summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-09-30 15:52:24 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-09-30 15:52:24 (GMT)
commitbadcaa75b4a5e5dfbb85f5abf856abcfcfa20533 (patch)
tree70df9d393d3b6946178378560834239c81fdabf0 /src
parent86b4c125372f02c21be81fff376817852c28afa9 (diff)
parent2e16dff13d260e8ba07534b36ac635c9e625e442 (diff)
downloadQt-badcaa75b4a5e5dfbb85f5abf856abcfcfa20533.zip
Qt-badcaa75b4a5e5dfbb85f5abf856abcfcfa20533.tar.gz
Qt-badcaa75b4a5e5dfbb85f5abf856abcfcfa20533.tar.bz2
Merge branch '4.6'
Conflicts: src/corelib/io/qdatastream.h
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp2
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp9
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.h2
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.cpp1
-rw-r--r--src/3rdparty/javascriptcore/VERSION4
-rw-r--r--src/3rdparty/phonon/mmf/TODO.txt29
-rw-r--r--src/3rdparty/phonon/mmf/abstractaudioeffect.cpp74
-rw-r--r--src/3rdparty/phonon/mmf/abstractaudioeffect.h105
-rw-r--r--src/3rdparty/phonon/mmf/abstractmediaplayer.cpp404
-rw-r--r--src/3rdparty/phonon/mmf/abstractmediaplayer.h119
-rw-r--r--src/3rdparty/phonon/mmf/abstractplayer.cpp174
-rw-r--r--src/3rdparty/phonon/mmf/abstractplayer.h166
-rw-r--r--src/3rdparty/phonon/mmf/audioequalizer.cpp85
-rw-r--r--src/3rdparty/phonon/mmf/audioequalizer.h62
-rw-r--r--src/3rdparty/phonon/mmf/audiooutput.cpp101
-rw-r--r--src/3rdparty/phonon/mmf/audiooutput.h93
-rw-r--r--src/3rdparty/phonon/mmf/audioplayer.cpp254
-rw-r--r--src/3rdparty/phonon/mmf/audioplayer.h106
-rw-r--r--src/3rdparty/phonon/mmf/backend.cpp194
-rw-r--r--src/3rdparty/phonon/mmf/backend.h56
-rw-r--r--src/3rdparty/phonon/mmf/bassboost.cpp44
-rw-r--r--src/3rdparty/phonon/mmf/bassboost.h58
-rw-r--r--src/3rdparty/phonon/mmf/defs.h43
-rw-r--r--src/3rdparty/phonon/mmf/dummyplayer.cpp131
-rw-r--r--src/3rdparty/phonon/mmf/dummyplayer.h76
-rw-r--r--src/3rdparty/phonon/mmf/effectfactory.cpp151
-rw-r--r--src/3rdparty/phonon/mmf/effectfactory.h76
-rw-r--r--src/3rdparty/phonon/mmf/mediaobject.cpp385
-rw-r--r--src/3rdparty/phonon/mmf/mediaobject.h140
-rw-r--r--src/3rdparty/phonon/mmf/mmf_medianode.cpp117
-rw-r--r--src/3rdparty/phonon/mmf/mmf_medianode.h100
-rw-r--r--src/3rdparty/phonon/mmf/mmf_videoplayer.cpp448
-rw-r--r--src/3rdparty/phonon/mmf/mmf_videoplayer.h111
-rw-r--r--src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.cpp527
-rw-r--r--src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.h166
-rw-r--r--src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_global.h30
-rw-r--r--src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_stub.cpp40
-rw-r--r--src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp135
-rw-r--r--src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.h56
-rw-r--r--src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.cpp102
-rw-r--r--src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.h117
-rw-r--r--src/3rdparty/phonon/mmf/utils.cpp142
-rw-r--r--src/3rdparty/phonon/mmf/utils.h167
-rw-r--r--src/3rdparty/phonon/mmf/videooutput.cpp173
-rw-r--r--src/3rdparty/phonon/mmf/videooutput.h67
-rw-r--r--src/3rdparty/phonon/mmf/videooutputobserver.h44
-rw-r--r--src/3rdparty/phonon/mmf/videowidget.cpp173
-rw-r--r--src/3rdparty/phonon/mmf/videowidget.h82
-rw-r--r--src/3rdparty/phonon/mmf/volumeobserver.h44
-rw-r--r--src/3rdparty/phonon/phonon/factory.cpp27
-rw-r--r--src/3rdparty/phonon/phonon/path.cpp8
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/Collector.h2
-rw-r--r--src/corelib/global/qnamespace.h5
-rw-r--r--src/corelib/global/qnamespace.qdoc28
-rw-r--r--src/corelib/io/io.pri2
-rw-r--r--src/corelib/io/qdatastream.cpp102
-rw-r--r--src/corelib/io/qdatastream.h13
-rw-r--r--src/corelib/io/qdatastream_p.h72
-rw-r--r--src/corelib/io/qfsfileengine_unix.cpp4
-rw-r--r--src/corelib/io/qtextstream.cpp77
-rw-r--r--src/corelib/io/qurl.cpp75
-rw-r--r--src/corelib/io/qurl.h2
-rw-r--r--src/corelib/kernel/qcoreevent.cpp1
-rw-r--r--src/corelib/kernel/qcoreevent.h4
-rw-r--r--src/corelib/statemachine/qstatemachine.cpp118
-rw-r--r--src/corelib/statemachine/qstatemachine.h11
-rw-r--r--src/corelib/statemachine/qstatemachine_p.h1
-rw-r--r--src/corelib/tools/qstringbuilder.h15
-rw-r--r--src/gui/dialogs/qfiledialog.cpp2
-rw-r--r--src/gui/dialogs/qfontdialog.cpp2
-rw-r--r--src/gui/effects/qgraphicseffect.cpp269
-rw-r--r--src/gui/effects/qgraphicseffect.h51
-rw-r--r--src/gui/effects/qgraphicseffect_p.h12
-rw-r--r--src/gui/gui.pro2
-rw-r--r--src/gui/image/qpixmapfilter.cpp8
-rw-r--r--src/gui/image/qpixmapfilter_p.h9
-rw-r--r--src/gui/kernel/qapplication_s60.cpp87
-rw-r--r--src/gui/kernel/qapplication_win.cpp61
-rw-r--r--src/gui/kernel/qkeysequence.cpp4
-rw-r--r--src/gui/kernel/qsoftkeymanager.cpp2
-rw-r--r--src/gui/kernel/qt_s60_p.h7
-rw-r--r--src/gui/kernel/qwidget.cpp10
-rw-r--r--src/gui/kernel/qwidget_p.h14
-rw-r--r--src/gui/kernel/qwidget_s60.cpp296
-rw-r--r--src/gui/s60framework/qs60mainapplication.h2
-rw-r--r--src/gui/styles/qs60style.cpp19
-rw-r--r--src/gui/styles/qs60style.h3
-rw-r--r--src/gui/styles/qwindowsvistastyle.cpp22
-rw-r--r--src/gui/styles/qwindowsvistastyle_p.h1
-rw-r--r--src/gui/text/qfont.h1
-rw-r--r--src/gui/text/qfontengine_qpf.cpp4
-rw-r--r--src/gui/text/qfontengine_qws.cpp4
-rw-r--r--src/gui/widgets/qcombobox.cpp10
-rw-r--r--src/gui/widgets/qcommandlinkbutton.cpp27
-rw-r--r--src/multimedia/audio/qaudioinput_alsa_p.cpp35
-rw-r--r--src/multimedia/audio/qaudioinput_alsa_p.h1
-rw-r--r--src/multimedia/audio/qaudioinput_win32_p.cpp12
-rw-r--r--src/multimedia/audio/qaudioinput_win32_p.h1
-rw-r--r--src/multimedia/audio/qaudiooutput_alsa_p.cpp33
-rw-r--r--src/multimedia/audio/qaudiooutput_alsa_p.h1
-rw-r--r--src/multimedia/audio/qaudiooutput_win32_p.cpp33
-rw-r--r--src/multimedia/audio/qaudiooutput_win32_p.h1
-rw-r--r--src/network/kernel/qhostinfo_win.cpp2
-rw-r--r--src/opengl/qgl_egl.cpp6
-rw-r--r--src/opengl/qglpixmapfilter.cpp197
-rw-r--r--src/opengl/qpaintengine_opengl.cpp16
-rw-r--r--src/openvg/qpaintengine_vg.cpp14
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp2
-rw-r--r--src/plugins/phonon/mmf/mmf.pro4
-rw-r--r--src/plugins/phonon/mmf/mmfphonondebug/mmfphonondebug.pro31
-rw-r--r--src/plugins/phonon/mmf/plugin/plugin.pro88
-rw-r--r--src/plugins/phonon/phonon.pro1
-rw-r--r--src/s60installs/qt.iby6
-rw-r--r--src/s60installs/s60installs.pro7
-rw-r--r--src/script/api/qscriptengine.cpp4
-rw-r--r--src/script/api/qscriptvalue.h4
-rw-r--r--src/script/script.pro8
-rw-r--r--src/scripttools/debugging/qscriptbreakpointsmodel.cpp13
-rw-r--r--src/scripttools/debugging/qscriptbreakpointswidget.cpp6
-rw-r--r--src/scripttools/debugging/qscriptdebugger.cpp58
-rw-r--r--src/scripttools/debugging/qscriptdebuggercodefinderwidget.cpp2
-rw-r--r--src/scripttools/debugging/qscriptdebuggerlocalsmodel.cpp5
-rw-r--r--src/scripttools/debugging/qscriptdebuggerstackmodel.cpp7
-rw-r--r--src/scripttools/debugging/qscriptedit.cpp8
-rw-r--r--src/scripttools/debugging/qscriptenginedebugger.cpp20
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.cpp17
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.h1
-rw-r--r--src/sql/drivers/tds/qsql_tds.cpp15
-rw-r--r--src/sql/drivers/tds/qsql_tds.h2
-rw-r--r--src/testlib/qtestsystem.h1
-rw-r--r--src/xml/dom/qdom.cpp17
-rw-r--r--src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp2
132 files changed, 7532 insertions, 630 deletions
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp
index 4200023..76c8510 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp
@@ -3084,6 +3084,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
#else
newCallFrame->init(0, vPC + 5, scopeChain, callFrame, dst, argCount, asObject(v));
#endif
+
Register* thisRegister = newCallFrame->registers() - RegisterFile::CallFrameHeaderSize - argCount;
ArgList args(thisRegister + 1, argCount - 1);
@@ -3242,7 +3243,6 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
newCallFrame->init(0, vPC + 5, scopeChain, callFrame, dst, argCount, asObject(v));
#endif
-
Register* thisRegister = newCallFrame->registers() - RegisterFile::CallFrameHeaderSize - argCount;
ArgList args(thisRegister + 1, argCount - 1);
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp
index 0b147df..08a4493 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp
@@ -2429,8 +2429,13 @@ DEFINE_STUB_FUNCTION(int, op_eq)
goto start;
}
- if (src2.isObject())
- return asObject(cell1) == asObject(src2);
+ if (src2.isObject()) {
+ return asObject(cell1) == asObject(src2)
+#ifdef QT_BUILD_SCRIPT_LIB
+ || asObject(cell1)->compareToObject(stackFrame.callFrame, asObject(src2))
+#endif
+ ;
+ }
src1 = asObject(cell1)->toPrimitive(stackFrame.callFrame);
CHECK_FOR_EXCEPTION();
goto start;
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.h b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.h
index 1a55bb5..0ecff19 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.h
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.h
@@ -181,7 +181,7 @@ namespace JSC {
#endif
template<> struct CellSize<sizeof(uint64_t)> { static const size_t m_value = 64; };
-#if PLATFORM(WINCE)
+#if PLATFORM(WINCE) || PLATFORM(SYMBIAN)
const size_t BLOCK_SIZE = 64 * 1024; // 64k
#else
const size_t BLOCK_SIZE = 64 * 4096; // 256k
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.cpp
index 05e3d7b..f7bda9e 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.cpp
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.cpp
@@ -46,7 +46,6 @@
#define DO_PROPERTYMAP_CONSTENCY_CHECK 0
#endif
-using namespace std;
using namespace WTF;
namespace JSC {
diff --git a/src/3rdparty/javascriptcore/VERSION b/src/3rdparty/javascriptcore/VERSION
index ae70d26..edcf898 100644
--- a/src/3rdparty/javascriptcore/VERSION
+++ b/src/3rdparty/javascriptcore/VERSION
@@ -4,8 +4,8 @@ This is a snapshot of JavaScriptCore from
The commit imported was from the
- jsc-for-qtscript-4.6-staging-28092009 branch/tag
+ jsc-for-qtscript-4.6-staging-30092009 branch/tag
and has the sha1 checksum
- b98dec961e9389ddd5e10d7c4086de9a297cb984
+ e8f42cf0203bee0ba89a05e0e773d713782129b4
diff --git a/src/3rdparty/phonon/mmf/TODO.txt b/src/3rdparty/phonon/mmf/TODO.txt
new file mode 100644
index 0000000..a2b1865
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/TODO.txt
@@ -0,0 +1,29 @@
+TODO list for MMF Phonon backend
+--------------------------------
+
+The following items are in rough order of priority.
+
+* Activating full-screen video playback in qmediaplayer causes the app to crash
+This may be symptomatic of more general problems with re-sizing / re-positioning video while playing.
+
+* Implement audio effects
+
+* Support for playing "file:" URLs
+
+* Support for network streaming playback
+The main question here is how best to implement the MIME type detection for streams. The OpenUrlL functions only take a URL, whereas the corresponding OpenFileL functions have overloads for filenames and for open RFile handles. This is because files support random access whereas streams do not. A naieve approach to MIME type detection for streams is as follows; is there a more efficient approach?
+ 1. Open network connection
+ 2. Download header
+ 3. Detect MIME type and create AbstractMediaPlayer instance
+ 4. Close network connection
+ 5. Pass URL to MMF client utility, which will then re-open the stream
+An alternative approach is to always create a VideoPlayer when passed an RTSP URL, and then modify VideoPlayer::hasVideo to check CVideoPlayerUtility::VideoMimeTypeL before returning. This way, we would always use CVideoPlayerUtility for RTSP streaming, whether the source is audio or video. Well-behaved client apps, however, should check MediaObject::hasVideo before creating the UI - and therefore the VideoWidget would only be connected if the source is actually a video stream.
+
+* Performance analysis
+Compare video frame rate obtained using default S60 media player and Qt demo apps
+
+* Implement MMF::Backend::disconnectNodes
+This should probably be left for now, particularly until audio effects have been implemented. This is because the node connection mechanism may need to be refactored slightly once we start building up longer graphs (e.g. MediaObject -> Effect -> Effect -> AudioOutput).
+
+* Metadata is not implemented.
+
diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp b/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp
new file mode 100644
index 0000000..b3155a6
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp
@@ -0,0 +1,74 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include "mediaobject.h"
+
+#include "abstractaudioeffect.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace Phonon;
+using namespace Phonon::MMF;
+
+AbstractAudioEffect::AbstractAudioEffect(QObject *parent,
+ const QList<EffectParameter> &params) : MediaNode::MediaNode(parent)
+ , m_params(params)
+{
+}
+
+bool AbstractAudioEffect::disconnectMediaNode(MediaNode *target)
+{
+ MediaNode::disconnectMediaNode(target);
+ m_effect.reset();
+ return true;
+}
+
+QList<EffectParameter> AbstractAudioEffect::parameters() const
+{
+ return m_params;
+}
+
+QVariant AbstractAudioEffect::parameterValue(const EffectParameter &queriedParam) const
+{
+ const QVariant &val = m_values.value(queriedParam.id());
+
+ if (val.isNull())
+ return queriedParam.defaultValue();
+ else
+ return val;
+}
+
+bool AbstractAudioEffect::activateOnMediaObject(MediaObject *mo)
+{
+ AudioPlayer *const ap = qobject_cast<AudioPlayer *>(mo->abstractPlayer());
+
+ if (ap)
+ return activateOn(ap->player());
+ else
+ return true;
+}
+
+void AbstractAudioEffect::setParameterValue(const EffectParameter &param,
+ const QVariant &newValue)
+{
+ m_values.insert(param.id(), newValue);
+ parameterChanged(param.id(), newValue);
+}
+
+QT_END_NAMESPACE
+
diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.h b/src/3rdparty/phonon/mmf/abstractaudioeffect.h
new file mode 100644
index 0000000..01542c9
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.h
@@ -0,0 +1,105 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef PHONON_MMF_ABSTRACTEFFECT_H
+#define PHONON_MMF_ABSTRACTEFFECT_H
+
+#include "mmf_medianode.h"
+
+#include <QScopedPointer>
+
+#include <AudioEffectBase.h>
+
+#include <Phonon/EffectInterface>
+#include <Phonon/EffectParameter>
+#include "audioplayer.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Phonon
+{
+namespace MMF
+{
+
+/**
+ * @short Base class for all effects for MMF.
+ *
+ * Adhering to Phonon with MMF is cumbersome because of a number of reasons:
+ *
+ * - MMF has no concept of effect chaining. Simply, an effect is a applied
+ * to PlayerUtility, that's it. This means that the order of effects is
+ * undefined.
+ * - We apply an effect to a PlayerUtility, and MediaObject has that one.
+ * However, effects might be created before MediaObject, but nevertheless
+ * needs to work. We solve this by that we are aware of the whole connection
+ * chain, and whenever a connection happens, we walk the chain, find effects
+ * that aren't applied, and apply it if we have a media object.
+ * - There are plenty of corner cases which we don't handle and where behavior
+ * are undefined. For instance, graphs with more than one MediaObject.
+ */
+class AbstractAudioEffect : public MediaNode
+ , public EffectInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(Phonon::EffectInterface)
+public:
+ AbstractAudioEffect(QObject *parent,
+ const QList<EffectParameter> &params);
+
+ virtual QList<EffectParameter> parameters() const;
+ virtual QVariant parameterValue(const EffectParameter &param) const;
+ virtual void setParameterValue(const EffectParameter &,
+ const QVariant &newValue);
+
+ virtual bool disconnectMediaNode(MediaNode *target);
+
+ enum Type
+ {
+ EffectAudioEqualizer = 1,
+ EffectBassBoost,
+ EffectDistanceAttenuation,
+ EffectEnvironmentalReverb,
+ EffectListenerOrientation,
+ EffectLoudness,
+ EffectSourceOrientation,
+ EffectStereoWidening
+ };
+
+protected:
+ virtual bool activateOn(CPlayerType *player) = 0;
+ virtual void parameterChanged(const int id,
+ const QVariant &value) = 0;
+
+ /**
+ * Part of the implementation of AbstractAudioEffect. Forwards the call to
+ * activateOn(), essentially.
+ */
+ virtual bool activateOnMediaObject(MediaObject *mo);
+
+ QScopedPointer<CAudioEffect> m_effect;
+private:
+ const QList<EffectParameter> m_params;
+ QHash<int, QVariant> m_values;
+};
+}
+}
+
+QT_END_NAMESPACE
+
+#endif
+
diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp
new file mode 100644
index 0000000..8fe1e4d
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp
@@ -0,0 +1,404 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include <QUrl>
+
+#include "abstractmediaplayer.h"
+#include "defs.h"
+#include "utils.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace Phonon;
+using namespace Phonon::MMF;
+
+//-----------------------------------------------------------------------------
+// Constants
+//-----------------------------------------------------------------------------
+
+const int NullMaxVolume = -1;
+
+
+//-----------------------------------------------------------------------------
+// Constructor / destructor
+//-----------------------------------------------------------------------------
+
+MMF::AbstractMediaPlayer::AbstractMediaPlayer() :
+ m_playPending(false)
+ , m_tickTimer(new QTimer(this))
+ , m_mmfMaxVolume(NullMaxVolume)
+{
+ connect(m_tickTimer.data(), SIGNAL(timeout()), this, SLOT(tick()));
+}
+
+MMF::AbstractMediaPlayer::AbstractMediaPlayer(const AbstractPlayer& player) :
+ AbstractPlayer(player)
+ , m_playPending(false)
+ , m_tickTimer(new QTimer(this))
+ , m_mmfMaxVolume(NullMaxVolume)
+{
+ connect(m_tickTimer.data(), SIGNAL(timeout()), this, SLOT(tick()));
+}
+
+//-----------------------------------------------------------------------------
+// MediaObjectInterface
+//-----------------------------------------------------------------------------
+
+void MMF::AbstractMediaPlayer::play()
+{
+ TRACE_CONTEXT(AbstractMediaPlayer::play, EAudioApi);
+ TRACE_ENTRY("state %d", privateState());
+
+ switch (privateState()) {
+ case GroundState:
+ setError(NormalError);
+ break;
+
+ case LoadingState:
+ m_playPending = true;
+ break;
+
+ case StoppedState:
+ case PausedState:
+ doPlay();
+ startTickTimer();
+ changeState(PlayingState);
+ break;
+
+ case PlayingState:
+ case BufferingState:
+ case ErrorState:
+ // Do nothing
+ break;
+
+ // Protection against adding new states and forgetting to update this switch
+ default:
+ TRACE_PANIC(InvalidStatePanic);
+ }
+
+ TRACE_EXIT("state %d", privateState());
+}
+
+void MMF::AbstractMediaPlayer::pause()
+{
+ TRACE_CONTEXT(AbstractMediaPlayer::pause, EAudioApi);
+ TRACE_ENTRY("state %d", privateState());
+
+ m_playPending = false;
+
+ switch (privateState()) {
+ case GroundState:
+ case LoadingState:
+ case PausedState:
+ case ErrorState:
+ // Do nothing
+ break;
+
+ case StoppedState:
+ case PlayingState:
+ case BufferingState:
+ doPause();
+ stopTickTimer();
+ changeState(PausedState);
+ break;
+
+ // Protection against adding new states and forgetting to update this switch
+ default:
+ TRACE_PANIC(InvalidStatePanic);
+ }
+
+ TRACE_EXIT("state %d", privateState());
+}
+
+void MMF::AbstractMediaPlayer::stop()
+{
+ TRACE_CONTEXT(AbstractMediaPlayer::stop, EAudioApi);
+ TRACE_ENTRY("state %d", privateState());
+
+ m_playPending = false;
+
+ switch (privateState()) {
+ case GroundState:
+ case LoadingState:
+ case StoppedState:
+ case ErrorState:
+ // Do nothing
+ break;
+
+ case PlayingState:
+ case BufferingState:
+ case PausedState:
+ doStop();
+ stopTickTimer();
+ changeState(StoppedState);
+ break;
+
+ // Protection against adding new states and forgetting to update this switch
+ default:
+ TRACE_PANIC(InvalidStatePanic);
+ }
+
+ TRACE_EXIT("state %d", privateState());
+}
+
+void MMF::AbstractMediaPlayer::seek(qint64 ms)
+{
+ TRACE_CONTEXT(AbstractMediaPlayer::seek, EAudioApi);
+ TRACE_ENTRY("state %d pos %Ld", state(), ms);
+
+ switch (privateState()) {
+ // Fallthrough all these
+ case GroundState:
+ case StoppedState:
+ case PausedState:
+ case PlayingState:
+ case LoadingState:
+ {
+ const bool tickTimerWasRunning = m_tickTimer->isActive();
+ stopTickTimer();
+
+ doSeek(ms);
+
+ if (tickTimerWasRunning) {
+ startTickTimer();
+ }
+ break;
+ }
+ case BufferingState:
+ // Fallthrough
+ case ErrorState:
+ // Do nothing
+ break;
+ }
+
+ TRACE_EXIT_0();
+}
+
+bool MMF::AbstractMediaPlayer::isSeekable() const
+{
+ return true;
+}
+
+void MMF::AbstractMediaPlayer::doSetTickInterval(qint32 interval)
+{
+ TRACE_CONTEXT(AbstractMediaPlayer::doSetTickInterval, EAudioApi);
+ TRACE_ENTRY("state %d m_interval %d interval %d", privateState(), tickInterval(), interval);
+
+ m_tickTimer->setInterval(interval);
+
+ TRACE_EXIT_0();
+}
+
+MediaSource MMF::AbstractMediaPlayer::source() const
+{
+ return m_source;
+}
+
+void MMF::AbstractMediaPlayer::setFileSource(const MediaSource &source, RFile& file)
+{
+ TRACE_CONTEXT(AbstractMediaPlayer::setFileSource, EAudioApi);
+ TRACE_ENTRY("state %d source.type %d", privateState(), source.type());
+
+ close();
+ changeState(GroundState);
+
+ // TODO: is it correct to assign even if the media type is not supported in
+ // the switch statement below?
+ m_source = source;
+
+ TInt symbianErr = KErrNone;
+
+ switch (m_source.type()) {
+ case MediaSource::LocalFile: {
+ symbianErr = openFile(file);
+ break;
+ }
+
+ case MediaSource::Url: {
+ const QUrl url(source.url());
+
+ if (url.scheme() == QLatin1String("file")) {
+ symbianErr = openFile(file);
+ }
+ else {
+ TRACE_0("Source type not supported");
+ // TODO: support network URLs
+ symbianErr = KErrNotSupported;
+ }
+
+ break;
+ }
+
+ case MediaSource::Invalid:
+ case MediaSource::Disc:
+ case MediaSource::Stream:
+ TRACE_0("Source type not supported");
+ symbianErr = KErrNotSupported;
+ break;
+
+ case MediaSource::Empty:
+ TRACE_0("Empty source - doing nothing");
+ TRACE_EXIT_0();
+ return;
+
+ // Protection against adding new media types and forgetting to update this switch
+ default:
+ TRACE_PANIC(InvalidMediaTypePanic);
+ }
+
+ if (KErrNone == symbianErr) {
+ changeState(LoadingState);
+ } else {
+ TRACE("error %d", symbianErr)
+ setError(NormalError);
+ }
+
+ TRACE_EXIT_0();
+}
+
+void MMF::AbstractMediaPlayer::setNextSource(const MediaSource &source)
+{
+ TRACE_CONTEXT(AbstractMediaPlayer::setNextSource, EAudioApi);
+ TRACE_ENTRY("state %d", privateState());
+
+ // TODO: handle 'next source'
+
+ m_nextSource = source;
+ Q_UNUSED(source);
+
+ TRACE_EXIT_0();
+}
+
+
+//-----------------------------------------------------------------------------
+// VolumeObserver
+//-----------------------------------------------------------------------------
+
+void MMF::AbstractMediaPlayer::volumeChanged(qreal volume)
+{
+ TRACE_CONTEXT(AbstractMediaPlayer::volumeChanged, EAudioInternal);
+ TRACE_ENTRY("state %d", privateState());
+
+ AbstractPlayer::volumeChanged(volume);
+ doVolumeChanged();
+
+ TRACE_EXIT_0();
+}
+
+
+void MMF::AbstractMediaPlayer::doVolumeChanged()
+{
+ switch (privateState()) {
+ case GroundState:
+ case LoadingState:
+ case ErrorState:
+ // Do nothing
+ break;
+
+ case StoppedState:
+ case PausedState:
+ case PlayingState:
+ case BufferingState: {
+ const int err = setDeviceVolume(m_volume * m_mmfMaxVolume);
+
+ if (KErrNone != err) {
+ setError(NormalError);
+ }
+ break;
+ }
+
+ // Protection against adding new states and forgetting to update this
+ // switch
+ default:
+ Utils::panic(InvalidStatePanic);
+ }
+}
+
+
+//-----------------------------------------------------------------------------
+// Protected functions
+//-----------------------------------------------------------------------------
+
+void MMF::AbstractMediaPlayer::startTickTimer()
+{
+ m_tickTimer->start(tickInterval());
+}
+
+void MMF::AbstractMediaPlayer::stopTickTimer()
+{
+ m_tickTimer->stop();
+}
+
+void MMF::AbstractMediaPlayer::maxVolumeChanged(int mmfMaxVolume)
+{
+ m_mmfMaxVolume = mmfMaxVolume;
+ doVolumeChanged();
+}
+
+qint64 MMF::AbstractMediaPlayer::toMilliSeconds(const TTimeIntervalMicroSeconds &in)
+{
+ return in.Int64() / 1000;
+}
+
+void MMF::AbstractMediaPlayer::changeState(PrivateState newState)
+{
+ TRACE_CONTEXT(AbstractPlayer::changeState, EAudioInternal);
+ TRACE_ENTRY("state %d newState %d", privateState(), newState);
+
+ // TODO: add some invariants to check that the transition is valid
+
+ const Phonon::State oldPhononState = phononState(privateState());
+ const Phonon::State newPhononState = phononState(newState);
+ if (oldPhononState != newPhononState) {
+ TRACE("emit stateChanged(%d, %d)", newPhononState, oldPhononState);
+ emit stateChanged(newPhononState, oldPhononState);
+ }
+
+ setState(newState);
+
+ if (
+ LoadingState == oldPhononState
+ and StoppedState == newPhononState
+ ) {
+ // Ensure initial volume is set on MMF API before starting playback
+ doVolumeChanged();
+
+ // Check whether play() was called while clip was being loaded. If so,
+ // playback should be started now
+ if (m_playPending) {
+ TRACE_0("play was called while loading; starting playback now");
+ m_playPending = false;
+ play();
+ }
+ }
+
+ TRACE_EXIT_0();
+}
+
+//-----------------------------------------------------------------------------
+// Slots
+//-----------------------------------------------------------------------------
+
+void MMF::AbstractMediaPlayer::tick()
+{
+ // For the MWC compiler, we need to qualify the base class.
+ emit MMF::AbstractPlayer::tick(currentTime());
+}
+
+QT_END_NAMESPACE
+
diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.h b/src/3rdparty/phonon/mmf/abstractmediaplayer.h
new file mode 100644
index 0000000..698b899
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.h
@@ -0,0 +1,119 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef PHONON_MMF_ABSTRACTMEDIAPLAYER_H
+#define PHONON_MMF_ABSTRACTMEDIAPLAYER_H
+
+#include <QTimer>
+#include <QScopedPointer>
+#include <e32std.h>
+#include "abstractplayer.h"
+
+class RFile;
+
+QT_BEGIN_NAMESPACE
+
+namespace Phonon
+{
+namespace MMF
+{
+class AudioOutput;
+
+/**
+ * Interface via which MMF client APIs for both audio and video can be
+ * accessed.
+ */
+class AbstractMediaPlayer : public AbstractPlayer
+{
+ Q_OBJECT
+
+protected:
+ AbstractMediaPlayer();
+ explicit AbstractMediaPlayer(const AbstractPlayer& player);
+
+public:
+ // MediaObjectInterface
+ virtual void play();
+ virtual void pause();
+ virtual void stop();
+ virtual void seek(qint64 milliseconds);
+ virtual bool isSeekable() const;
+ virtual MediaSource source() const;
+ virtual void setFileSource(const Phonon::MediaSource&, RFile&);
+ virtual void setNextSource(const MediaSource &source);
+
+ // VolumeObserver
+ virtual void volumeChanged(qreal volume);
+
+protected:
+ // AbstractPlayer
+ virtual void doSetTickInterval(qint32 interval);
+
+ virtual void doPlay() = 0;
+ virtual void doPause() = 0;
+ virtual void doStop() = 0;
+ virtual void doSeek(qint64 pos) = 0;
+ virtual int setDeviceVolume(int mmfVolume) = 0;
+ virtual int openFile(RFile& file) = 0;
+ virtual void close() = 0;
+
+ /**
+ * Changes state and emits stateChanged()
+ */
+ virtual void changeState(PrivateState newState);
+
+protected:
+ bool tickTimerRunning() const;
+ void startTickTimer();
+ void stopTickTimer();
+ void maxVolumeChanged(int maxVolume);
+
+ static qint64 toMilliSeconds(const TTimeIntervalMicroSeconds &);
+
+private:
+ void doVolumeChanged();
+
+private Q_SLOTS:
+ /**
+ * Receives signal from m_tickTimer
+ */
+ void tick();
+
+private:
+ /**
+ * This flag is set to true if play is called when the object is
+ * in a Loading state. Once loading is complete, playback will
+ * be started.
+ */
+ bool m_playPending;
+
+ QScopedPointer<QTimer> m_tickTimer;
+
+ int m_mmfMaxVolume;
+
+ MediaSource m_source;
+ MediaSource m_nextSource;
+
+};
+}
+}
+
+QT_END_NAMESPACE
+
+#endif
+
diff --git a/src/3rdparty/phonon/mmf/abstractplayer.cpp b/src/3rdparty/phonon/mmf/abstractplayer.cpp
new file mode 100644
index 0000000..24ef20a
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/abstractplayer.cpp
@@ -0,0 +1,174 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include "abstractplayer.h"
+#include "defs.h"
+#include "utils.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace Phonon;
+using namespace Phonon::MMF;
+
+
+//-----------------------------------------------------------------------------
+// Constructor / destructor
+//-----------------------------------------------------------------------------
+
+MMF::AbstractPlayer::AbstractPlayer()
+ : m_videoOutput(0)
+ , m_volume(InitialVolume)
+ , m_state(GroundState)
+ , m_error(NoError)
+ , m_tickInterval(DefaultTickInterval)
+ , m_transitionTime(0)
+ , m_prefinishMark(0)
+{
+
+}
+
+MMF::AbstractPlayer::AbstractPlayer(const AbstractPlayer& player)
+ : m_videoOutput(player.m_videoOutput)
+ , m_volume(player.m_volume)
+ , m_state(GroundState)
+ , m_error(NoError)
+ , m_tickInterval(player.tickInterval())
+ , m_transitionTime(player.transitionTime())
+ , m_prefinishMark(player.prefinishMark())
+{
+
+}
+
+//-----------------------------------------------------------------------------
+// MediaObjectInterface
+//-----------------------------------------------------------------------------
+
+qint32 MMF::AbstractPlayer::tickInterval() const
+{
+ return m_tickInterval;
+}
+
+void MMF::AbstractPlayer::setTickInterval(qint32 interval)
+{
+ m_tickInterval = interval;
+ doSetTickInterval(interval);
+}
+
+qint32 MMF::AbstractPlayer::prefinishMark() const
+{
+ return m_prefinishMark;
+}
+
+void MMF::AbstractPlayer::setPrefinishMark(qint32 mark)
+{
+ m_prefinishMark = mark;
+}
+
+qint32 MMF::AbstractPlayer::transitionTime() const
+{
+ return m_transitionTime;
+}
+
+void MMF::AbstractPlayer::setTransitionTime(qint32 time)
+{
+ m_transitionTime = time;
+}
+
+
+//-----------------------------------------------------------------------------
+// VolumeObserver
+//-----------------------------------------------------------------------------
+
+void MMF::AbstractPlayer::volumeChanged(qreal volume)
+{
+ m_volume = volume;
+}
+
+
+//-----------------------------------------------------------------------------
+// Video output
+//-----------------------------------------------------------------------------
+
+void MMF::AbstractPlayer::setVideoOutput(VideoOutput* videoOutput)
+{
+ m_videoOutput = videoOutput;
+ videoOutputChanged();
+}
+
+void MMF::AbstractPlayer::videoOutputChanged()
+{
+ // Default behaviour is empty - overridden by VideoPlayer
+}
+
+void MMF::AbstractPlayer::setError(Phonon::ErrorType error)
+{
+ TRACE_CONTEXT(AbstractPlayer::setError, EAudioInternal);
+ TRACE_ENTRY("state %d error %d", m_state, error);
+
+ m_error = error;
+ changeState(ErrorState);
+
+ TRACE_EXIT_0();
+}
+
+Phonon::ErrorType MMF::AbstractPlayer::errorType() const
+{
+ const Phonon::ErrorType result = (ErrorState == m_state)
+ ? errorType() : NoError;
+ return result;
+}
+
+QString MMF::AbstractPlayer::errorString() const
+{
+ // TODO: put in proper error strings
+ QString result;
+ return result;
+}
+
+Phonon::State MMF::AbstractPlayer::phononState() const
+{
+ return phononState(m_state);
+}
+
+Phonon::State MMF::AbstractPlayer::phononState(PrivateState state)
+{
+ const Phonon::State phononState =
+ GroundState == state
+ ? Phonon::LoadingState
+ : static_cast<Phonon::State>(state);
+
+ return phononState;
+}
+
+AbstractPlayer::PrivateState AbstractPlayer::privateState() const
+{
+ return m_state;
+}
+
+Phonon::State MMF::AbstractPlayer::state() const
+{
+ return phononState(m_state);
+}
+
+void MMF::AbstractPlayer::setState(PrivateState newState)
+{
+ m_state = newState;
+}
+
+QT_END_NAMESPACE
+
diff --git a/src/3rdparty/phonon/mmf/abstractplayer.h b/src/3rdparty/phonon/mmf/abstractplayer.h
new file mode 100644
index 0000000..ec39ab1
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/abstractplayer.h
@@ -0,0 +1,166 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef PHONON_MMF_ABSTRACTPLAYER_H
+#define PHONON_MMF_ABSTRACTPLAYER_H
+
+#include <Phonon/phononnamespace.h>
+#include <Phonon/MediaSource.h>
+
+#include <QObject>
+
+#include "volumeobserver.h"
+
+#include "videooutput.h"
+
+class RFile;
+
+QT_BEGIN_NAMESPACE
+
+namespace Phonon
+{
+namespace MMF
+{
+class VideoOutput;
+
+/**
+ * @short Interface which abstracts from MediaObject the current
+ * media type
+ *
+ * This may be:
+ * - Nothing, in which case this interface is implemented by
+ * DummyPlayer
+ * - Audio, in which case the implementation is AudioPlayer
+ * - Video, in which case the implementation is VideoPlayer
+ */
+class AbstractPlayer : public QObject
+ , public VolumeObserver
+{
+ // Required although this class has no signals or slots
+ // Without this, qobject_cast will fail
+ Q_OBJECT
+
+public:
+ AbstractPlayer();
+ explicit AbstractPlayer(const AbstractPlayer& player);
+
+ // MediaObjectInterface (implemented)
+ qint32 tickInterval() const;
+ void setTickInterval(qint32);
+ void setTransitionTime(qint32);
+ qint32 transitionTime() const;
+ void setPrefinishMark(qint32);
+ qint32 prefinishMark() const;
+
+ // MediaObjectInterface (abstract)
+ virtual void play() = 0;
+ virtual void pause() = 0;
+ virtual void stop() = 0;
+ virtual void seek(qint64 milliseconds) = 0;
+ virtual bool hasVideo() const = 0;
+ virtual bool isSeekable() const = 0;
+ virtual qint64 currentTime() const = 0;
+ virtual Phonon::ErrorType errorType() const;
+ virtual QString errorString() const;
+ virtual qint64 totalTime() const = 0;
+ virtual Phonon::MediaSource source() const = 0;
+ // This is a temporary hack to work around KErrInUse from MMF
+ // client utility OpenFileL calls
+ //virtual void setSource(const Phonon::MediaSource &) = 0;
+ virtual void setFileSource(const Phonon::MediaSource&, RFile&) = 0;
+ virtual void setNextSource(const Phonon::MediaSource &) = 0;
+
+ // VolumeObserver
+ virtual void volumeChanged(qreal volume);
+
+ void setVideoOutput(VideoOutput* videoOutput);
+
+ /**
+ * Records error and changes state to ErrorState
+ */
+ void setError(Phonon::ErrorType error);
+
+ Phonon::State state() const;
+Q_SIGNALS:
+ void totalTimeChanged(qint64 length);
+ void finished();
+ void tick(qint64 time);
+ void stateChanged(Phonon::State oldState,
+ Phonon::State newState);
+
+
+protected:
+ /**
+ * Defined private state enumeration in order to add GroundState
+ */
+ enum PrivateState {
+ LoadingState = Phonon::LoadingState,
+ StoppedState = Phonon::StoppedState,
+ PlayingState = Phonon::PlayingState,
+ BufferingState = Phonon::BufferingState,
+ PausedState = Phonon::PausedState,
+ ErrorState = Phonon::ErrorState,
+ GroundState
+ };
+
+ /**
+ * Converts PrivateState into the corresponding Phonon::State
+ */
+ Phonon::State phononState() const;
+
+ /**
+ * Converts PrivateState into the corresponding Phonon::State
+ */
+ static Phonon::State phononState(PrivateState state);
+
+ virtual void videoOutputChanged();
+
+ PrivateState privateState() const;
+
+ virtual void changeState(PrivateState newState) = 0;
+
+ /**
+ * Modifies m_state directly. Typically you want to call changeState(),
+ * which performs the business logic.
+ */
+ void setState(PrivateState newState);
+
+private:
+ virtual void doSetTickInterval(qint32 interval) = 0;
+
+protected:
+ // Not owned
+ VideoOutput* m_videoOutput;
+
+ qreal m_volume;
+
+private:
+ PrivateState m_state;
+ Phonon::ErrorType m_error;
+ qint32 m_tickInterval;
+ qint32 m_transitionTime;
+ qint32 m_prefinishMark;
+
+};
+}
+}
+
+QT_END_NAMESPACE
+
+#endif
+
diff --git a/src/3rdparty/phonon/mmf/audioequalizer.cpp b/src/3rdparty/phonon/mmf/audioequalizer.cpp
new file mode 100644
index 0000000..78c6ff7
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/audioequalizer.cpp
@@ -0,0 +1,85 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include "audioequalizer.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace Phonon;
+using namespace Phonon::MMF;
+
+AudioEqualizer::AudioEqualizer(QObject *parent) : AbstractAudioEffect::AbstractAudioEffect(parent, createParams())
+{
+}
+
+void AudioEqualizer::parameterChanged(const int pid,
+ const QVariant &value)
+{
+ // There is no way to return an error from this function, so we just
+ // have to trap and ignore exceptions.
+ TRAP_IGNORE(eq()->SetBandLevelL(pid, value.toInt()));
+}
+
+bool AudioEqualizer::activateOn(CPlayerType *player)
+{
+ m_effect.reset(CAudioEqualizer::NewL(*player));
+ return true;
+}
+
+CAudioEqualizer *AudioEqualizer::eq() const
+{
+ return static_cast<CAudioEqualizer *>(m_effect.data());
+}
+
+QList<EffectParameter> AudioEqualizer::createParams()
+{
+ QList<EffectParameter> retval;
+
+ // We temporarily create an AudioPlayer, and run the effect on it, so
+ // we can extract the readonly data we need.
+ AudioPlayer dummyPlayer;
+ activateOn(dummyPlayer.player());
+
+ TInt32 dbMin;
+ TInt32 dbMax;
+ eq()->DbLevelLimits(dbMin, dbMax);
+
+ const int bandCount = eq()->NumberOfBands();
+
+ for (int i = 0; i < bandCount; ++i) {
+ const qint32 hz = eq()->CenterFrequency(i);
+
+ const qint32 defVol = eq()->BandLevel(i);
+
+ retval.append(EffectParameter(i,
+ tr("Frequency band, %1 Hz").arg(hz),
+ EffectParameter::LogarithmicHint,
+ QVariant(qint32(defVol)),
+ QVariant(qint32(dbMin)),
+ QVariant(qint32(dbMax)),
+ QVariantList(),
+ QString()));
+ }
+
+ m_effect.reset();
+
+ return retval;
+}
+
+QT_END_NAMESPACE
+
diff --git a/src/3rdparty/phonon/mmf/audioequalizer.h b/src/3rdparty/phonon/mmf/audioequalizer.h
new file mode 100644
index 0000000..6415411
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/audioequalizer.h
@@ -0,0 +1,62 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef PHONON_MMF_AUDIOEQUALIZER_H
+#define PHONON_MMF_AUDIOEQUALIZER_H
+
+#include <AudioEqualizerBase.h>
+#include "abstractaudioeffect.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Phonon
+{
+namespace MMF
+{
+/**
+ * @short A classic equalizer.
+ *
+ * The equalizer has a number of bands, and each band has a frequency, and a
+ * volume. With Phonon's API, this is modeled such that each band is one
+ * Phonon::EffectParameter, where Phonon::EffectParameter::id() is the band
+ * number, and the setting is the volume level.
+ */
+class AudioEqualizer : public AbstractAudioEffect
+{
+ Q_OBJECT
+public:
+ AudioEqualizer(QObject *parent);
+
+protected:
+ virtual void parameterChanged(const int id,
+ const QVariant &value);
+
+ virtual bool activateOn(CPlayerType *player);
+
+private:
+ inline CAudioEqualizer *eq() const;
+ QList<EffectParameter> createParams();
+ QScopedPointer<CAudioEqualizer> m_bassBoost;
+};
+}
+}
+
+QT_END_NAMESPACE
+
+#endif
+
diff --git a/src/3rdparty/phonon/mmf/audiooutput.cpp b/src/3rdparty/phonon/mmf/audiooutput.cpp
new file mode 100644
index 0000000..8c8c330
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/audiooutput.cpp
@@ -0,0 +1,101 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include <e32debug.h>
+
+#include "audiooutput.h"
+#include "defs.h"
+#include "mediaobject.h"
+#include "utils.h"
+#include "volumeobserver.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace Phonon;
+using namespace Phonon::MMF;
+
+
+//-----------------------------------------------------------------------------
+// Constructor / destructor
+//-----------------------------------------------------------------------------
+
+MMF::AudioOutput::AudioOutput(Backend *, QObject *parent) : MediaNode(parent)
+ , m_volume(InitialVolume)
+ , m_observer(0)
+{
+
+}
+
+
+//-----------------------------------------------------------------------------
+// Public API
+//-----------------------------------------------------------------------------
+
+qreal MMF::AudioOutput::volume() const
+{
+ return m_volume;
+}
+
+void MMF::AudioOutput::setVolume(qreal volume)
+{
+ TRACE_CONTEXT(AudioOutput::setVolume, EAudioApi);
+ TRACE_ENTRY("observer 0x%08x volume %f", m_observer, volume);
+
+ if (volume != m_volume) {
+ if (m_observer) {
+ m_observer->volumeChanged(volume);
+ }
+
+ m_volume = volume;
+ TRACE("emit volumeChanged(%f)", volume)
+ emit volumeChanged(volume);
+ }
+
+ TRACE_EXIT_0();
+}
+
+int MMF::AudioOutput::outputDevice() const
+{
+ return 0;
+}
+
+bool MMF::AudioOutput::setOutputDevice(int)
+{
+ return true;
+}
+
+bool MMF::AudioOutput::setOutputDevice(const Phonon::AudioOutputDevice &)
+{
+ return true;
+}
+
+void MMF::AudioOutput::setVolumeObserver(VolumeObserver* observer)
+{
+ m_observer = observer;
+ if (m_observer) {
+ m_observer->volumeChanged(m_volume);
+ }
+}
+
+bool MMF::AudioOutput::activateOnMediaObject(MediaObject *mo)
+{
+ setVolumeObserver(mo);
+ return true;
+}
+
+QT_END_NAMESPACE
diff --git a/src/3rdparty/phonon/mmf/audiooutput.h b/src/3rdparty/phonon/mmf/audiooutput.h
new file mode 100644
index 0000000..0a962a9
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/audiooutput.h
@@ -0,0 +1,93 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef PHONON_MMF_AUDIOOUTPUT_H
+#define PHONON_MMF_AUDIOOUTPUT_H
+
+#include "mmf_medianode.h"
+#include <phonon/audiooutputinterface.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Phonon
+{
+namespace MMF
+{
+class Backend;
+class VolumeObserver;
+
+/**
+ * @short AudioOutputInterface implementation for MMF.
+ *
+ * Forwards volume commands to the VolumeObserver instance,
+ * which is provided by the backend when MediaNode objects are
+ * connected.
+ *
+ * \section volume Volume
+ *
+ * Phonon's concept on volume is from 0.0 to 1.0, and from 1< it does
+ * voltage multiplication. CDrmPlayerUtility goes from 1 to
+ * CDrmPlayerUtility::MaxVolume(). We apply some basic math to convert
+ * between the two.
+ *
+ * @author Frans Englich<frans.englich@nokia.com>
+ */
+class AudioOutput : public MediaNode
+ , public AudioOutputInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(Phonon::AudioOutputInterface)
+
+public:
+ AudioOutput(Backend *backend, QObject *parent);
+ virtual qreal volume() const;
+ virtual void setVolume(qreal volume);
+
+ virtual int outputDevice() const;
+
+ /**
+ * Has no effect.
+ */
+ virtual bool setOutputDevice(int);
+
+ /**
+ * Has no effect.
+ */
+ virtual bool setOutputDevice(const Phonon::AudioOutputDevice &);
+
+protected:
+ virtual bool activateOnMediaObject(MediaObject *mo);
+
+Q_SIGNALS:
+ void volumeChanged(qreal volume);
+ void audioDeviceFailed();
+
+private:
+ void setVolumeObserver(VolumeObserver* observer);
+
+ qreal m_volume;
+
+ // Not owned
+ VolumeObserver* m_observer;
+};
+}
+}
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/3rdparty/phonon/mmf/audioplayer.cpp b/src/3rdparty/phonon/mmf/audioplayer.cpp
new file mode 100644
index 0000000..3a4e04b
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/audioplayer.cpp
@@ -0,0 +1,254 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include <QUrl>
+
+#include "audioplayer.h"
+#include "utils.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace Phonon;
+using namespace Phonon::MMF;
+
+//-----------------------------------------------------------------------------
+// Constructor / destructor
+//-----------------------------------------------------------------------------
+
+MMF::AudioPlayer::AudioPlayer() : m_player(0)
+{
+ construct();
+}
+
+MMF::AudioPlayer::AudioPlayer(const AbstractPlayer& player)
+ : AbstractMediaPlayer(player)
+ , m_player(0)
+{
+ construct();
+}
+
+void MMF::AudioPlayer::construct()
+{
+ TRACE_CONTEXT(AudioPlayer::AudioPlayer, EAudioApi);
+ TRACE_ENTRY_0();
+
+ TRAPD(err, m_player = CPlayerType::NewL(*this, 0, EMdaPriorityPreferenceNone));
+ if (KErrNone != err) {
+ changeState(ErrorState);
+ }
+
+ TRACE_EXIT_0();
+}
+
+MMF::AudioPlayer::~AudioPlayer()
+{
+ TRACE_CONTEXT(AudioPlayer::~AudioPlayer, EAudioApi);
+ TRACE_ENTRY_0();
+
+ delete m_player;
+
+ TRACE_EXIT_0();
+}
+
+//-----------------------------------------------------------------------------
+// Public API
+//-----------------------------------------------------------------------------
+
+void MMF::AudioPlayer::doPlay()
+{
+ m_player->Play();
+}
+
+void MMF::AudioPlayer::doPause()
+{
+ m_player->Pause();
+}
+
+void MMF::AudioPlayer::doStop()
+{
+ m_player->Stop();
+}
+
+void MMF::AudioPlayer::doSeek(qint64 ms)
+{
+ m_player->SetPosition(TTimeIntervalMicroSeconds(ms * 1000));
+}
+
+int MMF::AudioPlayer::setDeviceVolume(int mmfVolume)
+{
+ /* In SDK 3.1, SetVolume() returns void. If we're compiling against
+ * 3.1, we handle it with ifdefs. However, if we compile against a later
+ * SDK but are _running_ against 3.1, we avoid returning from an undefined
+ * stack by doing a runtime check of the SDK version. */
+#if !defined(__SERIES60_31__)
+ const int err = m_player->SetVolume(mmfVolume);
+ if (QSysInfo::s60Version() > QSysInfo::SV_S60_3_1)
+ return err;
+ else
+ return KErrNone;
+ #else
+ m_player->SetVolume(mmfVolume);
+ return KErrNone;
+#endif
+}
+
+int MMF::AudioPlayer::openFile(RFile& file)
+{
+ TRAPD(err, m_player->OpenFileL(file));
+
+#ifdef QT_PHONON_MMF_AUDIO_DRM
+ if (KErrNone == err) {
+ // There appears to be a bug in the CDrmPlayerUtility implementation (at least
+ // in S60 5.x) whereby the player does not check whether the loading observer
+ // pointer is null before dereferencing it. Therefore we must register for
+ // loading notification, even though we do nothing in the callback functions.
+ m_player->RegisterForAudioLoadingNotification(*this);
+ }
+#endif
+
+ return err;
+}
+
+void MMF::AudioPlayer::close()
+{
+ m_player->Close();
+}
+
+bool MMF::AudioPlayer::hasVideo() const
+{
+ return false;
+}
+
+qint64 MMF::AudioPlayer::currentTime() const
+{
+ TRACE_CONTEXT(AudioPlayer::currentTime, EAudioApi);
+
+ TTimeIntervalMicroSeconds us;
+ const TInt err = m_player->GetPosition(us);
+
+ qint64 result = 0;
+
+ if (KErrNone == err) {
+ result = toMilliSeconds(us);
+ } else {
+ TRACE("GetPosition err %d", err);
+
+ // If we don't cast away constness here, we simply have to ignore
+ // the error.
+ const_cast<AudioPlayer*>(this)->setError(NormalError);
+ }
+
+ return result;
+}
+
+qint64 MMF::AudioPlayer::totalTime() const
+{
+ return toMilliSeconds(m_player->Duration());
+}
+
+
+//-----------------------------------------------------------------------------
+// Symbian multimedia client observer callbacks
+//-----------------------------------------------------------------------------
+
+#ifdef QT_PHONON_MMF_AUDIO_DRM
+void MMF::AudioPlayer::MdapcInitComplete(TInt aError,
+ const TTimeIntervalMicroSeconds &)
+#else
+void MMF::AudioPlayer::MapcInitComplete(TInt aError,
+ const TTimeIntervalMicroSeconds &)
+#endif
+{
+ TRACE_CONTEXT(AudioPlayer::MapcInitComplete, EAudioInternal);
+ TRACE_ENTRY("state %d error %d", state(), aError);
+
+ __ASSERT_ALWAYS(LoadingState == state(), Utils::panic(InvalidStatePanic));
+
+ if (KErrNone == aError) {
+ maxVolumeChanged(m_player->MaxVolume());
+
+ emit totalTimeChanged(totalTime());
+ changeState(StoppedState);
+ } else {
+ // TODO: set different error states according to value of aError?
+ setError(NormalError);
+ }
+
+ TRACE_EXIT_0();
+}
+
+#ifdef QT_PHONON_MMF_AUDIO_DRM
+void MMF::AudioPlayer::MdapcPlayComplete(TInt aError)
+#else
+void MMF::AudioPlayer::MapcPlayComplete(TInt aError)
+#endif
+{
+ TRACE_CONTEXT(AudioPlayer::MapcPlayComplete, EAudioInternal);
+ TRACE_ENTRY("state %d error %d", state(), aError);
+
+ stopTickTimer();
+
+ if (KErrNone == aError) {
+ changeState(StoppedState);
+ // TODO: move on to m_nextSource
+ } else {
+ // TODO: do something with aError?
+ setError(NormalError);
+ }
+
+ /*
+ if(aError == KErrNone) {
+ if(m_nextSource.type() == MediaSource::Empty) {
+ emit finished();
+ } else {
+ setSource(m_nextSource);
+ m_nextSource = MediaSource();
+ }
+
+ changeState(StoppedState);
+ }
+ else {
+ m_error = NormalError;
+ changeState(ErrorState);
+ }
+ */
+
+ TRACE_EXIT_0();
+}
+
+CPlayerType *MMF::AudioPlayer::player() const
+{
+ return m_player;
+}
+
+
+#ifdef QT_PHONON_MMF_AUDIO_DRM
+void MMF::AudioPlayer::MaloLoadingStarted()
+{
+
+}
+
+void MMF::AudioPlayer::MaloLoadingComplete()
+{
+
+}
+#endif // QT_PHONON_MMF_AUDIO_DRM
+
+
+QT_END_NAMESPACE
+
diff --git a/src/3rdparty/phonon/mmf/audioplayer.h b/src/3rdparty/phonon/mmf/audioplayer.h
new file mode 100644
index 0000000..f16de1d
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/audioplayer.h
@@ -0,0 +1,106 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef PHONON_MMF_AUDIOPLAYER_H
+#define PHONON_MMF_AUDIOPLAYER_H
+
+#include "abstractmediaplayer.h"
+
+class CDrmPlayerUtility;
+class TTimeIntervalMicroSeconds;
+
+#ifdef QT_PHONON_MMF_AUDIO_DRM
+#include <drmaudiosampleplayer.h>
+typedef CDrmPlayerUtility CPlayerType;
+typedef MDrmAudioPlayerCallback MPlayerObserverType;
+#else
+#include <mdaaudiosampleplayer.h>
+typedef CMdaAudioPlayerUtility CPlayerType;
+typedef MMdaAudioPlayerCallback MPlayerObserverType;
+#endif
+
+QT_BEGIN_NAMESPACE
+
+namespace Phonon
+{
+namespace MMF
+{
+/**
+ * @short Wrapper over MMF audio client utility
+ */
+class AudioPlayer : public AbstractMediaPlayer
+ , public MPlayerObserverType // typedef
+#ifdef QT_PHONON_MMF_AUDIO_DRM
+ , public MAudioLoadingObserver
+#endif
+{
+ Q_OBJECT
+
+public:
+ AudioPlayer();
+ explicit AudioPlayer(const AbstractPlayer& player);
+ virtual ~AudioPlayer();
+
+ // AbstractMediaPlayer
+ virtual void doPlay();
+ virtual void doPause();
+ virtual void doStop();
+ virtual void doSeek(qint64 milliseconds);
+ virtual int setDeviceVolume(int mmfVolume);
+ virtual int openFile(RFile& file);
+ virtual void close();
+
+ // MediaObjectInterface
+ virtual bool hasVideo() const;
+ virtual qint64 currentTime() const;
+ virtual qint64 totalTime() const;
+
+#ifdef QT_PHONON_MMF_AUDIO_DRM
+ // MDrmAudioPlayerCallback
+ virtual void MdapcInitComplete(TInt aError,
+ const TTimeIntervalMicroSeconds &aDuration);
+ virtual void MdapcPlayComplete(TInt aError);
+
+ // MAudioLoadingObserver
+ virtual void MaloLoadingStarted();
+ virtual void MaloLoadingComplete();
+#else
+ // MMdaAudioPlayerCallback
+ virtual void MapcInitComplete(TInt aError,
+ const TTimeIntervalMicroSeconds &aDuration);
+ virtual void MapcPlayComplete(TInt aError);
+#endif
+
+ CPlayerType *player() const;
+
+private:
+ void construct();
+
+private:
+ /**
+ * Using CPlayerType typedef in order to be able to easily switch between
+ * CMdaAudioPlayerUtility and CDrmPlayerUtility
+ */
+ CPlayerType* m_player;
+};
+}
+}
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/3rdparty/phonon/mmf/backend.cpp b/src/3rdparty/phonon/mmf/backend.cpp
new file mode 100644
index 0000000..0a9130c
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/backend.cpp
@@ -0,0 +1,194 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include <QStringList>
+#include <QtPlugin>
+
+#include <apgcli.h> // for RApaLsSession
+#include <apmrec.h> // for CDataTypeArray
+#include <apmstd.h> // for TDataType
+
+#include "abstractaudioeffect.h"
+#include "audiooutput.h"
+#include "audioplayer.h"
+#include "backend.h"
+#include "effectfactory.h"
+#include "mediaobject.h"
+#include "utils.h"
+#include "videowidget.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace Phonon;
+using namespace Phonon::MMF;
+
+Backend::Backend(QObject *parent) : QObject(parent)
+{
+ TRACE_CONTEXT(Backend::Backend, EBackend);
+ TRACE_ENTRY_0();
+
+ setProperty("identifier", QLatin1String("phonon_mmf"));
+ setProperty("backendName", QLatin1String("MMF"));
+ setProperty("backendComment", QLatin1String("Backend using Symbian Multimedia Framework (MMF)"));
+ setProperty("backendVersion", QLatin1String("0.1"));
+ setProperty("backendWebsite", QLatin1String("http://qt.nokia.com/"));
+
+ TRACE_EXIT_0();
+}
+
+QObject *Backend::createObject(BackendInterface::Class c, QObject *parent, const QList<QVariant> &args)
+{
+ TRACE_CONTEXT(Backend::createObject, EBackend);
+ TRACE_ENTRY("class %d", c);
+
+ QObject* result = 0;
+
+ switch (c) {
+ case AudioOutputClass:
+ result = new AudioOutput(this, parent);
+ break;
+
+ case MediaObjectClass:
+ result = new MediaObject(parent);
+ break;
+
+ case VolumeFaderEffectClass:
+ case VisualizationClass:
+ case VideoDataOutputClass:
+ case EffectClass:
+ {
+ Q_ASSERT(args.count() == 1);
+ Q_ASSERT(args.first().type() == QVariant::Int);
+ const AbstractAudioEffect::Type effect = AbstractAudioEffect::Type(args.first().toInt());
+
+ return EffectFactory::createAudioEffect(effect, parent);
+ }
+ case VideoWidgetClass:
+ result = new VideoWidget(qobject_cast<QWidget *>(parent));
+ break;
+
+ default:
+ TRACE_PANIC(InvalidBackendInterfaceClass);
+ }
+
+ TRACE_RETURN("0x%08x", result);
+}
+
+QList<int> Backend::objectDescriptionIndexes(ObjectDescriptionType type) const
+{
+ TRACE_CONTEXT(Backend::objectDescriptionIndexes, EAudioApi);
+ TRACE_ENTRY_0();
+ QList<int> retval;
+
+ switch(type)
+ {
+ case EffectType:
+ retval.append(EffectFactory::effectIndexes());
+ default:
+ ;
+ }
+
+ TRACE_EXIT_0();
+ return retval;
+}
+
+QHash<QByteArray, QVariant> Backend::objectDescriptionProperties(ObjectDescriptionType type, int index) const
+{
+ TRACE_CONTEXT(Backend::connectNodes, EBackend);
+
+ if (type == EffectType)
+ return EffectFactory::audioEffectDescriptions(AbstractAudioEffect::Type(index));
+ else
+ return QHash<QByteArray, QVariant>();
+}
+
+bool Backend::startConnectionChange(QSet<QObject *>)
+{
+ return true;
+}
+
+bool Backend::connectNodes(QObject *source, QObject *target)
+{
+ TRACE_CONTEXT(Backend::connectNodes, EBackend);
+ TRACE_ENTRY("source 0x%08x target 0x%08x", source, target);
+ Q_ASSERT(qobject_cast<MediaNode *>(source));
+ Q_ASSERT(qobject_cast<MediaNode *>(target));
+
+ MediaNode *const mediaSource = static_cast<MediaNode *>(source);
+ MediaNode *const mediaTarget = static_cast<MediaNode *>(target);
+
+ return mediaSource->connectMediaNode(mediaTarget);
+}
+
+bool Backend::disconnectNodes(QObject *source, QObject *target)
+{
+ TRACE_CONTEXT(Backend::disconnectNodes, EBackend);
+ TRACE_ENTRY("source 0x%08x target 0x%08x", source, target);
+ Q_ASSERT(qobject_cast<MediaNode *>(source));
+ Q_ASSERT(qobject_cast<MediaNode *>(target));
+
+ const bool result = static_cast<MediaNode *>(source)->disconnectMediaNode(static_cast<MediaNode *>(target));
+
+ TRACE_RETURN("%d", result);
+}
+
+bool Backend::endConnectionChange(QSet<QObject *>)
+{
+ return true;
+}
+
+void getAvailableMimeTypesL(QStringList& result)
+{
+ RApaLsSession apaSession;
+ User::LeaveIfError(apaSession.Connect());
+ CleanupClosePushL(apaSession);
+
+ static const TInt DataTypeArrayGranularity = 8;
+ CDataTypeArray* array = new(ELeave) CDataTypeArray(DataTypeArrayGranularity);
+ CleanupStack::PushL(array);
+
+ apaSession.GetSupportedDataTypesL(*array);
+
+ for (TInt i = 0; i < array->Count(); ++i) {
+ const TPtrC mimeType = array->At(i).Des();
+ const MediaType mediaType = Utils::mimeTypeToMediaType(mimeType);
+ if (MediaTypeAudio == mediaType or MediaTypeVideo == mediaType) {
+ result.append(qt_TDesC2QString(mimeType));
+ }
+ }
+
+ CleanupStack::PopAndDestroy(2); // apaSession, array
+}
+
+QStringList Backend::availableMimeTypes() const
+{
+ QStringList result;
+
+ // There is no way to return an error from this function, so we just
+ // have to trap and ignore exceptions...
+ TRAP_IGNORE(getAvailableMimeTypesL(result));
+
+ result.sort();
+
+ return result;
+}
+
+Q_EXPORT_PLUGIN2(phonon_mmf, Phonon::MMF::Backend);
+
+QT_END_NAMESPACE
+
diff --git a/src/3rdparty/phonon/mmf/backend.h b/src/3rdparty/phonon/mmf/backend.h
new file mode 100644
index 0000000..1886ae6
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/backend.h
@@ -0,0 +1,56 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef PHONON_MMF_BACKEND_H
+#define PHONON_MMF_BACKEND_H
+
+#include <Phonon/MediaSource>
+#include <Phonon/BackendInterface>
+
+QT_BEGIN_NAMESPACE
+
+namespace Phonon
+{
+namespace MMF
+{
+class Backend : public QObject
+ , public BackendInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(Phonon::BackendInterface)
+public:
+ Backend(QObject *parent = 0);
+
+ virtual QObject *createObject(BackendInterface::Class c, QObject *parent, const QList<QVariant> &args);
+ virtual QList<int> objectDescriptionIndexes(ObjectDescriptionType type) const;
+ virtual QHash<QByteArray, QVariant> objectDescriptionProperties(ObjectDescriptionType type, int index) const;
+ virtual bool startConnectionChange(QSet<QObject *>);
+ virtual bool connectNodes(QObject *, QObject *);
+ virtual bool disconnectNodes(QObject *, QObject *);
+ virtual bool endConnectionChange(QSet<QObject *>);
+ virtual QStringList availableMimeTypes() const;
+
+Q_SIGNALS:
+ void objectDescriptionChanged(ObjectDescriptionType);
+};
+}
+}
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/3rdparty/phonon/mmf/bassboost.cpp b/src/3rdparty/phonon/mmf/bassboost.cpp
new file mode 100644
index 0000000..fc88d03
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/bassboost.cpp
@@ -0,0 +1,44 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include "bassboost.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace Phonon;
+using namespace Phonon::MMF;
+
+BassBoost::BassBoost(QObject *parent) : AbstractAudioEffect::AbstractAudioEffect(parent,
+ QList<EffectParameter>())
+{
+}
+
+void BassBoost::parameterChanged(const int,
+ const QVariant &)
+{
+ // We should never be called, because we have no parameters.
+}
+
+bool BassBoost::activateOn(CPlayerType *player)
+{
+ m_effect.reset(CBassBoost::NewL(*player, true));
+ return true;
+}
+
+QT_END_NAMESPACE
+
diff --git a/src/3rdparty/phonon/mmf/bassboost.h b/src/3rdparty/phonon/mmf/bassboost.h
new file mode 100644
index 0000000..c16393a
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/bassboost.h
@@ -0,0 +1,58 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef PHONON_MMF_BASSBOOST_H
+#define PHONON_MMF_BASSBOOST_H
+
+#include <BassBoostBase.h>
+#include "abstractaudioeffect.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Phonon
+{
+namespace MMF
+{
+/**
+ * @short An "bass boost" effect.
+ *
+ * The documentation does not say what "bass boost" is, neither has it anykind
+ * of setting. It's an on or off thing.
+ */
+class BassBoost : public AbstractAudioEffect
+{
+ Q_OBJECT
+public:
+ BassBoost(QObject *parent);
+
+protected:
+ virtual void parameterChanged(const int id,
+ const QVariant &value);
+
+ virtual bool activateOn(CPlayerType *player);
+
+private:
+ QScopedPointer<CBassBoost> m_bassBoost;
+};
+}
+}
+
+QT_END_NAMESPACE
+
+#endif
+
diff --git a/src/3rdparty/phonon/mmf/defs.h b/src/3rdparty/phonon/mmf/defs.h
new file mode 100644
index 0000000..1a93aa9
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/defs.h
@@ -0,0 +1,43 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef PHONON_MMF_DEFS_H
+#define PHONON_MMF_DEFS_H
+
+#include <QtGlobal>
+
+QT_BEGIN_NAMESPACE
+
+namespace Phonon
+{
+namespace MMF
+{
+static const qint32 DefaultTickInterval = 10;
+static const qreal InitialVolume = 0.5;
+
+enum MediaType {
+ MediaTypeUnknown,
+ MediaTypeAudio,
+ MediaTypeVideo
+};
+}
+}
+
+QT_END_NAMESPACE
+
+#endif // PHONON_MMF_DEFS_H
diff --git a/src/3rdparty/phonon/mmf/dummyplayer.cpp b/src/3rdparty/phonon/mmf/dummyplayer.cpp
new file mode 100644
index 0000000..4c059c4
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/dummyplayer.cpp
@@ -0,0 +1,131 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include "dummyplayer.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace Phonon;
+using namespace Phonon::MMF;
+
+//-----------------------------------------------------------------------------
+// Constructor / destructor
+//-----------------------------------------------------------------------------
+
+MMF::DummyPlayer::DummyPlayer()
+{
+
+}
+
+MMF::DummyPlayer::DummyPlayer(const AbstractPlayer& player)
+ : AbstractPlayer(player)
+{
+
+}
+
+
+//-----------------------------------------------------------------------------
+// MediaObjectInterface
+//-----------------------------------------------------------------------------
+
+void MMF::DummyPlayer::play()
+{
+
+}
+
+void MMF::DummyPlayer::pause()
+{
+
+}
+
+void MMF::DummyPlayer::stop()
+{
+
+}
+
+void MMF::DummyPlayer::seek(qint64)
+{
+
+}
+
+bool MMF::DummyPlayer::hasVideo() const
+{
+ return false;
+}
+
+bool MMF::DummyPlayer::isSeekable() const
+{
+ return false;
+}
+
+Phonon::State MMF::DummyPlayer::state() const
+{
+ return Phonon::LoadingState;
+}
+
+qint64 MMF::DummyPlayer::currentTime() const
+{
+ return 0;
+}
+
+QString MMF::DummyPlayer::errorString() const
+{
+ return QString();
+}
+
+Phonon::ErrorType MMF::DummyPlayer::errorType() const
+{
+ return Phonon::NoError;
+}
+
+qint64 MMF::DummyPlayer::totalTime() const
+{
+ return 0;
+}
+
+MediaSource MMF::DummyPlayer::source() const
+{
+ return MediaSource();
+}
+
+void MMF::DummyPlayer::setFileSource(const Phonon::MediaSource &, RFile &)
+{
+
+}
+
+void MMF::DummyPlayer::setNextSource(const MediaSource &)
+{
+
+}
+
+
+//-----------------------------------------------------------------------------
+// AbstractPlayer
+//-----------------------------------------------------------------------------
+
+void MMF::DummyPlayer::doSetTickInterval(qint32)
+{
+
+}
+
+void MMF::DummyPlayer::changeState(PrivateState)
+{
+}
+
+QT_END_NAMESPACE
+
diff --git a/src/3rdparty/phonon/mmf/dummyplayer.h b/src/3rdparty/phonon/mmf/dummyplayer.h
new file mode 100644
index 0000000..9ff9f78
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/dummyplayer.h
@@ -0,0 +1,76 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef PHONON_MMF_DUMMYPLAYER_H
+#define PHONON_MMF_DUMMYPLAYER_H
+
+#include "abstractplayer.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Phonon
+{
+namespace MMF
+{
+class AudioOutput;
+
+/**
+ * @short Stub implementation of AbstractPlayer.
+ *
+ * The functions of this class are:
+ * - Allow MediaObject to call a subset of the MediaObjectInterface
+ * API, before SetSource has been called.
+ * - Cache any parameters which are set in this state (e.g.
+ * prefinish mark), so that they can be copied into the 'real'
+ * AbstractPlayer implementation once a source has been loaded.
+ */
+class DummyPlayer : public AbstractPlayer
+{
+public:
+ DummyPlayer();
+ DummyPlayer(const AbstractPlayer& player);
+
+ // MediaObjectInterface
+ virtual void play();
+ virtual void pause();
+ virtual void stop();
+ virtual void seek(qint64 milliseconds);
+ virtual bool hasVideo() const;
+ virtual bool isSeekable() const;
+ virtual qint64 currentTime() const;
+ virtual Phonon::State state() const;
+ virtual QString errorString() const;
+ virtual Phonon::ErrorType errorType() const;
+ virtual qint64 totalTime() const;
+ virtual MediaSource source() const;
+ // virtual void setSource(const MediaSource &);
+ virtual void setFileSource(const Phonon::MediaSource&, RFile&);
+ virtual void setNextSource(const MediaSource &source);
+
+ // AbstractPlayer
+ virtual void doSetTickInterval(qint32 interval);
+
+protected:
+ virtual void changeState(PrivateState newState);
+};
+}
+}
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/3rdparty/phonon/mmf/effectfactory.cpp b/src/3rdparty/phonon/mmf/effectfactory.cpp
new file mode 100644
index 0000000..9843a6c
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/effectfactory.cpp
@@ -0,0 +1,151 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include <QObject>
+#include <QCoreApplication>
+
+#include <AudioEqualizerBase.h>
+#include <BassBoostBase.h>
+#include <DistanceAttenuationBase.h>
+#include <DopplerBase.h>
+#include <EnvironmentalReverbBase.h>
+#include <ListenerOrientationBase.h>
+#include <LocationBase.h>
+#include <LoudnessBase.h>
+#include <SourceOrientationBase.h>
+#include <StereoWideningBase.h>
+
+#include "audioequalizer.h"
+#include "bassboost.h"
+
+#include "effectfactory.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace Phonon;
+using namespace Phonon::MMF;
+
+QHash<QByteArray, QVariant> EffectFactory::constructEffectDescription(const QString &name,
+ const QString &description)
+{
+ QHash<QByteArray, QVariant> retval;
+
+ retval.insert("name", name);
+ retval.insert("description", description);
+ retval.insert("available", true);
+
+ return retval;
+}
+
+
+QHash<QByteArray, QVariant> EffectFactory::audioEffectDescriptions(AbstractAudioEffect::Type type)
+{
+ switch (type)
+ {
+ case AbstractAudioEffect::EffectAudioEqualizer:
+ return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "audio equalizer"), "Audio equalizer.");
+ case AbstractAudioEffect::EffectBassBoost:
+ return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Bass boost"), "Bass boost.");
+ case AbstractAudioEffect::EffectDistanceAttenuation:
+ return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Distance Attenuation"), "Distance Attenuation.");
+ case AbstractAudioEffect::EffectEnvironmentalReverb:
+ return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Environmental Reverb"), "Environmental Reverb.");
+ case AbstractAudioEffect::EffectListenerOrientation:
+ return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Environmental Reverb"), "Environmental Reverb.");
+ case AbstractAudioEffect::EffectLoudness:
+ return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Loudness"), "Loudness.");
+ case AbstractAudioEffect::EffectSourceOrientation:
+ return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Source Orientation"), "Source Orientation.");
+ case AbstractAudioEffect::EffectStereoWidening:
+ return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Stereo Widening"), "Stereo Widening.");
+ }
+
+ Q_ASSERT_X(false, Q_FUNC_INFO, "Unknown effect type.");
+ return QHash<QByteArray, QVariant>();
+}
+
+AbstractAudioEffect *EffectFactory::createAudioEffect(AbstractAudioEffect::Type type,
+ QObject *parent)
+{
+ Q_ASSERT(parent);
+
+ switch (type)
+ {
+ case AbstractAudioEffect::EffectBassBoost:
+ return new BassBoost(parent);
+ case AbstractAudioEffect::EffectAudioEqualizer:
+ return new AudioEqualizer(parent);
+ case AbstractAudioEffect::EffectDistanceAttenuation:
+ case AbstractAudioEffect::EffectEnvironmentalReverb:
+ case AbstractAudioEffect::EffectListenerOrientation:
+ case AbstractAudioEffect::EffectLoudness:
+ case AbstractAudioEffect::EffectSourceOrientation:
+ case AbstractAudioEffect::EffectStereoWidening:
+ ;
+ }
+
+ Q_ASSERT_X(false, Q_FUNC_INFO, "Unknown effect.");
+ return 0;
+}
+
+template<typename TEffect>
+bool isEffectSupported()
+{
+ AudioPlayer audioPlayer;
+
+ QScopedPointer<TEffect> eff;
+ TRAPD(errorCode, eff.reset(TEffect::NewL(*audioPlayer.player())));
+
+ return errorCode != KErrNone;
+}
+
+QList<int> EffectFactory::effectIndexes()
+{
+ QList<int> retval;
+
+ if (isEffectSupported<CAudioEqualizer>())
+ retval.append(AbstractAudioEffect::EffectAudioEqualizer);
+
+ if (isEffectSupported<CBassBoost>())
+ retval.append(AbstractAudioEffect::EffectBassBoost);
+
+ /* We haven't implemented these yet.
+ if (isEffectSupported<CDistanceAttenuation>())
+ retval.append(AbstractAudioEffect::EffectDistanceAttenuation);
+
+ if (isEffectSupported<CEnvironmentalReverb>())
+ retval.append(AbstractAudioEffect::EffectEnvironmentalReverb);
+
+ if (isEffectSupported<CLoudness>())
+ retval.append(AbstractAudioEffect::EffectLoudness);
+
+ if (isEffectSupported<CListenerOrientation>())
+ retval.append(AbstractAudioEffect::EffectListenerOrientation);
+
+ if (isEffectSupported<CSourceOrientation>())
+ retval.append(AbstractAudioEffect::EffectSourceOrientation);
+
+ if (isEffectSupported<CStereoWidening>())
+ retval.append(AbstractAudioEffect::EffectStereoWidening);
+ */
+
+ return retval;
+}
+
+QT_END_NAMESPACE
+
diff --git a/src/3rdparty/phonon/mmf/effectfactory.h b/src/3rdparty/phonon/mmf/effectfactory.h
new file mode 100644
index 0000000..e83ad15
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/effectfactory.h
@@ -0,0 +1,76 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef PHONON_MMF_EFFECTFACTORY_H
+#define PHONON_MMF_EFFECTFACTORY_H
+
+#include "abstractaudioeffect.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Phonon
+{
+namespace MMF
+{
+
+/**
+ * @short Contains utility functions related to effects.
+ */
+class EffectFactory
+{
+public:
+ /**
+ * @short Creates an audio effect of type @p type.
+ */
+ static AbstractAudioEffect *createAudioEffect(AbstractAudioEffect::Type type,
+ QObject *parent);
+
+ /**
+ * @short Return the properties for effect @p type.
+ *
+ * This handles the effects for
+ * BackendInterface::objectDescriptionProperties().
+ */
+ static QHash<QByteArray, QVariant> audioEffectDescriptions(AbstractAudioEffect::Type type);
+
+ /**
+ * @short Returns the indexes for the supported effects.
+ *
+ * This handles the effects for
+ * BackendInterface::objectDescriptionIndexes().
+ */
+ static QList<int> effectIndexes();
+
+private:
+ static inline QHash<QByteArray, QVariant> constructEffectDescription(const QString &name,
+ const QString &description);
+
+ /**
+ * This class is not supposed to be instantiated, so disable
+ * the default constructor.
+ */
+ inline EffectFactory();
+ Q_DISABLE_COPY(EffectFactory)
+};
+}
+}
+
+QT_END_NAMESPACE
+
+#endif
+
diff --git a/src/3rdparty/phonon/mmf/mediaobject.cpp b/src/3rdparty/phonon/mmf/mediaobject.cpp
new file mode 100644
index 0000000..0591e05
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/mediaobject.cpp
@@ -0,0 +1,385 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include "audiooutput.h"
+#include "audioplayer.h"
+#include "defs.h"
+#include "dummyplayer.h"
+#include "utils.h"
+#include "utils.h"
+#include "mmf_videoplayer.h"
+#include "videowidget.h"
+
+#include "mediaobject.h"
+
+#include <QDir>
+#include <QUrl>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Phonon;
+using namespace Phonon::MMF;
+
+//-----------------------------------------------------------------------------
+// Constructor / destructor
+//-----------------------------------------------------------------------------
+
+MMF::MediaObject::MediaObject(QObject *parent) : MMF::MediaNode::MediaNode(parent)
+ , m_recognizerOpened(false)
+{
+ m_player.reset(new DummyPlayer());
+
+ TRACE_CONTEXT(MediaObject::MediaObject, EAudioApi);
+ TRACE_ENTRY_0();
+
+ Q_UNUSED(parent);
+
+ TRACE_EXIT_0();
+}
+
+MMF::MediaObject::~MediaObject()
+{
+ TRACE_CONTEXT(MediaObject::~MediaObject, EAudioApi);
+ TRACE_ENTRY_0();
+
+ m_file.Close();
+ m_fileServer.Close();
+ m_recognizer.Close();
+
+ TRACE_EXIT_0();
+}
+
+
+//-----------------------------------------------------------------------------
+// Recognizer
+//-----------------------------------------------------------------------------
+
+bool MMF::MediaObject::openRecognizer()
+{
+ TRACE_CONTEXT(MediaObject::openRecognizer, EAudioInternal);
+
+ if (!m_recognizerOpened) {
+ TInt err = m_recognizer.Connect();
+ if (KErrNone != err) {
+ TRACE("RApaLsSession::Connect error %d", err);
+ return false;
+ }
+
+ err = m_fileServer.Connect();
+ if (KErrNone != err) {
+ TRACE("RFs::Connect error %d", err);
+ return false;
+ }
+
+ // This must be called in order to be able to share file handles with
+ // the recognizer server (see fileMediaType function).
+ err = m_fileServer.ShareProtected();
+ if (KErrNone != err) {
+ TRACE("RFs::ShareProtected error %d", err);
+ return false;
+ }
+
+ m_recognizerOpened = true;
+ }
+
+ return true;
+}
+
+MMF::MediaType MMF::MediaObject::fileMediaType
+(const QString& fileName)
+{
+ TRACE_CONTEXT(MediaObject::fileMediaType, EAudioInternal);
+
+ MediaType result = MediaTypeUnknown;
+
+ if (openRecognizer()) {
+
+ const QHBufC fileNameSymbian(QDir::toNativeSeparators(fileName));
+
+ m_file.Close();
+ TInt err = m_file.Open(m_fileServer, *fileNameSymbian, EFileRead | EFileShareReadersOnly);
+
+ if (KErrNone == err) {
+ TDataRecognitionResult recognizerResult;
+ err = m_recognizer.RecognizeData(m_file, recognizerResult);
+ if (KErrNone == err) {
+ const TPtrC mimeType = recognizerResult.iDataType.Des();
+ result = Utils::mimeTypeToMediaType(mimeType);
+ } else {
+ TRACE("RApaLsSession::RecognizeData filename %S error %d", fileNameSymbian.data(), err);
+ }
+ } else {
+ TRACE("RFile::Open filename %S error %d", fileNameSymbian.data(), err);
+ }
+ }
+
+ return result;
+}
+
+
+//-----------------------------------------------------------------------------
+// MediaObjectInterface
+//-----------------------------------------------------------------------------
+
+void MMF::MediaObject::play()
+{
+ m_player->play();
+}
+
+void MMF::MediaObject::pause()
+{
+ m_player->pause();
+}
+
+void MMF::MediaObject::stop()
+{
+ m_player->stop();
+}
+
+void MMF::MediaObject::seek(qint64 ms)
+{
+ m_player->seek(ms);
+
+ if (state() == PausedState or state() == PlayingState) {
+ emit tick(currentTime());
+ }
+}
+
+qint32 MMF::MediaObject::tickInterval() const
+{
+ return m_player->tickInterval();
+}
+
+void MMF::MediaObject::setTickInterval(qint32 interval)
+{
+ m_player->setTickInterval(interval);
+}
+
+bool MMF::MediaObject::hasVideo() const
+{
+ return m_player->hasVideo();
+}
+
+bool MMF::MediaObject::isSeekable() const
+{
+ return m_player->isSeekable();
+}
+
+Phonon::State MMF::MediaObject::state() const
+{
+ return m_player->state();
+}
+
+qint64 MMF::MediaObject::currentTime() const
+{
+ return m_player->currentTime();
+}
+
+QString MMF::MediaObject::errorString() const
+{
+ return m_player->errorString();
+}
+
+Phonon::ErrorType MMF::MediaObject::errorType() const
+{
+ return m_player->errorType();
+}
+
+qint64 MMF::MediaObject::totalTime() const
+{
+ return m_player->totalTime();
+}
+
+MediaSource MMF::MediaObject::source() const
+{
+ return m_player->source();
+}
+
+void MMF::MediaObject::setSource(const MediaSource &source)
+{
+ createPlayer(source);
+
+ // This is a hack to work around KErrInUse from MMF client utility
+ // OpenFileL calls
+ m_player->setFileSource(source, m_file);
+
+ emit currentSourceChanged(source);
+}
+
+void MMF::MediaObject::createPlayer(const MediaSource &source)
+{
+ TRACE_CONTEXT(MediaObject::createPlayer, EAudioApi);
+ TRACE_ENTRY("state %d source.type %d", state(), source.type());
+ TRACE_ENTRY("source.type %d", source.type());
+
+ MediaType mediaType = MediaTypeUnknown;
+
+ AbstractPlayer* oldPlayer = m_player.data();
+
+ const bool oldPlayerHasVideo = oldPlayer->hasVideo();
+ const bool oldPlayerSeekable = oldPlayer->isSeekable();
+
+ Phonon::ErrorType error = NoError;
+
+ // Determine media type
+ switch (source.type()) {
+ case MediaSource::LocalFile:
+ mediaType = fileMediaType(source.fileName());
+ break;
+
+ case MediaSource::Url:
+ {
+ const QUrl url(source.url());
+ if (url.scheme() == QLatin1String("file")) {
+ mediaType = fileMediaType(url.toLocalFile());
+ }
+ else {
+ TRACE_0("Network streaming not supported yet");
+ error = NormalError;
+ }
+ }
+ break;
+
+ case MediaSource::Invalid:
+ case MediaSource::Disc:
+ case MediaSource::Stream:
+ TRACE_0("Unsupported media type");
+ error = NormalError;
+ break;
+
+ case MediaSource::Empty:
+ TRACE_0("Empty media source");
+ break;
+ }
+
+ AbstractPlayer* newPlayer = 0;
+
+ // Construct newPlayer using oldPlayer (if not 0) in order to copy
+ // parameters (volume, prefinishMark, transitionTime) which may have
+ // been set on oldPlayer.
+
+ switch (mediaType) {
+ case MediaTypeUnknown:
+ TRACE_0("Media type could not be determined");
+ if (oldPlayer) {
+ newPlayer = new DummyPlayer(*oldPlayer);
+ } else {
+ newPlayer = new DummyPlayer();
+ }
+
+ newPlayer->setError(NormalError);
+ break;
+
+ case MediaTypeAudio:
+ if (oldPlayer) {
+ newPlayer = new AudioPlayer(*oldPlayer);
+ } else {
+ newPlayer = new AudioPlayer();
+ }
+ break;
+
+ case MediaTypeVideo:
+ if (oldPlayer) {
+ newPlayer = new VideoPlayer(*oldPlayer);
+ } else {
+ newPlayer = new VideoPlayer();
+ }
+ break;
+ }
+
+ m_player.reset(newPlayer);
+
+ if (oldPlayerHasVideo != hasVideo()) {
+ emit hasVideoChanged(hasVideo());
+ }
+
+ if (oldPlayerSeekable != isSeekable()) {
+ emit seekableChanged(isSeekable());
+ }
+
+ connect(m_player.data(), SIGNAL(totalTimeChanged(qint64)), SIGNAL(totalTimeChanged(qint64)));
+ connect(m_player.data(), SIGNAL(stateChanged(Phonon::State, Phonon::State)), SIGNAL(stateChanged(Phonon::State, Phonon::State)));
+ connect(m_player.data(), SIGNAL(finished()), SIGNAL(finished()));
+ connect(m_player.data(), SIGNAL(tick(qint64)), SIGNAL(tick(qint64)));
+
+ if (error != NoError ) {
+ newPlayer = new DummyPlayer();
+ newPlayer->setError(error);
+ }
+
+ TRACE_EXIT_0();
+}
+
+void MMF::MediaObject::setNextSource(const MediaSource &source)
+{
+ m_player->setNextSource(source);
+}
+
+qint32 MMF::MediaObject::prefinishMark() const
+{
+ return m_player->prefinishMark();
+}
+
+void MMF::MediaObject::setPrefinishMark(qint32 mark)
+{
+ m_player->setPrefinishMark(mark);
+}
+
+qint32 MMF::MediaObject::transitionTime() const
+{
+ return m_player->transitionTime();
+}
+
+void MMF::MediaObject::setTransitionTime(qint32 time)
+{
+ m_player->setTransitionTime(time);
+}
+
+
+//-----------------------------------------------------------------------------
+// VolumeObserver
+//-----------------------------------------------------------------------------
+
+void MMF::MediaObject::volumeChanged(qreal volume)
+{
+ m_player->volumeChanged(volume);
+}
+
+//-----------------------------------------------------------------------------
+// Video output
+//-----------------------------------------------------------------------------
+
+void MMF::MediaObject::setVideoOutput(VideoOutput* videoOutput)
+{
+ m_player->setVideoOutput(videoOutput);
+}
+
+
+AbstractPlayer *MMF::MediaObject::abstractPlayer() const
+{
+ return m_player.data();
+}
+
+bool MMF::MediaObject::activateOnMediaObject(MediaObject *)
+{
+ // Guess what, we do nothing.
+ return true;
+}
+
+QT_END_NAMESPACE
+
diff --git a/src/3rdparty/phonon/mmf/mediaobject.h b/src/3rdparty/phonon/mmf/mediaobject.h
new file mode 100644
index 0000000..409918d
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/mediaobject.h
@@ -0,0 +1,140 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef PHONON_MMF_MEDIAOBJECT_H
+#define PHONON_MMF_MEDIAOBJECT_H
+
+#include <Phonon/MediaSource>
+#include <Phonon/MediaObjectInterface>
+#include <QScopedPointer>
+#include <QTimer>
+
+// For recognizer
+#include <apgcli.h>
+
+#include "abstractplayer.h"
+#include "mmf_medianode.h"
+#include "defs.h"
+#include "volumeobserver.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Phonon
+{
+namespace MMF
+{
+class AbstractPlayer;
+class VideoOutput;
+
+/**
+ * @short Facade class which wraps MMF client utility instance
+ */
+class MediaObject : public MediaNode
+ , public MediaObjectInterface
+ , public VolumeObserver
+{
+ Q_OBJECT
+ Q_INTERFACES(Phonon::MediaObjectInterface)
+
+public:
+ MediaObject(QObject *parent);
+ virtual ~MediaObject();
+
+ // MediaObjectInterface
+ virtual void play();
+ virtual void pause();
+ virtual void stop();
+ virtual void seek(qint64 milliseconds);
+ virtual qint32 tickInterval() const;
+ virtual void setTickInterval(qint32 interval);
+ virtual bool hasVideo() const;
+ virtual bool isSeekable() const;
+ virtual qint64 currentTime() const;
+ virtual Phonon::State state() const;
+ virtual QString errorString() const;
+ virtual Phonon::ErrorType errorType() const;
+ virtual qint64 totalTime() const;
+ virtual MediaSource source() const;
+ virtual void setSource(const MediaSource &);
+ virtual void setNextSource(const MediaSource &source);
+ virtual qint32 prefinishMark() const;
+ virtual void setPrefinishMark(qint32);
+ virtual qint32 transitionTime() const;
+ virtual void setTransitionTime(qint32);
+
+ // VolumeObserver
+ void volumeChanged(qreal volume);
+
+ /**
+ * This class owns the AbstractPlayer, and will delete it upon
+ * destruction.
+ */
+ AbstractPlayer *abstractPlayer() const;
+
+ void setVideoOutput(VideoOutput* videoOutput);
+
+ virtual bool activateOnMediaObject(MediaObject *);
+
+Q_SIGNALS:
+ void totalTimeChanged(qint64 length);
+ void hasVideoChanged(bool hasVideo);
+ void seekableChanged(bool seekable);
+ // TODO: emit bufferStatus from MediaObject
+ void bufferStatus(int);
+ // TODO: emit aboutToFinish from MediaObject
+ void aboutToFinish();
+ // TODO: emit prefinishMarkReached from MediaObject
+ void prefinishMarkReached(qint32);
+ // TODO: emit metaDataChanged from MediaObject
+ void metaDataChanged(const QMultiMap<QString, QString>& metaData);
+ void currentSourceChanged(const MediaSource& source);
+ void stateChanged(Phonon::State oldState,
+ Phonon::State newState);
+ void finished();
+ void tick(qint64 time);
+
+private:
+ void createPlayer(const MediaSource &source);
+ bool openRecognizer();
+
+ // Audio / video media type recognition
+ MediaType fileMediaType(const QString& fileName);
+ // TODO: urlMediaType function
+
+ static qint64 toMilliSeconds(const TTimeIntervalMicroSeconds &);
+
+private:
+
+ // Audio / video media type recognition
+ bool m_recognizerOpened;
+ RApaLsSession m_recognizer;
+ RFs m_fileServer;
+
+ // Storing the file handle here to work around KErrInUse error
+ // from MMF player utility OpenFileL functions
+ RFile m_file;
+
+ QScopedPointer<AbstractPlayer> m_player;
+
+};
+}
+}
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/3rdparty/phonon/mmf/mmf_medianode.cpp b/src/3rdparty/phonon/mmf/mmf_medianode.cpp
new file mode 100644
index 0000000..a9eee58
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/mmf_medianode.cpp
@@ -0,0 +1,117 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include "mediaobject.h"
+
+#include "mmf_medianode.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace Phonon;
+using namespace Phonon::MMF;
+
+MMF::MediaNode::MediaNode(QObject *parent) : QObject::QObject(parent)
+ , m_source(0)
+ , m_target(0)
+ , m_isApplied(false)
+{
+}
+
+bool MMF::MediaNode::connectMediaNode(MediaNode *target)
+{
+ m_target = target;
+ m_target->setSource(this);
+
+ return applyNodesOnMediaObject(target);
+}
+
+bool MMF::MediaNode::disconnectMediaNode(MediaNode *target)
+{
+ Q_UNUSED(target);
+ m_target = 0;
+ m_isApplied = false;
+ return false;
+}
+
+void MMF::MediaNode::setSource(MediaNode *source)
+{
+ m_source = source;
+}
+
+MMF::MediaNode *MMF::MediaNode::source() const
+{
+ return m_source;
+}
+
+MMF::MediaNode *MMF::MediaNode::target() const
+{
+ return m_target;
+}
+
+bool MMF::MediaNode::applyNodesOnMediaObject(MediaNode *)
+{
+ // Algorithmically, this can be expressed in a more efficient way by
+ // exercising available assumptions, but it complicates code for input
+ // data(length of the graph) which typically is very small.
+
+ // First, we go to the very beginning of the graph.
+ MMF::MediaNode *current = this;
+ do {
+ MediaNode *const candidate = current->source();
+ if (candidate)
+ current = candidate;
+ else
+ break;
+ }
+ while (current);
+
+ // Now we do two things, while walking to the other end:
+ // 1. Find the MediaObject, if present
+ // 2. Collect a list of all unapplied MediaNodes
+
+ QList<MediaNode *> unapplied;
+ MMF::MediaObject *mo = 0;
+
+ do {
+ if (!current->m_isApplied)
+ unapplied.append(current);
+
+ if (!mo)
+ mo = qobject_cast<MMF::MediaObject *>(current);
+
+ current = current->target();
+ }
+ while (current);
+
+ // Now, lets activate all the objects, if we found the MediaObject.
+
+ if (mo) {
+ for (int i = 0; i < unapplied.count(); ++i) {
+ MediaNode *const at = unapplied.at(i);
+
+ // We don't want to apply MediaObject on itself.
+ if (at != mo)
+ at->activateOnMediaObject(mo);
+ }
+ }
+
+ return true;
+}
+
+QT_END_NAMESPACE
+
diff --git a/src/3rdparty/phonon/mmf/mmf_medianode.h b/src/3rdparty/phonon/mmf/mmf_medianode.h
new file mode 100644
index 0000000..4616ff1
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/mmf_medianode.h
@@ -0,0 +1,100 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef PHONON_MMF_MEDIANODE_H
+#define PHONON_MMF_MEDIANODE_H
+
+#include <QObject>
+#include <Phonon/EffectInterface>
+#include "audioplayer.h"
+
+QT_BEGIN_NAMESPACE
+
+/**
+ * @file mmf_medianode.h mmf_medianode.cpp
+ *
+ * This file starts with mmf_ in order to avoid clash with Phonon's
+ * medianode.h. The GStreamer backend has a file named medianode.h, but it
+ * isn't compiled with ABLD build system, which have problems with separating
+ * user and system include paths.
+ */
+
+namespace Phonon
+{
+namespace MMF
+{
+class MediaObject;
+
+/**
+ * @short Base class for all nodes in the MMF backend.
+ *
+ * MediaNode is the base class for all nodes in the chain for MMF. Currently
+ * they are:
+ *
+ * - MediaObject: a source of media
+ * - AbstractEffect: supplying audio effects
+ * - AudioOutput: pretty much a dummy interface, but is also MediaNode in order
+ * to simplify connection/disconnection.
+ *
+ * MediaNode provides spectatability into the chain, and also allows the
+ * connection code to be written in a polymorphic manner, instead of putting it
+ * all in the Backend class. Due to that MMF has no concept of chaining, the
+ * order of the nodes in the graph has no meaning.
+ */
+class MediaNode : public QObject
+{
+ Q_OBJECT
+public:
+ MediaNode(QObject *parent);
+
+ virtual bool connectMediaNode(MediaNode *target);
+ virtual bool disconnectMediaNode(MediaNode *target);
+ void setSource(MediaNode *source);
+
+ MediaNode *source() const;
+ MediaNode *target() const;
+
+protected:
+ /**
+ * When connectMediaNode() is called and a MediaObject is part of
+ * the its graph, this function will be called for each MediaNode in the
+ * graph for which it hasn't been called yet.
+ *
+ * The caller guarantees that @p mo is always non-null.
+ */
+ virtual bool activateOnMediaObject(MediaObject *mo) = 0;
+
+private:
+ /**
+ * Finds a MediaObject anywhere in the graph @p target is apart of, and
+ * calls activateOnMediaObject() for all MediaNodes in the graph for which
+ * it hasn't been applied to already.
+ */
+ bool applyNodesOnMediaObject(MediaNode *target);
+
+ MediaNode * m_source;
+ MediaNode * m_target;
+ bool m_isApplied;
+};
+}
+}
+
+QT_END_NAMESPACE
+
+#endif
+
diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp
new file mode 100644
index 0000000..64e6568
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp
@@ -0,0 +1,448 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include <QUrl>
+#include <QTimer>
+#include <QWidget>
+
+#include <coemain.h> // For CCoeEnv
+#include <coecntrl.h>
+
+#include "mmf_videoplayer.h"
+#include "utils.h"
+
+#ifdef _DEBUG
+#include "objectdump.h"
+#endif
+
+QT_BEGIN_NAMESPACE
+
+using namespace Phonon;
+using namespace Phonon::MMF;
+
+//-----------------------------------------------------------------------------
+// Constructor / destructor
+//-----------------------------------------------------------------------------
+
+MMF::VideoPlayer::VideoPlayer()
+ : m_wsSession(0)
+ , m_screenDevice(0)
+ , m_window(0)
+ , m_totalTime(0)
+ , m_mmfOutputChangePending(false)
+{
+ construct();
+}
+
+MMF::VideoPlayer::VideoPlayer(const AbstractPlayer& player)
+ : AbstractMediaPlayer(player)
+ , m_wsSession(0)
+ , m_screenDevice(0)
+ , m_window(0)
+ , m_totalTime(0)
+ , m_mmfOutputChangePending(false)
+{
+ construct();
+}
+
+void MMF::VideoPlayer::construct()
+{
+ TRACE_CONTEXT(VideoPlayer::VideoPlayer, EVideoApi);
+ TRACE_ENTRY_0();
+
+ if (!m_videoOutput) {
+ m_dummyVideoOutput.reset(new VideoOutput(0));
+ }
+
+ videoOutput().setObserver(this);
+
+ const TInt priority = 0;
+ const TMdaPriorityPreference preference = EMdaPriorityPreferenceNone;
+
+ getNativeWindowSystemHandles();
+
+ // TODO: is this the correct way to handle errors which occur when
+ // creating a Symbian object in the constructor of a Qt object?
+
+ // TODO: check whether videoOutput is visible? If not, then the
+ // corresponding window will not be active, meaning that the
+ // clipping region will be set to empty and the video will not be
+ // visible. If this is the case, we should set m_mmfOutputChangePending
+ // and respond to future showEvents from the videoOutput widget.
+
+ TRAPD(err,
+ m_player.reset(CVideoPlayerUtility::NewL
+ (
+ *this,
+ priority, preference,
+ *m_wsSession, *m_screenDevice,
+ *m_window,
+ m_windowRect, m_clipRect
+ ))
+ );
+
+ if (KErrNone != err) {
+ changeState(ErrorState);
+ }
+
+ TRACE_EXIT_0();
+}
+
+MMF::VideoPlayer::~VideoPlayer()
+{
+ TRACE_CONTEXT(VideoPlayer::~VideoPlayer, EVideoApi);
+ TRACE_ENTRY_0();
+
+ TRACE_EXIT_0();
+}
+
+//-----------------------------------------------------------------------------
+// Public API
+//-----------------------------------------------------------------------------
+
+void MMF::VideoPlayer::doPlay()
+{
+ TRACE_CONTEXT(VideoPlayer::doPlay, EVideoApi);
+
+ // See comment in updateMmfOutput
+ if(m_mmfOutputChangePending) {
+ TRACE_0("MMF output change pending - pushing now");
+ updateMmfOutput();
+ }
+
+ m_player->Play();
+}
+
+void MMF::VideoPlayer::doPause()
+{
+ TRACE_CONTEXT(VideoPlayer::doPause, EVideoApi);
+
+ TRAPD(err, m_player->PauseL());
+ if (KErrNone != err) {
+ TRACE("PauseL error %d", err);
+ setError(NormalError);
+ }
+}
+
+void MMF::VideoPlayer::doStop()
+{
+ m_player->Stop();
+}
+
+void MMF::VideoPlayer::doSeek(qint64 ms)
+{
+ TRACE_CONTEXT(VideoPlayer::doSeek, EVideoApi);
+
+ bool wasPlaying = false;
+ if(state() == PlayingState) {
+ // The call to SetPositionL does not have any effect if playback is
+ // ongoing, so we pause before seeking.
+ doPause();
+ wasPlaying = true;
+ }
+
+ TRAPD(err, m_player->SetPositionL(TTimeIntervalMicroSeconds(ms * 1000)));
+
+ if(KErrNone == err) {
+ if(wasPlaying)
+ doPlay();
+ }
+ else {
+ TRACE("SetPositionL error %d", err);
+ setError(NormalError);
+ }
+}
+
+int MMF::VideoPlayer::setDeviceVolume(int mmfVolume)
+{
+ TRAPD(err, m_player->SetVolumeL(mmfVolume));
+ return err;
+}
+
+int MMF::VideoPlayer::openFile(RFile& file)
+{
+ TRAPD(err, m_player->OpenFileL(file));
+ return err;
+}
+
+void MMF::VideoPlayer::close()
+{
+ m_player->Close();
+}
+
+bool MMF::VideoPlayer::hasVideo() const
+{
+ return true;
+}
+
+qint64 MMF::VideoPlayer::currentTime() const
+{
+ TRACE_CONTEXT(VideoPlayer::currentTime, EVideoApi);
+
+ TTimeIntervalMicroSeconds us;
+ TRAPD(err, us = m_player->PositionL())
+
+ qint64 result = 0;
+
+ if (KErrNone == err) {
+ result = toMilliSeconds(us);
+ } else {
+ TRACE("PositionL error %d", err);
+
+ // If we don't cast away constness here, we simply have to ignore
+ // the error.
+ const_cast<VideoPlayer*>(this)->setError(NormalError);
+ }
+
+ return result;
+}
+
+qint64 MMF::VideoPlayer::totalTime() const
+{
+ return m_totalTime;
+}
+
+
+//-----------------------------------------------------------------------------
+// MVideoPlayerUtilityObserver callbacks
+//-----------------------------------------------------------------------------
+
+void MMF::VideoPlayer::MvpuoOpenComplete(TInt aError)
+{
+ TRACE_CONTEXT(VideoPlayer::MvpuoOpenComplete, EVideoApi);
+ TRACE_ENTRY("state %d error %d", state(), aError);
+
+ __ASSERT_ALWAYS(LoadingState == state(), Utils::panic(InvalidStatePanic));
+
+ if (KErrNone == aError)
+ m_player->Prepare();
+ else
+ setError(NormalError);
+
+ TRACE_EXIT_0();
+}
+
+void MMF::VideoPlayer::MvpuoPrepareComplete(TInt aError)
+{
+ TRACE_CONTEXT(VideoPlayer::MvpuoPrepareComplete, EVideoApi);
+ TRACE_ENTRY("state %d error %d", state(), aError);
+
+ __ASSERT_ALWAYS(LoadingState == state(), Utils::panic(InvalidStatePanic));
+
+ TRAPD(err, doPrepareCompleteL(aError));
+
+ if (KErrNone == err) {
+ maxVolumeChanged(m_player->MaxVolume());
+
+ videoOutput().setFrameSize(m_frameSize);
+
+ // See comment in updateMmfOutput
+ if(m_mmfOutputChangePending) {
+ TRACE_0("MMF output change pending - pushing now");
+ updateMmfOutput();
+ }
+
+ emit totalTimeChanged(totalTime());
+ changeState(StoppedState);
+ } else {
+ setError(NormalError);
+ }
+
+ TRACE_EXIT_0();
+}
+
+void MMF::VideoPlayer::doPrepareCompleteL(TInt aError)
+{
+ User::LeaveIfError(aError);
+
+ // Get frame size
+ TSize size;
+ m_player->VideoFrameSizeL(size);
+ m_frameSize = QSize(size.iWidth, size.iHeight);
+
+ // Get duration
+ m_totalTime = toMilliSeconds(m_player->DurationL());
+}
+
+
+void MMF::VideoPlayer::MvpuoFrameReady(CFbsBitmap &aFrame, TInt aError)
+{
+ TRACE_CONTEXT(VideoPlayer::MvpuoFrameReady, EVideoApi);
+ TRACE_ENTRY("state %d error %d", state(), aError);
+
+ // TODO
+ Q_UNUSED(aFrame);
+ Q_UNUSED(aError); // suppress warnings in release builds
+
+ TRACE_EXIT_0();
+}
+
+void MMF::VideoPlayer::MvpuoPlayComplete(TInt aError)
+{
+ TRACE_CONTEXT(VideoPlayer::MvpuoPlayComplete, EVideoApi)
+ TRACE_ENTRY("state %d error %d", state(), aError);
+
+ // TODO
+ Q_UNUSED(aError); // suppress warnings in release builds
+
+ TRACE_EXIT_0();
+}
+
+void MMF::VideoPlayer::MvpuoEvent(const TMMFEvent &aEvent)
+{
+ TRACE_CONTEXT(VideoPlayer::MvpuoEvent, EVideoApi);
+ TRACE_ENTRY("state %d", state());
+
+ // TODO
+ Q_UNUSED(aEvent);
+
+ TRACE_EXIT_0();
+}
+
+
+//-----------------------------------------------------------------------------
+// VideoOutputObserver
+//-----------------------------------------------------------------------------
+
+void MMF::VideoPlayer::videoOutputRegionChanged()
+{
+ TRACE_CONTEXT(VideoPlayer::videoOutputRegionChanged, EVideoInternal);
+ TRACE_ENTRY("state %d", state());
+
+ getNativeWindowSystemHandles();
+
+ // See comment in updateMmfOutput
+ if(state() == LoadingState)
+ m_mmfOutputChangePending = true;
+ else
+ updateMmfOutput();
+
+ TRACE_EXIT_0();
+}
+
+void MMF::VideoPlayer::updateMmfOutput()
+{
+ TRACE_CONTEXT(VideoPlayer::updateMmfOutput, EVideoInternal);
+ TRACE_ENTRY_0();
+
+ // Calling SetDisplayWindowL is a no-op unless the MMF controller has
+ // been loaded, so we shouldn't do it. Instead, the
+ // m_mmfOutputChangePending flag is used to record the fact that we
+ // need to call SetDisplayWindowL, and this is checked in
+ // MvpuoPrepareComplete, at which point the MMF controller has been
+ // loaded.
+
+ // TODO: check whether videoOutput is visible? If not, then the
+ // corresponding window will not be active, meaning that the
+ // clipping region will be set to empty and the video will not be
+ // visible. If this is the case, we should set m_mmfOutputChangePending
+ // and respond to future showEvents from the videoOutput widget.
+
+ getNativeWindowSystemHandles();
+
+ TRAPD(err,
+ m_player->SetDisplayWindowL
+ (
+ *m_wsSession, *m_screenDevice,
+ *m_window,
+ m_windowRect, m_clipRect
+ )
+ );
+
+ if (KErrNone != err) {
+ TRACE("SetDisplayWindowL error %d", err);
+ setError(NormalError);
+ }
+
+ m_mmfOutputChangePending = false;
+
+ TRACE_EXIT_0();
+}
+
+
+//-----------------------------------------------------------------------------
+// Private functions
+//-----------------------------------------------------------------------------
+
+VideoOutput& MMF::VideoPlayer::videoOutput()
+{
+ TRACE_CONTEXT(VideoPlayer::videoOutput, EVideoInternal);
+ TRACE("videoOutput 0x%08x dummy 0x%08x", m_videoOutput, m_dummyVideoOutput.data());
+
+ return m_videoOutput ? *m_videoOutput : *m_dummyVideoOutput;
+}
+
+void MMF::VideoPlayer::videoOutputChanged()
+{
+ TRACE_CONTEXT(VideoPlayer::videoOutputChanged, EVideoInternal);
+ TRACE_ENTRY_0();
+
+ // Lazily construct a dummy output if needed here
+ if (!m_videoOutput and m_dummyVideoOutput.isNull()) {
+ m_dummyVideoOutput.reset(new VideoOutput(0));
+ }
+
+ videoOutput().setObserver(this);
+
+ videoOutput().setFrameSize(m_frameSize);
+
+ videoOutputRegionChanged();
+
+ TRACE_EXIT_0();
+}
+
+void MMF::VideoPlayer::getNativeWindowSystemHandles()
+{
+ TRACE_CONTEXT(VideoPlayer::getNativeWindowSystemHandles, EVideoInternal);
+ TRACE_ENTRY_0();
+
+ VideoOutput& output = videoOutput();
+ CCoeControl* const control = output.winId();
+
+ CCoeEnv* const coeEnv = control->ControlEnv();
+ m_wsSession = &(coeEnv->WsSession());
+ m_screenDevice = coeEnv->ScreenDevice();
+ m_window = control->DrawableWindow();
+
+#ifdef _DEBUG
+ QScopedPointer<ObjectDump::QDumper> dumper(new ObjectDump::QDumper);
+ dumper->setPrefix("Phonon::MMF"); // to aid searchability of logs
+ ObjectDump::addDefaultAnnotators(*dumper);
+ TRACE_0("Dumping VideoOutput:");
+ dumper->dumpObject(output);
+#endif
+
+ m_windowRect = TRect(
+ control->DrawableWindow()->AbsPosition(),
+ control->DrawableWindow()->Size());
+
+ m_clipRect = m_windowRect;
+
+ TRACE("windowRect %d %d - %d %d",
+ m_windowRect.iTl.iX, m_windowRect.iTl.iY,
+ m_windowRect.iBr.iX, m_windowRect.iBr.iY);
+ TRACE("clipRect %d %d - %d %d",
+ m_clipRect.iTl.iX, m_clipRect.iTl.iY,
+ m_clipRect.iBr.iX, m_clipRect.iBr.iY);
+
+ TRACE_EXIT_0();
+}
+
+
+QT_END_NAMESPACE
+
diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.h b/src/3rdparty/phonon/mmf/mmf_videoplayer.h
new file mode 100644
index 0000000..a805135
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.h
@@ -0,0 +1,111 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef PHONON_MMF_VIDEOPLAYER_H
+#define PHONON_MMF_VIDEOPLAYER_H
+
+#include <videoplayer.h> // from epoc32/include
+
+#include "abstractmediaplayer.h"
+#include "videooutput.h"
+#include "videooutputobserver.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Phonon
+{
+namespace MMF
+{
+/**
+ * @short Wrapper over MMF video client utility
+ *
+ * See
+ * <a href="http://wiki.forum.nokia.com/index.php/How_to_play_a_video_file_using_CVideoPlayerUtility">How to
+ * play a video file using CVideoPlayerUtility</a>
+ */
+class VideoPlayer : public AbstractMediaPlayer
+ , public MVideoPlayerUtilityObserver
+ , public VideoOutputObserver
+{
+ Q_OBJECT
+
+public:
+ VideoPlayer();
+ explicit VideoPlayer(const AbstractPlayer& player);
+ virtual ~VideoPlayer();
+
+ // AbstractPlayer
+ virtual void doPlay();
+ virtual void doPause();
+ virtual void doStop();
+ virtual void doSeek(qint64 milliseconds);
+ virtual int setDeviceVolume(int mmfVolume);
+ virtual int openFile(RFile& file);
+ virtual void close();
+
+ // MediaObjectInterface
+ virtual bool hasVideo() const;
+ virtual qint64 currentTime() const;
+ virtual qint64 totalTime() const;
+
+ // MVideoPlayerUtilityObserver
+ virtual void MvpuoOpenComplete(TInt aError);
+ virtual void MvpuoPrepareComplete(TInt aError);
+ virtual void MvpuoFrameReady(CFbsBitmap &aFrame, TInt aError);
+ virtual void MvpuoPlayComplete(TInt aError);
+ virtual void MvpuoEvent(const TMMFEvent &aEvent);
+
+ // VideoOutputObserver
+ virtual void videoOutputRegionChanged();
+
+private:
+ void construct();
+ VideoOutput& videoOutput();
+
+ void doPrepareCompleteL(TInt aError);
+
+ // AbstractPlayer
+ virtual void videoOutputChanged();
+
+ void getNativeWindowSystemHandles();
+ void updateMmfOutput();
+
+private:
+ QScopedPointer<CVideoPlayerUtility> m_player;
+ QScopedPointer<VideoOutput> m_dummyVideoOutput;
+
+ // Not owned
+ RWsSession* m_wsSession;
+ CWsScreenDevice* m_screenDevice;
+ RWindowBase* m_window;
+ TRect m_windowRect;
+ TRect m_clipRect;
+
+ QSize m_frameSize;
+ qint64 m_totalTime;
+
+ bool m_mmfOutputChangePending;
+
+};
+
+}
+}
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.cpp b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.cpp
new file mode 100644
index 0000000..ef2b81c
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.cpp
@@ -0,0 +1,527 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include <QByteArray>
+#include <QDebug>
+#include <QHash>
+#include <QTextStream>
+#include <QWidget>
+
+#include "objectdump.h"
+#include "objecttree.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace ObjectDump
+{
+
+//-----------------------------------------------------------------------------
+// QObjectAnnotator
+//-----------------------------------------------------------------------------
+
+QAnnotator::~QAnnotator()
+{
+
+}
+
+
+//-----------------------------------------------------------------------------
+// Annotators
+//-----------------------------------------------------------------------------
+
+QList<QByteArray> QAnnotatorBasic::annotation(const QObject& object)
+{
+ QList<QByteArray> result;
+
+ QByteArray array;
+ QTextStream stream(&array);
+
+ stream << '[' << &object << ']';
+ stream << ' ';
+ stream << object.metaObject()->className();
+
+ if(object.objectName() != "")
+ stream << " \"" << object.objectName() << '"';
+
+ if(object.isWidgetType())
+ stream << " isWidget";
+
+ stream.flush();
+ result.append(array);
+ return result;
+}
+
+QList<QByteArray> QAnnotatorWidget::annotation(const QObject& object)
+{
+ QList<QByteArray> result;
+
+ const QWidget* widget = qobject_cast<const QWidget*>(&object);
+ if(widget) {
+
+ QByteArray array;
+ QTextStream stream(&array);
+
+ stream << "widget: ";
+
+ if(widget->isVisible())
+ stream << "visible ";
+ else
+ stream << "invisible ";
+
+ stream << widget->x() << ',' << widget->y() << ' ';
+ stream << widget->size().width() << 'x'<< widget->size().height() << ' ';
+
+ stream << "hint " << widget->sizeHint().width() << 'x' << widget->sizeHint().height();
+
+ stream.flush();
+ result.append(array);
+ }
+
+ return result;
+}
+
+
+//-----------------------------------------------------------------------------
+// Base class for QDumperPrivate, QVisitorPrivate
+//-----------------------------------------------------------------------------
+
+class QDumperBase
+{
+public:
+ QDumperBase();
+ ~QDumperBase();
+
+ void setPrefix(const QString& prefix);
+ void addAnnotator(QAnnotator* annotator);
+
+protected:
+ QByteArray m_prefix;
+ QList<QAnnotator*> m_annotators;
+
+};
+
+QDumperBase::QDumperBase()
+{
+
+}
+
+QDumperBase::~QDumperBase()
+{
+ QAnnotator* annotator;
+ foreach(annotator, m_annotators)
+ delete annotator;
+}
+
+void QDumperBase::setPrefix(const QString& prefix)
+{
+ m_prefix = prefix.count()
+ ? (prefix + " ").toAscii()
+ : prefix.toAscii();
+}
+
+void QDumperBase::addAnnotator(QAnnotator* annotator)
+{
+ // Protect against an exception occurring during QList::append
+ QScopedPointer<QAnnotator> holder(annotator);
+ m_annotators.append(annotator);
+ holder.take();
+}
+
+
+//-----------------------------------------------------------------------------
+// QDumper
+//-----------------------------------------------------------------------------
+
+class QDumperPrivate : public QDumperBase
+{
+public:
+ QDumperPrivate();
+ ~QDumperPrivate();
+
+ void dumpObject(const QObject& object);
+
+};
+
+
+QDumperPrivate::QDumperPrivate()
+{
+
+}
+
+QDumperPrivate::~QDumperPrivate()
+{
+
+}
+
+void QDumperPrivate::dumpObject(const QObject& object)
+{
+ QAnnotator* annotator;
+ foreach(annotator, m_annotators) {
+
+ const QList<QByteArray> annotations = annotator->annotation(object);
+ QByteArray annotation;
+ foreach(annotation, annotations) {
+ QByteArray buffer(m_prefix);
+ buffer.append(annotation);
+ qDebug() << buffer.constData();
+ }
+ }
+}
+
+
+QDumper::QDumper()
+ : d_ptr(new QDumperPrivate)
+{
+
+}
+
+QDumper::~QDumper()
+{
+
+}
+
+void QDumper::setPrefix(const QString& prefix)
+{
+ d_func()->setPrefix(prefix);
+}
+
+void QDumper::addAnnotator(QAnnotator* annotator)
+{
+ d_func()->addAnnotator(annotator);
+}
+
+void QDumper::dumpObject(const QObject& object)
+{
+ d_func()->dumpObject(object);
+}
+
+
+//-----------------------------------------------------------------------------
+// QVisitor
+//-----------------------------------------------------------------------------
+
+class QVisitorPrivate : public QDumperBase
+{
+public:
+ QVisitorPrivate();
+ ~QVisitorPrivate();
+
+ void setIndent(unsigned indent);
+
+ void visitNode(const QObject& object);
+ void visitComplete();
+
+private:
+ class Node
+ {
+ public:
+ Node();
+ ~Node();
+
+ QList<QByteArray> m_annotation;
+ QList<Node*> m_children;
+
+ typedef QList<Node*>::const_iterator child_iterator;
+ };
+
+private:
+ Node* findNode(const QObject* object) const;
+ QByteArray branchBuffer(const QList<bool>& branches, bool isNodeLine, bool isLastChild) const;
+ void dumpRecursive(const Node& node, QList<bool> branches, bool isLastChild);
+ void dumpNode(const Node& node, const QList<bool>& branches, bool isLastChild);
+
+private:
+ unsigned m_indent;
+
+ QScopedPointer<Node> m_root;
+
+ // Hash table used to associate internal nodes with QObjects
+ typedef QHash<const QObject*, Node*> Hash;
+ Hash m_hash;
+};
+
+static const unsigned DefaultIndent = 2;
+
+QVisitorPrivate::QVisitorPrivate()
+ : m_indent(DefaultIndent)
+{
+
+}
+
+QVisitorPrivate::~QVisitorPrivate()
+{
+
+}
+
+void QVisitorPrivate::setIndent(unsigned indent)
+{
+ m_indent = indent;
+}
+
+// Builds up a mirror of the object tree, rooted in m_root, with each node
+// storing annotations generated by
+void QVisitorPrivate::visitNode(const QObject& object)
+{
+ QObject* const objectParent = object.parent();
+ Node* const nodeParent = objectParent ? findNode(objectParent) : 0;
+
+ // Create a new node and store in scoped pointer for exception safety
+ Node* node = new Node;
+ QScopedPointer<Node> nodePtr(node);
+
+ // Associate node with QObject
+ m_hash.insert(&object, node);
+
+ // Insert node into internal tree
+ if(nodeParent)
+ {
+ nodeParent->m_children.append(nodePtr.take());
+ }
+ else
+ {
+ Q_ASSERT(m_root.isNull());
+ m_root.reset(nodePtr.take());
+ }
+
+ // Generate and store annotations
+ QAnnotator* annotator;
+ foreach(annotator, m_annotators)
+ node->m_annotation.append( annotator->annotation(object) );
+}
+
+void QVisitorPrivate::visitComplete()
+{
+ QList<bool> branches;
+ static const bool isLastChild = true;
+ dumpRecursive(*m_root, branches, isLastChild);
+ m_root.reset(0);
+}
+
+QVisitorPrivate::Node* QVisitorPrivate::findNode(const QObject* object) const
+{
+ Hash::const_iterator i = m_hash.find(object);
+ return (m_hash.end() == i) ? 0 : *i;
+}
+
+QByteArray QVisitorPrivate::branchBuffer
+ (const QList<bool>& branches, bool isNodeLine, bool isLastChild) const
+{
+ const int depth = branches.count();
+
+ const QByteArray indent(m_indent, ' ');
+ const QByteArray horiz(m_indent, '-');
+
+ QByteArray buffer;
+ QTextStream stream(&buffer);
+
+ for (int i=0; i<depth-1; ++i) {
+ if(branches[i])
+ stream << '|';
+ else
+ stream << ' ';
+ stream << indent;
+ }
+
+ if(depth) {
+ if(isNodeLine)
+ stream << '+' << horiz;
+ else {
+ if(!isLastChild)
+ stream << '|';
+ else
+ stream << ' ';
+ stream << indent;
+ }
+ }
+
+ stream.flush();
+ buffer.push_front(m_prefix);
+
+ return buffer;
+}
+
+void QVisitorPrivate::dumpRecursive
+ (const Node& node, QList<bool> branches, bool isLastChild)
+{
+ dumpNode(node, branches, isLastChild);
+
+ // Recurse down tree
+ const Node::child_iterator begin = node.m_children.begin();
+ const Node::child_iterator end = node.m_children.end();
+ for(Node::child_iterator i = begin; end != i; ++i) {
+
+ isLastChild = (end == i + 1);
+
+ if(begin == i)
+ branches.push_back(!isLastChild);
+ else
+ branches.back() = !isLastChild;
+
+ static const bool isNodeLine = false;
+ const QByteArray buffer = branchBuffer(branches, isNodeLine, false);
+ qDebug() << buffer.constData();
+
+ dumpRecursive(**i, branches, isLastChild);
+ }
+}
+
+void QVisitorPrivate::dumpNode
+ (const Node& node, const QList<bool>& branches, bool isLastChild)
+{
+ const QList<QByteArray>::const_iterator
+ begin = node.m_annotation.begin(), end = node.m_annotation.end();
+
+ if(begin == end) {
+ // No annotations - just dump the object pointer
+ const bool isNodeLine = true;
+ QByteArray buffer = branchBuffer(branches, isNodeLine, isLastChild);
+ qDebug() << 0; // TODO
+ }
+ else {
+ // Dump annotations
+ for(QList<QByteArray>::const_iterator i = begin; end != i; ++i) {
+ const bool isNodeLine = (begin == i);
+ QByteArray buffer = branchBuffer(branches, isNodeLine, isLastChild);
+ buffer.append(*i);
+ qDebug() << buffer.constData();
+ }
+ }
+}
+
+
+// QVisitorPrivate::Node
+
+QVisitorPrivate::Node::Node()
+{
+
+}
+
+QVisitorPrivate::Node::~Node()
+{
+ Node* child;
+ foreach(child, m_children)
+ delete child;
+}
+
+
+// QVisitor
+
+QVisitor::QVisitor()
+ : d_ptr(new QVisitorPrivate)
+{
+
+}
+
+QVisitor::~QVisitor()
+{
+
+}
+
+void QVisitor::setPrefix(const QString& prefix)
+{
+ d_func()->setPrefix(prefix);
+}
+
+void QVisitor::setIndent(unsigned indent)
+{
+ d_func()->setIndent(indent);
+}
+
+void QVisitor::addAnnotator(QAnnotator* annotator)
+{
+ d_func()->addAnnotator(annotator);
+}
+
+void QVisitor::visitPrepare()
+{
+ // Do nothing
+}
+
+void QVisitor::visitNode(const QObject& object)
+{
+ d_func()->visitNode(object);
+}
+
+void QVisitor::visitComplete()
+{
+ d_func()->visitComplete();
+}
+
+
+//-----------------------------------------------------------------------------
+// Utility functions
+//-----------------------------------------------------------------------------
+
+void addDefaultAnnotators_sys(QDumper& visitor);
+void addDefaultAnnotators_sys(QVisitor& visitor);
+
+void addDefaultAnnotators(QDumper& dumper)
+{
+ dumper.addAnnotator(new QAnnotatorBasic);
+ dumper.addAnnotator(new QAnnotatorWidget);
+
+ // Add platform-specific annotators
+ addDefaultAnnotators_sys(dumper);
+}
+
+void addDefaultAnnotators(QVisitor& visitor)
+{
+ visitor.addAnnotator(new QAnnotatorBasic);
+ visitor.addAnnotator(new QAnnotatorWidget);
+
+ // Add platform-specific annotators
+ addDefaultAnnotators_sys(visitor);
+}
+
+void dumpTreeFromRoot(const QObject& root, QVisitor& visitor)
+{
+ // Set up iteration range
+ ObjectTree::DepthFirstConstIterator begin(root), end;
+
+ // Invoke generic visitor algorithm
+ ObjectTree::visit(begin, end, visitor);
+}
+
+void dumpTreeFromLeaf(const QObject& leaf, QVisitor& visitor)
+{
+ // Walk up to root
+ const QObject* root = &leaf;
+ while(root->parent())
+ {
+ root = root->parent();
+ }
+
+ dumpTreeFromRoot(*root, visitor);
+}
+
+void dumpAncestors(const QObject& leaf, QVisitor& visitor)
+{
+ // Set up iteration range
+ ObjectTree::AncestorConstIterator begin(leaf), end;
+
+ // Invoke generic visitor algorithm
+ ObjectTree::visit(begin, end, visitor);
+}
+
+
+} // namespace ObjectDump
+
+QT_END_NAMESPACE
+
+
+
diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.h b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.h
new file mode 100644
index 0000000..cbd9bea
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.h
@@ -0,0 +1,166 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef OBJECTDUMP_H
+#define OBJECTDUMP_H
+
+#include "objectdump_global.h"
+
+#include <QObject>
+#include <QList>
+#include <QByteArray>
+#include <QScopedPointer>
+
+QT_BEGIN_NAMESPACE
+
+namespace ObjectDump
+{
+
+/**
+ * Abstract base for annotator classes invoked by QVisitor.
+ */
+class OBJECTDUMP_EXPORT QAnnotator : public QObject
+{
+ Q_OBJECT
+public:
+ virtual ~QAnnotator();
+ virtual QList<QByteArray> annotation(const QObject& object) = 0;
+};
+
+/**
+ * Annotator which replicates QObject::dumpObjectTree functionality.
+ */
+class OBJECTDUMP_EXPORT QAnnotatorBasic : public QAnnotator
+{
+ Q_OBJECT
+public:
+ QList<QByteArray> annotation(const QObject& object);
+};
+
+/**
+ * Annotator which returns widget information.
+ */
+class OBJECTDUMP_EXPORT QAnnotatorWidget : public QAnnotator
+{
+ Q_OBJECT
+public:
+ QList<QByteArray> annotation(const QObject& object);
+};
+
+
+class QDumperPrivate;
+
+/**
+ * Class used to dump information about individual QObjects.
+ */
+class OBJECTDUMP_EXPORT QDumper : public QObject
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QDumper)
+
+public:
+ QDumper();
+ ~QDumper();
+
+ /**
+ * Specify a prefix, to be printed on each line of output.
+ */
+ void setPrefix(const QString& prefix);
+
+ /**
+ * Takes ownership of annotator.
+ */
+ void addAnnotator(QAnnotator* annotator);
+
+ /**
+ * Invoke each annotator on the object and write to debug output.
+ */
+ void dumpObject(const QObject& object);
+
+private:
+ QScopedPointer<QDumperPrivate> d_ptr;
+
+};
+
+
+class QVisitorPrivate;
+
+/**
+ * Visitor class which dumps information about nodes in the object tree.
+ */
+class OBJECTDUMP_EXPORT QVisitor : public QObject
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QVisitor)
+
+public:
+ QVisitor();
+ ~QVisitor();
+
+ /**
+ * Specify a prefix, to be printed on each line of output.
+ */
+ void setPrefix(const QString& prefix);
+
+ /**
+ * Set number of spaces by which each level of the tree is indented.
+ */
+ void setIndent(unsigned indent);
+
+ /**
+ * Called by the visitor algorithm before starting the visit.
+ */
+ void visitPrepare();
+
+ /**
+ * Called by the visitor algorithm as each node is visited.
+ */
+ void visitNode(const QObject& object);
+
+ /**
+ * Called by the visitor algorithm when the visit is complete.
+ */
+ void visitComplete();
+
+ /**
+ * Takes ownership of annotator.
+ */
+ void addAnnotator(QAnnotator* annotator);
+
+private:
+ QScopedPointer<QVisitorPrivate> d_ptr;
+
+};
+
+
+//-----------------------------------------------------------------------------
+// Utility functions
+//-----------------------------------------------------------------------------
+
+void OBJECTDUMP_EXPORT addDefaultAnnotators(QDumper& dumper);
+void OBJECTDUMP_EXPORT addDefaultAnnotators(QVisitor& visitor);
+
+void OBJECTDUMP_EXPORT dumpTreeFromRoot(const QObject& root, QVisitor& visitor);
+void OBJECTDUMP_EXPORT dumpTreeFromLeaf(const QObject& leaf, QVisitor& visitor);
+void OBJECTDUMP_EXPORT dumpAncestors(const QObject& leaf, QVisitor& visitor);
+
+} // namespace ObjectDump
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_global.h b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_global.h
new file mode 100644
index 0000000..b8987e0
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_global.h
@@ -0,0 +1,30 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef OBJECTDUMP_GLOBAL_H
+#define OBJECTDUMP_GLOBAL_H
+
+#include <QtCore/QtGlobal>
+
+#if defined(OBJECTDUMP_LIBRARY)
+# define OBJECTDUMP_EXPORT
+#else
+# define OBJECTDUMP_EXPORT
+#endif
+
+#endif
diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_stub.cpp b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_stub.cpp
new file mode 100644
index 0000000..6207dac
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_stub.cpp
@@ -0,0 +1,40 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include "objectdump.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace ObjectDump
+{
+
+void addDefaultAnnotators_sys(QDumper& /*dumper*/)
+{
+
+}
+
+void addDefaultAnnotators_sys(QVisitor& /*visitor*/)
+{
+
+}
+
+} // namespace ObjectDump
+
+QT_END_NAMESPACE
+
+
diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp
new file mode 100644
index 0000000..f8adcd5
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp
@@ -0,0 +1,135 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include <QTextStream>
+#include <QWidget>
+#include <coecntrl.h>
+#include "objectdump_symbian.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace ObjectDump
+{
+namespace Symbian
+{
+
+QList<QByteArray> QAnnotatorControl::annotation(const QObject& object)
+{
+ QList<QByteArray> result;
+
+ const QWidget* widget = qobject_cast<const QWidget*>(&object);
+ if(widget) {
+
+ const CCoeControl* control = widget->effectiveWinId();
+ if(control) {
+
+ QByteArray array;
+ QTextStream stream(&array);
+
+ stream << "control: " << control << ' ';
+ stream << "parent " << control->Parent() << ' ';
+
+ if(control->IsVisible())
+ stream << "visible ";
+ else
+ stream << "invisible ";
+
+ stream << control->Position().iX << ',' << control->Position().iY << ' ';
+ stream << control->Size().iWidth << 'x' << control->Size().iHeight;
+
+ if(control->OwnsWindow())
+ stream << " ownsWindow ";
+
+ stream.flush();
+ result.append(array);
+ }
+ }
+
+ return result;
+}
+
+QList<QByteArray> QAnnotatorWindow::annotation(const QObject& object)
+{
+ QList<QByteArray> result;
+
+ const QWidget* widget = qobject_cast<const QWidget*>(&object);
+ if(widget) {
+
+ const CCoeControl* control = widget->effectiveWinId();
+ if(control) {
+
+ RDrawableWindow& window = *(control->DrawableWindow());
+
+ QByteArray array;
+ QTextStream stream(&array);
+
+ stream << "window: ";
+
+ // ClientHandle() is available first in 5.0.
+#if !defined(__SERIES60_31__) && !defined(__S60_32__)
+ // Client-side window handle
+ // Cast to a void pointer so that log output is in hexadecimal format.
+ stream << "cli " << reinterpret_cast<const void*>(window.ClientHandle()) << ' ';
+#endif
+
+ // Server-side address of CWsWindow object
+ // This is useful for correlation with the window tree dumped by the window
+ // server (see RWsSession::LogCommand).
+ // Cast to a void pointer so that log output is in hexadecimal format.
+ stream << "srv " << reinterpret_cast<const void*>(window.WsHandle()) << ' ';
+
+ stream << "group " << window.WindowGroupId() << ' ';
+
+ // Client-side handle to the parent window.
+ // Cast to a void pointer so that log output is in hexadecimal format.
+ stream << "parent " << reinterpret_cast<const void*>(window.Parent()) << ' ';
+
+ stream << window.Position().iX << ',' << window.Position().iY << ' ';
+ stream << '(' << window.AbsPosition().iX << ',' << window.AbsPosition().iY << ") ";
+ stream << window.Size().iWidth << 'x' << window.Size().iHeight << ' ';
+
+ const TDisplayMode displayMode = window.DisplayMode();
+ stream << "mode " << displayMode;
+
+ stream.flush();
+ result.append(array);
+ }
+ }
+
+ return result;
+}
+
+} // namespace Symbian
+
+void addDefaultAnnotators_sys(QDumper& dumper)
+{
+ dumper.addAnnotator(new Symbian::QAnnotatorControl);
+ dumper.addAnnotator(new Symbian::QAnnotatorWindow);
+}
+
+void addDefaultAnnotators_sys(QVisitor& visitor)
+{
+ visitor.addAnnotator(new Symbian::QAnnotatorControl);
+ visitor.addAnnotator(new Symbian::QAnnotatorWindow);
+}
+
+} // namespace ObjectDump
+
+QT_END_NAMESPACE
+
+
diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.h b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.h
new file mode 100644
index 0000000..26ab308
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.h
@@ -0,0 +1,56 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef OBJECTDUMP_SYMBIAN_H
+#define OBJECTDUMP_SYMBIAN_H
+
+#include "objectdump.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace ObjectDump
+{
+namespace Symbian
+{
+
+/**
+ * Annotator which returns control information
+ */
+class QAnnotatorControl : public QAnnotator
+{
+ Q_OBJECT
+public:
+ QList<QByteArray> annotation(const QObject& object);
+};
+
+/**
+ * Annotator which returns window information
+ */
+class QAnnotatorWindow : public QAnnotator
+{
+ Q_OBJECT
+public:
+ QList<QByteArray> annotation(const QObject& object);
+};
+
+} // namespace Symbian
+} // namespace ObjectDump
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.cpp b/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.cpp
new file mode 100644
index 0000000..5053b2d
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.cpp
@@ -0,0 +1,102 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include <QTextStream>
+#include <QWidget>
+#include "objecttree.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace ObjectTree
+{
+
+DepthFirstConstIterator::DepthFirstConstIterator()
+ : m_pointee(0)
+{
+
+}
+
+DepthFirstConstIterator::DepthFirstConstIterator
+ (const QObject& root)
+ : m_pointee(&root)
+{
+
+}
+
+DepthFirstConstIterator&
+ DepthFirstConstIterator::operator++()
+{
+ const QObjectList& children = m_pointee->children();
+
+ if (children.count() == 0) {
+ backtrack();
+ }
+ else {
+ m_history.push(0);
+ m_pointee = children.first();
+ }
+
+ return *this;
+}
+
+void DepthFirstConstIterator::backtrack()
+{
+ if (m_history.count()) {
+ const int index = m_history.top();
+ m_history.pop();
+
+ const QObjectList& siblings = m_pointee->parent()->children();
+ if (siblings.count() > index + 1) {
+ m_history.push(index + 1);
+ m_pointee = siblings[index + 1];
+ }
+ else {
+ m_pointee = m_pointee->parent();
+ backtrack();
+ }
+ }
+ else {
+ // Reached end of search
+ m_pointee = 0;
+ }
+}
+
+
+
+AncestorConstIterator::AncestorConstIterator()
+{
+
+}
+
+AncestorConstIterator::AncestorConstIterator(const QObject& leaf)
+{
+ m_ancestors.push(&leaf);
+ QObject* ancestor = leaf.parent();
+ while(ancestor)
+ {
+ m_ancestors.push(ancestor);
+ ancestor = ancestor->parent();
+ }
+}
+
+} // namespace ObjectTree
+
+QT_END_NAMESPACE
+
+
+
diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.h b/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.h
new file mode 100644
index 0000000..f2729fa
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.h
@@ -0,0 +1,117 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef OBJECTTREE_H
+#define OBJECTTREE_H
+
+#include "objectdump_global.h"
+
+#include <QObject>
+#include <QStack>
+
+QT_BEGIN_NAMESPACE
+
+namespace ObjectTree
+{
+
+/**
+ * Depth-first iterator for QObject tree
+ */
+class OBJECTDUMP_EXPORT DepthFirstConstIterator
+{
+public:
+ DepthFirstConstIterator();
+ DepthFirstConstIterator(const QObject& root);
+
+ DepthFirstConstIterator& operator++();
+
+ inline bool operator==(const DepthFirstConstIterator& other) const
+ { return other.m_pointee == m_pointee; }
+
+ inline bool operator!=(const DepthFirstConstIterator& other) const
+ { return other.m_pointee != m_pointee; }
+
+ inline const QObject* operator->() const { return m_pointee; }
+ inline const QObject& operator*() const { return *m_pointee; }
+
+private:
+ void backtrack();
+
+private:
+ const QObject* m_pointee;
+ QStack<int> m_history;
+};
+
+/**
+ * Ancestor iterator for QObject tree
+ */
+class OBJECTDUMP_EXPORT AncestorConstIterator
+{
+public:
+ AncestorConstIterator();
+ AncestorConstIterator(const QObject& root);
+
+ inline AncestorConstIterator& operator++()
+ { m_ancestors.pop(); return *this; }
+
+ inline bool operator==(const AncestorConstIterator& other) const
+ { return other.m_ancestors == m_ancestors; }
+
+ inline bool operator!=(const AncestorConstIterator& other) const
+ { return other.m_ancestors != m_ancestors; }
+
+ inline const QObject* operator->() const { return m_ancestors.top(); }
+ inline const QObject& operator*() const { return *m_ancestors.top(); }
+
+private:
+ QStack<const QObject*> m_ancestors;
+
+};
+
+/**
+ * Generic algorithm for visiting nodes in an object tree. Nodes in the
+ * tree are visited in a const context, therefore they are not modified
+ * by this algorithm.
+ *
+ * Visitor must provide functions with the following signatures:
+ *
+ * Called before visit begins
+ * void visitPrepare()
+ *
+ * Called on each node visited
+ * void visitNode(const QObject& object)
+ *
+ * Called when visit is complete
+ * void visitComplete()
+ */
+template <class Iterator, class Visitor>
+void visit(Iterator begin, Iterator end, Visitor& visitor)
+{
+ visitor.visitPrepare();
+
+ for( ; begin != end; ++begin)
+ visitor.visitNode(*begin);
+
+ visitor.visitComplete();
+}
+
+} // namespace ObjectTree
+
+QT_END_NAMESPACE
+
+#endif // OBJECTTREE_H
diff --git a/src/3rdparty/phonon/mmf/utils.cpp b/src/3rdparty/phonon/mmf/utils.cpp
new file mode 100644
index 0000000..2956722
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/utils.cpp
@@ -0,0 +1,142 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include "utils.h"
+#include <e32std.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Phonon;
+using namespace Phonon::MMF;
+
+_LIT(PanicCategory, "Phonon::MMF");
+
+void MMF::Utils::panic(PanicCode code)
+{
+ User::Panic(PanicCategory, code);
+}
+
+
+static const TInt KMimePrefixLength = 6; // either "audio/" or "video/"
+_LIT(KMimePrefixAudio, "audio/");
+_LIT(KMimePrefixVideo, "video/");
+
+MMF::MediaType MMF::Utils::mimeTypeToMediaType(const TDesC& mimeType)
+{
+ MediaType result = MediaTypeUnknown;
+
+ if (mimeType.Left(KMimePrefixLength).Compare(KMimePrefixAudio) == 0) {
+ result = MediaTypeAudio;
+ } else if (mimeType.Left(KMimePrefixLength).Compare(KMimePrefixVideo) == 0) {
+ result = MediaTypeVideo;
+ }
+
+ return result;
+}
+
+
+#ifdef _DEBUG
+
+#include <hal.h>
+#include <hal_data.h>
+#include <gdi.h>
+#include <eikenv.h>
+
+struct TScreenInfo
+{
+ int width;
+ int height;
+ int bpp;
+ const char* address;
+ int initialOffset;
+ int lineOffset;
+ TDisplayMode displayMode;
+};
+
+static void getScreenInfoL(TScreenInfo& info)
+{
+ info.displayMode = CEikonEnv::Static()->ScreenDevice()->DisplayMode();
+
+ // Then we must set these as the input parameter
+ info.width = info.displayMode;
+ info.height = info.displayMode;
+ info.initialOffset = info.displayMode;
+ info.lineOffset = info.displayMode;
+ info.bpp = info.displayMode;
+
+ User::LeaveIfError( HAL::Get(HALData::EDisplayXPixels, info.width) );
+ User::LeaveIfError( HAL::Get(HALData::EDisplayYPixels, info.width) );
+
+ int address;
+ User::LeaveIfError( HAL::Get(HALData::EDisplayMemoryAddress, address) );
+ info.address = reinterpret_cast<const char*>(address);
+
+ User::LeaveIfError( HAL::Get(HALData::EDisplayOffsetToFirstPixel, info.initialOffset) );
+
+ User::LeaveIfError( HAL::Get(HALData::EDisplayOffsetBetweenLines, info.lineOffset) );
+
+ User::LeaveIfError( HAL::Get(HALData::EDisplayBitsPerPixel, info.bpp) );
+}
+
+
+QColor MMF::Utils::getScreenPixel(const QPoint& pos)
+{
+ TScreenInfo info;
+ TRAPD(err, getScreenInfoL(info));
+ QColor pixel;
+ if(err == KErrNone and pos.x() < info.width and pos.y() < info.height)
+ {
+ const int bytesPerPixel = info.bpp / 8;
+ Q_ASSERT(bytesPerPixel >= 3);
+
+ const int stride = (info.width * bytesPerPixel) + info.lineOffset;
+
+ const char* ptr =
+ info.address
+ + info.initialOffset
+ + pos.y() * stride
+ + pos.x() * bytesPerPixel;
+
+ // BGRA
+ pixel.setBlue(*ptr++);
+ pixel.setGreen(*ptr++);
+ pixel.setRed(*ptr++);
+
+ if(bytesPerPixel == 4)
+ pixel.setAlpha(*ptr++);
+ }
+ return pixel;
+}
+
+// Debugging: for debugging video visibility
+void MMF::Utils::dumpScreenPixelSample()
+{
+ for(int i=0; i<20; ++i) {
+ const QPoint pos(i*10, i*10);
+ const QColor pixel = Utils::getScreenPixel(pos);
+ RDebug::Printf(
+ "Phonon::MMF::Utils::dumpScreenPixelSample %d %d = %d %d %d %d",
+ pos.x(), pos.y(), pixel.red(), pixel.green(), pixel.blue(), pixel.alpha()
+ );
+ }
+}
+
+#endif // _DEBUG
+
+QT_END_NAMESPACE
+
diff --git a/src/3rdparty/phonon/mmf/utils.h b/src/3rdparty/phonon/mmf/utils.h
new file mode 100644
index 0000000..38964d0
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/utils.h
@@ -0,0 +1,167 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef PHONON_MMF_UTILS_H
+#define PHONON_MMF_UTILS_H
+
+#include <private/qcore_symbian_p.h>
+#include <e32debug.h> // for RDebug
+
+#include <QColor>
+
+#include "defs.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Phonon
+{
+namespace MMF
+{
+/**
+ * Panic codes for fatal errors
+ */
+enum PanicCode {
+ InvalidStatePanic = 1,
+ InvalidMediaTypePanic = 2,
+ InvalidBackendInterfaceClass = 3
+};
+
+namespace Utils
+{
+/**
+ * Raise a fatal exception
+ */
+void panic(PanicCode code);
+
+/**
+ * Determines whether the provided MIME type is an audio or video
+ * type. If it is neither, the function returns MediaTypeUnknown.
+ */
+MediaType mimeTypeToMediaType(const TDesC& mimeType);
+
+#ifdef _DEBUG
+/**
+ * Retrieve color of specified pixel from the screen.
+ */
+QColor getScreenPixel(const QPoint& pos);
+
+/**
+ * Samples a small number of pixels from the screen, and dumps their
+ * colors to the debug log.
+ */
+void dumpScreenPixelSample();
+#endif
+}
+
+/**
+ * Available trace categories;
+ */
+enum TTraceCategory {
+ /**
+ * Backend
+ */
+ EBackend = 0x00000001,
+
+ /**
+ * Functions which map directly to the public Phonon audio API
+ */
+ EAudioApi = 0x00000010,
+
+ /**
+ * Internal functions in the audio implementation
+ */
+ EAudioInternal = 0x00000020,
+
+ /**
+ * Functions which map directly to the public Phonon video API
+ */
+ EVideoApi = 0x00010000,
+
+ /**
+ * Internal functions in the video implementation
+ */
+ EVideoInternal = 0x00020000
+};
+
+/**
+ * Mask indicating which trace categories are enabled
+ *
+ * Note that, at the moment, this is a compiled static constant. For
+ * runtime control over enabled trace categories, this could be replaced
+ * by a per-thread singleton object which owns the trace mask, and which
+ * exposes an API allowing it to be modified.
+ */
+static const TUint KTraceMask = 0xffffffff;
+
+/**
+ * Data structure used by tracing macros
+ */
+class TTraceContext
+{
+public:
+ TTraceContext(const TText* aFunction, const TUint aAddr,
+ const TUint aCategory = 0)
+ : iFunction(aFunction),
+ iAddr(aAddr),
+ iCategory(aCategory) { }
+
+ /**
+ * Check whether iCategory appears in the trace mask
+ */
+ TBool Enabled() const {
+ return (iCategory == 0) or(iCategory & KTraceMask);
+ }
+
+ const TText* iFunction; // Name of function
+ const TUint iAddr; // 'this' pointer
+ const TUint iCategory;
+};
+
+// Macros used internally by the trace system
+#define _TRACE_PRINT RDebug::Print
+#define _TRACE_TEXT(x) (TPtrC((const TText *)(x)))
+#define _TRACE_MODULE Phonon::MMF
+
+// Macros available for use by implementation code
+#ifdef _DEBUG
+#define TRACE_CONTEXT(_fn, _cat) const ::Phonon::MMF::TTraceContext _tc((TText*)L ## #_fn, (TUint)this, _cat);
+#define TRACE_ENTRY_0() { if(_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## "+ Phonon::MMF::%s [0x%08x]"), _tc.iFunction, _tc.iAddr); }
+#define TRACE_ENTRY(string, args...) { if(_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## "+ Phonon::MMF::%s [0x%08x] " L ## string), _tc.iFunction, _tc.iAddr, args); }
+#define TRACE_EXIT_0() { if(_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## "- Phonon::MMF::%s [0x%08x]"), _tc.iFunction, _tc.iAddr); }
+#define TRACE_EXIT(string, args...) { if(_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## "- Phonon::MMF::%s [0x%08x] " L ## string), _tc.iFunction, _tc.iAddr, args); }
+#define TRACE_RETURN(string, result) { if(_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## "r Phonon::MMF::%s [0x%08x] " L ## string), _tc.iFunction, _tc.iAddr, result); } return result;
+#define TRACE_PANIC(code) { _TRACE_PRINT(_TRACE_TEXT(L ## "! Phonon::MMF::%s [0x%08x] panic %d"), _tc.iFunction, _tc.iAddr, code); } Utils::panic(code);
+#define TRACE_0(string) { if(_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## " Phonon::MMF::%s [0x%08x] " L ## string), _tc.iFunction, _tc.iAddr); }
+#define TRACE(string, args...) { if(_tc.Enabled()) _TRACE_PRINT(_TRACE_TEXT(L ## " Phonon::MMF::%s [0x%08x] " L ## string), _tc.iFunction, _tc.iAddr, args); }
+#else
+#define TRACE_CONTEXT(_fn, _cat)
+#define TRACE_ENTRY_0()
+#define TRACE_ENTRY(string, args...)
+#define TRACE_EXIT_0()
+#define TRACE_EXIT(string, args...)
+#define TRACE_RETURN(string, result) return result;
+#define TRACE_PANIC(code) Utils::panic(code);
+#define TRACE_0(string)
+#define TRACE(string, args...)
+#endif
+}
+}
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/3rdparty/phonon/mmf/videooutput.cpp b/src/3rdparty/phonon/mmf/videooutput.cpp
new file mode 100644
index 0000000..e51fbcf
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/videooutput.cpp
@@ -0,0 +1,173 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include "utils.h"
+#include "videooutput.h"
+#include "videooutputobserver.h"
+
+#ifdef _DEBUG
+#include "objectdump.h"
+#endif
+
+#include <QPaintEvent>
+#include <QPainter>
+#include <QMoveEvent>
+#include <QResizeEvent>
+
+#include <QtGui/private/qwidget_p.h> // to access QWExtra
+
+QT_BEGIN_NAMESPACE
+
+using namespace Phonon;
+using namespace Phonon::MMF;
+
+//-----------------------------------------------------------------------------
+// Constructor / destructor
+//-----------------------------------------------------------------------------
+
+MMF::VideoOutput::VideoOutput(QWidget* parent)
+ : QWidget(parent)
+ , m_observer(0)
+{
+ TRACE_CONTEXT(VideoOutput::VideoOutput, EVideoInternal);
+ TRACE_ENTRY("parent 0x%08x", parent);
+
+ setPalette(QPalette(Qt::black));
+ setAttribute(Qt::WA_OpaquePaintEvent, true);
+ setAttribute(Qt::WA_NoSystemBackground, true);
+ setAutoFillBackground(false);
+
+ // Causes QSymbianControl::Draw not to BitBlt this widget's region of the
+ // backing store. Since the backing store is (by default) a 16MU bitmap,
+ // blitting it results in this widget's screen region in the final
+ // framebuffer having opaque alpha values. This in turn causes the video
+ // to be invisible when running on the target device.
+ qt_widget_private(this)->extraData()->disableBlit = true;
+
+ dump();
+
+ TRACE_EXIT_0();
+}
+
+MMF::VideoOutput::~VideoOutput()
+{
+ TRACE_CONTEXT(VideoOutput::~VideoOutput, EVideoInternal);
+ TRACE_ENTRY_0();
+
+ TRACE_EXIT_0();
+}
+
+void MMF::VideoOutput::setFrameSize(const QSize& frameSize)
+{
+ TRACE_CONTEXT(VideoOutput::setFrameSize, EVideoInternal);
+ TRACE("oldSize %d %d newSize %d %d",
+ m_frameSize.width(), m_frameSize.height(),
+ frameSize.width(), frameSize.height());
+
+ if (frameSize != m_frameSize) {
+ m_frameSize = frameSize;
+ updateGeometry();
+ }
+}
+
+void MMF::VideoOutput::setObserver(VideoOutputObserver* observer)
+{
+ TRACE_CONTEXT(VideoOutput::setObserver, EVideoInternal);
+ TRACE("observer 0x%08x", observer);
+
+ m_observer = observer;
+}
+
+
+//-----------------------------------------------------------------------------
+// QWidget
+//-----------------------------------------------------------------------------
+
+QSize MMF::VideoOutput::sizeHint() const
+{
+ // TODO: replace this with a more sensible default
+ QSize result(320, 240);
+
+ if (!m_frameSize.isNull()) {
+ result = m_frameSize;
+ }
+
+ return result;
+}
+
+void MMF::VideoOutput::paintEvent(QPaintEvent* event)
+{
+ TRACE_CONTEXT(VideoOutput::paintEvent, EVideoInternal);
+ TRACE("rect %d %d - %d %d",
+ event->rect().left(), event->rect().top(),
+ event->rect().right(), event->rect().bottom());
+ TRACE("regions %d", event->region().numRects());
+ TRACE("type %d", event->type());
+
+ dump();
+
+ // Do not paint anything
+}
+
+void MMF::VideoOutput::resizeEvent(QResizeEvent* event)
+{
+ TRACE_CONTEXT(VideoOutput::resizeEvent, EVideoInternal);
+ TRACE("%d %d -> %d %d",
+ event->oldSize().width(), event->oldSize().height(),
+ event->size().width(), event->size().height());
+
+ QWidget::resizeEvent(event);
+
+ if (m_observer)
+ m_observer->videoOutputRegionChanged();
+}
+
+void MMF::VideoOutput::moveEvent(QMoveEvent* event)
+{
+ TRACE_CONTEXT(VideoOutput::moveEvent, EVideoInternal);
+ TRACE("%d %d -> %d %d",
+ event->oldPos().x(), event->oldPos().y(),
+ event->pos().x(), event->pos().y());
+
+ QWidget::moveEvent(event);
+
+ if (m_observer)
+ m_observer->videoOutputRegionChanged();
+}
+
+
+//-----------------------------------------------------------------------------
+// Private functions
+//-----------------------------------------------------------------------------
+
+void VideoOutput::dump() const
+{
+#ifdef _DEBUG
+ TRACE_CONTEXT(VideoOutput::dump, EVideoInternal);
+ QScopedPointer<ObjectDump::QVisitor> visitor(new ObjectDump::QVisitor);
+ visitor->setPrefix("Phonon::MMF"); // to aid searchability of logs
+ ObjectDump::addDefaultAnnotators(*visitor);
+ TRACE("Dumping tree from leaf 0x%08x:", this);
+ //ObjectDump::dumpAncestors(*this, *visitor);
+ ObjectDump::dumpTreeFromLeaf(*this, *visitor);
+#endif
+}
+
+
+QT_END_NAMESPACE
+
diff --git a/src/3rdparty/phonon/mmf/videooutput.h b/src/3rdparty/phonon/mmf/videooutput.h
new file mode 100644
index 0000000..639a5ed
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/videooutput.h
@@ -0,0 +1,67 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef PHONON_MMF_VIDEOOUTPUT_H
+#define PHONON_MMF_VIDEOOUTPUT_H
+
+#include <QtGui/QWidget>
+#include <QVector>
+#include <QRect>
+#include "defs.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Phonon
+{
+namespace MMF
+{
+class VideoOutputObserver;
+
+class VideoOutput : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit VideoOutput(QWidget* parent);
+ ~VideoOutput();
+
+ void setFrameSize(const QSize& size);
+ void setObserver(VideoOutputObserver* observer);
+
+protected:
+ // Override QWidget functions
+ QSize sizeHint() const;
+ void paintEvent(QPaintEvent* event);
+ void resizeEvent(QResizeEvent* event);
+ void moveEvent(QMoveEvent* event);
+
+private:
+ void dump() const;
+
+private:
+ QSize m_frameSize;
+
+ // Not owned
+ VideoOutputObserver* m_observer;
+};
+}
+}
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/3rdparty/phonon/mmf/videooutputobserver.h b/src/3rdparty/phonon/mmf/videooutputobserver.h
new file mode 100644
index 0000000..e3ba305
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/videooutputobserver.h
@@ -0,0 +1,44 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef PHONON_MMF_VIDEOOUTPUTOBSERVER_H
+#define PHONON_MMF_VIDEOOUTPUTOBSERVER_H
+
+#include <QtGlobal>
+
+QT_BEGIN_NAMESPACE
+
+namespace Phonon
+{
+namespace MMF
+{
+/**
+ * Interface via which VideoOutput notifies VideoPlayer of changes to the
+ * video output screen region.
+ */
+class VideoOutputObserver
+{
+public:
+ virtual void videoOutputRegionChanged() = 0;
+};
+}
+}
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/3rdparty/phonon/mmf/videowidget.cpp b/src/3rdparty/phonon/mmf/videowidget.cpp
new file mode 100644
index 0000000..ac93929
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/videowidget.cpp
@@ -0,0 +1,173 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include "mediaobject.h"
+#include "utils.h"
+#include "videooutput.h"
+
+#include "videowidget.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace Phonon;
+using namespace Phonon::MMF;
+
+//-----------------------------------------------------------------------------
+// Constants
+//-----------------------------------------------------------------------------
+
+static const Phonon::VideoWidget::AspectRatio DefaultAspectRatio =
+ Phonon::VideoWidget::AspectRatioAuto;
+static const qreal DefaultBrightness = 1.0;
+static const Phonon::VideoWidget::ScaleMode DefaultScaleMode =
+ Phonon::VideoWidget::FitInView;
+static const qreal DefaultContrast = 1.0;
+static const qreal DefaultHue = 1.0;
+static const qreal DefaultSaturation = 1.0;
+
+
+//-----------------------------------------------------------------------------
+// Constructor / destructor
+//-----------------------------------------------------------------------------
+
+MMF::VideoWidget::VideoWidget(QWidget* parent)
+ : MediaNode(parent)
+ , m_widget(new VideoOutput(parent))
+ , m_aspectRatio(DefaultAspectRatio)
+ , m_brightness(DefaultBrightness)
+ , m_scaleMode(DefaultScaleMode)
+ , m_contrast(DefaultContrast)
+ , m_hue(DefaultHue)
+ , m_saturation(DefaultSaturation)
+{
+ TRACE_CONTEXT(VideoWidget::VideoWidget, EVideoApi);
+ TRACE_ENTRY_0();
+
+ TRACE_EXIT_0();
+}
+
+MMF::VideoWidget::~VideoWidget()
+{
+ TRACE_CONTEXT(VideoWidget::~VideoWidget, EVideoApi);
+ TRACE_ENTRY_0();
+
+ TRACE_EXIT_0();
+}
+
+
+//-----------------------------------------------------------------------------
+// VideoWidgetInterface
+//-----------------------------------------------------------------------------
+
+Phonon::VideoWidget::AspectRatio MMF::VideoWidget::aspectRatio() const
+{
+ return m_aspectRatio;
+}
+
+void MMF::VideoWidget::setAspectRatio
+(Phonon::VideoWidget::AspectRatio aspectRatio)
+{
+ TRACE_CONTEXT(VideoWidget::setAspectRatio, EVideoApi);
+ TRACE("aspectRatio %d", aspectRatio);
+
+ m_aspectRatio = aspectRatio;
+}
+
+qreal MMF::VideoWidget::brightness() const
+{
+ return m_brightness;
+}
+
+void MMF::VideoWidget::setBrightness(qreal brightness)
+{
+ TRACE_CONTEXT(VideoWidget::setBrightness, EVideoApi);
+ TRACE("brightness %f", brightness);
+
+ m_brightness = brightness;
+}
+
+Phonon::VideoWidget::ScaleMode MMF::VideoWidget::scaleMode() const
+{
+ return m_scaleMode;
+}
+
+void MMF::VideoWidget::setScaleMode(Phonon::VideoWidget::ScaleMode scaleMode)
+{
+ TRACE_CONTEXT(VideoWidget::setScaleMode, EVideoApi);
+ TRACE("setScaleMode %d", setScaleMode);
+
+ m_scaleMode = scaleMode;
+}
+
+qreal MMF::VideoWidget::contrast() const
+{
+ return m_contrast;
+}
+
+void MMF::VideoWidget::setContrast(qreal contrast)
+{
+ TRACE_CONTEXT(VideoWidget::setContrast, EVideoApi);
+ TRACE("contrast %f", contrast);
+
+ m_contrast = contrast;
+}
+
+qreal MMF::VideoWidget::hue() const
+{
+ return m_hue;
+}
+
+void MMF::VideoWidget::setHue(qreal hue)
+{
+ TRACE_CONTEXT(VideoWidget::setHue, EVideoApi);
+ TRACE("hue %f", hue);
+
+ m_hue = hue;
+}
+
+qreal MMF::VideoWidget::saturation() const
+{
+ return m_saturation;
+}
+
+void MMF::VideoWidget::setSaturation(qreal saturation)
+{
+ TRACE_CONTEXT(VideoWidget::setSaturation, EVideoApi);
+ TRACE("saturation %f", saturation);
+
+ m_saturation = saturation;
+}
+
+QWidget* MMF::VideoWidget::widget()
+{
+ return m_widget.data();
+}
+
+VideoOutput& MMF::VideoWidget::videoOutput()
+{
+ return *static_cast<VideoOutput*>(widget());
+}
+
+bool MMF::VideoWidget::activateOnMediaObject(MediaObject *mo)
+{
+ mo->setVideoOutput(&videoOutput());
+ return true;
+}
+
+QT_END_NAMESPACE
+
diff --git a/src/3rdparty/phonon/mmf/videowidget.h b/src/3rdparty/phonon/mmf/videowidget.h
new file mode 100644
index 0000000..970f749
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/videowidget.h
@@ -0,0 +1,82 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef PHONON_MMF_VIDEOWIDGET_H
+#define PHONON_MMF_VIDEOWIDGET_H
+
+#include "mmf_medianode.h"
+
+#include <QtGui/QWidget>
+#include <Phonon/VideoWidget>
+#include <Phonon/VideoWidgetInterface>
+
+QT_BEGIN_NAMESPACE
+
+namespace Phonon
+{
+namespace MMF
+{
+class VideoOutput;
+
+class VideoWidget : public MediaNode
+ , public Phonon::VideoWidgetInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(Phonon::VideoWidgetInterface)
+
+public:
+ VideoWidget(QWidget* parent);
+ ~VideoWidget();
+
+ // VideoWidgetInterface
+ virtual Phonon::VideoWidget::AspectRatio aspectRatio() const;
+ virtual void setAspectRatio(Phonon::VideoWidget::AspectRatio aspectRatio);
+ virtual qreal brightness() const;
+ virtual void setBrightness(qreal brightness);
+ virtual Phonon::VideoWidget::ScaleMode scaleMode() const;
+ virtual void setScaleMode(Phonon::VideoWidget::ScaleMode scaleMode);
+ virtual qreal contrast() const;
+ virtual void setContrast(qreal constrast);
+ virtual qreal hue() const;
+ virtual void setHue(qreal hue);
+ virtual qreal saturation() const;
+ virtual void setSaturation(qreal saturation);
+ virtual QWidget *widget();
+
+ VideoOutput& videoOutput();
+
+protected:
+ virtual bool activateOnMediaObject(MediaObject *mo);
+
+private:
+ QScopedPointer<QWidget> m_widget;
+
+ Phonon::VideoWidget::AspectRatio m_aspectRatio;
+ qreal m_brightness;
+ Phonon::VideoWidget::ScaleMode m_scaleMode;
+ qreal m_contrast;
+ qreal m_hue;
+ qreal m_saturation;
+
+};
+}
+}
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/3rdparty/phonon/mmf/volumeobserver.h b/src/3rdparty/phonon/mmf/volumeobserver.h
new file mode 100644
index 0000000..bedd3de
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/volumeobserver.h
@@ -0,0 +1,44 @@
+/* This file is part of the KDE project.
+
+Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation, either version 2.1 or 3 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef PHONON_MMF_VOLUMEOBSERVER_H
+#define PHONON_MMF_VOLUMEOBSERVER_H
+
+#include <QtGlobal>
+
+QT_BEGIN_NAMESPACE
+
+namespace Phonon
+{
+namespace MMF
+{
+/**
+ * Interface used by AudioOutput to pass volume control commands
+ * back along the audio path to the MediaObject.
+ */
+class VolumeObserver
+{
+public:
+ virtual void volumeChanged(qreal volume) = 0;
+};
+}
+}
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/3rdparty/phonon/phonon/factory.cpp b/src/3rdparty/phonon/phonon/factory.cpp
index fef88f0..5c3752a 100644
--- a/src/3rdparty/phonon/phonon/factory.cpp
+++ b/src/3rdparty/phonon/phonon/factory.cpp
@@ -133,9 +133,30 @@ bool FactoryPrivate::createBackend()
continue;
}
- const QStringList files = dir.entryList(QDir::Files);
- for (int i = 0; i < files.count(); ++i) {
- QPluginLoader pluginLoader(libPath + files.at(i));
+ QStringList plugins(dir.entryList(QDir::Files));
+
+#ifdef Q_OS_SYMBIAN
+ /* On Symbian OS we might have two plugins, one which uses Symbian
+ * MMF framework("phonon_mmf"), and one which uses Real Networks's
+ * Helix("hxphonon"). We prefer the latter because it's more
+ * sophisticated, so we make sure the Helix backend is attempted
+ * to be loaded first, and the MMF backend is used for backup. */
+ {
+
+ const int hxphonon = plugins.indexOf(QLatin1String("hxphonon"));
+ if (hxphonon != -1)
+ plugins.move(hxphonon, 0);
+
+ // Code for debugging the MMF backend.
+ if(hxphonon != -1) {
+ qDebug() << "Found hxphonon backend and removed it from the lookup list.";
+ plugins.removeAll(QLatin1String("hxphonon"));
+ }
+ }
+#endif
+
+ for (int i = 0; i < plugins.count(); ++i) {
+ QPluginLoader pluginLoader(libPath + plugins.at(i));
if (!pluginLoader.load()) {
pDebug() << Q_FUNC_INFO << " load failed:"
<< pluginLoader.errorString();
diff --git a/src/3rdparty/phonon/phonon/path.cpp b/src/3rdparty/phonon/phonon/path.cpp
index aec8d05..ef3530c 100644
--- a/src/3rdparty/phonon/phonon/path.cpp
+++ b/src/3rdparty/phonon/phonon/path.cpp
@@ -310,8 +310,8 @@ bool PathPrivate::executeTransaction( const QList<QObjectPair> &disconnections,
if (!transaction)
return false;
- QList<QObjectPair>::const_iterator it = disconnections.begin();
- for(;it != disconnections.end();++it) {
+ QList<QObjectPair>::const_iterator it = disconnections.constBegin();
+ for(;it != disconnections.constEnd();++it) {
const QObjectPair &pair = *it;
if (!backend->disconnectNodes(pair.first, pair.second)) {
@@ -327,8 +327,8 @@ bool PathPrivate::executeTransaction( const QList<QObjectPair> &disconnections,
}
}
- for(it = connections.begin(); it != connections.end();++it) {
- const QObjectPair &pair = *it;
+ for(it = connections.constBegin(); it != connections.constEnd(); ++it) {
+ const QObjectPair pair = *it;
if (!backend->connectNodes(pair.first, pair.second)) {
//Error: a connection failed
QList<QObjectPair>::const_iterator it2 = connections.begin();
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.h b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.h
index 1a55bb5..0ecff19 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.h
+++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.h
@@ -181,7 +181,7 @@ namespace JSC {
#endif
template<> struct CellSize<sizeof(uint64_t)> { static const size_t m_value = 64; };
-#if PLATFORM(WINCE)
+#if PLATFORM(WINCE) || PLATFORM(SYMBIAN)
const size_t BLOCK_SIZE = 64 * 1024; // 64k
#else
const size_t BLOCK_SIZE = 64 * 4096; // 256k
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index 741c06f..473398b 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -1627,6 +1627,11 @@ public:
NavigationModeCursorAuto,
NavigationModeCursorForceVisible
};
+
+ enum RenderHint {
+ QualityHint,
+ PerformanceHint
+ };
}
#ifdef Q_MOC_RUN
;
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index 40dd1d2..684ebca 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -2776,6 +2776,19 @@
*/
/*!
+ \enum Qt::CoordinateSystem
+ \since 4.6
+
+ This enum specifies the coordinate system.
+
+ \value DeviceCoordinates Coordinates are relative to the upper-left corner
+ of the object's paint device.
+
+ \value LogicalCoordinates Coordinates are relative to the upper-left corner
+ of the object.
+*/
+
+/*!
\enum Qt::GestureState
\since 4.6
@@ -2814,3 +2827,18 @@
\sa QApplication::setNavigationMode()
\sa QApplication::navigationMode()
*/
+
+/*!
+ \enum Qt::RenderHint
+ \since 4.6
+
+ This enum describes the possible hints that can be used to control various
+ rendering operations.
+
+ \value QualityHint Indicates that rendering quality is the most important factor,
+ at the potential cost of lower performance.
+
+ \value PerformanceHint Indicates that rendering performance is the most important factor,
+ at the potential cost of lower quality.
+*/
+
diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri
index e58e4ad..02a1586 100644
--- a/src/corelib/io/io.pri
+++ b/src/corelib/io/io.pri
@@ -5,6 +5,7 @@ HEADERS += \
io/qabstractfileengine_p.h \
io/qbuffer.h \
io/qdatastream.h \
+ io/qdatastream_p.h \
io/qdebug.h \
io/qdir.h \
io/qdiriterator.h \
@@ -89,6 +90,7 @@ win32 {
symbian {
SOURCES += io/qfilesystemwatcher_symbian.cpp
HEADERS += io/qfilesystemwatcher_symbian_p.h
+ INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
contains(QT_CONFIG, s60): LIBS += -lplatformenv
}
}
diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp
index 9339b8e..cc62201 100644
--- a/src/corelib/io/qdatastream.cpp
+++ b/src/corelib/io/qdatastream.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include "qdatastream.h"
+#include "qdatastream_p.h"
#ifndef QT_NO_DATASTREAM
#include "qbuffer.h"
@@ -193,6 +194,21 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ \enum QDataStream::FloatingPointPrecision
+
+ The precision of floating point numbers used for reading/writing the data. This will only have
+ an effect if the version of the data stream is Qt_4_6 or higher.
+
+ \warning The floating point precision must be set to the same value on the object that writes
+ and the object that reads the data stream.
+
+ \value SinglePrecision All floating point numbers in the data stream have 32-bit precision.
+ \value DoublePrecision All floating point numbers in the data stream have 64-bit precision.
+
+ \sa setFloatingPointPrecision(), floatingPointPrecision()
+*/
+
+/*!
\enum QDataStream::Status
This enum describes the current status of the data stream.
@@ -222,7 +238,7 @@ QT_BEGIN_NAMESPACE
#endif
enum {
- DefaultStreamVersion = QDataStream::Qt_4_5
+ DefaultStreamVersion = QDataStream::Qt_4_6
};
// ### 5.0: when streaming invalid QVariants, just the type should
@@ -414,6 +430,42 @@ bool QDataStream::atEnd() const
}
/*!
+ Returns the floating point precision of the data stream.
+
+ \since 4.6
+
+ \sa FloatingPointPrecision setFloatingPointPrecision()
+*/
+QDataStream::FloatingPointPrecision QDataStream::floatingPointPrecision() const
+{
+ return d == 0 ? QDataStream::DoublePrecision : d->floatingPointPrecision;
+}
+
+/*!
+ Sets the floating point precision of the data stream. If the floating point precision is
+ DoublePrecision and the version of the data stream is Qt_4_6 or higher, all floating point
+ numbers will be written and read with 64-bit precision. If the floating point precision is
+ SinglePrecision and the version is Qt_4_6 or higher, all floating point numbers will be written
+ and read with 32-bit precision.
+
+ For versions prior to Qt_4_6, the precision of floating point numbers in the data stream depends
+ on the stream operator called.
+
+ The default is DoublePrecision.
+
+ \warning This property must be set to the same value on the object that writes and the object
+ that reads the data stream.
+
+ \since 4.6
+*/
+void QDataStream::setFloatingPointPrecision(QDataStream::FloatingPointPrecision precision)
+{
+ if (d == 0)
+ d.reset(new QDataStreamPrivate());
+ d->floatingPointPrecision = precision;
+}
+
+/*!
Returns the status of the data stream.
\sa Status setStatus() resetStatus()
@@ -517,7 +569,7 @@ void QDataStream::setByteOrder(ByteOrder bo)
\value Qt_4_3 Version 9 (Qt 4.3)
\value Qt_4_4 Version 10 (Qt 4.4)
\value Qt_4_5 Version 11 (Qt 4.5)
- \omitvalue Qt_4_6
+ \value Qt_4_6 Version 12 (Qt 4.6)
\sa setVersion(), version()
*/
@@ -754,13 +806,23 @@ QDataStream &QDataStream::operator>>(bool &i)
/*!
\overload
- Reads a 32-bit floating point number from the stream into \a f,
+ Reads a floating point number from the stream into \a f,
using the standard IEEE 754 format. Returns a reference to the
stream.
+
+ \sa setFloatingPointPrecision()
*/
QDataStream &QDataStream::operator>>(float &f)
-{
+{
+ if (version() >= QDataStream::Qt_4_6
+ && floatingPointPrecision() == QDataStream::DoublePrecision) {
+ double d;
+ *this >> d;
+ f = d;
+ return *this;
+ }
+
f = 0.0f;
CHECK_STREAM_PRECOND(*this)
if (noswap) {
@@ -796,13 +858,23 @@ QDataStream &QDataStream::operator>>(float &f)
/*!
\overload
- Reads a 64-bit floating point number from the stream into \a f,
+ Reads a floating point number from the stream into \a f,
using the standard IEEE 754 format. Returns a reference to the
stream.
+
+ \sa setFloatingPointPrecision()
*/
QDataStream &QDataStream::operator>>(double &f)
{
+ if (version() >= QDataStream::Qt_4_6
+ && floatingPointPrecision() == QDataStream::SinglePrecision) {
+ float d;
+ *this >> d;
+ f = d;
+ return *this;
+ }
+
f = 0.0;
CHECK_STREAM_PRECOND(*this)
#ifndef Q_DOUBLE_FORMAT
@@ -1115,12 +1187,20 @@ QDataStream &QDataStream::operator<<(bool i)
/*!
\overload
- Writes a 32-bit floating point number, \a f, to the stream using
+ Writes a floating point number, \a f, to the stream using
the standard IEEE 754 format. Returns a reference to the stream.
+
+ \sa setFloatingPointPrecision()
*/
QDataStream &QDataStream::operator<<(float f)
{
+ if (version() >= QDataStream::Qt_4_6
+ && floatingPointPrecision() == QDataStream::DoublePrecision) {
+ *this << double(f);
+ return *this;
+ }
+
CHECK_STREAM_PRECOND(*this)
float g = f; // fixes float-on-stack problem
if (noswap) { // no conversion needed
@@ -1146,12 +1226,20 @@ QDataStream &QDataStream::operator<<(float f)
/*!
\overload
- Writes a 64-bit floating point number, \a f, to the stream using
+ Writes a floating point number, \a f, to the stream using
the standard IEEE 754 format. Returns a reference to the stream.
+
+ \sa setFloatingPointPrecision()
*/
QDataStream &QDataStream::operator<<(double f)
{
+ if (version() >= QDataStream::Qt_4_6
+ && floatingPointPrecision() == QDataStream::SinglePrecision) {
+ *this << float(f);
+ return *this;
+ }
+
CHECK_STREAM_PRECOND(*this)
#ifndef Q_DOUBLE_FORMAT
if (noswap) {
diff --git a/src/corelib/io/qdatastream.h b/src/corelib/io/qdatastream.h
index 7a930c4..f8e0608 100644
--- a/src/corelib/io/qdatastream.h
+++ b/src/corelib/io/qdatastream.h
@@ -42,6 +42,7 @@
#ifndef QDATASTREAM_H
#define QDATASTREAM_H
+#include <QtCore/qscopedpointer.h>
#include <QtCore/qiodevice.h>
#include <QtCore/qglobal.h>
@@ -83,7 +84,7 @@ public:
Qt_4_3 = 9,
Qt_4_4 = 10,
Qt_4_5 = 11,
- Qt_4_6 = Qt_4_5,
+ Qt_4_6 = 12,
Qt_4_7 = Qt_4_6
#if QT_VERSION >= 0x040800
#error Add the datastream version for this Qt version
@@ -102,6 +103,11 @@ public:
ReadCorruptData
};
+ enum FloatingPointPrecision {
+ SinglePrecision,
+ DoublePrecision
+ };
+
QDataStream();
explicit QDataStream(QIODevice *);
#ifdef QT3_SUPPORT
@@ -124,6 +130,9 @@ public:
void setStatus(Status status);
void resetStatus();
+ FloatingPointPrecision floatingPointPrecision() const;
+ void setFloatingPointPrecision(FloatingPointPrecision precision);
+
ByteOrder byteOrder() const;
void setByteOrder(ByteOrder);
@@ -177,7 +186,7 @@ public:
private:
Q_DISABLE_COPY(QDataStream)
- QDataStreamPrivate *d;
+ QScopedPointer<QDataStreamPrivate> d;
QIODevice *dev;
bool owndev;
diff --git a/src/corelib/io/qdatastream_p.h b/src/corelib/io/qdatastream_p.h
new file mode 100644
index 0000000..157fee9
--- /dev/null
+++ b/src/corelib/io/qdatastream_p.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QDATASTREAM_P_H
+#define QDATASTREAM_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 <qdatastream.h>
+
+QT_BEGIN_NAMESPACE
+
+#ifndef QT_NO_DATASTREAM
+class QDataStreamPrivate
+{
+public:
+ QDataStreamPrivate() : floatingPointPrecision(QDataStream::DoublePrecision) { }
+
+ QDataStream::FloatingPointPrecision floatingPointPrecision;
+};
+#endif
+
+QT_END_NAMESPACE
+
+#endif // QDATASTREAM_P_H
diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp
index 4ec5772..114da3b 100644
--- a/src/corelib/io/qfsfileengine_unix.cpp
+++ b/src/corelib/io/qfsfileengine_unix.cpp
@@ -595,7 +595,7 @@ QString QFSFileEngine::rootPath()
return QDir::cleanPath(QDir::fromNativeSeparators(qt_TDesC2QString(symbianPath)));
# else
# warning No fallback implementation of QFSFileEngine::rootPath()
- return QLatin1String();
+ return QString();
# endif
#else
return QLatin1String("/");
@@ -614,7 +614,7 @@ QString QFSFileEngine::tempPath()
QT_MKDIR(QFile::encodeName(temp), 0777);
# else
# warning No fallback implementation of QFSFileEngine::tempPath()
- return QString();
+ QString temp;
# endif
#else
QString temp = QFile::decodeName(qgetenv("TMPDIR"));
diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp
index 5931267..594718e 100644
--- a/src/corelib/io/qtextstream.cpp
+++ b/src/corelib/io/qtextstream.cpp
@@ -241,6 +241,7 @@ static const int QTEXTSTREAM_BUFFERSIZE = 16384;
#include "private/qlocale_p.h"
#include <stdlib.h>
+#include <limits.h>
#include <new>
#if defined QTEXTSTREAM_DEBUG
@@ -375,10 +376,10 @@ public:
enum TokenDelimiter {
Space,
NotSpace,
- EndOfLine,
- EndOfFile
+ EndOfLine
};
+ QString read(int maxlen);
bool scan(const QChar **ptr, int *tokenLength,
int maxlen, TokenDelimiter delimiter);
inline const QChar *readPtr() const;
@@ -704,6 +705,25 @@ bool QTextStreamPrivate::flushWriteBuffer()
return flushed && bytesWritten == qint64(data.size());
}
+QString QTextStreamPrivate::read(int maxlen)
+{
+ QString ret;
+ if (string) {
+ lastTokenSize = qMin(maxlen, string->size() - stringOffset);
+ ret = string->mid(stringOffset, lastTokenSize);
+ } else {
+ while (readBuffer.size() - readBufferOffset < maxlen && fillReadBuffer()) ;
+ lastTokenSize = qMin(maxlen, readBuffer.size() - readBufferOffset);
+ ret = readBuffer.mid(readBufferOffset, lastTokenSize);
+ }
+ consumeLastToken();
+
+#if defined (QTEXTSTREAM_DEBUG)
+ qDebug("QTextStreamPrivate::read() maxlen = %d, token length = %d", maxlen, ret.length());
+#endif
+ return ret;
+}
+
/*! \internal
Scans no more than \a maxlen QChars in the current buffer for the
@@ -736,19 +756,28 @@ bool QTextStreamPrivate::scan(const QChar **ptr, int *length, int maxlen, TokenD
const QChar ch = *chPtr++;
++totalSize;
- if (delimiter == Space && ch.isSpace()) {
- foundToken = true;
- delimSize = 1;
- } else if (delimiter == NotSpace && !ch.isSpace()) {
- foundToken = true;
- delimSize = 1;
- } else if (delimiter == EndOfLine && ch == QLatin1Char('\n')) {
- foundToken = true;
- delimSize = (lastChar == QLatin1Char('\r')) ? 2 : 1;
- consumeDelimiter = true;
+ switch (delimiter) {
+ case Space:
+ if (ch.isSpace()) {
+ foundToken = true;
+ delimSize = 1;
+ }
+ break;
+ case NotSpace:
+ if (!ch.isSpace()) {
+ foundToken = true;
+ delimSize = 1;
+ }
+ break;
+ case EndOfLine:
+ if (ch == QLatin1Char('\n')) {
+ foundToken = true;
+ delimSize = (lastChar == QLatin1Char('\r')) ? 2 : 1;
+ consumeDelimiter = true;
+ }
+ lastChar = ch;
+ break;
}
-
- lastChar = ch;
}
} while (!foundToken
&& (!maxlen || totalSize < maxlen)
@@ -769,7 +798,7 @@ bool QTextStreamPrivate::scan(const QChar **ptr, int *length, int maxlen, TokenD
// if we find a '\r' at the end of the data when reading lines,
// don't make it part of the line.
- if (totalSize > 0 && !foundToken && delimiter == EndOfLine) {
+ if (delimiter == EndOfLine && totalSize > 0 && !foundToken) {
if (((string && stringOffset + totalSize == string->size()) || (device && device->atEnd()))
&& lastChar == QLatin1Char('\r')) {
consumeDelimiter = true;
@@ -1603,14 +1632,7 @@ QString QTextStream::readAll()
Q_D(QTextStream);
CHECK_VALID_STREAM(QString());
- const QChar *readPtr;
- int length;
- if (!d->scan(&readPtr, &length, /* maxlen = */ 0, QTextStreamPrivate::EndOfFile))
- return QString();
-
- QString tmp = QString(readPtr, length);
- d->consumeLastToken();
- return tmp;
+ return d->read(INT_MAX);
}
/*!
@@ -1662,14 +1684,7 @@ QString QTextStream::read(qint64 maxlen)
if (maxlen <= 0)
return QString::fromLatin1(""); // empty, not null
- const QChar *readPtr;
- int length;
- if (!d->scan(&readPtr, &length, int(maxlen), QTextStreamPrivate::EndOfFile))
- return QString();
-
- QString tmp = QString(readPtr, length);
- d->consumeLastToken();
- return tmp;
+ return d->read(int(maxlen));
}
/*! \internal
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index face923..c9a4cf1 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -172,6 +172,8 @@
#include "private/qunicodetables_p.h"
#include "qatomic.h"
#include "qbytearray.h"
+#include "qdir.h"
+#include "qfile.h"
#include "qlist.h"
#ifndef QT_NO_REGEXP
#include "qregexp.h"
@@ -5547,6 +5549,79 @@ QUrl QUrl::fromEncoded(const QByteArray &input, ParsingMode parsingMode)
}
/*!
+ Returns a valid URL from a user supplied \a userInput string if one can be
+ deducted. In the case that is not possible, an invalid QUrl() is returned.
+
+ \since 4.6
+
+ Most applications that can browse the web, allow the user to input a URL
+ in the form of a plain string. This string can be manually typed into
+ a location bar, obtained from the clipboard, or passed in via command
+ line arguments.
+
+ When the string is not already a valid URL, a best guess is performed,
+ making various web related assumptions.
+
+ In the case the string corresponds to a valid file path on the system,
+ a file:// URL is constructed, using QUrl::fromLocalFile().
+
+ If that is not the case, an attempt is made to turn the string into a
+ http:// or ftp:// URL. The latter in the case the string starts with
+ 'ftp'. The result is then passed through QUrl's tolerant parser, and
+ in the case or success, a valid QUrl is returned, or else a QUrl().
+
+ \section1 Examples:
+
+ \list
+ \o qt.nokia.com becomes http://qt.nokia.com
+ \o ftp.qt.nokia.com becomes ftp://ftp.qt.nokia.com
+ \o localhost becomes http://localhost
+ \o /home/user/test.html becomes file:///home/user/test.html (if exists)
+ \endlist
+
+ \section2 Tips to avoid erroneous character conversion when dealing with
+ URLs and strings:
+
+ \list
+ \o When creating an URL QString from a QByteArray or a char*, always use
+ QString::fromUtf8().
+ \o Favor the use of QUrl::fromEncoded() and QUrl::toEncoded() instead of
+ QUrl(string) and QUrl::toString() when converting QUrl to/from string.
+ \endlist
+*/
+QUrl QUrl::fromUserInput(const QString &userInput)
+{
+ QString trimmedString = userInput.trimmed();
+
+ // Absolute files
+ if (QDir::isAbsolutePath(trimmedString))
+ return QUrl::fromLocalFile(trimmedString);
+
+ // Check the most common case of a valid url with scheme and host first
+ QUrl url = QUrl::fromEncoded(trimmedString.toUtf8(), QUrl::TolerantMode);
+ if (url.isValid() && !url.scheme().isEmpty() && !url.host().isEmpty())
+ return url;
+
+ // If the string is missing the scheme or the scheme is not valid, prepend a scheme
+ QString scheme = url.scheme();
+ if (scheme.isEmpty() || scheme.contains(QLatin1Char('.')) || scheme == QLatin1String("localhost")) {
+ // Do not do anything for strings such as "foo", only "foo.com"
+ int dotIndex = trimmedString.indexOf(QLatin1Char('.'));
+ if (dotIndex != -1 || trimmedString.startsWith(QLatin1String("localhost"))) {
+ const QString hostscheme = trimmedString.left(dotIndex).toLower();
+ QByteArray scheme = (hostscheme == QLatin1String("ftp")) ? "ftp" : "http";
+ trimmedString = QLatin1String(scheme) + QLatin1String("://") + trimmedString;
+ }
+ url = QUrl::fromEncoded(trimmedString.toUtf8(), QUrl::TolerantMode);
+ }
+
+ if (url.isValid())
+ return url;
+
+ return QUrl();
+}
+
+/*!
Returns a decoded copy of \a input. \a input is first decoded from
percent encoding, then converted from UTF-8 to unicode.
*/
diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h
index b00074a..f76d345 100644
--- a/src/corelib/io/qurl.h
+++ b/src/corelib/io/qurl.h
@@ -189,6 +189,8 @@ public:
static QUrl fromEncoded(const QByteArray &url, ParsingMode mode);
// ### Qt 5: merge the two fromEncoded() functions, with mode = TolerantMode
+ static QUrl fromUserInput(const QString &userInput);
+
void detach();
bool isDetached() const;
diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp
index 185c305..3bef0d4 100644
--- a/src/corelib/kernel/qcoreevent.cpp
+++ b/src/corelib/kernel/qcoreevent.cpp
@@ -270,7 +270,6 @@ QT_BEGIN_NAMESPACE
\omitvalue NetworkReplyUpdated
\omitvalue FutureCallOut
\omitvalue CocoaRequestModal
- \omitvalue SymbianDeferredFocusChanged
\omitvalue UpdateSoftKeys
\omitvalue NativeGesture
*/
diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h
index bc96918..be25b41 100644
--- a/src/corelib/kernel/qcoreevent.h
+++ b/src/corelib/kernel/qcoreevent.h
@@ -281,9 +281,7 @@ public:
RequestSoftwareInputPanel = 199,
CloseSoftwareInputPanel = 200,
- SymbianDeferredFocusChanged = 201, // Internal for generating asynchronous focus events on Symbian
-
- UpdateSoftKeys = 202, // Internal for compressing soft key updates
+ UpdateSoftKeys = 201, // Internal for compressing soft key updates
// 512 reserved for Qt Jambi's MetaCall event
// 513 reserved for Qt Jambi's DeleteOnMainThread event
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp
index 8d50870c..c7144e4 100644
--- a/src/corelib/statemachine/qstatemachine.cpp
+++ b/src/corelib/statemachine/qstatemachine.cpp
@@ -1265,11 +1265,13 @@ void QStateMachinePrivate::_q_process()
break;
case Finished:
state = NotRunning;
+ cancelAllDelayedEvents();
unregisterAllTransitions();
emit q->finished();
break;
case Stopped:
state = NotRunning;
+ cancelAllDelayedEvents();
unregisterAllTransitions();
emit q->stopped();
break;
@@ -1291,6 +1293,19 @@ void QStateMachinePrivate::processEvents(EventProcessingMode processingMode)
}
}
+void QStateMachinePrivate::cancelAllDelayedEvents()
+{
+ Q_Q(QStateMachine);
+ QHash<int, QEvent*>::const_iterator it;
+ for (it = delayedEvents.constBegin(); it != delayedEvents.constEnd(); ++it) {
+ int id = it.key();
+ QEvent *e = it.value();
+ q->killTimer(id);
+ delete e;
+ }
+ delayedEvents.clear();
+}
+
namespace {
class GoToStateTransition : public QAbstractTransition
@@ -1587,6 +1602,18 @@ QStateMachine::~QStateMachine()
{
}
+/*!
+ \enum QStateMachine::EventPriority
+
+ This enum type specifies the priority of an event posted to the state
+ machine using postEvent().
+
+ Events of high priority are processed before events of normal priority.
+
+ \value NormalPriority The event has normal priority.
+ \value HighPriority The event has high priority.
+*/
+
/*! \enum QStateMachine::Error
This enum type defines errors that can occur in the state machine at run time. When the state
@@ -1798,47 +1825,99 @@ void QStateMachine::stop()
}
/*!
- Posts the given \a event for processing by this state machine, with a delay
- of \a delay milliseconds.
+ Posts the given \a event of the given \a priority for processing by this
+ state machine.
This function returns immediately. The event is added to the state machine's
event queue. Events are processed in the order posted. The state machine
takes ownership of the event and deletes it once it has been processed.
You can only post events when the state machine is running.
+
+ \sa postDelayedEvent()
*/
-void QStateMachine::postEvent(QEvent *event, int delay)
+void QStateMachine::postEvent(QEvent *event, EventPriority priority)
{
Q_D(QStateMachine);
if (d->state != QStateMachinePrivate::Running) {
qWarning("QStateMachine::postEvent: cannot post event when the state machine is not running");
return;
}
+ if (!event) {
+ qWarning("QStateMachine::postEvent: cannot post null event");
+ return;
+ }
#ifdef QSTATEMACHINE_DEBUG
- qDebug() << this << ": posting external event" << event << "with delay" << delay;
+ qDebug() << this << ": posting event" << event;
#endif
- if (delay) {
- int tid = startTimer(delay);
- d->delayedEvents[tid] = event;
- } else {
+ switch (priority) {
+ case NormalPriority:
d->externalEventQueue.append(event);
- d->processEvents(QStateMachinePrivate::QueuedProcessing);
+ break;
+ case HighPriority:
+ d->internalEventQueue.append(event);
+ break;
}
+ d->processEvents(QStateMachinePrivate::QueuedProcessing);
}
/*!
- \internal
+ Posts the given \a event for processing by this state machine, with the
+ given \a delay in milliseconds. Returns an identifier associated with the
+ delayed event, or -1 if the event could not be posted.
- Posts the given internal \a event for processing by this state machine.
+ This function returns immediately. When the delay has expired, the event
+ will be added to the state machine's event queue for processing. The state
+ machine takes ownership of the event and deletes it once it has been
+ processed.
+
+ You can only post events when the state machine is running.
+
+ \sa cancelDelayedEvent(), postEvent()
*/
-void QStateMachine::postInternalEvent(QEvent *event)
+int QStateMachine::postDelayedEvent(QEvent *event, int delay)
{
Q_D(QStateMachine);
+ if (d->state != QStateMachinePrivate::Running) {
+ qWarning("QStateMachine::postDelayedEvent: cannot post event when the state machine is not running");
+ return -1;
+ }
+ if (!event) {
+ qWarning("QStateMachine::postDelayedEvent: cannot post null event");
+ return -1;
+ }
+ if (delay < 0) {
+ qWarning("QStateMachine::postDelayedEvent: delay cannot be negative");
+ return -1;
+ }
#ifdef QSTATEMACHINE_DEBUG
- qDebug() << this << ": posting internal event" << event;
+ qDebug() << this << ": posting event" << event << "with delay" << delay;
#endif
- d->internalEventQueue.append(event);
- d->processEvents(QStateMachinePrivate::QueuedProcessing);
+ int tid = startTimer(delay);
+ d->delayedEvents[tid] = event;
+ return tid;
+}
+
+/*!
+ Cancels the delayed event identified by the given \a id. The id should be a
+ value returned by a call to postDelayedEvent(). Returns true if the event
+ was successfully cancelled, otherwise returns false.
+
+ \sa postDelayedEvent()
+*/
+bool QStateMachine::cancelDelayedEvent(int id)
+{
+ Q_D(QStateMachine);
+ if (d->state != QStateMachinePrivate::Running) {
+ qWarning("QStateMachine::cancelDelayedEvent: the machine is not running");
+ return false;
+ }
+ QEvent *e = d->delayedEvents.take(id);
+ if (!e)
+ return false;
+ killTimer(id);
+ delete e;
+ return true;
}
/*!
@@ -1882,9 +1961,14 @@ bool QStateMachine::event(QEvent *e)
if (e->type() == QEvent::Timer) {
QTimerEvent *te = static_cast<QTimerEvent*>(e);
int tid = te->timerId();
- if (d->delayedEvents.contains(tid)) {
+ if (d->state != QStateMachinePrivate::Running) {
+ // This event has been cancelled already
+ Q_ASSERT(!d->delayedEvents.contains(tid));
+ return true;
+ }
+ QEvent *ee = d->delayedEvents.take(tid);
+ if (ee != 0) {
killTimer(tid);
- QEvent *ee = d->delayedEvents.take(tid);
d->externalEventQueue.append(ee);
d->processEvents(QStateMachinePrivate::DirectProcessing);
return true;
diff --git a/src/corelib/statemachine/qstatemachine.h b/src/corelib/statemachine/qstatemachine.h
index a0b2b14..321a05c 100644
--- a/src/corelib/statemachine/qstatemachine.h
+++ b/src/corelib/statemachine/qstatemachine.h
@@ -102,6 +102,11 @@ public:
QEvent *m_event;
};
+ enum EventPriority {
+ NormalPriority,
+ HighPriority
+ };
+
enum RestorePolicy {
DoNotRestoreProperties,
RestoreProperties
@@ -138,7 +143,9 @@ public:
QStateMachine::RestorePolicy globalRestorePolicy() const;
void setGlobalRestorePolicy(QStateMachine::RestorePolicy restorePolicy);
- void postEvent(QEvent *event, int delay = 0);
+ void postEvent(QEvent *event, EventPriority priority = NormalPriority);
+ int postDelayedEvent(QEvent *event, int delay);
+ bool cancelDelayedEvent(int id);
QSet<QAbstractState*> configuration() const;
@@ -158,8 +165,6 @@ protected:
void onEntry(QEvent *event);
void onExit(QEvent *event);
- void postInternalEvent(QEvent *event);
-
virtual void beginSelectTransitions(QEvent *event);
virtual void endSelectTransitions(QEvent *event);
diff --git a/src/corelib/statemachine/qstatemachine_p.h b/src/corelib/statemachine/qstatemachine_p.h
index 141bc5c..cf7a073 100644
--- a/src/corelib/statemachine/qstatemachine_p.h
+++ b/src/corelib/statemachine/qstatemachine_p.h
@@ -160,6 +160,7 @@ public:
void handleTransitionSignal(QObject *sender, int signalIndex,
void **args);
void processEvents(EventProcessingMode processingMode);
+ void cancelAllDelayedEvents();
#ifndef QT_NO_PROPERTIES
typedef QPair<QObject *, QByteArray> RestorableId;
diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h
index e1a0e06..efa39b5 100644
--- a/src/corelib/tools/qstringbuilder.h
+++ b/src/corelib/tools/qstringbuilder.h
@@ -198,6 +198,17 @@ template <int N> struct QConcatenable<char[N]>
}
};
+template <int N> struct QConcatenable<const char[N]>
+{
+ typedef const char type[N];
+ static int size(const char[N]) { return N - 1; }
+ static inline void appendTo(const char a[N], QChar *&out)
+ {
+ for (int i = 0; i < N - 1; ++i)
+ *out++ = QLatin1Char(a[i]);
+ }
+};
+
template <> struct QConcatenable<const char *>
{
typedef char const *type;
@@ -241,7 +252,7 @@ template <typename A, typename B>
QStringBuilder<typename QConcatenable<A>::type, typename QConcatenable<B>::type>
operator%(const A &a, const B &b)
{
- return QStringBuilder<A, B>(a, b);
+ return QStringBuilder<typename QConcatenable<A>::type, typename QConcatenable<B>::type>(a, b);
}
#ifdef QT_USE_FAST_OPERATOR_PLUS
@@ -249,7 +260,7 @@ template <typename A, typename B>
QStringBuilder<typename QConcatenable<A>::type, typename QConcatenable<B>::type>
operator+(const A &a, const B &b)
{
- return QStringBuilder<A, B>(a, b);
+ return QStringBuilder<typename QConcatenable<A>::type, typename QConcatenable<B>::type>(a, b);
}
#endif
diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp
index 14f19f2..297c900 100644
--- a/src/gui/dialogs/qfiledialog.cpp
+++ b/src/gui/dialogs/qfiledialog.cpp
@@ -317,6 +317,7 @@ QFileDialog::QFileDialog(QWidget *parent, Qt::WindowFlags f)
{
Q_D(QFileDialog);
d->init();
+ d->lineEdit()->selectAll();
}
/*!
@@ -334,6 +335,7 @@ QFileDialog::QFileDialog(QWidget *parent,
{
Q_D(QFileDialog);
d->init(directory, filter, caption);
+ d->lineEdit()->selectAll();
}
/*!
diff --git a/src/gui/dialogs/qfontdialog.cpp b/src/gui/dialogs/qfontdialog.cpp
index ca882c5..60fae27 100644
--- a/src/gui/dialogs/qfontdialog.cpp
+++ b/src/gui/dialogs/qfontdialog.cpp
@@ -602,6 +602,8 @@ void QFontDialogPrivate::updateStyles()
}
if (!found)
styleList->setCurrentItem(0);
+ } else {
+ styleList->setCurrentItem(0);
}
styleEdit->setText(styleList->currentText());
diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp
index eee9bbf..e971fd8 100644
--- a/src/gui/effects/qgraphicseffect.cpp
+++ b/src/gui/effects/qgraphicseffect.cpp
@@ -67,6 +67,7 @@
\o QGraphicsOpacityEffect - renders the item with an opacity
\o QGraphicsPixelizeEffect - pixelizes the item with any pixel size
\o QGraphicsGrayscaleEffect - renders the item in shades of gray
+ \o QGraphicsBloomEffect - applies a blooming / glowing effect
\endlist
\img graphicseffect-effects.png
@@ -795,7 +796,7 @@ QGraphicsBlurEffect::QGraphicsBlurEffect(QObject *parent)
: QGraphicsEffect(*new QGraphicsBlurEffectPrivate, parent)
{
Q_D(QGraphicsBlurEffect);
- d->filter->setBlurHint(QPixmapBlurFilter::PerformanceHint);
+ d->filter->setBlurHint(Qt::PerformanceHint);
}
/*!
@@ -839,48 +840,34 @@ void QGraphicsBlurEffect::setBlurRadius(int radius)
*/
/*!
- \enum QGraphicsBlurEffect::BlurHint
-
- \since 4.6
-
- This enum describes the hint of a blur graphics effect.
-
- \value PerformanceHint Using this value hints that performance is the
- most important factor, at the potential cost of lower quality.
-
- \value QualityHint Using this value hints that a higher quality blur is
- preferred over a fast blur.
-*/
-
-/*!
\property QGraphicsBlurEffect::blurHint
\brief the blur hint of the effect.
- Use the PerformanceHint blur hint to say that you want a faster blur,
- and the QualityHint blur hint to say that you prefer a higher quality blur.
+ Use the Qt::PerformanceHint hint to say that you want a faster blur,
+ and the Qt::QualityHint hint to say that you prefer a higher quality blur.
- When animating the blur radius it's recommended to use the PerformanceHint.
+ When animating the blur radius it's recommended to use Qt::PerformanceHint.
- By default, the blur hint is PerformanceHint.
+ By default, the blur hint is Qt::PerformanceHint.
*/
-QGraphicsBlurEffect::BlurHint QGraphicsBlurEffect::blurHint() const
+Qt::RenderHint QGraphicsBlurEffect::blurHint() const
{
Q_D(const QGraphicsBlurEffect);
- return BlurHint(d->filter->blurHint());
+ return d->filter->blurHint();
}
-void QGraphicsBlurEffect::setBlurHint(QGraphicsBlurEffect::BlurHint hint)
+void QGraphicsBlurEffect::setBlurHint(Qt::RenderHint hint)
{
Q_D(QGraphicsBlurEffect);
- if (BlurHint(d->filter->blurHint()) == hint)
+ if (d->filter->blurHint() == hint)
return;
- d->filter->setBlurHint(QPixmapBlurFilter::BlurHint(hint));
+ d->filter->setBlurHint(hint);
emit blurHintChanged(hint);
}
/*!
- \fn void QGraphicsBlurEffect::blurHintChanged(QGraphicsBlurEffect::BlurHint hint)
+ \fn void QGraphicsBlurEffect::blurHintChanged(Qt::RenderHint hint)
This signal is emitted whenever the effect's blur hint changes.
The \a hint parameter holds the effect's new blur hint.
@@ -1305,5 +1292,237 @@ void QGraphicsOpacityEffect::draw(QPainter *painter, QGraphicsEffectSource *sour
painter->restore();
}
+/*!
+ \class QGraphicsBloomEffect
+ \brief The QGraphicsBloomEffect class provides a bloom/glow effect.
+ \since 4.6
+
+ A bloom/glow effect adds fringes of light around bright areas in the source.
+
+ \img graphicseffect-bloom.png
+
+ \sa QGraphicsDropShadowEffect, QGraphicsBlurEffect, QGraphicsPixelizeEffect,
+ QGraphicsGrayscaleEffect, QGraphicsColorizeEffect
+*/
+
+/*!
+ Constructs a new QGraphicsBloomEffect instance.
+ The \a parent parameter is passed to QGraphicsEffect's constructor.
+*/
+QGraphicsBloomEffect::QGraphicsBloomEffect(QObject *parent)
+ : QGraphicsEffect(*new QGraphicsBloomEffectPrivate, parent)
+{
+ Q_D(QGraphicsBloomEffect);
+ for (int i = 0; i < 256; ++i)
+ d->colorTable[i] = qMin(i + d->brightness, 255);
+}
+
+/*!
+ Destroys the effect.
+*/
+QGraphicsBloomEffect::~QGraphicsBloomEffect()
+{
+}
+
+/*!
+ \reimp
+*/
+QRectF QGraphicsBloomEffect::boundingRectFor(const QRectF &rect) const
+{
+ Q_D(const QGraphicsBloomEffect);
+ const qreal delta = d->blurFilter.radius() * 2;
+ return rect.adjusted(-delta, -delta, delta, delta);
+}
+
+/*!
+ \property QGraphicsBloomEffect::blurRadius
+ \brief the blur radius in pixels of the effect.
+
+ Using a smaller radius results in a sharper appearance, whereas a bigger
+ radius results in a more blurred appearance.
+
+ By default, the blur radius is 5 pixels.
+
+ \sa strength(), brightness()
+*/
+int QGraphicsBloomEffect::blurRadius() const
+{
+ Q_D(const QGraphicsBloomEffect);
+ return d->blurFilter.radius();
+}
+
+void QGraphicsBloomEffect::setBlurRadius(int radius)
+{
+ Q_D(QGraphicsBloomEffect);
+ if (d->blurFilter.radius() == radius)
+ return;
+
+ d->blurFilter.setRadius(radius);
+ updateBoundingRect();
+ emit blurRadiusChanged(radius);
+}
+
+/*!
+ \fn void QGraphicsBloomEffect::blurRadiusChanged(int blurRadius)
+
+ This signal is emitted whenever the effect's blur radius changes.
+ The \a blurRadius parameter holds the effect's new blur radius.
+*/
+
+/*!
+ \property QGraphicsBloomEffect::blurHint
+ \brief the blur hint of the effect.
+
+ Use the Qt::PerformanceHint hint to say that you want a faster blur,
+ and the Qt::QualityHint hint to say that you prefer a higher quality blur.
+
+ When animating the blur radius it's recommended to use Qt::PerformanceHint.
+
+ By default, the blur hint is Qt::PerformanceHint.
+*/
+Qt::RenderHint QGraphicsBloomEffect::blurHint() const
+{
+ Q_D(const QGraphicsBloomEffect);
+ return d->blurFilter.blurHint();
+}
+
+void QGraphicsBloomEffect::setBlurHint(Qt::RenderHint hint)
+{
+ Q_D(QGraphicsBloomEffect);
+ if (d->blurFilter.blurHint() == hint)
+ return;
+
+ d->blurFilter.setBlurHint(hint);
+ emit blurHintChanged(hint);
+}
+
+/*!
+ \fn void QGraphicsBloomEffect::blurHintChanged(Qt::RenderHint hint)
+
+ This signal is emitted whenever the effect's blur hint changes.
+ The \a hint parameter holds the effect's new blur hint.
+*/
+
+/*!
+ \property QGraphicsBloomEffect::brightness
+ \brief the brightness of the glow.
+
+ The value should be in the range of 0 to 255, where 0 is dark
+ and 255 is bright.
+
+ By default, the brightness is 70.
+
+ \sa strength(), blurRadius()
+*/
+int QGraphicsBloomEffect::brightness() const
+{
+ Q_D(const QGraphicsBloomEffect);
+ return d->brightness;
+}
+
+void QGraphicsBloomEffect::setBrightness(int brightness)
+{
+ Q_D(QGraphicsBloomEffect);
+ brightness = qBound(0, brightness, 255);
+ if (d->brightness == brightness)
+ return;
+
+ d->brightness = brightness;
+ for (int i = 0; i < 256; ++i)
+ d->colorTable[i] = qMin(i + brightness, 255);
+
+ update();
+ emit brightnessChanged(brightness);
+}
+
+/*!
+ \fn void QGraphicsBloomEffect::brightnessChanged(int brightness)
+
+ This signal is emitted whenever the effect's brightness changes.
+ The \a brightness parameter holds the effect's new brightness.
+*/
+
+/*!
+ \property QGraphicsBloomEffect::strength
+ \brief the strength of the effect.
+
+ A strength 0.0 equals to no effect, while 1.0 means maximum glow.
+
+ By default, the strength is 0.7.
+*/
+qreal QGraphicsBloomEffect::strength() const
+{
+ Q_D(const QGraphicsBloomEffect);
+ return d->strength;
+}
+
+void QGraphicsBloomEffect::setStrength(qreal strength)
+{
+ Q_D(QGraphicsBloomEffect);
+ strength = qBound(qreal(0.0), strength, qreal(1.0));
+ if (qFuzzyCompare(d->strength, strength))
+ return;
+
+ d->strength = strength;
+ update();
+ emit strengthChanged(strength);
+}
+
+/*!
+ \fn void QGraphicsBloomEffect::strengthChanged(qreal strength)
+
+ This signal is emitted whenever the effect's strength changes.
+ The \a strength parameter holds the effect's new strength.
+*/
+
+/*!
+ \reimp
+*/
+void QGraphicsBloomEffect::draw(QPainter *painter, QGraphicsEffectSource *source)
+{
+ Q_D(QGraphicsBloomEffect);
+ if (d->strength < 0.001) {
+ source->draw(painter);
+ return;
+ }
+
+ const Qt::CoordinateSystem system = source->isPixmap()
+ ? Qt::LogicalCoordinates : Qt::DeviceCoordinates;
+ QPoint offset;
+ QPixmap pixmap = source->pixmap(system, &offset);
+ QImage result = pixmap.toImage().convertToFormat(QImage::Format_ARGB32_Premultiplied);
+
+ // Blur.
+ QPainter blurPainter(&pixmap);
+ d->blurFilter.draw(&blurPainter, QPointF(), pixmap);
+ blurPainter.end();
+
+ // Brighten.
+ QImage overlay = pixmap.toImage().convertToFormat(QImage::Format_ARGB32);
+ const int numBits = overlay.width() * overlay.height();
+ QRgb *bits = reinterpret_cast<QRgb *>(overlay.bits());
+ for (int i = 0; i < numBits; ++i) {
+ const QRgb bit = bits[i];
+ bits[i] = qRgba(d->colorTable[qRed(bit)], d->colorTable[qGreen(bit)],
+ d->colorTable[qBlue(bit)], qAlpha(bit));
+ }
+
+ // Composite.
+ QPainter compPainter(&result);
+ compPainter.setCompositionMode(QPainter::CompositionMode_Overlay);
+ compPainter.setOpacity(d->strength);
+ compPainter.drawImage(0, 0, overlay);
+ compPainter.end();
+
+ if (system == Qt::DeviceCoordinates) {
+ QTransform restoreTransform = painter->worldTransform();
+ painter->setWorldTransform(QTransform());
+ painter->drawImage(offset, result);
+ painter->setWorldTransform(restoreTransform);
+ } else {
+ painter->drawImage(offset, result);
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/effects/qgraphicseffect.h b/src/gui/effects/qgraphicseffect.h
index c256381..c5d3ede 100644
--- a/src/gui/effects/qgraphicseffect.h
+++ b/src/gui/effects/qgraphicseffect.h
@@ -224,27 +224,22 @@ class Q_GUI_EXPORT QGraphicsBlurEffect: public QGraphicsEffect
{
Q_OBJECT
Q_PROPERTY(int blurRadius READ blurRadius WRITE setBlurRadius NOTIFY blurRadiusChanged)
- Q_PROPERTY(BlurHint blurHint READ blurHint WRITE setBlurHint NOTIFY blurHintChanged)
+ Q_PROPERTY(Qt::RenderHint blurHint READ blurHint WRITE setBlurHint NOTIFY blurHintChanged)
public:
- enum BlurHint {
- PerformanceHint,
- QualityHint
- };
-
QGraphicsBlurEffect(QObject *parent = 0);
~QGraphicsBlurEffect();
QRectF boundingRectFor(const QRectF &rect) const;
int blurRadius() const;
- BlurHint blurHint() const;
+ Qt::RenderHint blurHint() const;
public Q_SLOTS:
void setBlurRadius(int blurRadius);
- void setBlurHint(BlurHint blurHint);
+ void setBlurHint(Qt::RenderHint hint);
Q_SIGNALS:
void blurRadiusChanged(int blurRadius);
- void blurHintChanged(BlurHint blurHint);
+ void blurHintChanged(Qt::RenderHint hint);
protected:
void draw(QPainter *painter, QGraphicsEffectSource *source);
@@ -339,6 +334,44 @@ private:
Q_DISABLE_COPY(QGraphicsOpacityEffect)
};
+class QGraphicsBloomEffectPrivate;
+class Q_GUI_EXPORT QGraphicsBloomEffect: public QGraphicsEffect
+{
+ Q_OBJECT
+ Q_PROPERTY(int blurRadius READ blurRadius WRITE setBlurRadius NOTIFY blurRadiusChanged)
+ Q_PROPERTY(Qt::RenderHint blurHint READ blurHint WRITE setBlurHint NOTIFY blurHintChanged)
+ Q_PROPERTY(int brightness READ brightness WRITE setBrightness NOTIFY brightnessChanged)
+ Q_PROPERTY(qreal strength READ strength WRITE setStrength NOTIFY strengthChanged)
+public:
+ QGraphicsBloomEffect(QObject *parent = 0);
+ ~QGraphicsBloomEffect();
+
+ QRectF boundingRectFor(const QRectF &rect) const;
+ int blurRadius() const;
+ Qt::RenderHint blurHint() const;
+ int brightness() const;
+ qreal strength() const;
+
+public Q_SLOTS:
+ void setBlurRadius(int blurRadius);
+ void setBlurHint(Qt::RenderHint hint);
+ void setBrightness(int brightness);
+ void setStrength(qreal strength);
+
+Q_SIGNALS:
+ void blurRadiusChanged(int blurRadius);
+ void blurHintChanged(Qt::RenderHint hint);
+ void brightnessChanged(int brightness);
+ void strengthChanged(qreal strength);
+
+protected:
+ void draw(QPainter *painter, QGraphicsEffectSource *source);
+
+private:
+ Q_DECLARE_PRIVATE(QGraphicsBloomEffect)
+ Q_DISABLE_COPY(QGraphicsBloomEffect)
+};
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/gui/effects/qgraphicseffect_p.h b/src/gui/effects/qgraphicseffect_p.h
index e109790..96eda0e 100644
--- a/src/gui/effects/qgraphicseffect_p.h
+++ b/src/gui/effects/qgraphicseffect_p.h
@@ -185,6 +185,18 @@ public:
uint hasOpacityMask : 1;
};
+class QGraphicsBloomEffectPrivate : public QGraphicsEffectPrivate
+{
+ Q_DECLARE_PUBLIC(QGraphicsBlurEffect)
+public:
+ QGraphicsBloomEffectPrivate() : brightness(70), strength(0.7) {}
+
+ QPixmapBlurFilter blurFilter;
+ int colorTable[256];
+ int brightness;
+ qreal strength;
+};
+
QT_END_NAMESPACE
#endif // QGRAPHICSEFFECT_P_H
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index 83ac5fe..7c24002 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -54,4 +54,4 @@ DEFINES += Q_INTERNAL_QAPP_SRC
symbian:TARGET.UID3=0x2001B2DD
# ro-section in gui can exceed default allocated space, so more rw-section little further
-symbian-sbsv2: MMP_RULES += "LINKEROPTION armcc --rw-base 0x800000" \ No newline at end of file
+symbian-sbsv2: MMP_RULES += "LINKEROPTION armcc --rw-base 0x800000"
diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp
index ba9a1e2..749b8f3 100644
--- a/src/gui/image/qpixmapfilter.cpp
+++ b/src/gui/image/qpixmapfilter.cpp
@@ -504,10 +504,10 @@ void QPixmapConvolutionFilter::draw(QPainter *painter, const QPointF &p, const Q
class QPixmapBlurFilterPrivate : public QPixmapFilterPrivate
{
public:
- QPixmapBlurFilterPrivate() : radius(5), hint(QPixmapBlurFilter::PerformanceHint) {}
+ QPixmapBlurFilterPrivate() : radius(5), hint(Qt::PerformanceHint) {}
int radius;
- QPixmapBlurFilter::BlurHint hint;
+ Qt::RenderHint hint;
};
@@ -561,7 +561,7 @@ int QPixmapBlurFilter::radius() const
\internal
*/
-void QPixmapBlurFilter::setBlurHint(QPixmapBlurFilter::BlurHint hint)
+void QPixmapBlurFilter::setBlurHint(Qt::RenderHint hint)
{
Q_D(QPixmapBlurFilter);
d->hint = hint;
@@ -572,7 +572,7 @@ void QPixmapBlurFilter::setBlurHint(QPixmapBlurFilter::BlurHint hint)
\internal
*/
-QPixmapBlurFilter::BlurHint QPixmapBlurFilter::blurHint() const
+Qt::RenderHint QPixmapBlurFilter::blurHint() const
{
Q_D(const QPixmapBlurFilter);
return d->hint;
diff --git a/src/gui/image/qpixmapfilter_p.h b/src/gui/image/qpixmapfilter_p.h
index 92c8e56..8a2207a 100644
--- a/src/gui/image/qpixmapfilter_p.h
+++ b/src/gui/image/qpixmapfilter_p.h
@@ -126,19 +126,14 @@ class Q_GUI_EXPORT QPixmapBlurFilter : public QPixmapFilter
Q_DECLARE_PRIVATE(QPixmapBlurFilter)
public:
- enum BlurHint {
- PerformanceHint,
- QualityHint
- };
-
QPixmapBlurFilter(QObject *parent = 0);
~QPixmapBlurFilter();
void setRadius(int radius);
- void setBlurHint(BlurHint hint);
+ void setBlurHint(Qt::RenderHint hint);
int radius() const;
- BlurHint blurHint() const;
+ Qt::RenderHint blurHint() const;
QRectF boundingRectFor(const QRectF &rect) const;
void draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect = QRectF()) const;
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 99d188e..27c7c94 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -91,6 +91,8 @@ extern QDesktopWidget *qt_desktopWidget; // qapplication.cpp
QWidget *qt_button_down = 0; // widget got last button-down
+QSymbianControl *QSymbianControl::lastFocusedControl = 0;
+
QS60Data* qGlobalS60Data()
{
return qt_s60Data();
@@ -320,13 +322,26 @@ QSymbianControl::QSymbianControl(QWidget *w)
{
}
-void QSymbianControl::ConstructL(bool topLevel, bool desktop)
+void QSymbianControl::ConstructL(bool isWindowOwning, bool desktop)
{
if (!desktop)
{
- if (topLevel) {
+ if (isWindowOwning or !qwidget->parentWidget())
CreateWindowL(S60->windowGroup());
- }
+ else
+ /**
+ * TODO: in order to avoid creating windows for all ancestors of
+ * this widget up to the root window, the parameter passed to
+ * CreateWindowL should be
+ * qwidget->parentWidget()->effectiveWinId(). However, if we do
+ * this, then we need to take care of re-parenting when a window
+ * is created for a widget between this one and the root window.
+ */
+ CreateWindowL(qwidget->parentWidget()->winId());
+
+ // Necessary in order to be able to track the activation status of
+ // the control's window
+ qwidget->d_func()->createExtra();
SetFocusing(true);
m_longTapDetector = QLongTapTimer::NewL(this);
@@ -337,6 +352,7 @@ QSymbianControl::~QSymbianControl()
{
if (S60->curWin == this)
S60->curWin = 0;
+ setFocusSafely(false);
S60->appUi()->RemoveFromStack(this);
delete m_longTapDetector;
}
@@ -767,19 +783,21 @@ TCoeInputCapabilities QSymbianControl::InputCapabilities() const
void QSymbianControl::Draw(const TRect& r) const
{
QWindowSurface *surface = qwidget->windowSurface();
- if (!surface)
- return;
+ QPaintEngine *engine = surface ? surface->paintDevice()->paintEngine() : NULL;
- QPaintEngine *engine = surface->paintDevice()->paintEngine();
if (!engine)
return;
+
if (engine->type() == QPaintEngine::Raster) {
QS60WindowSurface *s60Surface = static_cast<QS60WindowSurface *>(qwidget->windowSurface());
CFbsBitmap *bitmap = s60Surface->symbianBitmap();
CWindowGc &gc = SystemGc();
- if (qwidget->d_func()->isOpaque)
- gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
- gc.BitBlt(r.iTl, bitmap, r);
+
+ if(!qwidget->d_func()->extraData()->disableBlit) {
+ if (qwidget->d_func()->isOpaque)
+ gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
+ gc.BitBlt(r.iTl, bitmap, r);
+ }
} else {
surface->flush(qwidget, QRegion(qt_TRect2QRect(r)), QPoint());
}
@@ -845,8 +863,23 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */)
|| (qwidget->windowType() & Qt::Popup) == Qt::Popup)
return;
- QEvent *deferredFocusEvent = new QEvent(QEvent::SymbianDeferredFocusChanged);
- QApplication::postEvent(qwidget, deferredFocusEvent);
+ if (IsFocused() && IsVisible()) {
+ QApplication::setActiveWindow(qwidget->window());
+#ifdef Q_WS_S60
+ // If widget is fullscreen, hide status pane and button container
+ // otherwise show them.
+ CEikStatusPane* statusPane = S60->statusPane();
+ CEikButtonGroupContainer* buttonGroup = S60->buttonGroupContainer();
+ bool isFullscreen = qwidget->windowState() & Qt::WindowFullScreen;
+ if (statusPane && (statusPane->IsVisible() == isFullscreen))
+ statusPane->MakeVisible(!isFullscreen);
+ if (buttonGroup && (buttonGroup->IsVisible() == isFullscreen))
+ buttonGroup->MakeVisible(!isFullscreen);
+#endif
+ } else if (QApplication::activeWindow() == qwidget->window()) {
+ QApplication::setActiveWindow(0);
+ }
+ // else { We don't touch the active window unless we were explicitly activated or deactivated }
}
void QSymbianControl::HandleResourceChange(int resourceType)
@@ -890,6 +923,31 @@ TTypeUid::Ptr QSymbianControl::MopSupplyObject(TTypeUid id)
return CCoeControl::MopSupplyObject(id);
}
+void QSymbianControl::setFocusSafely(bool focus)
+{
+ // The stack hack in here is very unfortunate, but it is the only way to ensure proper
+ // focus in Symbian. If this is not executed, the control which happens to be on
+ // the top of the stack may randomly be assigned focus by Symbian, for example
+ // when creating new windows (specifically in CCoeAppUi::HandleStackChanged()).
+ if (focus) {
+ S60->appUi()->RemoveFromStack(this);
+ // Symbian doesn't automatically remove focus from the last focused control, so we need to
+ // remember it and clear focus ourselves.
+ if (lastFocusedControl && lastFocusedControl != this)
+ lastFocusedControl->SetFocus(false);
+ QT_TRAP_THROWING(S60->appUi()->AddToStackL(this,
+ ECoeStackPriorityDefault + 1, ECoeStackFlagStandard)); // Note the + 1
+ lastFocusedControl = this;
+ this->SetFocus(true);
+ } else {
+ S60->appUi()->RemoveFromStack(this);
+ QT_TRAP_THROWING(S60->appUi()->AddToStackL(this,
+ ECoeStackPriorityDefault, ECoeStackFlagStandard));
+ lastFocusedControl = 0;
+ this->SetFocus(false);
+ }
+}
+
/*!
\typedef QApplication::QS60MainApplicationFactory
@@ -1236,14 +1294,14 @@ QWidget * QApplication::topLevelAt(QPoint const& point)
if (widget->geometry().adjusted(0,0,1,1).contains(point)) {
// At this point we know there is a Qt widget under the point.
// Now we need to make sure it is the top most in the z-order.
- RDrawableWindow* rw = widget->d_func()->topData()->rwindow;
- int z = rw->OrdinalPosition();
+ RDrawableWindow *const window = widget->effectiveWinId()->DrawableWindow();
+ int z = window->OrdinalPosition();
if (z < lowestZ) {
lowestZ = z;
found = widget;
}
}
- }
+ }
}
return found;
}
@@ -1457,6 +1515,7 @@ bool QApplication::s60EventFilter(TWsEvent * /* aEvent */)
*/
void QApplication::symbianHandleCommand(int command)
{
+ QScopedLoopLevelCounter counter(d_func()->threadData);
switch (command) {
#ifdef Q_WS_S60
case EAknSoftkeyExit: {
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index 6ecd535..eb9e276 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -1752,79 +1752,18 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
case APPCOMMAND_BASS_UP:
key = Qt::Key_BassUp;
break;
- case APPCOMMAND_BROWSER_BACKWARD:
- key = Qt::Key_Back;
- break;
- case APPCOMMAND_BROWSER_FAVORITES:
- key = Qt::Key_Favorites;
- break;
- case APPCOMMAND_BROWSER_FORWARD:
- key = Qt::Key_Forward;
- break;
- case APPCOMMAND_BROWSER_HOME:
- key = Qt::Key_HomePage;
- break;
- case APPCOMMAND_BROWSER_REFRESH:
- key = Qt::Key_Refresh;
- break;
- case APPCOMMAND_BROWSER_SEARCH:
- key = Qt::Key_Search;
- break;
- case APPCOMMAND_BROWSER_STOP:
- key = Qt::Key_Stop;
- break;
- case APPCOMMAND_LAUNCH_APP1:
- key = Qt::Key_Launch0;
- break;
- case APPCOMMAND_LAUNCH_APP2:
- key = Qt::Key_Launch1;
- break;
- case APPCOMMAND_LAUNCH_MAIL:
- key = Qt::Key_LaunchMail;
- break;
- case APPCOMMAND_LAUNCH_MEDIA_SELECT:
- key = Qt::Key_LaunchMedia;
- break;
- case APPCOMMAND_MEDIA_NEXTTRACK:
- key = Qt::Key_MediaNext;
- break;
- case APPCOMMAND_MEDIA_PLAY_PAUSE:
- key = Qt::Key_MediaPlay;
- break;
- case APPCOMMAND_MEDIA_PREVIOUSTRACK:
- key = Qt::Key_MediaPrevious;
- break;
- case APPCOMMAND_MEDIA_STOP:
- key = Qt::Key_MediaStop;
- break;
case APPCOMMAND_TREBLE_DOWN:
key = Qt::Key_TrebleDown;
break;
case APPCOMMAND_TREBLE_UP:
key = Qt::Key_TrebleUp;
break;
- case APPCOMMAND_VOLUME_DOWN:
- key = Qt::Key_VolumeDown;
- break;
- case APPCOMMAND_VOLUME_MUTE:
- key = Qt::Key_VolumeMute;
- break;
- case APPCOMMAND_VOLUME_UP:
- key = Qt::Key_VolumeUp;
- break;
- // Commands new in Windows XP
case APPCOMMAND_HELP:
key = Qt::Key_Help;
break;
case APPCOMMAND_FIND:
key = Qt::Key_Search;
break;
- case APPCOMMAND_PRINT:
- key = Qt::Key_Print;
- break;
- case APPCOMMAND_MEDIA_PLAY:
- key = Qt::Key_MediaPlay;
- break;
default:
break;
}
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index aec757f..b44ef7f 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -571,7 +571,7 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = {
{QKeySequence::Close, 0, Qt::CTRL | Qt::Key_W, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11},
{QKeySequence::Close, 1, Qt::CTRL | Qt::Key_W, QApplicationPrivate::KB_Mac},
{QKeySequence::Cut, 1, Qt::CTRL | Qt::Key_X, QApplicationPrivate::KB_All},
- {QKeySequence::Redo, 1, Qt::CTRL | Qt::Key_Y, QApplicationPrivate::KB_Win},
+ {QKeySequence::Redo, 1, Qt::CTRL | Qt::Key_Y, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_S60},
{QKeySequence::Redo, 0, Qt::CTRL | Qt::Key_Y, QApplicationPrivate::KB_Mac},//different priority from above
{QKeySequence::Undo, 1, Qt::CTRL | Qt::Key_Z, QApplicationPrivate::KB_All},
{QKeySequence::Back, 1, Qt::CTRL | Qt::Key_BracketLeft, QApplicationPrivate::KB_Mac},
@@ -600,7 +600,7 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = {
{QKeySequence::FindPrevious, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_G, QApplicationPrivate::KB_Win},
{QKeySequence::AddTab, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_N, QApplicationPrivate::KB_KDE},
{QKeySequence::SaveAs, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_S, QApplicationPrivate::KB_Gnome | QApplicationPrivate::KB_Mac},
- {QKeySequence::Redo, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11},
+ {QKeySequence::Redo, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60},
{QKeySequence::Redo, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, QApplicationPrivate::KB_Mac}, //different priority from above
{QKeySequence::PreviousChild, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11},
{QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, QApplicationPrivate::KB_Mac },//different priority from above
diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp
index 91f4163..45695d9 100644
--- a/src/gui/kernel/qsoftkeymanager.cpp
+++ b/src/gui/kernel/qsoftkeymanager.cpp
@@ -238,7 +238,7 @@ void QSoftKeyManagerPrivate::updateSoftKeys_sys(const QList<QAction*> &softkeys)
}
if (needsExitButton)
- QT_TRAP_THROWING(nativeContainer->SetCommandL(2, EAknSoftkeyExit, qt_QString2TPtrC(QObject::tr("Exit"))));
+ QT_TRAP_THROWING(nativeContainer->SetCommandL(2, EAknSoftkeyExit, qt_QString2TPtrC(QSoftKeyManager::tr("Exit"))));
nativeContainer->DrawDeferred(); // 3.1 needs an extra invitation
}
diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h
index 0d48634..d33791b 100644
--- a/src/gui/kernel/qt_s60_p.h
+++ b/src/gui/kernel/qt_s60_p.h
@@ -141,7 +141,7 @@ public:
public:
QSymbianControl(QWidget *w);
- void ConstructL(bool topLevel = false, bool desktop = false);
+ void ConstructL(bool isWindowOwning = false, bool desktop = false);
~QSymbianControl();
void HandleResourceChange(int resourceType);
void HandlePointerEventL(const TPointerEvent& aPointerEvent);
@@ -157,6 +157,8 @@ public:
void setIgnoreFocusChanged(bool enabled) { m_ignoreFocusChanged = enabled; }
void CancelLongTapTimer();
+ void setFocusSafely(bool focus);
+
protected:
void Draw(const TRect& aRect) const;
void SizeChanged();
@@ -174,6 +176,9 @@ private:
#endif
private:
+ static QSymbianControl *lastFocusedControl;
+
+private:
QWidget *qwidget;
bool m_ignoreFocusChanged;
QLongTapTimer* m_longTapDetector;
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 08fe5b9..83593ab 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -8336,12 +8336,6 @@ bool QWidget::event(QEvent *event)
(void) QApplication::sendEvent(this, &mouseEvent);
break;
}
- case QEvent::SymbianDeferredFocusChanged: {
-#ifdef Q_OS_SYMBIAN
- d->handleSymbianDeferredFocusChanged();
-#endif
- break;
- }
#ifndef QT_NO_PROPERTIES
case QEvent::DynamicPropertyChange: {
const QByteArray &propName = static_cast<QDynamicPropertyChangeEvent *>(event)->propertyName();
@@ -11454,6 +11448,10 @@ QWidget *QWidgetPrivate::widgetInNavigationDirection(Direction direction)
QWidget *targetWidget = 0;
int shortestDistance = INT_MAX;
foreach(QWidget *targetCandidate, QApplication::allWidgets()) {
+
+ if (targetCandidate->focusProxy()) //skip if focus proxy set
+ continue;
+
const QRect targetCandidateRect = targetCandidate->rect().translated(targetCandidate->mapToGlobal(QPoint()));
if ( targetCandidate != sourceWidget
&& targetCandidate->focusPolicy() & Qt::TabFocus
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index 296c5b1..6c879be 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -169,9 +169,6 @@ struct QTLWExtra {
#ifndef QT_NO_QWS_MANAGER
QWSManager *qwsManager;
#endif
-#elif defined(Q_OS_SYMBIAN) // <--------------------------------------------------------- SYMBIAN
- uint activated : 1; // RWindowBase::Activated has been called
- RDrawableWindow *rwindow;
#endif
};
@@ -224,6 +221,15 @@ struct QWExtra {
QImage maskBits;
CGImageRef imageMask;
#endif
+#elif defined(Q_OS_SYMBIAN) // <----------------------------------------------------- Symbian
+ uint activated : 1; // RWindowBase::Activated has been called
+
+ // If set, QSymbianControl::Draw does not blit this widget
+ // This is to allow, for use cases such as video, widgets which, from the Qt point
+ // of view, are just placeholders in the scene. For these widgets, any necessary
+ // drawing to the UI framebuffer is done by the relevant Symbian subsystem. For
+ // video rendering, this would be an MMF controller, or MDF post-processor.
+ uint disableBlit : 1;
#endif
};
@@ -287,7 +293,7 @@ public:
void setMask_sys(const QRegion &);
#ifdef Q_OS_SYMBIAN
- void handleSymbianDeferredFocusChanged();
+ void setSoftKeys_sys(const QList<QAction*> &softkeys);
#endif
void raise_sys();
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index 6b5e9b7..05db8ca 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -78,14 +78,131 @@ static bool isEqual(const QList<QAction*>& a, const QList<QAction*>& b)
return true;
}
-void QWidgetPrivate::setWSGeometry(bool /* dontShow */, const QRect & /* rect */)
+void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &)
{
+ // Note: based on x11 implementation
+ static const int XCOORD_MAX = 16383;
+ static const int WRECT_MAX = 16383;
+
+ Q_Q(QWidget);
+
+ Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
+
+ /*
+ There are up to four different coordinate systems here:
+ Qt coordinate system for this widget.
+ Symbian coordinate system for this widget (relative to wrect).
+ Qt coordinate system for parent
+ Symbian coordinate system for parent (relative to parent's wrect).
+ */
+
+ QRect validRange(-XCOORD_MAX,-XCOORD_MAX, 2*XCOORD_MAX, 2*XCOORD_MAX);
+ QRect wrectRange(-WRECT_MAX,-WRECT_MAX, 2*WRECT_MAX, 2*WRECT_MAX);
+ QRect wrect;
+ //xrect is the Symbian geometry of my widget. (starts out in parent's Qt coord sys, and ends up in parent's Symbian coord sys)
+ QRect xrect = data.crect;
+
+ const QWidget *const parent = q->parentWidget();
+ QRect parentWRect = parent->data->wrect;
+
+ if (parentWRect.isValid()) {
+ // parent is clipped, and we have to clip to the same limit as parent
+ if (!parentWRect.contains(xrect)) {
+ xrect &= parentWRect;
+ wrect = xrect;
+ //translate from parent's to my Qt coord sys
+ wrect.translate(-data.crect.topLeft());
+ }
+ //translate from parent's Qt coords to parent's X coords
+ xrect.translate(-parentWRect.topLeft());
+
+ } else {
+ // parent is not clipped, we may or may not have to clip
+
+ if (data.wrect.isValid() && QRect(QPoint(),data.crect.size()).contains(data.wrect)) {
+ // This is where the main optimization is: we are already
+ // clipped, and if our clip is still valid, we can just
+ // move our window, and do not need to move or clip
+ // children
+
+ QRect vrect = xrect & parent->rect();
+ vrect.translate(-data.crect.topLeft()); //the part of me that's visible through parent, in my Qt coords
+ if (data.wrect.contains(vrect)) {
+ xrect = data.wrect;
+ xrect.translate(data.crect.topLeft());
+ if (data.winid)
+ data.winid->SetExtent(TPoint(xrect.x(), xrect.y()), TSize(xrect.width(), xrect.height()));
+ return;
+ }
+ }
+
+ if (!validRange.contains(xrect)) {
+ // we are too big, and must clip
+ xrect &=wrectRange;
+ wrect = xrect;
+ wrect.translate(-data.crect.topLeft());
+ //parent's X coord system is equal to parent's Qt coord
+ //sys, so we don't need to map xrect.
+ }
+ }
+
+ // unmap if we are outside the valid window system coord system
+ bool outsideRange = !xrect.isValid();
+ bool mapWindow = false;
+ if (q->testAttribute(Qt::WA_OutsideWSRange) != outsideRange) {
+ q->setAttribute(Qt::WA_OutsideWSRange, outsideRange);
+ if (outsideRange) {
+ if (data.winid)
+ data.winid->DrawableWindow()->SetVisible(EFalse);
+ q->setAttribute(Qt::WA_Mapped, false);
+ } else if (!q->isHidden()) {
+ mapWindow = true;
+ }
+ }
+
+ if (outsideRange)
+ return;
+
+ bool jump = (data.wrect != wrect);
+ data.wrect = wrect;
+
+ // and now recursively for all children...
+ for (int i = 0; i < children.size(); ++i) {
+ QObject *object = children.at(i);
+ if (object->isWidgetType()) {
+ QWidget *w = static_cast<QWidget *>(object);
+ if (!w->isWindow() && w->testAttribute(Qt::WA_WState_Created))
+ w->d_func()->setWSGeometry(jump);
+ }
+ }
+
+ if (data.winid) {
+ // move ourselves to the new position and map (if necessary) after
+ // the movement. Rationale: moving unmapped windows is much faster
+ // than moving mapped windows
+ if (!parent->internalWinId())
+ xrect.translate(parent->mapTo(q->nativeParentWidget(), QPoint(0, 0)));
+
+ data.winid->SetExtent(TPoint(xrect.x(), xrect.y()), TSize(xrect.width(), xrect.height()));
+ }
+
+ if (mapWindow and !dontShow) {
+ q->setAttribute(Qt::WA_Mapped);
+ if (q->internalWinId())
+ q->internalWinId()->DrawableWindow()->SetVisible(ETrue);
+ }
+
+ if (jump && data.winid) {
+ RWindow *const window = static_cast<RWindow *>(data.winid->DrawableWindow());
+ window->Invalidate(TRect(0, 0, wrect.width(), wrect.height()));
+ }
}
void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
{
Q_Q(QWidget);
+
Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
if ((q->windowType() == Qt::Desktop))
@@ -129,7 +246,6 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
// put the window in its place and show it
q->internalWinId()->SetRect(TRect(TPoint(x, y), TSize(w, h)));
data.crect.setRect(x, y, w, h);
-
show_sys();
} else {
QRect r = QRect(x, y, w, h);
@@ -251,20 +367,22 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de
} else {
stackingFlags = ECoeStackFlagStandard;
}
+ control->MakeVisible(false);
QT_TRAP_THROWING(control->ControlEnv()->AppUi()->AddToStackL(control, ECoeStackPriorityDefault, stackingFlags));
+ // Avoid keyboard focus to a hidden window.
+ control->setFocusSafely(false);
- QTLWExtra *topExtra = topData();
- topExtra->rwindow = control->DrawableWindow();
+ RDrawableWindow *const drawableWindow = control->DrawableWindow();
// Request mouse move events.
- topExtra->rwindow->PointerFilter(EPointerFilterEnterExit
+ drawableWindow->PointerFilter(EPointerFilterEnterExit
| EPointerFilterMove | EPointerFilterDrag, 0);
- topExtra->rwindow->EnableVisibilityChangeEvents();
+ drawableWindow->EnableVisibilityChangeEvents();
if (!isOpaque) {
- RWindow *rwindow = static_cast<RWindow*>(topExtra->rwindow);
- TDisplayMode gotDM = (TDisplayMode)rwindow->SetRequiredDisplayMode(EColor16MA);
- if (rwindow->SetTransparencyAlphaChannel() == KErrNone)
- rwindow->SetBackgroundColor(TRgb(255, 255, 255, 0));
+ RWindow *const window = static_cast<RWindow *>(drawableWindow);
+ const TDisplayMode displayMode = static_cast<TDisplayMode>(window->SetRequiredDisplayMode(EColor16MA));
+ if (window->SetTransparencyAlphaChannel() == KErrNone)
+ window->SetBackgroundColor(TRgb(255, 255, 255, 0));
}
}
@@ -284,10 +402,10 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de
} else {
stackingFlags = ECoeStackFlagStandard;
}
+ control->MakeVisible(false);
QT_TRAP_THROWING(control->ControlEnv()->AppUi()->AddToStackL(control, ECoeStackPriorityDefault, stackingFlags));
-
- WId parentw = parentWidget->effectiveWinId();
- QT_TRAP_THROWING(control->SetContainerWindowL(*parentw));
+ // Avoid keyboard focus to a hidden window.
+ control->setFocusSafely(false);
q->setAttribute(Qt::WA_WState_Created);
int x, y, w, h;
@@ -308,7 +426,7 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de
void QWidgetPrivate::show_sys()
{
Q_Q(QWidget);
-
+
if (q->testAttribute(Qt::WA_OutsideWSRange))
return;
@@ -321,20 +439,23 @@ void QWidgetPrivate::show_sys()
return;
}
- if (q->isWindow() && q->internalWinId()) {
-
- WId id = q->internalWinId();
- if (!extra->topextra->activated) {
+ if (q->internalWinId()) {
+
+ QSymbianControl *id = static_cast<QSymbianControl *>(q->internalWinId());
+ if (!extra->activated) {
QT_TRAP_THROWING(id->ActivateL());
- extra->topextra->activated = 1;
+ extra->activated = 1;
}
id->MakeVisible(true);
- id->SetFocus(true);
+
+ if(q->isWindow())
+ id->setFocusSafely(true);
// Force setting of the icon after window is made visible,
// this is needed even WA_SetWindowIcon is not set, as in that case we need
// to reset to the application level window icon
- setWindowIcon_sys(true);
+ if(q->isWindow())
+ setWindowIcon_sys(true);
}
invalidateBuffer(q->rect());
@@ -343,12 +464,14 @@ void QWidgetPrivate::show_sys()
void QWidgetPrivate::hide_sys()
{
Q_Q(QWidget);
+
Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
deactivateWidgetCleanup();
- WId id = q->internalWinId();
- if (q->isWindow() && id) {
- if (id->IsFocused()) // Avoid unnecessary calls to FocusChanged()
- id->SetFocus(false);
+ QSymbianControl *id = static_cast<QSymbianControl *>(q->internalWinId());
+
+ if (id) {
+ if(id->IsFocused()) // Avoid unnecessary calls to FocusChanged()
+ id->setFocusSafely(false);
id->MakeVisible(false);
if (QWidgetBackingStore *bs = maybeBackingStore())
bs->releaseBuffer();
@@ -364,55 +487,26 @@ void QWidgetPrivate::setFocus_sys()
Q_Q(QWidget);
if (q->testAttribute(Qt::WA_WState_Created) && q->window()->windowType() != Qt::Popup)
if (!q->effectiveWinId()->IsFocused()) // Avoid unnecessry calls to FocusChanged()
- q->effectiveWinId()->SetFocus(true);
-}
-
-void QWidgetPrivate::handleSymbianDeferredFocusChanged()
-{
- Q_Q(QWidget);
- WId control = q->internalWinId();
- if (!control) {
- // This could happen if the widget was reparented, while the focuschange
- // was in the event queue.
- return;
- }
-
- if (control->IsFocused()) {
- QApplication::setActiveWindow(q);
-#ifdef Q_WS_S60
- // If widget is fullscreen, hide status pane and button container
- // otherwise show them.
- CEikStatusPane* statusPane = S60->statusPane();
- CEikButtonGroupContainer* buttonGroup = S60->buttonGroupContainer();
- bool isFullscreen = q->windowState() & Qt::WindowFullScreen;
- if (statusPane && (statusPane->IsVisible() == isFullscreen))
- statusPane->MakeVisible(!isFullscreen);
- if (buttonGroup && (buttonGroup->IsVisible() == isFullscreen))
- buttonGroup->MakeVisible(!isFullscreen);
-#endif
- } else {
- QApplication::setActiveWindow(0);
- }
+ static_cast<QSymbianControl *>(q->effectiveWinId())->setFocusSafely(true);
}
void QWidgetPrivate::raise_sys()
{
Q_Q(QWidget);
+
Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
- QTLWExtra *tlwExtra = maybeTopData();
- if (q->internalWinId() && tlwExtra) {
- tlwExtra->rwindow->SetOrdinalPosition(0);
- }
+ if (q->internalWinId())
+ q->internalWinId()->DrawableWindow()->SetOrdinalPosition(0);
}
void QWidgetPrivate::lower_sys()
{
Q_Q(QWidget);
+
Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
- QTLWExtra *tlwExtra = maybeTopData();
- if (q->internalWinId() && tlwExtra) {
- tlwExtra->rwindow->SetOrdinalPosition(-1);
- }
+ if (q->internalWinId())
+ q->internalWinId()->DrawableWindow()->SetOrdinalPosition(-1);
+
if (!q->isWindow())
invalidateBuffer(q->rect());
}
@@ -426,10 +520,13 @@ void QWidgetPrivate::stackUnder_sys(QWidget* w)
{
Q_Q(QWidget);
Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
- QTLWExtra *tlwExtra = maybeTopData();
- QTLWExtra *tlwExtraSibling = w->d_func()->maybeTopData();
- if (q->internalWinId() && tlwExtra && w->internalWinId() && tlwExtraSibling)
- tlwExtra->rwindow->SetOrdinalPosition(tlwExtraSibling->rwindow->OrdinalPosition() + 1);
+
+ if (q->internalWinId() && w->internalWinId()) {
+ RDrawableWindow *const thisWindow = q->internalWinId()->DrawableWindow();
+ RDrawableWindow *const otherWindow = w->internalWinId()->DrawableWindow();
+ thisWindow->SetOrdinalPosition(otherWindow->OrdinalPosition() + 1);
+ }
+
if (!q->isWindow() || !w->internalWinId())
invalidateBuffer(q->rect());
}
@@ -437,6 +534,7 @@ void QWidgetPrivate::stackUnder_sys(QWidget* w)
void QWidgetPrivate::reparentChildren()
{
Q_Q(QWidget);
+
QObjectList chlist = q->children();
for (int i = 0; i < chlist.size(); ++i) { // reparent children
QObject *obj = chlist.at(i);
@@ -467,6 +565,7 @@ void QWidgetPrivate::reparentChildren()
void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f)
{
Q_Q(QWidget);
+
bool wasCreated = q->testAttribute(Qt::WA_WState_Created);
if (q->isVisible() && q->parentWidget() && parent != q->parentWidget())
@@ -475,7 +574,7 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f)
if (q->testAttribute(Qt::WA_DropSiteRegistered))
q->setAttribute(Qt::WA_DropSiteRegistered, false);
- WId old_winid = wasCreated ? data.winid : 0;
+ QSymbianControl *old_winid = static_cast<QSymbianControl *>(wasCreated ? data.winid : 0);
if ((q->windowType() == Qt::Desktop))
old_winid = 0;
setWinId(0);
@@ -485,7 +584,7 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f)
if (wasCreated && old_winid) {
old_winid->MakeVisible(false);
if (old_winid->IsFocused()) // Avoid unnecessary calls to FocusChanged()
- old_winid->SetFocus(false);
+ old_winid->setFocusSafely(false);
old_winid->SetParent(0);
}
@@ -536,17 +635,14 @@ void QWidgetPrivate::s60UpdateIsOpaque()
if ((data.window_flags & Qt::FramelessWindowHint) == 0)
return;
+ RWindow *const window = static_cast<RWindow *>(q->effectiveWinId()->DrawableWindow());
+
if (!isOpaque) {
- QTLWExtra *topExtra = topData();
- RWindow *rwindow = static_cast<RWindow*>(topExtra->rwindow);
- TDisplayMode gotDM = (TDisplayMode)rwindow->SetRequiredDisplayMode(EColor16MA);
- if (rwindow->SetTransparencyAlphaChannel() == KErrNone)
- rwindow->SetBackgroundColor(TRgb(255, 255, 255, 0));
- } else {
- QTLWExtra *topExtra = topData();
- RWindow *rwindow = static_cast<RWindow*>(topExtra->rwindow);
- rwindow->SetTransparentRegion(TRegionFix<1>());
- }
+ const TDisplayMode displayMode = static_cast<TDisplayMode>(window->SetRequiredDisplayMode(EColor16MA));
+ if (window->SetTransparencyAlphaChannel() == KErrNone)
+ window->SetBackgroundColor(TRgb(255, 255, 255, 0));
+ } else
+ window->SetTransparentRegion(TRegionFix<1>());
}
CFbsBitmap* qt_pixmapToNativeBitmap(QPixmap pixmap, bool invert)
@@ -722,8 +818,8 @@ void QWidgetPrivate::scroll_sys(int dx, int dy)
scrollRect(q->rect(), dx, dy);
} else {
Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
- RDrawableWindow* rw = topData()->rwindow;
- rw->Scroll(TPoint(dx, dy));
+ RDrawableWindow *const window = q->internalWinId()->DrawableWindow();
+ window->Scroll(TPoint(dx, dy));
}
}
@@ -735,8 +831,8 @@ void QWidgetPrivate::scroll_sys(int dx, int dy, const QRect &r)
scrollRect(r, dx, dy);
} else {
Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
- RDrawableWindow* rw = topData()->rwindow;
- rw->Scroll(TPoint(dx, dy), qt_QRect2TRect(r));
+ RDrawableWindow *const window = q->internalWinId()->DrawableWindow();
+ window->Scroll(TPoint(dx, dy), qt_QRect2TRect(r));
}
}
@@ -768,8 +864,6 @@ void QWidgetPrivate::registerDropSite(bool /* on */)
void QWidgetPrivate::createTLSysExtra()
{
extra->topextra->backingStore = 0;
- extra->topextra->activated = 0;
- extra->topextra->rwindow = 0;
}
void QWidgetPrivate::deleteTLSysExtra()
@@ -780,7 +874,8 @@ void QWidgetPrivate::deleteTLSysExtra()
void QWidgetPrivate::createSysExtra()
{
-
+ extra->activated = 0;
+ extra->disableBlit = 0;
}
void QWidgetPrivate::deleteSysExtra()
@@ -903,9 +998,10 @@ QPoint QWidget::mapToGlobal(const QPoint &pos) const
return pos + tp;
}
- // This is the native window case. Consider using CCoeControl::PositionRelativeToScreen()
- // if we decide to go with CCoeControl
- return QPoint();
+ // Native window case
+ const TPoint widgetScreenOffset = internalWinId()->PositionRelativeToScreen();
+ const QPoint globalPos = QPoint(widgetScreenOffset.iX, widgetScreenOffset.iY) + pos;
+ return globalPos;
}
QPoint QWidget::mapFromGlobal(const QPoint &pos) const
@@ -919,13 +1015,16 @@ QPoint QWidget::mapFromGlobal(const QPoint &pos) const
return pos - tp;
}
- // ### TODO native window
- return QPoint();
+ // Native window case
+ const TPoint widgetScreenOffset = internalWinId()->PositionRelativeToScreen();
+ const QPoint widgetPos = pos - QPoint(widgetScreenOffset.iX, widgetScreenOffset.iY);
+ return widgetPos;
}
void QWidget::setWindowState(Qt::WindowStates newstate)
{
Q_D(QWidget);
+
Qt::WindowStates oldstate = windowState();
if (oldstate == newstate)
return;
@@ -1002,17 +1101,17 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
if ((oldstate & Qt::WindowMinimized) != (newstate & Qt::WindowMinimized)) {
if (newstate & Qt::WindowMinimized) {
if (isVisible()) {
- WId id = effectiveWinId();
+ QSymbianControl *id = static_cast<QSymbianControl *>(effectiveWinId());
if (id->IsFocused()) // Avoid unnecessary calls to FocusChanged()
- id->SetFocus(false);
+ id->setFocusSafely(false);
id->MakeVisible(false);
}
} else {
if (isVisible()) {
- WId id = effectiveWinId();
+ QSymbianControl *id = static_cast<QSymbianControl *>(effectiveWinId());
id->MakeVisible(true);
if (!id->IsFocused()) // Avoid unnecessary calls to FocusChanged()
- id->SetFocus(true);
+ id->setFocusSafely(true);
}
const QRect normalGeometry = geometry();
const QRect r = top->normalGeometry;
@@ -1039,7 +1138,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
if (!isWindow() && parentWidget())
parentWidget()->d_func()->invalidateBuffer(geometry());
d->deactivateWidgetCleanup();
- WId id = internalWinId();
+ QSymbianControl *id = static_cast<QSymbianControl *>(internalWinId());
if (testAttribute(Qt::WA_WState_Created)) {
#ifndef QT_NO_IM
@@ -1067,7 +1166,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
}
if (destroyWindow && !(windowType() == Qt::Desktop) && id) {
if (id->IsFocused()) // Avoid unnecessry calls to FocusChanged()
- id->SetFocus(false);
+ id->setFocusSafely(false);
id->ControlEnv()->AppUi()->RemoveFromStack(id);
// Hack to activate window under destroyed one. With this activation
@@ -1173,11 +1272,12 @@ void QWidget::releaseMouse()
void QWidget::activateWindow()
{
Q_D(QWidget);
+
QWidget *tlw = window();
if (tlw->isVisible()) {
window()->createWinId();
- WId id = tlw->internalWinId();
- id->SetFocus(true);
+ QSymbianControl *id = static_cast<QSymbianControl *>(tlw->internalWinId());
+ id->setFocusSafely(true);
}
}
diff --git a/src/gui/s60framework/qs60mainapplication.h b/src/gui/s60framework/qs60mainapplication.h
index 457764c..5f621e0 100644
--- a/src/gui/s60framework/qs60mainapplication.h
+++ b/src/gui/s60framework/qs60mainapplication.h
@@ -42,7 +42,7 @@
#ifndef QS60MAINAPPLICATION_H
#define QS60MAINAPPLICATION_H
-#include <qglobal.h>
+#include <QtCore/qglobal.h>
#ifdef Q_WS_S60
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index 1e57167..6bdb79e 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -2397,8 +2397,6 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple
// lets use spinbox frame here as well, as no combobox specific value available.
const int frameThickness = cmb->frame ? pixelMetric(PM_SpinBoxFrameWidth, cmb, widget) : 0;
const int buttonWidth = QS60StylePrivate::pixelMetric(QStyle::PM_ButtonIconSize);
- const int xposMod = (cmb->rect.x()) + width - buttonMargin - buttonWidth;
- const int ypos = cmb->rect.y();
QSize buttonSize;
buttonSize.setHeight(qMax(8, (cmb->rect.height()>>1) - frameThickness)); //minimum of 8 pixels
@@ -2406,15 +2404,18 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple
buttonSize = buttonSize.expandedTo(QApplication::globalStrut());
switch (scontrol) {
case SC_ComboBoxArrow:
- ret.setRect(xposMod, ypos + buttonMargin, buttonWidth, height - 2*buttonMargin);
+ ret.setRect(
+ ret.x() + ret.width() - buttonMargin - buttonWidth,
+ ret.y() + buttonMargin,
+ buttonWidth,
+ height - 2*buttonMargin);
break;
case SC_ComboBoxEditField: {
- const int withFrameX = cmb->rect.x() + cmb->rect.width() - frameThickness - buttonSize.width();
- ret = QRect(
- frameThickness,
- frameThickness,
- withFrameX - frameThickness,
- cmb->rect.height() - 2*frameThickness);
+ ret.setRect(
+ ret.x() + frameThickness,
+ ret.y() + frameThickness,
+ ret.width() - 2*frameThickness - buttonSize.width(),
+ ret.height() - 2*frameThickness);
}
break;
default:
diff --git a/src/gui/styles/qs60style.h b/src/gui/styles/qs60style.h
index fd18bc3..6be3197 100644
--- a/src/gui/styles/qs60style.h
+++ b/src/gui/styles/qs60style.h
@@ -76,6 +76,9 @@ public:
void unpolish(QWidget *widget);
void polish(QApplication *application);
void unpolish(QApplication *application);
+#ifndef Q_NO_USING_KEYWORD
+ using QCommonStyle::polish;
+#endif
void setStyleProperty(const char *name, const QVariant &value);
QVariant styleProperty(const char *name) const;
diff --git a/src/gui/styles/qwindowsvistastyle.cpp b/src/gui/styles/qwindowsvistastyle.cpp
index b062a3f..6cb8b40 100644
--- a/src/gui/styles/qwindowsvistastyle.cpp
+++ b/src/gui/styles/qwindowsvistastyle.cpp
@@ -731,14 +731,11 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
{
const QStyleOptionViewItemV4 *vopt;
const QAbstractItemView *view = qobject_cast<const QAbstractItemView *>(widget);
- bool newStyle = false;
+ bool newStyle = true;
+
+ if (qobject_cast<const QTableView*>(widget))
+ newStyle = false;
- if (const QListView *listview = qobject_cast<const QListView *>(widget)) {
- if (listview->viewMode() == QListView::IconMode)
- newStyle = true;
- } else if (qobject_cast<const QTreeView *>(widget)) {
- newStyle = true;
- }
if (newStyle && view && (vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option))) {
bool selected = vopt->state & QStyle::State_Selected;
bool hover = vopt->state & QStyle::State_MouseOver;
@@ -1496,14 +1493,11 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
{
const QStyleOptionViewItemV4 *vopt;
const QAbstractItemView *view = qobject_cast<const QAbstractItemView *>(widget);
- bool newStyle = false;
+ bool newStyle = true;
+
+ if (qobject_cast<const QTableView*>(widget))
+ newStyle = false;
- if (const QListView *listview = qobject_cast<const QListView *>(widget)) {
- if (listview->viewMode() == QListView::IconMode)
- newStyle = true;
- } else if (qobject_cast<const QTreeView *>(widget)) {
- newStyle = true;
- }
if (newStyle && view && (vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option))) {
/*
// We cannot currently get the correct selection color for "explorer style" views
diff --git a/src/gui/styles/qwindowsvistastyle_p.h b/src/gui/styles/qwindowsvistastyle_p.h
index d4170aa..e9bbb77 100644
--- a/src/gui/styles/qwindowsvistastyle_p.h
+++ b/src/gui/styles/qwindowsvistastyle_p.h
@@ -84,6 +84,7 @@
#include <qinputdialog.h>
#include <qtreeview.h>
#include <qlistview.h>
+#include <qtableview.h>
#include <qbasictimer.h>
#include <qcommandlinkbutton.h>
diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h
index ef91983..d73e1c4 100644
--- a/src/gui/text/qfont.h
+++ b/src/gui/text/qfont.h
@@ -309,6 +309,7 @@ private:
friend class QPicturePaintEngine;
friend class QPainterReplayer;
friend class QPaintBufferEngine;
+ friend class QCommandLinkButtonPrivate;
#ifndef QT_NO_DATASTREAM
friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QFont &);
diff --git a/src/gui/text/qfontengine_qpf.cpp b/src/gui/text/qfontengine_qpf.cpp
index 996e471..ef3f2ae 100644
--- a/src/gui/text/qfontengine_qpf.cpp
+++ b/src/gui/text/qfontengine_qpf.cpp
@@ -628,13 +628,13 @@ QImage QFontEngineQPF::alphaMapForGlyph(glyph_t g)
{
const Glyph *glyph = findGlyph(g);
if (!glyph)
- QImage();
+ return QImage();
const uchar *bits = ((const uchar *) glyph) + sizeof(Glyph);
QImage image(glyph->width, glyph->height, QImage::Format_Indexed8);
for (int j=0; j<256; ++j)
- image.setColor(j, 0xff000000 | j | (j<<8) | (j<<16));
+ image.setColor(j, qRgba(0, 0, 0, j));
for (int i=0; i<glyph->height; ++i) {
memcpy(image.scanLine(i), bits, glyph->bytesPerLine);
diff --git a/src/gui/text/qfontengine_qws.cpp b/src/gui/text/qfontengine_qws.cpp
index 888e1be..de8028c 100644
--- a/src/gui/text/qfontengine_qws.cpp
+++ b/src/gui/text/qfontengine_qws.cpp
@@ -528,10 +528,12 @@ QImage QFontEngineQPF1::alphaMapForGlyph(glyph_t g)
QImage image;
if (mono) {
image = QImage((glyph->metrics->width+7)&~7, glyph->metrics->height, QImage::Format_Mono);
+ image.setColor(0, qRgba(0, 0, 0, 0));
+ image.setColor(1, qRgba(0, 0, 0, 255));
} else {
image = QImage(glyph->metrics->width, glyph->metrics->height, QImage::Format_Indexed8);
for (int j=0; j<256; ++j)
- image.setColor(j, 0xff000000 | j | (j<<8) | (j<<16));
+ image.setColor(j, qRgba(0, 0, 0, j));
}
for (int i=0; i<glyph->metrics->height; ++i) {
memcpy(image.scanLine(i), bits, glyph->metrics->linestep);
diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp
index 61532b9..95ff4c1 100644
--- a/src/gui/widgets/qcombobox.cpp
+++ b/src/gui/widgets/qcombobox.cpp
@@ -403,8 +403,8 @@ QComboBoxPrivateContainer::QComboBoxPrivateContainer(QAbstractItemView *itemView
layout->setMargin(0);
#ifdef QT_SOFTKEYS_ENABLED
- selectAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::SelectSoftKey, Qt::Key_Select, itemView);
- cancelAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::CancelSoftKey, Qt::Key_Escape, itemView);
+ selectAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::SelectSoftKey, Qt::Key_Select, this);
+ cancelAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::CancelSoftKey, Qt::Key_Escape, this);
addAction(selectAction);
addAction(cancelAction);
#endif
@@ -534,6 +534,7 @@ void QComboBoxPrivateContainer::setItemView(QAbstractItemView *itemView)
this, SLOT(setCurrentIndex(QModelIndex)));
disconnect(view, SIGNAL(destroyed()),
this, SLOT(viewDestroyed()));
+
delete view;
view = 0;
}
@@ -571,11 +572,6 @@ void QComboBoxPrivateContainer::setItemView(QAbstractItemView *itemView)
this, SLOT(setCurrentIndex(QModelIndex)));
connect(view, SIGNAL(destroyed()),
this, SLOT(viewDestroyed()));
-
-#ifdef QT_SOFTKEYS_ENABLED
- selectAction->setParent(itemView);
- cancelAction->setParent(itemView);
-#endif
}
/*!
diff --git a/src/gui/widgets/qcommandlinkbutton.cpp b/src/gui/widgets/qcommandlinkbutton.cpp
index e64f687..9adf280 100644
--- a/src/gui/widgets/qcommandlinkbutton.cpp
+++ b/src/gui/widgets/qcommandlinkbutton.cpp
@@ -140,23 +140,34 @@ QFont QCommandLinkButtonPrivate::titleFont() const
Q_Q(const QCommandLinkButton);
QFont font = q->font();
if (usingVistaStyle()) {
- if (!q->testAttribute(Qt::WA_SetFont))
- font.setPointSizeF(12.0);
+ font.setPointSizeF(12.0);
} else {
font.setBold(true);
- if (!q->testAttribute(Qt::WA_SetFont))
- font.setPointSizeF(9.0);
+ font.setPointSizeF(9.0);
}
- return font;
+
+ // Note the font will be resolved against
+ // QPainters font, so we need to restore the mask
+ int resolve_mask = font.resolve_mask;
+ QFont modifiedFont = q->font().resolve(font);
+ modifiedFont.detach();
+ modifiedFont.resolve_mask = resolve_mask;
+ return modifiedFont;
}
QFont QCommandLinkButtonPrivate::descriptionFont() const
{
Q_Q(const QCommandLinkButton);
QFont font = q->font();
- if (!q->testAttribute(Qt::WA_SetFont))
- font.setPointSizeF(9.0);
- return font;
+ font.setPointSizeF(9.0);
+
+ // Note the font will be resolved against
+ // QPainters font, so we need to restore the mask
+ int resolve_mask = font.resolve_mask;
+ QFont modifiedFont = q->font().resolve(font);
+ modifiedFont.detach();
+ modifiedFont.resolve_mask = resolve_mask;
+ return modifiedFont;
}
QRect QCommandLinkButtonPrivate::titleRect() const
diff --git a/src/multimedia/audio/qaudioinput_alsa_p.cpp b/src/multimedia/audio/qaudioinput_alsa_p.cpp
index f36ffc8..46c4392 100644
--- a/src/multimedia/audio/qaudioinput_alsa_p.cpp
+++ b/src/multimedia/audio/qaudioinput_alsa_p.cpp
@@ -57,6 +57,8 @@ QT_BEGIN_NAMESPACE
//#define DEBUG_AUDIO 1
+static const int minimumIntervalTime = 50;
+
QAudioInputPrivate::QAudioInputPrivate(const QByteArray &device, const QAudioFormat& audioFormat):
settings(audioFormat)
{
@@ -248,6 +250,7 @@ bool QAudioInputPrivate::open()
qDebug()<<now.second()<<"s "<<now.msec()<<"ms :open()";
#endif
timeStamp.restart();
+ elapsedTimeOffset = 0;
int dir;
int err=-1;
@@ -283,69 +286,69 @@ bool QAudioInputPrivate::open()
err = snd_pcm_hw_params_any( handle, hwparams );
if ( err < 0 ) {
fatal = true;
- errMessage = QString(tr("QAudioInput: snd_pcm_hw_params_any: err = %1")).arg(err);
+ errMessage = QString::fromLatin1("QAudioInput: snd_pcm_hw_params_any: err = %1").arg(err);
}
if ( !fatal ) {
err = snd_pcm_hw_params_set_rate_resample( handle, hwparams, 1 );
if ( err < 0 ) {
fatal = true;
- errMessage = QString(tr("QAudioInput: snd_pcm_hw_params_set_rate_resample: err = %1")).arg(err);
+ errMessage = QString::fromLatin1("QAudioInput: snd_pcm_hw_params_set_rate_resample: err = %1").arg(err);
}
}
if ( !fatal ) {
err = snd_pcm_hw_params_set_access( handle, hwparams, access );
if ( err < 0 ) {
fatal = true;
- errMessage = QString(tr("QAudioInput: snd_pcm_hw_params_set_access: err = %1")).arg(err);
+ errMessage = QString::fromLatin1("QAudioInput: snd_pcm_hw_params_set_access: err = %1").arg(err);
}
}
if ( !fatal ) {
err = setFormat();
if ( err < 0 ) {
fatal = true;
- errMessage = QString(tr("QAudioInput: snd_pcm_hw_params_set_format: err = %1")).arg(err);
+ errMessage = QString::fromLatin1("QAudioInput: snd_pcm_hw_params_set_format: err = %1").arg(err);
}
}
if ( !fatal ) {
err = snd_pcm_hw_params_set_channels( handle, hwparams, (unsigned int)settings.channels() );
if ( err < 0 ) {
fatal = true;
- errMessage = QString(tr("QAudioInput: snd_pcm_hw_params_set_channels: err = %1")).arg(err);
+ errMessage = QString::fromLatin1("QAudioInput: snd_pcm_hw_params_set_channels: err = %1").arg(err);
}
}
if ( !fatal ) {
err = snd_pcm_hw_params_set_rate_near( handle, hwparams, &freakuency, 0 );
if ( err < 0 ) {
fatal = true;
- errMessage = QString(tr("QAudioInput: snd_pcm_hw_params_set_rate_near: err = %1")).arg(err);
+ errMessage = QString::fromLatin1("QAudioInput: snd_pcm_hw_params_set_rate_near: err = %1").arg(err);
}
}
if ( !fatal ) {
err = snd_pcm_hw_params_set_buffer_time_near(handle, hwparams, &buffer_time, &dir);
if ( err < 0 ) {
fatal = true;
- errMessage = QString(tr("QAudioInput: snd_pcm_hw_params_set_buffer_time_near: err = %1")).arg(err);
+ errMessage = QString::fromLatin1("QAudioInput: snd_pcm_hw_params_set_buffer_time_near: err = %1").arg(err);
}
}
if ( !fatal ) {
err = snd_pcm_hw_params_set_period_time_near(handle, hwparams, &period_time, &dir);
if ( err < 0 ) {
fatal = true;
- errMessage = QString(tr("QAudioInput: snd_pcm_hw_params_set_period_time_near: err = %1")).arg(err);
+ errMessage = QString::fromLatin1("QAudioInput: snd_pcm_hw_params_set_period_time_near: err = %1").arg(err);
}
}
if ( !fatal ) {
err = snd_pcm_hw_params_set_periods_near(handle, hwparams, &chunks, &dir);
if ( err < 0 ) {
fatal = true;
- errMessage = QString(tr("QAudioInput: snd_pcm_hw_params_set_periods_near: err = %1")).arg(err);
+ errMessage = QString::fromLatin1("QAudioInput: snd_pcm_hw_params_set_periods_near: err = %1").arg(err);
}
}
if ( !fatal ) {
err = snd_pcm_hw_params(handle, hwparams);
if ( err < 0 ) {
fatal = true;
- errMessage = QString(tr("QAudioInput: snd_pcm_hw_params: err = %1")).arg(err);
+ errMessage = QString::fromLatin1("QAudioInput: snd_pcm_hw_params: err = %1").arg(err);
}
}
if( err < 0) {
@@ -443,7 +446,7 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len)
if (readFrames >= 0) {
err = snd_pcm_frames_to_bytes(handle, readFrames);
#ifdef DEBUG_AUDIO
- qDebug()<<QString(tr("PULL: read in bytes = %1 (frames=%2)")).arg(err).arg(readFrames).toLatin1().constData();
+ qDebug()<<QString::fromLatin1("PULL: read in bytes = %1 (frames=%2)").arg(err).arg(readFrames).toLatin1().constData();
#endif
break;
} else if((readFrames == -EAGAIN) || (readFrames == -EINTR)) {
@@ -531,7 +534,10 @@ int QAudioInputPrivate::periodSize() const
void QAudioInputPrivate::setNotifyInterval(int ms)
{
- intervalTime = ms;
+ if(ms >= minimumIntervalTime)
+ intervalTime = ms;
+ else
+ intervalTime = minimumIntervalTime;
}
int QAudioInputPrivate::notifyInterval() const
@@ -579,8 +585,9 @@ bool QAudioInputPrivate::deviceReady()
if(deviceState != QAudio::ActiveState)
return true;
- if(timeStamp.elapsed() > intervalTime && intervalTime > 50) {
+ if((timeStamp.elapsed() + elapsedTimeOffset) > intervalTime) {
emit notify();
+ elapsedTimeOffset = timeStamp.elapsed() + elapsedTimeOffset - intervalTime;
timeStamp.restart();
}
return true;
@@ -650,7 +657,7 @@ qint64 InputPrivate::readData( char* data, qint64 len)
if (readFrames >= 0) {
err = snd_pcm_frames_to_bytes(audioDevice->handle, readFrames);
#ifdef DEBUG_AUDIO
- qDebug()<<QString(tr("PUSH: read in bytes = %1 (frames=%2)")).arg(err).arg(readFrames).toLatin1().constData();
+ qDebug()<<QString::fromLatin1("PUSH: read in bytes = %1 (frames=%2)").arg(err).arg(readFrames).toLatin1().constData();
#endif
break;
} else if((readFrames == -EAGAIN) || (readFrames == -EINTR)) {
diff --git a/src/multimedia/audio/qaudioinput_alsa_p.h b/src/multimedia/audio/qaudioinput_alsa_p.h
index a1cc738..5583ea0 100644
--- a/src/multimedia/audio/qaudioinput_alsa_p.h
+++ b/src/multimedia/audio/qaudioinput_alsa_p.h
@@ -117,6 +117,7 @@ private:
QTimer* timer;
QTime timeStamp;
+ qint64 elapsedTimeOffset;
int intervalTime;
char* audioBuffer;
int bytesAvailable;
diff --git a/src/multimedia/audio/qaudioinput_win32_p.cpp b/src/multimedia/audio/qaudioinput_win32_p.cpp
index 31441ae..d4226f5 100644
--- a/src/multimedia/audio/qaudioinput_win32_p.cpp
+++ b/src/multimedia/audio/qaudioinput_win32_p.cpp
@@ -59,6 +59,8 @@ QT_BEGIN_NAMESPACE
static CRITICAL_SECTION waveInCriticalSection;
+static const int minimumIntervalTime = 50;
+
QAudioInputPrivate::QAudioInputPrivate(const QByteArray &device, const QAudioFormat& audioFormat):
settings(audioFormat)
{
@@ -226,6 +228,7 @@ bool QAudioInputPrivate::open()
period_size = buffer_size/2;
#endif
timeStamp.restart();
+ elapsedTimeOffset = 0;
wfx.nSamplesPerSec = settings.frequency();
wfx.wBitsPerSample = settings.sampleSize();
wfx.nChannels = settings.channels();
@@ -297,6 +300,7 @@ bool QAudioInputPrivate::open()
return false;
}
timeStampOpened.restart();
+ elapsedTimeOffset = 0;
totalTimeValue = 0;
errorState = QAudio::NoError;
deviceState = QAudio::ActiveState;
@@ -473,7 +477,10 @@ int QAudioInputPrivate::periodSize() const
void QAudioInputPrivate::setNotifyInterval(int ms)
{
- intervalTime = ms;
+ if(ms >= minimumIntervalTime)
+ intervalTime = ms;
+ else
+ intervalTime = minimumIntervalTime;
}
int QAudioInputPrivate::notifyInterval() const
@@ -524,8 +531,9 @@ bool QAudioInputPrivate::deviceReady()
if(deviceState != QAudio::ActiveState)
return true;
- if(timeStamp.elapsed() > intervalTime && intervalTime > 50) {
+ if((timeStamp.elapsed() + elapsedTimeOffset) > intervalTime) {
emit notify();
+ elapsedTimeOffset = timeStamp.elapsed() + elapsedTimeOffset - intervalTime;
timeStamp.restart();
}
return true;
diff --git a/src/multimedia/audio/qaudioinput_win32_p.h b/src/multimedia/audio/qaudioinput_win32_p.h
index 3363b6a..26c470d 100644
--- a/src/multimedia/audio/qaudioinput_win32_p.h
+++ b/src/multimedia/audio/qaudioinput_win32_p.h
@@ -109,6 +109,7 @@ private:
int bytesAvailable;
int intervalTime;
QTime timeStamp;
+ qint64 elapsedTimeOffset;
QTime timeStampOpened;
qint64 totalTimeValue;
bool pullMode;
diff --git a/src/multimedia/audio/qaudiooutput_alsa_p.cpp b/src/multimedia/audio/qaudiooutput_alsa_p.cpp
index e8a3f5c..0d37d61 100644
--- a/src/multimedia/audio/qaudiooutput_alsa_p.cpp
+++ b/src/multimedia/audio/qaudiooutput_alsa_p.cpp
@@ -57,6 +57,8 @@ QT_BEGIN_NAMESPACE
//#define DEBUG_AUDIO 1
+static const int minimumIntervalTime = 50;
+
QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray &device, const QAudioFormat& audioFormat):
settings(audioFormat)
{
@@ -271,6 +273,7 @@ bool QAudioOutputPrivate::open()
qDebug()<<now.second()<<"s "<<now.msec()<<"ms :open()";
#endif
timeStamp.restart();
+ elapsedTimeOffset = 0;
int dir;
int err=-1;
@@ -304,69 +307,69 @@ bool QAudioOutputPrivate::open()
err = snd_pcm_hw_params_any( handle, hwparams );
if ( err < 0 ) {
fatal = true;
- errMessage = QString(tr("QAudioOutput: snd_pcm_hw_params_any: err = %1")).arg(err);
+ errMessage = QString::fromLatin1("QAudioOutput: snd_pcm_hw_params_any: err = %1").arg(err);
}
if ( !fatal ) {
err = snd_pcm_hw_params_set_rate_resample( handle, hwparams, 1 );
if ( err < 0 ) {
fatal = true;
- errMessage = QString(tr("QAudioOutput: snd_pcm_hw_params_set_rate_resample: err = %1")).arg(err);
+ errMessage = QString::fromLatin1("QAudioOutput: snd_pcm_hw_params_set_rate_resample: err = %1").arg(err);
}
}
if ( !fatal ) {
err = snd_pcm_hw_params_set_access( handle, hwparams, access );
if ( err < 0 ) {
fatal = true;
- errMessage = QString(tr("QAudioOutput: snd_pcm_hw_params_set_access: err = %1")).arg(err);
+ errMessage = QString::fromLatin1("QAudioOutput: snd_pcm_hw_params_set_access: err = %1").arg(err);
}
}
if ( !fatal ) {
err = setFormat();
if ( err < 0 ) {
fatal = true;
- errMessage = QString(tr("QAudioOutput: snd_pcm_hw_params_set_format: err = %1")).arg(err);
+ errMessage = QString::fromLatin1("QAudioOutput: snd_pcm_hw_params_set_format: err = %1").arg(err);
}
}
if ( !fatal ) {
err = snd_pcm_hw_params_set_channels( handle, hwparams, (unsigned int)settings.channels() );
if ( err < 0 ) {
fatal = true;
- errMessage = QString(tr("QAudioOutput: snd_pcm_hw_params_set_channels: err = %1")).arg(err);
+ errMessage = QString::fromLatin1("QAudioOutput: snd_pcm_hw_params_set_channels: err = %1").arg(err);
}
}
if ( !fatal ) {
err = snd_pcm_hw_params_set_rate_near( handle, hwparams, &freakuency, 0 );
if ( err < 0 ) {
fatal = true;
- errMessage = QString(tr("QAudioOutput: snd_pcm_hw_params_set_rate_near: err = %1")).arg(err);
+ errMessage = QString::fromLatin1("QAudioOutput: snd_pcm_hw_params_set_rate_near: err = %1").arg(err);
}
}
if ( !fatal ) {
err = snd_pcm_hw_params_set_buffer_time_near(handle, hwparams, &buffer_time, &dir);
if ( err < 0 ) {
fatal = true;
- errMessage = QString(tr("QAudioOutput: snd_pcm_hw_params_set_buffer_time_near: err = %1")).arg(err);
+ errMessage = QString::fromLatin1("QAudioOutput: snd_pcm_hw_params_set_buffer_time_near: err = %1").arg(err);
}
}
if ( !fatal ) {
err = snd_pcm_hw_params_set_period_time_near(handle, hwparams, &period_time, &dir);
if ( err < 0 ) {
fatal = true;
- errMessage = QString(tr("QAudioOutput: snd_pcm_hw_params_set_period_time_near: err = %1")).arg(err);
+ errMessage = QString::fromLatin1("QAudioOutput: snd_pcm_hw_params_set_period_time_near: err = %1").arg(err);
}
}
if ( !fatal ) {
err = snd_pcm_hw_params_set_periods_near(handle, hwparams, &chunks, &dir);
if ( err < 0 ) {
fatal = true;
- errMessage = QString(tr("QAudioOutput: snd_pcm_hw_params_set_periods_near: err = %1")).arg(err);
+ errMessage = QString::fromLatin1("QAudioOutput: snd_pcm_hw_params_set_periods_near: err = %1").arg(err);
}
}
if ( !fatal ) {
err = snd_pcm_hw_params(handle, hwparams);
if ( err < 0 ) {
fatal = true;
- errMessage = QString(tr("QAudioOutput: snd_pcm_hw_params: err = %1")).arg(err);
+ errMessage = QString::fromLatin1("QAudioOutput: snd_pcm_hw_params: err = %1").arg(err);
}
}
if( err < 0) {
@@ -404,6 +407,8 @@ bool QAudioOutputPrivate::open()
// Step 6: Start audio processing
timer->start(period_time/1000);
+ timeStamp.restart();
+ elapsedTimeOffset = 0;
errorState = QAudio::NoError;
totalTimeValue = 0;
opened = true;
@@ -500,7 +505,10 @@ int QAudioOutputPrivate::bufferSize() const
void QAudioOutputPrivate::setNotifyInterval(int ms)
{
- intervalTime = ms;
+ if(ms >= minimumIntervalTime)
+ intervalTime = ms;
+ else
+ intervalTime = minimumIntervalTime;
}
int QAudioOutputPrivate::notifyInterval() const
@@ -629,8 +637,9 @@ bool QAudioOutputPrivate::deviceReady()
if(deviceState != QAudio::ActiveState)
return true;
- if(timeStamp.elapsed() > intervalTime && intervalTime > 50) {
+ if((timeStamp.elapsed() + elapsedTimeOffset) > intervalTime) {
emit notify();
+ elapsedTimeOffset = timeStamp.elapsed() + elapsedTimeOffset - intervalTime;
timeStamp.restart();
}
return true;
diff --git a/src/multimedia/audio/qaudiooutput_alsa_p.h b/src/multimedia/audio/qaudiooutput_alsa_p.h
index 63fe348..6d4177d 100644
--- a/src/multimedia/audio/qaudiooutput_alsa_p.h
+++ b/src/multimedia/audio/qaudiooutput_alsa_p.h
@@ -134,6 +134,7 @@ private:
QByteArray m_device;
int bytesAvailable;
QTime timeStamp;
+ qint64 elapsedTimeOffset;
char* audioBuffer;
snd_pcm_t* handle;
snd_async_handler_t* ahandler;
diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp
index aea3a3f..bb61f41 100644
--- a/src/multimedia/audio/qaudiooutput_win32_p.cpp
+++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp
@@ -58,6 +58,8 @@ QT_BEGIN_NAMESPACE
static CRITICAL_SECTION waveOutCriticalSection;
+static const int minimumIntervalTime = 50;
+
QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray &device, const QAudioFormat& audioFormat):
settings(audioFormat)
{
@@ -221,6 +223,7 @@ bool QAudioOutputPrivate::open()
audioBuffer = new char[buffer_size];
timeStamp.restart();
+ elapsedTimeOffset = 0;
wfx.nSamplesPerSec = settings.frequency();
wfx.wBitsPerSample = settings.sampleSize();
@@ -261,6 +264,7 @@ bool QAudioOutputPrivate::open()
totalTimeValue = 0;
timeStampOpened.restart();
+ elapsedTimeOffset = 0;
errorState = QAudio::NoError;
if(pullMode) {
@@ -316,7 +320,10 @@ int QAudioOutputPrivate::bufferSize() const
void QAudioOutputPrivate::setNotifyInterval(int ms)
{
- intervalTime = ms;
+ if(ms >= minimumIntervalTime)
+ intervalTime = ms;
+ else
+ intervalTime = minimumIntervalTime;
}
int QAudioOutputPrivate::notifyInterval() const
@@ -420,7 +427,6 @@ void QAudioOutputPrivate::feedback()
bool QAudioOutputPrivate::deviceReady()
{
if(pullMode) {
- int i = 0;
int chunks = bytesAvailable/period_size;
#ifdef DEBUG_AUDIO
qDebug()<<"deviceReady() avail="<<bytesAvailable<<" bytes, period size="<<period_size<<" bytes";
@@ -430,6 +436,22 @@ bool QAudioOutputPrivate::deviceReady()
if(totalTimeValue == 0)
startup = true;
+ bool full=false;
+ EnterCriticalSection(&waveOutCriticalSection);
+ if(waveFreeBlockCount==0) full = true;
+ LeaveCriticalSection(&waveOutCriticalSection);
+ if (full){
+#ifdef DEBUG_AUDIO
+ qDebug() << "Skipping data as unable to write";
+#endif
+ if((timeStamp.elapsed() + elapsedTimeOffset) > intervalTime ) {
+ emit notify();
+ elapsedTimeOffset = timeStamp.elapsed() + elapsedTimeOffset - intervalTime;
+ timeStamp.restart();
+ }
+ return true;
+ }
+
if(startup)
waveOutPause(hWaveOut);
int input = period_size*chunks;
@@ -451,7 +473,7 @@ bool QAudioOutputPrivate::deviceReady()
}
LeaveCriticalSection(&waveOutCriticalSection);
- } else if(i < 0) {
+ } else if(l < 0) {
bytesAvailable = bytesFree();
errorState = QAudio::IOError;
}
@@ -459,8 +481,9 @@ bool QAudioOutputPrivate::deviceReady()
if(deviceState != QAudio::ActiveState)
return true;
- if(timeStamp.elapsed() > intervalTime && intervalTime > 50) {
+ if((timeStamp.elapsed() + elapsedTimeOffset) > intervalTime) {
emit notify();
+ elapsedTimeOffset = timeStamp.elapsed() + elapsedTimeOffset - intervalTime;
timeStamp.restart();
}
@@ -468,7 +491,7 @@ bool QAudioOutputPrivate::deviceReady()
}
qint64 QAudioOutputPrivate::clock() const
-{
+{
if(deviceState != QAudio::ActiveState)
return 0;
diff --git a/src/multimedia/audio/qaudiooutput_win32_p.h b/src/multimedia/audio/qaudiooutput_win32_p.h
index 5c08bf4..bcf8e1e 100644
--- a/src/multimedia/audio/qaudiooutput_win32_p.h
+++ b/src/multimedia/audio/qaudiooutput_win32_p.h
@@ -109,6 +109,7 @@ private:
bool resuming;
int bytesAvailable;
QTime timeStamp;
+ qint64 elapsedTimeOffset;
QTime timeStampOpened;
qint32 buffer_size;
qint32 period_size;
diff --git a/src/network/kernel/qhostinfo_win.cpp b/src/network/kernel/qhostinfo_win.cpp
index 55aa77a..d9d7234 100644
--- a/src/network/kernel/qhostinfo_win.cpp
+++ b/src/network/kernel/qhostinfo_win.cpp
@@ -186,7 +186,7 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName)
results.setHostName(hostName);
if (aceHostname.isEmpty()) {
results.setError(QHostInfo::HostNotFound);
- results.setErrorString(hostName.isEmpty() ? QObject::tr("No host name given") : QObject::tr("Invalid hostname"));
+ results.setErrorString(hostName.isEmpty() ? tr("No host name given") : tr("Invalid hostname"));
return results;
}
} else {
diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp
index 5ce1a45..6c93bea 100644
--- a/src/opengl/qgl_egl.cpp
+++ b/src/opengl/qgl_egl.cpp
@@ -142,10 +142,12 @@ void QGLContext::reset()
d->cleanup();
doneCurrent();
if (d->eglContext) {
+ if (d->eglSurface != EGL_NO_SURFACE)
+ eglDestroySurface(d->eglContext->display(), d->eglSurface);
delete d->eglContext;
- d->eglContext = 0;
}
- d->eglSurface = EGL_NO_SURFACE; // XXX - probably need to destroy surface
+ d->eglContext = 0;
+ d->eglSurface = EGL_NO_SURFACE;
d->crWin = false;
d->sharing = false;
d->valid = false;
diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp
index bb3cb5d..1ae3866 100644
--- a/src/opengl/qglpixmapfilter.cpp
+++ b/src/opengl/qglpixmapfilter.cpp
@@ -79,34 +79,28 @@ protected:
bool processGL(QPainter *painter, const QPointF &pos, const QPixmap &pixmap, const QRectF &srcRect) const;
};
-#ifndef QT_OPENGL_ES_2
-
-class QGLPixmapConvolutionFilter: public QGLPixmapFilter<QPixmapConvolutionFilter>
+class QGLPixmapConvolutionFilter: public QGLCustomShaderStage, public QGLPixmapFilter<QPixmapConvolutionFilter>
{
public:
QGLPixmapConvolutionFilter();
~QGLPixmapConvolutionFilter();
+ void setUniforms(QGLShaderProgram *program);
+
protected:
bool processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &srcRect) const;
private:
QByteArray generateConvolutionShader() const;
- mutable QGLShaderProgram *m_program;
- mutable int m_scaleUniform;
- mutable int m_matrixUniform;
-
- mutable int m_kernelWidth;
- mutable int m_kernelHeight;
+ mutable QSize m_srcSize;
+ mutable int m_prevKernelSize;
};
-#endif
-
class QGLPixmapBlurFilter : public QGLCustomShaderStage, public QGLPixmapFilter<QPixmapBlurFilter>
{
public:
- QGLPixmapBlurFilter(QPixmapBlurFilter::BlurHint hint);
+ QGLPixmapBlurFilter(Qt::RenderHint hint);
void setUniforms(QGLShaderProgram *program);
@@ -121,7 +115,7 @@ private:
mutable bool m_haveCached;
mutable int m_cachedRadius;
- mutable QPixmapBlurFilter::BlurHint m_hint;
+ mutable Qt::RenderHint m_hint;
};
extern QGLWidget *qt_gl_share_widget();
@@ -137,67 +131,26 @@ QPixmapFilter *QGL2PaintEngineEx::pixmapFilter(int type, const QPixmapFilter *pr
case QPixmapFilter::BlurFilter: {
const QPixmapBlurFilter *proto = static_cast<const QPixmapBlurFilter *>(prototype);
- if (proto->blurHint() == QPixmapBlurFilter::PerformanceHint || proto->radius() <= 5) {
+ if (proto->blurHint() == Qt::PerformanceHint || proto->radius() <= 5) {
if (!d->fastBlurFilter)
- d->fastBlurFilter.reset(new QGLPixmapBlurFilter(QPixmapBlurFilter::PerformanceHint));
+ d->fastBlurFilter.reset(new QGLPixmapBlurFilter(Qt::PerformanceHint));
return d->fastBlurFilter.data();
}
if (!d->blurFilter)
- d->blurFilter.reset(new QGLPixmapBlurFilter(QPixmapBlurFilter::QualityHint));
+ d->blurFilter.reset(new QGLPixmapBlurFilter(Qt::QualityHint));
return d->blurFilter.data();
}
-#ifndef QT_OPENGL_ES_2
case QPixmapFilter::ConvolutionFilter:
if (!d->convolutionFilter)
d->convolutionFilter.reset(new QGLPixmapConvolutionFilter);
return d->convolutionFilter.data();
-#endif
default: break;
}
return QPaintEngineEx::pixmapFilter(type, prototype);
}
-#ifndef QT_OPENGL_ES_2 // XXX: needs to be ported
-
-extern void qt_add_rect_to_array(const QRectF &r, q_vertexType *array);
-extern void qt_add_texcoords_to_array(qreal x1, qreal y1, qreal x2, qreal y2, q_vertexType *array);
-
-static void qgl_drawTexture(const QRectF &rect, int tx_width, int tx_height, const QRectF & src)
-{
-#ifndef QT_OPENGL_ES
- glPushAttrib(GL_CURRENT_BIT);
-#endif
- qreal x1, x2, y1, y2;
-
- x1 = src.x() / tx_width;
- x2 = x1 + src.width() / tx_width;
- y1 = 1.0 - ((src.y() / tx_height) + (src.height() / tx_height));
- y2 = 1.0 - (src.y() / tx_height);
-
- q_vertexType vertexArray[4*2];
- q_vertexType texCoordArray[4*2];
-
- qt_add_rect_to_array(rect, vertexArray);
- qt_add_texcoords_to_array(x1, y2, x2, y1, texCoordArray);
-
- glVertexPointer(2, q_vertexTypeEnum, 0, vertexArray);
- glTexCoordPointer(2, q_vertexTypeEnum, 0, texCoordArray);
-
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- glDisableClientState(GL_VERTEX_ARRAY);
-
-#ifndef QT_OPENGL_ES
- glPopAttrib();
-#endif
-}
-
-#endif // !QT_OPENGL_ES_2
-
static const char *qt_gl_colorize_filter =
"uniform lowp vec4 colorizeColor;"
"uniform lowp float colorizeStrength;"
@@ -231,102 +184,88 @@ void QGLPixmapColorizeFilter::setUniforms(QGLShaderProgram *program)
program->setUniformValue("colorizeStrength", float(strength()));
}
-#ifndef QT_OPENGL_ES_2
+void QGLPixmapConvolutionFilter::setUniforms(QGLShaderProgram *program)
+{
+ const qreal *kernel = convolutionKernel();
+ int kernelWidth = columns();
+ int kernelHeight = rows();
+ int kernelSize = kernelWidth * kernelHeight;
+
+ QVarLengthArray<GLfloat> matrix(kernelSize);
+ QVarLengthArray<GLfloat> offset(kernelSize * 2);
+
+ for(int i = 0; i < kernelSize; ++i)
+ matrix[i] = kernel[i];
+
+ for(int y = 0; y < kernelHeight; ++y) {
+ for(int x = 0; x < kernelWidth; ++x) {
+ offset[(y * kernelWidth + x) * 2] = x - (kernelWidth / 2);
+ offset[(y * kernelWidth + x) * 2 + 1] = (kernelHeight / 2) - y;
+ }
+ }
+
+ const qreal iw = 1.0 / m_srcSize.width();
+ const qreal ih = 1.0 / m_srcSize.height();
+ program->setUniformValue("inv_texture_size", iw, ih);
+ program->setUniformValueArray("matrix", matrix.constData(), kernelSize, 1);
+ program->setUniformValueArray("offset", offset.constData(), kernelSize, 2);
+}
// generates convolution filter code for arbitrary sized kernel
QByteArray QGLPixmapConvolutionFilter::generateConvolutionShader() const {
QByteArray code;
- code.append("uniform sampler2D texture;\n"
- "uniform vec2 inv_texture_size;\n"
- "uniform float matrix[");
- code.append(QByteArray::number(m_kernelWidth * m_kernelHeight));
- code.append("];\n"
- "vec2 offset[");
- code.append(QByteArray::number(m_kernelWidth*m_kernelHeight));
+ int kernelWidth = columns();
+ int kernelHeight = rows();
+ int kernelSize = kernelWidth * kernelHeight;
+ code.append("uniform highp vec2 inv_texture_size;\n"
+ "uniform mediump float matrix[");
+ code.append(QByteArray::number(kernelSize));
code.append("];\n"
- "void main(void) {\n");
-
- for(int y = 0; y < m_kernelHeight; y++) {
- for(int x = 0; x < m_kernelWidth; x++) {
- code.append(" offset[");
- code.append(QByteArray::number(y * m_kernelWidth + x));
- code.append("] = vec2(inv_texture_size.x * ");
- code.append(QByteArray::number(x-(int)(m_kernelWidth/2)));
- code.append(".0, inv_texture_size.y * ");
- code.append(QByteArray::number((int)(m_kernelHeight/2)-y));
- code.append(".0);\n");
- }
- }
+ "uniform highp vec2 offset[");
+ code.append(QByteArray::number(kernelSize));
+ code.append("];\n");
+ code.append("lowp vec4 customShader(lowp sampler2D src, highp vec2 srcCoords) {\n");
code.append(" int i = 0;\n"
- " vec2 coords = gl_TexCoord[0].st;\n"
- " vec4 sum = vec4(0.0);\n"
+ " lowp vec4 sum = vec4(0.0);\n"
" for (i = 0; i < ");
- code.append(QByteArray::number(m_kernelWidth * m_kernelHeight));
+ code.append(QByteArray::number(kernelSize));
code.append("; i++) {\n"
- " vec4 tmp = texture2D(texture,coords+offset[i]);\n"
- " sum += matrix[i] * tmp;\n"
+ " sum += matrix[i] * texture2D(src,srcCoords+inv_texture_size*offset[i]);\n"
" }\n"
- " gl_FragColor = sum;\n"
+ " return sum;\n"
"}");
return code;
}
QGLPixmapConvolutionFilter::QGLPixmapConvolutionFilter()
- : m_program(0)
- , m_scaleUniform(0)
- , m_matrixUniform(0)
- , m_kernelWidth(0)
- , m_kernelHeight(0)
+ : m_prevKernelSize(-1)
{
}
QGLPixmapConvolutionFilter::~QGLPixmapConvolutionFilter()
{
- delete m_program;
}
-bool QGLPixmapConvolutionFilter::processGL(QPainter *, const QPointF &pos, const QPixmap &src, const QRectF &srcRect) const
+bool QGLPixmapConvolutionFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &srcRect) const
{
- QRectF target = (srcRect.isNull() ? QRectF(src.rect()) : srcRect).translated(pos);
-
- bindTexture(src);
-#ifdef GL_CLAMP
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
-#endif
- if (!m_program || m_kernelWidth != columns() || m_kernelHeight != rows()) {
- delete m_program;
-
- m_kernelWidth = columns();
- m_kernelHeight = rows();
-
- QByteArray code = generateConvolutionShader();
- m_program = new QGLShaderProgram();
- m_program->addShader(QGLShader::FragmentShader, code);
- m_program->link();
- m_scaleUniform = m_program->uniformLocation("inv_texture_size");
- m_matrixUniform = m_program->uniformLocation("matrix");
+ QGLPixmapConvolutionFilter *filter = const_cast<QGLPixmapConvolutionFilter *>(this);
+
+ m_srcSize = src.size();
+
+ int kernelSize = rows() * columns();
+ if (m_prevKernelSize == -1 || m_prevKernelSize != kernelSize) {
+ filter->setSource(generateConvolutionShader());
+ m_prevKernelSize = kernelSize;
}
- const qreal *kernel = convolutionKernel();
- GLfloat *conv = new GLfloat[m_kernelWidth * m_kernelHeight];
- for(int i = 0; i < m_kernelWidth * m_kernelHeight; ++i)
- conv[i] = kernel[i];
-
- const qreal iw = 1.0 / src.width();
- const qreal ih = 1.0 / src.height();
- m_program->enable();
- m_program->setUniformValue(m_scaleUniform, iw, ih);
- m_program->setUniformValueArray(m_matrixUniform, conv, m_kernelWidth * m_kernelHeight, 1);
-
- qgl_drawTexture(target, src.width(), src.height(), boundingRectFor(srcRect));
- m_program->disable();
+ filter->setOnPainter(painter);
+ painter->drawPixmap(pos, src, srcRect);
+ filter->removeFromPainter(painter);
+
return true;
}
-#endif // !QT_OPENGL_ES_2
-
static const char *qt_gl_blur_filter_fast =
"const int samples = 9;"
"uniform mediump vec2 delta;"
@@ -340,12 +279,12 @@ static const char *qt_gl_blur_filter_fast =
" return color * (1.0 / float(samples));"
"}";
-QGLPixmapBlurFilter::QGLPixmapBlurFilter(QPixmapBlurFilter::BlurHint hint)
+QGLPixmapBlurFilter::QGLPixmapBlurFilter(Qt::RenderHint hint)
: m_haveCached(false)
, m_cachedRadius(5)
, m_hint(hint)
{
- if (hint == PerformanceHint) {
+ if (hint == Qt::PerformanceHint) {
QGLPixmapBlurFilter *filter = const_cast<QGLPixmapBlurFilter *>(this);
filter->setSource(qt_gl_blur_filter_fast);
m_haveCached = true;
@@ -357,7 +296,7 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const
QGLPixmapBlurFilter *filter = const_cast<QGLPixmapBlurFilter *>(this);
int radius = this->radius();
- if (!m_haveCached || (m_hint == QualityHint && radius != m_cachedRadius)) {
+ if (!m_haveCached || (m_hint == Qt::QualityHint && radius != m_cachedRadius)) {
// Only regenerate the shader from source if parameters have changed.
m_haveCached = true;
m_cachedRadius = radius;
@@ -419,7 +358,7 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const
void QGLPixmapBlurFilter::setUniforms(QGLShaderProgram *program)
{
- if (m_hint == QualityHint) {
+ if (m_hint == Qt::QualityHint) {
if (m_horizontalBlur)
program->setUniformValue("delta", 1.0 / m_textureSize.width(), 0.0);
else
diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp
index bd3883a..a904064 100644
--- a/src/opengl/qpaintengine_opengl.cpp
+++ b/src/opengl/qpaintengine_opengl.cpp
@@ -4791,22 +4791,6 @@ void QGLGlyphCache::cacheGlyphs(QGLContext *context, const QTextItemInt &ti,
}
QImage glyph_im(ti.fontEngine->alphaMapForGlyph(glyphs[i]));
-
- // The QPF implementation of alphaMapForGlyph() uses the color
- // RGBA = (value, value, value, 255) instead of the color
- // RGBA = (0, 0, 0, value) that the other font engines use.
- // We modify the image colors to rectify this situation.
- QFontEngine::Type type = ti.fontEngine->type();
- if (type == QFontEngine::QPF1 || type == QFontEngine::QPF2) {
- if (glyph_im.format() == QImage::Format_Indexed8) {
- for (int i = 0; i < 256; ++i)
- glyph_im.setColor(i, qRgba(0, 0, 0, i));
- } else if (glyph_im.format() == QImage::Format_Mono) {
- glyph_im.setColor(0, qRgba(0, 0, 0, 0));
- glyph_im.setColor(1, qRgba(0, 0, 0, 255));
- }
- }
-
glyph_im = glyph_im.convertToFormat(QImage::Format_Indexed8);
glyph_width = glyph_im.width();
Q_ASSERT(glyph_width >= 0);
diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp
index 3558c28..b129164 100644
--- a/src/openvg/qpaintengine_vg.cpp
+++ b/src/openvg/qpaintengine_vg.cpp
@@ -3023,20 +3023,6 @@ void QVGFontGlyphCache::cacheGlyphs
VGImage vgImage = VG_INVALID_HANDLE;
metrics = ti.fontEngine->boundingBox(glyph);
if (!scaledImage.isNull()) { // Not a space character
- // The QPF implementation of alphaMapForGlyph() uses the color
- // RGBA = (value, value, value, 255) instead of the color
- // RGBA = (0, 0, 0, value) that the other font engines use.
- // We modify the image colors to rectify this situation.
- QFontEngine::Type type = ti.fontEngine->type();
- if (type == QFontEngine::QPF1 || type == QFontEngine::QPF2) {
- if (scaledImage.format() == QImage::Format_Indexed8) {
- for (int i = 0; i < 256; ++i)
- scaledImage.setColor(i, qRgba(0, 0, 0, i));
- } else if (scaledImage.format() == QImage::Format_Mono) {
- scaledImage.setColor(0, qRgba(0, 0, 0, 0));
- scaledImage.setColor(1, qRgba(0, 0, 0, 255));
- }
- }
if (scaledImage.format() == QImage::Format_Indexed8) {
vgImage = vgCreateImage(VG_A_8, scaledImage.width(), scaledImage.height(), VG_IMAGE_QUALITY_FASTER);
vgImageSubData(vgImage, scaledImage.bits(), scaledImage.bytesPerLine(), VG_A_8, 0, 0, scaledImage.width(), scaledImage.height());
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
index 043189e..a9ae72c 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
@@ -1249,7 +1249,7 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device *
dbg << dev << "of type" << dev->devType();
}
- dbg << QString("transformationType 0x%1").arg(transformationType, 3, 16, QLatin1Char('0'))
+ dbg << QString::fromLatin1("transformationType 0x%1").arg(transformationType, 3, 16, QLatin1Char('0'))
<< "simplePen" << simplePen
<< "clipType" << clipType
<< "compositionModeStatus" << compositionModeStatus;
diff --git a/src/plugins/phonon/mmf/mmf.pro b/src/plugins/phonon/mmf/mmf.pro
new file mode 100644
index 0000000..ff27ea1
--- /dev/null
+++ b/src/plugins/phonon/mmf/mmf.pro
@@ -0,0 +1,4 @@
+TEMPLATE = subdirs
+SUBDIRS = mmfphonondebug plugin
+
+plugin.depends = mmfphonondebug
diff --git a/src/plugins/phonon/mmf/mmfphonondebug/mmfphonondebug.pro b/src/plugins/phonon/mmf/mmfphonondebug/mmfphonondebug.pro
new file mode 100644
index 0000000..2cfec15
--- /dev/null
+++ b/src/plugins/phonon/mmf/mmfphonondebug/mmfphonondebug.pro
@@ -0,0 +1,31 @@
+TEMPLATE = lib
+TARGET = phonon_mmf_debug
+OBJECTDUMP_DIR = $$QT_SOURCE_TREE/src/3rdparty/phonon/mmf/mmfphonondebug
+
+CONFIG += staticlib
+
+DEFINES += OBJECTDUMP_LIBRARY
+
+HEADERS += \
+ $$OBJECTDUMP_DIR/objectdump_global.h \
+ $$OBJECTDUMP_DIR/objectdump.h \
+ $$OBJECTDUMP_DIR/objecttree.h
+
+SOURCES += \
+ $$OBJECTDUMP_DIR/objectdump.cpp \
+ $$OBJECTDUMP_DIR/objecttree.cpp
+
+symbian {
+ HEADERS += $$OBJECTDUMP_DIR/objectdump_symbian.h
+ SOURCES += $$OBJECTDUMP_DIR/objectdump_symbian.cpp
+
+ LIBS += -lcone
+ LIBS += -lws32
+
+ TARGET.CAPABILITY = all -tcb
+
+} else {
+ SOURCES += $$OBJECTDUMP_DIR/objectdump_stub.cpp
+}
+
+TARGET.UID3=0x2001E62A
diff --git a/src/plugins/phonon/mmf/plugin/plugin.pro b/src/plugins/phonon/mmf/plugin/plugin.pro
new file mode 100644
index 0000000..eb7fd27
--- /dev/null
+++ b/src/plugins/phonon/mmf/plugin/plugin.pro
@@ -0,0 +1,88 @@
+# MMF Phonon backend
+
+QT += phonon
+TARGET = phonon_mmf
+PHONON_MMF_DIR = $$QT_SOURCE_TREE/src/3rdparty/phonon/mmf
+
+# Uncomment the following line in order to use the CDrmPlayerUtility client
+# API for audio playback, rather than CMdaAudioPlayerUtility.
+#CONFIG += phonon_mmf_audio_drm
+
+phonon_mmf_audio_drm {
+ LIBS += -lDrmAudioPlayUtility
+ DEFINES += QT_PHONON_MMF_AUDIO_DRM
+} else {
+ LIBS += -lmediaclientaudio
+}
+
+# This is necessary because both epoc32/include and Phonon contain videoplayer.h.
+# By making /epoc32/include the first SYSTEMINCLUDE, we ensure that
+# '#include <videoplayer.h>' picks up the Symbian header, as intended.
+PREPEND_INCLUDEPATH = /epoc32/include
+
+INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
+
+HEADERS += \
+ $$PHONON_MMF_DIR/abstractaudioeffect.h \
+ $$PHONON_MMF_DIR/abstractmediaplayer.h \
+ $$PHONON_MMF_DIR/abstractplayer.h \
+ $$PHONON_MMF_DIR/audiooutput.h \
+ $$PHONON_MMF_DIR/audioequalizer.h \
+ $$PHONON_MMF_DIR/audioplayer.h \
+ $$PHONON_MMF_DIR/backend.h \
+ $$PHONON_MMF_DIR/bassboost.h \
+ $$PHONON_MMF_DIR/defs.h \
+ $$PHONON_MMF_DIR/dummyplayer.h \
+ $$PHONON_MMF_DIR/effectfactory.h \
+ $$PHONON_MMF_DIR/mmf_medianode.h \
+ $$PHONON_MMF_DIR/mediaobject.h \
+ $$PHONON_MMF_DIR/utils.h \
+ $$PHONON_MMF_DIR/videooutput.h \
+ $$PHONON_MMF_DIR/videooutputobserver.h \
+ $$PHONON_MMF_DIR/mmf_videoplayer.h \
+ $$PHONON_MMF_DIR/videowidget.h \
+ $$PHONON_MMF_DIR/volumeobserver.h
+
+SOURCES += \
+ $$PHONON_MMF_DIR/abstractaudioeffect.cpp \
+ $$PHONON_MMF_DIR/abstractmediaplayer.cpp \
+ $$PHONON_MMF_DIR/abstractplayer.cpp \
+ $$PHONON_MMF_DIR/audiooutput.cpp \
+ $$PHONON_MMF_DIR/audioequalizer.cpp \
+ $$PHONON_MMF_DIR/audioplayer.cpp \
+ $$PHONON_MMF_DIR/backend.cpp \
+ $$PHONON_MMF_DIR/bassboost.cpp \
+ $$PHONON_MMF_DIR/dummyplayer.cpp \
+ $$PHONON_MMF_DIR/effectfactory.cpp \
+ $$PHONON_MMF_DIR/mmf_medianode.cpp \
+ $$PHONON_MMF_DIR/mediaobject.cpp \
+ $$PHONON_MMF_DIR/utils.cpp \
+ $$PHONON_MMF_DIR/videooutput.cpp \
+ $$PHONON_MMF_DIR/mmf_videoplayer.cpp \
+ $$PHONON_MMF_DIR/videowidget.cpp
+
+debug {
+ INCLUDEPATH += $$PHONON_MMF_DIR/mmfphonondebug
+ LIBS += -lphonon_mmf_debug.lib
+ LIBS += -lhal
+}
+
+LIBS += -lmediaclientvideo # For CVideoPlayerUtility
+LIBS += -lcone # For CCoeEnv
+LIBS += -lws32 # For RWindow
+LIBS += -lefsrv # For file server
+LIBS += -lapgrfx -lapmime # For recognizer
+
+# These are for effects.
+LIBS += -lAudioEqualizerEffect -lBassBoostEffect -lDistanceAttenuationEffect -lDopplerBase -lEffectBase -lEnvironmentalReverbEffect -lListenerDopplerEffect -lListenerLocationEffect -lListenerOrientationEffect -lLocationBase -lLoudnessEffect -lOrientationBase -lSourceDopplerEffect -lSourceLocationEffect -lSourceOrientationEffect -lStereoWideningEffect
+
+# This is needed for having the .qtplugin file properly created on Symbian.
+QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/phonon_backend
+
+target.path = $$[QT_INSTALL_PLUGINS]/phonon_backend
+INSTALLS += target
+
+include(../../../qpluginbase.pri)
+
+TARGET.UID3=0x2001E629
+
diff --git a/src/plugins/phonon/phonon.pro b/src/plugins/phonon/phonon.pro
index e43a4c2..814a062 100644
--- a/src/plugins/phonon/phonon.pro
+++ b/src/plugins/phonon/phonon.pro
@@ -7,3 +7,4 @@ mac:contains(QT_CONFIG, phonon-backend): SUBDIRS *= qt7
win32:!wince*:contains(QT_CONFIG, phonon-backend): SUBDIRS *= ds9
wince*:contains(QT_CONFIG, phonon-backend): SUBDIRS *= waveout
wince*:contains(QT_CONFIG, directshow): SUBDIRS *= ds9
+symbian:contains(QT_CONFIG, phonon-backend): SUBDIRS *= mmf
diff --git a/src/s60installs/qt.iby b/src/s60installs/qt.iby
index dc9ec43..3a7f008 100644
--- a/src/s60installs/qt.iby
+++ b/src/s60installs/qt.iby
@@ -71,6 +71,9 @@ file=ABI_DIR\BUILD_DIR\qtwcodecs.dll SHARED_LIB_DIR\qtwcodecs.dll PAG
// iconengines
file=ABI_DIR\BUILD_DIR\qsvgicon.dll SHARED_LIB_DIR\qsvgicon.dll PAGED
+// Phonon MMF backend
+file=ABI_DIR\BUILD_DIR\phonon_mmf.dll SHARED_LIB_DIR\phonon_mmf.dll PAGED
+
// graphicssystems
file=ABI_DIR\BUILD_DIR\qvggraphicssystem.dll SHARED_LIB_DIR\qvggraphicssystem.dll PAGED
@@ -93,6 +96,9 @@ data=\epoc32\winscw\c\resource\qt\plugins\codecs\qtwcodecs.qtplugin res
// iconengines stubs
data=\epoc32\winscw\c\resource\qt\plugins\iconengines\qsvgicon.qtplugin resource\qt\plugins\iconengines\qsvgicon.qtplugin
+// Phonon MMF backend
+data=\epoc32\winscw\c\resource\qt\plugins\phonon_backend\phonon_mmf.qtplugin resource\qt\plugins\phonon_backend\phonon_mmf.qtplugin
+
// graphicssystems
data=\epoc32\winscw\c\resource\qt\plugins\graphicssystems\qvggraphicssystem.qtplugin resource\qt\plugins\graphicssystems\qvggraphicssystem.qtplugin
diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro
index 2bf64e3..d21c524 100644
--- a/src/s60installs/s60installs.pro
+++ b/src/s60installs/s60installs.pro
@@ -73,6 +73,13 @@ symbian: {
codecs_plugins.sources = qcncodecs.dll qjpcodecs.dll qtwcodecs.dll qkrcodecs.dll
codecs_plugins.path = $$QT_PLUGINS_BASE_DIR/codecs
+ contains(QT_CONFIG, phonon-backend) {
+ phonon_backend_plugins.sources += phonon_mmf.dll
+
+ phonon_backend_plugins.path = $$QT_PLUGINS_BASE_DIR/phonon_backend
+ DEPLOYMENT += phonon_backend_plugins
+ }
+
DEPLOYMENT += qtresources qtlibraries imageformats_plugins codecs_plugins graphicssystems_plugins
contains(QT_CONFIG, svg): {
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index ee25239..9604fff 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -1606,6 +1606,9 @@ QScriptValue QScriptEngine::newFunction(QScriptEngine::FunctionSignature fun,
}
#ifndef QT_NO_REGEXP
+
+extern QString qt_regexp_toCanonical(const QString &, QRegExp::PatternSyntax);
+
/*!
Creates a QtScript object of class RegExp with the given
\a regexp.
@@ -1620,7 +1623,6 @@ QScriptValue QScriptEngine::newRegExp(const QRegExp &regexp)
JSC::ArgList args(buf, sizeof(buf));
//convert the pattern to a ECMAScript pattern
- extern QString qt_regexp_toCanonical(const QString &, QRegExp::PatternSyntax);
QString pattern = qt_regexp_toCanonical(regexp.pattern(), regexp.patternSyntax());
if (regexp.isMinimal()) {
QString ecmaPattern;
diff --git a/src/script/api/qscriptvalue.h b/src/script/api/qscriptvalue.h
index 2bc89bd..32f7a43 100644
--- a/src/script/api/qscriptvalue.h
+++ b/src/script/api/qscriptvalue.h
@@ -216,9 +216,9 @@ public:
private:
// force compile error, prevent QScriptValue(bool) to be called
- inline QScriptValue(void *);
+ QScriptValue(void *);
// force compile error, prevent QScriptValue(QScriptEngine*, bool) to be called
- inline QScriptValue(QScriptEngine *, void *);
+ QScriptValue(QScriptEngine *, void *);
QScriptValue(QScriptValuePrivate*);
diff --git a/src/script/script.pro b/src/script/script.pro
index 6c6b701..008c556 100644
--- a/src/script/script.pro
+++ b/src/script/script.pro
@@ -62,6 +62,14 @@ DEFINES += WTF_USE_JAVASCRIPTCORE_BINDINGS=1 WTF_CHANGES=1
DEFINES += NDEBUG
+solaris-g++:isEqual(QT_ARCH,sparc) {
+ CONFIG -= separate_debug_info
+ CONFIG += no_debug_info
+}
+
+# Avoid JSC C API functions being exported.
+DEFINES += JS_EXPORT="" JS_EXPORTDATA=""
+
INCLUDEPATH += $$PWD
include(script.pri)
diff --git a/src/scripttools/debugging/qscriptbreakpointsmodel.cpp b/src/scripttools/debugging/qscriptbreakpointsmodel.cpp
index 82a7c6a..40acebb 100644
--- a/src/scripttools/debugging/qscriptbreakpointsmodel.cpp
+++ b/src/scripttools/debugging/qscriptbreakpointsmodel.cpp
@@ -47,6 +47,7 @@
#include "private/qabstractitemmodel_p.h"
#include <QtCore/qpair.h>
+#include <QtCore/qcoreapplication.h>
#include <QtGui/qicon.h>
#include <QtCore/qdebug.h>
@@ -451,17 +452,17 @@ QVariant QScriptBreakpointsModel::headerData(int section, Qt::Orientation orient
if (orient == Qt::Horizontal) {
if (role == Qt::DisplayRole) {
if (section == 0)
- return QObject::tr("ID");
+ return QCoreApplication::translate("QScriptBreakpointsModel", "ID");
else if (section == 1)
- return QObject::tr("Location");
+ return QCoreApplication::translate("QScriptBreakpointsModel", "Location");
else if (section == 2)
- return QObject::tr("Condition");
+ return QCoreApplication::translate("QScriptBreakpointsModel", "Condition");
else if (section == 3)
- return QObject::tr("Ignore-count");
+ return QCoreApplication::translate("QScriptBreakpointsModel", "Ignore-count");
else if (section == 4)
- return QObject::tr("Single-shot");
+ return QCoreApplication::translate("QScriptBreakpointsModel", "Single-shot");
else if (section == 5)
- return QObject::tr("Hit-count");
+ return QCoreApplication::translate("QScriptBreakpointsModel", "Hit-count");
}
}
return QVariant();
diff --git a/src/scripttools/debugging/qscriptbreakpointswidget.cpp b/src/scripttools/debugging/qscriptbreakpointswidget.cpp
index 356c6d5..688c7c8 100644
--- a/src/scripttools/debugging/qscriptbreakpointswidget.cpp
+++ b/src/scripttools/debugging/qscriptbreakpointswidget.cpp
@@ -78,7 +78,7 @@ public:
toolClose = new QToolButton(this);
toolClose->setIcon(QIcon(QString::fromUtf8(":/qt/scripttools/debugging/images/%1/closetab.png").arg(system)));
toolClose->setAutoRaise(true);
- toolClose->setText(QObject::tr("Close"));
+ toolClose->setText(tr("Close"));
hboxLayout->addWidget(toolClose);
fileNameEdit = new QLineEdit();
@@ -295,13 +295,13 @@ QScriptBreakpointsWidget::QScriptBreakpointsWidget(QWidget *parent)
QIcon newBreakpointIcon;
newBreakpointIcon.addPixmap(d->pixmap(QString::fromLatin1("new.png")), QIcon::Normal);
- QAction *newBreakpointAction = new QAction(newBreakpointIcon, QObject::tr("New"), this);
+ QAction *newBreakpointAction = new QAction(newBreakpointIcon, tr("New"), this);
QObject::connect(newBreakpointAction, SIGNAL(triggered()),
this, SLOT(_q_newBreakpoint()));
QIcon deleteBreakpointIcon;
deleteBreakpointIcon.addPixmap(d->pixmap(QString::fromLatin1("delete.png")), QIcon::Normal);
- d->deleteBreakpointAction = new QAction(deleteBreakpointIcon, QObject::tr("Delete"), this);
+ d->deleteBreakpointAction = new QAction(deleteBreakpointIcon, tr("Delete"), this);
d->deleteBreakpointAction->setEnabled(false);
QObject::connect(d->deleteBreakpointAction, SIGNAL(triggered()),
this, SLOT(_q_deleteBreakpoint()));
diff --git a/src/scripttools/debugging/qscriptdebugger.cpp b/src/scripttools/debugging/qscriptdebugger.cpp
index c09e494..58d707f 100644
--- a/src/scripttools/debugging/qscriptdebugger.cpp
+++ b/src/scripttools/debugging/qscriptdebugger.cpp
@@ -882,8 +882,8 @@ void QScriptDebuggerPrivate::_q_goToLine()
if (!view)
return;
bool ok = false;
- int lineNumber = QInputDialog::getInteger(0, QObject::tr("Go to Line"),
- QObject::tr("Line:"),
+ int lineNumber = QInputDialog::getInteger(0, QScriptDebugger::tr("Go to Line"),
+ QScriptDebugger::tr("Line:"),
view->cursorLineNumber(),
1, INT_MAX, 1, &ok);
if (ok)
@@ -1674,9 +1674,9 @@ QAction *QScriptDebugger::interruptAction(QObject *parent) const
interruptIcon.addPixmap(d->pixmap(QString::fromLatin1("interrupt.png")), QIcon::Normal);
interruptIcon.addPixmap(d->pixmap(QString::fromLatin1("d_interrupt.png")), QIcon::Disabled);
QScriptDebugger *that = const_cast<QScriptDebugger*>(this);
- that->d_func()->interruptAction = new QAction(interruptIcon, QObject::tr("Interrupt"), parent);
+ that->d_func()->interruptAction = new QAction(interruptIcon, QScriptDebugger::tr("Interrupt"), parent);
d->interruptAction->setEnabled(!d->interactive);
- d->interruptAction->setShortcut(QObject::tr("Shift+F5"));
+ d->interruptAction->setShortcut(QScriptDebugger::tr("Shift+F5"));
QObject::connect(d->interruptAction, SIGNAL(triggered()),
that, SLOT(_q_interrupt()));
}
@@ -1691,9 +1691,9 @@ QAction *QScriptDebugger::continueAction(QObject *parent) const
continueIcon.addPixmap(d->pixmap(QString::fromLatin1("play.png")), QIcon::Normal);
continueIcon.addPixmap(d->pixmap(QString::fromLatin1("d_play.png")), QIcon::Disabled);
QScriptDebugger *that = const_cast<QScriptDebugger*>(this);
- that->d_func()->continueAction = new QAction(continueIcon, QObject::tr("Continue"), parent);
+ that->d_func()->continueAction = new QAction(continueIcon, QScriptDebugger::tr("Continue"), parent);
d->continueAction->setEnabled(d->interactive);
- d->continueAction->setShortcut(QObject::tr("F5"));
+ d->continueAction->setShortcut(QScriptDebugger::tr("F5"));
QObject::connect(d->continueAction, SIGNAL(triggered()),
that, SLOT(_q_continue()));
}
@@ -1708,9 +1708,9 @@ QAction *QScriptDebugger::stepIntoAction(QObject *parent) const
stepIntoIcon.addPixmap(d->pixmap(QString::fromLatin1("stepinto.png")), QIcon::Normal);
stepIntoIcon.addPixmap(d->pixmap(QString::fromLatin1("d_stepinto.png")), QIcon::Disabled);
QScriptDebugger *that = const_cast<QScriptDebugger*>(this);
- that->d_func()->stepIntoAction = new QAction(stepIntoIcon, QObject::tr("Step Into"), parent);
+ that->d_func()->stepIntoAction = new QAction(stepIntoIcon, QScriptDebugger::tr("Step Into"), parent);
d->stepIntoAction->setEnabled(d->interactive);
- d->stepIntoAction->setShortcut(QObject::tr("F11"));
+ d->stepIntoAction->setShortcut(QScriptDebugger::tr("F11"));
QObject::connect(d->stepIntoAction, SIGNAL(triggered()),
that, SLOT(_q_stepInto()));
}
@@ -1725,9 +1725,9 @@ QAction *QScriptDebugger::stepOverAction(QObject *parent) const
stepOverIcon.addPixmap(d->pixmap(QString::fromLatin1("stepover.png")), QIcon::Normal);
stepOverIcon.addPixmap(d->pixmap(QString::fromLatin1("d_stepover.png")), QIcon::Disabled);
QScriptDebugger *that = const_cast<QScriptDebugger*>(this);
- that->d_func()->stepOverAction = new QAction(stepOverIcon, QObject::tr("Step Over"), parent);
+ that->d_func()->stepOverAction = new QAction(stepOverIcon, QScriptDebugger::tr("Step Over"), parent);
d->stepOverAction->setEnabled(d->interactive);
- d->stepOverAction->setShortcut(QObject::tr("F10"));
+ d->stepOverAction->setShortcut(QScriptDebugger::tr("F10"));
QObject::connect(d->stepOverAction, SIGNAL(triggered()),
that, SLOT(_q_stepOver()));
}
@@ -1742,9 +1742,9 @@ QAction *QScriptDebugger::stepOutAction(QObject *parent) const
stepOutIcon.addPixmap(d->pixmap(QString::fromLatin1("stepout.png")), QIcon::Normal);
stepOutIcon.addPixmap(d->pixmap(QString::fromLatin1("d_stepout.png")), QIcon::Disabled);
QScriptDebugger *that = const_cast<QScriptDebugger*>(this);
- that->d_func()->stepOutAction = new QAction(stepOutIcon, QObject::tr("Step Out"), parent);
+ that->d_func()->stepOutAction = new QAction(stepOutIcon, QScriptDebugger::tr("Step Out"), parent);
d->stepOutAction->setEnabled(d->interactive);
- d->stepOutAction->setShortcut(QObject::tr("Shift+F11"));
+ d->stepOutAction->setShortcut(QScriptDebugger::tr("Shift+F11"));
QObject::connect(d->stepOutAction, SIGNAL(triggered()),
that, SLOT(_q_stepOut()));
}
@@ -1759,9 +1759,9 @@ QAction *QScriptDebugger::runToCursorAction(QObject *parent) const
runToCursorIcon.addPixmap(d->pixmap(QString::fromLatin1("runtocursor.png")), QIcon::Normal);
runToCursorIcon.addPixmap(d->pixmap(QString::fromLatin1("d_runtocursor.png")), QIcon::Disabled);
QScriptDebugger *that = const_cast<QScriptDebugger*>(this);
- that->d_func()->runToCursorAction = new QAction(runToCursorIcon, QObject::tr("Run to Cursor"), parent);
+ that->d_func()->runToCursorAction = new QAction(runToCursorIcon, QScriptDebugger::tr("Run to Cursor"), parent);
d->runToCursorAction->setEnabled(d->interactive);
- d->runToCursorAction->setShortcut(QObject::tr("Ctrl+F10"));
+ d->runToCursorAction->setShortcut(QScriptDebugger::tr("Ctrl+F10"));
QObject::connect(d->runToCursorAction, SIGNAL(triggered()),
that, SLOT(_q_runToCursor()));
}
@@ -1777,7 +1777,7 @@ QAction *QScriptDebugger::runToNewScriptAction(QObject *parent) const
runToNewScriptIcon.addPixmap(d->pixmap(QString::fromLatin1("d_breakonscriptload.png")), QIcon::Disabled);
QScriptDebugger *that = const_cast<QScriptDebugger*>(this);
that->d_func()->runToNewScriptAction = new QAction(runToNewScriptIcon,
- QObject::tr("Run to New Script"), parent);
+ QScriptDebugger::tr("Run to New Script"), parent);
d->runToNewScriptAction->setEnabled(d->interactive);
QObject::connect(d->runToNewScriptAction, SIGNAL(triggered()),
that, SLOT(_q_runToNewScript()));
@@ -1792,8 +1792,8 @@ QAction *QScriptDebugger::toggleBreakpointAction(QObject *parent) const
QIcon toggleBreakpointIcon;
QScriptDebugger *that = const_cast<QScriptDebugger*>(this);
that->d_func()->toggleBreakpointAction = new QAction(toggleBreakpointIcon,
- QObject::tr("Toggle Breakpoint"), parent);
- d->toggleBreakpointAction->setShortcut(QObject::tr("F9"));
+ QScriptDebugger::tr("Toggle Breakpoint"), parent);
+ d->toggleBreakpointAction->setShortcut(QScriptDebugger::tr("F9"));
d->toggleBreakpointAction->setEnabled((d->codeWidget != 0) && (d->codeWidget->currentView() != 0));
QObject::connect(d->toggleBreakpointAction, SIGNAL(triggered()),
that, SLOT(_q_toggleBreakpoint()));
@@ -1807,7 +1807,7 @@ QAction *QScriptDebugger::clearDebugOutputAction(QObject *parent) const
if (!d->clearDebugOutputAction) {
QIcon clearDebugOutputIcon;
QScriptDebugger *that = const_cast<QScriptDebugger*>(this);
- that->d_func()->clearDebugOutputAction = new QAction(clearDebugOutputIcon, QObject::tr("Clear Debug Output"), parent);
+ that->d_func()->clearDebugOutputAction = new QAction(clearDebugOutputIcon, QScriptDebugger::tr("Clear Debug Output"), parent);
QObject::connect(d->clearDebugOutputAction, SIGNAL(triggered()),
that, SLOT(_q_clearDebugOutput()));
}
@@ -1820,7 +1820,7 @@ QAction *QScriptDebugger::clearErrorLogAction(QObject *parent) const
if (!d->clearErrorLogAction) {
QIcon clearErrorLogIcon;
QScriptDebugger *that = const_cast<QScriptDebugger*>(this);
- that->d_func()->clearErrorLogAction = new QAction(clearErrorLogIcon, QObject::tr("Clear Error Log"), parent);
+ that->d_func()->clearErrorLogAction = new QAction(clearErrorLogIcon, QScriptDebugger::tr("Clear Error Log"), parent);
QObject::connect(d->clearErrorLogAction, SIGNAL(triggered()),
that, SLOT(_q_clearErrorLog()));
}
@@ -1833,7 +1833,7 @@ QAction *QScriptDebugger::clearConsoleAction(QObject *parent) const
if (!d->clearConsoleAction) {
QIcon clearConsoleIcon;
QScriptDebugger *that = const_cast<QScriptDebugger*>(this);
- that->d_func()->clearConsoleAction = new QAction(clearConsoleIcon, QObject::tr("Clear Console"), parent);
+ that->d_func()->clearConsoleAction = new QAction(clearConsoleIcon, QScriptDebugger::tr("Clear Console"), parent);
QObject::connect(d->clearConsoleAction, SIGNAL(triggered()),
that, SLOT(_q_clearConsole()));
}
@@ -1847,8 +1847,8 @@ QAction *QScriptDebugger::findInScriptAction(QObject *parent) const
QIcon findInScriptIcon;
findInScriptIcon.addPixmap(d->pixmap(QString::fromLatin1("find.png")), QIcon::Normal);
QScriptDebugger *that = const_cast<QScriptDebugger*>(this);
- that->d_func()->findInScriptAction = new QAction(findInScriptIcon, QObject::tr("&Find in Script..."), parent);
- d->findInScriptAction->setShortcut(QObject::tr("Ctrl+F"));
+ that->d_func()->findInScriptAction = new QAction(findInScriptIcon, QScriptDebugger::tr("&Find in Script..."), parent);
+ d->findInScriptAction->setShortcut(QScriptDebugger::tr("Ctrl+F"));
d->findInScriptAction->setEnabled(
(d->codeFinderWidget != 0)
&& (d->codeWidget != 0)
@@ -1865,9 +1865,9 @@ QAction *QScriptDebugger::findNextInScriptAction(QObject *parent) const
if (!d->findNextInScriptAction) {
QIcon findNextInScriptIcon;
QScriptDebugger *that = const_cast<QScriptDebugger*>(this);
- that->d_func()->findNextInScriptAction = new QAction(findNextInScriptIcon, QObject::tr("Find &Next"), parent);
+ that->d_func()->findNextInScriptAction = new QAction(findNextInScriptIcon, QScriptDebugger::tr("Find &Next"), parent);
d->findNextInScriptAction->setEnabled(d->codeFinderWidget && !d->codeFinderWidget->text().isEmpty());
- d->findNextInScriptAction->setShortcut(QObject::tr("F3"));
+ d->findNextInScriptAction->setShortcut(QScriptDebugger::tr("F3"));
QObject::connect(d->findNextInScriptAction, SIGNAL(triggered()),
that, SLOT(_q_findNextInScript()));
}
@@ -1880,9 +1880,9 @@ QAction *QScriptDebugger::findPreviousInScriptAction(QObject *parent) const
if (!d->findPreviousInScriptAction) {
QIcon findPreviousInScriptIcon;
QScriptDebugger *that = const_cast<QScriptDebugger*>(this);
- that->d_func()->findPreviousInScriptAction = new QAction(findPreviousInScriptIcon, QObject::tr("Find &Previous"), parent);
+ that->d_func()->findPreviousInScriptAction = new QAction(findPreviousInScriptIcon, QScriptDebugger::tr("Find &Previous"), parent);
d->findPreviousInScriptAction->setEnabled(d->codeFinderWidget && !d->codeFinderWidget->text().isEmpty());
- d->findPreviousInScriptAction->setShortcut(QObject::tr("Shift+F3"));
+ d->findPreviousInScriptAction->setShortcut(QScriptDebugger::tr("Shift+F3"));
QObject::connect(d->findPreviousInScriptAction, SIGNAL(triggered()),
that, SLOT(_q_findPreviousInScript()));
}
@@ -1895,8 +1895,8 @@ QAction *QScriptDebugger::goToLineAction(QObject *parent) const
if (!d->goToLineAction) {
QIcon goToLineIcon;
QScriptDebugger *that = const_cast<QScriptDebugger*>(this);
- that->d_func()->goToLineAction = new QAction(goToLineIcon, QObject::tr("Go to Line"), parent);
- d->goToLineAction->setShortcut(QObject::tr("Ctrl+G"));
+ that->d_func()->goToLineAction = new QAction(goToLineIcon, QScriptDebugger::tr("Go to Line"), parent);
+ d->goToLineAction->setShortcut(QScriptDebugger::tr("Ctrl+G"));
d->goToLineAction->setEnabled((d->codeWidget != 0) && (d->codeWidget->currentView() != 0));
QObject::connect(d->goToLineAction, SIGNAL(triggered()),
that, SLOT(_q_goToLine()));
@@ -1907,7 +1907,7 @@ QAction *QScriptDebugger::goToLineAction(QObject *parent) const
QMenu *QScriptDebugger::createStandardMenu(QWidget *widgetParent, QObject *actionParent)
{
QMenu *menu = new QMenu(widgetParent);
- menu->setTitle(QObject::tr("Debug"));
+ menu->setTitle(QScriptDebugger::tr("Debug"));
menu->addAction(action(ContinueAction, actionParent));
menu->addAction(action(InterruptAction, actionParent));
menu->addAction(action(StepIntoAction, actionParent));
diff --git a/src/scripttools/debugging/qscriptdebuggercodefinderwidget.cpp b/src/scripttools/debugging/qscriptdebuggercodefinderwidget.cpp
index 5ef5a0c..8ed0aaa 100644
--- a/src/scripttools/debugging/qscriptdebuggercodefinderwidget.cpp
+++ b/src/scripttools/debugging/qscriptdebuggercodefinderwidget.cpp
@@ -138,7 +138,7 @@ QScriptDebuggerCodeFinderWidget::QScriptDebuggerCodeFinderWidget(QWidget *parent
d->toolClose = new QToolButton(this);
d->toolClose->setIcon(QIcon(QString::fromUtf8(":/qt/scripttools/debugging/images/%1/closetab.png").arg(system)));
d->toolClose->setAutoRaise(true);
- d->toolClose->setText(QObject::tr("Close"));
+ d->toolClose->setText(tr("Close"));
hboxLayout->addWidget(d->toolClose);
d->editFind = new QLineEdit(this);
diff --git a/src/scripttools/debugging/qscriptdebuggerlocalsmodel.cpp b/src/scripttools/debugging/qscriptdebuggerlocalsmodel.cpp
index 15d43f4..9caefce 100644
--- a/src/scripttools/debugging/qscriptdebuggerlocalsmodel.cpp
+++ b/src/scripttools/debugging/qscriptdebuggerlocalsmodel.cpp
@@ -53,6 +53,7 @@
#include "private/qabstractitemmodel_p.h"
#include <QtCore/qdebug.h>
+#include <QtCore/qcoreapplication.h>
#include <QtGui/qbrush.h>
#include <QtGui/qfont.h>
@@ -868,9 +869,9 @@ QVariant QScriptDebuggerLocalsModel::headerData(int section, Qt::Orientation ori
if (orient == Qt::Horizontal) {
if (role == Qt::DisplayRole) {
if (section == 0)
- return QObject::tr("Name");
+ return QCoreApplication::translate("QScriptDebuggerLocalsModel", "Name");
else if (section == 1)
- return QObject::tr("Value");
+ return QCoreApplication::translate("QScriptDebuggerLocalsModel", "Value");
}
}
return QVariant();
diff --git a/src/scripttools/debugging/qscriptdebuggerstackmodel.cpp b/src/scripttools/debugging/qscriptdebuggerstackmodel.cpp
index a63ea73..2d56e17 100644
--- a/src/scripttools/debugging/qscriptdebuggerstackmodel.cpp
+++ b/src/scripttools/debugging/qscriptdebuggerstackmodel.cpp
@@ -45,6 +45,7 @@
#include <QtScript/qscriptcontextinfo.h>
#include <QtCore/qfileinfo.h>
+#include <QtCore/qcoreapplication.h>
QT_BEGIN_NAMESPACE
@@ -157,11 +158,11 @@ QVariant QScriptDebuggerStackModel::headerData(int section, Qt::Orientation orie
return QVariant();
if (role == Qt::DisplayRole) {
if (section == 0)
- return QObject::tr("Level");
+ return QCoreApplication::translate("QScriptDebuggerStackModel", "Level");
else if (section == 1)
- return QObject::tr("Name");
+ return QCoreApplication::translate("QScriptDebuggerStackModel", "Name");
else if (section == 2)
- return QObject::tr("Location");
+ return QCoreApplication::translate("QScriptDebuggerStackModel", "Location");
}
return QVariant();
}
diff --git a/src/scripttools/debugging/qscriptedit.cpp b/src/scripttools/debugging/qscriptedit.cpp
index 8db9cea..7f0a5e0 100644
--- a/src/scripttools/debugging/qscriptedit.cpp
+++ b/src/scripttools/debugging/qscriptedit.cpp
@@ -408,14 +408,14 @@ void QScriptEdit::extraAreaMouseEvent(QMouseEvent *e)
return;
bool has = m_breakpoints.contains(lineNumber);
QMenu *popup = new QMenu();
- QAction *toggleAct = new QAction(QObject::tr("Toggle Breakpoint"), popup);
+ QAction *toggleAct = new QAction(tr("Toggle Breakpoint"), popup);
popup->addAction(toggleAct);
- QAction *disableAct = new QAction(QObject::tr("Disable Breakpoint"), popup);
- QAction *enableAct = new QAction(QObject::tr("Enable Breakpoint"), popup);
+ QAction *disableAct = new QAction(tr("Disable Breakpoint"), popup);
+ QAction *enableAct = new QAction(tr("Enable Breakpoint"), popup);
QWidget *conditionWidget = new QWidget();
{
QHBoxLayout *hbox = new QHBoxLayout(conditionWidget);
- hbox->addWidget(new QLabel(QObject::tr("Breakpoint Condition:")));
+ hbox->addWidget(new QLabel(tr("Breakpoint Condition:")));
hbox->addWidget(new QLineEdit());
}
// QWidgetAction *conditionAct = new QWidgetAction(popup);
diff --git a/src/scripttools/debugging/qscriptenginedebugger.cpp b/src/scripttools/debugging/qscriptenginedebugger.cpp
index 7456da0..915d511 100644
--- a/src/scripttools/debugging/qscriptenginedebugger.cpp
+++ b/src/scripttools/debugging/qscriptenginedebugger.cpp
@@ -520,43 +520,43 @@ QMainWindow *QScriptEngineDebugger::standardWindow() const
QMainWindow *win = new QMainWindow();
QDockWidget *scriptsDock = new QDockWidget(win);
scriptsDock->setObjectName(QLatin1String("qtscriptdebugger_scriptsDockWidget"));
- scriptsDock->setWindowTitle(QObject::tr("Loaded Scripts"));
+ scriptsDock->setWindowTitle(tr("Loaded Scripts"));
scriptsDock->setWidget(widget(ScriptsWidget));
win->addDockWidget(Qt::LeftDockWidgetArea, scriptsDock);
QDockWidget *breakpointsDock = new QDockWidget(win);
breakpointsDock->setObjectName(QLatin1String("qtscriptdebugger_breakpointsDockWidget"));
- breakpointsDock->setWindowTitle(QObject::tr("Breakpoints"));
+ breakpointsDock->setWindowTitle(tr("Breakpoints"));
breakpointsDock->setWidget(widget(BreakpointsWidget));
win->addDockWidget(Qt::LeftDockWidgetArea, breakpointsDock);
QDockWidget *stackDock = new QDockWidget(win);
stackDock->setObjectName(QLatin1String("qtscriptdebugger_stackDockWidget"));
- stackDock->setWindowTitle(QObject::tr("Stack"));
+ stackDock->setWindowTitle(tr("Stack"));
stackDock->setWidget(widget(StackWidget));
win->addDockWidget(Qt::RightDockWidgetArea, stackDock);
QDockWidget *localsDock = new QDockWidget(win);
localsDock->setObjectName(QLatin1String("qtscriptdebugger_localsDockWidget"));
- localsDock->setWindowTitle(QObject::tr("Locals"));
+ localsDock->setWindowTitle(tr("Locals"));
localsDock->setWidget(widget(LocalsWidget));
win->addDockWidget(Qt::RightDockWidgetArea, localsDock);
QDockWidget *consoleDock = new QDockWidget(win);
consoleDock->setObjectName(QLatin1String("qtscriptdebugger_consoleDockWidget"));
- consoleDock->setWindowTitle(QObject::tr("Console"));
+ consoleDock->setWindowTitle(tr("Console"));
consoleDock->setWidget(widget(ConsoleWidget));
win->addDockWidget(Qt::BottomDockWidgetArea, consoleDock);
QDockWidget *debugOutputDock = new QDockWidget(win);
debugOutputDock->setObjectName(QLatin1String("qtscriptdebugger_debugOutputDockWidget"));
- debugOutputDock->setWindowTitle(QObject::tr("Debug Output"));
+ debugOutputDock->setWindowTitle(tr("Debug Output"));
debugOutputDock->setWidget(widget(DebugOutputWidget));
win->addDockWidget(Qt::BottomDockWidgetArea, debugOutputDock);
QDockWidget *errorLogDock = new QDockWidget(win);
errorLogDock->setObjectName(QLatin1String("qtscriptdebugger_errorLogDockWidget"));
- errorLogDock->setWindowTitle(QObject::tr("Error Log"));
+ errorLogDock->setWindowTitle(tr("Error Log"));
errorLogDock->setWidget(widget(ErrorLogWidget));
win->addDockWidget(Qt::BottomDockWidgetArea, errorLogDock);
@@ -568,14 +568,14 @@ QMainWindow *QScriptEngineDebugger::standardWindow() const
#ifndef QT_NO_MENUBAR
win->menuBar()->addMenu(that->createStandardMenu(win));
- QMenu *editMenu = win->menuBar()->addMenu(QObject::tr("Search"));
+ QMenu *editMenu = win->menuBar()->addMenu(tr("Search"));
editMenu->addAction(action(FindInScriptAction));
editMenu->addAction(action(FindNextInScriptAction));
editMenu->addAction(action(FindPreviousInScriptAction));
editMenu->addSeparator();
editMenu->addAction(action(GoToLineAction));
- QMenu *viewMenu = win->menuBar()->addMenu(QObject::tr("View"));
+ QMenu *viewMenu = win->menuBar()->addMenu(tr("View"));
viewMenu->addAction(scriptsDock->toggleViewAction());
viewMenu->addAction(breakpointsDock->toggleViewAction());
viewMenu->addAction(stackDock->toggleViewAction());
@@ -593,7 +593,7 @@ QMainWindow *QScriptEngineDebugger::standardWindow() const
widget(CodeFinderWidget)->hide();
win->setCentralWidget(central);
- win->setWindowTitle(QObject::tr("Qt Script Debugger"));
+ win->setWindowTitle(tr("Qt Script Debugger"));
win->setUnifiedTitleAndToolBarOnMac(true);
QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp
index 7cf5e8b..ff9458b 100644
--- a/src/sql/drivers/odbc/qsql_odbc.cpp
+++ b/src/sql/drivers/odbc/qsql_odbc.cpp
@@ -127,7 +127,7 @@ class QODBCPrivate
{
public:
QODBCPrivate(QODBCDriverPrivate *dpp)
- : hStmt(0), useSchema(false), hasSQLFetchScroll(true), driverPrivate(dpp)
+ : hStmt(0), useSchema(false), hasSQLFetchScroll(true), driverPrivate(dpp), userForwardOnly(false)
{
unicode = false;
}
@@ -148,6 +148,7 @@ public:
int disconnectCount;
bool hasSQLFetchScroll;
QODBCDriverPrivate *driverPrivate;
+ bool userForwardOnly;
bool isStmtHandleValid(const QSqlDriver *driver);
void updateStmtHandleState(const QSqlDriver *driver);
@@ -848,7 +849,7 @@ bool QODBCResult::reset (const QString& query)
d->updateStmtHandleState(driver());
- if (isForwardOnly()) {
+ if (d->userForwardOnly) {
r = SQLSetStmtAttr(d->hStmt,
SQL_ATTR_CURSOR_TYPE,
(SQLPOINTER)SQL_CURSOR_FORWARD_ONLY,
@@ -885,7 +886,7 @@ bool QODBCResult::reset (const QString& query)
SQLINTEGER isScrollable, bufferLength;
r = SQLGetStmtAttr(d->hStmt, SQL_ATTR_CURSOR_SCROLLABLE, &isScrollable, SQL_IS_INTEGER, &bufferLength);
if(r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO)
- setForwardOnly(isScrollable==SQL_NONSCROLLABLE);
+ QSqlResult::setForwardOnly(isScrollable==SQL_NONSCROLLABLE);
SQLSMALLINT count;
SQLNumResultCols(d->hStmt, &count);
@@ -1194,7 +1195,7 @@ bool QODBCResult::prepare(const QString& query)
d->updateStmtHandleState(driver());
- if (isForwardOnly()) {
+ if (d->userForwardOnly) {
r = SQLSetStmtAttr(d->hStmt,
SQL_ATTR_CURSOR_TYPE,
(SQLPOINTER)SQL_CURSOR_FORWARD_ONLY,
@@ -1508,7 +1509,7 @@ bool QODBCResult::exec()
SQLINTEGER isScrollable, bufferLength;
r = SQLGetStmtAttr(d->hStmt, SQL_ATTR_CURSOR_SCROLLABLE, &isScrollable, SQL_IS_INTEGER, &bufferLength);
if(r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO)
- setForwardOnly(isScrollable==SQL_NONSCROLLABLE);
+ QSqlResult::setForwardOnly(isScrollable==SQL_NONSCROLLABLE);
SQLSMALLINT count;
SQLNumResultCols(d->hStmt, &count);
@@ -1639,6 +1640,12 @@ void QODBCResult::virtual_hook(int id, void *data)
}
}
+void QODBCResult::setForwardOnly(bool forward)
+{
+ d->userForwardOnly = forward;
+ QSqlResult::setForwardOnly(forward);
+}
+
////////////////////////////////////////
diff --git a/src/sql/drivers/odbc/qsql_odbc.h b/src/sql/drivers/odbc/qsql_odbc.h
index d8a3b69..8bd7660 100644
--- a/src/sql/drivers/odbc/qsql_odbc.h
+++ b/src/sql/drivers/odbc/qsql_odbc.h
@@ -100,6 +100,7 @@ public:
bool exec();
QVariant handle() const;
+ virtual void setForwardOnly(bool forward);
protected:
bool fetchNext();
diff --git a/src/sql/drivers/tds/qsql_tds.cpp b/src/sql/drivers/tds/qsql_tds.cpp
index 46508a0..2508833 100644
--- a/src/sql/drivers/tds/qsql_tds.cpp
+++ b/src/sql/drivers/tds/qsql_tds.cpp
@@ -754,7 +754,9 @@ QString QTDSDriver::formatValue(const QSqlField &field,
r = QLatin1String("NULL");
else if (field.type() == QVariant::DateTime) {
if (field.value().toDateTime().isValid()){
- r = field.value().toDateTime().toString(QLatin1String("'yyyyMMdd hh:mm:ss'"));
+ r = field.value().toDateTime().toString(QLatin1String("yyyyMMdd hh:mm:ss"));
+ r.prepend(QLatin1String("'"));
+ r.append(QLatin1String("'"));
} else
r = QLatin1String("NULL");
} else if (field.type() == QVariant::ByteArray) {
@@ -805,4 +807,15 @@ QSqlIndex QTDSDriver::primaryIndex(const QString& tablename) const
return idx;
}
+QString QTDSDriver::escapeIdentifier(const QString &identifier, IdentifierType type) const
+{
+ QString res = identifier;
+ if(!identifier.isEmpty() && !identifier.startsWith(QLatin1Char('"')) && !identifier.endsWith(QLatin1Char('"')) ) {
+ res.replace(QLatin1Char('"'), QLatin1String("\"\""));
+ res.prepend(QLatin1Char('"')).append(QLatin1Char('"'));
+ res.replace(QLatin1Char('.'), QLatin1String("\".\""));
+ }
+ return res;
+}
+
QT_END_NAMESPACE
diff --git a/src/sql/drivers/tds/qsql_tds.h b/src/sql/drivers/tds/qsql_tds.h
index 6001106..0ceae6d 100644
--- a/src/sql/drivers/tds/qsql_tds.h
+++ b/src/sql/drivers/tds/qsql_tds.h
@@ -116,6 +116,8 @@ public:
bool trimStrings) const;
QVariant handle() const;
+ QString escapeIdentifier(const QString &identifier, IdentifierType type) const;
+
protected:
bool beginTransaction();
bool commitTransaction();
diff --git a/src/testlib/qtestsystem.h b/src/testlib/qtestsystem.h
index a9a2193..8caec76 100644
--- a/src/testlib/qtestsystem.h
+++ b/src/testlib/qtestsystem.h
@@ -75,6 +75,7 @@ namespace QTest
{
#if defined(Q_WS_X11)
qt_x11_wait_for_window_manager(window);
+ QCoreApplication::processEvents();
#elif defined(Q_WS_QWS)
Q_UNUSED(window);
qWait(100);
diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp
index 3ae91d3..b06fbeb 100644
--- a/src/xml/dom/qdom.cpp
+++ b/src/xml/dom/qdom.cpp
@@ -6438,22 +6438,23 @@ void QDomDocumentPrivate::saveDocument(QTextStream& s, const int indent, QDomNod
#ifndef QT_NO_TEXTCODEC
const QDomNodePrivate* n = first;
+ QTextCodec *codec = 0;
+
if (n && n->isProcessingInstruction() && n->nodeName() == QLatin1String("xml")) {
// we have an XML declaration
QString data = n->nodeValue();
QRegExp encoding(QString::fromLatin1("encoding\\s*=\\s*((\"([^\"]*)\")|('([^']*)'))"));
encoding.indexIn(data);
QString enc = encoding.cap(3);
- if (enc.isEmpty()) {
- enc = encoding.cap(5);
- }
if (enc.isEmpty())
- s.setCodec(QTextCodec::codecForName("UTF-8"));
- else
- s.setCodec(QTextCodec::codecForName(enc.toLatin1().data()));
- } else {
- s.setCodec(QTextCodec::codecForName("UTF-8"));
+ enc = encoding.cap(5);
+ if (!enc.isEmpty())
+ codec = QTextCodec::codecForName(enc.toLatin1().data());
}
+ if (!codec)
+ codec = QTextCodec::codecForName("UTF-8");
+ if (codec)
+ s.setCodec(codec);
#endif
bool doc = false;
diff --git a/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp b/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp
index 10318f1..0980777 100644
--- a/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp
+++ b/src/xmlpatterns/schema/qxsdvalidatinginstancereader.cpp
@@ -455,7 +455,7 @@ bool XsdValidatingInstanceReader::validateElement(const XsdElement::Ptr &declara
const QString value = attribute(m_xsiNilName);
const Boolean::Ptr nil = Boolean::fromLexical(value);
if (nil->hasError()) {
- error(QtXmlPatterns::tr("attribute %1 contains invalid data: %1").arg(formatKeyword(QLatin1String("nil"))).arg(formatData(value)));
+ error(QtXmlPatterns::tr("attribute %1 contains invalid data: %2").arg(formatKeyword(QLatin1String("nil"))).arg(formatData(value)));
return false;
}