summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Boddie <david.boddie@nokia.com>2010-11-17 12:56:03 (GMT)
committerDavid Boddie <david.boddie@nokia.com>2010-11-17 12:56:03 (GMT)
commita34730e837bc1430011028dba11bbf5a4672789d (patch)
treee3a255dc51cada6c680d9110b855f46ba99804bd /src
parentb5d26bfb348b6a99529ecf9ab66845e7eacd4732 (diff)
parent88c2e6f8f9f968c6bfe4ca0c0e3e54365a3e0c82 (diff)
downloadQt-a34730e837bc1430011028dba11bbf5a4672789d.zip
Qt-a34730e837bc1430011028dba11bbf5a4672789d.tar.gz
Qt-a34730e837bc1430011028dba11bbf5a4672789d.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-doc-team into 4.7
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-buffer.h8
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-gdef-private.h9
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-gdef.h8
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-global.h4
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-gpos-private.h8
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-gsub-private.h8
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-gsub.h9
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp2
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-open.h8
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-shaper.h8
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-stream.h8
-rw-r--r--src/corelib/corelib.pro7
-rw-r--r--src/corelib/global/qmalloc.cpp16
-rw-r--r--src/corelib/io/qiodevice.cpp5
-rw-r--r--src/corelib/kernel/qeventdispatcher_glib.cpp7
-rw-r--r--src/corelib/tools/qlocale.h2
-rw-r--r--src/corelib/tools/qsimd.cpp2
-rw-r--r--src/corelib/tools/qsimd_p.h3
-rw-r--r--src/corelib/tools/qstring.cpp2
-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.cpp23
-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.cpp123
-rw-r--r--src/declarative/graphicsitems/qdeclarativeloader.cpp57
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview.cpp46
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview_p_p.h4
-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/qdeclarativecompiledbindings.cpp2
-rw-r--r--src/declarative/qml/qdeclarativecomponent.cpp37
-rw-r--r--src/declarative/qml/qdeclarativecontext.cpp25
-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/qdeclarativeobjectscriptclass.cpp2
-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/qgraphicswidget.cpp2
-rw-r--r--src/gui/gui.pro3
-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/qgesturemanager.cpp14
-rw-r--r--src/gui/kernel/qgesturemanager_p.h1
-rw-r--r--src/gui/kernel/qmotifdnd_x11.cpp5
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp6
-rw-r--r--src/gui/painting/qpainter.cpp4
-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/qstatictext.cpp22
-rw-r--r--src/gui/text/qstatictext_p.h54
-rw-r--r--src/gui/widgets/qtextedit.cpp2
-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/qhttpnetworkheader.cpp12
-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/access/qnetworkrequest.cpp10
-rw-r--r--src/network/ssl/qsslsocket_openssl.cpp119
-rw-r--r--src/network/ssl/qsslsocket_openssl_p.h2
-rw-r--r--src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h2
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadermanager_p.h2
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadersource_p.h5
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp24
-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.cpp8
-rw-r--r--src/plugins/bearer/symbian/symbianengine.cpp41
-rw-r--r--src/plugins/bearer/symbian/symbianengine.h6
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp86
-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/QtDeclarativeu.def3
-rw-r--r--src/s60installs/eabi/QtGuiu.def3
-rw-r--r--src/s60installs/eabi/QtOpenVGu.def1
-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/testlib/qtestcase.cpp3
-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
143 files changed, 1503 insertions, 798 deletions
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-buffer.h b/src/3rdparty/harfbuzz/src/harfbuzz-buffer.h
index 0d7c2c2..0d631b2 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-buffer.h
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-buffer.h
@@ -32,10 +32,6 @@
HB_BEGIN_HEADER
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(push, 1)
-#endif
-
typedef struct HB_GlyphItemRec_ {
HB_UInt gindex;
HB_UInt properties;
@@ -93,10 +89,6 @@ hb_buffer_add_glyph( HB_Buffer buffer,
HB_UInt properties,
HB_UInt cluster );
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(pop)
-#endif
-
HB_END_HEADER
#endif /* HARFBUZZ_BUFFER_H */
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gdef-private.h b/src/3rdparty/harfbuzz/src/harfbuzz-gdef-private.h
index 2a6d958..94e9b43 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-gdef-private.h
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-gdef-private.h
@@ -33,11 +33,6 @@
HB_BEGIN_HEADER
-
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(push, 1)
-#endif
-
/* Attachment related structures */
struct HB_AttachPoint_
@@ -126,10 +121,6 @@ _HB_GDEF_LoadMarkAttachClassDef_From_LookupFlags( HB_GDEFHeader* gdef,
HB_Lookup* lo,
HB_UShort num_lookups );
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(pop)
-#endif
-
HB_END_HEADER
#endif /* HARFBUZZ_GDEF_PRIVATE_H */
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gdef.h b/src/3rdparty/harfbuzz/src/harfbuzz-gdef.h
index f9a03dd..ccb6bf9 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-gdef.h
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-gdef.h
@@ -31,10 +31,6 @@
HB_BEGIN_HEADER
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(push, 1)
-#endif
-
/* GDEF glyph properties. Note that HB_GDEF_COMPONENT has no corresponding
* flag in the LookupFlag field. */
#define HB_GDEF_BASE_GLYPH 0x0002
@@ -131,10 +127,6 @@ HB_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef,
HB_UShort* glyph_array,
HB_UShort* class_array );
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(pop)
-#endif
-
HB_END_HEADER
#endif /* HARFBUZZ_GDEF_H */
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-global.h b/src/3rdparty/harfbuzz/src/harfbuzz-global.h
index bccd6a2..d4e6b46 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-global.h
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-global.h
@@ -39,10 +39,6 @@
#define HB_END_HEADER /* nothing */
#endif
-#if defined(__GNUC__) || defined(_MSC_VER)
-#define HB_USE_PACKED_STRUCTS
-#endif
-
HB_BEGIN_HEADER
#ifndef FALSE
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gpos-private.h b/src/3rdparty/harfbuzz/src/harfbuzz-gpos-private.h
index 39f3159..63ba907 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-gpos-private.h
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-gpos-private.h
@@ -32,10 +32,6 @@
HB_BEGIN_HEADER
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(push, 1)
-#endif
-
/* shared tables */
#define VR_X_PLACEMENT_DEVICE 0
@@ -720,10 +716,6 @@ HB_INTERNAL void
_HB_GPOS_Free_SubTable( HB_GPOS_SubTable* st,
HB_UShort lookup_type );
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(pop)
-#endif
-
HB_END_HEADER
#endif /* HARFBUZZ_GPOS_PRIVATE_H */
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gsub-private.h b/src/3rdparty/harfbuzz/src/harfbuzz-gsub-private.h
index 7eb329e..df0c3f6 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-gsub-private.h
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-gsub-private.h
@@ -32,10 +32,6 @@
HB_BEGIN_HEADER
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(push, 1)
-#endif
-
typedef union HB_GSUB_SubTable_ HB_GSUB_SubTable;
/* LookupType 1 */
@@ -474,10 +470,6 @@ HB_INTERNAL void
_HB_GSUB_Free_SubTable( HB_GSUB_SubTable* st,
HB_UShort lookup_type );
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(pop)
-#endif
-
HB_END_HEADER
#endif /* HARFBUZZ_GSUB_PRIVATE_H */
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gsub.h b/src/3rdparty/harfbuzz/src/harfbuzz-gsub.h
index b00df44..6e452bd 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-gsub.h
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-gsub.h
@@ -31,11 +31,6 @@
HB_BEGIN_HEADER
-
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(push, 1)
-#endif
-
/* Lookup types for glyph substitution */
#define HB_GSUB_LOOKUP_SINGLE 1
@@ -139,10 +134,6 @@ HB_Error HB_GSUB_Register_Alternate_Function( HB_GSUBHeader* gsub,
HB_Error HB_GSUB_Apply_String( HB_GSUBHeader* gsub,
HB_Buffer buffer );
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(pop)
-#endif
-
HB_END_HEADER
#endif /* HARFBUZZ_GSUB_H */
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp
index 4d8418b..237c9ae 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/3rdparty/harfbuzz/src/harfbuzz-open.h b/src/3rdparty/harfbuzz/src/harfbuzz-open.h
index 4ba6cf5..9ad7c98 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-open.h
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-open.h
@@ -30,10 +30,6 @@
HB_BEGIN_HEADER
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(push, 1)
-#endif
-
/* Use this if a feature applies to all glyphs */
#define HB_ALL_GLYPHS 0xFFFF
@@ -279,10 +275,6 @@ enum HB_Type_
typedef enum HB_Type_ HB_Type;
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(pop)
-#endif
-
HB_END_HEADER
#endif /* HARFBUZZ_OPEN_H */
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h
index ab5c07a..470e27b 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h
@@ -34,10 +34,6 @@
HB_BEGIN_HEADER
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(push, 1)
-#endif
-
/*
using anything else than signed or unsigned for bitfields in C is non standard,
but accepted by almost all compilers. And it gives a significant reduction in
@@ -258,10 +254,6 @@ typedef struct HB_Font_ {
void *userData;
} HB_FontRec;
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(pop)
-#endif
-
typedef struct HB_ShaperItem_ HB_ShaperItem;
struct HB_ShaperItem_ {
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-stream.h b/src/3rdparty/harfbuzz/src/harfbuzz-stream.h
index a155cc2..cfbfb1c 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-stream.h
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-stream.h
@@ -30,10 +30,6 @@
HB_BEGIN_HEADER
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(push, 1)
-#endif
-
typedef struct HB_StreamRec_
{
HB_Byte* base;
@@ -42,10 +38,6 @@ typedef struct HB_StreamRec_
HB_UInt pos;
} HB_StreamRec;
-#ifdef HB_USE_PACKED_STRUCTS
-#pragma pack(pop)
-#endif
-
HB_END_HEADER
#endif
diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro
index b7d6034..a001940 100644
--- a/src/corelib/corelib.pro
+++ b/src/corelib/corelib.pro
@@ -37,10 +37,3 @@ symbian: {
MMP_RULES -= PAGED
MMP_RULES *= UNPAGED
}
-
-neon {
- DEFINES += QT_HAVE_NEON
- QMAKE_CXXFLAGS *= -mfpu=neon
-}
-
-
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/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index 26e587d..68fb2bf 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -395,7 +395,10 @@ QIODevice::QIODevice(QIODevicePrivate &dd, QObject *parent)
/*!
- Destructs the QIODevice object.
+ The destructor is virtual, and QIODevice is an abstract base
+ class. This destructor does not call close(), but the subclass
+ destructor might. If you are in doubt, call close() before
+ destroying the QIODevice.
*/
QIODevice::~QIODevice()
{
diff --git a/src/corelib/kernel/qeventdispatcher_glib.cpp b/src/corelib/kernel/qeventdispatcher_glib.cpp
index 8390275..6fa2707 100644
--- a/src/corelib/kernel/qeventdispatcher_glib.cpp
+++ b/src/corelib/kernel/qeventdispatcher_glib.cpp
@@ -311,6 +311,10 @@ QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(GMainContext *context)
}
}
+#if GLIB_CHECK_VERSION (2, 22, 0)
+ g_main_context_push_thread_default (mainContext);
+#endif
+
// setup post event source
postEventSource = reinterpret_cast<GPostEventSource *>(g_source_new(&postEventSourceFuncs,
sizeof(GPostEventSource)));
@@ -389,6 +393,9 @@ QEventDispatcherGlib::~QEventDispatcherGlib()
d->postEventSource = 0;
Q_ASSERT(d->mainContext != 0);
+#if GLIB_CHECK_VERSION (2, 22, 0)
+ g_main_context_pop_thread_default (d->mainContext);
+#endif
g_main_context_unref(d->mainContext);
d->mainContext = 0;
}
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/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp
index b2fe2da..63ebafb 100644
--- a/src/corelib/tools/qsimd.cpp
+++ b/src/corelib/tools/qsimd.cpp
@@ -135,7 +135,7 @@ static inline uint detectProcessorFeatures()
#if defined(QT_HAVE_IWMMXT)
// runtime detection only available when running as a previlegied process
features = IWMMXT;
-#elif defined(QT_HAVE_NEON)
+#elif defined(QT_ALWAYS_HAVE_NEON)
features = NEON;
#endif
diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h
index 664543b..87fa770 100644
--- a/src/corelib/tools/qsimd_p.h
+++ b/src/corelib/tools/qsimd_p.h
@@ -105,7 +105,8 @@ QT_BEGIN_HEADER
#endif // defined(QT_HAVE_SSE2) && (defined(__SSE2__) || defined(Q_CC_MSVC))
// NEON intrinsics
-#if defined(QT_HAVE_NEON)
+#if defined __ARM_NEON__
+#define QT_ALWAYS_HAVE_NEON
#include <arm_neon.h>
#endif
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index bfbdb73..d4a1248 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -3572,7 +3572,7 @@ static QByteArray toLatin1_helper(const QChar *data, int length)
}
length = length % 16;
}
-#elif QT_HAVE_NEON
+#elif QT_ALWAYS_HAVE_NEON
// Refer to the documentation of the SSE2 implementation
// this use eactly the same method as for SSE except:
// 1) neon has unsigned comparison
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 a88fc2b..3a3189c 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)
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..6be49ba 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -124,8 +124,8 @@ public:
}
qreal endPosition() const {
return (view->orientation() == QDeclarativeListView::Vertical
- ? item->y() + (item->height() > 0 ? item->height() : 1)
- : item->x() + (item->width() > 0 ? item->width() : 1)) - 1;
+ ? item->y() + (item->height() >= 1.0 ? item->height() : 1)
+ : item->x() + (item->width() >= 1.0 ? item->width() : 1)) - 1;
}
void setPosition(qreal pos) {
if (view->orientation() == QDeclarativeListView::Vertical) {
@@ -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 {
@@ -754,7 +736,7 @@ void QDeclarativeListViewPrivate::layout()
}
if (!visibleItems.isEmpty()) {
qreal oldEnd = visibleItems.last()->endPosition();
- qreal pos = visibleItems.first()->endPosition() + spacing + 1;
+ qreal pos = visibleItems.first()->position() + visibleItems.first()->size() + spacing;
for (int i=1; i < visibleItems.count(); ++i) {
FxListItem *item = visibleItems.at(i);
item->setPosition(pos);
@@ -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,33 +1157,39 @@ 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;
- if (snapMode != QDeclarativeListView::NoSnap) {
+ if (currentItem && haveHighlightRange && highlightRange == QDeclarativeListView::StrictlyEnforceRange) {
+ updateHighlight();
+ qreal pos = currentItem->itemPosition();
+ qreal viewPos = position();
+ if (viewPos < pos + currentItem->itemSize() - highlightRangeEnd)
+ viewPos = pos + currentItem->itemSize() - highlightRangeEnd;
+ if (viewPos > pos - highlightRangeStart)
+ viewPos = pos - highlightRangeStart;
+
+ timeline.reset(data.move);
+ if (viewPos != position()) {
+ if (fixupDuration)
+ timeline.move(data.move, -viewPos, QEasingCurve(QEasingCurve::InOutQuad), fixupDuration/2);
+ else
+ timeline.set(data.move, -viewPos);
+ }
+ vTime = timeline.time();
+ } else if (snapMode != QDeclarativeListView::NoSnap) {
FxListItem *topItem = snapItemAt(position()+highlightRangeStart);
FxListItem *bottomItem = snapItemAt(position()+highlightRangeEnd);
qreal pos;
- if (topItem && bottomItem && haveHighlightRange && highlightRange == QDeclarativeListView::StrictlyEnforceRange) {
- qreal topPos = qMin(topItem->position() - highlightRangeStart, -maxExtent);
- qreal bottomPos = qMax(bottomItem->position() - highlightRangeEnd, -minExtent);
- pos = qAbs(data.move + topPos) < qAbs(data.move + bottomPos) ? topPos : bottomPos;
- } else if (topItem) {
+ if (topItem) {
pos = qMax(qMin(topItem->position() - highlightRangeStart, -maxExtent), -minExtent);
} else if (bottomItem) {
- pos = qMax(qMin(bottomItem->position() - highlightRangeStart, -maxExtent), -minExtent);
+ pos = qMax(qMin(bottomItem->position() - highlightRangeStart, -maxExtent), -minExtent);
} else {
fixupDuration = oldDuration;
return;
}
- if (currentItem && haveHighlightRange && highlightRange == QDeclarativeListView::StrictlyEnforceRange) {
- updateHighlight();
- qreal currPos = currentItem->itemPosition();
- if (pos < currPos + currentItem->itemSize() - highlightRangeEnd)
- pos = currPos + currentItem->itemSize() - highlightRangeEnd;
- if (pos > currPos - highlightRangeStart)
- pos = currPos - highlightRangeStart;
- }
qreal dist = qAbs(data.move + pos);
if (dist > 0) {
@@ -1210,25 +1200,6 @@ void QDeclarativeListViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m
timeline.set(data.move, -pos);
vTime = timeline.time();
}
- } else if (haveHighlightRange && highlightRange == QDeclarativeListView::StrictlyEnforceRange) {
- if (currentItem) {
- updateHighlight();
- qreal pos = currentItem->itemPosition();
- qreal viewPos = position();
- if (viewPos < pos + currentItem->itemSize() - highlightRangeEnd)
- viewPos = pos + currentItem->itemSize() - highlightRangeEnd;
- if (viewPos > pos - highlightRangeStart)
- viewPos = pos - highlightRangeStart;
-
- timeline.reset(data.move);
- if (viewPos != position()) {
- if (fixupDuration)
- timeline.move(data.move, -viewPos, QEasingCurve(QEasingCurve::InOutQuad), fixupDuration/2);
- else
- timeline.set(data.move, -viewPos);
- }
- vTime = timeline.time();
- }
} else {
QDeclarativeFlickablePrivate::fixup(data, minExtent, maxExtent);
}
@@ -1350,12 +1321,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 +1339,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 +1670,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 +2297,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..1119b92 100644
--- a/src/declarative/graphicsitems/qdeclarativeloader.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp
@@ -129,15 +129,41 @@ void QDeclarativeLoaderPrivate::initResize()
The loaded item can be accessed using the \l item property.
- Loader is like any other visual item and must be positioned and sized
- accordingly to become visible. Once the component is loaded, the Loader
- is automatically resized to the size of the component.
-
If the \l source or \l sourceComponent changes, any previously instantiated
items are destroyed. Setting \l source to an empty string or setting
\l sourceComponent to \c undefined destroys the currently loaded item,
freeing resources and leaving the Loader empty.
+ \section2 Loader sizing behavior
+
+ Loader is like any other visual item and must be positioned and sized
+ accordingly to become visible.
+
+ \list
+ \o If an explicit size is not specified for the Loader, the Loader
+ is automatically resized to the size of the loaded item once the
+ component is loaded.
+ \o If the size of the Loader is specified explicitly by setting
+ the width, height or by anchoring, the loaded item will be resized
+ to the size of the Loader.
+ \endlist
+
+ In both scenarios the size of the item and the Loader are identical.
+ This ensures that anchoring to the Loader is equivalent to anchoring
+ to the loaded item.
+
+ \table
+ \row
+ \o sizeloader.qml
+ \o sizeitem.qml
+ \row
+ \o \snippet doc/src/snippets/declarative/loader/sizeloader.qml 0
+ \o \snippet doc/src/snippets/declarative/loader/sizeitem.qml 0
+ \row
+ \o The red rectangle will be sized to the size of the root item.
+ \o The red rectangle will be 50x50, centered in the root item.
+ \endtable
+
\section2 Receiving signals from loaded items
@@ -343,12 +369,14 @@ void QDeclarativeLoaderPrivate::_q_sourceLoaded()
QDeclarativeContext *ctxt = new QDeclarativeContext(creationContext);
ctxt->setContextObject(q);
- QDeclarativeComponent *c = component;
- QObject *obj = component->create(ctxt);
+ QDeclarativeGuard<QDeclarativeComponent> c = component;
+ QObject *obj = component->beginCreate(ctxt);
if (component != c) {
// component->create could trigger a change in source that causes
// component to be set to something else. In that case we just
// need to cleanup.
+ if (c)
+ c->completeCreate();
delete obj;
delete ctxt;
return;
@@ -373,6 +401,7 @@ void QDeclarativeLoaderPrivate::_q_sourceLoaded()
delete ctxt;
source = QUrl();
}
+ component->completeCreate();
emit q->sourceChanged();
emit q->statusChanged();
emit q->progressChanged();
@@ -395,23 +424,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/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp
index dc3d5ee..926bec2 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp
@@ -373,7 +373,21 @@ void QDeclarativePathViewPrivate::regenerate()
opacity of the items as they rotate. This additional code can be seen in the
PathAttribute documentation.)
- The \c focus can be set to \c true to enable keyboard navigation.
+ PathView does not automatically handle keyboard navigation. This is because
+ the keys to use for navigation will depend upon the shape of the path. Navigation
+ can be added quite simply by setting \c focus to \c true and calling
+ \l decrementCurrentIndex() or \l incrementCurrentIndex(), for example to navigate
+ using the left and right arrow keys:
+
+ \code
+ PathView {
+ ...
+ focus: true
+ Keys.onLeftPressed: decrementCurrentIndex()
+ Keys.onRightPressed: incrementCurrentIndex()
+ }
+ \endcode
+
The path view itself is a focus scope (see \l{qmlfocus#Acquiring Focus and Focus Scopes}{the focus documentation page} for more details).
Delegates are instantiated as needed and may be destroyed at any time.
@@ -607,6 +621,8 @@ void QDeclarativePathView::setCurrentIndex(int idx)
*/
void QDeclarativePathView::incrementCurrentIndex()
{
+ Q_D(QDeclarativePathView);
+ d->moveDirection = QDeclarativePathViewPrivate::Positive;
setCurrentIndex(currentIndex()+1);
}
@@ -625,6 +641,7 @@ void QDeclarativePathView::decrementCurrentIndex()
int idx = currentIndex()-1;
if (idx < 0)
idx = d->modelCount - 1;
+ d->moveDirection = QDeclarativePathViewPrivate::Negative;
setCurrentIndex(idx);
}
}
@@ -1636,7 +1653,7 @@ void QDeclarativePathViewPrivate::snapToCurrent()
if (!model || modelCount <= 0)
return;
- qreal targetOffset = modelCount - currentIndex;
+ qreal targetOffset = qmlMod(modelCount - currentIndex, modelCount);
moveReason = Other;
offsetAdj = 0.0;
@@ -1645,19 +1662,28 @@ void QDeclarativePathViewPrivate::snapToCurrent()
const int duration = highlightMoveDuration;
- if (targetOffset - offset > modelCount/2) {
+ if (moveDirection == Positive || (moveDirection == Shortest && targetOffset - offset > modelCount/2)) {
qreal distance = modelCount - targetOffset + offset;
- tl.move(moveOffset, 0.0, QEasingCurve(QEasingCurve::InQuad), int(duration * offset / distance));
- tl.set(moveOffset, modelCount);
- tl.move(moveOffset, targetOffset, QEasingCurve(QEasingCurve::OutQuad), int(duration * (modelCount-targetOffset) / distance));
- } else if (targetOffset - offset <= -modelCount/2) {
+ if (targetOffset > moveOffset) {
+ tl.move(moveOffset, 0.0, QEasingCurve(QEasingCurve::InQuad), int(duration * offset / distance));
+ tl.set(moveOffset, modelCount);
+ tl.move(moveOffset, targetOffset, QEasingCurve(offset == 0.0 ? QEasingCurve::InOutQuad : QEasingCurve::OutQuad), int(duration * (modelCount-targetOffset) / distance));
+ } else {
+ tl.move(moveOffset, targetOffset, QEasingCurve(QEasingCurve::InOutQuad), duration);
+ }
+ } else if (moveDirection == Negative || targetOffset - offset <= -modelCount/2) {
qreal distance = modelCount - offset + targetOffset;
- tl.move(moveOffset, modelCount, QEasingCurve(QEasingCurve::InQuad), int(duration * (modelCount-offset) / distance));
- tl.set(moveOffset, 0.0);
- tl.move(moveOffset, targetOffset, QEasingCurve(QEasingCurve::OutQuad), int(duration * targetOffset / distance));
+ if (targetOffset < moveOffset) {
+ tl.move(moveOffset, modelCount, QEasingCurve(targetOffset == 0 ? QEasingCurve::InOutQuad : QEasingCurve::InQuad), int(duration * (modelCount-offset) / distance));
+ tl.set(moveOffset, 0.0);
+ tl.move(moveOffset, targetOffset, QEasingCurve(QEasingCurve::OutQuad), int(duration * targetOffset / distance));
+ } else {
+ tl.move(moveOffset, targetOffset, QEasingCurve(QEasingCurve::InOutQuad), duration);
+ }
} else {
tl.move(moveOffset, targetOffset, QEasingCurve(QEasingCurve::InOutQuad), duration);
}
+ moveDirection = Shortest;
}
QDeclarativePathViewAttached *QDeclarativePathView::qmlAttachedProperties(QObject *obj)
diff --git a/src/declarative/graphicsitems/qdeclarativepathview_p_p.h b/src/declarative/graphicsitems/qdeclarativepathview_p_p.h
index b217216..6232b83 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepathview_p_p.h
@@ -82,7 +82,7 @@ public:
, dragMargin(0), deceleration(100)
, moveOffset(this, &QDeclarativePathViewPrivate::setAdjustedOffset)
, firstIndex(-1), pathItems(-1), requestedIndex(-1)
- , moveReason(Other), attType(0), highlightComponent(0), highlightItem(0)
+ , moveReason(Other), moveDirection(Shortest), attType(0), highlightComponent(0), highlightItem(0)
, moveHighlight(this, &QDeclarativePathViewPrivate::setHighlightPosition)
, highlightPosition(0)
, highlightRangeStart(0), highlightRangeEnd(0)
@@ -173,6 +173,8 @@ public:
QVariant modelVariant;
enum MovementReason { Other, SetIndex, Mouse };
MovementReason moveReason;
+ enum MovementDirection { Shortest, Negative, Positive };
+ MovementDirection moveDirection;
QDeclarativeOpenMetaObjectType *attType;
QDeclarativeComponent *highlightComponent;
QDeclarativeItem *highlightItem;
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/qdeclarativecompiledbindings.cpp b/src/declarative/qml/qdeclarativecompiledbindings.cpp
index 5f0fd56..fbe5829 100644
--- a/src/declarative/qml/qdeclarativecompiledbindings.cpp
+++ b/src/declarative/qml/qdeclarativecompiledbindings.cpp
@@ -601,7 +601,7 @@ struct QDeclarativeBindingCompilerPrivate
QDeclarativeImports imports;
QDeclarativeEnginePrivate *engine;
- QString contextName() const { return QLatin1String("$$$SCOPE_") + QString::number((intptr_t)context, 16); }
+ QString contextName() const { return QLatin1String("$$$SCOPE_") + QString::number((quintptr)context, 16); }
bool compile(QDeclarativeJS::AST::Node *);
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..3ee0e6f 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.
@@ -467,7 +474,7 @@ int QDeclarativeContextPrivate::context_count(QDeclarativeListProperty<QObject>
{
QDeclarativeContext *context = static_cast<QDeclarativeContext*>(prop->object);
QDeclarativeContextPrivate *d = QDeclarativeContextPrivate::get(context);
- int contextProperty = (int)(intptr_t)prop->data;
+ int contextProperty = (int)(quintptr)prop->data;
if (d->propertyValues.at(contextProperty).userType() != qMetaTypeId<QList<QObject*> >()) {
return 0;
@@ -480,7 +487,7 @@ QObject *QDeclarativeContextPrivate::context_at(QDeclarativeListProperty<QObject
{
QDeclarativeContext *context = static_cast<QDeclarativeContext*>(prop->object);
QDeclarativeContextPrivate *d = QDeclarativeContextPrivate::get(context);
- int contextProperty = (int)(intptr_t)prop->data;
+ int contextProperty = (int)(quintptr)prop->data;
if (d->propertyValues.at(contextProperty).userType() != qMetaTypeId<QList<QObject*> >()) {
return 0;
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index 6906f21..808ba68 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/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
index ea92111..eff59df 100644
--- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
@@ -421,7 +421,7 @@ QScriptValue QDeclarativeObjectScriptClass::tostring(QScriptContext *context, QS
ret += QString::fromUtf8(obj->metaObject()->className());
ret += QLatin1String("(0x");
- ret += QString::number((intptr_t)obj,16);
+ ret += QString::number((quintptr)obj,16);
if (!objectName.isEmpty()) {
ret += QLatin1String(", \"");
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 789116e..be7ea0e 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 af3b79a..9b41909 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 320395e..e0eb3bb 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/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/gui.pro b/src/gui/gui.pro
index 90b5de5..4d51fa8 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -64,13 +64,12 @@ symbian {
neon:*-g++* {
DEFINES += QT_HAVE_NEON
- QMAKE_CXXFLAGS *= -mfpu=neon
HEADERS += $$NEON_HEADERS
SOURCES += $$NEON_SOURCES
DRAWHELPER_NEON_ASM_FILES = $$NEON_ASM
- neon_compiler.commands = $$QMAKE_CXX -c
+ neon_compiler.commands = $$QMAKE_CXX -c -mfpu=neon
neon_compiler.commands += $(CXXFLAGS) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
neon_compiler.dependency_type = TYPE_C
neon_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)}
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 64d8ed2..c5d9a7e 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -1102,6 +1102,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 95e92c9..7b81761 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -1166,7 +1166,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.
*/
@@ -1192,7 +1192,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.
*/
@@ -1275,7 +1275,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 4492e53..dc45854 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()) {
@@ -1411,7 +1411,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/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp
index 6dd8127..9519447 100644
--- a/src/gui/kernel/qgesturemanager.cpp
+++ b/src/gui/kernel/qgesturemanager.cpp
@@ -171,9 +171,13 @@ 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);
+ m_gesturesToDelete.insert(g);
}
- qDeleteAll(gestures);
iter = m_objectGestures.erase(iter);
} else {
++iter;
@@ -381,6 +385,11 @@ bool QGestureManager::filterEventThroughContexts(const QMultiMap<QObject *,
recycle(gesture);
m_gestureTargets.remove(gesture);
}
+
+ //Clean up the Gestures
+ qDeleteAll(m_gesturesToDelete);
+ m_gesturesToDelete.clear();
+
return ret;
}
@@ -443,7 +452,8 @@ void QGestureManager::cancelGesturesForChildren(QGesture *original)
void QGestureManager::cleanupGesturesForRemovedRecognizer(QGesture *gesture)
{
QGestureRecognizer *recognizer = m_deletedRecognizers.value(gesture);
- Q_ASSERT(recognizer);
+ if(!recognizer) //The Gesture is removed while in the even loop, so the recognizers for this gestures was removed
+ return;
m_deletedRecognizers.remove(gesture);
if (m_deletedRecognizers.keys(recognizer).isEmpty()) {
// no more active gestures, cleanup!
diff --git a/src/gui/kernel/qgesturemanager_p.h b/src/gui/kernel/qgesturemanager_p.h
index 0d84b67..a5a3482 100644
--- a/src/gui/kernel/qgesturemanager_p.h
+++ b/src/gui/kernel/qgesturemanager_p.h
@@ -130,6 +130,7 @@ private:
QHash<QGestureRecognizer *, QSet<QGesture *> > m_obsoleteGestures;
QHash<QGesture *, QGestureRecognizer *> m_deletedRecognizers;
+ QSet<QGesture *> m_gesturesToDelete;
void cleanupGesturesForRemovedRecognizer(QGesture *gesture);
QGesture *getState(QObject *widget, QGestureRecognizer *recognizer,
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/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 3717ed9..89202ac 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -875,9 +875,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));
@@ -901,6 +902,7 @@ void QRasterPaintEngine::opacityChanged()
s->fillFlags |= DirtyOpacity;
s->strokeFlags |= DirtyOpacity;
s->pixmapFlags |= DirtyOpacity;
+ s->dirty |= DirtyOpacity;
s->intOpacity = (int) (s->opacity * 256);
}
@@ -3301,7 +3303,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 7fed7e4..ab9707d 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -5746,7 +5746,7 @@ void QPainterPrivate::drawGlyphs(const quint32 *glyphArray, const QPointF *posit
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.data();
@@ -5938,7 +5938,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/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index f3fb2f5..5fe9050 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/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/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp
index 4541730..6b3f444 100644
--- a/src/gui/widgets/qtextedit.cpp
+++ b/src/gui/widgets/qtextedit.cpp
@@ -773,7 +773,7 @@ Qt::Alignment QTextEdit::alignment() const
is the document's parent object. The parent object of the provided document
remains the owner of the object.
- If the current document is a child of the text editor, then it is deleted.
+ The editor does not delete the current document, even if it is a child of the editor.
\sa document()
*/
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 ae28a26..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 += /epoc32/include/mmf/common
- INCLUDEPATH += /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/qhttpnetworkheader.cpp b/src/network/access/qhttpnetworkheader.cpp
index 669f9cf..3eb2f3b 100644
--- a/src/network/access/qhttpnetworkheader.cpp
+++ b/src/network/access/qhttpnetworkheader.cpp
@@ -60,7 +60,17 @@ QHttpNetworkHeaderPrivate::QHttpNetworkHeaderPrivate(const QHttpNetworkHeaderPri
qint64 QHttpNetworkHeaderPrivate::contentLength() const
{
bool ok = false;
- QByteArray value = headerField("content-length");
+ // We are not using the headerField() method here because servers might send us multiple content-length
+ // headers which is crap (see QTBUG-15311). Therefore just take the first content-length header field.
+ QByteArray value;
+ QList<QPair<QByteArray, QByteArray> >::ConstIterator it = fields.constBegin(),
+ end = fields.constEnd();
+ for ( ; it != end; ++it)
+ if (qstricmp("content-length", it->first) == 0) {
+ value = it->second;
+ break;
+ }
+
qint64 length = value.toULongLong(&ok);
if (ok)
return length;
diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp
index 0a0987a..05eb6cb 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 4fe6de6..7faa5cb 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 4560153..65f19ca 100644
--- a/src/network/access/qnetworkaccessfilebackend.cpp
+++ b/src/network/access/qnetworkaccessfilebackend.cpp
@@ -203,12 +203,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 1a59011..d1a18d3 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 2a0daf8..80b05a4 100644
--- a/src/network/access/qnetworkaccesshttpbackend.cpp
+++ b/src/network/access/qnetworkaccesshttpbackend.cpp
@@ -674,26 +674,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 568b2ee..5de3429 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 e5f4d5a..effd79e 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -54,6 +54,7 @@
#include "qnetworkaccessfilebackend_p.h"
#include "qnetworkaccessdatabackend_p.h"
#include "qnetworkaccessdebugpipebackend_p.h"
+#include "qnetworkaccesscachebackend_p.h"
#include "qfilenetworkreply_p.h"
#include "QtCore/qbuffer.h"
@@ -970,6 +971,26 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
return new QFileNetworkReply(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/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp
index b761af5..162392d 100644
--- a/src/network/access/qnetworkrequest.cpp
+++ b/src/network/access/qnetworkrequest.cpp
@@ -899,10 +899,16 @@ void QNetworkHeadersPrivate::parseAndSetHeader(const QByteArray &key, const QByt
// is it a known header?
QNetworkRequest::KnownHeaders parsedKey = parseHeaderName(key);
if (parsedKey != QNetworkRequest::KnownHeaders(-1)) {
- if (value.isNull())
+ if (value.isNull()) {
cookedHeaders.remove(parsedKey);
- else
+ } else if (parsedKey == QNetworkRequest::ContentLengthHeader
+ && cookedHeaders.contains(QNetworkRequest::ContentLengthHeader)) {
+ // Only set the cooked header "Content-Length" once.
+ // See bug QTBUG-15311
+ } else {
cookedHeaders.insert(parsedKey, parseHeaderValue(parsedKey, value));
+ }
+
}
}
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp
index 2910538..70ef7ba 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>
@@ -80,9 +81,6 @@ QT_BEGIN_NAMESPACE
bool QSslSocketPrivate::s_libraryLoaded = false;
bool QSslSocketPrivate::s_loadedCiphersAndCerts = false;
-// Useful defines
-#define SSL_ERRORSTR() QString::fromLocal8Bit(q_ERR_error_string(q_ERR_get_error(), NULL))
-
/* \internal
From OpenSSL's thread(3) manual page:
@@ -272,7 +270,7 @@ init_context:
}
// ### Bad error code
- q->setErrorString(QSslSocket::tr("Error creating SSL context (%1)").arg(SSL_ERRORSTR()));
+ q->setErrorString(QSslSocket::tr("Error creating SSL context (%1)").arg(getErrorsFromOpenSsl()));
q->setSocketError(QAbstractSocket::UnknownSocketError);
emit q->error(QAbstractSocket::UnknownSocketError);
return false;
@@ -297,7 +295,7 @@ init_context:
if (!q_SSL_CTX_set_cipher_list(ctx, cipherString.data())) {
// ### Bad error code
- q->setErrorString(QSslSocket::tr("Invalid or empty cipher list (%1)").arg(SSL_ERRORSTR()));
+ q->setErrorString(QSslSocket::tr("Invalid or empty cipher list (%1)").arg(getErrorsFromOpenSsl()));
q->setSocketError(QAbstractSocket::UnknownSocketError);
emit q->error(QAbstractSocket::UnknownSocketError);
return false;
@@ -325,14 +323,14 @@ init_context:
if (!configuration.localCertificate.isNull()) {
// Require a private key as well.
if (configuration.privateKey.isNull()) {
- q->setErrorString(QSslSocket::tr("Cannot provide a certificate with no key, %1").arg(SSL_ERRORSTR()));
+ q->setErrorString(QSslSocket::tr("Cannot provide a certificate with no key, %1").arg(getErrorsFromOpenSsl()));
emit q->error(QAbstractSocket::UnknownSocketError);
return false;
}
// Load certificate
if (!q_SSL_CTX_use_certificate(ctx, (X509 *)configuration.localCertificate.handle())) {
- q->setErrorString(QSslSocket::tr("Error loading local certificate, %1").arg(SSL_ERRORSTR()));
+ q->setErrorString(QSslSocket::tr("Error loading local certificate, %1").arg(getErrorsFromOpenSsl()));
emit q->error(QAbstractSocket::UnknownSocketError);
return false;
}
@@ -347,14 +345,14 @@ init_context:
else
q_EVP_PKEY_set1_DSA(pkey, (DSA *)configuration.privateKey.handle());
if (!q_SSL_CTX_use_PrivateKey(ctx, pkey)) {
- q->setErrorString(QSslSocket::tr("Error loading private key, %1").arg(SSL_ERRORSTR()));
+ q->setErrorString(QSslSocket::tr("Error loading private key, %1").arg(getErrorsFromOpenSsl()));
emit q->error(QAbstractSocket::UnknownSocketError);
return false;
}
// Check if the certificate matches the private key.
if (!q_SSL_CTX_check_private_key(ctx)) {
- q->setErrorString(QSslSocket::tr("Private key does not certify public key, %1").arg(SSL_ERRORSTR()));
+ q->setErrorString(QSslSocket::tr("Private key does not certify public key, %1").arg(getErrorsFromOpenSsl()));
emit q->error(QAbstractSocket::UnknownSocketError);
return false;
}
@@ -374,7 +372,7 @@ init_context:
// Create and initialize SSL session
if (!(ssl = q_SSL_new(ctx))) {
// ### Bad error code
- q->setErrorString(QSslSocket::tr("Error creating SSL session, %1").arg(SSL_ERRORSTR()));
+ q->setErrorString(QSslSocket::tr("Error creating SSL session, %1").arg(getErrorsFromOpenSsl()));
q->setSocketError(QAbstractSocket::UnknownSocketError);
emit q->error(QAbstractSocket::UnknownSocketError);
return false;
@@ -389,7 +387,7 @@ init_context:
writeBio = q_BIO_new(q_BIO_s_mem());
if (!readBio || !writeBio) {
// ### Bad error code
- q->setErrorString(QSslSocket::tr("Error creating SSL session: %1").arg(SSL_ERRORSTR()));
+ q->setErrorString(QSslSocket::tr("Error creating SSL session: %1").arg(getErrorsFromOpenSsl()));
q->setSocketError(QAbstractSocket::UnknownSocketError);
emit q->error(QAbstractSocket::UnknownSocketError);
return false;
@@ -574,7 +572,7 @@ void QSslSocketPrivate::resetDefaultCiphers()
#if defined(Q_OS_SYMBIAN)
CSymbianCertificateRetriever::CSymbianCertificateRetriever() : CActive(CActive::EPriorityStandard),
- iSequenceError(KErrNone)
+ iCertificatePtr(0,0,0), iSequenceError(KErrNone)
{
}
@@ -618,6 +616,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 +640,7 @@ void CSymbianCertificateRetriever::doThreadEntryL()
TInt CSymbianCertificateRetriever::ThreadEntryPoint(TAny* aParams)
{
+ User::SetCritical(User::EProcessCritical);
CTrapCleanup* cleanupStack = CTrapCleanup::New();
CSymbianCertificateRetriever* self = (CSymbianCertificateRetriever*) aParams;
@@ -658,7 +662,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 +685,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 +738,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;
@@ -800,6 +832,7 @@ QList<QSslCertificate> QSslSocketPrivate::systemCaCertificates()
systemCerts.append(QSslCertificate::fromPath(it.next()));
}
systemCerts.append(QSslCertificate::fromPath(QLatin1String("/etc/pki/tls/certs/ca-bundle.crt"), QSsl::Pem)); // Fedora, Mandriva
+ systemCerts.append(QSslCertificate::fromPath(QLatin1String("/usr/local/share/certs/ca-root-nss.crt"), QSsl::Pem)); // FreeBSD's ca_root_nss
#elif defined(Q_OS_SYMBIAN)
QList<QByteArray> certs;
@@ -808,10 +841,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;
}
@@ -868,7 +909,7 @@ void QSslSocketBackendPrivate::transmit()
int writtenBytes = q_SSL_write(ssl, writeBuffer.readPointer(), nextDataBlockSize);
if (writtenBytes <= 0) {
// ### Better error handling.
- q->setErrorString(QSslSocket::tr("Unable to write data: %1").arg(SSL_ERRORSTR()));
+ q->setErrorString(QSslSocket::tr("Unable to write data: %1").arg(getErrorsFromOpenSsl()));
q->setSocketError(QAbstractSocket::UnknownSocketError);
emit q->error(QAbstractSocket::UnknownSocketError);
return;
@@ -931,7 +972,7 @@ void QSslSocketBackendPrivate::transmit()
plainSocket->read(data.data(), writtenToBio);
} else {
// ### Better error handling.
- q->setErrorString(QSslSocket::tr("Unable to decrypt data: %1").arg(SSL_ERRORSTR()));
+ q->setErrorString(QSslSocket::tr("Unable to decrypt data: %1").arg(getErrorsFromOpenSsl()));
q->setSocketError(QAbstractSocket::UnknownSocketError);
emit q->error(QAbstractSocket::UnknownSocketError);
return;
@@ -1009,7 +1050,7 @@ void QSslSocketBackendPrivate::transmit()
case SSL_ERROR_SSL: // error in the SSL library
// we do not know exactly what the error is, nor whether we can recover from it,
// so just return to prevent an endless loop in the outer "while" statement
- q->setErrorString(QSslSocket::tr("Error while reading: %1").arg(SSL_ERRORSTR()));
+ q->setErrorString(QSslSocket::tr("Error while reading: %1").arg(getErrorsFromOpenSsl()));
q->setSocketError(QAbstractSocket::UnknownSocketError);
emit q->error(QAbstractSocket::UnknownSocketError);
return;
@@ -1019,7 +1060,7 @@ void QSslSocketBackendPrivate::transmit()
// SSL_ERROR_WANT_X509_LOOKUP: can only happen with a
// SSL_CTX_set_client_cert_cb(), which we do not call.
// So this default case should never be triggered.
- q->setErrorString(QSslSocket::tr("Error while reading: %1").arg(SSL_ERRORSTR()));
+ q->setErrorString(QSslSocket::tr("Error while reading: %1").arg(getErrorsFromOpenSsl()));
q->setSocketError(QAbstractSocket::UnknownSocketError);
emit q->error(QAbstractSocket::UnknownSocketError);
break;
@@ -1114,8 +1155,7 @@ bool QSslSocketBackendPrivate::startHandshake()
// The handshake is not yet complete.
break;
default:
- // ### Handle errors better
- q->setErrorString(QSslSocket::tr("Error during SSL handshake: %1").arg(SSL_ERRORSTR()));
+ q->setErrorString(QSslSocket::tr("Error during SSL handshake: %1").arg(getErrorsFromOpenSsl()));
q->setSocketError(QAbstractSocket::SslHandshakeFailedError);
#ifdef QSSLSOCKET_DEBUG
qDebug() << "QSslSocketBackendPrivate::startHandshake: error!" << q->errorString();
@@ -1291,6 +1331,19 @@ QList<QSslCertificate> QSslSocketBackendPrivate::STACKOFX509_to_QSslCertificates
return certificates;
}
+QString QSslSocketBackendPrivate::getErrorsFromOpenSsl()
+{
+ QString errorString;
+ unsigned long errNum;
+ while((errNum = q_ERR_get_error())) {
+ if (! errorString.isEmpty())
+ errorString.append(QLatin1String(", "));
+ const char *error = q_ERR_error_string(errNum, NULL);
+ errorString.append(QString::fromAscii(error)); // error is ascii according to man ERR_error_string
+ }
+ return errorString;
+}
+
bool QSslSocketBackendPrivate::isMatchingHostname(const QString &cn, const QString &hostname)
{
int wildcard = cn.indexOf(QLatin1Char('*'));
diff --git a/src/network/ssl/qsslsocket_openssl_p.h b/src/network/ssl/qsslsocket_openssl_p.h
index dec98ae..878c654 100644
--- a/src/network/ssl/qsslsocket_openssl_p.h
+++ b/src/network/ssl/qsslsocket_openssl_p.h
@@ -117,6 +117,7 @@ public:
static QSslCipher QSslCipher_from_SSL_CIPHER(SSL_CIPHER *cipher);
static QList<QSslCertificate> STACKOFX509_to_QSslCertificates(STACK_OF(X509) *x509);
Q_AUTOTEST_EXPORT static bool isMatchingHostname(const QString &cn, const QString &hostname);
+ static QString getErrorsFromOpenSsl();
};
#if defined(Q_OS_SYMBIAN)
@@ -165,6 +166,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 92cf108..536b44a 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/qglengineshadersource_p.h b/src/opengl/gl2paintengineex/qglengineshadersource_p.h
index a7ece0f..0d30f9a 100644
--- a/src/opengl/gl2paintengineex/qglengineshadersource_p.h
+++ b/src/opengl/gl2paintengineex/qglengineshadersource_p.h
@@ -340,12 +340,7 @@ static const char* const qglslImageSrcFragmentShader = "\n\
uniform lowp sampler2D imageTexture; \n\
lowp vec4 srcPixel() \n\
{ \n"
-#ifdef QT_OPENGL_ES_2
- // work-around for driver bug
- "return 1.0 * texture2D(imageTexture, textureCoords); \n"
-#else
"return texture2D(imageTexture, textureCoords); \n"
-#endif
"}\n";
static const char* const qglslCustomSrcFragmentShader = "\n\
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 84c7fed..1dcb773 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1350,8 +1350,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
@@ -1430,7 +1430,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();
@@ -1475,18 +1475,18 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
QOpenGL2PaintEngineState *s = q->state();
QGLTextureGlyphCache *cache =
- (QGLTextureGlyphCache *) staticTextItem->fontEngine->glyphCache(ctx, glyphType, QTransform());
+ (QGLTextureGlyphCache *) staticTextItem->fontEngine()->glyphCache(ctx, glyphType, QTransform());
if (!cache || cache->cacheType() != glyphType) {
cache = new QGLTextureGlyphCache(ctx, glyphType, QTransform());
- staticTextItem->fontEngine->setGlyphCache(ctx, cache);
+ staticTextItem->fontEngine()->setGlyphCache(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.
@@ -1494,8 +1494,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);
}
if (cache->width() == 0 || cache->height() == 0)
@@ -1515,14 +1515,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
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index dbd295f..ed9753e 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -127,7 +127,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;
}
@@ -1637,12 +1642,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 f85cad5..9ae619d 100644
--- a/src/opengl/qgl.h
+++ b/src/opengl/qgl.h
@@ -428,6 +428,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 f86c77f..4742bdb 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -317,6 +317,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:
@@ -326,7 +327,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);
@@ -417,6 +418,7 @@ public:
GLuint current_fbo;
GLuint default_fbo;
QPaintEngine *active_engine;
+ QGLTextureDestroyer *texture_destroyer;
bool vertexAttributeArraysEnabledState[QT_GL_VERTEX_ARRAY_TRACKED_COUNT];
@@ -434,20 +436,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
@@ -490,6 +478,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,
@@ -506,16 +544,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 9d28de0..d33ea56 100644
--- a/src/opengl/qgl_x11egl.cpp
+++ b/src/opengl/qgl_x11egl.cpp
@@ -377,7 +377,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 922a501..9cb3955 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 844e38b..9946b17 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 &id)
{
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 &id)
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 == id) {
ok = true;
}
@@ -900,6 +914,7 @@ quint64 QCoreWlanEngine::startTime(const QString &id)
}
}
}
+ [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..53a5b4d 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
@@ -1151,10 +1151,10 @@ void QNetworkSessionPrivateImpl::RunL()
serviceConfig = QNetworkConfiguration();
iError = QNetworkSession::InvalidConfigurationError;
QT_TRYCATCH_LEAVING(emit QNetworkSessionPrivate::error(iError));
- Cancel();
if (ipConnectionNotifier) {
ipConnectionNotifier->StopNotifications();
}
+ Cancel();
QT_TRYCATCH_LEAVING(syncStateWithInterface());
break;
case KErrCancel: // Connection attempt cancelled
@@ -1173,10 +1173,10 @@ void QNetworkSessionPrivateImpl::RunL()
iError = QNetworkSession::UnknownSessionError;
}
QT_TRYCATCH_LEAVING(emit QNetworkSessionPrivate::error(iError));
- Cancel();
if (ipConnectionNotifier) {
ipConnectionNotifier->StopNotifications();
}
+ Cancel();
QT_TRYCATCH_LEAVING(syncStateWithInterface());
break;
}
@@ -1268,10 +1268,10 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint
serviceConfig = QNetworkConfiguration();
iError = QNetworkSession::SessionAbortedError;
emit QNetworkSessionPrivate::error(iError);
- Cancel();
if (ipConnectionNotifier) {
ipConnectionNotifier->StopNotifications();
}
+ Cancel();
// Start handling IAP state change signals from QNetworkConfigurationManagerPrivate
iHandleStateNotificationsFromManager = true;
emitSessionClosed = true; // Emit SessionClosed after state change has been reported
diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp
index b4dfc4d..33fa508 100644
--- a/src/plugins/bearer/symbian/symbianengine.cpp
+++ b/src/plugins/bearer/symbian/symbianengine.cpp
@@ -135,10 +135,9 @@ void SymbianEngine::initialize()
updateConfigurations();
updateStatesToSnaps();
- updateAvailableAccessPoints(); // On first time updates synchronously (without WLAN scans)
+ updateAvailableAccessPoints(); // On first time updates (without WLAN scans)
// Start monitoring IAP and/or SNAP changes in Symbian CommsDB
startCommsDatabaseNotifications();
- iFirstUpdate = false;
}
SymbianEngine::~SymbianEngine()
@@ -790,6 +789,12 @@ void SymbianEngine::accessPointScanningReady(TBool scanSuccessful, TConnMonIapIn
mutex.unlock();
emit updateCompleted();
mutex.lock();
+ } else {
+ iFirstUpdate = false;
+ if (iScanInQueue) {
+ iScanInQueue = EFalse;
+ updateAvailableAccessPoints();
+ }
}
}
@@ -976,7 +981,7 @@ void SymbianEngine::RunL()
QMutexLocker locker(&mutex);
if (iStatus != KErrCancel) {
- // By default, start relistening notifications. Stop only if interesting event occurred.
+ // By default, start relistening notifications. Stop only if interesting event occured.
iWaitingCommsDatabaseNotifications = true;
RDbNotifier::TEvent event = STATIC_CAST(RDbNotifier::TEvent, iStatus.Int());
switch (event) {
@@ -1356,27 +1361,39 @@ AccessPointsAvailabilityScanner::~AccessPointsAvailabilityScanner()
void AccessPointsAvailabilityScanner::DoCancel()
{
iConnectionMonitor.CancelAsyncRequest(EConnMonGetPckgAttribute);
+ iScanActive = EFalse;
+ iOwner.iScanInQueue = EFalse;
}
void AccessPointsAvailabilityScanner::StartScanning()
{
- if (iOwner.iFirstUpdate) {
- // On first update (the mgr is being instantiated) update only those bearers who
- // don't need time-consuming scans (WLAN).
- // Note: EBearerIdWCDMA covers also GPRS bearer
- iConnectionMonitor.GetPckgAttribute(EBearerIdWCDMA, 0, KIapAvailability, iIapBuf, iStatus);
+ if (!iScanActive) {
+ iScanActive = ETrue;
+ if (iOwner.iFirstUpdate) {
+ // On first update (the mgr is being instantiated) update only those bearers who
+ // don't need time-consuming scans (WLAN).
+ // Note: EBearerIdWCDMA covers also GPRS bearer
+ iConnectionMonitor.GetPckgAttribute(EBearerIdWCDMA, 0, KIapAvailability, iIapBuf, iStatus);
+ } else {
+ iConnectionMonitor.GetPckgAttribute(EBearerIdAll, 0, KIapAvailability, iIapBuf, iStatus);
+ }
+
+ if (!IsActive()) {
+ SetActive();
+ }
} else {
- iConnectionMonitor.GetPckgAttribute(EBearerIdAll, 0, KIapAvailability, iIapBuf, iStatus);
+ // Queue scan for getting WLAN info after first request returns
+ if (iOwner.iFirstUpdate) {
+ iOwner.iScanInQueue = ETrue;
+ }
}
-
- if (!IsActive())
- SetActive();
}
void AccessPointsAvailabilityScanner::RunL()
{
QMutexLocker locker(&iOwner.mutex);
+ iScanActive = EFalse;
if (iStatus.Int() != KErrNone) {
iIapBuf().iCount = 0;
QT_TRYCATCH_LEAVING(iOwner.accessPointScanningReady(false,iIapBuf()));
diff --git a/src/plugins/bearer/symbian/symbianengine.h b/src/plugins/bearer/symbian/symbianengine.h
index 7c1076e..337d4d1 100644
--- a/src/plugins/bearer/symbian/symbianengine.h
+++ b/src/plugins/bearer/symbian/symbianengine.h
@@ -207,6 +207,7 @@ private: // Data
TBool iInitOk;
TBool iUpdateGoingOn;
TBool iUpdatePending;
+ TBool iScanInQueue;
AccessPointsAvailabilityScanner* ipAccessPointsAvailabilityScanner;
@@ -234,9 +235,10 @@ protected: // From CActive
void DoCancel();
private: // Data
- SymbianEngine& iOwner;
+ SymbianEngine& iOwner;
RConnectionMonitor& iConnectionMonitor;
- TConnMonIapInfoBuf iIapBuf;
+ TConnMonIapInfoBuf iIapBuf;
+ TBool iScanActive;
};
QT_END_NAMESPACE
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
index 4869eba..ceed7ae 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;
@@ -67,6 +68,15 @@ public:
Matrix_BlitsUnsupported = (Matrix_NegativeScale|Matrix_RectsUnsupported)
};
+ inline static uint getTransformationType(const QTransform &transform)
+ {
+ int ret = transform.type();
+ if (qMin(transform.m11(), transform.m22()) < 0) {
+ ret |= QDirectFBPaintEnginePrivate::Matrix_NegativeScale;
+ }
+ return ret;
+ }
+
enum CompositionModeStatus {
PorterDuff_None = 0x0,
PorterDuff_Supported = 0x1,
@@ -98,7 +108,7 @@ public:
inline bool isSimpleBrush(const QBrush &brush) const;
- void drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap, const QPointF &pos);
+ void drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap, const QPointF &pos, const QTransform &pixmapTransform);
void blit(const QRectF &dest, IDirectFBSurface *surface, const QRectF &src);
inline bool supportsStretchBlit() const;
@@ -112,7 +122,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 +630,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 +674,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));
}
}
@@ -691,7 +716,8 @@ void QDirectFBPaintEngine::drawTiledPixmap(const QRectF &r,
const QPixmap pix(data);
QRasterPaintEngine::drawTiledPixmap(r, pix, offset);
} else {
- CLIPPED_PAINT(d->drawTiledPixmap(r, pixmap, offset));
+ QTransform transform(state()->matrix);
+ CLIPPED_PAINT(d->drawTiledPixmap(r, pixmap, offset, transform));
}
}
@@ -811,9 +837,14 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
return; }
case Qt::TexturePattern: {
+ const QPointF &brushOrigin = state()->brushOrigin;
+ const QTransform stateTransform = state()->matrix;
+ QTransform transform(stateTransform);
+ transform.translate(brushOrigin.x(), brushOrigin.y());
+ transform = brush.transform() * transform;
if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)
- || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
- || (!d->supportsStretchBlit() && state()->matrix.isScaling())) {
+ || (QDirectFBPaintEnginePrivate::getTransformationType(transform) & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
+ || (!d->supportsStretchBlit() && transform.isScaling())) {
break;
}
@@ -821,7 +852,7 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
if (texture.pixmapData()->classId() != QPixmapData::DirectFBClass)
break;
- CLIPPED_PAINT(d->drawTiledPixmap(rect, texture, rect.topLeft() - state()->brushOrigin));
+ CLIPPED_PAINT(d->drawTiledPixmap(stateTransform.mapRect(rect), texture, rect.topLeft() - brushOrigin, transform));
return; }
default:
break;
@@ -932,10 +963,7 @@ void QDirectFBPaintEnginePrivate::unlock(QDirectFBPaintDevice *device)
void QDirectFBPaintEnginePrivate::setTransform(const QTransform &transform)
{
- transformationType = transform.type();
- if (qMin(transform.m11(), transform.m22()) < 0) {
- transformationType |= QDirectFBPaintEnginePrivate::Matrix_NegativeScale;
- }
+ transformationType = getTransformationType(transform);
setPen(q->state()->pen);
}
@@ -978,7 +1006,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 +1059,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);
}
@@ -1132,10 +1165,12 @@ static inline qreal fixCoord(qreal rect_pos, qreal pixmapSize, qreal offset)
return pos;
}
-void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap, const QPointF &off)
+void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap,
+ const QPointF &off, const QTransform &pixmapTransform)
{
- Q_ASSERT(!(transformationType & Matrix_BlitsUnsupported));
const QTransform &transform = q->state()->matrix;
+ Q_ASSERT(!(getTransformationType(transform) & Matrix_BlitsUnsupported) &&
+ !(getTransformationType(pixmapTransform) & Matrix_BlitsUnsupported));
const QRect destinationRect = transform.mapRect(dest).toRect().normalized();
QRect newClip = destinationRect;
if (!currentClip.isEmpty())
@@ -1152,22 +1187,27 @@ void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPix
};
surface->SetClip(surface, &clip);
- QPointF offset = off;
+ QPointF offset = pixmapTransform.inverted().map(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()) {
+ if (transform.isScaling() || pixmapTransform.isScaling()) {
Q_ASSERT(supportsStretchBlit());
Q_ASSERT(qMin(transform.m11(), transform.m22()) >= 0);
offset.rx() *= transform.m11();
offset.ry() *= transform.m22();
- const QSizeF mappedSize(pixmapSize.width() * transform.m11(), pixmapSize.height() * transform.m22());
+ const QSizeF mappedSize(pixmapSize.width() * pixmapTransform.m11(), pixmapSize.height() * pixmapTransform.m22());
qreal y = fixCoord(destinationRect.y(), mappedSize.height(), offset.y());
const qreal startX = fixCoord(destinationRect.x(), mappedSize.width(), offset.x());
while (y <= destinationRect.bottom()) {
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 ac11188..691fc80 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 = /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 d82d0f0..e24eeb5 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/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/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp
index f494106..e40458b 100644
--- a/src/script/api/qscriptvalue.cpp
+++ b/src/script/api/qscriptvalue.cpp
@@ -2036,6 +2036,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 dd229f1..228e755 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 e11cf75..1bf59bf 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/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 17f1a6b..e3a8726 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -755,6 +755,9 @@ QT_BEGIN_NAMESPACE
QTest::touchEvent to create a QTouchEventSequence instance. Add touch events to
the sequence by calling press(), move(), release() and stationary(), and let the
instance run out of scope to commit the sequence to the event system.
+
+ Example:
+ \snippet doc/src/snippets/code/src_qtestlib_qtestcase.cpp 25
*/
/*!
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 c4f3578..ecc78bf 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);