diff options
author | Bea Lam <bea.lam@nokia.com> | 2010-03-05 03:51:10 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2010-03-05 03:51:10 (GMT) |
commit | 48fd47f64f3f73e82016161d82cdf67908a9c653 (patch) | |
tree | e337d89e525d3a55d2b9aca8c19d2b3b43c65c50 /src | |
parent | a7b46bda37a428ae2e5554aa8e58469c92b310a9 (diff) | |
parent | c9b3309ae1d3a34790d71fdfd7dcaab79433f049 (diff) | |
download | Qt-48fd47f64f3f73e82016161d82cdf67908a9c653.zip Qt-48fd47f64f3f73e82016161d82cdf67908a9c653.tar.gz Qt-48fd47f64f3f73e82016161d82cdf67908a9c653.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Conflicts:
tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
Diffstat (limited to 'src')
120 files changed, 1194 insertions, 1874 deletions
diff --git a/src/3rdparty/README b/src/3rdparty/README index ef05674..0248db1 100644 --- a/src/3rdparty/README +++ b/src/3rdparty/README @@ -1,26 +1,22 @@ The libraries included here are the original packages, unpacked, and with their version number removed from the directory name (for version -information, see the README files in the directories). The following -have been removed: - - libjpeg - some source files, images, Makefiles, manual pages - libpng/contrib - a collection of examples and test-suite - libmng/bcb - a collection of files for the Borland compiler - libmng/contrib - a collection of projects that use libmng - libmng/special - configuration file for Mozilla integration - libtiff/contrib - a collection of additions to libtiff - libtiff/man - manual pages - libtiff/tools - a collection of command-line tools based on libtiff - zlib/contrib - a collection of non-zlib code - zlib/amiga - zlib for a platform not supported by Qt - zlib/as400 - zlib for a platform not supported by Qt - zlib/msdos - zlib for a platform not supported by Qt - zlib/old - zlib for a platform not supported by Qt - zlib/qnx - zlib packaging +information, see the README files in the directories). -Some patches are applied from time to time. Recent patches can be -found in the patches subdirectory. +Certain files and subdirectories of the original library packages that +are irrelevant to Qt may not be included here. Typically, those are +the standalone library configuration and make files, tools, test +files, contribs, documentation, and similar. +Patches may have been applied, typically for configuration and build +issues in the Qt framework. Such patches can be reviewed in the the +public git repository; they will appear in the commit logs of each +library directory, following the latest clean version update commit. + +The 'patches' subdirectory contains certain patches applied prior to +the start of the public git history, where the library has not been +updated since. + +-- The pvr2d.h & wsegl.h in the powervr directory are required for building the PowerVR plugin on Qt for Embedded Linux. These headers are for SGX diff --git a/src/3rdparty/patches/freetype-2.3.5-config.patch b/src/3rdparty/patches/freetype-2.3.5-config.patch deleted file mode 100644 index 2653467..0000000 --- a/src/3rdparty/patches/freetype-2.3.5-config.patch +++ /dev/null @@ -1,265 +0,0 @@ ---- builds/unix/ftconfig.h 1970-01-01 01:00:00.000000000 +0100 -+++ builds/unix/ftconfig.h 2007-07-15 00:00:00.000000000 +0200 -@@ -0,0 +1,262 @@ -+/* ftconfig.h. Generated by configure. */ -+/***************************************************************************/ -+/* */ -+/* ftconfig.in */ -+/* */ -+/* UNIX-specific configuration file (specification only). */ -+/* */ -+/* Copyright 1996-2000, 2002 by */ -+/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -+/* */ -+/* This file is part of the FreeType project, and may only be used, */ -+/* modified, and distributed under the terms of the FreeType project */ -+/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -+/* this file you indicate that you have read the license and */ -+/* understand and accept it fully. */ -+/* */ -+/***************************************************************************/ -+ -+ -+ /*************************************************************************/ -+ /* */ -+ /* This header file contains a number of macro definitions that are used */ -+ /* by the rest of the engine. Most of the macros here are automatically */ -+ /* determined at compile time, and you should not need to change it to */ -+ /* port FreeType, except to compile the library with a non-ANSI */ -+ /* compiler. */ -+ /* */ -+ /* Note however that if some specific modifications are needed, we */ -+ /* advise you to place a modified copy in your build directory. */ -+ /* */ -+ /* The build directory is usually `freetype/builds/<system>', and */ -+ /* contains system-specific files that are always included first when */ -+ /* building the library. */ -+ /* */ -+ /*************************************************************************/ -+ -+ -+#ifndef __FTCONFIG_H__ -+#define __FTCONFIG_H__ -+ -+#include <ft2build.h> -+#include FT_CONFIG_OPTIONS_H -+#include FT_CONFIG_STANDARD_LIBRARY_H -+ -+ -+FT_BEGIN_HEADER -+ -+ -+ /*************************************************************************/ -+ /* */ -+ /* PLATFORM-SPECIFIC CONFIGURATION MACROS */ -+ /* */ -+ /* These macros can be toggled to suit a specific system. The current */ -+ /* ones are defaults used to compile FreeType in an ANSI C environment */ -+ /* (16bit compilers are also supported). Copy this file to your own */ -+ /* `freetype/builds/<system>' directory, and edit it to port the engine. */ -+ /* */ -+ /*************************************************************************/ -+ -+ -+#define HAVE_UNISTD_H 1 -+#define HAVE_FCNTL_H 1 -+ -+#define SIZEOF_INT 4 -+#define SIZEOF_LONG 4 -+ -+#define FT_SIZEOF_INT SIZEOF_INT -+#define FT_SIZEOF_LONG SIZEOF_LONG -+ -+ -+ /* Preferred alignment of data */ -+#define FT_ALIGNMENT 8 -+ -+ -+ /* FT_UNUSED is a macro used to indicate that a given parameter is not */ -+ /* used -- this is only used to get rid of unpleasant compiler warnings */ -+#ifndef FT_UNUSED -+#define FT_UNUSED( arg ) ( (arg) = (arg) ) -+#endif -+ -+ -+ /*************************************************************************/ -+ /* */ -+ /* AUTOMATIC CONFIGURATION MACROS */ -+ /* */ -+ /* These macros are computed from the ones defined above. Don't touch */ -+ /* their definition, unless you know precisely what you are doing. No */ -+ /* porter should need to mess with them. */ -+ /* */ -+ /*************************************************************************/ -+ -+ -+ /*************************************************************************/ -+ /* */ -+ /* IntN types */ -+ /* */ -+ /* Used to guarantee the size of some specific integers. */ -+ /* */ -+ typedef signed short FT_Int16; -+ typedef unsigned short FT_UInt16; -+ -+#if FT_SIZEOF_INT == 4 -+ -+ typedef signed int FT_Int32; -+ typedef unsigned int FT_UInt32; -+ -+#elif FT_SIZEOF_LONG == 4 -+ -+ typedef signed long FT_Int32; -+ typedef unsigned long FT_UInt32; -+ -+#else -+#error "no 32bit type found -- please check your configuration files" -+#endif -+ -+#if FT_SIZEOF_LONG == 8 -+ -+ /* FT_LONG64 must be defined if a 64-bit type is available */ -+#define FT_LONG64 -+#define FT_INT64 long -+ -+#else -+ -+ /*************************************************************************/ -+ /* */ -+ /* Many compilers provide the non-ANSI `long long' 64-bit type. You can */ -+ /* activate it by defining the FTCALC_USE_LONG_LONG macro in */ -+ /* `ftoption.h'. */ -+ /* */ -+ /* Note that this will produce many -ansi warnings during library */ -+ /* compilation, and that in many cases, the generated code will be */ -+ /* neither smaller nor faster! */ -+ /* */ -+#ifdef FTCALC_USE_LONG_LONG -+ -+#define FT_LONG64 -+#define FT_INT64 long long -+ -+#endif /* FTCALC_USE_LONG_LONG */ -+#endif /* FT_SIZEOF_LONG == 8 */ -+ -+ -+#ifdef FT_MAKE_OPTION_SINGLE_OBJECT -+ -+#define FT_LOCAL( x ) static x -+#define FT_LOCAL_DEF( x ) static x -+ -+#else -+ -+#ifdef __cplusplus -+#define FT_LOCAL( x ) extern "C" x -+#define FT_LOCAL_DEF( x ) extern "C" x -+#else -+#define FT_LOCAL( x ) extern x -+#define FT_LOCAL_DEF( x ) extern x -+#endif -+ -+#endif /* FT_MAKE_OPTION_SINGLE_OBJECT */ -+ -+ -+#ifndef FT_BASE -+ -+#ifdef __cplusplus -+#define FT_BASE( x ) extern "C" x -+#else -+#define FT_BASE( x ) extern x -+#endif -+ -+#endif /* !FT_BASE */ -+ -+ -+#ifndef FT_BASE_DEF -+ -+#ifdef __cplusplus -+#define FT_BASE_DEF( x ) extern "C" x -+#else -+#define FT_BASE_DEF( x ) extern x -+#endif -+ -+#endif /* !FT_BASE_DEF */ -+ -+ -+#ifndef FT_EXPORT -+ -+#ifdef __cplusplus -+#define FT_EXPORT( x ) extern "C" x -+#else -+#define FT_EXPORT( x ) extern x -+#endif -+ -+#endif /* !FT_EXPORT */ -+ -+ -+#ifndef FT_EXPORT_DEF -+ -+#ifdef __cplusplus -+#define FT_EXPORT_DEF( x ) extern "C" x -+#else -+#define FT_EXPORT_DEF( x ) extern x -+#endif -+ -+#endif /* !FT_EXPORT_DEF */ -+ -+ -+#ifndef FT_EXPORT_VAR -+ -+#ifdef __cplusplus -+#define FT_EXPORT_VAR( x ) extern "C" x -+#else -+#define FT_EXPORT_VAR( x ) extern x -+#endif -+ -+#endif /* !FT_EXPORT_VAR */ -+ -+ /* The following macros are needed to compile the library with a */ -+ /* C++ compiler and with 16bit compilers. */ -+ /* */ -+ -+ /* This is special. Within C++, you must specify `extern "C"' for */ -+ /* functions which are used via function pointers, and you also */ -+ /* must do that for structures which contain function pointers to */ -+ /* assure C linkage -- it's not possible to have (local) anonymous */ -+ /* functions which are accessed by (global) function pointers. */ -+ /* */ -+ /* */ -+ /* FT_CALLBACK_DEF is used to _define_ a callback function. */ -+ /* */ -+ /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */ -+ /* contains pointers to callback functions. */ -+ /* */ -+ /* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable */ -+ /* that contains pointers to callback functions. */ -+ /* */ -+ /* */ -+ /* Some 16bit compilers have to redefine these macros to insert */ -+ /* the infamous `_cdecl' or `__fastcall' declarations. */ -+ /* */ -+#ifndef FT_CALLBACK_DEF -+#ifdef __cplusplus -+#define FT_CALLBACK_DEF( x ) extern "C" x -+#else -+#define FT_CALLBACK_DEF( x ) static x -+#endif -+#endif /* FT_CALLBACK_DEF */ -+ -+#ifndef FT_CALLBACK_TABLE -+#ifdef __cplusplus -+#define FT_CALLBACK_TABLE extern "C" -+#define FT_CALLBACK_TABLE_DEF extern "C" -+#else -+#define FT_CALLBACK_TABLE extern -+#define FT_CALLBACK_TABLE_DEF /* nothing */ -+#endif -+#endif /* FT_CALLBACK_TABLE */ -+ -+ -+FT_END_HEADER -+ -+#endif /* __FTCONFIG_H__ */ -+ -+ -+/* END */ diff --git a/src/3rdparty/patches/freetype-2.3.6-ascii.patch b/src/3rdparty/patches/freetype-2.3.6-ascii.patch deleted file mode 100644 index cc46296..0000000 --- a/src/3rdparty/patches/freetype-2.3.6-ascii.patch +++ /dev/null @@ -1,174 +0,0 @@ ---- include/freetype/ftbbox.h.orig 2007-10-20 15:27:57.000000000 +0200 -+++ include/freetype/ftbbox.h 2008-06-15 00:00:00.000000000 +0200 -@@ -61,7 +61,7 @@ - /* Computes the exact bounding box of an outline. This is slower */ - /* than computing the control box. However, it uses an advanced */ - /* algorithm which returns _very_ quickly when the two boxes */ -- /* coincide. Otherwise, the outline Bézier arcs are traversed to */ -+ /* coincide. Otherwise, the outline Bezier arcs are traversed to */ - /* extract their extrema. */ - /* */ - /* <Input> */ ---- include/freetype/ftglyph.h.orig 2008-04-13 23:58:59.000000000 +0200 -+++ include/freetype/ftglyph.h 2008-06-15 00:00:00.000000000 +0200 -@@ -354,10 +354,10 @@ - /* */ - /* <Description> */ - /* Return a glyph's `control box'. The control box encloses all the */ -- /* outline's points, including Bézier control points. Though it */ -+ /* outline's points, including Bezier control points. Though it */ - /* coincides with the exact bounding box for most glyphs, it can be */ - /* slightly larger in some situations (like when rotating an outline */ -- /* which contains Bézier outside arcs). */ -+ /* which contains Bezier outside arcs). */ - /* */ - /* Computing the control box is very fast, while getting the bounding */ - /* box can take much more time as it needs to walk over all segments */ ---- include/freetype/ftimage.h.orig 2008-05-31 08:46:38.000000000 +0200 -+++ include/freetype/ftimage.h 2008-06-15 00:00:00.000000000 +0200 -@@ -318,11 +318,11 @@ - /* */ - /* tags :: A pointer to an array of `n_points' chars, giving */ - /* each outline point's type. If bit 0 is unset, the */ -- /* point is `off' the curve, i.e., a Bézier control */ -+ /* point is `off' the curve, i.e., a Bezier control */ - /* point, while it is `on' when set. */ - /* */ - /* Bit 1 is meaningful for `off' points only. If set, */ -- /* it indicates a third-order Bézier arc control point; */ -+ /* it indicates a third-order Bezier arc control point; */ - /* and a second-order control point if unset. */ - /* */ - /* contours :: An array of `n_contours' shorts, giving the end */ -@@ -528,7 +528,7 @@ - /* A function pointer type use to describe the signature of a `conic */ - /* to' function during outline walking/decomposition. */ - /* */ -- /* A `conic to' is emitted to indicate a second-order Bézier arc in */ -+ /* A `conic to' is emitted to indicate a second-order Bezier arc in */ - /* the outline. */ - /* */ - /* <Input> */ -@@ -560,12 +560,12 @@ - /* A function pointer type used to describe the signature of a `cubic */ - /* to' function during outline walking/decomposition. */ - /* */ -- /* A `cubic to' is emitted to indicate a third-order Bézier arc. */ -+ /* A `cubic to' is emitted to indicate a third-order Bezier arc. */ - /* */ - /* <Input> */ -- /* control1 :: A pointer to the first Bézier control point. */ -+ /* control1 :: A pointer to the first Bezier control point. */ - /* */ -- /* control2 :: A pointer to the second Bézier control point. */ -+ /* control2 :: A pointer to the second Bezier control point. */ - /* */ - /* to :: A pointer to the target end point. */ - /* */ -@@ -591,7 +591,7 @@ - /* */ - /* <Description> */ - /* A structure to hold various function pointers used during outline */ -- /* decomposition in order to emit segments, conic, and cubic Béziers, */ -+ /* decomposition in order to emit segments, conic, and cubic Beziers, */ - /* as well as `move to' and `close to' operations. */ - /* */ - /* <Fields> */ -@@ -599,9 +599,9 @@ - /* */ - /* line_to :: The segment emitter. */ - /* */ -- /* conic_to :: The second-order Bézier arc emitter. */ -+ /* conic_to :: The second-order Bezier arc emitter. */ - /* */ -- /* cubic_to :: The third-order Bézier arc emitter. */ -+ /* cubic_to :: The third-order Bezier arc emitter. */ - /* */ - /* shift :: The shift that is applied to coordinates before they */ - /* are sent to the emitter. */ -@@ -698,7 +698,7 @@ - /* */ - /* FT_GLYPH_FORMAT_OUTLINE :: */ - /* The glyph image is a vectorial outline made of line segments */ -- /* and Bézier arcs; it can be described as an @FT_Outline; you */ -+ /* and Bezier arcs; it can be described as an @FT_Outline; you */ - /* generally want to access the `outline' field of the */ - /* @FT_GlyphSlotRec structure to read it. */ - /* */ ---- include/freetype/ftoutln.h.orig 2008-05-29 00:05:07.000000000 +0200 -+++ include/freetype/ftoutln.h 2008-06-15 00:00:00.000000000 +0200 -@@ -85,7 +85,7 @@ - /* */ - /* <Description> */ - /* Walks over an outline's structure to decompose it into individual */ -- /* segments and Bézier arcs. This function is also able to emit */ -+ /* segments and Bezier arcs. This function is also able to emit */ - /* `move to' and `close to' operations to indicate the start and end */ - /* of new contours in the outline. */ - /* */ -@@ -213,10 +213,10 @@ - /* */ - /* <Description> */ - /* Returns an outline's `control box'. The control box encloses all */ -- /* the outline's points, including Bézier control points. Though it */ -+ /* the outline's points, including Bezier control points. Though it */ - /* coincides with the exact bounding box for most glyphs, it can be */ - /* slightly larger in some situations (like when rotating an outline */ -- /* which contains Bézier outside arcs). */ -+ /* which contains Bezier outside arcs). */ - /* */ - /* Computing the control box is very fast, while getting the bounding */ - /* box can take much more time as it needs to walk over all segments */ ---- include/freetype/ftstroke.h.orig 2008-05-29 00:06:54.000000000 +0200 -+++ include/freetype/ftstroke.h 2008-06-15 00:00:00.000000000 +0200 -@@ -407,7 +407,7 @@ - * FT_Stroker_ConicTo - * - * @description: -- * `Draw' a single quadratic Bézier in the stroker's current sub-path, -+ * `Draw' a single quadratic Bezier in the stroker's current sub-path, - * from the last position. - * - * @input: -@@ -415,7 +415,7 @@ - * The target stroker handle. - * - * control :: -- * A pointer to a Bézier control point. -+ * A pointer to a Bezier control point. - * - * to :: - * A pointer to the destination point. -@@ -439,7 +439,7 @@ - * FT_Stroker_CubicTo - * - * @description: -- * `Draw' a single cubic Bézier in the stroker's current sub-path, -+ * `Draw' a single cubic Bezier in the stroker's current sub-path, - * from the last position. - * - * @input: -@@ -447,10 +447,10 @@ - * The target stroker handle. - * - * control1 :: -- * A pointer to the first Bézier control point. -+ * A pointer to the first Bezier control point. - * - * control2 :: -- * A pointer to second Bézier control point. -+ * A pointer to second Bezier control point. - * - * to :: - * A pointer to the destination point. ---- include/freetype/ftwinfnt.h.orig 2008-05-28 23:27:19.000000000 +0200 -+++ include/freetype/ftwinfnt.h 2008-06-15 00:00:00.000000000 +0200 -@@ -77,7 +77,7 @@ - * Mac Roman encoding. - * - * FT_WinFNT_ID_OEM :: -- * From Michael Pöttgen <michael@poettgen.de>: -+ * From Michael Poettgen <michael@poettgen.de>: - * - * The `Windows Font Mapping' article says that FT_WinFNT_ID_OEM - * is used for the charset of vector fonts, like `modern.fon', diff --git a/src/3rdparty/patches/freetype-2.3.6-vxworks.patch b/src/3rdparty/patches/freetype-2.3.6-vxworks.patch deleted file mode 100644 index 21e884c..0000000 --- a/src/3rdparty/patches/freetype-2.3.6-vxworks.patch +++ /dev/null @@ -1,35 +0,0 @@ -diff --git builds/unix/ftsystem.c builds/unix/ftsystem.c -index 3a740fd..40fa8d0 100644 ---- builds/unix/ftsystem.c -+++ builds/unix/ftsystem.c -@@ -69,6 +69,9 @@ - #include <string.h> - #include <errno.h> - -+#ifdef VXWORKS -+#include <ioLib.h> -+#endif - - /*************************************************************************/ - /* */ -@@ -238,7 +241,7 @@ - return FT_Err_Invalid_Stream_Handle; - - /* open the file */ -- file = open( filepathname, O_RDONLY ); -+ file = open( filepathname, O_RDONLY, 0); - if ( file < 0 ) - { - FT_ERROR(( "FT_Stream_Open:" )); -@@ -317,7 +320,11 @@ - - - read_count = read( file, -+#ifndef VXWORKS - stream->base + total_read_count, -+#else -+ (char *) stream->base + total_read_count, -+#endif - stream->size - total_read_count ); - - if ( read_count <= 0 ) diff --git a/src/3rdparty/patches/libjpeg-6b-config.patch b/src/3rdparty/patches/libjpeg-6b-config.patch deleted file mode 100644 index 3012b8f..0000000 --- a/src/3rdparty/patches/libjpeg-6b-config.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- jconfig.h.orig 1970-01-01 01:00:00.000000000 +0100 -+++ jconfig.h 2006-06-15 00:00:00.000000000 +0200 -@@ -0,0 +1,47 @@ -+/* jconfig.vc --- jconfig.h for Microsoft Visual C++ on Windows 95 or NT. */ -+/* see jconfig.doc for explanations */ -+ -+#define HAVE_PROTOTYPES -+#define HAVE_UNSIGNED_CHAR -+#define HAVE_UNSIGNED_SHORT -+/* #define void char */ -+/* #define const */ -+#undef CHAR_IS_UNSIGNED -+#define HAVE_STDDEF_H -+#define HAVE_STDLIB_H -+#undef NEED_BSD_STRINGS -+#undef NEED_SYS_TYPES_H -+#undef NEED_FAR_POINTERS /* we presume a 32-bit flat memory model */ -+#undef NEED_SHORT_EXTERNAL_NAMES -+#undef INCOMPLETE_TYPES_BROKEN -+ -+#if defined(_WIN32) -+/* Define "boolean" as unsigned char, not int, per Windows custom */ -+#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */ -+typedef unsigned char boolean; -+#endif -+#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ -+#endif -+ -+ -+#ifdef JPEG_INTERNALS -+ -+#undef RIGHT_SHIFT_IS_UNSIGNED -+ -+#endif /* JPEG_INTERNALS */ -+ -+#ifdef JPEG_CJPEG_DJPEG -+ -+#define BMP_SUPPORTED /* BMP image file format */ -+#define GIF_SUPPORTED /* GIF image file format */ -+#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ -+#undef RLE_SUPPORTED /* Utah RLE image file format */ -+#define TARGA_SUPPORTED /* Targa image file format */ -+ -+#define TWO_FILE_COMMANDLINE /* optional */ -+#define USE_SETMODE /* Microsoft has setmode() */ -+#undef NEED_SIGNAL_CATCHER -+#undef DONT_USE_B_MODE -+#undef PROGRESS_REPORT /* optional */ -+ -+#endif /* JPEG_CJPEG_DJPEG */ diff --git a/src/3rdparty/patches/libjpeg-6b-vxworks.patch b/src/3rdparty/patches/libjpeg-6b-vxworks.patch deleted file mode 100644 index 263c8d0..0000000 --- a/src/3rdparty/patches/libjpeg-6b-vxworks.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff --git jmorecfg.h jmorecfg.h -index 54a7d1c..b0b5870 100644 ---- jmorecfg.h -+++ jmorecfg.h -@@ -157,7 +157,7 @@ typedef short INT16; - - /* INT32 must hold at least signed 32-bit values. */ - --#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */ -+#if !defined(XMD_H) && !defined(VXWORKS) /* X11/xmd.h correctly defines INT32 */ - typedef long INT32; - #endif - -@@ -183,6 +183,9 @@ typedef unsigned int JDIMENSION; - /* a function called through method pointers: */ - #define METHODDEF(type) static type - /* a function used only in its module: */ -+#if defined(VXWORKS) && defined(LOCAL) -+# undef LOCAL -+#endif - #define LOCAL(type) static type - /* a function referenced thru EXTERNs: */ - #define GLOBAL(type) type diff --git a/src/3rdparty/patches/libpng-1.2.20-elf-visibility.patch b/src/3rdparty/patches/libpng-1.2.20-elf-visibility.patch deleted file mode 100644 index a374cbf..0000000 --- a/src/3rdparty/patches/libpng-1.2.20-elf-visibility.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- pngconf.h.orig 2007-09-08 05:22:56.000000000 +0200 -+++ pngconf.h 2007-09-09 00:00:00.000000000 +0200 -@@ -1375,6 +1375,14 @@ - # if 0 /* ... other platforms, with other meanings */ - # endif - # endif -+ -+# if !defined(PNG_IMPEXP) -+# include <qconfig.h> -+# if defined(QT_VISIBILITY_AVAILABLE) -+# define PNG_IMPEXP __attribute__((visibility("default"))) -+# endif -+# endif -+ - #endif - - #ifndef PNGAPI diff --git a/src/3rdparty/patches/libpng-1.2.20-vxworks.patch b/src/3rdparty/patches/libpng-1.2.20-vxworks.patch deleted file mode 100644 index 4c49b3f..0000000 --- a/src/3rdparty/patches/libpng-1.2.20-vxworks.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git pngconf.h pngconf.h -index 19e4732..8eb7d35 100644 ---- pngconf.h -+++ pngconf.h -@@ -344,7 +344,7 @@ - # endif /* __linux__ */ - #endif /* PNG_SETJMP_SUPPORTED */ - --#ifdef BSD -+#if defined(BSD) && !defined(VXWORKS) - # include <strings.h> - #else - # include <string.h> diff --git a/src/3rdparty/patches/libtiff-3.8.2-config.patch b/src/3rdparty/patches/libtiff-3.8.2-config.patch deleted file mode 100644 index 44230ea..0000000 --- a/src/3rdparty/patches/libtiff-3.8.2-config.patch +++ /dev/null @@ -1,374 +0,0 @@ ---- libtiff/tif_config.h 1970-01-01 01:00:00.000000000 +0100 -+++ libtiff/tif_config.h 2008-05-25 00:00:00.000000000 +0200 -@@ -0,0 +1,296 @@ -+/* -+ Configuration defines by Trolltech. -+*/ -+ -+#include <qglobal.h> -+#if defined(Q_OS_WINCE) -+# include <qfunctions_wince.h> -+#endif -+ -+/* Support CCITT Group 3 & 4 algorithms */ -+#define CCITT_SUPPORT 1 -+ -+/* Pick up YCbCr subsampling info from the JPEG data stream to support files -+ lacking the tag (default enabled). */ -+#define CHECK_JPEG_YCBCR_SUBSAMPLING 1 -+ -+/* Support C++ stream API (requires C++ compiler) */ -+/* #undef CXX_SUPPORT */ -+ -+/* Treat extra sample as alpha (default enabled). The RGBA interface will -+ treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many -+ packages produce RGBA files but don't mark the alpha properly. */ -+#define DEFAULT_EXTRASAMPLE_AS_ALPHA 1 -+ -+/* Use the Apple OpenGL framework. */ -+/* #undef HAVE_APPLE_OPENGL_FRAMEWORK */ -+ -+/* Define to 1 if you have the <assert.h> header file. */ -+#define HAVE_ASSERT_H 1 -+ -+/* Define to 1 if you have the <dlfcn.h> header file. */ -+/* #undef HAVE_DLFCN_H */ -+ -+/* Define to 1 if you have the <fcntl.h> header file. */ -+#if !defined(Q_OS_WINCE) -+#define HAVE_FCNTL_H 1 -+#endif -+ -+/* Define to 1 if you have the `floor' function. */ -+/* #undef HAVE_FLOOR */ -+ -+/* Define to 1 if you have the `getopt' function. */ -+/* #undef HAVE_GETOPT */ -+ -+/* Define as 0 or 1 according to the floating point format suported by the -+ machine */ -+#define HAVE_IEEEFP 1 -+ -+/* Define to 1 if the system has the type `int16'. */ -+/* #undef HAVE_INT16 */ -+#ifdef Q_OS_AIX -+#define HAVE_INT16 1 -+#endif -+ -+/* Define to 1 if the system has the type `int32'. */ -+/* #undef HAVE_INT32 */ -+#ifdef Q_OS_AIX -+#define HAVE_INT32 1 -+#endif -+ -+/* Define to 1 if the system has the type `int8'. */ -+/* #undef HAVE_INT8 */ -+#ifdef Q_OS_AIX -+#define HAVE_INT8 1 -+#endif -+ -+/* Define to 1 if you have the <inttypes.h> header file. */ -+/* #undef HAVE_INTTYPES_H */ -+ -+/* Define to 1 if you have the `isascii' function. */ -+/* #undef HAVE_ISASCII */ -+ -+/* Define to 1 if you have the `lfind' function. */ -+/* #undef HAVE_LFIND */ -+ -+/* Define to 1 if you have the `c' library (-lc). */ -+/* #undef HAVE_LIBC */ -+ -+/* Define to 1 if you have the `m' library (-lm). */ -+/* #undef HAVE_LIBM */ -+ -+/* Define to 1 if you have the <limits.h> header file. */ -+/* #undef HAVE_LIMITS_H */ -+ -+/* Define to 1 if you have the <malloc.h> header file. */ -+/* #undef HAVE_MALLOC_H */ -+ -+/* Define to 1 if you have the `memmove' function. */ -+/* #undef HAVE_MEMMOVE */ -+ -+/* Define to 1 if you have the <memory.h> header file. */ -+/* #undef HAVE_MEMORY_H */ -+ -+/* Define to 1 if you have the `memset' function. */ -+/* #undef HAVE_MEMSET */ -+ -+/* Define to 1 if you have the `mmap' function. */ -+/* #undef HAVE_MMAP */ -+ -+/* Define to 1 if you have the `pow' function. */ -+/* #undef HAVE_POW */ -+ -+/* Define if you have POSIX threads libraries and header files. */ -+/* #undef HAVE_PTHREAD */ -+ -+/* Define to 1 if you have the <search.h> header file. */ -+#if !defined(Q_OS_WINCE) -+#define HAVE_SEARCH_H 1 -+#endif -+ -+/* Define to 1 if you have the `sqrt' function. */ -+/* #undef HAVE_SQRT */ -+ -+/* Define to 1 if you have the <stdint.h> header file. */ -+/* #undef HAVE_STDINT_H */ -+ -+/* Define to 1 if you have the <stdlib.h> header file. */ -+/* #undef HAVE_STDLIB_H */ -+ -+/* Define to 1 if you have the `strcasecmp' function. */ -+/* #undef HAVE_STRCASECMP */ -+ -+/* Define to 1 if you have the `strchr' function. */ -+/* #undef HAVE_STRCHR */ -+ -+/* Define to 1 if you have the <strings.h> header file. */ -+/* #undef HAVE_STRINGS_H */ -+ -+/* Define to 1 if you have the <string.h> header file. */ -+#define HAVE_STRING_H 1 -+ -+/* Define to 1 if you have the `strrchr' function. */ -+/* #undef HAVE_STRRCHR */ -+ -+/* Define to 1 if you have the `strstr' function. */ -+/* #undef HAVE_STRSTR */ -+ -+/* Define to 1 if you have the `strtol' function. */ -+/* #undef HAVE_STRTOL */ -+ -+/* Define to 1 if you have the `strtoul' function. */ -+/* #undef HAVE_STRTOUL */ -+ -+/* Define to 1 if you have the <sys/stat.h> header file. */ -+/* #undef HAVE_SYS_STAT_H */ -+ -+/* Define to 1 if you have the <sys/time.h> header file. */ -+/* #undef HAVE_SYS_TIME_H */ -+ -+/* Define to 1 if you have the <sys/types.h> header file. */ -+#define HAVE_SYS_TYPES_H 1 -+ -+/* Define to 1 if you have the <unistd.h> header file. */ -+#define HAVE_UNISTD_H 1 -+ -+/* Define to 1 if you have the <windows.h> header file. */ -+/* #undef HAVE_WINDOWS_H */ -+#ifdef Q_OS_WIN -+#define TIF_PLATFORM_CONSOLE -+#endif -+ -+/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian -+ (Intel) */ -+#if (Q_BYTE_ORDER == Q_BIG_ENDIAN) -+#define HOST_BIGENDIAN 1 -+#else -+#define HOST_BIGENDIAN 0 -+#endif -+ -+/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */ -+#define HOST_FILLORDER FILLORDER_LSB2MSB -+ -+/* Support JPEG compression (requires IJG JPEG library) */ -+/* #undef JPEG_SUPPORT */ -+ -+/* Support LogLuv high dynamic range encoding */ -+#define LOGLUV_SUPPORT 1 -+ -+/* Define to the sub-directory in which libtool stores uninstalled libraries. -+ */ -+/* #undef LT_OBJDIR */ -+ -+/* Support LZW algorithm */ -+#define LZW_SUPPORT 1 -+ -+/* Support Microsoft Document Imaging format */ -+#define MDI_SUPPORT 1 -+ -+/* Support NeXT 2-bit RLE algorithm */ -+#define NEXT_SUPPORT 1 -+ -+/* Define to 1 if your C compiler doesn't accept -c and -o together. */ -+/* #undef NO_MINUS_C_MINUS_O */ -+ -+/* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation -+ fails with unpatched IJG JPEG library) */ -+/* #undef OJPEG_SUPPORT */ -+ -+/* Name of package */ -+/* #undef PACKAGE */ -+ -+/* Define to the address where bug reports for this package should be sent. */ -+/* #undef PACKAGE_BUGREPORT */ -+ -+/* Define to the full name of this package. */ -+/* #undef PACKAGE_NAME */ -+ -+/* Define to the full name and version of this package. */ -+/* #undef PACKAGE_STRING */ -+ -+/* Define to the one symbol short name of this package. */ -+/* #undef PACKAGE_TARNAME */ -+ -+/* Define to the version of this package. */ -+/* #undef PACKAGE_VERSION */ -+ -+/* Support Macintosh PackBits algorithm */ -+#define PACKBITS_SUPPORT 1 -+ -+/* Support Pixar log-format algorithm (requires Zlib) */ -+#define PIXARLOG_SUPPORT 1 -+ -+/* Define to necessary symbol if this constant uses a non-standard name on -+ your system. */ -+/* #undef PTHREAD_CREATE_JOINABLE */ -+ -+/* The size of a `int', as computed by sizeof. */ -+#define SIZEOF_INT 4 -+ -+/* The size of a `long', as computed by sizeof. */ -+#if (QT_POINTER_SIZE == 8) && !defined(Q_OS_WIN64) -+#define SIZEOF_LONG 8 -+#else -+#define SIZEOF_LONG 4 -+#endif -+ -+/* Define to 1 if you have the ANSI C header files. */ -+/* #undef STDC_HEADERS */ -+ -+/* Support strip chopping (whether or not to convert single-strip uncompressed -+ images to mutiple strips of specified size to reduce memory usage) */ -+#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP -+ -+/* Default size of the strip in bytes (when strip chopping enabled) */ -+/* #undef STRIP_SIZE_DEFAULT */ -+ -+/* Enable SubIFD tag (330) support */ -+#define SUBIFD_SUPPORT 1 -+ -+/* Support ThunderScan 4-bit RLE algorithm */ -+#define THUNDER_SUPPORT 1 -+ -+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ -+/* #undef TIME_WITH_SYS_TIME */ -+ -+/* Define to 1 if your <sys/time.h> declares `struct tm'. */ -+/* #undef TM_IN_SYS_TIME */ -+ -+/* Version number of package */ -+/* #undef VERSION */ -+ -+/* Define to 1 if your processor stores words with the most significant byte -+ first (like Motorola and SPARC, unlike Intel and VAX). */ -+#if (Q_BYTE_ORDER == Q_BIG_ENDIAN) -+#define WORDS_BIGENDIAN 1 -+#else -+/* #undef WORDS_BIGENDIAN */ -+#endif -+ -+/* Define to 1 if the X Window System is missing or not being used. */ -+/* #undef X_DISPLAY_MISSING */ -+ -+/* Support Deflate compression */ -+#define ZIP_SUPPORT 1 -+ -+/* Number of bits in a file offset, on hosts where this is settable. */ -+/* #undef _FILE_OFFSET_BITS */ -+ -+/* Define for large files, on AIX-style hosts. */ -+/* #undef _LARGE_FILES */ -+ -+/* Define to empty if `const' does not conform to ANSI C. */ -+/* #undef const */ -+ -+/* Define to `__inline__' or `__inline' if that's what the C compiler -+ calls it, or to nothing if 'inline' is not supported under any name. */ -+#ifndef __cplusplus -+#undef inline -+#define inline -+#endif -+ -+/* Define to `long' if <sys/types.h> does not define. */ -+/* #undef off_t */ -+ -+/* Define to `unsigned' if <sys/types.h> does not define. */ -+/* #undef size_t */ ---- libtiff/tiffconf.h 2006-03-23 15:55:22.000000000 +0100 -+++ libtiff/tiffconf.h 2008-05-25 00:00:00.000000000 +0200 -@@ -1,6 +1,5 @@ --/* libtiff/tiffconf.h. Generated by configure. */ - /* -- Configuration defines for installed libtiff. -+ Configuration defines by Trolltech. - This file maintained for backward compatibility. Do not use definitions - from this file in your programs. - */ -@@ -8,6 +7,8 @@ - #ifndef _TIFFCONF_ - #define _TIFFCONF_ - -+#include <qglobal.h> -+ - /* Define to 1 if the system has the type `int16'. */ - /* #undef HAVE_INT16 */ - -@@ -21,7 +22,11 @@ - #define SIZEOF_INT 4 - - /* The size of a `long', as computed by sizeof. */ -+#if (QT_POINTER_SIZE == 8) && !defined(Q_OS_WIN64) -+#define SIZEOF_LONG 8 -+#else - #define SIZEOF_LONG 4 -+#endif - - /* Compatibility stuff. */ - -@@ -34,13 +39,17 @@ - - /* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian - (Intel) */ -+#if (Q_BYTE_ORDER == Q_BIG_ENDIAN) -+#define HOST_BIGENDIAN 1 -+#else - #define HOST_BIGENDIAN 0 -+#endif - - /* Support CCITT Group 3 & 4 algorithms */ - #define CCITT_SUPPORT 1 - - /* Support JPEG compression (requires IJG JPEG library) */ --#define JPEG_SUPPORT 1 -+/* #undef JPEG_SUPPORT */ - - /* Support LogLuv high dynamic range encoding */ - #define LOGLUV_SUPPORT 1 ---- libtiff/tiffiop.h 2006-03-21 17:42:50.000000000 +0100 -+++ libtiff/tiffiop.h 2008-05-25 00:00:00.000000000 +0200 -@@ -37,7 +37,12 @@ - #endif - - #ifdef HAVE_SYS_TYPES_H -+#if !defined(Q_OS_WINCE) - # include <sys/types.h> -+#else -+# include <windows.h> -+# include <types.h> -+#endif - #endif - - #ifdef HAVE_STRING_H ---- libtiff/tif_win32.c 2006-02-07 14:51:03.000000000 +0100 -+++ libtiff/tif_win32.c 2008-05-25 00:00:00.000000000 +0200 -@@ -29,6 +29,7 @@ - * Scott Wagner (wagner@itek.com), Itek Graphix, Rochester, NY USA - */ - #include "tiffiop.h" -+#include <windows.h> - - static tsize_t - _tiffReadProc(thandle_t fd, tdata_t buf, tsize_t size) diff --git a/src/3rdparty/patches/libtiff-3.8.2-vxworks.patch b/src/3rdparty/patches/libtiff-3.8.2-vxworks.patch deleted file mode 100644 index b1b725e..0000000 --- a/src/3rdparty/patches/libtiff-3.8.2-vxworks.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- libtiff/tif_config.h.orig -+++ libtiff/tif_config.h -@@ -104,7 +104,7 @@ - /* #undef HAVE_PTHREAD */ - - /* Define to 1 if you have the <search.h> header file. */ --#if !defined(Q_OS_WINCE) -+#if !defined(Q_OS_WINCE) && !defined(Q_OS_VXWORKS) - #define HAVE_SEARCH_H 1 - #endif - diff --git a/src/3rdparty/patches/sqlite-3.5.6-config.patch b/src/3rdparty/patches/sqlite-3.5.6-config.patch deleted file mode 100644 index cf158ea..0000000 --- a/src/3rdparty/patches/sqlite-3.5.6-config.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- sqlite3.c.orig 2008-02-06 16:03:28.000000000 +0100 -+++ sqlite3.c 2008-02-13 00:00:00.000000000 +0100 -@@ -16823,6 +16823,8 @@ - */ - #if OS_UNIX /* This file is used on unix only */ - -+#include <qconfig.h> -+ - /* #define SQLITE_ENABLE_LOCKING_STYLE 0 */ - - /* -@@ -16865,7 +16867,7 @@ - ** If we are to be thread-safe, include the pthreads header and define - ** the SQLITE_UNIX_THREADS macro. - */ --#if SQLITE_THREADSAFE -+#ifndef QT_NO_THREAD - # define SQLITE_UNIX_THREADS 1 - #endif - -@@ -19739,6 +19741,8 @@ - ** desktops but not so well in embedded systems. - */ - -+#include <qconfig.h> -+ - #include <winbase.h> - - #ifdef __CYGWIN__ -@@ -19748,7 +19752,7 @@ - /* - ** Macros used to determine whether or not to use threads. - */ --#if defined(THREADSAFE) && THREADSAFE -+#ifndef QT_NO_THREAD - # define SQLITE_W32_THREADS 1 - #endif - diff --git a/src/3rdparty/patches/sqlite-3.5.6-vxworks.patch b/src/3rdparty/patches/sqlite-3.5.6-vxworks.patch deleted file mode 100644 index 6ae65fd..0000000 --- a/src/3rdparty/patches/sqlite-3.5.6-vxworks.patch +++ /dev/null @@ -1,68 +0,0 @@ ---- sqlite3.c.orig -+++ sqlite3.c -@@ -383,7 +383,7 @@ SQLITE_PRIVATE void sqlite3Coverage(int); - ** - ** See also ticket #2741. - */ --#if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__) && SQLITE_THREADSAFE -+#if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__) && SQLITE_THREADSAFE && !defined(VXWORKS) - # define _XOPEN_SOURCE 500 /* Needed to enable pthread recursive mutexes */ - #endif - -@@ -440,6 +440,13 @@ SQLITE_PRIVATE void sqlite3Coverage(int); - */ - #ifndef _SQLITE3_H_ - #define _SQLITE3_H_ -+ -+#ifdef VXWORKS -+# define SQLITE_HOMEGROWN_RECURSIVE_MUTEX -+# define NO_GETTOD -+# include <ioLib.h> -+#endif -+ - #include <stdarg.h> /* Needed for the definition of va_list */ - - /* -@@ -18792,7 +18799,11 @@ SQLITE_PRIVATE sqlite3_vfs *sqlite3OsDefaultVfs(void){ - #include <sys/stat.h> - #include <fcntl.h> - #include <unistd.h> --#include <sys/time.h> -+#ifdef VXWORKS -+# include <sys/times.h> -+#else -+# include <sys/time.h> -+#endif - #include <errno.h> - #ifdef SQLITE_ENABLE_LOCKING_STYLE - #include <sys/ioctl.h> -@@ -19728,7 +19739,11 @@ static int seekAndWrite(unixFile *id, i64 offset, const void *pBuf, int cnt){ - if( newOffset!=offset ){ - return -1; - } -+# ifndef VXWORKS - got = write(id->h, pBuf, cnt); -+# else -+ got = write(id->h, (char *)pBuf, cnt); -+# endif - #endif - TIMER_END; - OSTRACE5("WRITE %-3d %5d %7lld %d\n", id->h, got, offset, TIMER_ELAPSED); -@@ -21554,12 +21569,16 @@ static int unixRandomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf){ - #if !defined(SQLITE_TEST) - { - int pid, fd; -- fd = open("/dev/urandom", O_RDONLY); -+ fd = open("/dev/urandom", O_RDONLY, 0); - if( fd<0 ){ - time_t t; - time(&t); - memcpy(zBuf, &t, sizeof(t)); -+#ifndef VXWORKS - pid = getpid(); -+#else -+ pid = (int)taskIdCurrent(); -+#endif - memcpy(&zBuf[sizeof(t)], &pid, sizeof(pid)); - }else{ - read(fd, zBuf, nBuf); diff --git a/src/3rdparty/patches/sqlite-3.5.6-wince.patch b/src/3rdparty/patches/sqlite-3.5.6-wince.patch deleted file mode 100644 index 02965f8..0000000 --- a/src/3rdparty/patches/sqlite-3.5.6-wince.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- sqlite3.c.orig 2008-02-06 16:03:28.000000000 +0100 -+++ sqlite3.c 2008-02-13 00:00:00.000000000 +0100 -@@ -8837,6 +8837,16 @@ - } - - /* -+** Windows CE does not declare the localtime -+** function as it is not defined anywhere. -+** Anyway we need the forward-declaration to be -+** able to define it later on. -+*/ -+#if defined(_WIN32_WCE) && (_WIN32_WCE >= 0x600) -+struct tm *__cdecl localtime(const time_t *t); -+#endif -+ -+/* - ** Compute the difference (in days) between localtime and UTC (a.k.a. GMT) - ** for the time value p where p is in UTC. - */ diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 779b69b..8f2d025 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -133,6 +133,7 @@ QT_BEGIN_NAMESPACE \value Float \c float \value QObjectStar QObject * \value QWidgetStar QWidget * + \value QVariant QVariant \value QColorGroup QColorGroup \value QCursor QCursor @@ -300,6 +301,7 @@ static const struct { const char * typeName; int typeNameLength; int type; } typ QT_ADD_STATIC_METATYPE("float", QMetaType::Float), QT_ADD_STATIC_METATYPE("QObject*", QMetaType::QObjectStar), QT_ADD_STATIC_METATYPE("QWidget*", QMetaType::QWidgetStar), + QT_ADD_STATIC_METATYPE("QVariant", QMetaType::QVariant), /* Type aliases - order doesn't matter */ QT_ADD_STATIC_METATYPE("unsigned long", QMetaType::ULong), @@ -352,6 +354,7 @@ public: QMetaType::SaveOperator saveOp; QMetaType::LoadOperator loadOp; #endif + int alias; }; Q_DECLARE_TYPEINFO(QCustomTypeInfo, Q_MOVABLE_TYPE); @@ -436,8 +439,11 @@ static int qMetaTypeCustomType_unlocked(const char *typeName, int length) return 0; for (int v = 0; v < ct->count(); ++v) { - if ((length == ct->at(v).typeName.size()) - && !strcmp(typeName, ct->at(v).typeName.constData())) { + const QCustomTypeInfo &customInfo = ct->at(v); + if ((length == customInfo.typeName.size()) + && !strcmp(typeName, customInfo.typeName.constData())) { + if (customInfo.alias >= 0) + return customInfo.alias; return v + QMetaType::User; } } @@ -475,6 +481,7 @@ int QMetaType::registerType(const char *typeName, Destructor destructor, inf.typeName = normalizedTypeName; inf.constr = constructor; inf.destr = destructor; + inf.alias = -1; idx = ct->size() + User; ct->append(inf); } @@ -482,6 +489,51 @@ int QMetaType::registerType(const char *typeName, Destructor destructor, return idx; } +/*! \internal + \since 4.7 + + Registers a user type for marshalling, as an alias of another type (typedef) +*/ +int QMetaType::registerTypedef(const char* typeName, int aliasId) +{ + QVector<QCustomTypeInfo> *ct = customTypes(); + if (!ct || !typeName) + return -1; + +#ifdef QT_NO_QOBJECT + NS(QByteArray) normalizedTypeName = typeName; +#else + NS(QByteArray) normalizedTypeName = QMetaObject::normalizedType(typeName); +#endif + + int idx = qMetaTypeStaticType(normalizedTypeName.constData(), + normalizedTypeName.size()); + + if (idx) { + Q_ASSERT(idx == aliasId); + return idx; + } + + QWriteLocker locker(customTypesLock()); + idx = qMetaTypeCustomType_unlocked(normalizedTypeName.constData(), + normalizedTypeName.size()); + + if (idx) { + Q_ASSERT(idx == aliasId); + return idx; + } + + if (!idx) { + QCustomTypeInfo inf; + inf.typeName = normalizedTypeName; + inf.alias = aliasId; + inf.constr = 0; + inf.destr = 0; + ct->append(inf); + } + return aliasId; +} + /*! \since 4.4 @@ -507,6 +559,7 @@ void QMetaType::unregisterType(const char *typeName) inf.typeName.clear(); inf.constr = 0; inf.destr = 0; + inf.alias = -1; } } } @@ -635,6 +688,9 @@ bool QMetaType::save(QDataStream &stream, int type, const void *data) case QMetaType::QVariantList: stream << *static_cast<const NS(QVariantList)*>(data); break; + case QMetaType::QVariant: + stream << *static_cast<const NS(QVariant)*>(data); + break; #endif case QMetaType::QByteArray: stream << *static_cast<const NS(QByteArray)*>(data); @@ -837,6 +893,9 @@ bool QMetaType::load(QDataStream &stream, int type, void *data) case QMetaType::QVariantList: stream >> *static_cast< NS(QVariantList)*>(data); break; + case QMetaType::QVariant: + stream >> *static_cast< NS(QVariant)*>(data); + break; #endif case QMetaType::QByteArray: stream >> *static_cast< NS(QByteArray)*>(data); @@ -1004,6 +1063,8 @@ void *QMetaType::construct(int type, const void *copy) return new NS(QVariantHash)(*static_cast<const NS(QVariantHash)*>(copy)); case QMetaType::QVariantList: return new NS(QVariantList)(*static_cast<const NS(QVariantList)*>(copy)); + case QMetaType::QVariant: + return new NS(QVariant)(*static_cast<const NS(QVariant)*>(copy)); #endif case QMetaType::QByteArray: return new NS(QByteArray)(*static_cast<const NS(QByteArray)*>(copy)); @@ -1099,6 +1160,8 @@ void *QMetaType::construct(int type, const void *copy) return new NS(QVariantHash); case QMetaType::QVariantList: return new NS(QVariantList); + case QMetaType::QVariant: + return new NS(QVariant); #endif case QMetaType::QByteArray: return new NS(QByteArray); @@ -1240,6 +1303,9 @@ void QMetaType::destroy(int type, void *data) case QMetaType::QVariantList: delete static_cast< NS(QVariantList)* >(data); break; + case QMetaType::QVariant: + delete static_cast< NS(QVariant)* >(data); + break; #endif case QMetaType::QByteArray: delete static_cast< NS(QByteArray)* >(data); @@ -1349,6 +1415,11 @@ void QMetaType::destroy(int type, void *data) \snippet doc/src/snippets/code/src_corelib_kernel_qmetatype.cpp 4 + This function is usefull to register typedefs so they can be used + by QMetaProperty, or in QueuedConnections + + \snippet doc/src/snippets/code/src_corelib_kernel_qmetatype.cpp 9 + \sa qRegisterMetaTypeStreamOperators(), QMetaType::isRegistered(), Q_DECLARE_METATYPE() */ diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index 33126e8..2108b92 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -86,7 +86,8 @@ public: FirstCoreExtType = 128 /* VoidStar */, VoidStar = 128, Long = 129, Short = 130, Char = 131, ULong = 132, UShort = 133, UChar = 134, Float = 135, QObjectStar = 136, QWidgetStar = 137, - LastCoreExtType = QWidgetStar, + QVariant = 138, + LastCoreExtType = QVariant, // This logic must match the one in qglobal.h #if defined(QT_COORD_TYPE) @@ -113,6 +114,7 @@ public: #endif static int registerType(const char *typeName, Destructor destructor, Constructor constructor); + static int registerTypedef(const char *typeName, int aliasId); static int type(const char *typeName); static const char *typeName(int type); static bool isRegistered(int type); @@ -154,13 +156,31 @@ void qMetaTypeLoadHelper(QDataStream &stream, T *t) } #endif // QT_NO_DATASTREAM +template <typename T> struct QMetaTypeId2; + +namespace QtPrivate { + template <typename T, bool Defined = QMetaTypeId2<T>::Defined> + struct QMetaTypeIdHelper { + static inline int qt_metatype_id() + { return QMetaTypeId2<T>::qt_metatype_id(); } + }; + template <typename T> struct QMetaTypeIdHelper<T, false> { + static inline int qt_metatype_id() + { return -1; } + }; +} + template <typename T> int qRegisterMetaType(const char *typeName #ifndef qdoc - , T * /* dummy */ = 0 + , T * dummy = 0 #endif ) { + const int typedefOf = dummy ? -1 : QtPrivate::QMetaTypeIdHelper<T>::qt_metatype_id(); + if (typedefOf != -1) + return QMetaType::registerTypedef(typeName, typedefOf); + typedef void*(*ConstructPtr)(const T*); ConstructPtr cptr = qMetaTypeConstructHelper<T>; typedef void(*DeletePtr)(T*); @@ -254,7 +274,8 @@ inline int qRegisterMetaTypeStreamOperators() { \ static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \ if (!metatype_id) \ - metatype_id = qRegisterMetaType< TYPE >(#TYPE); \ + metatype_id = qRegisterMetaType< TYPE >(#TYPE, \ + reinterpret_cast< TYPE *>(quintptr(-1))); \ return metatype_id; \ } \ }; \ @@ -320,6 +341,7 @@ class QVector2D; class QVector3D; class QVector4D; class QQuaternion; +class QVariant; QT_END_NAMESPACE @@ -388,6 +410,7 @@ Q_DECLARE_BUILTIN_METATYPE(QVector2D, QVector2D) Q_DECLARE_BUILTIN_METATYPE(QVector3D, QVector3D) Q_DECLARE_BUILTIN_METATYPE(QVector4D, QVector4D) Q_DECLARE_BUILTIN_METATYPE(QQuaternion, QQuaternion) +Q_DECLARE_BUILTIN_METATYPE(QVariant, QVariant) QT_END_HEADER diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index 9628dbf..cb2825c 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -589,8 +589,7 @@ template<typename T> inline T qvariant_cast(const QVariant &v) template<> inline QVariant qvariant_cast<QVariant>(const QVariant &v) { - static const int vid = qRegisterMetaType<QVariant>("QVariant"); - if (vid == v.userType()) + if (v.userType() == QMetaType::QVariant) return *reinterpret_cast<const QVariant *>(v.constData()); return v; } diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index 724f3e0..21f308d 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -47,9 +47,6 @@ QT_BEGIN_HEADER -QT_BEGIN_NAMESPACE - -QT_MODULE(Core) #if defined(QT_NO_MAC_XARCH) || (defined(Q_OS_DARWIN) && (defined(__ppc__) || defined(__ppc64__))) // Disable MMX and SSE on Mac/PPC builds, or if the compiler @@ -103,6 +100,10 @@ QT_MODULE(Core) #include <mm3dnow.h> #endif +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + enum CPUFeatures { None = 0, MMX = 0x1, diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index 4951cb3..6e77abf 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -6,6 +6,7 @@ Flickable: renamed viewportHeight -> contentHeight Flickable: renamed viewportX -> contentX Flickable: renamed viewportY -> contentY Removed Flickable.reportedVelocitySmoothing +Removed Qt.playSound (replaced by SoundEffect element) Renamed MouseRegion -> MouseArea Connection: syntax and rename: Connection { sender: a; signal: foo(); script: xxx } diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 5b313be..463b238 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -52,8 +52,6 @@ QT_BEGIN_NAMESPACE -QHash<QObject*, QDeclarativeGridViewAttached*> QDeclarativeGridViewAttached::attachedProperties; - //---------------------------------------------------------------------------- @@ -61,8 +59,9 @@ class FxGridItem { public: FxGridItem(QDeclarativeItem *i, QDeclarativeGridView *v) : item(i), view(v) { - attached = QDeclarativeGridViewAttached::properties(item); - attached->m_view = view; + attached = static_cast<QDeclarativeGridViewAttached*>(qmlAttachedPropertiesObject<QDeclarativeGridView>(item)); + if (attached) + attached->m_view = view; } ~FxGridItem() {} @@ -697,6 +696,11 @@ void QDeclarativeGridViewPrivate::updateCurrent(int modelIndex) In this case ListModel is a handy way for us to test our UI. In practice the model would be implemented in C++, or perhaps via a SQL data source. + + Note that views do not enable \e clip automatically. If the view + is not clipped by another item or the screen, it will be necessary + to set \e {clip: true} in order to have the out of view items clipped + nicely. */ QDeclarativeGridView::QDeclarativeGridView(QDeclarativeItem *parent) : QDeclarativeFlickable(*(new QDeclarativeGridViewPrivate), parent) @@ -1336,6 +1340,18 @@ void QDeclarativeGridView::moveCurrentIndexRight() } } +/*! + \qmlmethod GridView::positionViewAtIndex(int index) + + Positions the view such that the \a index is at the top (or left for horizontal orientation) of the view. + If positioning the view at the index would cause empty space to be displayed at + the end of the view, the view will be positioned at the end. + + It is not recommended to use contentX or contentY to position the view + at a particular index. This is unreliable since removing items from the start + of the list does not cause all other items to be repositioned. + The correct way to bring an item into view is with positionViewAtIndex. +*/ void QDeclarativeGridView::positionViewAtIndex(int index) { Q_D(QDeclarativeGridView); @@ -1743,7 +1759,7 @@ void QDeclarativeGridView::refill() QDeclarativeGridViewAttached *QDeclarativeGridView::qmlAttachedProperties(QObject *obj) { - return QDeclarativeGridViewAttached::properties(obj); + return new QDeclarativeGridViewAttached(obj); } QT_END_NAMESPACE diff --git a/src/declarative/graphicsitems/qdeclarativegridview_p.h b/src/declarative/graphicsitems/qdeclarativegridview_p.h index d463a46..22fcef6 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview_p.h +++ b/src/declarative/graphicsitems/qdeclarativegridview_p.h @@ -167,9 +167,7 @@ class QDeclarativeGridViewAttached : public QObject public: QDeclarativeGridViewAttached(QObject *parent) : QObject(parent), m_isCurrent(false), m_delayRemove(false) {} - ~QDeclarativeGridViewAttached() { - attachedProperties.remove(parent()); - } + ~QDeclarativeGridViewAttached() {} Q_PROPERTY(QDeclarativeGridView *view READ view CONSTANT) QDeclarativeGridView *view() { return m_view; } @@ -192,15 +190,6 @@ public: } } - static QDeclarativeGridViewAttached *properties(QObject *obj) { - QDeclarativeGridViewAttached *rv = attachedProperties.value(obj); - if (!rv) { - rv = new QDeclarativeGridViewAttached(obj); - attachedProperties.insert(obj, rv); - } - return rv; - } - void emitAdd() { emit add(); } void emitRemove() { emit remove(); } @@ -212,10 +201,8 @@ Q_SIGNALS: public: QDeclarativeGridView *m_view; - bool m_isCurrent; - bool m_delayRemove; - - static QHash<QObject*, QDeclarativeGridViewAttached*> attachedProperties; + bool m_isCurrent : 1; + bool m_delayRemove : 1; }; diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index cb3f542..b0a7570 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -500,6 +500,32 @@ void QDeclarativeKeyNavigationAttached::setDown(QDeclarativeItem *i) emit changed(); } +QDeclarativeItem *QDeclarativeKeyNavigationAttached::tab() const +{ + Q_D(const QDeclarativeKeyNavigationAttached); + return d->tab; +} + +void QDeclarativeKeyNavigationAttached::setTab(QDeclarativeItem *i) +{ + Q_D(QDeclarativeKeyNavigationAttached); + d->tab = i; + emit changed(); +} + +QDeclarativeItem *QDeclarativeKeyNavigationAttached::backtab() const +{ + Q_D(const QDeclarativeKeyNavigationAttached); + return d->backtab; +} + +void QDeclarativeKeyNavigationAttached::setBacktab(QDeclarativeItem *i) +{ + Q_D(QDeclarativeKeyNavigationAttached); + d->backtab = i; + emit changed(); +} + void QDeclarativeKeyNavigationAttached::keyPressed(QKeyEvent *event) { Q_D(QDeclarativeKeyNavigationAttached); @@ -531,6 +557,18 @@ void QDeclarativeKeyNavigationAttached::keyPressed(QKeyEvent *event) event->accept(); } break; + case Qt::Key_Tab: + if (d->tab) { + d->tab->setFocus(true); + event->accept(); + } + break; + case Qt::Key_Backtab: + if (d->backtab) { + d->backtab->setFocus(true); + event->accept(); + } + break; default: break; } @@ -565,6 +603,16 @@ void QDeclarativeKeyNavigationAttached::keyReleased(QKeyEvent *event) event->accept(); } break; + case Qt::Key_Tab: + if (d->tab) { + event->accept(); + } + break; + case Qt::Key_Backtab: + if (d->backtab) { + event->accept(); + } + break; default: break; } @@ -904,6 +952,8 @@ const QDeclarativeKeysAttached::SigMap QDeclarativeKeysAttached::sigMap[] = { { Qt::Key_Right, "rightPressed" }, { Qt::Key_Up, "upPressed" }, { Qt::Key_Down, "downPressed" }, + { Qt::Key_Tab, "tabPressed" }, + { Qt::Key_Backtab, "backtabPressed" }, { Qt::Key_Asterisk, "asteriskPressed" }, { Qt::Key_NumberSign, "numberSignPressed" }, { Qt::Key_Escape, "escapePressed" }, @@ -1442,7 +1492,7 @@ QDeclarativeAnchors *QDeclarativeItem::anchors() void QDeclarativeItemPrivate::data_append(QDeclarativeListProperty<QObject> *prop, QObject *o) { QDeclarativeItem *i = qobject_cast<QDeclarativeItem *>(o); - if (i) + if (i) i->setParentItem(static_cast<QDeclarativeItem *>(prop->object)); else o->setParent(static_cast<QDeclarativeItem *>(prop->object)); @@ -1570,7 +1620,7 @@ void QDeclarativeItemPrivate::transform_clear(QDeclarativeListProperty<QGraphics */ /*! \internal */ -QDeclarativeListProperty<QObject> QDeclarativeItem::data() +QDeclarativeListProperty<QObject> QDeclarativeItem::data() { return QDeclarativeListProperty<QObject>(this, 0, QDeclarativeItemPrivate::data_append); } @@ -2233,16 +2283,16 @@ void QDeclarativeItem::focusChanged(bool flag) QDeclarativeListProperty<QDeclarativeItem> QDeclarativeItem::fxChildren() { return QDeclarativeListProperty<QDeclarativeItem>(this, 0, QDeclarativeItemPrivate::children_append, - QDeclarativeItemPrivate::children_count, - QDeclarativeItemPrivate::children_at); + QDeclarativeItemPrivate::children_count, + QDeclarativeItemPrivate::children_at); } /*! \internal */ QDeclarativeListProperty<QObject> QDeclarativeItem::resources() { - return QDeclarativeListProperty<QObject>(this, 0, QDeclarativeItemPrivate::resources_append, - QDeclarativeItemPrivate::resources_count, - QDeclarativeItemPrivate::resources_at); + return QDeclarativeListProperty<QObject>(this, 0, QDeclarativeItemPrivate::resources_append, + QDeclarativeItemPrivate::resources_count, + QDeclarativeItemPrivate::resources_at); } /*! @@ -2519,14 +2569,26 @@ QPointF QDeclarativeItemPrivate::computeTransformOrigin() const /*! \internal */ bool QDeclarativeItem::sceneEvent(QEvent *event) { - bool rv = QGraphicsItem::sceneEvent(event); + if (event->type() == QEvent::KeyPress) { + QKeyEvent *k = static_cast<QKeyEvent *>(event); - if (event->type() == QEvent::FocusIn || - event->type() == QEvent::FocusOut) { - focusChanged(hasFocus()); - } + if ((k->key() == Qt::Key_Tab || k->key() == Qt::Key_Backtab) && + !(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) { + keyPressEvent(static_cast<QKeyEvent *>(event)); + if (!event->isAccepted()) + QGraphicsItem::sceneEvent(event); + } else { + QGraphicsItem::sceneEvent(event); + } + } else { + bool rv = QGraphicsItem::sceneEvent(event); - return rv; + if (event->type() == QEvent::FocusIn || + event->type() == QEvent::FocusOut) { + focusChanged(hasFocus()); + } + return rv; + } } /*! \internal */ diff --git a/src/declarative/graphicsitems/qdeclarativeitem_p.h b/src/declarative/graphicsitems/qdeclarativeitem_p.h index 4b4917e..e424970 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem_p.h +++ b/src/declarative/graphicsitems/qdeclarativeitem_p.h @@ -289,12 +289,14 @@ class QDeclarativeKeyNavigationAttachedPrivate : public QObjectPrivate { public: QDeclarativeKeyNavigationAttachedPrivate() - : QObjectPrivate(), left(0), right(0), up(0), down(0) {} + : QObjectPrivate(), left(0), right(0), up(0), down(0), tab(0), backtab(0) {} QDeclarativeItem *left; QDeclarativeItem *right; QDeclarativeItem *up; QDeclarativeItem *down; + QDeclarativeItem *tab; + QDeclarativeItem *backtab; }; class QDeclarativeKeyNavigationAttached : public QObject, public QDeclarativeItemKeyFilter @@ -306,6 +308,9 @@ class QDeclarativeKeyNavigationAttached : public QObject, public QDeclarativeIte Q_PROPERTY(QDeclarativeItem *right READ right WRITE setRight NOTIFY changed) Q_PROPERTY(QDeclarativeItem *up READ up WRITE setUp NOTIFY changed) Q_PROPERTY(QDeclarativeItem *down READ down WRITE setDown NOTIFY changed) + Q_PROPERTY(QDeclarativeItem *tab READ tab WRITE setTab NOTIFY changed) + Q_PROPERTY(QDeclarativeItem *backtab READ backtab WRITE setBacktab NOTIFY changed) + public: QDeclarativeKeyNavigationAttached(QObject * = 0); @@ -317,6 +322,10 @@ public: void setUp(QDeclarativeItem *); QDeclarativeItem *down() const; void setDown(QDeclarativeItem *); + QDeclarativeItem *tab() const; + void setTab(QDeclarativeItem *); + QDeclarativeItem *backtab() const; + void setBacktab(QDeclarativeItem *); static QDeclarativeKeyNavigationAttached *qmlAttachedProperties(QObject *); @@ -407,6 +416,8 @@ Q_SIGNALS: void rightPressed(QDeclarativeKeyEvent *event); void upPressed(QDeclarativeKeyEvent *event); void downPressed(QDeclarativeKeyEvent *event); + void tabPressed(QDeclarativeKeyEvent *event); + void backtabPressed(QDeclarativeKeyEvent *event); void asteriskPressed(QDeclarativeKeyEvent *event); void numberSignPressed(QDeclarativeKeyEvent *event); diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp index e0ae2eb..25660f8 100644 --- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp @@ -106,7 +106,6 @@ void QDeclarativeItemModule::defineModule() QML_REGISTER_TYPE(Qt,4,6,LayoutItem,QDeclarativeLayoutItem); QML_REGISTER_TYPE(Qt,4,6,ListView,QDeclarativeListView); QML_REGISTER_TYPE(Qt,4,6,Loader,QDeclarativeLoader); - QML_REGISTER_TYPE(Qt,4,6,MouseRegion,QDeclarativeMouseArea); QML_REGISTER_TYPE(Qt,4,6,MouseArea,QDeclarativeMouseArea); QML_REGISTER_TYPE(Qt,4,6,Opacity,QGraphicsOpacityEffect); QML_REGISTER_TYPE(Qt,4,6,ParticleMotion,QDeclarativeParticleMotion); diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index eb5315d..cd8d143 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -223,7 +223,7 @@ public: if (!visibleItems.isEmpty()) { pos = (*visibleItems.constBegin())->position(); if (visibleIndex > 0) - pos -= visibleIndex * (averageSize + spacing) - spacing; + pos -= visibleIndex * (averageSize + spacing); } return pos; } @@ -799,10 +799,13 @@ void QDeclarativeListViewPrivate::createHighlight() if (item) { item->setParent(q->viewport()); highlight = new FxListItem(item, q); - if (orient == QDeclarativeListView::Vertical) - highlight->item->setHeight(currentItem->item->height()); - else - highlight->item->setWidth(currentItem->item->width()); + if (currentItem && autoHighlight) { + if (orient == QDeclarativeListView::Vertical) { + highlight->item->setHeight(currentItem->item->height()); + } else { + highlight->item->setWidth(currentItem->item->width()); + } + } const QLatin1String posProp(orient == QDeclarativeListView::Vertical ? "y" : "x"); highlightPosAnimator = new QDeclarativeEaseFollow(q); highlightPosAnimator->setTarget(QDeclarativeProperty(highlight->item, posProp)); @@ -1359,6 +1362,11 @@ void QDeclarativeListViewPrivate::flickY(qreal velocity) In this case ListModel is a handy way for us to test our UI. In practice the model would be implemented in C++, or perhaps via a SQL data source. + + Note that views do not enable \e clip automatically. If the view + is not clipped by another item or the screen, it will be necessary + to set \e {clip: true} in order to have the out of view items clipped + nicely. */ QDeclarativeListView::QDeclarativeListView(QDeclarativeItem *parent) @@ -2281,6 +2289,12 @@ void QDeclarativeListView::decrementCurrentIndex() Positions the view such that the \a index is at the top (or left for horizontal orientation) of the view. If positioning the view at the index would cause empty space to be displayed at the end of the view, the view will be positioned at the end. + + It is not recommended to use contentX or contentY to position the view + at a particular index. This is unreliable since removing items from the start + of the list does not cause all other items to be repositioned, and because + the actual start of the view can vary based on the size of the delegates. + The correct way to bring an item into view is with positionViewAtIndex. */ void QDeclarativeListView::positionViewAtIndex(int index) { @@ -2403,7 +2417,8 @@ void QDeclarativeListView::itemsInserted(int modelIndex, int count) int i = d->visibleItems.count() - 1; while (i > 0 && d->visibleItems.at(i)->index == -1) --i; - if (d->visibleItems.at(i)->index + 1 == modelIndex) { + if (d->visibleItems.at(i)->index + 1 == modelIndex + && d->visibleItems.at(i)->endPosition() < d->buffer+d->position()+d->size()-1) { // Special case of appending an item to the model. modelIndex = d->visibleIndex + d->visibleItems.count(); } else { diff --git a/src/declarative/graphicsitems/qdeclarativeparticles.cpp b/src/declarative/graphicsitems/qdeclarativeparticles.cpp index 1a58d3f..deabdd6 100644 --- a/src/declarative/graphicsitems/qdeclarativeparticles.cpp +++ b/src/declarative/graphicsitems/qdeclarativeparticles.cpp @@ -1260,7 +1260,11 @@ void QDeclarativeParticlesPainter::paint(QPainter *p, const QStyleOptionGraphics const int myX = x() + parentItem()->x(); const int myY = y() + parentItem()->y(); +#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0)) QVarLengthArray<QPainter::Fragment, 256> pixmapData; +#else + QVarLengthArray<QDrawPixmaps::Data, 256> pixmapData; +#endif pixmapData.resize(d->particles.count()); const QRectF sourceRect = d->image.rect(); @@ -1268,20 +1272,32 @@ void QDeclarativeParticlesPainter::paint(QPainter *p, const QStyleOptionGraphics qreal halfPHeight = sourceRect.height()/2.; for (int i = 0; i < d->particles.count(); ++i) { const QDeclarativeParticle &particle = d->particles.at(i); +#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0)) pixmapData[i].x = particle.x - myX + halfPWidth; pixmapData[i].y = particle.y - myY + halfPHeight; +#else + pixmapData[i].point = QPointF(particle.x - myX + halfPWidth, particle.y - myY + halfPHeight); +#endif pixmapData[i].opacity = particle.opacity; //these never change pixmapData[i].rotation = 0; pixmapData[i].scaleX = 1; pixmapData[i].scaleY = 1; +#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0)) pixmapData[i].sourceLeft = sourceRect.left(); pixmapData[i].sourceTop = sourceRect.top(); pixmapData[i].width = sourceRect.width(); pixmapData[i].height = sourceRect.height(); +#else + pixmapData[i].source = sourceRect; +#endif } +#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0)) p->drawPixmapFragments(pixmapData.data(), d->particles.count(), d->image); +#else + qDrawPixmaps(p, pixmapData.data(), d->particles.count(), d->image); +#endif } void QDeclarativeParticles::componentComplete() diff --git a/src/declarative/qml/parser/qdeclarativejs.g b/src/declarative/qml/parser/qdeclarativejs.g index 7cf81b2..493ad25 100644 --- a/src/declarative/qml/parser/qdeclarativejs.g +++ b/src/declarative/qml/parser/qdeclarativejs.g @@ -1020,7 +1020,7 @@ case $rule_number: { JsIdentifier: T_ON ; /. case $rule_number: { - QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_READONLY]); + QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_ON]); sym(1).sval = driver->intern(s.constData(), s.length()); break; } diff --git a/src/declarative/qml/parser/qdeclarativejsgrammar.cpp b/src/declarative/qml/parser/qdeclarativejsgrammar.cpp index 0677bc5..89493ff 100644 --- a/src/declarative/qml/parser/qdeclarativejsgrammar.cpp +++ b/src/declarative/qml/parser/qdeclarativejsgrammar.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtDeclarative module of the Qt Toolkit. +** This file is part of the QtCore module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/declarative/qml/parser/qdeclarativejsgrammar_p.h b/src/declarative/qml/parser/qdeclarativejsgrammar_p.h index 2b2e3d1..32bb12b 100644 --- a/src/declarative/qml/parser/qdeclarativejsgrammar_p.h +++ b/src/declarative/qml/parser/qdeclarativejsgrammar_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtDeclarative module of the Qt Toolkit. +** This file is part of the QtCore module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE class QDeclarativeJSGrammar { public: - enum { + enum VariousConstants { EOF_SYMBOL = 0, REDUCE_HERE = 100, SHIFT_THERE = 99, diff --git a/src/declarative/qml/parser/qdeclarativejsparser.cpp b/src/declarative/qml/parser/qdeclarativejsparser.cpp index fd9e690..c86e047 100644 --- a/src/declarative/qml/parser/qdeclarativejsparser.cpp +++ b/src/declarative/qml/parser/qdeclarativejsparser.cpp @@ -516,7 +516,7 @@ case 66: { } case 67: { - QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_READONLY]); + QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_ON]); sym(1).sval = driver->intern(s.constData(), s.length()); break; } diff --git a/src/declarative/qml/qdeclarativebinding_p.h b/src/declarative/qml/qdeclarativebinding_p.h index ec5809d..1a714f0 100644 --- a/src/declarative/qml/qdeclarativebinding_p.h +++ b/src/declarative/qml/qdeclarativebinding_p.h @@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE -class Q_AUTOTEST_EXPORT QDeclarativeAbstractBinding +class Q_DECLARATIVE_EXPORT QDeclarativeAbstractBinding { public: QDeclarativeAbstractBinding(); @@ -101,7 +101,7 @@ private: class QDeclarativeContext; class QDeclarativeBindingPrivate; -class Q_AUTOTEST_EXPORT QDeclarativeBinding : public QDeclarativeExpression, public QDeclarativeAbstractBinding +class Q_DECLARATIVE_EXPORT QDeclarativeBinding : public QDeclarativeExpression, public QDeclarativeAbstractBinding { Q_OBJECT public: diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 1eea012..3c6c949 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -561,9 +561,11 @@ bool QDeclarativeCompiler::compile(QDeclarativeEngine *engine, QDeclarativeCompositeTypeData::TypeReference &tref = unit->types[ii]; QDeclarativeCompiledData::TypeReference ref; QDeclarativeScriptParser::TypeReference *parserRef = unit->data.referencedTypes().at(ii); - if (tref.type) + if (tref.type) { ref.type = tref.type; - else if (tref.unit) { + if (!ref.type->isCreatable()) + COMPILE_EXCEPTION(parserRef->refObjects.first(), QCoreApplication::translate("QDeclarativeCompiler", "Element is not creatable.")); + } else if (tref.unit) { ref.component = tref.unit->toComponent(engine); if (ref.component->isError()) { @@ -983,12 +985,15 @@ void QDeclarativeCompiler::genObjectBody(QDeclarativeParser::Object *obj) } else if (v->type == Value::SignalExpression) { + BindingContext ctxt = compileState.signalExpressions.value(v); + QDeclarativeInstruction store; store.type = QDeclarativeInstruction::StoreSignal; store.line = v->location.start.line; store.storeSignal.signalIndex = prop->index; store.storeSignal.value = output->indexForString(v->value.asScript().trimmed()); + store.storeSignal.context = ctxt.stack; output->bytecode << store; } @@ -1321,7 +1326,7 @@ QMetaMethod QDeclarativeCompiler::findSignalByName(const QMetaObject *mo, const } bool QDeclarativeCompiler::buildSignal(QDeclarativeParser::Property *prop, QDeclarativeParser::Object *obj, - const BindingContext &ctxt) + const BindingContext &ctxt) { Q_ASSERT(obj->metaObject()); Q_ASSERT(!prop->isEmpty()); @@ -1342,7 +1347,7 @@ bool QDeclarativeCompiler::buildSignal(QDeclarativeParser::Property *prop, QDecl } else { - if (prop->value || prop->values.count() > 1) + if (prop->value || prop->values.count() != 1) COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Incorrectly specified signal")); prop->index = sigIdx; @@ -1357,6 +1362,8 @@ bool QDeclarativeCompiler::buildSignal(QDeclarativeParser::Property *prop, QDecl QString script = prop->values.at(0)->value.asScript().trimmed(); if (script.isEmpty()) COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Empty signal assignment")); + + compileState.signalExpressions.insert(prop->values.at(0), ctxt); } } @@ -1789,13 +1796,19 @@ bool QDeclarativeCompiler::buildGroupedProperty(QDeclarativeParser::Property *pr Q_ASSERT(prop->type != 0); Q_ASSERT(prop->index != -1); - if (prop->values.count()) - COMPILE_EXCEPTION(prop->values.first(), QCoreApplication::translate("QDeclarativeCompiler", "Invalid value in grouped property")); - - if (prop->type < (int)QVariant::UserType) { + if (QDeclarativeValueTypeFactory::isValueType(prop->type)) { QDeclarativeEnginePrivate *ep = static_cast<QDeclarativeEnginePrivate *>(QObjectPrivate::get(engine)); if (prop->type >= 0 /* QVariant == -1 */ && ep->valueTypes[prop->type]) { + + if (prop->values.count()) { + if (prop->values.at(0)->location < prop->value->location) { + COMPILE_EXCEPTION(prop->value, QCoreApplication::translate("QDeclarativeCompiler", "Property has already been assigned a value")); + } else { + COMPILE_EXCEPTION(prop->values.at(0), QCoreApplication::translate("QDeclarativeCompiler", "Property has already been assigned a value")); + } + } + COMPILE_CHECK(buildValueTypeProperty(ep->valueTypes[prop->type], prop->value, obj, ctxt.incr())); obj->addValueTypeProperty(prop); @@ -1810,6 +1823,9 @@ bool QDeclarativeCompiler::buildGroupedProperty(QDeclarativeParser::Property *pr if (!prop->value->metatype) COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Invalid grouped property access")); + if (prop->values.count()) + COMPILE_EXCEPTION(prop->values.at(0), QCoreApplication::translate("QDeclarativeCompiler", "Cannot assign a value directly to a grouped property")); + obj->addGroupedProperty(prop); COMPILE_CHECK(buildSubObject(prop->value, ctxt.incr())); @@ -2599,9 +2615,9 @@ bool QDeclarativeCompiler::buildBinding(QDeclarativeParser::Value *value, } void QDeclarativeCompiler::genBindingAssignment(QDeclarativeParser::Value *binding, - QDeclarativeParser::Property *prop, - QDeclarativeParser::Object *obj, - QDeclarativeParser::Property *valueTypeProperty) + QDeclarativeParser::Property *prop, + QDeclarativeParser::Object *obj, + QDeclarativeParser::Property *valueTypeProperty) { Q_UNUSED(obj); Q_ASSERT(compileState.bindings.contains(binding)); diff --git a/src/declarative/qml/qdeclarativecompiler_p.h b/src/declarative/qml/qdeclarativecompiler_p.h index f8ada95..cca42e2 100644 --- a/src/declarative/qml/qdeclarativecompiler_p.h +++ b/src/declarative/qml/qdeclarativecompiler_p.h @@ -307,6 +307,7 @@ private: QByteArray compiledBindingData; QHash<QDeclarativeParser::Value *, BindingReference> bindings; + QHash<QDeclarativeParser::Value *, BindingContext> signalExpressions; QList<QDeclarativeParser::Object *> aliasingObjects; QDeclarativeParser::Object *root; }; diff --git a/src/declarative/qml/qdeclarativecontext.cpp b/src/declarative/qml/qdeclarativecontext.cpp index 35e7a77..f70e143 100644 --- a/src/declarative/qml/qdeclarativecontext.cpp +++ b/src/declarative/qml/qdeclarativecontext.cpp @@ -484,7 +484,10 @@ QVariant QDeclarativeContext::contextProperty(const QString &name) const if (!value.isValid() && parentContext()) value = parentContext()->contextProperty(name); } else { - value = d->propertyValues[idx]; + if (idx >= d->propertyValues.count()) + value = QVariant::fromValue(d->idValues[idx - d->propertyValues.count()].data()); + else + value = d->propertyValues[idx]; } return value; diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index ecaea61..1e60df4 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -167,6 +167,7 @@ QDeclarativeEnginePrivate::QDeclarativeEnginePrivate(QDeclarativeEngine *e) QDeclarativeItemModule::defineModule(); QDeclarativeUtilModule::defineModule(); QDeclarativeEnginePrivate::defineModule(); + QDeclarativeValueTypeFactory::registerValueTypes(); } globalClass = new QDeclarativeGlobalScriptClass(&scriptEngine); @@ -236,9 +237,13 @@ QDeclarativeScriptEngine::QDeclarativeScriptEngine(QDeclarativeEnginePrivate *pr qtObject.setProperty(QLatin1String("tint"), newFunction(QDeclarativeEnginePrivate::tint, 2)); } + //date/time formatting + qtObject.setProperty(QLatin1String("formatDate"),newFunction(QDeclarativeEnginePrivate::formatDate, 2)); + qtObject.setProperty(QLatin1String("formatTime"),newFunction(QDeclarativeEnginePrivate::formatTime, 2)); + qtObject.setProperty(QLatin1String("formatDateTime"),newFunction(QDeclarativeEnginePrivate::formatDateTime, 2)); + //misc methods qtObject.setProperty(QLatin1String("closestAngle"), newFunction(QDeclarativeEnginePrivate::closestAngle, 2)); - qtObject.setProperty(QLatin1String("playSound"), newFunction(QDeclarativeEnginePrivate::playSound, 1)); qtObject.setProperty(QLatin1String("openUrlExternally"),newFunction(QDeclarativeEnginePrivate::desktopOpenUrl, 1)); qtObject.setProperty(QLatin1String("md5"),newFunction(QDeclarativeEnginePrivate::md5, 1)); qtObject.setProperty(QLatin1String("btoa"),newFunction(QDeclarativeEnginePrivate::btoa, 1)); @@ -936,6 +941,66 @@ QScriptValue QDeclarativeEnginePrivate::vector(QScriptContext *ctxt, QScriptEngi return engine->newVariant(qVariantFromValue(QVector3D(x, y, z))); } +QScriptValue QDeclarativeEnginePrivate::formatDate(QScriptContext*ctxt, QScriptEngine*engine) +{ + int argCount = ctxt->argumentCount(); + if(argCount == 0 || argCount > 2) + return engine->nullValue(); + + QDate date = ctxt->argument(0).toDateTime().date(); + Qt::DateFormat enumFormat = Qt::DefaultLocaleShortDate; + if (argCount == 2) { + if (ctxt->argument(1).isString()) { + QString format = ctxt->argument(1).toString(); + return engine->newVariant(qVariantFromValue(date.toString(format))); + } else if (ctxt->argument(1).isNumber()) { + enumFormat = Qt::DateFormat(ctxt->argument(1).toUInt32()); + } else + return engine->nullValue(); + } + return engine->newVariant(qVariantFromValue(date.toString(enumFormat))); +} + +QScriptValue QDeclarativeEnginePrivate::formatTime(QScriptContext*ctxt, QScriptEngine*engine) +{ + int argCount = ctxt->argumentCount(); + if(argCount == 0 || argCount > 2) + return engine->nullValue(); + + QTime date = ctxt->argument(0).toDateTime().time(); + Qt::DateFormat enumFormat = Qt::DefaultLocaleShortDate; + if (argCount == 2) { + if (ctxt->argument(1).isString()) { + QString format = ctxt->argument(1).toString(); + return engine->newVariant(qVariantFromValue(date.toString(format))); + } else if (ctxt->argument(1).isNumber()) { + enumFormat = Qt::DateFormat(ctxt->argument(1).toUInt32()); + } else + return engine->nullValue(); + } + return engine->newVariant(qVariantFromValue(date.toString(enumFormat))); +} + +QScriptValue QDeclarativeEnginePrivate::formatDateTime(QScriptContext*ctxt, QScriptEngine*engine) +{ + int argCount = ctxt->argumentCount(); + if(argCount == 0 || argCount > 2) + return engine->nullValue(); + + QDateTime date = ctxt->argument(0).toDateTime(); + Qt::DateFormat enumFormat = Qt::DefaultLocaleShortDate; + if (argCount == 2) { + if (ctxt->argument(1).isString()) { + QString format = ctxt->argument(1).toString(); + return engine->newVariant(qVariantFromValue(date.toString(format))); + } else if (ctxt->argument(1).isNumber()) { + enumFormat = Qt::DateFormat(ctxt->argument(1).toUInt32()); + } else + return engine->nullValue(); + } + return engine->newVariant(qVariantFromValue(date.toString(enumFormat))); +} + QScriptValue QDeclarativeEnginePrivate::rgba(QScriptContext *ctxt, QScriptEngine *engine) { int argCount = ctxt->argumentCount(); @@ -1040,30 +1105,6 @@ QScriptValue QDeclarativeEnginePrivate::darker(QScriptContext *ctxt, QScriptEngi return qScriptValueFromValue(engine, qVariantFromValue(color)); } -QScriptValue QDeclarativeEnginePrivate::playSound(QScriptContext *ctxt, QScriptEngine *engine) -{ - if (ctxt->argumentCount() != 1) - return engine->undefinedValue(); - - QUrl url(ctxt->argument(0).toString()); - - QDeclarativeEnginePrivate *enginePriv = QDeclarativeEnginePrivate::get(engine); - if (url.isRelative()) { - QDeclarativeContext *context = enginePriv->getContext(ctxt); - if (!context) - return engine->undefinedValue(); - - url = context->resolvedUrl(url); - } - - if (url.scheme() == QLatin1String("file")) { - - QSound::play(url.toLocalFile()); - - } - return engine->undefinedValue(); -} - QScriptValue QDeclarativeEnginePrivate::desktopOpenUrl(QScriptContext *ctxt, QScriptEngine *e) { if(ctxt->argumentCount() < 1) @@ -1383,7 +1424,11 @@ public: paths += QFileInfo(base.toLocalFile()).path(); paths += importPath; paths += QDeclarativeEnginePrivate::get(engine)->environmentImportPath; +#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0)) QString builtinPath = QLibraryInfo::location(QLibraryInfo::ImportsPath); +#else + QString builtinPath; +#endif if (!builtinPath.isEmpty()) paths += builtinPath; diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h index d3eb583..459a325 100644 --- a/src/declarative/qml/qdeclarativeengine_p.h +++ b/src/declarative/qml/qdeclarativeengine_p.h @@ -319,7 +319,6 @@ public: static QScriptValue tint(QScriptContext*, QScriptEngine*); static QScriptValue closestAngle(QScriptContext*, QScriptEngine*); - static QScriptValue playSound(QScriptContext*, QScriptEngine*); static QScriptValue desktopOpenUrl(QScriptContext*, QScriptEngine*); static QScriptValue md5(QScriptContext*, QScriptEngine*); static QScriptValue btoa(QScriptContext*, QScriptEngine*); @@ -327,6 +326,10 @@ public: static QScriptValue consoleLog(QScriptContext*, QScriptEngine*); static QScriptValue quit(QScriptContext*, QScriptEngine*); + static QScriptValue formatDate(QScriptContext*, QScriptEngine*); + static QScriptValue formatTime(QScriptContext*, QScriptEngine*); + static QScriptValue formatDateTime(QScriptContext*, QScriptEngine*); + static QScriptEngine *getScriptEngine(QDeclarativeEngine *e) { return &e->d_func()->scriptEngine; } static QDeclarativeEngine *getEngine(QScriptEngine *e) { return static_cast<QDeclarativeScriptEngine*>(e)->p->q_func(); } static QDeclarativeEnginePrivate *get(QDeclarativeEngine *e) { return e->d_func(); } diff --git a/src/declarative/qml/qdeclarativeenginedebug.cpp b/src/declarative/qml/qdeclarativeenginedebug.cpp index 09882cb..3e4acbe 100644 --- a/src/declarative/qml/qdeclarativeenginedebug.cpp +++ b/src/declarative/qml/qdeclarativeenginedebug.cpp @@ -117,7 +117,7 @@ QDeclarativeEngineDebugServer::propertyData(QObject *obj, int propIdx) QVariant value = prop.read(obj); rv.value = valueContents(value); - if (QVariant::Type(prop.userType()) < QVariant::UserType) { + if (QDeclarativeValueTypeFactory::isValueType(prop.userType())) { rv.type = QDeclarativeObjectProperty::Basic; } else if (QDeclarativeMetaType::isQObject(prop.userType())) { rv.type = QDeclarativeObjectProperty::Object; @@ -131,7 +131,7 @@ QDeclarativeEngineDebugServer::propertyData(QObject *obj, int propIdx) QVariant QDeclarativeEngineDebugServer::valueContents(const QVariant &value) const { int userType = value.userType(); - if (QVariant::Type(userType) < QVariant::UserType) + if (QDeclarativeValueTypeFactory::isValueType(userType)) return value; /* diff --git a/src/declarative/qml/qdeclarativeinstruction_p.h b/src/declarative/qml/qdeclarativeinstruction_p.h index d8af6a7..ec32b35 100644 --- a/src/declarative/qml/qdeclarativeinstruction_p.h +++ b/src/declarative/qml/qdeclarativeinstruction_p.h @@ -161,154 +161,180 @@ public: Type type; unsigned short line; + + struct InitInstruction { + int bindingsSize; + int parserStatusSize; + int contextCache; + int compiledBinding; + }; + struct CreateInstruction { + int type; + int data; + int bindingBits; + ushort column; + }; + struct StoreMetaInstruction { + int data; + int aliasData; + int propertyCache; + }; + struct SetIdInstruction { + int value; + int index; + }; + struct AssignValueSourceInstruction { + int property; + int owner; + int castValue; + }; + struct AssignValueInterceptorInstruction { + int property; + int owner; + int castValue; + }; + struct AssignBindingInstruction { + unsigned int property; + int value; + short context; + short owner; + }; + struct FetchInstruction { + int property; + }; + struct FetchValueInstruction { + int property; + int type; + }; + struct FetchQmlListInstruction { + int property; + int type; + }; + struct BeginInstruction { + int castValue; + }; + struct StoreFloatInstruction { + int propertyIndex; + float value; + }; + struct StoreDoubleInstruction { + int propertyIndex; + double value; + }; + struct StoreIntegerInstruction { + int propertyIndex; + int value; + }; + struct StoreBoolInstruction { + int propertyIndex; + bool value; + }; + struct StoreStringInstruction { + int propertyIndex; + int value; + }; + struct StoreScriptStringInstruction { + int propertyIndex; + int value; + int scope; + }; + struct StoreScriptInstruction { + int value; + }; + struct StoreUrlInstruction { + int propertyIndex; + int value; + }; + struct StoreColorInstruction { + int propertyIndex; + unsigned int value; + }; + struct StoreDateInstruction { + int propertyIndex; + int value; + }; + struct StoreTimeInstruction { + int propertyIndex; + int valueIndex; + }; + struct StoreDateTimeInstruction { + int propertyIndex; + int valueIndex; + }; + struct StoreRealPairInstruction { + int propertyIndex; + int valueIndex; + }; + struct StoreRectInstruction { + int propertyIndex; + int valueIndex; + }; + struct StoreVector3DInstruction { + int propertyIndex; + int valueIndex; + }; + struct StoreObjectInstruction { + int propertyIndex; + }; + struct AssignCustomTypeInstruction { + int propertyIndex; + int valueIndex; + }; + struct StoreSignalInstruction { + int signalIndex; + int value; + int context; + }; + struct AssignSignalObjectInstruction { + int signal; + }; + struct CreateComponentInstruction { + int count; + ushort column; + int endLine; + int metaObject; + }; + struct FetchAttachedInstruction { + int id; + }; + struct DeferInstruction { + int deferCount; + }; + union { - struct { - int bindingsSize; - int parserStatusSize; - int contextCache; - int compiledBinding; - } init; - struct { - int type; - int data; - int bindingBits; - ushort column; - } create; - struct { - int data; - int aliasData; - int propertyCache; - } storeMeta; - struct { - int value; - int index; - } setId; - struct { - int property; - int owner; - int castValue; - } assignValueSource; - struct { - int property; - int owner; - int castValue; - } assignValueInterceptor; - struct { - unsigned int property; - int value; - short context; - short owner; - } assignBinding; - struct { - int property; - int id; - } assignIdOptBinding; - struct { - int property; - int contextIdx; - short context; - short notifyIdx; - } assignObjPropBinding; - struct { - int property; - } fetch; - struct { - int property; - int type; - } fetchValue; - struct { - int property; - int type; - } fetchQmlList; - struct { - int castValue; - } begin; - struct { - int propertyIndex; - float value; - } storeFloat; - struct { - int propertyIndex; - double value; - } storeDouble; - struct { - int propertyIndex; - int value; - } storeInteger; - struct { - int propertyIndex; - bool value; - } storeBool; - struct { - int propertyIndex; - int value; - } storeString; - struct { - int propertyIndex; - int value; - int scope; - } storeScriptString; - struct { - int value; - } storeScript; - struct { - int propertyIndex; - int value; - } storeUrl; - struct { - int propertyIndex; - unsigned int value; - } storeColor; - struct { - int propertyIndex; - int value; - } storeDate; - struct { - int propertyIndex; - int valueIndex; - } storeTime; - struct { - int propertyIndex; - int valueIndex; - } storeDateTime; - struct { - int propertyIndex; - int valueIndex; - } storeRealPair; - struct { - int propertyIndex; - int valueIndex; - } storeRect; - struct { - int propertyIndex; - int valueIndex; - } storeVector3D; - struct { - int propertyIndex; - } storeObject; - struct { - int propertyIndex; - int valueIndex; - } assignCustomType; - struct { - int signalIndex; - int value; - } storeSignal; - struct { - int signal; - } assignSignalObject; - struct { - int count; - ushort column; - int endLine; - int metaObject; - } createComponent; - struct { - int id; - } fetchAttached; - struct { - int deferCount; - } defer; + InitInstruction init; + CreateInstruction create; + StoreMetaInstruction storeMeta; + SetIdInstruction setId; + AssignValueSourceInstruction assignValueSource; + AssignValueInterceptorInstruction assignValueInterceptor; + AssignBindingInstruction assignBinding; + FetchInstruction fetch; + FetchValueInstruction fetchValue; + FetchQmlListInstruction fetchQmlList; + BeginInstruction begin; + StoreFloatInstruction storeFloat; + StoreDoubleInstruction storeDouble; + StoreIntegerInstruction storeInteger; + StoreBoolInstruction storeBool; + StoreStringInstruction storeString; + StoreScriptStringInstruction storeScriptString; + StoreScriptInstruction storeScript; + StoreUrlInstruction storeUrl; + StoreColorInstruction storeColor; + StoreDateInstruction storeDate; + StoreTimeInstruction storeTime; + StoreDateTimeInstruction storeDateTime; + StoreRealPairInstruction storeRealPair; + StoreRectInstruction storeRect; + StoreVector3DInstruction storeVector3D; + StoreObjectInstruction storeObject; + AssignCustomTypeInstruction assignCustomType; + StoreSignalInstruction storeSignal; + AssignSignalObjectInstruction assignSignalObject; + CreateComponentInstruction createComponent; + FetchAttachedInstruction fetchAttached; + DeferInstruction defer; }; void dump(QDeclarativeCompiledData *); diff --git a/src/declarative/qml/qdeclarativemetatype.cpp b/src/declarative/qml/qdeclarativemetatype.cpp index abbb9d6..50ab56b 100644 --- a/src/declarative/qml/qdeclarativemetatype.cpp +++ b/src/declarative/qml/qdeclarativemetatype.cpp @@ -286,6 +286,11 @@ QDeclarativeCustomParser *QDeclarativeType::customParser() const return d->m_customParser; } +bool QDeclarativeType::isCreatable() const +{ + return d->m_newFunc != 0; +} + bool QDeclarativeType::isInterface() const { return d->m_isInterface; @@ -402,7 +407,7 @@ int QDeclarativePrivate::registerType(const QDeclarativePrivate::RegisterType &t data->types.append(dtype); data->idToType.insert(dtype->typeId(), dtype); - data->idToType.insert(dtype->qListTypeId(), dtype); + if (dtype->qListTypeId()) data->idToType.insert(dtype->qListTypeId(), dtype); if (!dtype->qmlTypeName().isEmpty()) data->nameToType.insertMulti(dtype->qmlTypeName(), dtype); @@ -414,7 +419,7 @@ int QDeclarativePrivate::registerType(const QDeclarativePrivate::RegisterType &t if (data->lists.size() <= type.listId) data->lists.resize(type.listId + 16); data->objects.setBit(type.typeId, true); - data->lists.setBit(type.listId, true); + if (type.listId) data->lists.setBit(type.listId, true); return index; } diff --git a/src/declarative/qml/qdeclarativemetatype_p.h b/src/declarative/qml/qdeclarativemetatype_p.h index ec5c045..cf8946d 100644 --- a/src/declarative/qml/qdeclarativemetatype_p.h +++ b/src/declarative/qml/qdeclarativemetatype_p.h @@ -114,6 +114,8 @@ public: QDeclarativeCustomParser *customParser() const; + bool isCreatable() const; + bool isInterface() const; int typeId() const; int qListTypeId() const; diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp index 542f417..2e4ffa7 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp @@ -232,7 +232,7 @@ QDeclarativeObjectScriptClass::property(QObject *obj, const Identifier &name) QDeclarativeEnginePrivate::CapturedProperty(obj, lastData->coreIndex, lastData->notifyIndex); } - if ((uint)lastData->propType < QVariant::UserType) { + if (QDeclarativeValueTypeFactory::isValueType((uint)lastData->propType)) { QDeclarativeValueType *valueType = enginePriv->valueTypes[lastData->propType]; if (valueType) return Value(scriptEngine, enginePriv->valueTypeClass->newObject(obj, lastData->coreIndex, valueType)); diff --git a/src/declarative/qml/qdeclarativeparser.cpp b/src/declarative/qml/qdeclarativeparser.cpp index 0e3d856..b0599ad 100644 --- a/src/declarative/qml/qdeclarativeparser.cpp +++ b/src/declarative/qml/qdeclarativeparser.cpp @@ -226,9 +226,9 @@ QDeclarativeParser::Property::~Property() if (value) value->release(); } -Object *QDeclarativeParser::Property::getValue() +Object *QDeclarativeParser::Property::getValue(const LocationSpan &l) { - if (!value) value = new Object; + if (!value) { value = new Object; value->location = l; } return value; } diff --git a/src/declarative/qml/qdeclarativeparser_p.h b/src/declarative/qml/qdeclarativeparser_p.h index d0d7de1..5bf4b68 100644 --- a/src/declarative/qml/qdeclarativeparser_p.h +++ b/src/declarative/qml/qdeclarativeparser_p.h @@ -104,6 +104,11 @@ namespace QDeclarativeParser Location start; Location end; LocationRange range; + + bool operator<(LocationSpan &o) const { + return (start.line < o.start.line) || + (start.line == o.start.line && start.column < o.start.column); + } }; class Property; @@ -318,7 +323,7 @@ namespace QDeclarativeParser // The Object to which this property is attached Object *parent; - Object *getValue(); + Object *getValue(const LocationSpan &); void addValue(Value *v); void addOnValue(Value *v); diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp index 521c241..4f73b89 100644 --- a/src/declarative/qml/qdeclarativeproperty.cpp +++ b/src/declarative/qml/qdeclarativeproperty.cpp @@ -238,10 +238,10 @@ void QDeclarativePropertyPrivate::initProperty(QObject *obj, const QString &name if (property->flags & QDeclarativePropertyCache::Data::IsFunction) return; // Not an object property - if (ii == (path.count() - 2) && property->propType < (int)QVariant::UserType) { + if (ii == (path.count() - 2) && QDeclarativeValueTypeFactory::isValueType(property->propType)) { // We're now at a value type property. We can use a global valuetypes array as we // never actually use the objects, just look up their properties. - QObject *typeObject = qmlValueTypes()->valueTypes[property->propType]; + QObject *typeObject = (*qmlValueTypes())[property->propType]; if (!typeObject) return; // Not a value type int idx = typeObject->metaObject()->indexOfProperty(path.last().toUtf8().constData()); @@ -346,7 +346,7 @@ QDeclarativePropertyPrivate::propertyTypeCategory() const int type = propertyType(); if (type == QVariant::Invalid) return QDeclarativeProperty::InvalidCategory; - else if ((uint)type < QVariant::UserType) + else if (QDeclarativeValueTypeFactory::isValueType((uint)type)) return QDeclarativeProperty::Normal; else if (core.flags & QDeclarativePropertyCache::Data::IsQObjectDerived) return QDeclarativeProperty::Object; diff --git a/src/declarative/qml/qdeclarativeproperty_p.h b/src/declarative/qml/qdeclarativeproperty_p.h index 1fda7f4..c31e2d3 100644 --- a/src/declarative/qml/qdeclarativeproperty_p.h +++ b/src/declarative/qml/qdeclarativeproperty_p.h @@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE class QDeclarativeContext; class QDeclarativeEnginePrivate; class QDeclarativeExpression; -class Q_AUTOTEST_EXPORT QDeclarativePropertyPrivate +class Q_DECLARATIVE_EXPORT QDeclarativePropertyPrivate { public: enum WriteFlag { BypassInterceptor = 0x01, DontRemoveBinding = 0x02 }; diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp index a4b3668..fe516c5 100644 --- a/src/declarative/qml/qdeclarativescriptparser.cpp +++ b/src/declarative/qml/qdeclarativescriptparser.cpp @@ -85,8 +85,8 @@ class ProcessAST: protected AST::Visitor { const State &state = top(); if (state.property) { - State s(state.property->getValue(), - state.property->getValue()->getProperty(name.toUtf8())); + State s(state.property->getValue(location), + state.property->getValue(location)->getProperty(name.toUtf8())); s.property->location = location; push(s); } else { diff --git a/src/declarative/qml/qdeclarativevaluetype.cpp b/src/declarative/qml/qdeclarativevaluetype.cpp index 01fa214..c070123 100644 --- a/src/declarative/qml/qdeclarativevaluetype.cpp +++ b/src/declarative/qml/qdeclarativevaluetype.cpp @@ -41,23 +41,88 @@ #include "qdeclarativevaluetype_p.h" +#include "qdeclarativemetatype_p.h" + #include <QtCore/qdebug.h> QT_BEGIN_NAMESPACE +#if (QT_VERSION < QT_VERSION_CHECK(4,7,0)) +Q_DECLARE_METATYPE(QEasingCurve); +#endif + +template<typename T> +int qmlRegisterValueTypeEnums(const char *qmlName) +{ + QByteArray name(T::staticMetaObject.className()); + + QByteArray pointerName(name + '*'); + + QDeclarativePrivate::RegisterType type = { + 0, + + qRegisterMetaType<T *>(pointerName.constData()), 0, 0, + + "Qt", 4, 6, qmlName, &T::staticMetaObject, + + 0, 0, + + 0, 0, 0, + + 0, 0, + + 0 + }; + + return QDeclarativePrivate::registerType(type); +} + QDeclarativeValueTypeFactory::QDeclarativeValueTypeFactory() { // ### Optimize for (unsigned int ii = 0; ii < (QVariant::UserType - 1); ++ii) valueTypes[ii] = valueType(ii); +#if (QT_VERSION < QT_VERSION_CHECK(4,7,0)) + easingType = qMetaTypeId<QEasingCurve>(); + easingValueType = valueType(easingType); +#endif } QDeclarativeValueTypeFactory::~QDeclarativeValueTypeFactory() { for (unsigned int ii = 0; ii < (QVariant::UserType - 1); ++ii) delete valueTypes[ii]; +#if (QT_VERSION < QT_VERSION_CHECK(4,7,0)) + delete easingValueType; +#endif +} + +bool QDeclarativeValueTypeFactory::isValueType(int idx) +{ + if ((uint)idx < QVariant::UserType) + return true; +#if (QT_VERSION < QT_VERSION_CHECK(4,7,0)) + if (idx == qMetaTypeId<QEasingCurve>()) + return true; +#endif + return false; +} + +void QDeclarativeValueTypeFactory::registerValueTypes() +{ + qmlRegisterValueTypeEnums<QDeclarativeEasingValueType>("Easing"); + qmlRegisterValueTypeEnums<QDeclarativeFontValueType>("Font"); +} + +QDeclarativeValueType *QDeclarativeValueTypeFactory::operator[](int idx) const +{ +#if (QT_VERSION < QT_VERSION_CHECK(4,7,0)) + if (idx == easingType) return easingValueType; +#endif + return valueTypes[idx]; } + QDeclarativeValueType *QDeclarativeValueTypeFactory::valueType(int t) { switch (t) { @@ -75,11 +140,17 @@ QDeclarativeValueType *QDeclarativeValueTypeFactory::valueType(int t) return new QDeclarativeRectFValueType; case QVariant::Vector3D: return new QDeclarativeVector3DValueType; +#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0)) case QVariant::EasingCurve: return new QDeclarativeEasingValueType; +#endif case QVariant::Font: return new QDeclarativeFontValueType; default: +#if (QT_VERSION < QT_VERSION_CHECK(4,7,0)) + if (t == qMetaTypeId<QEasingCurve>()) + return new QDeclarativeEasingValueType; +#endif return 0; } } @@ -495,7 +566,11 @@ void QDeclarativeEasingValueType::write(QObject *obj, int idx, QDeclarativePrope QVariant QDeclarativeEasingValueType::value() { +#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0)) return QVariant(easing); +#else + return QVariant::fromValue<QEasingCurve>(easing); +#endif } void QDeclarativeEasingValueType::setValue(QVariant value) diff --git a/src/declarative/qml/qdeclarativevaluetype_p.h b/src/declarative/qml/qdeclarativevaluetype_p.h index cb153be..ad2f6c4 100644 --- a/src/declarative/qml/qdeclarativevaluetype_p.h +++ b/src/declarative/qml/qdeclarativevaluetype_p.h @@ -81,10 +81,19 @@ class Q_DECLARATIVE_EXPORT QDeclarativeValueTypeFactory public: QDeclarativeValueTypeFactory(); ~QDeclarativeValueTypeFactory(); + static bool isValueType(int); static QDeclarativeValueType *valueType(int); + static void registerValueTypes(); + + QDeclarativeValueType *operator[](int idx) const; + +private: QDeclarativeValueType *valueTypes[QVariant::UserType - 1]; - QDeclarativeValueType *operator[](int idx) const { return valueTypes[idx]; } +#if (QT_VERSION < QT_VERSION_CHECK(4,7,0)) + int easingType; + QDeclarativeValueType *easingValueType; +#endif }; class Q_AUTOTEST_EXPORT QDeclarativePointFValueType : public QDeclarativeValueType diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp index fc3722d..6a08674 100644 --- a/src/declarative/qml/qdeclarativevme.cpp +++ b/src/declarative/qml/qdeclarativevme.cpp @@ -538,13 +538,13 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, QDeclarati case QDeclarativeInstruction::StoreSignal: { QObject *target = stack.top(); - // XXX scope - QMetaMethod signal = - target->metaObject()->method(instr.storeSignal.signalIndex); + QObject *context = stack.at(stack.count() - 1 - instr.assignBinding.context); + + QMetaMethod signal = target->metaObject()->method(instr.storeSignal.signalIndex); QDeclarativeBoundSignal *bs = new QDeclarativeBoundSignal(target, signal, target); QDeclarativeExpression *expr = - new QDeclarativeExpression(ctxt, primitives.at(instr.storeSignal.value), target); + new QDeclarativeExpression(ctxt, primitives.at(instr.storeSignal.value), context); expr->setSourceLocation(comp->name, instr.line); bs->setExpression(expr); } diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index b14de19..76b6a58 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -52,6 +52,7 @@ #include <qdeclarativestringconverters_p.h> #include <qdeclarativeglobal_p.h> #include <qdeclarativemetatype_p.h> +#include <qdeclarativevaluetype_p.h> #include <qdeclarativeproperty_p.h> #include <qvariant.h> @@ -1710,12 +1711,13 @@ void QDeclarativePropertyAnimationPrivate::convertVariant(QVariant &variant, int break; } default: - if ((uint)type >= QVariant::UserType) { + if (QDeclarativeValueTypeFactory::isValueType((uint)type)) { + variant.convert((QVariant::Type)type); + } else { QDeclarativeMetaType::StringConverter converter = QDeclarativeMetaType::customStringConverter(type); if (converter) variant = converter(variant.toString()); - } else - variant.convert((QVariant::Type)type); + } break; } } @@ -1734,7 +1736,7 @@ void QDeclarativePropertyAnimationPrivate::convertVariant(QVariant &variant, int Animate any objects that have changed their x or y properties in the target state using an InOutQuad easing curve: \qml - Transition { PropertyAnimation { properties: "x,y"; easing: "InOutQuad" } } + Transition { PropertyAnimation { properties: "x,y"; easing.type: "InOutQuad" } } \endqml \o In a Behavior @@ -1875,7 +1877,13 @@ void QDeclarativePropertyAnimation::setTo(const QVariant &t) \qmlproperty QEasingCurve PropertyAnimation::easing \brief the easing curve used for the transition. - Available values are: + For the easing you can specify the following parameters: type, amplitude, period and overshoot. + + \qml + PropertyAnimation { properties: "y"; easing.type: "InOutElastc"; easing.amplitude: 2.0; easing.period: 1.5 } + \endqml + + Available types are: \table \row @@ -2046,6 +2054,15 @@ void QDeclarativePropertyAnimation::setTo(const QVariant &t) \o \inlineimage qeasingcurve-outinbounce.png \endtable + easing.amplitude is not applicable for all curve types. It is only applicable for bounce and elastic curves (curves of type + QEasingCurve::InBounce, QEasingCurve::OutBounce, QEasingCurve::InOutBounce, QEasingCurve::OutInBounce, QEasingCurve::InElastic, + QEasingCurve::OutElastic, QEasingCurve::InOutElastic or QEasingCurve::OutInElastic). + + easing.overshoot is not applicable for all curve types. It is only applicable if type is: QEasingCurve::InBack, QEasingCurve::OutBack, + QEasingCurve::InOutBack or QEasingCurve::OutInBack. + + easing.period is not applicable for all curve types. It is only applicable if type is: QEasingCurve::InElastic, QEasingCurve::OutElastic, + QEasingCurve::InOutElastic or QEasingCurve::OutInElastic. */ QEasingCurve QDeclarativePropertyAnimation::easing() const { diff --git a/src/declarative/util/qdeclarativetimer.cpp b/src/declarative/util/qdeclarativetimer.cpp index d7e02b1..104e3ae 100644 --- a/src/declarative/util/qdeclarativetimer.cpp +++ b/src/declarative/util/qdeclarativetimer.cpp @@ -123,6 +123,7 @@ void QDeclarativeTimer::setInterval(int interval) if (interval != d->interval) { d->interval = interval; update(); + emit intervalChanged(); } } @@ -183,6 +184,7 @@ void QDeclarativeTimer::setRepeating(bool repeating) if (repeating != d->repeating) { d->repeating = repeating; update(); + emit repeatChanged(); } } @@ -215,6 +217,7 @@ void QDeclarativeTimer::setTriggeredOnStart(bool triggeredOnStart) if (d->triggeredOnStart != triggeredOnStart) { d->triggeredOnStart = triggeredOnStart; update(); + emit triggeredOnStartChanged(); } } diff --git a/src/declarative/util/qdeclarativetimer_p.h b/src/declarative/util/qdeclarativetimer_p.h index e063657..d1e6630 100644 --- a/src/declarative/util/qdeclarativetimer_p.h +++ b/src/declarative/util/qdeclarativetimer_p.h @@ -59,10 +59,10 @@ class Q_DECLARATIVE_EXPORT QDeclarativeTimer : public QObject, public QDeclarati Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeTimer) Q_INTERFACES(QDeclarativeParserStatus) - Q_PROPERTY(int interval READ interval WRITE setInterval) + Q_PROPERTY(int interval READ interval WRITE setInterval NOTIFY intervalChanged) Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged) - Q_PROPERTY(bool repeat READ isRepeating WRITE setRepeating) - Q_PROPERTY(bool triggeredOnStart READ triggeredOnStart WRITE setTriggeredOnStart) + Q_PROPERTY(bool repeat READ isRepeating WRITE setRepeating NOTIFY repeatChanged) + Q_PROPERTY(bool triggeredOnStart READ triggeredOnStart WRITE setTriggeredOnStart NOTIFY triggeredOnStartChanged) public: QDeclarativeTimer(QObject *parent=0); @@ -91,6 +91,9 @@ public Q_SLOTS: Q_SIGNALS: void triggered(); void runningChanged(); + void intervalChanged(); + void repeatChanged(); + void triggeredOnStartChanged(); private: void update(); diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp index f08e634..cd67aeb 100644 --- a/src/declarative/util/qdeclarativeview.cpp +++ b/src/declarative/util/qdeclarativeview.cpp @@ -194,6 +194,7 @@ void QDeclarativeViewPrivate::execute() \o Initializes QGraphicsView for QML key handling: \list \o QGraphicsView::viewport()->setFocusPolicy(Qt::NoFocus); + \o QGraphicsView::setFocusPolicy(Qt::StrongFocus); \o QGraphicsScene::setStickyFocus(true); \endlist \endlist @@ -268,6 +269,7 @@ void QDeclarativeViewPrivate::init() q->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); scene.setItemIndexMethod(QGraphicsScene::NoIndex); q->viewport()->setFocusPolicy(Qt::NoFocus); + q->setFocusPolicy(Qt::StrongFocus); scene.setStickyFocus(true); //### needed for correct focus handling } diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index d260ada..53e08b0 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -571,9 +571,10 @@ void QDeclarativeXmlListModel::setSource(const QUrl &src) { Q_D(QDeclarativeXmlListModel); if (d->src != src) { - d->src = src; reload(); - } + d->src = src; + emit sourceChanged(); + } } /*! @@ -593,8 +594,11 @@ QString QDeclarativeXmlListModel::xml() const void QDeclarativeXmlListModel::setXml(const QString &xml) { Q_D(QDeclarativeXmlListModel); - d->xml = xml; - reload(); + if (d->xml != xml) { + d->xml = xml; + reload(); + emit xmlChanged(); + } } /*! @@ -619,6 +623,7 @@ void QDeclarativeXmlListModel::setQuery(const QString &query) if (d->query != query) { d->query = query; reload(); + emit queryChanged(); } } @@ -638,6 +643,7 @@ void QDeclarativeXmlListModel::setNamespaceDeclarations(const QString &declarati if (d->namespaces != declarations) { d->namespaces = declarations; reload(); + emit namespaceDeclarationsChanged(); } } diff --git a/src/declarative/util/qdeclarativexmllistmodel_p.h b/src/declarative/util/qdeclarativexmllistmodel_p.h index f0ad4b8..23ff7ce 100644 --- a/src/declarative/util/qdeclarativexmllistmodel_p.h +++ b/src/declarative/util/qdeclarativexmllistmodel_p.h @@ -68,10 +68,10 @@ class Q_DECLARATIVE_EXPORT QDeclarativeXmlListModel : public QListModelInterface Q_PROPERTY(Status status READ status NOTIFY statusChanged) Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged) - Q_PROPERTY(QUrl source READ source WRITE setSource) - Q_PROPERTY(QString xml READ xml WRITE setXml) - Q_PROPERTY(QString query READ query WRITE setQuery) - Q_PROPERTY(QString namespaceDeclarations READ namespaceDeclarations WRITE setNamespaceDeclarations) + Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) + Q_PROPERTY(QString xml READ xml WRITE setXml NOTIFY xmlChanged) + Q_PROPERTY(QString query READ query WRITE setQuery NOTIFY queryChanged) + Q_PROPERTY(QString namespaceDeclarations READ namespaceDeclarations WRITE setNamespaceDeclarations NOTIFY namespaceDeclarationsChanged) Q_PROPERTY(QDeclarativeListProperty<QDeclarativeXmlListModelRole> roles READ roleObjects) Q_PROPERTY(int count READ count NOTIFY countChanged) Q_CLASSINFO("DefaultProperty", "roles") @@ -111,6 +111,10 @@ Q_SIGNALS: void statusChanged(Status); void progressChanged(qreal progress); void countChanged(); + void sourceChanged(); + void xmlChanged(); + void queryChanged(); + void namespaceDeclarationsChanged(); public Q_SLOTS: // ### need to use/expose Expiry to guess when to call this? @@ -132,16 +136,20 @@ private: class Q_DECLARATIVE_EXPORT QDeclarativeXmlListModelRole : public QObject { Q_OBJECT - Q_PROPERTY(QString name READ name WRITE setName) - Q_PROPERTY(QString query READ query WRITE setQuery) - Q_PROPERTY(bool isKey READ isKey WRITE setIsKey) - + Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + Q_PROPERTY(QString query READ query WRITE setQuery NOTIFY queryChanged) + Q_PROPERTY(bool isKey READ isKey WRITE setIsKey NOTIFY isKeyChanged) public: QDeclarativeXmlListModelRole() : m_isKey(false) {} ~QDeclarativeXmlListModelRole() {} QString name() const { return m_name; } - void setName(const QString &name) { m_name = name; } + void setName(const QString &name) { + if (name == m_name) + return; + m_name = name; + emit nameChanged(); + } QString query() const { return m_query; } void setQuery(const QString &query) @@ -150,16 +158,29 @@ public: qmlInfo(this) << tr("An XmlRole query must not start with '/'"); return; } + if (m_query == query) + return; m_query = query; + emit queryChanged(); } bool isKey() const { return m_isKey; } - void setIsKey(bool b) { m_isKey = b; } + void setIsKey(bool b) { + if (m_isKey == b) + return; + m_isKey = b; + emit isKeyChanged(); + } bool isValid() { return !m_name.isEmpty() && !m_query.isEmpty(); } +Q_SIGNALS: + void nameChanged(); + void queryChanged(); + void isKeyChanged(); + private: QString m_name; QString m_query; diff --git a/src/gui/dialogs/qabstractprintdialog.cpp b/src/gui/dialogs/qabstractprintdialog.cpp index 4523433..25d9ebb 100644 --- a/src/gui/dialogs/qabstractprintdialog.cpp +++ b/src/gui/dialogs/qabstractprintdialog.cpp @@ -76,6 +76,7 @@ class QPrintDialogPrivate : public QAbstractPrintDialogPrivate \value AllPages All pages should be printed. \value Selection Only the selection should be printed. \value PageRange The specified page range should be printed. + \value CurrentPage Only the currently visible page should be printed. \sa QPrinter::PrintRange */ @@ -89,7 +90,9 @@ class QPrintDialogPrivate : public QAbstractPrintDialogPrivate \value PrintToFile The print to file option is enabled. \value PrintSelection The print selection option is enabled. \value PrintPageRange The page range selection option is enabled. - \value PrintCollateCopies + \value PrintShowPageSize Show the page size + margins page only if this is enabled. + \value PrintCollateCopies The collate copies option is enabled + \value PrintCurrentPage The print current page option is enabled This value is obsolete and does nothing since Qt 4.5: @@ -97,8 +100,6 @@ class QPrintDialogPrivate : public QAbstractPrintDialogPrivate would create a sheet by default the dialog was given a parent. This is no longer supported in Qt 4.5. If you want to use sheets, use QPrintDialog::open() instead. - - \value PrintShowPageSize Show the page size + margins page only if this is enabled. */ /*! diff --git a/src/gui/dialogs/qabstractprintdialog.h b/src/gui/dialogs/qabstractprintdialog.h index 4d867f6..82e3df8 100644 --- a/src/gui/dialogs/qabstractprintdialog.h +++ b/src/gui/dialogs/qabstractprintdialog.h @@ -65,7 +65,8 @@ public: enum PrintRange { AllPages, Selection, - PageRange + PageRange, + CurrentPage }; enum PrintDialogOption { @@ -75,7 +76,8 @@ public: PrintPageRange = 0x0004, PrintShowPageSize = 0x0008, PrintCollateCopies = 0x0010, - DontUseSheet = 0x0020 + DontUseSheet = 0x0020, + PrintCurrentPage = 0x0040 }; Q_DECLARE_FLAGS(PrintDialogOptions, PrintDialogOption) diff --git a/src/gui/dialogs/qfontdialog.cpp b/src/gui/dialogs/qfontdialog.cpp index a4bf15d..b987611 100644 --- a/src/gui/dialogs/qfontdialog.cpp +++ b/src/gui/dialogs/qfontdialog.cpp @@ -988,13 +988,10 @@ void QFontDialog::open(QObject *receiver, const char *member) */ void QFontDialog::setVisible(bool visible) { - Q_D(QFontDialog); - if (visible) { - if (testAttribute(Qt::WA_WState_ExplicitShowHide) && !testAttribute(Qt::WA_WState_Hidden)) - return; - } else if (testAttribute(Qt::WA_WState_ExplicitShowHide) && testAttribute(Qt::WA_WState_Hidden)) + if (testAttribute(Qt::WA_WState_ExplicitShowHide) && testAttribute(Qt::WA_WState_Hidden) != visible) return; #ifdef Q_WS_MAC + Q_D(QFontDialog); if (d->canBeNativeDialog()){ if (d->setVisible_sys(visible)){ d->nativeDialogInUse = true; diff --git a/src/gui/dialogs/qprintdialog_qws.cpp b/src/gui/dialogs/qprintdialog_qws.cpp index 1336c04..b071427 100644 --- a/src/gui/dialogs/qprintdialog_qws.cpp +++ b/src/gui/dialogs/qprintdialog_qws.cpp @@ -178,6 +178,10 @@ void QPrintDialogPrivate::_q_okClicked() q->setPrintRange(QPrintDialog::PageRange); q->setFromTo(firstPage->value(), lastPage->value()); break; + case (int)QPrintDialog::CurrentPage: + q->setPrintRange(QPrintDialog::CurrentPage); + q->setFromTo(0, 0); + break; } q->accept(); } @@ -375,6 +379,7 @@ void QPrintDialogPrivate::setupOptions() rangeCombo->addItem(QPrintDialog::tr("Print all"), QPrintDialog::AllPages); rangeCombo->addItem(QPrintDialog::tr("Print selection"), QPrintDialog::Selection); rangeCombo->addItem(QPrintDialog::tr("Print range"), QPrintDialog::PageRange); + rangeCombo->addItem(QPrintDialog::tr("Print current page"), QPrintDialog::CurrentPage); QObject::connect(rangeCombo, SIGNAL(activated(int)), q, SLOT(_q_printRangeSelected(int))); @@ -490,6 +495,9 @@ void QPrintDialogPrivate::setPrinter(QPrinter *p, bool pickUpSettings) if (!q->isOptionEnabled(QPrintDialog::PrintPageRange) && rangeCombo->findData(QPrintDialog::PageRange) > 0) rangeCombo->removeItem(rangeCombo->findData(QPrintDialog::PageRange)); + if (!q->isOptionEnabled(QPrintDialog::PrintCurrentPage) + && rangeCombo->findData(QPrintDialog::CurrentPage) > 0) + rangeCombo->removeItem(rangeCombo->findData(QPrintDialog::CurrentPage)); switch (q->printRange()) { case QPrintDialog::AllPages: @@ -501,6 +509,9 @@ void QPrintDialogPrivate::setPrinter(QPrinter *p, bool pickUpSettings) case QPrintDialog::PageRange: rangeCombo->setCurrentIndex((int)(QPrintDialog::PageRange)); break; + case QPrintDialog::CurrentPage: + rangeCombo->setCurrentIndex((int)(QPrintDialog::CurrentPage)); + break; } } diff --git a/src/gui/dialogs/qprintdialog_unix.cpp b/src/gui/dialogs/qprintdialog_unix.cpp index 2d169cf..0487f23 100644 --- a/src/gui/dialogs/qprintdialog_unix.cpp +++ b/src/gui/dialogs/qprintdialog_unix.cpp @@ -502,6 +502,9 @@ void QPrintDialogPrivate::setupPrinter() } else if (options.printSelection->isChecked()) { p->setPrintRange(QPrinter::Selection); p->setFromTo(0,0); + } else if (options.printCurrentPage->isChecked()) { + p->setPrintRange(QPrinter::CurrentPage); + p->setFromTo(0,0); } else if (options.printRange->isChecked()) { p->setPrintRange(QPrinter::PageRange); p->setFromTo(options.from->value(), qMax(options.from->value(), options.to->value())); @@ -518,10 +521,12 @@ void QPrintDialogPrivate::updateWidgets() { Q_Q(QPrintDialog); options.gbPrintRange->setVisible(q->isOptionEnabled(QPrintDialog::PrintPageRange) || - q->isOptionEnabled(QPrintDialog::PrintSelection)); + q->isOptionEnabled(QPrintDialog::PrintSelection) || + q->isOptionEnabled(QPrintDialog::PrintCurrentPage)); options.printRange->setEnabled(q->isOptionEnabled(QPrintDialog::PrintPageRange)); options.printSelection->setVisible(q->isOptionEnabled(QPrintDialog::PrintSelection)); + options.printCurrentPage->setVisible(q->isOptionEnabled(QPrintDialog::PrintCurrentPage)); options.collate->setVisible(q->isOptionEnabled(QPrintDialog::PrintCollateCopies)); switch (q->printRange()) { @@ -534,6 +539,10 @@ void QPrintDialogPrivate::updateWidgets() case QPrintDialog::PageRange: options.printRange->setChecked(true); break; + case QPrintDialog::CurrentPage: + if (q->isOptionEnabled(QPrintDialog::PrintCurrentPage)) + options.printCurrentPage->setChecked(true); + break; default: break; } diff --git a/src/gui/dialogs/qprintdialog_win.cpp b/src/gui/dialogs/qprintdialog_win.cpp index fa0c99f..1061660 100644 --- a/src/gui/dialogs/qprintdialog_win.cpp +++ b/src/gui/dialogs/qprintdialog_win.cpp @@ -128,11 +128,14 @@ static void qt_win_setup_PRINTDLGEX(PRINTDLGEX *pd, QWidget *parent, if (pd->nMinPage==0 && pd->nMaxPage==0) pd->Flags |= PD_NOPAGENUMS; - // we don't have a 'current page' notion in the QPrinter API yet. - // Neither do we support more than one page range, so limit those - // options - pd->Flags |= PD_NOCURRENTPAGE; + // Disable Current Page option if not required as default is Enabled + if (!pdlg->isOptionEnabled(QPrintDialog::PrintCurrentPage)) + pd->Flags |= PD_NOCURRENTPAGE; + + // Default to showing the General tab first pd->nStartPage = START_PAGE_GENERAL; + + // We don't support more than one page range in the QPrinter API yet. pd->nPageRanges = 1; pd->nMaxPageRanges = 1; @@ -153,7 +156,10 @@ static void qt_win_read_back_PRINTDLGEX(PRINTDLGEX *pd, QPrintDialog *pdlg, QPri } else if (pd->Flags & PD_PAGENUMS) { pdlg->setPrintRange(QPrintDialog::PageRange); pdlg->setFromTo(pd->lpPageRanges[0].nFromPage, pd->lpPageRanges[0].nToPage); - } else { + } else if (pd->Flags & PD_CURRENTPAGE) { + pdlg->setPrintRange(QPrintDialog::CurrentPage); + pdlg->setFromTo(0, 0); + } else { // PD_ALLPAGES pdlg->setPrintRange(QPrintDialog::AllPages); pdlg->setFromTo(0, 0); } diff --git a/src/gui/dialogs/qprintsettingsoutput.ui b/src/gui/dialogs/qprintsettingsoutput.ui index fc57e86..be91679 100644 --- a/src/gui/dialogs/qprintsettingsoutput.ui +++ b/src/gui/dialogs/qprintsettingsoutput.ui @@ -1,121 +1,114 @@ -<ui version="4.0" > +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> <class>QPrintSettingsOutput</class> - <widget class="QWidget" name="QPrintSettingsOutput" > - <property name="geometry" > + <widget class="QWidget" name="QPrintSettingsOutput"> + <property name="geometry"> <rect> <x>0</x> <y>0</y> - <width>416</width> - <height>166</height> + <width>426</width> + <height>171</height> </rect> </property> - <property name="windowTitle" > + <property name="windowTitle"> <string>Form</string> </property> - <layout class="QHBoxLayout" name="horizontalLayout_2" > - <property name="margin" > + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <property name="margin"> <number>0</number> </property> <item> - <widget class="QTabWidget" name="tabs" > - <property name="currentIndex" > + <widget class="QTabWidget" name="tabs"> + <property name="currentIndex"> <number>0</number> </property> - <widget class="QWidget" name="copiesTab" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>412</width> - <height>139</height> - </rect> - </property> - <attribute name="title" > + <widget class="QWidget" name="copiesTab"> + <attribute name="title"> <string>Copies</string> </attribute> - <layout class="QHBoxLayout" name="horizontalLayout" > + <layout class="QHBoxLayout" name="horizontalLayout"> <item> - <widget class="QGroupBox" name="gbPrintRange" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Minimum" hsizetype="Preferred" > + <widget class="QGroupBox" name="gbPrintRange"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="title" > + <property name="title"> <string>Print range</string> </property> - <layout class="QVBoxLayout" name="_3" > - <property name="spacing" > + <layout class="QVBoxLayout" name="_3"> + <property name="spacing"> <number>4</number> </property> - <property name="margin" > + <property name="margin"> <number>6</number> </property> <item> - <widget class="QRadioButton" name="printAll" > - <property name="text" > + <widget class="QRadioButton" name="printAll"> + <property name="text"> <string>Print all</string> </property> - <property name="checked" > + <property name="checked"> <bool>true</bool> </property> </widget> </item> <item> - <layout class="QHBoxLayout" name="_4" > - <property name="spacing" > + <layout class="QHBoxLayout" name="_4"> + <property name="spacing"> <number>6</number> </property> - <property name="margin" > + <property name="margin"> <number>0</number> </property> <item> - <widget class="QRadioButton" name="printRange" > - <property name="text" > + <widget class="QRadioButton" name="printRange"> + <property name="text"> <string>Pages from</string> </property> </widget> </item> <item> - <widget class="QSpinBox" name="from" > - <property name="enabled" > + <widget class="QSpinBox" name="from"> + <property name="enabled"> <bool>false</bool> </property> - <property name="minimum" > + <property name="minimum"> <number>1</number> </property> - <property name="maximum" > + <property name="maximum"> <number>999</number> </property> </widget> </item> <item> - <widget class="QLabel" name="label_3" > - <property name="text" > + <widget class="QLabel" name="label_3"> + <property name="text"> <string>to</string> </property> </widget> </item> <item> - <widget class="QSpinBox" name="to" > - <property name="enabled" > + <widget class="QSpinBox" name="to"> + <property name="enabled"> <bool>false</bool> </property> - <property name="minimum" > + <property name="minimum"> <number>1</number> </property> - <property name="maximum" > + <property name="maximum"> <number>999</number> </property> </widget> </item> <item> <spacer> - <property name="orientation" > + <property name="orientation"> <enum>Qt::Horizontal</enum> </property> - <property name="sizeHint" stdset="0" > + <property name="sizeHint" stdset="0"> <size> <width>0</width> <height>20</height> @@ -126,18 +119,25 @@ </layout> </item> <item> - <widget class="QRadioButton" name="printSelection" > - <property name="text" > + <widget class="QRadioButton" name="printCurrentPage"> + <property name="text"> + <string>Current Page</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="printSelection"> + <property name="text"> <string>Selection</string> </property> </widget> </item> <item> - <spacer name="verticalSpacer" > - <property name="orientation" > + <spacer name="verticalSpacer"> + <property name="orientation"> <enum>Qt::Vertical</enum> </property> - <property name="sizeHint" stdset="0" > + <property name="sizeHint" stdset="0"> <size> <width>1</width> <height>1</height> @@ -149,37 +149,37 @@ </widget> </item> <item> - <widget class="QGroupBox" name="groupBox" > - <property name="title" > + <widget class="QGroupBox" name="groupBox"> + <property name="title"> <string>Output Settings</string> </property> - <layout class="QGridLayout" name="gridLayout" > - <item row="0" column="0" > - <widget class="QLabel" name="label" > - <property name="text" > + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> <string>Copies:</string> </property> - <property name="buddy" > + <property name="buddy"> <cstring>copies</cstring> </property> </widget> </item> - <item row="0" column="1" colspan="2" > - <widget class="QSpinBox" name="copies" > - <property name="minimum" > + <item row="0" column="1" colspan="2"> + <widget class="QSpinBox" name="copies"> + <property name="minimum"> <number>1</number> </property> - <property name="maximum" > + <property name="maximum"> <number>999</number> </property> </widget> </item> - <item row="0" column="3" > - <spacer name="horizontalSpacer" > - <property name="orientation" > + <item row="0" column="3"> + <spacer name="horizontalSpacer"> + <property name="orientation"> <enum>Qt::Horizontal</enum> </property> - <property name="sizeHint" stdset="0" > + <property name="sizeHint" stdset="0"> <size> <width>91</width> <height>20</height> @@ -187,36 +187,36 @@ </property> </spacer> </item> - <item row="1" column="0" colspan="2" > - <widget class="QCheckBox" name="collate" > - <property name="text" > + <item row="1" column="0" colspan="2"> + <widget class="QCheckBox" name="collate"> + <property name="text"> <string>Collate</string> </property> </widget> </item> - <item rowspan="2" row="1" column="2" colspan="2" > - <widget class="QLabel" name="outputIcon" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Ignored" hsizetype="Ignored" > + <item row="1" column="2" rowspan="2" colspan="2"> + <widget class="QLabel" name="outputIcon"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Ignored" vsizetype="Ignored"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> </widget> </item> - <item row="2" column="0" colspan="2" > - <widget class="QCheckBox" name="reverse" > - <property name="text" > + <item row="2" column="0" colspan="2"> + <widget class="QCheckBox" name="reverse"> + <property name="text"> <string>Reverse</string> </property> </widget> </item> - <item row="3" column="0" colspan="4" > - <spacer name="verticalSpacer_2" > - <property name="orientation" > + <item row="3" column="0" colspan="4"> + <spacer name="verticalSpacer_2"> + <property name="orientation"> <enum>Qt::Vertical</enum> </property> - <property name="sizeHint" stdset="0" > + <property name="sizeHint" stdset="0"> <size> <width>0</width> <height>1</height> @@ -229,31 +229,23 @@ </item> </layout> </widget> - <widget class="QWidget" name="optionsTab" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>412</width> - <height>139</height> - </rect> - </property> - <attribute name="title" > + <widget class="QWidget" name="optionsTab"> + <attribute name="title"> <string>Options</string> </attribute> - <layout class="QGridLayout" name="gridLayout_2" > - <item row="0" column="1" > - <widget class="QGroupBox" name="colorMode" > - <property name="title" > + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="1"> + <widget class="QGroupBox" name="colorMode"> + <property name="title"> <string>Color Mode</string> </property> - <layout class="QGridLayout" name="gridLayout_4" > - <item row="2" column="0" > - <spacer name="verticalSpacer_6" > - <property name="orientation" > + <layout class="QGridLayout" name="gridLayout_4"> + <item row="2" column="0"> + <spacer name="verticalSpacer_6"> + <property name="orientation"> <enum>Qt::Vertical</enum> </property> - <property name="sizeHint" stdset="0" > + <property name="sizeHint" stdset="0"> <size> <width>1</width> <height>0</height> @@ -261,19 +253,19 @@ </property> </spacer> </item> - <item row="0" column="0" > - <widget class="QRadioButton" name="color" > - <property name="text" > + <item row="0" column="0"> + <widget class="QRadioButton" name="color"> + <property name="text"> <string>Color</string> </property> </widget> </item> - <item rowspan="3" row="0" column="1" > - <widget class="QLabel" name="colorIcon" /> + <item row="0" column="1" rowspan="3"> + <widget class="QLabel" name="colorIcon"/> </item> - <item row="1" column="0" > - <widget class="QRadioButton" name="grayscale" > - <property name="text" > + <item row="1" column="0"> + <widget class="QRadioButton" name="grayscale"> + <property name="text"> <string>Grayscale</string> </property> </widget> @@ -281,42 +273,42 @@ </layout> </widget> </item> - <item row="0" column="0" > - <widget class="QGroupBox" name="duplex" > - <property name="title" > + <item row="0" column="0"> + <widget class="QGroupBox" name="duplex"> + <property name="title"> <string>Duplex Printing</string> </property> - <layout class="QVBoxLayout" name="verticalLayout" > + <layout class="QVBoxLayout" name="verticalLayout"> <item> - <widget class="QRadioButton" name="noDuplex" > - <property name="text" > + <widget class="QRadioButton" name="noDuplex"> + <property name="text"> <string>None</string> </property> - <property name="checked" > + <property name="checked"> <bool>true</bool> </property> </widget> </item> <item> - <widget class="QRadioButton" name="duplexLong" > - <property name="text" > + <widget class="QRadioButton" name="duplexLong"> + <property name="text"> <string>Long side</string> </property> </widget> </item> <item> - <widget class="QRadioButton" name="duplexShort" > - <property name="text" > + <widget class="QRadioButton" name="duplexShort"> + <property name="text"> <string>Short side</string> </property> </widget> </item> <item> - <spacer name="verticalSpacer_42" > - <property name="orientation" > + <spacer name="verticalSpacer_42"> + <property name="orientation"> <enum>Qt::Vertical</enum> </property> - <property name="sizeHint" stdset="0" > + <property name="sizeHint" stdset="0"> <size> <width>1</width> <height>0</height> @@ -341,11 +333,11 @@ <receiver>from</receiver> <slot>setEnabled(bool)</slot> <hints> - <hint type="sourcelabel" > + <hint type="sourcelabel"> <x>76</x> <y>59</y> </hint> - <hint type="destinationlabel" > + <hint type="destinationlabel"> <x>122</x> <y>57</y> </hint> @@ -357,11 +349,11 @@ <receiver>to</receiver> <slot>setEnabled(bool)</slot> <hints> - <hint type="sourcelabel" > + <hint type="sourcelabel"> <x>69</x> <y>67</y> </hint> - <hint type="destinationlabel" > + <hint type="destinationlabel"> <x>215</x> <y>67</y> </hint> diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h index aa89772..ffb45aa 100644 --- a/src/gui/egl/qegl_p.h +++ b/src/gui/egl/qegl_p.h @@ -77,6 +77,8 @@ QT_BEGIN_INCLUDE_NAMESPACE #undef Type #undef FontChange #undef CursorShape +#undef Unsorted +#undef GrayScale #endif // Internally we use the EGL-prefixed native types which are used in EGL >= 1.3. diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp index 339bd57..483c01d 100644 --- a/src/gui/egl/qegl_x11.cpp +++ b/src/gui/egl/qegl_x11.cpp @@ -149,6 +149,9 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config) eglGetConfigAttrib(display(), config, EGL_BUFFER_SIZE, &eglValue); int configBitDepth = eglValue; + eglGetConfigAttrib(display(), config, EGL_CONFIG_ID, &eglValue); + int configId = eglValue; + // See if EGL provided a valid VisualID: eglGetConfigAttrib(display(), config, EGL_NATIVE_VISUAL_ID, &eglValue); visualId = (VisualID)eglValue; @@ -170,14 +173,14 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config) format = XRenderFindVisualFormat(X11->display, chosenVisualInfo->visual); if (!format || (format->type != PictTypeDirect) || (!format->direct.alphaMask)) { qWarning("Warning: EGL suggested using X visual ID %d for config %d, but this is not ARGB", - (int)visualId, (int)config); + (int)visualId, configId); visualId = 0; } } #endif } else { qWarning("Warning: EGL suggested using X visual ID %d (%d bpp) for config %d (%d bpp), but the depths do not match!", - (int)visualId, chosenVisualInfo->depth, (int)config, configBitDepth); + (int)visualId, chosenVisualInfo->depth, configId, configBitDepth); visualId = 0; } } @@ -187,9 +190,9 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config) if (visualId) { #ifdef QT_DEBUG_X11_VISUAL_SELECTION if (configAlphaSize > 0) - qDebug("Using ARGB Visual ID %d provided by EGL for config %d", (int)visualId, (int)config); + qDebug("Using ARGB Visual ID %d provided by EGL for config %d", (int)visualId, configId); else - qDebug("Using Opaque Visual ID %d provided by EGL for config %d", (int)visualId, (int)config); + qDebug("Using Opaque Visual ID %d provided by EGL for config %d", (int)visualId, configId); #endif return visualId; } @@ -232,9 +235,9 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config) if (visualId) { # ifdef QT_DEBUG_X11_VISUAL_SELECTION if (configAlphaSize > 0) - qDebug("Using ARGB Visual ID %d provided by XRender for EGL config %d", (int)visualId, (int)config); + qDebug("Using ARGB Visual ID %d provided by XRender for EGL config %d", (int)visualId, configId); else - qDebug("Using Opaque Visual ID %d provided by XRender for EGL config %d", (int)visualId, (int)config); + qDebug("Using Opaque Visual ID %d provided by XRender for EGL config %d", (int)visualId, configId); # endif // QT_DEBUG_X11_VISUAL_SELECTION return visualId; } @@ -263,12 +266,12 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config) if (visualId) { #ifdef QT_DEBUG_X11_VISUAL_SELECTION - qDebug("Using Visual ID %d provided by XGetVisualInfo for EGL config %d", (int)visualId, (int)config); + qDebug("Using Visual ID %d provided by XGetVisualInfo for EGL config %d", (int)visualId, configId); #endif return visualId; } - qWarning("Unable to find an X11 visual which matches EGL config %d", (int)config); + qWarning("Unable to find an X11 visual which matches EGL config %d", configId); return (VisualID)0; } diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 5735cd6..4f06f80 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -3179,9 +3179,8 @@ void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool clim */ void QGraphicsItem::clearFocus() { - // Pass focus to the closest parent focus scope when clearing focus - // from a focus scope. - if (!d_ptr->inDestructor && (d_ptr->flags & ItemIsFocusScope)) { + // Pass focus to the closest parent focus scope. + if (!d_ptr->inDestructor) { QGraphicsItem *p = d_ptr->parent; while (p) { if (p->flags() & ItemIsFocusScope) { diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index d72833b..56f94a2 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -540,10 +540,10 @@ class Q_GUI_EXPORT QGraphicsObject : public QObject, public QGraphicsItem Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged FINAL) Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged FINAL) - Q_PROPERTY(QPointF pos READ pos WRITE setPos) - Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged) - Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged) - Q_PROPERTY(qreal z READ zValue WRITE setZValue NOTIFY zChanged) + Q_PROPERTY(QPointF pos READ pos WRITE setPos FINAL) + Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged FINAL) + Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged FINAL) + Q_PROPERTY(qreal z READ zValue WRITE setZValue NOTIFY zChanged FINAL) Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged) Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged) Q_PROPERTY(QPointF transformOriginPoint READ transformOriginPoint WRITE setTransformOriginPoint) diff --git a/src/gui/graphicsview/qgraphicslinearlayout.cpp b/src/gui/graphicsview/qgraphicslinearlayout.cpp index 6a9eb29..9722683 100644 --- a/src/gui/graphicsview/qgraphicslinearlayout.cpp +++ b/src/gui/graphicsview/qgraphicslinearlayout.cpp @@ -554,6 +554,8 @@ void QGraphicsLinearLayout::dump(int indent) const d->orientation == Qt::Horizontal ? "Horizontal" : "Vertical"); d->engine.dump(indent + 1); } +#else + Q_UNUSED(indent); #endif } diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp index 2792e45..0abf51f 100644 --- a/src/gui/image/qpixmapfilter.cpp +++ b/src/gui/image/qpixmapfilter.cpp @@ -726,7 +726,7 @@ void expblur(QImage &img, qreal radius, bool improvedQuality = false, int transp int img_height = img.height(); for (int row = 0; row < img_height; ++row) { - for (int i = 0; i <= improvedQuality; ++i) + for (int i = 0; i <= int(improvedQuality); ++i) qt_blurrow<aprec, zprec, alphaOnly>(img, row, alpha); } @@ -759,7 +759,7 @@ void expblur(QImage &img, qreal radius, bool improvedQuality = false, int transp img_height = temp.height(); for (int row = 0; row < img_height; ++row) { - for (int i = 0; i <= improvedQuality; ++i) + for (int i = 0; i <= int(improvedQuality); ++i) qt_blurrow<aprec, zprec, alphaOnly>(temp, row, alpha); } diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp index 5128b64..eb3db21 100644 --- a/src/gui/itemviews/qheaderview.cpp +++ b/src/gui/itemviews/qheaderview.cpp @@ -2037,7 +2037,7 @@ bool QHeaderView::event(QEvent *e) updateSection(d->hover); } break; } - case QEvent::Timer: { // ### reimplement timerEvent() instead ? + case QEvent::Timer: { QTimerEvent *te = static_cast<QTimerEvent*>(e); if (te->timerId() == d->delayedResize.timerId()) { d->delayedResize.stop(); @@ -2610,7 +2610,7 @@ void QHeaderView::updateGeometries() Q_D(QHeaderView); d->layoutChildren(); if (d->hasAutoResizeSections()) - resizeSections(); + d->doDelayedResizeSections(); } /*! diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp index 3111896..bdc1205 100644 --- a/src/gui/itemviews/qtableview.cpp +++ b/src/gui/itemviews/qtableview.cpp @@ -1960,12 +1960,7 @@ QModelIndexList QTableView::selectedIndexes() const void QTableView::rowCountChanged(int /*oldCount*/, int /*newCount*/ ) { Q_D(QTableView); - updateGeometries(); - if (verticalScrollMode() == QAbstractItemView::ScrollPerItem) - d->verticalHeader->setOffsetToSectionPosition(verticalScrollBar()->value()); - else - d->verticalHeader->setOffset(verticalScrollBar()->value()); - d->viewport->update(); + d->doDelayedItemsLayout(); } /*! diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index 37168eb..1145235 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -2524,8 +2524,7 @@ void QTreeView::rowsInserted(const QModelIndex &parent, int start, int end) d->viewItems[parentItem].hasChildren = true; d->updateChildCount(parentItem, delta); - updateGeometries(); - viewport()->update(); + d->doDelayedItemsLayout(); } else if ((parentItem != -1) && d->viewItems.at(parentItem).expanded) { d->doDelayedItemsLayout(); } else if (parentItem != -1 && (d->model->rowCount(parent) == end - start + 1)) { @@ -3780,8 +3779,7 @@ void QTreeViewPrivate::rowsRemoved(const QModelIndex &parent, } } if (after) { - q->updateGeometries(); - viewport->update(); + doDelayedItemsLayout(); } else { //we have removed items: we should at least update the scroll bar values. // They are used to determine the item geometry. diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index 9560952..c776b2a 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -373,7 +373,7 @@ QMacTabletHash *qt_mac_tablet_hash() // Clears the QWidget pointer that each QCocoaView holds. void qt_mac_clearCocoaViewQWidgetPointers(QWidget *widget) { - QCocoaView *cocoaView = reinterpret_cast<QCocoaView *>(qt_mac_nativeview_for(widget)); + QT_MANGLE_NAMESPACE(QCocoaView) *cocoaView = reinterpret_cast<QT_MANGLE_NAMESPACE(QCocoaView) *>(qt_mac_nativeview_for(widget)); if (cocoaView && [cocoaView respondsToSelector:@selector(qt_qwidget)]) { [cocoaView qt_clearQWidget]; } diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 2f6ec6b..aa5d259 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -5339,7 +5339,6 @@ void QWidgetPrivate::render(QPaintDevice *target, const QPoint &targetOffset, const QRegion &sourceRegion, QWidget::RenderFlags renderFlags, bool readyToRender) { - Q_Q(QWidget); if (!target) { qWarning("QWidget::render: null pointer to paint device"); return; diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 891f4c2..acd286a 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -7813,7 +7813,6 @@ static void qt_blend_color_argb_armv6(int count, const QSpan *spans, void *userD void qInitDrawhelperAsm() { - const uint features = qDetectCPUFeatures(); qt_memfill32 = qt_memfill_template<quint32, quint32>; qt_memfill16 = qt_memfill_quint16; //qt_memfill_template<quint16, quint16>; @@ -7822,6 +7821,7 @@ void qInitDrawhelperAsm() CompositionFunctionSolid *functionForModeSolidAsm = 0; #ifdef QT_NO_DEBUG + const uint features = qDetectCPUFeatures(); if (false) { #ifdef QT_HAVE_SSE2 } else if (features & SSE2) { diff --git a/src/gui/painting/qprinter.cpp b/src/gui/painting/qprinter.cpp index edf224d..ae21416 100644 --- a/src/gui/painting/qprinter.cpp +++ b/src/gui/painting/qprinter.cpp @@ -382,6 +382,7 @@ void QPrinterPrivate::addToManualSetList(QPrintEngine::PrintEnginePropertyKey ke \value AllPages All pages should be printed. \value Selection Only the selection should be printed. \value PageRange The specified page range should be printed. + \value CurrentPage Only the current page should be printed. \sa QAbstractPrintDialog::PrintRange */ @@ -571,6 +572,7 @@ void QPrinterPrivate::addToManualSetList(QPrintEngine::PrintEnginePropertyKey ke \value AllPages All the pages should be printed. \value Selection Only the selection should be printed. \value PageRange Print according to the from page and to page options. + \value CurrentPage Only the current page should be printed. \sa setPrintRange(), printRange() */ @@ -586,6 +588,7 @@ void QPrinterPrivate::addToManualSetList(QPrintEngine::PrintEnginePropertyKey ke \value PrintSelection Describes if printing selections should be enabled. \value PrintPageRange Describes if printing page ranges (from, to) should be enabled + \value PrintCurrentPage if Print Current Page option should be enabled \sa setOptionEnabled(), isOptionEnabled() */ diff --git a/src/gui/painting/qprinter.h b/src/gui/painting/qprinter.h index 6636179..996a954 100644 --- a/src/gui/painting/qprinter.h +++ b/src/gui/painting/qprinter.h @@ -124,7 +124,7 @@ public: enum OutputFormat { NativeFormat, PdfFormat, PostScriptFormat }; // ### Qt 5: Merge with QAbstractPrintDialog::PrintRange - enum PrintRange { AllPages, Selection, PageRange }; + enum PrintRange { AllPages, Selection, PageRange, CurrentPage }; enum Unit { Millimeter, diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index f8464cc..b0e2d37 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -4760,7 +4760,7 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, int margins = 0; // we add 4 pixels for label margins - if (btn->icon.isNull() || !btn->text.isEmpty()) + if (!btn->icon.isNull() || !btn->text.isEmpty()) margins = 4 + proxy()->pixelMetric(isRadio ? PM_RadioButtonLabelSpacing : PM_CheckBoxLabelSpacing, opt, widget); sz += QSize(w + margins, 4); diff --git a/src/gui/widgets/qcheckbox.cpp b/src/gui/widgets/qcheckbox.cpp index 4e0ff66..bc0900e 100644 --- a/src/gui/widgets/qcheckbox.cpp +++ b/src/gui/widgets/qcheckbox.cpp @@ -291,7 +291,7 @@ QSize QCheckBox::sizeHint() const QFontMetrics fm = fontMetrics(); QStyleOptionButton opt; initStyleOption(&opt); - QSize sz = style()->itemTextRect(fm, QRect(0, 0, 1, 1), Qt::TextShowMnemonic, false, + QSize sz = style()->itemTextRect(fm, QRect(), Qt::TextShowMnemonic, false, text()).size(); if (!opt.icon.isNull()) sz = QSize(sz.width() + opt.iconSize.width() + 4, qMax(sz.height(), opt.iconSize.height())); diff --git a/src/gui/widgets/qcombobox.h b/src/gui/widgets/qcombobox.h index 9b19a66..fb9af9f 100644 --- a/src/gui/widgets/qcombobox.h +++ b/src/gui/widgets/qcombobox.h @@ -111,10 +111,10 @@ public: bool hasFrame() const; inline int findText(const QString &text, - Qt::MatchFlags flags = Qt::MatchExactly|Qt::MatchCaseSensitive) const + Qt::MatchFlags flags = static_cast<Qt::MatchFlags>(Qt::MatchExactly|Qt::MatchCaseSensitive)) const { return findData(text, Qt::DisplayRole, flags); } int findData(const QVariant &data, int role = Qt::UserRole, - Qt::MatchFlags flags = Qt::MatchExactly|Qt::MatchCaseSensitive) const; + Qt::MatchFlags flags = static_cast<Qt::MatchFlags>(Qt::MatchExactly|Qt::MatchCaseSensitive)) const; enum InsertPolicy { NoInsert, diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp index c1b1ea3..f44858a 100644 --- a/src/gui/widgets/qdockarealayout.cpp +++ b/src/gui/widgets/qdockarealayout.cpp @@ -1985,7 +1985,10 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList<QDockWidget*> emit widget->dockLocationChanged(toDockWidgetArea(dockPos)); } } - + if (testing) { + //was it is not really added to the layout, we need to delete the object here + delete item.widgetItem; + } } } else if (nextMarker == SequenceMarker) { int dummy; diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index e2cf25b..9a4916e 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -85,9 +85,8 @@ QT_BEGIN_NAMESPACE -QPointer<QMenu> QMenuPrivate::mouseDown; -QBasicTimer QMenuPrivate::menuDelayTimer; -QBasicTimer QMenuPrivate::sloppyDelayTimer; +QMenu *QMenuPrivate::mouseDown = 0; +int QMenuPrivate::sloppyDelayTimer = 0; /* QMenu code */ // internal class used for the torn off popup @@ -487,8 +486,8 @@ void QMenuPrivate::popupAction(QAction *action, int delay, bool activateFirst) if (action && action->isEnabled()) { if (!delay) q->internalDelayedPopup(); - else - QMenuPrivate::menuDelayTimer.start(delay, q); + else if (!menuDelayTimer.isActive() && (!action->menu() || !action->menu()->isVisible())) + menuDelayTimer.start(delay, q); if (activateFirst && action->menu()) action->menu()->d_func()->setFirstActionActive(); } else if (QMenu *menu = activeMenu) { //hide the current item @@ -543,15 +542,6 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason { Q_Q(QMenu); tearoffHighlighted = 0; - if (action == currentAction) { - if (!action || !action->menu() || action->menu() == activeMenu) { - if(QMenu *menu = qobject_cast<QMenu*>(causedPopup.widget)) { - if(causedPopup.action && menu->d_func()->activeMenu == q) - menu->d_func()->setCurrentAction(causedPopup.action, 0, reason, false); - } - } - return; - } if (currentAction) q->update(actionRect(currentAction)); @@ -565,6 +555,7 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason #ifdef QT3_SUPPORT emitHighlighted = action; #endif + currentAction = action; if (action) { if (!action->isSeparator()) { @@ -2383,8 +2374,8 @@ QMenu::event(QEvent *e) } } break; case QEvent::ContextMenu: - if(QMenuPrivate::menuDelayTimer.isActive()) { - QMenuPrivate::menuDelayTimer.stop(); + if(d->menuDelayTimer.isActive()) { + d->menuDelayTimer.stop(); internalDelayedPopup(); } break; @@ -2817,7 +2808,7 @@ void QMenu::mouseMoveEvent(QMouseEvent *e) } if (d->sloppyRegion.contains(e->pos())) { d->sloppyAction = action; - QMenuPrivate::sloppyDelayTimer.start(style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, 0, this)*6, this); + QMenuPrivate::sloppyDelayTimer = startTimer(style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, 0, this)*6); } else { d->setCurrentAction(action, style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, 0, this)); } @@ -2855,11 +2846,12 @@ QMenu::timerEvent(QTimerEvent *e) d->scrollMenu((QMenuPrivate::QMenuScroller::ScrollDirection)d->scroll->scrollDirection); if (d->scroll->scrollFlags == QMenuPrivate::QMenuScroller::ScrollNone) d->scroll->scrollTimer.stop(); - } else if(QMenuPrivate::menuDelayTimer.timerId() == e->timerId()) { - QMenuPrivate::menuDelayTimer.stop(); + } else if(d->menuDelayTimer.timerId() == e->timerId()) { + d->menuDelayTimer.stop(); internalDelayedPopup(); - } else if(QMenuPrivate::sloppyDelayTimer.timerId() == e->timerId()) { - QMenuPrivate::sloppyDelayTimer.stop(); + } else if(QMenuPrivate::sloppyDelayTimer == e->timerId()) { + killTimer(QMenuPrivate::sloppyDelayTimer); + QMenuPrivate::sloppyDelayTimer = 0; internalSetSloppyAction(); } else if(d->searchBufferTimer.timerId() == e->timerId()) { d->searchBuffer.clear(); diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h index aaed6b1..276ffe6 100644 --- a/src/gui/widgets/qmenu_p.h +++ b/src/gui/widgets/qmenu_p.h @@ -202,7 +202,7 @@ public: bool activationRecursionGuard; //selection - static QPointer<QMenu> mouseDown; + static QMenu *mouseDown; QPoint mousePopupPos; uint hasHadMouse : 1; uint aboutToHide : 1; @@ -212,7 +212,7 @@ public: QAction *selectAction; QAction *cancelAction; #endif - static QBasicTimer menuDelayTimer; + QBasicTimer menuDelayTimer; enum SelectionReason { SelectedFromKeyboard, SelectedFromElsewhere @@ -272,7 +272,7 @@ public: mutable bool hasCheckableItems; //sloppy selection - static QBasicTimer sloppyDelayTimer; + static int sloppyDelayTimer; mutable QAction *sloppyAction; QRegion sloppyRegion; diff --git a/src/gui/widgets/qradiobutton.cpp b/src/gui/widgets/qradiobutton.cpp index d73ff2f..20b6c720 100644 --- a/src/gui/widgets/qradiobutton.cpp +++ b/src/gui/widgets/qradiobutton.cpp @@ -195,7 +195,7 @@ QSize QRadioButton::sizeHint() const ensurePolished(); QStyleOptionButton opt; initStyleOption(&opt); - QSize sz = style()->itemTextRect(fontMetrics(), QRect(0, 0, 1, 1), Qt::TextShowMnemonic, + QSize sz = style()->itemTextRect(fontMetrics(), QRect(), Qt::TextShowMnemonic, false, text()).size(); if (!opt.icon.isNull()) sz = QSize(sz.width() + opt.iconSize.width() + 4, qMax(sz.height(), opt.iconSize.height())); diff --git a/src/imports/multimedia/multimedia.cpp b/src/imports/multimedia/multimedia.cpp index 8becbf3..a2e74f4 100644 --- a/src/imports/multimedia/multimedia.cpp +++ b/src/imports/multimedia/multimedia.cpp @@ -41,17 +41,27 @@ #include <QtDeclarative/qdeclarativeextensionplugin.h> #include <QtDeclarative/qdeclarative.h> -#include <QtMultimedia/multimediadeclarative.h> +#include <QtMultimedia/private/qsoundeffect_p.h> + +#include "qdeclarativevideo_p.h" +#include "qdeclarativeaudio_p.h" + + +QML_DECLARE_TYPE(QSoundEffect) QT_BEGIN_NAMESPACE -class QMultimediaQmlModule : public QDeclarativeExtensionPlugin +class QMultimediaDeclarativeModule : public QDeclarativeExtensionPlugin { Q_OBJECT public: virtual void registerTypes(const char *uri) { - QtMultimedia::qRegisterDeclarativeElements(uri); + Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.multimedia")); + + qmlRegisterType<QSoundEffect>(uri, 4, 7, "SoundEffect"); + qmlRegisterType<QDeclarativeAudio>(uri, 4, 7, "Audio"); + qmlRegisterType<QDeclarativeVideo>(uri, 4, 7, "Video"); } }; @@ -59,5 +69,5 @@ QT_END_NAMESPACE #include "multimedia.moc" -Q_EXPORT_PLUGIN2(qmultimediaqmlmodule, QT_PREPEND_NAMESPACE(QMultimediaQmlModule)); +Q_EXPORT_PLUGIN2(qmultimediadeclarativemodule, QT_PREPEND_NAMESPACE(QMultimediaDeclarativeModule)); diff --git a/src/imports/multimedia/multimedia.pro b/src/imports/multimedia/multimedia.pro index ad2ce1b..117aa9b 100644 --- a/src/imports/multimedia/multimedia.pro +++ b/src/imports/multimedia/multimedia.pro @@ -4,7 +4,18 @@ include(../qimportbase.pri) QT += multimedia declarative -SOURCES += multimedia.cpp +HEADERS += \ + qdeclarativeaudio_p.h \ + qdeclarativemediabase_p.h \ + qdeclarativevideo_p.h \ + qmetadatacontrolmetaobject_p.h \ + +SOURCES += \ + multimedia.cpp \ + qdeclarativeaudio.cpp \ + qdeclarativemediabase.cpp \ + qdeclarativevideo.cpp \ + qmetadatacontrolmetaobject.cpp QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/Qt/multimedia target.path = $$TARGETPATH diff --git a/src/multimedia/qml/qdeclarativeaudio.cpp b/src/imports/multimedia/qdeclarativeaudio.cpp index 1cbf594..df2888c 100644 --- a/src/multimedia/qml/qdeclarativeaudio.cpp +++ b/src/imports/multimedia/qdeclarativeaudio.cpp @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtMultimedia module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/multimedia/qml/qdeclarativeaudio_p.h b/src/imports/multimedia/qdeclarativeaudio_p.h index d1fb275..9881dbc 100644 --- a/src/multimedia/qml/qdeclarativeaudio_p.h +++ b/src/imports/multimedia/qdeclarativeaudio_p.h @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtMultimedia module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -53,7 +53,7 @@ // We mean it. // -#include <QtMultimedia/private/qdeclarativemediabase_p.h> +#include "qdeclarativemediabase_p.h" #include <QtCore/qbasictimer.h> #include <QtDeclarative/qdeclarativeitem.h> @@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE class QTimerEvent; -class Q_AUTOTEST_EXPORT QDeclarativeAudio : public QObject, public QDeclarativeMediaBase, public QDeclarativeParserStatus +class QDeclarativeAudio : public QObject, public QDeclarativeMediaBase, public QDeclarativeParserStatus { Q_OBJECT Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) diff --git a/src/multimedia/qml/qdeclarativemediabase.cpp b/src/imports/multimedia/qdeclarativemediabase.cpp index e054cb2..8e87e44 100644 --- a/src/multimedia/qml/qdeclarativemediabase.cpp +++ b/src/imports/multimedia/qdeclarativemediabase.cpp @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtMultimedia module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "QtMultimedia/private/qdeclarativemediabase_p.h" +#include "qdeclarativemediabase_p.h" #include <QtCore/qcoreevent.h> #include <QtCore/qurl.h> @@ -48,7 +48,7 @@ #include <QtMultimedia/qmediaservice.h> #include <QtMultimedia/qmediaserviceprovider.h> #include <QtMultimedia/qmetadatacontrol.h> -#include <QtMultimedia/private/qmetadatacontrolmetaobject_p.h> +#include "qmetadatacontrolmetaobject_p.h" diff --git a/src/multimedia/qml/qdeclarativemediabase_p.h b/src/imports/multimedia/qdeclarativemediabase_p.h index 2fc48db..b40e84e 100644 --- a/src/multimedia/qml/qdeclarativemediabase_p.h +++ b/src/imports/multimedia/qdeclarativemediabase_p.h @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtMultimedia module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -67,7 +67,7 @@ class QMetaDataControl; class QMetaDataControlMetaObject; class QDeclarativeMediaBaseAnimation; -class Q_AUTOTEST_EXPORT QDeclarativeMediaBase +class QDeclarativeMediaBase { public: QDeclarativeMediaBase(); diff --git a/src/multimedia/qml/qdeclarativevideo.cpp b/src/imports/multimedia/qdeclarativevideo.cpp index 7f62075..064f242 100644 --- a/src/multimedia/qml/qdeclarativevideo.cpp +++ b/src/imports/multimedia/qdeclarativevideo.cpp @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtMultimedia module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/multimedia/qml/qdeclarativevideo_p.h b/src/imports/multimedia/qdeclarativevideo_p.h index d5ebde1..fb13519 100644 --- a/src/multimedia/qml/qdeclarativevideo_p.h +++ b/src/imports/multimedia/qdeclarativevideo_p.h @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtMultimedia module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -53,7 +53,7 @@ // We mean it. // -#include <QtMultimedia/private/qdeclarativemediabase_p.h> +#include "qdeclarativemediabase_p.h" #include <QtMultimedia/qgraphicsvideoitem.h> @@ -69,7 +69,7 @@ class QTimerEvent; class QVideoSurfaceFormat; -class Q_AUTOTEST_EXPORT QDeclarativeVideo : public QDeclarativeItem, public QDeclarativeMediaBase +class QDeclarativeVideo : public QDeclarativeItem, public QDeclarativeMediaBase { Q_OBJECT Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) diff --git a/src/multimedia/qml/qmetadatacontrolmetaobject.cpp b/src/imports/multimedia/qmetadatacontrolmetaobject.cpp index 47b6382..e90cbd6 100644 --- a/src/multimedia/qml/qmetadatacontrolmetaobject.cpp +++ b/src/imports/multimedia/qmetadatacontrolmetaobject.cpp @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtMultimedia module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include <QtMultimedia/private/qmetadatacontrolmetaobject_p.h> +#include "qmetadatacontrolmetaobject_p.h" #include <QtMultimedia/qmetadatacontrol.h> diff --git a/src/multimedia/qml/qmetadatacontrolmetaobject_p.h b/src/imports/multimedia/qmetadatacontrolmetaobject_p.h index ec4df05..c381f2d 100644 --- a/src/multimedia/qml/qmetadatacontrolmetaobject_p.h +++ b/src/imports/multimedia/qmetadatacontrolmetaobject_p.h @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtMultimedia module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/multimedia/base/qmediaserviceprovider.cpp b/src/multimedia/base/qmediaserviceprovider.cpp index d51d682..6e11079 100644 --- a/src/multimedia/base/qmediaserviceprovider.cpp +++ b/src/multimedia/base/qmediaserviceprovider.cpp @@ -102,6 +102,9 @@ public: \value RecordingSupport The service provides audio or video recording functions. + + \value StreamPlayback + The service is capable of playing QIODevice based streams. */ /*! @@ -396,14 +399,25 @@ public: QMediaServiceSupportedFormatsInterface *iface = qobject_cast<QMediaServiceSupportedFormatsInterface*>(obj); - //if low latency playback was asked, skip services known - //not to provide low latency playback - if (flags & QMediaPlayer::LowLatency) { + + if (flags) { QMediaServiceFeaturesInterface *iface = qobject_cast<QMediaServiceFeaturesInterface*>(obj); - if (iface && !(iface->supportedFeatures(serviceType) & QMediaServiceProviderHint::LowLatencyPlayback)) - continue; + if (iface) { + QMediaServiceProviderHint::Features features = iface->supportedFeatures(serviceType); + + //if low latency playback was asked, skip services known + //not to provide low latency playback + if ((flags & QMediaPlayer::LowLatency) && + !(features & QMediaServiceProviderHint::LowLatencyPlayback)) + continue; + + //the same for QIODevice based streams support + if ((flags & QMediaPlayer::StreamPlayback) && + !(features & QMediaServiceProviderHint::StreamPlayback)) + continue; + } } if (iface) @@ -434,14 +448,25 @@ public: QMediaServiceSupportedFormatsInterface *iface = qobject_cast<QMediaServiceSupportedFormatsInterface*>(obj); - // If low latency playback was asked for, skip MIME types from services known - // not to provide low latency playback + if (flags & QMediaPlayer::LowLatency) { QMediaServiceFeaturesInterface *iface = qobject_cast<QMediaServiceFeaturesInterface*>(obj); - if (iface && !(iface->supportedFeatures(serviceType) & QMediaServiceProviderHint::LowLatencyPlayback)) - continue; + if (iface) { + QMediaServiceProviderHint::Features features = iface->supportedFeatures(serviceType); + + // If low latency playback was asked for, skip MIME types from services known + // not to provide low latency playback + if ((flags & QMediaPlayer::LowLatency) && + !(features & QMediaServiceProviderHint::LowLatencyPlayback)) + continue; + + //the same for QIODevice based streams support + if ((flags & QMediaPlayer::StreamPlayback) && + !(features & QMediaServiceProviderHint::StreamPlayback)) + continue; + } } if (iface) { diff --git a/src/multimedia/base/qmediaserviceprovider.h b/src/multimedia/base/qmediaserviceprovider.h index 2ee0ae4..6e31493 100644 --- a/src/multimedia/base/qmediaserviceprovider.h +++ b/src/multimedia/base/qmediaserviceprovider.h @@ -64,7 +64,8 @@ public: enum Feature { LowLatencyPlayback = 0x01, - RecordingSupport = 0x02 + RecordingSupport = 0x02, + StreamPlayback = 0x04 }; Q_DECLARE_FLAGS(Features, Feature) diff --git a/src/multimedia/effects/effects.pri b/src/multimedia/effects/effects.pri new file mode 100644 index 0000000..ff762e8 --- /dev/null +++ b/src/multimedia/effects/effects.pri @@ -0,0 +1,25 @@ + + +unix { + unix:contains(QT_CONFIG, pulseaudio) { + DEFINES += QT_MULTIMEDIA_PULSEAUDIO + HEADERS += $$PWD/qsoundeffect_pulse_p.h + SOURCES += $$PWD/qsoundeffect_pulse_p.cpp + LIBS += -lpulse + } else { + DEFINES += QT_MULTIMEDIA_QMEDIAPLAYER + HEADERS += $$PWD/qsoundeffect_qmedia_p.h + SOURCES += $$PWD/qsoundeffect_qmedia_p.cpp + } +} else { + HEADERS += $$PWD/qsoundeffect_qsound_p.h + SOURCES += $$PWD/qsoundeffect_qsound_p.cpp +} + +HEADERS += \ + $$PWD/qsoundeffect_p.h \ + $$PWD/wavedecoder_p.h + +SOURCES += \ + $$PWD/qsoundeffect.cpp \ + $$PWD/wavedecoder_p.cpp diff --git a/src/multimedia/qml/qsoundeffect.cpp b/src/multimedia/effects/qsoundeffect.cpp index 541e6c9..2694023 100644 --- a/src/multimedia/qml/qsoundeffect.cpp +++ b/src/multimedia/effects/qsoundeffect.cpp @@ -66,7 +66,7 @@ QT_BEGIN_NAMESPACE id: playSound source: "test.wav" } - MouseRegion { + MouseArea { id: playArea anchors.fill: parent onPressed: { diff --git a/src/multimedia/qml/qsoundeffect_p.h b/src/multimedia/effects/qsoundeffect_p.h index 51ebe52..c5554bf 100644 --- a/src/multimedia/qml/qsoundeffect_p.h +++ b/src/multimedia/effects/qsoundeffect_p.h @@ -56,7 +56,6 @@ #include <QtCore/qobject.h> #include <QtCore/qurl.h> -#include <QtDeclarative/qdeclarative.h> QT_BEGIN_HEADER @@ -64,7 +63,7 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE class QSoundEffectPrivate; -class Q_AUTOTEST_EXPORT QSoundEffect : public QObject +class Q_MULTIMEDIA_EXPORT QSoundEffect : public QObject { Q_OBJECT Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) @@ -118,8 +117,6 @@ private: QT_END_NAMESPACE -QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QSoundEffect)) - QT_END_HEADER diff --git a/src/multimedia/qml/qsoundeffect_pulse_p.cpp b/src/multimedia/effects/qsoundeffect_pulse_p.cpp index 7e9a25c..7e9a25c 100644 --- a/src/multimedia/qml/qsoundeffect_pulse_p.cpp +++ b/src/multimedia/effects/qsoundeffect_pulse_p.cpp diff --git a/src/multimedia/qml/qsoundeffect_pulse_p.h b/src/multimedia/effects/qsoundeffect_pulse_p.h index 247f8a3..247f8a3 100644 --- a/src/multimedia/qml/qsoundeffect_pulse_p.h +++ b/src/multimedia/effects/qsoundeffect_pulse_p.h diff --git a/src/multimedia/qml/qsoundeffect_qmedia_p.cpp b/src/multimedia/effects/qsoundeffect_qmedia_p.cpp index 48fb257..48fb257 100644 --- a/src/multimedia/qml/qsoundeffect_qmedia_p.cpp +++ b/src/multimedia/effects/qsoundeffect_qmedia_p.cpp diff --git a/src/multimedia/qml/qsoundeffect_qmedia_p.h b/src/multimedia/effects/qsoundeffect_qmedia_p.h index 8267f79..8267f79 100644 --- a/src/multimedia/qml/qsoundeffect_qmedia_p.h +++ b/src/multimedia/effects/qsoundeffect_qmedia_p.h diff --git a/src/multimedia/qml/qsoundeffect_qsound_p.cpp b/src/multimedia/effects/qsoundeffect_qsound_p.cpp index df160a9..df160a9 100644 --- a/src/multimedia/qml/qsoundeffect_qsound_p.cpp +++ b/src/multimedia/effects/qsoundeffect_qsound_p.cpp diff --git a/src/multimedia/qml/qsoundeffect_qsound_p.h b/src/multimedia/effects/qsoundeffect_qsound_p.h index 45c0888..45c0888 100644 --- a/src/multimedia/qml/qsoundeffect_qsound_p.h +++ b/src/multimedia/effects/qsoundeffect_qsound_p.h diff --git a/src/multimedia/qml/wavedecoder_p.cpp b/src/multimedia/effects/wavedecoder_p.cpp index f2277ae..b534ded 100644 --- a/src/multimedia/qml/wavedecoder_p.cpp +++ b/src/multimedia/effects/wavedecoder_p.cpp @@ -55,7 +55,7 @@ WaveDecoder::WaveDecoder(QIODevice *s, QObject *parent): { open(QIODevice::ReadOnly | QIODevice::Unbuffered); - if (source->bytesAvailable() >= sizeof(CombinedHeader)) + if (source->bytesAvailable() >= qint64(sizeof(CombinedHeader) + sizeof(DATAHeader) + sizeof(quint16))) QTimer::singleShot(0, this, SLOT(handleData())); else connect(source, SIGNAL(readyRead()), SLOT(handleData())); @@ -105,7 +105,7 @@ qint64 WaveDecoder::writeData(const char *data, qint64 len) void WaveDecoder::handleData() { - if (source->bytesAvailable() < sizeof(CombinedHeader)) + if (source->bytesAvailable() < qint64(sizeof(CombinedHeader) + sizeof(DATAHeader) + sizeof(quint16))) return; source->disconnect(SIGNAL(readyRead()), this, SLOT(handleData())); @@ -114,12 +114,23 @@ void WaveDecoder::handleData() if (qstrncmp(header.riff.descriptor.id, "RIFF", 4) != 0 || qstrncmp(header.riff.type, "WAVE", 4) != 0 || qstrncmp(header.wave.descriptor.id, "fmt ", 4) != 0 || - (header.wave.audioFormat != 0 && header.wave.audioFormat != 1) || - qstrncmp(header.data.descriptor.id, "data", 4) != 0) { + (header.wave.audioFormat != 0 && header.wave.audioFormat != 1)) { emit invalidFormat(); } else { + DATAHeader dataHeader; + + if (qFromLittleEndian<quint32>(header.wave.descriptor.size) > sizeof(WAVEHeader)) { + // Extended data available + quint16 extraFormatBytes; + source->peek((char*)&extraFormatBytes, sizeof(quint16)); + extraFormatBytes = qFromLittleEndian<quint16>(extraFormatBytes); + source->read(sizeof(quint16) + extraFormatBytes); // dump it all + } + + source->read((char*)&dataHeader, sizeof(DATAHeader)); + int bps = qFromLittleEndian<quint16>(header.wave.bitsPerSample); format.setCodec(QLatin1String("audio/pcm")); @@ -129,7 +140,7 @@ void WaveDecoder::handleData() format.setSampleSize(bps); format.setChannels(qFromLittleEndian<quint16>(header.wave.numChannels)); - dataSize = qFromLittleEndian<quint32>(header.data.descriptor.size); + dataSize = qFromLittleEndian<quint32>(dataHeader.descriptor.size); haveFormat = true; connect(source, SIGNAL(readyRead()), SIGNAL(readyRead())); diff --git a/src/multimedia/qml/wavedecoder_p.h b/src/multimedia/effects/wavedecoder_p.h index 00aa14e..fa1f77e 100644 --- a/src/multimedia/qml/wavedecoder_p.h +++ b/src/multimedia/effects/wavedecoder_p.h @@ -116,7 +116,6 @@ private: { RIFFHeader riff; WAVEHeader wave; - DATAHeader data; }; bool haveFormat; diff --git a/src/multimedia/multimedia.pro b/src/multimedia/multimedia.pro index 106d3ab..500aff7 100644 --- a/src/multimedia/multimedia.pro +++ b/src/multimedia/multimedia.pro @@ -12,6 +12,6 @@ include(audio/audio.pri) include(video/video.pri) include(base/base.pri) include(playback/playback.pri) -include(qml/qml.pri) +include(effects/effects.pri) symbian: TARGET.UID3 = 0x2001E627 diff --git a/src/multimedia/playback/qmediaplayer.cpp b/src/multimedia/playback/qmediaplayer.cpp index 27bff02..9466cad 100644 --- a/src/multimedia/playback/qmediaplayer.cpp +++ b/src/multimedia/playback/qmediaplayer.cpp @@ -43,6 +43,7 @@ #include <QtCore/qmetaobject.h> #include <QtCore/qtimer.h> #include <QtCore/qpointer.h> +#include <QtCore/qdebug.h> #include <QtMultimedia/qmediaplayer.h> @@ -55,6 +56,7 @@ #include <QtMultimedia/qvideowidget.h> #include <QtMultimedia/qgraphicsvideoitem.h> +//#define DEBUG_PLAYER_STATE QT_BEGIN_HEADER @@ -152,10 +154,16 @@ public: void _q_playlistDestroyed(); }; +#define ENUM_NAME(c,e,v) (c::staticMetaObject.enumerator(c::staticMetaObject.indexOfEnumerator(e)).valueToKey((v))) + void QMediaPlayerPrivate::_q_stateChanged(QMediaPlayer::State ps) { Q_Q(QMediaPlayer); +#ifdef DEBUG_PLAYER_STATE + qDebug() << "State changed:" << ENUM_NAME(QMediaPlayer, "State", ps) << (filterStates ? "(filtered)" : ""); +#endif + if (filterStates) return; @@ -183,6 +191,10 @@ void QMediaPlayerPrivate::_q_mediaStatusChanged(QMediaPlayer::MediaStatus status { Q_Q(QMediaPlayer); +#ifdef DEBUG_PLAYER_STATE + qDebug() << "MediaStatus changed:" << ENUM_NAME(QMediaPlayer, "MediaStatus", status); +#endif + switch (status) { case QMediaPlayer::StalledMedia: case QMediaPlayer::BufferingMedia: @@ -230,8 +242,12 @@ void QMediaPlayerPrivate::_q_updateMedia(const QMediaContent &media) state = control->state(); - if (state != currentState) + if (state != currentState) { +#ifdef DEBUG_PLAYER_STATE + qDebug() << "State changed:" << ENUM_NAME(QMediaPlayer, "State", state); +#endif emit q_func()->stateChanged(state); + } } void QMediaPlayerPrivate::_q_playlistDestroyed() @@ -243,10 +259,17 @@ void QMediaPlayerPrivate::_q_playlistDestroyed() static QMediaService *playerService(QMediaPlayer::Flags flags, QMediaServiceProvider *provider) { - if (flags && QMediaPlayer::LowLatency) + if (flags) { + QMediaServiceProviderHint::Features features = 0; + if (flags & QMediaPlayer::LowLatency) + features |= QMediaServiceProviderHint::LowLatencyPlayback; + + if (flags & QMediaPlayer::StreamPlayback) + features |= QMediaServiceProviderHint::StreamPlayback; + return provider->requestService(Q_MEDIASERVICE_MEDIAPLAYER, - QMediaServiceProviderHint(QMediaServiceProviderHint::LowLatencyPlayback)); - else + QMediaServiceProviderHint(features)); + } else return provider->requestService(Q_MEDIASERVICE_MEDIAPLAYER); } @@ -945,6 +968,11 @@ QStringList QMediaPlayer::supportedMimeTypes(Flags flags) The player is expected to be used with simple audio formats, but playback should start without significant delay. Such playback service can be used for beeps, ringtones, etc. + + \value StreamPlayback + The player is expected to play QIODevice based streams. + If passed to QMediaPlayer constructor, the service supporting + streams playback will be choosen. */ QT_END_NAMESPACE diff --git a/src/multimedia/playback/qmediaplayer.h b/src/multimedia/playback/qmediaplayer.h index 1b761ce..129b244 100644 --- a/src/multimedia/playback/qmediaplayer.h +++ b/src/multimedia/playback/qmediaplayer.h @@ -99,7 +99,8 @@ public: enum Flag { - LowLatency = 0x01 + LowLatency = 0x01, + StreamPlayback = 0x02 }; Q_DECLARE_FLAGS(Flags, Flag) diff --git a/src/multimedia/qml/multimediadeclarative.cpp b/src/multimedia/qml/multimediadeclarative.cpp deleted file mode 100644 index 7f5298f..0000000 --- a/src/multimedia/qml/multimediadeclarative.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtMultimedia module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtMultimedia/multimediadeclarative.h> -#include <QtMultimedia/private/qsoundeffect_p.h> -#include <QtMultimedia/private/qdeclarativeaudio_p.h> -#include <QtMultimedia/private/qdeclarativevideo_p.h> - - -QT_BEGIN_NAMESPACE - -namespace QtMultimedia -{ - -/*! - Register the Multimedia QML elements. - \internal -*/ - -void qRegisterDeclarativeElements(const char *uri) -{ - Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.multimedia")); - - qmlRegisterType<QSoundEffect>(uri, 4, 7, "SoundEffect"); - qmlRegisterType<QDeclarativeAudio>(uri, 4, 7, "Audio"); - qmlRegisterType<QDeclarativeVideo>(uri, 4, 7, "Video"); -} - -} - -QT_END_NAMESPACE - diff --git a/src/multimedia/qml/multimediadeclarative.h b/src/multimedia/qml/multimediadeclarative.h deleted file mode 100644 index 29af65a..0000000 --- a/src/multimedia/qml/multimediadeclarative.h +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtMultimedia module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTMULTIMEDIA_QML_H -#define QTMULTIMEDIA_QML_H - -#include <QtCore/qglobal.h> - -QT_BEGIN_HEADER -QT_BEGIN_NAMESPACE - -QT_MODULE(Multimedia) - -namespace QtMultimedia -{ -extern void Q_MULTIMEDIA_EXPORT qRegisterDeclarativeElements(const char *uri); -} - -QT_END_NAMESPACE -QT_END_HEADER - -#endif // ifndef QTMULTIMEDIA_QML_H diff --git a/src/multimedia/qml/qml.pri b/src/multimedia/qml/qml.pri deleted file mode 100644 index d0ff71d..0000000 --- a/src/multimedia/qml/qml.pri +++ /dev/null @@ -1,37 +0,0 @@ - -contains(QT_CONFIG, declarative) { - QT += declarative - - system(pkg-config --exists \'libpulse >= 0.9.10\') { - DEFINES += QT_MULTIMEDIA_PULSEAUDIO - HEADERS += $$PWD/qsoundeffect_pulse_p.h - SOURCES += $$PWD/qsoundeffect_pulse_p.cpp - LIBS += -lpulse - } else:x11 { - DEFINES += QT_MULTIMEDIA_QMEDIAPLAYER - HEADERS += $$PWD/qsoundeffect_qmedia_p.h - SOURCES += $$PWD/qsoundeffect_qmedia_p.cpp - } else { - HEADERS += $$PWD/qsoundeffect_qsound_p.h - SOURCES += $$PWD/qsoundeffect_qsound_p.cpp - } - - HEADERS += \ - $$PWD/multimediadeclarative.h \ - $$PWD/qmetadatacontrolmetaobject_p.h \ - $$PWD/qdeclarativeaudio_p.h \ - $$PWD/qdeclarativevideo_p.h \ - $$PWD/qdeclarativemediabase_p.h \ - $$PWD/qsoundeffect_p.h \ - $$PWD/wavedecoder_p.h - - SOURCES += \ - $$PWD/multimediadeclarative.cpp \ - $$PWD/qmetadatacontrolmetaobject.cpp \ - $$PWD/qdeclarativeaudio.cpp \ - $$PWD/qdeclarativevideo.cpp \ - $$PWD/qdeclarativemediabase.cpp \ - $$PWD/qsoundeffect.cpp \ - $$PWD/wavedecoder_p.cpp -} - diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp index f1abab8..7bfcf27 100644 --- a/src/opengl/qgl_egl.cpp +++ b/src/opengl/qgl_egl.cpp @@ -40,8 +40,14 @@ ****************************************************************************/ #include <QtOpenGL/qgl.h> +#include <QtOpenGL/qglpixelbuffer.h> #include "qgl_p.h" #include "qgl_egl_p.h" +#include "qglpixelbuffer_p.h" + +#ifdef Q_WS_X11 +#include <QtGui/private/qpixmap_x11_p.h> +#endif QT_BEGIN_NAMESPACE @@ -154,12 +160,12 @@ void QGLContext::reset() void QGLContext::makeCurrent() { Q_D(QGLContext); - if (!d->valid || !d->eglContext || d->eglSurface == EGL_NO_SURFACE) { + if (!d->valid || !d->eglContext || d->eglSurfaceForDevice() == EGL_NO_SURFACE) { qWarning("QGLContext::makeCurrent(): Cannot make invalid context current"); return; } - if (d->eglContext->makeCurrent(d->eglSurface)) + if (d->eglContext->makeCurrent(d->eglSurfaceForDevice())) QGLContextPrivate::setCurrentContext(this); } @@ -179,7 +185,7 @@ void QGLContext::swapBuffers() const if (!d->valid || !d->eglContext) return; - d->eglContext->swapBuffers(d->eglSurface); + d->eglContext->swapBuffers(d->eglSurfaceForDevice()); } void QGLContextPrivate::destroyEglSurfaceForDevice() @@ -202,6 +208,27 @@ void QGLContextPrivate::destroyEglSurfaceForDevice() } } +EGLSurface QGLContextPrivate::eglSurfaceForDevice() const +{ + if (paintDevice->devType() == QInternal::Widget) + return eglSurface; + if (paintDevice->devType() == QInternal::Pixmap) { +#ifdef Q_WS_X11 + QPixmapData *pmd = static_cast<QPixmap*>(paintDevice)->data_ptr().data(); + if (pmd->classId() == QPixmapData::X11Class) { + QX11PixmapData* x11PixmapData = static_cast<QX11PixmapData*>(pmd); + return (EGLSurface)x11PixmapData->gl_surface; + } else +#endif + return eglSurface; + } + if (paintDevice->devType() == QInternal::Pbuffer) { + QGLPixelBuffer* pbuf = static_cast<QGLPixelBuffer*>(paintDevice); + return pbuf->d_func()->pbuf; + } + return EGL_NO_SURFACE; +} + void QGLWidget::setMouseTracking(bool enable) { QWidget::setMouseTracking(enable); diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index ecd8b43..c142715 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -65,13 +65,7 @@ #include "qglpaintdevice_p.h" #ifdef QT_OPENGL_ES -QT_BEGIN_INCLUDE_NAMESPACE -#if defined(QT_OPENGL_ES_2) -#include <EGL/egl.h> -#else -#include <GLES/egl.h> -#endif -QT_END_INCLUDE_NAMESPACE +#include <QtGui/private/qegl_p.h> #endif QT_BEGIN_NAMESPACE @@ -356,6 +350,7 @@ public: QEglContext *eglContext; EGLSurface eglSurface; void destroyEglSurfaceForDevice(); + EGLSurface eglSurfaceForDevice() const; #elif defined(Q_WS_X11) || defined(Q_WS_MAC) void* cx; #endif diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index bcde8c4..123bbdd 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -229,7 +229,7 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) // QWidget - yes, create the EGLSurface and store it in QGLContextPrivate::eglSurface // QGLWidget - yes, create the EGLSurface and store it in QGLContextPrivate::eglSurface // QPixmap - yes, create the EGLSurface but store it in QX11PixmapData::gl_surface - // QGLPixelBuffer - no, it creates the surface itself + // QGLPixelBuffer - no, it creates the surface itself and stores it in QGLPixelBufferPrivate::pbuf if (devType == QInternal::Widget) { if (d->eglSurface != EGL_NO_SURFACE) @@ -404,7 +404,7 @@ EGLConfig Q_OPENGL_EXPORT qt_chooseEGLConfigForPixmap(bool hasAlpha, bool readOn if (configCount > 0) { // Got one qDebug() << "Found an" << (hasAlpha ? "ARGB" : "RGB") << (readOnly ? "readonly" : "target" ) - << "config (" << int(*targetConfig) << ") to create a pixmap surface:"; + << "config to create a pixmap surface:"; // QEglProperties configProps(*targetConfig); // qDebug() << configProps.toString(); @@ -446,8 +446,7 @@ bool Q_OPENGL_EXPORT qt_createEGLSurfaceForPixmap(QPixmapData* pmd, bool readOnl // qDebug("qt_createEGLSurfaceForPixmap() created surface 0x%x for pixmap 0x%x", // pixmapSurface, pixmapData->handle()); if (pixmapSurface == EGL_NO_SURFACE) { - qWarning() << "Failed to create a pixmap surface using config" << (int)pixmapConfig - << ":" << QEgl::errorString(); + qWarning() << "Failed to create a pixmap surface:" << QEgl::errorString(); return false; } diff --git a/src/opengl/qglpixelbuffer.h b/src/opengl/qglpixelbuffer.h index 3304dd8..d9c7e3e 100644 --- a/src/opengl/qglpixelbuffer.h +++ b/src/opengl/qglpixelbuffer.h @@ -112,6 +112,7 @@ private: friend class QGLWindowSurface; friend class QGLPaintDevice; friend class QGLPBufferGLPaintDevice; + friend class QGLContextPrivate; }; QT_END_NAMESPACE diff --git a/src/plugins/mediaservices/gstreamer/qgstreamermessage.cpp b/src/plugins/mediaservices/gstreamer/qgstreamermessage.cpp index 863b6d4..d52aa75 100644 --- a/src/plugins/mediaservices/gstreamer/qgstreamermessage.cpp +++ b/src/plugins/mediaservices/gstreamer/qgstreamermessage.cpp @@ -50,7 +50,7 @@ static int wuchi = qRegisterMetaType<QGstreamerMessage>(); /*! - \class gstreamer::QGstreamerMessage + \class QGstreamerMessage \internal */ diff --git a/src/plugins/mediaservices/qt7/mediaplayer/qt7playermetadata.mm b/src/plugins/mediaservices/qt7/mediaplayer/qt7playermetadata.mm index b046672..59d01a2 100644 --- a/src/plugins/mediaservices/qt7/mediaplayer/qt7playermetadata.mm +++ b/src/plugins/mediaservices/qt7/mediaplayer/qt7playermetadata.mm @@ -251,6 +251,7 @@ void QT7PlayerMetaDataControl::updateTags() readFormattedData(metaDataRef, kQTMetaDataStorageFormatiTunes, metaMap); } #else + AutoReleasePool pool; NSString *name = [movie attributeForKey:@"QTMovieDisplayNameAttribute"]; metaMap.insert(QLatin1String("nam"), QString::fromUtf8([name UTF8String])); #endif // QUICKTIME_C_API_AVAILABLE diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 9cd5c63..024b4d0 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -1591,7 +1591,9 @@ QRegExp QScriptEnginePrivate::toRegExp(JSC::ExecState *exec, JSC::JSValue value) QVariant QScriptEnginePrivate::toVariant(JSC::ExecState *exec, JSC::JSValue value) { - if (isObject(value)) { + if (!value) { + return QVariant(); + } else if (isObject(value)) { if (isVariant(value)) return variantValue(value); #ifndef QT_NO_QOBJECT @@ -2901,6 +2903,9 @@ JSC::JSValue QScriptEnginePrivate::create(JSC::ExecState *exec, int type, const result = eng->newQObject(*reinterpret_cast<QObject* const *>(ptr)); break; #endif + case QMetaType::QVariant: + result = jscValueFromVariant(exec, *reinterpret_cast<const QVariant*>(ptr)); + break; default: if (type == qMetaTypeId<QScriptValue>()) { result = eng->scriptValueToJSCValue(*reinterpret_cast<const QScriptValue*>(ptr)); @@ -2922,8 +2927,6 @@ JSC::JSValue QScriptEnginePrivate::create(JSC::ExecState *exec, int type, const else { QByteArray typeName = QMetaType::typeName(type); - if (typeName == "QVariant") - result = jscValueFromVariant(exec, *reinterpret_cast<const QVariant*>(ptr)); if (typeName.endsWith('*') && !*reinterpret_cast<void* const *>(ptr)) return JSC::jsNull(); else @@ -3046,6 +3049,9 @@ bool QScriptEnginePrivate::convertValue(JSC::ExecState *exec, JSC::JSValue value *reinterpret_cast<QVariantMap *>(ptr) = variantMapFromObject(exec, value); return true; } break; + case QMetaType::QVariant: + *reinterpret_cast<QVariant*>(ptr) = toVariant(exec, value); + return true; default: ; } @@ -3096,9 +3102,6 @@ bool QScriptEnginePrivate::convertValue(JSC::ExecState *exec, JSC::JSValue value return false; *reinterpret_cast<QScriptValue*>(ptr) = eng->scriptValueFromJSCValue(value); return true; - } else if (name == "QVariant") { - *reinterpret_cast<QVariant*>(ptr) = toVariant(exec, value); - return true; } // lazy registration of some common list types diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp index 8d111f9..91636da 100644 --- a/src/script/bridge/qscriptqobject.cpp +++ b/src/script/bridge/qscriptqobject.cpp @@ -523,19 +523,15 @@ static JSC::JSValue callQtMethod(JSC::ExecState *exec, QMetaMethod::MethodType c QByteArray returnTypeName = method.typeName(); int rtype = QMetaType::type(returnTypeName); if ((rtype == 0) && !returnTypeName.isEmpty()) { - if (returnTypeName == "QVariant") { - types.append(QScriptMetaType::variant()); - } else { - int enumIndex = indexOfMetaEnum(meta, returnTypeName); - if (enumIndex != -1) - types.append(QScriptMetaType::metaEnum(enumIndex, returnTypeName)); - else - types.append(QScriptMetaType::unresolved(returnTypeName)); - } + int enumIndex = indexOfMetaEnum(meta, returnTypeName); + if (enumIndex != -1) + types.append(QScriptMetaType::metaEnum(enumIndex, returnTypeName)); + else + types.append(QScriptMetaType::unresolved(returnTypeName)); } else { if (callType == QMetaMethod::Constructor) types.append(QScriptMetaType::metaType(QMetaType::QObjectStar, "QObject*")); - else if (returnTypeName == "QVariant") + else if (rtype == QMetaType::QVariant) types.append(QScriptMetaType::variant()); else types.append(QScriptMetaType::metaType(rtype, returnTypeName)); @@ -547,20 +543,15 @@ static JSC::JSValue callQtMethod(JSC::ExecState *exec, QMetaMethod::MethodType c QByteArray argTypeName = parameterTypeNames.at(i); int atype = QMetaType::type(argTypeName); if (atype == 0) { - if (argTypeName == "QVariant") { - types.append(QScriptMetaType::variant()); - } else { - int enumIndex = indexOfMetaEnum(meta, argTypeName); - if (enumIndex != -1) - types.append(QScriptMetaType::metaEnum(enumIndex, argTypeName)); - else - types.append(QScriptMetaType::unresolved(argTypeName)); - } - } else { - if (argTypeName == "QVariant") - types.append(QScriptMetaType::variant()); + int enumIndex = indexOfMetaEnum(meta, argTypeName); + if (enumIndex != -1) + types.append(QScriptMetaType::metaEnum(enumIndex, argTypeName)); else - types.append(QScriptMetaType::metaType(atype, argTypeName)); + types.append(QScriptMetaType::unresolved(argTypeName)); + } else if (atype == QMetaType::QVariant) { + types.append(QScriptMetaType::variant()); + } else { + types.append(QScriptMetaType::metaType(atype, argTypeName)); } } @@ -2174,14 +2165,12 @@ void QObjectConnectionManager::execute(int slotIndex, void **argv) QByteArray typeName = parameterTypes.at(i); int argType = QMetaType::type(parameterTypes.at(i)); if (!argType) { - if (typeName == "QVariant") { - actual = QScriptEnginePrivate::jscValueFromVariant(exec, *reinterpret_cast<QVariant*>(arg)); - } else { - qWarning("QScriptEngine: Unable to handle unregistered datatype '%s' " - "when invoking handler of signal %s::%s", - typeName.constData(), meta->className(), method.signature()); - actual = JSC::jsUndefined(); - } + qWarning("QScriptEngine: Unable to handle unregistered datatype '%s' " + "when invoking handler of signal %s::%s", + typeName.constData(), meta->className(), method.signature()); + actual = JSC::jsUndefined(); + } else if (argType == QMetaType::QVariant) { + actual = QScriptEnginePrivate::jscValueFromVariant(exec, *reinterpret_cast<QVariant*>(arg)); } else { actual = QScriptEnginePrivate::create(exec, argType, arg); } diff --git a/src/src.pro b/src/src.pro index 7bb731e..8c21ef7 100644 --- a/src/src.pro +++ b/src/src.pro @@ -121,8 +121,6 @@ src_declarative.target = sub-declarative src_phonon.depends += src_dbus } contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2): src_plugins.depends += src_opengl - contains(QT_CONFIG, declarative): src_multimedia.depends += src_declarative - contains(QT_CONFIG, multimedia): src_imports += src_multimedia } !symbian { |