diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-09-28 05:06:56 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-09-28 05:06:56 (GMT) |
commit | bfd5b875701e36d8aa2637548a67511d6d1082d0 (patch) | |
tree | cbcbded97c90f0afa731df0da18158d8ef4dd595 | |
parent | 3a927312dbb797f03b351067210b83784c7132cb (diff) | |
parent | 7b796b4dcdebfba55c4754d241edb334217fc550 (diff) | |
download | Qt-bfd5b875701e36d8aa2637548a67511d6d1082d0.zip Qt-bfd5b875701e36d8aa2637548a67511d6d1082d0.tar.gz Qt-bfd5b875701e36d8aa2637548a67511d6d1082d0.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
88 files changed, 1544 insertions, 509 deletions
diff --git a/bin/createpackage.pl b/bin/createpackage.pl index cce0b54..85be5d3 100755 --- a/bin/createpackage.pl +++ b/bin/createpackage.pl @@ -212,21 +212,21 @@ my $certpath = File::Spec->catdir($scriptpath, File::Spec->updir(), "src/s60inst # Check some pre-conditions and print error messages if needed. unless (length($templatepkg)) { - print "\nError: Template PKG filename is not defined!\n"; + print "\nERROR: Template PKG filename is not defined!\n"; Usage(); } # Check template exist stat($templatepkg); unless( -e _ ) { - print "\nError: Package description file '$templatepkg' does not exist!\n"; + print "\nERROR: Package description file '$templatepkg' does not exist!\n"; Usage(); } # Check certifcate preconditions and set default certificate variables if needed if (length($certificate)) { unless(length($key)) { - print "\nError: Custom certificate key file parameter missing.!\n"; + print "\nERROR: Custom certificate key file parameter missing.!\n"; Usage(); } } else { @@ -261,7 +261,7 @@ if (length($certfile)) { # Do some validation unless(scalar(@certinfo) >= 2 && scalar(@certinfo) <= 3 && length($certinfo[0]) && length($certinfo[1]) ) { - print "\nError: $certfile line '$_' does not contain valid information!\n"; + print "\nERROR: $certfile line '$_' does not contain valid information!\n"; Usage(); } @@ -280,14 +280,14 @@ if (!$preservePkgOutput) { local $/; # read template file -open( TEMPLATE, $templatepkg) or die "Error '$templatepkg': $!\n"; +open( TEMPLATE, $templatepkg) or die "ERROR: '$templatepkg': $!"; $_=<TEMPLATE>; close (TEMPLATE); # If the pkg file does not contain macros, there is no need for platform or target. if (m/\$\(PLATFORM\)/) { unless (length($platform) && length($target)) { - print "\nError: Platform or target is not defined!\n"; + print "\nERROR: Platform or target is not defined!\n"; Usage(); } } @@ -297,7 +297,7 @@ s/\$\(PLATFORM\)/$platform/gm; s/\$\(TARGET\)/$target/gm; #write the output -open( OUTPUT, ">$pkgoutput" ) or die "Error '$pkgoutput' $!\n"; +open( OUTPUT, ">$pkgoutput" ) or die "ERROR: '$pkgoutput' $!"; print OUTPUT $_; close OUTPUT; @@ -306,7 +306,7 @@ if ($preprocessonly) { } if($stub) { - if(!($epocroot)) { die("EPOCROOT must be set to create stub sis files"); } + if(!($epocroot)) { die("ERROR: EPOCROOT must be set to create stub sis files"); } my $systeminstall = "$epocroot/epoc32/data/z/system/install"; mkpath($systeminstall); my $stub_sis_name = $systeminstall."/".$stub_sis_name; @@ -319,15 +319,15 @@ if($stub) { && !$onlyUnsigned) { print("Auto-patching capabilities for self signed package.\n"); my $patch_capabilities = File::Spec->catfile(dirname($0), "patch_capabilities"); - system ("$patch_capabilities $pkgoutput"); + system ("$patch_capabilities $pkgoutput") and die ("ERROR: Automatic patching failed"); } # Create SIS. # The 'and' is because system uses 0 to indicate success. if($epocroot) { - system ("$epocroot/epoc32/tools/makesis $pkgoutput $unsigned_sis_name") and die ("makesis failed"); + system ("$epocroot/epoc32/tools/makesis $pkgoutput $unsigned_sis_name") and die ("ERROR: makesis failed"); } else { - system ("makesis $pkgoutput $unsigned_sis_name") and die ("makesis failed"); + system ("makesis $pkgoutput $unsigned_sis_name") and die ("ERROR: makesis failed"); } print("\n"); @@ -354,7 +354,7 @@ if($stub) { my $relcert = File::Spec->abs2rel($certificate); my $relkey = File::Spec->abs2rel($key); # The 'and' is because system uses 0 to indicate success. - system ("signsis $unsigned_sis_name $signed_sis_name $relcert $relkey $passphrase") and die ("signsis failed"); + system ("signsis $unsigned_sis_name $signed_sis_name $relcert $relkey $passphrase") and die ("ERROR: signsis failed"); # Check if creating signed SIS Succeeded stat($signed_sis_name); diff --git a/bin/patch_capabilities.pl b/bin/patch_capabilities.pl index a85f073..06ab116 100755 --- a/bin/patch_capabilities.pl +++ b/bin/patch_capabilities.pl @@ -152,7 +152,7 @@ if (@ARGV) my $newLine = $line; # Patch pkg UID if it's in protected range - if ($line =~ m/^\#.*\((0x[0-7][0-9|a-f|A-F]*)\).*$/) + if ($line =~ m/^\#.*\((0x[0-7][0-9a-fA-F]*)\).*$/) { my $oldUID = $1; my $newUID = $oldUID; @@ -162,7 +162,7 @@ if (@ARGV) } # Patch embedded sis name and UID if UID is in protected range - if ($line =~ m/^@\"*(.*\.sis).*\((0x[0-7][0-9|a-f|A-F]*)\).*$/) + if ($line =~ m/^@\"*(.*\.sis).*\((0x[0-7][0-9a-fA-F]*)\).*$/) { my $oldSisName = $1; my $oldUID = $2; @@ -280,7 +280,16 @@ if (@ARGV) my $capabilitiesToAllow = join(" ", @capabilitiesToAllow); my @capabilitiesToDrop; while (<$dllCaps>) { - if (/^Vendor ID: (.*)$/) { + if (/^Secure ID: ([0-7][0-9a-fA-F]*)$/) { + my $exeSid = $1; + if ($binaryBaseName =~ /\.exe$/) { + # Installer refuses to install protected executables in a self signed package, so abort if one is detected. + # We can't simply just patch the executable SID, as any registration resources executable uses will be linked to it via SID. + print ("Patching: Executable with SID in the protected range (0x$exeSid) detected: \"$binaryBaseName\". A self-signed sis with protected executables is not supported.\n"); + exit(1); + } + } + if (/^Vendor ID: ([0-9a-fA-F]*)$/) { $originalVid = "$1"; } if (!$capsFound) { @@ -303,8 +312,15 @@ if (@ARGV) my $capsToDropStr = join("\", \"", @capabilitiesToDrop); $capsToDropStr =~ s/\", \"$//; - print ("Patching: The following capabilities used in \"$binaryBaseName\" are not compatible with a self-signed package and will be removed: \"$capsToDropStr\".\n"); - $executeNeeded = 1; + if ($binaryBaseName =~ /\.exe$/) { + # While libraries often have capabilities they do not themselves need just to enable them to be loaded by wider variety of processes, + # executables are more likely to need every capability they have been assigned or they won't function correctly. + print ("Patching: Executable with capabilities incompatible with self-signing detected: \"$binaryBaseName\". (Incompatible capabilities: \"$capsToDropStr\".) Reducing capabilities is only supported for libraries.\n"); + exit(1); + } else { + print ("Patching: The following capabilities used in \"$binaryBaseName\" are not compatible with a self-signed package and will be removed: \"$capsToDropStr\".\n"); + $executeNeeded = 1; + } } $commandToExecute = sprintf($baseCommandToExecute, join(" ", @capabilitiesToSet)); } diff --git a/dist/changes-4.7.1 b/dist/changes-4.7.1 index c8b26c2..5f33ce8 100644 --- a/dist/changes-4.7.1 +++ b/dist/changes-4.7.1 @@ -26,6 +26,11 @@ Optimizations - Improved the benchmarking library's timing code * Uses a faster access to the system clock + - Introduction of SSSE3 for alpha blending of images. + + - On x86 and 86_64, the memory access has been improved for alpha blending + and for some composition functions. + * See list of Important Behavior Changes below @@ -40,6 +45,15 @@ QtCore QtGui ----- + - QGraphicsWidget + * [QTBUG-13188] Make sure a font that has propagated from a parent can + be set on a QPainter. + + + - QStaticText + * [QTBUG-12614] Fix crash with zero-width string. + * [QTBUG-12540] Fix rendering of large glyphs with OpenGL2 paint engine. + QtDBus ------ @@ -51,6 +65,10 @@ QtMultimedia QtNetwork --------- + - QSslConfiguration + * [QTBUG-13265] fix crash with empty configuration + - QSslCertificate + * [QTBUG-12489] support dates > 2049 QtOpenGL @@ -72,11 +90,23 @@ QtSql QtSvg ----- +QtXmlPatterns +------------- + - XML Schema internals: + * [QTBUG-11559] Only parse 3 digits of time fraction + +QtDeclarative +------------- + - QML debugging: + * [QTBUG-5162] The debugger is now activated with -qmljsdebugger command + line arg to enable support for platforms without environment variables Qt Plugins ---------- - + - Jpeg image IO plugin + * [QTBUG-13653] Fixed infinite loop when loading jpeg without EOI marker + from memory. **************************************************************************** * Platform Specific Changes * @@ -88,7 +118,7 @@ Qt for Unix (X11 and Mac OS X) Qt for Linux/X11 ---------------- - + - The configure script now detects all vector extensions of x86 and x86_64 Qt for Windows -------------- @@ -96,7 +126,7 @@ Qt for Windows Qt for Mac OS X --------------- - + - The configure script now detects all vector extensions of x86 and x86_64 Qt for Symbian -------------- @@ -110,6 +140,7 @@ Qt for Symbian - Designer - uic + * Improve warnings and error reports **************************************************************************** * Important Behavior Changes * diff --git a/doc/src/declarative/qdeclarativedebugging.qdoc b/doc/src/declarative/qdeclarativedebugging.qdoc index ea21852..64c312c 100644 --- a/doc/src/declarative/qdeclarativedebugging.qdoc +++ b/doc/src/declarative/qdeclarativedebugging.qdoc @@ -79,20 +79,8 @@ QDeclarativeImportDatabase::resolveType "Rectangle" = "QDeclarativeRectangle" \section1 Debugging with Qt Creator \l{http://qt.nokia.com/products/developer-tools}{Qt Creator} provides built-in -support for QML debugging. Open a QML project in Creator and enter Debug mode, -or click the "Start Debugging" option from the menu, and Creator will -show QML debugging information and options for your application, including -object inspection, property monitoring and application frame-rate analysis. - -Creator can be used to debug both local and remote QML applications. To -enable remote debugging, start the \l {QML Viewer} -on the remote device with a debugging port defined, like this: - -\code - QML_DEBUG_SERVER_PORT=3768 qmlviewer myqmlfile.qml -\endcode - -In Creator, open the project settings pane and set the server and port -details for the remote device, then start debugging. +support for QML debugging. QML projects and standalone C++ applications that +utilize QML can be debugged on desktops as well as on remote devices. +For more information, see the Qt Creator Manual. */ diff --git a/examples/declarative/ui-components/searchbox/SearchBox.qml b/examples/declarative/ui-components/searchbox/SearchBox.qml index 60fa799..d000750 100644 --- a/examples/declarative/ui-components/searchbox/SearchBox.qml +++ b/examples/declarative/ui-components/searchbox/SearchBox.qml @@ -54,7 +54,7 @@ FocusScope { source: "images/lineedit-bg-focus.png" width: parent.width; height: parent.height border { left: 4; top: 4; right: 4; bottom: 4 } - visible: parent.wantsFocus ? true : false + visible: parent.activeFocus ? true : false } Text { diff --git a/examples/xml/rsslisting/main.cpp b/examples/xml/rsslisting/main.cpp index 95c8a89..71ae0eb 100644 --- a/examples/xml/rsslisting/main.cpp +++ b/examples/xml/rsslisting/main.cpp @@ -57,7 +57,6 @@ Provides the main function for the RSS news reader example. int main(int argc, char **argv) { QApplication app(argc, argv); - qWarning("The usage of QHttp is not recommended anymore, please use QNetworkAccessManager."); RSSListing *rsslisting = new RSSListing; rsslisting->show(); return app.exec(); diff --git a/examples/xml/rsslisting/rsslisting.cpp b/examples/xml/rsslisting/rsslisting.cpp index b7c9eb0..48c3062 100644 --- a/examples/xml/rsslisting/rsslisting.cpp +++ b/examples/xml/rsslisting/rsslisting.cpp @@ -65,21 +65,19 @@ its operation, and also allows very large data sources to be read. Constructs an RSSListing widget with a simple user interface, and sets up the XML reader to use a custom handler class. - The user interface consists of a line edit, two push buttons, and a + The user interface consists of a line edit, a push button, and a list view widget. The line edit is used for entering the URLs of news - sources; the push buttons start and abort the process of reading the + sources; the push button starts the process of reading the news. */ RSSListing::RSSListing(QWidget *parent) - : QWidget(parent) + : QWidget(parent), currentReply(0) { lineEdit = new QLineEdit(this); lineEdit->setText("http://labs.qt.nokia.com/blogs/feed"); fetchButton = new QPushButton(tr("Fetch"), this); - abortButton = new QPushButton(tr("Abort"), this); - abortButton->setEnabled(false); treeWidget = new QTreeWidget(this); connect(treeWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)), @@ -89,15 +87,11 @@ RSSListing::RSSListing(QWidget *parent) treeWidget->setHeaderLabels(headerLabels); treeWidget->header()->setResizeMode(QHeaderView::ResizeToContents); - connect(&http, SIGNAL(readyRead(QHttpResponseHeader)), - this, SLOT(readData(QHttpResponseHeader))); - - connect(&http, SIGNAL(requestFinished(int,bool)), - this, SLOT(finished(int,bool))); + connect(&manager, SIGNAL(finished(QNetworkReply*)), + this, SLOT(finished(QNetworkReply*))); connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(fetch())); connect(fetchButton, SIGNAL(clicked()), this, SLOT(fetch())); - connect(abortButton, SIGNAL(clicked()), &http, SLOT(abort())); QVBoxLayout *layout = new QVBoxLayout(this); @@ -105,7 +99,6 @@ RSSListing::RSSListing(QWidget *parent) hboxLayout->addWidget(lineEdit); hboxLayout->addWidget(fetchButton); - hboxLayout->addWidget(abortButton); layout->addLayout(hboxLayout); layout->addWidget(treeWidget); @@ -115,34 +108,53 @@ RSSListing::RSSListing(QWidget *parent) } /* + Starts the network request and connects the needed signals +*/ +void RSSListing::get(const QUrl &url) +{ + QNetworkRequest request(url); + if (currentReply) { + currentReply->disconnect(this); + currentReply->deleteLater(); + } + currentReply = manager.get(request); + connect(currentReply, SIGNAL(readyRead()), this, SLOT(readyRead())); + connect(currentReply, SIGNAL(metaDataChanged()), this, SLOT(metaDataChanged())); + connect(currentReply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(error(QNetworkReply::NetworkError))); +} + +/* Starts fetching data from a news source specified in the line edit widget. The line edit is made read only to prevent the user from modifying its contents during the fetch; this is only for cosmetic purposes. - The fetch button is disabled, and the abort button is enabled to allow - the user to interrupt processing. The list view is cleared, and we + The fetch button is disabled, the list view is cleared, and we define the last list view item to be 0, meaning that there are no existing items in the list. - The HTTP handler is supplied with the raw contents of the line edit and - a fetch is initiated. We keep the ID value returned by the HTTP handler - for future reference. + A URL is created with the raw contents of the line edit and + a get is initiated. */ void RSSListing::fetch() { lineEdit->setReadOnly(true); fetchButton->setEnabled(false); - abortButton->setEnabled(true); treeWidget->clear(); xml.clear(); QUrl url(lineEdit->text()); + get(url); +} - http.setHost(url.host()); - connectionId = http.get(url.path()); +void RSSListing::metaDataChanged() +{ + QUrl redirectionTarget = currentReply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl(); + if (redirectionTarget.isValid()) { + get(redirectionTarget); + } } /* @@ -150,16 +162,14 @@ void RSSListing::fetch() We read all the available data, and pass it to the XML stream reader. Then we call the XML parsing function. - - If parsing fails for any reason, we abort the fetch. */ -void RSSListing::readData(const QHttpResponseHeader &resp) +void RSSListing::readyRead() { - if (resp.statusCode() != 200) - http.abort(); - else { - xml.addData(http.readAll()); + int statusCode = currentReply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); + if (statusCode >= 200 && statusCode < 300) { + QByteArray data = currentReply->readAll(); + xml.addData(data); parseXml(); } } @@ -177,19 +187,11 @@ void RSSListing::readData(const QHttpResponseHeader &resp) user interface available to the user for further input. */ -void RSSListing::finished(int id, bool error) +void RSSListing::finished(QNetworkReply *reply) { - if (error) { - qWarning("Received error during HTTP fetch."); - lineEdit->setReadOnly(false); - abortButton->setEnabled(false); - fetchButton->setEnabled(true); - } - else if (id == connectionId) { - lineEdit->setReadOnly(false); - abortButton->setEnabled(false); - fetchButton->setEnabled(true); - } + Q_UNUSED(reply); + lineEdit->setReadOnly(false); + fetchButton->setEnabled(true); } @@ -225,7 +227,6 @@ void RSSListing::parseXml() } if (xml.error() && xml.error() != QXmlStreamReader::PrematureEndOfDocumentError) { qWarning() << "XML ERROR:" << xml.lineNumber() << ": " << xml.errorString(); - http.abort(); } } @@ -236,3 +237,11 @@ void RSSListing::itemActivated(QTreeWidgetItem * item) { QDesktopServices::openUrl(QUrl(item->text(1))); } + +void RSSListing::error(QNetworkReply::NetworkError) +{ + qWarning("error retrieving RSS feed"); + currentReply->disconnect(this); + currentReply->deleteLater(); + currentReply = 0; +} diff --git a/examples/xml/rsslisting/rsslisting.h b/examples/xml/rsslisting/rsslisting.h index 8939dfd..9387222 100644 --- a/examples/xml/rsslisting/rsslisting.h +++ b/examples/xml/rsslisting/rsslisting.h @@ -41,10 +41,12 @@ #ifndef RSSLISTING_H #define RSSLISTING_H -#include <QHttp> +#include <QNetworkAccessManager> +#include <QNetworkReply> #include <QWidget> #include <QBuffer> #include <QXmlStreamReader> +#include <QUrl> QT_BEGIN_NAMESPACE class QLineEdit; @@ -61,24 +63,26 @@ public: public slots: void fetch(); - void finished(int id, bool error); - void readData(const QHttpResponseHeader &); + void finished(QNetworkReply *reply); + void readyRead(); + void metaDataChanged(); void itemActivated(QTreeWidgetItem * item); + void error(QNetworkReply::NetworkError); private: void parseXml(); + void get(const QUrl &url); QXmlStreamReader xml; QString currentTag; QString linkString; QString titleString; - QHttp http; - int connectionId; + QNetworkAccessManager manager; + QNetworkReply *currentReply; QLineEdit *lineEdit; QTreeWidget *treeWidget; - QPushButton *abortButton; QPushButton *fetchButton; }; diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index 679731f..cc5b788 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -132,39 +132,49 @@ exists($${EPOCROOT}epoc32/tools/qt/mkspecs/features/environment.prf) { } # Try to detect SDK version if it wasn't set by environment.prf -isEmpty(S60_VERSION) { - # The Symbian^3 PDK does not necessarily contain the required sis files. - # However, libstdcppv5 first appeared in Symbian^3 (S60 5.2), so check for that too. - exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.2.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.2.sis)|exists($${EPOCROOT}epoc32/release/armv5/lib/libstdcppv5.dso) { - S60_VERSION = 5.2 +isEmpty(SYMBIAN_VERSION) { + exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/Symbianv4.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/Symbianv4.sis) { + SYMBIAN_VERSION = Symbian4 } else { - exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.1.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.1.sis) { - S60_VERSION = 5.1 + # The Symbian^3 PDK does not necessarily contain the required sis files. + # However, libstdcppv5 first appeared in Symbian^3 (S60 5.2), so check for that too. + exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.2.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.2.sis)|exists($${EPOCROOT}epoc32/release/armv5/lib/libstdcppv5.dso) { + SYMBIAN_VERSION = Symbian3 } else { - exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.0.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.0.sis) { - S60_VERSION = 5.0 + exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.1.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.1.sis) { + SYMBIAN_VERSION = Symbian2 } else { - exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v3.2.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v3.2.sis) { - S60_VERSION = 3.2 + exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.0.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.0.sis) { + SYMBIAN_VERSION = 9.4 } else { - S60_VERSION = 3.1 + exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v3.2.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v3.2.sis) { + SYMBIAN_VERSION = 9.3 + } else { + exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v3.1.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v3.1.sis) { + SYMBIAN_VERSION = 9.2 + } else { + SYMBIAN_VERSION = Unknown + } + } } } } } } -isEmpty(SYMBIAN_VERSION) { - contains(S60_VERSION, "3\\.1") { - SYMBIAN_VERSION = 9.2 - } else:contains(S60_VERSION, "3\\.2") { - SYMBIAN_VERSION = 9.3 - } else:contains(S60_VERSION, "5\\.0") { - SYMBIAN_VERSION = 9.4 - } else:contains(S60_VERSION, "5\\.1") { - SYMBIAN_VERSION = Symbian2 - } else:contains(S60_VERSION, "5\\.2") { - SYMBIAN_VERSION = Symbian3 +isEmpty(S60_VERSION) { + contains(SYMBIAN_VERSION, "9\\.2") { + S60_VERSION = 3.1 + } else:contains(SYMBIAN_VERSION, "9\\.3") { + S60_VERSION = 3.2 + } else:contains(SYMBIAN_VERSION, "9\\.4") { + S60_VERSION = 5.0 + } else:contains(SYMBIAN_VERSION, "Symbian2") { + S60_VERSION = 5.1 + } else:contains(SYMBIAN_VERSION, "Symbian3") { + S60_VERSION = 5.2 + } else { + S60_VERSION = Unknown } } @@ -174,14 +184,14 @@ isEmpty(SYMBIAN_VERSION) { default_deployment.pkg_prerules += pkg_depends_webkit pkg_depends_qt pkg_platform_dependencies -# Supports S60 3.0, 3.1, 3.2, 5.0 and Symbian^3 by default +# Supports S60 3.1, 3.2, 5.0, Symbian^3, and Symbian^4 by default pkg_platform_dependencies = \ "; Default HW/platform dependencies" \ - "[0x101F7961],0,0,0,{\"S60ProductID\"}" \ "[0x102032BE],0,0,0,{\"S60ProductID\"}" \ "[0x102752AE],0,0,0,{\"S60ProductID\"}" \ "[0x1028315F],0,0,0,{\"S60ProductID\"}" \ - "[0x20022e6d],0,0,0,{\"S60ProductID\"}" \ + "[0x20022E6D],0,0,0,{\"S60ProductID\"}" \ + "[0x20032DE7],0,0,0,{\"S60ProductID\"}" \ " " DEPLOYMENT += default_deployment diff --git a/src/3rdparty/webkit/.tag b/src/3rdparty/webkit/.tag index ae33228..fff71f4 100644 --- a/src/3rdparty/webkit/.tag +++ b/src/3rdparty/webkit/.tag @@ -1 +1 @@ -715b53069911a31a559aa0b3d94ffc6a5ac20988 +6e15c3404d15a8ab72242152ec966e5e388161a2 diff --git a/src/3rdparty/webkit/ChangeLog b/src/3rdparty/webkit/ChangeLog index 14d6da3..f438655 100644 --- a/src/3rdparty/webkit/ChangeLog +++ b/src/3rdparty/webkit/ChangeLog @@ -1,3 +1,11 @@ +2010-09-24 Romain Pokrzywka <romain@kdab.com> + + Reviewed by Simon Hausmann. + + [Qt] Fix the Wince build. + + * WebKit.pri: Apply msvc flags to wince, too. + 2010-07-01 Simon Hausmann <simon.hausmann@nokia.com> Rubber-stamped by Laszlo Gombos. diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog index 9922da6..c7e0fc2 100644 --- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog +++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog @@ -1,3 +1,39 @@ +2010-06-18 Tucker Jay <jay.tucker@nokia.com> + + Reviewed by NOBODY (OOPS!). + + [Symbian] Lazy commit of memory required in JSC register file + https://bugs.webkit.org/show_bug.cgi?id=34349 + + * JavaScriptCore.pro: Added 1 new Symbian source file + * interpreter/RegisterFile.cpp: + (JSC::RegisterFile::~RegisterFile): + * interpreter/RegisterFile.h: + (JSC::RegisterFile::): + (JSC::RegisterFile::start): + (JSC::RegisterFile::end): + (JSC::RegisterFile::size): + (JSC::RegisterFile::setNumGlobals): + (JSC::RegisterFile::numGlobals): + (JSC::RegisterFile::maxGlobals): + (JSC::RegisterFile::lastGlobal): + (JSC::RegisterFile::markGlobals): + (JSC::RegisterFile::markCallFrames): + (JSC::isPageAligned): + (JSC::RegisterFile::RegisterFile): + (JSC::RegisterFile::shrink): + (JSC::RegisterFile::grow): + * wtf/symbian/RegisterFileAllocatorSymbian.cpp: Added. + (WTF::RegisterFileAllocator::RegisterFileAllocator): + Helper class to allocate memory required by RegisterFile + more efficiently. + (WTF::RegisterFileAllocator::~RegisterFileAllocator): + (WTF::RegisterFileAllocator::buffer): + (WTF::RegisterFileAllocator::grow): + (WTF::RegisterFileAllocator::shrink): + * wtf/symbian/RegisterFileAllocatorSymbian.h: Added. + * wtf/symbian/SymbianDefines.h: Added. + 2010-06-16 Thiago Macieira <thiago.macieira@nokia.com> Reviewed by NOBODY (OOPS!). diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro index 3f1ac86..a805170 100644 --- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro +++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro @@ -208,6 +208,7 @@ SOURCES += \ wtf/qt/ThreadingQt.cpp \ wtf/RandomNumber.cpp \ wtf/RefCountedLeakCounter.cpp \ + wtf/symbian/RegisterFileAllocatorSymbian.cpp \ wtf/symbian/BlockAllocatorSymbian.cpp \ wtf/ThreadingNone.cpp \ wtf/Threading.cpp \ diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp b/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp index 510effe..4a33c62 100644 --- a/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp @@ -40,6 +40,8 @@ RegisterFile::~RegisterFile() VirtualFree(m_buffer, DWORD(m_commitEnd) - DWORD(m_buffer), MEM_DECOMMIT); #endif VirtualFree(m_buffer, 0, MEM_RELEASE); +#elif OS(SYMBIAN) + delete m_registerFileAllocator; #else fastFree(m_buffer); #endif diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.h b/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.h index 1fc4f82..80cf991 100644 --- a/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.h +++ b/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.h @@ -41,6 +41,10 @@ #include <sys/mman.h> #endif +#if OS(SYMBIAN) +#include <wtf/symbian/RegisterFileAllocatorSymbian.h> +#endif + namespace JSC { /* @@ -152,12 +156,21 @@ namespace JSC { #if HAVE(VIRTUALALLOC) Register* m_commitEnd; #endif +#if OS(SYMBIAN) + // Commits and frees a continguous chunk of memory as required + WTF::RegisterFileAllocator* m_registerFileAllocator; +#endif JSGlobalObject* m_globalObject; // The global object whose vars are currently stored in the register file. }; // FIXME: Add a generic getpagesize() to WTF, then move this function to WTF as well. - inline bool isPageAligned(size_t size) { return size != 0 && size % (8 * 1024) == 0; } + // This is still a hack that should be fixed later. We know that a Symbian page size is 4K. + #if OS(SYMBIAN) + inline bool isPageAligned(size_t size) { return size && !(size % (4 * 1024)); } + #else + inline bool isPageAligned(size_t size) { return size && !(size % (8 * 1024)); } + #endif inline RegisterFile::RegisterFile(size_t capacity, size_t maxGlobals) : m_numGlobals(0) @@ -204,7 +217,13 @@ namespace JSC { CRASH(); } m_commitEnd = reinterpret_cast<Register*>(reinterpret_cast<char*>(m_buffer) + committedSize); - #else + #elif OS(SYMBIAN) + m_registerFileAllocator = new WTF::RegisterFileAllocator(bufferLength); + m_buffer = (Register*)(m_registerFileAllocator->buffer()); + // start by committing enough space to hold maxGlobals + void* newEnd = (void*)((int)m_buffer + (maxGlobals * sizeof(Register))); + m_registerFileAllocator->grow(newEnd); + #else /* * If neither MMAP nor VIRTUALALLOC are available - use fastMalloc instead. * @@ -226,8 +245,13 @@ namespace JSC { if (newEnd >= m_end) return; m_end = newEnd; - if (m_end == m_start && (m_maxUsed - m_start) > maxExcessCapacity) + if (m_end == m_start && (m_maxUsed - m_start) > maxExcessCapacity) { +#if OS(SYMBIAN) + m_registerFileAllocator->shrink(newEnd); +#endif + releaseExcessCapacity(); + } } inline bool RegisterFile::grow(Register* newEnd) @@ -252,6 +276,9 @@ namespace JSC { m_commitEnd = reinterpret_cast<Register*>(reinterpret_cast<char*>(m_commitEnd) + size); } #endif +#if OS(SYMBIAN) + m_registerFileAllocator->grow((void*)newEnd); +#endif if (newEnd > m_maxUsed) m_maxUsed = newEnd; diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/RegisterFileAllocatorSymbian.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/RegisterFileAllocatorSymbian.cpp new file mode 100644 index 0000000..baa7841 --- /dev/null +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/RegisterFileAllocatorSymbian.cpp @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if OS(SYMBIAN) + +#include "RegisterFileAllocatorSymbian.h" + +namespace WTF { + +/** Efficiently allocates memory pools of size poolSize. + * Primarily designed for JSC RegisterFile's needs. + * Not thread-safe. + */ +RegisterFileAllocator::RegisterFileAllocator(TUint32 reservationSize, TUint32 poolSize) : + m_reserved(reservationSize), m_poolSize(poolSize) +{ + // Get system's page size value. + SYMBIAN_PAGESIZE(m_pageSize); + + // We only accept multiples of system page size for both initial reservation + // and the alignment/pool size + m_reserved = SYMBIAN_ROUNDUPTOMULTIPLE(m_reserved, m_pageSize); + __ASSERT_ALWAYS(SYMBIAN_ROUNDUPTOMULTIPLE(m_poolSize, m_pageSize), + User::Panic(_L("RegisterFileAllocator1"), KErrArgument)); + + // Open a Symbian RChunk, and reserve requested virtual address range + // Any thread in this process can operate this RChunk due to EOwnerProcess access rights. + TInt ret = m_chunk.CreateDisconnectedLocal(0 , 0, (TInt)m_reserved , EOwnerProcess); + if (ret != KErrNone) + User::Panic(_L("RegisterFileAllocator2"), ret); + + m_buffer = (void*)m_chunk.Base(); + m_resEnd = (void*)(m_chunk.Base() + m_chunk.MaxSize()); + m_comEnd = m_buffer; +} + +RegisterFileAllocator::~RegisterFileAllocator() +{ + // release everything! + m_chunk.Decommit(0, m_chunk.MaxSize()); + m_chunk.Close(); +} + +void* RegisterFileAllocator::buffer() const +{ + return m_buffer; +} + +void RegisterFileAllocator::grow(void* newEnd) +{ + // trying to commit more memory than reserved! + if (newEnd > m_resEnd) + return; + + if (newEnd > m_comEnd) { + TInt nBytes = (TInt)(newEnd) - (TInt)(m_comEnd); + nBytes = SYMBIAN_ROUNDUPTOMULTIPLE(nBytes, m_poolSize); + TInt offset = (TInt)m_comEnd - (TInt)m_buffer; + + TInt ret = m_chunk.Commit(offset, nBytes); + if (ret == KErrNone) + m_comEnd = (void*)(m_chunk.Base() + m_chunk.Size()); + } +} + +void RegisterFileAllocator::shrink(void* newEnd) +{ + if (newEnd < m_comEnd) { + TInt nBytes = (TInt)newEnd - (TInt)m_comEnd; + if (nBytes >= m_poolSize) { + TInt offset = SYMBIAN_ROUNDUPTOMULTIPLE((TUint)newEnd, m_poolSize) - (TInt)m_buffer; + nBytes = (TInt)m_comEnd - offset - (TInt)m_buffer; + if (nBytes > 0) { + TInt ret = m_chunk.Decommit(offset, nBytes); + if (ret == KErrNone) + m_comEnd = (void*)(m_chunk.Base() + m_chunk.Size()); + } + } + } +} + +} // end of namespace + +#endif // SYMBIAN diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/RegisterFileAllocatorSymbian.h b/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/RegisterFileAllocatorSymbian.h new file mode 100644 index 0000000..4cfc8c5 --- /dev/null +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/RegisterFileAllocatorSymbian.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef RegisterFileAllocatorSymbian_h +#define RegisterFileAllocatorSymbian_h + +#include "SymbianDefines.h" + +namespace WTF { + +/** + * Allocates contiguous regions of size poolSize. + * poolSize must be a multiple of system page size (typically 4K on Symbian/ARM) + * + * @param reservationSize Virtual address range to be reserved upon creation of chunk (bytes). + * @param poolSize Size of a single allocation. + */ +class RegisterFileAllocator { + +public: + RegisterFileAllocator( + TUint32 reservationSize, TUint32 poolSize = SYMBIAN_REGFILEALLOC_DEFAULTPOOLSIZE); + ~RegisterFileAllocator(); + void* buffer() const; + void grow(void* newEnd); + void shrink(void* newEnd); + +private: + RChunk m_chunk; // Symbian chunk that lets us reserve/commit/decommit + + // all following values are in numbers of bytes + TInt m_pageSize; // cached value of system page size, typically 4K on Symbian + TUint32 m_reserved; // total number of reserved bytes in virtual memory + TUint32 m_poolSize; // size of one memory pool, set by default to 64K in wtf/symbian/SymbianDefines.h + + void* m_buffer; // pointer to base of the chunk + void* m_comEnd; // pointer to end of currently committed memory + void* m_resEnd; // pointer to end of reserved memory + +}; + +} // end of namespace + +#endif // RegisterFileAllocatorSymbian_h diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/SymbianDefines.h b/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/SymbianDefines.h new file mode 100644 index 0000000..43e22b3 --- /dev/null +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/SymbianDefines.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SymbianDefines_h +#define SymbianDefines_h + +#include <e32cmn.h> +#include <e32std.h> +#include <hal.h> + +#define SYMBIAN_PAGESIZE(x) (HAL::Get(HALData::EMemoryPageSize, x)); +#define SYMBIAN_FREERAM(x) (HAL::Get(HALData::EMemoryRAMFree, x)); +#define SYMBIAN_ROUNDUPTOMULTIPLE(x, multipleof) ( (x + multipleof - 1) & ~(multipleof - 1) ) + +#define SYMBIAN_REGFILEALLOC_DEFAULTPOOLSIZE 65536 // 64K + +#endif // SymbianDefines_h diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index f919bdf..a270d56 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -4,4 +4,4 @@ This is a snapshot of the Qt port of WebKit from and has the sha1 checksum - 715b53069911a31a559aa0b3d94ffc6a5ac20988 + 6e15c3404d15a8ab72242152ec966e5e388161a2 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 2d20cbd..ac698e3 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,34 @@ +2010-09-24 Romain Pokrzywka <romain@kdab.com> + + Reviewed by Simon Hausmann. + + [Qt] Fix the Wince build. + + * WebCore.pro: Apply msvc flags to wince, too. + +2010-09-24 Anders Bakken <agbakken@gmail.com> + + Reviewed by Simon Hausmann. + + [Qt] Enable building Qt/Webkit with debug symbols + + With this patch one can configure with -webkit-debug to build Webkit + with debug symbols without having to manually edit WebCore.pro. + + * WebCore.pro: + +2010-09-16 Thomas Zander <t.zander@nokia.com> + + Reviewed by Andreas Kling. + + https://bugs.webkit.org/show_bug.cgi?id=45878 + + [Qt] Fixed incorrect Symbian scoping. + + The missing install functionality is only true for mmp based systems. + + * WebCore.pro: limit functionality to mmp systems. + 2010-09-09 Kristian Amlie <kristian.amlie@nokia.com> Reviewed by Andreas Kling. diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index 728bdf9..b7d6034 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -36,21 +36,6 @@ symbian: { # Workaroud for problems with paging this dll MMP_RULES -= PAGED MMP_RULES *= UNPAGED - - # Partial upgrade SIS file - vendorinfo = \ - "; Localised Vendor name" \ - "%{\"Nokia, Qt\"}" \ - " " \ - "; Unique Vendor name" \ - ":\"Nokia, Qt\"" \ - " " - pu_header = "; Partial upgrade package for testing QtCore changes without reinstalling everything" \ - "$${LITERAL_HASH}{\"Qt corelib\"}, (0x2001E61C), $${QT_MAJOR_VERSION},$${QT_MINOR_VERSION},$${QT_PATCH_VERSION}, TYPE=PU" - partial_upgrade.pkg_prerules = pu_header vendorinfo - partial_upgrade.sources = $$QMAKE_LIBDIR_QT/QtCore$${QT_LIBINFIX}.dll - partial_upgrade.path = c:/sys/bin - DEPLOYMENT = partial_upgrade $$DEPLOYMENT } neon { diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri index 260ed59..4800716 100644 --- a/src/corelib/global/global.pri +++ b/src/corelib/global/global.pri @@ -24,3 +24,6 @@ linux*:!static:!linux-armcc:!linux-gcce { prog=$$quote(if (/program interpreter: (.*)]/) { print $1; }) DEFINES += ELF_INTERPRETER=\\\"$$system(readelf -l /bin/ls | perl -n -e \'$$prog\')\\\" } + +# Compensate for lack of platform defines in Symbian3 and Symbian4 +symbian: DEFINES += SYMBIAN_VERSION_$$upper($$replace(SYMBIAN_VERSION,\\.,_)) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 401af85..3291fe7 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -86,7 +86,8 @@ # include "private/qcore_symbian_p.h" _LIT(qt_S60Filter, "Series60v?.*.sis"); -_LIT(qt_S60SystemInstallDir, "z:\\system\\install\\"); +_LIT(qt_symbianFilter, "Symbianv*.sis"); +_LIT(qt_symbianSystemInstallDir, "z:\\system\\install\\"); #endif QT_BEGIN_NAMESPACE @@ -1813,12 +1814,12 @@ const QSysInfo::WinVersion QSysInfo::WindowsVersion = QSysInfo::windowsVersion() #endif #ifdef Q_OS_SYMBIAN -static QSysInfo::S60Version cachedS60Version = QSysInfo::S60Version(-1); +static QSysInfo::SymbianVersion cachedSymbianVersion = QSysInfo::SymbianVersion(-1); -QSysInfo::S60Version QSysInfo::s60Version() +QSysInfo::SymbianVersion QSysInfo::symbianVersion() { - if (cachedS60Version != -1) - return cachedS60Version; + if (cachedSymbianVersion != -1) + return cachedSymbianVersion; // Use pure Symbian code, because if done using QDir, there will be a call back // to this method, resulting doing this expensive operation twice before the cache kicks in. @@ -1826,7 +1827,22 @@ QSysInfo::S60Version QSysInfo::s60Version() RFs rfs = qt_s60GetRFs(); TFindFile fileFinder(rfs); CDir* contents; - TInt err = fileFinder.FindWildByDir(qt_S60Filter, qt_S60SystemInstallDir, contents); + + // Check for Symbian4 + TInt err = fileFinder.FindWildByDir(qt_symbianFilter, qt_symbianSystemInstallDir, contents); + if (err == KErrNone) { + QScopedPointer<CDir> contentsDeleter(contents); + err = contents->Sort(EDescending|ESortByName); + if (err == KErrNone && contents->Count() > 0 && (*contents)[0].iName.Length() >= 9) { + TInt major = (*contents)[0].iName[8] - '0'; + if (major == 4) { + return cachedSymbianVersion = SV_SF_4; + } + } + } + + // Check for S60 and Symbian3 platforms, which use older .sis naming scheme + err = fileFinder.FindWildByDir(qt_S60Filter, qt_symbianSystemInstallDir, contents); if (err == KErrNone) { QScopedPointer<CDir> contentsDeleter(contents); err = contents->Sort(EDescending|ESortByName); @@ -1835,19 +1851,19 @@ QSysInfo::S60Version QSysInfo::s60Version() TInt minor = (*contents)[0].iName[11] - '0'; if (major == 3) { if (minor == 1) { - return cachedS60Version = SV_S60_3_1; + return cachedSymbianVersion = SV_9_2; } else if (minor == 2) { - return cachedS60Version = SV_S60_3_2; + return cachedSymbianVersion = SV_9_3; } } else if (major == 5) { if (minor == 0) { - return cachedS60Version = SV_S60_5_0; + return cachedSymbianVersion = SV_9_4; } else if (minor == 1) { - return cachedS60Version = SV_S60_5_1; + return cachedSymbianVersion = SV_SF_2; } else if (minor == 2) { - return cachedS60Version = SV_S60_5_2; + return cachedSymbianVersion = SV_SF_3; } } } @@ -1855,33 +1871,40 @@ QSysInfo::S60Version QSysInfo::s60Version() # ifdef Q_CC_NOKIAX86 // Some emulator environments may not contain the version specific .sis files, so - // simply hardcode the version on those environments. + // simply hardcode the version on those environments. Note that can't use + // SYMBIAN_VERSION_* defines for S60 3.x/5.0 platforms, as they do not define them + // right anyway in case .sis files are not found. # if defined(__SERIES60_31__) - return cachedS60Version = SV_S60_3_1; + return cachedSymbianVersion = SV_9_2; # elif defined(__S60_32__) - return cachedS60Version = SV_S60_3_2; + return cachedSymbianVersion = SV_9_3; # elif defined(__S60_50__) - return cachedS60Version = SV_S60_5_0; + return cachedSymbianVersion = SV_9_4; +# elif defined(SYMBIAN_VERSION_SYMBIAN3) + return cachedSymbianVersion = SV_SF_3; +# elif defined(SYMBIAN_VERSION_SYMBIAN4) + return cachedSymbianVersion = SV_SF_4; # endif # endif //If reaching here, it was not possible to determine the version - return cachedS60Version = SV_S60_Unknown; + return cachedSymbianVersion = SV_Unknown; } -QSysInfo::SymbianVersion QSysInfo::symbianVersion() + +QSysInfo::S60Version QSysInfo::s60Version() { - switch (s60Version()) { - case SV_S60_3_1: - return SV_9_2; - case SV_S60_3_2: - return SV_9_3; - case SV_S60_5_0: - return SV_9_4; - case SV_S60_5_1: - return SV_SF_2; - case SV_S60_5_2: - return SV_SF_3; + switch (symbianVersion()) { + case SV_9_2: + return SV_S60_3_1; + case SV_9_3: + return SV_S60_3_2; + case SV_9_4: + return SV_S60_5_0; + case SV_SF_2: + return SV_S60_5_1; + case SV_SF_3: + return SV_S60_5_2; default: - return SV_Unknown; + return SV_S60_Unknown; } } #endif // ifdef Q_OS_SYMBIAN diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index d04133b..6ef15d4 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1515,7 +1515,7 @@ public: #endif #ifdef Q_OS_SYMBIAN enum SymbianVersion { - SV_Unknown = 0x0000, + SV_Unknown = 1000000, // Assume unknown is something newer than what is supported //These are the Symbian Ltd versions 9.2-9.4 SV_9_2 = 10, SV_9_3 = 20, @@ -1529,7 +1529,7 @@ public: static SymbianVersion symbianVersion(); enum S60Version { SV_S60_None = 0, - SV_S60_Unknown = 1, + SV_S60_Unknown = SV_Unknown, SV_S60_3_1 = SV_9_2, SV_S60_3_2 = SV_9_3, SV_S60_5_0 = SV_9_4, diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index 5cc6ae3..d8cc344 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -127,9 +127,9 @@ private: * cannot change active objects that we do not own, but the active objects that Qt owns will use * this as a base class with convenience functions. * - * Here is how it works: On every RunL, the deriving class should call okToRun(). This will allow - * exactly one run of the active object, and mark it as such. If it is called again, it will return - * false, and add the object to a queue so it can be run later. + * Here is how it works: On every RunL, the deriving class should call maybeQueueForLater(). + * This will return whether the active object has been queued, or whether it should run immediately. + * Queued objects will run again after other events have been processed. * * The QCompleteDeferredAOs class is a special object that runs after all others, which will * reactivate the objects that were previously not run. @@ -149,7 +149,7 @@ QActiveObject::~QActiveObject() m_dispatcher->removeDeferredActiveObject(this); } -bool QActiveObject::okToRun() +bool QActiveObject::maybeQueueForLater() { Q_ASSERT(!m_hasRunAgain); @@ -157,12 +157,12 @@ bool QActiveObject::okToRun() // First occurrence of this event in this iteration. m_hasAlreadyRun = true; m_iterationCount = m_dispatcher->iterationCount(); - return true; + return false; } else { // The event has already occurred. m_dispatcher->addDeferredActiveObject(this); m_hasRunAgain = true; - return false; + return true; } } @@ -178,8 +178,7 @@ void QActiveObject::reactivateAndComplete() } QWakeUpActiveObject::QWakeUpActiveObject(QEventDispatcherSymbian *dispatcher) - : CActive(WAKE_UP_PRIORITY), - m_dispatcher(dispatcher) + : QActiveObject(WAKE_UP_PRIORITY, dispatcher) { CActiveScheduler::Add(this); iStatus = KRequestPending; @@ -201,6 +200,9 @@ void QWakeUpActiveObject::DoCancel() void QWakeUpActiveObject::RunL() { + if (maybeQueueForLater()) + return; + iStatus = KRequestPending; SetActive(); QT_TRYCATCH_LEAVING(m_dispatcher->wakeUpWasCalled()); @@ -270,7 +272,7 @@ void QTimerActiveObject::Run() return; } - if (!okToRun()) + if (maybeQueueForLater()) return; if (m_timerInfo->interval > 0) { @@ -630,7 +632,7 @@ void QSocketActiveObject::DoCancel() void QSocketActiveObject::RunL() { - if (!okToRun()) + if (maybeQueueForLater()) return; QT_TRYCATCH_LEAVING(m_dispatcher->socketFired(this)); @@ -722,6 +724,7 @@ QEventDispatcherSymbian::QEventDispatcherSymbian(QObject *parent) m_interrupt(false), m_wakeUpDone(0), m_iterationCount(0), + m_insideTimerEvent(false), m_noSocketEvents(false) { #ifdef QT_SYMBIAN_PRIORITY_DROP @@ -772,6 +775,9 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla { bool handledAnyEvent = false; bool oldNoSocketEventsValue = m_noSocketEvents; + bool oldInsideTimerEventValue = m_insideTimerEvent; + + m_insideTimerEvent = false; QT_TRY { Q_D(QAbstractEventDispatcher); @@ -862,6 +868,7 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla } m_noSocketEvents = oldNoSocketEventsValue; + m_insideTimerEvent = oldInsideTimerEventValue; return handledAnyEvent; } @@ -882,10 +889,13 @@ void QEventDispatcherSymbian::timerFired(int timerId) } timerInfo->inTimerEvent = true; + bool oldInsideTimerEventValue = m_insideTimerEvent; + m_insideTimerEvent = true; QTimerEvent event(timerInfo->timerId); QCoreApplication::sendEvent(timerInfo->receiver, &event); + m_insideTimerEvent = oldInsideTimerEventValue; timerInfo->inTimerEvent = false; return; @@ -1052,6 +1062,14 @@ void QEventDispatcherSymbian::registerTimer ( int timerId, int interval, QObject m_timerList.insert(timerId, timer); timer->timerAO->Start(); + + if (m_insideTimerEvent) + // If we are inside a timer event, we need to prevent event starvation + // by preventing newly created timers from running in the same event processing + // iteration. Do this by calling the maybeQueueForLater() function to "fake" that we have + // already run once. This will cause the next run to be added to the deferred + // queue instead. + timer->timerAO->maybeQueueForLater(); } bool QEventDispatcherSymbian::unregisterTimer ( int timerId ) diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h index bc42753..1486db5 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian_p.h +++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h @@ -82,7 +82,7 @@ public: QActiveObject(TInt priority, QEventDispatcherSymbian *dispatcher); ~QActiveObject(); - bool okToRun(); + bool maybeQueueForLater(); void reactivateAndComplete(); @@ -95,7 +95,7 @@ private: int m_iterationCount; }; -class QWakeUpActiveObject : public CActive +class QWakeUpActiveObject : public QActiveObject { public: QWakeUpActiveObject(QEventDispatcherSymbian *dispatcher); @@ -106,9 +106,6 @@ public: protected: void DoCancel(); void RunL(); - -private: - QEventDispatcherSymbian *m_dispatcher; }; struct SymbianTimerInfo : public QSharedData @@ -277,6 +274,7 @@ private: QAtomicInt m_wakeUpDone; unsigned char m_iterationCount; + bool m_insideTimerEvent; bool m_noSocketEvents; QList<QSocketActiveObject *> m_deferredSocketEvents; diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index 2824e15..a7601b6 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -514,6 +514,8 @@ void QThread::start(Priority priority) d->running = true; d->finished = false; d->terminated = false; + d->returnCode = 0; + d->exited = false; pthread_attr_t attr; pthread_attr_init(&attr); diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp index 37d5b87..f0cbe8d 100644 --- a/src/corelib/thread/qthread_win.cpp +++ b/src/corelib/thread/qthread_win.cpp @@ -405,6 +405,8 @@ void QThread::start(Priority priority) d->running = true; d->finished = false; d->terminated = false; + d->exited = false; + d->returnCode = 0; /* NOTE: we create the thread in the suspended state, set the diff --git a/src/declarative/graphicsitems/qdeclarativepositioners_p.h b/src/declarative/graphicsitems/qdeclarativepositioners_p.h index f9ecc0a..15b91e5 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners_p.h +++ b/src/declarative/graphicsitems/qdeclarativepositioners_p.h @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeBasePositionerPrivate; -class Q_AUTOTEST_EXPORT QDeclarativeBasePositioner : public QDeclarativeItem +class Q_DECLARATIVE_EXPORT QDeclarativeBasePositioner : public QDeclarativeItem { Q_OBJECT diff --git a/src/declarative/qml/qdeclarative.h b/src/declarative/qml/qdeclarative.h index 985ab72..f0c62f4 100644 --- a/src/declarative/qml/qdeclarative.h +++ b/src/declarative/qml/qdeclarative.h @@ -119,7 +119,7 @@ int qmlRegisterType() return QDeclarativePrivate::qmlregister(QDeclarativePrivate::TypeRegistration, &type); } -int qmlRegisterTypeNotAvailable(const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString& message); +int Q_AUTOTEST_EXPORT qmlRegisterTypeNotAvailable(const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString& message); template<typename T> int qmlRegisterUncreatableType(const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString& reason) diff --git a/src/declarative/qml/qdeclarativeimport.cpp b/src/declarative/qml/qdeclarativeimport.cpp index 8f95e26..fe4ed48 100644 --- a/src/declarative/qml/qdeclarativeimport.cpp +++ b/src/declarative/qml/qdeclarativeimport.cpp @@ -876,6 +876,7 @@ void QDeclarativeImportDatabase::addImportPath(const QString& path) cPath = dir.canonicalPath(); } else { cPath = path; + cPath.replace(QLatin1Char('\\'), QLatin1Char('/')); } if (!cPath.isEmpty() diff --git a/src/declarative/qml/qdeclarativetypenotavailable.cpp b/src/declarative/qml/qdeclarativetypenotavailable.cpp index 7a84732..9b79d70 100644 --- a/src/declarative/qml/qdeclarativetypenotavailable.cpp +++ b/src/declarative/qml/qdeclarativetypenotavailable.cpp @@ -41,9 +41,13 @@ #include "qdeclarativetypenotavailable_p.h" +QT_BEGIN_NAMESPACE + int qmlRegisterTypeNotAvailable(const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString& message) { return qmlRegisterUncreatableType<QDeclarativeTypeNotAvailable>(uri,versionMajor,versionMinor,qmlName,message); } QDeclarativeTypeNotAvailable::QDeclarativeTypeNotAvailable() { } + +QT_END_NAMESPACE diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index ea3da25..ba6f1e7 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -2192,6 +2192,13 @@ void QDeclarativePropertyAnimation::setProperties(const QString &prop) The singular forms are slightly optimized, so if you do have only a single target/property to animate you should try to use them. + The \c targets property allows multiple targets to be set. For example, this animates the + \c x property of both \c itemA and \c itemB: + + \qml + NumberAnimation { targets: [itemA, itemB]; properties: "x"; to: 500 } + \endqml + In many cases these properties do not need to be explicitly specified, as they can be inferred from the animation framework: @@ -2255,7 +2262,7 @@ void QDeclarativePropertyAnimation::setProperties(const QString &prop) As seen in the above example, properties is specified as a comma-separated string of property names to animate. - \sa exclude + \sa exclude, {QML Animation} */ QDeclarativeListProperty<QObject> QDeclarativePropertyAnimation::targets() { diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 54fdf3f..8dc15bf 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -4814,6 +4814,27 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter * } } +static inline void setClip(QPainter *painter, QGraphicsItem *item) +{ + painter->save(); + QRectF clipRect; + const QPainterPath clipPath(item->shape()); + if (QPathClipper::pathToRect(clipPath, &clipRect)) + painter->setClipRect(clipRect, Qt::IntersectClip); + else + painter->setClipPath(clipPath, Qt::IntersectClip); +} + +static inline void setWorldTransform(QPainter *painter, const QTransform *const transformPtr, + const QTransform *effectTransform) +{ + Q_ASSERT(transformPtr); + if (effectTransform) + painter->setWorldTransform(*transformPtr * *effectTransform); + else + painter->setWorldTransform(*transformPtr); +} + void QGraphicsScenePrivate::draw(QGraphicsItem *item, QPainter *painter, const QTransform *const viewTransform, const QTransform *const transformPtr, QRegion *exposedRegion, QWidget *widget, qreal opacity, const QTransform *effectTransform, @@ -4822,36 +4843,37 @@ void QGraphicsScenePrivate::draw(QGraphicsItem *item, QPainter *painter, const Q const bool itemIsFullyTransparent = QGraphicsItemPrivate::isOpacityNull(opacity); const bool itemClipsChildrenToShape = (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape); const bool itemHasChildren = !item->d_ptr->children.isEmpty(); + bool setChildClip = itemClipsChildrenToShape; + bool itemHasChildrenStackedBehind = false; int i = 0; if (itemHasChildren) { + if (itemClipsChildrenToShape) + setWorldTransform(painter, transformPtr, effectTransform); + item->d_ptr->ensureSortedChildren(); + // Items with the 'ItemStacksBehindParent' flag are put in front of the list + // so all we have to do is to check the first item. + itemHasChildrenStackedBehind = (item->d_ptr->children.at(0)->d_ptr->flags + & QGraphicsItem::ItemStacksBehindParent); - if (itemClipsChildrenToShape) { - painter->save(); - Q_ASSERT(transformPtr); - if (effectTransform) - painter->setWorldTransform(*transformPtr * *effectTransform); - else - painter->setWorldTransform(*transformPtr); - QRectF clipRect; - const QPainterPath clipPath(item->shape()); - if (QPathClipper::pathToRect(clipPath, &clipRect)) - painter->setClipRect(clipRect, Qt::IntersectClip); - else - painter->setClipPath(clipPath, Qt::IntersectClip); - } + if (itemHasChildrenStackedBehind) { + if (itemClipsChildrenToShape) { + setClip(painter, item); + setChildClip = false; + } - // Draw children behind - for (i = 0; i < item->d_ptr->children.size(); ++i) { - QGraphicsItem *child = item->d_ptr->children.at(i); - if (wasDirtyParentSceneTransform) - child->d_ptr->dirtySceneTransform = 1; - if (!(child->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent)) - break; - if (itemIsFullyTransparent && !(child->d_ptr->flags & QGraphicsItem::ItemIgnoresParentOpacity)) - continue; - drawSubtreeRecursive(child, painter, viewTransform, exposedRegion, widget, opacity, effectTransform); + // Draw children behind + for (i = 0; i < item->d_ptr->children.size(); ++i) { + QGraphicsItem *child = item->d_ptr->children.at(i); + if (wasDirtyParentSceneTransform) + child->d_ptr->dirtySceneTransform = 1; + if (!(child->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent)) + break; + if (itemIsFullyTransparent && !(child->d_ptr->flags & QGraphicsItem::ItemIgnoresParentOpacity)) + continue; + drawSubtreeRecursive(child, painter, viewTransform, exposedRegion, widget, opacity, effectTransform); + } } } @@ -4864,38 +4886,50 @@ void QGraphicsScenePrivate::draw(QGraphicsItem *item, QPainter *painter, const Q ? *exposedRegion : QRegion(), exposedRegion == 0); const bool itemClipsToShape = item->d_ptr->flags & QGraphicsItem::ItemClipsToShape; - const bool savePainter = itemClipsToShape || painterStateProtection; - if (savePainter) - painter->save(); + bool restorePainterClip = false; if (!itemHasChildren || !itemClipsChildrenToShape) { - if (effectTransform) - painter->setWorldTransform(*transformPtr * *effectTransform); - else - painter->setWorldTransform(*transformPtr); + // Item does not have children or clip children to shape. + setWorldTransform(painter, transformPtr, effectTransform); + if ((restorePainterClip = itemClipsToShape)) + setClip(painter, item); + } else if (itemHasChildrenStackedBehind){ + // Item clips children to shape and has children stacked behind, which means + // the painter is already clipped to the item's shape. + if (itemClipsToShape) { + // The clip is already correct. Ensure correct world transform. + setWorldTransform(painter, transformPtr, effectTransform); + } else { + // Remove clip (this also ensures correct world transform). + painter->restore(); + setChildClip = true; + } + } else if (itemClipsToShape) { + // Item clips children and itself to shape. It does not have hildren stacked + // behind, which means the clip has not yet been set. We set it now and re-use it + // for the children. + setClip(painter, item); + setChildClip = false; } - if (itemClipsToShape) { - QRectF clipRect; - const QPainterPath clipPath(item->shape()); - if (QPathClipper::pathToRect(clipPath, &clipRect)) - painter->setClipRect(clipRect, Qt::IntersectClip); - else - painter->setClipPath(clipPath, Qt::IntersectClip); - } - painter->setOpacity(opacity); + if (painterStateProtection && !restorePainterClip) + painter->save(); + painter->setOpacity(opacity); if (!item->d_ptr->cacheMode && !item->d_ptr->isWidget) item->paint(painter, &styleOptionTmp, widget); else drawItemHelper(item, painter, &styleOptionTmp, widget, painterStateProtection); - if (savePainter) + if (painterStateProtection || restorePainterClip) painter->restore(); } // Draw children in front if (itemHasChildren) { + if (setChildClip) + setClip(painter, item); + for (; i < item->d_ptr->children.size(); ++i) { QGraphicsItem *child = item->d_ptr->children.at(i); if (wasDirtyParentSceneTransform) @@ -4904,11 +4938,11 @@ void QGraphicsScenePrivate::draw(QGraphicsItem *item, QPainter *painter, const Q continue; drawSubtreeRecursive(child, painter, viewTransform, exposedRegion, widget, opacity, effectTransform); } - } - // Restore child clip - if (itemHasChildren && itemClipsChildrenToShape) - painter->restore(); + // Restore child clip + if (itemClipsChildrenToShape) + painter->restore(); + } } void QGraphicsScenePrivate::markDirty(QGraphicsItem *item, const QRectF &rect, bool invalidateChildren, @@ -5271,6 +5305,7 @@ void QGraphicsScene::drawItems(QPainter *painter, if (!d->unpolishedItems.isEmpty()) d->_q_polishItems(); + const qreal opacity = painter->opacity(); QTransform viewTransform = painter->worldTransform(); Q_UNUSED(options); @@ -5304,6 +5339,7 @@ void QGraphicsScene::drawItems(QPainter *painter, topLevelItems.at(i)->d_ptr->itemDiscovered = 0; painter->setWorldTransform(viewTransform); + painter->setOpacity(opacity); } /*! diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index c8aca80..a566c8e 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -3475,7 +3475,8 @@ void QGraphicsView::paintEvent(QPaintEvent *event) // IndirectPainting (the else branch), because in that case we always save() // and restore() in QGraphicsScene::drawItems(). if (!d->scene->d_func()->painterStateProtection) - painter.setWorldTransform(viewTransform); + painter.setOpacity(1.0); + painter.setWorldTransform(viewTransform); } else { // Make sure we don't have unpolished items before we draw if (!d->scene->d_func()->unpolishedItems.isEmpty()) diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 13d2c77..90b5de5 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -60,21 +60,6 @@ symbian { QMAKE_LFLAGS.ARMCC += --rw-base 0x800000 QMAKE_LFLAGS.GCCE += -Tdata 0xC00000 } - - # Partial upgrade SIS file - vendorinfo = \ - "; Localised Vendor name" \ - "%{\"Nokia, Qt\"}" \ - " " \ - "; Unique Vendor name" \ - ":\"Nokia, Qt\"" \ - " " - pu_header = "; Partial upgrade package for testing QtGui changes without reinstalling everything" \ - "$${LITERAL_HASH}{\"Qt gui\"}, (0x2001E61C), $${QT_MAJOR_VERSION},$${QT_MINOR_VERSION},$${QT_PATCH_VERSION}, TYPE=PU" - partial_upgrade.pkg_prerules = pu_header vendorinfo - partial_upgrade.sources = $$QMAKE_LIBDIR_QT/QtGui$${QT_LIBINFIX}.dll - partial_upgrade.path = c:/sys/bin - DEPLOYMENT = partial_upgrade $$DEPLOYMENT } neon:*-g++* { diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 1e502bd..64d8ed2 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -664,14 +664,19 @@ void QPixmap::resize_helper(const QSize &s) #if defined(Q_WS_X11) if (x11Data && x11Data->x11_mask) { - QX11PixmapData *pmData = static_cast<QX11PixmapData*>(pd); - pmData->x11_mask = (Qt::HANDLE)XCreatePixmap(X11->display, - RootWindow(x11Data->xinfo.display(), - x11Data->xinfo.screen()), - w, h, 1); - GC gc = XCreateGC(X11->display, pmData->x11_mask, 0, 0); - XCopyArea(X11->display, x11Data->x11_mask, pmData->x11_mask, gc, 0, 0, qMin(width(), w), qMin(height(), h), 0, 0); - XFreeGC(X11->display, gc); + QPixmapData *newPd = pm.pixmapData(); + QX11PixmapData *pmData = (newPd && newPd->classId() == QPixmapData::X11Class) + ? static_cast<QX11PixmapData*>(newPd) : 0; + if (pmData) { + pmData->x11_mask = (Qt::HANDLE)XCreatePixmap(X11->display, + RootWindow(x11Data->xinfo.display(), + x11Data->xinfo.screen()), + w, h, 1); + GC gc = XCreateGC(X11->display, pmData->x11_mask, 0, 0); + XCopyArea(X11->display, x11Data->x11_mask, pmData->x11_mask, gc, 0, 0, + qMin(width(), w), qMin(height(), h), 0, 0); + XFreeGC(X11->display, gc); + } } #endif *this = pm; @@ -836,7 +841,7 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers % HexString<quint64>(info.size()) % HexString<uint>(data ? data->pixelType() : QPixmapData::PixmapType); - // Note: If no extension is provided, we try to match the + // Note: If no extension is provided, we try to match the // file against known plugin extensions if (!info.completeSuffix().isEmpty() && !info.exists()) return false; @@ -1793,13 +1798,27 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode) Returns true if this pixmap has an alpha channel, \e or has a mask, otherwise returns false. - \warning This is potentially an expensive operation. - \sa hasAlphaChannel(), mask() */ bool QPixmap::hasAlpha() const { - return data && (data->hasAlphaChannel() || !data->mask().isNull()); +#if defined(Q_WS_X11) + if (data && data->hasAlphaChannel()) + return true; + QPixmapData *pd = pixmapData(); + if (pd && pd->classId() == QPixmapData::X11Class) { + QX11PixmapData *x11Data = static_cast<QX11PixmapData*>(pd); +#ifndef QT_NO_XRENDER + if (x11Data->picture && x11Data->d == 32) + return true; +#endif + if (x11Data->d == 1 || x11Data->x11_mask) + return true; + } + return false; +#else + return data && data->hasAlphaChannel(); +#endif } /*! diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp index 3d9c363..01f2c11 100644 --- a/src/gui/image/qpixmap_x11.cpp +++ b/src/gui/image/qpixmap_x11.cpp @@ -1321,7 +1321,6 @@ QBitmap QX11PixmapData::mask() const return mask; } - /*! Sets a mask bitmap. @@ -1549,7 +1548,7 @@ QImage QX11PixmapData::toImage(const QRect &rect) const if (!xiWrapper.xi) return QImage(); - if (canTakeQImageFromXImage(xiWrapper)) + if (!x11_mask && canTakeQImageFromXImage(xiWrapper)) return takeQImageFromXImage(xiWrapper); QImage image = toImage(xiWrapper, rect); diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index b797776..40b51fe 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -3435,6 +3435,10 @@ void QTreeViewPrivate::updateScrollBars() if (!viewportSize.isValid()) viewportSize = QSize(0, 0); + if (viewItems.isEmpty()) { + q->doItemsLayout(); + } + int itemsInViewport = 0; if (uniformRowHeights) { if (defaultItemHeight <= 0) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 43d5772..185af9a 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -2397,8 +2397,13 @@ static const char *application_menu_strings[] = { }; QString qt_mac_applicationmenu_string(int type) { - return qApp->translate("MAC_APPLICATION_MENU", - application_menu_strings[type]); + QString menuString = QString::fromLatin1(application_menu_strings[type]); + QString translated = qApp->translate("QMenuBar", application_menu_strings[type]); + if (translated != menuString) + return translated; + else + return qApp->translate("MAC_APPLICATION_MENU", + application_menu_strings[type]); } #endif #endif diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index e937918..2be3ed3 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1341,6 +1341,10 @@ void QSymbianControl::setFocusSafely(bool focus) // focus in Symbian. If this is not executed, the control which happens to be on // the top of the stack may randomly be assigned focus by Symbian, for example // when creating new windows (specifically in CCoeAppUi::HandleStackChanged()). + + // Close any popups. + CEikonEnv::Static()->EikAppUi()->StopDisplayingMenuBar(); + if (focus) { S60->appUi()->RemoveFromStack(this); // Symbian doesn't automatically remove focus from the last focused control, so we need to diff --git a/src/gui/kernel/qdnd_win.cpp b/src/gui/kernel/qdnd_win.cpp index a164c2a..7083886 100644 --- a/src/gui/kernel/qdnd_win.cpp +++ b/src/gui/kernel/qdnd_win.cpp @@ -515,7 +515,7 @@ static inline Qt::MouseButtons keystate_to_mousebutton(DWORD grfKeyState) //--------------------------------------------------------------------- // IDropSource Methods //--------------------------------------------------------------------- -STDMETHODIMP +QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP QOleDropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState) { #ifdef QDND_DEBUG @@ -545,7 +545,7 @@ QOleDropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState) } } -STDMETHODIMP +QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP QOleDropSource::GiveFeedback(DWORD dwEffect) { Qt::DropAction action = translateToQDragDropAction(dwEffect); @@ -626,7 +626,7 @@ QOleDropTarget::Release(void) // IDropTarget Methods //--------------------------------------------------------------------- -STDMETHODIMP +QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP QOleDropTarget::DragEnter(LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) { #ifdef QDND_DEBUG @@ -688,7 +688,7 @@ void QOleDropTarget::sendDragEnterEvent(QWidget *dragEnterWidget, DWORD grfKeySt } -STDMETHODIMP +QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP QOleDropTarget::DragOver(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) { #ifdef QDND_DEBUG @@ -758,7 +758,7 @@ QOleDropTarget::DragOver(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) return NOERROR; } -STDMETHODIMP +QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP QOleDropTarget::DragLeave() { #ifdef QDND_DEBUG @@ -785,7 +785,7 @@ QOleDropTarget::DragLeave() #define KEY_STATE_BUTTON_MASK (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON) -STDMETHODIMP +QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP QOleDropTarget::Drop(LPDATAOBJECT /*pDataObj*/, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) { #ifdef QDND_DEBUG diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp index f8f8afb..4fded1f 100644 --- a/src/gui/painting/qrasterizer.cpp +++ b/src/gui/painting/qrasterizer.cpp @@ -65,6 +65,12 @@ typedef int Q16Dot16; #define COORD_ROUNDING 1 // 0: round up, 1: round down #define COORD_OFFSET 32 // 26.6, 32 is half a pixel +static inline QT_FT_Vector PointToVector(const QPointF &p) +{ + QT_FT_Vector result = { QT_FT_Pos(p.x() * 64), QT_FT_Pos(p.y() * 64) }; + return result; +} + class QSpanBuffer { public: QSpanBuffer(ProcessSpans blend, void *data, const QRect &clipRect) @@ -693,9 +699,9 @@ static Q16Dot16 intersectPixelFP(int x, Q16Dot16 top, Q16Dot16 bottom, Q16Dot16 } } -static inline bool q16Dot16Compare(qreal p1, qreal p2) +static inline bool q26Dot6Compare(qreal p1, qreal p2) { - return FloatToQ16Dot16(p2 - p1) == 0; + return int((p2 - p1) * 64.) == 0; } static inline qreal qFloorF(qreal v) @@ -708,6 +714,12 @@ static inline qreal qFloorF(qreal v) return floor(v); } +static inline QPointF snapTo26Dot6Grid(const QPointF &p) +{ + return QPointF(qFloorF(p.x() * 64) * (1 / qreal(64)), + qFloorF(p.y() * 64) * (1 / qreal(64))); +} + void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, bool squareCap) { if (a == b || width == 0 || d->clipRect.isEmpty()) @@ -718,17 +730,21 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, QPointF pa = a; QPointF pb = b; - QPointF offs = QPointF(qAbs(b.y() - a.y()), qAbs(b.x() - a.x())) * width * 0.5; - if (squareCap) - offs += QPointF(offs.y(), offs.x()); + if (squareCap) { + QPointF delta = pb - pa; + pa -= (0.5f * width) * delta; + pb += (0.5f * width) * delta; + } + + QPointF offs = QPointF(qAbs(b.y() - a.y()), qAbs(b.x() - a.x())) * width * 0.5; const QRectF clip(d->clipRect.topLeft() - offs, d->clipRect.bottomRight() + QPoint(1, 1) + offs); - if (!clip.contains(a) || !clip.contains(b)) { + if (!clip.contains(pa) || !clip.contains(pb)) { qreal t1 = 0; qreal t2 = 1; - const qreal o[2] = { a.x(), a.y() }; - const qreal d[2] = { b.x() - a.x(), b.y() - a.y() }; + const qreal o[2] = { pa.x(), pa.y() }; + const qreal d[2] = { pb.x() - pa.x(), pb.y() - pa.y() }; const qreal low[2] = { clip.left(), clip.top() }; const qreal high[2] = { clip.right(), clip.bottom() }; @@ -751,8 +767,12 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, if (t1 >= t2) return; } - pa = a + (b - a) * t1; - pb = a + (b - a) * t2; + + QPointF npa = pa + (pb - pa) * t1; + QPointF npb = pa + (pb - pa) * t2; + + pa = npa; + pb = npb; } if (!d->antialiased) { @@ -763,15 +783,6 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, } { - const qreal gridResolution = 64; - const qreal reciprocal = 1 / gridResolution; - - // snap to grid to prevent large slopes - pa.rx() = qFloorF(pa.rx() * gridResolution) * reciprocal; - pa.ry() = qFloorF(pa.ry() * gridResolution) * reciprocal; - pb.rx() = qFloorF(pb.rx() * gridResolution) * reciprocal; - pb.ry() = qFloorF(pb.ry() * gridResolution) * reciprocal; - // old delta const QPointF d0 = a - b; const qreal w0 = d0.x() * d0.x() + d0.y() * d0.y(); @@ -789,7 +800,7 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, QSpanBuffer buffer(d->blend, d->data, d->clipRect); - if (q16Dot16Compare(pa.y(), pb.y())) { + if (q26Dot6Compare(pa.y(), pb.y())) { const qreal x = (pa.x() + pb.x()) * 0.5f; const qreal dx = qAbs(pb.x() - pa.x()) * 0.5f; @@ -799,26 +810,16 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, pa = QPointF(x, y - dy); pb = QPointF(x, y + dy); - if (squareCap) - width = 1 / width + 1.0f; - else - width = 1 / width; - - squareCap = false; + width = 1 / width; } - if (q16Dot16Compare(pa.x(), pb.x())) { + if (q26Dot6Compare(pa.x(), pb.x())) { if (pa.y() > pb.y()) qSwap(pa, pb); const qreal dy = pb.y() - pa.y(); const qreal halfWidth = 0.5f * width * dy; - if (squareCap) { - pa.ry() -= halfWidth; - pb.ry() += halfWidth; - } - qreal left = pa.x() - halfWidth; qreal right = pa.x() + halfWidth; @@ -828,7 +829,7 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, pa.ry() = qBound(qreal(d->clipRect.top()), pa.y(), qreal(d->clipRect.bottom() + 1)); pb.ry() = qBound(qreal(d->clipRect.top()), pb.y(), qreal(d->clipRect.bottom() + 1)); - if (q16Dot16Compare(left, right) || q16Dot16Compare(pa.y(), pb.y())) + if (q26Dot6Compare(left, right) || q26Dot6Compare(pa.y(), pb.y())) return; if (d->antialiased) { @@ -899,11 +900,6 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, delta *= 0.5f * width; const QPointF perp(delta.y(), -delta.x()); - if (squareCap) { - pa -= delta; - pb += delta; - } - QPointF top; QPointF left; QPointF right; @@ -921,14 +917,36 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, bottom = pb + perp; } + top = snapTo26Dot6Grid(top); + bottom = snapTo26Dot6Grid(bottom); + left = snapTo26Dot6Grid(left); + right = snapTo26Dot6Grid(right); + const qreal topBound = qBound(qreal(d->clipRect.top()), top.y(), qreal(d->clipRect.bottom())); const qreal bottomBound = qBound(qreal(d->clipRect.top()), bottom.y(), qreal(d->clipRect.bottom())); - const qreal leftSlope = (left.x() - top.x()) / (left.y() - top.y()); - const qreal rightSlope = -1.0f / leftSlope; + const QPointF topLeftEdge = left - top; + const QPointF topRightEdge = right - top; + const QPointF bottomLeftEdge = bottom - left; + const QPointF bottomRightEdge = bottom - right; + + const qreal topLeftSlope = topLeftEdge.x() / topLeftEdge.y(); + const qreal bottomLeftSlope = bottomLeftEdge.x() / bottomLeftEdge.y(); + + const qreal topRightSlope = topRightEdge.x() / topRightEdge.y(); + const qreal bottomRightSlope = bottomRightEdge.x() / bottomRightEdge.y(); + + const Q16Dot16 topLeftSlopeFP = FloatToQ16Dot16(topLeftSlope); + const Q16Dot16 topRightSlopeFP = FloatToQ16Dot16(topRightSlope); - const Q16Dot16 leftSlopeFP = FloatToQ16Dot16(leftSlope); - const Q16Dot16 rightSlopeFP = FloatToQ16Dot16(rightSlope); + const Q16Dot16 bottomLeftSlopeFP = FloatToQ16Dot16(bottomLeftSlope); + const Q16Dot16 bottomRightSlopeFP = FloatToQ16Dot16(bottomRightSlope); + + const Q16Dot16 invTopLeftSlopeFP = FloatToQ16Dot16(1 / topLeftSlope); + const Q16Dot16 invTopRightSlopeFP = FloatToQ16Dot16(1 / topRightSlope); + + const Q16Dot16 invBottomLeftSlopeFP = FloatToQ16Dot16(1 / bottomLeftSlope); + const Q16Dot16 invBottomRightSlopeFP = FloatToQ16Dot16(1 / bottomRightSlope); if (d->antialiased) { const Q16Dot16 iTopFP = IntToQ16Dot16(int(topBound)); @@ -936,16 +954,16 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, const Q16Dot16 iRightFP = IntToQ16Dot16(int(right.y())); const Q16Dot16 iBottomFP = IntToQ16Dot16(int(bottomBound)); - Q16Dot16 leftIntersectAf = FloatToQ16Dot16(top.x() + (int(topBound) - top.y()) * leftSlope); - Q16Dot16 rightIntersectAf = FloatToQ16Dot16(top.x() + (int(topBound) - top.y()) * rightSlope); + Q16Dot16 leftIntersectAf = FloatToQ16Dot16(top.x() + (int(topBound) - top.y()) * topLeftSlope); + Q16Dot16 rightIntersectAf = FloatToQ16Dot16(top.x() + (int(topBound) - top.y()) * topRightSlope); Q16Dot16 leftIntersectBf = 0; Q16Dot16 rightIntersectBf = 0; if (iLeftFP < iTopFP) - leftIntersectBf = FloatToQ16Dot16(left.x() + (int(topBound) - left.y()) * rightSlope); + leftIntersectBf = FloatToQ16Dot16(left.x() + (int(topBound) - left.y()) * bottomLeftSlope); if (iRightFP < iTopFP) - rightIntersectBf = FloatToQ16Dot16(right.x() + (int(topBound) - right.y()) * leftSlope); + rightIntersectBf = FloatToQ16Dot16(right.x() + (int(topBound) - right.y()) * bottomRightSlope); Q16Dot16 rowTop, rowBottomLeft, rowBottomRight, rowTopLeft, rowTopRight, rowBottom; Q16Dot16 topLeftIntersectAf, topLeftIntersectBf, topRightIntersectAf, topRightIntersectBf; @@ -960,9 +978,9 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, rowTop = qMax(iTopFP, yTopFP); topLeftIntersectAf = leftIntersectAf + - Q16Dot16Multiply(leftSlopeFP, rowTop - iTopFP); + Q16Dot16Multiply(topLeftSlopeFP, rowTop - iTopFP); topRightIntersectAf = rightIntersectAf + - Q16Dot16Multiply(rightSlopeFP, rowTop - iTopFP); + Q16Dot16Multiply(topRightSlopeFP, rowTop - iTopFP); Q16Dot16 yFP = iTopFP; while (yFP <= iBottomFP) { @@ -974,30 +992,30 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, if (yFP == iLeftFP) { const int y = Q16Dot16ToInt(yFP); - leftIntersectBf = FloatToQ16Dot16(left.x() + (y - left.y()) * rightSlope); - topLeftIntersectBf = leftIntersectBf + Q16Dot16Multiply(rightSlopeFP, rowTopLeft - yFP); - bottomLeftIntersectAf = leftIntersectAf + Q16Dot16Multiply(leftSlopeFP, rowBottomLeft - yFP); + leftIntersectBf = FloatToQ16Dot16(left.x() + (y - left.y()) * bottomLeftSlope); + topLeftIntersectBf = leftIntersectBf + Q16Dot16Multiply(bottomLeftSlopeFP, rowTopLeft - yFP); + bottomLeftIntersectAf = leftIntersectAf + Q16Dot16Multiply(topLeftSlopeFP, rowBottomLeft - yFP); } else { topLeftIntersectBf = leftIntersectBf; - bottomLeftIntersectAf = leftIntersectAf + leftSlopeFP; + bottomLeftIntersectAf = leftIntersectAf + topLeftSlopeFP; } if (yFP == iRightFP) { const int y = Q16Dot16ToInt(yFP); - rightIntersectBf = FloatToQ16Dot16(right.x() + (y - right.y()) * leftSlope); - topRightIntersectBf = rightIntersectBf + Q16Dot16Multiply(leftSlopeFP, rowTopRight - yFP); - bottomRightIntersectAf = rightIntersectAf + Q16Dot16Multiply(rightSlopeFP, rowBottomRight - yFP); + rightIntersectBf = FloatToQ16Dot16(right.x() + (y - right.y()) * bottomRightSlope); + topRightIntersectBf = rightIntersectBf + Q16Dot16Multiply(bottomRightSlopeFP, rowTopRight - yFP); + bottomRightIntersectAf = rightIntersectAf + Q16Dot16Multiply(topRightSlopeFP, rowBottomRight - yFP); } else { topRightIntersectBf = rightIntersectBf; - bottomRightIntersectAf = rightIntersectAf + rightSlopeFP; + bottomRightIntersectAf = rightIntersectAf + topRightSlopeFP; } if (yFP == iBottomFP) { - bottomLeftIntersectBf = leftIntersectBf + Q16Dot16Multiply(rightSlopeFP, rowBottom - yFP); - bottomRightIntersectBf = rightIntersectBf + Q16Dot16Multiply(leftSlopeFP, rowBottom - yFP); + bottomLeftIntersectBf = leftIntersectBf + Q16Dot16Multiply(bottomLeftSlopeFP, rowBottom - yFP); + bottomRightIntersectBf = rightIntersectBf + Q16Dot16Multiply(bottomRightSlopeFP, rowBottom - yFP); } else { - bottomLeftIntersectBf = leftIntersectBf + rightSlopeFP; - bottomRightIntersectBf = rightIntersectBf + leftSlopeFP; + bottomLeftIntersectBf = leftIntersectBf + bottomLeftSlopeFP; + bottomRightIntersectBf = rightIntersectBf + bottomRightSlopeFP; } if (yFP < iLeftFP) { @@ -1042,21 +1060,21 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, if (yFP <= iLeftFP) excluded += intersectPixelFP(x, rowTop, rowBottomLeft, bottomLeftIntersectAf, topLeftIntersectAf, - leftSlopeFP, -rightSlopeFP); + topLeftSlopeFP, invTopLeftSlopeFP); if (yFP >= iLeftFP) excluded += intersectPixelFP(x, rowTopLeft, rowBottom, topLeftIntersectBf, bottomLeftIntersectBf, - rightSlopeFP, -leftSlopeFP); + bottomLeftSlopeFP, invBottomLeftSlopeFP); if (x >= rightMin) { if (yFP <= iRightFP) excluded += (rowBottomRight - rowTop) - intersectPixelFP(x, rowTop, rowBottomRight, topRightIntersectAf, bottomRightIntersectAf, - rightSlopeFP, -leftSlopeFP); + topRightSlopeFP, invTopRightSlopeFP); if (yFP >= iRightFP) excluded += (rowBottom - rowTopRight) - intersectPixelFP(x, rowTopRight, rowBottom, bottomRightIntersectBf, topRightIntersectBf, - leftSlopeFP, -rightSlopeFP); + bottomRightSlopeFP, invBottomRightSlopeFP); } Q16Dot16 coverage = rowHeight - excluded; @@ -1074,11 +1092,11 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, if (yFP <= iRightFP) excluded += (rowBottomRight - rowTop) - intersectPixelFP(x, rowTop, rowBottomRight, topRightIntersectAf, bottomRightIntersectAf, - rightSlopeFP, -leftSlopeFP); + topRightSlopeFP, invTopRightSlopeFP); if (yFP >= iRightFP) excluded += (rowBottom - rowTopRight) - intersectPixelFP(x, rowTopRight, rowBottom, bottomRightIntersectBf, topRightIntersectBf, - leftSlopeFP, -rightSlopeFP); + bottomRightSlopeFP, invBottomRightSlopeFP); Q16Dot16 coverage = rowHeight - excluded; buffer.addSpan(x, 1, Q16Dot16ToInt(yFP), @@ -1086,10 +1104,10 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, ++x; } - leftIntersectAf += leftSlopeFP; - leftIntersectBf += rightSlopeFP; - rightIntersectAf += rightSlopeFP; - rightIntersectBf += leftSlopeFP; + leftIntersectAf += topLeftSlopeFP; + leftIntersectBf += bottomLeftSlopeFP; + rightIntersectAf += topRightSlopeFP; + rightIntersectBf += bottomRightSlopeFP; topLeftIntersectAf = leftIntersectAf; topRightIntersectAf = rightIntersectAf; @@ -1103,10 +1121,10 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, int iBottom = bottom.y() < 0.5f? -1 : int(bottom.y() - 0.5f); int iMiddle = qMin(iLeft, iRight); - Q16Dot16 leftIntersectAf = FloatToQ16Dot16(top.x() + 0.5f + (iTop + 0.5f - top.y()) * leftSlope); - Q16Dot16 leftIntersectBf = FloatToQ16Dot16(left.x() + 0.5f + (iLeft + 1.5f - left.y()) * rightSlope); - Q16Dot16 rightIntersectAf = FloatToQ16Dot16(top.x() - 0.5f + (iTop + 0.5f - top.y()) * rightSlope); - Q16Dot16 rightIntersectBf = FloatToQ16Dot16(right.x() - 0.5f + (iRight + 1.5f - right.y()) * leftSlope); + Q16Dot16 leftIntersectAf = FloatToQ16Dot16(top.x() + 0.5f + (iTop + 0.5f - top.y()) * topLeftSlope); + Q16Dot16 leftIntersectBf = FloatToQ16Dot16(left.x() + 0.5f + (iLeft + 1.5f - left.y()) * bottomLeftSlope); + Q16Dot16 rightIntersectAf = FloatToQ16Dot16(top.x() - 0.5f + (iTop + 0.5f - top.y()) * topRightSlope); + Q16Dot16 rightIntersectBf = FloatToQ16Dot16(right.x() - 0.5f + (iRight + 1.5f - right.y()) * bottomRightSlope); int ny; int y = iTop; @@ -1128,10 +1146,10 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, ri += rs; \ } - DO_SEGMENT(iMiddle, leftIntersectAf, rightIntersectAf, leftSlopeFP, rightSlopeFP) - DO_SEGMENT(iRight, leftIntersectBf, rightIntersectAf, rightSlopeFP, rightSlopeFP) - DO_SEGMENT(iLeft, leftIntersectAf, rightIntersectBf, leftSlopeFP, leftSlopeFP) - DO_SEGMENT(iBottom, leftIntersectBf, rightIntersectBf, rightSlopeFP, leftSlopeFP) + DO_SEGMENT(iMiddle, leftIntersectAf, rightIntersectAf, topLeftSlopeFP, topRightSlopeFP) + DO_SEGMENT(iRight, leftIntersectBf, rightIntersectAf, bottomLeftSlopeFP, topRightSlopeFP) + DO_SEGMENT(iLeft, leftIntersectAf, rightIntersectBf, topLeftSlopeFP, bottomRightSlopeFP); + DO_SEGMENT(iBottom, leftIntersectBf, rightIntersectBf, bottomLeftSlopeFP, bottomRightSlopeFP); #undef DO_SEGMENT } } @@ -1183,12 +1201,6 @@ void QRasterizer::rasterize(const QT_FT_Outline *outline, Qt::FillRule fillRule) d->scanConverter.end(); } -static inline QT_FT_Vector PointToVector(const QPointF &p) -{ - QT_FT_Vector result = { QT_FT_Pos(p.x() * 64), QT_FT_Pos(p.y() * 64) }; - return result; -} - void QRasterizer::rasterize(const QPainterPath &path, Qt::FillRule fillRule) { if (path.isEmpty()) diff --git a/src/gui/styles/qstylehelper_p.h b/src/gui/styles/qstylehelper_p.h index 71fce55..3759929 100644 --- a/src/gui/styles/qstylehelper_p.h +++ b/src/gui/styles/qstylehelper_p.h @@ -108,7 +108,7 @@ template <typename T> { typedef HexString<T> type; enum { ExactSize = true }; - static int size(const HexString<T> &str) { return sizeof(str.val) * 2; } + static int size(const HexString<T> &) { return sizeof(T) * 2; } static inline void appendTo(const HexString<T> &str, QChar *&out) { str.write(out); } }; diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index 5fe0c0c..7f2c4e9 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -404,12 +404,6 @@ void QTextControlPrivate::init(Qt::TextFormat format, const QString &text, QText Q_Q(QTextControl); setContent(format, text, document); - QWidget *parentWidget = qobject_cast<QWidget*>(parent); - if (parentWidget) { - QTextOption opt = doc->defaultTextOption(); - opt.setTextDirection(parentWidget->layoutDirection()); - doc->setDefaultTextOption(opt); - } doc->setUndoRedoEnabled(interactionFlags & Qt::TextEditable); q->setCursorWidth(-1); } diff --git a/src/gui/widgets/qlabel.cpp b/src/gui/widgets/qlabel.cpp index bdbd0b0..42be03b 100644 --- a/src/gui/widgets/qlabel.cpp +++ b/src/gui/widgets/qlabel.cpp @@ -635,7 +635,7 @@ QSize QLabelPrivate::sizeForWidth(int w) const br = movie->currentPixmap().rect(); #endif else if (isTextLabel) { - int align = QStyle::visualAlignment(q->layoutDirection(), QFlag(this->align)); + int align = QStyle::visualAlignment(textDirection(), QFlag(this->align)); // Add indentation int m = indent; @@ -1059,7 +1059,8 @@ void QLabel::paintEvent(QPaintEvent *) drawFrame(&painter); QRect cr = contentsRect(); cr.adjust(d->margin, d->margin, -d->margin, -d->margin); - int align = QStyle::visualAlignment(layoutDirection(), QFlag(d->align)); + int align = QStyle::visualAlignment(d->isTextLabel ? d->textDirection() + : layoutDirection(), QFlag(d->align)); #ifndef QT_NO_MOVIE if (d->movie) { @@ -1119,7 +1120,8 @@ void QLabel::paintEvent(QPaintEvent *) d->control->drawContents(&painter, QRectF(), this); painter.restore(); } else { - int flags = align; + int flags = align | (d->textDirection() == Qt::LeftToRight ? Qt::TextForceLeftToRight + : Qt::TextForceRightToLeft); if (d->hasShortcut) { flags |= Qt::TextShowMnemonic; if (!style->styleHint(QStyle::SH_UnderlineShortcut, &opt, this)) @@ -1447,10 +1449,6 @@ void QLabel::changeEvent(QEvent *ev) d->control->setPalette(palette()); } else if (ev->type() == QEvent::ContentsRectChange) { d->updateLabel(); - } else if (ev->type() == QEvent::LayoutDirectionChange) { - if (d->isTextLabel && d->control) { - d->sendControlEvent(ev); - } } QFrame::changeEvent(ev); } @@ -1486,6 +1484,15 @@ void QLabel::setScaledContents(bool enable) update(contentsRect()); } +Qt::LayoutDirection QLabelPrivate::textDirection() const +{ + if (control) { + QTextOption opt = control->document()->defaultTextOption(); + return opt.textDirection(); + } + + return text.isRightToLeft() ? Qt::RightToLeft : Qt::LeftToRight; +} /*! \fn void QLabel::setAlignment(Qt::AlignmentFlag flag) @@ -1503,7 +1510,8 @@ QRect QLabelPrivate::documentRect() const Q_ASSERT_X(isTextLabel, "documentRect", "document rect called for label that is not a text label!"); QRect cr = q->contentsRect(); cr.adjust(margin, margin, -margin, -margin); - const int align = QStyle::visualAlignment(q->layoutDirection(), QFlag(this->align)); + const int align = QStyle::visualAlignment(isTextLabel ? textDirection() + : q->layoutDirection(), QFlag(this->align)); int m = indent; if (m < 0 && q->frameWidth()) // no indent, but we do have a frame m = q->fontMetrics().width(QLatin1Char('x')) / 2 - margin; @@ -1564,7 +1572,6 @@ void QLabelPrivate::ensureTextLayouted() const if (!textLayoutDirty) return; ensureTextPopulated(); - Q_Q(const QLabel); if (control) { QTextDocument *doc = control->document(); QTextOption opt = doc->defaultTextOption(); @@ -1576,8 +1583,6 @@ void QLabelPrivate::ensureTextLayouted() const else opt.setWrapMode(QTextOption::ManualWrap); - opt.setTextDirection(q->layoutDirection()); - doc->setDefaultTextOption(opt); QTextFrameFormat fmt = doc->rootFrame()->frameFormat(); diff --git a/src/gui/widgets/qlabel_p.h b/src/gui/widgets/qlabel_p.h index fba7224..83624c7 100644 --- a/src/gui/widgets/qlabel_p.h +++ b/src/gui/widgets/qlabel_p.h @@ -132,6 +132,7 @@ public: QRectF layoutRect() const; QRect documentRect() const; QPoint layoutPoint(const QPoint& p) const; + Qt::LayoutDirection textDirection() const; #ifndef QT_NO_CONTEXTMENU QMenu *createStandardContextMenu(const QPoint &pos); #endif diff --git a/src/imports/folderlistmodel/folderlistmodel.pro b/src/imports/folderlistmodel/folderlistmodel.pro index c306037..b2e5360 100644 --- a/src/imports/folderlistmodel/folderlistmodel.pro +++ b/src/imports/folderlistmodel/folderlistmodel.pro @@ -8,7 +8,6 @@ SOURCES += qdeclarativefolderlistmodel.cpp plugin.cpp HEADERS += qdeclarativefolderlistmodel.h QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/$$TARGETPATH -else:DESTDIR = . target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH qmldir.files += $$PWD/qmldir @@ -17,8 +16,9 @@ qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH symbian:{ TARGET.UID3 = 0x20021320 include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) - - importFiles.sources = $$DESTDIR/qmlfolderlistmodelplugin$${QT_LIBINFIX}.dll qmldir + + isEmpty(DESTDIR):importFiles.sources = qmlfolderlistmodelplugin$${QT_LIBINFIX}.dll qmldir + else:importFiles.sources = $$DESTDIR/qmlfolderlistmodelplugin$${QT_LIBINFIX}.dll qmldir importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH DEPLOYMENT = importFiles diff --git a/src/imports/gestures/gestures.pro b/src/imports/gestures/gestures.pro index 8a772da..18ffcb9 100644 --- a/src/imports/gestures/gestures.pro +++ b/src/imports/gestures/gestures.pro @@ -8,7 +8,6 @@ SOURCES += qdeclarativegesturearea.cpp plugin.cpp HEADERS += qdeclarativegesturearea_p.h QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/$$TARGETPATH -else:DESTDIR = . target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH qmldir.files += $$PWD/qmldir @@ -18,7 +17,8 @@ symbian:{ TARGET.UID3 = 0x2002131F include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) - importFiles.sources = $$DESTDIR/qmlgesturesplugin$${QT_LIBINFIX}.dll qmldir + isEmpty(DESTDIR):importFiles.sources = qmlgesturesplugin$${QT_LIBINFIX}.dll qmldir + else:importFiles.sources = $$DESTDIR/qmlgesturesplugin$${QT_LIBINFIX}.dll qmldir importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH DEPLOYMENT = importFiles diff --git a/src/imports/particles/particles.pro b/src/imports/particles/particles.pro index 68462e7..a3eb0d1 100644 --- a/src/imports/particles/particles.pro +++ b/src/imports/particles/particles.pro @@ -12,7 +12,6 @@ HEADERS += \ qdeclarativeparticles_p.h QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/$$TARGETPATH -else:DESTDIR = . target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH qmldir.files += $$PWD/qmldir @@ -22,7 +21,8 @@ symbian:{ TARGET.UID3 = 0x2002131E include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) - importFiles.sources = $$DESTDIR/qmlparticlesplugin$${QT_LIBINFIX}.dll qmldir + isEmpty(DESTDIR):importFiles.sources = qmlparticlesplugin$${QT_LIBINFIX}.dll qmldir + else:importFiles.sources = $$DESTDIR/qmlparticlesplugin$${QT_LIBINFIX}.dll qmldir importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH DEPLOYMENT = importFiles diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp index 348b0d2..41a9512 100644 --- a/src/network/kernel/qhostinfo.cpp +++ b/src/network/kernel/qhostinfo.cpp @@ -468,14 +468,17 @@ void QHostInfoRunnable::run() resultEmitter.emitResultsReady(hostInfo); // now also iterate through the postponed ones - QMutableListIterator<QHostInfoRunnable*> iterator(manager->postponedLookups); - while (iterator.hasNext()) { - QHostInfoRunnable* postponed = iterator.next(); - if (toBeLookedUp == postponed->toBeLookedUp) { - // we can now emit - iterator.remove(); - hostInfo.setLookupId(postponed->id); - postponed->resultEmitter.emitResultsReady(hostInfo); + { + QMutexLocker locker(&manager->mutex); + QMutableListIterator<QHostInfoRunnable*> iterator(manager->postponedLookups); + while (iterator.hasNext()) { + QHostInfoRunnable* postponed = iterator.next(); + if (toBeLookedUp == postponed->toBeLookedUp) { + // we can now emit + iterator.remove(); + hostInfo.setLookupId(postponed->id); + postponed->resultEmitter.emitResultsReady(hostInfo); + } } } diff --git a/src/network/network.pro b/src/network/network.pro index 5e33080..7ed7d3a 100644 --- a/src/network/network.pro +++ b/src/network/network.pro @@ -28,19 +28,4 @@ QMAKE_LIBS += $$QMAKE_LIBS_NETWORK symbian { TARGET.UID3=0x2001B2DE LIBS += -lesock -linsock -lcertstore -lefsrv -lctframework - - # Partial upgrade SIS file - vendorinfo = \ - "; Localised Vendor name" \ - "%{\"Nokia, Qt\"}" \ - " " \ - "; Unique Vendor name" \ - ":\"Nokia, Qt\"" \ - " " - pu_header = "; Partial upgrade package for testing QtGui changes without reinstalling everything" \ - "$${LITERAL_HASH}{\"Qt network\"}, (0x2001E61C), $${QT_MAJOR_VERSION},$${QT_MINOR_VERSION},$${QT_PATCH_VERSION}, TYPE=PU" - partial_upgrade.pkg_prerules = pu_header vendorinfo - partial_upgrade.sources = $$QMAKE_LIBDIR_QT/QtNetwork.dll - partial_upgrade.path = c:/sys/bin - DEPLOYMENT = partial_upgrade $$DEPLOYMENT } diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index cb1ca8e..acc68d3 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -864,32 +864,6 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) if (do_vectorpath_cache) path.makeCacheable(); - if (!device->format().stencil()) { - // If there is no stencil buffer, triangulate the path instead. - - QRectF bbox = path.controlPointRect(); - // If the path doesn't fit within these limits, it is possible that the triangulation will fail. - bool withinLimits = (bbox.left() > -0x8000 * inverseScale) - && (bbox.right() < 0x8000 * inverseScale) - && (bbox.top() > -0x8000 * inverseScale) - && (bbox.bottom() < 0x8000 * inverseScale); - if (withinLimits) { - QTriangleSet polys = qTriangulate(path, QTransform().scale(1 / inverseScale, 1 / inverseScale)); - - QVarLengthArray<float> vertices(polys.vertices.size()); - for (int i = 0; i < polys.vertices.size(); ++i) - vertices[i] = float(inverseScale * polys.vertices.at(i)); - - prepareForDraw(currentBrush.isOpaque()); - setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, vertices.constData()); - glDrawElements(GL_TRIANGLES, polys.indices.size(), GL_UNSIGNED_INT, polys.indices.constData()); - } else { - // We can't handle big, concave painter paths with OpenGL without stencil buffer. - qWarning("Painter path exceeds +/-32767 pixels."); - } - return; - } - // The path is too complicated & needs the stencil technique vertexCoordinateArray.clear(); vertexCoordinateArray.addPath(path, inverseScale, false); @@ -1338,7 +1312,7 @@ void QGL2PaintEngineEx::drawPixmap(const QRectF& dest, const QPixmap & pixmap, c QGLRect srcRect(src.left(), top, src.right(), bottom); bool isBitmap = pixmap.isQBitmap(); - bool isOpaque = !isBitmap && !pixmap.hasAlphaChannel(); + bool isOpaque = !isBitmap && !pixmap.hasAlpha(); d->updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, state()->renderHints & QPainter::SmoothPixmapTransform, texture->id); @@ -1813,7 +1787,7 @@ void QGL2PaintEngineExPrivate::drawPixmapFragments(const QPainter::PixmapFragmen transferMode(ImageArrayDrawingMode); bool isBitmap = pixmap.isQBitmap(); - bool isOpaque = !isBitmap && (!pixmap.hasAlphaChannel() || (hints & QPainter::OpaqueHint)) && allOpaque; + bool isOpaque = !isBitmap && (!pixmap.hasAlpha() || (hints & QPainter::OpaqueHint)) && allOpaque; updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, q->state()->renderHints & QPainter::SmoothPixmapTransform, texture->id); diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 15070d4..0d1a66e 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1689,9 +1689,6 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format) workaround_brokenFBOReadBack = false; workaroundsCached = false; - workaround_brokenTextureFromPixmap = false; - workaround_brokenTextureFromPixmap_init = false; - for (int i = 0; i < QT_GL_VERTEX_ARRAY_TRACKED_COUNT; ++i) vertexAttributeArraysEnabledState[i] = false; } @@ -2577,34 +2574,18 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, } } -#if defined(Q_WS_X11) - // Try to use texture_from_pixmap +#if defined(Q_WS_X11) && !defined(QT_NO_EGL) + // Only try to use texture_from_pixmap under X11/EGL const QX11Info *xinfo = qt_x11Info(paintDevice); if (pd->classId() == QPixmapData::X11Class && pd->pixelType() == QPixmapData::PixmapType && xinfo && xinfo->screen() == pixmap.x11Info().screen() && target == GL_TEXTURE_2D) { - if (!workaround_brokenTextureFromPixmap_init) { - workaround_brokenTextureFromPixmap_init = true; - - const QByteArray versionString(reinterpret_cast<const char*>(glGetString(GL_VERSION))); - const int pos = versionString.indexOf("NVIDIA "); - - if (pos >= 0) { - const QByteArray nvidiaVersionString = versionString.mid(pos + strlen("NVIDIA ")); - - if (nvidiaVersionString.startsWith("195") || nvidiaVersionString.startsWith("256")) - workaround_brokenTextureFromPixmap = true; - } - } - - if (!workaround_brokenTextureFromPixmap) { - texture = bindTextureFromNativePixmap(const_cast<QPixmap*>(&pixmap), key, options); - if (texture) { - texture->options |= QGLContext::MemoryManagedBindOption; - texture->boundPixmap = pd; - boundPixmaps.insert(pd, QPixmap(pixmap)); - } + texture = bindTextureFromNativePixmap(const_cast<QPixmap*>(&pixmap), key, options); + if (texture) { + texture->options |= QGLContext::MemoryManagedBindOption; + texture->boundPixmap = pd; + boundPixmaps.insert(pd, QPixmap(pixmap)); } } #endif diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 623eeaf..6323ce2 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -401,9 +401,6 @@ public: uint workaround_brokenFBOReadBack : 1; uint workaroundsCached : 1; - uint workaround_brokenTextureFromPixmap : 1; - uint workaround_brokenTextureFromPixmap_init : 1; - QPaintDevice *paintDevice; QColor transpColor; QGLContext *q_ptr; diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp index f3a4c95..7f4c670 100644 --- a/src/opengl/qgl_x11.cpp +++ b/src/opengl/qgl_x11.cpp @@ -1776,6 +1776,10 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(pixmap->data_ptr().data()); Q_ASSERT(pixmapData->classId() == QPixmapData::X11Class); + // We can't use TFP if the pixmap has a separate X11 mask + if (pixmapData->x11_mask) + return 0; + if (!qt_resolveTextureFromPixmap(paintDevice)) return 0; diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index adbba85..6c9b288 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -324,10 +324,6 @@ void QGLFBOGLPaintDevice::setFBO(QGLFramebufferObject* f, fboFormat.setStencil(true); } else if (attachment == QGLFramebufferObject::Depth) { fboFormat.setDepth(true); - fboFormat.setStencil(false); - } else { - fboFormat.setDepth(false); - fboFormat.setStencil(false); } GLenum format = f->format().internalTextureFormat(); @@ -472,13 +468,17 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, glGetRenderbufferParameteriv(GL_RENDERBUFFER_EXT, GL_RENDERBUFFER_SAMPLES_EXT, &samples); } + // In practice, a combined depth-stencil buffer is supported by all desktop platforms, while a + // separate stencil buffer is not. On embedded devices however, a combined depth-stencil buffer + // might not be supported while separate buffers are, according to QTBUG-12861. + if (attachment == QGLFramebufferObject::CombinedDepthStencil && (QGLExtensions::glExtensions() & QGLExtensions::PackedDepthStencil)) { // depth and stencil buffer needs another extension - glGenRenderbuffers(1, &depth_stencil_buffer); - Q_ASSERT(!glIsRenderbuffer(depth_stencil_buffer)); - glBindRenderbuffer(GL_RENDERBUFFER_EXT, depth_stencil_buffer); - Q_ASSERT(glIsRenderbuffer(depth_stencil_buffer)); + glGenRenderbuffers(1, &depth_buffer); + Q_ASSERT(!glIsRenderbuffer(depth_buffer)); + glBindRenderbuffer(GL_RENDERBUFFER_EXT, depth_buffer); + Q_ASSERT(glIsRenderbuffer(depth_buffer)); if (samples != 0 && glRenderbufferStorageMultisampleEXT) glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, samples, GL_DEPTH24_STENCIL8_EXT, size.width(), size.height()); @@ -486,24 +486,26 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, glRenderbufferStorage(GL_RENDERBUFFER_EXT, GL_DEPTH24_STENCIL8_EXT, size.width(), size.height()); - GLint i = 0; - glGetRenderbufferParameteriv(GL_RENDERBUFFER_EXT, GL_RENDERBUFFER_DEPTH_SIZE_EXT, &i); + stencil_buffer = depth_buffer; glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, - GL_RENDERBUFFER_EXT, depth_stencil_buffer); + GL_RENDERBUFFER_EXT, depth_buffer); glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, - GL_RENDERBUFFER_EXT, depth_stencil_buffer); - fbo_attachment = QGLFramebufferObject::CombinedDepthStencil; + GL_RENDERBUFFER_EXT, stencil_buffer); valid = checkFramebufferStatus(); - if (!valid) - glDeleteRenderbuffers(1, &depth_stencil_buffer); - } else if (attachment == QGLFramebufferObject::Depth - || attachment == QGLFramebufferObject::CombinedDepthStencil) + if (!valid) { + glDeleteRenderbuffers(1, &depth_buffer); + stencil_buffer = depth_buffer = 0; + } + } + + if (depth_buffer == 0 && (attachment == QGLFramebufferObject::CombinedDepthStencil + || (attachment == QGLFramebufferObject::Depth))) { - glGenRenderbuffers(1, &depth_stencil_buffer); - Q_ASSERT(!glIsRenderbuffer(depth_stencil_buffer)); - glBindRenderbuffer(GL_RENDERBUFFER_EXT, depth_stencil_buffer); - Q_ASSERT(glIsRenderbuffer(depth_stencil_buffer)); + glGenRenderbuffers(1, &depth_buffer); + Q_ASSERT(!glIsRenderbuffer(depth_buffer)); + glBindRenderbuffer(GL_RENDERBUFFER_EXT, depth_buffer); + Q_ASSERT(glIsRenderbuffer(depth_buffer)); if (samples != 0 && glRenderbufferStorageMultisampleEXT) { #ifdef QT_OPENGL_ES #define GL_DEPTH_COMPONENT16 0x81A5 @@ -521,14 +523,53 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, glRenderbufferStorage(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, size.width(), size.height()); #endif } - GLint i = 0; - glGetRenderbufferParameteriv(GL_RENDERBUFFER_EXT, GL_RENDERBUFFER_DEPTH_SIZE_EXT, &i); glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, - GL_RENDERBUFFER_EXT, depth_stencil_buffer); - fbo_attachment = QGLFramebufferObject::Depth; + GL_RENDERBUFFER_EXT, depth_buffer); valid = checkFramebufferStatus(); - if (!valid) - glDeleteRenderbuffers(1, &depth_stencil_buffer); + if (!valid) { + glDeleteRenderbuffers(1, &depth_buffer); + depth_buffer = 0; + } + } + + if (stencil_buffer == 0 && (attachment == QGLFramebufferObject::CombinedDepthStencil)) { + glGenRenderbuffers(1, &stencil_buffer); + Q_ASSERT(!glIsRenderbuffer(stencil_buffer)); + glBindRenderbuffer(GL_RENDERBUFFER_EXT, stencil_buffer); + Q_ASSERT(glIsRenderbuffer(stencil_buffer)); + if (samples != 0 && glRenderbufferStorageMultisampleEXT) { +#ifdef QT_OPENGL_ES + glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, samples, + GL_STENCIL_INDEX8_EXT, size.width(), size.height()); +#else + glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, samples, + GL_STENCIL_INDEX, size.width(), size.height()); +#endif + } else { +#ifdef QT_OPENGL_ES + glRenderbufferStorage(GL_RENDERBUFFER_EXT, GL_STENCIL_INDEX8_EXT, + size.width(), size.height()); +#else + glRenderbufferStorage(GL_RENDERBUFFER_EXT, GL_STENCIL_INDEX, + size.width(), size.height()); +#endif + } + glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, + GL_RENDERBUFFER_EXT, stencil_buffer); + valid = checkFramebufferStatus(); + if (!valid) { + glDeleteRenderbuffers(1, &stencil_buffer); + stencil_buffer = 0; + } + } + + // The FBO might have become valid after removing the depth or stencil buffer. + valid = checkFramebufferStatus(); + + if (depth_buffer && stencil_buffer) { + fbo_attachment = QGLFramebufferObject::CombinedDepthStencil; + } else if (depth_buffer) { + fbo_attachment = QGLFramebufferObject::Depth; } else { fbo_attachment = QGLFramebufferObject::NoAttachment; } @@ -539,6 +580,10 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, glDeleteRenderbuffers(1, &color_buffer); else glDeleteTextures(1, &texture); + if (depth_buffer) + glDeleteRenderbuffers(1, &depth_buffer); + if (stencil_buffer && depth_buffer != stencil_buffer) + glDeleteRenderbuffers(1, &stencil_buffer); glDeleteFramebuffers(1, &fbo); fbo_guard.setId(0); } @@ -821,8 +866,10 @@ QGLFramebufferObject::~QGLFramebufferObject() glDeleteTextures(1, &d->texture); if (d->color_buffer) glDeleteRenderbuffers(1, &d->color_buffer); - if (d->depth_stencil_buffer) - glDeleteRenderbuffers(1, &d->depth_stencil_buffer); + if (d->depth_buffer) + glDeleteRenderbuffers(1, &d->depth_buffer); + if (d->stencil_buffer && d->stencil_buffer != d->depth_buffer) + glDeleteRenderbuffers(1, &d->stencil_buffer); GLuint fbo = d->fbo(); glDeleteFramebuffers(1, &fbo); } diff --git a/src/opengl/qglframebufferobject_p.h b/src/opengl/qglframebufferobject_p.h index d8ff012..58b4e9e 100644 --- a/src/opengl/qglframebufferobject_p.h +++ b/src/opengl/qglframebufferobject_p.h @@ -126,7 +126,7 @@ private: class QGLFramebufferObjectPrivate { public: - QGLFramebufferObjectPrivate() : fbo_guard(0), texture(0), depth_stencil_buffer(0) + QGLFramebufferObjectPrivate() : fbo_guard(0), texture(0), depth_buffer(0), stencil_buffer(0) , color_buffer(0), valid(false), engine(0) {} ~QGLFramebufferObjectPrivate() {} @@ -136,7 +136,8 @@ public: bool checkFramebufferStatus() const; QGLSharedResourceGuard fbo_guard; GLuint texture; - GLuint depth_stencil_buffer; + GLuint depth_buffer; + GLuint stencil_buffer; GLuint color_buffer; GLenum target; QSize size; diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 3c2fd3d..74395a2 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -248,7 +248,11 @@ public: inline void ensurePathTransform() { if (!pathTransformSet) { - setTransform(VG_MATRIX_PATH_USER_TO_SURFACE, pathTransform); + QTransform aliasedTransform = pathTransform; + if (renderingQuality == VG_RENDERING_QUALITY_NONANTIALIASED && currentPen != Qt::NoPen) + aliasedTransform = aliasedTransform + * QTransform::fromTranslate(aliasedCoordinateDelta, -aliasedCoordinateDelta); + setTransform(VG_MATRIX_PATH_USER_TO_SURFACE, aliasedTransform); pathTransformSet = true; } } @@ -306,6 +310,7 @@ inline void QVGPaintEnginePrivate::setRenderingQuality(VGRenderingQuality mode) if (renderingQuality != mode) { vgSeti(VG_RENDERING_QUALITY, mode); renderingQuality = mode; + pathTransformSet = false; // need to tweak transform for aliased stroking } } diff --git a/src/qbase.pri b/src/qbase.pri index 680693f..b431ade 100644 --- a/src/qbase.pri +++ b/src/qbase.pri @@ -183,3 +183,20 @@ QMAKE_PKGCONFIG_VARIABLES += moc_dir uic_dir rcc_dir lupdate_dir lrelease_dir include(qt_targets.pri) win32:DEFINES+=_USE_MATH_DEFINES + +symbian { + # Partial upgrade SIS file + vendorinfo = \ + "; Localised Vendor name" \ + "%{\"Nokia, Qt\"}" \ + " " \ + "; Unique Vendor name" \ + ":\"Nokia, Qt\"" \ + " " + pu_header = "; Partial upgrade package for testing $${TARGET} changes without reinstalling everything" \ + "$${LITERAL_HASH}{\"$${TARGET}\"}, (0x2001E61C), $${QT_MAJOR_VERSION},$${QT_MINOR_VERSION},$${QT_PATCH_VERSION}, TYPE=PU" + partial_upgrade.pkg_prerules = pu_header vendorinfo + partial_upgrade.sources = $$QMAKE_LIBDIR_QT/$${TARGET}.dll + partial_upgrade.path = c:/sys/bin + DEPLOYMENT += partial_upgrade +} diff --git a/src/src.pro b/src/src.pro index f856a0c..9a8b70fc 100644 --- a/src/src.pro +++ b/src/src.pro @@ -110,7 +110,8 @@ src_webkit_declarative.target = sub-webkitdeclarative contains(QT_CONFIG, opengl):src_multimedia.depends += src_opengl src_tools_activeqt.depends = src_tools_idc src_gui src_declarative.depends = src_gui src_script src_network - src_plugins.depends = src_gui src_sql src_svg src_multimedia + src_plugins.depends = src_gui src_sql src_svg + contains(QT_CONFIG, multimedia):src_plugins.depends += src_multimedia src_s60installs.depends = $$TOOLS_SUBDIRS $$SRC_SUBDIRS src_s60installs.depends -= src_s60installs src_imports.depends = src_gui src_declarative diff --git a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp index dca5205..e1b4c1c 100644 --- a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp +++ b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp @@ -493,9 +493,11 @@ void tst_qdeclarativedom::loadDynamicProperty() { QByteArray qml = "import Qt 4.7\n" "Item {\n" + " id: item\n" " property int a: 12\n" " property int b: a + 6\n" " default property QtObject c\n" + " property alias d: item.a\n" "}\n"; QDeclarativeDomDocument document; @@ -504,11 +506,12 @@ void tst_qdeclarativedom::loadDynamicProperty() QDeclarativeDomObject rootObject = document.rootObject(); QVERIFY(rootObject.isValid()); - QCOMPARE(rootObject.dynamicProperties().count(), 3); + QCOMPARE(rootObject.dynamicProperties().count(), 4); { QDeclarativeDomDynamicProperty d = rootObject.dynamicProperties().at(0); QVERIFY(d.isDefaultProperty() == false); + QVERIFY(d.isAlias() == false); QVERIFY(d.defaultValue().isValid()); QVERIFY(d.defaultValue().propertyName() == "a"); QVERIFY(d.defaultValue().value().isLiteral()); @@ -517,6 +520,7 @@ void tst_qdeclarativedom::loadDynamicProperty() { QDeclarativeDomDynamicProperty d = rootObject.dynamicProperties().at(1); QVERIFY(d.isDefaultProperty() == false); + QVERIFY(d.isAlias() == false); QVERIFY(d.defaultValue().isValid()); QVERIFY(d.defaultValue().propertyName() == "b"); QVERIFY(d.defaultValue().value().isBinding()); @@ -525,8 +529,15 @@ void tst_qdeclarativedom::loadDynamicProperty() { QDeclarativeDomDynamicProperty d = rootObject.dynamicProperties().at(2); QVERIFY(d.isDefaultProperty() == true); + QVERIFY(d.isAlias() == false); QVERIFY(d.defaultValue().isValid() == false); } + + { + QDeclarativeDomDynamicProperty d = rootObject.dynamicProperties().at(3); + QVERIFY(d.isDefaultProperty() == false); + QVERIFY(d.isAlias() == true); + } } } diff --git a/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp b/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp index 03df71f..7fd6279 100644 --- a/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp +++ b/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp @@ -63,6 +63,8 @@ private slots: void nonQmlObject(); void nullObject(); void nonQmlContextedObject(); + void types(); + void chaining(); private: QDeclarativeEngine engine; @@ -139,6 +141,68 @@ void tst_qdeclarativeinfo::nonQmlContextedObject() qmlInfo(&object) << "Test Message"; } +void tst_qdeclarativeinfo::types() +{ + QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: false"); + qmlInfo(0) << false; + + QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: 1.1"); + qmlInfo(0) << 1.1; + + QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: 1.2"); + qmlInfo(0) << 1.2f; + + QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: 15"); + qmlInfo(0) << 15; + + QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: 'b'"); + qmlInfo(0) << QChar('b'); + + QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: \"Qt\""); + qmlInfo(0) << QByteArray("Qt"); + + QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: true"); + qmlInfo(0) << QBool(true); + + //### do we actually want QUrl to show up in the output? + //### why the extra space at the end? + QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QUrl(\"http://qt.nokia.com\") "); + qmlInfo(0) << QUrl("http://qt.nokia.com"); + + //### should this be quoted? + QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: hello"); + qmlInfo(0) << QLatin1String("hello"); + + //### should this be quoted? + QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: World"); + QString str("Hello World"); + QStringRef ref(&str, 6, 5); + qmlInfo(0) << ref; + + //### should this be quoted? + QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: Quick"); + qmlInfo(0) << QString ("Quick"); +} + +void tst_qdeclarativeinfo::chaining() +{ + //### should more of these be automatically inserting spaces? + QString str("Hello World"); + QStringRef ref(&str, 6, 5); + QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: false 1.1 1.2 15 hello 'b' QUrl(\"http://qt.nokia.com\") World \"Qt\" true Quick "); + qmlInfo(0) << false << ' ' + << 1.1 << ' ' + << 1.2f << ' ' + << 15 << ' ' + << QLatin1String("hello") << ' ' + << QChar('b') << ' ' + << QUrl("http://qt.nokia.com") + << ref + << QByteArray("Qt") + << QBool(true) + << QString ("Quick"); +} + QTEST_MAIN(tst_qdeclarativeinfo) #include "tst_qdeclarativeinfo.moc" diff --git a/tests/auto/declarative/qdeclarativelanguage/data/notAvailable.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/notAvailable.errors.txt new file mode 100644 index 0000000..af95a53 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/notAvailable.errors.txt @@ -0,0 +1 @@ +3:1:UnavailableType is unavailable for testing diff --git a/tests/auto/declarative/qdeclarativelanguage/data/notAvailable.qml b/tests/auto/declarative/qdeclarativelanguage/data/notAvailable.qml new file mode 100644 index 0000000..7c3c7ee --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/notAvailable.qml @@ -0,0 +1,4 @@ +import Test 1.0 + +UnavailableType { +} diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp b/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp index 20cd976..e697aeb 100644 --- a/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp @@ -54,6 +54,8 @@ void registerTypes() qmlRegisterType<MyGroupedObject>(); qmlRegisterCustomType<MyCustomParserType>("Test", 1, 0, "MyCustomParserType", new MyCustomParserTypeParser); + + qmlRegisterTypeNotAvailable("Test",1,0,"UnavailableType", "UnavailableType is unavailable for testing"); } QVariant myCustomVariantTypeConverter(const QString &data) diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.h b/tests/auto/declarative/qdeclarativelanguage/testtypes.h index ac55bae..2b23a49 100644 --- a/tests/auto/declarative/qdeclarativelanguage/testtypes.h +++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.h @@ -508,6 +508,12 @@ public: } }; +class UnavailableType : public QObject +{ + Q_OBJECT +public: + UnavailableType() {} +}; class MyDotPropertyObject : public QObject { diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index 1825991..37e074b 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -376,6 +376,7 @@ void tst_qdeclarativelanguage::errors_data() 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; + QTest::newRow("notAvailable") << "notAvailable.qml" << "notAvailable.errors.txt" << false; } diff --git a/tests/auto/declarative/qdeclarativeqt/data/quit.qml b/tests/auto/declarative/qdeclarativeqt/data/quit.qml new file mode 100644 index 0000000..f4c8441 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeqt/data/quit.qml @@ -0,0 +1,5 @@ +import Qt 4.7 + +QtObject { + Component.onCompleted: Qt.quit() +} diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp index 895ee6c..739b10a 100644 --- a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp +++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp @@ -50,6 +50,7 @@ #include <QVector3D> #include <QCryptographicHash> #include <QDeclarativeItem> +#include <QSignalSpy> #ifdef Q_OS_SYMBIAN // In Symbian OS test data is located in applications private dir @@ -84,6 +85,7 @@ private slots: void btoa(); void atob(); void fontFamilies(); + void quit(); private: QDeclarativeEngine engine; @@ -518,6 +520,18 @@ void tst_qdeclarativeqt::fontFamilies() delete object; } +void tst_qdeclarativeqt::quit() +{ + QDeclarativeComponent component(&engine, TEST_FILE("quit.qml")); + + QSignalSpy spy(&engine, SIGNAL(quit())); + QObject *object = component.create(); + QVERIFY(object != 0); + QCOMPARE(spy.count(), 1); + + delete object; +} + QTEST_MAIN(tst_qdeclarativeqt) #include "tst_qdeclarativeqt.moc" diff --git a/tests/auto/qapplication/test/test.pro b/tests/auto/qapplication/test/test.pro index 30eb751..2c54c37 100644 --- a/tests/auto/qapplication/test/test.pro +++ b/tests/auto/qapplication/test/test.pro @@ -12,7 +12,7 @@ wince* { } symbian: { - additional.sources = ../desktopsettingsaware/desktopsettingsaware.exe + additional.sources = $$OUT_PWD/../desktopsettingsaware/desktopsettingsaware.exe additional.path = desktopsettingsaware someTest.sources = test.pro someTest.path = test diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 4476084..25ec040 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -377,6 +377,7 @@ private slots: void itemClipsChildrenToShape2(); void itemClipsChildrenToShape3(); void itemClipsChildrenToShape4(); + void itemClipsChildrenToShape5(); void itemClipsTextChildToShape(); void itemClippingDiscovery(); void ancestorFlags(); @@ -5464,6 +5465,193 @@ void tst_QGraphicsItem::itemClipsChildrenToShape4() QTRY_COMPARE(innerWidget->painted, true); } +//#define DEBUG_ITEM_CLIPS_CHILDREN_TO_SHAPE_5 +static inline void renderSceneToImage(QGraphicsScene *scene, QImage *image, const QString &filename) +{ + image->fill(0); + QPainter painter(image); + scene->render(&painter); + painter.end(); +#ifdef DEBUG_ITEM_CLIPS_CHILDREN_TO_SHAPE_5 + image->save(filename); +#else + Q_UNUSED(filename); +#endif +} + +void tst_QGraphicsItem::itemClipsChildrenToShape5() +{ + class ParentItem : public QGraphicsRectItem + { + public: + ParentItem(qreal x, qreal y, qreal width, qreal height) + : QGraphicsRectItem(x, y, width, height) {} + + QPainterPath shape() const + { + QPainterPath path; + path.addRect(50, 50, 200, 200); + return path; + } + }; + + ParentItem *parent = new ParentItem(0, 0, 300, 300); + parent->setBrush(Qt::blue); + parent->setOpacity(0.5); + + const QRegion parentRegion(0, 0, 300, 300); + const QRegion clippedParentRegion = parentRegion & QRect(50, 50, 200, 200); + QRegion childRegion; + QRegion grandChildRegion; + + QGraphicsRectItem *topLeftChild = new QGraphicsRectItem(0, 0, 100, 100); + topLeftChild->setBrush(Qt::red); + topLeftChild->setParentItem(parent); + childRegion += QRect(0, 0, 100, 100); + + QGraphicsRectItem *topRightChild = new QGraphicsRectItem(0, 0, 100, 100); + topRightChild->setBrush(Qt::red); + topRightChild->setParentItem(parent); + topRightChild->setFlag(QGraphicsItem::ItemClipsChildrenToShape); + topRightChild->setPos(200, 0); + childRegion += QRect(200, 0, 100, 100); + + QGraphicsRectItem *topRightGrandChild = new QGraphicsRectItem(0, 0, 100, 100); + topRightGrandChild->setBrush(Qt::green); + topRightGrandChild->setParentItem(topRightChild); + topRightGrandChild->setPos(-40, 40); + grandChildRegion += QRect(200 - 40, 0 + 40, 100, 100) & QRect(200, 0, 100, 100); + + QGraphicsRectItem *bottomLeftChild = new QGraphicsRectItem(0, 0, 100, 100); + bottomLeftChild->setBrush(Qt::red); + bottomLeftChild->setParentItem(parent); + bottomLeftChild->setFlag(QGraphicsItem::ItemClipsToShape); + bottomLeftChild->setPos(0, 200); + childRegion += QRect(0, 200, 100, 100); + + QGraphicsRectItem *bottomLeftGrandChild = new QGraphicsRectItem(0, 0, 160, 160); + bottomLeftGrandChild->setBrush(Qt::green); + bottomLeftGrandChild->setParentItem(bottomLeftChild); + bottomLeftGrandChild->setFlag(QGraphicsItem::ItemClipsToShape); + bottomLeftGrandChild->setPos(0, -60); + grandChildRegion += QRect(0, 200 - 60, 160, 160); + + QGraphicsRectItem *bottomRightChild = new QGraphicsRectItem(0, 0, 100, 100); + bottomRightChild->setBrush(Qt::red); + bottomRightChild->setParentItem(parent); + bottomRightChild->setPos(200, 200); + childRegion += QRect(200, 200, 100, 100); + + QPoint controlPoints[17] = { + QPoint(5, 5) , QPoint(95, 5) , QPoint(205, 5) , QPoint(295, 5) , + QPoint(5, 95) , QPoint(95, 95) , QPoint(205, 95) , QPoint(295, 95) , + QPoint(150, 150), + QPoint(5, 205), QPoint(95, 205), QPoint(205, 205), QPoint(295, 205), + QPoint(5, 295), QPoint(95, 295), QPoint(205, 295), QPoint(295, 295), + }; + + const QRegion clippedChildRegion = childRegion & QRect(50, 50, 200, 200); + const QRegion clippedGrandChildRegion = grandChildRegion & QRect(50, 50, 200, 200); + + QGraphicsScene scene; + scene.addItem(parent); + QImage sceneImage(300, 300, QImage::Format_ARGB32); + +#define VERIFY_CONTROL_POINTS(pRegion, cRegion, gRegion) \ + for (int i = 0; i < 17; ++i) { \ + QPoint controlPoint = controlPoints[i]; \ + QRgb pixel = sceneImage.pixel(controlPoint.x(), controlPoint.y()); \ + if (pRegion.contains(controlPoint)) \ + QVERIFY(qBlue(pixel) != 0); \ + else \ + QVERIFY(qBlue(pixel) == 0); \ + if (cRegion.contains(controlPoint)) \ + QVERIFY(qRed(pixel) != 0); \ + else \ + QVERIFY(qRed(pixel) == 0); \ + if (gRegion.contains(controlPoint)) \ + QVERIFY(qGreen(pixel) != 0); \ + else \ + QVERIFY(qGreen(pixel) == 0); \ + } + + const QList<QGraphicsItem *> children = parent->childItems(); + const int childrenCount = children.count(); + + for (int i = 0; i < 5; ++i) { + QString clipString; + QString childString; + switch (i) { + case 0: + // All children stacked in front. + childString = QLatin1String("ChildrenInFront.png"); + foreach (QGraphicsItem *child, children) + child->setFlag(QGraphicsItem::ItemStacksBehindParent, false); + break; + case 1: + // All children stacked behind. + childString = QLatin1String("ChildrenBehind.png"); + foreach (QGraphicsItem *child, children) + child->setFlag(QGraphicsItem::ItemStacksBehindParent, true); + break; + case 2: + // First half of the children behind, second half in front. + childString = QLatin1String("FirstHalfBehind_SecondHalfInFront.png"); + for (int j = 0; j < childrenCount; ++j) { + QGraphicsItem *child = children.at(j); + child->setFlag(QGraphicsItem::ItemStacksBehindParent, (j < childrenCount / 2)); + } + break; + case 3: + // First half of the children in front, second half behind. + childString = QLatin1String("FirstHalfInFront_SecondHalfBehind.png"); + for (int j = 0; j < childrenCount; ++j) { + QGraphicsItem *child = children.at(j); + child->setFlag(QGraphicsItem::ItemStacksBehindParent, (j >= childrenCount / 2)); + } + break; + case 4: + // Child2 and child4 behind, rest in front. + childString = QLatin1String("Child2And4Behind_RestInFront.png"); + for (int j = 0; j < childrenCount; ++j) { + QGraphicsItem *child = children.at(j); + if (j == 1 || j == 3) + child->setFlag(QGraphicsItem::ItemStacksBehindParent, true); + else + child->setFlag(QGraphicsItem::ItemStacksBehindParent, false); + } + break; + default: + qFatal("internal error"); + } + + // Nothing is clipped. + parent->setFlag(QGraphicsItem::ItemClipsChildrenToShape, false); + parent->setFlag(QGraphicsItem::ItemClipsToShape, false); + clipString = QLatin1String("nothingClipped_"); + renderSceneToImage(&scene, &sceneImage, clipString + childString); + VERIFY_CONTROL_POINTS(parentRegion, childRegion, grandChildRegion); + + // Parent clips children to shape. + parent->setFlag(QGraphicsItem::ItemClipsChildrenToShape); + clipString = QLatin1String("parentClipsChildrenToShape_"); + renderSceneToImage(&scene, &sceneImage, clipString + childString); + VERIFY_CONTROL_POINTS(parentRegion, clippedChildRegion, clippedGrandChildRegion); + + // Parent clips itself and children to shape. + parent->setFlag(QGraphicsItem::ItemClipsToShape); + clipString = QLatin1String("parentClipsItselfAndChildrenToShape_"); + renderSceneToImage(&scene, &sceneImage, clipString + childString); + VERIFY_CONTROL_POINTS(clippedParentRegion, clippedChildRegion, clippedGrandChildRegion); + + // Parent clips itself to shape. + parent->setFlag(QGraphicsItem::ItemClipsChildrenToShape, false); + clipString = QLatin1String("parentClipsItselfToShape_"); + renderSceneToImage(&scene, &sceneImage, clipString + childString); + VERIFY_CONTROL_POINTS(clippedParentRegion, childRegion, grandChildRegion); + } +} + void tst_QGraphicsItem::itemClipsTextChildToShape() { // Construct a scene with a rect that clips its children, with one text diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index 7b5ac7a..af02c55 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -2492,25 +2492,31 @@ void tst_QGraphicsView::optimizationFlags_dontSavePainterState() void tst_QGraphicsView::optimizationFlags_dontSavePainterState2_data() { QTest::addColumn<bool>("savePainter"); - QTest::newRow("With painter state protection") << true; - QTest::newRow("Without painter state protection") << false; + QTest::addColumn<bool>("indirectPainting"); + QTest::newRow("With painter state protection, without indirect painting") << true << false; + QTest::newRow("Without painter state protection, without indirect painting") << false << false; + QTest::newRow("With painter state protectionm, with indirect painting") << true << true; + QTest::newRow("Without painter state protection, with indirect painting") << false << true; } void tst_QGraphicsView::optimizationFlags_dontSavePainterState2() { QFETCH(bool, savePainter); + QFETCH(bool, indirectPainting); class MyScene : public QGraphicsScene { public: void drawBackground(QPainter *p, const QRectF &) - { transformInDrawBackground = p->worldTransform(); } + { transformInDrawBackground = p->worldTransform(); opacityInDrawBackground = p->opacity(); } void drawForeground(QPainter *p, const QRectF &) - { transformInDrawForeground = p->worldTransform(); } + { transformInDrawForeground = p->worldTransform(); opacityInDrawForeground = p->opacity(); } QTransform transformInDrawBackground; QTransform transformInDrawForeground; + qreal opacityInDrawBackground; + qreal opacityInDrawForeground; }; MyScene scene; @@ -2518,9 +2524,13 @@ void tst_QGraphicsView::optimizationFlags_dontSavePainterState2() scene.addRect(0, 0, 20, 20)->setTransform(QTransform::fromScale(2, 2)); scene.addRect(50, 50, 20, 20)->setTransform(QTransform::fromTranslate(200, 200)); + foreach (QGraphicsItem *item, scene.items()) + item->setOpacity(0.6); + CustomView view(&scene); if (!savePainter) view.setOptimizationFlag(QGraphicsView::DontSavePainterState); + view.setOptimizationFlag(QGraphicsView::IndirectPainting, indirectPainting); view.rotate(45); view.scale(1.5, 1.5); view.show(); @@ -2534,10 +2544,38 @@ void tst_QGraphicsView::optimizationFlags_dontSavePainterState2() QVERIFY(view.painted); // Make sure the painter's world transform is preserved after drawItems. - const QTransform expectedTransform = view.viewportTransform(); + QTransform expectedTransform = view.viewportTransform(); QVERIFY(!expectedTransform.isIdentity()); QCOMPARE(scene.transformInDrawForeground, expectedTransform); QCOMPARE(scene.transformInDrawBackground, expectedTransform); + + qreal expectedOpacity = 1.0; + QCOMPARE(scene.opacityInDrawBackground, expectedOpacity); + QCOMPARE(scene.opacityInDrawForeground, expectedOpacity); + + // Trigger more painting, this time from QGraphicsScene::render. + QImage image(scene.sceneRect().size().toSize(), QImage::Format_RGB32); + QPainter painter(&image); + scene.render(&painter); + painter.end(); + + expectedTransform = QTransform(); + QCOMPARE(scene.transformInDrawForeground, expectedTransform); + QCOMPARE(scene.transformInDrawBackground, expectedTransform); + QCOMPARE(scene.opacityInDrawBackground, expectedOpacity); + QCOMPARE(scene.opacityInDrawForeground, expectedOpacity); + + // Trigger more painting with another opacity on the painter. + painter.begin(&image); + painter.setOpacity(0.4); + expectedOpacity = 0.4; + scene.render(&painter); + painter.end(); + + QCOMPARE(scene.transformInDrawForeground, expectedTransform); + QCOMPARE(scene.transformInDrawBackground, expectedTransform); + QCOMPARE(scene.opacityInDrawBackground, expectedOpacity); + QCOMPARE(scene.opacityInDrawForeground, expectedOpacity); } class LodItem : public QGraphicsRectItem diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index f358681..45f5c3e 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -252,6 +252,8 @@ private slots: void QTBUG5939_attachPainterPrivate(); + void drawPointScaled(); + private: void fillData(); void setPenColor(QPainter& p); @@ -3170,7 +3172,6 @@ void fpe_steepSlopes() p.setRenderHint(QPainter::Antialiasing, antialiased); p.setTransform(transform); - QEXPECT_FAIL("steep line 3 aa", "needs to be fixed", Continue); p.drawLine(line); } @@ -4522,6 +4523,26 @@ void tst_QPainter::QTBUG5939_attachPainterPrivate() QCOMPARE(widget->deviceTransform, proxy->deviceTransform); } +void tst_QPainter::drawPointScaled() +{ + QImage image(32, 32, QImage::Format_RGB32); + image.fill(0xffffffff); + + QPainter p(&image); + + p.scale(0.1, 0.1); + + QPen pen; + pen.setWidth(1000); + pen.setColor(Qt::red); + + p.setPen(pen); + p.drawPoint(0, 0); + p.end(); + + QCOMPARE(image.pixel(16, 16), 0xffff0000); +} + QTEST_MAIN(tst_QPainter) #include "tst_qpainter.moc" diff --git a/tests/auto/qsettings/qsettings.pro b/tests/auto/qsettings/qsettings.pro index 115fb13..19513b3 100644 --- a/tests/auto/qsettings/qsettings.pro +++ b/tests/auto/qsettings/qsettings.pro @@ -5,3 +5,4 @@ RESOURCES += qsettings.qrc contains(QT_CONFIG, qt3support):QT += qt3support CONFIG -= debug CONFIG += release +win32-msvc*:LIBS += advapi32.lib diff --git a/tests/auto/qthread/tst_qthread.cpp b/tests/auto/qthread/tst_qthread.cpp index 7a5b053..843749a 100644 --- a/tests/auto/qthread/tst_qthread.cpp +++ b/tests/auto/qthread/tst_qthread.cpp @@ -49,6 +49,7 @@ #include <qtimer.h> #include <qwaitcondition.h> #include <qdebug.h> +#include <qmetaobject.h> #ifdef Q_OS_UNIX #include <pthread.h> @@ -104,6 +105,8 @@ private slots: void adoptedThreadFinished(); void adoptMultipleThreads(); + void QTBUG13810_exitAndStart(); + void stressTest(); }; @@ -934,6 +937,44 @@ void tst_QThread::stressTest() } } +class Syncronizer : public QObject +{ Q_OBJECT +public slots: + void setProp(int p) { + if(m_prop != p) { + m_prop = p; + emit propChanged(p); + } + } +signals: + void propChanged(int); +public: + Syncronizer() : m_prop(42) {} + int m_prop; +}; + +void tst_QThread::QTBUG13810_exitAndStart() +{ + QThread thread; + thread.exit(555); //should do nothing + + thread.start(); + + //test that the thread is running by executing queued connected signal there + Syncronizer sync1; + sync1.moveToThread(&thread); + Syncronizer sync2; + sync2.moveToThread(&thread); + connect(&sync2, SIGNAL(propChanged(int)), &sync1, SLOT(setProp(int)), Qt::QueuedConnection); + connect(&sync1, SIGNAL(propChanged(int)), &thread, SLOT(quit()), Qt::QueuedConnection); + QMetaObject::invokeMethod(&sync2, "setProp", Qt::QueuedConnection , Q_ARG(int, 89)); + QTest::qWait(50); + while(!thread.wait(10)) + QTest::qWait(10); + QCOMPARE(sync2.m_prop, 89); + QCOMPARE(sync1.m_prop, 89); +} + QTEST_MAIN(tst_QThread) #include "tst_qthread.moc" diff --git a/tests/auto/qtimer/tst_qtimer.cpp b/tests/auto/qtimer/tst_qtimer.cpp index f23d065..102308e 100644 --- a/tests/auto/qtimer/tst_qtimer.cpp +++ b/tests/auto/qtimer/tst_qtimer.cpp @@ -89,6 +89,7 @@ private slots: void recurseOnTimeoutAndStopTimer(); void QTBUG13633_dontBlockEvents(); + void postedEventsShouldNotStarveTimers(); }; class TimerHelper : public QObject @@ -723,5 +724,31 @@ void tst_QTimer::QTBUG13633_dontBlockEvents() QVERIFY(t.total > 2); } +class SlotRepeater : public QObject { + Q_OBJECT +public: + SlotRepeater() {} + +public slots: + void repeatThisSlot() + { + QMetaObject::invokeMethod(this, "repeatThisSlot", Qt::QueuedConnection); + } +}; + +void tst_QTimer::postedEventsShouldNotStarveTimers() +{ + TimerHelper timerHelper; + QTimer timer; + connect(&timer, SIGNAL(timeout()), &timerHelper, SLOT(timeout())); + timer.setInterval(0); + timer.setSingleShot(false); + timer.start(); + SlotRepeater slotRepeater; + slotRepeater.repeatThisSlot(); + QTest::qWait(100); + QVERIFY(timerHelper.count > 5); +} + QTEST_MAIN(tst_QTimer) #include "tst_qtimer.moc" diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp index 7e2e800..c7b53e9 100644 --- a/tests/auto/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/qtreeview/tst_qtreeview.cpp @@ -240,6 +240,7 @@ private slots: void taskQTBUG_6450_selectAllWith1stColumnHidden(); void taskQTBUG_9216_setSizeAndUniformRowHeightsWrongRepaint(); void taskQTBUG_11466_keyboardNavigationRegression(); + void taskQTBUG_13567_removeLastItemRegression(); }; class QtTestModel: public QAbstractItemModel @@ -3910,5 +3911,26 @@ void tst_QTreeView::taskQTBUG_11466_keyboardNavigationRegression() QTRY_COMPARE(treeView.currentIndex(), treeView.selectionModel()->selection().indexes().first()); } +void tst_QTreeView::taskQTBUG_13567_removeLastItemRegression() +{ + QtTestModel model(200, 1); + + QTreeView view; + view.setSelectionMode(QAbstractItemView::ExtendedSelection); + view.setModel(&model); + view.show(); + QTest::qWaitForWindowShown(&view); + + view.scrollToBottom(); + QTest::qWait(10); + CHECK_VISIBLE(199, 0); + + view.setCurrentIndex(model.index(199, 0)); + model.removeLastRow(); + QTest::qWait(10); + QCOMPARE(view.currentIndex(), model.index(198, 0)); + CHECK_VISIBLE(198, 0); +} + QTEST_MAIN(tst_QTreeView) #include "tst_qtreeview.moc" diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 098ce3c..2f221d2 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -70,6 +70,7 @@ #include <qtoolbar.h> #include <QtGui/qpaintengine.h> #include <private/qbackingstore_p.h> +#include <qmenubar.h> #include <QtGui/QGraphicsView> #include <QtGui/QGraphicsProxyWidget> @@ -81,8 +82,14 @@ #include <avkon.hrh> // EEikStatusPaneUidTitle #include <akntitle.h> // CAknTitlePane #include <akncontext.h> // CAknContextPane +#endif + +#ifdef Q_OS_SYMBIAN #include <eikspane.h> // CEikStatusPane #include <eikbtgpc.h> // CEikButtonGroupContainer +#include <eikenv.h> // CEikonEnv +#include <eikaufty.h> // MEikAppUiFactory +#include <eikmenub.h> // CEikMenuBar #endif #ifdef Q_WS_QWS @@ -387,6 +394,7 @@ private slots: void maximizedWindowModeTransitions(); void minimizedWindowModeTransitions(); void normalWindowModeTransitions(); + void focusSwitchClosesPopupMenu(); #endif void focusProxyAndInputMethods(); @@ -10253,6 +10261,31 @@ void tst_QWidget::normalWindowModeTransitions() QVERIFY(!buttonGroup->IsVisible()); QVERIFY(!statusPane->IsVisible()); } + +void tst_QWidget::focusSwitchClosesPopupMenu() +{ + QMainWindow mainWindow; + QAction action("Test action", &mainWindow); + mainWindow.menuBar()->addAction(&action); + + mainWindow.show(); + QT_TRAP_THROWING(CEikonEnv::Static()->AppUiFactory()->MenuBar()->TryDisplayMenuBarL()); + QVERIFY(CEikonEnv::Static()->AppUiFactory()->MenuBar()->IsDisplayed()); + + // Close the popup by opening a new window. + QMainWindow mainWindow2; + QAction action2("Test action", &mainWindow2); + mainWindow2.menuBar()->addAction(&action2); + mainWindow2.show(); + QVERIFY(!CEikonEnv::Static()->AppUiFactory()->MenuBar()->IsDisplayed()); + + QT_TRAP_THROWING(CEikonEnv::Static()->AppUiFactory()->MenuBar()->TryDisplayMenuBarL()); + QVERIFY(CEikonEnv::Static()->AppUiFactory()->MenuBar()->IsDisplayed()); + + // Close the popup by switching focus. + mainWindow.activateWindow(); + QVERIFY(!CEikonEnv::Static()->AppUiFactory()->MenuBar()->IsDisplayed()); +} #endif class InputContextTester : public QInputContext diff --git a/tools/assistant/tools/assistant/cmdlineparser.cpp b/tools/assistant/tools/assistant/cmdlineparser.cpp index 1cf2915..181abe2 100644 --- a/tools/assistant/tools/assistant/cmdlineparser.cpp +++ b/tools/assistant/tools/assistant/cmdlineparser.cpp @@ -300,6 +300,13 @@ QString CmdLineParser::collectionFile() const return m_collectionFile; } +bool CmdLineParser::collectionFileGiven() const +{ + TRACE_OBJ + return m_arguments.contains(QLatin1String("-collectionfile"), + Qt::CaseInsensitive); +} + QUrl CmdLineParser::url() const { TRACE_OBJ diff --git a/tools/assistant/tools/assistant/cmdlineparser.h b/tools/assistant/tools/assistant/cmdlineparser.h index db66494..9fc36b3 100644 --- a/tools/assistant/tools/assistant/cmdlineparser.h +++ b/tools/assistant/tools/assistant/cmdlineparser.h @@ -61,6 +61,7 @@ public: void setCollectionFile(const QString &file); QString collectionFile() const; + bool collectionFileGiven() const; QString cloneFile() const; QUrl url() const; bool enableRemoteControl() const; diff --git a/tools/assistant/tools/assistant/main.cpp b/tools/assistant/tools/assistant/main.cpp index bb86bfe..e3eef34 100644 --- a/tools/assistant/tools/assistant/main.cpp +++ b/tools/assistant/tools/assistant/main.cpp @@ -420,16 +420,18 @@ int main(int argc, char *argv[]) cachedCollection.setCurrentFilter(cmd.currentFilter()); } - /* - * We need to be careful here: The main window has to be deleted before - * the help engine wrapper, which has to be deleted before the - * QApplication. - */ if (collectionFileGiven) cmd.setCollectionFile(cachedCollectionFile); + MainWindow *w = new MainWindow(&cmd); w->show(); a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); + + /* + * We need to be careful here: The main window has to be deleted before + * the help engine wrapper, which has to be deleted before the + * QApplication. + */ const int retval = a.exec(); delete w; HelpEngineWrapper::removeInstance(); diff --git a/tools/assistant/tools/assistant/mainwindow.cpp b/tools/assistant/tools/assistant/mainwindow.cpp index 65a58c0..68343a4 100644 --- a/tools/assistant/tools/assistant/mainwindow.cpp +++ b/tools/assistant/tools/assistant/mainwindow.cpp @@ -161,7 +161,7 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent) setupActions(); statusBar()->show(); - if (initHelpDB()) { + if (initHelpDB(!cmdLine->collectionFileGiven())) { setupFilterToolbar(); setupAddressToolbar(); @@ -281,13 +281,18 @@ void MainWindow::closeEvent(QCloseEvent *e) QMainWindow::closeEvent(e); } -bool MainWindow::initHelpDB() +bool MainWindow::initHelpDB(bool registerInternalDoc) { TRACE_OBJ HelpEngineWrapper &helpEngineWrapper = HelpEngineWrapper::instance(); if (!helpEngineWrapper.setupData()) return false; + if (!registerInternalDoc) { + if (helpEngineWrapper.defaultHomePage() == QLatin1String("help")) + helpEngineWrapper.setDefaultHomePage(QLatin1String("about:blank")); + return true; + } bool assistantInternalDocRegistered = false; QString intern(QLatin1String("com.trolltech.com.assistantinternal-")); foreach (const QString &ns, helpEngineWrapper.registeredDocumentations()) { diff --git a/tools/assistant/tools/assistant/mainwindow.h b/tools/assistant/tools/assistant/mainwindow.h index 8219140..26726ee 100644 --- a/tools/assistant/tools/assistant/mainwindow.h +++ b/tools/assistant/tools/assistant/mainwindow.h @@ -121,7 +121,7 @@ private slots: void documentationUpdated(const QString &namespaceName); private: - bool initHelpDB(); + bool initHelpDB(bool registerInternalDoc); void setupActions(); void closeEvent(QCloseEvent *e); void activateDockWidget(QWidget *w); diff --git a/tools/configure/configure.pro b/tools/configure/configure.pro index 8a62fe1..810f006 100644 --- a/tools/configure/configure.pro +++ b/tools/configure/configure.pro @@ -1,5 +1,5 @@ TARGET = configure -DESTDIR = ../.. +DESTDIR = $$PWD/../.. # build directly in source dir CONFIG += console flat CONFIG -= moc qt diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 17bbadf..3808c4e 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -2421,7 +2421,7 @@ void Configure::generateBuildKey() + buildSymbianKey + "\"\n" "#else\n" // Debug builds - "# if (!QT_NO_DEBUG)\n" + "# if !defined(QT_NO_DEBUG)\n" "# if (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))\n" + build64Key.arg("debug") + "\"\n" "# else\n" diff --git a/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp b/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp index 5547761..794722e 100644 --- a/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp +++ b/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp @@ -724,7 +724,7 @@ SignalSlotEditorWindow::SignalSlotEditorWindow(QDesignerFormEditorInterface *cor | QAbstractItemView::EditKeyPressed); m_view->setRootIsDecorated(false); m_view->setTextElideMode (Qt::ElideMiddle); - connect(m_view, SIGNAL(activated(QModelIndex)), this, SLOT(updateUi())); + connect(m_view->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(updateUi())); connect(m_view->header(), SIGNAL(sectionDoubleClicked(int)), m_view, SLOT(resizeColumnToContents(int))); QVBoxLayout *layout = new QVBoxLayout(this); diff --git a/tools/qml/browser/Browser.qml b/tools/qml/browser/Browser.qml index ff2bb47..279c42f 100644 --- a/tools/qml/browser/Browser.qml +++ b/tools/qml/browser/Browser.qml @@ -44,7 +44,7 @@ import Qt.labs.folderlistmodel 1.0 Rectangle { id: root - property bool keyPressed: false + property bool showFocusHighlight: false property variant folders: folders1 property variant view: view1 width: 320 @@ -95,6 +95,19 @@ Rectangle { view.focus = true; folders.folder = path; } + function keyPressed(key) { + switch (key) { + case Qt.Key_Up: + case Qt.Key_Down: + case Qt.Key_Left: + case Qt.Key_Right: + root.showFocusHighlight = true; + break; + default: + // do nothing + break; + } + } Component { id: folderDelegate @@ -113,6 +126,7 @@ Rectangle { Rectangle { id: highlight; visible: false anchors.fill: parent + color: palette.highlight gradient: Gradient { GradientStop { id: t1; position: 0.0; color: palette.highlight } GradientStop { id: t2; position: 1.0; color: Qt.lighter(palette.highlight) } @@ -128,12 +142,16 @@ Rectangle { text: fileName anchors.leftMargin: 54 font.pixelSize: 32 - color: (wrapper.ListView.isCurrentItem && root.keyPressed) ? palette.highlightedText : palette.windowText + color: (wrapper.ListView.isCurrentItem && root.showFocusHighlight) ? palette.highlightedText : palette.windowText elide: Text.ElideRight } MouseArea { id: mouseRegion anchors.fill: parent + onPressed: { + root.showFocusHighlight = false; + wrapper.ListView.view.currentIndex = index; + } onClicked: { if (folders == wrapper.ListView.view.model) launch() } } states: [ @@ -155,7 +173,15 @@ Rectangle { width: parent.width model: folders1 delegate: folderDelegate - highlight: Rectangle { color: palette.highlight; visible: root.keyPressed && view1.count != 0 } + highlight: Rectangle { + color: palette.highlight + visible: root.showFocusHighlight && view1.count != 0 + gradient: Gradient { + GradientStop { id: t1; position: 0.0; color: palette.highlight } + GradientStop { id: t2; position: 1.0; color: Qt.lighter(palette.highlight) } + } + width: view1.currentItem.width + } highlightMoveSpeed: 1000 pressDelay: 100 focus: true @@ -186,7 +212,7 @@ Rectangle { NumberAnimation { properties: "x"; duration: 250 } } ] - Keys.onPressed: { root.keyPressed = true; } + Keys.onPressed: root.keyPressed(event.key) } ListView { @@ -197,7 +223,15 @@ Rectangle { width: parent.width model: folders2 delegate: folderDelegate - highlight: Rectangle { color: palette.highlight; visible: root.keyPressed && view2.count != 0 } + highlight: Rectangle { + color: palette.highlight + visible: root.showFocusHighlight && view2.count != 0 + gradient: Gradient { + GradientStop { id: t1; position: 0.0; color: palette.highlight } + GradientStop { id: t2; position: 1.0; color: Qt.lighter(palette.highlight) } + } + width: view1.currentItem.width + } highlightMoveSpeed: 1000 pressDelay: 100 states: [ @@ -225,11 +259,11 @@ Rectangle { NumberAnimation { properties: "x"; duration: 250 } } ] - Keys.onPressed: { root.keyPressed = true; } + Keys.onPressed: root.keyPressed(event.key) } Keys.onPressed: { - root.keyPressed = true; + root.keyPressed(event.key); if (event.key == Qt.Key_Return || event.key == Qt.Key_Select || event.key == Qt.Key_Right) { view.currentItem.launch(); event.accepted = true; |