diff options
author | axis <qt-info@nokia.com> | 2010-03-22 09:24:51 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2010-03-22 09:24:51 (GMT) |
commit | e48850c6ec90cd5eaa95d07573c2afa1a1c4f67f (patch) | |
tree | c53fa338b532c986b4baa1b481e5406f2fa16b5a /src | |
parent | 390d7f64d9afa288fb2c01fc70eddc8b1f5ff585 (diff) | |
parent | 7491a2ecfdd0fe883c72d2ee60ca72393c2990d9 (diff) | |
download | Qt-e48850c6ec90cd5eaa95d07573c2afa1a1c4f67f.zip Qt-e48850c6ec90cd5eaa95d07573c2afa1a1c4f67f.tar.gz Qt-e48850c6ec90cd5eaa95d07573c2afa1a1c4f67f.tar.bz2 |
Merge branch '4.6-s60' into 4.7-s60
Conflicts:
configure.exe
mkspecs/common/symbian/symbian.conf
src/gui/graphicsview/qgraphicswidget.h
src/gui/kernel/qapplication.cpp
src/gui/text/qtextlayout.cpp
src/openvg/qpixmapdata_vg.cpp
src/s60installs/s60installs.pro
tools/runonphone/main.cpp
tools/runonphone/serenum_unix.cpp
qtextlayout.cpp fixed up together with Eskil.
Kept the configure.exe from 4.7 without recompile.
Diffstat (limited to 'src')
76 files changed, 2466 insertions, 1403 deletions
diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp b/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp index 132eb79..6cfeb76 100644 --- a/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp +++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp @@ -20,7 +20,6 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include "abstractaudioeffect.h" #include "audioplayer.h" -#include "mmf_videoplayer.h" QT_BEGIN_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.h b/src/3rdparty/phonon/mmf/abstractaudioeffect.h index 436e8e4..d71993b 100644 --- a/src/3rdparty/phonon/mmf/abstractaudioeffect.h +++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.h @@ -28,7 +28,6 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include "audioplayer.h" #include "effectparameter.h" #include "mmf_medianode.h" -#include "mmf_videoplayer.h" class CMdaAudioOutputStream; diff --git a/src/3rdparty/phonon/mmf/abstractplayer.cpp b/src/3rdparty/phonon/mmf/abstractplayer.cpp index 53973eb..421155b 100644 --- a/src/3rdparty/phonon/mmf/abstractplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractplayer.cpp @@ -96,7 +96,7 @@ void MMF::AbstractPlayer::volumeChanged(qreal volume) // Video output //----------------------------------------------------------------------------- -void MMF::AbstractPlayer::setVideoOutput(VideoOutput* videoOutput) +void MMF::AbstractPlayer::setVideoOutput(AbstractVideoOutput* videoOutput) { m_videoOutput = videoOutput; videoOutputChanged(); diff --git a/src/3rdparty/phonon/mmf/abstractplayer.h b/src/3rdparty/phonon/mmf/abstractplayer.h index cec5568..92bd87e 100644 --- a/src/3rdparty/phonon/mmf/abstractplayer.h +++ b/src/3rdparty/phonon/mmf/abstractplayer.h @@ -24,7 +24,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include <QObject> -#include "videooutput.h" +#include "abstractvideooutput.h" class RFile; @@ -34,7 +34,6 @@ namespace Phonon { namespace MMF { -class VideoOutput; /** * @short Interface which abstracts from MediaObject the current @@ -79,7 +78,7 @@ public: virtual void volumeChanged(qreal volume); - void setVideoOutput(VideoOutput* videoOutput); + void setVideoOutput(AbstractVideoOutput *videoOutput); /** * Records error message and changes state to ErrorState @@ -156,7 +155,7 @@ private: protected: // Not owned - VideoOutput* m_videoOutput; + AbstractVideoOutput* m_videoOutput; qreal m_volume; diff --git a/src/3rdparty/phonon/mmf/abstractvideooutput.cpp b/src/3rdparty/phonon/mmf/abstractvideooutput.cpp new file mode 100644 index 0000000..3fe66fc --- /dev/null +++ b/src/3rdparty/phonon/mmf/abstractvideooutput.cpp @@ -0,0 +1,177 @@ +/* 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 "abstractvideooutput.h" +#include "utils.h" + +#ifndef QT_NO_DEBUG +#include "objectdump.h" +#endif + +#include <QtCore/private/qcore_symbian_p.h> // for qt_TSize2QSize + +#include <QMoveEvent> +#include <QResizeEvent> + +#include <coecntrl.h> + +QT_BEGIN_NAMESPACE + +using namespace Phonon; +using namespace Phonon::MMF; + +/*! \class MMF::AbstractVideoOutput + \internal +*/ + +//----------------------------------------------------------------------------- +// Constants +//----------------------------------------------------------------------------- + +static const Phonon::VideoWidget::AspectRatio DefaultAspectRatio = + Phonon::VideoWidget::AspectRatioAuto; +static const Phonon::VideoWidget::ScaleMode DefaultScaleMode = + Phonon::VideoWidget::FitInView; + + +//----------------------------------------------------------------------------- +// Constructor / destructor +//----------------------------------------------------------------------------- + +MMF::AbstractVideoOutput::AbstractVideoOutput(QWidget *parent) + : QWidget(parent) + , m_aspectRatio(DefaultAspectRatio) + , m_scaleMode(DefaultScaleMode) +{ + +} + +MMF::AbstractVideoOutput::~AbstractVideoOutput() +{ + +} + +void MMF::AbstractVideoOutput::setVideoSize(const QSize &frameSize) +{ + TRACE_CONTEXT(AbstractVideoOutput::setVideoSize, EVideoInternal); + TRACE("oldSize %d %d newSize %d %d", + m_videoFrameSize.width(), m_videoFrameSize.height(), + frameSize.width(), frameSize.height()); + + if (frameSize != m_videoFrameSize) { + m_videoFrameSize = frameSize; + updateGeometry(); + } +} + + +//----------------------------------------------------------------------------- +// QWidget +//----------------------------------------------------------------------------- + +QSize MMF::AbstractVideoOutput::sizeHint() const +{ + // TODO: replace this with a more sensible default + QSize result(320, 240); + + if (!m_videoFrameSize.isNull()) + result = m_videoFrameSize; + + return result; +} + + +//----------------------------------------------------------------------------- +// Public functions +//----------------------------------------------------------------------------- + +RWindowBase* MMF::AbstractVideoOutput::videoWindow() const +{ + CCoeControl *control = internalWinId(); + if (!control) + control = effectiveWinId(); + + RWindowBase *window = 0; + if (control) + window = control->DrawableWindow(); + + return window; +} + +QSize MMF::AbstractVideoOutput::videoWindowSize() const +{ + QSize result; + if (RWindowBase *const window = videoWindow()) + result = qt_TSize2QSize(window->Size()); + return result; +} + +Phonon::VideoWidget::AspectRatio MMF::AbstractVideoOutput::aspectRatio() const +{ + return m_aspectRatio; +} + +void MMF::AbstractVideoOutput::setAspectRatio + (Phonon::VideoWidget::AspectRatio aspectRatio) +{ + if (m_aspectRatio != aspectRatio) { + m_aspectRatio = aspectRatio; + emit aspectRatioChanged(); + } +} + +Phonon::VideoWidget::ScaleMode MMF::AbstractVideoOutput::scaleMode() const +{ + return m_scaleMode; +} + +void MMF::AbstractVideoOutput::setScaleMode + (Phonon::VideoWidget::ScaleMode scaleMode) +{ + if (m_scaleMode != scaleMode) { + m_scaleMode = scaleMode; + emit scaleModeChanged(); + } +} + + +//----------------------------------------------------------------------------- +// Private functions +//----------------------------------------------------------------------------- + +void MMF::AbstractVideoOutput::dump() const +{ +#ifndef QT_NO_DEBUG + TRACE_CONTEXT(AbstractVideoOutput::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::dumpTreeFromLeaf(*this, *visitor); + + QScopedPointer<ObjectDump::QDumper> dumper(new ObjectDump::QDumper); + dumper->setPrefix("Phonon::MMF"); // to aid searchability of logs + ObjectDump::addDefaultAnnotators(*dumper); + TRACE_0("Dumping AbstractVideoOutput:"); + dumper->dumpObject(*this); +#endif +} + +QT_END_NAMESPACE + diff --git a/src/3rdparty/phonon/mmf/videooutput.h b/src/3rdparty/phonon/mmf/abstractvideooutput.h index 3e9c036..61bcd0f 100644 --- a/src/3rdparty/phonon/mmf/videooutput.h +++ b/src/3rdparty/phonon/mmf/abstractvideooutput.h @@ -16,14 +16,15 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef PHONON_MMF_VIDEOOUTPUT_H -#define PHONON_MMF_VIDEOOUTPUT_H +#ifndef PHONON_MMF_ABSTRACTVIDEOOUTPUT_H +#define PHONON_MMF_ABSTRACTVIDEOOUTPUT_H #include <QtGui/QWidget> #include <QVector> #include <QRect> #include "defs.h" +#include <phonon/abstractvideooutput.h> #include <phonon/videowidget.h> #include <e32std.h> @@ -35,21 +36,25 @@ namespace Phonon { namespace MMF { -class AncestorMoveMonitor; -class VideoOutput : public QWidget +/** + * @short ABC for widget on which video is displayed + * + * @see DsaVideoOutput, SurfaceVideoOutput + */ +class AbstractVideoOutput + : public QWidget { Q_OBJECT public: - VideoOutput(AncestorMoveMonitor* ancestorMoveMonitor, QWidget* parent); - ~VideoOutput(); + ~AbstractVideoOutput(); // Set size of video frame. Called by VideoPlayer. - void setVideoSize(const QSize& size); + void setVideoSize(const QSize &size); - RWindowBase* videoWindow(); - const QRect& videoWindowRect() const; + RWindowBase* videoWindow() const; + QSize videoWindowSize() const; Phonon::VideoWidget::AspectRatio aspectRatio() const; void setAspectRatio(Phonon::VideoWidget::AspectRatio aspectRatio); @@ -57,41 +62,24 @@ public: Phonon::VideoWidget::ScaleMode scaleMode() const; void setScaleMode(Phonon::VideoWidget::ScaleMode scaleMode); - // Called by AncestorMoveMonitor - void ancestorMoved(); - // Debugging output void dump() const; -public Q_SLOTS: - void beginNativePaintEvent(const QRect& /*controlRect*/); - void endNativePaintEvent(const QRect& /*controlRect*/); - Q_SIGNALS: void videoWindowChanged(); void aspectRatioChanged(); void scaleModeChanged(); - void beginVideoWindowNativePaint(); - void endVideoWindowNativePaint(); protected: - // Override QWidget functions - QSize sizeHint() const; - void paintEvent(QPaintEvent* event); - void resizeEvent(QResizeEvent* event); - void moveEvent(QMoveEvent* event); - bool event(QEvent* event); + AbstractVideoOutput(QWidget *parent); private: - void getVideoWindowRect(); - void registerForAncestorMoved(); + // QWidget + QSize sizeHint() const; private: - // Not owned - AncestorMoveMonitor* m_ancestorMoveMonitor; - + // Dimensions of the video clip QSize m_videoFrameSize; - QRect m_videoWindowRect; Phonon::VideoWidget::AspectRatio m_aspectRatio; Phonon::VideoWidget::ScaleMode m_scaleMode; diff --git a/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp b/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp new file mode 100644 index 0000000..8cb9db5 --- /dev/null +++ b/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp @@ -0,0 +1,490 @@ +/* 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 "abstractvideoplayer.h" +#include "utils.h" + +#ifndef QT_NO_DEBUG +#include "objectdump.h" +#endif + +QT_BEGIN_NAMESPACE + +using namespace Phonon; +using namespace Phonon::MMF; + +/*! \class MMF::AbstractVideoPlayer + \internal +*/ + +//----------------------------------------------------------------------------- +// Constructor / destructor +//----------------------------------------------------------------------------- + +MMF::AbstractVideoPlayer::AbstractVideoPlayer(MediaObject *parent, const AbstractPlayer *player) + : AbstractMediaPlayer(parent, player) + , m_wsSession(CCoeEnv::Static()->WsSession()) + , m_screenDevice(*CCoeEnv::Static()->ScreenDevice()) + , m_window(0) + , m_scaleWidth(1.0) + , m_scaleHeight(1.0) + , m_totalTime(0) +{ + +} + +void MMF::AbstractVideoPlayer::construct() +{ + TRACE_CONTEXT(AbstractVideoPlayer::AbstractVideoPlayer, EVideoApi); + TRACE_ENTRY_0(); + + if (m_videoOutput) { + initVideoOutput(); + m_window = m_videoOutput->videoWindow(); + } + + createPlayer(); + + TRACE_EXIT_0(); +} + +MMF::AbstractVideoPlayer::~AbstractVideoPlayer() +{ + TRACE_CONTEXT(AbstractVideoPlayer::~AbstractVideoPlayer, EVideoApi); + TRACE_ENTRY_0(); + + // QObject destructor removes all signal-slot connections involving this + // object, so we do not need to disconnect from m_videoOutput here. + + TRACE_EXIT_0(); +} + +CVideoPlayerUtility* MMF::AbstractVideoPlayer::nativePlayer() const +{ + return m_player.data(); +} + +//----------------------------------------------------------------------------- +// Public API +//----------------------------------------------------------------------------- + +void MMF::AbstractVideoPlayer::doPlay() +{ + TRACE_CONTEXT(AbstractVideoPlayer::doPlay, EVideoApi); + + handlePendingParametersChanged(); + + m_player->Play(); +} + +void MMF::AbstractVideoPlayer::doPause() +{ + TRACE_CONTEXT(AbstractVideoPlayer::doPause, EVideoApi); + + TRAPD(err, m_player->PauseL()); + if (KErrNone != err && state() != ErrorState) { + TRACE("PauseL error %d", err); + setError(tr("Pause failed"), err); + } +} + +void MMF::AbstractVideoPlayer::doStop() +{ + m_player->Stop(); +} + +void MMF::AbstractVideoPlayer::doSeek(qint64 ms) +{ + TRACE_CONTEXT(AbstractVideoPlayer::doSeek, EVideoApi); + + TRAPD(err, m_player->SetPositionL(TTimeIntervalMicroSeconds(ms * 1000))); + + if (KErrNone != err) + setError(tr("Seek failed"), err); +} + +int MMF::AbstractVideoPlayer::setDeviceVolume(int mmfVolume) +{ + TRAPD(err, m_player->SetVolumeL(mmfVolume)); + return err; +} + +int MMF::AbstractVideoPlayer::openFile(RFile &file) +{ + TRAPD(err, m_player->OpenFileL(file)); + return err; +} + +int MMF::AbstractVideoPlayer::openUrl(const QString &url) +{ + TRAPD(err, m_player->OpenUrlL(qt_QString2TPtrC(url))); + return err; +} + +int MMF::AbstractVideoPlayer::bufferStatus() const +{ + int result = 0; + TRAP_IGNORE(m_player->GetVideoLoadingProgressL(result)); + return result; +} + +void MMF::AbstractVideoPlayer::close() +{ + m_player->Close(); +} + +bool MMF::AbstractVideoPlayer::hasVideo() const +{ + return true; +} + +qint64 MMF::AbstractVideoPlayer::currentTime() const +{ + TRACE_CONTEXT(AbstractVideoPlayer::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<AbstractVideoPlayer*>(this)->setError(tr("Getting position failed"), err); + } + + return result; +} + +qint64 MMF::AbstractVideoPlayer::totalTime() const +{ + return m_totalTime; +} + + +//----------------------------------------------------------------------------- +// Public slots +//----------------------------------------------------------------------------- + +void MMF::AbstractVideoPlayer::videoWindowChanged() +{ + TRACE_CONTEXT(AbstractVideoPlayer::videoOutputRegionChanged, EVideoInternal); + TRACE_ENTRY("state %d", state()); + + m_window = m_videoOutput ? m_videoOutput->videoWindow() : 0; + + handleVideoWindowChanged(); + + TRACE_EXIT_0(); +} + +void MMF::AbstractVideoPlayer::aspectRatioChanged() +{ + TRACE_CONTEXT(AbstractVideoPlayer::aspectRatioChanged, EVideoInternal); + TRACE_ENTRY("state %d aspectRatio %d", state()); + + updateScaleFactors(m_videoOutput->videoWindowSize()); + + TRACE_EXIT_0(); +} + +void MMF::AbstractVideoPlayer::scaleModeChanged() +{ + TRACE_CONTEXT(AbstractVideoPlayer::scaleModeChanged, EVideoInternal); + TRACE_ENTRY("state %d", state()); + + updateScaleFactors(m_videoOutput->videoWindowSize()); + + TRACE_EXIT_0(); +} + + +//----------------------------------------------------------------------------- +// MVideoPlayerUtilityObserver callbacks +//----------------------------------------------------------------------------- + +void MMF::AbstractVideoPlayer::MvpuoOpenComplete(TInt aError) +{ + TRACE_CONTEXT(AbstractVideoPlayer::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(tr("Opening clip failed"), aError); + + TRACE_EXIT_0(); +} + +void MMF::AbstractVideoPlayer::MvpuoPrepareComplete(TInt aError) +{ + TRACE_CONTEXT(AbstractVideoPlayer::MvpuoPrepareComplete, EVideoApi); + TRACE_ENTRY("state %d error %d", state(), aError); + + __ASSERT_ALWAYS(LoadingState == state(), Utils::panic(InvalidStatePanic)); + + TRAPD(err, getVideoClipParametersL(aError)); + + if (KErrNone == err) { + maxVolumeChanged(m_player->MaxVolume()); + + if (m_videoOutput) + m_videoOutput->setVideoSize(m_videoFrameSize); + + prepareCompleted(); + handlePendingParametersChanged(); + + emit totalTimeChanged(totalTime()); + changeState(StoppedState); + } else { + setError(tr("Buffering clip failed"), err); + } + + TRACE_EXIT_0(); +} + +void MMF::AbstractVideoPlayer::getVideoClipParametersL(TInt aError) +{ + User::LeaveIfError(aError); + + // Get frame size + TSize size; + m_player->VideoFrameSizeL(size); + m_videoFrameSize = QSize(size.iWidth, size.iHeight); + + // Get duration + m_totalTime = toMilliSeconds(m_player->DurationL()); +} + + +void MMF::AbstractVideoPlayer::MvpuoFrameReady(CFbsBitmap &aFrame, TInt aError) +{ + TRACE_CONTEXT(AbstractVideoPlayer::MvpuoFrameReady, EVideoApi); + TRACE_ENTRY("state %d error %d", state(), aError); + + Q_UNUSED(aFrame); + Q_UNUSED(aError); // suppress warnings in release builds + + TRACE_EXIT_0(); +} + +void MMF::AbstractVideoPlayer::MvpuoPlayComplete(TInt aError) +{ + TRACE_CONTEXT(AbstractVideoPlayer::MvpuoPlayComplete, EVideoApi) + TRACE_ENTRY("state %d error %d", state(), aError); + + // Call base class function which handles end of playback for both + // audio and video clips. + playbackComplete(aError); + + TRACE_EXIT_0(); +} + +void MMF::AbstractVideoPlayer::MvpuoEvent(const TMMFEvent &aEvent) +{ + TRACE_CONTEXT(AbstractVideoPlayer::MvpuoEvent, EVideoApi); + TRACE_ENTRY("state %d", state()); + + Q_UNUSED(aEvent); + + TRACE_EXIT_0(); +} + + +//----------------------------------------------------------------------------- +// MVideoLoadingObserver callbacks +//----------------------------------------------------------------------------- + +void MMF::AbstractVideoPlayer::MvloLoadingStarted() +{ + bufferingStarted(); +} + +void MMF::AbstractVideoPlayer::MvloLoadingComplete() +{ + bufferingComplete(); +} + + +//----------------------------------------------------------------------------- +// Video window updates +//----------------------------------------------------------------------------- + +void MMF::AbstractVideoPlayer::videoOutputChanged() +{ + TRACE_CONTEXT(AbstractVideoPlayer::videoOutputChanged, EVideoInternal); + TRACE_ENTRY_0(); + + if (m_videoOutput) + initVideoOutput(); + + videoWindowChanged(); + + TRACE_EXIT_0(); +} + +void MMF::AbstractVideoPlayer::initVideoOutput() +{ + bool connected = connect( + m_videoOutput, SIGNAL(videoWindowChanged()), + this, SLOT(videoWindowChanged()) + ); + Q_ASSERT(connected); + + connected = connect( + m_videoOutput, SIGNAL(aspectRatioChanged()), + this, SLOT(aspectRatioChanged()) + ); + Q_ASSERT(connected); + + connected = connect( + m_videoOutput, SIGNAL(scaleModeChanged()), + this, SLOT(scaleModeChanged()) + ); + Q_ASSERT(connected); + + // Suppress warnings in release builds + Q_UNUSED(connected); + + // Do these after all connections are complete, to ensure + // that any signals generated get to their destinations. + m_videoOutput->winId(); + m_videoOutput->setVideoSize(m_videoFrameSize); +} + +// Helper function for aspect ratio / scale mode handling +QSize scaleToAspect(const QSize &srcRect, int aspectWidth, int aspectHeight) +{ + const qreal aspectRatio = qreal(aspectWidth) / aspectHeight; + + int width = srcRect.width(); + int height = srcRect.width() / aspectRatio; + if (height > srcRect.height()){ + height = srcRect.height(); + width = srcRect.height() * aspectRatio; + } + return QSize(width, height); +} + +void MMF::AbstractVideoPlayer::updateScaleFactors(const QSize &windowSize, bool apply) +{ + if (m_videoFrameSize.isValid()) { + QRect videoRect; + + // Calculate size of smallest rect which contains video frame size + // and conforms to aspect ratio + switch (m_videoOutput->aspectRatio()) { + case Phonon::VideoWidget::AspectRatioAuto: + videoRect.setSize(m_videoFrameSize); + break; + + case Phonon::VideoWidget::AspectRatioWidget: + videoRect.setSize(windowSize); + break; + + case Phonon::VideoWidget::AspectRatio4_3: + videoRect.setSize(scaleToAspect(m_videoFrameSize, 4, 3)); + break; + + case Phonon::VideoWidget::AspectRatio16_9: + videoRect.setSize(scaleToAspect(m_videoFrameSize, 16, 9)); + break; + } + + // Scale to fill the window width + const int windowWidth = windowSize.width(); + const int windowHeight = windowSize.height(); + const qreal windowScaleFactor = qreal(windowWidth) / videoRect.width(); + int videoWidth = windowWidth; + int videoHeight = videoRect.height() * windowScaleFactor; + + const qreal windowToVideoHeightRatio = qreal(windowHeight) / videoHeight; + + switch (m_videoOutput->scaleMode()) { + case Phonon::VideoWidget::ScaleAndCrop: + if (videoHeight < windowHeight) { + videoWidth *= windowToVideoHeightRatio; + videoHeight = windowHeight; + } + break; + case Phonon::VideoWidget::FitInView: + default: + if (videoHeight > windowHeight) { + videoWidth *= windowToVideoHeightRatio; + videoHeight = windowHeight; + } + break; + } + + // Calculate scale factors + m_scaleWidth = 100.0f * videoWidth / m_videoFrameSize.width(); + m_scaleHeight = 100.0f * videoHeight / m_videoFrameSize.height(); + + if (apply) + parametersChanged(ScaleFactors); + } +} + +void MMF::AbstractVideoPlayer::parametersChanged(VideoParameters parameters) +{ + if (state() == LoadingState) + m_pendingChanges |= parameters; + else + handleParametersChanged(parameters); +} + +void MMF::AbstractVideoPlayer::handlePendingParametersChanged() +{ + if (m_pendingChanges) + handleParametersChanged(m_pendingChanges); + m_pendingChanges = 0; +} + + +//----------------------------------------------------------------------------- +// Metadata +//----------------------------------------------------------------------------- + +int MMF::AbstractVideoPlayer::numberOfMetaDataEntries() const +{ + int numberOfEntries = 0; + TRAP_IGNORE(numberOfEntries = m_player->NumberOfMetaDataEntriesL()); + return numberOfEntries; +} + +QPair<QString, QString> MMF::AbstractVideoPlayer::metaDataEntry(int index) const +{ + CMMFMetaDataEntry *entry = 0; + QT_TRAP_THROWING(entry = m_player->MetaDataEntryL(index)); + return QPair<QString, QString>(qt_TDesC2QString(entry->Name()), qt_TDesC2QString(entry->Value())); +} + +QT_END_NAMESPACE + diff --git a/src/3rdparty/phonon/mmf/abstractvideoplayer.h b/src/3rdparty/phonon/mmf/abstractvideoplayer.h new file mode 100644 index 0000000..d854793 --- /dev/null +++ b/src/3rdparty/phonon/mmf/abstractvideoplayer.h @@ -0,0 +1,171 @@ +/* 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_ABSTRACTVIDEOPLAYER_H +#define PHONON_MMF_ABSTRACTVIDEOPLAYER_H + +#include <videoplayer.h> // from epoc32/include + +#include <QSize> + +#include "abstractmediaplayer.h" +#include "abstractvideooutput.h" +#include "defs.h" + +QT_BEGIN_NAMESPACE + +namespace Phonon +{ +namespace MMF +{ +/** + * @short ABC for classes which wrap the MMF video player utility + * + * On devices which use the legacy graphics subsystem which does not + * support surfaces, video rendering is done via Direct Screen Access using + * the CVideoPlayerUtility API. On devices with a graphics subsystem which + * does support surfaces, video rendering is done using the + * CVideoPlayerUtility2 API. Because CVideoPlayerUtility2 inherits from + * CVideoPlayerUtility, AbstractVideoPlayer holds a pointer to the latter. + * + * @see DsaVideoPlayer, SurfaceVideoPlayer + */ +class AbstractVideoPlayer + : public AbstractMediaPlayer + , public MVideoPlayerUtilityObserver + , public MVideoLoadingObserver +{ + Q_OBJECT + +public: + ~AbstractVideoPlayer(); + + typedef CVideoPlayerUtility NativePlayer; + NativePlayer *nativePlayer() const; + + // 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 int openUrl(const QString &url); + virtual int bufferStatus() const; + virtual void close(); + + // MediaObjectInterface + virtual bool hasVideo() const; + virtual qint64 currentTime() const; + virtual qint64 totalTime() const; + + // AbstractPlayer + virtual void videoOutputChanged(); + + // AbstractMediaPlayer + virtual int numberOfMetaDataEntries() const; + virtual QPair<QString, QString> metaDataEntry(int index) const; + +public Q_SLOTS: + void videoWindowChanged(); + void aspectRatioChanged(); + void scaleModeChanged(); + +protected: + AbstractVideoPlayer(MediaObject *parent, const AbstractPlayer *player); + void construct(); + virtual void initVideoOutput(); + void updateScaleFactors(const QSize &windowSize, bool apply = true); + + // Called when a video parameter changes. If the underlying native API is + // ready to handle the change, it is propagated immediately, otherwise the + // change is recorded in m_pendingChanged and handled later by + // handlePendingParametersChanged(). + void parametersChanged(VideoParameters parameter); + + // Implementation must initialize the m_player pointer. + virtual void createPlayer() = 0; + + // Called from the MvpuoPrepareComplete callback. Allows derived class to + // calculate clipping rectangles and scale factors prior to starting + // playback. + virtual void prepareCompleted() = 0; + + // Called when native video window handle changes. Derived class may defer + // propagation of this change to the MMF video player utility by calling + // parametersChanged(). + virtual void handleVideoWindowChanged() = 0; + + // Called when the derived class must handle changes which have been made + // to video parameters such as window handle, screen rectangle and scale + // factors. Guaranteed to be called only when the underlying MMF video + // player object is ready to handle changes to these parameters. + virtual void handleParametersChanged(VideoParameters parameters) = 0; + +private: + void getVideoClipParametersL(TInt aError); + + // Called when native player API enters a state in which it is able to + // handle pending changes such as new video window handle, updated scale + // factors etc. + void handlePendingParametersChanged(); + +private: + // 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); + + // MVideoLoadingObserver + virtual void MvloLoadingStarted(); + virtual void MvloLoadingComplete(); + +protected: + QScopedPointer<NativePlayer> m_player; + + // Not owned + RWsSession& m_wsSession; + CWsScreenDevice& m_screenDevice; + RWindowBase* m_window; + + // Scaling factors for video display, expressed as percentages + TReal32 m_scaleWidth; + TReal32 m_scaleHeight; + + // Dimensions of the video clip + QSize m_videoFrameSize; + +private: + // Bitmask of parameters which have changed while the MMF video player + // object is not yet ready to receive these changes. + // See handlePendingParametersChanged(). + VideoParameters m_pendingChanges; + + // Duration of the video clip + qint64 m_totalTime; + +}; + +} +} + +QT_END_NAMESPACE + +#endif diff --git a/src/3rdparty/phonon/mmf/ancestormovemonitor.cpp b/src/3rdparty/phonon/mmf/ancestormovemonitor.cpp index 18ced94..f0d1be2 100644 --- a/src/3rdparty/phonon/mmf/ancestormovemonitor.cpp +++ b/src/3rdparty/phonon/mmf/ancestormovemonitor.cpp @@ -18,7 +18,8 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include "ancestormovemonitor.h" #include "utils.h" -#include "videooutput.h" + +#include "videooutput_dsa.h" #include <QCoreApplication> @@ -59,7 +60,7 @@ AncestorMoveMonitor::~AncestorMoveMonitor() // Public functions //----------------------------------------------------------------------------- -void AncestorMoveMonitor::registerTarget(VideoOutput *target) +void AncestorMoveMonitor::registerTarget(DsaVideoOutput *target) { TRACE_CONTEXT(AncestorMoveMonitor::registerTarget, EVideoInternal); TRACE_ENTRY("target 0x%08x", target); @@ -93,7 +94,7 @@ void AncestorMoveMonitor::registerTarget(VideoOutput *target) TRACE_EXIT_0(); } -void AncestorMoveMonitor::unRegisterTarget(VideoOutput *target) +void AncestorMoveMonitor::unRegisterTarget(DsaVideoOutput *target) { TRACE_CONTEXT(AncestorMoveMonitor::unRegisterTarget, EVideoInternal); TRACE_ENTRY("target 0x%08x", target); @@ -126,7 +127,7 @@ bool AncestorMoveMonitor::eventFilter(QObject *watched, QEvent *event) const Hash::const_iterator it = m_hash.find(watched); if(it != m_hash.end()) { const TargetList& targetList = it.value(); - VideoOutput* target = 0; + DsaVideoOutput* target = 0; foreach(target, targetList) { switch (event->type()) { @@ -166,7 +167,7 @@ void AncestorMoveMonitor::dump() const QObject *ancestor = it.key(); TRACE("ancestor 0x%08x", ancestor); const TargetList& targetList = it.value(); - VideoOutput* target = 0; + DsaVideoOutput* target = 0; foreach(target, targetList) { TRACE(" target 0x%08x", target); } @@ -174,7 +175,5 @@ void AncestorMoveMonitor::dump() #endif } - - QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/ancestormovemonitor.h b/src/3rdparty/phonon/mmf/ancestormovemonitor.h index 0e681aa..f3a022d 100644 --- a/src/3rdparty/phonon/mmf/ancestormovemonitor.h +++ b/src/3rdparty/phonon/mmf/ancestormovemonitor.h @@ -29,7 +29,7 @@ namespace Phonon { namespace MMF { -class VideoOutput; +class DsaVideoOutput; class AncestorMoveMonitor : public QObject { @@ -49,7 +49,7 @@ public: * ancestor list to be updated - therefore it should be called when * the target receives a ParentChange event. */ - void registerTarget(VideoOutput *target); + void registerTarget(DsaVideoOutput *target); /** * Remove target from the monitor. @@ -57,7 +57,7 @@ public: * The target will no longer receive notification when move events are * delivered to its ancestors. */ - void unRegisterTarget(VideoOutput *target); + void unRegisterTarget(DsaVideoOutput *target); protected: /** @@ -77,7 +77,7 @@ private: * therefore a set, however we use QList rather than QSet for * efficiency of iteration. */ - typedef QList<VideoOutput *> TargetList; + typedef QList<DsaVideoOutput *> TargetList; /** * Map from widget on which the move event occurs, to widgets which @@ -92,4 +92,4 @@ private: QT_END_NAMESPACE -#endif +#endif // !PHONON_MMF_ANCESTORMOVEMONITOR_H diff --git a/src/3rdparty/phonon/mmf/backend.cpp b/src/3rdparty/phonon/mmf/backend.cpp index 3568a49..2cec43b 100644 --- a/src/3rdparty/phonon/mmf/backend.cpp +++ b/src/3rdparty/phonon/mmf/backend.cpp @@ -24,7 +24,6 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include <apmstd.h> // for TDataType #include "abstractaudioeffect.h" -#include "ancestormovemonitor.h" #include "audiooutput.h" #include "audioplayer.h" #include "backend.h" @@ -44,7 +43,9 @@ using namespace Phonon::MMF; Backend::Backend(QObject *parent) : QObject(parent) +#ifndef PHONON_MMF_VIDEO_SURFACES , m_ancestorMoveMonitor(new AncestorMoveMonitor(this)) +#endif , m_effectFactory(new EffectFactory(this)) { TRACE_CONTEXT(Backend::Backend, EBackend); @@ -86,8 +87,15 @@ QObject *Backend::createObject(BackendInterface::Class c, QObject *parent, const static_cast<EffectFactory::Type>(args.first().toInt()); return m_effectFactory->createAudioEffect(type, parent); } + case VideoWidgetClass: - result = new VideoWidget(m_ancestorMoveMonitor.data(), qobject_cast<QWidget *>(parent)); + { + VideoWidget *widget = new VideoWidget(qobject_cast<QWidget *>(parent)); +#ifndef PHONON_MMF_VIDEO_SURFACES + widget->setAncestorMoveMonitor(m_ancestorMoveMonitor.data()); +#endif + result = widget; + } break; default: diff --git a/src/3rdparty/phonon/mmf/backend.h b/src/3rdparty/phonon/mmf/backend.h index 9361544..a45c92a 100644 --- a/src/3rdparty/phonon/mmf/backend.h +++ b/src/3rdparty/phonon/mmf/backend.h @@ -19,7 +19,10 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #ifndef PHONON_MMF_BACKEND_H #define PHONON_MMF_BACKEND_H +#ifndef PHONON_MMF_VIDEO_SURFACES #include "ancestormovemonitor.h" +#endif + #include "effectfactory.h" #include <phonon/mediasource.h> @@ -53,7 +56,9 @@ Q_SIGNALS: void objectDescriptionChanged(ObjectDescriptionType); private: +#ifndef PHONON_MMF_VIDEO_SURFACES QScopedPointer<AncestorMoveMonitor> m_ancestorMoveMonitor; +#endif QScopedPointer<EffectFactory> m_effectFactory; }; diff --git a/src/3rdparty/phonon/mmf/defs.h b/src/3rdparty/phonon/mmf/defs.h index 1a93aa9..1ed8250 100644 --- a/src/3rdparty/phonon/mmf/defs.h +++ b/src/3rdparty/phonon/mmf/defs.h @@ -35,6 +35,15 @@ enum MediaType { MediaTypeAudio, MediaTypeVideo }; + +enum VideoParameter { + WindowHandle = 0x1, + WindowScreenRect = 0x2, + ScaleFactors = 0x4 +}; +Q_DECLARE_FLAGS(VideoParameters, VideoParameter) +Q_DECLARE_OPERATORS_FOR_FLAGS(VideoParameters) + } } diff --git a/src/3rdparty/phonon/mmf/mediaobject.cpp b/src/3rdparty/phonon/mmf/mediaobject.cpp index 9744774..ee459e6 100644 --- a/src/3rdparty/phonon/mmf/mediaobject.cpp +++ b/src/3rdparty/phonon/mmf/mediaobject.cpp @@ -22,7 +22,13 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include "dummyplayer.h" #include "utils.h" #include "utils.h" -#include "mmf_videoplayer.h" + +#ifdef PHONON_MMF_VIDEO_SURFACES +#include "videoplayer_surface.h" +#else +#include "videoplayer_dsa.h" +#endif + #include "videowidget.h" #include "mediaobject.h" @@ -293,7 +299,11 @@ void MMF::MediaObject::createPlayer(const MediaSource &source) break; case MediaTypeVideo: - newPlayer = new VideoPlayer(this, oldPlayer); +#ifdef PHONON_MMF_VIDEO_SURFACES + newPlayer = SurfaceVideoPlayer::create(this, oldPlayer); +#else + newPlayer = DsaVideoPlayer::create(this, oldPlayer); +#endif break; } @@ -383,7 +393,7 @@ void MMF::MediaObject::disconnectMediaObject(MediaObject * /*mediaObject*/) // Video output //----------------------------------------------------------------------------- -void MMF::MediaObject::setVideoOutput(VideoOutput* videoOutput) +void MMF::MediaObject::setVideoOutput(AbstractVideoOutput* videoOutput) { m_player->setVideoOutput(videoOutput); } diff --git a/src/3rdparty/phonon/mmf/mediaobject.h b/src/3rdparty/phonon/mmf/mediaobject.h index d6248e2..62e0a0e 100644 --- a/src/3rdparty/phonon/mmf/mediaobject.h +++ b/src/3rdparty/phonon/mmf/mediaobject.h @@ -38,7 +38,7 @@ namespace Phonon namespace MMF { class AbstractPlayer; -class VideoOutput; +class AbstractVideoOutput; /** * @short Facade class which wraps MMF client utility instance @@ -85,7 +85,7 @@ public: */ AbstractPlayer *abstractPlayer() const; - void setVideoOutput(VideoOutput* videoOutput); + void setVideoOutput(AbstractVideoOutput* videoOutput); public Q_SLOTS: void volumeChanged(qreal volume); diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp deleted file mode 100644 index 127edb4..0000000 --- a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp +++ /dev/null @@ -1,658 +0,0 @@ -/* 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 <QApplication> // for QApplication::activeWindow -#include <QUrl> -#include <QTimer> -#include <QWidget> - -#include <coemain.h> // for CCoeEnv -#include <coecntrl.h> - -#include "mmf_videoplayer.h" -#include "utils.h" - -#ifndef QT_NO_DEBUG -#include "objectdump.h" -#endif - -QT_BEGIN_NAMESPACE - -using namespace Phonon; -using namespace Phonon::MMF; - -/*! \class MMF::VideoPlayer - \internal -*/ - -//----------------------------------------------------------------------------- -// Constructor / destructor -//----------------------------------------------------------------------------- - -MMF::VideoPlayer::VideoPlayer(MediaObject *parent, const AbstractPlayer *player) - : AbstractMediaPlayer(parent, player) - , m_wsSession(CCoeEnv::Static()->WsSession()) - , m_screenDevice(*CCoeEnv::Static()->ScreenDevice()) - , m_window(0) - , m_totalTime(0) - , m_pendingChanges(false) - , m_dsaActive(false) -{ - construct(); -} - -void MMF::VideoPlayer::construct() -{ - TRACE_CONTEXT(VideoPlayer::VideoPlayer, EVideoApi); - TRACE_ENTRY_0(); - - getVideoWindow(); - - const TInt priority = 0; - const TMdaPriorityPreference preference = EMdaPriorityPreferenceNone; - - CVideoPlayerUtility *player = 0; - QT_TRAP_THROWING(player = CVideoPlayerUtility::NewL - ( - *this, - priority, preference, - m_wsSession, m_screenDevice, - *m_window, - m_videoRect, m_videoRect - ) - ); - m_player.reset(player); - - // CVideoPlayerUtility::NewL starts DSA - m_dsaActive = true; - - m_player->RegisterForVideoLoadingNotification(*this); - - TRACE_EXIT_0(); -} - -MMF::VideoPlayer::~VideoPlayer() -{ - TRACE_CONTEXT(VideoPlayer::~VideoPlayer, EVideoApi); - TRACE_ENTRY_0(); - - // QObject destructor removes all signal-slot connections involving this - // object, so we do not need to disconnect from m_videoOutput here. - - TRACE_EXIT_0(); -} - -CVideoPlayerUtility* MMF::VideoPlayer::nativePlayer() const -{ - return m_player.data(); -} - -//----------------------------------------------------------------------------- -// Public API -//----------------------------------------------------------------------------- - -void MMF::VideoPlayer::doPlay() -{ - TRACE_CONTEXT(VideoPlayer::doPlay, EVideoApi); - - applyPendingChanges(); - - m_player->Play(); -} - -void MMF::VideoPlayer::doPause() -{ - TRACE_CONTEXT(VideoPlayer::doPause, EVideoApi); - - TRAPD(err, m_player->PauseL()); - if (KErrNone != err && state() != ErrorState) { - TRACE("PauseL error %d", err); - setError(tr("Pause failed"), err); - } -} - -void MMF::VideoPlayer::doStop() -{ - m_player->Stop(); -} - -void MMF::VideoPlayer::doSeek(qint64 ms) -{ - TRACE_CONTEXT(VideoPlayer::doSeek, EVideoApi); - - TRAPD(err, m_player->SetPositionL(TTimeIntervalMicroSeconds(ms * 1000))); - - if(KErrNone != err) - setError(tr("Seek failed"), err); -} - -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; -} - -int MMF::VideoPlayer::openUrl(const QString& url) -{ - TRAPD(err, m_player->OpenUrlL(qt_QString2TPtrC(url))); - return err; -} - -int MMF::VideoPlayer::bufferStatus() const -{ - int result = 0; - TRAP_IGNORE(m_player->GetVideoLoadingProgressL(result)); - return result; -} - -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(tr("Getting position failed"), err); - } - - 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(tr("Opening clip failed"), aError); - - 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()); - - if (m_videoOutput) - m_videoOutput->setVideoSize(m_videoFrameSize); - - updateVideoRect(); - applyPendingChanges(); - - emit totalTimeChanged(totalTime()); - changeState(StoppedState); - } else { - setError(tr("Buffering clip failed"), err); - } - - TRACE_EXIT_0(); -} - -void MMF::VideoPlayer::doPrepareCompleteL(TInt aError) -{ - User::LeaveIfError(aError); - - // Get frame size - TSize size; - m_player->VideoFrameSizeL(size); - m_videoFrameSize = 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); - - 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); - - // Call base class function which handles end of playback for both - // audio and video clips. - playbackComplete(aError); - - TRACE_EXIT_0(); -} - -void MMF::VideoPlayer::MvpuoEvent(const TMMFEvent &aEvent) -{ - TRACE_CONTEXT(VideoPlayer::MvpuoEvent, EVideoApi); - TRACE_ENTRY("state %d", state()); - - Q_UNUSED(aEvent); - - TRACE_EXIT_0(); -} - - -//----------------------------------------------------------------------------- -// MVideoLoadingObserver callbacks -//----------------------------------------------------------------------------- - -void MMF::VideoPlayer::MvloLoadingStarted() -{ - bufferingStarted(); -} - -void MMF::VideoPlayer::MvloLoadingComplete() -{ - bufferingComplete(); -} - - -//----------------------------------------------------------------------------- -// Video window updates -//----------------------------------------------------------------------------- - -void MMF::VideoPlayer::getVideoWindow() -{ - TRACE_CONTEXT(VideoPlayer::getVideoWindow, EVideoInternal); - TRACE_ENTRY_0(); - - if(m_videoOutput) { - // Dump information to log, only in debug builds - m_videoOutput->dump(); - - initVideoOutput(); - videoWindowChanged(); - } else - // Top-level window - m_window = QApplication::activeWindow()->effectiveWinId()->DrawableWindow(); - - TRACE_EXIT_0(); -} - -void MMF::VideoPlayer::videoOutputChanged() -{ - TRACE_CONTEXT(VideoPlayer::videoOutputChanged, EVideoInternal); - TRACE_ENTRY_0(); - - if (m_videoOutput) { - initVideoOutput(); - videoWindowChanged(); - } - - TRACE_EXIT_0(); -} - -void MMF::VideoPlayer::initVideoOutput() -{ - m_videoOutput->winId(); - m_videoOutput->setVideoSize(m_videoFrameSize); - - bool connected = connect( - m_videoOutput, SIGNAL(videoWindowChanged()), - this, SLOT(videoWindowChanged()) - ); - Q_ASSERT(connected); - - connected = connect( - m_videoOutput, SIGNAL(beginVideoWindowNativePaint()), - this, SLOT(suspendDirectScreenAccess()) - ); - Q_ASSERT(connected); - - connected = connect( - m_videoOutput, SIGNAL(endVideoWindowNativePaint()), - this, SLOT(resumeDirectScreenAccess()) - ); - Q_ASSERT(connected); - - connected = connect( - m_videoOutput, SIGNAL(aspectRatioChanged()), - this, SLOT(aspectRatioChanged()) - ); - Q_ASSERT(connected); - - connected = connect( - m_videoOutput, SIGNAL(scaleModeChanged()), - this, SLOT(scaleModeChanged()) - ); - Q_ASSERT(connected); - - // Suppress warnings in release builds - Q_UNUSED(connected); -} - -void MMF::VideoPlayer::videoWindowChanged() -{ - TRACE_CONTEXT(VideoPlayer::videoOutputRegionChanged, EVideoInternal); - TRACE_ENTRY("state %d", state()); - - m_window = m_videoOutput->videoWindow(); - updateVideoRect(); - - TRACE_EXIT_0(); -} - -void MMF::VideoPlayer::suspendDirectScreenAccess() -{ - m_dsaWasActive = stopDirectScreenAccess(); -} - -void MMF::VideoPlayer::resumeDirectScreenAccess() -{ - if(m_dsaWasActive) { - startDirectScreenAccess(); - m_dsaWasActive = false; - } -} - -void MMF::VideoPlayer::startDirectScreenAccess() -{ - if(!m_dsaActive) { - TRAPD(err, m_player->StartDirectScreenAccessL()); - if(KErrNone == err) - m_dsaActive = true; - else - setError(tr("Video display error"), err); - } -} - -bool MMF::VideoPlayer::stopDirectScreenAccess() -{ - const bool dsaWasActive = m_dsaActive; - if(m_dsaActive) { - TRAPD(err, m_player->StopDirectScreenAccessL()); - if(KErrNone == err) - m_dsaActive = false; - else - setError(tr("Video display error"), err); - } - return dsaWasActive; -} - -// Helper function for aspect ratio / scale mode handling -QSize scaleToAspect(const QSize& srcRect, int aspectWidth, int aspectHeight) -{ - const qreal aspectRatio = qreal(aspectWidth) / aspectHeight; - - int width = srcRect.width(); - int height = srcRect.width() / aspectRatio; - if (height > srcRect.height()){ - height = srcRect.height(); - width = srcRect.height() * aspectRatio; - } - return QSize(width, height); -} - -void MMF::VideoPlayer::updateVideoRect() -{ - QRect videoRect; - QRect windowRect = m_videoOutput->videoWindowRect(); - - // Clip to physical window size - // This is due to a defect in the layout when running on S60 3.2, which - // results in the rectangle of the video widget extending outside the - // screen in certain circumstances. These include the initial startup - // of the mediaplayer demo in portrait mode. When this rectangle is - // passed to the CVideoPlayerUtility, no video is rendered. - const TSize screenSize = m_screenDevice.SizeInPixels(); - const QRect screenRect(0, 0, screenSize.iWidth, screenSize.iHeight); - windowRect = windowRect.intersected(screenRect); - - const QSize windowSize = windowRect.size(); - - // Calculate size of smallest rect which contains video frame size - // and conforms to aspect ratio - switch (m_videoOutput->aspectRatio()) { - case Phonon::VideoWidget::AspectRatioAuto: - videoRect.setSize(m_videoFrameSize); - break; - - case Phonon::VideoWidget::AspectRatioWidget: - videoRect.setSize(windowSize); - break; - - case Phonon::VideoWidget::AspectRatio4_3: - videoRect.setSize(scaleToAspect(m_videoFrameSize, 4, 3)); - break; - - case Phonon::VideoWidget::AspectRatio16_9: - videoRect.setSize(scaleToAspect(m_videoFrameSize, 16, 9)); - break; - } - - // Scale to fill the window width - const int windowWidth = windowSize.width(); - const int windowHeight = windowSize.height(); - const qreal windowScaleFactor = qreal(windowWidth) / videoRect.width(); - int videoWidth = windowWidth; - int videoHeight = videoRect.height() * windowScaleFactor; - - const qreal windowToVideoHeightRatio = qreal(windowHeight) / videoHeight; - - switch(m_videoOutput->scaleMode()) { - case Phonon::VideoWidget::ScaleAndCrop: - if(videoHeight < windowHeight) { - videoWidth *= windowToVideoHeightRatio; - videoHeight = windowHeight; - } - break; - case Phonon::VideoWidget::FitInView: - default: - if(videoHeight > windowHeight) { - videoWidth *= windowToVideoHeightRatio; - videoHeight = windowHeight; - } - break; - } - - // Calculate scale factors - m_scaleWidth = 100.0f * videoWidth / m_videoFrameSize.width(); - m_scaleHeight = 100.0f * videoHeight / m_videoFrameSize.height(); - - m_videoRect = qt_QRect2TRect(windowRect); - - if (state() == LoadingState) - m_pendingChanges = true; - else { - applyVideoWindowChange(); - m_pendingChanges = false; - } -} - -void MMF::VideoPlayer::aspectRatioChanged() -{ - TRACE_CONTEXT(VideoPlayer::aspectRatioChanged, EVideoInternal); - TRACE_ENTRY("state %d aspectRatio %d", state()); - - updateVideoRect(); - - TRACE_EXIT_0(); -} - -void MMF::VideoPlayer::scaleModeChanged() -{ - TRACE_CONTEXT(VideoPlayer::scaleModeChanged, EVideoInternal); - TRACE_ENTRY("state %d", state()); - - updateVideoRect(); - - TRACE_EXIT_0(); -} - -#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(); } -}; - -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(); - } -} - -#endif // _DEBUG - -void MMF::VideoPlayer::applyPendingChanges() -{ - if(m_pendingChanges) - applyVideoWindowChange(); - - m_pendingChanges = false; -} - -void MMF::VideoPlayer::applyVideoWindowChange() -{ - TRACE_CONTEXT(VideoPlayer::applyVideoWindowChange, EVideoInternal); - TRACE_ENTRY_0(); - -#ifndef QT_NO_DEBUG - getDsaRegion(m_wsSession, *m_window); -#endif - - static const TBool antialias = ETrue; - - TRAPD(err, m_player->SetScaleFactorL(m_scaleWidth, m_scaleHeight, antialias)); - if(KErrNone != err) { - TRACE("SetScaleFactorL (1) err %d", err); - setError(tr("Video display error"), err); - } - - if(KErrNone == err) { - TRAP(err, - m_player->SetDisplayWindowL - ( - m_wsSession, m_screenDevice, - *m_window, - m_videoRect, m_videoRect - ) - ); - - if (KErrNone != err) { - TRACE("SetDisplayWindowL err %d", err); - setError(tr("Video display error"), err); - } else { - m_dsaActive = true; - TRAP(err, m_player->SetScaleFactorL(m_scaleWidth, m_scaleHeight, antialias)); - if(KErrNone != err) { - TRACE("SetScaleFactorL (2) err %d", err); - setError(tr("Video display error"), err); - } - } - } - - TRACE_EXIT_0(); -} - - -//----------------------------------------------------------------------------- -// Metadata -//----------------------------------------------------------------------------- - -int MMF::VideoPlayer::numberOfMetaDataEntries() const -{ - int numberOfEntries = 0; - TRAP_IGNORE(numberOfEntries = m_player->NumberOfMetaDataEntriesL()); - return numberOfEntries; -} - -QPair<QString, QString> MMF::VideoPlayer::metaDataEntry(int index) const -{ - CMMFMetaDataEntry *entry = 0; - QT_TRAP_THROWING(entry = m_player->MetaDataEntryL(index)); - return QPair<QString, QString>(qt_TDesC2QString(entry->Name()), qt_TDesC2QString(entry->Value())); -} - -QT_END_NAMESPACE - diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.h b/src/3rdparty/phonon/mmf/mmf_videoplayer.h deleted file mode 100644 index 0253ab9..0000000 --- a/src/3rdparty/phonon/mmf/mmf_videoplayer.h +++ /dev/null @@ -1,138 +0,0 @@ -/* 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" - -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 MVideoLoadingObserver -{ - Q_OBJECT - -public: - VideoPlayer(MediaObject *parent = 0, const AbstractPlayer *player = 0); - virtual ~VideoPlayer(); - - typedef CVideoPlayerUtility NativePlayer; - NativePlayer *nativePlayer() const; - - // 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 int openUrl(const QString& url); - virtual int bufferStatus() const; - virtual void close(); - - // MediaObjectInterface - virtual bool hasVideo() const; - virtual qint64 currentTime() const; - virtual qint64 totalTime() const; - - // AbstractPlayer - virtual void videoOutputChanged(); - - // AbstractMediaPlayer - virtual int numberOfMetaDataEntries() const; - virtual QPair<QString, QString> metaDataEntry(int index) const; - -public Q_SLOTS: - void videoWindowChanged(); - void aspectRatioChanged(); - void scaleModeChanged(); - void suspendDirectScreenAccess(); - void resumeDirectScreenAccess(); - -private: - void construct(); - - void doPrepareCompleteL(TInt aError); - - void getVideoWindow(); - void initVideoOutput(); - void updateVideoRect(); - - void applyPendingChanges(); - void applyVideoWindowChange(); - - void startDirectScreenAccess(); - bool stopDirectScreenAccess(); - -private: - // 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); - - // MVideoLoadingObserver - virtual void MvloLoadingStarted(); - virtual void MvloLoadingComplete(); - -private: - QScopedPointer<NativePlayer> m_player; - - // Not owned - RWsSession& m_wsSession; - CWsScreenDevice& m_screenDevice; - RWindowBase* m_window; - - /* Extent of the video display - will be clipped to m_windowRect */ - TRect m_videoRect; - - TReal32 m_scaleWidth; - TReal32 m_scaleHeight; - - QSize m_videoFrameSize; - qint64 m_totalTime; - - bool m_pendingChanges; - bool m_dsaActive; - bool m_dsaWasActive; - -}; - -} -} - -QT_END_NAMESPACE - -#endif diff --git a/src/3rdparty/phonon/mmf/videooutput.cpp b/src/3rdparty/phonon/mmf/videooutput.cpp deleted file mode 100644 index 119dcb1..0000000 --- a/src/3rdparty/phonon/mmf/videooutput.cpp +++ /dev/null @@ -1,303 +0,0 @@ -/* 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 "ancestormovemonitor.h" -#include "utils.h" -#include "videooutput.h" - -#ifndef QT_NO_DEBUG -#include "objectdump.h" -#endif - -#include <QPaintEvent> -#include <QPainter> -#include <QMoveEvent> -#include <QResizeEvent> - -#include <QtCore/private/qcore_symbian_p.h> // for qt_TRect2QRect -#include <QtGui/private/qwidget_p.h> // to access QWExtra - -#include <coecntrl.h> - -#include <coemain.h> // for CCoeEnv - -QT_BEGIN_NAMESPACE - -using namespace Phonon; -using namespace Phonon::MMF; - -/*! \class MMF::VideoOutput - \internal -*/ - -//----------------------------------------------------------------------------- -// Constants -//----------------------------------------------------------------------------- - -static const Phonon::VideoWidget::AspectRatio DefaultAspectRatio = - Phonon::VideoWidget::AspectRatioAuto; -static const Phonon::VideoWidget::ScaleMode DefaultScaleMode = - Phonon::VideoWidget::FitInView; - - -//----------------------------------------------------------------------------- -// Constructor / destructor -//----------------------------------------------------------------------------- - -MMF::VideoOutput::VideoOutput - (AncestorMoveMonitor* ancestorMoveMonitor, QWidget* parent) - : QWidget(parent) - , m_ancestorMoveMonitor(ancestorMoveMonitor) - , m_aspectRatio(DefaultAspectRatio) - , m_scaleMode(DefaultScaleMode) -{ - 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); - - qt_widget_private(this)->extraData()->nativePaintMode = QWExtra::ZeroFill; - qt_widget_private(this)->extraData()->receiveNativePaintEvents = true; - - getVideoWindowRect(); - registerForAncestorMoved(); - - dump(); - - TRACE_EXIT_0(); -} - -MMF::VideoOutput::~VideoOutput() -{ - TRACE_CONTEXT(VideoOutput::~VideoOutput, EVideoInternal); - TRACE_ENTRY_0(); - - m_ancestorMoveMonitor->unRegisterTarget(this); - - TRACE_EXIT_0(); -} - -void MMF::VideoOutput::setVideoSize(const QSize& frameSize) -{ - TRACE_CONTEXT(VideoOutput::setVideoSize, EVideoInternal); - TRACE("oldSize %d %d newSize %d %d", - m_videoFrameSize.width(), m_videoFrameSize.height(), - frameSize.width(), frameSize.height()); - - if (frameSize != m_videoFrameSize) { - m_videoFrameSize = frameSize; - updateGeometry(); - } -} - -void MMF::VideoOutput::ancestorMoved() -{ - TRACE_CONTEXT(VideoOutput::ancestorMoved, EVideoInternal); - TRACE_ENTRY_0(); - - RWindowBase *const window = videoWindow(); - - if(window) { - const TPoint newWindowPosSymbian = window->AbsPosition(); - const QPoint newWindowPos(newWindowPosSymbian.iX, newWindowPosSymbian.iY); - - if(newWindowPos != m_videoWindowRect.topLeft()) { - m_videoWindowRect.moveTo(newWindowPos); - emit videoWindowChanged(); - } - } - - TRACE_EXIT_0(); -} - -//----------------------------------------------------------------------------- -// QWidget -//----------------------------------------------------------------------------- - -QSize MMF::VideoOutput::sizeHint() const -{ - // TODO: replace this with a more sensible default - QSize result(320, 240); - - if (!m_videoFrameSize.isNull()) - result = m_videoFrameSize; - - 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().rectCount()); - TRACE("type %d", event->type()); - - // Do nothing -} - -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()); - - if(event->size() != event->oldSize()) { - m_videoWindowRect.setSize(event->size()); - emit videoWindowChanged(); - } -} - -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()); - - if(event->pos() != event->oldPos()) { - m_videoWindowRect.moveTo(event->pos()); - emit videoWindowChanged(); - } -} - -bool MMF::VideoOutput::event(QEvent* event) -{ - TRACE_CONTEXT(VideoOutput::event, EVideoInternal); - - if (event->type() == QEvent::WinIdChange) { - TRACE_0("WinIdChange"); - getVideoWindowRect(); - emit videoWindowChanged(); - return true; - } else if (event->type() == QEvent::ParentChange) { - // Tell ancestor move monitor to update ancestor list for this widget - registerForAncestorMoved(); - return true; - } else - return QWidget::event(event); -} - - -//----------------------------------------------------------------------------- -// Public functions -//----------------------------------------------------------------------------- - -RWindowBase* MMF::VideoOutput::videoWindow() -{ - CCoeControl *control = internalWinId(); - if(!control) - control = effectiveWinId(); - - RWindowBase *window = 0; - if(control) - window = control->DrawableWindow(); - - return window; -} - -const QRect& MMF::VideoOutput::videoWindowRect() const -{ - return m_videoWindowRect; -} - -Phonon::VideoWidget::AspectRatio MMF::VideoOutput::aspectRatio() const -{ - return m_aspectRatio; -} - -void MMF::VideoOutput::setAspectRatio - (Phonon::VideoWidget::AspectRatio aspectRatio) -{ - if(m_aspectRatio != aspectRatio) { - m_aspectRatio = aspectRatio; - emit aspectRatioChanged(); - } -} - -Phonon::VideoWidget::ScaleMode MMF::VideoOutput::scaleMode() const -{ - return m_scaleMode; -} - -void MMF::VideoOutput::setScaleMode - (Phonon::VideoWidget::ScaleMode scaleMode) -{ - if(m_scaleMode != scaleMode) { - m_scaleMode = scaleMode; - emit scaleModeChanged(); - } -} - - -//----------------------------------------------------------------------------- -// Private functions -//----------------------------------------------------------------------------- - -void MMF::VideoOutput::getVideoWindowRect() -{ - RWindowBase *const window = videoWindow(); - if(window) - m_videoWindowRect = - qt_TRect2QRect(TRect(window->AbsPosition(), window->Size())); -} - -void MMF::VideoOutput::registerForAncestorMoved() -{ - m_ancestorMoveMonitor->registerTarget(this); -} - -void MMF::VideoOutput::dump() const -{ -#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 - ObjectDump::addDefaultAnnotators(*visitor); - TRACE("Dumping tree from leaf 0x%08x:", this); - ObjectDump::dumpTreeFromLeaf(*this, *visitor); - - 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(*this); -#endif -} - -void MMF::VideoOutput::beginNativePaintEvent(const QRect& /*controlRect*/) -{ - emit beginVideoWindowNativePaint(); -} - -void MMF::VideoOutput::endNativePaintEvent(const QRect& /*controlRect*/) -{ - // Ensure that draw ops are executed into the WSERV output framebuffer - CCoeEnv::Static()->WsSession().Flush(); - - emit endVideoWindowNativePaint(); -} - -QT_END_NAMESPACE - diff --git a/src/3rdparty/phonon/mmf/videooutput_dsa.cpp b/src/3rdparty/phonon/mmf/videooutput_dsa.cpp new file mode 100644 index 0000000..a5e2ac8 --- /dev/null +++ b/src/3rdparty/phonon/mmf/videooutput_dsa.cpp @@ -0,0 +1,177 @@ +/* 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 <QtCore/private/qcore_symbian_p.h> // for qt_TRect2QRect +#include <QtGui/private/qwidget_p.h> // to access QWExtra +#include <QResizeEvent> +#include <QMoveEvent> + +#include <coemain.h> // for CCoeEnv + +#include "ancestormovemonitor.h" +#include "utils.h" +#include "videooutput_dsa.h" + +QT_BEGIN_NAMESPACE + +using namespace Phonon; +using namespace Phonon::MMF; + +DsaVideoOutput::DsaVideoOutput(QWidget *parent) + : AbstractVideoOutput(parent) + , m_ancestorMoveMonitor(0) +{ + TRACE_CONTEXT(DsaVideoOutput::DsaVideoOutput, EVideoInternal); + TRACE_ENTRY("parent 0x%08x", parent); + + setPalette(QPalette(Qt::black)); + setAttribute(Qt::WA_OpaquePaintEvent, true); + setAttribute(Qt::WA_NoSystemBackground, true); + setAutoFillBackground(false); + + qt_widget_private(this)->extraData()->nativePaintMode = QWExtra::ZeroFill; + qt_widget_private(this)->extraData()->receiveNativePaintEvents = true; + + getVideoWindowScreenRect(); + + dump(); + + TRACE_EXIT_0(); +} + +DsaVideoOutput::~DsaVideoOutput() +{ + TRACE_CONTEXT(DsaVideoOutput::~DsaVideoOutput, EVideoInternal); + TRACE_ENTRY_0(); + + m_ancestorMoveMonitor->unRegisterTarget(this); + + TRACE_EXIT_0(); +} + +//----------------------------------------------------------------------------- +// Public functions +//----------------------------------------------------------------------------- + +void MMF::DsaVideoOutput::setAncestorMoveMonitor(AncestorMoveMonitor *monitor) +{ + m_ancestorMoveMonitor = monitor; + registerForAncestorMoved(); +} + +const QRect& MMF::DsaVideoOutput::videoWindowScreenRect() const +{ + return m_videoWindowScreenRect; +} + +void MMF::DsaVideoOutput::ancestorMoved() +{ + TRACE_CONTEXT(DsaVideoOutput::ancestorMoved, EVideoInternal); + TRACE_ENTRY_0(); + + RWindowBase *const window = videoWindow(); + + if (window) { + const TPoint newWindowPosSymbian = window->AbsPosition(); + const QPoint newWindowPos(newWindowPosSymbian.iX, newWindowPosSymbian.iY); + + if (newWindowPos != m_videoWindowScreenRect.topLeft()) { + m_videoWindowScreenRect.moveTo(newWindowPos); + emit videoWindowScreenRectChanged(); + } + } + + TRACE_EXIT_0(); +} + +void MMF::DsaVideoOutput::beginNativePaintEvent(const QRect & /*controlRect*/) +{ + emit beginVideoWindowNativePaint(); +} + +void MMF::DsaVideoOutput::endNativePaintEvent(const QRect & /*controlRect*/) +{ + // Ensure that draw ops are executed into the WSERV output framebuffer + CCoeEnv::Static()->WsSession().Flush(); + + emit endVideoWindowNativePaint(); +} + +//----------------------------------------------------------------------------- +// Private functions +//----------------------------------------------------------------------------- + +void MMF::DsaVideoOutput::getVideoWindowScreenRect() +{ + RWindowBase *const window = videoWindow(); + if (window) + m_videoWindowScreenRect = + qt_TRect2QRect(TRect(window->AbsPosition(), window->Size())); +} + +void MMF::DsaVideoOutput::registerForAncestorMoved() +{ + m_ancestorMoveMonitor->registerTarget(this); +} + +void MMF::DsaVideoOutput::resizeEvent(QResizeEvent *event) +{ + TRACE_CONTEXT(DsaVideoOutput::resizeEvent, EVideoInternal); + TRACE("%d %d -> %d %d", + event->oldSize().width(), event->oldSize().height(), + event->size().width(), event->size().height()); + + if (event->size() != event->oldSize()) { + m_videoWindowScreenRect.setSize(event->size()); + emit videoWindowScreenRectChanged(); + } +} + +void MMF::DsaVideoOutput::moveEvent(QMoveEvent *event) +{ + TRACE_CONTEXT(DsaVideoOutput::moveEvent, EVideoInternal); + TRACE("%d %d -> %d %d", + event->oldPos().x(), event->oldPos().y(), + event->pos().x(), event->pos().y()); + + if (event->pos() != event->oldPos()) { + m_videoWindowScreenRect.moveTo(event->pos()); + emit videoWindowScreenRectChanged(); + } +} + +bool MMF::DsaVideoOutput::event(QEvent *event) +{ + TRACE_CONTEXT(DsaVideoOutput::event, EVideoInternal); + + if (event->type() == QEvent::WinIdChange) { + TRACE_0("WinIdChange"); + getVideoWindowScreenRect(); + emit videoWindowChanged(); + return true; + } else if (event->type() == QEvent::ParentChange) { + // Tell ancestor move monitor to update ancestor list for this widget + registerForAncestorMoved(); + return true; + } else { + return QWidget::event(event); + } +} + +QT_END_NAMESPACE + diff --git a/src/3rdparty/phonon/mmf/videooutput_dsa.h b/src/3rdparty/phonon/mmf/videooutput_dsa.h new file mode 100644 index 0000000..c37dad8 --- /dev/null +++ b/src/3rdparty/phonon/mmf/videooutput_dsa.h @@ -0,0 +1,109 @@ +/* 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_DSA_H +#define PHONON_MMF_VIDEOOUTPUT_DSA_H + +#include <QRect> + +#include "phonon/mmf/abstractvideooutput.h" + +QT_BEGIN_NAMESPACE + +class QResizeEvent; +class QMoveEvent; + +namespace Phonon +{ +namespace MMF +{ +class AncestorMoveMonitor; + +/** + * @short Widget on which video is displayed by DSA rendering + * + * This implementation is used on devices with the legacy graphics + * subsystem, which does not support surfaces. On such devices, + * video rendering is done via Direct Screen Access (DSA), whereby + * the video decoder writes directly to the framebuffer. To ensure + * that the window server and video decoder do not try to draw to + * the same screen region at the same time, the video subsystem + * first requests permission to perform DSA. If the window server + * needs to draw to this screen region (for example to display a + * message dialog), it first notifies the video subsystem that it + * must stop rendering to this region. + * + * @see SurfaceVideoOutput + */ +class DsaVideoOutput + : public AbstractVideoOutput +{ + Q_OBJECT + +public: + DsaVideoOutput(QWidget *parent); + ~DsaVideoOutput(); + + void setAncestorMoveMonitor(AncestorMoveMonitor *monitor); + + // Get absolute screen rectangle for video window + const QRect& videoWindowScreenRect() const; + + // Called by AncestorMoveMonitor + void ancestorMoved(); + +public Q_SLOTS: + // Callbacks received from Symbian QtGui implementation, when it + // begins / ends blitting the video widget's backing store to the + // window server. + void beginNativePaintEvent(const QRect & /*controlRect*/); + void endNativePaintEvent(const QRect & /*controlRect*/); + +Q_SIGNALS: + void videoWindowScreenRectChanged(); + + // Emitted when the Symbian QtGui implementation begins / ends + // blitting the video widget's backing store to the window server. + void beginVideoWindowNativePaint(); + void endVideoWindowNativePaint(); + +private: + void getVideoWindowScreenRect(); + void registerForAncestorMoved(); + + // QWidget + void resizeEvent(QResizeEvent *event); + void moveEvent(QMoveEvent *event); + bool event(QEvent *event); + +private: + // Not owned + AncestorMoveMonitor* m_ancestorMoveMonitor; + + // Absolute screen rectangle on which video is displayed + QRect m_videoWindowScreenRect; + +}; + +} +} + +QT_END_NAMESPACE + +#endif // !PHONON_MMF_VIDEOOUTPUT_DSA_H + diff --git a/src/3rdparty/phonon/mmf/videooutput_surface.cpp b/src/3rdparty/phonon/mmf/videooutput_surface.cpp new file mode 100644 index 0000000..e9b2d3f --- /dev/null +++ b/src/3rdparty/phonon/mmf/videooutput_surface.cpp @@ -0,0 +1,87 @@ +/* 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 <QResizeEvent> + +#include <QtCore/private/qcore_symbian_p.h> // for qt_TRect2QRect +#include <QtGui/private/qwidget_p.h> // to access QWExtra + +#include "utils.h" +#include "videooutput_surface.h" + +QT_BEGIN_NAMESPACE + +using namespace Phonon; +using namespace Phonon::MMF; + +SurfaceVideoOutput::SurfaceVideoOutput(QWidget *parent) + : AbstractVideoOutput(parent) +{ + TRACE_CONTEXT(SurfaceVideoOutput::SurfaceVideoOutput, EVideoInternal); + TRACE_ENTRY("parent 0x%08x", parent); + + qt_widget_private(this)->createExtra(); + qt_widget_private(this)->extraData()->nativePaintMode = QWExtra::Disable; + + TRACE_EXIT_0(); +} + +SurfaceVideoOutput::~SurfaceVideoOutput() +{ + TRACE_CONTEXT(SurfaceVideoOutput::~SurfaceVideoOutput, EVideoInternal); + TRACE_ENTRY_0(); + + TRACE_EXIT_0(); +} + +//----------------------------------------------------------------------------- +// Public functions +//----------------------------------------------------------------------------- + + +//----------------------------------------------------------------------------- +// Private functions +//----------------------------------------------------------------------------- + +void MMF::SurfaceVideoOutput::resizeEvent(QResizeEvent *event) +{ + TRACE_CONTEXT(SurfaceVideoOutput::resizeEvent, EVideoInternal); + TRACE("%d %d -> %d %d", + event->oldSize().width(), event->oldSize().height(), + event->size().width(), event->size().height()); + + if (event->size() != event->oldSize()) + emit videoWindowSizeChanged(); +} + +bool MMF::SurfaceVideoOutput::event(QEvent *event) +{ + TRACE_CONTEXT(SurfaceVideoOutput::event, EVideoInternal); + + if (event->type() == QEvent::WinIdChange) { + TRACE_0("WinIdChange"); + emit videoWindowChanged(); + return true; + } else { + return QWidget::event(event); + } +} + + +QT_END_NAMESPACE + diff --git a/src/3rdparty/phonon/mmf/videooutput_surface.h b/src/3rdparty/phonon/mmf/videooutput_surface.h new file mode 100644 index 0000000..0b22a710 --- /dev/null +++ b/src/3rdparty/phonon/mmf/videooutput_surface.h @@ -0,0 +1,66 @@ +/* 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_SURFACE_H +#define PHONON_MMF_VIDEOOUTPUT_SURFACE_H + +#include "phonon/mmf/abstractvideooutput.h" + +QT_BEGIN_NAMESPACE + +class QResizeEvent; + +namespace Phonon +{ +namespace MMF +{ + +/** + * @short Widget on which video is displayed by rendering to a surface + * + * This implementation is used on devices with a graphics subsystem which + * supports surfaces. + * + * @see DsaVideoOutput + */ +class SurfaceVideoOutput + : public AbstractVideoOutput +{ + Q_OBJECT + +public: + SurfaceVideoOutput(QWidget *parent); + ~SurfaceVideoOutput(); + +Q_SIGNALS: + void videoWindowSizeChanged(); + +private: + // QWidget + void resizeEvent(QResizeEvent *event); + bool event(QEvent *event); + +}; + +} +} + +QT_END_NAMESPACE + +#endif // !PHONON_MMF_VIDEOOUTPUT_SURFACE_H + diff --git a/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp b/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp new file mode 100644 index 0000000..21cdb16 --- /dev/null +++ b/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp @@ -0,0 +1,285 @@ +/* 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 <coecntrl.h> // for CCoeControl + +#include <QApplication> // for QApplication::activeWindow +#include <QtCore/private/qcore_symbian_p.h> // for qt_TRect2QRect + +#include "utils.h" +#include "videooutput_dsa.h" +#include "videoplayer_dsa.h" + +QT_BEGIN_NAMESPACE + +using namespace Phonon; +using namespace Phonon::MMF; + +// Two-phase constructor idiom is used because construct() calls virtual +// functions and therefore cannot be called from the AbstractVideoPlayer +// C++ constructor. +DsaVideoPlayer* DsaVideoPlayer::create(MediaObject *parent, + const AbstractPlayer *player) +{ + QScopedPointer<DsaVideoPlayer> self(new DsaVideoPlayer(parent, player)); + self->construct(); + return self.take(); +} + +DsaVideoPlayer::DsaVideoPlayer(MediaObject *parent, const AbstractPlayer *player) + : AbstractVideoPlayer(parent, player) + , m_dsaActive(false) + , m_dsaWasActive(false) +{ + +} + +DsaVideoPlayer::~DsaVideoPlayer() +{ + +} + + +//----------------------------------------------------------------------------- +// Public functions +//----------------------------------------------------------------------------- + +void MMF::DsaVideoPlayer::videoWindowScreenRectChanged() +{ + QRect windowRect = static_cast<DsaVideoOutput *>(m_videoOutput)->videoWindowScreenRect(); + + // Clip to physical window size + // This is due to a defect in the layout when running on S60 3.2, which + // results in the rectangle of the video widget extending outside the + // screen in certain circumstances. These include the initial startup + // of the mediaplayer demo in portrait mode. When this rectangle is + // passed to the CVideoPlayerUtility, no video is rendered. + const TSize screenSize = m_screenDevice.SizeInPixels(); + const QRect screenRect(0, 0, screenSize.iWidth, screenSize.iHeight); + windowRect = windowRect.intersected(screenRect); + + // Recalculate scale factors. Pass 'false' as second parameter in order to + // suppress application of the change to the player - this is done at the end + // of the function. + updateScaleFactors(windowRect.size(), false); + + m_videoScreenRect = qt_QRect2TRect(windowRect); + + parametersChanged(WindowScreenRect | ScaleFactors); +} + +void MMF::DsaVideoPlayer::suspendDirectScreenAccess() +{ + m_dsaWasActive = stopDirectScreenAccess(); +} + +void MMF::DsaVideoPlayer::resumeDirectScreenAccess() +{ + if (m_dsaWasActive) { + startDirectScreenAccess(); + m_dsaWasActive = false; + } +} + + +//----------------------------------------------------------------------------- +// Private functions +//----------------------------------------------------------------------------- + +void MMF::DsaVideoPlayer::createPlayer() +{ + // A window handle must be provided in order to construct + // CVideoPlayerUtility. If no VideoOutput has yet been connected to this + // player, we temporarily use the top-level application window handle. + // No video ever gets rendered into this window; SetDisplayWindowL is + // always called before rendering actually begins. + if (!m_window) + m_window = QApplication::activeWindow()->effectiveWinId()->DrawableWindow(); + + const TInt priority = 0; + const TMdaPriorityPreference preference = EMdaPriorityPreferenceNone; + + CVideoPlayerUtility *player = 0; + QT_TRAP_THROWING(player = CVideoPlayerUtility::NewL(*this, + priority, preference, + m_wsSession, m_screenDevice, + *m_window, + m_videoScreenRect, m_videoScreenRect)); + m_player.reset(player); + + // CVideoPlayerUtility::NewL starts DSA + m_dsaActive = true; + + m_player->RegisterForVideoLoadingNotification(*this); +} + +void MMF::DsaVideoPlayer::initVideoOutput() +{ + bool connected = connect( + m_videoOutput, SIGNAL(videoWindowScreenRectChanged()), + this, SLOT(videoWindowScreenRectChanged()) + ); + Q_ASSERT(connected); + + connected = connect( + m_videoOutput, SIGNAL(beginVideoWindowNativePaint()), + this, SLOT(suspendDirectScreenAccess()) + ); + Q_ASSERT(connected); + + connected = connect( + m_videoOutput, SIGNAL(endVideoWindowNativePaint()), + this, SLOT(resumeDirectScreenAccess()) + ); + Q_ASSERT(connected); + + // Suppress warnings in release builds + Q_UNUSED(connected); + + AbstractVideoPlayer::initVideoOutput(); +} + +void MMF::DsaVideoPlayer::prepareCompleted() +{ + videoWindowScreenRectChanged(); +} + +void MMF::DsaVideoPlayer::handleVideoWindowChanged() +{ + if (!m_window) { + m_window = QApplication::activeWindow()->effectiveWinId()->DrawableWindow(); + m_videoScreenRect = TRect(); + } + + parametersChanged(WindowHandle | WindowScreenRect); +} + +#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(); } +}; + +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(); + } +} + +#endif // QT_NO_DEBUG + +void MMF::DsaVideoPlayer::handleParametersChanged(VideoParameters parameters) +{ + TRACE_CONTEXT(DsaVideoPlayer::handleParametersChanged, EVideoInternal); + TRACE_ENTRY_0(); + +#ifndef QT_NO_DEBUG + getDsaRegion(m_wsSession, *m_window); +#endif + + static const TBool antialias = ETrue; + int err = KErrNone; + + if (parameters & ScaleFactors) { + TRAP(err, m_player->SetScaleFactorL(m_scaleWidth, m_scaleHeight, + antialias)); + if(KErrNone != err) { + TRACE("SetScaleFactorL (1) err %d", err); + setError(tr("Video display error"), err); + } + } + + if (KErrNone == err) { + if (parameters & WindowHandle || parameters & WindowScreenRect) { + TRAP(err, + m_player->SetDisplayWindowL(m_wsSession, m_screenDevice, + *m_window, + m_videoScreenRect, + m_videoScreenRect)); + } + + if (KErrNone != err) { + TRACE("SetDisplayWindowL err %d", err); + setError(tr("Video display error"), err); + } else { + m_dsaActive = true; + if (parameters & ScaleFactors) { + TRAP(err, m_player->SetScaleFactorL(m_scaleWidth, m_scaleHeight, + antialias)); + if (KErrNone != err) { + TRACE("SetScaleFactorL (2) err %d", err); + setError(tr("Video display error"), err); + } + } + } + } + + TRACE_EXIT_0(); +} + +void MMF::DsaVideoPlayer::startDirectScreenAccess() +{ + if (!m_dsaActive) { + TRAPD(err, m_player->StartDirectScreenAccessL()); + if (KErrNone == err) + m_dsaActive = true; + else + setError(tr("Video display error"), err); + } +} + +bool MMF::DsaVideoPlayer::stopDirectScreenAccess() +{ + const bool dsaWasActive = m_dsaActive; + if (m_dsaActive) { + TRAPD(err, m_player->StopDirectScreenAccessL()); + if (KErrNone == err) + m_dsaActive = false; + else + setError(tr("Video display error"), err); + } + return dsaWasActive; +} + +QT_END_NAMESPACE + diff --git a/src/3rdparty/phonon/mmf/videoplayer_dsa.h b/src/3rdparty/phonon/mmf/videoplayer_dsa.h new file mode 100644 index 0000000..45cc47d --- /dev/null +++ b/src/3rdparty/phonon/mmf/videoplayer_dsa.h @@ -0,0 +1,92 @@ +/* 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_DSA_H +#define PHONON_MMF_VIDEOPLAYER_DSA_H + +#include "abstractvideoplayer.h" + +QT_BEGIN_NAMESPACE + +namespace Phonon +{ +namespace MMF +{ + +/** + * @short Wrapper over the MMF video player utility (DSA version) + * + * This implementation is used on devices with the legacy graphics + * subsystem, which does not support surfaces. On such devices, + * video rendering is done via Direct Screen Access (DSA), whereby + * the video decoder writes directly to the framebuffer. To ensure + * that the window server and video decoder do not try to draw to + * the same screen region at the same time, the video subsystem + * first requests permission to perform DSA. If the window server + * needs to draw to this screen region (for example to display a + * message dialog), it first notifies the video subsystem that it + * must stop rendering to this region. + * + * @see SurfaceVideoPlayer + */ +class DsaVideoPlayer + : public AbstractVideoPlayer +{ + Q_OBJECT + +public: + // Factory function + static DsaVideoPlayer* create(MediaObject *parent = 0, + const AbstractPlayer *player = 0); + ~DsaVideoPlayer(); + +public Q_SLOTS: + void videoWindowScreenRectChanged(); + void suspendDirectScreenAccess(); + void resumeDirectScreenAccess(); + +private: + DsaVideoPlayer(MediaObject *parent, const AbstractPlayer *player); + + // AbstractVideoPlayer + void createPlayer(); + void initVideoOutput(); + void prepareCompleted(); + void handleVideoWindowChanged(); + void handleParametersChanged(VideoParameters parameters); + + void startDirectScreenAccess(); + bool stopDirectScreenAccess(); + +private: + bool m_dsaActive; + bool m_dsaWasActive; + + // Absolute screen rectangle on which video is displayed + TRect m_videoScreenRect; + +}; + +} +} + +QT_END_NAMESPACE + +#endif // !PHONON_MMF_VIDEOPLAYER_DSA_H + + diff --git a/src/3rdparty/phonon/mmf/videoplayer_surface.cpp b/src/3rdparty/phonon/mmf/videoplayer_surface.cpp new file mode 100644 index 0000000..5f234e5 --- /dev/null +++ b/src/3rdparty/phonon/mmf/videoplayer_surface.cpp @@ -0,0 +1,150 @@ +/* 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 <videoplayer2.h> + +#include <QtCore/private/qcore_symbian_p.h> // for qt_QRect2TRect + +#include "utils.h" +#include "videooutput_surface.h" +#include "videoplayer_surface.h" + +QT_BEGIN_NAMESPACE + +using namespace Phonon; +using namespace Phonon::MMF; + +// Two-phase constructor idiom is used because construct() calls virtual +// functions and therefore cannot be called from the AbstractVideoPlayer +// C++ constructor. +SurfaceVideoPlayer* SurfaceVideoPlayer::create(MediaObject *parent, + const AbstractPlayer *player) +{ + QScopedPointer<SurfaceVideoPlayer> self(new SurfaceVideoPlayer(parent, player)); + self->construct(); + return self.take(); +} + +SurfaceVideoPlayer::SurfaceVideoPlayer(MediaObject *parent, const AbstractPlayer *player) + : AbstractVideoPlayer(parent, player) + , m_displayWindow(0) +{ + +} + +SurfaceVideoPlayer::~SurfaceVideoPlayer() +{ + +} + + +//----------------------------------------------------------------------------- +// Public functions +//----------------------------------------------------------------------------- + +void MMF::SurfaceVideoPlayer::videoWindowSizeChanged() +{ + updateScaleFactors(m_videoOutput->videoWindowSize()); +} + + +//----------------------------------------------------------------------------- +// Private functions +//----------------------------------------------------------------------------- + +void MMF::SurfaceVideoPlayer::createPlayer() +{ + const TInt priority = 0; + const TMdaPriorityPreference preference = EMdaPriorityPreferenceNone; + + CVideoPlayerUtility2 *player = 0; + QT_TRAP_THROWING(player = CVideoPlayerUtility2::NewL(*this, + priority, preference)); + m_player.reset(player); +} + +void MMF::SurfaceVideoPlayer::initVideoOutput() +{ + bool connected = connect( + m_videoOutput, SIGNAL(videoWindowSizeChanged()), + this, SLOT(videoWindowSizeChanged()) + ); + Q_ASSERT(connected); + + // Suppress warnings in release builds + Q_UNUSED(connected); + + AbstractVideoPlayer::initVideoOutput(); +} + +void MMF::SurfaceVideoPlayer::prepareCompleted() +{ + videoWindowSizeChanged(); +} + +void MMF::SurfaceVideoPlayer::handleVideoWindowChanged() +{ + parametersChanged(WindowHandle); +} + +void MMF::SurfaceVideoPlayer::handleParametersChanged(VideoParameters parameters) +{ + CVideoPlayerUtility2 *player = static_cast<CVideoPlayerUtility2 *>(m_player.data()); + + int err = KErrNone; + + TRect rect; + + if (m_videoOutput) { + m_videoOutput->dump(); + const QSize size = m_videoOutput->videoWindowSize(); + rect.SetSize(TSize(size.width(), size.height())); + } + + if (parameters & WindowHandle) { + if (m_displayWindow) + player->RemoveDisplayWindow(*m_displayWindow); + + RWindow *window = static_cast<RWindow *>(m_window); + if (window) { + window->SetBackgroundColor(TRgb(0, 0, 0, 255)); + TRAP(err, player->AddDisplayWindowL(m_wsSession, m_screenDevice, *window, rect, rect)); + if (KErrNone != err) { + setError(tr("Video display error"), err); + window = 0; + } + } + m_displayWindow = window; + } + + if (KErrNone == err) { + if (parameters & ScaleFactors) { + Q_ASSERT(m_displayWindow); + TRAP(err, player->SetVideoExtentL(*m_displayWindow, rect)); + if (KErrNone == err) + TRAP(err, player->SetWindowClipRectL(*m_displayWindow, rect)); + if (KErrNone == err) + TRAP(err, player->SetScaleFactorL(*m_displayWindow, m_scaleWidth, m_scaleHeight)); + if (KErrNone != err) + setError(tr("Video display error"), err); + } + } +} + +QT_END_NAMESPACE + diff --git a/src/3rdparty/phonon/mmf/videoplayer_surface.h b/src/3rdparty/phonon/mmf/videoplayer_surface.h new file mode 100644 index 0000000..c05da9c --- /dev/null +++ b/src/3rdparty/phonon/mmf/videoplayer_surface.h @@ -0,0 +1,78 @@ +/* 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_SURFACE_H +#define PHONON_MMF_VIDEOPLAYER_SURFACE_H + +#include "abstractvideoplayer.h" + +class RWindow; + +QT_BEGIN_NAMESPACE + +namespace Phonon +{ +namespace MMF +{ + +/** + * @short Wrapper over the MMF video player utility (surface version) + * + * This implementation is used on devices with a graphics subsystem which + * supports surfaces. + * + * @see DsaVideoPlayer + */ +class SurfaceVideoPlayer + : public AbstractVideoPlayer +{ + Q_OBJECT + +public: + // Factory function + static SurfaceVideoPlayer* create(MediaObject *parent = 0, + const AbstractPlayer *player = 0); + ~SurfaceVideoPlayer(); + +public Q_SLOTS: + void videoWindowSizeChanged(); + +private: + SurfaceVideoPlayer(MediaObject *parent, const AbstractPlayer *player); + + // AbstractVideoPlayer + void createPlayer(); + void initVideoOutput(); + void prepareCompleted(); + void handleVideoWindowChanged(); + void handleParametersChanged(VideoParameters parameters); + +private: + // Window handle which has been passed to the MMF via + // CVideoPlayerUtility2::SetDisplayWindowL + RWindow* m_displayWindow; + +}; + +} +} + +QT_END_NAMESPACE + +#endif // !PHONON_MMF_VIDEOPLAYER_SURFACE_H + diff --git a/src/3rdparty/phonon/mmf/videowidget.cpp b/src/3rdparty/phonon/mmf/videowidget.cpp index bc9acfd..4ed9979 100644 --- a/src/3rdparty/phonon/mmf/videowidget.cpp +++ b/src/3rdparty/phonon/mmf/videowidget.cpp @@ -18,10 +18,15 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include "mediaobject.h" #include "utils.h" -#include "videooutput.h" #include "videowidget.h" +#ifdef PHONON_MMF_VIDEO_SURFACES +#include "videooutput_surface.h" +#else +#include "videooutput_dsa.h" +#endif + QT_BEGIN_NAMESPACE using namespace Phonon; @@ -45,10 +50,13 @@ static const qreal DefaultSaturation = 1.0; // Constructor / destructor //----------------------------------------------------------------------------- -MMF::VideoWidget::VideoWidget - (AncestorMoveMonitor* ancestorMoveMonitor, QWidget* parent) +MMF::VideoWidget::VideoWidget(QWidget *parent) : MediaNode(parent) - , m_videoOutput(new VideoOutput(ancestorMoveMonitor, parent)) +#ifdef PHONON_MMF_VIDEO_SURFACES + , m_videoOutput(new SurfaceVideoOutput(parent)) +#else + , m_videoOutput(new DsaVideoOutput(parent)) +#endif , m_brightness(DefaultBrightness) , m_contrast(DefaultContrast) , m_hue(DefaultHue) @@ -68,6 +76,13 @@ MMF::VideoWidget::~VideoWidget() TRACE_EXIT_0(); } +#ifndef PHONON_MMF_VIDEO_SURFACES +void MMF::VideoWidget::setAncestorMoveMonitor(AncestorMoveMonitor *monitor) +{ + static_cast<DsaVideoOutput *>(m_videoOutput.data())->setAncestorMoveMonitor(monitor); +} +#endif + //----------------------------------------------------------------------------- // VideoWidgetInterface diff --git a/src/3rdparty/phonon/mmf/videowidget.h b/src/3rdparty/phonon/mmf/videowidget.h index 899dca6..3b6283e 100644 --- a/src/3rdparty/phonon/mmf/videowidget.h +++ b/src/3rdparty/phonon/mmf/videowidget.h @@ -19,8 +19,8 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #ifndef PHONON_MMF_VIDEOWIDGET_H #define PHONON_MMF_VIDEOWIDGET_H +#include "abstractvideooutput.h" #include "mmf_medianode.h" -#include "videooutput.h" #include <QtGui/QWidget> #include <phonon/videowidget.h> @@ -32,8 +32,9 @@ namespace Phonon { namespace MMF { +#ifndef PHONON_MMF_VIDEO_SURFACES class AncestorMoveMonitor; -class VideoOutput; +#endif class VideoWidget : public MediaNode , public Phonon::VideoWidgetInterface @@ -42,9 +43,13 @@ class VideoWidget : public MediaNode Q_INTERFACES(Phonon::VideoWidgetInterface) public: - VideoWidget(AncestorMoveMonitor* ancestorMoveMonitor, QWidget* parent); + VideoWidget(QWidget* parent); ~VideoWidget(); +#ifndef PHONON_MMF_VIDEO_SURFACES + void setAncestorMoveMonitor(AncestorMoveMonitor *ancestorMoveMonitor); +#endif + // VideoWidgetInterface virtual Phonon::VideoWidget::AspectRatio aspectRatio() const; virtual void setAspectRatio(Phonon::VideoWidget::AspectRatio aspectRatio); @@ -66,7 +71,7 @@ protected: void disconnectMediaObject(MediaObject *mediaObject); private: - QScopedPointer<VideoOutput> m_videoOutput; + QScopedPointer<AbstractVideoOutput> m_videoOutput; qreal m_brightness; qreal m_contrast; diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp index ceb5ee1..a80c5d3 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp @@ -30,6 +30,7 @@ #include <QtGui/qapplication.h> #include <QtGui/qgraphicssceneevent.h> #include <QtGui/qstyleoption.h> +#include <QtGui/qinputcontext.h> #if defined(Q_WS_X11) #include <QX11Info> #endif @@ -63,6 +64,8 @@ public: void _q_doLoadFinished(bool success); + void _q_updateMicroFocus(); + QGraphicsWebView* q; QWebPage* page; }; @@ -80,6 +83,20 @@ void QGraphicsWebViewPrivate::_q_doLoadFinished(bool success) emit q->loadFinished(success); } +void QGraphicsWebViewPrivate::_q_updateMicroFocus() +{ +#if !defined(QT_NO_IM) && (defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)) + // Ideally, this should be handled by a common call to an updateMicroFocus function + // in QGraphicsItem. See http://bugreports.qt.nokia.com/browse/QTBUG-7578. + QList<QGraphicsView*> views = q->scene()->views(); + for (int c = 0; c < views.size(); ++c) { + QInputContext* ic = views.at(c)->inputContext(); + if (ic) + ic->update(); + } +#endif +} + void QGraphicsWebViewPrivate::scroll(int dx, int dy, const QRect& rectToScroll) { q->scroll(qreal(dx), qreal(dy), QRectF(rectToScroll)); @@ -435,6 +452,8 @@ void QGraphicsWebView::setPage(QWebPage* page) this, SIGNAL(statusBarMessage(QString))); connect(d->page, SIGNAL(linkClicked(QUrl)), this, SIGNAL(linkClicked(QUrl))); + connect(d->page, SIGNAL(microFocusChanged()), + this, SLOT(_q_updateMicroFocus())); } /*! diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.h b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.h index f3afb4c..68379a2 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.h @@ -140,3 +140,4 @@ private: }; #endif // QGraphicsWebView_h + Q_PRIVATE_SLOT(d, void _q_updateMicroFocus()) diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index e54c176..a5441cd 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,15 @@ +2010-03-21 Kristian Amlie <kristian.amlie@nokia.com> + + Reviewed by Simon Hausmann. + + Fixed updating the VKB display when inputting into QGraphicsWebView. + https://bugs.webkit.org/show_bug.cgi?id=36292 + + * Api/qgraphicswebview.cpp: + (QGraphicsWebViewPrivate::_q_updateMicroFocus): + (QGraphicsWebView::setPage): + * Api/qgraphicswebview.h: + 2010-03-04 Simon Hausmann <simon.hausmann@nokia.com> Reviewed by Kenneth Rohde Christiansen. diff --git a/src/corelib/animation/qanimationgroup.cpp b/src/corelib/animation/qanimationgroup.cpp index a89f949..2decda3 100644 --- a/src/corelib/animation/qanimationgroup.cpp +++ b/src/corelib/animation/qanimationgroup.cpp @@ -244,7 +244,7 @@ QAbstractAnimation *QAnimationGroup::takeAnimation(int index) // in ChildRemoved event d->animations.removeAt(index); animation->setParent(0); - d->animationRemovedAt(index); + d->animationRemoved(index, animation); return animation; } @@ -285,7 +285,7 @@ bool QAnimationGroup::event(QEvent *event) } -void QAnimationGroupPrivate::animationRemovedAt(int index) +void QAnimationGroupPrivate::animationRemoved(int index, QAbstractAnimation *) { Q_Q(QAnimationGroup); Q_UNUSED(index); diff --git a/src/corelib/animation/qanimationgroup_p.h b/src/corelib/animation/qanimationgroup_p.h index 394773b..45603b3 100644 --- a/src/corelib/animation/qanimationgroup_p.h +++ b/src/corelib/animation/qanimationgroup_p.h @@ -72,8 +72,19 @@ public: isGroup = true; } - virtual void animationInsertedAt(int index) { Q_UNUSED(index) }; - virtual void animationRemovedAt(int index); + virtual void animationInsertedAt(int) { } + virtual void animationRemoved(int, QAbstractAnimation *); + + void disconnectUncontrolledAnimation(QAbstractAnimation *anim) + { + //0 for the signal here because we might be called from the animation destructor + QObject::disconnect(anim, 0, q_func(), SLOT(_q_uncontrolledAnimationFinished())); + } + + void connectUncontrolledAnimation(QAbstractAnimation *anim) + { + QObject::connect(anim, SIGNAL(finished()), q_func(), SLOT(_q_uncontrolledAnimationFinished())); + } QList<QAbstractAnimation *> animations; }; diff --git a/src/corelib/animation/qparallelanimationgroup.cpp b/src/corelib/animation/qparallelanimationgroup.cpp index eaa0364..280afed 100644 --- a/src/corelib/animation/qparallelanimationgroup.cpp +++ b/src/corelib/animation/qparallelanimationgroup.cpp @@ -246,11 +246,9 @@ void QParallelAnimationGroupPrivate::_q_uncontrolledAnimationFinished() void QParallelAnimationGroupPrivate::disconnectUncontrolledAnimations() { - Q_Q(QParallelAnimationGroup); - QHash<QAbstractAnimation *, int>::iterator it = uncontrolledFinishTime.begin(); while (it != uncontrolledFinishTime.end()) { - QObject::disconnect(it.key(), SIGNAL(finished()), q, SLOT(_q_uncontrolledAnimationFinished())); + disconnectUncontrolledAnimation(it.key()); ++it; } @@ -259,13 +257,11 @@ void QParallelAnimationGroupPrivate::disconnectUncontrolledAnimations() void QParallelAnimationGroupPrivate::connectUncontrolledAnimations() { - Q_Q(QParallelAnimationGroup); - for (int i = 0; i < animations.size(); ++i) { QAbstractAnimation *animation = animations.at(i); if (animation->duration() == -1 || animation->loopCount() < 0) { uncontrolledFinishTime[animation] = -1; - QObject::connect(animation, SIGNAL(finished()), q, SLOT(_q_uncontrolledAnimationFinished())); + connectUncontrolledAnimation(animation); } } } @@ -305,6 +301,13 @@ bool QParallelAnimationGroupPrivate::isUncontrolledAnimationFinished(QAbstractAn return uncontrolledFinishTime.value(anim, -1) >= 0; } +void QParallelAnimationGroupPrivate::animationRemoved(int index, QAbstractAnimation *anim) +{ + QAnimationGroupPrivate::animationRemoved(index, anim); + disconnectUncontrolledAnimation(anim); + uncontrolledFinishTime.remove(anim); +} + /*! \reimp */ diff --git a/src/corelib/animation/qparallelanimationgroup_p.h b/src/corelib/animation/qparallelanimationgroup_p.h index a74d496..cab4fa9 100644 --- a/src/corelib/animation/qparallelanimationgroup_p.h +++ b/src/corelib/animation/qparallelanimationgroup_p.h @@ -80,6 +80,8 @@ public: void connectUncontrolledAnimations(); void disconnectUncontrolledAnimations(); + void animationRemoved(int index, QAbstractAnimation *); + // private slot void _q_uncontrolledAnimationFinished(); }; diff --git a/src/corelib/animation/qsequentialanimationgroup.cpp b/src/corelib/animation/qsequentialanimationgroup.cpp index 8ab084a..7617c1f 100644 --- a/src/corelib/animation/qsequentialanimationgroup.cpp +++ b/src/corelib/animation/qsequentialanimationgroup.cpp @@ -479,7 +479,7 @@ void QSequentialAnimationGroupPrivate::activateCurrentAnimation(bool intermediat // connects to the finish signal of uncontrolled animations if (currentAnimation->totalDuration() == -1) - QObject::connect(currentAnimation, SIGNAL(finished()), q, SLOT(_q_uncontrolledAnimationFinished())); + connectUncontrolledAnimation(currentAnimation); currentAnimation->start(); if (!intermediate && state == QSequentialAnimationGroup::Paused) @@ -496,7 +496,7 @@ void QSequentialAnimationGroupPrivate::_q_uncontrolledAnimationFinished() actualDuration.append(-1); actualDuration[currentAnimationIndex] = currentAnimation->currentTime(); - QObject::disconnect(currentAnimation, SIGNAL(finished()), q, SLOT(_q_uncontrolledAnimationFinished())); + disconnectUncontrolledAnimation(currentAnimation); if ((direction == QAbstractAnimation::Forward && currentAnimation == animations.last()) || (direction == QAbstractAnimation::Backward && currentAnimationIndex == 0)) { @@ -543,10 +543,10 @@ void QSequentialAnimationGroupPrivate::animationInsertedAt(int index) the group at index \a index. The animation is no more listed when this method is called. */ -void QSequentialAnimationGroupPrivate::animationRemovedAt(int index) +void QSequentialAnimationGroupPrivate::animationRemoved(int index, QAbstractAnimation *anim) { Q_Q(QSequentialAnimationGroup); - QAnimationGroupPrivate::animationRemovedAt(index); + QAnimationGroupPrivate::animationRemoved(index, anim); Q_ASSERT(currentAnimation); // currentAnimation should always be set @@ -555,7 +555,10 @@ void QSequentialAnimationGroupPrivate::animationRemovedAt(int index) const int currentIndex = animations.indexOf(currentAnimation); if (currentIndex == -1) { - //we're removing the current animation, let's update it to another one + //we're removing the current animation + + disconnectUncontrolledAnimation(currentAnimation); + if (index < animations.count()) setCurrentAnimation(index); //let's try to take the next one else if (index > 0) diff --git a/src/corelib/animation/qsequentialanimationgroup_p.h b/src/corelib/animation/qsequentialanimationgroup_p.h index a55e136..de69916 100644 --- a/src/corelib/animation/qsequentialanimationgroup_p.h +++ b/src/corelib/animation/qsequentialanimationgroup_p.h @@ -85,7 +85,7 @@ public: void activateCurrentAnimation(bool intermediate = false); void animationInsertedAt(int index); - void animationRemovedAt(int index); + void animationRemoved(int index, QAbstractAnimation *anim); bool atEnd() const; diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 6437fb7..3118f8f 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -2429,12 +2429,15 @@ QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathSysconf(); #define Q_SYMBIAN_FIXED_POINTER_CURSORS #define Q_SYMBIAN_HAS_EXTENDED_BITMAP_TYPE #define Q_SYMBIAN_WINDOW_SIZE_CACHE -//enabling new graphics resources -#define QT_SYMBIAN_SUPPORTS_SGIMAGE #define QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER +//enabling new graphics resources +#ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE +# define QT_SYMBIAN_SUPPORTS_SGIMAGE +#endif + #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS -#define Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE +# define Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE #endif #endif diff --git a/src/corelib/io/qprocess_symbian.cpp b/src/corelib/io/qprocess_symbian.cpp index 8902f7d..92212fe 100644 --- a/src/corelib/io/qprocess_symbian.cpp +++ b/src/corelib/io/qprocess_symbian.cpp @@ -237,11 +237,15 @@ static void qt_create_symbian_commandline(const QStringList &arguments, QString --i; endQuote += QLatin1String("\\"); } - commandLine += QLatin1String(" \"") + tmp.left(i) + endQuote; + commandLine += QLatin1String("\"") + tmp.left(i) + endQuote + QLatin1Char(' '); } else { - commandLine += QLatin1Char(' ') + tmp; + commandLine += tmp + QLatin1Char(' '); } } + + // Chop the extra trailing space if any arguments were appended + if (arguments.size()) + commandLine.chop(1); } static TInt qt_create_symbian_process(RProcess **proc, const QString &programName, const QStringList &arguments) diff --git a/src/corelib/kernel/qcore_symbian_p.cpp b/src/corelib/kernel/qcore_symbian_p.cpp index 0257ac4..402eccf 100644 --- a/src/corelib/kernel/qcore_symbian_p.cpp +++ b/src/corelib/kernel/qcore_symbian_p.cpp @@ -132,9 +132,10 @@ private: void init() { #ifdef Q_WS_S60 - _LIT(KLibName_3_1, "qts60plugin_3_1.dll"); - _LIT(KLibName_3_2, "qts60plugin_3_2.dll"); - _LIT(KLibName_5_0, "qts60plugin_5_0.dll"); + _LIT(KLibName_3_1, "qts60plugin_3_1" QT_LIBINFIX_UNICODE L".dll"); + _LIT(KLibName_3_2, "qts60plugin_3_2" QT_LIBINFIX_UNICODE L".dll"); + _LIT(KLibName_5_0, "qts60plugin_5_0" QT_LIBINFIX_UNICODE L".dll"); + TPtrC libName; TInt uidValue; switch (QSysInfo::s60Version()) { diff --git a/src/corelib/kernel/qcore_symbian_p.h b/src/corelib/kernel/qcore_symbian_p.h index 9f282d5..4a515ce 100644 --- a/src/corelib/kernel/qcore_symbian_p.h +++ b/src/corelib/kernel/qcore_symbian_p.h @@ -60,6 +60,15 @@ #include <qhash.h> #include <f32file.h> +#define QT_LSTRING2(x) L##x +#define QT_LSTRING(x) QT_LSTRING2(x) + +#if defined(QT_LIBINFIX) +# define QT_LIBINFIX_UNICODE QT_LSTRING(QT_LIBINFIX) +#else +# define QT_LIBINFIX_UNICODE L"" +#endif + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h index b045c42..555a1f5 100644 --- a/src/corelib/kernel/qobjectdefs.h +++ b/src/corelib/kernel/qobjectdefs.h @@ -78,6 +78,7 @@ class QString; #define Q_CLASSINFO(name, value) #define Q_INTERFACES(x) #define Q_PROPERTY(text) +#define Q_PRIVATE_PROPERTY(d, text) #define Q_OVERRIDE(text) #define Q_ENUMS(x) #define Q_FLAGS(x) @@ -178,6 +179,7 @@ private: #define Q_CLASSINFO(name, value) Q_CLASSINFO(name, value) #define Q_INTERFACES(x) Q_INTERFACES(x) #define Q_PROPERTY(text) Q_PROPERTY(text) +#define Q_PRIVATE_PROPERTY(d, text) Q_PRIVATE_PROPERTY(d, text) #define Q_OVERRIDE(text) Q_OVERRIDE(text) #define Q_ENUMS(x) Q_ENUMS(x) #define Q_FLAGS(x) Q_FLAGS(x) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 159c997..bcdc7d3 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -4301,6 +4301,12 @@ static void _q_paintIntoCache(QPixmap *pix, QGraphicsItem *item, const QRegion & if (!subPix.isNull()) { // Blit the subpixmap into the main pixmap. pixmapPainter.begin(pix); + if (item->cacheMode() == QGraphicsItem::DeviceCoordinateCache + && itemToPixmap.type() > QTransform::TxTranslate) { + pixmapPainter.setCompositionMode(QPainter::CompositionMode_SourceAtop); + } else { + pixmapPainter.setCompositionMode(QPainter::CompositionMode_Source); + } pixmapPainter.setClipRegion(pixmapExposed); pixmapPainter.drawPixmap(br.topLeft(), subPix); pixmapPainter.end(); diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index 87416b4..669dd61 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -384,7 +384,7 @@ void QGraphicsWidget::setGeometry(const QRectF &rect) } QSizeF oldSize = size(); QGraphicsLayoutItem::setGeometry(newGeom); - + emit geometryChanged(); // Send resize event bool resized = newGeom.size() != oldSize; if (resized) { diff --git a/src/gui/graphicsview/qgraphicswidget.h b/src/gui/graphicsview/qgraphicswidget.h index 4bea5be..87c669b 100644 --- a/src/gui/graphicsview/qgraphicswidget.h +++ b/src/gui/graphicsview/qgraphicswidget.h @@ -73,7 +73,7 @@ class Q_GUI_EXPORT QGraphicsWidget : public QGraphicsObject, public QGraphicsLay Q_PROPERTY(QPalette palette READ palette WRITE setPalette) Q_PROPERTY(QFont font READ font WRITE setFont) Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection RESET unsetLayoutDirection) - Q_PROPERTY(QSizeF size READ size WRITE resize) + Q_PROPERTY(QSizeF size READ size WRITE resize NOTIFY geometryChanged) Q_PROPERTY(QSizeF minimumSize READ minimumSize WRITE setMinimumSize) Q_PROPERTY(QSizeF preferredSize READ preferredSize WRITE setPreferredSize) Q_PROPERTY(QSizeF maximumSize READ maximumSize WRITE setMaximumSize) @@ -81,12 +81,11 @@ class Q_GUI_EXPORT QGraphicsWidget : public QGraphicsObject, public QGraphicsLay Q_PROPERTY(Qt::FocusPolicy focusPolicy READ focusPolicy WRITE setFocusPolicy) Q_PROPERTY(Qt::WindowFlags windowFlags READ windowFlags WRITE setWindowFlags) Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle) - Q_PROPERTY(QRectF geometry READ geometry WRITE setGeometry) + Q_PROPERTY(QRectF geometry READ geometry WRITE setGeometry NOTIFY geometryChanged) Q_PROPERTY(bool autoFillBackground READ autoFillBackground WRITE setAutoFillBackground) public: QGraphicsWidget(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0); ~QGraphicsWidget(); - QGraphicsLayout *layout() const; void setLayout(QGraphicsLayout *layout); void adjustSize(); @@ -179,6 +178,9 @@ public: using QObject::children; #endif +Q_SIGNALS: + void geometryChanged(); + public Q_SLOTS: bool close(); diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index fea8c37..9fe6c87 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -903,6 +903,14 @@ void QApplicationPrivate::initialize() { QWidgetPrivate::mapper = new QWidgetMapper; QWidgetPrivate::allWidgets = new QWidgetSet; + +#if !defined(Q_WS_X11) && !defined(Q_WS_QWS) + // initialize the graphics system - on X11 this is initialized inside + // qt_init() in qapplication_x11.cpp because of several reasons. + // On QWS, the graphics system is set by the QScreen plugin. + graphics_system = QGraphicsSystemFactory::create(graphics_system_name); +#endif + if (qt_appType != QApplication::Tty) (void) QApplication::style(); // trigger creation of application style // trigger registering of QVariant's GUI types @@ -936,13 +944,7 @@ void QApplicationPrivate::initialize() // Set up which span functions should be used in raster engine... qInitDrawhelperAsm(); - -#if !defined(Q_WS_X11) && !defined(Q_WS_QWS) - // initialize the graphics system - on X11 this is initialized inside - // qt_init() in qapplication_x11.cpp because of several reasons. - // On QWS, the graphics system is set by the QScreen plugin. - graphics_system = QGraphicsSystemFactory::create(graphics_system_name); -#endif + #ifndef QT_NO_WHEELEVENT QApplicationPrivate::wheel_scroll_lines = 3; #endif diff --git a/src/gui/kernel/qtooltip.cpp b/src/gui/kernel/qtooltip.cpp index c912129..1343959 100644 --- a/src/gui/kernel/qtooltip.cpp +++ b/src/gui/kernel/qtooltip.cpp @@ -368,7 +368,16 @@ void QTipLabel::placeTip(const QPoint &pos, QWidget *w) #ifdef Q_WS_MAC - QRect screen = QApplication::desktop()->availableGeometry(getTipScreen(pos, w)); + // When in full screen mode, there is no Dock nor Menu so we can use + // the whole screen for displaying the tooltip. However when not in + // full screen mode we need to save space for the dock, so we use + // availableGeometry instead. + extern bool qt_mac_app_fullscreen; //qapplication_mac.mm + QRect screen; + if(qt_mac_app_fullscreen) + screen = QApplication::desktop()->screenGeometry(getTipScreen(pos, w)); + else + screen = QApplication::desktop()->availableGeometry(getTipScreen(pos, w)); #else QRect screen = QApplication::desktop()->screenGeometry(getTipScreen(pos, w)); #endif diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index 10fb009..9660de5 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -369,7 +369,7 @@ Q_GUI_EXPORT void qt_x11_wait_for_window_manager(QWidget* w) // ConfigureNotify ... MapNotify ... Expose enum State { - Initial, Reparented, Mapped + Initial, Mapped } state = Initial; do { @@ -377,33 +377,15 @@ Q_GUI_EXPORT void qt_x11_wait_for_window_manager(QWidget* w) XNextEvent(X11->display, &ev); qApp->x11ProcessEvent(&ev); - if (w->windowFlags() & Qt::X11BypassWindowManagerHint) { - switch (state) { - case Initial: - case Reparented: - if (ev.type == MapNotify && ev.xany.window == winid) - state = Mapped; - break; - case Mapped: - if (ev.type == Expose && ev.xany.window == winid) - return; - break; - } - } else { - switch (state) { - case Initial: - if (ev.type == ReparentNotify && ev.xany.window == winid) - state = Reparented; - break; - case Reparented: - if (ev.type == MapNotify && ev.xany.window == winid) - state = Mapped; - break; - case Mapped: - if (ev.type == Expose && ev.xany.window == winid) - return; - break; - } + switch (state) { + case Initial: + if (ev.type == MapNotify && ev.xany.window == winid) + state = Mapped; + break; + case Mapped: + if (ev.type == Expose && ev.xany.window == winid) + return; + break; } } else { if (!XEventsQueued(X11->display, QueuedAfterFlush)) diff --git a/src/gui/s60framework/qs60mainapplication.cpp b/src/gui/s60framework/qs60mainapplication.cpp index 2a7c4aa..41ac1a8 100644 --- a/src/gui/s60framework/qs60mainapplication.cpp +++ b/src/gui/s60framework/qs60mainapplication.cpp @@ -41,6 +41,7 @@ // INCLUDE FILES #include <exception> +#include <private/qcore_symbian_p.h> #include "qs60maindocument.h" #include "qs60mainapplication_p.h" #include "qs60mainapplication.h" @@ -57,17 +58,17 @@ CApaApplication *newS60Application() return new QS60MainApplication; } -_LIT(KQtWrapperResourceFile, "\\resource\\apps\\s60main.rsc"); +_LIT(KQtWrapperResourceFile, "\\resource\\apps\\s60main" QT_LIBINFIX_UNICODE L".rsc"); /*! \class QS60MainApplication \since 4.6 \brief The QS60MainApplication class provides support for migration from S60. - + \warning This class is provided only to get access to S60 specific functionality in the application framework classes. It is not portable. We strongly recommend against using it in new applications. - + The QS60MainApplication provides a helper class for use in migrating from existing S60 based applications to Qt based applications. It is used in the exact same way as the \c CAknApplication class from diff --git a/src/gui/s60framework/qs60mainappui.cpp b/src/gui/s60framework/qs60mainappui.cpp index 012985b..3b5b9d3 100644 --- a/src/gui/s60framework/qs60mainappui.cpp +++ b/src/gui/s60framework/qs60mainappui.cpp @@ -45,7 +45,15 @@ #include <eikmenub.h> #include <eikmenup.h> #include <barsread.h> -#include <s60main.rsg> +#include <qconfig.h> +#if defined(QT_LIBINFIX_UNQUOTED) +// Two level macro needed for proper expansion of libinfix +# define QT_S60MAIN_RSG_2(x) <s60main##x##.rsg> +# define QT_S60MAIN_RSG(x) QT_S60MAIN_RSG_2(x) +# include QT_S60MAIN_RSG(QT_LIBINFIX_UNQUOTED) +#else +# include <s60main.rsg> +#endif #include <avkon.rsg> #include "qs60mainappui.h" diff --git a/src/gui/s60framework/s60framework.pri b/src/gui/s60framework/s60framework.pri index e177a33..f9d89dc 100644 --- a/src/gui/s60framework/s60framework.pri +++ b/src/gui/s60framework/s60framework.pri @@ -4,6 +4,7 @@ minimalAppResource31 = \ "SOURCEPATH s60framework" \ "START RESOURCE s60main.rss" \ + "TARGET s60main$${QT_LIBINFIX}" \ "HEADER" \ "TARGETPATH /resource/apps" \ "END" @@ -19,3 +20,5 @@ HEADERS += s60framework/qs60mainapplication_p.h \ s60framework/qs60mainapplication.h \ s60framework/qs60mainappui.h \ s60framework/qs60maindocument.h + +!isEmpty(QT_LIBINFIX): DEFINES += QT_LIBINFIX_UNQUOTED=$$QT_LIBINFIX
\ No newline at end of file diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index a2ebebb..750e19f 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -2069,11 +2069,11 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti break; case PE_IndicatorViewItemCheck: #ifndef QT_NO_ITEMVIEWS - if (const QListView *listItem = (qobject_cast<const QListView *>(widget))) { + if (const QAbstractItemView *itemView = (qobject_cast<const QAbstractItemView *>(widget))) { if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) { const bool checkBoxVisible = vopt->features & QStyleOptionViewItemV2::HasCheckIndicator; - const bool singleSelection = listItem->selectionMode() == - QAbstractItemView::SingleSelection || listItem->selectionMode() == QAbstractItemView::NoSelection; + const bool singleSelection = itemView->selectionMode() == + QAbstractItemView::SingleSelection || itemView->selectionMode() == QAbstractItemView::NoSelection; // draw either checkbox at the beginning if (checkBoxVisible && singleSelection) { drawPrimitive(PE_IndicatorCheckBox, option, painter, widget); @@ -2475,6 +2475,12 @@ int QS60Style::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w { int retValue = -1; switch (sh) { + case SH_RequestSoftwareInputPanel: + if (QS60StylePrivate::isSingleClickUi()) + retValue = RSIP_OnMouseClick; + else + retValue = RSIP_OnMouseClickAndAlreadyFocused; + break; case SH_ComboBox_Popup: retValue = true; break; @@ -2531,9 +2537,6 @@ int QS60Style::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w case SH_UnderlineShortcut: retValue = 0; break; - case SH_RequestSoftwareInputPanel: - retValue = RSIP_OnMouseClickAndAlreadyFocused; - break; case SH_FormLayoutWrapPolicy: retValue = QFormLayout::WrapLongRows; break; diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index ecac3d6..6138e85 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -1121,7 +1121,7 @@ QColor QS60StylePrivate::s60Color(QS60StyleEnums::ColorLists list, &KAknsIIDQsnParentColors, &KAknsIIDQsnTextColors }; - Q_ASSERT((int)list <= (int)sizeof(idMap)/sizeof(idMap[0])); + Q_ASSERT((int)list < (int)sizeof(idMap)/sizeof(idMap[0])); const QColor color = QS60StyleModeSpecifics::colorValue(*idMap[(int) list], index - 1); return option ? QS60StylePrivate::stateColor(color, option) : color; } diff --git a/src/gui/styles/qwindowsmobilestyle.cpp b/src/gui/styles/qwindowsmobilestyle.cpp index 6e77409..5f939d0 100644 --- a/src/gui/styles/qwindowsmobilestyle.cpp +++ b/src/gui/styles/qwindowsmobilestyle.cpp @@ -5076,6 +5076,10 @@ void QWindowsMobileStyle::drawPrimitive(PrimitiveElement element, const QStyleOp color = option->palette.buttonText().color(); QImage image; int xoffset, yoffset; + bool isTabBarArrow = widget && widget->parent() + && widget->inherits("QToolButton") + && widget->parent()->inherits("QTabBar"); + switch (element) { case PE_IndicatorArrowUp: image = d->imageArrowUp; @@ -5090,12 +5094,12 @@ void QWindowsMobileStyle::drawPrimitive(PrimitiveElement element, const QStyleOp case PE_IndicatorArrowLeft: image = d->imageArrowLeft; xoffset = 8; - yoffset = 2; + yoffset = isTabBarArrow ? 12 : 2; break; case PE_IndicatorArrowRight: image = d->imageArrowRight; xoffset = 8; - yoffset = 2; + yoffset = isTabBarArrow ? 12 : 2; break; case PE_IndicatorArrowUpBig: image = d->imageArrowUpBig; @@ -6949,10 +6953,11 @@ int QWindowsMobileStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, co case PM_SliderThickness: ret = d->doubleControls ? windowsMobileSliderThickness * 2: windowsMobileSliderThickness; break; - case PM_TabBarScrollButtonWidth: - ret = d->doubleControls ? 14 * 2 : 18; - case PM_CheckBoxLabelSpacing: - case PM_RadioButtonLabelSpacing: + case PM_TabBarScrollButtonWidth: + ret = d->doubleControls ? 14 * 2 : 18; + break; + case PM_CheckBoxLabelSpacing: + case PM_RadioButtonLabelSpacing: ret = d->doubleControls ? 6 * 2 : 6; break; // Returns the number of pixels to use for the business part of the diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index cc6793d..766053c 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1644,28 +1644,67 @@ namespace { struct LineBreakHelper { - LineBreakHelper() : glyphCount(0), maxGlyphs(0), manualWrap(false) {} + LineBreakHelper() + : glyphCount(0), maxGlyphs(0), currentPosition(0), fontEngine(0), logClusters(0), + manualWrap(false) + { + } + QScriptLine tmpData; QScriptLine spaceData; + QGlyphLayout glyphs; + int glyphCount; int maxGlyphs; + int currentPosition; QFixed minw; QFixed softHyphenWidth; QFixed rightBearing; + QFixed minimumRightBearing; + + QFontEngine *fontEngine; + const unsigned short *logClusters; bool manualWrap; bool checkFullOtherwiseExtend(QScriptLine &line); + + QFixed calculateNewWidth(const QScriptLine &line) const { + return line.textWidth + tmpData.textWidth + spaceData.textWidth + softHyphenWidth + - qMin(rightBearing, QFixed()); + } + + inline glyph_t currentGlyph() const + { + Q_ASSERT(currentPosition > 0); + return glyphs.glyphs[logClusters[currentPosition - 1]]; + } + + inline void adjustRightBearing() + { + if (currentPosition <= 0) + return; + + glyph_metrics_t gi = fontEngine->boundingBox(currentGlyph()); + if (gi.isValid()) + rightBearing = qMin(QFixed(), gi.xoff - gi.x - gi.width); + } + + inline void resetRightBearing() + { + rightBearing = QFixed(1); // Any positive number is defined as invalid since only + // negative right bearings are interesting to us. + } }; inline bool LineBreakHelper::checkFullOtherwiseExtend(QScriptLine &line) { LB_DEBUG("possible break width %f, spacew=%f", tmpData.textWidth.toReal(), spaceData.textWidth.toReal()); - QFixed newWidth = line.textWidth + tmpData.textWidth + spaceData.textWidth + softHyphenWidth + rightBearing; + QFixed newWidth = calculateNewWidth(line); if (line.length && !manualWrap && (newWidth > line.width || glyphCount > maxGlyphs)) return true; @@ -1741,13 +1780,12 @@ void QTextLine::layout_helper(int maxGlyphs) Qt::Alignment alignment = eng->option.alignment(); const HB_CharAttributes *attributes = eng->attributes(); - int pos = line.from; + lbh.currentPosition = line.from; int end = 0; - QGlyphLayout glyphs; - const unsigned short *logClusters = eng->layoutData->logClustersPtr; + lbh.logClusters = eng->layoutData->logClustersPtr; while (newItem < eng->layoutData->items.size()) { - lbh.rightBearing = 0; + lbh.resetRightBearing(); lbh.softHyphenWidth = 0; if (newItem != item) { item = newItem; @@ -1755,13 +1793,19 @@ void QTextLine::layout_helper(int maxGlyphs) if (!current.num_glyphs) { eng->shape(item); attributes = eng->attributes(); - logClusters = eng->layoutData->logClustersPtr; + lbh.logClusters = eng->layoutData->logClustersPtr; } - pos = qMax(line.from, current.position); + lbh.currentPosition = qMax(line.from, current.position); end = current.position + eng->length(item); - glyphs = eng->shapedGlyphs(¤t); + lbh.glyphs = eng->shapedGlyphs(¤t); } const QScriptItem ¤t = eng->layoutData->items[item]; + QFontEngine *fontEngine = eng->fontEngine(current); + if (lbh.fontEngine != fontEngine) { + lbh.fontEngine = fontEngine; + lbh.minimumRightBearing = qMin(QFixed(), + QFixed::fromReal(fontEngine->minRightBearing())); + } lbh.tmpData.leading = qMax(lbh.tmpData.leading + lbh.tmpData.ascent, current.leading + current.ascent) - qMax(lbh.tmpData.ascent, @@ -1791,8 +1835,8 @@ void QTextLine::layout_helper(int maxGlyphs) if (!line.length && !lbh.tmpData.length) line.setDefaultHeight(eng); if (eng->option.flags() & QTextOption::ShowLineAndParagraphSeparators) { - addNextCluster(pos, end, lbh.tmpData, lbh.glyphCount, - current, logClusters, glyphs); + addNextCluster(lbh.currentPosition, end, lbh.tmpData, lbh.glyphCount, + current, lbh.logClusters, lbh.glyphs); } else { lbh.tmpData.length++; } @@ -1811,10 +1855,10 @@ void QTextLine::layout_helper(int maxGlyphs) ++lbh.glyphCount; if (lbh.checkFullOtherwiseExtend(line)) goto found; - } else if (attributes[pos].whiteSpace) { - while (pos < end && attributes[pos].whiteSpace) - addNextCluster(pos, end, lbh.spaceData, lbh.glyphCount, - current, logClusters, glyphs); + } else if (attributes[lbh.currentPosition].whiteSpace) { + while (lbh.currentPosition < end && attributes[lbh.currentPosition].whiteSpace) + addNextCluster(lbh.currentPosition, end, lbh.spaceData, lbh.glyphCount, + current, lbh.logClusters, lbh.glyphs); if (!lbh.manualWrap && lbh.spaceData.textWidth > line.width) { lbh.spaceData.textWidth = line.width; // ignore spaces that fall out of the line. @@ -1823,19 +1867,19 @@ void QTextLine::layout_helper(int maxGlyphs) } else { bool sb_or_ws = false; do { - addNextCluster(pos, end, lbh.tmpData, lbh.glyphCount, - current, logClusters, glyphs); + addNextCluster(lbh.currentPosition, end, lbh.tmpData, lbh.glyphCount, + current, lbh.logClusters, lbh.glyphs); - if (attributes[pos].whiteSpace || attributes[pos-1].lineBreakType != HB_NoBreak) { + if (attributes[lbh.currentPosition].whiteSpace || attributes[lbh.currentPosition-1].lineBreakType != HB_NoBreak) { sb_or_ws = true; break; - } else if (breakany && attributes[pos].charStop) { + } else if (breakany && attributes[lbh.currentPosition].charStop) { break; } - } while (pos < end); + } while (lbh.currentPosition < end); lbh.minw = qMax(lbh.tmpData.textWidth, lbh.minw); - if (pos && attributes[pos - 1].lineBreakType == HB_SoftHyphen) { + if (lbh.currentPosition && attributes[lbh.currentPosition - 1].lineBreakType == HB_SoftHyphen) { // if we are splitting up a word because of // a soft hyphen then we ... // @@ -1853,43 +1897,40 @@ void QTextLine::layout_helper(int maxGlyphs) // and thus become invisible again. // if (line.length) - lbh.softHyphenWidth = glyphs.advances_x[logClusters[pos - 1]]; + lbh.softHyphenWidth = lbh.glyphs.advances_x[lbh.logClusters[lbh.currentPosition - 1]]; else if (breakany) - lbh.tmpData.textWidth += glyphs.advances_x[logClusters[pos - 1]]; + lbh.tmpData.textWidth += lbh.glyphs.advances_x[lbh.logClusters[lbh.currentPosition - 1]]; } // The actual width of the text needs to take the right bearing into account. The // right bearing is left-ward, which means that if the rightmost pixel is to the right // of the advance of the glyph, the bearing will be negative. We flip the sign // for the code to be more readable. Logic borrowed from qfontmetrics.cpp. - if (pos) { - QFontEngine *fontEngine = eng->fontEngine(current); - glyph_t glyph = glyphs.glyphs[logClusters[pos - 1]]; - glyph_metrics_t gi = fontEngine->boundingBox(glyph); - if (gi.isValid()) - lbh.rightBearing = qMax(QFixed(), -(gi.xoff - gi.x - gi.width)); - } + // We ignore the right bearing if the minimum negative bearing is too little to + // expand the text beyond the edge. + if (sb_or_ws|breakany) { + if (lbh.calculateNewWidth(line) + lbh.minimumRightBearing > line.width) + lbh.adjustRightBearing(); + if (lbh.checkFullOtherwiseExtend(line)) { + if (!breakany) { + line.textWidth += lbh.softHyphenWidth; + } - if ((sb_or_ws|breakany) && lbh.checkFullOtherwiseExtend(line)) { - if (!breakany) { - line.textWidth += lbh.softHyphenWidth; + goto found; } - - line.textAdvance = line.textWidth; - line.textWidth += lbh.rightBearing; - - goto found; } } - if (pos == end) + if (lbh.currentPosition == end) newItem = item + 1; } LB_DEBUG("reached end of line"); lbh.checkFullOtherwiseExtend(line); +found: + if (lbh.rightBearing > 0) // If right bearing has not yet been adjusted + lbh.adjustRightBearing(); line.textAdvance = line.textWidth; - line.textWidth += lbh.rightBearing; + line.textWidth -= qMin(QFixed(), lbh.rightBearing); -found: if (line.length == 0) { LB_DEBUG("no break available in line, adding temp: length %d, width %f, space: length %d, width %f", lbh.tmpData.length, lbh.tmpData.textWidth.toReal(), diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 806452c..1d8224c 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -353,6 +353,7 @@ void QHttpNetworkConnectionChannel::_q_receiveReply() replyPrivate->autoDecompress = false; } if (replyPrivate->statusCode == 100) { + replyPrivate->clearHttpLayerInformation(); replyPrivate->state = QHttpNetworkReplyPrivate::ReadingStatusState; break; // ignore } diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp index 984f557..338236e 100644 --- a/src/network/access/qhttpnetworkreply.cpp +++ b/src/network/access/qhttpnetworkreply.cpp @@ -219,7 +219,7 @@ QHttpNetworkReplyPrivate::~QHttpNetworkReplyPrivate() { } -void QHttpNetworkReplyPrivate::clear() +void QHttpNetworkReplyPrivate::clearHttpLayerInformation() { state = NothingDoneState; statusCode = 100; @@ -229,18 +229,24 @@ void QHttpNetworkReplyPrivate::clear() currentChunkSize = 0; currentChunkRead = 0; connectionCloseEnabled = true; - connection = 0; - connectionChannel = 0; #ifndef QT_NO_COMPRESS if (initInflate) inflateEnd(&inflateStrm); #endif initInflate = false; streamEnd = false; - autoDecompress = false; fields.clear(); } +// TODO: Isn't everything HTTP layer related? We don't need to set connection and connectionChannel to 0 at all +void QHttpNetworkReplyPrivate::clear() +{ + connection = 0; + connectionChannel = 0; + autoDecompress = false; + clearHttpLayerInformation(); +} + // QHttpNetworkReplyPrivate qint64 QHttpNetworkReplyPrivate::bytesAvailable() const { @@ -539,6 +545,11 @@ qint64 QHttpNetworkReplyPrivate::readHeader(QAbstractSocket *socket) || fragment.endsWith("\r\n\n") || fragment.endsWith("\n\n")) allHeaders = true; + + // there is another case: We have no headers. Then the fragment equals just the line ending + if ((fragment.length() == 2 && fragment.endsWith("\r\n")) + || (fragment.length() == 1 && fragment.endsWith("\n"))) + allHeaders = true; } } } while (!allHeaders && haveRead > 0); diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h index fa240ec..4011c78 100644 --- a/src/network/access/qhttpnetworkreply_p.h +++ b/src/network/access/qhttpnetworkreply_p.h @@ -172,6 +172,7 @@ public: bool findChallenge(bool forProxy, QByteArray &challenge) const; QAuthenticatorPrivate::Method authenticationMethod(bool isProxy) const; void clear(); + void clearHttpLayerInformation(); qint64 readReplyBodyRaw(QIODevice *in, QByteDataBuffer *out, qint64 size); qint64 readReplyBodyChunked(QIODevice *in, QByteDataBuffer *out); diff --git a/src/openvg/openvg.pro b/src/openvg/openvg.pro index c8c9917..3790492 100644 --- a/src/openvg/openvg.pro +++ b/src/openvg/openvg.pro @@ -33,6 +33,8 @@ contains(QT_CONFIG, egl) { qwindowsurface_vgegl.cpp } +symbian: DEFINES += QVG_RECREATE_ON_SIZE_CHANGE + include(../qbase.pri) unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp index 53f6b4c..e66d80b 100644 --- a/src/openvg/qpixmapdata_vg.cpp +++ b/src/openvg/qpixmapdata_vg.cpp @@ -45,10 +45,10 @@ #include "qvg_p.h" #include "qvgimagepool_p.h" -#ifdef QT_SYMBIAN_SUPPORTS_SGIMAGE #include <private/qt_s60_p.h> #include <fbs.h> -#include <graphics/sgimage.h> +#ifdef QT_SYMBIAN_SUPPORTS_SGIMAGE +#include <sgresource/sgimage.h> typedef EGLImageKHR (*pfnEglCreateImageKHR)(EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, EGLint*); typedef EGLBoolean (*pfnEglDestroyImageKHR)(EGLDisplay, EGLImageKHR); typedef VGImage (*pfnVgCreateEGLImageTargetKHR)(VGeglImageKHR); @@ -465,23 +465,24 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type) TInt err = 0; - err = SgDriver::Open(); - if(err != KErrNone) { + RSgDriver driver; + err = driver.Open(); + if (err != KErrNone) { cleanup(); return; } - if(sgImage->IsNull()) { + if (sgImage->IsNull()) { cleanup(); - SgDriver::Close(); + driver.Close(); return; } TSgImageInfo sgImageInfo; err = sgImage->GetInfo(sgImageInfo); - if(err != KErrNone) { + if (err != KErrNone) { cleanup(); - SgDriver::Close(); + driver.Close(); return; } @@ -489,9 +490,9 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type) pfnEglDestroyImageKHR eglDestroyImageKHR = (pfnEglDestroyImageKHR) eglGetProcAddress("eglDestroyImageKHR"); pfnVgCreateEGLImageTargetKHR vgCreateEGLImageTargetKHR = (pfnVgCreateEGLImageTargetKHR) eglGetProcAddress("vgCreateEGLImageTargetKHR"); - if(eglGetError() != EGL_SUCCESS || !eglCreateImageKHR || !eglDestroyImageKHR || !vgCreateEGLImageTargetKHR) { + if (eglGetError() != EGL_SUCCESS || !eglCreateImageKHR || !eglDestroyImageKHR || !vgCreateEGLImageTargetKHR) { cleanup(); - SgDriver::Close(); + driver.Close(); return; } @@ -502,17 +503,17 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type) (EGLClientBuffer)sgImage, (EGLint*)KEglImageAttribs); - if(eglGetError() != EGL_SUCCESS) { + if (eglGetError() != EGL_SUCCESS) { cleanup(); - SgDriver::Close(); + driver.Close(); return; } vgImage = vgCreateEGLImageTargetKHR(eglImage); - if(vgGetError() != VG_NO_ERROR) { + if (vgGetError() != VG_NO_ERROR) { cleanup(); eglDestroyImageKHR(QEgl::display(), eglImage); - SgDriver::Close(); + driver.Close(); return; } @@ -526,7 +527,7 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type) setSerialNumber(++qt_vg_pixmap_serial); // release stuff eglDestroyImageKHR(QEgl::display(), eglImage); - SgDriver::Close(); + driver.Close(); } else if (type == QPixmapData::FbsBitmap) { CFbsBitmap *bitmap = reinterpret_cast<CFbsBitmap*>(pixmap); @@ -584,29 +585,25 @@ void* QVGPixmapData::toNativeType(NativeType type) if (type == QPixmapData::SgImage) { toVGImage(); - if(!isValid() || vgImage == VG_INVALID_HANDLE) + if (!isValid() || vgImage == VG_INVALID_HANDLE) return 0; TInt err = 0; - err = SgDriver::Open(); - if(err != KErrNone) + RSgDriver driver; + err = driver.Open(); + if (err != KErrNone) return 0; TSgImageInfo sgInfo; sgInfo.iPixelFormat = EUidPixelFormatARGB_8888_PRE; sgInfo.iSizeInPixels.SetSize(w, h); - sgInfo.iUsage = ESgUsageOpenVgImage | ESgUsageOpenVgTarget; - sgInfo.iShareable = ETrue; - sgInfo.iCpuAccess = ESgCpuAccessNone; - sgInfo.iScreenId = KSgScreenIdMain; //KSgScreenIdAny; - sgInfo.iUserAttributes = NULL; - sgInfo.iUserAttributeCount = 0; + sgInfo.iUsage = ESgUsageBitOpenVgImage | ESgUsageBitOpenVgSurface; RSgImage *sgImage = q_check_ptr(new RSgImage()); err = sgImage->Create(sgInfo, NULL, NULL); - if(err != KErrNone) { - SgDriver::Close(); + if (err != KErrNone) { + driver.Close(); return 0; } @@ -614,8 +611,8 @@ void* QVGPixmapData::toNativeType(NativeType type) pfnEglDestroyImageKHR eglDestroyImageKHR = (pfnEglDestroyImageKHR) eglGetProcAddress("eglDestroyImageKHR"); pfnVgCreateEGLImageTargetKHR vgCreateEGLImageTargetKHR = (pfnVgCreateEGLImageTargetKHR) eglGetProcAddress("vgCreateEGLImageTargetKHR"); - if(eglGetError() != EGL_SUCCESS || !eglCreateImageKHR || !eglDestroyImageKHR || !vgCreateEGLImageTargetKHR) { - SgDriver::Close(); + if (eglGetError() != EGL_SUCCESS || !eglCreateImageKHR || !eglDestroyImageKHR || !vgCreateEGLImageTargetKHR) { + driver.Close(); return 0; } @@ -625,17 +622,17 @@ void* QVGPixmapData::toNativeType(NativeType type) EGL_NATIVE_PIXMAP_KHR, (EGLClientBuffer)sgImage, (EGLint*)KEglImageAttribs); - if(eglGetError() != EGL_SUCCESS) { + if (eglGetError() != EGL_SUCCESS) { sgImage->Close(); - SgDriver::Close(); + driver.Close(); return 0; } VGImage dstVgImage = vgCreateEGLImageTargetKHR(eglImage); - if(vgGetError() != VG_NO_ERROR) { + if (vgGetError() != VG_NO_ERROR) { eglDestroyImageKHR(QEgl::display(), eglImage); sgImage->Close(); - SgDriver::Close(); + driver.Close(); return 0; } @@ -643,14 +640,14 @@ void* QVGPixmapData::toNativeType(NativeType type) vgImage, 0, 0, w, h, VG_FALSE); - if(vgGetError() != VG_NO_ERROR) { + if (vgGetError() != VG_NO_ERROR) { sgImage->Close(); sgImage = 0; } // release stuff vgDestroyImage(dstVgImage); eglDestroyImageKHR(QEgl::display(), eglImage); - SgDriver::Close(); + driver.Close(); return reinterpret_cast<void*>(sgImage); } else if (type == QPixmapData::FbsBitmap) { CFbsBitmap *bitmap = q_check_ptr(new CFbsBitmap); diff --git a/src/plugins/phonon/mmf/mmf.pro b/src/plugins/phonon/mmf/mmf.pro index cfaca9d..da41f18 100644 --- a/src/plugins/phonon/mmf/mmf.pro +++ b/src/plugins/phonon/mmf/mmf.pro @@ -20,13 +20,16 @@ phonon_mmf_audio_drm { # '#include <videoplayer.h>' picks up the Symbian header, as intended. PREPEND_INCLUDEPATH = /epoc32/include +PREPEND_INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE HEADERS += \ $$PHONON_MMF_DIR/abstractaudioeffect.h \ $$PHONON_MMF_DIR/abstractmediaplayer.h \ $$PHONON_MMF_DIR/abstractplayer.h \ - $$PHONON_MMF_DIR/ancestormovemonitor.h \ + $$PHONON_MMF_DIR/abstractvideooutput.h \ + $$PHONON_MMF_DIR/abstractvideoplayer.h \ $$PHONON_MMF_DIR/audioequalizer.h \ $$PHONON_MMF_DIR/audiooutput.h \ $$PHONON_MMF_DIR/audioplayer.h \ @@ -40,23 +43,22 @@ HEADERS += \ $$PHONON_MMF_DIR/loudness.h \ $$PHONON_MMF_DIR/mediaobject.h \ $$PHONON_MMF_DIR/mmf_medianode.h \ - $$PHONON_MMF_DIR/mmf_videoplayer.h \ $$PHONON_MMF_DIR/stereowidening.h \ $$PHONON_MMF_DIR/objectdump.h \ $$PHONON_MMF_DIR/objectdump_symbian.h \ $$PHONON_MMF_DIR/objecttree.h \ $$PHONON_MMF_DIR/utils.h \ - $$PHONON_MMF_DIR/videooutput.h \ $$PHONON_MMF_DIR/videowidget.h SOURCES += \ $$PHONON_MMF_DIR/abstractaudioeffect.cpp \ $$PHONON_MMF_DIR/abstractmediaplayer.cpp \ $$PHONON_MMF_DIR/abstractplayer.cpp \ - $$PHONON_MMF_DIR/ancestormovemonitor.cpp \ $$PHONON_MMF_DIR/audioequalizer.cpp \ $$PHONON_MMF_DIR/audiooutput.cpp \ $$PHONON_MMF_DIR/audioplayer.cpp \ + $$PHONON_MMF_DIR/abstractvideooutput.cpp \ + $$PHONON_MMF_DIR/abstractvideoplayer.cpp \ $$PHONON_MMF_DIR/backend.cpp \ $$PHONON_MMF_DIR/bassboost.cpp \ $$PHONON_MMF_DIR/dummyplayer.cpp \ @@ -66,15 +68,34 @@ SOURCES += \ $$PHONON_MMF_DIR/loudness.cpp \ $$PHONON_MMF_DIR/mediaobject.cpp \ $$PHONON_MMF_DIR/mmf_medianode.cpp \ - $$PHONON_MMF_DIR/mmf_videoplayer.cpp \ $$PHONON_MMF_DIR/stereowidening.cpp \ $$PHONON_MMF_DIR/objectdump.cpp \ $$PHONON_MMF_DIR/objectdump_symbian.cpp \ $$PHONON_MMF_DIR/objecttree.cpp \ $$PHONON_MMF_DIR/utils.cpp \ - $$PHONON_MMF_DIR/videooutput.cpp \ $$PHONON_MMF_DIR/videowidget.cpp +# Test for whether the build environment supports video rendering to graphics +# surfaces. +exists($${EPOCROOT}epoc32/include/platform/videoplayer2.h) { + HEADERS += \ + $$PHONON_MMF_DIR/videooutput_surface.h \ + $$PHONON_MMF_DIR/videoplayer_surface.h + SOURCES += \ + $$PHONON_MMF_DIR/videooutput_surface.cpp \ + $$PHONON_MMF_DIR/videoplayer_surface.cpp + DEFINES += PHONON_MMF_VIDEO_SURFACES +} else { + HEADERS += \ + $$PHONON_MMF_DIR/ancestormovemonitor.h \ + $$PHONON_MMF_DIR/videooutput_dsa.h \ + $$PHONON_MMF_DIR/videoplayer_dsa.h + SOURCES += \ + $$PHONON_MMF_DIR/ancestormovemonitor.cpp \ + $$PHONON_MMF_DIR/videooutput_dsa.cpp \ + $$PHONON_MMF_DIR/videoplayer_dsa.cpp \ +} + LIBS += -lcone LIBS += -lws32 diff --git a/src/plugins/qpluginbase.pri b/src/plugins/qpluginbase.pri index 3dd3d2e..8b119b5 100644 --- a/src/plugins/qpluginbase.pri +++ b/src/plugins/qpluginbase.pri @@ -17,5 +17,6 @@ wince*:LIBS += $$QMAKE_LIBS_GUI symbian: { TARGET.EPOCALLOWDLLDATA=1 TARGET.CAPABILITY = All -Tcb + TARGET = $${TARGET}$${QT_LIBINFIX} load(armcc_warnings) } diff --git a/src/plugins/s60/3_1/3_1.pro b/src/plugins/s60/3_1/3_1.pro index 58ff5ce..9437f3d 100644 --- a/src/plugins/s60/3_1/3_1.pro +++ b/src/plugins/s60/3_1/3_1.pro @@ -1,6 +1,6 @@ include(../s60pluginbase.pri) -TARGET = qts60plugin_3_1 +TARGET = qts60plugin_3_1$${QT_LIBINFIX} SOURCES += ../src/qlocale_3_1.cpp \ ../src/qdesktopservices_3_1.cpp \ diff --git a/src/plugins/s60/3_2/3_2.pro b/src/plugins/s60/3_2/3_2.pro index 7700677..0524866 100644 --- a/src/plugins/s60/3_2/3_2.pro +++ b/src/plugins/s60/3_2/3_2.pro @@ -1,6 +1,6 @@ include(../s60pluginbase.pri) -TARGET = qts60plugin_3_2 +TARGET = qts60plugin_3_2$${QT_LIBINFIX} contains(S60_VERSION, 3.1) { SOURCES += ../src/qlocale_3_1.cpp \ diff --git a/src/plugins/s60/5_0/5_0.pro b/src/plugins/s60/5_0/5_0.pro index 164dfaa..00aea1b 100644 --- a/src/plugins/s60/5_0/5_0.pro +++ b/src/plugins/s60/5_0/5_0.pro @@ -1,6 +1,6 @@ include(../s60pluginbase.pri) -TARGET = qts60plugin_5_0 +TARGET = qts60plugin_5_0$${QT_LIBINFIX} contains(S60_VERSION, 3.1) { SOURCES += ../src/qlocale_3_1.cpp \ diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index b2e873f..db1ee4d 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -7,25 +7,38 @@ symbian: { SUBDIRS= # WARNING: Changing TARGET name will break Symbian SISX upgrade functionality # DO NOT TOUCH TARGET VARIABLE IF YOU ARE NOT SURE WHAT YOU ARE DOING - TARGET = "Qt" - TARGET.UID3 = 0x2001E61C + TARGET = "Qt$${QT_LIBINFIX}" + + isEmpty(QT_LIBINFIX) { + TARGET.UID3 = 0x2001E61C + + # sqlite3 is expected to be already found on phone if infixed configuration is built. + sqlitedeployment = \ + "; Deploy sqlite onto phone that does not have it already" \ + "@\"$$PWD/sqlite3.sis\", (0x2002af5f)" + qtlibraries.pkg_postrules += sqlitedeployment + } else { + # Always use experimental UID for infixed configuration to avoid UID clash + TARGET.UID3 = 0xE001E61C + } VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} symbian-abld|symbian-sbsv2 { - qtresources.sources = $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/s60main.rsc + qtresources.sources = $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/s60main$${QT_LIBINFIX}.rsc } else { - qtresources.sources = $$QMAKE_LIBDIR_QT/s60main.rsc + qtresources.sources = $$QMAKE_LIBDIR_QT/s60main$${QT_LIBINFIX}.rsc DESTDIR = $$QMAKE_LIBDIR_QT } qtresources.path = c:$$APP_RESOURCE_DIR + DEPLOYMENT += qtresources qtlibraries.sources = \ - $$QMAKE_LIBDIR_QT/QtCore.dll \ - $$QMAKE_LIBDIR_QT/QtXml.dll \ - $$QMAKE_LIBDIR_QT/QtGui.dll \ - $$QMAKE_LIBDIR_QT/QtNetwork.dll \ - $$QMAKE_LIBDIR_QT/QtTest.dll \ - $$QMAKE_LIBDIR_QT/QtSql.dll + $$QMAKE_LIBDIR_QT/QtCore$${QT_LIBINFIX}.dll \ + $$QMAKE_LIBDIR_QT/QtXml$${QT_LIBINFIX}.dll \ + $$QMAKE_LIBDIR_QT/QtGui$${QT_LIBINFIX}.dll \ + $$QMAKE_LIBDIR_QT/QtNetwork$${QT_LIBINFIX}.dll \ + $$QMAKE_LIBDIR_QT/QtTest$${QT_LIBINFIX}.dll \ + $$QMAKE_LIBDIR_QT/QtSql$${QT_LIBINFIX}.dll symbian-abld|symbian-sbsv2 { pluginLocations = $${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET) @@ -35,20 +48,16 @@ symbian: { qts60plugindeployment = \ "IF package(0x1028315F)" \ - " \"$$pluginLocations/qts60plugin_5_0.dll\" - \"c:\\sys\\bin\\qts60plugin_5_0.dll\"" \ + " \"$$pluginLocations/qts60plugin_5_0$${QT_LIBINFIX}.dll\" - \"c:\\sys\\bin\\qts60plugin_5_0$${QT_LIBINFIX}.dll\"" \ "ELSEIF package(0x102752AE)" \ - " \"$$pluginLocations/qts60plugin_3_2.dll\" - \"c:\\sys\\bin\\qts60plugin_3_2.dll\"" \ + " \"$$pluginLocations/qts60plugin_3_2$${QT_LIBINFIX}.dll\" - \"c:\\sys\\bin\\qts60plugin_3_2$${QT_LIBINFIX}.dll\"" \ "ELSEIF package(0x102032BE)" \ - " \"$$pluginLocations/qts60plugin_3_1.dll\" - \"c:\\sys\\bin\\qts60plugin_3_1.dll\"" \ + " \"$$pluginLocations/qts60plugin_3_1$${QT_LIBINFIX}.dll\" - \"c:\\sys\\bin\\qts60plugin_3_1$${QT_LIBINFIX}.dll\"" \ "ELSE" \ - " \"$$pluginLocations/qts60plugin_5_0.dll\" - \"c:\\sys\\bin\\qts60plugin_5_0.dll\"" \ + " \"$$pluginLocations/qts60plugin_5_0$${QT_LIBINFIX}.dll\" - \"c:\\sys\\bin\\qts60plugin_5_0$${QT_LIBINFIX}.dll\"" \ "ENDIF" qtlibraries.pkg_postrules += qts60plugindeployment - sqlitedeployment = \ - "; Deploy sqlite onto phone that does not have it already" \ - "@\"$$PWD/sqlite3.sis\", (0x2002af5f)" - qtlibraries.pkg_postrules += sqlitedeployment qtlibraries.path = c:/sys/bin @@ -72,18 +81,18 @@ symbian: { } qtlibraries.pkg_prerules += "(0x2002af5f), 0, 5, 0, {\"sqlite3\"}" - !contains(QT_CONFIG, no-jpeg): imageformats_plugins.sources += $$QT_BUILD_TREE/plugins/imageformats/qjpeg.dll - !contains(QT_CONFIG, no-gif): imageformats_plugins.sources += $$QT_BUILD_TREE/plugins/imageformats/qgif.dll - !contains(QT_CONFIG, no-mng): imageformats_plugins.sources += $$QT_BUILD_TREE/plugins/imageformats/qmng.dll - !contains(QT_CONFIG, no-tiff): imageformats_plugins.sources += $$QT_BUILD_TREE/plugins/imageformats/qtiff.dll - !contains(QT_CONFIG, no-ico): imageformats_plugins.sources += $$QT_BUILD_TREE/plugins/imageformats/qico.dll + !contains(QT_CONFIG, no-jpeg): imageformats_plugins.sources += $$QT_BUILD_TREE/plugins/imageformats/qjpeg$${QT_LIBINFIX}.dll + !contains(QT_CONFIG, no-gif): imageformats_plugins.sources += $$QT_BUILD_TREE/plugins/imageformats/qgif$${QT_LIBINFIX}.dll + !contains(QT_CONFIG, no-mng): imageformats_plugins.sources += $$QT_BUILD_TREE/plugins/imageformats/qmng$${QT_LIBINFIX}.dll + !contains(QT_CONFIG, no-tiff): imageformats_plugins.sources += $$QT_BUILD_TREE/plugins/imageformats/qtiff$${QT_LIBINFIX}.dll + !contains(QT_CONFIG, no-ico): imageformats_plugins.sources += $$QT_BUILD_TREE/plugins/imageformats/qico$${QT_LIBINFIX}.dll imageformats_plugins.path = c:$$QT_PLUGINS_BASE_DIR/imageformats - codecs_plugins.sources = $$QT_BUILD_TREE/plugins/codecs/qcncodecs.dll $$QT_BUILD_TREE/plugins/codecs/qjpcodecs.dll $$QT_BUILD_TREE/plugins/codecs/qtwcodecs.dll $$QT_BUILD_TREE/plugins/codecs/qkrcodecs.dll + codecs_plugins.sources = $$QT_BUILD_TREE/plugins/codecs/qcncodecs$${QT_LIBINFIX}.dll $$QT_BUILD_TREE/plugins/codecs/qjpcodecs$${QT_LIBINFIX}.dll $$QT_BUILD_TREE/plugins/codecs/qtwcodecs$${QT_LIBINFIX}.dll $$QT_BUILD_TREE/plugins/codecs/qkrcodecs$${QT_LIBINFIX}.dll codecs_plugins.path = c:$$QT_PLUGINS_BASE_DIR/codecs contains(QT_CONFIG, phonon-backend) { - phonon_backend_plugins.sources += $$QMAKE_LIBDIR_QT/phonon_mmf.dll + phonon_backend_plugins.sources += $$QMAKE_LIBDIR_QT/phonon_mmf$${QT_LIBINFIX}.dll phonon_backend_plugins.path = c:$$QT_PLUGINS_BASE_DIR/phonon_backend DEPLOYMENT += phonon_backend_plugins @@ -94,10 +103,9 @@ symbian: { qtbackup.path = c:/private/10202D56/import/packages/$$replace(TARGET.UID3, 0x,) bearer_plugins.path = c:$$QT_PLUGINS_BASE_DIR/bearer - bearer_plugins.sources += $$QT_BUILD_TREE/plugins/bearer/qsymbianbearer.dll + bearer_plugins.sources += $$QT_BUILD_TREE/plugins/bearer/qsymbianbearer$${QT_LIBINFIX}.dll - DEPLOYMENT += qtresources \ - qtlibraries \ + DEPLOYMENT += qtlibraries \ qtbackup \ imageformats_plugins \ codecs_plugins \ @@ -105,37 +113,37 @@ symbian: { bearer_plugins contains(QT_CONFIG, svg): { - qtlibraries.sources += $$QMAKE_LIBDIR_QT/QtSvg.dll - imageformats_plugins.sources += $$QT_BUILD_TREE/plugins/imageformats/qsvg.dll - iconengines_plugins.sources = $$QT_BUILD_TREE/plugins/iconengines/qsvgicon.dll + qtlibraries.sources += $$QMAKE_LIBDIR_QT/QtSvg$${QT_LIBINFIX}.dll + imageformats_plugins.sources += $$QT_BUILD_TREE/plugins/imageformats/qsvg$${QT_LIBINFIX}.dll + iconengines_plugins.sources = $$QT_BUILD_TREE/plugins/iconengines/qsvgicon$${QT_LIBINFIX}.dll iconengines_plugins.path = c:$$QT_PLUGINS_BASE_DIR/iconengines DEPLOYMENT += iconengines_plugins } contains(QT_CONFIG, phonon): { - qtlibraries.sources += $$QMAKE_LIBDIR_QT/phonon.dll + qtlibraries.sources += $$QMAKE_LIBDIR_QT/phonon$${QT_LIBINFIX}.dll } contains(QT_CONFIG, script): { - qtlibraries.sources += $$QMAKE_LIBDIR_QT/QtScript.dll + qtlibraries.sources += $$QMAKE_LIBDIR_QT/QtScript$${QT_LIBINFIX}.dll } contains(QT_CONFIG, xmlpatterns): { - qtlibraries.sources += $$QMAKE_LIBDIR_QT/QtXmlPatterns.dll + qtlibraries.sources += $$QMAKE_LIBDIR_QT/QtXmlPatterns$${QT_LIBINFIX}.dll } contains(QT_CONFIG, declarative): { - qtlibraries.sources += $$QMAKE_LIBDIR_QT/QtDeclarative.dll + qtlibraries.sources += $$QMAKE_LIBDIR_QT/QtDeclarative$${QT_LIBINFIX}.dll } graphicssystems_plugins.path = c:$$QT_PLUGINS_BASE_DIR/graphicssystems contains(QT_CONFIG, openvg) { - qtlibraries.sources += $$QMAKE_LIBDIR_QT/QtOpenVG.dll - graphicssystems_plugins.sources += $$QT_BUILD_TREE/plugins/graphicssystems/qvggraphicssystem.dll + qtlibraries.sources += $$QMAKE_LIBDIR_QT/QtOpenVG$${QT_LIBINFIX}.dll + graphicssystems_plugins.sources += $$QT_BUILD_TREE/plugins/graphicssystems/qvggraphicssystem$${QT_LIBINFIX}.dll } contains(QT_CONFIG, multimedia) { - qtlibraries.sources += $$QMAKE_LIBDIR_QT/QtMultimedia.dll + qtlibraries.sources += $$QMAKE_LIBDIR_QT/QtMultimedia$${QT_LIBINFIX}.dll } BLD_INF_RULES.prj_exports += "qt.iby $$CORE_MW_LAYER_IBY_EXPORT_PATH(qt.iby)" diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 294c3a0..356b4d0 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -3318,7 +3318,7 @@ void QScriptEngine::installTranslatorFunctions(const QScriptValue &object) JSC::JSValue jscObject = d->scriptValueToJSCValue(object); JSC::JSGlobalObject *glob = d->originalGlobalObject(); if (!jscObject || !jscObject.isObject()) - jscObject = glob; + jscObject = d->globalObject(); // unsigned attribs = JSC::DontEnum; JSC::asObject(jscObject)->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 5, JSC::Identifier(exec, "qsTranslate"), QScript::functionQsTranslate)); JSC::asObject(jscObject)->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 2, JSC::Identifier(exec, "QT_TRANSLATE_NOOP"), QScript::functionQsTranslateNoOp)); diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index a3af2d4..5db1165 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -1609,7 +1609,7 @@ QScriptValue QScriptValue::call(const QScriptValue &thisObject, JSC::MarkedArgumentBuffer applyArgs; if (!array.isUndefinedOrNull()) { if (!array.isObject()) { - return d->engine->scriptValueFromJSCValue(JSC::throwError(exec, JSC::TypeError)); + return d->engine->scriptValueFromJSCValue(JSC::throwError(exec, JSC::TypeError, "Arguments must be an array")); } if (JSC::asObject(array)->classInfo() == &JSC::Arguments::info) JSC::asArguments(array)->fillArgList(exec, applyArgs); @@ -1620,8 +1620,7 @@ QScriptValue QScriptValue::call(const QScriptValue &thisObject, for (unsigned i = 0; i < length; ++i) applyArgs.append(JSC::asArray(array)->get(exec, i)); } else { - Q_ASSERT_X(false, Q_FUNC_INFO, "implement me"); -// return JSC::throwError(exec, JSC::TypeError); + return d->engine->scriptValueFromJSCValue(JSC::throwError(exec, JSC::TypeError, "Arguments must be an array")); } } diff --git a/src/script/bridge/qscriptclassobject.cpp b/src/script/bridge/qscriptclassobject.cpp index a7b5f48..dd229f1 100644 --- a/src/script/bridge/qscriptclassobject.cpp +++ b/src/script/bridge/qscriptclassobject.cpp @@ -234,7 +234,7 @@ JSC::JSObject* ClassObjectDelegate::construct(JSC::ExecState *exec, JSC::JSObjec QScriptClass *scriptClass = static_cast<ClassObjectDelegate*>(delegate)->scriptClass(); QScriptEnginePrivate *eng_p = scriptEngineFromExec(exec); - //JSC::ExecState *oldFrame = eng_p->currentFrame; + JSC::ExecState *oldFrame = eng_p->currentFrame; eng_p->pushContext(exec, JSC::JSValue(), args, callee, true); QScriptContext *ctx = eng_p->contextForFrame(eng_p->currentFrame); @@ -242,6 +242,8 @@ JSC::JSObject* ClassObjectDelegate::construct(JSC::ExecState *exec, JSC::JSObjec QScriptValue result = qvariant_cast<QScriptValue>(scriptClass->extension(QScriptClass::Callable, qVariantFromValue(ctx))); if (!result.isObject()) result = defaultObject; + eng_p->popContext(); + eng_p->currentFrame = oldFrame; return JSC::asObject(eng_p->scriptValueToJSCValue(result)); } diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index 6729c62..9a982d0 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -738,18 +738,23 @@ void Generator::generateMetacall() const PropertyDef &p = cdef->propertyList.at(propindex); if (p.read.isEmpty()) continue; + QByteArray prefix; + if (p.inPrivateClass.size()) { + prefix = p.inPrivateClass; + prefix.append("->"); + } if (p.gspec == PropertyDef::PointerSpec) - fprintf(out, " case %d: _a[0] = const_cast<void*>(reinterpret_cast<const void*>(%s())); break;\n", - propindex, p.read.constData()); + fprintf(out, " case %d: _a[0] = const_cast<void*>(reinterpret_cast<const void*>(%s%s())); break;\n", + propindex, prefix.constData(), p.read.constData()); else if (p.gspec == PropertyDef::ReferenceSpec) - fprintf(out, " case %d: _a[0] = const_cast<void*>(reinterpret_cast<const void*>(&%s())); break;\n", - propindex, p.read.constData()); + fprintf(out, " case %d: _a[0] = const_cast<void*>(reinterpret_cast<const void*>(&%s%s())); break;\n", + propindex, prefix.constData(), p.read.constData()); else if (cdef->enumDeclarations.value(p.type, false)) - fprintf(out, " case %d: *reinterpret_cast<int*>(_v) = QFlag(%s()); break;\n", - propindex, p.read.constData()); + fprintf(out, " case %d: *reinterpret_cast<int*>(_v) = QFlag(%s%s()); break;\n", + propindex, prefix.constData(), p.read.constData()); else - fprintf(out, " case %d: *reinterpret_cast< %s*>(_v) = %s(); break;\n", - propindex, p.type.constData(), p.read.constData()); + fprintf(out, " case %d: *reinterpret_cast< %s*>(_v) = %s%s(); break;\n", + propindex, p.type.constData(), prefix.constData(), p.read.constData()); } fprintf(out, " }\n"); } @@ -768,12 +773,17 @@ void Generator::generateMetacall() const PropertyDef &p = cdef->propertyList.at(propindex); if (p.write.isEmpty()) continue; + QByteArray prefix; + if (p.inPrivateClass.size()) { + prefix = p.inPrivateClass; + prefix.append("->"); + } if (cdef->enumDeclarations.value(p.type, false)) { - fprintf(out, " case %d: %s(QFlag(*reinterpret_cast<int*>(_v))); break;\n", - propindex, p.write.constData()); + fprintf(out, " case %d: %s%s(QFlag(*reinterpret_cast<int*>(_v))); break;\n", + propindex, prefix.constData(), p.write.constData()); } else { - fprintf(out, " case %d: %s(*reinterpret_cast< %s*>(_v)); break;\n", - propindex, p.write.constData(), p.type.constData()); + fprintf(out, " case %d: %s%s(*reinterpret_cast< %s*>(_v)); break;\n", + propindex, prefix.constData(), p.write.constData(), p.type.constData()); } } fprintf(out, " }\n"); @@ -791,8 +801,13 @@ void Generator::generateMetacall() const PropertyDef &p = cdef->propertyList.at(propindex); if (!p.reset.endsWith(')')) continue; - fprintf(out, " case %d: %s; break;\n", - propindex, p.reset.constData()); + QByteArray prefix; + if (p.inPrivateClass.size()) { + prefix = p.inPrivateClass; + prefix.append("->"); + } + fprintf(out, " case %d: %s%s; break;\n", + propindex, prefix.constData(), p.reset.constData()); } fprintf(out, " }\n"); } diff --git a/src/tools/moc/keywords.cpp b/src/tools/moc/keywords.cpp index abc6be0..df1ba0d 100644 --- a/src/tools/moc/keywords.cpp +++ b/src/tools/moc/keywords.cpp @@ -43,12 +43,12 @@ // DO NOT EDIT. static const short keyword_trans[][128] = { - {0,0,0,0,0,0,0,0,0,525,522,0,0,0,0,0, + {0,0,0,0,0,0,0,0,0,533,530,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 525,252,523,526,0,38,239,524,25,26,236,234,30,235,27,237, + 533,252,531,534,0,38,239,532,25,26,236,234,30,235,27,237, 22,22,22,22,22,22,22,22,22,22,34,41,23,39,24,43, 0,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, - 8,21,8,8,8,8,8,8,8,8,8,31,527,32,238,8, + 8,21,8,8,8,8,8,8,8,8,8,31,535,32,238,8, 0,1,2,3,4,5,6,7,8,9,8,8,10,11,12,13, 14,8,15,16,17,18,19,20,8,8,8,36,245,37,248,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -190,7 +190,7 @@ static const short keyword_trans[][128] = { {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,42,0,0,0,28,0, - 530,530,530,530,530,530,530,530,530,530,0,0,0,0,0,0, + 538,538,538,538,538,538,538,538,538,538,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -349,7 +349,7 @@ static const short keyword_trans[][128] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,529,0,0,0,0,528, + 0,0,0,0,0,0,0,0,0,0,537,0,0,0,0,536, 0,0,0,0,0,0,0,0,0,0,0,0,0,258,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -430,6 +430,14 @@ static const short keyword_trans[][128] = { {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 522,0,0,481,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,497,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,486, @@ -925,12 +933,12 @@ static const struct {CHARACTER, 0, 84, 478, CHARACTER}, {CHARACTER, 0, 69, 479, CHARACTER}, {CHARACTER, 0, 95, 480, CHARACTER}, - {CHARACTER, 0, 83, 481, CHARACTER}, + {CHARACTER, 48, 0, 0, CHARACTER}, {CHARACTER, 0, 76, 482, CHARACTER}, {CHARACTER, 0, 79, 483, CHARACTER}, {CHARACTER, 0, 84, 484, CHARACTER}, {Q_PRIVATE_SLOT_TOKEN, 0, 0, 0, CHARACTER}, - {CHARACTER, 48, 0, 0, CHARACTER}, + {CHARACTER, 49, 0, 0, CHARACTER}, {CHARACTER, 0, 77, 487, CHARACTER}, {CHARACTER, 0, 79, 488, CHARACTER}, {CHARACTER, 0, 67, 489, CHARACTER}, @@ -967,6 +975,14 @@ static const struct {CHARACTER, 0, 76, 520, CHARACTER}, {CHARACTER, 0, 69, 521, CHARACTER}, {Q_SCRIPTABLE_TOKEN, 0, 0, 0, CHARACTER}, + {CHARACTER, 0, 82, 523, CHARACTER}, + {CHARACTER, 0, 79, 524, CHARACTER}, + {CHARACTER, 0, 80, 525, CHARACTER}, + {CHARACTER, 0, 69, 526, CHARACTER}, + {CHARACTER, 0, 82, 527, CHARACTER}, + {CHARACTER, 0, 84, 528, CHARACTER}, + {CHARACTER, 0, 89, 529, CHARACTER}, + {Q_PRIVATE_PROPERTY_TOKEN, 0, 0, 0, CHARACTER}, {NEWLINE, 0, 0, 0, NOTOKEN}, {QUOTE, 0, 0, 0, NOTOKEN}, {SINGLEQUOTE, 0, 0, 0, NOTOKEN}, diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index 94ad56f..680b8a5 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -658,6 +658,9 @@ void Moc::parse() case Q_PRIVATE_SLOT_TOKEN: parseSlotInPrivate(&def, access); break; + case Q_PRIVATE_PROPERTY_TOKEN: + parsePrivateProperty(&def); + break; case ENUM: { EnumDef enumDef; if (parseEnum(&enumDef)) @@ -872,11 +875,8 @@ void Moc::parseSignals(ClassDef *def) } } - -void Moc::parseProperty(ClassDef *def) +void Moc::createPropertyDef(PropertyDef &propDef) { - next(LPAREN); - PropertyDef propDef; QByteArray type = parseType().name; if (type.isEmpty()) error(); @@ -964,7 +964,6 @@ void Moc::parseProperty(ClassDef *def) error(2); } } - next(RPAREN); if (propDef.read.isNull()) { QByteArray msg; msg += "Property declaration "; @@ -988,6 +987,41 @@ void Moc::parseProperty(ClassDef *def) propDef.constant = false; warning(msg.constData()); } +} + +void Moc::parseProperty(ClassDef *def) +{ + next(LPAREN); + PropertyDef propDef; + createPropertyDef(propDef); + next(RPAREN); + + + if(!propDef.notify.isEmpty()) + def->notifyableProperties++; + def->propertyList += propDef; +} + +void Moc::parsePrivateProperty(ClassDef *def) +{ + next(LPAREN); + PropertyDef propDef; + next(IDENTIFIER); + propDef.inPrivateClass = lexem(); + while (test(SCOPE)) { + propDef.inPrivateClass += lexem(); + next(IDENTIFIER); + propDef.inPrivateClass += lexem(); + } + // also allow void functions + if (test(LPAREN)) { + next(RPAREN); + propDef.inPrivateClass += "()"; + } + + next(COMMA); + + createPropertyDef(propDef); if(!propDef.notify.isEmpty()) def->notifyableProperties++; diff --git a/src/tools/moc/moc.h b/src/tools/moc/moc.h index 10abfc6..d365ed5 100644 --- a/src/tools/moc/moc.h +++ b/src/tools/moc/moc.h @@ -116,7 +116,7 @@ struct FunctionDef struct PropertyDef { PropertyDef():notifyId(-1), constant(false), final(false), gspec(ValueSpec){} - QByteArray name, type, read, write, reset, designable, scriptable, editable, stored, user, notify; + QByteArray name, type, read, write, reset, designable, scriptable, editable, stored, user, notify, inPrivateClass; int notifyId; bool constant; bool final; @@ -217,6 +217,7 @@ public: void parseSlots(ClassDef *def, FunctionDef::Access access); void parseSignals(ClassDef *def); void parseProperty(ClassDef *def); + void createPropertyDef(PropertyDef &def); void parseEnumOrFlag(ClassDef *def, bool isFlag); void parseFlag(ClassDef *def); void parseClassInfo(ClassDef *def); @@ -224,6 +225,7 @@ public: void parseDeclareInterface(); void parseDeclareMetatype(); void parseSlotInPrivate(ClassDef *def, FunctionDef::Access access); + void parsePrivateProperty(ClassDef *def); void parseFunctionArguments(FunctionDef *def); diff --git a/src/tools/moc/token.cpp b/src/tools/moc/token.cpp index 98307a1..3da9446 100644 --- a/src/tools/moc/token.cpp +++ b/src/tools/moc/token.cpp @@ -179,6 +179,7 @@ const char *tokenTypeName(Token t) case Q_SIGNAL_TOKEN: return "Q_SIGNAL_TOKEN"; case Q_SLOT_TOKEN: return "Q_SLOT_TOKEN"; case Q_PRIVATE_SLOT_TOKEN: return "Q_PRIVATE_SLOT_TOKEN"; + case Q_PRIVATE_PROPERTY_TOKEN: return "Q_PRIVATE_PROPERTY_TOKEN"; case SPECIAL_TREATMENT_MARK: return "SPECIAL_TREATMENT_MARK"; case MOC_INCLUDE_BEGIN: return "MOC_INCLUDE_BEGIN"; case MOC_INCLUDE_END: return "MOC_INCLUDE_END"; diff --git a/src/tools/moc/token.h b/src/tools/moc/token.h index 6b1ad7d..6ca3d84 100644 --- a/src/tools/moc/token.h +++ b/src/tools/moc/token.h @@ -185,6 +185,7 @@ enum Token { Q_QT3_SUPPORT_TOKEN, Q_INVOKABLE_TOKEN, Q_SCRIPTABLE_TOKEN, + Q_PRIVATE_PROPERTY_TOKEN, Q_META_TOKEN_END, SPECIAL_TREATMENT_MARK = Q_META_TOKEN_END, MOC_INCLUDE_BEGIN, diff --git a/src/tools/moc/util/generate_keywords.cpp b/src/tools/moc/util/generate_keywords.cpp index 0641b40..88f187d 100644 --- a/src/tools/moc/util/generate_keywords.cpp +++ b/src/tools/moc/util/generate_keywords.cpp @@ -248,7 +248,7 @@ static const Keyword keywords[] = { { "Q_SIGNAL", "Q_SIGNAL_TOKEN" }, { "Q_SLOT", "Q_SLOT_TOKEN" }, { "Q_SCRIPTABLE", "Q_SCRIPTABLE_TOKEN" }, - + { "Q_PRIVATE_PROPERTY", "Q_PRIVATE_PROPERTY_TOKEN" }, { "\n", "NEWLINE" }, { "\"", "QUOTE" }, { "\'", "SINGLEQUOTE" }, |