From 55bf3ab3fb5591544e1f6a7996d5fdedb8e699c9 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 1 Oct 2010 11:25:02 +0300 Subject: Remove partial upgrade deployment generation for Webkit Generic partial upgrade package deployment generation in qbase.pri wrecks webkit pkg files. Reviewed-by: axis --- src/qbase.pri | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/qbase.pri b/src/qbase.pri index b431ade..e565e4a 100644 --- a/src/qbase.pri +++ b/src/qbase.pri @@ -185,18 +185,21 @@ include(qt_targets.pri) win32:DEFINES+=_USE_MATH_DEFINES symbian { - # Partial upgrade SIS file - vendorinfo = \ - "; Localised Vendor name" \ - "%{\"Nokia, Qt\"}" \ - " " \ - "; Unique Vendor name" \ - ":\"Nokia, Qt\"" \ - " " - pu_header = "; Partial upgrade package for testing $${TARGET} changes without reinstalling everything" \ - "$${LITERAL_HASH}{\"$${TARGET}\"}, (0x2001E61C), $${QT_MAJOR_VERSION},$${QT_MINOR_VERSION},$${QT_PATCH_VERSION}, TYPE=PU" - partial_upgrade.pkg_prerules = pu_header vendorinfo - partial_upgrade.sources = $$QMAKE_LIBDIR_QT/$${TARGET}.dll - partial_upgrade.path = c:/sys/bin - DEPLOYMENT += partial_upgrade + # Make partial upgrade SIS file for all dll's except webkit + !contains(TARGET.UID3, 0x200267C2):!contains(TARGET.UID3, 0xE00267C2) { + # Partial upgrade SIS file + vendorinfo = \ + "; Localised Vendor name" \ + "%{\"Nokia, Qt\"}" \ + " " \ + "; Unique Vendor name" \ + ":\"Nokia, Qt\"" \ + " " + pu_header = "; Partial upgrade package for testing $${TARGET} changes without reinstalling everything" \ + "$${LITERAL_HASH}{\"$${TARGET}\"}, (0x2001E61C), $${QT_MAJOR_VERSION},$${QT_MINOR_VERSION},$${QT_PATCH_VERSION}, TYPE=PU" + partial_upgrade.pkg_prerules = pu_header vendorinfo + partial_upgrade.sources = $$QMAKE_LIBDIR_QT/$${TARGET}.dll + partial_upgrade.path = c:/sys/bin + DEPLOYMENT += partial_upgrade + } } -- cgit v0.12 From 1f14df23bf0e593c31efc846c13f11afb0fad6b8 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 28 Sep 2010 11:01:20 +0100 Subject: Progressive download in Phonon MMF backend: added download managers This patch adds a Download class which uses the RHttpDownloadMgr API to download a media clip over HTTP. Task-number: QTBUG-10769 Reviewed-by: Derick Hawcroft --- src/3rdparty/phonon/mmf/download.cpp | 194 +++++++++++++++++++++++++++++++++++ src/3rdparty/phonon/mmf/download.h | 111 ++++++++++++++++++++ src/plugins/phonon/mmf/mmf.pro | 3 + 3 files changed, 308 insertions(+) create mode 100644 src/3rdparty/phonon/mmf/download.cpp create mode 100644 src/3rdparty/phonon/mmf/download.h diff --git a/src/3rdparty/phonon/mmf/download.cpp b/src/3rdparty/phonon/mmf/download.cpp new file mode 100644 index 0000000..7b80e4a --- /dev/null +++ b/src/3rdparty/phonon/mmf/download.cpp @@ -0,0 +1,194 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this library. If not, see . + +*/ + +#include "download.h" +#include "utils.h" +#include +#include + +QT_BEGIN_NAMESPACE + +using namespace Phonon; +using namespace Phonon::MMF; + +static const TBool InheritDownloads = EFalse; + +DownloadPrivate::DownloadPrivate(Download *parent) + : QObject(parent) + , m_parent(parent) + , m_download(0) + , m_length(0) +{ + +} + +DownloadPrivate::~DownloadPrivate() +{ + m_downloadManager.Disconnect(); + m_downloadManager.Close(); +} + +bool DownloadPrivate::start() +{ + TRACE_CONTEXT(DownloadPrivate::start, EVideoApi); + Q_ASSERT(!m_download); + // Connect to download manager + RProcess process; + const TUid uid3 = process.SecureId(); + TRAPD(err, m_downloadManager.ConnectL(uid3, *this, InheritDownloads)); + TRACE("connect err %d", err); + if (KErrNone == err) { + // Start download + QHBufC url(m_parent->sourceUrl().toString()); + TPtr8 url8 = url->Des().Collapse(); + TRAP(err, m_download = &m_downloadManager.CreateDownloadL(url8)); + TRACE("start err %d", err); + if (KErrNone == err) + m_download->Start(); + } + return (KErrNone == err); +} + +void DownloadPrivate::resume() +{ + +} + +void DownloadPrivate::HandleDMgrEventL(RHttpDownload &aDownload, THttpDownloadEvent aEvent) +{ + TRACE_CONTEXT(DownloadPrivate::HandleDMgrEventL, EVideoApi); + Q_ASSERT(&aDownload == m_download); + switch (aEvent.iDownloadState) { + case EHttpDlPaused: + if (EHttpContentTypeReceived == aEvent.iProgressState) { + TRACE_0("paused, content type received"); + m_download->Start(); + } + break; + case EHttpDlInprogress: + switch (aEvent.iProgressState) { + case EHttpProgResponseHeaderReceived: + { + TFileName fileName; + m_download->GetStringAttribute(EDlAttrDestFilename, fileName); + TRACE("in progress, response header received, filename %S", &fileName); + const QString fileNameQt = QDir::fromNativeSeparators(qt_TDesC2QString(fileName)); + m_parent->downloadStarted(fileNameQt); + } + break; + case EHttpProgResponseBodyReceived: + { + TInt32 length = 0; + m_download->GetIntAttribute(EDlAttrDownloadedSize, length); + if (length != m_length) { + TRACE("in progress, length %d", length); + m_length = length; + emit lengthChanged(m_length); + } + } + break; + } + break; + case EHttpDlCompleted: + TRACE_0("complete"); + m_parent->complete(); + break; + case EHttpDlFailed: + TRACE_0("failed"); + m_parent->error(); + break; + } +} + +Download::Download(const QUrl &url, QObject *parent) + : QObject(parent) + , m_private(new DownloadPrivate(this)) + , m_sourceUrl(url) + , m_state(Idle) +{ + qRegisterMetaType(); + connect(m_private, SIGNAL(lengthChanged(qint64)), this, SIGNAL(lengthChanged(qint64))); +} + +Download::~Download() +{ + +} + +const QUrl &Download::sourceUrl() const +{ + return m_sourceUrl; +} + +const QString &Download::targetFileName() const +{ + return m_targetFileName; +} + +void Download::start() +{ + TRACE_CONTEXT(Download::start, EVideoApi); + TRACE_ENTRY_0(); + Q_ASSERT(Idle == m_state); + const bool ok = m_private->start(); + setState(ok ? Initializing : Error); + TRACE_EXIT_0(); +} + +void Download::resume() +{ + TRACE_CONTEXT(Download::resume, EVideoApi); + TRACE_ENTRY_0(); + m_private->resume(); + TRACE_EXIT_0(); +} + +void Download::setState(State state) +{ + TRACE_CONTEXT(Download::setState, EVideoApi); + TRACE("oldState %d newState %d", m_state, state); + const State oldState = m_state; + m_state = state; + if (oldState != m_state) + emit stateChanged(m_state); +} + +void Download::error() +{ + TRACE_CONTEXT(Download::error, EVideoApi); + TRACE_0(""); + setState(Error); +} + +void Download::downloadStarted(const QString &targetFileName) +{ + TRACE_CONTEXT(Download::downloadStarted, EVideoApi); + TRACE_0("downloadStarted"); + m_targetFileName = targetFileName; + setState(Downloading); +} + +void Download::complete() +{ + TRACE_CONTEXT(Download::complete, EVideoApi); + TRACE_0(""); + setState(Complete); +} + +QT_END_NAMESPACE + diff --git a/src/3rdparty/phonon/mmf/download.h b/src/3rdparty/phonon/mmf/download.h new file mode 100644 index 0000000..b57348b --- /dev/null +++ b/src/3rdparty/phonon/mmf/download.h @@ -0,0 +1,111 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this library. If not, see . + +*/ + +#ifndef PHONON_MMF_DOWNLOAD_H +#define PHONON_MMF_DOWNLOAD_H + +#include +#include +#include +#include + +QT_FORWARD_DECLARE_CLASS(QByteArray) +QT_FORWARD_DECLARE_CLASS(QFile) + +QT_BEGIN_NAMESPACE + +namespace Phonon +{ +namespace MMF +{ + +class Download; + +class DownloadPrivate : public QObject + , public MHttpDownloadMgrObserver +{ + Q_OBJECT +public: + DownloadPrivate(Download *parent); + ~DownloadPrivate(); + bool start(); + void resume(); +signals: + void error(); + void targetFileNameChanged(); + void lengthChanged(qint64 length); + void complete(); +private: + // MHttpDownloadMgrObserver + void HandleDMgrEventL(RHttpDownload &aDownload, THttpDownloadEvent aEvent); +private: + Download *m_parent; + RHttpDownloadMgr m_downloadManager; + RHttpDownload *m_download; + qint64 m_length; +}; + +class Download : public QObject +{ + Q_OBJECT + friend class DownloadPrivate; +public: + Download(const QUrl &url, QObject *parent = 0); + ~Download(); + const QUrl &sourceUrl() const; + const QString &targetFileName() const; + void start(); + + // Only has effect when QT_PHONON_MMF_DOWNLOAD_DUMMY is defined + void resume(); + + enum State { + Idle, + Initializing, + Downloading, + Complete, + Error + }; + +signals: + void lengthChanged(qint64 length); + void stateChanged(Download::State state); + +private: + void setState(State state); + + // Called by DownloadPrivate + void error(); + void downloadStarted(const QString &targetFileName); + void complete(); + +private: + DownloadPrivate *m_private; + QUrl m_sourceUrl; + QString m_targetFileName; + State m_state; +}; + +} +} + +QT_END_NAMESPACE + +Q_DECLARE_METATYPE(Phonon::MMF::Download::State) + +#endif diff --git a/src/plugins/phonon/mmf/mmf.pro b/src/plugins/phonon/mmf/mmf.pro index 7a6fdf8..902354f 100644 --- a/src/plugins/phonon/mmf/mmf.pro +++ b/src/plugins/phonon/mmf/mmf.pro @@ -36,6 +36,7 @@ symbian { $$PHONON_MMF_DIR/backend.h \ $$PHONON_MMF_DIR/bassboost.h \ $$PHONON_MMF_DIR/defs.h \ + $$PHONON_MMF_DIR/download.h \ $$PHONON_MMF_DIR/dummyplayer.h \ $$PHONON_MMF_DIR/effectfactory.h \ $$PHONON_MMF_DIR/effectparameter.h \ @@ -61,6 +62,7 @@ symbian { $$PHONON_MMF_DIR/abstractvideoplayer.cpp \ $$PHONON_MMF_DIR/backend.cpp \ $$PHONON_MMF_DIR/bassboost.cpp \ + $$PHONON_MMF_DIR/download.cpp \ $$PHONON_MMF_DIR/dummyplayer.cpp \ $$PHONON_MMF_DIR/effectfactory.cpp \ $$PHONON_MMF_DIR/effectparameter.cpp \ @@ -111,6 +113,7 @@ symbian { LIBS += -lapgrfx -lapmime # For recognizer LIBS += -lmmfcontrollerframework # For CMMFMetaDataEntry LIBS += -lmediaclientaudiostream # For CMdaAudioOutputStream + LIBS += -ldownloadmgr # These are for effects. LIBS += -lAudioEqualizerEffect -lBassBoostEffect -lDistanceAttenuationEffect -lDopplerBase -lEffectBase -lEnvironmentalReverbEffect -lListenerDopplerEffect -lListenerLocationEffect -lListenerOrientationEffect -lLocationBase -lLoudnessEffect -lOrientationBase -lSourceDopplerEffect -lSourceLocationEffect -lSourceOrientationEffect -lStereoWideningEffect -- cgit v0.12 From 865a9214fbb858cd5089aa3073ad2cff305017ea Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 28 Sep 2010 11:05:41 +0100 Subject: Progressive download in Phonon MMF backend: integrated with player This commit integrates the Download class with the media playback classes in the backend, to implement Progressive Download. Note that this PDL implementation has one drawback: when video playback is paused due to shortage of data (i.e. due to the download being temporarily stalled), the display goes black. This is because, when the end of the currently-downloaded data is reached, the playback session is closed. When more data becomes available, the clip is re-opened, a seek is done to reach the previous playback position, and playback is re-started. Closing the playback session closes the video stack's connection to the display, thereby causing the video widget to go black while more data is buffered. This is a consequence of the level in the native video stack at which the Phonon integration is done: managing a network stall without requiring the playback session to be closed would require integration below the MMF client API, specifically at the MMF controller level. Task-number: QTBUG-10769 Reviewed-by: Derick Hawcroft --- src/3rdparty/phonon/mmf/abstractmediaplayer.cpp | 148 +++++++++++++++++++++--- src/3rdparty/phonon/mmf/abstractmediaplayer.h | 17 +++ src/3rdparty/phonon/mmf/abstractvideoplayer.cpp | 24 +++- src/3rdparty/phonon/mmf/abstractvideoplayer.h | 5 +- src/3rdparty/phonon/mmf/audioplayer.cpp | 18 ++- src/3rdparty/phonon/mmf/audioplayer.h | 5 +- src/3rdparty/phonon/mmf/mediaobject.cpp | 36 +++--- src/3rdparty/phonon/mmf/mediaobject.h | 1 + 8 files changed, 211 insertions(+), 43 deletions(-) diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp index 3702560..a728423 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp @@ -51,10 +51,13 @@ MMF::AbstractMediaPlayer::AbstractMediaPlayer , m_parent(parent) , m_pending(NothingPending) , m_positionTimer(new QTimer(this)) + , m_position(0) , m_bufferStatusTimer(new QTimer(this)) , m_mmfMaxVolume(NullMaxVolume) , m_prefinishMarkSent(false) , m_aboutToFinishSent(false) + , m_download(0) + , m_downloadStalled(false) { connect(m_positionTimer.data(), SIGNAL(timeout()), this, SLOT(positionTick())); connect(m_bufferStatusTimer.data(), SIGNAL(timeout()), this, SLOT(bufferStatusTick())); @@ -183,6 +186,7 @@ void MMF::AbstractMediaPlayer::seek(qint64 ms) } doSeek(ms); + m_position = ms; resetMarksIfRewound(); if(wasPlaying && state() != ErrorState) { @@ -207,6 +211,11 @@ bool MMF::AbstractMediaPlayer::isSeekable() const return true; } +qint64 MMF::AbstractMediaPlayer::currentTime() const +{ + return m_position; +} + void MMF::AbstractMediaPlayer::doSetTickInterval(qint32 interval) { TRACE_CONTEXT(AbstractMediaPlayer::doSetTickInterval, EAudioApi); @@ -247,6 +256,14 @@ void MMF::AbstractMediaPlayer::open() symbianErr = openFile(*file); if (KErrNone != symbianErr) errorMessage = tr("Error opening file"); + } else if (url.scheme() == QLatin1String("http")) { + Q_ASSERT(!m_download); + m_download = new Download(url, this); + connect(m_download, SIGNAL(lengthChanged(qint64)), + this, SLOT(downloadLengthChanged(qint64))); + connect(m_download, SIGNAL(stateChanged(Download::State)), + this, SLOT(downloadStateChanged(Download::State))); + m_download->start(); } else { symbianErr = openUrl(url.toString()); if (KErrNone != symbianErr) @@ -288,6 +305,14 @@ void MMF::AbstractMediaPlayer::open() TRACE_EXIT_0(); } +void MMF::AbstractMediaPlayer::close() +{ + doClose(); + delete m_download; + m_download = 0; + m_position = 0; +} + void MMF::AbstractMediaPlayer::volumeChanged(qreal volume) { TRACE_CONTEXT(AbstractMediaPlayer::volumeChanged, EAudioInternal); @@ -374,7 +399,8 @@ void MMF::AbstractMediaPlayer::bufferingComplete() { stopBufferStatusTimer(); emit MMF::AbstractPlayer::bufferStatus(100); - changeState(m_stateBeforeBuffering); + if (!progressiveDownloadStalled()) + changeState(m_stateBeforeBuffering); } void MMF::AbstractMediaPlayer::maxVolumeChanged(int mmfMaxVolume) @@ -385,13 +411,28 @@ void MMF::AbstractMediaPlayer::maxVolumeChanged(int mmfMaxVolume) void MMF::AbstractMediaPlayer::loadingComplete(int error) { - Q_ASSERT(Phonon::LoadingState == state()); - - if (KErrNone == error) { - updateMetaData(); - changeState(StoppedState); + TRACE_CONTEXT(AbstractMediaPlayer::loadingComplete, EAudioApi); + TRACE_ENTRY("state %d error %d", state(), error); + if (progressiveDownloadStalled()) { + Q_ASSERT(Phonon::BufferingState == state()); + if (KErrNone == error) { + bufferingComplete(); + doSeek(m_position); + startPlayback(); + m_downloadStalled = false; + } } else { - setError(tr("Loading clip failed"), error); + Q_ASSERT(Phonon::LoadingState == state()); + if (KErrNone == error) { + updateMetaData(); + changeState(StoppedState); + } else { + if (isProgressiveDownload() && KErrCorrupt == error) { + setProgressiveDownloadStalled(); + } else { + setError(tr("Loading clip failed"), error); + } + } } } @@ -415,8 +456,12 @@ void MMF::AbstractMediaPlayer::playbackComplete(int error) QMetaObject::invokeMethod(m_parent, "switchToNextSource", Qt::QueuedConnection); } else { - setError(tr("Playback complete"), error); - emit finished(); + if (isProgressiveDownload() && KErrCorrupt == error) { + setProgressiveDownloadStalled(); + } else { + setError(tr("Playback complete"), error); + emit finished(); + } } } @@ -425,15 +470,28 @@ qint64 MMF::AbstractMediaPlayer::toMilliSeconds(const TTimeIntervalMicroSeconds return in.Int64() / 1000; } +bool MMF::AbstractMediaPlayer::isProgressiveDownload() const +{ + return (0 != m_download); +} + +bool MMF::AbstractMediaPlayer::progressiveDownloadStalled() const +{ + return m_downloadStalled; +} + //----------------------------------------------------------------------------- // Slots //----------------------------------------------------------------------------- void MMF::AbstractMediaPlayer::positionTick() { - const qint64 current = currentTime(); - emitMarksIfReached(current); - emit MMF::AbstractPlayer::tick(current); + const qint64 pos = getCurrentTime(); + if (pos > m_position) { + m_position = pos; + emitMarksIfReached(m_position); + emit MMF::AbstractPlayer::tick(m_position); + } } void MMF::AbstractMediaPlayer::emitMarksIfReached(qint64 current) @@ -458,7 +516,7 @@ void MMF::AbstractMediaPlayer::emitMarksIfReached(qint64 current) void MMF::AbstractMediaPlayer::resetMarksIfRewound() { - const qint64 current = currentTime(); + const qint64 current = getCurrentTime(); const qint64 total = totalTime(); const qint64 remaining = total - current; @@ -487,9 +545,71 @@ void MMF::AbstractMediaPlayer::startPlayback() changeState(PlayingState); } +void MMF::AbstractMediaPlayer::setProgressiveDownloadStalled() +{ + TRACE_CONTEXT(AbstractMediaPlayer::setProgressiveDownloadStalled, EAudioApi); + TRACE_ENTRY("state %d", state()); + Q_ASSERT(isProgressiveDownload()); + m_downloadStalled = true; + doClose(); + bufferingStarted(); + // Video player loses window handle when closed - need to reapply it here + videoOutputChanged(); +#ifdef QT_PHONON_MMF_DOWNLOAD_DUMMY + m_download->resume(); +#endif +} + void MMF::AbstractMediaPlayer::bufferStatusTick() { - emit MMF::AbstractPlayer::bufferStatus(bufferStatus()); + // During progressive download, there is no way to detect the buffering status. + // Phonon does not support a "buffering; amount unknown" signal, therefore we + // return a buffering status of zero. + const int status = progressiveDownloadStalled() ? 0 : bufferStatus(); + emit MMF::AbstractPlayer::bufferStatus(status); +} + +void MMF::AbstractMediaPlayer::downloadLengthChanged(qint64 length) +{ + TRACE_CONTEXT(AbstractMediaPlayer::downloadLengthChanged, EAudioApi); + TRACE_ENTRY("length %Ld", length); + Q_UNUSED(length) + if (m_downloadStalled) { + bufferingComplete(); + int err = m_parent->openFileHandle(m_download->targetFileName()); + if (KErrNone == err) + err = openFile(*m_parent->file()); + if (KErrNone != err) + setError(tr("Error opening file")); + } +} + +void MMF::AbstractMediaPlayer::downloadStateChanged(Download::State state) +{ + TRACE_CONTEXT(AbstractMediaPlayer::downloadStateChanged, EAudioApi); + TRACE_ENTRY("state %d", state); + switch (state) { + case Download::Idle: + case Download::Initializing: + break; + case Download::Downloading: + { + int err = m_parent->openFileHandle(m_download->targetFileName()); + if (KErrNone == err) + err = openFile(*m_parent->file()); + else if (KErrCorrupt == err) + // Insufficient data downloaded - enter Buffering state + setProgressiveDownloadStalled(); + if (KErrNone != err) + setError(tr("Error opening file")); + } + break; + case Download::Complete: + break; + case Download::Error: + setError(tr("Download error")); + break; + } } Phonon::State MMF::AbstractMediaPlayer::phononState(PrivateState state) const diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.h b/src/3rdparty/phonon/mmf/abstractmediaplayer.h index e795ecb..99fc101 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.h +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.h @@ -23,6 +23,7 @@ along with this library. If not, see . #include #include #include "abstractplayer.h" +#include "download.h" class RFile; @@ -48,6 +49,7 @@ protected: public: virtual void open(); + virtual void close(); // MediaObjectInterface virtual void play(); @@ -55,6 +57,7 @@ public: virtual void stop(); virtual void seek(qint64 milliseconds); virtual bool isSeekable() const; + virtual qint64 currentTime() const; virtual void volumeChanged(qreal volume); protected: @@ -68,12 +71,15 @@ protected: virtual void doStop() = 0; virtual void doSeek(qint64 pos) = 0; virtual int setDeviceVolume(int mmfVolume) = 0; + virtual int openFile(const QString &fileName) = 0; virtual int openFile(RFile& file) = 0; virtual int openUrl(const QString& url) = 0; virtual int openDescriptor(const TDesC8 &des) = 0; virtual int bufferStatus() const = 0; + virtual void doClose() = 0; void updateMetaData(); + virtual qint64 getCurrentTime() const = 0; virtual int numberOfMetaDataEntries() const = 0; virtual QPair metaDataEntry(int index) const = 0; @@ -86,6 +92,9 @@ protected: static qint64 toMilliSeconds(const TTimeIntervalMicroSeconds &); + bool isProgressiveDownload() const; + bool progressiveDownloadStalled() const; + private: void startPositionTimer(); void stopPositionTimer(); @@ -96,6 +105,7 @@ private: void emitMarksIfReached(qint64 position); void resetMarksIfRewound(); void startPlayback(); + void setProgressiveDownloadStalled(); enum Pending { NothingPending, @@ -108,6 +118,8 @@ private: private Q_SLOTS: void positionTick(); void bufferStatusTick(); + void downloadLengthChanged(qint64); + void downloadStateChanged(Download::State); private: MediaObject *const m_parent; @@ -115,6 +127,7 @@ private: Pending m_pending; QScopedPointer m_positionTimer; + qint64 m_position; QScopedPointer m_bufferStatusTimer; PrivateState m_stateBeforeBuffering; @@ -127,6 +140,10 @@ private: // Used for playback of resource files TPtrC8 m_buffer; + // Used for progressive download + Download *m_download; + bool m_downloadStalled; + QMultiMap m_metaData; }; diff --git a/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp b/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp index fb20bea..1ab5bae 100644 --- a/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp @@ -16,6 +16,7 @@ along with this library. If not, see . */ +#include #include #include #include @@ -132,6 +133,13 @@ int MMF::AbstractVideoPlayer::setDeviceVolume(int mmfVolume) return err; } +int MMF::AbstractVideoPlayer::openFile(const QString &fileName) +{ + const QHBufC nativeFileName(QDir::toNativeSeparators(fileName)); + TRAPD(err, m_player->OpenFileL(*nativeFileName)); + return err; +} + int MMF::AbstractVideoPlayer::openFile(RFile &file) { TRAPD(err, m_player->OpenFileL(file)); @@ -157,7 +165,7 @@ int MMF::AbstractVideoPlayer::bufferStatus() const return result; } -void MMF::AbstractVideoPlayer::close() +void MMF::AbstractVideoPlayer::doClose() { m_player->Close(); } @@ -167,9 +175,9 @@ bool MMF::AbstractVideoPlayer::hasVideo() const return true; } -qint64 MMF::AbstractVideoPlayer::currentTime() const +qint64 MMF::AbstractVideoPlayer::getCurrentTime() const { - TRACE_CONTEXT(AbstractVideoPlayer::currentTime, EVideoApi); + TRACE_CONTEXT(AbstractVideoPlayer::getCurrentTime, EVideoApi); TTimeIntervalMicroSeconds us; TRAPD(err, us = m_player->PositionL()) @@ -246,7 +254,9 @@ 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)); + __ASSERT_ALWAYS(LoadingState == state() || + progressiveDownloadStalled() && BufferingState == state(), + Utils::panic(InvalidStatePanic)); if (KErrNone == aError) m_player->Prepare(); @@ -261,7 +271,9 @@ 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)); + __ASSERT_ALWAYS(LoadingState == state() || + progressiveDownloadStalled() && BufferingState == state(), + Utils::panic(InvalidStatePanic)); TRAPD(err, getVideoClipParametersL(aError)); @@ -470,7 +482,7 @@ void MMF::AbstractVideoPlayer::updateScaleFactors(const QSize &windowSize, bool void MMF::AbstractVideoPlayer::parametersChanged(VideoParameters parameters) { - if (state() == LoadingState) + if (state() == LoadingState || progressiveDownloadStalled() && BufferingState == state()) m_pendingChanges |= parameters; else handleParametersChanged(parameters); diff --git a/src/3rdparty/phonon/mmf/abstractvideoplayer.h b/src/3rdparty/phonon/mmf/abstractvideoplayer.h index 3ff3c75..3bc5c7c 100644 --- a/src/3rdparty/phonon/mmf/abstractvideoplayer.h +++ b/src/3rdparty/phonon/mmf/abstractvideoplayer.h @@ -64,21 +64,22 @@ public: virtual void doStop(); virtual void doSeek(qint64 milliseconds); virtual int setDeviceVolume(int mmfVolume); + virtual int openFile(const QString &fileName); virtual int openFile(RFile &file); virtual int openUrl(const QString &url); virtual int openDescriptor(const TDesC8 &des); virtual int bufferStatus() const; - virtual void close(); + virtual void doClose(); // MediaObjectInterface virtual bool hasVideo() const; - virtual qint64 currentTime() const; virtual qint64 totalTime() const; // AbstractPlayer virtual void videoOutputChanged(); // AbstractMediaPlayer + virtual qint64 getCurrentTime() const; virtual int numberOfMetaDataEntries() const; virtual QPair metaDataEntry(int index) const; diff --git a/src/3rdparty/phonon/mmf/audioplayer.cpp b/src/3rdparty/phonon/mmf/audioplayer.cpp index 7c8b9bd..dc5c800 100644 --- a/src/3rdparty/phonon/mmf/audioplayer.cpp +++ b/src/3rdparty/phonon/mmf/audioplayer.cpp @@ -16,6 +16,7 @@ along with this library. If not, see . */ +#include #include #include "audioplayer.h" @@ -109,6 +110,13 @@ int MMF::AudioPlayer::setDeviceVolume(int mmfVolume) #endif } +int MMF::AudioPlayer::openFile(const QString &fileName) +{ + const QHBufC nativeFileName(QDir::toNativeSeparators(fileName)); + TRAPD(err, m_player->OpenFileL(*nativeFileName)); + return err; +} + int MMF::AudioPlayer::openFile(RFile& file) { TRAPD(err, m_player->OpenFileL(file)); @@ -150,7 +158,7 @@ int MMF::AudioPlayer::bufferStatus() const return result; } -void MMF::AudioPlayer::close() +void MMF::AudioPlayer::doClose() { m_player->Close(); } @@ -160,9 +168,9 @@ bool MMF::AudioPlayer::hasVideo() const return false; } -qint64 MMF::AudioPlayer::currentTime() const +qint64 MMF::AudioPlayer::getCurrentTime() const { - TRACE_CONTEXT(AudioPlayer::currentTime, EAudioApi); + TRACE_CONTEXT(AudioPlayer::getCurrentTime, EAudioApi); TTimeIntervalMicroSeconds us; const TInt err = m_player->GetPosition(us); @@ -203,7 +211,9 @@ void MMF::AudioPlayer::MapcInitComplete(TInt aError, TRACE_CONTEXT(AudioPlayer::MapcInitComplete, EAudioInternal); TRACE_ENTRY("state %d error %d", state(), aError); - __ASSERT_ALWAYS(LoadingState == state(), Utils::panic(InvalidStatePanic)); + __ASSERT_ALWAYS(LoadingState == state() || + progressiveDownloadStalled() && BufferingState == state(), + Utils::panic(InvalidStatePanic)); if (KErrNone == aError) { maxVolumeChanged(m_player->MaxVolume()); diff --git a/src/3rdparty/phonon/mmf/audioplayer.h b/src/3rdparty/phonon/mmf/audioplayer.h index e43cadd..cf4f6d5 100644 --- a/src/3rdparty/phonon/mmf/audioplayer.h +++ b/src/3rdparty/phonon/mmf/audioplayer.h @@ -65,18 +65,19 @@ typedef CMdaAudioPlayerUtility NativePlayer; virtual void doStop(); virtual void doSeek(qint64 milliseconds); virtual int setDeviceVolume(int mmfVolume); + virtual int openFile(const QString &fileName); virtual int openFile(RFile& file); virtual int openUrl(const QString& url); virtual int openDescriptor(const TDesC8 &des); virtual int bufferStatus() const; - virtual void close(); + virtual void doClose(); // MediaObjectInterface virtual bool hasVideo() const; - virtual qint64 currentTime() const; virtual qint64 totalTime() const; // AbstractMediaPlayer + virtual qint64 getCurrentTime() const; virtual int numberOfMetaDataEntries() const; virtual QPair metaDataEntry(int index) const; diff --git a/src/3rdparty/phonon/mmf/mediaobject.cpp b/src/3rdparty/phonon/mmf/mediaobject.cpp index 98326b8..2c7a7ef 100644 --- a/src/3rdparty/phonon/mmf/mediaobject.cpp +++ b/src/3rdparty/phonon/mmf/mediaobject.cpp @@ -61,6 +61,9 @@ MMF::MediaObject::MediaObject(QObject *parent) : MMF::MediaNode::MediaNode(paren TRACE_CONTEXT(MediaObject::MediaObject, EAudioApi); TRACE_ENTRY_0(); + const int err = m_fileServer.Connect(); + QT_TRAP_THROWING(User::LeaveIfError(err)); + Q_UNUSED(parent); TRACE_EXIT_0(); @@ -99,12 +102,6 @@ bool MMF::MediaObject::openRecognizer() return false; } - err = m_fileServer.Connect(); - if (KErrNone != err) { - TRACE("RFs::Connect error %d", err); - return false; - } - // This must be called in order to be able to share file handles with // the recognizer server (see fileMediaType function). err = m_fileServer.ShareProtected(); @@ -127,13 +124,8 @@ MMF::MediaType MMF::MediaObject::fileMediaType MediaType result = MediaTypeUnknown; if (openRecognizer()) { - - const QHBufC fileNameSymbian(QDir::toNativeSeparators(fileName)); - - Q_ASSERT(!m_file); - m_file = new RFile; - TInt err = m_file->Open(m_fileServer, *fileNameSymbian, EFileRead | EFileShareReadersOnly); - + TInt err = openFileHandle(fileName); + const QHBufC nativeFileName(QDir::toNativeSeparators(fileName)); if (KErrNone == err) { TDataRecognitionResult recognizerResult; err = m_recognizer.RecognizeData(*m_file, recognizerResult); @@ -141,16 +133,30 @@ MMF::MediaType MMF::MediaObject::fileMediaType const TPtrC mimeType = recognizerResult.iDataType.Des(); result = Utils::mimeTypeToMediaType(mimeType); } else { - TRACE("RApaLsSession::RecognizeData filename %S error %d", fileNameSymbian.data(), err); + TRACE("RApaLsSession::RecognizeData filename %S error %d", nativeFileName.data(), err); } } else { - TRACE("RFile::Open filename %S error %d", fileNameSymbian.data(), err); + TRACE("RFile::Open filename %S error %d", nativeFileName.data(), err); } } return result; } +int MMF::MediaObject::openFileHandle(const QString &fileName) +{ + TRACE_CONTEXT(MediaObject::openFileHandle, EAudioInternal); + const QHBufC nativeFileName(QDir::toNativeSeparators(fileName)); + TRACE_ENTRY("filename %S", nativeFileName.data()); + if (m_file) + m_file->Close(); + delete m_file; + m_file = 0; + m_file = new RFile; + TInt err = m_file->Open(m_fileServer, *nativeFileName, EFileRead | EFileShareReadersOrWriters); + return err; +} + MMF::MediaType MMF::MediaObject::bufferMediaType(const uchar *data, qint64 size) { TRACE_CONTEXT(MediaObject::bufferMediaType, EAudioInternal); diff --git a/src/3rdparty/phonon/mmf/mediaobject.h b/src/3rdparty/phonon/mmf/mediaobject.h index 5399e27..5d785fb 100644 --- a/src/3rdparty/phonon/mmf/mediaobject.h +++ b/src/3rdparty/phonon/mmf/mediaobject.h @@ -89,6 +89,7 @@ public: void setVideoOutput(AbstractVideoOutput* videoOutput); + int openFileHandle(const QString &fileName); RFile* file() const; QResource* resource() const; -- cgit v0.12 From bd53ef2094a020789e9543156c524cd90a2d5302 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Mon, 27 Sep 2010 18:07:35 +0100 Subject: qmediaplayer: show buffer status of 0% During progressive download, it is not possible for the Symbian MMF Phonon backend to determine the buffering status, so it returns a value of 0%. This change causes qmediaplayer to display this value in the UI, thereby giving a visible notification of buffering during progressive download. Task-number: QTBUG-10769 Reviewed-by: Derick Hawcroft --- demos/qmediaplayer/mediaplayer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/qmediaplayer/mediaplayer.cpp b/demos/qmediaplayer/mediaplayer.cpp index 3cb0616..97a8e35 100644 --- a/demos/qmediaplayer/mediaplayer.cpp +++ b/demos/qmediaplayer/mediaplayer.cpp @@ -716,7 +716,7 @@ void MediaPlayer::openFile() void MediaPlayer::bufferStatus(int percent) { - if (percent == 0 || percent == 100) + if (percent == 100) progressLabel->setText(QString()); else { QString str = QString::fromLatin1("(%1%)").arg(percent); -- cgit v0.12 From c168be1aa3dc4f7ccc70d530244fc97af0b4d1e1 Mon Sep 17 00:00:00 2001 From: mread Date: Fri, 1 Oct 2010 13:13:42 +0100 Subject: fixed hybrid heap Symbian udeb build issues Fixed name collision with TAllocFail Added definition for EDebugHdrSize and fixed scope issue Added definition for SRAllocatorBurstFail Added a definition for global enum ETHeapBadDebugFailParameter Tested compilation on: Symbian^3 RnD - armv5_urel, armv5_udeb, winscw_urel, winscw_udeb S60 3.1 SDK - armv5_urel, armv5_udeb S60 5.0 SDK - armv5_urel, armv5_udeb Symbian^3 PDK - armv5_urel, armv5_udeb Symbian^4 RnD - armv5_urel, armv5_udeb Basic functional testing on N8 armv5_urel Task-number: QTBUG-14168 Reviewed-by: Shane Kearns --- src/corelib/arch/symbian/debugfunction.cpp | 2 +- src/corelib/arch/symbian/heap_hybrid_p.h | 6 +++++- src/corelib/arch/symbian/qt_hybridheap_symbian_p.h | 3 +++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/corelib/arch/symbian/debugfunction.cpp b/src/corelib/arch/symbian/debugfunction.cpp index f3b5d2d..91f6917 100644 --- a/src/corelib/arch/symbian/debugfunction.cpp +++ b/src/corelib/arch/symbian/debugfunction.cpp @@ -549,7 +549,7 @@ void ResetAllocCellLevels(TAny* aPtr, RHybridHeap::TCellType aType, TAny* aCell, if (aType == RHybridHeap::EGoodAllocatedCell) { - RHybridHeap::SDebugCell* DbgCell = (RHybridHeap::SDebugCell*)((TUint8*)aCell-RHeap::EDebugHdrSize); + RHybridHeap::SDebugCell* DbgCell = (RHybridHeap::SDebugCell*)((TUint8*)aCell-RHybridHeap::EDebugHdrSize); DbgCell->nestingLevel = 0; } } diff --git a/src/corelib/arch/symbian/heap_hybrid_p.h b/src/corelib/arch/symbian/heap_hybrid_p.h index 736af72..95fb3d4 100644 --- a/src/corelib/arch/symbian/heap_hybrid_p.h +++ b/src/corelib/arch/symbian/heap_hybrid_p.h @@ -103,11 +103,15 @@ public: EGetSize=48, EGetMaxLength, EGetBase, EAlignInteger, EAlignAddr }; enum TDebugOp { EWalk = 128, EHybridHeap }; - enum TAllocFail + enum THybridAllocFail { ERandom, ETrueRandom, EDeterministic, EHybridNone, EFailNext, EReset, EBurstRandom, EBurstTrueRandom, EBurstDeterministic, EBurstFailNext, ECheckFailure, }; + enum { EDebugHdrSize = sizeof(SDebugCell) }; +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS + struct SRAllocatorBurstFail {TInt iBurst; TInt iRate; TInt iUnused[2];}; +#endif struct HeapInfo { diff --git a/src/corelib/arch/symbian/qt_hybridheap_symbian_p.h b/src/corelib/arch/symbian/qt_hybridheap_symbian_p.h index 5827aca..92cfe0e 100644 --- a/src/corelib/arch/symbian/qt_hybridheap_symbian_p.h +++ b/src/corelib/arch/symbian/qt_hybridheap_symbian_p.h @@ -100,6 +100,9 @@ inline int noBTrace() {return 0;} #define BTraceContext12(a,b,c,d,e) noBTrace() #endif +// declare ETHeapBadDebugFailParameter, where missing +#define ETHeapBadDebugFailParameter ((TCdtPanic)213) + #ifndef QT_SYMBIAN_HAVE_U32STD_H struct SThreadCreateInfo { -- cgit v0.12 From d1b2480f33641055f2d729212addf059577a4e01 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Fri, 1 Oct 2010 15:33:37 +0100 Subject: Fixed crash on startup in Symbian debug build This fixes a typo in a debug-only function in the hybrid heap allocator. The typo causes an assertion to fail during startup of applications, when using a debug build of Qt. Reviewed-by: mread --- src/corelib/arch/symbian/debugfunction.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/arch/symbian/debugfunction.cpp b/src/corelib/arch/symbian/debugfunction.cpp index 91f6917..31937e8 100644 --- a/src/corelib/arch/symbian/debugfunction.cpp +++ b/src/corelib/arch/symbian/debugfunction.cpp @@ -1105,7 +1105,7 @@ void RHybridHeap::DoCheckSlab(slab* aSlab, TAllocatorType aSlabType, TAny* aBfr) unsigned used = SlabHeaderUsedm4(h)+4; unsigned size = SlabHeaderSize(h); __HEAP_CORRUPTED_TEST( (used < SLABSIZE),ETHeapBadCellAddress, aBfr, aSlab); - __HEAP_CORRUPTED_TEST( ((size > 3 ) && (size < MAXSLABSIZE)), ETHeapBadCellAddress,aBfr,aSlab); + __HEAP_CORRUPTED_TEST( ((size > 3 ) && (size <= MAXSLABSIZE)), ETHeapBadCellAddress,aBfr,aSlab); unsigned count = 0; switch ( aSlabType ) -- cgit v0.12 From 51d007e0fa699339f072956bbd8bfe33db9b7f70 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Sun, 3 Oct 2010 19:43:29 +0100 Subject: Added qmake check for presence of RHttpDownloadMgr header downloadmgrclient.h is not found on S^4 baselines, causing a build failure. This commit is a temporary workaround, which disables progressive download support if the header is not found. The correct solution is to determine whether the RHttpDownloadMgr definition has moved, and if so, to modify the .pro file to include the new path. Task-number: QTBUG-10769 Reviewed-by: TrustMe --- src/3rdparty/phonon/mmf/abstractmediaplayer.cpp | 26 ++++++++++-- src/3rdparty/phonon/mmf/abstractmediaplayer.h | 9 ++++- src/3rdparty/phonon/mmf/download.h | 2 - src/plugins/phonon/mmf/mmf.pro | 53 +++++++++++++++---------- 4 files changed, 61 insertions(+), 29 deletions(-) diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp index a728423..dfc5840 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp @@ -56,8 +56,10 @@ MMF::AbstractMediaPlayer::AbstractMediaPlayer , m_mmfMaxVolume(NullMaxVolume) , m_prefinishMarkSent(false) , m_aboutToFinishSent(false) +#ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD , m_download(0) , m_downloadStalled(false) +#endif { connect(m_positionTimer.data(), SIGNAL(timeout()), this, SLOT(positionTick())); connect(m_bufferStatusTimer.data(), SIGNAL(timeout()), this, SLOT(bufferStatusTick())); @@ -256,7 +258,9 @@ void MMF::AbstractMediaPlayer::open() symbianErr = openFile(*file); if (KErrNone != symbianErr) errorMessage = tr("Error opening file"); - } else if (url.scheme() == QLatin1String("http")) { + } +#ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD + else if (url.scheme() == QLatin1String("http")) { Q_ASSERT(!m_download); m_download = new Download(url, this); connect(m_download, SIGNAL(lengthChanged(qint64)), @@ -264,7 +268,9 @@ void MMF::AbstractMediaPlayer::open() connect(m_download, SIGNAL(stateChanged(Download::State)), this, SLOT(downloadStateChanged(Download::State))); m_download->start(); - } else { + } +#endif + else { symbianErr = openUrl(url.toString()); if (KErrNone != symbianErr) errorMessage = tr("Error opening URL"); @@ -308,8 +314,10 @@ void MMF::AbstractMediaPlayer::open() void MMF::AbstractMediaPlayer::close() { doClose(); +#ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD delete m_download; m_download = 0; +#endif m_position = 0; } @@ -419,7 +427,9 @@ void MMF::AbstractMediaPlayer::loadingComplete(int error) bufferingComplete(); doSeek(m_position); startPlayback(); +#ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD m_downloadStalled = false; +#endif } } else { Q_ASSERT(Phonon::LoadingState == state()); @@ -472,12 +482,20 @@ qint64 MMF::AbstractMediaPlayer::toMilliSeconds(const TTimeIntervalMicroSeconds bool MMF::AbstractMediaPlayer::isProgressiveDownload() const { +#ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD return (0 != m_download); +#else + return false; +#endif } bool MMF::AbstractMediaPlayer::progressiveDownloadStalled() const { +#ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD return m_downloadStalled; +#else + return false; +#endif } //----------------------------------------------------------------------------- @@ -547,6 +565,7 @@ void MMF::AbstractMediaPlayer::startPlayback() void MMF::AbstractMediaPlayer::setProgressiveDownloadStalled() { +#ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD TRACE_CONTEXT(AbstractMediaPlayer::setProgressiveDownloadStalled, EAudioApi); TRACE_ENTRY("state %d", state()); Q_ASSERT(isProgressiveDownload()); @@ -555,7 +574,6 @@ void MMF::AbstractMediaPlayer::setProgressiveDownloadStalled() bufferingStarted(); // Video player loses window handle when closed - need to reapply it here videoOutputChanged(); -#ifdef QT_PHONON_MMF_DOWNLOAD_DUMMY m_download->resume(); #endif } @@ -569,6 +587,7 @@ void MMF::AbstractMediaPlayer::bufferStatusTick() emit MMF::AbstractPlayer::bufferStatus(status); } +#ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD void MMF::AbstractMediaPlayer::downloadLengthChanged(qint64 length) { TRACE_CONTEXT(AbstractMediaPlayer::downloadLengthChanged, EAudioApi); @@ -611,6 +630,7 @@ void MMF::AbstractMediaPlayer::downloadStateChanged(Download::State state) break; } } +#endif // PHONON_MMF_PROGRESSIVE_DOWNLOAD Phonon::State MMF::AbstractMediaPlayer::phononState(PrivateState state) const { diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.h b/src/3rdparty/phonon/mmf/abstractmediaplayer.h index 99fc101..c3b4528 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.h +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.h @@ -23,7 +23,9 @@ along with this library. If not, see . #include #include #include "abstractplayer.h" -#include "download.h" +#ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD +# include "download.h" +#endif class RFile; @@ -118,8 +120,10 @@ private: private Q_SLOTS: void positionTick(); void bufferStatusTick(); +#ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD void downloadLengthChanged(qint64); void downloadStateChanged(Download::State); +#endif private: MediaObject *const m_parent; @@ -140,9 +144,10 @@ private: // Used for playback of resource files TPtrC8 m_buffer; - // Used for progressive download +#ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD Download *m_download; bool m_downloadStalled; +#endif QMultiMap m_metaData; diff --git a/src/3rdparty/phonon/mmf/download.h b/src/3rdparty/phonon/mmf/download.h index b57348b..bda7963 100644 --- a/src/3rdparty/phonon/mmf/download.h +++ b/src/3rdparty/phonon/mmf/download.h @@ -70,8 +70,6 @@ public: const QUrl &sourceUrl() const; const QString &targetFileName() const; void start(); - - // Only has effect when QT_PHONON_MMF_DOWNLOAD_DUMMY is defined void resume(); enum State { diff --git a/src/plugins/phonon/mmf/mmf.pro b/src/plugins/phonon/mmf/mmf.pro index 902354f..ac11188 100644 --- a/src/plugins/phonon/mmf/mmf.pro +++ b/src/plugins/phonon/mmf/mmf.pro @@ -36,7 +36,6 @@ symbian { $$PHONON_MMF_DIR/backend.h \ $$PHONON_MMF_DIR/bassboost.h \ $$PHONON_MMF_DIR/defs.h \ - $$PHONON_MMF_DIR/download.h \ $$PHONON_MMF_DIR/dummyplayer.h \ $$PHONON_MMF_DIR/effectfactory.h \ $$PHONON_MMF_DIR/effectparameter.h \ @@ -62,7 +61,6 @@ symbian { $$PHONON_MMF_DIR/abstractvideoplayer.cpp \ $$PHONON_MMF_DIR/backend.cpp \ $$PHONON_MMF_DIR/bassboost.cpp \ - $$PHONON_MMF_DIR/download.cpp \ $$PHONON_MMF_DIR/dummyplayer.cpp \ $$PHONON_MMF_DIR/effectfactory.cpp \ $$PHONON_MMF_DIR/effectparameter.cpp \ @@ -77,25 +75,37 @@ symbian { $$PHONON_MMF_DIR/utils.cpp \ $$PHONON_MMF_DIR/videowidget.cpp - # Test for whether the build environment supports video rendering to graphics - # surfaces. - symbian: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 \ + symbian { + # 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 \ + } + + # Test whether the build environment includes support for the Download Manager + # API, required for Progressive Download + exists($${EPOCROOT}epoc32/include/downloadmgrclient.h) | \ + exists($${EPOCROOT}epoc32/include/mw/downloadmgrclient.h) { + HEADERS += $$PHONON_MMF_DIR/download.h + SOURCES += $$PHONON_MMF_DIR/download.cpp + LIBS += -ldownloadmgr + DEFINES += PHONON_MMF_PROGRESSIVE_DOWNLOAD + } } LIBS += -lcone @@ -113,7 +123,6 @@ symbian { LIBS += -lapgrfx -lapmime # For recognizer LIBS += -lmmfcontrollerframework # For CMMFMetaDataEntry LIBS += -lmediaclientaudiostream # For CMdaAudioOutputStream - LIBS += -ldownloadmgr # These are for effects. LIBS += -lAudioEqualizerEffect -lBassBoostEffect -lDistanceAttenuationEffect -lDopplerBase -lEffectBase -lEnvironmentalReverbEffect -lListenerDopplerEffect -lListenerLocationEffect -lListenerOrientationEffect -lLocationBase -lLoudnessEffect -lOrientationBase -lSourceDopplerEffect -lSourceLocationEffect -lSourceOrientationEffect -lStereoWideningEffect -- cgit v0.12 From c2ed7b0cb9b9db105c650301af5bd3199cdd032e Mon Sep 17 00:00:00 2001 From: axis Date: Mon, 4 Oct 2010 09:32:42 +0200 Subject: Got rid of "No such directory" warning when shadow building. RevBy: Thomas Zander --- configure | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 53f520a..f7904d9 100755 --- a/configure +++ b/configure @@ -4902,9 +4902,8 @@ case "$XPLATFORM" in *symbian*) # Raptor does not support configure tests. # the main commands needed to compile; - (cd config.tests/symbian - mkdir -p rcomp - cd rcomp + (mkdir -p config.tests/symbian/rcomp + cd config.tests/symbian/rcomp rm -f rcomp_test.rsg touch rcomp_test.rpp rcomp_test.rsc rcomp_test.rss rcomp -u -m045,046,047 -s./rcomp_test.rpp -o./rcomp_test.rsc -h./rcomp_test.rsg -i./rcomp_test.rss 2>&1 > /dev/null -- cgit v0.12 From 9dae9599c4d19ca55693df0b81bacbc1255ec733 Mon Sep 17 00:00:00 2001 From: axis Date: Mon, 4 Oct 2010 09:33:20 +0200 Subject: Made scripttools disabled on Symbian by default, like on Windows. RevBy: Miikka Heikkinen --- configure | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/configure b/configure index f7904d9..aca3467 100755 --- a/configure +++ b/configure @@ -7224,7 +7224,14 @@ if [ "$CFG_SCRIPTTOOLS" = "yes" -a "$CFG_SCRIPT" = "no" ]; then exit 1 fi if [ "$CFG_SCRIPTTOOLS" = "auto" -a "$CFG_SCRIPT" != "no" ]; then - CFG_SCRIPTTOOLS="yes" + case "$XPLATFORM" in + symbian*) + CFG_SCRIPTTOOLS="no" + ;; + *) + CFG_SCRIPTTOOLS="yes" + ;; + esac elif [ "$CFG_SCRIPT" = "no" ]; then CFG_SCRIPTTOOLS="no" fi -- cgit v0.12 From 207d9239dc6b67109b5e8cbdea7e5a589c167e85 Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Mon, 4 Oct 2010 10:55:11 +0300 Subject: Enable QtOpenGL vector path caching on Symbian/IVE3 IVE3 doesn't support UNSIGNED_INT index values in DrawElements. This patch checks if GL_OES_element_index_uint extensions is supported and determines DrawElement indices type based on that. On desktop environment UNSIGNED_INT is always supported. Task-number: QTBUG-13563 Reviewed-by: Gunnar --- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 42 +-- src/opengl/gl2paintengineex/qtriangulator.cpp | 354 ++++++++++++++------- src/opengl/gl2paintengineex/qtriangulator_p.h | 58 +++- src/opengl/qglextensions_p.h | 14 + 4 files changed, 334 insertions(+), 134 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index a81ed8e..a98d7cc 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -646,7 +646,7 @@ struct QGL2PEVectorPathCache GLuint ibo; #else float *vertices; - quint32 *indices; + void *indices; #endif int vertexCount; int indexCount; @@ -696,14 +696,6 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) const QPointF* const points = reinterpret_cast(path.points()); - // ### Remove before release... -#ifdef Q_OS_SYMBIAN - // ### There are some unresolved issues in Symbian vector path caching. - static bool do_vectorpath_cache = false; -#else - static bool do_vectorpath_cache = true; -#endif - // Check to see if there's any hints if (path.shape() == QVectorPath::RectangleHint) { QGLRect rect(points[0].x(), points[0].y(), points[2].x(), points[2].y()); @@ -774,8 +766,7 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) } else { // printf(" - Marking path as cachable...\n"); // Tag it for later so that if the same path is drawn twice, it is assumed to be static and thus cachable - if (do_vectorpath_cache) - path.makeCacheable(); + path.makeCacheable(); vertexCoordinateArray.clear(); vertexCoordinateArray.addPath(path, inverseScale, false); prepareForDraw(currentBrush.isOpaque()); @@ -828,13 +819,16 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) cache->indexCount = polys.indices.size(); cache->primitiveType = GL_TRIANGLES; cache->iscale = inverseScale; - #ifdef QT_OPENGL_CACHE_AS_VBOS glGenBuffers(1, &cache->vbo); glGenBuffers(1, &cache->ibo); glBindBuffer(GL_ARRAY_BUFFER, cache->vbo); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, cache->ibo); - glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(quint32) * polys.indices.size(), polys.indices.data(), GL_STATIC_DRAW); + + if (glSupportsElementIndexUint) + glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(quint32) * polys.indices.size(), polys.indices.data(), GL_STATIC_DRAW); + else + glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(quint16) * polys.indices.size(), polys.indices.data(), GL_STATIC_DRAW); QVarLengthArray vertices(polys.vertices.size()); for (int i = 0; i < polys.vertices.size(); ++i) @@ -842,8 +836,13 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) glBufferData(GL_ARRAY_BUFFER, sizeof(float) * vertices.size(), vertices.data(), GL_STATIC_DRAW); #else cache->vertices = (float *) qMalloc(sizeof(float) * polys.vertices.size()); - cache->indices = (quint32 *) qMalloc(sizeof(quint32) * polys.indices.size()); - memcpy(cache->indices, polys.indices.data(), sizeof(quint32) * polys.indices.size()); + if (glSupportsElementIndexUint) { + cache->indices = (quint32 *) qMalloc(sizeof(quint32) * polys.indices.size()); + memcpy(cache->indices, polys.indices.data(), sizeof(quint32) * polys.indices.size()); + } else { + cache->indices = (quint16 *) qMalloc(sizeof(quint16) * polys.indices.size()); + memcpy(cache->indices, polys.indices.data(), sizeof(quint16) * polys.indices.size()); + } for (int i = 0; i < polys.vertices.size(); ++i) cache->vertices[i] = float(inverseScale * polys.vertices.at(i)); #endif @@ -854,19 +853,24 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) glBindBuffer(GL_ARRAY_BUFFER, cache->vbo); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, cache->ibo); setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, 0); - glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_INT, 0); + if (glSupportsElementIndexUint) + glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_INT, 0); + else + glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_SHORT, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); glBindBuffer(GL_ARRAY_BUFFER, 0); #else setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, cache->vertices); - glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_INT, cache->indices); + if (glSupportsElementIndexUint) + glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_INT, (qint32 *)cache->indices); + else + glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_SHORT, (qint16 *)cache->indices); #endif } else { // printf(" - Marking path as cachable...\n"); // Tag it for later so that if the same path is drawn twice, it is assumed to be static and thus cachable - if (do_vectorpath_cache) - path.makeCacheable(); + path.makeCacheable(); // The path is too complicated & needs the stencil technique vertexCoordinateArray.clear(); diff --git a/src/opengl/gl2paintengineex/qtriangulator.cpp b/src/opengl/gl2paintengineex/qtriangulator.cpp index f14b0a4..ea072b4 100644 --- a/src/opengl/gl2paintengineex/qtriangulator.cpp +++ b/src/opengl/gl2paintengineex/qtriangulator.cpp @@ -57,6 +57,9 @@ #include +#include "qgl_p.h" +#include "qglextensions_p.h" + QT_BEGIN_NAMESPACE //#define Q_TRIANGULATOR_DEBUG @@ -185,6 +188,18 @@ sort_loop_end: sort(array + low + 1, count - low - 1); } +template +struct QVertexSet +{ + inline QVertexSet() { } + inline QVertexSet(const QVertexSet &other) : vertices(other.vertices), indices(other.indices) { } + QVertexSet &operator = (const QVertexSet &other) {vertices = other.vertices; indices = other.indices; return *this;} + + // The vertices of a triangle are given by: (x[i[n]], y[i[n]]), (x[j[n]], y[j[n]]), (x[k[n]], y[k[n]]), n = 0, 1, ... + QVector vertices; // [x[0], y[0], x[1], y[1], x[2], ...] + QVector indices; // [i[0], j[0], k[0], i[1], j[1], k[1], i[2], ...] +}; + //============================================================================// // QFraction // //============================================================================// @@ -1295,7 +1310,7 @@ inline void QRingBuffer::enqueue(const T &x) //============================================================================// // QTriangulator // //============================================================================// - +template class QTriangulator { public: @@ -1308,7 +1323,7 @@ public: class ComplexToSimple { public: - inline ComplexToSimple(QTriangulator *parent) : m_parent(parent), + inline ComplexToSimple(QTriangulator *parent) : m_parent(parent), m_edges(0), m_events(0), m_splits(0) { } void decompose(); private: @@ -1422,7 +1437,7 @@ public: class SimpleToMonotone { public: - inline SimpleToMonotone(QTriangulator *parent) : m_parent(parent), m_edges(0), m_upperVertex(0) { } + inline SimpleToMonotone(QTriangulator *parent) : m_parent(parent), m_edges(0), m_upperVertex(0) { } void decompose(); private: enum VertexType {MergeVertex, EndVertex, RegularVertex, StartVertex, SplitVertex}; @@ -1431,7 +1446,7 @@ public: { QRBTree::Node *node; int helper, twin, next, previous; - quint32 from, to; + T from, to; VertexType type; bool pointingUp; int upper() const {return (pointingUp ? to : from);} @@ -1478,20 +1493,20 @@ public: class MonotoneToTriangles { public: - inline MonotoneToTriangles(QTriangulator *parent) : m_parent(parent) { } + inline MonotoneToTriangles(QTriangulator *parent) : m_parent(parent) { } void decompose(); private: - inline quint32 indices(int index) const {return m_parent->m_indices.at(index + m_first);} + inline T indices(int index) const {return m_parent->m_indices.at(index + m_first);} inline int next(int index) const {return (index + 1) % m_length;} inline int previous(int index) const {return (index + m_length - 1) % m_length;} - inline bool less(int i, int j) const {return m_parent->m_vertices.at(indices(i)) < m_parent->m_vertices.at(indices(j));} + inline bool less(int i, int j) const {return m_parent->m_vertices.at((qint32)indices(i)) < m_parent->m_vertices.at(indices(j));} inline bool leftOfEdge(int i, int j, int k) const { - return qPointIsLeftOfLine(m_parent->m_vertices.at(indices(i)), - m_parent->m_vertices.at(indices(j)), m_parent->m_vertices.at(indices(k))); + return qPointIsLeftOfLine(m_parent->m_vertices.at((qint32)indices(i)), + m_parent->m_vertices.at((qint32)indices(j)), m_parent->m_vertices.at((qint32)indices(k))); } - QTriangulator *m_parent; + QTriangulator *m_parent; int m_first; int m_length; }; @@ -1505,11 +1520,11 @@ public: // Call this only once. void initialize(const QPainterPath &path, const QTransform &matrix, qreal lod); // Call either triangulate() or polyline() only once. - QTriangleSet triangulate(); - QPolylineSet polyline(); + QVertexSet triangulate(); + QVertexSet polyline(); private: QDataBuffer m_vertices; - QVector m_indices; + QVector m_indices; uint m_hint; }; @@ -1517,7 +1532,8 @@ private: // QTriangulator // //============================================================================// -QTriangleSet QTriangulator::triangulate() +template +QVertexSet QTriangulator::triangulate() { for (int i = 0; i < m_vertices.size(); ++i) { Q_ASSERT(qAbs(m_vertices.at(i).x) < (1 << 21)); @@ -1536,7 +1552,7 @@ QTriangleSet QTriangulator::triangulate() MonotoneToTriangles m2t(this); m2t.decompose(); - QTriangleSet result; + QVertexSet result; result.indices = m_indices; result.vertices.resize(2 * m_vertices.size()); for (int i = 0; i < m_vertices.size(); ++i) { @@ -1546,9 +1562,10 @@ QTriangleSet QTriangulator::triangulate() return result; } -QPolylineSet QTriangulator::polyline() +template +QVertexSet QTriangulator::polyline() { - QPolylineSet result; + QVertexSet result; result.indices = m_indices; result.vertices.resize(2 * m_vertices.size()); for (int i = 0; i < m_vertices.size(); ++i) { @@ -1558,7 +1575,8 @@ QPolylineSet QTriangulator::polyline() return result; } -void QTriangulator::initialize(const qreal *polygon, int count, uint hint, const QTransform &matrix) +template +void QTriangulator::initialize(const qreal *polygon, int count, uint hint, const QTransform &matrix) { m_hint = hint; m_vertices.resize(count); @@ -1570,10 +1588,11 @@ void QTriangulator::initialize(const qreal *polygon, int count, uint hint, const m_vertices.at(i).y = qRound(y * Q_FIXED_POINT_SCALE); m_indices[i] = i; } - m_indices[count] = Q_TRIANGULATE_END_OF_POLYGON; + m_indices[count] = T(-1); //Q_TRIANGULATE_END_OF_POLYGON } -void QTriangulator::initialize(const QVectorPath &path, const QTransform &matrix, qreal lod) +template +void QTriangulator::initialize(const QVectorPath &path, const QTransform &matrix, qreal lod) { m_hint = path.hints(); // Curved paths will be converted to complex polygons. @@ -1586,10 +1605,10 @@ void QTriangulator::initialize(const QVectorPath &path, const QTransform &matrix switch (*e) { case QPainterPath::MoveToElement: if (!m_indices.isEmpty()) - m_indices.push_back(Q_TRIANGULATE_END_OF_POLYGON); + m_indices.push_back(T(-1)); // Q_TRIANGULATE_END_OF_POLYGON // Fall through. case QPainterPath::LineToElement: - m_indices.push_back(quint32(m_vertices.size())); + m_indices.push_back(T(m_vertices.size())); m_vertices.resize(m_vertices.size() + 1); qreal x, y; matrix.map(p[0], p[1], &x, &y); @@ -1607,7 +1626,7 @@ void QTriangulator::initialize(const QVectorPath &path, const QTransform &matrix QPolygonF poly = bezier.toPolygon(); // Skip first point, it already exists in 'm_vertices'. for (int j = 1; j < poly.size(); ++j) { - m_indices.push_back(quint32(m_vertices.size())); + m_indices.push_back(T(m_vertices.size())); m_vertices.resize(m_vertices.size() + 1); m_vertices.last().x = qRound(poly.at(j).x() * Q_FIXED_POINT_SCALE / lod); m_vertices.last().y = qRound(poly.at(j).y() * Q_FIXED_POINT_SCALE / lod); @@ -1624,7 +1643,7 @@ void QTriangulator::initialize(const QVectorPath &path, const QTransform &matrix } } else { for (int i = 0; i < path.elementCount(); ++i, p += 2) { - m_indices.push_back(quint32(m_vertices.size())); + m_indices.push_back(T(m_vertices.size())); m_vertices.resize(m_vertices.size() + 1); qreal x, y; matrix.map(p[0], p[1], &x, &y); @@ -1632,10 +1651,11 @@ void QTriangulator::initialize(const QVectorPath &path, const QTransform &matrix m_vertices.last().y = qRound(y * Q_FIXED_POINT_SCALE); } } - m_indices.push_back(Q_TRIANGULATE_END_OF_POLYGON); + m_indices.push_back(T(-1)); // Q_TRIANGULATE_END_OF_POLYGON } -void QTriangulator::initialize(const QPainterPath &path, const QTransform &matrix, qreal lod) +template +void QTriangulator::initialize(const QPainterPath &path, const QTransform &matrix, qreal lod) { initialize(qtVectorPathForPath(path), matrix, lod); } @@ -1643,8 +1663,8 @@ void QTriangulator::initialize(const QPainterPath &path, const QTransform &matri //============================================================================// // QTriangulator::ComplexToSimple // //============================================================================// - -void QTriangulator::ComplexToSimple::decompose() +template +void QTriangulator::ComplexToSimple::decompose() { m_initialPointCount = m_parent->m_vertices.size(); initEdges(); @@ -1670,17 +1690,18 @@ void QTriangulator::ComplexToSimple::decompose() processed.setBit(i); i = m_edges.at(i).next; // CCW order } while (i != first); - m_parent->m_indices.push_back(Q_TRIANGULATE_END_OF_POLYGON); + m_parent->m_indices.push_back(T(-1)); // Q_TRIANGULATE_END_OF_POLYGON } } -void QTriangulator::ComplexToSimple::initEdges() +template +void QTriangulator::ComplexToSimple::initEdges() { // Initialize edge structure. // 'next' and 'previous' are not being initialized at this point. int first = 0; for (int i = 0; i < m_parent->m_indices.size(); ++i) { - if (m_parent->m_indices.at(i) == Q_TRIANGULATE_END_OF_POLYGON) { + if (m_parent->m_indices.at(i) == T(-1)) { // Q_TRIANGULATE_END_OF_POLYGON if (m_edges.size() != first) m_edges.last().to = m_edges.at(first).from; first = m_edges.size(); @@ -1700,15 +1721,16 @@ void QTriangulator::ComplexToSimple::initEdges() } // Return true if new intersection was found -bool QTriangulator::ComplexToSimple::calculateIntersection(int left, int right) +template +bool QTriangulator::ComplexToSimple::calculateIntersection(int left, int right) { const Edge &e1 = m_edges.at(left); const Edge &e2 = m_edges.at(right); - const QPodPoint &u1 = m_parent->m_vertices.at(e1.from); - const QPodPoint &u2 = m_parent->m_vertices.at(e1.to); - const QPodPoint &v1 = m_parent->m_vertices.at(e2.from); - const QPodPoint &v2 = m_parent->m_vertices.at(e2.to); + const QPodPoint &u1 = m_parent->m_vertices.at((qint32)e1.from); + const QPodPoint &u2 = m_parent->m_vertices.at((qint32)e1.to); + const QPodPoint &v1 = m_parent->m_vertices.at((qint32)e2.from); + const QPodPoint &v2 = m_parent->m_vertices.at((qint32)e2.to); if (qMax(u1.x, u2.x) <= qMin(v1.x, v2.x)) return false; @@ -1734,7 +1756,8 @@ bool QTriangulator::ComplexToSimple::calculateIntersection(int left, int right) return true; } -bool QTriangulator::ComplexToSimple::edgeIsLeftOfEdge(int leftEdgeIndex, int rightEdgeIndex) const +template +bool QTriangulator::ComplexToSimple::edgeIsLeftOfEdge(int leftEdgeIndex, int rightEdgeIndex) const { const Edge &leftEdge = m_edges.at(leftEdgeIndex); const Edge &rightEdge = m_edges.at(rightEdgeIndex); @@ -1752,7 +1775,8 @@ bool QTriangulator::ComplexToSimple::edgeIsLeftOfEdge(int leftEdgeIndex, int rig return d < 0; } -QRBTree::Node *QTriangulator::ComplexToSimple::searchEdgeLeftOf(int edgeIndex) const +template +QRBTree::Node *QTriangulator::ComplexToSimple::searchEdgeLeftOf(int edgeIndex) const { QRBTree::Node *current = m_edgeList.root; QRBTree::Node *result = 0; @@ -1767,7 +1791,8 @@ QRBTree::Node *QTriangulator::ComplexToSimple::searchEdgeLeftOf(int edgeInd return result; } -QRBTree::Node *QTriangulator::ComplexToSimple::searchEdgeLeftOf(int edgeIndex, QRBTree::Node *after) const +template +QRBTree::Node *QTriangulator::ComplexToSimple::searchEdgeLeftOf(int edgeIndex, QRBTree::Node *after) const { if (!m_edgeList.root) return after; @@ -1782,7 +1807,8 @@ QRBTree::Node *QTriangulator::ComplexToSimple::searchEdgeLeftOf(int edgeInd return result; } -QPair::Node *, QRBTree::Node *> QTriangulator::ComplexToSimple::bounds(const QPodPoint &point) const +template +QPair::Node *, QRBTree::Node *> QTriangulator::ComplexToSimple::bounds(const QPodPoint &point) const { QRBTree::Node *current = m_edgeList.root; QPair::Node *, QRBTree::Node *> result(0, 0); @@ -1830,7 +1856,8 @@ QPair::Node *, QRBTree::Node *> QTriangulator::ComplexToSimple return result; } -QPair::Node *, QRBTree::Node *> QTriangulator::ComplexToSimple::outerBounds(const QPodPoint &point) const +template +QPair::Node *, QRBTree::Node *> QTriangulator::ComplexToSimple::outerBounds(const QPodPoint &point) const { QRBTree::Node *current = m_edgeList.root; QPair::Node *, QRBTree::Node *> result(0, 0); @@ -1886,7 +1913,8 @@ QPair::Node *, QRBTree::Node *> QTriangulator::ComplexToSimple return result; } -void QTriangulator::ComplexToSimple::splitEdgeListRange(QRBTree::Node *leftmost, QRBTree::Node *rightmost, int vertex, const QIntersectionPoint &intersectionPoint) +template +void QTriangulator::ComplexToSimple::splitEdgeListRange(QRBTree::Node *leftmost, QRBTree::Node *rightmost, int vertex, const QIntersectionPoint &intersectionPoint) { Q_ASSERT(leftmost && rightmost); @@ -1904,8 +1932,8 @@ void QTriangulator::ComplexToSimple::splitEdgeListRange(QRBTree::Node *left } } - -void QTriangulator::ComplexToSimple::reorderEdgeListRange(QRBTree::Node *leftmost, QRBTree::Node *rightmost) +template +void QTriangulator::ComplexToSimple::reorderEdgeListRange(QRBTree::Node *leftmost, QRBTree::Node *rightmost) { Q_ASSERT(leftmost && rightmost); @@ -1932,7 +1960,8 @@ void QTriangulator::ComplexToSimple::reorderEdgeListRange(QRBTree::Node *le calculateIntersection(storeRightmost->data, rightmost->data); } -void QTriangulator::ComplexToSimple::sortEdgeList(const QPodPoint eventPoint) +template +void QTriangulator::ComplexToSimple::sortEdgeList(const QPodPoint eventPoint) { QIntersectionPoint eventPoint2 = qIntersectionPoint(eventPoint); while (!m_topIntersection.isEmpty() && m_topIntersection.top().intersectionPoint < eventPoint2) { @@ -1949,8 +1978,8 @@ void QTriangulator::ComplexToSimple::sortEdgeList(const QPodPoint eventPoint) if (!previous) break; const Edge &edge = m_edges.at(previous->data); - const QPodPoint &u = m_parent->m_vertices.at(edge.from); - const QPodPoint &v = m_parent->m_vertices.at(edge.to); + const QPodPoint &u = m_parent->m_vertices.at((qint32)edge.from); + const QPodPoint &v = m_parent->m_vertices.at((qint32)edge.to); if (!currentIntersectionPoint.isOnLine(u, v)) { Q_ASSERT(!currentIntersectionPoint.isAccurate() || qCross(currentIntersectionPoint.upperLeft - u, v - u) != 0); break; @@ -1963,8 +1992,8 @@ void QTriangulator::ComplexToSimple::sortEdgeList(const QPodPoint eventPoint) if (!next) break; const Edge &edge = m_edges.at(next->data); - const QPodPoint &u = m_parent->m_vertices.at(edge.from); - const QPodPoint &v = m_parent->m_vertices.at(edge.to); + const QPodPoint &u = m_parent->m_vertices.at((qint32)edge.from); + const QPodPoint &v = m_parent->m_vertices.at((qint32)edge.to); if (!currentIntersectionPoint.isOnLine(u, v)) { Q_ASSERT(!currentIntersectionPoint.isAccurate() || qCross(currentIntersectionPoint.upperLeft - u, v - u) != 0); break; @@ -1987,7 +2016,8 @@ void QTriangulator::ComplexToSimple::sortEdgeList(const QPodPoint eventPoint) } } -void QTriangulator::ComplexToSimple::fillPriorityQueue() +template +void QTriangulator::ComplexToSimple::fillPriorityQueue() { m_events.reset(); m_events.reserve(m_edges.size() * 2); @@ -1995,7 +2025,7 @@ void QTriangulator::ComplexToSimple::fillPriorityQueue() Q_ASSERT(m_edges.at(i).previous == -1 && m_edges.at(i).next == -1); Q_ASSERT(m_edges.at(i).node == 0); Q_ASSERT(m_edges.at(i).pointingUp == m_edges.at(i).originallyPointingUp); - Q_ASSERT(m_edges.at(i).pointingUp == (m_parent->m_vertices.at(m_edges.at(i).to) < m_parent->m_vertices.at(m_edges.at(i).from))); + Q_ASSERT(m_edges.at(i).pointingUp == (m_parent->m_vertices.at(qint32)(m_edges.at(i).to) < m_parent->m_vertices.at(m_edges.at(i).from))); // Ignore zero-length edges. if (m_parent->m_vertices.at(m_edges.at(i).to) != m_parent->m_vertices.at(m_edges.at(i).from)) { QPodPoint upper = m_parent->m_vertices.at(m_edges.at(i).upper()); @@ -2010,7 +2040,8 @@ void QTriangulator::ComplexToSimple::fillPriorityQueue() sort(m_events.data(), m_events.size()); } -void QTriangulator::ComplexToSimple::calculateIntersections() +template +void QTriangulator::ComplexToSimple::calculateIntersections() { fillPriorityQueue(); @@ -2075,7 +2106,8 @@ void QTriangulator::ComplexToSimple::calculateIntersections() // The upper piece is pushed to the end of the 'm_edges' vector. // The lower piece replaces the old edge. // Return the edge whose 'from' is 'pointIndex'. -int QTriangulator::ComplexToSimple::splitEdge(int splitIndex) +template +int QTriangulator::ComplexToSimple::splitEdge(int splitIndex) { const Split &split = m_splits.at(splitIndex); Edge &lowerEdge = m_edges.at(split.edge); @@ -2105,7 +2137,8 @@ int QTriangulator::ComplexToSimple::splitEdge(int splitIndex) } } -bool QTriangulator::ComplexToSimple::splitEdgesAtIntersections() +template +bool QTriangulator::ComplexToSimple::splitEdgesAtIntersections() { for (int i = 0; i < m_edges.size(); ++i) m_edges.at(i).mayIntersect = false; @@ -2122,7 +2155,8 @@ bool QTriangulator::ComplexToSimple::splitEdgesAtIntersections() return checkForNewIntersections; } -void QTriangulator::ComplexToSimple::insertEdgeIntoVectorIfWanted(ShortArray &orderedEdges, int i) +template +void QTriangulator::ComplexToSimple::insertEdgeIntoVectorIfWanted(ShortArray &orderedEdges, int i) { // Edges with zero length should not reach this part. Q_ASSERT(m_parent->m_vertices.at(m_edges.at(i).from) != m_parent->m_vertices.at(m_edges.at(i).to)); @@ -2152,7 +2186,8 @@ void QTriangulator::ComplexToSimple::insertEdgeIntoVectorIfWanted(ShortArray &or orderedEdges.append(i); } -void QTriangulator::ComplexToSimple::removeUnwantedEdgesAndConnect() +template +void QTriangulator::ComplexToSimple::removeUnwantedEdgesAndConnect() { Q_ASSERT(m_edgeList.root == 0); // Initialize priority queue. @@ -2179,7 +2214,7 @@ void QTriangulator::ComplexToSimple::removeUnwantedEdgesAndConnect() while (current != b.second) { Q_ASSERT(current); Q_ASSERT(m_edges.at(current->data).node == current); - Q_ASSERT(qIntersectionPoint(event.point).isOnLine(m_parent->m_vertices.at(m_edges.at(current->data).from), m_parent->m_vertices.at(m_edges.at(current->data).to))); + Q_ASSERT(qIntersectionPoint(event.point).isOnLine(m_parent->m_vertices.at(m_edges.at(current->data).from), m_parent->m_vertices.at(qint32)(m_edges.at(current->data).to))); Q_ASSERT(m_parent->m_vertices.at(m_edges.at(current->data).from) == event.point || m_parent->m_vertices.at(m_edges.at(current->data).to) == event.point); insertEdgeIntoVectorIfWanted(orderedEdges, current->data); current = m_edgeList.next(current); @@ -2290,7 +2325,8 @@ void QTriangulator::ComplexToSimple::removeUnwantedEdgesAndConnect() } // end while } -void QTriangulator::ComplexToSimple::removeUnusedPoints() { +template +void QTriangulator::ComplexToSimple::removeUnusedPoints() { QBitArray used(m_parent->m_vertices.size(), false); for (int i = 0; i < m_edges.size(); ++i) { Q_ASSERT((m_edges.at(i).previous == -1) == (m_edges.at(i).next == -1)); @@ -2314,7 +2350,8 @@ void QTriangulator::ComplexToSimple::removeUnusedPoints() { } } -bool QTriangulator::ComplexToSimple::CompareEdges::operator () (int i, int j) const +template +bool QTriangulator::ComplexToSimple::CompareEdges::operator () (int i, int j) const { int cmp = comparePoints(m_parent->m_parent->m_vertices.at(m_parent->m_edges.at(i).from), m_parent->m_parent->m_vertices.at(m_parent->m_edges.at(j).from)); @@ -2325,7 +2362,8 @@ bool QTriangulator::ComplexToSimple::CompareEdges::operator () (int i, int j) co return cmp > 0; } -inline bool QTriangulator::ComplexToSimple::Event::operator < (const Event &other) const +template +inline bool QTriangulator::ComplexToSimple::Event::operator < (const Event &other) const { if (point == other.point) return type < other.type; // 'Lower' has higher priority than 'Upper'. @@ -2337,8 +2375,8 @@ inline bool QTriangulator::ComplexToSimple::Event::operator < (const Event &othe //============================================================================// #ifdef Q_TRIANGULATOR_DEBUG - -QTriangulator::ComplexToSimple::DebugDialog::DebugDialog(ComplexToSimple *parent, int currentVertex) +template +QTriangulator::ComplexToSimple::DebugDialog::DebugDialog(ComplexToSimple *parent, int currentVertex) : m_parent(parent), m_vertex(currentVertex) { QDataBuffer &vertices = m_parent->m_parent->m_vertices; @@ -2360,7 +2398,8 @@ QTriangulator::ComplexToSimple::DebugDialog::DebugDialog(ComplexToSimple *parent m_window = QRectF(minX - border, minY - border, (maxX - minX + 2 * border), (maxY - minY + 2 * border)); } -void QTriangulator::ComplexToSimple::DebugDialog::paintEvent(QPaintEvent *) +template +void QTriangulator::ComplexToSimple::DebugDialog::paintEvent(QPaintEvent *) { QPainter p(this); p.setRenderHint(QPainter::Antialiasing, true); @@ -2426,7 +2465,8 @@ void QTriangulator::ComplexToSimple::DebugDialog::paintEvent(QPaintEvent *) } } -void QTriangulator::ComplexToSimple::DebugDialog::wheelEvent(QWheelEvent *event) +template +void QTriangulator::ComplexToSimple::DebugDialog::wheelEvent(QWheelEvent *event) { qreal scale = exp(-0.001 * event->delta()); QPointF center = m_window.center(); @@ -2436,7 +2476,8 @@ void QTriangulator::ComplexToSimple::DebugDialog::wheelEvent(QWheelEvent *event) update(); } -void QTriangulator::ComplexToSimple::DebugDialog::mouseMoveEvent(QMouseEvent *event) +template +void QTriangulator::ComplexToSimple::DebugDialog::mouseMoveEvent(QMouseEvent *event) { if (event->buttons() & Qt::LeftButton) { QPointF delta = event->pos() - m_lastMousePos; @@ -2449,7 +2490,8 @@ void QTriangulator::ComplexToSimple::DebugDialog::mouseMoveEvent(QMouseEvent *ev } } -void QTriangulator::ComplexToSimple::DebugDialog::mousePressEvent(QMouseEvent *event) +template +void QTriangulator::ComplexToSimple::DebugDialog::mousePressEvent(QMouseEvent *event) { if (event->button() == Qt::LeftButton) m_lastMousePos = event->pos(); @@ -2462,8 +2504,8 @@ void QTriangulator::ComplexToSimple::DebugDialog::mousePressEvent(QMouseEvent *e //============================================================================// // QTriangulator::SimpleToMonotone // //============================================================================// - -void QTriangulator::SimpleToMonotone::decompose() +template +void QTriangulator::SimpleToMonotone::decompose() { setupDataStructures(); removeZeroLengthEdges(); @@ -2482,12 +2524,13 @@ void QTriangulator::SimpleToMonotone::decompose() processed.setBit(i); i = m_edges.at(i).next; } while (i != first); - if (m_parent->m_indices.size() > 0 && m_parent->m_indices.back() != Q_TRIANGULATE_END_OF_POLYGON) - m_parent->m_indices.push_back(Q_TRIANGULATE_END_OF_POLYGON); + if (m_parent->m_indices.size() > 0 && m_parent->m_indices.back() != T(-1)) // Q_TRIANGULATE_END_OF_POLYGON + m_parent->m_indices.push_back(T(-1)); // Q_TRIANGULATE_END_OF_POLYGON } } -void QTriangulator::SimpleToMonotone::setupDataStructures() +template +void QTriangulator::SimpleToMonotone::setupDataStructures() { int i = 0; Edge e; @@ -2505,7 +2548,7 @@ void QTriangulator::SimpleToMonotone::setupDataStructures() m_edges.add(e); ++i; Q_ASSERT(i < m_parent->m_indices.size()); - } while (m_parent->m_indices.at(i) != Q_TRIANGULATE_END_OF_POLYGON); + } while (m_parent->m_indices.at(i) != T(-1)); // Q_TRIANGULATE_END_OF_POLYGON m_edges.last().next = start; m_edges.at(start).previous = m_edges.size() - 1; @@ -2519,7 +2562,8 @@ void QTriangulator::SimpleToMonotone::setupDataStructures() } } -void QTriangulator::SimpleToMonotone::removeZeroLengthEdges() +template +void QTriangulator::SimpleToMonotone::removeZeroLengthEdges() { for (int i = 0; i < m_edges.size(); ++i) { if (m_parent->m_vertices.at(m_edges.at(i).from) == m_parent->m_vertices.at(m_edges.at(i).to)) { @@ -2547,7 +2591,8 @@ void QTriangulator::SimpleToMonotone::removeZeroLengthEdges() } } -void QTriangulator::SimpleToMonotone::fillPriorityQueue() +template +void QTriangulator::SimpleToMonotone::fillPriorityQueue() { m_upperVertex.reset(); m_upperVertex.reserve(m_edges.size()); @@ -2561,7 +2606,8 @@ void QTriangulator::SimpleToMonotone::fillPriorityQueue() //} } -bool QTriangulator::SimpleToMonotone::edgeIsLeftOfEdge(int leftEdgeIndex, int rightEdgeIndex) const +template +bool QTriangulator::SimpleToMonotone::edgeIsLeftOfEdge(int leftEdgeIndex, int rightEdgeIndex) const { const Edge &leftEdge = m_edges.at(leftEdgeIndex); const Edge &rightEdge = m_edges.at(rightEdgeIndex); @@ -2575,7 +2621,8 @@ bool QTriangulator::SimpleToMonotone::edgeIsLeftOfEdge(int leftEdgeIndex, int ri } // Returns the rightmost edge not to the right of the given edge. -QRBTree::Node *QTriangulator::SimpleToMonotone::searchEdgeLeftOfEdge(int edgeIndex) const +template +QRBTree::Node *QTriangulator::SimpleToMonotone::searchEdgeLeftOfEdge(int edgeIndex) const { QRBTree::Node *current = m_edgeList.root; QRBTree::Node *result = 0; @@ -2591,7 +2638,8 @@ QRBTree::Node *QTriangulator::SimpleToMonotone::searchEdgeLeftOfEdge(int ed } // Returns the rightmost edge left of the given point. -QRBTree::Node *QTriangulator::SimpleToMonotone::searchEdgeLeftOfPoint(int pointIndex) const +template +QRBTree::Node *QTriangulator::SimpleToMonotone::searchEdgeLeftOfPoint(int pointIndex) const { QRBTree::Node *current = m_edgeList.root; QRBTree::Node *result = 0; @@ -2609,7 +2657,8 @@ QRBTree::Node *QTriangulator::SimpleToMonotone::searchEdgeLeftOfPoint(int p return result; } -void QTriangulator::SimpleToMonotone::classifyVertex(int i) +template +void QTriangulator::SimpleToMonotone::classifyVertex(int i) { Edge &e2 = m_edges.at(i); const Edge &e1 = m_edges.at(e2.previous); @@ -2638,13 +2687,15 @@ void QTriangulator::SimpleToMonotone::classifyVertex(int i) } } -void QTriangulator::SimpleToMonotone::classifyVertices() +template +void QTriangulator::SimpleToMonotone::classifyVertices() { for (int i = 0; i < m_edges.size(); ++i) classifyVertex(i); } -bool QTriangulator::SimpleToMonotone::pointIsInSector(const QPodPoint &p, const QPodPoint &v1, const QPodPoint &v2, const QPodPoint &v3) +template +bool QTriangulator::SimpleToMonotone::pointIsInSector(const QPodPoint &p, const QPodPoint &v1, const QPodPoint &v2, const QPodPoint &v3) { bool leftOfPreviousEdge = !qPointIsLeftOfLine(p, v2, v1); bool leftOfNextEdge = !qPointIsLeftOfLine(p, v3, v2); @@ -2655,7 +2706,8 @@ bool QTriangulator::SimpleToMonotone::pointIsInSector(const QPodPoint &p, const return leftOfPreviousEdge || leftOfNextEdge; } -bool QTriangulator::SimpleToMonotone::pointIsInSector(int vertex, int sector) +template +bool QTriangulator::SimpleToMonotone::pointIsInSector(int vertex, int sector) { const QPodPoint ¢er = m_parent->m_vertices.at(m_edges.at(sector).from); // Handle degenerate edges. @@ -2677,7 +2729,8 @@ bool QTriangulator::SimpleToMonotone::pointIsInSector(int vertex, int sector) return pointIsInSector(p, v1, center, v3); } -int QTriangulator::SimpleToMonotone::findSector(int edge, int vertex) +template +int QTriangulator::SimpleToMonotone::findSector(int edge, int vertex) { while (!pointIsInSector(vertex, edge)) { edge = m_edges.at(m_edges.at(edge).previous).twin; @@ -2686,7 +2739,8 @@ int QTriangulator::SimpleToMonotone::findSector(int edge, int vertex) return edge; } -void QTriangulator::SimpleToMonotone::createDiagonal(int lower, int upper) +template +void QTriangulator::SimpleToMonotone::createDiagonal(int lower, int upper) { lower = findSector(lower, upper); upper = findSector(upper, lower); @@ -2713,7 +2767,8 @@ void QTriangulator::SimpleToMonotone::createDiagonal(int lower, int upper) m_edges.add(e); } -void QTriangulator::SimpleToMonotone::monotoneDecomposition() +template +void QTriangulator::SimpleToMonotone::monotoneDecomposition() { if (m_edges.isEmpty()) return; @@ -2729,8 +2784,8 @@ void QTriangulator::SimpleToMonotone::monotoneDecomposition() Q_ASSERT(i < m_edges.size()); int j = m_edges.at(i).previous; Q_ASSERT(j < m_edges.size()); - m_clockwiseOrder = qPointIsLeftOfLine(m_parent->m_vertices.at(m_edges.at(i).from), - m_parent->m_vertices.at(m_edges.at(j).from), m_parent->m_vertices.at(m_edges.at(i).to)); + m_clockwiseOrder = qPointIsLeftOfLine(m_parent->m_vertices.at((quint32)m_edges.at(i).from), + m_parent->m_vertices.at((quint32)m_edges.at(j).from), m_parent->m_vertices.at((quint32)m_edges.at(i).to)); classifyVertices(); fillPriorityQueue(); @@ -2848,7 +2903,8 @@ void QTriangulator::SimpleToMonotone::monotoneDecomposition() createDiagonal(diagonals.at(i).first, diagonals.at(i).second); } -bool QTriangulator::SimpleToMonotone::CompareVertices::operator () (int i, int j) const +template +bool QTriangulator::SimpleToMonotone::CompareVertices::operator () (int i, int j) const { if (m_parent->m_edges.at(i).from == m_parent->m_edges.at(j).from) return m_parent->m_edges.at(i).type > m_parent->m_edges.at(j).type; @@ -2859,16 +2915,16 @@ bool QTriangulator::SimpleToMonotone::CompareVertices::operator () (int i, int j //============================================================================// // QTriangulator::MonotoneToTriangles // //============================================================================// - -void QTriangulator::MonotoneToTriangles::decompose() +template +void QTriangulator::MonotoneToTriangles::decompose() { - QVector result; + QVector result; QDataBuffer stack(m_parent->m_indices.size()); m_first = 0; // Require at least three more indices. while (m_first + 3 <= m_parent->m_indices.size()) { m_length = 0; - while (m_parent->m_indices.at(m_first + m_length) != Q_TRIANGULATE_END_OF_POLYGON) { + while (m_parent->m_indices.at(m_first + m_length) != T(-1)) { // Q_TRIANGULATE_END_OF_POLYGON ++m_length; Q_ASSERT(m_first + m_length < m_parent->m_indices.size()); } @@ -2955,39 +3011,115 @@ void QTriangulator::MonotoneToTriangles::decompose() // qTriangulate // //============================================================================// -QTriangleSet qTriangulate(const qreal *polygon, int count, uint hint, const QTransform &matrix) +QTriangleSet qTriangulate(const qreal *polygon, + int count, uint hint, const QTransform &matrix) { - QTriangulator triangulator; - triangulator.initialize(polygon, count, hint, matrix); - return triangulator.triangulate(); + QGLContext *ctx = 0; // Not really used but needs to be introduced for glSupportsElementIndexUint + + QTriangleSet triangleSet; + if (glSupportsElementIndexUint) { + QTriangulator triangulator; + triangulator.initialize(polygon, count, hint, matrix); + QVertexSet vertexSet = triangulator.triangulate(); + triangleSet.vertices = vertexSet.vertices; + triangleSet.indices.setDataUint(vertexSet.indices); + + } else { + QTriangulator triangulator; + triangulator.initialize(polygon, count, hint, matrix); + QVertexSet vertexSet = triangulator.triangulate(); + triangleSet.vertices = vertexSet.vertices; + triangleSet.indices.setDataUshort(vertexSet.indices); + } + return triangleSet; } -QTriangleSet qTriangulate(const QVectorPath &path, const QTransform &matrix, qreal lod) +QTriangleSet qTriangulate(const QVectorPath &path, + const QTransform &matrix, qreal lod) { - QTriangulator triangulator; - triangulator.initialize(path, matrix, lod); - return triangulator.triangulate(); + QGLContext *ctx = 0; // Not really used but needs to be introduced for glSupportsElementIndexUint + + QTriangleSet triangleSet; + if (glSupportsElementIndexUint) { + QTriangulator triangulator; + triangulator.initialize(path, matrix, lod); + QVertexSet vertexSet = triangulator.triangulate(); + triangleSet.vertices = vertexSet.vertices; + triangleSet.indices.setDataUint(vertexSet.indices); + } else { + QTriangulator triangulator; + triangulator.initialize(path, matrix, lod); + QVertexSet vertexSet = triangulator.triangulate(); + triangleSet.vertices = vertexSet.vertices; + triangleSet.indices.setDataUshort(vertexSet.indices); + } + return triangleSet; } -QTriangleSet qTriangulate(const QPainterPath &path, const QTransform &matrix, qreal lod) +QTriangleSet qTriangulate(const QPainterPath &path, + const QTransform &matrix, qreal lod) { - QTriangulator triangulator; - triangulator.initialize(path, matrix, lod); - return triangulator.triangulate(); + QGLContext *ctx = 0; // Not really used but needs to be introduced for glSupportsElementIndexUint + + QTriangleSet triangleSet; + if (glSupportsElementIndexUint) { + QTriangulator triangulator; + triangulator.initialize(path, matrix, lod); + QVertexSet vertexSet = triangulator.triangulate(); + triangleSet.vertices = vertexSet.vertices; + triangleSet.indices.setDataUint(vertexSet.indices); + } else { + QTriangulator triangulator; + triangulator.initialize(path, matrix, lod); + QVertexSet vertexSet = triangulator.triangulate(); + triangleSet.vertices = vertexSet.vertices; + triangleSet.indices.setDataUshort(vertexSet.indices); + } + return triangleSet; } -QPolylineSet qPolyline(const QVectorPath &path, const QTransform &matrix, qreal lod) +QPolylineSet qPolyline(const QVectorPath &path, + const QTransform &matrix, qreal lod) { - QTriangulator triangulator; - triangulator.initialize(path, matrix, lod); - return triangulator.polyline(); + QGLContext *ctx = 0; // Not really used but needs to be introduced for glSupportsElementIndexUint + + QPolylineSet polyLineSet; + if (glSupportsElementIndexUint) { + QTriangulator triangulator; + triangulator.initialize(path, matrix, lod); + QVertexSet vertexSet = triangulator.polyline(); + polyLineSet.vertices = vertexSet.vertices; + polyLineSet.indices.setDataUint(vertexSet.indices); + } else { + QTriangulator triangulator; + triangulator.initialize(path, matrix, lod); + QVertexSet vertexSet = triangulator.triangulate(); + polyLineSet.vertices = vertexSet.vertices; + polyLineSet.indices.setDataUshort(vertexSet.indices); + } + return polyLineSet; } -QPolylineSet qPolyline(const QPainterPath &path, const QTransform &matrix, qreal lod) +QPolylineSet qPolyline(const QPainterPath &path, + const QTransform &matrix, qreal lod) { - QTriangulator triangulator; - triangulator.initialize(path, matrix, lod); - return triangulator.polyline(); + QGLContext *ctx = 0; // Not really used but needs to be introduced for glSupportsElementIndexUint + + QPolylineSet polyLineSet; + if (glSupportsElementIndexUint) { + QTriangulator triangulator; + triangulator.initialize(path, matrix, lod); + QVertexSet vertexSet = triangulator.polyline(); + polyLineSet.vertices = vertexSet.vertices; + polyLineSet.indices.setDataUint(vertexSet.indices); + } else { + QTriangulator triangulator; + triangulator.initialize(path, matrix, lod); + QVertexSet vertexSet = triangulator.triangulate(); + polyLineSet.vertices = vertexSet.vertices; + polyLineSet.indices.setDataUshort(vertexSet.indices); + } + return polyLineSet; } QT_END_NAMESPACE diff --git a/src/opengl/gl2paintengineex/qtriangulator_p.h b/src/opengl/gl2paintengineex/qtriangulator_p.h index e5eec39..8f96e9f 100644 --- a/src/opengl/gl2paintengineex/qtriangulator_p.h +++ b/src/opengl/gl2paintengineex/qtriangulator_p.h @@ -58,7 +58,58 @@ QT_BEGIN_NAMESPACE -#define Q_TRIANGULATE_END_OF_POLYGON quint32(-1) +class QVertexIndexVector +{ +public: + enum Type { + UnsignedInt, + UnsignedShort + }; + + inline Type type() const { return t; } + + inline void setDataUint(const QVector &data) + { + t = UnsignedInt; + indices32 = data; + } + + inline void setDataUshort(const QVector &data) + { + t = UnsignedShort; + indices16 = data; + } + + inline const void* data() const + { + if (t == UnsignedInt) + return indices32.data(); + return indices16.data(); + } + + inline int size() const + { + if (t == UnsignedInt) + return indices32.size(); + return indices16.size(); + } + + inline QVertexIndexVector &operator = (const QVertexIndexVector &other) + { + if (t == UnsignedInt) + indices32 = other.indices32; + else + indices16 = other.indices16; + + return *this; + } + +private: + + Type t; + QVector indices32; + QVector indices16; +}; struct QTriangleSet { @@ -68,7 +119,7 @@ struct QTriangleSet // The vertices of a triangle are given by: (x[i[n]], y[i[n]]), (x[j[n]], y[j[n]]), (x[k[n]], y[k[n]]), n = 0, 1, ... QVector vertices; // [x[0], y[0], x[1], y[1], x[2], ...] - QVector indices; // [i[0], j[0], k[0], i[1], j[1], k[1], i[2], ...] + QVertexIndexVector indices; // [i[0], j[0], k[0], i[1], j[1], k[1], i[2], ...] }; struct QPolylineSet @@ -78,8 +129,7 @@ struct QPolylineSet QPolylineSet &operator = (const QPolylineSet &other) {vertices = other.vertices; indices = other.indices; return *this;} QVector vertices; // [x[0], y[0], x[1], y[1], x[2], ...] - QVector indices; - + QVertexIndexVector indices; }; // The vertex coordinates of the returned triangle set will be rounded to a grid with a mesh size diff --git a/src/opengl/qglextensions_p.h b/src/opengl/qglextensions_p.h index 6259cca..e81e849 100644 --- a/src/opengl/qglextensions_p.h +++ b/src/opengl/qglextensions_p.h @@ -346,6 +346,17 @@ struct QGLExtensionFuncs qt_glEGLImageTargetTexture2DOES = 0; qt_glEGLImageTargetRenderbufferStorageOES = 0; #endif + + // OES_element_index_uint +#if !defined(QT_OPENGL_ES) + qt_glSupportsElementIndexUint = true; +#else + QString extensions = reinterpret_cast(glGetString(GL_EXTENSIONS)); + if (extensions.contains("GL_OES_element_index_uint")) + qt_glSupportsElementIndexUint = true; + else + qt_glSupportsElementIndexUint = false; +#endif } @@ -473,6 +484,7 @@ struct QGLExtensionFuncs _glEGLImageTargetRenderbufferStorageOES qt_glEGLImageTargetRenderbufferStorageOES; #endif + bool qt_glSupportsElementIndexUint; }; @@ -871,6 +883,8 @@ struct QGLExtensionFuncs #define glEGLImageTargetRenderbufferStorageOES QGLContextPrivate::extensionFuncs(ctx).qt_glEGLImageTargetRenderbufferStorageOES #endif +#define glSupportsElementIndexUint QGLContextPrivate::extensionFuncs(ctx).qt_glSupportsElementIndexUint + extern bool qt_resolve_framebufferobject_extensions(QGLContext *ctx); bool qt_resolve_buffer_extensions(QGLContext *ctx); -- cgit v0.12 From 77a92b39b30bf14f6509dfb578bad8511ef9a32e Mon Sep 17 00:00:00 2001 From: axis Date: Mon, 4 Oct 2010 09:34:07 +0200 Subject: Made javascriptcore depend on corelib. It lists "QT = core" in its profile, and may fail parallel builds if the dependency is not in place. RevBy: Benjamin Poulain --- src/src.pro | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/src.pro b/src/src.pro index 9a8b70fc..060f48b 100644 --- a/src/src.pro +++ b/src/src.pro @@ -119,7 +119,10 @@ src_webkit_declarative.target = sub-webkitdeclarative src_webkit.depends = src_gui src_sql src_network contains(QT_CONFIG, xmlpatterns): src_webkit.depends += src_xmlpatterns src_imports.depends += src_webkit - exists($$QT_SOURCE_TREE/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro): src_webkit.depends += src_javascriptcore + exists($$QT_SOURCE_TREE/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro) { + src_webkit.depends += src_javascriptcore + src_javascriptcore.depends = src_corelib + } } contains(QT_CONFIG, qt3support): src_plugins.depends += src_qt3support contains(QT_CONFIG, dbus):{ -- cgit v0.12 From 4207bded6577f24fb4c20cc84880fd48eb9c0c9b Mon Sep 17 00:00:00 2001 From: axis Date: Mon, 4 Oct 2010 10:46:14 +0200 Subject: Fixed library ordering when linking to qtmain. Done-with: Liang Qi Reviewed-by: Trust me --- mkspecs/features/symbian/symbian_building.prf | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mkspecs/features/symbian/symbian_building.prf b/mkspecs/features/symbian/symbian_building.prf index 539609d..614fb65 100644 --- a/mkspecs/features/symbian/symbian_building.prf +++ b/mkspecs/features/symbian/symbian_building.prf @@ -187,9 +187,11 @@ contains(TEMPLATE, app):!contains(QMAKE_LINK, "^@:.*") { linux-armcc: { QMAKE_LIBS += usrt2_2.lib dfpaeabi.dso dfprvct2_2.dso drtaeabi.dso scppnwdl.dso drtrvct2_2.dso h_t__uf.l\\(switch8.o\\) QMAKE_LIBS += -leexe.lib\\(uc_exe_.o\\) - contains(CONFIG, "qt"):contains(QT, "core") { #if linking with QtCore + contains(CONFIG, "qt"):contains(QT, "gui") { #if linking with QtCore + QMAKE_LIBS -= -lqtmain$${QT_LIBINFIX}.lib QMAKE_LIBS += -lqtmain$${QT_LIBINFIX}.lib } else { + QMAKE_LIBS -= -llibcrt0.lib QMAKE_LIBS += -llibcrt0.lib } } else :linux-gcce { @@ -197,9 +199,12 @@ contains(TEMPLATE, app):!contains(QMAKE_LINK, "^@:.*") { QMAKE_LIBS += \ -l:eexe.lib \ -l:usrt2_2.lib - contains(CONFIG, "qt"):contains(QT, "core") { #if linking with QtCore + contains(CONFIG, "qt"):contains(QT, "gui") { #if linking with QtCore + QMAKE_LIBS -= -l:qtmain$${QT_LIBINFIX}.lib QMAKE_LIBS += -l:qtmain$${QT_LIBINFIX}.lib } else { + QMAKE_LIBS -= -l:libcrt0.lib + QMAKE_LIBS -= -l:libcrt0_gcce.lib QMAKE_LIBS += -l:libcrt0_gcce.lib } QMAKE_LIBS += \ -- cgit v0.12 From d0d545a751c6b0b37f166c2c77fd3eba4d9b9ddc Mon Sep 17 00:00:00 2001 From: mread Date: Mon, 4 Oct 2010 16:39:25 +0100 Subject: fix for USER: 163 panic found on 5800XM The NO_NAMED_LOCAL_CHUNKS macro should have been set for S605.0 builds. Also for S60 3.2 and Symbian^2. All are added. Reviewed-by: Shane Kearns --- src/corelib/arch/symbian/qt_hybridheap_symbian_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/arch/symbian/qt_hybridheap_symbian_p.h b/src/corelib/arch/symbian/qt_hybridheap_symbian_p.h index 92cfe0e..36c7b6d 100644 --- a/src/corelib/arch/symbian/qt_hybridheap_symbian_p.h +++ b/src/corelib/arch/symbian/qt_hybridheap_symbian_p.h @@ -90,7 +90,7 @@ // disabling code ported from Symbian^4 that we don't want/can't have in earlier platforms #define QT_SYMBIAN4_ALLOCATOR_UNWANTED_CODE -#if defined(SYMBIAN_VERSION_9_2) || defined(SYMBIAN_VERSION_9_1) +#if defined(SYMBIAN_VERSION_9_1) || defined(SYMBIAN_VERSION_9_2) || defined(SYMBIAN_VERSION_9_3) || defined(SYMBIAN_VERSION_9_4) || defined(SYMBIAN_VERSION_SYMBIAN2) #define NO_NAMED_LOCAL_CHUNKS #endif -- cgit v0.12 From 25ddfb434f13aa3bbc6ac303aa17dbe9582bf3f0 Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Mon, 4 Oct 2010 15:42:51 +0300 Subject: Revert "When using complex transformations rendering goes easily off by one pixel." This reverts commit 2acdc634ee895af4a9738c0f6c2496e388afba38. Originally this fixed QT-3791 but it caused lots of problems in other sites. So reverting this will fix QT-4001 but reopens QT-3791. QT-4001 blocks Qt 4.7.1 but QT-3791 doesn't. Task-number: QT-4001 Reviewed-by: Jason Barron --- src/openvg/qpaintengine_vg.cpp | 158 +++++++++++++++++------------------------ 1 file changed, 66 insertions(+), 92 deletions(-) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 74395a2..f6d2435 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -196,9 +196,7 @@ public: #endif QTransform transform; // Currently active transform. - bool affineTransform; // True if the transform is non-projective. - bool simpleTransform; // True if the transform is simple translate - // or 0, 90, 180, and 270 degree rotation + bool simpleTransform; // True if the transform is simple (non-projective). qreal penScale; // Pen scaling factor from "transform". QTransform pathTransform; // Calculated VG path transformation. @@ -379,7 +377,6 @@ void QVGPaintEnginePrivate::init() roundRectPath = 0; #endif - affineTransform = true; simpleTransform = true; pathTransformSet = false; penScale = 1.0; @@ -532,59 +529,12 @@ void QVGPaintEnginePrivate::setTransform vgLoadMatrix(mat); } -// Determine if a co-ordinate transform is simple enough to allow -// rectangle-based clipping with vgMask() and rounding translation -// to integers. Simple transforms most often result from origin translations. -static inline bool transformIsSimple(const QTransform& transform) -{ - QTransform::TransformationType type = transform.type(); - if (type == QTransform::TxNone || type == QTransform::TxTranslate) { - return true; - } else if (type == QTransform::TxScale) { - // Check for 0 and 180 degree rotations. - // (0 might happen after 4 rotations of 90 degrees). - qreal m11 = transform.m11(); - qreal m12 = transform.m12(); - qreal m21 = transform.m21(); - qreal m22 = transform.m22(); - if (m12 == 0.0f && m21 == 0.0f) { - if (m11 == 1.0f && m22 == 1.0f) - return true; // 0 degrees - else if (m11 == -1.0f && m22 == -1.0f) - return true; // 180 degrees. - if(m11 == 1.0f && m22 == -1.0f) - return true; // 0 degrees inverted y. - else if(m11 == -1.0f && m22 == 1.0f) - return true; // 180 degrees inverted y. - } - } else if (type == QTransform::TxRotate) { - // Check for 90, and 270 degree rotations. - qreal m11 = transform.m11(); - qreal m12 = transform.m12(); - qreal m21 = transform.m21(); - qreal m22 = transform.m22(); - if (m11 == 0.0f && m22 == 0.0f) { - if (m12 == 1.0f && m21 == -1.0f) - return true; // 90 degrees. - else if (m12 == -1.0f && m21 == 1.0f) - return true; // 270 degrees. - else if (m12 == -1.0f && m21 == -1.0f) - return true; // 90 degrees inverted y. - else if (m12 == 1.0f && m21 == 1.0f) - return true; // 270 degrees inverted y. - } - } - return false; -} - Q_DECL_IMPORT extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); void QVGPaintEnginePrivate::updateTransform(QPaintDevice *pdev) { VGfloat devh = pdev->height(); - simpleTransform = transformIsSimple(transform); - // Construct the VG transform by combining the Qt transform with // the following viewport transformation: // | 1 0 0 | @@ -607,9 +557,9 @@ void QVGPaintEnginePrivate::updateTransform(QPaintDevice *pdev) // so we will have to convert the co-ordinates ourselves. // Change the matrix to just the viewport transformation. pathTransform = viewport; - affineTransform = false; + simpleTransform = false; } else { - affineTransform = true; + simpleTransform = true; } pathTransformSet = false; @@ -638,7 +588,7 @@ VGPath QVGPaintEnginePrivate::vectorPathToVGPath(const QVectorPath& path) // Size is sufficient segments for drawRoundedRect() paths. QVarLengthArray segments; - if (sizeof(qreal) == sizeof(VGfloat) && elements && affineTransform) { + if (sizeof(qreal) == sizeof(VGfloat) && elements && simpleTransform) { // If Qt was compiled with qreal the same size as VGfloat, // then convert the segment types and use the incoming // points array directly. @@ -673,7 +623,7 @@ VGPath QVGPaintEnginePrivate::vectorPathToVGPath(const QVectorPath& path) int curvePos = 0; QPointF temp; - if (elements && affineTransform) { + if (elements && simpleTransform) { // Convert the members of the element array. for (int i = 0; i < count; ++i) { switch (elements[i]) { @@ -717,7 +667,7 @@ VGPath QVGPaintEnginePrivate::vectorPathToVGPath(const QVectorPath& path) } points += 2; } - } else if (elements && !affineTransform) { + } else if (elements && !simpleTransform) { // Convert the members of the element array after applying the // current transform to the path locally. for (int i = 0; i < count; ++i) { @@ -766,7 +716,7 @@ VGPath QVGPaintEnginePrivate::vectorPathToVGPath(const QVectorPath& path) } points += 2; } - } else if (count > 0 && affineTransform) { + } else if (count > 0 && simpleTransform) { // If there is no element array, then the path is assumed // to be a MoveTo followed by several LineTo's. coords.append(points[0]); @@ -779,7 +729,7 @@ VGPath QVGPaintEnginePrivate::vectorPathToVGPath(const QVectorPath& path) segments.append(VG_LINE_TO_ABS); --count; } - } else if (count > 0 && !affineTransform) { + } else if (count > 0 && !simpleTransform) { // Convert a simple path, and apply the transform locally. temp = transform.map(QPointF(points[0], points[1])); coords.append(temp.x()); @@ -840,7 +790,7 @@ VGPath QVGPaintEnginePrivate::painterPathToVGPath(const QPainterPath& path) bool haveStart = false; bool haveEnd = false; - if (affineTransform) { + if (simpleTransform) { // Convert the members of the element array. for (int i = 0; i < count; ++i) { switch (elements[i].type) { @@ -1615,6 +1565,36 @@ void QVGPaintEngine::stroke(const QVectorPath &path, const QPen &pen) vgDestroyPath(vgpath); } +// Determine if a co-ordinate transform is simple enough to allow +// rectangle-based clipping with vgMask(). Simple transforms most +// often result from origin translations. +static inline bool clipTransformIsSimple(const QTransform& transform) +{ + QTransform::TransformationType type = transform.type(); + if (type == QTransform::TxNone || type == QTransform::TxTranslate) + return true; + if (type == QTransform::TxRotate) { + // Check for 0, 90, 180, and 270 degree rotations. + // (0 might happen after 4 rotations of 90 degrees). + qreal m11 = transform.m11(); + qreal m12 = transform.m12(); + qreal m21 = transform.m21(); + qreal m22 = transform.m22(); + if (m11 == 0.0f && m22 == 0.0f) { + if (m12 == 1.0f && m21 == -1.0f) + return true; // 90 degrees. + else if (m12 == -1.0f && m21 == 1.0f) + return true; // 270 degrees. + } else if (m12 == 0.0f && m21 == 0.0f) { + if (m11 == -1.0f && m22 == -1.0f) + return true; // 180 degrees. + else if (m11 == 1.0f && m22 == 1.0f) + return true; // 0 degrees. + } + } + return false; +} + #if defined(QVG_SCISSOR_CLIP) void QVGPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) @@ -1632,7 +1612,7 @@ void QVGPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) // We aren't using masking, so handle simple QRectF's only. if (path.shape() == QVectorPath::RectangleHint && - path.elementCount() == 4 && d->simpleTransform) { + path.elementCount() == 4 && clipTransformIsSimple(d->transform)) { // Clipping region that resulted from QPainter::setClipRect(QRectF). // Convert it into a QRect and apply. const qreal *points = path.points(); @@ -1782,7 +1762,7 @@ void QVGPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) // We don't have vgRenderToMask(), so handle simple QRectF's only. if (path.shape() == QVectorPath::RectangleHint && - path.elementCount() == 4 && d->simpleTransform) { + path.elementCount() == 4 && clipTransformIsSimple(d->transform)) { // Clipping region that resulted from QPainter::setClipRect(QRectF). // Convert it into a QRect and apply. const qreal *points = path.points(); @@ -1834,7 +1814,7 @@ void QVGPaintEngine::clip(const QRect &rect, Qt::ClipOperation op) d->dirty |= QPaintEngine::DirtyClipRegion; // If we have a non-simple transform, then use path-based clipping. - if (op != Qt::NoClip && !d->simpleTransform) { + if (op != Qt::NoClip && !clipTransformIsSimple(d->transform)) { QPaintEngineEx::clip(rect, op); return; } @@ -1953,7 +1933,7 @@ void QVGPaintEngine::clip(const QRegion ®ion, Qt::ClipOperation op) d->dirty |= QPaintEngine::DirtyClipRegion; // If we have a non-simple transform, then use path-based clipping. - if (op != Qt::NoClip && !d->simpleTransform) { + if (op != Qt::NoClip && !clipTransformIsSimple(d->transform)) { QPaintEngineEx::clip(region, op); return; } @@ -2530,14 +2510,14 @@ void QVGPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) // Check to see if we can use vgClear() for faster filling. if (brush.style() == Qt::SolidPattern && brush.isOpaque() && - d->simpleTransform && d->opacity == 1.0f && + clipTransformIsSimple(d->transform) && d->opacity == 1.0f && clearRect(rect, brush.color())) { return; } #if !defined(QVG_NO_MODIFY_PATH) VGfloat coords[8]; - if (d->affineTransform) { + if (d->simpleTransform) { coords[0] = rect.x(); coords[1] = rect.y(); coords[2] = rect.x() + rect.width(); @@ -2572,14 +2552,14 @@ void QVGPaintEngine::fillRect(const QRectF &rect, const QColor &color) Q_D(QVGPaintEngine); // Check to see if we can use vgClear() for faster filling. - if (d->simpleTransform && d->opacity == 1.0f && color.alpha() == 255 && + if (clipTransformIsSimple(d->transform) && d->opacity == 1.0f && color.alpha() == 255 && clearRect(rect, color)) { return; } #if !defined(QVG_NO_MODIFY_PATH) VGfloat coords[8]; - if (d->affineTransform) { + if (d->simpleTransform) { coords[0] = rect.x(); coords[1] = rect.y(); coords[2] = rect.x() + rect.width(); @@ -2612,7 +2592,7 @@ void QVGPaintEngine::fillRect(const QRectF &rect, const QColor &color) void QVGPaintEngine::drawRoundedRect(const QRectF &rect, qreal xrad, qreal yrad, Qt::SizeMode mode) { Q_D(QVGPaintEngine); - if (d->affineTransform) { + if (d->simpleTransform) { QVGPainterState *s = state(); VGPath vgpath = d->roundedRectPath(rect, xrad, yrad, mode); d->draw(vgpath, s->pen, s->brush); @@ -2631,7 +2611,7 @@ void QVGPaintEngine::drawRects(const QRect *rects, int rectCount) QVGPainterState *s = state(); for (int i = 0; i < rectCount; ++i, ++rects) { VGfloat coords[8]; - if (d->affineTransform) { + if (d->simpleTransform) { coords[0] = rects->x(); coords[1] = rects->y(); coords[2] = rects->x() + rects->width(); @@ -2672,7 +2652,7 @@ void QVGPaintEngine::drawRects(const QRectF *rects, int rectCount) QVGPainterState *s = state(); for (int i = 0; i < rectCount; ++i, ++rects) { VGfloat coords[8]; - if (d->affineTransform) { + if (d->simpleTransform) { coords[0] = rects->x(); coords[1] = rects->y(); coords[2] = rects->x() + rects->width(); @@ -2710,7 +2690,7 @@ void QVGPaintEngine::drawLines(const QLine *lines, int lineCount) QVGPainterState *s = state(); for (int i = 0; i < lineCount; ++i, ++lines) { VGfloat coords[4]; - if (d->affineTransform) { + if (d->simpleTransform) { coords[0] = lines->x1(); coords[1] = lines->y1(); coords[2] = lines->x2(); @@ -2738,7 +2718,7 @@ void QVGPaintEngine::drawLines(const QLineF *lines, int lineCount) QVGPainterState *s = state(); for (int i = 0; i < lineCount; ++i, ++lines) { VGfloat coords[4]; - if (d->affineTransform) { + if (d->simpleTransform) { coords[0] = lines->x1(); coords[1] = lines->y1(); coords[2] = lines->x2(); @@ -2764,7 +2744,7 @@ void QVGPaintEngine::drawEllipse(const QRectF &r) // Based on the description of vguEllipse() in the OpenVG specification. // We don't use vguEllipse(), to avoid unnecessary library dependencies. Q_D(QVGPaintEngine); - if (d->affineTransform) { + if (d->simpleTransform) { QVGPainterState *s = state(); VGPath path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, @@ -2837,7 +2817,7 @@ void QVGPaintEngine::drawPoints(const QPointF *points, int pointCount) for (int i = 0; i < pointCount; ++i, ++points) { VGfloat coords[4]; - if (d->affineTransform) { + if (d->simpleTransform) { coords[0] = points->x(); coords[1] = points->y(); coords[2] = coords[0]; @@ -2871,7 +2851,7 @@ void QVGPaintEngine::drawPoints(const QPoint *points, int pointCount) for (int i = 0; i < pointCount; ++i, ++points) { VGfloat coords[4]; - if (d->affineTransform) { + if (d->simpleTransform) { coords[0] = points->x(); coords[1] = points->y(); coords[2] = coords[0]; @@ -2905,7 +2885,7 @@ void QVGPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonD QVarLengthArray coords; QVarLengthArray segments; for (int i = 0; i < pointCount; ++i, ++points) { - if (d->affineTransform) { + if (d->simpleTransform) { coords.append(points->x()); coords.append(points->y()); } else { @@ -2952,7 +2932,7 @@ void QVGPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDr QVarLengthArray coords; QVarLengthArray segments; for (int i = 0; i < pointCount; ++i, ++points) { - if (d->affineTransform) { + if (d->simpleTransform) { coords.append(points->x()); coords.append(points->y()); } else { @@ -2987,7 +2967,7 @@ void QVGPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDr void QVGPaintEnginePrivate::setImageOptions() { - if (opacity != 1.0f && affineTransform) { + if (opacity != 1.0f && simpleTransform) { if (opacity != paintOpacity) { VGfloat values[4]; values[0] = 1.0f; @@ -3034,10 +3014,7 @@ static void drawVGImage(QVGPaintEnginePrivate *d, QTransform transform(d->imageTransform); VGfloat scaleX = sr.width() == 0.0f ? 0.0f : r.width() / sr.width(); VGfloat scaleY = sr.height() == 0.0f ? 0.0f : r.height() / sr.height(); - if (d->simpleTransform) - transform.translate(qRound(r.x()), qRound(r.y())); - else - transform.translate(r.x(), r.y()); + transform.translate(r.x(), r.y()); transform.scale(scaleX, scaleY); d->setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, transform); @@ -3055,10 +3032,7 @@ static void drawVGImage(QVGPaintEnginePrivate *d, return; QTransform transform(d->imageTransform); - if(d->simpleTransform) - transform.translate(qRound(pos.x()), qRound(pos.y())); - else - transform.translate(pos.x(), pos.y()); + transform.translate(pos.x(), pos.y()); d->setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, transform); d->setImageOptions(); @@ -3101,7 +3075,7 @@ void QVGPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF QVGPixmapData *vgpd = static_cast(pd); if (!vgpd->isValid()) return; - if (d->affineTransform) + if (d->simpleTransform) drawVGImage(d, r, vgpd->toVGImage(), vgpd->size(), sr); else drawVGImage(d, r, vgpd->toVGImage(d->opacity), vgpd->size(), sr); @@ -3120,7 +3094,7 @@ void QVGPaintEngine::drawPixmap(const QPointF &pos, const QPixmap &pm) QVGPixmapData *vgpd = static_cast(pd); if (!vgpd->isValid()) return; - if (d->affineTransform) + if (d->simpleTransform) drawVGImage(d, pos, vgpd->toVGImage()); else drawVGImage(d, pos, vgpd->toVGImage(d->opacity)); @@ -3135,7 +3109,7 @@ void QVGPaintEngine::drawImage { Q_D(QVGPaintEngine); VGImage vgImg; - if (d->affineTransform || d->opacity == 1.0f) + if (d->simpleTransform || d->opacity == 1.0f) vgImg = toVGImageSubRect(image, sr.toRect(), flags); else vgImg = toVGImageWithOpacitySubRect(image, d->opacity, sr.toRect()); @@ -3158,7 +3132,7 @@ void QVGPaintEngine::drawImage(const QPointF &pos, const QImage &image) { Q_D(QVGPaintEngine); VGImage vgImg; - if (d->affineTransform || d->opacity == 1.0f) + if (d->simpleTransform || d->opacity == 1.0f) vgImg = toVGImage(image); else vgImg = toVGImageWithOpacity(image, d->opacity); @@ -3191,7 +3165,7 @@ void QVGPaintEngine::drawPixmapFragments(const QPainter::PixmapFragment *drawing QPixmapData *pd = pixmap.pixmapData(); if (!pd) return; // null QPixmap - if (pd->classId() != QPixmapData::OpenVGClass || !d->affineTransform) { + if (pd->classId() != QPixmapData::OpenVGClass || !d->simpleTransform) { QPaintEngineEx::drawPixmapFragments(drawingData, dataCount, pixmap, hints); return; } @@ -3416,7 +3390,7 @@ void QVGPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) // If we are not using a simple transform, then fall back // to the default Qt path stroking algorithm. - if (!d->affineTransform) { + if (!d->simpleTransform) { QPaintEngineEx::drawTextItem(p, textItem); return; } -- cgit v0.12 From 2ab99337faa0ec03721fb39cae52361f7ac4d780 Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Mon, 4 Oct 2010 22:34:49 +0300 Subject: Fix gcc compilation problems in QtOpenGL. Actually was typo and for some reason rvct didn't catch that. Reviewed-by: TRUSTME --- src/opengl/gl2paintengineex/qtriangulator.cpp | 4 ++-- tests/auto/qglthreads/tst_qglthreads.cpp | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/opengl/gl2paintengineex/qtriangulator.cpp b/src/opengl/gl2paintengineex/qtriangulator.cpp index ea072b4..bf21240 100644 --- a/src/opengl/gl2paintengineex/qtriangulator.cpp +++ b/src/opengl/gl2paintengineex/qtriangulator.cpp @@ -2025,7 +2025,7 @@ void QTriangulator::ComplexToSimple::fillPriorityQueue() Q_ASSERT(m_edges.at(i).previous == -1 && m_edges.at(i).next == -1); Q_ASSERT(m_edges.at(i).node == 0); Q_ASSERT(m_edges.at(i).pointingUp == m_edges.at(i).originallyPointingUp); - Q_ASSERT(m_edges.at(i).pointingUp == (m_parent->m_vertices.at(qint32)(m_edges.at(i).to) < m_parent->m_vertices.at(m_edges.at(i).from))); + Q_ASSERT(m_edges.at(i).pointingUp == (m_parent->m_vertices.at(m_edges.at(i).to) < m_parent->m_vertices.at(m_edges.at(i).from))); // Ignore zero-length edges. if (m_parent->m_vertices.at(m_edges.at(i).to) != m_parent->m_vertices.at(m_edges.at(i).from)) { QPodPoint upper = m_parent->m_vertices.at(m_edges.at(i).upper()); @@ -2214,7 +2214,7 @@ void QTriangulator::ComplexToSimple::removeUnwantedEdgesAndConnect() while (current != b.second) { Q_ASSERT(current); Q_ASSERT(m_edges.at(current->data).node == current); - Q_ASSERT(qIntersectionPoint(event.point).isOnLine(m_parent->m_vertices.at(m_edges.at(current->data).from), m_parent->m_vertices.at(qint32)(m_edges.at(current->data).to))); + Q_ASSERT(qIntersectionPoint(event.point).isOnLine(m_parent->m_vertices.at(m_edges.at(current->data).from), m_parent->m_vertices.at(m_edges.at(current->data).to))); Q_ASSERT(m_parent->m_vertices.at(m_edges.at(current->data).from) == event.point || m_parent->m_vertices.at(m_edges.at(current->data).to) == event.point); insertEdgeIntoVectorIfWanted(orderedEdges, current->data); current = m_edgeList.next(current); diff --git a/tests/auto/qglthreads/tst_qglthreads.cpp b/tests/auto/qglthreads/tst_qglthreads.cpp index cce3161..06131bd 100644 --- a/tests/auto/qglthreads/tst_qglthreads.cpp +++ b/tests/auto/qglthreads/tst_qglthreads.cpp @@ -49,6 +49,10 @@ #include #endif +#ifdef Q_OS_SYMBIAN +#include // for usleep +#endif + #define RUNNING_TIME 5000 tst_QGLThreads::tst_QGLThreads(QObject *parent) @@ -209,6 +213,7 @@ public: p.drawText(image.rect(), Qt::AlignCenter, "This is an autotest"); p.end(); m_gl->bindTexture(image, GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption); + createdAndUploaded(image); } } -- cgit v0.12 From 68f4fa74312241b70604127405bec90aba49c186 Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Tue, 5 Oct 2010 11:23:13 +0300 Subject: Quick fix for OSX and Windows/Mingw compilation errors. On OSX AssertMacros.h header has macro called verify() and QRBTree::verify() function was substituted by this macro. On Windows/Mingw includes need to point to exported private include folder. Reviewed-by: Kim --- src/opengl/gl2paintengineex/qtriangulator.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/opengl/gl2paintengineex/qtriangulator.cpp b/src/opengl/gl2paintengineex/qtriangulator.cpp index bf21240..b839b00 100644 --- a/src/opengl/gl2paintengineex/qtriangulator.cpp +++ b/src/opengl/gl2paintengineex/qtriangulator.cpp @@ -57,8 +57,8 @@ #include -#include "qgl_p.h" -#include "qglextensions_p.h" +#include +#include QT_BEGIN_NAMESPACE @@ -625,7 +625,7 @@ struct QRBTree // Return 1 if 'left' comes after 'right', 0 if equal, and -1 otherwise. // 'left' and 'right' cannot be null. int order(Node *left, Node *right); - inline bool verify() const; + inline bool validate() const; private: void rotateLeft(Node *node); @@ -1038,7 +1038,7 @@ bool QRBTree::checkRedBlackProperty(Node *top) const } template -inline bool QRBTree::verify() const +inline bool QRBTree::validate() const { return checkRedBlackProperty(root) && blackDepth(root) != -1; } @@ -2854,7 +2854,7 @@ void QTriangulator::SimpleToMonotone::monotoneDecomposition() m_edges.at(j).node = node; m_edges.at(j).helper = i; m_edgeList.attachAfter(leftEdgeNode, node); - Q_ASSERT(m_edgeList.verify()); + Q_ASSERT(m_edgeList.validate()); } else { leftEdgeNode = searchEdgeLeftOfEdge(i); QRBTree::Node *node = m_edgeList.newNode(); @@ -2862,7 +2862,7 @@ void QTriangulator::SimpleToMonotone::monotoneDecomposition() m_edges.at(i).node = node; m_edges.at(i).helper = i; m_edgeList.attachAfter(leftEdgeNode, node); - Q_ASSERT(m_edgeList.verify()); + Q_ASSERT(m_edgeList.validate()); } break; case MergeVertex: @@ -2881,7 +2881,7 @@ void QTriangulator::SimpleToMonotone::monotoneDecomposition() diagonals.add(QPair(i, m_edges.at(i).helper)); if (m_edges.at(i).node) { m_edgeList.deleteNode(m_edges.at(i).node); - Q_ASSERT(m_edgeList.verify()); + Q_ASSERT(m_edgeList.validate()); } else { qWarning("Inconsistent polygon. (#5)"); } @@ -2890,7 +2890,7 @@ void QTriangulator::SimpleToMonotone::monotoneDecomposition() diagonals.add(QPair(i, m_edges.at(j).helper)); if (m_edges.at(j).node) { m_edgeList.deleteNode(m_edges.at(j).node); - Q_ASSERT(m_edgeList.verify()); + Q_ASSERT(m_edgeList.validate()); } else { qWarning("Inconsistent polygon. (#6)"); } -- cgit v0.12 From faba550d704312a29d9485bcaaa506331f102301 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 29 Sep 2010 13:13:27 +0200 Subject: Fixed arm X11 build. Without we get error: invalid conversion from 'const void*' to 'void*' Reviewed-by: Thiago Macieira --- src/corelib/arch/qatomic_arm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/arch/qatomic_arm.h b/src/corelib/arch/qatomic_arm.h index 9df02a2..bca3375 100644 --- a/src/corelib/arch/qatomic_arm.h +++ b/src/corelib/arch/qatomic_arm.h @@ -107,7 +107,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer::isFetchAndAddWaitFree() // kernel places a restartable cmpxchg implementation at a fixed address extern "C" typedef int (qt_atomic_eabi_cmpxchg_int_t)(int oldval, int newval, volatile int *ptr); -extern "C" typedef int (qt_atomic_eabi_cmpxchg_ptr_t)(void *oldval, void *newval, volatile void *ptr); +extern "C" typedef int (qt_atomic_eabi_cmpxchg_ptr_t)(const void *oldval, const void *newval, volatile void *ptr); #define qt_atomic_eabi_cmpxchg_int (*reinterpret_cast(0xffff0fc0)) #define qt_atomic_eabi_cmpxchg_ptr (*reinterpret_cast(0xffff0fc0)) -- cgit v0.12 From b3f895fd97deda0c7c5bfd704c04450e7afee748 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Tue, 5 Oct 2010 16:43:33 +0300 Subject: QS60Style: QDateEdit - Layout issues In portrait orientation, QDateEdit's calendar popup (QCalendarWidget) does not fit into screen. As a fix, the pixel metric PM_FocusFrameHMargin, is reduced from 13 to 3 in qHD screens (640*360). Also, the explicit halving of the pixel metric for QTableViews is removed. The pixel metric resulted in 27 pixel text margins (2 * pm + 1)for calendar widgets, which is clearly a bit too much. Task-number: QTBUG-14126 Reviewed-by: Miikka Heikkinen --- src/gui/styles/qs60style.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 3a01f3f..718774e 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -106,8 +106,8 @@ const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = { // *** generated pixel metrics *** {5,0,-909,0,0,2,0,0,-1,7,12,22,15,15,7,198,-909,-909,-909,20,13,2,0,0,21,7,18,30,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,4,4,4,9,13,-909,5,51,11,5,0,3,3,6,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1,106}, {5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,28,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,3,3,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1,106}, -{7,0,-909,0,0,2,0,0,-1,25,69,46,37,37,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,44,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,13,13,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, -{7,0,-909,0,0,2,0,0,-1,25,68,46,37,37,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,52,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,12,12,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, +{7,0,-909,0,0,2,0,0,-1,25,69,46,37,37,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,44,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,13,3,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, +{7,0,-909,0,0,2,0,0,-1,25,68,46,37,37,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,52,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,12,3,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, {7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,30,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1,106} // *** End of generated data *** }; @@ -2530,11 +2530,6 @@ int QS60Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const //without having to define custom pixel metric metricValue *= 2; - if (widget && (metric == PM_FocusFrameHMargin)) - if (qobject_cast(widget)) - //Halve the focus frame margin for table items - metricValue /= 2; - return metricValue; } -- cgit v0.12 From 7bf2de5adf62f45c8d7fcba22e2cf9ea427b5b37 Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Tue, 5 Oct 2010 16:54:20 +0200 Subject: Adding a threshold for partial updates. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 841 Reviewed-by: Samuel Rødal --- src/opengl/qwindowsurface_gl.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index f98dcff..8157b2a 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -534,8 +534,9 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & } } #endif - if (d_ptr->paintedRegion.boundingRect() != geometry() && - hasPartialUpdateSupport()) { + if (hasPartialUpdateSupport() && + d_ptr->paintedRegion.boundingRect().width() * d_ptr->paintedRegion.boundingRect().height() < + geometry().width() * geometry().height() * 0.2) { context()->d_func()->swapRegion(&d_ptr->paintedRegion); } else context()->swapBuffers(); -- cgit v0.12 From bb8ba98542e1ed363d4218b9a9a4e68a6c4b5337 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 6 Oct 2010 11:26:23 +1000 Subject: Create Loader components in correct context Task-number: QTBUG-13481 --- src/declarative/graphicsitems/qdeclarativeloader.cpp | 4 +++- .../qdeclarativeloader/data/CreationContextLoader.qml | 15 +++++++++++++++ .../qdeclarativeloader/data/creationContext.qml | 8 ++++++++ .../qdeclarativeloader/tst_qdeclarativeloader.cpp | 14 ++++++++++++++ 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 tests/auto/declarative/qdeclarativeloader/data/CreationContextLoader.qml create mode 100644 tests/auto/declarative/qdeclarativeloader/data/creationContext.qml diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp index 1066c2b..5647b14 100644 --- a/src/declarative/graphicsitems/qdeclarativeloader.cpp +++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp @@ -337,7 +337,9 @@ void QDeclarativeLoaderPrivate::_q_sourceLoaded() return; } - QDeclarativeContext *ctxt = new QDeclarativeContext(qmlContext(q)); + QDeclarativeContext *creationContext = component->creationContext(); + if (!creationContext) creationContext = qmlContext(q); + QDeclarativeContext *ctxt = new QDeclarativeContext(creationContext); ctxt->setContextObject(q); QDeclarativeComponent *c = component; diff --git a/tests/auto/declarative/qdeclarativeloader/data/CreationContextLoader.qml b/tests/auto/declarative/qdeclarativeloader/data/CreationContextLoader.qml new file mode 100644 index 0000000..bfc9a8d --- /dev/null +++ b/tests/auto/declarative/qdeclarativeloader/data/CreationContextLoader.qml @@ -0,0 +1,15 @@ +import QtQuick 1.0 + +Loader { + id: myLoader + property int testProperty: 1912 + sourceComponent: loaderComponent + Component { + id: loaderComponent + Item { + Component.onCompleted: { + test = (myLoader.testProperty == 1912); + } + } + } +} diff --git a/tests/auto/declarative/qdeclarativeloader/data/creationContext.qml b/tests/auto/declarative/qdeclarativeloader/data/creationContext.qml new file mode 100644 index 0000000..5297978 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeloader/data/creationContext.qml @@ -0,0 +1,8 @@ +import QtQuick 1.0 + +Item { + property bool test: false + + CreationContextLoader { + } +} diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp index 8d04616..1bde55b 100644 --- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp +++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp @@ -89,6 +89,7 @@ private slots: void deleteComponentCrash(); void nonItem(); void vmeErrors(); + void creationContext(); private: QDeclarativeEngine engine; @@ -562,6 +563,19 @@ void tst_QDeclarativeLoader::vmeErrors() delete loader; } +// QTBUG-13481 +void tst_QDeclarativeLoader::creationContext() +{ + QDeclarativeComponent component(&engine, TEST_FILE("creationContext.qml")); + + QObject *o = component.create(); + QVERIFY(o != 0); + + QCOMPARE(o->property("test").toBool(), true); + + delete o; +} + QTEST_MAIN(tst_QDeclarativeLoader) #include "tst_qdeclarativeloader.moc" -- cgit v0.12 From 0030599cbe39c9fc7d6f2632b4e66a54b1b46417 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 6 Oct 2010 13:59:19 +1000 Subject: Ensure PathView updates positions when path changes. Fixes regression caused by optimization added in commit 35a51442ed21f58c06b21293eeb56e843251ee82. Task-number: QTBUG-14239 Reviewed-by: Martin Jones --- src/declarative/graphicsitems/qdeclarativepathview.cpp | 17 +++++++++++++++-- src/declarative/graphicsitems/qdeclarativepathview_p.h | 1 + .../qdeclarativepathview/data/pathUpdate.qml | 18 ++++++++++++++++++ .../qdeclarativepathview/tst_qdeclarativepathview.cpp | 18 ++++++++++++++++++ 4 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativepathview/data/pathUpdate.qml diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index d134929..3ae8788 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -300,6 +300,19 @@ void QDeclarativePathViewPrivate::setHighlightPosition(qreal pos) } } +void QDeclarativePathView::pathUpdated() +{ + Q_D(QDeclarativePathView); + QList::iterator it = d->items.begin(); + while (it != d->items.end()) { + QDeclarativeItem *item = *it; + if (QDeclarativePathViewAttached *att = d->attached(item)) + att->m_percent = -1; + ++it; + } + refill(); +} + void QDeclarativePathViewPrivate::updateItem(QDeclarativeItem *item, qreal percent) { if (QDeclarativePathViewAttached *att = attached(item)) { @@ -526,9 +539,9 @@ void QDeclarativePathView::setPath(QDeclarativePath *path) if (d->path == path) return; if (d->path) - disconnect(d->path, SIGNAL(changed()), this, SLOT(refill())); + disconnect(d->path, SIGNAL(changed()), this, SLOT(pathUpdated())); d->path = path; - connect(d->path, SIGNAL(changed()), this, SLOT(refill())); + connect(d->path, SIGNAL(changed()), this, SLOT(pathUpdated())); if (d->isValid() && isComponentComplete()) { d->clear(); if (d->attType) { diff --git a/src/declarative/graphicsitems/qdeclarativepathview_p.h b/src/declarative/graphicsitems/qdeclarativepathview_p.h index 62a8c44..7775b1c 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview_p.h +++ b/src/declarative/graphicsitems/qdeclarativepathview_p.h @@ -186,6 +186,7 @@ private Q_SLOTS: void modelReset(); void createdItem(int index, QDeclarativeItem *item); void destroyingItem(QDeclarativeItem *item); + void pathUpdated(); private: friend class QDeclarativePathViewAttached; diff --git a/tests/auto/declarative/qdeclarativepathview/data/pathUpdate.qml b/tests/auto/declarative/qdeclarativepathview/data/pathUpdate.qml new file mode 100644 index 0000000..0c99e7f --- /dev/null +++ b/tests/auto/declarative/qdeclarativepathview/data/pathUpdate.qml @@ -0,0 +1,18 @@ +import Qt 4.7 + +Rectangle { + width: 400 + height: 400 + + PathView { + id: view + objectName: "pathView" + anchors.fill: parent + model: 10 + delegate: Rectangle { objectName: "wrapper"; color: "green"; width: 100; height: 100 } + path: Path { + startX: view.width/2; startY: 0 + PathLine { x: view.width/2; y: view.height } + } + } +} diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp index 65007a6..3a2a577 100644 --- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp +++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -86,6 +86,7 @@ private slots: void package(); void emptyModel(); void closed(); + void pathUpdate(); private: QDeclarativeView *createView(); @@ -808,6 +809,23 @@ void tst_QDeclarativePathView::closed() } } +// QTBUG-14239 +void tst_QDeclarativePathView::pathUpdate() +{ + QDeclarativeView *canvas = createView(); + QVERIFY(canvas); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pathUpdate.qml")); + + QDeclarativePathView *pathView = canvas->rootObject()->findChild("pathView"); + QVERIFY(pathView); + + QDeclarativeItem *item = findItem(pathView, "wrapper", 0); + QVERIFY(item); + QCOMPARE(item->x(), 150.0); + + delete canvas; +} + QDeclarativeView *tst_QDeclarativePathView::createView() { QDeclarativeView *canvas = new QDeclarativeView(0); -- cgit v0.12 From 4647f24469ec93b3b66628472af5462fbe957439 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Wed, 6 Oct 2010 12:41:16 +1000 Subject: Update QtGui def files --- src/s60installs/bwins/QtGuiu.def | 5 ++++- src/s60installs/eabi/QtGuiu.def | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 9a61523..7cc2752 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -12892,5 +12892,8 @@ EXPORTS ?setTimeout@QTapAndHoldGesture@@SAXH@Z @ 12891 NONAME ; void QTapAndHoldGesture::setTimeout(int) ?qmljsDebugArguments@QApplicationPrivate@@2VQString@@A @ 12892 NONAME ; class QString QApplicationPrivate::qmljsDebugArguments ?effectiveBoundingRect@QGraphicsItemPrivate@@QBE?AVQRectF@@PAVQGraphicsItem@@@Z @ 12893 NONAME ; class QRectF QGraphicsItemPrivate::effectiveBoundingRect(class QGraphicsItem *) const - ?lastResortFont@QFont@@QBE?AVQString@@XZ @ 12894 NONAME ; class QString QFont::lastResortFont(void) const + ?maxTextureHeight@QTextureGlyphCache@@UBEHXZ @ 12894 NONAME ; int QTextureGlyphCache::maxTextureHeight(void) const + ?maxTextureWidth@QTextureGlyphCache@@UBEHXZ @ 12895 NONAME ; int QTextureGlyphCache::maxTextureWidth(void) const + ?convertToPostscriptFontFamilyName@QFontEngine@@SA?AVQByteArray@@ABV2@@Z @ 12896 NONAME ; class QByteArray QFontEngine::convertToPostscriptFontFamilyName(class QByteArray const &) + ?lastResortFont@QFont@@QBE?AVQString@@XZ @ 12897 NONAME ; class QString QFont::lastResortFont(void) const diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 634b7af..4e867a3 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -12098,4 +12098,5 @@ EXPORTS _ZN20QGraphicsItemPrivate26childrenBoundingRectHelperEP10QTransformP6QRectFP13QGraphicsItem @ 12097 NONAME _ZNK20QGraphicsItemPrivate21effectiveBoundingRectEP13QGraphicsItem @ 12098 NONAME _ZNK5QFont14lastResortFontEv @ 12099 NONAME + _ZN11QFontEngine33convertToPostscriptFontFamilyNameERK10QByteArray @ 12100 NONAME -- cgit v0.12 From 695b54e671b55bd8103dee8b30ee76309dbd26c1 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Wed, 6 Oct 2010 14:01:56 +1000 Subject: Fix minehunt execution from QtDemo Task-number: QTBUG-14250 Reviewed-by: Martin Jones --- demos/declarative/minehunt/main.cpp | 2 +- demos/declarative/minehunt/minehunt.pro | 1 + demos/declarative/minehunt/minehunt.qrc | 20 ++++++++++++++++++++ demos/qtdemo/menumanager.cpp | 1 + demos/qtdemo/xml/examples.xml | 2 +- 5 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 demos/declarative/minehunt/minehunt.qrc diff --git a/demos/declarative/minehunt/main.cpp b/demos/declarative/minehunt/main.cpp index 8bbaee9..2b286ef 100644 --- a/demos/declarative/minehunt/main.cpp +++ b/demos/declarative/minehunt/main.cpp @@ -58,7 +58,7 @@ int main(int argc, char *argv[]) canvas.setResizeMode(QDeclarativeView::SizeRootObjectToView); #endif canvas.engine()->rootContext()->setContextObject(game); - canvas.setSource(QString("minehunt.qml")); + canvas.setSource(QString("qrc:minehunt.qml")); QObject::connect(canvas.engine(), SIGNAL(quit()), &app, SLOT(quit())); #ifdef Q_OS_SYMBIAN diff --git a/demos/declarative/minehunt/minehunt.pro b/demos/declarative/minehunt/minehunt.pro index 7a491ab..753ca4e 100644 --- a/demos/declarative/minehunt/minehunt.pro +++ b/demos/declarative/minehunt/minehunt.pro @@ -6,6 +6,7 @@ CONFIG += qt plugin # Input HEADERS += minehunt.h SOURCES += main.cpp minehunt.cpp +RESOURCES = minehunt.qrc sources.files = minehunt.qml minehunt.pro MinehuntCore sources.path = $$[QT_INSTALL_DEMOS]/declarative/minehunt diff --git a/demos/declarative/minehunt/minehunt.qrc b/demos/declarative/minehunt/minehunt.qrc new file mode 100644 index 0000000..fa8e27d --- /dev/null +++ b/demos/declarative/minehunt/minehunt.qrc @@ -0,0 +1,20 @@ + + + minehunt.qml + MinehuntCore/Explosion.qml + MinehuntCore/Tile.qml + MinehuntCore/qmldir + MinehuntCore/pics/background.png + MinehuntCore/pics/back.png + MinehuntCore/pics/bomb-color.png + MinehuntCore/pics/bomb.png + MinehuntCore/pics/face-sad.png + MinehuntCore/pics/face-smile-big.png + MinehuntCore/pics/face-smile.png + MinehuntCore/pics/flag-color.png + MinehuntCore/pics/flag.png + MinehuntCore/pics/front.png + MinehuntCore/pics/quit.png + MinehuntCore/pics/star.png + + diff --git a/demos/qtdemo/menumanager.cpp b/demos/qtdemo/menumanager.cpp index fe3c5aa..ea9146e 100644 --- a/demos/qtdemo/menumanager.cpp +++ b/demos/qtdemo/menumanager.cpp @@ -518,6 +518,7 @@ QString MenuManager::resolveExeFile(const QString &name) dir.cd(dirName); dir.cd(fileName); + fileName = fileName.split("/").last(); QFile unixFile(dir.path() + "/" + fileName); if (unixFile.exists()) return unixFile.fileName(); QFile winR(dir.path() + "\\release\\" + fileName + ".exe"); diff --git a/demos/qtdemo/xml/examples.xml b/demos/qtdemo/xml/examples.xml index 0ab048e..27f72bb 100644 --- a/demos/qtdemo/xml/examples.xml +++ b/demos/qtdemo/xml/examples.xml @@ -18,7 +18,7 @@ - + -- cgit v0.12 From cd4389efee184d2ad65b52c5ef64793868f1a004 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 6 Oct 2010 15:12:46 +1000 Subject: Ensure the TextInput cursor blinks immediately when enabled. Previously we relied on cursorPosChanged being called to do the update, but that isn't called in all circumstances. Now we explicitly update when the cursor is enabled or disabled. Task-number: QTBUG-13993 --- src/declarative/graphicsitems/qdeclarativetextinput.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 4817999..637dd77 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -417,7 +417,11 @@ void QDeclarativeTextInput::setCursorVisible(bool on) return; d->cursorVisible = on; d->control->setCursorBlinkPeriod(on?QApplication::cursorFlashTime():0); - //d->control should emit the cursor update regions + QRect r = d->control->cursorRect(); + if (d->control->inputMask().isEmpty()) + updateRect(r); + else + updateRect(); emit cursorVisibleChanged(d->cursorVisible); } -- cgit v0.12 From 8209815ee6eea3cbc1ca7b71ce8b68ae8930c0bd Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 6 Oct 2010 15:38:39 +1000 Subject: Autotest Task-number: QTBUG-14089 --- .../data/aliasPropertyChangeSignals.qml | 16 ++++++++++++++++ .../qdeclarativelanguage/tst_qdeclarativelanguage.cpp | 15 +++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/aliasPropertyChangeSignals.qml diff --git a/tests/auto/declarative/qdeclarativelanguage/data/aliasPropertyChangeSignals.qml b/tests/auto/declarative/qdeclarativelanguage/data/aliasPropertyChangeSignals.qml new file mode 100644 index 0000000..7944deb --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/aliasPropertyChangeSignals.qml @@ -0,0 +1,16 @@ +import QtQuick 1.0 + +QtObject { + id: root + + property alias aliasProperty: root.realProperty + onAliasPropertyChanged: root.test = true + + property int realProperty: 0 + + property bool test: false + + Component.onCompleted: { + root.realProperty = 10; + } +} diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index 8609a7e..3c82fc5 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -119,6 +119,7 @@ private slots: void cppnamespace(); void aliasProperties(); void aliasPropertiesAndSignals(); + void aliasPropertyChangeSignals(); void componentCompositeType(); void i18n(); void i18n_data(); @@ -1816,6 +1817,20 @@ void tst_qdeclarativelanguage::initTestCase() out.write(in.readAll()); } +void tst_qdeclarativelanguage::aliasPropertyChangeSignals() +{ + QDeclarativeComponent component(&engine, TEST_FILE("aliasPropertyChangeSignals.qml")); + + VERIFY_ERRORS(0); + QObject *o = component.create(); + QVERIFY(o != 0); + + QEXPECT_FAIL("", "QTBUG-14089", Abort); + QCOMPARE(o->property("test").toBool(), true); + + delete o; +} + QTEST_MAIN(tst_qdeclarativelanguage) #include "tst_qdeclarativelanguage.moc" -- cgit v0.12 From 9979154d2fd757396ef4685dbbb9bad95c3bf7ff Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Wed, 6 Oct 2010 10:02:45 +0300 Subject: QS60Style: Highlighted TreeBranch indicator is incorrect Part of the fix for QTBUG-13553 incorrectly uses commonstyle to draw branch highlight, when it should use QS60Style. As a fix, commonstyle should not be used unless theme palette has been tempered with. Task-number: QTBUG-13699 Reviewed-by: Miikka Heikkinen --- src/gui/styles/qs60style.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 718774e..1e32bd8 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -2453,7 +2453,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti case PE_PanelItemViewRow: // ### Qt 5: remove #ifndef QT_NO_ITEMVIEWS if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast(option)) { - if (QS60StylePrivate::equalToThemePalette(vopt->palette.base().texture().cacheKey(), QPalette::Base)) { + if (!QS60StylePrivate::equalToThemePalette(vopt->palette.base().texture().cacheKey(), QPalette::Base)) { //QPalette::Base has been changed, let commonstyle draw the item commonStyleDraws = true; } else { -- cgit v0.12 From 9d2078629b54a44defda7fa491824df437ffea11 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 6 Oct 2010 17:43:22 +1000 Subject: Allow default QApplication::startDragDistance() to be defined in platformdefs.h Task-number: QT-3930 Reviewed-by: Joona Petrell --- src/gui/kernel/qapplication.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index fdacefc..3323fbc 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -477,11 +477,14 @@ bool Q_GUI_EXPORT qt_tab_all_widgets = true; bool qt_in_tab_key_event = false; int qt_antialiasing_threshold = -1; static int drag_time = 500; +#ifndef QT_GUI_DRAG_DISTANCE +#define QT_GUI_DRAG_DISTANCE 4 +#endif #ifdef Q_OS_SYMBIAN // The screens are a bit too small to for your thumb when using only 4 pixels drag distance. -static int drag_distance = 12; +static int drag_distance = 12; //XXX move to qplatformdefs.h #else -static int drag_distance = 4; +static int drag_distance = QT_GUI_DRAG_DISTANCE; #endif static Qt::LayoutDirection layout_direction = Qt::LeftToRight; QSize QApplicationPrivate::app_strut = QSize(0,0); // no default application strut -- cgit v0.12 From 7d79beeb4c88d4e5fb8d7aecd8dd07419b465f55 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 6 Oct 2010 17:55:15 +1000 Subject: Set reasonable QT_GUI_DRAG_DISTANCE in mkspecs/linux-g++-maemo/qplatformdefs.h Task-number: QT-3930 --- mkspecs/linux-g++-maemo/qplatformdefs.h | 1 + 1 file changed, 1 insertion(+) diff --git a/mkspecs/linux-g++-maemo/qplatformdefs.h b/mkspecs/linux-g++-maemo/qplatformdefs.h index d7feb9e..df6152a 100644 --- a/mkspecs/linux-g++-maemo/qplatformdefs.h +++ b/mkspecs/linux-g++-maemo/qplatformdefs.h @@ -42,3 +42,4 @@ #include "../linux-g++/qplatformdefs.h" #define QT_GUI_DOUBLE_CLICK_RADIUS 20 +#define QT_GUI_DRAG_DISTANCE 16 -- cgit v0.12 From 97d436160c87876cdc272b3ce0bb09256d78405c Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Wed, 6 Oct 2010 09:54:15 +0200 Subject: Remove unused/incorrect TFX commands pertaining to layers on Symbian. These commands have been renamed in the Symbian^4 code line, but since they are not currently used by the effects engine, we simply remove them for now to avoid causing build breakages on platforms that use the older version. Reviewed-by: Jani Hautakangas --- src/gui/kernel/qapplication_s60.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 1127c84..296f24f 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -152,18 +152,12 @@ void QS60Data::controlVisibilityChanged(CCoeControl *control, bool visible) if (backingStore.data()) { backingStore.registerWidget(widget); } else { -#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS - S60->wsSession().SendEffectCommand(ETfxCmdRestoreLayer); -#endif backingStore.create(window); backingStore.registerWidget(widget); qt_widget_private(widget)->invalidateBuffer(widget->rect()); widget->repaint(); } } else { -#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS - S60->wsSession().SendEffectCommand(ETfxCmdDeallocateLayer); -#endif backingStore.unregisterWidget(widget); // In order to ensure that any resources used by the window surface // are immediately freed, we flush the WSERV command buffer. -- cgit v0.12 From d1e415f30b080f0aafefb13aa402634e5710b343 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Wed, 6 Oct 2010 10:14:21 +0200 Subject: Define QVG_SCISSOR_CLIP for QtOpenVG on Symbian. I avoided adding this flag for ages since I wasn't convinced that it was needed on all Symbian OpenVG hardware, but not having it has caused more problems since people report problems when it is not enabled. Simple solution is just to add it. Task-number: QTBUG-11311 Reviewed-by: Jani Hautakangas --- src/openvg/openvg.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openvg/openvg.pro b/src/openvg/openvg.pro index eb60331..c05af90 100644 --- a/src/openvg/openvg.pro +++ b/src/openvg/openvg.pro @@ -35,7 +35,7 @@ contains(QT_CONFIG, egl) { } symbian { - DEFINES += QVG_RECREATE_ON_SIZE_CHANGE QVG_BUFFER_SCROLLING + DEFINES += QVG_RECREATE_ON_SIZE_CHANGE QVG_BUFFER_SCROLLING QVG_SCISSOR_CLIP SOURCES += \ qvg_symbian.cpp } -- cgit v0.12 From 6b118e981b0da4e7bcfd99be6ba1d0123885e7b3 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 6 Oct 2010 10:29:55 +0200 Subject: fix regexp in "make custom command handling in vc(x)proj files sane" --- qmake/generators/win32/msvc_objectmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index df414ea..f5ca1be 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -284,7 +284,7 @@ inline XmlOutput::xml_output attrX(const char *name, const QStringList &v, const QStringList VCToolBase::fixCommandLine(const QString &input) { // The splitting regexp is a bit bizarre for backwards compat reasons (why else ...). - return input.split(QRegExp(QLatin1String("\n\t|\r\\h|\r\n"))); + return input.split(QRegExp(QLatin1String("\n\t|\r\\\\h|\r\n"))); } static QString vcCommandSeparator() -- cgit v0.12 From 651135cf53aacc4f580cc382b8192bd313366ed8 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Wed, 6 Oct 2010 18:52:44 +1000 Subject: Do not show 'More' button when in fullscreen view. Task-number: QTBUG-11813 --- demos/declarative/flickr/mobile/ImageDetails.qml | 2 ++ demos/declarative/flickr/mobile/ToolBar.qml | 22 +++++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/demos/declarative/flickr/mobile/ImageDetails.qml b/demos/declarative/flickr/mobile/ImageDetails.qml index 5dd3b4e..9d1464e 100644 --- a/demos/declarative/flickr/mobile/ImageDetails.qml +++ b/demos/declarative/flickr/mobile/ImageDetails.qml @@ -172,6 +172,8 @@ Flipable { states: State { name: "Back" PropertyChanges { target: itemRotation; angle: 180 } + PropertyChanges { target: toolBar; button2Visible: false } + PropertyChanges { target: toolBar; button1Label: "Back" } } transitions: Transition { diff --git a/demos/declarative/flickr/mobile/ToolBar.qml b/demos/declarative/flickr/mobile/ToolBar.qml index 55f19d2..d8abb14 100644 --- a/demos/declarative/flickr/mobile/ToolBar.qml +++ b/demos/declarative/flickr/mobile/ToolBar.qml @@ -46,20 +46,24 @@ Item { property alias button1Label: button1.text property alias button2Label: button2.text + property alias button2Visible: button2.visible + signal button1Clicked signal button2Clicked BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 } - Button { - id: button1 - anchors.left: parent.left; anchors.leftMargin: 5; y: 3; width: 140; height: 32 - onClicked: toolbar.button1Clicked() - } + Row { + anchors.right: parent.right; anchors.rightMargin: 5; y: 3; height: 32; spacing: 30 + Button { + id: button1 + width: 140; height: 32 + onClicked: toolbar.button1Clicked() + } - Button { - id: button2 - anchors.right: parent.right; anchors.rightMargin: 5; y: 3; width: 140; height: 32 - onClicked: toolbar.button2Clicked() + Button { + id: button2; width: 140; height: 32 + onClicked: toolbar.button2Clicked() + } } } -- cgit v0.12 From f532679ca11914b453e22342f2ae5e9f790ce47a Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 6 Oct 2010 11:48:24 +0200 Subject: Fixes assert in QDeclarativeWebView If QDeclarativeWebView was instantiated twice an assert was triggered by QWebSettings::enablePersistentStorage(); This patch is crtical for tooling (Bauhaus) Task-number: QTBUG-14278 Reviewed-by: Aaron Kennedy --- src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp index 94f08bd..e4f70de 100644 --- a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp @@ -249,7 +249,11 @@ void QDeclarativeWebView::init() { d = new QDeclarativeWebViewPrivate(this); - QWebSettings::enablePersistentStorage(); + if (QWebSettings::iconDatabasePath().isNull() && + QWebSettings::globalSettings()->localStoragePath().isNull() && + QWebSettings::offlineStoragePath().isNull() && + QWebSettings::offlineWebApplicationCachePath().isNull()) + QWebSettings::enablePersistentStorage(); setAcceptedMouseButtons(Qt::LeftButton); setFlag(QGraphicsItem::ItemHasNoContents, true); -- cgit v0.12 From 62ee836fafe515c03b0be716585f8c2354e188f7 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Tue, 5 Oct 2010 17:39:57 +0200 Subject: Fix copying large data to non-Qt applications In send_selection when we decide to use INCR properties we set the given property value to be INCR atom, however we were also sending SelectionNotify event containing the name of the property that the client should watch as INCR, which is wrong, we should send the original property that we were asked to use instead. This fixes copying large junks of data from Qt application, for example copying text (>200k) to gedit or images to gimp. Task-number: QTBUG-8644 Reviewed-by: Bradley T. Hughes --- src/gui/kernel/qclipboard_x11.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qclipboard_x11.cpp b/src/gui/kernel/qclipboard_x11.cpp index 4b75f0a..b7ca2d4 100644 --- a/src/gui/kernel/qclipboard_x11.cpp +++ b/src/gui/kernel/qclipboard_x11.cpp @@ -836,7 +836,7 @@ static Atom send_selection(QClipboardData *d, Atom target, Window window, Atom p ATOM(INCR), 32, PropModeReplace, (uchar *) &bytes, 1); (void)new QClipboardINCRTransaction(window, property, atomFormat, dataFormat, data, increment); - return ATOM(INCR); + return property; } // make sure we can perform the XChangeProperty in a single request -- cgit v0.12 From 4b81cb847647450f4bad8a0d9a278d43ebdfecc6 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Wed, 6 Oct 2010 10:31:37 +0200 Subject: Fixed a buffer overrun when pasting large data from non-Qt apps When we receive a COMPOUND_TEXT data and convert it to multi-byte, if the new length is less than the original buffer, we resize the buffer, but then we need to make sure we reset the buffer_offset variable, which is returned as a "size" of the buffer to a caller. The conversion to COMPOUND_TEXT format was totally wrong, we were using the wrong length of the input text, so the converted string was truncated. Task-number: QTBUG-8644 Reviewed-by: Bradley T. Hughes --- src/gui/kernel/qclipboard_x11.cpp | 22 +++++++++------------- src/gui/kernel/qdnd_x11.cpp | 2 +- src/gui/kernel/qmotifdnd_x11.cpp | 2 +- src/gui/kernel/qt_x11_p.h | 2 +- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/gui/kernel/qclipboard_x11.cpp b/src/gui/kernel/qclipboard_x11.cpp index b7ca2d4..55548ef 100644 --- a/src/gui/kernel/qclipboard_x11.cpp +++ b/src/gui/kernel/qclipboard_x11.cpp @@ -595,7 +595,7 @@ static inline int maxSelectionIncr(Display *dpy) { return XMaxRequestSize(dpy) > 65536 ? 65536*4 : XMaxRequestSize(dpy)*4 - 100; } bool QX11Data::clipboardReadProperty(Window win, Atom property, bool deleteProperty, - QByteArray *buffer, int *size, Atom *type, int *format, bool nullterm) + QByteArray *buffer, int *size, Atom *type, int *format) { int maxsize = maxSelectionIncr(display); ulong bytes_left; // bytes_after @@ -641,13 +641,13 @@ bool QX11Data::clipboardReadProperty(Window win, Atom property, bool deletePrope break; } - int newSize = proplen + (nullterm ? 1 : 0); + int newSize = proplen; buffer->resize(newSize); bool ok = (buffer->size() == newSize); VDEBUG("QClipboard: read_property(): buffer resized to %d", buffer->size()); - if (ok) { + if (ok && newSize) { // could allocate buffer while (bytes_left) { @@ -683,23 +683,19 @@ bool QX11Data::clipboardReadProperty(Window win, Atom property, bool deletePrope XTextProperty textprop; textprop.encoding = *type; textprop.format = *format; - textprop.nitems = length; + textprop.nitems = buffer_offset; textprop.value = (unsigned char *) buffer->data(); char **list_ret = 0; int count; if (XmbTextPropertyToTextList(display, &textprop, &list_ret, &count) == Success && count && list_ret) { - offset = strlen(list_ret[0]); - buffer->resize(offset + (nullterm ? 1 : 0)); + offset = buffer_offset = strlen(list_ret[0]); + buffer->resize(offset); memcpy(buffer->data(), list_ret[0], offset); } if (list_ret) XFreeStringList(list_ret); } - - // zero-terminate (for text) - if (nullterm) - buffer->data()[buffer_offset] = '\0'; } // correct size, not 0-term. @@ -742,7 +738,7 @@ QByteArray QX11Data::clipboardReadIncrementalProperty(Window win, Atom property, if (event.xproperty.atom != property || event.xproperty.state != PropertyNewValue) continue; - if (X11->clipboardReadProperty(win, property, true, &tmp_buf, &length, 0, 0, false)) { + if (X11->clipboardReadProperty(win, property, true, &tmp_buf, &length, 0, 0)) { if (length == 0) { // no more data, we're done if (nullterm) { buf.resize(offset+1); @@ -1070,7 +1066,7 @@ bool QClipboard::event(QEvent *e) QByteArray multi_data; if (req->property == XNone || !X11->clipboardReadProperty(req->requestor, req->property, false, &multi_data, - 0, &multi_type, &multi_format, 0) + 0, &multi_type, &multi_format) || multi_format != 32) { // MULTIPLE property not formatted correctly XSendEvent(dpy, req->requestor, False, NoEventMask, &event); @@ -1292,7 +1288,7 @@ QByteArray QClipboardWatcher::getDataInFormat(Atom fmtatom) const Atom type; XSelectInput(dpy, win, PropertyChangeMask); - if (X11->clipboardReadProperty(win, ATOM(_QT_SELECTION), true, &buf, 0, &type, 0, false)) { + if (X11->clipboardReadProperty(win, ATOM(_QT_SELECTION), true, &buf, 0, &type, 0)) { if (type == ATOM(INCR)) { int nbytes = buf.size() >= 4 ? *((int*)buf.data()) : 0; buf = X11->clipboardReadIncrementalProperty(win, ATOM(_QT_SELECTION), nbytes, false); diff --git a/src/gui/kernel/qdnd_x11.cpp b/src/gui/kernel/qdnd_x11.cpp index 92dd0a1..68d7688 100644 --- a/src/gui/kernel/qdnd_x11.cpp +++ b/src/gui/kernel/qdnd_x11.cpp @@ -1887,7 +1887,7 @@ static QVariant xdndObtainData(const char *format, QVariant::Type requestedType) if (got) { Atom type; - if (X11->clipboardReadProperty(tw->effectiveWinId(), ATOM(XdndSelection), true, &result, 0, &type, 0, false)) { + if (X11->clipboardReadProperty(tw->effectiveWinId(), ATOM(XdndSelection), true, &result, 0, &type, 0)) { if (type == ATOM(INCR)) { int nbytes = result.size() >= 4 ? *((int*)result.data()) : 0; result = X11->clipboardReadIncrementalProperty(tw->effectiveWinId(), ATOM(XdndSelection), nbytes, false); diff --git a/src/gui/kernel/qmotifdnd_x11.cpp b/src/gui/kernel/qmotifdnd_x11.cpp index 0a7b350..3334455 100644 --- a/src/gui/kernel/qmotifdnd_x11.cpp +++ b/src/gui/kernel/qmotifdnd_x11.cpp @@ -766,7 +766,7 @@ QVariant QX11Data::motifdndObtainData(const char *mimeType) if (got) { Atom type; - if (X11->clipboardReadProperty(tw->internalWinId(), Dnd_selection, true, &result, 0, &type, 0, false)) { + if (X11->clipboardReadProperty(tw->internalWinId(), Dnd_selection, true, &result, 0, &type, 0)) { } } diff --git a/src/gui/kernel/qt_x11_p.h b/src/gui/kernel/qt_x11_p.h index 7383382..d62d9c3 100644 --- a/src/gui/kernel/qt_x11_p.h +++ b/src/gui/kernel/qt_x11_p.h @@ -350,7 +350,7 @@ struct QX11Data // from qclipboard_x11.cpp bool clipboardWaitForEvent(Window win, int type, XEvent *event, int timeout); bool clipboardReadProperty(Window win, Atom property, bool deleteProperty, - QByteArray *buffer, int *size, Atom *type, int *format, bool nullterm); + QByteArray *buffer, int *size, Atom *type, int *format); QByteArray clipboardReadIncrementalProperty(Window win, Atom property, int nbytes, bool nullterm); // from qdnd_x11.cpp -- cgit v0.12 From e98962aab2db1c3760b324d6640fa8b510b7e04c Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 6 Oct 2010 12:46:45 +0200 Subject: tst_qtcpsocket: Attempt to reproduce QTBUG-14268 The test (un)fortunately passes :-) Task-number: QTBUG-14268 --- tests/auto/qtcpsocket/tst_qtcpsocket.cpp | 71 ++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp index 31cae40..5b77006 100644 --- a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp @@ -201,6 +201,9 @@ private slots: void proxyFactory_data(); void proxyFactory(); + void qtbug14268_peek(); + + protected slots: void nonBlockingIMAP_hostFound(); void nonBlockingIMAP_connected(); @@ -251,6 +254,41 @@ enum ProxyTests { int tst_QTcpSocket::loopLevel = 0; +class SocketPair: public QObject +{ + Q_OBJECT +public: + QTcpSocket *endPoints[2]; + + SocketPair(QObject *parent = 0) + : QObject(parent) + { + endPoints[0] = endPoints[1] = 0; + } + + bool create() + { + QTcpServer server; + server.listen(); + + QTcpSocket *active = new QTcpSocket(this); + active->connectToHost("127.0.0.1", server.serverPort()); + + if (!active->waitForConnected(1000)) + return false; + + if (!server.waitForNewConnection(1000)) + return false; + + QTcpSocket *passive = server.nextPendingConnection(); + passive->setParent(this); + + endPoints[0] = active; + endPoints[1] = passive; + return true; + } +}; + tst_QTcpSocket::tst_QTcpSocket() { Q_SET_DEFAULT_IAP @@ -2467,6 +2505,39 @@ void tst_QTcpSocket::proxyFactory() delete socket; } +void tst_QTcpSocket::qtbug14268_peek() +{ + QFETCH_GLOBAL(bool, setProxy); + if (setProxy) + return; + + SocketPair socketPair; + QVERIFY(socketPair.create()); + QTcpSocket *outgoing = socketPair.endPoints[0]; + QTcpSocket *incoming = socketPair.endPoints[1]; + + QVERIFY(incoming->state() == QTcpSocket::ConnectedState); + QVERIFY(outgoing->state() == QTcpSocket::ConnectedState); + + outgoing->write("abc"); + QVERIFY(outgoing->waitForBytesWritten(2000)); + QVERIFY(incoming->waitForReadyRead(2000)); + QVERIFY(incoming->peek(128*1024) == QByteArray("abc")); + + outgoing->write("def"); + QVERIFY(outgoing->waitForBytesWritten(2000)); + QVERIFY(incoming->waitForReadyRead(2000)); + QVERIFY(incoming->peek(128*1024) == QByteArray("abcdef")); + + outgoing->write("ghi"); + QVERIFY(outgoing->waitForBytesWritten(2000)); + QVERIFY(incoming->waitForReadyRead(2000)); + QVERIFY(incoming->peek(128*1024) == QByteArray("abcdefghi")); + + QVERIFY(incoming->read(128*1024) == QByteArray("abcdefghi")); +} + + QTEST_MAIN(tst_QTcpSocket) #include "tst_qtcpsocket.moc" -- cgit v0.12 From ccd3f663c8c96e266b173a6f825bccec830007e1 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Wed, 6 Oct 2010 10:31:06 +0200 Subject: Fix crash when constructing QThreadStorage after global destructors have run In this particular case, the destructors vector used by QThreadStorageData has already been destroyed, yet a new QThreadStorage is being allocated. This can only happen during global destruction, at which point we assume that there is only one thread. In order to keep QThreadStorage working, we need somewhere to store the data, and the best place we have in this situation is at the tail of the current thread's tls vector. The destructor is ignored, since we have no where to store it, and no way to actually call it. Task-number: QTBUG-10084 Reviewed-by: thiago Reviewed-by: olivier --- src/corelib/thread/qthreadstorage.cpp | 21 +++++++- tests/auto/qthreadstorage/crashOnExit.cpp | 64 ++++++++++++++++++++++++ tests/auto/qthreadstorage/crashOnExit.pro | 4 ++ tests/auto/qthreadstorage/qthreadstorage.pro | 8 +-- tests/auto/qthreadstorage/tst_qthreadstorage.cpp | 9 ++++ tests/auto/qthreadstorage/tst_qthreadstorage.pro | 4 ++ 6 files changed, 104 insertions(+), 6 deletions(-) create mode 100644 tests/auto/qthreadstorage/crashOnExit.cpp create mode 100644 tests/auto/qthreadstorage/crashOnExit.pro create mode 100644 tests/auto/qthreadstorage/tst_qthreadstorage.pro diff --git a/src/corelib/thread/qthreadstorage.cpp b/src/corelib/thread/qthreadstorage.cpp index 88d73cc..2fc04f5 100644 --- a/src/corelib/thread/qthreadstorage.cpp +++ b/src/corelib/thread/qthreadstorage.cpp @@ -79,6 +79,21 @@ QThreadStorageData::QThreadStorageData(void (*func)(void *)) { QMutexLocker locker(mutex()); DestructorMap *destr = destructors(); + if (!destr) { + /* + the destructors vector has already been destroyed, yet a new + QThreadStorage is being allocated. this can only happen during global + destruction, at which point we assume that there is only one thread. + in order to keep QThreadStorage working, we need somewhere to store + the data, best place we have in this situation is at the tail of the + current thread's tls vector. the destructor is ignored, since we have + no where to store it, and no way to actually call it. + */ + QThreadData *data = QThreadData::current(); + id = data->tls.count(); + DEBUG_MSG("QThreadStorageData: Allocated id %d, destructor %p cannot be stored", id, func); + return; + } for (id = 0; id < destr->count(); id++) { if (destr->at(id) == 0) break; @@ -139,13 +154,15 @@ void **QThreadStorageData::set(void *p) data->thread); QMutexLocker locker(mutex()); - void (*destructor)(void *) = destructors()->value(id); + DestructorMap *destr = destructors(); + void (*destructor)(void *) = destr ? destr->value(id) : 0; locker.unlock(); void *q = value; value = 0; - destructor(q); + if (destructor) + destructor(q); } // store new data diff --git a/tests/auto/qthreadstorage/crashOnExit.cpp b/tests/auto/qthreadstorage/crashOnExit.cpp new file mode 100644 index 0000000..96515a0 --- /dev/null +++ b/tests/auto/qthreadstorage/crashOnExit.cpp @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +class Class +{ +public: + ~Class() + { + // trigger creation of a new QThreadStorage, after the previous QThreadStorage from main() was destructed + static QThreadStorage threadstorage; + threadstorage.setLocalData(new int); + threadstorage.setLocalData(new int); + } +}; + +int main() +{ + // instantiate the class that will use QThreadStorage from its destructor, it's destructor will be run last + static Class instance; + // instantiate QThreadStorage, it's destructor (and the global destructors for QThreadStorages internals) will run first + static QThreadStorage threadstorage; + threadstorage.setLocalData(new int); + threadstorage.setLocalData(new int); +} diff --git a/tests/auto/qthreadstorage/crashOnExit.pro b/tests/auto/qthreadstorage/crashOnExit.pro new file mode 100644 index 0000000..918ef39 --- /dev/null +++ b/tests/auto/qthreadstorage/crashOnExit.pro @@ -0,0 +1,4 @@ +SOURCES += crashOnExit.cpp +QT = core +CONFIG-=app_bundle +CONFIG+=console diff --git a/tests/auto/qthreadstorage/qthreadstorage.pro b/tests/auto/qthreadstorage/qthreadstorage.pro index 3071098..a06f89c 100644 --- a/tests/auto/qthreadstorage/qthreadstorage.pro +++ b/tests/auto/qthreadstorage/qthreadstorage.pro @@ -1,4 +1,4 @@ -load(qttest_p4) -SOURCES += tst_qthreadstorage.cpp -QT = core -symbian:LIBS += -llibpthread +TEMPLATE = subdirs +SUBDIRS = \ + tst_qthreadstorage.pro \ + crashOnExit.pro diff --git a/tests/auto/qthreadstorage/tst_qthreadstorage.cpp b/tests/auto/qthreadstorage/tst_qthreadstorage.cpp index d8b404f..097d729 100644 --- a/tests/auto/qthreadstorage/tst_qthreadstorage.cpp +++ b/tests/auto/qthreadstorage/tst_qthreadstorage.cpp @@ -76,6 +76,7 @@ private slots: void autoDelete(); void adoptedThreads(); void ensureCleanupOrder(); + void QTBUG13877_crashOnExit(); }; class Pointer @@ -293,5 +294,13 @@ void tst_QThreadStorage::ensureCleanupOrder() QVERIFY(First::order < Second::order); } +void tst_QThreadStorage::QTBUG13877_crashOnExit() +{ + QProcess process; + process.start("./crashOnExit"); + QVERIFY(process.waitForFinished()); + QVERIFY(process.exitStatus() != QProcess::CrashExit); +} + QTEST_MAIN(tst_QThreadStorage) #include "tst_qthreadstorage.moc" diff --git a/tests/auto/qthreadstorage/tst_qthreadstorage.pro b/tests/auto/qthreadstorage/tst_qthreadstorage.pro new file mode 100644 index 0000000..3071098 --- /dev/null +++ b/tests/auto/qthreadstorage/tst_qthreadstorage.pro @@ -0,0 +1,4 @@ +load(qttest_p4) +SOURCES += tst_qthreadstorage.cpp +QT = core +symbian:LIBS += -llibpthread -- cgit v0.12 From 83b4cad278e2c3b0ca16affc76a82ddce9d6149a Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 6 Oct 2010 13:46:15 +0200 Subject: tst_qtcpserver: Another attempt to reproduce QTBUG-14268 The test (un)fortunately passes :-) Task-number: QTBUG-14268 --- tests/auto/qtcpserver/tst_qtcpserver.cpp | 53 ++++++++++++++++++++++++++++++++ tests/auto/qtcpsocket/tst_qtcpsocket.cpp | 15 ++++----- 2 files changed, 61 insertions(+), 7 deletions(-) diff --git a/tests/auto/qtcpserver/tst_qtcpserver.cpp b/tests/auto/qtcpserver/tst_qtcpserver.cpp index b2151b9..ab2a32d 100644 --- a/tests/auto/qtcpserver/tst_qtcpserver.cpp +++ b/tests/auto/qtcpserver/tst_qtcpserver.cpp @@ -105,6 +105,8 @@ private slots: void invalidProxy(); void proxyFactory_data(); void proxyFactory(); + + void qtbug14268_peek(); }; // Testing get/set functions @@ -662,5 +664,56 @@ void tst_QTcpServer::proxyFactory() QTEST(int(server.serverError()), "expectedError"); } +class Qtbug14268Helper : public QObject +{ + Q_OBJECT +public: + QByteArray lastDataPeeked; +public slots: + void newConnection() { + QTcpServer* server=static_cast(sender()); + QTcpSocket* s=server->nextPendingConnection(); + connect(s,SIGNAL(readyRead()),this,SLOT(onServerReadyRead())); + } + void onServerReadyRead() { + QTcpSocket* clientSocket=static_cast(sender()); + lastDataPeeked = clientSocket->peek(128*1024).toHex(); + QTestEventLoop::instance().exitLoop(); + } +}; + +// there is a similar test inside tst_qtcpsocket that uses the waitFor* functions instead +void tst_QTcpServer::qtbug14268_peek() +{ + QFETCH_GLOBAL(bool, setProxy); + if (setProxy) + return; + + QTcpServer server; + server.listen(); + + Qtbug14268Helper helper; + QObject::connect(&server, SIGNAL(newConnection()), &helper, SLOT(newConnection())); + + QTcpSocket client; + client.connectToHost(QHostAddress::LocalHost, server.serverPort()); + QVERIFY(client.waitForConnected(2000)); + + client.write("abc\n"); + QTestEventLoop::instance().enterLoop(5); + QVERIFY(!QTestEventLoop::instance().timeout()); + QVERIFY(helper.lastDataPeeked == QByteArray("6162630a")); + + client.write("def\n"); + QTestEventLoop::instance().enterLoop(5); + QVERIFY(!QTestEventLoop::instance().timeout()); + QVERIFY(helper.lastDataPeeked == QByteArray("6162630a6465660a")); + + client.write("ghi\n"); + QTestEventLoop::instance().enterLoop(5); + QVERIFY(!QTestEventLoop::instance().timeout()); + QVERIFY(helper.lastDataPeeked == QByteArray("6162630a6465660a6768690a")); +} + QTEST_MAIN(tst_QTcpServer) #include "tst_qtcpserver.moc" diff --git a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp index 5b77006..2dbe5b7 100644 --- a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp @@ -2505,6 +2505,7 @@ void tst_QTcpSocket::proxyFactory() delete socket; } +// there is a similar test inside tst_qtcpserver that uses the event loop instead void tst_QTcpSocket::qtbug14268_peek() { QFETCH_GLOBAL(bool, setProxy); @@ -2519,22 +2520,22 @@ void tst_QTcpSocket::qtbug14268_peek() QVERIFY(incoming->state() == QTcpSocket::ConnectedState); QVERIFY(outgoing->state() == QTcpSocket::ConnectedState); - outgoing->write("abc"); + outgoing->write("abc\n"); QVERIFY(outgoing->waitForBytesWritten(2000)); QVERIFY(incoming->waitForReadyRead(2000)); - QVERIFY(incoming->peek(128*1024) == QByteArray("abc")); + QVERIFY(incoming->peek(128*1024) == QByteArray("abc\n")); - outgoing->write("def"); + outgoing->write("def\n"); QVERIFY(outgoing->waitForBytesWritten(2000)); QVERIFY(incoming->waitForReadyRead(2000)); - QVERIFY(incoming->peek(128*1024) == QByteArray("abcdef")); + QVERIFY(incoming->peek(128*1024) == QByteArray("abc\ndef\n")); - outgoing->write("ghi"); + outgoing->write("ghi\n"); QVERIFY(outgoing->waitForBytesWritten(2000)); QVERIFY(incoming->waitForReadyRead(2000)); - QVERIFY(incoming->peek(128*1024) == QByteArray("abcdefghi")); + QVERIFY(incoming->peek(128*1024) == QByteArray("abc\ndef\nghi\n")); - QVERIFY(incoming->read(128*1024) == QByteArray("abcdefghi")); + QVERIFY(incoming->read(128*1024) == QByteArray("abc\ndef\nghi\n")); } -- cgit v0.12 From 9d574d9c6bed5b4528415402a9f2f68ab5de8009 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 7 Oct 2010 08:30:18 +1000 Subject: Update import statement. --- tests/auto/declarative/qdeclarativepathview/data/pathUpdate.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/declarative/qdeclarativepathview/data/pathUpdate.qml b/tests/auto/declarative/qdeclarativepathview/data/pathUpdate.qml index 0c99e7f..0c2ac0c 100644 --- a/tests/auto/declarative/qdeclarativepathview/data/pathUpdate.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/pathUpdate.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 400 -- cgit v0.12 From d97692f1eb18cb85830493be2e8d22fc00a85edf Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Thu, 7 Oct 2010 09:39:28 +1000 Subject: Rename toolbar button. Task-number: QT-3637 --- demos/declarative/flickr/flickr.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/declarative/flickr/flickr.qml b/demos/declarative/flickr/flickr.qml index 1533c04..740ee35 100644 --- a/demos/declarative/flickr/flickr.qml +++ b/demos/declarative/flickr/flickr.qml @@ -109,7 +109,7 @@ Item { states: State { name: "DetailedView" PropertyChanges { target: views; x: -parent.width } - PropertyChanges { target: toolBar; button1Label: "More..." } + PropertyChanges { target: toolBar; button1Label: "View..." } PropertyChanges { target: toolBar onButton1Clicked: if (imageDetails.state=='') imageDetails.state='Back'; else imageDetails.state='' -- cgit v0.12 From 0ed462973acc683882ac30ae6959340564f305a3 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 7 Oct 2010 10:37:50 +1000 Subject: Fix setting PathView offset when all visible items are removed. If we remove all items then we don't have a valid firstIndex with which to anchor item positions, so just use offset. Task-number: QTBUG-14199 Reviewed-by: Michael Brasser --- src/declarative/graphicsitems/qdeclarativepathview.cpp | 2 ++ .../qdeclarativepathview/tst_qdeclarativepathview.cpp | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index 3ae8788..31943b2 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -1331,6 +1331,8 @@ void QDeclarativePathView::refill() if (idx >= d->modelCount) idx = 0; } + if (!d->items.count()) + d->firstIndex = -1; if (d->modelCount) { // add items to beginning and end diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp index 3a2a577..a2a5363 100644 --- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp +++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -351,6 +351,10 @@ void tst_QDeclarativePathView::dataModel() model.addItem("yellow", "7"); model.addItem("thistle", "8"); model.addItem("cyan", "9"); + model.addItem("peachpuff", "10"); + model.addItem("powderblue", "11"); + model.addItem("gold", "12"); + model.addItem("sandybrown", "13"); ctxt->setContextProperty("testData", &model); @@ -371,7 +375,7 @@ void tst_QDeclarativePathView::dataModel() model.insertItem(4, "orange", "10"); QTest::qWait(100); - QTRY_COMPARE(findItems(pathview, "wrapper").count(), 10); + QTRY_COMPARE(findItems(pathview, "wrapper").count(), 14); QVERIFY(pathview->currentIndex() == 0); @@ -420,6 +424,11 @@ void tst_QDeclarativePathView::dataModel() QVERIFY(item->property("onPath").toBool()); } + // QTBUG-14199 + pathview->setOffset(7); + pathview->setOffset(0); + QCOMPARE(findItems(pathview, "wrapper").count(), 5); + delete canvas; } -- cgit v0.12 From 591695490b9ed7f1cd31e03e067a5962d6aadcee Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 7 Oct 2010 10:50:54 +1000 Subject: Doc fix. --- src/declarative/graphicsitems/qdeclarativerepeater.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativerepeater.cpp b/src/declarative/graphicsitems/qdeclarativerepeater.cpp index 00f2848..cb64212 100644 --- a/src/declarative/graphicsitems/qdeclarativerepeater.cpp +++ b/src/declarative/graphicsitems/qdeclarativerepeater.cpp @@ -134,13 +134,13 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate() create items as they are required. Also, note that Repeater is \l {Item}-based, and can only repeat \l {Item}-derived objects. - For example, it cannot be used to repeat QObjects: + For example, it cannot be used to repeat QtObjects: \badcode Item { - //XXX does not work! Can't repeat QObject as it doesn't derive from Item. + //XXX does not work! Can't repeat QtObject as it doesn't derive from Item. Repeater { model: 10 - QObject {} + QtObject {} } } \endcode -- cgit v0.12 From eae8c143428128a4bea4c06cff93b38189da267d Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Thu, 7 Oct 2010 08:49:30 +0200 Subject: Fix failure on Windows after commit ccd3f66 By default the builds are placed in either a release\ or debug\ directory, so we need to start the correct one on Windows. Reviewed-by: trustme --- tests/auto/qthreadstorage/tst_qthreadstorage.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/auto/qthreadstorage/tst_qthreadstorage.cpp b/tests/auto/qthreadstorage/tst_qthreadstorage.cpp index 097d729..ed86165 100644 --- a/tests/auto/qthreadstorage/tst_qthreadstorage.cpp +++ b/tests/auto/qthreadstorage/tst_qthreadstorage.cpp @@ -297,7 +297,15 @@ void tst_QThreadStorage::ensureCleanupOrder() void tst_QThreadStorage::QTBUG13877_crashOnExit() { QProcess process; +#ifdef Q_OS_WIN +# ifdef QT_NO_DEBUG + process.start("release/crashOnExit"); +# else + process.start("debug/crashOnExit"); +# endif +#else process.start("./crashOnExit"); +#endif QVERIFY(process.waitForFinished()); QVERIFY(process.exitStatus() != QProcess::CrashExit); } -- cgit v0.12 From 45134e5dda238e42b89a407464911ac05f214cac Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Fri, 24 Sep 2010 16:47:41 +0200 Subject: Make sure the QS60PaintEngine can draw other classes of pixmap data The QS60PaintEngine should not assume that the pixmap is always of type 'Raster'. It should check the classId and if it is not 'Raster' it should forward the call to QRasterPaintEngine which already handles this scenario by converting the pixmap to a QImage and drawing that instead. Reviewed-by: Jani Hautakangas --- src/gui/painting/qpaintengine_s60.cpp | 63 +++++++++++++++++++++++------------ 1 file changed, 41 insertions(+), 22 deletions(-) diff --git a/src/gui/painting/qpaintengine_s60.cpp b/src/gui/painting/qpaintengine_s60.cpp index 068ca0c..d7fc0af 100644 --- a/src/gui/painting/qpaintengine_s60.cpp +++ b/src/gui/painting/qpaintengine_s60.cpp @@ -59,44 +59,63 @@ bool QS60PaintEngine::begin(QPaintDevice *device) { Q_D(QS60PaintEngine); - pixmapData->beginDataAccess(); - bool ret = QRasterPaintEngine::begin(device); - // Make sure QPaintEngine::paintDevice() returns the proper device. - // QRasterPaintEngine changes pdev to QImage in case of RasterClass QPixmapData - // which is incorrect in Symbian. - d->pdev = device; - return ret; + if (pixmapData->classId() == QPixmapData::RasterClass) { + pixmapData->beginDataAccess(); + bool ret = QRasterPaintEngine::begin(device); + // Make sure QPaintEngine::paintDevice() returns the proper device. + // QRasterPaintEngine changes pdev to QImage in case of RasterClass QPixmapData + // which is incorrect in Symbian. + d->pdev = device; + return ret; + } + + return QRasterPaintEngine::begin(device); } bool QS60PaintEngine::end() { - bool ret = QRasterPaintEngine::end(); - pixmapData->endDataAccess(); - return ret; + if (pixmapData->classId() == QPixmapData::RasterClass) { + bool ret = QRasterPaintEngine::end(); + pixmapData->endDataAccess(); + return ret; + } + return QRasterPaintEngine::end(); } void QS60PaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm) { - QS60PixmapData *srcData = static_cast(pm.pixmapData()); - srcData->beginDataAccess(); - QRasterPaintEngine::drawPixmap(p, pm); - srcData->endDataAccess(); + if (pm.pixmapData()->classId() == QPixmapData::RasterClass) { + QS60PixmapData *srcData = static_cast(pm.pixmapData()); + srcData->beginDataAccess(); + QRasterPaintEngine::drawPixmap(p, pm); + srcData->endDataAccess(); + } else { + QRasterPaintEngine::drawPixmap(p, pm); + } } void QS60PaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) { - QS60PixmapData *srcData = static_cast(pm.pixmapData()); - srcData->beginDataAccess(); - QRasterPaintEngine::drawPixmap(r, pm, sr); - srcData->endDataAccess(); + if (pm.pixmapData()->classId() == QPixmapData::RasterClass) { + QS60PixmapData *srcData = static_cast(pm.pixmapData()); + srcData->beginDataAccess(); + QRasterPaintEngine::drawPixmap(r, pm, sr); + srcData->endDataAccess(); + } else { + QRasterPaintEngine::drawPixmap(r, pm, sr); + } } void QS60PaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr) { - QS60PixmapData *srcData = static_cast(pm.pixmapData()); - srcData->beginDataAccess(); - QRasterPaintEngine::drawTiledPixmap(r, pm, sr); - srcData->endDataAccess(); + if (pm.pixmapData()->classId() == QPixmapData::RasterClass) { + QS60PixmapData *srcData = static_cast(pm.pixmapData()); + srcData->beginDataAccess(); + QRasterPaintEngine::drawTiledPixmap(r, pm, sr); + srcData->endDataAccess(); + } else { + QRasterPaintEngine::drawTiledPixmap(r, pm, sr); + } } void QS60PaintEngine::prepare(QImage *image) -- cgit v0.12 From 83567e2dd93ad46cff2b3b611e298148e7d60f62 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Mon, 27 Sep 2010 10:54:38 +0200 Subject: Minor OpenVG optimization when setting the EGL surface attribute. Calling eglGetError() is expensive so we should avoid doing it unless we know there actually is an error. The function returns EGL_FALSE upon error so we can test for that instead of using eglGetError(). Reviewed-by: Jani Hautakangas --- src/openvg/qwindowsurface_vgegl.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/openvg/qwindowsurface_vgegl.cpp b/src/openvg/qwindowsurface_vgegl.cpp index e3f52f4e..37e5f40 100644 --- a/src/openvg/qwindowsurface_vgegl.cpp +++ b/src/openvg/qwindowsurface_vgegl.cpp @@ -709,10 +709,9 @@ QEglContext *QVGEGLWindowSurfaceDirect::ensureContext(QWidget *widget) #if !defined(QVG_NO_PRESERVED_SWAP) // Try to force the surface back buffer to preserve its contents. if (needToSwap) { - eglGetError(); // Clear error state first. - eglSurfaceAttrib(QEgl::display(), windowSurface, + bool succeeded = eglSurfaceAttrib(QEgl::display(), windowSurface, EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED); - if (eglGetError() != EGL_SUCCESS) { + if (!succeeded && eglGetError() != EGL_SUCCESS) { qWarning("QVG: could not enable preserved swap"); } } -- cgit v0.12 From 803bdd187ec1673541b7ef8dc69652c10d0e6f88 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 7 Oct 2010 17:42:08 +1000 Subject: Connect property alias change signals on use Task-number: QTBUG-14089 --- src/declarative/qml/qdeclarativeboundsignal.cpp | 4 +- src/declarative/qml/qdeclarativecompiler.cpp | 6 ++- src/declarative/qml/qdeclarativenotifier.cpp | 16 +++++++ src/declarative/qml/qdeclarativenotifier_p.h | 17 +------ src/declarative/qml/qdeclarativeproperty.cpp | 56 +++++++++++++++++++++- src/declarative/qml/qdeclarativeproperty_p.h | 3 ++ src/declarative/qml/qdeclarativepropertycache.cpp | 19 +++++++- src/declarative/qml/qdeclarativepropertycache_p.h | 9 ++-- .../qml/qdeclarativeproxymetaobject.cpp | 4 +- src/declarative/qml/qdeclarativevme.cpp | 2 +- src/declarative/qml/qdeclarativevmemetaobject.cpp | 48 ++++++++++++++----- src/declarative/qml/qdeclarativevmemetaobject_p.h | 2 + src/declarative/qml/qdeclarativewatcher.cpp | 3 +- .../tst_qdeclarativelanguage.cpp | 1 - 14 files changed, 147 insertions(+), 43 deletions(-) diff --git a/src/declarative/qml/qdeclarativeboundsignal.cpp b/src/declarative/qml/qdeclarativeboundsignal.cpp index 8769122..6af3e05 100644 --- a/src/declarative/qml/qdeclarativeboundsignal.cpp +++ b/src/declarative/qml/qdeclarativeboundsignal.cpp @@ -103,7 +103,7 @@ QDeclarativeBoundSignal::QDeclarativeBoundSignal(QObject *scope, const QMetaMeth if (evaluateIdx == -1) evaluateIdx = metaObject()->methodCount(); QDeclarative_setParent_noEvent(this, parent); - QMetaObject::connect(scope, m_signal.methodIndex(), this, evaluateIdx); + QDeclarativePropertyPrivate::connect(scope, m_signal.methodIndex(), this, evaluateIdx); } QDeclarativeBoundSignal::QDeclarativeBoundSignal(QDeclarativeContext *ctxt, const QString &val, @@ -117,7 +117,7 @@ QDeclarativeBoundSignal::QDeclarativeBoundSignal(QDeclarativeContext *ctxt, cons if (evaluateIdx == -1) evaluateIdx = metaObject()->methodCount(); QDeclarative_setParent_noEvent(this, parent); - QMetaObject::connect(scope, m_signal.methodIndex(), this, evaluateIdx); + QDeclarativePropertyPrivate::connect(scope, m_signal.methodIndex(), this, evaluateIdx); m_expression = new QDeclarativeExpression(ctxt, scope, val); } diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 90d38b3..dc28e22 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -945,7 +945,8 @@ void QDeclarativeCompiler::genObject(QDeclarativeParser::Object *obj) propertyCache = enginePrivate->cache(obj->metaObject()->superClass())->copy(); propertyCache->append(engine, obj->metaObject(), QDeclarativePropertyCache::Data::NoFlags, - QDeclarativePropertyCache::Data::IsVMEFunction); + QDeclarativePropertyCache::Data::IsVMEFunction, + QDeclarativePropertyCache::Data::IsVMESignal); if (obj == unitRoot) { propertyCache->addref(); @@ -1098,7 +1099,8 @@ void QDeclarativeCompiler::genObjectBody(QDeclarativeParser::Object *obj) QDeclarativePropertyCache *propertyCache = enginePrivate->cache(prop->value->metaObject()->superClass())->copy(); propertyCache->append(engine, prop->value->metaObject(), QDeclarativePropertyCache::Data::NoFlags, - QDeclarativePropertyCache::Data::IsVMEFunction); + QDeclarativePropertyCache::Data::IsVMEFunction, + QDeclarativePropertyCache::Data::IsVMESignal); output->propertyCaches << propertyCache; output->bytecode << meta; diff --git a/src/declarative/qml/qdeclarativenotifier.cpp b/src/declarative/qml/qdeclarativenotifier.cpp index 8c946f8..2e3f756 100644 --- a/src/declarative/qml/qdeclarativenotifier.cpp +++ b/src/declarative/qml/qdeclarativenotifier.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "private/qdeclarativenotifier_p.h" +#include "private/qdeclarativeproperty_p.h" QT_BEGIN_NAMESPACE @@ -66,6 +67,21 @@ void QDeclarativeNotifier::emitNotify(QDeclarativeNotifierEndpoint *endpoint) if (oldDisconnected) *oldDisconnected = endpoint; } +void QDeclarativeNotifierEndpoint::connect(QObject *source, int sourceSignal) +{ + Signal *s = toSignal(); + + if (s->source == source && s->sourceSignal == sourceSignal) + return; + + disconnect(); + + QDeclarativePropertyPrivate::connect(source, sourceSignal, target, targetMethod); + + s->source = source; + s->sourceSignal = sourceSignal; +} + void QDeclarativeNotifierEndpoint::copyAndClear(QDeclarativeNotifierEndpoint &other) { other.disconnect(); diff --git a/src/declarative/qml/qdeclarativenotifier_p.h b/src/declarative/qml/qdeclarativenotifier_p.h index 0781caf..ad04ba8 100644 --- a/src/declarative/qml/qdeclarativenotifier_p.h +++ b/src/declarative/qml/qdeclarativenotifier_p.h @@ -75,7 +75,7 @@ public: inline bool isConnected(QObject *source, int sourceSignal); inline bool isConnected(QDeclarativeNotifier *); - inline void connect(QObject *source, int sourceSignal); + void connect(QObject *source, int sourceSignal); inline void connect(QDeclarativeNotifier *); inline void disconnect(); @@ -175,21 +175,6 @@ bool QDeclarativeNotifierEndpoint::isConnected(QDeclarativeNotifier *notifier) return NotifierType == type && asNotifier()->notifier == notifier; } -void QDeclarativeNotifierEndpoint::connect(QObject *source, int sourceSignal) -{ - Signal *s = toSignal(); - - if (s->source == source && s->sourceSignal == sourceSignal) - return; - - disconnect(); - - QMetaObject::connect(source, sourceSignal, target, targetMethod); - - s->source = source; - s->sourceSignal = sourceSignal; -} - void QDeclarativeNotifierEndpoint::connect(QDeclarativeNotifier *notifier) { Notifier *n = toNotifier(); diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp index bc20bff..b5fb619 100644 --- a/src/declarative/qml/qdeclarativeproperty.cpp +++ b/src/declarative/qml/qdeclarativeproperty.cpp @@ -53,6 +53,7 @@ #include "private/qdeclarativestringconverters_p.h" #include "private/qdeclarativelist_p.h" #include "private/qdeclarativecompiler_p.h" +#include "private/qdeclarativevmemetaobject_p.h" #include #include @@ -1212,7 +1213,7 @@ bool QDeclarativeProperty::connectNotifySignal(QObject *dest, int method) const QMetaProperty prop = d->object->metaObject()->property(d->core.coreIndex); if (prop.hasNotifySignal()) { - return QMetaObject::connect(d->object, prop.notifySignalIndex(), dest, method, Qt::DirectConnection); + return QDeclarativePropertyPrivate::connect(d->object, prop.notifySignalIndex(), dest, method, Qt::DirectConnection); } else { return false; } @@ -1383,4 +1384,57 @@ QMetaMethod QDeclarativePropertyPrivate::findSignalByName(const QMetaObject *mo, return QMetaMethod(); } +static inline int QMetaObject_methods(const QMetaObject *metaObject) +{ + struct Private + { + int revision; + int className; + int classInfoCount, classInfoData; + int methodCount, methodData; + }; + + return reinterpret_cast(metaObject->d.data)->methodCount; +} + +static inline void flush_vme_signal(const QObject *object, int index) +{ + QDeclarativeData *data = static_cast(QObjectPrivate::get(const_cast(object))->declarativeData); + if (data && data->propertyCache) { + QDeclarativePropertyCache::Data *property = data->propertyCache->method(index); + + if (property && property->flags & QDeclarativePropertyCache::Data::IsVMESignal) { + const QMetaObject *metaObject = object->metaObject(); + int methodOffset = metaObject->methodOffset(); + + while (methodOffset > index) { + methodOffset -= QMetaObject_methods(metaObject); + metaObject = metaObject->d.superdata; + } + + QDeclarativeVMEMetaObject *vme = + static_cast(const_cast(metaObject)); + + vme->connectAliasSignal(index); + } + } +} + +/*! +Connect \a sender \a signal_index to \a receiver \a method_index with the specified +\a type and \a types. This behaves identically to QMetaObject::connect() except that +it connects any lazy "proxy" signal connections set up by QML. + +It is possible that this logic should be moved to QMetaObject::connect(). +*/ +bool QDeclarativePropertyPrivate::connect(const QObject *sender, int signal_index, + const QObject *receiver, int method_index, + int type, int *types) +{ + flush_vme_signal(sender, signal_index); + flush_vme_signal(receiver, method_index); + + return QMetaObject::connect(sender, signal_index, receiver, method_index, type, types); +} + QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativeproperty_p.h b/src/declarative/qml/qdeclarativeproperty_p.h index 8522561..a8438c8 100644 --- a/src/declarative/qml/qdeclarativeproperty_p.h +++ b/src/declarative/qml/qdeclarativeproperty_p.h @@ -133,6 +133,9 @@ public: static int valueTypeCoreIndex(const QDeclarativeProperty &that); static int bindingIndex(const QDeclarativeProperty &that); static QMetaMethod findSignalByName(const QMetaObject *mo, const QByteArray &); + static bool connect(const QObject *sender, int signal_index, + const QObject *receiver, int method_index, + int type = 0, int *types = 0); }; Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativePropertyPrivate::WriteFlags) diff --git a/src/declarative/qml/qdeclarativepropertycache.cpp b/src/declarative/qml/qdeclarativepropertycache.cpp index 08503c2..9e1ceb8 100644 --- a/src/declarative/qml/qdeclarativepropertycache.cpp +++ b/src/declarative/qml/qdeclarativepropertycache.cpp @@ -94,6 +94,8 @@ void QDeclarativePropertyCache::Data::load(const QMetaMethod &m) { coreIndex = m.methodIndex(); flags |= Data::IsFunction; + if (m.methodType() == QMetaMethod::Signal) + flags |= Data::IsSignal; propType = QVariant::Invalid; const char *returnType = m.typeName(); @@ -215,7 +217,7 @@ QDeclarativePropertyCache *QDeclarativePropertyCache::copy() const } void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaObject *metaObject, - Data::Flag propertyFlags, Data::Flag methodFlags) + Data::Flag propertyFlags, Data::Flag methodFlags, Data::Flag signalFlags) { QDeclarativeEnginePrivate *enginePriv = QDeclarativeEnginePrivate::get(engine); @@ -251,6 +253,8 @@ void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaOb int methodCount = metaObject->methodCount(); int methodOffset = qMax(2, metaObject->methodOffset()); // 2 to block the destroyed signal + + methodIndexCache.resize(methodCount); for (int ii = methodOffset; ii < methodCount; ++ii) { QMetaMethod m = metaObject->method(ii); if (m.access() == QMetaMethod::Private) @@ -272,6 +276,10 @@ void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaOb data->load(m); if (m.methodType() == QMetaMethod::Slot || m.methodType() == QMetaMethod::Method) data->flags |= methodFlags; + else if (m.methodType() == QMetaMethod::Signal) + data->flags |= signalFlags; + + methodIndexCache[ii] = data; stringCache.insert(methodName, data); identifierCache.insert(data->identifier.identifier, data); @@ -350,6 +358,15 @@ QDeclarativePropertyCache::property(int index) const } QDeclarativePropertyCache::Data * +QDeclarativePropertyCache::method(int index) const +{ + if (index < 0 || index >= methodIndexCache.count()) + return 0; + + return methodIndexCache.at(index); +} + +QDeclarativePropertyCache::Data * QDeclarativePropertyCache::property(const QString &str) const { return stringCache.value(str); diff --git a/src/declarative/qml/qdeclarativepropertycache_p.h b/src/declarative/qml/qdeclarativepropertycache_p.h index 72cfeba..79b126d 100644 --- a/src/declarative/qml/qdeclarativepropertycache_p.h +++ b/src/declarative/qml/qdeclarativepropertycache_p.h @@ -94,8 +94,9 @@ public: // Apply only to IsFunctions IsVMEFunction = 0x00000400, - HasArguments = 0x00000800 - + HasArguments = 0x00000800, + IsSignal = 0x00001000, + IsVMESignal = 0x00002000, }; Q_DECLARE_FLAGS(Flags, Flag) @@ -125,7 +126,7 @@ public: QDeclarativePropertyCache *copy() const; void append(QDeclarativeEngine *, const QMetaObject *, Data::Flag propertyFlags = Data::NoFlags, - Data::Flag methodFlags = Data::NoFlags); + Data::Flag methodFlags = Data::NoFlags, Data::Flag signalFlags = Data::NoFlags); static QDeclarativePropertyCache *create(QDeclarativeEngine *, const QMetaObject *); static Data create(const QMetaObject *, const QString &); @@ -133,6 +134,7 @@ public: inline Data *property(const QScriptDeclarativeClass::Identifier &id) const; Data *property(const QString &) const; Data *property(int) const; + Data *method(int) const; QStringList propertyNames() const; inline QDeclarativeEngine *qmlEngine() const; @@ -152,6 +154,7 @@ private: QDeclarativeEngine *engine; IndexCache indexCache; + IndexCache methodIndexCache; StringCache stringCache; IdentifierCache identifierCache; }; diff --git a/src/declarative/qml/qdeclarativeproxymetaobject.cpp b/src/declarative/qml/qdeclarativeproxymetaobject.cpp index c2dce0a..ceb6977 100644 --- a/src/declarative/qml/qdeclarativeproxymetaobject.cpp +++ b/src/declarative/qml/qdeclarativeproxymetaobject.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "private/qdeclarativeproxymetaobject_p.h" +#include "private/qdeclarativeproperty_p.h" QT_BEGIN_NAMESPACE @@ -95,8 +96,7 @@ int QDeclarativeProxyMetaObject::metaCall(QMetaObject::Call c, int id, void **a) QMetaMethod method = metaObject->method(jj + methodOffset); if (method.methodType() == QMetaMethod::Signal) - QMetaObject::connect(proxy, methodOffset + jj, - object, localOffset + jj); + QDeclarativePropertyPrivate::connect(proxy, methodOffset + jj, object, localOffset + jj); } } diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp index 4e41c22..360186c 100644 --- a/src/declarative/qml/qdeclarativevme.cpp +++ b/src/declarative/qml/qdeclarativevme.cpp @@ -608,7 +608,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack &stack, if (!QMetaObject::checkConnectArgs(prop.method().signature(), method.signature())) VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot connect mismatched signal/slot %1 %vs. %2").arg(QString::fromLatin1(method.signature())).arg(QString::fromLatin1(prop.method().signature()))); - QMetaObject::connect(target, prop.index(), assign, method.methodIndex()); + QDeclarativePropertyPrivate::connect(target, prop.index(), assign, method.methodIndex()); } else { VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot assign an object to signal property %1").arg(QString::fromUtf8(pr))); diff --git a/src/declarative/qml/qdeclarativevmemetaobject.cpp b/src/declarative/qml/qdeclarativevmemetaobject.cpp index 3e32006..37f08fc 100644 --- a/src/declarative/qml/qdeclarativevmemetaobject.cpp +++ b/src/declarative/qml/qdeclarativevmemetaobject.cpp @@ -584,19 +584,7 @@ int QDeclarativeVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a) if (!target) return -1; - if (c == QMetaObject::ReadProperty && !aConnected.testBit(id)) { - int sigIdx = methodOffset + id + metaData->propertyCount; - QMetaObject::connect(context, d->contextIdx + ctxtPriv->notifyIndex, object, sigIdx); - - if (d->propertyIdx != -1) { - QMetaProperty prop = - target->metaObject()->property(d->propertyIdx); - if (prop.hasNotifySignal()) - QMetaObject::connect(target, prop.notifySignalIndex(), - object, sigIdx); - } - aConnected.setBit(id); - } + connectAlias(id); if (d->propertyIdx == -1) { *reinterpret_cast(a[0]) = target; @@ -818,4 +806,38 @@ void QDeclarativeVMEMetaObject::setVMEProperty(int index, const QScriptValue &v) return writeVarProperty(index - propOffset, v); } +void QDeclarativeVMEMetaObject::connectAlias(int aliasId) +{ + if (!aConnected.testBit(aliasId)) { + aConnected.setBit(aliasId); + + QDeclarativeContext *context = ctxt->asQDeclarativeContext(); + QDeclarativeContextPrivate *ctxtPriv = QDeclarativeContextPrivate::get(context); + + QDeclarativeVMEMetaData::AliasData *d = metaData->aliasData() + aliasId; + + QObject *target = ctxtPriv->data->idValues[d->contextIdx].data(); + if (!target) + return; + + int sigIdx = methodOffset + aliasId + metaData->propertyCount; + QMetaObject::connect(context, d->contextIdx + ctxtPriv->notifyIndex, object, sigIdx); + + if (d->propertyIdx != -1) { + QMetaProperty prop = target->metaObject()->property(d->propertyIdx); + if (prop.hasNotifySignal()) + QDeclarativePropertyPrivate::connect(target, prop.notifySignalIndex(), object, sigIdx); + } + } +} + +void QDeclarativeVMEMetaObject::connectAliasSignal(int index) +{ + int aliasId = (index - methodOffset) - metaData->propertyCount; + if (aliasId < 0 || aliasId >= metaData->aliasCount) + return; + + connectAlias(aliasId); +} + QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativevmemetaobject_p.h b/src/declarative/qml/qdeclarativevmemetaobject_p.h index 20ca80b..4ccaa73 100644 --- a/src/declarative/qml/qdeclarativevmemetaobject_p.h +++ b/src/declarative/qml/qdeclarativevmemetaobject_p.h @@ -126,6 +126,7 @@ public: QScriptValue vmeProperty(int index); void setVMEProperty(int index, const QScriptValue &); + void connectAliasSignal(int index); protected: virtual int metaCall(QMetaObject::Call _c, int _id, void **_a); @@ -140,6 +141,7 @@ private: QDeclarativeVMEVariant *data; + void connectAlias(int aliasId); QBitArray aConnected; QBitArray aInterceptors; QHash > interceptors; diff --git a/src/declarative/qml/qdeclarativewatcher.cpp b/src/declarative/qml/qdeclarativewatcher.cpp index da1419f..b9d5ec8 100644 --- a/src/declarative/qml/qdeclarativewatcher.cpp +++ b/src/declarative/qml/qdeclarativewatcher.cpp @@ -46,6 +46,7 @@ #include "qdeclarative.h" #include +#include "private/qdeclarativeproperty_p.h" #include #include @@ -103,7 +104,7 @@ QDeclarativeWatchProxy::QDeclarativeWatchProxy(int id, refreshIdx = QDeclarativeWatchProxy::staticMetaObject.indexOfMethod("notifyValueChanged()"); if (prop.hasNotifySignal()) - QMetaObject::connect(m_object, prop.notifySignalIndex(), this, refreshIdx); + QDeclarativePropertyPrivate::connect(m_object, prop.notifySignalIndex(), this, refreshIdx); } void QDeclarativeWatchProxy::notifyValueChanged() diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index 3c82fc5..9a8c944 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -1825,7 +1825,6 @@ void tst_qdeclarativelanguage::aliasPropertyChangeSignals() QObject *o = component.create(); QVERIFY(o != 0); - QEXPECT_FAIL("", "QTBUG-14089", Abort); QCOMPARE(o->property("test").toBool(), true); delete o; -- cgit v0.12 From f9a8c4ec598a0070b9d2d861efe5ee69d5045a1f Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 7 Oct 2010 19:05:27 +1000 Subject: Support device orientation in harmattan Task-number: QTBUG-14137 Reviewed-by: Aaron Kennedy --- tools/qml/deviceorientation_harmattan.cpp | 161 ++++++++++++++++++++++++++++++ tools/qml/qml.pri | 5 + 2 files changed, 166 insertions(+) create mode 100644 tools/qml/deviceorientation_harmattan.cpp diff --git a/tools/qml/deviceorientation_harmattan.cpp b/tools/qml/deviceorientation_harmattan.cpp new file mode 100644 index 0000000..22f9f4c --- /dev/null +++ b/tools/qml/deviceorientation_harmattan.cpp @@ -0,0 +1,161 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "deviceorientation.h" +#include +#include + +#define ORIENTATION_SERVICE "com.nokia.SensorService" +#define ORIENTATION_PATH "/org/maemo/contextkit/Screen/TopEdge" +#define CONTEXT_INTERFACE "org.maemo.contextkit.Property" +#define CONTEXT_CHANGED "ValueChanged" +#define CONTEXT_SUBSCRIBE "Subscribe" +#define CONTEXT_UNSUBSCRIBE "Unsubscribe" +#define CONTEXT_GET "Get" + + +class HarmattanOrientation : public DeviceOrientation +{ + Q_OBJECT +public: + HarmattanOrientation() + : o(UnknownOrientation), sensorEnabled(false) + { + resumeListening(); + // connect to the orientation change signal + bool ok = QDBusConnection::systemBus().connect(ORIENTATION_SERVICE, ORIENTATION_PATH, + CONTEXT_INTERFACE, + CONTEXT_CHANGED, + this, + SLOT(deviceOrientationChanged(QList,quint64))); +// qDebug() << "connection OK" << ok; + QDBusMessage reply = QDBusConnection::systemBus().call( + QDBusMessage::createMethodCall(ORIENTATION_SERVICE, ORIENTATION_PATH, + CONTEXT_INTERFACE, CONTEXT_GET)); + if (reply.type() != QDBusMessage::ErrorMessage) { + QList args; + qvariant_cast(reply.arguments().at(0)) >> args; + deviceOrientationChanged(args, 0); + } + } + + ~HarmattanOrientation() + { + // unsubscribe from the orientation sensor + if (sensorEnabled) + QDBusConnection::systemBus().call( + QDBusMessage::createMethodCall(ORIENTATION_SERVICE, ORIENTATION_PATH, + CONTEXT_INTERFACE, CONTEXT_UNSUBSCRIBE)); + } + + inline Orientation orientation() const + { + return o; + } + + void setOrientation(Orientation) + { + } + + void pauseListening() { + if (sensorEnabled) { + // unsubscribe from the orientation sensor + QDBusConnection::systemBus().call( + QDBusMessage::createMethodCall(ORIENTATION_SERVICE, ORIENTATION_PATH, + CONTEXT_INTERFACE, CONTEXT_UNSUBSCRIBE)); + sensorEnabled = false; + } + } + + void resumeListening() { + if (!sensorEnabled) { + // subscribe to the orientation sensor + QDBusMessage reply = QDBusConnection::systemBus().call( + QDBusMessage::createMethodCall(ORIENTATION_SERVICE, ORIENTATION_PATH, + CONTEXT_INTERFACE, CONTEXT_SUBSCRIBE)); + + if (reply.type() == QDBusMessage::ErrorMessage) { + qWarning("Unable to retrieve device orientation: %s", qPrintable(reply.errorMessage())); + } else { + sensorEnabled = true; + } + } + } + +private Q_SLOTS: + void deviceOrientationChanged(QList args,quint64) + { + if (args.count() == 0) + return; + Orientation newOrientation = toOrientation(args.at(0).toString()); + if (newOrientation != o) { + o = newOrientation; + emit orientationChanged(); + } +// qDebug() << "orientation" << args.at(0).toString(); + } + +private: + static Orientation toOrientation(const QString &nativeOrientation) + { + if (nativeOrientation == "top") + return Landscape; + else if (nativeOrientation == "left") + return Portrait; + else if (nativeOrientation == "bottom") + return LandscapeInverted; + else if (nativeOrientation == "right") + return PortraitInverted; + return UnknownOrientation; + } + +private: + Orientation o; + bool sensorEnabled; +}; + +DeviceOrientation* DeviceOrientation::instance() +{ + static HarmattanOrientation *o = new HarmattanOrientation; + return o; +} + +#include "deviceorientation_harmattan.moc" diff --git a/tools/qml/qml.pri b/tools/qml/qml.pri index e5b2c7f..5db7678 100644 --- a/tools/qml/qml.pri +++ b/tools/qml/qml.pri @@ -29,6 +29,11 @@ symbian:!contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) { SOURCES += $$PWD/deviceorientation_maemo5.cpp FORMS = $$PWD/recopts_maemo5.ui \ $$PWD/proxysettings_maemo5.ui +} else:linux-g++-maemo { + QT += dbus + SOURCES += $$PWD/deviceorientation_harmattan.cpp + FORMS = $$PWD/recopts.ui \ + $$PWD/proxysettings.ui } else { SOURCES += $$PWD/deviceorientation.cpp FORMS = $$PWD/recopts.ui \ -- cgit v0.12 From 3fddf68f376fe06d0af3f390a94ed84cc1a3fa38 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 7 Oct 2010 12:36:30 +0200 Subject: Ensure that actions are still fired even if there is no visible window On Mac, if there is no visible window then actions can still be fired from the menubar as the menubar can still be accessed and used. This ensures that the actions are still triggered in this circumstance. Task-number: QTBUG-13941 Reviewed-by: Richard Moe Gustavsen --- src/gui/kernel/qcocoaapplicationdelegate_mac.mm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm index 7a9dc70..9b07d64 100644 --- a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm +++ b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm @@ -320,5 +320,10 @@ static void cleanupCocoaApplicationDelegate() [NSApp terminate:self]; } +- (void)qtDispatcherToQAction:(id)sender +{ + [[NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)] qtDispatcherToQAction:sender]; +} + @end #endif -- cgit v0.12 From d0f8bfe36e1375ec2628c6bf7fed213cb8d07f1a Mon Sep 17 00:00:00 2001 From: Adrian Constantin Date: Tue, 5 Oct 2010 21:31:27 +0300 Subject: Fix the icd auto config test after restructuring the icd plugin dependencies * Remove the auto config tests related to libicd-network-wlan-dev * Add test for the icd backend * Add test for connsettings See also f532d8fcd236be9933e4186a95561e1c264de277. Reviewed-by: Aaron McCarthy --- config.tests/unix/icd/icd.cpp | 8 +++++++- configure | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/config.tests/unix/icd/icd.cpp b/config.tests/unix/icd/icd.cpp index 19c171b..08ef115 100644 --- a/config.tests/unix/icd/icd.cpp +++ b/config.tests/unix/icd/icd.cpp @@ -39,9 +39,15 @@ ** ****************************************************************************/ -#include #include + #include +#include + +#include +#include + +#include int main(int, char **) { diff --git a/configure b/configure index aca3467..0152c8e 100755 --- a/configure +++ b/configure @@ -5485,8 +5485,8 @@ if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" ]; then # auto-detect icd support if [ "$CFG_GLIB" = "yes" -a "$CFG_ICD" != "no" ]; then if [ -n "$PKG_CONFIG" ]; then - QT_CFLAGS_CONNSETTINGS=`$PKG_CONFIG --cflags connsettings 2>/dev/null` - QT_LIBS_CONNSETTINGS=`$PKG_CONFIG --libs connsettings 2>/dev/null` + QT_CFLAGS_CONNSETTINGS=`$PKG_CONFIG --cflags connsettings icd2 2>/dev/null` + QT_LIBS_CONNSETTINGS=`$PKG_CONFIG --libs connsettings icd2 2>/dev/null` fi if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/icd "ICD" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_CONNSETTINGS $QT_LIBS_CONNSETTINGS; then [ "$CFG_ICD" = "auto" ] && CFG_ICD=yes -- cgit v0.12