summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoraavit <qt-info@nokia.com>2010-11-19 12:30:09 (GMT)
committeraavit <qt-info@nokia.com>2010-11-19 12:30:09 (GMT)
commit8034cab2cce55b43dcc1100d0b22f8c85eb733c2 (patch)
tree5a1637fa48ce23e12c6a51490f6a481fd1ca1a5a /src
parente614223831f2b3cc9051ae88586370a7d5b63db2 (diff)
parent1d152964adec62d03ce2f4a45ca40ddbd05819ae (diff)
downloadQt-8034cab2cce55b43dcc1100d0b22f8c85eb733c2.zip
Qt-8034cab2cce55b43dcc1100d0b22f8c85eb733c2.tar.gz
Qt-8034cab2cce55b43dcc1100d0b22f8c85eb733c2.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp2
-rw-r--r--src/corelib/animation/qabstractanimation.cpp146
-rw-r--r--src/corelib/animation/qabstractanimation.h31
-rw-r--r--src/corelib/animation/qabstractanimation_p.h52
-rw-r--r--src/corelib/concurrent/qtconcurrentrunbase.h25
-rw-r--r--src/corelib/global/qmalloc.cpp16
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp9
-rw-r--r--src/corelib/kernel/qeventdispatcher_symbian.cpp9
-rw-r--r--src/corelib/kernel/qeventdispatcher_symbian_p.h4
-rw-r--r--src/corelib/tools/qbytearray.cpp10
-rw-r--r--src/corelib/tools/qlocale.cpp1
-rw-r--r--src/corelib/tools/qlocale.h2
-rw-r--r--src/declarative/debugger/qdeclarativedebughelper.cpp8
-rw-r--r--src/declarative/debugger/qdeclarativedebughelper_p.h6
-rw-r--r--src/declarative/debugger/qdeclarativedebugservice.cpp7
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflickable.cpp44
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflickable_p_p.h3
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimage.cpp43
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimage_p.h1
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp4
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp63
-rw-r--r--src/declarative/graphicsitems/qdeclarativeloader.cpp16
-rw-r--r--src/declarative/graphicsitems/qdeclarativerectangle.cpp3
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext.cpp55
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput.cpp23
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextlayout.cpp17
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextlayout_p.h1
-rw-r--r--src/declarative/qml/qdeclarativecomponent.cpp37
-rw-r--r--src/declarative/qml/qdeclarativecontext.cpp21
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp1
-rw-r--r--src/declarative/qml/qdeclarativeengine_p.h2
-rw-r--r--src/declarative/qml/qdeclarativeenginedebug.cpp3
-rw-r--r--src/declarative/qml/qdeclarativeparser_p.h2
-rw-r--r--src/declarative/qml/qdeclarativeprivate.h5
-rw-r--r--src/declarative/qml/qdeclarativeworkerscript.cpp30
-rw-r--r--src/declarative/qml/qmetaobjectbuilder.cpp12
-rw-r--r--src/declarative/util/qdeclarativefontloader.cpp16
-rw-r--r--src/declarative/util/qdeclarativestate.cpp12
-rw-r--r--src/declarative/util/qdeclarativestate_p.h3
-rw-r--r--src/declarative/util/qdeclarativestate_p_p.h2
-rw-r--r--src/declarative/util/qdeclarativetransition.cpp6
-rw-r--r--src/declarative/util/qdeclarativetransitionmanager.cpp16
-rw-r--r--src/gui/egl/qegl.cpp4
-rw-r--r--src/gui/graphicsview/qgraphicsproxywidget.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicssceneevent.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsview.cpp7
-rw-r--r--src/gui/graphicsview/qgraphicswidget.cpp2
-rw-r--r--src/gui/image/qimage_ssse3.cpp2
-rw-r--r--src/gui/image/qpixmap.cpp3
-rw-r--r--src/gui/image/qxpmhandler.cpp2
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp6
-rw-r--r--src/gui/itemviews/qtableview.cpp4
-rw-r--r--src/gui/kernel/qapplication_mac.mm2
-rw-r--r--src/gui/kernel/qapplication_s60.cpp2
-rw-r--r--src/gui/kernel/qeventdispatcher_s60.cpp66
-rw-r--r--src/gui/kernel/qeventdispatcher_s60_p.h24
-rw-r--r--src/gui/kernel/qgesturemanager.cpp4
-rw-r--r--src/gui/kernel/qmotifdnd_x11.cpp5
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac.mm22
-rw-r--r--src/gui/kernel/qwidget.cpp4
-rw-r--r--src/gui/kernel/qwidget_win.cpp23
-rw-r--r--src/gui/painting/qgrayraster.c35
-rw-r--r--src/gui/painting/qgrayraster_p.h2
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp6
-rw-r--r--src/gui/painting/qpainter.cpp4
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp2
-rw-r--r--src/gui/painting/qwindowsurface_raster.cpp5
-rw-r--r--src/gui/styles/qs60style.cpp107
-rw-r--r--src/gui/styles/qs60style_p.h7
-rw-r--r--src/gui/styles/qs60style_s60.cpp75
-rw-r--r--src/gui/text/qfontdatabase_x11.cpp7
-rw-r--r--src/gui/text/qfontengine.cpp19
-rw-r--r--src/gui/text/qfontengine_mac.mm24
-rw-r--r--src/gui/text/qfontengine_p.h4
-rw-r--r--src/gui/text/qstatictext.cpp22
-rw-r--r--src/gui/text/qstatictext_p.h54
-rw-r--r--src/gui/text/qtextcontrol.cpp3
-rw-r--r--src/gui/text/qtextcursor.h1
-rw-r--r--src/gui/text/qtextdocument.cpp8
-rw-r--r--src/gui/text/qtextengine.cpp2
-rw-r--r--src/gui/widgets/qcocoamenu_mac.mm22
-rw-r--r--src/gui/widgets/qvalidator.cpp45
-rw-r--r--src/multimedia/audio/audio.pri4
-rw-r--r--src/multimedia/audio/qaudioinput_alsa_p.cpp21
-rw-r--r--src/multimedia/audio/qaudioinput_win32_p.cpp11
-rw-r--r--src/multimedia/audio/qaudiooutput_win32_p.cpp2
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp2
-rw-r--r--src/network/access/qnetworkaccessbackend.cpp12
-rw-r--r--src/network/access/qnetworkaccessbackend_p.h1
-rw-r--r--src/network/access/qnetworkaccesscachebackend.cpp12
-rw-r--r--src/network/access/qnetworkaccesscachebackend_p.h2
-rw-r--r--src/network/access/qnetworkaccessdebugpipebackend.cpp6
-rw-r--r--src/network/access/qnetworkaccessdebugpipebackend_p.h1
-rw-r--r--src/network/access/qnetworkaccessfilebackend.cpp6
-rw-r--r--src/network/access/qnetworkaccessfilebackend_p.h1
-rw-r--r--src/network/access/qnetworkaccessftpbackend.cpp17
-rw-r--r--src/network/access/qnetworkaccessftpbackend_p.h1
-rw-r--r--src/network/access/qnetworkaccesshttpbackend.cpp20
-rw-r--r--src/network/access/qnetworkaccesshttpbackend_p.h1
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp21
-rw-r--r--src/network/ssl/qsslsocket_openssl.cpp75
-rw-r--r--src/network/ssl/qsslsocket_openssl_p.h1
-rw-r--r--src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h2
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadermanager_p.h2
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp26
-rw-r--r--src/opengl/qgl.cpp18
-rw-r--r--src/opengl/qgl.h1
-rw-r--r--src/opengl/qgl_egl.cpp2
-rw-r--r--src/opengl/qgl_p.h80
-rw-r--r--src/opengl/qgl_x11egl.cpp2
-rw-r--r--src/opengl/qpaintengine_opengl.cpp8
-rw-r--r--src/opengl/qpixmapdata_x11gl_egl.cpp4
-rw-r--r--src/openvg/qpaintengine_vg.cpp2
-rw-r--r--src/plugins/bearer/corewlan/corewlan.pro2
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.mm85
-rw-r--r--src/plugins/bearer/icd/icd.pro2
-rw-r--r--src/plugins/bearer/symbian/qnetworksession_impl.cpp2
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp44
-rw-r--r--src/plugins/graphicssystems/meego/dithering.cpp53
-rw-r--r--src/plugins/graphicssystems/meego/qmeegoextensions.cpp80
-rw-r--r--src/plugins/graphicssystems/meego/qmeegoextensions.h22
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystem.cpp52
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystem.h9
-rw-r--r--src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp13
-rw-r--r--src/plugins/graphicssystems/meego/qmeegolivepixmapdata.h9
-rw-r--r--src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp5
-rw-r--r--src/plugins/phonon/mmf/mmf.pro2
-rw-r--r--src/qt3support/canvas/q3canvas.cpp2
-rw-r--r--src/qt3support/text/q3richtext.cpp2
-rw-r--r--src/s60installs/bwins/QtDeclarativeu.def3
-rw-r--r--src/s60installs/bwins/QtOpenVGu.def1
-rw-r--r--src/s60installs/eabi/QtCoreu.def1
-rw-r--r--src/s60installs/eabi/QtDeclarativeu.def3
-rw-r--r--src/s60installs/eabi/QtGuiu.def3
-rw-r--r--src/s60installs/eabi/QtOpenVGu.def1
-rw-r--r--src/script/api/qscriptengine.cpp18
-rw-r--r--src/script/api/qscriptvalue.cpp1
-rw-r--r--src/script/bridge/qscriptclassobject.cpp12
-rw-r--r--src/scripttools/debugging/qscriptdebuggeragent.cpp6
-rw-r--r--src/sql/drivers/oci/qsql_oci.cpp239
-rw-r--r--src/xmlpatterns/data/qabstractfloat.cpp2
-rw-r--r--src/xmlpatterns/data/qatomicvalue.cpp2
-rw-r--r--src/xmlpatterns/data/qschematime_p.h2
-rw-r--r--src/xmlpatterns/schema/qxsdschemaparser.cpp8
-rw-r--r--src/xmlpatterns/schema/qxsdschemaparser_setup.cpp2
-rw-r--r--src/xmlpatterns/schema/qxsdstatemachine_p.h4
-rw-r--r--src/xmlpatterns/type/qtypechecker.cpp2
147 files changed, 1767 insertions, 700 deletions
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp
index 817fb0d..4a618da 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp
@@ -833,7 +833,7 @@ static const unsigned char indicPosition[0xe00-0x900] = {
None, None, None, None,
None, None, None, Post,
- Post, None, Below, None,
+ Pre, None, Below, None,
None, Post, None, None,
None, None, None, None,
None, None, Post, Post,
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp
index 641b42b..9add36e 100644
--- a/src/corelib/animation/qabstractanimation.cpp
+++ b/src/corelib/animation/qabstractanimation.cpp
@@ -166,11 +166,12 @@ Q_GLOBAL_STATIC(QThreadStorage<QUnifiedTimer *>, unifiedTimer)
#endif
QUnifiedTimer::QUnifiedTimer() :
- QObject(), lastTick(0), timingInterval(DEFAULT_TIMER_INTERVAL),
+ QObject(), defaultDriver(this), lastTick(0), timingInterval(DEFAULT_TIMER_INTERVAL),
currentAnimationIdx(0), consistentTiming(false), slowMode(false),
slowdownFactor(5.0f), isPauseTimerActive(false), runningLeafAnimations(0)
{
time.invalidate();
+ driver = &defaultDriver;
}
@@ -247,14 +248,27 @@ void QUnifiedTimer::restartAnimationTimer()
qDebug() << runningPauseAnimations;
qDebug() << closestPauseAnimationTimeToFinish();
}
+ driver->stop();
animationTimer.start(closestTimeToFinish, this);
isPauseTimerActive = true;
- } else if (!animationTimer.isActive() || isPauseTimerActive) {
- animationTimer.start(timingInterval, this);
+ } else if (!driver->isRunning() || isPauseTimerActive) {
+ driver->start();
isPauseTimerActive = false;
}
}
+void QUnifiedTimer::setTimingInterval(int interval)
+{
+ timingInterval = interval;
+
+ if (driver->isRunning() && !isPauseTimerActive) {
+ //we changed the timing interval
+ driver->stop();
+ driver->start();
+ }
+}
+
+
void QUnifiedTimer::timerEvent(QTimerEvent *event)
{
//in the case of consistent timing we make sure the orders in which events come is always the same
@@ -369,6 +383,129 @@ int QUnifiedTimer::closestPauseAnimationTimeToFinish()
return closestTimeToFinish;
}
+void QUnifiedTimer::installAnimationDriver(QAnimationDriver *d)
+{
+ if (driver->isRunning()) {
+ qWarning("QUnifiedTimer: Cannot change animation driver while animations are running");
+ return;
+ }
+
+ if (driver && driver != &defaultDriver)
+ delete driver;
+
+ driver = d;
+}
+
+/*!
+ \class QAnimationDriver
+
+ \brief The QAnimationDriver class is used to exchange the mechanism that drives animations.
+
+ The default animation system is driven by a timer that fires at regular intervals.
+ In some scenarios, it is better to drive the animation based on other synchronization
+ mechanisms, such as the vertical refresh rate of the screen.
+ */
+
+QAnimationDriver::QAnimationDriver(QObject *parent)
+ : QObject(*(new QAnimationDriverPrivate), parent)
+{
+}
+
+QAnimationDriver::QAnimationDriver(QAnimationDriverPrivate &dd, QObject *parent)
+ : QObject(dd, parent)
+{
+}
+
+
+/*!
+ Advances the animation based on the current time. This function should
+ be continuously called by the driver while the animation is running.
+ */
+void QAnimationDriver::advance()
+{
+ QUnifiedTimer *instance = QUnifiedTimer::instance();
+
+ // update current time on all top level animations
+ instance->updateAnimationsTime();
+ instance->restartAnimationTimer();
+}
+
+
+/*!
+ Installs this animation driver. The animation driver is thread local and
+ will only apply for the thread its installed in.
+ */
+void QAnimationDriver::install()
+{
+ QUnifiedTimer *timer = QUnifiedTimer::instance(true);
+ timer->installAnimationDriver(this);
+}
+
+bool QAnimationDriver::isRunning() const
+{
+ return d_func()->running;
+}
+
+
+void QAnimationDriver::start()
+{
+ Q_D(QAnimationDriver);
+ if (!d->running) {
+ started();
+ d->running = true;
+ }
+}
+
+
+void QAnimationDriver::stop()
+{
+ Q_D(QAnimationDriver);
+ if (d->running) {
+ stopped();
+ d->running = false;
+ }
+}
+
+/*!
+ \fn QAnimationDriver::started()
+
+ This function is called by the animation framework to notify the driver
+ that it should start running.
+ */
+
+/*!
+ \fn QAnimationDriver::stopped()
+
+ This function is called by the animation framework to notify the driver
+ that it should stop running.
+ */
+
+/*!
+ The default animation driver just spins the timer...
+ */
+QDefaultAnimationDriver::QDefaultAnimationDriver(QUnifiedTimer *timer)
+ : QAnimationDriver(0), m_unified_timer(timer)
+{
+}
+
+void QDefaultAnimationDriver::timerEvent(QTimerEvent *e)
+{
+ Q_ASSERT(e->timerId() == m_timer.timerId());
+ advance();
+}
+
+void QDefaultAnimationDriver::started()
+{
+ m_timer.start(m_unified_timer->timingInterval, this);
+}
+
+void QDefaultAnimationDriver::stopped()
+{
+ m_timer.stop();
+}
+
+
+
void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState)
{
Q_Q(QAbstractAnimation);
@@ -794,6 +931,9 @@ void QAbstractAnimation::stop()
{
Q_D(QAbstractAnimation);
+ if (d->state == Stopped)
+ return;
+
d->setState(Stopped);
}
diff --git a/src/corelib/animation/qabstractanimation.h b/src/corelib/animation/qabstractanimation.h
index d3c0d0d..6abe8c1 100644
--- a/src/corelib/animation/qabstractanimation.h
+++ b/src/corelib/animation/qabstractanimation.h
@@ -54,6 +54,7 @@ QT_MODULE(Core)
class QAnimationGroup;
class QSequentialAnimationGroup;
+class QAnimationDriver;
class QAbstractAnimationPrivate;
class Q_CORE_EXPORT QAbstractAnimation : public QObject
@@ -132,6 +133,36 @@ private:
Q_DECLARE_PRIVATE(QAbstractAnimation)
};
+class QAnimationDriverPrivate;
+class Q_CORE_EXPORT QAnimationDriver : public QObject
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QAnimationDriver)
+
+public:
+ QAnimationDriver(QObject *parent);
+
+ void advance();
+ void install();
+
+ bool isRunning() const;
+
+protected:
+ virtual void started() = 0;
+ virtual void stopped() = 0;
+
+ QAnimationDriver(QAnimationDriverPrivate &dd, QObject *parent = 0);
+
+private:
+ friend class QUnifiedTimer;
+
+ void start();
+ void stop();
+};
+
+
+
+
#endif //QT_NO_ANIMATION
QT_END_NAMESPACE
diff --git a/src/corelib/animation/qabstractanimation_p.h b/src/corelib/animation/qabstractanimation_p.h
index d3d4098..d56c130 100644
--- a/src/corelib/animation/qabstractanimation_p.h
+++ b/src/corelib/animation/qabstractanimation_p.h
@@ -58,6 +58,7 @@
#include <QtCore/qtimer.h>
#include <QtCore/qelapsedtimer.h>
#include <private/qobject_p.h>
+#include <qabstractanimation.h>
#ifdef Q_OS_WIN
#include <qt_windows.h>
@@ -114,30 +115,47 @@ private:
Q_DECLARE_PUBLIC(QAbstractAnimation)
};
+
+class QUnifiedTimer;
+class QDefaultAnimationDriver : public QAnimationDriver
+{
+ Q_OBJECT
+public:
+ QDefaultAnimationDriver(QUnifiedTimer *timer);
+ void timerEvent(QTimerEvent *e);
+
+ void started();
+ void stopped();
+
+private:
+ QBasicTimer m_timer;
+ QUnifiedTimer *m_unified_timer;
+};
+
+class Q_CORE_EXPORT QAnimationDriverPrivate : public QObjectPrivate
+{
+public:
+ QAnimationDriverPrivate() : running(false) {}
+ bool running;
+};
+
typedef QElapsedTimer ElapsedTimer;
-class QUnifiedTimer : public QObject
+class Q_CORE_EXPORT QUnifiedTimer : public QObject
{
private:
QUnifiedTimer();
public:
//XXX this is needed by dui
- static Q_CORE_EXPORT QUnifiedTimer *instance();
+ static QUnifiedTimer *instance();
static QUnifiedTimer *instance(bool create);
static void registerAnimation(QAbstractAnimation *animation, bool isTopLevel);
static void unregisterAnimation(QAbstractAnimation *animation);
//defines the timing interval. Default is DEFAULT_TIMER_INTERVAL
- void setTimingInterval(int interval)
- {
- timingInterval = interval;
- if (animationTimer.isActive() && !isPauseTimerActive) {
- //we changed the timing interval
- animationTimer.start(timingInterval, this);
- }
- }
+ void setTimingInterval(int interval);
/*
this allows to have a consistent timer interval at each tick from the timer
@@ -161,11 +179,20 @@ public:
*/
static void updateAnimationTimer();
+ void installAnimationDriver(QAnimationDriver *driver);
+
+ void restartAnimationTimer();
+ void updateAnimationsTime();
+
protected:
void timerEvent(QTimerEvent *);
private:
- // timer used for all active (running) animations
+ friend class QDefaultAnimationDriver;
+
+ QAnimationDriver *driver;
+ QDefaultAnimationDriver defaultDriver;
+
QBasicTimer animationTimer;
// timer used to delay the check if we should start/stop the animation timer
QBasicTimer startStopAnimationTimer;
@@ -195,9 +222,6 @@ private:
void registerRunningAnimation(QAbstractAnimation *animation);
void unregisterRunningAnimation(QAbstractAnimation *animation);
- void restartAnimationTimer();
-
- void updateAnimationsTime();
int closestPauseAnimationTimeToFinish();
};
diff --git a/src/corelib/concurrent/qtconcurrentrunbase.h b/src/corelib/concurrent/qtconcurrentrunbase.h
index a6bbe3e..888d395 100644
--- a/src/corelib/concurrent/qtconcurrentrunbase.h
+++ b/src/corelib/concurrent/qtconcurrentrunbase.h
@@ -100,7 +100,18 @@ public:
this->reportFinished();
return;
}
- this->runFunctor();
+#ifndef QT_NO_EXCEPTIONS
+ try {
+#endif
+ this->runFunctor();
+#ifndef QT_NO_EXCEPTIONS
+ } catch (QtConcurrent::Exception &e) {
+ QFutureInterface<T>::reportException(e);
+ } catch (...) {
+ QFutureInterface<T>::reportException(QtConcurrent::UnhandledException());
+ }
+#endif
+
this->reportResult(result);
this->reportFinished();
}
@@ -117,7 +128,17 @@ public:
this->reportFinished();
return;
}
- this->runFunctor();
+#ifndef QT_NO_EXCEPTIONS
+ try {
+#endif
+ this->runFunctor();
+#ifndef QT_NO_EXCEPTIONS
+ } catch (QtConcurrent::Exception &e) {
+ QFutureInterface<void>::reportException(e);
+ } catch (...) {
+ QFutureInterface<void>::reportException(QtConcurrent::UnhandledException());
+ }
+#endif
this->reportFinished();
}
};
diff --git a/src/corelib/global/qmalloc.cpp b/src/corelib/global/qmalloc.cpp
index 090998c..028a0a5 100644
--- a/src/corelib/global/qmalloc.cpp
+++ b/src/corelib/global/qmalloc.cpp
@@ -90,8 +90,6 @@ void *qReallocAligned(void *oldptr, size_t newsize, size_t oldsize, size_t align
return newptr + 1;
}
- union { void *ptr; void **pptr; quintptr n; } real, faked;
-
// qMalloc returns pointers aligned at least at sizeof(size_t) boundaries
// but usually more (8- or 16-byte boundaries).
// So we overallocate by alignment-sizeof(size_t) bytes, so we're guaranteed to find a
@@ -100,19 +98,21 @@ void *qReallocAligned(void *oldptr, size_t newsize, size_t oldsize, size_t align
// However, we need to store the actual pointer, so we need to allocate actually size +
// alignment anyway.
- real.ptr = qRealloc(actualptr, newsize + alignment);
- if (!real.ptr)
+ void *real = qRealloc(actualptr, newsize + alignment);
+ if (!real)
return 0;
- faked.n = real.n + alignment;
- faked.n &= ~(alignment - 1);
+ quintptr faked = reinterpret_cast<quintptr>(real) + alignment;
+ faked &= ~(alignment - 1);
+
+ void **faked_ptr = reinterpret_cast<void **>(faked);
// now save the value of the real pointer at faked-sizeof(void*)
// by construction, alignment > sizeof(void*) and is a power of 2, so
// faked-sizeof(void*) is properly aligned for a pointer
- faked.pptr[-1] = real.ptr;
+ faked_ptr[-1] = real;
- return faked.ptr;
+ return faked_ptr;
}
void qFreeAligned(void *ptr)
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index e967884..a8dc491 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -415,11 +415,10 @@ QString qAppName()
operations can call processEvents() to keep the application
responsive.
- Some Qt classes, such as QString, can be used without a
- QCoreApplication object. However, in general, we recommend that
- you create a QCoreApplication or a QApplication object in your \c
- main() function as early as possible. exit() will not return
- until the event loop exits; e.g., when quit() is called.
+ In general, we recommend that you create a QCoreApplication or
+ a QApplication object in your \c main() function as early as
+ possible. exit() will not return until the event loop exits;
+ e.g., when quit() is called.
Several static convenience functions are also provided. The
QCoreApplication object is available from instance(). Events can
diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp
index 87d6a49..6154119 100644
--- a/src/corelib/kernel/qeventdispatcher_symbian.cpp
+++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp
@@ -975,9 +975,7 @@ bool QEventDispatcherSymbian::sendPostedEvents()
inline void QEventDispatcherSymbian::addDeferredActiveObject(QActiveObject *object)
{
- if (m_deferredActiveObjects.isEmpty()) {
- m_completeDeferredAOs->complete();
- }
+ queueDeferredActiveObjectsCompletion();
m_deferredActiveObjects.append(object);
}
@@ -986,6 +984,11 @@ inline void QEventDispatcherSymbian::removeDeferredActiveObject(QActiveObject *o
m_deferredActiveObjects.removeAll(object);
}
+void QEventDispatcherSymbian::queueDeferredActiveObjectsCompletion()
+{
+ m_completeDeferredAOs->complete();
+}
+
void QEventDispatcherSymbian::reactivateDeferredActiveObjects()
{
while (!m_deferredActiveObjects.isEmpty()) {
diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h
index 1486db5..3615996 100644
--- a/src/corelib/kernel/qeventdispatcher_symbian_p.h
+++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h
@@ -247,7 +247,9 @@ public:
void addDeferredActiveObject(QActiveObject *object);
void removeDeferredActiveObject(QActiveObject *object);
- void reactivateDeferredActiveObjects();
+ void queueDeferredActiveObjectsCompletion();
+ // Can be overridden to activate local active objects too, but do call baseclass!
+ virtual void reactivateDeferredActiveObjects();
inline int iterationCount() const { return m_iterationCount; }
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index dc2e8e9..f26d878 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -541,6 +541,11 @@ QByteArray qUncompress(const uchar* data, int nbytes)
forever {
ulong alloc = len;
+ if (len >= (1 << 31) - sizeof(QByteArray::Data)) {
+ //QByteArray does not support that huge size anyway.
+ qWarning("qUncompress: Input data is corrupted");
+ return QByteArray();
+ }
QByteArray::Data *p = static_cast<QByteArray::Data *>(qRealloc(d.data(), sizeof(QByteArray::Data) + alloc));
if (!p) {
// we are not allowed to crash here when compiling with QT_NO_EXCEPTIONS
@@ -556,6 +561,11 @@ QByteArray qUncompress(const uchar* data, int nbytes)
switch (res) {
case Z_OK:
if (len != alloc) {
+ if (len >= (1 << 31) - sizeof(QByteArray::Data)) {
+ //QByteArray does not support that huge size anyway.
+ qWarning("qUncompress: Input data is corrupted");
+ return QByteArray();
+ }
QByteArray::Data *p = static_cast<QByteArray::Data *>(qRealloc(d.data(), sizeof(QByteArray::Data) + len));
if (!p) {
// we are not allowed to crash here when compiling with QT_NO_EXCEPTIONS
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index 6b1de5e..2fb3616 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -7308,6 +7308,7 @@ Q_CORE_EXPORT char *qdtoa( double d, int mode, int ndigits, int *decpt, int *sig
Q_CORE_EXPORT double qstrtod(const char *s00, const char **se, bool *ok)
{
+ errno = 0;
double ret = strtod((char*)s00, (char**)se);
if (ok) {
if((ret == 0.0l && errno == ERANGE)
diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h
index 8b424bb..1af2cb4 100644
--- a/src/corelib/tools/qlocale.h
+++ b/src/corelib/tools/qlocale.h
@@ -114,7 +114,7 @@ class Q_CORE_EXPORT QLocale
friend class QString;
friend class QByteArray;
friend class QIntValidator;
- friend class QDoubleValidator;
+ friend class QDoubleValidatorPrivate;
friend class QTextStream;
friend class QTextStreamPrivate;
diff --git a/src/declarative/debugger/qdeclarativedebughelper.cpp b/src/declarative/debugger/qdeclarativedebughelper.cpp
index 207ad2b..b003c12 100644
--- a/src/declarative/debugger/qdeclarativedebughelper.cpp
+++ b/src/declarative/debugger/qdeclarativedebughelper.cpp
@@ -48,6 +48,7 @@
#include <private/qdeclarativeengine_p.h>
#include <private/qabstractanimation_p.h>
+#include <private/qdeclarativeengine_p.h>
QT_BEGIN_NAMESPACE
@@ -63,4 +64,11 @@ void QDeclarativeDebugHelper::setAnimationSlowDownFactor(qreal factor)
timer->setSlowdownFactor(factor);
}
+void QDeclarativeDebugHelper::enableDebugging() {
+ if (!QDeclarativeEnginePrivate::qml_debugging_enabled) {
+ qWarning("Qml debugging is enabled. Only use this in a safe environment!");
+ }
+ QDeclarativeEnginePrivate::qml_debugging_enabled = true;
+}
+
QT_END_NAMESPACE
diff --git a/src/declarative/debugger/qdeclarativedebughelper_p.h b/src/declarative/debugger/qdeclarativedebughelper_p.h
index 5689dff..fcd7115 100644
--- a/src/declarative/debugger/qdeclarativedebughelper_p.h
+++ b/src/declarative/debugger/qdeclarativedebughelper_p.h
@@ -55,11 +55,15 @@ class QDeclarativeEngine;
// Helper methods to access private API through a stable interface
// This is used in the qmljsdebugger library of QtCreator.
-class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugHelper
+class Q_DECLARATIVE_EXPORT QDeclarativeDebugHelper
{
public:
static QScriptEngine *getScriptEngine(QDeclarativeEngine *engine);
static void setAnimationSlowDownFactor(qreal factor);
+
+ // Enables remote debugging functionality
+ // Only use this for debugging in a safe environment!
+ static void enableDebugging();
};
QT_END_NAMESPACE
diff --git a/src/declarative/debugger/qdeclarativedebugservice.cpp b/src/declarative/debugger/qdeclarativedebugservice.cpp
index c39da3d..8c86ae8 100644
--- a/src/declarative/debugger/qdeclarativedebugservice.cpp
+++ b/src/declarative/debugger/qdeclarativedebugservice.cpp
@@ -42,6 +42,7 @@
#include "private/qdeclarativedebugservice_p.h"
#include "private/qpacketprotocol_p.h"
+#include "private/qdeclarativeengine_p.h"
#include <QtCore/qdebug.h>
#include <QtNetwork/qtcpserver.h>
@@ -205,6 +206,12 @@ QDeclarativeDebugServer *QDeclarativeDebugServer::instance()
// format: qmljsdebugger=port:3768[,block]
if (!appD->qmljsDebugArgumentsString().isEmpty()) {
+ if (!QDeclarativeEnginePrivate::qml_debugging_enabled) {
+ qWarning() << QString::fromLatin1("QDeclarativeDebugServer: Ignoring \"-qmljsdebugger=%1\". "
+ "Debugging has not been enabled.").arg(
+ appD->qmljsDebugArgumentsString()).toAscii().constData();
+ return 0;
+ }
if (appD->qmljsDebugArgumentsString().indexOf(QLatin1String("port:")) == 0) {
int separatorIndex = appD->qmljsDebugArgumentsString().indexOf(QLatin1Char(','));
diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
index 6fe1522..0f786e3 100644
--- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
@@ -53,9 +53,6 @@ QT_BEGIN_NAMESPACE
// before we perform a flick.
static const int FlickThreshold = 20;
-// Really slow flicks can be annoying.
-static const int MinimumFlickVelocity = 75;
-
QDeclarativeFlickableVisibleArea::QDeclarativeFlickableVisibleArea(QDeclarativeFlickable *parent)
: QObject(parent), flickable(parent), m_xPosition(0.), m_widthRatio(0.)
, m_yPosition(0.), m_heightRatio(0.)
@@ -990,8 +987,8 @@ void QDeclarativeFlickable::viewportMoved()
{
Q_D(QDeclarativeFlickable);
- qreal prevY = d->lastFlickablePosition.x();
- qreal prevX = d->lastFlickablePosition.y();
+ qreal prevX = d->lastFlickablePosition.x();
+ qreal prevY = d->lastFlickablePosition.y();
d->velocityTimeline.clear();
if (d->pressed || d->calcVelocity) {
int elapsed = QDeclarativeItemPrivate::restart(d->velocityTime);
@@ -1012,7 +1009,7 @@ void QDeclarativeFlickable::viewportMoved()
}
}
- d->lastFlickablePosition = QPointF(d->vData.move.value(), d->hData.move.value());
+ d->lastFlickablePosition = QPointF(d->hData.move.value(), d->vData.move.value());
d->vTime = d->timeline.time();
d->updateBeginningEnd();
@@ -1032,6 +1029,13 @@ void QDeclarativeFlickable::geometryChanged(const QRectF &newGeometry,
d->contentItem->setWidth(width());
emit contentWidthChanged();
}
+ // Make sure that we're entirely in view.
+ if (!d->pressed && !d->movingHorizontally && !d->movingVertically) {
+ int oldDuration = d->fixupDuration;
+ d->fixupDuration = 0;
+ d->fixupX();
+ d->fixupDuration = oldDuration;
+ }
}
if (newGeometry.height() != oldGeometry.height()) {
if (yflick())
@@ -1040,6 +1044,13 @@ void QDeclarativeFlickable::geometryChanged(const QRectF &newGeometry,
d->contentItem->setHeight(height());
emit contentHeightChanged();
}
+ // Make sure that we're entirely in view.
+ if (!d->pressed && !d->movingHorizontally && !d->movingVertically) {
+ int oldDuration = d->fixupDuration;
+ d->fixupDuration = 0;
+ d->fixupY();
+ d->fixupDuration = oldDuration;
+ }
}
if (changed)
@@ -1161,19 +1172,18 @@ void QDeclarativeFlickable::setBoundsBehavior(BoundsBehavior b)
\qmlproperty real Flickable::contentWidth
\qmlproperty real Flickable::contentHeight
- The dimensions of the content (the surface controlled by Flickable). Typically this
- should be set to the combined size of the items placed in the Flickable. Note this
- can be set automatically using \l {Item::childrenRect.width}{childrenRect.width}
- and \l {Item::childrenRect.height}{childrenRect.height}. For example:
+ The dimensions of the content (the surface controlled by Flickable).
+ This should typically be set to the combined size of the items placed in the
+ Flickable.
- \code
- Flickable {
- width: 320; height: 480
- contentWidth: childrenRect.width; contentHeight: childrenRect.height
+ The following snippet shows how these properties are used to display
+ an image that is larger than the Flickable item itself:
- Image { id: image; source: "bigImage.png" }
- }
- \endcode
+ \snippet doc/src/snippets/declarative/flickable.qml document
+
+ In some cases, the the content dimensions can be automatically set
+ using the \l {Item::childrenRect.width}{childrenRect.width}
+ and \l {Item::childrenRect.height}{childrenRect.height} properties.
*/
qreal QDeclarativeFlickable::contentWidth() const
{
diff --git a/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h b/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h
index afefde2..92cf748 100644
--- a/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h
@@ -66,6 +66,9 @@
QT_BEGIN_NAMESPACE
+// Really slow flicks can be annoying.
+const qreal MinimumFlickVelocity = 75.0;
+
class QDeclarativeFlickableVisibleArea;
class QDeclarativeFlickablePrivate : public QDeclarativeItemPrivate, public QDeclarativeItemChangeListener
{
diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp
index 08d237f..3b08a9b 100644
--- a/src/declarative/graphicsitems/qdeclarativeimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp
@@ -259,8 +259,10 @@ void QDeclarativeImage::setFillMode(FillMode mode)
\qmlproperty real Image::paintedHeight
These properties hold the size of the image that is actually painted.
- In most cases it is the same as \c width and \c height, but when using a \c fillMode like
- \c PreserveAspectFit \c paintedWidth or \c paintedHeight can be smaller than \c width and \c height.
+ In most cases it is the same as \c width and \c height, but when using a
+ \c fillMode \c PreserveAspectFit or \c fillMode \c PreserveAspectCrop
+ \c paintedWidth or \c paintedHeight can be smaller or larger than
+ \c width and \c height of the Image element.
*/
qreal QDeclarativeImage::paintedWidth() const
{
@@ -288,23 +290,25 @@ qreal QDeclarativeImage::paintedHeight() const
Use this status to provide an update or respond to the status change in some way.
For example, you could:
- \e {Trigger a state change:}
- \qml
- State { name: 'loaded'; when: image.status = Image.Ready }
+ \list
+ \o Trigger a state change:
+ \qml
+ State { name: 'loaded'; when: image.status == Image.Ready }
\endqml
- \e {Implement an \c onStatusChanged signal handler:}
- \qml
+ \o Implement an \c onStatusChanged signal handler:
+ \qml
Image {
id: image
onStatusChanged: if (image.status == Image.Ready) console.log('Loaded')
}
\endqml
- \e {Bind to the status value:}
+ \o Bind to the status value:
\qml
- Text { text: image.status != Image.Ready ? 'Not Loaded' : 'Loaded' }
+ Text { text: image.status == Image.Ready ? 'Loaded' : 'Not loaded' }
\endqml
+ \endlist
\sa progress
*/
@@ -397,6 +401,19 @@ void QDeclarativeImage::updatePaintedGeometry()
if (heightValid() && !widthValid()) {
setImplicitWidth(d->paintedWidth);
}
+ } else if (d->fillMode == PreserveAspectCrop) {
+ if (!d->pix.width() || !d->pix.height())
+ return;
+ qreal widthScale = width() / qreal(d->pix.width());
+ qreal heightScale = height() / qreal(d->pix.height());
+ if (widthScale < heightScale) {
+ widthScale = heightScale;
+ } else if(heightScale < widthScale) {
+ heightScale = widthScale;
+ }
+
+ d->paintedHeight = heightScale * qreal(d->pix.height());
+ d->paintedWidth = widthScale * qreal(d->pix.width());
} else {
d->paintedWidth = width();
d->paintedHeight = height();
@@ -410,6 +427,12 @@ void QDeclarativeImage::geometryChanged(const QRectF &newGeometry, const QRectF
updatePaintedGeometry();
}
+QRectF QDeclarativeImage::boundingRect() const
+{
+ Q_D(const QDeclarativeImage);
+ return QRectF(0, 0, qMax(d->mWidth, d->paintedWidth), qMax(d->mHeight, d->paintedHeight));
+}
+
/*!
\qmlproperty url Image::source
@@ -494,7 +517,7 @@ void QDeclarativeImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWi
}
if (clip()) {
p->save();
- p->setClipRect(boundingRect(), Qt::IntersectClip);
+ p->setClipRect(QRectF(0, 0, d->mWidth, d->mHeight), Qt::IntersectClip);
}
scale.scale(widthScale, heightScale);
QTransform old = p->transform();
diff --git a/src/declarative/graphicsitems/qdeclarativeimage_p.h b/src/declarative/graphicsitems/qdeclarativeimage_p.h
index c8bb30b..0e8034e 100644
--- a/src/declarative/graphicsitems/qdeclarativeimage_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeimage_p.h
@@ -76,6 +76,7 @@ public:
qreal paintedHeight() const;
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
+ QRectF boundingRect() const;
Q_SIGNALS:
void fillModeChanged();
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index 95a4fd6..e0df751 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -1955,12 +1955,8 @@ void QDeclarativeItem::geometryChanged(const QRectF &newGeometry,
change.listener->itemGeometryChanged(this, newGeometry, oldGeometry);
}
- if (newGeometry.x() != oldGeometry.x())
- emit xChanged();
if (newGeometry.width() != oldGeometry.width())
emit widthChanged();
- if (newGeometry.y() != oldGeometry.y())
- emit yChanged();
if (newGeometry.height() != oldGeometry.height())
emit heightChanged();
}
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index 38a4839..94b1cb3 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -334,28 +334,9 @@ public:
return model && model->count() && model->isValid();
}
- int snapIndex() {
- int index = currentIndex;
- for (int i = 0; i < visibleItems.count(); ++i) {
- FxListItem *item = visibleItems[i];
- if (item->index == -1)
- continue;
- qreal itemTop = item->position();
- if (itemTop >= highlight->position()-item->size()/2 && itemTop < highlight->position()+item->size()/2)
- return item->index;
- }
- return index;
- }
-
qreal snapPosAt(qreal pos) {
- for (int i = 0; i < visibleItems.count(); ++i) {
- FxListItem *item = visibleItems[i];
- if (item->index == -1)
- continue;
- qreal itemTop = item->position();
- if (itemTop+item->size()/2 >= pos && itemTop <= pos)
- return item->position();
- }
+ if (FxListItem *snapItem = snapItemAt(pos))
+ return snapItem->position();
if (visibleItems.count()) {
qreal firstPos = visibleItems.first()->position();
qreal endPos = visibleItems.last()->position();
@@ -368,17 +349,18 @@ public:
}
FxListItem *snapItemAt(qreal pos) {
+ FxListItem *snapItem = 0;
for (int i = 0; i < visibleItems.count(); ++i) {
FxListItem *item = visibleItems[i];
if (item->index == -1)
continue;
qreal itemTop = item->position();
- if (item->index == model->count()-1 || (itemTop+item->size()/2 >= pos))
+ if (highlight && itemTop >= pos && item->endPosition() <= pos + highlight->size() - 1)
return item;
+ if (itemTop+item->size()/2 >= pos && itemTop-item->size()/2 < pos)
+ snapItem = item;
}
- if (visibleItems.count() && visibleItems.first()->position() <= pos)
- return visibleItems.first();
- return 0;
+ return snapItem;
}
int lastVisibleIndex() const {
@@ -768,8 +750,10 @@ void QDeclarativeListViewPrivate::layout()
minExtentDirty = true;
maxExtentDirty = true;
updateHighlight();
- fixupPosition();
- q->refill();
+ if (!q->isMoving() && !q->isFlicking()) {
+ fixupPosition();
+ q->refill();
+ }
if (header)
updateHeader();
if (footer)
@@ -1173,6 +1157,7 @@ void QDeclarativeListViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m
|| (orient == QDeclarativeListView::Vertical && &data == &hData))
return;
+ correctFlick = false;
int oldDuration = fixupDuration;
fixupDuration = moveReason == Mouse ? fixupDuration : 0;
@@ -1350,12 +1335,15 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
qreal newtarget = data.flickTarget;
if (snapMode != QDeclarativeListView::NoSnap || highlightRange == QDeclarativeListView::StrictlyEnforceRange)
newtarget = -snapPosAt(-(data.flickTarget - highlightRangeStart)) + highlightRangeStart;
- if (velocity < 0 && newtarget < maxExtent)
- newtarget = maxExtent;
- else if (velocity > 0 && newtarget > minExtent)
- newtarget = minExtent;
- if (newtarget == data.flickTarget) // boundary unchanged - nothing to do
+ if (velocity < 0 && newtarget <= maxExtent)
+ newtarget = maxExtent - overshootDist;
+ else if (velocity > 0 && newtarget >= minExtent)
+ newtarget = minExtent + overshootDist;
+ if (newtarget == data.flickTarget) { // boundary unchanged - nothing to do
+ if (qAbs(velocity) < MinimumFlickVelocity)
+ correctFlick = false;
return;
+ }
data.flickTarget = newtarget;
qreal dist = -newtarget + data.move.value();
if ((v < 0 && dist < 0) || (v > 0 && dist > 0)) {
@@ -1365,7 +1353,7 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
return;
}
timeline.reset(data.move);
- timeline.accelDistance(data.move, v, -dist + (v < 0 ? -overshootDist : overshootDist));
+ timeline.accelDistance(data.move, v, -dist);
timeline.callback(QDeclarativeTimeLineCallback(&data.move, fixupCallback, this));
}
} else {
@@ -1696,7 +1684,7 @@ void QDeclarativeListView::setCurrentIndex(int index)
if (isComponentComplete() && d->isValid()) {
d->moveReason = QDeclarativeListViewPrivate::SetIndex;
d->updateCurrent(index);
- } else {
+ } else if (d->currentIndex != index) {
d->currentIndex = index;
emit currentIndexChanged();
}
@@ -2323,9 +2311,10 @@ void QDeclarativeListView::viewportMoved()
d->highlight->setPosition(qRound(pos));
// update current index
- int idx = d->snapIndex();
- if (idx >= 0 && idx != d->currentIndex)
- d->updateCurrent(idx);
+ if (FxListItem *snapItem = d->snapItemAt(d->highlight->position())) {
+ if (snapItem->index >= 0 && snapItem->index != d->currentIndex)
+ d->updateCurrent(snapItem->index);
+ }
}
}
diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp
index 7777567..109fbbb 100644
--- a/src/declarative/graphicsitems/qdeclarativeloader.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp
@@ -395,23 +395,25 @@ void QDeclarativeLoaderPrivate::_q_sourceLoaded()
Use this status to provide an update or respond to the status change in some way.
For example, you could:
- \e {Trigger a state change:}
- \qml
- State { name: 'loaded'; when: loader.status = Loader.Ready }
+ \list
+ \o Trigger a state change:
+ \qml
+ State { name: 'loaded'; when: loader.status == Loader.Ready }
\endqml
- \e {Implement an \c onStatusChanged signal handler:}
- \qml
+ \o Implement an \c onStatusChanged signal handler:
+ \qml
Loader {
id: loader
onStatusChanged: if (loader.status == Loader.Ready) console.log('Loaded')
}
\endqml
- \e {Bind to the status value:}
+ \o Bind to the status value:
\qml
- Text { text: loader.status != Loader.Ready ? 'Not Loaded' : 'Loaded' }
+ Text { text: loader.status == Loader.Ready ? 'Loaded' : 'Not loaded' }
\endqml
+ \endlist
Note that if the source is a local file, the status will initially be Ready (or Error). While
there will be no onStatusChanged signal in that case, the onLoaded will still be invoked.
diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp
index 1ffd3bd..fc3954f 100644
--- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp
+++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp
@@ -477,7 +477,8 @@ void QDeclarativeRectangle::drawRect(QPainter &p)
{
Q_D(QDeclarativeRectangle);
if ((d->gradient && d->gradient->gradient())
- || d->radius > width()/2 || d->radius > height()/2) {
+ || d->radius > width()/2 || d->radius > height()/2
+ || width() < 3 || height() < 3) {
// XXX This path is still slower than the image path
// Image path won't work for gradients or invalid radius though
bool oldAA = p.testRenderHint(QPainter::Antialiasing);
diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp
index 03c9765..82c444e 100644
--- a/src/declarative/graphicsitems/qdeclarativetext.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetext.cpp
@@ -219,6 +219,7 @@ void QDeclarativeTextPrivate::updateSize()
QFontMetrics fm(font);
if (text.isEmpty()) {
+ q->setImplicitWidth(0);
q->setImplicitHeight(fm.height());
emit q->paintedSizeChanged();
q->update();
@@ -284,37 +285,58 @@ QSize QDeclarativeTextPrivate::setupTextLayout()
{
// ### text layout handling should be profiled and optimized as needed
// what about QStackTextEngine engine(tmp, d->font.font()); QTextLayout textLayout(&engine);
-
Q_Q(QDeclarativeText);
layout.setCacheEnabled(true);
qreal height = 0;
+ qreal widthUsed = 0;
qreal lineWidth = 0;
//set manual width
- if (q->widthValid())
+ if ((wrapMode != QDeclarativeText::NoWrap || elideMode != QDeclarativeText::ElideNone) && q->widthValid())
lineWidth = q->width();
QTextOption textOption = layout.textOption();
textOption.setWrapMode(QTextOption::WrapMode(wrapMode));
- textOption.setAlignment(Qt::Alignment(hAlign));
layout.setTextOption(textOption);
layout.beginLayout();
- while (1) {
+ forever {
QTextLine line = layout.createLine();
if (!line.isValid())
break;
- if (q->widthValid()) {
+ if (lineWidth)
line.setLineWidth(lineWidth);
- line.setPosition(QPointF(0, height));
- height += line.height();
- }
}
layout.endLayout();
- return QSize(qCeil(layout.boundingRect().width()), layout.boundingRect().height());
+ for (int i = 0; i < layout.lineCount(); ++i) {
+ QTextLine line = layout.lineAt(i);
+ widthUsed = qMax(widthUsed, line.naturalTextWidth());
+ }
+
+ qreal layoutWidth = q->widthValid() ? q->width() : widthUsed;
+
+ qreal x = 0;
+ for (int i = 0; i < layout.lineCount(); ++i) {
+ QTextLine line = layout.lineAt(i);
+ line.setPosition(QPointF(0, height));
+ height += line.height();
+
+ if (!cacheAllTextAsImage) {
+ if (hAlign == QDeclarativeText::AlignLeft) {
+ x = 0;
+ } else if (hAlign == QDeclarativeText::AlignRight) {
+ x = layoutWidth - line.naturalTextWidth();
+ } else if (hAlign == QDeclarativeText::AlignHCenter) {
+ x = (layoutWidth - line.naturalTextWidth()) / 2;
+ }
+ line.setPosition(QPointF(x, line.y()));
+ }
+ }
+
+ return layout.boundingRect().toAlignedRect().size();
}
/*!
@@ -326,6 +348,19 @@ QPixmap QDeclarativeTextPrivate::textLayoutImage(bool drawStyle)
//do layout
QSize size = layedOutTextSize;
+ qreal x = 0;
+ for (int i = 0; i < layout.lineCount(); ++i) {
+ QTextLine line = layout.lineAt(i);
+ if (hAlign == QDeclarativeText::AlignLeft) {
+ x = 0;
+ } else if (hAlign == QDeclarativeText::AlignRight) {
+ x = size.width() - line.naturalTextWidth();
+ } else if (hAlign == QDeclarativeText::AlignHCenter) {
+ x = (size.width() - line.naturalTextWidth()) / 2;
+ }
+ line.setPosition(QPointF(x, line.y()));
+ }
+
//paint text
QPixmap img(size);
if (!size.isEmpty()) {
@@ -1028,7 +1063,7 @@ void QDeclarativeText::setTextFormat(TextFormat format)
Set this property to elide parts of the text fit to the Text item's width.
The text will only elide if an explicit width has been set.
- This property cannot be used with wrapping enabled or with rich text.
+ This property cannot be used with multi-line text or with rich text.
Eliding can be:
\list
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
index 2348478..0deacf8 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
@@ -460,10 +460,9 @@ QRect QDeclarativeTextInput::cursorRectangle() const
text edit.
Note that if selectionStart == selectionEnd then there is no current
- selection. If you attempt to set selectionStart to a value outside of
- the current text, selectionStart will not be changed.
+ selection.
- \sa selectionEnd, cursorPosition, selectedText
+ \sa selectionEnd, cursorPosition, selectedText, select()
*/
int QDeclarativeTextInput::selectionStart() const
{
@@ -479,10 +478,9 @@ int QDeclarativeTextInput::selectionStart() const
text edit.
Note that if selectionStart == selectionEnd then there is no current
- selection. If you attempt to set selectionEnd to a value outside of
- the current text, selectionEnd will not be changed.
+ selection.
- \sa selectionStart, cursorPosition, selectedText
+ \sa selectionStart, cursorPosition, selectedText, select()
*/
int QDeclarativeTextInput::selectionEnd() const
{
@@ -490,6 +488,19 @@ int QDeclarativeTextInput::selectionEnd() const
return d->lastSelectionEnd;
}
+/*!
+ \qmlmethod void TextInput::select(int start, int end)
+
+ Causes the text from \a start to \a end to be selected.
+
+ If either start or end is out of range, the selection is not changed.
+
+ After calling this, selectionStart will become the lesser
+ and selectionEnd will become the greater (regardless of the order passed
+ to this method).
+
+ \sa selectionStart, selectionEnd
+*/
void QDeclarativeTextInput::select(int start, int end)
{
Q_D(QDeclarativeTextInput);
diff --git a/src/declarative/graphicsitems/qdeclarativetextlayout.cpp b/src/declarative/graphicsitems/qdeclarativetextlayout.cpp
index 89a2158..e8da367 100644
--- a/src/declarative/graphicsitems/qdeclarativetextlayout.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextlayout.cpp
@@ -94,7 +94,7 @@ class DrawTextItemRecorder: public QPaintEngine
if (!m_inertText->items.isEmpty()) {
QStaticTextItem &last = m_inertText->items[m_inertText->items.count() - 1];
- if (last.fontEngine == ti.fontEngine && last.font == ti.font() &&
+ if (last.fontEngine() == ti.fontEngine && last.font == ti.font() &&
(!m_dirtyPen || last.color == state->pen().color())) {
needFreshCurrentItem = false;
@@ -107,7 +107,7 @@ class DrawTextItemRecorder: public QPaintEngine
if (needFreshCurrentItem) {
QStaticTextItem currentItem;
- currentItem.fontEngine = ti.fontEngine;
+ currentItem.setFontEngine(ti.fontEngine);
currentItem.font = ti.font();
currentItem.charOffset = charOffset;
currentItem.numChars = ti.num_chars;
@@ -285,6 +285,19 @@ void QDeclarativeTextLayout::beginLayout()
QTextLayout::beginLayout();
}
+void QDeclarativeTextLayout::clearLayout()
+{
+ if (d && d->cached) {
+ d->cached = false;
+ d->items.clear();
+ d->positions.clear();
+ d->glyphs.clear();
+ d->chars.clear();
+ d->position = QPointF();
+ }
+ QTextLayout::clearLayout();
+}
+
void QDeclarativeTextLayout::prepare()
{
if (!d || !d->cached) {
diff --git a/src/declarative/graphicsitems/qdeclarativetextlayout_p.h b/src/declarative/graphicsitems/qdeclarativetextlayout_p.h
index 90bf0e0..8b81db3 100644
--- a/src/declarative/graphicsitems/qdeclarativetextlayout_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetextlayout_p.h
@@ -59,6 +59,7 @@ public:
~QDeclarativeTextLayout();
void beginLayout();
+ void clearLayout();
void prepare();
void draw(QPainter *, const QPointF & = QPointF());
diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp
index 0a2a6db..2686ce3 100644
--- a/src/declarative/qml/qdeclarativecomponent.cpp
+++ b/src/declarative/qml/qdeclarativecomponent.cpp
@@ -98,6 +98,43 @@ class QByteArray;
int width = item->width(); // width = 200
\endcode
+
+ \section2 Network Components
+
+ If the URL passed to QDeclarativeComponent is a network resource, or if the QML document references a
+ network resource, the QDeclarativeComponent has to fetch the network data before it is able to create
+ objects. In this case, the QDeclarativeComponent will have a \l {QDeclarativeComponent::Loading}{Loading}
+ \l {QDeclarativeComponent::status()}{status}. An application will have to wait until the component
+ is \l {QDeclarativeComponent::Ready}{Ready} before calling \l {QDeclarativeComponent::create()}.
+
+ The following example shows how to load a QML file from a network resource. After creating
+ the QDeclarativeComponent, it tests whether the component is loading. If it is, it connects to the
+ QDeclarativeComponent::statusChanged() signal and otherwise calls the \c {continueLoading()} method
+ directly. Note that QDeclarativeComponent::isLoading() may be false for a network component if the
+ component has been cached and is ready immediately.
+
+ \code
+ MyApplication::MyApplication()
+ {
+ // ...
+ component = new QDeclarativeComponent(engine, QUrl("http://www.example.com/main.qml"));
+ if (component->isLoading())
+ QObject::connect(component, SIGNAL(statusChanged(QDeclarativeComponent::Status)),
+ this, SLOT(continueLoading()));
+ else
+ continueLoading();
+ }
+
+ void MyApplication::continueLoading()
+ {
+ if (component->isError()) {
+ qWarning() << component->errors();
+ } else {
+ QObject *myObject = component->create();
+ }
+ }
+ \endcode
+
\sa {Using QML in C++ Applications}, {Integrating QML with existing Qt UI code}
*/
diff --git a/src/declarative/qml/qdeclarativecontext.cpp b/src/declarative/qml/qdeclarativecontext.cpp
index 59d5cfa..1e58a71 100644
--- a/src/declarative/qml/qdeclarativecontext.cpp
+++ b/src/declarative/qml/qdeclarativecontext.cpp
@@ -86,9 +86,14 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate()
QDeclarativeComponent component(&engine);
component.setData("import QtQuick 1.0\nListView { model: myModel }", QUrl());
- component.create(context);
+ QObject *window = component.create(context);
\endcode
+ Note it is the responsibility of the creator to delete any QDeclarativeContext it
+ constructs. If the \c context object in the example is no longer needed when the
+ \c window component instance is destroyed, the \c context must be destroyed explicitly.
+ The simplest way to ensure this is to set \c window as the parent of \c context.
+
To simplify binding and maintaining larger data sets, a context object can be set
on a QDeclarativeContext. All the properties of the context object are available
by name in the context, as though they were all individually added through calls
@@ -119,11 +124,13 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate()
All properties added explicitly by QDeclarativeContext::setContextProperty() take
precedence over the context object's properties.
- Contexts form a hierarchy. The root of this hierarchy is the QDeclarativeEngine's
- \l {QDeclarativeEngine::rootContext()}{root context}. A component instance can
- access the data in its own context, as well as all its ancestor contexts. Data
- can be made available to all instances by modifying the
- \l {QDeclarativeEngine::rootContext()}{root context}.
+ \section2 The Context Hierarchy
+
+ Contexts form a hierarchy. The root of this hierarchy is the QML engine's
+ \l {QDeclarativeEngine::rootContext()}{root context}. Child contexts inherit
+ the context properties of their parents; if a child context sets a context property
+ that already exists in its parent, the new context property overrides that of the
+ parent.
The following example defines two contexts - \c context1 and \c context2. The
second context overrides the "b" context property inherited from the first with a
@@ -144,7 +151,7 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate()
context, their bindings are. If a context is destroyed, the property bindings of
outstanding QML objects will stop evaluating.
- \note Setting the context object or adding new context properties after an object
+ \warning Setting the context object or adding new context properties after an object
has been created in that context is an expensive operation (essentially forcing all bindings
to reevaluate). Thus whenever possible you should complete "setup" of the context
before using it to create any objects.
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index a11455d..cd11336 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -176,6 +176,7 @@ struct StaticQtMetaObject : public QObject
};
static bool qt_QmlQtModule_registered = false;
+bool QDeclarativeEnginePrivate::qml_debugging_enabled = false;
void QDeclarativeEnginePrivate::defineModule()
{
diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h
index 8539fbf..deb4a77 100644
--- a/src/declarative/qml/qdeclarativeengine_p.h
+++ b/src/declarative/qml/qdeclarativeengine_p.h
@@ -321,6 +321,8 @@ public:
static QString urlToLocalFileOrQrc(const QUrl& url);
static void defineModule();
+
+ static bool qml_debugging_enabled;
};
/*!
diff --git a/src/declarative/qml/qdeclarativeenginedebug.cpp b/src/declarative/qml/qdeclarativeenginedebug.cpp
index ed28185..bffe681 100644
--- a/src/declarative/qml/qdeclarativeenginedebug.cpp
+++ b/src/declarative/qml/qdeclarativeenginedebug.cpp
@@ -502,7 +502,8 @@ void QDeclarativeEngineDebugServer::setBinding(int objectId,
property.write(expression);
} else if (hasValidSignal(object, propertyName)) {
QDeclarativeExpression *declarativeExpression = new QDeclarativeExpression(context, object, expression.toString());
- QDeclarativePropertyPrivate::setSignalExpression(property, declarativeExpression);
+ QDeclarativeExpression *oldExpression = QDeclarativePropertyPrivate::setSignalExpression(property, declarativeExpression);
+ declarativeExpression->setSourceLocation(oldExpression->sourceFile(), oldExpression->lineNumber());
} else if (property.isProperty()) {
QDeclarativeBinding *binding = new QDeclarativeBinding(expression.toString(), object, context);
binding->setTarget(property);
diff --git a/src/declarative/qml/qdeclarativeparser_p.h b/src/declarative/qml/qdeclarativeparser_p.h
index b4753df..77184c2 100644
--- a/src/declarative/qml/qdeclarativeparser_p.h
+++ b/src/declarative/qml/qdeclarativeparser_p.h
@@ -356,7 +356,7 @@ namespace QDeclarativeParser
// True if the setting of this property will be deferred. Set by the
// QDeclarativeCompiler
bool isDeferred;
- // True if this property is a value-type psuedo-property
+ // True if this property is a value-type pseudo-property
bool isValueTypeSubProperty;
LocationSpan location;
diff --git a/src/declarative/qml/qdeclarativeprivate.h b/src/declarative/qml/qdeclarativeprivate.h
index d45ddbc..388c92e 100644
--- a/src/declarative/qml/qdeclarativeprivate.h
+++ b/src/declarative/qml/qdeclarativeprivate.h
@@ -55,9 +55,6 @@
#include <QtCore/qglobal.h>
#include <QtCore/qvariant.h>
-#ifndef Q_OS_WIN
-#include <stdint.h>
-#endif
QT_BEGIN_HEADER
@@ -105,7 +102,7 @@ namespace QDeclarativePrivate
template<class From, class To>
struct StaticCastSelectorClass<From, To, sizeof(int)>
{
- static inline int cast() { return int(reinterpret_cast<intptr_t>(static_cast<To *>(reinterpret_cast<From *>(0x10000000)))) - 0x10000000; }
+ static inline int cast() { return int(reinterpret_cast<quintptr>(static_cast<To *>(reinterpret_cast<From *>(0x10000000)))) - 0x10000000; }
};
template<class From, class To>
diff --git a/src/declarative/qml/qdeclarativeworkerscript.cpp b/src/declarative/qml/qdeclarativeworkerscript.cpp
index 509ca6b..ae7a80d 100644
--- a/src/declarative/qml/qdeclarativeworkerscript.cpp
+++ b/src/declarative/qml/qdeclarativeworkerscript.cpp
@@ -514,7 +514,7 @@ void QDeclarativeWorkerScriptEngine::run()
/*!
\qmlclass WorkerScript QDeclarativeWorkerScript
- \ingroup qml-utility-elements
+ \ingroup qml-utility-elements
\brief The WorkerScript element enables the use of threads in QML.
Use WorkerScript to run operations in a new thread.
@@ -528,7 +528,7 @@ void QDeclarativeWorkerScriptEngine::run()
\snippet doc/src/snippets/declarative/workerscript.qml 0
- The above worker script specifies a javascript file, "script.js", that handles
+ The above worker script specifies a JavaScript file, "script.js", that handles
the operations to be performed in the new thread. Here is \c script.js:
\qml
@@ -543,6 +543,19 @@ void QDeclarativeWorkerScriptEngine::run()
\tt script.js. This in turn sends a reply message that is then received
by the \tt onMessage() handler of \tt myWorker.
+
+ \section3 Restrictions
+
+ Since the \c WorkerScript.onMessage() function is run in a separate thread, the
+ JavaScript file is evaluated in a context separate from the main QML engine. This means
+ that unlike an ordinary JavaScript file that is imported into QML, the \c script.js
+ in the above example cannot access the properties, methods or other attributes
+ of the QML item, nor can it access any context properties set on the QML object
+ through QDeclarativeContext.
+
+ Additionally, there are restrictions on the types of values that can be passed to and
+ from the worker script. See the sendMessage() documentation for details.
+
\sa {declarative/threading/workerscript}{WorkerScript example},
{declarative/threading/threadedlistmodel}{Threaded ListModel example}
*/
@@ -586,6 +599,19 @@ void QDeclarativeWorkerScript::setSource(const QUrl &source)
Sends the given \a message to a worker script handler in another
thread. The other worker script handler can receive this message
through the onMessage() handler.
+
+ The \c message object may only contain values of the following
+ types:
+
+ \list
+ \o boolean, number, string
+ \o JavaScript objects and arrays
+ \o ListModel objects (any other type of QObject* is not allowed)
+ \endlist
+
+ All objects and arrays are copied to the \c message. With the exception
+ of ListModel objects, any modifications by the other thread to an object
+ passed in \c message will not be reflected in the original object.
*/
void QDeclarativeWorkerScript::sendMessage(const QScriptValue &message)
{
diff --git a/src/declarative/qml/qmetaobjectbuilder.cpp b/src/declarative/qml/qmetaobjectbuilder.cpp
index 58f8811..dfe89f8 100644
--- a/src/declarative/qml/qmetaobjectbuilder.cpp
+++ b/src/declarative/qml/qmetaobjectbuilder.cpp
@@ -41,10 +41,6 @@
#include "private/qmetaobjectbuilder_p.h"
-#ifndef Q_OS_WIN
-#include <stdint.h>
-#endif
-
QT_BEGIN_NAMESPACE
/*!
@@ -1264,8 +1260,8 @@ static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf,
char *str = reinterpret_cast<char *>(buf + size);
if (buf) {
if (relocatable) {
- meta->d.stringdata = reinterpret_cast<const char *>((intptr_t)size);
- meta->d.data = reinterpret_cast<uint *>((intptr_t)pmetaSize);
+ meta->d.stringdata = reinterpret_cast<const char *>((quintptr)size);
+ meta->d.data = reinterpret_cast<uint *>((quintptr)pmetaSize);
} else {
meta->d.stringdata = str;
meta->d.data = reinterpret_cast<uint *>(data);
@@ -1502,8 +1498,8 @@ void QMetaObjectBuilder::fromRelocatableData(QMetaObject *output,
const char *buf = data.constData();
const QMetaObject *dataMo = reinterpret_cast<const QMetaObject *>(buf);
- intptr_t stringdataOffset = (intptr_t)dataMo->d.stringdata;
- intptr_t dataOffset = (intptr_t)dataMo->d.data;
+ quintptr stringdataOffset = (quintptr)dataMo->d.stringdata;
+ quintptr dataOffset = (quintptr)dataMo->d.data;
output->d.superdata = superclass;
output->d.stringdata = buf + stringdataOffset;
diff --git a/src/declarative/util/qdeclarativefontloader.cpp b/src/declarative/util/qdeclarativefontloader.cpp
index 9fee257..03a0561 100644
--- a/src/declarative/util/qdeclarativefontloader.cpp
+++ b/src/declarative/util/qdeclarativefontloader.cpp
@@ -297,23 +297,25 @@ void QDeclarativeFontLoader::setName(const QString &name)
Use this status to provide an update or respond to the status change in some way.
For example, you could:
- \e {Trigger a state change:}
- \qml
- State { name: 'loaded'; when: loader.status = FontLoader.Ready }
+ \list
+ \o Trigger a state change:
+ \qml
+ State { name: 'loaded'; when: loader.status == FontLoader.Ready }
\endqml
- \e {Implement an \c onStatusChanged signal handler:}
- \qml
+ \o Implement an \c onStatusChanged signal handler:
+ \qml
FontLoader {
id: loader
onStatusChanged: if (loader.status == FontLoader.Ready) console.log('Loaded')
}
\endqml
- \e {Bind to the status value:}
+ \o Bind to the status value:
\qml
- Text { text: loader.status != FontLoader.Ready ? 'Not Loaded' : 'Loaded' }
+ Text { text: loader.status == FontLoader.Ready ? 'Loaded' : 'Not loaded' }
\endqml
+ \endlist
*/
QDeclarativeFontLoader::Status QDeclarativeFontLoader::status() const
{
diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp
index 0f5413e..3915485 100644
--- a/src/declarative/util/qdeclarativestate.cpp
+++ b/src/declarative/util/qdeclarativestate.cpp
@@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE
DEFINE_BOOL_CONFIG_OPTION(stateChangeDebug, STATECHANGE_DEBUG);
QDeclarativeAction::QDeclarativeAction()
-: restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false), fromBinding(0), toBinding(0), event(0),
+: restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false), fromBinding(0), event(0),
specifiedObject(0)
{
}
@@ -67,7 +67,7 @@ QDeclarativeAction::QDeclarativeAction(QObject *target, const QString &propertyN
const QVariant &value)
: restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false),
property(target, propertyName), toValue(value),
- fromBinding(0), toBinding(0), event(0),
+ fromBinding(0), event(0),
specifiedObject(target), specifiedProperty(propertyName)
{
if (property.isValid())
@@ -78,7 +78,7 @@ QDeclarativeAction::QDeclarativeAction(QObject *target, const QString &propertyN
QDeclarativeContext *context, const QVariant &value)
: restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false),
property(target, propertyName, context), toValue(value),
- fromBinding(0), toBinding(0), event(0),
+ fromBinding(0), event(0),
specifiedObject(target), specifiedProperty(propertyName)
{
if (property.isValid())
@@ -503,11 +503,11 @@ void QDeclarativeState::addEntriesToRevertList(const QList<QDeclarativeAction> &
const QDeclarativeAction &action = actionListIterator.next();
QDeclarativeSimpleAction simpleAction(action);
action.property.write(action.toValue);
- if (action.toBinding) {
+ if (!action.toBinding.isNull()) {
QDeclarativeAbstractBinding *oldBinding = QDeclarativePropertyPrivate::binding(simpleAction.property());
if (oldBinding)
QDeclarativePropertyPrivate::setBinding(simpleAction.property(), 0);
- QDeclarativePropertyPrivate::setBinding(simpleAction.property(), action.toBinding, QDeclarativePropertyPrivate::DontRemoveBinding);
+ QDeclarativePropertyPrivate::setBinding(simpleAction.property(), action.toBinding.data(), QDeclarativePropertyPrivate::DontRemoveBinding);
}
simpleActionList.append(simpleAction);
@@ -675,7 +675,7 @@ void QDeclarativeState::apply(QDeclarativeStateGroup *group, QDeclarativeTransit
a.property = d->revertList.at(ii).property();
a.fromValue = cur;
a.toValue = d->revertList.at(ii).value();
- a.toBinding = d->revertList.at(ii).binding();
+ a.toBinding = QDeclarativeAbstractBinding::getPointer(d->revertList.at(ii).binding());
a.specifiedObject = d->revertList.at(ii).specifiedObject();
a.specifiedProperty = d->revertList.at(ii).specifiedProperty();
a.event = d->revertList.at(ii).event();
diff --git a/src/declarative/util/qdeclarativestate_p.h b/src/declarative/util/qdeclarativestate_p.h
index fc7c940..7b9c18a 100644
--- a/src/declarative/util/qdeclarativestate_p.h
+++ b/src/declarative/util/qdeclarativestate_p.h
@@ -45,6 +45,7 @@
#include <qdeclarative.h>
#include <qdeclarativeproperty.h>
#include <QtCore/qobject.h>
+#include <private/qdeclarativebinding_p.h>
#include <private/qdeclarativeglobal_p.h>
QT_BEGIN_HEADER
@@ -75,7 +76,7 @@ public:
QVariant toValue;
QDeclarativeAbstractBinding *fromBinding;
- QDeclarativeAbstractBinding *toBinding;
+ QDeclarativeAbstractBinding::Pointer toBinding;
QDeclarativeActionEvent *event;
//strictly for matching
diff --git a/src/declarative/util/qdeclarativestate_p_p.h b/src/declarative/util/qdeclarativestate_p_p.h
index 4fd8f21..98c3f7b 100644
--- a/src/declarative/util/qdeclarativestate_p_p.h
+++ b/src/declarative/util/qdeclarativestate_p_p.h
@@ -85,7 +85,7 @@ public:
m_reverseEvent = true;
} else {
m_value = a.toValue;
- m_binding = QDeclarativeAbstractBinding::getPointer(a.toBinding);
+ m_binding = a.toBinding;
m_reverseEvent = false;
}
}
diff --git a/src/declarative/util/qdeclarativetransition.cpp b/src/declarative/util/qdeclarativetransition.cpp
index 478c7f4..c8bc7b3 100644
--- a/src/declarative/util/qdeclarativetransition.cpp
+++ b/src/declarative/util/qdeclarativetransition.cpp
@@ -86,12 +86,16 @@ QT_BEGIN_NAMESPACE
Item {
...
transitions: [
- Transition { ... },
+ Transition { to: "state1" ... },
Transition { ... }
]
}
\endqml
+ If multiple Transitions are specified, only a single (best-matching) Transition will be applied for any particular
+ state change. In the example above, when changing to \c state1, the first transition will be used, rather
+ than the more generic second transition.
+
If a state change has a Transition that matches the same property as a
\l Behavior, the Transition animation overrides the \l Behavior for that
state change.
diff --git a/src/declarative/util/qdeclarativetransitionmanager.cpp b/src/declarative/util/qdeclarativetransitionmanager.cpp
index 89b0044..d19e6f2 100644
--- a/src/declarative/util/qdeclarativetransitionmanager.cpp
+++ b/src/declarative/util/qdeclarativetransitionmanager.cpp
@@ -99,8 +99,8 @@ void QDeclarativeTransitionManager::complete()
void QDeclarativeTransitionManagerPrivate::applyBindings()
{
foreach(const QDeclarativeAction &action, bindingsList) {
- if (action.toBinding) {
- QDeclarativePropertyPrivate::setBinding(action.property, action.toBinding);
+ if (!action.toBinding.isNull()) {
+ QDeclarativePropertyPrivate::setBinding(action.property, action.toBinding.data());
} else if (action.event) {
if (action.reverseEvent)
action.event->reverse();
@@ -145,8 +145,8 @@ void QDeclarativeTransitionManager::transition(const QList<QDeclarativeAction> &
// Apply all the property and binding changes
for (int ii = 0; ii < applyList.size(); ++ii) {
const QDeclarativeAction &action = applyList.at(ii);
- if (action.toBinding) {
- QDeclarativePropertyPrivate::setBinding(action.property, action.toBinding, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding);
+ if (!action.toBinding.isNull()) {
+ QDeclarativePropertyPrivate::setBinding(action.property, action.toBinding.data(), QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding);
} else if (!action.event) {
QDeclarativePropertyPrivate::write(action.property, action.toValue, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding);
} else if (action.event->isReversable()) {
@@ -165,7 +165,7 @@ void QDeclarativeTransitionManager::transition(const QList<QDeclarativeAction> &
continue;
}
const QDeclarativeProperty &prop = action->property;
- if (action->toBinding || !action->toValue.isValid()) {
+ if (!action->toBinding.isNull() || !action->toValue.isValid()) {
action->toValue = prop.read();
}
}
@@ -259,10 +259,10 @@ void QDeclarativeTransitionManager::cancel()
for(int i = 0; i < d->bindingsList.count(); ++i) {
QDeclarativeAction action = d->bindingsList[i];
- if (action.toBinding && action.deletableToBinding) {
+ if (!action.toBinding.isNull() && action.deletableToBinding) {
QDeclarativePropertyPrivate::setBinding(action.property, 0);
- action.toBinding->destroy();
- action.toBinding = 0;
+ action.toBinding.data()->destroy();
+ action.toBinding.clear();
action.deletableToBinding = false;
} else if (action.event) {
//### what do we do here?
diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp
index 2a82427..66cb843 100644
--- a/src/gui/egl/qegl.cpp
+++ b/src/gui/egl/qegl.cpp
@@ -210,7 +210,7 @@ EGLConfig QEgl::defaultConfig(int devType, API api, ConfigOptions options)
else
configId = qgetenv("QT_GL_EGL_CONFIG");
if (!configId.isEmpty()) {
- // Overriden, so get the EGLConfig for the specified config ID:
+ // Overridden, so get the EGLConfig for the specified config ID:
EGLint properties[] = {
EGL_CONFIG_ID, (EGLint)configId.toInt(),
EGL_NONE
@@ -267,7 +267,7 @@ EGLConfig QEgl::defaultConfig(int devType, API api, ConfigOptions options)
configAttribs.setValue(EGL_STENCIL_SIZE, 1);
configAttribs.setValue(EGL_SAMPLE_BUFFERS, 1);
#ifndef QT_OPENGL_ES_2
- // Aditionally, the GL1 engine likes to have a depth buffer for clipping
+ // Additionally, the GL1 engine likes to have a depth buffer for clipping
configAttribs.setValue(EGL_DEPTH_SIZE, 1);
#endif
}
diff --git a/src/gui/graphicsview/qgraphicsproxywidget.cpp b/src/gui/graphicsview/qgraphicsproxywidget.cpp
index ce63659..bf61150 100644
--- a/src/gui/graphicsview/qgraphicsproxywidget.cpp
+++ b/src/gui/graphicsview/qgraphicsproxywidget.cpp
@@ -1508,7 +1508,7 @@ int QGraphicsProxyWidget::type() const
Creates a proxy widget for the given \a child of the widget
contained in this proxy.
- This function makes it possible to aquire proxies for
+ This function makes it possible to acquire proxies for
non top-level widgets. For instance, you can embed a dialog,
and then transform only one of its widgets.
diff --git a/src/gui/graphicsview/qgraphicssceneevent.cpp b/src/gui/graphicsview/qgraphicssceneevent.cpp
index a0ecd4c..d9ff655 100644
--- a/src/gui/graphicsview/qgraphicssceneevent.cpp
+++ b/src/gui/graphicsview/qgraphicssceneevent.cpp
@@ -1629,7 +1629,7 @@ QGraphicsSceneMoveEvent::~QGraphicsSceneMoveEvent()
}
/*!
- Returns the old position (i.e., the position immediatly before the widget
+ Returns the old position (i.e., the position immediately before the widget
was moved).
\sa newPos(), QGraphicsItem::setPos()
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp
index 0d39bb5..73f1493 100644
--- a/src/gui/graphicsview/qgraphicsview.cpp
+++ b/src/gui/graphicsview/qgraphicsview.cpp
@@ -80,9 +80,7 @@ static const int QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS = 503; // largest prime <
yourself, you can call setSceneRect(). This will adjust the scroll bars'
ranges appropriately. Note that although the scene supports a virtually
unlimited size, the range of the scroll bars will never exceed the range of
- an integer (INT_MIN, INT_MAX). When the scene is larger than the scroll
- bars' values, you can choose to use translate() to navigate the scene
- instead.
+ an integer (INT_MIN, INT_MAX).
QGraphicsView visualizes the scene by calling render(). By default, the
items are drawn onto the viewport by using a regular QPainter, and using
@@ -101,7 +99,8 @@ static const int QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS = 503; // largest prime <
convenience functions rotate(), scale(), translate() or shear(). The most
two common transformations are scaling, which is used to implement
zooming, and rotation. QGraphicsView keeps the center of the view fixed
- during a transformation.
+ during a transformation. Because of the scene alignment (setAligment()),
+ translating the view will have no visual impact.
You can interact with the items on the scene by using the mouse and
keyboard. QGraphicsView translates the mouse and key events into \e scene
diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp
index 4a733be..e48f9a7 100644
--- a/src/gui/graphicsview/qgraphicswidget.cpp
+++ b/src/gui/graphicsview/qgraphicswidget.cpp
@@ -450,7 +450,7 @@ void QGraphicsWidget::setGeometry(const QRectF &rect)
bottom.
Contents margins are used by the assigned layout to define the placement
- of subwidgets and layouts. Margins are particularily useful for widgets
+ of subwidgets and layouts. Margins are particularly useful for widgets
that constrain subwidgets to only a section of its own geometry. For
example, a group box with a layout will place subwidgets inside its frame,
but below the title.
diff --git a/src/gui/image/qimage_ssse3.cpp b/src/gui/image/qimage_ssse3.cpp
index 9aed011..836d7b0 100644
--- a/src/gui/image/qimage_ssse3.cpp
+++ b/src/gui/image/qimage_ssse3.cpp
@@ -54,7 +54,7 @@ Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32_ssse3(quint32 *dst, con
{
quint32 *const end = dst + len;
- // Prologue, align dst to 16 bytes. The alignement is done on dst because it has 4 store()
+ // Prologue, align dst to 16 bytes. The alignment is done on dst because it has 4 store()
// for each 3 load() of src.
const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3;
const int prologLength = qMin(len, offsetToAlignOn16Bytes);
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 1b370c0..9fd10ae 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -1110,6 +1110,9 @@ QPixmap QPixmap::grabWidget(QWidget * widget, const QRect &rect)
return QPixmap();
QPixmap res(r.size());
+ if (!qt_widget_private(widget)->isOpaque)
+ res.fill(Qt::transparent);
+
widget->d_func()->render(&res, QPoint(), r, QWidget::DrawWindowBackground
| QWidget::DrawChildren | QWidget::IgnoreMask, true);
return res;
diff --git a/src/gui/image/qxpmhandler.cpp b/src/gui/image/qxpmhandler.cpp
index b97afd3..453100c 100644
--- a/src/gui/image/qxpmhandler.cpp
+++ b/src/gui/image/qxpmhandler.cpp
@@ -766,7 +766,7 @@ static bool qt_get_named_xpm_rgb(const char *name_no_space, QRgb *rgb)
{
XPMRGBData x;
x.name = name_no_space;
- // Funtion bsearch() is supposed to be
+ // Function bsearch() is supposed to be
// void *bsearch(const void *key, const void *base, ...
// So why (char*)? Are there broken bsearch() declarations out there?
XPMRGBData *r = (XPMRGBData *)bsearch((char *)&x, (char *)xpmRgbTbl, xpmRgbTblSize,
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index a9612a2..8af6013 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -1169,7 +1169,7 @@ QAbstractItemView::EditTriggers QAbstractItemView::editTriggers() const
\property QAbstractItemView::verticalScrollMode
\brief how the view scrolls its contents in the vertical direction
- This property controlls how the view scroll its contents vertically.
+ This property controls how the view scroll its contents vertically.
Scrolling can be done either per pixel or per item.
*/
@@ -1195,7 +1195,7 @@ QAbstractItemView::ScrollMode QAbstractItemView::verticalScrollMode() const
\property QAbstractItemView::horizontalScrollMode
\brief how the view scrolls its contents in the horizontal direction
- This property controlls how the view scroll its contents horizontally.
+ This property controls how the view scroll its contents horizontally.
Scrolling can be done either per pixel or per item.
*/
@@ -1278,7 +1278,7 @@ bool QAbstractItemView::hasAutoScroll() const
\property QAbstractItemView::autoScrollMargin
\brief the size of the area when auto scrolling is triggered
- This property controlls the size of the area at the edge of the viewport that
+ This property controls the size of the area at the edge of the viewport that
triggers autoscrolling. The default value is 16 pixels.
*/
void QAbstractItemView::setAutoScrollMargin(int margin)
diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp
index d8fef55..d1022f1 100644
--- a/src/gui/itemviews/qtableview.cpp
+++ b/src/gui/itemviews/qtableview.cpp
@@ -114,7 +114,7 @@ void QSpanCollection::updateSpan(QSpanCollection::Span *span, int old_height)
}
} else if (old_height > span->height()) {
//remove the span from all the subspans lists that intersect the columns not covered anymore
- Index::iterator it_y = index.lowerBound(-qMax(span->bottom(), span->top())); //qMax usefull if height is 0
+ Index::iterator it_y = index.lowerBound(-qMax(span->bottom(), span->top())); //qMax useful if height is 0
Q_ASSERT(it_y != index.end()); //it_y must exist since the span is in the list
while (-it_y.key() <= span->top() + old_height -1) {
if (-it_y.key() > span->bottom()) {
@@ -1404,7 +1404,7 @@ void QTableView::paintEvent(QPaintEvent *event)
}
if (showGrid) {
- // Find the bottom right (the last rows/coloumns might be hidden)
+ // Find the bottom right (the last rows/columns might be hidden)
while (verticalHeader->isSectionHidden(verticalHeader->logicalIndex(bottom))) --bottom;
QPen old = painter.pen();
painter.setPen(gridPen);
diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm
index e5364d0..3aafeb4 100644
--- a/src/gui/kernel/qapplication_mac.mm
+++ b/src/gui/kernel/qapplication_mac.mm
@@ -549,7 +549,7 @@ void qt_mac_update_os_settings()
FontMap("QTipLabel", kThemeSmallSystemFont),
FontMap("QLabel", kThemeSystemFont),
FontMap("QToolButton", kThemeSmallSystemFont),
- FontMap("QMenuItem", kThemeMenuItemCmdKeyFont), // It doesn't exist, but its unique.
+ FontMap("QMenuItem", kThemeMenuItemFont), // It doesn't exist, but its unique.
FontMap("QComboLineEdit", kThemeViewsFont), // It doesn't exist, but its unique.
FontMap("QSmallFont", kThemeSmallSystemFont), // It doesn't exist, but its unique.
FontMap("QMiniFont", kThemeMiniSystemFont), // It doesn't exist, but its unique.
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 96856b8..f352871 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -1425,7 +1425,7 @@ void qt_init(QApplicationPrivate * /* priv */, int)
TInt err = CApaCommandLine::GetCommandLineFromProcessEnvironment(commandLine);
// After this construction, CEikonEnv will be available from CEikonEnv::Static().
// (much like our qApp).
- CEikonEnv* coe = new CEikonEnv;
+ QtEikonEnv* coe = new QtEikonEnv;
//not using QT_TRAP_THROWING, because coe owns the cleanupstack so it can't be pushed there.
if(err == KErrNone)
TRAP(err, coe->ConstructAppFromCommandLineL(factory,*commandLine));
diff --git a/src/gui/kernel/qeventdispatcher_s60.cpp b/src/gui/kernel/qeventdispatcher_s60.cpp
index bc787b8..77ebd0d 100644
--- a/src/gui/kernel/qeventdispatcher_s60.cpp
+++ b/src/gui/kernel/qeventdispatcher_s60.cpp
@@ -45,6 +45,62 @@
QT_BEGIN_NAMESPACE
+QtEikonEnv::QtEikonEnv()
+ : m_lastIterationCount(0)
+ , m_savedStatusCode(KRequestPending)
+ , m_hasAlreadyRun(false)
+{
+}
+
+QtEikonEnv::~QtEikonEnv()
+{
+}
+
+void QtEikonEnv::RunL()
+{
+ QEventDispatcherS60 *dispatcher = qobject_cast<QEventDispatcherS60 *>(QAbstractEventDispatcher::instance());
+ if (!dispatcher) {
+ CEikonEnv::RunL();
+ return;
+ }
+
+ if (m_lastIterationCount != dispatcher->iterationCount()) {
+ m_hasAlreadyRun = false;
+ m_lastIterationCount = dispatcher->iterationCount();
+ }
+
+ if (m_hasAlreadyRun) {
+ // Fool the active scheduler into believing we are still waiting for events.
+ // The window server thinks we are not, however.
+ m_savedStatusCode = iStatus.Int();
+ iStatus = KRequestPending;
+ SetActive();
+ dispatcher->queueDeferredActiveObjectsCompletion();
+ } else {
+ m_hasAlreadyRun = true;
+ CEikonEnv::RunL();
+ }
+}
+
+void QtEikonEnv::DoCancel()
+{
+ complete();
+
+ CEikonEnv::DoCancel();
+}
+
+void QtEikonEnv::complete()
+{
+ if (m_hasAlreadyRun) {
+ if (m_savedStatusCode != KRequestPending) {
+ TRequestStatus *status = &iStatus;
+ QEventDispatcherSymbian::RequestComplete(status, m_savedStatusCode);
+ m_savedStatusCode = KRequestPending;
+ }
+ m_hasAlreadyRun = false;
+ }
+}
+
QEventDispatcherS60::QEventDispatcherS60(QObject *parent)
: QEventDispatcherSymbian(parent),
m_noInputEvents(false)
@@ -127,4 +183,14 @@ void QEventDispatcherS60::removeInputEventsForWidget(QObject *object)
}
}
+// reimpl
+void QEventDispatcherS60::reactivateDeferredActiveObjects()
+{
+ if (S60->qtOwnsS60Environment) {
+ static_cast<QtEikonEnv *>(CCoeEnv::Static())->complete();
+ }
+
+ QEventDispatcherSymbian::reactivateDeferredActiveObjects();
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qeventdispatcher_s60_p.h b/src/gui/kernel/qeventdispatcher_s60_p.h
index d2f327c..c14fef0 100644
--- a/src/gui/kernel/qeventdispatcher_s60_p.h
+++ b/src/gui/kernel/qeventdispatcher_s60_p.h
@@ -56,8 +56,30 @@
#include <private/qeventdispatcher_symbian_p.h>
#include "qt_s60_p.h"
+#include <eikenv.h>
+
QT_BEGIN_NAMESPACE
+class QEventDispatcherS60;
+
+class QtEikonEnv : public CEikonEnv
+{
+public:
+ QtEikonEnv();
+ ~QtEikonEnv();
+
+ // from CActive.
+ void RunL();
+ void DoCancel();
+
+ void complete();
+
+private:
+ int m_lastIterationCount;
+ TInt m_savedStatusCode;
+ bool m_hasAlreadyRun;
+};
+
class Q_GUI_EXPORT QEventDispatcherS60 : public QEventDispatcherSymbian
{
Q_OBJECT
@@ -73,6 +95,8 @@ public:
void saveInputEvent(QSymbianControl *control, QWidget *widget, QInputEvent *event);
+ void reactivateDeferredActiveObjects();
+
private:
bool sendDeferredInputEvents();
diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp
index 8dd2db7..5f1bb85 100644
--- a/src/gui/kernel/qgesturemanager.cpp
+++ b/src/gui/kernel/qgesturemanager.cpp
@@ -171,6 +171,10 @@ void QGestureManager::cleanupCachedGestures(QObject *target, Qt::GestureType typ
foreach (QGesture *g, gestures) {
m_deletedRecognizers.remove(g);
m_gestureToRecognizer.remove(g);
+ m_maybeGestures.remove(g);
+ m_activeGestures.remove(g);
+ m_gestureOwners.remove(g);
+ m_gestureTargets.remove(g);
}
qDeleteAll(gestures);
diff --git a/src/gui/kernel/qmotifdnd_x11.cpp b/src/gui/kernel/qmotifdnd_x11.cpp
index 3334455..3b79129 100644
--- a/src/gui/kernel/qmotifdnd_x11.cpp
+++ b/src/gui/kernel/qmotifdnd_x11.cpp
@@ -385,7 +385,10 @@ static void DndReadSourceProperty(Display * dpy,
static void DndWriteReceiverProperty(Display * dpy, Window window,
unsigned char protocol_style)
{
- DndReceiverProp receiver_prop ;
+ DndReceiverProp receiver_prop;
+
+ // squelch potential valgrind errors about uninitialized reads
+ memset(&receiver_prop, 0, sizeof(receiver_prop));
receiver_prop.byte_order = DndByteOrder() ;
receiver_prop.protocol_version = DND_PROTOCOL_VERSION;
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm
index 5a522f9..48d21e9 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac.mm
+++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm
@@ -79,6 +79,7 @@
#include <qdesktopwidget.h>
#include <qevent.h>
#include <qpixmapcache.h>
+#include <qvarlengtharray.h>
#include <private/qevent_p.h>
#include <private/qt_cocoa_helpers_mac_p.h>
#include <private/qt_mac_p.h>
@@ -616,6 +617,27 @@ Qt::KeyboardModifiers qt_cocoaModifiers2QtModifiers(ulong modifierFlags)
return qtMods;
}
+NSString *qt_mac_removePrivateUnicode(NSString* string)
+{
+ int len = [string length];
+ if (len) {
+ QVarLengthArray <unichar, 10> characters(len);
+ bool changed = false;
+ for (int i = 0; i<len; i++) {
+ characters[i] = [string characterAtIndex:i];
+ // check if they belong to key codes in private unicode range
+ // currently we need to handle only the NSDeleteFunctionKey
+ if (characters[i] == NSDeleteFunctionKey) {
+ characters[i] = NSDeleteCharacter;
+ changed = true;
+ }
+ }
+ if (changed)
+ return [NSString stringWithCharacters:characters.data() length:len];
+ }
+ return string;
+}
+
Qt::KeyboardModifiers qt_cocoaDragOperation2QtModifiers(uint dragOperations)
{
Qt::KeyboardModifiers qtMods =Qt::NoModifier;
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 25450ce..cd1c9f0 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -7053,7 +7053,11 @@ bool QWidget::restoreGeometry(const QByteArray &geometry)
if (maximized || fullScreen) {
// set geomerty before setting the window state to make
// sure the window is maximized to the right screen.
+ // Skip on windows: the window is restored into a broken
+ // half-maximized state.
+#ifndef Q_WS_WIN
setGeometry(restoredNormalGeometry);
+#endif
Qt::WindowStates ws = windowState();
if (maximized)
ws |= Qt::WindowMaximized;
diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp
index 39ed750..c358b9b 100644
--- a/src/gui/kernel/qwidget_win.cpp
+++ b/src/gui/kernel/qwidget_win.cpp
@@ -329,18 +329,11 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
if (topLevel) {
if ((type == Qt::Window || dialog || tool)) {
if (!(flags & Qt::FramelessWindowHint)) {
- if (!(flags & Qt::MSWindowsFixedSizeDialogHint)) {
+ style |= WS_POPUP;
+ if (!(flags & Qt::MSWindowsFixedSizeDialogHint))
style |= WS_THICKFRAME;
- if(!(flags &
- ( Qt::WindowSystemMenuHint
- | Qt::WindowTitleHint
- | Qt::WindowMinMaxButtonsHint
- | Qt::WindowCloseButtonHint
- | Qt::WindowContextHelpButtonHint)))
- style |= WS_POPUP;
- } else {
- style |= WS_POPUP | WS_DLGFRAME;
- }
+ else
+ style |= WS_DLGFRAME;
}
if (flags & Qt::WindowTitleHint)
style |= WS_CAPTION;
@@ -424,6 +417,14 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
if (!q->testAttribute(Qt::WA_Resized)) {
w = sw/2;
h = 4*sh/10;
+ if (extra) {
+ int dx = rect.right - rect.left;
+ int dy = rect.bottom - rect.top;
+ w = qMin(w, extra->maxw + dx);
+ h = qMin(h, extra->maxh + dy);
+ w = qMax(w, extra->minw + dx);
+ h = qMax(h, extra->minh + dy);
+ }
}
if (!wasMoved) {
x = sw/2 - w/2;
diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c
index ec9ebeb..536f265 100644
--- a/src/gui/painting/qgrayraster.c
+++ b/src/gui/painting/qgrayraster.c
@@ -408,25 +408,31 @@
/* */
/* Record the current cell in the table. */
/* */
- static PCell
- gray_find_cell( RAS_ARG )
+ static void
+ gray_record_cell( RAS_ARG )
{
PCell *pcell, cell;
int x = ras.ex;
+ if ( ras.invalid || !( ras.area | ras.cover ) )
+ return;
if ( x > ras.max_ex )
x = ras.max_ex;
pcell = &ras.ycells[ras.ey];
+
for (;;)
{
cell = *pcell;
if ( cell == NULL || cell->x > x )
break;
- if ( cell->x == x )
- goto Exit;
+ if ( cell->x == x ) {
+ cell->area += ras.area;
+ cell->cover += ras.cover;
+ return;
+ }
pcell = &cell->next;
}
@@ -436,28 +442,11 @@
cell = ras.cells + ras.num_cells++;
cell->x = x;
- cell->area = 0;
- cell->cover = 0;
+ cell->area = ras.area;
+ cell->cover = ras.cover;
cell->next = *pcell;
*pcell = cell;
-
- Exit:
- return cell;
- }
-
-
- static void
- gray_record_cell( RAS_ARG )
- {
- if ( !ras.invalid && ( ras.area | ras.cover ) )
- {
- PCell cell = gray_find_cell( RAS_VAR );
-
-
- cell->area += ras.area;
- cell->cover += ras.cover;
- }
}
diff --git a/src/gui/painting/qgrayraster_p.h b/src/gui/painting/qgrayraster_p.h
index ad595b8..d610a9a 100644
--- a/src/gui/painting/qgrayraster_p.h
+++ b/src/gui/painting/qgrayraster_p.h
@@ -91,7 +91,7 @@
/* Minimum buffer size for raster object, that accounts
for TWorker and TCell sizes.*/
-#define MINIMUM_POOL_SIZE 4096
+#define MINIMUM_POOL_SIZE 8192
QT_FT_EXPORT_VAR( const QT_FT_Raster_Funcs ) qt_ft_grays_raster;
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 8088e63..97dfddf 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -874,9 +874,10 @@ void QRasterPaintEngine::updateState()
if (s->dirty & DirtyTransform)
updateMatrix(s->matrix);
- if (s->dirty & (DirtyPen|DirtyCompositionMode)) {
+ if (s->dirty & (DirtyPen|DirtyCompositionMode|DirtyOpacity)) {
const QPainter::CompositionMode mode = s->composition_mode;
s->flags.fast_text = (s->penData.type == QSpanData::Solid)
+ && s->intOpacity == 256
&& (mode == QPainter::CompositionMode_Source
|| (mode == QPainter::CompositionMode_SourceOver
&& qAlpha(s->penData.solid.color) == 255));
@@ -900,6 +901,7 @@ void QRasterPaintEngine::opacityChanged()
s->fillFlags |= DirtyOpacity;
s->strokeFlags |= DirtyOpacity;
s->pixmapFlags |= DirtyOpacity;
+ s->dirty |= DirtyOpacity;
s->intOpacity = (int) (s->opacity * 256);
}
@@ -3291,7 +3293,7 @@ void QRasterPaintEngine::drawStaticTextItem(QStaticTextItem *textItem)
ensureState();
drawCachedGlyphs(textItem->numGlyphs, textItem->glyphs, textItem->glyphPositions,
- textItem->fontEngine);
+ textItem->fontEngine());
}
/*!
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index b0ca6ed..546861a 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -5857,7 +5857,7 @@ void QPainterPrivate::drawGlyphs(quint32 *glyphArray, QFixedPoint *positions, in
QStaticTextItem staticTextItem;
staticTextItem.color = state->pen.color();
staticTextItem.font = state->font;
- staticTextItem.fontEngine = fontEngine;
+ staticTextItem.setFontEngine(fontEngine);
staticTextItem.numGlyphs = glyphCount;
staticTextItem.glyphs = reinterpret_cast<glyph_t *>(const_cast<glyph_t *>(glyphArray));
staticTextItem.glyphPositions = positions;
@@ -6064,7 +6064,7 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText
d->extended->drawStaticTextItem(item);
drawDecorationForGlyphs(this, item->glyphs, item->glyphPositions,
- item->numGlyphs, item->fontEngine, staticText_d->font,
+ item->numGlyphs, item->fontEngine(), staticText_d->font,
QTextCharFormat());
}
if (currentColor != oldPen.color())
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index 78c1019..4a6c03f 100644
--- a/src/gui/painting/qtextureglyphcache.cpp
+++ b/src/gui/painting/qtextureglyphcache.cpp
@@ -312,7 +312,7 @@ QImage QTextureGlyphCache::textureMapForGlyph(glyph_t g, QFixed subPixelPosition
if (m_type == QFontEngineGlyphCache::Raster_RGBMask)
return m_current_fontengine->alphaRGBMapForGlyph(g, subPixelPosition, glyphMargin(), m_transform);
else
- return m_current_fontengine->alphaMapForGlyph(g, m_transform);
+ return m_current_fontengine->alphaMapForGlyph(g, subPixelPosition, m_transform);
return QImage();
}
diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp
index 217723f..ae73d7d 100644
--- a/src/gui/painting/qwindowsurface_raster.cpp
+++ b/src/gui/painting/qwindowsurface_raster.cpp
@@ -251,6 +251,11 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi
#ifdef Q_WS_MAC
+ // This is mainly done for native components like native "open file" dialog.
+ if (widget->testAttribute(Qt::WA_DontShowOnScreen)) {
+ return;
+ }
+
#ifdef QT_MAC_USE_COCOA
// Unified toolbar hack.
QMainWindow* mWindow = qobject_cast<QMainWindow*>(widget->window());
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index 6fb3689..087907f 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -405,13 +405,14 @@ void QS60StylePrivate::clearCaches(CacheClearReason reason)
QPixmapCache::clear();
break;
case CC_ThemeChange:
- m_colorCache.clear();
QPixmapCache::clear();
+#ifdef Q_WS_S60
+ deleteStoredSettings();
+#endif
deleteBackground();
break;
case CC_UndefinedChange:
default:
- m_colorCache.clear();
m_mappedFontsCache.clear();
QPixmapCache::clear();
deleteBackground();
@@ -419,64 +420,53 @@ void QS60StylePrivate::clearCaches(CacheClearReason reason)
}
}
-// Since S60Style has 'button' and 'tooltip' as a graphic, we don't have any native color which to use
-// for QPalette::Button and QPalette::ToolTipBase. Therefore S60Style needs to guesstimate
-// palette colors by calculating average rgb values for button pixels.
-// Returns Qt::black if there is an issue with the graphics (image is NULL, or no bits() found).
-QColor QS60StylePrivate::colorFromFrameGraphics(SkinFrameElements frame) const
+QColor QS60StylePrivate::calculatedColor(SkinFrameElements frame) const
{
- const bool cachedColorExists = m_colorCache.contains(frame);
- if (!cachedColorExists) {
- const int frameCornerWidth = pixelMetric(PM_FrameCornerWidth);
- const int frameCornerHeight = pixelMetric(PM_FrameCornerHeight);
- Q_ASSERT(2 * frameCornerWidth < 32);
- Q_ASSERT(2 * frameCornerHeight < 32);
-
- const QImage frameImage = QS60StylePrivate::frame(frame, QSize(32, 32)).toImage();
- Q_ASSERT(frameImage.bytesPerLine() > 0);
- if (frameImage.isNull())
- return Qt::black;
-
- const QRgb *pixelRgb = (const QRgb*)frameImage.bits();
- const int pixels = frameImage.byteCount()/sizeof(QRgb);
-
- int estimatedRed = 0;
- int estimatedGreen = 0;
- int estimatedBlue = 0;
-
- int skips = 0;
- int estimations = 0;
-
- const int topBorderLastPixel = frameCornerHeight*frameImage.width() - 1;
- const int bottomBorderFirstPixel = frameImage.width() * frameImage.height() - frameCornerHeight*frameImage.width() - 1;
- const int rightBorderFirstPixel = frameImage.width() - frameCornerWidth;
- const int leftBorderLastPixel = frameCornerWidth;
-
- while ((skips + estimations) < pixels) {
- if ((skips + estimations) > topBorderLastPixel &&
- (skips + estimations) < bottomBorderFirstPixel) {
- for (int rowIndex = 0; rowIndex < frameImage.width(); rowIndex++) {
- if (rowIndex > leftBorderLastPixel &&
- rowIndex < rightBorderFirstPixel) {
- estimatedRed += qRed(*pixelRgb);
- estimatedGreen += qGreen(*pixelRgb);
- estimatedBlue += qBlue(*pixelRgb);
- }
- pixelRgb++;
- estimations++;
+ const int frameCornerWidth = pixelMetric(PM_FrameCornerWidth);
+ const int frameCornerHeight = pixelMetric(PM_FrameCornerHeight);
+ Q_ASSERT(2 * frameCornerWidth < 32);
+ Q_ASSERT(2 * frameCornerHeight < 32);
+
+ const QImage frameImage = QS60StylePrivate::frame(frame, QSize(32, 32)).toImage();
+ Q_ASSERT(frameImage.bytesPerLine() > 0);
+ if (frameImage.isNull())
+ return Qt::black;
+
+ const QRgb *pixelRgb = (const QRgb*)frameImage.constBits();
+ const int pixels = frameImage.byteCount() / sizeof(QRgb);
+
+ int estimatedRed = 0;
+ int estimatedGreen = 0;
+ int estimatedBlue = 0;
+
+ int skips = 0;
+ int estimations = 0;
+
+ const int topBorderLastPixel = frameCornerHeight * frameImage.width() - 1;
+ const int bottomBorderFirstPixel = frameImage.width() * frameImage.height() - topBorderLastPixel;
+ const int rightBorderFirstPixel = frameImage.width() - frameCornerWidth;
+ const int leftBorderLastPixel = frameCornerWidth;
+
+ while ((skips + estimations) < pixels) {
+ if ((skips + estimations) > topBorderLastPixel &&
+ (skips + estimations) < bottomBorderFirstPixel) {
+ for (int rowIndex = 0; rowIndex < frameImage.width(); rowIndex++) {
+ if (rowIndex > leftBorderLastPixel &&
+ rowIndex < rightBorderFirstPixel) {
+ estimatedRed += qRed(*pixelRgb);
+ estimatedGreen += qGreen(*pixelRgb);
+ estimatedBlue += qBlue(*pixelRgb);
}
- } else {
pixelRgb++;
- skips++;
+ estimations++;
}
+ } else {
+ pixelRgb++;
+ skips++;
}
- QColor frameColor(estimatedRed/estimations, estimatedGreen/estimations, estimatedBlue/estimations);
- m_colorCache.insert(frame, frameColor);
- return !estimations ? Qt::black : frameColor;
- } else {
- return m_colorCache.value(frame);
}
-
+ QColor frameColor(estimatedRed/estimations, estimatedGreen/estimations, estimatedBlue/estimations);
+ return !estimations ? Qt::black : frameColor;
}
void QS60StylePrivate::setThemePalette(QApplication *app) const
@@ -731,11 +721,14 @@ void QS60StylePrivate::setThemePalette(QPalette *palette) const
palette->setBrush(QPalette::Window, backgroundTexture());
// set as transparent so that styled full screen theme background is visible
palette->setBrush(QPalette::Base, Qt::transparent);
- // set button and tooltipbase based on pixel colors
+ // set button color based on pixel colors
+#ifndef Q_WS_S60
+ //For emulated style, just calculate the color every time
+ const QColor buttonColor = calculatedColor(SF_ButtonNormal);
+#else
const QColor buttonColor = colorFromFrameGraphics(SF_ButtonNormal);
+#endif
palette->setColor(QPalette::Button, buttonColor);
- const QColor toolTipColor = colorFromFrameGraphics(SF_ToolTip);
- palette->setColor(QPalette::ToolTipBase, toolTipColor);
palette->setColor(QPalette::Light, palette->color(QPalette::Button).lighter());
palette->setColor(QPalette::Dark, palette->color(QPalette::Button).darker());
palette->setColor(QPalette::Midlight, palette->color(QPalette::Button).lighter(125));
diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h
index b46f75e..db4285d 100644
--- a/src/gui/styles/qs60style_p.h
+++ b/src/gui/styles/qs60style_p.h
@@ -523,8 +523,12 @@ public:
static bool isSingleClickUi();
static bool isWidgetPressed(const QWidget *widget);
- // calculates average color based on button skin graphics (minus borders).
+#ifdef Q_WS_S60
+ static void deleteStoredSettings();
+ // calculates average color based on theme graphics (minus borders).
QColor colorFromFrameGraphics(SkinFrameElements frame) const;
+#endif
+ QColor calculatedColor(SkinFrameElements frame) const;
//set theme palette for application
void setThemePalette(QApplication *application) const;
@@ -542,7 +546,6 @@ public:
static const int m_numberOfLayouts;
mutable QHash<QPair<QS60StyleEnums::FontCategories , int>, QFont> m_mappedFontsCache;
- mutable QHash<SkinFrameElements, QColor> m_colorCache;
// Has one entry per SkinFrameElements
static const struct frameElementCenter {
diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp
index a1ea308..7b75d40 100644
--- a/src/gui/styles/qs60style_s60.cpp
+++ b/src/gui/styles/qs60style_s60.cpp
@@ -48,6 +48,7 @@
#include "private/qpixmap_s60_p.h"
#include "private/qcore_symbian_p.h"
#include "qapplication.h"
+#include "qsettings.h"
#include "qpluginloader.h"
#include "qlibraryinfo.h"
@@ -69,6 +70,8 @@
#include <gulicon.h>
#include <AknBitmapAnimation.h>
+#include <centralrepository.h>
+
#if !defined(QT_NO_STYLE_S60) || defined(QT_PLUGIN)
QT_BEGIN_NAMESPACE
@@ -81,6 +84,8 @@ enum TDrawType {
ENoDraw
};
+const TUid personalisationUID = { 0x101F876F };
+
enum TSupportRelease {
ES60_None = 0x0000, //indicates that the commonstyle should draw the graphics
ES60_3_1 = 0x0001,
@@ -689,6 +694,76 @@ bool QS60StylePrivate::isSingleClickUi()
return (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0);
}
+void QS60StylePrivate::deleteStoredSettings()
+{
+ QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
+ settings.beginGroup(QLatin1String("QS60Style"));
+ settings.remove("");
+ settings.endGroup();
+}
+
+// Since S60Style has 'button' as a graphic, we don't have any native color which to use
+// for QPalette::Button. Therefore S60Style needs to guesstimate palette color by calculating
+// average rgb values for button pixels.
+// Returns Qt::black if there is an issue with the graphics (image is NULL, or no constBits() found).
+QColor QS60StylePrivate::colorFromFrameGraphics(SkinFrameElements frame) const
+{
+#ifndef QT_NO_SETTINGS
+ TInt themeID = 0;
+ //First we need to fetch active theme ID. We need to store the themeID at the same time
+ //as color, so that we can later check if the stored color is still from the same theme.
+ //Native side stores active theme UID/Timestamp into central repository.
+ int error = 0;
+ QT_TRAP_THROWING(
+ CRepository *themeRepository = CRepository::NewLC(personalisationUID);
+ if (themeRepository) {
+ static const TInt KThemePkgIDDesSize = 23; //size of the stored theme package ID
+ TBuf<32> value; //themeID is currently max of 8 + 1 + 8 characters, but lets have some extra space
+ const TUint32 key = 0x00000002; //active theme key in the repository
+ error = themeRepository->Get(key, value);
+ if (error == KErrNone) {
+ TLex lex(value);
+ TPtrC numberToken(lex.NextToken());
+ if (numberToken.Length())
+ error = TLex(numberToken).Val(themeID);
+ else
+ error = KErrArgument;
+ }
+ }
+ CleanupStack::PopAndDestroy(themeRepository);
+ );
+
+ QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
+ settings.beginGroup(QLatin1String("QS60Style"));
+ if (themeID != 0) {
+ QVariant buttonColor = settings.value(QLatin1String("ButtonColor"));
+ if (!buttonColor.isNull()) {
+ //there is a stored color value, lets see if the theme ID matches
+ if (error == KErrNone) {
+ QVariant themeUID = settings.value(QLatin1String("ThemeUID"));
+ if (!themeUID.isNull() && themeUID.toInt() == themeID) {
+ QColor storedColor(buttonColor.value<QColor>());
+ if (storedColor.isValid())
+ return storedColor;
+ }
+ }
+ settings.remove(""); //if color was invalid, or theme has been changed, just delete all stored settings
+ }
+ }
+#endif
+
+ QColor color = calculatedColor(frame);
+
+#ifndef QT_NO_SETTINGS
+ settings.setValue(QLatin1String("ThemeUID"), QVariant(themeID));
+ if (frame == SF_ButtonNormal) //other colors are not currently calculated from graphics
+ settings.setValue(QLatin1String("ButtonColor"), QVariant(color));
+ settings.endGroup();
+#endif
+
+ return color;
+}
+
QPoint qt_s60_fill_background_offset(const QWidget *targetWidget)
{
CCoeControl *control = targetWidget->effectiveWinId();
diff --git a/src/gui/text/qfontdatabase_x11.cpp b/src/gui/text/qfontdatabase_x11.cpp
index ecc4690..635d2cf 100644
--- a/src/gui/text/qfontdatabase_x11.cpp
+++ b/src/gui/text/qfontdatabase_x11.cpp
@@ -1455,6 +1455,7 @@ void qt_addPatternProps(FcPattern *pattern, int screen, int script, const QFontD
weight_value = FC_WEIGHT_DEMIBOLD;
else if (request.weight < (QFont::Bold + QFont::Black) / 2)
weight_value = FC_WEIGHT_BOLD;
+ FcPatternDel(pattern, FC_WEIGHT);
FcPatternAddInteger(pattern, FC_WEIGHT, weight_value);
int slant_value = FC_SLANT_ROMAN;
@@ -1462,20 +1463,25 @@ void qt_addPatternProps(FcPattern *pattern, int screen, int script, const QFontD
slant_value = FC_SLANT_ITALIC;
else if (request.style == QFont::StyleOblique)
slant_value = FC_SLANT_OBLIQUE;
+ FcPatternDel(pattern, FC_SLANT);
FcPatternAddInteger(pattern, FC_SLANT, slant_value);
double size_value = qMax(qreal(1.), request.pixelSize);
+ FcPatternDel(pattern, FC_PIXEL_SIZE);
FcPatternAddDouble(pattern, FC_PIXEL_SIZE, size_value);
int stretch = request.stretch;
if (!stretch)
stretch = 100;
+ FcPatternDel(pattern, FC_WIDTH);
FcPatternAddInteger(pattern, FC_WIDTH, stretch);
if (X11->display && QX11Info::appDepth(screen) <= 8) {
+ FcPatternDel(pattern, FC_ANTIALIAS);
// can't do antialiasing on 8bpp
FcPatternAddBool(pattern, FC_ANTIALIAS, false);
} else if (request.styleStrategy & (QFont::PreferAntialias|QFont::NoAntialias)) {
+ FcPatternDel(pattern, FC_ANTIALIAS);
FcPatternAddBool(pattern, FC_ANTIALIAS,
!(request.styleStrategy & QFont::NoAntialias));
}
@@ -1484,6 +1490,7 @@ void qt_addPatternProps(FcPattern *pattern, int screen, int script, const QFontD
Q_ASSERT(script < QUnicodeTables::ScriptCount);
FcLangSet *ls = FcLangSetCreate();
FcLangSetAdd(ls, (const FcChar8*)specialLanguages[script]);
+ FcPatternDel(pattern, FC_LANG);
FcPatternAddLangSet(pattern, FC_LANG, ls);
FcLangSetDestroy(ls);
}
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index f73b816..24c4664 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -605,6 +605,12 @@ void QFontEngine::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int n
addBitmapFontToPath(x, y, g, path, flags);
}
+QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, QFixed /*subPixelPosition*/)
+{
+ // For font engines don't support subpixel positioning
+ return alphaMapForGlyph(glyph);
+}
+
QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, const QTransform &t)
{
QImage i = alphaMapForGlyph(glyph);
@@ -615,6 +621,19 @@ QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, const QTransform &t)
return i;
}
+QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t)
+{
+ if (! supportsSubPixelPositions())
+ return alphaMapForGlyph(glyph, t);
+
+ QImage i = alphaMapForGlyph(glyph, subPixelPosition);
+ if (t.type() > QTransform::TxTranslate)
+ i = i.transformed(t).convertToFormat(QImage::Format_Indexed8);
+ Q_ASSERT(i.depth() <= 8); // To verify that transformed didn't change the format...
+
+ return i;
+}
+
QImage QFontEngine::alphaRGBMapForGlyph(glyph_t glyph, QFixed /*subPixelPosition*/, int /* margin */, const QTransform &t)
{
QImage alphaMask = alphaMapForGlyph(glyph, t);
diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm
index ebc1f6d..3c6f3b2 100644
--- a/src/gui/text/qfontengine_mac.mm
+++ b/src/gui/text/qfontengine_mac.mm
@@ -252,6 +252,11 @@ bool QCoreTextFontEngineMulti::stringToCMap(const QChar *str, int len, QGlyphLay
continue;
Q_ASSERT((CTRunGetStatus(run) & kCTRunStatusRightToLeft) == rtl);
+ CFRange stringRange = CTRunGetStringRange(run);
+ UniChar endGlyph = CFStringGetCharacterAtIndex(cfstring, stringRange.location + stringRange.length - 1);
+ bool endWithPDF = QChar::direction(endGlyph) == QChar::DirPDF;
+ if (endWithPDF)
+ glyphCount++;
if (!outOBounds && outGlyphs + glyphCount - initialGlyph > *nglyphs) {
outOBounds = true;
@@ -264,6 +269,9 @@ bool QCoreTextFontEngineMulti::stringToCMap(const QChar *str, int len, QGlyphLay
CTFontRef runFont = static_cast<CTFontRef>(CFDictionaryGetValue(runAttribs, NSFontAttributeName));
const uint fontIndex = (fontIndexForFont(runFont) << 24);
//NSLog(@"Run Font Name = %@", CTFontCopyFamilyName(runFont));
+ if (endWithPDF)
+ glyphCount--;
+
QVarLengthArray<CGGlyph, 512> cgglyphs(0);
const CGGlyph *tmpGlyphs = CTRunGetGlyphsPtr(run);
if (!tmpGlyphs) {
@@ -331,6 +339,16 @@ bool QCoreTextFontEngineMulti::stringToCMap(const QChar *str, int len, QGlyphLay
(fontDef.styleStrategy & QFont::ForceIntegerMetrics)
? QFixed::fromReal(lastGlyphAdvance.width).round()
: QFixed::fromReal(lastGlyphAdvance.width);
+
+ if (endWithPDF) {
+ logClusters[stringRange.location + stringRange.length - 1] = glyphCount;
+ outGlyphs[glyphCount] = 0xFFFF;
+ outAdvances_x[glyphCount] = 0;
+ outAdvances_y[glyphCount] = 0;
+ outAttributes[glyphCount].clusterStart = true;
+ outAttributes[glyphCount].dontPrint = true;
+ glyphCount++;
+ }
}
outGlyphs += glyphCount;
outAttributes += glyphCount;
@@ -694,7 +712,7 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition
CGContextSetFont(ctx, cgFont);
qreal pos_x = -br.x.toReal() + subPixelPosition.toReal();
- qreal pos_y = im.height()+br.y.toReal();
+ qreal pos_y = im.height() + br.y.toReal() - 1;
CGContextSetTextPosition(ctx, pos_x, pos_y);
CGSize advance;
@@ -713,9 +731,9 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition
return im;
}
-QImage QCoreTextFontEngine::alphaMapForGlyph(glyph_t glyph)
+QImage QCoreTextFontEngine::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition)
{
- QImage im = imageForGlyph(glyph, QFixed(), 0, false);
+ QImage im = imageForGlyph(glyph, subPixelPosition, 0, false);
QImage indexed(im.width(), im.height(), QImage::Format_Indexed8);
QVector<QRgb> colors(256);
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index 6d6daaa..be9f48d 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -196,7 +196,9 @@ public:
* Returns an image indexed_8 with index values ranging from 0=fully transparant to 255=opaque
*/
virtual QImage alphaMapForGlyph(glyph_t);
+ virtual QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition);
virtual QImage alphaMapForGlyph(glyph_t, const QTransform &t);
+ virtual QImage alphaMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t);
virtual QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, int margin, const QTransform &t);
virtual glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, const QTransform &matrix, GlyphFormat /*format*/)
@@ -473,7 +475,7 @@ public:
virtual FaceId faceId() const;
virtual bool getSfntTableData(uint /*tag*/, uchar * /*buffer*/, uint * /*length*/) const;
virtual void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics);
- virtual QImage alphaMapForGlyph(glyph_t);
+ virtual QImage alphaMapForGlyph(glyph_t, QFixed subPixelPosition);
virtual QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, int margin, const QTransform &t);
virtual qreal minRightBearing() const;
virtual qreal minLeftBearing() const;
diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp
index 9506006..edf248a 100644
--- a/src/gui/text/qstatictext.cpp
+++ b/src/gui/text/qstatictext.cpp
@@ -445,7 +445,7 @@ namespace {
const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem);
QStaticTextItem currentItem;
- currentItem.fontEngine = ti.fontEngine;
+ currentItem.setFontEngine(ti.fontEngine);
currentItem.font = ti.font();
currentItem.charOffset = m_chars.size();
currentItem.numChars = ti.num_chars;
@@ -713,4 +713,24 @@ void QStaticTextPrivate::init()
needsRelayout = false;
}
+QStaticTextItem::~QStaticTextItem()
+{
+ if (m_userData != 0 && !m_userData->ref.deref())
+ delete m_userData;
+ if (!m_fontEngine->ref.deref())
+ delete m_fontEngine;
+}
+
+void QStaticTextItem::setFontEngine(QFontEngine *fe)
+{
+ if (m_fontEngine != 0) {
+ if (!m_fontEngine->ref.deref())
+ delete m_fontEngine;
+ }
+
+ m_fontEngine = fe;
+ if (m_fontEngine != 0)
+ m_fontEngine->ref.ref();
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/text/qstatictext_p.h b/src/gui/text/qstatictext_p.h
index cb60626..87ef0d5 100644
--- a/src/gui/text/qstatictext_p.h
+++ b/src/gui/text/qstatictext_p.h
@@ -68,27 +68,60 @@ public:
OpenGLUserData
};
- QStaticTextUserData(Type t) : type(t) {}
+ QStaticTextUserData(Type t) : type(t) { ref = 0; }
virtual ~QStaticTextUserData() {}
+ QAtomicInt ref;
Type type;
};
class Q_GUI_EXPORT QStaticTextItem
{
public:
- QStaticTextItem() : chars(0), numChars(0), fontEngine(0), userData(0),
- useBackendOptimizations(false), userDataNeedsUpdate(0) {}
- ~QStaticTextItem() { delete userData; }
+ QStaticTextItem() : chars(0), numChars(0), useBackendOptimizations(false),
+ userDataNeedsUpdate(0), m_fontEngine(0), m_userData(0) {}
+
+ QStaticTextItem(const QStaticTextItem &other)
+ {
+ operator=(other);
+ }
+
+ void operator=(const QStaticTextItem &other)
+ {
+ glyphPositions = other.glyphPositions;
+ glyphs = other.glyphs;
+ chars = other.chars;
+ numGlyphs = other.numGlyphs;
+ numChars = other.numChars;
+ font = other.font;
+ color = other.color;
+ useBackendOptimizations = other.useBackendOptimizations;
+ userDataNeedsUpdate = other.userDataNeedsUpdate;
+
+ m_fontEngine = 0;
+ m_userData = 0;
+ setUserData(other.userData());
+ setFontEngine(other.fontEngine());
+ }
+
+ ~QStaticTextItem();
void setUserData(QStaticTextUserData *newUserData)
{
- if (userData == newUserData)
+ if (m_userData == newUserData)
return;
- delete userData;
- userData = newUserData;
+ if (m_userData != 0 && !m_userData->ref.deref())
+ delete m_userData;
+
+ m_userData = newUserData;
+ if (m_userData != 0)
+ m_userData->ref.ref();
}
+ QStaticTextUserData *userData() const { return m_userData; }
+
+ void setFontEngine(QFontEngine *fe);
+ QFontEngine *fontEngine() const { return m_fontEngine; }
union {
QFixedPoint *glyphPositions; // 8 bytes per glyph
@@ -108,14 +141,17 @@ public:
// 12 bytes for pointers
int numGlyphs; // 4 bytes per item
int numChars; // 4 bytes per item
- QFontEngine *fontEngine; // 4 bytes per item
QFont font; // 8 bytes per item
QColor color; // 10 bytes per item
- QStaticTextUserData *userData; // 8 bytes per item
char useBackendOptimizations : 1; // 1 byte per item
char userDataNeedsUpdate : 1; //
// ================
// 51 bytes per item
+
+private: // Needs special handling in setters, so private to avoid abuse
+ QFontEngine *m_fontEngine; // 4 bytes per item
+ QStaticTextUserData *m_userData; // 8 bytes per item
+
};
class QStaticText;
diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp
index d0f71ae..334246b 100644
--- a/src/gui/text/qtextcontrol.cpp
+++ b/src/gui/text/qtextcontrol.cpp
@@ -64,6 +64,7 @@
#include "qgraphicssceneevent.h"
#include "qprinter.h"
#include "qtextdocumentwriter.h"
+#include "private/qtextcursor_p.h"
#include <qtextformat.h>
#include <qdatetime.h>
@@ -1904,6 +1905,8 @@ void QTextControlPrivate::inputMethodEvent(QInputMethodEvent *e)
}
layout->setAdditionalFormats(overrides);
cursor.endEditBlock();
+ if (cursor.d)
+ cursor.d->setX();
}
QVariant QTextControl::inputMethodQuery(Qt::InputMethodQuery property) const
diff --git a/src/gui/text/qtextcursor.h b/src/gui/text/qtextcursor.h
index 251cb33..d34ee4e 100644
--- a/src/gui/text/qtextcursor.h
+++ b/src/gui/text/qtextcursor.h
@@ -230,6 +230,7 @@ private:
QSharedDataPointer<QTextCursorPrivate> d;
friend class QTextDocumentFragmentPrivate;
friend class QTextCopyHelper;
+ friend class QTextControlPrivate;
};
QT_END_NAMESPACE
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 3aa6795..496accd 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -2612,8 +2612,8 @@ void QTextHtmlExporter::emitBlock(const QTextBlock &block)
if (format.hasProperty(QTextFormat::ListNumberPrefix)) {
QString numberPrefix = format.numberPrefix();
- numberPrefix.replace('"', "\\22");
- numberPrefix.replace('\'', "\\27"); // FIXME: There's a problem in the CSS parser the prevents this from being correctly restored
+ numberPrefix.replace(QLatin1Char('"'), QLatin1String("\\22"));
+ numberPrefix.replace(QLatin1Char('\''), QLatin1String("\\27")); // FIXME: There's a problem in the CSS parser the prevents this from being correctly restored
styleString += QLatin1String(" -qt-list-number-prefix: ");
styleString += QLatin1Char('\'');
styleString += numberPrefix;
@@ -2624,8 +2624,8 @@ void QTextHtmlExporter::emitBlock(const QTextBlock &block)
if (format.hasProperty(QTextFormat::ListNumberSuffix)) {
if (format.numberSuffix() != QLatin1String(".")) { // this is our default
QString numberSuffix = format.numberSuffix();
- numberSuffix.replace('"', "\\22");
- numberSuffix.replace('\'', "\\27"); // see above
+ numberSuffix.replace(QLatin1Char('"'), QLatin1String("\\22"));
+ numberSuffix.replace(QLatin1Char('\''), QLatin1String("\\27")); // see above
styleString += QLatin1String(" -qt-list-number-suffix: ");
styleString += QLatin1Char('\'');
styleString += numberSuffix;
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index f4f2168..06eed55 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -612,7 +612,7 @@ static bool bidiItemize(QTextEngine *engine, QScriptAnalysis *analysis, QBidiCon
} else {
eor = current;
}
- dir = QChar::DirON; status.eor = QChar::DirAN;
+ dir = QChar::DirAN; status.eor = QChar::DirAN;
break;
case QChar::DirCS:
if(status.eor == QChar::DirAN) {
diff --git a/src/gui/widgets/qcocoamenu_mac.mm b/src/gui/widgets/qcocoamenu_mac.mm
index 15fae23..b670186 100644
--- a/src/gui/widgets/qcocoamenu_mac.mm
+++ b/src/gui/widgets/qcocoamenu_mac.mm
@@ -156,10 +156,14 @@ QT_USE_NAMESPACE
// In every other case we return NO, which means that Cocoa can do as it pleases
// (i.e., fire the menu action).
NSMenuItem *whichItem;
+ // Change the private unicode keys to the ones used in setting the "Key Equivalents"
+ extern NSString *qt_mac_removePrivateUnicode(NSString* string);
+ NSString *characters = qt_mac_removePrivateUnicode([event characters]);
if ([self hasShortcut:menu
- forKey:[event characters]
- forModifiers:([event modifierFlags] & NSDeviceIndependentModifierFlagsMask)
- whichItem:&whichItem]) {
+ forKey:characters
+ // Interested only in Shift, Cmd, Ctrl & Alt Keys, so ignoring masks like, Caps lock, Num Lock ...
+ forModifiers:([event modifierFlags] & (NSShiftKeyMask | NSControlKeyMask | NSCommandKeyMask | NSAlternateKeyMask))
+ whichItem:&whichItem]) {
QWidget *widget = 0;
QAction *qaction = 0;
if (whichItem && [whichItem tag]) {
@@ -170,6 +174,9 @@ QT_USE_NAMESPACE
qApp->activePopupWidget()->focusWidget() : qApp->activePopupWidget());
else if (QApplicationPrivate::focus_widget)
widget = QApplicationPrivate::focus_widget;
+ // If we could not find any receivers, pass it to the active window
+ if (!widget)
+ widget = qApp->activeWindow();
if (qaction && widget) {
int key = qaction->shortcut();
QKeyEvent accel_ev(QEvent::ShortcutOverride, (key & (~Qt::KeyboardModifierMask)),
@@ -177,11 +184,10 @@ QT_USE_NAMESPACE
accel_ev.ignore();
qt_sendSpontaneousEvent(widget, &accel_ev);
if (accel_ev.isAccepted()) {
- if (qt_dispatchKeyEvent(event, widget)) {
- *target = nil;
- *action = nil;
- return YES;
- }
+ qt_dispatchKeyEvent(event, widget);
+ *target = nil;
+ *action = nil;
+ return YES;
}
}
}
diff --git a/src/gui/widgets/qvalidator.cpp b/src/gui/widgets/qvalidator.cpp
index b75db45..130d091 100644
--- a/src/gui/widgets/qvalidator.cpp
+++ b/src/gui/widgets/qvalidator.cpp
@@ -499,6 +499,8 @@ public:
}
QDoubleValidator::Notation notation;
+
+ QValidator::State validateWithLocale(QString & input, QLocalePrivate::NumberMode numMode, const QLocale &locale) const;
};
@@ -654,42 +656,49 @@ QValidator::State QDoubleValidator::validate(QString & input, int &) const
break;
}
+ State currentLocaleValidation = d->validateWithLocale(input, numMode, locale());
+ if (currentLocaleValidation == Acceptable || locale().language() == QLocale::C)
+ return currentLocaleValidation;
+ State cLocaleValidation = d->validateWithLocale(input, numMode, QLocale(QLocale::C));
+ return qMax(currentLocaleValidation, cLocaleValidation);
+}
+
+QValidator::State QDoubleValidatorPrivate::validateWithLocale(QString &input, QLocalePrivate::NumberMode numMode, const QLocale &locale) const
+{
+ Q_Q(const QDoubleValidator);
QByteArray buff;
- if (!locale().d()->validateChars(input, numMode, &buff, dec)) {
- QLocale cl(QLocale::C);
- if (!cl.d()->validateChars(input, numMode, &buff, dec))
- return Invalid;
- }
+ if (!locale.d()->validateChars(input, numMode, &buff, q->dec))
+ return QValidator::Invalid;
if (buff.isEmpty())
- return Intermediate;
+ return QValidator::Intermediate;
- if (b >= 0 && buff.startsWith('-'))
- return Invalid;
+ if (q->b >= 0 && buff.startsWith('-'))
+ return QValidator::Invalid;
- if (t < 0 && buff.startsWith('+'))
- return Invalid;
+ if (q->t < 0 && buff.startsWith('+'))
+ return QValidator::Invalid;
bool ok, overflow;
double i = QLocalePrivate::bytearrayToDouble(buff.constData(), &ok, &overflow);
if (overflow)
- return Invalid;
+ return QValidator::Invalid;
if (!ok)
- return Intermediate;
+ return QValidator::Intermediate;
- if (i >= b && i <= t)
- return Acceptable;
+ if (i >= q->b && i <= q->t)
+ return QValidator::Acceptable;
- if (d->notation == StandardNotation) {
- double max = qMax(qAbs(b), qAbs(t));
+ if (notation == QDoubleValidator::StandardNotation) {
+ double max = qMax(qAbs(q->b), qAbs(q->t));
if (max < LLONG_MAX) {
qlonglong n = pow10(numDigits(qlonglong(max))) - 1;
if (qAbs(i) > n)
- return Invalid;
+ return QValidator::Invalid;
}
}
- return Intermediate;
+ return QValidator::Intermediate;
}
diff --git a/src/multimedia/audio/audio.pri b/src/multimedia/audio/audio.pri
index f03d0ac..7b2f9ad 100644
--- a/src/multimedia/audio/audio.pri
+++ b/src/multimedia/audio/audio.pri
@@ -42,8 +42,8 @@ mac {
wince*:LIBS += -lcoredll
} else:symbian {
- INCLUDEPATH += $${EPOCROOT}/epoc32/include/mmf/common
- INCLUDEPATH += $${EPOCROOT}/epoc32/include/mmf/server
+ INCLUDEPATH += $${EPOCROOT}epoc32/include/mmf/common
+ INCLUDEPATH += $${EPOCROOT}epoc32/include/mmf/server
HEADERS += $$PWD/qaudio_symbian_p.h \
$$PWD/qaudiodeviceinfo_symbian_p.h \
diff --git a/src/multimedia/audio/qaudioinput_alsa_p.cpp b/src/multimedia/audio/qaudioinput_alsa_p.cpp
index ddafa3d..5265915 100644
--- a/src/multimedia/audio/qaudioinput_alsa_p.cpp
+++ b/src/multimedia/audio/qaudioinput_alsa_p.cpp
@@ -482,19 +482,18 @@ int QAudioInputPrivate::bytesReady() const
qint64 QAudioInputPrivate::read(char* data, qint64 len)
{
- Q_UNUSED(len)
-
// Read in some audio data and write it to QIODevice, pull mode
if ( !handle )
return 0;
- bytesAvailable = checkBytesReady();
+ // bytesAvaiable is saved as a side effect of checkBytesReady().
+ int bytesToRead = checkBytesReady();
- if (bytesAvailable < 0) {
+ if (bytesToRead < 0) {
// bytesAvailable as negative is error code, try to recover from it.
- xrun_recovery(bytesAvailable);
- bytesAvailable = checkBytesReady();
- if (bytesAvailable < 0) {
+ xrun_recovery(bytesToRead);
+ bytesToRead = checkBytesReady();
+ if (bytesToRead < 0) {
// recovery failed must stop and set error.
close();
errorState = QAudio::IOError;
@@ -504,9 +503,11 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len)
}
}
+ bytesToRead = qMin<qint64>(len, bytesToRead);
+ bytesToRead -= bytesToRead % period_size;
int count=0, err = 0;
while(count < 5) {
- int chunks = bytesAvailable/period_size;
+ int chunks = bytesToRead/period_size;
int frames = chunks*period_frames;
if(frames > (int)buffer_frames)
frames = buffer_frames;
@@ -554,6 +555,7 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len)
emit stateChanged(deviceState);
}
} else {
+ bytesAvailable -= err;
totalTimeValue += err;
resuming = false;
if (deviceState != QAudio::ActiveState) {
@@ -566,6 +568,7 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len)
} else {
memcpy(data,audioBuffer,err);
+ bytesAvailable -= err;
totalTimeValue += err;
resuming = false;
if (deviceState != QAudio::ActiveState) {
@@ -661,7 +664,7 @@ bool QAudioInputPrivate::deviceReady()
{
if(pullMode) {
// reads some audio data and writes it to QIODevice
- read(0,0);
+ read(0, buffer_size);
} else {
// emits readyRead() so user will call read() on QIODevice to get some audio data
InputPrivate* a = qobject_cast<InputPrivate*>(audioSource);
diff --git a/src/multimedia/audio/qaudioinput_win32_p.cpp b/src/multimedia/audio/qaudioinput_win32_p.cpp
index 1cde159..0ec2492 100644
--- a/src/multimedia/audio/qaudioinput_win32_p.cpp
+++ b/src/multimedia/audio/qaudioinput_win32_p.cpp
@@ -400,9 +400,12 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len)
resuming = false;
}
} else {
+ l = qMin<qint64>(len, waveBlocks[header].dwBytesRecorded);
// push mode
- memcpy(p,waveBlocks[header].lpData,waveBlocks[header].dwBytesRecorded);
- l = waveBlocks[header].dwBytesRecorded;
+ memcpy(p, waveBlocks[header].lpData, l);
+
+ len -= l;
+
#ifdef DEBUG_AUDIO
qDebug()<<"IN: "<<waveBlocks[header].dwBytesRecorded<<", OUT: "<<l;
#endif
@@ -457,7 +460,7 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len)
mutex.lock();
if(!pullMode) {
- if(l+period_size > len && waveFreeBlockCount == buffer_size/period_size)
+ if(len < period_size || waveFreeBlockCount == buffer_size/period_size)
done = true;
} else {
if(waveFreeBlockCount == buffer_size/period_size)
@@ -568,7 +571,7 @@ bool QAudioInputPrivate::deviceReady()
if(pullMode) {
// reads some audio data and writes it to QIODevice
- read(0,0);
+ read(0, buffer_size);
} else {
// emits readyRead() so user will call read() on QIODevice to get some audio data
InputPrivate* a = qobject_cast<InputPrivate*>(audioSource);
diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp
index 1f304e3..1b054e5 100644
--- a/src/multimedia/audio/qaudiooutput_win32_p.cpp
+++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp
@@ -586,7 +586,7 @@ bool QAudioOutputPrivate::deviceReady()
}
}
if ( out < l) {
- // Didnt write all data
+ // Didn't write all data
audioSource->seek(audioSource->pos()-(l-out));
}
if(startup)
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index 1ce162c..a1c7cf1 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -328,8 +328,6 @@ bool QHttpNetworkConnectionPrivate::handleAuthenticateChallenge(QAbstractSocket
Q_ASSERT(socket);
Q_ASSERT(reply);
- Q_Q(QHttpNetworkConnection);
-
resend = false;
//create the response header to be used with QAuthenticatorPrivate.
QList<QPair<QByteArray, QByteArray> > fields = reply->header();
diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp
index 86dd59b..d4ecf43 100644
--- a/src/network/access/qnetworkaccessbackend.cpp
+++ b/src/network/access/qnetworkaccessbackend.cpp
@@ -88,18 +88,6 @@ QNetworkAccessBackendFactory::~QNetworkAccessBackendFactory()
QNetworkAccessBackend *QNetworkAccessManagerPrivate::findBackend(QNetworkAccessManager::Operation op,
const QNetworkRequest &request)
{
- QNetworkRequest::CacheLoadControl mode =
- static_cast<QNetworkRequest::CacheLoadControl>(
- request.attribute(QNetworkRequest::CacheLoadControlAttribute,
- QNetworkRequest::PreferNetwork).toInt());
- if (mode == QNetworkRequest::AlwaysCache
- && (op == QNetworkAccessManager::GetOperation
- || op == QNetworkAccessManager::HeadOperation)) {
- QNetworkAccessBackend *backend = new QNetworkAccessCacheBackend;
- backend->manager = this;
- return backend;
- }
-
if (!factoryDataShutdown) {
QMutexLocker locker(&factoryData()->mutex);
QNetworkAccessBackendFactoryData::ConstIterator it = factoryData()->constBegin(),
diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h
index 9f8a01f..b9a832e 100644
--- a/src/network/access/qnetworkaccessbackend_p.h
+++ b/src/network/access/qnetworkaccessbackend_p.h
@@ -115,7 +115,6 @@ public:
virtual bool start();
#endif
virtual void closeDownstreamChannel() = 0;
- virtual bool waitForDownstreamReadyRead(int msecs) = 0;
// slot-like:
virtual void downstreamReadyWrite();
diff --git a/src/network/access/qnetworkaccesscachebackend.cpp b/src/network/access/qnetworkaccesscachebackend.cpp
index 73491a9..e78694e 100644
--- a/src/network/access/qnetworkaccesscachebackend.cpp
+++ b/src/network/access/qnetworkaccesscachebackend.cpp
@@ -132,18 +132,6 @@ void QNetworkAccessCacheBackend::closeUpstreamChannel()
Q_ASSERT_X(false, Q_FUNC_INFO, "This function show not have been called!");
}
-bool QNetworkAccessCacheBackend::waitForDownstreamReadyRead(int)
-{
- Q_ASSERT_X(false, Q_FUNC_INFO , "This function show not have been called!");
- return false;
-}
-
-bool QNetworkAccessCacheBackend::waitForUpstreamBytesWritten(int)
-{
- Q_ASSERT_X(false, Q_FUNC_INFO, "This function show not have been called!");
- return false;
-}
-
void QNetworkAccessCacheBackend::upstreamReadyRead()
{
Q_ASSERT_X(false, Q_FUNC_INFO, "This function show not have been called!");
diff --git a/src/network/access/qnetworkaccesscachebackend_p.h b/src/network/access/qnetworkaccesscachebackend_p.h
index df001ab..32581d5 100644
--- a/src/network/access/qnetworkaccesscachebackend_p.h
+++ b/src/network/access/qnetworkaccesscachebackend_p.h
@@ -69,8 +69,6 @@ public:
void open();
void closeDownstreamChannel();
void closeUpstreamChannel();
- bool waitForDownstreamReadyRead(int msecs);
- bool waitForUpstreamBytesWritten(int msecs);
void upstreamReadyRead();
void downstreamReadyWrite();
diff --git a/src/network/access/qnetworkaccessdebugpipebackend.cpp b/src/network/access/qnetworkaccessdebugpipebackend.cpp
index cd077e7..5f99f84 100644
--- a/src/network/access/qnetworkaccessdebugpipebackend.cpp
+++ b/src/network/access/qnetworkaccessdebugpipebackend.cpp
@@ -278,12 +278,6 @@ void QNetworkAccessDebugPipeBackend::socketConnected()
{
}
-bool QNetworkAccessDebugPipeBackend::waitForDownstreamReadyRead(int ms)
-{
- Q_UNUSED(ms);
- qCritical("QNetworkAccess: Debug pipe backend does not support waitForReadyRead()");
- return false;
-}
#endif
diff --git a/src/network/access/qnetworkaccessdebugpipebackend_p.h b/src/network/access/qnetworkaccessdebugpipebackend_p.h
index 58a4fd0..918a813 100644
--- a/src/network/access/qnetworkaccessdebugpipebackend_p.h
+++ b/src/network/access/qnetworkaccessdebugpipebackend_p.h
@@ -71,7 +71,6 @@ public:
virtual void open();
virtual void closeDownstreamChannel();
- virtual bool waitForDownstreamReadyRead(int msecs);
virtual void downstreamReadyWrite();
diff --git a/src/network/access/qnetworkaccessfilebackend.cpp b/src/network/access/qnetworkaccessfilebackend.cpp
index 710c258..cf4ce7c 100644
--- a/src/network/access/qnetworkaccessfilebackend.cpp
+++ b/src/network/access/qnetworkaccessfilebackend.cpp
@@ -208,12 +208,6 @@ void QNetworkAccessFileBackend::closeDownstreamChannel()
}
}
-bool QNetworkAccessFileBackend::waitForDownstreamReadyRead(int)
-{
- Q_ASSERT(operation() == QNetworkAccessManager::GetOperation);
- return readMoreFromFile();
-}
-
void QNetworkAccessFileBackend::downstreamReadyWrite()
{
Q_ASSERT_X(operation() == QNetworkAccessManager::GetOperation, "QNetworkAccessFileBackend",
diff --git a/src/network/access/qnetworkaccessfilebackend_p.h b/src/network/access/qnetworkaccessfilebackend_p.h
index 6df8710..d1dbe8d 100644
--- a/src/network/access/qnetworkaccessfilebackend_p.h
+++ b/src/network/access/qnetworkaccessfilebackend_p.h
@@ -69,7 +69,6 @@ public:
virtual void open();
virtual void closeDownstreamChannel();
- virtual bool waitForDownstreamReadyRead(int msecs);
virtual void downstreamReadyWrite();
diff --git a/src/network/access/qnetworkaccessftpbackend.cpp b/src/network/access/qnetworkaccessftpbackend.cpp
index da336d0..1567d98 100644
--- a/src/network/access/qnetworkaccessftpbackend.cpp
+++ b/src/network/access/qnetworkaccessftpbackend.cpp
@@ -182,23 +182,6 @@ void QNetworkAccessFtpBackend::closeDownstreamChannel()
#endif
}
-bool QNetworkAccessFtpBackend::waitForDownstreamReadyRead(int ms)
-{
- if (!ftp)
- return false;
-
- if (ftp->bytesAvailable()) {
- ftpReadyRead();
- return true;
- }
-
- if (ms == 0)
- return false;
-
- qCritical("QNetworkAccess: FTP backend does not support waitForReadyRead()");
- return false;
-}
-
void QNetworkAccessFtpBackend::downstreamReadyWrite()
{
if (state == Transferring && ftp && ftp->bytesAvailable())
diff --git a/src/network/access/qnetworkaccessftpbackend_p.h b/src/network/access/qnetworkaccessftpbackend_p.h
index 737fa72..8a2bfc3 100644
--- a/src/network/access/qnetworkaccessftpbackend_p.h
+++ b/src/network/access/qnetworkaccessftpbackend_p.h
@@ -87,7 +87,6 @@ public:
virtual void open();
virtual void closeDownstreamChannel();
- virtual bool waitForDownstreamReadyRead(int msecs);
virtual void downstreamReadyWrite();
diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp
index 0ae2192..3c41d85 100644
--- a/src/network/access/qnetworkaccesshttpbackend.cpp
+++ b/src/network/access/qnetworkaccesshttpbackend.cpp
@@ -678,26 +678,6 @@ void QNetworkAccessHttpBackend::closeDownstreamChannel()
// this indicates that the user closed the stream while the reply isn't finished yet
}
-bool QNetworkAccessHttpBackend::waitForDownstreamReadyRead(int msecs)
-{
- Q_ASSERT(http);
-
- if (httpReply->bytesAvailable()) {
- readFromHttp();
- return true;
- }
-
- if (msecs == 0) {
- // no bytes available in the socket and no waiting
- return false;
- }
-
- // ### FIXME
- qCritical("QNetworkAccess: HTTP backend does not support waitForReadyRead()");
- return false;
-}
-
-
void QNetworkAccessHttpBackend::downstreamReadyWrite()
{
readFromHttp();
diff --git a/src/network/access/qnetworkaccesshttpbackend_p.h b/src/network/access/qnetworkaccesshttpbackend_p.h
index ad0a7ba..fd3b2ec 100644
--- a/src/network/access/qnetworkaccesshttpbackend_p.h
+++ b/src/network/access/qnetworkaccesshttpbackend_p.h
@@ -79,7 +79,6 @@ public:
virtual void open();
virtual void closeDownstreamChannel();
- virtual bool waitForDownstreamReadyRead(int msecs);
virtual void downstreamReadyWrite();
virtual void setDownstreamLimited(bool b);
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index 5ae1078..97e7928 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -53,6 +53,7 @@
#include "qnetworkaccessftpbackend_p.h"
#include "qnetworkaccessfilebackend_p.h"
#include "qnetworkaccessdebugpipebackend_p.h"
+#include "qnetworkaccesscachebackend_p.h"
#include "qnetworkreplydataimpl_p.h"
#include "qnetworkreplyfileimpl_p.h"
@@ -960,6 +961,26 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
return new QNetworkReplyDataImpl(this, req, op);
}
+ // A request with QNetworkRequest::AlwaysCache does not need any bearer management
+ QNetworkRequest::CacheLoadControl mode =
+ static_cast<QNetworkRequest::CacheLoadControl>(
+ req.attribute(QNetworkRequest::CacheLoadControlAttribute,
+ QNetworkRequest::PreferNetwork).toInt());
+ if (mode == QNetworkRequest::AlwaysCache
+ && (op == QNetworkAccessManager::GetOperation
+ || op == QNetworkAccessManager::HeadOperation)) {
+ // FIXME Implement a QNetworkReplyCacheImpl instead, see QTBUG-15106
+ QNetworkReplyImpl *reply = new QNetworkReplyImpl(this);
+ QNetworkReplyImplPrivate *priv = reply->d_func();
+ priv->manager = this;
+ priv->backend = new QNetworkAccessCacheBackend();
+ priv->backend->manager = this->d_func();
+ priv->backend->setParent(reply);
+ priv->backend->reply = priv;
+ priv->setup(op, req, outgoingData);
+ return reply;
+ }
+
#ifndef QT_NO_BEARERMANAGEMENT
// Return a disabled network reply if network access is disabled.
// Except if the scheme is empty or file://.
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp
index 2910538..426b07a 100644
--- a/src/network/ssl/qsslsocket_openssl.cpp
+++ b/src/network/ssl/qsslsocket_openssl.cpp
@@ -51,6 +51,7 @@
#include <QtCore/qdebug.h>
#include <QtCore/qdir.h>
#include <QtCore/qdiriterator.h>
+#include <QtCore/qelapsedtimer.h>
#include <QtCore/qfile.h>
#include <QtCore/qfileinfo.h>
#include <QtCore/qmutex.h>
@@ -574,7 +575,7 @@ void QSslSocketPrivate::resetDefaultCiphers()
#if defined(Q_OS_SYMBIAN)
CSymbianCertificateRetriever::CSymbianCertificateRetriever() : CActive(CActive::EPriorityStandard),
- iSequenceError(KErrNone)
+ iCertificatePtr(0,0,0), iSequenceError(KErrNone)
{
}
@@ -618,6 +619,11 @@ void CSymbianCertificateRetriever::doThreadEntryL()
iCertStore = CUnifiedCertStore::NewLC(qt_s60GetRFs(), EFalse);
iCertFilter = CCertAttributeFilter::NewLC();
+ // only interested in CA certs
+ iCertFilter->SetOwnerType(ECACertificate);
+ // only interested in X.509 format (we don't support WAP formats)
+ iCertFilter->SetFormat(EX509Certificate);
+
// Kick off the sequence by initializing the cert store
iState = Initializing;
iCertStore->Initialize(iStatus);
@@ -637,6 +643,7 @@ void CSymbianCertificateRetriever::doThreadEntryL()
TInt CSymbianCertificateRetriever::ThreadEntryPoint(TAny* aParams)
{
+ User::SetCritical(User::EProcessCritical);
CTrapCleanup* cleanupStack = CTrapCleanup::New();
CSymbianCertificateRetriever* self = (CSymbianCertificateRetriever*) aParams;
@@ -658,7 +665,17 @@ void CSymbianCertificateRetriever::ConstructL()
void CSymbianCertificateRetriever::DoCancel()
{
- // We never cancel the sequence
+ switch(iState) {
+ case Initializing:
+ iCertStore->CancelInitialize();
+ break;
+ case Listing:
+ iCertStore->CancelList();
+ break;
+ case RetrievingCertificates:
+ iCertStore->CancelGetCert();
+ break;
+ }
}
TInt CSymbianCertificateRetriever::RunError(TInt aError)
@@ -671,37 +688,51 @@ TInt CSymbianCertificateRetriever::RunError(TInt aError)
void CSymbianCertificateRetriever::GetCertificateL()
{
- CCTCertInfo* certInfo = iCertInfos[iCurrentCertIndex];
- iCertificateData.resize(certInfo->Size());
- TPtr8 des((TUint8*)iCertificateData.data(), 0, iCertificateData.size());
- iCertStore->Retrieve(*certInfo, des, iStatus);
- iState = RetrievingCertificates;
- SetActive();
+ if (iCurrentCertIndex < iCertInfos.Count()) {
+ CCTCertInfo* certInfo = iCertInfos[iCurrentCertIndex++];
+ iCertificateData = QByteArray();
+ QT_TRYCATCH_LEAVING(iCertificateData.resize(certInfo->Size()));
+ iCertificatePtr.Set((TUint8*)iCertificateData.data(), 0, iCertificateData.size());
+#ifdef QSSLSOCKET_DEBUG
+ qDebug() << "getting " << qt_TDesC2QString(certInfo->Label()) << " size=" << certInfo->Size();
+ qDebug() << "format=" << certInfo->CertificateFormat();
+ qDebug() << "ownertype=" << certInfo->CertificateOwnerType();
+ qDebug() << "type=" << hex << certInfo->Type().iUid;
+#endif
+ iCertStore->Retrieve(*certInfo, iCertificatePtr, iStatus);
+ iState = RetrievingCertificates;
+ SetActive();
+ } else {
+ //reached end of list
+ CActiveScheduler::Stop();
+ }
}
void CSymbianCertificateRetriever::RunL()
{
+#ifdef QSSLSOCKET_DEBUG
+ qDebug() << "CSymbianCertificateRetriever::RunL status " << iStatus.Int() << " count " << iCertInfos.Count() << " index " << iCurrentCertIndex;
+#endif
switch (iState) {
case Initializing:
+ User::LeaveIfError(iStatus.Int()); // initialise fail means pointless to continue
iState = Listing;
iCertStore->List(iCertInfos, *iCertFilter, iStatus);
SetActive();
break;
case Listing:
+ User::LeaveIfError(iStatus.Int()); // listing fail means pointless to continue
iCurrentCertIndex = 0;
GetCertificateL();
break;
case RetrievingCertificates:
- iCertificates->append(iCertificateData);
- iCertificateData = QByteArray();
- iCurrentCertIndex++;
- if (iCurrentCertIndex < iCertInfos.Count())
- GetCertificateL();
+ if (iStatus.Int() == KErrNone)
+ iCertificates->append(iCertificateData);
else
- // Stop the scheduler to return to the thread entry function
- CActiveScheduler::Stop();
+ qWarning() << "CSymbianCertificateRetriever: failed to retreive a certificate, error " << iStatus.Int();
+ GetCertificateL();
break;
}
}
@@ -710,6 +741,10 @@ void CSymbianCertificateRetriever::RunL()
QList<QSslCertificate> QSslSocketPrivate::systemCaCertificates()
{
ensureInitialized();
+#ifdef QSSLSOCKET_DEBUG
+ QElapsedTimer timer;
+ timer.start();
+#endif
QList<QSslCertificate> systemCerts;
#if defined(Q_OS_MAC)
CFArrayRef cfCerts;
@@ -808,10 +843,18 @@ QList<QSslCertificate> QSslSocketPrivate::systemCaCertificates()
retriever->GetCertificates(certs);
foreach (const QByteArray &encodedCert, certs) {
QSslCertificate cert(encodedCert, QSsl::Der);
- if (!cert.isNull())
+ if (!cert.isNull()) {
+#ifdef QSSLSOCKET_DEBUG
+ qDebug() << "imported certificate: " << cert.issuerInfo(QSslCertificate::CommonName);
+#endif
systemCerts.append(cert);
+ }
}
#endif
+#ifdef QSSLSOCKET_DEBUG
+ qDebug() << "systemCaCertificates retrieval time " << timer.elapsed() << "ms";
+ qDebug() << "imported " << systemCerts.count() << " certificates";
+#endif
return systemCerts;
}
diff --git a/src/network/ssl/qsslsocket_openssl_p.h b/src/network/ssl/qsslsocket_openssl_p.h
index dec98ae..b59a6c9 100644
--- a/src/network/ssl/qsslsocket_openssl_p.h
+++ b/src/network/ssl/qsslsocket_openssl_p.h
@@ -165,6 +165,7 @@ private:
CCertAttributeFilter* iCertFilter;
TInt iCurrentCertIndex;
QByteArray iCertificateData;
+ TPtr8 iCertificatePtr;
QList<QByteArray>* iCertificates;
TInt iSequenceError;
};
diff --git a/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h b/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h
index 46029b9..b8c1018 100644
--- a/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h
+++ b/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h
@@ -93,7 +93,7 @@ struct QGLRect
GLfloat right;
GLfloat bottom;
- operator QRectF() {return QRectF(left, top, right-left, bottom-top);}
+ operator QRectF() const {return QRectF(left, top, right-left, bottom-top);}
};
class QGL2PEXVertexArray
diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
index d24f302..fa11dd7 100644
--- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
+++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
@@ -72,7 +72,7 @@
The position shaders for brushes look scary. This is because many of the
calculations which logically belong in the fragment shader have been moved
into the vertex shader to improve performance. This is why the position
- calculation is in a seperate shader. Not only does it calculate the
+ calculation is in a separate shader. Not only does it calculate the
position, but it also calculates some data to be passed to the fragment
shader as a varying. It is optimal to move as much of the calculation as
possible into the vertex shader as this is executed less often.
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 66895dd..85e4eab 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1379,8 +1379,8 @@ void QGL2PaintEngineEx::drawStaticTextItem(QStaticTextItem *textItem)
ensureActive();
- QFontEngineGlyphCache::Type glyphType = textItem->fontEngine->glyphFormat >= 0
- ? QFontEngineGlyphCache::Type(textItem->fontEngine->glyphFormat)
+ QFontEngineGlyphCache::Type glyphType = textItem->fontEngine()->glyphFormat >= 0
+ ? QFontEngineGlyphCache::Type(textItem->fontEngine()->glyphFormat)
: d->glyphCacheType;
if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) {
if (d->device->alphaRequested() || state()->matrix.type() > QTransform::TxTranslate
@@ -1459,7 +1459,7 @@ void QGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &textItem
{
QStaticTextItem staticTextItem;
staticTextItem.chars = const_cast<QChar *>(ti.chars);
- staticTextItem.fontEngine = ti.fontEngine;
+ staticTextItem.setFontEngine(ti.fontEngine);
staticTextItem.glyphs = glyphs.data();
staticTextItem.numChars = ti.num_chars;
staticTextItem.numGlyphs = glyphs.size();
@@ -1505,19 +1505,19 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
void *cacheKey = const_cast<QGLContext *>(QGLContextPrivate::contextGroup(ctx)->context());
QGLTextureGlyphCache *cache =
- (QGLTextureGlyphCache *) staticTextItem->fontEngine->glyphCache(cacheKey, glyphType, QTransform());
+ (QGLTextureGlyphCache *) staticTextItem->fontEngine()->glyphCache(cacheKey, glyphType, QTransform());
if (!cache || cache->cacheType() != glyphType || cache->context() == 0) {
cache = new QGLTextureGlyphCache(ctx, glyphType, QTransform());
- staticTextItem->fontEngine->setGlyphCache(cacheKey, cache);
+ staticTextItem->fontEngine()->setGlyphCache(cacheKey, cache);
cache->insert(ctx, cache);
}
bool recreateVertexArrays = false;
if (staticTextItem->userDataNeedsUpdate)
recreateVertexArrays = true;
- else if (staticTextItem->userData == 0)
+ else if (staticTextItem->userData() == 0)
recreateVertexArrays = true;
- else if (staticTextItem->userData->type != QStaticTextUserData::OpenGLUserData)
+ else if (staticTextItem->userData()->type != QStaticTextUserData::OpenGLUserData)
recreateVertexArrays = true;
// We only need to update the cache with new glyphs if we are actually going to recreate the vertex arrays.
@@ -1525,8 +1525,8 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
// cache so this text is performed before we test if the cache size has changed.
if (recreateVertexArrays) {
cache->setPaintEnginePrivate(this);
- cache->populate(staticTextItem->fontEngine, staticTextItem->numGlyphs, staticTextItem->glyphs,
- staticTextItem->glyphPositions);
+ cache->populate(staticTextItem->fontEngine(), staticTextItem->numGlyphs,
+ staticTextItem->glyphs, staticTextItem->glyphPositions);
cache->fillInPendingGlyphs();
}
@@ -1547,14 +1547,14 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
if (staticTextItem->useBackendOptimizations) {
QOpenGLStaticTextUserData *userData = 0;
- if (staticTextItem->userData == 0
- || staticTextItem->userData->type != QStaticTextUserData::OpenGLUserData) {
+ if (staticTextItem->userData() == 0
+ || staticTextItem->userData()->type != QStaticTextUserData::OpenGLUserData) {
userData = new QOpenGLStaticTextUserData();
staticTextItem->setUserData(userData);
} else {
- userData = static_cast<QOpenGLStaticTextUserData*>(staticTextItem->userData);
+ userData = static_cast<QOpenGLStaticTextUserData*>(staticTextItem->userData());
}
// Use cache if backend optimizations is turned on
@@ -1573,7 +1573,7 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
vertexCoordinates->clear();
textureCoordinates->clear();
- bool supportsSubPixelPositions = staticTextItem->fontEngine->supportsSubPixelPositions();
+ bool supportsSubPixelPositions = staticTextItem->fontEngine()->supportsSubPixelPositions();
for (int i=0; i<staticTextItem->numGlyphs; ++i) {
QFixed subPixelPosition;
if (supportsSubPixelPositions)
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index f316db6..cf45239 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -136,7 +136,12 @@ Q_GLOBAL_STATIC(QGLDefaultOverlayFormat, defaultOverlayFormatInstance)
Q_GLOBAL_STATIC(QGLSignalProxy, theSignalProxy)
QGLSignalProxy *QGLSignalProxy::instance()
{
- return theSignalProxy();
+ QGLSignalProxy *proxy = theSignalProxy();
+ if (proxy && proxy->thread() != qApp->thread()) {
+ if (proxy->thread() == QThread::currentThread())
+ proxy->moveToThread(qApp->thread());
+ }
+ return proxy;
}
@@ -1650,12 +1655,23 @@ const QGLContext *qt_gl_transfer_context(const QGLContext *ctx)
return 0;
}
+QGLContextPrivate::QGLContextPrivate(QGLContext *context)
+ : internal_context(false)
+ , q_ptr(context)
+{
+ group = new QGLContextGroup(context);
+ texture_destroyer = new QGLTextureDestroyer;
+ texture_destroyer->moveToThread(qApp->thread());
+}
+
QGLContextPrivate::~QGLContextPrivate()
{
if (!group->m_refs.deref()) {
Q_ASSERT(group->context() == q_ptr);
delete group;
}
+
+ delete texture_destroyer;
}
void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format)
diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h
index 2ac4cb6..4f10e5c 100644
--- a/src/opengl/qgl.h
+++ b/src/opengl/qgl.h
@@ -425,6 +425,7 @@ private:
friend class QGLSharedResourceGuard;
friend class QGLPixmapBlurFilter;
friend class QGLExtensions;
+ friend class QGLTexture;
friend QGLFormat::OpenGLVersionFlags QGLFormat::openGLVersionFlags();
#ifdef Q_WS_MAC
public:
diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp
index 27f7ad9..8902099 100644
--- a/src/opengl/qgl_egl.cpp
+++ b/src/opengl/qgl_egl.cpp
@@ -88,7 +88,7 @@ void qt_eglproperties_set_glformat(QEglProperties& eglProperties, const QGLForma
// put in the list before 32-bit configs. So, to make sure 16-bit is preffered over 32-bit,
// we must set the red/green/blue sizes to zero. This has an unfortunate consequence that
// if the application sets the red/green/blue size to 5/6/5 on the QGLFormat, they will
- // probably get a 32-bit config, even when there's an RGB565 config avaliable. Oh well.
+ // probably get a 32-bit config, even when there's an RGB565 config available. Oh well.
// Now normalize the values so -1 becomes 0
redSize = redSize > 0 ? redSize : 0;
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index 8c7f15c..8285f06 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -319,6 +319,7 @@ private:
};
class QGLTexture;
+class QGLTextureDestroyer;
// This probably needs to grow to GL_MAX_VERTEX_ATTRIBS, but 3 is ok for now as that's
// all the GL2 engine uses:
@@ -330,7 +331,7 @@ class QGLContextPrivate
{
Q_DECLARE_PUBLIC(QGLContext)
public:
- explicit QGLContextPrivate(QGLContext *context) : internal_context(false), q_ptr(context) {group = new QGLContextGroup(context);}
+ explicit QGLContextPrivate(QGLContext *context);
~QGLContextPrivate();
QGLTexture *bindTexture(const QImage &image, GLenum target, GLint format,
QGLContext::BindOptions options);
@@ -430,6 +431,7 @@ public:
GLuint default_fbo;
QPaintEngine *active_engine;
QHash<QGLContextResourceBase *, void *> m_resources;
+ QGLTextureDestroyer *texture_destroyer;
bool vertexAttributeArraysEnabledState[QT_GL_VERTEX_ARRAY_TRACKED_COUNT];
@@ -447,20 +449,6 @@ public:
static void setCurrentContext(QGLContext *context);
};
-// ### make QGLContext a QObject in 5.0 and remove the proxy stuff
-class Q_OPENGL_EXPORT QGLSignalProxy : public QObject
-{
- Q_OBJECT
-public:
- QGLSignalProxy() : QObject() {}
- void emitAboutToDestroyContext(const QGLContext *context) {
- emit aboutToDestroyContext(context);
- }
- static QGLSignalProxy *instance();
-Q_SIGNALS:
- void aboutToDestroyContext(const QGLContext *context);
-};
-
Q_DECLARE_OPERATORS_FOR_FLAGS(QGLExtensions::Extensions)
// Temporarily make a context current if not already current or
@@ -503,6 +491,56 @@ private:
QGLContext *m_ctx;
};
+class QGLTextureDestroyer : public QObject
+{
+ Q_OBJECT
+public:
+ QGLTextureDestroyer() : QObject() {
+ qRegisterMetaType<GLuint>("GLuint");
+ connect(this, SIGNAL(freeTexture(QGLContext *, QPixmapData *, GLuint)),
+ this, SLOT(freeTexture_slot(QGLContext *, QPixmapData *, GLuint)));
+ }
+ void emitFreeTexture(QGLContext *context, QPixmapData *boundPixmap, GLuint id) {
+ emit freeTexture(context, boundPixmap, id);
+ }
+
+Q_SIGNALS:
+ void freeTexture(QGLContext *context, QPixmapData *boundPixmap, GLuint id);
+
+private slots:
+ void freeTexture_slot(QGLContext *context, QPixmapData *boundPixmap, GLuint id) {
+#if defined(Q_WS_X11)
+ if (boundPixmap) {
+ QGLContext *oldContext = const_cast<QGLContext *>(QGLContext::currentContext());
+ context->makeCurrent();
+ // Although glXReleaseTexImage is a glX call, it must be called while there
+ // is a current context - the context the pixmap was bound to a texture in.
+ // Otherwise the release doesn't do anything and you get BadDrawable errors
+ // when you come to delete the context.
+ QGLContextPrivate::unbindPixmapFromTexture(boundPixmap);
+ glDeleteTextures(1, &id);
+ oldContext->makeCurrent();
+ return;
+ }
+#endif
+ QGLShareContextScope scope(context);
+ glDeleteTextures(1, &id);
+ }
+};
+
+// ### make QGLContext a QObject in 5.0 and remove the proxy stuff
+class Q_OPENGL_EXPORT QGLSignalProxy : public QObject
+{
+ Q_OBJECT
+public:
+ void emitAboutToDestroyContext(const QGLContext *context) {
+ emit aboutToDestroyContext(context);
+ }
+ static QGLSignalProxy *instance();
+Q_SIGNALS:
+ void aboutToDestroyContext(const QGLContext *context);
+};
+
class QGLTexture {
public:
QGLTexture(QGLContext *ctx = 0, GLuint tx_id = 0, GLenum tx_target = GL_TEXTURE_2D,
@@ -519,16 +557,10 @@ public:
~QGLTexture() {
if (options & QGLContext::MemoryManagedBindOption) {
Q_ASSERT(context);
- QGLShareContextScope scope(context);
-#if defined(Q_WS_X11)
- // Although glXReleaseTexImage is a glX call, it must be called while there
- // is a current context - the context the pixmap was bound to a texture in.
- // Otherwise the release doesn't do anything and you get BadDrawable errors
- // when you come to delete the context.
- if (boundPixmap)
- QGLContextPrivate::unbindPixmapFromTexture(boundPixmap);
+#if !defined(Q_WS_X11)
+ QPixmapData *boundPixmap = 0;
#endif
- glDeleteTextures(1, &id);
+ context->d_ptr->texture_destroyer->emitFreeTexture(context, boundPixmap, id);
}
}
diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp
index 1f7e60a..21b1ab6 100644
--- a/src/opengl/qgl_x11egl.cpp
+++ b/src/opengl/qgl_x11egl.cpp
@@ -376,7 +376,7 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons
checkedForEglImageTFP = true;
// We need to be able to create an EGLImage from a native pixmap, which was split
- // into a seperate EGL extension, EGL_KHR_image_pixmap. It is possible to have
+ // into a separate EGL extension, EGL_KHR_image_pixmap. It is possible to have
// eglCreateImageKHR & eglDestroyImageKHR without support for pixmaps, so we must
// check we have the EGLImage from pixmap functionality.
if (QEgl::hasExtension("EGL_KHR_image") || QEgl::hasExtension("EGL_KHR_image_pixmap")) {
diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp
index 74b6b9a..a04d930 100644
--- a/src/opengl/qpaintengine_opengl.cpp
+++ b/src/opengl/qpaintengine_opengl.cpp
@@ -4918,7 +4918,7 @@ void QOpenGLPaintEngine::drawStaticTextItem(QStaticTextItem *textItem)
d->flushDrawQueue();
// make sure the glyphs we want to draw are in the cache
- qt_glyph_cache()->cacheGlyphs(d->device->context(), textItem->fontEngine, textItem->glyphs,
+ qt_glyph_cache()->cacheGlyphs(d->device->context(), textItem->fontEngine(), textItem->glyphs,
textItem->numGlyphs);
d->setGradientOps(Qt::SolidPattern, QRectF()); // turns off gradient ops
@@ -4941,13 +4941,13 @@ void QOpenGLPaintEngine::drawStaticTextItem(QStaticTextItem *textItem)
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- bool antialias = !(textItem->fontEngine->fontDef.styleStrategy & QFont::NoAntialias)
+ bool antialias = !(textItem->fontEngine()->fontDef.styleStrategy & QFont::NoAntialias)
&& (d->matrix.type() > QTransform::TxTranslate);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, antialias ? GL_LINEAR : GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, antialias ? GL_LINEAR : GL_NEAREST);
for (int i=0; i< textItem->numGlyphs; ++i) {
- QGLGlyphCoord *g = qt_glyph_cache()->lookup(textItem->fontEngine, textItem->glyphs[i]);
+ QGLGlyphCoord *g = qt_glyph_cache()->lookup(textItem->fontEngine(), textItem->glyphs[i]);
// we don't cache glyphs with no width/height
if (!g)
@@ -5003,7 +5003,7 @@ void QOpenGLPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte
{
QStaticTextItem staticTextItem;
staticTextItem.chars = const_cast<QChar *>(ti.chars);
- staticTextItem.fontEngine = ti.fontEngine;
+ staticTextItem.setFontEngine(ti.fontEngine);
staticTextItem.glyphs = glyphs.data();
staticTextItem.numChars = ti.num_chars;
staticTextItem.numGlyphs = glyphs.size();
diff --git a/src/opengl/qpixmapdata_x11gl_egl.cpp b/src/opengl/qpixmapdata_x11gl_egl.cpp
index 2c11a0b..5cbc836 100644
--- a/src/opengl/qpixmapdata_x11gl_egl.cpp
+++ b/src/opengl/qpixmapdata_x11gl_egl.cpp
@@ -93,7 +93,7 @@ public:
if (rgbConfig == argbConfig)
argbContext = rgbContext;
- // Otherwise, create a seperate context to be used for ARGB pixmaps:
+ // Otherwise, create a separate context to be used for ARGB pixmaps:
if (!argbContext) {
argbContext = new QEglContext;
argbContext->setConfig(argbConfig);
@@ -314,7 +314,7 @@ QPaintEngine* QX11GLPixmapData::paintEngine() const
Q_ASSERT(ctx->d_func()->eglContext == 0);
ctx->d_func()->eglContext = hasAlphaChannel() ? sharedContexts()->argbContext : sharedContexts()->rgbContext;
- // While we use a seperate QGLContext for each pixmap, the underlying QEglContext is
+ // While we use a separate QGLContext for each pixmap, the underlying QEglContext is
// the same. So we must use a "fake" QGLContext and fool the texture cache into thinking
// each pixmap's QGLContext is sharing with this central one. The only place this is
// going to fail is where we the underlying EGL RGB and ARGB contexts aren't sharing.
diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp
index ee65e48..aea203f 100644
--- a/src/openvg/qpaintengine_vg.cpp
+++ b/src/openvg/qpaintengine_vg.cpp
@@ -3475,7 +3475,7 @@ void QVGPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem)
void QVGPaintEngine::drawStaticTextItem(QStaticTextItem *textItem)
{
- drawCachedGlyphs(textItem->numGlyphs, textItem->glyphs, textItem->font, textItem->fontEngine,
+ drawCachedGlyphs(textItem->numGlyphs, textItem->glyphs, textItem->font, textItem->fontEngine(),
QPointF(0, 0), textItem->glyphPositions);
}
diff --git a/src/plugins/bearer/corewlan/corewlan.pro b/src/plugins/bearer/corewlan/corewlan.pro
index 22ad550..90078e9 100644
--- a/src/plugins/bearer/corewlan/corewlan.pro
+++ b/src/plugins/bearer/corewlan/corewlan.pro
@@ -1,7 +1,7 @@
TARGET = qcorewlanbearer
include(../../qpluginbase.pri)
-QT = core gui network
+QT = core network
LIBS += -framework Foundation -framework SystemConfiguration
contains(QT_CONFIG, corewlan) {
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm
index db577fd..23dd14a 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.mm
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm
@@ -64,12 +64,17 @@
#include <Foundation/NSLock.h>
#include <SystemConfiguration/SCNetworkConfiguration.h>
-#include <private/qt_cocoa_helpers_mac_p.h>
#include "private/qcore_mac_p.h"
#include <net/if.h>
#include <ifaddrs.h>
+inline QString qt_NSStringToQString(const NSString *nsstr)
+{ return QCFString::toQString(reinterpret_cast<const CFStringRef>(nsstr)); }
+
+inline NSString *qt_QStringToNSString(const QString &qstr)
+{ return [reinterpret_cast<const NSString *>(QCFString::toCFStringRef(qstr)) autorelease]; }
+
@interface QT_MANGLE_NAMESPACE(QNSListener) : NSObject
{
@@ -93,11 +98,12 @@
- (id) init
{
[locker lock];
- QMacCocoaAutoReleasePool pool;
+ NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
notificationCenter = [NSNotificationCenter defaultCenter];
currentInterface = [CWInterface interfaceWithName:nil];
[notificationCenter addObserver:self selector:@selector(notificationHandler:) name:kCWPowerDidChangeNotification object:nil];
[locker unlock];
+ [autoreleasepool release];
return self;
}
@@ -161,10 +167,10 @@ void QScanThread::quit()
void QScanThread::run()
{
- QMacCocoaAutoReleasePool pool;
+ NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
QStringList found;
mutex.lock();
- CWInterface *currentInterface = [CWInterface interfaceWithName:qt_mac_QStringToNSString(interfaceName)];
+ CWInterface *currentInterface = [CWInterface interfaceWithName:qt_QStringToNSString(interfaceName)];
mutex.unlock();
if([currentInterface power]) {
@@ -182,14 +188,14 @@ void QScanThread::run()
for(uint row=0; row < [apArray count]; row++ ) {
apNetwork = [apArray objectAtIndex:row];
- const QString networkSsid = qt_mac_NSStringToQString([apNetwork ssid]);
+ const QString networkSsid = qt_NSStringToQString([apNetwork ssid]);
const QString id = QString::number(qHash(QLatin1String("corewlan:") + networkSsid));
found.append(id);
QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined;
bool known = isKnownSsid(networkSsid);
if( [currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) {
- if( networkSsid == qt_mac_NSStringToQString( [currentInterface ssid])) {
+ if( networkSsid == qt_NSStringToQString( [currentInterface ssid])) {
state = QNetworkConfiguration::Active;
}
}
@@ -232,7 +238,7 @@ void QScanThread::run()
}
if( [currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) {
- if( networkSsid == qt_mac_NSStringToQString([currentInterface ssid])) {
+ if( networkSsid == qt_NSStringToQString([currentInterface ssid])) {
state = QNetworkConfiguration::Active;
}
}
@@ -251,6 +257,7 @@ void QScanThread::run()
}
}
emit networksChanged();
+ [autoreleasepool release];
}
QStringList QScanThread::foundNetwork(const QString &id, const QString &name, const QNetworkConfiguration::StateFlags state, const QString &interfaceName, const QNetworkConfiguration::Purpose purpose)
@@ -290,7 +297,7 @@ void QScanThread::getUserConfigurations()
{
QMutexLocker locker(&mutex);
- QMacCocoaAutoReleasePool pool;
+ NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
userProfiles.clear();
NSArray *wifiInterfaces = [CWInterface supportedInterfaces];
@@ -310,10 +317,10 @@ void QScanThread::getUserConfigurations()
NSArray *thisSsidarray = [prefNetDict valueForKey:@"SSID_STR"];
for(NSString *ssidkey in thisSsidarray) {
- QString thisSsid = qt_mac_NSStringToQString(ssidkey);
+ QString thisSsid = qt_NSStringToQString(ssidkey);
if(!userProfiles.contains(thisSsid)) {
QMap <QString,QString> map;
- map.insert(thisSsid, qt_mac_NSStringToQString(nsInterfaceName));
+ map.insert(thisSsid, qt_NSStringToQString(nsInterfaceName));
userProfiles.insert(thisSsid, map);
}
}
@@ -322,7 +329,7 @@ void QScanThread::getUserConfigurations()
// 802.1X user profiles
QString userProfilePath = QDir::homePath() + "/Library/Preferences/com.apple.eap.profiles.plist";
- NSDictionary* eapDict = [[[NSDictionary alloc] initWithContentsOfFile:qt_mac_QStringToNSString(userProfilePath)] autorelease];
+ NSDictionary* eapDict = [[[NSDictionary alloc] initWithContentsOfFile:qt_QStringToNSString(userProfilePath)] autorelease];
if(eapDict != nil) {
NSString *profileStr= @"Profiles";
NSString *nameStr = @"UserDefinedName";
@@ -341,15 +348,15 @@ void QScanThread::getUserConfigurations()
QString ssid;
for(int i = 0; i < dictSize; i++) {
if([nameStr isEqualToString:keys[i]]) {
- networkName = qt_mac_NSStringToQString(objects[i]);
+ networkName = qt_NSStringToQString(objects[i]);
}
if([networkSsidStr isEqualToString:keys[i]]) {
- ssid = qt_mac_NSStringToQString(objects[i]);
+ ssid = qt_NSStringToQString(objects[i]);
}
if(!userProfiles.contains(networkName)
&& !ssid.isEmpty()) {
QMap<QString,QString> map;
- map.insert(ssid, qt_mac_NSStringToQString(nsInterfaceName));
+ map.insert(ssid, qt_NSStringToQString(nsInterfaceName));
userProfiles.insert(networkName, map);
}
}
@@ -358,6 +365,7 @@ void QScanThread::getUserConfigurations()
}
}
}
+ [autoreleasepool release];
}
QString QScanThread::getSsidFromNetworkName(const QString &name)
@@ -434,7 +442,7 @@ QCoreWlanEngine::~QCoreWlanEngine()
void QCoreWlanEngine::initialize()
{
QMutexLocker locker(&mutex);
- QMacCocoaAutoReleasePool pool;
+ NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
if([[CWInterface supportedInterfaces] count] > 0 && !listener) {
listener = [[QT_MANGLE_NAMESPACE(QNSListener) alloc] init];
@@ -446,6 +454,7 @@ void QCoreWlanEngine::initialize()
storeSession = NULL;
startNetworkChangeLoop();
+ [autoreleasepool release];
}
@@ -466,11 +475,11 @@ bool QCoreWlanEngine::hasIdentifier(const QString &id)
void QCoreWlanEngine::connectToId(const QString &id)
{
QMutexLocker locker(&mutex);
- QMacCocoaAutoReleasePool pool;
+ NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
QString interfaceString = getInterfaceFromId(id);
CWInterface *wifiInterface =
- [CWInterface interfaceWithName: qt_mac_QStringToNSString(interfaceString)];
+ [CWInterface interfaceWithName: qt_QStringToNSString(interfaceString)];
if ([wifiInterface power]) {
NSError *err = nil;
@@ -488,9 +497,9 @@ void QCoreWlanEngine::connectToId(const QString &id)
NSArray *array = [CW8021XProfile allUser8021XProfiles];
for (NSUInteger i = 0; i < [array count]; ++i) {
- const QString networkNameHashCheck = QString::number(qHash(QLatin1String("corewlan:") + qt_mac_NSStringToQString([[array objectAtIndex:i] userDefinedName])));
+ const QString networkNameHashCheck = QString::number(qHash(QLatin1String("corewlan:") + qt_NSStringToQString([[array objectAtIndex:i] userDefinedName])));
- const QString ssidHash = QString::number(qHash(QLatin1String("corewlan:") + qt_mac_NSStringToQString([[array objectAtIndex:i] ssid])));
+ const QString ssidHash = QString::number(qHash(QLatin1String("corewlan:") + qt_NSStringToQString([[array objectAtIndex:i] ssid])));
if (id == networkNameHashCheck || id == ssidHash) {
const QString thisName = scanThread->getSsidFromNetworkName(id);
@@ -523,7 +532,7 @@ void QCoreWlanEngine::connectToId(const QString &id)
[NSNumber numberWithBool:YES], kCWScanKeyMerge,
[NSNumber numberWithInt:kCWScanTypeFast], kCWScanKeyScanType,
[NSNumber numberWithInteger:100], kCWScanKeyRestTime,
- qt_mac_QStringToNSString(wantedSsid), kCWScanKeySSID,
+ qt_QStringToNSString(wantedSsid), kCWScanKeySSID,
nil];
NSArray *scanArray = [wifiInterface scanForNetworksWithParameters:scanParameters error:&err];
@@ -532,7 +541,7 @@ void QCoreWlanEngine::connectToId(const QString &id)
for(uint row=0; row < [scanArray count]; row++ ) {
CWNetwork *apNetwork = [scanArray objectAtIndex:row];
- if(wantedSsid == qt_mac_NSStringToQString([apNetwork ssid])) {
+ if(wantedSsid == qt_NSStringToQString([apNetwork ssid])) {
if(!using8021X) {
SecKeychainAttribute attributes[3];
@@ -599,18 +608,19 @@ void QCoreWlanEngine::connectToId(const QString &id)
return;
}
} else {
- qDebug() <<"associate ERROR"<< qt_mac_NSStringToQString([err localizedDescription ]);
+ qDebug() <<"associate ERROR"<< qt_NSStringToQString([err localizedDescription ]);
}
}
} //end scan network
} else {
- qDebug() <<"scan ERROR"<< qt_mac_NSStringToQString([err localizedDescription ]);
+ qDebug() <<"scan ERROR"<< qt_NSStringToQString([err localizedDescription ]);
}
emit connectionError(id, InterfaceLookupError);
}
locker.unlock();
emit connectionError(id, InterfaceLookupError);
+ [autoreleasepool release];
}
void QCoreWlanEngine::disconnectFromId(const QString &id)
@@ -618,10 +628,10 @@ void QCoreWlanEngine::disconnectFromId(const QString &id)
QMutexLocker locker(&mutex);
QString interfaceString = getInterfaceFromId(id);
- QMacCocoaAutoReleasePool pool;
+ NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
CWInterface *wifiInterface =
- [CWInterface interfaceWithName: qt_mac_QStringToNSString(interfaceString)];
+ [CWInterface interfaceWithName: qt_QStringToNSString(interfaceString)];
[wifiInterface disassociate];
if ([[wifiInterface interfaceState]intValue] != kCWInterfaceStateInactive) {
@@ -629,6 +639,7 @@ void QCoreWlanEngine::disconnectFromId(const QString &id)
emit connectionError(id, DisconnectionError);
locker.relock();
}
+ [autoreleasepool release];
}
void QCoreWlanEngine::requestUpdate()
@@ -641,27 +652,30 @@ void QCoreWlanEngine::doRequestUpdate()
{
QMutexLocker locker(&mutex);
- QMacCocoaAutoReleasePool pool;
+ NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
NSArray *wifiInterfaces = [CWInterface supportedInterfaces];
for (uint row = 0; row < [wifiInterfaces count]; ++row) {
- scanThread->interfaceName = qt_mac_NSStringToQString([wifiInterfaces objectAtIndex:row]);
+ scanThread->interfaceName = qt_NSStringToQString([wifiInterfaces objectAtIndex:row]);
scanThread->start();
}
locker.unlock();
+ [autoreleasepool release];
}
bool QCoreWlanEngine::isWifiReady(const QString &wifiDeviceName)
{
QMutexLocker locker(&mutex);
-
+ bool haswifi = false;
if(hasWifi) {
- QMacCocoaAutoReleasePool pool;
- CWInterface *defaultInterface = [CWInterface interfaceWithName: qt_mac_QStringToNSString(wifiDeviceName)];
- if([defaultInterface power])
- return true;
+ NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
+ CWInterface *defaultInterface = [CWInterface interfaceWithName: qt_QStringToNSString(wifiDeviceName)];
+ if([defaultInterface power]) {
+ haswifi = true;
+ }
+ [autoreleasepool release];
}
- return false;
+ return haswifi;
}
@@ -853,7 +867,7 @@ quint64 QCoreWlanEngine::bytesReceived(const QString &id)
quint64 QCoreWlanEngine::startTime(const QString &identifier)
{
QMutexLocker locker(&mutex);
- QMacCocoaAutoReleasePool pool;
+ NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
quint64 timestamp = 0;
NSString *filePath = @"/Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist";
@@ -884,7 +898,7 @@ quint64 QCoreWlanEngine::startTime(const QString &identifier)
bool ok = false;
for(int i = 0; i < dictSize; i++) {
if([ssidStr isEqualToString:keys[i]]) {
- const QString ident = QString::number(qHash(QLatin1String("corewlan:") + qt_mac_NSStringToQString(objects[i])));
+ const QString ident = QString::number(qHash(QLatin1String("corewlan:") + qt_NSStringToQString(objects[i])));
if(ident == identifier) {
ok = true;
}
@@ -900,6 +914,7 @@ quint64 QCoreWlanEngine::startTime(const QString &identifier)
}
}
}
+ [autoreleasepool release];
return timestamp;
}
diff --git a/src/plugins/bearer/icd/icd.pro b/src/plugins/bearer/icd/icd.pro
index 464cc1c..6700cda 100644
--- a/src/plugins/bearer/icd/icd.pro
+++ b/src/plugins/bearer/icd/icd.pro
@@ -1,7 +1,7 @@
TARGET = qicdbearer
include(../../qpluginbase.pri)
-QT += network dbus
+QT = core network dbus
QMAKE_CXXFLAGS *= $$QT_CFLAGS_DBUS $$QT_CFLAGS_CONNSETTINGS
LIBS += $$QT_LIBS_CONNSETTINGS
diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
index 85723ce..c5a39e1 100644
--- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
@@ -1078,7 +1078,7 @@ void QNetworkSessionPrivateImpl::RunL()
TInt error = KErrNone;
QNetworkConfiguration newActiveConfig = activeConfiguration();
if (!newActiveConfig.isValid()) {
- // RConnection startup was successfull but no configuration
+ // RConnection startup was successful but no configuration
// was found. That indicates that user has chosen to create a
// new WLAN configuration (from scan results), but that new
// configuration does not have access to Internet (Internet
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
index 4869eba..c16a242 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
@@ -55,6 +55,7 @@
#include <private/qpixmap_raster_p.h>
#include <private/qimagepixmapcleanuphooks_p.h>
+
QT_BEGIN_NAMESPACE
class SurfaceCache;
@@ -112,7 +113,11 @@ public:
static inline int cacheCost(const QImage &img) { return img.width() * img.height() * img.depth() / 8; }
#endif
- void prepareForBlit(bool alpha);
+ enum BlitFlag {
+ HasAlpha = 0x1,
+ Premultiplied = 0x2
+ };
+ void prepareForBlit(uint blitFlags);
IDirectFBSurface *surface;
@@ -616,7 +621,12 @@ void QDirectFBPaintEngine::drawImage(const QRectF &r, const QImage &image,
#if !defined QT_NO_DIRECTFB_PREALLOCATED || defined QT_DIRECTFB_IMAGECACHE
bool release;
IDirectFBSurface *imgSurface = d->getSurface(image, &release);
- d->prepareForBlit(QDirectFBScreen::hasAlphaChannel(imgSurface));
+ uint blitFlags = 0;
+ if (image.hasAlphaChannel())
+ blitFlags |= QDirectFBPaintEnginePrivate::HasAlpha;
+ if (QDirectFBScreen::isPremultiplied(image.format()))
+ blitFlags |= QDirectFBPaintEnginePrivate::Premultiplied;
+ d->prepareForBlit(blitFlags);
CLIPPED_PAINT(d->blit(r, imgSurface, sr));
if (release) {
#if (Q_DIRECTFB_VERSION >= 0x010000)
@@ -655,8 +665,14 @@ void QDirectFBPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap,
QRasterPaintEngine::drawImage(r, *img, sr);
} else {
QDirectFBPaintEnginePrivate::unlock(dfbData);
- d->prepareForBlit(pixmap.hasAlphaChannel());
IDirectFBSurface *s = dfbData->directFBSurface();
+ uint blitFlags = 0;
+ if (pixmap.hasAlphaChannel())
+ blitFlags |= QDirectFBPaintEnginePrivate::HasAlpha;
+ if (QDirectFBScreen::isPremultiplied(dfbData->pixelFormat()))
+ blitFlags |= QDirectFBPaintEnginePrivate::Premultiplied;
+
+ d->prepareForBlit(blitFlags);
CLIPPED_PAINT(d->blit(r, s, sr));
}
}
@@ -978,7 +994,7 @@ void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode m
break;
case QPainter::CompositionMode_SourceOver:
compositionModeStatus &= ~PorterDuff_AlwaysBlend;
- surface->SetPorterDuff(surface, DSPD_NONE);
+ surface->SetPorterDuff(surface, DSPD_SRC_OVER);
break;
case QPainter::CompositionMode_DestinationOver:
surface->SetPorterDuff(surface, DSPD_DST_OVER);
@@ -1031,13 +1047,18 @@ void QDirectFBPaintEnginePrivate::setRenderHints(QPainter::RenderHints hints)
}
}
-void QDirectFBPaintEnginePrivate::prepareForBlit(bool alpha)
+void QDirectFBPaintEnginePrivate::prepareForBlit(uint flags)
{
- DFBSurfaceBlittingFlags blittingFlags = alpha ? DSBLIT_BLEND_ALPHACHANNEL : DSBLIT_NOFX;
+ DFBSurfaceBlittingFlags blittingFlags = DSBLIT_NOFX;
+ if (flags & Premultiplied)
+ blittingFlags |= DSBLIT_SRC_PREMULTIPLY;
+ if (flags & HasAlpha)
+ blittingFlags |= DSBLIT_BLEND_ALPHACHANNEL;
if (opacity != 255) {
blittingFlags |= DSBLIT_BLEND_COLORALPHA;
+ surface->SetColor(surface, 0xff, 0xff, 0xff, opacity);
}
- surface->SetColor(surface, 0xff, 0xff, 0xff, opacity);
+
surface->SetBlittingFlags(surface, blittingFlags);
}
@@ -1154,13 +1175,18 @@ void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPix
QPointF offset = off;
Q_ASSERT(transform.type() <= QTransform::TxScale);
- prepareForBlit(pixmap.hasAlphaChannel());
QPixmapData *data = pixmap.pixmapData();
Q_ASSERT(data->classId() == QPixmapData::DirectFBClass);
QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(data);
+ IDirectFBSurface *sourceSurface = dfbData->directFBSurface();
+ uint blitFlags = 0;
+ if (dfbData->hasAlphaChannel())
+ blitFlags |= HasAlpha;
+ if (QDirectFBScreen::isPremultiplied(dfbData->pixelFormat()))
+ blitFlags |= Premultiplied;
+ prepareForBlit(blitFlags);
QDirectFBPaintEnginePrivate::unlock(dfbData);
const QSize pixmapSize = dfbData->size();
- IDirectFBSurface *sourceSurface = dfbData->directFBSurface();
if (transform.isScaling()) {
Q_ASSERT(supportsStretchBlit());
Q_ASSERT(qMin(transform.m11(), transform.m22()) >= 0);
diff --git a/src/plugins/graphicssystems/meego/dithering.cpp b/src/plugins/graphicssystems/meego/dithering.cpp
index b50826c..1a2e3fa 100644
--- a/src/plugins/graphicssystems/meego/dithering.cpp
+++ b/src/plugins/graphicssystems/meego/dithering.cpp
@@ -68,7 +68,7 @@
// Writes(ads) a new value to the diffusion accumulator. accumulator is a short.
// x, y is a position in the accumulation buffer. y can be 0 or 1 -- we operate on two lines at time.
-#define ACCUMULATE(accumulator, x, y, width, v) if (x < width && x > 0) accumulator[(y * width) + x] += v
+#define ACCUMULATE(accumulator, x, y, width, v) if (x < width && x >= 0) accumulator[(y * width) + x] += v
// Clamps a value to be in 0..255 range.
#define CLAMP_256(v) if (v > 255) v = 255; if (v < 0) v = 0;
@@ -76,8 +76,13 @@
// Converts incoming RGB32 (QImage::Format_RGB32) to RGB565. Returns the newly allocated data.
unsigned short* convertRGB32_to_RGB565(const unsigned char *in, int width, int height, int stride)
{
+ // Output line stride. Aligned to 4 bytes.
+ int alignedWidth = width;
+ if (alignedWidth % 2 > 0)
+ alignedWidth++;
+
// Will store output
- unsigned short *out = (unsigned short *) malloc(width * height * 2);
+ unsigned short *out = (unsigned short *) malloc(alignedWidth * height * 2);
// Lookup tables for the 8bit => 6bit and 8bit => 5bit conversion
unsigned char lookup_8bit_to_5bit[256];
@@ -105,18 +110,18 @@ unsigned short* convertRGB32_to_RGB565(const unsigned char *in, int width, int h
// Produce the conversion lookup tables.
for (i = 0; i < 256; i++) {
lookup_8bit_to_5bit[i] = round(i / 8.0);
- if (lookup_8bit_to_5bit[i] > 31)
- lookup_8bit_to_5bit[i] -= 1;
// Before bitshifts: (i * 8) - (... * 8 * 8)
lookup_8bit_to_5bit_diff[i] = (i << 3) - (lookup_8bit_to_5bit[i] << 6);
+ if (lookup_8bit_to_5bit[i] > 31)
+ lookup_8bit_to_5bit[i] -= 1;
lookup_8bit_to_6bit[i] = round(i / 4.0);
- if (lookup_8bit_to_6bit[i] > 63)
- lookup_8bit_to_6bit[i] -= 1;
// Before bitshifts: (i * 8) - (... * 4 * 8)
lookup_8bit_to_6bit_diff[i] = (i << 3) - (lookup_8bit_to_6bit[i] << 5);
+ if (lookup_8bit_to_6bit[i] > 63)
+ lookup_8bit_to_6bit[i] -= 1;
}
// Clear the accumulators
@@ -174,7 +179,7 @@ unsigned short* convertRGB32_to_RGB565(const unsigned char *in, int width, int h
}
// Write the newly produced pixel
- PUT_565(out, x, y, width, component[2], component[1], component[0]);
+ PUT_565(out, x, y, alignedWidth, component[2], component[1], component[0]);
}
}
@@ -183,10 +188,16 @@ unsigned short* convertRGB32_to_RGB565(const unsigned char *in, int width, int h
// Converts incoming RGBA32 (QImage::Format_ARGB32_Premultiplied) to RGB565. Returns the newly allocated data.
// This function is similar (yet different) to the _565 variant but it makes sense to duplicate it here for simplicity.
+// The output has each scan line aligned to 4 bytes (as expected by GL by default).
unsigned short* convertARGB32_to_RGBA4444(const unsigned char *in, int width, int height, int stride)
{
+ // Output line stride. Aligned to 4 bytes.
+ int alignedWidth = width;
+ if (alignedWidth % 2 > 0)
+ alignedWidth++;
+
// Will store output
- unsigned short *out = (unsigned short *) malloc(width * height * 2);
+ unsigned short *out = (unsigned short *) malloc(alignedWidth * 2 * height);
// Lookup tables for the 8bit => 4bit conversion
unsigned char lookup_8bit_to_4bit[256];
@@ -210,11 +221,11 @@ unsigned short* convertARGB32_to_RGBA4444(const unsigned char *in, int width, in
// Produce the conversion lookup tables.
for (i = 0; i < 256; i++) {
lookup_8bit_to_4bit[i] = round(i / 16.0);
- if (lookup_8bit_to_4bit[i] > 15)
- lookup_8bit_to_4bit[i] -= 1;
-
// Before bitshifts: (i * 8) - (... * 16 * 8)
lookup_8bit_to_4bit_diff[i] = (i << 3) - (lookup_8bit_to_4bit[i] << 7);
+
+ if (lookup_8bit_to_4bit[i] > 15)
+ lookup_8bit_to_4bit[i] = 15;
}
// Clear the accumulators
@@ -269,7 +280,25 @@ unsigned short* convertARGB32_to_RGBA4444(const unsigned char *in, int width, in
}
// Write the newly produced pixel
- PUT_4444(out, x, y, width, component[0], component[1], component[2], component[3]);
+ PUT_4444(out, x, y, alignedWidth, component[0], component[1], component[2], component[3]);
+ }
+ }
+
+ return out;
+}
+
+unsigned char* convertBGRA32_to_RGBA32(const unsigned char *in, int width, int height, int stride)
+{
+ unsigned char *out = (unsigned char *) malloc(stride * height);
+
+ // For each line...
+ for (int y = 0; y < height; y++) {
+ // For each column
+ for (int x = 0; x < width; x++) {
+ out[(stride * y) + (x * 4) + 0] = in[(stride * y) + (x * 4) + 2];
+ out[(stride * y) + (x * 4) + 1] = in[(stride * y) + (x * 4) + 1];
+ out[(stride * y) + (x * 4) + 2] = in[(stride * y) + (x * 4) + 0];
+ out[(stride * y) + (x * 4) + 3] = in[(stride * y) + (x * 4) + 3];
}
}
diff --git a/src/plugins/graphicssystems/meego/qmeegoextensions.cpp b/src/plugins/graphicssystems/meego/qmeegoextensions.cpp
index 611c962..dff80a4 100644
--- a/src/plugins/graphicssystems/meego/qmeegoextensions.cpp
+++ b/src/plugins/graphicssystems/meego/qmeegoextensions.cpp
@@ -47,6 +47,7 @@ bool QMeeGoExtensions::initialized = false;
bool QMeeGoExtensions::hasImageShared = false;
bool QMeeGoExtensions::hasSurfaceScaling = false;
bool QMeeGoExtensions::hasLockSurface = false;
+bool QMeeGoExtensions::hasFenceSync = false;
/* Extension funcs */
@@ -54,8 +55,12 @@ typedef EGLBoolean (EGLAPIENTRY *eglQueryImageNOKFunc)(EGLDisplay, EGLImageKHR,
typedef EGLNativeSharedImageTypeNOK (EGLAPIENTRY *eglCreateSharedImageNOKFunc)(EGLDisplay, EGLImageKHR, EGLint*);
typedef EGLBoolean (EGLAPIENTRY *eglDestroySharedImageNOKFunc)(EGLDisplay, EGLNativeSharedImageTypeNOK);
typedef EGLBoolean (EGLAPIENTRY *eglSetSurfaceScalingNOKFunc)(EGLDisplay, EGLSurface, EGLint, EGLint, EGLint, EGLint);
-typedef EGLBoolean (EGLAPIENTRY *eglLockSurfaceKHRFunc)(EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRY *eglUnlockSurfaceKHRFunc)(EGLDisplay display, EGLSurface surface);
+typedef EGLBoolean (EGLAPIENTRY *eglLockSurfaceKHRFunc)(EGLDisplay, EGLSurface, const EGLint*);
+typedef EGLBoolean (EGLAPIENTRY *eglUnlockSurfaceKHRFunc)(EGLDisplay, EGLSurface);
+typedef EGLSyncKHR (EGLAPIENTRY *eglCreateSyncKHRFunc)(EGLDisplay, EGLenum, const EGLint*);
+typedef EGLBoolean (EGLAPIENTRY *eglDestroySyncKHRFunc)(EGLDisplay, EGLSyncKHR);
+typedef EGLint (EGLAPIENTRY *eglClientWaitSyncKHRFunc)(EGLDisplay, EGLSyncKHR, EGLint, EGLTimeKHR);
+typedef EGLBoolean (EGLAPIENTRY *eglGetSyncAttribKHRFunc)(EGLDisplay, EGLSyncKHR, EGLint, EGLint*);
static eglQueryImageNOKFunc _eglQueryImageNOK = 0;
static eglCreateSharedImageNOKFunc _eglCreateSharedImageNOK = 0;
@@ -63,6 +68,10 @@ static eglDestroySharedImageNOKFunc _eglDestroySharedImageNOK = 0;
static eglSetSurfaceScalingNOKFunc _eglSetSurfaceScalingNOK = 0;
static eglLockSurfaceKHRFunc _eglLockSurfaceKHR = 0;
static eglUnlockSurfaceKHRFunc _eglUnlockSurfaceKHR = 0;
+static eglCreateSyncKHRFunc _eglCreateSyncKHR = 0;
+static eglDestroySyncKHRFunc _eglDestroySyncKHR = 0;
+static eglClientWaitSyncKHRFunc _eglClientWaitSyncKHR = 0;
+static eglGetSyncAttribKHRFunc _eglGetSyncAttribKHR = 0;
/* Public */
@@ -76,15 +85,15 @@ void QMeeGoExtensions::ensureInitialized()
EGLNativeSharedImageTypeNOK QMeeGoExtensions::eglCreateSharedImageNOK(EGLDisplay dpy, EGLImageKHR image, EGLint *props)
{
- if (! hasImageShared)
+ if (!hasImageShared)
qFatal("EGL_NOK_image_shared not found but trying to use capability!");
-
+
return _eglCreateSharedImageNOK(dpy, image, props);
}
bool QMeeGoExtensions::eglQueryImageNOK(EGLDisplay dpy, EGLImageKHR image, EGLint prop, EGLint *v)
{
- if (! hasImageShared)
+ if (!hasImageShared)
qFatal("EGL_NOK_image_shared not found but trying to use capability!");
return _eglQueryImageNOK(dpy, image, prop, v);
@@ -92,7 +101,7 @@ bool QMeeGoExtensions::eglQueryImageNOK(EGLDisplay dpy, EGLImageKHR image, EGLin
bool QMeeGoExtensions::eglDestroySharedImageNOK(EGLDisplay dpy, EGLNativeSharedImageTypeNOK img)
{
- if (! hasImageShared)
+ if (!hasImageShared)
qFatal("EGL_NOK_image_shared not found but trying to use capability!");
return _eglDestroySharedImageNOK(dpy, img);
@@ -100,7 +109,7 @@ bool QMeeGoExtensions::eglDestroySharedImageNOK(EGLDisplay dpy, EGLNativeSharedI
bool QMeeGoExtensions::eglSetSurfaceScalingNOK(EGLDisplay dpy, EGLSurface surface, int x, int y, int width, int height)
{
- if (! hasSurfaceScaling)
+ if (!hasSurfaceScaling)
qFatal("EGL_NOK_surface_scaling not found but trying to use capability!");
return _eglSetSurfaceScalingNOK(dpy, surface, x, y, width, height);
@@ -108,7 +117,7 @@ bool QMeeGoExtensions::eglSetSurfaceScalingNOK(EGLDisplay dpy, EGLSurface surfac
bool QMeeGoExtensions::eglLockSurfaceKHR(EGLDisplay display, EGLSurface surface, const EGLint *attrib_list)
{
- if (! hasLockSurface)
+ if (!hasLockSurface)
qFatal("EGL_KHR_lock_surface2 not found but trying to use capability!");
return _eglLockSurfaceKHR(display, surface, attrib_list);
@@ -116,19 +125,51 @@ bool QMeeGoExtensions::eglLockSurfaceKHR(EGLDisplay display, EGLSurface surface,
bool QMeeGoExtensions::eglUnlockSurfaceKHR(EGLDisplay display, EGLSurface surface)
{
- if (! hasLockSurface)
+ if (!hasLockSurface)
qFatal("EGL_KHR_lock_surface2 not found but trying to use capability!");
return _eglUnlockSurfaceKHR(display, surface);
}
+EGLSyncKHR QMeeGoExtensions::eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list)
+{
+ if (!hasFenceSync)
+ qFatal("EGL_KHR_fence_sync not found but trying to use capability!");
+
+ return _eglCreateSyncKHR(dpy, type, attrib_list);
+}
+
+bool QMeeGoExtensions::eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync)
+{
+ if (!hasFenceSync)
+ qFatal("EGL_KHR_fence_sync not found but trying to use capability!");
+
+ return _eglDestroySyncKHR(dpy, sync);
+}
+
+EGLint QMeeGoExtensions::eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout)
+{
+ if (!hasFenceSync)
+ qFatal("EGL_KHR_fence_sync not found but trying to use capability!");
+
+ return _eglClientWaitSyncKHR(dpy, sync, flags, timeout);
+}
+
+EGLBoolean QMeeGoExtensions::eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value)
+{
+ if (!hasFenceSync)
+ qFatal("EGL_KHR_fence_sync not found but trying to use capability!");
+
+ return _eglGetSyncAttribKHR(dpy, sync, attribute, value);
+}
+
/* Private */
void QMeeGoExtensions::initialize()
{
QGLContext *ctx = (QGLContext *) QGLContext::currentContext();
qt_resolve_eglimage_gl_extensions(ctx);
-
+
if (QEgl::hasExtension("EGL_NOK_image_shared")) {
qDebug("MeegoGraphics: found EGL_NOK_image_shared");
_eglQueryImageNOK = (eglQueryImageNOKFunc) eglGetProcAddress("eglQueryImageNOK");
@@ -136,15 +177,15 @@ void QMeeGoExtensions::initialize()
_eglDestroySharedImageNOK = (eglDestroySharedImageNOKFunc) eglGetProcAddress("eglDestroySharedImageNOK");
_eglLockSurfaceKHR = (eglLockSurfaceKHRFunc) eglGetProcAddress("eglLockSurfaceKHR");
_eglUnlockSurfaceKHR = (eglUnlockSurfaceKHRFunc) eglGetProcAddress("eglUnlockSurfaceKHR");
-
+
Q_ASSERT(_eglQueryImageNOK && _eglCreateSharedImageNOK && _eglDestroySharedImageNOK);
hasImageShared = true;
}
-
+
if (QEgl::hasExtension("EGL_NOK_surface_scaling")) {
qDebug("MeegoGraphics: found EGL_NOK_surface_scaling");
_eglSetSurfaceScalingNOK = (eglSetSurfaceScalingNOKFunc) eglGetProcAddress("eglSetSurfaceScalingNOK");
-
+
Q_ASSERT(_eglSetSurfaceScalingNOK);
hasSurfaceScaling = true;
}
@@ -153,9 +194,20 @@ void QMeeGoExtensions::initialize()
qDebug("MeegoGraphics: found EGL_KHR_lock_surface2");
_eglLockSurfaceKHR = (eglLockSurfaceKHRFunc) eglGetProcAddress("eglLockSurfaceKHR");
_eglUnlockSurfaceKHR = (eglUnlockSurfaceKHRFunc) eglGetProcAddress("eglUnlockSurfaceKHR");
-
+
Q_ASSERT(_eglLockSurfaceKHR && _eglUnlockSurfaceKHR);
hasLockSurface = true;
}
+
+ if (QEgl::hasExtension("EGL_KHR_fence_sync")) {
+ qDebug("MeegoGraphics: found EGL_KHR_fence_sync");
+ _eglCreateSyncKHR = (eglCreateSyncKHRFunc) eglGetProcAddress("eglCreateSyncKHR");
+ _eglDestroySyncKHR = (eglDestroySyncKHRFunc) eglGetProcAddress("eglDestroySyncKHR");
+ _eglClientWaitSyncKHR = (eglClientWaitSyncKHRFunc) eglGetProcAddress("eglClientWaitSyncKHR");
+ _eglGetSyncAttribKHR = (eglGetSyncAttribKHRFunc) eglGetProcAddress("eglGetSyncAttribKHR");
+
+ Q_ASSERT(_eglCreateSyncKHR && _eglDestroySyncKHR && _eglClientWaitSyncKHR && _eglGetSyncAttribKHR);
+ hasFenceSync = true;
+ }
}
diff --git a/src/plugins/graphicssystems/meego/qmeegoextensions.h b/src/plugins/graphicssystems/meego/qmeegoextensions.h
index 9e78caf..49a1e30 100644
--- a/src/plugins/graphicssystems/meego/qmeegoextensions.h
+++ b/src/plugins/graphicssystems/meego/qmeegoextensions.h
@@ -77,6 +77,23 @@ typedef void* EGLNativeSharedImageTypeNOK;
#define EGL_WRITE_SURFACE_BIT_KHR 0x0002
#endif
+#ifndef EGL_SYNC_FENCE_KHR
+#define EGL_SYNC_FENCE_KHR 0x30F9
+#define EGL_SYNC_TYPE_KHR 0x30F7
+#define EGL_SYNC_STATUS_KHR 0x30F1
+#define EGL_SYNC_CONDITION_KHR 0x30F8
+#define EGL_SIGNALED_KHR 0x30F2
+#define EGL_UNSIGNALED_KHR 0x30F3
+#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0
+#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001
+#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull
+#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5
+#define EGL_CONDITION_SATISFIED_KHR 0x30F6
+#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0)
+typedef void* EGLSyncKHR;
+typedef khronos_utime_nanoseconds_t EGLTimeKHR;
+#endif
+
/* Class */
class QMeeGoExtensions
@@ -90,6 +107,10 @@ public:
static bool eglSetSurfaceScalingNOK(EGLDisplay dpy, EGLSurface surface, int x, int y, int width, int height);
static bool eglLockSurfaceKHR(EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
static bool eglUnlockSurfaceKHR(EGLDisplay display, EGLSurface surface);
+ static EGLSyncKHR eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
+ static bool eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync);
+ static EGLint eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
+ static EGLBoolean eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
private:
static void initialize();
@@ -98,6 +119,7 @@ private:
static bool hasImageShared;
static bool hasSurfaceScaling;
static bool hasLockSurface;
+ static bool hasFenceSync;
};
#endif
diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
index a633e2f..063af13 100644
--- a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
+++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
@@ -82,12 +82,12 @@ QWindowSurface* QMeeGoGraphicsSystem::createWindowSurface(QWidget *widget) const
QPixmapData *QMeeGoGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const
{
- // Long story short: without this it's possible to hit an
- // unitialized paintDevice due to a Qt bug too complex to even
- // explain here... not to mention fix without going crazy.
+ // Long story short: without this it's possible to hit an
+ // unitialized paintDevice due to a Qt bug too complex to even
+ // explain here... not to mention fix without going crazy.
// MDK
QGLShareContextScope ctx(qt_gl_share_widget()->context());
-
+
return new QRasterPixmapData(type);
}
@@ -103,8 +103,8 @@ QPixmapData *QMeeGoGraphicsSystem::createPixmapData(QPixmapData *origin)
if (QMeeGoPixmapData::sharedImagesMap.contains(rawResource))
return new QMeeGoPixmapData();
- }
-
+ }
+
return new QRasterPixmapData(origin->pixelType());
}
@@ -155,7 +155,7 @@ QPixmapData *QMeeGoGraphicsSystem::pixmapDataFromEGLSharedImage(Qt::HANDLE handl
qFatal("For egl shared images, the soft image has to be ARGB32_Premultiplied or RGB32");
return NULL;
}
-
+
if (QMeeGoGraphicsSystem::meeGoRunning()) {
QMeeGoPixmapData *pmd = new QMeeGoPixmapData;
pmd->fromEGLSharedImage(handle, softImage);
@@ -177,9 +177,9 @@ QPixmapData *QMeeGoGraphicsSystem::pixmapDataFromEGLSharedImage(Qt::HANDLE handl
void QMeeGoGraphicsSystem::updateEGLSharedImagePixmap(QPixmap *pixmap)
{
QMeeGoPixmapData *pmd = (QMeeGoPixmapData *) pixmap->pixmapData();
-
+
// Basic sanity check to make sure this is really a QMeeGoPixmapData...
- if (pmd->classId() != QPixmapData::OpenGLClass)
+ if (pmd->classId() != QPixmapData::OpenGLClass)
qFatal("Trying to updated EGLSharedImage pixmap but it's not really a shared image pixmap!");
pmd->updateFromSoftImage();
@@ -218,10 +218,10 @@ QPixmapData* QMeeGoGraphicsSystem::pixmapDataFromLiveTextureHandle(Qt::HANDLE ha
return new QMeeGoLivePixmapData(handle);
}
-QImage* QMeeGoGraphicsSystem::lockLiveTexture(QPixmap* pixmap)
+QImage* QMeeGoGraphicsSystem::lockLiveTexture(QPixmap* pixmap, void* fenceSync)
{
QMeeGoLivePixmapData *pixmapData = static_cast<QMeeGoLivePixmapData*>(pixmap->data_ptr().data());
- return pixmapData->lock();
+ return pixmapData->lock(fenceSync);
}
bool QMeeGoGraphicsSystem::releaseLiveTexture(QPixmap *pixmap, QImage *image)
@@ -236,6 +236,20 @@ Qt::HANDLE QMeeGoGraphicsSystem::getLiveTextureHandle(QPixmap *pixmap)
return pixmapData->handle();
}
+void* QMeeGoGraphicsSystem::createFenceSync()
+{
+ QGLShareContextScope ctx(qt_gl_share_widget()->context());
+ QMeeGoExtensions::ensureInitialized();
+ return QMeeGoExtensions::eglCreateSyncKHR(QEgl::display(), EGL_SYNC_FENCE_KHR, NULL);
+}
+
+void QMeeGoGraphicsSystem::destroyFenceSync(void *fenceSync)
+{
+ QGLShareContextScope ctx(qt_gl_share_widget()->context());
+ QMeeGoExtensions::ensureInitialized();
+ QMeeGoExtensions::eglDestroySyncKHR(QEgl::display(), fenceSync);
+}
+
/* C API */
int qt_meego_image_to_egl_shared_image(const QImage &image)
@@ -288,9 +302,9 @@ QPixmapData* qt_meego_pixmapdata_from_live_texture_handle(Qt::HANDLE handle)
return QMeeGoGraphicsSystem::pixmapDataFromLiveTextureHandle(handle);
}
-QImage* qt_meego_live_texture_lock(QPixmap *pixmap)
+QImage* qt_meego_live_texture_lock(QPixmap *pixmap, void *fenceSync)
{
- return QMeeGoGraphicsSystem::lockLiveTexture(pixmap);
+ return QMeeGoGraphicsSystem::lockLiveTexture(pixmap, fenceSync);
}
bool qt_meego_live_texture_release(QPixmap *pixmap, QImage *image)
@@ -301,4 +315,14 @@ bool qt_meego_live_texture_release(QPixmap *pixmap, QImage *image)
Qt::HANDLE qt_meego_live_texture_get_handle(QPixmap *pixmap)
{
return QMeeGoGraphicsSystem::getLiveTextureHandle(pixmap);
-} \ No newline at end of file
+}
+
+void* qt_meego_create_fence_sync(void)
+{
+ return QMeeGoGraphicsSystem::createFenceSync();
+}
+
+void qt_meego_destroy_fence_sync(void* fs)
+{
+ return QMeeGoGraphicsSystem::destroyFenceSync(fs);
+}
diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.h b/src/plugins/graphicssystems/meego/qmeegographicssystem.h
index 2697f0f..1e50f00 100644
--- a/src/plugins/graphicssystems/meego/qmeegographicssystem.h
+++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.h
@@ -69,10 +69,13 @@ public:
static QPixmapData *pixmapDataWithNewLiveTexture(int w, int h, QImage::Format format);
static QPixmapData *pixmapDataFromLiveTextureHandle(Qt::HANDLE handle);
- static QImage *lockLiveTexture(QPixmap* pixmap);
+ static QImage *lockLiveTexture(QPixmap* pixmap, void* fenceSync);
static bool releaseLiveTexture(QPixmap *pixmap, QImage *image);
static Qt::HANDLE getLiveTextureHandle(QPixmap *pixmap);
+ static void* createFenceSync();
+ static void destroyFenceSync(void* fenceSync);
+
private:
static bool meeGoRunning();
static EGLSurface getSurfaceForLiveTexturePixmap(QPixmap *pixmap);
@@ -95,9 +98,11 @@ extern "C" {
Q_DECL_EXPORT void qt_meego_set_translucent(bool translucent);
Q_DECL_EXPORT QPixmapData* qt_meego_pixmapdata_with_new_live_texture(int w, int h, QImage::Format format);
Q_DECL_EXPORT QPixmapData* qt_meego_pixmapdata_from_live_texture_handle(Qt::HANDLE handle);
- Q_DECL_EXPORT QImage* qt_meego_live_texture_lock(QPixmap *pixmap);
+ Q_DECL_EXPORT QImage* qt_meego_live_texture_lock(QPixmap *pixmap, void *fenceSync);
Q_DECL_EXPORT bool qt_meego_live_texture_release(QPixmap *pixmap, QImage *image);
Q_DECL_EXPORT Qt::HANDLE qt_meego_live_texture_get_handle(QPixmap *pixmap);
+ Q_DECL_EXPORT void* qt_meego_create_fence_sync(void);
+ Q_DECL_EXPORT void qt_meego_destroy_fence_sync(void* fs);
}
#endif
diff --git a/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp b/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp
index 405b765..16096c9 100644
--- a/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp
+++ b/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp
@@ -40,7 +40,6 @@
****************************************************************************/
#include "qmeegolivepixmapdata.h"
-#include "qmeegoextensions.h"
#include "qmeegorasterpixmapdata.h"
#include <private/qimage_p.h>
#include <private/qwindowsurface_gl_p.h>
@@ -171,11 +170,18 @@ QPixmapData *QMeeGoLivePixmapData::createCompatiblePixmapData() const
return new QMeeGoRasterPixmapData(pixelType());
}
-QImage* QMeeGoLivePixmapData::lock()
+QImage* QMeeGoLivePixmapData::lock(EGLSyncKHR fenceSync)
{
QGLShareContextScope ctx(qt_gl_share_widget()->context());
QMeeGoExtensions::ensureInitialized();
+ if (fenceSync) {
+ QMeeGoExtensions::eglClientWaitSyncKHR(QEgl::display(),
+ fenceSync,
+ EGL_SYNC_FLUSH_COMMANDS_BIT_KHR,
+ EGL_FOREVER_KHR);
+ }
+
void *data = 0;
int pitch = 0;
EGLSurface surface = 0;
@@ -214,7 +220,6 @@ bool QMeeGoLivePixmapData::release(QImage* /*img*/)
if (QMeeGoExtensions::eglUnlockSurfaceKHR(QEgl::display(), getSurfaceForBackingPixmap())) {
lockedImage = QImage();
- glFinish();
return true;
} else {
lockedImage = QImage();
@@ -229,7 +234,7 @@ Qt::HANDLE QMeeGoLivePixmapData::handle()
bool QMeeGoLivePixmapData::scroll(int dx, int dy, const QRect &rect)
{
- lock();
+ lock(NULL);
if (!lockedImage.isNull())
qt_scrollRectInImage(lockedImage, rect, QPoint(dx, dy));
diff --git a/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.h b/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.h
index 1d647f0..2c6854e 100644
--- a/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.h
+++ b/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.h
@@ -43,6 +43,7 @@
#define MLIVEPIXMAPDATA_H
#include <private/qpixmapdata_gl_p.h>
+#include "qmeegoextensions.h"
class QMeeGoLivePixmapData : public QGLPixmapData
{
@@ -50,16 +51,16 @@ public:
QMeeGoLivePixmapData(int w, int h, QImage::Format format);
QMeeGoLivePixmapData(Qt::HANDLE h);
~QMeeGoLivePixmapData();
-
+
QPixmapData *createCompatiblePixmapData() const;
bool scroll(int dx, int dy, const QRect &rect);
void initializeThroughEGLImage();
-
- QImage* lock();
+
+ QImage* lock(EGLSyncKHR fenceSync);
bool release(QImage *img);
Qt::HANDLE handle();
-
+
EGLSurface getSurfaceForBackingPixmap();
void destroySurfaceForPixmapData(QPixmapData* pmd);
diff --git a/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp b/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp
index 02a4273..eb63692 100644
--- a/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp
+++ b/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp
@@ -51,6 +51,7 @@
// from dithering.cpp
extern unsigned short* convertRGB32_to_RGB565(const unsigned char *in, int width, int height, int stride);
extern unsigned short* convertARGB32_to_RGBA4444(const unsigned char *in, int width, int height, int stride);
+extern unsigned char* convertBGRA32_to_RGBA32(const unsigned char *in, int width, int height, int stride);
static EGLint preserved_image_attribs[] = { EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE };
@@ -146,8 +147,8 @@ Qt::HANDLE QMeeGoPixmapData::imageToEGLSharedImage(const QImage &image)
glGenTextures(1, &textureId);
glBindTexture(GL_TEXTURE_2D, textureId);
if (image.hasAlphaChannel() && const_cast<QImage &>(image).data_ptr()->checkForAlphaPixels()) {
- void *converted = convertARGB32_to_RGBA4444(image.bits(), image.width(), image.height(), image.bytesPerLine());
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.width(), image.height(), 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, converted);
+ void *converted = convertBGRA32_to_RGBA32(image.bits(), image.width(), image.height(), image.bytesPerLine());
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.width(), image.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, converted);
free(converted);
} else {
void *converted = convertRGB32_to_RGB565(image.bits(), image.width(), image.height(), image.bytesPerLine());
diff --git a/src/plugins/phonon/mmf/mmf.pro b/src/plugins/phonon/mmf/mmf.pro
index ade9023..2188505 100644
--- a/src/plugins/phonon/mmf/mmf.pro
+++ b/src/plugins/phonon/mmf/mmf.pro
@@ -18,7 +18,7 @@ symbian {
# This is necessary because both epoc32/include and Phonon contain videoplayer.h.
# By making /epoc32/include the first SYSTEMINCLUDE, we ensure that
# '#include <videoplayer.h>' picks up the Symbian header, as intended.
- PREPEND_INCLUDEPATH = $$EPOCROOT/epoc32/include
+ PREPEND_INCLUDEPATH = $${EPOCROOT}epoc32/include
PREPEND_INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty
diff --git a/src/qt3support/canvas/q3canvas.cpp b/src/qt3support/canvas/q3canvas.cpp
index 959c435..1b4706d 100644
--- a/src/qt3support/canvas/q3canvas.cpp
+++ b/src/qt3support/canvas/q3canvas.cpp
@@ -1030,7 +1030,7 @@ void Q3Canvas::setUpdatePeriod(int ms)
The advance takes place in two phases. In phase 0, the
Q3CanvasItem::advance() function of each Q3CanvasItem::animated()
- canvas item is called with paramater 0. Then all these canvas
+ canvas item is called with parameter 0. Then all these canvas
items are called again, with parameter 1. In phase 0, the canvas
items should not change position, merely examine other items on
the canvas for which special processing is required, such as
diff --git a/src/qt3support/text/q3richtext.cpp b/src/qt3support/text/q3richtext.cpp
index d84a85b..f8cd1ed 100644
--- a/src/qt3support/text/q3richtext.cpp
+++ b/src/qt3support/text/q3richtext.cpp
@@ -2914,7 +2914,7 @@ QString Q3TextDocument::selectedText(int id, bool asRichText) const
}
}
// ### workaround for plain text export until we get proper
- // mime types: turn unicode line seperators into the more
+ // mime types: turn unicode line separators into the more
// widely understood \n. Makes copy and pasting code snipplets
// from within Assistent possible
QChar* uc = (QChar*) s.unicode();
diff --git a/src/s60installs/bwins/QtDeclarativeu.def b/src/s60installs/bwins/QtDeclarativeu.def
index db4012c..9e88df7 100644
--- a/src/s60installs/bwins/QtDeclarativeu.def
+++ b/src/s60installs/bwins/QtDeclarativeu.def
@@ -1838,5 +1838,6 @@ EXPORTS
?addChanged@QDeclarativeBasePositioner@@IAEXXZ @ 1837 NONAME ABSENT ; void QDeclarativeBasePositioner::addChanged(void)
?start@QDeclarativeAbstractAnimation@@QAEXXZ @ 1838 NONAME ABSENT ; void QDeclarativeAbstractAnimation::start(void)
?qt_metacall@QDeclarativeAbstractAnimation@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1839 NONAME ABSENT ; int QDeclarativeAbstractAnimation::qt_metacall(enum QMetaObject::Call, int, void * *)
- ?connect@QDeclarativePropertyPrivate@@SA_NPBVQObject@@H0HHPAH@Z @ 1840 NONAME ABSENT ; bool QDeclarativePropertyPrivate::connect(class QObject const *, int, class QObject const *, int, int, int *)
+ ?enableDebugging@QDeclarativeDebugHelper@@SAXXZ @ 1840 NONAME ; void QDeclarativeDebugHelper::enableDebugging(void)
+ ?connect@QDeclarativePropertyPrivate@@SA_NPBVQObject@@H0HHPAH@Z @ 1841 NONAME ABSENT ; bool QDeclarativePropertyPrivate::connect(class QObject const *, int, class QObject const *, int, int, int *)
diff --git a/src/s60installs/bwins/QtOpenVGu.def b/src/s60installs/bwins/QtOpenVGu.def
index a67725e..87b9c7f 100644
--- a/src/s60installs/bwins/QtOpenVGu.def
+++ b/src/s60installs/bwins/QtOpenVGu.def
@@ -175,4 +175,5 @@ EXPORTS
?createPixmapForImage@QVGPixmapData@@IAEXAAVQImage@@V?$QFlags@W4ImageConversionFlag@Qt@@@@_N@Z @ 174 NONAME ; void QVGPixmapData::createPixmapForImage(class QImage &, class QFlags<enum Qt::ImageConversionFlag>, bool)
?fromData@QVGPixmapData@@UAE_NPBEIPBDV?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 175 NONAME ; bool QVGPixmapData::fromData(unsigned char const *, unsigned int, char const *, class QFlags<enum Qt::ImageConversionFlag>)
?fromImageReader@QVGPixmapData@@UAEXPAVQImageReader@@V?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 176 NONAME ; void QVGPixmapData::fromImageReader(class QImageReader *, class QFlags<enum Qt::ImageConversionFlag>)
+ ?canVgWritePixels@QVGPaintEngine@@ABE_NABVQImage@@@Z @ 177 NONAME ; bool QVGPaintEngine::canVgWritePixels(class QImage const &) const
diff --git a/src/s60installs/eabi/QtCoreu.def b/src/s60installs/eabi/QtCoreu.def
index eb53dca..aefbe1f 100644
--- a/src/s60installs/eabi/QtCoreu.def
+++ b/src/s60installs/eabi/QtCoreu.def
@@ -3713,4 +3713,5 @@ EXPORTS
_ZrsR11QDataStreamR12QEasingCurve @ 3712 NONAME
_Z26qt_symbian_SetupThreadHeapiR24SStdEpocThreadCreateInfo @ 3713 NONAME
_ZN24QAbstractDeclarativeData17objectNameChangedE @ 3714 NONAME DATA 4
+ _ZN23QEventDispatcherSymbian36queueDeferredActiveObjectsCompletionEv @ 3715 NONAME
diff --git a/src/s60installs/eabi/QtDeclarativeu.def b/src/s60installs/eabi/QtDeclarativeu.def
index 849ca6a..1f69061 100644
--- a/src/s60installs/eabi/QtDeclarativeu.def
+++ b/src/s60installs/eabi/QtDeclarativeu.def
@@ -1883,5 +1883,6 @@ EXPORTS
_ZThn8_N29QDeclarativeAbstractAnimation9setTargetERK20QDeclarativeProperty @ 1882 NONAME ABSENT
_ZThn8_N29QDeclarativeAbstractAnimationD0Ev @ 1883 NONAME ABSENT
_ZThn8_N29QDeclarativeAbstractAnimationD1Ev @ 1884 NONAME ABSENT
- _ZN27QDeclarativePropertyPrivate7connectEPK7QObjectiS2_iiPi @ 1885 NONAME ABSENT
+ _ZN23QDeclarativeDebugHelper15enableDebuggingEv @ 1885 NONAME
+ _ZN27QDeclarativePropertyPrivate7connectEPK7QObjectiS2_iiPi @ 1886 NONAME ABSENT
diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def
index f772bcc..75bb026 100644
--- a/src/s60installs/eabi/QtGuiu.def
+++ b/src/s60installs/eabi/QtGuiu.def
@@ -12101,4 +12101,7 @@ EXPORTS
_ZN19QApplicationPrivate25qmljsDebugArgumentsStringEv @ 12100 NONAME
_ZNK5QFont14lastResortFontEv @ 12101 NONAME
_ZN11QFontEngine33convertToPostscriptFontFamilyNameERK10QByteArray @ 12102 NONAME
+ _ZN15QStaticTextItem13setFontEngineEP11QFontEngine @ 12103 NONAME
+ _ZN15QStaticTextItemD1Ev @ 12104 NONAME
+ _ZN15QStaticTextItemD2Ev @ 12105 NONAME
diff --git a/src/s60installs/eabi/QtOpenVGu.def b/src/s60installs/eabi/QtOpenVGu.def
index 99942b8..e1828c1 100644
--- a/src/s60installs/eabi/QtOpenVGu.def
+++ b/src/s60installs/eabi/QtOpenVGu.def
@@ -205,4 +205,5 @@ EXPORTS
_ZN13QVGPixmapData20createPixmapForImageER6QImage6QFlagsIN2Qt19ImageConversionFlagEEb @ 204 NONAME
_ZN13QVGPixmapData8fromDataEPKhjPKc6QFlagsIN2Qt19ImageConversionFlagEE @ 205 NONAME
_ZN13QVGPixmapData8fromFileERK7QStringPKc6QFlagsIN2Qt19ImageConversionFlagEE @ 206 NONAME
+ _ZNK14QVGPaintEngine16canVgWritePixelsERK6QImage @ 207 NONAME
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index 2d5e5f4..69abcad 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -808,7 +808,7 @@ JSC::JSValue JSC_HOST_CALL functionQsTranslate(JSC::ExecState *exec, JSC::JSObje
JSC::UString comment;
if (args.size() > 2)
comment = args.at(2).toString(exec);
- QCoreApplication::Encoding encoding = QCoreApplication::CodecForTr;
+ QCoreApplication::Encoding encoding = QCoreApplication::UnicodeUTF8;
if (args.size() > 3) {
JSC::UString encStr = args.at(3).toString(exec);
if (encStr == "CodecForTr")
@@ -824,9 +824,9 @@ JSC::JSValue JSC_HOST_CALL functionQsTranslate(JSC::ExecState *exec, JSC::JSObje
#endif
JSC::UString result;
#ifndef QT_NO_QOBJECT
- result = QCoreApplication::translate(QScript::convertToLatin1(context).constData(),
- QScript::convertToLatin1(text).constData(),
- QScript::convertToLatin1(comment).constData(),
+ result = QCoreApplication::translate(context.UTF8String().c_str(),
+ text.UTF8String().c_str(),
+ comment.UTF8String().c_str(),
encoding, n);
#else
result = text;
@@ -878,10 +878,10 @@ JSC::JSValue JSC_HOST_CALL functionQsTr(JSC::ExecState *exec, JSC::JSObject*, JS
#endif
JSC::UString result;
#ifndef QT_NO_QOBJECT
- result = QCoreApplication::translate(QScript::convertToLatin1(context).constData(),
- QScript::convertToLatin1(text).constData(),
- QScript::convertToLatin1(comment).constData(),
- QCoreApplication::CodecForTr, n);
+ result = QCoreApplication::translate(context.UTF8String().c_str(),
+ text.UTF8String().c_str(),
+ comment.UTF8String().c_str(),
+ QCoreApplication::UnicodeUTF8, n);
#else
result = text;
#endif
@@ -907,7 +907,7 @@ JSC::JSValue JSC_HOST_CALL functionQsTrId(JSC::ExecState *exec, JSC::JSObject*,
int n = -1;
if (args.size() > 1)
n = args.at(1).toInt32(exec);
- return JSC::jsString(exec, qtTrId(QScript::convertToLatin1(id).constData(), n));
+ return JSC::jsString(exec, qtTrId(id.UTF8String().c_str(), n));
}
JSC::JSValue JSC_HOST_CALL functionQsTrIdNoOp(JSC::ExecState *, JSC::JSObject*, JSC::JSValue, const JSC::ArgList &args)
diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp
index e6c3801..8cd4057 100644
--- a/src/script/api/qscriptvalue.cpp
+++ b/src/script/api/qscriptvalue.cpp
@@ -2026,6 +2026,7 @@ void QScriptValue::setData(const QScriptValue &data)
Q_D(QScriptValue);
if (!d || !d->isObject())
return;
+ QScript::APIShim shim(d->engine);
JSC::JSValue other = d->engine->scriptValueToJSCValue(data);
if (d->jscValue.inherits(&QScriptObject::info)) {
QScriptObject *scriptObject = static_cast<QScriptObject*>(JSC::asObject(d->jscValue));
diff --git a/src/script/bridge/qscriptclassobject.cpp b/src/script/bridge/qscriptclassobject.cpp
index 28f7bd1..51c0976 100644
--- a/src/script/bridge/qscriptclassobject.cpp
+++ b/src/script/bridge/qscriptclassobject.cpp
@@ -78,6 +78,12 @@ bool ClassObjectDelegate::getOwnPropertySlot(QScriptObject* object,
scriptObject, scriptName, QScriptClass::HandlesReadAccess, &id);
if (flags & QScriptClass::HandlesReadAccess) {
QScriptValue value = m_scriptClass->property(scriptObject, scriptName, id);
+ if (!value.isValid()) {
+ // The class claims to have the property, but returned an invalid
+ // value. Silently convert to undefined to avoid the invalid value
+ // "escaping" into JS.
+ value = QScriptValue(QScriptValue::UndefinedValue);
+ }
slot.setValue(engine->scriptValueToJSCValue(value));
return true;
}
@@ -119,6 +125,12 @@ bool ClassObjectDelegate::getOwnPropertyDescriptor(QScriptObject *object,
attribs |= pflags & QScriptValue::UserRange;
// Rather than calling the getter, we could return an access descriptor here.
QScriptValue value = m_scriptClass->property(scriptObject, scriptName, id);
+ if (!value.isValid()) {
+ // The class claims to have the property, but returned an invalid
+ // value. Silently convert to undefined to avoid the invalid value
+ // "escaping" into JS.
+ value = QScriptValue(QScriptValue::UndefinedValue);
+ }
descriptor.setDescriptor(engine->scriptValueToJSCValue(value), attribs);
return true;
}
diff --git a/src/scripttools/debugging/qscriptdebuggeragent.cpp b/src/scripttools/debugging/qscriptdebuggeragent.cpp
index 551f6c3..9362639 100644
--- a/src/scripttools/debugging/qscriptdebuggeragent.cpp
+++ b/src/scripttools/debugging/qscriptdebuggeragent.cpp
@@ -116,7 +116,7 @@ QScriptDebuggerAgent::~QScriptDebuggerAgent()
/*!
Instructs the agent to perform a "step into" operation. This
function returns immediately. The agent will report step completion
- at a later time, i.e. when script statements are evaluted.
+ at a later time, i.e. when script statements are evaluated.
*/
void QScriptDebuggerAgent::enterStepIntoMode(int count)
{
@@ -129,7 +129,7 @@ void QScriptDebuggerAgent::enterStepIntoMode(int count)
/*!
Instructs the agent to perform a "step over" operation. This
function returns immediately. The agent will report step completion
- at a later time, i.e. when script statements are evaluted.
+ at a later time, i.e. when script statements are evaluated.
*/
void QScriptDebuggerAgent::enterStepOverMode(int count)
{
@@ -146,7 +146,7 @@ void QScriptDebuggerAgent::enterStepOverMode(int count)
/*!
Instructs the agent to perform a "step out" operation. This
function returns immediately. The agent will report step completion
- at a later time, i.e. when script statements are evaluted.
+ at a later time, i.e. when script statements are evaluated.
*/
void QScriptDebuggerAgent::enterStepOutMode()
{
diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp
index 6870055..a4614bf 100644
--- a/src/sql/drivers/oci/qsql_oci.cpp
+++ b/src/sql/drivers/oci/qsql_oci.cpp
@@ -93,11 +93,13 @@ enum { QOCIEncoding = 2002 }; // AL16UTF16LE
enum { QOCIEncoding = 2000 }; // AL16UTF16
#endif
+#ifdef OCI_ATTR_CHARSET_FORM
// Always set the OCI_ATTR_CHARSET_FORM to SQLCS_NCHAR is safe
// because Oracle server will deal with the implicit Conversion
// Between CHAR and NCHAR.
// see: http://download.oracle.com/docs/cd/A91202_01/901_doc/appdev.901/a89857/oci05bnd.htm#422705
static const ub1 qOraCharsetForm = SQLCS_NCHAR;
+#endif
#if defined (OCI_UTF16ID)
static const ub2 qOraCharset = OCI_UTF16ID;
@@ -110,13 +112,23 @@ typedef QVarLengthArray<ub2, 32> SizeArray;
static QByteArray qMakeOraDate(const QDateTime& dt);
static QDateTime qMakeDate(const char* oraDate);
+
+static QByteArray qMakeOCINumber(const qlonglong &ll, OCIError *err);
+static QByteArray qMakeOCINumber(const qulonglong& ull, OCIError* err);
+
+static qlonglong qMakeLongLong(const char* ociNumber, OCIError* err);
+static qulonglong qMakeULongLong(const char* ociNumber, OCIError* err);
+
static QString qOraWarn(OCIError *err, int *errorCode = 0);
+
#ifndef Q_CC_SUN
static // for some reason, Sun CC can't use qOraWarning when it's declared static
#endif
void qOraWarning(const char* msg, OCIError *err);
static QSqlError qMakeError(const QString& errString, QSqlError::ErrorType type, OCIError *err);
+
+
class QOCIRowId: public QSharedData
{
public:
@@ -164,7 +176,6 @@ struct QOCIResultPrivate
int serverVersion;
int prefetchRows, prefetchMem;
- void setCharset(OCIBind* hbnd);
void setStatementAttributes();
int bindValue(OCIStmt *sql, OCIBind **hbnd, OCIError *err, int pos,
const QVariant &val, dvoid *indPtr, ub2 *tmpSize, QList<QByteArray> &tmpStorage);
@@ -176,6 +187,41 @@ struct QOCIResultPrivate
{ return q->bindValueType(i) & QSql::Out; }
inline bool isBinaryValue(int i) const
{ return q->bindValueType(i) & QSql::Binary; }
+
+ void setCharset(dvoid* handle, ub4 type) const
+ {
+ int r = 0;
+ Q_ASSERT(handle);
+
+#ifdef OCI_ATTR_CHARSET_FORM
+ r = OCIAttrSet(handle,
+ type,
+ // this const cast is safe since OCI doesn't touch
+ // the charset.
+ const_cast<void *>(static_cast<const void *>(&qOraCharsetForm)),
+ 0,
+ OCI_ATTR_CHARSET_FORM,
+ //Strange Oracle bug: some Oracle servers crash the server process with non-zero error handle (mostly for 10g).
+ //So ignore the error message here.
+ 0);
+ #ifdef QOCI_DEBUG
+ if (r != 0)
+ qWarning("QOCIResultPrivate::setCharset: Couldn't set OCI_ATTR_CHARSET_FORM.");
+ #endif
+#endif
+
+ r = OCIAttrSet(handle,
+ type,
+ // this const cast is safe since OCI doesn't touch
+ // the charset.
+ const_cast<void *>(static_cast<const void *>(&qOraCharset)),
+ 0,
+ OCI_ATTR_CHARSET_ID,
+ err);
+ if (r != 0)
+ qOraWarning("QOCIResultPrivate::setCharsetI Couldn't set OCI_ATTR_CHARSET_ID: ", err);
+
+ }
};
void QOCIResultPrivate::setStatementAttributes()
@@ -208,36 +254,6 @@ void QOCIResultPrivate::setStatementAttributes()
}
}
-void QOCIResultPrivate::setCharset(OCIBind* hbnd)
-{
- int r = 0;
-
- Q_ASSERT(hbnd);
-
- r = OCIAttrSet(hbnd,
- OCI_HTYPE_BIND,
- // this const cast is safe since OCI doesn't touch
- // the charset.
- const_cast<void *>(static_cast<const void *>(&qOraCharsetForm)),
- 0,
- OCI_ATTR_CHARSET_FORM,
- err);
- if (r != 0)
- qOraWarning("QOCIResultPrivate::setCharset: Couldn't set OCI_ATTR_CHARSET_FORM: ", err);
-
- r = OCIAttrSet(hbnd,
- OCI_HTYPE_BIND,
- // this const cast is safe since OCI doesn't touch
- // the charset.
- const_cast<void *>(static_cast<const void *>(&qOraCharset)),
- 0,
- OCI_ATTR_CHARSET_ID,
- err);
- if (r != 0)
- qOraWarning("QOCIResultPrivate::setCharset: Couldn't set OCI_ATTR_CHARSET_ID: ", err);
-
-}
-
int QOCIResultPrivate::bindValue(OCIStmt *sql, OCIBind **hbnd, OCIError *err, int pos,
const QVariant &val, dvoid *indPtr, ub2 *tmpSize, QList<QByteArray> &tmpStorage)
{
@@ -283,6 +299,28 @@ int QOCIResultPrivate::bindValue(OCIStmt *sql, OCIBind **hbnd, OCIError *err, in
sizeof(uint),
SQLT_UIN, indPtr, 0, 0, 0, 0, OCI_DEFAULT);
break;
+ case QVariant::LongLong:
+ {
+ QByteArray ba = qMakeOCINumber(val.toLongLong(), err);
+ r = OCIBindByPos(sql, hbnd, err,
+ pos + 1,
+ ba.data(),
+ ba.size(),
+ SQLT_VNU, indPtr, 0, 0, 0, 0, OCI_DEFAULT);
+ tmpStorage.append(ba);
+ break;
+ }
+ case QVariant::ULongLong:
+ {
+ QByteArray ba = qMakeOCINumber(val.toULongLong(), err);
+ r = OCIBindByPos(sql, hbnd, err,
+ pos + 1,
+ ba.data(),
+ ba.size(),
+ SQLT_VNU, indPtr, 0, 0, 0, 0, OCI_DEFAULT);
+ tmpStorage.append(ba);
+ break;
+ }
case QVariant::Double:
r = OCIBindByPos(sql, hbnd, err,
pos + 1,
@@ -325,7 +363,7 @@ int QOCIResultPrivate::bindValue(OCIStmt *sql, OCIBind **hbnd, OCIError *err, in
(s.length() + 1) * sizeof(QChar),
SQLT_STR, indPtr, 0, 0, 0, 0, OCI_DEFAULT);
if (r == OCI_SUCCESS)
- setCharset(*hbnd);
+ setCharset(*hbnd, OCI_HTYPE_BIND);
break;
}
} // fall through for OUT values
@@ -349,7 +387,7 @@ int QOCIResultPrivate::bindValue(OCIStmt *sql, OCIBind **hbnd, OCIError *err, in
SQLT_STR, indPtr, 0, 0, 0, 0, OCI_DEFAULT);
}
if (r == OCI_SUCCESS)
- setCharset(*hbnd);
+ setCharset(*hbnd, OCI_HTYPE_BIND);
tmpStorage.append(ba);
break;
} // default case
@@ -378,7 +416,7 @@ int QOCIResultPrivate::bindValues(QVector<QVariant> &values, IndicatorArray &ind
}
// will assign out value and remove its temp storage.
-static void qOraOutValue(QVariant &value, QList<QByteArray> &storage)
+static void qOraOutValue(QVariant &value, QList<QByteArray> &storage, OCIError* err)
{
switch (value.type()) {
case QVariant::Time:
@@ -390,6 +428,12 @@ static void qOraOutValue(QVariant &value, QList<QByteArray> &storage)
case QVariant::DateTime:
value = qMakeDate(storage.takeFirst());
break;
+ case QVariant::LongLong:
+ value = qMakeLongLong(storage.takeFirst(), err);
+ break;
+ case QVariant::ULongLong:
+ value = qMakeULongLong(storage.takeFirst(), err);
+ break;
case QVariant::String:
value = QString(
reinterpret_cast<const QChar *>(storage.takeFirst().constData()));
@@ -407,7 +451,7 @@ void QOCIResultPrivate::outValues(QVector<QVariant> &values, IndicatorArray &ind
if (!isOutValue(i))
continue;
- qOraOutValue(values[i], tmpStorage);
+ qOraOutValue(values[i], tmpStorage, err);
QVariant::Type typ = values.at(i).type();
if (indicators[i] == -1) // NULL
@@ -667,6 +711,56 @@ QByteArray qMakeOraDate(const QDateTime& dt)
return ba;
}
+/*!
+ \internal
+
+ Convert qlonglong to the internal Oracle OCINumber format.
+ */
+QByteArray qMakeOCINumber(const qlonglong& ll, OCIError* err)
+{
+ QByteArray ba(sizeof(OCINumber), 0);
+
+ OCINumberFromInt(err,
+ &ll,
+ sizeof(qlonglong),
+ OCI_NUMBER_SIGNED,
+ reinterpret_cast<OCINumber*>(ba.data()));
+ return ba;
+}
+
+/*!
+ \internal
+
+ Convert qulonglong to the internal Oracle OCINumber format.
+ */
+QByteArray qMakeOCINumber(const qulonglong& ull, OCIError* err)
+{
+ QByteArray ba(sizeof(OCINumber), 0);
+
+ OCINumberFromInt(err,
+ &ull,
+ sizeof(qlonglong),
+ OCI_NUMBER_UNSIGNED,
+ reinterpret_cast<OCINumber*>(ba.data()));
+ return ba;
+}
+
+qlonglong qMakeLongLong(const char* ociNumber, OCIError* err)
+{
+ qlonglong qll = 0;
+ OCINumberToInt(err, reinterpret_cast<const OCINumber *>(ociNumber), sizeof(qlonglong),
+ OCI_NUMBER_SIGNED, &qll);
+ return qll;
+}
+
+qulonglong qMakeULongLong(const char* ociNumber, OCIError* err)
+{
+ qulonglong qull = 0;
+ OCINumberToInt(err, reinterpret_cast<const OCINumber *>(ociNumber), sizeof(qulonglong),
+ OCI_NUMBER_UNSIGNED, &qull);
+ return qull;
+}
+
QDateTime qMakeDate(const char* oraDate)
{
int century = uchar(oraDate[0]);
@@ -688,7 +782,6 @@ class QOCICols
public:
QOCICols(int size, QOCIResultPrivate* dp);
~QOCICols();
- void setCharset(OCIDefine* dfn);
int readPiecewise(QVector<QVariant> &values, int index = 0);
int readLOBs(QVector<QVariant> &values, int index = 0);
int fieldFromDefine(OCIDefine* d);
@@ -890,7 +983,7 @@ QOCICols::QOCICols(int size, QOCIResultPrivate* dp)
&(fieldInf[idx].ind),
0, 0, OCI_DEFAULT);
if (r == 0)
- setCharset(dfn);
+ d->setCharset(dfn, OCI_HTYPE_DEFINE);
}
break;
default:
@@ -950,35 +1043,6 @@ OCILobLocator **QOCICols::createLobLocator(int position, OCIEnv* env)
return &lob;
}
-void QOCICols::setCharset(OCIDefine* dfn)
-{
- int r = 0;
-
- Q_ASSERT(dfn);
-
- r = OCIAttrSet(dfn,
- OCI_HTYPE_DEFINE,
- // this const cast is safe since OCI doesn't touch
- // the charset.
- const_cast<void *>(static_cast<const void *>(&qOraCharsetForm)),
- 0,
- OCI_ATTR_CHARSET_FORM,
- d->err);
- if (r != 0)
- qOraWarning("QOCIResultPrivate::setCharset: Couldn't set OCI_ATTR_CHARSET_FORM: ", d->err);
-
- r = OCIAttrSet(dfn,
- OCI_HTYPE_DEFINE,
- // this const cast is safe since OCI doesn't touch
- // the charset.
- const_cast<void *>(static_cast<const void *>(&qOraCharset)),
- 0,
- OCI_ATTR_CHARSET_ID,
- d->err);
- if (r != 0)
- qOraWarning("QOCICols::setCharset: Couldn't set OCI_ATTR_CHARSET_ID: ", d->err);
-}
-
int QOCICols::readPiecewise(QVector<QVariant> &values, int index)
{
OCIDefine* dfn;
@@ -1281,6 +1345,16 @@ bool QOCICols::execBatch(QOCIResultPrivate *d, QVector<QVariant> &boundValues, b
col.maxLen = sizeof(uint);
break;
+ case QVariant::LongLong:
+ col.bindAs = SQLT_VNU;
+ col.maxLen = sizeof(OCINumber);
+ break;
+
+ case QVariant::ULongLong:
+ col.bindAs = SQLT_VNU;
+ col.maxLen = sizeof(OCINumber);
+ break;
+
case QVariant::Double:
col.bindAs = SQLT_FLT;
col.maxLen = sizeof(double);
@@ -1352,6 +1426,22 @@ bool QOCICols::execBatch(QOCIResultPrivate *d, QVector<QVariant> &boundValues, b
*reinterpret_cast<uint*>(dataPtr) = val.toUInt();
break;
+ case QVariant::LongLong:
+ {
+ columns[i].lengths[row] = columns[i].maxLen;
+ const QByteArray ba = qMakeOCINumber(val.toLongLong(), d->err);
+ Q_ASSERT(ba.size() == int(columns[i].maxLen));
+ memcpy(dataPtr, ba.constData(), columns[i].maxLen);
+ break;
+ }
+ case QVariant::ULongLong:
+ {
+ columns[i].lengths[row] = columns[i].maxLen;
+ const QByteArray ba = qMakeOCINumber(val.toULongLong(), d->err);
+ Q_ASSERT(ba.size() == int(columns[i].maxLen));
+ memcpy(dataPtr, ba.constData(), columns[i].maxLen);
+ break;
+ }
case QVariant::Double:
columns[i].lengths[row] = columns[i].maxLen;
*reinterpret_cast<double*>(dataPtr) = val.toDouble();
@@ -1459,7 +1549,7 @@ bool QOCICols::execBatch(QOCIResultPrivate *d, QVector<QVariant> &boundValues, b
QVariant::Type tp = boundValues.at(i).type();
if (tp != QVariant::List) {
- qOraOutValue(boundValues[i], tmpStorage);
+ qOraOutValue(boundValues[i], tmpStorage, d->err);
if (*columns[i].indicators == -1)
boundValues[i] = QVariant(tp);
continue;
@@ -1489,6 +1579,21 @@ bool QOCICols::execBatch(QOCIResultPrivate *d, QVector<QVariant> &boundValues, b
(*list)[r] = *reinterpret_cast<uint*>(data + r * columns[i].maxLen);
break;
+ case SQLT_VNU:
+ {
+ switch (boundValues.at(i).type()) {
+ case QVariant::LongLong:
+ (*list)[r] = qMakeLongLong(data + r * columns[i].maxLen, d->err);
+ break;
+ case QVariant::ULongLong:
+ (*list)[r] = qMakeULongLong(data + r * columns[i].maxLen, d->err);
+ break;
+ default:
+ break;
+ }
+ break;
+ }
+
case SQLT_FLT:
(*list)[r] = *reinterpret_cast<double*>(data + r * columns[i].maxLen);
break;
diff --git a/src/xmlpatterns/data/qabstractfloat.cpp b/src/xmlpatterns/data/qabstractfloat.cpp
index d3384fe..9f0e4e0 100644
--- a/src/xmlpatterns/data/qabstractfloat.cpp
+++ b/src/xmlpatterns/data/qabstractfloat.cpp
@@ -118,7 +118,7 @@ bool AbstractFloat<isDouble>::isEqual(const xsDouble a, const xsDouble b)
return qIsInf(a) && internalSignbit(a) == internalSignbit(b);
else
{
- /* Preferrably, we would use std::numeric_limits<xsDouble>::espilon(), but
+ /* Preferably, we would use std::numeric_limits<xsDouble>::espilon(), but
* we cannot since we cannot depend on the STL. The small xs:double value below,
* was extracted by printing the std::numeric_limits<xsDouble>::epsilon() using
* gdb. */
diff --git a/src/xmlpatterns/data/qatomicvalue.cpp b/src/xmlpatterns/data/qatomicvalue.cpp
index 5bb9a4f..700f7ea 100644
--- a/src/xmlpatterns/data/qatomicvalue.cpp
+++ b/src/xmlpatterns/data/qatomicvalue.cpp
@@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE
/**
* @file
- * @short Contains the implementation for AtomicValue. The defintion is in qitem_p.h.
+ * @short Contains the implementation for AtomicValue. The definition is in qitem_p.h.
*/
using namespace QPatternist;
diff --git a/src/xmlpatterns/data/qschematime_p.h b/src/xmlpatterns/data/qschematime_p.h
index bd63714..bff065b 100644
--- a/src/xmlpatterns/data/qschematime_p.h
+++ b/src/xmlpatterns/data/qschematime_p.h
@@ -63,7 +63,7 @@ namespace QPatternist
/**
* @short Implements the value instance of the @c xs:time type.
*
- * The header file for this class was orignally called Time.h, but this
+ * The header file for this class was originally called Time.h, but this
* clashed with a system header on MinGW.
*
* @author Frans Englich <frans.englich@nokia.com>
diff --git a/src/xmlpatterns/schema/qxsdschemaparser.cpp b/src/xmlpatterns/schema/qxsdschemaparser.cpp
index fd0b95c..585cf12 100644
--- a/src/xmlpatterns/schema/qxsdschemaparser.cpp
+++ b/src/xmlpatterns/schema/qxsdschemaparser.cpp
@@ -914,7 +914,7 @@ void XsdSchemaParser::parseRedefine()
redefinedType->setWxsSuperType(contextType);
// 3) remove the base type resolving job from the resolver as
- // we have set the base type here explicitely
+ // we have set the base type here explicitly
m_parserContext->resolver()->removeSimpleRestrictionBase(redefinedType);
// 4) add the redefined type to the schema
@@ -963,7 +963,7 @@ void XsdSchemaParser::parseRedefine()
redefinedType->setWxsSuperType(contextType);
// 3) remove the base type resolving job from the resolver as
- // we have set the base type here explicitely
+ // we have set the base type here explicitly
m_parserContext->resolver()->removeComplexBaseType(redefinedType);
// 4) add the redefined type to the schema
@@ -5781,7 +5781,7 @@ QString XsdSchemaParser::readNamespaceAttribute(const QString &attributeName, co
SchemaType::DerivationConstraints XsdSchemaParser::readDerivationConstraintAttribute(const SchemaType::DerivationConstraints &allowedConstraints, const char *elementName)
{
- // first convert the flags into strings for easier comparision
+ // first convert the flags into strings for easier comparison
QSet<QString> allowedContent;
if (allowedConstraints & SchemaType::RestrictionConstraint)
allowedContent.insert(QString::fromLatin1("restriction"));
@@ -5844,7 +5844,7 @@ SchemaType::DerivationConstraints XsdSchemaParser::readDerivationConstraintAttri
NamedSchemaComponent::BlockingConstraints XsdSchemaParser::readBlockingConstraintAttribute(const NamedSchemaComponent::BlockingConstraints &allowedConstraints, const char *elementName)
{
- // first convert the flags into strings for easier comparision
+ // first convert the flags into strings for easier comparison
QSet<QString> allowedContent;
if (allowedConstraints & NamedSchemaComponent::RestrictionConstraint)
allowedContent.insert(QString::fromLatin1("restriction"));
diff --git a/src/xmlpatterns/schema/qxsdschemaparser_setup.cpp b/src/xmlpatterns/schema/qxsdschemaparser_setup.cpp
index 88e5f93..dc4730e 100644
--- a/src/xmlpatterns/schema/qxsdschemaparser_setup.cpp
+++ b/src/xmlpatterns/schema/qxsdschemaparser_setup.cpp
@@ -53,7 +53,7 @@ using namespace QPatternist;
* This page describes how to use DFAs for validating that the XML child tags of an
* XML parent tag occur in the right order.
*
- * To validate the occurence of XML tags one need a regular expression that describes
+ * To validate the occurrence of XML tags one need a regular expression that describes
* which tags can appear how often in what context. For example the regular expression
* of the global <em>attribute</em> tag in XML Schema is (annotation?, simpleType?).
* That means the <em>attribute</em> tag can contain an <em>annotation</em> tag followed
diff --git a/src/xmlpatterns/schema/qxsdstatemachine_p.h b/src/xmlpatterns/schema/qxsdstatemachine_p.h
index 294eb50..62c6ab0 100644
--- a/src/xmlpatterns/schema/qxsdstatemachine_p.h
+++ b/src/xmlpatterns/schema/qxsdstatemachine_p.h
@@ -138,7 +138,7 @@ namespace QPatternist
/**
* Continues execution of the machine with the given input @p transition.
*
- * @return @c true if the transition was successfull, @c false otherwise.
+ * @return @c true if the transition was successful, @c false otherwise.
*/
bool proceed(TransitionType transition);
@@ -154,7 +154,7 @@ namespace QPatternist
* @note To use this method, inputEqualsTransition must be implemented
* to find the right transition to use.
*
- * @return @c true if the transition was successfull, @c false otherwise.
+ * @return @c true if the transition was successful, @c false otherwise.
*/
template <typename InputType>
bool proceed(InputType input);
diff --git a/src/xmlpatterns/type/qtypechecker.cpp b/src/xmlpatterns/type/qtypechecker.cpp
index 879fe0e..73f83b7 100644
--- a/src/xmlpatterns/type/qtypechecker.cpp
+++ b/src/xmlpatterns/type/qtypechecker.cpp
@@ -168,7 +168,7 @@ Expression::Ptr TypeChecker::verifyType(const Expression::Ptr &operand,
/* Since we haven't exited yet, it means that the operandType is a super type
* of reqType, and that there hence is a path down to it through the
- * type hierachy -- but that doesn't neccessarily mean that a up-cast(down the
+ * type hierachy -- but that doesn't necessarily mean that a up-cast(down the
* hierarchy) would succeed. */
Expression::Ptr result(operand);