diff options
380 files changed, 15646 insertions, 4477 deletions
diff --git a/bin/createpackage.pl b/bin/createpackage.pl index 984c1fd..2569a66 100755 --- a/bin/createpackage.pl +++ b/bin/createpackage.pl @@ -81,11 +81,14 @@ Where supported options are as follows: [-o|only-unsigned] = Creates only unsigned package. [-s|stub] = Generates stub sis for ROM. [-n|sisname <name>] = Specifies the final sis name. + [-g|gcce-is-armv5] = Convert gcce platform to armv5. Where parameters are as follows: templatepkg = Name of .pkg file template target = Either debug or release platform = One of the supported platform winscw | gcce | armv5 | armv6 | armv7 + Note that when packaging binaries built using gcce and symbian-sbsv2 + mkspec, armv5 must be used for platform instead of gcce. certificate = The certificate file used for signing key = The certificate's private key file passphrase = The passphrase of the certificate's private key file @@ -123,6 +126,7 @@ my $preserveUnsigned = ""; my $stub = ""; my $signed_sis_name = ""; my $onlyUnsigned = ""; +my $convertGcce = ""; unless (GetOptions('i|install' => \$install, 'p|preprocess' => \$preprocessonly, @@ -130,7 +134,8 @@ unless (GetOptions('i|install' => \$install, 'u|unsigned' => \$preserveUnsigned, 'o|only-unsigned' => \$onlyUnsigned, 's|stub' => \$stub, - 'n|sisname=s' => \$signed_sis_name,)) { + 'n|sisname=s' => \$signed_sis_name, + 'g|gcce-is-armv5' => \$convertGcce,)) { Usage(); } @@ -146,6 +151,16 @@ $target = $tmpvalues[0] or $target = ""; my $platform; $platform = $tmpvalues[1] or $platform = ""; +if ($platform =~ m/^gcce$/i) { + if (($convertGcce ne "")) { + $platform = "armv5"; + } elsif ($ENV{SBS_HOME}) { + # Print a informative note in case suspected misuse is detected. + print "\nNote: You should use armv5 as platform or specify -g parameter to convert platform\n"; + print " when packaging gcce binaries built using symbian-sbsv2 mkspec.\n\n"; + } +} + # Convert visual target to real target (debug->udeb and release->urel) $target =~ s/debug/udeb/i; $target =~ s/release/urel/i; diff --git a/bin/patch_capabilities.pl b/bin/patch_capabilities.pl index 7d6f5dc..0c0538c 100755 --- a/bin/patch_capabilities.pl +++ b/bin/patch_capabilities.pl @@ -54,7 +54,9 @@ sub Usage() { print("If no capabilities are given, the binaries will be given the\n"); print("capabilities supported by self-signed certificates.\n\n"); print(" *** NOTE: If *_template.pkg file is given and one is using symbian-abld or\n"); - print(" symbian-sbsv2 platform, 'target-platform' is REQUIRED. ***\n"); + print(" symbian-sbsv2 platform, 'target-platform' is REQUIRED. ***\n\n"); + print(" *** NOTE2: When patching gcce binaries built with symbian-sbsv2 toolchain,\n"); + print(" armv5 must be specified as platform.\n"); print("\nUsage: patch_capabilities.pl pkg_filename [target-platform [capability list]]\n"); print("\nE.g. patch_capabilities.pl myapp_template.pkg release-armv5 \"All -TCB\"\n"); exit(); @@ -104,6 +106,11 @@ if (@ARGV) # Convert visual target to real target (debug->udeb and release->urel) $target =~ s/debug/udeb/i; $target =~ s/release/urel/i; + + if (($platform =~ m/^gcce$/i) && ($ENV{SBS_HOME})) { + # Print a informative note in case suspected misuse is detected. + print "\nNote: You must use armv5 as platform when packaging gcce binaries built using symbian-sbsv2 mkspec.\n"; + } } # If the specified ".pkg" file exists (and can be read), @@ -852,7 +852,7 @@ foreach (@modules_to_sync) { " #if defined(__GNUC__)\n" . " #warning \"$warning_msg\"\n" . " #elif defined(_MSC_VER)\n" . - " #pragma message \"WARNING: $warning_msg\"\n" . + " #pragma message(\"WARNING: $warning_msg\")\n" . " #endif\n". "#endif\n\n"; } @@ -2328,7 +2328,7 @@ fi # detect build style if [ "$CFG_DEBUG" = "auto" ]; then - if [ "$PLATFORM_MAC" = "yes" ]; then + if [ "$PLATFORM_MAC" = "yes" -o "$XPLATFORM_MINGW" = "yes" ]; then CFG_DEBUG_RELEASE=yes CFG_DEBUG=yes elif [ "$CFG_DEV" = "yes" ]; then @@ -6682,7 +6682,11 @@ if [ "$PLATFORM_QWS" = "yes" ]; then QT_CONFIG="$QT_CONFIG embedded" rm -f "src/.moc/$QMAKE_OUTDIR/allmoc.cpp" # needs remaking if config changes fi -QMakeVar set PRECOMPILED_DIR ".pch/$QMAKE_OUTDIR" +if [ "$XPLATFORM_MINGW" != "yes" ]; then + # Do not set this here for Windows. Let qmake do it so + # debug and release precompiled headers are kept separate. + QMakeVar set PRECOMPILED_DIR ".pch/$QMAKE_OUTDIR" +fi QMakeVar set OBJECTS_DIR ".obj/$QMAKE_OUTDIR" QMakeVar set MOC_DIR ".moc/$QMAKE_OUTDIR" QMakeVar set RCC_DIR ".rcc/$QMAKE_OUTDIR" @@ -7163,7 +7167,8 @@ if [ "$CFG_WEBKIT" = "auto" ]; then fi if [ "$CFG_WEBKIT" = "yes" ]; then - QT_CONFIG="$QT_CONFIG webkit" + # This include takes care of adding "webkit" to QT_CONFIG. + cp -f "$relpath/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri" "$outpath/mkspecs/modules/qt_webkit_version.pri" # The reason we set CFG_WEBKIT, is such that the printed overview of what will be enabled, shows correctly. CFG_WEBKIT="yes" else @@ -7277,6 +7282,7 @@ fi # some compilers generate binary incompatible code between different versions, # so we need to generate a build key that is different between these compilers +COMPAT_COMPILER= case "$COMPILER" in g++*) # GNU C++ @@ -7310,6 +7316,22 @@ g++*) esac [ '!' -z "$COMPILER_VERSION" ] && COMPILER="g++-${COMPILER_VERSION}" ;; +icc*) + # The Intel CC compiler on Unix systems matches the ABI of the g++ + # that is found on PATH + COMPILER="icc" + COMPAT_COMPILER="g++-4" + case "`g++ -dumpversion` 2>/dev/null" in + 2.95.*) + COMPAT_COMPILER="g++-2.95.*" + ;; + 3.*) + COMPAT_COMPILER="g++-3.*" + ;; + *) + ;; + esac + ;; *) # ;; @@ -7452,9 +7474,20 @@ if [ "$QT_CROSS_COMPILE" = "no" ]; then QT_BUILD_KEY_COMPAT="$QT_BUILD_KEY_COMPAT $QT_NAMESPACE" fi fi + +# is this compiler compatible with some other "standard" build key +QT_BUILD_KEY_COMPAT_COMPILER= +if [ ! -z "$COMPAT_COMPILER" ]; then + QT_BUILD_KEY_COMPAT_COMPILER="$CFG_USER_BUILD_KEY $CFG_ARCH $TARGET_OPERATING_SYSTEM $COMPAT_COMPILER $BUILD_OPTIONS" + if [ -n "$QT_NAMESPACE" ]; then + QT_BUILD_KEY_COMPAT_COMPILER="$QT_BUILD_KEY_COMPAT_COMPILER $QT_NAMESPACE" + fi +fi + # strip out leading/trailing/extra whitespace QT_BUILD_KEY=`echo $QT_BUILD_KEY | sed -e "s, *, ,g" -e "s,^ *,," -e "s, *$,,"` QT_BUILD_KEY_COMPAT=`echo $QT_BUILD_KEY_COMPAT | sed -e "s, *, ,g" -e "s,^ *,," -e "s, *$,,"` +QT_BUILD_KEY_COMPAT_COMPILER=`echo $QT_BUILD_KEY_COMPAT_COMPILER | sed -e "s, *, ,g" -e "s,^ *,," -e "s, *$,,"` #------------------------------------------------------------------------------- # part of configuration information goes into qconfig.h @@ -7503,6 +7536,10 @@ if [ -n "$QT_BUILD_KEY_COMPAT" ]; then echo "#define QT_BUILD_KEY_COMPAT \"$QT_BUILD_KEY_COMPAT\"" \ >> "$outpath/src/corelib/global/qconfig.h.new" fi +if [ -n "$QT_BUILD_KEY_COMPAT_COMPILER" ]; then + echo "#define QT_BUILD_KEY_COMPAT2 \"$QT_BUILD_KEY_COMPAT_COMPILER\"" \ + >> "$outpath/src/corelib/global/qconfig.h.new" +fi echo "" >>"$outpath/src/corelib/global/qconfig.h.new" echo "#ifdef QT_BOOTSTRAPPED" >>"$outpath/src/corelib/global/qconfig.h.new" diff --git a/configure.exe b/configure.exe Binary files differindex c5bff85..982e038 100755 --- a/configure.exe +++ b/configure.exe diff --git a/demos/browser/downloadmanager.cpp b/demos/browser/downloadmanager.cpp index 876ec1d..ab68209 100644 --- a/demos/browser/downloadmanager.cpp +++ b/demos/browser/downloadmanager.cpp @@ -282,7 +282,7 @@ void DownloadItem::updateInfoLabel() remaining = tr("- %4 %5 remaining") .arg(timeRemaining) .arg(timeRemainingString); - info = QString(tr("%1 of %2 (%3/sec) %4")) + info = tr("%1 of %2 (%3/sec) %4") .arg(dataString(m_bytesReceived)) .arg(bytesTotal == 0 ? tr("?") : dataString(bytesTotal)) .arg(dataString((int)speed)) diff --git a/demos/declarative/snake/content/Cookie.qml b/demos/declarative/snake/content/Cookie.qml index e67a7af..eb57fd2 100644 --- a/demos/declarative/snake/content/Cookie.qml +++ b/demos/declarative/snake/content/Cookie.qml @@ -59,7 +59,6 @@ Item { anchors.fill: parent source: "pics/cookie.png" opacity: 0 - Behavior on opacity { NumberAnimation { duration: 100 } } Text { font.bold: true anchors.verticalCenter: parent.verticalCenter @@ -87,4 +86,9 @@ Item { PropertyChanges { target: img; opacity: 0 } } ] + transitions: [ + Transition { + NumberAnimation { target: img; property: "opacity"; duration: 100 } + } + ] } diff --git a/demos/declarative/snake/content/Link.qml b/demos/declarative/snake/content/Link.qml index 9aa6006..942008d 100644 --- a/demos/declarative/snake/content/Link.qml +++ b/demos/declarative/snake/content/Link.qml @@ -86,7 +86,6 @@ Item { id:link } opacity: 0 - Behavior on opacity { NumberAnimation { duration: 200 } } } @@ -114,4 +113,11 @@ Item { id:link PropertyChanges { target: img; opacity: 0 } } ] + + transitions: [ + Transition { + NumberAnimation { target: img; property: "opacity"; duration: 200 } + } + ] + } diff --git a/demos/declarative/snake/content/snake.js b/demos/declarative/snake/content/snake.js index fab7834..c2e9d3a 100644 --- a/demos/declarative/snake/content/snake.js +++ b/demos/declarative/snake/content/snake.js @@ -35,7 +35,7 @@ function startNewGame() if (heartbeat.running) { endGame(); startNewGameTimer.running = true; - state = "starting"; + state = ""; return; } diff --git a/demos/declarative/snake/snake.qml b/demos/declarative/snake/snake.qml index 12ad71c..4d989df 100644 --- a/demos/declarative/snake/snake.qml +++ b/demos/declarative/snake/snake.qml @@ -106,7 +106,6 @@ Rectangle { anchors.fill: parent anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter - Behavior on opacity { NumberAnimation { duration: 500 } } Text { color: "white" @@ -236,7 +235,10 @@ Rectangle { from: "*" to: "starting" NumberAnimation { target: progressIndicator; property: "width"; duration: 1000 } - + NumberAnimation { target: title; property: "opacity"; duration: 500 } + }, + Transition { + NumberAnimation { target: title; property: "opacity"; duration: 500 } } ] diff --git a/demos/declarative/twitter/TwitterCore/AuthView.qml b/demos/declarative/twitter/TwitterCore/AuthView.qml deleted file mode 100644 index 0d05deb..0000000 --- a/demos/declarative/twitter/TwitterCore/AuthView.qml +++ /dev/null @@ -1,146 +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 QtDeclarative 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$ -** -****************************************************************************/ - -import Qt 4.7 - -Item { - id: wrapper - Column { - anchors.centerIn: parent - spacing: 20 - Column{ - spacing: 4 - Text { - text: "Screen name:" - font.pixelSize: 16; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" - horizontalAlignment: Qt.AlignRight - } - Item { - width: 220 - height: 28 - BorderImage { source: "images/lineedit.sci"; anchors.fill: parent } - TextInput{ - id: nameIn - width: parent.width - 8 - anchors.centerIn: parent - maximumLength:21 - font.pixelSize: 16; - font.bold: true - color: "#151515"; selectionColor: "green" - KeyNavigation.tab: passIn - KeyNavigation.backtab: guest - focus: true - } - } - } - Column{ - spacing: 4 - Text { - text: "Password:" - font.pixelSize: 16; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" - horizontalAlignment: Qt.AlignRight - } - Item { - width: 220 - height: 28 - BorderImage { source: "images/lineedit.sci"; anchors.fill: parent } - TextInput{ - id: passIn - width: parent.width - 8 - anchors.centerIn: parent - maximumLength:21 - echoMode: TextInput.Password - font.pixelSize: 16; - font.bold: true - color: "#151515"; selectionColor: "green" - KeyNavigation.tab: login - KeyNavigation.backtab: nameIn - onAccepted: login.doLogin(); - } - } - } - Row{ - spacing: 10 - Button { - width: 100 - height: 32 - id: login - keyUsing: true; - function doLogin(){ - rssModel.authName=nameIn.text; - rssModel.authPass=passIn.text; - rssModel.tags='my timeline'; - screen.focus = true; - } - text: "Log in" - KeyNavigation.right: guest - KeyNavigation.tab: guest - KeyNavigation.backtab: passIn - Keys.onReturnPressed: login.doLogin(); - Keys.onEnterPressed: login.doLogin(); - Keys.onSelectPressed: login.doLogin(); - Keys.onSpacePressed: login.doLogin(); - onClicked: login.doLogin(); - } - Button { - width: 100 - height: 32 - id: guest - keyUsing: true; - function doGuest() - { - rssModel.authName='-'; - screen.focus = true; - screen.setMode(true); - } - text: "Guest" - KeyNavigation.left: login - KeyNavigation.tab: nameIn - KeyNavigation.backtab: login - Keys.onReturnPressed: guest.doGuest(); - Keys.onEnterPressed: guest.doGuest(); - Keys.onSelectPressed: guest.doGuest(); - Keys.onSpacePressed: guest.doGuest(); - onClicked: guest.doGuest(); - } - } - } -} diff --git a/demos/declarative/twitter/TwitterCore/Button.qml b/demos/declarative/twitter/TwitterCore/Button.qml index d326c64..437b013 100644 --- a/demos/declarative/twitter/TwitterCore/Button.qml +++ b/demos/declarative/twitter/TwitterCore/Button.qml @@ -67,7 +67,7 @@ Item { } Text { id: btnText - color: if(container.keyUsing){"#DDDDDD";} else {"#FFFFFF";} + color: if(container.keyUsing){"#D0D0D0";} else {"#FFFFFF";} anchors.centerIn: buttonImage; font.bold: true text: container.text; style: Text.Raised; styleColor: "black" font.pixelSize: 12 diff --git a/demos/declarative/twitter/TwitterCore/FatDelegate.qml b/demos/declarative/twitter/TwitterCore/FatDelegate.qml index ff03b0b..27dd300 100644 --- a/demos/declarative/twitter/TwitterCore/FatDelegate.qml +++ b/demos/declarative/twitter/TwitterCore/FatDelegate.qml @@ -44,11 +44,10 @@ import Qt 4.7 Component { id: listDelegate Item { - id: wrapper; width: wrapper.ListView.view.width; height: if(txt.height > 58){txt.height+8}else{58}//50+4+4 + id: wrapper; width: wrapper.ListView.view.width; height: if(txt.height > 60){txt.height+10}else{60} //50+5+5 function handleLink(link){ if(link.slice(0,3) == 'app'){ screen.setUser(link.slice(7)); - screen.setMode(true); }else if(link.slice(0,4) == 'http'){ Qt.openUrlExternally(link); } @@ -58,26 +57,47 @@ Component { var ret2 = ret.replace(/http:\/\/[^ \n\t]+/g, '<a href="$&">$&</a>');//surrounds http links with html link tags return ret2; } + + // Strip away paranthesis + function userName(str) { + var user = str.replace(/\([\S|\s]*\)/gi, ""); + return user.trim(); + } + Item { id: moveMe; height: parent.height Rectangle { id: blackRect color: "black"; opacity: wrapper.ListView.index % 2 ? 0.2 : 0.3; height: wrapper.height-2; width: wrapper.width; y: 1 } - Rectangle { - id: whiteRect; x: 6; width: 50; height: 50; color: "white"; smooth: true + Item { + id: image; x: 6; width: 48; height: 48; smooth: true anchors.verticalCenter: parent.verticalCenter Loading { x: 1; y: 1; width: 48; height: 48; visible: realImage.status != Image.Ready } - Image { id: realImage; source: userImage; x: 1; y: 1; width:48; height:48 } + Image { + id: realImage; + source: userImage; x: 1; y: 1; + width:48; height:48; opacity:0 ; + onStatusChanged: { + if(status==Image.Ready) + image.state="loaded" + } + } + states: State { + name: "loaded"; + PropertyChanges { target: realImage ; opacity:1 } + } + transitions: Transition { NumberAnimation { target: realImage; property: "opacity"; duration: 200 } } + } Text { id:txt; y:4; x: 56 text: '<html><style type="text/css">a:link {color:"#aaccaa"}; a:visited {color:"#336633"}</style>' - + '<a href="app://@'+userScreenName+'"><b>'+userScreenName + "</b></a> from " +source - + "<br /><b>" + wrapper.addTags(statusText) + "</b></html>"; + + '<a href="app://@'+userName(name)+'"><b>'+userName(name) + "</b></a> from " +source + + "<br /><b>" + statusText + "</b></html>"; textFormat: Qt.RichText color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrapMode: Text.WordWrap - anchors.left: whiteRect.right; anchors.right: blackRect.right; anchors.leftMargin: 6; anchors.rightMargin: 6 + anchors.left: image.right; anchors.right: blackRect.right; anchors.leftMargin: 6; anchors.rightMargin: 6 onLinkActivated: wrapper.handleLink(link) } } diff --git a/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml b/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml deleted file mode 100644 index 56f31b1..0000000 --- a/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml +++ /dev/null @@ -1,161 +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 QtDeclarative 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$ -** -****************************************************************************/ - -import Qt 4.7 - -Item { - id: titleBar - - signal update() - onYChanged: state="" //When switching titlebars - - BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 } - Item { - id: container - width: (parent.width * 2) - 55 ; height: parent.height - - function accept() { - if(rssModel.authName == '' || rssModel.authPass == '') - return false;//Can't login like that - - var postData = "status=" + editor.text; - var postman = new XMLHttpRequest(); - postman.open("POST", "http://twitter.com/statuses/update.xml", true, rssModel.authName, rssModel.authPass); - postman.onreadystatechange = function() { - if (postman.readyState == postman.DONE) { - titleBar.update(); - } - } - postman.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); - postman.send(postData); - - editor.text = "" - titleBar.state = "" - } - - Rectangle { - x: 6; width: 50; height: 50; color: "white"; smooth: true - anchors.verticalCenter: parent.verticalCenter - - UserModel { user: rssModel.authName; id: userModel } - Component { id: imgDelegate; - Item { - Loading { width:48; height:48; visible: realImage.status != Image.Ready } - Image { source: image; width:48; height:48; id: realImage } - } - } - ListView { model: userModel.model; x:1; y:1; delegate: imgDelegate } - } - - Text { - id: categoryText - anchors.left: parent.left; anchors.right: tagButton.left - anchors.leftMargin: 58; anchors.rightMargin: 10 - anchors.verticalCenter: parent.verticalCenter - elide: Text.ElideLeft - text: "Timeline for " + rssModel.authName - font.pixelSize: 12; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" - } - - Button { - id: tagButton; x: titleBar.width - 90; width: 85; height: 32; text: "New Post..." - anchors.verticalCenter: parent.verticalCenter; - onClicked: if (titleBar.state == "Posting") container.accept(); else titleBar.state = "Posting" - } - - Text { - id: charsLeftText; anchors.horizontalCenter: tagButton.horizontalCenter; - anchors.top: tagButton.bottom; anchors.topMargin: 2 - text: {140 - editor.text.length;} visible: titleBar.state == "Posting" - font.pointSize: 10; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" - } - Item { - id: txtEdit; - anchors.left: tagButton.right; anchors.leftMargin: 5; y: 4 - anchors.right: parent.right; anchors.rightMargin: 40; height: parent.height - 9 - BorderImage { source: "images/lineedit.sci"; anchors.fill: parent } - - Binding {//TODO: Can this be a function, which also resets the cursor? And flashes? - when: editor.text.length > 140 - target: editor - property: "text" - value: editor.text.slice(0,140) - } - TextEdit { - id: editor - anchors.left: parent.left; - anchors.leftMargin: 8; - anchors.bottom: parent.bottom - anchors.bottomMargin: 4; - cursorVisible: true; font.bold: true - width: parent.width - 12 - height: parent.height - 8 - font.pixelSize: 12 - wrapMode: TextEdit.Wrap - color: "#151515"; selectionColor: "green" - } - Keys.forwardTo: [(returnKey), (editor)] - Item { - id: returnKey - Keys.onReturnPressed: container.accept() - Keys.onEnterPressed: container.accept() - Keys.onEscapePressed: titleBar.state = "" - } - } - } - states: [ - State { - name: "Posting" - PropertyChanges { target: container; x: -tagButton.x + 5 } - PropertyChanges { target: titleBar; height: 80 } - PropertyChanges { target: tagButton; text: "OK" } - PropertyChanges { target: tagButton; width: 28 } - PropertyChanges { target: tagButton; height: 24 } - PropertyChanges { target: editor; focus: true } - } - ] - transitions: [ - Transition { - from: "*"; to: "*" - NumberAnimation { properties: "x,y,width,height"; easing.type: Easing.InOutQuad } - } - ] -} diff --git a/demos/declarative/twitter/TwitterCore/Input.qml b/demos/declarative/twitter/TwitterCore/Input.qml new file mode 100644 index 0000000..a33a995 --- /dev/null +++ b/demos/declarative/twitter/TwitterCore/Input.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** 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 QtDeclarative 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$ +** +****************************************************************************/ + +import Qt 4.7 + +FocusScope { + id:container + width: 220 + height: 28 + BorderImage { source: "images/lineedit.sci"; anchors.fill: parent } + signal accepted + property alias text: input.text + property alias item:input + TextInput{ + id: input + width: parent.width - 12 + anchors.centerIn: parent + maximumLength:21 + font.pixelSize: 16; + font.bold: true + color: "#151515"; selectionColor: "mediumseagreen" + focus: true + onAccepted:{container.accepted()} + text: "" + selectByMouse: true + } +} diff --git a/demos/declarative/twitter/TwitterCore/MultiTitleBar.qml b/demos/declarative/twitter/TwitterCore/MultiTitleBar.qml index 38d6c9c..29b7713 100644 --- a/demos/declarative/twitter/TwitterCore/MultiTitleBar.qml +++ b/demos/declarative/twitter/TwitterCore/MultiTitleBar.qml @@ -42,10 +42,6 @@ import Qt 4.7 Item { - height: homeBar.height - HomeTitleBar { id: homeBar; width: parent.width; height: 60; - onUpdate: rssModel.reload() - } TitleBar { id: titleBar; width: parent.width; height: 60; y: -80 untaggedString: "Latest tweets from everyone" @@ -53,9 +49,8 @@ Item { } states: [ State { - name: "search"; when: screen.userView + name: "search"; when: screen.state!="search" PropertyChanges { target: titleBar; y: 0 } - PropertyChanges { target: homeBar; y: -80 } } ] transitions: [ diff --git a/demos/declarative/twitter/TwitterCore/RssModel.qml b/demos/declarative/twitter/TwitterCore/RssModel.qml index bd73200..d03cdb3 100644 --- a/demos/declarative/twitter/TwitterCore/RssModel.qml +++ b/demos/declarative/twitter/TwitterCore/RssModel.qml @@ -43,43 +43,34 @@ import Qt 4.7 Item { id: wrapper property variant model: xmlModel - property string tags : "" - property string authName : "" - property string authPass : "" + property string from : "" + property string to : "" + property string phrase : "" + property string mode : "everyone" property int status: xmlModel.status function reload() { xmlModel.reload(); } -XmlListModel { - id: xmlModel + XmlListModel { + id: xmlModel - source:{ - if (wrapper.authName == ""){ - ""; //Avoid worthless calls to twitter servers - }else if(wrapper.mode == 'user'){ - "https://"+ ((wrapper.authName!="" && wrapper.authPass!="")? (wrapper.authName+":"+wrapper.authPass+"@") : "" )+"twitter.com/statuses/user_timeline.xml?screen_name="+wrapper.tags; - }else if(wrapper.mode == 'self'){ - "https://"+ ((wrapper.authName!="" && wrapper.authPass!="")? (wrapper.authName+":"+wrapper.authPass+"@") : "" )+"twitter.com/statuses/friends_timeline.xml"; - }else{//everyone/public - "http://twitter.com/statuses/public_timeline.xml"; - } - } - query: "/statuses/status" + source: (from=="" && to=="" && phrase=="") ? "" : + 'http://search.twitter.com/search.atom?from='+from+"&to="+to+"&phrase="+phrase - XmlRole { name: "statusText"; query: "text/string()" } - XmlRole { name: "timestamp"; query: "created_at/string()" } - XmlRole { name: "source"; query: "source/string()" } - XmlRole { name: "userName"; query: "user/name/string()" } - XmlRole { name: "userScreenName"; query: "user/screen_name/string()" } - XmlRole { name: "userImage"; query: "user/profile_image_url/string()" } - XmlRole { name: "userLocation"; query: "user/location/string()" } - XmlRole { name: "userDescription"; query: "user/description/string()" } - XmlRole { name: "userFollowers"; query: "user/followers_count/string()" } - XmlRole { name: "userStatuses"; query: "user/statuses_count/string()" } - //TODO: Could also get the user's color scheme, timezone and a few other things -} -Binding { - property: "mode" - target: wrapper - value: {if(wrapper.tags==''){"everyone";}else if(wrapper.tags=='my timeline'){"self";}else{"user";}} -} + namespaceDeclarations: "declare default element namespace 'http://www.w3.org/2005/Atom'; " + + "declare namespace twitter=\"http://api.twitter.com/\";"; + + query: "/feed/entry" + + XmlRole { name: "statusText"; query: "content/string()" } + XmlRole { name: "timestamp"; query: "published/string()" } + XmlRole { name: "source"; query: "twitter:source/string()" } + XmlRole { name: "name"; query: "author/name/string()" } + XmlRole { name: "userImage"; query: "link[@rel = 'image']/@href/string()" } + + } + Binding { + property: "mode" + target: wrapper + value: {if(wrapper.tags==''){"everyone";}else if(wrapper.tags=='my timeline'){"self";}else{"user";}} + } } diff --git a/demos/declarative/twitter/TwitterCore/SearchView.qml b/demos/declarative/twitter/TwitterCore/SearchView.qml new file mode 100644 index 0000000..22df374 --- /dev/null +++ b/demos/declarative/twitter/TwitterCore/SearchView.qml @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** 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 QtDeclarative 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$ +** +****************************************************************************/ + +import Qt 4.7 + +FocusScope { + id: wrapper + Column { + anchors.centerIn: parent + spacing: 20 + Column{ + spacing: 4 + Text { + text: "Posted by:" + font.pixelSize: 16; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" + horizontalAlignment: Qt.AlignRight + } + Input{ + id: fromIn + KeyNavigation.backtab: searchbutton + KeyNavigation.tab:toIn + onAccepted:searchbutton.doSearch(); + focus: true + } + Text { + text: "In reply to:" + font.pixelSize: 16; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" + horizontalAlignment: Qt.AlignRight + } + Input{ + id: toIn + KeyNavigation.backtab: fromIn + KeyNavigation.tab:phraseIn + onAccepted:searchbutton.doSearch(); + } + Text { + text: "Search phrase:" + font.pixelSize: 16; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" + horizontalAlignment: Qt.AlignRight + } + Input{ + id: phraseIn + KeyNavigation.backtab: toIn + KeyNavigation.tab:searchbutton + onAccepted:searchbutton.doSearch(); + text: "Qt Quick" + } + } + Button { + width: 100 + height: 32 + id: searchbutton + keyUsing: true; + opacity: 1 + text: "Search" + KeyNavigation.tab: fromIn + Keys.onReturnPressed: searchbutton.doSearch(); + Keys.onEnterPressed: searchbutton.doSearch(); + Keys.onSelectPressed: searchbutton.doSearch(); + Keys.onSpacePressed: searchbutton.doSearch(); + onClicked: searchbutton.doSearch(); + + function doSearch() { + // Search ! allowed + if (wrapper.state=="invalidinput") + return; + + rssModel.from=fromIn.text; + rssModel.to= toIn.text; + rssModel.phrase = phraseIn.text; + screen.focus = true; + screen.state = "" + } + } + } + states: + State { + name: "invalidinput" + when: fromIn.text=="" && toIn.text=="" && phraseIn.text=="" + PropertyChanges { target: searchbutton ; opacity: 0.6 ; } + } + transitions: + Transition { + NumberAnimation { target: searchbutton; property: "opacity"; duration: 200 } + } +} diff --git a/demos/declarative/twitter/TwitterCore/TitleBar.qml b/demos/declarative/twitter/TwitterCore/TitleBar.qml index 479aa20..145c189 100644 --- a/demos/declarative/twitter/TwitterCore/TitleBar.qml +++ b/demos/declarative/twitter/TwitterCore/TitleBar.qml @@ -58,66 +58,58 @@ Item { rssModel.tags = editor.text } - Image { - id: quitButton - x: 5 + Item { + id:imageBox + x: 6; width: 0; height: 50; smooth: true anchors.verticalCenter: parent.verticalCenter - source: "images/quit.png" - MouseArea { - anchors.fill: parent - onClicked: Qt.quit() + + UserModel { user: rssModel.from; id: userModel } + Component { + id: imgDelegate; + Item { + id:imageitem + visible:true + Loading { width:48; height:48; visible: realImage.status != Image.Ready } + Image { id: realImage; source: image; width:48; height:48; opacity:0; } + states: + State { + name: "loaded" + when: (realImage.status == Image.Ready) + PropertyChanges { target: realImage; opacity:1 } + } + transitions: Transition { + NumberAnimation { target: realImage; property: "opacity"; duration: 200 } + } + } + } + ListView { id:view; model: userModel.model; x:1; y:1; delegate: imgDelegate } + states: + State { + when: !userModel.user=="" + PropertyChanges { target: imageBox; width: 50; } + } + transitions: + Transition { + NumberAnimation { target: imageBox; property: "width"; duration: 200 } } - } + } + Text { id: categoryText anchors { - left: quitButton.right; right: tagButton.left; leftMargin: 5; rightMargin: 10 + left: imageBox.right; right: parent.right; leftMargin: 10; rightMargin: 10 verticalCenter: parent.verticalCenter } elide: Text.ElideLeft - text: (rssModel.tags=="" ? untaggedString : taggedString + rssModel.tags) + text: (rssModel.from=="" ? untaggedString : taggedString + rssModel.from) font.bold: true; color: "White"; style: Text.Raised; styleColor: "Black" font.pixelSize: 12 } - - Button { - id: tagButton; x: titleBar.width - 50; width: 45; height: 32; text: "..." - onClicked: if (titleBar.state == "Tags") container.accept(); else titleBar.state = "Tags" - anchors.verticalCenter: parent.verticalCenter - } - - Item { - id: lineEdit - y: 4; height: parent.height - 9 - anchors { left: tagButton.right; leftMargin: 5; right: parent.right; rightMargin: 5 } - - BorderImage { source: "images/lineedit.sci"; anchors.fill: parent } - - TextInput { - id: editor - anchors { - left: parent.left; right: parent.right; leftMargin: 10; rightMargin: 10 - verticalCenter: parent.verticalCenter - } - cursorVisible: true; font.bold: true - color: "#151515"; selectionColor: "Green" - } - - Keys.forwardTo: [ (returnKey), (editor)] - - Item { - id: returnKey - Keys.onReturnPressed: container.accept() - Keys.onEnterPressed: container.accept() - Keys.onEscapePressed: titleBar.state = "" - } - } } states: State { name: "Tags" PropertyChanges { target: container; x: -tagButton.x + 5 } - PropertyChanges { target: tagButton; text: "OK" } PropertyChanges { target: editor; focus: true } } diff --git a/demos/declarative/twitter/TwitterCore/ToolBar.qml b/demos/declarative/twitter/TwitterCore/ToolBar.qml index b9cb915..e18f5c6 100644 --- a/demos/declarative/twitter/TwitterCore/ToolBar.qml +++ b/demos/declarative/twitter/TwitterCore/ToolBar.qml @@ -48,15 +48,14 @@ Item { property alias button2Label: button2.text signal button1Clicked signal button2Clicked - + focus:true BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 } - Button { id: button1 anchors.left: parent.left; anchors.leftMargin: 5; y: 3; width: 140; height: 32 onClicked: toolbar.button1Clicked() + focus:true } - Button { id: button2 anchors.right: parent.right; anchors.rightMargin: 5; y: 3; width: 140; height: 32 diff --git a/demos/declarative/twitter/TwitterCore/UserModel.qml b/demos/declarative/twitter/TwitterCore/UserModel.qml index e653836..d8ca804 100644 --- a/demos/declarative/twitter/TwitterCore/UserModel.qml +++ b/demos/declarative/twitter/TwitterCore/UserModel.qml @@ -42,26 +42,24 @@ import Qt 4.7 //This "model" gets the user information about the searched user. Mainly for the icon. -//Copied from RssModel Item { id: wrapper property variant model: xmlModel property string user : "" property int status: xmlModel.status function reload() { xmlModel.reload(); } -XmlListModel { - id: xmlModel + XmlListModel { + id: xmlModel - source: {if(user!="") {"http://twitter.com/users/show.xml?screen_name="+user;}else{"";}} - query: "/user" + source: user!= "" ? "http://twitter.com/users/show.xml?screen_name="+user : "" + query: "/user" - XmlRole { name: "name"; query: "name/string()" } - XmlRole { name: "screenName"; query: "screen_name/string()" } - XmlRole { name: "image"; query: "profile_image_url/string()" } - XmlRole { name: "location"; query: "location/string()" } - XmlRole { name: "description"; query: "description/string()" } - XmlRole { name: "followers"; query: "followers_count/string()" } - //XmlRole { name: "protected"; query: "protected/bool()" } - //TODO: Could also get the user's color scheme, timezone and a few other things -} + XmlRole { name: "name"; query: "name/string()" } + XmlRole { name: "screenName"; query: "screen_name/string()" } + XmlRole { name: "image"; query: "profile_image_url/string()" } + XmlRole { name: "location"; query: "location/string()" } + XmlRole { name: "description"; query: "description/string()" } + XmlRole { name: "followers"; query: "followers_count/string()" } + //TODO: Could also get the user's color scheme, timezone and a few other things + } } diff --git a/demos/declarative/twitter/TwitterCore/qmldir b/demos/declarative/twitter/TwitterCore/qmldir index 8b56c56..84d85c2 100644 --- a/demos/declarative/twitter/TwitterCore/qmldir +++ b/demos/declarative/twitter/TwitterCore/qmldir @@ -1,7 +1,7 @@ -AuthView 1.0 AuthView.qml +SearchView 1.0 SearchView.qml Button 1.0 Button.qml +Input 1.0 Input.qml FatDelegate 1.0 FatDelegate.qml -HomeTitleBar 1.0 HomeTitleBar.qml Loading 1.0 Loading.qml MultiTitleBar 1.0 MultiTitleBar.qml TitleBar 1.0 TitleBar.qml diff --git a/demos/declarative/twitter/twitter.qml b/demos/declarative/twitter/twitter.qml index 08cecb0..6d224a2 100644 --- a/demos/declarative/twitter/twitter.qml +++ b/demos/declarative/twitter/twitter.qml @@ -46,28 +46,18 @@ Item { id: screen; width: 320; height: 480 property bool userView : false property variant tmpStr - function setMode(m){ - screen.userView = m; - if(m == false){ - rssModel.tags='my timeline'; - rssModel.reload(); - toolBar.button2Label = "View others"; - } else { - toolBar.button2Label = "Return home"; - } - } function setUser(str){hack.running = true; tmpStr = str} - function reallySetUser(){rssModel.tags = tmpStr;} - + function reallySetUser(){rssModel.from = tmpStr;rssModel.to = ""; rssModel.phrase = ""} + state:"searchquery" //Workaround for bug 260266 Timer{ interval: 1; running: false; repeat: false; onTriggered: screen.reallySetUser(); id:hack } - - //TODO: better way to return to the auth screen - Keys.onEscapePressed: rssModel.authName='' + Keys.onEscapePressed: screen.state="searchquery" + Keys.onBacktabPressed: screen.state="searchquery" Rectangle { id: background anchors.fill: parent; color: "#343434"; + state:"searchquery" Image { source: "TwitterCore/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 0.3 } MouseArea { @@ -90,8 +80,16 @@ Item { y:60 //Below the title bars height: 380 - Twitter.AuthView{ - id: authView + Text { + id:title + text: "Search Twitter" + anchors.horizontalCenter: parent.horizontalCenter + font.pixelSize: 20; font.bold: true; color: "#bbb"; style: Text.Raised; styleColor: "black" + opacity:0 + } + + Twitter.SearchView{ + id: searchView anchors.verticalCenter: parent.verticalCenter width: parent.width; height: parent.height-60; x: -(screen.width * 1.5) @@ -110,31 +108,27 @@ Item { //TODO: Use anchor changes instead of hard coding y: screen.height - 40 width: parent.width; opacity: 0.9 - button1Label: "Update" - button2Label: "View others" - onButton1Clicked: rssModel.reload(); - onButton2Clicked: + button1Label: "New Search" + button2Label: "Update" + onButton1Clicked: { - if(screen.userView == true){ - screen.setMode(false); - }else{ - rssModel.tags=''; - screen.setMode(true); - } + screen.state="searchquery" } + onButton2Clicked: rssModel.reload(); } - - states: [ - State { - name: "unauthed"; when: rssModel.authName=="" - PropertyChanges { target: authView; x: 0 } - PropertyChanges { target: mainView; x: -(parent.width * 1.5) } - PropertyChanges { target: titleBar; y: -80 } - PropertyChanges { target: toolBar; y: screen.height } - } - ] - transitions: [ - Transition { NumberAnimation { properties: "x,y"; duration: 500; easing.type: Easing.InOutQuad } } - ] } + states: [ + State { + name: "searchquery"; + PropertyChanges { target: searchView; x: 0; focus:true} + PropertyChanges { target: mainView; x: -(parent.width * 1.5) } + PropertyChanges { target: titleBar; y: -80 } + PropertyChanges { target: toolBar; y: screen.height } + PropertyChanges { target: toolBar } + PropertyChanges { target: title; opacity:1} + } + ] + transitions: [ + Transition { NumberAnimation { properties: "x,y,opacity"; duration: 500; easing.type: Easing.InOutQuad } } + ] } diff --git a/demos/embedded/anomaly/src/AddressBar.cpp b/demos/embedded/anomaly/src/AddressBar.cpp index 12523f2..f83876e 100644 --- a/demos/embedded/anomaly/src/AddressBar.cpp +++ b/demos/embedded/anomaly/src/AddressBar.cpp @@ -44,27 +44,11 @@ #include <QtCore> #include <QtGui> -class LineEdit: public QLineEdit -{ -public: - LineEdit(QWidget *parent = 0): QLineEdit(parent) {} - - void paintEvent(QPaintEvent *event) { - QLineEdit::paintEvent(event); - if (text().isEmpty()) { - QPainter p(this); - int flags = Qt::AlignLeft | Qt::AlignVCenter; - p.setPen(palette().color(QPalette::Disabled, QPalette::Text)); - p.drawText(rect().adjusted(10, 0, 0, 0), flags, "Enter address or search terms"); - p.end(); - } - } -}; - AddressBar::AddressBar(QWidget *parent) : QWidget(parent) { - m_lineEdit = new LineEdit(parent); + m_lineEdit = new QLineEdit(parent); + m_lineEdit->setPlaceholderText("Enter address or search terms"); connect(m_lineEdit, SIGNAL(returnPressed()), SLOT(processAddress())); m_toolButton = new QToolButton(parent); m_toolButton->setText("Go"); diff --git a/demos/embedded/qmlcalculator/qmlcalculator.cpp b/demos/embedded/qmlcalculator/qmlcalculator.cpp index 3030e81..6c41e61 100644 --- a/demos/embedded/qmlcalculator/qmlcalculator.cpp +++ b/demos/embedded/qmlcalculator/qmlcalculator.cpp @@ -42,6 +42,7 @@ #include <QtCore/QFileInfo> #include <QtGui/QApplication> #include <QtDeclarative/QDeclarativeView> +#include <QtDeclarative/QDeclarativeEngine> #if defined(Q_OS_SYMBIAN) #include <eikenv.h> @@ -58,7 +59,8 @@ int main(int argc, char *argv[]) QDeclarativeView view; view.setSource(QUrl(mainQmlApp)); view.setResizeMode(QDeclarativeView::SizeRootObjectToView); - + QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); + #if defined(QT_KEYPAD_NAVIGATION) QApplication::setNavigationMode(Qt::NavigationModeCursorAuto); #endif // QT_KEYPAD_NAVIGATION diff --git a/demos/embedded/qmlclocks/qmlclocks.cpp b/demos/embedded/qmlclocks/qmlclocks.cpp index d94cbdd..a09801b 100644 --- a/demos/embedded/qmlclocks/qmlclocks.cpp +++ b/demos/embedded/qmlclocks/qmlclocks.cpp @@ -42,6 +42,7 @@ #include <QtCore/QFileInfo> #include <QtGui/QApplication> #include <QtDeclarative/QDeclarativeView> +#include <QtDeclarative/QDeclarativeEngine> #if defined(Q_OS_SYMBIAN) #include <eikenv.h> @@ -58,6 +59,7 @@ int main(int argc, char *argv[]) QDeclarativeView view; view.setSource(QUrl(mainQmlApp)); view.setResizeMode(QDeclarativeView::SizeRootObjectToView); + QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); #if defined(QT_KEYPAD_NAVIGATION) QApplication::setNavigationMode(Qt::NavigationModeCursorAuto); diff --git a/demos/embedded/qmldialcontrol/qmldialcontrol.cpp b/demos/embedded/qmldialcontrol/qmldialcontrol.cpp index 311cee0..56b21d7 100644 --- a/demos/embedded/qmldialcontrol/qmldialcontrol.cpp +++ b/demos/embedded/qmldialcontrol/qmldialcontrol.cpp @@ -42,6 +42,7 @@ #include <QtCore/QFileInfo> #include <QtGui/QApplication> #include <QtDeclarative/QDeclarativeView> +#include <QtDeclarative/QDeclarativeEngine> int main(int argc, char *argv[]) { @@ -51,6 +52,7 @@ int main(int argc, char *argv[]) QDeclarativeView view; view.setSource(QUrl(mainQmlApp)); view.setResizeMode(QDeclarativeView::SizeRootObjectToView); + QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); #if defined(QT_KEYPAD_NAVIGATION) QApplication::setNavigationMode(Qt::NavigationModeCursorAuto); diff --git a/demos/embedded/qmleasing/deployment.pri b/demos/embedded/qmleasing/deployment.pri index 984f5c8..d3621cb 100644 --- a/demos/embedded/qmleasing/deployment.pri +++ b/demos/embedded/qmleasing/deployment.pri @@ -4,5 +4,5 @@ symbian { qmleasing_uid3 = A000E3FE qmleasing_files.path = $$APP_PRIVATE_DIR_BASE/$$qmleasing_uid3 } -qmleasing_files.sources = $$qmleasing_src/easing.qml +qmleasing_files.sources = $$qmleasing_src/easing.qml $$qmleasing_src/content DEPLOYMENT += qmleasing_files diff --git a/demos/embedded/qmleasing/qmleasing.cpp b/demos/embedded/qmleasing/qmleasing.cpp index d326468..713fe67 100644 --- a/demos/embedded/qmleasing/qmleasing.cpp +++ b/demos/embedded/qmleasing/qmleasing.cpp @@ -42,6 +42,7 @@ #include <QtCore/QFileInfo> #include <QtGui/QApplication> #include <QtDeclarative/QDeclarativeView> +#include <QtDeclarative/QDeclarativeEngine> int main(int argc, char *argv[]) { @@ -51,6 +52,7 @@ int main(int argc, char *argv[]) QDeclarativeView view; view.setSource(QUrl(mainQmlApp)); view.setResizeMode(QDeclarativeView::SizeRootObjectToView); + QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); #if defined(QT_KEYPAD_NAVIGATION) QApplication::setNavigationMode(Qt::NavigationModeCursorAuto); diff --git a/demos/embedded/qmlflickr/qmlflickr.cpp b/demos/embedded/qmlflickr/qmlflickr.cpp index 7068f88..c05806c 100644 --- a/demos/embedded/qmlflickr/qmlflickr.cpp +++ b/demos/embedded/qmlflickr/qmlflickr.cpp @@ -48,6 +48,7 @@ #include <QtNetwork/QNetworkConfiguration> #include <QtNetwork/QNetworkConfigurationManager> #include <QtNetwork/QNetworkAccessManager> +#include <QtDeclarative/QDeclarativeEngine> // Factory to create QNetworkAccessManagers that use the saved network configuration; otherwise // the system default. @@ -95,7 +96,8 @@ int main(int argc, char *argv[]) view.engine()->setNetworkAccessManagerFactory(&networkAccessManagerFactory); view.setSource(QUrl(mainQmlApp)); view.setResizeMode(QDeclarativeView::SizeRootObjectToView); - + QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); + #if defined(Q_OS_SYMBIAN) view.showFullScreen(); #else // Q_OS_SYMBIAN diff --git a/demos/embedded/qmlphotoviewer/qmlphotoviewer.cpp b/demos/embedded/qmlphotoviewer/qmlphotoviewer.cpp index 2b9db5e..d9cf67c 100644 --- a/demos/embedded/qmlphotoviewer/qmlphotoviewer.cpp +++ b/demos/embedded/qmlphotoviewer/qmlphotoviewer.cpp @@ -96,6 +96,8 @@ int main(int argc, char *argv[]) view.setSource(QUrl(mainQmlApp)); view.setResizeMode(QDeclarativeView::SizeRootObjectToView); + QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); + #if defined(Q_OS_SYMBIAN) view.showFullScreen(); #else // Q_OS_SYMBIAN diff --git a/demos/embedded/qmltwitter/qmltwitter.cpp b/demos/embedded/qmltwitter/qmltwitter.cpp index c53098a4..30c4601 100644 --- a/demos/embedded/qmltwitter/qmltwitter.cpp +++ b/demos/embedded/qmltwitter/qmltwitter.cpp @@ -95,7 +95,8 @@ int main(int argc, char *argv[]) view.engine()->setNetworkAccessManagerFactory(&networkAccessManagerFactory); view.setSource(QUrl(mainQmlApp)); view.setResizeMode(QDeclarativeView::SizeRootObjectToView); - + QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit())); + #if defined(Q_OS_SYMBIAN) view.showFullScreen(); #else // Q_OS_SYMBIAN diff --git a/dist/changes-4.6.4 b/dist/changes-4.6.4 index 381023f..389aa3a 100644 --- a/dist/changes-4.6.4 +++ b/dist/changes-4.6.4 @@ -63,8 +63,12 @@ QtNetwork QtOpenGL -------- - - foo - * bar + - QGLShaderProgram + * [QTBUG-12478] Don't resolve GLSL extensions if no shaders. + * [QTBUG-12591] setUniformValue(QSize) was setting (w,w) not (w,h). + * [QTBUG-12862] Don't #define highp/mediump/lowp if the desktop OpenGL + implementation has the GL_ARB_ES2_compatibility extension. + * [QTBUG-12554] Wrong OpenGLVersionFlags on OpenGL 4.0 systems. QtScript -------- diff --git a/dist/changes-4.7.0 b/dist/changes-4.7.0 index 790aabc..a5939e3 100644 --- a/dist/changes-4.7.0 +++ b/dist/changes-4.7.0 @@ -88,7 +88,10 @@ QtGui - QComboBox * [QTBUG-8796] Made ForegroundRole work for all styles. - + + - QCommandLinkButton + * [QTBUG-5995] Fixed text and icon alignment issues. + - QPrinter * Obsoleted the slightly confusing setNumCopies() and numCopies() functions, and replaced them with setCopyCount(), copyCount() and @@ -133,6 +136,9 @@ QtGui * [QTBUG-7982] Added QImage::bitPlaneCount(). * [QTBUG-9072] Fixed alpha check for 1-bit-per-pixel images. + - QLineEdit + * [QTBUG-9823] Placeholder text is now correctly aligned with text. + - QPicture * [QTBUG-4974] Printing QPictures containing text to a high resolution QPrinter would in many cases cause incorrect character spacing. @@ -286,8 +292,9 @@ Qt for Linux/X11 ---------------- - QGtkStyle * Fixed rtl issues with sliders (QTBUG-8986) - * Fixed missing pressed appearance on scroll bar handles. (QTBUG-10396) - + * Fixed missing pressed appearance on scroll bar handles. (QTBUG-10396) + * Fixed crash when creating QGtkStyle before QApplication. (QTBUG-10758) + - QFontDatabase * [QTBUG-4428] Fixed regression when using bitmap fonts on some Linux systems. @@ -303,7 +310,12 @@ Qt for Linux/X11 Qt for Windows -------------- - Popup windows now implicitly activate when shown. (QTBUG-7386) - + - QComboBox [QTBUG-7552] Fix an issue where only "..." would be shown for + QComboBox with certain DPI settings. + - Fixed a problem where menus exec'ed on system tray icons did not + disappear. (QTBUG-7386) + - Improved look and feel for QWizard on Windows 7 and Vista. (QTBUG-9873), + (QTBUG-11974) and (QTBUG-6120) - QLocalSocket * Pipe handle leak fixed, when closing a QLocalSocket that still has unwritten data. (QTBUG-7815) @@ -315,7 +327,9 @@ Qt for Mac OS X --------------- - QMacStyle * Removed frame around statusbar items. (QTBUG-3574) - * More native appearance of item view headers and frames. (QTBUG-10047) + * More native appearance of item view headers and frames. (QTBUG-10047) + * Increased spacing between tree view items. (QTBUG-10190) + * Removed frame around status bar items. (QTBUG-3574) - QFontEngine * Enable fractional metrics for the font engine on Mac in all @@ -478,6 +492,18 @@ QtCore: line breaking, reporting the index of the boundary at which the line break should occur rather than the index of the character. +QtGui: + - QWidget::setLayoutDirection no longer affects the text layout + direction (Qt::LeftToRight or Qt::RightToLeft) of QTextEdit, QLineEdit + and widgets based on them. The default text layout direction + (Qt::LayoutDirectionAuto) is now detected from keyboard layout and + language of the text (conforms to Unicode standards). To + programmatically force the text direction of a QTextEdit, you can + change the defaultTextOption of the QTextDocument associated with that + widget with a new QTextOption of different textDirection property. For + QLineEdit, the only way so far is sending a Qt::Key_Direction_L/R + keyboard event to that widget. + QtNetwork: - Qt does no longer provide its own CA bundle, but uses system APIs for retrieving the default system certificates. diff --git a/dist/changes-4.7.1 b/dist/changes-4.7.1 new file mode 100644 index 0000000..c8b26c2 --- /dev/null +++ b/dist/changes-4.7.1 @@ -0,0 +1,118 @@ +Qt 4.7.1 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 4.7.0. For more details, +refer to the online documentation included in this distribution. The +documentation is also available online: + + http://qt.nokia.com/doc/4.7 + +The Qt version 4.7 series is binary compatible with the 4.6.x series. +Applications compiled for 4.6 will continue to run with 4.7. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker, the (now obsolete) Task +Tracker, or the Merge Request queue of the public source repository. + +Qt Bug Tracker: http://bugreports.qt.nokia.com +Task Tracker: http://qt.nokia.com/developer/task-tracker +Merge Request: http://qt.gitorious.org + +**************************************************************************** +* General * +**************************************************************************** + +Optimizations +------------- + + - Improved the benchmarking library's timing code + * Uses a faster access to the system clock + + * See list of Important Behavior Changes below + + +**************************************************************************** +* Library * +**************************************************************************** + +QtCore +------ + + +QtGui +----- + + +QtDBus +------ + + +QtMultimedia +------------ + + +QtNetwork +--------- + + +QtOpenGL +-------- + + +QtOpenVG +-------- + + +QtWebKit +-------- + + +QtSql +----- + + +QtSvg +----- + + +Qt Plugins +---------- + + + +**************************************************************************** +* Platform Specific Changes * +**************************************************************************** + +Qt for Unix (X11 and Mac OS X) +------------------------------ + + +Qt for Linux/X11 +---------------- + + +Qt for Windows +-------------- + + +Qt for Mac OS X +--------------- + + +Qt for Symbian +-------------- + + + +**************************************************************************** +* Tools * +**************************************************************************** + + - Designer + + - uic + +**************************************************************************** +* Important Behavior Changes * +**************************************************************************** + + diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index 5c4d5e7..6388764 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -965,6 +965,20 @@ Item { } \endcode +This may be connected to via QObject::connect() or called directly from C++ using +QMetaObject::invokeMethod(): + +\code + QDeclarativeEngine engine; + QDeclarativeContext *context = new QDeclarativeContext(engine.rootContext()); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile("main.qml")); + QObject *object = component.create(context); + QVariant str("Hello"); + QMetaObject::invokeMethod(object, "say", Q_ARG(QVariant, str)); +\endcode + +Return values of type QVariant are also supported via Q_RETURN_ARG. + \section1 Defining new Components \target components diff --git a/doc/src/declarative/qml-intro.qdoc b/doc/src/declarative/qml-intro.qdoc index 69dd500..9130be0 100644 --- a/doc/src/declarative/qml-intro.qdoc +++ b/doc/src/declarative/qml-intro.qdoc @@ -47,7 +47,7 @@ Javascript is easier to learn than C++ and can be embedded into the QML files or imported from a separate file. \bold{In QML the types of various 'objects' are referred to as \l {QML -Elements}{ elements}}. +Elements}{elements}}. An element usually has various \e properties that help define the element. For example, if we created an element called Circle then the radius of the circle @@ -56,9 +56,14 @@ would be a property. \section1 A First Look -The basic syntax of an \l {QML Elements}{element} is +The basic syntax of an \l{QML Elements}{element} is -\snippet doc/src/snippets/declarative/qml-intro/basic-syntax.qml basic syntax +\code +SomeElement { + id: myObject + ... some other things here ... +} +\endcode Here we are defining a new object. We specify its 'type' first as SomeElement. Then within matching braces { ... } we specify the various parts of our @@ -82,7 +87,7 @@ want a rectangle that is 500 pixels by 400 pixels in the x and y directions We can implement this \l Rectangle with these properties this way -\quotefile doc/src/snippets/declarative/qml-intro/rectangle.qml +\snippet doc/src/snippets/declarative/qml-intro/rectangle.qml document This is a valid QML script. To run it, copy it and save it to a file, say myexample.qml, and on the command line run the following command: @@ -113,7 +118,7 @@ Text is handled by a different element called \l Text. We need to create a property to "Hello World!". So to set the text to "Hello world" and the background colour to light gray, -\quotefile doc/src/snippets/declarative/qml-intro/hello-world1.qml +\snippet doc/src/snippets/declarative/qml-intro/hello-world1.qml document \section1 Hello World Again @@ -172,7 +177,7 @@ text, also make it 150 by 150 pixels in size, Adding the Hello World example, with the text and the image example we can write a simple piece of QML that starts to look a bit better. -\quotefile doc/src/snippets/declarative/qml-intro/hello-world5.qml +\snippet doc/src/snippets/declarative/qml-intro/hello-world5.qml document The result is still quite simple @@ -203,7 +208,7 @@ If we want to position an image at the bottom of the rectangle it is inside. I have to specify that the bottom of the image is also at the bottom of the rectangle -\quotefile doc/src/snippets/declarative/qml-intro/anchors1.qml +\snippet doc/src/snippets/declarative/qml-intro/anchors1.qml document This places the logo at the bottom left of the window. @@ -222,7 +227,7 @@ the bottomMargin property is used. So the new actions for the script are Encoded into QML the script becomes -\quotefile doc/src/snippets/declarative/qml-intro/anchors2.qml +\snippet doc/src/snippets/declarative/qml-intro/anchors2.qml document Run this and resize the window. You will see that now the position of the image adjusts during the resize. @@ -282,7 +287,7 @@ vertically by a factor of 1.5 and by 1.2 horizontally. Using the example above as the basis for this we have, -\quotefile doc/src/snippets/declarative/qml-intro/transformations1.qml +\snippet doc/src/snippets/declarative/qml-intro/transformations1.qml document The code block in \c image1 starting with \c transform specifies that the \l {Item::transform}{transform} property will be a Rotation through -90 @@ -320,7 +325,7 @@ from \l Item. The rotation property is a real number that specifies the angle in a clockwise direction for the rotation of the object. Here is the code for our animated rotating image. -\quotefile doc/src/snippets/declarative/number-animation1.qml +\snippet doc/src/snippets/declarative/qml-intro/number-animation1.qml document The \c {transformOrigin: Item.Center} is redundant since this is the default axis of rotation anyway. But if you change \c Center to \c BottomRight you @@ -333,7 +338,7 @@ combination. For example, if the task had been to animate the rotation about the y-axis passing through the center of the image then the following code would do it. -\quotefile doc/src/snippets/declarative/number-animation2.qml +\snippet doc/src/snippets/declarative/qml-intro/number-animation2.qml document Here there is a rectangle 600 by 400 pixels. Placed within that rectangle is an image 100 by 100 pixels. It is rotated about the center of the image @@ -362,7 +367,7 @@ will be animating the position and the size of the image. First create two images -\quotefile doc/src/snippets/declarative/sequential-animation1.qml +\snippet doc/src/snippets/declarative/qml-intro/sequential-animation1.qml document We will add to 'image1' a SequentialAnimation from x = 20 to the target of x = 450. The 'from' values will be used because we will be repeating the @@ -375,7 +380,7 @@ between the x values and over a given duration. After the NumberAnimation there will be a PauseAnimation that will pause the animation for 500 milliseconds (half a second) simply for the visual effect. -\snippet doc/src/snippets/declarative/sequential-animation2.qml adding a sequential animation +\snippet doc/src/snippets/declarative/qml-intro/sequential-animation2.qml adding a sequential animation A similar block of code is written for the animation of the 'y' value of the position. @@ -390,7 +395,7 @@ and image1 to 1 and image2 to 2 then image2 will be in the foreground and image1 in the background. When image1 passes image2 it will pass behind it. The completed code looks like -\quotefile doc/src/snippets/declarative/sequential-animation3.qml +\snippet doc/src/snippets/declarative/qml-intro/sequential-animation3.qml document The \c {easing.type} has many options, expressed as a string. It specifies the kind of equation that describes the acceleration of the property value, not @@ -439,9 +444,6 @@ delivers some of the best examples that illustrate these new elements. \endtable - - - \section1 Using States A state is a defined set of values in the configuration of an object and @@ -471,7 +473,7 @@ will be the default state. We will just go to 'night' by clicking and holding the left mouse button down, releasing the mouse button will reverse the process -\quotefile doc/src/snippets/declarative/states1.qml +\snippet doc/src/snippets/declarative/qml-intro/states1.qml document Several new things appear in this sample. Firstly, we use a \l MouseArea element to detect mouse clicks in the \e mainRectangle. Secondly, we use @@ -549,15 +551,15 @@ needle_shadow have the same default \e x and \e y values but the rotation origin for the needle is slightly different so that a shadow will be evident as the needle moves. -\snippet ../../examples/declarative/ui-components/dialcontrol/content/Dial.qml needle_shadow +\snippet examples/declarative/ui-components/dialcontrol/content/Dial.qml needle_shadow And the needle -\snippet ../../examples/declarative/ui-components/dialcontrol/content/Dial.qml needle +\snippet examples/declarative/ui-components/dialcontrol/content/Dial.qml needle The final image is the overlay which simply has a position defined. -\snippet ../../examples/declarative/ui-components/dialcontrol/content/Dial.qml overlay +\snippet examples/declarative/ui-components/dialcontrol/content/Dial.qml overlay \e {dialcontrol.qml} in the \e {examples/declarative/ui-components/dialcontrol} directory is the main file of the example. It defines the visual environment that the Dial @@ -565,17 +567,14 @@ will fit into. Because the \e Dial component and the images live in the \e content sub-directory we will have to import this into \e dialcontrol.qml. So the start of the file looks like - \code - import Qt 4.7 - import "content" - \endcode +\snippet examples/declarative/ui-components/dialcontrol/dialcontrol.qml imports The visual space is bound by a 300 by 300 pixel \l Rectangle which is given a gray color. Inside this rectangle is our component \e Dial and a \l Rectangle. Inside the rectangle called 'container' is another rectangle with the interesting name 'slider'. -\snippet ../../examples/declarative/ui-components/dialcontrol/dialcontrol.qml 0 +\snippet examples/declarative/ui-components/dialcontrol/dialcontrol.qml 0 The Dial component, named 'dial, is \e anchored to the center of the main rectangle. The \c value attribute of 'dial' is set to a value based on the @@ -584,15 +583,7 @@ rectangle. The \c value attribute of 'dial' is set to a value based on the the rotation of the needle image. Notice this piece of code in Dial where the change in \c value modifies the position of the needle. - \code - angle: Math.min(Math.max(-130, root.value*2.6 - 130), 133) - Behavior on angle { - SpringAnimation { - spring: 1.4 - damping: .15 - } - } - \endcode +\snippet examples/declarative/ui-components/dialcontrol/Dial.qml needle angle This is part of the \c needleRotation that rotates the needle and causes the rotation of its shadow. \l SpringAnimation is an element that modifies the value diff --git a/doc/src/declarative/qmlruntime.qdoc b/doc/src/declarative/qmlruntime.qdoc index d44e774..9a84237 100644 --- a/doc/src/declarative/qmlruntime.qdoc +++ b/doc/src/declarative/qmlruntime.qdoc @@ -104,20 +104,22 @@ can be constructed directly instead. In this case, \c application.qml is loaded as a QDeclarativeComponent instance rather than placed into a view: \code - #include <QCoreApplication> + #include <QApplication> #include <QDeclarativeEngine> + #include <QDeclarativeContext> + #include <QDeclarativeComponent> int main(int argc, char *argv[]) { - QCoreApplication app(argc, argv); + QApplication app(argc, argv); QDeclarativeEngine engine; - QDeclarativeContext *windowContext = new QDeclarativeContext(engine.rootContext()); + QDeclarativeContext *objectContext = new QDeclarativeContext(engine.rootContext()); QDeclarativeComponent component(&engine, "application.qml"); - QObject *window = component.create(windowContext); + QObject *object = component.create(objectContext); - // ... delete window and windowContext when necessary + // ... delete object and objectContext when necessary return app.exec(); } diff --git a/doc/src/examples/qml-twitter.qdoc b/doc/src/examples/qml-twitter.qdoc index 8a0de00..c3182a0 100644 --- a/doc/src/examples/qml-twitter.qdoc +++ b/doc/src/examples/qml-twitter.qdoc @@ -29,8 +29,8 @@ \title Twitter Mobile \example demos/declarative/twitter - This demo shows how to write a mobile Twitter client in QML. Use it to - tweet us(@qtbynokia) how much you like our demos! + This demo shows how to write a mobile Twitter search client in QML. Use it to + see what people think about Qt Quick! \image qml-twitter-demo.png */ diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc index 708c44e..e8c85e6 100644 --- a/doc/src/getting-started/examples.qdoc +++ b/doc/src/getting-started/examples.qdoc @@ -255,6 +255,7 @@ \o \l{graphicsview/flowlayout}{Flow Layout} \o \l{graphicsview/simpleanchorlayout}{Simple Anchor Layout} \o \l{graphicsview/weatheranchorlayout}{Weather Anchor Layout} + \o \l{graphicsview/basicgraphicslayouts}{Basic Graphics Layouts} \endlist Some examples demonstrate the use of graphics effects with canvas items. @@ -471,6 +472,7 @@ \o \l{network/googlesuggest}{Google Suggest} \o \l{network/bearercloud}{Bearer Cloud}\raisedaster \o \l{network/bearermonitor}{Bearer Monitor} + \o \l{network/securesocketclient}{Secure Socket Client} \endlist Examples marked with an asterisk (*) are fully documented. @@ -609,6 +611,7 @@ \o \l{sql/querymodel}{Query Model} \o \l{sql/relationaltablemodel}{Relational Table Model} \o \l{sql/tablemodel}{Table Model} + \o \l{sql/masterdetail}{Master Detail} \o \l{sql/sqlwidgetmapper}{SQL Widget Mapper}\raisedaster \endlist @@ -633,6 +636,7 @@ \o \l{xml/streambookmarks}{QXmlStream Bookmarks}\raisedaster \o \l{xml/rsslisting}{RSS-Listing} \o \l{xml/xmlstreamlint}{XML Stream Lint Example}\raisedaster + \o \l{xml/htmlinfo}{XML HTML Info} \endlist The XQuery/XPath and XML Schema engines in the QtXmlPatterns modules diff --git a/doc/src/getting-started/gettingstartedqml.qdoc b/doc/src/getting-started/gettingstartedqml.qdoc index a19d281..405e791 100644 --- a/doc/src/getting-started/gettingstartedqml.qdoc +++ b/doc/src/getting-started/gettingstartedqml.qdoc @@ -404,13 +404,9 @@ \image qml-texteditor2_menubar.png - */ + \section1 Building a Text Editor - /*! - \page qml-textEditor3.html - \title Building a Text Editor - - \section1 Declaring a TextArea + \section2 Declaring a TextArea Our text editor is not a text editor if it didn't contain an editable text area. QML's \l {TextEdit}{TextEdit} element allows the declaration of a multi-line @@ -451,7 +447,7 @@ } \endcode - \section1 Combining Components for the Text Editor + \section2 Combining Components for the Text Editor We are now ready to create the layout of our text editor using QML. The text editor has two components, the menu bar we created and the text area. QML allows @@ -494,12 +490,8 @@ \image qml-texteditor3_texteditor.png - */ - - /*! - \page qml-textEditor4 - \title Decorating the Text Editor - \section1 Implementing a Drawer Interface + \section1 Decorating the Text Editor + \section2 Implementing a Drawer Interface Our text editor looks simple and we need to decorate it. Using QML, we can declare transitions and animate our text editor. Our menu bar is occupying one-third of the @@ -652,7 +644,7 @@ The first color starts at \c 0.0 and the last color is at \c 1.0. - \section2 Where to Go from Here + \section3 Where to Go from Here We are finished building the user interface of a very simple text editor. Going forward, the user interface is complete, and we can implement the @@ -661,7 +653,7 @@ \image qml-texteditor4_texteditor.png - \section1 Extending QML using Qt C++ + \section2 Extending QML using Qt C++ Now that we have our text editor layout, we may now implement the text editor functionalities in C++. Using QML with C++ enables us to create our application @@ -672,7 +664,7 @@ we shall implement the load and save functions in C++ and export it as a plugin. This way, we only need to load the QML file directly instead of running an executable. - \section2 Exposing C++ Classes to QML + \section3 Exposing C++ Classes to QML We will be implementing file loading and saving using Qt and C++. C++ classes and functions can be used in QML by registering them. The class also needs to be @@ -687,7 +679,7 @@ \o A \c qmldir file telling the qmlviewer tool where to find the plugin \endlist - \section2 Building a Qt Plugin + \section3 Building a Qt Plugin To build a plugin, we need to set the following in a Qt project file. First, the necessary sources, headers, and Qt modules need to be added into our @@ -721,7 +713,7 @@ parent's \c plugins directory. - \section2 Registering a Class into QML + \section3 Registering a Class into QML \code In dialogPlugin.h: @@ -771,7 +763,7 @@ file to generate the necessary meta-object code. - \section2 Creating QML Properties in a C++ class + \section3 Creating QML Properties in a C++ class We can create QML elements and properties using C++ and \l {The Meta-Object System}{Qt's Meta-Object System}. We can implement @@ -925,7 +917,7 @@ \c make to build and transfer the plugin to the \c plugins directory. - \section2 Importing a Plugin in QML + \section3 Importing a Plugin in QML The qmlviewer tool imports files that are in the same directory as the application. We can also create a \c qmldir file containing the locations of @@ -948,7 +940,7 @@ \c TARGET field in the project file. The compiled plugin is in the \c plugins directory. - \section2 Integrating a File Dialog into the File Menu + \section3 Integrating a File Dialog into the File Menu Our \c FileMenu needs to display the \c FileDialog element, containing a list of the text files in a directory thus allowing the user to select the file by @@ -1038,7 +1030,7 @@ \image qml-texteditor5_filemenu.png - \section1 Text Editor Completion + \section2 Text Editor Completion \image qml-texteditor5_newfile.png diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc index 629d8b7..708f166 100644 --- a/doc/src/getting-started/installation.qdoc +++ b/doc/src/getting-started/installation.qdoc @@ -1211,9 +1211,9 @@ applications using Qt for Symbian can start right away.} Qt for the Symbian platform requires the following software installed on your development PC: \list - \o \l{http://www.forum.nokia.com/main/resources/tools_and_sdks/carbide_cpp/}{Carbide.c++ v2.0.0 or higher} + \o \l{http://www.forum.nokia.com/Library/Tools_and_downloads/Other/Carbide.c++/}{Carbide.c++ v2.3.0 or higher recommended}. \list - \o \bold{Note:} It may be necessary to update the Carbide compiler. + \o \bold{Note:} It may be necessary to update the Carbide compiler depending on Carbide version. See \l{http://pepper.troll.no/s60prereleases/patches/}{here} for instructions how to check your compiler version and how to patch it, if needed. \endlist @@ -1223,18 +1223,18 @@ applications using Qt for Symbian can start right away.} but that version is no longer available from ActiveState. However, Qt for Symbian has been successfully compiled using both 5.8.x and 5.10.x versions. \endlist - \o \l{http://www.forum.nokia.com/main/resources/tools_and_sdks/S60SDK/}{S60 Platform SDK 3rd Edition FP1 or higher} + \o \l{http://www.forum.nokia.com/info/sw.nokia.com/id/ec866fab-4b76-49f6-b5a5-af0631419e9c/S60_All_in_One_SDKs.html}{S60 Platform SDK 3rd Edition FP1 or higher} \list \o \bold{Note:} Users of \bold{S60 Platform SDK 3rd Edition FP1} also need special update. The update can be found \l{http://pepper.troll.no/s60prereleases/patches/}{here}. \endlist - \o \l{http://www.forum.nokia.com/main/resources/technologies/openc_cpp/}{Open C/C++ v1.6.0 or higher}. + \o \l{http://www.forum.nokia.com/info/sw.nokia.com/id/91d89929-fb8c-4d66-bea0-227e42df9053/Open_C_SDK_Plug-In.html}{Open C/C++ v1.7.5 or higher}. Install this to all Symbian SDKs you plan to use Qt with. \o Building Qt tools from scratch requires \l{http://www.mingw.org/}{MinGW 3.4.5 or higher}, or another windows compiler. \list \o \bold{Note:} This is not required if you are using pre-built binary package. \endlist - \o Building Qt libraries requires \l{http://www.arm.com/products/DevTools/RVCT.html}{RVCT} version 2.2 (build 686 or later), + \o Building Qt libraries requires \l{http://www.arm.com/products/tools/software-development-tools.php}{RVCT} version 2.2 (build 686 or later), which is not available free of charge. Usage of later versions of RVCT, including the 3.x and 4.x series, is not supported in this release. \endlist diff --git a/doc/src/images/qml-image-example.png b/doc/src/images/qml-image-example.png Binary files differindex c1951c0..8d9846f 100644 --- a/doc/src/images/qml-image-example.png +++ b/doc/src/images/qml-image-example.png diff --git a/doc/src/platforms/symbian-introduction.qdoc b/doc/src/platforms/symbian-introduction.qdoc index 701707e..fafe007 100644 --- a/doc/src/platforms/symbian-introduction.qdoc +++ b/doc/src/platforms/symbian-introduction.qdoc @@ -219,6 +219,7 @@ \row \o -o \o Creates only unsigned package. \row \o -s \o Generates stub sis for ROM. \row \o -n <name> \o Specifies the final sis name. + \row \o -g \o Treat gcce platform as armv5. \endtable Execute the \c{createpackage.pl} script without any diff --git a/doc/src/platforms/x11overlays.qdoc b/doc/src/platforms/x11overlays.qdoc index 1a03ea6..949a500 100644 --- a/doc/src/platforms/x11overlays.qdoc +++ b/doc/src/platforms/x11overlays.qdoc @@ -28,6 +28,7 @@ /*! \page x11overlays.html \title How to Use X11 Overlays with Qt + \ingroup best-practices X11 overlays are a powerful mechanism for drawing annotations etc., on top of an image without destroying it, thus saving diff --git a/examples/tutorials/modelview/3_changingmodel/modelview.h b/doc/src/snippets/declarative/qml-intro/anchors1.qml index b2943ac..09ef3b2 100644 --- a/examples/tutorials/modelview/3_changingmodel/modelview.h +++ b/doc/src/snippets/declarative/qml-intro/anchors1.qml @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -38,20 +38,19 @@ ** ****************************************************************************/ -#ifndef MODELVIEW_H -#define MODELVIEW_H +//! [document] +import Qt 4.7 -#include <QtGui/QMainWindow> +Rectangle { + id: myWin + width: 500 + height: 400 -QT_FORWARD_DECLARE_CLASS(QTableView) - -class ModelView : public QMainWindow -{ - Q_OBJECT -private: - QTableView *tableView; -public: - ModelView(QWidget *parent = 0); -}; - -#endif // MODELVIEW_H + Image { + id: image1 + source: "images/qt-logo.png" + width: 150; height: 150 + anchors.bottom: myWin.bottom + } +} +//! [document] diff --git a/examples/tutorials/modelview/4_headers/modelview.cpp b/doc/src/snippets/declarative/qml-intro/anchors2.qml index 449dbbc..ef0ec1f 100644 --- a/examples/tutorials/modelview/4_headers/modelview.cpp +++ b/doc/src/snippets/declarative/qml-intro/anchors2.qml @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -38,17 +38,21 @@ ** ****************************************************************************/ -#include <QTableView> -#include <QHeaderView> -#include "modelview.h" -#include "mymodel.h" +//! [document] +import Qt 4.7 -ModelView::ModelView(QWidget *parent) - : QMainWindow(parent) -{ - tableView = new QTableView(this); - setCentralWidget(tableView); - tableView->setModel(new MyModel(this)); - tableView->verticalHeader()->hide(); -} +Rectangle { + id: myWin + width: 500 + height: 400 + Image { + id: image1 + source: "images/qt-logo.png" + width: 150; height: 150 + anchors.bottom: myWin.bottom + anchors.horizontalCenter: myWin.horizontalCenter + anchors.bottomMargin: 10 + } +} +//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/anchors3.qml b/doc/src/snippets/declarative/qml-intro/anchors3.qml new file mode 100644 index 0000000..008ad1a --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/anchors3.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** 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 QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 + +Rectangle { + id: myWin + width: 500 + height: 400 + + Image { + id: image1 + source: "images/qt-logo.png" + width: 150; height: 150 + anchors.bottom: myWin.bottom + anchors.horizontalCenter: myWin.horizontalCenter + anchors.bottomMargin: 10 + } + +//! [adding some text] + Text { + text: "<h2>The Qt Logo</h2>" + anchors.bottom: image1.top + anchors.horizontalCenter: myWin.horizontalCenter + anchors.bottomMargin: 15 + } +//! [adding some text] +} diff --git a/examples/tutorials/modelview/2_formatting/modelview.cpp b/doc/src/snippets/declarative/qml-intro/hello-world1.qml index 9a5ce64..9b91049 100644 --- a/examples/tutorials/modelview/2_formatting/modelview.cpp +++ b/doc/src/snippets/declarative/qml-intro/hello-world1.qml @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -38,15 +38,16 @@ ** ****************************************************************************/ -#include <QTableView> -#include "modelview.h" -#include "mymodel.h" +//! [document] +import Qt 4.7 -ModelView::ModelView(QWidget *parent) - : QMainWindow(parent) -{ - tableView = new QTableView(this); - setCentralWidget(tableView); - tableView->setModel(new MyModel(this)); -} +Rectangle { + id: myRectangle + width: 500 + height: 400 + + Text { text: "Hello World!" } + color: "lightgray" +} +//! [document] diff --git a/examples/tutorials/modelview/3_changingmodel/modelview.cpp b/doc/src/snippets/declarative/qml-intro/hello-world2.qml index 9a5ce64..ddc1017 100644 --- a/examples/tutorials/modelview/3_changingmodel/modelview.cpp +++ b/doc/src/snippets/declarative/qml-intro/hello-world2.qml @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -38,15 +38,19 @@ ** ****************************************************************************/ -#include <QTableView> -#include "modelview.h" -#include "mymodel.h" +import Qt 4.7 -ModelView::ModelView(QWidget *parent) - : QMainWindow(parent) -{ - tableView = new QTableView(this); - setCentralWidget(tableView); - tableView->setModel(new MyModel(this)); -} +Rectangle { + id: myRectangle + width: 500 + height: 400 + +//! [updated text] + Text { + text: "<h2>Hello World</h2>"; color: "darkgreen" + x: 100; y:100 + } +//! [updated text] + color: "lightgray" +} diff --git a/examples/tutorials/modelview/2_formatting/modelview.h b/doc/src/snippets/declarative/qml-intro/hello-world3.qml index b2943ac..f1102c2 100644 --- a/examples/tutorials/modelview/2_formatting/modelview.h +++ b/doc/src/snippets/declarative/qml-intro/hello-world3.qml @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -38,20 +38,20 @@ ** ****************************************************************************/ -#ifndef MODELVIEW_H -#define MODELVIEW_H +import Qt 4.7 -#include <QtGui/QMainWindow> +Rectangle { + id: myRectangle + width: 500 + height: 400 -QT_FORWARD_DECLARE_CLASS(QTableView) +//! [updated text] + Text { + text: "<h1>Hello world again</h1>" + color: "#002288" + x: 100; y: 100 + } +//! [updated text] -class ModelView : public QMainWindow -{ - Q_OBJECT -private: - QTableView *tableView; -public: - ModelView(QWidget *parent = 0); -}; - -#endif // MODELVIEW_H + color: "lightgray" +} diff --git a/doc/src/snippets/declarative/qml-intro/hello-world4.qml b/doc/src/snippets/declarative/qml-intro/hello-world4.qml new file mode 100644 index 0000000..c18fe15 --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/hello-world4.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** 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 QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 + +Rectangle { + id: myRectangle + width: 500 + height: 400 + + Text { + text: "<h1>Hello world again</h1>" + color: "#002288" + x: 100; y: 100 + } + +//! [added an image] + Image { + source: "images/qt-logo.png" + } +//! [added an image] + + color: "lightgray" +} diff --git a/examples/tutorials/modelview/1_readonly/modelview.h b/doc/src/snippets/declarative/qml-intro/hello-world5.qml index cc14d90..bde8dc3 100644 --- a/examples/tutorials/modelview/1_readonly/modelview.h +++ b/doc/src/snippets/declarative/qml-intro/hello-world5.qml @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -38,24 +38,28 @@ ** ****************************************************************************/ -#ifndef MODELVIEW_H -#define MODELVIEW_H +//! [document] +import Qt 4.7 -//! [Quoting ModelView Tutorial] -// modelview.h -#include <QtGui/QMainWindow> +Rectangle { + id: myRectangle + width: 500 + height: 400 -QT_FORWARD_DECLARE_CLASS(QTableView) + Text { + text: "<h1>Hello world again</h1>" + color: "#002288" + x: 100; y: 100 + } -class ModelView : public QMainWindow -{ - Q_OBJECT -private: - QTableView *tableView; -public: - ModelView(QWidget *parent = 0); +//! [positioning the image] + Image { + source: "images/qt-logo.png" + x: 100; y: 150 + width: 150; height: 150 + } +//! [positioning the image] -}; -//! [Quoting ModelView Tutorial] - -#endif // MODELVIEW_H + color: "lightgray" +} +//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/number-animation1.qml b/doc/src/snippets/declarative/qml-intro/number-animation1.qml new file mode 100644 index 0000000..8d8d747 --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/number-animation1.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** 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 QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +Rectangle { + id: mainRec + width: 600 + height: 400 + + Image { + id: image1 + source: "images/qt-logo.png" + x: 200; y: 100 + width: 100; height: 100 + + // Animate a rotation + transformOrigin: Item.Center + NumberAnimation on rotation { + from: 0; to: 360 + duration: 2000 + loops: Animation.Infinite + } + } +} +//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/number-animation2.qml b/doc/src/snippets/declarative/qml-intro/number-animation2.qml new file mode 100644 index 0000000..d556c21 --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/number-animation2.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** 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 QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +Rectangle { + id: mainRec + width: 600 + height: 400 + + Image { + id: image1 + source: "images/qt-logo.png" + x: 200; y: 100 + width: 100; height: 100 + + // Animate a rotation + transform: Rotation { + origin.x: 50; origin.y: 50; axis {x:0; y:1; z:0} angle:0 + NumberAnimation on angle { + from: 0; to: 360; + duration: 3000; + loops: Animation.Infinite + } + } + } +} +//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/rectangle.qml b/doc/src/snippets/declarative/qml-intro/rectangle.qml new file mode 100644 index 0000000..0078813 --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/rectangle.qml @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** 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 QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +// This is a comment. And below myRectangle is defined. +Rectangle { + id: myRectangle + width: 500 + height: 400 +} +//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/sequential-animation1.qml b/doc/src/snippets/declarative/qml-intro/sequential-animation1.qml new file mode 100644 index 0000000..e68de20 --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/sequential-animation1.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** 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 QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +Rectangle { + id: mainRec + width: 600 + height: 400 + z: 0 + + Image { + id: image1 + source: "images/qt-logo.png" + x: 20; y: 20 ; z: 1 + width: 100; height: 100 + } + + Image { + id: image2 + source: "images/qt-logo.png" + width: 100; height: 100 + x: (mainRec.width - 100)/2; y: (mainRec.height - 100)/2 + z: 2 + } +} +//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/sequential-animation2.qml b/doc/src/snippets/declarative/qml-intro/sequential-animation2.qml new file mode 100644 index 0000000..31835a1 --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/sequential-animation2.qml @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** 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 QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 + +Rectangle { + id: mainRec + width: 600 + height: 400 + z: 0 + +//! [adding a sequential animation] + Image { + id: image1 + source: "images/qt-logo.png" + width: 100; height: 100 + + SequentialAnimation on x { + loops: Animation.Infinite + NumberAnimation { + from: 20; to: 450; easing.type: "InOutQuad"; + duration: 2000 + } + PauseAnimation { duration: 500 } + } + } +//! [adding a sequential animation] + + Image { + id: image2 + source: "images/qt-logo.png" + width: 100; height: 100 + x: (mainRec.width - 100)/2; y: (mainRec.height - 100)/2 + z: 2 + } +} diff --git a/doc/src/snippets/declarative/qml-intro/sequential-animation3.qml b/doc/src/snippets/declarative/qml-intro/sequential-animation3.qml new file mode 100644 index 0000000..6926f8a --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/sequential-animation3.qml @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** 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 QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +Rectangle { + id: mainRec + width: 600 + height: 400 + z: 0 + + Image { + id: image2 + source: "images/qt-logo.png" + width: 100; height: 100 + x: (mainRec.width - 100)/2; y: (mainRec.height - 100)/2 + z: 2 + } + + Image { + id: image1 + source: "images/qt-logo.png" + x: 20; y: 20 ; z: 1 + width: 100; height: 100 + + SequentialAnimation on x { + loops: Animation.Infinite + NumberAnimation { + from: 20; to: 450 + easing.type: "InOutQuad"; duration: 2000 + } + PauseAnimation { duration: 500 } + } + + SequentialAnimation on y { + loops: Animation.Infinite + NumberAnimation { + from: 20; to: 250 + easing.type: "InOutQuad"; duration: 2000 + } + PauseAnimation { duration: 500 } + } + + SequentialAnimation on scale { + loops: Animation.Infinite + NumberAnimation { from: 1; to: 0.5; duration: 1000 } + NumberAnimation { from: 0.5; to: 1; duration: 1000 } + PauseAnimation { duration: 500 } + } + } +} +//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/states1.qml b/doc/src/snippets/declarative/qml-intro/states1.qml new file mode 100644 index 0000000..9619eb7 --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/states1.qml @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** 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 QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +Rectangle { + id: mainRectangle + width: 600 + height: 400 + color: "black" + + Rectangle { + id: sky + width: 600 + height: 200 + y: 0 + color: "lightblue" + } + + Rectangle { + id: ground + width: 600; height: 200 + y: 200 + color: "green" + } + + MouseArea { + id: mousearea + anchors.fill: mainRectangle + } + + states: [ State { + name: "night" + when: mousearea.pressed == true + PropertyChanges { target: sky; color: "darkblue" } + PropertyChanges { target: ground; color: "black" } + }, + State { + name: "daylight" + when: mousearea.pressed == false + PropertyChanges { target: sky; color: "lightblue" } + PropertyChanges { target: ground; color: "green" } + } + ] + + transitions: [ Transition { + from: "daylight"; to: "night" + ColorAnimation { duration: 1000 } + }, + Transition { + from: "night"; to: "daylight" + ColorAnimation { duration: 500 } + } + ] +} +//! [document] diff --git a/examples/tutorials/modelview/4_headers/modelview.h b/doc/src/snippets/declarative/qml-intro/transformations1.qml index 03f99c0..af39e69 100644 --- a/examples/tutorials/modelview/4_headers/modelview.h +++ b/doc/src/snippets/declarative/qml-intro/transformations1.qml @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -38,21 +38,43 @@ ** ****************************************************************************/ -#ifndef MODELVIEW_H -#define MODELVIEW_H +//! [document] +import Qt 4.7 -#include <QtGui/QMainWindow> +Rectangle { + id: myWin + width: 500 + height: 400 -QT_FORWARD_DECLARE_CLASS(QTableView) + Image { + id: image1 + source: "images/qt-logo.png" + width: 150; height: 150 + anchors.bottom: myWin.bottom + anchors.horizontalCenter: myWin.horizontalCenter + anchors.bottomMargin: 10 -class ModelView : public QMainWindow -{ - Q_OBJECT -private: - QTableView *tableView; -public: - ModelView(QWidget *parent = 0); + transform: Rotation { + origin.x: 75; origin.y: 75 + axis{ x: 0; y: 0; z:1 } angle: -90 + } -}; + } -#endif // MODELVIEW_H + Text { + text: "<h2>The Qt Logo -- taking it easy</h2>" + anchors.bottom: image1.top + anchors.horizontalCenter: myWin.horizontalCenter + anchors.bottomMargin: 15 + + transform: [ + Scale { xScale: 1.5; yScale: 1.2 } , + + Rotation { + origin.x: 75; origin.y: 75 + axis{ x: 0; y: 0; z:1 } angle: -45 + } + ] + } +} +//! [document] diff --git a/doc/src/tutorials/modelview.qdoc b/doc/src/tutorials/modelview.qdoc index b39a01c..65f6674 100755..100644 --- a/doc/src/tutorials/modelview.qdoc +++ b/doc/src/tutorials/modelview.qdoc @@ -29,22 +29,28 @@ \page modelview.html \startpage {index.html}{Qt Reference Documentation} - \nextpage {modelview-part1.html}{Introduction} \title Model/View Contents \brief An introduction to ModelView programming - This tutorial gives an introduction to ModelView programming using the Qt - cross-platform framework. + Every UI developer should know about ModelView programming and the goal of + this tutorial is to provide you with an easily understandable introduction + to this topic. + + Table, list and tree widgets are components frequently used in GUIs. There + are 2 different ways how these widgets can access their data. The + traditional way involves widgets which include internal containers for + storing data. This approach is very intuitive, however, in many non-trivial + applications, it leads to data synchronization issues. + The second approach is model/view programming, in + which widgets do not maintain internal data containers. They access external + data through a standardized interface and therefore avoid data duplication. + This may seem complicated at first, but once you take a closer look, it is + not only easy to grasp, but the many benefits of model/view programming also + become clearer. \image treeview.png - \omit - It doesn't cover everything; the emphasis is on teaching the programming - philosophy of Model/View programming, and Qt's features are introduced as - needed. Some commonly used features are never used in this tutorial. - \endomit - In the process, we will learn about some basic technologies provided by Qt, such as: @@ -52,38 +58,29 @@ \o The difference between standard and model/view widgets \o Adapters betweeen forms and models \o Developing a simple model/view application + \o Predefined models \o Intermediate topics such as: \list \o Tree views \o Selection - \o Predefined models \o Delegates \o Debugging with model test \endlist \endlist - If you are completely new to Qt, please read \l{How to Learn Qt} if you - have not already done so. - - The tutorial's source code is located in Qt's \c examples/tutorials/modelview - directory. + You will also learn whether your new application can be written easier with + model/view programming or if classic widgets will work just as well. - \list 1 - \o \l{modelview-part1.html}{Introduction} - \o \l{modelview-part2.html}{Developing a Simple Model/View Application} - \o \l{modelview-part3.html}{Intermediate Topics} - \o \l{modelview-part4.html}{Good Sources of Additional Information} - \endlist + This tutorial includes example code for you to edit and integrate into your + project. The tutorial's source code is located in Qt's + \c examples/tutorials/modelview directory. + For more detailed information you may also want to look at the + \l{model-view-programming.html}{reference documentation} -*/ + If you are completely new to Qt, please read \l{How to Learn Qt} if you + have not already done so. -/*! - \page modelview-part1.html - \contentspage {modelview.html}{Model/View Contents} - \previouspage {modelview.html}{Model/View Contents} - \nextpage {modelview-part2.html}{Developing a Simple Model/View Application} - \title An Introduction to Model/View Programming \section1 1. Introduction @@ -104,16 +101,16 @@ \section2 1.1 Standard Widgets Let's have a closer look at a standard table widget. A table widget is a 2D - array of the data elements that the user can change. The table widget can - be integrated into a program flow by reading and writing the data elements - that the table widget provides. This method is very intuitive and useful in - many applications. + array of the data elements that the user can change. The table widget can be + integrated into a program flow by reading and writing the data elements that + the table widget provides. This method is very intuitive and useful in many + applications. Displaying and editing a database table with a standard table widget can be problematic. Two copies of the data have to be coordinated: one outside the - widget; one inside the widget. The developer needs to know where up-to-date - data is so the both copies contain the most recent data. The tight coupling - of presentation and data makes it harder to write unit tests. + widget; one inside the widget. The developer is responsible for + synchronizing both versions. The tight coupling of presentation and data + makes it harder to write unit tests. \section2 1.2 Model/View to the Rescue @@ -121,14 +118,14 @@ architecture. Model/view eliminates the data consistency problems that may occur with standard widgets. Model/view also makes it easier to use more than one view of the same data because one model can be passed on to many - views. The most important difference is that model/view widgets do not - store data behind the table cells. In fact, they operate directly from your - data. Since view classes do not know your data's structure, you need to - provide a wrapper to make your data conform to the QAbstractItemModel - interface. A view uses this interface to read from and write to your data - and any class that implements QAbstractItemModel is a model. Once the view - receives a pointer to a model, it will read and display its content and be - its editor. + views. The most important difference is that model/view widgets do not store + data behind the table cells. In fact, they operate directly from your data. + Since view classes do not know your data's structure, you need to provide a + wrapper to make your data conform to the QAbstractItemModel interface. A + view uses this interface to read from and write to your data. Any instance + of a class that implements QAbstractItemModel is said to be a model. Once + the view receives a pointer to a model, it will read and display its content + and be its editor. \section2 1.3 Overview of the Model/View Widgets @@ -138,9 +135,10 @@ \table \header \o Widget - \o Standard Widget (a convenience class with data in - the widget) - \o Model/View View Class (for use with external data) + \o Standard Widget\br + (an item based convenience class) + \o Model/View View Class\br + (for use with external data) \row \o \inlineimage listview.png \o \l QListWidget @@ -167,47 +165,26 @@ Having adapters between forms and models can come in handy. - We often prefer editing data stored in tables (e.g. in database tables) in - forms rather than in tables. There is no direct model/view counterpart for - separating data and views for widgets that operate on one value instead of - a dataset, so we need an adapter in order to connect the form to the source - of data. + We can edit data stored in tables directly from within the table itself, but + it's much more comfortable to edit data in text fields. There is no direct + model/view counterpart that separates data and views for widgets that + operate on one value (QLineEdit, QCheckBox ...) instead of a dataset, so we + need an adapter in order to connect the form to the source of data. \l QDataWidgetMapper is a great solution because it maps form widgets to a - table row and it makes it very easy to build forms for database tables. + table row and makes it very easy to build forms for database tables. \image widgetmapper.png - Another example of an adapter is QCompleter. Qt has QCompleter for - providing auto-completions in Qt widgets such as QComboBox and, as shown - below, QLineEdit. QCompleter uses a model as its data source, so QCompleter, - in itself, is a very handy adapter. + Another example of an adapter is \l QCompleter. Qt has \l QCompleter for + providing auto-completions in Qt widgets such as \l QComboBox and, as shown + below, \l QLineEdit. \l QCompleter uses a model as its data source. \image qcompleter.png -*/ - -/*! - \page modelview-part2-main-cpp.html - \title main.cpp - \quotefile tutorials/modelview/1_readonly/main.cpp -*/ -/*! - \page modelview-part2.html - \contentspage {modelview-index.html}{Model/View Contents} - \previouspage {modelview-part1.html}{Introduction} - \nextpage {modelview-part3.html}{Intermediate Topics} - \title Model/View Chapter 2 - A Simple Model/View Application \section1 2. A Simple Model/View Application - - If you want to develop a model/view application, where should you start? We - recommend starting with a simple example and extending it step-by-step. - This makes understanding the architecture a lot easier. Trying to - understand the model/view architecture in detail before invoking the IDE - has proven to be less convenient for many developers. It is substantially - easier to start with a simple model/view application that has demo data. - Give it a try! Simply replace the data in the examples below with your own. + If you want to develop a model/view application, where should you start? We recommend starting with a simple example and extending it step-by-step. This makes understanding the architecture a lot easier. Trying to understand the model/view architecture in detail before invoking the IDE has proven to be less convenient for many developers. It is substantially easier to start with a simple model/view application that has demo data. Give it a try! Simply replace the data in the examples below with your own. Below are 7 very simple and independent applications that show different sides of model/view programming. The source code can be found inside the @@ -216,58 +193,55 @@ \section2 2.1 A Read Only Table We start with an application that uses a QTableView to show data. We will - add editing capabilities later. + add editing capabilities later. + (file source: examples/tutorials/modelview/1_readonly/main.cpp) \snippet examples/tutorials/modelview/1_readonly/main.cpp Quoting ModelView Tutorial We have the usual \l {modelview-part2-main-cpp.html}{main()} function: - \snippet examples/tutorials/modelview/1_readonly/modelview.h Quoting ModelView Tutorial - - The application is a \l QMainWindow that holds a \l QTableView. - - \snippet examples/tutorials/modelview/1_readonly/modelview.cpp Quoting ModelView Tutorial - - Here is the interesting part: We use - \l{QTableView::setModel()}{tableView->setModel(new MyModel(this));} to - instantiate the Model and pass its pointer to \l {QTableView}{tableView()}. - \l{QTableView}{tableView} will invoke the methods of the pointer it has - received to find out two things: + Here is the interesting part: We create an instance of MyModel and use + \l{QTableView::setModel()}{tableView.setModel(&myModel);} to pass a + pointer of it to to \l{QTableView}{tableView}. \l{QTableView}{tableView} + will invoke the methods of the pointer it has received to find out two + things: \list - \o How many rows and columns should be displayed - \o What content should be printed into each cell. + \o How many rows and columns should be displayed. + \o What content should be printed into each cell. \endlist - The model needs some code to respond to this. + The model needs some code to respond to this. We have a table data set, so let's start with QAbstractTableModel since it - is easier to use. + is easier to use than the more general QAbstractItemModel. + (file source: examples/tutorials/modelview/1_readonly/mymodel.h) \snippet examples/tutorials/modelview/1_readonly/mymodel.h Quoting ModelView Tutorial QAbstractTableModel requires the implementation of three abstract methods. + (file source: examples/tutorials/modelview/1_readonly/mymodel.cpp) \snippet examples/tutorials/modelview/1_readonly/mymodel.cpp Quoting ModelView Tutorial - The number of rows and columns is set by + The number of rows and columns is provided by \l{QAbstractItemModel::rowCount()}{MyModel::rowCount()} and - \l{QAbstractItemModel::columnCount()}{MyModel::columnCount()}. - When the view has to know what the cell's text is, it calls the method. - Row and column information is specified with parameter \c index and the - role is set to \l{Qt::ItemDataRole}{Qt::DisplayRole}. Other roles are - covered in the next section. In our example, the data that should be - displayed is generated. In a real application, \c MyModel would have a - member called \c MyData, which serves as the target for all reading and - writing operations. + \l{QAbstractItemModel::columnCount()}{MyModel::columnCount()}. When the view + has to know what the cell's text is, it calls the method + \l{QAbstractItemModel::data()}{MyModel::data()}. Row and column information + is specified with parameter \c index and the role is set to + \l{Qt::ItemDataRole}{Qt::DisplayRole}. Other roles are covered in the next + section. In our example, the data that should be displayed is generated. In + a real application, \c MyModel would have a member called \c MyData, which + serves as the target for all reading and writing operations. This small example demonstrates the passive nature of a model. The model does not know when it will be used or which data is needed. It simply - provides data each time the view requests it. + provides data each time the view requests it. - What happens when the model 's data needs to be changed? How does the view - know when data changes and needs to be read again? The model has to emit a - signal that indicates what range of cells has changed. This will be + What happens when the model's data needs to be changed? How does the view + realize that data has changed and needs to be read again? The model has to + emit a signal that indicates what range of cells has changed. This will be demonstrated in section 2.3. \section2 2.2 Extending the Read Only Example with Roles @@ -276,12 +250,14 @@ controls the text's appearance. When we slightly change the model, we get the following result: \image readonlytable_role.png - In fact, nothing except for the \l{QAbstractItemModel::}{data()} - method needs to be changed to set fonts, background colour, alignment and a + In fact, nothing except for the \l{QAbstractItemModel::}{data()} method + needs to be changed to set fonts, background colour, alignment and a checkbox. - Here is the \l{QAbstractItemModel::data()}{data()} method that produces the - result shown above: + Below is the \l{QAbstractItemModel::data()}{data()} method that produces the + result shown above. The difference is that this time we use parameter int + role to return different pieces of information depending on its value. + (file source: examples/tutorials/modelview/2_formatting/mymodel.cpp) \snippet examples/tutorials/modelview/2_formatting/mymodel.cpp Quoting ModelView Tutorial Each formatting property will be requested from the model with a separate @@ -290,42 +266,45 @@ \table \header - \o Role (enum Qt::ItemDataRole ) + \o \l{Qt::ItemDataRole}{enum Qt::ItemDataRole} \o Meaning - \o Type + \o Type \row - \o \l{Qt::ItemDataRole}{Qt::DisplayRole} + \o \l{Qt::ItemDataRole}{}Qt::DisplayRole \o text \o QString \row - \o Qt::FontRole + \o \l{Qt::ItemDataRole}{Qt::FontRole} \o font \o QFont \row - \o Qt::BackgroundRole + \o \l{Qt::ItemDataRole}{BackgroundRole} \o brush for the background of the cell \o QBrush \row - \o Qt::TextAlignmentRole + \o \l{Qt::ItemDataRole}{Qt::TextAlignmentRole} \o text alignment - \o enum Qt::AlignmentFlag + \o \l{Qt::AlignmentFlag}{enum Qt::AlignmentFlag} \row - \o {1, 3} Qt::CheckStateRole + \o {1, 3} \l{Qt::ItemDataRole}{Qt::CheckStateRole} \o {1, 3} suppresses checkboxes with \l{QVariant}{QVariant()}, - sets checkboxes with Qt::Checked or Qt::Unchecked - \o {1, 3} \l{Qt::ItemDataRole}{enum Qt::ItemDataRole} + + sets checkboxes with \l{Qt::CheckState}{Qt::Checked} + + or \l{Qt::CheckState}{Qt::Unchecked} + \o {1, 3} \l{Qt::ItemDataRole}{enum Qt::ItemDataRole} \endtable Refer to the Qt namespace documentation to learn more about the - Qt::ItemDataRole enum's capabilities. + \l{Qt::ItemDataRole}{Qt::ItemDataRole} enum's capabilities. - Now we need to determine how using a seperated model impacts the + Now we need to determine how using a separated model impacts the application's performance, so let's trace how often the view calls the - \l{QAbstractItemModel::}{data()} method. In order to track how often - the view calls the model, we have put a debug statement in the - \l{QAbstractItemModel::}{data()} method, which logs onto stdio. In - our small example, \l{QAbstractItemModel::}{data()} will be called 42 - times. + \l{QAbstractItemModel::}{data()} method. In order to track how often the + view calls the model, we have put a debug statement in the + \l{QAbstractItemModel::}{data()} method, which logs onto the error output + stream. In our small example, \l{QAbstractItemModel::}{data()} will be + called 42 times. Each time you hover the cursor over the field, \l{QAbstractItemModel::}{data()} will be called again \mdash 7 times for each cell. That's why it is important to make sure that your data is @@ -339,6 +318,7 @@ We still have a read only table, but this time the content changes every second because we are showing the current time. + (file source: examples/tutorials/modelview/3_changingmodel/mymodel.cpp) \snippet examples/tutorials/modelview/3_changingmodel/mymodel.cpp quoting mymodel_QVariant Something is missing to make the clock tick. We need to tell the view every @@ -346,17 +326,18 @@ this with a timer. In the constructor, we set its interval to 1 second and connect its timeout signal. + (file source: examples/tutorials/modelview/3_changingmodel/mymodel.cpp) \snippet examples/tutorials/modelview/3_changingmodel/mymodel.cpp quoting mymodel_a Here is the corresponding slot: + (file source: examples/tutorials/modelview/3_changingmodel/mymodel.cpp) \snippet examples/tutorials/modelview/3_changingmodel/mymodel.cpp quoting mymodel_b We ask the view to read the data in the top left cell again by emitting the \l{QAbstractItemModel::}{dataChanged()} signal. Note that we did not - explicitly connect the \l{QAbstractItemModel::}{dataChanged()} signal to - the view. This happened automatically when we called - \l{QTableView::}{setModel()}. + explicitly connect the \l{QAbstractItemModel::}{dataChanged()} signal to the + view. This happened automatically when we called \l{QTableView::}{setModel()}. \section2 2.4 Setting up Headers for Columns and Rows @@ -366,60 +347,58 @@ The header content, however, is set via the model, so we reimplement the \l{QAbstractItemModel::headerData()}{headerData()} method: + (file source: examples/tutorials/modelview/4_headers/mymodel.cpp) \snippet examples/tutorials/modelview/4_headers/mymodel.cpp quoting mymodel_c + Note that method \l{QAbstractItemModel::headerData()}{headerData()} also has + a parameter role which has the same meaning as in + \l{QAbstractItemModel::data()}{MyModel::data()}. \section2 2.5 The Minimal Editing Example In this example, we are going to build an application that automatically - populates a window title with content by repeating values entered into - table cells. + populates a window title with content by repeating values entered into table + cells. To be able to access the window title easily we put the QTableView in + a QMainWindow. - The model decides whether editing capabilities are available . We only have + The model decides whether editing capabilities are available. We only have to modify the model in order for the available editing capabilities to be enabled. This is done by reimplementing the following virtual methods: \l{QAbstractItemModel::}{setData()} and \l{QAbstractItemModel::}{flags()}. + (file source: examples/tutorials/modelview/5_edit/mymodel.h) \snippet examples/tutorials/modelview/5_edit/mymodel.h Quoting ModelView Tutorial - We use \c QStringList m_gridData to store our data. This makes - \c m_gridData the core of MyModel. The rest of \c MyModel acts like a - wrapper and adapts \c m_gridData to the QAbstractItemModel interface. We - have also introduced the \c editCompleted() signal, - which makes it possible to transfer the modified text to the window title. - - \snippet examples/tutorials/modelview/5_edit/mymodel.cpp quoting mymodel_d - - In the constructor, we fill \c QStringList gridData with 6 items (one item - for every field in the table): + We use \c the two-dimensional array QString \c m_gridData to store our data. + This makes \c m_gridData the core of \c MyModel. The rest of \c MyModel acts + like a wrapper and adapts \c m_gridData to the QAbstractItemModel + interface. We have also introduced the \c editCompleted() signal, which + makes it possible to transfer the modified text to the window title. + (file source: examples/tutorials/modelview/5_edit/mymodel.cpp) \snippet examples/tutorials/modelview/5_edit/mymodel.cpp quoting mymodel_e \l{QAbstractItemModel::setData()}{setData()} will be called each time the user edits a cell. The \c index parameter tells us which field has been edited and \c value provides the result of the editing process. The role - will always be set to \c Qt::EditRole because our cells only contain text. + will always be set to \l Qt::EditRole because our cells only contain text. If a checkbox were present and user permissions are set to allow the checkbox to be selected, calls would also be made with the role set to - \c Qt::CheckStateRole. + \l Qt::CheckStateRole. + (file source: examples/tutorials/modelview/5_edit/mymodel.cpp) \snippet examples/tutorials/modelview/5_edit/mymodel.cpp quoting mymodel_f Various properties of a cell can be adjusted with - \l{QAbstractItemModel::flags()}{flags()}. Returning - \c Qt::ItemIsEditable | \c Qt::ItemIsEnabled is enough to show an editor - that a cell has been selected. If editing one cell modifies more data than - the data in that particular cell, the model must emit a - \l{QAbstractItemModel::}{dataChanged()} signal in order for the data that - has been changed to be read. -*/ + \l{QAbstractItemModel::flags()}{flags()}. + + Returning \l{Qt::ItemFlag}{Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled} + is enough to show an editor that a cell can be selected. + + If editing one cell modifies more data than the data in that particular + cell, the model must emit a \l{QAbstractItemModel::}{dataChanged()} signal + in order for the data that has been changed to be read. -/*! - \page modelview-part3.html - \contentspage {modelview-index.html}{Model/View Contents} - \previouspage {modelview-part2.html}{Developing a Simple Model/View Application} - \nextpage {modelview-part4.html}{Good Sources of Additional Information} - \title Model/View Chapter 3 - Intermediate Topics \section1 3. Intermediate Topics @@ -429,28 +408,30 @@ Simply replace QTableView with QTreeView, which results in a read/write tree. No changes have to be made to the model. The tree won't have any hierarchies because there aren't any hierarchies in the model itself. - \image dummy_tree.png + \image dummy_tree.png QListView, QTableView and QTreeView all use a model abstraction, which is a merged list, table and tree. This makes it possible to use several different types of view classes from the same model. - \image list_table_tree.png + \image list_table_tree.png This is how our example model looks so far: - \image example_model.png + \image example_model.png We want to present a real tree. We have wrapped our data in the examples above in order to make a model. This time we use QStandardItemModel, which is a container for hierarchical data that also implements QAbstractItemModel. To show a tree, QStandardItemModel must be populated - with \l{QStandardItem}{QStandardItems}, which are able to hold all the - standard properties of items like text, fonts, checkboxes or brushes. + with \l{QStandardItem}s, which are able to hold all the standard properties + of items like text, fonts, checkboxes or brushes. + \image tree_2_with_algorithm.png - \snippet examples/tutorials/modelview/6_treeview/modelview.cpp Quoting ModelView Tutorial + (file source: examples/tutorials/modelview/6_treeview/mainwindow.cpp) + \snippet examples/tutorials/modelview/6_treeview/mainwindow.cpp Quoting ModelView Tutorial We simply instantiate a QStandardItemModel and add a couple of \l{QStandardItem}{QStandardItems} to the constructor. We can then make a @@ -462,42 +443,45 @@ We want to access a selected item's content in order to output it into the window title together with the hierarchy level. + \image selection2.png So let's create a couple of items: - \snippet examples/tutorials/modelview/7_selections/modelview.cpp quoting modelview_a + (file source: examples/tutorials/modelview/7_selections/mainwindow.cpp) + \snippet examples/tutorials/modelview/7_selections/mainwindow.cpp quoting modelview_a Views manage selections within a separate selection model, which can be - retrieved with the \l{QAbstractItemView::}{selectionModel()} - method. We retrieve the selection Model in order to connect a slot to its + retrieved with the \l{QAbstractItemView::}{selectionModel()} method. We + retrieve the selection Model in order to connect a slot to its \l{QAbstractItemView::}{selectionChanged()} signal. - \snippet examples/tutorials/modelview/7_selections/modelview.cpp quoting modelview_b + (file source: examples/tutorials/modelview/7_selections/mainwindow.cpp) + \snippet examples/tutorials/modelview/7_selections/mainwindow.cpp quoting modelview_b - We get the model index that corresponds to the selection by calling + We get the model index that corresponds to the selection by calling \l{QItemSelectionModel::currentIndex()}{treeView->selectionModel()->currentIndex()} and we get the the field's string by using the model index. Then we just - calculate the item's \c hierarchyLevel. Top level items do not have - parents and the \l{QAbstractItemModel::}{parent()} method will return a - default constructed \l{QModelIndex}{QModelIndex()}. This is why we use the + calculate the item's \c hierarchyLevel. Top level items do not have parents + and the \l{QAbstractItemModel::}{parent()} method will return a default + constructed \l{QModelIndex}{QModelIndex()}. This is why we use the \l{QAbstractItemModel::}{parent()} method to iterate to the top level while counting the steps performed during iteration. The selection model (as shown above) can be retrieved, but it can also be set with \l{QAbstractItemView}{QAbstractItemView::setSelectionModel}. This is how it's possible to have 3 view classes with synchronised selections - because only one instance of a selection model is used. The instance of a - selection model is retrieved from the first view class with - \l{QAbstractItemView::}{selectionModel()} and the result is assigned to the - second and third view class with \l{QAbstractItemView::}{setSelectionModel()}. + because only one instance of a selection model is used. To share a selection + model between 3 views use \l{QAbstractItemView::}{selectionModel()} and + assign the result to the second and third view class with + \l{QAbstractItemView::}{setSelectionModel()}. \section2 3.3 Predefined Models - The typical way to use model/view is to wrap specific data to make it - usable with view classes. Qt, however, also provides predefined models for - common underlying data structures. If one of the available data structures - is suitable for your application, a predefined model can be a good choice. + The typical way to use model/view is to wrap specific data to make it usable + with view classes. Qt, however, also provides predefined models for common + underlying data structures. If one of the available data structures is + suitable for your application, a predefined model can be a good choice. \table \row @@ -531,26 +515,26 @@ and is edited as text or a checkbox. The component that provides these presentation and editing services is called a \e delegate. We are only just beginning to work with the delegate because the view uses a default - delegate. But imagine that we want to have a different editor.(e.g. a + delegate. But imagine that we want to have a different editor (e.g., a slider or a drop down list) Or imagine that we want to present data as - graphics. Let's take a look at an example called - \l{Star Delegate Example}{Star Delegate}, in which stars are used to show - a rating: + graphics. + Let's take a look at an example called \l{Star Delegate Example}{Star + Delegate}, in which stars are used to show a rating: + \image stardelegate.png - The view has a method that replaces the default delegate and installs a - custom delegate. This method is called - \l{QAbstractItemView::}{setItemDelegate()}. A new delegate can be written - by creating a class that inherits from QStyledItemDelegate. In order to - write a delegate that displays stars and has no input capabilities, we only - need to overwrite 2 methods. + The view has a \l{QAbstractItemView::}{setItemDelegate()} method that + replaces the default delegate and installs a custom delegate. + A new delegate can be written by creating a class that inherits from + QStyledItemDelegate. In order to write a delegate that displays stars and + has no input capabilities, we only need to override 2 methods. \code class StarDelegate : public QStyledItemDelegate { Q_OBJECT public: - StarDelegate(QWidget *parent = 0); + StarDelegate(QWidget *parent = 0); void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; QSize sizeHint(const QStyleOptionViewItem &option, @@ -558,16 +542,28 @@ }; \endcode - \l{QStyledItemDelegate::}{paint()} draws stars depending on the content - of the underlying data. The data can be looked up with parameter - \l{QModelIndex::data()}{index.data()}. - \l{QAbstractItemDelegate::}{sizeHint()} specifies each star's dimensions - so the the cell will provide enough height and width to accommodate the - stars. + \l{QStyledItemDelegate::}{paint()} draws stars depending on the content of + the underlying data. The data can be looked up by calling + \l{QModelIndex::data()}{index.data()}. The delegate's + \l{QAbstractItemDelegate::}{sizeHint()} method is used to obtain each + star's dimensions, so the the cell will provide enough height and width to + accommodate the stars. Writing custom delegates is the right choice if you want to show your data - with a custom graphical representation inside the grid of the view class. - If you want to leave the grid, you can write a custom view class. + with a custom graphical representation inside the grid of the view class. If + you want to leave the grid, you would not use a custom delegate but a custom + view class. + + Other references to delegates in Qt Documentation: + + \list + \o \l{Spin Box Delegate Example} + \o \l{QAbstractItemDelegate}{QAbstractItemDelegate Class Reference} + \o \l{QSqlRelationalDelegate}{QSqlRelationalDelegate Class Reference} + \o \l{QStyledItemDelegate}{QStyledItemDelegate Class Reference} + \o \l{QItemDelegate}{QItemDelegate Class Reference} + \endlist + \section2 3.5 Debugging with ModelTest @@ -575,9 +571,9 @@ Inconsistencies in the model can cause the application to crash. Since the model is hit by numerous calls from the view, it is hard to find out which call has crashed the application and which operation has introduced the - problem. + problem. - Qt provides software called + Qt Labs provides software called \l{http://labs.qt.nokia.com/page/Projects/Itemview/Modeltest}{ModelTest}, which checks models while your programming is running. Every time the model is changed, ModelTest scans the model and reports errors with an assert. @@ -586,57 +582,9 @@ Unlike view classes, ModelTest uses out of range indexes to test the model. This means your application may crash with ModelTest even if it runs - perfectly without it. So you also need to handle all of the indexes that - are out of range when using ModelTest. - - - \section2 3.6 Model/View NG - - \raw HTML - <table style="background-color:white;border:none;font: normal 13px/1.2 Verdana;"> - <tr><td align="left" valign="top" style="background-color:white;border:none;padding:5px;"> - \endraw - - \raw HTML - <!-- wrap content table p has 0 padding and the padding for p outside of the table is 5px--> - \endraw - - Model/View was introduced in Qt 4.0 and is a frequently used technology. - Feedback from developers and new development trends have shown that there - is a need to further develop the model/view technology. Therefore a - research project originated at Nokia is looking into ways to go beyond the - current implementation. - - One limitation of model/view is that view classes are basically all fixed - grids. It is possible, but really hard to make a list view with icons - placed on a curve; or cells expanding on mouse over events to show - additional information. - In order to achieve graphically rich view experiences, Model/View NG will - use QGraphicsView to render elements. Nodel/View NG also aims to make - model/view programming more intuitive. One way to achieve this is to have - separate models for lists, tables and trees. The current model abstraction - is complex because it is capable of representing a list, a table or a tree. - - Model/View NG is a research project. You are welcome to checkout the source - code, monitor progress and take part in discussions at the following - address: \l{http://labs.qt.nokia.com/page/Projects/Itemview/ItemviewsNG} - - \raw HTML - </td><td align="right" valign="top"> - \endraw - - \inlineimage path.png - - \raw HTML - </td></tr></table> - \endraw -*/ + perfectly without it. So you also need to handle all of the indexes that are + out of range when using ModelTest. -/*! - \page modelview-part4.html - \contentspage {modelview-index.html}{Model/View Contents} - \previouspage {modelview-part3.html}{Intermediate Topics} - \title Model/View Chapter 4 - Good Sources of Additional Information \section1 4. Good Sources of Additional Information @@ -666,10 +614,10 @@ \table \header - \o example name - \o view class used - \o model used - \o aspects touched + \o Example name + \o View class used + \o Model used + \o Aspects covered \o \row \o Team Leaders @@ -695,26 +643,26 @@ \o QTableView \o custom model based on QAbstractTableModel - \o read only + \o Read only \o Book 1, Chapter 10, Figure 10.10 \row \o Cities \o QTableView - \o custom model based on + \o Custom model based on QAbstractTableModel - \o read / write + \o Read / write \o Book 1, Chapter 10, Figure 10.12 \row \o Boolean Parser \o QTreeView - \o custom model based on + \o Custom model based on QAbstractItemModel - \o read only + \o Read only \o Book 1, Chapter 10, Figure 10.14 \row \o Track Editor \o {2, 1} QTableWidget - \o custom delegate providing a custom editor + \o Custom delegate providing a custom editor \o Book 1, Chapter 10, Figure 10.15 \row @@ -723,47 +671,47 @@ QTableView QTreeView \o QDirModel - \o demonstrates the use of multiple views + \o Demonstrates the use of multiple views \o Book2, Chapter 8.2 \row \o Address Book \o QListView QTableView QTreeView - \o custom model based on + \o Custom model based on QAbstractTableModel - \o read / write + \o Read / write \o Book2, Chapter 8.4 \row \o Address Book with sorting \o \o QProxyModel - \o introducing sort and filter capabilities + \o Introducing sort and filter capabilities \o Book2, Chapter 8.5 \row \o Address Book with checkboxes \o \o - \o introducing checkboxes in model/view + \o Introducing checkboxes in model/view \o Book2, Chapter 8.6 \row \o Address Book with transposed grid \o - \o custom proxy Model based on QAbstractProxyModel - \o introducing a custom model + \o Custom proxy Model based on QAbstractProxyModel + \o Introducing a custom model \o Book2, Chapter 8.7 \row \o Address Book with drag and drop \o \o - \o introducing drag and drop support + \o Introducing drag and drop support \o Book2, Chapter 8.8 \row \o Address Book with custom editor \o \o - \o introducing custom delegates + \o Introducing custom delegates \o Book2, Chapter 8.9 \row \o Views @@ -771,51 +719,51 @@ QTableView QTreeView \o QStandardItemModel - \o read only + \o Read only \o Book 3, Chapter 5, figure 5-3 \row \o Bardelegate \o QTableView \o - \o custom delegate for presentation based on QAbstractItemDelegate + \o Custom delegate for presentation based on QAbstractItemDelegate \o Book 3, Chapter 5, figure 5-5 \row \o Editdelegate \o QTableView \o - \o custom delegate for editing based on QAbstractItemDelegate + \o Custom delegate for editing based on QAbstractItemDelegate \o Book 3, Chapter 5, figure 5-6 \row \o Singleitemview - \o custom view based on QAbstractItemView + \o Custom view based on QAbstractItemView \o - \o custom view + \o Custom view \o Book 3, Chapter 5, figure 5-7 \row \o listmodel \o QTableView - \o custom Model based on QAbstractTableModel - \o read only + \o Custom Model based on QAbstractTableModel + \o Read only \o Book 3, Chapter 5, Figure 5-8 \row \o treemodel \o QTreeView - \o custom Model based on QAbstractItemModel - \o read only + \o Custom Model based on QAbstractItemModel + \o Read only \o Book 3, Chapter 5, Figure 5-10 \row \o edit integers \o QListView - \o custom Model based on QAbstractListModel - \o read / write + \o Custom Model based on QAbstractListModel + \o Read / write \o Book 3, Chapter 5, Listing 5-37, Figure 5-11 \row \o sorting \o QTableView \o QSortFilterProxyModel applied to QStringListModel - \o demonstrates sorting + \o Demonstrates sorting \o Book 3, Chapter 5, Figure 5-12 \endtable @@ -823,19 +771,20 @@ \section2 4.2 Qt Documentation Qt 4.7 comes with 17 examples and 2 Demonstrations for model/view. - The examples can be found here: \l{Item Views Examples} + The examples can be found on the \l{Item Views Examples} page. + \table \header \o Example name \o View class used \o Model used - \o Aspects touched + \o Aspects covered \row \o Address Book \o QTableView \o QAbstractTableModel QSortFilterProxyModel - \o usage of QSortFilterProxyModel to generate different + \o Usage of QSortFilterProxyModel to generate different subsets from one data pool \row \o Basic Sort/Filter Model @@ -845,41 +794,41 @@ \o \row \o Chart - \o custom view + \o Custom view \o QStandardItemModel - \o designing custom views that cooperate with selection models + \o Designing custom views that cooperate with selection models \row \o Color Editor Factory \o {2, 1} QTableWidget - \o enhancing the standard delegate with a new custom editor to choose colours + \o Enhancing the standard delegate with a new custom editor to choose colours \row \o Combo Widget Mapper \o QDataWidgetMapper to map QLineEdit, QTextEdit and QComboBox \o QStandardItemModel - \o shows how a QComboBox can serve as a view class + \o Shows how a QComboBox can serve as a view class \row \o Custom Sort/Filter Model \o QTreeView \o QStandardItemModel QSortFilterProxyModel - \o subclass QSortFilterProxyModel for advanced sorting and filtering + \o Subclass QSortFilterProxyModel for advanced sorting and filtering \row \o Dir View \o QTreeView \o QDirModel - \o very small example to demonstrate how to assign a model to a view + \o Very small example to demonstrate how to assign a model to a view \row \o Editable Tree Model \o QTreeView - \o custom tree model - \o comprehensive example for working with trees, demonstrates + \o Custom tree model + \o Comprehensive example for working with trees, demonstrates editing cells and tree structure with an underlying custom model \row \o Fetch More \o QListView - \o custom list model - \o dynamically changing model + \o Custom list model + \o Dynamically changing model \row \o Frozen Column \o QTableView @@ -888,47 +837,47 @@ \row \o Pixelator \o QTableView - \o custom table model - \o implementation of a custom delegate + \o Custom table model + \o Implementation of a custom delegate \row \o Puzzle \o QListView - \o custom list model - \o model/view with drag and drop + \o Custom list model + \o Model/view with drag and drop \row \o Simple DOM Model \o QTreeView - \o custom tree model - \o read only example for a custom tree model + \o Custom tree model + \o Read only example for a custom tree model \row \o Simple Tree Model \o QTreeView - \o custom tree model - \o read only example for a custom tree model + \o Custom tree model + \o Read only example for a custom tree model \row \o Simple Widget Mapper \o QDataWidgetMapper to map QLineEdit, QTextEdit and QSpinBox \o QStandardItemModel - \o basic QDataWidgetMapper usage + \o Basic QDataWidgetMapper usage \row \o Spin Box Delegate \o QTableView \o QStandardItemModel - \o custom delegate that uses a spin box as a cell editor + \o Custom delegate that uses a spin box as a cell editor \row \o Star Delegate \o {2, 1} QTableWidget - \o comprehensive custom delegate example. + \o Comprehensive custom delegate example. \endtable - \l{Qt Demonstrations}{Demonstrations} are similar to examples except - that no walkthrough is provided for the code. Demonstrations are also - sometimes more feature rich. + \l{Qt Demonstrations}{Demonstrations} are similar to examples except that no + walkthrough is provided for the code. Demonstrations are typically more + feature rich than examples. \list \o The \bold Interview demonstration shows the same model and selection being shared between three different views. - \o Demonstration \bold Spreadsheet demonstrates the use of a + \o The \bold Spreadsheet demonstration illustrates the use of a table view as a spreadsheet, using custom delegates to render each item according to the type of data it contains. \endlist @@ -936,3 +885,9 @@ A \l{Model/View Programming}{reference document} for model/view technology is also available. */ + +/*! + \page modelview-part2-main-cpp.html + \title main.cpp + \quotefile tutorials/modelview/1_readonly/main.cpp +*/ diff --git a/examples/declarative/animation/easing/content/QuitButton.qml b/examples/declarative/animation/easing/content/QuitButton.qml new file mode 100644 index 0000000..039694d --- /dev/null +++ b/examples/declarative/animation/easing/content/QuitButton.qml @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** 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 QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 +Image { + source: "quit.png" + scale: quitMouse.pressed ? 0.8 : 1.0 + smooth: quitMouse.pressed + MouseArea { + id: quitMouse + anchors.fill: parent + anchors.margins: -10 + onClicked: Qt.quit() + } +}
\ No newline at end of file diff --git a/examples/declarative/animation/easing/content/quit.png b/examples/declarative/animation/easing/content/quit.png Binary files differnew file mode 100644 index 0000000..b822057 --- /dev/null +++ b/examples/declarative/animation/easing/content/quit.png diff --git a/examples/declarative/animation/easing/easing.qml b/examples/declarative/animation/easing/easing.qml index 9cdbad1..b53cb98 100644 --- a/examples/declarative/animation/easing/easing.qml +++ b/examples/declarative/animation/easing/easing.qml @@ -39,6 +39,7 @@ ****************************************************************************/ import Qt 4.7 +import "content" Rectangle { id: window @@ -134,11 +135,23 @@ Rectangle { } Flickable { - anchors.fill: parent; contentHeight: layout.height - + anchors.fill: parent + contentHeight: layout.height + Rectangle { + id: titlePane + color: "#444444" + height: 35 + anchors { top: parent.top; left: parent.left; right: parent.right } + QuitButton { + id: quitButton + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: 10 + } + } Column { id: layout - anchors.left: parent.left; anchors.right: parent.right + anchors { top: titlePane.bottom; topMargin: 10; left: parent.left; right: parent.right } Repeater { model: easingTypes; delegate: delegate } } } diff --git a/examples/declarative/toys/clocks/clocks.qml b/examples/declarative/toys/clocks/clocks.qml index 124e391..82a1dbf 100644 --- a/examples/declarative/toys/clocks/clocks.qml +++ b/examples/declarative/toys/clocks/clocks.qml @@ -51,4 +51,9 @@ Rectangle { Clock { city: "Mumbai"; shift: 5.5 } Clock { city: "Tokyo"; shift: 9 } } + QuitButton { + anchors.right: parent.right + anchors.top: parent.top + anchors.margins: 10 + } } diff --git a/examples/declarative/toys/clocks/content/QuitButton.qml b/examples/declarative/toys/clocks/content/QuitButton.qml new file mode 100644 index 0000000..039694d --- /dev/null +++ b/examples/declarative/toys/clocks/content/QuitButton.qml @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** 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 QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 +Image { + source: "quit.png" + scale: quitMouse.pressed ? 0.8 : 1.0 + smooth: quitMouse.pressed + MouseArea { + id: quitMouse + anchors.fill: parent + anchors.margins: -10 + onClicked: Qt.quit() + } +}
\ No newline at end of file diff --git a/examples/declarative/toys/clocks/content/quit.png b/examples/declarative/toys/clocks/content/quit.png Binary files differnew file mode 100644 index 0000000..b822057 --- /dev/null +++ b/examples/declarative/toys/clocks/content/quit.png diff --git a/examples/declarative/ui-components/dialcontrol/content/QuitButton.qml b/examples/declarative/ui-components/dialcontrol/content/QuitButton.qml new file mode 100644 index 0000000..039694d --- /dev/null +++ b/examples/declarative/ui-components/dialcontrol/content/QuitButton.qml @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** 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 QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 +Image { + source: "quit.png" + scale: quitMouse.pressed ? 0.8 : 1.0 + smooth: quitMouse.pressed + MouseArea { + id: quitMouse + anchors.fill: parent + anchors.margins: -10 + onClicked: Qt.quit() + } +}
\ No newline at end of file diff --git a/examples/declarative/ui-components/dialcontrol/content/quit.png b/examples/declarative/ui-components/dialcontrol/content/quit.png Binary files differnew file mode 100644 index 0000000..b822057 --- /dev/null +++ b/examples/declarative/ui-components/dialcontrol/content/quit.png diff --git a/examples/declarative/ui-components/dialcontrol/dialcontrol.qml b/examples/declarative/ui-components/dialcontrol/dialcontrol.qml index 46cc3e6..a7da5c6 100644 --- a/examples/declarative/ui-components/dialcontrol/dialcontrol.qml +++ b/examples/declarative/ui-components/dialcontrol/dialcontrol.qml @@ -88,5 +88,10 @@ Rectangle { } } } + QuitButton { + anchors.right: parent.right + anchors.top: parent.top + anchors.margins: 10 + } } //! [0] diff --git a/examples/sql/masterdetail/mainwindow.cpp b/examples/sql/masterdetail/mainwindow.cpp index b8c9df6..2ef8ad0 100644 --- a/examples/sql/masterdetail/mainwindow.cpp +++ b/examples/sql/masterdetail/mainwindow.cpp @@ -189,9 +189,9 @@ void MainWindow::deleteAlbum() QMessageBox::StandardButton button; button = QMessageBox::question(this, tr("Delete Album"), - QString(tr("Are you sure you want to " \ - "delete '%1' by '%2'?")) - .arg(title).arg(artist), + tr("Are you sure you want to " + "delete '%1' by '%2'?") + .arg(title, artist), QMessageBox::Yes | QMessageBox::No); if (button == QMessageBox::Yes) { diff --git a/examples/tools/treemodelcompleter/mainwindow.cpp b/examples/tools/treemodelcompleter/mainwindow.cpp index 0448e9d..cfe003a 100644 --- a/examples/tools/treemodelcompleter/mainwindow.cpp +++ b/examples/tools/treemodelcompleter/mainwindow.cpp @@ -241,6 +241,6 @@ void MainWindow::changeCase(int cs) void MainWindow::updateContentsLabel(const QString& sep) { - contentsLabel->setText(QString(tr("Type path from model above with items at each level separated by a '%1'")).arg(sep)); + contentsLabel->setText(tr("Type path from model above with items at each level separated by a '%1'").arg(sep)); } diff --git a/examples/tutorials/modelview/1_readonly/1_readonly.pro b/examples/tutorials/modelview/1_readonly/1_readonly.pro index 1162d5a..3ecebc2 100644..100755 --- a/examples/tutorials/modelview/1_readonly/1_readonly.pro +++ b/examples/tutorials/modelview/1_readonly/1_readonly.pro @@ -3,8 +3,15 @@ TARGET = mv_readonly TEMPLATE = app SOURCES += main.cpp \ - modelview.cpp \ mymodel.cpp -HEADERS += modelview.h \ - mymodel.h +HEADERS += mymodel.h + + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tutorials/modelview/1_readonly +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS 1_readonly.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tutorials/modelview/1_readonly +INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) diff --git a/examples/tutorials/modelview/1_readonly/main.cpp b/examples/tutorials/modelview/1_readonly/main.cpp index fb4726a..2143854 100644..100755 --- a/examples/tutorials/modelview/1_readonly/main.cpp +++ b/examples/tutorials/modelview/1_readonly/main.cpp @@ -41,13 +41,16 @@ //! [Quoting ModelView Tutorial] // main.cpp #include <QtGui/QApplication> -#include "modelview.h" +#include <QtGui/QTableView> +#include "mymodel.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); - ModelView w; - w.show(); + QTableView tableView; + MyModel myModel(0); + tableView.setModel( &myModel ); + tableView.show(); return a.exec(); } //! [Quoting ModelView Tutorial] diff --git a/examples/tutorials/modelview/1_readonly/modelview.cpp b/examples/tutorials/modelview/1_readonly/modelview.cpp deleted file mode 100644 index 91a97bf..0000000 --- a/examples/tutorials/modelview/1_readonly/modelview.cpp +++ /dev/null @@ -1,54 +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 examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [Quoting ModelView Tutorial] -// modelview.cpp -#include <QTableView> -#include "modelview.h" -#include "mymodel.h" - -ModelView::ModelView(QWidget *parent) - : QMainWindow(parent) -{ - tableView = new QTableView(this); - setCentralWidget(tableView); - tableView->setModel(new MyModel(this)); -} -//! [Quoting ModelView Tutorial] diff --git a/examples/tutorials/modelview/1_readonly/mymodel.cpp b/examples/tutorials/modelview/1_readonly/mymodel.cpp index 394605a..394605a 100644..100755 --- a/examples/tutorials/modelview/1_readonly/mymodel.cpp +++ b/examples/tutorials/modelview/1_readonly/mymodel.cpp diff --git a/examples/tutorials/modelview/1_readonly/mymodel.h b/examples/tutorials/modelview/1_readonly/mymodel.h index 6065f6e..6065f6e 100644..100755 --- a/examples/tutorials/modelview/1_readonly/mymodel.h +++ b/examples/tutorials/modelview/1_readonly/mymodel.h diff --git a/examples/tutorials/modelview/2_formatting/2_formatting.pro b/examples/tutorials/modelview/2_formatting/2_formatting.pro index 7e70d81..c6ad27c 100644..100755 --- a/examples/tutorials/modelview/2_formatting/2_formatting.pro +++ b/examples/tutorials/modelview/2_formatting/2_formatting.pro @@ -3,8 +3,14 @@ TARGET = mv_formatting TEMPLATE = app SOURCES += main.cpp \ - modelview.cpp \ mymodel.cpp -HEADERS += modelview.h \ - mymodel.h +HEADERS += mymodel.h + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tutorials/modelview/2_formatting +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS 2_formatting.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tutorials/modelview/2_formatting +INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) diff --git a/examples/tutorials/modelview/2_formatting/main.cpp b/examples/tutorials/modelview/2_formatting/main.cpp index 7be212e..2143854 100644..100755 --- a/examples/tutorials/modelview/2_formatting/main.cpp +++ b/examples/tutorials/modelview/2_formatting/main.cpp @@ -38,13 +38,19 @@ ** ****************************************************************************/ +//! [Quoting ModelView Tutorial] +// main.cpp #include <QtGui/QApplication> -#include "modelview.h" +#include <QtGui/QTableView> +#include "mymodel.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); - ModelView w; - w.show(); + QTableView tableView; + MyModel myModel(0); + tableView.setModel( &myModel ); + tableView.show(); return a.exec(); } +//! [Quoting ModelView Tutorial] diff --git a/examples/tutorials/modelview/2_formatting/mymodel.cpp b/examples/tutorials/modelview/2_formatting/mymodel.cpp index f7ff504..3e13ff4 100644..100755 --- a/examples/tutorials/modelview/2_formatting/mymodel.cpp +++ b/examples/tutorials/modelview/2_formatting/mymodel.cpp @@ -43,8 +43,6 @@ #include "mymodel.h" #include <QDebug> -//! [Quoting ModelView Tutorial] -// mymodel.cpp MyModel::MyModel(QObject *parent) :QAbstractTableModel(parent) { @@ -60,6 +58,8 @@ int MyModel::columnCount(const QModelIndex & /*parent */) const return 3; } +//! [Quoting ModelView Tutorial] +// mymodel.cpp QVariant MyModel::data(const QModelIndex &index, int role) const { int row = index.row(); @@ -89,7 +89,7 @@ QVariant MyModel::data(const QModelIndex &index, int role) const if (row == 1 && col == 2) //change background only for cell(1,2) { - QBrush redBackground = QBrush(Qt::red); + QBrush redBackground(QColor(Qt::red)); return redBackground; } break; diff --git a/examples/tutorials/modelview/2_formatting/mymodel.h b/examples/tutorials/modelview/2_formatting/mymodel.h index 4dc405a..4dc405a 100644..100755 --- a/examples/tutorials/modelview/2_formatting/mymodel.h +++ b/examples/tutorials/modelview/2_formatting/mymodel.h diff --git a/examples/tutorials/modelview/3_changingmodel/3_changingmodel.pro b/examples/tutorials/modelview/3_changingmodel/3_changingmodel.pro index d61ee4c..e977731 100644..100755 --- a/examples/tutorials/modelview/3_changingmodel/3_changingmodel.pro +++ b/examples/tutorials/modelview/3_changingmodel/3_changingmodel.pro @@ -3,8 +3,14 @@ TARGET = mv_changingmodel TEMPLATE = app SOURCES += main.cpp \ - modelview.cpp \ mymodel.cpp -HEADERS += modelview.h \ - mymodel.h +HEADERS += mymodel.h + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tutorials/modelview/3_changingmodel +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS 3_changingmodel.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tutorials/modelview/3_changingmodel +INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) diff --git a/examples/tutorials/modelview/3_changingmodel/main.cpp b/examples/tutorials/modelview/3_changingmodel/main.cpp index 7be212e..3b6061a 100644..100755 --- a/examples/tutorials/modelview/3_changingmodel/main.cpp +++ b/examples/tutorials/modelview/3_changingmodel/main.cpp @@ -39,12 +39,15 @@ ****************************************************************************/ #include <QtGui/QApplication> -#include "modelview.h" +#include <QtGui/QTableView> +#include "mymodel.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); - ModelView w; - w.show(); + QTableView tableView; + MyModel myModel(0); + tableView.setModel( &myModel ); + tableView.show(); return a.exec(); } diff --git a/examples/tutorials/modelview/3_changingmodel/mymodel.cpp b/examples/tutorials/modelview/3_changingmodel/mymodel.cpp index 42915b0..42915b0 100644..100755 --- a/examples/tutorials/modelview/3_changingmodel/mymodel.cpp +++ b/examples/tutorials/modelview/3_changingmodel/mymodel.cpp diff --git a/examples/tutorials/modelview/3_changingmodel/mymodel.h b/examples/tutorials/modelview/3_changingmodel/mymodel.h index 01ad88d..47b026e 100644..100755 --- a/examples/tutorials/modelview/3_changingmodel/mymodel.h +++ b/examples/tutorials/modelview/3_changingmodel/mymodel.h @@ -43,7 +43,7 @@ #include <QAbstractTableModel> -QT_FORWARD_DECLARE_CLASS(QTimer) +class QTimer; // forward declaration class MyModel : public QAbstractTableModel { diff --git a/examples/tutorials/modelview/4_headers/4_headers.pro b/examples/tutorials/modelview/4_headers/4_headers.pro index d6f8d23..f6c60b2 100644..100755 --- a/examples/tutorials/modelview/4_headers/4_headers.pro +++ b/examples/tutorials/modelview/4_headers/4_headers.pro @@ -2,9 +2,15 @@ TARGET = mv_headers TEMPLATE = app -SOURCES += main.cpp \ - modelview.cpp \ +SOURCES += main.cpp \ mymodel.cpp -HEADERS += modelview.h \ - mymodel.h +HEADERS += mymodel.h + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tutorials/modelview/4_headers +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS 4_headers.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tutorials/modelview/4_headers +INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) diff --git a/examples/tutorials/modelview/4_headers/main.cpp b/examples/tutorials/modelview/4_headers/main.cpp index 7be212e..5f5d05f 100644..100755 --- a/examples/tutorials/modelview/4_headers/main.cpp +++ b/examples/tutorials/modelview/4_headers/main.cpp @@ -39,12 +39,15 @@ ****************************************************************************/ #include <QtGui/QApplication> -#include "modelview.h" +#include <QtGui/QTableView> +#include "mymodel.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); - ModelView w; - w.show(); + QTableView tableView; + MyModel myModel(0); + tableView.setModel( &myModel ); + tableView.show(); return a.exec(); -} +}
\ No newline at end of file diff --git a/examples/tutorials/modelview/4_headers/mymodel.cpp b/examples/tutorials/modelview/4_headers/mymodel.cpp index e6f977d..e6f977d 100644..100755 --- a/examples/tutorials/modelview/4_headers/mymodel.cpp +++ b/examples/tutorials/modelview/4_headers/mymodel.cpp diff --git a/examples/tutorials/modelview/4_headers/mymodel.h b/examples/tutorials/modelview/4_headers/mymodel.h index ada3169..ada3169 100644..100755 --- a/examples/tutorials/modelview/4_headers/mymodel.h +++ b/examples/tutorials/modelview/4_headers/mymodel.h diff --git a/examples/tutorials/modelview/5_edit/5_edit.pro b/examples/tutorials/modelview/5_edit/5_edit.pro index e18c596..2ef343f 100644..100755 --- a/examples/tutorials/modelview/5_edit/5_edit.pro +++ b/examples/tutorials/modelview/5_edit/5_edit.pro @@ -3,8 +3,16 @@ TARGET = mv_edit TEMPLATE = app SOURCES += main.cpp \ - modelview.cpp \ + mainwindow.cpp \ mymodel.cpp -HEADERS += modelview.h \ +HEADERS += mainwindow.h \ mymodel.h + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tutorials/modelview/5_edit +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS 5_edit.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tutorials/modelview/5_edit +INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) diff --git a/examples/tutorials/modelview/5_edit/main.cpp b/examples/tutorials/modelview/5_edit/main.cpp index 7be212e..59e82ef 100644..100755 --- a/examples/tutorials/modelview/5_edit/main.cpp +++ b/examples/tutorials/modelview/5_edit/main.cpp @@ -39,12 +39,12 @@ ****************************************************************************/ #include <QtGui/QApplication> -#include "modelview.h" +#include "mainwindow.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); - ModelView w; + MainWindow w; w.show(); return a.exec(); } diff --git a/examples/tutorials/modelview/5_edit/modelview.cpp b/examples/tutorials/modelview/5_edit/mainwindow.cpp index a6c6ef5..542f3d6 100644..100755 --- a/examples/tutorials/modelview/5_edit/modelview.cpp +++ b/examples/tutorials/modelview/5_edit/mainwindow.cpp @@ -39,10 +39,10 @@ ****************************************************************************/ #include <QTableView> -#include "modelview.h" +#include "mainwindow.h" #include "mymodel.h" -ModelView::ModelView(QWidget *parent) +MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { tableView = new QTableView(this); @@ -54,7 +54,7 @@ ModelView::ModelView(QWidget *parent) connect(myModel, SIGNAL(editCompleted(const QString &)), this, SLOT(setWindowTitle(const QString &))); } -void ModelView::showWindowTitle(const QString & title) +void MainWindow::showWindowTitle(const QString & title) { setWindowTitle(title); } diff --git a/examples/tutorials/modelview/5_edit/modelview.h b/examples/tutorials/modelview/5_edit/mainwindow.h index 069107b..1d49f47 100644..100755 --- a/examples/tutorials/modelview/5_edit/modelview.h +++ b/examples/tutorials/modelview/5_edit/mainwindow.h @@ -38,22 +38,22 @@ ** ****************************************************************************/ -#ifndef MODELVIEW_H -#define MODELVIEW_H +#ifndef MAINWINDOW_H +#define MAINWINDOW_H #include <QtGui/QMainWindow> -QT_FORWARD_DECLARE_CLASS(QTableView) +class QTableView; //forward declaration -class ModelView : public QMainWindow +class MainWindow : public QMainWindow { Q_OBJECT private: QTableView *tableView; public: - ModelView(QWidget *parent = 0); + MainWindow(QWidget *parent = 0); public slots: void showWindowTitle(const QString & title); }; -#endif // MODELVIEW_H +#endif // MAINWINDOW_H diff --git a/examples/tutorials/modelview/5_edit/mymodel.cpp b/examples/tutorials/modelview/5_edit/mymodel.cpp index 67181ca..e2fd391 100644..100755 --- a/examples/tutorials/modelview/5_edit/mymodel.cpp +++ b/examples/tutorials/modelview/5_edit/mymodel.cpp @@ -38,62 +38,64 @@ ** ****************************************************************************/ -//! [quoting mymodel_d] + #include "mymodel.h" -const int COLS= 3; -const int ROWS= 2; MyModel::MyModel(QObject *parent) :QAbstractTableModel(parent) { - //gridData needs to have 6 element, one for each table cell - m_gridData << "1/1" << "1/2" << "1/3" << "2/1" << "2/2" << "2/3" ; } -//! [quoting mymodel_d] -//! [quoting mymodel_e] +//----------------------------------------------------------------- int MyModel::rowCount(const QModelIndex & /*parent*/) const { return ROWS; } +//----------------------------------------------------------------- int MyModel::columnCount(const QModelIndex & /*parent*/) const { return COLS; } +//----------------------------------------------------------------- QVariant MyModel::data(const QModelIndex &index, int role) const { if (role == Qt::DisplayRole) { - return m_gridData[modelIndexToOffset(index)]; + return m_gridData[index.row()][index.column()]; } return QVariant(); } -//! [quoting mymodel_e] //----------------------------------------------------------------- - -//! [quoting mymodel_f] +//! [quoting mymodel_e] bool MyModel::setData(const QModelIndex & index, const QVariant & value, int role) { if (role == Qt::EditRole) { - m_gridData[modelIndexToOffset(index)] = value.toString(); - emit editCompleted(m_gridData.join(" | ")); + //save value from editor to member m_gridData + m_gridData[index.row()][index.column()] = value.toString(); + //for presentation purposes only: build and emit a joined string + QString result; + for(int row= 0; row < ROWS; row++) + { + for(int col= 0; col < COLS; col++) + { + result += m_gridData[row][col] + " "; + } + } + emit editCompleted( result ); } return true; } +//! [quoting mymodel_e] +//----------------------------------------------------------------- +//! [quoting mymodel_f] Qt::ItemFlags MyModel::flags(const QModelIndex & /*index*/) const { return Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled ; } - -//convert row and column information to array offset -int MyModel::modelIndexToOffset(const QModelIndex & index) const -{ - return index.row()*COLS + index.column(); -} //! [quoting mymodel_f] diff --git a/examples/tutorials/modelview/5_edit/mymodel.h b/examples/tutorials/modelview/5_edit/mymodel.h index 0d2a1b8..574808e 100644..100755 --- a/examples/tutorials/modelview/5_edit/mymodel.h +++ b/examples/tutorials/modelview/5_edit/mymodel.h @@ -44,7 +44,11 @@ //! [Quoting ModelView Tutorial] // mymodel.h #include <QAbstractTableModel> -#include <QStringList> +#include <QString> + +const int COLS= 3; +const int ROWS= 2; + class MyModel : public QAbstractTableModel { @@ -57,8 +61,7 @@ public: bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole); Qt::ItemFlags flags(const QModelIndex & index) const ; private: - QStringList m_gridData; //holds text entered into QTableView - int modelIndexToOffset(const QModelIndex & index) const; + QString m_gridData[ROWS][COLS]; //holds text entered into QTableView signals: void editCompleted(const QString &); }; diff --git a/examples/tutorials/modelview/6_treeview/6_treeview.pro b/examples/tutorials/modelview/6_treeview/6_treeview.pro index 6d078be..e79ef20 100644..100755 --- a/examples/tutorials/modelview/6_treeview/6_treeview.pro +++ b/examples/tutorials/modelview/6_treeview/6_treeview.pro @@ -1,5 +1,13 @@ TARGET = mv_tree TEMPLATE = app SOURCES += main.cpp \ - modelview.cpp -HEADERS += modelview.h + mainwindow.cpp +HEADERS += mainwindow.h + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tutorials/modelview/6_treeview +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS 6_treeview.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tutorials/modelview/6_treeview +INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) diff --git a/examples/tutorials/modelview/6_treeview/main.cpp b/examples/tutorials/modelview/6_treeview/main.cpp index 7be212e..59e82ef 100644..100755 --- a/examples/tutorials/modelview/6_treeview/main.cpp +++ b/examples/tutorials/modelview/6_treeview/main.cpp @@ -39,12 +39,12 @@ ****************************************************************************/ #include <QtGui/QApplication> -#include "modelview.h" +#include "mainwindow.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); - ModelView w; + MainWindow w; w.show(); return a.exec(); } diff --git a/examples/tutorials/modelview/6_treeview/modelview.cpp b/examples/tutorials/modelview/6_treeview/mainwindow.cpp index 772dbdd..a105232 100644..100755 --- a/examples/tutorials/modelview/6_treeview/modelview.cpp +++ b/examples/tutorials/modelview/6_treeview/mainwindow.cpp @@ -43,40 +43,40 @@ #include <QTreeView> #include <QStandardItemModel> #include <QStandardItem> -#include "modelview.h" +#include "mainwindow.h" const int ROWS = 2; const int COLUMNS = 3; -ModelView::ModelView(QWidget *parent) +MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { treeView = new QTreeView(this); setCentralWidget(treeView); standardModel = new QStandardItemModel ; - QList<QStandardItem *> preparedColumn =prepareColumn("first", "second", "third"); + QList<QStandardItem *> preparedRow =prepareRow("first", "second", "third"); QStandardItem *item = standardModel->invisibleRootItem(); // adding a row to the invisible root item produces a root element - item->appendRow(preparedColumn); + item->appendRow(preparedRow); - QList<QStandardItem *> secondRow =prepareColumn("111", "222", "333"); + QList<QStandardItem *> secondRow =prepareRow("111", "222", "333"); // adding a row to an item starts a subtree - preparedColumn.first()->appendRow(secondRow); + preparedRow.first()->appendRow(secondRow); treeView->setModel(standardModel); treeView->expandAll(); } -QList<QStandardItem *> ModelView::prepareColumn(const QString &first, +QList<QStandardItem *> MainWindow::prepareRow(const QString &first, const QString &second, const QString &third) { - QList<QStandardItem *> colItems; - colItems << new QStandardItem(first); - colItems << new QStandardItem(second); - colItems << new QStandardItem(third); - return colItems; + QList<QStandardItem *> rowItems; + rowItems << new QStandardItem(first); + rowItems << new QStandardItem(second); + rowItems << new QStandardItem(third); + return rowItems; } //! [Quoting ModelView Tutorial] diff --git a/examples/tutorials/modelview/6_treeview/modelview.h b/examples/tutorials/modelview/6_treeview/mainwindow.h index 55f3470..fb8de79 100644..100755 --- a/examples/tutorials/modelview/6_treeview/modelview.h +++ b/examples/tutorials/modelview/6_treeview/mainwindow.h @@ -38,28 +38,27 @@ ** ****************************************************************************/ -#ifndef MODELVIEW_H -#define MODELVIEW_H +#ifndef MAINWINDOW_H +#define MAINWINDOW_H #include <QtGui/QMainWindow> -QT_BEGIN_NAMESPACE class QTreeView; //forward declaration class QStandardItemModel; class QStandardItem; -QT_END_NAMESPACE -class ModelView : public QMainWindow + +class MainWindow : public QMainWindow { Q_OBJECT private: QTreeView *treeView; QStandardItemModel *standardModel; - QList<QStandardItem *> prepareColumn(const QString &first, - const QString &second, - const QString &third); + QList<QStandardItem *> prepareRow( const QString &first, + const QString &second, + const QString &third ); public: - ModelView(QWidget *parent = 0); + MainWindow(QWidget *parent = 0); }; -#endif // MODELVIEW_H +#endif // MAINWINDOW_H diff --git a/examples/tutorials/modelview/7_selections/7_selections.pro b/examples/tutorials/modelview/7_selections/7_selections.pro index 952641c6..6945bf7 100644..100755 --- a/examples/tutorials/modelview/7_selections/7_selections.pro +++ b/examples/tutorials/modelview/7_selections/7_selections.pro @@ -1,5 +1,13 @@ TARGET = mv_selections TEMPLATE = app SOURCES += main.cpp \ - modelview.cpp -HEADERS += modelview.h + mainwindow.cpp +HEADERS += mainwindow.h + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tutorials/modelview/7_selections +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS 7_selections.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tutorials/modelview/7_selections +INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) diff --git a/examples/tutorials/modelview/7_selections/main.cpp b/examples/tutorials/modelview/7_selections/main.cpp index 7be212e..59e82ef 100644..100755 --- a/examples/tutorials/modelview/7_selections/main.cpp +++ b/examples/tutorials/modelview/7_selections/main.cpp @@ -39,12 +39,12 @@ ****************************************************************************/ #include <QtGui/QApplication> -#include "modelview.h" +#include "mainwindow.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); - ModelView w; + MainWindow w; w.show(); return a.exec(); } diff --git a/examples/tutorials/modelview/7_selections/modelview.cpp b/examples/tutorials/modelview/7_selections/mainwindow.cpp index 3b373c6..cb09633 100644..100755 --- a/examples/tutorials/modelview/7_selections/modelview.cpp +++ b/examples/tutorials/modelview/7_selections/mainwindow.cpp @@ -42,9 +42,9 @@ #include <QTreeView> #include <QStandardItemModel> #include <QItemSelectionModel> -#include "modelview.h" +#include "mainwindow.h" -ModelView::ModelView(QWidget *parent) +MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { treeView = new QTreeView(this); @@ -87,10 +87,12 @@ ModelView::ModelView(QWidget *parent) //------------------------------------------------------------------------------------ //! [quoting modelview_b] -void ModelView::selectionChangedSlot(const QItemSelection & /*newSelection*/, const QItemSelection & /*oldSelection*/) +void MainWindow::selectionChangedSlot(const QItemSelection & /*newSelection*/, const QItemSelection & /*oldSelection*/) { + //get the text of the selected item const QModelIndex index = treeView->selectionModel()->currentIndex(); QString selectedText = index.data(Qt::DisplayRole).toString(); + //find out the hierarchy level of the selected item int hierarchyLevel=1; QModelIndex seekRoot = index; while(seekRoot.parent() != QModelIndex()) diff --git a/examples/tutorials/modelview/7_selections/modelview.h b/examples/tutorials/modelview/7_selections/mainwindow.h index d20797e..f2defb5 100644..100755 --- a/examples/tutorials/modelview/7_selections/modelview.h +++ b/examples/tutorials/modelview/7_selections/mainwindow.h @@ -38,18 +38,17 @@ ** ****************************************************************************/ -#ifndef MODELVIEW_H -#define MODELVIEW_H +#ifndef MAINWINDOW_H +#define MAINWINDOW_H #include <QtGui/QMainWindow> -QT_BEGIN_NAMESPACE class QTreeView; //forward declaration class QStandardItemModel; class QItemSelection; -QT_END_NAMESPACE -class ModelView : public QMainWindow + +class MainWindow : public QMainWindow { Q_OBJECT private: @@ -58,7 +57,7 @@ private: private slots: void selectionChangedSlot(const QItemSelection & newSelection, const QItemSelection & oldSelection); public: - ModelView(QWidget *parent = 0); + MainWindow(QWidget *parent = 0); }; -#endif // MODELVIEW_H +#endif // MAINWINDOW_H diff --git a/examples/tutorials/modelview/modelview.pro b/examples/tutorials/modelview/modelview.pro index 7f684ba..50f5c3a 100644..100755 --- a/examples/tutorials/modelview/modelview.pro +++ b/examples/tutorials/modelview/modelview.pro @@ -1,5 +1,4 @@ -TEMPLATE = subdirs - +TEMPLATE = subdirs SUBDIRS = 1_readonly \ 2_formatting \ 3_changingmodel \ @@ -8,3 +7,10 @@ SUBDIRS = 1_readonly \ 6_treeview \ 7_selections +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tutorials/modelview +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS modelview.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tutorials/modelview +INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) diff --git a/examples/xmlpatterns/filetree/mainwindow.cpp b/examples/xmlpatterns/filetree/mainwindow.cpp index 5b9b0c3..85348f3 100644 --- a/examples/xmlpatterns/filetree/mainwindow.cpp +++ b/examples/xmlpatterns/filetree/mainwindow.cpp @@ -140,7 +140,7 @@ void MainWindow::loadDirectory(const QString &directory) QXmlFormatter formatter(query, &buffer); query.evaluateTo(&formatter); - treeInfo->setText((QString(tr("Model of %1 output as XML.")).arg(directory))); + treeInfo->setText(tr("Model of %1 output as XML.").arg(directory)); fileTree->setText(QString::fromLatin1(output.constData())); evaluateResult(); //! [6] diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index 04b81b0..61cc7d9 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -117,11 +117,12 @@ QMAKE_GZIP = gzip -9f QT_ARCH = symbian +load(qt_config) + # 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 -load(qt_config) load(symbian/platform_paths) # The Symbian^3 PDK does not necessarily contain the required sis files. diff --git a/mkspecs/features/sis_targets.prf b/mkspecs/features/sis_targets.prf index abdf2d4..e069ee1 100644 --- a/mkspecs/features/sis_targets.prf +++ b/mkspecs/features/sis_targets.prf @@ -11,6 +11,12 @@ else:!equals(DEPLOYMENT, default_deployment) { equals(GENERATE_SIS_TARGETS, true) { symbian-abld|symbian-sbsv2 { + symbian-sbsv2 { + CONVERT_GCCE_PARAM = -g + } else { + CONVERT_GCCE_PARAM = + } + make_cache_name = .make.cache sis_target.target = sis sis_target.commands = $(if $(wildcard $$basename(TARGET)_template.pkg), \ @@ -28,7 +34,7 @@ equals(GENERATE_SIS_TARGETS, true) { ) ok_sis_target.target = ok_sis - ok_sis_target.commands = createpackage.bat $(QT_SIS_OPTIONS) $$basename(TARGET)_template.pkg \ + ok_sis_target.commands = createpackage.bat $$CONVERT_GCCE_PARAM $(QT_SIS_OPTIONS) $$basename(TARGET)_template.pkg \ $(QT_SIS_TARGET) $(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE) unsigned_sis_target.target = unsigned_sis @@ -47,7 +53,7 @@ equals(GENERATE_SIS_TARGETS, true) { ) ok_unsigned_sis_target.target = ok_unsigned_sis - ok_unsigned_sis_target.commands = createpackage.bat $(QT_SIS_OPTIONS) -o $$basename(TARGET)_template.pkg $(QT_SIS_TARGET) + ok_unsigned_sis_target.commands = createpackage.bat $$CONVERT_GCCE_PARAM $(QT_SIS_OPTIONS) -o $$basename(TARGET)_template.pkg $(QT_SIS_TARGET) target_sis_target.target = $$basename(TARGET).sis target_sis_target.commands = $(MAKE) -f $(MAKEFILE) sis diff --git a/mkspecs/features/symbian/symbian_building.prf b/mkspecs/features/symbian/symbian_building.prf index 374fe21..414b081 100644 --- a/mkspecs/features/symbian/symbian_building.prf +++ b/mkspecs/features/symbian/symbian_building.prf @@ -114,14 +114,9 @@ isEmpty(capability): capability = "None" capability = "--capability=$$capability" contains(TEMPLATE, lib):!contains(CONFIG, static):!contains(CONFIG, staticlib) { - !isEmpty(QMAKE_POST_LINK) { - # No way to honor the '@' :-( - QMAKE_POST_LINK = $$replace(QMAKE_POST_LINK, "^@", "") - QMAKE_POST_LINK = && $$QMAKE_POST_LINK - } - contains(CONFIG, plugin):QMAKE_ELF2E32_FLAGS += --definput=plugin_commonu.def + !isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK = $$escape_expand(\\n\\t)$$QMAKE_POST_LINK QMAKE_POST_LINK = $$QMAKE_MOVE $$symbianDestdir/$${baseTarget}.dll $$symbianDestdir/$${baseTarget}.sym \ && $$QMAKE_ELF2E32_WRAPPER --version=$$decVersion \ --sid=$$TARGET.SID \ @@ -166,11 +161,7 @@ contains(TEMPLATE, lib):!contains(CONFIG, static):!contains(CONFIG, staticlib) { } contains(TEMPLATE, app):!contains(QMAKE_LINK, "^@:.*") { - !isEmpty(QMAKE_POST_LINK) { - # No way to honor the '@' :-( - QMAKE_POST_LINK = $$replace(QMAKE_POST_LINK, "^@", "") - QMAKE_POST_LINK = && $$QMAKE_POST_LINK - } + !isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK = $$escape_expand(\\n\\t)$$QMAKE_POST_LINK QMAKE_POST_LINK = $$QMAKE_MOVE $$symbianDestdir/$${baseTarget} $$symbianDestdir/$${baseTarget}.sym \ && $$QMAKE_ELF2E32_WRAPPER --version $$decVersion \ --sid=$$TARGET.SID \ diff --git a/mkspecs/features/unix/separate_debug_info.prf b/mkspecs/features/unix/separate_debug_info.prf index 40d52cb..8843c6d 100644 --- a/mkspecs/features/unix/separate_debug_info.prf +++ b/mkspecs/features/unix/separate_debug_info.prf @@ -1,8 +1,9 @@ !separate_debug_info_nocopy:!staticlib:!static:!contains(TEMPLATE, subdirs):!isEmpty(QMAKE_OBJCOPY) { - QMAKE_SEPARATE_DEBUG_INFO = (test -z \"$(DESTDIR)\" || cd \"$(DESTDIR)\" ; targ=`basename $(TARGET)`; $$QMAKE_OBJCOPY --only-keep-debug \"\$\$targ\" \"\$\$targ.debug\" && $$QMAKE_OBJCOPY --strip-debug \"\$\$targ\" && $$QMAKE_OBJCOPY --add-gnu-debuglink=\"\$\$targ.debug\" \"\$\$targ\" && chmod -x \"\$\$targ.debug\" ) ; + QMAKE_SEPARATE_DEBUG_INFO = test -z \"$(DESTDIR)\" || cd \"$(DESTDIR)\" ; targ=`basename $(TARGET)`; $$QMAKE_OBJCOPY --only-keep-debug \"\$\$targ\" \"\$\$targ.debug\" && $$QMAKE_OBJCOPY --strip-debug \"\$\$targ\" && $$QMAKE_OBJCOPY --add-gnu-debuglink=\"\$\$targ.debug\" \"\$\$targ\" && chmod -x \"\$\$targ.debug\" QMAKE_INSTALL_SEPARATE_DEBUG_INFO = test -z \"$(DESTDIR)\" || cd \"$(DESTDIR)\" ; $(INSTALL_FILE) `basename $(TARGET)`.debug $(INSTALL_ROOT)/\$\$target_path/ + !isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK = $$escape_expand(\\n\\t)$$QMAKE_POST_LINK QMAKE_POST_LINK = $$QMAKE_SEPARATE_DEBUG_INFO $$QMAKE_POST_LINK silent:QMAKE_POST_LINK = @echo creating $@.debug && $$QMAKE_POST_LINK diff --git a/mkspecs/features/vxworks.prf b/mkspecs/features/vxworks.prf index a910c69..e257cd7 100644 --- a/mkspecs/features/vxworks.prf +++ b/mkspecs/features/vxworks.prf @@ -22,20 +22,20 @@ isEmpty(VXWORKS_MUNCH_TOOL):VXWORKS_MUNCH_TOOL = $(WIND_BASE)/host/resource/huti shared|!staticlib:!lib { *-dcc { - VXWORKS_MUNCH_CMD = (targ=`basename $(TARGET)`; \ + VXWORKS_MUNCH_CMD = targ=`basename $(TARGET)`; \ ddump -Ng \"$(TARGET)\" | tclsh $$VXWORKS_MUNCH_TOOL -c $$VXWORKS_ARCH_MUNCH >\"$(OBJECTS_DIR)/\$\${targ}_ctdt.c\" && \ $$QMAKE_CC -c $$QMAKE_CFLAGS \"$(OBJECTS_DIR)/\$\${targ}_ctdt.c\" -o \"$(OBJECTS_DIR)/\$\${targ}_ctdt.o\" && \ $$QMAKE_LINK $$QMAKE_LFLAGS -X -r5 -r4 \"$(OBJECTS_DIR)/\$\${targ}_ctdt.o\" \"$(TARGET)\" -o \"$(TARGET).munched\" && \ mv \"$(TARGET).munched\" \"$(TARGET)\" && \ - chmod +x \"$(TARGET)\") + chmod +x \"$(TARGET)\" } *-g++ { - VXWORKS_MUNCH_CMD = (targ=`basename $(TARGET)`; \ + VXWORKS_MUNCH_CMD = targ=`basename $(TARGET)`; \ nm \"$(DESTDIR)$(TARGET)\" | tclsh $$VXWORKS_MUNCH_TOOL -c $$VXWORKS_ARCH_MUNCH >\"$(OBJECTS_DIR)/\$\${targ}_ctdt.c\" && \ $$QMAKE_CC -c $$QMAKE_CFLAGS -fdollars-in-identifiers \"$(OBJECTS_DIR)/\$\${targ}_ctdt.c\" -o \"$(OBJECTS_DIR)/\$\${targ}_ctdt.o\" && \ $$QMAKE_LINK $$QMAKE_LFLAGS -nostdlib -Wl,-X -T $(WIND_BASE)/target/h/tool/gnu/ldscripts/link.OUT \"$(OBJECTS_DIR)/\$\${targ}_ctdt.o\" \"$(DESTDIR)$(TARGET)\" -o \"$(DESTDIR)$(TARGET).munched\" && \ mv \"$(DESTDIR)$(TARGET).munched\" \"$(DESTDIR)$(TARGET)\" && \ - chmod +x \"$(DESTDIR)$(TARGET)\") + chmod +x \"$(DESTDIR)$(TARGET)\" } # We need to create a dummy lib.a in case someone links against this lib. @@ -48,7 +48,8 @@ shared|!staticlib:!lib { VXWORKS_MUNCH_CMD += (atarg=`basename $(TARGET) .so.$${VERSION}`.a ; touch \"$(DESTDIR)\$\${atarg}\") } - QMAKE_POST_LINK = $$VXWORKS_MUNCH_CMD $$QMAKE_POST_LINK + !isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK = $$escape_expand(\\n\\t)$$QMAKE_POST_LINK + QMAKE_POST_LINK = $$VXWORKS_MUNCH_CMD$$QMAKE_POST_LINK silent:QMAKE_POST_LINK = @echo creating $@.$$VXWORKS_MUNCH_EXT && $$QMAKE_POST_LINK isEmpty(DESTDIR) { diff --git a/mkspecs/features/win32/embed_manifest_dll.prf b/mkspecs/features/win32/embed_manifest_dll.prf index 7305c04..e8711da 100644 --- a/mkspecs/features/win32/embed_manifest_dll.prf +++ b/mkspecs/features/win32/embed_manifest_dll.prf @@ -6,8 +6,7 @@ isEmpty(MANIFEST_DIR):MANIFEST_DIR = . NOPATH_TARGET ~= s,\\\\,/,g # Change to single type separators NOPATH_TARGET ~= s,^(.*/)+,, # Remove all paths QMAKE_LFLAGS += /MANIFEST $$quote(/MANIFESTFILE:\"$${MANIFEST_DIR}\\$${NOPATH_TARGET}.intermediate.manifest\") - QMAKE_PREV_POST_LINK = $$QMAKE_POST_LINK - QMAKE_POST_LINK = $$quote(mt.exe -nologo -manifest \"$$replace(MANIFEST_DIR,/,\\)\\$${NOPATH_TARGET}.intermediate.manifest\" -outputresource:$(DESTDIR_TARGET);2$$escape_expand(\\n\\t)) - QMAKE_POST_LINK += $$QMAKE_PREV_POST_LINK + !isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK = $$escape_expand(\\n\\t)$$QMAKE_POST_LINK + QMAKE_POST_LINK = $$quote(mt.exe -nologo -manifest \"$$replace(MANIFEST_DIR,/,\\)\\$${NOPATH_TARGET}.intermediate.manifest\" -outputresource:$(DESTDIR_TARGET);2$$escape_expand(\\n\\t))$$QMAKE_POST_LINK QMAKE_CLEAN += \"$$replace(MANIFEST_DIR,/,\\)\\$${NOPATH_TARGET}.intermediate.manifest\" } diff --git a/mkspecs/features/win32/embed_manifest_exe.prf b/mkspecs/features/win32/embed_manifest_exe.prf index 5b37a6d..2d1c09b 100644 --- a/mkspecs/features/win32/embed_manifest_exe.prf +++ b/mkspecs/features/win32/embed_manifest_exe.prf @@ -6,8 +6,7 @@ if(win32-msvc2005*|win32-msvc2008*|win32-msvc2010*):!equals(TEMPLATE_PREFIX, "vc NOPATH_TARGET ~= s,\\\\,/,g # Change to single type separators NOPATH_TARGET ~= s,^(.*/)+,, # Remove all paths QMAKE_LFLAGS += /MANIFEST $$quote(/MANIFESTFILE:\"$${MANIFEST_DIR}\\$${NOPATH_TARGET}.intermediate.manifest\") - QMAKE_PREV_POST_LINK = $$QMAKE_POST_LINK - QMAKE_POST_LINK = $$quote(mt.exe -nologo -manifest \"$$replace(MANIFEST_DIR,/,\\)\\$${NOPATH_TARGET}.intermediate.manifest\" -outputresource:$(DESTDIR_TARGET);1$$escape_expand(\\n\\t)) - QMAKE_POST_LINK += $$QMAKE_PREV_POST_LINK + !isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK = $$escape_expand(\\n\\t)$$QMAKE_POST_LINK + QMAKE_POST_LINK = $$quote(mt.exe -nologo -manifest \"$$replace(MANIFEST_DIR,/,\\)\\$${NOPATH_TARGET}.intermediate.manifest\" -outputresource:$(DESTDIR_TARGET);1$$escape_expand(\\n\\t))$$QMAKE_POST_LINK QMAKE_CLEAN += \"$$replace(MANIFEST_DIR,/,\\)\\$${NOPATH_TARGET}.intermediate.manifest\" } diff --git a/mkspecs/modules/README b/mkspecs/modules/README new file mode 100644 index 0000000..f095982 --- /dev/null +++ b/mkspecs/modules/README @@ -0,0 +1,3 @@ +Externally provided Qt modules may drop a qmake file here to become part of +the current Qt configuration. The file name must follow the pattern +"qt_<module>.pri". It must contain a "QT_CONFIG += <module>" statement. diff --git a/mkspecs/modules/qt_webkit_version.pri b/mkspecs/modules/qt_webkit_version.pri deleted file mode 100644 index ffd192c..0000000 --- a/mkspecs/modules/qt_webkit_version.pri +++ /dev/null @@ -1,4 +0,0 @@ -QT_WEBKIT_VERSION = 4.7.0 -QT_WEBKIT_MAJOR_VERSION = 4 -QT_WEBKIT_MINOR_VERSION = 7 -QT_WEBKIT_PATCH_VERSION = 0 diff --git a/mkspecs/symbian-sbsv2/flm/qt/qmake_store_build.flm b/mkspecs/symbian-sbsv2/flm/qt/qmake_store_build.flm index 47c3f1e..21638ea 100644 --- a/mkspecs/symbian-sbsv2/flm/qt/qmake_store_build.flm +++ b/mkspecs/symbian-sbsv2/flm/qt/qmake_store_build.flm @@ -38,7 +38,7 @@ $(STORE_BUILD_TARGET): echo "# make sis target." >> $(CACHE_FILENAME) && \ echo "# Version : " >> $(CACHE_FILENAME) && \ echo "# ==============================================================================" >> $(CACHE_FILENAME) && \ - echo QT_SIS_TARGET ?= $(VISUAL_CFG)-$(VARIANTPLATFORM) >> $(CACHE_FILENAME) + echo QT_SIS_TARGET ?= $(VISUAL_CFG)-$(PLATFORM_PATH) >> $(CACHE_FILENAME) $(call endrule,qmake_store_build) endef diff --git a/mkspecs/symbian-sbsv2/flm/qt/qt.xml b/mkspecs/symbian-sbsv2/flm/qt/qt.xml index 12857a2..0f7db3c 100644 --- a/mkspecs/symbian-sbsv2/flm/qt/qt.xml +++ b/mkspecs/symbian-sbsv2/flm/qt/qt.xml @@ -37,6 +37,5 @@ <interface name="qt.qmake_store_build" extends="Symbian.UserFLM" flm="qmake_store_build.flm"> - <param name='VARIANTPLATFORM' /> </interface> </build> diff --git a/projects.pro b/projects.pro index 373b049..f94e1de 100644 --- a/projects.pro +++ b/projects.pro @@ -159,11 +159,13 @@ INSTALLS += qmake #mkspecs mkspecs.path=$$[QT_INSTALL_DATA]/mkspecs -mkspecs.files=$$QT_BUILD_TREE/mkspecs/qconfig.pri $$QT_SOURCE_TREE/mkspecs/* +mkspecs.files=$$QT_BUILD_TREE/mkspecs/qconfig.pri $$files($$QT_SOURCE_TREE/mkspecs/*) +mkspecs.files -= $$QT_SOURCE_TREE/mkspecs/modules unix { DEFAULT_QMAKESPEC = $$QMAKESPEC DEFAULT_QMAKESPEC ~= s,^.*mkspecs/,,g mkspecs.commands += $(DEL_FILE) $(INSTALL_ROOT)$$mkspecs.path/default; $(SYMLINK) $$DEFAULT_QMAKESPEC $(INSTALL_ROOT)$$mkspecs.path/default + mkspecs.files -= $$QT_SOURCE_TREE/mkspecs/default } win32:!equals(QT_BUILD_TREE, $$QT_SOURCE_TREE) { # When shadow building on Windows, the default mkspec only exists in the build tree. diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 852471d..c7b1473 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -466,14 +466,37 @@ MakefileGenerator::init() if(!project->isEmpty("QMAKE_SUBSTITUTES")) { const QStringList &subs = v["QMAKE_SUBSTITUTES"]; for(int i = 0; i < subs.size(); ++i) { - if(!subs.at(i).endsWith(".in")) { - warn_msg(WarnLogic, "Substitute '%s' does not end with '.in'", - subs.at(i).toLatin1().constData()); - continue; + QString inn = subs.at(i) + ".input", outn = subs.at(i) + ".output"; + if (v.contains(inn) || v.contains(outn)) { + if (!v.contains(inn) || !v.contains(outn)) { + warn_msg(WarnLogic, "Substitute '%s' has only one of .input and .output", + subs.at(i).toLatin1().constData()); + continue; + } + const QStringList &tinn = v[inn], &toutn = v[outn]; + if (tinn.length() != 1) { + warn_msg(WarnLogic, "Substitute '%s.input' does not have exactly one value", + subs.at(i).toLatin1().constData()); + continue; + } + if (toutn.length() != 1) { + warn_msg(WarnLogic, "Substitute '%s.output' does not have exactly one value", + subs.at(i).toLatin1().constData()); + continue; + } + inn = tinn.first(); + outn = toutn.first(); + } else { + inn = subs.at(i); + if(!inn.endsWith(".in")) { + warn_msg(WarnLogic, "Substitute '%s' does not end with '.in'", + inn.toLatin1().constData()); + continue; + } + outn = inn.left(inn.length()-3); } - QFile in(fileFixify(subs.at(i))); - QFile out(fileFixify(subs.at(i).left(subs.at(i).length()-3), - qmake_getpwd(), Option::output_dir)); + QFile in(fileFixify(inn)); + QFile out(fileFixify(outn, qmake_getpwd(), Option::output_dir)); if(in.open(QFile::ReadOnly)) { QString contents; QStack<int> state; @@ -528,7 +551,7 @@ MakefileGenerator::init() if(out.exists() && out.open(QFile::ReadOnly)) { QString old = QString::fromUtf8(out.readAll()); if(contents == old) { - v["QMAKE_INTERNAL_INCLUDED_FILES"].append(subs.at(i)); + v["QMAKE_INTERNAL_INCLUDED_FILES"].append(in.fileName()); continue; } out.close(); @@ -540,7 +563,7 @@ MakefileGenerator::init() } mkdir(QFileInfo(out).absolutePath()); if(out.open(QFile::WriteOnly)) { - v["QMAKE_INTERNAL_INCLUDED_FILES"].append(subs.at(i)); + v["QMAKE_INTERNAL_INCLUDED_FILES"].append(in.fileName()); out.write(contents.toUtf8()); } else { warn_msg(WarnLogic, "Cannot open substitute for output '%s'", diff --git a/qmake/generators/symbian/symbiancommon.cpp b/qmake/generators/symbian/symbiancommon.cpp index d124b02..155dbc9 100644 --- a/qmake/generators/symbian/symbiancommon.cpp +++ b/qmake/generators/symbian/symbiancommon.cpp @@ -275,6 +275,20 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB if (success) applicationVersion = QString("%1,%2,%3").arg(major).arg(minor).arg(patch); + // Append package build version number if it is set + QString pkgBuildVersion = project->first("DEPLOYMENT.pkg_build_version"); + if (!pkgBuildVersion.isEmpty()) { + success = false; + uint build = pkgBuildVersion.toUInt(&success); + if (success && build < 100) { + if (pkgBuildVersion.size() == 1) + pkgBuildVersion.prepend(QLatin1Char('0')); + applicationVersion.append(pkgBuildVersion); + } else { + fprintf(stderr, "Warning: Invalid DEPLOYMENT.pkg_build_version (%s), must be a number between 0 - 99\n", qPrintable(pkgBuildVersion)); + } + } + // Package header QString sisHeader = "; SIS header: name, uid, version\n#{\"%1\"},(%2),%3\n\n"; QString visualTarget = generator->escapeFilePath(project->first("TARGET")); diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp index 036eb1d..e794351 100644 --- a/qmake/generators/symbian/symmake_sbsv2.cpp +++ b/qmake/generators/symbian/symmake_sbsv2.cpp @@ -202,10 +202,18 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo QString genericClause = " -c %1_%2" + testClause; QString winscwClause = " -c winscw_%1.mwccinc" + testClause; QString gcceClause; - if (QString::compare(gcceVersion(), UNDETECTED_GCCE_VERSION) == 0) - allPlatforms.removeAll(PLATFORM_GCCE); - else - gcceClause = " -c arm.v5.%1." + gcceVersion() + ".release_gcce" + testClause; + bool stripArmv5 = false; + + if (allPlatforms.contains(PLATFORM_GCCE)) { + if (QString::compare(gcceVersion(), UNDETECTED_GCCE_VERSION) == 0) { + allPlatforms.removeAll(PLATFORM_GCCE); + } else { + gcceClause = " -c arm.v5.%1." + gcceVersion() + testClause; + // Since gcce building is enabled, do not add armv5 for any sbs command + // that also contains gcce, because those will build same targets. + stripArmv5 = true; + } + } QStringList allClauses; QStringList debugClauses; @@ -216,14 +224,15 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo releasePlatforms.removeAll(PLATFORM_WINSCW); // No release for emulator foreach(QString item, debugPlatforms) { - debugClauses << configClause(item, debugBuild, winscwClause, gcceClause, genericClause); + if (item != PLATFORM_ARMV5 || !stripArmv5) + debugClauses << configClause(item, debugBuild, winscwClause, gcceClause, genericClause); } foreach(QString item, releasePlatforms) { - releaseClauses << configClause(item, releaseBuild, winscwClause, gcceClause, genericClause); + if (item != PLATFORM_ARMV5 || !stripArmv5) + releaseClauses << configClause(item, releaseBuild, winscwClause, gcceClause, genericClause); } allClauses << debugClauses << releaseClauses; - QTextStream t(&wrapperFile); t << "# ==============================================================================" << endl; diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp index 17c4d5a..2505056 100644 --- a/qmake/generators/win32/msbuild_objectmodel.cpp +++ b/qmake/generators/win32/msbuild_objectmodel.cpp @@ -1573,7 +1573,8 @@ bool VCXLinkerTool::parseOption(const char* option) break; case 0x0034160: // /MAP[:filename] GenerateMapFile = _True; - MapFileName = option+5; + if (option[4] == ':') + MapFileName = option+5; break; case 0x164e1ef: // /MAPINFO:{EXPORTS} if(*(option+9) == 'E') diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 1e060a0..980e686 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -1430,7 +1430,8 @@ bool VCLinkerTool::parseOption(const char* option) break; case 0x0034160: // /MAP[:filename] GenerateMapFile = _True; - MapFileName = option+5; + if (option[4] == ':') + MapFileName = option+5; break; case 0x164e1ef: // /MAPINFO:{EXPORTS|LINES} if(*(option+9) == 'E') diff --git a/qmake/generators/win32/msvc_vcxproj.cpp b/qmake/generators/win32/msvc_vcxproj.cpp index f68a435..271d9ae 100644 --- a/qmake/generators/win32/msvc_vcxproj.cpp +++ b/qmake/generators/win32/msvc_vcxproj.cpp @@ -202,7 +202,6 @@ void VcxprojGenerator::initConfiguration() conf.CharacterSet = "NotSet"; break; } - conf.CharacterSet = charSet(temp.isEmpty() ? (short)charSetNotSet : temp.toShort()); } conf.DeleteExtensionsOnClean = project->first("DeleteExtensionsOnClean"); conf.ImportLibrary = conf.linker.ImportLibrary; diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 64aaf34..ecb20c7 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -472,10 +472,13 @@ void Win32MakefileGenerator::processRcFileVar() resFile.replace(".rc", Option::res_ext); project->values("RES_FILE").prepend(fileInfo(resFile).fileName()); if (!project->values("OBJECTS_DIR").isEmpty()) { - if(project->isActiveConfig("staticlib")) - project->values("RES_FILE").first().prepend(fileInfo(project->values("DESTDIR").first()).absoluteFilePath() + Option::dir_sep); + QString resDestDir; + if (project->isActiveConfig("staticlib")) + resDestDir = fileInfo(project->first("DESTDIR")).absoluteFilePath(); else - project->values("RES_FILE").first().prepend(project->values("OBJECTS_DIR").first() + Option::dir_sep); + resDestDir = project->first("OBJECTS_DIR"); + resDestDir.append(Option::dir_sep); + project->values("RES_FILE").first().prepend(resDestDir); } project->values("RES_FILE").first() = Option::fixPathToTargetOS(project->values("RES_FILE").first(), false, false); project->values("POST_TARGETDEPS") += project->values("RES_FILE"); diff --git a/src/3rdparty/phonon/gstreamer/mediaobject.cpp b/src/3rdparty/phonon/gstreamer/mediaobject.cpp index 3e0addc..23a60c0 100644 --- a/src/3rdparty/phonon/gstreamer/mediaobject.cpp +++ b/src/3rdparty/phonon/gstreamer/mediaobject.cpp @@ -219,9 +219,9 @@ void MediaObject::noMorePadsAvailable () if ( status != GST_INSTALL_PLUGINS_STARTED_OK ) { if( status == GST_INSTALL_PLUGINS_HELPER_MISSING ) - setError(QString(tr("Missing codec helper script assistant.")), Phonon::FatalError ); + setError(tr("Missing codec helper script assistant."), Phonon::FatalError ); else - setError(QString(tr("Plugin codec installation failed for codec: %0")) + setError(tr("Plugin codec installation failed for codec: %0") .arg(m_missingCodecs[0].split("|")[3]), error); } m_missingCodecs.clear(); @@ -232,7 +232,7 @@ void MediaObject::noMorePadsAvailable () m_hasVideo = false; emit hasVideoChanged(false); } - setError(QString(tr("A required codec is missing. You need to install the following codec(s) to play this content: %0")).arg(codecs), error); + setError(tr("A required codec is missing. You need to install the following codec(s) to play this content: %0").arg(codecs), error); m_missingCodecs.clear(); #endif } diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro index 2047143..537cdd3 100644 --- a/src/3rdparty/webkit/WebCore/WebCore.pro +++ b/src/3rdparty/webkit/WebCore/WebCore.pro @@ -82,7 +82,7 @@ CONFIG(QTDIR_build) { symbian: TARGET =$$TARGET$${QT_LIBINFIX} } moduleFile=$$PWD/../WebKit/qt/qt_webkit_version.pri -include($$moduleFile) +isEmpty(QT_BUILD_TREE):include($$moduleFile) VERSION = $${QT_WEBKIT_MAJOR_VERSION}.$${QT_WEBKIT_MINOR_VERSION}.$${QT_WEBKIT_PATCH_VERSION} unix { @@ -2857,6 +2857,25 @@ contains(DEFINES, ENABLE_SYMBIAN_DIALOG_PROVIDERS) { } } +!symbian { + modfile.files = $$moduleFile + modfile.path = $$[QMAKE_MKSPECS]/modules + + INSTALLS += modfile +} else { + # INSTALLS is not implemented in qmake's s60 generators, copy headers manually + + inst_modfile.commands = $$QMAKE_COPY ${QMAKE_FILE_NAME} ${QMAKE_FILE_OUT} + inst_modfile.input = moduleFile + inst_modfile.output = $$[QMAKE_MKSPECS]/modules + inst_modfile.CONFIG = no_clean + + QMAKE_EXTRA_COMPILERS += inst_modfile + + install.depends += compiler_inst_modfile_make_all + QMAKE_EXTRA_TARGETS += install +} + include($$PWD/../WebKit/qt/Api/headers.pri) HEADERS += $$WEBKIT_API_HEADERS @@ -2873,10 +2892,7 @@ HEADERS += $$WEBKIT_API_HEADERS !isEmpty(INSTALL_LIBS): target.path = $$INSTALL_LIBS else: target.path = $$[QT_INSTALL_LIBS] - modfile.files = $$moduleFile - modfile.path = $$[QMAKE_MKSPECS]/modules - - INSTALLS += target headers modfile + INSTALLS += target headers } else { # INSTALLS is not implemented in qmake's s60 generators, copy headers manually inst_headers.commands = $$QMAKE_COPY ${QMAKE_FILE_NAME} ${QMAKE_FILE_OUT} @@ -2888,15 +2904,7 @@ HEADERS += $$WEBKIT_API_HEADERS QMAKE_EXTRA_COMPILERS += inst_headers - inst_modfile.commands = $$inst_headers.commands - inst_modfile.input = moduleFile - inst_modfile.output = $$[QMAKE_MKSPECS]/modules - inst_modfile.CONFIG = no_clean - - QMAKE_EXTRA_COMPILERS += inst_modfile - - install.depends += compiler_inst_headers_make_all compiler_inst_modfile_make_all - QMAKE_EXTRA_TARGETS += install + install.depends += compiler_inst_headers_make_all } win32-*|wince* { diff --git a/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri b/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri index d8cf06c..4594d1e 100644 --- a/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri +++ b/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri @@ -2,4 +2,4 @@ QT_WEBKIT_VERSION = 4.7.0 QT_WEBKIT_MAJOR_VERSION = 4 QT_WEBKIT_MINOR_VERSION = 7 QT_WEBKIT_PATCH_VERSION = 0 -QT_CONFIG *= webkit +QT_CONFIG += webkit diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri index b916b4d..2505e72 100644 --- a/src/corelib/global/global.pri +++ b/src/corelib/global/global.pri @@ -19,7 +19,7 @@ INCLUDEPATH += $$QT_BUILD_TREE/src/corelib/global # Only used on platforms with CONFIG += precompile_header PRECOMPILED_HEADER = global/qt_pch.h -linux*-g++*:!static { +linux*:!static { QMAKE_LFLAGS += -Wl,-e,qt_core_boilerplate prog=$$quote(if (/program interpreter: (.*)]/) { print $1; }) DEFINES += ELF_INTERPRETER=\\\"$$system(readelf -l /bin/ls | perl -n -e \'$$prog\')\\\" diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index af35316..401af85 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1828,6 +1828,7 @@ QSysInfo::S60Version QSysInfo::s60Version() CDir* contents; TInt err = fileFinder.FindWildByDir(qt_S60Filter, qt_S60SystemInstallDir, contents); if (err == KErrNone) { + QScopedPointer<CDir> contentsDeleter(contents); err = contents->Sort(EDescending|ESortByName); if (err == KErrNone && contents->Count() > 0 && (*contents)[0].iName.Length() >= 12) { TInt major = (*contents)[0].iName[9] - '0'; @@ -1850,7 +1851,6 @@ QSysInfo::S60Version QSysInfo::s60Version() } } } - delete contents; } # ifdef Q_CC_NOKIAX86 diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index ea7e2e4..957abbf 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -66,6 +66,8 @@ QT_END_NAMESPACE QT_BEGIN_NAMESPACE +extern void qDumpCPUFeatures(); // in qsimd.cpp + #ifndef QT_NO_SETTINGS struct QLibrarySettings @@ -508,6 +510,14 @@ void qt_core_boilerplate() "Contact: Nokia Corporation (qt-info@nokia.com)\n" "\n" "Build key: " QT_BUILD_KEY "\n" + "Compat build key: " +#ifdef QT_BUILD_KEY_COMPAT + "| " QT_BUILD_KEY_COMPAT " " +#endif +#ifdef QT_BUILD_KEY_COMPAT2 + "| " QT_BUILD_KEY_COMPAT2 " " +#endif + "|\n" "Build date: %s\n" "Installation prefix: %s\n" "Library path: %s\n" @@ -517,6 +527,8 @@ void qt_core_boilerplate() qt_configure_libraries_path_str + 12, qt_configure_headers_path_str + 12); + QT_PREPEND_NAMESPACE(qDumpCPUFeatures)(); + #ifdef QT_EVAL extern void qt_core_eval_init(uint); qt_core_eval_init(1); diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index 1bad8ed..5cc6ae3 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -232,8 +232,12 @@ void QTimerActiveObject::DoCancel() void QTimerActiveObject::RunL() { - int error; - QT_TRYCATCH_ERROR(error, Run()); + int error = KErrNone; + if (iStatus == KErrNone) { + QT_TRYCATCH_ERROR(error, Run()); + } else { + error = iStatus.Int(); + } // All Symbian error codes are negative. if (error < 0) { CActiveScheduler::Current()->Error(error); // stop and report here, as this timer will be deleted on scope exit diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index 0f99948..1874a9e 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -295,14 +295,6 @@ static bool qt_parse_pattern(const char *s, uint *version, bool *debug, QByteArr #if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_SYMBIAN) && !defined(QT_NO_PLUGIN_CHECK) -#if defined(Q_OS_FREEBSD) || defined(Q_OS_LINUX) -# define USE_MMAP -QT_BEGIN_INCLUDE_NAMESPACE -# include <sys/types.h> -# include <sys/mman.h> -QT_END_INCLUDE_NAMESPACE -#endif // Q_OS_FREEBSD || Q_OS_LINUX - static long qt_find_pattern(const char *s, ulong s_len, const char *pattern, ulong p_len) { @@ -363,34 +355,15 @@ static bool qt_unix_query(const QString &library, uint *version, bool *debug, QB } QByteArray data; - char *filedata = 0; - ulong fdlen = 0; - -# ifdef USE_MMAP - char *mapaddr = 0; - size_t maplen = file.size(); - mapaddr = (char *) mmap(mapaddr, maplen, PROT_READ, MAP_PRIVATE, file.handle(), 0); - if (mapaddr != MAP_FAILED) { - // mmap succeeded - filedata = mapaddr; - fdlen = maplen; - } else { - // mmap failed - if (qt_debug_component()) { - qWarning("mmap: %s", qPrintable(qt_error_string(errno))); - } - if (lib) - lib->errorString = QLibrary::tr("Could not mmap '%1': %2") - .arg(library) - .arg(qt_error_string()); -# endif // USE_MMAP + const char *filedata = 0; + ulong fdlen = file.size(); + filedata = (char *) file.map(0, fdlen); + if (filedata == 0) { // try reading the data into memory instead data = file.readAll(); - filedata = data.data(); + filedata = data.constData(); fdlen = data.size(); -# ifdef USE_MMAP } -# endif // USE_MMAP // verify that the pattern is present in the plugin const char pattern[] = "pattern=QT_PLUGIN_VERIFICATION_DATA"; @@ -403,17 +376,6 @@ static bool qt_unix_query(const QString &library, uint *version, bool *debug, QB if (!ret && lib) lib->errorString = QLibrary::tr("Plugin verification data mismatch in '%1'").arg(library); -# ifdef USE_MMAP - if (mapaddr != MAP_FAILED && munmap(mapaddr, maplen) != 0) { - if (qt_debug_component()) - qWarning("munmap: %s", qPrintable(qt_error_string(errno))); - if (lib) - lib->errorString = QLibrary::tr("Could not unmap '%1': %2") - .arg(library) - .arg( qt_error_string() ); - } -# endif // USE_MMAP - file.close(); return ret; } @@ -790,10 +752,13 @@ bool QLibraryPrivate::isPlugin(QSettings *settings) .arg(qt_version&0xff) .arg(debug ? QLatin1String("debug") : QLatin1String("release")); } else if (key != QT_BUILD_KEY + // we may have some compatibility keys, try them too: #ifdef QT_BUILD_KEY_COMPAT - // be sure to load plugins using an older but compatible build key && key != QT_BUILD_KEY_COMPAT #endif +#ifdef QT_BUILD_KEY_COMPAT2 + && key != QT_BUILD_KEY_COMPAT2 +#endif ) { if (qt_debug_component()) { qWarning("In %s:\n" diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp index 8005d7d..68ab033 100644 --- a/src/corelib/tools/qsimd.cpp +++ b/src/corelib/tools/qsimd.cpp @@ -41,6 +41,7 @@ #include "qsimd_p.h" #include <QByteArray> +#include <stdio.h> #if defined(Q_OS_WINCE) #include <windows.h> @@ -50,15 +51,20 @@ #include <intrin.h> #endif +#if defined(Q_OS_LINUX) && defined(__arm__) +#include "private/qcore_unix_p.h" + +#include <asm/hwcap.h> +#include <linux/auxvec.h> +#endif + QT_BEGIN_NAMESPACE -uint qDetectCPUFeatures() +#if defined (Q_OS_WINCE) +static inline uint detectProcessorFeatures() { - static uint features = 0xffffffff; - if (features != 0xffffffff) - return features; + uint features = 0; -#if defined (Q_OS_WINCE) #if defined (ARM) if (IsProcessorFeaturePresent(PF_ARM_INTEL_WMMX)) { features = IWMMXT; @@ -78,22 +84,57 @@ uint qDetectCPUFeatures() #endif features = 0; return features; -#elif defined(QT_HAVE_IWMMXT) +} + +#elif defined(__arm__) || defined(__arm) || defined(QT_HAVE_IWMMXT) || defined(QT_HAVE_NEON) +static inline uint detectProcessorFeatures() +{ + uint features = 0; + +#if defined(Q_OS_LINUX) + int auxv = ::qt_safe_open("/proc/self/auxv", O_RDONLY); + if (auxv != -1) { + unsigned long vector[64]; + int nread; + while (features == 0) { + nread = ::qt_safe_read(auxv, (char *)vector, sizeof vector); + if (nread <= 0) { + // EOF or error + break; + } + + int max = nread / (sizeof vector[0]); + for (int i = 0; i < max; i += 2) + if (vector[i] == AT_HWCAP) { + if (vector[i+1] & HWCAP_IWMMXT) + features |= IWMMXT; + if (vector[i+1] & HWCAP_NEON) + features |= NEON; + break; + } + } + + ::qt_safe_close(auxv); + return features; + } + // fall back if /proc/self/auxv wasn't found +#endif + +#if defined(QT_HAVE_IWMMXT) // runtime detection only available when running as a previlegied process - static const bool doIWMMXT = !qgetenv("QT_NO_IWMMXT").toInt(); - features = doIWMMXT ? IWMMXT : 0; - return features; + features = IWMMXT; #elif defined(QT_HAVE_NEON) - static const bool doNEON = !qgetenv("QT_NO_NEON").toInt(); - features = doNEON ? NEON : 0; + features = NEON; +#endif + return features; -#else - features = 0; -#if defined(__x86_64__) || defined(Q_OS_WIN64) - features = MMX|SSE|SSE2|CMOV; -#elif defined(__ia64__) - features = MMX|SSE|SSE2; +} + #elif defined(__i386__) || defined(_M_IX86) +static inline uint detectProcessorFeatures() +{ + uint features = 0; + unsigned int extended_result = 0; unsigned int feature_result = 0; uint result = 0; @@ -149,6 +190,7 @@ uint qDetectCPUFeatures() : : "%eax", "%ecx", "%edx" ); + #elif defined (Q_OS_WIN) _asm { push eax @@ -210,6 +252,7 @@ uint qDetectCPUFeatures() } #endif + // result now contains the standard feature bits if (result & (1u << 15)) features |= CMOV; @@ -236,9 +279,13 @@ uint qDetectCPUFeatures() if (feature_result & (1u << 28)) features |= AVX; -#endif // i386 + return features; +} -#if defined(__x86_64__) || defined(Q_OS_WIN64) +#elif defined(__x86_64) || defined(Q_OS_WIN64) +static inline uint detectProcessorFeatures() +{ + uint features = MMX|SSE|SSE2|CMOV; uint feature_result = 0; #if defined(Q_CC_GNU) @@ -282,33 +329,97 @@ uint qDetectCPUFeatures() features |= SSE4_2; if (feature_result & (1u << 28)) features |= AVX; -#endif // x86_64 -#if defined(QT_HAVE_MMX) - if (qgetenv("QT_NO_MMX").toInt()) - features ^= MMX; -#endif - if (qgetenv("QT_NO_MMXEXT").toInt()) - features ^= MMXEXT; + return features; +} -#if defined(QT_HAVE_3DNOW) - if (qgetenv("QT_NO_3DNOW").toInt()) - features ^= MMX3DNOW; -#endif - if (qgetenv("QT_NO_3DNOWEXT").toInt()) - features ^= MMX3DNOWEXT; +#elif defined(__ia64__) +static inline uint detectProcessorFeatures() +{ + return MMX|SSE|SSE2; +} -#if defined(QT_HAVE_SSE) - if (qgetenv("QT_NO_SSE").toInt()) - features ^= SSE; -#endif -#if defined(QT_HAVE_SSE2) - if (qgetenv("QT_NO_SSE2").toInt()) - features ^= SSE2; +#else +static inline uint detectProcessorFeatures() +{ + return 0; +} #endif +/* + * Use kdesdk/scripts/generate_string_table.pl to update the table below. + * Here's the data (don't forget the ONE leading space): + mmx + mmxext + mmx3dnow + mmx3dnowext + sse + sse2 + cmov + iwmmxt + neon + sse3 + ssse3 + sse4.1 + sse4.2 + avx + */ + +// begin generated +static const char features_string[] = + " mmx\0" + " mmxext\0" + " mmx3dnow\0" + " mmx3dnowext\0" + " sse\0" + " sse2\0" + " cmov\0" + " iwmmxt\0" + " neon\0" + " sse3\0" + " ssse3\0" + " sse4.1\0" + " sse4.2\0" + " avx\0" + "\0"; + +static const int features_indices[] = { + 0, 5, 13, 23, 36, 41, 47, 53, + 61, 67, 73, 80, 88, 96, -1 +}; +// end generated + +const int features_count = (sizeof features_indices - 1) / (sizeof features_indices[0]); + +uint qDetectCPUFeatures() +{ + static QBasicAtomicInt features = Q_BASIC_ATOMIC_INITIALIZER(-1); + if (features != -1) + return features; + + uint f = detectProcessorFeatures(); + QByteArray disable = qgetenv("QT_NO_CPU_FEATURE"); + if (!disable.isEmpty()) { + disable.prepend(' '); + for (int i = 0; i < features_count; ++i) { + if (disable.contains(features_string + features_indices[i])) + f &= ~(1 << i); + } + } + + features = f; return features; -#endif +} + +void qDumpCPUFeatures() +{ + uint features = qDetectCPUFeatures(); + printf("Processor features: "); + for (int i = 0; i < features_count; ++i) { + if (features & (1 << i)) + printf("%s", features_string + features_indices[i]); + } + puts(""); } QT_END_NAMESPACE diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index a3148fb..664543b 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -51,8 +51,13 @@ QT_BEGIN_HEADER #if defined(QT_NO_MAC_XARCH) || (defined(Q_OS_DARWIN) && (defined(__ppc__) || defined(__ppc64__))) // Disable MMX and SSE on Mac/PPC builds, or if the compiler // does not support -Xarch argument passing -#undef QT_HAVE_SSE2 #undef QT_HAVE_SSE +#undef QT_HAVE_SSE2 +#undef QT_HAVE_SSE3 +#undef QT_HAVE_SSSE3 +#undef QT_HAVE_SSE4_1 +#undef QT_HAVE_SSE4_2 +#undef QT_HAVE_AVX #undef QT_HAVE_3DNOW #undef QT_HAVE_MMX #endif @@ -85,6 +90,7 @@ QT_BEGIN_HEADER // SSE4.1 and SSE4.2 intrinsics #if (defined(QT_HAVE_SSE4_1) || defined(QT_HAVE_SSE4_2)) && (defined(__SSE4_1__) || defined(Q_CC_MSVC)) #include <smmintrin.h> +#include <nmmintrin.h> #endif // AVX intrinsics diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 2fd9a0b..d940bf8 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -173,7 +173,7 @@ static int ucstricmp(const ushort *a, const ushort *ae, const uchar *b) return 1; } -// Unicode case-insensitive comparison +// Unicode case-sensitive comparison static int ucstrcmp(const QChar *a, int alen, const QChar *b, int blen) { if (a == b && alen == blen) @@ -202,22 +202,55 @@ static int ucstrnicmp(const ushort *a, const ushort *b, int l) return ucstricmp(a, a + l, b, b + l); } +// Benchmarking indicates that doing memcmp is much slower than +// executing the comparison ourselves. +// +// The profiling was done on a population of calls to qMemEquals, generated +// during a run of the demo browser. The profile of the data (32-bit x86 +// Linux) was: +// +// total number of comparisons: 21353 +// longest string compared: 95 +// average comparison length: 14.8786 +// cache-line crosses: 5661 (13.3%) +// alignment histogram: +// 0xXXX0 = 512 (1.2%) strings, 0 (0.0%) of which same-aligned +// 0xXXX2 = 15087 (35.3%) strings, 5145 (34.1%) of which same-aligned +// 0xXXX4 = 525 (1.2%) strings, 0 (0.0%) of which same-aligned +// 0xXXX6 = 557 (1.3%) strings, 6 (1.1%) of which same-aligned +// 0xXXX8 = 509 (1.2%) strings, 0 (0.0%) of which same-aligned +// 0xXXXa = 24358 (57.0%) strings, 9901 (40.6%) of which same-aligned +// 0xXXXc = 557 (1.3%) strings, 0 (0.0%) of which same-aligned +// 0xXXXe = 601 (1.4%) strings, 15 (2.5%) of which same-aligned +// total = 42706 (100%) strings, 15067 (35.3%) of which same-aligned +// +// 92% of the strings have alignment of 2 or 10, which is due to malloc on +// 32-bit Linux returning values aligned to 8 bytes, and offsetof(array, QString::Data) == 18. +// +// The profile on 64-bit will be different since offsetof(array, QString::Data) == 26. +// +// The benchmark results were, for a Core-i7 @ 2.67 GHz 32-bit, compiled with -O3 -funroll-loops: +// 16-bit loads only: 872,301 CPU ticks [Qt 4.5 / memcmp] +// 32- and 16-bit loads: 773,362 CPU ticks [Qt 4.6] +// SSE2 "movdqu" 128-bit loads: 618,736 CPU ticks +// SSE3 "lddqu" 128-bit loads: 619,954 CPU ticks +// SSSE3 "palignr" corrections: 852,147 CPU ticks +// SSE4.2 "pcmpestrm": 738,702 CPU ticks +// +// The same benchmark on an Atom N450 @ 1.66 GHz, is: +// 16-bit loads only: 2,185,882 CPU ticks +// 32- and 16-bit loads: 1,805,060 CPU ticks +// SSE2 "movdqu" 128-bit loads: 2,529,843 CPU ticks +// SSE3 "lddqu" 128-bit loads: 2,514,858 CPU ticks +// SSSE3 "palignr" corrections: 2,160,325 CPU ticks +// SSE4.2 not available +// +// The conclusion we reach is that alignment the SSE2 unaligned code can gain +// 20% improvement in performance in some systems, but suffers a penalty due +// to the unaligned loads on others. + static bool qMemEquals(const quint16 *a, const quint16 *b, int length) { - // Benchmarking indicates that doing memcmp is much slower than - // executing the comparison ourselves. - // To make it even faster, we do a 32-bit comparison, comparing - // twice the amount of data as a normal word-by-word comparison. - // - // Benchmarking results on a 2.33 GHz Core2 Duo, with a 64-QChar - // block of data, with 4194304 iterations (per iteration): - // operation usec cpu ticks - // memcmp 330 710 - // 16-bit 79 167-171 - // 32-bit aligned 49 105-109 - // - // Testing also indicates that unaligned 32-bit loads are as - // performant as 32-bit aligned. if (a == b || !length) return true; diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index e52f59f..06e4d47 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -614,6 +614,7 @@ private: ushort asciiCache : 1; ushort capacity : 1; ushort reserved : 11; + // ### Qt5: try to ensure that "array" is aligned to 16 bytes on both 32- and 64-bit ushort array[1]; }; static Data shared_null; diff --git a/src/declarative/debugger/qdeclarativedebugservice.cpp b/src/declarative/debugger/qdeclarativedebugservice.cpp index dca2695..1bbfcf4 100644 --- a/src/declarative/debugger/qdeclarativedebugservice.cpp +++ b/src/declarative/debugger/qdeclarativedebugservice.cpp @@ -128,6 +128,8 @@ void QDeclarativeDebugServer::newConnection() if (d->connection) { qWarning("QDeclarativeDebugServer error: another client is already connected"); + QTcpSocket *faultyConnection = d->tcpServer->nextPendingConnection(); + delete faultyConnection; return; } diff --git a/src/declarative/graphicsitems/qdeclarativeanchors.cpp b/src/declarative/graphicsitems/qdeclarativeanchors.cpp index 7ac2b17..26fb97f 100644 --- a/src/declarative/graphicsitems/qdeclarativeanchors.cpp +++ b/src/declarative/graphicsitems/qdeclarativeanchors.cpp @@ -148,15 +148,6 @@ static qreal adjustedPosition(QGraphicsObject *item, QDeclarativeAnchorLine::Anc return ret; } -/*! - \internal - \class QDeclarativeAnchors - \since 4.7 - \brief The QDeclarativeAnchors class provides a way to lay out items relative to other items. - - \warning Currently, only anchoring to siblings or parent is supported. -*/ - QDeclarativeAnchors::QDeclarativeAnchors(QObject *parent) : QObject(*new QDeclarativeAnchorsPrivate(0), parent) { diff --git a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp index e0a2149..a95e944 100644 --- a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp @@ -54,11 +54,6 @@ QT_BEGIN_NAMESPACE /*! - \class QDeclarativeAnimatedImage - \internal -*/ - -/*! \qmlclass AnimatedImage QDeclarativeAnimatedImage \inherits Image \since 4.7 diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp index e0c7fc2..f16770b 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp @@ -79,12 +79,6 @@ QT_BEGIN_NAMESPACE rectangular item. */ -/*! - \class QDeclarativeBorderImage BorderImage - \internal - \brief The QDeclarativeBorderImage class provides an image item that you can add to a QDeclarativeView. -*/ - QDeclarativeBorderImage::QDeclarativeBorderImage(QDeclarativeItem *parent) : QDeclarativeImageBase(*(new QDeclarativeBorderImagePrivate), parent) { diff --git a/src/declarative/graphicsitems/qdeclarativeevents.cpp b/src/declarative/graphicsitems/qdeclarativeevents.cpp index 0a35a3f..dbfb3fb 100644 --- a/src/declarative/graphicsitems/qdeclarativeevents.cpp +++ b/src/declarative/graphicsitems/qdeclarativeevents.cpp @@ -60,11 +60,6 @@ Item { */ /*! - \internal - \class QDeclarativeKeyEvent -*/ - -/*! \qmlproperty int KeyEvent::key This property holds the code of the key that was pressed or released. diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index a710190..b302393 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -1001,12 +1001,16 @@ void QDeclarativeFlickable::geometryChanged(const QRectF &newGeometry, bool changed = false; if (newGeometry.width() != oldGeometry.width()) { + if (xflick()) + changed = true; if (d->hData.viewSize < 0) { d->contentItem->setWidth(width()); emit contentWidthChanged(); } } if (newGeometry.height() != oldGeometry.height()) { + if (yflick()) + changed = true; if (d->vData.viewSize < 0) { d->contentItem->setHeight(height()); emit contentHeightChanged(); @@ -1254,6 +1258,7 @@ bool QDeclarativeFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event) if (mouseEvent.type() == QEvent::GraphicsSceneMouseRelease) { d->clearDelayedPress(); d->stealMouse = false; + d->pressed = false; } return false; } diff --git a/src/declarative/graphicsitems/qdeclarativeflipable.cpp b/src/declarative/graphicsitems/qdeclarativeflipable.cpp index 6ce0fa6..69dd66a 100644 --- a/src/declarative/graphicsitems/qdeclarativeflipable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflipable.cpp @@ -99,15 +99,6 @@ public: \sa {declarative/ui-components/flipable}{Flipable example} */ -/*! - \internal - \class QDeclarativeFlipable - \brief The Flipable item provides a surface that can be flipped. - - Flipable is an item that can be visibly "flipped" between its front and - back sides. -*/ - QDeclarativeFlipable::QDeclarativeFlipable(QDeclarativeItem *parent) : QDeclarativeItem(*(new QDeclarativeFlipablePrivate), parent) { diff --git a/src/declarative/graphicsitems/qdeclarativefocuspanel.cpp b/src/declarative/graphicsitems/qdeclarativefocuspanel.cpp index 5c7959a..f345a14 100644 --- a/src/declarative/graphicsitems/qdeclarativefocuspanel.cpp +++ b/src/declarative/graphicsitems/qdeclarativefocuspanel.cpp @@ -61,11 +61,6 @@ QT_BEGIN_NAMESPACE \l {qmlfocus}{keyboard focus documentation}. */ -/*! - \internal - \class QDeclarativeFocusPanel -*/ - QDeclarativeFocusPanel::QDeclarativeFocusPanel(QDeclarativeItem *parent) : QDeclarativeItem(parent) { diff --git a/src/declarative/graphicsitems/qdeclarativefocusscope.cpp b/src/declarative/graphicsitems/qdeclarativefocusscope.cpp index 4498275..da97a46 100644 --- a/src/declarative/graphicsitems/qdeclarativefocusscope.cpp +++ b/src/declarative/graphicsitems/qdeclarativefocusscope.cpp @@ -60,11 +60,6 @@ QT_BEGIN_NAMESPACE \sa {declarative/keyinteraction/focus}{Keyboard focus example} */ -/*! - \internal - \class QDeclarativeFocusScope -*/ - QDeclarativeFocusScope::QDeclarativeFocusScope(QDeclarativeItem *parent) : QDeclarativeItem(parent) { diff --git a/src/declarative/graphicsitems/qdeclarativegraphicswidget.cpp b/src/declarative/graphicsitems/qdeclarativegraphicswidget.cpp index ee45406..d45fe83 100644 --- a/src/declarative/graphicsitems/qdeclarativegraphicswidget.cpp +++ b/src/declarative/graphicsitems/qdeclarativegraphicswidget.cpp @@ -68,7 +68,6 @@ QDeclarativeGraphicsWidget::~QDeclarativeGraphicsWidget() delete d->_anchors; d->_anchors = 0; } -/*! \internal */ QDeclarativeAnchors *QDeclarativeGraphicsWidget::anchors() { Q_D(QDeclarativeGraphicsWidget); @@ -85,54 +84,36 @@ QDeclarativeItemPrivate::AnchorLines *QDeclarativeGraphicsWidgetPrivate::anchorL return _anchorLines; } -/*! - \internal -*/ QDeclarativeAnchorLine QDeclarativeGraphicsWidget::left() const { Q_D(const QDeclarativeGraphicsWidget); return d->anchorLines()->left; } -/*! - \internal -*/ QDeclarativeAnchorLine QDeclarativeGraphicsWidget::right() const { Q_D(const QDeclarativeGraphicsWidget); return d->anchorLines()->right; } -/*! - \internal -*/ QDeclarativeAnchorLine QDeclarativeGraphicsWidget::horizontalCenter() const { Q_D(const QDeclarativeGraphicsWidget); return d->anchorLines()->hCenter; } -/*! - \internal -*/ QDeclarativeAnchorLine QDeclarativeGraphicsWidget::top() const { Q_D(const QDeclarativeGraphicsWidget); return d->anchorLines()->top; } -/*! - \internal -*/ QDeclarativeAnchorLine QDeclarativeGraphicsWidget::bottom() const { Q_D(const QDeclarativeGraphicsWidget); return d->anchorLines()->bottom; } -/*! - \internal -*/ QDeclarativeAnchorLine QDeclarativeGraphicsWidget::verticalCenter() const { Q_D(const QDeclarativeGraphicsWidget); diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index 1cc5f81..7a88e78 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -91,19 +91,6 @@ QT_BEGIN_NAMESPACE \sa {declarative/imageelements/image}{Image example}, QDeclarativeImageProvider */ -/*! - \internal - \class QDeclarativeImage Image - \brief The QDeclarativeImage class provides an image item that you can add to a QDeclarativeView. - - Example: - \qml - Image { source: "pics/star.png" } - \endqml - - A QDeclarativeImage object can be instantiated in QML using the tag \l Image. -*/ - QDeclarativeImage::QDeclarativeImage(QDeclarativeItem *parent) : QDeclarativeImageBase(*(new QDeclarativeImagePrivate), parent) { diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp index d6b935b..416604b 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp @@ -50,13 +50,6 @@ QT_BEGIN_NAMESPACE - -/*! - \class QDeclarativeImageBase - \internal - \brief The base class for declarative images. - */ - QDeclarativeImageBase::QDeclarativeImageBase(QDeclarativeImageBasePrivate &dd, QDeclarativeItem *parent) : QDeclarativeItem(dd, parent) { diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 0f16a79..aca2bb7 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -229,12 +229,6 @@ QT_BEGIN_NAMESPACE The angle to rotate, in degrees clockwise. */ -/*! - \internal - \class QDeclarativeContents - \brief The QDeclarativeContents class gives access to the height and width of an item's contents. - -*/ QDeclarativeContents::QDeclarativeContents(QDeclarativeItem *item) : m_item(item), m_x(0), m_y(0), m_width(0), m_height(0) { //### optimize @@ -1728,7 +1722,6 @@ void QDeclarativeItemPrivate::parentProperty(QObject *o, void *rv, QDeclarativeN specify it. */ -/*! \internal */ QDeclarativeListProperty<QObject> QDeclarativeItemPrivate::data() { return QDeclarativeListProperty<QObject>(q_func(), 0, QDeclarativeItemPrivate::data_append); @@ -1890,6 +1883,12 @@ void QDeclarativeItem::geometryChanged(const QRectF &newGeometry, } } + for(int ii = 0; ii < d->changeListeners.count(); ++ii) { + const QDeclarativeItemPrivate::ChangeListener &change = d->changeListeners.at(ii); + if (change.types & QDeclarativeItemPrivate::Geometry) + change.listener->itemGeometryChanged(this, newGeometry, oldGeometry); + } + if (newGeometry.x() != oldGeometry.x()) emit xChanged(); if (newGeometry.width() != oldGeometry.width()) @@ -1898,12 +1897,6 @@ void QDeclarativeItem::geometryChanged(const QRectF &newGeometry, emit yChanged(); if (newGeometry.height() != oldGeometry.height()) emit heightChanged(); - - for(int ii = 0; ii < d->changeListeners.count(); ++ii) { - const QDeclarativeItemPrivate::ChangeListener &change = d->changeListeners.at(ii); - if (change.types & QDeclarativeItemPrivate::Geometry) - change.listener->itemGeometryChanged(this, newGeometry, oldGeometry); - } } void QDeclarativeItemPrivate::removeItemChangeListener(QDeclarativeItemChangeListener *listener, ChangeTypes types) @@ -2416,7 +2409,6 @@ void QDeclarativeItemPrivate::focusChanged(bool flag) emit q->focusChanged(flag); } -/*! \internal */ QDeclarativeListProperty<QObject> QDeclarativeItemPrivate::resources() { return QDeclarativeListProperty<QObject>(q_func(), 0, QDeclarativeItemPrivate::resources_append, @@ -2441,7 +2433,6 @@ QDeclarativeListProperty<QObject> QDeclarativeItemPrivate::resources() \sa {qmlstate}{States} */ -/*! \internal */ QDeclarativeListProperty<QDeclarativeState> QDeclarativeItemPrivate::states() { return _states()->statesProperty(); @@ -2465,7 +2456,6 @@ QDeclarativeListProperty<QDeclarativeState> QDeclarativeItemPrivate::states() */ -/*! \internal */ QDeclarativeListProperty<QDeclarativeTransition> QDeclarativeItemPrivate::transitions() { return _states()->transitionsProperty(); @@ -2538,7 +2528,6 @@ QDeclarativeListProperty<QDeclarativeTransition> QDeclarativeItemPrivate::transi \sa {qmlstates}{States} */ -/*! \internal */ QString QDeclarativeItemPrivate::state() const { if (!_stateGroup) @@ -2547,7 +2536,6 @@ QString QDeclarativeItemPrivate::state() const return _stateGroup->state(); } -/*! \internal */ void QDeclarativeItemPrivate::setState(const QString &state) { _states()->setState(state); diff --git a/src/declarative/graphicsitems/qdeclarativelayoutitem.cpp b/src/declarative/graphicsitems/qdeclarativelayoutitem.cpp index 8509473..d71b2c5 100644 --- a/src/declarative/graphicsitems/qdeclarativelayoutitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativelayoutitem.cpp @@ -66,13 +66,6 @@ QT_BEGIN_NAMESPACE */ /*! - \internal - \class QDeclarativeLayoutItem - \brief The QDeclarativeLayoutItem class allows you to place your QML UI elements inside Qt's Graphics View layouts. -*/ - - -/*! \qmlproperty QSizeF LayoutItem::maximumSize The maximumSize property can be set to specify the maximum desired size of this LayoutItem diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index d3d46f7..ef28ab2 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -2454,6 +2454,16 @@ void QDeclarativeListView::keyPressEvent(QKeyEvent *event) QDeclarativeFlickable::keyPressEvent(event); } +void QDeclarativeListView::geometryChanged(const QRectF &newGeometry, + const QRectF &oldGeometry) +{ + Q_D(QDeclarativeListView); + d->maxExtentDirty = true; + d->minExtentDirty = true; + QDeclarativeFlickable::geometryChanged(newGeometry, oldGeometry); +} + + /*! \qmlmethod ListView::incrementCurrentIndex() diff --git a/src/declarative/graphicsitems/qdeclarativelistview_p.h b/src/declarative/graphicsitems/qdeclarativelistview_p.h index 8fbff49..735b248 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview_p.h +++ b/src/declarative/graphicsitems/qdeclarativelistview_p.h @@ -246,6 +246,7 @@ protected: virtual qreal minXExtent() const; virtual qreal maxXExtent() const; virtual void keyPressEvent(QKeyEvent *); + virtual void geometryChanged(const QRectF &newGeometry,const QRectF &oldGeometry); virtual void componentComplete(); private Q_SLOTS: diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp index 2fde4c8..5d71625 100644 --- a/src/declarative/graphicsitems/qdeclarativeloader.cpp +++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp @@ -189,14 +189,6 @@ void QDeclarativeLoaderPrivate::initResize() \sa {dynamic-object-creation}{Dynamic Object Creation} */ -/*! - \internal - \class QDeclarativeLoader - */ - -/*! - Create a new QDeclarativeLoader instance. - */ QDeclarativeLoader::QDeclarativeLoader(QDeclarativeItem *parent) : QDeclarativeItem(*(new QDeclarativeLoaderPrivate), parent) { @@ -204,9 +196,6 @@ QDeclarativeLoader::QDeclarativeLoader(QDeclarativeItem *parent) d->flags |= QGraphicsItem::ItemIsFocusScope; } -/*! - Destroy the loader instance. - */ QDeclarativeLoader::~QDeclarativeLoader() { Q_D(QDeclarativeLoader); diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp index 2823888..ec01549 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp @@ -317,16 +317,6 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate() \l Flickable, \c onCanceled should be used in addition to onReleased. */ -/*! - \internal - \class QDeclarativeMouseArea - \brief The QDeclarativeMouseArea class provides a simple mouse handling abstraction for use within QML. - - All QDeclarativeItem derived classes can do mouse handling but the QDeclarativeMouseArea class exposes mouse - handling data as properties and tracks flicking and dragging of the mouse. - - A QDeclarativeMouseArea object can be instantiated in QML using the tag \l MouseArea. - */ QDeclarativeMouseArea::QDeclarativeMouseArea(QDeclarativeItem *parent) : QDeclarativeItem(*(new QDeclarativeMouseAreaPrivate), parent) { @@ -690,7 +680,6 @@ void QDeclarativeMouseArea::geometryChanged(const QRectF &newGeometry, d->lastPos = mapFromScene(d->lastScenePos); } -/*! \internal */ QVariant QDeclarativeMouseArea::itemChange(GraphicsItemChange change, const QVariant &value) { diff --git a/src/declarative/graphicsitems/qdeclarativepath.cpp b/src/declarative/graphicsitems/qdeclarativepath.cpp index 0c069ce..f93357d 100644 --- a/src/declarative/graphicsitems/qdeclarativepath.cpp +++ b/src/declarative/graphicsitems/qdeclarativepath.cpp @@ -62,11 +62,6 @@ QT_BEGIN_NAMESPACE */ /*! - \internal - \class QDeclarativePathElement -*/ - -/*! \qmlclass Path QDeclarativePath \ingroup qml-view-elements \since 4.7 @@ -83,13 +78,6 @@ QT_BEGIN_NAMESPACE \sa PathView, PathAttribute, PathPercent, PathLine, PathQuad, PathCubic */ - -/*! - \internal - \class QDeclarativePath - \brief The QDeclarativePath class defines a path. - \sa QDeclarativePathView -*/ QDeclarativePath::QDeclarativePath(QObject *parent) : QObject(*(new QDeclarativePathPrivate), parent) { @@ -527,15 +515,6 @@ void QDeclarativeCurve::setY(qreal y) */ /*! - \internal - \class QDeclarativePathAttribute - \brief The QDeclarativePathAttribute class allows to set the value of an attribute at a given position in the path. - - \sa QDeclarativePath -*/ - - -/*! \qmlproperty string PathAttribute::name the name of the attribute to change. @@ -608,14 +587,6 @@ void QDeclarativePathAttribute::setValue(qreal value) */ /*! - \internal - \class QDeclarativePathLine - \brief The QDeclarativePathLine class defines a straight line. - - \sa QDeclarativePath -*/ - -/*! \qmlproperty real PathLine::x \qmlproperty real PathLine::y @@ -652,15 +623,6 @@ void QDeclarativePathLine::addToPath(QPainterPath &path) */ /*! - \internal - \class QDeclarativePathQuad - \brief The QDeclarativePathQuad class defines a quadratic Bezier curve with a control point. - - \sa QDeclarativePath -*/ - - -/*! \qmlproperty real PathQuad::x \qmlproperty real PathQuad::y @@ -743,14 +705,6 @@ void QDeclarativePathQuad::addToPath(QPainterPath &path) */ /*! - \internal - \class QDeclarativePathCubic - \brief The QDeclarativePathCubic class defines a cubic Bezier curve with two control points. - - \sa QDeclarativePath -*/ - -/*! \qmlproperty real PathCubic::x \qmlproperty real PathCubic::y @@ -872,18 +826,6 @@ void QDeclarativePathCubic::addToPath(QPainterPath &path) \sa Path */ -/*! - \internal - \class QDeclarativePathPercent - \brief The QDeclarativePathPercent class manipulates the way a path is interpreted. - - QDeclarativePathPercent allows you to bunch up items (or spread out items) along various - segments of a QDeclarativePathView's path. - - \sa QDeclarativePath - -*/ - qreal QDeclarativePathPercent::value() const { return _value; diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp index 4ceb5d9..b776b8e 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp +++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp @@ -108,8 +108,7 @@ void QDeclarativeBasePositioner::graphicsWidgetGeometryChanged() You also need to set a PositionerType, to declare whether you are positioning the x, y or both for the child items. Depending on the chosen type, only x or y changes will be applied. - Note that the subclass is responsible for adding the - spacing in between items. + Note that the subclass is responsible for adding the spacing in between items. */ QDeclarativeBasePositioner::QDeclarativeBasePositioner(PositionerType at, QDeclarativeItem *parent) : QDeclarativeItem(*(new QDeclarativeBasePositionerPrivate), parent) @@ -439,11 +438,6 @@ Column { \image spacing_b.png */ -/*! - \internal - \class QDeclarativeColumn - \brief The QDeclarativeColumn class lines up items vertically. -*/ QDeclarativeColumn::QDeclarativeColumn(QDeclarativeItem *parent) : QDeclarativeBasePositioner(Vertical, parent) { @@ -579,11 +573,6 @@ Row { \image spacing_b.png */ -/*! - \internal - \class QDeclarativeRow - \brief The QDeclarativeRow class lines up items horizontally. -*/ QDeclarativeRow::QDeclarativeRow(QDeclarativeItem *parent) : QDeclarativeBasePositioner(Horizontal, parent) { @@ -736,11 +725,6 @@ Grid { \image spacing_b.png */ -/*! - \internal - \class QDeclarativeGrid - \brief The QDeclarativeGrid class lays out items in a grid. -*/ QDeclarativeGrid::QDeclarativeGrid(QDeclarativeItem *parent) : QDeclarativeBasePositioner(Both, parent), m_rows(-1), m_columns(-1), m_flow(LeftToRight) { diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp index 5990c2d..d027924 100644 --- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp +++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp @@ -180,11 +180,6 @@ void QDeclarativeGradient::doUpdate() int QDeclarativeRectanglePrivate::doUpdateSlotIdx = -1; -/*! - \internal - \class QDeclarativeRectangle - \brief The QDeclarativeRectangle class provides a rectangle item that you can add to a QDeclarativeView. -*/ QDeclarativeRectangle::QDeclarativeRectangle(QDeclarativeItem *parent) : QDeclarativeItem(*(new QDeclarativeRectanglePrivate), parent) { diff --git a/src/declarative/graphicsitems/qdeclarativerepeater.cpp b/src/declarative/graphicsitems/qdeclarativerepeater.cpp index 4a951a2..97cf05c 100644 --- a/src/declarative/graphicsitems/qdeclarativerepeater.cpp +++ b/src/declarative/graphicsitems/qdeclarativerepeater.cpp @@ -146,23 +146,11 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate() \endcode */ -/*! - \internal - \class QDeclarativeRepeater - */ - -/*! - Create a new QDeclarativeRepeater instance. - */ QDeclarativeRepeater::QDeclarativeRepeater(QDeclarativeItem *parent) : QDeclarativeItem(*(new QDeclarativeRepeaterPrivate), parent) { } -/*! - Destroy the repeater instance. All items it instantiated are also - destroyed. - */ QDeclarativeRepeater::~QDeclarativeRepeater() { } @@ -301,18 +289,12 @@ int QDeclarativeRepeater::count() const } -/*! - \internal - */ void QDeclarativeRepeater::componentComplete() { QDeclarativeItem::componentComplete(); regenerate(); } -/*! - \internal - */ QVariant QDeclarativeRepeater::itemChange(GraphicsItemChange change, const QVariant &value) { @@ -335,9 +317,6 @@ void QDeclarativeRepeater::clear() d->deletables.clear(); } -/*! - \internal - */ void QDeclarativeRepeater::regenerate() { Q_D(QDeclarativeRepeater); diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index e5ad743..f16af88 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -190,32 +190,6 @@ QSet<QUrl> QTextDocumentWithImageResources::errors; \sa {declarative/text/fonts}{Fonts example} */ - -/*! - \internal - \class QDeclarativeText - \qmlclass Text - - \brief The QDeclarativeText class provides a formatted text item that you can add to a QDeclarativeView. - - Text was designed for read-only text; it does not allow for any text editing. - It can display both plain and rich text. For example: - - \qml - Text { text: "Hello World!"; font.family: "Helvetica"; font.pointSize: 24; color: "red" } - Text { text: "<b>Hello</b> <i>World!</i>" } - \endqml - - \image text.png - - If height and width are not explicitly set, Text will attempt to determine how - much room is needed and set it accordingly. Unless \c wrapMode is set, it will always - prefer width to height (all text will be placed on a single line). - - The \c elide property can alternatively be used to fit a line of plain text to a set width. - - A QDeclarativeText object can be instantiated in QML using the tag \c Text. -*/ QDeclarativeText::QDeclarativeText(QDeclarativeItem *parent) : QDeclarativeItem(*(new QDeclarativeTextPrivate), parent) { diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index b8e8726..b1c0fcd 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -103,23 +103,6 @@ TextEdit { \sa Text, TextInput, {declarative/text/textselection}{Text Selection example} */ -/*! - \internal - \class QDeclarativeTextEdit - \qmlclass TextEdit - - \brief The QDeclarativeTextEdit class provides an editable formatted text item that you can add to a QDeclarativeView. - - It can display both plain and rich text. - - \image declarative-textedit.png - - A QDeclarativeTextEdit object can be instantiated in QML using the tag \c <TextEdit>. -*/ - -/*! - Constructs a new QDeclarativeTextEdit. -*/ QDeclarativeTextEdit::QDeclarativeTextEdit(QDeclarativeItem *parent) : QDeclarativePaintedItem(*(new QDeclarativeTextEditPrivate), parent) { diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index b4f36f4..5604b82 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -437,8 +437,6 @@ void QDeclarativeTextInput::setCursorPosition(int cp) } /*! - \internal - Returns a Rect which encompasses the cursor, but which may be larger than is required. Ignores custom cursor delegates. */ diff --git a/src/declarative/graphicsitems/qdeclarativetranslate.cpp b/src/declarative/graphicsitems/qdeclarativetranslate.cpp index 0bae0cd..2e0af2a 100644 --- a/src/declarative/graphicsitems/qdeclarativetranslate.cpp +++ b/src/declarative/graphicsitems/qdeclarativetranslate.cpp @@ -116,9 +116,6 @@ void QDeclarativeTranslate::setY(qreal y) emit yChanged(); } -/*! - \internal -*/ void QDeclarativeTranslate::applyTo(QMatrix4x4 *matrix) const { Q_D(const QDeclarativeTranslate); diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index b4e8bda..a46ee73 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -1305,24 +1305,27 @@ void QDeclarativeVisualDataModel::_q_itemsMoved(int from, int to, int count) void QDeclarativeVisualDataModel::_q_rowsInserted(const QModelIndex &parent, int begin, int end) { - if (!parent.isValid()) + Q_D(QDeclarativeVisualDataModel); + if (parent == d->m_root) _q_itemsInserted(begin, end - begin + 1); } void QDeclarativeVisualDataModel::_q_rowsRemoved(const QModelIndex &parent, int begin, int end) { - if (!parent.isValid()) + Q_D(QDeclarativeVisualDataModel); + if (parent == d->m_root) _q_itemsRemoved(begin, end - begin + 1); } void QDeclarativeVisualDataModel::_q_rowsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow) { + Q_D(QDeclarativeVisualDataModel); const int count = sourceEnd - sourceStart + 1; - if (!destinationParent.isValid() && !sourceParent.isValid()) { + if (destinationParent == d->m_root && sourceParent == d->m_root) { _q_itemsMoved(sourceStart, destinationRow, count); - } else if (!sourceParent.isValid()) { + } else if (sourceParent == d->m_root) { _q_itemsRemoved(sourceStart, count); - } else if (!destinationParent.isValid()) { + } else if (destinationParent == d->m_root) { _q_itemsInserted(destinationRow, count); } } @@ -1330,7 +1333,7 @@ void QDeclarativeVisualDataModel::_q_rowsMoved(const QModelIndex &sourceParent, void QDeclarativeVisualDataModel::_q_dataChanged(const QModelIndex &begin, const QModelIndex &end) { Q_D(QDeclarativeVisualDataModel); - if (!begin.parent().isValid()) + if (begin.parent() == d->m_root) _q_itemsChanged(begin.row(), end.row() - begin.row() + 1, d->m_roles); } diff --git a/src/declarative/qml/parser/qdeclarativejslexer.cpp b/src/declarative/qml/parser/qdeclarativejslexer.cpp index cd08658..1eb42e4 100644 --- a/src/declarative/qml/parser/qdeclarativejslexer.cpp +++ b/src/declarative/qml/parser/qdeclarativejslexer.cpp @@ -677,9 +677,9 @@ int Lexer::lex() setDone(Other); } else state = Start; - if (driver) driver->addComment(startpos, tokenLength(), startlineno, startcolumn); + if (driver) driver->addComment(startpos+2, tokenLength()-2, startlineno, startcolumn+2); } else if (current == 0) { - if (driver) driver->addComment(startpos, tokenLength(), startlineno, startcolumn); + if (driver) driver->addComment(startpos+2, tokenLength()-2, startlineno, startcolumn+2); setDone(Eof); } @@ -689,14 +689,14 @@ int Lexer::lex() setDone(Bad); err = UnclosedComment; errmsg = QCoreApplication::translate("QDeclarativeParser", "Unclosed comment at end of file"); - if (driver) driver->addComment(startpos, tokenLength(), startlineno, startcolumn); + if (driver) driver->addComment(startpos+2, tokenLength()-2, startlineno, startcolumn+2); } else if (isLineTerminator()) { shiftWindowsLineBreak(); yylineno++; } else if (current == '*' && next1 == '/') { state = Start; shift(1); - if (driver) driver->addComment(startpos, tokenLength(), startlineno, startcolumn); + if (driver) driver->addComment(startpos+2, tokenLength()-3, startlineno, startcolumn+2); } break; diff --git a/src/declarative/qml/qdeclarativecompiledbindings.cpp b/src/declarative/qml/qdeclarativecompiledbindings.cpp index 723da94..9402596 100644 --- a/src/declarative/qml/qdeclarativecompiledbindings.cpp +++ b/src/declarative/qml/qdeclarativecompiledbindings.cpp @@ -1874,7 +1874,7 @@ bool QDeclarativeBindingCompilerPrivate::parseName(AST::Node *node, Result &type return false; QDeclarativeImportedNamespace *ns = 0; - if (!engine->importDatabase.resolveType(imports, name.toUtf8(), &attachType, 0, 0, 0, &ns)) + if (!imports.resolveType(name.toUtf8(), &attachType, 0, 0, 0, &ns)) return false; if (ns || !attachType || !attachType->attachedPropertiesType()) return false; diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 2b4a4a5..7847303 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -41,7 +41,6 @@ #include "private/qdeclarativecompiler_p.h" -#include "private/qdeclarativecompositetypedata_p.h" #include "private/qdeclarativeparser_p.h" #include "private/qdeclarativescriptparser_p.h" #include "qdeclarativepropertyvaluesource.h" @@ -562,7 +561,7 @@ void QDeclarativeCompiler::reset(QDeclarativeCompiledData *data) on a successful compiler. */ bool QDeclarativeCompiler::compile(QDeclarativeEngine *engine, - QDeclarativeCompositeTypeData *unit, + QDeclarativeTypeData *unit, QDeclarativeCompiledData *out) { exceptions.clear(); @@ -573,10 +572,15 @@ bool QDeclarativeCompiler::compile(QDeclarativeEngine *engine, output = out; // Compile types - for (int ii = 0; ii < unit->types.count(); ++ii) { - QDeclarativeCompositeTypeData::TypeReference &tref = unit->types[ii]; + const QList<QDeclarativeTypeData::TypeReference> &resolvedTypes = unit->resolvedTypes(); + QList<QDeclarativeScriptParser::TypeReference *> referencedTypes = unit->parser().referencedTypes(); + + for (int ii = 0; ii < resolvedTypes.count(); ++ii) { QDeclarativeCompiledData::TypeReference ref; - QDeclarativeScriptParser::TypeReference *parserRef = unit->data.referencedTypes().at(ii); + + const QDeclarativeTypeData::TypeReference &tref = resolvedTypes.at(ii); + QDeclarativeScriptParser::TypeReference *parserRef = referencedTypes.at(ii); + if (tref.type) { ref.type = tref.type; if (!ref.type->isCreatable()) { @@ -585,33 +589,16 @@ bool QDeclarativeCompiler::compile(QDeclarativeEngine *engine, err = tr( "Element is not creatable."); COMPILE_EXCEPTION(parserRef->refObjects.first(), err); } - } else if (tref.unit) { - ref.component = tref.unit->toComponent(engine); - - if (ref.component->isError()) { - QDeclarativeError error; - error.setUrl(output->url); - error.setDescription(QLatin1String("Unable to create type ") + - parserRef->name); - if (!parserRef->refObjects.isEmpty()) { - QDeclarativeParser::Object *parserObject = parserRef->refObjects.first(); - error.setLine(parserObject->location.start.line); - error.setColumn(parserObject->location.start.column); - } - - exceptions << error; - exceptions << ref.component->errors(); - reset(out); - return false; - } - ref.ref = tref.unit; + } else if (tref.typeData) { + ref.component = tref.typeData->component(); + ref.ref = tref.typeData; ref.ref->addref(); } ref.className = parserRef->name.toUtf8(); out->types << ref; } - Object *root = unit->data.tree(); + Object *root = unit->parser().tree(); Q_ASSERT(root); this->engine = engine; @@ -664,17 +651,18 @@ void QDeclarativeCompiler::compileTree(Object *tree) QHash<QString, Object::ScriptBlock> importedScripts; QStringList importedScriptIndexes; - for (int ii = 0; ii < unit->scripts.count(); ++ii) { - QString scriptCode = QString::fromUtf8(unit->scripts.at(ii).resource->data); - Object::ScriptBlock::Pragmas pragmas = QDeclarativeScriptParser::extractPragmas(scriptCode); + foreach (const QDeclarativeTypeData::ScriptReference &script, unit->resolvedScripts()) { + QString scriptCode = script.script->scriptSource(); + Object::ScriptBlock::Pragmas pragmas = script.script->pragmas(); + + Q_ASSERT(!importedScripts.contains(script.qualifier)); if (!scriptCode.isEmpty()) { - Object::ScriptBlock &scriptBlock = importedScripts[unit->scripts.at(ii).qualifier]; + Object::ScriptBlock &scriptBlock = importedScripts[script.qualifier]; - scriptBlock.codes.append(scriptCode); - scriptBlock.lineNumbers.append(1); - scriptBlock.files.append(unit->scripts.at(ii).resource->url); - scriptBlock.pragmas.append(pragmas); + scriptBlock.code = scriptCode; + scriptBlock.file = script.script->finalUrl().toString(); + scriptBlock.pragmas = pragmas; } } @@ -703,7 +691,7 @@ void QDeclarativeCompiler::compileTree(Object *tree) for (int ii = 0; ii < importedScriptIndexes.count(); ++ii) output->importCache->add(importedScriptIndexes.at(ii), ii); - unit->imports.cache(output->importCache, engine); + unit->imports().populateCache(output->importCache, engine); Q_ASSERT(tree->metatype); @@ -986,7 +974,7 @@ void QDeclarativeCompiler::genObject(QDeclarativeParser::Object *obj) } // Begin the class - if (obj->parserStatusCast != -1) { + if (tr.type && obj->parserStatusCast != -1) { QDeclarativeInstruction begin; begin.type = QDeclarativeInstruction::BeginObject; begin.begin.castValue = obj->parserStatusCast; @@ -1374,7 +1362,7 @@ bool QDeclarativeCompiler::doesPropertyExist(QDeclarativeParser::Property *prop, return p.name() != 0; } else { int idx = mo->indexOfProperty(prop->name.constData()); - return idx != -1; + return idx != -1 && mo->property(idx).isScriptable(); } } @@ -1403,8 +1391,7 @@ bool QDeclarativeCompiler::buildProperty(QDeclarativeParser::Property *prop, QDeclarativeType *type = 0; QDeclarativeImportedNamespace *typeNamespace = 0; - enginePrivate->importDatabase.resolveType(unit->imports, prop->name, - &type, 0, 0, 0, &typeNamespace); + unit->imports().resolveType(prop->name, &type, 0, 0, 0, &typeNamespace); if (typeNamespace) { // ### We might need to indicate that this property is a namespace @@ -1440,6 +1427,11 @@ bool QDeclarativeCompiler::buildProperty(QDeclarativeParser::Property *prop, if (prop->index != -1) { p = metaObject->property(prop->index); Q_ASSERT(p.name()); + + if (!p.isScriptable()) { + prop->index = -1; + p = QMetaProperty(); + } } } @@ -1512,7 +1504,7 @@ bool QDeclarativeCompiler::buildPropertyInNamespace(QDeclarativeImportedNamespac // Setup attached property data QDeclarativeType *type = 0; - enginePrivate->importDatabase.resolveTypeInNamespace(ns, prop->name, &type, 0, 0, 0); + unit->imports().resolveType(ns, prop->name, &type, 0, 0, 0); if (!type || !type->attachedPropertiesType()) COMPILE_EXCEPTION(prop, tr("Non-existent attached object")); @@ -1826,6 +1818,8 @@ bool QDeclarativeCompiler::buildValueTypeProperty(QObject *type, if (idx == -1) COMPILE_EXCEPTION(prop, tr("Cannot assign to non-existent property \"%1\"").arg(QString::fromUtf8(prop->name))); QMetaProperty p = type->metaObject()->property(idx); + if (!p.isScriptable()) + COMPILE_EXCEPTION(prop, tr("Cannot assign to non-existent property \"%1\"").arg(QString::fromUtf8(prop->name))); prop->index = idx; prop->type = p.userType(); prop->isValueTypeSubProperty = true; @@ -2139,8 +2133,7 @@ bool QDeclarativeCompiler::testQualifiedEnumAssignment(const QMetaProperty &prop QString typeName = parts.at(0); QDeclarativeType *type = 0; - enginePrivate->importDatabase.resolveType(unit->imports, typeName.toUtf8(), - &type, 0, 0, 0, 0); + unit->imports().resolveType(typeName.toUtf8(), &type, 0, 0, 0, 0); if (!type || obj->typeName != type->qmlTypeName()) return true; @@ -2167,7 +2160,7 @@ int QDeclarativeCompiler::evaluateEnum(const QByteArray& script) const int dot = script.indexOf('.'); if (dot > 0) { QDeclarativeType *type = 0; - enginePrivate->importDatabase.resolveType(unit->imports, script.left(dot), &type, 0, 0, 0, 0); + unit->imports().resolveType(script.left(dot), &type, 0, 0, 0, 0); if (!type) return -1; const QMetaObject *mo = type->metaObject(); @@ -2185,8 +2178,7 @@ int QDeclarativeCompiler::evaluateEnum(const QByteArray& script) const const QMetaObject *QDeclarativeCompiler::resolveType(const QByteArray& name) const { QDeclarativeType *qmltype = 0; - if (!enginePrivate->importDatabase.resolveType(unit->imports, name, &qmltype, - 0, 0, 0, 0)) + if (!unit->imports().resolveType(name, &qmltype, 0, 0, 0, 0)) return 0; if (!qmltype) return 0; @@ -2344,17 +2336,18 @@ bool QDeclarativeCompiler::buildDynamicMeta(QDeclarativeParser::Object *obj, Dyn QByteArray customTypeName; QDeclarativeType *qmltype = 0; QUrl url; - if (!enginePrivate->importDatabase.resolveType(unit->imports, p.customType, &qmltype, - &url, 0, 0, 0)) + if (!unit->imports().resolveType(p.customType, &qmltype, &url, 0, 0, 0)) COMPILE_EXCEPTION(&p, tr("Invalid property type")); if (!qmltype) { - QDeclarativeCompositeTypeData *tdata = enginePrivate->typeManager.get(url); + QDeclarativeTypeData *tdata = enginePrivate->typeLoader.get(url); Q_ASSERT(tdata); - Q_ASSERT(tdata->status == QDeclarativeCompositeTypeData::Complete); + Q_ASSERT(tdata->isComplete()); - QDeclarativeCompiledData *data = tdata->toCompiledComponent(engine); + QDeclarativeCompiledData *data = tdata->compiledData(); customTypeName = data->root->className(); + data->release(); + tdata->release(); } else { customTypeName = qmltype->typeName(); } @@ -2420,7 +2413,6 @@ bool QDeclarativeCompiler::buildDynamicMeta(QDeclarativeParser::Object *obj, Dyn builder.addSignal(p.name + "Changed()"); QMetaPropertyBuilder propBuilder = builder.addProperty(p.name, type, builder.methodCount() - 1); - propBuilder.setScriptable(true); propBuilder.setWritable(!readonly); } @@ -2586,6 +2578,9 @@ bool QDeclarativeCompiler::compileAlias(QMetaObjectBuilder &builder, COMPILE_EXCEPTION(prop.defaultValue, tr("Invalid alias location")); QMetaProperty aliasProperty = idObject->metaObject()->property(propIdx); + if (!aliasProperty.isScriptable()) + COMPILE_EXCEPTION(prop.defaultValue, tr("Invalid alias location")); + writable = aliasProperty.isWritable(); if (aliasProperty.isEnumType()) @@ -2622,7 +2617,6 @@ bool QDeclarativeCompiler::compileAlias(QMetaObjectBuilder &builder, builder.addSignal(prop.name + "Changed()"); QMetaPropertyBuilder propBuilder = builder.addProperty(prop.name, typeName.constData(), builder.methodCount() - 1); - propBuilder.setScriptable(true); propBuilder.setWritable(writable); return true; } @@ -2749,7 +2743,7 @@ bool QDeclarativeCompiler::completeComponentBuild() expr.context = binding.bindingContext.object; expr.property = binding.property; expr.expression = binding.expression; - expr.imports = unit->imports; + expr.imports = unit->imports(); int index = bindingCompiler.compile(expr, enginePrivate); if (index != -1) { diff --git a/src/declarative/qml/qdeclarativecompiler_p.h b/src/declarative/qml/qdeclarativecompiler_p.h index 49dc53f..89eef09 100644 --- a/src/declarative/qml/qdeclarativecompiler_p.h +++ b/src/declarative/qml/qdeclarativecompiler_p.h @@ -56,13 +56,13 @@ #include "qdeclarative.h" #include "qdeclarativeerror.h" #include "private/qdeclarativeinstruction_p.h" -#include "private/qdeclarativecompositetypemanager_p.h" #include "private/qdeclarativeparser_p.h" #include "private/qdeclarativeengine_p.h" #include "private/qbitfield_p.h" #include "private/qdeclarativepropertycache_p.h" #include "private/qdeclarativeintegercache_p.h" #include "private/qdeclarativetypenamecache_p.h" +#include "private/qdeclarativetypeloader_p.h" #include <QtCore/qbytearray.h> #include <QtCore/qset.h> @@ -152,7 +152,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeCompiler public: QDeclarativeCompiler(); - bool compile(QDeclarativeEngine *, QDeclarativeCompositeTypeData *, QDeclarativeCompiledData *); + bool compile(QDeclarativeEngine *, QDeclarativeTypeData *, QDeclarativeCompiledData *); bool isError() const; QList<QDeclarativeError> errors() const; @@ -338,7 +338,7 @@ private: QDeclarativeEngine *engine; QDeclarativeEnginePrivate *enginePrivate; QDeclarativeParser::Object *unitRoot; - QDeclarativeCompositeTypeData *unit; + QDeclarativeTypeData *unit; }; QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index d2d1f19..75bb5db 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -44,7 +44,6 @@ #include "private/qdeclarativecompiler_p.h" #include "private/qdeclarativecontext_p.h" -#include "private/qdeclarativecompositetypedata_p.h" #include "private/qdeclarativeengine_p.h" #include "private/qdeclarativevme_p.h" #include "qdeclarative.h" @@ -197,7 +196,7 @@ class QByteArray; \value Error An error has occurred. Call errors() to retrieve a list of \{QDeclarativeError}{errors}. */ -void QDeclarativeComponentPrivate::typeDataReady() +void QDeclarativeComponentPrivate::typeDataReady(QDeclarativeTypeData *) { Q_Q(QDeclarativeComponent); @@ -209,28 +208,25 @@ void QDeclarativeComponentPrivate::typeDataReady() emit q->statusChanged(q->status()); } -void QDeclarativeComponentPrivate::updateProgress(qreal p) +void QDeclarativeComponentPrivate::typeDataProgress(QDeclarativeTypeData *, qreal p) { Q_Q(QDeclarativeComponent); progress = p; + emit q->progressChanged(p); } -void QDeclarativeComponentPrivate::fromTypeData(QDeclarativeCompositeTypeData *data) +void QDeclarativeComponentPrivate::fromTypeData(QDeclarativeTypeData *data) { - url = data->imports.baseUrl(); - QDeclarativeCompiledData *c = data->toCompiledComponent(engine); + url = data->finalUrl(); + QDeclarativeCompiledData *c = data->compiledData(); if (!c) { - Q_ASSERT(data->status == QDeclarativeCompositeTypeData::Error); - - state.errors = data->errors; - + Q_ASSERT(data->isError()); + state.errors = data->errors(); } else { - cc = c; - } data->release(); @@ -239,7 +235,7 @@ void QDeclarativeComponentPrivate::fromTypeData(QDeclarativeCompositeTypeData *d void QDeclarativeComponentPrivate::clear() { if (typeData) { - typeData->remWaiter(this); + typeData->unregisterCallback(this); typeData->release(); typeData = 0; } @@ -271,7 +267,7 @@ QDeclarativeComponent::~QDeclarativeComponent() } if (d->typeData) { - d->typeData->remWaiter(d); + d->typeData->unregisterCallback(d); d->typeData->release(); } if (d->cc) @@ -443,19 +439,13 @@ void QDeclarativeComponent::setData(const QByteArray &data, const QUrl &url) d->url = url; - QDeclarativeCompositeTypeData *typeData = - QDeclarativeEnginePrivate::get(d->engine)->typeManager.getImmediate(data, url); + QDeclarativeTypeData *typeData = QDeclarativeEnginePrivate::get(d->engine)->typeLoader.get(data, url); - if (typeData->status == QDeclarativeCompositeTypeData::Waiting - || typeData->status == QDeclarativeCompositeTypeData::WaitingResources) - { - d->typeData = typeData; - d->typeData->addWaiter(d); - - } else { - + if (typeData->isCompleteOrError()) { d->fromTypeData(typeData); - + } else { + d->typeData = typeData; + d->typeData->registerCallback(d); } d->progress = 1.0; @@ -501,18 +491,15 @@ void QDeclarativeComponent::loadUrl(const QUrl &url) return; } - QDeclarativeCompositeTypeData *data = - QDeclarativeEnginePrivate::get(d->engine)->typeManager.get(d->url); + QDeclarativeTypeData *data = QDeclarativeEnginePrivate::get(d->engine)->typeLoader.get(d->url); - if (data->status == QDeclarativeCompositeTypeData::Waiting - || data->status == QDeclarativeCompositeTypeData::WaitingResources) - { - d->typeData = data; - d->typeData->addWaiter(d); - d->progress = data->progress; - } else { + if (data->isCompleteOrError()) { d->fromTypeData(data); d->progress = 1.0; + } else { + d->typeData = data; + d->typeData->registerCallback(d); + d->progress = data->progress(); } emit statusChanged(status()); diff --git a/src/declarative/qml/qdeclarativecomponent.h b/src/declarative/qml/qdeclarativecomponent.h index 1d1fca7..fd9cb2b 100644 --- a/src/declarative/qml/qdeclarativecomponent.h +++ b/src/declarative/qml/qdeclarativecomponent.h @@ -117,6 +117,7 @@ private: Q_DISABLE_COPY(QDeclarativeComponent) friend class QDeclarativeVME; friend class QDeclarativeCompositeTypeData; + friend class QDeclarativeTypeData; }; QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativecomponent_p.h b/src/declarative/qml/qdeclarativecomponent_p.h index 2a7d633..1b1454b 100644 --- a/src/declarative/qml/qdeclarativecomponent_p.h +++ b/src/declarative/qml/qdeclarativecomponent_p.h @@ -56,7 +56,7 @@ #include "qdeclarativecomponent.h" #include "private/qdeclarativeengine_p.h" -#include "private/qdeclarativecompositetypemanager_p.h" +#include "private/qdeclarativetypeloader_p.h" #include "private/qbitfield_p.h" #include "qdeclarativeerror.h" #include "qdeclarative.h" @@ -74,7 +74,7 @@ class QDeclarativeEngine; class QDeclarativeCompiledData; class QDeclarativeComponentAttached; -class QDeclarativeComponentPrivate : public QObjectPrivate +class QDeclarativeComponentPrivate : public QObjectPrivate, public QDeclarativeTypeData::TypeDataCallback { Q_DECLARE_PUBLIC(QDeclarativeComponent) @@ -85,11 +85,11 @@ public: QObject *beginCreate(QDeclarativeContextData *, const QBitField &); void completeCreate(); - QDeclarativeCompositeTypeData *typeData; - void typeDataReady(); - void updateProgress(qreal); + QDeclarativeTypeData *typeData; + virtual void typeDataReady(QDeclarativeTypeData *); + virtual void typeDataProgress(QDeclarativeTypeData *, qreal); - void fromTypeData(QDeclarativeCompositeTypeData *data); + void fromTypeData(QDeclarativeTypeData *data); QUrl url; qreal progress; diff --git a/src/declarative/qml/qdeclarativecompositetypedata_p.h b/src/declarative/qml/qdeclarativecompositetypedata_p.h deleted file mode 100644 index a0e4cc2..0000000 --- a/src/declarative/qml/qdeclarativecompositetypedata_p.h +++ /dev/null @@ -1,161 +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 QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVECOMPOSITETYPEDATA_P_H -#define QDECLARATIVECOMPOSITETYPEDATA_P_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 "private/qdeclarativeengine_p.h" - -#include <QtCore/qglobal.h> - -QT_BEGIN_NAMESPACE - -class QDeclarativeCompositeTypeResource; -class QDeclarativeCompositeTypeData : public QDeclarativeRefCount -{ -public: - QDeclarativeCompositeTypeData(); - virtual ~QDeclarativeCompositeTypeData(); - - enum Status { - Invalid, - Complete, - Error, - Waiting, - WaitingResources - }; - Status status; - enum ErrorType { - NoError, - AccessError, - GeneralError - }; - ErrorType errorType; - - QList<QDeclarativeError> errors; - - QDeclarativeImports imports; - - QList<QDeclarativeCompositeTypeData *> dependants; - - // Return a QDeclarativeComponent if the QDeclarativeCompositeTypeData is not in the Waiting - // state. The QDeclarativeComponent is owned by the QDeclarativeCompositeTypeData, so a - // reference should be kept to keep the QDeclarativeComponent alive. - QDeclarativeComponent *toComponent(QDeclarativeEngine *); - // Return a QDeclarativeCompiledData if possible, or 0 if an error - // occurs - QDeclarativeCompiledData *toCompiledComponent(QDeclarativeEngine *); - - struct TypeReference - { - TypeReference(); - - QDeclarativeType *type; - QDeclarativeCompositeTypeData *unit; - }; - - struct ScriptReference - { - ScriptReference(); - - QString qualifier; - QDeclarativeCompositeTypeResource *resource; - }; - - QList<TypeReference> types; - QList<ScriptReference> scripts; - QList<QDeclarativeCompositeTypeResource *> resources; - - // Add or remove p as a waiter. When the QDeclarativeCompositeTypeData becomes - // ready, the QDeclarativeComponentPrivate::typeDataReady() method will be invoked on - // p. The waiter is automatically removed when the typeDataReady() method - // is invoked, so there is no need to call remWaiter() in this case. - void addWaiter(QDeclarativeComponentPrivate *p); - void remWaiter(QDeclarativeComponentPrivate *p); - - qreal progress; - -private: - friend class QDeclarativeCompositeTypeManager; - friend class QDeclarativeCompiler; - friend class QDeclarativeDomDocument; - - QDeclarativeScriptParser data; - QList<QDeclarativeComponentPrivate *> waiters; - QDeclarativeComponent *component; - QDeclarativeCompiledData *compiledComponent; -}; - -class QDeclarativeCompositeTypeResource : public QDeclarativeRefCount -{ -public: - QDeclarativeCompositeTypeResource(); - virtual ~QDeclarativeCompositeTypeResource(); - - enum Status { - Invalid, - Complete, - Error, - Waiting - }; - Status status; - - QList<QDeclarativeCompositeTypeData *> dependants; - - QString url; - QByteArray data; -}; - -QT_END_NAMESPACE - -#endif // QDECLARATIVECOMPOSITETYPEDATA_P_H - diff --git a/src/declarative/qml/qdeclarativecompositetypemanager.cpp b/src/declarative/qml/qdeclarativecompositetypemanager.cpp deleted file mode 100644 index 2e77534..0000000 --- a/src/declarative/qml/qdeclarativecompositetypemanager.cpp +++ /dev/null @@ -1,776 +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 QtDeclarative 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 "private/qdeclarativecompositetypemanager_p.h" - -#include "private/qdeclarativecompositetypedata_p.h" -#include "private/qdeclarativescriptparser_p.h" -#include "qdeclarativeengine.h" -#include "private/qdeclarativeengine_p.h" -#include "qdeclarativecomponent.h" -#include "private/qdeclarativecomponent_p.h" -#include "private/qdeclarativecompiler_p.h" - -#include <QtNetwork/qnetworkreply.h> -#include <QtCore/qdebug.h> -#include <QtCore/qfile.h> - -QT_BEGIN_NAMESPACE - -QDeclarativeCompositeTypeData::QDeclarativeCompositeTypeData() -: status(Invalid), errorType(NoError), component(0), compiledComponent(0) -{ -} - -QDeclarativeCompositeTypeData::~QDeclarativeCompositeTypeData() -{ - for (int ii = 0; ii < dependants.count(); ++ii) - dependants.at(ii)->release(); - - for (int ii = 0; ii < resources.count(); ++ii) - resources.at(ii)->release(); - - if (compiledComponent) - compiledComponent->release(); - - if (component) - delete component; -} - -QDeclarativeCompositeTypeResource::QDeclarativeCompositeTypeResource() -{ -} - -QDeclarativeCompositeTypeResource::~QDeclarativeCompositeTypeResource() -{ - for (int ii = 0; ii < dependants.count(); ++ii) - dependants.at(ii)->release(); -} - -void QDeclarativeCompositeTypeData::addWaiter(QDeclarativeComponentPrivate *p) -{ - waiters << p; -} - -void QDeclarativeCompositeTypeData::remWaiter(QDeclarativeComponentPrivate *p) -{ - waiters.removeAll(p); -} - -QDeclarativeComponent *QDeclarativeCompositeTypeData::toComponent(QDeclarativeEngine *engine) -{ - if (!component) { - - QDeclarativeCompiledData *cc = toCompiledComponent(engine); - if (cc) { - component = new QDeclarativeComponent(engine, cc, -1, -1, 0); - cc->release(); - } else { - component = new QDeclarativeComponent(engine, 0); - component->d_func()->url = imports.baseUrl(); - component->d_func()->state.errors = errors; - } - - } - - return component; -} - -QDeclarativeCompiledData * -QDeclarativeCompositeTypeData::toCompiledComponent(QDeclarativeEngine *engine) -{ - if (status == Complete && !compiledComponent) { - - // Build script imports - foreach (const QDeclarativeScriptParser::Import &import, data.imports()) { - if (import.type == QDeclarativeScriptParser::Import::Script) { - QString url = imports.baseUrl().resolved(QUrl(import.uri)).toString(); - - ScriptReference ref; - ref.qualifier = import.qualifier; - - for (int ii = 0; ii < resources.count(); ++ii) { - if (resources.at(ii)->url == url) { - ref.resource = resources.at(ii); - break; - } - } - - Q_ASSERT(ref.resource); - - scripts << ref; - } - } - - compiledComponent = new QDeclarativeCompiledData(engine); - compiledComponent->url = imports.baseUrl(); - compiledComponent->name = compiledComponent->url.toString(); - - QDeclarativeCompiler compiler; - if (!compiler.compile(engine, this, compiledComponent)) { - status = Error; - errors = compiler.errors(); - compiledComponent->release(); - compiledComponent = 0; - } - - // Data is no longer needed once we have a compiled component - data.clear(); - } - - if (compiledComponent) - compiledComponent->addref(); - - return compiledComponent; -} - -QDeclarativeCompositeTypeData::TypeReference::TypeReference() -: type(0), unit(0) -{ -} - -QDeclarativeCompositeTypeData::ScriptReference::ScriptReference() -: resource(0) -{ -} - -QDeclarativeCompositeTypeManager::QDeclarativeCompositeTypeManager(QDeclarativeEngine *e) -: engine(e), redirectCount(0) -{ -} - -QDeclarativeCompositeTypeManager::~QDeclarativeCompositeTypeManager() -{ - for (Components::Iterator iter = components.begin(); iter != components.end();) { - (*iter)->release(); - iter = components.erase(iter); - } - for (Resources::Iterator iter = resources.begin(); iter != resources.end();) { - (*iter)->release(); - iter = resources.erase(iter); - } -} - -QDeclarativeCompositeTypeData *QDeclarativeCompositeTypeManager::get(const QUrl &url) -{ - Redirects::Iterator redir = redirects.find(url); - if (redir != redirects.end()) - return get(*redir); - - QDeclarativeCompositeTypeData *unit = components.value(url); - - if (!unit) { - unit = new QDeclarativeCompositeTypeData; - unit->status = QDeclarativeCompositeTypeData::Waiting; - unit->progress = 0.0; - unit->imports.setBaseUrl(url); - components.insert(url, unit); - - loadSource(unit); - } - - unit->addref(); - return unit; -} - -QDeclarativeCompositeTypeData * -QDeclarativeCompositeTypeManager::getImmediate(const QByteArray &data, const QUrl &url) -{ - QDeclarativeCompositeTypeData *unit = new QDeclarativeCompositeTypeData; - unit->status = QDeclarativeCompositeTypeData::Waiting; - unit->imports.setBaseUrl(url); - setData(unit, data, url); - return unit; -} - -void QDeclarativeCompositeTypeManager::clearCache() -{ - for (Components::Iterator iter = components.begin(); iter != components.end();) { - if ((*iter)->status != QDeclarativeCompositeTypeData::Waiting) { - (*iter)->release(); - iter = components.erase(iter); - } else { - ++iter; - } - } - - for (Resources::Iterator iter = resources.begin(); iter != resources.end();) { - if ((*iter)->status != QDeclarativeCompositeTypeResource::Waiting) { - (*iter)->release(); - iter = resources.erase(iter); - } else { - ++iter; - } - } -} - -#define TYPEMANAGER_MAXIMUM_REDIRECT_RECURSION 16 - -void QDeclarativeCompositeTypeManager::replyFinished() -{ - QNetworkReply *reply = static_cast<QNetworkReply *>(sender()); - - QDeclarativeCompositeTypeData *unit = components.value(reply->url()); - Q_ASSERT(unit); - - redirectCount++; - if (redirectCount < TYPEMANAGER_MAXIMUM_REDIRECT_RECURSION) { - QVariant redirect = reply->attribute(QNetworkRequest::RedirectionTargetAttribute); - if (redirect.isValid()) { - QUrl url = reply->url().resolved(redirect.toUrl()); - redirects.insert(reply->url(),url); - unit->imports.setBaseUrl(url); - components.remove(reply->url()); - components.insert(url, unit); - reply->deleteLater(); - reply = engine->networkAccessManager()->get(QNetworkRequest(url)); - QObject::connect(reply, SIGNAL(finished()), - this, SLOT(replyFinished())); - QObject::connect(reply, SIGNAL(downloadProgress(qint64,qint64)), - this, SLOT(requestProgress(qint64,qint64))); - return; - } - } - redirectCount = 0; - - if (reply->error() != QNetworkReply::NoError) { - QString errorDescription; - // ### - Fill in error - errorDescription = QLatin1String("Network error for URL ") + - reply->url().toString(); - - unit->status = QDeclarativeCompositeTypeData::Error; - // ### FIXME - QDeclarativeError error; - error.setDescription(errorDescription); - unit->errorType = QDeclarativeCompositeTypeData::AccessError; - unit->errors << error; - doComplete(unit); - - } else { - QByteArray data = reply->readAll(); - - setData(unit, data, reply->url()); - } - - reply->deleteLater(); -} - -void QDeclarativeCompositeTypeManager::resourceReplyFinished() -{ - QNetworkReply *reply = static_cast<QNetworkReply *>(sender()); - - QDeclarativeCompositeTypeResource *resource = resources.value(reply->url()); - Q_ASSERT(resource); - - redirectCount++; - if (redirectCount < TYPEMANAGER_MAXIMUM_REDIRECT_RECURSION) { - QVariant redirect = reply->attribute(QNetworkRequest::RedirectionTargetAttribute); - if (redirect.isValid()) { - QUrl url = reply->url().resolved(redirect.toUrl()); - redirects.insert(reply->url(),url); - resource->url = url.toString(); - resources.remove(reply->url()); - resources.insert(url, resource); - reply->deleteLater(); - reply = engine->networkAccessManager()->get(QNetworkRequest(url)); - QObject::connect(reply, SIGNAL(finished()), - this, SLOT(resourceReplyFinished())); - return; - } - } - redirectCount = 0; - - if (reply->error() != QNetworkReply::NoError) { - - resource->status = QDeclarativeCompositeTypeResource::Error; - - } else { - - resource->status = QDeclarativeCompositeTypeResource::Complete; - resource->data = reply->readAll(); - - } - - doComplete(resource); - reply->deleteLater(); -} - -void QDeclarativeCompositeTypeManager::loadResource(QDeclarativeCompositeTypeResource *resource) -{ - QUrl url(resource->url); - - QString lf = QDeclarativeEnginePrivate::urlToLocalFileOrQrc(url); - if (!lf.isEmpty()) { - - QFile file(lf); - if (file.open(QFile::ReadOnly)) { - resource->data = file.readAll(); - resource->status = QDeclarativeCompositeTypeResource::Complete; - } else { - resource->status = QDeclarativeCompositeTypeResource::Error; - } - } else if (url.scheme().isEmpty()) { - - // We can't open this, so just declare as an error - resource->status = QDeclarativeCompositeTypeResource::Error; - } else { - - QNetworkReply *reply = - engine->networkAccessManager()->get(QNetworkRequest(url)); - QObject::connect(reply, SIGNAL(finished()), - this, SLOT(resourceReplyFinished())); - - } -} - -void QDeclarativeCompositeTypeManager::loadSource(QDeclarativeCompositeTypeData *unit) -{ - QUrl url(unit->imports.baseUrl()); - - QString lf = QDeclarativeEnginePrivate::urlToLocalFileOrQrc(url); - if (!lf.isEmpty()) { - - QFile file(lf); - if (file.open(QFile::ReadOnly)) { - QByteArray data = file.readAll(); - setData(unit, data, url); - return; // success - } - } else if (!url.scheme().isEmpty()) { - QNetworkReply *reply = - engine->networkAccessManager()->get(QNetworkRequest(url)); - QObject::connect(reply, SIGNAL(finished()), - this, SLOT(replyFinished())); - QObject::connect(reply, SIGNAL(downloadProgress(qint64,qint64)), - this, SLOT(requestProgress(qint64,qint64))); - return; // waiting - } - - // error happened - QString errorDescription; - // ### - Fill in error - errorDescription = QLatin1String("File error for URL ") + url.toString(); - unit->status = QDeclarativeCompositeTypeData::Error; - // ### FIXME - QDeclarativeError error; - error.setDescription(errorDescription); - unit->errorType = QDeclarativeCompositeTypeData::AccessError; - unit->errors << error; - doComplete(unit); -} - -void QDeclarativeCompositeTypeManager::requestProgress(qint64 received, qint64 total) -{ - if (total <= 0) - return; - QNetworkReply *reply = static_cast<QNetworkReply *>(sender()); - - QDeclarativeCompositeTypeData *unit = components.value(reply->url()); - Q_ASSERT(unit); - - unit->progress = qreal(received)/total; - - foreach (QDeclarativeComponentPrivate *comp, unit->waiters) - comp->updateProgress(unit->progress); -} - -void QDeclarativeCompositeTypeManager::setData(QDeclarativeCompositeTypeData *unit, - const QByteArray &data, - const QUrl &url) -{ - bool ok = true; - if (!unit->data.parse(data, url)) { - ok = false; - unit->errors << unit->data.errors(); - } - - if (ok) { - compile(unit); - } else { - unit->status = QDeclarativeCompositeTypeData::Error; - unit->errorType = QDeclarativeCompositeTypeData::GeneralError; - doComplete(unit); - } -} - -void QDeclarativeCompositeTypeManager::doComplete(QDeclarativeCompositeTypeData *unit) -{ - for (int ii = 0; ii < unit->dependants.count(); ++ii) { - checkComplete(unit->dependants.at(ii)); - unit->dependants.at(ii)->release(); - } - unit->dependants.clear(); - - while(!unit->waiters.isEmpty()) { - QDeclarativeComponentPrivate *p = unit->waiters.takeFirst(); - p->typeDataReady(); - } -} - -void QDeclarativeCompositeTypeManager::doComplete(QDeclarativeCompositeTypeResource *resource) -{ - for (int ii = 0; ii < resource->dependants.count(); ++ii) { - checkComplete(resource->dependants.at(ii)); - resource->dependants.at(ii)->release(); - } - resource->dependants.clear(); -} - -void QDeclarativeCompositeTypeManager::checkComplete(QDeclarativeCompositeTypeData *unit) -{ - if (unit->status != QDeclarativeCompositeTypeData::Waiting - && unit->status != QDeclarativeCompositeTypeData::WaitingResources) - return; - - int waiting = 0; - for (int ii = 0; ii < unit->resources.count(); ++ii) { - QDeclarativeCompositeTypeResource *r = unit->resources.at(ii); - - if (!r) - continue; - - if (r->status == QDeclarativeCompositeTypeResource::Error) { - unit->status = QDeclarativeCompositeTypeData::Error; - QDeclarativeError error; - error.setUrl(unit->imports.baseUrl()); - error.setDescription(tr("Resource %1 unavailable").arg(r->url)); - unit->errors << error; - doComplete(unit); - return; - } else if (r->status == QDeclarativeCompositeTypeResource::Waiting) { - waiting++; - } - } - - if (waiting == 0) { - if (unit->status == QDeclarativeCompositeTypeData::WaitingResources) { - waiting += resolveTypes(unit); - if (unit->status != QDeclarativeCompositeTypeData::Error) { - if (waiting) - unit->status = QDeclarativeCompositeTypeData::Waiting; - } else { - return; - } - } else { - for (int ii = 0; ii < unit->types.count(); ++ii) { - QDeclarativeCompositeTypeData *u = unit->types.at(ii).unit; - - if (!u) - continue; - - if (u->status == QDeclarativeCompositeTypeData::Error) { - unit->status = QDeclarativeCompositeTypeData::Error; - unit->errors = u->errors; - doComplete(unit); - return; - } else if (u->status == QDeclarativeCompositeTypeData::Waiting - || u->status == QDeclarativeCompositeTypeData::WaitingResources) - { - waiting++; - } - } - } - } - - if (!waiting) { - unit->status = QDeclarativeCompositeTypeData::Complete; - doComplete(unit); - } -} - -int QDeclarativeCompositeTypeManager::resolveTypes(QDeclarativeCompositeTypeData *unit) -{ - // not called until all resources are loaded (they include import URLs) - int waiting = 0; - - QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine); - QDeclarativeImportDatabase &importDatabase = ep->importDatabase; - - // For local urls, add an implicit import "." as first (most overridden) lookup. - // This will also trigger the loading of the qmldir and the import of any native - // types from available plugins. - { - QDeclarativeDirComponents qmldircomponentsnetwork; - if (QDeclarativeCompositeTypeResource *resource - = resources.value(unit->imports.baseUrl().resolved(QUrl(QLatin1String("./qmldir"))))) { - QDeclarativeDirParser parser; - parser.setSource(QString::fromUtf8(resource->data)); - parser.parse(); - qmldircomponentsnetwork = parser.components(); - } - - importDatabase.addToImport(&unit->imports, qmldircomponentsnetwork, QLatin1String("."), - QString(), -1, -1, QDeclarativeScriptParser::Import::File, - 0); // error ignored (just means no fallback) - } - - - foreach (const QDeclarativeScriptParser::Import &imp, unit->data.imports()) { - QDeclarativeDirComponents qmldircomponentsnetwork; - if (imp.type == QDeclarativeScriptParser::Import::Script) - continue; - - if (imp.type == QDeclarativeScriptParser::Import::File && imp.qualifier.isEmpty()) { - QString importUrl = unit->imports.baseUrl().resolved(QUrl(imp.uri + QLatin1String("/qmldir"))).toString(); - for (int ii = 0; ii < unit->resources.count(); ++ii) { - if (unit->resources.at(ii)->url == importUrl) { - QDeclarativeDirParser parser; - parser.setSource(QString::fromUtf8(unit->resources.at(ii)->data)); - parser.parse(); - qmldircomponentsnetwork = parser.components(); - break; - } - } - } - - - int vmaj = -1; - int vmin = -1; - if (!imp.version.isEmpty()) { - int dot = imp.version.indexOf(QLatin1Char('.')); - if (dot < 0) { - vmaj = imp.version.toInt(); - vmin = 0; - } else { - vmaj = imp.version.left(dot).toInt(); - vmin = imp.version.mid(dot+1).toInt(); - } - } - - QString errorString; - if (!importDatabase.addToImport(&unit->imports, qmldircomponentsnetwork, imp.uri, imp.qualifier, - vmaj, vmin, imp.type, &errorString)) { - QDeclarativeError error; - error.setUrl(unit->imports.baseUrl()); - error.setDescription(errorString); - error.setLine(imp.location.start.line); - error.setColumn(imp.location.start.column); - unit->status = QDeclarativeCompositeTypeData::Error; - unit->errorType = QDeclarativeCompositeTypeData::GeneralError; - unit->errors << error; - doComplete(unit); - return 0; - } - } - - - QList<QDeclarativeScriptParser::TypeReference*> types = unit->data.referencedTypes(); - - for (int ii = 0; ii < types.count(); ++ii) { - QDeclarativeScriptParser::TypeReference *parserRef = types.at(ii); - QByteArray typeName = parserRef->name.toUtf8(); - - QDeclarativeCompositeTypeData::TypeReference ref; - - QUrl url; - int majorVersion; - int minorVersion; - QDeclarativeImportedNamespace *typeNamespace = 0; - QString errorString; - if (!importDatabase.resolveType(unit->imports, typeName, &ref.type, &url, &majorVersion, &minorVersion, - &typeNamespace, &errorString) || typeNamespace) { - // Known to not be a type: - // - known to be a namespace (Namespace {}) - // - type with unknown namespace (UnknownNamespace.SomeType {}) - QDeclarativeError error; - error.setUrl(unit->imports.baseUrl()); - QString userTypeName = QString::fromUtf8(typeName); - userTypeName.replace(QLatin1Char('/'),QLatin1Char('.')); - if (typeNamespace) - error.setDescription(tr("Namespace %1 cannot be used as a type").arg(userTypeName)); - else - error.setDescription(tr("%1 %2").arg(userTypeName).arg(errorString)); - - if (!parserRef->refObjects.isEmpty()) { - QDeclarativeParser::Object *obj = parserRef->refObjects.first(); - error.setLine(obj->location.start.line); - error.setColumn(obj->location.start.column); - } - unit->status = QDeclarativeCompositeTypeData::Error; - unit->errorType = QDeclarativeCompositeTypeData::GeneralError; - unit->errors << error; - doComplete(unit); - return 0; - } - - if (ref.type) { - foreach (QDeclarativeParser::Object *obj, parserRef->refObjects) { - // store namespace for DOM - obj->majorVersion = majorVersion; - obj->minorVersion = minorVersion; - } - unit->types << ref; - continue; - } - - Redirects::Iterator redir = redirects.find(url); - if (redir != redirects.end()) - url = *redir; - - QDeclarativeCompositeTypeData *urlUnit = components.value(url); - - if (!urlUnit) { - urlUnit = new QDeclarativeCompositeTypeData; - urlUnit->status = QDeclarativeCompositeTypeData::Waiting; - urlUnit->imports.setBaseUrl(url); - components.insert(url, urlUnit); - - loadSource(urlUnit); - } - - ref.unit = urlUnit; - switch(urlUnit->status) { - case QDeclarativeCompositeTypeData::Invalid: - case QDeclarativeCompositeTypeData::Error: - unit->status = QDeclarativeCompositeTypeData::Error; - { - QDeclarativeError error; - error.setUrl(unit->imports.baseUrl()); - error.setDescription(tr("Type %1 unavailable").arg(QString::fromUtf8(typeName))); - if (!parserRef->refObjects.isEmpty()) { - QDeclarativeParser::Object *obj = parserRef->refObjects.first(); - error.setLine(obj->location.start.line); - error.setColumn(obj->location.start.column); - } - unit->errors << error; - } - if (urlUnit->errorType != QDeclarativeCompositeTypeData::AccessError) - unit->errors << urlUnit->errors; - doComplete(unit); - return 0; - - case QDeclarativeCompositeTypeData::Complete: - break; - - case QDeclarativeCompositeTypeData::Waiting: - case QDeclarativeCompositeTypeData::WaitingResources: - unit->addref(); - ref.unit->dependants << unit; - waiting++; - break; - } - - unit->types << ref; - } - return waiting; -} - -// ### Check ref counting in here -void QDeclarativeCompositeTypeManager::compile(QDeclarativeCompositeTypeData *unit) -{ - int waiting = 0; - - QList<QUrl> resourceList = unit->data.referencedResources(); - - foreach (QDeclarativeScriptParser::Import imp, unit->data.imports()) { - if (imp.type == QDeclarativeScriptParser::Import::File && imp.qualifier.isEmpty()) { - QUrl importUrl = unit->imports.baseUrl().resolved(QUrl(imp.uri + QLatin1String("/qmldir"))); - if (QDeclarativeEnginePrivate::urlToLocalFileOrQrc(importUrl).isEmpty()) { - // Import requires remote qmldir - resourceList.prepend(importUrl); - } - } - } - - QUrl importUrl; - if (!unit->imports.baseUrl().scheme().isEmpty()) - importUrl = unit->imports.baseUrl().resolved(QUrl(QLatin1String("qmldir"))); - if (!importUrl.scheme().isEmpty() && QDeclarativeEnginePrivate::urlToLocalFileOrQrc(importUrl).isEmpty()) - resourceList.prepend(importUrl); - - for (int ii = 0; ii < resourceList.count(); ++ii) { - QUrl url = unit->imports.baseUrl().resolved(resourceList.at(ii)); - - QDeclarativeCompositeTypeResource *resource = resources.value(url); - - if (!resource) { - resource = new QDeclarativeCompositeTypeResource; - resource->status = QDeclarativeCompositeTypeResource::Waiting; - resource->url = url.toString(); - resources.insert(url, resource); - - loadResource(resource); - } - - switch(resource->status) { - case QDeclarativeCompositeTypeResource::Invalid: - case QDeclarativeCompositeTypeResource::Error: - unit->status = QDeclarativeCompositeTypeData::Error; - { - QDeclarativeError error; - error.setUrl(unit->imports.baseUrl()); - error.setDescription(tr("Resource %1 unavailable").arg(resource->url)); - unit->errors << error; - } - doComplete(unit); - return; - - case QDeclarativeCompositeTypeData::Complete: - break; - - case QDeclarativeCompositeTypeData::Waiting: - unit->addref(); - resource->dependants << unit; - waiting++; - break; - } - - resource->addref(); - unit->resources << resource; - } - - if (waiting == 0) { - waiting += resolveTypes(unit); - if (unit->status != QDeclarativeCompositeTypeData::Error) { - if (!waiting) { - unit->status = QDeclarativeCompositeTypeData::Complete; - doComplete(unit); - } else { - unit->status = QDeclarativeCompositeTypeData::Waiting; - } - } - } else { - unit->status = QDeclarativeCompositeTypeData::WaitingResources; - } -} - -QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativecompositetypemanager_p.h b/src/declarative/qml/qdeclarativecompositetypemanager_p.h deleted file mode 100644 index 5c82c4c..0000000 --- a/src/declarative/qml/qdeclarativecompositetypemanager_p.h +++ /dev/null @@ -1,120 +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 QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVECOMPOSITETYPEMANAGER_P_H -#define QDECLARATIVECOMPOSITETYPEMANAGER_P_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 "private/qdeclarativescriptparser_p.h" -#include "private/qdeclarativerefcount_p.h" -#include "qdeclarativeerror.h" -#include "qdeclarativeengine.h" - -#include <QtCore/qglobal.h> - -QT_BEGIN_NAMESPACE - -class QDeclarativeCompiledData; -class QDeclarativeComponentPrivate; -class QDeclarativeComponent; -class QDeclarativeDomDocument; - -class QDeclarativeCompositeTypeData; -class QDeclarativeCompositeTypeResource; - -class QDeclarativeCompositeTypeManager : public QObject -{ - Q_OBJECT -public: - QDeclarativeCompositeTypeManager(QDeclarativeEngine *); - ~QDeclarativeCompositeTypeManager(); - - // Return a QDeclarativeCompositeTypeData for url. The QDeclarativeCompositeTypeData may be - // cached. - QDeclarativeCompositeTypeData *get(const QUrl &url); - // Return a QDeclarativeCompositeTypeData for data, with the provided base url. The - // QDeclarativeCompositeTypeData will not be cached. - QDeclarativeCompositeTypeData *getImmediate(const QByteArray &data, const QUrl &url); - - // Clear cached types. Only types that aren't in the Waiting state will - // be cleared. - void clearCache(); - -private Q_SLOTS: - void replyFinished(); - void resourceReplyFinished(); - void requestProgress(qint64 received, qint64 total); - -private: - void loadSource(QDeclarativeCompositeTypeData *); - void loadResource(QDeclarativeCompositeTypeResource *); - void compile(QDeclarativeCompositeTypeData *); - void setData(QDeclarativeCompositeTypeData *, const QByteArray &, const QUrl &); - - void doComplete(QDeclarativeCompositeTypeData *); - void doComplete(QDeclarativeCompositeTypeResource *); - void checkComplete(QDeclarativeCompositeTypeData *); - int resolveTypes(QDeclarativeCompositeTypeData *); - - QDeclarativeEngine *engine; - typedef QHash<QUrl, QDeclarativeCompositeTypeData *> Components; - Components components; - typedef QHash<QUrl, QDeclarativeCompositeTypeResource *> Resources; - Resources resources; - typedef QHash<QUrl, QUrl> Redirects; - Redirects redirects; - int redirectCount; -}; - -QT_END_NAMESPACE - -#endif // QDECLARATIVECOMPOSITETYPEMANAGER_P_H - diff --git a/src/declarative/qml/qdeclarativecontext.cpp b/src/declarative/qml/qdeclarativecontext.cpp index a3b16d9..de45a95 100644 --- a/src/declarative/qml/qdeclarativecontext.cpp +++ b/src/declarative/qml/qdeclarativecontext.cpp @@ -660,14 +660,12 @@ void QDeclarativeContextData::addImportedScript(const QDeclarativeParser::Object if (!engine) return; - Q_ASSERT(script.codes.count() == 1); - QDeclarativeEnginePrivate *enginePriv = QDeclarativeEnginePrivate::get(engine); QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine); - const QString &code = script.codes.at(0); - const QString &url = script.files.at(0); - const QDeclarativeParser::Object::ScriptBlock::Pragmas &pragmas = script.pragmas.at(0); + const QString &code = script.code; + const QString &url = script.file; + const QDeclarativeParser::Object::ScriptBlock::Pragmas &pragmas = script.pragmas; Q_ASSERT(!url.isEmpty()); diff --git a/src/declarative/qml/qdeclarativedom.cpp b/src/declarative/qml/qdeclarativedom.cpp index 5b30bde..1a9b501 100644 --- a/src/declarative/qml/qdeclarativedom.cpp +++ b/src/declarative/qml/qdeclarativedom.cpp @@ -42,7 +42,6 @@ #include "private/qdeclarativedom_p.h" #include "private/qdeclarativedom_p_p.h" -#include "private/qdeclarativecompositetypedata_p.h" #include "private/qdeclarativecompiler_p.h" #include "private/qdeclarativeengine_p.h" #include "private/qdeclarativescriptparser_p.h" @@ -145,37 +144,23 @@ bool QDeclarativeDomDocument::load(QDeclarativeEngine *engine, const QByteArray d->errors.clear(); d->imports.clear(); - QDeclarativeCompiledData *component = new QDeclarativeCompiledData(engine); - QDeclarativeCompiler compiler; + QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine); + QDeclarativeTypeData *td = ep->typeLoader.get(data, url, QDeclarativeTypeLoader::PreserveParser); - QDeclarativeCompositeTypeData *td = ((QDeclarativeEnginePrivate *)QDeclarativeEnginePrivate::get(engine))->typeManager.getImmediate(data, url); - - if(td->status == QDeclarativeCompositeTypeData::Error) { - d->errors = td->errors; + if(td->isError()) { + d->errors = td->errors(); td->release(); - component->release(); return false; - } else if(td->status == QDeclarativeCompositeTypeData::Waiting || - td->status == QDeclarativeCompositeTypeData::WaitingResources) { + } else if(!td->isCompleteOrError()) { QDeclarativeError error; error.setDescription(QLatin1String("QDeclarativeDomDocument supports local types only")); d->errors << error; td->release(); - component->release(); - return false; - } - - compiler.compile(engine, td, component); - - if (compiler.isError()) { - d->errors = compiler.errors(); - td->release(); - component->release(); return false; } - for (int i = 0; i < td->data.imports().size(); ++i) { - QDeclarativeScriptParser::Import parserImport = td->data.imports().at(i); + for (int i = 0; i < td->parser().imports().size(); ++i) { + QDeclarativeScriptParser::Import parserImport = td->parser().imports().at(i); QDeclarativeDomImport domImport; domImport.d->type = static_cast<QDeclarativeDomImportPrivate::Type>(parserImport.type); domImport.d->uri = parserImport.uri; @@ -184,12 +169,12 @@ bool QDeclarativeDomDocument::load(QDeclarativeEngine *engine, const QByteArray d->imports += domImport; } - if (td->data.tree()) { - d->root = td->data.tree(); + if (td->parser().tree()) { + d->root = td->parser().tree(); d->root->addref(); } - component->release(); + td->release(); return true; } diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index c5a5c18..8461368 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -259,7 +259,7 @@ QDeclarativeEnginePrivate::QDeclarativeEnginePrivate(QDeclarativeEngine *e) objectClass(0), valueTypeClass(0), globalClass(0), cleanup(0), erroredBindings(0), inProgressCreations(0), scriptEngine(this), workerScriptEngine(0), componentAttached(0), inBeginCreate(false), networkAccessManager(0), networkAccessManagerFactory(0), - typeManager(e), importDatabase(e), uniqueId(1) + typeLoader(e), importDatabase(e), uniqueId(1) { if (!qt_QmlQtModule_registered) { qt_QmlQtModule_registered = true; @@ -565,7 +565,7 @@ QDeclarativeEngine::~QDeclarativeEngine() void QDeclarativeEngine::clearComponentCache() { Q_D(QDeclarativeEngine); - d->typeManager.clearCache(); + d->typeLoader.clearCache(); } /*! @@ -1716,6 +1716,9 @@ void QDeclarativeEnginePrivate::sendQuit() { Q_Q(QDeclarativeEngine); emit q->quit(); + if (q->receivers(SIGNAL(quit())) == 0) { + qWarning("Signal QDeclarativeEngine::quit() emitted, but no receivers connected to handle it."); + } } static void dumpwarning(const QDeclarativeError &error) diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h index db2db35..dc7315d 100644 --- a/src/declarative/qml/qdeclarativeengine_p.h +++ b/src/declarative/qml/qdeclarativeengine_p.h @@ -56,7 +56,7 @@ #include "qdeclarativeengine.h" #include "private/qdeclarativeclassfactory_p.h" -#include "private/qdeclarativecompositetypemanager_p.h" +#include "private/qdeclarativetypeloader_p.h" #include "private/qdeclarativeimport_p.h" #include "private/qpodvector_p.h" #include "qdeclarative.h" @@ -239,7 +239,7 @@ public: mutable QMutex mutex; - QDeclarativeCompositeTypeManager typeManager; + QDeclarativeTypeLoader typeLoader; QDeclarativeImportDatabase importDatabase; QString offlineStoragePath; diff --git a/src/declarative/qml/qdeclarativeimport.cpp b/src/declarative/qml/qdeclarativeimport.cpp index 5c21ebc..8f95e26 100644 --- a/src/declarative/qml/qdeclarativeimport.cpp +++ b/src/declarative/qml/qdeclarativeimport.cpp @@ -109,6 +109,11 @@ public: QHash<QString,QDeclarativeImportedNamespace* > set; }; +/*! +\class QDeclarativeImports +\brief The QDeclarativeImports class encapsulates one QML document's import statements. +\internal +*/ QDeclarativeImports::QDeclarativeImports(const QDeclarativeImports ©) : d(copy.d) { @@ -181,7 +186,7 @@ cacheForNamespace(QDeclarativeEngine *engine, const QDeclarativeImportedNamespac return cache; } -void QDeclarativeImports::cache(QDeclarativeTypeNameCache *cache, QDeclarativeEngine *engine) const +void QDeclarativeImports::populateCache(QDeclarativeTypeNameCache *cache, QDeclarativeEngine *engine) const { const QDeclarativeImportedNamespace &set = d->unqualifiedset; @@ -201,6 +206,67 @@ void QDeclarativeImports::cache(QDeclarativeTypeNameCache *cache, QDeclarativeEn cacheForNamespace(engine, set, cache); } + +/*! + \internal + + The given (namespace qualified) \a type is resolved to either + \list + \o a QDeclarativeImportedNamespace stored at \a ns_return, + \o a QDeclarativeType stored at \a type_return, or + \o a component located at \a url_return. + \endlist + + If any return pointer is 0, the corresponding search is not done. + + \sa addImport() +*/ +bool QDeclarativeImports::resolveType(const QByteArray& type, + QDeclarativeType** type_return, QUrl* url_return, int *vmaj, int *vmin, + QDeclarativeImportedNamespace** ns_return, QString *errorString) const +{ + QDeclarativeImportedNamespace* ns = d->findNamespace(QString::fromUtf8(type)); + if (ns) { + if (ns_return) + *ns_return = ns; + return true; + } + if (type_return || url_return) { + if (d->find(type,vmaj,vmin,type_return,url_return, errorString)) { + if (qmlImportTrace()) { + if (type_return && *type_return && url_return && !url_return->isEmpty()) + qDebug().nospace() << "QDeclarativeImports(" << qPrintable(baseUrl().toString()) << ")" << "::resolveType: " + << type << " => " << (*type_return)->typeName() << " " << *url_return; + if (type_return && *type_return) + qDebug().nospace() << "QDeclarativeImports(" << qPrintable(baseUrl().toString()) << ")" << "::resolveType: " + << type << " => " << (*type_return)->typeName(); + if (url_return && !url_return->isEmpty()) + qDebug().nospace() << "QDeclarativeImports(" << qPrintable(baseUrl().toString()) << ")" << "::resolveType: " + << type << " => " << *url_return; + } + return true; + } + } + return false; +} + +/*! + \internal + + Searching \e only in the namespace \a ns (previously returned in a call to + resolveType(), \a type is found and returned to either + a QDeclarativeType stored at \a type_return, or + a component located at \a url_return. + + If either return pointer is 0, the corresponding search is not done. +*/ +bool QDeclarativeImports::resolveType(QDeclarativeImportedNamespace* ns, const QByteArray& type, + QDeclarativeType** type_return, QUrl* url_return, + int *vmaj, int *vmin) const +{ + return ns->find(type,vmaj,vmin,type_return,url_return); +} + bool QDeclarativeImportedNamespace::find_helper(int i, const QByteArray& type, int *vmajor, int *vminor, QDeclarativeType** type_return, QUrl* url_return, QUrl *base, bool *typeRecursionDetected) @@ -280,15 +346,16 @@ QDeclarativeImportsPrivate::~QDeclarativeImportsPrivate() } bool QDeclarativeImportsPrivate::importExtension(const QString &absoluteFilePath, const QString &uri, - QDeclarativeImportDatabase *database, - QDeclarativeDirComponents* components, QString *errorString) + QDeclarativeImportDatabase *database, + QDeclarativeDirComponents* components, QString *errorString) { QFile file(absoluteFilePath); QString filecontent; if (file.open(QFile::ReadOnly)) { filecontent = QString::fromUtf8(file.readAll()); if (qmlImportTrace()) - qDebug() << "QDeclarativeImportDatabase::add: loaded" << absoluteFilePath; + qDebug().nospace() << "QDeclarativeImports(" << qPrintable(base.toString()) << "::importExtension: " + << "loaded " << absoluteFilePath; } else { if (errorString) *errorString = QDeclarativeImportDatabase::tr("module \"%1\" definition \"%2\" not readable").arg(uri).arg(absoluteFilePath); @@ -576,6 +643,10 @@ bool QDeclarativeImportedNamespace::find(const QByteArray& type, int *vmajor, in return false; } +/*! +\class QDeclarativeImportDatabase +\brief The QDeclarativeImportDatabase class manages the QML imports for a QDeclarativeEngine. +*/ QDeclarativeImportDatabase::QDeclarativeImportDatabase(QDeclarativeEngine *e) : engine(e) { @@ -619,75 +690,19 @@ QDeclarativeImportDatabase::~QDeclarativeImportDatabase() The base URL must already have been set with Import::setBaseUrl(). */ -bool QDeclarativeImportDatabase::addToImport(QDeclarativeImports* imports, - const QDeclarativeDirComponents &qmldircomponentsnetwork, - const QString& uri, const QString& prefix, int vmaj, int vmin, - QDeclarativeScriptParser::Import::Type importType, - QString *errorString) +bool QDeclarativeImports::addImport(QDeclarativeImportDatabase *importDb, + const QString& uri, const QString& prefix, int vmaj, int vmin, + QDeclarativeScriptParser::Import::Type importType, + const QDeclarativeDirComponents &qmldircomponentsnetwork, + QString *errorString) { if (qmlImportTrace()) - qDebug().nospace() << "QDeclarativeImportDatabase::addToImport " << imports << " " << uri << " " - << vmaj << '.' << vmin << " " + qDebug().nospace() << "QDeclarativeImports(" << qPrintable(baseUrl().toString()) << ")" << "::addImport: " + << uri << " " << vmaj << '.' << vmin << " " << (importType==QDeclarativeScriptParser::Import::Library? "Library" : "File") << " as " << prefix; - bool ok = imports->d->add(qmldircomponentsnetwork, uri, prefix, vmaj, vmin, importType, this, errorString); - return ok; -} - -/*! - \internal - - Using the given \a imports, the given (namespace qualified) \a type is resolved to either - a QDeclarativeImportedNamespace stored at \a ns_return, - a QDeclarativeType stored at \a type_return, or - a component located at \a url_return. - - If any return pointer is 0, the corresponding search is not done. - - \sa addToImport() -*/ -bool QDeclarativeImportDatabase::resolveType(const QDeclarativeImports& imports, const QByteArray& type, - QDeclarativeType** type_return, QUrl* url_return, int *vmaj, int *vmin, - QDeclarativeImportedNamespace** ns_return, QString *errorString) const -{ - QDeclarativeImportedNamespace* ns = imports.d->findNamespace(QString::fromUtf8(type)); - if (ns) { - if (ns_return) - *ns_return = ns; - return true; - } - if (type_return || url_return) { - if (imports.d->find(type,vmaj,vmin,type_return,url_return, errorString)) { - if (qmlImportTrace()) { - if (type_return && *type_return && url_return && !url_return->isEmpty()) - qDebug() << "QDeclarativeImportDatabase::resolveType" << type << '=' << (*type_return)->typeName() << *url_return; - if (type_return && *type_return) - qDebug() << "QDeclarativeImportDatabase::resolveType" << type << '=' << (*type_return)->typeName(); - if (url_return && !url_return->isEmpty()) - qDebug() << "QDeclarativeImportDatabase::resolveType" << type << '=' << *url_return; - } - return true; - } - } - return false; -} - -/*! - \internal - - Searching \e only in the namespace \a ns (previously returned in a call to - resolveType(), \a type is found and returned to either - a QDeclarativeType stored at \a type_return, or - a component located at \a url_return. - - If either return pointer is 0, the corresponding search is not done. -*/ -bool QDeclarativeImportDatabase::resolveTypeInNamespace(QDeclarativeImportedNamespace* ns, const QByteArray& type, - QDeclarativeType** type_return, QUrl* url_return, - int *vmaj, int *vmin) const -{ - return ns->find(type,vmaj,vmin,type_return,url_return); + return d->add(qmldircomponentsnetwork, uri, prefix, vmaj, vmin, importType, importDb, errorString); } /*! @@ -834,7 +849,7 @@ void QDeclarativeImportDatabase::setPluginPathList(const QStringList &paths) void QDeclarativeImportDatabase::addPluginPath(const QString& path) { if (qmlImportTrace()) - qDebug() << "QDeclarativeImportDatabase::addPluginPath" << path; + qDebug().nospace() << "QDeclarativeImportDatabase::addPluginPath: " << path; QUrl url = QUrl(path); if (url.isRelative() || url.scheme() == QLatin1String("file")) { @@ -848,7 +863,7 @@ void QDeclarativeImportDatabase::addPluginPath(const QString& path) void QDeclarativeImportDatabase::addImportPath(const QString& path) { if (qmlImportTrace()) - qDebug() << "QDeclarativeImportDatabase::addImportPath" << path; + qDebug().nospace() << "QDeclarativeImportDatabase::addImportPath: " << path; if (path.isEmpty()) return; @@ -882,7 +897,7 @@ void QDeclarativeImportDatabase::setImportPathList(const QStringList &paths) bool QDeclarativeImportDatabase::importPlugin(const QString &filePath, const QString &uri, QString *errorString) { if (qmlImportTrace()) - qDebug() << "QDeclarativeImportDatabase::importPlugin" << uri << "from" << filePath; + qDebug().nospace() << "QDeclarativeImportDatabase::importPlugin: " << uri << " from " << filePath; QFileInfo fileInfo(filePath); const QString absoluteFilePath = fileInfo.absoluteFilePath(); diff --git a/src/declarative/qml/qdeclarativeimport_p.h b/src/declarative/qml/qdeclarativeimport_p.h index 88246d4..84802de 100644 --- a/src/declarative/qml/qdeclarativeimport_p.h +++ b/src/declarative/qml/qdeclarativeimport_p.h @@ -65,9 +65,10 @@ QT_BEGIN_NAMESPACE class QDeclarativeTypeNameCache; class QDeclarativeEngine; class QDir; - class QDeclarativeImportedNamespace; class QDeclarativeImportsPrivate; +class QDeclarativeImportDatabase; + class QDeclarativeImports { public: @@ -79,7 +80,24 @@ public: void setBaseUrl(const QUrl &url); QUrl baseUrl() const; - void cache(QDeclarativeTypeNameCache *cache, QDeclarativeEngine *) const; + bool resolveType(const QByteArray& type, + QDeclarativeType** type_return, QUrl* url_return, + int *version_major, int *version_minor, + QDeclarativeImportedNamespace** ns_return, + QString *errorString = 0) const; + bool resolveType(QDeclarativeImportedNamespace*, + const QByteArray& type, + QDeclarativeType** type_return, QUrl* url_return, + int *version_major, int *version_minor) const; + + bool addImport(QDeclarativeImportDatabase *, + const QString& uri, const QString& prefix, int vmaj, int vmin, + QDeclarativeScriptParser::Import::Type importType, + const QDeclarativeDirComponents &qmldircomponentsnetwork, + QString *errorString); + + void populateCache(QDeclarativeTypeNameCache *cache, QDeclarativeEngine *) const; + private: friend class QDeclarativeImportDatabase; QDeclarativeImportsPrivate *d; @@ -102,21 +120,6 @@ public: void setPluginPathList(const QStringList &paths); void addPluginPath(const QString& path); - - bool addToImport(QDeclarativeImports*, const QDeclarativeDirComponents &qmldircomponentsnetwork, - const QString& uri, const QString& prefix, int vmaj, int vmin, - QDeclarativeScriptParser::Import::Type importType, - QString *errorString); - bool resolveType(const QDeclarativeImports&, const QByteArray& type, - QDeclarativeType** type_return, QUrl* url_return, - int *version_major, int *version_minor, - QDeclarativeImportedNamespace** ns_return, - QString *errorString = 0) const; - bool resolveTypeInNamespace(QDeclarativeImportedNamespace*, const QByteArray& type, - QDeclarativeType** type_return, QUrl* url_return, - int *version_major, int *version_minor ) const; - - private: friend class QDeclarativeImportsPrivate; QString resolvePlugin(const QDir &qmldirPath, const QString &qmldirPluginPath, diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp index 3af892d..f439151 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp @@ -192,7 +192,7 @@ QDeclarativeObjectScriptClass::queryProperty(QObject *obj, const Identifier &nam if (!(hints & ImplicitObject)) { local.coreIndex = -1; lastData = &local; - return QScriptClass::HandlesReadAccess | QScriptClass::HandlesWriteAccess; + return QScriptClass::HandlesWriteAccess; } return 0; diff --git a/src/declarative/qml/qdeclarativeparser_p.h b/src/declarative/qml/qdeclarativeparser_p.h index d192f3a..c58aebc 100644 --- a/src/declarative/qml/qdeclarativeparser_p.h +++ b/src/declarative/qml/qdeclarativeparser_p.h @@ -183,10 +183,9 @@ namespace QDeclarativeParser }; Q_DECLARE_FLAGS(Pragmas, Pragma) - QStringList codes; - QStringList files; - QList<int> lineNumbers; - QList<Pragmas> pragmas; + QString code; + QString file; + Pragmas pragmas; }; // The bytes to cast instances by to get to the QDeclarativeParserStatus diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp index 515c4d6..d0dd2e8 100644 --- a/src/declarative/qml/qdeclarativeproperty.cpp +++ b/src/declarative/qml/qdeclarativeproperty.cpp @@ -42,7 +42,6 @@ #include "qdeclarativeproperty.h" #include "private/qdeclarativeproperty_p.h" -#include "private/qdeclarativecompositetypedata_p.h" #include "qdeclarative.h" #include "private/qdeclarativebinding_p.h" #include "qdeclarativecontext.h" diff --git a/src/declarative/qml/qdeclarativepropertycache.cpp b/src/declarative/qml/qdeclarativepropertycache.cpp index 839d79f..08503c2 100644 --- a/src/declarative/qml/qdeclarativepropertycache.cpp +++ b/src/declarative/qml/qdeclarativepropertycache.cpp @@ -134,8 +134,9 @@ QDeclarativePropertyCache::~QDeclarativePropertyCache() void QDeclarativePropertyCache::clear() { - for (int ii = 0; ii < indexCache.count(); ++ii) - indexCache.at(ii)->release(); + for (int ii = 0; ii < indexCache.count(); ++ii) { + if (indexCache.at(ii)) indexCache.at(ii)->release(); + } for (StringCache::ConstIterator iter = stringCache.begin(); iter != stringCache.end(); ++iter) @@ -156,14 +157,27 @@ QDeclarativePropertyCache::Data QDeclarativePropertyCache::create(const QMetaObj Q_ASSERT(metaObject); QDeclarativePropertyCache::Data rv; - int idx = metaObject->indexOfProperty(property.toUtf8()); - if (idx != -1) { - rv.load(metaObject->property(idx)); - return rv; + { + const QMetaObject *cmo = metaObject; + while (cmo) { + int idx = metaObject->indexOfProperty(property.toUtf8()); + if (idx != -1) { + QMetaProperty p = metaObject->property(idx); + if (p.isScriptable()) { + rv.load(metaObject->property(idx)); + return rv; + } else { + while (cmo && cmo->propertyOffset() >= idx) + cmo = cmo->superClass(); + } + } else { + cmo = 0; + } + } } int methodCount = metaObject->methodCount(); - for (int ii = methodCount - 1; ii >= 2; --ii) { // >=2 to block the destroyed signal + for (int ii = methodCount - 1; ii >= 3; --ii) { // >=3 to block the destroyed signal and deleteLater() slot QMetaMethod m = metaObject->method(ii); if (m.access() == QMetaMethod::Private) continue; @@ -189,8 +203,9 @@ QDeclarativePropertyCache *QDeclarativePropertyCache::copy() const cache->stringCache = stringCache; cache->identifierCache = identifierCache; - for (int ii = 0; ii < indexCache.count(); ++ii) - indexCache.at(ii)->addref(); + for (int ii = 0; ii < indexCache.count(); ++ii) { + if (indexCache.at(ii)) indexCache.at(ii)->addref(); + } for (StringCache::ConstIterator iter = stringCache.begin(); iter != stringCache.end(); ++iter) (*iter)->addref(); for (IdentifierCache::ConstIterator iter = identifierCache.begin(); iter != identifierCache.end(); ++iter) @@ -210,6 +225,9 @@ void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaOb indexCache.resize(propCount); for (int ii = propOffset; ii < propCount; ++ii) { QMetaProperty p = metaObject->property(ii); + if (!p.isScriptable()) + continue; + QString propName = QString::fromUtf8(p.name()); RData *data = new RData; @@ -275,6 +293,10 @@ void QDeclarativePropertyCache::update(QDeclarativeEngine *engine, const QMetaOb indexCache.resize(propCount); for (int ii = propCount - 1; ii >= 0; --ii) { QMetaProperty p = metaObject->property(ii); + if (!p.isScriptable()) { + indexCache[ii] = 0; + continue; + } QString propName = QString::fromUtf8(p.name()); RData *data = new RData; @@ -294,7 +316,7 @@ void QDeclarativePropertyCache::update(QDeclarativeEngine *engine, const QMetaOb } int methodCount = metaObject->methodCount(); - for (int ii = methodCount - 1; ii >= 2; --ii) { // >=2 to block the destroyed signal + for (int ii = methodCount - 1; ii >= 3; --ii) { // >=3 to block the destroyed signal and deleteLater() slot QMetaMethod m = metaObject->method(ii); if (m.access() == QMetaMethod::Private) continue; diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp index 0b3b35f..c956051 100644 --- a/src/declarative/qml/qdeclarativescriptparser.cpp +++ b/src/declarative/qml/qdeclarativescriptparser.cpp @@ -387,7 +387,6 @@ bool ProcessAST::visit(AST::UiImport *node) if (uri.endsWith(QLatin1String(".js"))) { import.type = QDeclarativeScriptParser::Import::Script; - _parser->_refUrls << QUrl(uri); } else { import.type = QDeclarativeScriptParser::Import::File; } @@ -878,11 +877,6 @@ QList<QDeclarativeScriptParser::TypeReference*> QDeclarativeScriptParser::refere return _refTypes; } -QList<QUrl> QDeclarativeScriptParser::referencedResources() const -{ - return _refUrls; -} - Object *QDeclarativeScriptParser::tree() const { return root; @@ -960,6 +954,217 @@ QDeclarativeParser::Object::ScriptBlock::Pragmas QDeclarativeScriptParser::extra return rv; } +#define CHECK_LINE if(l.currentLineNo() != startLine) return rv; +#define CHECK_TOKEN(t) if (token != QDeclarativeJSGrammar:: t) return rv; + +static const int uriTokens[] = { + QDeclarativeJSGrammar::T_IDENTIFIER, + QDeclarativeJSGrammar::T_PROPERTY, + QDeclarativeJSGrammar::T_SIGNAL, + QDeclarativeJSGrammar::T_READONLY, + QDeclarativeJSGrammar::T_ON, + QDeclarativeJSGrammar::T_BREAK, + QDeclarativeJSGrammar::T_CASE, + QDeclarativeJSGrammar::T_CATCH, + QDeclarativeJSGrammar::T_CONTINUE, + QDeclarativeJSGrammar::T_DEFAULT, + QDeclarativeJSGrammar::T_DELETE, + QDeclarativeJSGrammar::T_DO, + QDeclarativeJSGrammar::T_ELSE, + QDeclarativeJSGrammar::T_FALSE, + QDeclarativeJSGrammar::T_FINALLY, + QDeclarativeJSGrammar::T_FOR, + QDeclarativeJSGrammar::T_FUNCTION, + QDeclarativeJSGrammar::T_IF, + QDeclarativeJSGrammar::T_IN, + QDeclarativeJSGrammar::T_INSTANCEOF, + QDeclarativeJSGrammar::T_NEW, + QDeclarativeJSGrammar::T_NULL, + QDeclarativeJSGrammar::T_RETURN, + QDeclarativeJSGrammar::T_SWITCH, + QDeclarativeJSGrammar::T_THIS, + QDeclarativeJSGrammar::T_THROW, + QDeclarativeJSGrammar::T_TRUE, + QDeclarativeJSGrammar::T_TRY, + QDeclarativeJSGrammar::T_TYPEOF, + QDeclarativeJSGrammar::T_VAR, + QDeclarativeJSGrammar::T_VOID, + QDeclarativeJSGrammar::T_WHILE, + QDeclarativeJSGrammar::T_CONST, + QDeclarativeJSGrammar::T_DEBUGGER, + QDeclarativeJSGrammar::T_RESERVED_WORD, + QDeclarativeJSGrammar::T_WITH, + + QDeclarativeJSGrammar::EOF_SYMBOL +}; +static inline bool isUriToken(int token) +{ + const int *current = uriTokens; + while (*current != QDeclarativeJSGrammar::EOF_SYMBOL) { + if (*current == token) + return true; + ++current; + } + return false; +} + +QDeclarativeScriptParser::JavaScriptMetaData QDeclarativeScriptParser::extractMetaData(QString &script) +{ + JavaScriptMetaData rv; + + QDeclarativeParser::Object::ScriptBlock::Pragmas &pragmas = rv.pragmas; + + const QString pragma(QLatin1String("pragma")); + const QString js(QLatin1String(".js")); + const QString library(QLatin1String("library")); + + QDeclarativeJS::Lexer l(0); + l.setCode(script, 0); + + int token = l.lex(); + + while (true) { + if (token != QDeclarativeJSGrammar::T_DOT) + return rv; + + int startOffset = l.tokenOffset(); + int startLine = l.currentLineNo(); + + token = l.lex(); + + CHECK_LINE; + + if (token == QDeclarativeJSGrammar::T_IMPORT) { + + // .import <URI> <Version> as <Identifier> + // .import <file.js> as <Identifier> + + token = l.lex(); + + CHECK_LINE; + + if (token == QDeclarativeJSGrammar::T_STRING_LITERAL) { + + QString file(l.characterBuffer(), l.characterCount()); + if (!file.endsWith(js)) + return rv; + + token = l.lex(); + + CHECK_TOKEN(T_AS); + CHECK_LINE; + + token = l.lex(); + + CHECK_TOKEN(T_IDENTIFIER); + CHECK_LINE; + + int endOffset = l.tokenLength() + l.tokenOffset(); + + QString importId = script.mid(l.tokenOffset(), l.tokenLength()); + + if (!importId.at(0).isUpper()) + return rv; + + token = l.lex(); + if (l.currentLineNo() == startLine) + return rv; + + replaceWithSpace(script, startOffset, endOffset - startOffset); + + Import import; + import.type = Import::Script; + import.uri = file; + import.qualifier = importId; + + rv.imports << import; + + } else { + // URI + QString uri; + QString version; + + while (true) { + if (!isUriToken(token)) + return rv; + + uri.append(QString(l.characterBuffer(), l.characterCount())); + + token = l.lex(); + CHECK_LINE; + if (token != QDeclarativeJSGrammar::T_DOT) + break; + + uri.append(QLatin1Char('.')); + + token = l.lex(); + CHECK_LINE; + } + + CHECK_TOKEN(T_NUMERIC_LITERAL); + version = script.mid(l.tokenOffset(), l.tokenLength()); + + token = l.lex(); + + CHECK_TOKEN(T_AS); + CHECK_LINE; + + token = l.lex(); + + CHECK_TOKEN(T_IDENTIFIER); + CHECK_LINE; + + int endOffset = l.tokenLength() + l.tokenOffset(); + + QString importId = script.mid(l.tokenOffset(), l.tokenLength()); + + if (!importId.at(0).isUpper()) + return rv; + + token = l.lex(); + if (l.currentLineNo() == startLine) + return rv; + + replaceWithSpace(script, startOffset, endOffset - startOffset); + + Import import; + import.type = Import::Library; + import.uri = uri; + import.version = version; + import.qualifier = importId; + + rv.imports << import; + } + + } else if (token == QDeclarativeJSGrammar::T_IDENTIFIER && + script.mid(l.tokenOffset(), l.tokenLength()) == pragma) { + + token = l.lex(); + + CHECK_TOKEN(T_IDENTIFIER); + CHECK_LINE; + + QString pragmaValue = script.mid(l.tokenOffset(), l.tokenLength()); + int endOffset = l.tokenLength() + l.tokenOffset(); + + if (pragmaValue == QLatin1String("library")) { + pragmas |= QDeclarativeParser::Object::ScriptBlock::Shared; + replaceWithSpace(script, startOffset, endOffset - startOffset); + } else { + return rv; + } + + token = l.lex(); + if (l.currentLineNo() == startLine) + return rv; + + } else { + return rv; + } + } + return rv; +} + void QDeclarativeScriptParser::clear() { if (root) { diff --git a/src/declarative/qml/qdeclarativescriptparser_p.h b/src/declarative/qml/qdeclarativescriptparser_p.h index 28e960b..6319e11 100644 --- a/src/declarative/qml/qdeclarativescriptparser_p.h +++ b/src/declarative/qml/qdeclarativescriptparser_p.h @@ -103,7 +103,6 @@ public: bool parse(const QByteArray &data, const QUrl &url = QUrl()); QList<TypeReference*> referencedTypes() const; - QList<QUrl> referencedResources() const; QDeclarativeParser::Object *tree() const; QList<Import> imports() const; @@ -112,7 +111,18 @@ public: QList<QDeclarativeError> errors() const; + class JavaScriptMetaData { + public: + JavaScriptMetaData() + : pragmas(QDeclarativeParser::Object::ScriptBlock::None) {} + + QDeclarativeParser::Object::ScriptBlock::Pragmas pragmas; + QList<Import> imports; + }; + static QDeclarativeParser::Object::ScriptBlock::Pragmas extractPragmas(QString &); + static JavaScriptMetaData extractMetaData(QString &); + // ### private: TypeReference *findOrCreateType(const QString &name); @@ -127,7 +137,6 @@ public: QDeclarativeParser::Object *root; QList<Import> _imports; QList<TypeReference*> _refTypes; - QList<QUrl> _refUrls; QString _scriptFile; QDeclarativeScriptParserJsASTData *data; }; diff --git a/src/declarative/qml/qdeclarativetypeloader.cpp b/src/declarative/qml/qdeclarativetypeloader.cpp new file mode 100644 index 0000000..8c291f2 --- /dev/null +++ b/src/declarative/qml/qdeclarativetypeloader.cpp @@ -0,0 +1,1070 @@ +/**************************************************************************** +** +** 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 QtDeclarative 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 "qdeclarativetypeloader_p.h" + +#include <private/qdeclarativeengine_p.h> +#include <private/qdeclarativecompiler_p.h> +#include <private/qdeclarativecomponent_p.h> + +#include <QtDeclarative/qdeclarativecomponent.h> +#include <QtCore/qdebug.h> +#include <QtCore/qdir.h> +#include <QtCore/qfile.h> + +QT_BEGIN_NAMESPACE + +/*! +\class QDeclarativeDataBlob +\brief The QDeclarativeDataBlob encapsulates a data request that can be issued to a QDeclarativeDataLoader. +\internal + +QDeclarativeDataBlob's are loaded by a QDeclarativeDataLoader. The user creates the QDeclarativeDataBlob +and then calls QDeclarativeDataLoader::load() or QDeclarativeDataLoader::loadWithStaticData() to load it. +The QDeclarativeDataLoader invokes callbacks on the QDeclarativeDataBlob as data becomes available. +*/ + +/*! +\enum QDeclarativeDataBlob::Status + +\o Null The blob has not yet been loaded by a QDeclarativeDataLoader +\o Loading The blob is loading network data. The QDeclarativeDataBlob::setData() callback has not yet been +invoked or has not yet returned. +\o WaitingForDependencies The blob is waiting for dependencies to be done before continueing. This status +only occurs after the QDeclarativeDataBlob::setData() callback has been made, and when the blob has outstanding +dependencies. +\o Complete The blob's data has been loaded and all dependencies are done. +\o Error An error has been set on this blob. +*/ + +/*! +\enum QDeclarativeDataBlob::Type +\o QmlFile This is a QDeclarativeTypeData +\o JavaScriptFile This is a QDeclarativeScriptData +\o QmldirFile This is a QDeclarativeQmldirData +*/ + +/*! +Create a new QDeclarativeDataBlob for \a url and of the provided \a type. +*/ +QDeclarativeDataBlob::QDeclarativeDataBlob(const QUrl &url, Type type) +: m_type(type), m_status(Null), m_progress(0), m_url(url), m_finalUrl(url), m_manager(0), + m_redirectCount(0), m_inCallback(false), m_isDone(false) +{ +} + +/*! \internal */ +QDeclarativeDataBlob::~QDeclarativeDataBlob() +{ + Q_ASSERT(m_waitingOnMe.isEmpty()); + + cancelAllWaitingFor(); +} + +/*! +Returns the type provided to the constructor. +*/ +QDeclarativeDataBlob::Type QDeclarativeDataBlob::type() const +{ + return m_type; +} + +/*! +Returns the blob's status. +*/ +QDeclarativeDataBlob::Status QDeclarativeDataBlob::status() const +{ + return m_status; +} + +/*! +Returns true if the status is Null. +*/ +bool QDeclarativeDataBlob::isNull() const +{ + return m_status == Null; +} + +/*! +Returns true if the status is Loading. +*/ +bool QDeclarativeDataBlob::isLoading() const +{ + return m_status == Loading; +} + +/*! +Returns true if the status is WaitingForDependencies. +*/ +bool QDeclarativeDataBlob::isWaiting() const +{ + return m_status == WaitingForDependencies; +} + +/*! +Returns true if the status is Complete. +*/ +bool QDeclarativeDataBlob::isComplete() const +{ + return m_status == Complete; +} + +/*! +Returns true if the status is Error. +*/ +bool QDeclarativeDataBlob::isError() const +{ + return m_status == Error; +} + +/*! +Returns true if the status is Complete or Error. +*/ +bool QDeclarativeDataBlob::isCompleteOrError() const +{ + return isComplete() || isError(); +} + +/*! +Returns the data download progress from 0 to 1. +*/ +qreal QDeclarativeDataBlob::progress() const +{ + return m_progress; +} + +/*! +Returns the blob url passed to the constructor. If a network redirect +happens while fetching the data, this url remains the same. + +\sa finalUrl() +*/ +QUrl QDeclarativeDataBlob::url() const +{ + return m_url; +} + +/*! +Returns the final url of the data. Initially this is the same as +url(), but if a network redirect happens while fetching the data, this url +is updated to reflect the new location. +*/ +QUrl QDeclarativeDataBlob::finalUrl() const +{ + return m_finalUrl; +} + +/*! +Return the errors on this blob. +*/ +QList<QDeclarativeError> QDeclarativeDataBlob::errors() const +{ + return m_errors; +} + +/*! +Mark this blob as having \a errors. + +All outstanding dependencies will be cancelled. Requests to add new dependencies +will be ignored. Entry into the Error state is irreversable, although you can change the +specific errors by additional calls to setError. +*/ +void QDeclarativeDataBlob::setError(const QDeclarativeError &errors) +{ + QList<QDeclarativeError> l; + l << errors; + setError(l); +} + +/*! +\override +*/ +void QDeclarativeDataBlob::setError(const QList<QDeclarativeError> &errors) +{ + m_status = Error; + m_errors = errors; + + cancelAllWaitingFor(); + + if (!m_inCallback) + tryDone(); +} + +/*! +Wait for \a blob to become complete or to error. If \a blob is already +complete or in error, or this blob is already complete, this has no effect. +*/ +void QDeclarativeDataBlob::addDependency(QDeclarativeDataBlob *blob) +{ + Q_ASSERT(status() != Null); + + if (!blob || + blob->status() == Error || blob->status() == Complete || + status() == Error || status() == Complete || + m_waitingFor.contains(blob)) + return; + + blob->addref(); + m_status = WaitingForDependencies; + m_waitingFor.append(blob); + blob->m_waitingOnMe.append(this); +} + +/*! +\fn void QDeclarativeDataBlob::dataReceived(const QByteArray &data) + +Invoked when data for the blob is received. Implementors should use this callback +to determine a blob's dependencies. Within this callback you may call setError() +or addDependency(). +*/ + +/*! +Invoked once data has either been received or a network error occurred, and all +dependencies are complete. + +You can set an error in this method, but you cannot add new dependencies. Implementors +should use this callback to finalize processing of data. + +The default implementation does nothing. +*/ +void QDeclarativeDataBlob::done() +{ +} + +/*! +Invoked if there is a network error while fetching this blob. + +The default implementation sets an appropriate QDeclarativeError. +*/ +void QDeclarativeDataBlob::networkError(QNetworkReply::NetworkError networkError) +{ + Q_UNUSED(networkError); + + QDeclarativeError error; + error.setUrl(m_finalUrl); + + const char *errorString = 0; + switch (networkError) { + default: + errorString = "Network error"; + break; + case QNetworkReply::ConnectionRefusedError: + errorString = "Connection refused"; + break; + case QNetworkReply::RemoteHostClosedError: + errorString = "Remote host closed the connection"; + break; + case QNetworkReply::HostNotFoundError: + errorString = "Host not found"; + break; + case QNetworkReply::TimeoutError: + errorString = "Timeout"; + break; + case QNetworkReply::ProxyConnectionRefusedError: + case QNetworkReply::ProxyConnectionClosedError: + case QNetworkReply::ProxyNotFoundError: + case QNetworkReply::ProxyTimeoutError: + case QNetworkReply::ProxyAuthenticationRequiredError: + case QNetworkReply::UnknownProxyError: + errorString = "Proxy error"; + break; + case QNetworkReply::ContentAccessDenied: + errorString = "Access denied"; + break; + case QNetworkReply::ContentNotFoundError: + errorString = "File not found"; + break; + case QNetworkReply::AuthenticationRequiredError: + errorString = "Authentication required"; + break; + }; + + error.setDescription(QLatin1String(errorString)); + + setError(error); +} + +/*! +Called if \a blob, which was previously waited for, has an error. + +The default implementation does nothing. +*/ +void QDeclarativeDataBlob::dependencyError(QDeclarativeDataBlob *blob) +{ + Q_UNUSED(blob); +} + +/*! +Called if \a blob, which was previously waited for, has completed. + +The default implementation does nothing. +*/ +void QDeclarativeDataBlob::dependencyComplete(QDeclarativeDataBlob *blob) +{ + Q_UNUSED(blob); +} + +/*! +Called when all blobs waited for have completed. This occurs regardless of +whether they are in error, or complete state. + +The default implementation does nothing. +*/ +void QDeclarativeDataBlob::allDependenciesDone() +{ +} + +/*! +Called when the download progress of this blob changes. \a progress goes +from 0 to 1. +*/ +void QDeclarativeDataBlob::downloadProgressChanged(qreal progress) +{ + Q_UNUSED(progress); +} + +void QDeclarativeDataBlob::tryDone() +{ + if (status() != Loading && m_waitingFor.isEmpty() && !m_isDone) { + if (status() != Error) + m_status = Complete; + + m_isDone = true; + done(); + notifyAllWaitingOnMe(); + } +} + +void QDeclarativeDataBlob::cancelAllWaitingFor() +{ + while (m_waitingFor.count()) { + QDeclarativeDataBlob *blob = m_waitingFor.takeLast(); + + Q_ASSERT(blob->m_waitingOnMe.contains(this)); + + blob->m_waitingOnMe.removeOne(this); + + blob->release(); + } +} + +void QDeclarativeDataBlob::notifyAllWaitingOnMe() +{ + while (m_waitingOnMe.count()) { + QDeclarativeDataBlob *blob = m_waitingOnMe.takeLast(); + + Q_ASSERT(blob->m_waitingFor.contains(this)); + + blob->notifyComplete(this); + } +} + +void QDeclarativeDataBlob::notifyComplete(QDeclarativeDataBlob *blob) +{ + Q_ASSERT(m_waitingFor.contains(blob)); + Q_ASSERT(blob->status() == Error || blob->status() == Complete); + + m_inCallback = true; + + if (blob->status() == Error) { + dependencyError(blob); + } else if (blob->status() == Complete) { + dependencyComplete(blob); + } + + m_waitingFor.removeOne(blob); + blob->release(); + + if (!isError() && m_waitingFor.isEmpty()) + allDependenciesDone(); + + m_inCallback = false; + + tryDone(); +} + +/*! +\class QDeclarativeDataLoader +\brief The QDeclarativeDataLoader class abstracts loading files and their dependecies over the network. +\internal + +The QDeclarativeDataLoader class is provided for the exclusive use of the QDeclarativeTypeLoader class. + +Clients create QDeclarativeDataBlob instances and submit them to the QDeclarativeDataLoader class +through the QDeclarativeDataLoader::load() or QDeclarativeDataLoader::loadWithStaticData() methods. +The loader then fetches the data over the network or from the local file system in an efficient way. +QDeclarativeDataBlob is an abstract class, so should always be specialized. + +Once data is received, the QDeclarativeDataBlob::dataReceived() method is invoked on the blob. The +derived class should use this callback to process the received data. Processing of the data can +result in an error being set (QDeclarativeDataBlob::setError()), or one or more dependencies being +created (QDeclarativeDataBlob::addDependency()). Dependencies are other QDeclarativeDataBlob's that +are required before processing can fully complete. + +To complete processing, the QDeclarativeDataBlob::done() callback is invoked. done() is called when +one of these three preconditions are met. + +1. The QDeclarativeDataBlob has no dependencies. +2. The QDeclarativeDataBlob has an error set. +3. All the QDeclarativeDataBlob's dependencies are themselves "done()". + +Thus QDeclarativeDataBlob::done() will always eventually be called, even if the blob has an error set. +*/ + +/*! +Create a new QDeclarativeDataLoader for \a engine. +*/ +QDeclarativeDataLoader::QDeclarativeDataLoader(QDeclarativeEngine *engine) +: m_engine(engine) +{ +} + +/*! \internal */ +QDeclarativeDataLoader::~QDeclarativeDataLoader() +{ + for (NetworkReplies::Iterator iter = m_networkReplies.begin(); iter != m_networkReplies.end(); ++iter) + (*iter)->release(); +} + +/*! +Load the provided \a blob from the network or filesystem. +*/ +void QDeclarativeDataLoader::load(QDeclarativeDataBlob *blob) +{ + Q_ASSERT(blob->status() == QDeclarativeDataBlob::Null); + Q_ASSERT(blob->m_manager == 0); + + blob->m_status = QDeclarativeDataBlob::Loading; + + if (blob->m_url.isEmpty()) { + QDeclarativeError error; + error.setDescription(QLatin1String("Invalid null URL")); + blob->setError(error); + return; + } + + QString lf = QDeclarativeEnginePrivate::urlToLocalFileOrQrc(blob->m_url); + + if (!lf.isEmpty()) { + QFile file(lf); + if (file.open(QFile::ReadOnly)) { + QByteArray data = file.readAll(); + + blob->m_progress = 1.; + blob->downloadProgressChanged(1.); + + setData(blob, data); + } else { + blob->networkError(QNetworkReply::ContentNotFoundError); + } + + } else { + + blob->m_manager = this; + QNetworkReply *reply = m_engine->networkAccessManager()->get(QNetworkRequest(blob->m_url)); + QObject::connect(reply, SIGNAL(downloadProgress(qint64,qint64)), + this, SLOT(networkReplyProgress(qint64,qint64))); + QObject::connect(reply, SIGNAL(finished()), + this, SLOT(networkReplyFinished())); + m_networkReplies.insert(reply, blob); + + blob->addref(); + } +} + +#define DATALOADER_MAXIMUM_REDIRECT_RECURSION 16 + +void QDeclarativeDataLoader::networkReplyFinished() +{ + QNetworkReply *reply = static_cast<QNetworkReply *>(sender()); + reply->deleteLater(); + + QDeclarativeDataBlob *blob = m_networkReplies.take(reply); + + Q_ASSERT(blob); + + blob->m_redirectCount++; + + if (blob->m_redirectCount < DATALOADER_MAXIMUM_REDIRECT_RECURSION) { + QVariant redirect = reply->attribute(QNetworkRequest::RedirectionTargetAttribute); + if (redirect.isValid()) { + QUrl url = reply->url().resolved(redirect.toUrl()); + blob->m_finalUrl = url; + + QNetworkReply *reply = m_engine->networkAccessManager()->get(QNetworkRequest(url)); + QObject::connect(reply, SIGNAL(finished()), this, SLOT(networkReplyFinished())); + m_networkReplies.insert(reply, blob); + return; + } + } + + if (reply->error()) { + blob->networkError(reply->error()); + } else { + QByteArray data = reply->readAll(); + setData(blob, data); + } + + blob->release(); +} + +void QDeclarativeDataLoader::networkReplyProgress(qint64 bytesReceived, qint64 bytesTotal) +{ + QNetworkReply *reply = static_cast<QNetworkReply *>(sender()); + QDeclarativeDataBlob *blob = m_networkReplies.value(reply); + + Q_ASSERT(blob); + + if (bytesTotal != 0) { + blob->m_progress = bytesReceived / bytesTotal; + blob->downloadProgressChanged(blob->m_progress); + } +} + +/*! +Load the provided \a blob with \a data. The blob's URL is not used by the data loader in this case. +*/ +void QDeclarativeDataLoader::loadWithStaticData(QDeclarativeDataBlob *blob, const QByteArray &data) +{ + Q_ASSERT(blob->status() == QDeclarativeDataBlob::Null); + Q_ASSERT(blob->m_manager == 0); + + blob->m_status = QDeclarativeDataBlob::Loading; + + setData(blob, data); +} + +/*! +Return the QDeclarativeEngine associated with this loader +*/ +QDeclarativeEngine *QDeclarativeDataLoader::engine() const +{ + return m_engine; +} + +void QDeclarativeDataLoader::setData(QDeclarativeDataBlob *blob, const QByteArray &data) +{ + blob->m_inCallback = true; + + blob->dataReceived(data); + + if (!blob->isError() && !blob->isWaiting()) + blob->allDependenciesDone(); + + if (blob->status() != QDeclarativeDataBlob::Error) + blob->m_status = QDeclarativeDataBlob::WaitingForDependencies; + + blob->m_inCallback = false; + + blob->tryDone(); +} + +/*! +\class QDeclarativeTypeLoader +*/ +QDeclarativeTypeLoader::QDeclarativeTypeLoader(QDeclarativeEngine *engine) +: QDeclarativeDataLoader(engine) +{ +} + +QDeclarativeTypeLoader::~QDeclarativeTypeLoader() +{ + clearCache(); +} + +/*! +Return a QDeclarativeTypeData for \a url. The QDeclarativeTypeData may be cached. +*/ +QDeclarativeTypeData *QDeclarativeTypeLoader::get(const QUrl &url) +{ + Q_ASSERT(!url.isRelative() && + (QDeclarativeEnginePrivate::urlToLocalFileOrQrc(url).isEmpty() || + !QDir::isRelativePath(QDeclarativeEnginePrivate::urlToLocalFileOrQrc(url)))); + + QDeclarativeTypeData *typeData = m_typeCache.value(url); + + if (!typeData) { + typeData = new QDeclarativeTypeData(url, None, this); + m_typeCache.insert(url, typeData); + QDeclarativeDataLoader::load(typeData); + } + + typeData->addref(); + return typeData; +} + +/*! +Return a QDeclarativeTypeData for \a data with the provided base \a url. The +QDeclarativeTypeData will not be cached. +*/ +QDeclarativeTypeData *QDeclarativeTypeLoader::get(const QByteArray &data, const QUrl &url, Options options) +{ + QDeclarativeTypeData *typeData = new QDeclarativeTypeData(url, options, this); + QDeclarativeDataLoader::loadWithStaticData(typeData, data); + return typeData; +} + +/*! +Return a QDeclarativeScriptData for \a url. The QDeclarativeScriptData may be cached. +*/ +QDeclarativeScriptData *QDeclarativeTypeLoader::getScript(const QUrl &url) +{ + Q_ASSERT(!url.isRelative() && + (QDeclarativeEnginePrivate::urlToLocalFileOrQrc(url).isEmpty() || + !QDir::isRelativePath(QDeclarativeEnginePrivate::urlToLocalFileOrQrc(url)))); + + QDeclarativeScriptData *scriptData = m_scriptCache.value(url); + + if (!scriptData) { + scriptData = new QDeclarativeScriptData(url); + m_scriptCache.insert(url, scriptData); + QDeclarativeDataLoader::load(scriptData); + } + + scriptData->addref(); + return scriptData; +} + +/*! +Return a QDeclarativeQmldirData for \a url. The QDeclarativeQmldirData may be cached. +*/ +QDeclarativeQmldirData *QDeclarativeTypeLoader::getQmldir(const QUrl &url) +{ + Q_ASSERT(!url.isRelative() && + (QDeclarativeEnginePrivate::urlToLocalFileOrQrc(url).isEmpty() || + !QDir::isRelativePath(QDeclarativeEnginePrivate::urlToLocalFileOrQrc(url)))); + + QDeclarativeQmldirData *qmldirData = m_qmldirCache.value(url); + + if (!qmldirData) { + qmldirData = new QDeclarativeQmldirData(url); + m_qmldirCache.insert(url, qmldirData); + QDeclarativeDataLoader::load(qmldirData); + } + + qmldirData->addref(); + return qmldirData; +} + +void QDeclarativeTypeLoader::clearCache() +{ + for (TypeCache::Iterator iter = m_typeCache.begin(); iter != m_typeCache.end(); ++iter) + (*iter)->release(); + for (ScriptCache::Iterator iter = m_scriptCache.begin(); iter != m_scriptCache.end(); ++iter) + (*iter)->release(); + for (QmldirCache::Iterator iter = m_qmldirCache.begin(); iter != m_qmldirCache.end(); ++iter) + (*iter)->release(); + + m_typeCache.clear(); + m_scriptCache.clear(); + m_qmldirCache.clear(); +} + + +QDeclarativeTypeData::QDeclarativeTypeData(const QUrl &url, QDeclarativeTypeLoader::Options options, + QDeclarativeTypeLoader *manager) +: QDeclarativeDataBlob(url, QmlFile), m_options(options), m_typesResolved(false), + m_compiledData(0), m_component(0), m_typeLoader(manager) +{ +} + +QDeclarativeTypeData::~QDeclarativeTypeData() +{ + for (int ii = 0; ii < m_scripts.count(); ++ii) + m_scripts.at(ii).script->release(); + for (int ii = 0; ii < m_qmldirs.count(); ++ii) + m_qmldirs.at(ii)->release(); + for (int ii = 0; ii < m_types.count(); ++ii) + if (m_types.at(ii).typeData) m_types.at(ii).typeData->release(); + if (m_compiledData) + m_compiledData->release(); +} + +QDeclarativeTypeLoader *QDeclarativeTypeData::typeLoader() const +{ + return m_typeLoader; +} + +const QDeclarativeImports &QDeclarativeTypeData::imports() const +{ + return m_imports; +} + +const QDeclarativeScriptParser &QDeclarativeTypeData::parser() const +{ + return scriptParser; +} + +const QList<QDeclarativeTypeData::TypeReference> &QDeclarativeTypeData::resolvedTypes() const +{ + return m_types; +} + +const QList<QDeclarativeTypeData::ScriptReference> &QDeclarativeTypeData::resolvedScripts() const +{ + return m_scripts; +} + +QDeclarativeCompiledData *QDeclarativeTypeData::compiledData() const +{ + if (m_compiledData) + m_compiledData->addref(); + + return m_compiledData; +} + +QDeclarativeComponent *QDeclarativeTypeData::component() const +{ + if (!m_component) { + + if (m_compiledData) { + m_component = new QDeclarativeComponent(typeLoader()->engine(), m_compiledData, -1, -1, 0); + } else { + m_component = new QDeclarativeComponent(typeLoader()->engine()); + QDeclarativeComponentPrivate::get(m_component)->url = finalUrl(); + QDeclarativeComponentPrivate::get(m_component)->state.errors = errors(); + } + + } + + return m_component; +} + +void QDeclarativeTypeData::registerCallback(TypeDataCallback *callback) +{ + Q_ASSERT(!m_callbacks.contains(callback)); + m_callbacks.append(callback); +} + +void QDeclarativeTypeData::unregisterCallback(TypeDataCallback *callback) +{ + Q_ASSERT(m_callbacks.contains(callback)); + m_callbacks.removeOne(callback); + Q_ASSERT(!m_callbacks.contains(callback)); +} + +void QDeclarativeTypeData::done() +{ + addref(); + + // Check all script dependencies for errors + for (int ii = 0; !isError() && ii < m_scripts.count(); ++ii) { + const ScriptReference &script = m_scripts.at(ii); + Q_ASSERT(script.script->isCompleteOrError()); + if (script.script->isError()) { + QList<QDeclarativeError> errors = script.script->errors(); + QDeclarativeError error; + error.setUrl(finalUrl()); + error.setLine(script.location.line); + error.setColumn(script.location.column); + error.setDescription(typeLoader()->tr("Script %1 unavailable").arg(script.script->url().toString())); + errors.prepend(error); + setError(errors); + } + } + + // Check all type dependencies for errors + for (int ii = 0; !isError() && ii < m_types.count(); ++ii) { + const TypeReference &type = m_types.at(ii); + Q_ASSERT(!type.typeData || type.typeData->isCompleteOrError()); + if (type.typeData && type.typeData->isError()) { + QString typeName = scriptParser.referencedTypes().at(ii)->name; + + QList<QDeclarativeError> errors = type.typeData->errors(); + QDeclarativeError error; + error.setUrl(finalUrl()); + error.setLine(type.location.line); + error.setColumn(type.location.column); + error.setDescription(typeLoader()->tr("Type %1 unavailable").arg(typeName)); + errors.prepend(error); + setError(errors); + } + } + + // Compile component + if (!isError()) + compile(); + + if (!(m_options & QDeclarativeTypeLoader::PreserveParser)) + scriptParser.clear(); + + // Notify callbacks + while (!m_callbacks.isEmpty()) { + TypeDataCallback *callback = m_callbacks.takeFirst(); + callback->typeDataReady(this); + } + + release(); +} + +void QDeclarativeTypeData::dataReceived(const QByteArray &data) +{ + if (!scriptParser.parse(data, finalUrl())) { + setError(scriptParser.errors()); + return; + } + + m_imports.setBaseUrl(finalUrl()); + + foreach (const QDeclarativeScriptParser::Import &import, scriptParser.imports()) { + if (import.type == QDeclarativeScriptParser::Import::File && import.qualifier.isEmpty()) { + QUrl importUrl = finalUrl().resolved(QUrl(import.uri + QLatin1String("/qmldir"))); + if (QDeclarativeEnginePrivate::urlToLocalFileOrQrc(importUrl).isEmpty()) { + QDeclarativeQmldirData *data = typeLoader()->getQmldir(importUrl); + addDependency(data); + m_qmldirs << data; + } + } else if (import.type == QDeclarativeScriptParser::Import::Script) { + QUrl scriptUrl = finalUrl().resolved(QUrl(import.uri)); + QDeclarativeScriptData *data = typeLoader()->getScript(scriptUrl); + addDependency(data); + + ScriptReference ref; + ref.location = import.location.start; + ref.qualifier = import.qualifier; + ref.script = data; + m_scripts << ref; + + } + } + + if (!finalUrl().scheme().isEmpty()) { + QUrl importUrl = finalUrl().resolved(QUrl(QLatin1String("qmldir"))); + if (QDeclarativeEnginePrivate::urlToLocalFileOrQrc(importUrl).isEmpty()) { + QDeclarativeQmldirData *data = typeLoader()->getQmldir(importUrl); + addDependency(data); + m_qmldirs << data; + } + } +} + +void QDeclarativeTypeData::allDependenciesDone() +{ + if (!m_typesResolved) { + resolveTypes(); + m_typesResolved = true; + } +} + +void QDeclarativeTypeData::downloadProgressChanged(qreal p) +{ + for (int ii = 0; ii < m_callbacks.count(); ++ii) { + TypeDataCallback *callback = m_callbacks.at(ii); + callback->typeDataProgress(this, p); + } +} + +void QDeclarativeTypeData::compile() +{ + Q_ASSERT(m_compiledData == 0); + + m_compiledData = new QDeclarativeCompiledData(typeLoader()->engine()); + m_compiledData->url = m_imports.baseUrl(); + m_compiledData->name = m_compiledData->url.toString(); + + QDeclarativeCompiler compiler; + if (!compiler.compile(typeLoader()->engine(), this, m_compiledData)) { + setError(compiler.errors()); + m_compiledData->release(); + m_compiledData = 0; + } +} + +void QDeclarativeTypeData::resolveTypes() +{ + QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(m_typeLoader->engine()); + QDeclarativeImportDatabase *importDatabase = &ep->importDatabase; + + // For local urls, add an implicit import "." as first (most overridden) lookup. + // This will also trigger the loading of the qmldir and the import of any native + // types from available plugins. + if (QDeclarativeQmldirData *qmldir = qmldirForUrl(finalUrl().resolved(QUrl(QLatin1String("./qmldir"))))) { + m_imports.addImport(importDatabase, QLatin1String("."), + QString(), -1, -1, QDeclarativeScriptParser::Import::File, + qmldir->dirComponents(), 0); + } else { + m_imports.addImport(importDatabase, QLatin1String("."), + QString(), -1, -1, QDeclarativeScriptParser::Import::File, + QDeclarativeDirComponents(), 0); + } + + foreach (const QDeclarativeScriptParser::Import &import, scriptParser.imports()) { + QDeclarativeDirComponents qmldircomponentsnetwork; + if (import.type == QDeclarativeScriptParser::Import::Script) + continue; + + if (import.type == QDeclarativeScriptParser::Import::File && import.qualifier.isEmpty()) { + QUrl qmldirUrl = finalUrl().resolved(QUrl(import.uri + QLatin1String("/qmldir"))); + if (QDeclarativeQmldirData *qmldir = qmldirForUrl(qmldirUrl)) + qmldircomponentsnetwork = qmldir->dirComponents(); + } + + int vmaj = -1; + int vmin = -1; + + if (!import.version.isEmpty()) { + int dot = import.version.indexOf(QLatin1Char('.')); + if (dot < 0) { + vmaj = import.version.toInt(); + vmin = 0; + } else { + vmaj = import.version.left(dot).toInt(); + vmin = import.version.mid(dot+1).toInt(); + } + } + + QString errorString; + if (!m_imports.addImport(importDatabase, import.uri, import.qualifier, + vmaj, vmin, import.type, qmldircomponentsnetwork, &errorString)) { + QDeclarativeError error; + error.setUrl(m_imports.baseUrl()); + error.setDescription(errorString); + error.setLine(import.location.start.line); + error.setColumn(import.location.start.column); + + setError(error); + return; + } + } + + foreach (QDeclarativeScriptParser::TypeReference *parserRef, scriptParser.referencedTypes()) { + QByteArray typeName = parserRef->name.toUtf8(); + + TypeReference ref; + + QUrl url; + int majorVersion; + int minorVersion; + QDeclarativeImportedNamespace *typeNamespace = 0; + QString errorString; + + if (!m_imports.resolveType(typeName, &ref.type, &url, &majorVersion, &minorVersion, + &typeNamespace, &errorString) || typeNamespace) { + // Known to not be a type: + // - known to be a namespace (Namespace {}) + // - type with unknown namespace (UnknownNamespace.SomeType {}) + QDeclarativeError error; + error.setUrl(m_imports.baseUrl()); + QString userTypeName = parserRef->name; + userTypeName.replace(QLatin1Char('/'),QLatin1Char('.')); + if (typeNamespace) + error.setDescription(typeLoader()->tr("Namespace %1 cannot be used as a type").arg(userTypeName)); + else + error.setDescription(typeLoader()->tr("%1 %2").arg(userTypeName).arg(errorString)); + + if (!parserRef->refObjects.isEmpty()) { + QDeclarativeParser::Object *obj = parserRef->refObjects.first(); + error.setLine(obj->location.start.line); + error.setColumn(obj->location.start.column); + } + + setError(error); + return; + } + + if (ref.type) { + foreach (QDeclarativeParser::Object *obj, parserRef->refObjects) { + // store namespace for DOM + obj->majorVersion = majorVersion; + obj->minorVersion = minorVersion; + } + } else { + ref.typeData = typeLoader()->get(url); + addDependency(ref.typeData); + } + + if (parserRef->refObjects.count()) + ref.location = parserRef->refObjects.first()->location.start; + + m_types << ref; + } +} + +QDeclarativeQmldirData *QDeclarativeTypeData::qmldirForUrl(const QUrl &url) +{ + for (int ii = 0; ii < m_qmldirs.count(); ++ii) { + if (m_qmldirs.at(ii)->url() == url) + return m_qmldirs.at(ii); + } + return 0; +} + +QDeclarativeScriptData::QDeclarativeScriptData(const QUrl &url) +: QDeclarativeDataBlob(url, JavaScriptFile), m_pragmas(QDeclarativeParser::Object::ScriptBlock::None) +{ +} + +QDeclarativeParser::Object::ScriptBlock::Pragmas QDeclarativeScriptData::pragmas() const +{ + return m_pragmas; +} + +QString QDeclarativeScriptData::scriptSource() const +{ + return m_source; +} + +void QDeclarativeScriptData::dataReceived(const QByteArray &data) +{ + m_source = QString::fromUtf8(data); + m_pragmas = QDeclarativeScriptParser::extractPragmas(m_source); +} + +QDeclarativeQmldirData::QDeclarativeQmldirData(const QUrl &url) +: QDeclarativeDataBlob(url, QmldirFile) +{ +} + +const QDeclarativeDirComponents &QDeclarativeQmldirData::dirComponents() const +{ + return m_components; +} + +void QDeclarativeQmldirData::dataReceived(const QByteArray &data) +{ + QDeclarativeDirParser parser; + parser.setSource(QString::fromUtf8(data)); + parser.parse(); + m_components = parser.components(); +} + +QT_END_NAMESPACE + diff --git a/src/declarative/qml/qdeclarativetypeloader_p.h b/src/declarative/qml/qdeclarativetypeloader_p.h new file mode 100644 index 0000000..7381f28 --- /dev/null +++ b/src/declarative/qml/qdeclarativetypeloader_p.h @@ -0,0 +1,321 @@ +/**************************************************************************** +** +** 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 QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVETYPELOADER_P_H +#define QDECLARATIVETYPELOADER_P_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 <QtCore/qobject.h> +#include <QtNetwork/qnetworkreply.h> +#include <QtDeclarative/qdeclarativeerror.h> +#include <QtDeclarative/qdeclarativeengine.h> +#include <private/qdeclarativescriptparser_p.h> +#include <private/qdeclarativedirparser_p.h> +#include <private/qdeclarativeimport_p.h> + +QT_BEGIN_NAMESPACE + +class QDeclarativeScriptData; +class QDeclarativeQmldirData; +class QDeclarativeTypeLoader; +class QDeclarativeCompiledData; +class QDeclarativeComponentPrivate; +class QDeclarativeTypeData; +class QDeclarativeDataLoader; + +class Q_AUTOTEST_EXPORT QDeclarativeDataBlob : public QDeclarativeRefCount +{ +public: + enum Status { + Null, // Prior to QDeclarativeDataLoader::load() + Loading, // Prior to data being received and dataReceived() being called + WaitingForDependencies, // While there are outstanding addDependency()s + Complete, // Finished + Error, // Error + }; + + enum Type { + QmlFile, + JavaScriptFile, + QmldirFile + }; + + QDeclarativeDataBlob(const QUrl &, Type); + virtual ~QDeclarativeDataBlob(); + + Type type() const; + + Status status() const; + bool isNull() const; + bool isLoading() const; + bool isWaiting() const; + bool isComplete() const; + bool isError() const; + bool isCompleteOrError() const; + + qreal progress() const; + + QUrl url() const; + QUrl finalUrl() const; + + QList<QDeclarativeError> errors() const; + + void setError(const QDeclarativeError &); + void setError(const QList<QDeclarativeError> &errors); + + void addDependency(QDeclarativeDataBlob *); + +protected: + virtual void dataReceived(const QByteArray &) = 0; + + virtual void done(); + virtual void networkError(QNetworkReply::NetworkError); + + virtual void dependencyError(QDeclarativeDataBlob *); + virtual void dependencyComplete(QDeclarativeDataBlob *); + virtual void allDependenciesDone(); + + virtual void downloadProgressChanged(qreal); + +private: + friend class QDeclarativeDataLoader; + void tryDone(); + void cancelAllWaitingFor(); + void notifyAllWaitingOnMe(); + void notifyComplete(QDeclarativeDataBlob *); + + Type m_type; + Status m_status; + qreal m_progress; + + QUrl m_url; + QUrl m_finalUrl; + + // List of QDeclarativeDataBlob's that are waiting for me to complete. + QList<QDeclarativeDataBlob *> m_waitingOnMe; + + // List of QDeclarativeDataBlob's that I am waiting for to complete. + QList<QDeclarativeDataBlob *> m_waitingFor; + + // Manager that is currently fetching data for me + QDeclarativeDataLoader *m_manager; + int m_redirectCount:30; + bool m_inCallback:1; + bool m_isDone:1; + + QList<QDeclarativeError> m_errors; +}; + +class Q_AUTOTEST_EXPORT QDeclarativeDataLoader : public QObject +{ + Q_OBJECT +public: + QDeclarativeDataLoader(QDeclarativeEngine *); + ~QDeclarativeDataLoader(); + + void load(QDeclarativeDataBlob *); + void loadWithStaticData(QDeclarativeDataBlob *, const QByteArray &); + + QDeclarativeEngine *engine() const; + +private slots: + void networkReplyFinished(); + void networkReplyProgress(qint64,qint64); + +private: + void setData(QDeclarativeDataBlob *, const QByteArray &); + + QDeclarativeEngine *m_engine; + typedef QHash<QNetworkReply *, QDeclarativeDataBlob *> NetworkReplies; + NetworkReplies m_networkReplies; +}; + + +class Q_AUTOTEST_EXPORT QDeclarativeTypeLoader : public QDeclarativeDataLoader +{ + Q_OBJECT +public: + QDeclarativeTypeLoader(QDeclarativeEngine *); + ~QDeclarativeTypeLoader(); + + enum Option { + None, + PreserveParser + }; + Q_DECLARE_FLAGS(Options, Option) + + QDeclarativeTypeData *get(const QUrl &url); + QDeclarativeTypeData *get(const QByteArray &, const QUrl &url, Options = None); + void clearCache(); + + QDeclarativeScriptData *getScript(const QUrl &); + QDeclarativeQmldirData *getQmldir(const QUrl &); +private: + typedef QHash<QUrl, QDeclarativeTypeData *> TypeCache; + typedef QHash<QUrl, QDeclarativeScriptData *> ScriptCache; + typedef QHash<QUrl, QDeclarativeQmldirData *> QmldirCache; + + TypeCache m_typeCache; + ScriptCache m_scriptCache; + QmldirCache m_qmldirCache; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativeTypeLoader::Options) + +class Q_AUTOTEST_EXPORT QDeclarativeTypeData : public QDeclarativeDataBlob +{ +public: + struct TypeReference + { + TypeReference() : type(0), typeData(0) {} + + QDeclarativeParser::Location location; + QDeclarativeType *type; + QDeclarativeTypeData *typeData; + }; + + struct ScriptReference + { + ScriptReference() : script(0) {} + + QDeclarativeParser::Location location; + QString qualifier; + QDeclarativeScriptData *script; + }; + + QDeclarativeTypeData(const QUrl &, QDeclarativeTypeLoader::Options, QDeclarativeTypeLoader *); + ~QDeclarativeTypeData(); + + QDeclarativeTypeLoader *typeLoader() const; + + const QDeclarativeImports &imports() const; + const QDeclarativeScriptParser &parser() const; + + const QList<TypeReference> &resolvedTypes() const; + const QList<ScriptReference> &resolvedScripts() const; + + QDeclarativeCompiledData *compiledData() const; + QDeclarativeComponent *component() const; + + // Used by QDeclarativeComponent to get notifications + struct TypeDataCallback { + ~TypeDataCallback() {} + virtual void typeDataProgress(QDeclarativeTypeData *, qreal) {} + virtual void typeDataReady(QDeclarativeTypeData *) {} + }; + void registerCallback(TypeDataCallback *); + void unregisterCallback(TypeDataCallback *); + +protected: + virtual void done(); + virtual void dataReceived(const QByteArray &); + virtual void allDependenciesDone(); + virtual void downloadProgressChanged(qreal); + +private: + void resolveTypes(); + void compile(); + + QDeclarativeTypeLoader::Options m_options; + + QDeclarativeQmldirData *qmldirForUrl(const QUrl &); + + QDeclarativeScriptParser scriptParser; + QDeclarativeImports m_imports; + + QList<ScriptReference> m_scripts; + QList<QDeclarativeQmldirData *> m_qmldirs; + + QList<TypeReference> m_types; + bool m_typesResolved:1; + + QDeclarativeCompiledData *m_compiledData; + mutable QDeclarativeComponent *m_component; + + QList<TypeDataCallback *> m_callbacks; + + QDeclarativeTypeLoader *m_typeLoader; +}; + +class Q_AUTOTEST_EXPORT QDeclarativeScriptData : public QDeclarativeDataBlob +{ +public: + QDeclarativeScriptData(const QUrl &); + + QDeclarativeParser::Object::ScriptBlock::Pragmas pragmas() const; + QString scriptSource() const; + +protected: + virtual void dataReceived(const QByteArray &); + +private: + QDeclarativeParser::Object::ScriptBlock::Pragmas m_pragmas; + QString m_source; +}; + +class Q_AUTOTEST_EXPORT QDeclarativeQmldirData : public QDeclarativeDataBlob +{ +public: + QDeclarativeQmldirData(const QUrl &); + + const QDeclarativeDirComponents &dirComponents() const; + +protected: + virtual void dataReceived(const QByteArray &); + +private: + QDeclarativeDirComponents m_components; + +}; + +QT_END_NAMESPACE + +#endif // QDECLARATIVETYPELOADER_P_H diff --git a/src/declarative/qml/qdeclarativevmemetaobject.cpp b/src/declarative/qml/qdeclarativevmemetaobject.cpp index 689ed92..3e32006 100644 --- a/src/declarative/qml/qdeclarativevmemetaobject.cpp +++ b/src/declarative/qml/qdeclarativevmemetaobject.cpp @@ -707,11 +707,19 @@ void QDeclarativeVMEMetaObject::writeVarProperty(int id, const QScriptValue &val void QDeclarativeVMEMetaObject::writeVarProperty(int id, const QVariant &value) { - if (value.userType() == QMetaType::QObjectStar) + bool needActivate = false; + if (value.userType() == QMetaType::QObjectStar) { + QObject *o = qvariant_cast<QObject *>(value); + needActivate = (data[id].dataType() != QMetaType::QObjectStar || data[id].asQObject() != o); data[id].setValue(qvariant_cast<QObject *>(value)); - else + } else { + needActivate = (data[id].dataType() != qMetaTypeId<QVariant>() || + data[id].asQVariant().userType() != value.userType() || + data[id].asQVariant() != value); data[id].setValue(value); - activate(object, methodOffset + id, 0); + } + if (needActivate) + activate(object, methodOffset + id, 0); } void QDeclarativeVMEMetaObject::listChanged(int id) diff --git a/src/declarative/qml/qmetaobjectbuilder.cpp b/src/declarative/qml/qmetaobjectbuilder.cpp index 0954248..58f8811 100644 --- a/src/declarative/qml/qmetaobjectbuilder.cpp +++ b/src/declarative/qml/qmetaobjectbuilder.cpp @@ -205,7 +205,7 @@ public: (const QByteArray& _name, const QByteArray& _type, int notifierIdx=-1) : name(_name), type(QMetaObject::normalizedType(_type.constData())), - flags(Readable | Writable), notifySignal(-1) + flags(Readable | Writable | Scriptable), notifySignal(-1) { if (notifierIdx >= 0) { flags |= Notify; @@ -2187,7 +2187,7 @@ bool QMetaPropertyBuilder::isDesignable() const /*! Returns true if the property is scriptable; otherwise returns false. - This default value is false. + This default value is true. \sa setScriptable(), isDesignable(), isStored() */ diff --git a/src/declarative/qml/qml.pri b/src/declarative/qml/qml.pri index 12f9794..687ff52 100644 --- a/src/declarative/qml/qml.pri +++ b/src/declarative/qml/qml.pri @@ -24,7 +24,7 @@ SOURCES += \ $$PWD/qdeclarativestringconverters.cpp \ $$PWD/qdeclarativeclassfactory.cpp \ $$PWD/qdeclarativeparserstatus.cpp \ - $$PWD/qdeclarativecompositetypemanager.cpp \ + $$PWD/qdeclarativetypeloader.cpp \ $$PWD/qdeclarativeinfo.cpp \ $$PWD/qdeclarativeerror.cpp \ $$PWD/qdeclarativescriptparser.cpp \ @@ -94,8 +94,7 @@ HEADERS += \ $$PWD/qdeclarativeproperty_p.h \ $$PWD/qdeclarativecontext_p.h \ $$PWD/qdeclarativeinclude_p.h \ - $$PWD/qdeclarativecompositetypedata_p.h \ - $$PWD/qdeclarativecompositetypemanager_p.h \ + $$PWD/qdeclarativetypeloader_p.h \ $$PWD/qdeclarativelist.h \ $$PWD/qdeclarativelist_p.h \ $$PWD/qdeclarativedata_p.h \ diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index 4e9e8d5..3c09747 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -84,11 +84,6 @@ QT_BEGIN_NAMESPACE element directly will result in an error. */ -/*! - \class QDeclarativeAbstractAnimation - \internal -*/ - QDeclarativeAbstractAnimation::QDeclarativeAbstractAnimation(QObject *parent) : QObject(*(new QDeclarativeAbstractAnimationPrivate), parent) { @@ -337,7 +332,7 @@ void QDeclarativeAbstractAnimation::setAlwaysRunToEnd(bool f) stopped - either by setting the \c running property to false, or by calling the \c stop() method. - In the following example, the rectangle will spin indefinately. + In the following example, the rectangle will spin indefinitely. \code Rectangle { @@ -574,12 +569,6 @@ void QDeclarativeAbstractAnimation::timelineComplete() \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} */ -/*! - \internal - \class QDeclarativePauseAnimation -*/ - - QDeclarativePauseAnimation::QDeclarativePauseAnimation(QObject *parent) : QDeclarativeAbstractAnimation(*(new QDeclarativePauseAnimationPrivate), parent) { @@ -659,11 +648,6 @@ QAbstractAnimation *QDeclarativePauseAnimation::qtAnimation() \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} */ -/*! - \internal - \class QDeclarativeColorAnimation -*/ - QDeclarativeColorAnimation::QDeclarativeColorAnimation(QObject *parent) : QDeclarativePropertyAnimation(parent) { @@ -776,10 +760,6 @@ void QDeclarativeColorAnimation::setTo(const QColor &t) \sa StateChangeScript */ -/*! - \internal - \class QDeclarativeScriptAction -*/ QDeclarativeScriptAction::QDeclarativeScriptAction(QObject *parent) :QDeclarativeAbstractAnimation(*(new QDeclarativeScriptActionPrivate), parent) { @@ -933,10 +913,6 @@ QAbstractAnimation *QDeclarativeScriptAction::qtAnimation() \sa {QML Animation}, QtDeclarative */ -/*! - \internal - \class QDeclarativePropertyAction -*/ QDeclarativePropertyAction::QDeclarativePropertyAction(QObject *parent) : QDeclarativeAbstractAnimation(*(new QDeclarativePropertyActionPrivate), parent) { @@ -1185,12 +1161,6 @@ void QDeclarativePropertyAction::transition(QDeclarativeStateActions &actions, \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} */ - -/*! - \internal - \class QDeclarativeNumberAnimation -*/ - QDeclarativeNumberAnimation::QDeclarativeNumberAnimation(QObject *parent) : QDeclarativePropertyAnimation(parent) { @@ -1276,7 +1246,7 @@ void QDeclarativeNumberAnimation::setTo(qreal t) /*! \qmlclass Vector3dAnimation QDeclarativeVector3dAnimation - \ingroup qml-animation-transition + \ingroup qml-animation-transition \since 4.7 \inherits PropertyAnimation \brief The Vector3dAnimation element animates changes in QVector3d values. @@ -1291,12 +1261,6 @@ void QDeclarativeNumberAnimation::setTo(qreal t) \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} */ - -/*! - \internal - \class QDeclarativeVector3dAnimation -*/ - QDeclarativeVector3dAnimation::QDeclarativeVector3dAnimation(QObject *parent) : QDeclarativePropertyAnimation(parent) { @@ -1396,12 +1360,6 @@ void QDeclarativeVector3dAnimation::setTo(QVector3D t) \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} */ - -/*! - \internal - \class QDeclarativeRotationAnimation -*/ - QVariant _q_interpolateShortestRotation(qreal &f, qreal &t, qreal progress) { qreal newt = t; @@ -1702,11 +1660,6 @@ void QDeclarativeSequentialAnimation::transition(QDeclarativeStateActions &actio \sa SequentialAnimation, {QML Animation}, {declarative/animation/basics}{Animation basics example} */ -/*! - \internal - \class QDeclarativeParallelAnimation -*/ - QDeclarativeParallelAnimation::QDeclarativeParallelAnimation(QObject *parent) : QDeclarativeAnimationGroup(parent) { @@ -2512,11 +2465,6 @@ void QDeclarativePropertyAnimation::transition(QDeclarativeStateActions &actions \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} */ - -/*! - \internal - \class QDeclarativeParentAnimation -*/ QDeclarativeParentAnimation::QDeclarativeParentAnimation(QObject *parent) : QDeclarativeAnimationGroup(*(new QDeclarativeParentAnimationPrivate), parent) { diff --git a/src/declarative/util/qdeclarativebind.cpp b/src/declarative/util/qdeclarativebind.cpp index 86d08f5..88b45ae 100644 --- a/src/declarative/util/qdeclarativebind.cpp +++ b/src/declarative/util/qdeclarativebind.cpp @@ -72,7 +72,7 @@ public: /*! \qmlclass Binding QDeclarativeBind - \ingroup qml-working-with-data + \ingroup qml-working-with-data \since 4.7 \brief The Binding element allows arbitrary property bindings to be created. @@ -95,18 +95,7 @@ public: immediately pushed onto the new target. \sa QtDeclarative - */ -/*! - \internal - \class QDeclarativeBind - \brief The QDeclarativeBind class allows arbitrary property bindings to be created. - - Simple bindings are usually earier to do in-place rather than creating a - QDeclarativeBind item. For that reason, QDeclarativeBind is usually used to transfer property information - from Qml to C++. - - \sa cppqml - */ +*/ QDeclarativeBind::QDeclarativeBind(QObject *parent) : QObject(*(new QDeclarativeBindPrivate), parent) { diff --git a/src/declarative/util/qdeclarativeconnections.cpp b/src/declarative/util/qdeclarativeconnections.cpp index 293928e..15e5ac5 100644 --- a/src/declarative/util/qdeclarativeconnections.cpp +++ b/src/declarative/util/qdeclarativeconnections.cpp @@ -124,13 +124,6 @@ public: \sa QtDeclarative */ - -/*! - \internal - \class QDeclarativeConnections - \brief The QDeclarativeConnections class describes generalized connections to signals. - -*/ QDeclarativeConnections::QDeclarativeConnections(QObject *parent) : QObject(*(new QDeclarativeConnectionsPrivate), parent) { diff --git a/src/declarative/util/qdeclarativepropertychanges.cpp b/src/declarative/util/qdeclarativepropertychanges.cpp index c28ada3..e897458 100644 --- a/src/declarative/util/qdeclarativepropertychanges.cpp +++ b/src/declarative/util/qdeclarativepropertychanges.cpp @@ -127,12 +127,6 @@ QT_BEGIN_NAMESPACE */ /*! - \internal - \class QDeclarativePropertyChanges - \brief The QDeclarativePropertyChanges class describes new property values for a state. -*/ - -/*! \qmlproperty Object PropertyChanges::target This property holds the object which contains the properties to be changed. */ diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp index 6e17cf2..1ed7923 100644 --- a/src/declarative/util/qdeclarativestate.cpp +++ b/src/declarative/util/qdeclarativestate.cpp @@ -123,9 +123,6 @@ bool QDeclarativeActionEvent::override(QDeclarativeActionEvent *other) return false; } -/*! - \internal -*/ QDeclarativeStateOperation::QDeclarativeStateOperation(QObjectPrivate &dd, QObject *parent) : QObject(dd, parent) { @@ -164,20 +161,6 @@ QDeclarativeStateOperation::QDeclarativeStateOperation(QObjectPrivate &dd, QObje \sa {declarative/animation/states}{states example}, {qmlstates}{States}, {qdeclarativeanimation.html#transitions}{QML Transitions}, QtDeclarative */ - -/*! - \internal - \class QDeclarativeState - \brief The QDeclarativeState class allows you to define configurations of objects and properties. - - - QDeclarativeState allows you to specify a state as a set of batched changes from the default - configuration. - - \sa {states-transitions}{States and Transitions} -*/ - - QDeclarativeState::QDeclarativeState(QObject *parent) : QObject(*(new QDeclarativeStatePrivate), parent) { diff --git a/src/declarative/util/qdeclarativetransition.cpp b/src/declarative/util/qdeclarativetransition.cpp index 21d7ded..478c7f4 100644 --- a/src/declarative/util/qdeclarativetransition.cpp +++ b/src/declarative/util/qdeclarativetransition.cpp @@ -99,12 +99,6 @@ QT_BEGIN_NAMESPACE \sa {QML Animation}, {declarative/animation/states}{states example}, {qmlstates}{States}, {QtDeclarative} */ -/*! - \internal - \class QDeclarativeTransition - \brief The QDeclarativeTransition class allows you to define animated transitions that occur on state changes. -*/ - //ParallelAnimationWrapper allows us to do a "callback" when the animation finishes, rather than connecting //and disconnecting signals and slots frequently class ParallelAnimationWrapper : public QParallelAnimationGroup diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index 02bf370..47b502d 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -498,11 +498,6 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty<QDecla } /*! - \class QDeclarativeXmlListModel - \internal -*/ - -/*! \qmlclass XmlListModel QDeclarativeXmlListModel \ingroup qml-working-with-data \since 4.7 diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 0b3b164..7a622f1 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -7758,18 +7758,21 @@ void QGraphicsItemPrivate::resetHeight() } /*! - \property QGraphicsObject::children - \internal + \property QGraphicsObject::children + \since 4.7 + \internal */ /*! - \property QGraphicsObject::width - \internal + \property QGraphicsObject::width + \since 4.7 + \internal */ /*! - \property QGraphicsObject::height - \internal + \property QGraphicsObject::height + \since 4.7 + \internal */ /*! @@ -7985,24 +7988,6 @@ void QGraphicsItemPrivate::resetHeight() */ /*! - \property QGraphicsObject::children - \since 4.7 - \internal -*/ - -/*! - \property QGraphicsObject::width - \since 4.7 - \internal -*/ - -/*! - \property QGraphicsObject::height - \since 4.7 - \internal -*/ - -/*! \class QAbstractGraphicsShapeItem \brief The QAbstractGraphicsShapeItem class provides a common base for all path items. diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 3c23884..539685a 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -1074,7 +1074,7 @@ void QGraphicsScenePrivate::enableMouseTrackingOnViews() /*! Returns all items for the screen position in \a event. */ -QList<QGraphicsItem *> QGraphicsScenePrivate::itemsAtPosition(const QPoint &screenPos, +QList<QGraphicsItem *> QGraphicsScenePrivate::itemsAtPosition(const QPoint &/*screenPos*/, const QPointF &scenePos, QWidget *widget) const { @@ -1083,16 +1083,12 @@ QList<QGraphicsItem *> QGraphicsScenePrivate::itemsAtPosition(const QPoint &scre if (!view) return q->items(scenePos, Qt::IntersectsItemShape, Qt::DescendingOrder, QTransform()); - const QRectF pointRect(QPointF(widget->mapFromGlobal(screenPos)), QSizeF(1, 1)); + const QRectF pointRect(scenePos, QSizeF(1, 1)); if (!view->isTransformed()) return q->items(pointRect, Qt::IntersectsItemShape, Qt::DescendingOrder); const QTransform viewTransform = view->viewportTransform(); - if (viewTransform.type() <= QTransform::TxScale) { - return q->items(viewTransform.inverted().mapRect(pointRect), Qt::IntersectsItemShape, - Qt::DescendingOrder, viewTransform); - } - return q->items(viewTransform.inverted().map(pointRect), Qt::IntersectsItemShape, + return q->items(pointRect, Qt::IntersectsItemShape, Qt::DescendingOrder, viewTransform); } @@ -5742,16 +5738,11 @@ void QGraphicsScenePrivate::touchEventHandler(QTouchEvent *sceneTouchEvent) } if (sceneTouchEvent->deviceType() == QTouchEvent::TouchScreen) { - // on touch-screens, combine this touch point with the closest one we find if it - // is a a direct descendent or ancestor ( + // on touch-screens, combine this touch point with the closest one we find int closestTouchPointId = findClosestTouchPointId(touchPoint.scenePos()); QGraphicsItem *closestItem = itemForTouchPointId.value(closestTouchPointId); - if (!item - || (closestItem - && (item->isAncestorOf(closestItem) - || closestItem->isAncestorOf(item)))) { + if (!item || (closestItem && cachedItemsUnderMouse.contains(closestItem))) item = closestItem; - } } if (!item) continue; diff --git a/src/gui/graphicsview/qgraphicstransform.cpp b/src/gui/graphicsview/qgraphicstransform.cpp index bd3f2ef..1f155c6 100644 --- a/src/gui/graphicsview/qgraphicstransform.cpp +++ b/src/gui/graphicsview/qgraphicstransform.cpp @@ -346,21 +346,24 @@ void QGraphicsScale::applyTo(QMatrix4x4 *matrix) const /*! \fn QGraphicsScale::xScaleChanged() + \since 4.7 - QGraphicsScale emits this signal when its xScale changes. + This signal is emitted whenever the \l xScale property changes. */ /*! \fn QGraphicsScale::yScaleChanged() + \since 4.7 - QGraphicsScale emits this signal when its yScale changes. + This signal is emitted whenever the \l yScale property changes. */ /*! \fn QGraphicsScale::zScaleChanged() + \since 4.7 - QGraphicsScale emits this signal when its zScale changes. -*/ + This signal is emitted whenever the \l zScale property changes. +*/ /*! \fn QGraphicsScale::scaleChanged() @@ -583,27 +586,6 @@ void QGraphicsRotation::applyTo(QMatrix4x4 *matrix) const \sa QGraphicsRotation::axis */ -/*! - \fn QGraphicsScale::xScaleChanged() - \since 4.7 - - This signal is emitted whenever the \l xScale property changes. -*/ - -/*! - \fn QGraphicsScale::yScaleChanged() - \since 4.7 - - This signal is emitted whenever the \l yScale property changes. -*/ - -/*! - \fn QGraphicsScale::zScaleChanged() - \since 4.7 - - This signal is emitted whenever the \l zScale property changes. -*/ - #include "moc_qgraphicstransform.cpp" QT_END_NAMESPACE diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index 0fabd18..1bfe266 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -937,7 +937,9 @@ void QGraphicsWidget::setStyle(QStyle *style) QFont QGraphicsWidget::font() const { Q_D(const QGraphicsWidget); - return d->font; + QFont fnt = d->font; + fnt.resolve(fnt.resolve() | d->inheritedFontResolveMask); + return fnt; } void QGraphicsWidget::setFont(const QFont &font) { diff --git a/src/gui/graphicsview/qgraphicswidget_p.cpp b/src/gui/graphicsview/qgraphicswidget_p.cpp index f7850ca..3466733 100644 --- a/src/gui/graphicsview/qgraphicswidget_p.cpp +++ b/src/gui/graphicsview/qgraphicswidget_p.cpp @@ -254,7 +254,10 @@ void QGraphicsWidgetPrivate::setFont_helper(const QFont &font) void QGraphicsWidgetPrivate::resolveFont(uint inheritedMask) { + Q_Q(QGraphicsWidget); inheritedFontResolveMask = inheritedMask; + if (QGraphicsWidget *p = q->parentWidget()) + inheritedFontResolveMask |= p->d_func()->inheritedFontResolveMask; QFont naturalFont = naturalWidgetFont(); QFont resolvedFont = font.resolve(naturalFont); updateFont(resolvedFont); diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 3943e26..13d2c77 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -99,7 +99,7 @@ neon:*-g++* { contains(QMAKE_MAC_XARCH, no) { DEFINES += QT_NO_MAC_XARCH } else { - win32-g++*|!win32:!*-icc* { + win32-g++*|!win32:!win32-icc*:!macx-icc* { mmx { mmx_compiler.commands = $$QMAKE_CXX -c -Winline diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h index d5243c3..2fd6d16 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_p.h +++ b/src/gui/inputmethod/qcoefepinputcontext_p.h @@ -66,10 +66,10 @@ QT_BEGIN_NAMESPACE -class QCoeFepInputContext : public QInputContext, - public MCoeFepAwareTextEditor, - public MCoeFepAwareTextEditor_Extension1, - public MObjectProvider +class Q_AUTOTEST_EXPORT QCoeFepInputContext : public QInputContext, + public MCoeFepAwareTextEditor, + public MCoeFepAwareTextEditor_Extension1, + public MObjectProvider { Q_OBJECT @@ -151,9 +151,10 @@ private: int m_inlinePosition; MFepInlineTextFormatRetriever *m_formatRetriever; MFepPointerEventHandlerDuringInlineEdit *m_pointerHandler; - int m_cursorPos; QBasicTimer m_tempPreeditStringTimeout; bool m_hasTempPreeditString; + + friend class tst_QInputContext; }; QT_END_NAMESPACE diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index c4d60a5..add3d17 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -79,7 +79,6 @@ QCoeFepInputContext::QCoeFepInputContext(QObject *parent) m_inlinePosition(0), m_formatRetriever(0), m_pointerHandler(0), - m_cursorPos(0), m_hasTempPreeditString(false) { m_fepState->SetObjectProvider(this); @@ -237,11 +236,17 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event) break; } + QString widgetText = focusWidget()->inputMethodQuery(Qt::ImSurroundingText).toString(); + int maxLength = focusWidget()->inputMethodQuery(Qt::ImMaximumTextLength).toInt(); + if (!keyEvent->text().isEmpty() && widgetText.size() + m_preeditString.size() >= maxLength) { + // Don't send key events with string content if the widget is "full". + return true; + } + if (keyEvent->type() == QEvent::KeyPress && focusWidget()->inputMethodHints() & Qt::ImhHiddenText && !keyEvent->text().isEmpty()) { // Send some temporary preedit text in order to make text visible for a moment. - m_cursorPos = focusWidget()->inputMethodQuery(Qt::ImCursorPosition).toInt(); m_preeditString = keyEvent->text(); QList<QInputMethodEvent::Attribute> attributes; QInputMethodEvent imEvent(m_preeditString, attributes); @@ -297,10 +302,6 @@ void QCoeFepInputContext::commitTemporaryPreeditString() return; commitCurrentString(false); - - //update cursor position, now this pre-edit text has been committed. - //this prevents next keypress overwriting it (QTBUG-11673) - m_cursorPos = focusWidget()->inputMethodQuery(Qt::ImCursorPosition).toInt(); } void QCoeFepInputContext::mouseHandler( int x, QMouseEvent *event) @@ -596,8 +597,6 @@ void QCoeFepInputContext::StartFepInlineEditL(const TDesC& aInitialInlineText, commitTemporaryPreeditString(); - m_cursorPos = w->inputMethodQuery(Qt::ImCursorPosition).toInt(); - QList<QInputMethodEvent::Attribute> attributes; m_cursorVisibility = aCursorVisibility ? 1 : 0; @@ -612,9 +611,10 @@ void QCoeFepInputContext::StartFepInlineEditL(const TDesC& aInitialInlineText, // Let's remove the selected text if aInitialInlineText is empty and there is selected text if (m_preeditString.isEmpty()) { int anchor = w->inputMethodQuery(Qt::ImAnchorPosition).toInt(); - int replacementLength = qAbs(m_cursorPos-anchor); + int cursorPos = w->inputMethodQuery(Qt::ImCursorPosition).toInt(); + int replacementLength = qAbs(cursorPos-anchor); if (replacementLength > 0) { - int replacementStart = m_cursorPos < anchor ? 0 : -replacementLength; + int replacementStart = cursorPos < anchor ? 0 : -replacementLength; QList<QInputMethodEvent::Attribute> clearSelectionAttributes; QInputMethodEvent clearSelectionEvent(QLatin1String(""), clearSelectionAttributes); clearSelectionEvent.setCommitString(QLatin1String(""), replacementStart, replacementLength); @@ -647,8 +647,13 @@ void QCoeFepInputContext::UpdateFepInlineTextL(const TDesC& aNewInlineText, m_inlinePosition, m_cursorVisibility, QVariant())); - m_preeditString = qt_TDesC2QString(aNewInlineText); - QInputMethodEvent event(m_preeditString, attributes); + QString newPreeditString = qt_TDesC2QString(aNewInlineText); + QInputMethodEvent event(newPreeditString, attributes); + if (newPreeditString.isEmpty() && m_preeditString.isEmpty()) { + // In Symbian world this means "erase last character". + event.setCommitString("", -1, 1); + } + m_preeditString = newPreeditString; sendEvent(event); } @@ -820,23 +825,13 @@ void QCoeFepInputContext::commitCurrentString(bool cancelFepTransaction) { int longPress = 0; - if (m_preeditString.size() == 0) { - QWidget *w = focusWidget(); - if (!cancelFepTransaction && w) { - // We must replace the last character only if the input box has already accepted one - if (w->inputMethodQuery(Qt::ImCursorPosition).toInt() != m_cursorPos) - longPress = 1; - } - } - QList<QInputMethodEvent::Attribute> attributes; QInputMethodEvent event(QLatin1String(""), attributes); - event.setCommitString(m_preeditString, 0-longPress, longPress); + event.setCommitString(m_preeditString, 0, 0); m_preeditString.clear(); sendEvent(event); m_hasTempPreeditString = false; - longPress = 0; if (cancelFepTransaction) { CCoeFep* fep = CCoeEnv::Static()->Fep(); diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index e197dc5..4ed4ba3 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1242,17 +1242,28 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */) S60->setStatusPaneAndButtonGroupVisibility(statusPaneVisibility, buttonGroupVisibility); #endif } else if (QApplication::activeWindow() == qwidget->window()) { - if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog() || S60->menuBeingConstructed) { - QWidget *fw = QApplication::focusWidget(); - if (fw) { - QFocusEvent event(QEvent::FocusOut, Qt::PopupFocusReason); - QCoreApplication::sendEvent(fw, &event); - } - m_symbianPopupIsOpen = true; - return; + bool focusedControlFound = false; + WId winId = 0; + for (QWidget *w = qwidget->parentWidget(); w && (winId = w->internalWinId()); w = w->parentWidget()) { + if (winId->IsFocused() && winId->IsVisible()) { + focusedControlFound = true; + break; + } else if (w->isWindow()) + break; } + if (!focusedControlFound) { + if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog() || S60->menuBeingConstructed) { + QWidget *fw = QApplication::focusWidget(); + if (fw) { + QFocusEvent event(QEvent::FocusOut, Qt::PopupFocusReason); + QCoreApplication::sendEvent(fw, &event); + } + m_symbianPopupIsOpen = true; + return; + } - QApplication::setActiveWindow(0); + QApplication::setActiveWindow(0); + } } // else { We don't touch the active window unless we were explicitly activated or deactivated } } diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm index 89f01d8..515c6d3 100644 --- a/src/gui/kernel/qeventdispatcher_mac.mm +++ b/src/gui/kernel/qeventdispatcher_mac.mm @@ -830,6 +830,7 @@ NSModalSession QEventDispatcherMacPrivate::currentModalSession() [window setLevel:levelBeforeEnterModal]; } currentModalSessionCached = info.session; + cleanupModalSessionsNeeded = false; } return currentModalSessionCached; } @@ -881,6 +882,10 @@ void QEventDispatcherMacPrivate::cleanupModalSessions() for (int i=stackSize-1; i>=0; --i) { QCocoaModalSessionInfo &info = cocoaModalSessionStack[i]; if (info.widget) { + // This session has a widget, and is therefore not marked + // as stopped. So just make it current. There might still be other + // stopped sessions on the stack, but those will be stopped on + // a later "cleanup" call. currentModalSessionCached = info.session; break; } @@ -926,6 +931,7 @@ void QEventDispatcherMacPrivate::endModalSession(QWidget *widget) if (i == stackSize-1) { // The top sessions ended. Interrupt the event dispatcher // to start spinning the correct session immidiatly: + currentModalSessionCached = 0; cleanupModalSessionsNeeded = true; QEventDispatcherMac::instance()->interrupt(); } diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index e768a21..cb4061e 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -595,8 +595,9 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures, if (gesture->hasHotSpot()) { // guess the target widget using the hotspot of the gesture QPoint pt = gesture->hotSpot().toPoint(); - if (QWidget *w = qApp->topLevelAt(pt)) { - target = w->childAt(w->mapFromGlobal(pt)); + if (QWidget *topLevel = qApp->topLevelAt(pt)) { + QWidget *child = topLevel->childAt(topLevel->mapFromGlobal(pt)); + target = child ? child : topLevel; } } else { // or use the context of the gesture diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index eb1aa18..7fd2baa 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -87,7 +87,7 @@ const TInt KInternalStatusPaneChange = 0x50000000; //this macro exists because EColor16MAP enum value doesn't exist in Symbian OS 9.2 #define Q_SYMBIAN_ECOLOR16MAP TDisplayMode(13) -class QS60ThreadLocalData +class Q_AUTOTEST_EXPORT QS60ThreadLocalData { public: QS60ThreadLocalData(); @@ -171,7 +171,7 @@ public: #endif }; -QS60Data* qGlobalS60Data(); +Q_AUTOTEST_EXPORT QS60Data* qGlobalS60Data(); #define S60 qGlobalS60Data() class QAbstractLongTapObserver diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 3d2bfe2..ea3dcab 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -4864,6 +4864,8 @@ void QWidgetPrivate::resolveLayoutDirection() has been called for the parent do not inherit the parent's layout direction. + This method no longer affects text layout direction since Qt 4.7. + \sa QApplication::layoutDirection */ void QWidget::setLayoutDirection(Qt::LayoutDirection direction) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 276da93..5223458 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -46,7 +46,6 @@ #include <private/qdrawhelper_armv6_p.h> #include <private/qdrawhelper_neon_p.h> #include <private/qmath_p.h> -#include <private/qsimd_p.h> #include <qmath.h> QT_BEGIN_NAMESPACE @@ -656,6 +655,46 @@ const uint * QT_FASTCALL fetchTransformed(uint *buffer, const Operator *, const return buffer; } +/** \internal + interpolate 4 argb pixels with the distx and disty factor. + distx and disty bust be between 0 and 16 + */ +static inline uint interpolate_4_pixels_16(uint tl, uint tr, uint bl, uint br, int distx, int disty, int idistx, int idisty) +{ + uint tlrb = ((tl & 0x00ff00ff) * idistx * idisty); + uint tlag = (((tl & 0xff00ff00) >> 8) * idistx * idisty); + uint trrb = ((tr & 0x00ff00ff) * distx * idisty); + uint trag = (((tr & 0xff00ff00) >> 8) * distx * idisty); + uint blrb = ((bl & 0x00ff00ff) * idistx * disty); + uint blag = (((bl & 0xff00ff00) >> 8) * idistx * disty); + uint brrb = ((br & 0x00ff00ff) * distx * disty); + uint brag = (((br & 0xff00ff00) >> 8) * distx * disty); + return (((tlrb + trrb + blrb + brrb) >> 8) & 0x00ff00ff) | ((tlag + trag + blag + brag) & 0xff00ff00); +} + + +template<TextureBlendType blendType> +Q_STATIC_TEMPLATE_FUNCTION inline void fetchTransformedBilinear_pixelBounds(int max, int l1, int l2, int &v1, int &v2) +{ + if (blendType == BlendTransformedBilinearTiled) { + v1 %= max; + if (v1 < 0) v1 += max; + v2 = v1 + 1; + v2 %= max; + } else { + if (v1 < l1) { + v2 = v1 = l1; + } else if (v1 >= l2 - 1) { + v2 = v1 = l2 - 1; + } else { + v2 = v1 + 1; + } + } + + Q_ASSERT(v1 >= 0 && v1 < max); + Q_ASSERT(v2 >= 0 && v2 < max); +} + template<TextureBlendType blendType, QImage::Format format> /* blendType = BlendTransformedBilinear or BlendTransformedBilinearTiled */ Q_STATIC_TEMPLATE_FUNCTION const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *, const QSpanData *data, @@ -696,64 +735,230 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator * fx -= half_point; fy -= half_point; - while (b < end) { - int x1 = (fx >> 16); - int x2; + + if (fdy == 0) { //simple scale, no rotation int y1 = (fy >> 16); int y2; + fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2); + const uchar *s1 = data->texture.scanLine(y1); + const uchar *s2 = data->texture.scanLine(y2); - if (blendType == BlendTransformedBilinearTiled) { - x1 %= image_width; - if (x1 < 0) x1 += image_width; - x2 = x1 + 1; - x2 %= image_width; - - y1 %= image_height; - if (y1 < 0) y1 += image_height; - y2 = y1 + 1; - y2 %= image_height; - } else { - if (x1 < image_x1) { - x2 = x1 = image_x1; - } else if (x1 >= image_x2 - 1) { - x2 = x1 = image_x2 - 1; + if (fdx <= fixed_scale && fdx > 0) { // scale up on X + int disty = (fy & 0x0000ffff) >> 8; + int idisty = 256 - disty; + int x = fx >> 16; + + // The idea is first to do the interpolation between the row s1 and the row s2 + // into an intermediate buffer, then we interpolate between two pixel of this buffer. + + // intermediate_buffer[0] is a buffer of red-blue component of the pixel, in the form 0x00RR00BB + // intermediate_buffer[1] is the alpha-green component of the pixel, in the form 0x00AA00GG + quint32 intermediate_buffer[2][buffer_size + 2]; + // count is the size used in the intermediate_buffer. + int count = qCeil(length * data->m11) + 2; //+1 for the last pixel to interpolate with, and +1 for rounding errors. + Q_ASSERT(count <= buffer_size + 2); //length is supposed to be <= buffer_size and data->m11 < 1 in this case + int f = 0; + int lim = count; + if (blendType == BlendTransformedBilinearTiled) { + x %= image_width; + if (x < 0) x += image_width; } else { - x2 = x1 + 1; + lim = qMin(count, image_x2-x); + if (x < image_x1) { + Q_ASSERT(x < image_x2); + uint t = fetch(s1, image_x1, data->texture.colorTable); + uint b = fetch(s2, image_x1, data->texture.colorTable); + quint32 rb = (((t & 0xff00ff) * idisty + (b & 0xff00ff) * disty) >> 8) & 0xff00ff; + quint32 ag = ((((t>>8) & 0xff00ff) * idisty + ((b>>8) & 0xff00ff) * disty) >> 8) & 0xff00ff; + do { + intermediate_buffer[0][f] = rb; + intermediate_buffer[1][f] = ag; + f++; + x++; + } while (x < image_x1 && f < lim); + } } - if (y1 < image_y1) { - y2 = y1 = image_y1; - } else if (y1 >= image_y2 - 1) { - y2 = y1 = image_y2 - 1; - } else { - y2 = y1 + 1; + +#if defined(QT_ALWAYS_HAVE_SSE2) + if (blendType != BlendTransformedBilinearTiled && + (format == QImage::Format_ARGB32_Premultiplied || format == QImage::Format_RGB32)) { + + const __m128i disty_ = _mm_set1_epi16(disty); + const __m128i idisty_ = _mm_set1_epi16(idisty); + const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); + + lim -= 3; + for (; f < lim; x += 4, f += 4) { + // Load 4 pixels from s1, and split the alpha-green and red-blue component + __m128i top = _mm_loadu_si128((__m128i*)((const uint *)(s1)+x)); + __m128i topAG = _mm_srli_epi16(top, 8); + __m128i topRB = _mm_and_si128(top, colorMask); + // Multiplies each colour component by idisty + topAG = _mm_mullo_epi16 (topAG, idisty_); + topRB = _mm_mullo_epi16 (topRB, idisty_); + + // Same for the s2 vector + __m128i bottom = _mm_loadu_si128((__m128i*)((const uint *)(s2)+x)); + __m128i bottomAG = _mm_srli_epi16(bottom, 8); + __m128i bottomRB = _mm_and_si128(bottom, colorMask); + bottomAG = _mm_mullo_epi16 (bottomAG, disty_); + bottomRB = _mm_mullo_epi16 (bottomRB, disty_); + + // Add the values, and shift to only keep 8 significant bits per colors + __m128i rAG =_mm_add_epi16(topAG, bottomAG); + rAG = _mm_srli_epi16(rAG, 8); + _mm_storeu_si128((__m128i*)(&intermediate_buffer[1][f]), rAG); + __m128i rRB =_mm_add_epi16(topRB, bottomRB); + rRB = _mm_srli_epi16(rRB, 8); + _mm_storeu_si128((__m128i*)(&intermediate_buffer[0][f]), rRB); + } + } +#endif + for (; f < count; f++) { // Same as above but without sse2 + if (blendType == BlendTransformedBilinearTiled) { + if (x >= image_width) x -= image_width; + } else { + x = qMin(x, image_x2 - 1); + } + + uint t = fetch(s1, x, data->texture.colorTable); + uint b = fetch(s2, x, data->texture.colorTable); + + intermediate_buffer[0][f] = (((t & 0xff00ff) * idisty + (b & 0xff00ff) * disty) >> 8) & 0xff00ff; + intermediate_buffer[1][f] = ((((t>>8) & 0xff00ff) * idisty + ((b>>8) & 0xff00ff) * disty) >> 8) & 0xff00ff; + x++; + } + // Now interpolate the values from the intermediate_buffer to get the final result. + fx &= fixed_scale - 1; + Q_ASSERT((fx >> 16) == 0); + while (b < end) { + register int x1 = (fx >> 16); + register int x2 = x1 + 1; + Q_ASSERT(x1 >= 0); + Q_ASSERT(x2 < count); + + register int distx = (fx & 0x0000ffff) >> 8; + register int idistx = 256 - distx; + int rb = ((intermediate_buffer[0][x1] * idistx + intermediate_buffer[0][x2] * distx) >> 8) & 0xff00ff; + int ag = (intermediate_buffer[1][x1] * idistx + intermediate_buffer[1][x2] * distx) & 0xff00ff00; + *b = rb | ag; + b++; + fx += fdx; + } + } else if ((fdx < 0 && fdx > -(fixed_scale / 8)) || fabs(data->m22) < (1./8.)) { // scale up more than 8x + int y1 = (fy >> 16); + int y2; + fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2); + const uchar *s1 = data->texture.scanLine(y1); + const uchar *s2 = data->texture.scanLine(y2); + int disty = (fy & 0x0000ffff) >> 8; + int idisty = 256 - disty; + while (b < end) { + int x1 = (fx >> 16); + int x2; + fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); + uint tl = fetch(s1, x1, data->texture.colorTable); + uint tr = fetch(s1, x2, data->texture.colorTable); + uint bl = fetch(s2, x1, data->texture.colorTable); + uint br = fetch(s2, x2, data->texture.colorTable); + + int distx = (fx & 0x0000ffff) >> 8; + int idistx = 256 - distx; + + uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx); + uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx); + *b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty); + + fx += fdx; + ++b; + } + } else { //scale down + int y1 = (fy >> 16); + int y2; + fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2); + const uchar *s1 = data->texture.scanLine(y1); + const uchar *s2 = data->texture.scanLine(y2); + int disty = (fy & 0x0000ffff) >> 12; + int idisty = 16 - disty; + while (b < end) { + int x1 = (fx >> 16); + int x2; + fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); + uint tl = fetch(s1, x1, data->texture.colorTable); + uint tr = fetch(s1, x2, data->texture.colorTable); + uint bl = fetch(s2, x1, data->texture.colorTable); + uint br = fetch(s2, x2, data->texture.colorTable); + int distx = (fx & 0x0000ffff) >> 12; + int idistx = 16 - distx; + *b = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty, idistx, idisty); + fx += fdx; + ++b; } } + } else { //rotation + if (fabs(data->m11) > 8 || fabs(data->m22) > 8) { + //if we are zooming more than 8 times, we use 8bit precision for the position. + while (b < end) { + int x1 = (fx >> 16); + int x2; + int y1 = (fy >> 16); + int y2; - Q_ASSERT(x1 >= 0 && x1 < image_width); - Q_ASSERT(x2 >= 0 && x2 < image_width); - Q_ASSERT(y1 >= 0 && y1 < image_height); - Q_ASSERT(y2 >= 0 && y2 < image_height); + fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); + fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2); - const uchar *s1 = data->texture.scanLine(y1); - const uchar *s2 = data->texture.scanLine(y2); + const uchar *s1 = data->texture.scanLine(y1); + const uchar *s2 = data->texture.scanLine(y2); - uint tl = fetch(s1, x1, data->texture.colorTable); - uint tr = fetch(s1, x2, data->texture.colorTable); - uint bl = fetch(s2, x1, data->texture.colorTable); - uint br = fetch(s2, x2, data->texture.colorTable); + uint tl = fetch(s1, x1, data->texture.colorTable); + uint tr = fetch(s1, x2, data->texture.colorTable); + uint bl = fetch(s2, x1, data->texture.colorTable); + uint br = fetch(s2, x2, data->texture.colorTable); - int distx = (fx & 0x0000ffff) >> 8; - int disty = (fy & 0x0000ffff) >> 8; - int idistx = 256 - distx; - int idisty = 256 - disty; + int distx = (fx & 0x0000ffff) >> 8; + int disty = (fy & 0x0000ffff) >> 8; + int idistx = 256 - distx; + int idisty = 256 - disty; - uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx); - uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx); - *b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty); + uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx); + uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx); + *b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty); - fx += fdx; - fy += fdy; - ++b; + fx += fdx; + fy += fdy; + ++b; + } + } else { + //we are zooming less than 8x, use 4bit precision + while (b < end) { + int x1 = (fx >> 16); + int x2; + int y1 = (fy >> 16); + int y2; + + fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); + fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2); + + const uchar *s1 = data->texture.scanLine(y1); + const uchar *s2 = data->texture.scanLine(y2); + + uint tl = fetch(s1, x1, data->texture.colorTable); + uint tr = fetch(s1, x2, data->texture.colorTable); + uint bl = fetch(s2, x1, data->texture.colorTable); + uint br = fetch(s2, x2, data->texture.colorTable); + + int distx = (fx & 0x0000ffff) >> 12; + int disty = (fy & 0x0000ffff) >> 12; + int idistx = 16 - distx; + int idisty = 16 - disty; + + *b = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty, idistx, idisty); + + fx += fdx; + fy += fdy; + ++b; + } + } } } else { const qreal fdx = data->m11; @@ -779,37 +984,8 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator * int idistx = 256 - distx; int idisty = 256 - disty; - if (blendType == BlendTransformedBilinearTiled) { - x1 %= image_width; - if (x1 < 0) x1 += image_width; - x2 = x1 + 1; - x2 %= image_width; - - y1 %= image_height; - if (y1 < 0) y1 += image_height; - y2 = y1 + 1; - y2 %= image_height; - } else { - if (x1 < 0) { - x2 = x1 = 0; - } else if (x1 >= image_width - 1) { - x2 = x1 = image_width - 1; - } else { - x2 = x1 + 1; - } - if (y1 < 0) { - y2 = y1 = 0; - } else if (y1 >= image_height - 1) { - y2 = y1 = image_height - 1; - } else { - y2 = y1 + 1; - } - } - - Q_ASSERT(x1 >= 0 && x1 < image_width); - Q_ASSERT(x2 >= 0 && x2 < image_width); - Q_ASSERT(y1 >= 0 && y1 < image_height); - Q_ASSERT(y2 >= 0 && y2 < image_height); + fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); + fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2); const uchar *s1 = data->texture.scanLine(y1); const uchar *s2 = data->texture.scanLine(y2); @@ -1757,9 +1933,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Plus_impl(uint *dest, int for (int i = 0; i < length; ++i) { PRELOAD_COND(dest) uint d = dest[i]; -#define MIX(mask) (qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask))) - d = (MIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK)); -#undef MIX + d = comp_func_Plus_one_pixel(d, s); coverage.store(&dest[i], d); } } @@ -1781,9 +1955,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Plus_impl(uint *dest, const uin uint d = dest[i]; uint s = src[i]; -#define MIX(mask) (qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask))) - d = (MIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK)); -#undef MIX + d = comp_func_Plus_one_pixel(d, s); coverage.store(&dest[i], d); } @@ -5216,37 +5388,8 @@ Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_bilinear_argb(int count, const int y1 = (y >> 16); int y2; - if (blendType == BlendTransformedBilinearTiled) { - x1 %= image_width; - if (x1 < 0) x1 += image_width; - x2 = x1 + 1; - x2 %= image_width; - - y1 %= image_height; - if (y1 < 0) y1 += image_height; - y2 = y1 + 1; - y2 %= image_height; - - Q_ASSERT(x1 >= 0 && x1 < image_width); - Q_ASSERT(x2 >= 0 && x2 < image_width); - Q_ASSERT(y1 >= 0 && y1 < image_height); - Q_ASSERT(y2 >= 0 && y2 < image_height); - } else { - if (x1 < image_x1) { - x2 = x1 = image_x1; - } else if (x1 >= image_x2 - 1) { - x2 = x1 = image_x2 - 1; - } else { - x2 = x1 + 1; - } - if (y1 < image_y1) { - y2 = y1 = image_y1; - } else if (y1 >= image_y2 - 1) { - y2 = y1 = image_y2 - 1; - } else { - y2 = y1 + 1; - } - } + fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); + fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2); int y1_offset = y1 * scanline_offset; int y2_offset = y2 * scanline_offset; @@ -5326,37 +5469,8 @@ Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_bilinear_argb(int count, const int idistx = 256 - distx; int idisty = 256 - disty; - if (blendType == BlendTransformedBilinearTiled) { - x1 %= image_width; - if (x1 < 0) x1 += image_width; - x2 = x1 + 1; - x2 %= image_width; - - y1 %= image_height; - if (y1 < 0) y1 += image_height; - y2 = y1 + 1; - y2 %= image_height; - - Q_ASSERT(x1 >= 0 && x1 < image_width); - Q_ASSERT(x2 >= 0 && x2 < image_width); - Q_ASSERT(y1 >= 0 && y1 < image_height); - Q_ASSERT(y2 >= 0 && y2 < image_height); - } else { - if (x1 < image_x1) { - x2 = x1 = image_x1; - } else if (x1 >= image_x2 - 1) { - x2 = x1 = image_x2 - 1; - } else { - x2 = x1 + 1; - } - if (y1 < image_y1) { - y2 = y1 = image_y1; - } else if (y1 >= image_y2 - 1) { - y2 = y1 = image_y2 - 1; - } else { - y2 = y1 + 1; - } - } + fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); + fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2); int y1_offset = y1 * scanline_offset; int y2_offset = y2 * scanline_offset; @@ -7911,11 +8025,13 @@ void qInitDrawhelperAsm() functionForMode_C[QPainter::CompositionMode_SourceOver] = qt_blend_argb32_on_argb32_scanline_neon; functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_neon; + functionForMode_C[QPainter::CompositionMode_Plus] = comp_func_Plus_neon; destFetchProc[QImage::Format_RGB16] = qt_destFetchRGB16_neon; destStoreProc[QImage::Format_RGB16] = qt_destStoreRGB16_neon; qMemRotateFunctions[QImage::Format_RGB16][0] = qt_memrotate90_16_neon; qMemRotateFunctions[QImage::Format_RGB16][2] = qt_memrotate270_16_neon; + qt_memfill32 = qt_memfill32_neon; } #endif diff --git a/src/gui/painting/qdrawhelper_neon.cpp b/src/gui/painting/qdrawhelper_neon.cpp index 03fe075..ed15c5c 100644 --- a/src/gui/painting/qdrawhelper_neon.cpp +++ b/src/gui/painting/qdrawhelper_neon.cpp @@ -51,6 +51,44 @@ QT_BEGIN_NAMESPACE +void qt_memfill32_neon(quint32 *dest, quint32 value, int count) +{ + const int epilogueSize = count % 16; + if (count >= 16) { + quint32 *const neonEnd = dest + count - epilogueSize; + register uint32x4_t valueVector1 asm ("q0") = vdupq_n_u32(value); + register uint32x4_t valueVector2 asm ("q1") = valueVector1; + while (dest != neonEnd) { + asm volatile ( + "vst2.32 { d0, d1, d2, d3 }, [%[DST]] !\n\t" + "vst2.32 { d0, d1, d2, d3 }, [%[DST]] !\n\t" + : [DST]"+r" (dest) + : [VALUE1]"w"(valueVector1), [VALUE2]"w"(valueVector2) + : "memory" + ); + } + } + + switch (epilogueSize) + { + case 15: *dest++ = value; + case 14: *dest++ = value; + case 13: *dest++ = value; + case 12: *dest++ = value; + case 11: *dest++ = value; + case 10: *dest++ = value; + case 9: *dest++ = value; + case 8: *dest++ = value; + case 7: *dest++ = value; + case 6: *dest++ = value; + case 5: *dest++ = value; + case 4: *dest++ = value; + case 3: *dest++ = value; + case 2: *dest++ = value; + case 1: *dest++ = value; + } +} + static inline uint16x8_t qvdiv_255_u16(uint16x8_t x, uint16x8_t half) { // result = (x + (x >> 8) + 0x80) >> 8 @@ -622,6 +660,61 @@ void QT_FASTCALL comp_func_solid_SourceOver_neon(uint *destPixels, int length, u } } +void QT_FASTCALL comp_func_Plus_neon(uint *dst, const uint *src, int length, uint const_alpha) +{ + if (const_alpha == 255) { + uint *const end = dst + length; + uint *const neonEnd = end - 3; + + while (dst < neonEnd) { + asm volatile ( + "vld2.8 { d0, d1 }, [%[SRC]] !\n\t" + "vld2.8 { d2, d3 }, [%[DST]]\n\t" + "vqadd.u8 q0, q0, q1\n\t" + "vst2.8 { d0, d1 }, [%[DST]] !\n\t" + : [DST]"+r" (dst), [SRC]"+r" (src) + : + : "memory", "d0", "d1", "d2", "d3", "q0", "q1" + ); + } + + while (dst != end) { + *dst = comp_func_Plus_one_pixel(*dst, *src); + ++dst; + ++src; + } + } else { + int x = 0; + const int one_minus_const_alpha = 255 - const_alpha; + const uint16x8_t constAlphaVector = vdupq_n_u16(const_alpha); + const uint16x8_t oneMinusconstAlphaVector = vdupq_n_u16(one_minus_const_alpha); + + const uint16x8_t half = vdupq_n_u16(0x80); + for (; x < length - 3; x += 4) { + const uint32x4_t src32 = vld1q_u32((uint32_t *)&src[x]); + const uint8x16_t src8 = vreinterpretq_u8_u32(src32); + uint8x16_t dst8 = vld1q_u8((uint8_t *)&dst[x]); + uint8x16_t result = vqaddq_u8(dst8, src8); + + uint16x8_t result_low = vmovl_u8(vget_low_u8(result)); + uint16x8_t result_high = vmovl_u8(vget_high_u8(result)); + + uint16x8_t dst_low = vmovl_u8(vget_low_u8(dst8)); + uint16x8_t dst_high = vmovl_u8(vget_high_u8(dst8)); + + result_low = qvinterpolate_pixel_255(result_low, constAlphaVector, dst_low, oneMinusconstAlphaVector, half); + result_high = qvinterpolate_pixel_255(result_high, constAlphaVector, dst_high, oneMinusconstAlphaVector, half); + + const uint32x2_t result32_low = vreinterpret_u32_u8(vmovn_u16(result_low)); + const uint32x2_t result32_high = vreinterpret_u32_u8(vmovn_u16(result_high)); + vst1q_u32((uint32_t *)&dst[x], vcombine_u32(result32_low, result32_high)); + } + + for (; x < length; ++x) + dst[x] = comp_func_Plus_one_pixel_const_alpha(dst[x], src[x], const_alpha, one_minus_const_alpha); + } +} + static const int tileSize = 32; extern "C" void qt_rotate90_16_neon(quint16 *dst, const quint16 *src, int sstride, int dstride, int count); diff --git a/src/gui/painting/qdrawhelper_neon_p.h b/src/gui/painting/qdrawhelper_neon_p.h index cd2dbfc..451edbc 100644 --- a/src/gui/painting/qdrawhelper_neon_p.h +++ b/src/gui/painting/qdrawhelper_neon_p.h @@ -120,6 +120,7 @@ void qt_transform_image_rgb16_on_rgb16_neon(uchar *destPixels, int dbpl, const QTransform &targetRectTransform, int const_alpha); +void qt_memfill32_neon(quint32 *dest, quint32 value, int count); void qt_memrotate90_16_neon(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl); void qt_memrotate270_16_neon(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl); @@ -131,6 +132,7 @@ void QT_FASTCALL qt_destStoreRGB16_neon(QRasterBuffer *rasterBuffer, int x, int y, const uint *buffer, int length); void QT_FASTCALL comp_func_solid_SourceOver_neon(uint *destPixels, int length, uint color, uint const_alpha); +void QT_FASTCALL comp_func_Plus_neon(uint *dst, const uint *src, int length, uint const_alpha); #endif // QT_HAVE_NEON diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index d04c70d..5747da5 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -62,6 +62,7 @@ #define QT_FT_END_HEADER #endif #include "private/qrasterdefs_p.h" +#include <private/qsimd_p.h> #ifdef Q_WS_QWS #include "QtGui/qscreen_qws.h" @@ -69,13 +70,6 @@ QT_BEGIN_NAMESPACE -#if defined(Q_OS_MAC) && (defined(__ppc__) || defined(__ppc64__)) -#undef QT_HAVE_MMX -#undef QT_HAVE_SSE -#undef QT_HAVE_SSE2 -#undef QT_HAVE_3DNOW -#endif - #if defined(Q_CC_MSVC) && _MSCVER <= 1300 && !defined(Q_CC_INTEL) #define Q_STATIC_TEMPLATE_SPECIALIZATION static #else @@ -1944,6 +1938,30 @@ const uint qt_bayer_matrix[16][16] = { ((((argb >> 24) * alpha) >> 8) << 24) | (argb & 0x00ffffff) +#if QT_POINTER_SIZE == 8 // 64-bit versions +#define AMIX(mask) (qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask))) +#define MIX(mask) (qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask))) +#else // 32 bits +// The mask for alpha can overflow over 32 bits +#define AMIX(mask) quint32(qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask))) +#define MIX(mask) (qMin(((quint32(s)&mask) + (quint32(d)&mask)), quint32(mask))) +#endif + +inline int comp_func_Plus_one_pixel_const_alpha(uint d, const uint s, const uint const_alpha, const uint one_minus_const_alpha) +{ + const int result = (AMIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK)); + return INTERPOLATE_PIXEL_255(result, const_alpha, d, one_minus_const_alpha); +} + +inline int comp_func_Plus_one_pixel(uint d, const uint s) +{ + const int result = (AMIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK)); + return result; +} + +#undef MIX +#undef AMIX + // prototypes of all the composition functions void QT_FASTCALL comp_func_SourceOver(uint *dest, const uint *src, int length, uint const_alpha); void QT_FASTCALL comp_func_DestinationOver(uint *dest, const uint *src, int length, uint const_alpha); diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp index 22c0384..5b674b5 100644 --- a/src/gui/painting/qdrawhelper_sse2.cpp +++ b/src/gui/painting/qdrawhelper_sse2.cpp @@ -43,7 +43,6 @@ #ifdef QT_HAVE_SSE2 -#include <private/qsimd_p.h> #include <private/qdrawingprimitive_sse2_p.h> #include <private/qpaintengine_raster_p.h> @@ -161,22 +160,6 @@ void QT_FASTCALL comp_func_SourceOver_sse2(uint *destPixels, const uint *srcPixe } } -inline int comp_func_Plus_one_pixel_const_alpha(uint d, const uint s, const uint const_alpha, const uint one_minus_const_alpha) -{ -#define MIX(mask) (qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask))) - const int result = (MIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK)); -#undef MIX - return INTERPOLATE_PIXEL_255(result, const_alpha, d, one_minus_const_alpha); -} - -inline int comp_func_Plus_one_pixel(uint d, const uint s) -{ -#define MIX(mask) (qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask))) - const int result = (MIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK)); -#undef MIX - return result; -} - void QT_FASTCALL comp_func_Plus_sse2(uint *dst, const uint *src, int length, uint const_alpha) { int x = 0; diff --git a/src/gui/painting/qdrawhelper_ssse3.cpp b/src/gui/painting/qdrawhelper_ssse3.cpp index 9c02009..4cb4089 100644 --- a/src/gui/painting/qdrawhelper_ssse3.cpp +++ b/src/gui/painting/qdrawhelper_ssse3.cpp @@ -39,11 +39,10 @@ ** ****************************************************************************/ +#include <private/qdrawhelper_x86_p.h> #ifdef QT_HAVE_SSSE3 -#include <private/qsimd_p.h> -#include <private/qdrawhelper_x86_p.h> #include <private/qdrawingprimitive_sse2_p.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index be90006..4e10671 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -696,9 +696,9 @@ void QPainterPrivate::updateEmulationSpecifier(QPainterState *s) skip = false; - QBrush penBrush = s->pen.brush(); - Qt::BrushStyle brushStyle = s->brush.style(); - Qt::BrushStyle penBrushStyle = penBrush.style(); + QBrush penBrush = (qpen_style(s->pen) == Qt::NoPen) ? QBrush(Qt::NoBrush) : qpen_brush(s->pen); + Qt::BrushStyle brushStyle = qbrush_style(s->brush); + Qt::BrushStyle penBrushStyle = qbrush_style(penBrush); alpha = (penBrushStyle != Qt::NoBrush && (penBrushStyle < Qt::LinearGradientPattern && penBrush.color().alpha() != 255) && !penBrush.isOpaque()) @@ -5863,7 +5863,8 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText } bool paintEngineSupportsTransformations = d->extended->type() == QPaintEngine::OpenGL2 - || d->extended->type() == QPaintEngine::OpenVG; + || d->extended->type() == QPaintEngine::OpenVG + || d->extended->type() == QPaintEngine::OpenGL; if (paintEngineSupportsTransformations && !staticText_d->untransformedCoordinates) { staticText_d->untransformedCoordinates = true; @@ -5907,7 +5908,7 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText // Recreate the layout of the static text because the matrix or font has changed if (staticTextNeedsReinit) - staticText_d->init(); + staticText_d->init(); if (transformedPosition != staticText_d->position) { // Translate to actual position QFixed fx = QFixed::fromReal(transformedPosition.x()); diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp index ada5293..306219d 100644 --- a/src/gui/styles/qcleanlooksstyle.cpp +++ b/src/gui/styles/qcleanlooksstyle.cpp @@ -2157,7 +2157,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o } if (button->features & QStyleOptionButton::HasMenu) - ir = ir.adjusted(0, 0, -pixelMetric(PM_MenuButtonIndicator, button, widget), 0); + ir = ir.adjusted(0, 0, -proxy()->pixelMetric(PM_MenuButtonIndicator, button, widget), 0); proxy()->drawItemText(painter, ir, tf, button->palette, (button->state & State_Enabled), button->text, QPalette::ButtonText); } @@ -4014,8 +4014,8 @@ QRect QCleanlooksStyle::subControlRect(ComplexControl control, const QStyleOptio switch (subControl) { case SC_SliderHandle: { if (slider->orientation == Qt::Horizontal) { - rect.setHeight(pixelMetric(PM_SliderThickness)); - rect.setWidth(pixelMetric(PM_SliderLength)); + rect.setHeight(proxy()->pixelMetric(PM_SliderThickness)); + rect.setWidth(proxy()->pixelMetric(PM_SliderLength)); int centerY = slider->rect.center().y() - rect.height() / 2; if (slider->tickPosition & QSlider::TicksAbove) centerY += tickSize; @@ -4023,8 +4023,8 @@ QRect QCleanlooksStyle::subControlRect(ComplexControl control, const QStyleOptio centerY -= tickSize; rect.moveTop(centerY); } else { - rect.setWidth(pixelMetric(PM_SliderThickness)); - rect.setHeight(pixelMetric(PM_SliderLength)); + rect.setWidth(proxy()->pixelMetric(PM_SliderThickness)); + rect.setHeight(proxy()->pixelMetric(PM_SliderLength)); int centerX = slider->rect.center().x() - rect.width() / 2; if (slider->tickPosition & QSlider::TicksAbove) centerX += tickSize; diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index c989bd3..c5429dd 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -836,7 +836,10 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, case PE_PanelItemViewItem: if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) { - if (vopt->backgroundBrush.style() != Qt::NoBrush) { + uint resolve_mask = vopt->palette.resolve(); + if (vopt->backgroundBrush.style() != Qt::NoBrush + || (resolve_mask & (1 << QPalette::Base))) + { QPointF oldBO = painter->brushOrigin(); painter->setBrushOrigin(vopt->rect.topLeft()); painter->fillRect(vopt->rect, vopt->backgroundBrush); diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index e28403b..0ba1bc6 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -2340,16 +2340,20 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti tableView = true; QS60StylePrivate::SkinElements element; + bool themeGraphicDefined = false; QRect elementRect = option->rect; //draw item is drawn as pressed, if it already has focus. if (isPressed && (hasFocus || isSelected)) { + themeGraphicDefined = true; element = tableView ? QS60StylePrivate::SE_TableItemPressed : QS60StylePrivate::SE_ListItemPressed; } else if (hasFocus || (isSelected && selectionBehavior != QAbstractItemView::SelectItems)) { element = QS60StylePrivate::SE_ListHighlight; elementRect = highlightRect; + themeGraphicDefined = true; } - QS60StylePrivate::drawSkinElement(element, painter, elementRect, flags); + if (themeGraphicDefined) + QS60StylePrivate::drawSkinElement(element, painter, elementRect, flags); } else { QCommonStyle::drawPrimitive(element, option, painter, widget); } diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 194c5f3..3f758b1 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -1093,6 +1093,18 @@ const QVector<QRgb> &QFontEngine::grayPalette() return *qt_grayPalette(); } +QFixed QFontEngine::lastRightBearing(const QGlyphLayout &glyphs, bool round) +{ + if (glyphs.numGlyphs >= 1) { + glyph_t glyph = glyphs.glyphs[glyphs.numGlyphs - 1]; + glyph_metrics_t gi = boundingBox(glyph); + if (gi.isValid()) + return round ? QFixed(qRound(gi.xoff - gi.x - gi.width)) + : QFixed(gi.xoff - gi.x - gi.width); + } + return 0; +} + // ------------------------------------------------------------------ // The box font engine // ------------------------------------------------------------------ diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm index 91b6082..bdf3848 100644 --- a/src/gui/text/qfontengine_mac.mm +++ b/src/gui/text/qfontengine_mac.mm @@ -455,12 +455,13 @@ bool QCoreTextFontEngine::stringToCMap(const QChar *, int, QGlyphLayout *, int * glyph_metrics_t QCoreTextFontEngine::boundingBox(const QGlyphLayout &glyphs) { QFixed w; + bool round = fontDef.styleStrategy & QFont::ForceIntegerMetrics; + for (int i = 0; i < glyphs.numGlyphs; ++i) { - w += (fontDef.styleStrategy & QFont::ForceIntegerMetrics) - ? glyphs.effectiveAdvance(i).round() - : glyphs.effectiveAdvance(i); + w += round ? glyphs.effectiveAdvance(i).round() + : glyphs.effectiveAdvance(i); } - return glyph_metrics_t(0, -(ascent()), w, ascent()+descent(), w, 0); + return glyph_metrics_t(0, -(ascent()), w - lastRightBearing(glyphs, round), ascent()+descent(), w, 0); } glyph_metrics_t QCoreTextFontEngine::boundingBox(glyph_t glyph) { @@ -1480,12 +1481,12 @@ void QFontEngineMac::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFla glyph_metrics_t QFontEngineMac::boundingBox(const QGlyphLayout &glyphs) { QFixed w; + bool round = fontDef.styleStrategy & QFont::ForceIntegerMetrics; for (int i = 0; i < glyphs.numGlyphs; ++i) { - w += (fontDef.styleStrategy & QFont::ForceIntegerMetrics) - ? glyphs.effectiveAdvance(i).round() - : glyphs.effectiveAdvance(i); + w += round ? glyphs.effectiveAdvance(i).round() + : glyphs.effectiveAdvance(i); } - return glyph_metrics_t(0, -(ascent()), w, ascent()+descent(), w, 0); + return glyph_metrics_t(0, -(ascent()), w - lastRightBearing(glyphs, round), ascent()+descent(), w, 0); } glyph_metrics_t QFontEngineMac::boundingBox(glyph_t glyph) diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index 922acfb..3b91cd8 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -253,6 +253,7 @@ public: protected: static const QVector<QRgb> &grayPalette(); + QFixed lastRightBearing(const QGlyphLayout &glyphs, bool round = false); private: struct GlyphCacheEntry { diff --git a/src/gui/text/qfontengine_qws.cpp b/src/gui/text/qfontengine_qws.cpp index a7a95d0..decc89c 100644 --- a/src/gui/text/qfontengine_qws.cpp +++ b/src/gui/text/qfontengine_qws.cpp @@ -557,7 +557,7 @@ glyph_metrics_t QFontEngineQPF1::boundingBox(const QGlyphLayout &glyphs) QFixed w = 0; for (int i = 0; i < glyphs.numGlyphs; ++i) w += glyphs.effectiveAdvance(i); - return glyph_metrics_t(0, -ascent(), w, ascent()+descent()+1, w, 0); + return glyph_metrics_t(0, -ascent(), w - lastRightBearing(glyphs), ascent()+descent()+1, w, 0); } glyph_metrics_t QFontEngineQPF1::boundingBox(glyph_t glyph) diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp index 52a1fe7..2cc3f50 100644 --- a/src/gui/text/qfontengine_s60.cpp +++ b/src/gui/text/qfontengine_s60.cpp @@ -345,7 +345,7 @@ glyph_metrics_t QFontEngineS60::boundingBox(const QGlyphLayout &glyphs) for (int i = 0; i < glyphs.numGlyphs; ++i) w += glyphs.effectiveAdvance(i); - return glyph_metrics_t(0, -ascent(), w, ascent()+descent()+1, w, 0); + return glyph_metrics_t(0, -ascent(), w - lastRightBearing(glyphs), ascent()+descent()+1, w, 0); } glyph_metrics_t QFontEngineS60::boundingBox_const(glyph_t glyph) const diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp index a805612..4bed2b5 100644 --- a/src/gui/text/qfontengine_win.cpp +++ b/src/gui/text/qfontengine_win.cpp @@ -487,7 +487,7 @@ glyph_metrics_t QFontEngineWin::boundingBox(const QGlyphLayout &glyphs) for (int i = 0; i < glyphs.numGlyphs; ++i) w += glyphs.effectiveAdvance(i); - return glyph_metrics_t(0, -tm.tmAscent, w, tm.tmHeight, w, 0); + return glyph_metrics_t(0, -tm.tmAscent, w - lastRightBearing(glyphs), tm.tmHeight, w, 0); } #ifndef Q_WS_WINCE diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 8d6dd6c..119217a 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1646,7 +1646,6 @@ glyph_metrics_t QTextEngine::boundingBox(int from, int len) const for (int i = 0; i < layoutData->items.size(); i++) { const QScriptItem *si = layoutData->items.constData() + i; - QFontEngine *fe = fontEngine(*si); int pos = si->position; int ilen = length(i); @@ -1676,6 +1675,7 @@ glyph_metrics_t QTextEngine::boundingBox(int from, int len) const while (charFrom < ilen && logClusters[charFrom] == glyphStart) charFrom++; if (charFrom < ilen) { + QFontEngine *fe = fontEngine(*si); glyphStart = logClusters[charFrom]; int charEnd = from + len - 1 - pos; if (charEnd >= ilen) @@ -1694,11 +1694,6 @@ glyph_metrics_t QTextEngine::boundingBox(int from, int len) const gm.yoff += m.yoff; } } - - glyph_t glyph = glyphs.glyphs[logClusters[ilen - 1]]; - glyph_metrics_t gi = fe->boundingBox(glyph); - if (gi.isValid()) - gm.width -= qRound(gi.xoff - gi.x - gi.width); } } return gm; @@ -2144,8 +2139,11 @@ bool QTextEngine::LayoutData::reallocate(int totalGlyphs) void **newMem = memory; newMem = (void **)::realloc(memory_on_stack ? 0 : memory, newAllocated*sizeof(void *)); - Q_CHECK_PTR(newMem); - if (memory_on_stack && newMem) + if (!newMem) { + layoutState = LayoutFailed; + return false; + } + if (memory_on_stack) memcpy(newMem, memory, allocated*sizeof(void *)); memory = newMem; memory_on_stack = false; diff --git a/src/gui/widgets/qdatetimeedit.cpp b/src/gui/widgets/qdatetimeedit.cpp index 7a61dc7..bd6c577 100644 --- a/src/gui/widgets/qdatetimeedit.cpp +++ b/src/gui/widgets/qdatetimeedit.cpp @@ -248,7 +248,7 @@ void QDateTimeEdit::setDateTime(const QDateTime &datetime) /*! \property QDateTimeEdit::date - \brief the QDate that is set in the QDateTimeEdit + \brief the QDate that is set in the widget By default, this property contains a date that refers to January 1, 2000. @@ -279,7 +279,7 @@ void QDateTimeEdit::setDate(const QDate &date) /*! \property QDateTimeEdit::time - \brief the QTime that is set in the QDateTimeEdit + \brief the QTime that is set in the widget By default, this property contains a time of 00:00:00 and 0 milliseconds. @@ -1555,13 +1555,6 @@ QTimeEdit::QTimeEdit(const QTime &time, QWidget *parent) { } -/*! - \property QTimeEdit::time - \brief the QTime that is shown in the widget - - By default, this property contains a time of 00:00:00 and 0 milliseconds. -*/ - /*! \class QDateEdit @@ -1616,13 +1609,6 @@ QDateEdit::QDateEdit(const QDate &date, QWidget *parent) { } -/*! - \property QDateEdit::date - \brief the QDate that is shown in the widget - - By default, this property contains a date referring to January 1, 2000. -*/ - // --- QDateTimeEditPrivate --- diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index d027b91..69e6791 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -419,7 +419,7 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event) int c = m_cursor; // cursor position after insertion of commit string - if (event->replacementStart() == 0) + if (event->replacementStart() <= 0) c += event->commitString().length() + qMin(-event->replacementStart(), event->replacementLength()); m_cursor += event->replacementStart(); @@ -464,6 +464,8 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event) if (a.type == QInputMethodEvent::Cursor) { m_preeditCursor = a.start; m_hideCursor = !a.length; + if (m_hideCursor) + setCursorBlinkPeriod(0); } else if (a.type == QInputMethodEvent::TextFormat) { QTextCharFormat f = qvariant_cast<QTextFormat>(a.value).toCharFormat(); if (f.isValid()) { @@ -527,7 +529,7 @@ void QLineControl::draw(QPainter *painter, const QPoint &offset, const QRect &cl int cursor = m_cursor; if (m_preeditCursor != -1) cursor += m_preeditCursor; - if(!m_blinkPeriod || m_blinkStatus) + if (!m_hideCursor && (!m_blinkPeriod || m_blinkStatus)) m_textLayout.drawCursor(painter, offset, cursor, m_cursorWidth); } } diff --git a/src/imports/particles/qdeclarativeparticles.cpp b/src/imports/particles/qdeclarativeparticles.cpp index 5cd9c0c..edb69bc 100644 --- a/src/imports/particles/qdeclarativeparticles.cpp +++ b/src/imports/particles/qdeclarativeparticles.cpp @@ -165,14 +165,6 @@ void QDeclarativeParticleMotion::destroy(QDeclarativeParticle &particle) It has no further properties. */ - -/*! - \internal - \class QDeclarativeParticleMotionLinear - \ingroup group_effects - \brief The QDeclarativeParticleMotionLinear class moves the particles linearly. -*/ - void QDeclarativeParticleMotionLinear::advance(QDeclarativeParticle &p, int interval) { p.x += interval * p.x_velocity; @@ -196,14 +188,6 @@ void QDeclarativeParticleMotionLinear::advance(QDeclarativeParticle &p, int inte */ /*! - \internal - \class QDeclarativeParticleMotionGravity - \ingroup group_effects - \brief The QDeclarativeParticleMotionGravity class moves the particles towards a point. - -*/ - -/*! \qmlproperty real ParticleMotionGravity::xattractor \qmlproperty real ParticleMotionGravity::yattractor These properties hold the x and y coordinates of the point attracting the particles. @@ -311,16 +295,6 @@ Rectangle { */ /*! - \internal - \class QDeclarativeParticleMotionWander - \ingroup group_effects - \brief The QDeclarativeParticleMotionWander class moves particles in a somewhat random fashion. - - The particles will continue roughly in the original direction, however will randomly - drift to each side. -*/ - -/*! \qmlproperty real ParticleMotionWander::xvariance \qmlproperty real ParticleMotionWander::yvariance @@ -709,13 +683,6 @@ Rectangle { \image particles.gif */ -/*! - \internal - \class QDeclarativeParticles - \ingroup group_effects - \brief The QDeclarativeParticles class generates and moves particles. -*/ - QDeclarativeParticles::QDeclarativeParticles(QDeclarativeItem *parent) : QDeclarativeItem(*(new QDeclarativeParticlesPrivate), parent) { diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 837cf66..b35c318 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -201,7 +201,7 @@ static void ensureInitialized() deleteResource()) \value CustomOperation custom operation (created with - sendCustomRequest()) + sendCustomRequest()) \since 4.7 \omitvalue UnknownOperation diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index 102b347..23d7800 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -45,16 +45,45 @@ #include "qbearerengine_p.h" #include <QtCore/qstringlist.h> +#include <QtCore/qcoreapplication.h> #ifndef QT_NO_BEARERMANAGEMENT QT_BEGIN_NAMESPACE -Q_GLOBAL_STATIC(QNetworkConfigurationManagerPrivate, connManager); +#define Q_GLOBAL_STATIC_QAPP_DESTRUCTION(TYPE, NAME) \ + Q_GLOBAL_STATIC_INIT(TYPE, NAME); \ + static void NAME##_cleanup() \ + { \ + delete this_##NAME.pointer; \ + this_##NAME.pointer = 0; \ + this_##NAME.destroyed = true; \ + } \ + static TYPE *NAME() \ + { \ + if (!this_##NAME.pointer && !this_##NAME.destroyed) { \ + TYPE *x = new TYPE; \ + if (!this_##NAME.pointer.testAndSetOrdered(0, x)) \ + delete x; \ + else \ + qAddPostRoutine(NAME##_cleanup); \ + } \ + return this_##NAME.pointer; \ + } + +Q_GLOBAL_STATIC_QAPP_DESTRUCTION(QNetworkConfigurationManagerPrivate, connManager); QNetworkConfigurationManagerPrivate *qNetworkConfigurationManagerPrivate() { - return connManager(); + static bool initialized = false; + + QNetworkConfigurationManagerPrivate *m = connManager(); + if (!initialized) { + initialized = true; + m->updateConfigurations(); + } + + return m; } /*! @@ -178,7 +207,7 @@ QNetworkConfigurationManagerPrivate *qNetworkConfigurationManagerPrivate() QNetworkConfigurationManager::QNetworkConfigurationManager( QObject* parent ) : QObject(parent) { - QNetworkConfigurationManagerPrivate *priv = connManager(); + QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate(); connect(priv, SIGNAL(configurationAdded(QNetworkConfiguration)), this, SIGNAL(configurationAdded(QNetworkConfiguration))); diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index dd174bf..d388920 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -64,9 +64,6 @@ QNetworkConfigurationManagerPrivate::QNetworkConfigurationManagerPrivate() { qRegisterMetaType<QNetworkConfiguration>("QNetworkConfiguration"); qRegisterMetaType<QNetworkConfigurationPrivatePointer>("QNetworkConfigurationPrivatePointer"); - - moveToThread(QCoreApplicationPrivate::mainThread()); - updateConfigurations(); } QNetworkConfigurationManagerPrivate::~QNetworkConfigurationManagerPrivate() @@ -359,6 +356,13 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() if (sender()) return; + if (thread() != QCoreApplicationPrivate::mainThread()) { + if (thread() != QThread::currentThread()) + return; + + moveToThread(QCoreApplicationPrivate::mainThread()); + } + updating = false; #ifndef QT_NO_LIBRARY diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp index d61c686..18cc14e 100644 --- a/src/network/kernel/qauthenticator.cpp +++ b/src/network/kernel/qauthenticator.cpp @@ -52,10 +52,13 @@ #include <qstring.h> #include <qdatetime.h> +//#define NTLMV1_CLIENT QT_BEGIN_NAMESPACE +#ifdef NTLMV1_CLIENT #include "../../3rdparty/des/des.cpp" +#endif static QByteArray qNtlmPhase1(); static QByteArray qNtlmPhase3(QAuthenticatorPrivate *ctx, const QByteArray& phase2data); @@ -203,17 +206,29 @@ QString QAuthenticator::user() const void QAuthenticator::setUser(const QString &user) { detach(); - int separatorPosn = 0; - separatorPosn = user.indexOf(QLatin1String("\\")); - if (separatorPosn == -1) { - //No domain name present + switch(d->method) { + case QAuthenticatorPrivate::DigestMd5: + case QAuthenticatorPrivate::Ntlm: + if((separatorPosn = user.indexOf(QLatin1String("\\"))) != -1) + { + //domain name is present + d->realm = user.left(separatorPosn); + d->user = user.mid(separatorPosn + 1); + } else if((separatorPosn = user.indexOf(QLatin1String("@"))) != -1) { + //domain name is present + d->realm = user.mid(separatorPosn + 1); + d->user = user.left(separatorPosn); + } else { + d->user = user; + d->realm.clear(); + } + break; + // For other auth mechanisms, domain name will be part of username + default: d->user = user; - } else { - //domain name is present - d->realm = user.left(separatorPosn); - d->user = user.mid(separatorPosn+1); + break; } } @@ -1178,11 +1193,9 @@ static QByteArray clientChallenge(const QAuthenticatorPrivate *ctx) } // caller has to ensure a valid targetInfoBuff -static bool qExtractServerTime(const QByteArray& targetInfoBuff, - quint64 *serverTime) +static QByteArray qExtractServerTime(const QByteArray& targetInfoBuff) { - Q_ASSERT(serverTime != 0); - bool retValue = false; + QByteArray timeArray; QDataStream ds(targetInfoBuff); ds.setByteOrder(QDataStream::LittleEndian); @@ -1193,19 +1206,16 @@ static bool qExtractServerTime(const QByteArray& targetInfoBuff, ds >> avLen; while(avId != 0) { if(avId == AVTIMESTAMP) { - QByteArray timeArray(avLen, 0); + timeArray.resize(avLen); //avLen size of QByteArray is allocated ds.readRawData(timeArray.data(), avLen); - bool ok; - *serverTime = timeArray.toHex().toLongLong(&ok, 16); - retValue = true; break; } ds.skipRawData(avLen); ds >> avId; ds >> avLen; } - return retValue; + return timeArray; } static QByteArray qEncodeNtlmv2Response(const QAuthenticatorPrivate *ctx, @@ -1228,9 +1238,17 @@ static QByteArray qEncodeNtlmv2Response(const QAuthenticatorPrivate *ctx, ds.writeRawData(reserved1.constData(), reserved1.size()); quint64 time = 0; + QByteArray timeArray; + + if(ch.targetInfo.len) + { + timeArray = qExtractServerTime(ch.targetInfoBuff); + } //if server sends time, use it instead of current time - if(!(ch.targetInfo.len && qExtractServerTime(ch.targetInfoBuff, &time))) { + if(timeArray.size()) { + ds.writeRawData(timeArray.constData(), timeArray.size()); + } else { QDateTime currentTime(QDate::currentDate(), QTime::currentTime(), Qt::UTC); @@ -1242,8 +1260,8 @@ static QByteArray qEncodeNtlmv2Response(const QAuthenticatorPrivate *ctx, // represented as 100 nano seconds time = Q_UINT64_C(time * 10000000); + ds << time; } - ds << time; //8 byte client challenge QByteArray clientCh = clientChallenge(ctx); diff --git a/src/network/kernel/qhostinfo_unix.cpp b/src/network/kernel/qhostinfo_unix.cpp index 3112dd6..9e3da61 100644 --- a/src/network/kernel/qhostinfo_unix.cpp +++ b/src/network/kernel/qhostinfo_unix.cpp @@ -247,7 +247,10 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName) #ifndef QT_NO_IPV6 else if (node->ai_family == AF_INET6) { QHostAddress addr; - addr.setAddress(((sockaddr_in6 *) node->ai_addr)->sin6_addr.s6_addr); + sockaddr_in6 *sa6 = (sockaddr_in6 *) node->ai_addr; + addr.setAddress(sa6->sin6_addr.s6_addr); + if (sa6->sin6_scope_id) + addr.setScopeId(QString::number(sa6->sin6_scope_id)); if (!addresses.contains(addr)) addresses.append(addr); } diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index fe28863..f6bfbac 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -352,10 +352,13 @@ bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress &addr, quint16 memset(&sockAddrIPv6, 0, sizeof(sockAddrIPv6)); sockAddrIPv6.sin6_family = AF_INET6; sockAddrIPv6.sin6_port = htons(port); + + QString scopeid = addr.scopeId(); + bool ok; + sockAddrIPv6.sin6_scope_id = scopeid.toInt(&ok); #ifndef QT_NO_IPV6IFNAME - sockAddrIPv6.sin6_scope_id = ::if_nametoindex(addr.scopeId().toLatin1().data()); -#else - sockAddrIPv6.sin6_scope_id = addr.scopeId().toInt(); + if (!ok) + sockAddrIPv6.sin6_scope_id = ::if_nametoindex(scopeid.toLatin1()); #endif Q_IPV6ADDR ip6 = addr.toIPv6Address(); memcpy(&sockAddrIPv6.sin6_addr.s6_addr, &ip6, sizeof(ip6)); diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp index 8177b4f..477ef45 100644 --- a/src/network/socket/qnativesocketengine_win.cpp +++ b/src/network/socket/qnativesocketengine_win.cpp @@ -207,6 +207,7 @@ static inline void qt_socket_setPortAndAddress(SOCKET socketDescriptor, sockaddr if (address.protocol() == QAbstractSocket::IPv6Protocol) { memset(sockAddrIPv6, 0, sizeof(qt_sockaddr_in6)); sockAddrIPv6->sin6_family = AF_INET6; + sockAddrIPv6->sin6_scope_id = address.scopeId().toInt(); WSAHtons(socketDescriptor, port, &(sockAddrIPv6->sin6_port)); Q_IPV6ADDR tmp = address.toIPv6Address(); memcpy(&(sockAddrIPv6->sin6_addr.qt_s6_addr), &tmp, sizeof(tmp)); diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 91265f3..f18c629 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -1966,6 +1966,11 @@ void QSslConfigurationPrivate::deepCopyDefaultConfiguration(QSslConfigurationPri QMutexLocker locker(&globalData()->mutex); const QSslConfigurationPrivate *global = globalData()->config.constData(); + if (!global) { + ptr = 0; + return; + } + ptr->ref = 1; ptr->peerCertificate = global->peerCertificate; ptr->peerCertificateChain = global->peerCertificateChain; diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 9e69816..c49dba4 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2103,11 +2103,8 @@ void QGLContextPrivate::syncGlState() #ifdef QT_NO_EGL void QGLContextPrivate::swapRegion(const QRegion *) { - static bool firstWarning = true; - if (firstWarning) { - qWarning() << "::swapRegion called but not supported!"; - firstWarning = false; - } + Q_Q(QGLContext); + q->swapBuffers(); } #endif @@ -5262,6 +5259,8 @@ QGLExtensions::Extensions QGLExtensions::currentContextExtensions() glExtensions |= FragmentProgram; if (extensions.match("GL_ARB_fragment_shader")) glExtensions |= FragmentShader; + if (extensions.match("GL_ARB_ES2_compatibility")) + glExtensions |= ES2Compatibility; if (extensions.match("GL_ARB_texture_mirrored_repeat")) glExtensions |= MirroredRepeat; if (extensions.match("GL_EXT_framebuffer_object")) @@ -5282,6 +5281,7 @@ QGLExtensions::Extensions QGLExtensions::currentContextExtensions() glExtensions |= FramebufferObject; glExtensions |= GenerateMipmap; glExtensions |= FragmentShader; + glExtensions |= ES2Compatibility; #endif #if defined(QT_OPENGL_ES_1) if (extensions.match("GL_OES_framebuffer_object")) diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 387c8f7..623eeaf 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -284,7 +284,8 @@ public: DDSTextureCompression = 0x00008000, ETC1TextureCompression = 0x00010000, PVRTCTextureCompression = 0x00020000, - FragmentShader = 0x00040000 + FragmentShader = 0x00040000, + ES2Compatibility = 0x00080000 }; Q_DECLARE_FLAGS(Extensions, Extension) diff --git a/src/opengl/qgl_win.cpp b/src/opengl/qgl_win.cpp index 5ab944a..8eb6177 100644 --- a/src/opengl/qgl_win.cpp +++ b/src/opengl/qgl_win.cpp @@ -1042,7 +1042,7 @@ int QGLContext::choosePixelFormat(void* dummyPfd, HDC pdc) iAttributes[i++] = WGL_DRAW_TO_WINDOW_ARB; iAttributes[i++] = TRUE; iAttributes[i++] = WGL_COLOR_BITS_ARB; - iAttributes[i++] = 32; + iAttributes[i++] = 24; iAttributes[i++] = WGL_DOUBLE_BUFFER_ARB; iAttributes[i++] = d->glFormat.doubleBuffer(); if (d->glFormat.stereo()) { diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index 74382b0..bc1c009 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -97,6 +97,10 @@ QT_BEGIN_NAMESPACE to just features that are present in GLSL/ES, and avoid standard variable names that only work on the desktop. + If the \c{GL_ARB_ES2_compatibility} extension is present, + then the above prefix is not added because the desktop OpenGL + implementation supports precision qualifiers. + \section1 Simple shader example \snippet doc/src/snippets/code/src_opengl_qglshaderprogram.cpp 1 @@ -394,8 +398,10 @@ bool QGLShader::compileSourceCode(const char *source) srclen.append(GLint(headerLen)); } #ifdef QGL_DEFINE_QUALIFIERS - src.append(qualifierDefines); - srclen.append(GLint(sizeof(qualifierDefines) - 1)); + if (!(QGLExtensions::glExtensions() & QGLExtensions::ES2Compatibility)) { + src.append(qualifierDefines); + srclen.append(GLint(sizeof(qualifierDefines) - 1)); + } #endif #ifdef QGL_REDEFINE_HIGHP if (d->shaderType == Fragment) { diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index b86fb78..d602000 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -426,6 +426,20 @@ static void drawTexture(const QRectF &rect, GLuint tex_id, const QSize &texSize, void QGLWindowSurface::beginPaint(const QRegion &) { + if (! context()) + return; + + int clearFlags = 0; + + if (context()->d_func()->workaround_needsFullClearOnEveryFrame) + clearFlags = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT; + else if (context()->format().alpha()) + clearFlags = GL_COLOR_BUFFER_BIT; + + if (clearFlags) { + glClearColor(0.0, 0.0, 0.0, 0.0); + glClear(clearFlags); + } } void QGLWindowSurface::endPaint(const QRegion &rgn) diff --git a/src/plugins/bearer/icd/qnetworksession_impl.cpp b/src/plugins/bearer/icd/qnetworksession_impl.cpp index 3170bf6..8013d30 100644 --- a/src/plugins/bearer/icd/qnetworksession_impl.cpp +++ b/src/plugins/bearer/icd/qnetworksession_impl.cpp @@ -888,12 +888,12 @@ void QNetworkSessionPrivateImpl::close() state = QNetworkSession::Closing; emit stateChanged(state); + // we fake a disconnection, session error is sent + updateState(QNetworkSession::Disconnected); + opened = false; isOpen = false; - // we fake a disconnection, session error is not sent - updateState(QNetworkSession::Disconnected); - icd.disconnect(ICD_CONNECTION_FLAG_APPLICATION_EVENT); startTime = QDateTime(); } else { diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp index 1de4c0f..19f13c2 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp +++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp @@ -48,6 +48,14 @@ #include <stdapis/sys/socket.h> #include <stdapis/net/if.h> +#ifdef SNAP_FUNCTIONALITY_AVAILABLE +#include <cmmanager.h> +#endif + +#if defined(OCC_FUNCTIONALITY_AVAILABLE) && defined(SNAP_FUNCTIONALITY_AVAILABLE) +#include <extendedconnpref.h> +#endif + #ifndef QT_NO_BEARERMANAGEMENT QT_BEGIN_NAMESPACE @@ -102,19 +110,18 @@ QNetworkSessionPrivateImpl::~QNetworkSessionPrivateImpl() // Cancel possible RConnection::Start() Cancel(); iSocketServ.Close(); - - // Close global 'Open C' RConnection - // Clears also possible unsetdefaultif() flags. - setdefaultif(0); - + + // Restore default interface to system default + restoreDefaultIf(); + iConnectionMonitor.Close(); iOpenCLibrary.Close(); #ifdef QT_BEARERMGMT_SYMBIAN_DEBUG - qDebug() << "QNS this : " << QString::number((uint)this) << " - destroyed (and setdefaultif(0))"; + qDebug() << "QNS this : " << QString::number((uint)this) << " - destroyed (and restoreDefaultIf())"; #endif } -void QNetworkSessionPrivateImpl::configurationStateChanged(TUint32 accessPointId, TUint32 connMonId, QNetworkSession::State newState) +void QNetworkSessionPrivateImpl::configurationStateChanged(quint32 accessPointId, quint32 connMonId, QNetworkSession::State newState) { if (iHandleStateNotificationsFromManager) { #ifdef QT_BEARERMGMT_SYMBIAN_DEBUG @@ -171,8 +178,10 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface() return; if (iFirstSync) { - QObject::connect(engine, SIGNAL(configurationStateChanged(TUint32, TUint32, QNetworkSession::State)), - this, SLOT(configurationStateChanged(TUint32, TUint32, QNetworkSession::State))); + QObject::connect(engine, + SIGNAL(configurationStateChanged(quint32,quint32,QNetworkSession::State)), + this, + SLOT(configurationStateChanged(quint32,quint32,QNetworkSession::State))); // Listen to configuration removals, so that in case the configuration // this session is based on is removed, session knows to enter Invalid -state. QObject::connect(engine, SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)), @@ -523,16 +532,9 @@ void QNetworkSessionPrivateImpl::close(bool allowSignals) Cancel(); // closes iConnection iSocketServ.Close(); - - // Close global 'Open C' RConnection. If OpenC supports, - // close the defaultif for good to avoid difficult timing - // and bouncing issues of network going immediately back up - // because of e.g. select() thread etc. - if (iDynamicUnSetdefaultif) { - iDynamicUnSetdefaultif(); - } else { - setdefaultif(0); - } + + // Restore default interface to system default + restoreDefaultIf(); // If UserChoice, go down immediately. If some other configuration, // go down immediately if there is no reports expected from the platform; @@ -910,13 +912,13 @@ QNetworkConfiguration QNetworkSessionPrivateImpl::activeConfiguration(TUint32 ia if (iapId == 0) { _LIT(KSetting, "IAP\\Id"); iConnection.GetIntSetting(KSetting, iapId); -#if defined(OCC_FUNCTIONALITY_AVAILABLE) && defined(SNAP_FUNCTIONALITY_AVAILABLE) +#ifdef SNAP_FUNCTIONALITY_AVAILABLE // Check if this is an Easy WLAN configuration. On Symbian^3 RConnection may report // the used configuration as 'EasyWLAN' IAP ID if someone has just opened the configuration // from WLAN Scan dialog, _and_ that connection is still up. We need to find the // real matching configuration. Function alters the Easy WLAN ID to real IAP ID (only if // easy WLAN): - engine->easyWlanTrueIapId(iapId); + easyWlanTrueIapId(iapId); #endif } @@ -956,7 +958,7 @@ QNetworkConfiguration QNetworkSessionPrivateImpl::activeConfiguration(TUint32 ia } } } else { -#if defined(OCC_FUNCTIONALITY_AVAILABLE) && defined(SNAP_FUNCTIONALITY_AVAILABLE) +#ifdef SNAP_FUNCTIONALITY_AVAILABLE // On Symbian^3 (only, not earlier or Symbian^4) if the SNAP was not reachable, it triggers // user choice type of activity (EasyWLAN). As a result, a new IAP may be created, and // hence if was not found yet. Therefore update configurations and see if there is something new. @@ -1327,7 +1329,7 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint } } } -#if defined(OCC_FUNCTIONALITY_AVAILABLE) && defined(SNAP_FUNCTIONALITY_AVAILABLE) +#ifdef SNAP_FUNCTIONALITY_AVAILABLE // If the retVal is not true here, it means that the status update may apply to an IAP outside of // SNAP (session is based on SNAP but follows IAP outside of it), which may occur on Symbian^3 EasyWlan. if (retVal == false && activeConfig.isValid() && @@ -1457,6 +1459,87 @@ void QNetworkSessionPrivateImpl::handleSymbianConnectionStatusChange(TInt aConne } } +void QNetworkSessionPrivateImpl::restoreDefaultIf() +{ + QNetworkConfigurationPrivatePointer config = engine->defaultConfiguration(); + + QMutexLocker locker(&config->mutex); + + ifreq ifr; + memset(&ifr, 0, sizeof(ifreq)); + + switch (config->type) { + case QNetworkConfiguration::InternetAccessPoint: + strcpy(ifr.ifr_name, config->name.toUtf8().constData()); + break; + case QNetworkConfiguration::ServiceNetwork: + ifr.ifr_ifru.snap_id = toSymbianConfig(config)->numericId; + break; + default: + ; + }; + + setdefaultif(&ifr); +} + +#if defined(SNAP_FUNCTIONALITY_AVAILABLE) +bool QNetworkSessionPrivateImpl::easyWlanTrueIapId(TUint32 &trueIapId) const +{ + RCmManager iCmManager; + TRAPD(err, iCmManager.OpenL()); + if (err != KErrNone) + return false; + + // Check if this is easy wlan id in the first place + if (trueIapId != iCmManager.EasyWlanIdL()) { + iCmManager.Close(); + return false; + } + + iCmManager.Close(); + + // Loop through all connections that connection monitor is aware + // and check for IAPs based on easy WLAN + TRequestStatus status; + TUint connectionCount; + iConnectionMonitor.GetConnectionCount(connectionCount, status); + User::WaitForRequest(status); + TUint connectionId; + TUint subConnectionCount; + TUint apId; + if (status.Int() == KErrNone) { + for (TUint i = 1; i <= connectionCount; i++) { + iConnectionMonitor.GetConnectionInfo(i, connectionId, subConnectionCount); + iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, + KIAPId, apId, status); + User::WaitForRequest(status); + if (apId == trueIapId) { + TBuf<50>easyWlanNetworkName; + iConnectionMonitor.GetStringAttribute(connectionId, 0, KNetworkName, + easyWlanNetworkName, status); + User::WaitForRequest(status); + if (status.Int() != KErrNone) + continue; + + const QString ssid = QString::fromUtf16(easyWlanNetworkName.Ptr(), + easyWlanNetworkName.Length()); + + QNetworkConfigurationPrivatePointer ptr = engine->configurationFromSsid(ssid); + if (ptr) { +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNCM easyWlanTrueIapId(), found true IAP ID: " + << toSymbianConfig(ptr)->numericIdentifier(); +#endif + trueIapId = toSymbianConfig(ptr)->numericIdentifier(); + return true; + } + } + } + } + return false; +} +#endif + ConnectionProgressNotifier::ConnectionProgressNotifier(QNetworkSessionPrivateImpl& owner, RConnection& connection) : CActive(CActive::EPriorityUserInput), iOwner(owner), iConnection(connection) { diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.h b/src/plugins/bearer/symbian/qnetworksession_impl.h index aac9321..51f2e70 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.h +++ b/src/plugins/bearer/symbian/qnetworksession_impl.h @@ -64,9 +64,6 @@ #ifdef SNAP_FUNCTIONALITY_AVAILABLE #include <comms-infras/cs_mobility_apiext.h> #endif -#if defined(OCC_FUNCTIONALITY_AVAILABLE) && defined(SNAP_FUNCTIONALITY_AVAILABLE) - #include <extendedconnpref.h> -#endif QT_BEGIN_NAMESPACE @@ -132,7 +129,8 @@ protected: // From CActive void DoCancel(); private Q_SLOTS: - void configurationStateChanged(TUint32 accessPointId, TUint32 connMonId, QNetworkSession::State newState); + void configurationStateChanged(quint32 accessPointId, quint32 connMonId, + QNetworkSession::State newState); void configurationRemoved(QNetworkConfigurationPrivatePointer config); void configurationAdded(QNetworkConfigurationPrivatePointer config); @@ -143,10 +141,16 @@ private: void handleSymbianConnectionStatusChange(TInt aConnectionStatus, TInt aError, TUint accessPointId = 0); QNetworkConfiguration bestConfigFromSNAP(const QNetworkConfiguration& snapConfig) const; QNetworkConfiguration activeConfiguration(TUint32 iapId = 0) const; + void restoreDefaultIf(); #ifndef QT_NO_NETWORKINTERFACE QNetworkInterface interface(TUint iapId) const; #endif +#if defined(SNAP_FUNCTIONALITY_AVAILABLE) + bool easyWlanTrueIapId(TUint32 &trueIapId) const; +#endif + + private: // data SymbianEngine *engine; diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp index 9593461..2e2b671 100644 --- a/src/plugins/bearer/symbian/symbianengine.cpp +++ b/src/plugins/bearer/symbian/symbianengine.cpp @@ -692,7 +692,7 @@ void SymbianEngine::updateActiveAccessPoints() User::WaitForRequest(status); QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(apId)); QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident); -#if defined(OCC_FUNCTIONALITY_AVAILABLE) && defined(SNAP_FUNCTIONALITY_AVAILABLE) +#ifdef SNAP_FUNCTIONALITY_AVAILABLE if (!ptr) { // If IAP was not found, check if the update was about EasyWLAN ptr = configurationFromEasyWlan(apId, connectionId); @@ -1054,7 +1054,7 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent) QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(apId)); QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident); -#if defined(OCC_FUNCTIONALITY_AVAILABLE) && defined(SNAP_FUNCTIONALITY_AVAILABLE) +#ifdef SNAP_FUNCTIONALITY_AVAILABLE if (!ptr) { // Check if status was regarding EasyWLAN ptr = configurationFromEasyWlan(apId, connectionId); @@ -1079,7 +1079,7 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent) User::WaitForRequest(status); QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(apId)); QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident); -#if defined(OCC_FUNCTIONALITY_AVAILABLE) && defined(SNAP_FUNCTIONALITY_AVAILABLE) +#ifdef SNAP_FUNCTIONALITY_AVAILABLE if (!ptr) { // Check for EasyWLAN ptr = configurationFromEasyWlan(apId, connectionId); @@ -1189,7 +1189,7 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent) User::WaitForRequest(status); QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(apId)); QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident); -#if defined(OCC_FUNCTIONALITY_AVAILABLE) && defined(SNAP_FUNCTIONALITY_AVAILABLE) +#ifdef SNAP_FUNCTIONALITY_AVAILABLE if (!ptr) { // If IAP was not found, check if the update was about EasyWLAN ptr = configurationFromEasyWlan(apId, connectionId); @@ -1210,11 +1210,39 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent) } } -#if defined(OCC_FUNCTIONALITY_AVAILABLE) && defined(SNAP_FUNCTIONALITY_AVAILABLE) +/* + Returns the network configuration that matches the given SSID. +*/ +QNetworkConfigurationPrivatePointer SymbianEngine::configurationFromSsid(const QString &ssid) +{ + QMutexLocker locker(&mutex); + + // Browser through all items and check their name for match + QHash<QString, QNetworkConfigurationPrivatePointer>::ConstIterator i = + accessPointConfigurations.constBegin(); + while (i != accessPointConfigurations.constEnd()) { + QNetworkConfigurationPrivatePointer ptr = i.value(); + + QMutexLocker configLocker(&ptr->mutex); + + if (ptr->name == ssid) { +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNCM EasyWlan uses real SSID: " << ssid; +#endif + return ptr; + } + ++i; + } + + return QNetworkConfigurationPrivatePointer(); +} + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE // Tries to derive configuration from EasyWLAN. // First checks if the interface brought up was EasyWLAN, then derives the real SSID, // and looks up configuration based on that one. -QNetworkConfigurationPrivatePointer SymbianEngine::configurationFromEasyWlan(TUint32 apId, TUint connectionId) +QNetworkConfigurationPrivatePointer SymbianEngine::configurationFromEasyWlan(TUint32 apId, + TUint connectionId) { if (apId == iCmManager.EasyWlanIdL()) { TRequestStatus status; @@ -1223,11 +1251,12 @@ QNetworkConfigurationPrivatePointer SymbianEngine::configurationFromEasyWlan(TUi easyWlanNetworkName, status ); User::WaitForRequest(status); if (status.Int() == KErrNone) { - QString realSSID = QString::fromUtf16(easyWlanNetworkName.Ptr(), easyWlanNetworkName.Length()); + const QString realSSID = QString::fromUtf16(easyWlanNetworkName.Ptr(), + easyWlanNetworkName.Length()); // Browser through all items and check their name for match - QHash<QString, QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> >::const_iterator i = - accessPointConfigurations.constBegin(); + QHash<QString, QNetworkConfigurationPrivatePointer>::ConstIterator i = + accessPointConfigurations.constBegin(); while (i != accessPointConfigurations.constEnd()) { QNetworkConfigurationPrivatePointer ptr = i.value(); @@ -1245,45 +1274,6 @@ QNetworkConfigurationPrivatePointer SymbianEngine::configurationFromEasyWlan(TUi } return QNetworkConfigurationPrivatePointer(); } - -bool SymbianEngine::easyWlanTrueIapId(TUint32& trueIapId) -{ - // Check if this is easy wlan id in the first place - if (trueIapId != iCmManager.EasyWlanIdL()) - return false; - - // Loop through all connections that connection monitor is aware - // and check for IAPs based on easy WLAN - TRequestStatus status; - TUint connectionCount; - iConnectionMonitor.GetConnectionCount(connectionCount, status); - User::WaitForRequest(status); - TUint connectionId; - TUint subConnectionCount; - TUint apId; - if (status.Int() == KErrNone) { - for (TUint i = 1; i <= connectionCount; i++) { - iConnectionMonitor.GetConnectionInfo(i, connectionId, subConnectionCount); - iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, - KIAPId, apId, status); - User::WaitForRequest(status); - if (apId == trueIapId) { - QNetworkConfigurationPrivatePointer ptr = - configurationFromEasyWlan(apId, connectionId); - if (ptr) { -#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG - qDebug() << "QNCM easyWlanTrueIapId(), found true IAP ID: " - << toSymbianConfig(ptr)->numericIdentifier(); -#endif - trueIapId = toSymbianConfig(ptr)->numericIdentifier(); - return true; - } - } - } - } - return false; -} - #endif // Sessions may use this function to report configuration state changes, diff --git a/src/plugins/bearer/symbian/symbianengine.h b/src/plugins/bearer/symbian/symbianengine.h index 1fe6395..7c1076e 100644 --- a/src/plugins/bearer/symbian/symbianengine.h +++ b/src/plugins/bearer/symbian/symbianengine.h @@ -138,10 +138,15 @@ public: QStringList accessPointConfigurationIdentifiers(); + QNetworkConfigurationPrivatePointer configurationFromSsid(const QString &ssid); + + // For QNetworkSessionPrivateImpl to indicate about state changes + void configurationStateChangeReport(TUint32 accessPointId, QNetworkSession::State newState); + Q_SIGNALS: void onlineStateChanged(bool isOnline); - void configurationStateChanged(TUint32 accessPointId, TUint32 connMonId, + void configurationStateChanged(quint32 accessPointId, quint32 connMonId, QNetworkSession::State newState); public Q_SLOTS: @@ -187,12 +192,9 @@ protected: private: // MConnectionMonitorObserver void EventL(const CConnMonEventBase& aEvent); - // For QNetworkSessionPrivate to indicate about state changes - void configurationStateChangeReport(TUint32 accessPointId, - QNetworkSession::State newState); -#ifdef OCC_FUNCTIONALITY_AVAILABLE - QNetworkConfigurationPrivatePointer configurationFromEasyWlan(TUint32 apId, TUint connectionId); - bool easyWlanTrueIapId(TUint32& trueIapId); +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + QNetworkConfigurationPrivatePointer configurationFromEasyWlan(TUint32 apId, + TUint connectionId); #endif private: // Data @@ -212,7 +214,6 @@ private: // Data friend class QNetworkSessionPrivate; friend class AccessPointsAvailabilityScanner; - friend class QNetworkSessionPrivateImpl; #ifdef SNAP_FUNCTIONALITY_AVAILABLE RCmManager iCmManager; diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 8560214..07aced4 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -782,6 +782,8 @@ static JSC::JSValue JSC_HOST_CALL functionQsTranslate(JSC::ExecState*, JSC::JSOb static JSC::JSValue JSC_HOST_CALL functionQsTranslateNoOp(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); static JSC::JSValue JSC_HOST_CALL functionQsTr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); static JSC::JSValue JSC_HOST_CALL functionQsTrNoOp(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +static JSC::JSValue JSC_HOST_CALL functionQsTrId(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +static JSC::JSValue JSC_HOST_CALL functionQsTrIdNoOp(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); JSC::JSValue JSC_HOST_CALL functionQsTranslate(JSC::ExecState *exec, JSC::JSObject*, JSC::JSValue, const JSC::ArgList &args) { @@ -892,6 +894,28 @@ JSC::JSValue JSC_HOST_CALL functionQsTrNoOp(JSC::ExecState *, JSC::JSObject*, JS return args.at(0); } +JSC::JSValue JSC_HOST_CALL functionQsTrId(JSC::ExecState *exec, JSC::JSObject*, JSC::JSValue, const JSC::ArgList &args) +{ + if (args.size() < 1) + return JSC::throwError(exec, JSC::GeneralError, "qsTrId() requires at least one argument"); + if (!args.at(0).isString()) + return JSC::throwError(exec, JSC::TypeError, "qsTrId(): first argument (id) must be a string"); + if ((args.size() > 1) && !args.at(1).isNumber()) + return JSC::throwError(exec, JSC::TypeError, "qsTrId(): second argument (n) must be a number"); + JSC::UString id = args.at(0).toString(exec); + int n = -1; + if (args.size() > 1) + n = args.at(1).toInt32(exec); + return JSC::jsString(exec, qtTrId(QScript::convertToLatin1(id).constData(), n)); +} + +JSC::JSValue JSC_HOST_CALL functionQsTrIdNoOp(JSC::ExecState *, JSC::JSObject*, JSC::JSValue, const JSC::ArgList &args) +{ + if (args.size() < 1) + return JSC::jsUndefined(); + return args.at(0); +} + static JSC::JSValue JSC_HOST_CALL stringProtoFuncArg(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); JSC::JSValue JSC_HOST_CALL stringProtoFuncArg(JSC::ExecState *exec, JSC::JSObject*, JSC::JSValue thisObject, const JSC::ArgList &args) @@ -2602,8 +2626,7 @@ QScriptValue QScriptEngine::evaluate(const QString &program, const QString &file } /*! - \internal - \since 4.6 + \since 4.7 Evaluates the given \a program and returns the result of the evaluation. @@ -3435,6 +3458,8 @@ void QScriptEngine::registerCustomType(int type, MarshalFunction mf, \row \o QT_TR_NOOP() \o QT_TR_NOOP() \row \o qsTranslate() \o QCoreApplication::translate() \row \o QT_TRANSLATE_NOOP() \o QT_TRANSLATE_NOOP() + \row \o qsTrId() (since 4.7) \o qtTrId() + \row \o QT_TRID_NOOP() (since 4.7) \o QT_TRID_NOOP() \endtable \sa {Internationalization with Qt} @@ -3453,6 +3478,8 @@ void QScriptEngine::installTranslatorFunctions(const QScriptValue &object) JSC::asObject(jscObject)->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 2, JSC::Identifier(exec, "QT_TRANSLATE_NOOP"), QScript::functionQsTranslateNoOp)); JSC::asObject(jscObject)->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 3, JSC::Identifier(exec, "qsTr"), QScript::functionQsTr)); JSC::asObject(jscObject)->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 1, JSC::Identifier(exec, "QT_TR_NOOP"), QScript::functionQsTrNoOp)); + JSC::asObject(jscObject)->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 1, JSC::Identifier(exec, "qsTrId"), QScript::functionQsTrId)); + JSC::asObject(jscObject)->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 1, JSC::Identifier(exec, "QT_TRID_NOOP"), QScript::functionQsTrIdNoOp)); glob->stringPrototype()->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 1, JSC::Identifier(exec, "arg"), QScript::stringProtoFuncArg)); } diff --git a/src/script/api/qscriptprogram.cpp b/src/script/api/qscriptprogram.cpp index 02beba4..3857b75 100644 --- a/src/script/api/qscriptprogram.cpp +++ b/src/script/api/qscriptprogram.cpp @@ -32,9 +32,7 @@ QT_BEGIN_NAMESPACE /*! - \internal - - \since 4.6 + \since 4.7 \class QScriptProgram \brief The QScriptProgram class encapsulates a Qt Script program. diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index 9a35ac5..66dabfa 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -2106,7 +2106,7 @@ void QODBCDriverPrivate::checkSqlServer() serverType = QString::fromUtf8((const char *)serverString.constData(), t); #endif isFreeTDSDriver = serverType.contains(QLatin1String("tdsodbc"), Qt::CaseInsensitive); - unicode = isFreeTDSDriver == false; + unicode = unicode && !isFreeTDSDriver; } } diff --git a/src/sql/drivers/psql/qsql_psql.pri b/src/sql/drivers/psql/qsql_psql.pri index 97db4be..6da3540 100644 --- a/src/sql/drivers/psql/qsql_psql.pri +++ b/src/sql/drivers/psql/qsql_psql.pri @@ -2,12 +2,9 @@ HEADERS += $$PWD/qsql_psql.h SOURCES += $$PWD/qsql_psql.cpp unix|win32-g++* { - !static:!isEmpty(QT_LFLAGS_PSQL) { - !contains(QT_CONFIG, system-zlib): QT_LFLAGS_PSQL -= -lz - LIBS *= $$QT_LFLAGS_PSQL - QMAKE_CXXFLAGS *= $$QT_CFLAGS_PSQL - } + LIBS *= $$QT_LFLAGS_PSQL !contains(LIBS, .*pq.*):LIBS += -lpq + QMAKE_CXXFLAGS *= $$QT_CFLAGS_PSQL } else { !contains(LIBS, .*pq.*):LIBS += -llibpq -lws2_32 -ladvapi32 } diff --git a/src/sql/drivers/tds/qsql_tds.pri b/src/sql/drivers/tds/qsql_tds.pri index 037f793..521c06b 100644 --- a/src/sql/drivers/tds/qsql_tds.pri +++ b/src/sql/drivers/tds/qsql_tds.pri @@ -1,8 +1,8 @@ HEADERS += $$PWD/qsql_tds.h SOURCES += $$PWD/qsql_tds.cpp -unix|win32-g++: { - !isEmpty(QT_LFLAGS_TDS):!static:LIBS *= $$QT_LFLAGS_TDS +unix|win32-g++*: { + LIBS *= $$QT_LFLAGS_TDS !contains(LIBS, .*sybdb.*):LIBS += -lsybdb QMAKE_CXXFLAGS *= $$QT_CFLAGS_TDS } else:win32-borland { diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index d545440..bf19a88 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -74,7 +74,7 @@ QT_BEGIN_NAMESPACE static const char *qt_inherit_text = "inherit"; #define QT_INHERIT QLatin1String(qt_inherit_text) -Q_DECL_IMPORT double qstrtod(const char *s00, char const **se, bool *ok); +Q_CORE_EXPORT double qstrtod(const char *s00, char const **se, bool *ok); // ======== duplicated from qcolor_p diff --git a/src/testlib/qbenchmarkmeasurement_p.h b/src/testlib/qbenchmarkmeasurement_p.h index 932852c..20a3bc1 100644 --- a/src/testlib/qbenchmarkmeasurement_p.h +++ b/src/testlib/qbenchmarkmeasurement_p.h @@ -53,7 +53,7 @@ // We mean it. // -#include <QtCore/qdatetime.h> +#include <QtCore/qelapsedtimer.h> #include "3rdparty/cycle_p.h" #include "qbenchmark.h" @@ -87,7 +87,7 @@ public: bool needsWarmupIteration(); QTest::QBenchmarkMetric metricType(); private: - QTime time; + QElapsedTimer time; }; #ifdef HAVE_TICK_COUNTER // defined in 3rdparty/cycle_p.h diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/qtbug12295.qml b/tests/auto/declarative/qdeclarativebehaviors/data/qtbug12295.qml index 804559c..d41add3 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/qtbug12295.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/qtbug12295.qml @@ -11,7 +11,7 @@ Rectangle { width: 100 height: 100 Behavior on x { - NumberAnimation {} + NumberAnimation { duration: 500 } } } } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/deleteLater.qml b/tests/auto/declarative/qdeclarativeecmascript/data/deleteLater.qml new file mode 100644 index 0000000..6d23e5f7 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/deleteLater.qml @@ -0,0 +1,14 @@ +import Qt 4.7 + +QtObject { + id: root + property bool test: false + + Component.onCompleted: { + try { + root.deleteLater() + } catch(e) { + test = true; + } + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/in.qml b/tests/auto/declarative/qdeclarativeecmascript/data/in.qml new file mode 100644 index 0000000..0b5b0ba --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/in.qml @@ -0,0 +1,7 @@ +import Qt 4.7 + +Item { + id: root + property bool test1: "x" in root + property bool test2: !("foo" in root) +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/nonscriptable.qml b/tests/auto/declarative/qdeclarativeecmascript/data/nonscriptable.qml new file mode 100644 index 0000000..024d82e --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/nonscriptable.qml @@ -0,0 +1,19 @@ +import Qt.test 1.0 +import Qt 4.7 + +MyQmlObject { + id: root + + property bool readOk: false; + property bool writeOk: false + + Component.onCompleted: { + readOk = (root.nonscriptable == undefined); + + try { + root.nonscriptable = 10 + } catch (e) { + writeOk = true; + } + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h index 37d6dbd..7d7e3d9 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h @@ -92,6 +92,7 @@ class MyQmlObject : public QObject Q_PROPERTY(QDeclarativeListProperty<QObject> objectListProperty READ objectListProperty CONSTANT) Q_PROPERTY(int resettableProperty READ resettableProperty WRITE setResettableProperty RESET resetProperty) Q_PROPERTY(QRegExp regExp READ regExp WRITE setRegExp) + Q_PROPERTY(int nonscriptable READ nonscriptable WRITE setNonscriptable SCRIPTABLE false); public: MyQmlObject(): m_methodCalled(false), m_methodIntCalled(false), m_object(0), m_value(0), m_resetProperty(13) {} @@ -144,6 +145,10 @@ public: void setRegExp(const QRegExp ®Exp) { m_regExp = regExp; } int console() const { return 11; } + + int nonscriptable() const { return 0; } + void setNonscriptable(int) {} + signals: void basicSignal(); void argumentSignal(int a, QString b, qreal c); diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index a6d2dac..76ca964 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -157,6 +157,9 @@ private slots: void qtbug_10696(); void qtbug_11606(); void qtbug_11600(); + void nonscriptable(); + void deleteLater(); + void in(); void include(); @@ -2530,6 +2533,36 @@ void tst_qdeclarativeecmascript::qtbug_11600() delete o; } +// Reading and writing non-scriptable properties should fail +void tst_qdeclarativeecmascript::nonscriptable() +{ + QDeclarativeComponent component(&engine, TEST_FILE("nonscriptable.qml")); + QObject *o = component.create(); + QVERIFY(o != 0); + QCOMPARE(o->property("readOk").toBool(), true); + QCOMPARE(o->property("writeOk").toBool(), true); + delete o; +} + +// deleteLater() should not be callable from QML +void tst_qdeclarativeecmascript::deleteLater() +{ + QDeclarativeComponent component(&engine, TEST_FILE("deleteLater.qml")); + QObject *o = component.create(); + QVERIFY(o != 0); + QCOMPARE(o->property("test").toBool(), true); + delete o; +} + +void tst_qdeclarativeecmascript::in() +{ + QDeclarativeComponent component(&engine, TEST_FILE("in.qml")); + QObject *o = component.create(); + QVERIFY(o != 0); + QCOMPARE(o->property("test1").toBool(), true); + QCOMPARE(o->property("test2").toBool(), true); + delete o; +} QTEST_MAIN(tst_qdeclarativeecmascript) diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index 896d69e..d4d8bf6 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -655,6 +655,15 @@ void tst_QDeclarativeGridView::currentIndex() gridview->setFlow(QDeclarativeGridView::TopToBottom); + qApp->setActiveWindow(canvas); +#ifdef Q_WS_X11 + // to be safe and avoid failing setFocus with window managers + qt_x11_wait_for_window_manager(canvas); +#endif + QTRY_VERIFY(canvas->hasFocus()); + QTRY_VERIFY(canvas->scene()->hasFocus()); + qApp->processEvents(); + QTest::keyClick(canvas, Qt::Key_Right); QCOMPARE(gridview->currentIndex(), 5); diff --git a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp index 6d5a357..d0afc8a 100644 --- a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp +++ b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp @@ -389,6 +389,7 @@ void tst_qdeclarativeimageprovider::threadTest() } provider->ok = true; provider->cond.wakeAll(); + QTest::qWait(250); foreach(QDeclarativeImage *img, images) { TRY_WAIT(img->status() == QDeclarativeImage::Ready); } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/DontDoubleCallClassBeginItem.qml b/tests/auto/declarative/qdeclarativelanguage/data/DontDoubleCallClassBeginItem.qml new file mode 100644 index 0000000..1f8eac8 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/DontDoubleCallClassBeginItem.qml @@ -0,0 +1,4 @@ +import Test 1.0 + +MyParserStatus { +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/dontDoubleCallClassBegin.qml b/tests/auto/declarative/qdeclarativelanguage/data/dontDoubleCallClassBegin.qml new file mode 100644 index 0000000..df048cc --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/dontDoubleCallClassBegin.qml @@ -0,0 +1,5 @@ +import Qt 4.7 + +Item { + property QtObject object: DontDoubleCallClassBeginItem {} +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.7.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.7.errors.txt new file mode 100644 index 0000000..93652a7 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.7.errors.txt @@ -0,0 +1 @@ +5:23:Invalid alias location diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.7.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.7.qml new file mode 100644 index 0000000..2a09648 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.7.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + id: root + property alias a: root.nonScriptable +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.errors.txt index 6e11786..53e752b 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.errors.txt @@ -1,2 +1,2 @@ -4:5:Unable to create type NestedErrorsType +4:5:Type NestedErrorsType unavailable 4:8:Invalid property assignment: number expected diff --git a/tests/auto/declarative/qdeclarativelanguage/data/nonScriptableProperty.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/nonScriptableProperty.errors.txt new file mode 100644 index 0000000..cdfa4b2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/nonScriptableProperty.errors.txt @@ -0,0 +1 @@ +4:5:Cannot assign to non-existent property "nonScriptable" diff --git a/tests/auto/declarative/qdeclarativelanguage/data/nonScriptableProperty.qml b/tests/auto/declarative/qdeclarativelanguage/data/nonScriptableProperty.qml new file mode 100644 index 0000000..bd59bc8 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/nonScriptableProperty.qml @@ -0,0 +1,5 @@ +import Test 1.0 + +MyQmlObject { + nonScriptable: 11 +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/variantNotify.qml b/tests/auto/declarative/qdeclarativelanguage/data/variantNotify.qml new file mode 100644 index 0000000..e7aaf16 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/variantNotify.qml @@ -0,0 +1,13 @@ +import Qt 4.7 + +QtObject { + property int notifyCount: 0 + + property variant foo + onFooChanged: notifyCount++ + + Component.onCompleted: { + foo = 1; + foo = 1; + } +} diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp b/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp index 5d87404..20cd976 100644 --- a/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp @@ -50,6 +50,7 @@ void registerTypes() qmlRegisterType<MyDotPropertyObject>("Test",1,0,"MyDotPropertyObject"); qmlRegisterType<MyNamespace::MyNamespacedType>("Test",1,0,"MyNamespacedType"); qmlRegisterType<MyNamespace::MySecondNamespacedType>("Test",1,0,"MySecondNamespacedType"); + qmlRegisterType<MyParserStatus>("Test",1,0,"MyParserStatus"); qmlRegisterType<MyGroupedObject>(); qmlRegisterCustomType<MyCustomParserType>("Test", 1, 0, "MyCustomParserType", new MyCustomParserTypeParser); diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.h b/tests/auto/declarative/qdeclarativelanguage/testtypes.h index acbe219..ac55bae 100644 --- a/tests/auto/declarative/qdeclarativelanguage/testtypes.h +++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.h @@ -112,6 +112,7 @@ class MyQmlObject : public QObject, public MyInterface Q_PROPERTY(MyCustomVariantType customType READ customType WRITE setCustomType) Q_PROPERTY(MyQmlObject *qmlobjectProperty READ qmlobject WRITE setQmlobject) Q_PROPERTY(int propertyWithNotify READ propertyWithNotify WRITE setPropertyWithNotify NOTIFY oddlyNamedNotifySignal) + Q_PROPERTY(int nonScriptable READ nonScriptable WRITE setNonScriptable SCRIPTABLE false); Q_INTERFACES(MyInterface) public: @@ -150,6 +151,9 @@ public: int propertyWithNotify() const { return m_propertyWithNotify; } void setPropertyWithNotify(int i) { m_propertyWithNotify = i; emit oddlyNamedNotifySignal(); } + + int nonScriptable() const { return 0; } + void setNonScriptable(int) {} public slots: void basicSlot() { qWarning("MyQmlObject::basicSlot"); } void basicSlotWithArgs(int v) { qWarning("MyQmlObject::basicSlotWithArgs(%d)", v); } @@ -170,7 +174,6 @@ private: QML_DECLARE_TYPE(MyQmlObject) QML_DECLARE_TYPEINFO(MyQmlObject, QML_HAS_ATTACHED_PROPERTIES) - class MyGroupedObject : public QObject { Q_OBJECT @@ -576,6 +579,22 @@ public: void setCustomData(QObject *, const QByteArray &) {} }; +class MyParserStatus : public QObject, public QDeclarativeParserStatus +{ + Q_OBJECT +public: + MyParserStatus() : m_cbc(0), m_ccc(0) {} + + int classBeginCount() const { return m_cbc; } + int componentCompleteCount() const { return m_ccc; } + + virtual void classBegin() { m_cbc++; } + virtual void componentComplete() { m_ccc++; } +private: + int m_cbc; + int m_ccc; +}; + void registerTypes(); #endif // TESTTYPES_H diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index fcdf926..dc00e16 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -126,6 +126,7 @@ private slots: void scriptString(); void defaultPropertyListOrder(); void declaredPropertyValues(); + void dontDoubleCallClassBegin(); void basicRemote_data(); void basicRemote(); @@ -141,8 +142,8 @@ private slots: void importsOrder(); void qmlAttachedPropertiesObjectMethod(); - void customOnProperty(); + void variantNotify(); // regression tests for crashes void crash1(); @@ -342,6 +343,7 @@ void tst_qdeclarativelanguage::errors_data() QTest::newRow("invalidAlias.4") << "invalidAlias.4.qml" << "invalidAlias.4.errors.txt" << false; QTest::newRow("invalidAlias.5") << "invalidAlias.5.qml" << "invalidAlias.5.errors.txt" << false; QTest::newRow("invalidAlias.6") << "invalidAlias.6.qml" << "invalidAlias.6.errors.txt" << false; + QTest::newRow("invalidAlias.7") << "invalidAlias.7.qml" << "invalidAlias.7.errors.txt" << false; QTest::newRow("invalidAttachedProperty.1") << "invalidAttachedProperty.1.qml" << "invalidAttachedProperty.1.errors.txt" << false; QTest::newRow("invalidAttachedProperty.2") << "invalidAttachedProperty.2.qml" << "invalidAttachedProperty.2.errors.txt" << false; @@ -372,6 +374,7 @@ void tst_qdeclarativelanguage::errors_data() QTest::newRow("assignToNamespace") << "assignToNamespace.qml" << "assignToNamespace.errors.txt" << false; QTest::newRow("invalidOn") << "invalidOn.qml" << "invalidOn.errors.txt" << false; QTest::newRow("invalidProperty") << "invalidProperty.qml" << "invalidProperty.errors.txt" << false; + QTest::newRow("nonScriptableProperty") << "nonScriptableProperty.qml" << "nonScriptableProperty.errors.txt" << false; } @@ -1192,6 +1195,20 @@ void tst_qdeclarativelanguage::declaredPropertyValues() VERIFY_ERRORS(0); } +void tst_qdeclarativelanguage::dontDoubleCallClassBegin() +{ + QDeclarativeComponent component(&engine, TEST_FILE("dontDoubleCallClassBegin.qml")); + QObject *o = component.create(); + QVERIFY(o); + + MyParserStatus *o2 = qobject_cast<MyParserStatus *>(qvariant_cast<QObject *>(o->property("object"))); + QVERIFY(o2); + QCOMPARE(o2->classBeginCount(), 1); + QCOMPARE(o2->componentCompleteCount(), 1); + + delete o; +} + // Check that first child of qml is of given type. Empty type insists on error. void tst_qdeclarativelanguage::testType(const QString& qml, const QString& type, const QString& expectederror) { @@ -1668,6 +1685,20 @@ void tst_qdeclarativelanguage::customOnProperty() delete object; } +// QTBUG-12601 +void tst_qdeclarativelanguage::variantNotify() +{ + QDeclarativeComponent component(&engine, TEST_FILE("variantNotify.qml")); + + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("notifyCount").toInt(), 1); + + delete object; +} + void tst_qdeclarativelanguage::initTestCase() { registerTypes(); diff --git a/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml b/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml index 3b2db5e..d5d3365 100644 --- a/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml +++ b/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml @@ -4,6 +4,12 @@ Rectangle { width: 240 height: 320 color: "#ffffff" + + property real hr: list.visibleArea.heightRatio + function heightRatio() { + return list.visibleArea.heightRatio + } + function checkProperties() { testObject.error = false; if (list.model != testModel) { diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index bf4754d..377a9e5 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -98,6 +98,7 @@ private slots: void manualHighlight(); void QTBUG_11105(); void footer(); + void resizeView(); private: template <class T> void items(); @@ -1591,6 +1592,48 @@ void tst_QDeclarativeListView::footer() QTRY_COMPARE(footer->y(), 0.0); } +void tst_QDeclarativeListView::resizeView() +{ + QDeclarativeView *canvas = createView(); + + TestModel model; + for (int i = 0; i < 40; i++) + model.addItem("Item" + QString::number(i), ""); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + TestObject *testObject = new TestObject; + ctxt->setContextProperty("testObject", testObject); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml")); + qApp->processEvents(); + + QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); + QTRY_VERIFY(listview != 0); + + QDeclarativeItem *contentItem = listview->contentItem(); + QTRY_VERIFY(contentItem != 0); + + // Confirm items positioned correctly + int itemCount = findItems<QDeclarativeItem>(contentItem, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(contentItem, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(), i*20.); + } + + QVariant heightRatio; + QMetaObject::invokeMethod(canvas->rootObject(), "heightRatio", Q_RETURN_ARG(QVariant, heightRatio)); + QCOMPARE(heightRatio.toReal(), 0.4); + + listview->setHeight(200); + + QMetaObject::invokeMethod(canvas->rootObject(), "heightRatio", Q_RETURN_ARG(QVariant, heightRatio)); + QCOMPARE(heightRatio.toReal(), 0.25); +} + void tst_QDeclarativeListView::qListModelInterface_items() { items<TestModel>(); diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp index b0b7a3b..3baf848 100644 --- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp +++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp @@ -146,7 +146,7 @@ void tst_QDeclarativeLoader::component() void tst_QDeclarativeLoader::invalidUrl() { - QTest::ignoreMessage(QtWarningMsg, QString("<Unknown File>: File error for URL " + QUrl::fromLocalFile(SRCDIR "/data/IDontExist.qml").toString()).toUtf8().constData()); + QTest::ignoreMessage(QtWarningMsg, QString(QUrl::fromLocalFile(SRCDIR "/data/IDontExist.qml").toString() + ": File not found").toUtf8().constData()); QDeclarativeComponent component(&engine); component.setData(QByteArray("import Qt 4.7\nLoader { source: \"IDontExist.qml\" }"), TEST_FILE("")); @@ -508,7 +508,7 @@ void tst_QDeclarativeLoader::failNetworkRequest() QVERIFY(server.isValid()); server.serveDirectory(SRCDIR "/data"); - QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: Network error for URL http://127.0.0.1:14450/IDontExist.qml"); + QTest::ignoreMessage(QtWarningMsg, "http://127.0.0.1:14450/IDontExist.qml: File not found"); QDeclarativeComponent component(&engine); component.setData(QByteArray("import Qt 4.7\nLoader { property int did_load: 123; source: \"http://127.0.0.1:14450/IDontExist.qml\"; onLoaded: did_load=456 }"), QUrl::fromLocalFile("http://127.0.0.1:14450/dummy.qml")); diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 56a3121..84f4230 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -777,7 +777,7 @@ void tst_qdeclarativetextedit::delegateLoading_data() // import installed QTest::newRow("pass") << "cursorHttpTestPass.qml" << ""; - QTest::newRow("fail1") << "cursorHttpTestFail1.qml" << "<Unknown File>: Network error for URL http://localhost:42332/FailItem.qml "; + QTest::newRow("fail1") << "cursorHttpTestFail1.qml" << "http://localhost:42332/FailItem.qml: Remote host closed the connection "; QTest::newRow("fail2") << "cursorHttpTestFail2.qml" << "http://localhost:42332/ErrItem.qml:4:5: Fungus is not a type "; } diff --git a/tests/auto/declarative/qdeclarativevisualdatamodel/data/datalist.qml b/tests/auto/declarative/qdeclarativevisualdatamodel/data/datalist.qml index a798f77..c5e945a 100644 --- a/tests/auto/declarative/qdeclarativevisualdatamodel/data/datalist.qml +++ b/tests/auto/declarative/qdeclarativevisualdatamodel/data/datalist.qml @@ -4,12 +4,16 @@ ListView { width: 100 height: 100 anchors.fill: parent - model: myModel - delegate: Component { - Rectangle { - height: 25 - width: 100 - Text { objectName: "display"; text: display } + model: VisualDataModel { + id: visualModel + objectName: "visualModel" + model: myModel + delegate: Component { + Rectangle { + height: 25 + width: 100 + Text { objectName: "display"; text: display } + } } } } diff --git a/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp b/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp index 3cd786f..95ef4fc 100644 --- a/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp +++ b/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp @@ -84,6 +84,7 @@ public: private slots: void rootIndex(); void updateLayout(); + void childChanged(); void objectListModel(); private: @@ -174,22 +175,82 @@ void tst_qdeclarativevisualdatamodel::updateLayout() QVERIFY(contentItem != 0); QDeclarativeText *name = findItem<QDeclarativeText>(contentItem, "display", 0); + QVERIFY(name); QCOMPARE(name->text(), QString("Row 1 Item")); name = findItem<QDeclarativeText>(contentItem, "display", 1); + QVERIFY(name); QCOMPARE(name->text(), QString("Row 2 Item")); name = findItem<QDeclarativeText>(contentItem, "display", 2); + QVERIFY(name); QCOMPARE(name->text(), QString("Row 3 Item")); model.invisibleRootItem()->sortChildren(0, Qt::DescendingOrder); name = findItem<QDeclarativeText>(contentItem, "display", 0); + QVERIFY(name); QCOMPARE(name->text(), QString("Row 3 Item")); name = findItem<QDeclarativeText>(contentItem, "display", 1); + QVERIFY(name); QCOMPARE(name->text(), QString("Row 2 Item")); name = findItem<QDeclarativeText>(contentItem, "display", 2); + QVERIFY(name); QCOMPARE(name->text(), QString("Row 1 Item")); } +void tst_qdeclarativevisualdatamodel::childChanged() +{ + QDeclarativeView view; + + QStandardItemModel model; + initStandardTreeModel(&model); + + view.rootContext()->setContextProperty("myModel", &model); + + view.setSource(QUrl::fromLocalFile(SRCDIR "/data/datalist.qml")); + + QDeclarativeListView *listview = qobject_cast<QDeclarativeListView*>(view.rootObject()); + QVERIFY(listview != 0); + + QDeclarativeItem *contentItem = listview->contentItem(); + QVERIFY(contentItem != 0); + + QDeclarativeVisualDataModel *vdm = listview->findChild<QDeclarativeVisualDataModel*>("visualModel"); + vdm->setRootIndex(QVariant::fromValue(model.indexFromItem(model.item(1,0)))); + + QDeclarativeText *name = findItem<QDeclarativeText>(contentItem, "display", 0); + QVERIFY(name); + QCOMPARE(name->text(), QString("Row 2 Child Item")); + + model.item(1,0)->child(0,0)->setText("Row 2 updated child"); + + name = findItem<QDeclarativeText>(contentItem, "display", 0); + QVERIFY(name); + QCOMPARE(name->text(), QString("Row 2 updated child")); + + model.item(1,0)->appendRow(new QStandardItem(QLatin1String("Row 2 Child Item 2"))); + QTest::qWait(300); + + name = findItem<QDeclarativeText>(contentItem, "display", 1); + QVERIFY(name != 0); + QCOMPARE(name->text(), QString("Row 2 Child Item 2")); + + model.item(1,0)->takeRow(1); + name = findItem<QDeclarativeText>(contentItem, "display", 1); + QVERIFY(name == 0); + + vdm->setRootIndex(QVariant::fromValue(QModelIndex())); + QTest::qWait(300); + name = findItem<QDeclarativeText>(contentItem, "display", 0); + QVERIFY(name); + QCOMPARE(name->text(), QString("Row 1 Item")); + name = findItem<QDeclarativeText>(contentItem, "display", 1); + QVERIFY(name); + QCOMPARE(name->text(), QString("Row 2 Item")); + name = findItem<QDeclarativeText>(contentItem, "display", 2); + QVERIFY(name); + QCOMPARE(name->text(), QString("Row 3 Item")); +} + void tst_qdeclarativevisualdatamodel::objectListModel() { QDeclarativeView view; diff --git a/tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp b/tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp index 8ba9d45..0f6d531 100644 --- a/tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp +++ b/tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp @@ -558,7 +558,7 @@ void tst_QMetaObjectBuilder::property() QVERIFY(prop1.isWritable()); QVERIFY(!prop1.isResettable()); QVERIFY(!prop1.isDesignable()); - QVERIFY(!prop1.isScriptable()); + QVERIFY(prop1.isScriptable()); QVERIFY(!prop1.isStored()); QVERIFY(!prop1.isEditable()); QVERIFY(!prop1.isUser()); @@ -577,7 +577,7 @@ void tst_QMetaObjectBuilder::property() QVERIFY(prop2.isWritable()); QVERIFY(!prop2.isResettable()); QVERIFY(!prop2.isDesignable()); - QVERIFY(!prop2.isScriptable()); + QVERIFY(prop2.isScriptable()); QVERIFY(!prop2.isStored()); QVERIFY(!prop2.isEditable()); QVERIFY(!prop2.isUser()); @@ -599,7 +599,7 @@ void tst_QMetaObjectBuilder::property() prop1.setWritable(false); prop1.setResettable(true); prop1.setDesignable(true); - prop1.setScriptable(true); + prop1.setScriptable(false); prop1.setStored(true); prop1.setEditable(true); prop1.setUser(true); @@ -614,7 +614,7 @@ void tst_QMetaObjectBuilder::property() QVERIFY(!prop1.isWritable()); QVERIFY(prop1.isResettable()); QVERIFY(prop1.isDesignable()); - QVERIFY(prop1.isScriptable()); + QVERIFY(!prop1.isScriptable()); QVERIFY(prop1.isStored()); QVERIFY(prop1.isEditable()); QVERIFY(prop1.isUser()); @@ -627,7 +627,7 @@ void tst_QMetaObjectBuilder::property() QCOMPARE(prop2.type(), QByteArray("int")); QVERIFY(!prop2.isResettable()); QVERIFY(!prop2.isDesignable()); - QVERIFY(!prop2.isScriptable()); + QVERIFY(prop2.isScriptable()); QVERIFY(!prop2.isStored()); QVERIFY(!prop2.isEditable()); QVERIFY(!prop2.isUser()); @@ -643,7 +643,7 @@ void tst_QMetaObjectBuilder::property() QCOMPARE(prop2.type(), QByteArray("int")); QVERIFY(!prop2.isResettable()); QVERIFY(!prop2.isDesignable()); - QVERIFY(!prop2.isScriptable()); + QVERIFY(prop2.isScriptable()); QVERIFY(!prop2.isStored()); QVERIFY(!prop2.isEditable()); QVERIFY(!prop2.isUser()); diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index a968520..ddc3939 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -395,7 +395,12 @@ void tst_Gestures::customGesture() { GestureWidget widget; widget.grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); + widget.show(); + QTest::qWaitForWindowShown(&widget); + CustomEvent event; + event.hotSpot = widget.mapToGlobal(QPoint(5,5)); + event.hasHotSpot = true; sendCustomGesture(&event, &widget); static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; diff --git a/tests/auto/headers/tst_headers.cpp b/tests/auto/headers/tst_headers.cpp index 06c70f9..7ccf058 100644 --- a/tests/auto/headers/tst_headers.cpp +++ b/tests/auto/headers/tst_headers.cpp @@ -213,7 +213,8 @@ void tst_Headers::licenseCheck() return; if (content.first().contains("generated")) { - content.takeFirst(); + // don't scan generated files + return; } if (sourceFile.endsWith("/tests/auto/linguist/lupdate/testdata/good/merge_ordering/foo.cpp") diff --git a/tests/auto/linguist/lconvert/data/test-refs.po b/tests/auto/linguist/lconvert/data/test-refs.po new file mode 100644 index 0000000..e149a38 --- /dev/null +++ b/tests/auto/linguist/lconvert/data/test-refs.po @@ -0,0 +1,23 @@ +msgid "" +msgstr "" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Language: de_DE\n" + +#: themer/kdmlabel.cpp:285 +#, no-c-format +msgctxt "date format" +msgid "%a %d %B" +msgstr "%a %d %B" + +#: foo.bar.baz +#, no-c-format +msgid "full java class name" +msgstr "" + +#: foo.car:123 monks:here file/gar.c:17:19 no:monks:here +#, no-c-format +msgid "some excessive locations" +msgstr "" diff --git a/tests/auto/linguist/lconvert/data/test20.ts b/tests/auto/linguist/lconvert/data/test20.ts index f042edf..0e38b4b 100644 --- a/tests/auto/linguist/lconvert/data/test20.ts +++ b/tests/auto/linguist/lconvert/data/test20.ts @@ -158,5 +158,14 @@ <comment>comment with | and ~ and so~</comment> <translation type="unfinished"></translation> </message> + <message> + <source>just something obsolete</source> + <translation type="obsolete">translated obsoletion</translation> + </message> + <message> + <source>something else obsolete</source> + <comment>comment with | and ~ and so~</comment> + <translation type="obsolete">another translated obsoletion</translation> + </message> </context> </TS> diff --git a/tests/auto/linguist/lconvert/tst_lconvert.cpp b/tests/auto/linguist/lconvert/tst_lconvert.cpp index 998f588..a3c29d8 100644 --- a/tests/auto/linguist/lconvert/tst_lconvert.cpp +++ b/tests/auto/linguist/lconvert/tst_lconvert.cpp @@ -317,6 +317,8 @@ void tst_lconvert::roundtrips_data() QTest::newRow("po-xliff-po (plural-2)") << "plural-2.po" << poXlfPo << noArgs; QTest::newRow("po-xliff-po (plural-3)") << "plural-3.po" << poXlfPo << noArgs; + QTest::newRow("po-ts-po (references)") << "test-refs.po" << poTsPo << noArgs; + QTest::newRow("ts20-ts11-ts20 (utf8)") << "codec-utf8.ts" << tsTs11Ts << noArgs; QTest::newRow("ts20-ts11-ts20 (cp1252)") << "codec-cp1252.ts" << tsTs11Ts << noArgs; QTest::newRow("ts20-ts11-ts20 (dual-encoding)") << "dual-encoding.ts" << tsTs11Ts << noArgs; diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejs/main.js b/tests/auto/linguist/lupdate/testdata/good/parsejs/main.js new file mode 100644 index 0000000..9f61cea --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsejs/main.js @@ -0,0 +1,91 @@ +qsTr("One"); +qsTranslate("FooContext", "Two"); + +var greeting_strings = [ + QT_TR_NOOP("Hello"), + QT_TRANSLATE_NOOP("FooContext", "Goodbye") +]; + +qsTr("One", "not the same one"); + +//: My first comment. +qsTr("See comment"); + +//: My second comment. +qsTranslate("BarContext", "See other comment"); + +//: My third comment +//: spans two lines. +qsTr("The comment explains it all"); + +//: My fourth comment +//: spans a whopping +//: three lines. +qsTranslate("BazContext", "It should be clear by now"); + +/*: C-style comment. */ +qsTr("I love C++"); + +/*: Another C-style comment. */ +qsTranslate("FooContext", "I really love C++"); + +/*: C-style comment, followed by */ +/*: another one. */ +qsTr("Qt is the best"); + +/*: Another C-style comment, followed by */ +/*: yet another one. */ +qsTranslate("BarContext", "Qt is the very best"); + +// This comment doesn't have any effect. +qsTr("The comment had no effect"); + +// This comment doesn't have any effect either. +qsTranslate("BazContext", "The comment had no effect, really"); + +/* This C-style comment doesn't have any effect. */ +qsTr("No comment to your comment"); + +/* This C-style comment doesn't have any effect either. */ +qsTranslate("FooContext", "I refuse to comment on that"); + +//= id_foo +qsTr("This string has an identifier"); + +//= id_bar +qsTranslate("BarContext", "This string also has an identifier"); + +//~ loc-blank False +qsTr("This string has meta-data"); + +//~ loc-layout_id foo_dialog +qsTranslate("BazContext", "This string also has meta-data"); + +// This comment is to be ignored. +//: This is a comment for the translator. +//= id_baz +//~ foo 123 +//~ magic-stuff This means something special. +qsTr("This string has a lot of information"); + +// This comment is also to be ignored. +//: This is another comment for the translator. +//= id_babar +//~ foo-bar Important stuff +//~ needle-in-haystack Found +//~ overflow True +qsTranslate("FooContext", "This string has even more information"); + +qsTr("This string has disambiguation", "Disambiguation"); + +qsTranslate("BarContext", "This string also has disambiguation", "Another disambiguation"); + +qsTr("This string contains plurals", "", 10); + +qsTrId("qtn_foo_bar"); + +var more_greeting_strings = [ QT_TRID_NOOP("qtn_needle"), QT_TRID_NOOP("qtn_haystack") ]; + +//: qsTrId() with comment, meta-data and plurals. +//~ well-tested True +qsTrId("qtn_bar_baz", 10); diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejs/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsejs/project.pro new file mode 100644 index 0000000..d549039 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsejs/project.pro @@ -0,0 +1,3 @@ +SOURCES += main.js + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejs/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsejs/project.ts.result new file mode 100644 index 0000000..d03c713 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsejs/project.ts.result @@ -0,0 +1,195 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name></name> + <message id="qtn_foo_bar"> + <location filename="main.js" line="85"/> + <source></source> + <translation type="unfinished"></translation> + </message> + <message id="qtn_needle"> + <location filename="main.js" line="87"/> + <source></source> + <translation type="unfinished"></translation> + </message> + <message id="qtn_haystack"> + <location filename="main.js" line="87"/> + <source></source> + <translation type="unfinished"></translation> + </message> + <message id="qtn_bar_baz" numerus="yes"> + <location filename="main.js" line="91"/> + <source></source> + <extracomment>qsTrId() with comment, meta-data and plurals.</extracomment> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + <extra-well-tested>True</extra-well-tested> + </message> +</context> +<context> + <name>BarContext</name> + <message> + <location filename="main.js" line="15"/> + <source>See other comment</source> + <extracomment>My second comment.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.js" line="38"/> + <source>Qt is the very best</source> + <extracomment>Another C-style comment, followed by yet another one.</extracomment> + <translation type="unfinished"></translation> + </message> + <message id="id_bar"> + <location filename="main.js" line="56"/> + <source>This string also has an identifier</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.js" line="81"/> + <source>This string also has disambiguation</source> + <comment>Another disambiguation</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>BazContext</name> + <message> + <location filename="main.js" line="24"/> + <source>It should be clear by now</source> + <extracomment>My fourth comment spans a whopping three lines.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.js" line="44"/> + <source>The comment had no effect, really</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.js" line="62"/> + <source>This string also has meta-data</source> + <translation type="unfinished"></translation> + <extra-loc-layout_id>foo_dialog</extra-loc-layout_id> + </message> +</context> +<context> + <name>FooContext</name> + <message> + <location filename="main.js" line="2"/> + <source>Two</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.js" line="6"/> + <source>Goodbye</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.js" line="30"/> + <source>I really love C++</source> + <extracomment>Another C-style comment.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.js" line="50"/> + <source>I refuse to comment on that</source> + <translation type="unfinished"></translation> + </message> + <message id="id_babar"> + <location filename="main.js" line="77"/> + <source>This string has even more information</source> + <extracomment>This is another comment for the translator.</extracomment> + <translation type="unfinished"></translation> + <extra-needle-in-haystack>Found</extra-needle-in-haystack> + <extra-overflow>True</extra-overflow> + <extra-foo-bar>Important stuff</extra-foo-bar> + </message> +</context> +<context> + <name>main</name> + <message> + <location filename="main.js" line="1"/> + <source>One</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.js" line="5"/> + <source>Hello</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.js" line="9"/> + <source>One</source> + <comment>not the same one</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.js" line="12"/> + <source>See comment</source> + <extracomment>My first comment.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.js" line="19"/> + <source>The comment explains it all</source> + <extracomment>My third comment spans two lines.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.js" line="27"/> + <source>I love C++</source> + <extracomment>C-style comment.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.js" line="34"/> + <source>Qt is the best</source> + <extracomment>C-style comment, followed by another one.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.js" line="41"/> + <source>The comment had no effect</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.js" line="47"/> + <source>No comment to your comment</source> + <translation type="unfinished"></translation> + </message> + <message id="id_foo"> + <location filename="main.js" line="53"/> + <source>This string has an identifier</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.js" line="59"/> + <source>This string has meta-data</source> + <translation type="unfinished"></translation> + <extra-loc-blank>False</extra-loc-blank> + </message> + <message id="id_baz"> + <location filename="main.js" line="69"/> + <source>This string has a lot of information</source> + <extracomment>This is a comment for the translator.</extracomment> + <translation type="unfinished"></translation> + <extra-foo>123</extra-foo> + <extra-magic-stuff>This means something special.</extra-magic-stuff> + </message> + <message> + <location filename="main.js" line="79"/> + <source>This string has disambiguation</source> + <comment>Disambiguation</comment> + <translation type="unfinished"></translation> + </message> + <message numerus="yes"> + <location filename="main.js" line="83"/> + <source>This string contains plurals</source> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejs2/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/parsejs2/expectedoutput.txt new file mode 100644 index 0000000..d6c977f --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsejs2/expectedoutput.txt @@ -0,0 +1,29 @@ +.*/lupdate/testdata/good/parsejs2/main.js:3: qsTranslate\(\) requires at least two arguments. +.*/lupdate/testdata/good/parsejs2/main.js:4: qsTranslate\(\) requires at least two arguments. +.*/lupdate/testdata/good/parsejs2/main.js:5: qsTranslate\(\): both arguments must be literal strings. +.*/lupdate/testdata/good/parsejs2/main.js:6: qsTranslate\(\): both arguments must be literal strings. +.*/lupdate/testdata/good/parsejs2/main.js:7: qsTranslate\(\): both arguments must be literal strings. +.*/lupdate/testdata/good/parsejs2/main.js:9: QT_TRANSLATE_NOOP\(\) requires at least two arguments. +.*/lupdate/testdata/good/parsejs2/main.js:10: QT_TRANSLATE_NOOP\(\) requires at least two arguments. +.*/lupdate/testdata/good/parsejs2/main.js:11: QT_TRANSLATE_NOOP\(\): both arguments must be literal strings. +.*/lupdate/testdata/good/parsejs2/main.js:12: QT_TRANSLATE_NOOP\(\): both arguments must be literal strings. +.*/lupdate/testdata/good/parsejs2/main.js:13: QT_TRANSLATE_NOOP\(\): both arguments must be literal strings. +.*/lupdate/testdata/good/parsejs2/main.js:15: qsTr\(\) requires at least one argument. +.*/lupdate/testdata/good/parsejs2/main.js:16: qsTr\(\): text to translate must be a literal string. +.*/lupdate/testdata/good/parsejs2/main.js:18: QT_TR_NOOP\(\) requires at least one argument. +.*/lupdate/testdata/good/parsejs2/main.js:19: QT_TR_NOOP\(\): text to translate must be a literal string. +.*/lupdate/testdata/good/parsejs2/main.js:21: qsTrId\(\) requires at least one argument. +.*/lupdate/testdata/good/parsejs2/main.js:22: qsTrId\(\): identifier must be a literal string. +.*/lupdate/testdata/good/parsejs2/main.js:24: QT_TRID_NOOP\(\) requires at least one argument. +.*/lupdate/testdata/good/parsejs2/main.js:25: QT_TRID_NOOP\(\): identifier must be a literal string. +.*/lupdate/testdata/good/parsejs2/main.js:27: Unexpected character in meta string +.*/lupdate/testdata/good/parsejs2/main.js:28: Unexpected character in meta string +.*/lupdate/testdata/good/parsejs2/main.js:29: Unterminated meta string +.*/lupdate/testdata/good/parsejs2/main.js:30: Unterminated meta string +.*/lupdate/testdata/good/parsejs2/main.js:33: //% cannot be used with qsTranslate\(\). Ignoring +.*/lupdate/testdata/good/parsejs2/main.js:35: //% cannot be used with QT_TRANSLATE_NOOP\(\). Ignoring +.*/lupdate/testdata/good/parsejs2/main.js:37: //% cannot be used with qsTr\(\). Ignoring +.*/lupdate/testdata/good/parsejs2/main.js:39: //% cannot be used with QT_TR_NOOP\(\). Ignoring +.*/lupdate/testdata/good/parsejs2/main.js:42: Discarding unconsumed meta data +.*/lupdate/testdata/good/parsejs2/main.js:44: Discarding unconsumed meta data +.*/lupdate/testdata/good/parsejs2/main.js:46: Discarding unconsumed meta data diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejs2/main.js b/tests/auto/linguist/lupdate/testdata/good/parsejs2/main.js new file mode 100644 index 0000000..ea02957 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsejs2/main.js @@ -0,0 +1,56 @@ +// This script exercises lupdate errors and warnings. + +qsTranslate(); +qsTranslate(10); +qsTranslate(10, 20); +qsTranslate("10", 20); +qsTranslate(10, "20"); + +QT_TRANSLATE_NOOP(); +QT_TRANSLATE_NOOP(10); +QT_TRANSLATE_NOOP(10, 20); +QT_TRANSLATE_NOOP("10", 20); +QT_TRANSLATE_NOOP(10, "20"); + +qsTr(); +qsTr(10); + +QT_TR_NOOP(); +QT_TR_NOOP(10); + +qsTrId(); +qsTrId(10); + +QT_TRID_NOOP(); +QT_TRID_NOOP(10); + +//% This is wrong +//% "This is not wrong" This is wrong +//% "I forgot to close the meta string +//% "Being evil \ + +//% "Should cause a warning" +qsTranslate("FooContext", "Hello"); +//% "Should cause a warning" +QT_TRANSLATE_NOOP("FooContext", "World"); +//% "Should cause a warning" +qsTr("Hello"); +//% "Should cause a warning" +QT_TR_NOOP("World"); + +//: This comment will be discarded. +Math.sin(1); +//= id_foobar +Math.cos(2); +//~ underflow False +Math.tan(3); + +/* +Not tested for now, because these should perhaps not cause +translation entries to be generated at all; see QTBUG-11843. + +//= qtn_foo +qsTrId("qtn_foo"); +//= qtn_bar +QT_TRID_NOOP("qtn_bar"); +*/ diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejs2/project.pro b/tests/auto/linguist/lupdate/testdata/good/parsejs2/project.pro new file mode 100644 index 0000000..d549039 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsejs2/project.pro @@ -0,0 +1,3 @@ +SOURCES += main.js + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/parsejs2/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsejs2/project.ts.result new file mode 100644 index 0000000..bfa1b3d --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsejs2/project.ts.result @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>FooContext</name> + <message> + <location filename="main.js" line="33"/> + <source>Hello</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.js" line="35"/> + <source>World</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>main</name> + <message> + <location filename="main.js" line="37"/> + <source>Hello</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.js" line="39"/> + <source>World</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqml/main.qml b/tests/auto/linguist/lupdate/testdata/good/parseqml/main.qml new file mode 100644 index 0000000..172bd65 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseqml/main.qml @@ -0,0 +1,97 @@ +import Qt 4.7 + +QtObject { + function translate() { + qsTr("One"); + qsTranslate("FooContext", "Two"); + + var greeting_strings = [ + QT_TR_NOOP("Hello"), + QT_TRANSLATE_NOOP("FooContext", "Goodbye") + ]; + + qsTr("One", "not the same one"); + + //: My first comment. + qsTr("See comment"); + + //: My second comment. + qsTranslate("BarContext", "See other comment"); + + //: My third comment + //: spans two lines. + qsTr("The comment explains it all"); + + //: My fourth comment + //: spans a whopping + //: three lines. + qsTranslate("BazContext", "It should be clear by now"); + + /*: C-style comment. */ + qsTr("I love C++"); + + /*: Another C-style comment. */ + qsTranslate("FooContext", "I really love C++"); + + /*: C-style comment, followed by */ + /*: another one. */ + qsTr("Qt is the best"); + + /*: Another C-style comment, followed by */ + /*: yet another one. */ + qsTranslate("BarContext", "Qt is the very best"); + + // This comment doesn't have any effect. + qsTr("The comment had no effect"); + + // This comment doesn't have any effect either. + qsTranslate("BazContext", "The comment had no effect, really"); + + /* This C-style comment doesn't have any effect. */ + qsTr("No comment to your comment"); + + /* This C-style comment doesn't have any effect either. */ + qsTranslate("FooContext", "I refuse to comment on that"); + + //= id_foo + qsTr("This string has an identifier"); + + //= id_bar + qsTranslate("BarContext", "This string also has an identifier"); + + //~ loc-blank False + qsTr("This string has meta-data"); + + //~ loc-layout_id foo_dialog + qsTranslate("BazContext", "This string also has meta-data"); + + // This comment is to be ignored. + //: This is a comment for the translator. + //= id_baz + //~ foo 123 + //~ magic-stuff This means something special. + qsTr("This string has a lot of information"); + + // This comment is also to be ignored. + //: This is another comment for the translator. + //= id_babar + //~ foo-bar Important stuff + //~ needle-in-haystack Found + //~ overflow True + qsTranslate("FooContext", "This string has even more information"); + + qsTr("This string has disambiguation", "Disambiguation"); + + qsTranslate("BarContext", "This string also has disambiguation", "Another disambiguation"); + + qsTr("This string contains plurals", "", 10); + + qsTrId("qtn_foo_bar"); + + var more_greeting_strings = [ QT_TRID_NOOP("qtn_needle"), QT_TRID_NOOP("qtn_haystack") ]; + + //: qsTrId() with comment, meta-data and plurals. + //~ well-tested True + qsTrId("qtn_bar_baz", 10); + } +} diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqml/project.pro b/tests/auto/linguist/lupdate/testdata/good/parseqml/project.pro new file mode 100644 index 0000000..1040e22 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseqml/project.pro @@ -0,0 +1,3 @@ +SOURCES += main.qml + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqml/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parseqml/project.ts.result new file mode 100644 index 0000000..7dac8cb --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseqml/project.ts.result @@ -0,0 +1,195 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name></name> + <message id="qtn_foo_bar"> + <location filename="main.qml" line="89"/> + <source></source> + <translation type="unfinished"></translation> + </message> + <message id="qtn_needle"> + <location filename="main.qml" line="91"/> + <source></source> + <translation type="unfinished"></translation> + </message> + <message id="qtn_haystack"> + <location filename="main.qml" line="91"/> + <source></source> + <translation type="unfinished"></translation> + </message> + <message id="qtn_bar_baz" numerus="yes"> + <location filename="main.qml" line="95"/> + <source></source> + <extracomment>qsTrId() with comment, meta-data and plurals.</extracomment> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + <extra-well-tested>True</extra-well-tested> + </message> +</context> +<context> + <name>BarContext</name> + <message> + <location filename="main.qml" line="19"/> + <source>See other comment</source> + <extracomment>My second comment.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="42"/> + <source>Qt is the very best</source> + <extracomment>Another C-style comment, followed by yet another one.</extracomment> + <translation type="unfinished"></translation> + </message> + <message id="id_bar"> + <location filename="main.qml" line="60"/> + <source>This string also has an identifier</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="85"/> + <source>This string also has disambiguation</source> + <comment>Another disambiguation</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>BazContext</name> + <message> + <location filename="main.qml" line="28"/> + <source>It should be clear by now</source> + <extracomment>My fourth comment spans a whopping three lines.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="48"/> + <source>The comment had no effect, really</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="66"/> + <source>This string also has meta-data</source> + <translation type="unfinished"></translation> + <extra-loc-layout_id>foo_dialog</extra-loc-layout_id> + </message> +</context> +<context> + <name>FooContext</name> + <message> + <location filename="main.qml" line="6"/> + <source>Two</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="10"/> + <source>Goodbye</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="34"/> + <source>I really love C++</source> + <extracomment>Another C-style comment.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="54"/> + <source>I refuse to comment on that</source> + <translation type="unfinished"></translation> + </message> + <message id="id_babar"> + <location filename="main.qml" line="81"/> + <source>This string has even more information</source> + <extracomment>This is another comment for the translator.</extracomment> + <translation type="unfinished"></translation> + <extra-needle-in-haystack>Found</extra-needle-in-haystack> + <extra-overflow>True</extra-overflow> + <extra-foo-bar>Important stuff</extra-foo-bar> + </message> +</context> +<context> + <name>main</name> + <message> + <location filename="main.qml" line="5"/> + <source>One</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="9"/> + <source>Hello</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="13"/> + <source>One</source> + <comment>not the same one</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="16"/> + <source>See comment</source> + <extracomment>My first comment.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="23"/> + <source>The comment explains it all</source> + <extracomment>My third comment spans two lines.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="31"/> + <source>I love C++</source> + <extracomment>C-style comment.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="38"/> + <source>Qt is the best</source> + <extracomment>C-style comment, followed by another one.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="45"/> + <source>The comment had no effect</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="51"/> + <source>No comment to your comment</source> + <translation type="unfinished"></translation> + </message> + <message id="id_foo"> + <location filename="main.qml" line="57"/> + <source>This string has an identifier</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="63"/> + <source>This string has meta-data</source> + <translation type="unfinished"></translation> + <extra-loc-blank>False</extra-loc-blank> + </message> + <message id="id_baz"> + <location filename="main.qml" line="73"/> + <source>This string has a lot of information</source> + <extracomment>This is a comment for the translator.</extracomment> + <translation type="unfinished"></translation> + <extra-foo>123</extra-foo> + <extra-magic-stuff>This means something special.</extra-magic-stuff> + </message> + <message> + <location filename="main.qml" line="83"/> + <source>This string has disambiguation</source> + <comment>Disambiguation</comment> + <translation type="unfinished"></translation> + </message> + <message numerus="yes"> + <location filename="main.qml" line="87"/> + <source>This string contains plurals</source> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> +</context> +</TS> diff --git a/tests/auto/qdbusthreading/tst_qdbusthreading.cpp b/tests/auto/qdbusthreading/tst_qdbusthreading.cpp index 94771a8..9d96ad8 100644 --- a/tests/auto/qdbusthreading/tst_qdbusthreading.cpp +++ b/tests/auto/qdbusthreading/tst_qdbusthreading.cpp @@ -70,7 +70,12 @@ public: QSemaphore sem1, sem2; volatile bool success; QEventLoop *loop; - const char *functionSpy; + enum FunctionSpy { + NoMethod = 0, + Adaptor_method, + Object_method + } functionSpy; + QThread *threadSpy; int signalSpy; @@ -127,7 +132,7 @@ public: public Q_SLOTS: void method() { - tst_QDBusThreading::self()->functionSpy = Q_FUNC_INFO; + tst_QDBusThreading::self()->functionSpy = tst_QDBusThreading::Adaptor_method; tst_QDBusThreading::self()->threadSpy = QThread::currentThread(); emit signal(); } @@ -155,7 +160,7 @@ public: public Q_SLOTS: void method() { - tst_QDBusThreading::self()->functionSpy = Q_FUNC_INFO; + tst_QDBusThreading::self()->functionSpy = tst_QDBusThreading::Object_method; tst_QDBusThreading::self()->threadSpy = QThread::currentThread(); emit signal(); deleteLater(); @@ -198,7 +203,7 @@ void Thread::run() static const char myConnectionName[] = "connection"; tst_QDBusThreading::tst_QDBusThreading() - : loop(0), functionSpy(0), threadSpy(0) + : loop(0), functionSpy(NoMethod), threadSpy(0) { _self = this; QCoreApplication::instance()->thread()->setObjectName("Main thread"); @@ -420,22 +425,22 @@ void tst_QDBusThreading::registerObjectInOtherThread() QTest::qWait(100); QCOMPARE(signalSpy, 0); - functionSpy = 0; + functionSpy = NoMethod; threadSpy = 0; QDBusReply<void> reply = iface.call("method"); QVERIFY(reply.isValid()); - QCOMPARE(functionSpy, "void Object::method()"); + QCOMPARE(functionSpy, Object_method); QCOMPARE(threadSpy, th); QTest::qWait(100); QCOMPARE(signalSpy, 1); sem2.acquire(); // the object is gone - functionSpy = 0; + functionSpy = NoMethod; threadSpy = 0; reply = iface.call("method"); QVERIFY(!reply.isValid()); - QCOMPARE(functionSpy, (const char*)0); + QCOMPARE(functionSpy, NoMethod); QCOMPARE(threadSpy, (QThread*)0); } @@ -468,36 +473,36 @@ void tst_QDBusThreading::registerAdaptorInOtherThread() connect(&adaptor, SIGNAL(signal()), SLOT(signalSpySlot())); QCOMPARE(signalSpy, 0); - functionSpy = 0; + functionSpy = NoMethod; threadSpy = 0; QDBusReply<void> reply = adaptor.call("method"); QVERIFY(reply.isValid()); - QCOMPARE(functionSpy, "void Adaptor::method()"); + QCOMPARE(functionSpy, Adaptor_method); QCOMPARE(threadSpy, th); QTest::qWait(100); QCOMPARE(signalSpy, 1); - functionSpy = 0; + functionSpy = NoMethod; threadSpy = 0; reply = object.call("method"); QVERIFY(reply.isValid()); - QCOMPARE(functionSpy, "void Object::method()"); + QCOMPARE(functionSpy, Object_method); QCOMPARE(threadSpy, th); QTest::qWait(100); QCOMPARE(signalSpy, 1); sem2.acquire(); // the object is gone - functionSpy = 0; + functionSpy = NoMethod; threadSpy = 0; reply = adaptor.call("method"); QVERIFY(!reply.isValid()); - QCOMPARE(functionSpy, (const char*)0); + QCOMPARE(functionSpy, NoMethod); QCOMPARE(threadSpy, (QThread*)0); reply = object.call("method"); QVERIFY(!reply.isValid()); - QCOMPARE(functionSpy, (const char*)0); + QCOMPARE(functionSpy, NoMethod); QCOMPARE(threadSpy, (QThread*)0); } diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp index e5628d1..ddc4f73 100644 --- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp @@ -172,6 +172,12 @@ private slots: void itemChangeEvents(); void itemSendGeometryPosChangesDeactivated(); + void fontPropagatesResolveToChildren(); + void fontPropagatesResolveToGrandChildren(); + void fontPropagatesResolveInParentChange(); + void fontPropagatesResolveViaNonWidget(); + void fontPropagatesResolveFromScene(); + // Task fixes void task236127_bspTreeIndexFails(); void task243004_setStyleCrash(); @@ -622,6 +628,192 @@ void tst_QGraphicsWidget::font() QCOMPARE(widget.font().family(), font.family()); } +void tst_QGraphicsWidget::fontPropagatesResolveToChildren() +{ + QGraphicsWidget *root = new QGraphicsWidget(); + QGraphicsWidget *child1 = new QGraphicsWidget(root); + + QGraphicsScene scene; + scene.addItem(root); + + QFont font; + font.setItalic(true); + root->setFont(font); + + QGraphicsWidget *child2 = new QGraphicsWidget(root); + QGraphicsWidget *child3 = new QGraphicsWidget(); + child3->setParentItem(root); + + QGraphicsView view; + view.setScene(&scene); + view.show(); + QTest::qWaitForWindowShown(&view); + + QCOMPARE(font.resolve(), uint(QFont::StyleResolved)); + QCOMPARE(root->font().resolve(), uint(QFont::StyleResolved)); + QCOMPARE(child1->font().resolve(), uint(QFont::StyleResolved)); + QCOMPARE(child2->font().resolve(), uint(QFont::StyleResolved)); + QCOMPARE(child3->font().resolve(), uint(QFont::StyleResolved)); +} + +void tst_QGraphicsWidget::fontPropagatesResolveToGrandChildren() +{ + QGraphicsWidget *root = new QGraphicsWidget(); + QGraphicsWidget *child1 = new QGraphicsWidget(root); + QGraphicsWidget *grandChild1 = new QGraphicsWidget(child1); + + QGraphicsScene scene; + scene.addItem(root); + + QFont font; + font.setItalic(true); + root->setFont(font); + + QGraphicsWidget *child2 = new QGraphicsWidget(root); + QGraphicsWidget *grandChild2 = new QGraphicsWidget(child2); + QGraphicsWidget *grandChild3 = new QGraphicsWidget(child2); + + QGraphicsWidget *child3 = new QGraphicsWidget(); + QGraphicsWidget *grandChild4 = new QGraphicsWidget(child3); + QGraphicsWidget *grandChild5 = new QGraphicsWidget(child3); + child3->setParentItem(root); + grandChild5->setParentItem(child3); + + QGraphicsView view; + view.setScene(&scene); + view.show(); + QTest::qWaitForWindowShown(&view); + + QCOMPARE(font.resolve(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild1->font().resolve(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild2->font().resolve(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild3->font().resolve(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild4->font().resolve(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild5->font().resolve(), uint(QFont::StyleResolved)); +} + +void tst_QGraphicsWidget::fontPropagatesResolveViaNonWidget() +{ + QGraphicsWidget *root = new QGraphicsWidget(); + QGraphicsPixmapItem *child1 = new QGraphicsPixmapItem(root); + QGraphicsWidget *grandChild1 = new QGraphicsWidget(child1); + + QGraphicsScene scene; + scene.addItem(root); + + QFont font; + font.setItalic(true); + root->setFont(font); + + QGraphicsPixmapItem *child2 = new QGraphicsPixmapItem(root); + QGraphicsWidget *grandChild2 = new QGraphicsWidget(child2); + QGraphicsWidget *grandChild3 = new QGraphicsWidget(child2); + + QGraphicsPixmapItem *child3 = new QGraphicsPixmapItem(); + QGraphicsWidget *grandChild4 = new QGraphicsWidget(child3); + QGraphicsWidget *grandChild5 = new QGraphicsWidget(child3); + child3->setParentItem(root); + grandChild5->setParentItem(child3); + + QGraphicsView view; + view.setScene(&scene); + view.show(); + QTest::qWaitForWindowShown(&view); + + QCOMPARE(font.resolve(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild1->font().resolve(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild2->font().resolve(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild3->font().resolve(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild4->font().resolve(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild5->font().resolve(), uint(QFont::StyleResolved)); +} + +void tst_QGraphicsWidget::fontPropagatesResolveFromScene() +{ + QGraphicsWidget *root = new QGraphicsWidget(); + QGraphicsWidget *child1 = new QGraphicsWidget(root); + QGraphicsWidget *grandChild1 = new QGraphicsWidget(child1); + + QGraphicsScene scene; + scene.addItem(root); + + QFont font; + font.setItalic(true); + scene.setFont(font); + + QGraphicsWidget *child2 = new QGraphicsWidget(root); + QGraphicsWidget *grandChild2 = new QGraphicsWidget(child2); + QGraphicsWidget *grandChild3 = new QGraphicsWidget(child2); + + QGraphicsWidget *child3 = new QGraphicsWidget(); + QGraphicsWidget *grandChild4 = new QGraphicsWidget(child3); + QGraphicsWidget *grandChild5 = new QGraphicsWidget(child3); + child3->setParentItem(root); + grandChild5->setParentItem(child3); + + QGraphicsView view; + view.setScene(&scene); + view.show(); + QTest::qWaitForWindowShown(&view); + + QCOMPARE(font.resolve(), uint(QFont::StyleResolved)); + QCOMPARE(root->font().resolve(), uint(QFont::StyleResolved)); + QCOMPARE(child1->font().resolve(), uint(QFont::StyleResolved)); + QCOMPARE(child2->font().resolve(), uint(QFont::StyleResolved)); + QCOMPARE(child3->font().resolve(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild1->font().resolve(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild2->font().resolve(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild3->font().resolve(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild4->font().resolve(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild5->font().resolve(), uint(QFont::StyleResolved)); +} + +void tst_QGraphicsWidget::fontPropagatesResolveInParentChange() +{ + QGraphicsWidget *root = new QGraphicsWidget(); + + QGraphicsWidget *child1 = new QGraphicsWidget(root); + QGraphicsWidget *grandChild1 = new QGraphicsWidget(child1); + + QGraphicsWidget *child2 = new QGraphicsWidget(root); + QGraphicsWidget *grandChild2 = new QGraphicsWidget(child2); + + QGraphicsScene scene; + scene.addItem(root); + + QFont italicFont; + italicFont.setItalic(true); + child1->setFont(italicFont); + + QFont boldFont; + boldFont.setBold(true); + child2->setFont(boldFont); + + QVERIFY(grandChild1->font().italic()); + QVERIFY(!grandChild1->font().bold()); + QVERIFY(!grandChild2->font().italic()); + QVERIFY(grandChild2->font().bold()); + + QCOMPARE(grandChild1->font().resolve(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild2->font().resolve(), uint(QFont::WeightResolved)); + + grandChild2->setParentItem(child1); + + QGraphicsView view; + view.setScene(&scene); + view.show(); + QTest::qWaitForWindowShown(&view); + + QVERIFY(grandChild1->font().italic()); + QVERIFY(!grandChild1->font().bold()); + QVERIFY(grandChild2->font().italic()); + QVERIFY(!grandChild2->font().bold()); + + QCOMPARE(grandChild1->font().resolve(), uint(QFont::StyleResolved)); + QCOMPARE(grandChild2->font().resolve(), uint(QFont::StyleResolved)); + +} + void tst_QGraphicsWidget::fontPropagation() { QGraphicsWidget *root = new QGraphicsWidget; @@ -728,11 +920,12 @@ void tst_QGraphicsWidget::fontPropagationWidgetItemWidget() widget->setFont(font); QCOMPARE(widget2->font().pointSize(), 43); - QCOMPARE(widget2->font().resolve(), QFont().resolve()); + QCOMPARE(widget2->font().resolve(), uint(QFont::SizeResolved)); widget->setFont(QFont()); QCOMPARE(widget2->font().pointSize(), qApp->font().pointSize()); + QCOMPARE(widget2->font().resolve(), QFont().resolve()); } void tst_QGraphicsWidget::fontPropagationSceneChange() diff --git a/tests/auto/qimage/tst_qimage.cpp b/tests/auto/qimage/tst_qimage.cpp index 49514dc..ec0ecec 100644 --- a/tests/auto/qimage/tst_qimage.cpp +++ b/tests/auto/qimage/tst_qimage.cpp @@ -1451,11 +1451,6 @@ static inline int rand8() return int(256. * (qrand() / (RAND_MAX + 1.0))); } -static inline bool compare(int a, int b, int tolerance) -{ - return qAbs(a - b) <= tolerance; -} - // compares img.scale against the bilinear filtering used by QPainter void tst_QImage::smoothScale3() { @@ -1483,6 +1478,7 @@ void tst_QImage::smoothScale3() p.scale(scales[i], scales[i]); p.drawImage(0, 0, img); p.end(); + int err = 0; for (int y = 0; y < a.height(); ++y) { for (int x = 0; x < a.width(); ++x) { @@ -1490,11 +1486,15 @@ void tst_QImage::smoothScale3() QRgb cb = b.pixel(x, y); // tolerate a little bit of rounding errors - QVERIFY(compare(qRed(ca), qRed(cb), 3)); - QVERIFY(compare(qGreen(ca), qGreen(cb), 3)); - QVERIFY(compare(qBlue(ca), qBlue(cb), 3)); + bool r = true; + r &= qAbs(qRed(ca) - qRed(cb)) <= 18; + r &= qAbs(qGreen(ca) - qGreen(cb)) <= 18; + r &= qAbs(qBlue(ca) - qBlue(cb)) <= 18; + if (!r) + err++; } } + QCOMPARE(err, 0); } } diff --git a/tests/auto/qinputcontext/qinputcontext.pro b/tests/auto/qinputcontext/qinputcontext.pro index b3ea8c2..ec6831e 100644 --- a/tests/auto/qinputcontext/qinputcontext.pro +++ b/tests/auto/qinputcontext/qinputcontext.pro @@ -1,2 +1,6 @@ load(qttest_p4) SOURCES += tst_qinputcontext.cpp + +symbian { + LIBS += -lws32 -lcone +} diff --git a/tests/auto/qinputcontext/tst_qinputcontext.cpp b/tests/auto/qinputcontext/tst_qinputcontext.cpp index 644b463..93813f9 100644 --- a/tests/auto/qinputcontext/tst_qinputcontext.cpp +++ b/tests/auto/qinputcontext/tst_qinputcontext.cpp @@ -48,17 +48,26 @@ #include <qlayout.h> #include <qradiobutton.h> #include <qwindowsstyle.h> +#include <qdesktopwidget.h> + +#ifdef Q_OS_SYMBIAN +#include <private/qt_s60_p.h> +#include <private/qcoefepinputcontext_p.h> + +#include <w32std.h> +#include <coecntrl.h> +#endif class tst_QInputContext : public QObject { Q_OBJECT public: - tst_QInputContext() {} + tst_QInputContext() : m_phoneIsQwerty(false) {} virtual ~tst_QInputContext() {} public slots: - void initTestCase() {} + void initTestCase(); void cleanupTestCase() {} void init() {} void cleanup() {} @@ -69,8 +78,176 @@ private slots: void closeSoftwareInputPanel(); void selections(); void focusProxy(); + void symbianTestCoeFepInputContext_data(); + void symbianTestCoeFepInputContext(); + +private: + bool m_phoneIsQwerty; }; +#ifdef Q_OS_SYMBIAN +class KeyEvent : public TWsEvent +{ +public: + KeyEvent(QWidget *w, TInt type, TInt scanCode, TUint code, TUint modifiers, TInt repeats) { + iHandle = w->effectiveWinId()->DrawableWindow()->WindowGroupId(); + iType = type; + SetTimeNow(); + TKeyEvent *keyEvent = reinterpret_cast<TKeyEvent *>(iEventData); + keyEvent->iScanCode = scanCode; + keyEvent->iCode = code; + keyEvent->iModifiers = modifiers; + keyEvent->iRepeats = repeats; + } +}; + +class FepReplayEvent +{ +public: + enum Type { + Pause, + Key, + CompleteKey + }; + + FepReplayEvent(int msecsToPause) + : m_type(Pause) + , m_msecsToPause(msecsToPause) + { + } + + FepReplayEvent(TInt keyType, TInt scanCode, TUint code, TUint modifiers, TInt repeats) + : m_type(Key) + , m_keyType(keyType) + , m_scanCode(scanCode) + , m_code(code) + , m_modifiers(modifiers) + , m_repeats(repeats) + { + } + + FepReplayEvent(TInt scanCode, TUint code, TUint modifiers, TInt repeats) + : m_type(CompleteKey) + , m_scanCode(scanCode) + , m_code(code) + , m_modifiers(modifiers) + , m_repeats(repeats) + { + } + + void sendEvent(QWidget *w, TInt type, TInt scanCode, TUint code, TUint modifiers, TInt repeats) + { + KeyEvent event(w, type, scanCode, code, modifiers, repeats); + S60->wsSession().SendEventToWindowGroup(w->effectiveWinId()->DrawableWindow()->WindowGroupId(), event); + } + + void pause(int msecs) + { + // Don't use qWait here. The polling nature of that function screws up the test. + QTimer timer; + QEventLoop loop; + QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit())); + timer.setSingleShot(true); + timer.start(msecs); + loop.exec(); + } + + // For some reason, the test fails if using processEvents instead of an event loop + // with a zero timer to quit it, so use the timer. +#define KEY_WAIT 0 + + void replay(QWidget *w) + { + if (m_type == Pause) { + pause(m_msecsToPause); + } else if (m_type == Key) { + sendEvent(w, m_keyType, m_scanCode, m_code, m_modifiers, m_repeats); + if (m_keyType != EEventKeyDown) + // EEventKeyDown events should have no pause before the EEventKey event. + pause(KEY_WAIT); + } else if (m_type == CompleteKey) { + sendEvent(w, EEventKeyDown, m_scanCode, 0, m_modifiers, m_repeats); + // EEventKeyDown events should have no pause before the EEventKey event. + sendEvent(w, EEventKey, m_scanCode, m_code, m_modifiers, m_repeats); + pause(KEY_WAIT); + sendEvent(w, EEventKeyUp, m_scanCode, 0, m_modifiers, m_repeats); + pause(KEY_WAIT); + } + } + +private: + Type m_type; + int m_msecsToPause; + TInt m_keyType; + TInt m_scanCode; + TUint m_code; + TUint m_modifiers; + TInt m_repeats; +}; + +Q_DECLARE_METATYPE(QList<FepReplayEvent>) +Q_DECLARE_METATYPE(Qt::InputMethodHints) +Q_DECLARE_METATYPE(QLineEdit::EchoMode); + +#endif // Q_OS_SYMBIAN + +void tst_QInputContext::initTestCase() +{ +#ifdef Q_OS_SYMBIAN + // Sanity test. Checks FEP for: + // - T9 mode is default (it will attempt to fix this) + // - Language is English (it cannot fix this; bail out if not correct) + QWidget w; + QLayout *layout = new QVBoxLayout; + w.setLayout(layout); + QLineEdit *lineedit = new QLineEdit; + layout->addWidget(lineedit); + lineedit->setFocus(); +#ifdef QT_KEYPAD_NAVIGATION + lineedit->setEditFocus(true); +#endif + w.show(); + + QDesktopWidget desktop; + QRect screenSize = desktop.screenGeometry(&w); + if (screenSize.width() > screenSize.height()) { + // Crude way of finding out we are running on a qwerty phone. + m_phoneIsQwerty = true; + return; + } + + for (int iterations = 0; iterations < 16; iterations++) { + QTest::qWait(500); + + QList<FepReplayEvent> keyEvents; + + keyEvents << FepReplayEvent('9', '9', 0, 0); + keyEvents << FepReplayEvent('6', '6', 0, 0); + keyEvents << FepReplayEvent('8', '8', 0, 0); + keyEvents << FepReplayEvent(EStdKeyRightArrow, EKeyRightArrow, 0, 0); + + foreach(FepReplayEvent event, keyEvents) { + event.replay(lineedit); + } + + QApplication::processEvents(); + + if (lineedit->text().endsWith("you", Qt::CaseInsensitive)) { + // Success! + return; + } + + // Try changing modes. + // After 8 iterations, try to press the mode switch twice before typing. + for (int c = 0; c <= iterations / 8; c++) { + FepReplayEvent(EStdKeyHash, '#', 0, 0).replay(lineedit); + } + } + + QFAIL("FEP sanity test failed. Either the phone is not set to English, or the test was unable to enable T9"); +#endif +} + void tst_QInputContext::maximumTextLength() { QLineEdit le; @@ -271,7 +448,6 @@ void tst_QInputContext::focusProxy() QInputContext *gic = qApp->inputContext(); QVERIFY(gic); - qDebug() << gic->focusWidget() << &proxy; QCOMPARE(gic->focusWidget(), &proxy); // then change the focus proxy and check that input context is valid @@ -285,5 +461,480 @@ void tst_QInputContext::focusProxy() QCOMPARE(gic->focusWidget(), &proxy); } +void tst_QInputContext::symbianTestCoeFepInputContext_data() +{ +#ifdef Q_OS_SYMBIAN + QTest::addColumn<bool> ("inputMethodEnabled"); + QTest::addColumn<Qt::InputMethodHints> ("inputMethodHints"); + QTest::addColumn<int> ("maxLength"); // Zero for no limit + QTest::addColumn<QLineEdit::EchoMode> ("echoMode"); + QTest::addColumn<QList<FepReplayEvent> > ("keyEvents"); + QTest::addColumn<QString> ("finalString"); + QTest::addColumn<QString> ("preeditString"); + QList<FepReplayEvent> events; + + events << FepReplayEvent(EStdKeyBackspace, EKeyBackspace, 0, 0); + events << FepReplayEvent(EStdKeyBackspace, EKeyBackspace, 0, 0); + events << FepReplayEvent('5', '5', 0, 0); + events << FepReplayEvent('4', '4', 0, 0); + events << FepReplayEvent('6', '6', 0, 0); + events << FepReplayEvent(EStdKeyBackspace, EKeyBackspace, 0, 0); + events << FepReplayEvent(EStdKeyBackspace, EKeyBackspace, 0, 0); + events << FepReplayEvent('1', '1', 0, 0); + events << FepReplayEvent(EStdKeyBackspace, EKeyBackspace, 0, 0); + events << FepReplayEvent('2', '2', 0, 0); + events << FepReplayEvent('1', '1', 0, 0); + QTest::newRow("Numbers (no FEP)") + << false + << Qt::InputMethodHints(Qt::ImhNone) + << 0 + << QLineEdit::Normal + << events + << QString("521") + << QString(""); + QTest::newRow("Numbers and password mode (no FEP)") + << false + << Qt::InputMethodHints(Qt::ImhNone) + << 0 + << QLineEdit::Password + << events + << QString("521") + << QString(""); + QTest::newRow("Numbers") + << true + << Qt::InputMethodHints(Qt::ImhDigitsOnly) + << 0 + << QLineEdit::Normal + << events + << QString("521") + << QString(""); + QTest::newRow("Numbers max length (no FEP)") + << false + << Qt::InputMethodHints(Qt::ImhNone) + << 2 + << QLineEdit::Normal + << events + << QString("21") + << QString(""); + QTest::newRow("Numbers max length") + << true + << Qt::InputMethodHints(Qt::ImhDigitsOnly) + << 2 + << QLineEdit::Normal + << events + << QString("21") + << QString(""); + events.clear(); + + events << FepReplayEvent(EEventKeyDown, '5', 0, 0, 0); + events << FepReplayEvent(EEventKey, '5', '5', 0, 0); + events << FepReplayEvent(EEventKey, '5', '5', 0, 1); + events << FepReplayEvent(EEventKey, '5', '5', 0, 1); + events << FepReplayEvent(EEventKeyUp, '5', 0, 0, 0); + QTest::newRow("Numbers and autorepeat (no FEP)") + << false + << Qt::InputMethodHints(Qt::ImhNone) + << 0 + << QLineEdit::Normal + << events + << QString("555") + << QString(""); + events.clear(); + + events << FepReplayEvent(EStdKeyBackspace, EKeyBackspace, 0, 0); + events << FepReplayEvent('2', '2', 0, 0); + events << FepReplayEvent('3', '3', 0, 0); + events << FepReplayEvent('4', '4', 0, 0); + events << FepReplayEvent('4', '4', 0, 0); + events << FepReplayEvent('5', '5', 0, 0); + events << FepReplayEvent('5', '5', 0, 0); + events << FepReplayEvent(EStdKeyBackspace, EKeyBackspace, 0, 0); + QTest::newRow("Multitap") + << true + << Qt::InputMethodHints(Qt::ImhNoPredictiveText) + << 0 + << QLineEdit::Normal + << events + << QString("Adh") + << QString(""); + QTest::newRow("Multitap with no auto uppercase") + << true + << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhNoAutoUppercase) + << 0 + << QLineEdit::Normal + << events + << QString("adh") + << QString(""); + QTest::newRow("Multitap with uppercase") + << true + << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhPreferUppercase) + << 0 + << QLineEdit::Normal + << events + << QString("ADH") + << QString(""); + QTest::newRow("Multitap with lowercase") + << true + << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhPreferLowercase) + << 0 + << QLineEdit::Normal + << events + << QString("adh") + << QString(""); + QTest::newRow("Multitap with forced uppercase") + << true + << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhUppercaseOnly) + << 0 + << QLineEdit::Normal + << events + << QString("ADH") + << QString(""); + QTest::newRow("Multitap with forced lowercase") + << true + << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhLowercaseOnly) + << 0 + << QLineEdit::Normal + << events + << QString("adh") + << QString(""); + events.clear(); + + events << FepReplayEvent(EStdKeyHash, '#', 0, 0); + events << FepReplayEvent('2', '2', 0, 0); + events << FepReplayEvent('2', '2', 0, 0); + events << FepReplayEvent('3', '3', 0, 0); + events << FepReplayEvent('4', '4', 0, 0); + events << FepReplayEvent('4', '4', 0, 0); + events << FepReplayEvent('5', '5', 0, 0); + events << FepReplayEvent('5', '5', 0, 0); + events << FepReplayEvent(EStdKeyBackspace, EKeyBackspace, 0, 0); + QTest::newRow("Multitap with mode switch") + << true + << Qt::InputMethodHints(Qt::ImhNoPredictiveText) + << 0 + << QLineEdit::Normal + << events + << QString("bdh") + << QString(""); + events.clear(); + + events << FepReplayEvent('7', '7', 0, 0); + events << FepReplayEvent('7', '7', 0, 0); + events << FepReplayEvent('8', '8', 0, 0); + events << FepReplayEvent('9', '9', 0, 0); + events << FepReplayEvent('9', '9', 0, 0); + QTest::newRow("Multitap with unfinished text") + << true + << Qt::InputMethodHints(Qt::ImhNoPredictiveText) + << 0 + << QLineEdit::Normal + << events + << QString("Qt") + << QString("x"); + events << FepReplayEvent(2000); + QTest::newRow("Multitap with committed text") + << true + << Qt::InputMethodHints(Qt::ImhNoPredictiveText) + << 0 + << QLineEdit::Normal + << events + << QString("Qtx") + << QString(""); + events.clear(); + + events << FepReplayEvent('4', '4', 0, 0); + events << FepReplayEvent('4', '4', 0, 0); + // Simulate holding down hash key. + events << FepReplayEvent(EEventKeyDown, EStdKeyHash, 0, 0, 0); + events << FepReplayEvent(EEventKey, EStdKeyHash, '#', 0, 0); + events << FepReplayEvent(500); + events << FepReplayEvent(EEventKey, EStdKeyHash, '#', 0, 1); + events << FepReplayEvent(EEventKey, EStdKeyHash, '#', 0, 1); + events << FepReplayEvent(EEventKey, EStdKeyHash, '#', 0, 1); + events << FepReplayEvent(EEventKeyUp, EStdKeyHash, 0, 0, 0); + events << FepReplayEvent('7', '7', 0, 0); + events << FepReplayEvent('7', '7', 0, 0); + events << FepReplayEvent('8', '8', 0, 0); + // QTBUG-9867: Switch back as well to make sure we don't get extra symbols + events << FepReplayEvent(EEventKeyDown, EStdKeyHash, 0, 0, 0); + events << FepReplayEvent(EEventKey, EStdKeyHash, '#', 0, 0); + events << FepReplayEvent(500); + events << FepReplayEvent(EEventKey, EStdKeyHash, '#', 0, 1); + events << FepReplayEvent(EEventKey, EStdKeyHash, '#', 0, 1); + events << FepReplayEvent(EEventKey, EStdKeyHash, '#', 0, 1); + events << FepReplayEvent(EEventKeyUp, EStdKeyHash, 0, 0, 0); + events << FepReplayEvent('9', '9', 0, 0); + events << FepReplayEvent('6', '6', 0, 0); + events << FepReplayEvent('8', '8', 0, 0); + events << FepReplayEvent(2000); + events << FepReplayEvent(EStdKeyDevice3, EKeyDevice3, 0, 0); // Select key + QTest::newRow("Multitap and numbers") + << true + << Qt::InputMethodHints(Qt::ImhNoPredictiveText) + << 0 + << QLineEdit::Normal + << events + << QString("H778wmt") + << QString(""); + QTest::newRow("T9 and numbers") + << true + << Qt::InputMethodHints(Qt::ImhPreferLowercase) + << 0 + << QLineEdit::Normal + << events + << QString("hi778you") + << QString(""); + events.clear(); + + events << FepReplayEvent('4', '4', 0, 0); + events << FepReplayEvent('4', '4', 0, 0); + events << FepReplayEvent(EStdKeyDevice3, EKeyDevice3, 0, 0); // Select key + QTest::newRow("T9") + << true + << Qt::InputMethodHints(Qt::ImhPreferLowercase) + << 0 + << QLineEdit::Normal + << events + << QString("hi") + << QString(""); + QTest::newRow("T9 with uppercase") + << true + << Qt::InputMethodHints(Qt::ImhPreferUppercase) + << 0 + << QLineEdit::Normal + << events + << QString("HI") + << QString(""); + QTest::newRow("T9 with forced lowercase") + << true + << Qt::InputMethodHints(Qt::ImhLowercaseOnly) + << 0 + << QLineEdit::Normal + << events + << QString("hi") + << QString(""); + QTest::newRow("T9 with forced uppercase") + << true + << Qt::InputMethodHints(Qt::ImhUppercaseOnly) + << 0 + << QLineEdit::Normal + << events + << QString("HI") + << QString(""); + QTest::newRow("T9 with maxlength") + << true + << Qt::InputMethodHints(Qt::ImhLowercaseOnly) + << 1 + << QLineEdit::Normal + << events + << QString("i") + << QString(""); + events.clear(); + + events << FepReplayEvent('4', '4', 0, 0); + events << FepReplayEvent('4', '4', 0, 0); + events << FepReplayEvent(EStdKeyLeftArrow, EKeyLeftArrow, 0, 0); + events << FepReplayEvent(EStdKeyLeftArrow, EKeyLeftArrow, 0, 0); + events << FepReplayEvent('9', '9', 0, 0); + events << FepReplayEvent('6', '6', 0, 0); + events << FepReplayEvent('8', '8', 0, 0); + events << FepReplayEvent('0', '0', 0, 0); + events << FepReplayEvent(EStdKeyRightArrow, EKeyRightArrow, 0, 0); + events << FepReplayEvent(EStdKeyRightArrow, EKeyRightArrow, 0, 0); + events << FepReplayEvent('8', '8', 0, 0); + events << FepReplayEvent('8', '8', 0, 0); + QTest::newRow("T9 with movement and unfinished text") + << true + << Qt::InputMethodHints(Qt::ImhPreferLowercase) + << 0 + << QLineEdit::Normal + << events + << QString("you hi") + << QString("tv"); + QTest::newRow("T9 with movement, password and unfinished text") + << true + << Qt::InputMethodHints(Qt::ImhPreferLowercase) + << 0 + << QLineEdit::Password + << events + << QString("wmt h") + << QString("u"); + QTest::newRow("T9 with movement, maxlength, password and unfinished text") + << true + << Qt::InputMethodHints(Qt::ImhPreferLowercase) + << 2 + << QLineEdit::Password + << events + << QString("wh") + << QString(""); + QTest::newRow("T9 with movement, maxlength and unfinished text") + << true + << Qt::InputMethodHints(Qt::ImhPreferLowercase) + << 2 + << QLineEdit::Normal + << events + << QString("hi") + << QString(""); + QTest::newRow("Multitap with movement and unfinished text") + << true + << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhPreferLowercase) + << 0 + << QLineEdit::Normal + << events + << QString("wmt h") + << QString("u"); + QTest::newRow("Multitap with movement, maxlength and unfinished text") + << true + << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhPreferLowercase) + << 2 + << QLineEdit::Normal + << events + << QString("wh") + << QString(""); + QTest::newRow("Numbers with movement") + << true + << Qt::InputMethodHints(Qt::ImhDigitsOnly) + << 0 + << QLineEdit::Normal + << events + << QString("96804488") + << QString(""); + QTest::newRow("Numbers with movement and maxlength") + << true + << Qt::InputMethodHints(Qt::ImhDigitsOnly) + << 2 + << QLineEdit::Normal + << events + << QString("44") + << QString(""); + QTest::newRow("Numbers with movement, password and unfinished text") + << true + << Qt::InputMethodHints(Qt::ImhDigitsOnly) + << 0 + << QLineEdit::Password + << events + << QString("9680448") + << QString("8"); + QTest::newRow("Numbers with movement, maxlength, password and unfinished text") + << true + << Qt::InputMethodHints(Qt::ImhDigitsOnly) + << 2 + << QLineEdit::Password + << events + << QString("44") + << QString(""); + events << FepReplayEvent(EStdKeyRightArrow, EKeyRightArrow, 0, 0); + QTest::newRow("T9 with movement") + << true + << Qt::InputMethodHints(Qt::ImhPreferLowercase) + << 0 + << QLineEdit::Normal + << events + << QString("you htvi") + << QString(""); + QTest::newRow("T9 with movement and password") + << true + << Qt::InputMethodHints(Qt::ImhPreferLowercase) + << 0 + << QLineEdit::Password + << events + << QString("wmt hu") + << QString(""); + QTest::newRow("T9 with movement, maxlength and password") + << true + << Qt::InputMethodHints(Qt::ImhPreferLowercase) + << 2 + << QLineEdit::Password + << events + << QString("wh") + << QString(""); + QTest::newRow("Multitap with movement") + << true + << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhPreferLowercase) + << 0 + << QLineEdit::Normal + << events + << QString("wmt hu") + << QString(""); + QTest::newRow("Multitap with movement and maxlength") + << true + << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhPreferLowercase) + << 2 + << QLineEdit::Normal + << events + << QString("wh") + << QString(""); + QTest::newRow("Numbers with movement and password") + << true + << Qt::InputMethodHints(Qt::ImhDigitsOnly) + << 0 + << QLineEdit::Password + << events + << QString("96804488") + << QString(""); + QTest::newRow("Numbers with movement, maxlength and password") + << true + << Qt::InputMethodHints(Qt::ImhDigitsOnly) + << 2 + << QLineEdit::Password + << events + << QString("44") + << QString(""); + events.clear(); +#endif +} + +void tst_QInputContext::symbianTestCoeFepInputContext() +{ +#ifndef Q_OS_SYMBIAN + QSKIP("This is a Symbian-only test", SkipAll); +#else + QCoeFepInputContext *ic = qobject_cast<QCoeFepInputContext *>(qApp->inputContext()); + if (!ic) { + QSKIP("coefep is not the active input context; skipping test", SkipAll); + } + + QFETCH(bool, inputMethodEnabled); + QFETCH(Qt::InputMethodHints, inputMethodHints); + QFETCH(int, maxLength); + QFETCH(QLineEdit::EchoMode, echoMode); + QFETCH(QList<FepReplayEvent>, keyEvents); + QFETCH(QString, finalString); + QFETCH(QString, preeditString); + + if (inputMethodEnabled && m_phoneIsQwerty) { + QSKIP("Skipping advanced input method tests on QWERTY phones", SkipSingle); + } + + QWidget w; + QLayout *layout = new QVBoxLayout; + w.setLayout(layout); + QLineEdit *lineedit = new QLineEdit; + layout->addWidget(lineedit); + lineedit->setFocus(); +#ifdef QT_KEYPAD_NAVIGATION + lineedit->setEditFocus(true); +#endif + w.show(); + + lineedit->setAttribute(Qt::WA_InputMethodEnabled, inputMethodEnabled); + lineedit->setInputMethodHints(inputMethodHints); + if (maxLength > 0) + lineedit->setMaxLength(maxLength); + lineedit->setEchoMode(echoMode); + + QTest::qWait(200); + + foreach(FepReplayEvent event, keyEvents) { + event.replay(lineedit); + } + + QApplication::processEvents(); + + QCOMPARE(lineedit->text(), finalString); + QCOMPARE(ic->m_preeditString, preeditString); +#endif +} + QTEST_MAIN(tst_QInputContext) #include "tst_qinputcontext.moc" diff --git a/tests/auto/qkeysequence/tst_qkeysequence.cpp b/tests/auto/qkeysequence/tst_qkeysequence.cpp index 1faae6a..60f022f 100644 --- a/tests/auto/qkeysequence/tst_qkeysequence.cpp +++ b/tests/auto/qkeysequence/tst_qkeysequence.cpp @@ -532,20 +532,20 @@ void tst_QKeySequence::translated_data() QTest::addColumn<QString>("transKey"); QTest::addColumn<QString>("compKey"); - QTest::newRow("Shift++") << QString(tr("Shift++")) << QString("Umschalt++"); - QTest::newRow("Ctrl++") << QString(tr("Ctrl++")) << QString("Strg++"); - QTest::newRow("Alt++") << QString(tr("Alt++")) << QString("Alt++"); - QTest::newRow("Meta++") << QString(tr("Meta++")) << QString("Meta++"); - - QTest::newRow("Shift+,, Shift++") << QString(tr("Shift+,, Shift++")) << QString("Umschalt+,, Umschalt++"); - QTest::newRow("Shift+,, Ctrl++") << QString(tr("Shift+,, Ctrl++")) << QString("Umschalt+,, Strg++"); - QTest::newRow("Shift+,, Alt++") << QString(tr("Shift+,, Alt++")) << QString("Umschalt+,, Alt++"); - QTest::newRow("Shift+,, Meta++") << QString(tr("Shift+,, Meta++")) << QString("Umschalt+,, Meta++"); - - QTest::newRow("Ctrl+,, Shift++") << QString(tr("Ctrl+,, Shift++")) << QString("Strg+,, Umschalt++"); - QTest::newRow("Ctrl+,, Ctrl++") << QString(tr("Ctrl+,, Ctrl++")) << QString("Strg+,, Strg++"); - QTest::newRow("Ctrl+,, Alt++") << QString(tr("Ctrl+,, Alt++")) << QString("Strg+,, Alt++"); - QTest::newRow("Ctrl+,, Meta++") << QString(tr("Ctrl+,, Meta++")) << QString("Strg+,, Meta++"); + QTest::newRow("Shift++") << tr("Shift++") << QString("Umschalt++"); + QTest::newRow("Ctrl++") << tr("Ctrl++") << QString("Strg++"); + QTest::newRow("Alt++") << tr("Alt++") << QString("Alt++"); + QTest::newRow("Meta++") << tr("Meta++") << QString("Meta++"); + + QTest::newRow("Shift+,, Shift++") << tr("Shift+,, Shift++") << QString("Umschalt+,, Umschalt++"); + QTest::newRow("Shift+,, Ctrl++") << tr("Shift+,, Ctrl++") << QString("Umschalt+,, Strg++"); + QTest::newRow("Shift+,, Alt++") << tr("Shift+,, Alt++") << QString("Umschalt+,, Alt++"); + QTest::newRow("Shift+,, Meta++") << tr("Shift+,, Meta++") << QString("Umschalt+,, Meta++"); + + QTest::newRow("Ctrl+,, Shift++") << tr("Ctrl+,, Shift++") << QString("Strg+,, Umschalt++"); + QTest::newRow("Ctrl+,, Ctrl++") << tr("Ctrl+,, Ctrl++") << QString("Strg+,, Strg++"); + QTest::newRow("Ctrl+,, Alt++") << tr("Ctrl+,, Alt++") << QString("Strg+,, Alt++"); + QTest::newRow("Ctrl+,, Meta++") << tr("Ctrl+,, Meta++") << QString("Strg+,, Meta++"); qApp->removeTranslator(ourTranslator); qApp->removeTranslator(qtTranslator); diff --git a/tests/auto/qmake/qmake.pro b/tests/auto/qmake/qmake.pro index 8cae6be..d0faa87 100644 --- a/tests/auto/qmake/qmake.pro +++ b/tests/auto/qmake/qmake.pro @@ -1,6 +1,7 @@ load(qttest_p4) HEADERS += testcompiler.h SOURCES += tst_qmake.cpp testcompiler.cpp +QT -= gui cross_compile: DEFINES += QMAKE_CROSS_COMPILED diff --git a/tests/auto/qmake/testdata/substitutes/test.pro b/tests/auto/qmake/testdata/substitutes/test.pro index ddad93f..26b0272 100644 --- a/tests/auto/qmake/testdata/substitutes/test.pro +++ b/tests/auto/qmake/testdata/substitutes/test.pro @@ -1 +1,5 @@ -QMAKE_SUBSTITUTES += test.in sub/test2.in +QMAKE_SUBSTITUTES += test.in sub/test2.in indirect + +indirect.input = $$PWD/test3.txt +indirect.output = $$OUT_PWD/sub/indirect_test.txt + diff --git a/tests/auto/qmake/testdata/substitutes/test3.txt b/tests/auto/qmake/testdata/substitutes/test3.txt new file mode 100644 index 0000000..ce01362 --- /dev/null +++ b/tests/auto/qmake/testdata/substitutes/test3.txt @@ -0,0 +1 @@ +hello diff --git a/tests/auto/qmake/tst_qmake.cpp b/tests/auto/qmake/tst_qmake.cpp index 060fa01..1d3e128 100644 --- a/tests/auto/qmake/tst_qmake.cpp +++ b/tests/auto/qmake/tst_qmake.cpp @@ -99,7 +99,8 @@ private: tst_qmake::tst_qmake() { - QString cmd = QString("qmake \"QT_VERSION=%1\"").arg(QT_VERSION); + QString binpath = QLibraryInfo::location(QLibraryInfo::BinariesPath); + QString cmd = QString("%2/qmake \"QT_VERSION=%1\"").arg(QT_VERSION).arg(binpath); #ifdef Q_CC_MSVC test_compiler.setBaseCommands( "nmake", cmd ); #elif defined(Q_CC_MINGW) @@ -484,12 +485,14 @@ void tst_qmake::substitutes() QVERIFY( test_compiler.qmake( workDir, "test" )); QVERIFY( test_compiler.exists( workDir, "test", Plain, "" )); QVERIFY( test_compiler.exists( workDir, "sub/test2", Plain, "" )); + QVERIFY( test_compiler.exists( workDir, "sub/indirect_test.txt", Plain, "" )); QVERIFY( test_compiler.makeDistClean( workDir )); QString buildDir = base_path + "/testdata/substitutes_build"; QVERIFY( test_compiler.qmake( workDir, "test", buildDir )); QVERIFY( test_compiler.exists( buildDir, "test", Plain, "" )); QVERIFY( test_compiler.exists( buildDir, "sub/test2", Plain, "" )); + QVERIFY( test_compiler.exists( buildDir, "sub/indirect_test.txt", Plain, "" )); QVERIFY( test_compiler.makeDistClean( buildDir )); } diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 01d7783..306b5f8 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -289,6 +289,8 @@ private Q_SLOTS: void symbianOpenCDataUrlCrash(); + void qtbug12908compressedHttpReply(); + // NOTE: This test must be last! void parentingRepliesToTheApp(); }; @@ -4274,6 +4276,30 @@ void tst_QNetworkReply::symbianOpenCDataUrlCrash() QCOMPARE(reply->header(QNetworkRequest::ContentLengthHeader).toLongLong(), qint64(598)); } +// TODO: +// Prepare a gzip that has one chunk that expands to the size mentioned in the bugreport. +// Then have a custom HTTP server that waits after this chunk so the returning gets +// triggered. +void tst_QNetworkReply::qtbug12908compressedHttpReply() +{ + QString header("HTTP/1.0 200 OK\r\nContent-Encoding: gzip\r\nContent-Length: 63\r\n\r\n"); + + // dd if=/dev/zero of=qtbug-12908 bs=16384 count=1 && gzip qtbug-12908 && base64 -w 0 qtbug-12908.gz + QString encodedFile("H4sICDdDaUwAA3F0YnVnLTEyOTA4AO3BMQEAAADCoPVPbQwfoAAAAAAAAAAAAAAAAAAAAIC3AYbSVKsAQAAA"); + QByteArray decodedFile = QByteArray::fromBase64(encodedFile.toAscii()); + + MiniHttpServer server(header.toAscii() + decodedFile); + server.doClose = true; + + QNetworkRequest request(QUrl("http://localhost:" + QString::number(server.serverPort()))); + QNetworkReplyPtr reply = manager.get(request); + + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QCOMPARE(reply->error(), QNetworkReply::NoError); +} // NOTE: This test must be last testcase in tst_qnetworkreply! diff --git a/tests/auto/qpen/tst_qpen.cpp b/tests/auto/qpen/tst_qpen.cpp index 149f462..b0c2cad 100644 --- a/tests/auto/qpen/tst_qpen.cpp +++ b/tests/auto/qpen/tst_qpen.cpp @@ -213,6 +213,5 @@ void tst_QPen::stream() QCOMPARE(pen, cmp); } - QTEST_APPLESS_MAIN(tst_QPen) #include "tst_qpen.moc" diff --git a/tests/auto/qscriptengine/idtranslatable.js b/tests/auto/qscriptengine/idtranslatable.js new file mode 100644 index 0000000..554ca88 --- /dev/null +++ b/tests/auto/qscriptengine/idtranslatable.js @@ -0,0 +1,5 @@ +qsTrId("qtn_foo_bar"); + +var more_greeting_strings = [ QT_TRID_NOOP("qtn_needle"), QT_TRID_NOOP("qtn_haystack") ]; + +qsTrId("qtn_bar_baz", 10); diff --git a/tests/auto/qscriptengine/qscriptengine.qrc b/tests/auto/qscriptengine/qscriptengine.qrc index b87f985..fa55a5b 100644 --- a/tests/auto/qscriptengine/qscriptengine.qrc +++ b/tests/auto/qscriptengine/qscriptengine.qrc @@ -1,5 +1,6 @@ <!DOCTYPE RCC><RCC version="1.0"> <qresource> <file>translations/translatable_la.qm</file> + <file>translations/idtranslatable_la.qm</file> </qresource> </RCC> diff --git a/tests/auto/qscriptengine/translations/idtranslatable_la.qm b/tests/auto/qscriptengine/translations/idtranslatable_la.qm Binary files differnew file mode 100644 index 0000000..c8c0b72 --- /dev/null +++ b/tests/auto/qscriptengine/translations/idtranslatable_la.qm diff --git a/tests/auto/qscriptengine/translations/idtranslatable_la.ts b/tests/auto/qscriptengine/translations/idtranslatable_la.ts new file mode 100644 index 0000000..b6d7053 --- /dev/null +++ b/tests/auto/qscriptengine/translations/idtranslatable_la.ts @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="nb_NO"> +<context> + <name></name> + <message id="qtn_foo_bar"> + <location filename="idtranslatable.js" line="1"/> + <source></source> + <translation>First string</translation> + </message> + <message id="qtn_needle"> + <location filename="idtranslatable.js" line="3"/> + <source></source> + <translation>Second string</translation> + </message> + <message id="qtn_haystack"> + <location filename="idtranslatable.js" line="3"/> + <source></source> + <translation>Third string</translation> + </message> + <message id="qtn_bar_baz" numerus="yes"> + <location filename="idtranslatable.js" line="5"/> + <source></source> + <translation> + <numerusform>Fourth string</numerusform> + <numerusform>%n fooish bar(s) found</numerusform> + </translation> + </message> +</context> +</TS> diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index 7a732cc..4cff043 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -162,6 +162,7 @@ private slots: void translateWithInvalidArgs(); void translationContext_data(); void translationContext(); + void translateScriptIdBased(); void functionScopes(); void nativeFunctionScopes(); void evaluateProgram(); @@ -4386,6 +4387,8 @@ void tst_QScriptEngine::installTranslatorFunctions() QVERIFY(!global.property("QT_TRANSLATE_NOOP").isValid()); QVERIFY(!global.property("qsTr").isValid()); QVERIFY(!global.property("QT_TR_NOOP").isValid()); + QVERIFY(!global.property("qsTrId").isValid()); + QVERIFY(!global.property("QT_TRID_NOOP").isValid()); QVERIFY(!globalOrig.property("String").property("prototype").property("arg").isValid()); eng.installTranslatorFunctions(); @@ -4393,6 +4396,8 @@ void tst_QScriptEngine::installTranslatorFunctions() QVERIFY(global.property("QT_TRANSLATE_NOOP").isFunction()); QVERIFY(global.property("qsTr").isFunction()); QVERIFY(global.property("QT_TR_NOOP").isFunction()); + QVERIFY(global.property("qsTrId").isFunction()); + QVERIFY(global.property("QT_TRID_NOOP").isFunction()); QVERIFY(globalOrig.property("String").property("prototype").property("arg").isFunction()); if (useCustomGlobalObject) { @@ -4400,6 +4405,8 @@ void tst_QScriptEngine::installTranslatorFunctions() QVERIFY(!globalOrig.property("QT_TRANSLATE_NOOP").isValid()); QVERIFY(!globalOrig.property("qsTr").isValid()); QVERIFY(!globalOrig.property("QT_TR_NOOP").isValid()); + QVERIFY(!globalOrig.property("qsTrId").isValid()); + QVERIFY(!globalOrig.property("QT_TRID_NOOP").isValid()); } { @@ -4427,6 +4434,17 @@ void tst_QScriptEngine::installTranslatorFunctions() QVERIFY(ret.isString()); QCOMPARE(ret.toString(), QString::fromLatin1("foobar")); } + + { + QScriptValue ret = eng.evaluate("qsTrId('foo')"); + QVERIFY(ret.isString()); + QCOMPARE(ret.toString(), QString::fromLatin1("foo")); + } + { + QScriptValue ret = eng.evaluate("QT_TRID_NOOP('foo')"); + QVERIFY(ret.isString()); + QCOMPARE(ret.toString(), QString::fromLatin1("foo")); + } } static QScriptValue callQsTr(QScriptContext *ctx, QScriptEngine *eng) @@ -4537,6 +4555,10 @@ void tst_QScriptEngine::translateWithInvalidArgs_data() QTest::newRow("qsTranslate('foo', 'bar', 'baz', 123)") << "qsTranslate('foo', 'bar', 'baz', 123)" << "Error: qsTranslate(): fourth argument (encoding) must be a string"; QTest::newRow("qsTranslate('foo', 'bar', 'baz', 'zab', 'rab')") << "qsTranslate('foo', 'bar', 'baz', 'zab', 'rab')" << "Error: qsTranslate(): fifth argument (n) must be a number"; QTest::newRow("qsTranslate('foo', 'bar', 'baz', 'zab', 123)") << "qsTranslate('foo', 'bar', 'baz', 'zab', 123)" << "Error: qsTranslate(): invalid encoding 'zab'"; + + QTest::newRow("qsTrId()") << "qsTrId()" << "Error: qsTrId() requires at least one argument"; + QTest::newRow("qsTrId(123)") << "qsTrId(123)" << "TypeError: qsTrId(): first argument (id) must be a string"; + QTest::newRow("qsTrId('foo', 'bar')") << "qsTrId('foo', 'bar')" << "TypeError: qsTrId(): second argument (n) must be a number"; } void tst_QScriptEngine::translateWithInvalidArgs() @@ -4598,6 +4620,53 @@ void tst_QScriptEngine::translationContext() QCoreApplication::instance()->removeTranslator(&translator); } +void tst_QScriptEngine::translateScriptIdBased() +{ + QScriptEngine engine; + + QTranslator translator; + translator.load(":/translations/idtranslatable_la"); + QCoreApplication::instance()->installTranslator(&translator); + engine.installTranslatorFunctions(); + + QString fileName = QString::fromLatin1("idtranslatable.js"); + + QHash<QString, QString> expectedTranslations; + expectedTranslations["qtn_foo_bar"] = "First string"; + expectedTranslations["qtn_needle"] = "Second string"; + expectedTranslations["qtn_haystack"] = "Third string"; + expectedTranslations["qtn_bar_baz"] = "Fourth string"; + + QHash<QString, QString>::const_iterator it; + for (it = expectedTranslations.constBegin(); it != expectedTranslations.constEnd(); ++it) { + for (int x = 0; x < 2; ++x) { + QString fn; + if (x) + fn = fileName; + // Top-level + QCOMPARE(engine.evaluate(QString::fromLatin1("qsTrId('%0')") + .arg(it.key()), fn).toString(), + it.value()); + QCOMPARE(engine.evaluate(QString::fromLatin1("QT_TRID_NOOP('%0')") + .arg(it.key()), fn).toString(), + it.key()); + // From function + QCOMPARE(engine.evaluate(QString::fromLatin1("(function() { return qsTrId('%0'); })()") + .arg(it.key()), fn).toString(), + it.value()); + QCOMPARE(engine.evaluate(QString::fromLatin1("(function() { return QT_TRID_NOOP('%0'); })()") + .arg(it.key()), fn).toString(), + it.key()); + } + } + + // Plural form + QCOMPARE(engine.evaluate("qsTrId('qtn_bar_baz', 10)").toString(), + QString::fromLatin1("10 fooish bar(s) found")); + QCOMPARE(engine.evaluate("qsTrId('qtn_foo_bar', 10)").toString(), + QString::fromLatin1("qtn_foo_bar")); // Doesn't have plural +} + void tst_QScriptEngine::functionScopes() { QScriptEngine eng; diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index 6c1dd8f..d6a7a01 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -183,6 +183,7 @@ private slots: void ignoreSslErrorsListWithSlot(); void readFromClosedSocket(); void writeBigChunk(); + void setEmptyDefaultConfiguration(); static void exitLoop() { @@ -1835,6 +1836,21 @@ void tst_QSslSocket::writeBigChunk() socket->close(); } +void tst_QSslSocket::setEmptyDefaultConfiguration() +{ + // used to produce a crash in QSslConfigurationPrivate::deepCopyDefaultConfiguration, QTBUG-13265 + + if (!QSslSocket::supportsSsl()) + return; + + QSslConfiguration emptyConf; + QSslConfiguration::setDefaultConfiguration(emptyConf); + + QSslSocketPtr socket = newSocket(); + socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + +} + #endif // QT_NO_OPENSSL QTEST_MAIN(tst_QSslSocket) diff --git a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp index e370309..04b1e79 100644 --- a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -698,20 +698,25 @@ void tst_QStyleSheetStyle::fontPrecedence() QCOMPARE(FONTSIZE(edit2), 26); } -static bool testForColors(const QImage& image, const QColor& color) +// Ensure primary will only return true if the color covers more than 50% of pixels +static bool testForColors(const QImage& image, const QColor& color, bool ensurePrimary=false) { int count = 0; QRgb rgb = color.rgba(); + int totalCount = image.height()*image.width(); for (int y = 0; y < image.height(); ++y) { for (int x = 0; x < image.width(); ++x) { // Because of antialiasing we allow a certain range of errors here. QRgb pixel = image.pixel(x, y); + if (qAbs((int)(pixel & 0xff) - (int)(rgb & 0xff)) + qAbs((int)((pixel & 0xff00) >> 8) - (int)((rgb & 0xff00) >> 8)) + qAbs((int)((pixel & 0xff0000) >> 16) - (int)((rgb & 0xff0000) >> 16)) <= 50) { - if (++count >= 10) { + count++; + if (!ensurePrimary && count >=10 ) + return true; + else if (count > totalCount/2) return true; - } } } } @@ -1528,6 +1533,15 @@ void tst_QStyleSheetStyle::task188195_baseBackground() tree.render(&image); QVERIFY(testForColors(image, tree.palette().base().color())); QVERIFY(!testForColors(image, QColor(0xab, 0x12, 0x51))); + + QTableWidget table(12, 12); + table.setItem(0, 0, new QTableWidgetItem()); + table.setStyleSheet( "QTableView {background-color: #ff0000}" ); + table.show(); + QTest::qWait(20); + image = QImage(table.width(), table.height(), QImage::Format_ARGB32); + table.render(&image); + QVERIFY(testForColors(image, Qt::red, true)); } void tst_QStyleSheetStyle::task232085_spinBoxLineEditBg() diff --git a/tests/auto/qtimer/tst_qtimer.cpp b/tests/auto/qtimer/tst_qtimer.cpp index 8d213ed..b651187 100644 --- a/tests/auto/qtimer/tst_qtimer.cpp +++ b/tests/auto/qtimer/tst_qtimer.cpp @@ -161,8 +161,9 @@ void tst_QTimer::singleShotTimeout() QCOMPARE(helper.count, 1); } -#if defined(Q_OS_SYMBIAN) && defined(Q_CC_NOKIAX86) -// Increase wait as emulator startup can cause unexpected delays +#if defined(Q_OS_SYMBIAN) +// Increase wait as emulator startup can cause unexpected delays, and +// on hardware there are sometimes spikes right after process startup. #define TIMEOUT_TIMEOUT 2000 #else #define TIMEOUT_TIMEOUT 200 diff --git a/tests/auto/qtouchevent/tst_qtouchevent.cpp b/tests/auto/qtouchevent/tst_qtouchevent.cpp index bb80fde..4219ef4 100644 --- a/tests/auto/qtouchevent/tst_qtouchevent.cpp +++ b/tests/auto/qtouchevent/tst_qtouchevent.cpp @@ -109,6 +109,7 @@ class tst_QTouchEventGraphicsItem : public QGraphicsItem public: QList<QTouchEvent::TouchPoint> touchBeginPoints, touchUpdatePoints, touchEndPoints; bool seenTouchBegin, seenTouchUpdate, seenTouchEnd; + int touchBeginCounter, touchUpdateCounter, touchEndCounter; bool acceptTouchBegin, acceptTouchUpdate, acceptTouchEnd; bool deleteInTouchBegin, deleteInTouchUpdate, deleteInTouchEnd; tst_QTouchEventGraphicsItem **weakpointer; @@ -131,6 +132,7 @@ public: touchUpdatePoints.clear(); touchEndPoints.clear(); seenTouchBegin = seenTouchUpdate = seenTouchEnd = false; + touchBeginCounter = touchUpdateCounter = touchEndCounter = 0; acceptTouchBegin = acceptTouchUpdate = acceptTouchEnd = true; deleteInTouchBegin = deleteInTouchUpdate = deleteInTouchEnd = false; } @@ -146,6 +148,7 @@ public: if (seenTouchUpdate) qWarning("TouchBegin: TouchUpdate cannot happen before TouchBegin"); if (seenTouchEnd) qWarning("TouchBegin: TouchEnd cannot happen before TouchBegin"); seenTouchBegin = !seenTouchBegin && !seenTouchUpdate && !seenTouchEnd; + ++touchBeginCounter; touchBeginPoints = static_cast<QTouchEvent *>(event)->touchPoints(); event->setAccepted(acceptTouchBegin); if (deleteInTouchBegin) @@ -155,6 +158,7 @@ public: if (!seenTouchBegin) qWarning("TouchUpdate: have not seen TouchBegin"); if (seenTouchEnd) qWarning("TouchUpdate: TouchEnd cannot happen before TouchUpdate"); seenTouchUpdate = seenTouchBegin && !seenTouchEnd; + ++touchUpdateCounter; touchUpdatePoints = static_cast<QTouchEvent *>(event)->touchPoints(); event->setAccepted(acceptTouchUpdate); if (deleteInTouchUpdate) @@ -164,6 +168,7 @@ public: if (!seenTouchBegin) qWarning("TouchEnd: have not seen TouchBegin"); if (seenTouchEnd) qWarning("TouchEnd: already seen a TouchEnd"); seenTouchEnd = seenTouchBegin && !seenTouchEnd; + ++touchEndCounter; touchEndPoints = static_cast<QTouchEvent *>(event)->touchPoints(); event->setAccepted(acceptTouchEnd); if (deleteInTouchEnd) @@ -194,6 +199,7 @@ private slots: void deleteInEventHandler(); void deleteInRawEventTranslation(); void crashInQGraphicsSceneAfterNotHandlingTouchBegin(); + void touchBeginWithGraphicsWidget(); }; void tst_QTouchEvent::touchDisabledByDefault() @@ -1334,6 +1340,59 @@ void tst_QTouchEvent::crashInQGraphicsSceneAfterNotHandlingTouchBegin() QTest::touchEvent(view.viewport()).release(0, view.mapFromScene(QPoint(10, 10))); } +void tst_QTouchEvent::touchBeginWithGraphicsWidget() +{ + QGraphicsScene scene; + QGraphicsView view(&scene); + tst_QTouchEventGraphicsItem *root; + root = new tst_QTouchEventGraphicsItem; + root->setAcceptTouchEvents(true); + scene.addItem(root); + + QGraphicsWidget *glassWidget = new QGraphicsWidget; + glassWidget->setMinimumSize(100, 100); + scene.addItem(glassWidget); + + view.resize(200, 200); + view.show(); + QTest::qWaitForWindowShown(&view); + view.fitInView(scene.sceneRect()); + + QTest::touchEvent() + .press(0, view.mapFromScene(root->mapToScene(3,3)), view.viewport()); + QTest::touchEvent() + .stationary(0) + .press(1, view.mapFromScene(root->mapToScene(6,6)), view.viewport()); + QTest::touchEvent() + .release(0, view.mapFromScene(root->mapToScene(3,3)), view.viewport()) + .release(1, view.mapFromScene(root->mapToScene(6,6)), view.viewport()); + + QCOMPARE(root->touchBeginCounter, 1); + QCOMPARE(root->touchUpdateCounter, 1); + QCOMPARE(root->touchEndCounter, 1); + QCOMPARE(root->touchUpdatePoints.size(), 2); + + root->reset(); + glassWidget->setWindowFlags(Qt::Window); // make the glassWidget a panel + + QTest::touchEvent() + .press(0, view.mapFromScene(root->mapToScene(3,3)), view.viewport()); + QTest::touchEvent() + .stationary(0) + .press(1, view.mapFromScene(root->mapToScene(6,6)), view.viewport()); + QTest::touchEvent() + .release(0, view.mapFromScene(root->mapToScene(3,3)), view.viewport()) + .release(1, view.mapFromScene(root->mapToScene(6,6)), view.viewport()); + + QCOMPARE(root->touchBeginCounter, 0); + QCOMPARE(root->touchUpdateCounter, 0); + QCOMPARE(root->touchEndCounter, 0); + + + delete root; + delete glassWidget; +} + QTEST_MAIN(tst_QTouchEvent) #include "tst_qtouchevent.moc" diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index ef05b91..098ce3c 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -402,6 +402,8 @@ private slots: #endif // QT_MAC_USE_COCOA #endif + void nativeChildFocus(); + private: bool ensureScreenSize(int width, int height); QWidget *testWidget; @@ -10531,5 +10533,28 @@ void tst_QWidget::taskQTBUG_11373() #endif // QT_MAC_USE_COCOA #endif +void tst_QWidget::nativeChildFocus() +{ + QWidget w; + QLayout *layout = new QVBoxLayout; + w.setLayout(layout); + QLineEdit *p1 = new QLineEdit; + QLineEdit *p2 = new QLineEdit; + layout->addWidget(p1); + layout->addWidget(p2); + p1->setObjectName("p1"); + p2->setObjectName("p2"); + w.show(); + w.activateWindow(); + p1->setFocus(); + p1->setAttribute(Qt::WA_NativeWindow); + p2->setAttribute(Qt::WA_NativeWindow); + QApplication::processEvents(); + QTest::qWaitForWindowShown(&w); + + QCOMPARE(QApplication::activeWindow(), &w); + QCOMPARE(QApplication::focusWidget(), p1); +} + QTEST_MAIN(tst_QWidget) #include "tst_qwidget.moc" diff --git a/tests/benchmarks/corelib/tools/qstring/data.cpp b/tests/benchmarks/corelib/tools/qstring/data.cpp new file mode 100644 index 0000000..6d1a069 --- /dev/null +++ b/tests/benchmarks/corelib/tools/qstring/data.cpp @@ -0,0 +1,1284 @@ +// This is a generated file - DO NOT EDIT +static const ushort stringCollectionData[] __attribute__((aligned(16))) = { + // #0 + 65535, + 99, 111, 109, 112, 105, 108, 101, 114, 32, 118, 101, 114, 115, 105, 111, 110, 115, 47, + 65535,65534,65533,65532,65531, // 24 + 65535,65534,65533,65532,65531, + 99, 111, 109, 112, 105, 108, 101, 114, 32, 118, 101, 114, 115, 105, 111, 110, 115, 47, + 65535, // 48 + + // #1 + 65535,65534,65533,65532,65531, + 99, 111, 109, 112, 105, 108, 101, 114, 32, 118, 101, 114, 115, 105, 111, 110, 115, 47, + 65535, // 72 + 65535,65534,65533,65532,65531, + 67, 111, 109, 112, 105, 108, 101, 114, 32, 86, 101, 114, 115, 105, 111, 110, 115, 47, + 65535, // 96 + + // #2 + 65535, + 99, 111, 109, 112, 105, 108, 101, 114, 32, 116, 105, 109, 101, 115, 116, 97, 109, 112, 115, 47, + 65535,65534,65533, // 120 + 65535,65534,65533,65532,65531, + 99, 111, 109, 112, 105, 108, 101, 114, 32, 116, 105, 109, 101, 115, 116, 97, 109, 112, 115, 47, + 65535,65534,65533,65532,65531,65530,65529, // 152 + + // #3 + 65535,65534,65533,65532,65531, + 99, 111, 109, 112, 105, 108, 101, 114, 32, 116, 105, 109, 101, 115, 116, 97, 109, 112, 115, 47, + 65535,65534,65533,65532,65531,65530,65529, // 184 + 65535, + 67, 111, 109, 112, 105, 108, 101, 114, 32, 84, 105, 109, 101, 115, 116, 97, 109, 112, 115, 47, + 65535,65534,65533, // 208 + + // #4 + 65535,65534,65533,65532,65531,65530,65529,65528,65527,65526,65525,65524,65523,65522,65521,65520,65519, + 47, 118, 97, 114, 47, 116, 109, 112, 47, 116, 101, 97, 109, 98, 117, 105, 108, 100, 101, 114, 45, 116, 109, 97, 99, 105, 101, 105, 114, 47, 99, 108, 105, 101, 110, 116, 47, 99, 111, 109, 112, 105, 108, 101, 114, 115, 46, 99, 111, 110, 102, + 65535,65534,65533,65532, // 280+ + + + // #5 + 65535,65534,65533,65532,65531,65530,65529,65528,65527,65526,65525,65524,65523, + 47, 118, 97, 114, 47, 116, 109, 112, 47, 116, 101, 97, 109, 98, 117, 105, 108, 100, 101, 114, 45, 116, 109, 97, 99, 105, 101, 105, 114, 47, 99, 108, 105, 101, 110, 116, 47, 99, 111, 109, 112, 105, 108, 101, 114, 115, 46, 99, 111, 110, 102, + 65535,65534,65533,65532,65531,65530,65529,65528, // 352+ + 65535, + 47, 118, 97, 114, 47, 116, 109, 112, 47, 116, 101, 97, 109, 98, 117, 105, 108, 100, 101, 114, 45, 116, 109, 97, 99, 105, 101, 105, 114, 47, 99, 108, 105, 101, 110, 116, 47, 99, 111, 109, 112, 105, 108, 101, 114, 115, 46, 99, 111, 110, 102, + 65535,65534,65533,65532, // 408+ + + // #6 + 65535,65534,65533,65532,65531,65530,65529,65528,65527, + 47, 118, 97, 114, 47, 116, 109, 112, 47, 116, 101, 97, 109, 98, 117, 105, 108, 100, 101, 114, 45, 116, 109, 97, 99, 105, 101, 105, 114, 47, 99, 108, 105, 101, 110, 116, 47, 99, 111, 109, 112, 105, 108, 101, 114, 115, 46, 99, 111, 110, 102, + 65535,65534,65533,65532, // 472+ + + + // #7 + 65535, + 97, 114, 99, 104, 105, 118, 101, 100, 32, 99, 111, 109, 112, 105, 108, 101, 114, 115, 47, + 65535,65534,65533,65532, // 496 + 65535,65534,65533,65532,65531, + 97, 114, 99, 104, 105, 118, 101, 100, 32, 99, 111, 109, 112, 105, 108, 101, 114, 115, 47, + 65535,65534,65533,65532,65531,65530,65529,65528, // 528 + + // #8 + 65535,65534,65533,65532,65531, + 97, 114, 99, 104, 105, 118, 101, 100, 32, 99, 111, 109, 112, 105, 108, 101, 114, 115, 47, + 65535,65534,65533,65532,65531,65530,65529,65528, // 560 + 65535,65534,65533,65532,65531, + 65, 114, 99, 104, 105, 118, 101, 100, 32, 67, 111, 109, 112, 105, 108, 101, 114, 115, 47, + 65535,65534,65533,65532,65531,65530,65529,65528, // 592 + + // #9 + 65535,65534,65533,65532,65531,65530,65529,65528,65527,65526,65525,65524,65523,65522,65521,65520,65519, + 47, 118, 97, 114, 47, 116, 109, 112, 47, 116, 101, 97, 109, 98, 117, 105, 108, 100, 101, 114, 45, 116, 109, 97, 99, 105, 101, 105, 114, 47, 99, 108, 105, 101, 110, 116, 47, 99, 111, 109, 112, 105, 108, 101, 114, 115, 46, 99, 111, 110, 102, + 65535,65534,65533,65532, // 664+ + 65535,65534,65533,65532,65531,65530,65529,65528,65527,65526,65525,65524,65523, + 47, 118, 97, 114, 47, 116, 109, 112, 47, 116, 101, 97, 109, 98, 117, 105, 108, 100, 101, 114, 45, 116, 109, 97, 99, 105, 101, 105, 114, 47, 99, 108, 105, 101, 110, 116, 47, 99, 111, 109, 112, 105, 108, 101, 114, 115, 46, 99, 111, 110, 102, + 65535,65534,65533,65532,65531,65530,65529,65528, // 736+ + + // #10 + 65535,65534,65533,65532,65531, + 76, 105, 110, 117, 120, + 65535,65534,65533,65532,65531,65530, // 752 + 65535, + 76, 105, 110, 117, 120, + 65535,65534, // 760 + + // #11 + 65535,65534,65533,65532,65531, + 105, 51, 56, 54, + 65535,65534,65533,65532,65531,65530,65529, // 776 + 65535,65534,65533,65532,65531, + 105, 51, 56, 54, + 65535,65534,65533,65532,65531,65530,65529, // 792 + + // #12 + 65535, + 105, 99, 99, + 65535,65534,65533,65532, // 800 + 65535,65534,65533,65532,65531, + 103, 43, 43, + 65535,65534,65533,65532,65531,65530,65529,65528, // 816 + + // #13 + 65535, + 76, 105, 110, 117, 120, + 65535,65534, // 824 + 65535, + 76, 105, 110, 117, 120, + 65535,65534, // 832 + + // #14 + 65535, + 105, 51, 56, 54, + 65535,65534,65533, // 840 + 65535,65534,65533,65532,65531, + 105, 51, 56, 54, + 65535,65534,65533,65532,65531,65530,65529, // 856 + + // #15 + 65535, + 76, 105, 110, 117, 120, + 65535,65534, // 864 + 65535, + 76, 105, 110, 117, 120, + 65535,65534, // 872 + + // #16 + 65535, + 105, 51, 56, 54, + 65535,65534,65533, // 880 + 65535,65534,65533,65532,65531, + 105, 51, 56, 54, + 65535,65534,65533,65532,65531,65530,65529, // 896 + + // #17 + 65535, + 103, 99, 99, + 65535,65534,65533,65532, // 904 + 65535,65534,65533,65532,65531, + 103, 43, 43, + 65535,65534,65533,65532,65531,65530,65529,65528, // 920 + + // #18 + 65535,65534,65533,65532,65531, + 76, 105, 110, 117, 120, + 65535,65534,65533,65532,65531,65530, // 936 + 65535, + 76, 105, 110, 117, 120, + 65535,65534, // 944 + + // #19 + 65535,65534,65533,65532,65531, + 105, 51, 56, 54, + 65535,65534,65533,65532,65531,65530,65529, // 960 + 65535,65534,65533,65532,65531, + 105, 51, 56, 54, + 65535,65534,65533,65532,65531,65530,65529, // 976 + + // #20 + 65535, + 103, 43, 43, + 65535,65534,65533,65532, // 984 + 65535,65534,65533,65532,65531, + 103, 43, 43, + 65535,65534,65533,65532,65531,65530,65529,65528, // 1000 + + // #21 + 65535,65534,65533,65532,65531, + 52, 46, 52, 46, 51, + 65535,65534,65533,65532,65531,65530, // 1016 + 65535,65534,65533,65532,65531, + 52, 46, 52, 46, 51, + 65535,65534,65533,65532,65531,65530, // 1032 + + // #22 + 65535, + 76, 105, 110, 117, 120, + 65535,65534, // 1040 + 65535, + 76, 105, 110, 117, 120, + 65535,65534, // 1048 + + // #23 + 65535,65534,65533,65532,65531, + 105, 51, 56, 54, + 65535,65534,65533,65532,65531,65530,65529, // 1064 + 65535,65534,65533,65532,65531, + 105, 51, 56, 54, + 65535,65534,65533,65532,65531,65530,65529, // 1080 + + // #24 + 65535, + 47, 117, 115, 114, 47, 98, 105, 110, 47, 103, 43, 43, + 65535,65534,65533, // 1096 + 65535, + 47, 117, 115, 114, 47, 98, 105, 110, 47, 103, 43, 43, + 65535,65534,65533, // 1112 + + // #25 + 65535, + 76, 105, 110, 117, 120, + 65535,65534, // 1120 + 65535, + 76, 105, 110, 117, 120, + 65535,65534, // 1128 + + // #26 + 65535, + 105, 51, 56, 54, + 65535,65534,65533, // 1136 + 65535,65534,65533,65532,65531, + 105, 51, 56, 54, + 65535,65534,65533,65532,65531,65530,65529, // 1152 + + // #27 + 65535, + 105, 99, 99, + 65535,65534,65533,65532, // 1160 + 65535,65534,65533,65532,65531, + 103, 43, 43, + 65535,65534,65533,65532,65531,65530,65529,65528, // 1176 + + // #28 + 65535, + 76, 105, 110, 117, 120, + 65535,65534, // 1184 + 65535, + 76, 105, 110, 117, 120, + 65535,65534, // 1192 + + // #29 + 65535, + 105, 51, 56, 54, + 65535,65534,65533, // 1200 + 65535,65534,65533,65532,65531, + 105, 51, 56, 54, + 65535,65534,65533,65532,65531,65530,65529, // 1216 + + // #30 + 65535,65534,65533,65532,65531, + 76, 105, 110, 117, 120, + 65535,65534,65533,65532,65531,65530, // 1232 + 65535, + 76, 105, 110, 117, 120, + 65535,65534, // 1240 + + // #31 + 65535,65534,65533,65532,65531, + 105, 51, 56, 54, + 65535,65534,65533,65532,65531,65530,65529, // 1256 + 65535,65534,65533,65532,65531, + 105, 51, 56, 54, + 65535,65534,65533,65532,65531,65530,65529, // 1272 + + // #32 + 65535,65534,65533,65532,65531, + 76, 105, 110, 117, 120, + 65535,65534,65533,65532,65531,65530, // 1288 + 65535, + 76, 105, 110, 117, 120, + 65535,65534, // 1296 + + // #33 + 65535,65534,65533,65532,65531, + 105, 51, 56, 54, + 65535,65534,65533,65532,65531,65530,65529, // 1312 + 65535,65534,65533,65532,65531, + 105, 51, 56, 54, + 65535,65534,65533,65532,65531,65530,65529, // 1328 + + // #34 + 65535, + 45, 109, 97, 114, 99, 104, 61, 99, 111, 114, 101, 50, + 65535,65534,65533, // 1344 + 65535, + 116, 98, 51, 54, 57, 54, 56, 95, 50, 46, 105, 105, + 65535,65534,65533, // 1360 + + // #35 + 65535,65534,65533,65532,65531, + 45, 102, 108, 111, 111, 112, 45, 98, 108, 111, 99, 107, + 65535,65534,65533,65532,65531,65530,65529, // 1384 + 65535, + 116, 98, 51, 54, 57, 54, 56, 95, 50, 46, 105, 105, + 65535,65534,65533, // 1400 + + // #36 + 65535,65534,65533,65532,65531, + 116, 98, 51, 54, 57, 54, 56, 95, 50, 46, 105, 105, + 65535,65534,65533,65532,65531,65530,65529, // 1424 + 65535, + 116, 98, 51, 54, 57, 54, 56, 95, 50, 46, 105, 105, + 65535,65534,65533, // 1440 + + // #37 + 65535,65534,65533,65532,65531, + 45, 109, 115, 115, 101, 52, + 65535,65534,65533,65532,65531, // 1456 + 65535,65534,65533,65532,65531, + 108, 101, 110, 103, 116, 104, + 65535,65534,65533,65532,65531, // 1472 + + // #38 + 65535,65534,65533,65532,65531, + 116, 98, 51, 54, 57, 54, 56, 95, 49, 46, 111, + 65535,65534,65533,65532,65531,65530,65529,65528, // 1496 + 65535,65534,65533,65532,65531, + 116, 98, 51, 54, 57, 54, 56, 95, 49, 46, 111, + 65535,65534,65533,65532,65531,65530,65529,65528, // 1520 + + // #39 + 65535,65534,65533,65532,65531, + 68, 69, 83, 75, 84, 79, 80, 95, 83, 69, 83, 83, + 65535,65534,65533,65532,65531,65530,65529, // 1544 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 1560 + + // #40 + 65535,65534,65533,65532,65531, + 76, 67, 95, 83, 79, 85, 82, 67, 69, 68, 61, 49, + 65535,65534,65533,65532,65531,65530,65529, // 1584 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 1600 + + // #41 + 65535,65534,65533,65532,65531, + 81, 84, 68, 73, 82, 61, 47, 104, 111, 109, 101, 47, + 65535,65534,65533,65532,65531,65530,65529, // 1624 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 1640 + + // #42 + 65535, + 76, 67, 95, 67, 84, 89, 80, 69, 61, 112, 116, 95, + 65535,65534,65533, // 1656 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 1672 + + // #43 + 65535, + 71, 84, 75, 95, 82, 67, 95, 70, 73, 76, 69, 83, + 65535,65534,65533, // 1688 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 1704 + + // #44 + 65535, + 88, 77, 79, 68, 73, 70, 73, 69, 82, 83, 61, 64, + 65535,65534,65533, // 1720 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 1736 + + // #45 + 65535, + 83, 72, 69, 76, 76, 61, 47, 98, 105, 110, 47, 122, + 65535,65534,65533, // 1752 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 1768 + + // #46 + 65535,65534,65533,65532,65531, + 85, 61, 64, 123, 117, 112, 115, 116, 114, 101, 97, 109, + 65535,65534,65533,65532,65531,65530,65529, // 1792 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 1808 + + // #47 + 65535, + 95, 61, 47, 117, 115, 114, 47, 98, 105, 110, 47, 105, + 65535,65534,65533, // 1824 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 1840 + + // #48 + 65535, + 88, 68, 71, 95, 67, 79, 78, 70, 73, 71, 95, 68, + 65535,65534,65533, // 1856 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 1872 + + // #49 + 65535,65534,65533,65532,65531, + 83, 65, 86, 69, 72, 73, 83, 84, 61, 49, 48, 48, + 65535,65534,65533,65532,65531,65530,65529, // 1896 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 1912 + + // #50 + 65535, + 75, 68, 69, 95, 77, 85, 76, 84, 73, 72, 69, 65, + 65535,65534,65533, // 1928 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 1944 + + // #51 + 65535,65534,65533,65532,65531, + 77, 65, 76, 76, 79, 67, 95, 67, 72, 69, 67, 75, + 65535,65534,65533,65532,65531,65530,65529, // 1968 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 1984 + + // #52 + 65535,65534,65533,65532,65531, + 72, 73, 83, 84, 67, 79, 78, 84, 82, 79, 76, 61, + 65535,65534,65533,65532,65531,65530,65529, // 2008 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 2024 + + // #53 + 65535,65534,65533,65532,65531, + 88, 68, 71, 95, 68, 65, 84, 65, 95, 68, 73, 82, + 65535,65534,65533,65532,65531,65530,65529, // 2048 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 2064 + + // #54 + 65535,65534,65533,65532,65531, + 88, 68, 77, 95, 77, 65, 78, 65, 71, 69, 68, 61, + 65535,65534,65533,65532,65531,65530,65529, // 2088 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 2104 + + // #55 + 65535, + 76, 67, 95, 67, 79, 76, 76, 65, 84, 69, 61, 112, + 65535,65534,65533, // 2120 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 2136 + + // #56 + 65535, + 81, 84, 95, 80, 76, 85, 71, 73, 78, 95, 80, 65, + 65535,65534,65533, // 2152 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 2168 + + // #57 + 65535, + 83, 67, 82, 69, 69, 78, 68, 73, 82, 61, 47, 104, + 65535,65534,65533, // 2184 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 2200 + + // #58 + 65535,65534,65533,65532,65531, + 76, 69, 83, 83, 79, 80, 69, 78, 61, 124, 47, 117, + 65535,65534,65533,65532,65531,65530,65529, // 2224 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 2240 + + // #59 + 65535, + 76, 67, 95, 78, 65, 77, 69, 61, 110, 98, 95, 78, + 65535,65534,65533, // 2256 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 2272 + + // #60 + 65535,65534,65533,65532,65531, + 80, 52, 67, 76, 73, 69, 78, 84, 61, 116, 109, 97, + 65535,65534,65533,65532,65531,65530,65529, // 2296 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 2312 + + // #61 + 65535, + 80, 65, 84, 72, 61, 47, 104, 111, 109, 101, 47, 116, + 65535,65534,65533, // 2328 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 2344 + + // #62 + 65535,65534,65533,65532,65531, + 71, 80, 71, 95, 65, 71, 69, 78, 84, 95, 73, 78, + 65535,65534,65533,65532,65531,65530,65529, // 2368 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 2384 + + // #63 + 65535,65534,65533,65532,65531, + 88, 67, 85, 82, 83, 79, 82, 95, 84, 72, 69, 77, + 65535,65534,65533,65532,65531,65530,65529, // 2408 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 2424 + + // #64 + 65535,65534,65533,65532,65531, + 83, 69, 83, 83, 73, 79, 78, 95, 77, 65, 78, 65, + 65535,65534,65533,65532,65531,65530,65529, // 2448 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 2464 + + // #65 + 65535, + 81, 84, 83, 82, 67, 68, 73, 82, 61, 47, 104, 111, + 65535,65534,65533, // 2480 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 2496 + + // #66 + 65535,65534,65533,65532,65531, + 87, 73, 78, 68, 79, 87, 73, 68, 61, 52, 54, 49, + 65535,65534,65533,65532,65531,65530,65529, // 2520 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 2536 + + // #67 + 65535,65534,65533,65532,65531, + 76, 67, 95, 77, 69, 83, 83, 65, 71, 69, 83, 61, + 65535,65534,65533,65532,65531,65530,65529, // 2560 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 2576 + + // #68 + 65535, + 76, 67, 95, 78, 85, 77, 69, 82, 73, 67, 61, 110, + 65535,65534,65533, // 2592 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 2608 + + // #69 + 65535, + 71, 84, 75, 50, 95, 82, 67, 95, 70, 73, 76, 69, + 65535,65534,65533, // 2624 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 2640 + + // #70 + 65535, + 80, 82, 79, 70, 73, 76, 69, 72, 79, 77, 69, 61, + 65535,65534,65533, // 2656 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 2672 + + // #71 + 65535,65534,65533,65532,65531, + 68, 77, 95, 67, 79, 78, 84, 82, 79, 76, 61, 47, + 65535,65534,65533,65532,65531,65530,65529, // 2696 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 2712 + + // #72 + 65535, + 76, 83, 95, 67, 79, 76, 79, 82, 83, 61, 114, 115, + 65535,65534,65533, // 2728 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 2744 + + // #73 + 65535,65534,65533,65532,65531, + 83, 83, 72, 95, 65, 85, 84, 72, 95, 83, 79, 67, + 65535,65534,65533,65532,65531,65530,65529, // 2768 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 2784 + + // #74 + 65535,65534,65533,65532,65531, + 75, 68, 69, 68, 73, 82, 83, 61, 47, 104, 111, 109, + 65535,65534,65533,65532,65531,65530,65529, // 2808 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 2824 + + // #75 + 65535,65534,65533,65532,65531, + 76, 68, 95, 80, 82, 69, 76, 79, 65, 68, 61, 47, + 65535,65534,65533,65532,65531,65530,65529, // 2848 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 2864 + + // #76 + 65535,65534,65533,65532,65531, + 88, 67, 85, 82, 83, 79, 82, 95, 80, 65, 84, 72, + 65535,65534,65533,65532,65531,65530,65529, // 2888 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 2904 + + // #77 + 65535, + 115, 114, 99, 100, 105, 114, 61, 47, 104, 111, 109, 101, + 65535,65534,65533, // 2920 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 2936 + + // #78 + 65535,65534,65533,65532,65531, + 72, 79, 77, 69, 61, 47, 104, 111, 109, 101, 47, 116, + 65535,65534,65533,65532,65531,65530,65529, // 2960 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 2976 + + // #79 + 65535, + 81, 84, 52, 68, 79, 67, 68, 73, 82, 61, 47, 117, + 65535,65534,65533, // 2992 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 3008 + + // #80 + 65535,65534,65533,65532,65531, + 80, 87, 68, 61, 47, 104, 111, 109, 101, 47, 116, 109, + 65535,65534,65533,65532,65531,65530,65529, // 3032 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 3048 + + // #81 + 65535,65534,65533,65532,65531, + 75, 68, 69, 95, 83, 69, 83, 83, 73, 79, 78, 95, + 65535,65534,65533,65532,65531,65530,65529, // 3072 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 3088 + + // #82 + 65535, + 73, 78, 83, 73, 68, 69, 95, 83, 80, 69, 67, 73, + 65535,65534,65533, // 3104 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 3120 + + // #83 + 65535, + 83, 83, 72, 95, 65, 71, 69, 78, 84, 95, 80, 73, + 65535,65534,65533, // 3136 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 3152 + + // #84 + 65535, + 80, 75, 71, 95, 67, 79, 78, 70, 73, 71, 95, 80, + 65535,65534,65533, // 3168 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 3184 + + // #85 + 65535,65534,65533,65532,65531, + 68, 66, 85, 83, 95, 83, 69, 83, 83, 73, 79, 78, + 65535,65534,65533,65532,65531,65530,65529, // 3208 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 3224 + + // #86 + 65535, + 76, 68, 95, 76, 73, 66, 82, 65, 82, 89, 95, 80, + 65535,65534,65533, // 3240 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 3256 + + // #87 + 65535,65534,65533,65532,65531, + 80, 52, 85, 83, 69, 82, 61, 116, 106, 109, 97, 99, + 65535,65534,65533,65532,65531,65530,65529, // 3280 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 3296 + + // #88 + 65535,65534,65533,65532,65531, + 81, 84, 69, 83, 84, 95, 67, 79, 76, 79, 82, 69, + 65535,65534,65533,65532,65531,65530,65529, // 3320 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 3336 + + // #89 + 65535,65534,65533,65532,65531, + 88, 68, 71, 95, 83, 69, 83, 83, 73, 79, 78, 95, + 65535,65534,65533,65532,65531,65530,65529, // 3360 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 3376 + + // #90 + 65535,65534,65533,65532,65531, + 76, 69, 83, 83, 75, 69, 89, 61, 47, 101, 116, 99, + 65535,65534,65533,65532,65531,65530,65529, // 3400 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 3416 + + // #91 + 65535, + 76, 79, 71, 78, 65, 77, 69, 61, 116, 109, 97, 99, + 65535,65534,65533, // 3432 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 3448 + + // #92 + 65535, + 71, 95, 70, 73, 76, 69, 78, 65, 77, 69, 95, 69, + 65535,65534,65533, // 3464 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 3480 + + // #93 + 65535, + 75, 68, 69, 95, 70, 85, 76, 76, 95, 83, 69, 83, + 65535,65534,65533, // 3496 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 3512 + + // #94 + 65535,65534,65533,65532,65531, + 72, 79, 83, 84, 78, 65, 77, 69, 61, 108, 111, 116, + 65535,65534,65533,65532,65531,65530,65529, // 3536 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 3552 + + // #95 + 65535,65534,65533,65532,65531, + 76, 67, 95, 84, 73, 77, 69, 61, 112, 116, 95, 66, + 65535,65534,65533,65532,65531,65530,65529, // 3576 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 3592 + + // #96 + 65535, + 83, 83, 72, 95, 65, 83, 75, 80, 65, 83, 83, 61, + 65535,65534,65533, // 3608 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 3624 + + // #97 + 65535,65534,65533,65532,65531, + 72, 73, 83, 84, 70, 73, 76, 69, 61, 47, 104, 111, + 65535,65534,65533,65532,65531,65530,65529, // 3648 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 3664 + + // #98 + 65535, + 75, 79, 78, 83, 79, 76, 69, 95, 68, 66, 85, 83, + 65535,65534,65533, // 3680 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 3696 + + // #99 + 65535, + 77, 65, 75, 69, 61, 47, 117, 115, 114, 47, 98, 105, + 65535,65534,65533, // 3712 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 3728 + + // #100 + 65535, + 67, 65, 78, 66, 69, 82, 82, 65, 95, 68, 82, 73, + 65535,65534,65533, // 3744 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 3760 + + // #101 + 65535, + 71, 67, 79, 78, 70, 95, 84, 77, 80, 68, 73, 82, + 65535,65534,65533, // 3776 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 3792 + + // #102 + 65535,65534,65533,65532,65531, + 85, 83, 69, 82, 61, 116, 109, 97, 99, 105, 101, 105, + 65535,65534,65533,65532,65531,65530,65529, // 3816 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 3832 + + // #103 + 65535, + 111, 98, 106, 100, 105, 114, 61, 47, 104, 111, 109, 101, + 65535,65534,65533, // 3848 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 3864 + + // #104 + 65535,65534,65533,65532,65531, + 76, 67, 95, 77, 79, 78, 69, 84, 65, 82, 89, 61, + 65535,65534,65533,65532,65531,65530,65529, // 3888 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 3904 + + // #105 + 65535,65534,65533,65532,65531, + 81, 84, 76, 73, 66, 61, 47, 117, 115, 114, 47, 108, + 65535,65534,65533,65532,65531,65530,65529, // 3928 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 3944 + + // #106 + 65535,65534,65533,65532,65531, + 76, 67, 95, 84, 69, 76, 69, 80, 72, 79, 78, 69, + 65535,65534,65533,65532,65531,65530,65529, // 3968 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 3984 + + // #107 + 65535, + 80, 89, 84, 72, 79, 78, 68, 79, 78, 84, 87, 82, + 65535,65534,65533, // 4000 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 4016 + + // #108 + 65535,65534,65533,65532,65531, + 84, 77, 80, 68, 73, 82, 61, 47, 116, 109, 112, 47, + 65535,65534,65533,65532,65531,65530,65529, // 4040 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 4056 + + // #109 + 65535,65534,65533,65532,65531, + 65, 82, 77, 76, 77, 68, 95, 76, 73, 67, 69, 78, + 65535,65534,65533,65532,65531,65530,65529, // 4080 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 4096 + + // #110 + 65535, + 80, 89, 84, 72, 79, 78, 80, 65, 84, 72, 61, 47, + 65535,65534,65533, // 4112 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 4128 + + // #111 + 65535,65534,65533,65532,65531, + 77, 65, 75, 69, 70, 76, 65, 71, 83, 61, 119, 32, + 65535,65534,65533,65532,65531,65530,65529, // 4152 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 4168 + + // #112 + 65535, + 77, 70, 76, 65, 71, 83, 61, 45, 119, 32, 45, 45, + 65535,65534,65533, // 4184 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 4200 + + // #113 + 65535, + 77, 65, 73, 76, 61, 47, 118, 97, 114, 47, 115, 112, + 65535,65534,65533, // 4216 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 4232 + + // #114 + 65535,65534,65533,65532,65531, + 83, 72, 69, 76, 76, 95, 83, 69, 83, 83, 73, 79, + 65535,65534,65533,65532,65531,65530,65529, // 4256 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 4272 + + // #115 + 65535, + 75, 68, 69, 68, 73, 82, 61, 47, 104, 111, 109, 101, + 65535,65534,65533, // 4288 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 4304 + + // #116 + 65535,65534,65533,65532,65531, + 76, 69, 83, 83, 67, 72, 65, 82, 83, 69, 84, 61, + 65535,65534,65533,65532,65531,65530,65529, // 4328 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 4344 + + // #117 + 65535,65534,65533,65532,65531, + 76, 67, 95, 80, 65, 80, 69, 82, 61, 110, 98, 95, + 65535,65534,65533,65532,65531,65530,65529, // 4368 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 4384 + + // #118 + 65535, + 66, 82, 79, 87, 83, 69, 82, 61, 47, 117, 115, 114, + 65535,65534,65533, // 4400 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 4416 + + // #119 + 65535, + 77, 69, 84, 65, 95, 67, 76, 65, 83, 83, 61, 100, + 65535,65534,65533, // 4432 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 4448 + + // #120 + 65535,65534,65533,65532,65531, + 77, 68, 86, 95, 77, 69, 78, 85, 95, 83, 84, 89, + 65535,65534,65533,65532,65531,65530,65529, // 4472 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 4488 + + // #121 + 65535,65534,65533,65532,65531, + 67, 79, 76, 79, 82, 70, 71, 66, 71, 61, 49, 53, + 65535,65534,65533,65532,65531,65530,65529, // 4512 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 4528 + + // #122 + 65535,65534,65533,65532,65531, + 80, 89, 84, 72, 79, 78, 83, 84, 65, 82, 84, 85, + 65535,65534,65533,65532,65531,65530,65529, // 4552 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 4568 + + // #123 + 65535, + 76, 67, 95, 77, 69, 65, 83, 85, 82, 69, 77, 69, + 65535,65534,65533, // 4584 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 4600 + + // #124 + 65535,65534,65533,65532,65531, + 69, 68, 73, 84, 79, 82, 61, 47, 117, 115, 114, 47, + 65535,65534,65533,65532,65531,65530,65529, // 4624 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 4640 + + // #125 + 65535,65534,65533,65532,65531, + 69, 78, 95, 84, 66, 61, 109, 111, 99, 58, 117, 105, + 65535,65534,65533,65532,65531,65530,65529, // 4664 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 4680 + + // #126 + 65535, + 72, 73, 83, 84, 83, 73, 90, 69, 61, 49, 48, 48, + 65535,65534,65533, // 4696 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 4712 + + // #127 + 65535,65534,65533,65532,65531, + 71, 83, 95, 76, 73, 66, 61, 47, 104, 111, 109, 101, + 65535,65534,65533,65532,65531,65530,65529, // 4736 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 4752 + + // #128 + 65535,65534,65533,65532,65531, + 78, 76, 83, 80, 65, 84, 72, 61, 47, 117, 115, 114, + 65535,65534,65533,65532,65531,65530,65529, // 4776 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 4792 + + // #129 + 65535,65534,65533,65532,65531, + 87, 73, 78, 68, 79, 87, 80, 65, 84, 72, 61, 55, + 65535,65534,65533,65532,65531,65530,65529, // 4816 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 4832 + + // #130 + 65535,65534,65533,65532,65531, + 75, 79, 78, 83, 79, 76, 69, 95, 68, 66, 85, 83, + 65535,65534,65533,65532,65531,65530,65529, // 4856 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 4872 + + // #131 + 65535, + 76, 67, 95, 73, 68, 69, 78, 84, 73, 70, 73, 67, + 65535,65534,65533, // 4888 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 4904 + + // #132 + 65535, + 73, 78, 80, 85, 84, 82, 67, 61, 47, 101, 116, 99, + 65535,65534,65533, // 4920 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 4936 + + // #133 + 65535,65534,65533,65532,65531, + 81, 84, 73, 78, 67, 61, 47, 117, 115, 114, 47, 108, + 65535,65534,65533,65532,65531,65530,65529, // 4960 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 4976 + + // #134 + 65535, + 76, 67, 95, 65, 68, 68, 82, 69, 83, 83, 61, 110, + 65535,65534,65533, // 4992 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 5008 + + // #135 + 65535,65534,65533,65532,65531, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 95, + 65535,65534,65533,65532,65531,65530,65529, // 5032 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 5048 + + // #136 + 65535, + 76, 65, 78, 71, 61, 112, 116, 95, 66, 82, 46, 85, + 65535,65534,65533, // 5064 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 5080 + + // #137 + 65535, + 80, 52, 80, 79, 82, 84, 61, 112, 52, 46, 116, 114, + 65535,65534,65533, // 5096 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 5112 + + // #138 + 65535,65534,65533,65532,65531, + 80, 73, 76, 79, 84, 80, 79, 82, 84, 61, 117, 115, + 65535,65534,65533,65532,65531,65530,65529, // 5136 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 5152 + + // #139 + 65535, + 75, 68, 69, 95, 83, 69, 83, 83, 73, 79, 78, 95, + 65535,65534,65533, // 5168 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 5184 + + // #140 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 5200 + 65535, + 84, 69, 65, 77, 66, 85, 73, 76, 68, 69, 82, 61, + 65535,65534,65533, // 5216 + + +}; +static struct StringCollection +{ + int len; + int offset1, offset2; + ushort align1, align2; +} stringCollection[] = { + {18, 1, 29, 3666, 106}, // #0 + {18, 53, 77, 106, 1978}, // #1 + {20, 97, 125, 2850, 3210}, // #2 + {20, 157, 185, 3210, 3138}, // #3 + {51, 225, 225, 3362, 3362}, // #4 + {51, 293, 353, 1434, 3362}, // #5 + {51, 417, 417, 3362, 3362}, // #6 + {19, 473, 501, 2850, 10}, // #7 + {19, 533, 565, 10, 442}, // #8 + {51, 609, 677, 3362, 1434}, // #9 + {5, 741, 753, 2666, 2066}, // #10 + {4, 765, 781, 2362, 3930}, // #11 + {3, 793, 805, 3330, 2138}, // #12 + {5, 817, 825, 738, 2066}, // #13 + {4, 833, 845, 434, 3930}, // #14 + {5, 857, 865, 3842, 2066}, // #15 + {4, 873, 885, 3538, 3930}, // #16 + {3, 897, 909, 3330, 2138}, // #17 + {5, 925, 937, 1898, 2066}, // #18 + {4, 949, 965, 1594, 3930}, // #19 + {3, 977, 989, 3330, 2138}, // #20 + {5, 1005, 1021, 2218, 762}, // #21 + {5, 1033, 1041, 3346, 2066}, // #22 + {4, 1053, 1069, 3082, 3930}, // #23 + {12, 1081, 1097, 2082, 962}, // #24 + {5, 1113, 1121, 3362, 2066}, // #25 + {4, 1129, 1141, 322, 3930}, // #26 + {3, 1153, 1165, 2050, 2138}, // #27 + {5, 1177, 1185, 1538, 2066}, // #28 + {4, 1193, 1205, 1234, 3930}, // #29 + {5, 1221, 1233, 554, 2066}, // #30 + {4, 1245, 1261, 250, 3930}, // #31 + {5, 1277, 1289, 2858, 2066}, // #32 + {4, 1301, 1317, 2554, 3930}, // #33 + {12, 1329, 1345, 2194, 1762}, // #34 + {12, 1365, 1385, 2170, 1762}, // #35 + {12, 1405, 1425, 2314, 1762}, // #36 + {6, 1445, 1461, 3626, 666}, // #37 + {11, 1477, 1501, 3882, 842}, // #38 + {12, 1525, 1545, 1722, 2930}, // #39 + {12, 1565, 1585, 1914, 2930}, // #40 + {12, 1605, 1625, 442, 2930}, // #41 + {12, 1641, 1657, 626, 2930}, // #42 + {12, 1673, 1689, 946, 2930}, // #43 + {12, 1705, 1721, 738, 2930}, // #44 + {12, 1737, 1753, 2066, 2930}, // #45 + {12, 1773, 1793, 1210, 2930}, // #46 + {12, 1809, 1825, 1426, 2930}, // #47 + {12, 1841, 1857, 1650, 2930}, // #48 + {12, 1877, 1897, 1530, 2930}, // #49 + {12, 1913, 1929, 1858, 2930}, // #50 + {12, 1949, 1969, 2106, 2930}, // #51 + {12, 1989, 2009, 2202, 2930}, // #52 + {12, 2029, 2049, 2490, 2930}, // #53 + {12, 2069, 2089, 2794, 2930}, // #54 + {12, 2105, 2121, 2322, 2930}, // #55 + {12, 2137, 2153, 2834, 2930}, // #56 + {12, 2169, 2185, 1266, 2930}, // #57 + {12, 2205, 2225, 2538, 2930}, // #58 + {12, 2241, 2257, 2706, 2930}, // #59 + {12, 2277, 2297, 3402, 2930}, // #60 + {12, 2313, 2329, 146, 2930}, // #61 + {12, 2349, 2369, 3690, 2930}, // #62 + {12, 2389, 2409, 810, 2930}, // #63 + {12, 2429, 2449, 1178, 2930}, // #64 + {12, 2465, 2481, 1442, 2930}, // #65 + {12, 2501, 2521, 3546, 2930}, // #66 + {12, 2541, 2561, 1930, 2930}, // #67 + {12, 2577, 2593, 1634, 2930}, // #68 + {12, 2609, 2625, 1986, 2930}, // #69 + {12, 2641, 2657, 1970, 2930}, // #70 + {12, 2677, 2697, 1834, 2930}, // #71 + {12, 2713, 2729, 1474, 2930}, // #72 + {12, 2749, 2769, 2250, 2930}, // #73 + {12, 2789, 2809, 2458, 2930}, // #74 + {12, 2829, 2849, 2618, 2930}, // #75 + {12, 2869, 2889, 3066, 2930}, // #76 + {12, 2905, 2921, 3330, 2930}, // #77 + {12, 2941, 2961, 1706, 2930}, // #78 + {12, 2977, 2993, 2802, 2930}, // #79 + {12, 3013, 3033, 3770, 2930}, // #80 + {12, 3053, 3073, 3594, 2930}, // #81 + {12, 3089, 3105, 2, 2930}, // #82 + {12, 3121, 3137, 2962, 2930}, // #83 + {12, 3153, 3169, 290, 2930}, // #84 + {12, 3189, 3209, 794, 2930}, // #85 + {12, 3225, 3241, 1058, 2930}, // #86 + {12, 3261, 3281, 2394, 2930}, // #87 + {12, 3301, 3321, 138, 2930}, // #88 + {12, 3341, 3361, 1482, 2930}, // #89 + {12, 3381, 3401, 570, 2930}, // #90 + {12, 3417, 3433, 674, 2930}, // #91 + {12, 3449, 3465, 1282, 2930}, // #92 + {12, 3481, 3497, 1746, 2930}, // #93 + {12, 3517, 3537, 1866, 2930}, // #94 + {12, 3557, 3577, 1978, 2930}, // #95 + {12, 3593, 3609, 3954, 2930}, // #96 + {12, 3629, 3649, 2570, 2930}, // #97 + {12, 3665, 3681, 2754, 2930}, // #98 + {12, 3697, 3713, 3666, 2930}, // #99 + {12, 3729, 3745, 34, 2930}, // #100 + {12, 3761, 3777, 2914, 2930}, // #101 + {12, 3797, 3817, 1194, 2930}, // #102 + {12, 3833, 3849, 3202, 2930}, // #103 + {12, 3869, 3889, 3018, 2930}, // #104 + {12, 3909, 3929, 202, 2930}, // #105 + {12, 3949, 3969, 3546, 2930}, // #106 + {12, 3985, 4001, 3682, 2930}, // #107 + {12, 4021, 4041, 3466, 2930}, // #108 + {12, 4061, 4081, 4074, 2930}, // #109 + {12, 4097, 4113, 306, 2930}, // #110 + {12, 4133, 4153, 634, 2930}, // #111 + {12, 4169, 4185, 802, 2930}, // #112 + {12, 4201, 4217, 962, 2930}, // #113 + {12, 4237, 4257, 1114, 2930}, // #114 + {12, 4273, 4289, 1250, 2930}, // #115 + {12, 4309, 4329, 3898, 2930}, // #116 + {12, 4349, 4369, 1386, 2930}, // #117 + {12, 4385, 4401, 1586, 2930}, // #118 + {12, 4417, 4433, 1730, 2930}, // #119 + {12, 4453, 4473, 1914, 2930}, // #120 + {12, 4493, 4513, 1498, 2930}, // #121 + {12, 4533, 4553, 2138, 2930}, // #122 + {12, 4569, 4585, 2290, 2930}, // #123 + {12, 4605, 4625, 2426, 2930}, // #124 + {12, 4645, 4665, 2666, 2930}, // #125 + {12, 4681, 4697, 2050, 2930}, // #126 + {12, 4717, 4737, 2874, 2930}, // #127 + {12, 4757, 4777, 3018, 2930}, // #128 + {12, 4797, 4817, 1834, 2930}, // #129 + {12, 4837, 4857, 3178, 2930}, // #130 + {12, 4873, 4889, 3314, 2930}, // #131 + {12, 4905, 4921, 2546, 2930}, // #132 + {12, 4941, 4961, 3546, 2930}, // #133 + {12, 4977, 4993, 3682, 2930}, // #134 + {12, 5013, 5033, 3802, 2930}, // #135 + {12, 5049, 5065, 3922, 2930}, // #136 + {12, 5081, 5097, 4018, 2930}, // #137 + {12, 5117, 5137, 42, 2930}, // #138 + {12, 5153, 5169, 130, 2930}, // #139 + {12, 5185, 5201, 242, 2930}, // #140 +}; +static const int stringCollectionCount = 141; +static const int stringCollectionMaxLen = 51; +// average comparison length: 12.0922 +// cache-line crosses: 6 (2.1%) +// alignment histogram: +// 0xXXX2 = 188 (66.7%) strings, 57 (30.3%) of which same-aligned +// 0xXXXa = 94 (33.3%) strings, 10 (10.6%) of which same-aligned +// total = 282 (100%) strings, 67 (23.8%) of which same-aligned diff --git a/tools/designer/src/components/propertyeditor/defs.h b/tests/benchmarks/corelib/tools/qstring/data.h index 28e39fc..c7a7467 100644 --- a/tools/designer/src/components/propertyeditor/defs.h +++ b/tests/benchmarks/corelib/tools/qstring/data.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Designer of the Qt Toolkit. +** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -39,22 +39,15 @@ ** ****************************************************************************/ -#ifndef DEFS_H -#define DEFS_H +#include <qglobal.h> -#include <QtGui/QSizePolicy> -#include <QtCore/QString> +struct StringCollection +{ + int len; + int offset1, offset2; + ushort align1, align2; +}; -QT_BEGIN_NAMESPACE - -namespace qdesigner_internal { - -int size_type_to_int(QSizePolicy::Policy t); -QString size_type_to_string(QSizePolicy::Policy t); -QSizePolicy::Policy int_to_size_type(int i); - -} // namespace qdesigner_internal - -QT_END_NAMESPACE - -#endif // DEFS_H +extern const ushort stringCollectionData[]; +extern StringCollection stringCollection[]; +extern const int stringCollectionCount; diff --git a/tests/benchmarks/corelib/tools/qstring/generatelist.pl b/tests/benchmarks/corelib/tools/qstring/generatelist.pl new file mode 100644 index 0000000..d027adb --- /dev/null +++ b/tests/benchmarks/corelib/tools/qstring/generatelist.pl @@ -0,0 +1,198 @@ +#!/usr/bin/perl +## 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 QtCore 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$ +# +# Parses a file (passed as argument) that contains a dump of pairs of +# strings and generates C source code including said data. +# +# The format of the file is: +# LEN = <len> <keyword> <align1> <align2>\n<data1><data2>\n +# where: +# LEN the literal string "LEN" +# <len> the length of the data, in 16-bit words +# <keyword> the literal string "SAME" or "DIFF" +# <align1> the alignment or pointer value of the first data +# <align2> the alignment or pointer value of the second data +# <data1> the first data +# <data2> the second data +# \n newline +# +# The code to write this data would be: +# fprintf(out, "LEN = %d %s %d %d\n", len, +# (p1 == p2) ? "SAME" : "DIFF", +# uint(quintptr(p1)) & 0xfff, uint(quintptr(p2)) & 0xfff); +# fwrite(p1, 2, len, out); +# fwrite(p2, 2, len, out); +# fwrite("\n", 1, 1, out); + +sub printUshortArray($$$) { + $str = $_[0]; + $align = $_[1] & 0x1f; + $offset = $_[2]; + + die if ($align & 1) != 0; + $align /= 2; + + $len = (length $str) / 2; + $headpadding = $align & 0x7; + $tailpadding = 8 - (($len + $headpadding) & 0x7); + $multiplecachelines = ($align + $len) > 0x20; + + if ($multiplecachelines) { + # if this string crosses into a new cacheline, then + # replicate the result + $headpadding |= ($offset & ~0x1f); + $headpadding += 0x20 + if ($headpadding < $offset); + $headpadding -= $offset; + ++$cachelinecrosses; + } + for $i (1..$headpadding) { + print 65536-$i,","; + } + print "\n " if ($headpadding > 0); + print " " if ($headpadding == 0); + + for ($i = 0; $i < $len * 2; $i += 2) { + print " ", ord(substr($str, $i, 1)) + + ord(substr($str, $i + 1, 1)) * 256, + ","; + } + print "\n " if ($tailpadding > 0); + + for $i (1..$tailpadding) { + print 65536-$i, ","; + } + print " // ", $offset + $headpadding + $len + $tailpadding; + print "+" if $multiplecachelines; + + return ($offset + $headpadding, $offset + $headpadding + $len + $tailpadding); +} + +print "#include \"data.h\"\n\n"; + +print "// This is a generated file - DO NOT EDIT\n"; +print "const ushort stringCollectionData[] __attribute__((aligned(64))) = {\n"; +$count = 0; +$offset = 0; +$totalsize = 0; +$maxlen = 0; +$cachelinecrosses = 0; + +open IN, "<" . $ARGV[0]; +while (1) { + $line = readline(*IN); + last unless defined($line); + $line =~ /LEN = (\d+) (\w+) (\d+) (\d+)/; + $len = $1; + $data[$count]->{len} = $len; + $sameptr = $2; + $data[$count]->{align1} = $3 - 0; + $data[$count]->{align2} = $4 - 0; + + # statistics + $alignhistogram{$3 & 0xf}++; + $alignhistogram{$4 & 0xf}++; + $samealignments{$3 & 0xf}++ if ($3 & 0xf) == ($4 & 0xf); + + read IN, $a, $len * 2; + read IN, $b, $len * 2; + + <IN>; # Eat the newline + + if ($len == 0) { + $data[$count]->{offset1} = $offset; + $data[$count]->{offset2} = $data[$count]->{offset1}; + ++$data[$count]->{offset2} if ($sameptr eq "DIFF"); + } else { + print " // #$count\n"; + print " "; + ($data[$count]->{offset1}, $offset) = + printUshortArray($a, $data[$count]->{align1}, $offset); + print "\n "; + die if ($offset & 0x7) != 0; + + if ($sameptr eq "DIFF") { + ($data[$count]->{offset2}, $offset) = + printUshortArray($b, $data[$count]->{align2}, $offset); + print "\n\n"; + } else { + $data[$count]->{offset2} = $data[$count]->{offset1}; + print "\n\n"; + } + } + ++$count; + + $totalsize += $len; + $maxlen = $len if $len > $maxlen; +} +print "\n};\n"; +close IN; + +print "struct StringCollection stringCollection[] = {\n"; + +for $i (0..$count-1) { + print " {", + $data[$i]->{len}, ", ", + $data[$i]->{offset1}, ", ", + $data[$i]->{offset2}, ", ", + $data[$i]->{align1}, ", ", + $data[$i]->{align2}, + "}, // #$i\n"; + next if $data[$i]->{len} == 0; + die if (($data[$i]->{offset1} & 0x7) != ($data[$i]->{align1} & 0xf)/2); + die if (($data[$i]->{offset2} & 0x7) != ($data[$i]->{align2} & 0xf)/2); +} +print "};\n"; + +print "const int stringCollectionCount = $count;\n"; +print "const int stringCollectionMaxLen = $maxlen;\n"; +printf "// average comparison length: %.4f\n", ($totalsize * 1.0 / $count); +printf "// cache-line crosses: %d (%.1f%%)\n", + $cachelinecrosses, ($cachelinecrosses * 100.0 / $count / 2); + +print "// alignment histogram:\n"; +for $key (sort { $a <=> $b } keys(%alignhistogram)) { + $value = $alignhistogram{$key}; + $samealigned = $samealignments{$key}; + printf "// 0xXXX%x = %d (%.1f%%) strings, %d (%.1f%%) of which same-aligned\n", + $key, $value, $value * 100.0 / ($count*2), + $samealigned, $samealigned * 100.0 / $value; + $samealignedtotal += $samealigned; +} +printf "// total = %d (100%) strings, %d (%.1f%%) of which same-aligned\n", + $count * 2, $samealignedtotal, $samealignedtotal * 100 / $count / 2; diff --git a/tests/benchmarks/corelib/tools/qstring/main.cpp b/tests/benchmarks/corelib/tools/qstring/main.cpp index 12826eb..9616052 100644 --- a/tests/benchmarks/corelib/tools/qstring/main.cpp +++ b/tests/benchmarks/corelib/tools/qstring/main.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include <QStringList> #include <QFile> -#include <qtest.h> +#include <QtTest/QtTest> #ifdef Q_OS_SYMBIAN // In Symbian OS test data is located in applications private dir @@ -48,12 +48,27 @@ #define SRCDIR "" #endif +#ifdef Q_OS_UNIX +#include <sys/mman.h> +#include <unistd.h> +#endif + +#include <private/qsimd_p.h> + +#include "data.h" + class tst_QString: public QObject { Q_OBJECT +public: + tst_QString(); private slots: void equals() const; void equals_data() const; + void equals2_data() const; + void equals2() const; + void ucstrncmp_data() const; + void ucstrncmp() const; void fromUtf8() const; }; @@ -67,6 +82,10 @@ void tst_QString::equals() const } } +tst_QString::tst_QString() +{ +} + void tst_QString::equals_data() const { static const struct { @@ -126,6 +145,1247 @@ void tst_QString::equals_data() const << QString::fromRawData(ptr + 1, 58) << QString::fromRawData(ptr + 3, 58); } +static bool equals2_memcmp_call(const ushort *p1, const ushort *p2, int len) +{ + return memcmp(p1, p2, len * 2) == 0; +} + +static bool equals2_bytewise(const ushort *p1, const ushort *p2, int len) +{ + if (p1 == p2 || !len) + return true; + uchar *b1 = (uchar *)p1; + uchar *b2 = (uchar *)p2; + len *= 2; + while (len--) + if (*b1++ != *b2++) + return false; + return true; +} + +static bool equals2_shortwise(const ushort *p1, const ushort *p2, int len) +{ + if (p1 == p2 || !len) + return true; +// for (register int counter; counter < len; ++counter) +// if (p1[counter] != p2[counter]) +// return false; + while (len--) { + if (p1[len] != p2[len]) + return false; + } + return true; +} + +static bool equals2_intwise(const ushort *p1, const ushort *p2, int length) +{ + if (p1 == p2 || !length) + return true; + register union { + const quint16 *w; + const quint32 *d; + quintptr value; + } sa, sb; + sa.w = p1; + sb.w = p2; + + // check alignment + if ((sa.value & 2) == (sb.value & 2)) { + // both addresses have the same alignment + if (sa.value & 2) { + // both addresses are not aligned to 4-bytes boundaries + // compare the first character + if (*sa.w != *sb.w) + return false; + --length; + ++sa.w; + ++sb.w; + + // now both addresses are 4-bytes aligned + } + + // both addresses are 4-bytes aligned + // do a fast 32-bit comparison + register const quint32 *e = sa.d + (length >> 1); + for ( ; sa.d != e; ++sa.d, ++sb.d) { + if (*sa.d != *sb.d) + return false; + } + + // do we have a tail? + return (length & 1) ? *sa.w == *sb.w : true; + } else { + // one of the addresses isn't 4-byte aligned but the other is + register const quint16 *e = sa.w + length; + for ( ; sa.w != e; ++sa.w, ++sb.w) { + if (*sa.w != *sb.w) + return false; + } + } + return true; +} + +static inline bool equals2_short_tail(const ushort *p1, const ushort *p2, int len) +{ + if (len) { + if (*p1 != *p2) + return false; + if (--len) { + if (p1[1] != p2[1]) + return false; + if (--len) { + if (p1[2] != p2[2]) + return false; + if (--len) { + if (p1[3] != p2[3]) + return false; + if (--len) { + if (p1[4] != p2[4]) + return false; + if (--len) { + if (p1[5] != p2[5]) + return false; + if (--len) { + if (p1[6] != p2[6]) + return false; + return p1[7] == p2[7]; + } + } + } + } + } + } + } + return true; +} + +//#pragma GCC optimize("no-unroll-loops") +#ifdef __SSE2__ +static bool equals2_sse2_aligned(const ushort *p1, const ushort *p2, int len) +{ + if (len >= 8) { + qptrdiff counter = 0; + while (len > 8) { + __m128i q1 = _mm_load_si128((__m128i *)(p1 + counter)); + __m128i q2 = _mm_load_si128((__m128i *)(p2 + counter)); + __m128i cmp = _mm_cmpeq_epi16(q1, q2); + if (ushort(_mm_movemask_epi8(cmp)) != ushort(0xffff)) + return false; + + len -= 8; + counter += 8; + } + p1 += counter; + p2 += counter; + } + + return equals2_short_tail(p1, p2, len); +} + +static bool __attribute__((optimize("no-unroll-loops"))) equals2_sse2(const ushort *p1, const ushort *p2, int len) +{ + if (p1 == p2 || !len) + return true; + + if (len >= 8) { + qptrdiff counter = 0; + while (len >= 8) { + __m128i q1 = _mm_loadu_si128((__m128i *)(p1 + counter)); + __m128i q2 = _mm_loadu_si128((__m128i *)(p2 + counter)); + __m128i cmp = _mm_cmpeq_epi16(q1, q2); + if (ushort(_mm_movemask_epi8(cmp)) != 0xffff) + return false; + + len -= 8; + counter += 8; + } + p1 += counter; + p2 += counter; + } + + return equals2_short_tail(p1, p2, len); +} + +//static bool equals2_sse2(const ushort *p1, const ushort *p2, int len) +//{ +// register int val1 = quintptr(p1) & 0xf; +// register int val2 = quintptr(p2) & 0xf; +// if (false && val1 + val2 == 0) +// return equals2_sse2_aligned(p1, p2, len); +// else +// return equals2_sse2_unaligned(p1, p2, len); +//} + +static bool equals2_sse2_aligning(const ushort *p1, const ushort *p2, int len) +{ + if (len < 8) + return equals2_short_tail(p1, p2, len); + + qptrdiff counter = 0; + + // which one is easier to align, p1 or p2 ? + register int val1 = quintptr(p1) & 0xf; + register int val2 = quintptr(p2) & 0xf; + if (val1 && val2) { +#if 0 + // we'll align the one which requires the least number of steps + if (val1 > val2) { + qSwap(p1, p2); + val1 = val2; + } + + // val1 contains the number of bytes past the 16-aligned mark + // we must read 16-val1 bytes to align + val1 = 16 - val1; + if (val1 & 0x2) { + if (*p1 != *p2) + return false; + --len; + ++counter; + } + while (val1 & 12) { + if (*(uint*)p1 != *(uint*)p2) + return false; + --len; + counter += 2; + val1 -= 4; + } +#else + // we'll align the one closest to the 16-byte mark + if (val1 > val2) { + qSwap(p1, p2); + val1 = val2; + } + + // we're reading val1 bytes too many + __m128i q2 = _mm_loadu_si128((__m128i *)(p2 - val1/2)); + __m128i cmp = _mm_cmpeq_epi16(*(__m128i *)(p1 - val1/2), q2); + if (short(_mm_movemask_epi8(cmp)) >> val1 != short(-1)) + return false; + + counter = 8 - val1/2; + len -= 8 - val1/2; +#endif + } else if (!val2) { + // p2 is already aligned + qSwap(p1, p2); + } + + // p1 is aligned + + while (len >= 8) { + __m128i q1 = _mm_load_si128((__m128i *)(p1 + counter)); + __m128i q2 = _mm_loadu_si128((__m128i *)(p2 + counter)); + __m128i cmp = _mm_cmpeq_epi16(q1, q2); + if (ushort(_mm_movemask_epi8(cmp)) != ushort(0xffff)) + return false; + + len -= 8; + counter += 8; + } + + // tail + return equals2_short_tail(p1 + counter, p2 + counter, len); +} + +#ifdef __SSE3__ +static bool __attribute__((optimize("no-unroll-loops"))) equals2_sse3(const ushort *p1, const ushort *p2, int len) +{ + if (p1 == p2 || !len) + return true; + + if (len >= 8) { + qptrdiff counter = 0; + while (len >= 8) { + __m128i q1 = _mm_lddqu_si128((__m128i *)(p1 + counter)); + __m128i q2 = _mm_lddqu_si128((__m128i *)(p2 + counter)); + __m128i cmp = _mm_cmpeq_epi16(q1, q2); + if (ushort(_mm_movemask_epi8(cmp)) != 0xffff) + return false; + + len -= 8; + counter += 8; + } + p1 += counter; + p2 += counter; + } + + return equals2_short_tail(p1, p2, len); +} + +#ifdef __SSSE3__ +template<int N> static __attribute__((optimize("unroll-loops"))) inline bool equals2_ssse3_alignr(__m128i *m1, __m128i *m2, int len) +{ + __m128i lower = _mm_load_si128(m1); + while (len >= 8) { + __m128i upper = _mm_load_si128(m1 + 1); + __m128i correct; + correct = _mm_alignr_epi8(upper, lower, N); + + __m128i q2 = _mm_lddqu_si128(m2); + __m128i cmp = _mm_cmpeq_epi16(correct, q2); + if (ushort(_mm_movemask_epi8(cmp)) != 0xffff) + return false; + + len -= 8; + ++m2; + ++m1; + lower = upper; + } + + // tail + return len == 0 || equals2_short_tail((const ushort *)m1 + N / 2, (const ushort*)m2, len); +} + +static inline __attribute__((optimize("unroll-loops"))) bool equals2_ssse3_aligned(__m128i *m1, __m128i *m2, int len) +{ + while (len >= 8) { + __m128i q2 = _mm_lddqu_si128(m2); + __m128i cmp = _mm_cmpeq_epi16(*m1, q2); + if (ushort(_mm_movemask_epi8(cmp)) != 0xffff) + return false; + + len -= 8; + ++m1; + ++m2; + } + return len == 0 || equals2_short_tail((const ushort *)m1, (const ushort *)m2, len); +} + +static bool equals2_ssse3(const ushort *p1, const ushort *p2, int len) +{ + // p1 & 0xf can be: + // 0, 2, 4, 6, 8, 10, 12, 14 + // If it's 0, we're aligned + // If it's not, then we're interested in the 16 - (p1 & 0xf) bytes only + + if (len >= 8) { + // find the last aligned position below the p1 memory + __m128i *m1 = (__m128i *)(quintptr(p1) & ~0xf); + __m128i *m2 = (__m128i *)p2; + qptrdiff diff = quintptr(p1) - quintptr(m1); + + // diff contains the number of extra bytes + if (diff == 10) + return equals2_ssse3_alignr<10>(m1, m2, len); + else if (diff == 2) + return equals2_ssse3_alignr<2>(m1, m2, len); + if (diff < 8) { + if (diff < 4) { + return equals2_ssse3_aligned(m1, m2, len); + } else { + if (diff == 4) + return equals2_ssse3_alignr<4>(m1, m2, len); + else // diff == 6 + return equals2_ssse3_alignr<6>(m1, m2, len); + } + } else { + if (diff < 12) { + return equals2_ssse3_alignr<8>(m1, m2, len); + } else { + if (diff == 12) + return equals2_ssse3_alignr<12>(m1, m2, len); + else // diff == 14 + return equals2_ssse3_alignr<14>(m1, m2, len); + } + } + } + + // tail + return equals2_short_tail(p1, p2, len); +} + +template<int N> static inline bool equals2_ssse3_aligning_alignr(__m128i *m1, __m128i *m2, int len) +{ + __m128i lower = _mm_load_si128(m1); + while (len >= 8) { + __m128i upper = _mm_load_si128(m1 + 1); + __m128i correct; + correct = _mm_alignr_epi8(upper, lower, N); + + __m128i cmp = _mm_cmpeq_epi16(correct, *m2); + if (ushort(_mm_movemask_epi8(cmp)) != 0xffff) + return false; + + len -= 8; + ++m2; + ++m1; + lower = upper; + } + + // tail + return len == 0 || equals2_short_tail((const ushort *)m1 + N / 2, (const ushort*)m2, len); +} + +static bool equals2_ssse3_aligning(const ushort *p1, const ushort *p2, int len) +{ + if (len < 8) + return equals2_short_tail(p1, p2, len); + qptrdiff counter = 0; + + // which one is easier to align, p1 or p2 ? + { + register int val1 = quintptr(p1) & 0xf; + register int val2 = quintptr(p2) & 0xf; + if (val1 && val2) { + // we'll align the one closest to the 16-byte mark + if (val1 < val2) { + qSwap(p1, p2); + val2 = val1; + } + + // we're reading val1 bytes too many + __m128i q1 = _mm_lddqu_si128((__m128i *)(p1 - val2/2)); + __m128i cmp = _mm_cmpeq_epi16(q1, *(__m128i *)(p2 - val2/2)); + if (short(_mm_movemask_epi8(cmp)) >> val1 != short(-1)) + return false; + + counter = 8 - val2/2; + len -= 8 - val2/2; + } else if (!val1) { + // p1 is already aligned + qSwap(p1, p2); + } + } + + // p2 is aligned now + // we want to use palignr in the mis-alignment of p1 + __m128i *m1 = (__m128i *)(quintptr(p1 + counter) & ~0xf); + __m128i *m2 = (__m128i *)(p2 + counter); + register int val1 = quintptr(p1 + counter) - quintptr(m1); + + // val1 contains the number of extra bytes + if (val1 == 8) + return equals2_ssse3_aligning_alignr<8>(m1, m2, len); + if (val1 == 0) + return equals2_sse2_aligned(p1 + counter, p2 + counter, len); + if (val1 < 8) { + if (val1 < 4) { + return equals2_ssse3_aligning_alignr<2>(m1, m2, len); + } else { + if (val1 == 4) + return equals2_ssse3_aligning_alignr<4>(m1, m2, len); + else // diff == 6 + return equals2_ssse3_aligning_alignr<6>(m1, m2, len); + } + } else { + if (val1 < 12) { + return equals2_ssse3_aligning_alignr<10>(m1, m2, len); + } else { + if (val1 == 12) + return equals2_ssse3_aligning_alignr<12>(m1, m2, len); + else // diff == 14 + return equals2_ssse3_aligning_alignr<14>(m1, m2, len); + } + } +} + +#ifdef __SSE4_1__ +static bool equals2_sse4(const ushort *p1, const ushort *p2, int len) +{ + // We use the pcmpestrm instruction searching for differences (negative polarity) + // it will reset CF if it's all equal + // it will reset OF if the first char is equal + // it will set ZF & SF if the length is less than 8 (which means we've done the last operation) + // the three possible conditions are: + // difference found: CF = 1 + // all equal, not finished: CF = ZF = SF = 0 + // all equal, finished: CF = 0, ZF = SF = 1 + // We use the JA instruction that jumps if ZF = 0 and CF = 0 + if (p1 == p2 || !len) + return true; + + // This function may read some bytes past the end of p1 or p2 + // It is safe to do that, as long as those extra bytes (beyond p1+len and p2+len) + // are on the same page as the last valid byte. + // If len is a multiple of 8, we'll never load invalid bytes. + if (len & 7) { + // The last load would load (len & ~7) valid bytes and (8 - (len & ~7)) invalid bytes. + // So we can't do the last load if any of those bytes is in a different + // page. That is, if: + // pX + len is on a different page from pX + (len & ~7) + 8 + // + // that is, if second-to-last load ended up less than 16 bytes from the page end: + // pX + (len & ~7) is the last ushort read in the second-to-last load + if (len < 8) + return equals2_short_tail(p1, p2, len); + if ((quintptr(p1 + (len & ~7)) & 0xfff) > 0xff0 || + (quintptr(p2 + (len & ~7)) & 0xfff) > 0xff0) { + + // yes, so we mustn't do the final 128-bit load + bool result; + asm ( + "sub %[p1], %[p2]\n\t" + "sub $16, %[p1]\n\t" + "add $8, %[len]\n\t" + + // main loop: + "0:\n\t" + "add $16, %[p1]\n\t" + "sub $8, %[len]\n\t" + "jz 1f\n\t" + "lddqu (%[p1]), %%xmm0\n\t" + "mov %[len], %%edx\n\t" + "pcmpestri %[mode], (%[p2],%[p1]), %%xmm0\n\t" + + "jna 1f\n\t" + "add $16, %[p1]\n\t" + "sub $8, %[len]\n\t" + "jz 1f\n\t" + "lddqu (%[p1]), %%xmm0\n\t" + "mov %[len], %%edx\n\t" + "pcmpestri %[mode], (%[p2],%[p1]), %%xmm0\n\t" + + "ja 0b\n\t" + "1:\n\t" + "setnc %[result]\n\t" + : [result] "=a" (result), + [p1] "+r" (p1), + [p2] "+r" (p2) + : [len] "0" (len & ~7), + [mode] "i" (_SIDD_UWORD_OPS | _SIDD_CMP_EQUAL_EACH | _SIDD_NEGATIVE_POLARITY) + : "%edx", "%ecx", "%xmm0" + ); + return result && equals2_short_tail(p1, (const ushort *)(quintptr(p1) + quintptr(p2)), len & 7); + } + } + +// const qptrdiff disp = p2 - p1; +// p1 -= 8; +// len += 8; +// while (true) { +// enum { Mode = _SIDD_UWORD_OPS | _SIDD_CMP_EQUAL_EACH | _SIDD_NEGATIVE_POLARITY }; + +// p1 += 8; +// len -= 8; +// if (!len) +// return true; + +// __m128i q1 = _mm_lddqu_si128((__m128i *)(p1 + disp)); +// __m128i *m2 = (__m128i *)p1; + +// bool cmp_a = _mm_cmpestra(q1, len, *m2, len, Mode); +// if (cmp_a) +// continue; +// return !_mm_cmpestrc(q1, len, *m2, len, Mode); +// } +// return true; + bool result; + asm ( + "sub %[p1], %[p2]\n\t" + "sub $16, %[p1]\n\t" + "add $8, %[len]\n\t" + + "0:\n\t" + "add $16, %[p1]\n\t" + "sub $8, %[len]\n\t" + "jz 1f\n\t" + "lddqu (%[p2],%[p1]), %%xmm0\n\t" + "mov %[len], %%edx\n\t" + "pcmpestri %[mode], (%[p1]), %%xmm0\n\t" + + "jna 1f\n\t" + "add $16, %[p1]\n\t" + "sub $8, %[len]\n\t" + "jz 1f\n\t" + "lddqu (%[p2],%[p1]), %%xmm0\n\t" + "mov %[len], %%edx\n\t" + "pcmpestri %[mode], (%[p1]), %%xmm0\n\t" + + "ja 0b\n\t" + + "1:\n\t" + "setnc %[result]\n\t" + : [result] "=a" (result) + : [len] "0" (len), + [p1] "r" (p1), + [p2] "r" (p2), + [mode] "i" (_SIDD_UWORD_OPS | _SIDD_CMP_EQUAL_EACH | _SIDD_NEGATIVE_POLARITY) + : "%edx", "%ecx", "%xmm0" + ); + return result; +} + +#endif +#endif +#endif +#endif + +typedef bool (* FuncPtr)(const ushort *, const ushort *, int); +static const FuncPtr func[] = { + equals2_memcmp_call, // 0 + equals2_bytewise, // 1 + equals2_shortwise, // 1 + equals2_intwise, // 3 +#ifdef __SSE2__ + equals2_sse2, // 4 + equals2_sse2_aligning, // 5 +#ifdef __SSE3__ + equals2_sse3, // 6 +#ifdef __SSSE3__ + equals2_ssse3, // 7 + equals2_ssse3, // 8 +#ifdef __SSE4_1__ + equals2_sse4, // 9 +#endif +#endif +#endif +#endif + 0 +}; +static const int functionCount = sizeof(func)/sizeof(func[0]) - 1; + +void tst_QString::equals2_data() const +{ + QTest::addColumn<int>("algorithm"); + QTest::newRow("selftest") << -1; + QTest::newRow("memcmp_call") << 0; + QTest::newRow("bytewise") << 1; + QTest::newRow("shortwise") << 2; + QTest::newRow("intwise") << 3; +#ifdef __SSE2__ + QTest::newRow("sse2") << 4; + QTest::newRow("sse2_aligning") << 5; +#ifdef __SSE3__ + QTest::newRow("sse3") << 6; +#ifdef __SSSE3__ + QTest::newRow("ssse3") << 7; + QTest::newRow("ssse3_aligning") << 8; +#ifdef __SSE4_1__ + QTest::newRow("sse4.2") << 9; +#endif +#endif +#endif +#endif +} + +static void __attribute__((noinline)) equals2_selftest() +{ +#ifdef Q_OS_UNIX + const long pagesize = sysconf(_SC_PAGESIZE); + void *page1, *page3; + ushort *page2; + page1 = mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + page2 = (ushort *)mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, -1, 0); + page3 = mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + + Q_ASSERT(quintptr(page2) == quintptr(page1) + pagesize || quintptr(page2) == quintptr(page1) - pagesize); + Q_ASSERT(quintptr(page3) == quintptr(page2) + pagesize || quintptr(page3) == quintptr(page2) - pagesize); + munmap(page1, pagesize); + munmap(page3, pagesize); + + // populate our page + for (uint i = 0; i < pagesize / sizeof(long long); ++i) + ((long long *)page2)[i] = Q_INT64_C(0x0041004100410041); + + // the following should crash: + //page2[-1] = 0xdead; + //page2[pagesize / sizeof(ushort) + 1] = 0xbeef; + + static const ushort needle[] = { + 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, + 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, + 0x41 + }; + + for (int algo = 0; algo < functionCount; ++algo) { + // boundary condition test: + for (int i = 0; i < 8; ++i) { + (func[algo])(page2 + i, needle, sizeof needle / 2); + (func[algo])(page2 - i - 1 - sizeof(needle)/2 + pagesize/2, needle, sizeof needle/2); + } + } + + munmap(page2, pagesize); +#endif + + for (int algo = 0; algo < functionCount; ++algo) { + for (int i = 0; i < stringCollectionCount; ++i) { + const ushort *p1 = stringCollectionData + stringCollection[i].offset1; + const ushort *p2 = stringCollectionData + stringCollection[i].offset2; + bool expected = memcmp(p1, p2, stringCollection[i].len * 2) == 0; + + bool result = (func[algo])(p1, p2, stringCollection[i].len); + if (expected != result) + qWarning().nospace() + << "algo=" << algo + << " i=" << i + << " failed (" << result << "!=" << expected + << "); strings were " + << QByteArray((char*)p1, stringCollection[i].len).toHex() + << " and " + << QByteArray((char*)p2, stringCollection[i].len).toHex(); + } + } +} + +void tst_QString::equals2() const +{ + QFETCH(int, algorithm); + if (algorithm == -1) { + equals2_selftest(); + return; + } + + QBENCHMARK { + for (int i = 0; i < stringCollectionCount; ++i) { + const ushort *p1 = stringCollectionData + stringCollection[i].offset1; + const ushort *p2 = stringCollectionData + stringCollection[i].offset2; + bool result = (func[algorithm])(p1, p2, stringCollection[i].len); + Q_UNUSED(result); + } + } +} + +static int ucstrncmp_shortwise(const ushort *a, const ushort *b, int l) +{ + while (l-- && *a == *b) + a++,b++; + if (l==-1) + return 0; + return *a - *b; +} + +static int ucstrncmp_intwise(const ushort *a, const ushort *b, int len) +{ + // do both strings have the same alignment? + if ((quintptr(a) & 2) == (quintptr(b) & 2)) { + // are we aligned to 4 bytes? + if (quintptr(a) & 2) { + if (*a != *b) + return *a - *b; + ++a; + ++b; + --len; + } + + const uint *p1 = (const uint *)a; + const uint *p2 = (const uint *)b; + quintptr counter = 0; + for ( ; len > 1 ; len -= 2, ++counter) { + if (p1[counter] != p2[counter]) { + // which ushort isn't equal? + int diff = a[2*counter] - b[2*counter]; + return diff ? diff : a[2*counter + 1] - b[2*counter + 1]; + } + } + + return len ? a[2*counter] - b[2*counter] : 0; + } else { + while (len-- && *a == *b) + a++,b++; + if (len==-1) + return 0; + return *a - *b; + } +} + +#ifdef __SSE2__ +static inline int ucstrncmp_short_tail(const ushort *p1, const ushort *p2, int len) +{ + if (len) { + if (*p1 != *p2) + return *p1 - *p2; + if (--len) { + if (p1[1] != p2[1]) + return p1[1] - p2[1]; + if (--len) { + if (p1[2] != p2[2]) + return p1[2] - p2[2]; + if (--len) { + if (p1[3] != p2[3]) + return p1[3] - p2[3]; + if (--len) { + if (p1[4] != p2[4]) + return p1[4] - p2[4]; + if (--len) { + if (p1[5] != p2[5]) + return p1[5] - p2[5]; + if (--len) { + if (p1[6] != p2[6]) + return p1[6] - p2[6]; + return p1[7] - p2[7]; + } + } + } + } + } + } + } + return 0; +} + +static inline int bsf_nonzero(register long val) +{ + int result; +# ifdef Q_CC_GNU + // returns the first non-zero bit on a non-zero reg + asm ("bsf %1, %0" : "=r" (result) : "r" (val)); + return result; +# elif defined(Q_CC_MSVC) + _BitScanForward(&result, val); + return result; +# endif +} + +static __attribute__((optimize("no-unroll-loops"))) int ucstrncmp_sse2(const ushort *a, const ushort *b, int len) +{ + qptrdiff counter = 0; + while (len >= 8) { + __m128i m1 = _mm_loadu_si128((__m128i *)(a + counter)); + __m128i m2 = _mm_loadu_si128((__m128i *)(b + counter)); + __m128i cmp = _mm_cmpeq_epi16(m1, m2); + ushort mask = ~uint(_mm_movemask_epi8(cmp)); + if (mask) { + // which ushort isn't equal? + counter += bsf_nonzero(mask)/2; + return a[counter] - b[counter]; + } + + counter += 8; + len -= 8; + } + return ucstrncmp_short_tail(a + counter, b + counter, len); +} + +static __attribute__((optimize("no-unroll-loops"))) int ucstrncmp_sse2_aligning(const ushort *a, const ushort *b, int len) +{ + if (len >= 8) { + __m128i m1 = _mm_loadu_si128((__m128i *)a); + __m128i m2 = _mm_loadu_si128((__m128i *)b); + __m128i cmp = _mm_cmpeq_epi16(m1, m2); + ushort mask = ~uint(_mm_movemask_epi8(cmp)); + if (mask) { + // which ushort isn't equal? + int counter = bsf_nonzero(mask)/2; + return a[counter] - b[counter]; + } + + + // now align to do 16-byte loads + int diff = 8 - (quintptr(a) & 0xf)/2; + len -= diff; + a += diff; + b += diff; + } + + qptrdiff counter = 0; + while (len >= 8) { + __m128i m1 = _mm_load_si128((__m128i *)(a + counter)); + __m128i m2 = _mm_loadu_si128((__m128i *)(b + counter)); + __m128i cmp = _mm_cmpeq_epi16(m1, m2); + ushort mask = ~uint(_mm_movemask_epi8(cmp)); + if (mask) { + // which ushort isn't equal? + counter += bsf_nonzero(mask)/2; + return a[counter] - b[counter]; + } + + counter += 8; + len -= 8; + } + return ucstrncmp_short_tail(a + counter, b + counter, len); +} + +static inline __attribute__((optimize("no-unroll-loops"))) int ucstrncmp_sse2_aligned(const ushort *a, const ushort *b, int len) +{ + quintptr counter = 0; + while (len >= 8) { + __m128i m1 = _mm_load_si128((__m128i *)(a + counter)); + __m128i m2 = _mm_load_si128((__m128i *)(b + counter)); + __m128i cmp = _mm_cmpeq_epi16(m1, m2); + ushort mask = ~uint(_mm_movemask_epi8(cmp)); + if (mask) { + // which ushort isn't equal? + counter += bsf_nonzero(mask)/2; + return a[counter] - b[counter]; + } + + counter += 8; + len -= 8; + } + return ucstrncmp_short_tail(a + counter, b + counter, len); +} + +static inline __attribute__((optimize("no-unroll-loops"))) int ucstrncmp_ssse3_alignr_aligned(const ushort *a, const ushort *b, int len) +{ + quintptr counter = 0; + while (len >= 8) { + __m128i m1 = _mm_load_si128((__m128i *)(a + counter)); + __m128i m2 = _mm_lddqu_si128((__m128i *)(b + counter)); + __m128i cmp = _mm_cmpeq_epi16(m1, m2); + ushort mask = ~uint(_mm_movemask_epi8(cmp)); + if (mask) { + // which ushort isn't equal? + counter += bsf_nonzero(mask)/2; + return a[counter] - b[counter]; + } + + counter += 8; + len -= 8; + } + return ucstrncmp_short_tail(a + counter, b + counter, len); +} + + +typedef __m128i (* MMLoadFunction)(const __m128i *); +template<int N, MMLoadFunction LoadFunction> +static inline __attribute__((optimize("no-unroll-loops"))) int ucstrncmp_ssse3_alignr(const ushort *a, const ushort *b, int len) +{ + qptrdiff counter = 0; + __m128i lower, upper; + upper = _mm_load_si128((__m128i *)a); + + do { + lower = upper; + upper = _mm_load_si128((__m128i *)(a + counter) + 1); + __m128i merged = _mm_alignr_epi8(upper, lower, N); + + __m128i m2 = LoadFunction((__m128i *)(b + counter)); + __m128i cmp = _mm_cmpeq_epi16(merged, m2); + ushort mask = ~uint(_mm_movemask_epi8(cmp)); + if (mask) { + // which ushort isn't equal? + counter += bsf_nonzero(mask)/2; + return a[counter + N/2] - b[counter]; + } + + counter += 8; + len -= 8; + } while (len >= 8); + + return ucstrncmp_short_tail(a + counter + N/2, b + counter, len); +} + +static int ucstrncmp_ssse3(const ushort *a, const ushort *b, int len) +{ + if (len >= 8) { + int val = quintptr(a) & 0xf; + a -= val/2; + + if (val == 10) + return ucstrncmp_ssse3_alignr<10, _mm_lddqu_si128>(a, b, len); + else if (val == 2) + return ucstrncmp_ssse3_alignr<2, _mm_lddqu_si128>(a, b, len); + if (val < 8) { + if (val < 4) + return ucstrncmp_ssse3_alignr_aligned(a, b, len); + else if (val == 4) + return ucstrncmp_ssse3_alignr<4, _mm_lddqu_si128>(a, b, len); + else + return ucstrncmp_ssse3_alignr<6, _mm_lddqu_si128>(a, b, len); + } else { + if (val < 12) + return ucstrncmp_ssse3_alignr<8, _mm_lddqu_si128>(a, b, len); + else if (val == 12) + return ucstrncmp_ssse3_alignr<12, _mm_lddqu_si128>(a, b, len); + else + return ucstrncmp_ssse3_alignr<14, _mm_lddqu_si128>(a, b, len); + } + } + return ucstrncmp_short_tail(a, b, len); +} + +static int ucstrncmp_ssse3_aligning(const ushort *a, const ushort *b, int len) +{ + if (len >= 8) { + __m128i m1 = _mm_loadu_si128((__m128i *)a); + __m128i m2 = _mm_loadu_si128((__m128i *)b); + __m128i cmp = _mm_cmpeq_epi16(m1, m2); + ushort mask = ~uint(_mm_movemask_epi8(cmp)); + if (mask) { + // which ushort isn't equal? + int counter = bsf_nonzero(mask)/2; + return a[counter] - b[counter]; + } + + + // now 'b' align to do 16-byte loads + int diff = 8 - (quintptr(b) & 0xf)/2; + len -= diff; + a += diff; + b += diff; + } + + if (len < 8) + return ucstrncmp_short_tail(a, b, len); + + // 'b' is aligned + int val = quintptr(a) & 0xf; + a -= val/2; + + if (val == 8) + return ucstrncmp_ssse3_alignr<8, _mm_load_si128>(a, b, len); + else if (val == 0) + return ucstrncmp_sse2_aligned(a, b, len); + if (val < 8) { + if (val < 4) + return ucstrncmp_ssse3_alignr<2, _mm_load_si128>(a, b, len); + else if (val == 4) + return ucstrncmp_ssse3_alignr<4, _mm_load_si128>(a, b, len); + else + return ucstrncmp_ssse3_alignr<6, _mm_load_si128>(a, b, len); + } else { + if (val < 12) + return ucstrncmp_ssse3_alignr<10, _mm_load_si128>(a, b, len); + else if (val == 12) + return ucstrncmp_ssse3_alignr<12, _mm_load_si128>(a, b, len); + else + return ucstrncmp_ssse3_alignr<14, _mm_load_si128>(a, b, len); + } +} + +static inline __attribute__((optimize("no-unroll-loops"))) +int ucstrncmp_ssse3_aligning2_aligned(const ushort *a, const ushort *b, int len, int garbage) +{ + // len >= 8 + __m128i m1 = _mm_load_si128((const __m128i *)a); + __m128i m2 = _mm_load_si128((const __m128i *)b); + __m128i cmp = _mm_cmpeq_epi16(m1, m2); + int mask = short(_mm_movemask_epi8(cmp)); // force sign extension + mask >>= garbage; + if (~mask) { + // which ushort isn't equal? + uint counter = (garbage + bsf_nonzero(~mask)); + return a[counter/2] - b[counter/2]; + } + + // the first 16-garbage bytes (8-garbage/2 ushorts) were equal + len -= 8 - garbage/2; + return ucstrncmp_sse2_aligned(a + 8, b + 8, len); +} + +template<int N> static inline __attribute__((optimize("no-unroll-loops"),always_inline)) +int ucstrncmp_ssse3_aligning2_alignr(const ushort *a, const ushort *b, int len, int garbage) +{ + // len >= 8 + __m128i lower, upper, merged; + lower = _mm_load_si128((const __m128i*)a); + upper = _mm_load_si128((const __m128i*)(a + 8)); + merged = _mm_alignr_epi8(upper, lower, N); + + __m128i m2 = _mm_load_si128((const __m128i*)b); + __m128i cmp = _mm_cmpeq_epi16(merged, m2); + int mask = short(_mm_movemask_epi8(cmp)); // force sign extension + mask >>= garbage; + if (~mask) { + // which ushort isn't equal? + uint counter = (garbage + bsf_nonzero(~mask)); + return a[counter/2 + N/2] - b[counter/2]; + } + + // the first 16-garbage bytes (8-garbage/2 ushorts) were equal + quintptr counter = 8; + len -= 8 - garbage/2; + while (len >= 8) { + lower = upper; + upper = _mm_load_si128((__m128i *)(a + counter) + 1); + merged = _mm_alignr_epi8(upper, lower, N); + + m2 = _mm_load_si128((__m128i *)(b + counter)); + cmp = _mm_cmpeq_epi16(merged, m2); + ushort mask = ~uint(_mm_movemask_epi8(cmp)); + if (mask) { + // which ushort isn't equal? + counter += bsf_nonzero(mask)/2; + return a[counter + N/2] - b[counter]; + } + + counter += 8; + len -= 8; + } + + return ucstrncmp_short_tail(a + counter + N/2, b + counter, len); +} + +static inline int conditional_invert(int result, bool invert) +{ + if (invert) + return -result; + return result; +} + +static int ucstrncmp_ssse3_aligning2(const ushort *a, const ushort *b, int len) +{ + // Different strategy from above: instead of doing two unaligned loads + // when trying to align, we'll only do aligned loads and round down the + // addresses of a and b. This means the first load will contain garbage + // in the beginning of the string, which we'll shift out of the way + // (after _mm_movemask_epi8) + + if (len < 8) + return ucstrncmp_intwise(a, b, len); + + // both a and b are misaligned + // we'll call the alignr function with the alignment *difference* between the two + int offset = (quintptr(a) & 0xf) - (quintptr(b) & 0xf); + if (offset >= 0) { + // from this point on, b has the shortest alignment + // and align(a) = align(b) + offset + // round down the alignment so align(b) == align(a) == 0 + int garbage = (quintptr(b) & 0xf); + a = (const ushort*)(quintptr(a) & ~0xf); + b = (const ushort*)(quintptr(b) & ~0xf); + + // now the first load of b will load 'garbage' extra bytes + // and the first load of a will load 'garbage + offset' extra bytes + if (offset == 8) + return ucstrncmp_ssse3_aligning2_alignr<8>(a, b, len, garbage); + if (offset == 0) + return ucstrncmp_ssse3_aligning2_aligned(a, b, len, garbage); + if (offset < 8) { + if (offset < 4) + return ucstrncmp_ssse3_aligning2_alignr<2>(a, b, len, garbage); + else if (offset == 4) + return ucstrncmp_ssse3_aligning2_alignr<4>(a, b, len, garbage); + else + return ucstrncmp_ssse3_aligning2_alignr<6>(a, b, len, garbage); + } else { + if (offset < 12) + return ucstrncmp_ssse3_aligning2_alignr<10>(a, b, len, garbage); + else if (offset == 12) + return ucstrncmp_ssse3_aligning2_alignr<12>(a, b, len, garbage); + else + return ucstrncmp_ssse3_aligning2_alignr<14>(a, b, len, garbage); + } + } else { + // same as above but inverted + int garbage = (quintptr(a) & 0xf); + a = (const ushort*)(quintptr(a) & ~0xf); + b = (const ushort*)(quintptr(b) & ~0xf); + + offset = -offset; + if (offset == 8) + return -ucstrncmp_ssse3_aligning2_alignr<8>(b, a, len, garbage); + if (offset < 8) { + if (offset < 4) + return -ucstrncmp_ssse3_aligning2_alignr<2>(b, a, len, garbage); + else if (offset == 4) + return -ucstrncmp_ssse3_aligning2_alignr<4>(b, a, len, garbage); + else + return -ucstrncmp_ssse3_aligning2_alignr<6>(b, a, len, garbage); + } else { + if (offset < 12) + return -ucstrncmp_ssse3_aligning2_alignr<10>(b, a, len, garbage); + else if (offset == 12) + return -ucstrncmp_ssse3_aligning2_alignr<12>(b, a, len, garbage); + else + return -ucstrncmp_ssse3_aligning2_alignr<14>(b, a, len, garbage); + } + } +} + +#endif + +typedef int (* UcstrncmpFunction)(const ushort *, const ushort *, int); +Q_DECLARE_METATYPE(UcstrncmpFunction) + +void tst_QString::ucstrncmp_data() const +{ + QTest::addColumn<UcstrncmpFunction>("function"); + QTest::newRow("selftest") << UcstrncmpFunction(0); + QTest::newRow("shortwise") << &ucstrncmp_shortwise; + QTest::newRow("intwise") << &ucstrncmp_intwise; +#ifdef __SSE2__ + QTest::newRow("sse2") << &ucstrncmp_sse2; + QTest::newRow("sse2_aligning") << &ucstrncmp_sse2_aligning; +#ifdef __SSSE3__ + QTest::newRow("ssse3") << &ucstrncmp_ssse3; + QTest::newRow("ssse3_aligning") << &ucstrncmp_ssse3_aligning; + QTest::newRow("ssse3_aligning2") << &ucstrncmp_ssse3_aligning2; +#endif +#endif +} + +void tst_QString::ucstrncmp() const +{ + QFETCH(UcstrncmpFunction, function); + if (!function) { + static const UcstrncmpFunction func[] = { + &ucstrncmp_shortwise, + &ucstrncmp_intwise, +#ifdef __SSE2__ + &ucstrncmp_sse2, + &ucstrncmp_sse2_aligning, +#ifdef __SSSE3__ + &ucstrncmp_ssse3, + &ucstrncmp_ssse3_aligning, + &ucstrncmp_ssse3_aligning2 +#endif +#endif + }; + static const int functionCount = sizeof func / sizeof func[0]; + +#ifdef Q_OS_UNIX + const long pagesize = sysconf(_SC_PAGESIZE); + void *page1, *page3; + ushort *page2; + page1 = mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + page2 = (ushort *)mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, -1, 0); + page3 = mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + + Q_ASSERT(quintptr(page2) == quintptr(page1) + pagesize || quintptr(page2) == quintptr(page1) - pagesize); + Q_ASSERT(quintptr(page3) == quintptr(page2) + pagesize || quintptr(page3) == quintptr(page2) - pagesize); + munmap(page1, pagesize); + munmap(page3, pagesize); + + // populate our page + for (uint i = 0; i < pagesize / sizeof(long long); ++i) + ((long long *)page2)[i] = Q_INT64_C(0x0041004100410041); + + // the following should crash: + //page2[-1] = 0xdead; + //page2[pagesize / sizeof(ushort) + 1] = 0xbeef; + + static const ushort needle[] = { + 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, + 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, + 0x41 + }; + + for (int algo = 0; algo < functionCount; ++algo) { + // boundary condition test: + for (int i = 0; i < 8; ++i) { + (func[algo])(page2 + i, needle, sizeof needle / 2); + (func[algo])(page2 - i - 1 - sizeof(needle)/2 + pagesize/2, needle, sizeof needle/2); + } + } + + munmap(page2, pagesize); +#endif + + for (int algo = 0; algo < functionCount; ++algo) { + for (int i = 0; i < stringCollectionCount; ++i) { + const ushort *p1 = stringCollectionData + stringCollection[i].offset1; + const ushort *p2 = stringCollectionData + stringCollection[i].offset2; + int expected = ucstrncmp_shortwise(p1, p2, stringCollection[i].len); + expected = qBound(-1, expected, 1); + + int result = (func[algo])(p1, p2, stringCollection[i].len); + result = qBound(-1, result, 1); + if (expected != result) + qWarning().nospace() + << "algo=" << algo + << " i=" << i + << " failed (" << result << "!=" << expected + << "); strings were " + << QByteArray((char*)p1, stringCollection[i].len).toHex() + << " and " + << QByteArray((char*)p2, stringCollection[i].len).toHex(); + } + } + return; + } + + QBENCHMARK { + for (int i = 0; i < stringCollectionCount; ++i) { + const ushort *p1 = stringCollectionData + stringCollection[i].offset1; + const ushort *p2 = stringCollectionData + stringCollection[i].offset2; + (function)(p1, p2, stringCollection[i].len); + } + } +} + void tst_QString::fromUtf8() const { QFile file(SRCDIR "utf-8.txt"); diff --git a/tests/benchmarks/corelib/tools/qstring/qstring.pro b/tests/benchmarks/corelib/tools/qstring/qstring.pro index fa4310e..e8720e1 100644 --- a/tests/benchmarks/corelib/tools/qstring/qstring.pro +++ b/tests/benchmarks/corelib/tools/qstring/qstring.pro @@ -1,7 +1,7 @@ load(qttest_p4) TARGET = tst_bench_qstring QT -= gui -SOURCES += main.cpp +SOURCES += main.cpp data.cpp wince*:{ DEFINES += SRCDIR=\\\"\\\" @@ -14,3 +14,6 @@ wince*:{ DEFINES += SRCDIR=\\\"$$PWD/\\\" } +sse4:QMAKE_CXXFLAGS += -msse4 +else:ssse3:QMAKE_FLAGS += -mssse3 +else:sse2:QMAKE_CXXFLAGS += -msse2 diff --git a/tools/activeqt/testcon/changeproperties.cpp b/tools/activeqt/testcon/changeproperties.cpp index e2ad601..00a2cab 100644 --- a/tools/activeqt/testcon/changeproperties.cpp +++ b/tools/activeqt/testcon/changeproperties.cpp @@ -111,10 +111,10 @@ void ChangeProperties::on_buttonSet_clicked() value = qVariantFromValue(col); } else { QMessageBox::warning(this, tr("Can't parse input"), - QString(tr("Failed to create a color from %1\n" + tr("Failed to create a color from %1\n" "The string has to be a valid color name (e.g. 'red')\n" "or a RGB triple of format '#rrggbb'." - ).arg(editValue->text()))); + ).arg(editValue->text())); } } break; @@ -125,10 +125,10 @@ void ChangeProperties::on_buttonSet_clicked() value = qVariantFromValue(fnt); } else { QMessageBox::warning(this, tr("Can't parse input"), - (tr("Failed to create a font from %1\n" + tr("Failed to create a font from %1\n" "The string has to have a format family,<point size> or\n" "family,pointsize,stylehint,weight,italic,underline,strikeout,fixedpitch,rawmode." - ).arg(editValue->text()))); + ).arg(editValue->text())); } } break; diff --git a/tools/assistant/tools/assistant/bookmarkitem.cpp b/tools/assistant/tools/assistant/bookmarkitem.cpp index 2e81e38..2c92113 100644 --- a/tools/assistant/tools/assistant/bookmarkitem.cpp +++ b/tools/assistant/tools/assistant/bookmarkitem.cpp @@ -41,6 +41,7 @@ #include "bookmarkitem.h" +#include <QtCore/QCoreApplication> #include <QtCore/QDebug> QT_BEGIN_NAMESPACE @@ -147,7 +148,9 @@ BookmarkItem::insertChildren(bool isFolder, int position, int count) for (int row = 0; row < count; ++row) { m_children.insert(position, new BookmarkItem(DataVector() - << QObject::tr(isFolder ? "New Folder" : "Untitled") + << (isFolder + ? QCoreApplication::translate("BookmarkItem", "New Folder") + : QCoreApplication::translate("BookmarkItem", "Untitled")) << (isFolder ? "Folder" : "about:blank") << false, this)); } diff --git a/tools/assistant/tools/assistant/cmdlineparser.cpp b/tools/assistant/tools/assistant/cmdlineparser.cpp index b6c0beb..1cf2915 100644 --- a/tools/assistant/tools/assistant/cmdlineparser.cpp +++ b/tools/assistant/tools/assistant/cmdlineparser.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE -const QString CmdLineParser::m_helpMessage = QLatin1String( +static const char helpMessage[] = QT_TRANSLATE_NOOP("CmdLineParser", "Usage: assistant [Options]\n\n" "-collectionFile file Uses the specified collection\n" " file instead of the default one\n" @@ -138,10 +138,10 @@ CmdLineParser::Result CmdLineParser::parse() } if (!m_error.isEmpty()) { - showMessage(m_error + QLatin1String("\n\n\n") + m_helpMessage, true); + showMessage(m_error + QLatin1String("\n\n\n") + tr(helpMessage), true); return Error; } else if (showHelp) { - showMessage(m_helpMessage, false); + showMessage(tr(helpMessage), false); return Help; } return Ok; diff --git a/tools/assistant/tools/assistant/cmdlineparser.h b/tools/assistant/tools/assistant/cmdlineparser.h index 5573081..db66494 100644 --- a/tools/assistant/tools/assistant/cmdlineparser.h +++ b/tools/assistant/tools/assistant/cmdlineparser.h @@ -93,7 +93,6 @@ private: QStringList m_arguments; int m_pos; - static const QString m_helpMessage; QString m_collectionFile; QString m_cloneFile; QString m_helpFile; diff --git a/tools/assistant/tools/assistant/mainwindow.cpp b/tools/assistant/tools/assistant/mainwindow.cpp index 913e342..65a58c0 100644 --- a/tools/assistant/tools/assistant/mainwindow.cpp +++ b/tools/assistant/tools/assistant/mainwindow.cpp @@ -831,7 +831,7 @@ void MainWindow::showAboutDialog() aboutDia.setWindowTitle(aboutDia.documentTitle()); } else { QByteArray resources; - aboutDia.setText(QString::fromLatin1("<center>" + aboutDia.setText(tr("<center>" "<h3>%1</h3>" "<p>Version %2</p></center>" "<p>Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).</p>") diff --git a/tools/assistant/tools/qcollectiongenerator/main.cpp b/tools/assistant/tools/qcollectiongenerator/main.cpp index b3f6bd9..46e301c 100644 --- a/tools/assistant/tools/qcollectiongenerator/main.cpp +++ b/tools/assistant/tools/qcollectiongenerator/main.cpp @@ -49,15 +49,21 @@ #include <QtCore/QDir> #include <QtCore/QMap> #include <QtCore/QFileInfo> -#include <QtCore/QCoreApplication> #include <QtCore/QDateTime> #include <QtCore/QBuffer> +#include <QtCore/QTranslator> +#include <QtCore/QLocale> +#include <QtCore/QLibraryInfo> #include <QtHelp/QHelpEngineCore> #include <QtXml/QXmlStreamReader> QT_USE_NAMESPACE +class QCG { + Q_DECLARE_TR_FUNCTIONS(QCollectionGenerator) +}; + class CollectionConfigReader : public QXmlStreamReader { public: @@ -123,9 +129,7 @@ private: void CollectionConfigReader::raiseErrorWithLine() { - raiseError(QCoreApplication::translate("QCollectionGenerator", - "Unknown token at line %1.") - .arg(lineNumber())); + raiseError(QCG::tr("Unknown token at line %1.").arg(lineNumber())); } void CollectionConfigReader::readData(const QByteArray &contents) @@ -144,9 +148,8 @@ void CollectionConfigReader::readData(const QByteArray &contents) && attributes().value(QLatin1String("version")) == QLatin1String("1.0")) readConfig(); else - raiseError(QCoreApplication::translate("QCollectionGenerator", - "Unknown token at line %1. " - "Expected \"QtHelpCollectionProject\"!") + raiseError(QCG::tr("Unknown token at line %1. " + "Expected \"QtHelpCollectionProject\".") .arg(lineNumber())); } } @@ -169,7 +172,7 @@ void CollectionConfigReader::readConfig() } } if (!ok && !hasError()) - raiseError(QLatin1String("Missing end tags.")); + raiseError(QCG::tr("Missing end tags.")); } void CollectionConfigReader::readAssistantSettings() @@ -311,7 +314,7 @@ void CollectionConfigReader::readFiles() } } if (input.isEmpty() || output.isEmpty()) { - raiseError(QLatin1String("Missing input or output file for help file generation!")); + raiseError(QCG::tr("Missing input or output file for help file generation.")); return; } m_filesToGenerate.insert(input, output); @@ -350,6 +353,20 @@ int main(int argc, char *argv[]) bool showHelp = false; bool showVersion = false; + QCoreApplication app(argc, argv); + QTranslator translator; + QTranslator qtTranslator; + QTranslator qt_helpTranslator; + QString sysLocale = QLocale::system().name(); + QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath); + if (translator.load(QLatin1String("assistant_") + sysLocale, resourceDir) + && qtTranslator.load(QLatin1String("qt_") + sysLocale, resourceDir) + && qt_helpTranslator.load(QLatin1String("qt_help_") + sysLocale, resourceDir)) { + app.installTranslator(&translator); + app.installTranslator(&qtTranslator); + app.installTranslator(&qt_helpTranslator); + } + for (int i=1; i<argc; ++i) { arg = QString::fromLocal8Bit(argv[i]); if (arg == QLatin1String("-o")) { @@ -357,8 +374,7 @@ int main(int argc, char *argv[]) QFileInfo fi(QString::fromLocal8Bit(argv[i])); collectionFile = fi.absoluteFilePath(); } else { - error = QCoreApplication::translate("QCollectionGenerator", - "Missing output file name!"); + error = QCG::tr("Missing output file name."); } } else if (arg == QLatin1String("-h")) { showHelp = true; @@ -372,16 +388,15 @@ int main(int argc, char *argv[]) } if (showVersion) { - fprintf(stdout, "Qt Collection Generator version 1.0 (Qt %s)\n", - QT_VERSION_STR); + fputs(qPrintable(QCG::tr("Qt Collection Generator version 1.0 (Qt %1)\n") + .arg(QT_VERSION_STR)), stdout); return 0; } if (configFile.isEmpty() && !showHelp) - error = QCoreApplication::translate("QCollectionGenerator", - "Missing collection config file!"); + error = QCG::tr("Missing collection config file."); - QString help = QCoreApplication::translate("QCollectionGenerator", "\nUsage:\n\n" + QString help = QCG::tr("\nUsage:\n\n" "qcollectiongenerator <collection-config-file> [options]\n\n" " -o <collection-file> Generates a collection file\n" " called <collection-file>. If\n" @@ -391,7 +406,7 @@ int main(int argc, char *argv[]) " qcollectiongenerator.\n\n"); if (showHelp) { - fprintf(stdout, "%s", qPrintable(help)); + fputs(qPrintable(help), stdout); return 0; }else if (!error.isEmpty()) { fprintf(stderr, "%s\n\n%s", qPrintable(error), qPrintable(help)); @@ -400,7 +415,7 @@ int main(int argc, char *argv[]) QFile file(configFile); if (!file.open(QIODevice::ReadOnly)) { - fprintf(stderr, "Could not open %s!\n", qPrintable(configFile)); + fputs(qPrintable(QCG::tr("Could not open %1.\n").arg(configFile)), stderr); return -1; } @@ -410,19 +425,18 @@ int main(int argc, char *argv[]) + fi.baseName() + QLatin1String(".qhc"); } - QCoreApplication app(argc, argv); - - fprintf(stdout, "Reading collection config file...\n"); + fputs(qPrintable(QCG::tr("Reading collection config file...\n")), stdout); CollectionConfigReader config; config.readData(file.readAll()); if (config.hasError()) { - fprintf(stderr, "Collection config file error: %s\n", qPrintable(config.errorString())); + fputs(qPrintable(QCG::tr("Collection config file error: %1\n") + .arg(config.errorString())), stderr); return -1; } QMap<QString, QString>::const_iterator it = config.filesToGenerate().constBegin(); while (it != config.filesToGenerate().constEnd()) { - fprintf(stdout, "Generating help for %s...\n", qPrintable(it.key())); + fputs(qPrintable(QCG::tr("Generating help for %1...\n").arg(it.key())), stdout); QHelpProjectData helpData; if (!helpData.readData(absoluteFileName(basePath, it.key()))) { fprintf(stderr, "%s\n", qPrintable(helpData.errorMessage())); @@ -437,12 +451,13 @@ int main(int argc, char *argv[]) ++it; } - fprintf(stdout, "Creating collection file...\n"); + fputs(qPrintable(QCG::tr("Creating collection file...\n")), stdout); QFileInfo colFi(collectionFile); if (colFi.exists()) { if (!colFi.dir().remove(colFi.fileName())) { - fprintf(stderr, "The file %s cannot be overwritten!\n", qPrintable(collectionFile)); + fputs(qPrintable(QCG::tr("The file %1 cannot be overwritten.\n") + .arg(collectionFile)), stderr); return -1; } } @@ -500,7 +515,7 @@ int main(int argc, char *argv[]) if (!config.applicationIcon().isEmpty()) { QFile icon(absoluteFileName(basePath, config.applicationIcon())); if (!icon.open(QIODevice::ReadOnly)) { - fprintf(stderr, "Cannot open %s!\n", qPrintable(icon.fileName())); + fputs(qPrintable(QCG::tr("Cannot open %1.\n").arg(icon.fileName())), stderr); return -1; } CollectionConfiguration::setApplicationIcon(helpEngine, icon.readAll()); @@ -521,7 +536,7 @@ int main(int argc, char *argv[]) if (!config.aboutIcon().isEmpty()) { QFile icon(absoluteFileName(basePath, config.aboutIcon())); if (!icon.open(QIODevice::ReadOnly)) { - fprintf(stderr, "Cannot open %s!\n", qPrintable(icon.fileName())); + fputs(qPrintable(QCG::tr("Cannot open %1.\n").arg(icon.fileName())), stderr); return -1; } CollectionConfiguration::setAboutIcon(helpEngine, icon.readAll()); @@ -543,7 +558,7 @@ int main(int argc, char *argv[]) QFileInfo fi(absoluteFileName(basePath, it.value())); QFile f(fi.absoluteFilePath()); if (!f.open(QIODevice::ReadOnly)) { - fprintf(stderr, "Cannot open %s!\n", qPrintable(f.fileName())); + fputs(qPrintable(QCG::tr("Cannot open %1.\n").arg(f.fileName())), stderr); return -1; } QByteArray data = f.readAll(); @@ -565,8 +580,8 @@ int main(int argc, char *argv[]) if (!imgData.contains(src)) imgData.insert(src, img.readAll()); } else { - fprintf(stderr, "Cannot open referenced image file %s!\n", - qPrintable(img.fileName())); + fputs(qPrintable(QCG::tr("Cannot open referenced image file %1.\n") + .arg(img.fileName())), stderr); } } } diff --git a/tools/assistant/tools/qhelpconverter/filterpage.cpp b/tools/assistant/tools/qhelpconverter/filterpage.cpp index 7f86980..c782943 100644 --- a/tools/assistant/tools/qhelpconverter/filterpage.cpp +++ b/tools/assistant/tools/qhelpconverter/filterpage.cpp @@ -127,7 +127,7 @@ void FilterPage::addFilter() { QTreeWidgetItem *item = new QTreeWidgetItem(m_ui.customFilterWidget); item->setFlags(Qt::ItemIsEnabled|Qt::ItemIsEditable|Qt::ItemIsSelectable); - item->setText(0, QLatin1String("unfiltered")); + item->setText(0, tr("unfiltered", "list of available documentation")); item->setText(1, QLatin1String("")); m_ui.customFilterWidget->editItem(item, 0); m_ui.removeButton->setDisabled(false); diff --git a/tools/assistant/tools/qhelpconverter/finishpage.cpp b/tools/assistant/tools/qhelpconverter/finishpage.cpp index 0be3a1b..f0228e3 100644 --- a/tools/assistant/tools/qhelpconverter/finishpage.cpp +++ b/tools/assistant/tools/qhelpconverter/finishpage.cpp @@ -52,8 +52,7 @@ FinishPage::FinishPage(QWidget *parent) : QWizardPage(parent) { setTitle(tr("Converting File")); - setSubTitle(QLatin1String("Creating the new Qt help files from the " - "old .adp file.")); + setSubTitle(tr("Creating the new Qt help files from the old ADP file.")); setFinalPage(true); QVBoxLayout *layout = new QVBoxLayout(this); diff --git a/tools/assistant/tools/qhelpconverter/helpwindow.cpp b/tools/assistant/tools/qhelpconverter/helpwindow.cpp index 9cc1a85..2c7e030 100644 --- a/tools/assistant/tools/qhelpconverter/helpwindow.cpp +++ b/tools/assistant/tools/qhelpconverter/helpwindow.cpp @@ -64,7 +64,7 @@ HelpWindow::HelpWindow(QWidget *parent) layout = new QVBoxLayout(frame); layout->setMargin(2); - QLabel *l = new QLabel(QLatin1String("<center><b>Wizard Assistant</b></center>")); + QLabel *l = new QLabel(tr("<center><b>Wizard Assistant</b></center>")); layout->addWidget(l); m_textEdit = new QTextEdit(); m_textEdit->setFrameStyle(QFrame::NoFrame); diff --git a/tools/assistant/tools/qhelpconverter/main.cpp b/tools/assistant/tools/qhelpconverter/main.cpp index 4b1d815..5ee624d 100644 --- a/tools/assistant/tools/qhelpconverter/main.cpp +++ b/tools/assistant/tools/qhelpconverter/main.cpp @@ -40,6 +40,9 @@ ****************************************************************************/ #include <QtCore/QFileInfo> +#include <QtCore/QTranslator> +#include <QtCore/QLocale> +#include <QtCore/QLibraryInfo> #include <QtGui/QApplication> #include "conversionwizard.h" @@ -49,6 +52,18 @@ QT_USE_NAMESPACE int main(int argc, char *argv[]) { QApplication app(argc, argv); + QTranslator translator; + QTranslator qtTranslator; + QTranslator qt_helpTranslator; + QString sysLocale = QLocale::system().name(); + QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath); + if (translator.load(QLatin1String("assistant_") + sysLocale, resourceDir) + && qtTranslator.load(QLatin1String("qt_") + sysLocale, resourceDir) + && qt_helpTranslator.load(QLatin1String("qt_help_") + sysLocale, resourceDir)) { + app.installTranslator(&translator); + app.installTranslator(&qtTranslator); + app.installTranslator(&qt_helpTranslator); + } ConversionWizard w; if (argc == 2) { diff --git a/tools/assistant/tools/qhelpgenerator/main.cpp b/tools/assistant/tools/qhelpgenerator/main.cpp index a309f42..637786c 100644 --- a/tools/assistant/tools/qhelpgenerator/main.cpp +++ b/tools/assistant/tools/qhelpgenerator/main.cpp @@ -44,11 +44,18 @@ #include <QtCore/QDir> #include <QtCore/QFileInfo> #include <QtCore/QCoreApplication> +#include <QtCore/QTranslator> +#include <QtCore/QLocale> +#include <QtCore/QLibraryInfo> #include <private/qhelpprojectdata_p.h> QT_USE_NAMESPACE +class QHG { + Q_DECLARE_TR_FUNCTIONS(QHelpGenerator) +}; + int main(int argc, char *argv[]) { QString error; @@ -60,6 +67,20 @@ int main(int argc, char *argv[]) bool showVersion = false; bool checkLinks = false; + QCoreApplication app(argc, argv); + QTranslator translator; + QTranslator qtTranslator; + QTranslator qt_helpTranslator; + QString sysLocale = QLocale::system().name(); + QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath); + if (translator.load(QLatin1String("assistant_") + sysLocale, resourceDir) + && qtTranslator.load(QLatin1String("qt_") + sysLocale, resourceDir) + && qt_helpTranslator.load(QLatin1String("qt_help_") + sysLocale, resourceDir)) { + app.installTranslator(&translator); + app.installTranslator(&qtTranslator); + app.installTranslator(&qt_helpTranslator); + } + for (int i = 1; i < argc; ++i) { arg = QString::fromLocal8Bit(argv[i]); if (arg == QLatin1String("-o")) { @@ -67,8 +88,7 @@ int main(int argc, char *argv[]) QFileInfo fi(QString::fromLocal8Bit(argv[i])); compressedFile = fi.absoluteFilePath(); } else { - error = QCoreApplication::translate("QHelpGenerator", - "Missing output file name!"); + error = QHG::tr("Missing output file name."); } } else if (arg == QLatin1String("-v")) { showVersion = true; @@ -84,16 +104,15 @@ int main(int argc, char *argv[]) } if (showVersion) { - fprintf(stdout, "Qt Help Generator version 1.0 (Qt %s)\n", - QT_VERSION_STR); + fputs(qPrintable(QHG::tr("Qt Help Generator version 1.0 (Qt %1)\n") + .arg(QT_VERSION_STR)), stdout); return 0; } if (projectFile.isEmpty() && !showHelp) - error = QCoreApplication::translate("QHelpGenerator", - "Missing Qt help project file!"); + error = QHG::tr("Missing Qt help project file."); - QString help = QCoreApplication::translate("QHelpGenerator", "\nUsage:\n\n" + QString help = QHG::tr("\nUsage:\n\n" "qhelpgenerator <help-project-file> [options]\n\n" " -o <compressed-file> Generates a Qt compressed help\n" " file called <compressed-file>.\n" @@ -105,7 +124,7 @@ int main(int argc, char *argv[]) " qhelpgenerator.\n\n"); if (showHelp) { - fprintf(stdout, "%s", qPrintable(help)); + fputs(qPrintable(help), stdout); return 0; }else if (!error.isEmpty()) { fprintf(stderr, "%s\n\n%s", qPrintable(error), qPrintable(help)); @@ -114,7 +133,7 @@ int main(int argc, char *argv[]) QFile file(projectFile); if (!file.open(QIODevice::ReadOnly)) { - fprintf(stderr, "Could not open %s!\n", qPrintable(projectFile)); + fputs(qPrintable(QHG::tr("Could not open %1.\n").arg(projectFile)), stderr); return -1; } @@ -130,8 +149,8 @@ int main(int argc, char *argv[]) QDir parentDir = fi.dir(); if (!parentDir.exists()) { if (!parentDir.mkpath(QLatin1String("."))) { - fprintf(stderr, "Could not create output directory: %s\n", - qPrintable(parentDir.path())); + fputs(qPrintable(QHG::tr("Could not create output directory: %1\n") + .arg(parentDir.path())), stderr); } } } @@ -142,7 +161,6 @@ int main(int argc, char *argv[]) return -1; } - QCoreApplication app(argc, argv); HelpGenerator generator; bool success = true; if (checkLinks) diff --git a/tools/assistant/tools/shared/helpgenerator.cpp b/tools/assistant/tools/shared/helpgenerator.cpp index 12008e6..4812bc5 100644 --- a/tools/assistant/tools/shared/helpgenerator.cpp +++ b/tools/assistant/tools/shared/helpgenerator.cpp @@ -73,12 +73,12 @@ QString HelpGenerator::error() const void HelpGenerator::printStatus(const QString &msg) { - fprintf(stdout, "%s\n", qPrintable(msg)); + puts(qPrintable(msg)); } void HelpGenerator::printWarning(const QString &msg) { - fprintf(stdout, "Warning: %s\n", qPrintable(msg)); + puts(qPrintable(tr("Warning: %1").arg(msg))); } QT_END_NAMESPACE diff --git a/tools/configure/configure.pro b/tools/configure/configure.pro index 73f3317..a3473af 100644 --- a/tools/configure/configure.pro +++ b/tools/configure/configure.pro @@ -28,7 +28,7 @@ INCLUDEPATH += \ $$QT_SOURCE_TREE/src/corelib/global \ $$QT_BUILD_TREE/include \ $$QT_BUILD_TREE/include/QtCore \ - $$QT_BUILD_TREE/tools/shared + $$QT_SOURCE_TREE/tools/shared HEADERS = configureapp.h environment.h tools.h\ $$QT_SOURCE_TREE/src/corelib/tools/qbytearray.h \ diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 0c716d1..09da581 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -341,7 +341,7 @@ Configure::Configure(int& argc, char** argv) dictionary[ "ACCESSIBILITY" ] = "yes"; dictionary[ "OPENGL" ] = "yes"; dictionary[ "OPENVG" ] = "no"; - dictionary[ "IPV6" ] = "yes"; // Always, dynamicly loaded + dictionary[ "IPV6" ] = "yes"; // Always, dynamically loaded dictionary[ "OPENSSL" ] = "auto"; dictionary[ "DBUS" ] = "auto"; dictionary[ "S60" ] = "yes"; @@ -2149,7 +2149,7 @@ bool Configure::checkAvailability(const QString &part) available = (paths.size() == 0); if (!available) { - if (epocRoot.isNull() || epocRoot == "") + if (epocRoot.isEmpty()) epocRoot = "<empty string>"; cout << endl << "The QtMultimedia audio backend will not be built because required" << endl @@ -2667,8 +2667,13 @@ void Configure::generateOutputVars() qtConfig += "audio-backend"; } - if (dictionary["WEBKIT"] == "yes") - qtConfig += "webkit"; + if (dictionary["WEBKIT"] == "yes") { + // This include takes care of adding "webkit" to QT_CONFIG. + QString src = sourcePath + "/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri"; + QString dst = buildPath + "/mkspecs/modules/qt_webkit_version.pri"; + QFile::remove(dst); + QFile::copy(src, dst); + } if (dictionary["DECLARATIVE"] == "yes") { if (dictionary[ "SCRIPT" ] == "no") { @@ -2695,7 +2700,7 @@ void Configure::generateOutputVars() QString set_config = dictionary["QCONFIG"]; if (possible_configs.contains(set_config)) { - foreach(QString cfg, possible_configs) { + foreach (const QString &cfg, possible_configs) { qtConfig += (cfg + "-config"); if (cfg == set_config) break; @@ -2821,7 +2826,7 @@ void Configure::generateCachefile() QStringList buildParts; buildParts << "libs" << "tools" << "examples" << "demos" << "docs" << "translations"; - foreach(QString item, disabledBuildParts) { + foreach (const QString &item, disabledBuildParts) { buildParts.removeAll(item); } cacheStream << "QT_BUILD_PARTS = " << buildParts.join(" ") << endl; @@ -3134,7 +3139,7 @@ void Configure::generateConfigfiles() QStringList kbdDrivers = dictionary["KBD_DRIVERS"].split(" ");; QStringList allKbdDrivers; allKbdDrivers<<"tty"<<"usb"<<"sl5000"<<"yopy"<<"vr41xx"<<"qvfb"<<"um"; - foreach(QString kbd, allKbdDrivers) { + foreach (const QString &kbd, allKbdDrivers) { if (!kbdDrivers.contains(kbd)) tmpStream<<"#define QT_NO_QWS_KBD_"<<kbd.toUpper()<<endl; } @@ -3142,7 +3147,7 @@ void Configure::generateConfigfiles() QStringList mouseDrivers = dictionary["MOUSE_DRIVERS"].split(" "); QStringList allMouseDrivers; allMouseDrivers << "pc"<<"bus"<<"linuxtp"<<"yopy"<<"vr41xx"<<"tslib"<<"qvfb"; - foreach(QString mouse, allMouseDrivers) { + foreach (const QString &mouse, allMouseDrivers) { if (!mouseDrivers.contains(mouse)) tmpStream<<"#define QT_NO_QWS_MOUSE_"<<mouse.toUpper()<<endl; } @@ -3150,7 +3155,7 @@ void Configure::generateConfigfiles() QStringList gfxDrivers = dictionary["GFX_DRIVERS"].split(" "); QStringList allGfxDrivers; allGfxDrivers<<"linuxfb"<<"transformed"<<"qvfb"<<"vnc"<<"multiscreen"<<"ahi"; - foreach(QString gfx, allGfxDrivers) { + foreach (const QString &gfx, allGfxDrivers) { if (!gfxDrivers.contains(gfx)) tmpStream<<"#define QT_NO_QWS_"<<gfx.toUpper()<<endl; } @@ -3158,7 +3163,7 @@ void Configure::generateConfigfiles() tmpStream<<"#define Q_WS_QWS"<<endl; QStringList depths = dictionary[ "QT_QWS_DEPTH" ].split(" "); - foreach(QString depth, depths) + foreach (const QString &depth, depths) tmpStream<<"#define QT_QWS_DEPTH_"+depth<<endl; } @@ -3607,7 +3612,10 @@ void Configure::buildHostTools() // generate Makefile QStringList args; args << QDir::toNativeSeparators(buildPath + "/bin/qmake"); - args << "-spec" << dictionary["QMAKESPEC"] << "-r"; + // override .qmake.cache because we are not cross-building these. + // we need a full path so that a build with -prefix will still find it. + args << "-spec" << QDir::toNativeSeparators(buildPath + "/mkspecs/" + dictionary["QMAKESPEC"]); + args << "-r"; args << "-o" << QDir::toNativeSeparators(toolBuildPath + "/Makefile"); QDir().mkpath(toolBuildPath); @@ -3745,8 +3753,7 @@ void Configure::generateMakefiles() printf("Generating Makefiles...\n"); generate = false; // Now Makefiles will be done } - args << "-spec"; - args << spec; + // don't pass -spec - .qmake.cache has it already args << "-r"; args << (sourcePath + "/projects.pro"); args << "-o"; diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp index 943a8a2..03fd0cc 100644 --- a/tools/configure/environment.cpp +++ b/tools/configure/environment.cpp @@ -281,8 +281,7 @@ static QByteArray qt_create_environment(const QStringList &environment) pos += tmpSize; } // add the user environment - for (QStringList::ConstIterator it = environment.begin(); it != environment.end(); it++ ) { - QString tmp = *it; + foreach (const QString &tmp, environment) { uint tmpSize = sizeof(wchar_t) * (tmp.length() + 1); envlist.resize(envlist.size() + tmpSize); memcpy(envlist.data() + pos, tmp.utf16(), tmpSize); @@ -386,7 +385,7 @@ int Environment::execute(QStringList arguments, const QStringList &additionalEnv switch(GetLastError()) { case E2BIG: cerr << "execute: Argument list exceeds 1024 bytes" << endl; - foreach(QString arg, arguments) + foreach (const QString &arg, arguments) cerr << " (" << arg.toLocal8Bit().constData() << ")" << endl; break; case ENOENT: @@ -400,7 +399,7 @@ int Environment::execute(QStringList arguments, const QStringList &additionalEnv break; default: cerr << "execute: Unknown error" << endl; - foreach(QString arg, arguments) + foreach (const QString &arg, arguments) cerr << " (" << arg.toLocal8Bit().constData() << ")" << endl; break; } diff --git a/tools/configure/tools.cpp b/tools/configure/tools.cpp index c4625af..c91f048 100644 --- a/tools/configure/tools.cpp +++ b/tools/configure/tools.cpp @@ -91,8 +91,8 @@ void Tools::checkLicense(QMap<QString,QString> &dictionary, QMap<QString,QString QStringList components = buffer.split( '=' ); if ( components.size() >= 2 ) { QStringList::Iterator it = components.begin(); - QString key = (*it++).trimmed().replace( "\"", QString() ).toUpper(); - QString value = (*it++).trimmed().replace( "\"", QString() ); + QString key = (*it++).trimmed().remove('"').toUpper(); + QString value = (*it++).trimmed().remove('"'); licenseInfo[ key ] = value; } } @@ -111,7 +111,7 @@ void Tools::checkLicense(QMap<QString,QString> &dictionary, QMap<QString,QString // Verify license info... QString licenseKey = licenseInfo["LICENSEKEYEXT"]; QByteArray clicenseKey = licenseKey.toLatin1(); - //We check the licence + //We check the license static const char * const SEP = "-"; char *licenseParts[NUMBER_OF_PARTS]; int partNumber = 0; @@ -218,7 +218,7 @@ void Tools::checkLicense(QMap<QString,QString> &dictionary, QMap<QString,QString if (QFile::exists(dictionary["QT_SOURCE_TREE"] + "/.LICENSE")) { // Generic, no-suffix license - dictionary["LICENSE_EXTENSION"] = QString(); + dictionary["LICENSE_EXTENSION"].clear(); } else if (dictionary["LICENSE_EXTENSION"].isEmpty()) { cout << "License file does not contain proper license key." << endl; dictionary["DONE"] = "error"; @@ -239,7 +239,7 @@ void Tools::checkLicense(QMap<QString,QString> &dictionary, QMap<QString,QString fromLicenseFile += "-US"; if (!CopyFile((wchar_t*)QDir::toNativeSeparators(fromLicenseFile).utf16(), - (wchar_t*)QDir::toNativeSeparators(toLicenseFile).utf16(), FALSE)) { + (wchar_t*)QDir::toNativeSeparators(toLicenseFile).utf16(), false)) { cout << "Failed to copy license file (" << fromLicenseFile << ")"; dictionary["DONE"] = "error"; return; diff --git a/tools/designer/src/components/propertyeditor/defs.cpp b/tools/designer/src/components/propertyeditor/defs.cpp deleted file mode 100644 index 54dec74..0000000 --- a/tools/designer/src/components/propertyeditor/defs.cpp +++ /dev/null @@ -1,107 +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 Qt Designer 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 "defs.h" - -QT_BEGIN_NAMESPACE - -namespace qdesigner_internal { - -int size_type_to_int( QSizePolicy::Policy t ) -{ - if ( t == QSizePolicy::Fixed ) - return 0; - if ( t == QSizePolicy::Minimum ) - return 1; - if ( t == QSizePolicy::Maximum ) - return 2; - if ( t == QSizePolicy::Preferred ) - return 3; - if ( t == QSizePolicy::MinimumExpanding ) - return 4; - if ( t == QSizePolicy::Expanding ) - return 5; - if ( t == QSizePolicy::Ignored ) - return 6; - return 0; -} - -QString size_type_to_string( QSizePolicy::Policy t ) -{ - if ( t == QSizePolicy::Fixed ) - return QString::fromUtf8("Fixed"); - if ( t == QSizePolicy::Minimum ) - return QString::fromUtf8("Minimum"); - if ( t == QSizePolicy::Maximum ) - return QString::fromUtf8("Maximum"); - if ( t == QSizePolicy::Preferred ) - return QString::fromUtf8("Preferred"); - if ( t == QSizePolicy::MinimumExpanding ) - return QString::fromUtf8("MinimumExpanding"); - if ( t == QSizePolicy::Expanding ) - return QString::fromUtf8("Expanding"); - if ( t == QSizePolicy::Ignored ) - return QString::fromUtf8("Ignored"); - return QString(); -} - -QSizePolicy::Policy int_to_size_type( int i ) -{ - if ( i == 0 ) - return QSizePolicy::Fixed; - if ( i == 1 ) - return QSizePolicy::Minimum; - if ( i == 2 ) - return QSizePolicy::Maximum; - if ( i == 3 ) - return QSizePolicy::Preferred; - if ( i == 4 ) - return QSizePolicy::MinimumExpanding; - if ( i == 5 ) - return QSizePolicy::Expanding; - if ( i == 6 ) - return QSizePolicy::Ignored; - return QSizePolicy::Preferred; -} - -} // namespace qdesigner_internal - -QT_END_NAMESPACE diff --git a/tools/designer/src/components/propertyeditor/propertyeditor.pri b/tools/designer/src/components/propertyeditor/propertyeditor.pri index 7d2e7cb..bb1afdb 100644 --- a/tools/designer/src/components/propertyeditor/propertyeditor.pri +++ b/tools/designer/src/components/propertyeditor/propertyeditor.pri @@ -45,10 +45,8 @@ SOURCES += $$PWD/propertyeditor.cpp \ HEADERS += \ $$PWD/propertyeditor_global.h \ - $$PWD/defs.h \ $$PWD/qlonglongvalidator.h -SOURCES += $$PWD/defs.cpp \ - $$PWD/qlonglongvalidator.cpp +SOURCES += $$PWD/qlonglongvalidator.cpp RESOURCES += $$PWD/propertyeditor.qrc diff --git a/tools/designer/src/components/taskmenu/itemlisteditor.cpp b/tools/designer/src/components/taskmenu/itemlisteditor.cpp index 94959fd..9f8e9c8 100644 --- a/tools/designer/src/components/taskmenu/itemlisteditor.cpp +++ b/tools/designer/src/components/taskmenu/itemlisteditor.cpp @@ -114,20 +114,20 @@ void AbstractItemEditor::keyPressEvent(QKeyEvent *e) } static const char * const itemFlagNames[] = { - "Selectable", - "Editable", - "DragEnabled", - "DropEnabled", - "UserCheckable", - "Enabled", - "Tristate", + QT_TRANSLATE_NOOP("AbstractItemEditor", "Selectable"), + QT_TRANSLATE_NOOP("AbstractItemEditor", "Editable"), + QT_TRANSLATE_NOOP("AbstractItemEditor", "DragEnabled"), + QT_TRANSLATE_NOOP("AbstractItemEditor", "DropEnabled"), + QT_TRANSLATE_NOOP("AbstractItemEditor", "UserCheckable"), + QT_TRANSLATE_NOOP("AbstractItemEditor", "Enabled"), + QT_TRANSLATE_NOOP("AbstractItemEditor", "Tristate"), 0 }; static const char * const checkStateNames[] = { - "Unchecked", - "PartiallyChecked", - "Checked", + QT_TRANSLATE_NOOP("AbstractItemEditor", "Unchecked"), + QT_TRANSLATE_NOOP("AbstractItemEditor", "PartiallyChecked"), + QT_TRANSLATE_NOOP("AbstractItemEditor", "Checked"), 0 }; @@ -135,7 +135,7 @@ static QStringList c2qStringList(const char * const in[]) { QStringList out; for (int i = 0; in[i]; i++) - out << QLatin1String(in[i]); + out << AbstractItemEditor::tr(in[i]); return out; } diff --git a/tools/designer/src/lib/shared/plugindialog.cpp b/tools/designer/src/lib/shared/plugindialog.cpp index 3e88043..63ba81c 100644 --- a/tools/designer/src/lib/shared/plugindialog.cpp +++ b/tools/designer/src/lib/shared/plugindialog.cpp @@ -102,7 +102,7 @@ void PluginDialog::populateTreeWidget() const QStringList fileNames = pluginManager->registeredPlugins(); if (!fileNames.isEmpty()) { - QTreeWidgetItem *topLevelItem = setTopLevelItem(QLatin1String("Loaded Plugins")); + QTreeWidgetItem *topLevelItem = setTopLevelItem(tr("Loaded Plugins")); QFont boldFont = topLevelItem->font(0); foreach (const QString &fileName, fileNames) { @@ -125,7 +125,7 @@ void PluginDialog::populateTreeWidget() const QStringList notLoadedPlugins = pluginManager->failedPlugins(); if (!notLoadedPlugins.isEmpty()) { - QTreeWidgetItem *topLevelItem = setTopLevelItem(QLatin1String("Failed Plugins")); + QTreeWidgetItem *topLevelItem = setTopLevelItem(tr("Failed Plugins")); const QFont boldFont = topLevelItem->font(0); foreach (const QString &plugin, notLoadedPlugins) { const QString failureReason = pluginManager->failureReason(plugin); diff --git a/tools/designer/src/plugins/phononwidgets/seeksliderplugin.cpp b/tools/designer/src/plugins/phononwidgets/seeksliderplugin.cpp index c508fa2..7f597ff 100644 --- a/tools/designer/src/plugins/phononwidgets/seeksliderplugin.cpp +++ b/tools/designer/src/plugins/phononwidgets/seeksliderplugin.cpp @@ -66,12 +66,12 @@ QString SeekSliderPlugin::group() const QString SeekSliderPlugin::toolTip() const { - return QString(QLatin1String(toolTipC)); + return tr(toolTipC); } QString SeekSliderPlugin::whatsThis() const { - return QString(QLatin1String(toolTipC)); + return tr(toolTipC); } QString SeekSliderPlugin::includeFile() const diff --git a/tools/designer/src/plugins/phononwidgets/videoplayerplugin.cpp b/tools/designer/src/plugins/phononwidgets/videoplayerplugin.cpp index d4af121..489a08c 100644 --- a/tools/designer/src/plugins/phononwidgets/videoplayerplugin.cpp +++ b/tools/designer/src/plugins/phononwidgets/videoplayerplugin.cpp @@ -72,12 +72,12 @@ QString VideoPlayerPlugin::group() const QString VideoPlayerPlugin::toolTip() const { - return QString(QLatin1String(toolTipC)); + return tr(toolTipC); } QString VideoPlayerPlugin::whatsThis() const { - return QString(QLatin1String(toolTipC)); + return tr(toolTipC); } QString VideoPlayerPlugin::includeFile() const diff --git a/tools/designer/src/plugins/phononwidgets/volumesliderplugin.cpp b/tools/designer/src/plugins/phononwidgets/volumesliderplugin.cpp index becd5d9..24eb829 100644 --- a/tools/designer/src/plugins/phononwidgets/volumesliderplugin.cpp +++ b/tools/designer/src/plugins/phononwidgets/volumesliderplugin.cpp @@ -66,12 +66,12 @@ QString VolumeSliderPlugin::group() const QString VolumeSliderPlugin::toolTip() const { - return QString(QLatin1String(toolTipC)); + return tr(toolTipC); } QString VolumeSliderPlugin::whatsThis() const { - return QString(QLatin1String(toolTipC)); + return tr(toolTipC); } QString VolumeSliderPlugin::includeFile() const diff --git a/tools/designer/src/plugins/qdeclarativeview/qdeclarativeview_plugin.cpp b/tools/designer/src/plugins/qdeclarativeview/qdeclarativeview_plugin.cpp index b352a9b..7148ad0 100644 --- a/tools/designer/src/plugins/qdeclarativeview/qdeclarativeview_plugin.cpp +++ b/tools/designer/src/plugins/qdeclarativeview/qdeclarativeview_plugin.cpp @@ -69,12 +69,12 @@ QString QDeclarativeViewPlugin::group() const QString QDeclarativeViewPlugin::toolTip() const { - return QString(QLatin1String(toolTipC)); + return tr(toolTipC); } QString QDeclarativeViewPlugin::whatsThis() const { - return QString(QLatin1String(toolTipC)); + return tr(toolTipC); } QString QDeclarativeViewPlugin::includeFile() const diff --git a/tools/designer/src/plugins/qwebview/qwebview_plugin.cpp b/tools/designer/src/plugins/qwebview/qwebview_plugin.cpp index 61f7e66..c90e191 100644 --- a/tools/designer/src/plugins/qwebview/qwebview_plugin.cpp +++ b/tools/designer/src/plugins/qwebview/qwebview_plugin.cpp @@ -69,12 +69,12 @@ QString QWebViewPlugin::group() const QString QWebViewPlugin::toolTip() const { - return QString(QLatin1String(toolTipC)); + return tr(toolTipC); } QString QWebViewPlugin::whatsThis() const { - return QString(QLatin1String(toolTipC)); + return tr(toolTipC); } QString QWebViewPlugin::includeFile() const diff --git a/tools/linguist/lconvert/main.cpp b/tools/linguist/lconvert/main.cpp index 094406c..d691548 100644 --- a/tools/linguist/lconvert/main.cpp +++ b/tools/linguist/lconvert/main.cpp @@ -45,11 +45,17 @@ #include <QtCore/QDebug> #include <QtCore/QString> #include <QtCore/QStringList> +#include <QtCore/QTranslator> +#include <QtCore/QLibraryInfo> #include <iostream> QT_USE_NAMESPACE +class LC { + Q_DECLARE_TR_FUNCTIONS(LConvert) +}; + static int usage(const QStringList &args) { Q_UNUSED(args); @@ -59,7 +65,7 @@ static int usage(const QStringList &args) foreach (Translator::FileFormat format, Translator::registeredFileFormats()) loaders += line.arg(format.extension, -5).arg(format.description); - std::cerr << qPrintable(QString(QLatin1String("\nUsage:\n" + std::cerr << qPrintable(LC::tr("\nUsage:\n" " lconvert [options] <infile> [<infile>...]\n\n" "lconvert is part of Qt's Linguist tool chain. It can be used as a\n" "stand-alone tool to convert and filter translation data files.\n" @@ -121,7 +127,7 @@ static int usage(const QStringList &args) " 0 on success\n" " 1 on command line parse failures\n" " 2 on read failures\n" - " 3 on write failures\n")).arg(loaders)); + " 3 on write failures\n").arg(loaders)); return 1; } @@ -134,8 +140,17 @@ struct File int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); - QStringList args = app.arguments(); + QTranslator translator; + QTranslator qtTranslator; + QString sysLocale = QLocale::system().name(); + QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath); + if (translator.load(QLatin1String("linguist_") + sysLocale, resourceDir) + && qtTranslator.load(QLatin1String("qt_") + sysLocale, resourceDir)) { + app.installTranslator(&translator); + app.installTranslator(&qtTranslator); + } + QStringList args = app.arguments(); QList<File> inFiles; QString inFormat(QLatin1String("auto")); QString outFileName; diff --git a/tools/linguist/linguist/phrase.cpp b/tools/linguist/linguist/phrase.cpp index 254daf4..709ec35 100644 --- a/tools/linguist/linguist/phrase.cpp +++ b/tools/linguist/linguist/phrase.cpp @@ -188,10 +188,9 @@ bool QphHandler::characters(const QString &ch) bool QphHandler::fatalError(const QXmlParseException &exception) { if (ferrorCount++ == 0) { - QString msg; - msg.sprintf("Parse error at line %d, column %d (%s).", - exception.lineNumber(), exception.columnNumber(), - exception.message().toLatin1().constData()); + QString msg = PhraseBook::tr("Parse error at line %1, column %2 (%3).") + .arg(exception.lineNumber()).arg(exception.columnNumber()) + .arg(exception.message()); QMessageBox::information(0, QObject::tr("Qt Linguist"), msg); } diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp index b5cff90..19377ef 100644 --- a/tools/linguist/lrelease/main.cpp +++ b/tools/linguist/lrelease/main.cpp @@ -65,6 +65,17 @@ static void initBinaryDir( const char *argv0 #endif ); + +struct LR { + static inline QString tr(const char *sourceText, const char *comment = 0) + { + return QCoreApplication::translate("LRelease", sourceText, comment); + } +}; +#else +class LR { + Q_DECLARE_TR_FUNCTIONS(LRelease) +}; #endif static void printOut(const QString & out) @@ -75,7 +86,7 @@ static void printOut(const QString & out) static void printUsage() { - printOut(QCoreApplication::tr( + printOut(LR::tr( "Usage:\n" " lrelease [options] project-file\n" " lrelease [options] ts-files [-qm qm-file]\n\n" @@ -108,7 +119,7 @@ static bool loadTsFile(Translator &tor, const QString &tsFileName, bool /* verbo ConversionData cd; bool ok = tor.load(tsFileName, cd, QLatin1String("auto")); if (!ok) { - std::cerr << "lrelease error: " << qPrintable(cd.error()); + std::cerr << qPrintable(LR::tr("lrelease error: %1").arg(cd.error())); } else { if (!cd.errors().isEmpty()) printOut(cd.error()); @@ -123,17 +134,17 @@ static bool releaseTranslator(Translator &tor, const QString &qmFileName, tor.reportDuplicates(tor.resolveDuplicates(), qmFileName, cd.isVerbose()); if (cd.isVerbose()) - printOut(QCoreApplication::tr( "Updating '%1'...\n").arg(qmFileName)); + printOut(LR::tr("Updating '%1'...\n").arg(qmFileName)); if (removeIdentical) { if (cd.isVerbose()) - printOut(QCoreApplication::tr( "Removing translations equal to source text in '%1'...\n").arg(qmFileName)); + printOut(LR::tr("Removing translations equal to source text in '%1'...\n").arg(qmFileName)); tor.stripIdenticalSourceTranslations(); } QFile file(qmFileName); if (!file.open(QIODevice::WriteOnly)) { - std::cerr << "lrelease error: cannot create '" << qPrintable(qmFileName) - << "': " << qPrintable(file.errorString()) << std::endl; + std::cerr << qPrintable(LR::tr("lrelease error: cannot create '%1': %2\n") + .arg(qmFileName, file.errorString())); return false; } @@ -142,8 +153,8 @@ static bool releaseTranslator(Translator &tor, const QString &qmFileName, file.close(); if (!ok) { - std::cerr << "lrelease error: cannot save '" << qPrintable(qmFileName) - << "': " << qPrintable(cd.error()); + std::cerr << qPrintable(LR::tr("lrelease error: cannot save '%1': %2") + .arg(qmFileName, cd.error())); } else if (!cd.errors().isEmpty()) { printOut(cd.error()); } @@ -181,8 +192,14 @@ int main(int argc, char **argv) #else QCoreApplication app(argc, argv); QTranslator translator; - if (translator.load(QLatin1String("lrelease_") + QLocale::system().name())) + QTranslator qtTranslator; + QString sysLocale = QLocale::system().name(); + QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath); + if (translator.load(QLatin1String("linguist_") + sysLocale, resourceDir) + && qtTranslator.load(QLatin1String("qt_") + sysLocale, resourceDir)) { app.installTranslator(&translator); + app.installTranslator(&qtTranslator); + } #endif ConversionData cd; @@ -221,7 +238,7 @@ int main(int argc, char **argv) cd.m_verbose = true; continue; } else if (!strcmp(argv[i], "-version")) { - printOut(QCoreApplication::tr( "lrelease version %1\n").arg(QLatin1String(QT_VERSION_STR)) ); + printOut(LR::tr("lrelease version %1\n").arg(QLatin1String(QT_VERSION_STR))); return 0; } else if (!strcmp(argv[i], "-qm")) { if (i == argc - 1) { @@ -255,20 +272,23 @@ int main(int argc, char **argv) visitor.setVerbose(cd.isVerbose()); if (!visitor.queryProFile(&pro)) { - std::cerr << "lrelease error: cannot read project file '" - << qPrintable(inputFile) << "'.\n"; + std::cerr << qPrintable(LR::tr( + "lrelease error: cannot read project file '%1'.\n") + .arg(inputFile)); continue; } if (!visitor.accept(&pro)) { - std::cerr << "lrelease error: cannot process project file '" - << qPrintable(inputFile) << "'.\n"; + std::cerr << qPrintable(LR::tr( + "lrelease error: cannot process project file '%1'.\n") + .arg(inputFile)); continue; } QStringList translations = visitor.values(QLatin1String("TRANSLATIONS")); if (translations.isEmpty()) { - std::cerr << "lrelease warning: Met no 'TRANSLATIONS' entry in project file '" - << qPrintable(inputFile) << "'\n"; + std::cerr << qPrintable(LR::tr( + "lrelease warning: Met no 'TRANSLATIONS' entry in project file '%1'\n") + .arg(inputFile)); } else { QDir proDir(fi.absolutePath()); foreach (const QString &trans, translations) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index bc9bb26..970d44b 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -50,6 +50,7 @@ #include <QtCore/QString> #include <QtCore/QTextCodec> #include <QtCore/QTextStream> +#include <QtCore/QCoreApplication> #include <iostream> @@ -57,6 +58,10 @@ QT_BEGIN_NAMESPACE +class LU { + Q_DECLARE_TR_FUNCTIONS(LUpdate) +}; + /* qmake ignore Q_OBJECT */ static QString MagicComment(QLatin1String("TRANSLATOR")); @@ -624,8 +629,8 @@ uint CppParser::getToken() || yyBraceDepth != is.braceDepth1st || yyParenDepth != is.parenDepth1st) yyMsg(is.elseLine) - << "Parenthesis/bracket/brace mismatch between " - "#if and #else branches; using #if branch\n"; + << qPrintable(LU::tr("Parenthesis/bracket/brace mismatch between " + "#if and #else branches; using #if branch\n")); } else { is.bracketDepth1st = yyBracketDepth; is.braceDepth1st = yyBraceDepth; @@ -647,8 +652,8 @@ uint CppParser::getToken() || yyBraceDepth != is.braceDepth1st || yyParenDepth != is.parenDepth1st) yyMsg(is.elseLine) - << "Parenthesis/brace mismatch between " - "#if and #else branches; using #if branch\n"; + << qPrintable(LU::tr("Parenthesis/brace mismatch between " + "#if and #else branches; using #if branch\n")); yyBracketDepth = is.bracketDepth1st; yyBraceDepth = is.braceDepth1st; yyParenDepth = is.parenDepth1st; @@ -674,7 +679,7 @@ uint CppParser::getToken() forever { yyCh = getChar(); if (yyCh == EOF) { - yyMsg() << "Unterminated C++ comment\n"; + yyMsg() << qPrintable(LU::tr("Unterminated C++ comment\n")); break; } @@ -804,7 +809,7 @@ uint CppParser::getToken() forever { yyCh = getChar(); if (yyCh == EOF) { - yyMsg() << "Unterminated C++ comment\n"; + yyMsg() << qPrintable(LU::tr("Unterminated C++ comment\n")); break; } *ptr++ = yyCh; @@ -837,7 +842,7 @@ uint CppParser::getToken() yyWord.resize(ptr - (ushort *)yyWord.unicode()); if (yyCh != '"') - yyMsg() << "Unterminated C++ string\n"; + yyMsg() << qPrintable(LU::tr("Unterminated C++ string\n")); else yyCh = getChar(); return Tok_String; @@ -894,8 +899,8 @@ uint CppParser::getToken() if (yyBraceDepth == yyMinBraceDepth) { if (!inDefine) yyMsg(yyCurLineNo) - << "Excess closing brace in C++ code" - " (or abuse of the C++ preprocessor)\n"; + << qPrintable(LU::tr("Excess closing brace in C++ code" + " (or abuse of the C++ preprocessor)\n")); // Avoid things getting messed up even more yyCh = getChar(); return Tok_Semicolon; @@ -912,8 +917,8 @@ uint CppParser::getToken() case ')': if (yyParenDepth == 0) yyMsg(yyCurLineNo) - << "Excess closing parenthesis in C++ code" - " (or abuse of the C++ preprocessor)\n"; + << qPrintable(LU::tr("Excess closing parenthesis in C++ code" + " (or abuse of the C++ preprocessor)\n")); else yyParenDepth--; yyCh = getChar(); @@ -927,8 +932,8 @@ uint CppParser::getToken() case ']': if (yyBracketDepth == 0) yyMsg(yyCurLineNo) - << "Excess closing bracket in C++ code" - " (or abuse of the C++ preprocessor)\n"; + << qPrintable(LU::tr("Excess closing bracket in C++ code" + " (or abuse of the C++ preprocessor)\n")); else yyBracketDepth--; yyCh = getChar(); @@ -1296,7 +1301,7 @@ void CppParser::processInclude(const QString &file, ConversionData &cd, QString cleanFile = QDir::cleanPath(file); if (inclusions.contains(cleanFile)) { - yyMsg() << "circular inclusion of " << qPrintable(cleanFile) << std::endl; + yyMsg() << qPrintable(LU::tr("circular inclusion of %1\n").arg(cleanFile)); return; } @@ -1320,9 +1325,7 @@ void CppParser::processInclude(const QString &file, ConversionData &cd, QFile f(cleanFile); if (!f.open(QIODevice::ReadOnly)) { - yyMsg() - << "Cannot open " << qPrintable(cleanFile) << ": " - << qPrintable(f.errorString()) << std::endl; + yyMsg() << qPrintable(LU::tr("Cannot open %1: %2\n").arg(cleanFile, f.errorString())); return; } @@ -1766,7 +1769,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) if (!tor) goto case_default; if (!sourcetext.isEmpty()) - yyMsg() << "//% cannot be used with tr() / QT_TR_NOOP(). Ignoring\n"; + yyMsg() << qPrintable(LU::tr("//% cannot be used with tr() / QT_TR_NOOP(). Ignoring\n")); utf8 = (yyTok == Tok_trUtf8); line = yyLineNo; yyTok = getToken(); @@ -1787,9 +1790,8 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) QStringList unresolved; if (!fullyQualify(namespaces, pendingContext, true, &functionContext, &unresolved)) { functionContextUnresolved = unresolved.join(strColons); - yyMsg() << "Qualifying with unknown namespace/class " - << qPrintable(stringifyNamespace(functionContext)) << "::" - << qPrintable(unresolved.first()) << std::endl; + yyMsg() << qPrintable(LU::tr("Qualifying with unknown namespace/class %1::%2\n") + .arg(stringifyNamespace(functionContext)).arg(unresolved.first())); } pendingContext.clear(); } @@ -1797,7 +1799,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) if (functionContextUnresolved.isEmpty()) { int idx = functionContext.length(); if (idx < 2) { - yyMsg() << "tr() cannot be called without context\n"; + yyMsg() << qPrintable(LU::tr("tr() cannot be called without context\n")); break; } Namespace *fctx; @@ -1806,8 +1808,8 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) context = stringifyNamespace(functionContext); fctx = findNamespace(functionContext)->classDef; if (!fctx->complained) { - yyMsg() << "Class '" << qPrintable(context) - << "' lacks Q_OBJECT macro\n"; + yyMsg() << qPrintable(LU::tr("Class '%1' lacks Q_OBJECT macro\n") + .arg(context)); fctx->complained = true; } goto gotctx; @@ -1835,8 +1837,8 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) int last = prefix.lastIndexOf(strColons); QString className = prefix.mid(last == -1 ? 0 : last + 2); if (!className.isEmpty() && className == functionName) { - yyMsg() << "It is not recommended to call tr() from within a constructor '" - << qPrintable(className) << "::" << qPrintable(functionName) << "'\n"; + yyMsg() << qPrintable(LU::tr("It is not recommended to call tr() from within a constructor '%1::%2'\n") + .arg(className).arg(functionName)); } #endif prefix.chop(2); @@ -1851,7 +1853,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) context = fctx->trQualification; } if (!fctx->hasTrFunctions && !fctx->complained) { - yyMsg() << "Class '" << qPrintable(context) << "' lacks Q_OBJECT macro\n"; + yyMsg() << qPrintable(LU::tr("Class '%1' lacks Q_OBJECT macro\n").arg(context)); fctx->complained = true; } } else { @@ -1873,7 +1875,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) if (!tor) goto case_default; if (!sourcetext.isEmpty()) - yyMsg() << "//% cannot be used with translate() / QT_TRANSLATE_NOOP(). Ignoring\n"; + yyMsg() << qPrintable(LU::tr("//% cannot be used with translate() / QT_TRANSLATE_NOOP(). Ignoring\n")); utf8 = (yyTok == Tok_translateUtf8); line = yyLineNo; yyTok = getToken(); @@ -1928,7 +1930,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) if (!tor) goto case_default; if (!msgid.isEmpty()) - yyMsg() << "//= cannot be used with qtTrId() / QT_TRID_NOOP(). Ignoring\n"; + yyMsg() << qPrintable(LU::tr("//= cannot be used with qtTrId() / QT_TRID_NOOP(). Ignoring\n")); //utf8 = false; // Maybe use //%% or something like that line = yyLineNo; yyTok = getToken(); @@ -1995,13 +1997,13 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) if (isspace(c)) continue; if (c != '"') { - yyMsg() << "Unexpected character in meta string\n"; + yyMsg() << qPrintable(LU::tr("Unexpected character in meta string\n")); break; } forever { if (p >= yyWord.length()) { whoops: - yyMsg() << "Unterminated meta string\n"; + yyMsg() << qPrintable(LU::tr("Unterminated meta string\n")); break; } c = yyWord.unicode()[p++].unicode(); @@ -2054,7 +2056,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) case Tok_Arrow: yyTok = getToken(); if (yyTok == Tok_tr || yyTok == Tok_trUtf8) - yyMsg() << "Cannot invoke tr() like this\n"; + yyMsg() << qPrintable(LU::tr("Cannot invoke tr() like this\n")); break; case Tok_ColonColon: if (yyBraceDepth == namespaceDepths.count() && yyParenDepth == 0 && !yyTokColonSeen) @@ -2087,7 +2089,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) prospectiveContext.clear(); prefix.clear(); if (!sourcetext.isEmpty() || !extracomment.isEmpty() || !msgid.isEmpty() || !extra.isEmpty()) { - yyMsg() << "Discarding unconsumed meta data\n"; + yyMsg() << qPrintable(LU::tr("Discarding unconsumed meta data\n")); sourcetext.clear(); extracomment.clear(); msgid.clear(); @@ -2127,16 +2129,16 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) if (yyBraceDepth != 0) yyMsg(yyBraceLineNo) - << "Unbalanced opening brace in C++ code" - " (or abuse of the C++ preprocessor)\n"; + << qPrintable(LU::tr("Unbalanced opening brace in C++ code" + " (or abuse of the C++ preprocessor)\n")); else if (yyParenDepth != 0) yyMsg(yyParenLineNo) - << "Unbalanced opening parenthesis in C++ code" - " (or abuse of the C++ preprocessor)\n"; + << qPrintable(LU::tr("Unbalanced opening parenthesis in C++ code" + " (or abuse of the C++ preprocessor)\n")); else if (yyBracketDepth != 0) yyMsg(yyBracketLineNo) - << "Unbalanced opening bracket in C++ code" - " (or abuse of the C++ preprocessor)\n"; + << qPrintable(LU::tr("Unbalanced opening bracket in C++ code" + " (or abuse of the C++ preprocessor)\n")); } const ParseResults *CppParser::recordResults(bool isHeader) @@ -2197,8 +2199,7 @@ void loadCPP(Translator &translator, const QStringList &filenames, ConversionDat QFile file(filename); if (!file.open(QIODevice::ReadOnly)) { - cd.appendError(QString::fromLatin1("Cannot open %1: %2") - .arg(filename, file.errorString())); + cd.appendError(LU::tr("Cannot open %1: %2").arg(filename, file.errorString())); continue; } diff --git a/tools/linguist/lupdate/java.cpp b/tools/linguist/lupdate/java.cpp index dc66e2b..165b6a3 100644 --- a/tools/linguist/lupdate/java.cpp +++ b/tools/linguist/lupdate/java.cpp @@ -50,6 +50,7 @@ #include <QtCore/QStack> #include <QtCore/QString> #include <QtCore/QTextCodec> +#include <QtCore/QCoreApplication> #include <iostream> @@ -57,6 +58,10 @@ QT_BEGIN_NAMESPACE +class LU { + Q_DECLARE_TR_FUNCTIONS(LUpdate) +}; + enum { Tok_Eof, Tok_class, Tok_return, Tok_tr, Tok_translate, Tok_Ident, Tok_Package, Tok_Comment, Tok_String, Tok_Colon, Tok_Dot, @@ -196,7 +201,7 @@ static int getToken() while ( !metAsterSlash ) { yyCh = getChar(); if ( yyCh == EOF ) { - yyMsg() << "Unterminated Java comment.\n"; + yyMsg() << qPrintable(LU::tr("Unterminated Java comment.\n")); return Tok_Comment; } @@ -232,7 +237,7 @@ static int getToken() else { int sub(yyCh.toLower().toAscii() - 87); if( sub > 15 || sub < 10) { - yyMsg() << "Invalid Unicode value.\n"; + yyMsg() << qPrintable(LU::tr("Invalid Unicode value.\n")); break; } unicode += sub; @@ -255,7 +260,7 @@ static int getToken() } if ( yyCh != QLatin1Char('"') ) - yyMsg() << "Unterminated string.\n"; + yyMsg() << qPrintable(LU::tr("Unterminated string.\n")); yyCh = getChar(); @@ -368,8 +373,9 @@ static bool matchString( QString &s ) if (yyTok == Tok_String) s += yyString; else { - yyMsg() << "String used in translation can contain only literals" - " concatenated with other literals, not expressions or numbers.\n"; + yyMsg() << qPrintable(LU::tr( + "String used in translation can contain only literals" + " concatenated with other literals, not expressions or numbers.\n")); return false; } yyTok = getToken(); @@ -477,7 +483,7 @@ static void parse( Translator *tor ) yyScope.push(new Scope(yyIdent, Scope::Clazz, yyLineNo)); } else { - yyMsg() << "'class' must be followed by a class name.\n"; + yyMsg() << qPrintable(LU::tr("'class' must be followed by a class name.\n")); break; } while (!match(Tok_LeftBrace)) { @@ -549,7 +555,7 @@ static void parse( Translator *tor ) case Tok_RightBrace: if ( yyScope.isEmpty() ) { - yyMsg() << "Excess closing brace.\n"; + yyMsg() << qPrintable(LU::tr("Excess closing brace.\n")); } else delete (yyScope.pop()); @@ -578,7 +584,7 @@ static void parse( Translator *tor ) yyPackage.append(QLatin1String(".")); break; default: - yyMsg() << "'package' must be followed by package name.\n"; + yyMsg() << qPrintable(LU::tr("'package' must be followed by package name.\n")); break; } yyTok = getToken(); @@ -591,9 +597,9 @@ static void parse( Translator *tor ) } if ( !yyScope.isEmpty() ) - yyMsg(yyScope.top()->line) << "Unbalanced opening brace.\n"; + yyMsg(yyScope.top()->line) << qPrintable(LU::tr("Unbalanced opening brace.\n")); else if ( yyParenDepth != 0 ) - yyMsg(yyParenLineNo) << "Unbalanced opening parenthesis.\n"; + yyMsg(yyParenLineNo) << qPrintable(LU::tr("Unbalanced opening parenthesis.\n")); } @@ -601,8 +607,7 @@ bool loadJava(Translator &translator, const QString &filename, ConversionData &c { QFile file(filename); if (!file.open(QIODevice::ReadOnly)) { - cd.appendError(QString::fromLatin1("Cannot open %1: %2") - .arg(filename, file.errorString())); + cd.appendError(LU::tr("Cannot open %1: %2").arg(filename, file.errorString())); return false; } diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index a575192..d96e205 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -52,6 +52,8 @@ #include <QtCore/QString> #include <QtCore/QStringList> #include <QtCore/QTextCodec> +#include <QtCore/QTranslator> +#include <QtCore/QLibraryInfo> #include <iostream> @@ -79,7 +81,7 @@ static void recursiveFileInfoList(const QDir &dir, static void printUsage() { - printOut(QObject::tr( + printOut(LU::tr( "Usage:\n" " lupdate [options] [project-file]...\n" " lupdate [options] [source-file|path|@lst-file]... -ts ts-files|@lst-file\n\n" @@ -186,7 +188,7 @@ static void updateTsFiles(const Translator &fetchedTor, const QStringList &tsFil else if (options & AbsoluteLocations) tor.setLocationsType(Translator::AbsoluteLocations); if (options & Verbose) - printOut(QObject::tr("Updating '%1'...\n").arg(fn)); + printOut(LU::tr("Updating '%1'...\n").arg(fn)); UpdateOptions theseOptions = options; if (tor.locationsType() == Translator::NoLocations) // Could be set from file @@ -201,7 +203,7 @@ static void updateTsFiles(const Translator &fetchedTor, const QStringList &tsFil } if (options & PluralOnly) { if (options & Verbose) - printOut(QObject::tr("Stripping non plural forms in '%1'...\n").arg(fn)); + printOut(LU::tr("Stripping non plural forms in '%1'...\n").arg(fn)); out.stripNonPluralForms(); } if (options & NoObsolete) @@ -359,12 +361,12 @@ static void processProjects( if (visitor.contains(QLatin1String("TRANSLATIONS"))) { if (parentTor) { if (topLevel) { - std::cerr << "lupdate warning: TS files from command line " - "will override TRANSLATIONS in " << qPrintable(proFile) << ".\n"; + std::cerr << qPrintable(LU::tr("lupdate warning: TS files from command line " + "will override TRANSLATIONS in %1.\n").arg(proFile)); goto noTrans; } else if (nestComplain) { - std::cerr << "lupdate warning: TS files from command line " - "prevent recursing into " << qPrintable(proFile) << ".\n"; + std::cerr << qPrintable(LU::tr("lupdate warning: TS files from command line " + "prevent recursing into %1.\n").arg(proFile)); continue; } } @@ -395,8 +397,8 @@ static void processProjects( noTrans: if (!parentTor) { if (topLevel) - std::cerr << "lupdate warning: no TS files specified. Only diagnostics " - "will be produced for '" << qPrintable(proFile) << "'.\n"; + std::cerr << qPrintable(LU::tr("lupdate warning: no TS files specified. Only diagnostics " + "will be produced for '%1'.\n").arg(proFile)); Translator tor; processProject(nestComplain, pfi, visitor, options, codecForSource, targetLanguage, sourceLanguage, &tor, fail); @@ -410,6 +412,16 @@ static void processProjects( int main(int argc, char **argv) { QCoreApplication app(argc, argv); + QTranslator translator; + QTranslator qtTranslator; + QString sysLocale = QLocale::system().name(); + QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath); + if (translator.load(QLatin1String("linguist_") + sysLocale, resourceDir) + && qtTranslator.load(QLatin1String("qt_") + sysLocale, resourceDir)) { + app.installTranslator(&translator); + app.installTranslator(&qtTranslator); + } + m_defaultExtensions = QLatin1String("java,jui,ui,c,c++,cc,cpp,cxx,ch,h,h++,hh,hpp,hxx,js,qs,qml"); QStringList args = app.arguments(); @@ -613,7 +625,7 @@ int main(int argc, char **argv) proFiles << file; } else if (fi.isDir()) { if (options & Verbose) - printOut(QObject::tr("Scanning directory '%1'...\n").arg(file)); + printOut(LU::tr("Scanning directory '%1'...\n").arg(file)); QDir dir = QDir(fi.filePath()); projectRoots.insert(dir.absolutePath() + QLatin1Char('/')); if (extensionsNameFilters.isEmpty()) { diff --git a/tools/linguist/lupdate/merge.cpp b/tools/linguist/lupdate/merge.cpp index fffdf9b..87c150c 100644 --- a/tools/linguist/lupdate/merge.cpp +++ b/tools/linguist/lupdate/merge.cpp @@ -44,15 +44,19 @@ #include "simtexth.h" #include "translator.h" +#include <QtCore/QCoreApplication> #include <QtCore/QDebug> #include <QtCore/QMap> #include <QtCore/QStringList> #include <QtCore/QTextCodec> #include <QtCore/QVector> - QT_BEGIN_NAMESPACE +class LU { + Q_DECLARE_TR_FUNCTIONS(LUpdate) +}; + static bool isDigitFriendly(QChar c) { return c.isPunct() || c.isSpace(); @@ -485,24 +489,24 @@ Translator merge(const Translator &tor, const Translator &virginTor, if (options & Verbose) { int totalFound = neww + known; - err += QObject::tr(" Found %n source text(s) (%1 new and %2 already existing)\n", 0, totalFound).arg(neww).arg(known); + err += LU::tr(" Found %n source text(s) (%1 new and %2 already existing)\n", 0, totalFound).arg(neww).arg(known); if (obsoleted) { if (options & NoObsolete) { - err += QObject::tr(" Removed %n obsolete entries\n", 0, obsoleted); + err += LU::tr(" Removed %n obsolete entries\n", 0, obsoleted); } else { - err += QObject::tr(" Kept %n obsolete entries\n", 0, obsoleted); + err += LU::tr(" Kept %n obsolete entries\n", 0, obsoleted); } } if (sameNumberHeuristicCount) - err += QObject::tr(" Number heuristic provided %n translation(s)\n", + err += LU::tr(" Number heuristic provided %n translation(s)\n", 0, sameNumberHeuristicCount); if (sameTextHeuristicCount) - err += QObject::tr(" Same-text heuristic provided %n translation(s)\n", + err += LU::tr(" Same-text heuristic provided %n translation(s)\n", 0, sameTextHeuristicCount); if (similarTextHeuristicCount) - err += QObject::tr(" Similar-text heuristic provided %n translation(s)\n", + err += LU::tr(" Similar-text heuristic provided %n translation(s)\n", 0, similarTextHeuristicCount); } return outTor; diff --git a/tools/linguist/lupdate/qdeclarative.cpp b/tools/linguist/lupdate/qdeclarative.cpp index 2377416..01b9a1d 100644 --- a/tools/linguist/lupdate/qdeclarative.cpp +++ b/tools/linguist/lupdate/qdeclarative.cpp @@ -65,8 +65,26 @@ QT_BEGIN_NAMESPACE +class LU { + Q_DECLARE_TR_FUNCTIONS(LUpdate) +}; + using namespace QDeclarativeJS; +class Comment +{ +public: + Comment() : lastLine(-1) {} + QString extracomment; + QString msgid; + TranslatorMessage::ExtraData extra; + QString sourcetext; + int lastLine; + + bool isValid() const + { return !extracomment.isEmpty() || !msgid.isEmpty() || !sourcetext.isEmpty() || !extra.isEmpty(); } +}; + class FindTrCalls: protected AST::Visitor { public: @@ -78,6 +96,8 @@ public: accept(node); } + QList<Comment> comments; + protected: using AST::Visitor::visit; using AST::Visitor::endVisit; @@ -114,10 +134,23 @@ protected: plural = true; } + QString id; + QString extracomment; + TranslatorMessage::ExtraData extra; + Comment scomment = findComment(node->firstSourceLocation().startLine); + if (scomment.isValid()) { + extracomment = scomment.extracomment; + extra = scomment.extra; + id = scomment.msgid; + } + TranslatorMessage msg(m_component, source, comment, QString(), m_fileName, node->firstSourceLocation().startLine, QStringList(), TranslatorMessage::Unfinished, plural); + msg.setExtraComment(extracomment.simplified()); + msg.setId(id); + msg.setExtras(extra); m_translator->extend(msg); } } else if (idExpr->name->asString() == QLatin1String("qsTranslate") || @@ -140,6 +173,17 @@ protected: } if (!literal && m_bSource.isEmpty()) return; + + QString id; + QString extracomment; + TranslatorMessage::ExtraData extra; + Comment scomment = findComment(node->firstSourceLocation().startLine); + if (scomment.isValid()) { + extracomment = scomment.extracomment; + extra = scomment.extra; + id = scomment.msgid; + } + source = literal ? literal->value->asString() : m_bSource; AST::ArgumentList *commentNode = sourceNode->next; if (commentNode && AST::cast<AST::StringLiteral *>(commentNode->expression)) { @@ -155,15 +199,48 @@ protected: comment, QString(), m_fileName, node->firstSourceLocation().startLine, QStringList(), TranslatorMessage::Unfinished, plural); + msg.setExtraComment(extracomment.simplified()); + msg.setId(id); + msg.setExtras(extra); m_translator->extend(msg); } + } else if (idExpr->name->asString() == QLatin1String("qsTrId") || + idExpr->name->asString() == QLatin1String("QT_TRID_NOOP")) { + if (!node->arguments) + return; + AST::StringLiteral *literal = AST::cast<AST::StringLiteral *>(node->arguments->expression); + if (literal) { + + QString extracomment; + QString sourcetext; + TranslatorMessage::ExtraData extra; + Comment comment = findComment(node->firstSourceLocation().startLine); + if (comment.isValid()) { + extracomment = comment.extracomment; + sourcetext = comment.sourcetext; + extra = comment.extra; + } + + const QString id = literal->value->asString(); + bool plural = node->arguments->next; + + TranslatorMessage msg(QString(), QString(), + QString(), QString(), m_fileName, + node->firstSourceLocation().startLine, QStringList(), + TranslatorMessage::Unfinished, plural); + msg.setExtraComment(extracomment.simplified()); + msg.setId(id); + msg.setExtras(extra); + m_translator->extend(msg); + } } } } private: - bool createString(AST::BinaryExpression *b) { + bool createString(AST::BinaryExpression *b) + { if (!b || b->op != 0) return false; AST::BinaryExpression *l = AST::cast<AST::BinaryExpression *>(b->left); @@ -187,6 +264,23 @@ private: return true; } + Comment findComment(int loc) + { + if (comments.isEmpty()) + return Comment(); + + int i = 0; + int commentLoc = comments.at(i).lastLine; + while (commentLoc <= loc) { + if (commentLoc == loc) + return comments.at(i); + if (i == comments.count()-1) + break; + commentLoc = comments.at(++i).lastLine; + } + return Comment(); + } + Translator *m_translator; QString m_fileName; QString m_component; @@ -236,13 +330,60 @@ QString createErrorString(const QString &filename, const QString &code, Parser & return errorString; } +bool processComment(const QChar *chars, int length, Comment &comment) +{ + // Try to match the logic of the QtScript parser. + if (!length) + return comment.isValid(); + if (*chars == QLatin1Char(':') && chars[1].isSpace()) { + comment.extracomment += QString(chars+1, length-1); + } else if (*chars == QLatin1Char('=') && chars[1].isSpace()) { + comment.msgid = QString(chars+2, length-2).simplified(); + } else if (*chars == QLatin1Char('~') && chars[1].isSpace()) { + QString text = QString(chars+2, length-2).trimmed(); + int k = text.indexOf(QLatin1Char(' ')); + if (k > -1) + comment.extra.insert(text.left(k), text.mid(k + 1).trimmed()); + } else if (*chars == QLatin1Char('%') && chars[1].isSpace()) { + comment.sourcetext.reserve(comment.sourcetext.length() + length-2); + ushort *ptr = (ushort *)comment.sourcetext.data() + comment.sourcetext.length(); + int p = 2, c; + forever { + if (p >= length) + break; + c = chars[p++].unicode(); + if (isspace(c)) + continue; + if (c != '"') + break; + forever { + if (p >= length) + break; + c = chars[p++].unicode(); + if (c == '"') + break; + if (c == '\\') { + if (p >= length) + break; + c = chars[p++].unicode(); + if (c == '\n') + break; + *ptr++ = '\\'; + } + *ptr++ = c; + } + } + comment.sourcetext.resize(ptr - (ushort *)comment.sourcetext.data()); + } + return comment.isValid(); +} + bool loadQml(Translator &translator, const QString &filename, ConversionData &cd) { cd.m_sourceFileName = filename; QFile file(filename); if (!file.open(QIODevice::ReadOnly)) { - cd.appendError(QString::fromLatin1("Cannot open %1: %2") - .arg(filename, file.errorString())); + cd.appendError(LU::tr("Cannot open %1: %2").arg(filename, file.errorString())); return false; } @@ -260,6 +401,25 @@ bool loadQml(Translator &translator, const QString &filename, ConversionData &cd if (parser.parse()) { FindTrCalls trCalls; + + // build up a list of comments that contain translation information. + for (int i = 0; i < driver.comments().size(); ++i) { + AST::SourceLocation loc = driver.comments().at(i); + QString commentStr = code.mid(loc.offset, loc.length); + + if (trCalls.comments.isEmpty() || trCalls.comments.last().lastLine != int(loc.startLine)) { + Comment comment; + comment.lastLine = loc.startLine+1; + if (processComment(commentStr.constData(), commentStr.length(), comment)) + trCalls.comments.append(comment); + } else { + Comment &lastComment = trCalls.comments.last(); + lastComment.lastLine += 1; + processComment(commentStr.constData(), commentStr.length(), lastComment); + } + } + + //find all tr calls in the code trCalls(&translator, filename, parser.ast()); } else { QString error = createErrorString(filename, code, parser); diff --git a/tools/linguist/lupdate/qscript.cpp b/tools/linguist/lupdate/qscript.cpp index 188ac36..5323022 100644 --- a/tools/linguist/lupdate/qscript.cpp +++ b/tools/linguist/lupdate/qscript.cpp @@ -47,6 +47,7 @@ #include <translator.h> +#include <QtCore/QCoreApplication> #include <QtCore/qdebug.h> #include <QtCore/qnumeric.h> #include <QtCore/qstring.h> @@ -62,6 +63,10 @@ QT_BEGIN_NAMESPACE +class LU { + Q_DECLARE_TR_FUNCTIONS(LUpdate) +}; + class QScriptGrammar { public: @@ -770,13 +775,16 @@ const int QScriptGrammar::action_check [] = { static void recordMessage( Translator *tor, const QString &context, const QString &text, const QString &comment, - const QString &extracomment, bool plural, const QString &fileName, int lineNo) + const QString &extracomment, const QString &msgid, const TranslatorMessage::ExtraData &extra, + bool plural, const QString &fileName, int lineNo) { TranslatorMessage msg( context, text, comment, QString(), fileName, lineNo, QStringList(), TranslatorMessage::Unfinished, plural); msg.setExtraComment(extracomment.simplified()); + msg.setId(msgid); + msg.setExtras(extra); tor->extend(msg); } @@ -784,15 +792,23 @@ static void recordMessage( namespace QScript { +class CommentProcessor +{ +public: + virtual ~CommentProcessor() {} + virtual void processComment(const QChar *chars, int length) = 0; +}; + class Lexer { public: - Lexer(); + Lexer(CommentProcessor *); ~Lexer(); - void setCode(const QString &c, int lineno); + void setCode(const QString &c, const QString &fileName, int lineno); int lex(); + QString fileName() const { return yyfilename; } int currentLineNo() const { return yylineno; } int currentColumnNo() const { return yycolumn; } @@ -872,6 +888,7 @@ public: { err = NoError; } private: + QString yyfilename; int yylineno; bool done; char *buffer8; @@ -925,6 +942,8 @@ private: void syncProhibitAutomaticSemicolon(); + void processComment(const QChar *, int); + const QChar *code; uint length; int yycolumn; @@ -951,6 +970,8 @@ private: ParenthesesState parenthesesState; int parenthesesCount; bool prohibitAutomaticSemicolon; + + CommentProcessor *commentProcessor; }; } // namespace QScript @@ -1027,7 +1048,7 @@ double integerFromString(const char *buf, int size, int radix) } // namespace QScript -QScript::Lexer::Lexer() +QScript::Lexer::Lexer(QScript::CommentProcessor *proc) : yylineno(0), size8(128), size16(128), restrKeyword(false), @@ -1038,7 +1059,8 @@ QScript::Lexer::Lexer() err(NoError), check_reserved(true), parenthesesState(IgnoreParentheses), - prohibitAutomaticSemicolon(false) + prohibitAutomaticSemicolon(false), + commentProcessor(proc) { // allocate space for read buffers buffer8 = new char[size8]; @@ -1053,9 +1075,10 @@ QScript::Lexer::~Lexer() delete [] buffer16; } -void QScript::Lexer::setCode(const QString &c, int lineno) +void QScript::Lexer::setCode(const QString &c, const QString &fileName, int lineno) { errmsg = QString(); + yyfilename = fileName; yylineno = lineno; yycolumn = 1; restrKeyword = false; @@ -1404,10 +1427,12 @@ int QScript::Lexer::lex() } else if (current == '/' && next1 == '/') { recordStartPos(); shift(1); + Q_ASSERT(pos16 == 0); state = InSingleLineComment; } else if (current == '/' && next1 == '*') { recordStartPos(); shift(1); + Q_ASSERT(pos16 == 0); state = InMultiLineComment; } else if (current == 0) { syncProhibitAutomaticSemicolon(); @@ -1466,7 +1491,7 @@ int QScript::Lexer::lex() else { setDone(Bad); err = IllegalCharacter; - errmsg = QLatin1String("Illegal character"); + errmsg = LU::tr("Illegal character"); } } break; @@ -1477,7 +1502,7 @@ int QScript::Lexer::lex() } else if (current == 0 || isLineTerminator()) { setDone(Bad); err = UnclosedStringLiteral; - errmsg = QLatin1String("Unclosed string at end of line"); + errmsg = LU::tr("Unclosed string at end of line"); } else if (current == '\\') { state = InEscapeSequence; } else { @@ -1503,7 +1528,7 @@ int QScript::Lexer::lex() } else { setDone(Bad); err = IllegalEscapeSequence; - errmsg = QLatin1String("Illegal escape squence"); + errmsg = LU::tr("Illegal escape squence"); } } else if (current == 'x') state = InHexEscape; @@ -1542,14 +1567,17 @@ int QScript::Lexer::lex() } else { setDone(Bad); err = IllegalUnicodeEscapeSequence; - errmsg = QLatin1String("Illegal unicode escape sequence"); + errmsg = LU::tr("Illegal unicode escape sequence"); } break; case InSingleLineComment: if (isLineTerminator()) { + record16(current); // include newline + processComment(buffer16, pos16); shiftWindowsLineBreak(); yylineno++; yycolumn = 0; + pos16 = 0; terminator = true; bol = true; if (restrKeyword) { @@ -1559,19 +1587,25 @@ int QScript::Lexer::lex() state = Start; } else if (current == 0) { setDone(Eof); + } else { + record16(current); } break; case InMultiLineComment: if (current == 0) { setDone(Bad); err = UnclosedComment; - errmsg = QLatin1String("Unclosed comment at end of file"); + errmsg = LU::tr("Unclosed comment at end of file"); } else if (isLineTerminator()) { shiftWindowsLineBreak(); yylineno++; } else if (current == '*' && next1 == '/') { + processComment(buffer16, pos16); + pos16 = 0; state = Start; shift(1); + } else { + record16(current); } break; case InIdentifier: @@ -1649,7 +1683,7 @@ int QScript::Lexer::lex() } else { setDone(Bad); err = IllegalExponentIndicator; - errmsg = QLatin1String("Illegal syntax for exponential number"); + errmsg = LU::tr("Illegal syntax for exponential number"); } break; case InExponent: @@ -1675,7 +1709,7 @@ int QScript::Lexer::lex() && isIdentLetter(current)) { state = Bad; err = IllegalIdentifier; - errmsg = QLatin1String("Identifier cannot start with numeric literal"); + errmsg = LU::tr("Identifier cannot start with numeric literal"); } // terminate string @@ -1994,7 +2028,7 @@ bool QScript::Lexer::scanRegExp(RegExpBodyPrefix prefix) while (1) { if (isLineTerminator() || current == 0) { - errmsg = QLatin1String("Unterminated regular expression literal"); + errmsg = LU::tr("Unterminated regular expression literal"); return false; } else if (current != '/' || lastWasEscape == true) @@ -2033,10 +2067,15 @@ void QScript::Lexer::syncProhibitAutomaticSemicolon() } } +void QScript::Lexer::processComment(const QChar *chars, int length) +{ + commentProcessor->processComment(chars, length); +} + class Translator; -class QScriptParser: protected QScriptGrammar +class QScriptParser: protected QScriptGrammar, public QScript::CommentProcessor { public: QVariant val; @@ -2052,10 +2091,12 @@ public: QScriptParser(); ~QScriptParser(); - bool parse(QScript::Lexer *lexer, - const QString &fileName, - Translator *translator); + void setLexer(QScript::Lexer *); + + bool parse(Translator *translator); + QString fileName() const + { return lexer->fileName(); } inline QString errorMessage() const { return error_message; } inline int errorLineNumber() const @@ -2072,6 +2113,10 @@ protected: inline Location &loc(int index) { return location_stack [tos + index - 2]; } + std::ostream &yyMsg(int line = 0); + + virtual void processComment(const QChar *, int); + protected: int tos; int stack_size; @@ -2081,6 +2126,13 @@ protected: QString error_message; int error_lineno; int error_column; + +private: + QScript::Lexer *lexer; + QString extracomment; + QString msgid; + QString sourcetext; + TranslatorMessage::ExtraData extra; }; inline void QScriptParser::reallocateStack() @@ -2107,7 +2159,8 @@ QScriptParser::QScriptParser(): stack_size(0), sym_stack(0), state_stack(0), - location_stack(0) + location_stack(0), + lexer(0) { } @@ -2129,10 +2182,14 @@ static inline QScriptParser::Location location(QScript::Lexer *lexer) return loc; } -bool QScriptParser::parse(QScript::Lexer *lexer, - const QString &fileName, - Translator *translator) +void QScriptParser::setLexer(QScript::Lexer *lex) { + lexer = lex; +} + +bool QScriptParser::parse(Translator *translator) +{ + Q_ASSERT(lexer != 0); const int INITIAL_STATE = 0; int yytoken = -1; @@ -2214,44 +2271,70 @@ case 8: { case 66: { QString name = sym(1).toString(); if ((name == QLatin1String("qsTranslate")) || (name == QLatin1String("QT_TRANSLATE_NOOP"))) { + if (!sourcetext.isEmpty()) + yyMsg(identLineNo) << qPrintable(LU::tr("//% cannot be used with %1(). Ignoring\n").arg(name)); QVariantList args = sym(2).toList(); if (args.size() < 2) { - std::cerr << qPrintable(fileName) << ':' << identLineNo << ": " - << qPrintable(name) << "() requires at least two arguments.\n"; + yyMsg(identLineNo) << qPrintable(LU::tr("%1() requires at least two arguments.\n").arg(name)); } else { if ((args.at(0).type() != QVariant::String) || (args.at(1).type() != QVariant::String)) { - std::cerr << qPrintable(fileName) << ':' << identLineNo << ": " - << qPrintable(name) << "(): both arguments must be literal strings.\n"; + yyMsg(identLineNo) << qPrintable(LU::tr("%1(): both arguments must be literal strings.\n").arg(name)); } else { QString context = args.at(0).toString(); QString text = args.at(1).toString(); QString comment = args.value(2).toString(); - QString extracomment; bool plural = (args.size() > 4); recordMessage(translator, context, text, comment, extracomment, - plural, fileName, identLineNo); + msgid, extra, plural, fileName(), identLineNo); } } + sourcetext.clear(); + extracomment.clear(); + msgid.clear(); + extra.clear(); } else if ((name == QLatin1String("qsTr")) || (name == QLatin1String("QT_TR_NOOP"))) { + if (!sourcetext.isEmpty()) + yyMsg(identLineNo) << qPrintable(LU::tr("//% cannot be used with %1(). Ignoring\n").arg(name)); QVariantList args = sym(2).toList(); if (args.size() < 1) { - std::cerr << qPrintable(fileName) << ':' << identLineNo << ": " - << qPrintable(name) << "() requires at least one argument.\n"; + yyMsg(identLineNo) << qPrintable(LU::tr("%1() requires at least one argument.\n").arg(name)); } else { if (args.at(0).type() != QVariant::String) { - std::cerr << qPrintable(fileName) << ':' << identLineNo << ": " - << qPrintable(name) << "(): text to translate must be a literal string.\n"; + yyMsg(identLineNo) << qPrintable(LU::tr("%1(): text to translate must be a literal string.\n").arg(name)); } else { - QString context = QFileInfo(fileName).baseName(); + QString context = QFileInfo(fileName()).baseName(); QString text = args.at(0).toString(); QString comment = args.value(1).toString(); - QString extracomment; bool plural = (args.size() > 2); recordMessage(translator, context, text, comment, extracomment, - plural, fileName, identLineNo); + msgid, extra, plural, fileName(), identLineNo); } } + sourcetext.clear(); + extracomment.clear(); + msgid.clear(); + extra.clear(); + } else if ((name == QLatin1String("qsTrId")) || (name == QLatin1String("QT_TRID_NOOP"))) { + if (!msgid.isEmpty()) + yyMsg(identLineNo) << qPrintable(LU::tr("//= cannot be used with %1(). Ignoring\n").arg(name)); + QVariantList args = sym(2).toList(); + if (args.size() < 1) { + yyMsg(identLineNo) << qPrintable(LU::tr("%1() requires at least one argument.\n").arg(name)); + } else { + if (args.at(0).type() != QVariant::String) { + yyMsg(identLineNo) << qPrintable(LU::tr("%1(): identifier must be a literal string.\n").arg(name)); + } else { + msgid = args.at(0).toString(); + bool plural = (args.size() > 1); + recordMessage(translator, QString(), sourcetext, QString(), extracomment, + msgid, extra, plural, fileName(), identLineNo); + } + } + sourcetext.clear(); + extracomment.clear(); + msgid.clear(); + extra.clear(); } } break; @@ -2278,6 +2361,44 @@ case 94: { sym(1) = QVariant(); } break; + case 171: + + case 172: + + case 173: + + case 174: + + case 175: + + case 176: + + case 177: + + case 178: + + case 179: + + case 180: + + case 181: + + case 182: + + case 183: + + case 184: + + case 185: + if (!sourcetext.isEmpty() || !extracomment.isEmpty() || !msgid.isEmpty() || !extra.isEmpty()) { + yyMsg() << qPrintable(LU::tr("Discarding unconsumed meta data\n")); + sourcetext.clear(); + extracomment.clear(); + msgid.clear(); + extra.clear(); + } + break; + } // switch state_stack [tos] = nt_action (act, lhs [r] - TERMINAL_COUNT); @@ -2332,7 +2453,9 @@ case 94: { for (int s = 0; s < shifts; ++s) { if (first) - error_message += QLatin1String ("Expected "); + //: Beginning of the string that contains + //: comma-separated list of expected tokens + error_message += LU::tr("Expected "); else error_message += QLatin1String (", "); @@ -2356,13 +2479,69 @@ case 94: { return false; } +std::ostream &QScriptParser::yyMsg(int line) +{ + return std::cerr << qPrintable(fileName()) << ':' << (line ? line : lexer->startLineNo()) << ": "; +} + +void QScriptParser::processComment(const QChar *chars, int length) +{ + if (!length) + return; + // Try to match the logic of the C++ parser. + if (*chars == QLatin1Char(':') && chars[1].isSpace()) { + extracomment += QString(chars+2, length-2); + } else if (*chars == QLatin1Char('=') && chars[1].isSpace()) { + msgid = QString(chars+2, length-2).simplified(); + } else if (*chars == QLatin1Char('~') && chars[1].isSpace()) { + QString text = QString(chars+2, length-2).trimmed(); + int k = text.indexOf(QLatin1Char(' ')); + if (k > -1) + extra.insert(text.left(k), text.mid(k + 1).trimmed()); + } else if (*chars == QLatin1Char('%') && chars[1].isSpace()) { + sourcetext.reserve(sourcetext.length() + length-2); + ushort *ptr = (ushort *)sourcetext.data() + sourcetext.length(); + int p = 2, c; + forever { + if (p >= length) + break; + c = chars[p++].unicode(); + if (isspace(c)) + continue; + if (c != '"') { + yyMsg() << qPrintable(LU::tr("Unexpected character in meta string\n")); + break; + } + forever { + if (p >= length) { + whoops: + yyMsg() << qPrintable(LU::tr("Unterminated meta string\n")); + break; + } + c = chars[p++].unicode(); + if (c == '"') + break; + if (c == '\\') { + if (p >= length) + goto whoops; + c = chars[p++].unicode(); + if (c == '\n') + goto whoops; + *ptr++ = '\\'; + } + *ptr++ = c; + } + } + sourcetext.resize(ptr - (ushort *)sourcetext.data()); + } +} + bool loadQScript(Translator &translator, const QString &filename, ConversionData &cd) { QFile file(filename); if (!file.open(QIODevice::ReadOnly)) { - cd.appendError(QString::fromLatin1("Cannot open %1: %2") - .arg(filename, file.errorString())); + cd.appendError(LU::tr("Cannot open %1: %2").arg(filename, file.errorString())); return false; } QTextStream ts(&file); @@ -2375,10 +2554,11 @@ bool loadQScript(Translator &translator, const QString &filename, ConversionData ts.setAutoDetectUnicode(true); QString code = ts.readAll(); - QScript::Lexer lexer; - lexer.setCode(code, /*lineNumber=*/1); QScriptParser parser; - if (!parser.parse(&lexer, filename, &translator)) { + QScript::Lexer lexer(&parser); + lexer.setCode(code, filename, /*lineNumber=*/1); + parser.setLexer(&lexer); + if (!parser.parse(&translator)) { std::cerr << qPrintable(filename) << ':' << parser.errorLineNumber() << ": " << qPrintable(parser.errorMessage()) << std::endl; return false; diff --git a/tools/linguist/lupdate/qscript.g b/tools/linguist/lupdate/qscript.g index 857c58a..3655f2e 100644 --- a/tools/linguist/lupdate/qscript.g +++ b/tools/linguist/lupdate/qscript.g @@ -84,6 +84,7 @@ /. #include <translator.h> +#include <QtCore/QCoreApplication> #include <QtCore/qdebug.h> #include <QtCore/qnumeric.h> #include <QtCore/qstring.h> @@ -99,15 +100,22 @@ QT_BEGIN_NAMESPACE +class LU { + Q_DECLARE_TR_FUNCTIONS(LUpdate) +}; + static void recordMessage( Translator *tor, const QString &context, const QString &text, const QString &comment, - const QString &extracomment, bool plural, const QString &fileName, int lineNo) + const QString &extracomment, const QString &msgid, const TranslatorMessage::ExtraData &extra, + bool plural, const QString &fileName, int lineNo) { TranslatorMessage msg( context, text, comment, QString(), fileName, lineNo, QStringList(), TranslatorMessage::Unfinished, plural); msg.setExtraComment(extracomment.simplified()); + msg.setId(msgid); + msg.setExtras(extra); tor->extend(msg); } @@ -115,15 +123,23 @@ static void recordMessage( namespace QScript { +class CommentProcessor +{ +public: + virtual ~CommentProcessor() {} + virtual void processComment(const QChar *chars, int length) = 0; +}; + class Lexer { public: - Lexer(); + Lexer(CommentProcessor *); ~Lexer(); - void setCode(const QString &c, int lineno); + void setCode(const QString &c, const QString &fileName, int lineno); int lex(); + QString fileName() const { return yyfilename; } int currentLineNo() const { return yylineno; } int currentColumnNo() const { return yycolumn; } @@ -203,6 +219,7 @@ public: { err = NoError; } private: + QString yyfilename; int yylineno; bool done; char *buffer8; @@ -256,6 +273,8 @@ private: void syncProhibitAutomaticSemicolon(); + void processComment(const QChar *, int); + const QChar *code; uint length; int yycolumn; @@ -282,6 +301,8 @@ private: ParenthesesState parenthesesState; int parenthesesCount; bool prohibitAutomaticSemicolon; + + CommentProcessor *commentProcessor; }; } // namespace QScript @@ -358,7 +379,7 @@ double integerFromString(const char *buf, int size, int radix) } // namespace QScript -QScript::Lexer::Lexer() +QScript::Lexer::Lexer(QScript::CommentProcessor *proc) : yylineno(0), size8(128), size16(128), restrKeyword(false), @@ -369,7 +390,8 @@ QScript::Lexer::Lexer() err(NoError), check_reserved(true), parenthesesState(IgnoreParentheses), - prohibitAutomaticSemicolon(false) + prohibitAutomaticSemicolon(false), + commentProcessor(proc) { // allocate space for read buffers buffer8 = new char[size8]; @@ -384,9 +406,10 @@ QScript::Lexer::~Lexer() delete [] buffer16; } -void QScript::Lexer::setCode(const QString &c, int lineno) +void QScript::Lexer::setCode(const QString &c, const QString &fileName, int lineno) { errmsg = QString(); + yyfilename = fileName; yylineno = lineno; yycolumn = 1; restrKeyword = false; @@ -735,10 +758,12 @@ int QScript::Lexer::lex() } else if (current == '/' && next1 == '/') { recordStartPos(); shift(1); + Q_ASSERT(pos16 == 0); state = InSingleLineComment; } else if (current == '/' && next1 == '*') { recordStartPos(); shift(1); + Q_ASSERT(pos16 == 0); state = InMultiLineComment; } else if (current == 0) { syncProhibitAutomaticSemicolon(); @@ -797,7 +822,7 @@ int QScript::Lexer::lex() else { setDone(Bad); err = IllegalCharacter; - errmsg = QLatin1String("Illegal character"); + errmsg = LU::tr("Illegal character"); } } break; @@ -808,7 +833,7 @@ int QScript::Lexer::lex() } else if (current == 0 || isLineTerminator()) { setDone(Bad); err = UnclosedStringLiteral; - errmsg = QLatin1String("Unclosed string at end of line"); + errmsg = LU::tr("Unclosed string at end of line"); } else if (current == '\\') { state = InEscapeSequence; } else { @@ -834,7 +859,7 @@ int QScript::Lexer::lex() } else { setDone(Bad); err = IllegalEscapeSequence; - errmsg = QLatin1String("Illegal escape squence"); + errmsg = LU::tr("Illegal escape squence"); } } else if (current == 'x') state = InHexEscape; @@ -873,14 +898,17 @@ int QScript::Lexer::lex() } else { setDone(Bad); err = IllegalUnicodeEscapeSequence; - errmsg = QLatin1String("Illegal unicode escape sequence"); + errmsg = LU::tr("Illegal unicode escape sequence"); } break; case InSingleLineComment: if (isLineTerminator()) { + record16(current); // include newline + processComment(buffer16, pos16); shiftWindowsLineBreak(); yylineno++; yycolumn = 0; + pos16 = 0; terminator = true; bol = true; if (restrKeyword) { @@ -890,19 +918,25 @@ int QScript::Lexer::lex() state = Start; } else if (current == 0) { setDone(Eof); + } else { + record16(current); } break; case InMultiLineComment: if (current == 0) { setDone(Bad); err = UnclosedComment; - errmsg = QLatin1String("Unclosed comment at end of file"); + errmsg = LU::tr("Unclosed comment at end of file"); } else if (isLineTerminator()) { shiftWindowsLineBreak(); yylineno++; } else if (current == '*' && next1 == '/') { + processComment(buffer16, pos16); + pos16 = 0; state = Start; shift(1); + } else { + record16(current); } break; case InIdentifier: @@ -980,7 +1014,7 @@ int QScript::Lexer::lex() } else { setDone(Bad); err = IllegalExponentIndicator; - errmsg = QLatin1String("Illegal syntax for exponential number"); + errmsg = LU::tr("Illegal syntax for exponential number"); } break; case InExponent: @@ -1006,7 +1040,7 @@ int QScript::Lexer::lex() && isIdentLetter(current)) { state = Bad; err = IllegalIdentifier; - errmsg = QLatin1String("Identifier cannot start with numeric literal"); + errmsg = LU::tr("Identifier cannot start with numeric literal"); } // terminate string @@ -1325,7 +1359,7 @@ bool QScript::Lexer::scanRegExp(RegExpBodyPrefix prefix) while (1) { if (isLineTerminator() || current == 0) { - errmsg = QLatin1String("Unterminated regular expression literal"); + errmsg = LU::tr("Unterminated regular expression literal"); return false; } else if (current != '/' || lastWasEscape == true) @@ -1364,10 +1398,15 @@ void QScript::Lexer::syncProhibitAutomaticSemicolon() } } +void QScript::Lexer::processComment(const QChar *chars, int length) +{ + commentProcessor->processComment(chars, length); +} + class Translator; -class QScriptParser: protected $table +class QScriptParser: protected $table, public QScript::CommentProcessor { public: QVariant val; @@ -1383,10 +1422,12 @@ public: QScriptParser(); ~QScriptParser(); - bool parse(QScript::Lexer *lexer, - const QString &fileName, - Translator *translator); + void setLexer(QScript::Lexer *); + bool parse(Translator *translator); + + QString fileName() const + { return lexer->fileName(); } inline QString errorMessage() const { return error_message; } inline int errorLineNumber() const @@ -1403,6 +1444,10 @@ protected: inline Location &loc(int index) { return location_stack [tos + index - 2]; } + std::ostream &yyMsg(int line = 0); + + virtual void processComment(const QChar *, int); + protected: int tos; int stack_size; @@ -1412,6 +1457,13 @@ protected: QString error_message; int error_lineno; int error_column; + +private: + QScript::Lexer *lexer; + QString extracomment; + QString msgid; + QString sourcetext; + TranslatorMessage::ExtraData extra; }; inline void QScriptParser::reallocateStack() @@ -1438,7 +1490,8 @@ QScriptParser::QScriptParser(): stack_size(0), sym_stack(0), state_stack(0), - location_stack(0) + location_stack(0), + lexer(0) { } @@ -1460,10 +1513,14 @@ static inline QScriptParser::Location location(QScript::Lexer *lexer) return loc; } -bool QScriptParser::parse(QScript::Lexer *lexer, - const QString &fileName, - Translator *translator) +void QScriptParser::setLexer(QScript::Lexer *lex) { + lexer = lex; +} + +bool QScriptParser::parse(Translator *translator) +{ + Q_ASSERT(lexer != 0); const int INITIAL_STATE = 0; int yytoken = -1; @@ -1630,44 +1687,70 @@ CallExpression: MemberExpression Arguments ; case $rule_number: { QString name = sym(1).toString(); if ((name == QLatin1String("qsTranslate")) || (name == QLatin1String("QT_TRANSLATE_NOOP"))) { + if (!sourcetext.isEmpty()) + yyMsg(identLineNo) << qPrintable(LU::tr("//% cannot be used with %1(). Ignoring\n").arg(name)); QVariantList args = sym(2).toList(); if (args.size() < 2) { - std::cerr << qPrintable(fileName) << ':' << identLineNo << ": " - << qPrintable(name) << "() requires at least two arguments.\n"; + yyMsg(identLineNo) << qPrintable(LU::tr("%1() requires at least two arguments.\n").arg(name)); } else { if ((args.at(0).type() != QVariant::String) || (args.at(1).type() != QVariant::String)) { - std::cerr << qPrintable(fileName) << ':' << identLineNo << ": " - << qPrintable(name) << "(): both arguments must be literal strings.\n"; + yyMsg(identLineNo) << qPrintable(LU::tr("%1(): both arguments must be literal strings.\n").arg(name)); } else { QString context = args.at(0).toString(); QString text = args.at(1).toString(); QString comment = args.value(2).toString(); - QString extracomment; bool plural = (args.size() > 4); recordMessage(translator, context, text, comment, extracomment, - plural, fileName, identLineNo); + msgid, extra, plural, fileName(), identLineNo); } } + sourcetext.clear(); + extracomment.clear(); + msgid.clear(); + extra.clear(); } else if ((name == QLatin1String("qsTr")) || (name == QLatin1String("QT_TR_NOOP"))) { + if (!sourcetext.isEmpty()) + yyMsg(identLineNo) << qPrintable(LU::tr("//% cannot be used with %1(). Ignoring\n").arg(name)); QVariantList args = sym(2).toList(); if (args.size() < 1) { - std::cerr << qPrintable(fileName) << ':' << identLineNo << ": " - << qPrintable(name) << "() requires at least one argument.\n"; + yyMsg(identLineNo) << qPrintable(LU::tr("%1() requires at least one argument.\n").arg(name)); } else { if (args.at(0).type() != QVariant::String) { - std::cerr << qPrintable(fileName) << ':' << identLineNo << ": " - << qPrintable(name) << "(): text to translate must be a literal string.\n"; + yyMsg(identLineNo) << qPrintable(LU::tr("%1(): text to translate must be a literal string.\n").arg(name)); } else { - QString context = QFileInfo(fileName).baseName(); + QString context = QFileInfo(fileName()).baseName(); QString text = args.at(0).toString(); QString comment = args.value(1).toString(); - QString extracomment; bool plural = (args.size() > 2); recordMessage(translator, context, text, comment, extracomment, - plural, fileName, identLineNo); + msgid, extra, plural, fileName(), identLineNo); } } + sourcetext.clear(); + extracomment.clear(); + msgid.clear(); + extra.clear(); + } else if ((name == QLatin1String("qsTrId")) || (name == QLatin1String("QT_TRID_NOOP"))) { + if (!msgid.isEmpty()) + yyMsg(identLineNo) << qPrintable(LU::tr("//= cannot be used with %1(). Ignoring\n").arg(name)); + QVariantList args = sym(2).toList(); + if (args.size() < 1) { + yyMsg(identLineNo) << qPrintable(LU::tr("%1() requires at least one argument.\n").arg(name)); + } else { + if (args.at(0).type() != QVariant::String) { + yyMsg(identLineNo) << qPrintable(LU::tr("%1(): identifier must be a literal string.\n").arg(name)); + } else { + msgid = args.at(0).toString(); + bool plural = (args.size() > 1); + recordMessage(translator, QString(), sourcetext, QString(), extracomment, + msgid, extra, plural, fileName(), identLineNo); + } + } + sourcetext.clear(); + extracomment.clear(); + msgid.clear(); + extra.clear(); } } break; ./ @@ -1813,20 +1896,73 @@ ExpressionNotInOpt: ; ExpressionNotInOpt: ExpressionNotIn ; Statement: Block ; +/. + case $rule_number: +./ Statement: VariableStatement ; +/. + case $rule_number: +./ Statement: EmptyStatement ; +/. + case $rule_number: +./ Statement: ExpressionStatement ; +/. + case $rule_number: +./ Statement: IfStatement ; +/. + case $rule_number: +./ Statement: IterationStatement ; +/. + case $rule_number: +./ Statement: ContinueStatement ; +/. + case $rule_number: +./ Statement: BreakStatement ; +/. + case $rule_number: +./ Statement: ReturnStatement ; +/. + case $rule_number: +./ Statement: WithStatement ; +/. + case $rule_number: +./ Statement: LabelledStatement ; +/. + case $rule_number: +./ Statement: SwitchStatement ; +/. + case $rule_number: +./ Statement: ThrowStatement ; +/. + case $rule_number: +./ Statement: TryStatement ; +/. + case $rule_number: +./ Statement: DebuggerStatement ; +/. + case $rule_number: + if (!sourcetext.isEmpty() || !extracomment.isEmpty() || !msgid.isEmpty() || !extra.isEmpty()) { + yyMsg() << qPrintable(LU::tr("Discarding unconsumed meta data\n")); + sourcetext.clear(); + extracomment.clear(); + msgid.clear(); + extra.clear(); + } + break; +./ Block: T_LBRACE StatementListOpt T_RBRACE ; StatementList: Statement ; @@ -1965,6 +2101,9 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ; { if (first) error_message += QLatin1String ("Expected "); + //: Beginning of the string that contains + //: comma-separated list of expected tokens + error_message += LU::tr("Expected "); else error_message += QLatin1String (", "); @@ -1988,13 +2127,69 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ; return false; } +std::ostream &QScriptParser::yyMsg(int line) +{ + return std::cerr << qPrintable(fileName()) << ':' << (line ? line : lexer->startLineNo()) << ": "; +} + +void QScriptParser::processComment(const QChar *chars, int length) +{ + if (!length) + return; + // Try to match the logic of the C++ parser. + if (*chars == QLatin1Char(':') && chars[1].isSpace()) { + extracomment += QString(chars+2, length-2); + } else if (*chars == QLatin1Char('=') && chars[1].isSpace()) { + msgid = QString(chars+2, length-2).simplified(); + } else if (*chars == QLatin1Char('~') && chars[1].isSpace()) { + QString text = QString(chars+2, length-2).trimmed(); + int k = text.indexOf(QLatin1Char(' ')); + if (k > -1) + extra.insert(text.left(k), text.mid(k + 1).trimmed()); + } else if (*chars == QLatin1Char('%') && chars[1].isSpace()) { + sourcetext.reserve(sourcetext.length() + length-2); + ushort *ptr = (ushort *)sourcetext.data() + sourcetext.length(); + int p = 2, c; + forever { + if (p >= length) + break; + c = chars[p++].unicode(); + if (isspace(c)) + continue; + if (c != '"') { + yyMsg() << qPrintable(LU::tr("Unexpected character in meta string\n")); + break; + } + forever { + if (p >= length) { + whoops: + yyMsg() << qPrintable(LU::tr("Unterminated meta string\n")); + break; + } + c = chars[p++].unicode(); + if (c == '"') + break; + if (c == '\\') { + if (p >= length) + goto whoops; + c = chars[p++].unicode(); + if (c == '\n') + goto whoops; + *ptr++ = '\\'; + } + *ptr++ = c; + } + } + sourcetext.resize(ptr - (ushort *)sourcetext.data()); + } +} + bool loadQScript(Translator &translator, const QString &filename, ConversionData &cd) { QFile file(filename); if (!file.open(QIODevice::ReadOnly)) { - cd.appendError(QString::fromLatin1("Cannot open %1: %2") - .arg(filename, file.errorString())); + cd.appendError(LU::tr("Cannot open %1: %2").arg(filename, file.errorString())); return false; } QTextStream ts(&file); @@ -2007,10 +2202,11 @@ bool loadQScript(Translator &translator, const QString &filename, ConversionData ts.setAutoDetectUnicode(true); QString code = ts.readAll(); - QScript::Lexer lexer; - lexer.setCode(code, /*lineNumber=*/1); QScriptParser parser; - if (!parser.parse(&lexer, filename, &translator)) { + QScript::Lexer lexer(&parser); + lexer.setCode(code, filename, /*lineNumber=*/1); + parser.setLexer(&lexer); + if (!parser.parse(&translator)) { std::cerr << qPrintable(filename) << ':' << parser.errorLineNumber() << ": " << qPrintable(parser.errorMessage()) << std::endl; return false; diff --git a/tools/linguist/lupdate/ui.cpp b/tools/linguist/lupdate/ui.cpp index 9e22922..797ab1f 100644 --- a/tools/linguist/lupdate/ui.cpp +++ b/tools/linguist/lupdate/ui.cpp @@ -43,6 +43,7 @@ #include <translator.h> +#include <QtCore/QCoreApplication> #include <QtCore/QDebug> #include <QtCore/QFile> #include <QtCore/QString> @@ -55,6 +56,10 @@ QT_BEGIN_NAMESPACE +class LU { + Q_DECLARE_TR_FUNCTIONS(LUpdate) +}; + class UiReader : public QXmlDefaultHandler { public: @@ -152,11 +157,10 @@ bool UiReader::characters(const QString &ch) bool UiReader::fatalError(const QXmlParseException &exception) { - QString msg; - msg.sprintf("XML error: Parse error at line %d, column %d (%s).", - exception.lineNumber(), exception.columnNumber(), - exception.message().toLatin1().data()); - m_cd.appendError(msg); + QString msg = LU::tr("XML error: Parse error at line %1, column %2 (%3).") + .arg(exception.lineNumber()).arg(exception.columnNumber()) + .arg(exception.message()); + m_cd.appendError(msg); return false; } @@ -181,8 +185,7 @@ bool loadUI(Translator &translator, const QString &filename, ConversionData &cd) cd.m_sourceFileName = filename; QFile file(filename); if (!file.open(QIODevice::ReadOnly)) { - cd.appendError(QString::fromLatin1("Cannot open %1: %2") - .arg(filename, file.errorString())); + cd.appendError(LU::tr("Cannot open %1: %2").arg(filename, file.errorString())); return false; } QXmlInputSource in(&file); @@ -196,7 +199,7 @@ bool loadUI(Translator &translator, const QString &filename, ConversionData &cd) reader.setErrorHandler(&handler); bool result = reader.parse(in); if (!result) - cd.appendError(QLatin1String("Parse error in UI file")); + cd.appendError(LU::tr("Parse error in UI file")); reader.setContentHandler(0); reader.setErrorHandler(0); return result; diff --git a/tools/linguist/shared/po.cpp b/tools/linguist/shared/po.cpp index a692332..3fd05ee 100644 --- a/tools/linguist/shared/po.cpp +++ b/tools/linguist/shared/po.cpp @@ -50,8 +50,6 @@ #include <ctype.h> -#define MAGIC_OBSOLETE_REFERENCE "Obsolete_PO_entries" - // Uncomment if you wish to hard wrap long lines in .po files. Note that this // affects only msg strings, not comments. //#define HARD_WRAP_LONG_WORDS @@ -555,15 +553,26 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) TranslatorMessage msg; msg.setContext(codec->toUnicode(item.context)); if (!item.references.isEmpty()) { + QString xrefs; foreach (const QString &ref, codec->toUnicode(item.references).split( QRegExp(QLatin1String("\\s")), QString::SkipEmptyParts)) { - int pos = ref.lastIndexOf(QLatin1Char(':')); - if (pos != -1) - msg.addReference(ref.left(pos), ref.mid(pos + 1).toInt()); + int pos = ref.indexOf(QLatin1Char(':')); + int lpos = ref.lastIndexOf(QLatin1Char(':')); + if (pos != -1 && pos == lpos) { + bool ok; + int lno = ref.mid(pos + 1).toInt(&ok); + if (ok) { + msg.addReference(ref.left(pos), lno); + continue; + } + } + if (!xrefs.isEmpty()) + xrefs += QLatin1Char(' '); + xrefs += ref; } - } else if (isObsolete) { - msg.setFileName(QLatin1String(MAGIC_OBSOLETE_REFERENCE)); + if (!xrefs.isEmpty()) + item.extra[QLatin1String("po-references")] = xrefs; } msg.setId(codec->toUnicode(item.id)); msg.setSourceText(codec->toUnicode(item.msgId)); @@ -660,6 +669,8 @@ bool loadPO(Translator &translator, QIODevice &dev, ConversionData &cd) item.isPlural = true; } else if (line.startsWith("#~ msgctxt ")) { item.tscomment = slurpEscapedString(lines, l, 11, "#~ ", cd); + if (qtContexts) + splitContext(&item.tscomment, &item.context); } else { cd.appendError(QString(QLatin1String("PO-format parse error in line %1: '%2'")) .arg(l + 1).arg(codec->toUnicode(lines[l]))); @@ -773,11 +784,14 @@ bool savePO(const Translator &translator, QIODevice &dev, ConversionData &cd) if (!msg.id().isEmpty()) out << QLatin1String("#. ts-id ") << msg.id() << '\n'; - if (!msg.fileName().isEmpty() && msg.fileName() != QLatin1String(MAGIC_OBSOLETE_REFERENCE)) { + QString xrefs = msg.extra(QLatin1String("po-references")); + if (!msg.fileName().isEmpty() || !xrefs.isEmpty()) { QStringList refs; foreach (const TranslatorMessage::Reference &ref, msg.allReferences()) refs.append(QString(QLatin1String("%2:%1")) .arg(ref.lineNumber()).arg(ref.fileName())); + if (!xrefs.isEmpty()) + refs << xrefs; out << poWrappedEscapedLines(QLatin1String("#:"), true, refs.join(QLatin1String(" "))); } diff --git a/tools/linguist/shared/xliff.cpp b/tools/linguist/shared/xliff.cpp index 6411426..70724ef 100644 --- a/tools/linguist/shared/xliff.cpp +++ b/tools/linguist/shared/xliff.cpp @@ -53,6 +53,11 @@ #include <QtXml/QXmlParseException> +// The string value is historical and reflects the main purpose: Keeping +// obsolete entries separate from the magic file message (which both have +// no location information, but typically reside at opposite ends of the file). +#define MAGIC_OBSOLETE_REFERENCE "Obsolete_PO_entries" + QT_BEGIN_NAMESPACE /** @@ -692,6 +697,9 @@ bool XLIFFHandler::finalizeMessage(bool isPlural) m_cd.appendError(QLatin1String("XLIFF syntax error: Message without source string.")); return false; } + if (m_type == TranslatorMessage::Obsolete && m_refs.size() == 1 + && m_refs.at(0).fileName() == QLatin1String(MAGIC_OBSOLETE_REFERENCE)) + m_refs.clear(); TranslatorMessage msg(m_context, m_sources[0], m_comment, QString(), QString(), -1, m_translations, m_type, isPlural); @@ -761,12 +769,15 @@ bool saveXLIFF(const Translator &translator, QIODevice &dev, ConversionData &cd) QHash<QString, QList<QString> > contextOrder; QList<QString> fileOrder; foreach (const TranslatorMessage &msg, translator.messages()) { - QHash<QString, QList<TranslatorMessage> > &file = messageOrder[msg.fileName()]; + QString fn = msg.fileName(); + if (fn.isEmpty() && msg.type() == TranslatorMessage::Obsolete) + fn = QLatin1String(MAGIC_OBSOLETE_REFERENCE); + QHash<QString, QList<TranslatorMessage> > &file = messageOrder[fn]; if (file.isEmpty()) - fileOrder.append(msg.fileName()); + fileOrder.append(fn); QList<TranslatorMessage> &context = file[msg.context()]; if (context.isEmpty()) - contextOrder[msg.fileName()].append(msg.context()); + contextOrder[fn].append(msg.context()); context.append(msg); } diff --git a/tools/porting/src/errors.cpp b/tools/porting/src/errors.cpp index 580efb5..9081dba 100644 --- a/tools/porting/src/errors.cpp +++ b/tools/porting/src/errors.cpp @@ -44,8 +44,8 @@ QT_BEGIN_NAMESPACE -QT_STATIC_CONST_IMPL Error& Errors::InternalError = Error( 1, -1, QLatin1String("Internal Error") ); -QT_STATIC_CONST_IMPL Error& Errors::SyntaxError = Error( 2, -1, QLatin1String("Syntax Error before '%1'") ); -QT_STATIC_CONST_IMPL Error& Errors::ParseError = Error( 3, -1, QLatin1String("Parse Error before '%1'") ); +QT_STATIC_CONST_IMPL Error Errors::InternalError = Error( 1, -1, QLatin1String("Internal Error") ); +QT_STATIC_CONST_IMPL Error Errors::SyntaxError = Error( 2, -1, QLatin1String("Syntax Error before '%1'") ); +QT_STATIC_CONST_IMPL Error Errors::ParseError = Error( 3, -1, QLatin1String("Parse Error before '%1'") ); QT_END_NAMESPACE diff --git a/tools/porting/src/errors.h b/tools/porting/src/errors.h index f0ad691..dbac833 100644 --- a/tools/porting/src/errors.h +++ b/tools/porting/src/errors.h @@ -61,9 +61,9 @@ public: class Errors { public: - QT_STATIC_CONST Error& InternalError; - QT_STATIC_CONST Error& SyntaxError; - QT_STATIC_CONST Error& ParseError; + QT_STATIC_CONST Error InternalError; + QT_STATIC_CONST Error SyntaxError; + QT_STATIC_CONST Error ParseError; }; QT_END_NAMESPACE diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 698b516..bc71b6e 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -3177,7 +3177,14 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode, if (parseArg(src, typeTag, &i, srcSize, &arg, &par1)) { par1 = QStringRef(); const Node* n = marker->resolveTarget(arg.toString(), myTree, relative, self); - addLink(linkForNode(n,relative), arg, &html); + if (n && n->subType() == Node::QmlBasicType) { + if (relative && relative->subType() == Node::QmlClass) + addLink(linkForNode(n,relative), arg, &html); + else + html += arg.toString(); + } + else + addLink(linkForNode(n,relative), arg, &html); handled = true; } else if (parseArg(src, headerTag, &i, srcSize, &arg, &par1)) { @@ -3539,7 +3546,7 @@ QString HtmlGenerator::linkForNode(const Node *node, const Node *relative) return QString(); if (node->access() == Node::Private) return QString(); - + fn = fileName(node); /* if (!node->url().isEmpty()) return fn;*/ diff --git a/tools/qdoc3/main.cpp b/tools/qdoc3/main.cpp index fa7efee..2bfe38e 100644 --- a/tools/qdoc3/main.cpp +++ b/tools/qdoc3/main.cpp @@ -148,7 +148,7 @@ static void printHelp() */ static void printVersion() { - QString s = QString(tr("qdoc version ")) + QString(QT_VERSION_STR); + QString s = tr("qdoc version %1").arg(QT_VERSION_STR); Location::information(s); } diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro index 5bedc29..ae0bf25 100644 --- a/tools/qdoc3/qdoc3.pro +++ b/tools/qdoc3/qdoc3.pro @@ -6,6 +6,7 @@ DEFINES += QT_NO_CAST_TO_ASCII qdoc_bootstrapped { include(../../src/tools/bootstrap/bootstrap.pri) + SOURCES += ../../src/corelib/plugin/quuid.cpp DEFINES -= QT_NO_CAST_FROM_ASCII DEFINES += QT_NO_TRANSLATION } else { diff --git a/tools/qdoc3/test/qt-defines.qdocconf b/tools/qdoc3/test/qt-defines.qdocconf index 9e41d93..344bbb0 100644 --- a/tools/qdoc3/test/qt-defines.qdocconf +++ b/tools/qdoc3/test/qt-defines.qdocconf @@ -20,29 +20,29 @@ codeindent = 1 # See also qhp.Qt.extraFiles extraimages.HTML = qt-logo \ trolltech-logo \ - bg_l.png \ - bg_l_blank.png \ - bg_ll_blank.png \ - bg_ul_blank.png \ - header_bg.png \ - bg_r.png \ - box_bg.png \ - breadcrumb.png \ - bullet_gt.png \ - bullet_dn.png \ - bullet_sq.png \ - bullet_up.png \ - arrow_down.png \ - feedbackground.png \ - horBar.png \ - page.png \ - page_bg.png \ - sprites-combined.png \ - spinner.gif \ - stylesheet-coffee-plastique.png \ - taskmenuextension-example.png \ - coloreditorfactoryimage.png \ - dynamiclayouts-example.png \ + bg_l.png \ + bg_l_blank.png \ + bg_ll_blank.png \ + bg_ul_blank.png \ + header_bg.png \ + bg_r.png \ + box_bg.png \ + breadcrumb.png \ + bullet_gt.png \ + bullet_dn.png \ + bullet_sq.png \ + bullet_up.png \ + arrow_down.png \ + feedbackground.png \ + horBar.png \ + page.png \ + page_bg.png \ + sprites-combined.png \ + spinner.gif \ + stylesheet-coffee-plastique.png \ + taskmenuextension-example.png \ + coloreditorfactoryimage.png \ + dynamiclayouts-example.png # This stuff is used by the new doc format. scriptdirs = $QT_SOURCE_TREE/doc/src/template/scripts diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index c70bcaf..8d4d27f 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -98,10 +98,13 @@ HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \ " Qt Topics</h2>\n" \ " <div id=\"list002\" class=\"list\">\n" \ " <ul id=\"ul002\" >\n" \ - " <li class=\"defaultLink\"><a href=\"qt-basic-concepts.html\">Basic Qt architecture</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"qtquick.html\">Device UI's & Qt Quick</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"qt-gui-concepts.html\">Desktop UI components</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"platform-specific.html\">Platform-specific info</a></li>\n" \ + " <li><a href=\"qt-basic-concepts.html\">Programming with Qt</a></li> \n" \ + " <li><a href=\"qtquick.html\">Device UI's & Qt Quick</a></li> \n" \ + " <li><a href=\"qt-gui-concepts.html\">UI Design with Qt</a></li> \n" \ + " <li><a href=\"developing-with-qt.html\">Cross-platform and Platform-specific</a></li> \n" \ + " <li><a href=\"platform-specific.html\">Platform-specific info</a></li> \n" \ + " <li><a href=\"technology-apis.html\">Qt and Key Technologies</a></li> \n" \ + " <li><a href=\"best-practices.html\">How-To's and Best Practices</a></li> \n" \ " </ul> \n" \ " </div>\n" \ " </div>\n" \ diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro index d794005..3927dd6 100644 --- a/tools/qml/qml.pro +++ b/tools/qml/qml.pro @@ -34,7 +34,7 @@ maemo5 { } symbian { TARGET.UID3 = 0x20021317 - include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) + include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) TARGET.EPOCHEAPSIZE = 0x20000 0x4000000 TARGET.CAPABILITY = NetworkServices ReadUserData !contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) { diff --git a/tools/qml/startup/startup.qml b/tools/qml/startup/startup.qml index be67598..ddc7217 100644 --- a/tools/qml/startup/startup.qml +++ b/tools/qml/startup/startup.qml @@ -49,14 +49,53 @@ Rectangle { Component.onCompleted: treatsApp.state = "part1" signal animationFinished - Logo { - id: logo - x: 165 - y: 35 - rotation: -15 - scale: 0.6 - opacity: 0 - onAnimationFinished: treatsApp.animationFinished(); + Item { + width: 800 + height: 480 + anchors.centerIn: parent + clip: true + + Logo { + id: logo + x: 165 + y: 35 + rotation: -15 + scale: 0.6 + opacity: 0 + onAnimationFinished: treatsApp.animationFinished(); + } + + Item { + id: quickblur + x: 800//325 + y: 344 + Image { + id: blurText + source: "quick-blur.png" + } + Image { + id: quickregular + x: -1 + y: 0 + opacity: 0 + source: "quick-regular.png" + } + Image { + id: star + x: -1 + y: 0 + opacity: 0 + source: "white-star.png" + smooth: true + NumberAnimation on rotation { + from: 0 + to: 360 + loops: NumberAnimation.Infinite + running: true + duration: 2000 + } + } + } } states: [ @@ -96,39 +135,6 @@ Rectangle { } ] - - Item { - id: quickblur - x: 800//325 - y: 344 - Image { - id: blurText - source: "quick-blur.png" - } - Image { - id: quickregular - x: -1 - y: 0 - opacity: 0 - source: "quick-regular.png" - } - Image { - id: star - x: -1 - y: 0 - opacity: 0 - source: "white-star.png" - smooth: true - NumberAnimation on rotation { - from: 0 - to: 360 - loops: NumberAnimation.Infinite - running: true - duration: 2000 - } - } - } - transitions: [ Transition { ParallelAnimation { diff --git a/tools/shared/qtpropertybrowser/qtpropertymanager.cpp b/tools/shared/qtpropertybrowser/qtpropertymanager.cpp index d9ff10a..8c7835c 100644 --- a/tools/shared/qtpropertybrowser/qtpropertymanager.cpp +++ b/tools/shared/qtpropertybrowser/qtpropertymanager.cpp @@ -2399,15 +2399,23 @@ QString QtLocalePropertyManager::valueText(const QtProperty *property) const if (it == d_ptr->m_values.constEnd()) return QString(); - QLocale loc = it.value(); + const QLocale loc = it.value(); int langIdx = 0; int countryIdx = 0; - metaEnumProvider()->localeToIndex(loc.language(), loc.country(), &langIdx, &countryIdx); - QString str = tr("%1, %2") - .arg(metaEnumProvider()->languageEnumNames().at(langIdx)) - .arg(metaEnumProvider()->countryEnumNames(loc.language()).at(countryIdx)); - return str; + const QtMetaEnumProvider *me = metaEnumProvider(); + me->localeToIndex(loc.language(), loc.country(), &langIdx, &countryIdx); + if (langIdx < 0) { + qWarning("QtLocalePropertyManager::valueText: Unknown language %d", loc.language()); + return tr("<Invalid>"); + } + const QString languageName = me->languageEnumNames().at(langIdx); + if (countryIdx < 0) { + qWarning("QtLocalePropertyManager::valueText: Unknown country %d for %s", loc.country(), qPrintable(languageName)); + return languageName; + } + const QString countryName = me->countryEnumNames(loc.language()).at(countryIdx); + return tr("%1, %2").arg(languageName, countryName); } /*! @@ -2635,8 +2643,8 @@ QString QtPointPropertyManager::valueText(const QtProperty *property) const if (it == d_ptr->m_values.constEnd()) return QString(); const QPoint v = it.value(); - return QString(tr("(%1, %2)").arg(QString::number(v.x())) - .arg(QString::number(v.y()))); + return tr("(%1, %2)").arg(QString::number(v.x())) + .arg(QString::number(v.y())); } /*! @@ -2876,8 +2884,8 @@ QString QtPointFPropertyManager::valueText(const QtProperty *property) const return QString(); const QPointF v = it.value().val; const int dec = it.value().decimals; - return QString(tr("(%1, %2)").arg(QString::number(v.x(), 'f', dec)) - .arg(QString::number(v.y(), 'f', dec))); + return tr("(%1, %2)").arg(QString::number(v.x(), 'f', dec)) + .arg(QString::number(v.y(), 'f', dec)); } /*! @@ -3196,8 +3204,8 @@ QString QtSizePropertyManager::valueText(const QtProperty *property) const if (it == d_ptr->m_values.constEnd()) return QString(); const QSize v = it.value().val; - return QString(tr("%1 x %2").arg(QString::number(v.width())) - .arg(QString::number(v.height()))); + return tr("%1 x %2").arg(QString::number(v.width())) + .arg(QString::number(v.height())); } /*! @@ -3561,8 +3569,8 @@ QString QtSizeFPropertyManager::valueText(const QtProperty *property) const return QString(); const QSizeF v = it.value().val; const int dec = it.value().decimals; - return QString(tr("%1 x %2").arg(QString::number(v.width(), 'f', dec)) - .arg(QString::number(v.height(), 'f', dec))); + return tr("%1 x %2").arg(QString::number(v.width(), 'f', dec)) + .arg(QString::number(v.height(), 'f', dec)); } /*! @@ -3954,10 +3962,10 @@ QString QtRectPropertyManager::valueText(const QtProperty *property) const if (it == d_ptr->m_values.constEnd()) return QString(); const QRect v = it.value().val; - return QString(tr("[(%1, %2), %3 x %4]").arg(QString::number(v.x())) - .arg(QString::number(v.y())) - .arg(QString::number(v.width())) - .arg(QString::number(v.height()))); + return tr("[(%1, %2), %3 x %4]").arg(QString::number(v.x())) + .arg(QString::number(v.y())) + .arg(QString::number(v.width())) + .arg(QString::number(v.height())); } /*! diff --git a/translations/assistant_sl.ts b/translations/assistant_sl.ts new file mode 100644 index 0000000..05429bd --- /dev/null +++ b/translations/assistant_sl.ts @@ -0,0 +1,972 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="sl"> + <extra-po-header-po_revision_date>2010-08-28 14:36+0200</extra-po-header-po_revision_date> + <extra-po-headers>MIME-Version,Content-Type,Content-Transfer-Encoding,Plural-Forms,X-Language,X-Qt-Contexts,Last-Translator,PO-Revision-Date,Project-Id-Version,Language-Team,X-Generator</extra-po-headers> + <extra-po-header-x_generator>Lokalize 1.1</extra-po-header-x_generator> + <extra-po-header-language_team>Slovenian <lugos-slo@lugos.si></extra-po-header-language_team> + <extra-po-header-project_id_version></extra-po-header-project_id_version> + <extra-po-header_comment># Jure Repinc <jlp@holodeck1.com>, 2010.</extra-po-header_comment> + <extra-po-header-last_translator>Jure Repinc <jlp@holodeck1.com></extra-po-header-last_translator> +<context> + <name>AboutDialog</name> + <message> + <source>&Close</source> + <translation>&Zapri</translation> + </message> +</context> +<context> + <name>AboutLabel</name> + <message> + <source>Warning</source> + <translation>Opozorilo</translation> + </message> + <message> + <source>Unable to launch external application. +</source> + <translation>Zunanjega programa ni moč zagnati. +</translation> + </message> + <message> + <source>OK</source> + <translation>V redu</translation> + </message> +</context> +<context> + <name>Assistant</name> + <message> + <source>Error registering documentation file '%1': %2</source> + <translation>Napaka pri registraciji datoteke z dokumentacijo »%1«: %2</translation> + </message> + <message> + <source>Error: %1</source> + <translation>Napaka: %1</translation> + </message> + <message> + <source>Could not register documentation file +%1 + +Reason: +%2</source> + <translation>Ni bilo moč registrirati datoteke z dokumentacijo +%1 + +Razlog: +%2</translation> + </message> + <message> + <source>Documentation successfully registered.</source> + <translation>Dokumentacija je bila uspešno registrirana.</translation> + </message> + <message> + <source>Could not unregister documentation file +%1 + +Reason: +%2</source> + <translation>Ni bilo moč od-registrirati datoteke z dokumentacijo +%1 + +Razlog: +%2</translation> + </message> + <message> + <source>Documentation successfully unregistered.</source> + <translation>Dokumentacija je bila uspešno odstranjena iz registrira.</translation> + </message> + <message> + <source>Error reading collection file '%1': %2.</source> + <translation>Napaka pri branju datoteke zbirke »%1«: %2.</translation> + </message> + <message> + <source>Error creating collection file '%1': %2.</source> + <translation>Napaka pri ustvarjanju datoteke zbirke »%1«: %2.</translation> + </message> + <message> + <source>Cannot load sqlite database driver!</source> + <translation>Ni moč naložiti gonilnika za podatkovno zbirko SQLite.</translation> + </message> +</context> +<context> + <name>BookmarkDialog</name> + <message> + <source>Add Bookmark</source> + <translation>Dodaj zaznamek</translation> + </message> + <message> + <source>Bookmark:</source> + <translation>Zaznamek:</translation> + </message> + <message> + <source>Add in Folder:</source> + <translation>Dodaj v mapo:</translation> + </message> + <message> + <source>+</source> + <translation>+</translation> + </message> + <message> + <source>New Folder</source> + <translation>Nova mapa</translation> + </message> + <message> + <source>Rename Folder</source> + <translation>Preimenuj mapo</translation> + </message> +</context> +<context> + <name>BookmarkManager</name> + <message> + <source>Untitled</source> + <translation>Brez naslova</translation> + </message> + <message> + <source>Remove</source> + <translation>Odstrani</translation> + </message> + <message> + <source>You are going to delete a Folder, this will also<br>remove it's content. Are you sure to continue?</source> + <translation>Nameravate zbrisati mapo, pri čemer bo zbrisana<br>tudi njena vsebina. Ali res želite nadaljevati?</translation> + </message> + <message> + <source>Manage Bookmarks...</source> + <translation>Upravljanje zaznamkov ...</translation> + </message> + <message> + <source>Add Bookmark...</source> + <translation>Dodaj zaznamek ...</translation> + </message> + <message> + <source>Ctrl+D</source> + <translation>Ctrl+D</translation> + </message> + <message> + <source>Delete Folder</source> + <translation>Izbriši mapo</translation> + </message> + <message> + <source>Rename Folder</source> + <translation>Preimenuj mapo</translation> + </message> + <message> + <source>Show Bookmark</source> + <translation>Prikaži zaznamek</translation> + </message> + <message> + <source>Show Bookmark in New Tab</source> + <translation>Prikaži zaznamek v novem zavihku</translation> + </message> + <message> + <source>Delete Bookmark</source> + <translation>Izbriši zaznamek</translation> + </message> + <message> + <source>Rename Bookmark</source> + <translation>Preimenuj zaznamek</translation> + </message> +</context> +<context> + <name>BookmarkManagerWidget</name> + <message> + <source>Manage Bookmarks</source> + <translation>Upravljanje zaznamkov</translation> + </message> + <message> + <source>Search:</source> + <translation>Išči:</translation> + </message> + <message> + <source>Remove</source> + <translation>Odstrani</translation> + </message> + <message> + <source>Import and Backup</source> + <translation>Uvozi in ustvari varnostno kopijo</translation> + </message> + <message> + <source>OK</source> + <translation>V redu</translation> + </message> + <message> + <source>Import...</source> + <translation>Uvozi ...</translation> + </message> + <message> + <source>Export...</source> + <translation>Izvozi ...</translation> + </message> + <message> + <source>Open File</source> + <translation>Odpri datoteko</translation> + </message> + <message> + <source>Files (*.xbel)</source> + <translation>Datoteke (*.xbel)</translation> + </message> + <message> + <source>Save File</source> + <translation>Shrani datoteko</translation> + </message> + <message> + <source>Qt Assistant</source> + <translation>Qt Assistant</translation> + </message> + <message> + <source>Unable to save bookmarks.</source> + <translation>Zaznamkov ni moč shraniti.</translation> + </message> + <message> + <source>You are goingto delete a Folder, this will also<br> remove it's content. Are you sure to continue?</source> + <translation>Nameravate zbrisati mapo, pri čemer bo zbrisana<br>tudi njena vsebina. Ali res želite nadaljevati?</translation> + </message> + <message> + <source>Delete Folder</source> + <translation>Izbriši mapo</translation> + </message> + <message> + <source>Rename Folder</source> + <translation>Preimenuj mapo</translation> + </message> + <message> + <source>Show Bookmark</source> + <translation>Prikaži zaznamek</translation> + </message> + <message> + <source>Show Bookmark in New Tab</source> + <translation>Prikaži zaznamek v novem zavihku</translation> + </message> + <message> + <source>Delete Bookmark</source> + <translation>Izbriši zaznamek</translation> + </message> + <message> + <source>Rename Bookmark</source> + <translation>Preimenuj zaznamek</translation> + </message> +</context> +<context> + <name>BookmarkModel</name> + <message> + <source>Name</source> + <translation>Ime</translation> + </message> + <message> + <source>Address</source> + <translation>Naslov</translation> + </message> + <message> + <source>Bookmarks Menu</source> + <translation>Meni z zaznamki</translation> + </message> +</context> +<context> + <name>BookmarkWidget</name> + <message> + <source>Bookmarks</source> + <translation>Zaznamki</translation> + </message> + <message> + <source>Filter:</source> + <translation>Filter:</translation> + </message> + <message> + <source>Add</source> + <translation>Dodaj</translation> + </message> + <message> + <source>Remove</source> + <translation>Odstrani</translation> + </message> +</context> +<context> + <name>CentralWidget</name> + <message> + <source>Add new page</source> + <translation>Dodaj novo stran</translation> + </message> + <message> + <source>Close current page</source> + <translation>Zapri trenutno stran</translation> + </message> + <message> + <source>Print Document</source> + <translation>Natisni dokument</translation> + </message> + <message> + <source>unknown</source> + <translation>neznano</translation> + </message> + <message> + <source>Add New Page</source> + <translation>Dodaj novo stran</translation> + </message> + <message> + <source>Close This Page</source> + <translation>Zapri to stran</translation> + </message> + <message> + <source>Close Other Pages</source> + <translation>Zapri druge strani</translation> + </message> + <message> + <source>Add Bookmark for this Page...</source> + <translation>Dodaj zaznamek za to stran ...</translation> + </message> + <message> + <source>Search</source> + <translation>Iskanje</translation> + </message> +</context> +<context> + <name>CmdLineParser</name> + <message> + <source>Unknown option: %1</source> + <translation>Neznana možnost: %1</translation> + </message> + <message> + <source>The collection file '%1' does not exist.</source> + <translation>Datoteka zbirke »%1« ne obstaja.</translation> + </message> + <message> + <source>Missing collection file.</source> + <translation>Manjkajoča datoteka zbirke.</translation> + </message> + <message> + <source>Invalid URL '%1'.</source> + <translation>Neveljaven URL »%1«.</translation> + </message> + <message> + <source>Missing URL.</source> + <translation>Manjkajoč URL.</translation> + </message> + <message> + <source>Unknown widget: %1</source> + <translation>Neznan gradnik: %1</translation> + </message> + <message> + <source>Missing widget.</source> + <translation>Manjkajoč gradnik.</translation> + </message> + <message> + <source>The Qt help file '%1' does not exist.</source> + <translation>Datoteka s pomočjo za Qt »%1« ne obstaja.</translation> + </message> + <message> + <source>Missing help file.</source> + <translation>Manjkajoča datoteka s pomočjo.</translation> + </message> + <message> + <source>Missing filter argument.</source> + <translation>Manjkajoč argument filtra.</translation> + </message> + <message> + <source>Error</source> + <translation>Napaka</translation> + </message> + <message> + <source>Notice</source> + <translation>Opomba</translation> + </message> +</context> +<context> + <name>ContentWindow</name> + <message> + <source>Open Link</source> + <translation>Odpri povezavo</translation> + </message> + <message> + <source>Open Link in New Tab</source> + <translation>Odpri povezavo v novem zavihku</translation> + </message> +</context> +<context> + <name>FilterNameDialogClass</name> + <message> + <source>Add Filter Name</source> + <translation>Dodaj ime filtra</translation> + </message> + <message> + <source>Filter Name:</source> + <translation>Ime filtra:</translation> + </message> +</context> +<context> + <name>FindWidget</name> + <message> + <source>Previous</source> + <translation>Predhodno</translation> + </message> + <message> + <source>Next</source> + <translation>Naslednje</translation> + </message> + <message> + <source>Case Sensitive</source> + <translation>Loči velike in male črke</translation> + </message> + <message> + <source><img src=":/trolltech/assistant/images/wrap.png">&nbsp;Search wrapped</source> + <translation><img src=":/trolltech/assistant/images/wrap.png">&nbsp;Iskanje se nadaljuje na drugem koncu</translation> + </message> +</context> +<context> + <name>FontPanel</name> + <message> + <source>Font</source> + <translation>Pisava</translation> + </message> + <message> + <source>&Writing system</source> + <translation>S&istem pisanja</translation> + </message> + <message> + <source>&Family</source> + <translation>&Družina</translation> + </message> + <message> + <source>&Style</source> + <translation>&Slog</translation> + </message> + <message> + <source>&Point size</source> + <translation>&Velikost v točkah</translation> + </message> +</context> +<context> + <name>HelpViewer</name> + <message> + <source><title>about:blank</title></source> + <translation><title>about:blank</title></translation> + </message> + <message> + <source><title>Error 404...</title><div align="center"><br><br><h1>The page could not be found</h1><br><h3>'%1'</h3></div></source> + <translation><title>Napaka 404</title><div align="center"><br><br><h1>Strani ni bilo moč najti</h1><br><h3>»%1«</h3></div></translation> + </message> + <message> + <source>Copy &Link Location</source> + <translation>Skopiraj &povezavo do lokacije</translation> + </message> + <message> + <source>Open Link in New Tab Ctrl+LMB</source> + <translation>Odpri povezavo v novem zavihku Ctrl+LGM</translation> + </message> + <message> + <source>Open Link in New Tab</source> + <translation>Odpri povezavo v novem zavihku</translation> + </message> +</context> +<context> + <name>IndexWindow</name> + <message> + <source>&Look for:</source> + <translation>&Išči:</translation> + </message> + <message> + <source>Open Link</source> + <translation>Odpri povezavo</translation> + </message> + <message> + <source>Open Link in New Tab</source> + <translation>Odpri povezavo v novem zavihku</translation> + </message> +</context> +<context> + <name>InstallDialog</name> + <message> + <source>Install Documentation</source> + <translation>Namesti dokumentacijo</translation> + </message> + <message> + <source>Available Documentation:</source> + <translation>Razpoložljiva dokumentacija:</translation> + </message> + <message> + <source>Install</source> + <translation>Namesti</translation> + </message> + <message> + <source>Cancel</source> + <translation>Prekliči</translation> + </message> + <message> + <source>Close</source> + <translation>Zapri</translation> + </message> + <message> + <source>Installation Path:</source> + <translation>Namestitvena pot:</translation> + </message> + <message> + <source>...</source> + <translation>...</translation> + </message> + <message> + <source>Downloading documentation info...</source> + <translation>Prejemanje podatkov o dokumentaciji ...</translation> + </message> + <message> + <source>Download canceled.</source> + <translation>Prejemanje preklicano.</translation> + </message> + <message> + <source>Done.</source> + <translation>Opravljeno.</translation> + </message> + <message> + <source>The file %1 already exists. Do you want to overwrite it?</source> + <translation>Datoteka %1 že obstaja. Ali jo želite nadomestiti?</translation> + </message> + <message> + <source>Unable to save the file %1: %2.</source> + <translation>Datoteke %1 ni moč shraniti: %2.</translation> + </message> + <message> + <source>Downloading %1...</source> + <translation>Prejemanje %1 ...</translation> + </message> + <message> + <source>Download failed: %1.</source> + <translation>Prejemanje ni uspelo: %1.</translation> + </message> + <message> + <source>Documentation info file is corrupt!</source> + <translation>Datoteka s podatki o dokumentaciji je poškodovana.</translation> + </message> + <message> + <source>Download failed: Downloaded file is corrupted.</source> + <translation>Prejemanje ni uspelo. Prejeta datoteka je poškodovana.</translation> + </message> + <message> + <source>Installing documentation %1...</source> + <translation>Nameščanje dokumentacije %1 ...</translation> + </message> + <message> + <source>Error while installing documentation: +%1</source> + <translation>Napaka pri nameščanju dokumentacije: +%1</translation> + </message> +</context> +<context> + <name>MainWindow</name> + <message> + <source>Index</source> + <translation>Kazalo</translation> + </message> + <message> + <source>Contents</source> + <translation>Vsebina</translation> + </message> + <message> + <source>Bookmarks</source> + <translation>Zaznamki</translation> + </message> + <message> + <source>Qt Assistant</source> + <translation>Qt Assistant</translation> + </message> + <message> + <source>Looking for Qt Documentation...</source> + <translation>iskanje dokumentacije za Qt ...</translation> + </message> + <message> + <source>&File</source> + <translation>&Datoteka</translation> + </message> + <message> + <source>New &Tab</source> + <translation>Nov zavi&hek</translation> + </message> + <message> + <source>Page Set&up...</source> + <translation>Nastavitve stra&ni ...</translation> + </message> + <message> + <source>Print Preview...</source> + <translation>Ogled tiskanja ...</translation> + </message> + <message> + <source>&Print...</source> + <translation>Na&tisni ...</translation> + </message> + <message> + <source>&Close Tab</source> + <translation>&Zapri zavihek</translation> + </message> + <message> + <source>&Quit</source> + <translation>Konča&j</translation> + </message> + <message> + <source>CTRL+Q</source> + <translation>Ctrl+Q</translation> + </message> + <message> + <source>&Edit</source> + <translation>&Urejanje</translation> + </message> + <message> + <source>&Copy selected Text</source> + <translation>S&kopiraj izbrano besedilo</translation> + </message> + <message> + <source>&Find in Text...</source> + <translation>&Najdi v besedilu ...</translation> + </message> + <message> + <source>&Find</source> + <translation>&Najdi</translation> + </message> + <message> + <source>Find &Next</source> + <translation>Najdi na&slednje</translation> + </message> + <message> + <source>Find &Previous</source> + <translation>Najdi p&rejšnje</translation> + </message> + <message> + <source>Preferences...</source> + <translation>Nastavitve ...</translation> + </message> + <message> + <source>&View</source> + <translation>&Videz</translation> + </message> + <message> + <source>Zoom &in</source> + <translation>Po&večaj</translation> + </message> + <message> + <source>Zoom &out</source> + <translation>Z&manjšaj</translation> + </message> + <message> + <source>Normal &Size</source> + <translation>&Običajna velikost</translation> + </message> + <message> + <source>Ctrl+0</source> + <translation>Ctrl+0</translation> + </message> + <message> + <source>ALT+C</source> + <translation>Alt+V</translation> + </message> + <message> + <source>ALT+I</source> + <translation>Alt+K</translation> + </message> + <message> + <source>ALT+O</source> + <translation>Alt+Z</translation> + </message> + <message> + <source>Search</source> + <translation>Iskanje</translation> + </message> + <message> + <source>ALT+S</source> + <translation>Alt+I</translation> + </message> + <message> + <source>&Go</source> + <translation>&Pojdi</translation> + </message> + <message> + <source>&Home</source> + <translation>&Domov</translation> + </message> + <message> + <source>ALT+Home</source> + <translation>Alt+Domov</translation> + </message> + <message> + <source>&Back</source> + <translation>Na&zaj</translation> + </message> + <message> + <source>&Forward</source> + <translation>&Naprej</translation> + </message> + <message> + <source>Sync with Table of Contents</source> + <translation>Uskladi s seznamom vsebine</translation> + </message> + <message> + <source>Sync</source> + <translation>Uskladi</translation> + </message> + <message> + <source>Next Page</source> + <translation>Naslednja stran</translation> + </message> + <message> + <source>Ctrl+Alt+Right</source> + <translation>Ctrl+Alt+Desno</translation> + </message> + <message> + <source>Previous Page</source> + <translation>Predhodna stran</translation> + </message> + <message> + <source>Ctrl+Alt+Left</source> + <translation>Ctrl+Alt+Levo</translation> + </message> + <message> + <source>&Bookmarks</source> + <translation>&Zaznamki</translation> + </message> + <message> + <source>&Help</source> + <translation>&Pomoč</translation> + </message> + <message> + <source>About...</source> + <translation>O ...</translation> + </message> + <message> + <source>Navigation Toolbar</source> + <translation>Orodjarna za krmarjenje</translation> + </message> + <message> + <source>&Window</source> + <translation>&Okno</translation> + </message> + <message> + <source>Zoom</source> + <translation>Povečava</translation> + </message> + <message> + <source>Minimize</source> + <translation>Pomanjšaj</translation> + </message> + <message> + <source>Ctrl+M</source> + <translation>Ctrl+M</translation> + </message> + <message> + <source>Toolbars</source> + <translation>Orodjarne</translation> + </message> + <message> + <source>Filter Toolbar</source> + <translation>Orodjarna filtra</translation> + </message> + <message> + <source>Filtered by:</source> + <translation>Filtrirano po:</translation> + </message> + <message> + <source>Address Toolbar</source> + <translation>Naslovna vrstica</translation> + </message> + <message> + <source>Address:</source> + <translation>Naslov:</translation> + </message> + <message> + <source>Could not find the associated content item.</source> + <translation>Povezane postavke vsebine ni bilo moč najti.</translation> + </message> + <message> + <source>About %1</source> + <translation>O %1</translation> + </message> + <message> + <source>Updating search index</source> + <translation>Posodabljanje kazala za iskanje</translation> + </message> + <message> + <source>Could not register file '%1': %2</source> + <translation>Datoteke »%1« ni bilo moč registrirati: %2</translation> + </message> +</context> +<context> + <name>PreferencesDialog</name> + <message> + <source>Add Documentation</source> + <translation>Dodaj dokumentacijo</translation> + </message> + <message> + <source>Qt Compressed Help Files (*.qch)</source> + <translation>Stisnjene datoteke s pomočjo za Qt (*.qch)</translation> + </message> + <message> + <source>The namespace %1 is already registered!</source> + <translation>Imenski prostor %1 je že registriran.</translation> + </message> + <message> + <source>The specified file is not a valid Qt Help File!</source> + <translation>Navedena datoteka ni veljavna datoteka s pomočjo za Qt.</translation> + </message> + <message> + <source>Remove Documentation</source> + <translation>Odstrani dokumentacijo</translation> + </message> + <message> + <source>Some documents currently opened in Assistant reference the documentation you are attempting to remove. Removing the documentation will close those documents.</source> + <translation>Nekateri odprti dokumenti se sklicujejo na dokumentacijo, ki jo poskušate odstraniti. Odstranitev dokumentacije bo povzročila zaprtje teh dokumentov.</translation> + </message> + <message> + <source>Cancel</source> + <translation>Prekliči</translation> + </message> + <message> + <source>OK</source> + <translation>V redu</translation> + </message> + <message> + <source>Use custom settings</source> + <translation>Uporabi nastavitve po meri</translation> + </message> +</context> +<context> + <name>PreferencesDialogClass</name> + <message> + <source>Preferences</source> + <translation>Nastavitve</translation> + </message> + <message> + <source>Fonts</source> + <translation>Pisave</translation> + </message> + <message> + <source>Font settings:</source> + <translation>Nastavitve pisav</translation> + </message> + <message> + <source>Browser</source> + <translation>Brskalnik</translation> + </message> + <message> + <source>Application</source> + <translation>Program</translation> + </message> + <message> + <source>Filters</source> + <translation>Filtri</translation> + </message> + <message> + <source>Filter:</source> + <translation>Filter:</translation> + </message> + <message> + <source>Attributes:</source> + <translation>Lastnosti:</translation> + </message> + <message> + <source>1</source> + <translation>1</translation> + </message> + <message> + <source>Add</source> + <translation>Dodaj</translation> + </message> + <message> + <source>Remove</source> + <translation>Odstrani</translation> + </message> + <message> + <source>Documentation</source> + <translation>Dokumentacija</translation> + </message> + <message> + <source>Registered Documentation:</source> + <translation>Registrirana dokumentacija</translation> + </message> + <message> + <source>Add...</source> + <translation>Dodaj ...</translation> + </message> + <message> + <source>Options</source> + <translation>Možnosti</translation> + </message> + <message> + <source>On help start:</source> + <translation>Ob zagonu pomoči:</translation> + </message> + <message> + <source>Show my home page</source> + <translation>Prikaži mojo domačo stran</translation> + </message> + <message> + <source>Show a blank page</source> + <translation>Prikaži prazno stran</translation> + </message> + <message> + <source>Show my tabs from last session</source> + <translation>Prikaži moje zavihke iz zadnje seje</translation> + </message> + <message> + <source>Homepage</source> + <translation>Domača stran</translation> + </message> + <message> + <source>Current Page</source> + <translation>Trenutna stran</translation> + </message> + <message> + <source>Blank Page</source> + <translation>Prazna stran</translation> + </message> + <message> + <source>Restore to default</source> + <translation>Ponastavi na privzeto</translation> + </message> +</context> +<context> + <name>RemoteControl</name> + <message> + <source>Debugging Remote Control</source> + <translation>Razhroščevanje oddaljenega nadzora</translation> + </message> + <message> + <source>Received Command: %1 %2</source> + <translation>Prejet ukaz: %1 %2</translation> + </message> +</context> +<context> + <name>SearchWidget</name> + <message> + <source>&Copy</source> + <translation>S&kopiraj</translation> + </message> + <message> + <source>Copy &Link Location</source> + <translation>Skopiraj &povezavo do lokacije</translation> + </message> + <message> + <source>Open Link in New Tab</source> + <translation>Odpri povezavo v novem &zavihku</translation> + </message> + <message> + <source>Select All</source> + <translation>Izberi vse</translation> + </message> +</context> +<context> + <name>TopicChooser</name> + <message> + <source>Choose Topic</source> + <translation>Izberite temo</translation> + </message> + <message> + <source>&Topics</source> + <translation>&Teme</translation> + </message> + <message> + <source>&Display</source> + <translation>&Prikaži</translation> + </message> + <message> + <source>&Close</source> + <translation>&Zapri</translation> + </message> + <message> + <source>Choose a topic for <b>%1</b>:</source> + <translation>Izberite temo za <b>%1</b>:</translation> + </message> +</context> +</TS> diff --git a/translations/designer_sl.ts b/translations/designer_sl.ts index 8d2a161..d925f09 100644 --- a/translations/designer_sl.ts +++ b/translations/designer_sl.ts @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> <TS version="2.0" language="sl_SI"> - <extra-po-header-po_revision_date>2010-08-05 02:42+0200</extra-po-header-po_revision_date> + <extra-po-header-po_revision_date>2010-08-28 14:05+0200</extra-po-header-po_revision_date> <extra-po-headers>MIME-Version,Content-Type,Content-Transfer-Encoding,Plural-Forms,X-Language,X-Qt-Contexts,Last-Translator,PO-Revision-Date,Project-Id-Version,Language-Team,X-Generator</extra-po-headers> <extra-po-header-x_generator>Lokalize 1.1</extra-po-header-x_generator> <extra-po-header-language_team>Slovenian <lugos-slo@lugos.si></extra-po-header-language_team> @@ -720,7 +720,7 @@ </message> <message> <source>&Point Size</source> - <translation>&Velikost točke</translation> + <translation>&Velikost v točkah</translation> </message> <message> <source>Style</source> @@ -826,7 +826,7 @@ </message> <message> <source>&Point size</source> - <translation>&Velikost točke</translation> + <translation>&Velikost v točkah</translation> </message> </context> <context> @@ -2190,7 +2190,7 @@ Empty class name passed to widget factory method </message> <message> <source>Point Size</source> - <translation>Velikost točke</translation> + <translation>Velikost v točkah</translation> </message> <message> <source>Bold</source> diff --git a/translations/linguist_sl.ts b/translations/linguist_sl.ts new file mode 100644 index 0000000..0b5b084 --- /dev/null +++ b/translations/linguist_sl.ts @@ -0,0 +1,1596 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="sl"> + <extra-po-header-po_revision_date>2010-08-28 18:45+0200</extra-po-header-po_revision_date> + <extra-po-headers>MIME-Version,Content-Type,Content-Transfer-Encoding,Plural-Forms,X-Language,X-Qt-Contexts,Last-Translator,PO-Revision-Date,Project-Id-Version,Language-Team,X-Generator</extra-po-headers> + <extra-po-header-x_generator>Lokalize 1.1</extra-po-header-x_generator> + <extra-po-header-language_team>Slovenian <lugos-slo@lugos.si></extra-po-header-language_team> + <extra-po-header-project_id_version></extra-po-header-project_id_version> + <extra-po-header_comment># Jure Repinc <jlp@holodeck1.com>, 2010.</extra-po-header_comment> + <extra-po-header-last_translator>Jure Repinc <jlp@holodeck1.com></extra-po-header-last_translator> +<context> + <name>AboutDialog</name> + <message> + <source>Qt Linguist</source> + <translation>Qt Linguist</translation> + </message> +</context> +<context> + <name>BatchTranslationDialog</name> + <message> + <source>Qt Linguist - Batch Translation</source> + <translation>Qt Linguist – paketno prevajanje</translation> + </message> + <message> + <source>Options</source> + <translation>Možnosti</translation> + </message> + <message> + <source>Set translated entries to finished</source> + <translation>Označi prevedene vnose kot zaključene</translation> + </message> + <message> + <source>Retranslate entries with existing translation</source> + <translation>Znova prevedi vnose z obstoječimi prevodi</translation> + </message> + <message> + <source>Note that the modified entries will be reset to unfinished if 'Set translated entries to finished' above is unchecked</source> + <translation>Vedite, da bodo spremenjeni vnosi ponastavljeni na nezaključeno, če možnost »Označi prevedene vnose kot zaključene« ni omogočena.</translation> + </message> + <message> + <source>Translate also finished entries</source> + <translation>Prevedi tudi zaključene vnose</translation> + </message> + <message> + <source>Phrase book preference</source> + <translation>Prednostni seznam knjig z izrazi</translation> + </message> + <message> + <source>Move up</source> + <translation>Premakni gor</translation> + </message> + <message> + <source>Move down</source> + <translation>Premakni dol</translation> + </message> + <message> + <source>The batch translator will search through the selected phrase books in the order given above</source> + <translation>Paketni prevajalnik bo izbrane knjige z izrazi preiskal v zgoraj navedenem vrstnem redu</translation> + </message> + <message> + <source>&Run</source> + <translation>&Zaženi</translation> + </message> + <message> + <source>Cancel</source> + <translation>Prekliči</translation> + </message> + <message> + <source>Batch Translation of '%1' - Qt Linguist</source> + <translation>Paketno prevajanje »%1« – Qt Linguist</translation> + </message> + <message> + <source>Searching, please wait...</source> + <translation>Iskanje, prosimo počakajte ...</translation> + </message> + <message> + <source>&Cancel</source> + <translation>&Prekliči</translation> + </message> + <message> + <source>Linguist batch translator</source> + <translation>Paketni prevajalnik</translation> + </message> + <message numerus="yes"> + <source>Batch translated %n entries</source> + <translation> + <numerusform>Paketno preveden %n vnos</numerusform> + <numerusform>Paketno prevedena %n vnosa</numerusform> + <numerusform>Paketno prevedeni %n vnosi</numerusform> + <numerusform>Paketno prevedenih %n vnosov</numerusform> + </translation> + </message> +</context> +<context> + <name>DataModel</name> + <message> + <source><qt>Duplicate messages found in '%1':</source> + <translation><qt>V »%1« so bila najdena podvojena sporočila.</translation> + </message> + <message> + <source><p>[more duplicates omitted]</source> + <translation><p>[več izpuščenih podvojitev]</translation> + </message> + <message> + <source><p>* ID: %1</source> + <translation><p>* ID: %1</translation> + </message> + <message> + <source><p>* Context: %1<br>* Source: %2</source> + <translation><p>* Kontekst: %1<br>* Vir: %2</translation> + </message> + <message> + <source><br>* Comment: %3</source> + <translation><br>* Komentar: %3</translation> + </message> + <message> + <source>Linguist does not know the plural rules for '%1'. +Will assume a single universal form.</source> + <translation>Qt Linguist ne pozna pravil za množinske oblike za »%1«. +Privzeta bo edninska univerzalna oblika.</translation> + </message> + <message> + <source>Cannot create '%2': %1</source> + <translation>Ni moč ustvariti »%2«: %1</translation> + </message> + <message> + <source>Universal Form</source> + <translation>Univerzalna oblika</translation> + </message> +</context> +<context> + <name>ErrorsView</name> + <message> + <source>Accelerator possibly superfluous in translation.</source> + <translation>V prevodu je morda odvečen pospeševalnik.</translation> + </message> + <message> + <source>Accelerator possibly missing in translation.</source> + <translation>V prevodu morda manjka pospeševalnik.</translation> + </message> + <message> + <source>Translation does not end with the same punctuation as the source text.</source> + <translation>Prevod se ne zaključi z istim ločilom kot izvorno besedilo.</translation> + </message> + <message> + <source>A phrase book suggestion for '%1' was ignored.</source> + <translation>Predlog za »%1« is knjige izrazov je bil prezrt.</translation> + </message> + <message> + <source>Translation does not refer to the same place markers as in the source text.</source> + <translation>Prevod ne navaja enakih oznak vsebnikov kot izvorno besedilo.</translation> + </message> + <message> + <source>Translation does not contain the necessary %n place marker.</source> + <translation>Prevod ne vsebuje potrebne oznake %n za vsebnik.</translation> + </message> + <message> + <source>Unknown error</source> + <translation>Neznana napaka</translation> + </message> +</context> +<context> + <name>FindDialog</name> + <message> + <source>Find</source> + <translation>Najdi</translation> + </message> + <message> + <source>This window allows you to search for some text in the translation source file.</source> + <translation>To okno omogoča iskanje besedila v izvorni datoteki s prevodom.</translation> + </message> + <message> + <source>&Find what:</source> + <translation>&Najdi:</translation> + </message> + <message> + <source>Type in the text to search for.</source> + <translation>Vnesite iskano besedilo.</translation> + </message> + <message> + <source>Options</source> + <translation>Možnosti</translation> + </message> + <message> + <source>Source texts are searched when checked.</source> + <translation>Ko je omogočeno, se preišče izvorna besedila.</translation> + </message> + <message> + <source>&Source texts</source> + <translation>&Izvorna besedila</translation> + </message> + <message> + <source>Translations are searched when checked.</source> + <translation>Ko je omogočeno, se preišče prevode.</translation> + </message> + <message> + <source>&Translations</source> + <translation>&Prevodi</translation> + </message> + <message> + <source>Texts such as 'TeX' and 'tex' are considered as different when checked.</source> + <translation>Ko je omogočeno, se razlikuje med besedili kot sta »KDE« in »kde«.</translation> + </message> + <message> + <source>&Match case</source> + <translation>Ujemanje &velikosti črk</translation> + </message> + <message> + <source>Comments and contexts are searched when checked.</source> + <translation>Ko je omogočeno, se preišče kontekste in komentarje.</translation> + </message> + <message> + <source>&Comments</source> + <translation>&Komentarji</translation> + </message> + <message> + <source>Ignore &accelerators</source> + <translation>Prezri p&ospeševalnike</translation> + </message> + <message> + <source>Click here to find the next occurrence of the text you typed in.</source> + <translation>Kliknite, da poiščete naslednjo pojavitev vnešenega besedila.</translation> + </message> + <message> + <source>Find Next</source> + <translation>Najdi naslednje</translation> + </message> + <message> + <source>Click here to close this window.</source> + <translation>Kliknite, da zaprete to okno.</translation> + </message> + <message> + <source>Cancel</source> + <translation>Prekliči</translation> + </message> +</context> +<context> + <name>FormMultiWidget</name> + <message> + <source>Alt+Delete</source> + <extracomment>translate, but don't change +</extracomment> + <translation>Alt+Izbriši</translation> + </message> + <message> + <source>Shift+Alt+Insert</source> + <extracomment>translate, but don't change +</extracomment> + <translation>Shift+Alt+Vstavi</translation> + </message> + <message> + <source>Alt+Insert</source> + <extracomment>translate, but don't change +</extracomment> + <translation>Alt+Vstavi</translation> + </message> + <message> + <source>Confirmation - Qt Linguist</source> + <translation>Potrditev – Qt Linguist</translation> + </message> + <message> + <source>Delete non-empty length variant?</source> + <translation>Ali izbrišem ne-prazno dolžinsko inačico?</translation> + </message> +</context> +<context> + <name>LRelease</name> + <message numerus="yes"> + <source>Dropped %n message(s) which had no ID.</source> + <translation> + <numerusform>Opustil %n sporočilo, ki ni imelo ID-ja.</numerusform> + <numerusform>Opustil %n sporočili, ki nista imeli ID-ja.</numerusform> + <numerusform>Opustil %n sporočila, ki niso imela ID-ja.</numerusform> + <numerusform>Opustil %n sporočil, ki niso imeli ID-ja.</numerusform> + </translation> + </message> + <message numerus="yes"> + <source>Excess context/disambiguation dropped from %n message(s).</source> + <translation> + <numerusform>Odvečen kontekst/razločitev opuščen iz %n sporočila.</numerusform> + <numerusform>Odvečen kontekst/razločitev opuščen iz %n sporočil.</numerusform> + <numerusform>Odvečen kontekst/razločitev opuščen iz %n sporočil.</numerusform> + <numerusform>Odvečen kontekst/razločitev opuščen iz %n sporočil.</numerusform> + </translation> + </message> + <message numerus="yes"> + <source> Generated %n translation(s) (%1 finished and %2 unfinished)</source> + <translation> + <numerusform> Ustvaril %n prevod (%1 zaključenih in %2 nezaključenih)</numerusform> + <numerusform> Ustvaril %n prevoda (%1 zaključenih in %2 nezaključenih)</numerusform> + <numerusform> Ustvaril %n prevode (%1 zaključenih in %2 nezaključenih)</numerusform> + <numerusform> Ustvaril %n prevodov (%1 zaključenih in %2 nezaključenih)</numerusform> + </translation> + </message> + <message numerus="yes"> + <source> Ignored %n untranslated source text(s)</source> + <translation> + <numerusform> Prezrl %n neprevedeno izvorno besedilo</numerusform> + <numerusform> Prezrl %n neprevedeni izvorni besedili</numerusform> + <numerusform> Prezrl %n neprevedena izvorna besedila</numerusform> + <numerusform> Prezrl %n neprevedenih izvornih besedil</numerusform> + </translation> + </message> +</context> +<context> + <name>MainWindow</name> + <message> + <source>MainWindow</source> + <translation>GlavnoOkno</translation> + </message> + <message> + <source>&Phrases</source> + <translation>&Izrazi</translation> + </message> + <message> + <source>&Close Phrase Book</source> + <translation>&Zapri knjigo izrazov</translation> + </message> + <message> + <source>&Edit Phrase Book</source> + <translation>&Uredi knjigo izrazov</translation> + </message> + <message> + <source>&Print Phrase Book</source> + <translation>&Natisni knjigo izrazov</translation> + </message> + <message> + <source>V&alidation</source> + <translation>P&otrjevanje</translation> + </message> + <message> + <source>&View</source> + <translation>&Videz</translation> + </message> + <message> + <source>Vie&ws</source> + <translation>&Prikazi</translation> + </message> + <message> + <source>&Toolbars</source> + <translation>O&rodjarne</translation> + </message> + <message> + <source>&Help</source> + <translation>&Pomoč</translation> + </message> + <message> + <source>&Translation</source> + <translation>P&revajanje</translation> + </message> + <message> + <source>&File</source> + <translation>&Datoteka</translation> + </message> + <message> + <source>Recently Opened &Files</source> + <translation>Nedavno odprte &datoteke</translation> + </message> + <message> + <source>&Edit</source> + <translation>&Urejanje</translation> + </message> + <message> + <source>&Open...</source> + <translation>&Odpri ...</translation> + </message> + <message> + <source>Open a Qt translation source file (TS file) for editing</source> + <translation>Odpre izvorno datoteko s prevodi za Qt (*.ts) za urejanje</translation> + </message> + <message> + <source>Ctrl+O</source> + <translation>Ctrl+O</translation> + </message> + <message> + <source>E&xit</source> + <translation>Konča&j</translation> + </message> + <message> + <source>Close this window and exit.</source> + <translation>Zapre to okno in konča.</translation> + </message> + <message> + <source>Ctrl+Q</source> + <translation>Ctrl+Q</translation> + </message> + <message> + <source>Save</source> + <translation>Shrani</translation> + </message> + <message> + <source>Save changes made to this Qt translation source file</source> + <translation>Shrani spremembe te izvorne datoteke s prevodi za Qt</translation> + </message> + <message> + <source>Save &As...</source> + <translation>Shrani &kot ...</translation> + </message> + <message> + <source>Save As...</source> + <translation>Shrani kot ...</translation> + </message> + <message> + <source>Save changes made to this Qt translation source file into a new file.</source> + <translation>Shrani spremembe te izvorne datoteke s prevodi za Qt v novo datoteko.</translation> + </message> + <message> + <source>Release</source> + <translation>Izdaj</translation> + </message> + <message> + <source>Create a Qt message file suitable for released applications from the current message file.</source> + <translation>Iz trenutne datoteke s sporočili ustvari datoteko, ki je primerna za izdane programe.</translation> + </message> + <message> + <source>&Print...</source> + <translation>Na&tisni ...</translation> + </message> + <message> + <source>Print a list of all the translation units in the current translation source file.</source> + <translation>Natisne seznam vseh prevajalskih enot iz trenutne izvorne datoteke s prevodi.</translation> + </message> + <message> + <source>Ctrl+P</source> + <translation>Ctrl+P</translation> + </message> + <message> + <source>&Undo</source> + <translation>&Razveljavi</translation> + </message> + <message> + <source>Undo the last editing operation performed on the current translation.</source> + <translation>Razveljavi zadnje dejanje urejanja trenutnega prevoda.</translation> + </message> + <message> + <source>Ctrl+Z</source> + <translation>Ctrl+Z</translation> + </message> + <message> + <source>&Redo</source> + <translation>&Uveljavi</translation> + </message> + <message> + <source>Redo an undone editing operation performed on the translation.</source> + <translation>Uveljavi razveljavljeno dejanje urejanja prevoda.</translation> + </message> + <message> + <source>Ctrl+Y</source> + <translation>Ctrl+Y</translation> + </message> + <message> + <source>Cu&t</source> + <translation>&Izreži</translation> + </message> + <message> + <source>Copy the selected translation text to the clipboard and deletes it.</source> + <translation>Skopira izbrano besedilo prevoda na odložišče in ga izbriše.</translation> + </message> + <message> + <source>Ctrl+X</source> + <translation>Ctrl+X</translation> + </message> + <message> + <source>&Copy</source> + <translation>S&kopiraj</translation> + </message> + <message> + <source>Copy the selected translation text to the clipboard.</source> + <translation>Skopira izbrano besedilo prevoda na odložišče.</translation> + </message> + <message> + <source>Ctrl+C</source> + <translation>Ctrl+C</translation> + </message> + <message> + <source>&Paste</source> + <translation>Pri&lepi</translation> + </message> + <message> + <source>Paste the clipboard text into the translation.</source> + <translation>Prilepi besedilo z odložišča v prevod.</translation> + </message> + <message> + <source>Ctrl+V</source> + <translation>Ctrl+V</translation> + </message> + <message> + <source>Select &All</source> + <translation>Izberi &vse</translation> + </message> + <message> + <source>Select the whole translation text.</source> + <translation>Izbere celotno besedilo prevoda.</translation> + </message> + <message> + <source>Ctrl+A</source> + <translation>Ctrl+A</translation> + </message> + <message> + <source>&Find...</source> + <translation>&Najdi ...</translation> + </message> + <message> + <source>Search for some text in the translation source file.</source> + <translation>Poišče dano besedilo v izvorni datoteki s prevodi.</translation> + </message> + <message> + <source>Ctrl+F</source> + <translation>Ctrl+F</translation> + </message> + <message> + <source>Find &Next</source> + <translation>Najdi na&slednje</translation> + </message> + <message> + <source>Continue the search where it was left.</source> + <translation>Nadaljuje z iskanjem od zadnjega mesta.</translation> + </message> + <message> + <source>F3</source> + <translation>F3</translation> + </message> + <message> + <source>&Prev Unfinished</source> + <translation>&Predhodni nezaključen</translation> + </message> + <message> + <source>Previous unfinished item</source> + <translation>Predhodni nezaključen prevod</translation> + </message> + <message> + <source>Move to the previous unfinished item.</source> + <translation>Premakne se na predhodni nezaključen prevod.</translation> + </message> + <message> + <source>Ctrl+K</source> + <translation>Ctrl+K</translation> + </message> + <message> + <source>&Next Unfinished</source> + <translation>&Naslednji nezaključen</translation> + </message> + <message> + <source>Next unfinished item</source> + <translation>Naslednji nezaključen prevod</translation> + </message> + <message> + <source>Move to the next unfinished item.</source> + <translation>Premakne se na naslednji nezaključen prevod.</translation> + </message> + <message> + <source>Ctrl+J</source> + <translation>Ctrl+J</translation> + </message> + <message> + <source>P&rev</source> + <translation>&Predhodni</translation> + </message> + <message> + <source>Move to previous item</source> + <translation>Predhodni prevod</translation> + </message> + <message> + <source>Move to the previous item.</source> + <translation>Premakne se na predhodni prevod.</translation> + </message> + <message> + <source>Ctrl+Shift+K</source> + <translation>Ctrl+Shift+K</translation> + </message> + <message> + <source>Ne&xt</source> + <translation>N&aslednji</translation> + </message> + <message> + <source>Next item</source> + <translation>Naslednji prevod</translation> + </message> + <message> + <source>Move to the next item.</source> + <translation>Premakne se na naslednji prevod.</translation> + </message> + <message> + <source>Ctrl+Shift+J</source> + <translation>Ctrl+Shift+J</translation> + </message> + <message> + <source>&Done and Next</source> + <translation>&Zaključi in naslednji</translation> + </message> + <message> + <source>Mark item as done and move to the next unfinished item</source> + <translation>Označi prevod kot zaključen in na naslednji nezaključen</translation> + </message> + <message> + <source>Mark this item as done and move to the next unfinished item.</source> + <translation>Označi prevod kot zaključen in se premakni na naslednji nezaključen prevod.</translation> + </message> + <message> + <source>Copy from source text</source> + <translation>Skopiraj izvorno besedilo</translation> + </message> + <message> + <source>Copies the source text into the translation field</source> + <translation>Skopira izvorno besedilo v prevod</translation> + </message> + <message> + <source>Copies the source text into the translation field.</source> + <translation>Skopira izvorno besedilo v polje za vnos prevoda.</translation> + </message> + <message> + <source>Ctrl+B</source> + <translation>Ctrl+B</translation> + </message> + <message> + <source>&Accelerators</source> + <translation>&Pospeševalniki</translation> + </message> + <message> + <source>Toggle the validity check of accelerators</source> + <translation>Preklopi preverjanje pospeševalnikov</translation> + </message> + <message> + <source>Toggle the validity check of accelerators, i.e. whether the number of ampersands in the source and translation text is the same. If the check fails, a message is shown in the warnings window.</source> + <translation>Preklopi preverjanje pospeševalnikov, t.j. ali je število znakov »&&« v izvornem besedilu enako kot v prevodu. Če preizkus ne uspe, bo v podoknu z opozorili prikazano sporočilo.</translation> + </message> + <message> + <source>&Ending Punctuation</source> + <translation>&Končna ločila</translation> + </message> + <message> + <source>Toggle the validity check of ending punctuation</source> + <translation>Preklopi preverjanje končnih ločil</translation> + </message> + <message> + <source>Toggle the validity check of ending punctuation. If the check fails, a message is shown in the warnings window.</source> + <translation>Preklopi preverjanje končnih ločil. Če preizkus ne uspe, bo v podoknu z opozorili prikazano sporočilo.</translation> + </message> + <message> + <source>&Phrase matches</source> + <translation>&Ujemanje z izrazi</translation> + </message> + <message> + <source>Toggle checking that phrase suggestions are used</source> + <translation>Preklopi preverjanje uporabe predlogov izrazov</translation> + </message> + <message> + <source>Toggle checking that phrase suggestions are used. If the check fails, a message is shown in the warnings window.</source> + <translation>Preklopi preverjanje uporabe predlogov izrazov. Če preizkus ne uspe, bo v podoknu z opozorili prikazano sporočilo.</translation> + </message> + <message> + <source>Place &Marker Matches</source> + <translation>Ujemanje &oznak vsebnikov</translation> + </message> + <message> + <source>Toggle the validity check of place markers</source> + <translation>Preklopi preverjanje oznak vsebnikov</translation> + </message> + <message> + <source>Toggle the validity check of place markers, i.e. whether %1, %2, ... are used consistently in the source text and translation text. If the check fails, a message is shown in the warnings window.</source> + <translation>Preklopi preverjanje oznak vsebnikov, tj. ali so %1, %2, itd. v izvornem besedilu in prevodu konsistenčni. Če preizkus ne uspe, bo v podoknu z opozorili prikazano sporočilo.</translation> + </message> + <message> + <source>&New Phrase Book...</source> + <translation>&Nova knjiga z izrazi ...</translation> + </message> + <message> + <source>Create a new phrase book.</source> + <translation>Ustvari novo knjigo izrazov</translation> + </message> + <message> + <source>Ctrl+N</source> + <translation>Ctrl+N</translation> + </message> + <message> + <source>&Open Phrase Book...</source> + <translation>&Odpri knjigo izrazov ...</translation> + </message> + <message> + <source>Open a phrase book to assist translation.</source> + <translation>Odpre knjigo izrazov za pomoč pri prevajanju.</translation> + </message> + <message> + <source>Ctrl+H</source> + <translation>Ctrl+H</translation> + </message> + <message> + <source>&Reset Sorting</source> + <translation>&Ponastavi razvrščanje</translation> + </message> + <message> + <source>Sort the items back in the same order as in the message file.</source> + <translation>Prevajalske enote bodo razvrščene kot v datoteki s sporočili.</translation> + </message> + <message> + <source>&Display guesses</source> + <translation>Prikaži &ugibanja</translation> + </message> + <message> + <source>Set whether or not to display translation guesses.</source> + <translation>Ali naj bodo prikazana ugibanja prevodov.</translation> + </message> + <message> + <source>&Statistics</source> + <translation>&Statistika</translation> + </message> + <message> + <source>Display translation statistics.</source> + <translation>Prikaže statistiko prevodov.</translation> + </message> + <message> + <source>&Manual</source> + <translation>&Priročnik</translation> + </message> + <message> + <source>F1</source> + <translation>F1</translation> + </message> + <message> + <source>About Qt Linguist</source> + <translation>O Qt Linguist</translation> + </message> + <message> + <source>About Qt</source> + <translation>O Qt</translation> + </message> + <message> + <source>Display information about the Qt toolkit by Nokia.</source> + <translation>Prikaže podatke o ogrodju Qt.</translation> + </message> + <message> + <source>&What's This?</source> + <translation>&Kaj je to?</translation> + </message> + <message> + <source>What's This?</source> + <translation>Kaj je to?</translation> + </message> + <message> + <source>Enter What's This? mode.</source> + <translation>Vstop v način Kaj je to?</translation> + </message> + <message> + <source>Shift+F1</source> + <translation>Shift+F1</translation> + </message> + <message> + <source>&Search And Translate...</source> + <translation>&Najdi in prevedi ...</translation> + </message> + <message> + <source>Replace the translation on all entries that matches the search source text.</source> + <translation>Zamenja prevode vseh enot, kjer se izvorno besedilo ujema z iskanim.</translation> + </message> + <message> + <source>&Batch Translation...</source> + <translation>&Paketno prevajanje ...</translation> + </message> + <message> + <source>Batch translate all entries using the information in the phrase books.</source> + <translation>Paketno prevede vse enote in pri tem uporabi podatke iz knjig z izrazi.</translation> + </message> + <message> + <source>Release As...</source> + <translation>Izdaj kot ...</translation> + </message> + <message> + <source>Create a Qt message file suitable for released applications from the current message file. The filename will automatically be determined from the name of the TS file.</source> + <translation>Iz trenutne datoteke s sporočili ustvari datoteko, ki je primerna za izdane programe. Ime datoteke bo izbrano sampdejno glede na ime datoteke *.ts.</translation> + </message> + <message> + <source>File</source> + <translation>Datoteka</translation> + </message> + <message> + <source>Edit</source> + <translation>Urejanje</translation> + </message> + <message> + <source>Translation</source> + <translation>Prevajanje</translation> + </message> + <message> + <source>Validation</source> + <translation>Potrjevanje</translation> + </message> + <message> + <source>Help</source> + <translation>Pomoč</translation> + </message> + <message> + <source>Open/Refresh Form &Preview</source> + <translation>Odpri/osveži &ogled obrazca</translation> + </message> + <message> + <source>Form Preview Tool</source> + <translation>Orodje za ogled obrazca</translation> + </message> + <message> + <source>F5</source> + <translation>F5</translation> + </message> + <message> + <source>Translation File &Settings...</source> + <translation>&Nastavitve datoteke s prevodi ...</translation> + </message> + <message> + <source>&Add to Phrase Book</source> + <translation>&Dodaj v knjigo izrazov</translation> + </message> + <message> + <source>Ctrl+T</source> + <translation>Ctrl+T</translation> + </message> + <message> + <source>Open Read-O&nly...</source> + <translation>Odpri samo za &branje ...</translation> + </message> + <message> + <source>&Save All</source> + <translation>&Shrani vse</translation> + </message> + <message> + <source>Ctrl+S</source> + <translation>Ctrl+S</translation> + </message> + <message> + <source>&Release All</source> + <translation>&Izdaj vse</translation> + </message> + <message> + <source>Close</source> + <translation>Zapri</translation> + </message> + <message> + <source>&Close All</source> + <translation>&Zapri vse</translation> + </message> + <message> + <source>Ctrl+W</source> + <translation> Ctrl+W</translation> + </message> + <message> + <source>Length Variants</source> + <translation>Dolžinske inačice</translation> + </message> + <message> + <source>Source text</source> + <translation>Izvorno besedilo</translation> + </message> + <message> + <source>Index</source> + <translation>Kazalo</translation> + </message> + <message> + <source>Context</source> + <translation>Kontekst</translation> + </message> + <message> + <source>Items</source> + <translation>Postavke</translation> + </message> + <message> + <source>This panel lists the source contexts.</source> + <translation>To podokno prikazuje seznam kontekstov iz izvorne kode.</translation> + </message> + <message> + <source>Strings</source> + <translation>Nizi</translation> + </message> + <message> + <source>Phrases and guesses</source> + <translation>Izrazi in ugibanja</translation> + </message> + <message> + <source>Sources and Forms</source> + <translation>Izvorna koda in obrazci</translation> + </message> + <message> + <source>Warnings</source> + <translation>Opozorila</translation> + </message> + <message> + <source> MOD </source> + <comment>status bar: file(s) modified</comment> + <translation> SPR </translation> + </message> + <message> + <source>Loading...</source> + <translation>Nalaganje ...</translation> + </message> + <message> + <source>Loading File - Qt Linguist</source> + <translation>Nalaganje datoteke – Qt Linguist</translation> + </message> + <message> + <source>The file '%1' does not seem to be related to the currently open file(s) '%2'. + +Close the open file(s) first?</source> + <translation>Kot kaže datoteka »%1« ni povezana s trenutno odprtimi datotekami »%2«. + +Ali želite najprej zapreti odprte datoteke?</translation> + </message> + <message> + <source>The file '%1' does not seem to be related to the file '%2' which is being loaded as well. + +Skip loading the first named file?</source> + <translation>Kot kaže datoteka »%1« ni povezana z datoteko »%2«, ki se ravno tako nalaga. + +Ali želite preskočiti nalaganje prve datoteke?</translation> + </message> + <message numerus="yes"> + <source>%n translation unit(s) loaded.</source> + <translation> + <numerusform>Naložena %n prevajalska enota.</numerusform> + <numerusform>Naloženi %n prevajalski enoti.</numerusform> + <numerusform>Naložene %n prevajalske enote.</numerusform> + <numerusform>Naloženih %n prevajalskih enot.</numerusform> + </translation> + </message> + <message> + <source>Related files (%1);;</source> + <translation>Povezane datoteke (%1);;</translation> + </message> + <message> + <source>Open Translation Files</source> + <translation>Odpri datoteke za prevajanje</translation> + </message> + <message> + <source>File saved.</source> + <translation>Datoteka je shranjena.</translation> + </message> + <message> + <source>Qt message files for released applications (*.qm) +All files (*)</source> + <translation>Datoteke s sporočili za izdane programe (*.qm) +Vse datoteke (*)</translation> + </message> + <message> + <source>File created.</source> + <translation>Datoteka ustvarjena.</translation> + </message> + <message> + <source>Printing...</source> + <translation>Tiskanje ...</translation> + </message> + <message> + <source>Context: %1</source> + <translation>Kontekst: %1</translation> + </message> + <message> + <source>finished</source> + <translation>zaključen</translation> + </message> + <message> + <source>unresolved</source> + <translation>nerazrešen</translation> + </message> + <message> + <source>obsolete</source> + <translation>zastarel</translation> + </message> + <message> + <source>Printing... (page %1)</source> + <translation>Tiskanje (%1. stran) ...</translation> + </message> + <message> + <source>Printing completed</source> + <translation>Tiskanje zaključeno</translation> + </message> + <message> + <source>Printing aborted</source> + <translation>Tiskanje preklicano</translation> + </message> + <message> + <source>Search wrapped.</source> + <translation>Iskanje na drugem koncu</translation> + </message> + <message> + <source>Qt Linguist</source> + <translation>Qt Linguist</translation> + </message> + <message> + <source>Cannot find the string '%1'.</source> + <translation>Ni moč najti niza »%1«.</translation> + </message> + <message> + <source>Search And Translate in '%1' - Qt Linguist</source> + <translation>Najdi in prevedi v »%1« – Qt Linguist</translation> + </message> + <message> + <source>Translate - Qt Linguist</source> + <translation>Prevajanje – Qt Linguist</translation> + </message> + <message numerus="yes"> + <source>Translated %n entry(s)</source> + <translation> + <numerusform>Prevedel %n vnos</numerusform> + <numerusform>Prevedel %n vnosa</numerusform> + <numerusform>Prevedel %n vnose</numerusform> + <numerusform>Prevedel %n vnosov</numerusform> + </translation> + </message> + <message> + <source>No more occurrences of '%1'. Start over?</source> + <translation>Pojavitev »%1« ni več. Ali začnem znova?</translation> + </message> + <message> + <source>Create New Phrase Book</source> + <translation>Ustvari novo knjigo izrazov</translation> + </message> + <message> + <source>Qt phrase books (*.qph) +All files (*)</source> + <translation>Knjiga z izrazi za Qt (*.qph) +Vse datoteke (*)</translation> + </message> + <message> + <source>Phrase book created.</source> + <translation>Knjiga izrazov ustvarjena.</translation> + </message> + <message> + <source>Open Phrase Book</source> + <translation>Odpri knjigo izrazov</translation> + </message> + <message> + <source>Qt phrase books (*.qph);;All files (*)</source> + <translation>Knjiga z izrazi za Qt (*.qph);;Vse datoteke (*)</translation> + </message> + <message numerus="yes"> + <source>%n phrase(s) loaded.</source> + <translation> + <numerusform>Naložil %n izrazov.</numerusform> + <numerusform>Naložil %n izraz.</numerusform> + <numerusform>Naložil %n izraza.</numerusform> + <numerusform>Naložil %n izraze.</numerusform> + </translation> + </message> + <message> + <source>Add to phrase book</source> + <translation>Dodaj v knjigo izrazov</translation> + </message> + <message> + <source>No appropriate phrasebook found.</source> + <translation>Najdene ni bilo nobene ustrezne knjige izrazov.</translation> + </message> + <message> + <source>Adding entry to phrasebook %1</source> + <translation>Dodajam vnos v knjigo izrazov %1</translation> + </message> + <message> + <source>Select phrase book to add to</source> + <translation>Izberite knjigo izrazov za dodajanje vanjo</translation> + </message> + <message> + <source>Unable to launch Qt Assistant (%1)</source> + <translation>Ni moč zagnati Qt Assistanta (%1)</translation> + </message> + <message> + <source>Version %1</source> + <translation>Različica %1</translation> + </message> + <message> + <source><center><img src=":/images/splash.png"/></img><p>%1</p></center><p>Qt Linguist is a tool for adding translations to Qt applications.</p><p>Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).</source> + <translation><center><img src=":/images/splash.png"/></img><p>%1</p></center><p>Qt Linguist je orodje za dodajanje prevodov programom Qt..</p><p>Avtorske pravice © 2010 Nokia Corporation in/ali njene podružnice.</p><p>Prevedel: <a href="mailto:jlp@holodeck1.com">Jure Repinc</a>, <a href="http://www.lugos.si/">LUGOS</a></p></translation> + </message> + <message> + <source>Do you want to save the modified files?</source> + <translation>Ali želite shraniti spremenjene datoteke?</translation> + </message> + <message> + <source>Do you want to save '%1'?</source> + <translation>Ali želite shraniti »%1«?</translation> + </message> + <message> + <source>Qt Linguist[*]</source> + <translation>Qt Linguist[*]</translation> + </message> + <message> + <source>%1[*] - Qt Linguist</source> + <translation>%1[*] – Qt Linguist</translation> + </message> + <message> + <source>No untranslated translation units left.</source> + <translation>Preostale ni nobene neprevedene prevajalske enote.</translation> + </message> + <message> + <source>&Window</source> + <translation>&Okno</translation> + </message> + <message> + <source>Minimize</source> + <translation>Pomanjšaj</translation> + </message> + <message> + <source>Ctrl+M</source> + <translation>Ctrl+M</translation> + </message> + <message> + <source>Display the manual for %1.</source> + <translation>Prikaži priročnik za %1.</translation> + </message> + <message> + <source>Display information about %1.</source> + <translation>Prikaži podatke o %1.</translation> + </message> + <message> + <source>&Save '%1'</source> + <translation>&Shrani »%1«</translation> + </message> + <message> + <source>Save '%1' &As...</source> + <translation>Shrani »%1« &kot ...</translation> + </message> + <message> + <source>Release '%1'</source> + <translation>Izdaj »%1«</translation> + </message> + <message> + <source>Release '%1' As...</source> + <translation>Izdaj »%1« kot ...</translation> + </message> + <message> + <source>&Close '%1'</source> + <translation>&Zapri »%1«</translation> + </message> + <message> + <source>&Save</source> + <translation>&Shrani</translation> + </message> + <message> + <source>&Close</source> + <translation>&Zapri</translation> + </message> + <message> + <source>Save All</source> + <translation>Shrani vse</translation> + </message> + <message> + <source>Close All</source> + <translation>Zapri vse</translation> + </message> + <message> + <source>&Release</source> + <translation>&Izdaj</translation> + </message> + <message> + <source>Translation File &Settings for '%1'...</source> + <translation>&Nastavitve datoteke s prevodi za »%1« ...</translation> + </message> + <message> + <source>&Batch Translation of '%1'...</source> + <translation>&Paketno prevajanje »%1« ...</translation> + </message> + <message> + <source>Search And &Translate in '%1'...</source> + <translation>&Najdi in prevedi v »%1« ...</translation> + </message> + <message> + <source>Search And &Translate...</source> + <translation>&Najdi in prevedi ...</translation> + </message> + <message> + <source>Cannot read from phrase book '%1'.</source> + <translation>Ni moč brati iz knjige izrazov »%1«.</translation> + </message> + <message> + <source>Close this phrase book.</source> + <translation>Zapri to knjigo izrazov.</translation> + </message> + <message> + <source>Enables you to add, modify, or delete entries in this phrase book.</source> + <translation>Omogoča dodajanje, spreminjanje in brisanje vnosov v knjigi izrazov.</translation> + </message> + <message> + <source>Print the entries in this phrase book.</source> + <translation>Natisne vnose iz te knjige izrazov.</translation> + </message> + <message> + <source>Cannot create phrase book '%1'.</source> + <translation>Ni moč ustvariti knjige izrazov »%1«.</translation> + </message> + <message> + <source>Do you want to save phrase book '%1'?</source> + <translation>Ali želite shraniti knjigo izrazov »%1«?</translation> + </message> + <message> + <source>All</source> + <translation>Vse</translation> + </message> +</context> +<context> + <name>MessageEditor</name> + <message> + <source>Russian</source> + <translation>Ruščina</translation> + </message> + <message> + <source>German</source> + <translation>Nemščina</translation> + </message> + <message> + <source>Japanese</source> + <translation>Japonščina</translation> + </message> + <message> + <source>French</source> + <translation>Francoščina</translation> + </message> + <message> + <source>Polish</source> + <translation>Poljščina</translation> + </message> + <message> + <source>Chinese</source> + <translation>Kitajščina</translation> + </message> + <message> + <source>This whole panel allows you to view and edit the translation of some source text.</source> + <translation>To podokno vam omogoča ogled in urejanje prevoda izvornega besedila.</translation> + </message> + <message> + <source>Source text</source> + <translation>Izvorno besedilo</translation> + </message> + <message> + <source>This area shows the source text.</source> + <translation>To področje prikazuje izvorno besedilo.</translation> + </message> + <message> + <source>Source text (Plural)</source> + <translation>Izvorno besedilo (množina)</translation> + </message> + <message> + <source>This area shows the plural form of the source text.</source> + <translation>To področje prikazuje množinsko obliko izvornega besedila.</translation> + </message> + <message> + <source>Developer comments</source> + <translation>Komentarji razvijalcev</translation> + </message> + <message> + <source>This area shows a comment that may guide you, and the context in which the text occurs.</source> + <translation>To področje prikazuje komentar, ki vas lahko vodi, in kontekst v katerem se besedilo pojavi.</translation> + </message> + <message> + <source>Here you can enter comments for your own use. They have no effect on the translated applications.</source> + <translation>Sem lahko vnesete komentarje za lastne potrebe. Na prevedene programe ne vplivajo.</translation> + </message> + <message> + <source>%1 translation (%2)</source> + <translation>%1 prevod (%2)</translation> + </message> + <message> + <source>This is where you can enter or modify the translation of the above source text.</source> + <translation>Sem lahko vnesete ali pa tu spremenite prevod gornjega izvornega besedila.</translation> + </message> + <message> + <source>%1 translation</source> + <translation>%1 prevod</translation> + </message> + <message> + <source>%1 translator comments</source> + <translation>%1 prevajalski komentarji</translation> + </message> + <message> + <source>'%1' +Line: %2</source> + <translation>»%1« +Vrstica: %2</translation> + </message> +</context> +<context> + <name>MessageModel</name> + <message> + <source>Completion status for %1</source> + <translation>Stanje za %1</translation> + </message> + <message> + <source><file header></source> + <translation><glava datoteke></translation> + </message> + <message> + <source><context comment></source> + <translation><komentar konteksta></translation> + </message> + <message> + <source><unnamed context></source> + <translation><neimenovan kontekst></translation> + </message> +</context> +<context> + <name>PhraseBookBox</name> + <message> + <source>Edit Phrase Book</source> + <translation>Uredi knjigo izrazov</translation> + </message> + <message> + <source>This window allows you to add, modify, or delete entries in a phrase book.</source> + <translation>To okno omogoča dodajanje, spreminjanje in brisanje vnosov v knjigi izrazov.</translation> + </message> + <message> + <source>&Translation:</source> + <translation>&Prevod:</translation> + </message> + <message> + <source>This is the phrase in the target language corresponding to the source phrase.</source> + <translation>To je izraz v ciljnem jeziku, ki ustreza izvornemu izrazu.</translation> + </message> + <message> + <source>S&ource phrase:</source> + <translation>&Izvorni izraz:</translation> + </message> + <message> + <source>This is a definition for the source phrase.</source> + <translation>To je definicija za izvorni izraz.</translation> + </message> + <message> + <source>This is the phrase in the source language.</source> + <translation>To je izraz v izvornem jeziku.</translation> + </message> + <message> + <source>&Definition:</source> + <translation>&Definicija:</translation> + </message> + <message> + <source>Click here to add the phrase to the phrase book.</source> + <translation>Kliknite, da dodate izraz v knjigo izrazov.</translation> + </message> + <message> + <source>&New Entry</source> + <translation>&Nov vnos</translation> + </message> + <message> + <source>Click here to remove the entry from the phrase book.</source> + <translation>Kliknite, da odstranite vnos iz knjige izrazov.</translation> + </message> + <message> + <source>&Remove Entry</source> + <translation>&Odstrani vnos</translation> + </message> + <message> + <source>Settin&gs...</source> + <translation>&Nastavitve ...</translation> + </message> + <message> + <source>Click here to save the changes made.</source> + <translation>Kliknite za shranitev opravljenih sprememb.</translation> + </message> + <message> + <source>&Save</source> + <translation>&Shrani</translation> + </message> + <message> + <source>Click here to close this window.</source> + <translation>Kliknite, da zaprete to okno.</translation> + </message> + <message> + <source>Close</source> + <translation>Zapri</translation> + </message> + <message> + <source>(New Entry)</source> + <translation>(Nov vnos)</translation> + </message> + <message> + <source>%1[*] - Qt Linguist</source> + <translation>%1[*] – Qt Linguist</translation> + </message> + <message> + <source>Qt Linguist</source> + <translation>Qt Linguist</translation> + </message> + <message> + <source>Cannot save phrase book '%1'.</source> + <translation>Ni moč shraniti knjige izrazov »%1«.</translation> + </message> +</context> +<context> + <name>PhraseModel</name> + <message> + <source>Source phrase</source> + <translation>Izvorni izraz</translation> + </message> + <message> + <source>Translation</source> + <translation>Prevod</translation> + </message> + <message> + <source>Definition</source> + <translation>Definicija</translation> + </message> +</context> +<context> + <name>PhraseView</name> + <message> + <source>Insert</source> + <translation>Vstavi</translation> + </message> + <message> + <source>Edit</source> + <translation>Uredi</translation> + </message> + <message> + <source>Guess (%1)</source> + <translation>Ugibanje (%1)</translation> + </message> + <message> + <source>Guess</source> + <translation>Ugibanje</translation> + </message> +</context> +<context> + <name>QObject</name> + <message> + <source>Translation files (%1);;</source> + <translation>Prevajalske datoteke (%1);;</translation> + </message> + <message> + <source>All files (*)</source> + <translation>Vse datoteke (*)</translation> + </message> + <message> + <source>Qt Linguist</source> + <translation>Qt Linguist</translation> + </message> + <message> + <source>GNU Gettext localization files</source> + <translation>Prevajalske datoteke GNU Gettext</translation> + </message> + <message> + <source>GNU Gettext localization template files</source> + <translation>Predloge prevajalskih datotek GNU Gettext</translation> + </message> + <message> + <source>Compiled Qt translations</source> + <translation>Prevedeni prevodi za Qt</translation> + </message> + <message> + <source>Qt Linguist 'Phrase Book'</source> + <translation>Knjiga izrazov za Qt Linguist</translation> + </message> + <message> + <source>Qt translation sources (format 1.1)</source> + <translation>Prevajalski viri za Qt (različica 1.1)</translation> + </message> + <message> + <source>Qt translation sources (format 2.0)</source> + <translation>Prevajalski viri za Qt (različica 2.0)</translation> + </message> + <message> + <source>Qt translation sources (latest format)</source> + <translation>Prevajalski viri za Qt (najnovejša različica)</translation> + </message> + <message> + <source>XLIFF localization files</source> + <translation>Prevajalske datoteke XLIFF</translation> + </message> +</context> +<context> + <name>SourceCodeView</name> + <message> + <source><i>Source code not available</i></source> + <translation><i>Izvorna koda ni na voljo</i></translation> + </message> + <message> + <source><i>File %1 not available</i></source> + <translation><i>Datoteka %1 ni na voljo</i></translation> + </message> + <message> + <source><i>File %1 not readable</i></source> + <translation><i>Datoteka %1 ni berljiva</i></translation> + </message> +</context> +<context> + <name>Statistics</name> + <message> + <source>Statistics</source> + <translation>Statistika</translation> + </message> + <message> + <source>Close</source> + <translation>Zapri</translation> + </message> + <message> + <source>Translation</source> + <translation>Prevod</translation> + </message> + <message> + <source>Source</source> + <translation>Vir</translation> + </message> + <message> + <source>0</source> + <translation>0</translation> + </message> + <message> + <source>Words:</source> + <translation>Besede:</translation> + </message> + <message> + <source>Characters:</source> + <translation>Znaki:</translation> + </message> + <message> + <source>Characters (with spaces):</source> + <translation>Znaki (s presledki):</translation> + </message> +</context> +<context> + <name>TranslateDialog</name> + <message> + <source>This window allows you to search for some text in the translation source file.</source> + <translation>To okno omogoča iskanje besedila v izvorni datoteki s prevodom.</translation> + </message> + <message> + <source>Type in the text to search for.</source> + <translation>Vnesite iskano besedilo.</translation> + </message> + <message> + <source>Find &source text:</source> + <translation>Najdi &izvorno besedilo:</translation> + </message> + <message> + <source>&Translate to:</source> + <translation>&Prevedi v:</translation> + </message> + <message> + <source>Search options</source> + <translation>Možnosti iskanja</translation> + </message> + <message> + <source>Texts such as 'TeX' and 'tex' are considered as different when checked.</source> + <translation>Ko je omogočeno, se razlikuje med besedili kot sta »KDE« in »kde«.</translation> + </message> + <message> + <source>Match &case</source> + <translation>Ujemanje &velikosti črk</translation> + </message> + <message> + <source>Mark new translation as &finished</source> + <translation>Nove prevode označi kot &zaključene</translation> + </message> + <message> + <source>Click here to find the next occurrence of the text you typed in.</source> + <translation>Kliknite, da poiščete naslednjo pojavitev vnešenega besedila.</translation> + </message> + <message> + <source>Find Next</source> + <translation>Najdi naslednje</translation> + </message> + <message> + <source>Translate</source> + <translation>Prevedi</translation> + </message> + <message> + <source>Translate All</source> + <translation>Prevedi vse</translation> + </message> + <message> + <source>Click here to close this window.</source> + <translation>Kliknite, da zaprete to okno.</translation> + </message> + <message> + <source>Cancel</source> + <translation>Prekliči</translation> + </message> +</context> +<context> + <name>TranslationSettingsDialog</name> + <message> + <source>Source language</source> + <translation>Izvorni jezik</translation> + </message> + <message> + <source>Language</source> + <translation>Jezik</translation> + </message> + <message> + <source>Country/Region</source> + <translation>Država/regija:</translation> + </message> + <message> + <source>Target language</source> + <translation>Ciljni jezik</translation> + </message> + <message> + <source>Settings for '%1' - Qt Linguist</source> + <translation>Nastavitve za »%1« – Qt Linguist</translation> + </message> + <message> + <source>Any Country</source> + <translation>Katerakoli država</translation> + </message> +</context> +</TS> diff --git a/translations/qt_help_sl.ts b/translations/qt_help_sl.ts new file mode 100644 index 0000000..7d76e58 --- /dev/null +++ b/translations/qt_help_sl.ts @@ -0,0 +1,329 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="sl"> + <extra-po-header-po_revision_date>2010-08-28 13:32+0200</extra-po-header-po_revision_date> + <extra-po-headers>MIME-Version,Content-Type,Content-Transfer-Encoding,Plural-Forms,X-Language,X-Qt-Contexts,Last-Translator,PO-Revision-Date,Project-Id-Version,Language-Team,X-Generator</extra-po-headers> + <extra-po-header-x_generator>Lokalize 1.1</extra-po-header-x_generator> + <extra-po-header-language_team>Slovenian <lugos-slo@lugos.si></extra-po-header-language_team> + <extra-po-header-project_id_version></extra-po-header-project_id_version> + <extra-po-header_comment># Jure Repinc <jlp@holodeck1.com>, 2010.</extra-po-header_comment> + <extra-po-header-last_translator>Jure Repinc <jlp@holodeck1.com></extra-po-header-last_translator> +<context> + <name>QCLuceneResultWidget</name> + <message> + <source>Search Results</source> + <translation>Rezultati iskanja</translation> + </message> + <message> + <source>Note:</source> + <translation>Opomba:</translation> + </message> + <message> + <source>The search results may not be complete since the documentation is still being indexed!</source> + <translation>Rezultati iskanja morda niso popolni, saj se dokumentacijo še vedno indeksira.</translation> + </message> + <message> + <source>Your search did not match any documents.</source> + <translation>Vašemu iskanju ne ustreza noben dokument.</translation> + </message> + <message> + <source>(The reason for this might be that the documentation is still being indexed.)</source> + <translation>(Razlog je morda to, da se dokumentacijo še vedno indeksira.)</translation> + </message> +</context> +<context> + <name>QHelp</name> + <message> + <source>Untitled</source> + <translation>Brez naslova</translation> + </message> +</context> +<context> + <name>QHelpCollectionHandler</name> + <message> + <source>The collection file '%1' is not set up yet!</source> + <translation>Datoteka zbirke »%1« še ni nastavljena.</translation> + </message> + <message> + <source>Cannot load sqlite database driver!</source> + <translation>Ni moč naložiti gonilnika za podatkovno zbirko SQLite.</translation> + </message> + <message> + <source>Cannot open collection file: %1</source> + <translation>Datoteke zbirke ni moč odpreti: %1</translation> + </message> + <message> + <source>Cannot create tables in file %1!</source> + <translation>V datoteki %1 ni moč ustvariti tabel.</translation> + </message> + <message> + <source>The collection file '%1' already exists!</source> + <translation>Datoteka zbirke »%1« že obstaja.</translation> + </message> + <message> + <source>Cannot create directory: %1</source> + <translation>Ni moč ustvariti mape: %1</translation> + </message> + <message> + <source>Cannot copy collection file: %1</source> + <translation>Ni moč skopirati datoteke zbirke: %1</translation> + </message> + <message> + <source>Unknown filter '%1'!</source> + <translation>Neznan filter »%1«.</translation> + </message> + <message> + <source>Cannot register filter %1!</source> + <translation>Filtra %1 ni moč registrirati.</translation> + </message> + <message> + <source>Cannot open documentation file %1!</source> + <translation>Ni moč odpreti datoteke z dokumentacijo %1.</translation> + </message> + <message> + <source>Invalid documentation file '%1'!</source> + <translation>Neveljavna datoteka z dokumentacijo »%1«.</translation> + </message> + <message> + <source>The namespace %1 was not registered!</source> + <translation>Imenski prostor %1 ni bil registriran.</translation> + </message> + <message> + <source>Namespace %1 already exists!</source> + <translation>Imenski prostor %1 že obstaja.</translation> + </message> + <message> + <source>Cannot register namespace '%1'!</source> + <translation>Imenskega prostora »%1« ni moč registrirati.</translation> + </message> + <message> + <source>Cannot open database '%1' to optimize!</source> + <translation>Podatkovne zbirke »%1« ni moč odpreti za optimizacijo.</translation> + </message> +</context> +<context> + <name>QHelpDBReader</name> + <message> + <source>Cannot open database '%1' '%2': %3</source> + <extracomment>The placeholders are: %1 - The name of the database which cannot be opened %2 - The unique id for the connection %3 - The actual error string +</extracomment> + <translation>Podatkovne zbirke »%1« »%2« ni moč odpreti: %3</translation> + </message> +</context> +<context> + <name>QHelpEngineCore</name> + <message> + <source>Cannot open documentation file %1: %2!</source> + <translation>Ni moč odpreti datoteke z dokumentacijo %1: %2.</translation> + </message> + <message> + <source>The specified namespace does not exist!</source> + <translation>Navedeni imenski prostor ne obstaja.</translation> + </message> +</context> +<context> + <name>QHelpGenerator</name> + <message> + <source>Invalid help data!</source> + <translation>Neveljavni podatki s pomočjo.</translation> + </message> + <message> + <source>No output file name specified!</source> + <translation>Navedenega ni nobenega imena izhodne datoteke.</translation> + </message> + <message> + <source>The file %1 cannot be overwritten!</source> + <translation>Datoteke %1 ni moč nadomestiti.</translation> + </message> + <message> + <source>Building up file structure...</source> + <translation>Grajenje datotečne strukture ...</translation> + </message> + <message> + <source>Cannot open data base file %1!</source> + <translation>Datoteke podatkovne zbirke %1 ni moč odpreti.</translation> + </message> + <message> + <source>Cannot register namespace %1!</source> + <translation>Imenskega prostora %1 ni moč registrirati.</translation> + </message> + <message> + <source>Insert custom filters...</source> + <translation>Vstavi filtre po meri ...</translation> + </message> + <message> + <source>Insert help data for filter section (%1 of %2)...</source> + <translation>Vstavljanje podatkov s pomočjo za filtrirni razdelek (%1 od %2) ...</translation> + </message> + <message> + <source>Documentation successfully generated.</source> + <translation>Dokumentacija je bila uspešno ustvarjena.</translation> + </message> + <message> + <source>Some tables already exist!</source> + <translation>Nekatere tabele že obstajajo.</translation> + </message> + <message> + <source>Cannot create tables!</source> + <translation>Tabel ni moč ustvariti.</translation> + </message> + <message> + <source>Cannot register virtual folder!</source> + <translation>Navidezne mape ni moč registrirati.</translation> + </message> + <message> + <source>Insert files...</source> + <translation>Vstavi datoteke ...</translation> + </message> + <message> + <source>The referenced file %1 must be inside or within a subdirectory of (%2). Skipping it.</source> + <translation>Sklicana datoteka %1 se mora nahajti v mapi (%1) ali njeni podmapi. Preskakujem jo.</translation> + </message> + <message> + <source>The file %1 does not exist! Skipping it.</source> + <translation>Datoteka %1 ne obstaja. Preskakujem jo.</translation> + </message> + <message> + <source>Cannot open file %1! Skipping it.</source> + <translation>Datoteke %1 ni moč odpreti. Preskakujem jo.</translation> + </message> + <message> + <source>The filter %1 is already registered!</source> + <translation>Filter %1 je že registriran.</translation> + </message> + <message> + <source>Cannot register filter %1!</source> + <translation>Filtra %1 ni moč registrirati.</translation> + </message> + <message> + <source>Insert indices...</source> + <translation>Vstavi kazala ...</translation> + </message> + <message> + <source>Insert contents...</source> + <translation>Vstavi vsebino ...</translation> + </message> + <message> + <source>Cannot insert contents!</source> + <translation>Vsebine ni moč vstaviti.</translation> + </message> + <message> + <source>Cannot register contents!</source> + <translation>Vsebine ni moč registrirati.</translation> + </message> + <message> + <source>File '%1' does not exist.</source> + <translation>Filter »%1« ne obstaja.</translation> + </message> + <message> + <source>File '%1' cannot be opened.</source> + <translation>Filtra »%1« ni moč odpreti.</translation> + </message> + <message> + <source>File '%1' contains an invalid link to file '%2'</source> + <translation>Datoteka »%1« vsebuje neveljavno povezavo na datoteko »%2«</translation> + </message> + <message> + <source>Invalid links in HTML files.</source> + <translation>Neveljavne povezave v datotekah HTML.</translation> + </message> +</context> +<context> + <name>QHelpProject</name> + <message> + <source>Unknown token.</source> + <translation>Neznan žeton.</translation> + </message> + <message> + <source>Unknown token. Expected "QtHelpProject"!</source> + <translation>Neznan žeton. Pričakovan je bil »QtHelpProject«.</translation> + </message> + <message> + <source>Error in line %1: %2</source> + <translation>Napaka v vrstici %1: %2</translation> + </message> + <message> + <source>Virtual folder has invalid syntax.</source> + <translation>Navidezna mapa ima neveljavno skladnjo.</translation> + </message> + <message> + <source>Namespace has invalid syntax.</source> + <translation>Imenski prostor ima neveljavno skladnjo.</translation> + </message> + <message> + <source>Missing namespace in QtHelpProject.</source> + <translation>Manjkajoč imenski prostor v QtHelpProject.</translation> + </message> + <message> + <source>Missing virtual folder in QtHelpProject</source> + <translation>Manjkajoča navidezna mapa v QtHelpProject.</translation> + </message> + <message> + <source>Missing attribute in keyword at line %1.</source> + <translation>Manjkajoča lastnost v ključni besedi v vrstici %1.</translation> + </message> + <message> + <source>The input file %1 could not be opened!</source> + <translation>Vhodne datoteke %1 ni bilo moč odpreti.</translation> + </message> +</context> +<context> + <name>QHelpSearchQueryWidget</name> + <message> + <source>Search for:</source> + <translation>Išči:</translation> + </message> + <message> + <source>Previous search</source> + <translation>Predhodno iskanje</translation> + </message> + <message> + <source>Next search</source> + <translation>Naslednje iskanje</translation> + </message> + <message> + <source>Search</source> + <translation>Išči</translation> + </message> + <message> + <source>Advanced search</source> + <translation>Napredno iskanje</translation> + </message> + <message> + <source>words <B>similar</B> to:</source> + <translation>besede <B>podobne</B>:</translation> + </message> + <message> + <source><B>without</B> the words:</source> + <translation><B>brez</B> besed:</translation> + </message> + <message> + <source>with <B>exact phrase</B>:</source> + <translation>s <B>točnim izrazom</B>:</translation> + </message> + <message> + <source>with <B>all</B> of the words:</source> + <translation>z <B>vsemi</B> besedami:</translation> + </message> + <message> + <source>with <B>at least one</B> of the words:</source> + <translation>z <B>vsaj eno</B> izmed besed:</translation> + </message> +</context> +<context> + <name>QHelpSearchResultWidget</name> + <message numerus="yes"> + <source>%1 - %2 of %n Hits</source> + <translation> + <numerusform>%1 – %2 od %n zadetka</numerusform> + <numerusform>%1 – %2 od %n zadetkov</numerusform> + <numerusform>%1 – %2 od %n zadetkov</numerusform> + <numerusform>%1 – %2 od %n zadetkov</numerusform> + </translation> + </message> + <message> + <source>0 - 0 of 0 Hits</source> + <translation>0 - 0 od 0 zadetkov</translation> + </message> +</context> +</TS> diff --git a/translations/qt_sl.ts b/translations/qt_sl.ts index e0cee0f..6bc552b 100644 --- a/translations/qt_sl.ts +++ b/translations/qt_sl.ts @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> <TS version="2.0" language="sl"> - <extra-po-header-po_revision_date>2010-08-05 12:59+0200</extra-po-header-po_revision_date> + <extra-po-header-po_revision_date>2010-08-29 00:26+0200</extra-po-header-po_revision_date> <extra-po-headers>MIME-Version,Content-Type,Content-Transfer-Encoding,Plural-Forms,X-Language,X-Qt-Contexts,Last-Translator,PO-Revision-Date,Project-Id-Version,Language-Team,X-Generator</extra-po-headers> <extra-po-header-x_generator>Lokalize 1.1</extra-po-header-x_generator> <extra-po-header-language_team>Slovenian <lugos-slo@lugos.si></extra-po-header-language_team> @@ -1328,194 +1328,194 @@ v <name>QDeclarativeAnchors</name> <message> <source>Possible anchor loop detected on fill.</source> - <translation type="unfinished">Ob zapolnjevanju je bila zaznana možna zanka sidra.</translation> + <translation>Ob zapolnjevanju je bila zaznana možna zanka sidra.</translation> </message> <message> <source>Possible anchor loop detected on centerIn.</source> - <translation type="unfinished">Ob usrediščanju je bila zaznana možna zanka sidra.</translation> + <translation>Ob usrediščanju je bila zaznana možna zanka sidra.</translation> </message> <message> <source>Cannot anchor to an item that isn't a parent or sibling.</source> - <translation type="unfinished">Na objekt, ki ni nadrejen ali enakovreden, se ni moč zasidrati.</translation> + <translation>Na objekt, ki ni nadrejen ali enakovreden, se ni moč zasidrati.</translation> </message> <message> <source>Possible anchor loop detected on vertical anchor.</source> - <translation type="unfinished">Ob navpičnem sidru je bila zaznana možna zanka sidra.</translation> + <translation>Ob navpičnem sidru je bila zaznana možna zanka sidra.</translation> </message> <message> <source>Possible anchor loop detected on horizontal anchor.</source> - <translation type="unfinished">Ob vodoravnem sidru je bila zaznana možna zanka sidra.</translation> + <translation>Ob vodoravnem sidru je bila zaznana možna zanka sidra.</translation> </message> <message> <source>Cannot specify left, right, and hcenter anchors.</source> - <translation type="unfinished">Levih, desnih in vodoravno sredinskih sider ni moč določiti.</translation> + <translation>Levih, desnih in vodoravno sredinskih sider ni moč določiti.</translation> </message> <message> <source>Cannot anchor to a null item.</source> - <translation type="unfinished">Na ničelni objekt se ni moč zasidrati.</translation> + <translation>Na neobstoječ objekt se ni moč zasidrati.</translation> </message> <message> <source>Cannot anchor a horizontal edge to a vertical edge.</source> - <translation type="unfinished">Vodoravnega roba ni moč zasidrati na navpični rob.</translation> + <translation>Vodoravnega roba ni moč zasidrati na navpični rob.</translation> </message> <message> <source>Cannot anchor item to self.</source> - <translation type="unfinished">Objekta ni moč zasidrati samega nase.</translation> + <translation>Objekta ni moč zasidrati samega nase.</translation> </message> <message> <source>Cannot specify top, bottom, and vcenter anchors.</source> - <translation type="unfinished">Vrhnjih, spodnjih in navpično sredinskih sider ni moč določiti.</translation> + <translation>Vrhnjih, spodnjih in navpično sredinskih sider ni moč določiti.</translation> </message> <message> <source>Baseline anchor cannot be used in conjunction with top, bottom, or vcenter anchors.</source> - <translation type="unfinished">Sidra na osnovnici ni moč uporabiti skupaj z vrhnjimi, spodnjimi ali navpično sredinskimi sidri.</translation> + <translation>Sidra na osnovnici ni moč uporabiti skupaj z vrhnjimi, spodnjimi ali navpično sredinskimi sidri.</translation> </message> <message> <source>Cannot anchor a vertical edge to a horizontal edge.</source> - <translation type="unfinished">Navpičnega roba ni moč zasidrati na vodoravni rob.</translation> + <translation>Navpičnega roba ni moč zasidrati na vodoravni rob.</translation> </message> </context> <context> <name>QDeclarativeAnimatedImage</name> <message> <source>Qt was built without support for QMovie</source> - <translation type="unfinished">Qt je bil zgrajen brez podpore za QMovie</translation> + <translation>Qt je bil zgrajen brez podpore za QMovie</translation> </message> </context> <context> <name>QDeclarativeBehavior</name> <message> <source>Cannot change the animation assigned to a Behavior.</source> - <translation type="unfinished">Animacije, ki je prirejena obnašanju, ni moč spremeniti.</translation> + <translation>Animacije, ki je prirejena obnašanju, ni moč spremeniti.</translation> </message> </context> <context> <name>QDeclarativeBinding</name> <message> <source>Binding loop detected for property "%1"</source> - <translation type="unfinished">Za lastnost »%1« je bila zaznana zanka vezave</translation> + <translation>Za lastnost »%1« je bila zaznana zanka vezave</translation> </message> </context> <context> <name>QDeclarativeCompiledBindings</name> <message> <source>Binding loop detected for property "%1"</source> - <translation type="unfinished">Za lastnost »%1« je bila zaznana zanka vezave</translation> + <translation>Za lastnost »%1« je bila zaznana zanka vezave</translation> </message> </context> <context> <name>QDeclarativeCompiler</name> <message> <source>Invalid property assignment: "%1" is a read-only property</source> - <translation type="unfinished">Neveljavna prireditev lastnosti: »%1« je lastnost, ki je samo za branje</translation> + <translation>Neveljavna prireditev lastnosti: »%1« je lastnost, ki je samo za branje</translation> </message> <message> <source>Invalid property assignment: unknown enumeration</source> - <translation type="unfinished">Neveljavna prireditev lastnosti: neznano oštevilčenje</translation> + <translation>Neveljavna prireditev lastnosti: neznano oštevilčenje</translation> </message> <message> <source>Invalid property assignment: string expected</source> - <translation type="unfinished">Neveljavna prireditev lastnosti: pričakovan je niz</translation> + <translation>Neveljavna prireditev lastnosti: pričakovan je niz</translation> </message> <message> <source>Invalid property assignment: url expected</source> - <translation type="unfinished">Neveljavna prireditev lastnosti: pričakovan je URL</translation> + <translation>Neveljavna prireditev lastnosti: pričakovan je URL</translation> </message> <message> <source>Invalid property assignment: unsigned int expected</source> - <translation type="unfinished">Neveljavna prireditev lastnosti: pričakovano je nepredznačeno celo število</translation> + <translation>Neveljavna prireditev lastnosti: pričakovano je nepredznačeno celo število</translation> </message> <message> <source>Invalid property assignment: int expected</source> - <translation type="unfinished">Neveljavna prireditev lastnosti: pričakovano je celo število</translation> + <translation>Neveljavna prireditev lastnosti: pričakovano je celo število</translation> </message> <message> <source>Invalid property assignment: number expected</source> - <translation type="unfinished">Neveljavna prireditev lastnosti: pričakovano je število</translation> + <translation>Neveljavna prireditev lastnosti: pričakovano je število</translation> </message> <message> <source>Invalid property assignment: color expected</source> - <translation type="unfinished">Neveljavna prireditev lastnosti: pričakovana je barva</translation> + <translation>Neveljavna prireditev lastnosti: pričakovana je barva</translation> </message> <message> <source>Invalid property assignment: date expected</source> - <translation type="unfinished">Neveljavna prireditev lastnosti: pričakovan je datum</translation> + <translation>Neveljavna prireditev lastnosti: pričakovan je datum</translation> </message> <message> <source>Invalid property assignment: time expected</source> - <translation type="unfinished">Neveljavna prireditev lastnosti: pričakovan je čas</translation> + <translation>Neveljavna prireditev lastnosti: pričakovan je čas</translation> </message> <message> <source>Invalid property assignment: datetime expected</source> - <translation type="unfinished">Neveljavna prireditev lastnosti: pričakovana sta datum in čas</translation> + <translation>Neveljavna prireditev lastnosti: pričakovana sta datum in čas</translation> </message> <message> <source>Invalid property assignment: point expected</source> - <translation type="unfinished">Neveljavna prireditev lastnosti: pričakovana je točka</translation> + <translation>Neveljavna prireditev lastnosti: pričakovana je točka</translation> </message> <message> <source>Invalid property assignment: size expected</source> - <translation type="unfinished">Neveljavna prireditev lastnosti: pričakovana je velikost</translation> + <translation>Neveljavna prireditev lastnosti: pričakovana je velikost</translation> </message> <message> <source>Invalid property assignment: rect expected</source> - <translation type="unfinished">Neveljavna prireditev lastnosti: pričakovan je pravokotnik</translation> + <translation>Neveljavna prireditev lastnosti: pričakovan je pravokotnik</translation> </message> <message> <source>Invalid property assignment: boolean expected</source> - <translation type="unfinished">Neveljavna prireditev lastnosti: pričakovana je logična vrednost</translation> + <translation>Neveljavna prireditev lastnosti: pričakovana je logična vrednost</translation> </message> <message> <source>Invalid property assignment: 3D vector expected</source> - <translation type="unfinished">Neveljavna prireditev lastnosti: pričakovan je 3D vektor</translation> + <translation>Neveljavna prireditev lastnosti: pričakovan je 3D vektor</translation> </message> <message> <source>Invalid property assignment: unsupported type "%1"</source> - <translation type="unfinished">Neveljavna prireditev lastnosti: nepodprta vrsta »%1«</translation> + <translation>Neveljavna prireditev lastnosti: nepodprta vrsta »%1«</translation> </message> <message> <source>Element is not creatable.</source> - <translation type="unfinished">Elementa ni moč ustvariti.</translation> + <translation>Elementa ni moč ustvariti.</translation> </message> <message> <source>Component elements may not contain properties other than id</source> - <translation type="unfinished">Elementi komponent ne smejo vsebovati drugih lastnosti kot ID</translation> + <translation>Elementi komponent ne smejo vsebovati drugih lastnosti kot ID</translation> </message> <message> <source>Invalid component id specification</source> - <translation type="unfinished">Neveljavno določen ID komponente</translation> + <translation>Neveljavno določen ID komponente</translation> </message> <message> <source>id is not unique</source> - <translation type="unfinished">ID ni edinstven</translation> + <translation>ID ni edinstven</translation> </message> <message> <source>Invalid component body specification</source> - <translation type="unfinished">Neveljavno določeno telo komponente</translation> + <translation>Neveljavno določeno telo komponente</translation> </message> <message> <source>Component objects cannot declare new properties.</source> - <translation type="unfinished">Objekti komponent ne morejo deklarirati novih lastnosti.</translation> + <translation>Objekti komponent ne morejo deklarirati novih lastnosti.</translation> </message> <message> <source>Component objects cannot declare new signals.</source> - <translation type="unfinished">Objekti komponent ne morejo deklarirati novih signalov.</translation> + <translation>Objekti komponent ne morejo deklarirati novih signalov.</translation> </message> <message> <source>Component objects cannot declare new functions.</source> - <translation type="unfinished">Objekti komponent ne morejo deklarirati novih funkcij.</translation> + <translation>Objekti komponent ne morejo deklarirati novih funkcij.</translation> </message> <message> <source>Cannot create empty component specification</source> - <translation type="unfinished">Prazne specifikacije komponente ni moč ustvariti</translation> + <translation>Prazne specifikacije komponente ni moč ustvariti</translation> </message> <message> <source>Incorrectly specified signal assignment</source> - <translation type="unfinished">Napačno določena prireditev signalu</translation> + <translation>Napačno določena prireditev signalu</translation> </message> <message> <source>Cannot assign a value to a signal (expecting a script to be run)</source> - <translation type="unfinished">Signalu ni moč prirediti vrednosti (pričakovan je skript, ki bo zagnan)</translation> + <translation>Signalu ni moč prirediti vrednosti (pričakovan je skript, ki bo zagnan)</translation> </message> <message> <source>Empty signal assignment</source> @@ -1527,247 +1527,247 @@ v </message> <message> <source>Attached properties cannot be used here</source> - <translation type="unfinished">Pripete lastnosti tu ne morejo biti uporabljene</translation> + <translation>Pripete lastnosti tu ne morejo biti uporabljene</translation> </message> <message> <source>Non-existent attached object</source> - <translation type="unfinished">Neobstoječ pripet objekt</translation> + <translation>Neobstoječ pripet objekt</translation> </message> <message> <source>Invalid attached object assignment</source> - <translation type="unfinished">Neveljavna prireditev pripetega objekta</translation> + <translation>Neveljavna prireditev pripetega objekta</translation> </message> <message> <source>Cannot assign to non-existent default property</source> - <translation type="unfinished">Neobstoječi privzeti lastnosti ni moč prirediti</translation> + <translation>Neobstoječi privzeti lastnosti ni moč prirediti</translation> </message> <message> <source>Cannot assign to non-existent property "%1"</source> - <translation type="unfinished">Neobstoječi lastnosti »%1« ni moč prirediti</translation> + <translation>Neobstoječi lastnosti »%1« ni moč prirediti</translation> </message> <message> <source>Invalid use of namespace</source> - <translation type="unfinished">Napačna raba imenskega prostora</translation> + <translation>Napačna raba imenskega prostora</translation> </message> <message> <source>Not an attached property name</source> - <translation type="unfinished">Ni ime pripete lastnosti</translation> + <translation>Ni ime pripete lastnosti</translation> </message> <message> <source>Invalid use of id property</source> - <translation type="unfinished">Napačna raba lastnosti ID</translation> + <translation>Napačna raba lastnosti ID</translation> </message> <message> <source>Property has already been assigned a value</source> - <translation type="unfinished">Lastnosti je že bila prirejena vrednost</translation> + <translation>Lastnosti je že bila prirejena vrednost</translation> </message> <message> <source>Invalid grouped property access</source> - <translation type="unfinished">Neveljaven dostop do skupinske lastnosti</translation> + <translation>Neveljaven dostop do skupinske lastnosti</translation> </message> <message> <source>Cannot assign a value directly to a grouped property</source> - <translation type="unfinished">Skupinski lastnosti ni moč neposredno prirediti vrednosti</translation> + <translation>Skupinski lastnosti ni moč neposredno prirediti vrednosti</translation> </message> <message> <source>Invalid property use</source> - <translation type="unfinished">Neveljavna raba lastnosti</translation> + <translation>Neveljavna raba lastnosti</translation> </message> <message> <source>Property assignment expected</source> - <translation type="unfinished">Pričakovana je prireditev lastnosti</translation> + <translation>Pričakovana je prireditev lastnosti</translation> </message> <message> <source>Single property assignment expected</source> - <translation type="unfinished">Pričakovana je enojna prireditev lastnosti</translation> + <translation>Pričakovana je enojna prireditev lastnosti</translation> </message> <message> <source>Unexpected object assignment</source> - <translation type="unfinished">Nepričakovana prireditev objekta</translation> + <translation>Nepričakovana prireditev objekta</translation> </message> <message> <source>Cannot assign object to list</source> - <translation type="unfinished">Objekta ni moč prirediti seznamu</translation> + <translation>Objekta ni moč prirediti seznamu</translation> </message> <message> <source>Can only assign one binding to lists</source> - <translation type="unfinished">Seznamom je moč prirediti le eno vezavo</translation> + <translation>Seznamom je moč prirediti le eno vezavo</translation> </message> <message> <source>Cannot assign primitives to lists</source> - <translation type="unfinished">Seznamom ni moč prirediti osnovnih tipov</translation> + <translation>Seznamom ni moč prirediti osnovnih tipov</translation> </message> <message> <source>Cannot assign multiple values to a script property</source> - <translation type="unfinished"></translation> + <translation>Lastnosti »script« ni moč prirediti več vrednosti</translation> </message> <message> <source>Invalid property assignment: script expected</source> - <translation type="unfinished">Neveljavna prireditev lastnosti: pričakovan je skript</translation> + <translation>Neveljavna prireditev lastnosti: pričakovan je skript</translation> </message> <message> <source>Cannot assign object to property</source> - <translation type="unfinished">Objekta ni moč prirediti lastnosti</translation> + <translation>Objekta ni moč prirediti lastnosti</translation> </message> <message> <source>"%1" cannot operate on "%2"</source> - <translation type="unfinished">»%1« ne more delovati na »%2«</translation> + <translation>»%1« ne more delovati na »%2«</translation> </message> <message> <source>Duplicate default property</source> - <translation type="unfinished">Podvojena privzeta lastnost</translation> + <translation>Podvojena privzeta lastnost</translation> </message> <message> <source>Duplicate property name</source> - <translation type="unfinished">Podvojeno ime lastnosti</translation> + <translation>Podvojeno ime lastnosti</translation> </message> <message> <source>Property names cannot begin with an upper case letter</source> - <translation type="unfinished">Imena lastnosti se ne smejo začeti z veliko črko</translation> + <translation>Imena lastnosti se ne smejo začeti z veliko črko</translation> </message> <message> <source>Illegal property name</source> - <translation type="unfinished">Neveljavno ime lastnosti</translation> + <translation>Neveljavno ime lastnosti</translation> </message> <message> <source>Duplicate signal name</source> - <translation type="unfinished">Podvojeno ime signala</translation> + <translation>Podvojeno ime signala</translation> </message> <message> <source>Signal names cannot begin with an upper case letter</source> - <translation type="unfinished">Imena signalov se ne smejo začeti z veliko črko</translation> + <translation>Imena signalov se ne smejo začeti z veliko črko</translation> </message> <message> <source>Illegal signal name</source> - <translation type="unfinished">Neveljavno ime signala</translation> + <translation>Neveljavno ime signala</translation> </message> <message> <source>Duplicate method name</source> - <translation type="unfinished">Podvojeno ime metode</translation> + <translation>Podvojeno ime metode</translation> </message> <message> <source>Method names cannot begin with an upper case letter</source> - <translation type="unfinished">Imena metod se ne smejo začeti z veliko črko</translation> + <translation>Imena metod se ne smejo začeti z veliko črko</translation> </message> <message> <source>Illegal method name</source> - <translation type="unfinished">Neveljavno ime metode</translation> + <translation>Neveljavno ime metode</translation> </message> <message> <source>Property value set multiple times</source> - <translation type="unfinished">Vrednost lastnosti je bila nastavljena večkrat</translation> + <translation>Vrednost lastnosti je bila nastavljena večkrat</translation> </message> <message> <source>Invalid property nesting</source> - <translation type="unfinished">Neveljavno gnezdenje lastnosti</translation> + <translation>Neveljavno gnezdenje lastnosti</translation> </message> <message> <source>Cannot override FINAL property</source> - <translation type="unfinished">Lastnosti FINAL ni moč povoziti</translation> + <translation>Lastnosti FINAL ni moč povoziti</translation> </message> <message> <source>Invalid property type</source> - <translation type="unfinished">Neveljavna vrsta lastnosti</translation> + <translation>Neveljavna vrsta lastnosti</translation> </message> <message> <source>Invalid empty ID</source> - <translation type="unfinished">Neveljaven prazen ID</translation> + <translation>Neveljaven prazen ID</translation> </message> <message> <source>IDs cannot start with an uppercase letter</source> - <translation type="unfinished">ID-ji se ne smejo začeti z veliko črko</translation> + <translation>ID-ji se ne smejo začeti z veliko črko</translation> </message> <message> <source>IDs must start with a letter or underscore</source> - <translation type="unfinished">ID-ji se morajo začeti s črko ali podčrtajem</translation> + <translation>ID-ji se morajo začeti s črko ali podčrtajem</translation> </message> <message> <source>IDs must contain only letters, numbers, and underscores</source> - <translation type="unfinished">ID-ji lahko vsebujejo le črke, števke in podčrtaje</translation> + <translation>ID-ji lahko vsebujejo le črke, števke in podčrtaje</translation> </message> <message> <source>ID illegally masks global JavaScript property</source> - <translation type="unfinished">ID neveljavno zakriva globalno lastnost JavaScripta</translation> + <translation>ID neveljavno zakriva globalno lastnost JavaScripta</translation> </message> <message> <source>No property alias location</source> - <translation type="unfinished">Brez lokacije aliasa lastnosti</translation> + <translation>Brez lokacije aliasa lastnosti</translation> </message> <message> <source>Invalid alias location</source> - <translation type="unfinished">Neveljavna lokacija aliasa</translation> + <translation>Neveljavna lokacija aliasa</translation> </message> <message> <source>Invalid alias reference. An alias reference must be specified as <id> or <id>.<property></source> - <translation type="unfinished">Neveljavna referenca aliasa. Referenca aliasa mora biti določena kot <id> ali <id>.<lastnost></translation> + <translation>Neveljavna referenca aliasa. Referenca aliasa mora biti določena kot <id> ali <id>.<lastnost></translation> </message> <message> <source>Invalid alias reference. Unable to find id "%1"</source> - <translation type="unfinished">Neveljavna referenca aliasa. ID-ja »%1« ni moč najti</translation> + <translation>Neveljavna referenca aliasa. ID-ja »%1« ni moč najti</translation> </message> </context> <context> <name>QDeclarativeComponent</name> <message> <source>Invalid empty URL</source> - <translation type="unfinished">Neveljaven prazen URL</translation> + <translation>Neveljaven prazen URL</translation> </message> </context> <context> <name>QDeclarativeCompositeTypeManager</name> <message> <source>Resource %1 unavailable</source> - <translation type="unfinished">Vir %1 ni na voljo</translation> + <translation>Vir %1 ni na voljo</translation> </message> <message> <source>Namespace %1 cannot be used as a type</source> - <translation type="unfinished">Imenskega prostora %1 ni moč uporabiti kot vrste</translation> + <translation>Imenskega prostora %1 ni moč uporabiti kot vrste</translation> </message> <message> <source>%1 %2</source> - <translation type="unfinished">%1 % {1 %2?}</translation> + <translation>%1 %2</translation> </message> <message> <source>Type %1 unavailable</source> - <translation type="unfinished">Vrsta %1 ni na voljo</translation> + <translation>Vrsta %1 ni na voljo</translation> </message> </context> <context> <name>QDeclarativeConnections</name> <message> <source>Cannot assign to non-existent property "%1"</source> - <translation type="unfinished">Neobstoječi lastnosti »%1« ni moč prirediti</translation> + <translation>Neobstoječi lastnosti »%1« ni moč prirediti</translation> </message> <message> <source>Connections: nested objects not allowed</source> - <translation type="unfinished">Povezave: gnezdeni objekti niso dovoljeni</translation> + <translation>Povezave: gnezdeni objekti niso dovoljeni</translation> </message> <message> <source>Connections: syntax error</source> - <translation type="unfinished">Povezave: napaka v skladnji</translation> + <translation>Povezave: napaka v skladnji</translation> </message> <message> <source>Connections: script expected</source> - <translation type="unfinished">Povezave: pričakovan je skript</translation> + <translation>Povezave: pričakovan je skript</translation> </message> </context> <context> <name>QDeclarativeEngine</name> <message> <source>executeSql called outside transaction()</source> - <translation type="unfinished">executeSql je bil klican izven transaction()</translation> + <translation>executeSql je bil klican izven transaction()</translation> </message> <message> <source>Read-only Transaction</source> - <translation type="unfinished">Transakcija samo za branje</translation> + <translation>Transakcija samo za branje</translation> </message> <message> <source>Version mismatch: expected %1, found %2</source> - <translation type="unfinished">Neujemanje različic: pričakovana %1, najdena %2</translation> + <translation>Neujemanje različic: pričakovana %1, najdena %2</translation> </message> <message> <source>SQL transaction failed</source> - <translation type="unfinished">Transakcija SQL ni uspela</translation> + <translation>Transakcija SQL ni uspela</translation> </message> <message> <source>transaction: missing callback</source> @@ -1775,408 +1775,408 @@ v </message> <message> <source>SQL: database version mismatch</source> - <translation type="unfinished">SQL: neujemanje različice podatkovne zbirke</translation> + <translation>SQL: neujemanje različice podatkovne zbirke</translation> </message> </context> <context> <name>QDeclarativeFlipable</name> <message> <source>front is a write-once property</source> - <translation type="unfinished">front je lastnost, ki se jo lahko zapiše samo enkrat</translation> + <translation>front je lastnost, ki se jo lahko zapiše samo enkrat</translation> </message> <message> <source>back is a write-once property</source> - <translation type="unfinished">back je lastnost, ki se jo lahko zapiše samo enkrat</translation> + <translation>back je lastnost, ki se jo lahko zapiše samo enkrat</translation> </message> </context> <context> <name>QDeclarativeImportDatabase</name> <message> <source>module "%1" definition "%2" not readable</source> - <translation type="unfinished">definicije »%2« modula »%1« ni moč brati</translation> + <translation>definicije »%2« modula »%1« ni moč brati</translation> </message> <message> <source>plugin cannot be loaded for module "%1": %2</source> - <translation type="unfinished">vstavka za modul »%1« ni moč naložiti: %2</translation> + <translation>vstavka za modul »%1« ni moč naložiti: %2</translation> </message> <message> <source>module "%1" plugin "%2" not found</source> - <translation type="unfinished">vstavek »%2« modula »%1« ni bil najden</translation> + <translation>vstavek »%2« modula »%1« ni bil najden</translation> </message> <message> <source>module "%1" version %2.%3 is not installed</source> - <translation type="unfinished">modul »%1« različice %2.%3 ni nameščen</translation> + <translation>modul »%1« različice %2.%3 ni nameščen</translation> </message> <message> <source>module "%1" is not installed</source> - <translation type="unfinished">modul »%1« ni nameščen</translation> + <translation>modul »%1« ni nameščen</translation> </message> <message> <source>"%1": no such directory</source> - <translation type="unfinished">»%1«: mapa ne obstaja</translation> + <translation>»%1«: mapa ne obstaja</translation> </message> <message> <source>import "%1" has no qmldir and no namespace</source> - <translation type="unfinished"></translation> + <translation>uvoz »%1« nima niti qmldir-a niti imenskega prostora</translation> </message> <message> <source>- %1 is not a namespace</source> - <translation type="unfinished">– %1 ni imenski prostor</translation> + <translation>– %1 ni imenski prostor</translation> </message> <message> <source>- nested namespaces not allowed</source> - <translation type="unfinished">– gnezdeni imenski prostori niso dovoljeni</translation> + <translation>– gnezdeni imenski prostori niso dovoljeni</translation> </message> <message> <source>local directory</source> - <translation type="unfinished">krajevna mapa</translation> + <translation>krajevna mapa</translation> </message> <message> <source>is ambiguous. Found in %1 and in %2</source> - <translation type="unfinished">je dvoumno. Najdeno v %1 in %2</translation> + <translation>je dvoumno. Najdeno v %1 in %2</translation> </message> <message> <source>is ambiguous. Found in %1 in version %2.%3 and %4.%5</source> - <translation type="unfinished">je dvoumno. Najdeno v %1 v različicah %2.%3 in %4.%5</translation> + <translation>je dvoumno. Najdeno v %1 v različicah %2.%3 in %4.%5</translation> </message> <message> <source>is instantiated recursively</source> - <translation type="unfinished">je instanciran rekurzivno</translation> + <translation>je instanciran rekurzivno</translation> </message> <message> <source>is not a type</source> - <translation type="unfinished">ni vrsta</translation> + <translation>ni vrsta</translation> </message> </context> <context> <name>QDeclarativeKeyNavigationAttached</name> <message> <source>KeyNavigation is only available via attached properties</source> - <translation type="unfinished">KeyNavigation je na voljo samo s pripetimi lastnostmi</translation> + <translation>KeyNavigation je na voljo samo s pripetimi lastnostmi</translation> </message> </context> <context> <name>QDeclarativeKeysAttached</name> <message> <source>Keys is only available via attached properties</source> - <translation type="unfinished">Keys je na voljo samo s pripetimi lastnostmi</translation> + <translation>Keys je na voljo samo s pripetimi lastnostmi</translation> </message> </context> <context> <name>QDeclarativeListModel</name> <message> <source>remove: index %1 out of range</source> - <translation type="unfinished">remove: indeks %1 je izven obsega</translation> + <translation>remove: indeks %1 je izven obsega</translation> </message> <message> <source>insert: value is not an object</source> - <translation type="unfinished">insert: vrednost ni objekt</translation> + <translation>insert: vrednost ni objekt</translation> </message> <message> <source>insert: index %1 out of range</source> - <translation type="unfinished">insert: indeks %1 je izven obsega</translation> + <translation>insert: indeks %1 je izven obsega</translation> </message> <message> <source>move: out of range</source> - <translation type="unfinished">move: izven obsega</translation> + <translation>move: izven obsega</translation> </message> <message> <source>append: value is not an object</source> - <translation type="unfinished">append: vrednost ni objekt</translation> + <translation>append: vrednost ni objekt</translation> </message> <message> <source>set: value is not an object</source> - <translation type="unfinished">set: vrednost ni objekt</translation> + <translation>set: vrednost ni objekt</translation> </message> <message> <source>set: index %1 out of range</source> - <translation type="unfinished">set: indeks %1 je izven obsega</translation> + <translation>set: indeks %1 je izven obsega</translation> </message> <message> <source>ListElement: cannot contain nested elements</source> - <translation type="unfinished"></translation> + <translation>ListElement: ni moč vsebovati gnezdenih elementov</translation> </message> <message> <source>ListElement: cannot use reserved "id" property</source> - <translation type="unfinished">ListElement: ne more uporabiti rezervirane lastnosti »id«</translation> + <translation>ListElement: ne more uporabiti rezervirane lastnosti »id«</translation> </message> <message> <source>ListElement: cannot use script for property value</source> - <translation type="unfinished">ListElement: ne more uporabiti skripta za vrednost lastnosti</translation> + <translation>ListElement: ne more uporabiti skripta za vrednost lastnosti</translation> </message> <message> <source>ListModel: undefined property '%1'</source> - <translation type="unfinished">ListModel: nedoločena lastnost »%1«</translation> + <translation>ListModel: nedoločena lastnost »%1«</translation> </message> </context> <context> <name>QDeclarativeLoader</name> <message> <source>Loader does not support loading non-visual elements.</source> - <translation type="unfinished">Loader ne podpira nalaganja elementov, ki niso vidni.</translation> + <translation>Loader ne podpira nalaganja elementov, ki niso vidni.</translation> </message> </context> <context> <name>QDeclarativeParentAnimation</name> <message> <source>Unable to preserve appearance under complex transform</source> - <translation type="unfinished"></translation> + <translation>Pod kompleksnim preoblikovanjem ni moč obdržati videza</translation> </message> <message> <source>Unable to preserve appearance under non-uniform scale</source> - <translation type="unfinished"></translation> + <translation>Pod ne-enakovrednim povečevanjem ni moč obdržati videza</translation> </message> <message> <source>Unable to preserve appearance under scale of 0</source> - <translation type="unfinished"></translation> + <translation>Pod povečavo 0 ni moč obdržati videza</translation> </message> </context> <context> <name>QDeclarativeParentChange</name> <message> <source>Unable to preserve appearance under complex transform</source> - <translation type="unfinished"></translation> + <translation>Pod kompleksnim preoblikovanjem ni moč obdržati videza</translation> </message> <message> <source>Unable to preserve appearance under non-uniform scale</source> - <translation type="unfinished"></translation> + <translation>Pod ne-enakovrednim povečevanjem ni moč obdržati videza</translation> </message> <message> <source>Unable to preserve appearance under scale of 0</source> - <translation type="unfinished"></translation> + <translation>Pod povečavo 0 ni moč obdržati videza</translation> </message> </context> <context> <name>QDeclarativeParser</name> <message> <source>Illegal unicode escape sequence</source> - <translation type="unfinished">Neveljavno ubežno zaporedje Unicode</translation> + <translation>Neveljavno ubežno zaporedje Unicode</translation> </message> <message> <source>Illegal character</source> - <translation type="unfinished">Neveljaven znak</translation> + <translation>Neveljaven znak</translation> </message> <message> <source>Unclosed string at end of line</source> - <translation type="unfinished">Nezaprt niz na koncu vrstice</translation> + <translation>Nezaprt niz na koncu vrstice</translation> </message> <message> <source>Illegal escape squence</source> - <translation type="unfinished">Neveljavno ubežno zaporedje</translation> + <translation>Neveljavno ubežno zaporedje</translation> </message> <message> <source>Unclosed comment at end of file</source> - <translation type="unfinished">Nezaprt komentar na koncu datoteke</translation> + <translation>Nezaprt komentar na koncu datoteke</translation> </message> <message> <source>Illegal syntax for exponential number</source> - <translation type="unfinished">Neveljavna skladnja za eksponentno število</translation> + <translation>Neveljavna skladnja za eksponentno število</translation> </message> <message> <source>Identifier cannot start with numeric literal</source> - <translation type="unfinished"></translation> + <translation>Identifikator se ne sme začeti s številskim literalom</translation> </message> <message> <source>Unterminated regular expression literal</source> - <translation type="unfinished"></translation> + <translation>Nezaključen literal regularnega izraza</translation> </message> <message> <source>Invalid regular expression flag '%0'</source> - <translation type="unfinished">Neveljavna zastavica »%0« regularnega izraza</translation> + <translation>Neveljavna zastavica »%0« regularnega izraza</translation> </message> <message> <source>Unterminated regular expression backslash sequence</source> - <translation type="unfinished"></translation> + <translation>Nezaključeno zaporedij poševnic nazaj v regularnem izrazu</translation> </message> <message> <source>Unterminated regular expression class</source> - <translation type="unfinished"></translation> + <translation>Nezaključen razred regularnega izraza</translation> </message> <message> <source>Syntax error</source> - <translation type="unfinished">Skladenjska napaka</translation> + <translation>Skladenjska napaka</translation> </message> <message> <source>Unexpected token `%1'</source> - <translation type="unfinished">Nepričakovan žeton »%1«</translation> + <translation>Nepričakovan žeton »%1«</translation> </message> <message> <source>Expected token `%1'</source> - <translation type="unfinished">Pričakovan žeton »%1«</translation> + <translation>Pričakovan žeton »%1«</translation> </message> <message> <source>Property value set multiple times</source> - <translation type="unfinished">Vrednost lastnosti je bila nastavljena večkrat</translation> + <translation>Vrednost lastnosti je bila nastavljena večkrat</translation> </message> <message> <source>Expected type name</source> - <translation type="unfinished"></translation> + <translation>Pričakovano ime vrste</translation> </message> <message> <source>Invalid import qualifier ID</source> - <translation type="unfinished"></translation> + <translation>Neveljaven ID kvalifikatorja uvoza</translation> </message> <message> <source>Reserved name "Qt" cannot be used as an qualifier</source> - <translation type="unfinished"></translation> + <translation>Rezerviranega imena »Qt« ni moč uporabiti kot kvalifikatorja</translation> </message> <message> <source>Script import qualifiers must be unique.</source> - <translation type="unfinished"></translation> + <translation>Kvalifikatorji uvozov skriptov morajo biti edinstveni.</translation> </message> <message> <source>Script import requires a qualifier</source> - <translation type="unfinished"></translation> + <translation>Uvozi skriptov potrebujejo kvalifikator</translation> </message> <message> <source>Library import requires a version</source> - <translation type="unfinished"></translation> + <translation>Uvozi knjižnic potrebujejo različico</translation> </message> <message> <source>Expected parameter type</source> - <translation type="unfinished"></translation> + <translation>Pričakovana vrsta parametra</translation> </message> <message> <source>Invalid property type modifier</source> - <translation type="unfinished"></translation> + <translation>Neveljaven modifikator vrste lastnosti</translation> </message> <message> <source>Unexpected property type modifier</source> - <translation type="unfinished"></translation> + <translation>Nepričakovan modifikator vrste lastnosti</translation> </message> <message> <source>Expected property type</source> - <translation type="unfinished"></translation> + <translation>Pričakovana vrsta lastnosti</translation> </message> <message> <source>Readonly not yet supported</source> - <translation type="unfinished"></translation> + <translation>Tisti, ki so samo za branje, še niso podprti</translation> </message> <message> <source>JavaScript declaration outside Script element</source> - <translation type="unfinished"></translation> + <translation>Deklaracija JavaScripta izven elementa Script</translation> </message> </context> <context> <name>QDeclarativePauseAnimation</name> <message> <source>Cannot set a duration of < 0</source> - <translation type="unfinished">Trajanja, ki je krajše od 0, ni moč nastaviti</translation> + <translation>Trajanja, ki je krajše od 0, ni moč nastaviti</translation> </message> </context> <context> <name>QDeclarativePixmap</name> <message> <source>Error decoding: %1: %2</source> - <translation type="unfinished"></translation> + <translation>Napaka dekodiranja: %1: %2</translation> </message> <message> <source>Failed to get image from provider: %1</source> - <translation type="unfinished"></translation> + <translation>Od ponudnika ni bilo moč dobiti slike: %1</translation> </message> <message> <source>Cannot open: %1</source> - <translation type="unfinished">Ni moč odpreti %1: %2</translation> + <translation>Ni moč odpreti %1:</translation> </message> </context> <context> <name>QDeclarativePropertyAnimation</name> <message> <source>Cannot set a duration of < 0</source> - <translation type="unfinished">Trajanja, ki je krajše od 0, ni moč nastaviti</translation> + <translation>Trajanja, ki je krajše od 0, ni moč nastaviti</translation> </message> </context> <context> <name>QDeclarativePropertyChanges</name> <message> <source>PropertyChanges does not support creating state-specific objects.</source> - <translation type="unfinished"></translation> + <translation>PropertyChanges ne podpira ustvarjanja objektov sprecifičnih za stanje.</translation> </message> <message> <source>Cannot assign to non-existent property "%1"</source> - <translation type="unfinished">Neobstoječi lastnosti »%1« ni moč prirediti</translation> + <translation>Neobstoječi lastnosti »%1« ni moč prirediti</translation> </message> <message> <source>Cannot assign to read-only property "%1"</source> - <translation type="unfinished"></translation> + <translation>Ni moč prirediti lastnosti »%1«, ki je samo za branje</translation> </message> </context> <context> <name>QDeclarativeTextInput</name> <message> <source>Could not load cursor delegate</source> - <translation type="unfinished"></translation> + <translation>Ni bilo moč naložiti delegata za kazalec</translation> </message> <message> <source>Could not instantiate cursor delegate</source> - <translation type="unfinished"></translation> + <translation>Ni bilo moč instancirati delegata za kazalec</translation> </message> </context> <context> <name>QDeclarativeVME</name> <message> <source>Unable to create object of type %1</source> - <translation type="unfinished"></translation> + <translation>Ni moč ustvariti objekta vrste %1</translation> </message> <message> <source>Cannot assign value %1 to property %2</source> - <translation type="unfinished"></translation> + <translation>Lastnosti %2 ni moč prirediti vrednosti %1</translation> </message> <message> <source>Cannot assign object type %1 with no default method</source> - <translation type="unfinished"></translation> + <translation>Ni moč prirediti objekta vrste %1 brez privzete metode</translation> </message> <message> <source>Cannot connect mismatched signal/slot %1 %vs. %2</source> - <translation type="unfinished"></translation> + <translation>Ni moč povezati neujemajočih signalov in rež: %1 in %2</translation> </message> <message> <source>Cannot assign an object to signal property %1</source> - <translation type="unfinished"></translation> + <translation>Objekta ni moč prirediti lastnosi signala %1</translation> </message> <message> <source>Cannot assign object to list</source> - <translation type="unfinished">Objekta ni moč prirediti seznamu</translation> + <translation>Objekta ni moč prirediti seznamu</translation> </message> <message> <source>Cannot assign object to interface property</source> - <translation type="unfinished"></translation> + <translation>Objekta ni moč prirediti lastnosti vmesnika</translation> </message> <message> <source>Unable to create attached object</source> - <translation type="unfinished"></translation> + <translation>Ni moč ustvariti pripetega objekta</translation> </message> <message> <source>Cannot set properties on %1 as it is null</source> - <translation type="unfinished"></translation> + <translation>Ni moč nastaviti lastnosti za %1, saj ne obstaja</translation> </message> </context> <context> <name>QDeclarativeVisualDataModel</name> <message> <source>Delegate component must be Item type.</source> - <translation type="unfinished"></translation> + <translation>Komponenta delegata mora biti vrste Item.</translation> </message> </context> <context> <name>QDeclarativeXmlListModel</name> <message> <source>Qt was built without support for xmlpatterns</source> - <translation type="unfinished"></translation> + <translation>Qt je bil zgrajen brez podpore za xmlpatterns</translation> </message> </context> <context> <name>QDeclarativeXmlListModelRole</name> <message> <source>An XmlRole query must not start with '/'</source> - <translation type="unfinished"></translation> + <translation>Poizvedba XmlRole se ne sme začeti z »/«</translation> </message> </context> <context> <name>QDeclarativeXmlRoleList</name> <message> <source>An XmlListModel query must start with '/' or "//"</source> - <translation type="unfinished"></translation> + <translation>Poizvedba XmlListModel se mora začeti z »/« ali »//«</translation> </message> </context> <context> @@ -2593,27 +2593,27 @@ Ali jo kljub temu želite izbrisati?</translation> </message> <message> <source>Go back</source> - <translation type="unfinished">Vrni se nazaj</translation> + <translation>Vrni se nazaj</translation> </message> <message> <source>Go forward</source> - <translation type="unfinished">Napreduj naprej</translation> + <translation>Napreduj naprej</translation> </message> <message> <source>Go to the parent directory</source> - <translation type="unfinished"></translation> + <translation>Pojdi v matično mapo</translation> </message> <message> <source>Create a New Folder</source> - <translation type="unfinished"></translation> + <translation>Ustvari novo mapo</translation> </message> <message> <source>Change to list view mode</source> - <translation type="unfinished"></translation> + <translation>Preklopi v način prikaza seznama</translation> </message> <message> <source>Change to detail view mode</source> - <translation type="unfinished"></translation> + <translation>Preklopi v način prikaza podrobnosti</translation> </message> </context> <context> @@ -2678,7 +2678,7 @@ Ali jo kljub temu želite izbrisati?</translation> </message> <message> <source>%1 byte(s)</source> - <translation type="unfinished"></translation> + <translation>%1 B</translation> </message> </context> <context> @@ -2697,7 +2697,7 @@ Ali jo kljub temu želite izbrisati?</translation> </message> <message> <source>Black</source> - <translation type="unfinished">Črna</translation> + <translation type="unfinished"></translation> </message> <message> <source>Demi</source> @@ -2849,7 +2849,7 @@ Ali jo kljub temu želite izbrisati?</translation> </message> <message> <source>N'Ko</source> - <translation type="unfinished"></translation> + <translation>N'Ko</translation> </message> </context> <context> @@ -3004,7 +3004,7 @@ Ali jo kljub temu želite izbrisati?</translation> </message> <message> <source>No host name given</source> - <translation type="unfinished">Podano ni bilo nobeno ime gostitelja</translation> + <translation>Podano ni bilo nobeno ime gostitelja</translation> </message> </context> <context> @@ -3665,7 +3665,7 @@ Ali jo kljub temu želite izbrisati?</translation> </message> <message> <source><p>Qt is a C++ toolkit for cross-platform application development.</p><p>Qt provides single-source portability across MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux, and all major commercial Unix variants. Qt is also available for embedded devices as Qt for Embedded Linux and Qt for Windows CE.</p><p>Qt is available under three different licensing options designed to accommodate the needs of our various users.</p><p>Qt licensed under our commercial license agreement is appropriate for development of proprietary/commercial software where you do not want to share any source code with third parties or otherwise cannot comply with the terms of the GNU LGPL version 2.1 or GNU GPL version 3.0.</p><p>Qt licensed under the GNU LGPL version 2.1 is appropriate for the development of Qt applications (proprietary or open source) provided you can comply with the terms and conditions of the GNU LGPL version 2.1.</p><p>Qt licensed under the GNU General Public License version 3.0 is appropriate for the development of Qt applications where you wish to use such applications in combination with software subject to the terms of the GNU GPL version 3.0 or where you are otherwise willing to comply with the terms of the GNU GPL version 3.0.</p><p>Please see <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a> for an overview of Qt licensing.</p><p>Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).</p><p>Qt is a Nokia product. See <a href="http://qt.nokia.com/">qt.nokia.com</a> for more information.</p></source> - <translation><p>Qt je skupek gradnikov C++ za razvoj programov, ki tečejo na več platformah.</p><p>Qt omogoča isto kodo prenašati med platformami Linux, Mac&nbsp;OS&nbsp;X, Windows in vsemi večjimi variantami UNIX-a. Qt je na voljo tudi za vgrajene naprave in sicer kot Qt for Embedded Linux in Qt for Windows CE.</p><p>Qt je na voljo pod tremi možnimi licenčnimi pogoji, ki ustrezajo različnim željam uporabnikov.</p><p>Qt pod licenco GNU General Public License različice 3.0 (<a href="http://www.gnu.org/licenses/gpl-3.0.html">GPLv3.0</a>) je primeren za razvoj programov Qt, ki so povsem <a href="http://www.gnu.org/philosophy/free-sw.html">prosti in odprto-kodni</a>. S to licenco se uporabnikom programa zagotovijo vse pravice in svoboščine, kot jih je imel izdelovalec programa.</p><p>Qt pod licenco GNU Lesser General Public License različice 2.1 (<a href="http://www.gnu.org/licenses/lgpl-2.1.html">LGPLv2.1</a>) omogoča tudi razvoj programov, ki uporabnikom ne zagotavljajo vseh pravic in svoboščin, kot jih je imel izdelovalec. Omogoča na primer tudi razvoj zaprto-kodnih programov.</p><p>Qt pod posebno komercialno licenco je namenjen razvoju lastniških in zaprto-kodnih programov, kjer izdelovalec z uporabniki noče deliti nič izvorne kode ter pravic in svoboščin, ali pa ne more ustreči pogojem licenc GPLv3.0 ali LGPLv2.1.</p><p>Za pregled licenčnih možnosti si oglejte spletno stran <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a>.</p><p>Avtorske pravice © 2009 Nokia Corporation in/ali podružnice ter zunanji prispevajoči.</p><p>Qt je proizvod podjetja Nokia. Za dodatne podatke si oglejte <a href="http://qt.nokia.com/">qt.nokia.com</a>.</p></translation> + <translation><p>Qt je skupek gradnikov C++ za razvoj programov, ki tečejo na več platformah.</p><p>Qt omogoča isto kodo prenašati med platformami Linux, Mac&nbsp;OS&nbsp;X, Windows in vsemi večjimi variantami UNIX-a. Qt je na voljo tudi za vgrajene naprave in sicer kot Qt for Embedded Linux in Qt for Windows CE.</p><p>Qt je na voljo pod tremi možnimi licenčnimi pogoji, ki ustrezajo različnim željam uporabnikov.</p><p>Qt pod licenco GNU General Public License različice 3.0 (<a href="http://www.gnu.org/licenses/gpl-3.0.html">GPLv3.0</a>) je primeren za razvoj programov Qt, ki so povsem <a href="http://www.gnu.org/philosophy/free-sw.html">prosti in odprto-kodni</a>. S to licenco se uporabnikom programa zagotovijo vse pravice in svoboščine, kot jih je imel izdelovalec programa.</p><p>Qt pod licenco GNU Lesser General Public License različice 2.1 (<a href="http://www.gnu.org/licenses/lgpl-2.1.html">LGPLv2.1</a>) omogoča tudi razvoj programov, ki uporabnikom ne zagotavljajo vseh pravic in svoboščin, kot jih je imel izdelovalec. Omogoča na primer tudi razvoj zaprto-kodnih programov.</p><p>Qt pod posebno komercialno licenco je namenjen razvoju lastniških in zaprto-kodnih programov, kjer izdelovalec z uporabniki noče deliti nič izvorne kode ter pravic in svoboščin, ali pa ne more ustreči pogojem licenc GPLv3.0 ali LGPLv2.1.</p><p>Za pregled licenčnih možnosti si oglejte spletno stran <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a>.</p><p>Avtorske pravice © 2009 Nokia Corporation in/ali podružnice ter zunanji prispevajoči.</p><p>Qt je proizvod podjetja Nokia. Za dodatne podatke si oglejte <a href="http://qt.nokia.com/">qt.nokia.com</a>.</p><p>Prevedel: <a href="mailto:jlp@holodeck1.com">Jure Repinc</a>, <a href="http://www.lugos.si/">LUGOS</a></p></translation> </message> <message> <source>About Qt</source> @@ -3816,11 +3816,11 @@ Ali jo kljub temu želite izbrisati?</translation> <name>QNetworkAccessDataBackend</name> <message> <source>Operation not supported on %1</source> - <translation type="unfinished">Dejanje na %1 ni podprto</translation> + <translation>Dejanje na %1 ni podprto</translation> </message> <message> <source>Invalid URI: %1</source> - <translation type="unfinished">Neveljaven URI: %1</translation> + <translation>Neveljaven URI: %1</translation> </message> </context> <context> @@ -3831,11 +3831,11 @@ Ali jo kljub temu želite izbrisati?</translation> </message> <message> <source>Socket error on %1: %2</source> - <translation type="unfinished">Napaka vtičnice na %1: %2</translation> + <translation>Napaka vtičnice na %1: %2</translation> </message> <message> <source>Remote host closed the connection prematurely on %1</source> - <translation type="unfinished">Oddaljen gostitelj je predčasno prekinil povezavo na %1</translation> + <translation>Oddaljen gostitelj je predčasno prekinil povezavo na %1</translation> </message> </context> <context> @@ -3895,7 +3895,7 @@ Ali jo kljub temu želite izbrisati?</translation> <name>QNetworkAccessManager</name> <message> <source>Network access is disabled.</source> - <translation type="unfinished"></translation> + <translation>Omrežni dostop je onemogočen.</translation> </message> </context> <context> @@ -3910,11 +3910,11 @@ Ali jo kljub temu želite izbrisati?</translation> </message> <message> <source>Network session error.</source> - <translation type="unfinished"></translation> + <translation>Napaka omrežne seje.</translation> </message> <message> <source>Temporary network failure.</source> - <translation type="unfinished"></translation> + <translation>Začasna omrežna napaka.</translation> </message> </context> <context> @@ -3928,42 +3928,42 @@ Ali jo kljub temu želite izbrisati?</translation> <name>QNetworkSession</name> <message> <source>Invalid configuration.</source> - <translation type="unfinished"></translation> + <translation>Neveljavna nastavitev.</translation> </message> </context> <context> <name>QNetworkSessionPrivateImpl</name> <message> <source>Roaming error</source> - <translation type="unfinished"></translation> + <translation>Napaka potovanja</translation> </message> <message> <source>Session aborted by user or system</source> - <translation type="unfinished"></translation> + <translation>Sejo je preklical uporabnik ali pa sistem</translation> </message> <message> <source>Unidentified Error</source> - <translation type="unfinished"></translation> + <translation>Neznana napaka</translation> </message> <message> <source>Unknown session error.</source> - <translation type="unfinished"></translation> + <translation>Neznana napaka seje.</translation> </message> <message> <source>The session was aborted by the user or system.</source> - <translation type="unfinished"></translation> + <translation>Sejo je preklical uporabnik ali pa sistem.</translation> </message> <message> <source>The requested operation is not supported by the system.</source> - <translation type="unfinished"></translation> + <translation>Sistem ne podpira zahtevanega dejanja.</translation> </message> <message> <source>The specified configuration cannot be used.</source> - <translation type="unfinished"></translation> + <translation>Navedenih nastavitev ni moč uporabiti.</translation> </message> <message> <source>Roaming was aborted or is not possible.</source> - <translation type="unfinished"></translation> + <translation>Potovanje je bilo preklicano ali pa ni možno.</translation> </message> </context> <context> @@ -4095,15 +4095,15 @@ Ali jo kljub temu želite izbrisati?</translation> <name>QObject</name> <message> <source>PulseAudio Sound Server</source> - <translation type="unfinished">Zvočni strežnik PulseAudio</translation> + <translation>Zvočni strežnik PulseAudio</translation> </message> <message> <source>"%1" duplicates a previous role name and will be disabled.</source> - <translation type="unfinished"></translation> + <translation>»%1« podvaja obstoječe ime vloge in bo onemogočena.</translation> </message> <message> <source>invalid query: "%1"</source> - <translation type="unfinished"></translation> + <translation>neveljavna poizvedba: »%1«</translation> </message> </context> <context> @@ -4385,7 +4385,7 @@ Ali jo kljub temu želite izbrisati?</translation> </message> <message> <source>Print current page</source> - <translation type="unfinished"></translation> + <translation>Natisni trenutno stran</translation> </message> <message> <source>OK</source> @@ -4670,7 +4670,7 @@ Izberite drugo ime datoteke.</translation> </message> <message> <source>Close</source> - <translation type="unfinished">Zapri</translation> + <translation>Zapri</translation> </message> <message> <source>Export to PDF</source> @@ -4776,7 +4776,7 @@ Izberite drugo ime datoteke.</translation> </message> <message> <source>Current Page</source> - <translation type="unfinished"></translation> + <translation>Trenutna stran</translation> </message> </context> <context> @@ -5444,7 +5444,7 @@ Izberite drugo ime datoteke.</translation> </message> <message> <source>Backtab</source> - <translation type="unfinished"></translation> + <translation>Tabulator nazaj</translation> </message> <message> <source>Backspace</source> @@ -5602,13 +5602,13 @@ Izberite drugo ime datoteke.</translation> <source>Media Pause</source> <extracomment>Media player pause button </extracomment> - <translation type="unfinished"></translation> + <translation>Prekini večpredstavnost</translation> </message> <message> <source>Toggle Media Play/Pause</source> <extracomment>Media player button to toggle between playing and paused </extracomment> - <translation type="unfinished"></translation> + <translation>Preklopi predvajanje/prekinitev večpredstavnosti</translation> </message> <message> <source>Favorites</source> @@ -5700,111 +5700,111 @@ Izberite drugo ime datoteke.</translation> </message> <message> <source>Monitor Brightness Up</source> - <translation type="unfinished">Povečaj svetlost zaslon</translation> + <translation>Povečaj svetlost zaslona</translation> </message> <message> <source>Monitor Brightness Down</source> - <translation type="unfinished">Zmanjšaj svetlost zaslona</translation> + <translation>Zmanjšaj svetlost zaslona</translation> </message> <message> <source>Keyboard Light On/Off</source> - <translation type="unfinished">Vklop/izklop lučk na tipkovnici</translation> + <translation>Vklop/izklop lučk na tipkovnici</translation> </message> <message> <source>Keyboard Brightness Up</source> - <translation type="unfinished"></translation> + <translation>Povečaj svetlost tipkovnice</translation> </message> <message> <source>Keyboard Brightness Down</source> - <translation type="unfinished"></translation> + <translation>Zmanjšaj svetlost tipkovnice</translation> </message> <message> <source>Power Off</source> - <translation type="unfinished">Izklopi</translation> + <translation>Izklopi</translation> </message> <message> <source>Wake Up</source> - <translation type="unfinished">Zbudi se</translation> + <translation>Zbudi</translation> </message> <message> <source>Eject</source> - <translation type="unfinished">Izvrzi</translation> + <translation>Izvrzi</translation> </message> <message> <source>Screensaver</source> - <translation type="unfinished">Ohranjevalnik zaslona</translation> + <translation>Ohranjevalnik zaslona</translation> </message> <message> <source>WWW</source> - <translation type="unfinished">WWW</translation> + <translation>Svetovni splet</translation> </message> <message> <source>Sleep</source> - <translation type="unfinished">V pripravljenost</translation> + <translation>V pripravljenost</translation> </message> <message> <source>LightBulb</source> - <translation type="unfinished">Žarnica</translation> + <translation>Žarnica</translation> </message> <message> <source>Shop</source> - <translation type="unfinished"></translation> + <translation>Trgovina</translation> </message> <message> <source>History</source> - <translation type="unfinished">Zgodovina</translation> + <translation>Zgodovina</translation> </message> <message> <source>Add Favorite</source> - <translation type="unfinished">Dodaj najljubšo</translation> + <translation>Dodaj priljubljeno</translation> </message> <message> <source>Hot Links</source> - <translation type="unfinished">Vroče povezave</translation> + <translation>Vroče povezave</translation> </message> <message> <source>Adjust Brightness</source> - <translation type="unfinished">Prilagodi svetlost</translation> + <translation>Prilagodi svetlost</translation> </message> <message> <source>Finance</source> - <translation type="unfinished">Finance</translation> + <translation>Finance</translation> </message> <message> <source>Community</source> - <translation type="unfinished">Skupnost</translation> + <translation>Skupnost</translation> </message> <message> <source>Audio Rewind</source> - <translation type="unfinished">Samodejno previj</translation> + <translation>Previj zvok</translation> </message> <message> <source>Back Forward</source> - <translation type="unfinished"></translation> + <translation>Nazaj naprej</translation> </message> <message> <source>Application Left</source> - <translation type="unfinished"></translation> + <translation>Program levo</translation> </message> <message> <source>Application Right</source> - <translation type="unfinished"></translation> + <translation>Program desno</translation> </message> <message> <source>Book</source> - <translation type="unfinished">Knjiga</translation> + <translation>Knjiga</translation> </message> <message> <source>CD</source> - <translation type="unfinished">CD</translation> + <translation>CD</translation> </message> <message> <source>Calculator</source> - <translation type="unfinished">Računalo</translation> + <translation>Računalo</translation> </message> <message> <source>Clear</source> - <translation type="unfinished">Počisti</translation> + <translation>Počisti</translation> </message> <message> <source>Clear Grab</source> @@ -5812,15 +5812,15 @@ Izberite drugo ime datoteke.</translation> </message> <message> <source>Close</source> - <translation type="unfinished">Zapri</translation> + <translation>Zapri</translation> </message> <message> <source>Copy</source> - <translation type="unfinished">Kopiraj</translation> + <translation>Skopiraj</translation> </message> <message> <source>Cut</source> - <translation type="unfinished">Izreži</translation> + <translation>Izreži</translation> </message> <message> <source>Display</source> @@ -5828,23 +5828,23 @@ Izberite drugo ime datoteke.</translation> </message> <message> <source>DOS</source> - <translation type="unfinished">DOS</translation> + <translation>DOS</translation> </message> <message> <source>Documents</source> - <translation type="unfinished">Dokumenti</translation> + <translation>Dokumenti</translation> </message> <message> <source>Spreadsheet</source> - <translation type="unfinished">Preglednica</translation> + <translation>Preglednica</translation> </message> <message> <source>Browser</source> - <translation type="unfinished">Brskalnik</translation> + <translation>Brskalnik</translation> </message> <message> <source>Game</source> - <translation type="unfinished">Igra</translation> + <translation>Igra</translation> </message> <message> <source>Go</source> @@ -5852,19 +5852,19 @@ Izberite drugo ime datoteke.</translation> </message> <message> <source>iTouch</source> - <translation type="unfinished">iTouch</translation> + <translation>iTouch</translation> </message> <message> <source>Logoff</source> - <translation type="unfinished">Odjava</translation> + <translation>Odjavi</translation> </message> <message> <source>Market</source> - <translation type="unfinished"></translation> + <translation>Trg</translation> </message> <message> <source>Meeting</source> - <translation type="unfinished">Srečanje</translation> + <translation>Srečanje</translation> </message> <message> <source>Keyboard Menu</source> @@ -5876,39 +5876,39 @@ Izberite drugo ime datoteke.</translation> </message> <message> <source>My Sites</source> - <translation type="unfinished">Moje strani</translation> + <translation>Moje strani</translation> </message> <message> <source>News</source> - <translation type="unfinished">Novice</translation> + <translation>Novice</translation> </message> <message> <source>Home Office</source> - <translation type="unfinished">Domača pisarna</translation> + <translation>Domača pisarna</translation> </message> <message> <source>Option</source> - <translation type="unfinished">Možnost</translation> + <translation>Možnost</translation> </message> <message> <source>Paste</source> - <translation type="unfinished">Prilepi</translation> + <translation>Prilepi</translation> </message> <message> <source>Phone</source> - <translation type="unfinished">Telefon</translation> + <translation>Telefon</translation> </message> <message> <source>Reply</source> - <translation type="unfinished">Odgovori</translation> + <translation>Odgovori</translation> </message> <message> <source>Reload</source> - <translation type="unfinished">Znova naloži</translation> + <translation>Znova naloži</translation> </message> <message> <source>Rotate Windows</source> - <translation type="unfinished">Zavrti okna</translation> + <translation>Zavrti okna</translation> </message> <message> <source>Rotation PB</source> @@ -5920,23 +5920,23 @@ Izberite drugo ime datoteke.</translation> </message> <message> <source>Save</source> - <translation type="unfinished">Shrani</translation> + <translation>Shrani</translation> </message> <message> <source>Send</source> - <translation type="unfinished">Pošlji</translation> + <translation>Pošlji</translation> </message> <message> <source>Spellchecker</source> - <translation type="unfinished">Črkovalnik</translation> + <translation>Črkovalnik</translation> </message> <message> <source>Split Screen</source> - <translation type="unfinished">Razdeli zaslon</translation> + <translation>Razdeli zaslon</translation> </message> <message> <source>Support</source> - <translation type="unfinished">Podpora</translation> + <translation>Podpora</translation> </message> <message> <source>Task Panel</source> @@ -5944,23 +5944,23 @@ Izberite drugo ime datoteke.</translation> </message> <message> <source>Terminal</source> - <translation type="unfinished">Terminal</translation> + <translation>Konzola</translation> </message> <message> <source>Tools</source> - <translation type="unfinished">Orodja</translation> + <translation>Orodja</translation> </message> <message> <source>Travel</source> - <translation type="unfinished">Potovanje</translation> + <translation>Potovanje</translation> </message> <message> <source>Video</source> - <translation type="unfinished">Video</translation> + <translation>Video</translation> </message> <message> <source>Word Processor</source> - <translation type="unfinished">Urejevalnik besedila</translation> + <translation>Urejevalnik besedil</translation> </message> <message> <source>XFer</source> @@ -5968,47 +5968,47 @@ Izberite drugo ime datoteke.</translation> </message> <message> <source>Zoom In</source> - <translation type="unfinished">Približaj</translation> + <translation>Povečaj</translation> </message> <message> <source>Zoom Out</source> - <translation type="unfinished">Oddalji</translation> + <translation>Zmanjšaj</translation> </message> <message> <source>Away</source> - <translation type="unfinished">Odsoten</translation> + <translation>Odsoten</translation> </message> <message> <source>Messenger</source> - <translation type="unfinished">Sporočilnik</translation> + <translation>Sporočilnik</translation> </message> <message> <source>WebCam</source> - <translation type="unfinished">Spletna kamera</translation> + <translation>Spletna kamera</translation> </message> <message> <source>Mail Forward</source> - <translation type="unfinished">Posreduj sporočilo naprej</translation> + <translation>Posreduj sporočilo</translation> </message> <message> <source>Pictures</source> - <translation type="unfinished">Slike</translation> + <translation>Slike</translation> </message> <message> <source>Music</source> - <translation type="unfinished">Glasba</translation> + <translation>Glasba</translation> </message> <message> <source>Battery</source> - <translation type="unfinished">Baterija</translation> + <translation>Baterija</translation> </message> <message> <source>Bluetooth</source> - <translation type="unfinished">Bluetooth</translation> + <translation>Bluetooth</translation> </message> <message> <source>Wireless</source> - <translation type="unfinished">Brezžično</translation> + <translation>Brezžično</translation> </message> <message> <source>Ultra Wide Band</source> @@ -6016,19 +6016,19 @@ Izberite drugo ime datoteke.</translation> </message> <message> <source>Audio Forward</source> - <translation type="unfinished"></translation> + <translation>Zvok naprej</translation> </message> <message> <source>Audio Repeat</source> - <translation type="unfinished"></translation> + <translation>Zvok ponavljanje</translation> </message> <message> <source>Audio Random Play</source> - <translation type="unfinished"></translation> + <translation>Zvok naključno</translation> </message> <message> <source>Subtitle</source> - <translation type="unfinished">Podnaslov</translation> + <translation>Podnaslov</translation> </message> <message> <source>Audio Cycle Track</source> @@ -6036,19 +6036,19 @@ Izberite drugo ime datoteke.</translation> </message> <message> <source>Time</source> - <translation type="unfinished">Čas</translation> + <translation>Čas</translation> </message> <message> <source>View</source> - <translation type="unfinished">Pogled</translation> + <translation>Prikaz</translation> </message> <message> <source>Top Menu</source> - <translation type="unfinished">Vrhnji meni</translation> + <translation>Vrhnji meni</translation> </message> <message> <source>Suspend</source> - <translation type="unfinished">Ustavi</translation> + <translation>Ustavi</translation> </message> <message> <source>Hibernate</source> @@ -6142,7 +6142,7 @@ Izberite drugo ime datoteke.</translation> <source>Toggle Call/Hangup</source> <extracomment>Button that will hang up if we're in call, or make a call if we're not. </extracomment> - <translation type="unfinished"></translation> + <translation>Preklopi pokliči/odloži</translation> </message> <message> <source>Flip</source> @@ -6152,13 +6152,13 @@ Izberite drugo ime datoteke.</translation> <source>Voice Dial</source> <extracomment>Button to trigger voice dialling </extracomment> - <translation type="unfinished"></translation> + <translation>Glasovni klic</translation> </message> <message> <source>Last Number Redial</source> <extracomment>Button to redial the last number called </extracomment> - <translation type="unfinished"></translation> + <translation>Ponovni klic zadnje številke</translation> </message> <message> <source>Camera Shutter</source> @@ -6170,11 +6170,11 @@ Izberite drugo ime datoteke.</translation> <source>Camera Focus</source> <extracomment>Button to focus the camera </extracomment> - <translation type="unfinished"></translation> + <translation>Fokus fotoaparata</translation> </message> <message> <source>Kanji</source> - <translation type="unfinished"></translation> + <translation>Kanji</translation> </message> <message> <source>Muhenkan</source> @@ -6190,11 +6190,11 @@ Izberite drugo ime datoteke.</translation> </message> <message> <source>Hiragana</source> - <translation type="unfinished">Hiragana</translation> + <translation>Hiragana</translation> </message> <message> <source>Katakana</source> - <translation type="unfinished">Katakana</translation> + <translation>Katakana</translation> </message> <message> <source>Hiragana Katakana</source> @@ -6238,7 +6238,7 @@ Izberite drugo ime datoteke.</translation> </message> <message> <source>Code input</source> - <translation type="unfinished"></translation> + <translation>Vnos kode</translation> </message> <message> <source>Multiple Candidate</source> @@ -6266,7 +6266,7 @@ Izberite drugo ime datoteke.</translation> </message> <message> <source>Hangul Jamo</source> - <translation type="unfinished">Hangul Jamo</translation> + <translation>Hangul Jamo</translation> </message> <message> <source>Hangul Romaja</source> @@ -6492,7 +6492,7 @@ Izberite drugo ime datoteke.</translation> </message> <message> <source>Unable to decrypt data: %1</source> - <translation type="unfinished"></translation> + <translation>Ni moč dešifrirati podatkov: %1</translation> </message> <message> <source>Error while reading: %1</source> @@ -6512,7 +6512,7 @@ Izberite drugo ime datoteke.</translation> </message> <message> <source>Private key does not certify public key, %1</source> - <translation type="unfinished"></translation> + <translation>Zasebni ključ ne potrjuje javnega ključa: %1</translation> </message> <message> <source>Error creating SSL session, %1</source> @@ -6536,59 +6536,59 @@ Izberite drugo ime datoteke.</translation> </message> <message> <source>No error</source> - <translation type="unfinished">Brez napake</translation> + <translation>Brez napake</translation> </message> <message> <source>The issuer certificate could not be found</source> - <translation type="unfinished"></translation> + <translation>Potrdila izdajatelja ni bilo moč najti</translation> </message> <message> <source>The certificate signature could not be decrypted</source> - <translation type="unfinished"></translation> + <translation>Podpisa potrdila ni bilo moč dešifrirati</translation> </message> <message> <source>The public key in the certificate could not be read</source> - <translation type="unfinished"></translation> + <translation>Javnega ključa iz potrdila ni bilo moč prebrati</translation> </message> <message> <source>The signature of the certificate is invalid</source> - <translation type="unfinished"></translation> + <translation>Podpis potrdila ni veljaven</translation> </message> <message> <source>The certificate is not yet valid</source> - <translation type="unfinished"></translation> + <translation>Potrdilo še ni veljavno</translation> </message> <message> <source>The certificate has expired</source> - <translation type="unfinished">Potrdilo je preteklo</translation> + <translation>Potrdilo je preteklo</translation> </message> <message> <source>The certificate's notBefore field contains an invalid time</source> - <translation type="unfinished"></translation> + <translation>Polje notBefore (ne pred) potrdila vsebuje neveljaven čas</translation> </message> <message> <source>The certificate's notAfter field contains an invalid time</source> - <translation type="unfinished"></translation> + <translation>Polje notAfter (ne po) potrdila vsebuje neveljaven čas</translation> </message> <message> <source>The certificate is self-signed, and untrusted</source> - <translation type="unfinished"></translation> + <translation>Potrdilo je samo-podpisano in nezaupano</translation> </message> <message> <source>The root certificate of the certificate chain is self-signed, and untrusted</source> - <translation type="unfinished"></translation> + <translation>Vrhnje potrdilo verige potrdil je samo-podpisano in nezaupano</translation> </message> <message> <source>The issuer certificate of a locally looked up certificate could not be found</source> - <translation type="unfinished"></translation> + <translation>Potrdila izdajatelja za krajevno najdeno potrdilo ni bilo moč najti</translation> </message> <message> <source>No certificates could be verified</source> - <translation type="unfinished"></translation> + <translation>Preveriti ni bilo moč nobenega potrdila</translation> </message> <message> <source>One of the CA certificates is invalid</source> - <translation type="unfinished"></translation> + <translation>Eno izmed potrdil avtoritete za potrdila ni veljavno</translation> </message> <message> <source>The basicConstraints path length parameter has been exceeded</source> @@ -6596,15 +6596,15 @@ Izberite drugo ime datoteke.</translation> </message> <message> <source>The supplied certificate is unsuitable for this purpose</source> - <translation type="unfinished"></translation> + <translation>Predloženo potrdilo ni primerno za ta namen</translation> </message> <message> <source>The root CA certificate is not trusted for this purpose</source> - <translation type="unfinished"></translation> + <translation>Potrdilo vrhovne avtoritete za potrdila ni zaupano za ta namen</translation> </message> <message> <source>The root CA certificate is marked to reject the specified purpose</source> - <translation type="unfinished"></translation> + <translation>Potrdilo vrhovne avtoritete za potrdila je označeno za zavrnitev navedenega namena</translation> </message> <message> <source>The current candidate issuer certificate was rejected because its subject name did not match the issuer name of the current certificate</source> @@ -6616,15 +6616,15 @@ Izberite drugo ime datoteke.</translation> </message> <message> <source>The peer did not present any certificate</source> - <translation type="unfinished">Vrstnik ni predložil nobenega potrdila</translation> + <translation>Vrstnik ni predložil nobenega potrdila</translation> </message> <message> <source>The host name did not match any of the valid hosts for this certificate</source> - <translation type="unfinished"></translation> + <translation>Ime gostitelja se ne ujema z nobenim izmed veljavnih gostiteljev za to potrdilo</translation> </message> <message> <source>Unknown error</source> - <translation type="unfinished">Neznana napaka</translation> + <translation>Neznana napaka</translation> </message> </context> <context> @@ -6858,7 +6858,7 @@ Izberite drugo ime datoteke.</translation> <name>QWebPage</name> <message> <source>Redirection limit reached</source> - <translation type="unfinished"></translation> + <translation>Dosežena je bila omejitev preusmeritev</translation> </message> <message> <source>Bad HTTP request</source> @@ -7082,7 +7082,7 @@ Izberite drugo ime datoteke.</translation> <message> <source>Missing Plug-in</source> <comment>Label text to be used when a plug-in is missing</comment> - <translation type="unfinished"></translation> + <translation>Manjkajoč vstavek</translation> </message> <message> <source>Loading...</source> @@ -7779,23 +7779,23 @@ Izberite drugo ime datoteke.</translation> <name>QXmlPatternistCLI</name> <message> <source>Warning in %1, at line %2, column %3: %4</source> - <translation type="unfinished"></translation> + <translation>Opozorilo v %1, vrstica %2, stolpec %3: %4</translation> </message> <message> <source>Warning in %1: %2</source> - <translation type="unfinished"></translation> + <translation>Opozorilo v %1: %2</translation> </message> <message> <source>Unknown location</source> - <translation type="unfinished">Neznana lokacija</translation> + <translation>Neznana lokacija</translation> </message> <message> <source>Error %1 in %2, at line %3, column %4: %5</source> - <translation type="unfinished"></translation> + <translation>Napaka %1 v %2, vrstica %3, stolpec %4: %5</translation> </message> <message> <source>Error %1 in %2: %3</source> - <translation type="unfinished">Napaka %1 v %2: %3</translation> + <translation>Napaka %1 v %2: %3</translation> </message> </context> <context> @@ -7826,7 +7826,7 @@ Izberite drugo ime datoteke.</translation> </message> <message> <source>Unexpected character '%1' in public id literal.</source> - <translation type="unfinished"></translation> + <translation>Nepričakovan znak »%1« v javnem literalu ID-ja.</translation> </message> <message> <source>Invalid XML version string.</source> @@ -7846,7 +7846,7 @@ Izberite drugo ime datoteke.</translation> </message> <message> <source>Standalone accepts only yes or no.</source> - <translation type="unfinished"></translation> + <translation>Samostojni (standalone) sprejema samo da (yes) ali ne (no).</translation> </message> <message> <source>Invalid attribute in XML declaration.</source> @@ -7890,7 +7890,7 @@ Izberite drugo ime datoteke.</translation> </message> <message> <source>NDATA in parameter entity declaration.</source> - <translation type="unfinished"></translation> + <translation>NDATA v parametru deklaracije entitete.</translation> </message> <message> <source>%1 is an invalid processing instruction name.</source> @@ -7938,7 +7938,7 @@ Izberite drugo ime datoteke.</translation> </message> <message> <source>%1 is an invalid PUBLIC identifier.</source> - <translation type="unfinished"></translation> + <translation>%1 ni veljaven javni identifikator.</translation> </message> </context> <context> @@ -7949,7 +7949,7 @@ Izberite drugo ime datoteke.</translation> </message> <message> <source>Element %1 can't be serialized because it appears outside the document element.</source> - <translation type="unfinished"></translation> + <translation>Elementa %1 ni moč serializirati, ker se nahaja zunaj elementa dokumenta.</translation> </message> <message> <source>Year %1 is invalid because it begins with %2.</source> @@ -8235,7 +8235,7 @@ Izberite drugo ime datoteke.</translation> </message> <message> <source>%1 is not a whole number of minutes.</source> - <translation type="unfinished">%1 ni celovito število minut,</translation> + <translation>%1 ni celovito število minut.</translation> </message> <message> <source>Required cardinality is %1; got cardinality %2.</source> @@ -9339,7 +9339,7 @@ Izberite drugo ime datoteke.</translation> </message> <message> <source>Component with ID %1 has been defined previously.</source> - <translation type="unfinished">Komponenta z ID-jem %1 je že bila definirana.</translation> + <translation>Komponenta z ID-jem %1 je že bila definirana.</translation> </message> <message> <source>Element %1 already defined.</source> diff --git a/translations/qtconfig_sl.ts b/translations/qtconfig_sl.ts new file mode 100644 index 0000000..fa779ff --- /dev/null +++ b/translations/qtconfig_sl.ts @@ -0,0 +1,732 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="sl"> + <extra-po-header-po_revision_date>2010-08-28 15:58+0200</extra-po-header-po_revision_date> + <extra-po-headers>MIME-Version,Content-Type,Content-Transfer-Encoding,Plural-Forms,X-Language,X-Qt-Contexts,Last-Translator,PO-Revision-Date,Project-Id-Version,Language-Team,X-Generator</extra-po-headers> + <extra-po-header-x_generator>Lokalize 1.1</extra-po-header-x_generator> + <extra-po-header-language_team>Slovenian <lugos-slo@lugos.si></extra-po-header-language_team> + <extra-po-header-project_id_version></extra-po-header-project_id_version> + <extra-po-header_comment># Jure Repinc <jlp@holodeck1.com>, 2010.</extra-po-header_comment> + <extra-po-header-last_translator>Jure Repinc <jlp@holodeck1.com></extra-po-header-last_translator> +<context> + <name>MainWindow</name> + <message> + <source>Desktop Settings (Default)</source> + <translation>Nastavitve namizja (privzeto)</translation> + </message> + <message> + <source>Choose style and palette based on your desktop settings.</source> + <translation>Izberite slog in paleto, ki temeljita na vaših nastavitvah namizja.</translation> + </message> + <message> + <source>On The Spot</source> + <translation>Na mestu</translation> + </message> + <message> + <source>Auto (default)</source> + <translation>Samodejno (privzeto)</translation> + </message> + <message> + <source>Choose audio output automatically.</source> + <translation>Samodejno izbere zvočni izhod.</translation> + </message> + <message> + <source>aRts</source> + <translation>aRts</translation> + </message> + <message> + <source>Experimental aRts support for GStreamer.</source> + <translation>Poskusna podpora za aRts za GStreamer.</translation> + </message> + <message> + <source>Phonon GStreamer backend not available.</source> + <translation>Hrbtenica GStreamer za Phonon ni na voljo.</translation> + </message> + <message> + <source>Choose render method automatically</source> + <translation>Samodejno izberi način izrisovanja</translation> + </message> + <message> + <source>X11</source> + <translation>X11</translation> + </message> + <message> + <source>Use X11 Overlays</source> + <translation>Uporabi prekritja X11</translation> + </message> + <message> + <source>OpenGL</source> + <translation>OpenGL</translation> + </message> + <message> + <source>Use OpenGL if available</source> + <translation>Če je na voljo, uporabi OpenGL</translation> + </message> + <message> + <source>Software</source> + <translation>Programsko</translation> + </message> + <message> + <source>Use simple software rendering</source> + <translation>Uporabi preprosto programsko izrisovanje</translation> + </message> + <message> + <source>No changes to be saved.</source> + <translation>Ni sprememb, ki bi jih bilo potrebno shraniti.</translation> + </message> + <message> + <source>Saving changes...</source> + <translation>Shranjevanje sprememb ...</translation> + </message> + <message> + <source>Over The Spot</source> + <translation>Prek mesta</translation> + </message> + <message> + <source>Off The Spot</source> + <translation>Z mesta</translation> + </message> + <message> + <source>Root</source> + <translation>Koren</translation> + </message> + <message> + <source>Select a Directory</source> + <translation>Izberite mapo</translation> + </message> + <message> + <source><h3>%1</h3><br/>Version %2<br/><br/>Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).</source> + <translation><h3>%1</h3><br/>Različica %2<br/><br/>Avtorske pravice © 2010 Nokia Corporation in/ali njene podružnice.<br/><br/>Prevedel: <a href="mailto:jlp@holodeck1.com">Jure Repinc</a>, <a href="http://www.lugos.si/">LUGOS</a></translation> + </message> + <message> + <source>Qt Configuration</source> + <translation>Nastavitev Qt</translation> + </message> + <message> + <source>Save Changes</source> + <translation>Shrani spremembe</translation> + </message> + <message> + <source>Save changes to settings?</source> + <translation>Ali želite shraniti spremembe nastavitev?</translation> + </message> + <message> + <source>&Yes</source> + <translation>&Da</translation> + </message> + <message> + <source>&No</source> + <translation>&Ne</translation> + </message> + <message> + <source>&Cancel</source> + <translation>&Prekliči</translation> + </message> +</context> +<context> + <name>MainWindowBase</name> + <message> + <source>Qt Configuration</source> + <translation>Nastavitev Qt</translation> + </message> + <message> + <source>Appearance</source> + <translation>Videz</translation> + </message> + <message> + <source>GUI Style</source> + <translation>Slog grafičnega vmesnika</translation> + </message> + <message> + <source>Select GUI &Style:</source> + <translation>Izberite &slog grafičnega vmesnika:</translation> + </message> + <message> + <source>Preview</source> + <translation>Ogled</translation> + </message> + <message> + <source>Select &Palette:</source> + <translation>Izberite &paleto:</translation> + </message> + <message> + <source>Active Palette</source> + <translation>Paleta za aktivno</translation> + </message> + <message> + <source>Inactive Palette</source> + <translation>Paleta za neaktivno</translation> + </message> + <message> + <source>Disabled Palette</source> + <translation>Paleta za onemogočeno</translation> + </message> + <message> + <source>Build Palette</source> + <translation>Gradnja palete</translation> + </message> + <message> + <source>&3-D Effects:</source> + <translation>Učinki &3D:</translation> + </message> + <message> + <source>Window Back&ground:</source> + <translation>&Ozadje okna:</translation> + </message> + <message> + <source>&Tune Palette...</source> + <translation>&Nastavitev palete ...</translation> + </message> + <message> + <source>Please use the KDE Control Center to set the palette.</source> + <translation>Za nastavitev palete uporabite KDE-jeve Sistemske nastavitve.</translation> + </message> + <message> + <source>Fonts</source> + <translation>Pisave</translation> + </message> + <message> + <source>Default Font</source> + <translation>Privzeta pisava</translation> + </message> + <message> + <source>&Style:</source> + <translation>&Slog:</translation> + </message> + <message> + <source>&Point Size:</source> + <translation>&Velikost v točkah:</translation> + </message> + <message> + <source>F&amily:</source> + <translation>&Družina:</translation> + </message> + <message> + <source>Sample Text</source> + <translation>Vzorec besedila</translation> + </message> + <message> + <source>Font Substitution</source> + <translation>Nadomeščanje pisav</translation> + </message> + <message> + <source>S&elect or Enter a Family:</source> + <translation>I&zberite ali vnesite družino:</translation> + </message> + <message> + <source>Current Substitutions:</source> + <translation>Trenutni nadomestki:</translation> + </message> + <message> + <source>Up</source> + <translation>Gor</translation> + </message> + <message> + <source>Down</source> + <translation>Dol</translation> + </message> + <message> + <source>Remove</source> + <translation>Odstrani</translation> + </message> + <message> + <source>Select s&ubstitute Family:</source> + <translation>Izberite &nadomestno družino:</translation> + </message> + <message> + <source>Add</source> + <translation>Dodaj</translation> + </message> + <message> + <source>Interface</source> + <translation>Vmesnik</translation> + </message> + <message> + <source>Feel Settings</source> + <translation>Nastavitve obnašanja</translation> + </message> + <message> + <source> ms</source> + <translation> ms</translation> + </message> + <message> + <source>&Double Click Interval:</source> + <translation>Interval &dvojnega klika:</translation> + </message> + <message> + <source>No blinking</source> + <translation>Brez utripanja</translation> + </message> + <message> + <source>&Cursor Flash Time:</source> + <translation>&Hitrost utripanja kazalca:</translation> + </message> + <message> + <source> lines</source> + <translation> vrstic</translation> + </message> + <message> + <source>Wheel &Scroll Lines:</source> + <translation>&Vrtljaj koleščka:</translation> + </message> + <message> + <source>Resolve symlinks in URLs</source> + <translation>Razreši simbolične povezave v URL-jih</translation> + </message> + <message> + <source>GUI Effects</source> + <translation>Učinki grafičnega vmesnika</translation> + </message> + <message> + <source>&Enable</source> + <translation>&Omogoči</translation> + </message> + <message> + <source>Alt+E</source> + <translation>Alt+O</translation> + </message> + <message> + <source>&Menu Effect:</source> + <translation>Učinek &menija:</translation> + </message> + <message> + <source>C&omboBox Effect:</source> + <translation>Učinek &spustnega seznama:</translation> + </message> + <message> + <source>&ToolTip Effect:</source> + <translation>Učinek &namiga:</translation> + </message> + <message> + <source>Tool&Box Effect:</source> + <translation>Učinek o&rodjarne:</translation> + </message> + <message> + <source>Disable</source> + <translation>Onemogoči</translation> + </message> + <message> + <source>Animate</source> + <translation>Animiraj</translation> + </message> + <message> + <source>Fade</source> + <translation>Preidi</translation> + </message> + <message> + <source>Global Strut</source> + <translation>Globalni razmiki</translation> + </message> + <message> + <source>Minimum &Width:</source> + <translation>Najmanjša &širina:</translation> + </message> + <message> + <source>Minimum Hei&ght:</source> + <translation>Najmanjša &višina:</translation> + </message> + <message> + <source> pixels</source> + <translation> pik</translation> + </message> + <message> + <source>Enhanced support for languages written right-to-left</source> + <translation>Izboljšana podpora za jezike, ki se pišejo od desne proti levi</translation> + </message> + <message> + <source>XIM Input Style:</source> + <translation>Način za vnašanje XIM:</translation> + </message> + <message> + <source>On The Spot</source> + <translation>Na mestu</translation> + </message> + <message> + <source>Over The Spot</source> + <translation>Prek mesta</translation> + </message> + <message> + <source>Off The Spot</source> + <translation>Z mesta</translation> + </message> + <message> + <source>Root</source> + <translation>Vrh</translation> + </message> + <message> + <source>Default Input Method:</source> + <translation>Privzeti način vnašanja:</translation> + </message> + <message> + <source>Printer</source> + <translation>Tiskalnik</translation> + </message> + <message> + <source>Enable Font embedding</source> + <translation>Omogoči vgrajevanje pisav</translation> + </message> + <message> + <source>Font Paths</source> + <translation>Poti do posav</translation> + </message> + <message> + <source>Browse...</source> + <translation>Brskanje ...</translation> + </message> + <message> + <source>Press the <b>Browse</b> button or enter a directory and press Enter to add them to the list.</source> + <translation>Kliknite gumb <b>Brskanje</b> ali pa vnesite mapo in pritisnite vnašalko za dodajanje na seznam.</translation> + </message> + <message> + <source>Phonon</source> + <translation>Phonon</translation> + </message> + <message> + <source>About Phonon</source> + <translation>O Phononu</translation> + </message> + <message> + <source>Current Version:</source> + <translation>Trenutna različica:</translation> + </message> + <message> + <source>Not available</source> + <translation>Ni na voljo</translation> + </message> + <message> + <source>Website:</source> + <translation>Spletna stran:</translation> + </message> + <message> + <source><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://phonon.kde.org"><span style=" text-decoration: underline; color:#0000ff;">http://phonon.kde.org</span></a></p></body></html></source> + <translation><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://phonon.kde.org"><span style=" text-decoration: underline; color:#0000ff;">http://phonon.kde.org/</span></a></p></body></html></translation> + </message> + <message> + <source>About GStreamer</source> + <translation>O GStreamerju</translation> + </message> + <message> + <source><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://gstreamer.freedesktop.org/"><span style=" text-decoration: underline; color:#0000ff;">http://gstreamer.freedesktop.org/</span></a></p></body></html></source> + <translation><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://gstreamer.freedesktop.org/"><span style=" text-decoration: underline; color:#0000ff;">http://gstreamer.freedesktop.org/</span></a></p></body></html></translation> + </message> + <message> + <source>GStreamer backend settings</source> + <translation>Nastavitve hrbtenice GStreamer</translation> + </message> + <message> + <source>Preferred audio sink:</source> + <translation>Prednostni ponor zvoka:</translation> + </message> + <message> + <source>Preferred render method:</source> + <translation>Prednostni način izrisovanja:</translation> + </message> + <message> + <source><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Note: changes to these settings may prevent applications from starting up correctly.</span></p></body></html></source> + <translation><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Vedite: spremembe teh nastavitev lahko preprečijo pravilen zagon programov.</span></p></body></html></translation> + </message> + <message> + <source>&File</source> + <translation>&Datoteka</translation> + </message> + <message> + <source>&Help</source> + <translation>&Pomoč</translation> + </message> + <message> + <source>&Save</source> + <translation>&Shrani</translation> + </message> + <message> + <source>Save</source> + <translation>Shrani</translation> + </message> + <message> + <source>Ctrl+S</source> + <translation>Ctrl+S</translation> + </message> + <message> + <source>E&xit</source> + <translation>Konča&j</translation> + </message> + <message> + <source>Exit</source> + <translation>Končaj</translation> + </message> + <message> + <source>&About</source> + <translation>&O</translation> + </message> + <message> + <source>About</source> + <translation>O</translation> + </message> + <message> + <source>About &Qt</source> + <translation>O &Qt</translation> + </message> + <message> + <source>About Qt</source> + <translation>O Qt</translation> + </message> +</context> +<context> + <name>PaletteEditorAdvancedBase</name> + <message> + <source>Tune Palette</source> + <translation>Nastavitev palete</translation> + </message> + <message> + <source><b>Edit Palette</b><p>Change the palette of the current widget or form.</p><p>Use a generated palette or select colors for each color group and each color role.</p><p>The palette can be tested with different widget layouts in the preview section.</p></source> + <translation><b>Nastavitev palete</b><p>Spremenite paleto za trenutni gradnik ali obrazec.</p><p>Uporabite ustvarjeno paleto ali pa za vsako barvno skupino in vsako barvno vlogo izberite barvo.</p><p>Paleto lahko v razdelku Ogled preizkusite z različnimi slogi gradnikov.</p></translation> + </message> + <message> + <source>Select &Palette:</source> + <translation>Izberite &paleto:</translation> + </message> + <message> + <source>Active Palette</source> + <translation>Paleta za aktivno</translation> + </message> + <message> + <source>Inactive Palette</source> + <translation>Paleta za neaktivno</translation> + </message> + <message> + <source>Disabled Palette</source> + <translation>Paleta za onemogočeno</translation> + </message> + <message> + <source>Auto</source> + <translation>Samodejno</translation> + </message> + <message> + <source>Build inactive palette from active</source> + <translation>Paleto za neaktivno zgradi iz palete za aktivno</translation> + </message> + <message> + <source>Build disabled palette from active</source> + <translation>Paleto za onemogočeno zgradi iz palete za aktivno</translation> + </message> + <message> + <source>Central color &roles</source> + <translation>Osrednje barvne &vloge</translation> + </message> + <message> + <source>Choose central color role</source> + <translation>Izberite osrednjo barvno vlogo</translation> + </message> + <message> + <source><b>Select a color role.</b><p>Available central roles are: <ul> <li>Window - general background color.</li> <li>WindowText - general foreground color. </li> <li>Base - used as background color for e.g. text entry widgets, usually white or another light color. </li> <li>Text - the foreground color used with Base. Usually this is the same as WindowText, in what case it must provide good contrast both with Window and Base. </li> <li>Button - general button background color, where buttons need a background different from Window, as in the Macintosh style. </li> <li>ButtonText - a foreground color used with the Button color. </li> <li>Highlight - a color to indicate a selected or highlighted item. </li> <li>HighlightedText - a text color that contrasts to Highlight. </li> <li>BrightText - a text color that is very different from WindowText and contrasts well with e.g. black. </li> </ul> </p></source> + <translation><b>Izberite barvno vlogo</b><p>Razpoložljive osrednje vloge so:<ul><li>Okno – splošna barva ozadja.</li><li>Besedilo okna – splošna barva ospredja</li><li>Osnova – uporabljena kot barva ozadja za npr. vnosne gradnike, običajno bela ali druga svetla barva.</li><li>Besedilo – barva ospredja, ki se uporablja z Osnovo. Običajno je to isto kot Besedilo okna in v tem primeru mora biti v kontrastu z barvama Okno in Osnova.</li><li>Gumb – splošna barva ozadja gumba, če gumb potrebuje ozadje, ki je drugačno od ozadja oken.</li><li>Besedilo gumba – barva ospredja, ki se uporablja z barvo Gumba<li>Poudarek – barva za nakazovanje izbranega ali poudarjenega.</li><li>Poudarjeno besedilo – barva besedila, ki se razlikuje od barve za Poudarek.</li><li>Svetlo besedilo – barva besedila, ki se zelo razlikuje od barve za Besedilo okna in je v kontrastu s črno.</li></ul></p></translation> + </message> + <message> + <source>Window</source> + <translation>Okno</translation> + </message> + <message> + <source>WindowText</source> + <translation>Besedilo okna</translation> + </message> + <message> + <source>Button</source> + <translation>Gumb</translation> + </message> + <message> + <source>Base</source> + <translation>Osnova</translation> + </message> + <message> + <source>Text</source> + <translation>Besedilo</translation> + </message> + <message> + <source>BrightText</source> + <translation>Svetlo besedilo</translation> + </message> + <message> + <source>ButtonText</source> + <translation>Besedilo gumba</translation> + </message> + <message> + <source>Highlight</source> + <translation>Poudarek</translation> + </message> + <message> + <source>HighlightedText</source> + <translation>Poudarjeno besedilo</translation> + </message> + <message> + <source>&Select Color:</source> + <translation>&Izberite barvo:</translation> + </message> + <message> + <source>Choose a color</source> + <translation>Izberite barvo</translation> + </message> + <message> + <source>Choose a color for the selected central color role.</source> + <translation>Izberite barvo za izbrano osrednjo barvno vlogo.</translation> + </message> + <message> + <source>3-D shadow &effects</source> + <translation>&Učinki 3D sence:</translation> + </message> + <message> + <source>Build &from button color</source> + <translation>&Zgradi iz barve za gumb</translation> + </message> + <message> + <source>Generate shadings</source> + <translation>Ustvari sence</translation> + </message> + <message> + <source>Check to let 3D-effect colors be calculated from button-color.</source> + <translation>Izberite, da se barve 3D učinka izračuna iz barve za gumb.</translation> + </message> + <message> + <source>Choose 3D-effect color role</source> + <translation>Izberite barvno vlogo 3D učinka</translation> + </message> + <message> + <source><b>Select a color role.</b><p>Available effect roles are: <ul> <li>Light - lighter than Button color. </li> <li>Midlight - between Button and Light. </li> <li>Mid - between Button and Dark. </li> <li>Dark - darker than Button. </li> <li>Shadow - a very dark color. </li> </ul></source> + <translation><b>Izberite barvno vlogo</b><p>Razpoložljive vloge za učinek so:<ul><li>Svetlo – svetlejše od barve za gumb.</li><li>Srednje svetlo – med barvama za gumb in Svetlo.</li><li>Srednje temno – med barvama za gumb in Temno</li><li>Temno – temnejše od barve za gumb.</li><li>Senca – zelo temna barva.</li></ul></translation> + </message> + <message> + <source>Light</source> + <translation>Svetlo</translation> + </message> + <message> + <source>Midlight</source> + <translation>Srednje svetlo</translation> + </message> + <message> + <source>Mid</source> + <translation>Srednje temno</translation> + </message> + <message> + <source>Dark</source> + <translation>Temno</translation> + </message> + <message> + <source>Shadow</source> + <translation>Senca</translation> + </message> + <message> + <source>Select Co&lor:</source> + <translation>Izberite b&arvo:</translation> + </message> + <message> + <source>Choose a color for the selected effect color role.</source> + <translation>Izberite barvo za izbrano barvno vlogo učinka.</translation> + </message> + <message> + <source>OK</source> + <translation>V redu</translation> + </message> + <message> + <source>Close dialog and apply all changes.</source> + <translation>Zapre pogovorno okno in uveljavi spremembe.</translation> + </message> + <message> + <source>Cancel</source> + <translation>Prekliči</translation> + </message> + <message> + <source>Close dialog and discard all changes.</source> + <translation>Zapre pogovorno okno in zavrže spremembe.</translation> + </message> +</context> +<context> + <name>PreviewFrame</name> + <message> + <source>Desktop settings will only take effect after an application restart.</source> + <translation>Nastavitve namizja bodo stopile v veljavo po ponovnem zagonu programa.</translation> + </message> +</context> +<context> + <name>PreviewWidgetBase</name> + <message> + <source>Preview Window</source> + <translation>Okno ogleda</translation> + </message> + <message> + <source>ButtonGroup</source> + <translation>SkupinaGumbov</translation> + </message> + <message> + <source>RadioButton1</source> + <translation>IzbirniGumb1</translation> + </message> + <message> + <source>RadioButton2</source> + <translation>IzbirniGumb2</translation> + </message> + <message> + <source>RadioButton3</source> + <translation>IzbirniGumb3</translation> + </message> + <message> + <source>ButtonGroup2</source> + <translation>SkupinaGumbov2</translation> + </message> + <message> + <source>CheckBox1</source> + <translation>PotrditvenoPolje1</translation> + </message> + <message> + <source>CheckBox2</source> + <translation>PotrditvenoPolje2</translation> + </message> + <message> + <source>LineEdit</source> + <translation>UrejevalnaVrstica</translation> + </message> + <message> + <source>ComboBox</source> + <translation>SpustniSeznam</translation> + </message> + <message> + <source>PushButton</source> + <translation>Gumb</translation> + </message> + <message> + <source><p> +<a href="http://qt.nokia.com">http://qt.nokia.com</a> +</p> +<p> +<a href="http://www.kde.org">http://www.kde.org</a> +</p></source> + <translation><p> +<a href="http://qt.nokia.com/">qt.nokia.com</a> +</p> +<p> +<a href="http://www.kde.org/">www.kde.org</a> +</p></translation> + </message> +</context> +</TS> diff --git a/translations/qvfb_sl.ts b/translations/qvfb_sl.ts new file mode 100644 index 0000000..251ba19 --- /dev/null +++ b/translations/qvfb_sl.ts @@ -0,0 +1,422 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="sl"> + <extra-po-header-po_revision_date>2010-08-28 16:47+0200</extra-po-header-po_revision_date> + <extra-po-headers>MIME-Version,Content-Type,Content-Transfer-Encoding,Plural-Forms,X-Language,X-Qt-Contexts,Last-Translator,PO-Revision-Date,Project-Id-Version,Language-Team,X-Generator</extra-po-headers> + <extra-po-header-x_generator>Lokalize 1.1</extra-po-header-x_generator> + <extra-po-header-language_team>Slovenian <lugos-slo@lugos.si></extra-po-header-language_team> + <extra-po-header-project_id_version></extra-po-header-project_id_version> + <extra-po-header_comment># Jure Repinc <jlp@holodeck1.com>, 2010.</extra-po-header_comment> + <extra-po-header-last_translator>Jure Repinc <jlp@holodeck1.com></extra-po-header-last_translator> +<context> + <name>AnimationSaveWidget</name> + <message> + <source>Record</source> + <translation>Posnemi</translation> + </message> + <message> + <source>Reset</source> + <translation>Ponastavi</translation> + </message> + <message> + <source>Save</source> + <translation>Shrani</translation> + </message> + <message> + <source>Save in MPEG format (requires netpbm package installed)</source> + <translation>Shrani v obliko MPEG (potrebuje nameščen paket netpbm)</translation> + </message> + <message> + <source>Click record to begin recording.</source> + <translation>Kliknite Posnemi za začetek snemanja.</translation> + </message> + <message> + <source>Finished saving.</source> + <translation>Shranjevanje zaključeno.</translation> + </message> + <message> + <source>Paused. Click record to resume, or save if done.</source> + <translation>Premor. Za nadaljevanje kliknite Posnemi, če ste zaključili pa Shrani.</translation> + </message> + <message> + <source>Pause</source> + <translation>Premor</translation> + </message> + <message> + <source>Recording...</source> + <translation>Snemanje ...</translation> + </message> + <message> + <source>Saving... </source> + <translation>Shranjevanje ... </translation> + </message> + <message> + <source>Save animation...</source> + <translation>Shrani animacijo ...</translation> + </message> + <message> + <source>Save canceled.</source> + <translation>Shranjevanje preklicano</translation> + </message> + <message> + <source>Save failed!</source> + <translation>Shranjevanje ni uspelo.</translation> + </message> +</context> +<context> + <name>Config</name> + <message> + <source>Configure</source> + <translation>Nastavi</translation> + </message> + <message> + <source>Size</source> + <translation>Velikost</translation> + </message> + <message> + <source>176x220 "SmartPhone"</source> + <translation>176⨯220 (pametni telefon)</translation> + </message> + <message> + <source>240x320 "PDA"</source> + <translation>240⨯320 (dlančnik)</translation> + </message> + <message> + <source>320x240 "TV" / "QVGA"</source> + <translation>320⨯240 (TV/QVGA)</translation> + </message> + <message> + <source>640x480 "VGA"</source> + <translation>640⨯480 (VGA)</translation> + </message> + <message> + <source>800x480</source> + <translation>800⨯480</translation> + </message> + <message> + <source>800x600</source> + <translation>800⨯600</translation> + </message> + <message> + <source>1024x768</source> + <translation>1024⨯768</translation> + </message> + <message> + <source>Custom</source> + <translation>Po meri</translation> + </message> + <message> + <source>Depth</source> + <translation>Globina</translation> + </message> + <message> + <source>1 bit monochrome</source> + <translation>1 bit enobarvno</translation> + </message> + <message> + <source>2 bit grayscale</source> + <translation>2 bita sivine</translation> + </message> + <message> + <source>4 bit grayscale</source> + <translation>4 bite sivine</translation> + </message> + <message> + <source>8 bit</source> + <translation>8 bitov</translation> + </message> + <message> + <source>12 (16) bit</source> + <translation>12 (16) bitov</translation> + </message> + <message> + <source>15 bit</source> + <translation>15 bitov</translation> + </message> + <message> + <source>16 bit</source> + <translation>16 bitov</translation> + </message> + <message> + <source>18 bit</source> + <translation>18 bitov</translation> + </message> + <message> + <source>24 bit</source> + <translation>24 bitov</translation> + </message> + <message> + <source>32 bit</source> + <translation>32 bitov</translation> + </message> + <message> + <source>32 bit ARGB</source> + <translation>32-bitov ARGB</translation> + </message> + <message> + <source>Swap red and blue channels</source> + <translation>Izmenjaj modri in rdeči kanal</translation> + </message> + <message> + <source>BGR format</source> + <translation>Format BGR</translation> + </message> + <message> + <source>Skin</source> + <translation>Tema</translation> + </message> + <message> + <source>None</source> + <translation>Brez</translation> + </message> + <message> + <source>Emulate touch screen (no mouse move)</source> + <translation>Posnemaj zaslon na dotik (brez premikov miške)</translation> + </message> + <message> + <source>Emulate LCD screen (Only with fixed zoom of 3.0 times magnification)</source> + <translation>Posnemaj zaslon LCD (samo s stalno 3.0⨯ povećavo)</translation> + </message> + <message> + <source><p>Note that any applications using the virtual framebuffer will be terminated if you change the Size or Depth <i>above</i>. You may freely modify the Gamma <i>below</i>.</source> + <translation><p>Vedite, da bo ob spremembi velikosti ali globine vsak program, ki uporablja navidezni slikovni medpomnilnik, končan. Gamo lahko prosto spreminjate.</translation> + </message> + <message> + <source>Gamma</source> + <translation>Gama</translation> + </message> + <message> + <source>Blue</source> + <translation>Modra</translation> + </message> + <message> + <source>1.0</source> + <translation>1,0</translation> + </message> + <message> + <source>Green</source> + <translation>Zelena</translation> + </message> + <message> + <source>All</source> + <translation>Vse</translation> + </message> + <message> + <source>Red</source> + <translation>Rdeča</translation> + </message> + <message> + <source>Set all to 1.0</source> + <translation>Nastavi vse na 1,0</translation> + </message> + <message> + <source>&OK</source> + <translation>&V redu</translation> + </message> + <message> + <source>&Cancel</source> + <translation>&Prekliči</translation> + </message> +</context> +<context> + <name>DeviceSkin</name> + <message> + <source>The image file '%1' could not be loaded.</source> + <translation>Slikovne datoteke »%1« ni bilo moč naložiti.</translation> + </message> + <message> + <source>The skin directory '%1' does not contain a configuration file.</source> + <translation>Mapa s temo »%1« ne vsebuje nastavitvene datoteke.</translation> + </message> + <message> + <source>The skin configuration file '%1' could not be opened.</source> + <translation>Nastavitvene datoteke za temo »%1« ni bilo moč odpreti.</translation> + </message> + <message> + <source>The skin configuration file '%1' could not be read: %2</source> + <translation>Nastavitvene datoteke za temo »%1« ni bilo moč prebrati: %2</translation> + </message> + <message> + <source>Syntax error: %1</source> + <translation>Skladenjska napaka: %1</translation> + </message> + <message> + <source>The skin "up" image file '%1' does not exist.</source> + <translation>Datoteka slike »up« teme »%1« ne obstaja.</translation> + </message> + <message> + <source>The skin "down" image file '%1' does not exist.</source> + <translation>Datoteka slike »down« teme »%1« ne obstaja.</translation> + </message> + <message> + <source>The skin "closed" image file '%1' does not exist.</source> + <translation>Datoteka slike »closed« teme »%1« ne obstaja.</translation> + </message> + <message> + <source>The skin cursor image file '%1' does not exist.</source> + <translation>Slikovna datoteka s kazalcem za temo »%1« ne obstaja.</translation> + </message> + <message> + <source>Syntax error in area definition: %1</source> + <translation>Skladenjska napaka pri določitvi območja: %1</translation> + </message> + <message> + <source>Mismatch in number of areas, expected %1, got %2.</source> + <translation>Neujemanje v številu območij, pričakovano %1, dobljeno %2.</translation> + </message> +</context> +<context> + <name>QVFb</name> + <message> + <source>&File</source> + <translation>&Datoteka</translation> + </message> + <message> + <source>&Configure...</source> + <translation>&Nastavi ...</translation> + </message> + <message> + <source>&Save image...</source> + <translation>&Shrani sliko ...</translation> + </message> + <message> + <source>&Animation...</source> + <translation>&Animacija ...</translation> + </message> + <message> + <source>&Quit</source> + <translation>Konča&j</translation> + </message> + <message> + <source>&View</source> + <translation>&Videz</translation> + </message> + <message> + <source>Show &Cursor</source> + <translation>Prikaži &kazalec</translation> + </message> + <message> + <source>&Refresh Rate...</source> + <translation>&Hitrost osveževanja ...</translation> + </message> + <message> + <source>&No rotation</source> + <translation>&Brez zasuka</translation> + </message> + <message> + <source>&90° rotation</source> + <translation>Zasuk za &90°</translation> + </message> + <message> + <source>1&80° rotation</source> + <translation>Zasuk za 1&80°</translation> + </message> + <message> + <source>2&70° rotation</source> + <translation>Zasuk za 2&70°</translation> + </message> + <message> + <source>Zoom scale &0.5</source> + <translation>Povečava &0,5</translation> + </message> + <message> + <source>Zoom scale 0.7&5</source> + <translation>Povečava 0,7&5</translation> + </message> + <message> + <source>Zoom scale &1</source> + <translation>Povečeva &1,0</translation> + </message> + <message> + <source>Zoom scale &2</source> + <translation>Povečava &2,0</translation> + </message> + <message> + <source>Zoom scale &3</source> + <translation>Povečeva &3,0</translation> + </message> + <message> + <source>Zoom scale &4</source> + <translation>Povečava &4,0</translation> + </message> + <message> + <source>Zoom &scale...</source> + <translation>&Povečava ...</translation> + </message> + <message> + <source>&Help</source> + <translation>&Pomoč</translation> + </message> + <message> + <source>&About...</source> + <translation>&O ...</translation> + </message> + <message> + <source>Save Main Screen image</source> + <translation>Shrani sliko glavnega zaslona</translation> + </message> + <message> + <source>snapshot.png</source> + <translation>posnetek.png</translation> + </message> + <message> + <source>Portable Network Graphics (*.png)</source> + <translation>Portable Network Graphics (*.png)</translation> + </message> + <message> + <source>Save Main Screen Image</source> + <translation>Shrani sliko glavnega zaslona</translation> + </message> + <message> + <source>Save failed. Check that you have permission to write to the target directory.</source> + <translation>Shranjevanje ni uspelo. Preverite dovoljenja za pisanje v ciljno mapo.</translation> + </message> + <message> + <source>Save Second Screen image</source> + <translation>Shrani sliko drugega zaslona</translation> + </message> + <message> + <source>Save Second Screen Image</source> + <translation>Shrani sliko drugega zaslona</translation> + </message> + <message> + <source>About QVFB</source> + <translation>O QVFB</translation> + </message> + <message> + <source><h2>The Qt for Embedded Linux Virtual X11 Framebuffer</h2><p>This application runs under Qt for X11, emulating a simple framebuffer, which the Qt for Embedded Linux server and clients can attach to just as if it was a hardware Linux framebuffer. <p>With the aid of this development tool, you can develop Qt for Embedded Linux applications under X11 without having to switch to a virtual console. This means you can comfortably use your other development tools such as GUI profilers and debuggers.</source> + <translation><h2>Qt for Embedded Linux Virtual X11 Framebuffer</h2><p>Ta program teče pod okenskim sistemom X11 in posnema preprost slikovni medpomnilnik, na katerega se lahko strežniki in odjemalci, izdelani s Qt za vgrajeni Linux, priklopijo, kot da bi bil pravi strojni slikovni medpomnilnik Linuxa.<p>S pomočjo tega orodja lahko programe Qt za vgrajeni Linux razvijate pod X11, ne da bi bilo potrebno preklopiti v navidezno konzolo. To pomeni, da lahko še naprej udobno uporabljate druga razvojna orodja, kot so grafični profilirniki in razhroščevalniki.</translation> + </message> + <message> + <source>Browse...</source> + <translation>Brskanje ...</translation> + </message> + <message> + <source>Load Custom Skin...</source> + <translation>Naloži temo po meri ...</translation> + </message> + <message> + <source>All QVFB Skins (*.skin)</source> + <translation>Vse teme za QVFB (*.skin)</translation> + </message> +</context> +<context> + <name>QVFbRateDialog</name> + <message> + <source>Target frame rate:</source> + <translation>Ciljna hitrost sličic:</translation> + </message> + <message> + <source>%1fps</source> + <translation>%1 sl./s</translation> + </message> + <message> + <source>OK</source> + <translation>V redu</translation> + </message> + <message> + <source>Cancel</source> + <translation>Prekliči</translation> + </message> +</context> +</TS> diff --git a/translations/translations.pri b/translations/translations.pri index fbc1596..1576bd5 100644 --- a/translations/translations.pri +++ b/translations/translations.pri @@ -47,8 +47,8 @@ addTsTargets(qt, -I../include -I../include/Qt \ xmlpatterns \ ) addTsTargets(designer, ../tools/designer/designer.pro) -addTsTargets(linguist, ../tools/linguist/linguist/linguist.pro) -addTsTargets(assistant, ../tools/assistant/tools/assistant/assistant.pro) +addTsTargets(linguist, ../tools/linguist/linguist.pro) +addTsTargets(assistant, ../tools/assistant/tools/tools.pro) addTsTargets(qt_help, ../tools/assistant/lib/lib.pro) addTsTargets(qtconfig, ../tools/qtconfig/qtconfig.pro) addTsTargets(qvfb, ../tools/qvfb/qvfb.pro) |