# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1273844413 -10800 # Node ID 79de32ba329684277b7f4dcea8bd88f9521d783a # Parent fcece45ef507e087a274919687a7b7a9bed24786 Revision: 201017 Kit: 201019 diff -r fcece45ef507 -r 79de32ba3296 VERSION.SHA1 --- a/VERSION.SHA1 Mon May 03 13:17:34 2010 +0300 +++ b/VERSION.SHA1 Fri May 14 16:40:13 2010 +0300 @@ -1,1 +1,1 @@ -364597fa4f043db390f1c64462f4d2338d5b1d2b +a27f0b42276ce9e760ed23dcb00dc2edb522a66f diff -r fcece45ef507 -r 79de32ba3296 configure --- a/configure Mon May 03 13:17:34 2010 +0300 +++ b/configure Fri May 14 16:40:13 2010 +0300 @@ -173,6 +173,12 @@ UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +# detect the "echo without newline" style. usage: echo $ECHO_N "$ECHO_C" +if echo '\c' | grep '\c' >/dev/null; then + ECHO_N=-n +else + ECHO_C='\c' +fi #------------------------------------------------------------------------------- # window system detection @@ -399,11 +405,7 @@ else if [ -z "$LicenseKeyExt" ]; then echo - if echo '\c' | grep '\c' >/dev/null; then - echo -n "Please enter your license key: " - else - echo "Please enter your license key: \c" - fi + echo $ECHO_N "Please enter your license key: $ECHO_C" read LicenseKeyExt Licensee="Unknown user" fi @@ -4006,11 +4008,7 @@ echo "Type 'yes' to accept this license offer." echo "Type 'no' to decline this license offer." echo - if echo '\c' | grep '\c' >/dev/null; then - echo -n "Do you accept the terms of $affix license? " - else - echo "Do you accept the terms of $affix license? \c" - fi + echo $ECHO_N "Do you accept the terms of $affix license? $ECHO_C" read acceptance fi echo @@ -4041,11 +4039,7 @@ echo "Type 'yes' to accept this license offer." echo "Type 'no' to decline this license offer." echo - if echo '\c' | grep '\c' >/dev/null; then - echo -n "Do you accept the terms of the license? " - else - echo "Do you accept the terms of the license? \c" - fi + echo $ECHO_N "Do you accept the terms of the license? $ECHO_C" read acceptance fi echo @@ -4131,11 +4125,7 @@ echo "Type 'yes' to accept this license offer." echo "Type 'no' to decline this license offer." echo - if echo '\c' | grep '\c' >/dev/null; then - echo -n "Do you accept the terms of the $TheLicense? " - else - echo "Do you accept the terms of the $TheLicense? \c" - fi + echo $ECHO_N "Do you accept the terms of the $TheLicense? $ECHO_C" read acceptance fi echo @@ -7439,11 +7429,7 @@ fi if [ "$OPT_VERBOSE" = "yes" ]; then - if echo '\c' | grep '\c' >/dev/null; then - echo -n "qmake vars .......... " - else - echo "qmake vars .......... \c" - fi + echo $ECHO_N "qmake vars .......... $ECHO_C" cat "$QMAKE_VARS_FILE" | tr '\n' ' ' echo "qmake switches ...... $QMAKE_SWITCHES" fi @@ -7820,21 +7806,12 @@ continue; fi QMAKE_SPEC_ARGS="-spec $SPEC" - if echo '\c' | grep '\c' >/dev/null; then - echo -n " for $a" - else - echo " for $a\c" - fi + echo $ECHO_N " for $a$ECHO_C" QMAKE="$outpath/bin/qmake" QMAKE_ARGS="$QMAKE_SWITCHES $QMAKE_SPEC_ARGS" if [ "$file" = ".projects.3" ]; then - if echo '\c' | grep '\c' >/dev/null; then - echo -n " (fast)" - else - echo " (fast)\c" - fi - echo + echo " (fast)" cat >"${OUTDIR}/Makefile" < - + - + - + - + - + diff -r fcece45ef507 -r 79de32ba3296 mkspecs/aix-xlc-64/qmake.conf --- a/mkspecs/aix-xlc-64/qmake.conf Mon May 03 13:17:34 2010 +0300 +++ b/mkspecs/aix-xlc-64/qmake.conf Fri May 14 16:40:13 2010 +0300 @@ -48,7 +48,7 @@ QMAKE_LINK = xlC QMAKE_LINK_THREAD = xlC_r QMAKE_LINK_SHLIB = ld -QMAKE_LFLAGS = -q64 +QMAKE_LFLAGS = -q64 -bbigtoc QMAKE_LFLAGS_RELEASE = QMAKE_LFLAGS_DEBUG = QMAKE_LFLAGS_SHLIB = -qmkshrobj diff -r fcece45ef507 -r 79de32ba3296 mkspecs/aix-xlc/qmake.conf --- a/mkspecs/aix-xlc/qmake.conf Mon May 03 13:17:34 2010 +0300 +++ b/mkspecs/aix-xlc/qmake.conf Fri May 14 16:40:13 2010 +0300 @@ -48,7 +48,7 @@ QMAKE_LINK = xlC QMAKE_LINK_THREAD = xlC_r QMAKE_LINK_SHLIB = ld -QMAKE_LFLAGS = +QMAKE_LFLAGS = -bmaxdata:0x80000000 QMAKE_LFLAGS_RELEASE = QMAKE_LFLAGS_DEBUG = QMAKE_LFLAGS_SHLIB = -qmkshrobj diff -r fcece45ef507 -r 79de32ba3296 mkspecs/common/symbian/symbian.conf --- a/mkspecs/common/symbian/symbian.conf Mon May 03 13:17:34 2010 +0300 +++ b/mkspecs/common/symbian/symbian.conf Fri May 14 16:40:13 2010 +0300 @@ -26,7 +26,7 @@ QMAKE_CFLAGS_DEBUG = QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses - +MMP_OPTION_KEYWORDS = CW ARMCC GCCE VERSION_FLAGS.ARMCC = ARMCC_4_0 QMAKE_CXX = g++ QMAKE_CXXFLAGS = $$QMAKE_CFLAGS @@ -100,9 +100,10 @@ QMAKE_CHK_DIR_EXISTS = test -d } -QMAKE_MOC = /epoc32/tools/qt/moc$$(DOTEXE) -QMAKE_UIC = /epoc32/tools/qt/uic$$(DOTEXE) -QMAKE_IDC = /epoc32/tools/qt/idc$$(DOTEXE) +QMAKE_MOC = /epoc32/tools/moc$$(DOTEXE) +QMAKE_UIC = /epoc32/tools/uic$$(DOTEXE) +QMAKE_IDC = /epoc32/tools/idc$$(DOTEXE) +QMAKE_RCC = /epoc32/tools/rcc$$(DOTEXE) QMAKE_IDL = midl QMAKE_LIB = /epoc32/gcc_mingw/bin/ar -ru @@ -181,4 +182,3 @@ } } } - diff -r fcece45ef507 -r 79de32ba3296 mkspecs/features/qt.prf --- a/mkspecs/features/qt.prf Mon May 03 13:17:34 2010 +0300 +++ b/mkspecs/features/qt.prf Fri May 14 16:40:13 2010 +0300 @@ -166,8 +166,14 @@ # we bump the values for all Symbian Phonon plugins. symbian:isEmpty(TARGET.EPOCHEAPSIZE):TARGET.EPOCHEAPSIZE = 0x040000 0x1600000 - } else:isEqual(QTLIB, webkit):qlib = QtWebKit - else:isEqual(QTLIB, declarative):qlib = QtDeclarative + } else:isEqual(QTLIB, webkit) { + qlib = QtWebKit + aix-xlc { + # Flags recommended by IBM when using WebKit + QMAKE_LFLAGS -= -bmaxdata:0x80000000 + QMAKE_LFLAGS += -bmaxdata:0xD0000000/dsa + } + } else:isEqual(QTLIB, declarative):qlib = QtDeclarative else:isEqual(QTLIB, multimedia):qlib = QtMultimedia else:message("Unknown QT: $$QTLIB"):qlib = !isEmpty(qlib) { diff -r fcece45ef507 -r 79de32ba3296 mkspecs/symbian-sbsv2/flm/qt/ts2qm.flm --- a/mkspecs/symbian-sbsv2/flm/qt/ts2qm.flm Mon May 03 13:17:34 2010 +0300 +++ b/mkspecs/symbian-sbsv2/flm/qt/ts2qm.flm Fri May 14 16:40:13 2010 +0300 @@ -7,7 +7,7 @@ # FLM to convert .ts to .qm -LRELEASE:=$(EPOCROOT)/epoc32/tools/qt/lrelease$(DOTEXE) +LRELEASE:=$(EPOCROOT)/epoc32/tools/lrelease$(DOTEXE) #TSFILE:=$(EPOCROOT)$(TSFILE) #QMFILE:=$(EPOCROOT)$(QMFILE) diff -r fcece45ef507 -r 79de32ba3296 projects.pro --- a/projects.pro Mon May 03 13:17:34 2010 +0300 +++ b/projects.pro Fri May 14 16:40:13 2010 +0300 @@ -9,7 +9,7 @@ isEmpty(QT_BUILD_PARTS) { #defaults symbian { - QT_BUILD_PARTS = libs tools + QT_BUILD_PARTS = libs tools examples demos } else { QT_BUILD_PARTS = libs tools examples demos docs translations } @@ -30,10 +30,6 @@ QT_BUILD_PARTS -= qmake QT_BUILD_PARTS = qmake $$QT_BUILD_PARTS } - symbian { - #QTP: build libs only by default - QT_BUILD_PARTS = libs - } } #process the projects @@ -44,8 +40,6 @@ SUBDIRS += examples } else:isEqual(PROJECT, demos) { SUBDIRS += demos - } else:isEqual(PROJECT, tests) { - SUBDIRS += tests } else:isEqual(PROJECT, libs) { include(src/src.pro) } else:isEqual(PROJECT, docs) { diff -r fcece45ef507 -r 79de32ba3296 qmake/generators/symbian/symmake.cpp --- a/qmake/generators/symbian/symmake.cpp Mon May 03 13:17:34 2010 +0300 +++ b/qmake/generators/symbian/symmake.cpp Fri May 14 16:40:13 2010 +0300 @@ -81,12 +81,8 @@ #define MMP_TARGET "TARGET" #define MMP_TARGETTYPE "TARGETTYPE" #define MMP_SECUREID "SECUREID" -#define MMP_OPTION_CW "OPTION CW" -#define MMP_OPTION_ARMCC "OPTION ARMCC" -#define MMP_OPTION_GCCE "OPTION GCCE" -#define MMP_LINKEROPTION_CW "LINKEROPTION CW" -#define MMP_LINKEROPTION_ARMCC "LINKEROPTION ARMCC" -#define MMP_LINKEROPTION_GCCE "LINKEROPTION GCCE" +#define MMP_OPTION "OPTION" +#define MMP_LINKEROPTION "LINKEROPTION" #define MMP_CAPABILITY "CAPABILITY" #define MMP_EPOCALLOWDLLDATA "EPOCALLOWDLLDATA" #define MMP_EPOCHEAPSIZE "EPOCHEAPSIZE" @@ -97,6 +93,10 @@ #define MMP_START_RESOURCE "START RESOURCE" #define MMP_END_RESOURCE "END" +#define VAR_CXXFLAGS "QMAKE_CXXFLAGS" +#define VAR_CFLAGS "QMAKE_CFLAGS" +#define VAR_LFLAGS "QMAKE_LFLAGS" + #define SIS_TARGET "sis" #define INSTALLER_SIS_TARGET "installer_sis" #define ROM_STUB_SIS_TARGET "stub_sis" @@ -822,8 +822,7 @@ overridableMmpKeywords << QLatin1String(MMP_TARGETTYPE) << QLatin1String(MMP_EPOCHEAPSIZE); restrictableMmpKeywords << QLatin1String(MMP_TARGET) << QLatin1String(MMP_SECUREID) - << QLatin1String(MMP_LINKEROPTION_CW) << QLatin1String(MMP_LINKEROPTION_ARMCC) - << QLatin1String(MMP_LINKEROPTION_GCCE) + << QLatin1String(MMP_OPTION) << QLatin1String(MMP_LINKEROPTION) << QLatin1String(MMP_CAPABILITY) << QLatin1String(MMP_EPOCALLOWDLLDATA) << QLatin1String(MMP_EPOCSTACKSIZE) << QLatin1String(MMP_UID) << QLatin1String(MMP_VENDORID) << QLatin1String(MMP_VERSION); @@ -1186,119 +1185,64 @@ t << endl << endl; } -void SymbianMakefileGenerator::writeMmpFileCompilerOptionPart(QTextStream& t) +void SymbianMakefileGenerator::writeMmpFileConditionalOptions(QTextStream& t, + const QString &optionType, + const QString &optionTag, + const QString &variableBase) { - QString cw, armcc, gcce; - QString cwlink, armlink, gccelink; - - if (0 != project->values("QMAKE_CXXFLAGS.CW").size()) { - cw.append(project->values("QMAKE_CXXFLAGS.CW").join(" ")); - cw.append(" "); - } - - if (0 != project->values("QMAKE_CXXFLAGS.ARMCC").size()) { - armcc.append(project->values("QMAKE_CXXFLAGS.ARMCC").join(" ")); - armcc.append(" "); - } - - if (0 != project->values("QMAKE_CXXFLAGS.GCCE").size()) { - gcce.append(project->values("QMAKE_CXXFLAGS.GCCE").join(" ")); - gcce.append(" "); - } - - if (0 != project->values("QMAKE_CFLAGS.CW").size()) { - cw.append(project->values("QMAKE_CFLAGS.CW").join(" ")); - cw.append(" "); - } - - if (0 != project->values("QMAKE_CFLAGS.ARMCC").size()) { - armcc.append(project->values("QMAKE_CFLAGS.ARMCC").join(" ")); - armcc.append(" "); - } - - if (0 != project->values("QMAKE_CFLAGS.GCCE").size()) { - gcce.append(project->values("QMAKE_CXXFLAGS.GCCE").join(" ")); - gcce.append(" "); - } - - if (0 != project->values("QMAKE_CXXFLAGS").size()) { - cw.append(project->values("QMAKE_CXXFLAGS").join(" ")); - cw.append(" "); - armcc.append(project->values("QMAKE_CXXFLAGS").join(" ")); - armcc.append(" "); - gcce.append(project->values("QMAKE_CXXFLAGS").join(" ")); - gcce.append(" "); - } - - if (0 != project->values("QMAKE_CFLAGS").size()) { - cw.append(project->values("QMAKE_CFLAGS").join(" ")); - cw.append(" "); - armcc.append(project->values("QMAKE_CFLAGS").join(" ")); - armcc.append(" "); - gcce.append(project->values("QMAKE_CFLAGS").join(" ")); - gcce.append(" "); - } - - if (0 != project->values("QMAKE_LFLAGS.CW").size()) { - cwlink.append(project->values("QMAKE_LFLAGS.CW").join(" ")); - cwlink.append(" "); - } - - if (0 != project->values("QMAKE_LFLAGS.ARMCC").size()) { - armlink.append(project->values("QMAKE_LFLAGS.ARMCC").join(" ")); - armlink.append(" "); - } - - if (0 != project->values("QMAKE_LFLAGS.GCCE").size()) { - gccelink.append(project->values("QMAKE_LFLAGS.GCCE").join(" ")); - gccelink.append(" "); - } - - if (0 != project->values("QMAKE_LFLAGS").size()) { - cwlink.append(project->values("QMAKE_LFLAGS").join(" ")); - cwlink.append(" "); - armlink.append(project->values("QMAKE_LFLAGS").join(" ")); - armlink.append(" "); - gccelink.append(project->values("QMAKE_LFLAGS").join(" ")); - gccelink.append(" "); - } - - if (!cw.isEmpty() && cw[cw.size()-1] == ' ') - cw.chop(1); - if (!armcc.isEmpty() && armcc[armcc.size()-1] == ' ') - armcc.chop(1); - if (!gcce.isEmpty() && gcce[gcce.size()-1] == ' ') - gcce.chop(1); - if (!cwlink.isEmpty() && cwlink[cwlink.size()-1] == ' ') - cwlink.chop(1); - if (!armlink.isEmpty() && armlink[armlink.size()-1] == ' ') - armlink.chop(1); - if (!gccelink.isEmpty() && gccelink[gccelink.size()-1] == ' ') - gccelink.chop(1); - - if (!cw.isEmpty()) - t << MMP_OPTION_CW " " << cw << endl; - if (!armcc.isEmpty()) - t << MMP_OPTION_ARMCC " " << armcc << endl; - - foreach(QString armccVersion, project->values("VERSION_FLAGS.ARMCC")) { - QStringList currentValues = project->values("QMAKE_CXXFLAGS." + armccVersion); + foreach(QString compilerVersion, project->values("VERSION_FLAGS." + optionTag)) { + QStringList currentValues = project->values(variableBase + "." + compilerVersion); if (currentValues.size()) { - t << "#if defined(" << armccVersion << ")" << endl; - t << MMP_OPTION_ARMCC " " << currentValues.join(" ") << endl; + t << "#if defined(" << compilerVersion << ")" << endl; + t << optionType << " " << optionTag << " " << currentValues.join(" ") << endl; t << "#endif" << endl; } } +} - if (!gcce.isEmpty()) - t << MMP_OPTION_GCCE " " << gcce << endl; +void SymbianMakefileGenerator::writeMmpFileSimpleOption(QTextStream& t, + const QString &optionType, + const QString &optionTag, + const QString &options) +{ + QString trimmedOptions = options.trimmed(); + if (!trimmedOptions.isEmpty()) + t << optionType << " " << optionTag << " " << trimmedOptions << endl; +} + +void SymbianMakefileGenerator::appendMmpFileOptions(QString &options, const QStringList &list) +{ + if (list.size()) { + options.append(list.join(" ")); + options.append(" "); + } +} - if (!cwlink.isEmpty()) - t << MMP_LINKEROPTION_CW " " << cwlink << endl; - if (!armlink.isEmpty()) - t << MMP_LINKEROPTION_ARMCC " " << armlink << endl; - if (!gccelink.isEmpty()) - t << MMP_LINKEROPTION_GCCE " " << gccelink << endl; +void SymbianMakefileGenerator::writeMmpFileCompilerOptionPart(QTextStream& t) +{ + QStringList keywords = project->values("MMP_OPTION_KEYWORDS"); + QStringList commonCxxFlags = project->values(VAR_CXXFLAGS); + QStringList commonCFlags = project->values(VAR_CFLAGS); + QStringList commonLFlags = project->values(VAR_LFLAGS); + + foreach(QString item, keywords) { + QString compilerOption; + QString linkerOption; + + appendMmpFileOptions(compilerOption, project->values(VAR_CXXFLAGS "." + item)); + appendMmpFileOptions(compilerOption, project->values(VAR_CFLAGS "." + item)); + appendMmpFileOptions(compilerOption, commonCxxFlags); + appendMmpFileOptions(compilerOption, commonCFlags); + + appendMmpFileOptions(linkerOption, project->values(VAR_LFLAGS "." + item)); + appendMmpFileOptions(linkerOption, commonLFlags); + + writeMmpFileSimpleOption(t, MMP_OPTION, item, compilerOption); + writeMmpFileSimpleOption(t, MMP_LINKEROPTION, item, linkerOption); + + writeMmpFileConditionalOptions(t, MMP_OPTION, item, VAR_CXXFLAGS); + writeMmpFileConditionalOptions(t, MMP_LINKEROPTION, item, VAR_LFLAGS); + } t << endl; } diff -r fcece45ef507 -r 79de32ba3296 qmake/generators/symbian/symmake.h --- a/qmake/generators/symbian/symmake.h Mon May 03 13:17:34 2010 +0300 +++ b/qmake/generators/symbian/symmake.h Fri May 14 16:40:13 2010 +0300 @@ -125,6 +125,15 @@ void writeMmpFileIncludePart(QTextStream& t); void writeMmpFileLibraryPart(QTextStream& t); void writeMmpFileCapabilityPart(QTextStream& t); + void writeMmpFileConditionalOptions(QTextStream& t, + const QString &optionType, + const QString &optionTag, + const QString &variableBase); + void writeMmpFileSimpleOption(QTextStream& t, + const QString &optionType, + const QString &optionTag, + const QString &options); + void appendMmpFileOptions(QString &options, const QStringList &list); void writeMmpFileCompilerOptionPart(QTextStream& t); void writeMmpFileBinaryVersionPart(QTextStream& t); void writeMmpFileRulesPart(QTextStream& t); diff -r fcece45ef507 -r 79de32ba3296 qmake/generators/symbian/symmake_sbsv2.cpp --- a/qmake/generators/symbian/symmake_sbsv2.cpp Mon May 03 13:17:34 2010 +0300 +++ b/qmake/generators/symbian/symmake_sbsv2.cpp Fri May 14 16:40:13 2010 +0300 @@ -75,7 +75,7 @@ foreach(QFileInfo item, sourceInfos) { QFileInfo destInfo = QFileInfo(destDir.absolutePath() + "/" + item.fileName()); - if (!destInfo.exists() || destInfo.lastModified() < item.lastModified()) { + if (!destInfo.exists() || destInfo.lastModified() != item.lastModified()) { if (destInfo.exists()) QFile::remove(destInfo.absoluteFilePath()); if (QFile::copy(item.absoluteFilePath(), destInfo.absoluteFilePath())) { diff -r fcece45ef507 -r 79de32ba3296 qmake/qmake.pri --- a/qmake/qmake.pri Mon May 03 13:17:34 2010 +0300 +++ b/qmake/qmake.pri Fri May 14 16:40:13 2010 +0300 @@ -130,6 +130,7 @@ } else:win32 { SOURCES += qfsfileengine_win.cpp qfsfileengine_iterator_win.cpp qsettings_win.cpp win32-msvc*:LIBS += ole32.lib advapi32.lib + win32-g++:LIBS += -lole32 -luuid } qnx { diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp --- a/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp Fri May 14 16:40:13 2010 +0300 @@ -1107,6 +1107,7 @@ #ifndef NO_OPENTYPE static const HB_OpenTypeFeature indic_features[] = { + { HB_MAKE_TAG('l', 'o', 'c', 'a'), LocaProperty }, { HB_MAKE_TAG('c', 'c', 'm', 'p'), CcmpProperty }, { HB_MAKE_TAG('i', 'n', 'i', 't'), InitProperty }, { HB_MAKE_TAG('n', 'u', 'k', 't'), NuktaProperty }, @@ -1115,12 +1116,14 @@ { HB_MAKE_TAG('b', 'l', 'w', 'f'), BelowFormProperty }, { HB_MAKE_TAG('h', 'a', 'l', 'f'), HalfFormProperty }, { HB_MAKE_TAG('p', 's', 't', 'f'), PostFormProperty }, + { HB_MAKE_TAG('c', 'j', 'c', 't'), ConjunctFormProperty }, { HB_MAKE_TAG('v', 'a', 't', 'u'), VattuProperty }, { HB_MAKE_TAG('p', 'r', 'e', 's'), PreSubstProperty }, { HB_MAKE_TAG('b', 'l', 'w', 's'), BelowSubstProperty }, { HB_MAKE_TAG('a', 'b', 'v', 's'), AboveSubstProperty }, { HB_MAKE_TAG('p', 's', 't', 's'), PostSubstProperty }, { HB_MAKE_TAG('h', 'a', 'l', 'n'), HalantProperty }, + { HB_MAKE_TAG('c', 'a', 'l', 't'), IndicCaltProperty }, { 0, 0 } }; #endif @@ -1148,6 +1151,8 @@ { QString res; properties = ~properties; + if (properties & LocaProperty) + res += "Loca "; if (properties & CcmpProperty) res += "Ccmp "; if (properties & InitProperty) @@ -1168,6 +1173,8 @@ res += "HalfForm "; if (properties & PostFormProperty) res += "PostForm "; + if (properties & ConjunctFormProperty) + res += "PostForm "; if (properties & VattuProperty) res += "Vattu "; if (properties & PreSubstProperty) @@ -1182,6 +1189,8 @@ res += "Halant "; if (properties & CligProperty) res += "Clig "; + if (properties & IndicCaltProperty) + res += "Calt "; return res; } #endif @@ -1296,10 +1305,15 @@ } int skipped = 0; Position pos = Post; - for (i = len-1; i > base; i--) { + for (i = len-1; i >= base; i--) { if (position[i] != Consonant && (position[i] != Control || script == HB_Script_Kannada)) continue; + if (i < len-1 && position[i] == Control && position[i+1] == Consonant) { + base = i+1; + break; + } + Position charPosition = indic_position(uc[i]); if (pos == Post && charPosition == Post) { pos = Post; @@ -1545,16 +1559,20 @@ // features we should always apply for (i = 0; i < len; ++i) - properties[i] = ~(CcmpProperty + properties[i] = ~(LocaProperty + | CcmpProperty | NuktaProperty | VattuProperty + | ConjunctFormProperty | PreSubstProperty | BelowSubstProperty | AboveSubstProperty | PostSubstProperty | HalantProperty + | IndicCaltProperty | PositioningProperties); + // Loca always applies // Ccmp always applies // Init if (item->item.pos == 0 @@ -1611,6 +1629,7 @@ // abvs always applies // psts always applies // halant always applies + // calt always applies #ifdef INDIC_DEBUG // { diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/harfbuzz/src/harfbuzz-shaper-private.h --- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper-private.h Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper-private.h Fri May 14 16:40:13 2010 +0300 @@ -57,34 +57,37 @@ } HB_CombiningClass; typedef enum { - CcmpProperty = 0x1, - InitProperty = 0x2, - IsolProperty = 0x4, - FinaProperty = 0x8, - MediProperty = 0x10, - RligProperty = 0x20, - CaltProperty = 0x40, - LigaProperty = 0x80, - DligProperty = 0x100, - CswhProperty = 0x200, - MsetProperty = 0x400, + LocaProperty = 0x1, + CcmpProperty = 0x2, + InitProperty = 0x4, + IsolProperty = 0x8, + FinaProperty = 0x10, + MediProperty = 0x20, + RligProperty = 0x40, + CaltProperty = 0x80, + LigaProperty = 0x100, + DligProperty = 0x200, + CswhProperty = 0x400, + MsetProperty = 0x800, /* used by indic and myanmar shaper */ - NuktaProperty = 0x4, - AkhantProperty = 0x8, - RephProperty = 0x10, - PreFormProperty = 0x20, - BelowFormProperty = 0x40, - AboveFormProperty = 0x80, - HalfFormProperty = 0x100, - PostFormProperty = 0x200, - VattuProperty = 0x400, - PreSubstProperty = 0x800, - BelowSubstProperty = 0x1000, - AboveSubstProperty = 0x2000, - PostSubstProperty = 0x4000, - HalantProperty = 0x8000, - CligProperty = 0x10000 + NuktaProperty = 0x8, + AkhantProperty = 0x10, + RephProperty = 0x20, + PreFormProperty = 0x40, + BelowFormProperty = 0x80, + AboveFormProperty = 0x100, + HalfFormProperty = 0x200, + PostFormProperty = 0x400, + ConjunctFormProperty = 0x800, + VattuProperty = 0x1000, + PreSubstProperty = 0x2000, + BelowSubstProperty = 0x4000, + AboveSubstProperty = 0x8000, + PostSubstProperty = 0x10000, + HalantProperty = 0x20000, + CligProperty = 0x40000, + IndicCaltProperty = 0x80000 } HB_OpenTypeProperty; diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/harfbuzz/tests/shaping/main.cpp --- a/src/3rdparty/harfbuzz/tests/shaping/main.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/harfbuzz/tests/shaping/main.cpp Fri May 14 16:40:13 2010 +0300 @@ -136,13 +136,13 @@ return HB_Err_Ok; } -void hb_getGlyphMetrics(HB_Font font, HB_Glyph glyph, HB_GlyphMetrics *metrics) +void hb_getGlyphMetrics(HB_Font, HB_Glyph, HB_GlyphMetrics *metrics) { // ### metrics->x = metrics->y = metrics->width = metrics->height = metrics->xOffset = metrics->yOffset = 0; } -HB_Fixed hb_getFontMetric(HB_Font font, HB_FontMetric metric) +HB_Fixed hb_getFontMetric(HB_Font, HB_FontMetric ) { return 0; // #### } @@ -169,6 +169,8 @@ void initTestCase(); void cleanupTestCase(); private slots: + void greek(); + void devanagari(); void bengali(); void gurmukhi(); @@ -203,18 +205,25 @@ FT_Done_FreeType(freetype); } -struct ShapeTable { - unsigned short unicode[16]; - unsigned short glyphs[16]; +class Shaper +{ +public: + Shaper(FT_Face face, HB_Script script, const QString &str); + + HB_FontRec hbFont; + HB_ShaperItem shaper_item; + QVarLengthArray hb_glyphs; + QVarLengthArray hb_attributes; + QVarLengthArray hb_advances; + QVarLengthArray hb_offsets; + QVarLengthArray hb_logClusters; + }; -static bool shaping(FT_Face face, const ShapeTable *s, HB_Script script) +Shaper::Shaper(FT_Face face, HB_Script script, const QString &str) { - QString str = QString::fromUtf16( s->unicode ); - HB_Face hbFace = HB_NewFace(face, hb_getSFntTable); - HB_FontRec hbFont; hbFont.klass = &hb_fontClass; hbFont.userData = face; hbFont.x_ppem = face->size->metrics.x_ppem; @@ -222,7 +231,6 @@ hbFont.x_scale = face->size->metrics.x_scale; hbFont.y_scale = face->size->metrics.y_scale; - HB_ShaperItem shaper_item; shaper_item.kerning_applied = false; shaper_item.string = reinterpret_cast(str.constData()); shaper_item.stringLength = str.length(); @@ -237,11 +245,6 @@ shaper_item.glyphIndicesPresent = false; shaper_item.initialGlyphCount = 0; - QVarLengthArray hb_glyphs(shaper_item.num_glyphs); - QVarLengthArray hb_attributes(shaper_item.num_glyphs); - QVarLengthArray hb_advances(shaper_item.num_glyphs); - QVarLengthArray hb_offsets(shaper_item.num_glyphs); - QVarLengthArray hb_logClusters(shaper_item.num_glyphs); while (1) { hb_glyphs.resize(shaper_item.num_glyphs); @@ -263,10 +266,66 @@ if (HB_ShapeItem(&shaper_item)) break; - } HB_FreeFace(hbFace); +} + + +static bool decomposedShaping(FT_Face face, HB_Script script, const QChar &ch) +{ + QString uc = QString().append(ch); + Shaper shaper(face, script, uc); + + uc = uc.normalized(QString::NormalizationForm_D); + Shaper decomposed(face, script, uc); + + if( shaper.shaper_item.num_glyphs != decomposed.shaper_item.num_glyphs ) + goto error; + + for (unsigned int i = 0; i < shaper.shaper_item.num_glyphs; ++i) { + if ((shaper.shaper_item.glyphs[i]&0xffffff) != (decomposed.shaper_item.glyphs[i]&0xffffff)) + goto error; + } + return true; + error: + QString str = ""; + int i = 0; + while (i < uc.length()) { + str += QString("%1 ").arg(uc[i].unicode(), 4, 16); + ++i; + } + qDebug("%s: decomposedShaping of char %4x failed\n decomposedString: %s\n nglyphs=%d, decomposed nglyphs %d", + face->family_name, + ch.unicode(), str.toLatin1().data(), + shaper.shaper_item.num_glyphs, + decomposed.shaper_item.num_glyphs); + + str = ""; + i = 0; + while (i < shaper.shaper_item.num_glyphs) { + str += QString("%1 ").arg(shaper.shaper_item.glyphs[i], 4, 16); + ++i; + } + qDebug(" composed glyph result = %s", str.toLatin1().constData()); + str = ""; + i = 0; + while (i < decomposed.shaper_item.num_glyphs) { + str += QString("%1 ").arg(decomposed.shaper_item.glyphs[i], 4, 16); + ++i; + } + qDebug(" decomposed glyph result = %s", str.toLatin1().constData()); + return false; +} + +struct ShapeTable { + unsigned short unicode[16]; + unsigned short glyphs[16]; +}; + +static bool shaping(FT_Face face, const ShapeTable *s, HB_Script script) +{ + Shaper shaper(face, script, QString::fromUtf16( s->unicode )); hb_uint32 nglyphs = 0; const unsigned short *g = s->glyphs; @@ -275,16 +334,16 @@ g++; } - if( nglyphs != shaper_item.num_glyphs ) + if( nglyphs != shaper.shaper_item.num_glyphs ) goto error; for (hb_uint32 i = 0; i < nglyphs; ++i) { - if ((shaper_item.glyphs[i]&0xffffff) != s->glyphs[i]) + if ((shaper.shaper_item.glyphs[i]&0xffffff) != s->glyphs[i]) goto error; } return true; error: - str = ""; + QString str = ""; const unsigned short *uc = s->unicode; while (*uc) { str += QString("%1 ").arg(*uc, 4, 16); @@ -293,18 +352,78 @@ qDebug("%s: shaping of string %s failed, nglyphs=%d, expected %d", face->family_name, str.toLatin1().constData(), - shaper_item.num_glyphs, nglyphs); + shaper.shaper_item.num_glyphs, nglyphs); str = ""; hb_uint32 i = 0; - while (i < shaper_item.num_glyphs) { - str += QString("%1 ").arg(shaper_item.glyphs[i], 4, 16); + while (i < shaper.shaper_item.num_glyphs) { + str += QString("%1 ").arg(shaper.shaper_item.glyphs[i], 4, 16); ++i; } qDebug(" glyph result = %s", str.toLatin1().constData()); return false; } + +void tst_QScriptEngine::greek() +{ + FT_Face face = loadFace("DejaVuSans.ttf"); + if (face) { + for (int uc = 0x1f00; uc <= 0x1fff; ++uc) { + QString str; + str.append(uc); + if (str.normalized(QString::NormalizationForm_D).normalized(QString::NormalizationForm_C) != str) { + //qDebug() << "skipping" << hex << uc; + continue; + } + if (uc == 0x1fc1 || uc == 0x1fed) + continue; + QVERIFY( decomposedShaping(face, HB_Script_Greek, QChar(uc)) ); + } + FT_Done_Face(face); + } else { + QSKIP("couln't find DejaVu Sans", SkipAll); + } + + + face = loadFace("SBL_grk.ttf"); + if (face) { + for (int uc = 0x1f00; uc <= 0x1fff; ++uc) { + QString str; + str.append(uc); + if (str.normalized(QString::NormalizationForm_D).normalized(QString::NormalizationForm_C) != str) { + //qDebug() << "skipping" << hex << uc; + continue; + } + if (uc == 0x1fc1 || uc == 0x1fed) + continue; + QVERIFY( decomposedShaping(face, HB_Script_Greek, QChar(uc)) ); + + } + + const ShapeTable shape_table [] = { + { { 0x3b1, 0x300, 0x313, 0x0 }, + { 0xb8, 0x3d3, 0x3c7, 0x0 } }, + { { 0x3b1, 0x313, 0x300, 0x0 }, + { 0xd4, 0x0 } }, + + { {0}, {0} } + }; + + + const ShapeTable *s = shape_table; + while (s->unicode[0]) { + QVERIFY( shaping(face, s, HB_Script_Greek) ); + ++s; + } + + FT_Done_Face(face); + } else { + QSKIP("couln't find DejaVu Sans", SkipAll); + } +} + + void tst_QScriptEngine::devanagari() { { @@ -1011,6 +1130,8 @@ { 0x3f8, 0x0 } }, { { 0xd2f, 0xd4d, 0xd15, 0xd4d, 0xd15, 0xd41, 0x0 }, { 0x2ff, 0x0 } }, + { { 0xd30, 0xd4d, 0x200d, 0xd35, 0xd4d, 0xd35, 0x0 }, + { 0xf3, 0x350, 0x0 } }, { {0}, {0} } }; diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/phonon/mmf/abstractmediaplayer.cpp --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp Fri May 14 16:40:13 2010 +0300 @@ -48,7 +48,7 @@ (MediaObject *parent, const AbstractPlayer *player) : AbstractPlayer(player) , m_parent(parent) - , m_playPending(false) + , m_pending(NothingPending) , m_positionTimer(new QTimer(this)) , m_bufferStatusTimer(new QTimer(this)) , m_mmfMaxVolume(NullMaxVolume) @@ -74,14 +74,12 @@ break; case LoadingState: - m_playPending = true; + setPending(PlayPending); break; case StoppedState: case PausedState: - doPlay(); - startPositionTimer(); - changeState(PlayingState); + startPlayback(); break; case PlayingState: @@ -103,14 +101,16 @@ TRACE_CONTEXT(AbstractMediaPlayer::pause, EAudioApi); TRACE_ENTRY("state %d", privateState()); - m_playPending = false; stopTimers(); switch (privateState()) { case GroundState: case LoadingState: + case StoppedState: + setPending(PausePending); + break; + case PausedState: - case StoppedState: // Do nothing break; @@ -135,7 +135,7 @@ TRACE_CONTEXT(AbstractMediaPlayer::stop, EAudioApi); TRACE_ENTRY("state %d", privateState()); - m_playPending = false; + setPending(NothingPending); stopTimers(); switch (privateState()) { @@ -365,12 +365,31 @@ doVolumeChanged(); } +void MMF::AbstractMediaPlayer::loadingComplete(int error) +{ + Q_ASSERT(Phonon::LoadingState == state()); + + if (KErrNone == error) { + updateMetaData(); + changeState(StoppedState); + } else { + setError(tr("Loading clip failed"), error); + } +} + void MMF::AbstractMediaPlayer::playbackComplete(int error) { stopTimers(); + if (KErrNone == error && !m_aboutToFinishSent) { + const qint64 total = totalTime(); + emit MMF::AbstractPlayer::tick(total); + m_aboutToFinishSent = true; + emit aboutToFinish(); + } + if (KErrNone == error) { - changeState(StoppedState); + changeState(PausedState); // MediaObject::switchToNextSource deletes the current player, so we // call it via delayed slot invokation to ensure that this object does @@ -379,6 +398,7 @@ } else { setError(tr("Playback complete"), error); + emit finished(); } } @@ -393,15 +413,13 @@ void MMF::AbstractMediaPlayer::positionTick() { - emitMarksIfReached(); - const qint64 current = currentTime(); + emitMarksIfReached(current); emit MMF::AbstractPlayer::tick(current); } -void MMF::AbstractMediaPlayer::emitMarksIfReached() +void MMF::AbstractMediaPlayer::emitMarksIfReached(qint64 current) { - const qint64 current = currentTime(); const qint64 total = totalTime(); const qint64 remaining = total - current; @@ -435,11 +453,39 @@ m_aboutToFinishSent = false; } +void MMF::AbstractMediaPlayer::setPending(Pending pending) +{ + const Phonon::State oldState = state(); + m_pending = pending; + const Phonon::State newState = state(); + if (newState != oldState) + emit stateChanged(newState, oldState); +} + +void MMF::AbstractMediaPlayer::startPlayback() +{ + doPlay(); + startPositionTimer(); + changeState(PlayingState); +} + void MMF::AbstractMediaPlayer::bufferStatusTick() { emit MMF::AbstractPlayer::bufferStatus(bufferStatus()); } +Phonon::State MMF::AbstractMediaPlayer::phononState(PrivateState state) const +{ + Phonon::State result = AbstractPlayer::phononState(state); + + if (PausePending == m_pending) { + Q_ASSERT(Phonon::StoppedState == result || Phonon::LoadingState == result); + result = Phonon::PausedState; + } + + return result; +} + void MMF::AbstractMediaPlayer::changeState(PrivateState newState) { TRACE_CONTEXT(AbstractMediaPlayer::changeState, EAudioInternal); @@ -447,20 +493,26 @@ const Phonon::State oldPhononState = phononState(privateState()); const Phonon::State newPhononState = phononState(newState); - // TODO: add some invariants to check that the transition is valid - AbstractPlayer::changeState(newState); - if (LoadingState == oldPhononState && StoppedState == newPhononState) { - // Ensure initial volume is set on MMF API before starting playback - doVolumeChanged(); + switch (m_pending) { + case NothingPending: + AbstractPlayer::changeState(newState); + break; - // Check whether play() was called while clip was being loaded. If so, - // playback should be started now - if (m_playPending) { - TRACE_0("play was called while loading; starting playback now"); - m_playPending = false; - play(); + case PlayPending: + changeState(PlayingState); // necessary in order to apply initial volume + doVolumeChanged(); + startPlayback(); + break; + + case PausePending: + AbstractPlayer::changeState(PausedState); + break; } + + setPending(NothingPending); + } else { + AbstractPlayer::changeState(newState); } } diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/phonon/mmf/abstractmediaplayer.h --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.h Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.h Fri May 14 16:40:13 2010 +0300 @@ -60,6 +60,8 @@ protected: // AbstractPlayer virtual void doSetTickInterval(qint32 interval); + virtual Phonon::State phononState(PrivateState state) const; + virtual void changeState(PrivateState newState); virtual void doPlay() = 0; virtual void doPause() = 0; @@ -70,7 +72,6 @@ virtual int openUrl(const QString& url) = 0; virtual int bufferStatus() const = 0; virtual void close() = 0; - virtual void changeState(PrivateState newState); void updateMetaData(); virtual int numberOfMetaDataEntries() const = 0; @@ -80,6 +81,7 @@ void bufferingStarted(); void bufferingComplete(); void maxVolumeChanged(int maxVolume); + void loadingComplete(int error); void playbackComplete(int error); static qint64 toMilliSeconds(const TTimeIntervalMicroSeconds &); @@ -91,8 +93,17 @@ void stopBufferStatusTimer(); void stopTimers(); void doVolumeChanged(); - void emitMarksIfReached(); + void emitMarksIfReached(qint64 position); void resetMarksIfRewound(); + void startPlayback(); + + enum Pending { + NothingPending, + PausePending, + PlayPending + }; + + void setPending(Pending pending); private Q_SLOTS: void positionTick(); @@ -101,12 +112,7 @@ private: MediaObject *const m_parent; - /** - * This flag is set to true if play is called when the object is - * in a Loading state. Once loading is complete, playback will - * be started. - */ - bool m_playPending; + Pending m_pending; QScopedPointer m_positionTimer; diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/phonon/mmf/abstractplayer.cpp --- a/src/3rdparty/phonon/mmf/abstractplayer.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/phonon/mmf/abstractplayer.cpp Fri May 14 16:40:13 2010 +0300 @@ -48,6 +48,11 @@ m_tickInterval = player->m_tickInterval; m_transitionTime = player->m_transitionTime; m_prefinishMark = player->m_prefinishMark; + + // This is to prevent unwanted state transitions occurring as a result + // of MediaObject::switchToNextSource() during playlist playback. + if (StoppedState == player->m_state) + m_state = player->m_state; } } @@ -141,7 +146,7 @@ return phononState(m_state); } -Phonon::State MMF::AbstractPlayer::phononState(PrivateState state) +Phonon::State MMF::AbstractPlayer::phononState(PrivateState state) const { const Phonon::State phononState = GroundState == state diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/phonon/mmf/abstractplayer.h --- a/src/3rdparty/phonon/mmf/abstractplayer.h Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/phonon/mmf/abstractplayer.h Fri May 14 16:40:13 2010 +0300 @@ -133,7 +133,7 @@ /** * Converts PrivateState into the corresponding Phonon::State */ - static Phonon::State phononState(PrivateState state); + virtual Phonon::State phononState(PrivateState state) const; virtual void videoOutputChanged(); diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/phonon/mmf/abstractvideooutput.cpp --- a/src/3rdparty/phonon/mmf/abstractvideooutput.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/phonon/mmf/abstractvideooutput.cpp Fri May 14 16:40:13 2010 +0300 @@ -28,6 +28,8 @@ #include #include +#include // for QApplication::activeWindow + #include QT_BEGIN_NAMESPACE @@ -162,6 +164,12 @@ QScopedPointer visitor(new ObjectDump::QVisitor); visitor->setPrefix("Phonon::MMF"); // to aid searchability of logs ObjectDump::addDefaultAnnotators(*visitor); + + if (QWidget *window = QApplication::activeWindow()) { + TRACE("Dumping from root window 0x%08x:", window); + ObjectDump::dumpTreeFromLeaf(*window, *visitor); + } + TRACE("Dumping tree from leaf 0x%08x:", this); ObjectDump::dumpTreeFromLeaf(*this, *visitor); diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/phonon/mmf/abstractvideoplayer.cpp --- a/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp Fri May 14 16:40:13 2010 +0300 @@ -193,11 +193,14 @@ void MMF::AbstractVideoPlayer::videoWindowChanged() { - TRACE_CONTEXT(AbstractVideoPlayer::videoOutputRegionChanged, EVideoInternal); + TRACE_CONTEXT(AbstractVideoPlayer::videoWindowChanged, EVideoInternal); TRACE_ENTRY("state %d", state()); m_window = m_videoOutput ? m_videoOutput->videoWindow() : 0; + if (m_videoOutput) + m_videoOutput->dump(); + handleVideoWindowChanged(); TRACE_EXIT_0(); @@ -253,6 +256,9 @@ TRAPD(err, getVideoClipParametersL(aError)); if (KErrNone == err) { + if (m_videoOutput) + m_videoOutput->dump(); + maxVolumeChanged(m_player->MaxVolume()); if (m_videoOutput) @@ -262,11 +268,10 @@ handlePendingParametersChanged(); emit totalTimeChanged(totalTime()); - changeState(StoppedState); - } else { - setError(tr("Buffering clip failed"), err); } + loadingComplete(aError); + TRACE_EXIT_0(); } diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/phonon/mmf/audioplayer.cpp --- a/src/3rdparty/phonon/mmf/audioplayer.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/phonon/mmf/audioplayer.cpp Fri May 14 16:40:13 2010 +0300 @@ -203,12 +203,10 @@ maxVolumeChanged(m_player->MaxVolume()); m_totalTime = toMilliSeconds(m_player->Duration()); emit totalTimeChanged(m_totalTime); - updateMetaData(); - changeState(StoppedState); - } else { - setError(tr("Opening clip failed"), aError); } + loadingComplete(aError); + TRACE_EXIT_0(); } diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/phonon/mmf/mediaobject.cpp --- a/src/3rdparty/phonon/mmf/mediaobject.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/phonon/mmf/mediaobject.cpp Fri May 14 16:40:13 2010 +0300 @@ -323,11 +323,12 @@ connect(m_player.data(), SIGNAL(totalTimeChanged(qint64)), SIGNAL(totalTimeChanged(qint64))); connect(m_player.data(), SIGNAL(stateChanged(Phonon::State,Phonon::State)), SIGNAL(stateChanged(Phonon::State,Phonon::State))); connect(m_player.data(), SIGNAL(finished()), SIGNAL(finished())); - connect(m_player.data(), SIGNAL(tick(qint64)), SIGNAL(tick(qint64))); connect(m_player.data(), SIGNAL(bufferStatus(int)), SIGNAL(bufferStatus(int))); connect(m_player.data(), SIGNAL(metaDataChanged(QMultiMap)), SIGNAL(metaDataChanged(QMultiMap))); connect(m_player.data(), SIGNAL(aboutToFinish()), SIGNAL(aboutToFinish())); - connect(m_player.data(), SIGNAL(prefinishMarkReached(qint32)), SIGNAL(tick(qint32))); + connect(m_player.data(), SIGNAL(prefinishMarkReached(qint32)), SIGNAL(prefinishMarkReached(qint32))); + connect(m_player.data(), SIGNAL(prefinishMarkReached(qint32)), SLOT(handlePrefinishMarkReached(qint32))); + connect(m_player.data(), SIGNAL(tick(qint64)), SIGNAL(tick(qint64))); // We need to call setError() after doing the connects, otherwise the // error won't be received. @@ -414,8 +415,20 @@ m_nextSourceSet = false; switchToSource(m_nextSource); play(); + } else { + emit finished(); } } +//----------------------------------------------------------------------------- +// Other private functions +//----------------------------------------------------------------------------- + +void MMF::MediaObject::handlePrefinishMarkReached(qint32 time) +{ + emit tick(time); +} + + QT_END_NAMESPACE diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/phonon/mmf/mediaobject.h --- a/src/3rdparty/phonon/mmf/mediaobject.h Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/phonon/mmf/mediaobject.h Fri May 14 16:40:13 2010 +0300 @@ -107,6 +107,9 @@ void finished(); void tick(qint64 time); +private Q_SLOTS: + void handlePrefinishMarkReached(qint32); + private: void switchToSource(const MediaSource &source); void createPlayer(const MediaSource &source); diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/phonon/mmf/videooutput_dsa.cpp --- a/src/3rdparty/phonon/mmf/videooutput_dsa.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/phonon/mmf/videooutput_dsa.cpp Fri May 14 16:40:13 2010 +0300 @@ -101,11 +101,17 @@ void MMF::DsaVideoOutput::beginNativePaintEvent(const QRect & /*controlRect*/) { + TRACE_CONTEXT(DsaVideoOutput::beginNativePaintEvent, EVideoInternal); + TRACE_ENTRY_0(); + emit beginVideoWindowNativePaint(); } void MMF::DsaVideoOutput::endNativePaintEvent(const QRect & /*controlRect*/) { + TRACE_CONTEXT(DsaVideoOutput::endNativePaintEvent, EVideoInternal); + TRACE_ENTRY_0(); + // Ensure that draw ops are executed into the WSERV output framebuffer CCoeEnv::Static()->WsSession().Flush(); diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/phonon/mmf/videoplayer_dsa.cpp --- a/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp Fri May 14 16:40:13 2010 +0300 @@ -190,6 +190,9 @@ void getDsaRegion(RWsSession &session, const RWindowBase &window) { + // Dump complete window tree + session.LogCommand(RWsSession::ELoggingStatusDump); + RDirectScreenAccess dsa(session); TInt err = dsa.Construct(); CDummyAO ao; @@ -214,7 +217,7 @@ void MMF::DsaVideoPlayer::handleParametersChanged(VideoParameters parameters) { TRACE_CONTEXT(DsaVideoPlayer::handleParametersChanged, EVideoInternal); - TRACE_ENTRY_0(); + TRACE_ENTRY("parameters 0x%x", parameters.operator int()); if (!m_window) return; @@ -223,38 +226,40 @@ getDsaRegion(m_wsSession, *m_window); #endif - static const TBool antialias = ETrue; - int err = KErrNone; + if (m_player) { + static const TBool antialias = ETrue; + int err = KErrNone; - if (parameters & ScaleFactors) { - TRAP(err, m_player->SetScaleFactorL(m_scaleWidth, m_scaleHeight, - antialias)); - if(KErrNone != err) { - TRACE("SetScaleFactorL (1) err %d", err); - setError(tr("Video display error"), err); - } - } - - if (KErrNone == err) { - if (parameters & WindowHandle || parameters & WindowScreenRect) { - TRAP(err, - m_player->SetDisplayWindowL(m_wsSession, m_screenDevice, - *m_window, - m_videoScreenRect, - m_videoScreenRect)); + if (parameters & ScaleFactors) { + TRAP(err, m_player->SetScaleFactorL(m_scaleWidth, m_scaleHeight, + antialias)); + if(KErrNone != err) { + TRACE("SetScaleFactorL (1) err %d", err); + setError(tr("Video display error"), err); + } } - if (KErrNone != err) { - TRACE("SetDisplayWindowL err %d", err); - setError(tr("Video display error"), err); - } else { - m_dsaActive = true; - if (parameters & ScaleFactors) { - TRAP(err, m_player->SetScaleFactorL(m_scaleWidth, m_scaleHeight, - antialias)); - if (KErrNone != err) { - TRACE("SetScaleFactorL (2) err %d", err); - setError(tr("Video display error"), err); + if (KErrNone == err) { + if (parameters & WindowHandle || parameters & WindowScreenRect) { + TRAP(err, + m_player->SetDisplayWindowL(m_wsSession, m_screenDevice, + *m_window, + m_videoScreenRect, + m_videoScreenRect)); + } + + if (KErrNone != err) { + TRACE("SetDisplayWindowL err %d", err); + setError(tr("Video display error"), err); + } else { + m_dsaActive = true; + if (parameters & ScaleFactors) { + TRAP(err, m_player->SetScaleFactorL(m_scaleWidth, m_scaleHeight, + antialias)); + if (KErrNone != err) { + TRACE("SetScaleFactorL (2) err %d", err); + setError(tr("Video display error"), err); + } } } } @@ -265,25 +270,43 @@ void MMF::DsaVideoPlayer::startDirectScreenAccess() { + TRACE_CONTEXT(DsaVideoPlayer::startDirectScreenAccess, EVideoInternal); + TRACE_ENTRY("dsaActive %d", m_dsaActive); + + int err = KErrNone; + if (!m_dsaActive) { - TRAPD(err, m_player->StartDirectScreenAccessL()); + TRAP(err, m_player->StartDirectScreenAccessL()); if (KErrNone == err) m_dsaActive = true; else setError(tr("Video display error"), err); } + + if (m_videoOutput) + m_videoOutput->dump(); + + TRACE_EXIT("error %d", err); } bool MMF::DsaVideoPlayer::stopDirectScreenAccess() { + TRACE_CONTEXT(DsaVideoPlayer::stopDirectScreenAccess, EVideoInternal); + TRACE_ENTRY("dsaActive %d", m_dsaActive); + + int err = KErrNone; + const bool dsaWasActive = m_dsaActive; if (m_dsaActive) { - TRAPD(err, m_player->StopDirectScreenAccessL()); + TRAP(err, m_player->StopDirectScreenAccessL()); if (KErrNone == err) m_dsaActive = false; else setError(tr("Video display error"), err); } + + TRACE_EXIT("error %d", err); + return dsaWasActive; } diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/phonon/mmf/videoplayer_surface.cpp --- a/src/3rdparty/phonon/mmf/videoplayer_surface.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/phonon/mmf/videoplayer_surface.cpp Fri May 14 16:40:13 2010 +0300 @@ -104,44 +104,43 @@ void MMF::SurfaceVideoPlayer::handleParametersChanged(VideoParameters parameters) { - CVideoPlayerUtility2 *player = static_cast(m_player.data()); - - int err = KErrNone; - TRect rect; - if (m_videoOutput) { m_videoOutput->dump(); const QSize size = m_videoOutput->videoWindowSize(); rect.SetSize(TSize(size.width(), size.height())); } - if (parameters & WindowHandle) { - if (m_displayWindow) - player->RemoveDisplayWindow(*m_displayWindow); + CVideoPlayerUtility2 *player = static_cast(m_player.data()); + if (player) { + int err = KErrNone; + if (parameters & WindowHandle) { + if (m_displayWindow) + player->RemoveDisplayWindow(*m_displayWindow); - RWindow *window = static_cast(m_window); - if (window) { - window->SetBackgroundColor(TRgb(0, 0, 0, 255)); - TRAP(err, player->AddDisplayWindowL(m_wsSession, m_screenDevice, *window, rect, rect)); - if (KErrNone != err) { - setError(tr("Video display error"), err); - window = 0; + RWindow *window = static_cast(m_window); + if (window) { + window->SetBackgroundColor(TRgb(0, 0, 0, 255)); + TRAP(err, player->AddDisplayWindowL(m_wsSession, m_screenDevice, *window, rect, rect)); + if (KErrNone != err) { + setError(tr("Video display error"), err); + window = 0; + } } + m_displayWindow = window; } - m_displayWindow = window; - } - if (KErrNone == err) { - if (parameters & ScaleFactors) { - Q_ASSERT(m_displayWindow); - TRAP(err, player->SetVideoExtentL(*m_displayWindow, rect)); - if (KErrNone == err) - TRAP(err, player->SetWindowClipRectL(*m_displayWindow, rect)); - if (KErrNone == err) - TRAP(err, player->SetScaleFactorL(*m_displayWindow, m_scaleWidth, m_scaleHeight)); - if (KErrNone != err) - setError(tr("Video display error"), err); + if (KErrNone == err) { + if (parameters & ScaleFactors) { + Q_ASSERT(m_displayWindow); + TRAP(err, player->SetVideoExtentL(*m_displayWindow, rect)); + if (KErrNone == err) + TRAP(err, player->SetWindowClipRectL(*m_displayWindow, rect)); + if (KErrNone == err) + TRAP(err, player->SetScaleFactorL(*m_displayWindow, m_scaleWidth, m_scaleHeight)); + if (KErrNone != err) + setError(tr("Video display error"), err); + } } } } diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/phonon/mmf/videowidget.cpp --- a/src/3rdparty/phonon/mmf/videowidget.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/phonon/mmf/videowidget.cpp Fri May 14 16:40:13 2010 +0300 @@ -123,7 +123,7 @@ void MMF::VideoWidget::setScaleMode(Phonon::VideoWidget::ScaleMode scaleMode) { TRACE_CONTEXT(VideoWidget::setScaleMode, EVideoApi); - TRACE("setScaleMode %d", setScaleMode); + TRACE("setScaleMode %d", scaleMode); m_videoOutput->setScaleMode(scaleMode); } diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/webkit/JavaScriptCore/ChangeLog --- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog Fri May 14 16:40:13 2010 +0300 @@ -1,3 +1,31 @@ +2010-03-22 Siddharth Mathur + + Reviewed by Laszlo Gombos. + + [Symbian] More efficient aligned memory allocation for JSC Collector + https://bugs.webkit.org/show_bug.cgi?id=34350 + + * JavaScriptCore.pri: Added 2 new Symbian source files and HAL linkage + + * runtime/Collector.cpp: Reduced port-specific code and added private data member + (JSC::Heap::Heap): + (JSC::Heap::~Heap): + (JSC::Heap::destroy): + (JSC::Heap::allocateBlock): + (JSC::Heap::freeBlockPtr): + + * runtime/Collector.h: Added private data member + + * wtf/symbian: Added. + * wtf/symbian/BlockAllocatorSymbian.cpp: Added. + (WTF::AlignedBlockAllocator::AlignedBlockAllocator): Helper class to allocate + aligned blocks more efficiently as required by Collector + (WTF::AlignedBlockAllocator::alloc): + (WTF::AlignedBlockAllocator::free): + (WTF::AlignedBlockAllocator::destroy): + (WTF::AlignedBlockAllocator::~AlignedBlockAllocator): + * wtf/symbian/BlockAllocatorSymbian.h: Added. + 2010-02-09 Janne Koskinen Reviewed by Laszlo Gombos. diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri --- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri Fri May 14 16:40:13 2010 +0300 @@ -9,6 +9,10 @@ OBJECTS_DIR = obj/release } +symbian { + LIBS += -lhal +} + INCLUDEPATH = \ $$PWD \ $$PWD/.. \ @@ -23,6 +27,7 @@ $$PWD/runtime \ $$PWD/wrec \ $$PWD/wtf \ + $$PWD/wtf/symbian \ $$PWD/wtf/unicode \ $$PWD/yarr \ $$PWD/API \ @@ -243,6 +248,7 @@ profiler/TreeProfile.cpp \ wtf/DateMath.cpp \ wtf/FastMalloc.cpp \ + wtf/symbian/BlockAllocatorSymbian.cpp \ wtf/Threading.cpp \ wtf/qt/MainThreadQt.cpp diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp Fri May 14 16:40:13 2010 +0300 @@ -52,11 +52,6 @@ #include #include -#elif PLATFORM(SYMBIAN) -#include -#include -#include - #elif PLATFORM(WIN_OS) #include @@ -124,11 +119,6 @@ // a PIC branch in Mach-O binaries, see . #define MIN_ARRAY_SIZE (static_cast(14)) -#if PLATFORM(SYMBIAN) -const size_t MAX_NUM_BLOCKS = 256; // Max size of collector heap set to 16 MB -static RHeap* userChunk = 0; -#endif - #if ENABLE(JSC_MULTIPLE_THREADS) #if PLATFORM(DARWIN) @@ -165,29 +155,11 @@ , m_currentThreadRegistrar(0) #endif , m_globalData(globalData) +#if PLATFORM(SYMBIAN) + , m_blockallocator(JSCCOLLECTOR_VIRTUALMEM_RESERVATION, BLOCK_SIZE) +#endif { ASSERT(globalData); - -#if PLATFORM(SYMBIAN) - // Symbian OpenC supports mmap but currently not the MAP_ANON flag. - // Using fastMalloc() does not properly align blocks on 64k boundaries - // and previous implementation was flawed/incomplete. - // UserHeap::ChunkHeap allows allocation of continuous memory and specification - // of alignment value for (symbian) cells within that heap. - // - // Clarification and mapping of terminology: - // RHeap (created by UserHeap::ChunkHeap below) is continuos memory chunk, - // which can dynamically grow up to 8 MB, - // that holds all CollectorBlocks of this session (static). - // Each symbian cell within RHeap maps to a 64kb aligned CollectorBlock. - // JSCell objects are maintained as usual within CollectorBlocks. - if (!userChunk) { - userChunk = UserHeap::ChunkHeap(0, 0, MAX_NUM_BLOCKS * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE); - if (!userChunk) - CRASH(); - } -#endif // PLATFORM(SYMBIAN) - memset(&primaryHeap, 0, sizeof(CollectorHeap)); memset(&numberHeap, 0, sizeof(CollectorHeap)); } @@ -233,7 +205,9 @@ t = next; } #endif - +#if PLATFORM(SYMBIAN) + m_blockallocator.destroy(); +#endif m_globalData = 0; } @@ -247,12 +221,9 @@ // FIXME: tag the region as a JavaScriptCore heap when we get a registered VM tag: . vm_map(current_task(), &address, BLOCK_SIZE, BLOCK_OFFSET_MASK, VM_FLAGS_ANYWHERE | VM_TAG_FOR_COLLECTOR_MEMORY, MEMORY_OBJECT_NULL, 0, FALSE, VM_PROT_DEFAULT, VM_PROT_DEFAULT, VM_INHERIT_DEFAULT); #elif PLATFORM(SYMBIAN) - // Allocate a 64 kb aligned CollectorBlock - unsigned char* mask = reinterpret_cast(userChunk->Alloc(BLOCK_SIZE)); - if (!mask) + void* address = m_blockallocator.alloc(); + if (!address) CRASH(); - uintptr_t address = reinterpret_cast(mask); - memset(reinterpret_cast(address), 0, BLOCK_SIZE); #elif PLATFORM(WINCE) void* address = VirtualAlloc(NULL, BLOCK_SIZE, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); @@ -339,7 +310,7 @@ #if PLATFORM(DARWIN) && !PLATFORM(QT) vm_deallocate(current_task(), reinterpret_cast(block), BLOCK_SIZE); #elif PLATFORM(SYMBIAN) - userChunk->Free(reinterpret_cast(block)); + m_blockallocator.free(reinterpret_cast(block)); #elif PLATFORM(WINCE) VirtualFree(block, 0, MEM_RELEASE); #elif PLATFORM(WIN_OS) diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/webkit/JavaScriptCore/runtime/Collector.h --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.h Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.h Fri May 14 16:40:13 2010 +0300 @@ -35,6 +35,10 @@ #include #endif +#if PLATFORM(SYMBIAN) +#include +#endif + #define ASSERT_CLASS_FITS_IN_CELL(class) COMPILE_ASSERT(sizeof(class) <= CELL_SIZE, class_fits_in_cell) namespace JSC { @@ -157,6 +161,11 @@ pthread_key_t m_currentThreadRegistrar; #endif +#if PLATFORM(SYMBIAN) + // Allocates collector blocks with correct alignment + WTF::AlignedBlockAllocator m_blockallocator; +#endif + JSGlobalData* m_globalData; }; diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/webkit/JavaScriptCore/wtf/symbian/BlockAllocatorSymbian.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/BlockAllocatorSymbian.cpp Fri May 14 16:40:13 2010 +0300 @@ -0,0 +1,132 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if PLATFORM(SYMBIAN) + +#include "BlockAllocatorSymbian.h" + + +namespace WTF { + +/** Efficiently allocates blocks of size blockSize with blockSize alignment. + * Primarly designed for JSC Collector's needs. + * Not thread-safe. + */ +AlignedBlockAllocator::AlignedBlockAllocator(TUint32 reservationSize, TUint32 blockSize ) + : m_reservation(reservationSize), + m_blockSize(blockSize) +{ + + // Get system's page size value. + SYMBIAN_PAGESIZE(m_pageSize); + + // We only accept multiples of system page size for both initial reservation and the alignment/block size + m_reservation = SYMBIAN_ROUNDUPTOMULTIPLE(m_reservation, m_pageSize); + __ASSERT_ALWAYS(SYMBIAN_ROUNDUPTOMULTIPLE(m_blockSize, m_pageSize), User::Panic(_L("AlignedBlockAllocator1"), KErrArgument)); + + // Calculate max. bit flags we need to carve a reservationSize range into blockSize-sized blocks + m_map.numBits = m_reservation / m_blockSize; + const TUint32 bitsPerWord = 8*sizeof(TUint32); + const TUint32 numWords = (m_map.numBits + bitsPerWord -1) / bitsPerWord; + + m_map.bits = new TUint32[numWords]; + __ASSERT_ALWAYS(m_map.bits, User::Panic(_L("AlignedBlockAllocator2"), KErrNoMemory)); + m_map.clearAll(); + + // Open a Symbian RChunk, and reserve requested virtual address range + // Any thread in this process can operate this rchunk due to EOwnerProcess access rights. + TInt ret = m_chunk.CreateDisconnectedLocal(0 , 0, (TInt)m_reservation , EOwnerProcess); + if (ret != KErrNone) + User::Panic(_L("AlignedBlockAllocator3"), ret); + + // This is the offset to m_chunk.Base() required to make it m_blockSize-aligned + m_offset = SYMBIAN_ROUNDUPTOMULTIPLE(TUint32(m_chunk.Base()), m_blockSize) - TUint(m_chunk.Base()); + +} + +void* AlignedBlockAllocator::alloc() +{ + + TInt freeRam = 0; + void* address = 0; + + // Look up first free slot in bit map + const TInt freeIdx = m_map.findFree(); + + // Pseudo OOM: We ate up the address space we reserved.. + // ..even though the device may have free RAM left + if (freeIdx < 0) + return 0; + + TInt ret = m_chunk.Commit(m_offset + (m_blockSize * freeIdx), m_blockSize); + if (ret != KErrNone) + return 0; // True OOM: Device didn't have physical RAM to spare + + // Updated bit to mark region as in use. + m_map.set(freeIdx); + + // Calculate address of committed region (block) + address = (void*)( (m_chunk.Base() + m_offset) + (TUint)(m_blockSize * freeIdx) ); + + return address; +} + +void AlignedBlockAllocator::free(void* block) +{ + // Calculate index of block to be freed + TInt idx = TUint(static_cast(block) - m_chunk.Base() - m_offset) / m_blockSize; + + __ASSERT_DEBUG(idx >= 0 && idx < m_map.numBits, User::Panic(_L("AlignedBlockAllocator4"), KErrCorrupt)); // valid index check + __ASSERT_DEBUG(m_map.get(idx), User::Panic(_L("AlignedBlockAllocator5"), KErrCorrupt)); // in-use flag check + + // Return committed region to system RAM pool (the physical RAM becomes usable by others) + TInt ret = m_chunk.Decommit(m_offset + m_blockSize * idx, m_blockSize); + + // mark this available again + m_map.clear(idx); +} + +void AlignedBlockAllocator::destroy() +{ + // release everything! + m_chunk.Decommit(0, m_chunk.MaxSize()); + m_map.clearAll(); +} + +AlignedBlockAllocator::~AlignedBlockAllocator() +{ + destroy(); + m_chunk.Close(); + delete [] m_map.bits; +} + +} // end of namespace + +#endif // SYMBIAN diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/webkit/JavaScriptCore/wtf/symbian/BlockAllocatorSymbian.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/BlockAllocatorSymbian.h Fri May 14 16:40:13 2010 +0300 @@ -0,0 +1,120 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef BlockAllocatorSymbian_h +#define BlockAllocatorSymbian_h + +#include +#include +#include + + +#define SYMBIAN_PAGESIZE(x) (HAL::Get(HALData::EMemoryPageSize, x)); +#define SYMBIAN_FREERAM(x) (HAL::Get(HALData::EMemoryRAMFree, x)); +#define SYMBIAN_ROUNDUPTOMULTIPLE(x, multipleof) ( (x + multipleof - 1) & ~(multipleof - 1) ) + +// Set sane defaults if -D wasn't provided via compiler args +#ifndef JSCCOLLECTOR_VIRTUALMEM_RESERVATION +#if defined(__WINS__) + // Emulator has limited virtual address space + #define JSCCOLLECTOR_VIRTUALMEM_RESERVATION (4*1024*1024) +#else + // HW has plenty of virtual addresses + #define JSCCOLLECTOR_VIRTUALMEM_RESERVATION (128*1024*1024) +#endif +#endif + +namespace WTF { + +/** + * Allocates contiguous region of size blockSize with blockSize-aligned address. + * blockSize must be a multiple of system page size (typically 4K on Symbian/ARM) + * + * @param reservationSize Virtual address range to be reserved upon creation of chunk (bytes). + * @param blockSize Size of a single allocation. Returned address will also be blockSize-aligned. + */ +class AlignedBlockAllocator { + public: + AlignedBlockAllocator(TUint32 reservationSize, TUint32 blockSize); + ~AlignedBlockAllocator(); + void destroy(); + void* alloc(); + void free(void* data); + + private: + RChunk m_chunk; // Symbian chunk that lets us reserve/commit/decommit + TUint m_offset; // offset of first committed region from base + TInt m_pageSize; // cached value of system page size, typically 4K on Symbian + TUint32 m_reservation; + TUint32 m_blockSize; + + // Tracks comitted/decommitted state of a blockSize region + struct { + + TUint32 *bits; // array of bit flags + TUint32 numBits; // number of regions to keep track of + + bool get(TUint32 n) const + { + return !!(bits[n >> 5] & (1 << (n & 0x1F))); + } + + void set(TUint32 n) + { + bits[n >> 5] |= (1 << (n & 0x1F)); + } + + void clear(TUint32 n) + { + bits[n >> 5] &= ~(1 << (n & 0x1F)); + } + + void clearAll() + { + for (TUint32 i = 0; i < numBits; i++) + clear(i); + } + + TInt findFree() const + { + for (TUint32 i = 0; i < numBits; i++) { + if (!get(i)) + return i; + } + return -1; + } + + } m_map; + +}; + +} + +#endif // end of BlockAllocatorSymbian_h + + diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/webkit/VERSION --- a/src/3rdparty/webkit/VERSION Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/webkit/VERSION Fri May 14 16:40:13 2010 +0300 @@ -8,4 +8,4 @@ and has the sha1 checksum - e9151b11e974f0aa47fd40c225f88f35ced91496 + 6ed0b6197addffc7dacbdb3e49db711420a2c47a diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/webkit/WebCore/ChangeLog --- a/src/3rdparty/webkit/WebCore/ChangeLog Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/webkit/WebCore/ChangeLog Fri May 14 16:40:13 2010 +0300 @@ -1,3 +1,47 @@ +2009-11-03 Dan Bernstein + + Reviewed by Dave Hyatt. + + Allow a frame to go back to copy-on-scroll when it ceases being overlapped + + The code was not testing slow-scrolling frames for overlappedness, thinking the answer + would not matter. That is not the case if the only reason for the slow-scrolling is + being overlapped. + + * page/FrameView.cpp: + (WebCore::FrameView::useSlowRepaintsIfNotOverlapped): Added. Returns whether there is any + reason besides being overlapped that the frame would need to fully repaint on scroll. + * page/FrameView.h: + * rendering/RenderWidget.cpp: + (WebCore::RenderWidget::paint): Use useSlowRepaintsIfNotOverlapped(). + +2010-04-09 David Leong + + Reviewed by Simon Hausmann. + + [Qt] Symbian apps crash on exit due to a bad qObject_cast. + + https://bugs.webkit.org/show_bug.cgi?id=37303 + + Added check for NULL to avoid the crash. + + * plugins/symbian/PluginViewSymbian.cpp: + (WebCore::PluginView::platformDestroy): + +2009-11-15 Dave Tapuska + + Reviewed by George Staikos. + + Compare UChars single unit at a time as opposed to the uint32_t + approach as casting to unaligned addresses may cause a bus failure + on ARMv5 and below. This change replicates the same defines that + exists in AtomicString.cpp + + https://bugs.webkit.org/show_bug.cgi?id=31475 + + * platform/text/StringHash.h: + (WebCore::StringHash::equal): + 2010-03-25 yael aharon Reviewed by Laszlo Gombos. diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/webkit/WebCore/WebCore.pro --- a/src/3rdparty/webkit/WebCore/WebCore.pro Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/webkit/WebCore/WebCore.pro Fri May 14 16:40:13 2010 +0300 @@ -203,10 +203,12 @@ !CONFIG(QTDIR_build):!contains(DEFINES, ENABLE_QT_BEARER=.) { symbian: { - exists($${EPOCROOT}epoc32/release/winscw/udeb/QtBearer.lib)| \ - exists($${EPOCROOT}epoc32/release/armv5/lib/QtBearer.lib) { - DEFINES += ENABLE_QT_BEARER=1 - } + # exists($${EPOCROOT}epoc32/release/winscw/udeb/QtBearer.lib)| \ + # exists($${EPOCROOT}epoc32/release/armv5/lib/QtBearer.lib) { + # DEFINES += ENABLE_QT_BEARER=1 + # } + # :QTP:Bearer management always enabled + DEFINES += ENABLE_QT_BEARER=1 } } diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/webkit/WebCore/page/FrameView.cpp --- a/src/3rdparty/webkit/WebCore/page/FrameView.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/webkit/WebCore/page/FrameView.cpp Fri May 14 16:40:13 2010 +0300 @@ -739,6 +739,11 @@ return m_useSlowRepaints || m_slowRepaintObjectCount > 0 || (platformWidget() && m_fixedObjectCount > 0) || m_isOverlapped || !m_contentIsOpaque; } +bool FrameView::useSlowRepaintsIfNotOverlapped() const +{ + return m_useSlowRepaints || m_slowRepaintObjectCount > 0 || !m_contentIsOpaque; +} + void FrameView::setUseSlowRepaints() { m_useSlowRepaints = true; diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/webkit/WebCore/page/FrameView.h --- a/src/3rdparty/webkit/WebCore/page/FrameView.h Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/webkit/WebCore/page/FrameView.h Fri May 14 16:40:13 2010 +0300 @@ -212,6 +212,7 @@ friend class RenderWidget; bool useSlowRepaints() const; + bool useSlowRepaintsIfNotOverlapped() const; void applyOverflowToViewport(RenderObject*, ScrollbarMode& hMode, ScrollbarMode& vMode); diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/webkit/WebCore/page/qt/EventHandlerQt.cpp --- a/src/3rdparty/webkit/WebCore/page/qt/EventHandlerQt.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/webkit/WebCore/page/qt/EventHandlerQt.cpp Fri May 14 16:40:13 2010 +0300 @@ -51,7 +51,7 @@ #include "NotImplemented.h" QT_BEGIN_NAMESPACE -extern Q_GUI_EXPORT bool qt_tab_all_widgets; // from qapplication.cpp +Q_DECL_IMPORT extern bool qt_tab_all_widgets; // from qapplication.cpp QT_END_NAMESPACE namespace WebCore { diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/webkit/WebCore/platform/text/StringHash.h --- a/src/3rdparty/webkit/WebCore/platform/text/StringHash.h Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/webkit/WebCore/platform/text/StringHash.h Fri May 14 16:40:13 2010 +0300 @@ -1,5 +1,6 @@ /* * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved + * Copyright (C) Research In Motion Limited 2009. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -47,6 +48,16 @@ if (aLength != bLength) return false; +#if PLATFORM(ARM) || PLATFORM(SH4) + const UChar* aChars = a->characters(); + const UChar* bChars = b->characters(); + for (unsigned i = 0; i != aLength; ++i) { + if (*aChars++ != *bChars++) + return false; + } + return true; +#else + /* Do it 4-bytes-at-a-time on architectures where it's safe */ const uint32_t* aChars = reinterpret_cast(a->characters()); const uint32_t* bChars = reinterpret_cast(b->characters()); @@ -59,6 +70,7 @@ return false; return true; +#endif } static unsigned hash(const RefPtr& key) { return key->hash(); } diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/webkit/WebCore/plugins/symbian/PluginViewSymbian.cpp --- a/src/3rdparty/webkit/WebCore/plugins/symbian/PluginViewSymbian.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/webkit/WebCore/plugins/symbian/PluginViewSymbian.cpp Fri May 14 16:40:13 2010 +0300 @@ -453,7 +453,7 @@ void PluginView::platformDestroy() { QWebPageClient* client = m_parentFrame->view()->hostWindow()->platformPageClient(); - if (QGraphicsWebView *webView = qobject_cast(client->pluginParent())) + if (client && qobject_cast(client->pluginParent())) delete static_cast(platformPluginWidget())->proxy(); else delete platformPluginWidget(); diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/webkit/WebCore/rendering/RenderWidget.cpp --- a/src/3rdparty/webkit/WebCore/rendering/RenderWidget.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/webkit/WebCore/rendering/RenderWidget.cpp Fri May 14 16:40:13 2010 +0300 @@ -233,7 +233,7 @@ else m_widget->paint(paintInfo.context, paintInfo.rect); - if (m_widget->isFrameView() && paintInfo.overlapTestRequests && !static_cast(m_widget.get())->useSlowRepaints()) { + if (m_widget->isFrameView() && paintInfo.overlapTestRequests && !static_cast(m_widget.get())->useSlowRepaintsIfNotOverlapped()) { ASSERT(!paintInfo.overlapTestRequests->contains(this)); paintInfo.overlapTestRequests->set(this, m_widget->frameRect()); } diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp Fri May 14 16:40:13 2010 +0300 @@ -326,10 +326,11 @@ static bool webframe_scrollOverflow(WebCore::Frame* frame, int dx, int dy, const QPoint& pos) { - if (!frame || !frame->document() || !frame->eventHandler()) + if (!frame || !frame->document() || !frame->view() || !frame->eventHandler()) return false; - Node* node = frame->document()->elementFromPoint(pos.x(), pos.y()); + QPoint contentsPos = frame->view()->windowToContents(pos); + Node* node = frame->document()->elementFromPoint(contentsPos.x(), contentsPos.y()); if (!node) return false; @@ -1056,37 +1057,33 @@ */ void QWEBKIT_EXPORT qtwebkit_webframe_scrollRecursively(QWebFrame* qFrame, int dx, int dy, const QPoint& pos) { - Frame* frame = QWebFramePrivate::core(qFrame); - - if (!frame || !frame->view()) + if (!qFrame) return; - - if (!webframe_scrollOverflow(frame, dx, dy, pos)) { - do { - bool scrolledHorizontal = false; - bool scrolledVertical = false; - - IntSize scrollOffset = frame->view()->scrollOffset(); - IntPoint maxScrollOffset = frame->view()->maximumScrollPosition(); + + if (webframe_scrollOverflow(QWebFramePrivate::core(qFrame), dx, dy, pos)) + return; + + bool scrollHorizontal = false; + bool scrollVertical = false; - if (dx > 0) // scroll right - scrolledHorizontal = scrollOffset.width() < maxScrollOffset.x(); - else if (dx < 0) // scroll left - scrolledHorizontal = scrollOffset.width() > 0; + do { + if (dx > 0) // scroll right + scrollHorizontal = qFrame->scrollBarValue(Qt::Horizontal) < qFrame->scrollBarMaximum(Qt::Horizontal); + else if (dx < 0) // scroll left + scrollHorizontal = qFrame->scrollBarValue(Qt::Horizontal) > qFrame->scrollBarMinimum(Qt::Horizontal); - if (dy > 0) // scroll down - scrolledVertical = scrollOffset.height() < maxScrollOffset.y(); + if (dy > 0) // scroll down + scrollVertical = qFrame->scrollBarValue(Qt::Vertical) < qFrame->scrollBarMaximum(Qt::Vertical); else if (dy < 0) //scroll up - scrolledVertical = scrollOffset.height() > 0; + scrollVertical = qFrame->scrollBarValue(Qt::Vertical) > qFrame->scrollBarMinimum(Qt::Vertical); - if (scrolledHorizontal || scrolledVertical) { - frame->view()->scrollBy(IntSize(dx, dy)); - return; - } - - frame = frame->tree()->parent(); - } while (frame && frame->view()); - } + if (scrollHorizontal || scrollVertical) { + qFrame->scroll(dx, dy); + return; + } + + qFrame = qFrame->parentFrame(); + } while (qFrame); } /*! diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/webkit/WebKit/qt/ChangeLog --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog Fri May 14 16:40:13 2010 +0300 @@ -1,3 +1,29 @@ +2010-04-08 Joe Ligman + + Reviewed by Simon Hausmann. + + [Qt] qtwebkit_webframe_scrollRecursively scrolls when body.style.overflow="hidden" + https://bugs.webkit.org/show_bug.cgi?id=36674 + + The scrolling check was based on the frameview's scrolloffset, and + maximumScrollPosition, which does not acknowledge the overflow properties. + + I am now basing the scrolling off the scrollbar position. The scrollbars are + affected by the overflow properties indicating when not to scroll. The scrollbar + positions also continue to work for CSS ::-webkit-scrollbar styles. + + * Api/qwebframe.cpp: + (qtwebkit_webframe_scrollRecursively): + +2010-03-24 Viatcheslav Ostapenko + + Reviewed by Laszlo Gombos. + + Auto-uppercase and predictive text need to be disabled for S60 (as for maemo) + https://bugs.webkit.org/show_bug.cgi?id=33176 + + * WebCoreSupport/EditorClientQt.cpp: + 2010-03-22 Jakub Wieczorek Reviewed by Simon Hausmann. diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp Fri May 14 16:40:13 2010 +0300 @@ -615,11 +615,11 @@ } } webPageClient->setInputMethodHint(Qt::ImhHiddenText, isPasswordField); -#ifdef Q_WS_MAEMO_5 - // Maemo 5 MicroB Browser disables auto-uppercase and predictive text, thus, so do we. +#if defined(Q_WS_MAEMO_5) || defined(Q_OS_SYMBIAN) + // disables auto-uppercase and predictive text for mobile devices webPageClient->setInputMethodHint(Qt::ImhNoAutoUppercase, true); webPageClient->setInputMethodHint(Qt::ImhNoPredictiveText, true); -#endif // Q_WS_MAEMO_5 +#endif // Q_WS_MAEMO_5 || Q_OS_SYMBIAN #endif // QT_VERSION check webPageClient->setInputMethodEnabled(active); } diff -r fcece45ef507 -r 79de32ba3296 src/3rdparty/webkit/WebKit/qt/symbian/bwins/QtWebKitu.def --- a/src/3rdparty/webkit/WebKit/qt/symbian/bwins/QtWebKitu.def Mon May 03 13:17:34 2010 +0300 +++ b/src/3rdparty/webkit/WebKit/qt/symbian/bwins/QtWebKitu.def Fri May 14 16:40:13 2010 +0300 @@ -623,5 +623,6 @@ ?qt_networkAccessAllowed@@YAX_N@Z @ 622 NONAME ; void qt_networkAccessAllowed(bool) ?qt_resumeActiveDOMObjects@@YAXPAVQWebFrame@@@Z @ 623 NONAME ; void qt_resumeActiveDOMObjects(class QWebFrame *) ?qt_suspendActiveDOMObjects@@YAXPAVQWebFrame@@@Z @ 624 NONAME ; void qt_suspendActiveDOMObjects(class QWebFrame *) + ?qtwebkit_webframe_scrollRecursively@@YA_NPAVQWebFrame@@HH@Z @ 625 NONAME ABSENT ; bool qtwebkit_webframe_scrollRecursively(class QWebFrame *, int, int) + ?qtwebkit_webframe_scrollRecursively@@YAXPAVQWebFrame@@HHABVQPoint@@@Z @ 626 NONAME ; void qtwebkit_webframe_scrollRecursively(class QWebFrame *, int, int, class QPoint const &) - diff -r fcece45ef507 -r 79de32ba3296 src/corelib/codecs/qtextcodec.cpp --- a/src/corelib/codecs/qtextcodec.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/corelib/codecs/qtextcodec.cpp Fri May 14 16:40:13 2010 +0300 @@ -110,6 +110,7 @@ (QTextCodecFactoryInterface_iid, QLatin1String("/codecs"))) #endif + static char qtolower(register char c) { if (c >= 'A' && c <= 'Z') return c + 0x20; return c; } static bool qisalnum(register char c) @@ -224,6 +225,19 @@ Q_GLOBAL_STATIC(QTextCodecCleanup, createQTextCodecCleanup) +bool QTextCodec::validCodecs() +{ +#ifdef Q_OS_SYMBIAN + // If we don't have a trap handler, we're outside of the main() function, + // ie. in global constructors or destructors. Don't use codecs in this + // case as it would lead to crashes because we don't have a cleanup stack on Symbian + return (User::TrapHandler() != NULL); +#else + return true; +#endif +} + + #if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) class QWindowsLocalCodec: public QTextCodec { @@ -684,6 +698,14 @@ if (all) return; +#ifdef Q_OS_SYMBIAN + // If we don't have a trap handler, we're outside of the main() function, + // ie. in global constructors or destructors. Don't create codecs in this + // case as it would lead to crashes because of a missing cleanup stack on Symbian + if (User::TrapHandler() == NULL) + return; +#endif + #ifdef Q_DEBUG_TEXTCODEC if (destroying_is_ok) qWarning("QTextCodec: Creating new codec during codec cleanup"); @@ -986,6 +1008,9 @@ #endif setup(); + if (!validCodecs()) + return 0; + static QHash cache; if (clearCaches & 0x1) { cache.clear(); @@ -1027,6 +1052,9 @@ #endif setup(); + if (!validCodecs()) + return 0; + static QHash cache; if (clearCaches & 0x2) { cache.clear(); @@ -1074,6 +1102,10 @@ setup(); QList codecs; + + if (!validCodecs()) + return codecs; + for (int i = 0; i < all->size(); ++i) { codecs += all->at(i)->name(); codecs += all->at(i)->aliases(); @@ -1112,6 +1144,10 @@ setup(); QList codecs; + + if (!validCodecs()) + return codecs; + for (int i = 0; i < all->size(); ++i) codecs += all->at(i)->mibEnum(); @@ -1165,6 +1201,9 @@ QTextCodec* QTextCodec::codecForLocale() { + if (!validCodecs()) + return 0; + if (localeMapper) return localeMapper; diff -r fcece45ef507 -r 79de32ba3296 src/corelib/codecs/qtextcodec.h --- a/src/corelib/codecs/qtextcodec.h Mon May 03 13:17:34 2010 +0300 +++ b/src/corelib/codecs/qtextcodec.h Fri May 14 16:40:13 2010 +0300 @@ -145,12 +145,13 @@ private: friend class QTextCodecCleanup; static QTextCodec *cftr; + static bool validCodecs(); }; Q_DECLARE_OPERATORS_FOR_FLAGS(QTextCodec::ConversionFlags) -inline QTextCodec* QTextCodec::codecForTr() { return cftr; } + inline QTextCodec* QTextCodec::codecForTr() { return validCodecs() ? cftr : 0; } inline void QTextCodec::setCodecForTr(QTextCodec *c) { cftr = c; } -inline QTextCodec* QTextCodec::codecForCStrings() { return QString::codecForCStrings; } +inline QTextCodec* QTextCodec::codecForCStrings() { return validCodecs() ? QString::codecForCStrings : 0; } inline void QTextCodec::setCodecForCStrings(QTextCodec *c) { QString::codecForCStrings = c; } class Q_CORE_EXPORT QTextEncoder { diff -r fcece45ef507 -r 79de32ba3296 src/corelib/io/qfsfileengine_unix.cpp --- a/src/corelib/io/qfsfileengine_unix.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/corelib/io/qfsfileengine_unix.cpp Fri May 14 16:40:13 2010 +0300 @@ -518,9 +518,7 @@ if ((st.st_mode & S_IFMT) != S_IFDIR) return false; } else if (QT_MKDIR(chunk, 0777) != 0) { - //QTP: workaround for QT-3141 - if (errno != EEXIST) - return false; + return false; } } } diff -r fcece45ef507 -r 79de32ba3296 src/corelib/io/qiodevice.cpp --- a/src/corelib/io/qiodevice.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/corelib/io/qiodevice.cpp Fri May 14 16:40:13 2010 +0300 @@ -755,6 +755,7 @@ qint64 QIODevice::read(char *data, qint64 maxSize) { Q_D(QIODevice); + CHECK_READABLE(read, qint64(-1)); #if defined QIODEVICE_DEBUG printf("%p QIODevice::read(%p, %d), d->pos = %d, d->buffer.size() = %d\n", diff -r fcece45ef507 -r 79de32ba3296 src/corelib/io/qprocess.cpp --- a/src/corelib/io/qprocess.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/corelib/io/qprocess.cpp Fri May 14 16:40:13 2010 +0300 @@ -551,6 +551,16 @@ interpreter itself (\c{cmd.exe} on some Windows systems), and ask the interpreter to execute the desired command. + \section1 Symbian Platform Security Requirements + + On Symbian, processes which use the functions kill() or terminate() + must have the \c PowerMgmt platform security capability. If the client + process lacks this capability, these functions will fail. + + Platform security capabilities are added via the + \l{qmake-variable-reference.html#target-capability}{TARGET.CAPABILITY} + qmake variable. + \sa QBuffer, QFile, QTcpSocket */ @@ -2006,9 +2016,13 @@ event loop does not handle the WM_CLOSE message, can only be terminated by calling kill(). + On Symbian, this function requires platform security capability + \c PowerMgmt. If absent, the process will panic with KERN-EXEC 46. + \note Terminating running processes from other processes will typically cause a panic in Symbian due to platform security. + \sa \l {Symbian Platform Security Requirements} \sa kill() */ void QProcess::terminate() @@ -2023,6 +2037,10 @@ On Windows, kill() uses TerminateProcess, and on Unix and Mac OS X, the SIGKILL signal is sent to the process. + On Symbian, this function requires platform security capability + \c PowerMgmt. If absent, the process will panic with KERN-EXEC 46. + + \sa \l {Symbian Platform Security Requirements} \sa terminate() */ void QProcess::kill() diff -r fcece45ef507 -r 79de32ba3296 src/corelib/kernel/qcoreapplication.cpp --- a/src/corelib/kernel/qcoreapplication.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/corelib/kernel/qcoreapplication.cpp Fri May 14 16:40:13 2010 +0300 @@ -67,6 +67,7 @@ #ifdef Q_OS_SYMBIAN # include # include +# include # include "qeventdispatcher_symbian_p.h" # include "private/qcore_symbian_p.h" #elif defined(Q_OS_UNIX) @@ -579,6 +580,27 @@ qt_core_eval_init(d->application_type); #endif +#if defined(Q_OS_SYMBIAN) \ + && defined(Q_CC_NOKIAX86) \ + && defined(QT_DEBUG) + /** + * Prevent the executable from being locked in the Symbian emulator. The + * code dramatically simplifies debugging on Symbian, but beyond that has + * no impact. + * + * Force the ZLazyUnloadTimer to fire and therefore unload code segments + * immediately. The code affects Symbian's file server and on the other + * hand needs only to be run once in each emulator run. + */ + { + RLoader loader; + CleanupClosePushL(loader); + User::LeaveIfError(loader.Connect()); + User::LeaveIfError(loader.CancelLazyDllUnload()); + CleanupStack::PopAndDestroy(&loader); + } +#endif + qt_startup_hook(); } diff -r fcece45ef507 -r 79de32ba3296 src/corelib/kernel/qeventdispatcher_symbian.cpp --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp Fri May 14 16:40:13 2010 +0300 @@ -570,7 +570,13 @@ * check if socket is in exception set * then signal RequestComplete for it */ - qWarning("exception on %d", i.key()->socket()); + qWarning("exception on %d [will close the socket handle - hack]", i.key()->socket()); + // quick fix; there is a bug + // when doing read on socket + // errors not preoperly mapped + // after offline-ing the device + // on some devices we do get exception + ::close(i.key()->socket()); toRemove.append(i.key()); TRequestStatus *status = i.value(); QEventDispatcherSymbian::RequestComplete(d->threadData->symbian_thread_handle, status, KErrNone); diff -r fcece45ef507 -r 79de32ba3296 src/corelib/tools/qpoint.cpp --- a/src/corelib/tools/qpoint.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/corelib/tools/qpoint.cpp Fri May 14 16:40:13 2010 +0300 @@ -374,7 +374,7 @@ QDebug operator<<(QDebug d, const QPointF &p) { d.nospace() << "QPointF(" << p.x() << ", " << p.y() << ')'; - return d; + return d.space(); } #endif diff -r fcece45ef507 -r 79de32ba3296 src/gui/dialogs/qdialog.cpp --- a/src/gui/dialogs/qdialog.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/dialogs/qdialog.cpp Fri May 14 16:40:13 2010 +0300 @@ -904,26 +904,33 @@ } else { cbaHeight = qt_TSize2QSize(bgContainer->Size()).height(); } - p.setY(S60->screenHeightInPixels-height()-cbaHeight); + p.setY(S60->screenHeightInPixels - height() - cbaHeight); p.setX(0); } else { const int scrollbarWidth = style()->pixelMetric(QStyle::PM_ScrollBarExtent); - TRect cbaRect = TRect(); - AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EControlPane, cbaRect); - AknLayoutUtils::TAknCbaLocation cbaLocation = AknLayoutUtils::CbaLocation(); - switch (cbaLocation) { - case AknLayoutUtils::EAknCbaLocationBottom: - p.setY(S60->screenHeightInPixels - height()-cbaRect.Height()); - p.setX((S60->screenWidthInPixels - width())>>1); - break; - case AknLayoutUtils::EAknCbaLocationRight: - p.setY((S60->screenHeightInPixels - height())>>1); - p.setX(qMax(0,S60->screenWidthInPixels-width()-scrollbarWidth-cbaRect.Width())); - break; - case AknLayoutUtils::EAknCbaLocationLeft: - p.setY((S60->screenHeightInPixels - height())>>1); - p.setX(qMax(0,scrollbarWidth+cbaRect.Width())); - break; + TRect staConTopRect = TRect(); + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStaconTop, staConTopRect); + if (staConTopRect.IsEmpty()) { + TRect cbaRect = TRect(); + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EControlPane, cbaRect); + AknLayoutUtils::TAknCbaLocation cbaLocation = AknLayoutUtils::CbaLocation(); + switch (cbaLocation) { + case AknLayoutUtils::EAknCbaLocationBottom: + p.setY(S60->screenHeightInPixels - height() - cbaRect.Height()); + p.setX((S60->screenWidthInPixels - width()) >> 1); + break; + case AknLayoutUtils::EAknCbaLocationRight: + p.setY((S60->screenHeightInPixels - height()) >> 1); + p.setX(qMax(0,S60->screenWidthInPixels - width() - scrollbarWidth - cbaRect.Width())); + break; + case AknLayoutUtils::EAknCbaLocationLeft: + p.setY((S60->screenHeightInPixels - height()) >> 1); + p.setX(qMax(0,scrollbarWidth + cbaRect.Width())); + break; + } + } else { + p.setY((S60->screenHeightInPixels - height()) >> 1); + p.setX(qMax(0,S60->screenWidthInPixels - width())); } } move(p); diff -r fcece45ef507 -r 79de32ba3296 src/gui/dialogs/qfiledialog.ui --- a/src/gui/dialogs/qfiledialog.ui Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/dialogs/qfiledialog.ui Fri May 14 16:40:13 2010 +0300 @@ -83,6 +83,12 @@ Back + + Back + + + Go back + @@ -90,6 +96,12 @@ Forward + + Forward + + + Go forward + @@ -97,6 +109,12 @@ Parent Directory + + Parent Directory + + + Go to the parent directory + @@ -104,6 +122,12 @@ Create New Folder + + Create New Folder + + + Create a New Folder + @@ -111,6 +135,12 @@ List View + + List View + + + Change to list view mode + @@ -118,6 +148,12 @@ Detail View + + Detail View + + + Change to detail view mode + diff -r fcece45ef507 -r 79de32ba3296 src/gui/dialogs/qfilesystemmodel.cpp --- a/src/gui/dialogs/qfilesystemmodel.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/dialogs/qfilesystemmodel.cpp Fri May 14 16:40:13 2010 +0300 @@ -1361,6 +1361,16 @@ if (!showDrives && !newPathDir.exists()) return d->index(rootPath()); + //We remove the watcher on the previous path + if (!rootPath().isEmpty() && rootPath() != QLatin1String(".")) { + //This remove the watcher for the old rootPath + d->fileInfoGatherer.removePath(rootPath()); + //This line "marks" the node as dirty, so the next fetchMore + //call on the path will ask the gatherer to install a watcher again + //But it doesn't re-fetch everything + d->node(rootPath())->populatedChildren = false; + } + // We have a new valid root path d->rootDir = newPathDir; QModelIndex newRootIndex; diff -r fcece45ef507 -r 79de32ba3296 src/gui/embedded/qscreenqnx_qws.cpp --- a/src/gui/embedded/qscreenqnx_qws.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/embedded/qscreenqnx_qws.cpp Fri May 14 16:40:13 2010 +0300 @@ -205,7 +205,7 @@ int ret = gf_surface_create(&d->memSurface, d->device, w, h, GF_FORMAT_ARGB8888, 0, GF_SURFACE_CREATE_CPU_FAST_ACCESS | GF_SURFACE_CREATE_CPU_LINEAR_ACCESSIBLE - | GF_SURFACE_PHYS_CONTIG); + | GF_SURFACE_PHYS_CONTIG | GF_SURFACE_CREATE_SHAREABLE); if (ret != GF_ERR_OK) { qWarning("QQnxScreen: gf_surface_create(%dx%d) failed with error code %d", w, h, ret); diff -r fcece45ef507 -r 79de32ba3296 src/gui/graphicsview/qgraphicsitem.cpp --- a/src/gui/graphicsview/qgraphicsitem.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/graphicsview/qgraphicsitem.cpp Fri May 14 16:40:13 2010 +0300 @@ -5225,8 +5225,6 @@ needSortChildren = 1; // ### maybe 0 child->d_ptr->siblingIndex = children.size(); children.append(child); - if (isObject) - emit static_cast(q_ptr)->childrenChanged(); } /*! @@ -5249,8 +5247,6 @@ // the child is not guaranteed to be at the index after the list is sorted. // (see ensureSortedChildren()). child->d_ptr->siblingIndex = -1; - if (isObject) - emit static_cast(q_ptr)->childrenChanged(); } /*! @@ -7458,88 +7454,6 @@ } } -void QGraphicsItemPrivate::append(QDeclarativeListProperty *list, QGraphicsObject *item) -{ - QGraphicsItemPrivate::get(item)->setParentItemHelper(static_cast(list->object), /*newParentVariant=*/0, /*thisPointerVariant=*/0); -} - -/*! - Returns a list of this item's children. - - The items are sorted by stacking order. This takes into account both the - items' insertion order and their Z-values. - -*/ -QDeclarativeListProperty QGraphicsItemPrivate::childrenList() -{ - Q_Q(QGraphicsItem); - if (isObject) { - QGraphicsObject *that = static_cast(q); - return QDeclarativeListProperty(that, &children, QGraphicsItemPrivate::append); - } else { - //QGraphicsItem is not supported for this property - return QDeclarativeListProperty(); - } -} - -/*! - \internal - Returns the width of the item - Reimplemented by QGraphicsWidget -*/ -qreal QGraphicsItemPrivate::width() const -{ - return 0; -} - -/*! - \internal - Set the width of the item - Reimplemented by QGraphicsWidget -*/ -void QGraphicsItemPrivate::setWidth(qreal w) -{ - Q_UNUSED(w); -} - -/*! - \internal - Reset the width of the item - Reimplemented by QGraphicsWidget -*/ -void QGraphicsItemPrivate::resetWidth() -{ -} - -/*! - \internal - Returns the height of the item - Reimplemented by QGraphicsWidget -*/ -qreal QGraphicsItemPrivate::height() const -{ - return 0; -} - -/*! - \internal - Set the height of the item - Reimplemented by QGraphicsWidget -*/ -void QGraphicsItemPrivate::setHeight(qreal h) -{ - Q_UNUSED(h); -} - -/*! - \internal - Reset the height of the item - Reimplemented by QGraphicsWidget -*/ -void QGraphicsItemPrivate::resetHeight() -{ -} - /*! \property QGraphicsObject::parent \brief the parent of the item @@ -7726,23 +7640,6 @@ \sa scale, rotation, QGraphicsItem::transformOriginPoint() */ -/*! - \fn void QGraphicsObject::widthChanged() - \internal -*/ - -/*! - \fn void QGraphicsObject::heightChanged() - \internal -*/ - -/*! - - \fn QGraphicsObject::childrenChanged() - - This signal gets emitted whenever the children list changes - \internal -*/ /*! \class QAbstractGraphicsShapeItem diff -r fcece45ef507 -r 79de32ba3296 src/gui/graphicsview/qgraphicsitem.h --- a/src/gui/graphicsview/qgraphicsitem.h Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/graphicsview/qgraphicsitem.h Fri May 14 16:40:13 2010 +0300 @@ -547,10 +547,6 @@ Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged) Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged) Q_PROPERTY(QPointF transformOriginPoint READ transformOriginPoint WRITE setTransformOriginPoint) - Q_PRIVATE_PROPERTY(QGraphicsItem::d_func(), QDeclarativeListProperty children READ childrenList DESIGNABLE false NOTIFY childrenChanged) - Q_PRIVATE_PROPERTY(QGraphicsItem::d_func(), qreal width READ width WRITE setWidth NOTIFY widthChanged RESET resetWidth FINAL) - Q_PRIVATE_PROPERTY(QGraphicsItem::d_func(), qreal height READ height WRITE setHeight NOTIFY heightChanged RESET resetHeight FINAL) - Q_CLASSINFO("DefaultProperty", "children") Q_INTERFACES(QGraphicsItem) public: QGraphicsObject(QGraphicsItem *parent = 0); @@ -575,9 +571,6 @@ void zChanged(); void rotationChanged(); void scaleChanged(); - void childrenChanged(); - void widthChanged(); - void heightChanged(); protected: QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent, QGraphicsScene *scene); diff -r fcece45ef507 -r 79de32ba3296 src/gui/graphicsview/qgraphicsitem_p.h --- a/src/gui/graphicsview/qgraphicsitem_p.h Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/graphicsview/qgraphicsitem_p.h Fri May 14 16:40:13 2010 +0300 @@ -71,62 +71,6 @@ class QGraphicsItemPrivate; -#ifndef QDECLARATIVELISTPROPERTY -#define QDECLARATIVELISTPROPERTY -template -struct QDeclarativeListProperty { - typedef void (*AppendFunction)(QDeclarativeListProperty *, T*); - typedef int (*CountFunction)(QDeclarativeListProperty *); - typedef T *(*AtFunction)(QDeclarativeListProperty *, int); - typedef void (*ClearFunction)(QDeclarativeListProperty *); - - QDeclarativeListProperty() - : object(0), data(0), append(0), count(0), at(0), clear(0), dummy1(0), dummy2(0) {} - QDeclarativeListProperty(QObject *o, QList &list) - : object(o), data(&list), append(qlist_append), count(qlist_count), at(qlist_at), - clear(qlist_clear), dummy1(0), dummy2(0) {} - QDeclarativeListProperty(QObject *o, void *d, AppendFunction a, CountFunction c = 0, AtFunction t = 0, - ClearFunction r = 0) - : object(o), data(d), append(a), count(c), at(t), clear(r), dummy1(0), dummy2(0) {} - - bool operator==(const QDeclarativeListProperty &o) const { - return object == o.object && - data == o.data && - append == o.append && - count == o.count && - at == o.at && - clear == o.clear; - } - - QObject *object; - void *data; - - AppendFunction append; - - CountFunction count; - AtFunction at; - - ClearFunction clear; - - void *dummy1; - void *dummy2; - -private: - static void qlist_append(QDeclarativeListProperty *p, T *v) { - ((QList *)p->data)->append(v); - } - static int qlist_count(QDeclarativeListProperty *p) { - return ((QList *)p->data)->count(); - } - static T *qlist_at(QDeclarativeListProperty *p, int idx) { - return ((QList *)p->data)->at(idx); - } - static void qlist_clear(QDeclarativeListProperty *p) { - return ((QList *)p->data)->clear(); - } -}; -#endif - class QGraphicsItemCache { public: @@ -293,7 +237,6 @@ void resolveDepth(); void addChild(QGraphicsItem *child); void removeChild(QGraphicsItem *child); - QDeclarativeListProperty childrenList(); void setParentItemHelper(QGraphicsItem *parent, const QVariant *newParentVariant, const QVariant *thisPointerVariant); void childrenBoundingRectHelper(QTransform *x, QRectF *rect); @@ -480,21 +423,11 @@ inline QTransform transformToParent() const; inline void ensureSortedChildren(); - static void append(QDeclarativeListProperty *list, QGraphicsObject *item); static inline bool insertionOrder(QGraphicsItem *a, QGraphicsItem *b); void ensureSequentialSiblingIndex(); inline void sendScenePosChange(); virtual void siblingOrderChange(); - // Private Properties - virtual qreal width() const; - virtual void setWidth(qreal); - virtual void resetWidth(); - - virtual qreal height() const; - virtual void setHeight(qreal); - virtual void resetHeight(); - QRectF childrenBoundingRect; QRectF needsRepaint; QMap paintedViewBoundingRects; diff -r fcece45ef507 -r 79de32ba3296 src/gui/graphicsview/qgraphicsproxywidget.cpp --- a/src/gui/graphicsview/qgraphicsproxywidget.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/graphicsview/qgraphicsproxywidget.cpp Fri May 14 16:40:13 2010 +0300 @@ -189,7 +189,7 @@ */ extern bool qt_sendSpontaneousEvent(QObject *, QEvent *); -extern bool qt_tab_all_widgets; +Q_GUI_EXPORT extern bool qt_tab_all_widgets; /*! \internal @@ -897,6 +897,29 @@ } break; } +#ifndef QT_NO_TOOLTIP + case QEvent::GraphicsSceneHelp: { + // Propagate the help event (for tooltip) to the widget under mouse + if (d->lastWidgetUnderMouse) { + QGraphicsSceneHelpEvent *he = static_cast(event); + QPoint pos = d->mapToReceiver(mapFromScene(he->scenePos()), d->lastWidgetUnderMouse).toPoint(); + QHelpEvent e(QEvent::ToolTip, pos, he->screenPos()); + QApplication::sendEvent(d->lastWidgetUnderMouse, &e); + event->setAccepted(e.isAccepted()); + return e.isAccepted(); + } + break; + } + case QEvent::ToolTipChange: { + // Propagate tooltip change to the widget + if (!d->tooltipChangeMode) { + d->tooltipChangeMode = QGraphicsProxyWidgetPrivate::ProxyToWidgetMode; + d->widget->setToolTip(toolTip()); + d->tooltipChangeMode = QGraphicsProxyWidgetPrivate::NoMode; + } + break; + } +#endif default: break; } @@ -952,6 +975,14 @@ d->styleChangeMode = QGraphicsProxyWidgetPrivate::NoMode; } break; + case QEvent::ToolTipChange: + // Propagate tooltip change to the proxy. + if (!d->tooltipChangeMode) { + d->tooltipChangeMode = QGraphicsProxyWidgetPrivate::WidgetToProxyMode; + setToolTip(d->widget->toolTip()); + d->tooltipChangeMode = QGraphicsProxyWidgetPrivate::NoMode; + } + break; default: break; } @@ -1435,7 +1466,7 @@ return; // Filter out repaints on the window frame. - const QRect exposedWidgetRect = (option->exposedRect & rect()).toRect(); + const QRect exposedWidgetRect = (option->exposedRect & rect()).toAlignedRect(); if (exposedWidgetRect.isEmpty()) return; diff -r fcece45ef507 -r 79de32ba3296 src/gui/graphicsview/qgraphicsproxywidget_p.h --- a/src/gui/graphicsview/qgraphicsproxywidget_p.h Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/graphicsview/qgraphicsproxywidget_p.h Fri May 14 16:40:13 2010 +0300 @@ -72,6 +72,7 @@ enabledChangeMode(NoMode), styleChangeMode(NoMode), paletteChangeMode(NoMode), + tooltipChangeMode(NoMode), focusFromWidgetToProxy(0) { } void init(); @@ -117,6 +118,7 @@ quint32 enabledChangeMode : 2; quint32 styleChangeMode : 2; quint32 paletteChangeMode : 2; + quint32 tooltipChangeMode : 2; quint32 focusFromWidgetToProxy : 1; quint32 proxyIsGivingFocus : 1; }; diff -r fcece45ef507 -r 79de32ba3296 src/gui/graphicsview/qgraphicsscene.cpp --- a/src/gui/graphicsview/qgraphicsscene.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/graphicsview/qgraphicsscene.cpp Fri May 14 16:40:13 2010 +0300 @@ -3772,6 +3772,12 @@ QGraphicsItem *toolTipItem = 0; for (int i = 0; i < itemsAtPos.size(); ++i) { QGraphicsItem *tmp = itemsAtPos.at(i); + if (tmp->d_func()->isProxyWidget()) { + // if the item is a proxy widget, the event is forwarded to it + sendEvent(tmp, helpEvent); + if (helpEvent->isAccepted()) + return; + } if (!tmp->toolTip().isEmpty()) { toolTipItem = tmp; break; diff -r fcece45ef507 -r 79de32ba3296 src/gui/graphicsview/qgraphicswidget.cpp --- a/src/gui/graphicsview/qgraphicswidget.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/graphicsview/qgraphicswidget.cpp Fri May 14 16:40:13 2010 +0300 @@ -324,14 +324,6 @@ */ /*! - - \fn QGraphicsWidget::geometryChanged() - - This signal gets emitted whenever the geometry of the item changes - \internal -*/ - -/*! \property QGraphicsWidget::geometry \brief the geometry of the widget @@ -392,17 +384,13 @@ } QSizeF oldSize = size(); QGraphicsLayoutItem::setGeometry(newGeom); - emit geometryChanged(); + // Send resize event bool resized = newGeom.size() != oldSize; if (resized) { QGraphicsSceneResizeEvent re; re.setOldSize(oldSize); re.setNewSize(newGeom.size()); - if (oldSize.width() != newGeom.size().width()) - emit widthChanged(); - if (oldSize.height() != newGeom.size().height()) - emit heightChanged(); QApplication::sendEvent(this, &re); } } @@ -1079,13 +1067,13 @@ QApplication::sendEvent(this, &event); break; } - case ItemCursorChange: { + case ItemCursorHasChanged: { // Deliver CursorChange. QEvent event(QEvent::CursorChange); QApplication::sendEvent(this, &event); break; } - case ItemToolTipChange: { + case ItemToolTipHasChanged: { // Deliver ToolTipChange. QEvent event(QEvent::ToolTipChange); QApplication::sendEvent(this, &event); diff -r fcece45ef507 -r 79de32ba3296 src/gui/graphicsview/qgraphicswidget.h --- a/src/gui/graphicsview/qgraphicswidget.h Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/graphicsview/qgraphicswidget.h Fri May 14 16:40:13 2010 +0300 @@ -73,7 +73,7 @@ Q_PROPERTY(QPalette palette READ palette WRITE setPalette) Q_PROPERTY(QFont font READ font WRITE setFont) Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection RESET unsetLayoutDirection) - Q_PROPERTY(QSizeF size READ size WRITE resize NOTIFY geometryChanged) + Q_PROPERTY(QSizeF size READ size WRITE resize) Q_PROPERTY(QSizeF minimumSize READ minimumSize WRITE setMinimumSize) Q_PROPERTY(QSizeF preferredSize READ preferredSize WRITE setPreferredSize) Q_PROPERTY(QSizeF maximumSize READ maximumSize WRITE setMaximumSize) @@ -81,10 +81,11 @@ Q_PROPERTY(Qt::FocusPolicy focusPolicy READ focusPolicy WRITE setFocusPolicy) Q_PROPERTY(Qt::WindowFlags windowFlags READ windowFlags WRITE setWindowFlags) Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle) - Q_PROPERTY(QRectF geometry READ geometry WRITE setGeometry NOTIFY geometryChanged) + Q_PROPERTY(QRectF geometry READ geometry WRITE setGeometry) public: QGraphicsWidget(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0); ~QGraphicsWidget(); + QGraphicsLayout *layout() const; void setLayout(QGraphicsLayout *layout); void adjustSize(); @@ -174,9 +175,6 @@ using QObject::children; #endif -Q_SIGNALS: - void geometryChanged(); - public Q_SLOTS: bool close(); diff -r fcece45ef507 -r 79de32ba3296 src/gui/graphicsview/qgraphicswidget_p.cpp --- a/src/gui/graphicsview/qgraphicswidget_p.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/graphicsview/qgraphicswidget_p.cpp Fri May 14 16:40:13 2010 +0300 @@ -44,7 +44,6 @@ #ifndef QT_NO_GRAPHICSVIEW #include -#include #include "qgraphicswidget_p.h" #include "qgraphicslayout.h" #include "qgraphicsscene_p.h" @@ -826,56 +825,6 @@ } } -qreal QGraphicsWidgetPrivate::width() const -{ - Q_Q(const QGraphicsWidget); - return q->geometry().width(); -} - -void QGraphicsWidgetPrivate::setWidth(qreal w) -{ - if (qIsNaN(w)) - return; - Q_Q(QGraphicsWidget); - if (q->geometry().width() == w) - return; - - QRectF oldGeom = q->geometry(); - - q->setGeometry(QRectF(q->x(), q->y(), w, height())); -} - -void QGraphicsWidgetPrivate::resetWidth() -{ - Q_Q(QGraphicsWidget); - q->setGeometry(QRectF(q->x(), q->y(), 0, height())); -} - -qreal QGraphicsWidgetPrivate::height() const -{ - Q_Q(const QGraphicsWidget); - return q->geometry().height(); -} - -void QGraphicsWidgetPrivate::setHeight(qreal h) -{ - if (qIsNaN(h)) - return; - Q_Q(QGraphicsWidget); - if (q->geometry().height() == h) - return; - - QRectF oldGeom = q->geometry(); - - q->setGeometry(QRectF(q->x(), q->y(), width(), h)); -} - -void QGraphicsWidgetPrivate::resetHeight() -{ - Q_Q(QGraphicsWidget); - q->setGeometry(QRectF(q->x(), q->y(), width(), 0)); -} - QT_END_NAMESPACE #endif //QT_NO_GRAPHICSVIEW diff -r fcece45ef507 -r 79de32ba3296 src/gui/graphicsview/qgraphicswidget_p.h --- a/src/gui/graphicsview/qgraphicswidget_p.h Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/graphicsview/qgraphicswidget_p.h Fri May 14 16:40:13 2010 +0300 @@ -130,15 +130,6 @@ void windowFrameHoverLeaveEvent(QGraphicsSceneHoverEvent *event); bool hasDecoration() const; - // Private Properties - qreal width() const; - void setWidth(qreal); - void resetWidth(); - - qreal height() const; - void setHeight(qreal); - void resetHeight(); - // State inline int attributeToBitIndex(Qt::WidgetAttribute att) const { diff -r fcece45ef507 -r 79de32ba3296 src/gui/image/qimage.cpp --- a/src/gui/image/qimage.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/image/qimage.cpp Fri May 14 16:40:13 2010 +0300 @@ -118,8 +118,8 @@ return &image.d->colortable; } -extern int qt_defaultDpiX(); -extern int qt_defaultDpiY(); +Q_GUI_EXPORT extern int qt_defaultDpiX(); +Q_GUI_EXPORT extern int qt_defaultDpiY(); QBasicAtomicInt qimage_serial_number = Q_BASIC_ATOMIC_INITIALIZER(1); @@ -5667,7 +5667,11 @@ detach(); - *this = convertToFormat(QImage::Format_ARGB32_Premultiplied); + QImage converted = convertToFormat(QImage::Format_ARGB32_Premultiplied); + if (!converted.isNull()) + *this = converted; + else + return; // Slight optimization since alphachannels are returned as 8-bit grays. if (alphaChannel.d->depth == 8 && alphaChannel.isGrayscale()) { diff -r fcece45ef507 -r 79de32ba3296 src/gui/image/qimagewriter.cpp --- a/src/gui/image/qimagewriter.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/image/qimagewriter.cpp Fri May 14 16:40:13 2010 +0300 @@ -197,6 +197,7 @@ for (int i = 0; i < keys.size(); ++i) { QImageIOPlugin *plugin = qobject_cast(l->instance(keys.at(i))); if (plugin && (plugin->capabilities(device, testFormat) & QImageIOPlugin::CanWrite)) { + delete handler; handler = plugin->create(device, testFormat); break; } diff -r fcece45ef507 -r 79de32ba3296 src/gui/image/qpaintengine_pic.cpp --- a/src/gui/image/qpaintengine_pic.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/image/qpaintengine_pic.cpp Fri May 14 16:40:13 2010 +0300 @@ -477,7 +477,7 @@ writeCmdLength(pos, r, false); } -extern int qt_defaultDpi(); +Q_GUI_EXPORT extern int qt_defaultDpi(); void QPicturePaintEngine::drawTextItem(const QPointF &p , const QTextItem &ti) { diff -r fcece45ef507 -r 79de32ba3296 src/gui/image/qpicture.cpp --- a/src/gui/image/qpicture.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/image/qpicture.cpp Fri May 14 16:40:13 2010 +0300 @@ -108,8 +108,8 @@ const char *qt_mfhdr_tag = "QPIC"; // header tag static const quint16 mfhdr_maj = 11; // major version # static const quint16 mfhdr_min = 0; // minor version # -extern int qt_defaultDpiX(); -extern int qt_defaultDpiY(); +Q_GUI_EXPORT extern int qt_defaultDpiX(); +Q_GUI_EXPORT extern int qt_defaultDpiY(); /*! Constructs an empty picture. diff -r fcece45ef507 -r 79de32ba3296 src/gui/image/qpixmap_raster.cpp --- a/src/gui/image/qpixmap_raster.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/image/qpixmap_raster.cpp Fri May 14 16:40:13 2010 +0300 @@ -357,8 +357,8 @@ return image.paintEngine(); } -extern int qt_defaultDpiX(); -extern int qt_defaultDpiY(); +Q_GUI_EXPORT extern int qt_defaultDpiX(); +Q_GUI_EXPORT extern int qt_defaultDpiY(); int QRasterPixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const { diff -r fcece45ef507 -r 79de32ba3296 src/gui/image/qpixmap_x11.cpp --- a/src/gui/image/qpixmap_x11.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/image/qpixmap_x11.cpp Fri May 14 16:40:13 2010 +0300 @@ -383,7 +383,7 @@ return has; // Will implicitly also check format and return quickly for opaque types... checked = true; - has = const_cast(image)->data_ptr()->checkForAlphaPixels(); + has = image->isNull() ? false : const_cast(image)->data_ptr()->checkForAlphaPixels(); return has; } diff -r fcece45ef507 -r 79de32ba3296 src/gui/image/qpixmapfilter.cpp --- a/src/gui/image/qpixmapfilter.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/image/qpixmapfilter.cpp Fri May 14 16:40:13 2010 +0300 @@ -898,7 +898,7 @@ expblur<12, 10, false>(blurImage, radius, quality, transposed); } -bool qt_scaleForTransform(const QTransform &transform, qreal *scale); +Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale); /*! \internal diff -r fcece45ef507 -r 79de32ba3296 src/gui/inputmethod/qcoefepinputcontext_s60.cpp --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp Fri May 14 16:40:13 2010 +0300 @@ -58,6 +58,11 @@ // MAknEdStateObserver::EAknActivatePenInputRequest #define QT_EAknActivatePenInputRequest MAknEdStateObserver::EAknEdwinStateEvent(7) +// EAknEditorFlagSelectionVisible is only valid from 3.2 onwards. +// Sym^3 AVKON FEP manager expects that this flag is used for FEP-aware editors +// that support text selection. +#define QT_EAknEditorFlagSelectionVisible 0x100000 + QT_BEGIN_NAMESPACE QCoeFepInputContext::QCoeFepInputContext(QObject *parent) @@ -75,7 +80,10 @@ m_hasTempPreeditString(false) { m_fepState->SetObjectProvider(this); - m_fepState->SetFlags(EAknEditorFlagDefault); + if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) + m_fepState->SetFlags(EAknEditorFlagDefault | QT_EAknEditorFlagSelectionVisible); + else + m_fepState->SetFlags(EAknEditorFlagDefault); m_fepState->SetDefaultInputMode( EAknEditorTextInputMode ); m_fepState->SetPermittedInputModes( EAknEditorAllInputModes ); m_fepState->SetDefaultCase( EAknEditorLowerCase ); @@ -432,7 +440,10 @@ m_fepState->SetPermittedCases(flags); ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateCaseModeUpdate); - flags = 0; + if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) + flags = QT_EAknEditorFlagSelectionVisible; + else + flags = 0; if (hints & ImhUppercaseOnly && !(hints & ImhLowercaseOnly) || hints & ImhLowercaseOnly && !(hints & ImhUppercaseOnly)) { flags |= EAknEditorFlagFixedCase; @@ -771,7 +782,6 @@ if (w->inputMethodQuery(Qt::ImCursorPosition).toInt() != m_cursorPos) longPress = 1; } - return; } QList attributes; diff -r fcece45ef507 -r 79de32ba3296 src/gui/itemviews/qfileiconprovider.cpp --- a/src/gui/itemviews/qfileiconprovider.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/itemviews/qfileiconprovider.cpp Fri May 14 16:40:13 2010 +0300 @@ -254,7 +254,9 @@ val = SHGetFileInfo((const wchar_t *)QDir::toNativeSeparators(fileInfo.filePath()).utf16(), 0, &info, sizeof(SHFILEINFO), SHGFI_SMALLICON|SHGFI_SYSICONINDEX); #endif - if (val) { + + // Even if GetFileInfo returns a valid result, hIcon can be empty in some cases + if (val && info.hIcon) { if (fileInfo.isDir() && !fileInfo.isRoot()) { //using the unique icon index provided by windows save us from duplicate keys key = QString::fromLatin1("qt_dir_%1").arg(info.iIcon); @@ -293,7 +295,7 @@ val = SHGetFileInfo((const wchar_t *)QDir::toNativeSeparators(fileInfo.filePath()).utf16(), 0, &info, sizeof(SHFILEINFO), SHGFI_LARGEICON|SHGFI_SYSICONINDEX); #endif - if (val) { + if (val && info.hIcon) { if (fileInfo.isDir() && !fileInfo.isRoot()) { //using the unique icon index provided by windows save us from duplicate keys key = QString::fromLatin1("qt_dir_%1").arg(info.iIcon); diff -r fcece45ef507 -r 79de32ba3296 src/gui/itemviews/qtableview.cpp --- a/src/gui/itemviews/qtableview.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/itemviews/qtableview.cpp Fri May 14 16:40:13 2010 +0300 @@ -114,15 +114,14 @@ } } else if (old_height > span->height()) { //remove the span from all the subspans lists that intersect the columns not covered anymore - Index::iterator it_y = index.lowerBound(-span->bottom()); - if (it_y == index.end()) - it_y = index.find(-span->top()); // This is the only span remaining and we are deleting it. + Index::iterator it_y = index.lowerBound(-qMax(span->bottom(), span->top())); //qMax usefull if height is 0 Q_ASSERT(it_y != index.end()); //it_y must exist since the span is in the list while (-it_y.key() <= span->top() + old_height -1) { if (-it_y.key() > span->bottom()) { - (*it_y).remove(-span->left()); + int removed = (*it_y).remove(-span->left()); + Q_ASSERT(removed == 1); Q_UNUSED(removed); if (it_y->isEmpty()) { - it_y = index.erase(it_y) - 1; + it_y = index.erase(it_y); } } if(it_y == index.begin()) diff -r fcece45ef507 -r 79de32ba3296 src/gui/kernel/qapplication.cpp --- a/src/gui/kernel/qapplication.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/kernel/qapplication.cpp Fri May 14 16:40:13 2010 +0300 @@ -138,7 +138,7 @@ QT_BEGIN_NAMESPACE -extern void qt_call_post_routines(); +Q_DECL_IMPORT extern void qt_call_post_routines(); int QApplicationPrivate::app_compile_version = 0x040000; //we don't know exactly, but it's at least 4.0.0 @@ -5255,10 +5255,20 @@ qic = QInputContextFactory::create(QLatin1String("xim"), that); that->d_func()->inputContext = qic; } -#elif defined(Q_WS_S60) +#elif defined(Q_OS_SYMBIAN) if (!d->inputContext) { QApplication *that = const_cast(this); - that->d_func()->inputContext = QInputContextFactory::create(QString::fromLatin1("coefep"), that); + const QStringList keys = QInputContextFactory::keys(); + // Try hbim and coefep first, then try others. + if (keys.contains("hbim")) { + that->d_func()->inputContext = QInputContextFactory::create(QLatin1String("hbim"), that); + } else if (keys.contains("coefep")) { + that->d_func()->inputContext = QInputContextFactory::create(QLatin1String("coefep"), that); + } else { + for (int c = 0; c < keys.size() && !d->inputContext; ++c) { + that->d_func()->inputContext = QInputContextFactory::create(keys[c], that); + } + } } #endif return d->inputContext; diff -r fcece45ef507 -r 79de32ba3296 src/gui/kernel/qapplication_s60.cpp --- a/src/gui/kernel/qapplication_s60.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/kernel/qapplication_s60.cpp Fri May 14 16:40:13 2010 +0300 @@ -372,8 +372,13 @@ { if (S60->curWin == this) S60->curWin = 0; - if (!QApplicationPrivate::is_app_closing) - setFocusSafely(false); + if (!QApplicationPrivate::is_app_closing) { + QT_TRY { + setFocusSafely(false); + } QT_CATCH(const std::exception&) { + // ignore exceptions, nothing can be done + } + } S60->appUi()->RemoveFromStack(this); delete m_longTapDetector; } @@ -989,7 +994,7 @@ } #endif } else if (QApplication::activeWindow() == qwidget->window()) { - if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog()) { + if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog() || S60->menuBeingConstructed) { QWidget *fw = QApplication::focusWidget(); if (fw) { QFocusEvent event(QEvent::FocusOut, Qt::PopupFocusReason); @@ -1239,6 +1244,7 @@ } S60->avkonComponentsSupportTransparency = false; + S60->menuBeingConstructed = false; #ifdef Q_WS_S60 TUid KCRUidAvkon = { 0x101F876E }; diff -r fcece45ef507 -r 79de32ba3296 src/gui/kernel/qgridlayout.cpp --- a/src/gui/kernel/qgridlayout.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/kernel/qgridlayout.cpp Fri May 14 16:40:13 2010 +0300 @@ -1852,7 +1852,7 @@ /*! \fn int QGridLayout::colSpacing(int col) const - Use columnSpacing() instead. + Use columnMinimumWidth() instead. */ /*! diff -r fcece45ef507 -r 79de32ba3296 src/gui/kernel/qsoftkeymanager.cpp --- a/src/gui/kernel/qsoftkeymanager.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/kernel/qsoftkeymanager.cpp Fri May 14 16:40:13 2010 +0300 @@ -242,6 +242,7 @@ d->requestedSoftKeyActions.clear(); bool recursiveMerging = false; QWidget *source = softkeySource(NULL, recursiveMerging); + d->initialSoftKeySource = source; while (source) { if (appendSoftkeys(*source, level)) ++level; diff -r fcece45ef507 -r 79de32ba3296 src/gui/kernel/qsoftkeymanager_common_p.h --- a/src/gui/kernel/qsoftkeymanager_common_p.h Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/kernel/qsoftkeymanager_common_p.h Fri May 14 16:40:13 2010 +0300 @@ -70,6 +70,7 @@ static QSoftKeyManager *self; QHash keyedActions; QMultiHash requestedSoftKeyActions; + QWidget *initialSoftKeySource; }; @@ -79,4 +80,4 @@ QT_END_HEADER -#endif // QSOFTKEYMANAGER_COMMON_P_H \ No newline at end of file +#endif // QSOFTKEYMANAGER_COMMON_P_H diff -r fcece45ef507 -r 79de32ba3296 src/gui/kernel/qsoftkeymanager_s60.cpp --- a/src/gui/kernel/qsoftkeymanager_s60.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/kernel/qsoftkeymanager_s60.cpp Fri May 14 16:40:13 2010 +0300 @@ -312,17 +312,8 @@ bool QSoftKeyManagerPrivateS60::setRightSoftkey(CEikButtonGroupContainer &cba) { if (!setSoftkey(cba, QAction::NegativeSoftKey, RSK_POSITION)) { - Qt::WindowType windowType = Qt::Window; - QAction *action = requestedSoftKeyActions.value(0); - if (action) { - QWidget *actionParent = action->parentWidget(); - Q_ASSERT_X(actionParent, Q_FUNC_INFO, "No parent set for softkey action!"); - - QWidget *actionWindow = actionParent->window(); - Q_ASSERT_X(actionWindow, Q_FUNC_INFO, "Softkey action does not have window!"); - windowType = actionWindow->windowType(); - } - + const Qt::WindowType windowType = initialSoftKeySource + ? initialSoftKeySource->window()->windowType() : Qt::Window; if (windowType != Qt::Dialog && windowType != Qt::Popup) { QString text(QSoftKeyManager::tr("Exit")); TPtrC nativeText = qt_QString2TPtrC(text); @@ -374,17 +365,30 @@ nativeContainer->DrawDeferred(); // 3.1 needs an extra invitation } +static void resetMenuBeingConstructed(TAny* /*aAny*/) +{ + S60->menuBeingConstructed = false; +} + +void QSoftKeyManagerPrivateS60::tryDisplayMenuBarL() +{ + CleanupStack::PushL(TCleanupItem(resetMenuBeingConstructed, NULL)); + S60->menuBeingConstructed = true; + S60->menuBar()->TryDisplayMenuBarL(); + CleanupStack::PopAndDestroy(); // Reset menuBeingConstructed to false in all cases +} + bool QSoftKeyManagerPrivateS60::handleCommand(int command) { QAction *action = realSoftKeyActions.value(command); if (action) { QVariant property = action->property(MENU_ACTION_PROPERTY); if (property.isValid() && property.toBool()) { - QT_TRAP_THROWING(S60->menuBar()->TryDisplayMenuBarL()); + QT_TRAP_THROWING(tryDisplayMenuBarL()); } else if (action->menu()) { // TODO: This is hack, in order to use exising QMenuBar implementation for Symbian // menubar needs to have widget to which it is associated. Since we want to associate - // menubar to action (which is inherited from QObejct), we create and associate QWidget + // menubar to action (which is inherited from QObject), we create and associate QWidget // to action and pass that for QMenuBar. This associates the menubar to action, and we // can have own menubar for each action. QWidget *actionContainer = action->property("_q_action_widget").value(); @@ -403,15 +407,15 @@ action->setProperty("_q_action_widget", v); } qt_symbian_next_menu_from_action(actionContainer); - QT_TRAP_THROWING(S60->menuBar()->TryDisplayMenuBarL()); - } else { - Q_ASSERT(action->softKeyRole() != QAction::NoSoftKey); - QWidget *actionParent = action->parentWidget(); - Q_ASSERT_X(actionParent, Q_FUNC_INFO, "No parent set for softkey action!"); - if (actionParent->isEnabled()) { - action->activate(QAction::Trigger); - return true; - } + QT_TRAP_THROWING(tryDisplayMenuBarL()); + } + + Q_ASSERT(action->softKeyRole() != QAction::NoSoftKey); + QWidget *actionParent = action->parentWidget(); + Q_ASSERT_X(actionParent, Q_FUNC_INFO, "No parent set for softkey action!"); + if (actionParent->isEnabled()) { + action->activate(QAction::Trigger); + return true; } } return false; diff -r fcece45ef507 -r 79de32ba3296 src/gui/kernel/qsoftkeymanager_s60_p.h --- a/src/gui/kernel/qsoftkeymanager_s60_p.h Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/kernel/qsoftkeymanager_s60_p.h Fri May 14 16:40:13 2010 +0300 @@ -78,6 +78,7 @@ bool handleCommand(int command); private: + void tryDisplayMenuBarL(); bool skipCbaUpdate(); void ensureCbaVisibilityAndResponsiviness(CEikButtonGroupContainer &cba); void clearSoftkeys(CEikButtonGroupContainer &cba); diff -r fcece45ef507 -r 79de32ba3296 src/gui/kernel/qt_s60_p.h --- a/src/gui/kernel/qt_s60_p.h Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/kernel/qt_s60_p.h Fri May 14 16:40:13 2010 +0300 @@ -122,6 +122,7 @@ int qtOwnsS60Environment : 1; int supportsPremultipliedAlpha : 1; int avkonComponentsSupportTransparency : 1; + int menuBeingConstructed : 1; QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type static inline void updateScreenSize(); static inline RWsSession& wsSession(); diff -r fcece45ef507 -r 79de32ba3296 src/gui/kernel/qtooltip.cpp --- a/src/gui/kernel/qtooltip.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/kernel/qtooltip.cpp Fri May 14 16:40:13 2010 +0300 @@ -168,9 +168,9 @@ QTipLabel::QTipLabel(const QString &text, QWidget *w) #ifndef QT_NO_STYLE_STYLESHEET - : QLabel(w, Qt::ToolTip), styleSheetParent(0), widget(0) + : QLabel(w, Qt::ToolTip | Qt::BypassGraphicsProxyWidget), styleSheetParent(0), widget(0) #else - : QLabel(w, Qt::ToolTip), widget(0) + : QLabel(w, Qt::ToolTip | Qt::BypassGraphicsProxyWidget), widget(0) #endif { delete instance; diff -r fcece45ef507 -r 79de32ba3296 src/gui/kernel/qwhatsthis.cpp --- a/src/gui/kernel/qwhatsthis.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/kernel/qwhatsthis.cpp Fri May 14 16:40:13 2010 +0300 @@ -143,7 +143,7 @@ \sa QToolTip */ -extern void qDeleteInEventHandler(QObject *o); +Q_DECL_IMPORT extern void qDeleteInEventHandler(QObject *o); class QWhatsThat : public QWidget { diff -r fcece45ef507 -r 79de32ba3296 src/gui/kernel/qwidget.cpp --- a/src/gui/kernel/qwidget.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/kernel/qwidget.cpp Fri May 14 16:40:13 2010 +0300 @@ -1487,8 +1487,12 @@ if (QWidgetPrivate::allWidgets) // might have been deleted by ~QApplication QWidgetPrivate::allWidgets->remove(this); - QEvent e(QEvent::Destroy); - QCoreApplication::sendEvent(this, &e); + QT_TRY { + QEvent e(QEvent::Destroy); + QCoreApplication::sendEvent(this, &e); + } QT_CATCH(const std::exception&) { + // if this fails we can't do anything about it but at least we are not allowed to throw. + } } int QWidgetPrivate::instanceCounter = 0; // Current number of widget instances diff -r fcece45ef507 -r 79de32ba3296 src/gui/painting/qbrush.cpp --- a/src/gui/painting/qbrush.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/painting/qbrush.cpp Fri May 14 16:40:13 2010 +0300 @@ -160,8 +160,7 @@ qt_brushPatternImageCache()->cleanup(); } -Q_GUI_EXPORT -QImage qt_imageForBrush(int brushStyle, bool invert) +Q_GUI_EXPORT QImage qt_imageForBrush(int brushStyle, bool invert) { return qt_brushPatternImageCache()->getImage(brushStyle, invert); } @@ -989,7 +988,8 @@ "LinearGradientPattern", "RadialGradientPattern", "ConicalGradientPattern", - "TexturePattern" + 0, 0, 0, 0, 0, 0, + "TexturePattern" // 24 }; dbg.nospace() << "QBrush(" << b.color() << ',' << BRUSH_STYLES[b.style()] << ')'; diff -r fcece45ef507 -r 79de32ba3296 src/gui/painting/qpaintbuffer.cpp --- a/src/gui/painting/qpaintbuffer.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/painting/qpaintbuffer.cpp Fri May 14 16:40:13 2010 +0300 @@ -52,8 +52,8 @@ QT_BEGIN_NAMESPACE -extern int qt_defaultDpiX(); -extern int qt_defaultDpiY(); +Q_GUI_EXPORT extern int qt_defaultDpiX(); +Q_GUI_EXPORT extern int qt_defaultDpiY(); extern void qt_format_text(const QFont &font, const QRectF &_r, int tf, const QTextOption *option, const QString& str, QRectF *brect, int tabstops, int* tabarray, int tabarraylen, diff -r fcece45ef507 -r 79de32ba3296 src/gui/painting/qpaintengine_alpha.cpp --- a/src/gui/painting/qpaintengine_alpha.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/painting/qpaintengine_alpha.cpp Fri May 14 16:40:13 2010 +0300 @@ -93,8 +93,8 @@ return true; } -extern int qt_defaultDpiX(); -extern int qt_defaultDpiY(); +Q_GUI_EXPORT extern int qt_defaultDpiX(); +Q_GUI_EXPORT extern int qt_defaultDpiY(); bool QAlphaPaintEngine::end() { diff -r fcece45ef507 -r 79de32ba3296 src/gui/painting/qpaintengine_raster.cpp --- a/src/gui/painting/qpaintengine_raster.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/painting/qpaintengine_raster.cpp Fri May 14 16:40:13 2010 +0300 @@ -102,7 +102,7 @@ QT_BEGIN_NAMESPACE -extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp +Q_GUI_EXPORT extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp #define qreal_to_fixed_26_6(f) (int(f * 64)) #define qt_swap_int(x, y) { int tmp = (x); (x) = (y); (y) = tmp; } @@ -4977,7 +4977,7 @@ clip = pe ? pe->d_func()->clip() : 0; } -extern QImage qt_imageForBrush(int brushStyle, bool invert); +Q_GUI_EXPORT extern QImage qt_imageForBrush(int brushStyle, bool invert); void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode compositionMode) { diff -r fcece45ef507 -r 79de32ba3296 src/gui/painting/qpaintengineex.cpp --- a/src/gui/painting/qpaintengineex.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/painting/qpaintengineex.cpp Fri May 14 16:40:13 2010 +0300 @@ -380,7 +380,7 @@ return new QPainterState(orig); } -extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp +Q_GUI_EXPORT extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) { diff -r fcece45ef507 -r 79de32ba3296 src/gui/painting/qpdf.cpp --- a/src/gui/painting/qpdf.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/painting/qpdf.cpp Fri May 14 16:40:13 2010 +0300 @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE -extern int qt_defaultDpi(); +Q_GUI_EXPORT extern int qt_defaultDpi(); #ifndef QT_NO_PRINTER diff -r fcece45ef507 -r 79de32ba3296 src/gui/painting/qstroker.cpp --- a/src/gui/painting/qstroker.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/painting/qstroker.cpp Fri May 14 16:40:13 2010 +0300 @@ -825,7 +825,7 @@ return t; } -void qt_find_ellipse_coords(const QRectF &r, qreal angle, qreal length, +Q_GUI_EXPORT void qt_find_ellipse_coords(const QRectF &r, qreal angle, qreal length, QPointF* startPoint, QPointF *endPoint); /*! diff -r fcece45ef507 -r 79de32ba3296 src/gui/styles/qs60style.cpp --- a/src/gui/styles/qs60style.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/styles/qs60style.cpp Fri May 14 16:40:13 2010 +0300 @@ -122,6 +122,8 @@ qint64 QS60StylePrivate::m_webPaletteKey = 0; +QPointer QS60StylePrivate::m_pressedWidget = 0; + const struct QS60StylePrivate::frameElementCenter QS60StylePrivate::m_frameElementsData[] = { {SE_ButtonNormal, QS60StyleEnums::SP_QsnFrButtonTbCenter}, {SE_ButtonPressed, QS60StyleEnums::SP_QsnFrButtonTbCenterPressed}, @@ -138,6 +140,8 @@ {SE_PanelBackground, QS60StyleEnums::SP_QsnFrSetOptCenter}, {SE_ButtonInactive, QS60StyleEnums::SP_QsnFrButtonCenterInactive}, {SE_Editor, QS60StyleEnums::SP_QsnFrInputCenter}, + {SE_TableItemPressed, QS60StyleEnums::SP_QsnFrGridCenterPressed}, + {SE_ListItemPressed, QS60StyleEnums::SP_QsnFrListPressed}, }; static const int frameElementsCount = @@ -294,6 +298,12 @@ case SE_DropArea: drawPart(QS60StyleEnums::SP_QgnGrafOrgBgGrid, painter, rect, flags | SF_PointNorth); break; + case SE_TableItemPressed: + drawFrame(SF_TableItemPressed, painter, rect, flags | SF_PointNorth); + break; + case SE_ListItemPressed: + drawFrame(SF_ListItemPressed, painter, rect, flags | SF_PointNorth); + break; default: break; } @@ -542,6 +552,7 @@ QRect endRect; if (orientation == Qt::Horizontal) { + startRect.setHeight(rect.height()); startRect.setWidth(qMin((rect.width() >> 1) - 1, startRect.width())); endRect = startRect.translated(rect.width() - startRect.width(), 0); middleRect.adjust(startRect.width(), 0, -startRect.width(), 0); @@ -551,6 +562,7 @@ endRect.adjust(overlap, 0, 0, 0); } } else { + startRect.setWidth(rect.width()); startRect.setHeight(qMin((rect.height() >> 1) - 1, startRect.height())); endRect = startRect.translated(0, rect.height() - startRect.height()); middleRect.adjust(0, startRect.height(), 0, -startRect.height()); @@ -939,6 +951,11 @@ backgroundBrush.style() == Qt::NoBrush) ? true : false; } +bool QS60StylePrivate::isWidgetPressed(const QWidget *widget) +{ + return (widget && widget == m_pressedWidget); +} + /*! \class QS60Style \brief The QS60Style class provides a look and feel suitable for applications on S60. @@ -1357,14 +1374,13 @@ optionComboBox.palette.setColor(QPalette::Inactive, QPalette::WindowText, optionComboBox.palette.text().color() ); QRect editRect = subControlRect(CC_ComboBox, comboBox, SC_ComboBoxEditField, widget); - painter->save(); - painter->setClipRect(editRect); + const int frameW = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget); if (!comboBox->currentIcon.isNull()) { - QIcon::Mode mode = comboBox->state & State_Enabled ? QIcon::Normal : QIcon::Disabled; - QPixmap pixmap = comboBox->currentIcon.pixmap(comboBox->iconSize, mode); + const QIcon::Mode mode = comboBox->state & State_Enabled ? QIcon::Normal : QIcon::Disabled; + const QPixmap pixmap = comboBox->currentIcon.pixmap(comboBox->iconSize, mode); QRect iconRect(editRect); - iconRect.setWidth(comboBox->iconSize.width() + 4); + iconRect.setWidth(comboBox->iconSize.width() + frameW); iconRect = alignedRect(comboBox->direction, Qt::AlignLeft | Qt::AlignVCenter, iconRect.size(), editRect); @@ -1373,17 +1389,19 @@ drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap); if (comboBox->direction == Qt::RightToLeft) - editRect.translate(-4 - comboBox->iconSize.width(), 0); + editRect.setRight(editRect.right() - frameW - comboBox->iconSize.width()); else - editRect.translate(comboBox->iconSize.width() + 4, 0); + editRect.setLeft(comboBox->iconSize.width() + frameW); } if (!comboBox->currentText.isEmpty() && !comboBox->editable) { + const Qt::TextElideMode elideMode = (comboBox->direction == Qt::LeftToRight) ? Qt::ElideRight : Qt::ElideLeft; + const QString text = comboBox->fontMetrics.elidedText(comboBox->currentText, elideMode, editRect.width()); + QCommonStyle::drawItemText(painter, editRect.adjusted(QS60StylePrivate::pixelMetric(PM_FrameCornerWidth), 0, -1, 0), visualAlignment(comboBox->direction, Qt::AlignLeft | Qt::AlignVCenter), - comboBox->palette, comboBox->state & State_Enabled, comboBox->currentText); + comboBox->palette, comboBox->state & State_Enabled, text); } - painter->restore(); } break; #endif //QT_NO_COMBOBOX @@ -1424,73 +1442,37 @@ // draw themed background for table unless background brush has been defined. if (vopt->backgroundBrush == Qt::NoBrush) { if (itemView) { - const QModelIndex index = vopt->index; - //todo: Draw cell background only once - for the first cell. - QStyleOptionViewItemV4 voptAdj2 = voptAdj; - const QModelIndex indexFirst = itemView->model()->index(0, 0); - const QModelIndex indexLast = itemView->model()->index( - itemView->model()->rowCount() - 1, itemView->model()->columnCount() -1); - if (itemView->viewport()) - voptAdj2.rect = QRect( itemView->visualRect(indexFirst).topLeft(), - itemView->visualRect(indexLast).bottomRight()).intersect(itemView->viewport()->rect()); drawPrimitive(PE_PanelItemViewItem, &voptAdj, painter, widget); } } else { QCommonStyle::drawPrimitive(PE_PanelItemViewItem, &voptAdj, painter, widget);} - // draw the focus rect - if (isSelected || hasFocus ) { - QRect highlightRect = option->rect.adjusted(1,1,-1,-1); - QAbstractItemView::SelectionBehavior selectionBehavior = - itemView ? itemView->selectionBehavior() : QAbstractItemView::SelectItems; - if (selectionBehavior != QAbstractItemView::SelectItems) { - // set highlight rect so that it is continuous from cell to cell, yet sligthly - // smaller than cell rect - int xBeginning = 0, yBeginning = 0, xEnd = 0, yEnd = 0; - if (selectionBehavior == QAbstractItemView::SelectRows) { - yBeginning = 1; yEnd = -1; - if (vopt->viewItemPosition == QStyleOptionViewItemV4::Beginning) - xBeginning = 1; - else if (vopt->viewItemPosition == QStyleOptionViewItemV4::End) - xEnd = -1; - } else if (selectionBehavior == QAbstractItemView::SelectColumns) { - xBeginning = 1; xEnd = -1; - if (vopt->viewItemPosition == QStyleOptionViewItemV4::Beginning) - yBeginning = 1; - else if (vopt->viewItemPosition == QStyleOptionViewItemV4::End) - yEnd = -1; - } - highlightRect = option->rect.adjusted(xBeginning, yBeginning, xEnd, yEnd); - } - if (vopt->showDecorationSelected && - (vopt->palette.highlight().color() == QS60StylePrivate::themePalette()->highlight().color())) - QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ListHighlight, painter, highlightRect, flags); - else - painter->fillRect(highlightRect, vopt->palette.highlight()); - } - // draw the icon const QIcon::Mode mode = (voptAdj.state & State_Enabled) ? QIcon::Normal : QIcon::Disabled; - const QIcon::State state = voptAdj.state & State_Open ? QIcon::On : QIcon::Off; + const QIcon::State state = (voptAdj.state & State_Open) ? QIcon::On : QIcon::Off; voptAdj.icon.paint(painter, iconRect, voptAdj.decorationAlignment, mode, state); // Draw selection check mark. Show check mark only in multi selection modes. if (itemView) { const bool singleSelection = (itemView->selectionMode() == QAbstractItemView::SingleSelection || - itemView->selectionMode() == QAbstractItemView::NoSelection); + itemView->selectionMode() == QAbstractItemView::NoSelection)|| + (itemView->selectionModel()->selectedIndexes().count() < 2 ); + + const bool selectItemsOnly = (itemView->selectionBehavior() == QAbstractItemView::SelectItems); + const QRect selectionRect = subElementRect(SE_ItemViewItemCheckIndicator, &voptAdj, widget); QStyleOptionViewItemV4 checkMarkOption(voptAdj); - // Draw selection mark. - if (voptAdj.state & State_Selected && !singleSelection) { + if (selectionRect.isValid()) checkMarkOption.rect = selectionRect; - drawPrimitive(PE_IndicatorViewItemCheck, &checkMarkOption, painter, widget); - if ( textRect.right() > selectionRect.left() ) + // Draw selection mark. + if (isSelected && !singleSelection && selectItemsOnly) { + proxy()->drawPrimitive(PE_IndicatorViewItemCheck, &checkMarkOption, painter, widget); + // @todo: this should happen in the rect retrievel i.e. subElementRect() + if (textRect.right() > selectionRect.left()) textRect.setRight(selectionRect.left()); } else if (singleSelection && - voptAdj.features & QStyleOptionViewItemV2::HasCheckIndicator && - selectionRect.isValid()) { - checkMarkOption.rect = selectionRect; + voptAdj.features & QStyleOptionViewItemV2::HasCheckIndicator) { checkMarkOption.state = checkMarkOption.state & ~State_HasFocus; switch (vopt->checkState) { @@ -1562,7 +1544,6 @@ QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth); const int tabOverlap = QS60StylePrivate::pixelMetric(PM_TabBarTabOverlap) - borderThickness; - //todo: draw navi wipe behind tabbar - must be drawn with first draw if (skinElement==QS60StylePrivate::SE_TabBarTabEastInactive|| skinElement==QS60StylePrivate::SE_TabBarTabEastActive|| @@ -1666,7 +1647,7 @@ painter->drawPixmap(tr.left() + tabOverlap, tr.center().y() - (tabIcon.height() >> 1), tabIcon); - tr.setLeft(tr.left() + iconSize.width() + 4); + tr.setLeft(tr.left() + iconSize.width() + 4); //todo: magic four } QCommonStyle::drawItemText(painter, tr, alignment, optionTab.palette, tab->state & State_Enabled, tab->text, QPalette::WindowText); @@ -1985,14 +1966,14 @@ // We need to reduce the focus frame size if LayoutSpacing is smaller than FocusFrameMargin // Otherwise, we would overlay adjacent widgets. const int frameHeightReduction = - qMin(0, pixelMetric(QStyle::PM_LayoutVerticalSpacing) - - pixelMetric(QStyle::PM_FocusFrameVMargin)); + qMin(0, pixelMetric(PM_LayoutVerticalSpacing) + - pixelMetric(PM_FocusFrameVMargin)); const int frameWidthReduction = - qMin(0, pixelMetric(QStyle::PM_LayoutHorizontalSpacing) - - pixelMetric(QStyle::PM_FocusFrameHMargin)); + qMin(0, pixelMetric(PM_LayoutHorizontalSpacing) + - pixelMetric(PM_FocusFrameHMargin)); const int rounding = - qMin(pixelMetric(QStyle::PM_FocusFrameVMargin), - pixelMetric(QStyle::PM_LayoutVerticalSpacing)); + qMin(pixelMetric(PM_FocusFrameVMargin), + pixelMetric(PM_LayoutVerticalSpacing)); const QRect frameRect = option->rect.adjusted(-frameWidthReduction, -frameHeightReduction, frameWidthReduction, frameHeightReduction); @@ -2037,7 +2018,10 @@ if (option->palette.highlight().color() == QS60StylePrivate::themePalette()->highlight().color()) if ((qstyleoption_cast(option) && (qobject_cast(widget) || qobject_cast(widget)))) - QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ListHighlight, painter, option->rect, flags); + QS60StylePrivate::drawSkinElement( + QS60StylePrivate::isWidgetPressed(widget) ? + QS60StylePrivate::SE_ListItemPressed : + QS60StylePrivate::SE_ListHighlight, painter, option->rect, flags); else commonStyleDraws = true; } @@ -2257,6 +2241,57 @@ break; #ifndef QT_NO_ITEMVIEWS case PE_PanelItemViewItem: + if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast(option)) { + const bool isSelected = (vopt->state & State_Selected); + const bool hasFocus = (vopt->state & State_HasFocus); + const bool isPressed = QS60StylePrivate::isWidgetPressed(widget); + + if (option->palette.highlight().color() == QS60StylePrivate::themePalette()->highlight().color()) { + QRect highlightRect = vopt->rect.adjusted(1,1,-1,-1); + const QAbstractItemView *itemView = qobject_cast(widget); + QAbstractItemView::SelectionBehavior selectionBehavior = + itemView ? itemView->selectionBehavior() : QAbstractItemView::SelectItems; + // Set the draw area for highlights (focus, select rect or pressed rect) + if (hasFocus || isSelected || isPressed) { + if (selectionBehavior != QAbstractItemView::SelectItems) { + // set highlight rect so that it is continuous from cell to cell, yet sligthly + // smaller than cell rect + int xBeginning = 0, yBeginning = 0, xEnd = 0, yEnd = 0; + if (selectionBehavior == QAbstractItemView::SelectRows) { + yBeginning = 1; yEnd = -1; + if (vopt->viewItemPosition == QStyleOptionViewItemV4::Beginning) + xBeginning = 1; + else if (vopt->viewItemPosition == QStyleOptionViewItemV4::End) + xEnd = -1; + } else if (selectionBehavior == QAbstractItemView::SelectColumns) { + xBeginning = 1; xEnd = -1; + if (vopt->viewItemPosition == QStyleOptionViewItemV4::Beginning) + yBeginning = 1; + else if (vopt->viewItemPosition == QStyleOptionViewItemV4::End) + yEnd = -1; + } + highlightRect = option->rect.adjusted(xBeginning, yBeginning, xEnd, yEnd); + } + } + bool tableView = false; + if (itemView && qobject_cast(widget)) + tableView = true; + + QS60StylePrivate::SkinElements element; + QRect elementRect = option->rect; + + //draw item is drawn as pressed, if it already has focus. + if (isPressed && (hasFocus || isSelected)) { + element = tableView ? QS60StylePrivate::SE_TableItemPressed : QS60StylePrivate::SE_ListItemPressed; + } else if (hasFocus || (isSelected && selectionBehavior != QAbstractItemView::SelectItems)) { + element = QS60StylePrivate::SE_ListHighlight; + elementRect = highlightRect; + } + QS60StylePrivate::drawSkinElement(element, painter, elementRect, flags); + } else { + QCommonStyle::drawPrimitive(element, option, painter, widget); + } + } break; #endif //QT_NO_ITEMVIEWS @@ -2433,7 +2468,7 @@ const int contentHeight = qMax(qMax(iconHeight, decoratorHeight) + pixelMetric(PM_ButtonMargin), textHeight + 2*pixelMetric(PM_ButtonMargin)); - sz.setHeight(contentHeight); + sz.setHeight(qMax(sz.height(), contentHeight)); sz += QSize(2 * pixelMetric(PM_ButtonMargin), 0); } break; @@ -2814,7 +2849,7 @@ const int tabOverlapNoBorder = QS60StylePrivate::pixelMetric(PM_TabBarTabOverlap); const int tabOverlap = - tabOverlapNoBorder-QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth); + tabOverlapNoBorder - QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth); const QTabWidget *tab = qobject_cast(widget); int gain = (tab) ? tabOverlap * tab->count() : 0; switch (twf->shape) { @@ -2880,7 +2915,7 @@ ret = QRect(); } else { if (menuItem->direction == Qt::RightToLeft) - ret.translate(ret.width()-indicatorWidth, 0); + ret.translate(ret.width() - indicatorWidth, 0); ret.setWidth(indicatorWidth); } } else { @@ -3067,8 +3102,11 @@ void QS60Style::polish(QApplication *application) { Q_D(QS60Style); + QCommonStyle::polish(qApp); d->m_originalPalette = application->palette(); d->setThemePalette(application); + if (QS60StylePrivate::isTouchSupported()) + qApp->installEventFilter(this); } /*! @@ -3077,10 +3115,14 @@ void QS60Style::unpolish(QApplication *application) { Q_UNUSED(application) + Q_D(QS60Style); + QCommonStyle::unpolish(qApp); const QPalette newPalette = QApplication::style()->standardPalette(); QApplication::setPalette(newPalette); QApplicationPrivate::setSystemPalette(d->m_originalPalette); + if (QS60StylePrivate::isTouchSupported()) + qApp->removeEventFilter(this); } /*! @@ -3227,9 +3269,40 @@ */ bool QS60Style::eventFilter(QObject *object, QEvent *event) { + Q_D(QS60Style); + switch(event->type()) { + case QEvent::MouseButtonPress: { + QWidget *w = QApplication::widgetAt(QCursor::pos()); + if (w) { + QWidget *focusW = w->focusProxy(); + if (qobject_cast(focusW) || + qobject_cast(focusW) || + qobject_cast(focusW)) + d->m_pressedWidget = focusW; + else if (qobject_cast(w)|| + qobject_cast(w) || + qobject_cast(w)) + d->m_pressedWidget = w; + + if ( d->m_pressedWidget) + d->m_pressedWidget->update(); + } + break; + } + case QEvent::MouseButtonRelease: { + const QWidget *w = QApplication::widgetAt(QCursor::pos()); + if (w && d->m_pressedWidget) { + d->m_pressedWidget->update(); + d->m_pressedWidget = 0; + } + break; + } + default: + break; + } + #ifdef Q_WS_S60 #ifndef QT_NO_PROGRESSBAR - Q_D(QS60Style); switch(event->type()) { case QEvent::StyleChange: case QEvent::Show: @@ -3242,15 +3315,17 @@ break; case QEvent::Destroy: case QEvent::Hide: - d->stopAnimation(QS60StyleEnums::SP_QgnGrafBarWaitAnim); - d->m_bars.removeAll(reinterpret_cast(object)); + if (QProgressBar *bar = reinterpret_cast(object)) { + d->stopAnimation(QS60StyleEnums::SP_QgnGrafBarWaitAnim); + d->m_bars.removeAll(bar); + } break; default: break; } #endif // QT_NO_PROGRESSBAR #endif // Q_WS_S60 - return QStyle::eventFilter(object, event); + return QCommonStyle::eventFilter(object, event); } /*! diff -r fcece45ef507 -r 79de32ba3296 src/gui/styles/qs60style_p.h --- a/src/gui/styles/qs60style_p.h Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/styles/qs60style_p.h Fri May 14 16:40:13 2010 +0300 @@ -293,6 +293,24 @@ SP_QsnFrButtonSideLInactive, SP_QsnFrButtonSideRInactive, SP_QsnFrButtonCenterInactive, + SP_QsnFrGridCornerTlPressed, // Pressed table item + SP_QsnFrGridCornerTrPressed, + SP_QsnFrGridCornerBlPressed, + SP_QsnFrGridCornerBrPressed, + SP_QsnFrGridSideTPressed, + SP_QsnFrGridSideBPressed, + SP_QsnFrGridSideLPressed, + SP_QsnFrGridSideRPressed, + SP_QsnFrGridCenterPressed, + SP_QsnFrListCornerTlPressed, // Pressed list item + SP_QsnFrListCornerTrPressed, + SP_QsnFrListCornerBlPressed, + SP_QsnFrListCornerBrPressed, + SP_QsnFrListSideTPressed, + SP_QsnFrListSideBPressed, + SP_QsnFrListSideLPressed, + SP_QsnFrListSideRPressed, + SP_QsnFrListPressed, }; enum ColorLists { @@ -424,7 +442,9 @@ SE_ScrollBarHandlePressedVertical, SE_ButtonInactive, SE_Editor, - SE_DropArea + SE_DropArea, + SE_TableItemPressed, + SE_ListItemPressed, }; enum SkinFrameElements { @@ -442,6 +462,8 @@ SF_ToolBarButtonPressed, SF_PanelBackground, SF_ButtonInactive, + SF_TableItemPressed, + SF_ListItemPressed, }; enum SkinElementFlag { @@ -496,6 +518,7 @@ static bool isToolBarBackground(); static bool hasSliderGrooveGraphic(); static bool isSingleClickUi(); + static bool isWidgetPressed(const QWidget *widget); // calculates average color based on button skin graphics (minus borders). QColor colorFromFrameGraphics(SkinFrameElements frame) const; @@ -593,6 +616,8 @@ QPointer m_focusFrame; static qint64 m_webPaletteKey; + static QPointer m_pressedWidget; + #ifdef Q_WS_S60 //list of progress bars having animation running QList m_bars; diff -r fcece45ef507 -r 79de32ba3296 src/gui/styles/qs60style_s60.cpp --- a/src/gui/styles/qs60style_s60.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/styles/qs60style_s60.cpp Fri May 14 16:40:13 2010 +0300 @@ -377,6 +377,27 @@ /* SP_QsnFrButtonSideRInactive */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b8}, /* SP_QsnFrButtonCenterInactive */ {KAknsIIDQsnFrButtonTbCenter, EDrawIcon, ES60_3_X, EAknsMajorSkin, 0x21b9}, + // No pressed down grid in 3.1/3.2 + /* SP_QsnFrGridCornerTlPressed */ {KAknsIIDQsnFrGridCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2681}, /*KAknsIIDQsnFrGridCornerTlPressed*/ + /* SP_QsnFrGridCornerTrPressed */ {KAknsIIDQsnFrGridCornerTr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2682}, + /* SP_QsnFrGridCornerBlPressed */ {KAknsIIDQsnFrGridCornerBl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2683}, + /* SP_QsnFrGridCornerBrPressed */ {KAknsIIDQsnFrGridCornerBr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2684}, + /* SP_QsnFrGridSideTPressed */ {KAknsIIDQsnFrGridSideT, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2685}, + /* SP_QsnFrGridSideBPressed */ {KAknsIIDQsnFrGridSideB, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2686}, + /* SP_QsnFrGridSideLPressed */ {KAknsIIDQsnFrGridSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2687}, + /* SP_QsnFrGridSideRPressed */ {KAknsIIDQsnFrGridSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2688}, + /* SP_QsnFrGridCenterPressed */ {KAknsIIDQsnFrGridCenter, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2689}, + + // No pressed down list in 3.1/3.2 + /* SP_QsnFrListCornerTlPressed */ {KAknsIIDQsnFrListCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x268b}, /*KAknsIIDQsnFrListCornerTlPressed*/ + /* SP_QsnFrListCornerTrPressed */ {KAknsIIDQsnFrListCornerTr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x268c}, + /* SP_QsnFrListCornerBlPressed */ {KAknsIIDQsnFrListCornerBl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x268d}, + /* SP_QsnFrListCornerBrPressed */ {KAknsIIDQsnFrListCornerBr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x268e}, + /* SP_QsnFrListSideTPressed */ {KAknsIIDQsnFrListSideT, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x268f}, + /* SP_QsnFrListSideBPressed */ {KAknsIIDQsnFrListSideB, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2690}, + /* SP_QsnFrListSideLPressed */ {KAknsIIDQsnFrListSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2691}, + /* SP_QsnFrListSideRPressed */ {KAknsIIDQsnFrListSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2692}, + /* SP_QsnFrListPressed */ {KAknsIIDQsnFrList, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2693}, }; QPixmap QS60StyleModeSpecifics::skinnedGraphics( diff -r fcece45ef507 -r 79de32ba3296 src/gui/styles/qstylesheetstyle.cpp --- a/src/gui/styles/qstylesheetstyle.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/styles/qstylesheetstyle.cpp Fri May 14 16:40:13 2010 +0300 @@ -4242,8 +4242,15 @@ if (const QAbstractScrollArea *sa = qobject_cast(w)) { const QAbstractScrollAreaPrivate *sap = sa->d_func(); rule.drawBackground(p, opt->rect, sap->contentsOffset()); - if (rule.hasBorder()) - rule.drawBorder(p, rule.borderRect(opt->rect)); + if (rule.hasBorder()) { + QRect brect = rule.borderRect(opt->rect); + if (styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, opt, w)) { + QRect r = brect.adjusted(0, 0, sa->verticalScrollBar()->isVisible() ? -sa->verticalScrollBar()->width() : 0, + sa->horizontalScrollBar()->isVisible() ? -sa->horizontalScrollBar()->height() : 0); + brect = QStyle::visualRect(opt->direction, brect, r); + } + rule.drawBorder(p, brect); + } break; } #endif @@ -4628,6 +4635,11 @@ return msz.width() == -1 ? msz.height() : msz.width(); } break; + + case PM_ScrollView_ScrollBarSpacing: + if(!rule.hasNativeBorder() || rule.hasBox()) + return 0; + break; #endif // QT_NO_SCROLLBAR case PM_ProgressBarChunkWidth: diff -r fcece45ef507 -r 79de32ba3296 src/gui/text/qcssparser.cpp --- a/src/gui/text/qcssparser.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/text/qcssparser.cpp Fri May 14 16:40:13 2010 +0300 @@ -895,7 +895,7 @@ BorderData data = qvariant_cast(decl.d->parsed); *width = lengthValueFromData(data.width, f); *style = data.style; - *color = brushFromData(data.color, pal); + *color = data.color.type != BrushData::Invalid ? brushFromData(data.color, pal) : QBrush(QColor()); return; } diff -r fcece45ef507 -r 79de32ba3296 src/gui/text/qfont.cpp --- a/src/gui/text/qfont.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/text/qfont.cpp Fri May 14 16:40:13 2010 +0300 @@ -2612,8 +2612,10 @@ } QT_CATCH (const std::bad_alloc &) { // no cache - just ignore } - if (cache && cache->hasLocalData()) + if (cache && cache->hasLocalData()) { + cache->localData()->clear(); cache->setLocalData(0); + } } #endif // QT_NO_THREAD diff -r fcece45ef507 -r 79de32ba3296 src/gui/text/qfontdatabase.cpp --- a/src/gui/text/qfontdatabase.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/text/qfontdatabase.cpp Fri May 14 16:40:13 2010 +0300 @@ -83,7 +83,7 @@ #define SMOOTH_SCALABLE 0xffff -extern int qt_defaultDpiY(); // in qfont.cpp +Q_GUI_EXPORT extern int qt_defaultDpiY(); // in qfont.cpp bool qt_enable_test_font = false; diff -r fcece45ef507 -r 79de32ba3296 src/gui/text/qfontengine_s60.cpp --- a/src/gui/text/qfontengine_s60.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/text/qfontengine_s60.cpp Fri May 14 16:40:13 2010 +0300 @@ -79,6 +79,31 @@ return result; } +bool QFontEngineS60Extensions::getSfntTableData(uint tag, uchar *buffer, uint *length) const +{ + if (!m_trueTypeExtension->HasTrueTypeTable(tag)) + return false; + + bool result = true; + TInt error = KErrNone; + TInt tableByteLength; + TAny *table = + q_check_ptr(m_trueTypeExtension->GetTrueTypeTable(error, tag, &tableByteLength)); + + if (error != KErrNone) { + return false; + } else if (*length > 0 && *length < tableByteLength) { + result = false; // Caller did not allocate enough memory + } else { + *length = tableByteLength; + if (buffer) + qMemCopy(buffer, table, tableByteLength); + } + + m_trueTypeExtension->ReleaseTrueTypeTable(table); + return result; +} + const unsigned char *QFontEngineS60Extensions::cmap() const { if (!m_cmap) { @@ -326,6 +351,11 @@ return m_extensions->getSfntTable(tag); } +bool QFontEngineS60::getSfntTableData(uint tag, uchar *buffer, uint *length) const +{ + return m_extensions->getSfntTableData(tag, buffer, length); +} + QFontEngine::Type QFontEngineS60::type() const { return QFontEngine::S60FontEngine; diff -r fcece45ef507 -r 79de32ba3296 src/gui/text/qfontengine_s60_p.h --- a/src/gui/text/qfontengine_s60_p.h Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/text/qfontengine_s60_p.h Fri May 14 16:40:13 2010 +0300 @@ -69,6 +69,7 @@ QFontEngineS60Extensions(CFont* fontOwner, COpenFont *font); QByteArray getSfntTable(uint tag) const; + bool getSfntTableData(uint tag, uchar *buffer, uint *length) const; const unsigned char *cmap() const; QPainterPath glyphOutline(glyph_t glyph) const; CFont *fontOwner() const; @@ -106,6 +107,7 @@ qreal minRightBearing() const { return 0; } QByteArray getSfntTable(uint tag) const; + bool getSfntTableData(uint tag, uchar *buffer, uint *length) const; static qreal pixelsToPoints(qreal pixels, Qt::Orientation orientation = Qt::Horizontal); static qreal pointsToPixels(qreal points, Qt::Orientation orientation = Qt::Horizontal); diff -r fcece45ef507 -r 79de32ba3296 src/gui/text/qfontengine_win.cpp --- a/src/gui/text/qfontengine_win.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/text/qfontengine_win.cpp Fri May 14 16:40:13 2010 +0300 @@ -654,6 +654,7 @@ static const int char_table_entries = sizeof(char_table)/sizeof(ushort); +#ifndef Q_CC_MINGW void QFontEngineWin::getGlyphBearings(glyph_t glyph, qreal *leftBearing, qreal *rightBearing) { HDC hdc = shared_dc(); @@ -678,6 +679,7 @@ } #endif } +#endif // Q_CC_MINGW qreal QFontEngineWin::minLeftBearing() const { diff -r fcece45ef507 -r 79de32ba3296 src/gui/text/qfontengine_win_p.h --- a/src/gui/text/qfontengine_win_p.h Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/text/qfontengine_win_p.h Fri May 14 16:40:13 2010 +0300 @@ -106,7 +106,9 @@ virtual QImage alphaMapForGlyph(glyph_t, const QTransform &xform); virtual QImage alphaRGBMapForGlyph(glyph_t t, int margin, const QTransform &xform); +#ifndef Q_CC_MINGW virtual void getGlyphBearings(glyph_t glyph, qreal *leftBearing = 0, qreal *rightBearing = 0); +#endif int getGlyphIndexes(const QChar *ch, int numChars, QGlyphLayout *glyphs, bool mirrored) const; void getCMap(); diff -r fcece45ef507 -r 79de32ba3296 src/gui/text/qfontmetrics.cpp --- a/src/gui/text/qfontmetrics.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/text/qfontmetrics.cpp Fri May 14 16:40:13 2010 +0300 @@ -63,7 +63,7 @@ int tf, const QString &text, QRectF *brect, int tabStops, int *tabArray, int tabArrayLen, QPainter *painter); -extern int qt_defaultDpi(); +Q_GUI_EXPORT extern int qt_defaultDpi(); /***************************************************************************** QFontMetrics member functions diff -r fcece45ef507 -r 79de32ba3296 src/gui/text/qtextcontrol.cpp --- a/src/gui/text/qtextcontrol.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/text/qtextcontrol.cpp Fri May 14 16:40:13 2010 +0300 @@ -1199,7 +1199,8 @@ blockFmt.setIndent(blockFmt.indent() - 1); cursor.setBlockFormat(blockFmt); } else { - cursor.deletePreviousChar(); + QTextCursor localCursor = cursor; + localCursor.deletePreviousChar(); } goto accept; } @@ -1232,7 +1233,8 @@ } #endif else if (e == QKeySequence::Delete) { - cursor.deleteChar(); + QTextCursor localCursor = cursor; + localCursor.deleteChar(); } else if (e == QKeySequence::DeleteEndOfWord) { if (!cursor.hasSelection()) diff -r fcece45ef507 -r 79de32ba3296 src/gui/text/qtextdocument.cpp --- a/src/gui/text/qtextdocument.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/text/qtextdocument.cpp Fri May 14 16:40:13 2010 +0300 @@ -1631,7 +1631,7 @@ painter->restore(); } -extern int qt_defaultDpi(); +Q_GUI_EXPORT extern int qt_defaultDpi(); /*! Prints the document to the given \a printer. The QPrinter must be diff -r fcece45ef507 -r 79de32ba3296 src/gui/text/qtextdocumentlayout.cpp --- a/src/gui/text/qtextdocumentlayout.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/text/qtextdocumentlayout.cpp Fri May 14 16:40:13 2010 +0300 @@ -75,7 +75,7 @@ QT_BEGIN_NAMESPACE -extern int qt_defaultDpi(); +Q_GUI_EXPORT extern int qt_defaultDpi(); // ################ should probably add frameFormatChange notification! diff -r fcece45ef507 -r 79de32ba3296 src/gui/text/qtextengine.cpp --- a/src/gui/text/qtextengine.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/text/qtextengine.cpp Fri May 14 16:40:13 2010 +0300 @@ -856,7 +856,7 @@ } } -extern int qt_defaultDpiY(); // in qfont.cpp +Q_GUI_EXPORT extern int qt_defaultDpiY(); // in qfont.cpp void QTextEngine::shapeText(int item) const { @@ -1648,7 +1648,7 @@ } } - glyph_t glyph = glyphs.glyphs[logClusters[pos + ilen - 1]]; + glyph_t glyph = glyphs.glyphs[logClusters[ilen - 1]]; glyph_metrics_t gi = fe->boundingBox(glyph); if (gi.isValid()) gm.width -= qRound(gi.xoff - gi.x - gi.width); @@ -2495,7 +2495,7 @@ // qDebug("split at position %d itempos=%d", pos, item); } -extern int qt_defaultDpiY(); +Q_GUI_EXPORT extern int qt_defaultDpiY(); QFixed QTextEngine::calculateTabWidth(int item, QFixed x) const { diff -r fcece45ef507 -r 79de32ba3296 src/gui/text/qtextimagehandler.cpp --- a/src/gui/text/qtextimagehandler.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/text/qtextimagehandler.cpp Fri May 14 16:40:13 2010 +0300 @@ -123,7 +123,7 @@ qreal scale = 1.0; QPaintDevice *pdev = doc->documentLayout()->paintDevice(); if (pdev) { - extern int qt_defaultDpi(); + Q_GUI_EXPORT extern int qt_defaultDpi(); if (pm.isNull()) pm = getPixmap(doc, format); if (!pm.isNull()) diff -r fcece45ef507 -r 79de32ba3296 src/gui/widgets/qabstractbutton.cpp --- a/src/gui/widgets/qabstractbutton.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/widgets/qabstractbutton.cpp Fri May 14 16:40:13 2010 +0300 @@ -57,7 +57,7 @@ #define AUTO_REPEAT_DELAY 300 #define AUTO_REPEAT_INTERVAL 100 -extern bool qt_tab_all_widgets; +Q_GUI_EXPORT extern bool qt_tab_all_widgets; /*! \class QAbstractButton diff -r fcece45ef507 -r 79de32ba3296 src/gui/widgets/qabstractscrollarea.cpp --- a/src/gui/widgets/qabstractscrollarea.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/widgets/qabstractscrollarea.cpp Fri May 14 16:40:13 2010 +0300 @@ -394,7 +394,7 @@ if ((frameStyle != QFrame::NoFrame) && q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, &opt, q)) { controlsRect = widgetRect; - const int extra = q->style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarSpacing); + const int extra = q->style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarSpacing, &opt, q); const QPoint cornerExtra(needv ? extra : 0, needh ? extra : 0); QRect frameRect = widgetRect; frameRect.adjust(0, 0, -cornerOffset.x() - cornerExtra.x(), -cornerOffset.y() - cornerExtra.y()); diff -r fcece45ef507 -r 79de32ba3296 src/gui/widgets/qcombobox.cpp --- a/src/gui/widgets/qcombobox.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/widgets/qcombobox.cpp Fri May 14 16:40:13 2010 +0300 @@ -76,6 +76,10 @@ #ifndef QT_NO_EFFECTS # include #endif +#if defined(Q_WS_S60) +#include "private/qt_s60_p.h" +#endif + QT_BEGIN_NAMESPACE QComboBoxPrivate::QComboBoxPrivate() @@ -2449,11 +2453,16 @@ // in portait, menu should be positioned above softkeys listRect.moveBottom(screen.bottom()); } else { - // landscape, menu should be at the right and horizontally centered + TRect staConTopRect = TRect(); + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStaconTop, staConTopRect); listRect.setWidth(listRect.height()); + //by default popup is centered on screen in landscape listRect.moveCenter(screen.center()); - (opt.direction == Qt::LeftToRight) ? listRect.setRight(screen.right()) : - listRect.setLeft(screen.left()); + if (staConTopRect.IsEmpty()) { + // landscape without stacon, menu should be at the right + (opt.direction == Qt::LeftToRight) ? listRect.setRight(screen.right()) : + listRect.setLeft(screen.left()); + } } #endif } else if (!boundToScreen || listRect.height() <= belowHeight) { @@ -2681,13 +2690,18 @@ // in portait, menu should be positioned above softkeys listRect.moveBottom(screen.bottom()); } else { - // landscape, menu should be at the right and horizontally centered + TRect staConTopRect = TRect(); + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStaconTop, staConTopRect); listRect.setWidth(listRect.height()); + //by default popup is centered on screen in landscape listRect.moveCenter(screen.center()); - (opt.direction == Qt::LeftToRight) ? listRect.setRight(screen.right()) : - listRect.setLeft(screen.left()); + if (staConTopRect.IsEmpty()) { + // landscape without stacon, menu should be at the right + (opt.direction == Qt::LeftToRight) ? listRect.setRight(screen.right()) : + listRect.setLeft(screen.left()); + } + d->container->setGeometry(listRect); } - d->container->setGeometry(listRect); } } #endif diff -r fcece45ef507 -r 79de32ba3296 src/gui/widgets/qmenu.cpp --- a/src/gui/widgets/qmenu.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/gui/widgets/qmenu.cpp Fri May 14 16:40:13 2010 +0300 @@ -1406,12 +1406,14 @@ QMenu::~QMenu() { Q_D(QMenu); - QHash::iterator it = d->widgetItems.begin(); - for (; it != d->widgetItems.end(); ++it) { - if (QWidget *widget = it.value()) { - QWidgetAction *action = static_cast(it.key()); - action->releaseWidget(widget); - *it = 0; + if (!d->widgetItems.isEmpty()) { // avoid detach on shared null hash + QHash::iterator it = d->widgetItems.begin(); + for (; it != d->widgetItems.end(); ++it) { + if (QWidget *widget = it.value()) { + QWidgetAction *action = static_cast(it.key()); + action->releaseWidget(widget); + *it = 0; + } } } diff -r fcece45ef507 -r 79de32ba3296 src/multimedia/audio/qaudio_symbian_p.cpp --- a/src/multimedia/audio/qaudio_symbian_p.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/multimedia/audio/qaudio_symbian_p.cpp Fri May 14 16:40:13 2010 +0300 @@ -315,7 +315,7 @@ TUint32 fourCC; bool result = false; - if (formatQt.codec() == "audio/pcm" && + if (formatQt.codec() == QString::fromAscii("audio/pcm") && formatQtToNative(formatQt, fourCC, formatNative)) { result = (formatNative.iRate & caps.caps().iRate) @@ -337,7 +337,7 @@ TMMFMonoStereo outputChannels; TMMFSoundEncoding outputEncoding; - if (inputFormat.codec() == "audio/pcm") { + if (inputFormat.codec() == QString::fromAscii("audio/pcm")) { result = sampleRateQtToNative(inputFormat.frequency(), outputSampleRate) && channelsQtToNative(inputFormat.channels(), outputChannels) diff -r fcece45ef507 -r 79de32ba3296 src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp --- a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp Fri May 14 16:40:13 2010 +0300 @@ -78,6 +78,8 @@ { device = QLatin1String(dev); this->mode = mode; + + updateLists(); } QAudioDeviceInfoInternal::~QAudioDeviceInfoInternal() @@ -176,22 +178,70 @@ // See if what is in settings will work (return value). bool failed = false; + bool match = false; - // For now, just accept only audio/pcm codec - if(!format.codec().startsWith(QLatin1String("audio/pcm"))) - failed = true; + // check codec + for( int i = 0; i < codecz.count(); i++) { + if (format.codec() == codecz.at(i)) + match = true; + } + if (!match) failed = true; - if(!failed && !(format.channels() == 1 || format.channels() == 2)) - failed = true; + // check channel + match = false; + if (!failed) { + for( int i = 0; i < channelz.count(); i++) { + if (format.channels() == channelz.at(i)) { + match = true; + break; + } + } + } + if (!match) failed = true; - if(!failed) { - if(!(format.frequency() == 8000 || format.frequency() == 11025 || format.frequency() == 22050 || - format.frequency() == 44100 || format.frequency() == 48000 || format.frequency() == 96000)) - failed = true; + // check frequency + match = false; + if (!failed) { + for( int i = 0; i < freqz.count(); i++) { + if (format.frequency() == freqz.at(i)) { + match = true; + break; + } + } } - if(!failed && !(format.sampleSize() == 8 || format.sampleSize() == 16)) - failed = true; + // check sample size + match = false; + if (!failed) { + for( int i = 0; i < sizez.count(); i++) { + if (format.sampleSize() == sizez.at(i)) { + match = true; + break; + } + } + } + + // check byte order + match = false; + if (!failed) { + for( int i = 0; i < byteOrderz.count(); i++) { + if (format.byteOrder() == byteOrderz.at(i)) { + match = true; + break; + } + } + } + + // check sample type + match = false; + if (!failed) { + for( int i = 0; i < typez.count(); i++) { + if (format.sampleType() == typez.at(i)) { + match = true; + break; + } + } + } if(!failed) { // settings work @@ -332,6 +382,8 @@ codecz.append(QLatin1String("audio/pcm")); } + if (freqz.count() > 0) + freqz.prepend(8000); } QList QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode) diff -r fcece45ef507 -r 79de32ba3296 src/multimedia/audio/qaudioinput.cpp --- a/src/multimedia/audio/qaudioinput.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/multimedia/audio/qaudioinput.cpp Fri May 14 16:40:13 2010 +0300 @@ -146,6 +146,20 @@ \snippet doc/src/snippets/audio/main.cpp 0 \sa QAudioOutput, QAudioDeviceInfo + + \section1 Symbian Platform Security Requirements + + On Symbian, processes which use this class must have the + \c UserEnvironment platform security capability. If the client + process lacks this capability, calls to either overload of start() + will fail. + This failure is indicated by the QAudioInput object setting + its error() value to \l{QAudio::OpenError} and then emitting a + \l{stateChanged()}{stateChanged}(\l{QAudio::StoppedState}) signal. + + Platform security capabilities are added via the + \l{qmake-variable-reference.html#target-capability}{TARGET.CAPABILITY} + qmake variable. */ /*! @@ -197,6 +211,8 @@ If a problem occurs during this process the error() is set to QAudio::OpenError, state() is set to QAudio::StoppedState and stateChanged() signal is emitted. + \sa {Symbian Platform Security Requirements} + \sa QIODevice */ @@ -217,6 +233,8 @@ If a problem occurs during this process the error() is set to QAudio::OpenError, state() is set to QAudio::StoppedState and stateChanged() signal is emitted. + \sa {Symbian Platform Security Requirements} + \sa QIODevice */ diff -r fcece45ef507 -r 79de32ba3296 src/multimedia/audio/qaudioinput_alsa_p.cpp --- a/src/multimedia/audio/qaudioinput_alsa_p.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/multimedia/audio/qaudioinput_alsa_p.cpp Fri May 14 16:40:13 2010 +0300 @@ -428,7 +428,6 @@ void QAudioInputPrivate::close() { - deviceState = QAudio::StoppedState; timer->stop(); if ( handle ) { diff -r fcece45ef507 -r 79de32ba3296 src/multimedia/audio/qaudioinput_win32_p.cpp --- a/src/multimedia/audio/qaudioinput_win32_p.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/multimedia/audio/qaudioinput_win32_p.cpp Fri May 14 16:40:13 2010 +0300 @@ -57,8 +57,6 @@ //#define DEBUG_AUDIO 1 -static CRITICAL_SECTION waveInCriticalSection; - static const int minimumIntervalTime = 50; QAudioInputPrivate::QAudioInputPrivate(const QByteArray &device, const QAudioFormat& audioFormat): @@ -104,16 +102,16 @@ case WIM_OPEN: break; case WIM_DATA: - EnterCriticalSection(&waveInCriticalSection); + EnterCriticalSection(&qAudio->waveInCriticalSection); if(qAudio->waveFreeBlockCount > 0) qAudio->waveFreeBlockCount--; qAudio->feedback(); - LeaveCriticalSection(&waveInCriticalSection); + LeaveCriticalSection(&qAudio->waveInCriticalSection); break; case WIM_CLOSE: - EnterCriticalSection(&waveInCriticalSection); + EnterCriticalSection(&qAudio->waveInCriticalSection); qAudio->finished = true; - LeaveCriticalSection(&waveInCriticalSection); + LeaveCriticalSection(&qAudio->waveInCriticalSection); break; default: return; @@ -226,8 +224,8 @@ #endif header = 0; if(buffer_size == 0) { - // Default buffer size, 100ms, default period size is 20ms - buffer_size = settings.frequency()*settings.channels()*(settings.sampleSize()/8)*0.1; + // Default buffer size, 200ms, default period size is 40ms + buffer_size = settings.frequency()*settings.channels()*(settings.sampleSize()/8)*0.2; period_size = buffer_size/5; } else { period_size = buffer_size/5; diff -r fcece45ef507 -r 79de32ba3296 src/multimedia/audio/qaudioinput_win32_p.h --- a/src/multimedia/audio/qaudioinput_win32_p.h Mon May 03 13:17:34 2010 +0300 +++ b/src/multimedia/audio/qaudioinput_win32_p.h Fri May 14 16:40:13 2010 +0300 @@ -122,6 +122,8 @@ volatile int waveFreeBlockCount; int waveCurrentBlock; + CRITICAL_SECTION waveInCriticalSection; + static void CALLBACK waveInProc( HWAVEIN hWaveIn, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 ); diff -r fcece45ef507 -r 79de32ba3296 src/multimedia/audio/qaudiooutput_alsa_p.cpp --- a/src/multimedia/audio/qaudiooutput_alsa_p.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/multimedia/audio/qaudiooutput_alsa_p.cpp Fri May 14 16:40:13 2010 +0300 @@ -485,7 +485,6 @@ void QAudioOutputPrivate::close() { - deviceState = QAudio::StoppedState; timer->stop(); if ( handle ) { @@ -701,6 +700,7 @@ } else if(l < 0) { close(); + deviceState = QAudio::StoppedState; errorState = QAudio::IOError; emit stateChanged(deviceState); } diff -r fcece45ef507 -r 79de32ba3296 src/multimedia/audio/qaudiooutput_win32_p.cpp --- a/src/multimedia/audio/qaudiooutput_win32_p.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp Fri May 14 16:40:13 2010 +0300 @@ -56,8 +56,6 @@ QT_BEGIN_NAMESPACE -static CRITICAL_SECTION waveOutCriticalSection; - static const int minimumIntervalTime = 50; QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray &device, const QAudioFormat& audioFormat): @@ -107,16 +105,16 @@ case WOM_CLOSE: return; case WOM_DONE: - EnterCriticalSection(&waveOutCriticalSection); + EnterCriticalSection(&qAudio->waveOutCriticalSection); if(qAudio->finished || qAudio->buffer_size == 0 || qAudio->period_size == 0) { - LeaveCriticalSection(&waveOutCriticalSection); + LeaveCriticalSection(&qAudio->waveOutCriticalSection); return; } qAudio->waveFreeBlockCount++; if(qAudio->waveFreeBlockCount >= qAudio->buffer_size/qAudio->period_size) qAudio->waveFreeBlockCount = qAudio->buffer_size/qAudio->period_size; qAudio->feedback(); - LeaveCriticalSection(&waveOutCriticalSection); + LeaveCriticalSection(&qAudio->waveOutCriticalSection); break; default: return; diff -r fcece45ef507 -r 79de32ba3296 src/multimedia/audio/qaudiooutput_win32_p.h --- a/src/multimedia/audio/qaudiooutput_win32_p.h Mon May 03 13:17:34 2010 +0300 +++ b/src/multimedia/audio/qaudiooutput_win32_p.h Fri May 14 16:40:13 2010 +0300 @@ -119,6 +119,8 @@ static void CALLBACK waveOutProc( HWAVEOUT hWaveOut, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 ); + CRITICAL_SECTION waveOutCriticalSection; + WAVEHDR* allocateBlocks(int size, int count); void freeBlocks(WAVEHDR* blockArray); bool open(); diff -r fcece45ef507 -r 79de32ba3296 src/network/access/qftp.cpp --- a/src/network/access/qftp.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/network/access/qftp.cpp Fri May 14 16:40:13 2010 +0300 @@ -2309,6 +2309,12 @@ void QFtpPrivate::_q_piError(int errorCode, const QString &text) { Q_Q(QFtp); + + if (pending.isEmpty()) { + qWarning() << "QFtpPrivate::_q_piError was called without pending command!"; + return; + } + QFtpCommand *c = pending.first(); // non-fatal errors diff -r fcece45ef507 -r 79de32ba3296 src/network/access/qhttpnetworkconnection.cpp --- a/src/network/access/qhttpnetworkconnection.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/network/access/qhttpnetworkconnection.cpp Fri May 14 16:40:13 2010 +0300 @@ -71,9 +71,11 @@ const int QHttpNetworkConnectionPrivate::defaultChannelCount = 6; #endif -// the maximum amount of requests that might be pipelined into a socket -// from what was suggested, 3 seems to be OK +// The pipeline length. So there will be 4 requests in flight. const int QHttpNetworkConnectionPrivate::defaultPipelineLength = 3; +// Only re-fill the pipeline if there's defaultRePipelineLength slots free in the pipeline. +// This means that there are 2 requests in flight and 2 slots free that will be re-filled. +const int QHttpNetworkConnectionPrivate::defaultRePipelineLength = 2; QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(const QString &hostName, quint16 port, bool encrypt) @@ -487,54 +489,68 @@ int i = indexOf(socket); - bool highPriorityQueueProcessingDone = false; - bool lowPriorityQueueProcessingDone = false; + if (! (defaultPipelineLength - channels[i].alreadyPipelinedRequests.length() >= 2)) { + return; + } - while (!highPriorityQueueProcessingDone && !lowPriorityQueueProcessingDone) { - // this loop runs once per request we intend to pipeline in. + if (channels[i].pipeliningSupported != QHttpNetworkConnectionChannel::PipeliningProbablySupported) + return; - if (channels[i].pipeliningSupported != QHttpNetworkConnectionChannel::PipeliningProbablySupported) - return; + // the current request that is in must already support pipelining + if (!channels[i].request.isPipeliningAllowed()) + return; - // the current request that is in must already support pipelining - if (!channels[i].request.isPipeliningAllowed()) - return; + // the current request must be a idempotent (right now we only check GET) + if (channels[i].request.operation() != QHttpNetworkRequest::Get) + return; - // the current request must be a idempotent (right now we only check GET) - if (channels[i].request.operation() != QHttpNetworkRequest::Get) - return; + // check if socket is connected + if (socket->state() != QAbstractSocket::ConnectedState) + return; - // check if socket is connected - if (socket->state() != QAbstractSocket::ConnectedState) - return; + // check for resendCurrent + if (channels[i].resendCurrent) + return; - // check for resendCurrent - if (channels[i].resendCurrent) - return; + // we do not like authentication stuff + // ### make sure to be OK with this in later releases + if (!channels[i].authenticator.isNull() || !channels[i].authenticator.user().isEmpty()) + return; + if (!channels[i].proxyAuthenticator.isNull() || !channels[i].proxyAuthenticator.user().isEmpty()) + return; - // we do not like authentication stuff - // ### make sure to be OK with this in later releases - if (!channels[i].authenticator.isNull() || !channels[i].authenticator.user().isEmpty()) - return; - if (!channels[i].proxyAuthenticator.isNull() || !channels[i].proxyAuthenticator.user().isEmpty()) - return; + // must be in ReadingState or WaitingState + if (! (channels[i].state == QHttpNetworkConnectionChannel::WaitingState + || channels[i].state == QHttpNetworkConnectionChannel::ReadingState)) + return; + - // check for pipeline length + //qDebug() << "QHttpNetworkConnectionPrivate::fillPipeline processing highPriorityQueue, size=" << highPriorityQueue.size() << " alreadyPipelined=" << channels[i].alreadyPipelinedRequests.length(); + int lengthBefore; + while (!highPriorityQueue.isEmpty()) { + lengthBefore = channels[i].alreadyPipelinedRequests.length(); + fillPipeline(highPriorityQueue, channels[i]); + if (channels[i].alreadyPipelinedRequests.length() >= defaultPipelineLength) return; - // must be in ReadingState or WaitingState - if (! (channels[i].state == QHttpNetworkConnectionChannel::WaitingState - || channels[i].state == QHttpNetworkConnectionChannel::ReadingState)) + if (lengthBefore == channels[i].alreadyPipelinedRequests.length()) + break; // did not process anything, now do the low prio queue + } + + //qDebug() << "QHttpNetworkConnectionPrivate::fillPipeline processing lowPriorityQueue, size=" << lowPriorityQueue.size() << " alreadyPipelined=" << channels[i].alreadyPipelinedRequests.length(); + while (!lowPriorityQueue.isEmpty()) { + lengthBefore = channels[i].alreadyPipelinedRequests.length(); + fillPipeline(lowPriorityQueue, channels[i]); + + if (channels[i].alreadyPipelinedRequests.length() >= defaultPipelineLength) return; - highPriorityQueueProcessingDone = fillPipeline(highPriorityQueue, channels[i]); - // not finished with highPriorityQueue? then loop again - if (!highPriorityQueueProcessingDone) - continue; - // highPriorityQueue was processed, now deal with the lowPriorityQueue - lowPriorityQueueProcessingDone = fillPipeline(lowPriorityQueue, channels[i]); + if (lengthBefore == channels[i].alreadyPipelinedRequests.length()) + break; // did not process anything } + + } // returns true when the processing of a queue has been done @@ -707,7 +723,6 @@ // if this is not possible, error will be emitted and connection terminated if (!channels[i].resetUploadData()) continue; - channels[i].sendRequest(); } } @@ -747,8 +762,9 @@ // return fast if there is nothing to pipeline if (highPriorityQueue.isEmpty() && lowPriorityQueue.isEmpty()) return; - for (int j = 0; j < channelCount; j++) - fillPipeline(channels[j].socket); + for (int i = 0; i < channelCount; i++) + if (channels[i].socket->state() == QAbstractSocket::ConnectedState) + fillPipeline(channels[i].socket); } void QHttpNetworkConnectionPrivate::_q_restartAuthPendingRequests() diff -r fcece45ef507 -r 79de32ba3296 src/network/access/qhttpnetworkconnection_p.h --- a/src/network/access/qhttpnetworkconnection_p.h Mon May 03 13:17:34 2010 +0300 +++ b/src/network/access/qhttpnetworkconnection_p.h Fri May 14 16:40:13 2010 +0300 @@ -156,6 +156,7 @@ public: static const int defaultChannelCount; static const int defaultPipelineLength; + static const int defaultRePipelineLength; QHttpNetworkConnectionPrivate(const QString &hostName, quint16 port, bool encrypt); QHttpNetworkConnectionPrivate(quint16 channelCount, const QString &hostName, quint16 port, bool encrypt); diff -r fcece45ef507 -r 79de32ba3296 src/network/access/qhttpnetworkconnectionchannel.cpp --- a/src/network/access/qhttpnetworkconnectionchannel.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp Fri May 14 16:40:13 2010 +0300 @@ -285,8 +285,8 @@ } // HTTP pipelining - connection->d_func()->fillPipeline(socket); - socket->flush(); + //connection->d_func()->fillPipeline(socket); + //socket->flush(); // ensure we try to receive a reply in all cases, even if _q_readyRead_ hat not been called // this is needed if the sends an reply before we have finished sending the request. In that @@ -661,7 +661,8 @@ connection->d_func()->fillPipeline(socket); // continue reading - _q_receiveReply(); + //_q_receiveReply(); + // this was wrong, allDone gets called from that function anyway. } } else if (alreadyPipelinedRequests.isEmpty() && socket->bytesAvailable() > 0) { eatWhitespace(); @@ -690,6 +691,8 @@ && (serverHeaderField = reply->headerField("Server"), !serverHeaderField.contains("Microsoft-IIS/4.")) && (!serverHeaderField.contains("Microsoft-IIS/5.")) && (!serverHeaderField.contains("Netscape-Enterprise/3.")) + // this is adpoted from the knowledge of the Nokia 7.x browser team (DEF143319) + && (!serverHeaderField.contains("WebLogic")) ) { pipeliningSupported = QHttpNetworkConnectionChannel::PipeliningProbablySupported; } else { diff -r fcece45ef507 -r 79de32ba3296 src/network/access/qnetworkaccessmanager.cpp --- a/src/network/access/qnetworkaccessmanager.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/network/access/qnetworkaccessmanager.cpp Fri May 14 16:40:13 2010 +0300 @@ -138,6 +138,16 @@ can be: \snippet doc/src/snippets/code/src_network_access_qnetworkaccessmanager.cpp 1 + \section1 Symbian Platform Security Requirements + + On Symbian, processes which use this class must have the + \c NetworkServices platform security capability. If the client + process lacks this capability, operations will result in a panic. + + Platform security capabilities are added via the + \l{qmake-variable-reference.html#target-capability}{TARGET.CAPABILITY} + qmake variable. + \sa QNetworkRequest, QNetworkReply, QNetworkProxy */ diff -r fcece45ef507 -r 79de32ba3296 src/network/access/qnetworkdiskcache.cpp --- a/src/network/access/qnetworkdiskcache.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/network/access/qnetworkdiskcache.cpp Fri May 14 16:40:13 2010 +0300 @@ -41,7 +41,6 @@ //#define QNETWORKDISKCACHE_DEBUG -#ifndef QT_NO_NETWORKDISKCACHE #include "qnetworkdiskcache.h" #include "qnetworkdiskcache_p.h" @@ -60,6 +59,8 @@ #define CACHE_POSTFIX QLatin1String(".cache") #define MAX_COMPRESSION_SIZE (1024 * 1024 * 3) +#ifndef QT_NO_NETWORKDISKCACHE + QT_BEGIN_NAMESPACE /*! diff -r fcece45ef507 -r 79de32ba3296 src/network/access/qnetworkdiskcache_p.h --- a/src/network/access/qnetworkdiskcache_p.h Mon May 03 13:17:34 2010 +0300 +++ b/src/network/access/qnetworkdiskcache_p.h Fri May 14 16:40:13 2010 +0300 @@ -59,6 +59,8 @@ #include #include +#ifndef QT_NO_NETWORKDISKCACHE + QT_BEGIN_NAMESPACE class QFile; @@ -119,4 +121,6 @@ QT_END_NAMESPACE +#endif // QT_NO_NETWORKDISKCACHE + #endif // QNETWORKDISKCACHE_P_H diff -r fcece45ef507 -r 79de32ba3296 src/network/socket/qlocalsocket_win.cpp --- a/src/network/socket/qlocalsocket_win.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/network/socket/qlocalsocket_win.cpp Fri May 14 16:40:13 2010 +0300 @@ -39,7 +39,6 @@ ** ****************************************************************************/ -#include "qlocalsocket.h" #include "qlocalsocket_p.h" #include @@ -425,6 +424,15 @@ void QLocalSocket::disconnectFromServer() { Q_D(QLocalSocket); + + // Are we still connected? + if (!isValid()) { + // If we have unwritten data, the pipeWriter is still present. + // It must be destroyed before close() to prevent an infinite loop. + delete d->pipeWriter; + d->pipeWriter = 0; + } + flush(); if (d->pipeWriter && d->pipeWriter->bytesToWrite() != 0) { d->state = QLocalSocket::ClosingState; diff -r fcece45ef507 -r 79de32ba3296 src/network/socket/qnativesocketengine_unix.cpp --- a/src/network/socket/qnativesocketengine_unix.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/network/socket/qnativesocketengine_unix.cpp Fri May 14 16:40:13 2010 +0300 @@ -601,10 +601,15 @@ // Peek 0 bytes into the next message. The size of the message may // well be 0, so we can't check recvfrom's return value. ssize_t readBytes; +#ifdef Q_OS_SYMBIAN + char c; + readBytes = ::recvfrom(socketDescriptor, &c, 1, MSG_PEEK, &storage.a, &storageSize); +#else do { char c; readBytes = ::recvfrom(socketDescriptor, &c, 1, MSG_PEEK, &storage.a, &storageSize); } while (readBytes == -1 && errno == EINTR); +#endif // If there's no error, or if our buffer was too small, there must be a // pending datagram. @@ -661,11 +666,17 @@ sz = sizeof(aa); ssize_t recvFromResult = 0; +#ifdef Q_OS_SYMBIAN + char c; + recvFromResult = ::recvfrom(socketDescriptor, maxSize ? data : &c, maxSize ? maxSize : 1, + 0, &aa.a, &sz); +#else do { char c; recvFromResult = ::recvfrom(socketDescriptor, maxSize ? data : &c, maxSize ? maxSize : 1, 0, &aa.a, &sz); } while (recvFromResult == -1 && errno == EINTR); +#endif if (recvFromResult == -1) { setError(QAbstractSocket::NetworkError, ReceiveDatagramErrorString); @@ -832,17 +843,17 @@ // ignore the SIGPIPE signal qt_ignore_sigpipe(); + ssize_t writtenBytes; +#ifdef Q_OS_SYMBIAN + // Symbian does not support signals natively and Open C returns EINTR when moving to offline + writtenBytes = ::write(socketDescriptor, data, len); +#else // loop while ::write() returns -1 and errno == EINTR, in case // of an interrupting signal. - ssize_t writtenBytes; do { -#ifdef Q_OS_SYMBIAN - writtenBytes = ::write(socketDescriptor, data, len); -#else writtenBytes = qt_safe_write(socketDescriptor, data, len); + } while (writtenBytes < 0 && errno == EINTR); #endif - // writtenBytes = QT_WRITE(socketDescriptor, data, len); ### TODO S60: Should this line be removed or the one above it? - } while (writtenBytes < 0 && errno == EINTR); if (writtenBytes < 0) { switch (errno) { @@ -882,13 +893,13 @@ } ssize_t r = 0; - do { #ifdef Q_OS_SYMBIAN - r = ::read(socketDescriptor, data, maxSize); + r = ::read(socketDescriptor, data, maxSize); #else + do { r = qt_safe_read(socketDescriptor, data, maxSize); + } while (r == -1 && errno == EINTR); #endif - } while (r == -1 && errno == EINTR); if (r < 0) { r = -1; diff -r fcece45ef507 -r 79de32ba3296 src/network/socket/qtcpserver.cpp --- a/src/network/socket/qtcpserver.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/network/socket/qtcpserver.cpp Fri May 14 16:40:13 2010 +0300 @@ -79,6 +79,16 @@ use waitForNewConnection(), which blocks until either a connection is available or a timeout expires. + \section1 Symbian Platform Security Requirements + + On Symbian, processes which use this class must have the + \c NetworkServices platform security capability. If the client + process lacks this capability, it will lead to a panic. + + Platform security capabilities are added via the + \l{qmake-variable-reference.html#target-capability}{TARGET.CAPABILITY} + qmake variable. + \sa QTcpSocket, {Fortune Server Example}, {Threaded Fortune Server Example}, {Loopback Example}, {Torrent Example} */ diff -r fcece45ef507 -r 79de32ba3296 src/network/socket/qtcpsocket.cpp --- a/src/network/socket/qtcpsocket.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/network/socket/qtcpsocket.cpp Fri May 14 16:40:13 2010 +0300 @@ -60,6 +60,16 @@ \bold{Note:} TCP sockets cannot be opened in QIODevice::Unbuffered mode. + \section1 Symbian Platform Security Requirements + + On Symbian, processes which use this class must have the + \c NetworkServices platform security capability. If the client + process lacks this capability, it will result in a panic. + + Platform security capabilities are added via the + \l{qmake-variable-reference.html#target-capability}{TARGET.CAPABILITY} + qmake variable. + \sa QTcpServer, QUdpSocket, QFtp, QNetworkAccessManager, {Fortune Server Example}, {Fortune Client Example}, {Threaded Fortune Server Example}, {Blocking Fortune Client Example}, diff -r fcece45ef507 -r 79de32ba3296 src/network/socket/qudpsocket.cpp --- a/src/network/socket/qudpsocket.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/network/socket/qudpsocket.cpp Fri May 14 16:40:13 2010 +0300 @@ -86,6 +86,16 @@ \l{network/broadcastreceiver}{Broadcast Receiver} examples illustrate how to use QUdpSocket in applications. + \section1 Symbian Platform Security Requirements + + On Symbian, processes which use this class must have the + \c NetworkServices platform security capability. If the client + process lacks this capability, operations will result in a panic. + + Platform security capabilities are added via the + \l{qmake-variable-reference.html#target-capability}{TARGET.CAPABILITY} + qmake variable. + \sa QTcpSocket */ diff -r fcece45ef507 -r 79de32ba3296 src/network/ssl/qsslsocket.cpp --- a/src/network/ssl/qsslsocket.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/network/ssl/qsslsocket.cpp Fri May 14 16:40:13 2010 +0300 @@ -156,6 +156,16 @@ is being encrypted and encryptedBytesWritten() will get emitted as soon as data has been written to the TCP socket. + \section1 Symbian Platform Security Requirements + + On Symbian, processes which use this class must have the + \c NetworkServices platform security capability. If the client + process lacks this capability, operations will fail. + + Platform security capabilities are added via the + \l{qmake-variable-reference.html#target-capability}{TARGET.CAPABILITY} + qmake variable. + \sa QSslCertificate, QSslCipher, QSslError */ diff -r fcece45ef507 -r 79de32ba3296 src/network/ssl/qsslsocket_openssl_symbols.cpp --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp Fri May 14 16:40:13 2010 +0300 @@ -742,7 +742,7 @@ bool q_resolveOpenSslSymbols() { -#ifdef QT_NO_SSL +#ifdef QT_NO_OPENSSL return false; #endif return true; diff -r fcece45ef507 -r 79de32ba3296 src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp Fri May 14 16:40:13 2010 +0300 @@ -184,7 +184,7 @@ QImage texImage = qt_imageForBrush(style, false); glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); - ctx->d_func()->bindTexture(texImage, GL_TEXTURE_2D, GL_RGBA, true, QGLContext::InternalBindOption); + ctx->d_func()->bindTexture(texImage, GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption); updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, q->state()->renderHints & QPainter::SmoothPixmapTransform); } else if (style >= Qt::LinearGradientPattern && style <= Qt::ConicalGradientPattern) { diff -r fcece45ef507 -r 79de32ba3296 src/opengl/gl2paintengineex/qtriangulatingstroker.cpp --- a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp Fri May 14 16:40:13 2010 +0300 @@ -144,11 +144,17 @@ m_cos_theta = qFastCos(Q_PI / m_roundness); const qreal *endPts = pts + (count<<1); - const qreal *startPts; + const qreal *startPts = 0; Qt::PenCapStyle cap = m_cap_style; if (!types) { + // skip duplicate points + while((pts + 2) < endPts && pts[0] == pts[2] && pts[1] == pts[3]) + pts += 2; + if ((pts + 2) == endPts) + return; + startPts = pts; bool endsAtStart = startPts[0] == *(endPts-2) && startPts[1] == *(endPts-1); @@ -161,15 +167,17 @@ lineTo(pts); pts += 2; while (pts < endPts) { - join(pts); - lineTo(pts); + if (m_cx != pts[0] || m_cy != pts[1]) { + join(pts); + lineTo(pts); + } pts += 2; } endCapOrJoinClosed(startPts, pts-2, path.hasImplicitClose(), endsAtStart); } else { - bool endsAtStart; + bool endsAtStart = false; while (pts < endPts) { switch (*types) { case QPainterPath::MoveToElement: { diff -r fcece45ef507 -r 79de32ba3296 src/opengl/qglshaderprogram.cpp --- a/src/opengl/qglshaderprogram.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/opengl/qglshaderprogram.cpp Fri May 14 16:40:13 2010 +0300 @@ -969,17 +969,18 @@ Any attributes that have not been explicitly bound when the program is linked will be assigned locations automatically. + When this function is called after the program has been linked, + the program will need to be relinked for the change to take effect. + \sa attributeLocation() */ void QGLShaderProgram::bindAttributeLocation(const char *name, int location) { Q_D(QGLShaderProgram); - if (!d->linked) { - glBindAttribLocation(d->programGuard.id(), location, name); - } else { - qWarning() << "QGLShaderProgram::bindAttributeLocation(" << name - << "): cannot bind after shader program is linked"; - } + if (!init()) + return; + glBindAttribLocation(d->programGuard.id(), location, name); + d->linked = false; // Program needs to be relinked. } /*! @@ -990,6 +991,9 @@ Any attributes that have not been explicitly bound when the program is linked will be assigned locations automatically. + When this function is called after the program has been linked, + the program will need to be relinked for the change to take effect. + \sa attributeLocation() */ void QGLShaderProgram::bindAttributeLocation(const QByteArray& name, int location) @@ -1005,6 +1009,9 @@ Any attributes that have not been explicitly bound when the program is linked will be assigned locations automatically. + When this function is called after the program has been linked, + the program will need to be relinked for the change to take effect. + \sa attributeLocation() */ void QGLShaderProgram::bindAttributeLocation(const QString& name, int location) diff -r fcece45ef507 -r 79de32ba3296 src/openvg/openvg.pro --- a/src/openvg/openvg.pro Mon May 03 13:17:34 2010 +0300 +++ b/src/openvg/openvg.pro Fri May 14 16:40:13 2010 +0300 @@ -33,7 +33,7 @@ qwindowsurface_vgegl.cpp } -symbian: DEFINES += QVG_RECREATE_ON_SIZE_CHANGE QVG_SCISSOR_CLIP +symbian: DEFINES += QVG_RECREATE_ON_SIZE_CHANGE QVG_SCISSOR_CLIP QVG_BUFFER_SCROLLING include(../qbase.pri) diff -r fcece45ef507 -r 79de32ba3296 src/openvg/qpaintengine_vg.cpp --- a/src/openvg/qpaintengine_vg.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/openvg/qpaintengine_vg.cpp Fri May 14 16:40:13 2010 +0300 @@ -75,8 +75,8 @@ #if !defined(QVG_NO_DRAW_GLYPHS) -extern int qt_defaultDpiX(); -extern int qt_defaultDpiY(); +Q_DECL_IMPORT extern int qt_defaultDpiX(); +Q_DECL_IMPORT extern int qt_defaultDpiY(); class QVGPaintEnginePrivate; @@ -497,7 +497,7 @@ vgLoadMatrix(mat); } -extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); +Q_DECL_IMPORT extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); void QVGPaintEnginePrivate::updateTransform(QPaintDevice *pdev) { @@ -975,7 +975,7 @@ return vgpath; } -extern QImage qt_imageForBrush(int style, bool invert); +Q_DECL_IMPORT extern QImage qt_imageForBrush(int style, bool invert); static QImage colorizeBitmap(const QImage &image, const QColor &color) { diff -r fcece45ef507 -r 79de32ba3296 src/openvg/qpixmapdata_vg.cpp --- a/src/openvg/qpixmapdata_vg.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/openvg/qpixmapdata_vg.cpp Fri May 14 16:40:13 2010 +0300 @@ -354,8 +354,8 @@ destroyImages(); } -extern int qt_defaultDpiX(); -extern int qt_defaultDpiY(); +Q_DECL_IMPORT extern int qt_defaultDpiX(); +Q_DECL_IMPORT extern int qt_defaultDpiY(); int QVGPixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const { diff -r fcece45ef507 -r 79de32ba3296 src/openvg/qwindowsurface_vg.cpp --- a/src/openvg/qwindowsurface_vg.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/openvg/qwindowsurface_vg.cpp Fri May 14 16:40:13 2010 +0300 @@ -57,6 +57,7 @@ { // Create the default type of EGL window surface for windows. d_ptr = new QVGEGLWindowSurfaceDirect(this); + setStaticContentsSupport(d_ptr->supportsStaticContents()); } QVGWindowSurface::QVGWindowSurface @@ -89,7 +90,9 @@ bool QVGWindowSurface::scroll(const QRegion &area, int dx, int dy) { - return QWindowSurface::scroll(area, dx, dy); + if (!d_ptr->scroll(window(), area, dx, dy)) + return QWindowSurface::scroll(area, dx, dy); + return true; } void QVGWindowSurface::beginPaint(const QRegion ®ion) diff -r fcece45ef507 -r 79de32ba3296 src/openvg/qwindowsurface_vgegl.cpp --- a/src/openvg/qwindowsurface_vgegl.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/openvg/qwindowsurface_vgegl.cpp Fri May 14 16:40:13 2010 +0300 @@ -659,6 +659,7 @@ #endif windowSurface = context->createSurface(widget, &surfaceProps); isPaintingActive = false; + needToSwap = true; } #else if (context && size != newSize) { @@ -710,20 +711,21 @@ needToSwap = false; } #endif -#if !defined(QVG_NO_PRESERVED_SWAP) - // Try to force the surface back buffer to preserve its contents. - if (needToSwap) { - eglGetError(); // Clear error state first. - eglSurfaceAttrib(QEglContext::display(), surface, - EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED); - if (eglGetError() != EGL_SUCCESS) { - qWarning("QVG: could not enable preserved swap"); - } - } -#endif windowSurface = surface; isPaintingActive = false; } + +#if !defined(QVG_NO_PRESERVED_SWAP) + // Try to force the surface back buffer to preserve its contents. + if (needToSwap) { + eglGetError(); // Clear error state first. + eglSurfaceAttrib(QEglContext::display(), windowSurface, + EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED); + if (eglGetError() != EGL_SUCCESS) { + qWarning("QVG: could not enable preserved swap"); + } + } +#endif return context; } @@ -756,6 +758,33 @@ } } +bool QVGEGLWindowSurfaceDirect::supportsStaticContents() const +{ +#if defined(QVG_BUFFER_SCROLLING) && !defined(QVG_NO_PRESERVED_SWAP) + return true; +#else + return QVGEGLWindowSurfacePrivate::supportsStaticContents(); +#endif +} + +bool QVGEGLWindowSurfaceDirect::scroll(QWidget *widget, const QRegion& area, int dx, int dy) +{ +#ifdef QVG_BUFFER_SCROLLING + QEglContext *context = ensureContext(widget); + if (context) { + context->makeCurrent(windowSurface); + QRect scrollRect = area.boundingRect(); + int sx = scrollRect.x(); + int sy = size.height() - scrollRect.y() - scrollRect.height(); + vgSeti(VG_SCISSORING, VG_FALSE); + vgCopyPixels(sx + dx, sy - dy, sx, sy, scrollRect.width(), scrollRect.height()); + context->lazyDoneCurrent(); + return true; + } +#endif + return false; +} + QT_END_NAMESPACE #endif diff -r fcece45ef507 -r 79de32ba3296 src/openvg/qwindowsurface_vgegl_p.h --- a/src/openvg/qwindowsurface_vgegl_p.h Mon May 03 13:17:34 2010 +0300 +++ b/src/openvg/qwindowsurface_vgegl_p.h Fri May 14 16:40:13 2010 +0300 @@ -77,6 +77,8 @@ (QWidget *widget, const QRegion& region, QImage *image = 0) = 0; virtual VGImage surfaceImage() const; virtual QSize surfaceSize() const = 0; + virtual bool supportsStaticContents() const { return false; } + virtual bool scroll(QWidget *, const QRegion&, int, int) { return false; } private: QVGPaintEngine *engine; @@ -128,6 +130,8 @@ void beginPaint(QWidget *widget); void endPaint(QWidget *widget, const QRegion& region, QImage *image); QSize surfaceSize() const { return size; } + bool supportsStaticContents() const; + bool scroll(QWidget *widget, const QRegion& area, int dx, int dy); protected: QEglContext *context; diff -r fcece45ef507 -r 79de32ba3296 src/plugins/accessible/widgets/complexwidgets.cpp --- a/src/plugins/accessible/widgets/complexwidgets.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/plugins/accessible/widgets/complexwidgets.cpp Fri May 14 16:40:13 2010 +0300 @@ -724,7 +724,8 @@ if (start.isValid()) { m_current = start; } else if (m_view && m_view->model()) { - m_current = view->model()->index(0, 0); + m_current = view->rootIndex().isValid() ? + view->rootIndex().child(0,0) : view->model()->index(0, 0); } } diff -r fcece45ef507 -r 79de32ba3296 src/s60installs/bwins/QtCoreu.def --- a/src/s60installs/bwins/QtCoreu.def Mon May 03 13:17:34 2010 +0300 +++ b/src/s60installs/bwins/QtCoreu.def Fri May 14 16:40:13 2010 +0300 @@ -4417,4 +4417,6 @@ ?QBasicAtomicInt_testAndSetRelease@@YA_NPCHHH@Z @ 4416 NONAME ; bool QBasicAtomicInt_testAndSetRelease(int volatile *, int, int) ?QBasicAtomicInt_fetchAndStoreAcquire@@YAHPCHH@Z @ 4417 NONAME ; int QBasicAtomicInt_fetchAndStoreAcquire(int volatile *, int) ?QBasicAtomicInt_fetchAndAddAcquire@@YAHPCHH@Z @ 4418 NONAME ; int QBasicAtomicInt_fetchAndAddAcquire(int volatile *, int) + ?validCodecs@QTextCodec@@CA_NXZ @ 4419 NONAME ; bool QTextCodec::validCodecs(void) + ?clearHistory@QStateMachinePrivate@@QAEXXZ @ 4420 NONAME ; void QStateMachinePrivate::clearHistory(void) diff -r fcece45ef507 -r 79de32ba3296 src/s60installs/bwins/QtGuiu.def --- a/src/s60installs/bwins/QtGuiu.def Mon May 03 13:17:34 2010 +0300 +++ b/src/s60installs/bwins/QtGuiu.def Fri May 14 16:40:13 2010 +0300 @@ -12602,10 +12602,10 @@ ?currentContext@QEglContext@@CAPAV1@W4API@QEgl@@@Z @ 12601 NONAME ; class QEglContext * QEglContext::currentContext(enum QEgl::API) ?errorString@QEglContext@@SA?AVQString@@H@Z @ 12602 NONAME ; class QString QEglContext::errorString(int) ?removeAllApplicationFonts@QFontDatabase@@SA_NXZ @ 12603 NONAME ; NONAME ; bool QFontDatabase::removeAllApplicationFonts() - ?setWidth@QGraphicsItemPrivate@@UAEXM@Z @ 12604 NONAME ; void QGraphicsItemPrivate::setWidth(float) - ?setHeight@QGraphicsItemPrivate@@UAEXM@Z @ 12605 NONAME ; void QGraphicsItemPrivate::setHeight(float) - ?height@QGraphicsItemPrivate@@UBEMXZ @ 12606 NONAME ; float QGraphicsItemPrivate::height(void) const - ?width@QGraphicsItemPrivate@@UBEMXZ @ 12607 NONAME ; float QGraphicsItemPrivate::width(void) const - ?resetHeight@QGraphicsItemPrivate@@UAEXXZ @ 12608 NONAME ; void QGraphicsItemPrivate::resetHeight(void) - ?resetWidth@QGraphicsItemPrivate@@UAEXXZ @ 12609 NONAME ; void QGraphicsItemPrivate::resetWidth(void) + ?setWidth@QGraphicsItemPrivate@@UAEXM@Z @ 12604 NONAME ABSENT ; void QGraphicsItemPrivate::setWidth(float) + ?setHeight@QGraphicsItemPrivate@@UAEXM@Z @ 12605 NONAME ABSENT ; void QGraphicsItemPrivate::setHeight(float) + ?height@QGraphicsItemPrivate@@UBEMXZ @ 12606 NONAME ABSENT ; float QGraphicsItemPrivate::height(void) const + ?width@QGraphicsItemPrivate@@UBEMXZ @ 12607 NONAME ABSENT ; float QGraphicsItemPrivate::width(void) const + ?resetHeight@QGraphicsItemPrivate@@UAEXXZ @ 12608 NONAME ABSENT ; void QGraphicsItemPrivate::resetHeight(void) + ?resetWidth@QGraphicsItemPrivate@@UAEXXZ @ 12609 NONAME ABSENT ; void QGraphicsItemPrivate::resetWidth(void) diff -r fcece45ef507 -r 79de32ba3296 src/s60installs/bwins/QtNetworku.def --- a/src/s60installs/bwins/QtNetworku.def Mon May 03 13:17:34 2010 +0300 +++ b/src/s60installs/bwins/QtNetworku.def Fri May 14 16:40:13 2010 +0300 @@ -962,4 +962,6 @@ ?staticMetaObject@QTcpServer@@2UQMetaObject@@B @ 961 NONAME ; struct QMetaObject const QTcpServer::staticMetaObject ?staticMetaObject@QUdpSocket@@2UQMetaObject@@B @ 962 NONAME ; struct QMetaObject const QUdpSocket::staticMetaObject ?staticMetaObject@QAbstractSocket@@2UQMetaObject@@B @ 963 NONAME ; struct QMetaObject const QAbstractSocket::staticMetaObject + ?qt_qhostinfo_clear_cache@@YAXXZ @ 964 NONAME ; void qt_qhostinfo_clear_cache(void) + ?qt_qhostinfo_lookup@@YA?AVQHostInfo@@ABVQString@@PAVQObject@@PBDPA_NPAH@Z @ 965 NONAME ; class QHostInfo qt_qhostinfo_lookup(class QString const &, class QObject *, char const *, bool *, int *) diff -r fcece45ef507 -r 79de32ba3296 src/s60installs/bwins/QtOpenVGu.def --- a/src/s60installs/bwins/QtOpenVGu.def Mon May 03 13:17:34 2010 +0300 +++ b/src/s60installs/bwins/QtOpenVGu.def Fri May 14 16:40:13 2010 +0300 @@ -164,4 +164,8 @@ ?qt_vg_create_context@@YAPAVQEglContext@@PAVQPaintDevice@@H@Z @ 163 NONAME ; class QEglContext * qt_vg_create_context(class QPaintDevice *, int) ?reclaimImages@QVGPixmapData@@UAEXXZ @ 164 NONAME ; void QVGPixmapData::reclaimImages(void) ?hibernate@QVGPixmapData@@UAEXXZ @ 165 NONAME ; void QVGPixmapData::hibernate(void) + ?supportsStaticContents@QVGEGLWindowSurfaceDirect@@UBE_NXZ @ 166 NONAME ; bool QVGEGLWindowSurfaceDirect::supportsStaticContents(void) const + ?scroll@QVGEGLWindowSurfacePrivate@@UAE_NPAVQWidget@@ABVQRegion@@HH@Z @ 167 NONAME ; bool QVGEGLWindowSurfacePrivate::scroll(class QWidget *, class QRegion const &, int, int) + ?scroll@QVGEGLWindowSurfaceDirect@@UAE_NPAVQWidget@@ABVQRegion@@HH@Z @ 168 NONAME ; bool QVGEGLWindowSurfaceDirect::scroll(class QWidget *, class QRegion const &, int, int) + ?supportsStaticContents@QVGEGLWindowSurfacePrivate@@UBE_NXZ @ 169 NONAME ; bool QVGEGLWindowSurfacePrivate::supportsStaticContents(void) const diff -r fcece45ef507 -r 79de32ba3296 src/s60installs/deviceconfiguration/bld.inf --- a/src/s60installs/deviceconfiguration/bld.inf Mon May 03 13:17:34 2010 +0300 +++ b/src/s60installs/deviceconfiguration/bld.inf Fri May 14 16:40:13 2010 +0300 @@ -31,15 +31,8 @@ wrappers/qmake_abld.bat /epoc32/tools/qmake.bat wrappers/qmake_abld /epoc32/tools/qmake #endif -wrappers/moc.bat /epoc32/tools/moc.bat -wrappers/moc /epoc32/tools/moc -wrappers/rcc.bat /epoc32/tools/rcc.bat -wrappers/rcc /epoc32/tools/rcc -wrappers/uic.bat /epoc32/tools/uic.bat -wrappers/uic /epoc32/tools/uic + wrappers/qt.conf /epoc32/tools/qt/qt.conf -wrappers/lrelease.bat /epoc32/tools/lrelease.bat -wrappers/lrelease /epoc32/tools/lrelease /* export platform specific configuration */ @@ -73,5 +66,5 @@ PRJ_EXTENSIONS START EXTENSION qt/qtconfig OPTION QT_ROOT .. -OPTION OPTIONS -opensource -confirm-license -openvg -script -no-scripttools -webkit -make make -graphicssystem openvg -no-phonon-backend -usedeffiles -dont-process +OPTION OPTIONS -opensource -confirm-license -openvg -script -no-scripttools -webkit -make make -graphicssystem openvg -no-phonon-backend -usedeffiles -dont-process -nomake examples -nomake demos -nomake tools END diff -r fcece45ef507 -r 79de32ba3296 src/s60installs/deviceconfiguration/qtconfig.flm --- a/src/s60installs/deviceconfiguration/qtconfig.flm Mon May 03 13:17:34 2010 +0300 +++ b/src/s60installs/deviceconfiguration/qtconfig.flm Fri May 14 16:40:13 2010 +0300 @@ -9,6 +9,8 @@ QT_ROOT:=../../.. TARGETDIR:=$(EPOCROOT)/$(INSTALLPATH) +QMAKEDIR:=$(EPOCROOT)/$(INSTALLPATH)/qt +MKSPECDIR:=$(EPOCROOT)/$(INSTALLPATH)/qt SOURCEDIR:=$(EXTENSION_ROOT)/$(QT_ROOT)/bin TOOLSSRCDIR:=$(EXTENSION_ROOT)/$(QT_ROOT)/src/tools LANGUAGETOOLSDIR:=$(EXTENSION_ROOT)/$(QT_ROOT)/tools/linguist @@ -16,7 +18,7 @@ $(call makepath,$(TARGETDIR)) -ifeq ($(OSTYPE),unix) +ifneq ($(filter linux,$(HOSTPLATFORM)),) PLATFORM:=$(PLATFORM.LINUX) ifeq ($(XPLATFORM), symbian-sbsv2) CONFIGURE_APP:=configure_symbian @@ -25,12 +27,12 @@ PLATFORM:=$(PLATFORM.WIN32) endif -TARGET_TOOLS:=$(TARGETDIR)/qmake$(DOTEXE) $(TARGETDIR)/moc$(DOTEXE) $(TARGETDIR)/rcc$(DOTEXE) $(TARGETDIR)/uic$(DOTEXE) $(TARGETDIR)/lrelease$(DOTEXE) +TARGET_TOOLS:=$(QMAKEDIR)/qmake$(DOTEXE) $(TARGETDIR)/moc$(DOTEXE) $(TARGETDIR)/rcc$(DOTEXE) $(TARGETDIR)/uic$(DOTEXE) $(TARGETDIR)/lrelease$(DOTEXE) QT_TOOLS:= $(TOOLSSRCDIR)/uic $(TOOLSSRCDIR)/moc $(TOOLSSRCDIR)/rcc $(LANGUAGETOOLSDIR)/lrelease SOURCE_TOOLS:=$(SOURCEDIR)/qmake$(DOTEXE) $(SOURCEDIR)/moc$(DOTEXE) $(SOURCEDIR)/rcc$(DOTEXE) $(SOURCEDIR)/uic$(DOTEXE) $(SOURCEDIR)/lrelease$(DOTEXE) define QtConfiguration -ifeq ($(OSTYPE),unix) +ifneq ($(filter linux,$(HOSTPLATFORM)),) $(TARGET_TOOLS): $(QT_TOOLS) else $(TARGET_TOOLS): $(SOURCEDIR)/qmake$(DOTEXE) @@ -39,7 +41,7 @@ $(GNUCP) $(SOURCEDIR)/$$(notdir $$@) $$@ \ $(call endrule,qtconf_deploy) -ifeq ($(OSTYPE),unix) +ifneq ($(filter linux,$(HOSTPLATFORM)),) $(QT_TOOLS): $(TOOLSSRCDIR)/bootstrap $(call startrule,qtconf_tools_build) \ cd $$@; \ @@ -65,7 +67,7 @@ perl syncqt -base-dir $(EXTENSION_ROOT)/$(QT_ROOT) -copy -oneway -outdir $(EPOCROOT)/epoc32/include/ -outsubdir mw $(call endrule,syncqt) $(call startrule,mkspecexport) \ - $(GNUCP) -R $(EXTENSION_ROOT)/$(QT_ROOT)/mkspecs $(TARGETDIR) + $(GNUCP) -R $(EXTENSION_ROOT)/$(QT_ROOT)/mkspecs $(MKSPECDIR) $(call endrule,mkspecexport) endef @@ -75,7 +77,7 @@ # UREL and UDEB do not execute makesis twice on the same target ifeq ($($(GUARD)),) $(GUARD):=1 -ifeq ($(OSTYPE),unix) +ifneq ($(filter linux,$(HOSTPLATFORM)),) ALL:: $(QT_TOOLS) $(TARGET_TOOLS) else ALL:: $(TARGET_TOOLS) diff -r fcece45ef507 -r 79de32ba3296 src/s60installs/deviceconfiguration/qtconfig.mk --- a/src/s60installs/deviceconfiguration/qtconfig.mk Mon May 03 13:17:34 2010 +0300 +++ b/src/s60installs/deviceconfiguration/qtconfig.mk Fri May 14 16:40:13 2010 +0300 @@ -6,7 +6,9 @@ EPOC_ROOT := $(subst \,/,$(EPOCROOT)) QT_ROOT := $(subst src/s60installs/deviceconfiguration,,$(subst \,/,$(EXTENSION_ROOT))) -INSTALLPATH := epoc32/tools/qt/ +QMAKEPATH := epoc32/tools/qt/ +INSTALLTOOLSPATH := epoc32/tools/ +MKSPECPATH := epoc32/tools/qt/ # Determine which platform we are building on ifeq ($(OSTYPE),unix) @@ -23,8 +25,8 @@ TARGETDIR := $(EPOC_ROOT)$(INSTALLPATH) SOURCEDIR := $(QT_ROOT)bin/ -TARGET_TOOLS := $(TARGETDIR)qmake$(DOTEXE) $(TARGETDIR)moc$(DOTEXE) $(TARGETDIR)rcc$(DOTEXE) $(TARGETDIR)uic$(DOTEXE) $(TARGETDIR)/lrelease$(DOTEXE) -SOURCE_TOOLS := $(SOURCEDIR)qmake$(DOTEXE) $(SOURCEDIR)moc$(DOTEXE) $(SOURCEDIR)rcc$(DOTEXE) $(SOURCEDIR)uic$(DOTEXE) $(SOURCEDIR)/lrelease$(DOTEXE) +TARGET_TOOLS := $(EPOC_ROOT)$(QMAKEPATH)qmake$(DOTEXE) $(TARGETDIR)moc$(DOTEXE) $(TARGETDIR)rcc$(DOTEXE) $(TARGETDIR)uic$(DOTEXE) +SOURCE_TOOLS := $(SOURCEDIR)qmake$(DOTEXE) $(SOURCEDIR)moc$(DOTEXE) $(SOURCEDIR)rcc$(DOTEXE) $(SOURCEDIR)uic$(DOTEXE) XPLATFORM:=symbian-abld diff -r fcece45ef507 -r 79de32ba3296 src/s60installs/deviceconfiguration/qtconfig.xml --- a/src/s60installs/deviceconfiguration/qtconfig.xml Mon May 03 13:17:34 2010 +0300 +++ b/src/s60installs/deviceconfiguration/qtconfig.xml Fri May 14 16:40:13 2010 +0300 @@ -7,7 +7,7 @@ - + diff -r fcece45ef507 -r 79de32ba3296 src/s60installs/deviceconfiguration/wrappers/lrelease --- a/src/s60installs/deviceconfiguration/wrappers/lrelease Mon May 03 13:17:34 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. - -PRGDIR=`dirname "$0"` -PRGDIR=`cd "$PRGDIR"; pwd` - -[ -z "$QMAKESPEC" ] && export QMAKESPEC=$PRGDIR/qt/mkspecs/symbian-sbsv2 - -"$PRGDIR/qt/lrelease" "$@" diff -r fcece45ef507 -r 79de32ba3296 src/s60installs/deviceconfiguration/wrappers/lrelease.bat --- a/src/s60installs/deviceconfiguration/wrappers/lrelease.bat Mon May 03 13:17:34 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -@REM Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -@REM All rights reserved. - -@ECHO OFF -SETLOCAL - -SET __PRG__=%~dp0qt/lrelease.exe - -IF DEFINED QMAKESPEC GOTO :mkspec_set -SET QMAKESPEC=%~dp0qt/mkspecs/symbian-abld - -:mkspec_set -REM The following line can be used to enable qmake.cache -REM %__PRG__% -cache %~dp0qt\qmake.cache %* - -"%__PRG__%" %* diff -r fcece45ef507 -r 79de32ba3296 src/s60installs/deviceconfiguration/wrappers/moc --- a/src/s60installs/deviceconfiguration/wrappers/moc Mon May 03 13:17:34 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. - -PRGDIR=`dirname "$0"` -PRGDIR=`cd "$PRGDIR"; pwd` - -[ -z "$QMAKESPEC" ] && export QMAKESPEC=$PRGDIR/qt/mkspecs/symbian-sbsv2 - -"$PRGDIR/qt/moc" "$@" diff -r fcece45ef507 -r 79de32ba3296 src/s60installs/deviceconfiguration/wrappers/moc.bat --- a/src/s60installs/deviceconfiguration/wrappers/moc.bat Mon May 03 13:17:34 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -@REM Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -@REM All rights reserved. - -@ECHO OFF -SETLOCAL - -SET __PRG__=%~dp0qt\moc.exe - -IF DEFINED QMAKESPEC GOTO :mkspec_set -SET QMAKESPEC=%~dp0qt\mkspecs\symbian-sbsv2 - -:mkspec_set -"%__PRG__%" %* diff -r fcece45ef507 -r 79de32ba3296 src/s60installs/deviceconfiguration/wrappers/rcc --- a/src/s60installs/deviceconfiguration/wrappers/rcc Mon May 03 13:17:34 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. - -PRGDIR=`dirname "$0"` -PRGDIR=`cd "$PRGDIR"; pwd` - -[ -z "$QMAKESPEC" ] && export QMAKESPEC=$PRGDIR/qt/mkspecs/symbian-sbsv2 - -"$PRGDIR/qt/rcc" "$@" diff -r fcece45ef507 -r 79de32ba3296 src/s60installs/deviceconfiguration/wrappers/rcc.bat --- a/src/s60installs/deviceconfiguration/wrappers/rcc.bat Mon May 03 13:17:34 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -@REM Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -@REM All rights reserved. - -@ECHO OFF -SETLOCAL - -SET __PRG__=%~dp0qt\rcc.exe - -IF DEFINED QMAKESPEC GOTO :mkspec_set -SET QMAKESPEC=%~dp0qt\mkspecs\symbian-sbsv2 - -:mkspec_set -"%__PRG__%" %* diff -r fcece45ef507 -r 79de32ba3296 src/s60installs/deviceconfiguration/wrappers/uic --- a/src/s60installs/deviceconfiguration/wrappers/uic Mon May 03 13:17:34 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. - -PRGDIR=`dirname "$0"` -PRGDIR=`cd "$PRGDIR"; pwd` - -[ -z "$QMAKESPEC" ] && export QMAKESPEC=$PRGDIR/qt/mkspecs/symbian-sbsv2 - -"$PRGDIR/qt/uic" "$@" diff -r fcece45ef507 -r 79de32ba3296 src/s60installs/deviceconfiguration/wrappers/uic.bat --- a/src/s60installs/deviceconfiguration/wrappers/uic.bat Mon May 03 13:17:34 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -@REM Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -@REM All rights reserved. - -@ECHO OFF -SETLOCAL - -SET __PRG__=%~dp0qt\uic.exe - -IF DEFINED QMAKESPEC GOTO :mkspec_set -SET QMAKESPEC=%~dp0qt\mkspecs\symbian-sbsv2 - -:mkspec_set -"%__PRG__%" %* diff -r fcece45ef507 -r 79de32ba3296 src/s60installs/eabi/QtGuiu.def --- a/src/s60installs/eabi/QtGuiu.def Mon May 03 13:17:34 2010 +0300 +++ b/src/s60installs/eabi/QtGuiu.def Fri May 14 16:40:13 2010 +0300 @@ -11807,9 +11807,10 @@ _ZN9QS60Style11eventFilterEP7QObjectP6QEvent @ 11806 NONAME _ZN13QFontDatabase25removeAllApplicationFontsEv @ 11807 NONAME _ZN11QEglContext7displayEv @ 11808 NONAME - _ZN20QGraphicsItemPrivate10resetWidthEv @ 11809 NONAME - _ZN20QGraphicsItemPrivate11resetHeightEv @ 11810 NONAME - _ZN20QGraphicsItemPrivate8setWidthEf @ 11811 NONAME - _ZN20QGraphicsItemPrivate9setHeightEf @ 11812 NONAME - _ZNK20QGraphicsItemPrivate5widthEv @ 11813 NONAME - _ZNK20QGraphicsItemPrivate6heightEv @ 11814 NONAME + _ZN20QGraphicsItemPrivate10resetWidthEv @ 11809 NONAME ABSENT + _ZN20QGraphicsItemPrivate11resetHeightEv @ 11810 NONAME ABSENT + _ZN20QGraphicsItemPrivate8setWidthEf @ 11811 NONAME ABSENT + _ZN20QGraphicsItemPrivate9setHeightEf @ 11812 NONAME ABSENT + _ZNK20QGraphicsItemPrivate5widthEv @ 11813 NONAME ABSENT + _ZNK20QGraphicsItemPrivate6heightEv @ 11814 NONAME ABSENT + diff -r fcece45ef507 -r 79de32ba3296 src/s60installs/qt.iby --- a/src/s60installs/qt.iby Mon May 03 13:17:34 2010 +0300 +++ b/src/s60installs/qt.iby Fri May 14 16:40:13 2010 +0300 @@ -19,7 +19,6 @@ file=ABI_DIR\BUILD_DIR\phonon.dll SHARED_LIB_DIR\phonon.dll file=ABI_DIR\BUILD_DIR\QtMultimedia.dll SHARED_LIB_DIR\QtMultimedia.dll file=ABI_DIR\BUILD_DIR\QtXmlPatterns.dll SHARED_LIB_DIR\QtXmlPatterns.dll -file=ABI_DIR\BUILD_DIR\QtDeclarative.dll SHARED_LIB_DIR\QtDeclarative.dll // imageformats file=ABI_DIR\BUILD_DIR\qgif.dll SHARED_LIB_DIR\qgif.dll diff -r fcece45ef507 -r 79de32ba3296 src/s60installs/qt_nonNR.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/s60installs/qt_nonNR.pkg Fri May 14 16:40:13 2010 +0300 @@ -0,0 +1,71 @@ +; Language +&EN + +; SIS header: name, uid, version +#{"Qt"},(0x2001E61C),4,6,3,TYPE=SA,RU + +; Manual PKG pre-rules from PRO files +; Default HW/platform dependencies +[0x101F7961],0,0,0,{"S60ProductID"} +[0x102032BE],0,0,0,{"S60ProductID"} +[0x102752AE],0,0,0,{"S60ProductID"} +[0x1028315F],0,0,0,{"S60ProductID"} + +; Localised Vendor name +%{"Nokia, Qt"} + +; Unique Vendor name +:"Nokia, Qt" + +; Dependencies of Qt libraries + +; DEPLOYMENT +"/epoc32/data/z/resource/apps/s60main.rsc" - "!:\resource\apps\s60main.rsc" +"/epoc32/release/armv5/urel/QtCore.dll" - "!:\sys\bin\QtCore.dll" +"/epoc32/release/armv5/urel/QtXml.dll" - "!:\sys\bin\QtXml.dll" +"/epoc32/release/armv5/urel/QtGui.dll" - "!:\sys\bin\QtGui.dll" +"/epoc32/release/armv5/urel/QtNetwork.dll" - "!:\sys\bin\QtNetwork.dll" +"/epoc32/release/armv5/urel/QtTest.dll" - "!:\sys\bin\QtTest.dll" +"/epoc32/release/armv5/urel/QtSql.dll" - "!:\sys\bin\QtSql.dll" +"/epoc32/release/armv5/urel/QtSvg.dll" - "!:\sys\bin\QtSvg.dll" +"/epoc32/release/armv5/urel/phonon.dll" - "!:\sys\bin\phonon.dll" +"/epoc32/release/armv5/urel/QtScript.dll" - "!:\sys\bin\QtScript.dll" +"/epoc32/release/armv5/urel/QtXmlPatterns.dll" - "!:\sys\bin\QtXmlPatterns.dll" +"/epoc32/release/armv5/urel/QtOpenVG.dll" - "!:\sys\bin\QtOpenVG.dll" +"/epoc32/release/armv5/urel/QtMultimedia.dll" - "!:\sys\bin\QtMultimedia.dll" + +"/epoc32/release/armv5/urel/qjpeg.dll" - "!:\sys\bin\qjpeg.dll" +"/sf/mw/qt/src/s60installs/qmakepluginstubs/qjpeg.qtplugin" - "!:\resource\qt\plugins\imageformats\qjpeg.qtplugin" +"/epoc32/release/armv5/urel/qgif.dll" - "!:\sys\bin\qgif.dll" +"/sf/mw/qt/src/s60installs/qmakepluginstubs/qgif.qtplugin" - "!:\resource\qt\plugins\imageformats\qgif.qtplugin" +"/epoc32/release/armv5/urel/qmng.dll" - "!:\sys\bin\qmng.dll" +"/sf/mw/qt/src/s60installs/qmakepluginstubs/qmng.qtplugin" - "!:\resource\qt\plugins\imageformats\qmng.qtplugin" +"/epoc32/release/armv5/urel/qtiff.dll" - "!:\sys\bin\qtiff.dll" +"/sf/mw/qt/src/s60installs/qmakepluginstubs/qtiff.qtplugin" - "!:\resource\qt\plugins\imageformats\qtiff.qtplugin" +"/epoc32/release/armv5/urel/qico.dll" - "!:\sys\bin\qico.dll" +"/sf/mw/qt/src/s60installs/qmakepluginstubs/qico.qtplugin" - "!:\resource\qt\plugins\imageformats\qico.qtplugin" +"/epoc32/release/armv5/urel/qsvg.dll" - "!:\sys\bin\qsvg.dll" +"/sf/mw/qt/src/s60installs/qmakepluginstubs/qsvg.qtplugin" - "!:\resource\qt\plugins\imageformats\qsvg.qtplugin" +"/epoc32/release/armv5/urel/qcncodecs.dll" - "!:\sys\bin\qcncodecs.dll" +"/sf/mw/qt/src/s60installs/qmakepluginstubs/qcncodecs.qtplugin" - "!:\resource\qt\plugins\codecs\qcncodecs.qtplugin" +"/epoc32/release/armv5/urel/qjpcodecs.dll" - "!:\sys\bin\qjpcodecs.dll" +"/sf/mw/qt/src/s60installs/qmakepluginstubs/qjpcodecs.qtplugin" - "!:\resource\qt\plugins\codecs\qjpcodecs.qtplugin" +"/epoc32/release/armv5/urel/qtwcodecs.dll" - "!:\sys\bin\qtwcodecs.dll" +"/sf/mw/qt/src/s60installs/qmakepluginstubs/qtwcodecs.qtplugin" - "!:\resource\qt\plugins\codecs\qtwcodecs.qtplugin" +"/epoc32/release/armv5/urel/qkrcodecs.dll" - "!:\sys\bin\qkrcodecs.dll" +"/sf/mw/qt/src/s60installs/qmakepluginstubs/qkrcodecs.qtplugin" - "!:\resource\qt\plugins\codecs\qkrcodecs.qtplugin" +"/epoc32/release/armv5/urel/qvggraphicssystem.dll" - "!:\sys\bin\qvggraphicssystem.dll" +"/sf/mw/qt/src/s60installs/qmakepluginstubs/qvggraphicssystem.qtplugin" - "!:\resource\qt\plugins\graphicssystems\qvggraphicssystem.qtplugin" +"/epoc32/release/armv5/urel/qsvgicon.dll" - "!:\sys\bin\qsvgicon.dll" +"/sf/mw/qt/src/s60installs/qmakepluginstubs/qsvgicon.qtplugin" - "!:\resource\qt\plugins\iconengines\qsvgicon.qtplugin" + +; Manual PKG post-rules from PRO files +IF package(0x1028315F) + "/epoc32/release/armv5/urel/qts60plugin_5_0.dll" - "!:\sys\bin\qts60plugin_5_0.dll" +ELSEIF package(0x102752AE) + "/epoc32/release/armv5/urel/qts60plugin_3_2.dll" - "!:\sys\bin\qts60plugin_3_2.dll" +ELSEIF package(0x102032BE) + "/epoc32/release/armv5/urel/qts60plugin_3_1.dll" - "!:\sys\bin\qts60plugin_3_1.dll" +ELSE + "/epoc32/release/armv5/urel/qts60plugin_5_0.dll" - "!:\sys\bin\qts60plugin_5_0.dll" +ENDIF diff -r fcece45ef507 -r 79de32ba3296 src/s60installs/qtwebkit_nonNR.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/s60installs/qtwebkit_nonNR.pkg Fri May 14 16:40:13 2010 +0300 @@ -0,0 +1,28 @@ +; Language +&EN + +; SIS header: name, uid, version +#{"QtWebKit"},(0x200267C2),4,6,3,TYPE=SA,RU + + +; Manual PKG pre-rules from PRO files +; Default HW/platform dependencies +[0x101F7961],0,0,0,{"S60ProductID"} +[0x102032BE],0,0,0,{"S60ProductID"} +[0x102752AE],0,0,0,{"S60ProductID"} +[0x1028315F],0,0,0,{"S60ProductID"} + +; Default dependency to Qt libraries +(0x2001E61C), 4, 6, 3, {"Qt"} +; Localised Vendor name +%{"Nokia, Qt"} + +; Unique Vendor name +:"Nokia, Qt" + + +; DEPLOYMENT +"/epoc32/release/armv5/urel/QtWebKit.dll" - "!:\sys\bin\QtWebKit.dll" + +; Manual PKG post-rules from PRO files + diff -r fcece45ef507 -r 79de32ba3296 src/s60installs/s60installs.pro --- a/src/s60installs/s60installs.pro Mon May 03 13:17:34 2010 +0300 +++ b/src/s60installs/s60installs.pro Fri May 14 16:40:13 2010 +0300 @@ -64,17 +64,14 @@ qtlibraries.pkg_prerules = vendorinfo qtlibraries.pkg_prerules += "; Dependencies of Qt libraries" - - # Comment the following dependencies out because it is not needed in MCL - - #qtlibraries.pkg_prerules += "(0x20013851), 1, 5, 1, {\"PIPS Installer\"}" - #contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked) { - # qtlibraries.pkg_prerules += "(0x200110CB), 1, 5, 1, {\"Open C LIBSSL Common\"}" - #} - #contains(CONFIG, stl) { - # qtlibraries.pkg_prerules += "(0x2000F866), 1, 0, 0, {\"Standard C++ Library Common\"}" - #} - #qtlibraries.pkg_prerules += "(0x2002af5f), 0, 5, 0, {\"sqlite3\"}" + qtlibraries.pkg_prerules += "(0x20013851), 1, 5, 1, {\"PIPS Installer\"}" + contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked) { + qtlibraries.pkg_prerules += "(0x200110CB), 1, 5, 1, {\"Open C LIBSSL Common\"}" + } + contains(CONFIG, stl) { + qtlibraries.pkg_prerules += "(0x2000F866), 1, 0, 0, {\"Standard C++ Library Common\"}" + } + qtlibraries.pkg_prerules += "(0x2002af5f), 0, 5, 0, {\"sqlite3\"}" !contains(QT_CONFIG, no-jpeg): imageformats_plugins.sources += qjpeg$${QT_LIBINFIX}.dll !contains(QT_CONFIG, no-gif): imageformats_plugins.sources += qgif$${QT_LIBINFIX}.dll diff -r fcece45ef507 -r 79de32ba3296 src/script/api/qscriptengine.cpp --- a/src/script/api/qscriptengine.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/script/api/qscriptengine.cpp Fri May 14 16:40:13 2010 +0300 @@ -41,6 +41,7 @@ #include #include +#include "CodeBlock.h" #include "Error.h" #include "JSArray.h" #include "JSLock.h" @@ -662,7 +663,7 @@ else if (encStr == QLatin1String("UnicodeUTF8")) encoding = QCoreApplication::UnicodeUTF8; else - return JSC::throwError(exec, JSC::GeneralError, QString::fromLatin1("qsTranslate(): invalid encoding '%s'").arg(encStr)); + return JSC::throwError(exec, JSC::GeneralError, QString::fromLatin1("qsTranslate(): invalid encoding '%0'").arg(encStr)); } int n = -1; if (args.size() > 4) @@ -696,12 +697,21 @@ if ((args.size() > 1) && !args.at(1).isString()) return JSC::throwError(exec, JSC::GeneralError, "qsTr(): second argument (comment) must be a string"); if ((args.size() > 2) && !args.at(2).isNumber()) - return JSC::throwError(exec, JSC::GeneralError, "qsTranslate(): third argument (n) must be a number"); + return JSC::throwError(exec, JSC::GeneralError, "qsTr(): third argument (n) must be a number"); #ifndef QT_NO_QOBJECT QString context; - QScriptContext *ctx = QScriptEnginePrivate::contextForFrame(exec); - if (ctx && ctx->parentContext()) - context = QFileInfo(QScriptContextInfo(ctx->parentContext()).fileName()).baseName(); + // The first non-empty source URL in the call stack determines the translation context. + { + JSC::ExecState *frame = exec->removeHostCallFrameFlag(); + while (frame) { + if (frame->codeBlock() && frame->codeBlock()->source() + && !frame->codeBlock()->source()->url().isEmpty()) { + context = QFileInfo(frame->codeBlock()->source()->url()).baseName(); + break; + } + frame = frame->callerFrame()->removeHostCallFrameFlag(); + } + } #endif QString text(args.at(0).toString(exec)); #ifndef QT_NO_QOBJECT @@ -1007,11 +1017,15 @@ if (object == globalObject()) return; QScript::GlobalObject *glob = static_cast(originalGlobalObject()); - if (object == originalGlobalObjectProxy) + if (object == originalGlobalObjectProxy) { glob->customGlobalObject = 0; - else { + // Sync the internal prototype, since JSObject::prototype() is not virtual. + glob->setPrototype(originalGlobalObjectProxy->prototype()); + } else { Q_ASSERT(object != originalGlobalObject()); glob->customGlobalObject = object; + // Sync the internal prototype, since JSObject::prototype() is not virtual. + glob->setPrototype(object->prototype()); } } @@ -1589,7 +1603,7 @@ #ifndef QT_NO_REGEXP -extern QString qt_regexp_toCanonical(const QString &, QRegExp::PatternSyntax); +Q_DECL_IMPORT extern QString qt_regexp_toCanonical(const QString &, QRegExp::PatternSyntax); /*! Creates a QtScript object of class RegExp with the given @@ -2925,7 +2939,7 @@ // unsigned attribs = JSC::DontEnum; JSC::asObject(jscObject)->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 5, JSC::Identifier(exec, "qsTranslate"), QScript::functionQsTranslate)); JSC::asObject(jscObject)->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 2, JSC::Identifier(exec, "QT_TRANSLATE_NOOP"), QScript::functionQsTranslateNoOp)); - JSC::asObject(jscObject)->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 3, JSC::Identifier(exec, "qsTr"), QScript::functionQsTr)); + JSC::asObject(jscObject)->putDirectFunction(exec, new (exec)JSC::PrototypeFunction(exec, glob->prototypeFunctionStructure(), 3, JSC::Identifier(exec, "qsTr"), QScript::functionQsTr)); JSC::asObject(jscObject)->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 1, JSC::Identifier(exec, "QT_TR_NOOP"), QScript::functionQsTrNoOp)); glob->stringPrototype()->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 1, JSC::Identifier(exec, "arg"), QScript::stringProtoFuncArg)); diff -r fcece45ef507 -r 79de32ba3296 src/script/api/qscriptvalue.cpp --- a/src/script/api/qscriptvalue.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/script/api/qscriptvalue.cpp Fri May 14 16:40:13 2010 +0300 @@ -792,19 +792,28 @@ "a different engine"); return; } + JSC::JSObject *thisObject = JSC::asObject(d->jscValue); JSC::JSValue other = d->engine->scriptValueToJSCValue(prototype); // check for cycle JSC::JSValue nextPrototypeValue = other; while (nextPrototypeValue && nextPrototypeValue.isObject()) { JSC::JSObject *nextPrototype = JSC::asObject(nextPrototypeValue); - if (nextPrototype == JSC::asObject(d->jscValue)) { + if (nextPrototype == thisObject) { qWarning("QScriptValue::setPrototype() failed: cyclic prototype value"); return; } nextPrototypeValue = nextPrototype->prototype(); } - JSC::asObject(d->jscValue)->setPrototype(other); + + thisObject->setPrototype(other); + + // Sync the internal Global Object prototype if appropriate. + if (((thisObject == d->engine->originalGlobalObjectProxy) + && !d->engine->customGlobalObject()) + || (thisObject == d->engine->customGlobalObject())) { + d->engine->originalGlobalObject()->setPrototype(other); + } } /*! diff -r fcece45ef507 -r 79de32ba3296 src/script/parser/qscriptlexer.cpp --- a/src/script/parser/qscriptlexer.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/script/parser/qscriptlexer.cpp Fri May 14 16:40:13 2010 +0300 @@ -31,7 +31,7 @@ QT_BEGIN_NAMESPACE -extern double qstrtod(const char *s00, char const **se, bool *ok); +Q_DECL_IMPORT extern double qstrtod(const char *s00, char const **se, bool *ok); #define shiftWindowsLineBreak() \ do { \ diff -r fcece45ef507 -r 79de32ba3296 src/svg/qsvghandler.cpp --- a/src/svg/qsvghandler.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/svg/qsvghandler.cpp Fri May 14 16:40:13 2010 +0300 @@ -74,7 +74,7 @@ static const char *qt_inherit_text = "inherit"; #define QT_INHERIT QLatin1String(qt_inherit_text) -double qstrtod(const char *s00, char const **se, bool *ok); +Q_DECL_IMPORT double qstrtod(const char *s00, char const **se, bool *ok); // ======== duplicated from qcolor_p diff -r fcece45ef507 -r 79de32ba3296 src/xmlpatterns/api/qxmlresultitems.cpp --- a/src/xmlpatterns/api/qxmlresultitems.cpp Mon May 03 13:17:34 2010 +0300 +++ b/src/xmlpatterns/api/qxmlresultitems.cpp Fri May 14 16:40:13 2010 +0300 @@ -70,6 +70,10 @@ sequence and returns it, and current() always returns the QXmlItem that next() returned the last time it was called. + \note When using the QXmlResultItems overload of QXmlQuery::evaluateTo() + to execute a query, it is advisable to create a new instance of this + class for each new set of results rather than reusing an old instance. + \sa QXmlItem::isNode(), QXmlItem::isAtomicValue(), QXmlNodeModelIndex */ diff -r fcece45ef507 -r 79de32ba3296 src/xmlpatterns/data/qdecimal_p.h --- a/src/xmlpatterns/data/qdecimal_p.h Mon May 03 13:17:34 2010 +0300 +++ b/src/xmlpatterns/data/qdecimal_p.h Fri May 14 16:40:13 2010 +0300 @@ -61,7 +61,7 @@ /** * Defined in QtCore's qlocale.cpp. */ -extern char *qdtoa(double d, int mode, int ndigits, int *decpt, int *sign, char **rve, char **resultp); +Q_DECL_IMPORT extern char *qdtoa(double d, int mode, int ndigits, int *decpt, int *sign, char **rve, char **resultp); namespace QPatternist { diff -r fcece45ef507 -r 79de32ba3296 tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp --- a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp Fri May 14 16:40:13 2010 +0300 @@ -43,6 +43,7 @@ #include #include +#include QT_USE_NAMESPACE @@ -285,8 +286,26 @@ allocFailer.reactivateAt(currentIndex); } +typedef void (*PVF)(); +PVF defaultTerminate; +void debugTerminate() +{ + // you can detect uncaught exceptions with a breakpoint in here + (*defaultTerminate)(); +} + +PVF defaultUnexpected; +void debugUnexpected() +{ + // you can detect unexpected exceptions with a breakpoint in here + (*defaultUnexpected)(); +} + void tst_ExceptionSafetyObjects::initTestCase() { + // set handlers for bad exception cases, you might want to step in and breakpoint the default handlers too + defaultTerminate = std::set_terminate(&debugTerminate); + defaultUnexpected = std::set_unexpected(&debugUnexpected); testMessageHandler = qInstallMsgHandler(safeMessageHandler); QVERIFY(AllocFailer::initialize()); diff -r fcece45ef507 -r 79de32ba3296 tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.ts.result --- a/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.ts.result Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/linguist/lupdate/testdata/good/parsecontexts/project.ts.result Fri May 14 16:40:13 2010 +0300 @@ -98,7 +98,7 @@ This is a comment to the translator. - + diff -r fcece45ef507 -r 79de32ba3296 tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp Fri May 14 16:40:13 2010 +0300 @@ -252,3 +252,26 @@ //: This is a message without a source string QString test = qtTrId("yet_another_id"); + + + +// QTBUG-9276: context in static initializers +class Bogus : QObject { + Q_OBJECT + + static const char * const s_strings[]; +}; + +const char * const Bogus::s_strings[] = { + QT_TR_NOOP("this should be in Bogus") +}; + +const char * const Bogus::s_strings[SIZE] = { + QT_TR_NOOP("this should be in Bogus") +}; + +void bogosity() +{ + // no spaces here. test collateral damage from ignoring equal sign + Class::member=QObject::tr("just QObject"); +} diff -r fcece45ef507 -r 79de32ba3296 tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result Fri May 14 16:40:13 2010 +0300 @@ -26,6 +26,15 @@ + Bogus + + + + this should be in Bogus + + + + Dialog2 @@ -184,6 +193,14 @@ + QObject + + + just QObject + + + + QTranslator diff -r fcece45ef507 -r 79de32ba3296 tests/auto/mediaobject/qtesthelper.h --- a/tests/auto/mediaobject/qtesthelper.h Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/mediaobject/qtesthelper.h Fri May 14 16:40:13 2010 +0300 @@ -215,7 +215,6 @@ default: return 0; } - return 0; } } // namespace QTest QT_END_NAMESPACE diff -r fcece45ef507 -r 79de32ba3296 tests/auto/mediaobject/tst_mediaobject.cpp --- a/tests/auto/mediaobject/tst_mediaobject.cpp Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/mediaobject/tst_mediaobject.cpp Fri May 14 16:40:13 2010 +0300 @@ -193,31 +193,17 @@ return *reinterpret_cast(variant.constData()); } -static const char *const red = "\033[0;31m"; -static const char *const green = "\033[0;32m"; -static const char *const yellow = "\033[0;33m"; -static const char *const blue = "\033[0;34m"; -static const char *const purple = "\033[0;35m"; -static const char *const cyan = "\033[0;36m"; -static const char *const white = "\033[0;37m"; -static const char *const normal = "\033[0m"; - void tst_MediaObject::stateChanged(Phonon::State newstate, Phonon::State oldstate) { - if (newstate == Phonon::ErrorState) { - QWARN(QByteArray(QByteArray(red) + ".......................................................... ") + QByteArray(QTest::toString(oldstate)) + " to " + QByteArray(QTest::toString(newstate)) + normal); - } else { - //qDebug() << ".........................................................." << cyan << QTest::toString(oldstate) << "to" << QTest::toString(newstate) << normal; - } + if (newstate == Phonon::ErrorState) + QWARN(QByteArray(QByteArray(QTest::toString(oldstate)) + " to " + QByteArray(QTest::toString(newstate)))); } void tst_MediaObject::testPlayFromResource() { #ifdef Q_OS_SYMBIAN QSKIP("Not implemented yet.", SkipAll); - return; -#endif - +#else QFile file(MEDIA_FILEPATH); MediaObject media; media.setCurrentSource(&file); @@ -229,6 +215,7 @@ if (media.state() != Phonon::PlayingState) QTest::waitForSignal(&media, SIGNAL(stateChanged(Phonon::State, Phonon::State)), 10000); QCOMPARE(media.state(), Phonon::PlayingState); +#endif } void tst_MediaObject::testPlayIllegalFile() @@ -264,6 +251,13 @@ } m_stateChangedSignalSpy->clear(); } + + // Ensure that m_media is in StoppedState + if (m_media->state() != Phonon::StoppedState) { + m_media->stop(); + QTest::waitForSignal(m_media, SIGNAL(stateChanged(Phonon::State, Phonon::State))); + QCOMPARE(m_media->state(), Phonon::StoppedState); + } } void tst_MediaObject::cleanup() @@ -579,13 +573,18 @@ if (m_media->state() != Phonon::StoppedState) QTest::waitForSignal(m_media, SIGNAL(stateChanged(Phonon::State, Phonon::State)), 10000); - // At this point we're in error state due to absent media, but it has now loaded the SDP: - QCOMPARE(m_media->errorString(), QString::fromLatin1("Buffering clip failed: Unknown error (-39)")); + // MediaObject should have loaded the SDP, but be in error state due to absent media + const bool stateMatch = (m_media->state() == Phonon::ErrorState); + const bool errorStringMatch = (m_media->errorString() == QString::fromLatin1("Loading clip failed: Unknown error (-39)")); - // We cannot play the SDP, we can neither attempt to play it, because we - // won't get a state change from ErrorState to ErrorState, and hence block - // on a never occuring signal. + // Ensure that m_media is back in ground state prior to starting next test step m_media->setCurrentSource(oldSource); + if (m_media->state() != Phonon::StoppedState) + QTest::waitForSignal(m_media, SIGNAL(stateChanged(Phonon::State, Phonon::State))); + QCOMPARE(m_media->state(), Phonon::StoppedState); + + QVERIFY(stateMatch); + QVERIFY(errorStringMatch); #else QSKIP("Unsupported on this platform.", SkipAll); diff -r fcece45ef507 -r 79de32ba3296 tests/auto/qbrush/tst_qbrush.cpp --- a/tests/auto/qbrush/tst_qbrush.cpp Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/qbrush/tst_qbrush.cpp Fri May 14 16:40:13 2010 +0300 @@ -75,9 +75,10 @@ void gradientStops(); void textures(); - + void nullBrush(); void isOpaque(); + void debug(); }; Q_DECLARE_METATYPE(QBrush) @@ -390,5 +391,15 @@ QVERIFY(!brush.isOpaque()); } +void tst_QBrush::debug() +{ + QPixmap pixmap_source(10, 10); + fill(&pixmap_source); + QBrush pixmap_brush; + pixmap_brush.setTexture(pixmap_source); + QCOMPARE(pixmap_brush.style(), Qt::TexturePattern); + qDebug() << pixmap_brush; // don't crash +} + QTEST_MAIN(tst_QBrush) #include "tst_qbrush.moc" diff -r fcece45ef507 -r 79de32ba3296 tests/auto/qcssparser/tst_qcssparser.cpp --- a/tests/auto/qcssparser/tst_qcssparser.cpp Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/qcssparser/tst_qcssparser.cpp Fri May 14 16:40:13 2010 +0300 @@ -1381,6 +1381,13 @@ QTEST(image, "expectedImage"); QTEST(int(repeat), "expectedRepeatValue"); QTEST(int(alignment), "expectedAlignment"); + + //QTBUG-9674 : a second evaluation should give the same results + QVERIFY(v.extractBackground(&brush, &image, &repeat, &alignment, &origin, &attachment, &ignoredOrigin)); + QVERIFY(expectedBrush.color() == brush.color()); + QTEST(image, "expectedImage"); + QTEST(int(repeat), "expectedRepeatValue"); + QTEST(int(alignment), "expectedAlignment"); } void tst_QCssParser::pseudoElement_data() @@ -1644,6 +1651,12 @@ QVERIFY(widths[QCss::TopEdge] == expectedTopWidth); QVERIFY(styles[QCss::TopEdge] == expectedTopStyle); QVERIFY(colors[QCss::TopEdge] == expectedTopColor); + + //QTBUG-9674 : a second evaluation should give the same results + QVERIFY(extractor.extractBorder(widths, colors, styles, radii)); + QVERIFY(widths[QCss::TopEdge] == expectedTopWidth); + QVERIFY(styles[QCss::TopEdge] == expectedTopStyle); + QVERIFY(colors[QCss::TopEdge] == expectedTopColor); } void tst_QCssParser::noTextDecoration() diff -r fcece45ef507 -r 79de32ba3296 tests/auto/qfile/tst_qfile.cpp --- a/tests/auto/qfile/tst_qfile.cpp Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/qfile/tst_qfile.cpp Fri May 14 16:40:13 2010 +0300 @@ -480,7 +480,7 @@ #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) QTest::newRow("//./PhysicalDrive0") << QString("//./PhysicalDrive0") << int(QIODevice::ReadOnly) << (bool)TRUE << QFile::NoError; - QTest::newRow("uncFile") << "//" + QtNetworkSettings::winServerName() + "/testsharewritable/test.pri" << int(QIODevice::ReadOnly) + QTest::newRow("uncFile") << "//" + QtNetworkSettings::winServerName() + "/testshare/test.pri" << int(QIODevice::ReadOnly) << true << QFile::NoError; #endif } @@ -552,7 +552,7 @@ QTest::newRow( "exist01" ) << QString(SRCDIR "testfile.txt") << (qint64)245; #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) // Only test UNC on Windows./ - QTest::newRow("unc") << "//" + QString(QtNetworkSettings::winServerName() + "/testsharewritable/test.pri") << (qint64)34; + QTest::newRow("unc") << "//" + QString(QtNetworkSettings::winServerName() + "/testshare/test.pri") << (qint64)34; #endif } @@ -2473,7 +2473,7 @@ { #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) QString current = QDir::currentPath(); - QVERIFY(QDir::setCurrent("//" + QtNetworkSettings::winServerName() + "/testsharewritable")); + QVERIFY(QDir::setCurrent("//" + QtNetworkSettings::winServerName() + "/testshare")); QFile file("test.pri"); QVERIFY(file.exists()); QCOMPARE(int(file.size()), 34); diff -r fcece45ef507 -r 79de32ba3296 tests/auto/qftp/tst_qftp.cpp --- a/tests/auto/qftp/tst_qftp.cpp Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/qftp/tst_qftp.cpp Fri May 14 16:40:13 2010 +0300 @@ -123,6 +123,8 @@ void doneSignal(); void queueMoreCommandsInDoneSlot(); + void qtbug7359Crash(); + protected slots: void stateChanged( int ); void listInfo( const QUrlInfo & ); @@ -2052,6 +2054,30 @@ } } +void tst_QFtp::qtbug7359Crash() +{ + QFtp ftp; + ftp.connectToHost("127.0.0.1"); + + QTime t; + int elapsed; + + t.start(); + while ((elapsed = t.elapsed()) < 200) + QCoreApplication::processEvents(QEventLoop::AllEvents, 200 - elapsed); + + ftp.close(); + t.restart(); + while ((elapsed = t.elapsed()) < 1000) + QCoreApplication::processEvents(QEventLoop::AllEvents, 1000 - elapsed); + + ftp.connectToHost("127.0.0.1"); + + t.restart(); + while ((elapsed = t.elapsed()) < 2000) + QCoreApplication::processEvents(QEventLoop::AllEvents, 2000 - elapsed); +} + QTEST_MAIN(tst_QFtp) #include "tst_qftp.moc" diff -r fcece45ef507 -r 79de32ba3296 tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp --- a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp Fri May 14 16:40:13 2010 +0300 @@ -277,9 +277,8 @@ // Make sure installing the effect triggers a repaint. CustomEffect *effect = new CustomEffect; item->setGraphicsEffect(effect); - QTest::qWait(50); - QCOMPARE(effect->numRepaints, 1); - QCOMPARE(item->numRepaints, 1); + QTRY_COMPARE(effect->numRepaints, 1); + QTRY_COMPARE(item->numRepaints, 1); // Make sure QPainter* and QStyleOptionGraphicsItem* stays persistent // during QGraphicsEffect::draw/QGraphicsItem::paint. @@ -293,26 +292,23 @@ // Make sure updating the source triggers a repaint. item->update(); - QTest::qWait(50); - QCOMPARE(effect->numRepaints, 1); - QCOMPARE(item->numRepaints, 1); + QTRY_COMPARE(effect->numRepaints, 1); + QTRY_COMPARE(item->numRepaints, 1); QVERIFY(effect->m_sourceChangedFlags & QGraphicsEffect::SourceInvalidated); effect->reset(); item->reset(); // Make sure changing the effect's bounding rect triggers a repaint. effect->setMargin(20); - QTest::qWait(50); - QCOMPARE(effect->numRepaints, 1); - QCOMPARE(item->numRepaints, 1); + QTRY_COMPARE(effect->numRepaints, 1); + QTRY_COMPARE(item->numRepaints, 1); effect->reset(); item->reset(); // Make sure change the item's bounding rect triggers a repaint. item->setRect(0, 0, 50, 50); - QTest::qWait(50); - QCOMPARE(effect->numRepaints, 1); - QCOMPARE(item->numRepaints, 1); + QTRY_COMPARE(effect->numRepaints, 1); + QTRY_COMPARE(item->numRepaints, 1); QVERIFY(effect->m_sourceChangedFlags & QGraphicsEffect::SourceBoundingRectChanged); effect->reset(); item->reset(); @@ -320,8 +316,7 @@ // Make sure the effect is the one to issue a repaint of the item. effect->doNothingInDraw = true; item->update(); - QTest::qWait(50); - QCOMPARE(effect->numRepaints, 1); + QTRY_COMPARE(effect->numRepaints, 1); QCOMPARE(item->numRepaints, 0); effect->doNothingInDraw = false; effect->reset(); @@ -336,9 +331,8 @@ item->reset(); effect->setEnabled(true); - QTest::qWait(50); - QCOMPARE(effect->numRepaints, 1); - QCOMPARE(item->numRepaints, 1); + QTRY_COMPARE(effect->numRepaints, 1); + QTRY_COMPARE(item->numRepaints, 1); effect->reset(); item->reset(); @@ -352,8 +346,7 @@ QPointer ptr = effect; item->setGraphicsEffect(0); QVERIFY(!ptr); - QTest::qWait(50); - QCOMPARE(item->numRepaints, 1); + QTRY_COMPARE(item->numRepaints, 1); } void tst_QGraphicsEffect::opacity() @@ -515,7 +508,6 @@ QTRY_VERIFY(effect->repaints >= 1); item->rotate(180); - QTest::qWait(50); QTRY_VERIFY(effect->repaints >= 2); } @@ -560,9 +552,8 @@ int numRepaints = item->numRepaints; item->translate(10, 0); - QTest::qWait(50); - QVERIFY(item->numRepaints == numRepaints); + QTRY_VERIFY(item->numRepaints == numRepaints); } void tst_QGraphicsEffect::inheritOpacity() @@ -588,7 +579,6 @@ int numRepaints = item->numRepaints; rectItem->setOpacity(1); - QTest::qWait(50); // item should have been rerendered due to opacity changing QTRY_VERIFY(item->numRepaints > numRepaints); diff -r fcece45ef507 -r 79de32ba3296 tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp --- a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp Fri May 14 16:40:13 2010 +0300 @@ -48,6 +48,8 @@ #include +#include "../../shared/util.h" + //TESTED_CLASS= //TESTED_FILES= @@ -220,9 +222,8 @@ QCOMPARE(item->numRepaints, 0); QCOMPARE(effect->numRepaints, 0); item->update(); - QTest::qWait(50); - QCOMPARE(item->numRepaints, 1); - QCOMPARE(effect->numRepaints, 1); + QTRY_COMPARE(item->numRepaints, 1); + QTRY_COMPARE(effect->numRepaints, 1); } void tst_QGraphicsEffectSource::isPixmap() @@ -255,10 +256,9 @@ QCOMPARE(effect->numRepaints, 0); effect->source()->update(); - QTest::qWait(50); - QCOMPARE(item->numRepaints, 1); - QCOMPARE(effect->numRepaints, 1); + QTRY_COMPARE(item->numRepaints, 1); + QTRY_COMPARE(effect->numRepaints, 1); } void tst_QGraphicsEffectSource::boundingRect() @@ -273,22 +273,20 @@ // We can at least check that the device bounding rect was correct in QGraphicsEffect::draw. effect->storeDeviceDependentStuff = true; effect->source()->update(); - QTest::qWait(50); const QTransform deviceTransform = item->deviceTransform(view->viewportTransform()); - QCOMPARE(effect->sourceDeviceBoundingRect, deviceTransform.mapRect(itemBoundingRect)); + QTRY_COMPARE(effect->sourceDeviceBoundingRect, deviceTransform.mapRect(itemBoundingRect)); // Bounding rect in logical coordinates is of course fine. - QCOMPARE(effect->source()->boundingRect(Qt::LogicalCoordinates), itemBoundingRect); + QTRY_COMPARE(effect->source()->boundingRect(Qt::LogicalCoordinates), itemBoundingRect); // Make sure default value is Qt::LogicalCoordinates. - QCOMPARE(effect->source()->boundingRect(), itemBoundingRect); + QTRY_COMPARE(effect->source()->boundingRect(), itemBoundingRect); } void tst_QGraphicsEffectSource::deviceRect() { effect->storeDeviceDependentStuff = true; effect->source()->update(); - QTest::qWait(50); - QCOMPARE(effect->deviceRect, view->viewport()->rect()); + QTRY_COMPARE(effect->deviceRect, view->viewport()->rect()); } void tst_QGraphicsEffectSource::pixmap() @@ -299,8 +297,7 @@ // We can at least verify a valid pixmap from QGraphicsEffect::draw. effect->storeDeviceDependentStuff = true; effect->source()->update(); - QTest::qWait(50); - QVERIFY(!effect->deviceCoordinatesPixmap.isNull()); + QTRY_VERIFY(!effect->deviceCoordinatesPixmap.isNull()); // Pixmaps in logical coordinates we can do fine. QPixmap pixmap1 = effect->source()->pixmap(Qt::LogicalCoordinates); diff -r fcece45ef507 -r 79de32ba3296 tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp Fri May 14 16:40:13 2010 +0300 @@ -6823,8 +6823,8 @@ testerChild2->rotate(22); QTest::qWait(25); QTRY_COMPARE(tester->repaints, 4); - QCOMPARE(testerChild->repaints, 4); - QCOMPARE(testerChild2->repaints, 3); + QTRY_COMPARE(testerChild->repaints, 4); + QTRY_COMPARE(testerChild2->repaints, 3); tester->resetTransform(); testerChild->resetTransform(); testerChild2->resetTransform(); @@ -6902,33 +6902,30 @@ testerChild->setPos(1, 1); QTest::qWait(25); QTRY_COMPARE(tester->repaints, 11); - QCOMPARE(testerChild->repaints, 10); - QCOMPARE(testerChild2->repaints, 5); + QTRY_COMPARE(testerChild->repaints, 10); + QTRY_COMPARE(testerChild2->repaints, 5); tester->resetTransform(); // Make a huge item tester->setGeometry(QRectF(-4000, -4000, 8000, 8000)); - QTest::qWait(25); QTRY_COMPARE(tester->repaints, 12); - QCOMPARE(testerChild->repaints, 11); - QCOMPARE(testerChild2->repaints, 5); + QTRY_COMPARE(testerChild->repaints, 11); + QTRY_COMPARE(testerChild2->repaints, 5); // Move the large item - will cause a repaint as the // cache is clipped. tester->setPos(5, 0); - QTest::qWait(25); QTRY_COMPARE(tester->repaints, 13); - QCOMPARE(testerChild->repaints, 11); - QCOMPARE(testerChild2->repaints, 5); + QTRY_COMPARE(testerChild->repaints, 11); + QTRY_COMPARE(testerChild2->repaints, 5); // Hiding and showing should invalidate the cache tester->hide(); QTest::qWait(25); tester->show(); - QTest::qWait(25); QTRY_COMPARE(tester->repaints, 14); - QCOMPARE(testerChild->repaints, 12); - QCOMPARE(testerChild2->repaints, 6); + QTRY_COMPARE(testerChild->repaints, 12); + QTRY_COMPARE(testerChild2->repaints, 6); } void tst_QGraphicsItem::cacheMode2() diff -r fcece45ef507 -r 79de32ba3296 tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp --- a/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp Fri May 14 16:40:13 2010 +0300 @@ -44,6 +44,8 @@ #include #include +#include "../../shared/util.h" + //TESTED_CLASS=QGraphicsLayout //TESTED_FILES= @@ -423,22 +425,15 @@ view.resize(150, 150); view.show(); - QApplication::processEvents(); - QTest::qWait(750); - QApplication::processEvents(); - - QCOMPARE(static_cast(li1->graphicsItem())->rect(), QRectF( 0, 0, 33, 99)); - QCOMPARE(static_cast(li2->graphicsItem())->rect(), QRectF(33, 0, 33, 99)); - QCOMPARE(static_cast(li3->graphicsItem())->rect(), QRectF(66, 0, 33, 99)); + QTRY_COMPARE(static_cast(li1->graphicsItem())->rect(), QRectF( 0, 0, 33, 99)); + QTRY_COMPARE(static_cast(li2->graphicsItem())->rect(), QRectF(33, 0, 33, 99)); + QTRY_COMPARE(static_cast(li3->graphicsItem())->rect(), QRectF(66, 0, 33, 99)); lout->setOrientation(Qt::Vertical); - QApplication::processEvents(); - QTest::qWait(750); - QApplication::processEvents(); - QCOMPARE(static_cast(li1->graphicsItem())->rect(), QRectF(0, 0, 99, 33)); - QCOMPARE(static_cast(li2->graphicsItem())->rect(), QRectF(0, 33, 99, 33)); - QCOMPARE(static_cast(li3->graphicsItem())->rect(), QRectF(0, 66, 99, 33)); + QTRY_COMPARE(static_cast(li1->graphicsItem())->rect(), QRectF(0, 0, 99, 33)); + QTRY_COMPARE(static_cast(li2->graphicsItem())->rect(), QRectF(0, 33, 99, 33)); + QTRY_COMPARE(static_cast(li3->graphicsItem())->rect(), QRectF(0, 66, 99, 33)); } diff -r fcece45ef507 -r 79de32ba3296 tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp --- a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp Fri May 14 16:40:13 2010 +0300 @@ -43,6 +43,7 @@ #include #include #include "../../shared/util.h" +#include #include // qSmartMin functions... #if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) #include @@ -787,7 +788,6 @@ view.show(); QApplication::setActiveWindow(&view); QTest::qWaitForWindowShown(&view); - QApplication::processEvents(); QTRY_COMPARE(QApplication::activeWindow(), &view); if (hasScene) { scene.addItem(proxy); @@ -836,7 +836,6 @@ view.activateWindow(); view.setFocus(); QTest::qWaitForWindowShown(&view); - QApplication::processEvents(); QTRY_VERIFY(view.isVisible()); QTRY_COMPARE(QApplication::activeWindow(), &view); @@ -989,7 +988,6 @@ // in QTest::mouseMove(&view, QPoint(50, 50)); - QTest::qWait(25); QTRY_COMPARE(widget->testAttribute(Qt::WA_UnderMouse), hasWidget ? true : false); // ### this attribute isn't supported QCOMPARE(widget->enterCount, hasWidget ? 1 : 0); @@ -999,11 +997,10 @@ // out QTest::mouseMove(&view, QPoint(10, 10)); - QTest::qWait(25); // QTRY_COMPARE(widget->testAttribute(Qt::WA_UnderMouse), false); // ### this attribute isn't supported - QCOMPARE(widget->leaveCount, hasWidget ? 1 : 0); - QCOMPARE(widget->hoverLeave, (hasWidget && hoverEnabled) ? 1 : 0); + QTRY_COMPARE(widget->leaveCount, hasWidget ? 1 : 0); + QTRY_COMPARE(widget->hoverLeave, (hasWidget && hoverEnabled) ? 1 : 0); // does not work on all platforms //QCOMPARE(widget->moveCount, 0); @@ -1071,7 +1068,6 @@ // move a little bit QTest::mouseMove(&view, QPoint(60, 60)); - QTest::qWait(12); QTRY_COMPARE(widget->hoverEnter, (hasWidget && hoverEnabled) ? 1 : 0); QCOMPARE(widget->moveCount, (hasWidget && mouseTracking) || (hasWidget && mouseDown) ? 1 : 0); @@ -1097,7 +1093,6 @@ view.viewport()->setFocus(); QApplication::setActiveWindow(&view); QTest::qWaitForWindowShown(&view); - QApplication::processEvents(); QTRY_COMPARE(QApplication::activeWindow(), &view); SubQGraphicsProxyWidget *proxy = new SubQGraphicsProxyWidget; @@ -1305,13 +1300,11 @@ scene.addItem(&proxy); //make sure we flush all the paint events - QTest::qWait(30); QTRY_VERIFY(proxy.paintCount > 1); QTest::qWait(30); proxy.paintCount = 0; w->update(); - QTest::qWait(30); QTRY_COMPARE(proxy.paintCount, 1); //the widget should have been painted now } @@ -1504,7 +1497,6 @@ view.paintEventRegion = QRegion(); view.npaints = 0; QTimer::singleShot(0, widget, SLOT(updateScroll())); - QTest::qWait(50); QTRY_COMPARE(view.npaints, 2); // QRect(0, 0, 200, 12) is the first update, expanded (-2, -2, 2, 2) // QRect(0, 12, 102, 10) is the scroll update, expanded (-2, -2, 2, 2), @@ -2483,9 +2475,7 @@ QTest::mousePress(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(proxy->mapToScene(proxy->boundingRect().center()))); - QTest::qWait(12); - - QCOMPARE(box->pos(), QPoint()); + QTRY_COMPARE(box->pos(), QPoint()); QCOMPARE(proxy->childItems().count(), 1); QGraphicsProxyWidget *child = (QGraphicsProxyWidget*)(proxy->childItems())[0]; @@ -2498,7 +2488,6 @@ QSKIP("Does not work due to SH_Combobox_Popup", SkipAll); QCOMPARE(child->widget()->parent(), static_cast(box)); - QTest::qWait(12); QTRY_COMPARE(proxy->pos(), QPointF(box->pos())); QCOMPARE(child->x(), qreal(box->x())); QCOMPARE(child->y(), qreal(box->rect().bottom())); @@ -2583,47 +2572,79 @@ // in QTest::mouseMove(view.viewport(), view.mapFromScene(proxy->mapToScene(proxy->boundingRect().center()))); sendMouseMove(view.viewport(), view.mapFromScene(proxy->mapToScene(proxy->boundingRect().center()))); - QTest::qWait(12); QTRY_COMPARE(view.viewport()->cursor().shape(), Qt::IBeamCursor); // out QTest::mouseMove(view.viewport(), QPoint(1, 1)); sendMouseMove(view.viewport(), QPoint(1, 1)); - QTest::qWait(12); QTRY_COMPARE(view.viewport()->cursor().shape(), Qt::ArrowCursor); #endif } void tst_QGraphicsProxyWidget::tooltip_basic() { - // Confirm that mouse events are working properly by checking that - // when moving the mouse over a label with a tooptip the tooltip appears + QString toolTip = "Qt rocks!"; + QString toolTip2 = "Qt rocks even more!"; + + QPushButton *button = new QPushButton("button"); + QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget; + QGraphicsProxyWidgetPrivate *proxyd = static_cast(QGraphicsItemPrivate::get(proxy)); + proxy->setWidget(button); + proxyd->lastWidgetUnderMouse = button; // force widget under mouse + + QVERIFY(button->toolTip().isEmpty()); + QVERIFY(proxy->toolTip().isEmpty()); + // Check that setting the tooltip on the proxy also set it on the widget + proxy->setToolTip(toolTip); + QCOMPARE(proxy->toolTip(), toolTip); + QCOMPARE(button->toolTip(), toolTip); + // Check that setting the tooltip on the widget also set it on the proxy + button->setToolTip(toolTip2); + QCOMPARE(proxy->toolTip(), toolTip2); + QCOMPARE(button->toolTip(), toolTip2); + QGraphicsScene scene; + scene.addItem(proxy); + QGraphicsView view(&scene); + view.setFixedSize(200, 200); view.show(); - - QSKIP("Tooltips don't work yet", SkipAll); - - SubQGraphicsProxyWidget *proxy = new SubQGraphicsProxyWidget; - QLabel *widget = new QLabel; - widget->setText("If it ain't tested it's broken"); - widget->setToolTip("When in doubt, test"); - proxy->setWidget(widget); - widget->show(); - scene.addItem(proxy); - QTest::qWait(125); - - // in - QTest::mouseMove(view.viewport(), view.mapFromScene(proxy->mapToScene(proxy->boundingRect().center()))); - QTest::qWait(3000); - - QCOMPARE(proxy->childItems().count(), 1); - QGraphicsProxyWidget *child = (QGraphicsProxyWidget*)(proxy->childItems())[0]; - QVERIFY(child->isWidget()); - QVERIFY(child->widget()); - QCOMPARE(child->widget()->parent(), static_cast(widget)); - QCOMPARE(child->widget()->x(), widget->x()); // ### ??? - QCOMPARE(child->widget()->y(), widget->y() + widget->height()); // ### ??? + QTest::qWaitForWindowShown(&view); + { + QHelpEvent helpEvent(QEvent::ToolTip, view.viewport()->rect().topLeft(), + view.viewport()->mapToGlobal(view.viewport()->rect().topLeft())); + QApplication::sendEvent(view.viewport(), &helpEvent); + QTest::qWait(350); + + bool foundView = false; + bool foundTipLabel = false; + foreach (QWidget *widget, QApplication::topLevelWidgets()) { + if (widget == &view) + foundView = true; + if (widget->inherits("QTipLabel")) + foundTipLabel = true; + } + QVERIFY(foundView); + QVERIFY(!foundTipLabel); + } + + { + QHelpEvent helpEvent(QEvent::ToolTip, view.mapFromScene(proxy->boundingRect().center()), + view.viewport()->mapToGlobal(view.mapFromScene(proxy->boundingRect().center()))); + QApplication::sendEvent(view.viewport(), &helpEvent); + QTest::qWait(350); + + bool foundView = false; + bool foundTipLabel = false; + foreach (QWidget *widget, QApplication::topLevelWidgets()) { + if (widget == &view) + foundView = true; + if (widget->inherits("QTipLabel")) + foundTipLabel = true; + } + QVERIFY(foundView); + QVERIFY(foundTipLabel); + } } void tst_QGraphicsProxyWidget::childPos_data() @@ -3348,7 +3369,6 @@ #ifdef Q_WS_X11 qt_x11_wait_for_window_manager(&view); #endif - QTest::qWait(20); QTRY_VERIFY(view.npaints > 0); const QRect itemDeviceBoundingRect = proxy->deviceTransform(view.viewportTransform()) @@ -3361,8 +3381,7 @@ // Update and hide. proxy->update(); proxy->hide(); - QTest::qWait(50); - QCOMPARE(view.npaints, 1); + QTRY_COMPARE(view.npaints, 1); QCOMPARE(view.paintEventRegion, expectedRegion); proxy->show(); @@ -3373,8 +3392,7 @@ // Update and delete. proxy->update(); delete proxy; - QTest::qWait(50); - QCOMPARE(view.npaints, 1); + QTRY_COMPARE(view.npaints, 1); QCOMPARE(view.paintEventRegion, expectedRegion); } @@ -3439,7 +3457,6 @@ qt_x11_wait_for_window_manager(&view); #endif QApplication::setActiveWindow(&view); - QTest::qWait(25); QTRY_COMPARE(QApplication::activeWindow(), &view); QVERIFY(!proxy->hasFocus()); diff -r fcece45ef507 -r 79de32ba3296 tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp --- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp Fri May 14 16:40:13 2010 +0300 @@ -111,8 +111,6 @@ void fontPropagationSceneChange(); void geometry_data(); void geometry(); - void width(); - void height(); void getContentsMargins_data(); void getContentsMargins(); void initStyleOption_data(); @@ -167,6 +165,7 @@ void polishEvent2(); void initialShow(); void initialShow2(); + void itemChangeEvents(); // Task fixes void task236127_bspTreeIndexFails(); @@ -767,42 +766,14 @@ { SubQGraphicsWidget widget; QCOMPARE(widget.geometry(), QRectF(widget.pos(), widget.size())); - QSignalSpy spy(&widget, SIGNAL(geometryChanged())); + QFETCH(QPointF, pos); QFETCH(QSizeF, size); widget.setPos(pos); widget.resize(size); - if (!size.isNull()) - QCOMPARE(spy.count(), 1); QCOMPARE(widget.geometry(), QRectF(pos, size)); } -void tst_QGraphicsWidget::width() -{ - QGraphicsWidget w; - QCOMPARE(w.property("width").toReal(), qreal(0)); - QSignalSpy spy(&w, SIGNAL(widthChanged())); - w.setProperty("width", qreal(50)); - QCOMPARE(w.property("width").toReal(), qreal(50)); - QCOMPARE(spy.count(), 1); - //calling old school setGeometry should work too - w.setGeometry(0, 0, 200, 200); - QCOMPARE(spy.count(), 2); -} - -void tst_QGraphicsWidget::height() -{ - QGraphicsWidget w; - QCOMPARE(w.property("height").toReal(), qreal(0)); - QSignalSpy spy(&w, SIGNAL(heightChanged())); - w.setProperty("height", qreal(50)); - QCOMPARE(w.property("height").toReal(), qreal(50)); - QCOMPARE(spy.count(), 1); - //calling old school setGeometry should work too - w.setGeometry(0, 0, 200, 200); - QCOMPARE(spy.count(), 2); -} - void tst_QGraphicsWidget::getContentsMargins_data() { QTest::addColumn("left"); @@ -2916,6 +2887,91 @@ QTRY_COMPARE(widget->repaints, expectedRepaintCount); } +void tst_QGraphicsWidget::itemChangeEvents() +{ + class TestGraphicsWidget : public QGraphicsWidget + { public: + TestGraphicsWidget() : QGraphicsWidget() {} + QHash valueDuringEvents; + bool event(QEvent *event) { + Q_UNUSED(event); + switch (event->type()) { + case QEvent::EnabledChange: { + valueDuringEvents.insert(QEvent::EnabledChange, isEnabled()); + break; + } + case QEvent::ParentAboutToChange: { + valueDuringEvents.insert(QEvent::ParentAboutToChange, qVariantFromValue(parentItem())); + break; + } + case QEvent::ParentChange: { + valueDuringEvents.insert(QEvent::ParentChange, qVariantFromValue(parentItem())); + break; + } + case QEvent::CursorChange: { + valueDuringEvents.insert(QEvent::CursorChange, int(cursor().shape())); + break; + } + case QEvent::ToolTipChange: { + valueDuringEvents.insert(QEvent::ToolTipChange, toolTip()); + break; + } + default: { + break; + } + } + return true; + } + void showEvent(QShowEvent *event) { + Q_UNUSED(event); + valueDuringEvents.insert(QEvent::Show, isVisible()); + } + void hideEvent(QHideEvent *event) { + Q_UNUSED(event); + valueDuringEvents.insert(QEvent::Hide, isVisible()); + } + }; + + QGraphicsScene scene; + QGraphicsView view(&scene); + QGraphicsWidget *parent = new QGraphicsWidget; + scene.addItem(parent); + view.show(); + QTest::qWaitForWindowShown(&view); + + TestGraphicsWidget *item = new TestGraphicsWidget; + item->setParentItem(parent); + // ParentAboutToChange should be triggered before the parent has changed + QTRY_COMPARE(qVariantValue(item->valueDuringEvents.value(QEvent::ParentAboutToChange)), + static_cast(0)); + // ParentChange should be triggered after the parent has changed + QTRY_COMPARE(qVariantValue(item->valueDuringEvents.value(QEvent::ParentChange)), + static_cast(parent)); + + // ShowEvent should be triggered before the item is shown + QTRY_VERIFY(!item->valueDuringEvents.value(QEvent::Show).toBool()); + + // HideEvent should be triggered after the item is hidden + QVERIFY(item->isVisible()); + item->setVisible(false); + QVERIFY(!item->isVisible()); + QTRY_VERIFY(!item->valueDuringEvents.value(QEvent::Hide).toBool()); + + // CursorChange should be triggered after the cursor has changed + item->setCursor(Qt::PointingHandCursor); + QTRY_COMPARE(item->valueDuringEvents.value(QEvent::CursorChange).toInt(), int(item->cursor().shape())); + + // ToolTipChange should be triggered after the tooltip has changed + item->setToolTip("tooltipText"); + QTRY_COMPARE(item->valueDuringEvents.value(QEvent::ToolTipChange).toString(), item->toolTip()); + + // EnabledChange should be triggered after the enabled state has changed + QVERIFY(item->isEnabled()); + item->setEnabled(false); + QVERIFY(!item->isEnabled()); + QTRY_VERIFY(!item->valueDuringEvents.value(QEvent::EnabledChange).toBool()); +} + void tst_QGraphicsWidget::QT_BUG_6544_tabFocusFirstUnsetWhenRemovingItems() { QGraphicsScene scene; diff -r fcece45ef507 -r 79de32ba3296 tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp --- a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp Fri May 14 16:40:13 2010 +0300 @@ -385,7 +385,7 @@ QTest::addColumn("contentLength"); QTest::addColumn("downloadSize"); - QTest::newRow("success-internal") << "http://" << QtNetworkSettings::serverName() << "/cgi-bin/echo.cgi" << ushort(80) << false << "7 bytes" << 200 << "OK" << 7 << 7; + QTest::newRow("success-internal") << "http://" << QtNetworkSettings::serverName() << "/qtest/cgi-bin/echo.cgi" << ushort(80) << false << "7 bytes" << 200 << "OK" << 7 << 7; QTest::newRow("failure-internal") << "http://" << QtNetworkSettings::serverName() << "/t" << ushort(80) << false << "Hello World" << 404 << "Not Found" << -1 << 997 + QtNetworkSettings::serverName().size(); } @@ -801,7 +801,7 @@ QTest::newRow("6 connections, no pipelining, 100 requests") << quint16(6) << false << 100; QTest::newRow("1 connection, no pipelining, 100 requests") << quint16(1) << false << 100; - QTest::newRow("6 connections, pipelining allowed, 100 requests") << quint16(2) << true << 100; + QTest::newRow("6 connections, pipelining allowed, 100 requests") << quint16(6) << true << 100; QTest::newRow("1 connection, pipelining allowed, 100 requests") << quint16(1) << true << 100; } diff -r fcece45ef507 -r 79de32ba3296 tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp --- a/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp Fri May 14 16:40:13 2010 +0300 @@ -506,7 +506,8 @@ // Connect socket.connectToHost(QtNetworkSettings::serverName(), 143); - QCOMPARE(socket.state(), QTcpSocket::HostLookupState); + QVERIFY(socket.state() == QTcpSocket::HostLookupState || + socket.state() == QTcpSocket::ConnectingState); QTestEventLoop::instance().enterLoop(30); if (QTestEventLoop::instance().timeout()) { @@ -640,7 +641,7 @@ QByteArray hostName = QtNetworkSettings::serverName().toLatin1(); QVERIFY(tmpSocket->state() == QAbstractSocket::ConnectedState); - QVERIFY(tmpSocket->write("GET /mediumfile HTTP/1.0\r\n") > 0); + QVERIFY(tmpSocket->write("GET /qtest/mediumfile HTTP/1.0\r\n") > 0); QVERIFY(tmpSocket->write("Host: ") > 0); QVERIFY(tmpSocket->write(hostName.data()) > 0); QVERIFY(tmpSocket->write("\r\n") > 0); diff -r fcece45ef507 -r 79de32ba3296 tests/auto/qnetworkreply/tst_qnetworkreply.cpp --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp Fri May 14 16:40:13 2010 +0300 @@ -1376,10 +1376,10 @@ // for status codes to expect, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html QTest::newRow("405-method-not-allowed") << QUrl("http://" + QtNetworkSettings::serverName() + "/index.html") << 405 << QNetworkReply::ContentOperationNotPermittedError; - QTest::newRow("200-ok") << QUrl("http://" + QtNetworkSettings::serverName() + "/cgi-bin/http-delete.cgi?200-ok") << 200 << QNetworkReply::NoError; - QTest::newRow("202-accepted") << QUrl("http://" + QtNetworkSettings::serverName() + "/cgi-bin/http-delete.cgi?202-accepted") << 202 << QNetworkReply::NoError; - QTest::newRow("204-no-content") << QUrl("http://" + QtNetworkSettings::serverName() + "/cgi-bin/http-delete.cgi?204-no-content") << 204 << QNetworkReply::NoError; - QTest::newRow("404-not-found") << QUrl("http://" + QtNetworkSettings::serverName() + "/cgi-bin/http-delete.cgi?404-not-found") << 404 << QNetworkReply::ContentNotFoundError; + QTest::newRow("200-ok") << QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/cgi-bin/http-delete.cgi?200-ok") << 200 << QNetworkReply::NoError; + QTest::newRow("202-accepted") << QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/cgi-bin/http-delete.cgi?202-accepted") << 202 << QNetworkReply::NoError; + QTest::newRow("204-no-content") << QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/cgi-bin/http-delete.cgi?204-no-content") << 204 << QNetworkReply::NoError; + QTest::newRow("404-not-found") << QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/cgi-bin/http-delete.cgi?404-not-found") << 404 << QNetworkReply::ContentNotFoundError; } void tst_QNetworkReply::deleteFromHttp() @@ -3278,7 +3278,7 @@ void tst_QNetworkReply::lastModifiedHeaderForHttp() { // Tue, 22 May 2007 12:04:57 GMT according to webserver - QUrl url = "http://" + QtNetworkSettings::serverName() + "/gif/fluke.gif"; + QUrl url = "http://" + QtNetworkSettings::serverName() + "/qtest/fluke.gif"; QNetworkRequest request(url); QNetworkReplyPtr reply = manager.head(request); @@ -3786,10 +3786,10 @@ QTest::addColumn("httpBody"); QTest::newRow("unknown-authorization-method") << "http://" + QtNetworkSettings::serverName() + - "/cgi-bin/http-unknown-authentication-method.cgi?401-authorization-required" << 1 << 1 + "/qtest/cgi-bin/http-unknown-authentication-method.cgi?401-authorization-required" << 1 << 1 << int(QNetworkReply::AuthenticationRequiredError) << 401 << "authorization required"; QTest::newRow("unknown-proxy-authorization-method") << "http://" + QtNetworkSettings::serverName() + - "/cgi-bin/http-unknown-authentication-method.cgi?407-proxy-authorization-required" << 1 << 1 + "/qtest/cgi-bin/http-unknown-authentication-method.cgi?407-proxy-authorization-required" << 1 << 1 << int(QNetworkReply::ProxyAuthenticationRequiredError) << 407 << "authorization required"; } @@ -4013,7 +4013,7 @@ } } void startOne() { - QUrl url = "http://" + QtNetworkSettings::serverName() + "/gif/fluke.gif"; + QUrl url = "http://" + QtNetworkSettings::serverName() + "/qtest/fluke.gif"; QNetworkRequest request(url); QNetworkReply *reply = manager.get(request); reply->setParent(this); diff -r fcece45ef507 -r 79de32ba3296 tests/auto/qscriptengine/qscriptengine.pro --- a/tests/auto/qscriptengine/qscriptengine.pro Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/qscriptengine/qscriptengine.pro Fri May 14 16:40:13 2010 +0300 @@ -1,6 +1,7 @@ load(qttest_p4) QT = core gui script SOURCES += tst_qscriptengine.cpp +RESOURCES += qscriptengine.qrc wince* { DEFINES += SRCDIR=\\\"./\\\" diff -r fcece45ef507 -r 79de32ba3296 tests/auto/qscriptengine/qscriptengine.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/auto/qscriptengine/qscriptengine.qrc Fri May 14 16:40:13 2010 +0300 @@ -0,0 +1,5 @@ + + + translations/translatable_la.qm + + diff -r fcece45ef507 -r 79de32ba3296 tests/auto/qscriptengine/translatable.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/auto/qscriptengine/translatable.js Fri May 14 16:40:13 2010 +0300 @@ -0,0 +1,9 @@ +qsTr("One"); +qsTranslate("FooContext", "Two"); + +var greeting_strings = [ + QT_TR_NOOP("Hello"), + QT_TRANSLATE_NOOP("FooContext", "Goodbye") +]; + +qsTr("One", "not the same one"); diff -r fcece45ef507 -r 79de32ba3296 tests/auto/qscriptengine/translatable2.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/auto/qscriptengine/translatable2.js Fri May 14 16:40:13 2010 +0300 @@ -0,0 +1,9 @@ +qsTr("Three"); +qsTranslate("BarContext", "Four"); + +var celebration_strings = [ + QT_TR_NOOP("Happy birthday!"), + QT_TRANSLATE_NOOP("BarContext", "Congratulations!") +]; + +qsTr("Three", "not the same three"); diff -r fcece45ef507 -r 79de32ba3296 tests/auto/qscriptengine/translations/translatable_la.qm Binary file tests/auto/qscriptengine/translations/translatable_la.qm has changed diff -r fcece45ef507 -r 79de32ba3296 tests/auto/qscriptengine/translations/translatable_la.ts --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/auto/qscriptengine/translations/translatable_la.ts Fri May 14 16:40:13 2010 +0300 @@ -0,0 +1,72 @@ + + + + + BarContext + + + Four + Fire + + + + Congratulations! + Gratulerer! + + + + FooContext + + + Two + To + + + + Goodbye + Farvel + + + + translatable + + + One + En + + + + Hello + Hallo + + + + One + not the same one + Enda en + + + Goodbye + Farvel + + + + translatable2 + + + Three + Tre + + + + Happy birthday! + Gratulerer med dagen! + + + + Three + not the same three + Tre andre + + + diff -r fcece45ef507 -r 79de32ba3296 tests/auto/qscriptengine/tst_qscriptengine.cpp --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp Fri May 14 16:40:13 2010 +0300 @@ -104,6 +104,8 @@ void getSetGlobalObject(); void globalObjectProperties(); void globalObjectGetterSetterProperty(); + void customGlobalObjectWithPrototype(); + void globalObjectWithCustomPrototype(); void builtinFunctionNames_data(); void builtinFunctionNames(); void checkSyntax_data(); @@ -152,6 +154,9 @@ void incDecNonObjectProperty(); void installTranslatorFunctions_data(); void installTranslatorFunctions(); + void translateScript(); + void translateWithInvalidArgs_data(); + void translateWithInvalidArgs(); void functionScopes(); void nativeFunctionScopes(); void evaluateProgram(); @@ -1174,6 +1179,131 @@ QVERIFY(global.property("baz").equals(789)); } +void tst_QScriptEngine::customGlobalObjectWithPrototype() +{ + for (int x = 0; x < 2; ++x) { + QScriptEngine engine; + QScriptValue wrap = engine.newObject(); + QScriptValue global = engine.globalObject(); + QScriptValue originalGlobalProto = global.prototype(); + if (!x) { + // Set prototype before setting global object + wrap.setPrototype(global); + QVERIFY(wrap.prototype().strictlyEquals(global)); + engine.setGlobalObject(wrap); + } else { + // Set prototype after setting global object + engine.setGlobalObject(wrap); + wrap.setPrototype(global); + QVERIFY(wrap.prototype().strictlyEquals(global)); + } + { + QScriptValue ret = engine.evaluate("print"); + QVERIFY(ret.isFunction()); + QVERIFY(ret.strictlyEquals(wrap.property("print"))); + } + { + QScriptValue ret = engine.evaluate("this.print"); + QVERIFY(ret.isFunction()); + QVERIFY(ret.strictlyEquals(wrap.property("print"))); + } + { + QScriptValue ret = engine.evaluate("hasOwnProperty('print')"); + QVERIFY(ret.isBool()); + QVERIFY(!ret.toBool()); + } + { + QScriptValue ret = engine.evaluate("this.hasOwnProperty('print')"); + QVERIFY(ret.isBool()); + QVERIFY(!ret.toBool()); + } + + QScriptValue anotherProto = engine.newObject(); + anotherProto.setProperty("anotherProtoProperty", 123); + global.setPrototype(anotherProto); + { + QScriptValue ret = engine.evaluate("print"); + QVERIFY(ret.isFunction()); + QVERIFY(ret.strictlyEquals(wrap.property("print"))); + } + { + QScriptValue ret = engine.evaluate("anotherProtoProperty"); + QVERIFY(ret.isNumber()); + QVERIFY(ret.strictlyEquals(wrap.property("anotherProtoProperty"))); + } + { + QScriptValue ret = engine.evaluate("this.anotherProtoProperty"); + QVERIFY(ret.isNumber()); + QVERIFY(ret.strictlyEquals(wrap.property("anotherProtoProperty"))); + } + + wrap.setPrototype(anotherProto); + { + QScriptValue ret = engine.evaluate("print"); + QVERIFY(ret.isError()); + QCOMPARE(ret.toString(), QString::fromLatin1("ReferenceError: Can't find variable: print")); + } + { + QScriptValue ret = engine.evaluate("anotherProtoProperty"); + QVERIFY(ret.isNumber()); + QVERIFY(ret.strictlyEquals(wrap.property("anotherProtoProperty"))); + } + QVERIFY(global.prototype().strictlyEquals(anotherProto)); + + global.setPrototype(originalGlobalProto); + engine.setGlobalObject(global); + { + QScriptValue ret = engine.evaluate("anotherProtoProperty"); + QVERIFY(ret.isError()); + QCOMPARE(ret.toString(), QString::fromLatin1("ReferenceError: Can't find variable: anotherProtoProperty")); + } + { + QScriptValue ret = engine.evaluate("print"); + QVERIFY(ret.isFunction()); + QVERIFY(ret.strictlyEquals(global.property("print"))); + } + QVERIFY(!anotherProto.property("print").isValid()); + } +} + +void tst_QScriptEngine::globalObjectWithCustomPrototype() +{ + QScriptEngine engine; + QScriptValue proto = engine.newObject(); + proto.setProperty("protoProperty", 123); + QScriptValue global = engine.globalObject(); + QScriptValue originalProto = global.prototype(); + global.setPrototype(proto); + { + QScriptValue ret = engine.evaluate("protoProperty"); + QVERIFY(ret.isNumber()); + QVERIFY(ret.strictlyEquals(global.property("protoProperty"))); + } + { + QScriptValue ret = engine.evaluate("this.protoProperty"); + QVERIFY(ret.isNumber()); + QVERIFY(ret.strictlyEquals(global.property("protoProperty"))); + } + { + QScriptValue ret = engine.evaluate("hasOwnProperty('protoProperty')"); + QVERIFY(ret.isBool()); + QVERIFY(!ret.toBool()); + } + { + QScriptValue ret = engine.evaluate("this.hasOwnProperty('protoProperty')"); + QVERIFY(ret.isBool()); + QVERIFY(!ret.toBool()); + } + + // Custom prototype set from JS + { + QScriptValue ret = engine.evaluate("this.__proto__ = { 'a': 123 }; a"); + QVERIFY(ret.isNumber()); + QEXPECT_FAIL("", "QTBUG-9737", Continue); + QVERIFY(ret.strictlyEquals(global.property("a"))); + } +} + void tst_QScriptEngine::builtinFunctionNames_data() { QTest::addColumn("expression"); @@ -4187,6 +4317,127 @@ } } +static QScriptValue callQsTr(QScriptContext *ctx, QScriptEngine *eng) +{ + return eng->globalObject().property("qsTr").call(ctx->thisObject(), ctx->argumentsObject()); +} + +void tst_QScriptEngine::translateScript() +{ + QScriptEngine engine; + + QTranslator translator; + translator.load(":/translations/translatable_la"); + QCoreApplication::instance()->installTranslator(&translator); + engine.installTranslatorFunctions(); + + QString fileName = QString::fromLatin1("translatable.js"); + // Top-level + QCOMPARE(engine.evaluate("qsTr('One')", fileName).toString(), QString::fromLatin1("En")); + QCOMPARE(engine.evaluate("qsTr('Hello')", fileName).toString(), QString::fromLatin1("Hallo")); + // From function + QCOMPARE(engine.evaluate("(function() { return qsTr('One'); })()", fileName).toString(), QString::fromLatin1("En")); + QCOMPARE(engine.evaluate("(function() { return qsTr('Hello'); })()", fileName).toString(), QString::fromLatin1("Hallo")); + // From eval + QCOMPARE(engine.evaluate("eval('qsTr(\\'One\\')')", fileName).toString(), QString::fromLatin1("En")); + QCOMPARE(engine.evaluate("eval('qsTr(\\'Hello\\')')", fileName).toString(), QString::fromLatin1("Hallo")); + + QCOMPARE(engine.evaluate("qsTranslate('FooContext', 'Two')", fileName).toString(), QString::fromLatin1("To")); + QCOMPARE(engine.evaluate("qsTranslate('FooContext', 'Goodbye')", fileName).toString(), QString::fromLatin1("Farvel")); + // From eval + QCOMPARE(engine.evaluate("eval('qsTranslate(\\'FooContext\\', \\'Two\\')')", fileName).toString(), QString::fromLatin1("To")); + QCOMPARE(engine.evaluate("eval('qsTranslate(\\'FooContext\\', \\'Goodbye\\')')", fileName).toString(), QString::fromLatin1("Farvel")); + + QCOMPARE(engine.evaluate("qsTranslate('FooContext', 'Goodbye', '', 'UnicodeUTF8')", fileName).toString(), QString::fromLatin1("Farvel")); + + QCOMPARE(engine.evaluate("qsTr('One', 'not the same one')", fileName).toString(), QString::fromLatin1("Enda en")); + + QVERIFY(engine.evaluate("QT_TR_NOOP()").isUndefined()); + QCOMPARE(engine.evaluate("QT_TR_NOOP('One')").toString(), QString::fromLatin1("One")); + + QVERIFY(engine.evaluate("QT_TRANSLATE_NOOP()").isUndefined()); + QVERIFY(engine.evaluate("QT_TRANSLATE_NOOP('FooContext')").isUndefined()); + QCOMPARE(engine.evaluate("QT_TRANSLATE_NOOP('FooContext', 'Two')").toString(), QString::fromLatin1("Two")); + + // Don't exist in translation + QCOMPARE(engine.evaluate("qsTr('Three')", fileName).toString(), QString::fromLatin1("Three")); + QCOMPARE(engine.evaluate("qsTranslate('FooContext', 'So long')", fileName).toString(), QString::fromLatin1("So long")); + QCOMPARE(engine.evaluate("qsTranslate('BarContext', 'Goodbye')", fileName).toString(), QString::fromLatin1("Goodbye")); + + // From C++ + // There is no context, but it shouldn't crash + QCOMPARE(engine.globalObject().property("qsTr").call( + QScriptValue(), QScriptValueList() << "One").toString(), QString::fromLatin1("One")); + + // Translate strings from the second script (translatable2.js) + + QString fileName2 = QString::fromLatin1("translatable2.js"); + + QCOMPARE(engine.evaluate("qsTr('Three')", fileName2).toString(), QString::fromLatin1("Tre")); + QCOMPARE(engine.evaluate("qsTr('Happy birthday!')", fileName2).toString(), QString::fromLatin1("Gratulerer med dagen!")); + + // Not translated because translation is only in translatable.js + QCOMPARE(engine.evaluate("qsTr('One')", fileName2).toString(), QString::fromLatin1("One")); + QCOMPARE(engine.evaluate("(function() { return qsTr('One'); })()", fileName2).toString(), QString::fromLatin1("One")); + + // For qsTranslate() the filename shouldn't matter + QCOMPARE(engine.evaluate("qsTranslate('FooContext', 'Two')", fileName2).toString(), QString::fromLatin1("To")); + QCOMPARE(engine.evaluate("qsTranslate('BarContext', 'Congratulations!')", fileName).toString(), QString::fromLatin1("Gratulerer!")); + + // qsTr() should use the innermost filename as context + engine.evaluate("function foo(s) { return bar(s); }", fileName); + engine.evaluate("function bar(s) { return qsTr(s); }", fileName2); + QCOMPARE(engine.evaluate("bar('Three')", fileName2).toString(), QString::fromLatin1("Tre")); + QCOMPARE(engine.evaluate("bar('Three')", fileName).toString(), QString::fromLatin1("Tre")); + QCOMPARE(engine.evaluate("bar('One')", fileName2).toString(), QString::fromLatin1("One")); + + engine.evaluate("function foo(s) { return bar(s); }", fileName2); + engine.evaluate("function bar(s) { return qsTr(s); }", fileName); + QCOMPARE(engine.evaluate("bar('Three')", fileName2).toString(), QString::fromLatin1("Three")); + QCOMPARE(engine.evaluate("bar('One')", fileName).toString(), QString::fromLatin1("En")); + QCOMPARE(engine.evaluate("bar('One')", fileName2).toString(), QString::fromLatin1("En")); + + // Calling qsTr() from a native function + engine.globalObject().setProperty("qsTrProxy", engine.newFunction(callQsTr)); + QCOMPARE(engine.evaluate("qsTrProxy('One')", fileName).toString(), QString::fromLatin1("En")); + QCOMPARE(engine.evaluate("qsTrProxy('One')", fileName2).toString(), QString::fromLatin1("One")); + QCOMPARE(engine.evaluate("qsTrProxy('Three')", fileName).toString(), QString::fromLatin1("Three")); + QCOMPARE(engine.evaluate("qsTrProxy('Three')", fileName2).toString(), QString::fromLatin1("Tre")); + + QCoreApplication::instance()->removeTranslator(&translator); +} + +void tst_QScriptEngine::translateWithInvalidArgs_data() +{ + QTest::addColumn("expression"); + QTest::addColumn("expectedError"); + + QTest::newRow("qsTr()") << "qsTr()" << "Error: qsTr() requires at least one argument"; + QTest::newRow("qsTr(123)") << "qsTr(123)" << "Error: qsTr(): first argument (text) must be a string"; + QTest::newRow("qsTr('foo', 123)") << "qsTr('foo', 123)" << "Error: qsTr(): second argument (comment) must be a string"; + QTest::newRow("qsTr('foo', 'bar', 'baz')") << "qsTr('foo', 'bar', 'baz')" << "Error: qsTr(): third argument (n) must be a number"; + QTest::newRow("qsTr('foo', 'bar', true)") << "qsTr('foo', 'bar', true)" << "Error: qsTr(): third argument (n) must be a number"; + + QTest::newRow("qsTranslate()") << "qsTranslate()" << "Error: qsTranslate() requires at least two arguments"; + QTest::newRow("qsTranslate('foo')") << "qsTranslate('foo')" << "Error: qsTranslate() requires at least two arguments"; + QTest::newRow("qsTranslate('foo', 123)") << "qsTranslate('foo', 123)" << "Error: qsTranslate(): second argument (text) must be a string"; + QTest::newRow("qsTranslate('foo', 'bar', 123)") << "qsTranslate('foo', 'bar', 123)" << "Error: qsTranslate(): third argument (comment) must be a string"; + QTest::newRow("qsTranslate('foo', 'bar', 'baz', 123)") << "qsTranslate('foo', 'bar', 'baz', 123)" << "Error: qsTranslate(): fourth argument (encoding) must be a string"; + QTest::newRow("qsTranslate('foo', 'bar', 'baz', 'zab', 'rab')") << "qsTranslate('foo', 'bar', 'baz', 'zab', 'rab')" << "Error: qsTranslate(): fifth argument (n) must be a number"; + QTest::newRow("qsTranslate('foo', 'bar', 'baz', 'zab', 123)") << "qsTranslate('foo', 'bar', 'baz', 'zab', 123)" << "Error: qsTranslate(): invalid encoding 'zab'"; +} + +void tst_QScriptEngine::translateWithInvalidArgs() +{ + QFETCH(QString, expression); + QFETCH(QString, expectedError); + QScriptEngine engine; + engine.installTranslatorFunctions(); + QScriptValue result = engine.evaluate(expression); + QVERIFY(result.isError()); + QCOMPARE(result.toString(), expectedError); +} + void tst_QScriptEngine::functionScopes() { QScriptEngine eng; diff -r fcece45ef507 -r 79de32ba3296 tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp --- a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp Fri May 14 16:40:13 2010 +0300 @@ -533,6 +533,7 @@ void objectDeleted(); void connectToDestroyedSignal(); void emitAfterReceiverDeleted(); + void enumerateMetaObject(); private: QScriptEngine *m_engine; @@ -3043,5 +3044,38 @@ } } +void tst_QScriptExtQObject::enumerateMetaObject() +{ + QScriptValue myClass = m_engine->newQMetaObject(m_myObject->metaObject(), m_engine->undefinedValue()); + + QStringList expectedNames; + expectedNames << "FooPolicy" << "BarPolicy" << "BazPolicy" + << "FooStrategy" << "BarStrategy" << "BazStrategy" + << "NoAbility" << "FooAbility" << "BarAbility" << "BazAbility" << "AllAbility"; + + for (int x = 0; x < 2; ++x) { + QSet actualNames; + if (x == 0) { + // From C++ + QScriptValueIterator it(myClass); + while (it.hasNext()) { + it.next(); + actualNames.insert(it.name()); + } + } else { + // From JS + m_engine->globalObject().setProperty("MyClass", myClass); + QScriptValue ret = m_engine->evaluate("a=[]; for (var p in MyClass) if (MyClass.hasOwnProperty(p)) a.push(p); a"); + QVERIFY(ret.isArray()); + QStringList strings = qscriptvalue_cast(ret); + for (int i = 0; i < strings.size(); ++i) + actualNames.insert(strings.at(i)); + } + QCOMPARE(actualNames.size(), expectedNames.size()); + for (int i = 0; i < expectedNames.size(); ++i) + QVERIFY(actualNames.contains(expectedNames.at(i))); + } +} + QTEST_MAIN(tst_QScriptExtQObject) #include "tst_qscriptextqobject.moc" diff -r fcece45ef507 -r 79de32ba3296 tests/auto/qsharedpointer/externaltests.cpp --- a/tests/auto/qsharedpointer/externaltests.cpp Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/qsharedpointer/externaltests.cpp Fri May 14 16:40:13 2010 +0300 @@ -140,7 +140,6 @@ QExternalTestPrivate() : qtModules(QExternalTest::QtCore | QExternalTest::QtGui | QExternalTest::QtTest), appType(QExternalTest::AutoApplication), - debugMode(true), exitCode(-1) { } @@ -156,7 +155,6 @@ QByteArray programHeader; QExternalTest::QtModules qtModules; QExternalTest::ApplicationType appType; - bool debugMode; QString temporaryDir; QByteArray sourceCode; @@ -190,16 +188,6 @@ delete d; } - bool QExternalTest::isDebugMode() const - { - return d->debugMode; - } - - void QExternalTest::setDebugMode(bool enable) - { - d->debugMode = enable; - } - QList QExternalTest::qmakeSettings() const { return d->qmakeLines; @@ -524,10 +512,11 @@ "INCLUDEPATH += . "); projectFile.write(QFile::encodeName(QDir::currentPath())); - if (debugMode) +#ifndef QT_NO_DEBUG projectFile.write("\nCONFIG += debug\n"); - else +#else projectFile.write("\nCONFIG += release\n"); +#endif QByteArray extraSources = QFile::encodeName(extraProgramSources.join(" ")); if (!extraSources.isEmpty()) { diff -r fcece45ef507 -r 79de32ba3296 tests/auto/qsharedpointer/externaltests.h --- a/tests/auto/qsharedpointer/externaltests.h Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/qsharedpointer/externaltests.h Fri May 14 16:40:13 2010 +0300 @@ -91,9 +91,6 @@ QApplicationGuiServer }; - bool isDebugMode() const; - void setDebugMode(bool enable); - QList qmakeSettings() const; void setQmakeSettings(const QList &settings); diff -r fcece45ef507 -r 79de32ba3296 tests/auto/qsharedpointer/tst_qsharedpointer.cpp --- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp Fri May 14 16:40:13 2010 +0300 @@ -1717,11 +1717,11 @@ #endif QTest::QExternalTest test; - test.setDebugMode(true); test.setQtModules(QTest::QExternalTest::QtCore); test.setExtraProgramSources(QStringList() << SRCDIR "forwarddeclared.cpp"); test.setProgramHeader( "#define QT_SHAREDPOINTER_TRACK_POINTERS\n" + "#define QT_DEBUG\n" "#include \n" "#include \n" "\n" diff -r fcece45ef507 -r 79de32ba3296 tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp --- a/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp Fri May 14 16:40:13 2010 +0300 @@ -647,7 +647,8 @@ // Connect socket.connectToHost(QtNetworkSettings::serverName(), 143); - QCOMPARE(socket.state(), QTcpSocket::HostLookupState); + QVERIFY(socket.state() == QTcpSocket::HostLookupState || + socket.state() == QTcpSocket::ConnectingState); QTestEventLoop::instance().enterLoop(30); if (QTestEventLoop::instance().timeout()) { @@ -779,7 +780,7 @@ QByteArray hostName = QtNetworkSettings::serverName().toLatin1(); QVERIFY(tmpSocket->state() == QAbstractSocket::ConnectedState); - QVERIFY(tmpSocket->write("GET /mediumfile HTTP/1.0\r\n") > 0); + QVERIFY(tmpSocket->write("GET /qtest/mediumfile HTTP/1.0\r\n") > 0); QVERIFY(tmpSocket->write("HOST: ") > 0); QVERIFY(tmpSocket->write(hostName.data()) > 0); QVERIFY(tmpSocket->write("\r\n") > 0); diff -r fcece45ef507 -r 79de32ba3296 tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp --- a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp Fri May 14 16:40:13 2010 +0300 @@ -181,7 +181,11 @@ QVERIFY_SQL( q, exec("create table " + test3 + "(id int, random varchar(20), randomtwo varchar(20))")); - QVERIFY_SQL( q, exec("create table " + qTableName("test4", __FILE__) + "(column1 varchar(50), column2 varchar(50), column3 varchar(50))")); + if(!tst_Databases::isSqlServer(db)) + QVERIFY_SQL( q, exec("create table " + qTableName("test4", __FILE__) + "(column1 varchar(50), column2 varchar(50), column3 varchar(50))")); + else + QVERIFY_SQL( q, exec("create table " + qTableName("test4", __FILE__) + "(column1 varchar(50), column2 varchar(50) NULL, column3 varchar(50))")); + QVERIFY_SQL( q, exec("create table " + qTableName("emptytable", __FILE__) + "(id int)")); diff -r fcece45ef507 -r 79de32ba3296 tests/auto/qsslsocket/tst_qsslsocket.cpp --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp Fri May 14 16:40:13 2010 +0300 @@ -1271,7 +1271,7 @@ connect(socket, SIGNAL(readyRead()), &setReadBufferSize_task_250027_handler, SLOT(readyReadSlot())); // provoke a response by sending a request - socket->write("GET /gif/fluke.gif HTTP/1.0\n"); // this file is 27 KB + socket->write("GET /qtest/fluke.gif HTTP/1.0\n"); // this file is 27 KB socket->write("Host: "); socket->write(QtNetworkSettings::serverName().toLocal8Bit().constData()); socket->write("\n"); @@ -1735,7 +1735,7 @@ socket->waitForConnected(); socket->waitForEncrypted(); // provoke a response by sending a request - socket->write("GET /gif/fluke.gif HTTP/1.1\n"); + socket->write("GET /qtest/fluke.gif HTTP/1.1\n"); socket->write("Host: "); socket->write(QtNetworkSettings::serverName().toLocal8Bit().constData()); socket->write("\n"); diff -r fcece45ef507 -r 79de32ba3296 tests/auto/qtableview/tst_qtableview.cpp --- a/tests/auto/qtableview/tst_qtableview.cpp Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/qtableview/tst_qtableview.cpp Fri May 14 16:40:13 2010 +0300 @@ -3035,6 +3035,14 @@ << QPoint(0, 0) << 1 << 1; + + QTest::newRow("QTBUG-9631: remove one span") + << 10 << 10 + << (SpanList() << QRect(1, 1, 2, 1) << QRect(2, 2, 2, 2) << QRect(1, 1, 1, 1)) + << false + << QPoint(1, 1) + << 1 + << 1; } void tst_QTableView::spans() diff -r fcece45ef507 -r 79de32ba3296 tests/auto/qtcpsocket/tst_qtcpsocket.cpp --- a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp Fri May 14 16:40:13 2010 +0300 @@ -1116,7 +1116,7 @@ QByteArray hostName = QtNetworkSettings::serverName().toLatin1(); QVERIFY(tmpSocket->state() == QAbstractSocket::ConnectedState); - QVERIFY(tmpSocket->write("GET /mediumfile HTTP/1.0\r\n") > 0); + QVERIFY(tmpSocket->write("GET /qtest/mediumfile HTTP/1.0\r\n") > 0); QVERIFY(tmpSocket->write("HOST: ") > 0); QVERIFY(tmpSocket->write(hostName.data()) > 0); QVERIFY(tmpSocket->write("\r\n") > 0); diff -r fcece45ef507 -r 79de32ba3296 tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp --- a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp Fri May 14 16:40:13 2010 +0300 @@ -870,6 +870,8 @@ { 0x3f8, 0x0 } }, { { 0xd2f, 0xd4d, 0xd15, 0xd4d, 0xd15, 0xd41, 0x0 }, { 0x2ff, 0x0 } }, + { { 0xd30, 0xd4d, 0x200d, 0xd35, 0xd4d, 0xd35, 0x0 }, + { 0xf3, 0x350, 0x0 } }, { {0}, {0} } }; diff -r fcece45ef507 -r 79de32ba3296 tests/auto/qxmlquery/tst_qxmlquery.cpp --- a/tests/auto/qxmlquery/tst_qxmlquery.cpp Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/qxmlquery/tst_qxmlquery.cpp Fri May 14 16:40:13 2010 +0300 @@ -2040,7 +2040,7 @@ return; QTest::newRow("http scheme") - << QUrl(QString("http://" + QtNetworkSettings::serverName() + "/qxmlquery/wellFormed.xml")) + << QUrl(QString("http://" + QtNetworkSettings::serverName() + "/qtest/qxmlquery/wellFormed.xml")) << QByteArray("Some Text"); QTest::newRow("ftp scheme") @@ -2103,10 +2103,10 @@ return; QTest::newRow("http scheme, not well-formed") - << QUrl(QString("http://" + QtNetworkSettings::serverName() + "/qxmlquery/notWellformed.xml")); + << QUrl(QString("http://" + QtNetworkSettings::serverName() + "/qtest/qxmlquery/notWellformed.xml")); QTest::newRow("https scheme, not well-formed") - << QUrl(QString("https://" + QtNetworkSettings::serverName() + "/qxmlquery/notWellformedViaHttps.xml")); + << QUrl(QString("https://" + QtNetworkSettings::serverName() + "/qtest/qxmlquery/notWellformedViaHttps.xml")); QTest::newRow("https scheme, nonexistent host") << QUrl(QLatin1String("https://this.host.does.not.exist.I.SWear")); @@ -2564,7 +2564,7 @@ << QByteArray("This was received via FTP"); QTest::newRow("A valid query via the http scheme") - << QUrl::fromEncoded(QString("http://" + QtNetworkSettings::serverName() + "/qxmlquery/viaHttp.xq").toLatin1()) + << QUrl::fromEncoded(QString("http://" + QtNetworkSettings::serverName() + "/qtest/qxmlquery/viaHttp.xq").toLatin1()) << QByteArray("This was received via HTTP."); } @@ -2630,11 +2630,11 @@ QTest::newRow("A query via http:// that is completely empty, but readable.") << QUrl::fromEncoded(QString( - "http://" + QtNetworkSettings::serverName() + "/qxmlquery/completelyEmptyQuery.xq").toLatin1()); + "http://" + QtNetworkSettings::serverName() + "/qtest/qxmlquery/completelyEmptyQuery.xq").toLatin1()); QTest::newRow("A query via ftp:// that is completely empty, but readable.") << QUrl::fromEncoded(QString( - "ftp://" + QtNetworkSettings::serverName() + "qxmlquery/completelyEmptyQuery.xq").toLatin1()); + "ftp://" + QtNetworkSettings::serverName() + "/pub/qxmlquery/completelyEmptyQuery.xq").toLatin1()); } diff -r fcece45ef507 -r 79de32ba3296 tests/auto/uiloader/baseline/css_scroll.ui --- a/tests/auto/uiloader/baseline/css_scroll.ui Mon May 03 13:17:34 2010 +0300 +++ b/tests/auto/uiloader/baseline/css_scroll.ui Fri May 14 16:40:13 2010 +0300 @@ -14,8 +14,10 @@ Form - QScrollArea { background:red; } -QScrollArea .QWidget { background:transparent; } + QScrollArea { background:red; + border: 5px dashed blue; } +QScrollArea .QWidget { background:transparent; + border: 5px dotted green;} QScrollArea::corner { background:yellow; } @@ -111,10 +113,10 @@ - -60 - -145 - 554 - 575 + 0 + 0 + 520 + 532 diff -r fcece45ef507 -r 79de32ba3296 tests/benchmarks/script/qscriptengine/tst_qscriptengine.cpp --- a/tests/benchmarks/script/qscriptengine/tst_qscriptengine.cpp Mon May 03 13:17:34 2010 +0300 +++ b/tests/benchmarks/script/qscriptengine/tst_qscriptengine.cpp Fri May 14 16:40:13 2010 +0300 @@ -269,19 +269,22 @@ void tst_QScriptEngine::translation_data() { QTest::addColumn("text"); - QTest::newRow("no translation") << "\"hello world\""; - QTest::newRow("qsTr") << "qsTr(\"hello world\")"; - QTest::newRow("qsTranslate") << "qsTranslate(\"\", \"hello world\")"; + QTest::addColumn("fileName"); + QTest::newRow("no translation") << "\"hello world\"" << ""; + QTest::newRow("qsTr") << "qsTr(\"hello world\")" << ""; + QTest::newRow("qsTranslate") << "qsTranslate(\"\", \"hello world\")" << ""; + QTest::newRow("qsTr:script.js") << "qsTr(\"hello world\")" << "script.js"; } void tst_QScriptEngine::translation() { QFETCH(QString, text); + QFETCH(QString, fileName); QScriptEngine engine; engine.installTranslatorFunctions(); QBENCHMARK { - (void)engine.evaluate(text); + (void)engine.evaluate(text, fileName); } } diff -r fcece45ef507 -r 79de32ba3296 tools/linguist/linguist.pro --- a/tools/linguist/linguist.pro Mon May 03 13:17:34 2010 +0300 +++ b/tools/linguist/linguist.pro Fri May 14 16:40:13 2010 +0300 @@ -4,5 +4,3 @@ lrelease \ lupdate \ lconvert -CONFIG += ordered - diff -r fcece45ef507 -r 79de32ba3296 tools/linguist/lupdate/cpp.cpp --- a/tools/linguist/lupdate/cpp.cpp Mon May 03 13:17:34 2010 +0300 +++ b/tools/linguist/lupdate/cpp.cpp Fri May 14 16:40:13 2010 +0300 @@ -65,47 +65,44 @@ class HashString { public: - HashString() : m_hashed(false) {} - explicit HashString(const QString &str) : m_str(str), m_hashed(false) {} - void setValue(const QString &str) { m_str = str; m_hashed = false; } + HashString() : m_hash(0x80000000) {} + explicit HashString(const QString &str) : m_str(str), m_hash(0x80000000) {} + void setValue(const QString &str) { m_str = str; m_hash = 0x80000000; } const QString &value() const { return m_str; } bool operator==(const HashString &other) const { return m_str == other.m_str; } private: QString m_str; + // qHash() of a QString is only 28 bits wide, so we can use + // the highest bit(s) as the "hash valid" flag. mutable uint m_hash; - mutable bool m_hashed; friend uint qHash(const HashString &str); }; uint qHash(const HashString &str) { - if (!str.m_hashed) { - str.m_hashed = true; + if (str.m_hash & 0x80000000) str.m_hash = qHash(str.m_str); - } return str.m_hash; } class HashStringList { public: - explicit HashStringList(const QList &list) : m_list(list), m_hashed(false) {} + explicit HashStringList(const QList &list) : m_list(list), m_hash(0x80000000) {} const QList &value() const { return m_list; } bool operator==(const HashStringList &other) const { return m_list == other.m_list; } private: QList m_list; mutable uint m_hash; - mutable bool m_hashed; friend uint qHash(const HashStringList &list); }; uint qHash(const HashStringList &list) { - if (!list.m_hashed) { - list.m_hashed = true; + if (list.m_hash & 0x80000000) { uint hash = 0; foreach (const HashString &qs, list.m_list) { - hash ^= qHash(qs) ^ 0xa09df22f; - hash = (hash << 13) | (hash >> 19); + hash ^= qHash(qs) ^ 0x0ad9f526; + hash = ((hash << 13) & 0x0fffffff) | (hash >> 15); } list.m_hash = hash; } @@ -215,13 +212,15 @@ private: struct IfdefState { IfdefState() {} - IfdefState(int _braceDepth, int _parenDepth) : + IfdefState(int _bracketDepth, int _braceDepth, int _parenDepth) : + bracketDepth(_bracketDepth), braceDepth(_braceDepth), parenDepth(_parenDepth), elseLine(-1) {} SavedState state; + int bracketDepth, bracketDepth1st; int braceDepth, braceDepth1st; int parenDepth, parenDepth1st; int elseLine; @@ -280,14 +279,14 @@ enum { Tok_Eof, Tok_class, Tok_friend, Tok_namespace, Tok_using, Tok_return, - Tok_tr = 10, Tok_trUtf8, Tok_translate, Tok_translateUtf8, Tok_trid, - Tok_Q_OBJECT = 20, Tok_Q_DECLARE_TR_FUNCTIONS, + Tok_tr, Tok_trUtf8, Tok_translate, Tok_translateUtf8, Tok_trid, + Tok_Q_OBJECT, Tok_Q_DECLARE_TR_FUNCTIONS, Tok_Ident, Tok_Comment, Tok_String, Tok_Arrow, Tok_Colon, Tok_ColonColon, - Tok_Equals, - Tok_LeftBrace = 30, Tok_RightBrace, Tok_LeftParen, Tok_RightParen, Tok_Comma, Tok_Semicolon, - Tok_Null = 40, Tok_Integer, - Tok_QuotedInclude = 50, Tok_AngledInclude, - Tok_Other = 99 + Tok_Equals, Tok_LeftBracket, Tok_RightBracket, + Tok_LeftBrace, Tok_RightBrace, Tok_LeftParen, Tok_RightParen, Tok_Comma, Tok_Semicolon, + Tok_Null, Tok_Integer, + Tok_QuotedInclude, Tok_AngledInclude, + Tok_Other }; // Tokenizer state @@ -299,10 +298,12 @@ QString yyWord; qlonglong yyInteger; QStack yyIfdefStack; + int yyBracketDepth; int yyBraceDepth; int yyParenDepth; int yyLineNo; int yyCurLineNo; + int yyBracketLineNo; int yyBraceLineNo; int yyParenLineNo; @@ -339,9 +340,11 @@ results = new ParseResults; directInclude = false; } + yyBracketDepth = 0; yyBraceDepth = 0; yyParenDepth = 0; yyCurLineNo = 1; + yyBracketLineNo = 1; yyBraceLineNo = 1; yyParenLineNo = 1; yyAtNewline = true; @@ -568,7 +571,7 @@ yyCh = getChar(); if (yyCh == 'f') { // if, ifdef, ifndef - yyIfdefStack.push(IfdefState(yyBraceDepth, yyParenDepth)); + yyIfdefStack.push(IfdefState(yyBracketDepth, yyBraceDepth, yyParenDepth)); yyCh = getChar(); } else if (yyCh == 'n') { // include @@ -607,16 +610,20 @@ if (!yyIfdefStack.isEmpty()) { IfdefState &is = yyIfdefStack.top(); if (is.elseLine != -1) { - if (yyBraceDepth != is.braceDepth1st || yyParenDepth != is.parenDepth1st) - qWarning("%s:%d: Parenthesis/brace mismatch between " + if (yyBracketDepth != is.bracketDepth1st + || yyBraceDepth != is.braceDepth1st + || yyParenDepth != is.parenDepth1st) + qWarning("%s:%d: Parenthesis/bracket/brace mismatch between " "#if and #else branches; using #if branch\n", qPrintable(yyFileName), is.elseLine); } else { + is.bracketDepth1st = yyBracketDepth; is.braceDepth1st = yyBraceDepth; is.parenDepth1st = yyParenDepth; saveState(&is.state); } is.elseLine = yyLineNo; + yyBracketDepth = is.bracketDepth; yyBraceDepth = is.braceDepth; yyParenDepth = is.parenDepth; } @@ -626,10 +633,13 @@ if (!yyIfdefStack.isEmpty()) { IfdefState is = yyIfdefStack.pop(); if (is.elseLine != -1) { - if (yyBraceDepth != is.braceDepth1st || yyParenDepth != is.parenDepth1st) + if (yyBracketDepth != is.bracketDepth1st + || yyBraceDepth != is.braceDepth1st + || yyParenDepth != is.parenDepth1st) qWarning("%s:%d: Parenthesis/brace mismatch between " "#if and #else branches; using #if branch\n", qPrintable(yyFileName), is.elseLine); + yyBracketDepth = is.bracketDepth1st; yyBraceDepth = is.braceDepth1st; yyParenDepth = is.parenDepth1st; loadState(&is.state); @@ -902,6 +912,21 @@ yyParenDepth--; yyCh = getChar(); return Tok_RightParen; + case '[': + if (yyBracketDepth == 0) + yyBracketLineNo = yyCurLineNo; + yyBracketDepth++; + yyCh = getChar(); + return Tok_LeftBracket; + case ']': + if (yyBracketDepth == 0) + qWarning("%s:%d: Excess closing bracket in C++ code" + " (or abuse of the C++ preprocessor)\n", + qPrintable(yyFileName), yyCurLineNo); + else + yyBracketDepth--; + yyCh = getChar(); + return Tok_RightBracket; case ',': yyCh = getChar(); return Tok_Comma; @@ -1537,6 +1562,12 @@ yyCh = getChar(); yyTok = getToken(); while (yyTok != Tok_Eof) { + // these are array indexing operations. we ignore them entirely + // so they don't confuse our scoping of static initializers. + // we enter the loop by either reading a left bracket or by an + // #else popping the state. + while (yyBracketDepth) + yyTok = getToken(); //qDebug() << "TOKEN: " << yyTok; switch (yyTok) { case Tok_QuotedInclude: { @@ -2004,9 +2035,14 @@ } else { context = comment.left(k); comment.remove(0, k + 1); - recordMessage(yyLineNo, context, QString(), comment, extracomment, - QString(), TranslatorMessage::ExtraData(), false, false); + TranslatorMessage msg( + transcode(context, false), QString(), + transcode(comment, false), QString(), + yyFileName, yyLineNo, QStringList(), + TranslatorMessage::Finished, false); + msg.setExtraComment(transcode(extracomment.simplified(), false)); extracomment.clear(); + tor->append(msg); tor->setExtras(extra); extra.clear(); } @@ -2077,6 +2113,9 @@ default: if (!yyParenDepth) prospectiveContext.clear(); + // fallthrough + case Tok_Equals: // for static initializers; other cases make no difference + case Tok_RightBracket: // ignoring indexing; same reason case_default: yyTok = getToken(); break; @@ -2091,6 +2130,10 @@ qWarning("%s:%d: Unbalanced opening parenthesis in C++ code" " (or abuse of the C++ preprocessor)\n", qPrintable(yyFileName), yyParenLineNo); + else if (yyBracketDepth != 0) + qWarning("%s:%d: Unbalanced opening bracket in C++ code" + " (or abuse of the C++ preprocessor)\n", + qPrintable(yyFileName), yyBracketLineNo); } const ParseResults *CppParser::recordResults(bool isHeader) diff -r fcece45ef507 -r 79de32ba3296 tools/tools.pro --- a/tools/tools.pro Mon May 03 13:17:34 2010 +0300 +++ b/tools/tools.pro Fri May 14 16:40:13 2010 +0300 @@ -28,7 +28,8 @@ contains(QT_CONFIG, declarative):SUBDIRS += qmlviewer qmldebugger contains(QT_CONFIG, dbus):SUBDIRS += qdbus -!wince*:contains(QT_CONFIG, xmlpatterns): SUBDIRS += xmlpatterns xmlpatternsvalidator +# We don't need these command line utilities on embedded platforms. +!wince*:!symbian:contains(QT_CONFIG, xmlpatterns): SUBDIRS += xmlpatterns xmlpatternsvalidator embedded: SUBDIRS += makeqpf !wince*:!cross_compile:SUBDIRS += qdoc3 diff -r fcece45ef507 -r 79de32ba3296 translations/designer_fr.ts --- a/translations/designer_fr.ts Mon May 03 13:17:34 2010 +0300 +++ b/translations/designer_fr.ts Fri May 14 16:40:13 2010 +0300 @@ -1166,7 +1166,7 @@ &Pixmap Function - Function de &pixmap + Fonction de &pixmap