From e8b49d0e33ea6c8a2814fcad70015dbcc28e9a5d Mon Sep 17 00:00:00 2001 From: Honglei Zhang Date: Fri, 19 Aug 2011 11:22:38 +0300 Subject: QXmlSimpleReader handle external entity reference file over 1k This commit fixes the bug that causes the QXmlSimpleReader can only handle external reference file less than 1k. Instead of reading the 1k buffer, the system will try to read all data from file into memory. This is not good for memory management. But there doesn't seem to be better solution without breaking the existing API. Task-number: QTBUG-21025 Reviewed-by: Peter Hartmann --- src/xml/sax/qxml.cpp | 8 +++++++- tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/015.ent | Bin 0 -> 2130 bytes tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/015.xml | 6 ++++++ .../qxmlsimplereader/xmldocs/valid/ext-sa/015.xml.ref | 10 ++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100755 tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/015.ent create mode 100644 tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/015.xml create mode 100644 tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/015.xml.ref diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp index 2f5384b..0c7f2ab 100644 --- a/src/xml/sax/qxml.cpp +++ b/src/xml/sax/qxml.cpp @@ -7748,7 +7748,13 @@ bool QXmlSimpleReaderPrivate::processReference() return false; } if (ret) { - QString xmlRefString = ret->data(); + QString xmlRefString; + QString buffer = ret->data(); + while (buffer.length()>0){ + xmlRefString += buffer; + ret->fetchData(); + buffer = ret->data(); + } delete ret; if (!stripTextDecl(xmlRefString)) { reportParseError(QLatin1String(XMLERR_ERRORINTEXTDECL)); diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/015.ent b/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/015.ent new file mode 100755 index 0000000..86a8679 Binary files /dev/null and b/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/015.ent differ diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/015.xml b/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/015.xml new file mode 100644 index 0000000..5550dab --- /dev/null +++ b/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/015.xml @@ -0,0 +1,6 @@ + + +]> +&e; + diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/015.xml.ref b/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/015.xml.ref new file mode 100644 index 0000000..1ec309a --- /dev/null +++ b/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/015.xml.ref @@ -0,0 +1,10 @@ +setDocumentLocator(locator={columnNumber=1, lineNumber=1}) +startDocument() + startDTD(name="doc", publicId="", systemId="") + externalEntityDecl(name="e", publicId="", systemId="015.ent") + endDTD() + startElement(namespaceURI="", localName="doc", qName="doc", atts=[]) + resolveEntity(publicId="", systemId="015.ent", ret={}) + skippedEntity(name="e") + endElement(namespaceURI="", localName="doc", qName="doc") +endDocument() -- cgit v0.12 From 33f65993866e3eb2a80001f1b53f38dbfc7017ce Mon Sep 17 00:00:00 2001 From: Honglei Zhang Date: Mon, 22 Aug 2011 14:42:41 +0300 Subject: Enable running of XQuery test suite Some xmlpatterns auto test cases are still using old script. And some small bugs in test driver prevent the XQuery test suite testing. This commit updated the out-of-date scripts and fixes couple of bugs in test driver. Task-number: QTBUG-16028 Reviewed-by: Dmitry Trofimov --- tests/auto/qxmlquery/tst_qxmlquery.cpp | 1 + tests/auto/qxmlstream/test.xml | 3 + tests/auto/xmlpatternsschemats/Baseline.xml | 2 +- tests/auto/xmlpatternsschemats/ReadMe.txt | 8 +++ .../xmlpatternsschemats/TESTSUITE/updateSuite.sh | 12 +++- tests/auto/xmlpatternssdk/TestSuite.cpp | 1 + tests/auto/xmlpatternssdk/TestSuiteHandler.cpp | 17 +++++ tests/auto/xmlpatternssdk/TestSuiteHandler.h | 4 ++ tests/auto/xmlpatternssdk/Worker.cpp | 2 +- tests/auto/xmlpatternssdk/XSDTestSuiteHandler.cpp | 1 + tests/auto/xmlpatternsxqts/Baseline.xml | 2 - .../auto/xmlpatternsxqts/TESTSUITE/updateSuite.sh | 72 ++++++++++++++++++++++ tests/auto/xmlpatternsxqts/tst_suitetest.cpp | 5 +- tests/auto/xmlpatternsxqts/tst_xmlpatternsxqts.cpp | 26 +------- tests/auto/xmlpatternsxslts/XSLTS/updateSuite.sh | 17 +++-- 15 files changed, 133 insertions(+), 40 deletions(-) create mode 100644 tests/auto/qxmlstream/test.xml create mode 100644 tests/auto/xmlpatternsschemats/ReadMe.txt delete mode 100644 tests/auto/xmlpatternsxqts/Baseline.xml create mode 100755 tests/auto/xmlpatternsxqts/TESTSUITE/updateSuite.sh diff --git a/tests/auto/qxmlquery/tst_qxmlquery.cpp b/tests/auto/qxmlquery/tst_qxmlquery.cpp index 1d3a0bc..e443720 100644 --- a/tests/auto/qxmlquery/tst_qxmlquery.cpp +++ b/tests/auto/qxmlquery/tst_qxmlquery.cpp @@ -55,6 +55,7 @@ #include #include #include +#include #include "MessageSilencer.h" #include "MessageValidator.h" diff --git a/tests/auto/qxmlstream/test.xml b/tests/auto/qxmlstream/test.xml new file mode 100644 index 0000000..797fd3b --- /dev/null +++ b/tests/auto/qxmlstream/test.xml @@ -0,0 +1,3 @@ + + + diff --git a/tests/auto/xmlpatternsschemats/Baseline.xml b/tests/auto/xmlpatternsschemats/Baseline.xml index 9576538..16878bc 100644 --- a/tests/auto/xmlpatternsschemats/Baseline.xml +++ b/tests/auto/xmlpatternsschemats/Baseline.xml @@ -1,2 +1,2 @@ -

Patternist is an implementation written in C++ and with the Qt/KDE libraries. It is licensed under GNU LGPL and part of KDE, the K Desktop Environment.

XQuery
\ No newline at end of file +

Patternist is an implementation written in C++ and with the Qt/KDE libraries. It is licensed under GNU LGPL and part of KDE, the K Desktop Environment.

