From 9a5b72eb64d698aff507d5c2b2ea6d19bda0b65e Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 9 Nov 2010 14:39:27 +0000 Subject: Send WinIdChange event when winId is set to zero This allows an observer to get a notification just before the window handle owned by a native widget is destroyed. Note that, at the point when the event is sent, the widget's internalWinId() will return the new value, but the old native window handle will not be destroyed until after the event handler is run. Task-number: QTMOBILITY-645 Reviewed-by: sroedal --- dist/changes-4.7.2 | 8 ++++++-- src/gui/kernel/qwidget.cpp | 9 ++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/dist/changes-4.7.2 b/dist/changes-4.7.2 index 49bdd8e..a18a237 100644 --- a/dist/changes-4.7.2 +++ b/dist/changes-4.7.2 @@ -45,8 +45,12 @@ QtCore QtGui ----- - - foo - * bar + - QWidget + * [QTMOBILITY-645] Send WinIdChange event when winId is set to zero. + The window handle of a native widget may be set to zero in two + situations: (i) temporarily, during reparenting and (ii) during + widget destruction. Previously, no WinIdChange event was sent in + either of these cases; now, it is sent in both cases. QtDBus ------ diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index e22ec55..cbf4886 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -1673,13 +1673,8 @@ void QWidgetPrivate::setWinId(WId id) // set widget identifier } if(oldWinId != id) { - // Do not emit an event when the old winId is destroyed. This only - // happens (a) during widget destruction, and (b) immediately prior - // to creation of a new winId, for example as a result of re-parenting. - if(id != 0) { - QEvent e(QEvent::WinIdChange); - QCoreApplication::sendEvent(q, &e); - } + QEvent e(QEvent::WinIdChange); + QCoreApplication::sendEvent(q, &e); } } -- cgit v0.12 From d16fcbc6d6b00770a5106027c24ed7cf7e92c1d5 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Thu, 11 Nov 2010 17:27:01 +0000 Subject: SSL: Fix for systemCaCertificates being called first on symbian On symbian, thread names must be unique (actually kernel object names) When a thread exits, there may still be open handles, for example a debugger or RUndertaker so the thread name cannot be reused immediately. S60 has an RUndertaker instance in a background thread, which is used to display the "application closed" messages when a crash happens. Until that thread has run and checked the thread exit to see if it was a crash or not, the thread remains open. When systemCaCertificates is called as the first API call, it calls itself via ensureinitialised() to set the default CA certs. This double call should be addressed by QTBUG-15218. In any case, QSslSocket::systemCaCertificates() is intended to refresh from the system - if application code calls it too quickly in succession it could also trigger this bug. Task-number: QTBUG-15126 Reviewed-by: Markus Goetz --- src/network/ssl/qsslsocket_openssl.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 426b07a..f4bd423 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -659,8 +659,16 @@ TInt CSymbianCertificateRetriever::ThreadEntryPoint(TAny* aParams) void CSymbianCertificateRetriever::ConstructL() { - User::LeaveIfError(iThread.Create(_L("CertWorkerThread"), - CSymbianCertificateRetriever::ThreadEntryPoint, 16384, NULL, this)); + TInt err; + int i=0; + QString name(QLatin1String("CertWorkerThread-%1")); + //recently closed thread names remain in use for a while until all handles have been closed + //including users of RUndertaker + do { + err = iThread.Create(qt_QString2TPtrC(name.arg(i++)), + CSymbianCertificateRetriever::ThreadEntryPoint, 16384, NULL, this); + } while (err == KErrAlreadyExists); + User::LeaveIfError(err); } void CSymbianCertificateRetriever::DoCancel() -- cgit v0.12 From 924be25253471ababfcf560a6ca098543838c0aa Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Fri, 12 Nov 2010 13:23:41 +1000 Subject: Bump Qt version to 4.7.2. Reviewed-by: Trust Me --- src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri | 4 ++-- src/corelib/global/qglobal.h | 4 ++-- src/plugins/qpluginbase.pri | 2 +- src/qbase.pri | 2 +- tests/auto/selftests/expected_cmptest.txt | 2 +- tests/auto/selftests/expected_crashes_3.txt | 2 +- tests/auto/selftests/expected_longstring.txt | 2 +- tests/auto/selftests/expected_maxwarnings.txt | 2 +- tests/auto/selftests/expected_skip.txt | 2 +- tools/assistant/tools/assistant/doc/assistant.qdocconf | 2 +- tools/qdoc3/doc/files/qt.qdocconf | 8 ++++---- tools/qdoc3/test/assistant.qdocconf | 4 ++-- tools/qdoc3/test/designer.qdocconf | 4 ++-- tools/qdoc3/test/linguist.qdocconf | 4 ++-- tools/qdoc3/test/qdeclarative.qdocconf | 8 ++++---- tools/qdoc3/test/qmake.qdocconf | 4 ++-- tools/qdoc3/test/qt-build-docs.qdocconf | 8 ++++---- tools/qdoc3/test/qt-build-docs_ja_JP.qdocconf | 8 ++++---- tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf | 8 ++++---- tools/qdoc3/test/qt.qdocconf | 8 ++++---- tools/qdoc3/test/qt_ja_JP.qdocconf | 8 ++++---- tools/qdoc3/test/qt_zh_CN.qdocconf | 8 ++++---- 22 files changed, 52 insertions(+), 52 deletions(-) diff --git a/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri b/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri index f2282f8..b98617f 100644 --- a/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri +++ b/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri @@ -1,5 +1,5 @@ -QT_WEBKIT_VERSION = 4.7.1 +QT_WEBKIT_VERSION = 4.7.2 QT_WEBKIT_MAJOR_VERSION = 4 QT_WEBKIT_MINOR_VERSION = 7 -QT_WEBKIT_PATCH_VERSION = 1 +QT_WEBKIT_PATCH_VERSION = 2 QT_CONFIG += webkit diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 35607d5..b148a1d 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -44,11 +44,11 @@ #include -#define QT_VERSION_STR "4.7.1" +#define QT_VERSION_STR "4.7.2" /* QT_VERSION is (major << 16) + (minor << 8) + patch. */ -#define QT_VERSION 0x040701 +#define QT_VERSION 0x040702 /* can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0)) */ diff --git a/src/plugins/qpluginbase.pri b/src/plugins/qpluginbase.pri index 84009d8..7cbffe0 100644 --- a/src/plugins/qpluginbase.pri +++ b/src/plugins/qpluginbase.pri @@ -1,6 +1,6 @@ TEMPLATE = lib isEmpty(QT_MAJOR_VERSION) { - VERSION=4.7.1 + VERSION=4.7.2 } else { VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} } diff --git a/src/qbase.pri b/src/qbase.pri index 4217618..af18af8 100644 --- a/src/qbase.pri +++ b/src/qbase.pri @@ -4,7 +4,7 @@ INCLUDEPATH *= $$QMAKE_INCDIR_QT/$$TARGET #just for today to have some compat isEmpty(QT_ARCH):!isEmpty(ARCH):QT_ARCH=$$ARCH #another compat that will rot for change #215700 TEMPLATE = lib isEmpty(QT_MAJOR_VERSION) { - VERSION=4.7.1 + VERSION=4.7.2 } else { VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} } diff --git a/tests/auto/selftests/expected_cmptest.txt b/tests/auto/selftests/expected_cmptest.txt index 7f3aa9a..fccaca3 100644 --- a/tests/auto/selftests/expected_cmptest.txt +++ b/tests/auto/selftests/expected_cmptest.txt @@ -1,5 +1,5 @@ ********* Start testing of tst_Cmptest ********* -Config: Using QTest library 4.7.1, Qt 4.7.1 +Config: Using QTest library 4.7.2, Qt 4.7.2 PASS : tst_Cmptest::initTestCase() PASS : tst_Cmptest::compare_boolfuncs() PASS : tst_Cmptest::compare_pointerfuncs() diff --git a/tests/auto/selftests/expected_crashes_3.txt b/tests/auto/selftests/expected_crashes_3.txt index 7ded525..2558f68 100644 --- a/tests/auto/selftests/expected_crashes_3.txt +++ b/tests/auto/selftests/expected_crashes_3.txt @@ -1,5 +1,5 @@ ********* Start testing of tst_Crashes ********* -Config: Using QTest library 4.7.1, Qt 4.7.1 +Config: Using QTest library 4.7.2, Qt 4.7.2 PASS : tst_Crashes::initTestCase() QFATAL : tst_Crashes::crash() Received signal 11 FAIL! : tst_Crashes::crash() Received a fatal error. diff --git a/tests/auto/selftests/expected_longstring.txt b/tests/auto/selftests/expected_longstring.txt index 9ad6f56..c56244b 100644 --- a/tests/auto/selftests/expected_longstring.txt +++ b/tests/auto/selftests/expected_longstring.txt @@ -1,5 +1,5 @@ ********* Start testing of tst_LongString ********* -Config: Using QTest library 4.7.1, Qt 4.7.1 +Config: Using QTest library 4.7.2, Qt 4.7.2 PASS : tst_LongString::initTestCase() FAIL! : tst_LongString::failWithLongString() Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. diff --git a/tests/auto/selftests/expected_maxwarnings.txt b/tests/auto/selftests/expected_maxwarnings.txt index 949da13..7846435 100644 --- a/tests/auto/selftests/expected_maxwarnings.txt +++ b/tests/auto/selftests/expected_maxwarnings.txt @@ -1,5 +1,5 @@ ********* Start testing of MaxWarnings ********* -Config: Using QTest library 4.7.1, Qt 4.7.1 +Config: Using QTest library 4.7.2, Qt 4.7.2 PASS : MaxWarnings::initTestCase() QWARN : MaxWarnings::warn() 0 QWARN : MaxWarnings::warn() 1 diff --git a/tests/auto/selftests/expected_skip.txt b/tests/auto/selftests/expected_skip.txt index 1f5bf7b..5c9e497 100644 --- a/tests/auto/selftests/expected_skip.txt +++ b/tests/auto/selftests/expected_skip.txt @@ -1,5 +1,5 @@ ********* Start testing of tst_Skip ********* -Config: Using QTest library 4.7.1, Qt 4.7.1 +Config: Using QTest library 4.7.2, Qt 4.7.2 PASS : tst_Skip::initTestCase() SKIP : tst_Skip::test() skipping all Loc: [/home/user/depot/qt-git/mainline/tests/auto/selftests/skip/tst_skip.cpp(68)] diff --git a/tools/assistant/tools/assistant/doc/assistant.qdocconf b/tools/assistant/tools/assistant/doc/assistant.qdocconf index 26cdafb..57abeae 100644 --- a/tools/assistant/tools/assistant/doc/assistant.qdocconf +++ b/tools/assistant/tools/assistant/doc/assistant.qdocconf @@ -12,5 +12,5 @@ HTML.footer = "


