diff options
Diffstat (limited to 'src/3rdparty')
26 files changed, 557 insertions, 367 deletions
diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp index 2fdb092..af2c31e 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp @@ -376,20 +376,20 @@ void MMF::AbstractMediaPlayer::changeState(PrivateState newState) 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(); - } - } + 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(); } @@ -400,7 +400,7 @@ void MMF::AbstractMediaPlayer::changeState(PrivateState newState) void MMF::AbstractMediaPlayer::tick() { - // For the MWC compiler, we need to qualify the base class. + // For the MWC compiler, we need to qualify the base class. emit MMF::AbstractPlayer::tick(currentTime()); } diff --git a/src/3rdparty/phonon/mmf/abstractplayer.h b/src/3rdparty/phonon/mmf/abstractplayer.h index ec39ab1..08558cf 100644 --- a/src/3rdparty/phonon/mmf/abstractplayer.h +++ b/src/3rdparty/phonon/mmf/abstractplayer.h @@ -87,7 +87,7 @@ public: // VolumeObserver virtual void volumeChanged(qreal volume); - + void setVideoOutput(VideoOutput* videoOutput); /** @@ -146,9 +146,9 @@ private: protected: // Not owned VideoOutput* m_videoOutput; - + qreal m_volume; - + private: PrivateState m_state; Phonon::ErrorType m_error; diff --git a/src/3rdparty/phonon/mmf/audioplayer.cpp b/src/3rdparty/phonon/mmf/audioplayer.cpp index ceaf305..1d259a8 100644 --- a/src/3rdparty/phonon/mmf/audioplayer.cpp +++ b/src/3rdparty/phonon/mmf/audioplayer.cpp @@ -213,8 +213,8 @@ void MMF::AudioPlayer::MapcPlayComplete(TInt aError) } /* - if(aError == KErrNone) { - if(m_nextSource.type() == MediaSource::Empty) { + if (aError == KErrNone) { + if (m_nextSource.type() == MediaSource::Empty) { emit finished(); } else { setSource(m_nextSource); diff --git a/src/3rdparty/phonon/mmf/mediaobject.cpp b/src/3rdparty/phonon/mmf/mediaobject.cpp index 76db5cb..29ac2df 100644 --- a/src/3rdparty/phonon/mmf/mediaobject.cpp +++ b/src/3rdparty/phonon/mmf/mediaobject.cpp @@ -112,7 +112,7 @@ MMF::MediaType MMF::MediaObject::fileMediaType MediaType result = MediaTypeUnknown; if (openRecognizer()) { - + const QHBufC fileNameSymbian(QDir::toNativeSeparators(fileName)); m_file.Close(); diff --git a/src/3rdparty/phonon/mmf/mmf_medianode.cpp b/src/3rdparty/phonon/mmf/mmf_medianode.cpp index b60d6f4..253c5e7 100644 --- a/src/3rdparty/phonon/mmf/mmf_medianode.cpp +++ b/src/3rdparty/phonon/mmf/mmf_medianode.cpp @@ -74,7 +74,7 @@ bool MMF::MediaNode::applyNodesOnMediaObject(MediaNode *) // data(length of the graph) which typically is very small. // First, we go to the very beginning of the graph. - MMF::MediaNode *current = this; + MMF::MediaNode *current = this; do { MediaNode *const candidate = current->source(); if (candidate) diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp index c7fa791..a93aca0 100644 --- a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp +++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp @@ -16,7 +16,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. */ -#include <QApplication> // for QApplication::activeWindow +#include <QApplication> // for QApplication::activeWindow #include <QUrl> #include <QTimer> #include <QWidget> @@ -27,7 +27,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include "mmf_videoplayer.h" #include "utils.h" -#ifdef _DEBUG +#ifndef QT_NO_DEBUG #include "objectdump.h" #endif @@ -45,8 +45,8 @@ using namespace Phonon::MMF; //----------------------------------------------------------------------------- MMF::VideoPlayer::VideoPlayer() - : m_wsSession(0) - , m_screenDevice(0) + : m_wsSession(CCoeEnv::Static()->WsSession()) + , m_screenDevice(*CCoeEnv::Static()->ScreenDevice()) , m_window(0) , m_totalTime(0) , m_mmfOutputChangePending(false) @@ -56,8 +56,8 @@ MMF::VideoPlayer::VideoPlayer() MMF::VideoPlayer::VideoPlayer(const AbstractPlayer& player) : AbstractMediaPlayer(player) - , m_wsSession(0) - , m_screenDevice(0) + , m_wsSession(CCoeEnv::Static()->WsSession()) + , m_screenDevice(*CCoeEnv::Static()->ScreenDevice()) , m_window(0) , m_totalTime(0) , m_mmfOutputChangePending(false) @@ -70,37 +70,37 @@ void MMF::VideoPlayer::construct() TRACE_CONTEXT(VideoPlayer::VideoPlayer, EVideoApi); TRACE_ENTRY_0(); - if(m_videoOutput) - m_videoOutput->setObserver(this); + if (m_videoOutput) + m_videoOutput->setObserver(this); const TInt priority = 0; const TMdaPriorityPreference preference = EMdaPriorityPreferenceNone; + // Ignore return value - first call must always return true 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 + + // 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) { + TRAPD(err, + m_player.reset(CVideoPlayerUtility::NewL + ( + *this, + priority, preference, + m_wsSession, m_screenDevice, + *m_window, + m_rect, m_rect + )) + ); + + if (KErrNone != err) changeState(ErrorState); - } TRACE_EXIT_0(); } @@ -120,13 +120,13 @@ MMF::VideoPlayer::~VideoPlayer() void MMF::VideoPlayer::doPlay() { TRACE_CONTEXT(VideoPlayer::doPlay, EVideoApi); - + // See comment in updateMmfOutput - if(m_mmfOutputChangePending) { + if (m_mmfOutputChangePending) { TRACE_0("MMF output change pending - pushing now"); updateMmfOutput(); } - + m_player->Play(); } @@ -149,20 +149,20 @@ void MMF::VideoPlayer::doStop() 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; + 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(); + if (KErrNone == err) { + if (wasPlaying) + doPlay(); } else { TRACE("SetPositionL error %d", err); @@ -251,15 +251,15 @@ void MMF::VideoPlayer::MvpuoPrepareComplete(TInt aError) if (KErrNone == err) { maxVolumeChanged(m_player->MaxVolume()); - if(m_videoOutput) - m_videoOutput->setFrameSize(m_frameSize); + if (m_videoOutput) + m_videoOutput->setFrameSize(m_frameSize); // See comment in updateMmfOutput - if(m_mmfOutputChangePending) { + if (m_mmfOutputChangePending) { TRACE_0("MMF output change pending - pushing now"); updateMmfOutput(); - } - + } + emit totalTimeChanged(totalTime()); changeState(StoppedState); } else { @@ -327,82 +327,91 @@ void MMF::VideoPlayer::videoOutputRegionChanged() TRACE_CONTEXT(VideoPlayer::videoOutputRegionChanged, EVideoInternal); TRACE_ENTRY("state %d", state()); - getNativeWindowSystemHandles(); + const bool changed = getNativeWindowSystemHandles(); // See comment in updateMmfOutput - if(state() == LoadingState) - m_mmfOutputChangePending = true; - else - updateMmfOutput(); - + if (changed) { + if (state() == LoadingState) + m_mmfOutputChangePending = true; + else + updateMmfOutput(); + } + TRACE_EXIT_0(); } -// DEBUGGING *** DO NOT INTEGRATE *** + +#ifndef QT_NO_DEBUG + +// The following code is for debugging problems related to video visibility. It allows +// the VideoPlayer instance to query the window server in order to determine the +// DSA drawing region for the video window. + class CDummyAO : public CActive { public: - CDummyAO() : CActive(CActive::EPriorityStandard) { CActiveScheduler::Add(this); } - void RunL() { } - void DoCancel() { } - TRequestStatus& Status() { return iStatus; } - void SetActive() { CActive::SetActive(); } + CDummyAO() : CActive(CActive::EPriorityStandard) { CActiveScheduler::Add(this); } + void RunL() { } + void DoCancel() { } + TRequestStatus& Status() { return iStatus; } + void SetActive() { CActive::SetActive(); } }; -// DEBUGGING *** DO NOT INTEGRATE *** void getDsaRegion(RWsSession &session, const RWindowBase &window) { - RDirectScreenAccess dsa(session); - TInt err = dsa.Construct(); - CDummyAO ao; - RRegion* region; - err = dsa.Request(region, ao.Status(), window); - ao.SetActive(); - dsa.Close(); - ao.Cancel(); - if(region) { - qDebug() << "Phonon::MMF::getDsaRegion count" << region->Count(); - for(int i=0; i<region->Count(); ++i) { - const TRect& rect = region->RectangleList()[i]; - qDebug() << "Phonon::MMF::getDsaRegion rect" << rect.iTl.iX << rect.iTl.iY << rect.iBr.iX << rect.iBr.iY; - } - region->Close(); - } + RDirectScreenAccess dsa(session); + TInt err = dsa.Construct(); + CDummyAO ao; + RRegion* region; + err = dsa.Request(region, ao.Status(), window); + ao.SetActive(); + dsa.Close(); + ao.Cancel(); + if (region) { + qDebug() << "Phonon::MMF::getDsaRegion count" << region->Count(); + for (int i=0; i<region->Count(); ++i) { + const TRect& rect = region->RectangleList()[i]; + qDebug() << "Phonon::MMF::getDsaRegion rect" + << rect.iTl.iX << rect.iTl.iY << rect.iBr.iX << rect.iBr.iY; + } + region->Close(); + } } +#endif // _DEBUG + void MMF::VideoPlayer::updateMmfOutput() { TRACE_CONTEXT(VideoPlayer::updateMmfOutput, EVideoInternal); TRACE_ENTRY_0(); - - // Calling SetDisplayWindowL is a no-op unless the MMF controller has + + // 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 + // need to call SetDisplayWindowL, and this is checked in // MvpuoPrepareComplete, at which point the MMF controller has been // loaded. - - getNativeWindowSystemHandles(); - -// DEBUGGING *** DO NOT INTEGRATE *** -getDsaRegion(*m_wsSession, *m_window); + +#ifndef QT_NO_DEBUG + getDsaRegion(m_wsSession, *m_window); +#endif TRAPD(err, - m_player->SetDisplayWindowL - ( - *m_wsSession, *m_screenDevice, - *m_window, - m_windowRect, m_clipRect - ) - ); + m_player->SetDisplayWindowL + ( + m_wsSession, m_screenDevice, + *m_window, + m_rect, m_rect + ) + ); if (KErrNone != err) { TRACE("SetDisplayWindowL error %d", err); setError(NormalError); } - + m_mmfOutputChangePending = false; - + TRACE_EXIT_0(); } @@ -416,9 +425,9 @@ void MMF::VideoPlayer::videoOutputChanged() TRACE_CONTEXT(VideoPlayer::videoOutputChanged, EVideoInternal); TRACE_ENTRY_0(); - if(m_videoOutput) { - m_videoOutput->setObserver(this); - m_videoOutput->setFrameSize(m_frameSize); + if (m_videoOutput) { + m_videoOutput->setObserver(this); + m_videoOutput->setFrameSize(m_frameSize); } videoOutputRegionChanged(); @@ -426,58 +435,56 @@ void MMF::VideoPlayer::videoOutputChanged() TRACE_EXIT_0(); } -void MMF::VideoPlayer::getNativeWindowSystemHandles() +bool MMF::VideoPlayer::getNativeWindowSystemHandles() { TRACE_CONTEXT(VideoPlayer::getNativeWindowSystemHandles, EVideoInternal); TRACE_ENTRY_0(); - + CCoeControl *control = 0; - - if(m_videoOutput) - // Create native window - control = m_videoOutput->winId(); + + if (m_videoOutput) + // Create native window + control = m_videoOutput->winId(); else - // Get top-level window - control = QApplication::activeWindow()->effectiveWinId(); - - CCoeEnv* const coeEnv = control->ControlEnv(); - m_wsSession = &(coeEnv->WsSession()); - m_screenDevice = coeEnv->ScreenDevice(); - m_window = control->DrawableWindow(); - -#ifdef _DEBUG - if(m_videoOutput) { - 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(*m_videoOutput); + // Get top-level window + control = QApplication::activeWindow()->effectiveWinId(); + +#ifndef QT_NO_DEBUG + if (m_videoOutput) { + 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(*m_videoOutput); } else { - TRACE_0("m_videoOutput is null - dumping top-level control info:"); - TRACE("control %08x", control); - TRACE("control.parent %08x", control->Parent()); - TRACE("control.isVisible %d", control->IsVisible()); - TRACE("control.rect %d,%d %dx%d", - control->Position().iX, control->Position().iY, - control->Size().iWidth, control->Size().iHeight); - TRACE("control.ownsWindow %d", control->OwnsWindow()); + TRACE_0("m_videoOutput is null - dumping top-level control info:"); + TRACE("control %08x", control); + TRACE("control.parent %08x", control->Parent()); + TRACE("control.isVisible %d", control->IsVisible()); + TRACE("control.rect %d,%d %dx%d", + control->Position().iX, control->Position().iY, + control->Size().iWidth, control->Size().iHeight); + TRACE("control.ownsWindow %d", control->OwnsWindow()); } #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(); + RWindowBase *const window = control->DrawableWindow(); + const TRect rect(window->AbsPosition(), window->Size()); + + TRACE("rect %d %d - %d %d", + rect.iTl.iX, rect.iTl.iY, + rect.iBr.iX, rect.iBr.iY); + + bool changed = false; + + if (window != m_window || rect != m_rect) { + m_window = window; + m_rect = rect; + changed = true; + } + + TRACE_RETURN("changed %d", changed); } diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.h b/src/3rdparty/phonon/mmf/mmf_videoplayer.h index ee3650a..8072404 100644 --- a/src/3rdparty/phonon/mmf/mmf_videoplayer.h +++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.h @@ -80,25 +80,26 @@ private: // AbstractPlayer virtual void videoOutputChanged(); - - void getNativeWindowSystemHandles(); + + // Returns true if handles have changed + bool getNativeWindowSystemHandles(); + void updateMmfOutput(); - + private: QScopedPointer<CVideoPlayerUtility> m_player; // Not owned - RWsSession* m_wsSession; - CWsScreenDevice* m_screenDevice; + RWsSession& m_wsSession; + CWsScreenDevice& m_screenDevice; RWindowBase* m_window; - TRect m_windowRect; - TRect m_clipRect; - + TRect m_rect; + QSize m_frameSize; qint64 m_totalTime; bool m_mmfOutputChangePending; - + }; } diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.cpp b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.cpp index ef2b81c..9add439 100644 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.cpp +++ b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.cpp @@ -36,7 +36,7 @@ namespace ObjectDump QAnnotator::~QAnnotator() { - + } @@ -45,53 +45,53 @@ QAnnotator::~QAnnotator() //----------------------------------------------------------------------------- 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() != "") + + if (object.objectName() != "") stream << " \"" << object.objectName() << '"'; - - if(object.isWidgetType()) + + 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) { - + if (widget) { + QByteArray array; QTextStream stream(&array); - + stream << "widget: "; - - if(widget->isVisible()) + + 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; } @@ -105,12 +105,12 @@ class QDumperBase public: QDumperBase(); ~QDumperBase(); - + void setPrefix(const QString& prefix); void addAnnotator(QAnnotator* annotator); - + protected: - QByteArray m_prefix; + QByteArray m_prefix; QList<QAnnotator*> m_annotators; }; @@ -139,7 +139,7 @@ void QDumperBase::addAnnotator(QAnnotator* annotator) // Protect against an exception occurring during QList::append QScopedPointer<QAnnotator> holder(annotator); m_annotators.append(annotator); - holder.take(); + holder.take(); } @@ -148,13 +148,13 @@ void QDumperBase::addAnnotator(QAnnotator* annotator) //----------------------------------------------------------------------------- class QDumperPrivate : public QDumperBase -{ +{ public: QDumperPrivate(); ~QDumperPrivate(); void dumpObject(const QObject& object); - + }; @@ -206,27 +206,27 @@ void QDumper::addAnnotator(QAnnotator* 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: +private: class Node { public: @@ -235,24 +235,24 @@ private: 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; + Hash m_hash; }; static const unsigned DefaultIndent = 2; @@ -274,21 +274,21 @@ void QVisitorPrivate::setIndent(unsigned indent) } // Builds up a mirror of the object tree, rooted in m_root, with each node -// storing annotations generated by +// 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) + if (nodeParent) { nodeParent->m_children.append(nodePtr.take()); } @@ -297,7 +297,7 @@ void QVisitorPrivate::visitNode(const QObject& object) Q_ASSERT(m_root.isNull()); m_root.reset(nodePtr.take()); } - + // Generate and store annotations QAnnotator* annotator; foreach(annotator, m_annotators) @@ -322,71 +322,71 @@ 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]) + if (branches[i]) stream << '|'; else stream << ' '; stream << indent; } - - if(depth) { - if(isNodeLine) + + if (depth) { + if (isNodeLine) stream << '+' << horiz; else { - if(!isLastChild) + 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) { - + for (Node::child_iterator i = begin; end != i; ++i) { + isLastChild = (end == i + 1); - - if(begin == i) + + 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) { + + if (begin == end) { // No annotations - just dump the object pointer const bool isNodeLine = true; QByteArray buffer = branchBuffer(branches, isNodeLine, isLastChild); @@ -394,7 +394,7 @@ void QVisitorPrivate::dumpNode } else { // Dump annotations - for(QList<QByteArray>::const_iterator i = begin; end != i; ++i) { + for (QList<QByteArray>::const_iterator i = begin; end != i; ++i) { const bool isNodeLine = (begin == i); QByteArray buffer = branchBuffer(branches, isNodeLine, isLastChild); buffer.append(*i); @@ -408,7 +408,7 @@ void QVisitorPrivate::dumpNode QVisitorPrivate::Node::Node() { - + } QVisitorPrivate::Node::~Node() @@ -453,7 +453,7 @@ void QVisitor::visitPrepare() } void QVisitor::visitNode(const QObject& object) -{ +{ d_func()->visitNode(object); } @@ -474,7 +474,7 @@ void addDefaultAnnotators(QDumper& dumper) { dumper.addAnnotator(new QAnnotatorBasic); dumper.addAnnotator(new QAnnotatorWidget); - + // Add platform-specific annotators addDefaultAnnotators_sys(dumper); } @@ -483,7 +483,7 @@ void addDefaultAnnotators(QVisitor& visitor) { visitor.addAnnotator(new QAnnotatorBasic); visitor.addAnnotator(new QAnnotatorWidget); - + // Add platform-specific annotators addDefaultAnnotators_sys(visitor); } @@ -492,7 +492,7 @@ 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); } @@ -505,7 +505,7 @@ void dumpTreeFromLeaf(const QObject& leaf, QVisitor& visitor) { root = root->parent(); } - + dumpTreeFromRoot(*root, visitor); } @@ -513,7 +513,7 @@ 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); } diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.h b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.h index cbd9bea..e94b3ac 100644 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.h +++ b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.h @@ -32,7 +32,7 @@ namespace ObjectDump { /** - * Abstract base for annotator classes invoked by QVisitor. + * Abstract base for annotator classes invoked by QVisitor. */ class OBJECTDUMP_EXPORT QAnnotator : public QObject { @@ -72,29 +72,29 @@ 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; - + }; @@ -107,36 +107,36 @@ 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. */ @@ -144,7 +144,7 @@ public: private: QScopedPointer<QVisitorPrivate> d_ptr; - + }; diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp index 5ae10f9..03220a7 100644 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp +++ b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp @@ -21,6 +21,8 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include <coecntrl.h> #include "objectdump_symbian.h" +#include <QtGui/private/qwidget_p.h> // to access QWExtra + QT_BEGIN_NAMESPACE namespace ObjectDump @@ -28,92 +30,118 @@ namespace ObjectDump namespace Symbian { +QList<QByteArray> QAnnotatorWidget::annotation(const QObject& object) +{ + QList<QByteArray> result; + + const QWidget* widget = qobject_cast<const QWidget*>(&object); + if (widget) { + + const QWExtra* extra = qt_widget_private(const_cast<QWidget *>(widget))->extraData(); + + if (extra) { + + QByteArray array; + QTextStream stream(&array); + + stream << "widget (Symbian): "; + stream << "activated " << extra->activated << ' '; + stream << "disableBlit " << extra->disableBlit << ' '; + + stream.flush(); + result.append(array); + } + } + + return result; +} + QList<QByteArray> QAnnotatorControl::annotation(const QObject& object) { QList<QByteArray> result; - + const QWidget* widget = qobject_cast<const QWidget*>(&object); - if(widget) { - + if (widget) { + const CCoeControl* control = widget->effectiveWinId(); - if(control) { - + if (control) { + QByteArray array; QTextStream stream(&array); - + stream << "control: " << control << ' '; stream << "parent " << control->Parent() << ' '; - - if(control->IsVisible()) + + 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()) + + 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) { - + if (widget) { + const CCoeControl* control = widget->effectiveWinId(); - if(control) { - - RDrawableWindow& window = *(control->DrawableWindow()); - + RDrawableWindow *window = 0; + + if (control && (window = control->DrawableWindow())) { + QByteArray array; QTextStream stream(&array); - + stream << "window: "; - + // ClientHandle() is available first in 5.0. #if !defined(__SERIES60_31__) && !defined(__S60_32__) if (QSysInfo::s60Version() > QSysInfo::SV_S60_3_2) - // 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()) << ' '; + // 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() << ' '; - + 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(); + // 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 << "ord " << window.OrdinalPosition(); - + + stream << "ord " << window->OrdinalPosition(); + stream.flush(); result.append(array); - } + } } - + return result; } @@ -121,12 +149,14 @@ QList<QByteArray> QAnnotatorWindow::annotation(const QObject& object) void addDefaultAnnotators_sys(QDumper& dumper) { + dumper.addAnnotator(new Symbian::QAnnotatorWidget); dumper.addAnnotator(new Symbian::QAnnotatorControl); dumper.addAnnotator(new Symbian::QAnnotatorWindow); } void addDefaultAnnotators_sys(QVisitor& visitor) { + visitor.addAnnotator(new Symbian::QAnnotatorWidget); visitor.addAnnotator(new Symbian::QAnnotatorControl); visitor.addAnnotator(new Symbian::QAnnotatorWindow); } diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.h b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.h index 26ab308..563c862 100644 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.h +++ b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.h @@ -29,6 +29,16 @@ namespace Symbian { /** + * Annotator which returns Symbian-specific widget information + */ +class QAnnotatorWidget : public QAnnotator +{ + Q_OBJECT +public: + QList<QByteArray> annotation(const QObject& object); +}; + +/** * Annotator which returns control information */ class QAnnotatorControl : public QAnnotator diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.cpp b/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.cpp index 5053b2d..bc61435 100644 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.cpp +++ b/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.cpp @@ -28,38 +28,38 @@ 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(); + 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); @@ -70,7 +70,7 @@ void DepthFirstConstIterator::backtrack() backtrack(); } } - else { + else { // Reached end of search m_pointee = 0; } @@ -80,7 +80,7 @@ void DepthFirstConstIterator::backtrack() AncestorConstIterator::AncestorConstIterator() { - + } AncestorConstIterator::AncestorConstIterator(const QObject& leaf) diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.h b/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.h index f2729fa..98bdf14 100644 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.h +++ b/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.h @@ -34,24 +34,24 @@ namespace ObjectTree */ class OBJECTDUMP_EXPORT DepthFirstConstIterator { -public: +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; @@ -62,40 +62,40 @@ private: */ class OBJECTDUMP_EXPORT AncestorConstIterator { -public: +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() */ @@ -103,8 +103,8 @@ template <class Iterator, class Visitor> void visit(Iterator begin, Iterator end, Visitor& visitor) { visitor.visitPrepare(); - - for( ; begin != end; ++begin) + + for ( ; begin != end; ++begin) visitor.visitNode(*begin); visitor.visitComplete(); diff --git a/src/3rdparty/phonon/mmf/utils.cpp b/src/3rdparty/phonon/mmf/utils.cpp index 2f5b68f..58d1ece 100644 --- a/src/3rdparty/phonon/mmf/utils.cpp +++ b/src/3rdparty/phonon/mmf/utils.cpp @@ -62,7 +62,7 @@ MMF::MediaType MMF::Utils::mimeTypeToMediaType(const TDesC& mimeType) } -#ifdef _DEBUG +#ifndef QT_NO_DEBUG #include <hal.h> #include <hal_data.h> @@ -111,7 +111,7 @@ 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) + if (err == KErrNone and pos.x() < info.width and pos.y() < info.height) { const int bytesPerPixel = info.bpp / 8; Q_ASSERT(bytesPerPixel >= 3); @@ -129,7 +129,7 @@ QColor MMF::Utils::getScreenPixel(const QPoint& pos) pixel.setGreen(*ptr++); pixel.setRed(*ptr++); - if(bytesPerPixel == 4) + if (bytesPerPixel == 4) pixel.setAlpha(*ptr++); } return pixel; @@ -138,7 +138,7 @@ QColor MMF::Utils::getScreenPixel(const QPoint& pos) // Debugging: for debugging video visibility void MMF::Utils::dumpScreenPixelSample() { - for(int i=0; i<20; ++i) { + for (int i=0; i<20; ++i) { const QPoint pos(i*10, i*10); const QColor pixel = Utils::getScreenPixel(pos); RDebug::Printf( diff --git a/src/3rdparty/phonon/mmf/utils.h b/src/3rdparty/phonon/mmf/utils.h index 38964d0..7e363e8 100644 --- a/src/3rdparty/phonon/mmf/utils.h +++ b/src/3rdparty/phonon/mmf/utils.h @@ -54,7 +54,7 @@ void panic(PanicCode code); */ MediaType mimeTypeToMediaType(const TDesC& mimeType); -#ifdef _DEBUG +#ifndef QT_NO_DEBUG /** * Retrieve color of specified pixel from the screen. */ @@ -138,16 +138,16 @@ public: #define _TRACE_MODULE Phonon::MMF // Macros available for use by implementation code -#ifdef _DEBUG +#ifndef QT_NO_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_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); } +#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() diff --git a/src/3rdparty/phonon/mmf/videooutput.cpp b/src/3rdparty/phonon/mmf/videooutput.cpp index 041b0a8..f0393a7 100644 --- a/src/3rdparty/phonon/mmf/videooutput.cpp +++ b/src/3rdparty/phonon/mmf/videooutput.cpp @@ -20,7 +20,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include "videooutput.h" #include "videooutputobserver.h" -#ifdef _DEBUG +#ifndef QT_NO_DEBUG #include "objectdump.h" #endif @@ -52,19 +52,19 @@ MMF::VideoOutput::VideoOutput(QWidget* parent) TRACE_ENTRY("parent 0x%08x", parent); setPalette(QPalette(Qt::black)); - setAttribute(Qt::WA_OpaquePaintEvent, true); - setAttribute(Qt::WA_NoSystemBackground, true); - setAutoFillBackground(false); + 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; + // 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(); } @@ -123,9 +123,7 @@ void MMF::VideoOutput::paintEvent(QPaintEvent* event) TRACE("regions %d", event->region().numRects()); TRACE("type %d", event->type()); - dump(); - - // Do not paint anything + // Do nothing } void MMF::VideoOutput::resizeEvent(QResizeEvent* event) @@ -135,10 +133,7 @@ void MMF::VideoOutput::resizeEvent(QResizeEvent* event) event->oldSize().width(), event->oldSize().height(), event->size().width(), event->size().height()); - QWidget::resizeEvent(event); - - if (m_observer) - m_observer->videoOutputRegionChanged(); + videoOutputRegionChanged(); } void MMF::VideoOutput::moveEvent(QMoveEvent* event) @@ -148,10 +143,20 @@ void MMF::VideoOutput::moveEvent(QMoveEvent* event) event->oldPos().x(), event->oldPos().y(), event->pos().x(), event->pos().y()); - QWidget::moveEvent(event); + videoOutputRegionChanged(); +} - if (m_observer) - m_observer->videoOutputRegionChanged(); +bool MMF::VideoOutput::event(QEvent* event) +{ + TRACE_CONTEXT(VideoOutput::event, EVideoInternal); + + if (event->type() == QEvent::WinIdChange) { + TRACE_0("WinIdChange"); + videoOutputRegionChanged(); + return true; + } + else + return QWidget::event(event); } @@ -159,9 +164,16 @@ void MMF::VideoOutput::moveEvent(QMoveEvent* event) // Private functions //----------------------------------------------------------------------------- -void VideoOutput::dump() const +void MMF::VideoOutput::videoOutputRegionChanged() +{ + dump(); + if (m_observer) + m_observer->videoOutputRegionChanged(); +} + +void MMF::VideoOutput::dump() const { -#ifdef _DEBUG +#ifndef QT_NO_DEBUG TRACE_CONTEXT(VideoOutput::dump, EVideoInternal); QScopedPointer<ObjectDump::QVisitor> visitor(new ObjectDump::QVisitor); visitor->setPrefix("Phonon::MMF"); // to aid searchability of logs diff --git a/src/3rdparty/phonon/mmf/videooutput.h b/src/3rdparty/phonon/mmf/videooutput.h index 639a5ed..7bc0b52 100644 --- a/src/3rdparty/phonon/mmf/videooutput.h +++ b/src/3rdparty/phonon/mmf/videooutput.h @@ -49,10 +49,12 @@ protected: void paintEvent(QPaintEvent* event); void resizeEvent(QResizeEvent* event); void moveEvent(QMoveEvent* event); + bool event(QEvent* event); private: void dump() const; - + void videoOutputRegionChanged(); + private: QSize m_frameSize; diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp index 474d7bf..01e36c4 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp @@ -240,7 +240,9 @@ void Heap::destroy() template <HeapType heapType> NEVER_INLINE CollectorBlock* Heap::allocateBlock() { -#if PLATFORM(DARWIN) + // Disable the use of vm_map for the Qt build on Darwin, because when compiled on 10.4 + // it crashes on 10.5 +#if PLATFORM(DARWIN) && !PLATFORM(QT) vm_address_t address = 0; // FIXME: tag the region as a JavaScriptCore heap when we get a registered VM tag: <rdar://problem/6054788>. vm_map(current_task(), &address, BLOCK_SIZE, BLOCK_OFFSET_MASK, VM_FLAGS_ANYWHERE | VM_TAG_FOR_COLLECTOR_MEMORY, MEMORY_OBJECT_NULL, 0, FALSE, VM_PROT_DEFAULT, VM_PROT_DEFAULT, VM_INHERIT_DEFAULT); @@ -332,7 +334,9 @@ NEVER_INLINE void Heap::freeBlock(size_t block) NEVER_INLINE void Heap::freeBlock(CollectorBlock* block) { -#if PLATFORM(DARWIN) + // Disable the use of vm_deallocate for the Qt build on Darwin, because when compiled on 10.4 + // it crashes on 10.5 +#if PLATFORM(DARWIN) && !PLATFORM(QT) vm_deallocate(current_task(), reinterpret_cast<vm_address_t>(block), BLOCK_SIZE); #elif PLATFORM(SYMBIAN) userChunk->Free(reinterpret_cast<TAny*>(block)); diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 4f7dd4f..493a64d 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,13 @@ +2009-10-09 Joe Ligman <joseph.ligman@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Added pure virtual methods setInputMethodEnabled and setInputMethodHint to QWebPageClient + + https://bugs.webkit.org/show_bug.cgi?id=30023 + + * platform/qt/QWebPageClient.h: + 2009-10-07 Janne Koskinen <janne.p.koskinen@digia.com> Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro index 1c39bb8..a0a072d 100644 --- a/src/3rdparty/webkit/WebCore/WebCore.pro +++ b/src/3rdparty/webkit/WebCore/WebCore.pro @@ -87,6 +87,19 @@ win32-g++ { QMAKE_LIBDIR_POST += $$split(TMPPATH,";") } +# Temporary workaround to pick up the DEF file from the same place as all the others +symbian { + shared { + MMP_RULES -= defBlock + + MMP_RULES += "$${LITERAL_HASH}ifdef WINSCW" \ + "DEFFILE ../../../s60installs/bwins/$${TARGET}.def" \ + "$${LITERAL_HASH}elif defined EABI" \ + "DEFFILE ../../../s60installs/eabi/$${TARGET}.def" \ + "$${LITERAL_HASH}endif" + } +} + # Assume that symbian OS always comes with sqlite symbian:!CONFIG(QTDIR_build): CONFIG += system-sqlite diff --git a/src/3rdparty/webkit/WebCore/platform/qt/QWebPageClient.h b/src/3rdparty/webkit/WebCore/platform/qt/QWebPageClient.h index 1fc29a0..37941eb 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/QWebPageClient.h +++ b/src/3rdparty/webkit/WebCore/platform/qt/QWebPageClient.h @@ -33,6 +33,10 @@ public: virtual void scroll(int dx, int dy, const QRect&) = 0; virtual void update(const QRect&) = 0; + virtual void setInputMethodEnabled(bool enable) = 0; +#if QT_VERSION >= 0x040600 + virtual void setInputMethodHint(Qt::InputMethodHint hint, bool enable) = 0; +#endif inline void resetCursor() { if (!cursor().bitmap() && cursor().shape() == m_lastCursor.shape()) diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp index 2a0ee20..b11890d 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp @@ -44,6 +44,10 @@ public: virtual void scroll(int dx, int dy, const QRect&); virtual void update(const QRect& dirtyRect); + virtual void setInputMethodEnabled(bool enable); +#if QT_VERSION >= 0x040600 + virtual void setInputMethodHint(Qt::InputMethodHint hint, bool enable); +#endif virtual QCursor cursor() const; virtual void updateCursor(const QCursor& cursor); @@ -95,6 +99,21 @@ void QGraphicsWebViewPrivate::update(const QRect & dirtyRect) q->update(QRectF(dirtyRect)); } +void QGraphicsWebViewPrivate::setInputMethodEnabled(bool enable) +{ + q->setAttribute(Qt::WA_InputMethodEnabled, enable); +} + +#if QT_VERSION >= 0x040600 +void QGraphicsWebViewPrivate::setInputMethodHint(Qt::InputMethodHint hint, bool enable) +{ + if (enable) + q->setInputMethodHints(q->inputMethodHints() | hint); + else + q->setInputMethodHints(q->inputMethodHints() & ~hint); +} +#endif + QCursor QGraphicsWebViewPrivate::cursor() const { return q->cursor(); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp index 882f3d7..41067f1 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp @@ -47,6 +47,10 @@ public: virtual void scroll(int dx, int dy, const QRect&); virtual void update(const QRect& dirtyRect); + virtual void setInputMethodEnabled(bool enable); +#if QT_VERSION >= 0x040600 + virtual void setInputMethodHint(Qt::InputMethodHint hint, bool enable); +#endif virtual QCursor cursor() const; virtual void updateCursor(const QCursor& cursor); @@ -72,6 +76,20 @@ void QWebViewPrivate::update(const QRect & dirtyRect) view->update(dirtyRect); } +void QWebViewPrivate::setInputMethodEnabled(bool enable) +{ + view->setAttribute(Qt::WA_InputMethodEnabled, enable); +} +#if QT_VERSION >= 0x040600 +void QWebViewPrivate::setInputMethodHint(Qt::InputMethodHint hint, bool enable) +{ + if (enable) + view->setInputMethodHints(view->inputMethodHints() | hint); + else + view->setInputMethodHints(view->inputMethodHints() & ~hint); +} +#endif + QCursor QWebViewPrivate::cursor() const { return view->cursor(); @@ -119,7 +137,7 @@ void QWebViewPrivate::_q_pageDestroyed() It can be used in various applications to display web content live from the Internet. - The image below shows QWebView previewed in \QD with the Trolltech website. + The image below shows QWebView previewed in \QD with a Nokia website. \image qwebview-url.png diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index 99ddaa5..85d0e4f 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,29 @@ +2009-10-09 Joe Ligman <joseph.ligman@nokia.com> + + Reviewed by Simon Hausmann. + + Sets Qt::WA_InputMethodEnabled and Qt::ImhHiddenText for password fields in EditorClientQt + setInputMethodState. This change is needed so widgets such as the s60 software + input panel can receive input method events for password fields. + It's up to the Qt platform to determine which widget will receive input method + events when these flags are set. + Also added implementation for setInputMethodEnabled and setInputMethodHint + to QGraphicsWebViewPrivate and QWebViewPrivate. This change removes the direct + dependency on QWebView and uses QWebPageClient. + Added autotest to tst_qwebpage.cpp + https://bugs.webkit.org/show_bug.cgi?id=30023 + + * Api/qgraphicswebview.cpp: + (QGraphicsWebViewPrivate::setInputMethodEnabled): + (QGraphicsWebViewPrivate::setInputMethodHint): + * Api/qwebview.cpp: + (QWebViewPrivate::setInputMethodEnabled): + (QWebViewPrivate::setInputMethodHint): + * WebCoreSupport/EditorClientQt.cpp: + (WebCore::EditorClientQt::setInputMethodState): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::inputMethods): + 2009-10-06 Janne Koskinen <janne.p.koskinen@digia.com> Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp index 5d5df97..34241f0 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp @@ -41,6 +41,7 @@ #include "FocusController.h" #include "Frame.h" #include "HTMLElement.h" +#include "HTMLInputElement.h" #include "HTMLNames.h" #include "KeyboardCodes.h" #include "KeyboardEvent.h" @@ -48,6 +49,7 @@ #include "Page.h" #include "Page.h" #include "PlatformKeyboardEvent.h" +#include "QWebPageClient.h" #include "Range.h" #include <stdio.h> @@ -596,10 +598,26 @@ bool EditorClientQt::isEditing() const void EditorClientQt::setInputMethodState(bool active) { - QWidget *view = m_page->view(); - if (view) - view->setAttribute(Qt::WA_InputMethodEnabled, active); - + QWebPageClient* webPageClient = m_page->d->client; + if (webPageClient) { +#if QT_VERSION >= 0x040600 + bool isPasswordField = false; + if (!active) { + // Setting the Qt::WA_InputMethodEnabled attribute true and Qt::ImhHiddenText flag + // for password fields. The Qt platform is responsible for determining which widget + // will receive input method events for password fields. + Frame* frame = m_page->d->page->focusController()->focusedOrMainFrame(); + if (frame && frame->document() && frame->document()->focusedNode()) { + if (frame->document()->focusedNode()->hasTagName(HTMLNames::inputTag)) { + HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(frame->document()->focusedNode()); + active = isPasswordField = inputElement->isPasswordField(); + } + } + } + webPageClient->setInputMethodHint(Qt::ImhHiddenText, isPasswordField); +#endif + webPageClient->setInputMethodEnabled(active); + } emit m_page->microFocusChanged(); } diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index 8f9a740..bdcc27f 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -1208,7 +1208,8 @@ void tst_QWebPage::frameAt() void tst_QWebPage::inputMethods() { m_view->page()->mainFrame()->setHtml("<html><body>" \ - "<input type='text' id='input1' style='font-family: serif' value='' maxlength='20'/>" \ + "<input type='text' id='input1' style='font-family: serif' value='' maxlength='20'/><br>" \ + "<input type='password'/>" \ "</body></html>"); m_view->page()->mainFrame()->setFocus(); @@ -1291,6 +1292,21 @@ void tst_QWebPage::inputMethods() value = variant.value<QString>(); QCOMPARE(value, QString("QtWebKit")); #endif + + //ImhHiddenText + QMouseEvent evpresPassword(QEvent::MouseButtonPress, inputs.at(1).geometry().center(), Qt::LeftButton, Qt::NoButton, Qt::NoModifier); + m_view->page()->event(&evpresPassword); + QMouseEvent evrelPassword(QEvent::MouseButtonRelease, inputs.at(1).geometry().center(), Qt::LeftButton, Qt::NoButton, Qt::NoModifier); + m_view->page()->event(&evrelPassword); + + QVERIFY(m_view->testAttribute(Qt::WA_InputMethodEnabled)); +#if QT_VERSION >= 0x040600 + QVERIFY(m_view->inputMethodHints() & Qt::ImhHiddenText); + + m_view->page()->event(&evpres); + m_view->page()->event(&evrel); + QVERIFY(!(m_view->inputMethodHints() & Qt::ImhHiddenText)); +#endif } // import a little DRT helper function to trigger the garbage collector |