XQuery
\ No newline at end of file diff --git a/tests/auto/xmlpatternsschemats/ReadMe.txt b/tests/auto/xmlpatternsschemats/ReadMe.txt new file mode 100644 index 0000000..0bf6d17 --- /dev/null +++ b/tests/auto/xmlpatternsschemats/ReadMe.txt @@ -0,0 +1,8 @@ +This testing requires test suite which is available from w3c website. Download, unpack and transform the test suite will take quite long time. This test is normally skipped. To get the test run, following steps are required: + +- Linux environment is normally required to retrieve and prepare test suite +- wget, Java should be preinstalled +- install Saxon(version 9 or upwards) +- Run updateSuite.sh under TESTSUITE +- create file runTests in the same directory of auto test executable. For example: touch runTests + diff --git a/tests/auto/xmlpatternsschemats/TESTSUITE/updateSuite.sh b/tests/auto/xmlpatternsschemats/TESTSUITE/updateSuite.sh index 0297db5..a61f0a1 100755 --- a/tests/auto/xmlpatternsschemats/TESTSUITE/updateSuite.sh +++ b/tests/auto/xmlpatternsschemats/TESTSUITE/updateSuite.sh @@ -44,6 +44,9 @@ # # NOTE: the files checked out CANNOT be added to Qt's # repository at the moment, due to legal complications. +# +# To run the script, Saxon package version 9 and above shall be installed +# DIRECTORY_NAME="xmlschema2006-11-06" ARCHIVE_NAME="xsts-2007-06-20.tar.gz" @@ -54,7 +57,10 @@ wget http://www.w3.org/XML/2004/xml-schema-test-suite/xmlschema2006-11-06/$ARCHI tar -xzf $ARCHIVE_NAME rm $ARCHIVE_NAME -CVSROOT=:pserver:anonymous@dev.w3.org:/sources/public cvs login -CVSROOT=:pserver:anonymous@dev.w3.org:/sources/public cvs checkout -d xmlschema2006-11-06-new XML/xml-schema-test-suite/2004-01-14/xmlschema2006-11-06 +# cvs script is used to retrive newer version of test suite. +#CVSROOT=:pserver:anonymous@dev.w3.org:/sources/public cvs login +#CVSROOT=:pserver:anonymous@dev.w3.org:/sources/public cvs checkout -d xmlschema2006-11-06-new XML/xml-schema-test-suite/2004-01-14/xmlschema2006-11-06 + +#Saxon need to be installed before the following command works. +java -jar /usr/share/java/saxon.jar -xsl:unifyCatalog.xsl -s:$DIRECTORY_NAME/suite.xml > testSuites.xml -java net.sf.saxon.Transform -xsl:unifyCatalog.xsl $DIRECTORY_NAME/suite.xml > testSuites.xml diff --git a/tests/auto/xmlpatternssdk/TestSuite.cpp b/tests/auto/xmlpatternssdk/TestSuite.cpp index e24786a..db94f25 100644 --- a/tests/auto/xmlpatternssdk/TestSuite.cpp +++ b/tests/auto/xmlpatternssdk/TestSuite.cpp @@ -151,6 +151,7 @@ TestSuite *TestSuite::openCatalog(QIODevice *input, } reader.setContentHandler(loader.data()); + reader.setEntityResolver(loader.data()); QXmlInputSource source(input); diff --git a/tests/auto/xmlpatternssdk/TestSuiteHandler.cpp b/tests/auto/xmlpatternssdk/TestSuiteHandler.cpp index 74a6082..c46350a 100644 --- a/tests/auto/xmlpatternssdk/TestSuiteHandler.cpp +++ b/tests/auto/xmlpatternssdk/TestSuiteHandler.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include +#include #include "qacceltreeresourceloader_p.h" #include "qnetworkaccessdelegator_p.h" @@ -308,5 +309,21 @@ TestSuite *TestSuiteHandler::testSuite() const return m_ts; } +bool TestSuiteHandler::resolveEntity(const QString& publicId, + const QString& systemId, + QXmlInputSource*& ret) +{ + QFileInfo catFileName(m_catalogFile.path()); + QFileInfo externalFileName(catFileName.absolutePath(), systemId); + QFile *file = new QFile(externalFileName.absoluteFilePath()); + if (file->open(QIODevice::ReadOnly | QIODevice::Text)) { + ret = new QXmlInputSource(file); + return true; + } + return false; + //return QXmlDefaultHandler::resolveEntity(publicId, systemId, ret); +} + + // vim: et:ts=4:sw=4:sts=4 diff --git a/tests/auto/xmlpatternssdk/TestSuiteHandler.h b/tests/auto/xmlpatternssdk/TestSuiteHandler.h index 7a46145..2d6a22f 100644 --- a/tests/auto/xmlpatternssdk/TestSuiteHandler.h +++ b/tests/auto/xmlpatternssdk/TestSuiteHandler.h @@ -94,6 +94,10 @@ namespace QPatternistSDK const QString &qName, const QXmlAttributes &atts); + virtual bool resolveEntity(const QString& publicId, + const QString& systemId, + QXmlInputSource*& ret); + virtual TestSuite *testSuite() const; private: diff --git a/tests/auto/xmlpatternssdk/Worker.cpp b/tests/auto/xmlpatternssdk/Worker.cpp index f2051cc..4fb7da7 100644 --- a/tests/auto/xmlpatternssdk/Worker.cpp +++ b/tests/auto/xmlpatternssdk/Worker.cpp @@ -183,7 +183,7 @@ void Worker::threadFinished() const int totPass = count(m_result, TestResult::Pass); const int total = resultCount; const int notTested = m_notTested.count(); - const int percentage = int((static_cast(totPass) / total) * 100); + const int percentage = total==0 ? 0 : int((static_cast(totPass) / total) * 100); Q_ASSERT_X(percentage >= 0 && percentage <= 100, Q_FUNC_INFO, qPrintable(QString(QLatin1String("Percentage was: %1")).arg(percentage))); diff --git a/tests/auto/xmlpatternssdk/XSDTestSuiteHandler.cpp b/tests/auto/xmlpatternssdk/XSDTestSuiteHandler.cpp index 5b6fb90..9036dad 100644 --- a/tests/auto/xmlpatternssdk/XSDTestSuiteHandler.cpp +++ b/tests/auto/xmlpatternssdk/XSDTestSuiteHandler.cpp @@ -793,6 +793,7 @@ XSDTestSuiteHandler::XSDTestSuiteHandler(const QUrl &catalogFile) : m_ts(0) << QLatin1String("schZ012_a") << QLatin1String("stZ041") << QLatin1String("wildZ010"); + } bool XSDTestSuiteHandler::startElement(const QString &namespaceURI, diff --git a/tests/auto/xmlpatternsxqts/Baseline.xml b/tests/auto/xmlpatternsxqts/Baseline.xml deleted file mode 100644 index d9be95a..0000000 --- a/tests/auto/xmlpatternsxqts/Baseline.xml +++ /dev/null @@ -1,2 +0,0 @@ - -

Patternist is an implementation written in C++ and with the Qt/KDE libraries. It is licensed under GNU LGPL and part of KDE, the K Desktop Environment.