\n" \ "\n" \ "\n" \ "\n" \ - "\n" \ + "\n" \ "
Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies)Trademarks
Qt 4.7.1
Qt 4.7.2
" diff --git a/tools/qdoc3/doc/files/qt.qdocconf b/tools/qdoc3/doc/files/qt.qdocconf index 4546c7a..44cfbc1 100644 --- a/tools/qdoc3/doc/files/qt.qdocconf +++ b/tools/qdoc3/doc/files/qt.qdocconf @@ -22,7 +22,7 @@ edition.DesktopLight.groups = -graphicsview-api qhp.projects = Qt qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.471 +qhp.Qt.namespace = com.trolltech.qt.472 qhp.Qt.virtualFolder = qdoc qhp.Qt.indexTitle = Qt Reference Documentation qhp.Qt.indexRoot = @@ -36,9 +36,9 @@ qhp.Qt.extraFiles = classic.css \ images/dynamiclayouts-example.png \ images/stylesheet-coffee-plastique.png -qhp.Qt.filterAttributes = qt 4.7.1 qtrefdoc -qhp.Qt.customFilters.Qt.name = Qt 4.7.1 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.1 +qhp.Qt.filterAttributes = qt 4.7.2 qtrefdoc +qhp.Qt.customFilters.Qt.name = Qt 4.7.2 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.2 qhp.Qt.subprojects = classes overviews examples qhp.Qt.subprojects.classes.title = Classes qhp.Qt.subprojects.classes.indexTitle = Qt's Classes diff --git a/tools/qdoc3/test/assistant.qdocconf b/tools/qdoc3/test/assistant.qdocconf index 74b68df..0e9a2a8 100644 --- a/tools/qdoc3/test/assistant.qdocconf +++ b/tools/qdoc3/test/assistant.qdocconf @@ -13,7 +13,7 @@ indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index qhp.projects = Assistant qhp.Assistant.file = assistant.qhp -qhp.Assistant.namespace = com.trolltech.assistant.471 +qhp.Assistant.namespace = com.trolltech.assistant.472 qhp.Assistant.virtualFolder = qdoc qhp.Assistant.indexTitle = Qt Assistant Manual qhp.Assistant.extraFiles = images/bg_l.png \ @@ -50,7 +50,7 @@ qhp.Assistant.extraFiles = images/bg_l.png \ style/style_ie8.css \ style/style.css -qhp.Assistant.filterAttributes = qt 4.7.1 tools assistant +qhp.Assistant.filterAttributes = qt 4.7.2 tools assistant qhp.Assistant.customFilters.Assistant.name = Qt Assistant Manual qhp.Assistant.customFilters.Assistant.filterAttributes = qt tools assistant qhp.Assistant.subprojects = manual examples diff --git a/tools/qdoc3/test/designer.qdocconf b/tools/qdoc3/test/designer.qdocconf index ab66792..637399b 100644 --- a/tools/qdoc3/test/designer.qdocconf +++ b/tools/qdoc3/test/designer.qdocconf @@ -13,7 +13,7 @@ indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index qhp.projects = Designer qhp.Designer.file = designer.qhp -qhp.Designer.namespace = com.trolltech.designer.471 +qhp.Designer.namespace = com.trolltech.designer.472 qhp.Designer.virtualFolder = qdoc qhp.Designer.indexTitle = Qt Designer Manual qhp.Designer.extraFiles = images/bg_l.png \ @@ -50,7 +50,7 @@ qhp.Designer.extraFiles = images/bg_l.png \ style/style_ie8.css \ style/style.css -qhp.Designer.filterAttributes = qt 4.7.1 tools designer +qhp.Designer.filterAttributes = qt 4.7.2 tools designer qhp.Designer.customFilters.Designer.name = Qt Designer Manual qhp.Designer.customFilters.Designer.filterAttributes = qt tools designer qhp.Designer.subprojects = manual examples diff --git a/tools/qdoc3/test/linguist.qdocconf b/tools/qdoc3/test/linguist.qdocconf index 0d920e2..8ee298e 100644 --- a/tools/qdoc3/test/linguist.qdocconf +++ b/tools/qdoc3/test/linguist.qdocconf @@ -13,7 +13,7 @@ indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index qhp.projects = Linguist qhp.Linguist.file = linguist.qhp -qhp.Linguist.namespace = com.trolltech.linguist.471 +qhp.Linguist.namespace = com.trolltech.linguist.472 qhp.Linguist.virtualFolder = qdoc qhp.Linguist.indexTitle = Qt Linguist Manual qhp.Linguist.extraFiles = images/bg_l.png \ @@ -50,7 +50,7 @@ qhp.Linguist.extraFiles = images/bg_l.png \ style/style_ie8.css \ style/style.css -qhp.Linguist.filterAttributes = qt 4.7.1 tools linguist +qhp.Linguist.filterAttributes = qt 4.7.2 tools linguist qhp.Linguist.customFilters.Linguist.name = Qt Linguist Manual qhp.Linguist.customFilters.Linguist.filterAttributes = qt tools linguist qhp.Linguist.subprojects = manual examples diff --git a/tools/qdoc3/test/qdeclarative.qdocconf b/tools/qdoc3/test/qdeclarative.qdocconf index 9aaebcb..e68a935 100644 --- a/tools/qdoc3/test/qdeclarative.qdocconf +++ b/tools/qdoc3/test/qdeclarative.qdocconf @@ -21,7 +21,7 @@ edition.DesktopLight.groups = -graphicsview-api qhp.projects = Qml qhp.Qml.file = qml.qhp -qhp.Qml.namespace = com.trolltech.qml.471 +qhp.Qml.namespace = com.trolltech.qml.472 qhp.Qml.virtualFolder = qdoc qhp.Qml.indexTitle = Qml Reference @@ -61,9 +61,9 @@ qhp.Qml.extraFiles = images/bg_l.png \ style/style_ie8.css \ style/style.css -qhp.Qml.filterAttributes = qt 4.7.1 qtrefdoc -qhp.Qml.customFilters.Qt.name = Qt 4.7.1 -qhp.Qml.customFilters.Qt.filterAttributes = qt 4.7.1 +qhp.Qml.filterAttributes = qt 4.7.2 qtrefdoc +qhp.Qml.customFilters.Qt.name = Qt 4.7.2 +qhp.Qml.customFilters.Qt.filterAttributes = qt 4.7.2 qhp.Qml.subprojects = classes qhp.Qml.subprojects.classes.title = Elements qhp.Qml.subprojects.classes.indexTitle = Qml Elements diff --git a/tools/qdoc3/test/qmake.qdocconf b/tools/qdoc3/test/qmake.qdocconf index be2e9d3..b5bc96c 100644 --- a/tools/qdoc3/test/qmake.qdocconf +++ b/tools/qdoc3/test/qmake.qdocconf @@ -13,7 +13,7 @@ indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index qhp.projects = qmake qhp.qmake.file = qmake.qhp -qhp.qmake.namespace = com.trolltech.qmake.471 +qhp.qmake.namespace = com.trolltech.qmake.472 qhp.qmake.virtualFolder = qdoc qhp.qmake.indexTitle = QMake Manual qhp.qmake.extraFiles = images/bg_l.png \ @@ -50,7 +50,7 @@ qhp.qmake.extraFiles = images/bg_l.png \ style/style_ie8.css \ style/style.css -qhp.qmake.filterAttributes = qt 4.7.1 tools qmake +qhp.qmake.filterAttributes = qt 4.7.2 tools qmake qhp.qmake.customFilters.qmake.name = qmake Manual qhp.qmake.customFilters.qmake.filterAttributes = qt tools qmake qhp.qmake.subprojects = manual diff --git a/tools/qdoc3/test/qt-build-docs.qdocconf b/tools/qdoc3/test/qt-build-docs.qdocconf index dcabeb4..5fae2f6 100644 --- a/tools/qdoc3/test/qt-build-docs.qdocconf +++ b/tools/qdoc3/test/qt-build-docs.qdocconf @@ -15,7 +15,7 @@ naturallanguage = en_US qhp.projects = Qt qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.471 +qhp.Qt.namespace = com.trolltech.qt.472 qhp.Qt.virtualFolder = qdoc qhp.Qt.indexTitle = Qt Reference Documentation qhp.Qt.indexRoot = @@ -59,9 +59,9 @@ qhp.Qt.extraFiles = index.html \ -qhp.Qt.filterAttributes = qt 4.7.1 qtrefdoc -qhp.Qt.customFilters.Qt.name = Qt 4.7.1 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.1 +qhp.Qt.filterAttributes = qt 4.7.2 qtrefdoc +qhp.Qt.customFilters.Qt.name = Qt 4.7.2 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.2 qhp.Qt.subprojects = classes overviews examples qhp.Qt.subprojects.classes.title = Classes qhp.Qt.subprojects.classes.indexTitle = Qt's Classes diff --git a/tools/qdoc3/test/qt-build-docs_ja_JP.qdocconf b/tools/qdoc3/test/qt-build-docs_ja_JP.qdocconf index 7e28fa2..24696d5 100644 --- a/tools/qdoc3/test/qt-build-docs_ja_JP.qdocconf +++ b/tools/qdoc3/test/qt-build-docs_ja_JP.qdocconf @@ -17,15 +17,15 @@ indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index qhp.projects = Qt qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.471 +qhp.Qt.namespace = com.trolltech.qt.472 qhp.Qt.virtualFolder = qdoc qhp.Qt.title = Qt qhp.Qt.indexTitle = Qt qhp.Qt.selectors = fake:example -qhp.Qt.filterAttributes = qt 4.7.1 qtrefdoc ja_JP -qhp.Qt.customFilters.Qt.name = Qt 4.7.1 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.1 +qhp.Qt.filterAttributes = qt 4.7.2 qtrefdoc ja_JP +qhp.Qt.customFilters.Qt.name = Qt 4.7.2 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.2 # Files not referenced in any qdoc file (last four are needed by qtdemo) # See also extraimages.HTML diff --git a/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf b/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf index cfcc76d..7789bf7 100644 --- a/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf +++ b/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf @@ -17,15 +17,15 @@ indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index qhp.projects = Qt qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.471 +qhp.Qt.namespace = com.trolltech.qt.472 qhp.Qt.virtualFolder = qdoc qhp.Qt.title = 教程 qhp.Qt.indexTitle = 教程 qhp.Qt.selectors = fake:example -qhp.Qt.filterAttributes = qt 4.7.1 qtrefdoc zh_CN -qhp.Qt.customFilters.Qt.name = Qt 4.7.1 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.1 +qhp.Qt.filterAttributes = qt 4.7.2 qtrefdoc zh_CN +qhp.Qt.customFilters.Qt.name = Qt 4.7.2 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.2 # Files not referenced in any qdoc file (last four are needed by qtdemo) # See also extraimages.HTML diff --git a/tools/qdoc3/test/qt.qdocconf b/tools/qdoc3/test/qt.qdocconf index ea97205..8998751 100644 --- a/tools/qdoc3/test/qt.qdocconf +++ b/tools/qdoc3/test/qt.qdocconf @@ -17,7 +17,7 @@ naturallanguage = en_US qhp.projects = Qt qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.471 +qhp.Qt.namespace = com.trolltech.qt.472 qhp.Qt.virtualFolder = qdoc qhp.Qt.indexTitle = Qt Reference Documentation qhp.Qt.indexRoot = @@ -59,9 +59,9 @@ qhp.Qt.extraFiles = index.html \ style/style_ie8.css \ style/style.css -qhp.Qt.filterAttributes = qt 4.7.1 qtrefdoc -qhp.Qt.customFilters.Qt.name = Qt 4.7.1 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.1 +qhp.Qt.filterAttributes = qt 4.7.2 qtrefdoc +qhp.Qt.customFilters.Qt.name = Qt 4.7.2 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.2 qhp.Qt.subprojects = classes overviews examples qhp.Qt.subprojects.classes.title = Classes qhp.Qt.subprojects.classes.indexTitle = Qt's Classes diff --git a/tools/qdoc3/test/qt_ja_JP.qdocconf b/tools/qdoc3/test/qt_ja_JP.qdocconf index 32bba06..a5c348c 100644 --- a/tools/qdoc3/test/qt_ja_JP.qdocconf +++ b/tools/qdoc3/test/qt_ja_JP.qdocconf @@ -19,15 +19,15 @@ indexes = $QTDIR/doc/html/qt.index qhp.projects = Qt qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.471 +qhp.Qt.namespace = com.trolltech.qt.472 qhp.Qt.virtualFolder = qdoc qhp.Qt.title = Qt qhp.Qt.indexTitle = Qt qhp.Qt.selectors = fake:example -qhp.Qt.filterAttributes = qt 4.7.1 qtrefdoc ja_JP -qhp.Qt.customFilters.Qt.name = Qt 4.7.1 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.1 +qhp.Qt.filterAttributes = qt 4.7.2 qtrefdoc ja_JP +qhp.Qt.customFilters.Qt.name = Qt 4.7.2 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.2 # Files not referenced in any qdoc file (last four are needed by qtdemo) # See also extraimages.HTML diff --git a/tools/qdoc3/test/qt_zh_CN.qdocconf b/tools/qdoc3/test/qt_zh_CN.qdocconf index 40d3d5a..25f96b8 100644 --- a/tools/qdoc3/test/qt_zh_CN.qdocconf +++ b/tools/qdoc3/test/qt_zh_CN.qdocconf @@ -19,15 +19,15 @@ indexes = $QTDIR/doc/html/qt.index qhp.projects = Qt qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.471 +qhp.Qt.namespace = com.trolltech.qt.472 qhp.Qt.virtualFolder = qdoc qhp.Qt.title = 教程 qhp.Qt.indexTitle = 教程 qhp.Qt.selectors = fake:example -qhp.Qt.filterAttributes = qt 4.7.1 qtrefdoc zh_CN -qhp.Qt.customFilters.Qt.name = Qt 4.7.1 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.1 +qhp.Qt.filterAttributes = qt 4.7.2 qtrefdoc zh_CN +qhp.Qt.customFilters.Qt.name = Qt 4.7.2 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.2 # Files not referenced in any qdoc file (last four are needed by qtdemo) # See also extraimages.HTML -- cgit v0.12 From 16575f7aef840b6aae0dc767468ab713fbcfd7a6 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 9 Nov 2010 16:39:20 +0200 Subject: Localize .loc and .pkg content based on TRANSLATIONS If developer specifies "CONFIG += localize_deployment" in .pro file, the generated .loc and .pkg will now use translatable strings from .ts files defined in TRANSLATIONS. The .ts files must have an underscore and Qt language code at the end of the filename body to be compatible with deployment localization. E.g. myapp_en.ts. Running lupdate will generate these entries into .ts files: - Application short caption - Application long caption - Package name - Smart installer package name Task-number: QTBUG-13917 Reviewed-by: Oswald Buddenhagen Reviewed-by: Janne Anttila Reviewed-by: axis --- demos/symbianpkgrules.pri | 5 +- doc/src/development/qmake-manual.qdoc | 8 + examples/symbianpkgrules.pri | 5 +- .../common/symbian/appCaptionForTranslation.cpp | 46 ++ .../common/symbian/packageNameForTranslation.cpp | 47 +++ mkspecs/common/symbian/symbian.conf | 63 ++- mkspecs/features/default_post.prf | 10 + mkspecs/features/symbian/default_post.prf | 12 + mkspecs/features/symbian/localize_deployment.prf | 82 ++++ mkspecs/features/symbian/qt.prf | 6 +- mkspecs/features/symbian/sis_targets.prf | 26 +- qmake/generators/symbian/symbian_makefile.h | 10 +- qmake/generators/symbian/symbiancommon.cpp | 467 ++++++++++++--------- qmake/generators/symbian/symbiancommon.h | 35 +- qmake/generators/symbian/symmake.cpp | 37 +- qmake/generators/symbian/symmake.h | 5 +- qmake/generators/symbian/symmake_abld.cpp | 10 +- qmake/generators/symbian/symmake_sbsv2.cpp | 13 +- src/s60installs/s60installs.pro | 8 +- tools/linguist/lupdate/main.cpp | 4 + 20 files changed, 638 insertions(+), 261 deletions(-) create mode 100644 mkspecs/common/symbian/appCaptionForTranslation.cpp create mode 100644 mkspecs/common/symbian/packageNameForTranslation.cpp create mode 100644 mkspecs/features/symbian/localize_deployment.prf diff --git a/demos/symbianpkgrules.pri b/demos/symbianpkgrules.pri index c9cc492..ef6dfd8 100644 --- a/demos/symbianpkgrules.pri +++ b/demos/symbianpkgrules.pri @@ -2,12 +2,13 @@ RSS_RULES ="group_name=\"QtDemos\";" +nokiaVendor = "Nokia, Qt" vendorinfo = \ "; Localised Vendor name" \ - "%{\"Nokia, Qt\"}" \ + "%{$$addLanguageDependentPkgItem(nokiaVendor)}" \ " " \ "; Unique Vendor name" \ - ":\"Nokia, Qt\"" \ + ":\"$$nokiaVendor\"" \ " " demos_deployment.pkg_prerules += vendorinfo diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index 6531d25..c0ed940 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -1294,6 +1294,14 @@ test sections in generated bld.inf instead of their regular sections. Note that this only affects automatically generated bld.inf content; the content added via \c BLD_INF_RULES variable is not affected. + \row \o localize_deployment \o Makes \c lupdate tool add fields for + application captions and package file names into generated \c{.ts} + files. Qmake generates properly localized \c{.loc} and \c{.pkg} files + based on available translations. Translation file name bodies must + end with underscore and the language code for deployment localization + to work. E.g. \c{myapp_en.ts}. + \bold{Note:} All languages supported by Qt are not supported by Symbian, + so some \c{.ts} files may be ignored by qmake. \endtable These options have an effect on Linux/Unix platforms: diff --git a/examples/symbianpkgrules.pri b/examples/symbianpkgrules.pri index 0f615c7..fe9b487 100644 --- a/examples/symbianpkgrules.pri +++ b/examples/symbianpkgrules.pri @@ -2,12 +2,13 @@ RSS_RULES ="group_name=\"QtExamples\";" +nokiaVendor = "Nokia, Qt" vendorinfo = \ "; Localised Vendor name" \ - "%{\"Nokia, Qt\"}" \ + "%{$$addLanguageDependentPkgItem(nokiaVendor)}" \ " " \ "; Unique Vendor name" \ - ":\"Nokia, Qt\"" \ + ":\"$$nokiaVendor\"" \ " " examples_deployment.pkg_prerules += vendorinfo diff --git a/mkspecs/common/symbian/appCaptionForTranslation.cpp b/mkspecs/common/symbian/appCaptionForTranslation.cpp new file mode 100644 index 0000000..c295147 --- /dev/null +++ b/mkspecs/common/symbian/appCaptionForTranslation.cpp @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//: Application short caption, currently only relevant for application projects in Symbian. +QT_TRANSLATE_NOOP("QtApplicationCaptions", "Application short caption") + +//: Application long caption, currently only relevant for application projects in Symbian. +QT_TRANSLATE_NOOP("QtApplicationCaptions", "Application long caption") diff --git a/mkspecs/common/symbian/packageNameForTranslation.cpp b/mkspecs/common/symbian/packageNameForTranslation.cpp new file mode 100644 index 0000000..bc4a7f4 --- /dev/null +++ b/mkspecs/common/symbian/packageNameForTranslation.cpp @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//: Installation package name, currently only relevant for Symbian projects that deploy something. +QT_TRANSLATE_NOOP("QtPackageNames", "Package name") + +//: Smart installer installation package name, currently only relevant for Symbian projects that +//: deploy something. +QT_TRANSLATE_NOOP("QtPackageNames", "Smart installer package name") diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index 69188a8..f8586b0 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -130,6 +130,17 @@ QMAKE_LIBS_QT_ENTRY = -lqtmain$${QT_LIBINFIX}.lib QMAKE_LIBS_NO_QT_ENTRY = -llibcrt0.lib QMAKE_LIBS_NO_QT_ENTRY_GCCE = -llibcrt0_gcce.lib +# List of languages that have a Symbian language code mapping provided in localize_deployment.prf +SYMBIAN_SUPPORTED_LANGUAGES = \ + af sq am ar hy bn bg my be ca \ + hr cs da nl en et fi fr gd ka \ + de el gu he hi hu is id ga it \ + ja kn kk ko lo lv lt mk ms ml \ + mr mo mn nb pl pt pa ro ru sr \ + si sk sl so es sw sv tl ta te \ + th bo ti tr tk uk ur vi cy zu \ + nn + # These directories must match what configure uses for QT_INSTALL_PLUGINS and QT_INSTALL_IMPORTS QT_PLUGINS_BASE_DIR = /resource/qt$${QT_LIBINFIX}/plugins QT_IMPORTS_BASE_DIR = /resource/qt/imports @@ -194,17 +205,6 @@ isEmpty(S60_VERSION) { # multiple language compatible dependency statements him/herself. default_deployment.pkg_prerules += pkg_depends_webkit pkg_depends_qt pkg_platform_dependencies - -# Supports S60 3.1, 3.2, 5.0, Symbian^3, and Symbian^4 by default -pkg_platform_dependencies = \ - "; Default HW/platform dependencies" \ - "[0x102032BE],0,0,0,{\"S60ProductID\"}" \ - "[0x102752AE],0,0,0,{\"S60ProductID\"}" \ - "[0x1028315F],0,0,0,{\"S60ProductID\"}" \ - "[0x20022E6D],0,0,0,{\"S60ProductID\"}" \ - "[0x20032DE7],0,0,0,{\"S60ProductID\"}" \ - " " - DEPLOYMENT += default_deployment default_bin_deployment default_resource_deployment default_reg_deployment defineReplace(symbianRemoveSpecialCharacters) { @@ -225,3 +225,44 @@ defineReplace(symbianRemoveSpecialCharacters) { return ($$fixedStr) } +# Determines translations that are Symbian supported +defineTest(matchSymbianLanguages) { + SYMBIAN_MATCHED_LANGUAGES = + SYMBIAN_MATCHED_TRANSLATIONS = + + # Cannot parse .ts file for language here, so detect it from filename. + # Allow two and three character language and country codes. + for(translation, TRANSLATIONS) { + language = $$replace(translation, "^(.*/)?[^/]+_(([^_]{2,3}_)?[^_]{2,3})\\.ts$", \\2) + contains(SYMBIAN_SUPPORTED_LANGUAGES, $$language) { + SYMBIAN_MATCHED_LANGUAGES += $$language + SYMBIAN_MATCHED_TRANSLATIONS += $$translation + } + } + + isEmpty(SYMBIAN_MATCHED_LANGUAGES): SYMBIAN_MATCHED_LANGUAGES = en + + export(SYMBIAN_MATCHED_LANGUAGES) + export(SYMBIAN_MATCHED_TRANSLATIONS) +} + +# Symbian pkg files that define multiple languages require a language specific string to be +# defined for various items, even though the string often needs to be same for all languages. +# This replacement method will generate correct string for such cases based on TRANSLATIONS +# variable. +defineReplace(addLanguageDependentPkgItem) { + localize_deployment:!isEmpty(TRANSLATIONS):isEmpty(SYMBIAN_MATCHED_LANGUAGES) { + matchSymbianLanguages() + } + + pkgItem = $$eval($$1) + pkgLanguageList = + + for(dummyItem, SYMBIAN_MATCHED_LANGUAGES) { + pkgLanguageList += "\"$$pkgItem\"" + } + + isEmpty(pkgLanguageList): pkgLanguageList = "\"$$pkgItem\"" + + return($$join(pkgLanguageList,",",,)) +} diff --git a/mkspecs/features/default_post.prf b/mkspecs/features/default_post.prf index 09c6587..9fb9f10 100644 --- a/mkspecs/features/default_post.prf +++ b/mkspecs/features/default_post.prf @@ -110,3 +110,13 @@ QMAKE_LIBDIR += $$QMAKE_LIBDIR_POST } QMAKE_EXTRA_TARGETS += check } + +# Add special translation sources for projects that require them. +# Note 1: Since lupdate will not parse regular config scopes right, contains checks are used instead. +# Note 2: Checking for last value of TEMPLATE is used instead of simple contains check because +# lupdate doesn't respect "-=" variable assignments and therefore always finds "app" +# as the first value of TEMPLATE variable. +contains(CONFIG, lupdate_run):contains(CONFIG, localize_deployment) { + equals($$list($$last(TEMPLATE)), app): SOURCES += $$[QT_INSTALL_DATA]/mkspecs/common/symbian/appCaptionForTranslation.cpp + SOURCES += $$[QT_INSTALL_DATA]/mkspecs/common/symbian/packageNameForTranslation.cpp +} diff --git a/mkspecs/features/symbian/default_post.prf b/mkspecs/features/symbian/default_post.prf index d9ff03d..ec6ecd0 100644 --- a/mkspecs/features/symbian/default_post.prf +++ b/mkspecs/features/symbian/default_post.prf @@ -52,3 +52,15 @@ isEmpty(TARGET.UID2) { } } } + +# Supports S60 3.1, 3.2, 5.0, Symbian^3, and Symbian^4 by default +platform_product_id = S60ProductID +platform_product_id = $$addLanguageDependentPkgItem(platform_product_id) +pkg_platform_dependencies = \ + "; Default HW/platform dependencies" \ + "[0x102032BE],0,0,0,{$$platform_product_id}" \ + "[0x102752AE],0,0,0,{$$platform_product_id}" \ + "[0x1028315F],0,0,0,{$$platform_product_id}" \ + "[0x20022E6D],0,0,0,{$$platform_product_id}" \ + "[0x20032DE7],0,0,0,{$$platform_product_id}" \ + " " diff --git a/mkspecs/features/symbian/localize_deployment.prf b/mkspecs/features/symbian/localize_deployment.prf new file mode 100644 index 0000000..5f52dbc --- /dev/null +++ b/mkspecs/features/symbian/localize_deployment.prf @@ -0,0 +1,82 @@ +SYMBIAN_LANG.af = 34 #Afrikaans +SYMBIAN_LANG.sq = 35 #Albanian +SYMBIAN_LANG.am = 36 #Amharic +SYMBIAN_LANG.ar = 37 #Arabic +SYMBIAN_LANG.hy = 38 #Armenian +SYMBIAN_LANG.bn = 41 #Bengali +SYMBIAN_LANG.bg = 42 #Bulgarian +SYMBIAN_LANG.my = 43 #Burmese +SYMBIAN_LANG.be = 40 #Byelorussian +SYMBIAN_LANG.ca = 44 #Catalan +SYMBIAN_LANG.hr = 45 #Croatian +SYMBIAN_LANG.cs = 25 #Czech +SYMBIAN_LANG.da = 07 #Danish +SYMBIAN_LANG.nl = 18 #Dutch +SYMBIAN_LANG.en = 01 #English(UK) +SYMBIAN_LANG.et = 49 #Estonian +SYMBIAN_LANG.fi = 09 #Finnish +SYMBIAN_LANG.fr = 02 #French +SYMBIAN_LANG.gd = 52 #Gaelic +SYMBIAN_LANG.ka = 53 #Georgian +SYMBIAN_LANG.de = 03 #German +SYMBIAN_LANG.el = 54 #Greek +SYMBIAN_LANG.gu = 56 #Gujarati +SYMBIAN_LANG.he = 57 #Hebrew +SYMBIAN_LANG.hi = 58 #Hindi +SYMBIAN_LANG.hu = 17 #Hungarian +SYMBIAN_LANG.is = 15 #Icelandic +SYMBIAN_LANG.id = 59 #Indonesian +SYMBIAN_LANG.ga = 60 #Irish +SYMBIAN_LANG.it = 05 #Italian +SYMBIAN_LANG.ja = 32 #Japanese +SYMBIAN_LANG.kn = 62 #Kannada +SYMBIAN_LANG.kk = 63 #Kazakh +SYMBIAN_LANG.ko = 65 #Korean +SYMBIAN_LANG.lo = 66 #Laothian +SYMBIAN_LANG.lv = 67 #Latvian +SYMBIAN_LANG.lt = 68 #Lithuanian +SYMBIAN_LANG.mk = 69 #Macedonian +SYMBIAN_LANG.ms = 70 #Malay +SYMBIAN_LANG.ml = 71 #Malayalam +SYMBIAN_LANG.mr = 72 #Marathi +SYMBIAN_LANG.mo = 73 #Moldavian +SYMBIAN_LANG.mn = 74 #Mongolian +SYMBIAN_LANG.nb = 08 #Norwegian +SYMBIAN_LANG.pl = 27 #Polish +SYMBIAN_LANG.pt = 13 #Portuguese +SYMBIAN_LANG.pa = 77 #Punjabi +SYMBIAN_LANG.ro = 78 #Romanian +SYMBIAN_LANG.ru = 16 #Russian +SYMBIAN_LANG.sr = 79 #Serbian +SYMBIAN_LANG.si = 80 #Singhalese +SYMBIAN_LANG.sk = 26 #Slovak +SYMBIAN_LANG.sl = 28 #Slovenian +SYMBIAN_LANG.so = 81 #Somali +SYMBIAN_LANG.es = 04 #Spanish +SYMBIAN_LANG.sw = 84 #Swahili +SYMBIAN_LANG.sv = 06 #Swedish +SYMBIAN_LANG.tl = 39 #Tagalog +SYMBIAN_LANG.ta = 87 #Tamil +SYMBIAN_LANG.te = 88 #Telugu +SYMBIAN_LANG.th = 33 #Thai +SYMBIAN_LANG.bo = 89 #Tibetan +SYMBIAN_LANG.ti = 90 #Tigrinya +SYMBIAN_LANG.tr = 14 #Turkish +SYMBIAN_LANG.tk = 92 #Turkmen +SYMBIAN_LANG.uk = 93 #Ukrainian +SYMBIAN_LANG.ur = 94 #Urdu +SYMBIAN_LANG.vi = 96 #Vietnamese +SYMBIAN_LANG.cy = 97 #Welsh +SYMBIAN_LANG.zu = 98 #Zulu +SYMBIAN_LANG.nn = 75 #Nynorsk + +isEmpty(SYMBIAN_MATCHED_LANGUAGES) { + matchSymbianLanguages() +} + +!isEmpty(SYMBIAN_MATCHED_TRANSLATIONS) { + # Generate dependencies to .ts files for pkg files + template_pkg_target.depends += $$SYMBIAN_MATCHED_TRANSLATIONS + installer_pkg_target.depends += $$SYMBIAN_MATCHED_TRANSLATIONS + stub_pkg_target.depends += $$SYMBIAN_MATCHED_TRANSLATIONS +} diff --git a/mkspecs/features/symbian/qt.prf b/mkspecs/features/symbian/qt.prf index b5d3d98..c8f97aa 100644 --- a/mkspecs/features/symbian/qt.prf +++ b/mkspecs/features/symbian/qt.prf @@ -25,9 +25,10 @@ INCLUDEPATH = $$PREPEND_INCLUDEPATH $$INCLUDEPATH # Note: Qt libs package with full capabilities has UID3 of 0x2001E61C, # while self-signed version typically has temporary UID3 of 0xE001E61C. contains(CONFIG, qt):!contains(TARGET.UID3, 0x2001E61C):!contains(TARGET.UID3, 0xE001E61C):isEmpty(QT_LIBINFIX) { + qt_pkg_name = Qt pkg_depends_qt += \ "; Default dependency to Qt libraries" \ - "(0x2001E61C), $${QT_MAJOR_VERSION}, $${QT_MINOR_VERSION}, $${QT_PATCH_VERSION}, {\"Qt\"}" + "(0x2001E61C), $${QT_MAJOR_VERSION}, $${QT_MINOR_VERSION}, $${QT_PATCH_VERSION}, {$$addLanguageDependentPkgItem(qt_pkg_name)}" # Projects linking to webkit need dependency to webkit contains(QT, webkit): { @@ -38,9 +39,10 @@ contains(CONFIG, qt):!contains(TARGET.UID3, 0x2001E61C):!contains(TARGET.UID3, 0 QT_WEBKIT_PATCH_VERSION = $${QT_PATCH_VERSION} } + webkit_pkg_name = QtWebKit pkg_depends_webkit += \ "; Dependency to Qt Webkit" \ - "(0x200267C2), $${QT_WEBKIT_MAJOR_VERSION}, $${QT_WEBKIT_MINOR_VERSION}, $${QT_WEBKIT_PATCH_VERSION}, {\"QtWebKit\"}" + "(0x200267C2), $${QT_WEBKIT_MAJOR_VERSION}, $${QT_WEBKIT_MINOR_VERSION}, $${QT_WEBKIT_PATCH_VERSION}, {$$addLanguageDependentPkgItem(webkit_pkg_name)}" } else { default_deployment.pkg_prerules -= pkg_depends_webkit } diff --git a/mkspecs/features/symbian/sis_targets.prf b/mkspecs/features/symbian/sis_targets.prf index e838e10..ad81803 100644 --- a/mkspecs/features/symbian/sis_targets.prf +++ b/mkspecs/features/symbian/sis_targets.prf @@ -12,6 +12,17 @@ else:!equals(DEPLOYMENT, default_deployment) { equals(GENERATE_SIS_TARGETS, true) { baseTarget = $$symbianRemoveSpecialCharacters($$basename(TARGET)) + template_pkg_target.target = $${baseTarget}_template.pkg + template_pkg_target.depends += $$_PRO_FILE_ + template_pkg_target.commands = $(MAKE) -f $(MAKEFILE) qmake + installer_pkg_target.target = $${baseTarget}_installer.pkg + installer_pkg_target.depends += $$_PRO_FILE_ + installer_pkg_target.commands = $(MAKE) -f $(MAKEFILE) qmake + stub_pkg_target.target = $${baseTarget}_stub.pkg + stub_pkg_target.depends += $$_PRO_FILE_ + stub_pkg_target.commands = $(MAKE) -f $(MAKEFILE) qmake + QMAKE_EXTRA_TARGETS += template_pkg_target installer_pkg_target stub_pkg_target + symbian-abld|symbian-sbsv2 { symbian-sbsv2 { @@ -35,6 +46,7 @@ equals(GENERATE_SIS_TARGETS, true) { , \ $(MAKE) -f $(MAKEFILE) fail_sis_nopkg \ ) + sis_target.depends += $${baseTarget}_template.pkg ok_sis_target.target = ok_sis ok_sis_target.commands = createpackage $$CONVERT_GCCE_PARAM $(QT_SIS_OPTIONS) $${baseTarget}_template.pkg \ @@ -54,6 +66,7 @@ equals(GENERATE_SIS_TARGETS, true) { , \ $(MAKE) -f $(MAKEFILE) fail_sis_nopkg \ ) + unsigned_sis_target.depends += $${baseTarget}_template.pkg ok_unsigned_sis_target.target = ok_unsigned_sis ok_unsigned_sis_target.commands = createpackage $$CONVERT_GCCE_PARAM $(QT_SIS_OPTIONS) -o $${baseTarget}_template.pkg $(QT_SIS_TARGET) @@ -67,7 +80,7 @@ equals(GENERATE_SIS_TARGETS, true) { , \ $(MAKE) -f $(MAKEFILE) fail_sis_nopkg \ ) - installer_sis_target.depends = sis + installer_sis_target.depends = $${baseTarget}_installer.pkg sis ok_installer_sis_target.target = ok_installer_sis ok_installer_sis_target.commands = createpackage $(QT_SIS_OPTIONS) $${baseTarget}_installer.pkg - \ @@ -79,7 +92,7 @@ equals(GENERATE_SIS_TARGETS, true) { , \ $(MAKE) -f $(MAKEFILE) fail_sis_nopkg \ ) - unsigned_installer_sis_target.depends = unsigned_sis + unsigned_installer_sis_target.depends = $${baseTarget}_installer.pkg unsigned_sis ok_unsigned_installer_sis_target.target = ok_unsigned_installer_sis ok_unsigned_installer_sis_target.commands = createpackage $(QT_SIS_OPTIONS) -o $${baseTarget}_installer.pkg @@ -104,6 +117,7 @@ equals(GENERATE_SIS_TARGETS, true) { , \ $(MAKE) -f $(MAKEFILE) fail_sis_nopkg \ ) + stub_sis_target.depends += $${baseTarget}_stub.pkg ok_stub_sis_target.target = ok_stub_sis ok_stub_sis_target.commands = createpackage -s $(QT_SIS_OPTIONS) $${baseTarget}_stub.pkg \ @@ -154,11 +168,11 @@ equals(GENERATE_SIS_TARGETS, true) { sis_target.target = sis sis_target.commands = $$QMAKE_CREATEPACKAGE $(QT_SIS_OPTIONS) $${baseTarget}_template.pkg \ - $(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE) - sis_target.depends = first + sis_target.depends = first $${baseTarget}_template.pkg unsigned_sis_target.target = unsigned_sis unsigned_sis_target.commands = $$QMAKE_CREATEPACKAGE $(QT_SIS_OPTIONS) -o $${baseTarget}_template.pkg - unsigned_sis_target.depends = first + unsigned_sis_target.depends = first $${baseTarget}_template.pkg target_sis_target.target = $${sis_destdir}/$${baseTarget}.sis target_sis_target.commands = $(MAKE) -f $(MAKEFILE) sis @@ -166,11 +180,11 @@ equals(GENERATE_SIS_TARGETS, true) { installer_sis_target.target = installer_sis installer_sis_target.commands = $$QMAKE_CREATEPACKAGE $(QT_SIS_OPTIONS) $${baseTarget}_installer.pkg - \ $(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE) - installer_sis_target.depends = sis + installer_sis_target.depends = $${baseTarget}_installer.pkg sis unsigned_installer_sis_target.target = unsigned_installer_sis unsigned_installer_sis_target.commands = $$QMAKE_CREATEPACKAGE $(QT_SIS_OPTIONS) -o $${baseTarget}_installer.pkg - unsigned_installer_sis_target.depends = unsigned_sis + unsigned_installer_sis_target.depends = $${baseTarget}_installer.pkg unsigned_sis !isEmpty(sis_destdir):!equals(sis_destdir, "."):!equals(sis_destdir, "./") { sis_target.commands += && $$QMAKE_MOVE $${baseTarget}.sis $$sis_destdir diff --git a/qmake/generators/symbian/symbian_makefile.h b/qmake/generators/symbian/symbian_makefile.h index 94f0145..28a6206 100644 --- a/qmake/generators/symbian/symbian_makefile.h +++ b/qmake/generators/symbian/symbian_makefile.h @@ -79,18 +79,18 @@ public: } } + SymbianLocalizationList symbianLocalizationList; + parseTsFiles(&symbianLocalizationList); + if (generatePkg) { - generatePkgFile(iconFile, false); + generatePkgFile(iconFile, false, symbianLocalizationList); } - // Get the application translations and convert to symbian OS lang code, i.e. decical number - QStringList symbianLangCodes = symbianLangCodesFromTsFiles(); - if (targetType == TypeExe) { if (!this->project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) { writeRegRssFile(userRssRules); writeRssFile(numberOfIcons, iconFile); - writeLocFile(symbianLangCodes); + writeLocFile(symbianLocalizationList); } } diff --git a/qmake/generators/symbian/symbiancommon.cpp b/qmake/generators/symbian/symbiancommon.cpp index 9d4f27e..2244a98 100644 --- a/qmake/generators/symbian/symbiancommon.cpp +++ b/qmake/generators/symbian/symbiancommon.cpp @@ -41,6 +41,7 @@ #include "symbiancommon.h" #include +#include // Included from tools/shared #include @@ -151,7 +152,9 @@ QString romPath(const QString& path) return QLatin1String("z:") + path; } -void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocBuild) +void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, + bool epocBuild, + const SymbianLocalizationList &symbianLocalizationList) { QMakeProject *project = generator->project; QString pkgFilename = Option::output_dir + QLatin1Char('/') + @@ -270,8 +273,17 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB // Apply some defaults if specific data does not exist in PKG pre-rules if (languageRules.isEmpty()) { - // language, (*** hardcoded to english atm, should be parsed from TRANSLATIONS) - languageRules << "; Language\n&EN\n\n"; + if (symbianLocalizationList.isEmpty()) { + languageRules << "; Language\n&EN\n\n"; + } else { + QStringList langCodes; + SymbianLocalizationListIterator iter(symbianLocalizationList); + while (iter.hasNext()) { + const SymbianLocalization &loc = iter.next(); + langCodes << loc.symbianLanguageCode; + } + languageRules << QString("; Languages\n&%1\n\n").arg(langCodes.join(",")); + } } else if (headerRules.isEmpty()) { // In case user defines langs, he must take care also about SIS header fprintf(stderr, "Warning: If language is defined with DEPLOYMENT pkg_prerules, also the SIS header must be defined\n"); @@ -320,12 +332,14 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB // Package header QString sisHeader = "; SIS header: name, uid, version\n#{\"%1\"},(%2),%3\n\n"; - QString visualTarget = project->values("DEPLOYMENT.display_name").join(" "); - if (visualTarget.isEmpty()) - visualTarget = generator->escapeFilePath(project->first("TARGET")); - visualTarget = removePathSeparators(visualTarget); - QString wrapperTarget = visualTarget + " installer"; + QString defaultVisualTarget = project->values("DEPLOYMENT.display_name").join(" "); + if (defaultVisualTarget.isEmpty()) + defaultVisualTarget = generator->escapeFilePath(project->first("TARGET")); + defaultVisualTarget = removePathSeparators(defaultVisualTarget); + + QString visualTarget = generatePkgNameForHeader(symbianLocalizationList, defaultVisualTarget, false); + QString wrapperTarget = generatePkgNameForHeader(symbianLocalizationList, defaultVisualTarget, true); if (installerSisHeader.startsWith("0x", Qt::CaseInsensitive)) { tw << sisHeader.arg(wrapperTarget).arg(installerSisHeader).arg(applicationVersion); @@ -344,7 +358,13 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB // Vendor name if (!containsStartWithItem('%', vendorRules)) { - vendorRules << "; Default localized vendor name\n%{\"Vendor\"}\n\n"; + QString vendorStr = QLatin1String("\"Vendor\","); + QString locVendors = vendorStr; + for (int i = 1; i < symbianLocalizationList.size(); i++) { + locVendors.append(vendorStr); + } + locVendors.chop(1); + vendorRules << QString("; Default localized vendor name\n%{%1}\n\n").arg(locVendors); } if (!containsStartWithItem(':', vendorRules)) { vendorRules << "; Default unique vendor name\n:\"Vendor\"\n\n"; @@ -385,6 +405,13 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB t << manufacturerStr << endl; } + // ### FIXME: remove epocBuild check once makefile based mkspecs support localized resource generation + if (epocBuild && symbianLocalizationList.size()) { + // Add localized resources to DEPLOYMENT if default resource deployment is done + addLocalizedResourcesToDeployment("default_resource_deployment.sources", symbianLocalizationList); + addLocalizedResourcesToDeployment("default_reg_deployment.sources", symbianLocalizationList); + } + // deploy files specified by DEPLOYMENT variable QString remoteTestPath; QString zDir; @@ -633,12 +660,9 @@ void SymbianCommonGenerator::writeRssFile(QString &numberOfIcons, QString &iconF } } -void SymbianCommonGenerator::writeLocFile(QStringList &symbianLangCodes) +void SymbianCommonGenerator::writeLocFile(const SymbianLocalizationList &symbianLocalizationList) { - QString filename(fixedTarget); - if (!Option::output_dir.isEmpty()) - filename = Option::output_dir + '/' + filename; - filename.append(".loc"); + QString filename = generateLocFileName(); QFile ft(filename); if (ft.open(QIODevice::WriteOnly)) { generatedFiles << ft.fileName(); @@ -658,11 +682,22 @@ void SymbianCommonGenerator::writeLocFile(QStringList &symbianLangCodes) t << "#ifdef LANGUAGE_SC" << endl; t << "#define STRING_r_short_caption \"" << displayName << "\"" << endl; t << "#define STRING_r_caption \"" << displayName << "\"" << endl; - foreach(QString lang, symbianLangCodes) { - t << "#elif defined LANGUAGE_" << lang << endl; - t << "#define STRING_r_short_caption \"" << displayName << "\"" << endl; - t << "#define STRING_r_caption \"" << displayName << "\"" << endl; + + SymbianLocalizationListIterator iter(symbianLocalizationList); + while (iter.hasNext()) { + const SymbianLocalization &loc = iter.next(); + QString shortCaption = loc.shortCaption; + QString longCaption = loc.longCaption; + if (shortCaption.isEmpty()) + shortCaption = displayName; + if (longCaption.isEmpty()) + longCaption = displayName; + + t << "#elif defined LANGUAGE_" << loc.symbianLanguageCode << endl; + t << "#define STRING_r_short_caption \"" << shortCaption << "\"" << endl; + t << "#define STRING_r_caption \"" << longCaption << "\"" << endl; } + t << "#else" << endl; t << "#define STRING_r_short_caption \"" << displayName << "\"" << endl; t << "#define STRING_r_caption \"" << displayName << "\"" << endl; @@ -803,195 +838,49 @@ void SymbianCommonGenerator::writeCustomDefFile() } } -QStringList SymbianCommonGenerator::symbianLangCodesFromTsFiles() +void SymbianCommonGenerator::parseTsFiles(SymbianLocalizationList *symbianLocalizationList) { - QStringList tsfiles; - QStringList symbianLangCodes; - tsfiles << generator->project->values("TRANSLATIONS"); + if (!generator->project->isActiveConfig("localize_deployment")) { + return; + } - fillQt2S60LangMapTable(); + QStringList symbianTsFiles; - foreach(QString file, tsfiles) { - int extIndex = file.lastIndexOf("."); - int langIndex = file.lastIndexOf("_", (extIndex - file.length())); - langIndex += 1; - QString qtlang = file.mid(langIndex, extIndex - langIndex); - QString s60lang = qt2S60LangMapTable.value(qtlang, QString("SC")); + symbianTsFiles << generator->project->values("SYMBIAN_MATCHED_TRANSLATIONS"); - if (!symbianLangCodes.contains(s60lang) && s60lang != "SC") - symbianLangCodes += s60lang; - } + if (!symbianTsFiles.isEmpty()) { + fillQt2SymbianLocalizationList(symbianLocalizationList); - return symbianLangCodes; + QMutableListIterator iter(*symbianLocalizationList); + while (iter.hasNext()) { + SymbianLocalization &loc = iter.next(); + static QString matchStrTemplate = QLatin1String(".*_%1\\.ts"); + QString matchStr = matchStrTemplate.arg(loc.qtLanguageCode); + + foreach (QString file, symbianTsFiles) { + QRegExp matcher(matchStr); + if (matcher.exactMatch(file) && parseTsContent(file, &loc)) + break; + } + } + } } -void SymbianCommonGenerator::fillQt2S60LangMapTable() +void SymbianCommonGenerator::fillQt2SymbianLocalizationList(SymbianLocalizationList *symbianLocalizationList) { - qt2S60LangMapTable.reserve(170); // 165 items at time of writing. - qt2S60LangMapTable.insert("ab", "SC"); //Abkhazian // - qt2S60LangMapTable.insert("om", "SC"); //Afan // - qt2S60LangMapTable.insert("aa", "SC"); //Afar // - qt2S60LangMapTable.insert("af", "34"); //Afrikaans //Afrikaans - qt2S60LangMapTable.insert("sq", "35"); //Albanian //Albanian - qt2S60LangMapTable.insert("am", "36"); //Amharic //Amharic - qt2S60LangMapTable.insert("ar", "37"); //Arabic //Arabic - qt2S60LangMapTable.insert("hy", "38"); //Armenian //Armenian - qt2S60LangMapTable.insert("as", "SC"); //Assamese // - qt2S60LangMapTable.insert("ay", "SC"); //Aymara // - qt2S60LangMapTable.insert("az", "SC"); //Azerbaijani // - qt2S60LangMapTable.insert("ba", "SC"); //Bashkir // - qt2S60LangMapTable.insert("eu", "SC"); //Basque // - qt2S60LangMapTable.insert("bn", "41"); //Bengali //Bengali - qt2S60LangMapTable.insert("dz", "SC"); //Bhutani // - qt2S60LangMapTable.insert("bh", "SC"); //Bihari // - qt2S60LangMapTable.insert("bi", "SC"); //Bislama // - qt2S60LangMapTable.insert("br", "SC"); //Breton // - qt2S60LangMapTable.insert("bg", "42"); //Bulgarian //Bulgarian - qt2S60LangMapTable.insert("my", "43"); //Burmese //Burmese - qt2S60LangMapTable.insert("be", "40"); //Byelorussian //Belarussian - qt2S60LangMapTable.insert("km", "SC"); //Cambodian // - qt2S60LangMapTable.insert("ca", "44"); //Catalan //Catalan - qt2S60LangMapTable.insert("zh", "SC"); //Chinese // - qt2S60LangMapTable.insert("co", "SC"); //Corsican // - qt2S60LangMapTable.insert("hr", "45"); //Croatian //Croatian - qt2S60LangMapTable.insert("cs", "25"); //Czech //Czech - qt2S60LangMapTable.insert("da", "07"); //Danish //Danish - qt2S60LangMapTable.insert("nl", "18"); //Dutch //Dutch - qt2S60LangMapTable.insert("en", "01"); //English //English(UK) - qt2S60LangMapTable.insert("eo", "SC"); //Esperanto // - qt2S60LangMapTable.insert("et", "49"); //Estonian //Estonian - qt2S60LangMapTable.insert("fo", "SC"); //Faroese // - qt2S60LangMapTable.insert("fj", "SC"); //Fiji // - qt2S60LangMapTable.insert("fi", "09"); //Finnish //Finnish - qt2S60LangMapTable.insert("fr", "02"); //French //French - qt2S60LangMapTable.insert("fy", "SC"); //Frisian // - qt2S60LangMapTable.insert("gd", "52"); //Gaelic //Gaelic - qt2S60LangMapTable.insert("gl", "SC"); //Galician // - qt2S60LangMapTable.insert("ka", "53"); //Georgian //Georgian - qt2S60LangMapTable.insert("de", "03"); //German //German - qt2S60LangMapTable.insert("el", "54"); //Greek //Greek - qt2S60LangMapTable.insert("kl", "SC"); //Greenlandic // - qt2S60LangMapTable.insert("gn", "SC"); //Guarani // - qt2S60LangMapTable.insert("gu", "56"); //Gujarati //Gujarati - qt2S60LangMapTable.insert("ha", "SC"); //Hausa // - qt2S60LangMapTable.insert("he", "57"); //Hebrew //Hebrew - qt2S60LangMapTable.insert("hi", "58"); //Hindi //Hindi - qt2S60LangMapTable.insert("hu", "17"); //Hungarian //Hungarian - qt2S60LangMapTable.insert("is", "15"); //Icelandic //Icelandic - qt2S60LangMapTable.insert("id", "59"); //Indonesian //Indonesian - qt2S60LangMapTable.insert("ia", "SC"); //Interlingua // - qt2S60LangMapTable.insert("ie", "SC"); //Interlingue // - qt2S60LangMapTable.insert("iu", "SC"); //Inuktitut // - qt2S60LangMapTable.insert("ik", "SC"); //Inupiak // - qt2S60LangMapTable.insert("ga", "60"); //Irish //Irish - qt2S60LangMapTable.insert("it", "05"); //Italian //Italian - qt2S60LangMapTable.insert("ja", "32"); //Japanese //Japanese - qt2S60LangMapTable.insert("jv", "SC"); //Javanese // - qt2S60LangMapTable.insert("kn", "62"); //Kannada //Kannada - qt2S60LangMapTable.insert("ks", "SC"); //Kashmiri // - qt2S60LangMapTable.insert("kk", "63"); //Kazakh //Kazakh - qt2S60LangMapTable.insert("rw", "SC"); //Kinyarwanda // - qt2S60LangMapTable.insert("ky", "SC"); //Kirghiz // - qt2S60LangMapTable.insert("ko", "65"); //Korean //Korean - qt2S60LangMapTable.insert("ku", "SC"); //Kurdish // - qt2S60LangMapTable.insert("rn", "SC"); //Kurundi // - qt2S60LangMapTable.insert("lo", "66"); //Laothian //Laothian - qt2S60LangMapTable.insert("la", "SC"); //Latin // - qt2S60LangMapTable.insert("lv", "67"); //Latvian //Latvian - qt2S60LangMapTable.insert("ln", "SC"); //Lingala // - qt2S60LangMapTable.insert("lt", "68"); //Lithuanian //Lithuanian - qt2S60LangMapTable.insert("mk", "69"); //Macedonian //Macedonian - qt2S60LangMapTable.insert("mg", "SC"); //Malagasy // - qt2S60LangMapTable.insert("ms", "70"); //Malay //Malay - qt2S60LangMapTable.insert("ml", "71"); //Malayalam //Malayalam - qt2S60LangMapTable.insert("mt", "SC"); //Maltese // - qt2S60LangMapTable.insert("mi", "SC"); //Maori // - qt2S60LangMapTable.insert("mr", "72"); //Marathi //Marathi - qt2S60LangMapTable.insert("mo", "73"); //Moldavian //Moldovian - qt2S60LangMapTable.insert("mn", "74"); //Mongolian //Mongolian - qt2S60LangMapTable.insert("na", "SC"); //Nauru // - qt2S60LangMapTable.insert("ne", "SC"); //Nepali // - qt2S60LangMapTable.insert("nb", "08"); //Norwegian //Norwegian - qt2S60LangMapTable.insert("oc", "SC"); //Occitan // - qt2S60LangMapTable.insert("or", "SC"); //Oriya // - qt2S60LangMapTable.insert("ps", "SC"); //Pashto // - qt2S60LangMapTable.insert("fa", "SC"); //Persian // - qt2S60LangMapTable.insert("pl", "27"); //Polish //Polish - qt2S60LangMapTable.insert("pt", "13"); //Portuguese //Portuguese - qt2S60LangMapTable.insert("pa", "77"); //Punjabi //Punjabi - qt2S60LangMapTable.insert("qu", "SC"); //Quechua // - qt2S60LangMapTable.insert("rm", "SC"); //RhaetoRomance // - qt2S60LangMapTable.insert("ro", "78"); //Romanian //Romanian - qt2S60LangMapTable.insert("ru", "16"); //Russian //Russian - qt2S60LangMapTable.insert("sm", "SC"); //Samoan // - qt2S60LangMapTable.insert("sg", "SC"); //Sangho // - qt2S60LangMapTable.insert("sa", "SC"); //Sanskrit // - qt2S60LangMapTable.insert("sr", "79"); //Serbian //Serbian - qt2S60LangMapTable.insert("sh", "SC"); //SerboCroatian // - qt2S60LangMapTable.insert("st", "SC"); //Sesotho // - qt2S60LangMapTable.insert("tn", "SC"); //Setswana // - qt2S60LangMapTable.insert("sn", "SC"); //Shona // - qt2S60LangMapTable.insert("sd", "SC"); //Sindhi // - qt2S60LangMapTable.insert("si", "80"); //Singhalese //Sinhalese - qt2S60LangMapTable.insert("ss", "SC"); //Siswati // - qt2S60LangMapTable.insert("sk", "26"); //Slovak //Slovak - qt2S60LangMapTable.insert("sl", "28"); //Slovenian //Slovenian - qt2S60LangMapTable.insert("so", "81"); //Somali //Somali - qt2S60LangMapTable.insert("es", "04"); //Spanish //Spanish - qt2S60LangMapTable.insert("su", "SC"); //Sundanese // - qt2S60LangMapTable.insert("sw", "84"); //Swahili //Swahili - qt2S60LangMapTable.insert("sv", "06"); //Swedish //Swedish - qt2S60LangMapTable.insert("tl", "39"); //Tagalog //Tagalog - qt2S60LangMapTable.insert("tg", "SC"); //Tajik // - qt2S60LangMapTable.insert("ta", "87"); //Tamil //Tamil - qt2S60LangMapTable.insert("tt", "SC"); //Tatar // - qt2S60LangMapTable.insert("te", "88"); //Telugu //Telugu - qt2S60LangMapTable.insert("th", "33"); //Thai //Thai - qt2S60LangMapTable.insert("bo", "89"); //Tibetan //Tibetan - qt2S60LangMapTable.insert("ti", "90"); //Tigrinya //Tigrinya - qt2S60LangMapTable.insert("to", "SC"); //Tonga // - qt2S60LangMapTable.insert("ts", "SC"); //Tsonga // - qt2S60LangMapTable.insert("tr", "14"); //Turkish //Turkish - qt2S60LangMapTable.insert("tk", "92"); //Turkmen //Turkmen - qt2S60LangMapTable.insert("tw", "SC"); //Twi // - qt2S60LangMapTable.insert("ug", "SC"); //Uigur // - qt2S60LangMapTable.insert("uk", "93"); //Ukrainian //Ukrainian - qt2S60LangMapTable.insert("ur", "94"); //Urdu //Urdu - qt2S60LangMapTable.insert("uz", "SC"); //Uzbek // - qt2S60LangMapTable.insert("vi", "96"); //Vietnamese //Vietnamese - qt2S60LangMapTable.insert("vo", "SC"); //Volapuk // - qt2S60LangMapTable.insert("cy", "97"); //Welsh //Welsh - qt2S60LangMapTable.insert("wo", "SC"); //Wolof // - qt2S60LangMapTable.insert("xh", "SC"); //Xhosa // - qt2S60LangMapTable.insert("yi", "SC"); //Yiddish // - qt2S60LangMapTable.insert("yo", "SC"); //Yoruba // - qt2S60LangMapTable.insert("za", "SC"); //Zhuang // - qt2S60LangMapTable.insert("zu", "98"); //Zulu //Zulu - qt2S60LangMapTable.insert("nn", "75"); //Nynorsk //NorwegianNynorsk - qt2S60LangMapTable.insert("bs", "SC"); //Bosnian // - qt2S60LangMapTable.insert("dv", "SC"); //Divehi // - qt2S60LangMapTable.insert("gv", "SC"); //Manx // - qt2S60LangMapTable.insert("kw", "SC"); //Cornish // - qt2S60LangMapTable.insert("ak", "SC"); //Akan // - qt2S60LangMapTable.insert("kok", "SC"); //Konkani // - qt2S60LangMapTable.insert("gaa", "SC"); //Ga // - qt2S60LangMapTable.insert("ig", "SC"); //Igbo // - qt2S60LangMapTable.insert("kam", "SC"); //Kamba // - qt2S60LangMapTable.insert("syr", "SC"); //Syriac // - qt2S60LangMapTable.insert("byn", "SC"); //Blin // - qt2S60LangMapTable.insert("gez", "SC"); //Geez // - qt2S60LangMapTable.insert("kfo", "SC"); //Koro // - qt2S60LangMapTable.insert("sid", "SC"); //Sidamo // - qt2S60LangMapTable.insert("cch", "SC"); //Atsam // - qt2S60LangMapTable.insert("tig", "SC"); //Tigre // - qt2S60LangMapTable.insert("kaj", "SC"); //Jju // - qt2S60LangMapTable.insert("fur", "SC"); //Friulian // - qt2S60LangMapTable.insert("ve", "SC"); //Venda // - qt2S60LangMapTable.insert("ee", "SC"); //Ewe // - qt2S60LangMapTable.insert("wa", "SC"); //Walamo // - qt2S60LangMapTable.insert("haw", "SC"); //Hawaiian // - qt2S60LangMapTable.insert("kcg", "SC"); //Tyap // - qt2S60LangMapTable.insert("ny", "SC"); //Chewa // + static QString symbianCodePrefix = QLatin1String("SYMBIAN_LANG."); + + QStringList symbianLanguages = generator->project->values("SYMBIAN_MATCHED_LANGUAGES"); + + foreach (QString qtCode, symbianLanguages) { + SymbianLocalization newLoc; + QString symbianCodeVariable = symbianCodePrefix + qtCode; + newLoc.symbianLanguageCode = generator->project->first(symbianCodeVariable); + if (!newLoc.symbianLanguageCode.isEmpty()) { + newLoc.qtLanguageCode = qtCode; + symbianLocalizationList->append(newLoc); + } + } } void SymbianCommonGenerator::parsePreRules(const QString &deploymentVariable, @@ -1057,3 +946,183 @@ void SymbianCommonGenerator::parsePostRules(const QString &deploymentVariable, } } +bool SymbianCommonGenerator::parseTsContent(const QString &tsFilename, SymbianLocalization *loc) +{ + bool retval = true; + QMakeProject *project = generator->project; + QFile tsFile(tsFilename); + + if (tsFile.exists()) { + if (tsFile.open(QIODevice::ReadOnly)) { + static QString applicationCaptionsContext = QLatin1String("QtApplicationCaptions"); + static QString pkgNameContext = QLatin1String("QtPackageNames"); + static QString tsElement = QLatin1String("TS"); + static QString contextElement = QLatin1String("context"); + static QString nameElement = QLatin1String("name"); + static QString messageElement = QLatin1String("message"); + static QString sourceElement = QLatin1String("source"); + static QString translationElement = QLatin1String("translation"); + static QString shortCaptionId = QLatin1String("Application short caption"); + static QString longCaptionId = QLatin1String("Application long caption"); + static QString pkgDisplayNameId = QLatin1String("Package name"); + static QString installerPkgDisplayNameId = QLatin1String("Smart installer package name"); + static QString languageAttribute = QLatin1String("language"); + static QChar underscoreChar = QLatin1Char('_'); + + enum CurrentContext { + ContextUnknown, + ContextUninteresting, + ContextInteresting + }; + + QXmlStreamReader xml(&tsFile); + + while (xml.name() != tsElement) + xml.readNextStartElement(); + + while (xml.readNextStartElement()) { + if (xml.name() == contextElement) { + CurrentContext currentContext = ContextUnknown; + while (xml.readNextStartElement()) { + if (currentContext == ContextUnknown) { + // Expect name element before message elements + if (xml.name() == nameElement) { + QString nameText = xml.readElementText(); + if (nameText == applicationCaptionsContext || nameText == pkgNameContext) { + currentContext = ContextInteresting; + } else { + currentContext = ContextUninteresting; + } + } else { + xml.skipCurrentElement(); + } + } else if (currentContext == ContextInteresting) { + if (xml.name() == messageElement) { + QString source; + QString translation; + while (xml.readNextStartElement()) { + if (xml.name() == sourceElement) { + source = xml.readElementText(); + } else if (xml.name() == translationElement) { + translation = xml.readElementText(); + } else { + xml.skipCurrentElement(); + } + } + + if (source == shortCaptionId) { + if (loc->shortCaption.isEmpty()) { + loc->shortCaption = translation; + } else { + fprintf(stderr, "Warning: Duplicate application short caption defined in (%s).\n", + qPrintable(tsFilename)); + } + } else if (source == longCaptionId) { + if (loc->longCaption.isEmpty()) { + loc->longCaption = translation; + } else { + fprintf(stderr, "Warning: Duplicate application long caption defined in (%s).\n", + qPrintable(tsFilename)); + } + } else if (source == pkgDisplayNameId) { + if (loc->pkgDisplayName.isEmpty()) { + loc->pkgDisplayName = translation; + } else { + fprintf(stderr, "Warning: Duplicate package display name defined in (%s).\n", + qPrintable(tsFilename)); + } + } else if (source == installerPkgDisplayNameId) { + if (loc->installerPkgDisplayName.isEmpty()) { + loc->installerPkgDisplayName = translation; + } else { + fprintf(stderr, "Warning: Duplicate smart installer package display name defined in (%s).\n", + qPrintable(tsFilename)); + } + } + } else { + xml.skipCurrentElement(); + } + } else { + xml.skipCurrentElement(); + } + } + } else { + xml.skipCurrentElement(); + } + } + if (xml.hasError()) { + retval = false; + fprintf(stderr, "ERROR: Encountered error \"%s\" when parsing ts file (%s).\n", + qPrintable(xml.errorString()), qPrintable(tsFilename)); + } + } else { + retval = false; + fprintf(stderr, "Warning: Could not open ts file (%s).\n", qPrintable(tsFilename)); + } + } else { + retval = false; + fprintf(stderr, "Warning: ts file does not exist: (%s), unable to parse it.\n", + qPrintable(tsFilename)); + } + + return retval; +} + +QString SymbianCommonGenerator::generatePkgNameForHeader(const SymbianLocalizationList &symbianLocalizationList, + const QString &defaultName, + bool isForSmartInstaller) +{ + QStringList allNames; + QString noTranslation = defaultName; + + if (isForSmartInstaller) + noTranslation += QLatin1String(" installer"); + + SymbianLocalizationListIterator iter(symbianLocalizationList); + while (iter.hasNext()) { + const SymbianLocalization &loc = iter.next(); + QString currentName; + if (isForSmartInstaller) { + currentName = loc.installerPkgDisplayName; + } else { + currentName = loc.pkgDisplayName; + } + + if (currentName.isEmpty()) + currentName = noTranslation; + + allNames << currentName; + } + + if (!allNames.size()) + allNames << noTranslation; + + return allNames.join("\",\""); + +} + +void SymbianCommonGenerator::addLocalizedResourcesToDeployment(const QString &deploymentFilesVar, + const SymbianLocalizationList &symbianLocalizationList) +{ + QStringList locResources; + foreach (QString defaultResource, generator->project->values(deploymentFilesVar)) { + if (defaultResource.endsWith(".rsc")) { + defaultResource.chop(2); + SymbianLocalizationListIterator iter(symbianLocalizationList); + while (iter.hasNext()) { + const SymbianLocalization &loc = iter.next(); + locResources << QString(defaultResource + loc.symbianLanguageCode); + } + } + } + generator->project->values(deploymentFilesVar) << locResources; +} + +QString SymbianCommonGenerator::generateLocFileName() +{ + QString fileName(fixedTarget); + if (!Option::output_dir.isEmpty()) + fileName = Option::output_dir + QLatin1Char('/') + fileName; + fileName.append(".loc"); + return fileName; +} diff --git a/qmake/generators/symbian/symbiancommon.h b/qmake/generators/symbian/symbiancommon.h index 80f2079..1db5890 100644 --- a/qmake/generators/symbian/symbiancommon.h +++ b/qmake/generators/symbian/symbiancommon.h @@ -48,6 +48,20 @@ #define PRINT_FILE_CREATE_ERROR(filename) fprintf(stderr, "Error: Could not create '%s'\n", qPrintable(filename)); +class SymbianLocalization +{ +public: + QString qtLanguageCode; + QString symbianLanguageCode; + QString shortCaption; + QString longCaption; + QString pkgDisplayName; + QString installerPkgDisplayName; +}; + +typedef QList SymbianLocalizationList; +typedef QListIterator SymbianLocalizationListIterator; + class SymbianCommonGenerator { public: @@ -59,6 +73,7 @@ public: TypeSubdirs }; + SymbianCommonGenerator(MakefileGenerator *generator); virtual void init(); @@ -68,7 +83,9 @@ protected: QString removePathSeparators(QString &file); void removeSpecialCharacters(QString& str); void removeEpocSpecialCharacters(QString& str); - void generatePkgFile(const QString &iconFile, bool epocBuild); + void generatePkgFile(const QString &iconFile, + bool epocBuild, + const SymbianLocalizationList &symbianLocalizationList); bool containsStartWithItem(const QChar &c, const QStringList& src); void writeRegRssFile(QMap &useritems); @@ -76,15 +93,15 @@ protected: const QString &listTag, const QString &listItem); void writeRssFile(QString &numberOfIcons, QString &iconfile); - void writeLocFile(QStringList &symbianLangCodes); + void writeLocFile(const SymbianLocalizationList &symbianLocalizationList); void readRssRules(QString &numberOfIcons, QString &iconFile, QMap &userRssRules); void writeCustomDefFile(); - QStringList symbianLangCodesFromTsFiles(); - void fillQt2S60LangMapTable(); + void parseTsFiles(SymbianLocalizationList *symbianLocalizationList); + void fillQt2SymbianLocalizationList(SymbianLocalizationList *symbianLocalizationList); void parsePreRules(const QString &deploymentVariable, const QString &variableSuffix, @@ -95,7 +112,13 @@ protected: void parsePostRules(const QString &deploymentVariable, const QString &variableSuffix, QStringList *rawRuleList); - + bool parseTsContent(const QString &tsFilename, SymbianLocalization *loc); + QString generatePkgNameForHeader(const SymbianLocalizationList &symbianLocalizationList, + const QString &defaultName, + bool isForSmartInstaller); + void addLocalizedResourcesToDeployment(const QString &deploymentFilesVar, + const SymbianLocalizationList &symbianLocalizationList); + QString generateLocFileName(); protected: MakefileGenerator *generator; @@ -106,8 +129,6 @@ protected: QString privateDirUid; QString uid3; TargetType targetType; - - QHash qt2S60LangMapTable; }; #endif // SYMBIANCOMMON_H diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index 0b0033a..e1426ab 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -187,8 +187,8 @@ bool SymbianMakefileGenerator::writeMakefile(QTextStream &t) QMap userRssRules; readRssRules(numberOfIcons, iconFile, userRssRules); - // Get the application translations and convert to symbian OS lang code, i.e. decical number - QStringList symbianLangCodes = symbianLangCodesFromTsFiles(); + SymbianLocalizationList symbianLocalizationList; + parseTsFiles(&symbianLocalizationList); // Generate pkg files if there are any actual files to deploy bool generatePkg = false; @@ -205,7 +205,7 @@ bool SymbianMakefileGenerator::writeMakefile(QTextStream &t) } if (generatePkg) { - generatePkgFile(iconFile, true); + generatePkgFile(iconFile, true, symbianLocalizationList); } writeBldInfContent(t, generatePkg, iconFile); @@ -242,13 +242,13 @@ bool SymbianMakefileGenerator::writeMakefile(QTextStream &t) writeMkFile(wrapperFileName, false); QString absoluteMmpFileName = Option::output_dir + QLatin1Char('/') + mmpFileName; - writeMmpFile(absoluteMmpFileName, symbianLangCodes); + writeMmpFile(absoluteMmpFileName, symbianLocalizationList); if (targetType == TypeExe) { if (!project->isActiveConfig("no_icon")) { writeRegRssFile(userRssRules); writeRssFile(numberOfIcons, iconFile); - writeLocFile(symbianLangCodes); + writeLocFile(symbianLocalizationList); } } @@ -489,7 +489,7 @@ void SymbianMakefileGenerator::writeMmpFileHeader(QTextStream &t) t << "// ==============================================================================" << endl << endl; } -void SymbianMakefileGenerator::writeMmpFile(QString &filename, QStringList &symbianLangCodes) +void SymbianMakefileGenerator::writeMmpFile(QString &filename, const SymbianLocalizationList &symbianLocalizationList) { QFile ft(filename); if (ft.open(QIODevice::WriteOnly)) { @@ -501,7 +501,7 @@ void SymbianMakefileGenerator::writeMmpFile(QString &filename, QStringList &symb writeMmpFileTargetPart(t); - writeMmpFileResourcePart(t, symbianLangCodes); + writeMmpFileResourcePart(t, symbianLocalizationList); writeMmpFileMacrosPart(t); @@ -643,7 +643,7 @@ void SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t) Application registration resource files should be installed to the \private\10003a3f\import\apps directory. */ -void SymbianMakefileGenerator::writeMmpFileResourcePart(QTextStream& t, QStringList &symbianLangCodes) +void SymbianMakefileGenerator::writeMmpFileResourcePart(QTextStream& t, const SymbianLocalizationList &symbianLocalizationList) { if ((targetType == TypeExe) && !project->isActiveConfig("no_icon")) { @@ -653,8 +653,10 @@ void SymbianMakefileGenerator::writeMmpFileResourcePart(QTextStream& t, QStringL t << "SOURCEPATH\t\t\t. " << endl; t << "LANG SC "; // no endl - foreach(QString lang, symbianLangCodes) { - t << lang << " "; // no endl + SymbianLocalizationListIterator iter(symbianLocalizationList); + while (iter.hasNext()) { + const SymbianLocalization &loc = iter.next(); + t << loc.symbianLanguageCode << " "; // no endl } t << endl; t << MMP_START_RESOURCE "\t\t" << locTarget << endl; @@ -1108,3 +1110,18 @@ void SymbianMakefileGenerator::generateDistcleanTargets(QTextStream& t) t << "distclean: clean dodistclean" << endl; t << endl; } + +// Returns a string that can be used as a dependency to loc file on other targets +QString SymbianMakefileGenerator::generateLocFileTarget(QTextStream& t, const QString& locCmd) +{ + QString locFile; + if (targetType == TypeExe && !project->isActiveConfig("no_icon")) { + locFile = Option::fixPathToLocalOS(generateLocFileName()); + t << locFile << QLatin1String(": ") << project->values("SYMBIAN_MATCHED_TRANSLATIONS").join(" ") << endl; + t << locCmd << endl; + t << endl; + locFile += QLatin1Char(' '); + } + + return locFile; +} \ No newline at end of file diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h index a1a8e88..aba11de 100644 --- a/qmake/generators/symbian/symmake.h +++ b/qmake/generators/symbian/symmake.h @@ -97,11 +97,11 @@ protected: static bool removeDuplicatedStrings(QStringList& stringList); void writeMmpFileHeader(QTextStream &t); - void writeMmpFile(QString &filename, QStringList &symbianLangCodes); + void writeMmpFile(QString &filename, const SymbianLocalizationList &symbianLocalizationList); void writeMmpFileMacrosPart(QTextStream& t); void addMacro(QTextStream& t, const QString& value); void writeMmpFileTargetPart(QTextStream& t); - void writeMmpFileResourcePart(QTextStream& t, QStringList &symbianLangCodes); + void writeMmpFileResourcePart(QTextStream& t, const SymbianLocalizationList &symbianLocalizationList); void writeMmpFileSystemIncludePart(QTextStream& t); void writeMmpFileIncludePart(QTextStream& t); void writeMmpFileLibraryPart(QTextStream& t); @@ -131,6 +131,7 @@ protected: const QString& itemSuffix); void generateDistcleanTargets(QTextStream& t); + QString generateLocFileTarget(QTextStream& t, const QString& locCmd); // Subclass implements virtual void writeBldInfExtensionRulesPart(QTextStream& t, const QString &iconTargetFile) = 0; diff --git a/qmake/generators/symbian/symmake_abld.cpp b/qmake/generators/symbian/symmake_abld.cpp index f895109..7059a52 100644 --- a/qmake/generators/symbian/symmake_abld.cpp +++ b/qmake/generators/symbian/symmake_abld.cpp @@ -267,12 +267,14 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool t << "\tbldmake bldfiles" << endl; t << endl; - t << "debug: $(ABLD)" << endl; + QString locFileDep = generateLocFileTarget(t, qmakeCmd); + + t << "debug: " << locFileDep << "$(ABLD)" << endl; foreach(QString item, debugPlatforms) { t << "\t$(ABLD)" << testClause << " build " << item << " udeb" << endl; } t << endl; - t << "release: $(ABLD)" << endl; + t << "release: " << locFileDep << "$(ABLD)" << endl; foreach(QString item, releasePlatforms) { t << "\t$(ABLD)" << testClause << " build " << item << " urel" << endl; } @@ -280,12 +282,12 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool // For more specific builds, targets are in this form: build-platform, e.g. release-armv5 foreach(QString item, debugPlatforms) { - t << "debug-" << item << ": $(ABLD)" << endl; + t << "debug-" << item << ": " << locFileDep << "$(ABLD)" << endl; t << "\t$(ABLD)" << testClause << " build " << item << " udeb" << endl; } foreach(QString item, releasePlatforms) { - t << "release-" << item << ": $(ABLD)" << endl; + t << "release-" << item << ": " << locFileDep << "$(ABLD)" << endl; t << "\t$(ABLD)" << testClause << " build " << item << " urel" << endl; } diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp index d650e08..b3f8ba2 100644 --- a/qmake/generators/symbian/symmake_sbsv2.cpp +++ b/qmake/generators/symbian/symmake_sbsv2.cpp @@ -386,8 +386,9 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo t << endl; QString currentClause; + QString locFileDep = generateLocFileTarget(t, qmakeCmd); - t << "debug: " << BLD_INF_FILENAME << endl; + t << "debug: " << locFileDep << BLD_INF_FILENAME << endl; t << "\t$(SBS)"; foreach(QString clause, debugClauses) { t << clause; @@ -399,7 +400,7 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo t << clause; } t << endl; - t << "release: " << BLD_INF_FILENAME << endl; + t << "release: " << locFileDep << BLD_INF_FILENAME << endl; t << "\t$(SBS)"; foreach(QString clause, releaseClauses) { t << clause; @@ -431,7 +432,7 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo else // use generic arm clause clause = configClause(item, debugBuild, defaultRvctCompilerVersion, genericArmClause); - t << "debug-" << item << ": " << BLD_INF_FILENAME << endl; + t << "debug-" << item << ": " << locFileDep << BLD_INF_FILENAME << endl; t << "\t$(SBS)" << clause << endl; t << "clean-debug-" << item << ": " << BLD_INF_FILENAME << endl; t << "\t$(SBS) reallyclean" << clause << endl; @@ -444,7 +445,7 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo else // use generic arm clause clause = configClause(item, releaseBuild, defaultRvctCompilerVersion, genericArmClause); - t << "release-" << item << ": " << BLD_INF_FILENAME << endl; + t << "release-" << item << ": " << locFileDep << BLD_INF_FILENAME << endl; t << "\t$(SBS)" << clause << endl; t << "clean-release-" << item << ": " << BLD_INF_FILENAME << endl; t << "\t$(SBS) reallyclean" << clause << endl; @@ -454,11 +455,11 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo foreach(QString compilerVersion, allArmCompilerVersions) { QString debugClause = configClause(item, debugBuild, compilerVersion, armClause); QString releaseClause = configClause(item, releaseBuild, compilerVersion, armClause); - t << "debug-" << item << "-" << compilerVersion << ": " << BLD_INF_FILENAME << endl; + t << "debug-" << item << "-" << compilerVersion << ": " << locFileDep << BLD_INF_FILENAME << endl; t << "\t$(SBS)" << debugClause << endl; t << "clean-debug-" << item << "-" << compilerVersion << ": " << BLD_INF_FILENAME << endl; t << "\t$(SBS) reallyclean" << debugClause << endl; - t << "release-" << item << "-" << compilerVersion << ": " << BLD_INF_FILENAME << endl; + t << "release-" << item << "-" << compilerVersion << ": " << locFileDep << BLD_INF_FILENAME << endl; t << "\t$(SBS)" << releaseClause << endl; t << "clean-release-" << item << "-" << compilerVersion << ": " << BLD_INF_FILENAME << endl; t << "\t$(SBS) reallyclean" << releaseClause << endl; diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index 65b8781..a236028 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -191,11 +191,9 @@ symbian: { qtlibraries.sources += $$QMAKE_LIBDIR_QT/QtOpenVG$${QT_LIBINFIX}.dll graphicssystems_plugins.sources += $$QT_BUILD_TREE/plugins/graphicssystems/qvggraphicssystem$${QT_LIBINFIX}.dll # OpenVG requires Symbian^3 or later - pkg_platform_dependencies -= \ - "[0x101F7961],0,0,0,{\"S60ProductID\"}" \ - "[0x102032BE],0,0,0,{\"S60ProductID\"}" \ - "[0x102752AE],0,0,0,{\"S60ProductID\"}" \ - "[0x1028315F],0,0,0,{\"S60ProductID\"}" + pkg_platform_dependencies = \ + "[0x20022E6D],0,0,0,{\"S60ProductID\"}" \ + "[0x20032DE7],0,0,0,{\"S60ProductID\"}" } contains(QT_CONFIG, opengl) { diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index 49906e0..76a8756 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -350,6 +350,10 @@ static void processProjects( ProFileEvaluator visitor; visitor.setVerbose(options & Verbose); + QHash lupdateConfig; + lupdateConfig.insert(QLatin1String("CONFIG"), QStringList(QLatin1String("lupdate_run"))); + visitor.addVariables(lupdateConfig); + QFileInfo pfi(proFile); ProFile pro(pfi.absoluteFilePath()); if (!visitor.queryProFile(&pro) || !visitor.accept(&pro)) { -- cgit v0.12 From ad8e7b27427825bee730c55735cd2554407205e4 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 12 Nov 2010 11:28:09 +0200 Subject: Add Location as self signable capability in patch_capabilities.pl Location was not originally included in self-signable set, since in S60 3.1 devices it is not so. However, it is a lesser of two evils to make applications with Location capability not install on 3.1 devices than make them not work correctly on any devices, so Location is now included in the self-signable set in patch_capabilities.pl. Task-number: QTBUG-13891 Reviewed-by: Janne Koskinen --- bin/patch_capabilities.pl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/patch_capabilities.pl b/bin/patch_capabilities.pl index 5230480..994d493 100755 --- a/bin/patch_capabilities.pl +++ b/bin/patch_capabilities.pl @@ -78,7 +78,7 @@ sub trim($) { my $nullDevice = "/dev/null"; $nullDevice = "NUL" if ($^O =~ /MSWin/); -my @capabilitiesToAllow = ("LocalServices", "NetworkServices", "ReadUserData", "UserEnvironment", "WriteUserData"); +my @capabilitiesToAllow = ("LocalServices", "NetworkServices", "ReadUserData", "UserEnvironment", "WriteUserData", "Location"); my @capabilitiesSpecified = (); # If arguments were given to the script, @@ -301,6 +301,9 @@ if (@ARGV) $_ = trim($_); if ($capabilitiesToAllow =~ /$_/) { push(@capabilitiesToSet, $_); + if (Location =~ /$_/i) { + print ("Patching: Warning - \"Location\" capability detected for binary: \"$binaryBaseName\". This capability is not self-signable for S60 3rd edition feature pack 1 devices, so installing this package on those devices will most likely not work.\n"); + } } else { push(@capabilitiesToDrop, $_); } @@ -319,6 +322,7 @@ if (@ARGV) # While libraries often have capabilities they do not themselves need just to enable them to be loaded by wider variety of processes, # executables are more likely to need every capability they have been assigned or they won't function correctly. print ("Patching: Executable with capabilities incompatible with self-signing detected: \"$binaryBaseName\". (Incompatible capabilities: \"$capsToDropStr\".) Reducing capabilities is only supported for libraries.\n"); + print ("Patching: Please use a proper developer certificate for signing this package.\n"); exit(1); } else { print ("Patching: The following capabilities used in \"$binaryBaseName\" are not compatible with a self-signed package and will be removed: \"$capsToDropStr\".\n"); -- cgit v0.12 From 1f7ddb0525f7de24e195b2dd1a9f0374d19b2a05 Mon Sep 17 00:00:00 2001 From: Titta Heikkala Date: Mon, 15 Nov 2010 12:19:59 +0200 Subject: Native file dialog on Symbian^3 The static functions in QFileDialog use native file dialog and not QFileDialog on Symbian^3. Task-number: QT-3917 Reviewed-by: Sami Merila Merge-request: 918 Reviewed-by: Sami Merila --- src/gui/dialogs/dialogs.pri | 13 ++ src/gui/dialogs/qfiledialog.cpp | 72 ++++++++++-- src/gui/dialogs/qfiledialog_symbian.cpp | 202 ++++++++++++++++++++++++++++++++ 3 files changed, 278 insertions(+), 9 deletions(-) create mode 100644 src/gui/dialogs/qfiledialog_symbian.cpp diff --git a/src/gui/dialogs/dialogs.pri b/src/gui/dialogs/dialogs.pri index 4e1b9a7..483e9aa 100644 --- a/src/gui/dialogs/dialogs.pri +++ b/src/gui/dialogs/dialogs.pri @@ -108,6 +108,19 @@ SOURCES += \ dialogs/qwizard.cpp \ dialogs/qprintpreviewdialog.cpp +contains(QT_CONFIG, s60) { + LIBS += -lcommondialogs \ + -lavkon \ + -lplatformenv \ + -lefsrv \ + -lgdi + SOURCES += dialogs/qfiledialog_symbian.cpp \ + dialogs/qcolordialog_symbian.cpp +} + FORMS += dialogs/qpagesetupwidget.ui RESOURCES += dialogs/qprintdialog.qrc RESOURCES += dialogs/qmessagebox.qrc + +# Compensate for lack of platform defines in Symbian3 +symbian: DEFINES += SYMBIAN_VERSION_$$upper($$replace(SYMBIAN_VERSION,\\.,_)) diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index fc3c186..a5bff02 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -1616,6 +1616,25 @@ extern QStringList qt_win_get_open_file_names(const QFileDialogArgs &args, extern QString qt_win_get_existing_directory(const QFileDialogArgs &args); #endif +/* + For Symbian file dialogs +*/ +#if defined(Q_WS_S60) && defined(SYMBIAN_VERSION_SYMBIAN3) +extern QString qtSymbianGetOpenFileName(const QString &caption, + const QString &dir, + const QString &filter); + +extern QStringList qtSymbianGetOpenFileNames(const QString &caption, + const QString &dir, + const QString &filter); + +extern QString qtSymbianGetSaveFileName(const QString &caption, + const QString &dir); + +extern QString qtSymbianGetExistingDirectory(const QString &caption, + const QString &dir); +#endif + /*! This is a convenience static function that returns an existing file selected by the user. If the user presses Cancel, it returns a null string. @@ -1644,8 +1663,8 @@ extern QString qt_win_get_existing_directory(const QFileDialogArgs &args); The dialog's caption is set to \a caption. If \a caption is not specified then a default caption will be used. - On Windows and Mac OS X, this static function will use the native file - dialog and not a QFileDialog. + On Windows, Mac OS X and Symbian^3, this static function will use the + native file dialog and not a QFileDialog. On Windows the dialog will spin a blocking modal event loop that will not dispatch any QTimers, and if \a parent is not 0 then it will position the @@ -1657,6 +1676,10 @@ extern QString qt_win_get_existing_directory(const QFileDialogArgs &args); \a options includes DontResolveSymlinks, the file dialog will treat symlinks as regular directories. + On Symbian^3 the parameter \a selectedFilter has no meaning and the + \a options parameter is only used to define if the native file dialog is + used. + \warning Do not delete \a parent during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the QFileDialog constructors. @@ -1672,6 +1695,11 @@ QString QFileDialog::getOpenFileName(QWidget *parent, { if (qt_filedialog_open_filename_hook && !(options & DontUseNativeDialog)) return qt_filedialog_open_filename_hook(parent, caption, dir, filter, selectedFilter, options); +#if defined(Q_WS_S60) + if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0 && !(options & DontUseNativeDialog)) { + return qtSymbianGetOpenFileName(caption, dir, filter); + } +#endif QFileDialogArgs args; args.parent = parent; args.caption = caption; @@ -1722,8 +1750,8 @@ QString QFileDialog::getOpenFileName(QWidget *parent, The dialog's caption is set to \a caption. If \a caption is not specified then a default caption will be used. - On Windows and Mac OS X, this static function will use the native file - dialog and not a QFileDialog. + On Windows, Mac OS X and Symbian^3, this static function will use the + native file dialog and not a QFileDialog. On Windows the dialog will spin a blocking modal event loop that will not dispatch any QTimers, and if \a parent is not 0 then it will position the @@ -1741,6 +1769,10 @@ QString QFileDialog::getOpenFileName(QWidget *parent, \snippet doc/src/snippets/code/src_gui_dialogs_qfiledialog.cpp 10 + On Symbian^3 the parameter \a selectedFilter has no meaning and the + \a options parameter is only used to define if the native file dialog is + used. + \warning Do not delete \a parent during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the QFileDialog constructors. @@ -1756,6 +1788,11 @@ QStringList QFileDialog::getOpenFileNames(QWidget *parent, { if (qt_filedialog_open_filenames_hook && !(options & DontUseNativeDialog)) return qt_filedialog_open_filenames_hook(parent, caption, dir, filter, selectedFilter, options); +#if defined(Q_WS_S60) + if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0 && !(options & DontUseNativeDialog)) { + return qtSymbianGetOpenFileNames(caption, dir, filter); + } +#endif QFileDialogArgs args; args.parent = parent; args.caption = caption; @@ -1813,8 +1850,8 @@ QStringList QFileDialog::getOpenFileNames(QWidget *parent, The dialog's caption is set to \a caption. If \a caption is not specified, a default caption will be used. - On Windows and Mac OS X, this static function will use the native file - dialog and not a QFileDialog. + On Windows, Mac OS X and Symbian^3, this static function will use the + native file dialog and not a QFileDialog. On Windows the dialog will spin a blocking modal event loop that will not dispatch any QTimers, and if \a parent is not 0 then it will position the @@ -1827,6 +1864,10 @@ QStringList QFileDialog::getOpenFileNames(QWidget *parent, \a options includes DontResolveSymlinks the file dialog will treat symlinks as regular directories. + On Symbian^3 the parameters \a filter and \a selectedFilter have no + meaning. The \a options parameter is only used to define if the native file + dialog is used. + \warning Do not delete \a parent during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the QFileDialog constructors. @@ -1842,6 +1883,11 @@ QString QFileDialog::getSaveFileName(QWidget *parent, { if (qt_filedialog_save_filename_hook && !(options & DontUseNativeDialog)) return qt_filedialog_save_filename_hook(parent, caption, dir, filter, selectedFilter, options); +#if defined(Q_WS_S60) + if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0 && !(options & DontUseNativeDialog)) { + return qtSymbianGetSaveFileName(caption, dir); + } +#endif QFileDialogArgs args; args.parent = parent; args.caption = caption; @@ -1890,9 +1936,9 @@ QString QFileDialog::getSaveFileName(QWidget *parent, pass. To ensure a native file dialog, \l{QFileDialog::}{ShowDirsOnly} must be set. - On Windows and Mac OS X, this static function will use the native file - dialog and not a QFileDialog. On Windows CE, if the device has no native - file dialog, a QFileDialog will be used. + On Windows, Mac OS X and Symbian^3, this static function will use the + native file dialog and not a QFileDialog. On Windows CE, if the device has + no native file dialog, a QFileDialog will be used. On Unix/X11, the normal behavior of the file dialog is to resolve and follow symlinks. For example, if \c{/usr/tmp} is a symlink to \c{/var/tmp}, @@ -1904,6 +1950,9 @@ QString QFileDialog::getSaveFileName(QWidget *parent, dispatch any QTimers, and if \a parent is not 0 then it will position the dialog just below the parent's title bar. + On Symbian^3 the \a options parameter is only used to define if the native + file dialog is used. + \warning Do not delete \a parent during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the QFileDialog constructors. @@ -1917,6 +1966,11 @@ QString QFileDialog::getExistingDirectory(QWidget *parent, { if (qt_filedialog_existing_directory_hook && !(options & DontUseNativeDialog)) return qt_filedialog_existing_directory_hook(parent, caption, dir, options); +#if defined(Q_WS_S60) + if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0 && !(options & DontUseNativeDialog)) { + return qtSymbianGetExistingDirectory(caption, dir); + } +#endif QFileDialogArgs args; args.parent = parent; args.caption = caption; diff --git a/src/gui/dialogs/qfiledialog_symbian.cpp b/src/gui/dialogs/qfiledialog_symbian.cpp new file mode 100644 index 0000000..bd937a1 --- /dev/null +++ b/src/gui/dialogs/qfiledialog_symbian.cpp @@ -0,0 +1,202 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qfiledialog.h" + +#ifndef QT_NO_FILEDIALOG + +#include +#if defined(Q_WS_S60) && defined(SYMBIAN_VERSION_SYMBIAN3) +#include +#include +#include +#include +#endif +#include "private/qcore_symbian_p.h" + +QT_BEGIN_NAMESPACE + +enum DialogMode { DialogOpen, DialogSave, DialogFolder }; +#if defined(Q_WS_S60) && defined(SYMBIAN_VERSION_SYMBIAN3) +class CExtensionFilter : public MAknFileFilter +{ +public: + void setFilter(const QString filter) + { + filterList.clear(); + if (filter.left(2) == "*.") { + //Filter has only extensions + filterList << filter.split(" "); + return; + } + else { + //Extensions are in parenthesis and there may be several filters + QStringList separatedFilters(filter.split(";;")); + for (int i = 0; i < separatedFilters.size(); i++) { + if (separatedFilters.at(i) == QFileDialog::tr("All Files (*)")){ + filterList << QFileDialog::tr("All Files (*)"); + return; + } + } + QRegExp rx("\\(([^\\)]*)\\)"); + int pos = 0; + while ((pos = rx.indexIn(filter, pos)) != -1) { + filterList << rx.cap(1).split(" "); + pos += rx.matchedLength(); + } + } + } + + TBool Accept(const TDesC &/*aDriveAndPath*/, const TEntry &aEntry) const + { + if (aEntry.IsDir()) { + return ETrue; + } + if (filterList.isEmpty()) { + //No filter for files, all can be accepted + return ETrue; + } + if (filterList == QStringList(QFileDialog::tr("All Files (*)"))) { + return ETrue; + } + for (int i = 0; i < filterList.size(); ++i) { + QString extension = filterList.at(i); + //remove '*' from the beginning of the extension + if (extension.left(1) == "*"){ + extension = extension.right(extension.size() - 1); + } + QString fileName = qt_TDesC2QString(aEntry.iName); + if (fileName.right(extension.size()) == extension) { + return ETrue; + } + } + return EFalse; + } + +private: + QStringList filterList; +}; +#endif + +static QString launchSymbianDialog(const QString dialogCaption, const QString startDirectory, + const QString filter, DialogMode dialogMode) +{ + QString selection; +#if defined(Q_WS_S60) && defined(SYMBIAN_VERSION_SYMBIAN3) + QT_TRAP_THROWING( + TFileName startFolder; + if (!startDirectory.isEmpty()) { + QString dir = QDir::toNativeSeparators(startDirectory); + startFolder = qt_QString2TPtrC(dir); + } + TInt types = AknCommonDialogsDynMem::EMemoryTypeMMCExternal| + AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage| + AknCommonDialogsDynMem::EMemoryTypePhone; + + TPtrC titlePtr(qt_QString2TPtrC(dialogCaption)); + TFileName target; + bool select = false; + if (dialogMode == DialogOpen) { + CExtensionFilter* extensionFilter = new (ELeave) CExtensionFilter; + CleanupStack::PushL(extensionFilter); + extensionFilter->setFilter(filter); + select = AknCommonDialogsDynMem::RunSelectDlgLD(types, target, + startFolder, NULL, NULL, titlePtr, extensionFilter); + CleanupStack::Pop(extensionFilter); + } + else if (dialogMode == DialogSave){ + select = AknCommonDialogsDynMem::RunSaveDlgLD(types, target, + startFolder, NULL, NULL, titlePtr); + } + else if (dialogMode == DialogFolder){ + select = AknCommonDialogsDynMem::RunFolderSelectDlgLD(types, target, startFolder, + 0, 0, titlePtr, NULL, NULL); + } + if (select) { + selection.append(qt_TDesC2QString(target)); + } + ); +#endif + return selection; +} + +QString qtSymbianGetOpenFileName(const QString &caption, + const QString &dir, + const QString &filter) +{ + return launchSymbianDialog(caption, dir, filter, DialogOpen); +} + +QStringList qtSymbianGetOpenFileNames(const QString &caption, + const QString &dir, + const QString &filter) +{ + QString fileName; + fileName.append(launchSymbianDialog(caption, dir, filter, DialogOpen)); + QStringList fileList; + fileList << fileName; + + return fileList; +} + +QString qtSymbianGetSaveFileName(const QString &caption, + const QString &dir) +{ + return launchSymbianDialog(caption, dir, QString(), DialogSave); +} + +QString qtSymbianGetExistingDirectory(const QString &caption, + const QString &dir) +{ + QString folderCaption; + if (!caption.isEmpty()) { + folderCaption.append(caption); + } + else { + // Title for folder selection dialog is mandatory + folderCaption.append(QFileDialog::tr("Find Directory")); + } + return launchSymbianDialog(folderCaption, dir, QString(), DialogFolder); +} + +QT_END_NAMESPACE + +#endif -- cgit v0.12 From 4715182e9c600811c045fe5ed7989d4d52d1f4e9 Mon Sep 17 00:00:00 2001 From: Titta Heikkala Date: Mon, 15 Nov 2010 12:27:01 +0200 Subject: Documented usage of dialogs on Symbian Added quidance to documentation about using print dialogs on Symbian. Task-number: QT-4247 Reviewed-by: Sami Merila Merge-request: 920 Reviewed-by: Sami Merila --- src/gui/dialogs/qabstractprintdialog.cpp | 3 +++ src/gui/dialogs/qpagesetupdialog.cpp | 3 +++ src/gui/dialogs/qprintpreviewdialog.cpp | 2 ++ 3 files changed, 8 insertions(+) diff --git a/src/gui/dialogs/qabstractprintdialog.cpp b/src/gui/dialogs/qabstractprintdialog.cpp index 25d9ebb..641419f 100644 --- a/src/gui/dialogs/qabstractprintdialog.cpp +++ b/src/gui/dialogs/qabstractprintdialog.cpp @@ -65,6 +65,9 @@ class QPrintDialogPrivate : public QAbstractPrintDialogPrivate customize settings shown in print dialogs, but it is not used directly. Use QPrintDialog to display a print dialog in your application. + In Symbian, there is no support for printing. Hence, this dialog should not + be used in Symbian. + \sa QPrintDialog, QPrinter, {Printing with Qt} */ diff --git a/src/gui/dialogs/qpagesetupdialog.cpp b/src/gui/dialogs/qpagesetupdialog.cpp index 5d77de1..b5be942 100644 --- a/src/gui/dialogs/qpagesetupdialog.cpp +++ b/src/gui/dialogs/qpagesetupdialog.cpp @@ -62,6 +62,9 @@ QT_BEGIN_NAMESPACE page margins set on a QPrinter won't show in the native Mac OS X page setup dialog. + In Symbian, there is no support for printing. Hence, this dialog should not + be used in Symbian. + \sa QPrinter, QPrintDialog */ diff --git a/src/gui/dialogs/qprintpreviewdialog.cpp b/src/gui/dialogs/qprintpreviewdialog.cpp index f21343e..d74742a 100644 --- a/src/gui/dialogs/qprintpreviewdialog.cpp +++ b/src/gui/dialogs/qprintpreviewdialog.cpp @@ -676,6 +676,8 @@ void QPrintPreviewDialogPrivate::_q_zoomFactorChanged() Call QPrintPreviewDialog::exec() to show the preview dialog. \endlist + In Symbian, there is no support for printing. Hence, this dialog should not + be used in Symbian. \sa QPrinter, QPrintDialog, QPageSetupDialog, QPrintPreviewWidget */ -- cgit v0.12 From 012c865ab30ed45fc57ee5b49b625697cc065e82 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Fri, 12 Nov 2010 11:16:29 +0200 Subject: Removed unnecessary Q_OS_SYMBIAN flags from qdesktopservices_s60.cpp. This flags used to be Q_WS_S60 flags but as part of fabf804b they were changed to Q_OS_SYMBIAN. However since the whole while is only included to build when Q_OS_SYMBIAN is defined, the flags can be removed. Reviewed-by: mread --- src/gui/util/qdesktopservices_s60.cpp | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/src/gui/util/qdesktopservices_s60.cpp b/src/gui/util/qdesktopservices_s60.cpp index cd023cb..d1eeeae 100644 --- a/src/gui/util/qdesktopservices_s60.cpp +++ b/src/gui/util/qdesktopservices_s60.cpp @@ -62,15 +62,10 @@ // copied from miutset.h, so we don't get a dependency into the app layer const TUid KUidMsgTypeSMTP = {0x10001028}; // 268439592 -#ifdef Q_OS_SYMBIAN -# include // PathInfo -# ifdef USE_DOCUMENTHANDLER -# include // CDocumentHandler -# include -# endif -#else -# warning CDocumentHandler requires support for S60 -# undef USE_DOCUMENTHANDLER // Fallback to RApaLsSession based implementation +#include // PathInfo +#ifdef USE_DOCUMENTHANDLER +# include // CDocumentHandler +# include #endif QT_BEGIN_NAMESPACE @@ -268,7 +263,6 @@ static TDriveUnit writableExeDrive() static TPtrC writableDataRoot() { TDriveUnit drive = exeDrive(); -#ifdef Q_OS_SYMBIAN switch(drive.operator TInt()){ case EDriveC: return PathInfo::PhoneMemoryRootPath(); @@ -285,10 +279,6 @@ static TPtrC writableDataRoot() return PathInfo::PhoneMemoryRootPath(); break; } -#else -#warning No fallback implementation of writableDataRoot() - return 0; -#endif } static void openDocumentL(const TDesC& aUrl) @@ -395,21 +385,15 @@ QString QDesktopServices::storageLocation(StandardLocation type) break; case MusicLocation: path.Append(writableDataRoot()); -#ifdef Q_OS_SYMBIAN path.Append(PathInfo::SoundsPath()); -#endif break; case MoviesLocation: path.Append(writableDataRoot()); -#ifdef Q_OS_SYMBIAN path.Append(PathInfo::VideosPath()); -#endif break; case PicturesLocation: path.Append(writableDataRoot()); -#ifdef Q_OS_SYMBIAN path.Append(PathInfo::ImagesPath()); -#endif break; case TempLocation: return QDir::tempPath(); -- cgit v0.12 From d92cbfc5d04d750dea1e49a377e62be564cac788 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Mon, 15 Nov 2010 13:22:27 +0200 Subject: Switched qdesktopservices to use SchemeHandler for Symbian^3 and later. SchemeHandler is plugin extensible component to handle several different URI schemes. By default schemes such as http, https, rtsp, mailto, file, wtai, tel and cti are supported. In some devices/platforms also other schemes might be supported. This commit only defines the USE_SCHEMEHANDLER macro and re-orders the qdesktopservices_s60 source code to make it more readable and to make it compile both with and without the flag. The actual implementation was provided at the same time when qdesktopservices for symbian was initially implemented. Why support is enabled only for Symbian^3 and later? SchemeHandler component does not exist in S60 3.1 - 5.0 public SDKs, actually it does not exist also in Forum Nokia provided Symbian^3 SDK, but is available in Symbian^3 PDK. Since building Qt for Symbian^3 anyway require PDK and because the release builds for Symbian^3 are done separately from older Symbian versions, PDK dependency should be Ok. It might be that SchemeHandler headers will be relicensed as part of Qt, then SchemeHandler support also for older S60/Symbian releases can be enabled. If this happens it will be separate commit. Task-number: QTBUG-15282 Reviewed-by: Miikka Heikkinen --- src/gui/util/qdesktopservices_s60.cpp | 162 ++++++++++++++++++---------------- src/gui/util/util.pri | 19 ++-- 2 files changed, 97 insertions(+), 84 deletions(-) diff --git a/src/gui/util/qdesktopservices_s60.cpp b/src/gui/util/qdesktopservices_s60.cpp index d1eeeae..47b0cbe 100644 --- a/src/gui/util/qdesktopservices_s60.cpp +++ b/src/gui/util/qdesktopservices_s60.cpp @@ -45,27 +45,29 @@ #include #include -#include // CRichText #include // TDriveUnit etc -#include // CEikonEnv -#include // RApaLsSession -#include // TApaTaskList, TApaTask -#include // RSendAs -#include // RSendAsMessage +#include // PathInfo +#ifndef USE_SCHEMEHANDLER #ifdef Q_WS_S60 // This flag changes the implementation to use S60 CDcoumentHandler -// instead of apparch when opening the files +// instead of apparc when opening the files #define USE_DOCUMENTHANDLER #endif -// copied from miutset.h, so we don't get a dependency into the app layer -const TUid KUidMsgTypeSMTP = {0x10001028}; // 268439592 +#include // CRichText +#include // CEikonEnv +#include // RApaLsSession +#include // TApaTaskList, TApaTask +#include // RSendAs +#include // RSendAsMessage -#include // PathInfo #ifdef USE_DOCUMENTHANDLER -# include // CDocumentHandler -# include +#include // CDocumentHandler +#include +#endif +#else // USE_SCHEMEHANDLER +#include #endif QT_BEGIN_NAMESPACE @@ -74,6 +76,10 @@ _LIT(KCacheSubDir, "Cache\\"); _LIT(KSysBin, "\\Sys\\Bin\\"); _LIT(KBrowserPrefix, "4 " ); _LIT(KFontsDir, "z:\\resource\\Fonts\\"); + +#ifndef USE_SCHEMEHANDLER +// copied from miutset.h, so we don't get a dependency into the app layer +const TUid KUidMsgTypeSMTP = {0x10001028}; // 268439592 const TUid KUidBrowser = { 0x10008D39 }; template @@ -132,7 +138,6 @@ private: Q_GLOBAL_STATIC(QS60DocumentHandler, qt_s60_documenthandler); #endif - static void handleMailtoSchemeLX(const QUrl &url) { // this function has many intermingled leaves and throws. Qt and Symbian objects do not have @@ -150,12 +155,10 @@ static void handleMailtoSchemeLX(const QUrl &url) QStringList ccs = cc.split(QLatin1String(","), QString::SkipEmptyParts); QStringList bccs = bcc.split(QLatin1String(","), QString::SkipEmptyParts); - RSendAs sendAs; User::LeaveIfError(sendAs.Connect()); QAutoClose sendAsCleanup(sendAs); - CSendAsAccounts* accounts = CSendAsAccounts::NewL(); CleanupStack::PushL(accounts); sendAs.AvailableAccountsL(KUidMsgTypeSMTP, *accounts); @@ -244,42 +247,6 @@ static bool handleOtherSchemes(const QUrl &url) return err ? false : true; } -static TDriveUnit exeDrive() -{ - RProcess me; - TFileName processFileName = me.FileName(); - TDriveUnit drive(processFileName); - return drive; -} - -static TDriveUnit writableExeDrive() -{ - TDriveUnit drive = exeDrive(); - if(drive.operator TInt() == EDriveZ) - return TDriveUnit(EDriveC); - return drive; -} - -static TPtrC writableDataRoot() -{ - TDriveUnit drive = exeDrive(); - switch(drive.operator TInt()){ - case EDriveC: - return PathInfo::PhoneMemoryRootPath(); - break; - case EDriveE: - return PathInfo::MemoryCardRootPath(); - break; - case EDriveZ: - // It is not possible to write on ROM drive -> - // return phone mem root path instead - return PathInfo::PhoneMemoryRootPath(); - break; - default: - return PathInfo::PhoneMemoryRootPath(); - break; - } -} static void openDocumentL(const TDesC& aUrl) { @@ -304,13 +271,44 @@ static void openDocumentL(const TDesC& aUrl) #endif } -#ifdef USE_SCHEMEHANDLER +static bool launchWebBrowser(const QUrl &url) +{ + if (!url.isValid()) + return false; + + if (url.scheme() == QLatin1String("mailto")) { + return handleMailtoScheme(url); + } + return handleOtherSchemes( url ); +} + +static bool openDocument(const QUrl &file) +{ + if (!file.isValid()) + return false; + + QString filePath = file.toLocalFile(); + filePath = QDir::toNativeSeparators(filePath); + TPtrC filePathPtr(qt_QString2TPtrC(filePath)); + TRAPD(err, openDocumentL(filePathPtr)); + return err ? false : true; +} + +#else //USE_SCHEMEHANDLER // The schemehandler component only exist in private SDK. This implementation // exist here just for convenience in case that we need to use it later on // The schemehandle based implementation is not yet tested. // The biggest advantage of schemehandler is that it can handle // wide range of schemes and is extensible by plugins +static void handleUrlL(const TDesC& aUrl) +{ + CSchemeHandler* schemeHandler = CSchemeHandler::NewL(aUrl); + CleanupStack::PushL(schemeHandler); + schemeHandler->HandleUrlStandaloneL(); // Process the Url in standalone mode + CleanupStack::PopAndDestroy(); +} + static bool handleUrl(const QUrl &url) { if (!url.isValid()) @@ -322,13 +320,6 @@ static bool handleUrl(const QUrl &url) return err ? false : true; } -static void handleUrlL(const TDesC& aUrl) -{ - CSchemeHandler* schemeHandler = CSchemeHandler::NewL(aUrl); - CleanupStack::PushL(schemeHandler); - schemeHandler->HandleUrlStandaloneL(); // Process the Url in standalone mode - CleanupStack::PopAndDestroy(); -} static bool launchWebBrowser(const QUrl &url) { return handleUrl(url); @@ -336,31 +327,48 @@ static bool launchWebBrowser(const QUrl &url) static bool openDocument(const QUrl &file) { - return handleUrl(url); + return handleUrl(file); } -#endif -static bool launchWebBrowser(const QUrl &url) -{ - if (!url.isValid()) - return false; +#endif //USE_SCHEMEHANDLER - if (url.scheme() == QLatin1String("mailto")) { - return handleMailtoScheme(url); - } - return handleOtherSchemes( url ); +// Common functions to all implementations + +static TDriveUnit exeDrive() +{ + RProcess me; + TFileName processFileName = me.FileName(); + TDriveUnit drive(processFileName); + return drive; } -static bool openDocument(const QUrl &file) +static TDriveUnit writableExeDrive() { - if (!file.isValid()) - return false; + TDriveUnit drive = exeDrive(); + if(drive.operator TInt() == EDriveZ) + return TDriveUnit(EDriveC); + return drive; +} - QString filePath = file.toLocalFile(); - filePath = QDir::toNativeSeparators(filePath); - TPtrC filePathPtr(qt_QString2TPtrC(filePath)); - TRAPD(err, openDocumentL(filePathPtr)); - return err ? false : true; +static TPtrC writableDataRoot() +{ + TDriveUnit drive = exeDrive(); + switch(drive.operator TInt()){ + case EDriveC: + return PathInfo::PhoneMemoryRootPath(); + break; + case EDriveE: + return PathInfo::MemoryCardRootPath(); + break; + case EDriveZ: + // It is not possible to write on ROM drive -> + // return phone mem root path instead + return PathInfo::PhoneMemoryRootPath(); + break; + default: + return PathInfo::PhoneMemoryRootPath(); + break; + } } QString QDesktopServices::storageLocation(StandardLocation type) diff --git a/src/gui/util/util.pri b/src/gui/util/util.pri index bea520e..d1c4ff8 100644 --- a/src/gui/util/util.pri +++ b/src/gui/util/util.pri @@ -43,12 +43,17 @@ embedded { } symbian { - LIBS += -lsendas2 -letext -lapmime -lplatformenv - contains(QT_CONFIG, s60) { - contains(CONFIG, is_using_gnupoc) { - LIBS += -lcommonui - } else { - LIBS += -lCommonUI + LIBS += -letext -lplatformenv + contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { + LIBS += -lsendas2 -lapmime + contains(QT_CONFIG, s60) { + contains(CONFIG, is_using_gnupoc) { + LIBS += -lcommonui + } else { + LIBS += -lCommonUI + } } + } else { + DEFINES += USE_SCHEMEHANDLER } -} +} \ No newline at end of file -- cgit v0.12 From 03c60ccac1ab416ebee7a262f1c910774fdc2ff2 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Mon, 15 Nov 2010 14:28:25 +0200 Subject: Fixed code style of d92cbfc5, reported by git push. 82: TAB character in non-leading whitespace 348: Flow control keywords must be followed by single space 356: Flow control keywords must be followed by single space Rev-By: TrustMe --- src/gui/util/qdesktopservices_s60.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/util/qdesktopservices_s60.cpp b/src/gui/util/qdesktopservices_s60.cpp index 47b0cbe..56c2b98 100644 --- a/src/gui/util/qdesktopservices_s60.cpp +++ b/src/gui/util/qdesktopservices_s60.cpp @@ -79,7 +79,7 @@ _LIT(KFontsDir, "z:\\resource\\Fonts\\"); #ifndef USE_SCHEMEHANDLER // copied from miutset.h, so we don't get a dependency into the app layer -const TUid KUidMsgTypeSMTP = {0x10001028}; // 268439592 +const TUid KUidMsgTypeSMTP = {0x10001028}; // 268439592 const TUid KUidBrowser = { 0x10008D39 }; template @@ -345,7 +345,7 @@ static TDriveUnit exeDrive() static TDriveUnit writableExeDrive() { TDriveUnit drive = exeDrive(); - if(drive.operator TInt() == EDriveZ) + if (drive.operator TInt() == EDriveZ) return TDriveUnit(EDriveC); return drive; } @@ -353,7 +353,7 @@ static TDriveUnit writableExeDrive() static TPtrC writableDataRoot() { TDriveUnit drive = exeDrive(); - switch(drive.operator TInt()){ + switch (drive.operator TInt()){ case EDriveC: return PathInfo::PhoneMemoryRootPath(); break; -- cgit v0.12 From 515fd562d87290c3fc0eb45817434dd0744d346e Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 15 Nov 2010 14:15:25 +0200 Subject: Use include(original mkspec) instead of copying of mkspec to default Having QMAKESPEC_ORIGINAL at the end of the default qmake.conf sets the mkspec too late for scope checks in symbian-mmp.conf and related files. Fixed by changing how default mkspec is handled: it is no longer simply copied over to mkspecs/default by configure but rather included with include statement in the generated mkspecs/default/qmake.conf after setting of QMAKESPEC_ORIGINAL value. This should also fix any issues with relative includes in mkspecs used as default that are not on same level as mkspecs/default folder. Task-number: QTBUG-15159 Reviewed-by: Oswald Buddenhagen Reviewed-by: Joerg Bornemann --- tools/configure/configureapp.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 3808c4e..3c12eb9 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -3227,7 +3227,8 @@ void Configure::generateConfigfiles() } // Copy configured mkspec to default directory, but remove the old one first, if there is any - QString defSpec = buildPath + "/mkspecs/default"; + QString mkspecsPath = buildPath + "/mkspecs"; + QString defSpec = mkspecsPath + "/default"; QFileInfo defSpecInfo(defSpec); if (defSpecInfo.exists()) { if (!Environment::rmdir(defSpec)) { @@ -3237,21 +3238,22 @@ void Configure::generateConfigfiles() } } - QString spec = dictionary.contains("XQMAKESPEC") ? dictionary["XQMAKESPEC"] : dictionary["QMAKESPEC"]; - QString pltSpec = sourcePath + "/mkspecs/" + spec; - if (!Environment::cpdir(pltSpec, defSpec)) { - cout << "Couldn't update default mkspec! Does " << qPrintable(pltSpec) << " exist?" << endl; + QDir mkspecsDir(mkspecsPath); + if (!mkspecsDir.mkdir("default")) { + cout << "Couldn't create default mkspec dir!" << endl; dictionary["DONE"] = "error"; return; } + QString spec = dictionary.contains("XQMAKESPEC") ? dictionary["XQMAKESPEC"] : dictionary["QMAKESPEC"]; + QString pltSpec = sourcePath + "/mkspecs/" + spec; outName = defSpec + "/qmake.conf"; - ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL); QFile qmakeConfFile(outName); - if (qmakeConfFile.open(QFile::Append | QFile::WriteOnly | QFile::Text)) { + if (qmakeConfFile.open(QFile::WriteOnly | QFile::Text)) { QTextStream qmakeConfStream; qmakeConfStream.setDevice(&qmakeConfFile); - qmakeConfStream << endl << "QMAKESPEC_ORIGINAL=" << pltSpec << endl; + qmakeConfStream << "QMAKESPEC_ORIGINAL=" << pltSpec << endl << endl; + qmakeConfStream << "include(" << pltSpec << "/qmake.conf)" << endl; qmakeConfStream.flush(); qmakeConfFile.close(); } -- cgit v0.12 From 14ddf44ce2fdd7195741b9683226a3cd774e17e4 Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Wed, 17 Nov 2010 14:59:15 +0200 Subject: Fix for WServ 64 crash on Symbian. Crash happens if application first sets WA_OpaquePaintEvent flag and then sets WA_TranslucentBackground flag. In that case WA_TranslucentBackground flag is ineffective leading to situation where Qt Symbian adaptation tries to reset native window transparency but because native window is already opaque due to WA_OpaquePaintEvent, WServ 64 crash occurs. Task-number: QTBUG-15369 Reviewed-by: Jason Barron --- src/gui/kernel/qwidget_p.h | 1 + src/gui/kernel/qwidget_s60.cpp | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index ca1e3fc..6a27469 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -226,6 +226,7 @@ struct QTLWExtra { #endif #elif defined(Q_OS_SYMBIAN) uint inExpose : 1; // Prevents drawing recursion + uint nativeWindowTransparencyEnabled : 1; // Tracks native window transparency #endif }; diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index cf4bdf1..6ce46d3 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -767,17 +767,24 @@ void QWidgetPrivate::s60UpdateIsOpaque() if (!q->testAttribute(Qt::WA_WState_Created) || !q->testAttribute(Qt::WA_TranslucentBackground)) return; + createTLExtra(); + RWindow *const window = static_cast(q->effectiveWinId()->DrawableWindow()); #ifdef Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE window->SetSurfaceTransparency(!isOpaque); + extra->topextra->nativeWindowTransparencyEnabled = !isOpaque; #else if (!isOpaque) { const TDisplayMode displayMode = static_cast(window->SetRequiredDisplayMode(EColor16MA)); - if (window->SetTransparencyAlphaChannel() == KErrNone) + if (window->SetTransparencyAlphaChannel() == KErrNone) { window->SetBackgroundColor(TRgb(255, 255, 255, 0)); - } else + extra->topextra->nativeWindowTransparencyEnabled = 1; + } + } else if (extra->topextra->nativeWindowTransparencyEnabled) { window->SetTransparentRegion(TRegionFix<1>()); + extra->topextra->nativeWindowTransparencyEnabled = 0; + } #endif } @@ -936,6 +943,7 @@ void QWidgetPrivate::registerDropSite(bool /* on */) void QWidgetPrivate::createTLSysExtra() { extra->topextra->inExpose = 0; + extra->topextra->nativeWindowTransparencyEnabled = 0; } void QWidgetPrivate::deleteTLSysExtra() -- cgit v0.12 From fd7c4c07c20eaff247be33826ae0af099c178494 Mon Sep 17 00:00:00 2001 From: Titta Heikkala Date: Wed, 17 Nov 2010 10:15:15 +0200 Subject: Correct flags for Symbian file dialogs Corrected the flags for extern functions Task-number: QT-3917 Reviewed-by: Janne Koskinen Merge-request: 918 Reviewed-by: Janne Koskinen --- src/gui/dialogs/qfiledialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index a5bff02..0b789cc 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -1619,7 +1619,7 @@ extern QString qt_win_get_existing_directory(const QFileDialogArgs &args); /* For Symbian file dialogs */ -#if defined(Q_WS_S60) && defined(SYMBIAN_VERSION_SYMBIAN3) +#if defined(Q_WS_S60) extern QString qtSymbianGetOpenFileName(const QString &caption, const QString &dir, const QString &filter); -- cgit v0.12 From 518b284673d66ed4a2961a88646ec012cedc96bd Mon Sep 17 00:00:00 2001 From: Titta Heikkala Date: Thu, 18 Nov 2010 11:34:13 +0200 Subject: Removed extra cpp and done changes based on comments qcolordialog_symbian.cpp is removed from dialogs.pri and string comparison corrected based on comments. Task-number: QT-3917 Reviewed-by: Janne Koskinen Merge-request: 918 Reviewed-by: Janne Koskinen --- src/gui/dialogs/dialogs.pri | 3 +-- src/gui/dialogs/qfiledialog.cpp | 9 +++------ src/gui/dialogs/qfiledialog_symbian.cpp | 22 ++++++++++------------ 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/src/gui/dialogs/dialogs.pri b/src/gui/dialogs/dialogs.pri index 483e9aa..c7cb794 100644 --- a/src/gui/dialogs/dialogs.pri +++ b/src/gui/dialogs/dialogs.pri @@ -114,8 +114,7 @@ contains(QT_CONFIG, s60) { -lplatformenv \ -lefsrv \ -lgdi - SOURCES += dialogs/qfiledialog_symbian.cpp \ - dialogs/qcolordialog_symbian.cpp + SOURCES += dialogs/qfiledialog_symbian.cpp } FORMS += dialogs/qpagesetupwidget.ui diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index 0b789cc..1db9789 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -1696,9 +1696,8 @@ QString QFileDialog::getOpenFileName(QWidget *parent, if (qt_filedialog_open_filename_hook && !(options & DontUseNativeDialog)) return qt_filedialog_open_filename_hook(parent, caption, dir, filter, selectedFilter, options); #if defined(Q_WS_S60) - if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0 && !(options & DontUseNativeDialog)) { + if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0 && !(options & DontUseNativeDialog)) return qtSymbianGetOpenFileName(caption, dir, filter); - } #endif QFileDialogArgs args; args.parent = parent; @@ -1789,9 +1788,8 @@ QStringList QFileDialog::getOpenFileNames(QWidget *parent, if (qt_filedialog_open_filenames_hook && !(options & DontUseNativeDialog)) return qt_filedialog_open_filenames_hook(parent, caption, dir, filter, selectedFilter, options); #if defined(Q_WS_S60) - if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0 && !(options & DontUseNativeDialog)) { + if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0 && !(options & DontUseNativeDialog)) return qtSymbianGetOpenFileNames(caption, dir, filter); - } #endif QFileDialogArgs args; args.parent = parent; @@ -1884,9 +1882,8 @@ QString QFileDialog::getSaveFileName(QWidget *parent, if (qt_filedialog_save_filename_hook && !(options & DontUseNativeDialog)) return qt_filedialog_save_filename_hook(parent, caption, dir, filter, selectedFilter, options); #if defined(Q_WS_S60) - if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0 && !(options & DontUseNativeDialog)) { + if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0 && !(options & DontUseNativeDialog)) return qtSymbianGetSaveFileName(caption, dir); - } #endif QFileDialogArgs args; args.parent = parent; diff --git a/src/gui/dialogs/qfiledialog_symbian.cpp b/src/gui/dialogs/qfiledialog_symbian.cpp index bd937a1..0277e1c 100644 --- a/src/gui/dialogs/qfiledialog_symbian.cpp +++ b/src/gui/dialogs/qfiledialog_symbian.cpp @@ -62,24 +62,23 @@ public: void setFilter(const QString filter) { filterList.clear(); - if (filter.left(2) == "*.") { + if (filter.left(2) == QLatin1String("*.")) { //Filter has only extensions filterList << filter.split(" "); return; - } - else { + } else { //Extensions are in parenthesis and there may be several filters - QStringList separatedFilters(filter.split(";;")); + QStringList separatedFilters(filter.split(QLatin1String(";;"))); for (int i = 0; i < separatedFilters.size(); i++) { - if (separatedFilters.at(i) == QFileDialog::tr("All Files (*)")){ - filterList << QFileDialog::tr("All Files (*)"); + if (separatedFilters.at(i).contains(QLatin1String("(*)"))) { + filterList << QLatin1String("(*)"); return; } } QRegExp rx("\\(([^\\)]*)\\)"); int pos = 0; while ((pos = rx.indexIn(filter, pos)) != -1) { - filterList << rx.cap(1).split(" "); + filterList << rx.cap(1).split(QLatin1String(" ")); pos += rx.matchedLength(); } } @@ -94,7 +93,7 @@ public: //No filter for files, all can be accepted return ETrue; } - if (filterList == QStringList(QFileDialog::tr("All Files (*)"))) { + if (filterList == QStringList(QLatin1String("(*)"))) { return ETrue; } for (int i = 0; i < filterList.size(); ++i) { @@ -142,11 +141,11 @@ static QString launchSymbianDialog(const QString dialogCaption, const QString st startFolder, NULL, NULL, titlePtr, extensionFilter); CleanupStack::Pop(extensionFilter); } - else if (dialogMode == DialogSave){ + else if (dialogMode == DialogSave) { select = AknCommonDialogsDynMem::RunSaveDlgLD(types, target, startFolder, NULL, NULL, titlePtr); } - else if (dialogMode == DialogFolder){ + else if (dialogMode == DialogFolder) { select = AknCommonDialogsDynMem::RunFolderSelectDlgLD(types, target, startFolder, 0, 0, titlePtr, NULL, NULL); } @@ -189,8 +188,7 @@ QString qtSymbianGetExistingDirectory(const QString &caption, QString folderCaption; if (!caption.isEmpty()) { folderCaption.append(caption); - } - else { + } else { // Title for folder selection dialog is mandatory folderCaption.append(QFileDialog::tr("Find Directory")); } -- cgit v0.12 From 4e73e8b530f77bf1f43042fb07038eb51cb0238f Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Thu, 18 Nov 2010 12:01:04 +0200 Subject: Fix for QtOpenGL RVCT4 compilation error RVCT4 has strict lookup rules. Calls from function ,that depends on a template parameter, to internal static functions must be qualified. Task-number: QTBUG-15424 Reviewed-by: Jason Barron --- src/opengl/gl2paintengineex/qtriangulator.cpp | 34 +++++++++++++-------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/opengl/gl2paintengineex/qtriangulator.cpp b/src/opengl/gl2paintengineex/qtriangulator.cpp index 85f604a..4c3deb6 100644 --- a/src/opengl/gl2paintengineex/qtriangulator.cpp +++ b/src/opengl/gl2paintengineex/qtriangulator.cpp @@ -339,7 +339,7 @@ static inline qint64 qPointDistanceFromLine(const QPodPoint &p, const QPodPoint static inline bool qPointIsLeftOfLine(const QPodPoint &p, const QPodPoint &v1, const QPodPoint &v2) { - return qPointDistanceFromLine(p, v1, v2) < 0; + return ::qPointDistanceFromLine(p, v1, v2) < 0; } // Return: @@ -1741,7 +1741,7 @@ bool QTriangulator::ComplexToSimple::calculateIntersection(int left, int righ Intersection intersection; intersection.leftEdge = left; intersection.rightEdge = right; - intersection.intersectionPoint = qIntersectionPoint(u1, u2, v1, v2); + intersection.intersectionPoint = ::qIntersectionPoint(u1, u2, v1, v2); if (!intersection.intersectionPoint.isValid()) return false; @@ -1767,10 +1767,10 @@ bool QTriangulator::ComplexToSimple::edgeIsLeftOfEdge(int leftEdgeIndex, int return true; if (upper.x > qMax(l.x, u.x)) return false; - qint64 d = qPointDistanceFromLine(upper, l, u); + qint64 d = ::qPointDistanceFromLine(upper, l, u); // d < 0: left, d > 0: right, d == 0: on top if (d == 0) - d = qPointDistanceFromLine(m_parent->m_vertices.at(leftEdge.lower()), l, u); + d = ::qPointDistanceFromLine(m_parent->m_vertices.at(leftEdge.lower()), l, u); return d < 0; } @@ -1814,7 +1814,7 @@ QPair::Node *, QRBTree::Node *> QTriangulator::ComplexToSim while (current) { const QPodPoint &v1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); const QPodPoint &v2 = m_parent->m_vertices.at(m_edges.at(current->data).upper()); - qint64 d = qPointDistanceFromLine(point, v1, v2); + qint64 d = ::qPointDistanceFromLine(point, v1, v2); if (d == 0) { result.first = result.second = current; break; @@ -1828,7 +1828,7 @@ QPair::Node *, QRBTree::Node *> QTriangulator::ComplexToSim while (current) { const QPodPoint &v1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); const QPodPoint &v2 = m_parent->m_vertices.at(m_edges.at(current->data).upper()); - qint64 d = qPointDistanceFromLine(point, v1, v2); + qint64 d = ::qPointDistanceFromLine(point, v1, v2); Q_ASSERT(d >= 0); if (d == 0) { result.first = current; @@ -1842,7 +1842,7 @@ QPair::Node *, QRBTree::Node *> QTriangulator::ComplexToSim while (current) { const QPodPoint &v1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); const QPodPoint &v2 = m_parent->m_vertices.at(m_edges.at(current->data).upper()); - qint64 d = qPointDistanceFromLine(point, v1, v2); + qint64 d = ::qPointDistanceFromLine(point, v1, v2); Q_ASSERT(d <= 0); if (d == 0) { result.second = current; @@ -1864,7 +1864,7 @@ QPair::Node *, QRBTree::Node *> QTriangulator::ComplexToSim while (current) { const QPodPoint &v1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); const QPodPoint &v2 = m_parent->m_vertices.at(m_edges.at(current->data).upper()); - qint64 d = qPointDistanceFromLine(point, v1, v2); + qint64 d = ::qPointDistanceFromLine(point, v1, v2); if (d == 0) break; if (d < 0) { @@ -1885,7 +1885,7 @@ QPair::Node *, QRBTree::Node *> QTriangulator::ComplexToSim while (current) { const QPodPoint &v1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); const QPodPoint &v2 = m_parent->m_vertices.at(m_edges.at(current->data).upper()); - qint64 d = qPointDistanceFromLine(point, v1, v2); + qint64 d = ::qPointDistanceFromLine(point, v1, v2); Q_ASSERT(d >= 0); if (d == 0) { current = current->left; @@ -1899,7 +1899,7 @@ QPair::Node *, QRBTree::Node *> QTriangulator::ComplexToSim while (current) { const QPodPoint &v1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); const QPodPoint &v2 = m_parent->m_vertices.at(m_edges.at(current->data).upper()); - qint64 d = qPointDistanceFromLine(point, v1, v2); + qint64 d = ::qPointDistanceFromLine(point, v1, v2); Q_ASSERT(d <= 0); if (d == 0) { current = current->right; @@ -1962,7 +1962,7 @@ void QTriangulator::ComplexToSimple::reorderEdgeListRange(QRBTree::Node template void QTriangulator::ComplexToSimple::sortEdgeList(const QPodPoint eventPoint) { - QIntersectionPoint eventPoint2 = qIntersectionPoint(eventPoint); + QIntersectionPoint eventPoint2 = ::qIntersectionPoint(eventPoint); while (!m_topIntersection.isEmpty() && m_topIntersection.top().intersectionPoint < eventPoint2) { Intersection intersection = m_topIntersection.pop(); @@ -2056,7 +2056,7 @@ void QTriangulator::ComplexToSimple::calculateIntersections() QPair::Node *, QRBTree::Node *> range = bounds(event.point); QRBTree::Node *leftNode = range.first ? m_edgeList.previous(range.first) : 0; int vertex = (event.type == Event::Upper ? m_edges.at(event.edge).upper() : m_edges.at(event.edge).lower()); - QIntersectionPoint eventPoint = qIntersectionPoint(event.point); + QIntersectionPoint eventPoint = ::qIntersectionPoint(event.point); if (range.first != 0) { splitEdgeListRange(range.first, range.second, vertex, eventPoint); @@ -2213,7 +2213,7 @@ void QTriangulator::ComplexToSimple::removeUnwantedEdgesAndConnect() while (current != b.second) { Q_ASSERT(current); Q_ASSERT(m_edges.at(current->data).node == current); - Q_ASSERT(qIntersectionPoint(event.point).isOnLine(m_parent->m_vertices.at(m_edges.at(current->data).from), m_parent->m_vertices.at(m_edges.at(current->data).to))); + Q_ASSERT(::qIntersectionPoint(event.point).isOnLine(m_parent->m_vertices.at(m_edges.at(current->data).from), m_parent->m_vertices.at(m_edges.at(current->data).to))); Q_ASSERT(m_parent->m_vertices.at(m_edges.at(current->data).from) == event.point || m_parent->m_vertices.at(m_edges.at(current->data).to) == event.point); insertEdgeIntoVectorIfWanted(orderedEdges, current->data); current = m_edgeList.next(current); @@ -2612,10 +2612,10 @@ bool QTriangulator::SimpleToMonotone::edgeIsLeftOfEdge(int leftEdgeIndex, int const Edge &rightEdge = m_edges.at(rightEdgeIndex); const QPodPoint &u = m_parent->m_vertices.at(rightEdge.upper()); const QPodPoint &l = m_parent->m_vertices.at(rightEdge.lower()); - qint64 d = qPointDistanceFromLine(m_parent->m_vertices.at(leftEdge.upper()), l, u); + qint64 d = ::qPointDistanceFromLine(m_parent->m_vertices.at(leftEdge.upper()), l, u); // d < 0: left, d > 0: right, d == 0: on top if (d == 0) - d = qPointDistanceFromLine(m_parent->m_vertices.at(leftEdge.lower()), l, u); + d = ::qPointDistanceFromLine(m_parent->m_vertices.at(leftEdge.lower()), l, u); return d < 0; } @@ -2645,7 +2645,7 @@ QRBTree::Node *QTriangulator::SimpleToMonotone::searchEdgeLeftOfPoint(in while (current) { const QPodPoint &p1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); const QPodPoint &p2 = m_parent->m_vertices.at(m_edges.at(current->data).upper()); - qint64 d = qPointDistanceFromLine(m_parent->m_vertices.at(pointIndex), p1, p2); + qint64 d = ::qPointDistanceFromLine(m_parent->m_vertices.at(pointIndex), p1, p2); if (d <= 0) { current = current->left; } else { @@ -2668,7 +2668,7 @@ void QTriangulator::SimpleToMonotone::classifyVertex(int i) const QPodPoint &p1 = m_parent->m_vertices.at(e1.from); const QPodPoint &p2 = m_parent->m_vertices.at(e2.from); const QPodPoint &p3 = m_parent->m_vertices.at(e2.to); - qint64 d = qPointDistanceFromLine(p1, p2, p3); + qint64 d = ::qPointDistanceFromLine(p1, p2, p3); Q_ASSERT(d != 0 || (!startOrSplit && !endOrMerge)); e2.type = RegularVertex; -- cgit v0.12 From dfd5ee41532b55ef6aaa5fb7ed3b586fbac80fce Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 18 Nov 2010 12:39:09 +0200 Subject: Make epocroot resolving compatible with more build environments This commit prepares epocroot.cpp and registry.cpp to be compilable by lrelease and corelib. Task-number: QTBUG-15393 Reviewed-by: axis --- tools/shared/symbian/epocroot.cpp | 100 ++++++++++++++++++-------------------- tools/shared/windows/registry.cpp | 8 +-- 2 files changed, 51 insertions(+), 57 deletions(-) diff --git a/tools/shared/symbian/epocroot.cpp b/tools/shared/symbian/epocroot.cpp index ae1dcb1..9d7d465 100644 --- a/tools/shared/symbian/epocroot.cpp +++ b/tools/shared/symbian/epocroot.cpp @@ -64,23 +64,13 @@ // Stored as a static value in order to avoid unnecessary re-evaluation. static QString epocRootValue; -#ifdef QT_BUILD_QMAKE -std::ostream &operator<<(std::ostream &s, const QString &val) { - s << val.toLocal8Bit().data(); - return s; -} -#else -// Operator implemented in configureapp.cpp -std::ostream &operator<<(std::ostream &s, const QString &val); -#endif - QString getDevicesXmlPath() { // Note that the following call will return a null string on platforms other // than Windows. If support is required on other platforms for devices.xml, // an alternative mechanism for retrieving the location of this file will // be required. - return readRegistryKey(SYMBIAN_SDKS_REG_HANDLE, SYMBIAN_SDKS_REG_SUBKEY); + return readRegistryKey(SYMBIAN_SDKS_REG_HANDLE, QLatin1String(SYMBIAN_SDKS_REG_SUBKEY)); } /** @@ -92,7 +82,8 @@ void checkEpocRootExists(const QString &source) if (!epocRootValue.isEmpty()) { QDir dir(epocRootValue); if (!dir.exists()) { - std::cerr << "Warning: " << source << " is set to an invalid path: " << epocRootValue << std::endl; + qWarning("Warning: %s is set to an invalid path: '%s'", qPrintable(source), + qPrintable(epocRootValue)); epocRootValue = QString(); } } @@ -103,10 +94,10 @@ void checkEpocRootExists(const QString &source) */ static void fixEpocRoot(QString &path) { - path.replace("\\", "/"); + path.replace(QLatin1Char('\\'), QLatin1Char('/')); - if (!path.size() || path[path.size()-1] != QChar('/')) { - path += QChar('/'); + if (!path.size() || path[path.size()-1] != QLatin1Char('/')) { + path += QLatin1Char('/'); } } @@ -118,17 +109,15 @@ QString epocRoot() if (epocRootValue.isEmpty()) { // 1. If environment variable EPOCROOT is set and points to an existent // directory, this is returned. - epocRootValue = qgetenv("EPOCROOT"); - checkEpocRootExists("EPOCROOT"); + epocRootValue = QString::fromLocal8Bit(qgetenv("EPOCROOT").constData()); + checkEpocRootExists(QLatin1String("EPOCROOT environment variable")); if (epocRootValue.isEmpty()) { // 2. The location of devices.xml is specified by a registry key. If this // file exists, it is parsed. QString devicesXmlPath = getDevicesXmlPath(); - if (devicesXmlPath.isEmpty()) { - std::cerr << "Error: Symbian SDK registry key not found" << std::endl; - } else { - devicesXmlPath += "/devices.xml"; + if (!devicesXmlPath.isEmpty()) { + devicesXmlPath += QLatin1String("/devices.xml"); QFile devicesFile(devicesXmlPath); if (devicesFile.open(QIODevice::ReadOnly)) { @@ -138,87 +127,90 @@ QString epocRoot() // 4. If a device element marked as default is found in devices.xml and its // epocroot value points to an existent directory, this is returned. - const QString epocDeviceValue = qgetenv("EPOCDEVICE"); + const QString epocDeviceValue = QString::fromLocal8Bit(qgetenv("EPOCDEVICE").constData()); bool epocDeviceFound = false; QXmlStreamReader xml(&devicesFile); while (!xml.atEnd()) { xml.readNext(); - if (xml.isStartElement() && xml.name() == "devices") { - if (xml.attributes().value("version") == "1.0") { - while (!(xml.isEndElement() && xml.name() == "devices") && !xml.atEnd()) { + if (xml.isStartElement() && xml.name() == QLatin1String("devices")) { + if (xml.attributes().value(QLatin1String("version")) == QLatin1String("1.0")) { + while (!(xml.isEndElement() && xml.name() == QLatin1String("devices")) && !xml.atEnd()) { xml.readNext(); - if (xml.isStartElement() && xml.name() == "device") { - const bool isDefault = xml.attributes().value("default") == "yes"; - const QString id = xml.attributes().value("id").toString(); - const QString name = xml.attributes().value("name").toString(); - const QString alias = xml.attributes().value("alias").toString(); - bool epocDeviceMatch = (id + ":" + name) == epocDeviceValue; + if (xml.isStartElement() && xml.name() == QLatin1String("device")) { + const bool isDefault = xml.attributes().value(QLatin1String("default")) == QLatin1String("yes"); + const QString id = xml.attributes().value(QLatin1String("id")).toString(); + const QString name = xml.attributes().value(QLatin1String("name")).toString(); + const QString alias = xml.attributes().value(QLatin1String("alias")).toString(); + bool epocDeviceMatch = QString(id + QLatin1String(":") + name) == epocDeviceValue; if (!alias.isEmpty()) epocDeviceMatch |= alias == epocDeviceValue; epocDeviceFound |= epocDeviceMatch; if((epocDeviceValue.isEmpty() && isDefault) || epocDeviceMatch) { // Found a matching device - while (!(xml.isEndElement() && xml.name() == "device") && !xml.atEnd()) { + while (!(xml.isEndElement() && xml.name() == QLatin1String("device")) && !xml.atEnd()) { xml.readNext(); - if (xml.isStartElement() && xml.name() == "epocroot") { + if (xml.isStartElement() && xml.name() == QLatin1String("epocroot")) { epocRootValue = xml.readElementText(); const QString deviceSource = epocDeviceValue.isEmpty() - ? "default device" - : "EPOCDEVICE (" + epocDeviceValue + ")"; + ? QLatin1String("default device") + : QString(QLatin1String("EPOCDEVICE (") + epocDeviceValue + QLatin1String(")")); checkEpocRootExists(deviceSource); } } if (epocRootValue.isEmpty()) - xml.raiseError("No epocroot element found"); + xml.raiseError(QLatin1String("No epocroot element found")); } } } } else { - xml.raiseError("Invalid 'devices' element version"); + xml.raiseError(QLatin1String("Invalid 'devices' element version")); } } } if (xml.hasError()) { - std::cerr << "Error: \"" << xml.errorString() << "\" when parsing devices.xml" << std::endl; + qWarning("Warning: Error \"%s\" when parsing devices.xml", + qPrintable(xml.errorString())); } else { if (epocRootValue.isEmpty()) { if (!epocDeviceValue.isEmpty()) { if (epocDeviceFound) { - std::cerr << "Error: missing or invalid epocroot attribute " - << "in device '" << epocDeviceValue << "'"; + qWarning("Warning: Missing or invalid epocroot attribute in device '%s' in devices.xml.", + qPrintable(epocDeviceValue)); } else { - std::cerr << "Error: no device matching EPOCDEVICE (" - << epocDeviceValue << ")"; + qWarning("Warning: No device matching EPOCDEVICE (%s) in devices.xml.", + qPrintable(epocDeviceValue)); } } else { if (epocDeviceFound) { - std::cerr << "Error: missing or invalid epocroot attribute " - << "in default device"; + qWarning("Warning: Missing or invalid epocroot attribute in default device in devices.xml."); } else { - std::cerr << "Error: no default device"; + qWarning("Warning: No default device set in devices.xml."); } } - std::cerr << " found in devices.xml file." << std::endl; } } } else { - std::cerr << "Error: could not open file " << devicesXmlPath << std::endl; + qWarning("Warning: Could not open file: '%s'.", qPrintable(devicesXmlPath)); } } } if (epocRootValue.isEmpty()) { // 5. An empty string is returned. - std::cerr << "Error: failed to find epoc root" << std::endl - << "Either" << std::endl - << " 1. Set EPOCROOT environment variable to a valid value" << std::endl - << " or 2. Ensure that the HKEY_LOCAL_MACHINE\\" SYMBIAN_SDKS_REG_SUBKEY - " registry key is set, and then" << std::endl - << " a. Set EPOCDEVICE environment variable to a valid device" << std::endl - << " or b. Specify a default device in the devices.xml file." << std::endl; + qWarning("Warning: failed to resolve epocroot." +#ifdef Q_OS_WIN32 + "\nEither\n" + " 1. Set EPOCROOT environment variable to a valid value.\n" + " or 2. Ensure that the HKEY_LOCAL_MACHINE\\" SYMBIAN_SDKS_REG_SUBKEY + " registry key is set, and then\n" + " a. Set EPOCDEVICE environment variable to a valid device\n" + " or b. Specify a default device in the devices.xml file."); +#else + " Set EPOCROOT environment variable to a valid value."); +#endif } else { fixEpocRoot(epocRootValue); } diff --git a/tools/shared/windows/registry.cpp b/tools/shared/windows/registry.cpp index 67d9b56..2373839 100644 --- a/tools/shared/windows/registry.cpp +++ b/tools/shared/windows/registry.cpp @@ -42,6 +42,7 @@ #include #include "registry.h" +#ifdef Q_OS_WIN32 /*! Returns the path part of a registry key. e.g. @@ -73,10 +74,11 @@ static QString keyName(const QString &rKey) return rKey; QString res(rKey.mid(idx + 1)); - if (res == "Default" || res == ".") - res = ""; + if (res == QLatin1String("Default") || res == QLatin1String(".")) + res = QString(); return res; } +#endif QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) { @@ -128,7 +130,7 @@ QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) break; l.append(s); } - result = l.join(", "); + result = l.join(QLatin1String(", ")); break; } -- cgit v0.12 From bc09d5b11cd45e975ec745b508c703b75b019a4e Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 18 Nov 2010 15:23:03 +0200 Subject: Resolve EPOCROOT in qt.conf using same logic as in .pro Previously it was only possible to use EPOCROOT in qt.conf via env variable, while qmake & configure could resolve it also via devices.xml. Changed qt.conf parsing to support $${EPOCROOT} tag and use same resolving logic as qmake & configure. Task-number: QTBUG-15393 Reviewed-by: axis --- qmake/Makefile.unix | 2 +- qmake/Makefile.win32 | 3 ++- qmake/Makefile.win32-g++ | 2 +- qmake/Makefile.win32-g++-sh | 2 +- qmake/qmake.pri | 2 +- src/corelib/global/global.pri | 2 ++ src/corelib/global/qlibraryinfo.cpp | 12 ++++++++++++ tools/linguist/lrelease/lrelease.pro | 1 + tools/shared/symbian/epocroot.pri | 11 +++++++++++ 9 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 tools/shared/symbian/epocroot.pri diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix index 8d56fc8..d941dc4 100644 --- a/qmake/Makefile.unix +++ b/qmake/Makefile.unix @@ -68,7 +68,7 @@ CPPFLAGS = -I. -Igenerators -Igenerators/unix -Igenerators/win32 -Igenerators/ma -I$(BUILD_PATH)/src/corelib/global -I$(BUILD_PATH)/src/corelib/xml \ -I$(SOURCE_PATH)/tools/shared \ -DQT_NO_PCRE \ - -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED \ + -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DQLIBRARYINFO_EPOCROOT \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_STL \ -DQT_NO_COMPRESS -I$(QMAKESPEC) -DHAVE_QCONFIG_CPP -DQT_NO_THREAD -DQT_NO_QOBJECT \ -DQT_NO_GEOM_VARIANT $(OPENSOURCE_CXXFLAGS) diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32 index 4d0121c..c04bcb2 100644 --- a/qmake/Makefile.win32 +++ b/qmake/Makefile.win32 @@ -40,7 +40,8 @@ CFLAGS_BARE = -c -Fo./ \ -I$(SOURCE_PATH)\tools\shared \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NODLL -DQT_NO_STL \ -DQT_NO_COMPRESS -DUNICODE -DHAVE_QCONFIG_CPP -DQT_BUILD_QMAKE -DQT_NO_THREAD \ - -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM -DQT_NO_PCRE -DQT_BOOTSTRAPPED + -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM -DQT_NO_PCRE -DQT_BOOTSTRAPPED \ + -DQLIBRARYINFO_EPOCROOT CFLAGS = -Yuqmake_pch.h -FIqmake_pch.h -Fpqmake_pch.pch $(CFLAGS_BARE) $(CFLAGS) CXXFLAGS_BARE = $(CFLAGS_BARE) diff --git a/qmake/Makefile.win32-g++ b/qmake/Makefile.win32-g++ index f313f9e..29fbd0a 100644 --- a/qmake/Makefile.win32-g++ +++ b/qmake/Makefile.win32-g++ @@ -25,7 +25,7 @@ CFLAGS = -c -o$@ -O \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NO_PCRE \ -DQT_NODLL -DQT_NO_STL -DQT_NO_COMPRESS -DUNICODE -DHAVE_QCONFIG_CPP \ -DQT_BUILD_QMAKE -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \ - -DQT_BOOTSTRAPPED + -DQT_BOOTSTRAPPED -DQLIBRARYINFO_EPOCROOT CXXFLAGS = $(CFLAGS) LFLAGS = -static-libgcc -static-libstdc++ -s LIBS = -lole32 -luuid diff --git a/qmake/Makefile.win32-g++-sh b/qmake/Makefile.win32-g++-sh index af54288..9c7942c 100644 --- a/qmake/Makefile.win32-g++-sh +++ b/qmake/Makefile.win32-g++-sh @@ -25,7 +25,7 @@ CFLAGS = -c -o$@ -O \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NO_PCRE \ -DQT_NODLL -DQT_NO_STL -DQT_NO_COMPRESS -DUNICODE -DHAVE_QCONFIG_CPP \ -DQT_BUILD_QMAKE -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \ - -DQT_BOOTSTRAPPED + -DQT_BOOTSTRAPPED -DQLIBRARYINFO_EPOCROOT CXXFLAGS = $(CFLAGS) LFLAGS = -static-libgcc -static-libstdc++ -s LIBS = -lole32 -luuid diff --git a/qmake/qmake.pri b/qmake/qmake.pri index 36c5d36..7cf94cb 100644 --- a/qmake/qmake.pri +++ b/qmake/qmake.pri @@ -3,7 +3,7 @@ CONFIG += depend_includepath QMAKE_INCREMENTAL = SKIP_DEPENDS += qconfig.h qmodules.h DEFINES += QT_NO_TEXTCODEC QT_NO_LIBRARY QT_NO_STL QT_NO_COMPRESS QT_NO_UNICODETABLES \ - QT_NO_GEOM_VARIANT QT_NO_DATASTREAM + QT_NO_GEOM_VARIANT QT_NO_DATASTREAM QLIBRARYINFO_EPOCROOT #qmake code SOURCES += project.cpp property.cpp main.cpp generators/makefile.cpp \ diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri index 4800716..86800ef 100644 --- a/src/corelib/global/global.pri +++ b/src/corelib/global/global.pri @@ -27,3 +27,5 @@ linux*:!static:!linux-armcc:!linux-gcce { # Compensate for lack of platform defines in Symbian3 and Symbian4 symbian: DEFINES += SYMBIAN_VERSION_$$upper($$replace(SYMBIAN_VERSION,\\.,_)) + +include(../../../tools/shared/symbian/epocroot.pri) diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 957abbf..acacf7c 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -62,6 +62,10 @@ QT_END_NAMESPACE # include "private/qcore_mac_p.h" #endif +#ifdef QLIBRARYINFO_EPOCROOT +# include "symbian/epocroot.h" +#endif + #include "qconfig.cpp" QT_BEGIN_NAMESPACE @@ -433,6 +437,14 @@ QLibraryInfo::location(LibraryLocation loc) QString::fromLocal8Bit(qgetenv(ret.mid(rep + 2, reg_var.matchedLength() - 3).toLatin1().constData()).constData())); } + +#ifdef QLIBRARYINFO_EPOCROOT + // $${EPOCROOT} is a special case, resolve it similarly to qmake. + QRegExp epocrootMatcher(QLatin1String("\\$\\$\\{EPOCROOT\\}")); + if ((rep = epocrootMatcher.indexIn(ret)) != -1) + ret.replace(rep, epocrootMatcher.matchedLength(), epocRoot()); +#endif + config->endGroup(); } } diff --git a/tools/linguist/lrelease/lrelease.pro b/tools/linguist/lrelease/lrelease.pro index 6beafa3..89694be 100644 --- a/tools/linguist/lrelease/lrelease.pro +++ b/tools/linguist/lrelease/lrelease.pro @@ -15,6 +15,7 @@ macx:SOURCES += $$QT_SOURCE_TREE/src/corelib/io/qsettings_mac.cpp include(../../../src/tools/bootstrap/bootstrap.pri) include(../shared/formats.pri) include(../shared/proparser.pri) +include(../../shared/symbian/epocroot.pri) win32:LIBS += -ladvapi32 # for qsettings_win.cpp diff --git a/tools/shared/symbian/epocroot.pri b/tools/shared/symbian/epocroot.pri new file mode 100644 index 0000000..117836e --- /dev/null +++ b/tools/shared/symbian/epocroot.pri @@ -0,0 +1,11 @@ +# Epocroot resolving is only required for tools, so omit it from all mobile/embedded builds +!symbian:!wince*:!embedded { +HEADERS += \ + $$QT_SOURCE_TREE/tools/shared/symbian/epocroot.h \ + $$QT_SOURCE_TREE/tools/shared/windows/registry.h +SOURCES += \ + $$QT_SOURCE_TREE/tools/shared/symbian/epocroot.cpp \ + $$QT_SOURCE_TREE/tools/shared/windows/registry.cpp +INCLUDEPATH += $$QT_SOURCE_TREE/tools/shared +DEFINES += QLIBRARYINFO_EPOCROOT +} -- cgit v0.12 From 8a298f78a8050bffff1d3c0135aa432a85747c2e Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 18 Nov 2010 16:59:42 +0200 Subject: Add symbian scope for qfiledialog_symbian.cpp Missing symbian scope caused build break on non-symbian platforms. Reviewed-by: Janne Koskinen --- src/gui/dialogs/dialogs.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/dialogs/dialogs.pri b/src/gui/dialogs/dialogs.pri index c7cb794..443c5e9 100644 --- a/src/gui/dialogs/dialogs.pri +++ b/src/gui/dialogs/dialogs.pri @@ -108,7 +108,7 @@ SOURCES += \ dialogs/qwizard.cpp \ dialogs/qprintpreviewdialog.cpp -contains(QT_CONFIG, s60) { +symbian:contains(QT_CONFIG, s60) { LIBS += -lcommondialogs \ -lavkon \ -lplatformenv \ -- cgit v0.12 From 00e99440596d8bf648aefdfbb00e80004e328033 Mon Sep 17 00:00:00 2001 From: Titta Heikkala Date: Fri, 19 Nov 2010 09:47:55 +0200 Subject: Corrected ASCII comparison and removed extra braces Corrected ASCII comparison and removed extra braces based on comments Task-number: QT-3917 Reviewed-by: Janne Koskinen Merge-request: 918 Reviewed-by: Janne Koskinen --- src/gui/dialogs/qfiledialog.cpp | 3 +-- src/gui/dialogs/qfiledialog_symbian.cpp | 32 ++++++++++++++------------------ 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index 1db9789..f3f7469 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -1964,9 +1964,8 @@ QString QFileDialog::getExistingDirectory(QWidget *parent, if (qt_filedialog_existing_directory_hook && !(options & DontUseNativeDialog)) return qt_filedialog_existing_directory_hook(parent, caption, dir, options); #if defined(Q_WS_S60) - if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0 && !(options & DontUseNativeDialog)) { + if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0 && !(options & DontUseNativeDialog)) return qtSymbianGetExistingDirectory(caption, dir); - } #endif QFileDialogArgs args; args.parent = parent; diff --git a/src/gui/dialogs/qfiledialog_symbian.cpp b/src/gui/dialogs/qfiledialog_symbian.cpp index 0277e1c..1f70305 100644 --- a/src/gui/dialogs/qfiledialog_symbian.cpp +++ b/src/gui/dialogs/qfiledialog_symbian.cpp @@ -86,26 +86,25 @@ public: TBool Accept(const TDesC &/*aDriveAndPath*/, const TEntry &aEntry) const { - if (aEntry.IsDir()) { + if (aEntry.IsDir()) return ETrue; - } - if (filterList.isEmpty()) { - //No filter for files, all can be accepted + + //If no filter for files, all can be accepted + if (filterList.isEmpty()) return ETrue; - } - if (filterList == QStringList(QLatin1String("(*)"))) { + + if (filterList == QStringList(QLatin1String("(*)"))) return ETrue; - } + for (int i = 0; i < filterList.size(); ++i) { QString extension = filterList.at(i); //remove '*' from the beginning of the extension - if (extension.left(1) == "*"){ - extension = extension.right(extension.size() - 1); - } + if (extension.at(0) == QLatin1Char('*')) + extension = extension.mid(1); + QString fileName = qt_TDesC2QString(aEntry.iName); - if (fileName.right(extension.size()) == extension) { + if (fileName.endsWith(extension)) return ETrue; - } } return EFalse; } @@ -140,18 +139,15 @@ static QString launchSymbianDialog(const QString dialogCaption, const QString st select = AknCommonDialogsDynMem::RunSelectDlgLD(types, target, startFolder, NULL, NULL, titlePtr, extensionFilter); CleanupStack::Pop(extensionFilter); - } - else if (dialogMode == DialogSave) { + } else if (dialogMode == DialogSave) { select = AknCommonDialogsDynMem::RunSaveDlgLD(types, target, startFolder, NULL, NULL, titlePtr); - } - else if (dialogMode == DialogFolder) { + } else if (dialogMode == DialogFolder) { select = AknCommonDialogsDynMem::RunFolderSelectDlgLD(types, target, startFolder, 0, 0, titlePtr, NULL, NULL); } - if (select) { + if (select) selection.append(qt_TDesC2QString(target)); - } ); #endif return selection; -- cgit v0.12 From 4b380543cc973d575a3ed0c77918adbe5b6133f0 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 19 Nov 2010 14:53:29 +0200 Subject: Fixed namespace issues related to epocroot.cpp Task-number: QTBUG-15393 Reviewed-by: axis --- .../symbian/initprojectdeploy_symbian.cpp | 12 ++-- qmake/generators/symbian/symbiancommon.cpp | 4 +- qmake/generators/symbian/symmake.cpp | 10 +-- qmake/generators/symbian/symmake_abld.cpp | 4 +- qmake/generators/symbian/symmake_sbsv2.cpp | 8 +-- qmake/generators/win32/msvc_vcproj.cpp | 6 +- qmake/project.cpp | 4 +- qmake/qmake.pri | 4 +- src/corelib/global/qlibraryinfo.cpp | 4 +- tools/configure/configure.pro | 4 +- tools/configure/environment.cpp | 10 +-- tools/shared/symbian/epocroot.cpp | 17 ++--- tools/shared/symbian/epocroot.h | 67 ----------------- tools/shared/symbian/epocroot.pri | 4 +- tools/shared/symbian/epocroot_p.h | 83 ++++++++++++++++++++++ tools/shared/windows/registry.cpp | 7 +- tools/shared/windows/registry.h | 64 ----------------- tools/shared/windows/registry_p.h | 80 +++++++++++++++++++++ 18 files changed, 214 insertions(+), 178 deletions(-) delete mode 100644 tools/shared/symbian/epocroot.h create mode 100644 tools/shared/symbian/epocroot_p.h delete mode 100644 tools/shared/windows/registry.h create mode 100644 tools/shared/windows/registry_p.h diff --git a/qmake/generators/symbian/initprojectdeploy_symbian.cpp b/qmake/generators/symbian/initprojectdeploy_symbian.cpp index 22a4a82..81236d4 100644 --- a/qmake/generators/symbian/initprojectdeploy_symbian.cpp +++ b/qmake/generators/symbian/initprojectdeploy_symbian.cpp @@ -47,7 +47,7 @@ #include // Included from tools/shared -#include +#include #define SYSBIN_DIR "/sys/bin" #define HW_Z_DIR "epoc32/data/z" @@ -75,7 +75,7 @@ static bool isPlugin(const QFileInfo& info, const QString& devicePath) && (devicePath.size() < 8 || (0 != devicePath.compare(QLatin1String(SYSBIN_DIR), Qt::CaseInsensitive) && 0 != devicePath.mid(1).compare(QLatin1String(":" SYSBIN_DIR), Qt::CaseInsensitive) - && 0 != devicePath.compare(epocRoot() + QLatin1String(HW_Z_DIR SYSBIN_DIR))))) { + && 0 != devicePath.compare(qt_epocRoot() + QLatin1String(HW_Z_DIR SYSBIN_DIR))))) { return true; } else { return false; @@ -182,7 +182,7 @@ void initProjectDeploySymbian(QMakeProject* project, QString deploymentDrive; if (0 == platform.compare(QLatin1String(ROM_DEPLOYMENT_PLATFORM))) { - deploymentDrive = epocRoot() + HW_Z_DIR; + deploymentDrive = qt_epocRoot() + HW_Z_DIR; } else { deploymentDrive = targetPathHasDriveLetter ? targetPath.left(2) : QLatin1String("c:"); } @@ -225,9 +225,9 @@ void initProjectDeploySymbian(QMakeProject* project, } else { if (0 == platform.compare(QLatin1String(EMULATOR_DEPLOYMENT_PLATFORM))) { if (devicePathHasDriveLetter) { - devicePath = epocRoot() + "epoc32/winscw/" + devicePath.remove(1, 1); + devicePath = qt_epocRoot() + "epoc32/winscw/" + devicePath.remove(1, 1); } else { - devicePath = epocRoot() + "epoc32/winscw/c" + devicePath; + devicePath = qt_epocRoot() + "epoc32/winscw/c" + devicePath; } } else { if (devicePathHasDriveLetter @@ -278,7 +278,7 @@ void initProjectDeploySymbian(QMakeProject* project, // Executables and libraries are deployed to \sys\bin QFileInfo targetPath; if (epocBuild) - targetPath.setFile(epocRoot() + "epoc32/release/" + platform + "/" + build + "/"); + targetPath.setFile(qt_epocRoot() + "epoc32/release/" + platform + "/" + build + "/"); else targetPath.setFile(info.path() + QDir::separator()); if(devicePathHasDriveLetter) { diff --git a/qmake/generators/symbian/symbiancommon.cpp b/qmake/generators/symbian/symbiancommon.cpp index 2244a98..602bcc2 100644 --- a/qmake/generators/symbian/symbiancommon.cpp +++ b/qmake/generators/symbian/symbiancommon.cpp @@ -44,7 +44,7 @@ #include // Included from tools/shared -#include +#include #define RESOURCE_DIRECTORY_RESOURCE "\\\\resource\\\\apps\\\\" @@ -417,7 +417,7 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, QString zDir; remoteTestPath = QString("!:\\private\\%1").arg(privateDirUid); if (epocBuild) - zDir = epocRoot() + QLatin1String("epoc32/data/z"); + zDir = qt_epocRoot() + QLatin1String("epoc32/data/z"); DeploymentList depList; initProjectDeploySymbian(project, depList, remoteTestPath, true, epocBuild, "$(PLATFORM)", "$(TARGET)", generatedDirs, generatedFiles); diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index e1426ab..7bebd56 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -50,7 +50,7 @@ #include // Included from tools/shared -#include +#include #define RESOURCE_DIRECTORY_MMP "/resource/apps" #define REGISTRATION_RESOURCE_DIRECTORY_HW "/private/10003a3f/import/apps" @@ -87,10 +87,10 @@ QString SymbianMakefileGenerator::fixPathForMmp(const QString& origPath, const Q { static QString epocRootStr; if (epocRootStr.isEmpty()) { - epocRootStr = epocRoot(); + epocRootStr = qt_epocRoot(); QFileInfo efi(epocRootStr); if (!efi.exists() || epocRootStr.isEmpty()) { - fprintf(stderr, "Unable to resolve epocRoot '%s' to real dir on current drive, defaulting to '/' for mmp paths\n", qPrintable(epocRoot())); + fprintf(stderr, "Unable to resolve epocRoot '%s' to real dir on current drive, defaulting to '/' for mmp paths\n", qPrintable(qt_epocRoot())); epocRootStr = "/"; } else { epocRootStr = efi.absoluteFilePath(); @@ -122,7 +122,7 @@ QString SymbianMakefileGenerator::absolutizePath(const QString& origPath) // Prepend epocroot to any paths beginning with "/epoc32/" QString resultPath = QDir::fromNativeSeparators(origPath); if (resultPath.startsWith("/epoc32/", Qt::CaseInsensitive)) - resultPath = QDir::fromNativeSeparators(epocRoot()) + resultPath.mid(1); + resultPath = QDir::fromNativeSeparators(qt_epocRoot()) + resultPath.mid(1); QFileInfo fi(fileInfo(resultPath)); @@ -719,7 +719,7 @@ void SymbianMakefileGenerator::writeMmpFileLibraryPart(QTextStream& t) // Hacky way to find out what kind of library it is. Check the // ARMV5 build directory for library type. We default to shared // library, since that is more common. - QString udebStaticLibLocation(epocRoot()); + QString udebStaticLibLocation(qt_epocRoot()); QString urelStaticLibLocation(udebStaticLibLocation); udebStaticLibLocation += QString("epoc32/release/armv5/udeb/%1.lib").arg(lib); urelStaticLibLocation += QString("epoc32/release/armv5/urel/%1.lib").arg(lib); diff --git a/qmake/generators/symbian/symmake_abld.cpp b/qmake/generators/symbian/symmake_abld.cpp index 7059a52..cd64325 100644 --- a/qmake/generators/symbian/symmake_abld.cpp +++ b/qmake/generators/symbian/symmake_abld.cpp @@ -49,7 +49,7 @@ #include // Included from tools/shared -#include +#include #define DO_NOTHING_TARGET "do_nothing" #define CREATE_TEMPS_TARGET "create_temps" @@ -431,7 +431,7 @@ bool SymbianAbldMakefileGenerator::writeDeploymentTargets(QTextStream &t, bool i else t << WINSCW_DEPLOYMENT_TARGET ":" << endl; - QString remoteTestPath = epocRoot() + QString remoteTestPath = qt_epocRoot() + QDir::toNativeSeparators(QLatin1String(isRom ? "epoc32/data/z/private/" : "epoc32/winscw/c/private/")) + privateDirUid; diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp index b3f8ba2..f4a6132 100644 --- a/qmake/generators/symbian/symmake_sbsv2.cpp +++ b/qmake/generators/symbian/symmake_sbsv2.cpp @@ -49,7 +49,7 @@ #include // Included from tools/shared -#include +#include SymbianSbsv2MakefileGenerator::SymbianSbsv2MakefileGenerator() : SymbianMakefileGenerator() { } SymbianSbsv2MakefileGenerator::~SymbianSbsv2MakefileGenerator() { } @@ -82,7 +82,7 @@ void SymbianSbsv2MakefileGenerator::exportFlm() QDir sourceDir = QDir(QLibraryInfo::location(QLibraryInfo::PrefixPath) + FLM_SOURCE_DIR); QFileInfoList sourceInfos = sourceDir.entryInfoList(QDir::Files); - QDir destDir(epocRoot() + FLM_DEST_DIR); + QDir destDir(qt_epocRoot() + FLM_DEST_DIR); if (!destDir.exists()) { if (destDir.mkpath(destDir.absolutePath())) generatedDirs << destDir.absolutePath(); @@ -630,7 +630,7 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t t << endl; // Write deployment rules - QString remoteTestPath = epocRoot() + QLatin1String("epoc32/winscw/c/private/") + privateDirUid; + QString remoteTestPath = qt_epocRoot() + QLatin1String("epoc32/winscw/c/private/") + privateDirUid; DeploymentList depList; //write emulator deployment @@ -641,7 +641,7 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t t << "#endif" << endl; //write ROM deployment - remoteTestPath = epocRoot() + QLatin1String("epoc32/data/z/private/") + privateDirUid; + remoteTestPath = qt_epocRoot() + QLatin1String("epoc32/data/z/private/") + privateDirUid; depList.clear(); initProjectDeploySymbian(project, depList, remoteTestPath, false, true, QLatin1String(ROM_DEPLOYMENT_PLATFORM), QString(), generatedDirs, generatedFiles); diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index a8ff306..6f27515 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -67,7 +67,7 @@ QT_END_NAMESPACE #ifdef Q_OS_WIN32 #include -#include +#include QT_BEGIN_NAMESPACE @@ -119,7 +119,7 @@ DotNET which_dotnet_version() int installed = 0; int i = 0; for(; dotNetCombo[i].version; ++i) { - QString path = readRegistryKey(HKEY_LOCAL_MACHINE, dotNetCombo[i].regKey); + QString path = qt_readRegistryKey(HKEY_LOCAL_MACHINE, dotNetCombo[i].regKey); if(!path.isEmpty()) { ++installed; current_version = dotNetCombo[i].version; @@ -136,7 +136,7 @@ DotNET which_dotnet_version() i = installed = 0; for(; dotNetCombo[i].version; ++i) { - QString productPath = readRegistryKey(HKEY_LOCAL_MACHINE, dotNetCombo[i].regKey).toLower(); + QString productPath = qt_readRegistryKey(HKEY_LOCAL_MACHINE, dotNetCombo[i].regKey).toLower(); if (productPath.isEmpty()) continue; QStringList::iterator it; diff --git a/qmake/project.cpp b/qmake/project.cpp index fe08b7b..2586c57 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -64,7 +64,7 @@ #include // Included from tools/shared -#include +#include #ifdef Q_OS_WIN32 #define QT_POPEN _popen @@ -3118,7 +3118,7 @@ QStringList &QMakeProject::values(const QString &_var, QMapendGroup(); diff --git a/tools/configure/configure.pro b/tools/configure/configure.pro index 810f006..0a49fbe 100644 --- a/tools/configure/configure.pro +++ b/tools/configure/configure.pro @@ -63,8 +63,8 @@ HEADERS = configureapp.h environment.h tools.h\ $$QT_SOURCE_TREE/src/corelib/tools/qunicodetables_p.h \ $$QT_SOURCE_TREE/src/corelib/xml/qxmlstream.h \ $$QT_SOURCE_TREE/src/corelib/xml/qxmlutils_p.h \ - $$QT_SOURCE_TREE/tools/shared/symbian/epocroot.h \ - $$QT_SOURCE_TREE/tools/shared/windows/registry.h + $$QT_SOURCE_TREE/tools/shared/symbian/epocroot_p.h \ + $$QT_SOURCE_TREE/tools/shared/windows/registry_p.h SOURCES = main.cpp configureapp.cpp environment.cpp tools.cpp \ diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp index 03fd0cc..1866ef4 100644 --- a/tools/configure/environment.cpp +++ b/tools/configure/environment.cpp @@ -60,8 +60,8 @@ using namespace std; #include #endif -#include // from tools/shared -#include // from tools/shared +#include // from tools/shared +#include // from tools/shared QT_BEGIN_NAMESPACE @@ -163,7 +163,7 @@ Compiler Environment::detectCompiler() QString paths = qgetenv("PATH"); QStringList pathlist = paths.toLower().split(";"); for(int i = 0; compiler_info[i].compiler; ++i) { - QString productPath = readRegistryKey(HKEY_LOCAL_MACHINE, compiler_info[i].regKey).toLower(); + QString productPath = qt_readRegistryKey(HKEY_LOCAL_MACHINE, compiler_info[i].regKey).toLower(); if (productPath.length()) { QStringList::iterator it; for(it = pathlist.begin(); it != pathlist.end(); ++it) { @@ -466,8 +466,8 @@ bool Environment::rmdir(const QString &name) QString Environment::symbianEpocRoot() { - // Call function defined in tools/shared/symbian/epocroot.h - return ::epocRoot(); + // Call function defined in tools/shared/symbian/epocroot_p.h + return ::qt_epocRoot(); } QT_END_NAMESPACE diff --git a/tools/shared/symbian/epocroot.cpp b/tools/shared/symbian/epocroot.cpp index 9d7d465..eabae98 100644 --- a/tools/shared/symbian/epocroot.cpp +++ b/tools/shared/symbian/epocroot.cpp @@ -39,13 +39,13 @@ ** ****************************************************************************/ -#include - #include #include -#include "epocroot.h" -#include "../windows/registry.h" +#include "epocroot_p.h" +#include "../windows/registry_p.h" + +QT_BEGIN_NAMESPACE // Registry key under which the location of the Symbian devices.xml file is // stored. @@ -64,20 +64,20 @@ // Stored as a static value in order to avoid unnecessary re-evaluation. static QString epocRootValue; -QString getDevicesXmlPath() +static QString getDevicesXmlPath() { // Note that the following call will return a null string on platforms other // than Windows. If support is required on other platforms for devices.xml, // an alternative mechanism for retrieving the location of this file will // be required. - return readRegistryKey(SYMBIAN_SDKS_REG_HANDLE, QLatin1String(SYMBIAN_SDKS_REG_SUBKEY)); + return qt_readRegistryKey(SYMBIAN_SDKS_REG_HANDLE, QLatin1String(SYMBIAN_SDKS_REG_SUBKEY)); } /** * Checks whether epocRootValue points to an existent directory. * If not, epocRootValue is set to an empty string and an error message is printed. */ -void checkEpocRootExists(const QString &source) +static void checkEpocRootExists(const QString &source) { if (!epocRootValue.isEmpty()) { QDir dir(epocRootValue); @@ -104,7 +104,7 @@ static void fixEpocRoot(QString &path) /** * Determine the epoc root for the currently active SDK. */ -QString epocRoot() +QString qt_epocRoot() { if (epocRootValue.isEmpty()) { // 1. If environment variable EPOCROOT is set and points to an existent @@ -219,3 +219,4 @@ QString epocRoot() return epocRootValue; } +QT_END_NAMESPACE diff --git a/tools/shared/symbian/epocroot.h b/tools/shared/symbian/epocroot.h deleted file mode 100644 index 9846485..0000000 --- a/tools/shared/symbian/epocroot.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SYMBIAN_EPOCROOT_H -#define SYMBIAN_EPOCROOT_H - -#include - -/** - * Determine the epoc root for the currently active SDK. - * - * The algorithm used is as follows: - * 1. If environment variable EPOCROOT is set and points to an existent - * directory, this is returned. - * 2. The location of devices.xml is specified by a registry key. If this - * file exists, it is parsed. - * 3. If the EPOCDEVICE environment variable is set and a corresponding - * entry is found in devices.xml, and its epocroot value points to an - * existent directory, it is returned. - * 4. If a device element marked as default is found in devices.xml and its - * epocroot value points to an existent directory, this is returned. - * 5. An empty string is returned. - * - * Any return value other than the empty string therefore is guaranteed to - * point to an existent directory. - */ -QString epocRoot(); - -#endif // EPOCROOT_H diff --git a/tools/shared/symbian/epocroot.pri b/tools/shared/symbian/epocroot.pri index 117836e..f0f0dab 100644 --- a/tools/shared/symbian/epocroot.pri +++ b/tools/shared/symbian/epocroot.pri @@ -1,8 +1,8 @@ # Epocroot resolving is only required for tools, so omit it from all mobile/embedded builds !symbian:!wince*:!embedded { HEADERS += \ - $$QT_SOURCE_TREE/tools/shared/symbian/epocroot.h \ - $$QT_SOURCE_TREE/tools/shared/windows/registry.h + $$QT_SOURCE_TREE/tools/shared/symbian/epocroot_p.h \ + $$QT_SOURCE_TREE/tools/shared/windows/registry_p.h SOURCES += \ $$QT_SOURCE_TREE/tools/shared/symbian/epocroot.cpp \ $$QT_SOURCE_TREE/tools/shared/windows/registry.cpp diff --git a/tools/shared/symbian/epocroot_p.h b/tools/shared/symbian/epocroot_p.h new file mode 100644 index 0000000..c97b593 --- /dev/null +++ b/tools/shared/symbian/epocroot_p.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake application of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT_SYMBIAN_EPOCROOT_H +#define QT_SYMBIAN_EPOCROOT_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include + +QT_BEGIN_NAMESPACE + +/** + * Determine the epoc root for the currently active SDK. + * + * The algorithm used is as follows: + * 1. If environment variable EPOCROOT is set and points to an existent + * directory, this is returned. + * 2. The location of devices.xml is specified by a registry key. If this + * file exists, it is parsed. + * 3. If the EPOCDEVICE environment variable is set and a corresponding + * entry is found in devices.xml, and its epocroot value points to an + * existent directory, it is returned. + * 4. If a device element marked as default is found in devices.xml and its + * epocroot value points to an existent directory, this is returned. + * 5. An empty string is returned. + * + * Any return value other than the empty string therefore is guaranteed to + * point to an existent directory. + */ +QString qt_epocRoot(); + +QT_END_NAMESPACE + +#endif // QT_SYMBIAN_EPOCROOT_H + diff --git a/tools/shared/windows/registry.cpp b/tools/shared/windows/registry.cpp index 2373839..48e9ae6 100644 --- a/tools/shared/windows/registry.cpp +++ b/tools/shared/windows/registry.cpp @@ -40,7 +40,9 @@ ****************************************************************************/ #include -#include "registry.h" +#include "registry_p.h" + +QT_BEGIN_NAMESPACE #ifdef Q_OS_WIN32 /*! @@ -80,7 +82,7 @@ static QString keyName(const QString &rKey) } #endif -QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) +QString qt_readRegistryKey(HKEY parentHandle, const QString &rSubkey) { QString result; @@ -160,4 +162,5 @@ QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) return result; } +QT_END_NAMESPACE diff --git a/tools/shared/windows/registry.h b/tools/shared/windows/registry.h deleted file mode 100644 index 3896527..0000000 --- a/tools/shared/windows/registry.h +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef WINDOWS_REGISTRY_H -#define WINDOWS_REGISTRY_H - -#include - -#ifdef Q_OS_WIN32 - #include -#else - typedef void* HKEY; -#endif - -#include - -/** - * Read a value from the Windows registry. - * - * If the key is not found, or the registry cannot be accessed (for example - * if this code is compiled for a platform other than Windows), a null - * string is returned. - */ -QString readRegistryKey(HKEY parentHandle, const QString &rSubkey); - -#endif // WINDOWS_REGISTRY_H diff --git a/tools/shared/windows/registry_p.h b/tools/shared/windows/registry_p.h new file mode 100644 index 0000000..4aae5f9 --- /dev/null +++ b/tools/shared/windows/registry_p.h @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake application of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT_WINDOWS_REGISTRY_H +#define QT_WINDOWS_REGISTRY_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +QT_BEGIN_NAMESPACE + +#include + +#ifdef Q_OS_WIN32 + #include +#else + typedef void* HKEY; +#endif + +#include + +/** + * Read a value from the Windows registry. + * + * If the key is not found, or the registry cannot be accessed (for example + * if this code is compiled for a platform other than Windows), a null + * string is returned. + */ +QString qt_readRegistryKey(HKEY parentHandle, const QString &rSubkey); + +QT_END_NAMESPACE + +#endif // QT_WINDOWS_REGISTRY_H + -- cgit v0.12 From 348fef0a406006ac813732ad5b8a143d8a63e879 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 22 Nov 2010 12:55:43 +0200 Subject: Fix a build break when namespace is defined Reviewed-by: Jani Hautakangas --- src/opengl/gl2paintengineex/qtriangulator.cpp | 34 +++++++++++++-------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/opengl/gl2paintengineex/qtriangulator.cpp b/src/opengl/gl2paintengineex/qtriangulator.cpp index 4c3deb6..75d5ce2 100644 --- a/src/opengl/gl2paintengineex/qtriangulator.cpp +++ b/src/opengl/gl2paintengineex/qtriangulator.cpp @@ -339,7 +339,7 @@ static inline qint64 qPointDistanceFromLine(const QPodPoint &p, const QPodPoint static inline bool qPointIsLeftOfLine(const QPodPoint &p, const QPodPoint &v1, const QPodPoint &v2) { - return ::qPointDistanceFromLine(p, v1, v2) < 0; + return QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(p, v1, v2) < 0; } // Return: @@ -1741,7 +1741,7 @@ bool QTriangulator::ComplexToSimple::calculateIntersection(int left, int righ Intersection intersection; intersection.leftEdge = left; intersection.rightEdge = right; - intersection.intersectionPoint = ::qIntersectionPoint(u1, u2, v1, v2); + intersection.intersectionPoint = QT_PREPEND_NAMESPACE(qIntersectionPoint)(u1, u2, v1, v2); if (!intersection.intersectionPoint.isValid()) return false; @@ -1767,10 +1767,10 @@ bool QTriangulator::ComplexToSimple::edgeIsLeftOfEdge(int leftEdgeIndex, int return true; if (upper.x > qMax(l.x, u.x)) return false; - qint64 d = ::qPointDistanceFromLine(upper, l, u); + qint64 d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(upper, l, u); // d < 0: left, d > 0: right, d == 0: on top if (d == 0) - d = ::qPointDistanceFromLine(m_parent->m_vertices.at(leftEdge.lower()), l, u); + d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(m_parent->m_vertices.at(leftEdge.lower()), l, u); return d < 0; } @@ -1814,7 +1814,7 @@ QPair::Node *, QRBTree::Node *> QTriangulator::ComplexToSim while (current) { const QPodPoint &v1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); const QPodPoint &v2 = m_parent->m_vertices.at(m_edges.at(current->data).upper()); - qint64 d = ::qPointDistanceFromLine(point, v1, v2); + qint64 d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(point, v1, v2); if (d == 0) { result.first = result.second = current; break; @@ -1828,7 +1828,7 @@ QPair::Node *, QRBTree::Node *> QTriangulator::ComplexToSim while (current) { const QPodPoint &v1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); const QPodPoint &v2 = m_parent->m_vertices.at(m_edges.at(current->data).upper()); - qint64 d = ::qPointDistanceFromLine(point, v1, v2); + qint64 d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(point, v1, v2); Q_ASSERT(d >= 0); if (d == 0) { result.first = current; @@ -1842,7 +1842,7 @@ QPair::Node *, QRBTree::Node *> QTriangulator::ComplexToSim while (current) { const QPodPoint &v1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); const QPodPoint &v2 = m_parent->m_vertices.at(m_edges.at(current->data).upper()); - qint64 d = ::qPointDistanceFromLine(point, v1, v2); + qint64 d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(point, v1, v2); Q_ASSERT(d <= 0); if (d == 0) { result.second = current; @@ -1864,7 +1864,7 @@ QPair::Node *, QRBTree::Node *> QTriangulator::ComplexToSim while (current) { const QPodPoint &v1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); const QPodPoint &v2 = m_parent->m_vertices.at(m_edges.at(current->data).upper()); - qint64 d = ::qPointDistanceFromLine(point, v1, v2); + qint64 d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(point, v1, v2); if (d == 0) break; if (d < 0) { @@ -1885,7 +1885,7 @@ QPair::Node *, QRBTree::Node *> QTriangulator::ComplexToSim while (current) { const QPodPoint &v1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); const QPodPoint &v2 = m_parent->m_vertices.at(m_edges.at(current->data).upper()); - qint64 d = ::qPointDistanceFromLine(point, v1, v2); + qint64 d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(point, v1, v2); Q_ASSERT(d >= 0); if (d == 0) { current = current->left; @@ -1899,7 +1899,7 @@ QPair::Node *, QRBTree::Node *> QTriangulator::ComplexToSim while (current) { const QPodPoint &v1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); const QPodPoint &v2 = m_parent->m_vertices.at(m_edges.at(current->data).upper()); - qint64 d = ::qPointDistanceFromLine(point, v1, v2); + qint64 d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(point, v1, v2); Q_ASSERT(d <= 0); if (d == 0) { current = current->right; @@ -1962,7 +1962,7 @@ void QTriangulator::ComplexToSimple::reorderEdgeListRange(QRBTree::Node template void QTriangulator::ComplexToSimple::sortEdgeList(const QPodPoint eventPoint) { - QIntersectionPoint eventPoint2 = ::qIntersectionPoint(eventPoint); + QIntersectionPoint eventPoint2 = QT_PREPEND_NAMESPACE(qIntersectionPoint)(eventPoint); while (!m_topIntersection.isEmpty() && m_topIntersection.top().intersectionPoint < eventPoint2) { Intersection intersection = m_topIntersection.pop(); @@ -2056,7 +2056,7 @@ void QTriangulator::ComplexToSimple::calculateIntersections() QPair::Node *, QRBTree::Node *> range = bounds(event.point); QRBTree::Node *leftNode = range.first ? m_edgeList.previous(range.first) : 0; int vertex = (event.type == Event::Upper ? m_edges.at(event.edge).upper() : m_edges.at(event.edge).lower()); - QIntersectionPoint eventPoint = ::qIntersectionPoint(event.point); + QIntersectionPoint eventPoint = QT_PREPEND_NAMESPACE(qIntersectionPoint)(event.point); if (range.first != 0) { splitEdgeListRange(range.first, range.second, vertex, eventPoint); @@ -2213,7 +2213,7 @@ void QTriangulator::ComplexToSimple::removeUnwantedEdgesAndConnect() while (current != b.second) { Q_ASSERT(current); Q_ASSERT(m_edges.at(current->data).node == current); - Q_ASSERT(::qIntersectionPoint(event.point).isOnLine(m_parent->m_vertices.at(m_edges.at(current->data).from), m_parent->m_vertices.at(m_edges.at(current->data).to))); + Q_ASSERT(QT_PREPEND_NAMESPACE(qIntersectionPoint)(event.point).isOnLine(m_parent->m_vertices.at(m_edges.at(current->data).from), m_parent->m_vertices.at(m_edges.at(current->data).to))); Q_ASSERT(m_parent->m_vertices.at(m_edges.at(current->data).from) == event.point || m_parent->m_vertices.at(m_edges.at(current->data).to) == event.point); insertEdgeIntoVectorIfWanted(orderedEdges, current->data); current = m_edgeList.next(current); @@ -2612,10 +2612,10 @@ bool QTriangulator::SimpleToMonotone::edgeIsLeftOfEdge(int leftEdgeIndex, int const Edge &rightEdge = m_edges.at(rightEdgeIndex); const QPodPoint &u = m_parent->m_vertices.at(rightEdge.upper()); const QPodPoint &l = m_parent->m_vertices.at(rightEdge.lower()); - qint64 d = ::qPointDistanceFromLine(m_parent->m_vertices.at(leftEdge.upper()), l, u); + qint64 d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(m_parent->m_vertices.at(leftEdge.upper()), l, u); // d < 0: left, d > 0: right, d == 0: on top if (d == 0) - d = ::qPointDistanceFromLine(m_parent->m_vertices.at(leftEdge.lower()), l, u); + d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(m_parent->m_vertices.at(leftEdge.lower()), l, u); return d < 0; } @@ -2645,7 +2645,7 @@ QRBTree::Node *QTriangulator::SimpleToMonotone::searchEdgeLeftOfPoint(in while (current) { const QPodPoint &p1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); const QPodPoint &p2 = m_parent->m_vertices.at(m_edges.at(current->data).upper()); - qint64 d = ::qPointDistanceFromLine(m_parent->m_vertices.at(pointIndex), p1, p2); + qint64 d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(m_parent->m_vertices.at(pointIndex), p1, p2); if (d <= 0) { current = current->left; } else { @@ -2668,7 +2668,7 @@ void QTriangulator::SimpleToMonotone::classifyVertex(int i) const QPodPoint &p1 = m_parent->m_vertices.at(e1.from); const QPodPoint &p2 = m_parent->m_vertices.at(e2.from); const QPodPoint &p3 = m_parent->m_vertices.at(e2.to); - qint64 d = ::qPointDistanceFromLine(p1, p2, p3); + qint64 d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(p1, p2, p3); Q_ASSERT(d != 0 || (!startOrSplit && !endOrMerge)); e2.type = RegularVertex; -- cgit v0.12 From d7d0b1528fd200fc3110093244b8265fdf457238 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 22 Nov 2010 15:14:25 +0200 Subject: Fix symbian-mmp.conf include path Use $$[QT_INSTALL_DATA] instead of $$[QT_INSTALL_PREFIX] when adding include path that points under mkspecs. Task-number: QTBUG-15501 Reviewed-by: axis --- mkspecs/common/symbian/symbian-mmp.conf | 4 ++-- mkspecs/features/symbian/stl.prf | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mkspecs/common/symbian/symbian-mmp.conf b/mkspecs/common/symbian/symbian-mmp.conf index 1fbd302..4d554bd 100644 --- a/mkspecs/common/symbian/symbian-mmp.conf +++ b/mkspecs/common/symbian/symbian-mmp.conf @@ -18,8 +18,8 @@ MMP_RULES += $$MMP_RULES_DONT_EXPORT_ALL_CLASS_IMPEDIMENTA SYMBIAN_PLATFORMS = WINSCW GCCE ARMV5 ARMV6 INCLUDEPATH = \ - $$[QT_INSTALL_PREFIX]/mkspecs/common/symbian/stl-off \ - $$[QT_INSTALL_PREFIX]/mkspecs/common/symbian \ + $$[QT_INSTALL_DATA]/mkspecs/common/symbian/stl-off \ + $$[QT_INSTALL_DATA]/mkspecs/common/symbian \ $${EPOCROOT}epoc32/include \ $$OS_LAYER_LIBC_SYSTEMINCLUDE \ $$INCLUDEPATH diff --git a/mkspecs/features/symbian/stl.prf b/mkspecs/features/symbian/stl.prf index 65d4b93..1fd5e16 100644 --- a/mkspecs/features/symbian/stl.prf +++ b/mkspecs/features/symbian/stl.prf @@ -12,7 +12,7 @@ INCLUDEPATH += $$OS_LAYER_STDCPP_SYSTEMINCLUDE # Remove mkspecs/common/symbian/stl-off from beginning of includepath # in order to use new and delete operators from STL -INCLUDEPATH -= $$[QT_INSTALL_PREFIX]/mkspecs/common/symbian/stl-off +INCLUDEPATH -= $$[QT_INSTALL_DATA]/mkspecs/common/symbian/stl-off # libstdcppv5 is preferred over libstdcpp as it has/uses the throwing version of operator new # STDCPP turns on standard C++ new behaviour (ie. throwing new) -- cgit v0.12 From 0df002ad600800a6c4ccadb969e1b1de7f8353e7 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Mon, 22 Nov 2010 14:56:14 +0100 Subject: Fix non-stroked filled paths in OpenVG paint engine. The QPainter::fillRect() functions are optimizations to avoid state changes in the paint engines. Since these functions should be completely independant of state, ideally they should only call functions that are also stateless. QVGPaintEngine::fillRect() has two different code paths for this. The vgClearRect() path of this function is stateless however in the case of non-opaque or complex fills, this code path cannot be used and instead we use the normal path fill function which is not entirely stateless because ensureTransform() will apply the aliased coordinate transform if the current state includes a stroked pen. To avoid this happening for a pure fill (no stroke) we temporary set the pen state to be Qt::NoPen such that the state used by ensureTransform() is correct. Task-number: QTBUG-14717 Reviewed-by: Jani Hautakangas --- src/openvg/qpaintengine_vg.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index aea203f..03d756d 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -1502,7 +1502,10 @@ void QVGPaintEnginePrivate::fill(VGPath path, const QBrush& brush, VGint rule) return; ensureBrush(brush); setFillRule(rule); + QPen savedPen = currentPen; + currentPen = Qt::NoPen; ensurePathTransform(); + currentPen = savedPen; vgDrawPath(path, VG_FILL_PATH); } -- cgit v0.12 From a9467c8542ff745471e077ac8be554d3a0087e4a Mon Sep 17 00:00:00 2001 From: Milla Pohjanheimo Date: Fri, 19 Nov 2010 13:10:57 +0200 Subject: Native color dialog on symbian Native color dialog implementation for Symbian. During merge extra libraries removed. Task-number: QT-3917 Reviewed-by: Sami Merila Merge-Request: 932 Reviewed-by: Janne Koskinen --- src/gui/dialogs/dialogs.pri | 9 +-- src/gui/dialogs/qcolordialog.cpp | 21 ++++++ src/gui/dialogs/qcolordialog_symbian.cpp | 107 +++++++++++++++++++++++++++++++ 3 files changed, 131 insertions(+), 6 deletions(-) create mode 100644 src/gui/dialogs/qcolordialog_symbian.cpp diff --git a/src/gui/dialogs/dialogs.pri b/src/gui/dialogs/dialogs.pri index 443c5e9..c25b6d5 100644 --- a/src/gui/dialogs/dialogs.pri +++ b/src/gui/dialogs/dialogs.pri @@ -109,12 +109,9 @@ SOURCES += \ dialogs/qprintpreviewdialog.cpp symbian:contains(QT_CONFIG, s60) { - LIBS += -lcommondialogs \ - -lavkon \ - -lplatformenv \ - -lefsrv \ - -lgdi - SOURCES += dialogs/qfiledialog_symbian.cpp + LIBS += -lcommondialogs + SOURCES += dialogs/qfiledialog_symbian.cpp \ + dialogs/qcolordialog_symbian.cpp } FORMS += dialogs/qpagesetupwidget.ui diff --git a/src/gui/dialogs/qcolordialog.cpp b/src/gui/dialogs/qcolordialog.cpp index e9b5720..4ef2100 100644 --- a/src/gui/dialogs/qcolordialog.cpp +++ b/src/gui/dialogs/qcolordialog.cpp @@ -1952,6 +1952,12 @@ void QColorDialog::open(QObject *receiver, const char *member) \sa QDialog::open() */ +/* + For Symbian color dialogs +*/ +#ifdef Q_WS_S60 +extern QColor qtSymbianGetColor(const QColor &initial); +#endif /*! \since 4.5 @@ -1961,10 +1967,19 @@ void QColorDialog::open(QObject *receiver, const char *member) QColor::isValid()) color if the user cancels the dialog. The \a options argument allows you to customize the dialog. + + On Symbian, this static function will use the native color dialog and not a QColorDialog. + On Symbian the parameters \a title and \a parent has no relevance and the + \a options parameter is only used to define if the native color dialog is + used or not. */ QColor QColorDialog::getColor(const QColor &initial, QWidget *parent, const QString &title, ColorDialogOptions options) { +#ifdef Q_WS_S60 + if (!(options & DontUseNativeDialog)) + return qtSymbianGetColor(initial); +#endif QColorDialog dlg(parent); if (!title.isEmpty()) dlg.setWindowTitle(title); @@ -1979,10 +1994,16 @@ QColor QColorDialog::getColor(const QColor &initial, QWidget *parent, const QStr returns that color. The color is initially set to \a initial. The dialog is a child of \a parent. It returns an invalid (see QColor::isValid()) color if the user cancels the dialog. + + On Symbian, this static function will use the native + color dialog and not a QColorDialog. */ QColor QColorDialog::getColor(const QColor &initial, QWidget *parent) { +#ifdef Q_WS_S60 + return qtSymbianGetColor(initial); +#endif return getColor(initial, parent, QString(), ColorDialogOptions(0)); } diff --git a/src/gui/dialogs/qcolordialog_symbian.cpp b/src/gui/dialogs/qcolordialog_symbian.cpp new file mode 100644 index 0000000..3f8036c --- /dev/null +++ b/src/gui/dialogs/qcolordialog_symbian.cpp @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qcolordialog_p.h" + +#ifndef QT_NO_COLORDIALOG + + +#include "qcolor.h" +#include "private/qguiplatformplugin_p.h" + +#ifdef Q_WS_S60 +#include +#endif + +#include "private/qt_s60_p.h" + +QT_BEGIN_NAMESPACE + +QColor launchSymbianColorDialog(QColor initial) +{ + QColor currentColor = QColor::Invalid; +#ifdef Q_WS_S60 + QT_TRAP_THROWING( + CArrayFixFlat* array = new( ELeave ) CArrayFixFlat(17); + CleanupStack::PushL(array); + array->AppendL(KRgbBlack); + array->AppendL(KRgbDarkGray); + array->AppendL(KRgbDarkRed); + array->AppendL(KRgbDarkGreen); + array->AppendL(KRgbDarkYellow); + array->AppendL(KRgbDarkBlue); + array->AppendL(KRgbDarkMagenta); + array->AppendL(KRgbDarkCyan); + array->AppendL(KRgbRed); + array->AppendL(KRgbGreen); + array->AppendL(KRgbYellow); + array->AppendL(KRgbBlue); + array->AppendL(KRgbMagenta); + array->AppendL(KRgbCyan); + array->AppendL(KRgbGray); + array->AppendL(KRgbWhite); + + TRgb initialColour(initial.red(), initial.green(), initial.blue(), initial.alpha()); + + TBool noneChosen = EFalse; // If true shows the default colour button + CAknColourSelectionGrid* colourSelectionGrid = + CAknColourSelectionGrid::NewL(array, EFalse, noneChosen, initialColour); + CleanupStack::PushL(colourSelectionGrid); + + if (colourSelectionGrid->ExecuteLD()) { + currentColor.setRgb(initialColour.Red(), initialColour.Green(), + initialColour.Blue(), initialColour.Alpha()); + } + CleanupStack::Pop(colourSelectionGrid); + CleanupStack::PopAndDestroy(array); + ); +#endif + return currentColor; +} + +QColor qtSymbianGetColor(const QColor &initial) +{ + return launchSymbianColorDialog(initial); +} + +QT_END_NAMESPACE + +#endif // QT_NO_COLORDIALOG -- cgit v0.12 From f9c97d3a4ab7bbd0ca2f4cf33a53025af23fc47c Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Tue, 23 Nov 2010 11:13:41 +0100 Subject: Fix QPixmap::fromImage() in the OpenVG pixmap backend. If QPixmap::fromImage() was called with a QImage that has an alpha channel and with the 'Qt::NoOpaqueDetection' image conversion flag set, then we would always create an opaque (RGB32) pixmap. This is incorrect. The fix is to check if the source QImage has an alpha channel and if so, use sourceFormat(), otherwise use RGB32. Task-number: QT-4278 Reviewed-by: Jani Hautakangas --- src/openvg/qpixmapdata_vg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp index 509882b..c3c7def 100644 --- a/src/openvg/qpixmapdata_vg.cpp +++ b/src/openvg/qpixmapdata_vg.cpp @@ -214,7 +214,7 @@ void QVGPixmapData::createPixmapForImage(QImage &image, Qt::ImageConversionFlags else if (!(flags & Qt::NoOpaqueDetection) && const_cast(image).data_ptr()->checkForAlphaPixels()) format = sourceFormat(); else - format = QImage::Format_RGB32; + format = image.hasAlphaChannel() ? sourceFormat() : QImage::Format_RGB32; if (inPlace && image.data_ptr()->convertInPlace(format, flags)) source = image; -- cgit v0.12 From b5e5d6b39c01c4a3962d07d79c025c16aa1c24a5 Mon Sep 17 00:00:00 2001 From: Janne Koskinen Date: Tue, 23 Nov 2010 12:30:02 +0200 Subject: Fix spaces Remove extra spaces Reviewed-by: Miikka Heikkinen --- src/gui/dialogs/qcolordialog.cpp | 2 +- src/gui/dialogs/qcolordialog_symbian.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/dialogs/qcolordialog.cpp b/src/gui/dialogs/qcolordialog.cpp index 4ef2100..a66a979 100644 --- a/src/gui/dialogs/qcolordialog.cpp +++ b/src/gui/dialogs/qcolordialog.cpp @@ -1968,7 +1968,7 @@ extern QColor qtSymbianGetColor(const QColor &initial); The \a options argument allows you to customize the dialog. - On Symbian, this static function will use the native color dialog and not a QColorDialog. + On Symbian, this static function will use the native color dialog and not a QColorDialog. On Symbian the parameters \a title and \a parent has no relevance and the \a options parameter is only used to define if the native color dialog is used or not. diff --git a/src/gui/dialogs/qcolordialog_symbian.cpp b/src/gui/dialogs/qcolordialog_symbian.cpp index 3f8036c..8f73f7c 100644 --- a/src/gui/dialogs/qcolordialog_symbian.cpp +++ b/src/gui/dialogs/qcolordialog_symbian.cpp @@ -79,7 +79,7 @@ QColor launchSymbianColorDialog(QColor initial) array->AppendL(KRgbGray); array->AppendL(KRgbWhite); - TRgb initialColour(initial.red(), initial.green(), initial.blue(), initial.alpha()); + TRgb initialColour(initial.red(), initial.green(), initial.blue(), initial.alpha()); TBool noneChosen = EFalse; // If true shows the default colour button CAknColourSelectionGrid* colourSelectionGrid = -- cgit v0.12 From 1689f5c557f686b7ad0ab68385402e928e590a13 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 23 Nov 2010 14:29:10 +0200 Subject: Use parent class function to generate Makefile headers in Symbian Qt Creator depends on some of the information generated into the makefile header by MakefileGenerator::writeHeader() function, so changed symmake*.cpp to use it instead of each having separate code for header generation. Task-number: QTBUG-15539 Reviewed-by: Janne Koskinen --- qmake/generators/symbian/symmake_abld.cpp | 11 +---------- qmake/generators/symbian/symmake_sbsv2.cpp | 12 ++---------- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/qmake/generators/symbian/symmake_abld.cpp b/qmake/generators/symbian/symmake_abld.cpp index cd64325..eb39d36 100644 --- a/qmake/generators/symbian/symmake_abld.cpp +++ b/qmake/generators/symbian/symmake_abld.cpp @@ -184,16 +184,7 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool QTextStream t(&wrapperFile); - t << "# ==============================================================================" << endl; - t << "# Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; - t << QDateTime::currentDateTime().toString() << endl; - t << "# This file is generated by qmake and should not be modified by the" << endl; - t << "# user." << endl; - t << "# Name : " << wrapperFile.fileName() << endl; - t << "# Description : Wrapper Makefile for calling Symbian build tools" << endl; - t << "#" << endl; - t << "# ==============================================================================" << "\n" << endl; - t << endl; + MakefileGenerator::writeHeader(t); t << "MAKEFILE = " << fileInfo(wrapperFile.fileName()).fileName() << endl; t << "QMAKE = " << var("QMAKE_QMAKE") << endl; diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp index f4a6132..c4b51f2 100644 --- a/qmake/generators/symbian/symmake_sbsv2.cpp +++ b/qmake/generators/symbian/symmake_sbsv2.cpp @@ -324,16 +324,8 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo QTextStream t(&wrapperFile); - t << "# ==============================================================================" << endl; - t << "# Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; - t << QDateTime::currentDateTime().toString() << endl; - t << "# This file is generated by qmake and should not be modified by the" << endl; - t << "# user." << endl; - t << "# Name : " << wrapperFile.fileName() << endl; - t << "# Description : Wrapper Makefile for calling Symbian build tools" << endl; - t << "#" << endl; - t << "# ==============================================================================" << "\n" << endl; - t << endl; + MakefileGenerator::writeHeader(t); + t << "MAKEFILE = " << fileInfo(wrapperFile.fileName()).fileName() << endl; t << "QMAKE = " << var("QMAKE_QMAKE") << endl; t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; -- cgit v0.12 From d13d0246352a5d6c26d28d2b8ff8313eb30f6299 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 24 Nov 2010 08:36:15 +0000 Subject: Fixed tst_qwidget::winIdChangeEvent During reparenting of a native widget, the winId is now first set to zero before being set to the new value. Reviewed-by: Jason Barron --- tests/auto/qwidget/tst_qwidget.cpp | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 09af941..5521873 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -4389,7 +4389,6 @@ class WinIdChangeWidget : public QWidget { public: WinIdChangeWidget(QWidget *p = 0) : QWidget(p) - , m_winIdChangeEventCount(0) { } @@ -4397,13 +4396,14 @@ protected: bool event(QEvent *e) { if (e->type() == QEvent::WinIdChange) { - ++m_winIdChangeEventCount; + m_winIdList.append(internalWinId()); return true; } return QWidget::event(e); } public: - int m_winIdChangeEventCount; + QList m_winIdList; + int winIdChangeEventCount() const { return m_winIdList.count(); } }; void tst_QWidget::winIdChangeEvent() @@ -4414,7 +4414,7 @@ void tst_QWidget::winIdChangeEvent() const WId winIdBefore = widget.internalWinId(); const WId winIdAfter = widget.winId(); QVERIFY(winIdBefore != winIdAfter); - QCOMPARE(widget.m_winIdChangeEventCount, 1); + QCOMPARE(widget.winIdChangeEventCount(), 1); } { @@ -4423,11 +4423,13 @@ void tst_QWidget::winIdChangeEvent() QWidget parent1, parent2; WinIdChangeWidget child(&parent1); const WId winIdBefore = child.winId(); - QCOMPARE(child.m_winIdChangeEventCount, 1); + QCOMPARE(child.winIdChangeEventCount(), 1); child.setParent(&parent2); const WId winIdAfter = child.internalWinId(); QVERIFY(winIdBefore != winIdAfter); - QCOMPARE(child.m_winIdChangeEventCount, 2); + QCOMPARE(child.winIdChangeEventCount(), 3); + // winId is set to zero during reparenting + QVERIFY(0 == child.m_winIdList[1]); } { @@ -4437,15 +4439,16 @@ void tst_QWidget::winIdChangeEvent() QWidget parent(&grandparent1); WinIdChangeWidget child(&parent); const WId winIdBefore = child.winId(); - QCOMPARE(child.m_winIdChangeEventCount, 1); + QCOMPARE(child.winIdChangeEventCount(), 1); parent.setParent(&grandparent2); const WId winIdAfter = child.internalWinId(); #ifdef Q_OS_SYMBIAN QVERIFY(winIdBefore != winIdAfter); - QCOMPARE(child.m_winIdChangeEventCount, 2); + QVERIFY(winIdAfter != 0); + QCOMPARE(child.winIdChangeEventCount(), 2); #else QCOMPARE(winIdBefore, winIdAfter); - QCOMPARE(child.m_winIdChangeEventCount, 1); + QCOMPARE(child.winIdChangeEventCount(), 1); #endif } @@ -4457,7 +4460,7 @@ void tst_QWidget::winIdChangeEvent() child.setParent(&parent2); const WId winIdAfter = child.internalWinId(); QCOMPARE(winIdBefore, winIdAfter); - QCOMPARE(child.m_winIdChangeEventCount, 0); + QCOMPARE(child.winIdChangeEventCount(), 0); } { @@ -4466,12 +4469,14 @@ void tst_QWidget::winIdChangeEvent() WinIdChangeWidget child(&parent); child.winId(); const WId winIdBefore = child.internalWinId(); - QCOMPARE(child.m_winIdChangeEventCount, 1); + QCOMPARE(child.winIdChangeEventCount(), 1); const Qt::WindowFlags flags = child.windowFlags(); child.setWindowFlags(flags | Qt::Window); const WId winIdAfter = child.internalWinId(); QVERIFY(winIdBefore != winIdAfter); - QCOMPARE(child.m_winIdChangeEventCount, 2); + QCOMPARE(child.winIdChangeEventCount(), 3); + // winId is set to zero during reparenting + QVERIFY(0 == child.m_winIdList[1]); } } -- cgit v0.12