diff options
Diffstat (limited to 'src')
76 files changed, 1392 insertions, 289 deletions
diff --git a/src/3rdparty/libpng.pri b/src/3rdparty/libpng.pri index 7ac1910..81966cb 100644 --- a/src/3rdparty/libpng.pri +++ b/src/3rdparty/libpng.pri @@ -1,20 +1,7 @@ DEFINES *= QT_USE_BUNDLED_LIBPNG !isEqual(QT_ARCH, i386):!isEqual(QT_ARCH, x86_64):DEFINES += PNG_NO_ASSEMBLER_CODE INCLUDEPATH += $$PWD/libpng -SOURCES += $$PWD/libpng/png.c \ - $$PWD/libpng/pngerror.c \ - $$PWD/libpng/pngget.c \ - $$PWD/libpng/pngmem.c \ - $$PWD/libpng/pngpread.c \ - $$PWD/libpng/pngread.c \ - $$PWD/libpng/pngrio.c \ - $$PWD/libpng/pngrtran.c \ - $$PWD/libpng/pngrutil.c \ - $$PWD/libpng/pngset.c \ - $$PWD/libpng/pngtrans.c \ - $$PWD/libpng/pngwio.c \ - $$PWD/libpng/pngwrite.c \ - $$PWD/libpng/pngwtran.c \ - $$PWD/libpng/pngwutil.c + +SOURCES += $$PWD/libpng/privatepng.cpp include($$PWD/zlib_dependency.pri) diff --git a/src/3rdparty/libpng/png.c b/src/3rdparty/libpng/png.c index eed3136..db37732 100644 --- a/src/3rdparty/libpng/png.c +++ b/src/3rdparty/libpng/png.c @@ -13,6 +13,8 @@ #include "pngpriv.h" +namespace PrivatePng { + /* Generate a compiler error if there is an old png.h in the search path. */ typedef png_libpng_version_1_5_4 Your_png_h_is_not_version_1_5_4; @@ -2420,3 +2422,4 @@ png_build_gamma_table(png_structp png_ptr, int bit_depth) } #endif /* READ_GAMMA */ #endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */ +} // namespace PrivatePng diff --git a/src/3rdparty/libpng/png.h b/src/3rdparty/libpng/png.h index c655a51..69d9538 100644 --- a/src/3rdparty/libpng/png.h +++ b/src/3rdparty/libpng/png.h @@ -464,11 +464,6 @@ #ifndef PNG_VERSION_INFO_ONLY -/* Inhibit C++ name-mangling for libpng functions but not for system calls. */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - /* Version information for C files, stored in png.c. This had better match * the version above. */ @@ -520,6 +515,7 @@ extern "C" { * See pngconf.h for base types that vary by machine/system */ +namespace PrivatePng { /* This triggers a compiler error in png.c, if png.c and png.h * do not agree upon the version number. */ @@ -2579,10 +2575,7 @@ PNG_EXPORT(207, void, png_save_uint_16, (png_bytep buf, unsigned int i)); PNG_EXPORT_LAST_ORDINAL(229); #endif -#ifdef __cplusplus -} -#endif - #endif /* PNG_VERSION_INFO_ONLY */ /* Do not put anything past this line */ +} // namespace PrivatePng #endif /* PNG_H */ diff --git a/src/3rdparty/libpng/pngconf.h b/src/3rdparty/libpng/pngconf.h index b02f2a0..754f91f 100644 --- a/src/3rdparty/libpng/pngconf.h +++ b/src/3rdparty/libpng/pngconf.h @@ -64,6 +64,7 @@ # endif #endif +namespace PrivatePng { /* COMPILER SPECIFIC OPTIONS. * * These options are provided so that a variety of difficult compilers @@ -627,5 +628,5 @@ typedef char FAR * FAR * FAR * png_charppp; # endif # endif #endif - +} // namespace PrivatePng #endif /* PNGCONF_H */ diff --git a/src/3rdparty/libpng/pngdebug.h b/src/3rdparty/libpng/pngdebug.h index 16f81fd..4547b7d 100644 --- a/src/3rdparty/libpng/pngdebug.h +++ b/src/3rdparty/libpng/pngdebug.h @@ -85,7 +85,7 @@ # define png_debug(l,m) \ do { \ int num_tabs=l; \ - fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \ + fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \ (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \ } while (0) # endif @@ -93,7 +93,7 @@ # define png_debug1(l,m,p1) \ do { \ int num_tabs=l; \ - fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \ + fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \ (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \ } while (0) # endif @@ -101,7 +101,7 @@ # define png_debug2(l,m,p1,p2) \ do { \ int num_tabs=l; \ - fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \ + fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \ (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \ } while (0) # endif diff --git a/src/3rdparty/libpng/pngerror.c b/src/3rdparty/libpng/pngerror.c index 4d4ceba..5559cfb 100644 --- a/src/3rdparty/libpng/pngerror.c +++ b/src/3rdparty/libpng/pngerror.c @@ -18,6 +18,8 @@ #include "pngpriv.h" +namespace PrivatePng { + #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) static PNG_FUNCTION(void, png_default_error,PNGARG((png_structp png_ptr, @@ -670,3 +672,5 @@ png_set_strip_error_numbers(png_structp png_ptr, png_uint_32 strip_mode) } #endif #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ +} // namespace PrivatePng + diff --git a/src/3rdparty/libpng/pngget.c b/src/3rdparty/libpng/pngget.c index b5e5798..0f18370 100644 --- a/src/3rdparty/libpng/pngget.c +++ b/src/3rdparty/libpng/pngget.c @@ -14,6 +14,8 @@ #include "pngpriv.h" +namespace PrivatePng { + #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) png_uint_32 PNGAPI @@ -1030,3 +1032,4 @@ png_get_io_chunk_name (png_structp png_ptr) #endif /* ?PNG_IO_STATE_SUPPORTED */ #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ +} // namespace PrivatePng diff --git a/src/3rdparty/libpng/pnginfo.h b/src/3rdparty/libpng/pnginfo.h index a33bfab..2ce4350 100644 --- a/src/3rdparty/libpng/pnginfo.h +++ b/src/3rdparty/libpng/pnginfo.h @@ -53,6 +53,7 @@ #ifndef PNGINFO_H #define PNGINFO_H +namespace PrivatePng { struct png_info_def { /* the following are necessary for every PNG file */ @@ -266,4 +267,6 @@ defined(PNG_READ_BACKGROUND_SUPPORTED) #endif }; + +} // namespace PrivatePng #endif /* PNGINFO_H */ diff --git a/src/3rdparty/libpng/pngmem.c b/src/3rdparty/libpng/pngmem.c index ea606d6..9f2e4df 100644 --- a/src/3rdparty/libpng/pngmem.c +++ b/src/3rdparty/libpng/pngmem.c @@ -19,6 +19,8 @@ #include "pngpriv.h" +namespace PrivatePng { + #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) /* Borland DOS special memory handler */ @@ -665,3 +667,4 @@ png_get_mem_ptr(png_const_structp png_ptr) } #endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ +} // PrivatePng namespace diff --git a/src/3rdparty/libpng/pngpread.c b/src/3rdparty/libpng/pngpread.c index a50292a..26eb777 100644 --- a/src/3rdparty/libpng/pngpread.c +++ b/src/3rdparty/libpng/pngpread.c @@ -13,6 +13,8 @@ #include "pngpriv.h" +namespace PrivatePng { + #ifdef PNG_PROGRESSIVE_READ_SUPPORTED /* Push model modes */ @@ -1854,3 +1856,4 @@ png_get_progressive_ptr(png_const_structp png_ptr) return png_ptr->io_ptr; } #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ +} // namespace PrivatePng diff --git a/src/3rdparty/libpng/pngpriv.h b/src/3rdparty/libpng/pngpriv.h index ca2fb8c..be4146d 100644 --- a/src/3rdparty/libpng/pngpriv.h +++ b/src/3rdparty/libpng/pngpriv.h @@ -46,6 +46,7 @@ /* This is required for the definition of abort(), used as a last ditch * error handler when all else fails. */ + #include <stdlib.h> #define PNGLIB_BUILD @@ -63,10 +64,12 @@ #include "pnginfo.h" #include "pngstruct.h" +namespace PrivatePng { /* This is used for 16 bit gamma tables - only the top level pointers are const, * this could be changed: */ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp; +} // namespace PrivatePng /* Added at libpng-1.2.9 */ /* Moved to pngpriv.h at libpng-1.5.0 */ @@ -429,6 +432,7 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp; * NOTE: by default this is off - the macro is not used - because the * function call saves a lot of code. */ +namespace PrivatePng { #ifdef PNG_FIXED_POINT_MACRO_SUPPORTED #define png_fixed(png_ptr, fp, s) ((fp) <= 21474 && (fp) >= -21474 ?\ ((png_fixed_point)(100000 * (fp))) : (png_fixed_error(png_ptr, s),0)) @@ -437,6 +441,7 @@ PNG_EXTERN png_fixed_point png_fixed PNGARG((png_structp png_ptr, double fp, png_const_charp text)); #endif #endif +} // namespace PrivatePng /* Constant strings for known chunk types. If you need to add a chunk, * define the name here, and add an invocation of the macro wherever it's @@ -470,18 +475,14 @@ PNG_EXTERN png_fixed_point png_fixed PNGARG((png_structp png_ptr, double fp, #define PNG_GAMMA_MAC_INVERSE 65909 #define PNG_GAMMA_sRGB_INVERSE 45455 - -/* Inhibit C++ name-mangling for libpng functions but not for system calls. */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - /* These functions are used internally in the code. They generally * shouldn't be used unless you are writing code to add or replace some * functionality in libpng. More information about most functions can * be found in the files where the functions are located. */ +namespace PrivatePng { + /* Check the user version string for compatibility, returns false if the version * numbers aren't compatible. */ @@ -1355,10 +1356,8 @@ PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr, /* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */ -#include "pngdebug.h" +} // PrivatePng -#ifdef __cplusplus -} -#endif +#include "pngdebug.h" #endif /* PNGPRIV_H */ diff --git a/src/3rdparty/libpng/pngread.c b/src/3rdparty/libpng/pngread.c index be3df47..662dd4a 100644 --- a/src/3rdparty/libpng/pngread.c +++ b/src/3rdparty/libpng/pngread.c @@ -16,6 +16,8 @@ #include "pngpriv.h" +namespace PrivatePng { + #ifdef PNG_READ_SUPPORTED /* Create a PNG structure for reading, and allocate any memory needed. */ @@ -1452,3 +1454,4 @@ png_read_png(png_structp png_ptr, png_infop info_ptr, #endif /* PNG_INFO_IMAGE_SUPPORTED */ #endif /* PNG_SEQUENTIAL_READ_SUPPORTED */ #endif /* PNG_READ_SUPPORTED */ +} // namespace PrivatePng diff --git a/src/3rdparty/libpng/pngrio.c b/src/3rdparty/libpng/pngrio.c index e9c381c..3a6e536 100644 --- a/src/3rdparty/libpng/pngrio.c +++ b/src/3rdparty/libpng/pngrio.c @@ -20,6 +20,7 @@ #include "pngpriv.h" +namespace PrivatePng { #ifdef PNG_READ_SUPPORTED /* Read the data from whatever input you are using. The default routine @@ -174,3 +175,4 @@ png_set_read_fn(png_structp png_ptr, png_voidp io_ptr, #endif } #endif /* PNG_READ_SUPPORTED */ +} // namespace PrivatePng diff --git a/src/3rdparty/libpng/pngrtran.c b/src/3rdparty/libpng/pngrtran.c index 4e0401a..d5b9d45 100644 --- a/src/3rdparty/libpng/pngrtran.c +++ b/src/3rdparty/libpng/pngrtran.c @@ -18,6 +18,8 @@ #include "pngpriv.h" +namespace PrivatePng { + #ifdef PNG_READ_SUPPORTED /* Set the action on getting a CRC error for an ancillary or critical chunk. */ @@ -4951,3 +4953,4 @@ png_do_read_intrapixel(png_row_infop row_info, png_bytep row) } #endif /* PNG_MNG_FEATURES_SUPPORTED */ #endif /* PNG_READ_SUPPORTED */ +} // namespace PrivatePng diff --git a/src/3rdparty/libpng/pngrutil.c b/src/3rdparty/libpng/pngrutil.c index daf3c5e..9b0ff3e 100644 --- a/src/3rdparty/libpng/pngrutil.c +++ b/src/3rdparty/libpng/pngrutil.c @@ -16,6 +16,7 @@ #include "pngpriv.h" +namespace PrivatePng { #ifdef PNG_READ_SUPPORTED #define png_strtod(p,a,b) strtod(a,b) @@ -458,7 +459,7 @@ png_decompress_chunk(png_structp png_ptr, int comp_type, { /* Success (maybe) - really uncompress the chunk. */ png_size_t new_size = 0; - png_charp text = png_malloc_warn(png_ptr, + png_charp text = (png_charp) png_malloc_warn(png_ptr, prefix_size + expanded_size + 1); if (text != NULL) @@ -501,7 +502,7 @@ png_decompress_chunk(png_structp png_ptr, int comp_type, * amount of compressed data. */ { - png_charp text = png_malloc_warn(png_ptr, prefix_size + 1); + png_charp text = (png_charp) png_malloc_warn(png_ptr, prefix_size + 1); if (text != NULL) { @@ -3666,3 +3667,4 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) png_ptr->flags |= PNG_FLAG_ROW_INIT; } #endif /* PNG_READ_SUPPORTED */ +} // namespace PrivatePng diff --git a/src/3rdparty/libpng/pngset.c b/src/3rdparty/libpng/pngset.c index 7eaad7d..bb7c1ab 100644 --- a/src/3rdparty/libpng/pngset.c +++ b/src/3rdparty/libpng/pngset.c @@ -18,6 +18,8 @@ #include "pngpriv.h" +namespace PrivatePng { + #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) #ifdef PNG_bKGD_SUPPORTED @@ -1224,3 +1226,4 @@ png_set_benign_errors(png_structp png_ptr, int allowed) } #endif /* PNG_BENIGN_ERRORS_SUPPORTED */ #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ +} // namespace PrivatePng diff --git a/src/3rdparty/libpng/pngstruct.h b/src/3rdparty/libpng/pngstruct.h index 93b2b3e..d984461 100644 --- a/src/3rdparty/libpng/pngstruct.h +++ b/src/3rdparty/libpng/pngstruct.h @@ -26,6 +26,7 @@ */ #include "zlib.h" +namespace PrivatePng { struct png_struct_def { #ifdef PNG_SETJMP_SUPPORTED @@ -334,4 +335,5 @@ struct png_struct_def png_uint_32 io_state; #endif }; +} // namespace PrivatePng #endif /* PNGSTRUCT_H */ diff --git a/src/3rdparty/libpng/pngtest.c b/src/3rdparty/libpng/pngtest.c index 9084ada..1a9f8db 100644 --- a/src/3rdparty/libpng/pngtest.c +++ b/src/3rdparty/libpng/pngtest.c @@ -32,13 +32,13 @@ */ #define _POSIX_SOURCE 1 - #include "zlib.h" #include "png.h" /* Copied from pngpriv.h but only used in error messages below. */ #ifndef PNG_ZBUF_SIZE # define PNG_ZBUF_SIZE 8192 #endif + # include <stdio.h> # include <stdlib.h> # include <string.h> @@ -99,8 +99,9 @@ static char tIME_string[PNG_tIME_STRING_LENGTH] = "tIME chunk is not present"; static int verbose = 0; +namespace PrivatePng { int test_one_file PNGARG((PNG_CONST char *inname, PNG_CONST char *outname)); - +} #ifdef __TURBOC__ #include <mem.h> #endif @@ -114,6 +115,7 @@ int test_one_file PNGARG((PNG_CONST char *inname, PNG_CONST char *outname)); # define png_jmpbuf(png_ptr) png_ptr->jmpbuf #endif +namespace PrivatePng { /* Example of using row callbacks to make a simple progress meter */ static int status_pass = 1; static int status_dots_requested = 0; @@ -1795,3 +1797,4 @@ main(int argc, char *argv[]) /* Generate a compiler error if there is an old png.h in the search path. */ typedef png_libpng_version_1_5_4 Your_png_h_is_not_version_1_5_4; +} // namespace PrivatePng diff --git a/src/3rdparty/libpng/pngtrans.c b/src/3rdparty/libpng/pngtrans.c index 6a6908d..2e84686 100644 --- a/src/3rdparty/libpng/pngtrans.c +++ b/src/3rdparty/libpng/pngtrans.c @@ -13,6 +13,8 @@ #include "pngpriv.h" +namespace PrivatePng { + #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) @@ -676,3 +678,4 @@ png_get_current_pass_number(png_const_structp png_ptr) #endif /* PNG_READ_USER_TRANSFORM_SUPPORTED || PNG_WRITE_USER_TRANSFORM_SUPPORTED */ #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ +} // namespace PrivatePng diff --git a/src/3rdparty/libpng/pngwio.c b/src/3rdparty/libpng/pngwio.c index 95ffb34..3dc7378 100644 --- a/src/3rdparty/libpng/pngwio.c +++ b/src/3rdparty/libpng/pngwio.c @@ -20,6 +20,8 @@ #include "pngpriv.h" +namespace PrivatePng { + #ifdef PNG_WRITE_SUPPORTED /* Write the data to whatever output you are using. The default routine @@ -252,3 +254,4 @@ void *png_far_to_near(png_structp png_ptr, png_voidp ptr, int check) # endif #endif #endif /* PNG_WRITE_SUPPORTED */ +} // namespace PrivatePng diff --git a/src/3rdparty/libpng/pngwrite.c b/src/3rdparty/libpng/pngwrite.c index d1af9e8..a945eb8 100644 --- a/src/3rdparty/libpng/pngwrite.c +++ b/src/3rdparty/libpng/pngwrite.c @@ -13,6 +13,8 @@ #include "pngpriv.h" +namespace PrivatePng { + #ifdef PNG_WRITE_SUPPORTED /* Writes all the PNG information. This is the suggested way to use the @@ -1653,3 +1655,4 @@ png_write_png(png_structp png_ptr, png_infop info_ptr, } #endif #endif /* PNG_WRITE_SUPPORTED */ +} // namespace PrivatePng diff --git a/src/3rdparty/libpng/pngwtran.c b/src/3rdparty/libpng/pngwtran.c index 124d708..1b36d01 100644 --- a/src/3rdparty/libpng/pngwtran.c +++ b/src/3rdparty/libpng/pngwtran.c @@ -13,6 +13,8 @@ #include "pngpriv.h" +namespace PrivatePng { + #ifdef PNG_WRITE_SUPPORTED #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED @@ -631,3 +633,4 @@ png_do_write_intrapixel(png_row_infop row_info, png_bytep row) } #endif /* PNG_MNG_FEATURES_SUPPORTED */ #endif /* PNG_WRITE_SUPPORTED */ +} // namespace PrivatePng diff --git a/src/3rdparty/libpng/pngwutil.c b/src/3rdparty/libpng/pngwutil.c index 3ae5ed4..1082350 100644 --- a/src/3rdparty/libpng/pngwutil.c +++ b/src/3rdparty/libpng/pngwutil.c @@ -13,6 +13,8 @@ #include "pngpriv.h" +namespace PrivatePng { + #ifdef PNG_WRITE_SUPPORTED #ifdef PNG_WRITE_INT_FUNCTIONS_SUPPORTED @@ -3177,3 +3179,4 @@ png_write_filtered_row(png_structp png_ptr, png_bytep filtered_row) #endif } #endif /* PNG_WRITE_SUPPORTED */ +} // namespace PrivatePng diff --git a/src/3rdparty/libpng/privatepng.cpp b/src/3rdparty/libpng/privatepng.cpp new file mode 100644 index 0000000..6136447 --- /dev/null +++ b/src/3rdparty/libpng/privatepng.cpp @@ -0,0 +1,16 @@ +#include "png.c" +#include "pngerror.c" +#include "pngget.c" +#include "pngmem.c" +#include "pngpread.c" +#include "pngread.c" +#include "pngrio.c" +#include "pngrtran.c" +#include "pngrutil.c" +#include "pngset.c" +#include "pngtrans.c" +#include "pngwio.c" +#include "pngwrite.c" +#include "pngwtran.c" +#include "pngwutil.c" + diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITStubs.cpp index a589e11..e2f13e7 100644 --- a/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITStubs.cpp +++ b/src/3rdparty/webkit/Source/JavaScriptCore/jit/JITStubs.cpp @@ -353,7 +353,7 @@ asm volatile ( ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" - "mov.l .L2"SYMBOL_STRING(cti_vm_throw)",r0" "\n" + "mov.l .L2" SYMBOL_STRING(cti_vm_throw) ",r0" "\n" "mov r15, r4" "\n" "mov.l @(r0,r12),r11" "\n" "jsr @r11" "\n" @@ -369,7 +369,7 @@ SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" "rts" "\n" "nop" "\n" ".align 2" "\n" - ".L2"SYMBOL_STRING(cti_vm_throw)":.long " SYMBOL_STRING(cti_vm_throw)"@GOT \n" + ".L2" SYMBOL_STRING(cti_vm_throw)":.long " SYMBOL_STRING(cti_vm_throw) "@GOT \n" ); asm volatile ( @@ -1239,7 +1239,7 @@ MSVC_END( END) SYMBOL_STRING(cti_##op) ":" "\n" \ "sts pr, r11" "\n" \ "mov.l r11, @(0x38, r15)" "\n" \ - "mov.l .L2"SYMBOL_STRING(JITStubThunked_##op)",r0" "\n" \ + "mov.l .L2" SYMBOL_STRING(JITStubThunked_##op) ",r0" "\n" \ "mov.l @(r0,r12),r11" "\n" \ "jsr @r11" "\n" \ "nop" "\n" \ @@ -1248,7 +1248,7 @@ MSVC_END( END) "rts" "\n" \ "nop" "\n" \ ".align 2" "\n" \ - ".L2"SYMBOL_STRING(JITStubThunked_##op)":.long " SYMBOL_STRING(JITStubThunked_##op)"@GOT \n" \ + ".L2" SYMBOL_STRING(JITStubThunked_##op) ":.long " SYMBOL_STRING(JITStubThunked_##op)"@GOT \n" \ ); \ rtype JITStubThunked_##op(STUB_ARGS_DECLARATION) #else diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/common/debug.h b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/common/debug.h index 2c4ec70..19da378 100644 --- a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/common/debug.h +++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/common/debug.h @@ -20,21 +20,21 @@ namespace gl // A macro to output a trace of a function call and its arguments to the debugging log #if !defined(NDEBUG) && !defined(ANGLE_DISABLE_TRACE) - #define TRACE(message, ...) gl::trace("trace: %s"message"\n", __FUNCTION__, __VA_ARGS__) + #define TRACE(message, ...) gl::trace("trace: %s" message "\n", __FUNCTION__, __VA_ARGS__) #else #define TRACE(...) ((void)0) #endif // A macro to output a function call and its arguments to the debugging log, to denote an item in need of fixing. Will occur even in release mode. -#define FIXME(message, ...) gl::trace("fixme: %s"message"\n", __FUNCTION__, __VA_ARGS__) +#define FIXME(message, ...) gl::trace("fixme: %s" message "\n", __FUNCTION__, __VA_ARGS__) // A macro to output a function call and its arguments to the debugging log, in case of error. Will occur even in release mode. -#define ERR(message, ...) gl::trace("err: %s"message"\n", __FUNCTION__, __VA_ARGS__) +#define ERR(message, ...) gl::trace("err: %s" message "\n", __FUNCTION__, __VA_ARGS__) // A macro asserting a condition and outputting failures to the debug log #define ASSERT(expression) do { \ if(!(expression)) \ - ERR("\t! Assert failed in %s(%d): "#expression"\n", __FUNCTION__, __LINE__); \ + ERR("\t! Assert failed in %s(%d): " #expression "\n", __FUNCTION__, __LINE__); \ assert(expression); \ } while(0) diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/libEGL.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/libEGL.cpp index 8dfe6e5..98251a1 100644 --- a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/libEGL.cpp +++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libEGL/libEGL.cpp @@ -197,7 +197,7 @@ const char *__stdcall eglQueryString(EGLDisplay dpy, EGLint name) case EGL_VENDOR: return success("TransGaming Inc."); case EGL_VERSION: - return success("1.4 (git-devel "__DATE__" " __TIME__")"); + return success("1.4 (git-devel " __DATE__ " " __TIME__ ")"); } return error(EGL_BAD_PARAMETER, (const char*)NULL); diff --git a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.cpp b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.cpp index 543c0d2..21bffa8 100644 --- a/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.cpp +++ b/src/3rdparty/webkit/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.cpp @@ -3214,9 +3214,9 @@ const GLubyte* __stdcall glGetString(GLenum name) case GL_RENDERER: return (GLubyte*)"ANGLE"; case GL_VERSION: - return (GLubyte*)"OpenGL ES 2.0 (git-devel "__DATE__ " " __TIME__")"; + return (GLubyte*)"OpenGL ES 2.0 (git-devel " __DATE__ " " __TIME__ ")"; case GL_SHADING_LANGUAGE_VERSION: - return (GLubyte*)"OpenGL ES GLSL ES 1.00 (git-devel "__DATE__ " " __TIME__")"; + return (GLubyte*)"OpenGL ES GLSL ES 1.00 (git-devel " __DATE__ " " __TIME__ ")"; case GL_EXTENSIONS: return (GLubyte*)((context != NULL) ? context->getExtensionString() : ""); default: diff --git a/src/3rdparty/webkit/Source/WebCore/platform/sql/SQLiteFileSystem.cpp b/src/3rdparty/webkit/Source/WebCore/platform/sql/SQLiteFileSystem.cpp index 362005c..c4ca6aa 100644 --- a/src/3rdparty/webkit/Source/WebCore/platform/sql/SQLiteFileSystem.cpp +++ b/src/3rdparty/webkit/Source/WebCore/platform/sql/SQLiteFileSystem.cpp @@ -77,10 +77,10 @@ String SQLiteFileSystem::getFileNameForNewDatabase(const String& dbDir, const St String fileName; do { ++seq; - fileName = pathByAppendingComponent(dbDir, String::format("%016"PRIx64".db", seq)); + fileName = pathByAppendingComponent(dbDir, String::format("%016" PRIx64 ".db", seq)); } while (fileExists(fileName)); - return String::format("%016"PRIx64".db", seq); + return String::format("%016" PRIx64 ".db", seq); } String SQLiteFileSystem::appendDatabaseFileNameToPath(const String& path, const String& fileName) diff --git a/src/3rdparty/webkit/Source/WebKit/qt/QtWebKit.pro b/src/3rdparty/webkit/Source/WebKit/qt/QtWebKit.pro index 197aa98..4161832 100644 --- a/src/3rdparty/webkit/Source/WebKit/qt/QtWebKit.pro +++ b/src/3rdparty/webkit/Source/WebKit/qt/QtWebKit.pro @@ -123,7 +123,7 @@ symbian { webkitlibs.pkg_prerules = vendorinfo webkitbackup.sources = symbian/backup_registration.xml - webkitbackup.path = /private/10202D56/import/packages/$$replace(TARGET.UID3, 0x,) + webkitbackup.path = /private/10202d56/import/packages/$$replace(TARGET.UID3, 0x,) contains(QT_CONFIG, declarative) { declarativeImport.sources = $$QT_BUILD_TREE/imports/QtWebKit/qmlwebkitplugin$${QT_LIBINFIX}.dll diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 84d68e5..3675fc7 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -2207,16 +2207,13 @@ void qt_message_output(QtMsgType msgType, const char *buf) OutputDebugString(reinterpret_cast<const wchar_t *> (fstr.utf16())); #elif defined(Q_OS_SYMBIAN) // RDebug::Print has a cap of 256 characters so break it up - _LIT(format, "[Qt Message] %S"); - const int maxBlockSize = 256 - ((const TDesC &)format).Length(); + char format[] = "[Qt Message] %S"; + const int maxBlockSize = 256 - sizeof(format); const TPtrC8 ptr(reinterpret_cast<const TUint8*>(buf)); - HBufC* hbuffer = HBufC::New(qMin(maxBlockSize, ptr.Length())); - Q_CHECK_PTR(hbuffer); - for (int i = 0; i < ptr.Length(); i += hbuffer->Length()) { - hbuffer->Des().Copy(ptr.Mid(i, qMin(maxBlockSize, ptr.Length()-i))); - RDebug::Print(format, hbuffer); + for (int i = 0; i < ptr.Length(); i += maxBlockSize) { + TPtrC8 part(ptr.Mid(i, qMin(maxBlockSize, ptr.Length()-i))); + RDebug::Printf(format, &part); } - delete hbuffer; #else fprintf(stderr, "%s\n", buf); fflush(stderr); diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index ea466f5..da6f021 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -749,7 +749,7 @@ public: ObjectRun, ObjectDelayed }; - static RunResult RunMarkedIfReady(TInt &runPriority, TInt minimumPriority); + static RunResult RunMarkedIfReady(TInt &runPriority, TInt minimumPriority, QEventDispatcherSymbian *dispatcher); static bool UseRRActiveScheduler(); private: @@ -808,7 +808,7 @@ void QtRRActiveScheduler::MarkReadyToRun() } } -QtRRActiveScheduler::RunResult QtRRActiveScheduler::RunMarkedIfReady(TInt &runPriority, TInt minimumPriority) +QtRRActiveScheduler::RunResult QtRRActiveScheduler::RunMarkedIfReady(TInt &runPriority, TInt minimumPriority, QEventDispatcherSymbian *dispatcher) { RunResult result = NothingFound; TInt error=KErrNone; @@ -824,12 +824,12 @@ QtRRActiveScheduler::RunResult QtRRActiveScheduler::RunMarkedIfReady(TInt &runPr runPriority = active->Priority(); dataAccess->iStatus.iFlags&=~TRequestStatusAccess::ERequestActiveFlags; int vptr = *(int*)active; // vptr can be used to identify type when debugging leaves - TRAP(error, active->RunL()); + TRAP(error, QT_TRYCATCH_ERROR(error, active->RunL())); if (error!=KErrNone) error=active->RunError(error); if (error) { qWarning("Active object (ptr=0x%08x, vptr=0x%08x) leave: %i\n", active, vptr, error); - pS->Error(error); + dispatcher->activeObjectError(error); } return ObjectRun; } @@ -966,13 +966,15 @@ QEventDispatcherSymbian::QEventDispatcherSymbian(QObject *parent) m_wakeUpDone(0), m_iterationCount(0), m_insideTimerEvent(false), - m_noSocketEvents(false) + m_noSocketEvents(false), + m_oomErrorCount(0) { #ifdef QT_SYMBIAN_PRIORITY_DROP m_delay = baseDelay; m_avgEventTime = 0; idleDetectorThread(); #endif + m_oomErrorTimer.start(); } QEventDispatcherSymbian::~QEventDispatcherSymbian() @@ -1098,7 +1100,7 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla // Standard or above priority AOs are scheduled round robin. // Lower priority AOs can only run if nothing higher priority has run. int runPriority = minPriority; - handledSymbianEvent = QtRRActiveScheduler::RunMarkedIfReady(runPriority, minPriority); + handledSymbianEvent = QtRRActiveScheduler::RunMarkedIfReady(runPriority, minPriority, this); minPriority = qMin(runPriority, int(CActive::EPriorityStandard)); } else { TInt error; @@ -1396,6 +1398,19 @@ QList<QEventDispatcherSymbian::TimerInfo> QEventDispatcherSymbian::registeredTim return list; } +void QEventDispatcherSymbian::activeObjectError(int error) +{ + if (error == KErrNoMemory) { + // limit the number of reported out of memory errors, as the disappearance of the warning + // dialog can trigger further OOM errors causing a loop. + if (m_oomErrorTimer.restart() > 60000) // 1 minute + m_oomErrorCount = 0; + if (m_oomErrorCount++ >= 5) + return; + } + CActiveScheduler::Current()->Error(error); +} + /* * This active scheduler class implements a simple report and continue policy, for Symbian OS leaves * or exceptions from Qt that fall back to the scheduler. diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h index 01f5ab1..869fe31 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian_p.h +++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h @@ -264,6 +264,8 @@ public: static void RequestComplete(TRequestStatus *&status, TInt reason); static void RequestComplete(RThread &threadHandle, TRequestStatus *&status, TInt reason); + void activeObjectError(int error); + private: bool sendPostedEvents(); bool sendDeferredSocketEvents(); @@ -294,6 +296,8 @@ private: int m_delay; int m_avgEventTime; QElapsedTimer m_lastIdleRequestTimer; + int m_oomErrorCount; + QElapsedTimer m_oomErrorTimer; }; #ifdef QT_DEBUG diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index f1ed8e4..e0e2b8d 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -789,7 +789,7 @@ bool QLibraryPrivate::isPlugin(QSettings *settings) // An exception was thrown when calling qt_plugin_query_verification_data(). // This usually happens when plugin is compiled with the /clr compiler flag, // & will only work if the dependencies are loaded & DLLMain() is called. - // LoadLibrary() will do this, try once with this & if it fails dont load. + // LoadLibrary() will do this, try once with this & if it fails don't load. retryLoadLibrary = !retryLoadLibrary; } #endif diff --git a/src/corelib/plugin/qplugin.h b/src/corelib/plugin/qplugin.h index 40e6e66..559822a 100644 --- a/src/corelib/plugin/qplugin.h +++ b/src/corelib/plugin/qplugin.h @@ -115,10 +115,10 @@ void Q_CORE_EXPORT qRegisterStaticPluginInstanceFunction(QtPluginInstanceFunctio # endif # define Q_PLUGIN_VERIFICATION_DATA \ static const char qt_plugin_verification_data[] = \ - "pattern=""QT_PLUGIN_VERIFICATION_DATA""\n" \ - "version="QT_VERSION_STR"\n" \ - "debug="QPLUGIN_DEBUG_STR"\n" \ - "buildkey="QT_BUILD_KEY; + "pattern=QT_PLUGIN_VERIFICATION_DATA\n" \ + "version=" QT_VERSION_STR "\n" \ + "debug=" QPLUGIN_DEBUG_STR "\n" \ + "buildkey=" QT_BUILD_KEY; # if defined (Q_OF_ELF) && defined (Q_CC_GNU) # define Q_PLUGIN_VERIFICATION_SECTION \ diff --git a/src/declarative/debugger/qdeclarativedebugserver.cpp b/src/declarative/debugger/qdeclarativedebugserver.cpp index 3e0c326..05f63c7 100644 --- a/src/declarative/debugger/qdeclarativedebugserver.cpp +++ b/src/declarative/debugger/qdeclarativedebugserver.cpp @@ -96,7 +96,7 @@ public: private: // private slot void _q_deliverMessage(const QString &serviceName, const QByteArray &message); - static QDeclarativeDebugServerConnection *loadConnectionPlugin(const QString &pluginName); + static QDeclarativeDebugServerConnection *loadConnectionPlugin(QPluginLoader *loader, const QString &pluginName); }; QDeclarativeDebugServerPrivate::QDeclarativeDebugServerPrivate() : @@ -120,7 +120,7 @@ void QDeclarativeDebugServerPrivate::advertisePlugins() } QDeclarativeDebugServerConnection *QDeclarativeDebugServerPrivate::loadConnectionPlugin( - const QString &pluginName) + QPluginLoader *loader, const QString &pluginName) { #ifndef QT_NO_LIBRARY QStringList pluginCandidates; @@ -137,17 +137,17 @@ QDeclarativeDebugServerConnection *QDeclarativeDebugServerPrivate::loadConnectio } foreach (const QString &pluginPath, pluginCandidates) { - QPluginLoader loader(pluginPath); - if (!loader.load()) { + loader->setFileName(pluginPath); + if (!loader->load()) { continue; } QDeclarativeDebugServerConnection *connection = 0; - if (QObject *instance = loader.instance()) + if (QObject *instance = loader->instance()) connection = qobject_cast<QDeclarativeDebugServerConnection*>(instance); if (connection) return connection; - loader.unload(); + loader->unload(); } #endif return 0; @@ -202,8 +202,9 @@ QDeclarativeDebugServer *QDeclarativeDebugServer::instance() if (ok) { server = new QDeclarativeDebugServer(); + QPluginLoader *loader = new QPluginLoader(server); QDeclarativeDebugServerConnection *connection - = QDeclarativeDebugServerPrivate::loadConnectionPlugin(pluginName); + = QDeclarativeDebugServerPrivate::loadConnectionPlugin(loader, pluginName); if (connection) { server->d_func()->connection = connection; diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 7b4dc5c..ef7e25f 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -1628,7 +1628,7 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m to set \e {clip: true} in order to have the out of view items clipped nicely. - \sa {QML Data Models}, GridView, {declarative/modelviews/listview}{ListView examples} + \sa {QML Data Models}, GridView, {Models and Views: ListView Examples}{ListView examples} */ QDeclarativeListView::QDeclarativeListView(QDeclarativeItem *parent) @@ -1956,7 +1956,7 @@ int QDeclarativeListView::count() const so as to stay with the current item, unless the highlightFollowsCurrentItem property is false. - \sa highlightItem, highlightFollowsCurrentItem, {declarative/modelviews/listview}{ListView examples} + \sa highlightItem, highlightFollowsCurrentItem, {Models and Views: ListView Examples}{ListView examples} */ QDeclarativeComponent *QDeclarativeListView::highlight() const { @@ -2344,7 +2344,7 @@ void QDeclarativeListView::setCacheBuffer(int b) differing sections will result in a section header being created even if that section exists elsewhere. - \sa {declarative/modelviews/listview}{ListView examples} + \sa {Models and Views: ListView Examples}{ListView examples} */ QDeclarativeViewSection *QDeclarativeListView::sectionCriteria() { diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 20e4eef..684dc5a 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -289,7 +289,7 @@ void QDeclarativeTextPrivate::updateSize() doc->setTextWidth(-1); naturalWidth = doc->idealWidth(); } - if (wrapMode != QDeclarativeText::NoWrap && q->widthValid()) + if (q->widthValid()) doc->setTextWidth(q->width()); else doc->setTextWidth(doc->idealWidth()); // ### Text does not align if width is not set (QTextDoc bug) diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index f423f50..0d892a2 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -936,50 +936,37 @@ void QDeclarativeComponentPrivate::beginDeferred(QDeclarativeEnginePrivate *engi void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePriv, ConstructionState *state) { if (state->completePending) { - - for (int ii = 0; ii < state->bindValues.count(); ++ii) { - QDeclarativeEnginePrivate::SimpleList<QDeclarativeAbstractBinding> bv = - state->bindValues.at(ii); - for (int jj = 0; jj < bv.count; ++jj) { - if(bv.at(jj)) { - // XXX akennedy - bv.at(jj)->m_mePtr = 0; - bv.at(jj)->setEnabled(true, QDeclarativePropertyPrivate::BypassInterceptor | - QDeclarativePropertyPrivate::DontRemoveBinding); + QT_TRY { + for (int ii = 0; ii < state->bindValues.count(); ++ii) { + QDeclarativeEnginePrivate::SimpleList<QDeclarativeAbstractBinding> bv = + state->bindValues.at(ii); + for (int jj = 0; jj < bv.count; ++jj) { + if(bv.at(jj)) { + // XXX akennedy + bv.at(jj)->m_mePtr = 0; + bv.at(jj)->setEnabled(true, QDeclarativePropertyPrivate::BypassInterceptor | + QDeclarativePropertyPrivate::DontRemoveBinding); + } } + QDeclarativeEnginePrivate::clear(bv); } - QDeclarativeEnginePrivate::clear(bv); - } - for (int ii = 0; ii < state->parserStatus.count(); ++ii) { - QDeclarativeEnginePrivate::SimpleList<QDeclarativeParserStatus> ps = - state->parserStatus.at(ii); + for (int ii = 0; ii < state->parserStatus.count(); ++ii) { + QDeclarativeEnginePrivate::SimpleList<QDeclarativeParserStatus> ps = + state->parserStatus.at(ii); - for (int jj = ps.count - 1; jj >= 0; --jj) { - QDeclarativeParserStatus *status = ps.at(jj); - if (status && status->d) { - status->d = 0; - status->componentComplete(); + for (int jj = ps.count - 1; jj >= 0; --jj) { + QDeclarativeParserStatus *status = ps.at(jj); + if (status && status->d) { + status->d = 0; + status->componentComplete(); + } } + QDeclarativeEnginePrivate::clear(ps); } - QDeclarativeEnginePrivate::clear(ps); - } - - for (int ii = 0; ii < state->finalizedParserStatus.count(); ++ii) { - QPair<QDeclarativeGuard<QObject>, int> status = state->finalizedParserStatus.at(ii); - QObject *obj = status.first; - if (obj) { - void *args[] = { 0 }; - QMetaObject::metacall(obj, QMetaObject::InvokeMetaMethod, - status.second, args); - } - } - //componentComplete() can register additional finalization objects - //that are then never handled. Handle them manually here. - if (1 == enginePriv->inProgressCreations) { - for (int ii = 0; ii < enginePriv->finalizedParserStatus.count(); ++ii) { - QPair<QDeclarativeGuard<QObject>, int> status = enginePriv->finalizedParserStatus.at(ii); + for (int ii = 0; ii < state->finalizedParserStatus.count(); ++ii) { + QPair<QDeclarativeGuard<QObject>, int> status = state->finalizedParserStatus.at(ii); QObject *obj = status.first; if (obj) { void *args[] = { 0 }; @@ -987,17 +974,38 @@ void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePri status.second, args); } } - enginePriv->finalizedParserStatus.clear(); - } - while (state->componentAttached) { - QDeclarativeComponentAttached *a = state->componentAttached; - a->rem(); - QDeclarativeData *d = QDeclarativeData::get(a->parent()); - Q_ASSERT(d); - Q_ASSERT(d->context); - a->add(&d->context->componentAttached); - emit a->completed(); + //componentComplete() can register additional finalization objects + //that are then never handled. Handle them manually here. + if (1 == enginePriv->inProgressCreations) { + for (int ii = 0; ii < enginePriv->finalizedParserStatus.count(); ++ii) { + QPair<QDeclarativeGuard<QObject>, int> status = enginePriv->finalizedParserStatus.at(ii); + QObject *obj = status.first; + if (obj) { + void *args[] = { 0 }; + QMetaObject::metacall(obj, QMetaObject::InvokeMetaMethod, + status.second, args); + } + } + enginePriv->finalizedParserStatus.clear(); + } + + while (state->componentAttached) { + QDeclarativeComponentAttached *a = state->componentAttached; + a->rem(); + QDeclarativeData *d = QDeclarativeData::get(a->parent()); + Q_ASSERT(d); + Q_ASSERT(d->context); + a->add(&d->context->componentAttached); + emit a->completed(); + } + } QT_CATCH(const std::exception&) { + state->bindValues.clear(); + state->parserStatus.clear(); + state->finalizedParserStatus.clear(); + state->completePending = false; + enginePriv->inProgressCreations--; + QT_RETHROW; } state->bindValues.clear(); diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 1417b78..89a9809 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1202,8 +1202,8 @@ void QDeclarativeData::setBindingBit(QObject *obj, int bit) int arraySize = (props + 31) / 32; int oldArraySize = bindingBitsSize / 32; - bindingBits = (quint32 *)realloc(bindingBits, - arraySize * sizeof(quint32)); + bindingBits = (quint32 *)q_check_ptr(realloc(bindingBits, + arraySize * sizeof(quint32))); memset(bindingBits + oldArraySize, 0x00, diff --git a/src/declarative/qml/qpodvector_p.h b/src/declarative/qml/qpodvector_p.h index 7b50463..a055d17 100644 --- a/src/declarative/qml/qpodvector_p.h +++ b/src/declarative/qml/qpodvector_p.h @@ -89,7 +89,7 @@ public: void insert(int idx, const T &v) { if (m_count == m_capacity) { m_capacity += Increment; - m_data = (T *)realloc(m_data, m_capacity * sizeof(T)); + m_data = (T *)q_check_ptr(realloc(m_data, m_capacity * sizeof(T))); } int moveCount = m_count - idx; if (moveCount) @@ -101,7 +101,7 @@ public: void reserve(int count) { if (count >= m_capacity) { m_capacity = (count + (Increment-1)) & (0xFFFFFFFF - Increment + 1); - m_data = (T *)realloc(m_data, m_capacity * sizeof(T)); + m_data = (T *)q_check_ptr(realloc(m_data, m_capacity * sizeof(T))); } } diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp index 411e5e9..2b56e49 100644 --- a/src/gui/image/qimagereader.cpp +++ b/src/gui/image/qimagereader.cpp @@ -1473,11 +1473,16 @@ QByteArray QImageReader::imageFormat(QIODevice *device) \row \o XBM \o X11 Bitmap \row \o XPM \o X11 Pixmap \row \o SVG \o Scalable Vector Graphics + \row \o TGA \o Targa Image Format \endtable Reading and writing SVG files is supported through Qt's \l{QtSvg Module}{SVG Module}. + TGA support only extends to reading non-RLE compressed files. In particular + calls to \l{http://doc.qt.nokia.com/4.7-snapshot/qimageioplugin.html#capabilities}{capabilities} + for the tga plugin returns only QImageIOPlugin::CanRead, not QImageIOPlugin::CanWrite. + To configure Qt with GIF support, pass \c -qt-gif to the \c configure script or check the appropriate option in the graphical installer. diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp index 1714442..5a4a4d7 100644 --- a/src/gui/image/qpnghandler.cpp +++ b/src/gui/image/qpnghandler.cpp @@ -53,6 +53,7 @@ #ifdef QT_USE_BUNDLED_LIBPNG #include <../../3rdparty/libpng/png.h> #include <../../3rdparty/libpng/pngconf.h> +using namespace PrivatePng; #else #include <png.h> #include <pngconf.h> diff --git a/src/gui/image/qtiffhandler.cpp b/src/gui/image/qtiffhandler.cpp index 4dc9775..51a500d 100644 --- a/src/gui/image/qtiffhandler.cpp +++ b/src/gui/image/qtiffhandler.cpp @@ -158,7 +158,13 @@ bool QTiffHandler::canRead(QIODevice *device) // current implementation uses TIFFClientOpen which needs to be // able to seek, so sequential devices are not supported + int pos = device->pos(); + if (pos != 0) + device->seek(0); // need the magic from the beginning QByteArray header = device->peek(4); + if (pos != 0) + device->seek(pos); // put it back where we found it + return header == QByteArray::fromRawData("\x49\x49\x2A\x00", 4) || header == QByteArray::fromRawData("\x4D\x4D\x00\x2A", 4); } diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h index 90d47f9..d9d577a 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_p.h +++ b/src/gui/inputmethod/qcoefepinputcontext_p.h @@ -162,6 +162,8 @@ private: void enableSymbianCcpuSupport(); void changeCBA(bool showCopyAndOrPaste); void copyOrCutTextToClipboard(const char *operation); + void getScreenCoordinatesForFepX(TPoint& aLeftSideOfBaseLine, TInt& aHeight, TInt& aAscent, + TInt aDocumentPosition) const; //From MEikCcpuEditor interface public: @@ -223,6 +225,7 @@ private: Q_GUI_EXPORT void qt_s60_setPartialScreenInputMode(bool enable); Q_GUI_EXPORT void qt_s60_setPartialScreenAutomaticTranslation(bool enable); +Q_GUI_EXPORT void qt_s60_setEditorFlags(int flags); QT_END_NAMESPACE diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index ed7411f..3bcac62 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -367,6 +367,11 @@ Q_GUI_EXPORT void qt_s60_setPartialScreenAutomaticTranslation(bool enable) S60->partial_keyboardAutoTranslation = enable; } +Q_GUI_EXPORT void qt_s60_setEditorFlags(int flags) +{ + S60->editorFlags |= flags; +} + QCoeFepInputContext::QCoeFepInputContext(QObject *parent) : QInputContext(parent), m_fepState(q_check_ptr(new CAknEdwinState)), // CBase derived object needs check on new @@ -1160,6 +1165,11 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) if (hints & ImhNoPredictiveText || hints & ImhHiddenText) { flags |= EAknEditorFlagNoT9; } + + if ((hints & (ImhEmailCharactersOnly | ImhUrlCharactersOnly)) && (S60->editorFlags & EAknEditorFlagLatinInputModesOnly)){ + flags |= EAknEditorFlagLatinInputModesOnly; + } + if (needsCharMap) flags |= EAknEditorFlagUseSCTNumericCharmap; m_fepState->SetFlags(flags); @@ -1465,40 +1475,49 @@ void QCoeFepInputContext::CancelFepInlineEdit() m_pendingTransactionCancel = true; - QList<QInputMethodEvent::Attribute> attributes; - QInputMethodEvent event(QLatin1String(""), attributes); - event.setCommitString(QLatin1String(""), 0, 0); - m_preeditString.clear(); - m_inlinePosition = 0; - sendEvent(event); + QT_TRY { + QList<QInputMethodEvent::Attribute> attributes; + QInputMethodEvent event(QLatin1String(""), attributes); + event.setCommitString(QLatin1String(""), 0, 0); + m_preeditString.clear(); + m_inlinePosition = 0; + sendEvent(event); - // Sync with native side editor state. Native side can then do various operations - // based on editor state, such as removing 'exact word bubble'. - if (!m_pendingInputCapabilitiesChanged) - ReportAknEdStateEvent(MAknEdStateObserver::EAknSyncEdwinState); + // Sync with native side editor state. Native side can then do various operations + // based on editor state, such as removing 'exact word bubble'. + if (!m_pendingInputCapabilitiesChanged) + ReportAknEdStateEvent(MAknEdStateObserver::EAknSyncEdwinState); + } QT_CATCH(const std::exception&) { + m_preeditString.clear(); + m_inlinePosition = 0; + } m_pendingTransactionCancel = false; } TInt QCoeFepInputContext::DocumentLengthForFep() const { - QWidget *w = focusWidget(); - if (!w) - return 0; + QT_TRY { + QWidget *w = focusWidget(); + if (!w) + return 0; - QVariant variant = w->inputMethodQuery(Qt::ImSurroundingText); + QVariant variant = w->inputMethodQuery(Qt::ImSurroundingText); - int size = variant.value<QString>().size() + m_preeditString.size(); + int size = variant.value<QString>().size() + m_preeditString.size(); - // To fix an issue with backspaces not being generated if document size is zero, - // fake document length to be at least one always, except when dealing with - // hidden text widgets, where this faking would generate extra asterisk. Since the - // primary use of hidden text widgets is password fields, they are unlikely to - // support multiple lines anyway. - if (size == 0 && !(m_textCapabilities & TCoeInputCapabilities::ESecretText)) - size = 1; + // To fix an issue with backspaces not being generated if document size is zero, + // fake document length to be at least one always, except when dealing with + // hidden text widgets, where this faking would generate extra asterisk. Since the + // primary use of hidden text widgets is password fields, they are unlikely to + // support multiple lines anyway. + if (size == 0 && !(m_textCapabilities & TCoeInputCapabilities::ESecretText)) + size = 1; - return size; + return size; + } QT_CATCH(const std::exception&) { + return 0; + } } TInt QCoeFepInputContext::DocumentMaximumLengthForFep() const @@ -1540,42 +1559,46 @@ void QCoeFepInputContext::SetCursorSelectionForFepL(const TCursorSelection& aCur void QCoeFepInputContext::GetCursorSelectionForFep(TCursorSelection& aCursorSelection) const { - QWidget *w = focusWidget(); - if (!w) { - aCursorSelection.SetSelection(0,0); - return; - } + QT_TRY { + QWidget *w = focusWidget(); + if (!w) { + aCursorSelection.SetSelection(0,0); + return; + } - int cursor = w->inputMethodQuery(Qt::ImCursorPosition).toInt() + m_preeditString.size(); - int anchor = w->inputMethodQuery(Qt::ImAnchorPosition).toInt() + m_preeditString.size(); + int cursor = w->inputMethodQuery(Qt::ImCursorPosition).toInt() + m_preeditString.size(); + int anchor = w->inputMethodQuery(Qt::ImAnchorPosition).toInt() + m_preeditString.size(); - // If the position is stored, use that value, so that word replacement from proposed word - // lists are added to the correct position. - if (m_cachedCursorAndAnchorPosition != -1) { - cursor = m_cachedCursorAndAnchorPosition; - anchor = m_cachedCursorAndAnchorPosition; - } - QString text = w->inputMethodQuery(Qt::ImSurroundingText).value<QString>(); - int combinedSize = text.size() + m_preeditString.size(); - if (combinedSize < anchor || combinedSize < cursor) { - // ### TODO! FIXME! QTBUG-5050 - // This is a hack to prevent crashing in 4.6 with QLineEdits that use input masks. - // The root problem is that cursor position is relative to displayed text instead of the - // actual text we get. - // - // To properly fix this we would need to know the displayText of QLineEdits instead - // of just the text, which on itself should be a trivial change. The difficulties start - // when we need to commit the changes back to the QLineEdit, which would have to be somehow - // able to handle displayText, too. - // - // Until properly fixed, the cursor and anchor positions will not reflect correct positions - // for masked QLineEdits, unless all the masked positions are filled in order so that - // cursor position relative to the displayed text matches position relative to actual text. - aCursorSelection.iAnchorPos = combinedSize; - aCursorSelection.iCursorPos = combinedSize; - } else { - aCursorSelection.iAnchorPos = anchor; - aCursorSelection.iCursorPos = cursor; + // If the position is stored, use that value, so that word replacement from proposed word + // lists are added to the correct position. + if (m_cachedCursorAndAnchorPosition != -1) { + cursor = m_cachedCursorAndAnchorPosition; + anchor = m_cachedCursorAndAnchorPosition; + } + QString text = w->inputMethodQuery(Qt::ImSurroundingText).value<QString>(); + int combinedSize = text.size() + m_preeditString.size(); + if (combinedSize < anchor || combinedSize < cursor) { + // ### TODO! FIXME! QTBUG-5050 + // This is a hack to prevent crashing in 4.6 with QLineEdits that use input masks. + // The root problem is that cursor position is relative to displayed text instead of the + // actual text we get. + // + // To properly fix this we would need to know the displayText of QLineEdits instead + // of just the text, which on itself should be a trivial change. The difficulties start + // when we need to commit the changes back to the QLineEdit, which would have to be somehow + // able to handle displayText, too. + // + // Until properly fixed, the cursor and anchor positions will not reflect correct positions + // for masked QLineEdits, unless all the masked positions are filled in order so that + // cursor position relative to the displayed text matches position relative to actual text. + aCursorSelection.iAnchorPos = combinedSize; + aCursorSelection.iCursorPos = combinedSize; + } else { + aCursorSelection.iAnchorPos = anchor; + aCursorSelection.iCursorPos = cursor; + } + } QT_CATCH(const std::exception&) { + aCursorSelection.SetSelection(0,0); } } @@ -1618,6 +1641,12 @@ void QCoeFepInputContext::GetFormatForFep(TCharFormat& aFormat, TInt /* aDocumen } void QCoeFepInputContext::GetScreenCoordinatesForFepL(TPoint& aLeftSideOfBaseLine, TInt& aHeight, + TInt& aAscent, TInt aDocumentPosition) const +{ + QT_TRYCATCH_LEAVING(getScreenCoordinatesForFepX(aLeftSideOfBaseLine, aHeight, aAscent, aDocumentPosition)); +} + +void QCoeFepInputContext::getScreenCoordinatesForFepX(TPoint& aLeftSideOfBaseLine, TInt& aHeight, TInt& aAscent, TInt /* aDocumentPosition */) const { QWidget *w = focusWidget(); @@ -1774,36 +1803,40 @@ TBool QCoeFepInputContext::CcpuIsFocused() const TBool QCoeFepInputContext::CcpuCanCut() const { - bool retval = false; - if (m_inDestruction) - return retval; - QWidget *w = focusWidget(); - QObject *focusObject = 0; - if (!w) { - w = m_lastFocusedEditor; - focusObject = m_lastFocusedObject; - } else { - w = getQWidgetFromQGraphicsView(w, &focusObject); - } - if (w) { - QRect microFocus = w->inputMethodQuery(Qt::ImMicroFocus).toRect(); - if (microFocus.isNull()) { - // For some reason, the editor does not have microfocus. Most probably, - // it is due to using native fullscreen editing mode with QML apps. - // Try accessing "selectedText" directly. - QObject *invokeTarget = w; - if (focusObject) - invokeTarget = focusObject; - - QString selectedText = invokeTarget->property("selectedText").toString(); - retval = !selectedText.isNull(); + QT_TRY { + bool retval = false; + if (m_inDestruction) + return retval; + QWidget *w = focusWidget(); + QObject *focusObject = 0; + if (!w) { + w = m_lastFocusedEditor; + focusObject = m_lastFocusedObject; } else { - int cursor = w->inputMethodQuery(Qt::ImCursorPosition).toInt(); - int anchor = w->inputMethodQuery(Qt::ImAnchorPosition).toInt(); - retval = cursor != anchor; + w = getQWidgetFromQGraphicsView(w, &focusObject); + } + if (w) { + QRect microFocus = w->inputMethodQuery(Qt::ImMicroFocus).toRect(); + if (microFocus.isNull()) { + // For some reason, the editor does not have microfocus. Most probably, + // it is due to using native fullscreen editing mode with QML apps. + // Try accessing "selectedText" directly. + QObject *invokeTarget = w; + if (focusObject) + invokeTarget = focusObject; + + QString selectedText = invokeTarget->property("selectedText").toString(); + retval = !selectedText.isNull(); + } else { + int cursor = w->inputMethodQuery(Qt::ImCursorPosition).toInt(); + int anchor = w->inputMethodQuery(Qt::ImAnchorPosition).toInt(); + retval = cursor != anchor; + } } + return retval; + } QT_CATCH(const std::exception&) { + return EFalse; } - return retval; } void QCoeFepInputContext::CcpuCutL() diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index fe239f5..ca9c3a3 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1534,53 +1534,57 @@ bool QSymbianControl::hasFocusedAndVisibleChild(QWidget *parentWidget) void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */) { - if (m_ignoreFocusChanged || (qwidget->windowType() & Qt::WindowType_Mask) == Qt::Desktop) - return; + QT_TRY { + if (m_ignoreFocusChanged || (qwidget->windowType() & Qt::WindowType_Mask) == Qt::Desktop) + return; #ifdef Q_WS_S60 - if (S60->splitViewLastWidget) - return; + if (S60->splitViewLastWidget) + return; #endif - // Popups never get focused, but still receive the FocusChanged when they are hidden. - if (QApplicationPrivate::popupWidgets != 0 - || (qwidget->windowType() & Qt::Popup) == Qt::Popup) - return; - - if (IsFocused() && IsVisible()) { - if (m_symbianPopupIsOpen) { - QWidget *fw = QApplication::focusWidget(); - if (fw) { - QFocusEvent event(QEvent::FocusIn, Qt::PopupFocusReason); - QCoreApplication::sendEvent(fw, &event); - } - m_symbianPopupIsOpen = false; - } + // Popups never get focused, but still receive the FocusChanged when they are hidden. + if (QApplicationPrivate::popupWidgets != 0 + || (qwidget->windowType() & Qt::Popup) == Qt::Popup) + return; - QApplication::setActiveWindow(qwidget->window()); - qwidget->d_func()->setWindowIcon_sys(true); - qwidget->d_func()->setWindowTitle_sys(qwidget->windowTitle()); -#ifdef Q_WS_S60 - if (qwidget->isWindow()) - S60->setRecursiveDecorationsVisibility(qwidget, qwidget->windowState()); -#endif - } else { - QWidget *parentWindow = qwidget->window(); - if (QApplication::activeWindow() == parentWindow && !hasFocusedAndVisibleChild(parentWindow)) { - if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog() || S60->menuBeingConstructed) { + if (IsFocused() && IsVisible()) { + if (m_symbianPopupIsOpen) { QWidget *fw = QApplication::focusWidget(); if (fw) { - QFocusEvent event(QEvent::FocusOut, Qt::PopupFocusReason); + QFocusEvent event(QEvent::FocusIn, Qt::PopupFocusReason); QCoreApplication::sendEvent(fw, &event); } - m_symbianPopupIsOpen = true; - return; + m_symbianPopupIsOpen = false; } - QApplication::setActiveWindow(0); + QApplication::setActiveWindow(qwidget->window()); + qwidget->d_func()->setWindowIcon_sys(true); + qwidget->d_func()->setWindowTitle_sys(qwidget->windowTitle()); +#ifdef Q_WS_S60 + if (qwidget->isWindow()) + S60->setRecursiveDecorationsVisibility(qwidget, qwidget->windowState()); +#endif + } else { + QWidget *parentWindow = qwidget->window(); + if (QApplication::activeWindow() == parentWindow && !hasFocusedAndVisibleChild(parentWindow)) { + if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog() || S60->menuBeingConstructed) { + QWidget *fw = QApplication::focusWidget(); + if (fw) { + QFocusEvent event(QEvent::FocusOut, Qt::PopupFocusReason); + QCoreApplication::sendEvent(fw, &event); + } + m_symbianPopupIsOpen = true; + return; + } + + QApplication::setActiveWindow(0); + } } + // else { We don't touch the active window unless we were explicitly activated or deactivated } + } QT_CATCH(const std::exception&) { + // ignore errors } - // else { We don't touch the active window unless we were explicitly activated or deactivated } } void QSymbianControl::handleClientAreaChange() @@ -2065,9 +2069,6 @@ extern void qt_cleanup_symbianFontDatabase(); // qfontdatabase_s60.cpp *****************************************************************************/ void qt_cleanup() { -#ifdef Q_WS_S60 - S60->setButtonGroupContainer(0); -#endif if(qt_S60Beep) { delete qt_S60Beep; qt_S60Beep = 0; @@ -2377,19 +2378,25 @@ int QApplication::symbianProcessEvent(const QSymbianEvent *event) QScopedLoopLevelCounter counter(d->threadData); - if (d->eventDispatcher->filterEvent(const_cast<QSymbianEvent *>(event))) - return 1; + QT_TRY { + if (d->eventDispatcher->filterEvent(const_cast<QSymbianEvent *>(event))) + return 1; - QWidget *w = qApp ? qApp->focusWidget() : 0; - if (w) { - QInputContext *ic = w->inputContext(); - if (ic && ic->symbianFilterEvent(w, event)) + QWidget *w = qApp ? qApp->focusWidget() : 0; + if (w) { + QInputContext *ic = w->inputContext(); + if (ic && ic->symbianFilterEvent(w, event)) + return 1; + } + + if (symbianEventFilter(event)) return 1; + } QT_CATCH(const std::exception& ex) { + // don't allow an exception to stop exit command handling + if (event->type() != QSymbianEvent::CommandEvent || event->command() != EEikCmdExit) + QT_RETHROW; } - if (symbianEventFilter(event)) - return 1; - switch (event->type()) { case QSymbianEvent::WindowServerEvent: return d->symbianProcessWsEvent(event); diff --git a/src/gui/kernel/qclipboard_s60.cpp b/src/gui/kernel/qclipboard_s60.cpp index f5314bd..dc812fb 100644 --- a/src/gui/kernel/qclipboard_s60.cpp +++ b/src/gui/kernel/qclipboard_s60.cpp @@ -187,6 +187,7 @@ void readSymbianStoreLX(QMimeData* aData, CClipboard* clipboard) QString string = qt_TDesC2QString(buf); CleanupStack::PopAndDestroy(text); + aData->clear(); aData->setText(string); } @@ -196,6 +197,8 @@ void readFromStreamLX(QMimeData* aData,RReadStream& aStream) // dependencies between cleanup styles, and no cleanup stack dependencies on stacked objects. TCardinality mimeTypeCount; aStream >> mimeTypeCount; + if (mimeTypeCount > 0) + aData->clear(); for (int i = 0; i< mimeTypeCount;i++) { // mime type diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 5b5d5ce..c75b20e 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -230,6 +230,7 @@ public: int beginFullScreenCalled : 1; int endFullScreenCalled : 1; + int editorFlags; }; Q_AUTOTEST_EXPORT QS60Data* qGlobalS60Data(); @@ -390,7 +391,8 @@ inline QS60Data::QS60Data() ,s60InstalledTrapHandler(0) #endif ,beginFullScreenCalled(0), - endFullScreenCalled(0) + endFullScreenCalled(0), + editorFlags(0) { } diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 27b1bf2..d4f904b 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -200,10 +200,12 @@ symbian { SOURCES += \ painting/qpaintengine_raster_symbian.cpp \ painting/qregion_s60.cpp \ - painting/qcolormap_s60.cpp + painting/qcolormap_s60.cpp \ + painting/qgraphicssystemhelper_symbian.cpp HEADERS += \ - painting/qpaintengine_raster_symbian_p.h + painting/qpaintengine_raster_symbian_p.h \ + painting/qgraphicssystemhelper_symbian.h } x11|embedded|qpa { diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index 6fbb59f..d79be41 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -1625,7 +1625,7 @@ void QWidgetPrivate::repaint_sys(const QRegion &rgn) extra->staticContentsSize = data.crect.size(); } -#ifdef Q_WS_QPA //Dont even call q->p +#ifdef Q_WS_QPA //Don't even call q->p QPaintEngine *engine = 0; #else QPaintEngine *engine = q->paintEngine(); diff --git a/src/gui/painting/qgraphicssystemex_symbian.cpp b/src/gui/painting/qgraphicssystemex_symbian.cpp index 5a182ff..5bfd5a8 100644 --- a/src/gui/painting/qgraphicssystemex_symbian.cpp +++ b/src/gui/painting/qgraphicssystemex_symbian.cpp @@ -74,7 +74,7 @@ bool QSymbianGraphicsSystemEx::hasBCM2727() #if 1 // Hacky but fast ~0ms. const char* vendor = eglQueryString(display, EGL_VENDOR); - if (strstr(vendor, "Broadcom")) { + if (vendor && strstr(vendor, "Broadcom")) { const TUid KIvePropertyCat = {0x2726beef}; enum TIvePropertyChipType { EVCBCM2727B1 = 0x00000000, diff --git a/src/gui/painting/qgraphicssystemhelper_symbian.cpp b/src/gui/painting/qgraphicssystemhelper_symbian.cpp new file mode 100644 index 0000000..eb70247 --- /dev/null +++ b/src/gui/painting/qgraphicssystemhelper_symbian.cpp @@ -0,0 +1,141 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgraphicssystemhelper_symbian.h" +#include "qt_s60_p.h" +#include "qwidget_p.h" + +QT_BEGIN_NAMESPACE + +/*! + \enum QSymbianGraphicsSystemHelper::NativePaintMode + + This enum controls the way in which QWidget paints content from the Qt + backing store into the corresponding native window surface. + + \value NativePaintModeDefault Default painting behaviour. + \value NativePaintModeZeroFill Ignore contents of backing store, and + fill the window surface region with zeroes. + \value NativePaintModeWriteAlpha By default, alpha values are only copied + from the backing store into the window surface if the top-level widget + has the Qt::WA_TranslucentBackground attribute. If this mode is set, + alpha values are copied regardless of the value of that attribute. + \value NativePaintModeDisable Do not paint anything into the native window + surface. + */ + +/*! + \class QSymbianGraphicsSystemHelper + \ingroup painting + + \brief QSymbianGraphicsSystemHelper defines functions required by + QtMultimediaKit in order to enable video rendering. + + This class is not intended for use by applications. +*/ + +/*! + Specify whether native focus change events should be ignored by the widget. +*/ + +void QSymbianGraphicsSystemHelper::setIgnoreFocusChanged(QWidget *widget, bool value) +{ + static_cast<QSymbianControl *>(widget->winId())->setIgnoreFocusChanged(value); +} + +/*! + Set the native paint mode to the specified \a mode. +*/ + +void QSymbianGraphicsSystemHelper::setNativePaintMode(QWidget *widget, NativePaintMode mode) +{ + QWidgetPrivate *widgetPrivate = qt_widget_private(widget->window()); + widgetPrivate->createExtra(); + QWExtra::NativePaintMode widgetMode = QWExtra::Default; + switch (mode) { + case NativePaintModeDefault: + break; + case NativePaintModeZeroFill: + widgetMode = QWExtra::ZeroFill; + break; + case NativePaintModeWriteAlpha: + widgetMode = QWExtra::BlitWriteAlpha; + break; + case NativePaintModeDisable: + widgetMode = QWExtra::Disable; + break; + } + widgetPrivate->extraData()->nativePaintMode = widgetMode; +} + +/*! + Set the native paint mode to the specified \a mode. +*/ + +void QSymbianGraphicsSystemHelper::setNativePaintMode(WId wid, NativePaintMode mode) +{ + QWidget *window = static_cast<QSymbianControl *>(wid)->widget()->window(); + setNativePaintMode(window, mode); +} + +/*! + Specify whether the widget should receive receive native paint events. + + If enabled, the QWidget::beginNativePaintEvent slot is called before + content from the backing store is written into the native window + surface, and QWidget::endNativePaintEvent is called once writing to + the native window surface is complete. + + This function is intended for use by QWidget clients such as video + widgets, which wish to use Direct Screen Access to write into the + native window surface. Such clients should stop their DSA session on + receipt of QWidget::beginNativePaintEvent, and re-start it on receipt of + QWidget::endNativePaintEvent. +*/ + +void QSymbianGraphicsSystemHelper::setReceiveNativePaintEvents(QWidget *widget, bool value) +{ + QWidgetPrivate *widgetPrivate = qt_widget_private(widget); + widgetPrivate->createExtra(); + widgetPrivate->extraData()->receiveNativePaintEvents = value; +} + +QT_END_NAMESPACE diff --git a/src/gui/painting/qgraphicssystemhelper_symbian.h b/src/gui/painting/qgraphicssystemhelper_symbian.h new file mode 100644 index 0000000..b74144e --- /dev/null +++ b/src/gui/painting/qgraphicssystemhelper_symbian.h @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSYMBIANGRAPHICSSYSTEMHELPER_H +#define QSYMBIANGRAPHICSSYSTEMHELPER_H + +#include <QtCore/qglobal.h> + +#ifndef Q_OS_SYMBIAN +#error "This header file can only be included when building for Symbian" +#endif + +#include <QtGui/qwindowdefs.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QWidget; + +class Q_GUI_EXPORT QSymbianGraphicsSystemHelper +{ +public: + enum NativePaintMode { + NativePaintModeDefault, + NativePaintModeZeroFill, + NativePaintModeWriteAlpha, + NativePaintModeDisable + }; + + static void setIgnoreFocusChanged(QWidget *widget, bool value); + static void setNativePaintMode(QWidget *widget, NativePaintMode mode); + static void setNativePaintMode(WId wid, NativePaintMode mode); + static void setReceiveNativePaintEvents(QWidget *widget, bool value); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSYMBIANGRAPHICSSYSTEMHELPER_H + diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp index 71d61a4..4167b6d 100644 --- a/src/network/kernel/qnetworkproxy.cpp +++ b/src/network/kernel/qnetworkproxy.cpp @@ -1384,9 +1384,9 @@ void QNetworkProxyFactory::setApplicationProxyFactory(QNetworkProxyFactory *fact SOCKS server for all queries. If SOCKS isn't enabled, it will use the HTTPS proxy for all TcpSocket and UrlRequest queries. - On other systems, there is no standardised method of obtaining the - system proxy configuration. This function may be improved in - future versions to support those systems. + On other systems, this function will pick up proxy settings from + the "http_proxy" environment variable. This variable must be a URL + using one of the following schemes: "http", "socks5" or "socks5h". \section1 Limitations diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 5f520f7..872b19c 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -254,7 +254,11 @@ bool QSslSocketBackendPrivate::initSslContext() init_context: switch (configuration.protocol) { case QSsl::SslV2: +#ifndef OPENSSL_NO_SSL2 ctx = q_SSL_CTX_new(client ? q_SSLv2_client_method() : q_SSLv2_server_method()); +#else + ctx = 0; // SSL 2 not supported by the system, but chosen deliberately -> error +#endif break; case QSsl::SslV3: ctx = q_SSL_CTX_new(client ? q_SSLv3_client_method() : q_SSLv3_server_method()); diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index 90a840f..51ecf5d 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -222,11 +222,15 @@ DEFINEFUNC(void, SSL_set_accept_state, SSL *a, a, return, DUMMYARG) DEFINEFUNC(void, SSL_set_connect_state, SSL *a, a, return, DUMMYARG) DEFINEFUNC(int, SSL_shutdown, SSL *a, a, return -1, return) #if OPENSSL_VERSION_NUMBER >= 0x10000000L +#ifndef OPENSSL_NO_SSL2 DEFINEFUNC(const SSL_METHOD *, SSLv2_client_method, DUMMYARG, DUMMYARG, return 0, return) +#endif DEFINEFUNC(const SSL_METHOD *, SSLv3_client_method, DUMMYARG, DUMMYARG, return 0, return) DEFINEFUNC(const SSL_METHOD *, SSLv23_client_method, DUMMYARG, DUMMYARG, return 0, return) DEFINEFUNC(const SSL_METHOD *, TLSv1_client_method, DUMMYARG, DUMMYARG, return 0, return) +#ifndef OPENSSL_NO_SSL2 DEFINEFUNC(const SSL_METHOD *, SSLv2_server_method, DUMMYARG, DUMMYARG, return 0, return) +#endif DEFINEFUNC(const SSL_METHOD *, SSLv3_server_method, DUMMYARG, DUMMYARG, return 0, return) DEFINEFUNC(const SSL_METHOD *, SSLv23_server_method, DUMMYARG, DUMMYARG, return 0, return) DEFINEFUNC(const SSL_METHOD *, TLSv1_server_method, DUMMYARG, DUMMYARG, return 0, return) @@ -741,11 +745,15 @@ bool q_resolveOpenSslSymbols() RESOLVEFUNC(SSL_set_connect_state) RESOLVEFUNC(SSL_shutdown) RESOLVEFUNC(SSL_write) +#ifndef OPENSSL_NO_SSL2 RESOLVEFUNC(SSLv2_client_method) +#endif RESOLVEFUNC(SSLv3_client_method) RESOLVEFUNC(SSLv23_client_method) RESOLVEFUNC(TLSv1_client_method) +#ifndef OPENSSL_NO_SSL2 RESOLVEFUNC(SSLv2_server_method) +#endif RESOLVEFUNC(SSLv3_server_method) RESOLVEFUNC(SSLv23_server_method) RESOLVEFUNC(TLSv1_server_method) diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp index 518c860..b31833a 100644 --- a/src/opengl/qgl_qpa.cpp +++ b/src/opengl/qgl_qpa.cpp @@ -404,7 +404,7 @@ QGLContext *QGLContext::fromPlatformGLContext(QPlatformGLContext *platformContex return reinterpret_cast<QGLContext *>(platformContext->qGLContextHandle()); } QGLContext *glContext = new QGLContext(platformContext); - //Dont call create on context. This can cause the platformFormat to be set on the widget, which + //Don't call create on context. This can cause the platformFormat to be set on the widget, which //will cause the platformWindow to be recreated. return glContext; } diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index e963f8c..a15084b 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -362,7 +362,7 @@ QGLWindowSurface::~QGLWindowSurface() { if (d_ptr->ctx) glDeleteTextures(1, &d_ptr->tex_id); -#ifndef Q_WS_QPA // Dont delete the contexts. Destroying the window does that for us +#ifndef Q_WS_QPA // Don't delete the contexts. Destroying the window does that for us foreach(QGLContext **ctx, d_ptr->contexts) { delete *ctx; *ctx = 0; diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp index a7dad2b..f5f71cf 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp +++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp @@ -97,7 +97,6 @@ void QNetworkSessionPrivateImpl::closeHandles() QSymbianSocketManager::instance().setDefaultConnection(0); - iConnectionMonitor.Close(); #ifdef QT_BEARERMGMT_SYMBIAN_DEBUG qDebug() << "QNS this : " << QString::number((uint)this) << " - handles closed"; @@ -111,6 +110,7 @@ QNetworkSessionPrivateImpl::~QNetworkSessionPrivateImpl() isOpening = false; closeHandles(); + iConnectionMonitor.Close(); #ifdef QT_BEARERMGMT_SYMBIAN_DEBUG qDebug() << "QNS this : " << QString::number((uint)this) << " - destroyed"; diff --git a/src/plugins/imageformats/imageformats.pro b/src/plugins/imageformats/imageformats.pro index 5fff2de..54a2795 100644 --- a/src/plugins/imageformats/imageformats.pro +++ b/src/plugins/imageformats/imageformats.pro @@ -6,3 +6,4 @@ TEMPLATE = subdirs contains(QT_CONFIG, svg):SUBDIRS += svg !contains(QT_CONFIG, no-tiff):!contains(QT_CONFIG, tiff):SUBDIRS += tiff !contains(QT_CONFIG, no-ico):SUBDIRS += ico +!contains(QT_CONFIG, no-tga):SUBDIRS += tga diff --git a/src/plugins/imageformats/tga/main.cpp b/src/plugins/imageformats/tga/main.cpp new file mode 100644 index 0000000..5650be2 --- /dev/null +++ b/src/plugins/imageformats/tga/main.cpp @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtQuick3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtGui/QImageIOHandler> +#include <QtCore/QDebug> + +#ifndef QT_NO_IMAGEFORMATPLUGIN + +#ifdef QT_NO_IMAGEFORMAT_TGA +#undef QT_NO_IMAGEFORMAT_TGA +#endif + +#include "qtgahandler.h" + +QT_BEGIN_NAMESPACE + +class QTgaPlugin : public QImageIOPlugin +{ +public: + Capabilities capabilities(QIODevice * device, const QByteArray & format) const; + QImageIOHandler * create(QIODevice * device, const QByteArray & format = QByteArray()) const; + QStringList keys() const; +}; + +QImageIOPlugin::Capabilities QTgaPlugin::capabilities(QIODevice *device, const QByteArray &format) const +{ + if (format == "tga") + return Capabilities(CanRead); + if (!format.isEmpty()) + return 0; + if (!device->isOpen()) + return 0; + + Capabilities cap; + if (device->isReadable() && QTgaHandler::canRead(device)) + cap |= CanRead; + return cap; +} + +QImageIOHandler* QTgaPlugin::create(QIODevice *device, const QByteArray &format) const +{ + QImageIOHandler *tgaHandler = new QTgaHandler(); + tgaHandler->setDevice(device); + tgaHandler->setFormat(format); + return tgaHandler; +} + +QStringList QTgaPlugin::keys() const +{ + return QStringList() << QLatin1String("tga"); +} + +Q_EXPORT_PLUGIN2(qtga, QTgaPlugin) + +QT_END_NAMESPACE + +#endif /* QT_NO_IMAGEFORMATPLUGIN */ diff --git a/src/plugins/imageformats/tga/qtgafile.cpp b/src/plugins/imageformats/tga/qtgafile.cpp new file mode 100644 index 0000000..885a63c --- /dev/null +++ b/src/plugins/imageformats/tga/qtgafile.cpp @@ -0,0 +1,266 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtQuick3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtgafile.h" + +#include <QtCore/QIODevice> +#include <QtCore/QDebug> +#include <QtCore/QDateTime> + +struct TgaReader +{ + virtual ~TgaReader() {} + virtual QRgb operator()(QIODevice *s) const = 0; +}; + +struct Tga16Reader : public TgaReader +{ + ~Tga16Reader() {} + QRgb operator()(QIODevice *s) const + { + char ch1, ch2; + if (s->getChar(&ch1) && s->getChar(&ch2)) { + quint16 d = (int(ch1) & 0xFF) | ((int(ch2) & 0xFF) << 8); + QRgb result = (d & 0x8000) ? 0xFF000000 : 0x00000000; + result |= (d & 0x7C00 << 6) | (d & 0x03E0 << 3) | (d & 0x001F); + return result; + } else { + return 0; + } + } +}; + +struct Tga24Reader : public TgaReader +{ + QRgb operator()(QIODevice *s) const + { + char r, g, b; + if (s->getChar(&b) && s->getChar(&g) && s->getChar(&r)) + return qRgb(uchar(r), uchar(g), uchar(b)); + else + return 0; + } +}; + +struct Tga32Reader : public TgaReader +{ + QRgb operator()(QIODevice *s) const + { + char r, g, b, a; + if (s->getChar(&b) && s->getChar(&g) && s->getChar(&r) && s->getChar(&a)) + return qRgba(uchar(r), uchar(g), uchar(b), uchar(a)); + else + return 0; + } +}; + +/*! + \class QTgaFile + \since 4.8 + \internal + + File data container for a TrueVision Graphics format file. + + Format is as described here: + http://local.wasp.uwa.edu.au/~pbourke/dataformats/tga/ + http://netghost.narod.ru/gff2/graphics/summary/tga.htm + + Usage is: + \code + QTgaFile tga(myFile); + QImage tgaImage; + if (tga.isValid()) + tgaImage = tga.readImage(); + \endcode + + The class is designed to handle sequential and non-sequential + sources, so during construction the mHeader is read. Then during + the readImage() call the rest of the data is read. + + After passing myFile to the constructor, if the QIODevice *myFile + is read, or has seek() called, the results are undefined - so don't + do that. +*/ + +/*! + Construct a new QTgaFile object getting data from \a device. + + The object does not take ownership of the \a device, but until the + object is destroyed do not do any non-const operations, eg seek or + read on the device. +*/ +QTgaFile::QTgaFile(QIODevice *device) + : mDevice(device) +{ + ::memset(mHeader, 0, HeaderSize); + if (!mDevice->isReadable()) + { + mErrorMessage = QObject::tr("Could not read image data"); + return; + } + if (mDevice->isSequential()) + { + mErrorMessage = QObject::tr("Sequential device (eg socket) for image read not supported"); + return; + } + if (!mDevice->seek(0)) + { + mErrorMessage = QObject::tr("Seek file/device for image read failed"); + return; + } + int bytes = device->read((char*)mHeader, HeaderSize); + if (bytes != HeaderSize) + { + mErrorMessage = QObject::tr("Image mHeader read failed"); + return; + } + if (mHeader[ImageType] != 2) + { + // TODO: should support other image types + mErrorMessage = QObject::tr("Image type not supported"); + return; + } + int bitsPerPixel = mHeader[PixelDepth]; + bool validDepth = (bitsPerPixel == 16 || bitsPerPixel == 24 || bitsPerPixel == 32); + if (!validDepth) + { + mErrorMessage = QObject::tr("Image dpeth not valid"); + } + int curPos = mDevice->pos(); + int fileBytes = mDevice->size(); + if (!mDevice->seek(fileBytes - FooterSize)) + { + mErrorMessage = QObject::tr("Could not seek to image read footer"); + return; + } + char footer[FooterSize]; + bytes = mDevice->read((char*)footer, FooterSize); + if (bytes != FooterSize) + { + mErrorMessage = QObject::tr("Could not read footer"); + } + if (qstrncmp(&footer[SignatureOffset], "TRUEVISION-XFILE", 16) != 0) + { + mErrorMessage = QObject::tr("Image type (non-TrueVision 2.0) not supported"); + } + if (!mDevice->seek(curPos)) + { + mErrorMessage = QObject::tr("Could not reset to read data"); + } +} + +/*! + \internal + Destroy the device, recovering any resources. +*/ +QTgaFile::~QTgaFile() +{ +} + +/*! + \internal + Reads an image file from the QTgaFile's device, and returns it. + + This method seeks to the absolute position of the image data in the file, + so no assumptions are made about where the devices read pointer is when this + method is called. For this reason only random access devices are supported. + + If the constructor completed successfully, such that isValid() returns true, + then this method is likely to succeed, unless the file is somehow corrupted. + + In the case that the read fails, the QImage returned will be null, such that + QImage::isNull() will be true. +*/ +QImage QTgaFile::readImage() +{ + if (!isValid()) + return QImage(); + + int offset = mHeader[IdLength]; // Mostly always zero + + // Even in TrueColor files a color pallette may be present + if (mHeader[ColorMapType] == 1) + offset += littleEndianInt(&mHeader[CMapLength]) * littleEndianInt(&mHeader[CMapDepth]); + + mDevice->seek(HeaderSize + offset); + + char dummy; + for (int i = 0; i < offset; ++i) + mDevice->getChar(&dummy); + + int bitsPerPixel = mHeader[PixelDepth]; + int imageWidth = width(); + int imageHeight = height(); + + unsigned char desc = mHeader[ImageDescriptor]; + //unsigned char xCorner = desc & 0x10; // 0 = left, 1 = right + unsigned char yCorner = desc & 0x20; // 0 = lower, 1 = upper + + QImage im(imageWidth, imageHeight, QImage::Format_ARGB32); + TgaReader *reader = 0; + if (bitsPerPixel == 16) + reader = new Tga16Reader(); + else if (bitsPerPixel == 24) + reader = new Tga24Reader(); + else if (bitsPerPixel == 32) + reader = new Tga32Reader(); + TgaReader &read = *reader; + + // For now only deal with yCorner, since no one uses xCorner == 1 + // Also this is upside down, since Qt has the origin flipped + if (yCorner) + { + for (int y = 0; y < imageHeight; ++y) + for (int x = 0; x < imageWidth; ++x) + im.setPixel(x, y, read(mDevice)); + } + else + { + for (int y = imageHeight - 1; y >= 0; --y) + for (int x = 0; x < imageWidth; ++x) + im.setPixel(x, y, read(mDevice)); + } + + delete reader; + + // TODO: add processing of TGA extension information - ie TGA 2.0 files + return im; +} diff --git a/src/plugins/imageformats/tga/qtgafile.h b/src/plugins/imageformats/tga/qtgafile.h new file mode 100644 index 0000000..264c18b --- /dev/null +++ b/src/plugins/imageformats/tga/qtgafile.h @@ -0,0 +1,157 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtQuick3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTGAFILE_H +#define QTGAFILE_H + +#include <QtGui/QColor> +#include <QtGui/QImage> + +QT_BEGIN_NAMESPACE + +class QIODevice; + +class QTgaFile +{ +public: + enum Compression { + NoCompression = 0, + RleCompression = 1 + }; + + enum HeaderOffset { + IdLength = 0, /* 00h Size of Image ID field */ + ColorMapType = 1, /* 01h Color map type */ + ImageType = 2, /* 02h Image type code */ + CMapStart = 3, /* 03h Color map origin */ + CMapLength = 5, /* 05h Color map length */ + CMapDepth = 7, /* 07h Depth of color map entries */ + XOffset = 8, /* 08h X origin of image */ + YOffset = 10, /* 0Ah Y origin of image */ + Width = 12, /* 0Ch Width of image */ + Height = 14, /* 0Eh Height of image */ + PixelDepth = 16, /* 10h Image pixel size */ + ImageDescriptor = 17, /* 11h Image descriptor byte */ + HeaderSize = 18 + }; + + enum FooterOffset { + ExtensionOffset = 0, + DeveloperOffset = 4, + SignatureOffset = 8, + FooterSize = 26 + }; + + QTgaFile(QIODevice *); + ~QTgaFile(); + + inline bool isValid() const; + inline QString errorMessage() const; + QImage readImage(); + inline int xOffset() const; + inline int yOffset() const; + inline int width() const; + inline int height() const; + inline QSize size() const; + inline Compression compression() const; + +private: + static inline quint16 littleEndianInt(const unsigned char *d); + + QString mErrorMessage; + unsigned char mHeader[HeaderSize]; + QIODevice *mDevice; +}; + +inline bool QTgaFile::isValid() const +{ + return mErrorMessage.isEmpty(); +} + +inline QString QTgaFile::errorMessage() const +{ + return mErrorMessage; +} + +/*! + \internal + Returns the integer encoded in the two little endian bytes at \a d. +*/ +inline quint16 QTgaFile::littleEndianInt(const unsigned char *d) +{ + return d[0] + d[1] * 256; +} + +inline int QTgaFile::xOffset() const +{ + return littleEndianInt(&mHeader[XOffset]); +} + +inline int QTgaFile::yOffset() const +{ + return littleEndianInt(&mHeader[YOffset]); +} + +inline int QTgaFile::width() const +{ + return littleEndianInt(&mHeader[Width]); +} + +inline int QTgaFile::height() const +{ + return littleEndianInt(&mHeader[Height]); +} + +inline QSize QTgaFile::size() const +{ + return QSize(width(), height()); +} + +inline QTgaFile::Compression QTgaFile::compression() const +{ + // TODO: for now, only handle type 2 files, with no color table + // and no compression + return NoCompression; +} + +QT_END_NAMESPACE + +#endif // QTGAFILE_H diff --git a/src/plugins/imageformats/tga/qtgahandler.cpp b/src/plugins/imageformats/tga/qtgahandler.cpp new file mode 100644 index 0000000..ddea4f2 --- /dev/null +++ b/src/plugins/imageformats/tga/qtgahandler.cpp @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtQuick3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtgahandler.h" +#include "qtgafile.h" + +#include <QtCore/QVariant> +#include <QtCore/QDebug> +#include <QtGui/QImage> + +QT_BEGIN_NAMESPACE + +QTgaHandler::QTgaHandler() + : QImageIOHandler() + , tga(0) +{ +} + +QTgaHandler::~QTgaHandler() +{ + delete tga; +} + +bool QTgaHandler::canRead() const +{ + if (!tga) + tga = new QTgaFile(device()); + if (tga->isValid()) + { + setFormat("tga"); + return true; + } + return false; +} + +bool QTgaHandler::canRead(QIODevice *device) +{ + if (!device) { + qWarning("QTgaHandler::canRead() called with no device"); + return false; + } + QTgaFile tga(device); + return tga.isValid(); +} + +bool QTgaHandler::read(QImage *image) +{ + if (!canRead()) + return false; + *image = tga->readImage(); + return !image->isNull(); +} + +QByteArray QTgaHandler::name() const +{ + return "tga"; +} + +QVariant QTgaHandler::option(ImageOption option) const +{ + if (option == Size && canRead()) { + return tga->size(); + } else if (option == CompressionRatio) { + return tga->compression(); + } else if (option == ImageFormat) { + return QImage::Format_ARGB32; + } + return QVariant(); +} + +void QTgaHandler::setOption(ImageOption option, const QVariant &value) +{ + Q_UNUSED(option); + Q_UNUSED(value); +} + +bool QTgaHandler::supportsOption(ImageOption option) const +{ + return option == CompressionRatio + || option == Size + || option == ImageFormat; +} + +QT_END_NAMESPACE diff --git a/src/plugins/imageformats/tga/qtgahandler.h b/src/plugins/imageformats/tga/qtgahandler.h new file mode 100644 index 0000000..f0eb2b0 --- /dev/null +++ b/src/plugins/imageformats/tga/qtgahandler.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtQuick3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTGAHANDLER_H +#define QTGAHANDLER_H + +#include <QtGui/QImageIOHandler> + +QT_BEGIN_NAMESPACE + +class QTgaFile; + +class QTgaHandler : public QImageIOHandler +{ +public: + QTgaHandler(); + ~QTgaHandler(); + + bool canRead() const; + bool read(QImage *image); + + QByteArray name() const; + + static bool canRead(QIODevice *device); + + QVariant option(ImageOption option) const; + void setOption(ImageOption option, const QVariant &value); + bool supportsOption(ImageOption option) const; + +private: + mutable QTgaFile *tga; +}; + +QT_END_NAMESPACE + +#endif // QTGAHANDLER_H diff --git a/src/plugins/imageformats/tga/tga.pro b/src/plugins/imageformats/tga/tga.pro new file mode 100644 index 0000000..292d06e --- /dev/null +++ b/src/plugins/imageformats/tga/tga.pro @@ -0,0 +1,16 @@ +TARGET = qtga +include(../../qpluginbase.pri) + +QTDIR_build:REQUIRES = "!contains(QT_CONFIG, no-tga)" + +HEADERS += qtgahandler.h \ + qtgafile.h +SOURCES += main.cpp \ + qtgahandler.cpp \ + qtgafile.cpp + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/imageformats +target.path += $$[QT_INSTALL_PLUGINS]/imageformats +INSTALLS += target + +symbian: TARGET.UID3=0x20031E99 diff --git a/src/plugins/inputmethods/imsw-multi/qmultiinputcontext.cpp b/src/plugins/inputmethods/imsw-multi/qmultiinputcontext.cpp index 258d586..25abe17 100644 --- a/src/plugins/inputmethods/imsw-multi/qmultiinputcontext.cpp +++ b/src/plugins/inputmethods/imsw-multi/qmultiinputcontext.cpp @@ -46,7 +46,7 @@ ** Copyright (C) 2004 immodule for Qt Project. All rights reserved. ** ** This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own -** licence. You may use this file under your Qt license. Following +** license. You may use this file under your Qt license. Following ** description is copied from their original file headers. Contact ** immodule-qt@freedesktop.org if any conditions of this licensing are ** not clear to you. diff --git a/src/plugins/inputmethods/imsw-multi/qmultiinputcontext.h b/src/plugins/inputmethods/imsw-multi/qmultiinputcontext.h index 5d311b3..cc1b1f0 100644 --- a/src/plugins/inputmethods/imsw-multi/qmultiinputcontext.h +++ b/src/plugins/inputmethods/imsw-multi/qmultiinputcontext.h @@ -46,7 +46,7 @@ ** Copyright (C) 2004 immodule for Qt Project. All rights reserved. ** ** This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own -** licence. You may use this file under your Qt license. Following +** license. You may use this file under your Qt license. Following ** description is copied from their original file headers. Contact ** immodule-qt@freedesktop.org if any conditions of this licensing are ** not clear to you. diff --git a/src/plugins/platforms/openkode/qopenkodewindow.cpp b/src/plugins/platforms/openkode/qopenkodewindow.cpp index c6fe6d0..dedd2d5 100644 --- a/src/plugins/platforms/openkode/qopenkodewindow.cpp +++ b/src/plugins/platforms/openkode/qopenkodewindow.cpp @@ -283,7 +283,7 @@ void QOpenKODEWindow::processKeyEvents(const KDEvent *event) QEvent::Type keyPressed = QEvent::KeyRelease; if (event->data.keyboardInputKey.flags) keyPressed = QEvent::KeyPress; -//KD_KEY_LOCATION_LEFT_ATX // dont care for now +//KD_KEY_LOCATION_LEFT_ATX // don't care for now //KD_KEY_LOCATION_RIGHT_ATX //KD_KEY_LOCATION_NUMPAD_ATX Qt::KeyboardModifiers mod = Qt::NoModifier; diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 80a1624..4f3021e 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -59,7 +59,7 @@ #include <X11/Xlib-xcb.h> #endif -#ifdef XCB_USE_EGL //dont pull in eglext prototypes +#ifdef XCB_USE_EGL //don't pull in eglext prototypes #include <EGL/egl.h> #endif diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index cf6b0da..375f3a2 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -13990,3 +13990,4 @@ EXPORTS ?resetFontEngineCache@QTextEngine@@QAEXXZ @ 13989 NONAME ; void QTextEngine::resetFontEngineCache(void) ?symbianHandleLiteModeStartup@QApplicationPrivate@@QAEXXZ @ 13990 NONAME ; void QApplicationPrivate::symbianHandleLiteModeStartup(void) ?_q_cleanupWinIds@QWidgetPrivate@@QAEXXZ @ 13991 NONAME ; void QWidgetPrivate::_q_cleanupWinIds(void) + ?qt_s60_setEditorFlags@@YAXH@Z @ 13992 NONAME ; void qt_s60_setEditorFlags(int) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index f667bab..07f0929 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -12803,3 +12803,4 @@ EXPORTS _ZN11QTextEngine20resetFontEngineCacheEv @ 12802 NONAME _ZN14QWidgetPrivate16_q_cleanupWinIdsEv @ 12803 NONAME _ZN19QApplicationPrivate28symbianHandleLiteModeStartupEv @ 12804 NONAME + _Z21qt_s60_setEditorFlagsi @ 12805 NONAME diff --git a/src/testlib/3rdparty/valgrind_p.h b/src/testlib/3rdparty/valgrind_p.h index 6380a9f..70ba371 100644 --- a/src/testlib/3rdparty/valgrind_p.h +++ b/src/testlib/3rdparty/valgrind_p.h @@ -3703,8 +3703,8 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...) /* These requests allow control to move from the simulated CPU to the - real CPU, calling an arbitary function. - + real CPU, calling an arbitrary function. + Note that the current ThreadId is inserted as the first argument. So this call: diff --git a/src/testlib/qxmltestlogger.cpp b/src/testlib/qxmltestlogger.cpp index 2c8ba6c..1cb221c 100644 --- a/src/testlib/qxmltestlogger.cpp +++ b/src/testlib/qxmltestlogger.cpp @@ -120,14 +120,14 @@ void QXmlTestLogger::startLogging() QTest::qt_asprintf(&buf, "<Environment>\n" " <QtVersion>%s</QtVersion>\n" - " <QTestVersion>"QTEST_VERSION_STR"</QTestVersion>\n" + " <QTestVersion>" QTEST_VERSION_STR "</QTestVersion>\n" " <RandomSeed>%d</RandomSeed>\n" "</Environment>\n", qVersion(), randomSeed); } else { QTest::qt_asprintf(&buf, "<Environment>\n" " <QtVersion>%s</QtVersion>\n" - " <QTestVersion>"QTEST_VERSION_STR"</QTestVersion>\n" + " <QTestVersion>" QTEST_VERSION_STR "</QTestVersion>\n" "</Environment>\n", qVersion()); } outputString(buf.constData()); diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp index 7c7cafc..ccc6e8b 100644 --- a/src/xml/dom/qdom.cpp +++ b/src/xml/dom/qdom.cpp @@ -3487,10 +3487,10 @@ QDomDocumentTypePrivate::QDomDocumentTypePrivate(QDomDocumentTypePrivate* n, boo QDomNodePrivate* p = first; while (p) { if (p->isEntity()) - // Dont use normal insert function since we would create infinite recursion + // Don't use normal insert function since we would create infinite recursion entities->map.insertMulti(p->nodeName(), p); if (p->isNotation()) - // Dont use normal insert function since we would create infinite recursion + // Don't use normal insert function since we would create infinite recursion notations->map.insertMulti(p->nodeName(), p); p = p->next; } @@ -5725,7 +5725,7 @@ static QByteArray encodeEntity(const QByteArray& str) len += 4; i += 5; } else if (d[i] == '&' && i + 1 < len && d[i+1] == '#') { - // Dont encode < or " or &custom;. + // Don't encode < or " or &custom;. // Only encode character references tmp.replace(i, 1, "&"); d = tmp; |