XQuery
\ No newline at end of file diff --git a/tests/auto/xmlpatternsxqts/TESTSUITE/updateSuite.sh b/tests/auto/xmlpatternsxqts/TESTSUITE/updateSuite.sh new file mode 100755 index 0000000..1157f51 --- /dev/null +++ b/tests/auto/xmlpatternsxqts/TESTSUITE/updateSuite.sh @@ -0,0 +1,72 @@ +#!/bin/sh +############################################################################# +## +## Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +## All rights reserved. +## Contact: Nokia Corporation (qt-info@nokia.com) +## +## This file is the build configuration utility of the Qt Toolkit. +## +## $QT_BEGIN_LICENSE:LGPL$ +## GNU Lesser General Public License Usage +## This file may be used under the terms of the GNU Lesser General Public +## License version 2.1 as published by the Free Software Foundation and +## appearing in the file LICENSE.LGPL included in the packaging of this +## file. Please review the following information to ensure the GNU Lesser +## General Public License version 2.1 requirements will be met: +## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +## +## In addition, as a special exception, Nokia gives you certain additional +## rights. These rights are described in the Nokia Qt LGPL Exception +## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +## +## GNU General Public License Usage +## Alternatively, this file may be used under the terms of the GNU General +## Public License version 3.0 as published by the Free Software Foundation +## and appearing in the file LICENSE.GPL included in the packaging of this +## file. Please review the following information to ensure the GNU General +## Public License version 3.0 requirements will be met: +## http://www.gnu.org/copyleft/gpl.html. +## +## Other Usage +## Alternatively, this file may be used in accordance with the terms and +## conditions contained in a signed written agreement between you and Nokia. +## +## +## +## +## +## $QT_END_LICENSE$ +## +############################################################################# + +# This script updates the suite from W3C's CVS server. +# +# NOTE: the files checked out CANNOT be added to Qt's +# repository at the moment, due to legal complications. However, +# when the test suite is publically released, it is possible as +# according to W3C's usual license agreements. + +echo "*** This script typically doesn't need to be run." + +# There are two ways to retrieve test suites, via cvs or direct downloading. +# CVS always receive the latest release. + +# download test suite from http://dev.w3.org/2006/xquery-test-suite/ + +TMPFILE='tmpfile' +wget http://dev.w3.org/2006/xquery-test-suite/PublicPagesStagingArea/XQTS_1_0_3.zip -O $TMPFILE +unzip $TMPFILE +rm $TMPFILE + +# This is W3C's internal CVS server, not the public dev.w3.org. +# export CVSROOT=":pserver:anonymous@dev.w3.org:/sources/public" + +# echo "*** Enter 'anonymous' as password. ***" +# cvs login +# cvs get 2006/xquery-test-suite + +# Substitute entity values for entity references +mv XQTSCatalog.xml XQTSCatalogUnsolved.xml +xmllint -noent -output XQTSCatalog.xml XQTSCatalogUnsolved.xml + diff --git a/tests/auto/xmlpatternsxqts/tst_suitetest.cpp b/tests/auto/xmlpatternsxqts/tst_suitetest.cpp index 76b7893..19adc0b 100644 --- a/tests/auto/xmlpatternsxqts/tst_suitetest.cpp +++ b/tests/auto/xmlpatternsxqts/tst_suitetest.cpp @@ -66,9 +66,6 @@ tst_SuiteTest::tst_SuiteTest(const SuiteType suiteType, /*! Returns an absolute path to the XQTS catalog, or flags a failure using QTestLib's mechanisms. - - Finding the location of the catalog is done with `p4 where` such that we don't have - to care about where it is checked out. */ void tst_SuiteTest::initTestCase() { @@ -87,7 +84,7 @@ void tst_SuiteTest::runTestSuite() const const QFileInfo fi(m_catalogPath); const QUrl catalogPath(QUrl::fromLocalFile(fi.absoluteFilePath())); - TestSuite::SuiteType suiteType; + TestSuite::SuiteType suiteType(TestSuite::XQuerySuite); switch (m_suiteType) { case XQuerySuite: suiteType = TestSuite::XQuerySuite; diff --git a/tests/auto/xmlpatternsxqts/tst_xmlpatternsxqts.cpp b/tests/auto/xmlpatternsxqts/tst_xmlpatternsxqts.cpp index ec14872..7caaf89 100644 --- a/tests/auto/xmlpatternsxqts/tst_xmlpatternsxqts.cpp +++ b/tests/auto/xmlpatternsxqts/tst_xmlpatternsxqts.cpp @@ -70,30 +70,8 @@ void tst_XmlPatternsXQTS::catalogPath(QString &write) const if(dontRun()) QSKIP("This test takes too long time to run on the majority of platforms.", SkipAll); - QProcess p4; - - QStringList arguments; - arguments << QLatin1String("where") - << QLatin1String("//depot/autotests/4.4/tests/auto/xmlpatternsxqts/XQTS/XQTSCatalog.xml"); - p4.start(QLatin1String("p4"), arguments); - QVERIFY(p4.waitForFinished()); - QCOMPARE(p4.exitCode(), 0); - QCOMPARE(p4.exitStatus(), QProcess::NormalExit); - - /* `p4 where' prints for instance: - * - * //depot/qt/4.4/tests/auto/xmlpatternsxqts/... //fenglich-englich/qt-4.4/tests/auto/xmlpatternsxqts/... /home/fenglich/dev/autotests/4.4/tests/auto/xmlpatternsxqts/XQTS/XQTSCatalog.xml - * - * so we want the last string. - */ - write = QString::fromLocal8Bit(p4.readAllStandardOutput()).split(QLatin1Char(' ')).last().trimmed(); - - if(write.isEmpty() || !QFile::exists(write)) - { - QEXPECT_FAIL("", "//depot/autotests/4.4/tests/auto/xmlpatternsxqts/XQTS/ must be part of the perforce client spec, " - "checked out at an arbitrary location, for this test to run. The test suite will now be skipped.", Abort); - QVERIFY(false); - } + write = QLatin1String("TESTSUITE/XQTSCatalog.xml"); + return; } QTEST_MAIN(tst_XmlPatternsXQTS) diff --git a/tests/auto/xmlpatternsxslts/XSLTS/updateSuite.sh b/tests/auto/xmlpatternsxslts/XSLTS/updateSuite.sh index 52a5b07..1bac5ec 100755 --- a/tests/auto/xmlpatternsxslts/XSLTS/updateSuite.sh +++ b/tests/auto/xmlpatternsxslts/XSLTS/updateSuite.sh @@ -47,14 +47,21 @@ # when the test suite is publically released, it is possible as # according to W3C's usual license agreements. -echo "*** This script typically doesn't need to be run, and it needs to be updated anyway." -exit 1 +echo "*** This script typically doesn't need to be run. Test Suite is not available. So, this test is only a place holder! ***" +exit 0 + +# Download the test suite +TMPFILE='tmpfile' +wget http://www.w3.org/Style/XSL/XSL-TestSuite.zip -O $TMPFILE +unzip $TMPFILE +rm $TMPFILE + # This is W3C's internal CVS server, not the public dev.w3.org. -export CVSROOT="fenglich@cvs.w3.org:path is currently unknown" +# export CVSROOT="fenglich@cvs.w3.org:path is currently unknown" -echo "*** Enter 'anonymous' as password. ***" -cvs login +# echo "*** Enter 'anonymous' as password. ***" +# cvs login mv catalog.xml catalogUnresolved.xml xmllint --noent --output catalog.xml catalogUnresolved.xml -- cgit v0.12 From ac10a99e642c9005efc7639583fcb726acc169fd Mon Sep 17 00:00:00 2001 From: mread Date: Wed, 24 Aug 2011 13:04:02 +0100 Subject: Giving QUuid::createUuid() more entropy on Symbian QUuid::createUuid() uuids have low entropy on Symbian, giving a dangerously high probability of collision. This change adds in more entropy from the kernel tick count to reduce the possibility of collision. Task-number: QTBUG-21072 Reviewed-by: Sami Merila --- src/corelib/plugin/quuid.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp index af63b79..83c6194 100644 --- a/src/corelib/plugin/quuid.cpp +++ b/src/corelib/plugin/quuid.cpp @@ -901,6 +901,12 @@ QUuid QUuid::createUuid() uint randNumber = 0; for (int filled = 0; filled < intbits; filled += randbits) randNumber |= qrand()< Date: Tue, 23 Aug 2011 12:18:54 +0300 Subject: Fix def file paths for Symbian shadow builds Def file paths are now generated absolute Task-number: QTBUG-10703 Reviewed-by: Sami Merila --- mkspecs/features/symbian/def_files.prf | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/mkspecs/features/symbian/def_files.prf b/mkspecs/features/symbian/def_files.prf index 746de6a..a78c74e 100644 --- a/mkspecs/features/symbian/def_files.prf +++ b/mkspecs/features/symbian/def_files.prf @@ -30,28 +30,32 @@ symbian-abld|symbian-sbsv2 { # statements - they use the qmake generated statements instead # Static libraries obviously don't have DEF files, as they don't take part in dynamic linkage !contains(TEMPLATE, app):!contains(CONFIG, plugin):!contains(CONFIG, staticlib): { + # Symbian DEFFILE statements do not like drive letters, so remove it from the pro path. + FIXED_PRO_PATH = $$replace(_PRO_FILE_PWD_, "^.:", "")/ !isEmpty(DEF_FILE) { + contains(DEF_FILE,"^/.*"): FIXED_PRO_PATH = defBlock = \ "$${LITERAL_HASH}ifdef WINSCW" \ - "DEFFILE $$DEF_FILE/bwins/$${clean_TARGET}.def" \ + "DEFFILE $$FIXED_PRO_PATH$$DEF_FILE/bwins/$${clean_TARGET}.def" \ "$${LITERAL_HASH}elif defined EABI" \ - "DEFFILE $$DEF_FILE/eabi/$${clean_TARGET}.def" \ + "DEFFILE $$FIXED_PRO_PATH$$DEF_FILE/eabi/$${clean_TARGET}.def" \ "$${LITERAL_HASH}endif" } else:!isEmpty(defFilePath) { + contains(defFilePath,"^/.*"): FIXED_PRO_PATH = defBlock = \ "$${LITERAL_HASH}ifdef WINSCW" \ - "DEFFILE $$defFilePath/bwins/$${clean_TARGET}.def" \ + "DEFFILE $$FIXED_PRO_PATH$$defFilePath/bwins/$${clean_TARGET}.def" \ "$${LITERAL_HASH}elif defined EABI" \ - "DEFFILE $$defFilePath/eabi/$${clean_TARGET}.def" \ + "DEFFILE $$FIXED_PRO_PATH$$defFilePath/eabi/$${clean_TARGET}.def" \ "$${LITERAL_HASH}endif" } else { # If defFilePath is not defined, then put the folders containing the DEF files at the # same level as the .pro (and generated MMP) file(s) defBlock = \ "$${LITERAL_HASH}ifdef WINSCW" \ - "DEFFILE ./bwins/$${clean_TARGET}.def" \ + "DEFFILE $${FIXED_PRO_PATH}bwins/$${clean_TARGET}.def" \ "$${LITERAL_HASH}elif defined EABI" \ - "DEFFILE ./eabi/$${clean_TARGET}.def" \ + "DEFFILE $${FIXED_PRO_PATH}eabi/$${clean_TARGET}.def" \ "$${LITERAL_HASH}endif" } MMP_RULES += defBlock -- cgit v0.12 From a9822d39136a3f7912cc68320cfe030d95b4cb4f Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 24 Aug 2011 15:56:02 +0300 Subject: Improved support for shadow builds in Symbian. It is now possible to make shadow builds in Symbian. Note that any relative host side paths specified via BLD_INF_RULES, MMP_RULES, or DEPLOYMENT pkg_*rules are NOT automatically converted to point to build directory. Task-number: QTBUG-10432 Rubber-stamped-by: ossi Reviewed-by: TrustMe --- doc/src/development/qmake-manual.qdoc | 12 ++++++++++++ mkspecs/features/symbian/application_icon.prf | 4 +--- qmake/generators/makefile.cpp | 13 ++++++++----- qmake/generators/symbian/symbiancommon.cpp | 6 ++++-- qmake/generators/symbian/symmake.cpp | 26 +++++++++++--------------- qmake/generators/symbian/symmake.h | 1 + qmake/generators/symbian/symmake_abld.cpp | 3 ++- qmake/generators/symbian/symmake_sbsv2.cpp | 19 ++++++++----------- 8 files changed, 47 insertions(+), 37 deletions(-) diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index 329bac5..2c7fda2 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -1184,6 +1184,10 @@ Any rules you define will be added after automatically generated rules in each section. + \note Content specified using \c BLD_INF_RULES is inserted as-is into the \c bld.inf + file, so any rules that specify host side paths may not work correctly when doing + a shadow build. + \target CONFIG \section1 CONFIG @@ -1521,6 +1525,10 @@ override languages statement, you must override also package-header statement and all other statements which are language specific. + \note Custom deployments specified using \c pkg_postrules are inserted + as-is into the \c PKG file, so any rules that specify host side paths may not + work correctly when doing a shadow build. + On the Symbian platform, three separate PKG files are generated: \list @@ -1911,6 +1919,10 @@ \c TARGET.EPOCSTACKSIZE. Doing so could result in duplicate statements in the MMP file. + \note Content specified using \c MMP_RULES is inserted as-is into the \c MMP + file, so any rules that specify host side paths may not work correctly when doing + a shadow build. + \target MOC_DIR \section1 MOC_DIR diff --git a/mkspecs/features/symbian/application_icon.prf b/mkspecs/features/symbian/application_icon.prf index f058399..dc23428 100644 --- a/mkspecs/features/symbian/application_icon.prf +++ b/mkspecs/features/symbian/application_icon.prf @@ -45,9 +45,7 @@ contains(CONFIG, no_icon) { # Note: symbian-sbsv2 builds can't utilize extra compiler for mifconv, so ICON handling is done in code !symbian-sbsv2 { # Absolute path required for shadow builds. - # However, in older Symbian environments abld toolchain can't handle even moderately long - # paths, so don't force absolute there. - !symbian-abld:!contains(ICON, "^(/|\\\\|.:).*"):ICON = $$_PRO_FILE_PWD_/$$ICON + !contains(ICON, "^(/|\\\\|.:).*"):ICON = $$_PRO_FILE_PWD_/$$ICON #Makefile: requires paths with backslash ICON_backslashed = $$ICON diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 00f6b4a..b9de92d 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -1769,6 +1769,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) { QString clean_targets; const QStringList &quc = project->values("QMAKE_EXTRA_COMPILERS"); + QDir outputDir(Option::output_dir); for(QStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) { QString tmp_out = fileFixify(project->values((*it) + ".output").first(), Option::output_dir, Option::output_dir); @@ -1960,9 +1961,11 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) QString cmd; if (isForSymbianSbsv2()) { // In sbsv2 the command inputs and outputs need to use absolute paths - cmd = replaceExtraCompilerVariables(tmp_cmd, - fileFixify(escapeFilePaths(inputs), FileFixifyAbsolute), - fileFixify(QStringList(tmp_out), FileFixifyAbsolute)); + QStringList absoluteInputs; + for (int i = 0; i < inputs.size(); ++i) + absoluteInputs.append(escapeFilePath(outputDir.absoluteFilePath(inputs.at(i)))); + cmd = replaceExtraCompilerVariables(tmp_cmd, absoluteInputs, + QStringList(outputDir.absoluteFilePath(tmp_out))); } else { cmd = replaceExtraCompilerVariables(tmp_cmd, escapeFilePaths(inputs), QStringList(tmp_out)); } @@ -1996,8 +1999,8 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) if (isForSymbianSbsv2()) { // In sbsv2 the command inputs and outputs need to use absolute paths cmd = replaceExtraCompilerVariables(tmp_cmd, - fileFixify((*input), FileFixifyAbsolute), - fileFixify(out, FileFixifyAbsolute)); + outputDir.absoluteFilePath(*input), + outputDir.absoluteFilePath(out)); } else { cmd = replaceExtraCompilerVariables(tmp_cmd, (*input), out); } diff --git a/qmake/generators/symbian/symbiancommon.cpp b/qmake/generators/symbian/symbiancommon.cpp index d4db4b9..c9ffa11 100644 --- a/qmake/generators/symbian/symbiancommon.cpp +++ b/qmake/generators/symbian/symbiancommon.cpp @@ -503,9 +503,11 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, twf << wrapperStreamBuffer << endl; // Wrapped files deployment - QString currentPath = qmake_getpwd(); + QString currentPath = Option::output_dir; + if (!currentPath.endsWith(QLatin1Char('/'))) + currentPath += QLatin1Char('/'); QString sisName = QString("%1.sis").arg(fixedTarget); - twf << "\"" << currentPath << "/" << sisName << "\" - \"!:\\private\\2002CCCE\\import\\" << sisName << "\"" << endl; + twf << "\"" << currentPath << sisName << "\" - \"!:\\private\\2002CCCE\\import\\" << sisName << "\"" << endl; QString bootStrapPath = QLibraryInfo::location(QLibraryInfo::PrefixPath); bootStrapPath.append("/smartinstaller.sis"); diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index bdba329..694bbfb 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -126,8 +126,7 @@ QString SymbianMakefileGenerator::absolutizePath(const QString& origPath) if (resultPath.startsWith("/epoc32/", Qt::CaseInsensitive)) resultPath = QDir::fromNativeSeparators(qt_epocRoot()) + resultPath.mid(1); - QFileInfo fi(fileInfo(resultPath)); - + QFileInfo fi(outputDir, resultPath); // Since origPath can be something given in HEADERS, we need to check if we are dealing // with a file or a directory. In case the origPath doesn't yet exist, isFile() returns // false and we default to assuming it is a dir. @@ -271,6 +270,8 @@ void SymbianMakefileGenerator::init() MakefileGenerator::init(); SymbianCommonGenerator::init(); + outputDir = QDir(Option::output_dir); + if (0 != project->values("QMAKE_PLATFORM").size()) platform = varGlue("QMAKE_PLATFORM", "", " ", ""); @@ -338,7 +339,6 @@ void SymbianMakefileGenerator::initMmpVariables() srcpaths << project->values("UNUSED_SOURCES") << project->values("UI_SOURCES_DIR"); srcpaths << project->values("UI_DIR"); - QDir current = QDir::current(); QString absolutizedCurrent = absolutizePath("."); for (int j = 0; j < srcpaths.size(); ++j) { @@ -373,12 +373,12 @@ void SymbianMakefileGenerator::initMmpVariables() QStringList temporary; for (int i = 0; i < sysincspaths.size(); ++i) { QString origPath = sysincspaths.at(i); - QFileInfo origPathInfo(fileInfo(origPath)); + QFileInfo origPathInfo(outputDir, origPath); bool bFound = false; for (int j = 0; j < temporary.size(); ++j) { QString tmpPath = temporary.at(j); - QFileInfo tmpPathInfo(fileInfo(tmpPath)); + QFileInfo tmpPathInfo(outputDir, tmpPath); if (origPathInfo.absoluteFilePath() == tmpPathInfo.absoluteFilePath()) { bFound = true; @@ -515,14 +515,12 @@ void SymbianMakefileGenerator::writeMmpFile(QString &filename, const SymbianLoca writeMmpFileIncludePart(t); - QDir current = QDir::current(); - for (QMap::iterator it = sources.begin(); it != sources.end(); ++it) { QStringList values = it.value(); QString currentSourcePath = it.key(); if (values.size()) - t << "SOURCEPATH \t" << fixPathForMmp(currentSourcePath, current) << endl; + t << "SOURCEPATH \t" << fixPathForMmp(currentSourcePath, Option::output_dir) << endl; for (int i = 0; i < values.size(); ++i) { QString sourceFileName = values.at(i); @@ -709,13 +707,11 @@ void SymbianMakefileGenerator::writeMmpFileResourcePart(QTextStream& t, const Sy void SymbianMakefileGenerator::writeMmpFileSystemIncludePart(QTextStream& t) { - QDir current = QDir::current(); - for (QMap::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { QStringList values = it.value(); for (int i = 0; i < values.size(); ++i) { QString handledPath = values.at(i); - t << "SYSTEMINCLUDE\t\t" << fixPathForMmp(handledPath, current) << endl; + t << "SYSTEMINCLUDE\t\t" << fixPathForMmp(handledPath, Option::output_dir) << endl; } } @@ -1105,7 +1101,7 @@ void SymbianMakefileGenerator::generateDistcleanTargets(QTextStream& t) fromFile = item.endsWith(Option::pro_ext); fixedItem = item; } - QFileInfo fi(fileInfo(fixedItem)); + QFileInfo fi(outputDir, fixedItem); if (!fromFile) { t << "\t-$(MAKE) -f \"" << Option::fixPathToTargetOS(fi.absoluteFilePath() + "/Makefile") << "\" dodistclean" << endl; } else { @@ -1118,19 +1114,19 @@ void SymbianMakefileGenerator::generateDistcleanTargets(QTextStream& t) } - generatedFiles << Option::fixPathToTargetOS(fileInfo(Option::output.fileName()).absoluteFilePath()); // bld.inf + generatedFiles << Option::output.fileName(); // bld.inf generatedFiles << project->values("QMAKE_INTERNAL_PRL_FILE"); // Add generated prl files for cleanup generatedFiles << project->values("QMAKE_DISTCLEAN"); // Add any additional files marked for distclean QStringList fixedFiles; QStringList fixedDirs; foreach(QString item, generatedFiles) { - QString fixedItem = Option::fixPathToTargetOS(fileInfo(item).absoluteFilePath()); + QString fixedItem = Option::fixPathToTargetOS(outputDir.absoluteFilePath(item)); if (!fixedFiles.contains(fixedItem)) { fixedFiles << fixedItem; } } foreach(QString item, generatedDirs) { - QString fixedItem = Option::fixPathToTargetOS(fileInfo(item).absoluteFilePath()); + QString fixedItem = Option::fixPathToTargetOS(outputDir.absoluteFilePath(item)); if (!fixedDirs.contains(fixedItem)) { fixedDirs << fixedItem; } diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h index 053b275..1dfb102 100644 --- a/qmake/generators/symbian/symmake.h +++ b/qmake/generators/symbian/symmake.h @@ -66,6 +66,7 @@ protected: // (output file) (source , command) QMap makmakeCommands; QStringList overriddenMmpKeywords; + QDir outputDir; QString fixPathForMmp(const QString& origPath, const QDir& parentDir); QString absolutizePath(const QString& origPath); diff --git a/qmake/generators/symbian/symmake_abld.cpp b/qmake/generators/symbian/symmake_abld.cpp index 7863dca..7026355 100644 --- a/qmake/generators/symbian/symmake_abld.cpp +++ b/qmake/generators/symbian/symmake_abld.cpp @@ -70,7 +70,8 @@ SymbianAbldMakefileGenerator::~SymbianAbldMakefileGenerator() { } void SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, bool deploymentOnly) { - QFile ft(gnuMakefileName); + QString mkFullPath = Option::output_dir + QLatin1Char('/') + gnuMakefileName; + QFile ft(mkFullPath); if (ft.open(QIODevice::WriteOnly)) { generatedFiles << ft.fileName(); QTextStream t(&ft); diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp index 78a9024..cc32f8d 100644 --- a/qmake/generators/symbian/symmake_sbsv2.cpp +++ b/qmake/generators/symbian/symmake_sbsv2.cpp @@ -624,11 +624,11 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t // are not necessary. QStringList allPreDeps; foreach(QString item, project->values("PRE_TARGETDEPS")) { - allPreDeps.append(fileInfo(item).absoluteFilePath()); + allPreDeps.append(QDir::cleanPath(outputDir.absoluteFilePath(item))); } foreach (QString item, project->values("GENERATED_SOURCES")) { - allPreDeps.append(fileInfo(item).absoluteFilePath()); + allPreDeps.append(QDir::cleanPath(outputDir.absoluteFilePath(item))); } for (QMap::iterator it = sources.begin(); it != sources.end(); ++it) { @@ -638,7 +638,7 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t QString sourceFile = currentSourcePath + "/" + values.at(i); QStringList deps = findDependencies(QDir::toNativeSeparators(sourceFile)); foreach(QString depItem, deps) { - appendIfnotExist(allPreDeps, fileInfo(depItem).absoluteFilePath()); + appendIfnotExist(allPreDeps, QDir::cleanPath(outputDir.absoluteFilePath(depItem))); } } } @@ -649,7 +649,7 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t foreach(QString item, extraTargets) { foreach(QString targetItem, project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_TARGETS.") + item)) { // Make sure targetpath is absolute - QString absoluteTarget = fileInfo(targetItem).absoluteFilePath(); + QString absoluteTarget = QDir::cleanPath(outputDir.absoluteFilePath(targetItem)); if (allPreDeps.contains(absoluteTarget)) { QStringList deps = project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_DEPS.") + item + targetItem); QString commandItem = project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_CMD.") + item + targetItem).join(" "); @@ -658,7 +658,7 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t QString absoluteDeps; foreach (QString depItem, deps) { if (!depItem.isEmpty()) { - absoluteDeps.append(fileInfo(depItem).absoluteFilePath()); + absoluteDeps.append(QDir::cleanPath(outputDir.absoluteFilePath(depItem))); absoluteDeps.append(" "); } } @@ -723,9 +723,7 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t QFileInfo iconInfo = fileInfo(icon); - QFileInfo bldinf(project->values("MAKEFILE").first()); - QString iconPath = bldinf.dir().relativeFilePath(iconInfo.path()); - + QString iconPath = outputDir.relativeFilePath(iconInfo.absolutePath()); QString iconFile = iconInfo.baseName(); QFileInfo iconTargetInfo = fileInfo(iconTargetFile); @@ -747,11 +745,10 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t if (!cleanFiles.isEmpty()) { QStringList absoluteCleanFiles; foreach (QString cleanFile, cleanFiles) { - QFileInfo fi(cleanFile); QString fileName = QLatin1String("\""); - fileName.append(fi.absoluteFilePath()); + fileName.append(QDir::cleanPath(outputDir.absoluteFilePath(cleanFile))); fileName.append(QLatin1String("\"")); - absoluteCleanFiles << fileName; + absoluteCleanFiles << fileName; } t << "START EXTENSION qt/qmake_clean" << endl; t << "OPTION CLEAN_FILES " << absoluteCleanFiles.join(" ") << endl; -- cgit v0.12 From 33ad8aa89a214143f3ffb0850e81daffca2ac68d Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 24 Aug 2011 16:03:34 +0300 Subject: Fix BLD_INF_RULES.prj_exports statements in Qt libs for shadow builds. Task-number: QTBUG-10432 Rubber-stamped-by: ossi Reviewed-by: TrustMe --- mkspecs/common/symbian/symbian.conf | 7 +++++++ src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro | 4 +++- src/s60installs/s60installs.pro | 9 ++++++--- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index b19eece..61a6228 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -302,3 +302,10 @@ defineReplace(addLanguageDependentPkgItem) { return($$join(pkgLanguageList,",",,)) } + +# Sometimes a relative path to original .pro file directory is necessary when doing shadow builds. +defineReplace(relativeProPath) { + RELATIVE_PRO_FILE_PWD = $$replace(OUT_PWD, "^.:", "") # Lose drive letter if any + RELATIVE_PRO_FILE_PWD = $$replace(RELATIVE_PRO_FILE_PWD, "/[^/]*", "../")$$replace(_PRO_FILE_PWD_, "^[^/]*/", "") + return($$RELATIVE_PRO_FILE_PWD) +} diff --git a/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro b/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro index 0d233e6..382217a 100644 --- a/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro +++ b/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro @@ -4,6 +4,8 @@ TEMPLATE = subdirs # We just want to export the sqlite3 binaries for Symbian for platforms that do not have them. symbian-abld|symbian-sbsv2 { !symbian_no_export_sqlite:!exists($${EPOCROOT}epoc32/release/armv5/lib/sqlite3.dso) { - BLD_INF_RULES.prj_exports += ":zip SQLite3_v9.2.zip" + # Symbian exports do not like drive letter, so remove it from the source dir + SQLITE_SRC_DIR = $$relativeProPath() + BLD_INF_RULES.prj_exports += ":zip $$SQLITE_SRC_DIR/SQLite3_v9.2.zip" } } diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index a43c3df..c2b462c 100755 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -27,13 +27,16 @@ symbian: { $$QMAKE_LIBDIR_QT/QtTest$${QT_LIBINFIX}.dll \ $$QMAKE_LIBDIR_QT/QtSql$${QT_LIBINFIX}.dll + # Symbian exports do not like absolute paths, so generate a relative path to original .pro file dir + S60_INSTALLS_SOURCE_DIR = $$relativeProPath() + symbian-abld|symbian-sbsv2 { pluginLocations = $${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET) bearerPluginLocation = $${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET) bearerStubZ = $${EPOCROOT}$${HW_ZDIR}$${QT_PLUGINS_BASE_DIR}/bearer/qsymbianbearer$${QT_LIBINFIX}.qtplugin BLD_INF_RULES.prj_exports += \ - "qsymbianbearer.qtplugin /$${HW_ZDIR}$${QT_PLUGINS_BASE_DIR}/bearer/qsymbianbearer$${QT_LIBINFIX}.qtplugin" \ - "qsymbianbearer.qtplugin /epoc32/winscw/c$${QT_PLUGINS_BASE_DIR}/bearer/qsymbianbearer$${QT_LIBINFIX}.qtplugin" + "$$S60_INSTALLS_SOURCE_DIR/qsymbianbearer.qtplugin /$${HW_ZDIR}$${QT_PLUGINS_BASE_DIR}/bearer/qsymbianbearer$${QT_LIBINFIX}.qtplugin" \ + "$$S60_INSTALLS_SOURCE_DIR/qsymbianbearer.qtplugin /epoc32/winscw/c$${QT_PLUGINS_BASE_DIR}/bearer/qsymbianbearer$${QT_LIBINFIX}.qtplugin" } else { pluginLocations = $$QT_BUILD_TREE/plugins/s60 bearerPluginLocation = $$QT_BUILD_TREE/plugins/bearer @@ -171,5 +174,5 @@ symbian: { qtlibraries.files += $$QMAKE_LIBDIR_QT/QtMultimedia$${QT_LIBINFIX}.dll } - BLD_INF_RULES.prj_exports += "qt.iby $$CORE_MW_LAYER_IBY_EXPORT_PATH(qt.iby)" + BLD_INF_RULES.prj_exports += "$$S60_INSTALLS_SOURCE_DIR/qt.iby $$CORE_MW_LAYER_IBY_EXPORT_PATH(qt.iby)" } -- cgit v0.12 From 2485dea76dc36acb8fa9a5506ee66971ed89ff10 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 24 Aug 2011 16:04:57 +0300 Subject: Fix incorrect Symbian version check. This check is unnecessary and doesn't work post-Symbian3 SDKs. Reviewed-by: Sami Merila --- mkspecs/features/qt_functions.prf | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf index 5baf7ce..9271de5 100644 --- a/mkspecs/features/qt_functions.prf +++ b/mkspecs/features/qt_functions.prf @@ -48,9 +48,7 @@ defineTest(qtAddLibrary) { symbian { isEqual(LIB_NAME, QtCore) { #workaround for dependency from f32file.h on e32svr.h which has moved location in symbian3 - contains(SYMBIAN_VERSION, Symbian3) { - INCLUDEPATH *= $$OS_LAYER_SYSTEMINCLUDE - } + INCLUDEPATH *= $$OS_LAYER_SYSTEMINCLUDE } else:isEqual(LIB_NAME, QtGui) { # Needed for #include because qs60mainapplication.h includes aknapp.h INCLUDEPATH *= $$MW_LAYER_SYSTEMINCLUDE -- cgit v0.12 From 8f7535c3939e78f0c397d32945b577a98c234980 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 29 Aug 2011 13:24:53 +0300 Subject: Fix pointer event mapping when windows are fixed to native orientation When the "fix native orientation" feature is enabled via WA_SymbianNoSystemRotation, QSymbianControl has to do an extra mapping for all pointer events because in this special mode the RWindow and thus the CCoeControl will "rotate" (i.e. will change their dimensions according to the orientation of the device), however the EGL window surface and the QWidget will remain locked to the native orientation of the device (typically portrait). This means that the pointer events will correspond to the current orientation of the device, which is not what Qt wants: typically a graphics view or similar will perform the transformation of the input events too, and therefore passing already-transformed events is wrong (as it would result in double transformation). To solve this, all pointer event coordinates are mapped back to the native orientation. This had a problem however: It only took the traditional portrait and landscape modes into account. When there are two landscape modes (i.e. rotations of both 90 and 270 degrees are supported), the mapping of pointer events generated wrong results in one of them because they treated them the same. The patch corrects this, so all three orientations will result in proper input behavior, even when NoSystemRotation is set. Task-number: QT-5236 Reviewed-by: Sami Merila --- src/gui/kernel/qapplication_s60.cpp | 15 +++++++++++---- src/gui/kernel/qt_s60_p.h | 27 +++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 5ac9803..58fd0a8 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -580,13 +580,20 @@ QPoint QSymbianControl::translatePointForFixedNativeOrientation(const TPoint &po { QPoint pos(pointerEventPos.iX, pointerEventPos.iY); if (qwidget->d_func()->fixNativeOrientationCalled) { - QSize wsize = qwidget->size(); - TSize size = Size(); + QSize wsize = qwidget->size(); // always same as the size in the native orientation + TSize size = Size(); // depends on the current orientation if (size.iWidth == wsize.height() && size.iHeight == wsize.width()) { qreal x = pos.x(); qreal y = pos.y(); - pos.setX(size.iHeight - y); - pos.setY(x); + if (S60->screenRotation == QS60Data::ScreenRotation90) { + // DisplayRightUp + pos.setX(size.iHeight - y); + pos.setY(x); + } else if (S60->screenRotation == QS60Data::ScreenRotation270) { + // DisplayLeftUp + pos.setX(y); + pos.setY(size.iWidth - x); + } } } return pos; diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 3ec4052..96b8141 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -77,6 +77,7 @@ #include // CAknContextPane #include // CEikStatusPane #include // MAknFadedComponent and TAknPopupFader +#include // EGraphicsOrientation constants #ifdef QT_SYMBIAN_HAVE_AKNTRANSEFFECT_H #include // BeginFullScreen #include // BeginFullScreen @@ -213,6 +214,14 @@ public: int nativeScreenWidthInPixels; int nativeScreenHeightInPixels; + enum ScreenRotation { + ScreenRotation0, // portrait (or the native orientation) + ScreenRotation90, // typically DisplayLeftUp landscape + ScreenRotation180, // not used + ScreenRotation270 // DisplayRightUp landscape when 3-way orientation is supported + }; + ScreenRotation screenRotation; + int beginFullScreenCalled : 1; int endFullScreenCalled : 1; }; @@ -384,6 +393,24 @@ inline void QS60Data::updateScreenSize() inches = S60->screenWidthInTwips / (TReal)KTwipsPerInch; S60->defaultDpiX = S60->screenWidthInPixels / inches; + switch (params.iRotation) { + case CFbsBitGc::EGraphicsOrientationNormal: + S60->screenRotation = ScreenRotation0; + break; + case CFbsBitGc::EGraphicsOrientationRotated90: + S60->screenRotation = ScreenRotation90; + break; + case CFbsBitGc::EGraphicsOrientationRotated180: + S60->screenRotation = ScreenRotation180; + break; + case CFbsBitGc::EGraphicsOrientationRotated270: + S60->screenRotation = ScreenRotation270; + break; + default: + S60->screenRotation = ScreenRotation0; + break; + } + int screens = S60->screenCount(); for (int i = 0; i < screens; ++i) { CWsScreenDevice *dev = S60->screenDevice(i); -- cgit v0.12 From 726cf479c1c03a5562841aacb7c1e7677e711c90 Mon Sep 17 00:00:00 2001 From: Honglei Zhang Date: Tue, 30 Aug 2011 17:42:15 +0300 Subject: Fix QXmlSimpleReader auto test failer Bug fix for QTBUG-21025 has introduced a auto test failure. One added xml file has typo and failed a test driver. The extra charactor is removed from the test xml file. Task-number: QTBUG-21025 Reviewed-by: Trust Me --- tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/015.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/015.xml b/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/015.xml index 5550dab..0e7b9cc 100644 --- a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/015.xml +++ b/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/015.xml @@ -1,6 +1,5 @@ + ]> &e; - -- cgit v0.12 From 131647aa8f90ea90905eb376697998939df049d6 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 30 Aug 2011 14:58:33 +0300 Subject: Fix Symbian system date format parsing. System date format parsing didn't work correctly when the format was locale-dependent (i.e. didn't have %F). The abbreviations of day, month, and year where not taken into account if they were specified in their proper place, i.e. with %*D, %*M, or %*Y parameter. Task-number: QT-5237 Reviewed-by: Sami Merila --- src/corelib/tools/qlocale_symbian.cpp | 63 ++++++++++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 8 deletions(-) diff --git a/src/corelib/tools/qlocale_symbian.cpp b/src/corelib/tools/qlocale_symbian.cpp index cdf0ab1..1214e46 100644 --- a/src/corelib/tools/qlocale_symbian.cpp +++ b/src/corelib/tools/qlocale_symbian.cpp @@ -195,7 +195,9 @@ QByteArray qt_symbianLocaleName(int code) return qt_resolveSymbianLocaleName(code, ISO); } -// order is: normal, abbr, nmode, nmode+abbr +// Rows are: normal, abbr, nmode, nmode+abbr +// First three values on a row are used for three component date, +// while the last two are used for two component date (i.e. no year). static const char *us_locale_dep[] = { "MM", "dd", "yyyy", "MM", "dd", "M", "d", "yy", "M", "d", @@ -214,6 +216,13 @@ static const char *jp_locale_dep[] = { "yyyy", "MMMM", "dd", "MMMM", "dd", "yy", "MMM", "d", "MMM", "d" }; +// 0 = day, 1 = month, 2 = year +static const int digit_map[] = { + 1, 0, 2, 1, 0, // American + 0, 1, 2, 0, 1, // European + 2, 1, 0, 1, 0 // Japanese +}; + /*! Returns a Qt version of the given \a sys_fmt Symbian locale format string. */ @@ -229,6 +238,9 @@ static QString s60ToQtFormat(const QString &sys_fmt) int i = 0; bool open_escape = false; bool abbrev_next = false; + bool abbrev_day = false; + bool abbrev_month = false; + bool abbrev_year = false; bool locale_indep_ordering = false; bool minus_mode = false; bool plus_mode = false; @@ -305,8 +317,11 @@ static QString s60ToQtFormat(const QString &sys_fmt) case 'D': { - if (!locale_indep_ordering) + if (!locale_indep_ordering) { + if (abbrev_next) + abbrev_day = true; break; + } if (!abbrev_next) result += QLatin1String("dd"); @@ -318,8 +333,11 @@ static QString s60ToQtFormat(const QString &sys_fmt) case 'M': { - if (!locale_indep_ordering) + if (!locale_indep_ordering) { + if (abbrev_next) + abbrev_month = true; break; + } if (!n_mode) { if (!abbrev_next) @@ -340,8 +358,11 @@ static QString s60ToQtFormat(const QString &sys_fmt) { n_mode = true; - if (!locale_indep_ordering) + if (!locale_indep_ordering) { + if (abbrev_next) + abbrev_month = true; break; + } if (!abbrev_next) result += QLatin1String("MMMM"); @@ -353,8 +374,11 @@ static QString s60ToQtFormat(const QString &sys_fmt) case 'Y': { - if (!locale_indep_ordering) + if (!locale_indep_ordering) { + if (abbrev_next) + abbrev_year = true; break; + } if (!abbrev_next) result += QLatin1String("yyyy"); @@ -522,7 +546,9 @@ static QString s60ToQtFormat(const QString &sys_fmt) const char **locale_dep; switch (df) { - default: // fallthru to american + default: + df = EDateAmerican; + // fallthru to american case EDateAmerican: locale_dep = us_locale_dep; break; @@ -534,12 +560,33 @@ static QString s60ToQtFormat(const QString &sys_fmt) break; } int offset = 0; - if (abbrev_next) + int adjustedDigit = c.digitValue() - 1; + + bool abbrev_this = abbrev_next; + // If abbreviation specified for this digit, use that. + // Otherwise abbreviate according to %D, %M, and %Y specified previously. + if (!abbrev_this) { + switch (digit_map[adjustedDigit + (static_cast(df) * 5)]) { + case 0: + abbrev_this = abbrev_day; + break; + case 1: + abbrev_this = abbrev_month; + break; + case 2: + abbrev_this = abbrev_year; + break; + default: + break; // never happens + } + } + + if (abbrev_this) offset += 5; if (n_mode) offset += 10; - result += QLatin1String(locale_dep[offset + (c.digitValue()-1)]); + result += QLatin1String(locale_dep[offset + (adjustedDigit)]); break; } -- cgit v0.12