diff options
author | Bea Lam <bea.lam@nokia.com> | 2010-07-06 05:46:31 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2010-07-06 05:46:31 (GMT) |
commit | 49dccb31d1e31c4d538f65c62e20268fc2496a6e (patch) | |
tree | a6c930fc8e0056a505475ab24be5233ee8ca859a | |
parent | c9d487b6ed3ac9bb666c2a1fe08252f3c6dcb455 (diff) | |
parent | 7369eaf32dd45b6fb4e72c34bee2c9a44c62a5b4 (diff) | |
download | Qt-49dccb31d1e31c4d538f65c62e20268fc2496a6e.zip Qt-49dccb31d1e31c4d538f65c62e20268fc2496a6e.tar.gz Qt-49dccb31d1e31c4d538f65c62e20268fc2496a6e.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Conflicts:
doc/src/declarative/extending.qdoc
172 files changed, 2759 insertions, 1601 deletions
@@ -1526,8 +1526,8 @@ while [ "$#" -gt 0 ]; do fi ;; gif) - [ "$VAL" = "qt" ] && VAL=yes - if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + [ "$VAL" = "qt" ] && VAL=auto + if [ "$VAL" = "auto" ] || [ "$VAL" = "no" ]; then CFG_GIF="$VAL" else UNKNOWN_OPT=yes @@ -3634,26 +3634,26 @@ Third Party Libraries: + -system-zlib ....... Use zlib from the operating system. See http://www.gzip.org/zlib - -no-gif ............ Do not compile the plugin for GIF reading support. - * -qt-gif ............ Compile the plugin for GIF reading support. - See also src/plugins/imageformats/gif/qgifhandler.h + -no-gif ............ Do not compile GIF reading support. + * -qt-gif ............ Compile GIF reading support. + See also src/gui/image/qgifhandler.h - -no-libtiff ........ Do not compile the plugin for TIFF support. + -no-libtiff ........ Do not compile TIFF support. -qt-libtiff ........ Use the libtiff bundled with Qt. + -system-libtiff .... Use libtiff from the operating system. See http://www.libtiff.org - -no-libpng ......... Do not compile in PNG support. + -no-libpng ......... Do not compile PNG support. -qt-libpng ......... Use the libpng bundled with Qt. + -system-libpng ..... Use libpng from the operating system. See http://www.libpng.org/pub/png - -no-libmng ......... Do not compile the plugin for MNG support. + -no-libmng ......... Do not compile MNG support. -qt-libmng ......... Use the libmng bundled with Qt. + -system-libmng ..... Use libmng from the operating system. See http://www.libmng.com - -no-libjpeg ........ Do not compile the plugin for JPEG support. + -no-libjpeg ........ Do not compile JPEG support. -qt-libjpeg ........ Use the libjpeg bundled with Qt. + -system-libjpeg .... Use libjpeg from the operating system. See http://www.ijg.org @@ -7627,6 +7627,13 @@ cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF EOF fi +if [ -n "$QT_LIBINFIX" ]; then +cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF +#define QT_LIBINFIX "$QT_LIBINFIX" + +EOF +fi + # avoid unecessary rebuilds by copying only if qconfig.h has changed if cmp -s "$outpath/src/corelib/global/qconfig.h" "$outpath/src/corelib/global/qconfig.h.new"; then rm -f "$outpath/src/corelib/global/qconfig.h.new" diff --git a/configure.exe b/configure.exe Binary files differindex 1fddc81..6817331 100755 --- a/configure.exe +++ b/configure.exe diff --git a/demos/.gitignore b/demos/.gitignore new file mode 100644 index 0000000..bc54bd5 --- /dev/null +++ b/demos/.gitignore @@ -0,0 +1,2 @@ +*.dll +*.dso diff --git a/demos/declarative/minehunt/minehunt.pro b/demos/declarative/minehunt/minehunt.pro index aac91f6..f85afeb 100644 --- a/demos/declarative/minehunt/minehunt.pro +++ b/demos/declarative/minehunt/minehunt.pro @@ -27,7 +27,7 @@ symbian:{ TARGET.EPOCALLOWDLLDATA = 1 include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) TARGET.CAPABILITY = NetworkServices ReadUserData - importFiles.sources = qmlminehuntplugin.dll \ + importFiles.sources = MinehuntCore/qmlminehuntplugin.dll \ MinehuntCore/Explosion.qml \ MinehuntCore/pics \ MinehuntCore/qmldir diff --git a/demos/spectrum/app/.gitignore b/demos/spectrum/app/.gitignore new file mode 100644 index 0000000..82cf2a2 --- /dev/null +++ b/demos/spectrum/app/.gitignore @@ -0,0 +1,2 @@ +spectrum +spectrum.exe diff --git a/demos/spectrum/app/app.pro b/demos/spectrum/app/app.pro index c15edf9..ebeef87 100644 --- a/demos/spectrum/app/app.pro +++ b/demos/spectrum/app/app.pro @@ -86,7 +86,7 @@ symbian { !contains(DEFINES, DISABLE_FFT) { # Include FFTReal DLL in the SIS file - fftreal.sources = $${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/fftreal.dll + fftreal.sources = ../3rdparty/fftreal/fftreal.dll fftreal.path = !:/sys/bin DEPLOYMENT += fftreal } diff --git a/doc/src/declarative/basictypes.qdoc b/doc/src/declarative/basictypes.qdoc index 159f40d..109e6d5 100644 --- a/doc/src/declarative/basictypes.qdoc +++ b/doc/src/declarative/basictypes.qdoc @@ -400,3 +400,26 @@ \sa {QML Basic Types} */ + +/*! + \qmlbasictype enumeration + \ingroup qmlbasictypes + + \brief An enumeration type consists of a set of named values. + + An enumeration type consists of a set of named values. + + An enumeration value may be specifed as either a string: + \qml + Text { horizontalAlignment: "AlignRight" } + \endqml + + or as \c {<Element>.<value>}: + \qml + Text { horizontalAlignment: Text.AlignRight } + \endqml + + The second form is preferred. + + \sa {QML Basic Types} +*/ diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index 1ee3574..3b04ddb 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -65,20 +65,22 @@ template<typename T> int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const char *qmlName) \endcode -Calling qmlRegisterType() registers the C++ type \a T with the QML system, and makes it available in QML -under the name \a qmlName in library \a uri version \a versionMajor.versionMinor. -The \a qmlName can be the same as the C++ type name. +Calling qmlRegisterType() registers the C++ type \a T with the QML +system, and makes it available in QML under the name \a qmlName in +library \a uri version \a versionMajor.versionMinor. The \a qmlName +can be the same as the C++ type name. Type \a T must be a concrete type that inherits QObject and has a default constructor. + \endquotation -Types can be registered by libraries (such as Qt does), application code, -or by plugins (see QDeclarativeExtensionPlugin). +Types can be registered by libraries, application code, or by plugins +(see QDeclarativeExtensionPlugin). -Once registered, all of the \l {Qt's Property System}{properties} of a supported -type are available for use within QML. QML has intrinsic support for properties -of these types: +Once registered, all \l {Qt's Property System}{properties} of the +supported types are available in QML. QML has intrinsic support for +properties of these types: \list \o bool @@ -94,9 +96,14 @@ of these types: \o QVariant \endlist -QML is typesafe. Attempting to assign an invalid value to a property will -generate an error. For example, assuming the name property of the \c Person -element had a type of QString, this would cause an error: +When a property of a supported type is added to a C++ class, in a QML +element based on the C++ class, a \e{value-changed} signal handler +will be available. See \l{Signal Support} below. + +QML is typesafe. Attempting to assign an invalid value to a property +will generate an error. For example, assuming the \e{name} property +of the \c Person element had a type of QString, this would cause an +error: \code Person { @@ -412,7 +419,28 @@ value will not be accessible from script. implement the onPartyStarted signal property. If you want to use signals from items not created in QML, you can access their -signals with the \l {Connections}Â element. +signals with the \l {Connections} element. + +Additionally, if a property is added to a C++ class, all QML elements +based on that C++ class will have a \e{value-changed} signal handler +for that property. The name of the signal handler is \e{on<Property +name>Changed}, with the first letter of the property name being upper +cased. + +\note If the NOTIFY signal for the added property is not simply +\c{<property_name>Changed()}, then you will get two equivalent signal +handlers, one because of the signal, one because of the property. For +example, if the property \c{test_property} with NOTIFY signal +\c{testPropChanged()} is added to a C++ class, then QML elements based +on that C++ class will have two signal handlers: +\c{onTest_propertyChanged} because of the property, and +\c{onTestPropChanged} because of the NOTIFY signal. For clarity, we +suggest that for properties exposed to QML in this way, the name of +the NOTIFY signal should be just \c{<property_name>Changed()}, so that +there will be just one signal handler in QML and one naming +convention used. + +See also \l {Extending types from QML}. \section1 Property Value Sources @@ -702,9 +730,30 @@ controls the color of the inner rectangle. \endcode +\section3 Property signal handlers + +Adding a property to an item automatically adds a \e{value-changed} +signal handler to the item. The signal hander is named +\c{on<Property_name>Changed}, with the first letter of the property +name being upper case. + +Signal handlers can have arbitrary JavaScript code assigned. The following +example shows how to output to a text console a new value of property +\c{innerColor} whenever the value of this property changes. + +\code + Rectangle { + id: rect + property color innerColor: "black" + + onInnerColorChanged: { console.log(rect.innerColor); } + } +\endcode + + \section3 Setting default properties -The optional "default" attribute marks a property as the \e {default property} +The optional \c default attribute for a property marks it as the \e {default property} for a type. This allows other items to specify the default property's value as child elements. For example, the \l Item element's default property is its \l{Item::children}{children} property. This allows the children of an \l Item @@ -729,12 +778,14 @@ Item { } \endqml +See the \l{declarative/ui-components/tabwidget}{TabWidget} example for a +demonstration of using default properties. + Specifying a default property overrides any existing default property (for example, any default property inherited from a parent item). Using the default attribute twice in the same type block is an error. - \target qml-property-aliases \section2 Property aliases diff --git a/doc/src/declarative/modules.qdoc b/doc/src/declarative/modules.qdoc index a77c64e..938222a 100644 --- a/doc/src/declarative/modules.qdoc +++ b/doc/src/declarative/modules.qdoc @@ -103,9 +103,16 @@ the \c qmldir file. Types which you do not wish to export to users of your modul may be marked with the \c internal keyword: \c internal <TypeName> <File>. The same type can be provided by different files in different versions, in which -case later earlier versions (eg. 1.2) must precede earlier versions (eg. 1.0), +case later versions (eg. 1.2) must precede earlier versions (eg. 1.0), since the \e first name-version match is used and a request for a version of a type -can be fulfilled by one defined in an earlier version of the module. +can be fulfilled by one defined in an earlier version of the module. If a user attempts +to import a version earlier than the earliest provided or later than the latest provided, +an error results, but if the user imports a version within the range of versions provided, +even if no type is specific to that version, no error results. + +A single module, in all versions, may only be provided in a single directory (and a single \c qmldir file). +If multiple are provided, only the first in the search path will be used (regardless of whether other versions +are provided by directories later in the search path). Installed and remote files without a namespace \e must be referred to by version information described above, local files \e may have it. diff --git a/doc/src/examples/qml-webbrowser.qdoc b/doc/src/examples/qml-webbrowser.qdoc index d322b02..a3cef66 100644 --- a/doc/src/examples/qml-webbrowser.qdoc +++ b/doc/src/examples/qml-webbrowser.qdoc @@ -6,35 +6,21 @@ ** ** This file is part of the documentation of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** $QT_BEGIN_LICENSE:FDL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in a +** written agreement between you and Nokia. +** +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of this +** file. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/doc/src/external-resources.qdoc b/doc/src/external-resources.qdoc index d4dc2b1..cbd66ee 100644 --- a/doc/src/external-resources.qdoc +++ b/doc/src/external-resources.qdoc @@ -410,6 +410,11 @@ */ /*! + \externalpage http://www.iso.org/iso/date_and_time_format + \title ISO 8601 +*/ + +/*! \externalpage http://opensource.org/licenses/bsd-license.php \title New and Modified BSD Licenses -*/ +*/
\ No newline at end of file diff --git a/doc/src/index.qdoc b/doc/src/index.qdoc index da50a6d..18a1746 100644 --- a/doc/src/index.qdoc +++ b/doc/src/index.qdoc @@ -70,15 +70,15 @@ <li><a href="declarativeui.html">Device UI's & Qt Quick</a></li> <li><a href="qt-gui-concepts.html">Desktop UI components</a></li> <li><a href="platform-specific.html">Platform-specific info</a></li> - <li><a href="qt-graphics.html">Graphics, Painting & Printing</a></li> - <li><a href="qt-network.html">Input/Output & networking</a></li> + <li><a href="qt-graphics.html">Graphics, Painting & Printing</a></li> + <li><a href="qt-network.html">Input/Output & networking</a></li> </ul> </div> <div class="sectionlist"> <ul> <li><a href="model-view-programming.html">Model/View programming</a></li> <li><a href="technology-apis.html">Qt API's for other technologies</a></li> - <li><a href="best-practices.html">Qt How-to's & best practices</a></li> + <li><a href="best-practices.html">Qt How-to's & best practices</a></li> <li><a href="developing-with-qt.html">Cross-platform development</a></li> </ul> </div> diff --git a/doc/src/platforms/symbian-introduction.qdoc b/doc/src/platforms/symbian-introduction.qdoc index 1b3641d..22d858f 100644 --- a/doc/src/platforms/symbian-introduction.qdoc +++ b/doc/src/platforms/symbian-introduction.qdoc @@ -112,6 +112,7 @@ \row \o \c release-armv5 \o Build release binaries for hardware using RVCT. \row \o \c run \o Run the application on the emulator. \row \o \c runonphone \o Run the application on a device. + \row \o \c deploy \o Deploys the project into a device. \row \o \c sis \o Create signed \c .sis file for project. \row \o \c unsigned_sis \o Create unsigned \c .sis file for project. \row \o \c installer_sis \o Create signed \l{Smart Installer}{smart installer} @@ -172,7 +173,7 @@ By default empty. \endtable - The suppported options for \c QT_SIS_OPTIONS: + The supported options for \c QT_SIS_OPTIONS: \target Supported options for QT_SIS_OPTIONS \table @@ -186,7 +187,7 @@ \endtable Execute the \c{createpackage.pl} script without any - parameters for detailed information about options. By default no otions are given. + parameters for detailed information about options. By default no options are given. For example: @@ -196,9 +197,9 @@ \snippet doc/src/snippets/code/doc_src_symbian-introduction.qdoc 3 - If you want to install the program immediately, make sure that the device - is connected to the computer in "PC Suite" mode, and run \c sis target - with the \c QT_SIS_OPTIONS=-i, like this: + If you want to install the program immediately after creating \c .sis file, + make sure that the device is connected to the computer in "PC Suite" mode, + and use \c deploy target instead of \c sis target: \snippet doc/src/snippets/code/doc_src_symbian-introduction.qdoc 5 diff --git a/doc/src/snippets/code/doc_src_symbian-introduction.qdoc b/doc/src/snippets/code/doc_src_symbian-introduction.qdoc index 60c69c0..a2ea686 100644 --- a/doc/src/snippets/code/doc_src_symbian-introduction.qdoc +++ b/doc/src/snippets/code/doc_src_symbian-introduction.qdoc @@ -63,6 +63,5 @@ //! [4] //! [5] - set QT_SIS_OPTIONS=-i - make sis + make deploy //! [5] diff --git a/doc/src/template/scripts/functions.js b/doc/src/template/scripts/functions.js index 2723ff2..faa4ca4 100755 --- a/doc/src/template/scripts/functions.js +++ b/doc/src/template/scripts/functions.js @@ -63,11 +63,9 @@ function processNokiaData(response){ if(propertyTags[i].getElementsByTagName('pageType')[0].firstChild.nodeValue == 'APIPage'){ lookupCount++; - for (var j=0; j< propertyTags[i].getElementsByTagName('pageWords').length; j++){ full_li_element = linkStart + propertyTags[i].getElementsByTagName('pageUrl')[j].firstChild.nodeValue; full_li_element = full_li_element + "'>" + propertyTags[i].getElementsByTagName('pageTitle')[0].firstChild.nodeValue + linkEnd; - $('#ul001').append(full_li_element); $('#ul001 .defaultLink').css('display','none'); @@ -77,7 +75,6 @@ function processNokiaData(response){ if(propertyTags[i].getElementsByTagName('pageType')[0].firstChild.nodeValue == 'Article'){ articleCount++; - for (var j=0; j< propertyTags[i].getElementsByTagName('pageWords').length; j++){ full_li_element = linkStart + propertyTags[i].getElementsByTagName('pageUrl')[j].firstChild.nodeValue; full_li_element =full_li_element + "'>" + propertyTags[i].getElementsByTagName('pageTitle')[0].firstChild.nodeValue + linkEnd ; @@ -103,10 +100,13 @@ function processNokiaData(response){ if(i==propertyTags.length){$('#pageType').removeClass('loading');} } + if(lookupCount > 0){$('#ul001 .menuAlert').remove();$('#ul001').prepend('<li class=\"menuAlert liveResult hit\">Found ' + lookupCount + ' hits</li>');$('#ul001 li').css('display','block');$('.sidebar .search form input').removeClass('loading');} + if(articleCount > 0){$('#ul002 .menuAlert').remove();$('#ul002').prepend('<li class=\"menuAlert liveResult hit\">Found ' + articleCount + ' hits</li>');$('#ul002 li').css('display','block');} + if(exampleCount > 0){$('#ul003 .menuAlert').remove();$('#ul003').prepend('<li class=\"menuAlert liveResult hit\">Found ' + articleCount + ' hits</li>');$('#ul003 li').css('display','block');} - if(lookupCount == 0){$('#ul001').prepend('<li class=\"menuAlert liveResult noMatch\">Found no result</li>');$('#ul001 li').css('display','block');$('.sidebar .search form input').removeClass('loading');} - if(articleCount == 0){$('#ul002').prepend('<li class=\"menuAlert liveResult noMatch\">Found no result</li>');$('#ul002 li').css('display','block');} - if(exampleCount == 0){$('#ul003').prepend('<li class=\"menuAlert liveResult noMatch\">Found no result</li>');$('#ul003 li').css('display','block');} + if(lookupCount == 0){$('#ul001 .menuAlert').remove();$('#ul001').prepend('<li class=\"menuAlert liveResult noMatch\">Found no result</li>');$('#ul001 li').css('display','block');$('.sidebar .search form input').removeClass('loading');} + if(articleCount == 0){$('#ul002 .menuAlert').remove();$('#ul002').prepend('<li class=\"menuAlert liveResult noMatch\">Found no result</li>');$('#ul002 li').css('display','block');} + if(exampleCount == 0){$('#ul003 .menuAlert').remove();$('#ul003').prepend('<li class=\"menuAlert liveResult noMatch\">Found no result</li>');$('#ul003 li').css('display','block');} // reset count variables; lookupCount=0; articleCount = 0; @@ -121,6 +121,7 @@ function CheckEmptyAndLoadList() var pageVal = $('title').html(); $('#feedUrl').remove(); $('#pageVal').remove(); + $('.menuAlert').remove(); $('#feedform').append('<input id="feedUrl" name="feedUrl" value="'+pageUrl+'" style="display:none;">'); $('#feedform').append('<input id="pageVal" name="pageVal" value="'+pageVal+'" style="display:none;">'); $('.liveResult').remove(); @@ -170,6 +171,7 @@ else if (this.timer) clearTimeout(this.timer); this.timer = setTimeout(function () { $('#pageType').addClass('loading'); + $('.searching').remove(); $('.list ul').prepend('<li class="menuAlert searching">Searching...</li>'); $.ajax({ contentType: "application/x-www-form-urlencoded", @@ -180,7 +182,8 @@ else success: function (response, textStatus) { $('.liveResult').remove(); - $('#pageType').removeClass('loading'); + $('.searching').remove(); + $('#pageType').removeClass('loading'); $('.list ul').prepend('<li class="menuAlert searching">Searching...</li>'); processNokiaData(response); diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index f1a63a9..299806b 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -239,7 +239,7 @@ width: 158px; height: 19px; padding: 0; - border: none; + border: 0px; outline: none; font: 13px/1.2 Verdana; } @@ -328,13 +328,18 @@ { background: url(../images/box_bg.png) repeat-x 0 bottom; } - .sidebar .box ul li.menuAlert + .sidebar .box ul li.noMatch { background: none; - color:gray; + color:#FF2A00; font-style:italic; } - + .sidebar .box ul li.hit + { + background: none; + color:#AAD2F0; + font-style:italic; + } .wrap { @@ -829,12 +834,14 @@ } .qmlreadonly { + padding-left: 5px; float: right; color: #254117; } .qmldefault { + padding-left: 5px; float: right; color: red; } @@ -855,7 +862,7 @@ position: fixed; top: 100px; left: 33%; - height: 190px; + height: 230px; width: 400px; padding: 5px; background-color: #e6e7e8; @@ -879,12 +886,25 @@ height: 120px; margin: 0px 25px 10px 15px; } + #noteHead + { + font-weight:bold; + padding:10px 10px 10px 20px; + } #feedsubmit { display: inline; float: right; margin: 4px 32px 0 0; } + + .note + { + font-size:7pt; + padding-bottom:3px; + padding-left:20px; + } + #blurpage { display: none; @@ -1231,12 +1251,19 @@ pre.highlightedCode { .navTop{ float:right; padding-right:5px; - padding-top:15px; + margin-top:15px; } .wrap .content .toc h3{ - border-bottom:none; + border-bottom:0px; + margin-top:0px; } + + .wrap .content .toc h3 a:hover{ + color:#00732F; + text-decoration:none; + } + /* end of screen media */ /* start of print media */ diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index baa519f..c1b31e5 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -67,7 +67,7 @@ QMAKE_LINK_OBJECT_SCRIPT= QMAKE_LIBS = -llibc -llibm -leuser -llibdl QMAKE_LIBS_CORE = $$QMAKE_LIBS -lefsrv -lhal -lbafl -QMAKE_LIBS_GUI = $$QMAKE_LIBS_CORE -lfbscli -lbitgdi -lgdi -lws32 -lapgrfx -lcone -leikcore -lmediaclientaudio -leikcoctl -leiksrv -lapparc -lcentralrepository +QMAKE_LIBS_GUI = $$QMAKE_LIBS_CORE -lfbscli -lbitgdi -lgdi -lws32 -lapgrfx -lcone -leikcore -lmediaclientaudio -lapparc -lcentralrepository QMAKE_LIBS_NETWORK = QMAKE_LIBS_EGL = -llibEGL QMAKE_LIBS_OPENGL = @@ -75,7 +75,7 @@ QMAKE_LIBS_OPENVG = -llibOpenVG -lfbscli -lbitgdi -lgdi QMAKE_LIBS_THREAD = -llibpthread QMAKE_LIBS_COMPAT = QMAKE_LIBS_QT_ENTRY = -llibcrt0.lib -QMAKE_LIBS_S60 = -lavkon +QMAKE_LIBS_S60 = -lavkon -leikcoctl exists($${EPOCROOT}epoc32/include/platform/sgresource/sgimage.h) { QMAKE_LIBS_OPENVG += -lsgresource diff --git a/mkspecs/features/sis_targets.prf b/mkspecs/features/sis_targets.prf index c31e38f..19972d7 100644 --- a/mkspecs/features/sis_targets.prf +++ b/mkspecs/features/sis_targets.prf @@ -159,6 +159,16 @@ equals(GENERATE_SIS_TARGETS, true) { QMAKE_DISTCLEAN += $${sis_destdir}/$${baseTarget}.sis } + + deploy_target.target = deploy + contains(QMAKE_HOST.os, "Windows") { + deploy_target.depends = sis + deploy_target.commands = call $$target_sis_target.target + } else { + deploy_target.commands = @echo Deployment not supported in this environment + } + QMAKE_EXTRA_TARGETS += deploy_target + } else { contains(TEMPLATE, subdirs) { # Enable recursive sis target. diff --git a/mkspecs/features/symbian/def_files.prf b/mkspecs/features/symbian/def_files.prf index bae9d2d..f243878 100644 --- a/mkspecs/features/symbian/def_files.prf +++ b/mkspecs/features/symbian/def_files.prf @@ -3,6 +3,10 @@ CONFIG -= def_files_disabled +# We need a target name without the INFIX'ed part, since DEF files are not infixed. +equals(QMAKE_TARGET_PRODUCT, Qt4):clean_TARGET = $$replace(TARGET, "$${QT_LIBINFIX}$", "") +else:clean_TARGET = $$TARGET + symbian-abld|symbian-sbsv2 { # Firstly, if the MMP_RULES already contain a defBlock variable, don't generate another one # (this bit is slightly magic, because it depends upon everyone creating their DEFFILE statements @@ -17,25 +21,25 @@ symbian-abld|symbian-sbsv2 { !isEmpty(DEF_FILE) { defBlock = \ "$${LITERAL_HASH}ifdef WINSCW" \ - "DEFFILE $$DEF_FILE/bwins/$${TARGET}.def" \ + "DEFFILE $$DEF_FILE/bwins/$${clean_TARGET}.def" \ "$${LITERAL_HASH}elif defined EABI" \ - "DEFFILE $$DEF_FILE/eabi/$${TARGET}.def" \ + "DEFFILE $$DEF_FILE/eabi/$${clean_TARGET}.def" \ "$${LITERAL_HASH}endif" } else:!isEmpty(defFilePath) { defBlock = \ "$${LITERAL_HASH}ifdef WINSCW" \ - "DEFFILE $$defFilePath/bwins/$${TARGET}.def" \ + "DEFFILE $$defFilePath/bwins/$${clean_TARGET}.def" \ "$${LITERAL_HASH}elif defined EABI" \ - "DEFFILE $$defFilePath/eabi/$${TARGET}.def" \ + "DEFFILE $$defFilePath/eabi/$${clean_TARGET}.def" \ "$${LITERAL_HASH}endif" } else { # If defFilePath is not defined, then put the folders containing the DEF files at the # same level as the .pro (and generated MMP) file(s) defBlock = \ "$${LITERAL_HASH}ifdef WINSCW" \ - "DEFFILE ./bwins/$${TARGET}.def" \ + "DEFFILE ./bwins/$${clean_TARGET}.def" \ "$${LITERAL_HASH}elif defined EABI" \ - "DEFFILE ./eabi/$${TARGET}.def" \ + "DEFFILE ./eabi/$${clean_TARGET}.def" \ "$${LITERAL_HASH}endif" } MMP_RULES += defBlock @@ -52,7 +56,7 @@ symbian-abld|symbian-sbsv2 { !exists("$$_PRO_FILE_PWD_/$$defFile/eabi") { system("$$QMAKE_MKDIR $$_PRO_FILE_PWD_/$$defFile/eabi") } - elf2e32FileToAdd = $$_PRO_FILE_PWD_/$$defFile/eabi/$$basename(TARGET)u.def + elf2e32FileToAdd = $$_PRO_FILE_PWD_/$$defFile/eabi/$$basename(clean_TARGET)u.def } else { elf2e32FileToAdd = $$_PRO_FILE_PWD_/$$defFile } diff --git a/mkspecs/features/symbian/symbian_building.prf b/mkspecs/features/symbian/symbian_building.prf index c4088ca..ce124ec 100644 --- a/mkspecs/features/symbian/symbian_building.prf +++ b/mkspecs/features/symbian/symbian_building.prf @@ -1,7 +1,11 @@ +# We need a target name without the INFIX'ed part, since flags are not infixed. +equals(QMAKE_TARGET_PRODUCT, Qt4):clean_TARGET = $$replace(TARGET, "$${QT_LIBINFIX}$", "") +else:clean_TARGET = $$TARGET + # we have some module specific options (defined in qt.prf) lets add them -!contains(TARGET, ".*[ -/].*"):eval(TMPVAR = \$\$QMAKE_$${TARGET}_CXXFLAGS) +!contains(clean_TARGET, ".*[ -/].*"):eval(TMPVAR = \$\$QMAKE_$${clean_TARGET}_CXXFLAGS) !isEmpty(TMPVAR):QMAKE_CXXFLAGS += $$TMPVAR -!contains(TARGET, ".*[ -/].*"):eval(TMPVAR = \$\$QMAKE_$${TARGET}_LFLAGS) +!contains(clean_TARGET, ".*[ -/].*"):eval(TMPVAR = \$\$QMAKE_$${clean_TARGET}_LFLAGS) !isEmpty(TMPVAR) { QMAKE_LFLAGS += $$TMPVAR } else :linux-gcce { # lets provide a simple default. Without elf2e32 complains diff --git a/src/3rdparty/libjpeg.pri b/src/3rdparty/libjpeg.pri new file mode 100644 index 0000000..4551d7b --- /dev/null +++ b/src/3rdparty/libjpeg.pri @@ -0,0 +1,48 @@ +INCLUDEPATH += $$PWD/libjpeg +SOURCES += \ + $$PWD/libjpeg/jaricom.c \ + $$PWD/libjpeg/jcapimin.c \ + $$PWD/libjpeg/jcapistd.c \ + $$PWD/libjpeg/jcarith.c \ + $$PWD/libjpeg/jccoefct.c \ + $$PWD/libjpeg/jccolor.c \ + $$PWD/libjpeg/jcdctmgr.c \ + $$PWD/libjpeg/jchuff.c \ + $$PWD/libjpeg/jcinit.c \ + $$PWD/libjpeg/jcmainct.c \ + $$PWD/libjpeg/jcmarker.c \ + $$PWD/libjpeg/jcmaster.c \ + $$PWD/libjpeg/jcomapi.c \ + $$PWD/libjpeg/jcparam.c \ + $$PWD/libjpeg/jcprepct.c \ + $$PWD/libjpeg/jcsample.c \ + $$PWD/libjpeg/jctrans.c \ + $$PWD/libjpeg/jdapimin.c \ + $$PWD/libjpeg/jdapistd.c \ + $$PWD/libjpeg/jdarith.c \ + $$PWD/libjpeg/jdatadst.c \ + $$PWD/libjpeg/jdatasrc.c \ + $$PWD/libjpeg/jdcoefct.c \ + $$PWD/libjpeg/jdcolor.c \ + $$PWD/libjpeg/jddctmgr.c \ + $$PWD/libjpeg/jdhuff.c \ + $$PWD/libjpeg/jdinput.c \ + $$PWD/libjpeg/jdmainct.c \ + $$PWD/libjpeg/jdmarker.c \ + $$PWD/libjpeg/jdmaster.c \ + $$PWD/libjpeg/jdmerge.c \ + $$PWD/libjpeg/jdpostct.c \ + $$PWD/libjpeg/jdsample.c \ + $$PWD/libjpeg/jdtrans.c \ + $$PWD/libjpeg/jerror.c \ + $$PWD/libjpeg/jfdctflt.c \ + $$PWD/libjpeg/jfdctfst.c \ + $$PWD/libjpeg/jfdctint.c \ + $$PWD/libjpeg/jidctflt.c \ + $$PWD/libjpeg/jidctfst.c \ + $$PWD/libjpeg/jidctint.c \ + $$PWD/libjpeg/jquant1.c \ + $$PWD/libjpeg/jquant2.c \ + $$PWD/libjpeg/jutils.c \ + $$PWD/libjpeg/jmemmgr.c \ + $$PWD/libjpeg/jmemnobs.c diff --git a/src/3rdparty/libmng.pri b/src/3rdparty/libmng.pri new file mode 100644 index 0000000..7b68210 --- /dev/null +++ b/src/3rdparty/libmng.pri @@ -0,0 +1,25 @@ +DEFINES += MNG_BUILD_SO +DEFINES += MNG_NO_INCLUDE_JNG +INCLUDEPATH += $$PWD/libmng +SOURCES += \ + $$PWD/libmng/libmng_callback_xs.c \ + $$PWD/libmng/libmng_chunk_io.c \ + $$PWD/libmng/libmng_chunk_descr.c \ + $$PWD/libmng/libmng_chunk_prc.c \ + $$PWD/libmng/libmng_chunk_xs.c \ + $$PWD/libmng/libmng_cms.c \ + $$PWD/libmng/libmng_display.c \ + $$PWD/libmng/libmng_dither.c \ + $$PWD/libmng/libmng_error.c \ + $$PWD/libmng/libmng_filter.c \ + $$PWD/libmng/libmng_hlapi.c \ + $$PWD/libmng/libmng_jpeg.c \ + $$PWD/libmng/libmng_object_prc.c \ + $$PWD/libmng/libmng_pixels.c \ + $$PWD/libmng/libmng_prop_xs.c \ + $$PWD/libmng/libmng_read.c \ + $$PWD/libmng/libmng_trace.c \ + $$PWD/libmng/libmng_write.c \ + $$PWD/libmng/libmng_zlib.c + +include($$PWD/zlib_dependency.pri) diff --git a/src/3rdparty/libpng.pri b/src/3rdparty/libpng.pri new file mode 100644 index 0000000..7ac1910 --- /dev/null +++ b/src/3rdparty/libpng.pri @@ -0,0 +1,20 @@ +DEFINES *= QT_USE_BUNDLED_LIBPNG +!isEqual(QT_ARCH, i386):!isEqual(QT_ARCH, x86_64):DEFINES += PNG_NO_ASSEMBLER_CODE +INCLUDEPATH += $$PWD/libpng +SOURCES += $$PWD/libpng/png.c \ + $$PWD/libpng/pngerror.c \ + $$PWD/libpng/pngget.c \ + $$PWD/libpng/pngmem.c \ + $$PWD/libpng/pngpread.c \ + $$PWD/libpng/pngread.c \ + $$PWD/libpng/pngrio.c \ + $$PWD/libpng/pngrtran.c \ + $$PWD/libpng/pngrutil.c \ + $$PWD/libpng/pngset.c \ + $$PWD/libpng/pngtrans.c \ + $$PWD/libpng/pngwio.c \ + $$PWD/libpng/pngwrite.c \ + $$PWD/libpng/pngwtran.c \ + $$PWD/libpng/pngwutil.c + +include($$PWD/zlib_dependency.pri) diff --git a/src/3rdparty/libtiff.pri b/src/3rdparty/libtiff.pri new file mode 100644 index 0000000..e43e1fe --- /dev/null +++ b/src/3rdparty/libtiff.pri @@ -0,0 +1,43 @@ +INCLUDEPATH += $$PWD/libtiff/libtiff +SOURCES += \ + $$PWD/libtiff/libtiff/tif_aux.c \ + $$PWD/libtiff/libtiff/tif_close.c \ + $$PWD/libtiff/libtiff/tif_codec.c \ + $$PWD/libtiff/libtiff/tif_color.c \ + $$PWD/libtiff/libtiff/tif_compress.c \ + $$PWD/libtiff/libtiff/tif_dir.c \ + $$PWD/libtiff/libtiff/tif_dirinfo.c \ + $$PWD/libtiff/libtiff/tif_dirread.c \ + $$PWD/libtiff/libtiff/tif_dirwrite.c \ + $$PWD/libtiff/libtiff/tif_dumpmode.c \ + $$PWD/libtiff/libtiff/tif_error.c \ + $$PWD/libtiff/libtiff/tif_extension.c \ + $$PWD/libtiff/libtiff/tif_fax3.c \ + $$PWD/libtiff/libtiff/tif_fax3sm.c \ + $$PWD/libtiff/libtiff/tif_flush.c \ + $$PWD/libtiff/libtiff/tif_getimage.c \ + $$PWD/libtiff/libtiff/tif_luv.c \ + $$PWD/libtiff/libtiff/tif_lzw.c \ + $$PWD/libtiff/libtiff/tif_next.c \ + $$PWD/libtiff/libtiff/tif_open.c \ + $$PWD/libtiff/libtiff/tif_packbits.c \ + $$PWD/libtiff/libtiff/tif_pixarlog.c \ + $$PWD/libtiff/libtiff/tif_predict.c \ + $$PWD/libtiff/libtiff/tif_print.c \ + $$PWD/libtiff/libtiff/tif_read.c \ + $$PWD/libtiff/libtiff/tif_strip.c \ + $$PWD/libtiff/libtiff/tif_swab.c \ + $$PWD/libtiff/libtiff/tif_thunder.c \ + $$PWD/libtiff/libtiff/tif_tile.c \ + $$PWD/libtiff/libtiff/tif_version.c \ + $$PWD/libtiff/libtiff/tif_warning.c \ + $$PWD/libtiff/libtiff/tif_write.c \ + $$PWD/libtiff/libtiff/tif_zip.c + +wince*: SOURCES += $$PWD/../corelib/kernel/qfunctions_wince.cpp \ + $$PWD/libtiff/libtiff/tif_wince.c +win32: SOURCES += $$PWD/libtiff/libtiff/tif_win32.c +else: SOURCES += $$PWD/libtiff/libtiff/tif_unix.c +symbian: SOURCES += $$PWD/libtiff/port/lfind.c + +include($$PWD/zlib_dependency.pri) diff --git a/src/3rdparty/webkit/.tag b/src/3rdparty/webkit/.tag index c44a95b..0b824b7 100644 --- a/src/3rdparty/webkit/.tag +++ b/src/3rdparty/webkit/.tag @@ -1 +1 @@ -cd3aee284bddf4ff9d26f3bcaa7c33d478e81e10 +d59845f6fec84f15da116f50a1a0e52ce26116e9 diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index aa574b4..c970745 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 - cd3aee284bddf4ff9d26f3bcaa7c33d478e81e10 + d59845f6fec84f15da116f50a1a0e52ce26116e9 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 5ba94de..a4ae758 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,16 @@ +2010-03-26 Shu Chang <chang.shu@nokia.com> + + Reviewed by Eric Seidel. + + [Qt] Prevent referring d->m_job in the future because calling abort() + deletes the instance itself. + https://bugs.webkit.org/show_bug.cgi?id=36618 + + Test: http/tests/appcache/fallback.html + + * platform/network/qt/ResourceHandleQt.cpp: + (WebCore::ResourceHandle::cancel): + 2010-06-28 Sam Magnuson <smagnuson@netflix.com> Reviewed by Kenneth Rohde Christiansen. diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceHandleQt.cpp b/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceHandleQt.cpp index f006c08..aaa306a 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceHandleQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceHandleQt.cpp @@ -144,8 +144,10 @@ bool ResourceHandle::start(Frame* frame) void ResourceHandle::cancel() { - if (d->m_job) + if (d->m_job) { d->m_job->abort(); + d->m_job = 0; + } } bool ResourceHandle::loadsBlocked() diff --git a/src/3rdparty/webkit/WebCore/platform/qt/QWebPageClient.h b/src/3rdparty/webkit/WebCore/platform/qt/QWebPageClient.h index 8e48d1f..d3978b8 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/QWebPageClient.h +++ b/src/3rdparty/webkit/WebCore/platform/qt/QWebPageClient.h @@ -90,6 +90,8 @@ public: virtual QStyle* style() const = 0; virtual QRectF graphicsItemVisibleRect() const { return QRectF(); } + + virtual bool viewResizesToContentsEnabled() const = 0; protected: #ifndef QT_NO_CURSOR diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp index c4d240c..b63921b 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp @@ -117,6 +117,8 @@ public: virtual QStyle* style() const; + virtual bool viewResizesToContentsEnabled() const { return resizesToContents; } + #if USE(ACCELERATED_COMPOSITING) virtual void setRootGraphicsLayer(QGraphicsItem* layer); virtual void markForSync(bool scheduleSync); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp index 9a4e9b2..d0c047d 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp @@ -233,6 +233,8 @@ public: virtual QStyle* style() const; + virtual bool viewResizesToContentsEnabled() const { return false; } + QWidget* view; }; @@ -3614,7 +3616,7 @@ QString QWebPage::userAgentForUrl(const QUrl&) const firstPartTemp += QString::fromLatin1("Sun Solaris"); #elif defined Q_OS_ULTRIX firstPartTemp += QString::fromLatin1("DEC Ultrix"); -#elif defined Q_WS_S60 +#elif defined Q_OS_SYMBIAN firstPartTemp += QLatin1Char(' '); QSysInfo::S60Version s60Version = QSysInfo::s60Version(); switch (s60Version) { diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index 1eb7b11..9dd129e 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,20 @@ +2010-05-19 Antti Koivisto <koivisto@iki.fi> + + Rubber-stamped by Kenneth Rohde Christiansen. + + [Qt] TiledBackingStore updates broken when not using resizesToContents mode + https://bugs.webkit.org/show_bug.cgi?id=39359 + + Put the back logic that was lost in refactoring. + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::visibleRectForTiledBackingStore): + * WebCoreSupport/PageClientQt.cpp: + (WebCore::PageClientQGraphicsWidget::graphicsItemVisibleRect): + * WebCoreSupport/PageClientQt.h: + (WebCore::PageClientQWidget::viewResizesToContentsEnabled): + (WebCore::PageClientQGraphicsWidget::viewResizesToContentsEnabled): + 2010-07-01 Bea Lam <bea.lam@nokia.com> Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp index e253161..4d4e70e 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp @@ -563,8 +563,12 @@ bool ChromeClientQt::allowsAcceleratedCompositing() const #if ENABLE(TILED_BACKING_STORE) IntRect ChromeClientQt::visibleRectForTiledBackingStore() const { - if (!platformPageClient()) + if (!platformPageClient() || !m_webPage) return IntRect(); + + if (!platformPageClient()->viewResizesToContentsEnabled()) + return QRect(m_webPage->mainFrame()->scrollPosition(), m_webPage->mainFrame()->geometry().size()); + return enclosingIntRect(FloatRect(platformPageClient()->graphicsItemVisibleRect())); } #endif diff --git a/src/3rdparty/webkit/WebKit/qt/declarative/declarative.pro b/src/3rdparty/webkit/WebKit/qt/declarative/declarative.pro index 75268f3..526cf06 100644 --- a/src/3rdparty/webkit/WebKit/qt/declarative/declarative.pro +++ b/src/3rdparty/webkit/WebKit/qt/declarative/declarative.pro @@ -30,6 +30,7 @@ symbian: { TARGET.EPOCALLOWDLLDATA=1 TARGET.CAPABILITY = All -Tcb load(armcc_warnings) + TARGET = $$TARGET$${QT_LIBINFIX} } include(../../../WebKit.pri) diff --git a/src/3rdparty/zlib.pri b/src/3rdparty/zlib.pri new file mode 100644 index 0000000..bae3221 --- /dev/null +++ b/src/3rdparty/zlib.pri @@ -0,0 +1,14 @@ +wince*: DEFINES += NO_ERRNO_H +INCLUDEPATH += $$PWD/zlib +SOURCES+= \ + $$PWD/zlib/adler32.c \ + $$PWD/zlib/compress.c \ + $$PWD/zlib/crc32.c \ + $$PWD/zlib/deflate.c \ + $$PWD/zlib/gzio.c \ + $$PWD/zlib/inffast.c \ + $$PWD/zlib/inflate.c \ + $$PWD/zlib/inftrees.c \ + $$PWD/zlib/trees.c \ + $$PWD/zlib/uncompr.c \ + $$PWD/zlib/zutil.c diff --git a/src/3rdparty/zlib_dependency.pri b/src/3rdparty/zlib_dependency.pri new file mode 100644 index 0000000..042eb13 --- /dev/null +++ b/src/3rdparty/zlib_dependency.pri @@ -0,0 +1,8 @@ +# zlib dependency satisfied by bundled 3rd party zlib or system zlib +contains(QT_CONFIG, system-zlib) { + symbian: LIBS_PRIVATE += -llibz + else:if(unix|win32-g++*):LIBS_PRIVATE += -lz + else: LIBS += zdll.lib +} else { + INCLUDEPATH += $$PWD/zlib +} diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index e39d326..dba2a42 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -48,7 +48,7 @@ symbian: { 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.dll + partial_upgrade.sources = $$QMAKE_LIBDIR_QT/QtCore$${QT_LIBINFIX}.dll partial_upgrade.path = c:/sys/bin DEPLOYMENT = partial_upgrade $$DEPLOYMENT } diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index b31c83b..75a51ec 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1622,7 +1622,7 @@ bool qSharedBuild() \macro Q_WS_S60 \relates <QtGlobal> - Defined on S60. + Defined on S60 with the Avkon UI framework. \sa Q_WS_MAC, Q_WS_WIN, Q_WS_X11, Q_WS_QWS */ @@ -1813,7 +1813,6 @@ const QSysInfo::WinVersion QSysInfo::WindowsVersion = QSysInfo::windowsVersion() #endif #ifdef Q_OS_SYMBIAN -# ifdef Q_WS_S60 static QSysInfo::S60Version cachedS60Version = QSysInfo::S60Version(-1); QSysInfo::S60Version QSysInfo::s60Version() @@ -1885,17 +1884,6 @@ QSysInfo::SymbianVersion QSysInfo::symbianVersion() return SV_Unknown; } } -#else -QSysInfo::S60Version QSysInfo::s60Version() -{ - return SV_S60_None; -} - -QSysInfo::SymbianVersion QSysInfo::symbianVersion() -{ - return SV_Unknown; -} -# endif // ifdef Q_WS_S60 #endif // ifdef Q_OS_SYMBIAN /*! diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 76f35ac..8a3166d 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1066,10 +1066,11 @@ redefine to built-in booleans to make autotests work properly */ //the alignment needs to be forced for sse2 to not crash with mingw #if defined(Q_WS_WIN) # if defined(Q_CC_MINGW) -# define QT_WIN_CALLBACK CALLBACK __attribute__ ((force_align_arg_pointer)) +# define QT_ENSURE_STACK_ALIGNED_FOR_SSE __attribute__ ((force_align_arg_pointer)) # else -# define QT_WIN_CALLBACK CALLBACK +# define QT_ENSURE_STACK_ALIGNED_FOR_SSE # endif +# define QT_WIN_CALLBACK CALLBACK QT_ENSURE_STACK_ALIGNED_FOR_SSE #endif typedef int QNoImplicitBoolCast; diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index d419759..ed2ae6e 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -565,8 +565,9 @@ be short, localized names. This is basically equivalent to using the date format string, "ddd MMM d yyyy". See QDate::toString() for more information. - \value ISODate ISO 8601 extended format: either \c{YYYY-MM-DD} for dates or - \c{YYYY-MM-DDTHH:MM:SS} for combined dates and times. + \value ISODate \l{ISO 8601} extended format: either \c{YYYY-MM-DD} for dates or + \c{YYYY-MM-DDTHH:MM:SS}, \c{YYYY-MM-DDTHH:MM:SSTZD} (e.g., 1997-07-16T19:20:30+01:00) + for combined dates and times. \value SystemLocaleShortDate The \l{QLocale::ShortFormat}{short format} used by the \l{QLocale::system()}{operating system}. diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index ef448b1..3d964c6 100644 --- a/src/corelib/io/io.pri +++ b/src/corelib/io/io.pri @@ -93,6 +93,6 @@ win32 { SOURCES += io/qfilesystemwatcher_symbian.cpp HEADERS += io/qfilesystemwatcher_symbian_p.h INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE - contains(QT_CONFIG, s60): LIBS += -lplatformenv + LIBS += -lplatformenv } } diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 5762d94..9464a97 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -634,13 +634,8 @@ QString QFSFileEngine::homePath() QString QFSFileEngine::rootPath() { #if defined(Q_OS_SYMBIAN) -# ifdef Q_WS_S60 TFileName symbianPath = PathInfo::PhoneMemoryRootPath(); return QDir::cleanPath(QDir::fromNativeSeparators(qt_TDesC2QString(symbianPath))); -# else -# warning No fallback implementation of QFSFileEngine::rootPath() - return QString(); -# endif #else return QLatin1String("/"); #endif @@ -649,17 +644,12 @@ QString QFSFileEngine::rootPath() QString QFSFileEngine::tempPath() { #if defined(Q_OS_SYMBIAN) -# ifdef Q_WS_S60 TFileName symbianPath = PathInfo::PhoneMemoryRootPath(); QString temp = QDir::fromNativeSeparators(qt_TDesC2QString(symbianPath)); temp += QLatin1String( "temp/"); // Just to verify that folder really exist on hardware QT_MKDIR(QFile::encodeName(temp), 0777); -# else -# warning No fallback implementation of QFSFileEngine::tempPath() - QString temp; -# endif #else QString temp = QFile::decodeName(qgetenv("TMPDIR")); if (temp.isEmpty()) diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index b5e7a97..8eba2b0 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -1856,7 +1856,7 @@ QByteArray QProcess::readAllStandardError() } /*! - Starts the program \a program in a new process, if one is not already + Starts the given \a program in a new process, if none is already running, passing the command line arguments in \a arguments. The OpenMode is set to \a mode. @@ -1866,14 +1866,13 @@ QByteArray QProcess::readAllStandardError() process, a warning may be printed at the console, and the existing process will continue running. - \note Arguments that contain spaces are not passed to the - process as separate arguments. - \note Processes are started asynchronously, which means the started() and error() signals may be delayed. Call waitForStarted() to make sure the process has started (or has failed to start) and those signals have been emitted. + \note No further splitting of the arguments is performed. + \bold{Windows:} Arguments that contain spaces are wrapped in quotes. \sa pid(), started(), waitForStarted() @@ -2079,7 +2078,7 @@ QProcess::ExitStatus QProcess::exitStatus() const code of the process. Any data the new process writes to the console is forwarded to the calling process. - The environment and working directory are inherited by the calling + The environment and working directory are inherited from the calling process. On Windows, arguments that contain spaces are wrapped in quotes. diff --git a/src/corelib/kernel/qcore_symbian_p.cpp b/src/corelib/kernel/qcore_symbian_p.cpp index 402eccf..5afde9a 100644 --- a/src/corelib/kernel/qcore_symbian_p.cpp +++ b/src/corelib/kernel/qcore_symbian_p.cpp @@ -131,7 +131,7 @@ public: private: void init() { -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN _LIT(KLibName_3_1, "qts60plugin_3_1" QT_LIBINFIX_UNICODE L".dll"); _LIT(KLibName_3_2, "qts60plugin_3_2" QT_LIBINFIX_UNICODE L".dll"); _LIT(KLibName_5_0, "qts60plugin_5_0" QT_LIBINFIX_UNICODE L".dll"); diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h index 788cc44..b219841 100644 --- a/src/corelib/kernel/qeventdispatcher_win_p.h +++ b/src/corelib/kernel/qeventdispatcher_win_p.h @@ -76,7 +76,7 @@ public: explicit QEventDispatcherWin32(QObject *parent = 0); ~QEventDispatcherWin32(); - bool processEvents(QEventLoop::ProcessEventsFlags flags); + bool QT_ENSURE_STACK_ALIGNED_FOR_SSE processEvents(QEventLoop::ProcessEventsFlags flags); bool hasPendingEvents(); void registerSocketNotifier(QSocketNotifier *notifier); diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index ae8aad6..ab7530d 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -1843,7 +1843,7 @@ QTime QTime::fromString(const QString& s, Qt::DateFormat f) const QString msec_s(QLatin1String("0.") + s.mid(9, 4)); const float msec(msec_s.toFloat(&ok)); if (!ok) - return QTime(); + return QTime(hour, minute, second, 0); return QTime(hour, minute, second, qMin(qRound(msec * 1000.0), 999)); } } @@ -3304,12 +3304,37 @@ QDateTime QDateTime::fromString(const QString& s, Qt::DateFormat f) if (tmp.size() == 10) return QDateTime(date); + tmp = tmp.mid(11); + // Recognize UTC specifications if (tmp.endsWith(QLatin1Char('Z'))) { ts = Qt::UTC; tmp.chop(1); } - return QDateTime(date, QTime::fromString(tmp.mid(11), Qt::ISODate), ts); + + // Recognize timezone specifications + QRegExp rx(QLatin1String("[+-]")); + if (tmp.contains(rx)) { + int idx = tmp.indexOf(rx); + QString tmp2 = tmp.mid(idx); + tmp = tmp.left(idx); + bool ok = true; + int ntzhour = 1; + int ntzminute = 3; + if ( tmp2.indexOf(QLatin1Char(':')) == 3 ) + ntzminute = 4; + const int tzhour(tmp2.mid(ntzhour, 2).toInt(&ok)); + const int tzminute(tmp2.mid(ntzminute, 2).toInt(&ok)); + QTime tzt(tzhour, tzminute); + int utcOffset = (tzt.hour() * 60 + tzt.minute()) * 60; + if ( utcOffset != 0 ) { + ts = Qt::OffsetFromUTC; + QDateTime dt(date, QTime::fromString(tmp, Qt::ISODate), ts); + dt.setUtcOffset( utcOffset * (tmp2.startsWith(QLatin1Char('-')) ? -1 : 1) ); + return dt; + } + } + return QDateTime(date, QTime::fromString(tmp, Qt::ISODate), ts); } case Qt::SystemLocaleDate: case Qt::SystemLocaleShortDate: diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index e579dd5..d81ab04 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -89,27 +89,8 @@ else:unix:SOURCES += tools/qelapsedtimer_unix.cpp else:win32:SOURCES += tools/qelapsedtimer_win.cpp else:SOURCES += tools/qelapsedtimer_generic.cpp -#zlib support -contains(QT_CONFIG, zlib) { - wince*: DEFINES += NO_ERRNO_H - INCLUDEPATH += ../3rdparty/zlib - SOURCES+= \ - ../3rdparty/zlib/adler32.c \ - ../3rdparty/zlib/compress.c \ - ../3rdparty/zlib/crc32.c \ - ../3rdparty/zlib/deflate.c \ - ../3rdparty/zlib/gzio.c \ - ../3rdparty/zlib/inffast.c \ - ../3rdparty/zlib/inflate.c \ - ../3rdparty/zlib/inftrees.c \ - ../3rdparty/zlib/trees.c \ - ../3rdparty/zlib/uncompr.c \ - ../3rdparty/zlib/zutil.c -} else:!contains(QT_CONFIG, no-zlib) { - symbian:LIBS_PRIVATE += -llibz - else:if(unix|win32-g++*):LIBS_PRIVATE += -lz - else:LIBS += zdll.lib -} +contains(QT_CONFIG, zlib):include($$PWD/../../3rdparty/zlib.pri) +else:include($$PWD/../../3rdparty/zlib_dependency.pri) DEFINES += HB_EXPORT=Q_CORE_EXPORT INCLUDEPATH += ../3rdparty/harfbuzz/src diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp index d4ca9eb..44c206b 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp @@ -94,8 +94,6 @@ QDeclarativeBorderImage::~QDeclarativeBorderImage() Q_D(QDeclarativeBorderImage); if (d->sciReply) d->sciReply->deleteLater(); - if (d->sciPendingPixmapCache) - QDeclarativePixmapCache::cancel(d->sciurl, this); } /*! \qmlproperty enumeration BorderImage::status @@ -164,15 +162,6 @@ void QDeclarativeBorderImage::setSource(const QUrl &url) d->sciReply = 0; } - if (d->pendingPixmapCache) { - QDeclarativePixmapCache::cancel(d->url, this); - d->pendingPixmapCache = false; - } - if (d->sciPendingPixmapCache) { - QDeclarativePixmapCache::cancel(d->sciurl, this); - d->sciPendingPixmapCache = false; - } - d->url = url; d->sciurl = QUrl(); emit sourceChanged(d->url); @@ -190,7 +179,7 @@ void QDeclarativeBorderImage::load() } if (d->url.isEmpty()) { - d->pix = QPixmap(); + d->pix.clear(); d->status = Null; setImplicitWidth(0); setImplicitHeight(0); @@ -224,26 +213,24 @@ void QDeclarativeBorderImage::load() thisSciRequestFinished, Qt::DirectConnection); } } else { - QSize impsize; - QString errorString; - QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(d->url, &d->pix, &errorString, &impsize, d->async); - if (status != QDeclarativePixmapReply::Ready && status != QDeclarativePixmapReply::Error) { - QDeclarativePixmapReply *reply = QDeclarativePixmapCache::request(qmlEngine(this), d->url); - d->pendingPixmapCache = true; - connect(reply, SIGNAL(finished()), this, SLOT(requestFinished())); - connect(reply, SIGNAL(downloadProgress(qint64,qint64)), - this, SLOT(requestProgress(qint64,qint64))); + + d->pix.load(qmlEngine(this), d->url, d->async); + + if (d->pix.isLoading()) { + d->pix.connectFinished(this, SLOT(requestFinished())); + d->pix.connectDownloadProgress(this, SLOT(requestProgress(qint64,qint64))); } else { - //### should be unified with requestFinished + QSize impsize = d->pix.implicitSize(); setImplicitWidth(impsize.width()); setImplicitHeight(impsize.height()); - if (d->pix.isNull()) { + if (d->pix.isReady()) { + d->status = Ready; + } else { d->status = Error; - qmlInfo(this) << errorString; + qmlInfo(this) << d->pix.error(); } - if (d->status == Loading) - d->status = Ready; + d->progress = 1.0; emit statusChanged(d->status); emit progressChanged(d->progress); @@ -343,47 +330,40 @@ void QDeclarativeBorderImage::setGridScaledImage(const QDeclarativeGridScaledIma d->verticalTileMode = sci.verticalTileRule(); d->sciurl = d->url.resolved(QUrl(sci.pixmapUrl())); - QSize impsize; - QString errorString; - QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(d->sciurl, &d->pix, &errorString, &impsize, d->async); - if (status != QDeclarativePixmapReply::Ready && status != QDeclarativePixmapReply::Error) { - QDeclarativePixmapReply *reply = QDeclarativePixmapCache::request(qmlEngine(this), d->sciurl); - d->sciPendingPixmapCache = true; - - static int replyDownloadProgress = -1; - static int replyFinished = -1; + + d->pix.load(qmlEngine(this), d->sciurl, d->async); + + if (d->pix.isLoading()) { static int thisRequestProgress = -1; static int thisRequestFinished = -1; - if (replyDownloadProgress == -1) { - replyDownloadProgress = - QDeclarativePixmapReply::staticMetaObject.indexOfSignal("downloadProgress(qint64,qint64)"); - replyFinished = - QDeclarativePixmapReply::staticMetaObject.indexOfSignal("finished()"); + if (thisRequestProgress == -1) { thisRequestProgress = QDeclarativeBorderImage::staticMetaObject.indexOfSlot("requestProgress(qint64,qint64)"); thisRequestFinished = QDeclarativeBorderImage::staticMetaObject.indexOfSlot("requestFinished()"); } - QMetaObject::connect(reply, replyFinished, this, - thisRequestFinished, Qt::DirectConnection); - QMetaObject::connect(reply, replyDownloadProgress, this, - thisRequestProgress, Qt::DirectConnection); + d->pix.connectFinished(this, thisRequestFinished); + d->pix.connectDownloadProgress(this, thisRequestProgress); + } else { - //### should be unified with requestFinished + + QSize impsize = d->pix.implicitSize(); setImplicitWidth(impsize.width()); setImplicitHeight(impsize.height()); - if (d->pix.isNull()) { + if (d->pix.isReady()) { + d->status = Ready; + } else { d->status = Error; - qmlInfo(this) << errorString; + qmlInfo(this) << d->pix.error(); } - if (d->status == Loading) - d->status = Ready; + d->progress = 1.0; emit statusChanged(d->status); emit progressChanged(1.0); update(); + } } } @@ -392,27 +372,17 @@ void QDeclarativeBorderImage::requestFinished() { Q_D(QDeclarativeBorderImage); - QSize impsize; - if (d->url.path().endsWith(QLatin1String(".sci"))) { - d->sciPendingPixmapCache = false; - QString errorString; - if (QDeclarativePixmapCache::get(d->sciurl, &d->pix, &errorString, &impsize, d->async) != QDeclarativePixmapReply::Ready) { - d->status = Error; - qmlInfo(this) << errorString; - } + QSize impsize = d->pix.implicitSize(); + if (d->pix.isError()) { + d->status = Error; + qmlInfo(this) << d->pix.error(); } else { - d->pendingPixmapCache = false; - QString errorString; - if (QDeclarativePixmapCache::get(d->url, &d->pix, &errorString, &impsize, d->async) != QDeclarativePixmapReply::Ready) { - d->status = Error; - qmlInfo(this) << errorString; - } + d->status = Ready; } + setImplicitWidth(impsize.width()); setImplicitHeight(impsize.height()); - if (d->status == Loading) - d->status = Ready; d->progress = 1.0; emit statusChanged(d->status); emit progressChanged(1.0); diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage_p_p.h b/src/declarative/graphicsitems/qdeclarativeborderimage_p_p.h index 01e4a00..65583d6 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativeborderimage_p_p.h @@ -66,7 +66,6 @@ class QDeclarativeBorderImagePrivate : public QDeclarativeImageBasePrivate public: QDeclarativeBorderImagePrivate() : border(0), sciReply(0), - sciPendingPixmapCache(false), horizontalTileMode(QDeclarativeBorderImage::Stretch), verticalTileMode(QDeclarativeBorderImage::Stretch), redirectCount(0) @@ -97,7 +96,6 @@ public: QDeclarativeScaleGrid *border; QUrl sciurl; QNetworkReply *sciReply; - bool sciPendingPixmapCache; QDeclarativeBorderImage::TileMode horizontalTileMode; QDeclarativeBorderImage::TileMode verticalTileMode; int redirectCount; diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index cb99129..3efb9ad 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -1216,6 +1216,11 @@ void QDeclarativeGridView::setModel(const QVariant &model) } else { d->moveReason = QDeclarativeGridViewPrivate::SetIndex; d->updateCurrent(d->currentIndex); + if (d->highlight && d->currentItem) { + d->highlight->setPosition(d->currentItem->colPos(), d->currentItem->rowPos()); + d->updateTrackedItem(); + } + d->moveReason = QDeclarativeGridViewPrivate::Other; } } connect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); @@ -1274,6 +1279,11 @@ void QDeclarativeGridView::setDelegate(QDeclarativeComponent *delegate) refill(); d->moveReason = QDeclarativeGridViewPrivate::SetIndex; d->updateCurrent(d->currentIndex); + if (d->highlight && d->currentItem) { + d->highlight->setPosition(d->currentItem->colPos(), d->currentItem->rowPos()); + d->updateTrackedItem(); + } + d->moveReason = QDeclarativeGridViewPrivate::Other; } emit delegateChanged(); } @@ -1300,7 +1310,6 @@ void QDeclarativeGridView::setCurrentIndex(int index) return; if (isComponentComplete() && d->isValid() && index != d->currentIndex && index < d->model->count() && index >= 0) { d->moveReason = QDeclarativeGridViewPrivate::SetIndex; - cancelFlick(); d->updateCurrent(index); } else if (index != d->currentIndex) { d->currentIndex = index; @@ -2158,7 +2167,7 @@ void QDeclarativeGridView::componentComplete() d->updateCurrent(0); else d->updateCurrent(d->currentIndex); - if (d->highlight) { + if (d->highlight && d->currentItem) { d->highlight->setPosition(d->currentItem->colPos(), d->currentItem->rowPos()); d->updateTrackedItem(); } @@ -2172,20 +2181,17 @@ void QDeclarativeGridView::trackedPositionChanged() Q_D(QDeclarativeGridView); if (!d->trackedItem || !d->currentItem) return; - if (!d->flickingHorizontally && !d->flickingVertically && !d->movingHorizontally && !d->movingVertically - && d->moveReason == QDeclarativeGridViewPrivate::SetIndex) { + if (d->moveReason == QDeclarativeGridViewPrivate::SetIndex) { const qreal trackedPos = d->trackedItem->rowPos(); const qreal viewPos = d->position(); + qreal pos = viewPos; if (d->haveHighlightRange) { if (d->highlightRange == StrictlyEnforceRange) { - qreal pos = viewPos; if (trackedPos > pos + d->highlightRangeEnd - d->rowSize()) pos = trackedPos - d->highlightRangeEnd + d->rowSize(); if (trackedPos < pos + d->highlightRangeStart) pos = trackedPos - d->highlightRangeStart; - d->setPosition(pos); } else { - qreal pos = viewPos; if (trackedPos < d->startPosition() + d->highlightRangeStart) { pos = d->startPosition(); } else if (d->trackedItem->endRowPos() > d->endPosition() - d->size() + d->highlightRangeEnd) { @@ -2199,14 +2205,12 @@ void QDeclarativeGridView::trackedPositionChanged() pos = trackedPos - d->highlightRangeEnd + d->rowSize(); } } - d->setPosition(pos); } } else { if (trackedPos < viewPos && d->currentItem->rowPos() < viewPos) { - d->setPosition(d->currentItem->rowPos() < trackedPos ? trackedPos : d->currentItem->rowPos()); + pos = d->currentItem->rowPos() < trackedPos ? trackedPos : d->currentItem->rowPos(); } else if (d->trackedItem->endRowPos() > viewPos + d->size() && d->currentItem->endRowPos() > viewPos + d->size()) { - qreal pos; if (d->trackedItem->endRowPos() < d->currentItem->endRowPos()) { pos = d->trackedItem->endRowPos() - d->size(); if (d->rowSize() > d->size()) @@ -2216,9 +2220,12 @@ void QDeclarativeGridView::trackedPositionChanged() if (d->rowSize() > d->size()) pos = d->currentItem->rowPos(); } - d->setPosition(pos); } } + if (viewPos != pos) { + cancelFlick(); + d->setPosition(pos); + } } } @@ -2563,6 +2570,12 @@ void QDeclarativeGridView::modelReset() refill(); d->moveReason = QDeclarativeGridViewPrivate::SetIndex; d->updateCurrent(d->currentIndex); + if (d->highlight && d->currentItem) { + d->highlight->setPosition(d->currentItem->colPos(), d->currentItem->rowPos()); + d->updateTrackedItem(); + } + d->moveReason = QDeclarativeGridViewPrivate::Other; + emit countChanged(); } diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index ff61302..e0db580 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -126,7 +126,7 @@ QDeclarativeImage::~QDeclarativeImage() QPixmap QDeclarativeImage::pixmap() const { Q_D(const QDeclarativeImage); - return d->pix; + return d->pix.pixmap(); } void QDeclarativeImage::setPixmap(const QPixmap &pix) @@ -140,7 +140,7 @@ void QDeclarativeImage::setPixmap(const QPixmap &pix) void QDeclarativeImagePrivate::setPixmap(const QPixmap &pixmap) { Q_Q(QDeclarativeImage); - pix = pixmap; + pix.setPixmap(pixmap); q->setImplicitWidth(pix.width()); q->setImplicitHeight(pix.height()); diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp index c3f8195..67f2327 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp @@ -57,9 +57,6 @@ QDeclarativeImageBase::QDeclarativeImageBase(QDeclarativeImageBasePrivate &dd, Q QDeclarativeImageBase::~QDeclarativeImageBase() { - Q_D(QDeclarativeImageBase); - if (d->pendingPixmapCache) - QDeclarativePixmapCache::cancel(d->url, this); } QDeclarativeImageBase::Status QDeclarativeImageBase::status() const @@ -91,7 +88,6 @@ void QDeclarativeImageBase::setAsynchronous(bool async) } } - QUrl QDeclarativeImageBase::source() const { Q_D(const QDeclarativeImageBase); @@ -105,11 +101,6 @@ void QDeclarativeImageBase::setSource(const QUrl &url) if ((d->url.isEmpty() == url.isEmpty()) && url == d->url) return; - if (d->pendingPixmapCache) { - QDeclarativePixmapCache::cancel(d->url, this); - d->pendingPixmapCache = false; - } - d->url = url; emit sourceChanged(d->url); @@ -122,6 +113,7 @@ void QDeclarativeImageBase::setSourceSize(const QSize& size) Q_D(QDeclarativeImageBase); if (d->sourcesize == size) return; + d->sourcesize = size; emit sourceSizeChanged(); if (isComponentComplete()) @@ -143,7 +135,7 @@ void QDeclarativeImageBase::load() } if (d->url.isEmpty()) { - d->pix = QPixmap(); + d->pix.clear(); d->status = Null; setImplicitWidth(0); setImplicitHeight(0); @@ -152,48 +144,37 @@ void QDeclarativeImageBase::load() update(); } else { d->status = Loading; - int reqwidth = d->sourcesize.width(); - int reqheight = d->sourcesize.height(); - QSize impsize; - QString errorString; - QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(d->url, &d->pix, &errorString, &impsize, d->async, reqwidth, reqheight); - if (status != QDeclarativePixmapReply::Ready && status != QDeclarativePixmapReply::Error) { - QDeclarativePixmapReply *reply = QDeclarativePixmapCache::request(qmlEngine(this), d->url, reqwidth, reqheight); - d->pendingPixmapCache = true; - - static int replyDownloadProgress = -1; - static int replyFinished = -1; + + d->pix.load(qmlEngine(this), d->url, d->sourcesize, d->async); + + if (d->pix.isLoading()) { + static int thisRequestProgress = -1; static int thisRequestFinished = -1; - if (replyDownloadProgress == -1) { - replyDownloadProgress = - QDeclarativePixmapReply::staticMetaObject.indexOfSignal("downloadProgress(qint64,qint64)"); - replyFinished = - QDeclarativePixmapReply::staticMetaObject.indexOfSignal("finished()"); + if (thisRequestProgress == -1) { thisRequestProgress = QDeclarativeImageBase::staticMetaObject.indexOfSlot("requestProgress(qint64,qint64)"); thisRequestFinished = QDeclarativeImageBase::staticMetaObject.indexOfSlot("requestFinished()"); } - QMetaObject::connect(reply, replyFinished, this, - thisRequestFinished, Qt::DirectConnection); - QMetaObject::connect(reply, replyDownloadProgress, this, - thisRequestProgress, Qt::DirectConnection); + d->pix.connectFinished(this, thisRequestFinished); + d->pix.connectDownloadProgress(this, thisRequestProgress); + } else { - //### should be unified with requestFinished - if (status == QDeclarativePixmapReply::Ready) { - setImplicitWidth(impsize.width()); - setImplicitHeight(impsize.height()); + QSize impsize = d->pix.implicitSize(); + setImplicitWidth(impsize.width()); + setImplicitHeight(impsize.height()); - if (d->status == Loading) - d->status = Ready; + if (d->pix.isReady()) { + d->status = Ready; if (!d->sourcesize.isValid()) emit sourceSizeChanged(); + } else { d->status = Error; - qmlInfo(this) << errorString; + qmlInfo(this) << d->pix.error(); } d->progress = 1.0; emit statusChanged(d->status); @@ -201,6 +182,7 @@ void QDeclarativeImageBase::load() pixmapChange(); update(); } + } emit statusChanged(d->status); @@ -210,14 +192,13 @@ void QDeclarativeImageBase::requestFinished() { Q_D(QDeclarativeImageBase); - d->pendingPixmapCache = false; + QSize impsize = d->pix.implicitSize(); - QSize impsize; - QString errorString; - if (QDeclarativePixmapCache::get(d->url, &d->pix, &errorString, &impsize, d->async, d->sourcesize.width(), d->sourcesize.height()) != QDeclarativePixmapReply::Ready) { + if (d->pix.isError()) { d->status = Error; - qmlInfo(this) << errorString; + qmlInfo(this) << d->pix.error(); } + setImplicitWidth(impsize.width()); setImplicitHeight(impsize.height()); diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h b/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h index 392c1db..aee8b28 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h @@ -54,6 +54,7 @@ // #include "private/qdeclarativeitem_p.h" +#include "private/qdeclarativepixmapcache_p.h" #include <QtCore/QPointer> @@ -68,18 +69,16 @@ public: QDeclarativeImageBasePrivate() : status(QDeclarativeImageBase::Null), progress(0.0), - pendingPixmapCache(false), async(false) { QGraphicsItemPrivate::flags = QGraphicsItemPrivate::flags & ~QGraphicsItem::ItemHasNoContents; } - QPixmap pix; + QDeclarativePixmap pix; QDeclarativeImageBase::Status status; QUrl url; qreal progress; QSize sourcesize; - bool pendingPixmapCache : 1; bool async : 1; }; diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 352c3df..bd935c9 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -347,6 +347,7 @@ void QDeclarativeContents::complete() void QDeclarativeContents::itemGeometryChanged(QDeclarativeItem *changed, const QRectF &newGeometry, const QRectF &oldGeometry) { + Q_UNUSED(changed) //### we can only pass changed if the left edge has moved left, or the right edge has moved right if (newGeometry.width() != oldGeometry.width() || newGeometry.x() != oldGeometry.x()) calcWidth(/*changed*/); diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index e519bd9..9497cb7 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -1547,6 +1547,10 @@ void QDeclarativeListView::setModel(const QVariant &model) } else { d->moveReason = QDeclarativeListViewPrivate::SetIndex; d->updateCurrent(d->currentIndex); + if (d->highlight && d->currentItem) { + d->highlight->setPosition(d->currentItem->position()); + d->updateTrackedItem(); + } } } connect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); @@ -1610,6 +1614,10 @@ void QDeclarativeListView::setDelegate(QDeclarativeComponent *delegate) refill(); d->moveReason = QDeclarativeListViewPrivate::SetIndex; d->updateCurrent(d->currentIndex); + if (d->highlight && d->currentItem) { + d->highlight->setPosition(d->currentItem->position()); + d->updateTrackedItem(); + } } } emit delegateChanged(); @@ -1636,7 +1644,6 @@ void QDeclarativeListView::setCurrentIndex(int index) return; if (isComponentComplete() && d->isValid() && index != d->currentIndex && index < d->model->count() && index >= 0) { d->moveReason = QDeclarativeListViewPrivate::SetIndex; - cancelFlick(); d->updateCurrent(index); } else if (index != d->currentIndex) { d->currentIndex = index; @@ -2439,7 +2446,6 @@ void QDeclarativeListView::incrementCurrentIndex() if (currentIndex() < d->model->count() - 1 || d->wrap) { d->moveReason = QDeclarativeListViewPrivate::SetIndex; int index = currentIndex()+1; - cancelFlick(); d->updateCurrent(index < d->model->count() ? index : 0); } } @@ -2458,7 +2464,6 @@ void QDeclarativeListView::decrementCurrentIndex() if (currentIndex() > 0 || d->wrap) { d->moveReason = QDeclarativeListViewPrivate::SetIndex; int index = currentIndex()-1; - cancelFlick(); d->updateCurrent(index >= 0 ? index : d->model->count()-1); } } @@ -2591,7 +2596,7 @@ void QDeclarativeListView::componentComplete() d->updateCurrent(0); else d->updateCurrent(d->currentIndex); - if (d->highlight) { + if (d->highlight && d->currentItem) { d->highlight->setPosition(d->currentItem->position()); d->updateTrackedItem(); } @@ -2611,20 +2616,17 @@ void QDeclarativeListView::trackedPositionChanged() Q_D(QDeclarativeListView); if (!d->trackedItem || !d->currentItem) return; - if (!d->flickingHorizontally && !d->flickingVertically && !d->movingHorizontally && !d->movingVertically - && d->moveReason == QDeclarativeListViewPrivate::SetIndex) { + if (d->moveReason == QDeclarativeListViewPrivate::SetIndex) { const qreal trackedPos = qCeil(d->trackedItem->position()); const qreal viewPos = d->position(); + qreal pos = viewPos; if (d->haveHighlightRange) { if (d->highlightRange == StrictlyEnforceRange) { - qreal pos = viewPos; if (trackedPos > pos + d->highlightRangeEnd - d->trackedItem->size()) pos = trackedPos - d->highlightRangeEnd + d->trackedItem->size(); if (trackedPos < pos + d->highlightRangeStart) pos = trackedPos - d->highlightRangeStart; - d->setPosition(pos); } else { - qreal pos = viewPos; if (trackedPos < d->startPosition() + d->highlightRangeStart) { pos = d->startPosition(); } else if (d->trackedItem->endPosition() > d->endPosition() - d->size() + d->highlightRangeEnd) { @@ -2638,14 +2640,12 @@ void QDeclarativeListView::trackedPositionChanged() pos = trackedPos - d->highlightRangeEnd + d->trackedItem->size(); } } - d->setPosition(pos); } } else { if (trackedPos < viewPos && d->currentItem->position() < viewPos) { - d->setPosition(d->currentItem->position() < trackedPos ? trackedPos : d->currentItem->position()); + pos = d->currentItem->position() < trackedPos ? trackedPos : d->currentItem->position(); } else if (d->trackedItem->endPosition() > viewPos + d->size() && d->currentItem->endPosition() > viewPos + d->size()) { - qreal pos; if (d->trackedItem->endPosition() < d->currentItem->endPosition()) { pos = d->trackedItem->endPosition() - d->size(); if (d->trackedItem->size() > d->size()) @@ -2655,9 +2655,12 @@ void QDeclarativeListView::trackedPositionChanged() if (d->currentItem->size() > d->size()) pos = d->currentItem->position(); } - d->setPosition(pos); } } + if (viewPos != pos) { + cancelFlick(); + d->setPosition(pos); + } } } @@ -3021,6 +3024,11 @@ void QDeclarativeListView::modelReset() refill(); d->moveReason = QDeclarativeListViewPrivate::SetIndex; d->updateCurrent(d->currentIndex); + if (d->highlight && d->currentItem) { + d->highlight->setPosition(d->currentItem->position()); + d->updateTrackedItem(); + } + d->moveReason = QDeclarativeListViewPrivate::Other; emit countChanged(); } diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 0bd9a53..a7e2ed0 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -61,52 +61,100 @@ class QTextDocumentWithImageResources : public QTextDocument { Q_OBJECT public: - QTextDocumentWithImageResources(QDeclarativeText *parent) : - QTextDocument(parent), - outstanding(0) - { - } + QTextDocumentWithImageResources(QDeclarativeText *parent); + virtual ~QTextDocumentWithImageResources(); + void setText(const QString &); int resourcesLoading() const { return outstanding; } protected: - QVariant loadResource(int type, const QUrl &name) - { - QUrl url = qmlContext(parent())->resolvedUrl(name); - - if (type == QTextDocument::ImageResource) { - QPixmap pm; - QString errorString; - QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(url, &pm, &errorString, 0, false, 0, 0); - if (status == QDeclarativePixmapReply::Ready) - return pm; - if (status == QDeclarativePixmapReply::Error) { - if (!errors.contains(url)) { - errors.insert(url); - qmlInfo(parent()) << errorString; - } - } else { - QDeclarativePixmapReply *reply = QDeclarativePixmapCache::request(qmlEngine(parent()), url); - connect(reply, SIGNAL(finished()), this, SLOT(requestFinished())); + QVariant loadResource(int type, const QUrl &name); + +private slots: + void requestFinished(); + +private: + QHash<QUrl, QDeclarativePixmap *> m_resources; + + int outstanding; + static QSet<QUrl> errors; +}; + +QTextDocumentWithImageResources::QTextDocumentWithImageResources(QDeclarativeText *parent) +: QTextDocument(parent), outstanding(0) +{ +} + +QTextDocumentWithImageResources::~QTextDocumentWithImageResources() +{ + if (!m_resources.isEmpty()) + qDeleteAll(m_resources); +} + +QVariant QTextDocumentWithImageResources::loadResource(int type, const QUrl &name) +{ + QDeclarativeContext *context = qmlContext(parent()); + QUrl url = context->resolvedUrl(name); + + if (type == QTextDocument::ImageResource) { + QHash<QUrl, QDeclarativePixmap *>::Iterator iter = m_resources.find(url); + + if (iter == m_resources.end()) { + QDeclarativePixmap *p = new QDeclarativePixmap(context->engine(), url); + iter = m_resources.insert(name, p); + + if (p->isLoading()) { + p->connectFinished(this, SLOT(requestFinished())); outstanding++; } } - return QTextDocument::loadResource(type,url); // The *resolved* URL + QDeclarativePixmap *p = *iter; + if (p->isReady()) { + return p->pixmap(); + } else if (p->isError()) { + if (!errors.contains(url)) { + errors.insert(url); + qmlInfo(parent()) << p->error(); + } + } } -private slots: - void requestFinished() - { - outstanding--; - if (outstanding == 0) - static_cast<QDeclarativeText*>(parent())->reloadWithResources(); + return QTextDocument::loadResource(type,url); // The *resolved* URL +} + +void QTextDocumentWithImageResources::requestFinished() +{ + outstanding--; + if (outstanding == 0) { + QDeclarativeText *textItem = static_cast<QDeclarativeText*>(parent()); + QString text = textItem->text(); +#ifndef QT_NO_TEXTHTMLPARSER + setHtml(text); +#else + setPlainText(text); +#endif + QDeclarativeTextPrivate *d = QDeclarativeTextPrivate::get(textItem); + d->updateLayout(); + d->markImgDirty(); } +} -private: - int outstanding; - static QSet<QUrl> errors; -}; +void QTextDocumentWithImageResources::setText(const QString &text) +{ + if (!m_resources.isEmpty()) { + qWarning("CLEAR"); + qDeleteAll(m_resources); + m_resources.clear(); + outstanding = 0; + } + +#ifndef QT_NO_TEXTHTMLPARSER + setHtml(text); +#else + setPlainText(text); +#endif +} QSet<QUrl> QTextDocumentWithImageResources::errors; @@ -314,11 +362,7 @@ void QDeclarativeText::setText(const QString &n) if (d->richText) { if (isComponentComplete()) { d->ensureDoc(); -#ifndef QT_NO_TEXTHTMLPARSER - d->doc->setHtml(n); -#else - d->doc->setPlainText(n); -#endif + d->doc->setText(n); } } @@ -607,11 +651,7 @@ void QDeclarativeText::setTextFormat(TextFormat format) } else if (!wasRich && d->richText) { if (isComponentComplete()) { d->ensureDoc(); -#ifndef QT_NO_TEXTHTMLPARSER - d->doc->setHtml(d->text); -#else - d->doc->setPlainText(d->text); -#endif + d->doc->setText(d->text); } d->updateLayout(); d->markImgDirty(); @@ -1074,20 +1114,6 @@ void QDeclarativeTextPrivate::ensureDoc() } } -void QDeclarativeText::reloadWithResources() -{ - Q_D(QDeclarativeText); - if (!d->richText) - return; -#ifndef QT_NO_TEXTHTMLPARSER - d->doc->setHtml(d->text); -#else - d->doc->setPlainText(d->text); -#endif - d->updateLayout(); - d->markImgDirty(); -} - /*! Returns the number of resources (images) that are being loaded asynchronously. */ @@ -1173,11 +1199,7 @@ void QDeclarativeText::componentComplete() if (d->dirty) { if (d->richText) { d->ensureDoc(); -#ifndef QT_NO_TEXTHTMLPARSER - d->doc->setHtml(d->text); -#else - d->doc->setPlainText(d->text); -#endif + d->doc->setText(d->text); } d->updateLayout(); d->dirty = false; diff --git a/src/declarative/graphicsitems/qdeclarativetext_p.h b/src/declarative/graphicsitems/qdeclarativetext_p.h index cd97df3..2cc4d52 100644 --- a/src/declarative/graphicsitems/qdeclarativetext_p.h +++ b/src/declarative/graphicsitems/qdeclarativetext_p.h @@ -168,9 +168,6 @@ protected: private: Q_DISABLE_COPY(QDeclarativeText) Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeText) - - friend class QTextDocumentWithImageResources; - void reloadWithResources(); }; QT_END_NAMESPACE diff --git a/src/declarative/graphicsitems/qdeclarativetext_p_p.h b/src/declarative/graphicsitems/qdeclarativetext_p_p.h index 332f99e..51a5514 100644 --- a/src/declarative/graphicsitems/qdeclarativetext_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativetext_p_p.h @@ -124,6 +124,10 @@ public: QSize cachedLayoutSize; QDeclarativeText::TextFormat format; QDeclarativeText::WrapMode wrapMode; + + static inline QDeclarativeTextPrivate *get(QDeclarativeText *t) { + return t->d_func(); + } }; QT_END_NAMESPACE diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index c066f11..5b4d80b 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -1263,6 +1263,15 @@ void QDeclarativeTextEditPrivate::init() control = new QTextControl(q); control->setIgnoreUnusedNavigationEvents(true); + // QTextControl follows the default text color + // defined by the platform, declarative text + // should be black by default + QPalette pal = control->palette(); + if (pal.color(QPalette::Text) != color) { + pal.setColor(QPalette::Text, color); + control->setPalette(pal); + } + QObject::connect(control, SIGNAL(updateRequest(QRectF)), q, SLOT(updateImgCache(QRectF))); QObject::connect(control, SIGNAL(textChanged()), q, SLOT(q_textChanged())); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 374f371..c2eea6e 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -908,6 +908,7 @@ void QDeclarativeTextInput::keyPressEvent(QKeyEvent* ev) void QDeclarativeTextInput::inputMethodEvent(QInputMethodEvent *ev) { Q_D(QDeclarativeTextInput); + ev->ignore(); inputMethodPreHandler(ev); if (ev->isAccepted()) return; diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index 6d15278..8b013fe 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -68,7 +68,7 @@ class QByteArray; /*! \class QDeclarativeComponent \since 4.7 - \brief The QDeclarativeComponent class encapsulates a QML component description. + \brief The QDeclarativeComponent class encapsulates a QML component definition. \mainclass Components are reusable, encapsulated QML elements with well-defined interfaces. @@ -105,7 +105,7 @@ class QByteArray; /*! \qmlclass Component QDeclarativeComponent \since 4.7 - \brief The Component element encapsulates a QML component description. + \brief The Component element encapsulates a QML component definition. Components are reusable, encapsulated QML elements with well-defined interfaces. They are often defined in \l {qdeclarativedocuments.html}{Component Files}. @@ -478,7 +478,8 @@ void QDeclarativeComponent::loadUrl(const QUrl &url) d->clear(); - if (url.isRelative() && !url.isEmpty()) + if ((url.isRelative() && !url.isEmpty()) + || url.scheme() == QLatin1String("file")) // Workaround QTBUG-11929 d->url = d->engine->baseUrl().resolved(url); else d->url = url; diff --git a/src/declarative/qml/qdeclarativeimport.cpp b/src/declarative/qml/qdeclarativeimport.cpp index fe05d20..8d81b34 100644 --- a/src/declarative/qml/qdeclarativeimport.cpp +++ b/src/declarative/qml/qdeclarativeimport.cpp @@ -447,11 +447,23 @@ bool QDeclarativeImportsPrivate::add(const QDeclarativeDirComponents &qmldircomp if (vmaj > -1 && vmin > -1 && !qmldircomponents.isEmpty()) { QList<QDeclarativeDirParser::Component>::ConstIterator it = qmldircomponents.begin(); + int lowest_maj = INT_MAX; + int lowest_min = INT_MAX; + int highest_maj = INT_MIN; + int highest_min = INT_MIN; for (; it != qmldircomponents.end(); ++it) { - if (it->majorVersion > vmaj || (it->majorVersion == vmaj && it->minorVersion >= vmin)) - break; + if (it->majorVersion > highest_maj || (it->majorVersion == highest_maj && it->minorVersion > highest_min)) { + highest_maj = it->majorVersion; + highest_min = it->minorVersion; + } + if (it->majorVersion < lowest_maj || (it->majorVersion == lowest_maj && it->minorVersion < lowest_min)) { + lowest_maj = it->majorVersion; + lowest_min = it->minorVersion; + } } - if (it == qmldircomponents.end()) { + if (lowest_maj > vmaj || (lowest_maj == vmaj && lowest_min > vmin) + || highest_maj < vmaj || (highest_maj == vmaj && highest_min < vmin)) + { *errorString = QDeclarativeImportDatabase::tr("module \"%1\" version %2.%3 is not installed").arg(uri_arg).arg(vmaj).arg(vmin); return false; } diff --git a/src/declarative/util/qdeclarativepixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp index 0c2f23d..fdc2455 100644 --- a/src/declarative/util/qdeclarativepixmapcache.cpp +++ b/src/declarative/util/qdeclarativepixmapcache.cpp @@ -55,104 +55,209 @@ #include <QFile> #include <QThread> #include <QMutex> +#include <QMutexLocker> +#include <QWaitCondition> #include <QBuffer> #include <QWaitCondition> #include <QtCore/qdebug.h> #include <private/qobject_p.h> #include <QSslError> -// Maximum number of simultaneous image requests to send. -static const int maxImageRequestCount = 8; +#define IMAGEREQUEST_MAX_REQUEST_COUNT 8 +#define IMAGEREQUEST_MAX_REDIRECT_RECURSION 16 +#define CACHE_EXPIRE_TIME 30 +#define CACHE_REMOVAL_FRACTION 4 QT_BEGIN_NAMESPACE -class QDeclarativeImageReaderEvent : public QEvent +class QDeclarativePixmapReader; +class QDeclarativePixmapData; +class QDeclarativePixmapReply : public QObject { + Q_OBJECT public: enum ReadError { NoError, Loading, Decoding }; - QDeclarativeImageReaderEvent(QDeclarativeImageReaderEvent::ReadError err, const QString &errStr, const QImage &img) - : QEvent(QEvent::User), error(err), errorString(errStr), image(img) {} + QDeclarativePixmapReply(QDeclarativePixmapData *); + ~QDeclarativePixmapReply(); - ReadError error; - QString errorString; - QImage image; + QDeclarativePixmapData *data; + QDeclarativePixmapReader *reader; + + bool loading; + int redirectCount; + + class Event : public QEvent { + public: + Event(ReadError, const QString &, const QSize &, const QImage &); + + ReadError error; + QString errorString; + QSize implicitSize; + QImage image; + }; + void postReply(ReadError, const QString &, const QSize &, const QImage &); + + +Q_SIGNALS: + void finished(); + void downloadProgress(qint64, qint64); + +protected: + bool event(QEvent *event); + +private: + Q_DISABLE_COPY(QDeclarativePixmapReply) + +public: + static int finishedIndex; + static int downloadProgressIndex; }; -class QDeclarativeImageRequestHandler; -class QDeclarativeImageReader : public QThread +class QDeclarativePixmapData; +class QDeclarativePixmapReader : public QThread { Q_OBJECT public: - QDeclarativeImageReader(QDeclarativeEngine *eng); - ~QDeclarativeImageReader(); + QDeclarativePixmapReader(QDeclarativeEngine *eng); + ~QDeclarativePixmapReader(); - QDeclarativePixmapReply *getImage(const QUrl &url, int req_width, int req_height); + QDeclarativePixmapReply *getImage(QDeclarativePixmapData *); void cancel(QDeclarativePixmapReply *rep); - static QDeclarativeImageReader *instance(QDeclarativeEngine *engine); + static QDeclarativePixmapReader *instance(QDeclarativeEngine *engine); protected: void run(); +private slots: + void networkRequestDone(); + private: + void processJobs(); + void processJob(QDeclarativePixmapReply *); + QList<QDeclarativePixmapReply*> jobs; QList<QDeclarativePixmapReply*> cancelled; QDeclarativeEngine *engine; - QDeclarativeImageRequestHandler *handler; QObject *eventLoopQuitHack; + QMutex mutex; + class ThreadObject : public QObject { + public: + ThreadObject(QDeclarativePixmapReader *); + void processJobs(); + virtual bool event(QEvent *e); + private: + QDeclarativePixmapReader *reader; + } *threadObject; + QWaitCondition waitCondition; + + QNetworkAccessManager *networkAccessManager(); + QNetworkAccessManager *accessManager; - static QHash<QDeclarativeEngine *,QDeclarativeImageReader*> readers; + QHash<QNetworkReply*,QDeclarativePixmapReply*> replies; + + static int replyDownloadProgress; + static int replyFinished; + static int downloadProgress; + static int thisNetworkRequestDone; + static QHash<QDeclarativeEngine *,QDeclarativePixmapReader*> readers; static QMutex readerMutex; - friend class QDeclarativeImageRequestHandler; }; -QHash<QDeclarativeEngine *,QDeclarativeImageReader*> QDeclarativeImageReader::readers; -QMutex QDeclarativeImageReader::readerMutex; - - -class QDeclarativeImageRequestHandler : public QObject +class QDeclarativePixmapData { - Q_OBJECT public: - QDeclarativeImageRequestHandler(QDeclarativeImageReader *read, QDeclarativeEngine *eng) - : QObject(), accessManager(0), engine(eng), reader(read), redirectCount(0) + QDeclarativePixmapData(const QUrl &u, const QSize &s, const QString &e) + : refCount(1), inCache(false), pixmapStatus(QDeclarativePixmap::Error), + url(u), errorString(e), requestSize(s), reply(0), prevUnreferenced(0), + prevUnreferencedPtr(0), nextUnreferenced(0) { - QCoreApplication::postEvent(this, new QEvent(QEvent::User)); } - QDeclarativePixmapReply *getImage(const QUrl &url, int req_width, int req_height); - void cancel(QDeclarativePixmapReply *reply); - -protected: - bool event(QEvent *event); + QDeclarativePixmapData(const QUrl &u, const QSize &r) + : refCount(1), inCache(false), pixmapStatus(QDeclarativePixmap::Loading), + url(u), requestSize(r), reply(0), prevUnreferenced(0), prevUnreferencedPtr(0), + nextUnreferenced(0) + { + } -private slots: - void networkRequestDone(); + QDeclarativePixmapData(const QUrl &u, const QPixmap &p, const QSize &s, const QSize &r) + : refCount(1), inCache(false), privatePixmap(false), pixmapStatus(QDeclarativePixmap::Ready), + url(u), pixmap(p), implicitSize(s), requestSize(r), reply(0), prevUnreferenced(0), + prevUnreferencedPtr(0), nextUnreferenced(0) + { + } -private: - QNetworkAccessManager *networkAccessManager() { - if (!accessManager) - accessManager = QDeclarativeEnginePrivate::get(engine)->createNetworkAccessManager(this); - return accessManager; + QDeclarativePixmapData(const QPixmap &p) + : refCount(1), inCache(false), privatePixmap(true), pixmapStatus(QDeclarativePixmap::Ready), + pixmap(p), implicitSize(p.size()), requestSize(p.size()), reply(0), prevUnreferenced(0), + prevUnreferencedPtr(0), nextUnreferenced(0) + { } - QHash<QNetworkReply*,QDeclarativePixmapReply*> replies; - QNetworkAccessManager *accessManager; - QDeclarativeEngine *engine; - QDeclarativeImageReader *reader; - int redirectCount; + int cost() const; + void addref(); + void release(); + void addToCache(); + void removeFromCache(); - static int replyDownloadProgress; - static int replyFinished; - static int downloadProgress; - static int thisNetworkRequestDone; + uint refCount; + + bool inCache:1; + bool privatePixmap:1; + + QDeclarativePixmap::Status pixmapStatus; + QUrl url; + QString errorString; + QPixmap pixmap; + QSize implicitSize; + QSize requestSize; + + QDeclarativePixmapReply *reply; + + QDeclarativePixmapData *prevUnreferenced; + QDeclarativePixmapData**prevUnreferencedPtr; + QDeclarativePixmapData *nextUnreferenced; }; -//=========================================================================== +int QDeclarativePixmapReply::finishedIndex = -1; +int QDeclarativePixmapReply::downloadProgressIndex = -1; + +// XXX +QHash<QDeclarativeEngine *,QDeclarativePixmapReader*> QDeclarativePixmapReader::readers; +QMutex QDeclarativePixmapReader::readerMutex; -static bool readImage(const QUrl& url, QIODevice *dev, QImage *image, QString *errorString, QSize *impsize, int req_width, int req_height) +int QDeclarativePixmapReader::replyDownloadProgress = -1; +int QDeclarativePixmapReader::replyFinished = -1; +int QDeclarativePixmapReader::downloadProgress = -1; +int QDeclarativePixmapReader::thisNetworkRequestDone = -1; + + +void QDeclarativePixmapReply::postReply(ReadError error, const QString &errorString, + const QSize &implicitSize, const QImage &image) +{ + loading = false; + QCoreApplication::postEvent(this, new Event(error, errorString, implicitSize, image)); +} + +QDeclarativePixmapReply::Event::Event(ReadError e, const QString &s, const QSize &iSize, const QImage &i) +: QEvent(QEvent::User), error(e), errorString(s), implicitSize(iSize), image(i) +{ +} + +QNetworkAccessManager *QDeclarativePixmapReader::networkAccessManager() +{ + if (!accessManager) { + Q_ASSERT(threadObject); + accessManager = QDeclarativeEnginePrivate::get(engine)->createNetworkAccessManager(threadObject); + } + return accessManager; +} + +static bool readImage(const QUrl& url, QIODevice *dev, QImage *image, QString *errorString, QSize *impsize, + const QSize &requestSize) { QImageReader imgio(dev); @@ -163,17 +268,17 @@ static bool readImage(const QUrl& url, QIODevice *dev, QImage *image, QString *e } bool scaled = false; - if (req_width > 0 || req_height > 0) { + if (requestSize.width() > 0 || requestSize.height() > 0) { QSize s = imgio.size(); - if (req_width && (force_scale || req_width < s.width())) { - if (req_height <= 0) - s.setHeight(s.height()*req_width/s.width()); - s.setWidth(req_width); scaled = true; + if (requestSize.width() && (force_scale || requestSize.width() < s.width())) { + if (requestSize.height() <= 0) + s.setHeight(s.height()*requestSize.width()/s.width()); + s.setWidth(requestSize.width()); scaled = true; } - if (req_height && (force_scale || req_height < s.height())) { - if (req_width <= 0) - s.setWidth(s.width()*req_height/s.height()); - s.setHeight(req_height); scaled = true; + if (requestSize.height() && (force_scale || requestSize.height() < s.height())) { + if (requestSize.width() <= 0) + s.setWidth(s.width()*requestSize.height()/s.height()); + s.setHeight(requestSize.height()); scaled = true; } if (scaled) { imgio.setScaledSize(s); } } @@ -187,130 +292,39 @@ static bool readImage(const QUrl& url, QIODevice *dev, QImage *image, QString *e return true; } else { if (errorString) - *errorString = QDeclarativePixmapCache::tr("Error decoding: %1: %2").arg(url.toString()) + *errorString = QDeclarativePixmap::tr("Error decoding: %1: %2").arg(url.toString()) .arg(imgio.errorString()); return false; } } - -//=========================================================================== - -int QDeclarativeImageRequestHandler::replyDownloadProgress = -1; -int QDeclarativeImageRequestHandler::replyFinished = -1; -int QDeclarativeImageRequestHandler::downloadProgress = -1; -int QDeclarativeImageRequestHandler::thisNetworkRequestDone = -1; - -typedef QHash<QUrl, QSize> QDeclarativePixmapSizeHash; -Q_GLOBAL_STATIC(QDeclarativePixmapSizeHash, qmlOriginalSizes); - -bool QDeclarativeImageRequestHandler::event(QEvent *event) +QDeclarativePixmapReader::QDeclarativePixmapReader(QDeclarativeEngine *eng) +: QThread(eng), engine(eng), threadObject(0), accessManager(0) { - if (event->type() == QEvent::User) { - if (replyDownloadProgress == -1) { - replyDownloadProgress = QNetworkReply::staticMetaObject.indexOfSignal("downloadProgress(qint64,qint64)"); - replyFinished = QNetworkReply::staticMetaObject.indexOfSignal("finished()"); - downloadProgress = QDeclarativePixmapReply::staticMetaObject.indexOfSignal("downloadProgress(qint64,qint64)"); - thisNetworkRequestDone = QDeclarativeImageRequestHandler::staticMetaObject.indexOfSlot("networkRequestDone()"); - } - - while (1) { - reader->mutex.lock(); - - if (reader->cancelled.count()) { - for (int i = 0; i < reader->cancelled.count(); ++i) { - QDeclarativePixmapReply *job = reader->cancelled.at(i); - QNetworkReply *reply = replies.key(job, 0); - if (reply && reply->isRunning()) { - // cancel any jobs already started - replies.remove(reply); - reply->close(); - job->release(true); - } else { - // remove from pending job list - for (int j = 0; j < reader->jobs.count(); ++j) { - if (reader->jobs.at(j) == job) { - reader->jobs.removeAt(j); - job->release(true); - break; - } - } - } - } - reader->cancelled.clear(); - } - - if (!reader->jobs.count() || replies.count() > maxImageRequestCount) { - reader->mutex.unlock(); - break; - } - - QDeclarativePixmapReply *runningJob = reader->jobs.takeLast(); - QUrl url = runningJob->url(); - reader->mutex.unlock(); - - // fetch - if (url.scheme() == QLatin1String("image")) { - // Use QmlImageProvider - QSize read_impsize; - QImage image = QDeclarativeEnginePrivate::get(engine)->getImageFromProvider(url, &read_impsize, QSize(runningJob->forcedWidth(),runningJob->forcedHeight())); - qmlOriginalSizes()->insert(url, read_impsize); - QDeclarativeImageReaderEvent::ReadError errorCode = QDeclarativeImageReaderEvent::NoError; - QString errorStr; - if (image.isNull()) { - errorCode = QDeclarativeImageReaderEvent::Loading; - errorStr = QDeclarativePixmapCache::tr("Failed to get image from provider: %1").arg(url.toString()); - } - QCoreApplication::postEvent(runningJob, new QDeclarativeImageReaderEvent(errorCode, errorStr, image)); - } else { - QString lf = QDeclarativeEnginePrivate::urlToLocalFileOrQrc(url); - if (!lf.isEmpty()) { - // Image is local - load/decode immediately - QImage image; - QDeclarativeImageReaderEvent::ReadError errorCode = QDeclarativeImageReaderEvent::NoError; - QString errorStr; - QFile f(lf); - if (f.open(QIODevice::ReadOnly)) { - QSize read_impsize; - if (readImage(url, &f, &image, &errorStr, &read_impsize, runningJob->forcedWidth(),runningJob->forcedHeight())) { - qmlOriginalSizes()->insert(url, read_impsize); - } else { - errorCode = QDeclarativeImageReaderEvent::Loading; - } - } else { - errorStr = QDeclarativePixmapCache::tr("Cannot open: %1").arg(url.toString()); - errorCode = QDeclarativeImageReaderEvent::Loading; - } - QCoreApplication::postEvent(runningJob, new QDeclarativeImageReaderEvent(errorCode, errorStr, image)); - } else { - // Network resource - QNetworkRequest req(url); - req.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true); - QNetworkReply *reply = networkAccessManager()->get(req); - - QMetaObject::connect(reply, replyDownloadProgress, runningJob, downloadProgress); - QMetaObject::connect(reply, replyFinished, this, thisNetworkRequestDone); + eventLoopQuitHack = new QObject; + eventLoopQuitHack->moveToThread(this); + connect(eventLoopQuitHack, SIGNAL(destroyed(QObject*)), SLOT(quit()), Qt::DirectConnection); + start(QThread::IdlePriority); +} - replies.insert(reply, runningJob); - } - } - } - return true; - } +QDeclarativePixmapReader::~QDeclarativePixmapReader() +{ + readerMutex.lock(); + readers.remove(engine); + readerMutex.unlock(); - return QObject::event(event); + eventLoopQuitHack->deleteLater(); + wait(); } -#define IMAGEREQUESTHANDLER_MAX_REDIRECT_RECURSION 16 - -void QDeclarativeImageRequestHandler::networkRequestDone() +void QDeclarativePixmapReader::networkRequestDone() { QNetworkReply *reply = static_cast<QNetworkReply *>(sender()); QDeclarativePixmapReply *job = replies.take(reply); if (job) { - redirectCount++; - if (redirectCount < IMAGEREQUESTHANDLER_MAX_REDIRECT_RECURSION) { + job->redirectCount++; + if (job->redirectCount < IMAGEREQUEST_MAX_REDIRECT_RECURSION) { QVariant redirect = reply->attribute(QNetworkRequest::RedirectionTargetAttribute); if (redirect.isValid()) { QUrl url = reply->url().resolved(redirect.toUrl()); @@ -327,62 +341,141 @@ void QDeclarativeImageRequestHandler::networkRequestDone() return; } } - redirectCount=0; QImage image; - QDeclarativeImageReaderEvent::ReadError error; + QDeclarativePixmapReply::ReadError error = QDeclarativePixmapReply::NoError; QString errorString; + QSize readSize; if (reply->error()) { - error = QDeclarativeImageReaderEvent::Loading; + error = QDeclarativePixmapReply::Loading; errorString = reply->errorString(); } else { - QSize read_impsize; QByteArray all = reply->readAll(); QBuffer buff(&all); buff.open(QIODevice::ReadOnly); - if (readImage(reply->url(), &buff, &image, &errorString, &read_impsize, job->forcedWidth(), job->forcedHeight())) { - qmlOriginalSizes()->insert(reply->url(), read_impsize); - error = QDeclarativeImageReaderEvent::NoError; - } else { - error = QDeclarativeImageReaderEvent::Decoding; + if (!readImage(reply->url(), &buff, &image, &errorString, &readSize, job->data->requestSize)) { + error = QDeclarativePixmapReply::Decoding; } } // send completion event to the QDeclarativePixmapReply - QCoreApplication::postEvent(job, new QDeclarativeImageReaderEvent(error, errorString, image)); + job->postReply(error, errorString, readSize, image); } - // kick off event loop again if we have dropped below max request count - if (replies.count() == maxImageRequestCount) - QCoreApplication::postEvent(this, new QEvent(QEvent::User)); reply->deleteLater(); + + // kick off event loop again incase we have dropped below max request count + threadObject->processJobs(); } -//=========================================================================== +QDeclarativePixmapReader::ThreadObject::ThreadObject(QDeclarativePixmapReader *i) +: reader(i) +{ +} + +void QDeclarativePixmapReader::ThreadObject::processJobs() +{ + QCoreApplication::postEvent(this, new QEvent(QEvent::User)); +} -QDeclarativeImageReader::QDeclarativeImageReader(QDeclarativeEngine *eng) - : QThread(eng), engine(eng), handler(0) +bool QDeclarativePixmapReader::ThreadObject::event(QEvent *e) { - eventLoopQuitHack = new QObject; - eventLoopQuitHack->moveToThread(this); - connect(eventLoopQuitHack, SIGNAL(destroyed(QObject*)), SLOT(quit()), Qt::DirectConnection); - start(QThread::IdlePriority); + if (e->type() == QEvent::User) { + reader->processJobs(); + return true; + } else { + return QObject::event(e); + } } -QDeclarativeImageReader::~QDeclarativeImageReader() +void QDeclarativePixmapReader::processJobs() { - readerMutex.lock(); - readers.remove(engine); - readerMutex.unlock(); + QMutexLocker locker(&mutex); + + while (true) { + if (cancelled.isEmpty() && (jobs.isEmpty() || replies.count() >= IMAGEREQUEST_MAX_REQUEST_COUNT)) + return; // Nothing else to do + + // Clean cancelled jobs + if (cancelled.count()) { + for (int i = 0; i < cancelled.count(); ++i) { + QDeclarativePixmapReply *job = cancelled.at(i); + QNetworkReply *reply = replies.key(job, 0); + if (reply && reply->isRunning()) { + // cancel any jobs already started + replies.remove(reply); + reply->close(); + } + delete job; + } + cancelled.clear(); + } - eventLoopQuitHack->deleteLater(); - wait(); + if (!jobs.isEmpty() && replies.count() < IMAGEREQUEST_MAX_REQUEST_COUNT) { + QDeclarativePixmapReply *runningJob = jobs.takeLast(); + runningJob->loading = true; + + locker.unlock(); + processJob(runningJob); + locker.relock(); + } + } +} + +void QDeclarativePixmapReader::processJob(QDeclarativePixmapReply *runningJob) +{ + QUrl url = runningJob->data->url; + + // fetch + if (url.scheme() == QLatin1String("image")) { + // Use QmlImageProvider + QSize readSize; + QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine); + QImage image = ep->getImageFromProvider(url, &readSize, runningJob->data->requestSize); + + QDeclarativePixmapReply::ReadError errorCode = QDeclarativePixmapReply::NoError; + QString errorStr; + if (image.isNull()) { + errorCode = QDeclarativePixmapReply::Loading; + errorStr = QDeclarativePixmap::tr("Failed to get image from provider: %1").arg(url.toString()); + } + + runningJob->postReply(errorCode, errorStr, readSize, image); + } else { + QString lf = QDeclarativeEnginePrivate::urlToLocalFileOrQrc(url); + if (!lf.isEmpty()) { + // Image is local - load/decode immediately + QImage image; + QDeclarativePixmapReply::ReadError errorCode = QDeclarativePixmapReply::NoError; + QString errorStr; + QFile f(lf); + QSize readSize; + if (f.open(QIODevice::ReadOnly)) { + if (!readImage(url, &f, &image, &errorStr, &readSize, runningJob->data->requestSize)) + errorCode = QDeclarativePixmapReply::Loading; + } else { + errorStr = QDeclarativePixmap::tr("Cannot open: %1").arg(url.toString()); + errorCode = QDeclarativePixmapReply::Loading; + } + runningJob->postReply(errorCode, errorStr, readSize, image); + } else { + // Network resource + QNetworkRequest req(url); + req.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true); + QNetworkReply *reply = networkAccessManager()->get(req); + + QMetaObject::connect(reply, replyDownloadProgress, runningJob, downloadProgress); + QMetaObject::connect(reply, replyFinished, this, thisNetworkRequestDone); + + replies.insert(reply, runningJob); + } + } } -QDeclarativeImageReader *QDeclarativeImageReader::instance(QDeclarativeEngine *engine) +QDeclarativePixmapReader *QDeclarativePixmapReader::instance(QDeclarativeEngine *engine) { readerMutex.lock(); - QDeclarativeImageReader *reader = readers.value(engine); + QDeclarativePixmapReader *reader = readers.value(engine); if (!reader) { - reader = new QDeclarativeImageReader(engine); + reader = new QDeclarativePixmapReader(engine); readers.insert(engine, reader); } readerMutex.unlock(); @@ -390,348 +483,510 @@ QDeclarativeImageReader *QDeclarativeImageReader::instance(QDeclarativeEngine *e return reader; } -QDeclarativePixmapReply *QDeclarativeImageReader::getImage(const QUrl &url, int req_width, int req_height) +QDeclarativePixmapReply *QDeclarativePixmapReader::getImage(QDeclarativePixmapData *data) { mutex.lock(); - QDeclarativePixmapReply *reply = new QDeclarativePixmapReply(this, url, req_width, req_height); - reply->addRef(); - reply->setLoading(); + QDeclarativePixmapReply *reply = new QDeclarativePixmapReply(data); + reply->reader = this; jobs.append(reply); - if (jobs.count() == 1 && handler) - QCoreApplication::postEvent(handler, new QEvent(QEvent::User)); + // XXX + if (threadObject) threadObject->processJobs(); mutex.unlock(); return reply; } -void QDeclarativeImageReader::cancel(QDeclarativePixmapReply *reply) +void QDeclarativePixmapReader::cancel(QDeclarativePixmapReply *reply) { mutex.lock(); - if (reply->isLoading()) { - // Add to cancel list to be cancelled in reader thread. + if (reply->loading) { cancelled.append(reply); - if (cancelled.count() == 1 && handler) - QCoreApplication::postEvent(handler, new QEvent(QEvent::User)); + // XXX + if (threadObject) threadObject->processJobs(); + } else { + jobs.removeAll(reply); + delete reply; } mutex.unlock(); } -void QDeclarativeImageReader::run() +void QDeclarativePixmapReader::run() { - readerMutex.lock(); - handler = new QDeclarativeImageRequestHandler(this, engine); - readerMutex.unlock(); + if (replyDownloadProgress == -1) { + const QMetaObject *nr = &QNetworkReply::staticMetaObject; + const QMetaObject *pr = &QDeclarativePixmapReply::staticMetaObject; + const QMetaObject *ir = &QDeclarativePixmapReader::staticMetaObject; + replyDownloadProgress = nr->indexOfSignal("downloadProgress(qint64,qint64)"); + replyFinished = nr->indexOfSignal("finished()"); + downloadProgress = pr->indexOfSignal("downloadProgress(qint64,qint64)"); + thisNetworkRequestDone = ir->indexOfSlot("networkRequestDone()"); + } + mutex.lock(); + threadObject = new ThreadObject(this); + mutex.unlock(); + + processJobs(); exec(); - delete handler; - handler = 0; + delete threadObject; + threadObject = 0; } -//=========================================================================== - -/*! - \internal - \class QDeclarativePixmapCache - \brief Enacapsultes a pixmap for QDeclarativeGraphics items. +class QDeclarativePixmapKey +{ +public: + const QUrl *url; + const QSize *size; +}; - This class is NOT reentrant. - */ +inline bool operator==(const QDeclarativePixmapKey &lhs, const QDeclarativePixmapKey &rhs) +{ + return *lhs.size == *rhs.size && *lhs.url == *rhs.url; +} -typedef QHash<QUrl, QDeclarativePixmapReply *> QDeclarativePixmapReplyHash; -Q_GLOBAL_STATIC(QDeclarativePixmapReplyHash, qmlActivePixmapReplies); +inline uint qHash(const QDeclarativePixmapKey &key) +{ + return qHash(*key.url) ^ key.size->width() ^ key.size->height(); +} -class QDeclarativePixmapReplyPrivate : public QObjectPrivate +class QDeclarativePixmapStore : public QObject { - Q_DECLARE_PUBLIC(QDeclarativePixmapReply) + Q_OBJECT +public: + QDeclarativePixmapStore(); + + void unreferencePixmap(QDeclarativePixmapData *); + void referencePixmap(QDeclarativePixmapData *); + +protected: + virtual void timerEvent(QTimerEvent *); public: - QDeclarativePixmapReplyPrivate(QDeclarativeImageReader *r, const QUrl &u, int req_width, int req_height) - : QObjectPrivate(), refCount(1), url(u), status(QDeclarativePixmapReply::Loading), loading(false), reader(r), - forced_width(req_width), forced_height(req_height) - { - } + QHash<QDeclarativePixmapKey, QDeclarativePixmapData *> m_cache; - int refCount; - QUrl url; - QPixmap pixmap; // ensure reference to pixmap so QPixmapCache does not discard - QDeclarativePixmapReply::Status status; - bool loading; - QDeclarativeImageReader *reader; - int forced_width, forced_height; - QString errorString; -}; +private: + QDeclarativePixmapData *m_unreferencedPixmaps; + QDeclarativePixmapData *m_lastUnreferencedPixmap; + int m_unreferencedCost; + int m_timerId; +}; +Q_GLOBAL_STATIC(QDeclarativePixmapStore, pixmapStore); -QDeclarativePixmapReply::QDeclarativePixmapReply(QDeclarativeImageReader *reader, const QUrl &url, int req_width, int req_height) - : QObject(*new QDeclarativePixmapReplyPrivate(reader, url, req_width, req_height), 0) +QDeclarativePixmapStore::QDeclarativePixmapStore() +: m_unreferencedPixmaps(0), m_lastUnreferencedPixmap(0), m_unreferencedCost(0), m_timerId(-1) { } -QDeclarativePixmapReply::~QDeclarativePixmapReply() +void QDeclarativePixmapStore::unreferencePixmap(QDeclarativePixmapData *data) { + Q_ASSERT(data->prevUnreferenced == 0); + Q_ASSERT(data->prevUnreferencedPtr == 0); + Q_ASSERT(data->nextUnreferenced == 0); + + data->nextUnreferenced = m_unreferencedPixmaps; + data->prevUnreferencedPtr = &m_unreferencedPixmaps; + + m_unreferencedPixmaps = data; + if (m_unreferencedPixmaps->nextUnreferenced) { + m_unreferencedPixmaps->nextUnreferenced->prevUnreferenced = m_unreferencedPixmaps; + m_unreferencedPixmaps->nextUnreferenced->prevUnreferencedPtr = &m_unreferencedPixmaps->nextUnreferenced; + } + + if (!m_lastUnreferencedPixmap) + m_lastUnreferencedPixmap = data; + + m_unreferencedCost += data->cost(); + + if (m_timerId == -1) + startTimer(CACHE_EXPIRE_TIME * 1000); } -const QUrl &QDeclarativePixmapReply::url() const +void QDeclarativePixmapStore::referencePixmap(QDeclarativePixmapData *data) { - Q_D(const QDeclarativePixmapReply); - return d->url; + Q_ASSERT(data->prevUnreferencedPtr); + + *data->prevUnreferencedPtr = data->nextUnreferenced; + if (data->nextUnreferenced) { + data->nextUnreferenced->prevUnreferencedPtr = data->prevUnreferencedPtr; + data->nextUnreferenced->prevUnreferenced = data->prevUnreferenced; + } + if (m_lastUnreferencedPixmap == data) + m_lastUnreferencedPixmap = data->prevUnreferenced; + + data->nextUnreferenced = 0; + data->prevUnreferencedPtr = 0; + data->prevUnreferenced = 0; + + m_unreferencedCost -= data->cost(); } -int QDeclarativePixmapReply::forcedWidth() const +void QDeclarativePixmapStore::timerEvent(QTimerEvent *) { - Q_D(const QDeclarativePixmapReply); - return d->forced_width; + int removalCost = m_unreferencedCost / CACHE_REMOVAL_FRACTION; + + while (removalCost > 0 && m_lastUnreferencedPixmap) { + QDeclarativePixmapData *data = m_lastUnreferencedPixmap; + Q_ASSERT(data->nextUnreferenced == 0); + + *data->prevUnreferencedPtr = 0; + m_lastUnreferencedPixmap = data->prevUnreferenced; + data->prevUnreferencedPtr = 0; + data->prevUnreferenced = 0; + + removalCost -= data->cost(); + data->removeFromCache(); + delete data; + } + + if (m_unreferencedPixmaps == 0) { + killTimer(m_timerId); + m_timerId = -1; + } } -int QDeclarativePixmapReply::forcedHeight() const +QDeclarativePixmapReply::QDeclarativePixmapReply(QDeclarativePixmapData *d) +: data(d), reader(0), loading(false), redirectCount(0) { - Q_D(const QDeclarativePixmapReply); - return d->forced_height; + if (finishedIndex == -1) { + finishedIndex = QDeclarativePixmapReply::staticMetaObject.indexOfSignal("finished()"); + downloadProgressIndex = QDeclarativePixmapReply::staticMetaObject.indexOfSignal("downloadProgress(qint64,qint64)"); + } } -QSize QDeclarativePixmapReply::implicitSize() const +QDeclarativePixmapReply::~QDeclarativePixmapReply() { - Q_D(const QDeclarativePixmapReply); - QDeclarativePixmapSizeHash::Iterator iter = qmlOriginalSizes()->find(d->url); - if (iter != qmlOriginalSizes()->end()) - return *iter; - else - return QSize(); } bool QDeclarativePixmapReply::event(QEvent *event) { - Q_D(QDeclarativePixmapReply); if (event->type() == QEvent::User) { - d->loading = false; - if (!release(true)) { - QDeclarativeImageReaderEvent *de = static_cast<QDeclarativeImageReaderEvent*>(event); - d->status = (de->error == QDeclarativeImageReaderEvent::NoError) ? Ready : Error; - if (d->status == Ready) - d->pixmap = QPixmap::fromImage(de->image); - else - d->errorString = de->errorString; - QByteArray key = d->url.toEncoded(QUrl::FormattingOption(0x100)); - if (d->forced_width > 0 || d->forced_height > 0) { - key += ':'; - key += QByteArray::number(d->forced_width); - key += 'x'; - key += QByteArray::number(d->forced_height); + + if (data) { + Event *de = static_cast<Event *>(event); + data->pixmapStatus = (de->error == NoError) ? QDeclarativePixmap::Ready : QDeclarativePixmap::Error; + + if (data->pixmapStatus == QDeclarativePixmap::Ready) { + data->pixmap = QPixmap::fromImage(de->image); + data->implicitSize = de->implicitSize; + } else { + data->errorString = de->errorString; + data->removeFromCache(); // We don't continue to cache error'd pixmaps } - QString strKey = QString::fromLatin1(key.constData(), key.count()); - QPixmapCache::insert(strKey, d->pixmap); // note: may fail (returns false) + + data->reply = 0; emit finished(); } + + delete this; return true; + } else { + return QObject::event(event); } +} - return QObject::event(event); +int QDeclarativePixmapData::cost() const +{ + return pixmap.width() * pixmap.height() * pixmap.depth(); } -QString QDeclarativePixmapReply::errorString() const +void QDeclarativePixmapData::addref() { - Q_D(const QDeclarativePixmapReply); - return d->errorString; + ++refCount; + if (prevUnreferencedPtr) + pixmapStore()->referencePixmap(this); } -QDeclarativePixmapReply::Status QDeclarativePixmapReply::status() const +void QDeclarativePixmapData::release() { - Q_D(const QDeclarativePixmapReply); - return d->status; + Q_ASSERT(refCount > 0); + --refCount; + + if (refCount == 0) { + if (reply) { + reply->data = 0; + reply->reader->cancel(reply); + reply = 0; + } + + if (pixmapStatus == QDeclarativePixmap::Ready) { + pixmapStore()->unreferencePixmap(this); + } else { + removeFromCache(); + delete this; + } + } } -bool QDeclarativePixmapReply::isLoading() const +void QDeclarativePixmapData::addToCache() { - Q_D(const QDeclarativePixmapReply); - return d->loading; + if (!inCache) { + QDeclarativePixmapKey key = { &url, &requestSize }; + pixmapStore()->m_cache.insert(key, this); + inCache = true; + } } -void QDeclarativePixmapReply::setLoading() +void QDeclarativePixmapData::removeFromCache() { - Q_D(QDeclarativePixmapReply); - d->loading = true; + if (inCache) { + QDeclarativePixmapKey key = { &url, &requestSize }; + pixmapStore()->m_cache.remove(key); + inCache = false; + } } -void QDeclarativePixmapReply::addRef() +struct QDeclarativePixmapNull { + QUrl url; + QPixmap pixmap; + QSize size; +}; +Q_GLOBAL_STATIC(QDeclarativePixmapNull, nullPixmap); + +QDeclarativePixmap::QDeclarativePixmap() +: d(0) { - Q_D(QDeclarativePixmapReply); - ++d->refCount; } -bool QDeclarativePixmapReply::release(bool defer) +QDeclarativePixmap::QDeclarativePixmap(QDeclarativeEngine *engine, const QUrl &url) +: d(0) { - Q_D(QDeclarativePixmapReply); - Q_ASSERT(d->refCount > 0); - --d->refCount; - if (d->refCount == 0) { - qmlActivePixmapReplies()->remove(d->url); - if (defer) - deleteLater(); - else - delete this; - return true; - } else if (d->refCount == 1 && d->loading) { - // The only reference left is the reader thread. - qmlActivePixmapReplies()->remove(d->url); - d->reader->cancel(this); + load(engine, url); +} + +QDeclarativePixmap::QDeclarativePixmap(QDeclarativeEngine *engine, const QUrl &url, const QSize &size) +: d(0) +{ + load(engine, url, size); +} + +QDeclarativePixmap::~QDeclarativePixmap() +{ + if (d) { + d->release(); + d = 0; } +} - return false; +bool QDeclarativePixmap::isNull() const +{ + return d == 0; } -/*! - Finds the cached pixmap corresponding to \a url. - If the image is a network resource and has not yet - been retrieved and cached, request() must be called. +bool QDeclarativePixmap::isReady() const +{ + return status() == Ready; +} - Returns Ready, or Error if the image has been retrieved, - otherwise the current retrieval status. +bool QDeclarativePixmap::isError() const +{ + return status() == Error; +} - If \a async is false the image will be loaded and decoded immediately; - otherwise the image will be loaded and decoded in a separate thread. +bool QDeclarativePixmap::isLoading() const +{ + return status() == Loading; +} - If \a req_width and \a req_height are non-zero, they are used for - the size of the rendered pixmap rather than the intrinsic size of the image. - Different request sizes add different cache items. +QString QDeclarativePixmap::error() const +{ + if (d) + return d->errorString; + else + return QString(); +} - Note that images sourced from the network will always be loaded and - decoded asynchonously. -*/ -QDeclarativePixmapReply::Status QDeclarativePixmapCache::get(const QUrl& url, QPixmap *pixmap, QString *errorString, QSize *impsize, bool async, int req_width, int req_height) +QDeclarativePixmap::Status QDeclarativePixmap::status() const { - QDeclarativePixmapReply::Status status = QDeclarativePixmapReply::Unrequested; - QByteArray key = url.toEncoded(QUrl::FormattingOption(0x100)); + if (d) + return d->pixmapStatus; + else + return Null; +} - if (req_width > 0 || req_height > 0) { - key += ':'; - key += QByteArray::number(req_width); - key += 'x'; - key += QByteArray::number(req_height); - } +const QUrl &QDeclarativePixmap::url() const +{ + if (d) + return d->url; + else + return nullPixmap()->url; +} - QString strKey = QString::fromLatin1(key.constData(), key.count()); +const QSize &QDeclarativePixmap::implicitSize() const +{ + if (d) + return d->implicitSize; + else + return nullPixmap()->size; +} + +const QSize &QDeclarativePixmap::requestSize() const +{ + if (d) + return d->requestSize; + else + return nullPixmap()->size; +} + +const QPixmap &QDeclarativePixmap::pixmap() const +{ + if (d) + return d->pixmap; + else + return nullPixmap()->pixmap; +} + +void QDeclarativePixmap::setPixmap(const QPixmap &p) +{ + clear(); + + if (!p.isNull()) + d = new QDeclarativePixmapData(p); +} + +int QDeclarativePixmap::width() const +{ + if (d) + return d->pixmap.width(); + else + return 0; +} + +int QDeclarativePixmap::height() const +{ + if (d) + return d->pixmap.height(); + else + return 0; +} + +QRect QDeclarativePixmap::rect() const +{ + if (d) + return d->pixmap.rect(); + else + return QRect(); +} + +void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url) +{ + load(engine, url, QSize(), false); +} + +void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, bool async) +{ + load(engine, url, QSize(), async); +} + +void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, const QSize &size) +{ + load(engine, url, size, false); +} + +void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, const QSize &requestSize, bool async) +{ + if (d) { d->release(); d = 0; } + + QDeclarativePixmapKey key = { &url, &requestSize }; + QDeclarativePixmapStore *store = pixmapStore(); + + QHash<QDeclarativePixmapKey, QDeclarativePixmapData *>::Iterator iter = store->m_cache.find(key); + + if (iter == store->m_cache.end()) { + if (!async) { + QString localFile = QDeclarativeEnginePrivate::urlToLocalFileOrQrc(url); + if (!localFile.isEmpty()) { + QFile f(localFile); + QSize readSize; + QString errorString; -#ifndef QT_NO_LOCALFILE_OPTIMIZED_QML - if (!async) { - QString lf = QDeclarativeEnginePrivate::urlToLocalFileOrQrc(url); - if (!lf.isEmpty()) { - status = QDeclarativePixmapReply::Ready; - if (!QPixmapCache::find(strKey,pixmap)) { - QFile f(lf); - QSize read_impsize; if (f.open(QIODevice::ReadOnly)) { QImage image; - if (readImage(url, &f, &image, errorString, &read_impsize, req_width, req_height)) { - *pixmap = QPixmap::fromImage(image); - } else { - *pixmap = QPixmap(); - status = QDeclarativePixmapReply::Error; - } + if (readImage(url, &f, &image, &errorString, &readSize, requestSize)) { + d = new QDeclarativePixmapData(url, QPixmap::fromImage(image), readSize, requestSize); + d->addToCache(); + return; + } } else { - if (errorString) - *errorString = tr("Cannot open: %1").arg(url.toString()); - *pixmap = QPixmap(); - status = QDeclarativePixmapReply::Error; - } - if (status == QDeclarativePixmapReply::Ready) { - QPixmapCache::insert(strKey, *pixmap); - qmlOriginalSizes()->insert(url, read_impsize); - } - if (impsize) - *impsize = read_impsize; - } else { - if (impsize) { - QDeclarativePixmapSizeHash::Iterator iter = qmlOriginalSizes()->find(url); - if (iter != qmlOriginalSizes()->end()) - *impsize = *iter; + errorString = tr("Cannot open: %1").arg(url.toString()); } + + d = new QDeclarativePixmapData(url, requestSize, errorString); + return; } - return status; - } - } -#endif - - QDeclarativePixmapReplyHash::Iterator iter = qmlActivePixmapReplies()->find(url); - if (iter != qmlActivePixmapReplies()->end() && (*iter)->status() == QDeclarativePixmapReply::Ready) { - // Must check this, since QPixmapCache::insert may have failed. - *pixmap = (*iter)->d_func()->pixmap; - status = (*iter)->status(); - (*iter)->release(); - } else if (QPixmapCache::find(strKey, pixmap)) { - if (iter != qmlActivePixmapReplies()->end()) { - status = (*iter)->status(); - if (errorString) - *errorString = (*iter)->errorString(); - (*iter)->release(); - } else if (pixmap->isNull()) { - status = QDeclarativePixmapReply::Error; - if (errorString) - *errorString = tr("Unknown Error loading %1").arg(url.toString()); - } else { - status = QDeclarativePixmapReply::Ready; - } - } else if (iter != qmlActivePixmapReplies()->end()) { - status = QDeclarativePixmapReply::Loading; - } - if (impsize) { - QDeclarativePixmapSizeHash::Iterator iter = qmlOriginalSizes()->find(url); - if (iter != qmlOriginalSizes()->end()) - *impsize = *iter; - } + } + + if (!engine) + return; + + QDeclarativePixmapReader *reader = QDeclarativePixmapReader::instance(engine); + + d = new QDeclarativePixmapData(url, requestSize); + d->addToCache(); - return status; + d->reply = reader->getImage(d); + } else { + d = *iter; + d->addref(); + } } -/*! - Starts a network request to load \a url. +void QDeclarativePixmap::clear() +{ + if (d) { + d->release(); + d = 0; + } +} - Returns a QDeclarativePixmapReply. Caller should connect to QDeclarativePixmapReply::finished() - and call get() when the image is available. +void QDeclarativePixmap::clear(QObject *obj) +{ + if (d) { + if (d->reply) + QObject::disconnect(d->reply, 0, obj, 0); + d->release(); + d = 0; + } +} - The returned QDeclarativePixmapReply will be deleted when all request() calls are - matched by a corresponding get() call. -*/ -QDeclarativePixmapReply *QDeclarativePixmapCache::request(QDeclarativeEngine *engine, const QUrl &url, int req_width, int req_height) +bool QDeclarativePixmap::connectFinished(QObject *object, const char *method) { - QDeclarativePixmapReplyHash::Iterator iter = qmlActivePixmapReplies()->find(url); - if (iter == qmlActivePixmapReplies()->end()) { - QDeclarativeImageReader *reader = QDeclarativeImageReader::instance(engine); - QDeclarativePixmapReply *item = reader->getImage(url, req_width, req_height); - iter = qmlActivePixmapReplies()->insert(url, item); - } else { - (*iter)->addRef(); + if (!d || !d->reply) { + qWarning("QDeclarativePixmap: connectFinished() called when not loading."); + return false; } - return (*iter); + return QObject::connect(d->reply, SIGNAL(finished()), object, method); } -/*! - Cancels a previous call to request(). +bool QDeclarativePixmap::connectFinished(QObject *object, int method) +{ + if (!d || !d->reply) { + qWarning("QDeclarativePixmap: connectFinished() called when not loading."); + return false; + } - May also cancel loading (eg. if no other pending request). + return QMetaObject::connect(d->reply, QDeclarativePixmapReply::finishedIndex, object, method); +} - Any connections from the QDeclarativePixmapReply returned by request() to \a obj will be - disconnected. -*/ -void QDeclarativePixmapCache::cancel(const QUrl& url, QObject *obj) +bool QDeclarativePixmap::connectDownloadProgress(QObject *object, const char *method) { - QDeclarativePixmapReplyHash::Iterator iter = qmlActivePixmapReplies()->find(url); - if (iter == qmlActivePixmapReplies()->end()) - return; + if (!d || !d->reply) { + qWarning("QDeclarativePixmap: connectDownloadProgress() called when not loading."); + return false; + } - QDeclarativePixmapReply *reply = *iter; - if (obj) - QObject::disconnect(reply, 0, obj, 0); - reply->release(); + return QObject::connect(d->reply, SIGNAL(downloadProgress(qint64,qint64)), object, method); } -/*! - This function is mainly for test verification. It returns the number of - requests that are still unfinished. -*/ -int QDeclarativePixmapCache::pendingRequests() +bool QDeclarativePixmap::connectDownloadProgress(QObject *object, int method) { - return qmlActivePixmapReplies()->count(); + if (!d || !d->reply) { + qWarning("QDeclarativePixmap: connectDownloadProgress() called when not loading."); + return false; + } + + return QMetaObject::connect(d->reply, QDeclarativePixmapReply::downloadProgressIndex, object, method); } QT_END_NAMESPACE diff --git a/src/declarative/util/qdeclarativepixmapcache_p.h b/src/declarative/util/qdeclarativepixmapcache_p.h index 33d9de1..b4d88bd 100644 --- a/src/declarative/util/qdeclarativepixmapcache_p.h +++ b/src/declarative/util/qdeclarativepixmapcache_p.h @@ -42,69 +42,70 @@ #ifndef QDECLARATIVEPIXMAPCACHE_H #define QDECLARATIVEPIXMAPCACHE_H -#include <QtCore/QString> -#include <QtGui/QPixmap> +#include <QtCore/qcoreapplication.h> +#include <QtCore/qstring.h> +#include <QtGui/qpixmap.h> #include <QtCore/qurl.h> -#include <QtCore/QCoreApplication> QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QDeclarativeEngine; -class QNetworkReply; -class QDeclarativeImageReader; -class QDeclarativePixmapReplyPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativePixmapReply : public QObject +class QDeclarativeEngine; +class QDeclarativePixmapData; +class Q_DECLARATIVE_EXPORT QDeclarativePixmap { - Q_OBJECT + Q_DECLARE_TR_FUNCTIONS(QDeclarativePixmap) public: - ~QDeclarativePixmapReply(); + QDeclarativePixmap(); + QDeclarativePixmap(QDeclarativeEngine *, const QUrl &); + QDeclarativePixmap(QDeclarativeEngine *, const QUrl &, const QSize &); + ~QDeclarativePixmap(); - enum Status { Ready, Error, Unrequested, Loading }; - Status status() const; - QString errorString() const; + enum Status { Null, Ready, Error, Loading }; + bool isNull() const; + bool isReady() const; + bool isError() const; + bool isLoading() const; + + Status status() const; + QString error() const; const QUrl &url() const; - int forcedWidth() const; - int forcedHeight() const; - QSize implicitSize() const; + const QSize &implicitSize() const; + const QSize &requestSize() const; + const QPixmap &pixmap() const; + void setPixmap(const QPixmap &); -Q_SIGNALS: - void finished(); - void downloadProgress(qint64, qint64); + QRect rect() const; + int width() const; + int height() const; + inline operator const QPixmap &() const; -protected: - bool event(QEvent *event); + void load(QDeclarativeEngine *, const QUrl &); + void load(QDeclarativeEngine *, const QUrl &, bool); + void load(QDeclarativeEngine *, const QUrl &, const QSize &); + void load(QDeclarativeEngine *, const QUrl &, const QSize &, bool); -private: - void addRef(); - bool release(bool defer=false); - bool isLoading() const; - void setLoading(); + void clear(); + void clear(QObject *); + + bool connectFinished(QObject *, const char *); + bool connectFinished(QObject *, int); + bool connectDownloadProgress(QObject *, const char *); + bool connectDownloadProgress(QObject *, int); private: - QDeclarativePixmapReply(QDeclarativeImageReader *reader, const QUrl &url, int req_width, int req_height); - Q_DISABLE_COPY(QDeclarativePixmapReply) - Q_DECLARE_PRIVATE(QDeclarativePixmapReply) - friend class QDeclarativeImageRequestHandler; - friend class QDeclarativeImageReader; - friend class QDeclarativePixmapCache; + Q_DISABLE_COPY(QDeclarativePixmap); + QDeclarativePixmapData *d; }; -class Q_DECLARATIVE_EXPORT QDeclarativePixmapCache +inline QDeclarativePixmap::operator const QPixmap &() const { - Q_DECLARE_TR_FUNCTIONS(QDeclarativePixmapCache) -public: - static QDeclarativePixmapReply::Status get(const QUrl& url, QPixmap *pixmap, QString *errorString, QSize *impsize=0, bool async=false, int req_width=0, int req_height=0); - static QDeclarativePixmapReply *request(QDeclarativeEngine *, const QUrl& url, int req_width=0, int req_height=0); - static void cancel(const QUrl& url, QObject *obj); - static int pendingRequests(); -}; - - + return pixmap(); +} QT_END_NAMESPACE diff --git a/src/declarative/util/qdeclarativestyledtext.cpp b/src/declarative/util/qdeclarativestyledtext.cpp index babd71b..91566bc 100644 --- a/src/declarative/util/qdeclarativestyledtext.cpp +++ b/src/declarative/util/qdeclarativestyledtext.cpp @@ -152,8 +152,6 @@ void QDeclarativeStyledTextPrivate::parse() QTextCharFormat format; if (formatStack.count()) format = formatStack.top(); - else - format.setFont(baseFont); if (parseTag(ch, text, drawText, format)) formatStack.push(format); } @@ -198,8 +196,10 @@ bool QDeclarativeStyledTextPrivate::parseTag(const QChar *&ch, const QString &te if (char0 == QLatin1Char('b')) { if (tagLength == 1) format.setFontWeight(QFont::Bold); - else if (tagLength == 2 && tag.at(1) == QLatin1Char('r')) + else if (tagLength == 2 && tag.at(1) == QLatin1Char('r')) { textOut.append(QChar(QChar::LineSeparator)); + return false; + } } else if (char0 == QLatin1Char('i')) { if (tagLength == 1) format.setFontItalic(true); diff --git a/src/gui/dialogs/qdialog.cpp b/src/gui/dialogs/qdialog.cpp index a6bd78a..9e0437c 100644 --- a/src/gui/dialogs/qdialog.cpp +++ b/src/gui/dialogs/qdialog.cpp @@ -67,12 +67,12 @@ extern bool qt_wince_is_smartphone(); //is defined in qguifunctions_wce.cpp #elif defined(Q_OS_SYMBIAN) # include "qfiledialog.h" # include "qfontdialog.h" -# include "qcolordialog.h" # include "qwizard.h" +# include "private/qt_s60_p.h" #endif #if defined(Q_WS_S60) -#include "private/qt_s60_p.h" +#include <AknUtils.h> // AknLayoutUtils #endif #ifndef SPI_GETSNAPTODEFBUTTON @@ -393,7 +393,7 @@ void QDialogPrivate::resetModalitySetByOpen() resetModalityTo = -1; } -#if defined(Q_WS_WINCE) || defined(Q_WS_S60) +#if defined(Q_WS_WINCE) || defined(Q_OS_SYMBIAN) #ifdef Q_WS_WINCE_WM void QDialogPrivate::_q_doneAction() { @@ -413,7 +413,7 @@ bool QDialog::event(QEvent *e) accept(); result = true; } -#else +#elif defined(Q_WS_S60) if ((e->type() == QEvent::StyleChange) || (e->type() == QEvent::Resize )) { if (!testAttribute(Qt::WA_Moved)) { Qt::WindowStates state = windowState(); @@ -423,6 +423,7 @@ bool QDialog::event(QEvent *e) setWindowState(state); } } + // TODO is Symbian, non-S60 behaviour required? #endif return result; } @@ -527,14 +528,19 @@ int QDialog::exec() #endif //QT_NO_MENUBAR #endif //Q_WS_WINCE_WM + bool showSystemDialogFullScreen = false; #ifdef Q_OS_SYMBIAN if (qobject_cast<QFileDialog *>(this) || qobject_cast<QFontDialog *>(this) || - qobject_cast<QColorDialog *>(this) || qobject_cast<QWizard *>(this)) - showMaximized(); - else + qobject_cast<QWizard *>(this)) { + showSystemDialogFullScreen = true; + } #endif // Q_OS_SYMBIAN - show(); + if (showSystemDialogFullScreen) { + setWindowFlags(windowFlags() | Qt::WindowSoftkeysVisibleHint); + setWindowState(Qt::WindowFullScreen); + } + show(); #ifdef Q_WS_MAC d->mac_nativeDialogModalHelp(); @@ -818,8 +824,8 @@ void QDialog::adjustPosition(QWidget* w) return; #endif -#ifdef Q_WS_S60 - if (s60AdjustedPosition()) +#ifdef Q_OS_SYMBIAN + if (symbianAdjustedPosition()) //dialog has already been positioned return; #endif @@ -887,13 +893,12 @@ void QDialog::adjustPosition(QWidget* w) move(p); } -#if defined(Q_WS_S60) +#if defined(Q_OS_SYMBIAN) /*! \internal */ -bool QDialog::s60AdjustedPosition() +bool QDialog::symbianAdjustedPosition() { +#if defined(Q_WS_S60) QPoint p; - const QSize mainAreaSize = QApplication::desktop()->availableGeometry(QCursor::pos()).size(); - const int statusPaneHeight = (S60->screenHeightInPixels - mainAreaSize.height())>>1; const bool doS60Positioning = !(isFullScreen()||isMaximized()); if (doS60Positioning) { // naive way to deduce screen orientation @@ -937,6 +942,10 @@ bool QDialog::s60AdjustedPosition() move(p); } return doS60Positioning; +#else + // TODO - check positioning requirement for Symbian, non-s60 + return false; +#endif } #endif diff --git a/src/gui/dialogs/qdialog.h b/src/gui/dialogs/qdialog.h index 777256a..b2ba93c 100644 --- a/src/gui/dialogs/qdialog.h +++ b/src/gui/dialogs/qdialog.h @@ -107,7 +107,7 @@ public Q_SLOTS: protected: QDialog(QDialogPrivate &, QWidget *parent, Qt::WindowFlags f = 0); -#if defined(Q_WS_WINCE) || defined(Q_WS_S60) +#if defined(Q_WS_WINCE) || defined(Q_OS_SYMBIAN) bool event(QEvent *e); #endif void keyPressEvent(QKeyEvent *); @@ -123,8 +123,8 @@ private: Q_DECLARE_PRIVATE(QDialog) Q_DISABLE_COPY(QDialog) -#if defined(Q_WS_S60) - bool s60AdjustedPosition(); +#if defined(Q_OS_SYMBIAN) + bool symbianAdjustedPosition(); #endif diff --git a/src/gui/dialogs/qprogressdialog.cpp b/src/gui/dialogs/qprogressdialog.cpp index a2d7b23..d64c847 100644 --- a/src/gui/dialogs/qprogressdialog.cpp +++ b/src/gui/dialogs/qprogressdialog.cpp @@ -153,6 +153,13 @@ void QProgressDialogPrivate::layout() const bool centered = bool(q->style()->styleHint(QStyle::SH_ProgressDialog_CenterCancelButton, 0, q)); + int additionalSpacing = 0; +#ifdef Q_OS_SYMBIAN + //In Symbian, we need to have wider margins for dialog borders, as the actual border is some pixels + //inside the dialog area (to enable transparent borders) + additionalSpacing = mlr; +#endif + QSize cs = cancel ? cancel->sizeHint() : QSize(0,0); QSize bh = bar->sizeHint(); int cspc; @@ -185,8 +192,8 @@ void QProgressDialogPrivate::layout() } if (label) - label->setGeometry(mlr, 0, q->width()-mlr*2, lh); - bar->setGeometry(mlr, lh+sp, q->width()-mlr*2, bh.height()); + label->setGeometry(mlr, additionalSpacing, q->width() - mlr * 2, lh); + bar->setGeometry(mlr, lh + sp + additionalSpacing, q->width() - mlr * 2, bh.height()); } void QProgressDialogPrivate::retranslateStrings() diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 7f1cb78..dede9d0 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -72,7 +72,7 @@ symbian { 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.dll + partial_upgrade.sources = $$QMAKE_LIBDIR_QT/QtGui$${QT_LIBINFIX}.dll partial_upgrade.path = c:/sys/bin DEPLOYMENT = partial_upgrade $$DEPLOYMENT } diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri index f5f1bc0..9f0c87e 100644 --- a/src/gui/image/image.pri +++ b/src/gui/image/image.pri @@ -28,8 +28,7 @@ HEADERS += \ image/qpixmapdata_p.h \ image/qpixmapdatafactory_p.h \ image/qpixmapfilter_p.h \ - image/qimagepixmapcleanuphooks_p.h \ - + image/qimagepixmapcleanuphooks_p.h SOURCES += \ image/qbitmap.cpp \ @@ -52,24 +51,23 @@ SOURCES += \ image/qmovie.cpp \ image/qpixmap_raster.cpp \ image/qnativeimage.cpp \ - image/qimagepixmapcleanuphooks.cpp \ - + image/qimagepixmapcleanuphooks.cpp win32 { SOURCES += image/qpixmap_win.cpp } -embedded { +else:embedded { SOURCES += image/qpixmap_qws.cpp } -x11 { +else:x11 { HEADERS += image/qpixmap_x11_p.h SOURCES += image/qpixmap_x11.cpp } -mac { +else:mac { HEADERS += image/qpixmap_mac_p.h SOURCES += image/qpixmap_mac.cpp } -symbian { +else:symbian { HEADERS += image/qpixmap_s60_p.h SOURCES += image/qpixmap_s60.cpp } @@ -87,42 +85,10 @@ SOURCES += \ image/qxbmhandler.cpp \ image/qxpmhandler.cpp -# 3rd party / system PNG support -!contains(QT_CONFIG, no-png) { - HEADERS += image/qpnghandler_p.h - SOURCES += image/qpnghandler.cpp +!contains(QT_CONFIG, no-png):include($$PWD/qpnghandler.pri) +else:DEFINES *= QT_NO_IMAGEFORMAT_PNG - contains(QT_CONFIG, system-png) { - unix|win32-g++*:LIBS_PRIVATE += -lpng - win32:!win32-g++*:LIBS += libpng.lib - } else { - DEFINES *= QT_USE_BUNDLED_LIBPNG - !isEqual(QT_ARCH, i386):!isEqual(QT_ARCH, x86_64):DEFINES += PNG_NO_ASSEMBLER_CODE - INCLUDEPATH += ../3rdparty/libpng - SOURCES += ../3rdparty/libpng/png.c \ - ../3rdparty/libpng/pngerror.c \ - ../3rdparty/libpng/pngget.c \ - ../3rdparty/libpng/pngmem.c \ - ../3rdparty/libpng/pngpread.c \ - ../3rdparty/libpng/pngread.c \ - ../3rdparty/libpng/pngrio.c \ - ../3rdparty/libpng/pngrtran.c \ - ../3rdparty/libpng/pngrutil.c \ - ../3rdparty/libpng/pngset.c \ - ../3rdparty/libpng/pngtrans.c \ - ../3rdparty/libpng/pngwio.c \ - ../3rdparty/libpng/pngwrite.c \ - ../3rdparty/libpng/pngwtran.c \ - ../3rdparty/libpng/pngwutil.c - - contains(QT_CONFIG, system-zlib) { - symbian:LIBS_PRIVATE += -llibz - else:if(unix|win32-g++*):LIBS_PRIVATE += -lz - else:LIBS += zdll.lib - } else { - INCLUDEPATH += ../3rdparty/zlib - } - } -} else { - DEFINES *= QT_NO_IMAGEFORMAT_PNG -} +contains(QT_CONFIG, jpeg):include($$PWD/qjpeghandler.pri) +contains(QT_CONFIG, mng):include($$PWD/qmnghandler.pri) +contains(QT_CONFIG, tiff):include($$PWD/qtiffhandler.pri) +contains(QT_CONFIG, gif):include($$PWD/qgifhandler.pri) diff --git a/src/plugins/imageformats/gif/qgifhandler.cpp b/src/gui/image/qgifhandler.cpp index 129a11b..124d27b 100644 --- a/src/plugins/imageformats/gif/qgifhandler.cpp +++ b/src/gui/image/qgifhandler.cpp @@ -44,7 +44,7 @@ ** ****************************************************************************/ -#include "qgifhandler.h" +#include "qgifhandler_p.h" #include <qimage.h> #include <qiodevice.h> diff --git a/src/gui/image/qgifhandler.pri b/src/gui/image/qgifhandler.pri new file mode 100644 index 0000000..6eb0751 --- /dev/null +++ b/src/gui/image/qgifhandler.pri @@ -0,0 +1,4 @@ +# common to plugin and built-in forms +INCLUDEPATH *= $$PWD +HEADERS += $$PWD/qgifhandler_p.h +SOURCES += $$PWD/qgifhandler.cpp diff --git a/src/plugins/imageformats/gif/qgifhandler.h b/src/gui/image/qgifhandler_p.h index 8e07aff..b2a9725 100644 --- a/src/plugins/imageformats/gif/qgifhandler.h +++ b/src/gui/image/qgifhandler_p.h @@ -44,8 +44,8 @@ ** ****************************************************************************/ -#ifndef QGIFHANDLER_H -#define QGIFHANDLER_H +#ifndef QGIFHANDLER_P_H +#define QGIFHANDLER_P_H #include <QtGui/qimageiohandler.h> #include <QtGui/qimage.h> @@ -93,4 +93,4 @@ private: QT_END_NAMESPACE -#endif // QGIFHANDLER_H +#endif // QGIFHANDLER_P_H diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp index af43e90..ec56af2 100644 --- a/src/gui/image/qimagereader.cpp +++ b/src/gui/image/qimagereader.cpp @@ -141,6 +141,18 @@ #ifndef QT_NO_IMAGEFORMAT_PNG #include <private/qpnghandler_p.h> #endif +#ifndef QT_NO_IMAGEFORMAT_JPEG +#include <private/qjpeghandler_p.h> +#endif +#ifndef QT_NO_IMAGEFORMAT_MNG +#include <private/qmnghandler_p.h> +#endif +#ifndef QT_NO_IMAGEFORMAT_TIFF +#include <private/qtiffhandler_p.h> +#endif +#ifdef QT_BUILTIN_GIF_READER +#include <private/qgifhandler_p.h> +#endif QT_BEGIN_NAMESPACE @@ -153,6 +165,18 @@ enum _qt_BuiltInFormatType { #ifndef QT_NO_IMAGEFORMAT_PNG _qt_PngFormat, #endif +#ifndef QT_NO_IMAGEFORMAT_JPEG + _qt_JpgFormat, +#endif +#ifndef QT_NO_IMAGEFORMAT_MNG + _qt_MngFormat, +#endif +#ifndef QT_NO_IMAGEFORMAT_TIFF + _qt_TifFormat, +#endif +#ifdef QT_BUILTIN_GIF_READER + _qt_GifFormat, +#endif _qt_BmpFormat, #ifndef QT_NO_IMAGEFORMAT_PPM _qt_PpmFormat, @@ -179,6 +203,18 @@ static const _qt_BuiltInFormatStruct _qt_BuiltInFormats[] = { #ifndef QT_NO_IMAGEFORMAT_PNG {_qt_PngFormat, "png"}, #endif +#ifndef QT_NO_IMAGEFORMAT_JPEG + {_qt_JpgFormat, "jpg"}, +#endif +#ifndef QT_NO_IMAGEFORMAT_MNG + {_qt_MngFormat, "mng"}, +#endif +#ifndef QT_NO_IMAGEFORMAT_TIFF + {_qt_TifFormat, "tif"}, +#endif +#ifdef QT_BUILTIN_GIF_READER + {_qt_GifFormat, "gif"}, +#endif {_qt_BmpFormat, "bmp"}, #ifndef QT_NO_IMAGEFORMAT_PPM {_qt_PpmFormat, "ppm"}, @@ -304,6 +340,22 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, } else if (testFormat == "png") { handler = new QPngHandler; #endif +#ifndef QT_NO_IMAGEFORMAT_JPEG + } else if (testFormat == "jpg" || testFormat == "jpeg") { + handler = new QJpegHandler; +#endif +#ifndef QT_NO_IMAGEFORMAT_MNG + } else if (testFormat == "mng") { + handler = new QMngHandler; +#endif +#ifndef QT_NO_IMAGEFORMAT_TIFF + } else if (testFormat == "tif" || testFormat == "tiff") { + handler = new QTiffHandler; +#endif +#ifdef QT_BUILTIN_GIF_READER + } else if (testFormat == "gif") { + handler = new QGifHandler; +#endif #ifndef QT_NO_IMAGEFORMAT_BMP } else if (testFormat == "bmp") { handler = new QBmpHandler; @@ -380,6 +432,30 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, handler = new QPngHandler; break; #endif +#ifndef QT_NO_IMAGEFORMAT_JPEG + case _qt_JpgFormat: + if (QJpegHandler::canRead(device)) + handler = new QJpegHandler; + break; +#endif +#ifndef QT_NO_IMAGEFORMAT_MNG + case _qt_MngFormat: + if (QMngHandler::canRead(device)) + handler = new QMngHandler; + break; +#endif +#ifndef QT_NO_IMAGEFORMAT_TIFF + case _qt_TifFormat: + if (QTiffHandler::canRead(device)) + handler = new QTiffHandler; + break; +#endif +#ifdef QT_BUILTIN_GIF_READER + case _qt_GifFormat: + if (QGifHandler::canRead(device)) + handler = new QGifHandler; + break; +#endif #ifndef QT_NO_IMAGEFORMAT_BMP case _qt_BmpFormat: if (QBmpHandler::canRead(device)) diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp index 552729f..b995914 100644 --- a/src/gui/image/qimagewriter.cpp +++ b/src/gui/image/qimagewriter.cpp @@ -114,6 +114,18 @@ #ifndef QT_NO_IMAGEFORMAT_PNG #include <private/qpnghandler_p.h> #endif +#ifndef QT_NO_IMAGEFORMAT_JPEG +#include <private/qjpeghandler_p.h> +#endif +#ifndef QT_NO_IMAGEFORMAT_MNG +#include <private/qmnghandler_p.h> +#endif +#ifndef QT_NO_IMAGEFORMAT_TIFF +#include <private/qtiffhandler_p.h> +#endif +#ifdef QT_BUILTIN_GIF_READER +#include <private/qgifhandler_p.h> +#endif QT_BEGIN_NAMESPACE @@ -170,6 +182,22 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device, } else if (testFormat == "png") { handler = new QPngHandler; #endif +#ifndef QT_NO_IMAGEFORMAT_JPEG + } else if (testFormat == "jpg" || testFormat == "jpeg") { + handler = new QJpegHandler; +#endif +#ifndef QT_NO_IMAGEFORMAT_MNG + } else if (testFormat == "mng") { + handler = new QMngHandler; +#endif +#ifndef QT_NO_IMAGEFORMAT_TIFF + } else if (testFormat == "tif" || testFormat == "tiff") { + handler = new QTiffHandler; +#endif +#ifdef QT_BUILTIN_GIF_READER + } else if (testFormat == "gif") { + handler = new QGifHandler; +#endif #ifndef QT_NO_IMAGEFORMAT_BMP } else if (testFormat == "bmp") { handler = new QBmpHandler; @@ -669,6 +697,18 @@ QList<QByteArray> QImageWriter::supportedImageFormats() #ifndef QT_NO_IMAGEFORMAT_PNG formats << "png"; #endif +#ifndef QT_NO_IMAGEFORMAT_JPEG + formats << "jpg" << "jpeg"; +#endif +#ifndef QT_NO_IMAGEFORMAT_MNG + formats << "mng"; +#endif +#ifndef QT_NO_IMAGEFORMAT_TIFF + formats << "tif" << "tiff"; +#endif +#ifdef QT_BUILTIN_GIF_READER + formats << "gif"; +#endif #ifndef QT_NO_LIBRARY QFactoryLoader *l = loader(); diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.cpp b/src/gui/image/qjpeghandler.cpp index 60e7cce..972dd65 100644 --- a/src/plugins/imageformats/jpeg/qjpeghandler.cpp +++ b/src/gui/image/qjpeghandler.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qjpeghandler.h" +#include "qjpeghandler_p.h" #include <qimage.h> #include <qvariant.h> diff --git a/src/gui/image/qjpeghandler.pri b/src/gui/image/qjpeghandler.pri new file mode 100644 index 0000000..3cb35c9 --- /dev/null +++ b/src/gui/image/qjpeghandler.pri @@ -0,0 +1,10 @@ +# common to plugin and built-in forms +INCLUDEPATH *= $$PWD +HEADERS += $$PWD/qjpeghandler_p.h +SOURCES += $$PWD/qjpeghandler.cpp +contains(QT_CONFIG, system-jpeg) { + if(unix|win32-g++*): LIBS += -ljpeg + else:win32: LIBS += libjpeg.lib +} else { + include($$PWD/../../3rdparty/libjpeg.pri) +} diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.h b/src/gui/image/qjpeghandler_p.h index c879f21..5320a5e 100644 --- a/src/plugins/imageformats/jpeg/qjpeghandler.h +++ b/src/gui/image/qjpeghandler_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QJPEGHANDLER_H -#define QJPEGHANDLER_H +#ifndef QJPEGHANDLER_P_H +#define QJPEGHANDLER_P_H #include <QtGui/qimageiohandler.h> #include <QtCore/QSize> @@ -73,4 +73,4 @@ private: QT_END_NAMESPACE -#endif // QJPEGHANDLER_H +#endif // QJPEGHANDLER_P_H diff --git a/src/plugins/imageformats/mng/qmnghandler.cpp b/src/gui/image/qmnghandler.cpp index ec442a1..cf53af0 100644 --- a/src/plugins/imageformats/mng/qmnghandler.cpp +++ b/src/gui/image/qmnghandler.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qmnghandler.h" +#include "qmnghandler_p.h" #include "qimage.h" #include "qvariant.h" diff --git a/src/gui/image/qmnghandler.pri b/src/gui/image/qmnghandler.pri new file mode 100644 index 0000000..ffb98de --- /dev/null +++ b/src/gui/image/qmnghandler.pri @@ -0,0 +1,10 @@ +# common to plugin and built-in forms +INCLUDEPATH *= $$PWD +HEADERS += $$PWD/qmnghandler_p.h +SOURCES += $$PWD/qmnghandler.cpp +contains(QT_CONFIG, system-mng) { + if(unix|win32-g++*):LIBS += -lmng + else:win32: LIBS += libmng.lib +} else { + include($$PWD/../../3rdparty/libmng.pri) +} diff --git a/src/plugins/imageformats/mng/qmnghandler.h b/src/gui/image/qmnghandler_p.h index 65243be..c39d0a6 100644 --- a/src/plugins/imageformats/mng/qmnghandler.h +++ b/src/gui/image/qmnghandler_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QMNGHANDLER_H -#define QMNGHANDLER_H +#ifndef QMNGHANDLER_P_H +#define QMNGHANDLER_P_H #include <QtCore/qscopedpointer.h> #include <QtGui/qimageiohandler.h> @@ -80,4 +80,4 @@ class QMngHandler : public QImageIOHandler QT_END_NAMESPACE -#endif // QMNGHANDLER_H +#endif // QMNGHANDLER_P_H diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp index 20a1dce..48d2de3 100644 --- a/src/gui/image/qpicture.cpp +++ b/src/gui/image/qpicture.cpp @@ -440,6 +440,36 @@ bool QPicture::play(QPainter *painter) return true; // no end-command } + +// +// QFakeDevice is used to create fonts with a custom DPI +// +class QFakeDevice : public QPaintDevice +{ +public: + QFakeDevice() { dpi_x = qt_defaultDpiX(); dpi_y = qt_defaultDpiY(); } + void setDpiX(int dpi) { dpi_x = dpi; } + void setDpiY(int dpi) { dpi_y = dpi; } + QPaintEngine *paintEngine() const { return 0; } + int metric(PaintDeviceMetric m) const + { + switch(m) { + case PdmPhysicalDpiX: + case PdmDpiX: + return dpi_x; + case PdmPhysicalDpiY: + case PdmDpiY: + return dpi_y; + default: + return QPaintDevice::metric(m); + } + } + +private: + int dpi_x; + int dpi_y; +}; + /*! \internal Iterates over the internal picture data and draws the picture using @@ -649,16 +679,13 @@ bool QPicture::exec(QPainter *painter, QDataStream &s, int nrecords) if (d->formatMajor >= 9) { s >> dbl; - QFont fnt(font, painter->device()); - - // Fonts that specify a pixel size should not be scaled - QPicture already - // have a matrix set to compensate for the DPI differences between the - // default Qt DPI and the actual target device DPI, and we have to take that - // into consideration in the case where the font has a pixel size set. - - qreal scale = fnt.pointSize() == -1 ? 1 : painter->device()->logicalDpiY() / (dbl*qt_defaultDpiY()); - painter->save(); - painter->scale(1/scale, 1/scale); + QFont fnt(font); + if (dbl != 1.0) { + QFakeDevice fake; + fake.setDpiX(qRound(dbl*qt_defaultDpiX())); + fake.setDpiY(qRound(dbl*qt_defaultDpiY())); + fnt = QFont(font, &fake); + } qreal justificationWidth; s >> justificationWidth; @@ -667,16 +694,15 @@ bool QPicture::exec(QPainter *painter, QDataStream &s, int nrecords) QSizeF size(1, 1); if (justificationWidth > 0) { - size.setWidth(justificationWidth*scale); + size.setWidth(justificationWidth); flags |= Qt::TextJustificationForced; flags |= Qt::AlignJustify; } QFontMetrics fm(fnt); - QPointF pt(p.x()*scale, p.y()*scale - fm.ascent()); + QPointF pt(p.x(), p.y() - fm.ascent()); qt_format_text(fnt, QRectF(pt, size), flags, /*opt*/0, str, /*brect=*/0, /*tabstops=*/0, /*...*/0, /*tabarraylen=*/0, painter); - painter->restore(); } else { qt_format_text(font, QRectF(p, QSizeF(1, 1)), Qt::TextSingleLine | Qt::TextDontClip, /*opt*/0, str, /*brect=*/0, /*tabstops=*/0, /*...*/0, /*tabarraylen=*/0, painter); diff --git a/src/gui/image/qpixmapdatafactory.cpp b/src/gui/image/qpixmapdatafactory.cpp index 8014660..7498a7c 100644 --- a/src/gui/image/qpixmapdatafactory.cpp +++ b/src/gui/image/qpixmapdatafactory.cpp @@ -53,7 +53,7 @@ #ifdef Q_WS_MAC # include <private/qpixmap_mac_p.h> #endif -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN # include <private/qpixmap_s60_p.h> #endif @@ -82,7 +82,7 @@ QPixmapData* QSimplePixmapDataFactory::create(QPixmapData::PixelType type) return new QRasterPixmapData(type); #elif defined(Q_WS_MAC) return new QMacPixmapData(type); -#elif defined(Q_WS_S60) +#elif defined(Q_OS_SYMBIAN) return new QS60PixmapData(type); #else #error QSimplePixmapDataFactory::create() not implemented diff --git a/src/gui/image/qpnghandler.pri b/src/gui/image/qpnghandler.pri new file mode 100644 index 0000000..bedf23f --- /dev/null +++ b/src/gui/image/qpnghandler.pri @@ -0,0 +1,10 @@ +INCLUDEPATH *= $$PWD +HEADERS += $$PWD/qpnghandler_p.h +SOURCES += $$PWD/qpnghandler.cpp +contains(QT_CONFIG, system-png) { + if(unix|win32-g++*): LIBS_PRIVATE += -lpng + else:win32: LIBS += libpng.lib + +} else { + include($$PWD/../../3rdparty/libpng.pri) +} diff --git a/src/plugins/imageformats/tiff/qtiffhandler.cpp b/src/gui/image/qtiffhandler.cpp index 619aa4e..de4f680 100644 --- a/src/plugins/imageformats/tiff/qtiffhandler.cpp +++ b/src/gui/image/qtiffhandler.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qtiffhandler.h" +#include "qtiffhandler_p.h" #include <qvariant.h> #include <qdebug.h> #include <qimage.h> diff --git a/src/gui/image/qtiffhandler.pri b/src/gui/image/qtiffhandler.pri new file mode 100644 index 0000000..e1cc3ee --- /dev/null +++ b/src/gui/image/qtiffhandler.pri @@ -0,0 +1,10 @@ +# common to plugin and built-in forms +INCLUDEPATH *= $$PWD +HEADERS += $$PWD/qtiffhandler_p.h +SOURCES += $$PWD/qtiffhandler.cpp +contains(QT_CONFIG, system-tiff) { + if(unix|win32-g++*):LIBS += -ltiff + else:win32: LIBS += libtiff.lib +} else { + include($$PWD/../../3rdparty/libtiff.pri) +} diff --git a/src/plugins/imageformats/tiff/qtiffhandler.h b/src/gui/image/qtiffhandler_p.h index 4534ed5..da7d7ed 100644 --- a/src/plugins/imageformats/tiff/qtiffhandler.h +++ b/src/gui/image/qtiffhandler_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QTIFFHANDLER_H -#define QTIFFHANDLER_H +#ifndef QTIFFHANDLER_P_H +#define QTIFFHANDLER_P_H #include <QtGui/qimageiohandler.h> @@ -75,4 +75,4 @@ private: QT_END_NAMESPACE -#endif // QTIFFHANDLER_H +#endif // QTIFFHANDLER_P_H diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 6fd45ad..f9c84c1 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -120,18 +120,21 @@ symbian { kernel/qkeymapper_s60.cpp\ kernel/qclipboard_s60.cpp\ kernel/qdnd_s60.cpp \ - kernel/qsound_s60.cpp \ - kernel/qsoftkeymanager_s60.cpp + kernel/qsound_s60.cpp HEADERS += \ kernel/qt_s60_p.h \ - kernel/qeventdispatcher_s60_p.h \ - kernel/qsoftkeymanager_s60_p.h + kernel/qeventdispatcher_s60_p.h LIBS += -lbafl -lestor INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE INCLUDEPATH += ../3rdparty/s60 + + contains(QT_CONFIG, s60) { + SOURCES += kernel/qsoftkeymanager_s60.cpp + HEADERS += kernel/qsoftkeymanager_s60_p.h + } } diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 1680ef4..ccfe88c 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -81,7 +81,7 @@ #include <private/qt_x11_p.h> #endif -#if defined(Q_WS_X11) || defined(Q_WS_S60) +#if defined(Q_WS_X11) || defined(Q_OS_SYMBIAN) #include "qinputcontextfactory.h" #endif @@ -2771,7 +2771,7 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) { qt_win_set_cursor(cursorWidget, true); #elif defined(Q_WS_X11) qt_x11_enforce_cursor(cursorWidget, true); -#elif defined(Q_WS_S60) +#elif defined(Q_OS_SYMBIAN) qt_symbian_set_cursor(cursorWidget, true); #endif } diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h index cb1d063..d31d9e5 100644 --- a/src/gui/kernel/qapplication.h +++ b/src/gui/kernel/qapplication.h @@ -61,7 +61,7 @@ QT_BEGIN_HEADER -#if defined(Q_WS_S60) +#if defined(Q_OS_SYMBIAN) class CApaApplication; #endif @@ -118,7 +118,7 @@ class Q_GUI_EXPORT QApplication : public QCoreApplication public: enum Type { Tty, GuiClient, GuiServer }; -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN typedef CApaApplication * (*QS60MainApplicationFactory)(); #endif @@ -130,7 +130,7 @@ public: QApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0, int = QT_VERSION); QApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap= 0, int = QT_VERSION); #endif -#if defined(Q_WS_S60) +#if defined(Q_OS_SYMBIAN) QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv, int = QT_VERSION); #endif #endif @@ -366,7 +366,7 @@ public: QApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0); QApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap= 0); #endif -#if defined(Q_WS_S60) || defined(qdoc) +#if defined(Q_OS_SYMBIAN) || defined(qdoc) QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv); #endif #endif diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index a7c7310..0d65811 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -69,14 +69,17 @@ #include "apgwgnam.h" // For CApaWindowGroupName #include <mdaaudiotoneplayer.h> // For CMdaAudioToneUtility +#if defined(Q_OS_SYMBIAN) +# include <private/qs60mainapplication_p.h> +# include <centralrepository.h> +# include "qs60mainappui.h" +# include "qinputcontext.h" +#endif + #if defined(Q_WS_S60) # if !defined(QT_NO_IM) -# include "qinputcontext.h" # include <private/qcoefepinputcontext_p.h> # endif -# include <private/qs60mainapplication_p.h> -# include <centralrepository.h> -# include "qs60mainappui.h" #endif #include "private/qstylesheetstyle_p.h" @@ -894,7 +897,7 @@ TKeyResponse QSymbianControl::sendKeyEvent(QWidget *widget, QKeyEvent *keyEvent) if (qic && qic->filterEvent(keyEvent)) return EKeyWasConsumed; } -#endif // !defined(QT_NO_IM) && defined(Q_WS_S60) +#endif // !defined(QT_NO_IM) && defined(Q_OS_SYMBIAN) if (widget && qt_sendSpontaneousEvent(widget, keyEvent)) if (keyEvent->isAccepted()) @@ -1974,10 +1977,10 @@ int QApplicationPrivate::symbianHandleCommand(const QSymbianEvent *symbianEvent) ret = 1; break; default: +#ifdef Q_WS_S60 bool handled = QSoftKeyManager::handleCommand(command); if (handled) ret = 1; -#ifdef Q_WS_S60 else ret = QMenuBarPrivate::symbianCommands(command); #endif diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 204e38c..d8ef67d 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -155,7 +155,9 @@ public: static inline CAknTitlePane* titlePane(); static inline CAknContextPane* contextPane(); static inline CEikButtonGroupContainer* buttonGroupContainer(); +#endif +#ifdef Q_OS_SYMBIAN TTrapHandler *s60InstalledTrapHandler; #endif }; @@ -208,7 +210,7 @@ protected: // from MAknFadedComponent TInt CountFadedComponents() {return 1;} CCoeControl* FadedComponent(TInt /*aIndex*/) {return this;} #else - #warning No fallback implementation for QSymbianControl::FadeBehindPopup + // #warning No fallback implementation for QSymbianControl::FadeBehindPopup void FadeBehindPopup(bool /*fade*/){ } #endif @@ -277,9 +279,9 @@ inline QS60Data::QS60Data() avkonComponentsSupportTransparency(0), menuBeingConstructed(0), memoryLimitForHwRendering(0), - s60ApplicationFactory(0), -#ifdef Q_WS_S60 - s60InstalledTrapHandler(0) + s60ApplicationFactory(0) +#ifdef Q_OS_SYMBIAN + ,s60InstalledTrapHandler(0) #endif { } diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index dd568cd..233df15 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -10695,7 +10695,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) break; case Qt::WA_AcceptTouchEvents: -#if defined(Q_WS_WIN) || defined(Q_WS_MAC) || defined(Q_WS_S60) +#if defined(Q_WS_WIN) || defined(Q_WS_MAC) || defined(Q_OS_SYMBIAN) if (on) d->registerTouchWindow(); #endif diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 3f351d9..2818d88 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -54,6 +54,7 @@ #ifdef Q_WS_S60 #include <aknappui.h> +#include <eikbtgpc.h> #endif // This is necessary in order to be able to perform delayed invokation on slots @@ -1082,12 +1083,14 @@ void QWidget::setWindowState(Qt::WindowStates newstate) Qt::WindowStates oldstate = windowState(); const TBool isFullscreen = newstate & Qt::WindowFullScreen; +#ifdef Q_WS_S60 const TBool cbaRequested = windowFlags() & Qt::WindowSoftkeysVisibleHint; const TBool cbaVisible = CEikButtonGroupContainer::Current() ? true : false; const TBool softkeyVisibilityChange = isFullscreen && (cbaRequested != cbaVisible); if (oldstate == newstate && !softkeyVisibilityChange) return; +#endif // Q_WS_S60 if (isWindow()) { createWinId(); diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index a5cfb84..07aabc9 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -402,11 +402,4 @@ neon:*-g++* { QMAKE_EXTRA_COMPILERS += neon_compiler } -contains(QT_CONFIG, zlib) { - INCLUDEPATH += ../3rdparty/zlib -} else:!contains(QT_CONFIG, no-zlib) { - symbian:LIBS_PRIVATE += -llibz - else:if(unix|win32-g++*):LIBS_PRIVATE += -lz - else:LIBS += zdll.lib -} - +include($$PWD/../../3rdparty/zlib_dependency.pri) diff --git a/src/gui/painting/qgraphicssystem.cpp b/src/gui/painting/qgraphicssystem.cpp index 69ce47e..f06e309 100644 --- a/src/gui/painting/qgraphicssystem.cpp +++ b/src/gui/painting/qgraphicssystem.cpp @@ -50,7 +50,7 @@ #ifdef Q_WS_MAC # include <private/qpixmap_mac_p.h> #endif -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN # include <private/qpixmap_s60_p.h> #endif @@ -71,7 +71,7 @@ QPixmapData *QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixelType typ return new QRasterPixmapData(type); #elif defined(Q_WS_MAC) return new QMacPixmapData(type); -#elif defined(Q_WS_S60) +#elif defined(Q_OS_SYMBIAN) return new QS60PixmapData(type); #elif !defined(Q_WS_QWS) #error QGraphicsSystem::createDefaultPixmapData() not implemented diff --git a/src/gui/painting/qgraphicssystem_runtime.cpp b/src/gui/painting/qgraphicssystem_runtime.cpp index 1c3ae10..3438137 100644 --- a/src/gui/painting/qgraphicssystem_runtime.cpp +++ b/src/gui/painting/qgraphicssystem_runtime.cpp @@ -418,7 +418,7 @@ void QRuntimeGraphicsSystem::setGraphicsSystem(const QString &name) QRuntimePixmapData *proxy = m_pixmapDatas.at(i); QPixmapData *newData = m_graphicsSystem->createPixmapData(proxy->m_data); // ### TODO Optimize. Openvg and s60raster graphics systems could switch internal ARGB32_PRE QImage buffers. - newData->fromImage(proxy->m_data->toImage(), Qt::AutoColor | Qt::OrderedAlphaDither); + newData->fromImage(proxy->m_data->toImage(), Qt::NoOpaqueDetection); delete proxy->m_data; proxy->m_data = newData; proxy->readBackInfo(); diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 2ea6673..9dadbd5 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -8969,6 +8969,15 @@ void QPainter::drawPixmapFragments(const PixmapFragment *fragments, int fragment if (!d->engine) return; +#ifndef QT_NO_DEBUG + for (int i = 0; i < fragmentCount; ++i) { + QRectF sourceRect(fragments[i].sourceLeft, fragments[i].sourceTop, + fragments[i].width, fragments[i].height); + if (!(QRectF(pixmap.rect()).contains(sourceRect))) + qWarning("QPainter::drawPixmapFragments - the source rect is not contained by the pixmap's rectangle"); + } +#endif + if (d->engine->isExtended()) { d->extended->drawPixmapFragments(fragments, fragmentCount, pixmap, hints); } else { diff --git a/src/gui/s60framework/qs60mainapplication.cpp b/src/gui/s60framework/qs60mainapplication.cpp index 41ac1a8..0f9367e 100644 --- a/src/gui/s60framework/qs60mainapplication.cpp +++ b/src/gui/s60framework/qs60mainapplication.cpp @@ -71,17 +71,17 @@ _LIT(KQtWrapperResourceFile, "\\resource\\apps\\s60main" QT_LIBINFIX_UNICODE L". The QS60MainApplication provides a helper class for use in migrating from existing S60 based applications to Qt based applications. It is - used in the exact same way as the \c CAknApplication class from + used in the exact same way as the \c CEikApplication class from Symbian, but internally provides extensions used by Qt. When modifying old S60 applications that rely on implementing - functions in \c CAknApplication, the class should be modified to - inherit from this class instead of \c CAknApplication. Then the + functions in \c CEikApplication, the class should be modified to + inherit from this class instead of \c CEikApplication. Then the application can choose to override only certain functions. To make Qt use the custom application objects, pass a factory function to \c{QApplication::QApplication(QApplication::QS60MainApplicationFactory, int &, char **)}. - For more information on \c CAknApplication, please see the S60 documentation. + For more information on \c CEikApplication, please see the S60 documentation. Unlike other Qt classes, QS60MainApplication behaves like an S60 class, and can throw Symbian leaves. @@ -136,4 +136,19 @@ TFileName QS60MainApplication::ResourceFileName() const return KNullDesC(); } +void QS60MainApplication::PreDocConstructL() +{ + QS60MainApplicationBase::PreDocConstructL(); +} + +CDictionaryStore *QS60MainApplication::OpenIniFileLC(RFs &aFs) const +{ + return QS60MainApplicationBase::OpenIniFileLC(aFs); +} + +void QS60MainApplication::NewAppServerL(CApaAppServer *&aAppServer) +{ + QS60MainApplicationBase::NewAppServerL(aAppServer); +} + QT_END_NAMESPACE diff --git a/src/gui/s60framework/qs60mainapplication.h b/src/gui/s60framework/qs60mainapplication.h index 997f30f..cb22e68 100644 --- a/src/gui/s60framework/qs60mainapplication.h +++ b/src/gui/s60framework/qs60mainapplication.h @@ -44,9 +44,15 @@ #include <QtCore/qglobal.h> -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN +#ifdef Q_WS_S60 #include <aknapp.h> +typedef CAknApplication QS60MainApplicationBase; +#else +#include <eikapp.h> +typedef CEikApplication QS60MainApplicationBase; +#endif QT_BEGIN_HEADER @@ -54,7 +60,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -class Q_GUI_EXPORT QS60MainApplication : public CAknApplication +class Q_GUI_EXPORT QS60MainApplication : public QS60MainApplicationBase { public: QS60MainApplication(); @@ -65,6 +71,14 @@ public: virtual TFileName ResourceFileName() const; +public: + + virtual void PreDocConstructL(); + + virtual CDictionaryStore *OpenIniFileLC(RFs &aFs) const; + + virtual void NewAppServerL(CApaAppServer *&aAppServer); + protected: virtual CApaDocument *CreateDocumentL(); @@ -74,6 +88,6 @@ QT_END_NAMESPACE QT_END_HEADER -#endif // Q_WS_S60 +#endif // Q_OS_SYMBIAN #endif // QS60MAINAPPLICATION_H diff --git a/src/gui/s60framework/qs60mainappui.cpp b/src/gui/s60framework/qs60mainappui.cpp index ce13de8..40c2d03 100644 --- a/src/gui/s60framework/qs60mainappui.cpp +++ b/src/gui/s60framework/qs60mainappui.cpp @@ -41,20 +41,25 @@ // INCLUDE FILES #include <exception> +#include <qglobal.h> +#ifdef Q_WS_S60 #include <avkon.hrh> #include <eikmenub.h> #include <eikmenup.h> +#include <avkon.rsg> +#endif #include <barsread.h> #include <qconfig.h> -#if defined(QT_LIBINFIX_UNQUOTED) +#ifdef Q_WS_S60 +# if defined(QT_LIBINFIX_UNQUOTED) // Two level macro needed for proper expansion of libinfix -# define QT_S60MAIN_RSG_2(x) <s60main##x##.rsg> -# define QT_S60MAIN_RSG(x) QT_S60MAIN_RSG_2(x) -# include QT_S60MAIN_RSG(QT_LIBINFIX_UNQUOTED) -#else -# include <s60main.rsg> +# define QT_S60MAIN_RSG_2(x) <s60main##x##.rsg> +# define QT_S60MAIN_RSG(x) QT_S60MAIN_RSG_2(x) +# include QT_S60MAIN_RSG(QT_LIBINFIX_UNQUOTED) +# else +# include <s60main.rsg> +# endif #endif -#include <avkon.rsg> #include "qs60mainappui.h" #include <QtGui/qapplication.h> @@ -115,14 +120,16 @@ void QS60MainAppUi::ConstructL() // ENoAppResourceFile and ENonStandardResourceFile makes UI to work without // resource files in most SDKs. S60 3rd FP1 public seems to require resource file // even these flags are defined - TInt flags = CAknAppUi::EAknEnableSkin - | CAknAppUi::ENoScreenFurniture - | CAknAppUi::ENonStandardResourceFile; + TInt flags = CEikAppUi::ENoScreenFurniture + | CEikAppUi::ENonStandardResourceFile; +#ifdef Q_WS_S60 + flags |= CAknAppUi::EAknEnableSkin; // After 5th Edition S60, native side supports animated wallpapers. // However, there is no support for that feature on Qt side, so indicate to // native UI framework that this application will not support background animations. if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) flags |= KAknDisableAnimationBackground; +#endif BaseConstructL(flags); } @@ -168,7 +175,7 @@ void QS60MainAppUi::HandleCommandL(TInt command) */ void QS60MainAppUi::HandleResourceChangeL(TInt type) { - CAknAppUi::HandleResourceChangeL(type); + QS60MainAppUiBase::HandleResourceChangeL(type); if (qApp) { QSymbianEvent event(QSymbianEvent::ResourceChangeEvent, type); @@ -185,7 +192,7 @@ void QS60MainAppUi::HandleResourceChangeL(TInt type) * If you override this function, you should call the base class implementation if you do not * handle the event. */ -void QS60MainAppUi::HandleWsEventL(const TWsEvent& wsEvent, CCoeControl *destination) +void QS60MainAppUi::HandleWsEventL(const TWsEvent &wsEvent, CCoeControl *destination) { int result = 0; if (qApp) { @@ -196,7 +203,7 @@ void QS60MainAppUi::HandleWsEventL(const TWsEvent& wsEvent, CCoeControl *destina } if (result <= 0) - CAknAppUi::HandleWsEventL(wsEvent, destination); + QS60MainAppUiBase::HandleWsEventL(wsEvent, destination); } @@ -236,6 +243,7 @@ void QS60MainAppUi::DynInitMenuBarL(TInt /* resourceId */, CEikMenuBar * /* menu */ void QS60MainAppUi::DynInitMenuPaneL(TInt resourceId, CEikMenuPane *menuPane) { +#ifdef Q_WS_S60 if (resourceId == R_QT_WRAPPERAPP_MENU) { if (menuPane->NumberOfItemsInPane() <= 1) QT_TRYCATCH_LEAVING(qt_symbian_show_toplevel(menuPane)); @@ -245,6 +253,9 @@ void QS60MainAppUi::DynInitMenuPaneL(TInt resourceId, CEikMenuPane *menuPane) && resourceId != R_AVKON_MENUPANE_LANGUAGE_DEFAULT) { QT_TRYCATCH_LEAVING(qt_symbian_show_submenu(menuPane, resourceId)); } +#else + QS60MainAppUiBase::DynInitMenuPaneL(resourceId, menuPane); +#endif } /*! @@ -255,16 +266,104 @@ void QS60MainAppUi::DynInitMenuPaneL(TInt resourceId, CEikMenuPane *menuPane) * * If you override this function, you should call the base class implementation as well. */ -void QS60MainAppUi::RestoreMenuL(CCoeControl* menuWindow, TInt resourceId, TMenuType menuType) +void QS60MainAppUi::RestoreMenuL(CCoeControl *menuWindow, TInt resourceId, TMenuType menuType) { +#ifdef Q_WS_S60 if (resourceId >= QT_SYMBIAN_FIRST_MENU_ITEM && resourceId <= QT_SYMBIAN_LAST_MENU_ITEM) { if (menuType == EMenuPane) DynInitMenuPaneL(resourceId, (CEikMenuPane*)menuWindow); else DynInitMenuBarL(resourceId, (CEikMenuBar*)menuWindow); - } else { - CAknAppUi::RestoreMenuL(menuWindow, resourceId, menuType); + } else +#endif + { + QS60MainAppUiBase::RestoreMenuL(menuWindow, resourceId, menuType); } } +void QS60MainAppUi::Exit() +{ + QS60MainAppUiBase::Exit(); +} + +void QS60MainAppUi::SetFadedL(TBool aFaded) +{ + QS60MainAppUiBase::SetFadedL(aFaded); +} + +TRect QS60MainAppUi::ApplicationRect() const +{ + return QS60MainAppUiBase::ApplicationRect(); +} + +void QS60MainAppUi::HandleScreenDeviceChangedL() +{ + QS60MainAppUiBase::HandleScreenDeviceChangedL(); +} + +void QS60MainAppUi::HandleApplicationSpecificEventL(TInt aType, const TWsEvent &aEvent) +{ + QS60MainAppUiBase::HandleApplicationSpecificEventL(aType, aEvent); +} + +TTypeUid::Ptr QS60MainAppUi::MopSupplyObject(TTypeUid aId) +{ + return QS60MainAppUiBase::MopSupplyObject(aId); +} + +void QS60MainAppUi::ProcessCommandL(TInt aCommand) +{ + QS60MainAppUiBase::ProcessCommandL(aCommand); +} + +TErrorHandlerResponse QS60MainAppUi::HandleError (TInt aError, const SExtendedError &aExtErr, TDes &aErrorText, TDes &aContextText) +{ + return QS60MainAppUiBase::HandleError(aError, aExtErr, aErrorText, aContextText); +} + +void QS60MainAppUi::HandleViewDeactivation(const TVwsViewId &aViewIdToBeDeactivated, const TVwsViewId &aNewlyActivatedViewId) +{ + QS60MainAppUiBase::HandleViewDeactivation(aViewIdToBeDeactivated, aNewlyActivatedViewId); +} + +void QS60MainAppUi::PrepareToExit() +{ + QS60MainAppUiBase::PrepareToExit(); +} + +void QS60MainAppUi::HandleTouchPaneSizeChange() +{ + QS60MainAppUiBase::HandleTouchPaneSizeChange(); +} + +void QS60MainAppUi::HandleSystemEventL(const TWsEvent &aEvent) +{ + QS60MainAppUiBase::HandleSystemEventL(aEvent); +} + +void QS60MainAppUi::Reserved_MtsmPosition() +{ + QS60MainAppUiBase::Reserved_MtsmPosition(); +} + +void QS60MainAppUi::Reserved_MtsmObject() +{ + QS60MainAppUiBase::Reserved_MtsmObject(); +} + +void QS60MainAppUi::HandleForegroundEventL(TBool aForeground) +{ + QS60MainAppUiBase::HandleForegroundEventL(aForeground); +} + +#ifndef Q_WS_S60 + +void QS60StubAknAppUi::HandleViewDeactivation(const TVwsViewId &, const TVwsViewId &) {} +void QS60StubAknAppUi::HandleTouchPaneSizeChange() {} +void QS60StubAknAppUi::HandleStatusPaneSizeChange() {} +void QS60StubAknAppUi::Reserved_MtsmPosition() {} +void QS60StubAknAppUi::Reserved_MtsmObject() {} + +#endif + QT_END_NAMESPACE diff --git a/src/gui/s60framework/qs60mainappui.h b/src/gui/s60framework/qs60mainappui.h index dcc72d1..796059f 100644 --- a/src/gui/s60framework/qs60mainappui.h +++ b/src/gui/s60framework/qs60mainappui.h @@ -44,9 +44,55 @@ #include <QtCore/qglobal.h> -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN +#ifdef Q_WS_S60 #include <aknappui.h> +typedef CAknAppUi QS60MainAppUiBase; +#else +#include <eikappui.h> +// these stub classes simulate the structure of CAknAppUi, to help binary compatibility between Qt configured with and without S60/Avkon +class QS60StubAknAppUiBase : public CEikAppUi +{ +private: + int qS60StubAknAppUiBaseSpace[4]; +}; + +class QS60StubMEikStatusPaneObserver +{ +public: + virtual void HandleStatusPaneSizeChange() = 0; +}; + +class QS60StubMAknTouchPaneObserver +{ +public: + virtual void HandleTouchPaneSizeChange() = 0; +}; + +class QS60StubAknAppUi : public QS60StubAknAppUiBase, QS60StubMEikStatusPaneObserver, + public MCoeViewDeactivationObserver, + public QS60StubMAknTouchPaneObserver +{ +public: // MCoeViewDeactivationObserver + virtual void HandleViewDeactivation(const TVwsViewId&, const TVwsViewId &); + +public: // from MAknTouchPaneObserver + virtual void HandleTouchPaneSizeChange(); + +protected: // from MEikStatusPaneObserver + virtual void HandleStatusPaneSizeChange(); + +protected: // from CAknAppUi + virtual void Reserved_MtsmPosition(); + virtual void Reserved_MtsmObject(); + +private: + int qS60StubAknAppUiSpace[4]; +}; + +typedef QS60StubAknAppUi QS60MainAppUiBase; +#endif QT_BEGIN_HEADER @@ -54,7 +100,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -class Q_GUI_EXPORT QS60MainAppUi : public CAknAppUi +class Q_GUI_EXPORT QS60MainAppUi : public QS60MainAppUiBase { public: QS60MainAppUi(); @@ -63,7 +109,7 @@ public: virtual void ConstructL(); - virtual void RestoreMenuL(CCoeControl* menuWindow,TInt resourceId,TMenuType menuType); + virtual void RestoreMenuL(CCoeControl *menuWindow,TInt resourceId,TMenuType menuType); virtual void DynInitMenuBarL(TInt resourceId, CEikMenuBar *menuBar); virtual void DynInitMenuPaneL(TInt resourceId, CEikMenuPane *menuPane); @@ -74,13 +120,32 @@ public: virtual void HandleStatusPaneSizeChange(); protected: - virtual void HandleWsEventL(const TWsEvent& event, CCoeControl* destination); + virtual void HandleWsEventL(const TWsEvent &event, CCoeControl *destination); + +public: + virtual void Exit(); + virtual void SetFadedL(TBool aFaded); + virtual TRect ApplicationRect() const; + virtual void ProcessCommandL(TInt aCommand); + virtual TErrorHandlerResponse HandleError (TInt aError, const SExtendedError &aExtErr, TDes &aErrorText, TDes &aContextText); + virtual void HandleViewDeactivation(const TVwsViewId &aViewIdToBeDeactivated, const TVwsViewId &aNewlyActivatedViewId); + virtual void PrepareToExit(); + virtual void HandleTouchPaneSizeChange(); + +protected: + virtual void HandleScreenDeviceChangedL(); + virtual void HandleApplicationSpecificEventL(TInt aType, const TWsEvent &aEvent); + virtual TTypeUid::Ptr MopSupplyObject(TTypeUid aId); + virtual void HandleSystemEventL(const TWsEvent &aEvent); + virtual void Reserved_MtsmPosition(); + virtual void Reserved_MtsmObject(); + virtual void HandleForegroundEventL(TBool aForeground); }; QT_END_NAMESPACE QT_END_HEADER -#endif // Q_WS_S60 +#endif // Q_OS_SYMBIAN #endif // QS60MAINAPPUI_H diff --git a/src/gui/s60framework/qs60maindocument.cpp b/src/gui/s60framework/qs60maindocument.cpp index 487e067..ed33a41 100644 --- a/src/gui/s60framework/qs60maindocument.cpp +++ b/src/gui/s60framework/qs60maindocument.cpp @@ -57,15 +57,15 @@ QT_BEGIN_NAMESPACE The QS60MainDocument provides a helper class for use in migrating from existing S60 based applications to Qt based applications. It is - used in the exact same way as the \c CAknDocument class from + used in the exact same way as the \c CEikDocument class from Symbian, but internally provides extensions used by Qt. When modifying old S60 applications that rely on implementing - functions in \c CAknDocument, the class should be modified to - inherit from this class instead of \c CAknDocument. Then the + functions in \c CEikDocument, the class should be modified to + inherit from this class instead of \c CEikDocument. Then the application can choose to override only certain functions. - For more information on \c CAknDocument, please see the S60 + For more information on \c CEikDocument, please see the S60 documentation. Unlike other Qt classes, QS60MainDocument behaves like an S60 class, @@ -79,8 +79,8 @@ QT_BEGIN_NAMESPACE * * \a mainApplication should contain a pointer to a QS60MainApplication instance. */ -QS60MainDocument::QS60MainDocument(CEikApplication& mainApplication) - : CAknDocument(mainApplication) +QS60MainDocument::QS60MainDocument(CEikApplication &mainApplication) + : QS60MainDocumentBase(mainApplication) { // No implementation required } @@ -105,4 +105,14 @@ CEikAppUi *QS60MainDocument::CreateAppUiL() return (static_cast <CEikAppUi*>(new(ELeave)QS60MainAppUi)); } +CFileStore *QS60MainDocument::OpenFileL(TBool aDoOpen, const TDesC &aFilename, RFs &aFs) +{ + return QS60MainDocumentBase::OpenFileL(aDoOpen, aFilename, aFs); +} + +void QS60MainDocument::OpenFileL(CFileStore *&aFileStore, RFile &aFile) +{ + QS60MainDocumentBase::OpenFileL(aFileStore, aFile); +} + QT_END_NAMESPACE diff --git a/src/gui/s60framework/qs60maindocument.h b/src/gui/s60framework/qs60maindocument.h index 553675f..2f0564f 100644 --- a/src/gui/s60framework/qs60maindocument.h +++ b/src/gui/s60framework/qs60maindocument.h @@ -44,9 +44,15 @@ #include <QtCore/qglobal.h> -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN -#include <AknDoc.h> +#ifdef Q_WS_S60 +#include <akndoc.h> +typedef CAknDocument QS60MainDocumentBase; +#else +#include <eikdoc.h> +typedef CEikDocument QS60MainDocumentBase; +#endif class CEikApplication; @@ -58,7 +64,7 @@ QT_MODULE(Gui) class QS60MainAppUi; -class Q_GUI_EXPORT QS60MainDocument : public CAknDocument +class Q_GUI_EXPORT QS60MainDocument : public QS60MainDocumentBase { public: @@ -69,12 +75,18 @@ public: public: virtual CEikAppUi *CreateAppUiL(); + +public: + + virtual CFileStore *OpenFileL(TBool aDoOpen, const TDesC &aFilename, RFs &aFs); + + virtual void OpenFileL(CFileStore *&aFileStore, RFile &aFile); }; QT_END_NAMESPACE QT_END_HEADER -#endif // Q_WS_S60 +#endif // Q_OS_SYMBIAN #endif // QS60MAINDOCUMENT_H diff --git a/src/gui/s60framework/s60framework.pri b/src/gui/s60framework/s60framework.pri index f9d89dc..edbacc0 100644 --- a/src/gui/s60framework/s60framework.pri +++ b/src/gui/s60framework/s60framework.pri @@ -1,16 +1,20 @@ +contains(QT_CONFIG, s60) { # This block serves the minimalistic resource file for S60 3.1 platforms. # Note there is no way to ifdef S60 version in mmp file, that is why the resource # file is always compiled for WINSCW -minimalAppResource31 = \ - "SOURCEPATH s60framework" \ - "START RESOURCE s60main.rss" \ - "TARGET s60main$${QT_LIBINFIX}" \ - "HEADER" \ - "TARGETPATH /resource/apps" \ - "END" -MMP_RULES += minimalAppResource31 -SYMBIAN_RESOURCES += s60framework/s60main.rss + minimalAppResource31 = \ + "SOURCEPATH s60framework" \ + "START RESOURCE s60main.rss" \ + "TARGET s60main$${QT_LIBINFIX}" \ + "HEADER" \ + "TARGETPATH /resource/apps" \ + "END" + + MMP_RULES += minimalAppResource31 + + SYMBIAN_RESOURCES += s60framework/s60main.rss +} SOURCES += s60framework/qs60mainapplication.cpp \ s60framework/qs60mainappui.cpp \ diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 45bcc00..e28403b 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -1765,52 +1765,31 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, QRect iconRect = subElementRect(SE_ItemViewItemDecoration, &optionMenuItem, widget); QRect textRect = subElementRect(SE_ItemViewItemText, &optionMenuItem, widget); - //todo: move the vertical spacing stuff into subElementRect - const int vSpacing = QS60StylePrivate::pixelMetric(PM_LayoutVerticalSpacing); QStyleOptionMenuItem optionCheckBox; //Regardless of checkbox visibility, make room for it, this mirrors native implementation, //where text and icon placement is static regardless of content of menu item. - const int hSpacing = QS60StylePrivate::pixelMetric(PM_LayoutHorizontalSpacing); optionCheckBox.QStyleOptionMenuItem::operator=(*menuItem); optionCheckBox.rect.setWidth(pixelMetric(PM_IndicatorWidth)); optionCheckBox.rect.setHeight(pixelMetric(PM_IndicatorHeight)); + + const int vSpacing = QS60StylePrivate::pixelMetric(PM_LayoutVerticalSpacing); + //The vertical spacing is doubled; it needs one spacing to separate checkbox from + //highlight and then it needs one to separate it whatever is shown after it (text/icon/both). + const int moveByX = optionCheckBox.rect.width() + 2 * vSpacing; optionCheckBox.rect.moveCenter(QPoint( - optionCheckBox.rect.center().x(), + optionCheckBox.rect.center().x() + moveByX >> 1, menuItem->rect.center().y())); - const int moveByX = optionCheckBox.rect.width() + vSpacing + - pixelMetric(PM_DefaultFrameWidth); - if (optionMenuItem.direction == Qt::LeftToRight) { - if (iconRect.isValid()) { - iconRect.translate(moveByX, 0); - iconRect.setWidth(iconRect.width() + vSpacing); - } - if (textRect.isValid()) { - textRect.translate(moveByX, 0); - textRect.setWidth(textRect.width() - moveByX - vSpacing); - } - optionCheckBox.rect.translate(vSpacing + pixelMetric(PM_DefaultFrameWidth), hSpacing >> 1); - } else { - if (textRect.isValid()) - textRect.setWidth(textRect.width() - moveByX); - if (iconRect.isValid()) { - iconRect.setWidth(iconRect.width() + vSpacing); - iconRect.translate(-optionCheckBox.rect.width() - vSpacing, 0); - } + + if (optionMenuItem.direction != Qt::LeftToRight) optionCheckBox.rect.translate(textRect.width() + iconRect.width(), 0); - } + const bool selected = (option->state & State_Selected) && (option->state & State_Enabled); if (selected) { - const int spacing = pixelMetric(PM_DefaultFrameWidth) * 2; - int start; int end; - if (QApplication::layoutDirection() == Qt::LeftToRight) { - start = optionMenuItem.rect.left() + spacing; - end = qMax(textRect.right(), iconRect.right() + spacing); - } else { - start = qMax(spacing, qMin(textRect.left(), iconRect.left() - spacing)); - end = optionMenuItem.rect.right() - spacing; - } + const int spacing = ignoreCheckMark ? (vSpacing + QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth)) : 0; + const int start = optionMenuItem.rect.left() + spacing; + const int end = optionMenuItem.rect.right() - spacing; //-1 adjustment to avoid highlight being on top of possible separator item const QRect highlightRect = QRect( QPoint(start, option->rect.top()), @@ -3025,20 +3004,38 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con pixelMetric(PM_SmallIconSize, opt, widget); ret = menuItem->rect; + QRect checkBoxRect = checkable ? menuItem->rect : QRect(); + if (checkable) { + checkBoxRect.setWidth(pixelMetric(PM_IndicatorWidth)); + checkBoxRect.setHeight(pixelMetric(PM_IndicatorHeight)); + } + + const int vSpacing = QS60StylePrivate::pixelMetric(PM_LayoutVerticalSpacing); + //The vertical spacing is doubled; it needs one spacing to separate checkbox from + //highlight and then it needs one to separate it whatever is shown after it (text/icon/both). + const int moveByX = checkBoxRect.width() + 2 * vSpacing; + if (element == SE_ItemViewItemDecoration) { if (menuItem->icon.isNull()) { ret = QRect(); } else { if (menuItem->direction == Qt::RightToLeft) - ret.translate(ret.width() - indicatorWidth, 0); + ret.translate(ret.width() - indicatorWidth - moveByX, 0); + else + ret.translate(moveByX, 0); ret.setWidth(indicatorWidth); } } else { - if (!menuItem->icon.isNull()) + if (!menuItem->icon.isNull()) { if (menuItem->direction == Qt::LeftToRight) ret.adjust(indicatorWidth, 0, 0, 0); else ret.adjust(0, 0, -indicatorWidth, 0); + } + if (menuItem->direction == Qt::LeftToRight) + ret.adjust(moveByX, 0, 0, 0); + else + ret.adjust(0, 0, -moveByX, 0); // Make room for submenu indicator if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu){ @@ -3116,6 +3113,11 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con case SE_CheckBoxFocusRect: ret = opt->rect; break; + case SE_ProgressBarLabel: + case SE_ProgressBarContents: + case SE_ProgressBarGroove: + ret = opt->rect; + break; default: ret = QCommonStyle::subElementRect(element, opt, widget); } diff --git a/src/gui/styles/qs60style.h b/src/gui/styles/qs60style.h index c878538..f588d9f 100644 --- a/src/gui/styles/qs60style.h +++ b/src/gui/styles/qs60style.h @@ -50,8 +50,6 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -#if !defined(QT_NO_STYLE_S60) - //Public custom pixel metrics values. //These can be used to fetch custom pixel metric value from outside QS60Style. enum { @@ -91,14 +89,14 @@ public: #endif bool event(QEvent *e); -#ifndef Q_WS_S60 +#ifndef Q_OS_SYMBIAN static QStringList partKeys(); static QStringList colorListKeys(); void setS60Theme(const QHash<QString, QPicture> &parts, const QHash<QPair<QString , int>, QColor> &colors); bool loadS60ThemeFromBlob(const QString &blobFile); bool saveS60ThemeToBlob(const QString &blobFile) const; -#endif // !Q_WS_S60 +#endif // !Q_OS_SYMBIAN protected Q_SLOTS: QIcon standardIconImplementation( @@ -113,8 +111,6 @@ private: friend class QApplicationPrivate; }; -#endif // QT_NO_STYLE_S60 - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/gui/styles/qs60style_stub.cpp b/src/gui/styles/qs60style_stub.cpp new file mode 100644 index 0000000..a3a5b9d --- /dev/null +++ b/src/gui/styles/qs60style_stub.cpp @@ -0,0 +1,131 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qs60style.h" +#include "qdebug.h" + +#if defined(QT_NO_STYLE_S60) +QT_BEGIN_NAMESPACE + +QS60Style::QS60Style() +{ + qWarning() << "QS60Style stub created"; +} + +QS60Style::~QS60Style() +{ +} + +void QS60Style::drawComplexControl(ComplexControl , const QStyleOptionComplex *, QPainter *, const QWidget *) const +{ +} + +void QS60Style::drawControl(ControlElement , const QStyleOption *, QPainter *, const QWidget *) const +{ +} + +void QS60Style::drawPrimitive(PrimitiveElement , const QStyleOption *, QPainter *, const QWidget *) const +{ +} + +int QS60Style::pixelMetric(PixelMetric , const QStyleOption *, const QWidget *) const +{ + return 0; +} + +QSize QS60Style::sizeFromContents(ContentsType , const QStyleOption *, const QSize &, const QWidget *) const +{ + return QSize(); +} + +int QS60Style::styleHint(StyleHint , const QStyleOption *, const QWidget *, QStyleHintReturn *) const +{ + return 0; +} + +QRect QS60Style::subControlRect(ComplexControl , const QStyleOptionComplex *, SubControl , const QWidget *) const +{ + return QRect(); +} + +QRect QS60Style::subElementRect(SubElement , const QStyleOption *, const QWidget *) const +{ + return QRect(); +} + +void QS60Style::polish(QWidget *) +{ +} + +void QS60Style::unpolish(QWidget *) +{ +} + +void QS60Style::polish(QApplication *) +{ +} + +void QS60Style::unpolish(QApplication *) +{ +} + +bool QS60Style::event(QEvent *) +{ + return false; +} + +QIcon QS60Style::standardIconImplementation(StandardPixmap , const QStyleOption *, const QWidget *) const +{ + return QIcon(); +} + +void QS60Style::timerEvent(QTimerEvent *) +{ +} + +bool QS60Style::eventFilter(QObject *, QEvent *) +{ + return false; +} + +QT_END_NAMESPACE + +#endif // QT_NO_STYLE_S60 diff --git a/src/gui/styles/qwindowsvistastyle.cpp b/src/gui/styles/qwindowsvistastyle.cpp index 67a7b85..8511592 100644 --- a/src/gui/styles/qwindowsvistastyle.cpp +++ b/src/gui/styles/qwindowsvistastyle.cpp @@ -1926,30 +1926,7 @@ QSize QWindowsVistaStyle::sizeFromContents(ContentsType type, const QStyleOption return QWindowsStyle::sizeFromContents(type, option, size, widget); QSize sz(size); - - QSize newSize = QWindowsXPStyle::sizeFromContents(type, option, size, widget); switch (type) { - case CT_LineEdit: - case CT_ComboBox: - { - HTHEME theme = pOpenThemeData(0, L"Button"); - MARGINS borderSize; - if (theme) { - int result = pGetThemeMargins(theme, - NULL, - BP_PUSHBUTTON, - PBS_NORMAL, - TMT_CONTENTMARGINS, - NULL, - &borderSize); - if (result == S_OK) { - sz += QSize(borderSize.cxLeftWidth + borderSize.cxRightWidth - 2, - borderSize.cyBottomHeight + borderSize.cyTopHeight - 2); - } - sz += QSize(23, 0); //arrow button - } - } - return sz; case CT_MenuItem: sz = QWindowsXPStyle::sizeFromContents(type, option, size, widget); int minimumHeight; @@ -1990,7 +1967,7 @@ QSize QWindowsVistaStyle::sizeFromContents(ContentsType type, const QStyleOption default: break; } - return newSize; + return QWindowsXPStyle::sizeFromContents(type, option, size, widget); } /*! diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp index efb1224..8743807 100644 --- a/src/gui/styles/qwindowsxpstyle.cpp +++ b/src/gui/styles/qwindowsxpstyle.cpp @@ -3678,7 +3678,9 @@ QSize QWindowsXPStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt sz += QSize(borderSize.cxLeftWidth + borderSize.cxRightWidth - 2, borderSize.cyBottomHeight + borderSize.cyTopHeight - 2); } - sz += QSize(23, 0); //arrow button + const int textMargins = 2*(proxy()->pixelMetric(PM_FocusFrameHMargin) + 1); + sz += QSize(qMax(pixelMetric(QStyle::PM_ScrollBarExtent, option, widget) + + textMargins, 23), 0); //arrow button } } break; diff --git a/src/gui/styles/styles.pri b/src/gui/styles/styles.pri index 0a96272..b22a908 100644 --- a/src/gui/styles/styles.pri +++ b/src/gui/styles/styles.pri @@ -182,5 +182,9 @@ contains( styles, s60 ):contains(QT_CONFIG, s60) { RESOURCES += styles/qstyle_s60_simulated.qrc } } else { + symbian { + HEADERS += styles/qs60style.h + SOURCES += styles/qs60style_stub.cpp + } DEFINES += QT_NO_STYLE_S60 } diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp index f3cd481..a55e5f3 100644 --- a/src/gui/text/qtextdocument_p.cpp +++ b/src/gui/text/qtextdocument_p.cpp @@ -205,6 +205,7 @@ QTextDocumentPrivate::QTextDocumentPrivate() undoEnabled = true; inContentsChange = false; + inRemove = false; defaultTextOption.setTabStop(80); // same as in qtextengine.cpp defaultTextOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); @@ -669,7 +670,10 @@ void QTextDocumentPrivate::remove(int pos, int length, QTextUndoCommand::Operati { if (length == 0) return; + inRemove = true; move(pos, -1, length, op); + inRemove = false; + adjustDocumentChangesAndCursors(pos, -length, op); } void QTextDocumentPrivate::setCharFormat(int pos, int length, const QTextCharFormat &newFormat, FormatChangeMode mode) @@ -1263,6 +1267,9 @@ void QTextDocumentPrivate::documentChange(int from, int length) */ void QTextDocumentPrivate::adjustDocumentChangesAndCursors(int from, int addedOrRemoved, QTextUndoCommand::Operation op) { + if (inRemove) // postpone, will be called again from QTextDocumentPrivate::remove() + return; + if (!editBlock) ++revision; diff --git a/src/gui/text/qtextdocument_p.h b/src/gui/text/qtextdocument_p.h index d1bd698..06e0753 100644 --- a/src/gui/text/qtextdocument_p.h +++ b/src/gui/text/qtextdocument_p.h @@ -346,6 +346,7 @@ public: int maximumBlockCount; uint needsEnsureMaximumBlockCount : 1; uint inContentsChange : 1; + uint inRemove : 1; QSizeF pageSize; QString title; QString url; diff --git a/src/gui/util/qdesktopservices_s60.cpp b/src/gui/util/qdesktopservices_s60.cpp index a415180..24f6ccf 100644 --- a/src/gui/util/qdesktopservices_s60.cpp +++ b/src/gui/util/qdesktopservices_s60.cpp @@ -39,9 +39,6 @@ ** ****************************************************************************/ -// This flag changes the implementation to use S60 CDcoumentHandler -// instead of apparch when opening the files -#define USE_DOCUMENTHANDLER #include <qcoreapplication.h> #include <qdir.h> @@ -56,10 +53,16 @@ #include <rsendas.h> // RSendAs #include <rsendasmessage.h> // RSendAsMessage +#ifdef Q_WS_S60 +// This flag changes the implementation to use S60 CDcoumentHandler +// instead of apparch when opening the files +#define USE_DOCUMENTHANDLER +#endif + // copied from miutset.h, so we don't get a dependency into the app layer const TUid KUidMsgTypeSMTP = {0x10001028}; // 268439592 -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN # include <pathinfo.h> // PathInfo # ifdef USE_DOCUMENTHANDLER # include <DocumentHandler.h> // CDocumentHandler @@ -264,7 +267,7 @@ static TDriveUnit writableExeDrive() static TPtrC writableDataRoot() { TDriveUnit drive = exeDrive(); -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN switch(drive.operator TInt()){ case EDriveC: return PathInfo::PhoneMemoryRootPath(); @@ -391,19 +394,19 @@ QString QDesktopServices::storageLocation(StandardLocation type) break; case MusicLocation: path.Append(writableDataRoot()); -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN path.Append(PathInfo::SoundsPath()); #endif break; case MoviesLocation: path.Append(writableDataRoot()); -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN path.Append(PathInfo::VideosPath()); #endif break; case PicturesLocation: path.Append(writableDataRoot()); -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN path.Append(PathInfo::ImagesPath()); #endif break; diff --git a/src/gui/util/util.pri b/src/gui/util/util.pri index be8db93..bea520e 100644 --- a/src/gui/util/util.pri +++ b/src/gui/util/util.pri @@ -43,9 +43,8 @@ embedded { } symbian { - LIBS += -lsendas2 -letext -lapmime + LIBS += -lsendas2 -letext -lapmime -lplatformenv contains(QT_CONFIG, s60) { - LIBS += -lplatformenv contains(CONFIG, is_using_gnupoc) { LIBS += -lcommonui } else { diff --git a/src/gui/widgets/qmenubar_p.h b/src/gui/widgets/qmenubar_p.h index 82070fe..fc6701c 100644 --- a/src/gui/widgets/qmenubar_p.h +++ b/src/gui/widgets/qmenubar_p.h @@ -269,10 +269,10 @@ public: } *symbian_menubar; static int symbianCommands(int command); +#endif #ifdef QT_SOFTKEYS_ENABLED QAction *menuBarAction; #endif -#endif }; #endif diff --git a/src/imports/folderlistmodel/folderlistmodel.pro b/src/imports/folderlistmodel/folderlistmodel.pro index 49a6baa..c306037 100644 --- a/src/imports/folderlistmodel/folderlistmodel.pro +++ b/src/imports/folderlistmodel/folderlistmodel.pro @@ -8,6 +8,7 @@ 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,7 +18,7 @@ symbian:{ TARGET.UID3 = 0x20021320 include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) - importFiles.sources = qmlfolderlistmodelplugin.dll qmldir + 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 265bbca..8a772da 100644 --- a/src/imports/gestures/gestures.pro +++ b/src/imports/gestures/gestures.pro @@ -8,6 +8,7 @@ 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 @@ -17,7 +18,7 @@ symbian:{ TARGET.UID3 = 0x2002131F include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) - importFiles.sources = qmlgesturesplugin.dll qmldir + 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 91c1b9f..68462e7 100644 --- a/src/imports/particles/particles.pro +++ b/src/imports/particles/particles.pro @@ -12,6 +12,7 @@ HEADERS += \ qdeclarativeparticles_p.h QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/$$TARGETPATH +else:DESTDIR = . target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH qmldir.files += $$PWD/qmldir @@ -21,7 +22,7 @@ symbian:{ TARGET.UID3 = 0x2002131E include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) - importFiles.sources = qmlparticlesplugin.dll qmldir + importFiles.sources = $$DESTDIR/qmlparticlesplugin$${QT_LIBINFIX}.dll qmldir importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH DEPLOYMENT = importFiles diff --git a/src/imports/particles/qdeclarativeparticles.cpp b/src/imports/particles/qdeclarativeparticles.cpp index 630c068..a7c445d 100644 --- a/src/imports/particles/qdeclarativeparticles.cpp +++ b/src/imports/particles/qdeclarativeparticles.cpp @@ -437,7 +437,7 @@ public: , lifeSpanDev(1000), fadeInDur(200), fadeOutDur(300) , angle(0), angleDev(0), velocity(0), velocityDev(0), emissionCarry(0.) , addParticleTime(0), addParticleCount(0), lastAdvTime(0) - , motion(0), pendingPixmapCache(false), clock(this) + , motion(0), clock(this) { } @@ -456,7 +456,7 @@ public: void updateOpacity(QDeclarativeParticle &p, int age); QUrl url; - QPixmap image; + QDeclarativePixmap image; int count; int emissionRate; qreal emissionVariance; @@ -475,7 +475,6 @@ public: QDeclarativeParticleMotion *motion; QDeclarativeParticlesPainter *paintItem; - bool pendingPixmapCache; QList<QPair<int, int> > bursts;//countLeft, emissionRate pairs QList<QDeclarativeParticle> particles; @@ -709,9 +708,6 @@ QDeclarativeParticles::QDeclarativeParticles(QDeclarativeItem *parent) QDeclarativeParticles::~QDeclarativeParticles() { - Q_D(QDeclarativeParticles); - if (d->pendingPixmapCache) - QDeclarativePixmapCache::cancel(d->url, this); } /*! @@ -732,10 +728,8 @@ QUrl QDeclarativeParticles::source() const void QDeclarativeParticles::imageLoaded() { Q_D(QDeclarativeParticles); - d->pendingPixmapCache = false; - QString errorString; - if (QDeclarativePixmapCache::get(d->url, &d->image, &errorString)==QDeclarativePixmapReply::Error) - qmlInfo(this) << errorString; + if (d->image.isError()) + qmlInfo(this) << d->image.error(); d->paintItem->updateSize(); d->paintItem->update(); } @@ -747,27 +741,20 @@ void QDeclarativeParticles::setSource(const QUrl &name) if ((d->url.isEmpty() == name.isEmpty()) && name == d->url) return; - if (d->pendingPixmapCache) { - QDeclarativePixmapCache::cancel(d->url, this); - d->pendingPixmapCache = false; - } if (name.isEmpty()) { d->url = name; - d->image = QPixmap(); + d->image.clear(this); d->paintItem->updateSize(); d->paintItem->update(); } else { d->url = name; Q_ASSERT(!name.isRelative()); - QString errorString; - QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(d->url, &d->image, &errorString); - if (status != QDeclarativePixmapReply::Ready && status != QDeclarativePixmapReply::Error) { - QDeclarativePixmapReply *reply = QDeclarativePixmapCache::request(qmlEngine(this), d->url); - connect(reply, SIGNAL(finished()), this, SLOT(imageLoaded())); - d->pendingPixmapCache = true; + d->image.load(qmlEngine(this), d->url); + if (d->image.isLoading()) { + d->image.connectFinished(this, SLOT(imageLoaded())); } else { - if (status == QDeclarativePixmapReply::Error) - qmlInfo(this) << errorString; + if (d->image.isError()) + qmlInfo(this) << d->image.error(); //### unify with imageLoaded d->paintItem->updateSize(); d->paintItem->update(); diff --git a/src/network/access/access.pri b/src/network/access/access.pri index 173a087..6a0cd32 100644 --- a/src/network/access/access.pri +++ b/src/network/access/access.pri @@ -1,67 +1,62 @@ # Qt network access module -HEADERS += access/qftp.h \ - access/qhttp.h \ - access/qhttpnetworkheader_p.h \ - access/qhttpnetworkrequest_p.h \ - access/qhttpnetworkreply_p.h \ - access/qhttpnetworkconnection_p.h \ - access/qhttpnetworkconnectionchannel_p.h \ - access/qfilenetworkreply_p.h \ - access/qnetworkaccessmanager.h \ - access/qnetworkaccessmanager_p.h \ - access/qnetworkaccesscache_p.h \ - access/qnetworkaccessbackend_p.h \ - access/qnetworkaccessdatabackend_p.h \ - access/qnetworkaccessdebugpipebackend_p.h \ - access/qnetworkaccesshttpbackend_p.h \ - access/qnetworkaccessfilebackend_p.h \ - access/qnetworkaccesscachebackend_p.h \ - access/qnetworkaccessftpbackend_p.h \ - access/qnetworkcookie.h \ - access/qnetworkcookie_p.h \ - access/qnetworkcookiejar.h \ - access/qnetworkcookiejar_p.h \ - access/qnetworkrequest.h \ - access/qnetworkrequest_p.h \ - access/qnetworkreply.h \ - access/qnetworkreply_p.h \ - access/qnetworkreplyimpl_p.h \ - access/qabstractnetworkcache_p.h \ - access/qabstractnetworkcache.h \ - access/qnetworkdiskcache_p.h \ - access/qnetworkdiskcache.h +HEADERS += \ + access/qftp.h \ + access/qhttp.h \ + access/qhttpnetworkheader_p.h \ + access/qhttpnetworkrequest_p.h \ + access/qhttpnetworkreply_p.h \ + access/qhttpnetworkconnection_p.h \ + access/qhttpnetworkconnectionchannel_p.h \ + access/qfilenetworkreply_p.h \ + access/qnetworkaccessmanager.h \ + access/qnetworkaccessmanager_p.h \ + access/qnetworkaccesscache_p.h \ + access/qnetworkaccessbackend_p.h \ + access/qnetworkaccessdatabackend_p.h \ + access/qnetworkaccessdebugpipebackend_p.h \ + access/qnetworkaccesshttpbackend_p.h \ + access/qnetworkaccessfilebackend_p.h \ + access/qnetworkaccesscachebackend_p.h \ + access/qnetworkaccessftpbackend_p.h \ + access/qnetworkcookie.h \ + access/qnetworkcookie_p.h \ + access/qnetworkcookiejar.h \ + access/qnetworkcookiejar_p.h \ + access/qnetworkrequest.h \ + access/qnetworkrequest_p.h \ + access/qnetworkreply.h \ + access/qnetworkreply_p.h \ + access/qnetworkreplyimpl_p.h \ + access/qabstractnetworkcache_p.h \ + access/qabstractnetworkcache.h \ + access/qnetworkdiskcache_p.h \ + access/qnetworkdiskcache.h -SOURCES += access/qftp.cpp \ - access/qhttp.cpp \ - access/qhttpnetworkheader.cpp \ - access/qhttpnetworkrequest.cpp \ - access/qhttpnetworkreply.cpp \ - access/qhttpnetworkconnection.cpp \ - access/qhttpnetworkconnectionchannel.cpp \ - access/qfilenetworkreply.cpp \ - access/qnetworkaccessmanager.cpp \ - access/qnetworkaccesscache.cpp \ - access/qnetworkaccessbackend.cpp \ - access/qnetworkaccessdatabackend.cpp \ - access/qnetworkaccessdebugpipebackend.cpp \ - access/qnetworkaccessfilebackend.cpp \ - access/qnetworkaccesscachebackend.cpp \ - access/qnetworkaccessftpbackend.cpp \ - access/qnetworkaccesshttpbackend.cpp \ - access/qnetworkcookie.cpp \ - access/qnetworkcookiejar.cpp \ - access/qnetworkrequest.cpp \ - access/qnetworkreply.cpp \ - access/qnetworkreplyimpl.cpp \ - access/qabstractnetworkcache.cpp \ - access/qnetworkdiskcache.cpp +SOURCES += \ + access/qftp.cpp \ + access/qhttp.cpp \ + access/qhttpnetworkheader.cpp \ + access/qhttpnetworkrequest.cpp \ + access/qhttpnetworkreply.cpp \ + access/qhttpnetworkconnection.cpp \ + access/qhttpnetworkconnectionchannel.cpp \ + access/qfilenetworkreply.cpp \ + access/qnetworkaccessmanager.cpp \ + access/qnetworkaccesscache.cpp \ + access/qnetworkaccessbackend.cpp \ + access/qnetworkaccessdatabackend.cpp \ + access/qnetworkaccessdebugpipebackend.cpp \ + access/qnetworkaccessfilebackend.cpp \ + access/qnetworkaccesscachebackend.cpp \ + access/qnetworkaccessftpbackend.cpp \ + access/qnetworkaccesshttpbackend.cpp \ + access/qnetworkcookie.cpp \ + access/qnetworkcookiejar.cpp \ + access/qnetworkrequest.cpp \ + access/qnetworkreply.cpp \ + access/qnetworkreplyimpl.cpp \ + access/qabstractnetworkcache.cpp \ + access/qnetworkdiskcache.cpp -#zlib support -contains(QT_CONFIG, zlib) { - INCLUDEPATH += ../3rdparty/zlib -} else:!contains(QT_CONFIG, no-zlib) { - symbian:LIBS_PRIVATE += -llibz - else:if(unix|win32-g++*):LIBS_PRIVATE += -lz - else:LIBS += zdll.lib -} +include($$PWD/../../3rdparty/zlib_dependency.pri) diff --git a/src/network/kernel/qnetworkproxy_win.cpp b/src/network/kernel/qnetworkproxy_win.cpp index e801738..537107e 100644 --- a/src/network/kernel/qnetworkproxy_win.cpp +++ b/src/network/kernel/qnetworkproxy_win.cpp @@ -100,6 +100,10 @@ typedef struct { #define WINHTTP_NO_PROXY_NAME NULL #define WINHTTP_NO_PROXY_BYPASS NULL +#define WINHTTP_ERROR_BASE 12000 +#define ERROR_WINHTTP_LOGIN_FAILURE (WINHTTP_ERROR_BASE + 15) +#define ERROR_WINHTTP_AUTODETECTION_FAILED (WINHTTP_ERROR_BASE + 180) + QT_BEGIN_NAMESPACE typedef BOOL (WINAPI * PtrWinHttpGetProxyForUrl)(HINTERNET, LPCWSTR, WINHTTP_AUTOPROXY_OPTIONS*, WINHTTP_PROXY_INFO*); @@ -320,7 +324,7 @@ void QWindowsSystemProxy::init() isAutoConfig = true; memset(&autoProxyOptions, 0, sizeof autoProxyOptions); - autoProxyOptions.fAutoLogonIfChallenged = true; + autoProxyOptions.fAutoLogonIfChallenged = false; if (ieProxyConfig.fAutoDetect) { autoProxyOptions.dwFlags = WINHTTP_AUTOPROXY_AUTO_DETECT; autoProxyOptions.dwAutoDetectFlags = WINHTTP_AUTO_DETECT_TYPE_DHCP | @@ -377,10 +381,26 @@ QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkPro // change the scheme to https, maybe it'll work url.setScheme(QLatin1String("https")); } - if (ptrWinHttpGetProxyForUrl(sp->hHttpSession, - (LPCWSTR)url.toString().utf16(), - &sp->autoProxyOptions, - &proxyInfo)) { + + bool getProxySucceeded = ptrWinHttpGetProxyForUrl(sp->hHttpSession, + (LPCWSTR)url.toString().utf16(), + &sp->autoProxyOptions, + &proxyInfo); + DWORD getProxyError = GetLastError(); + + if (!getProxySucceeded + && (ERROR_WINHTTP_LOGIN_FAILURE == getProxyError)) { + // We first tried without AutoLogon, because this might prevent caching the result. + // But now we've to enable it (http://msdn.microsoft.com/en-us/library/aa383153%28v=VS.85%29.aspx) + sp->autoProxyOptions.fAutoLogonIfChallenged = TRUE; + getProxySucceeded = ptrWinHttpGetProxyForUrl(sp->hHttpSession, + (LPCWSTR)url.toString().utf16(), + &sp->autoProxyOptions, + &proxyInfo); + getProxyError = GetLastError(); + } + + if (getProxySucceeded) { // yes, we got a config for this URL QString proxyBypass = QString::fromWCharArray(proxyInfo.lpszProxyBypass); QStringList proxyServerList = splitSpaceSemicolon(QString::fromWCharArray(proxyInfo.lpszProxy)); @@ -395,6 +415,13 @@ QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkPro } // GetProxyForUrl failed + + if (ERROR_WINHTTP_AUTODETECTION_FAILED == getProxyError) { + //No config file could be retrieved on the network. + //Don't search for it next time again. + sp->isAutoConfig = false; + } + return sp->defaultResult; } diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 54a580d..cad8ca7 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -515,9 +515,15 @@ void QSslSocketPrivate::ensureInitialized() #elif defined(Q_OS_WIN) HINSTANCE hLib = LoadLibraryW(L"Crypt32"); if (hLib) { +#if defined(Q_OS_WINCE) + ptrCertOpenSystemStoreW = (PtrCertOpenSystemStoreW)GetProcAddress(hLib, L"CertOpenStore"); + ptrCertFindCertificateInStore = (PtrCertFindCertificateInStore)GetProcAddress(hLib, L"CertFindCertificateInStore"); + ptrCertCloseStore = (PtrCertCloseStore)GetProcAddress(hLib, L"CertCloseStore"); +#else ptrCertOpenSystemStoreW = (PtrCertOpenSystemStoreW)GetProcAddress(hLib, "CertOpenSystemStoreW"); ptrCertFindCertificateInStore = (PtrCertFindCertificateInStore)GetProcAddress(hLib, "CertFindCertificateInStore"); ptrCertCloseStore = (PtrCertCloseStore)GetProcAddress(hLib, "CertCloseStore"); +#endif if (!ptrCertOpenSystemStoreW || !ptrCertFindCertificateInStore || !ptrCertCloseStore) qWarning("could not resolve symbols in crypt32 library"); // should never happen } else { @@ -601,7 +607,15 @@ QList<QSslCertificate> QSslSocketPrivate::systemCaCertificates() #elif defined(Q_OS_WIN) if (ptrCertOpenSystemStoreW && ptrCertFindCertificateInStore && ptrCertCloseStore) { HCERTSTORE hSystemStore; +#if defined(Q_OS_WINCE) + hSystemStore = ptrCertOpenSystemStoreW(CERT_STORE_PROV_SYSTEM_W, + 0, + 0, + CERT_STORE_NO_CRYPT_RELEASE_FLAG|CERT_SYSTEM_STORE_CURRENT_USER, + L"ROOT"); +#else hSystemStore = ptrCertOpenSystemStoreW(0, L"ROOT"); +#endif if(hSystemStore) { PCCERT_CONTEXT pc = NULL; while(1) { diff --git a/src/network/ssl/qsslsocket_p.h b/src/network/ssl/qsslsocket_p.h index 09775bc..72b3ef7 100644 --- a/src/network/ssl/qsslsocket_p.h +++ b/src/network/ssl/qsslsocket_p.h @@ -77,7 +77,11 @@ QT_BEGIN_NAMESPACE #ifndef HCRYPTPROV_LEGACY #define HCRYPTPROV_LEGACY HCRYPTPROV #endif +#if defined(Q_OS_WINCE) + typedef HCERTSTORE (WINAPI *PtrCertOpenSystemStoreW)(LPCSTR, DWORD, HCRYPTPROV_LEGACY, DWORD, const void*); +#else typedef HCERTSTORE (WINAPI *PtrCertOpenSystemStoreW)(HCRYPTPROV_LEGACY, LPCWSTR); +#endif typedef PCCERT_CONTEXT (WINAPI *PtrCertFindCertificateInStore)(HCERTSTORE, DWORD, DWORD, DWORD, const void*, PCCERT_CONTEXT); typedef BOOL (WINAPI *PtrCertCloseStore)(HCERTSTORE, DWORD); #endif diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp index 9d1bfab..0083380 100644 --- a/src/plugins/bearer/icd/qicdengine.cpp +++ b/src/plugins/bearer/icd/qicdengine.cpp @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE IcdNetworkConfigurationPrivate::IcdNetworkConfigurationPrivate() -: network_attrs(0), service_attrs(0) +: service_attrs(0), network_attrs(0) { } @@ -251,6 +251,11 @@ void QIcdEngine::initialize() ICD_DBUS_API_INTERFACE, QDBusConnection::systemBus(), this); + + // abort if cannot connect to DBus. + if (!m_dbusInterface->isValid()) + return; + connect(&m_scanTimer, SIGNAL(timeout()), this, SLOT(finishAsyncConfigurationUpdate())); m_scanTimer.setSingleShot(true); @@ -322,10 +327,10 @@ void QIcdEngine::deleteConfiguration(const QString &iap_id) } -static uint32_t getNetworkAttrs(bool is_iap_id, - const QString &iap_id, - const QString &iap_type, - QString security_method) +static quint32 getNetworkAttrs(bool is_iap_id, + const QString &iap_id, + const QString &iap_type, + QString security_method) { guint network_attr = 0; dbus_uint32_t cap = 0; @@ -363,7 +368,7 @@ static uint32_t getNetworkAttrs(bool is_iap_id, if (is_iap_id) network_attr |= ICD_NW_ATTR_IAPNAME; - return (uint32_t)network_attr; + return quint32(network_attr); } diff --git a/src/plugins/bearer/icd/qicdengine.h b/src/plugins/bearer/icd/qicdengine.h index 2f9f8ed..1b291eb 100644 --- a/src/plugins/bearer/icd/qicdengine.h +++ b/src/plugins/bearer/icd/qicdengine.h @@ -69,11 +69,11 @@ public: QString service_type; QString service_id; - uint32_t service_attrs; + quint32 service_attrs; // Network attributes for this IAP, this is the value returned by icd and // passed to it when connecting. - uint32_t network_attrs; + quint32 network_attrs; }; inline IcdNetworkConfigurationPrivate *toIcdConfig(QNetworkConfigurationPrivatePointer ptr) diff --git a/src/plugins/imageformats/gif/gif.pro b/src/plugins/imageformats/gif/gif.pro index 8a5c51a..439b431 100644 --- a/src/plugins/imageformats/gif/gif.pro +++ b/src/plugins/imageformats/gif/gif.pro @@ -1,9 +1,8 @@ TARGET = qgif include(../../qpluginbase.pri) -HEADERS += qgifhandler.h -SOURCES += main.cpp \ - qgifhandler.cpp +include(../../../gui/image/qgifhandler.pri) +SOURCES += $$PWD/main.cpp QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/imageformats target.path += $$[QT_INSTALL_PLUGINS]/imageformats diff --git a/src/plugins/imageformats/gif/main.cpp b/src/plugins/imageformats/gif/main.cpp index 3bb0bf4..99a9528 100644 --- a/src/plugins/imageformats/gif/main.cpp +++ b/src/plugins/imageformats/gif/main.cpp @@ -47,7 +47,7 @@ #ifdef QT_NO_IMAGEFORMAT_GIF #undef QT_NO_IMAGEFORMAT_GIF #endif -#include "qgifhandler.h" +#include <qgifhandler_p.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/imageformats/imageformats.pro b/src/plugins/imageformats/imageformats.pro index 2e4036b..5fff2de 100644 --- a/src/plugins/imageformats/imageformats.pro +++ b/src/plugins/imageformats/imageformats.pro @@ -1,8 +1,8 @@ TEMPLATE = subdirs -!contains(QT_CONFIG, no-jpeg):SUBDIRS += jpeg -!contains(QT_CONFIG, no-gif):SUBDIRS += gif -!contains(QT_CONFIG, no-mng):SUBDIRS += mng +!contains(QT_CONFIG, no-jpeg):!contains(QT_CONFIG, jpeg):SUBDIRS += jpeg +!contains(QT_CONFIG, no-gif):!contains(QT_CONFIG, gif):SUBDIRS += gif +!contains(QT_CONFIG, no-mng):!contains(QT_CONFIG, mng):SUBDIRS += mng contains(QT_CONFIG, svg):SUBDIRS += svg -!contains(QT_CONFIG, no-tiff):SUBDIRS += tiff +!contains(QT_CONFIG, no-tiff):!contains(QT_CONFIG, tiff):SUBDIRS += tiff !contains(QT_CONFIG, no-ico):SUBDIRS += ico diff --git a/src/plugins/imageformats/jpeg/jpeg.pro b/src/plugins/imageformats/jpeg/jpeg.pro index d4b0fef..c5671c3 100644 --- a/src/plugins/imageformats/jpeg/jpeg.pro +++ b/src/plugins/imageformats/jpeg/jpeg.pro @@ -3,10 +3,6 @@ include(../../qpluginbase.pri) QTDIR_build:REQUIRES = "!contains(QT_CONFIG, no-jpeg)" -HEADERS += qjpeghandler.h -SOURCES += main.cpp \ - qjpeghandler.cpp - wince*: { DEFINES += NO_GETENV contains(CE_ARCH,x86):CONFIG -= stl exceptions @@ -21,61 +17,9 @@ symbian: { QMAKE_CFLAGS_WARN_ON += -Wno-unused-parameter -Wno-main } -contains(QT_CONFIG, system-jpeg) { - unix|win32-g++*:LIBS += -ljpeg - win32:!win32-g++*:LIBS += libjpeg.lib -} else { - INCLUDEPATH += ../../../3rdparty/libjpeg - SOURCES += \ - ../../../3rdparty/libjpeg/jaricom.c \ - ../../../3rdparty/libjpeg/jcapimin.c \ - ../../../3rdparty/libjpeg/jcapistd.c \ - ../../../3rdparty/libjpeg/jcarith.c \ - ../../../3rdparty/libjpeg/jccoefct.c \ - ../../../3rdparty/libjpeg/jccolor.c \ - ../../../3rdparty/libjpeg/jcdctmgr.c \ - ../../../3rdparty/libjpeg/jchuff.c \ - ../../../3rdparty/libjpeg/jcinit.c \ - ../../../3rdparty/libjpeg/jcmainct.c \ - ../../../3rdparty/libjpeg/jcmarker.c \ - ../../../3rdparty/libjpeg/jcmaster.c \ - ../../../3rdparty/libjpeg/jcomapi.c \ - ../../../3rdparty/libjpeg/jcparam.c \ - ../../../3rdparty/libjpeg/jcprepct.c \ - ../../../3rdparty/libjpeg/jcsample.c \ - ../../../3rdparty/libjpeg/jctrans.c \ - ../../../3rdparty/libjpeg/jdapimin.c \ - ../../../3rdparty/libjpeg/jdapistd.c \ - ../../../3rdparty/libjpeg/jdarith.c \ - ../../../3rdparty/libjpeg/jdatadst.c \ - ../../../3rdparty/libjpeg/jdatasrc.c \ - ../../../3rdparty/libjpeg/jdcoefct.c \ - ../../../3rdparty/libjpeg/jdcolor.c \ - ../../../3rdparty/libjpeg/jddctmgr.c \ - ../../../3rdparty/libjpeg/jdhuff.c \ - ../../../3rdparty/libjpeg/jdinput.c \ - ../../../3rdparty/libjpeg/jdmainct.c \ - ../../../3rdparty/libjpeg/jdmarker.c \ - ../../../3rdparty/libjpeg/jdmaster.c \ - ../../../3rdparty/libjpeg/jdmerge.c \ - ../../../3rdparty/libjpeg/jdpostct.c \ - ../../../3rdparty/libjpeg/jdsample.c \ - ../../../3rdparty/libjpeg/jdtrans.c \ - ../../../3rdparty/libjpeg/jerror.c \ - ../../../3rdparty/libjpeg/jfdctflt.c \ - ../../../3rdparty/libjpeg/jfdctfst.c \ - ../../../3rdparty/libjpeg/jfdctint.c \ - ../../../3rdparty/libjpeg/jidctflt.c \ - ../../../3rdparty/libjpeg/jidctfst.c \ - ../../../3rdparty/libjpeg/jidctint.c \ - ../../../3rdparty/libjpeg/jquant1.c \ - ../../../3rdparty/libjpeg/jquant2.c \ - ../../../3rdparty/libjpeg/jutils.c \ - ../../../3rdparty/libjpeg/jmemmgr.c \ - ../../../3rdparty/libjpeg/jmemnobs.c -} +include(../../../gui/image/qjpeghandler.pri) +SOURCES += main.cpp QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/imageformats target.path += $$[QT_INSTALL_PLUGINS]/imageformats INSTALLS += target - diff --git a/src/plugins/imageformats/jpeg/main.cpp b/src/plugins/imageformats/jpeg/main.cpp index 2a45cb0..8eb3f03 100644 --- a/src/plugins/imageformats/jpeg/main.cpp +++ b/src/plugins/imageformats/jpeg/main.cpp @@ -47,7 +47,7 @@ #ifdef QT_NO_IMAGEFORMAT_JPEG #undef QT_NO_IMAGEFORMAT_JPEG #endif -#include "qjpeghandler.h" +#include <qjpeghandler_p.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/imageformats/mng/main.cpp b/src/plugins/imageformats/mng/main.cpp index 84f085c..dd62ba5 100644 --- a/src/plugins/imageformats/mng/main.cpp +++ b/src/plugins/imageformats/mng/main.cpp @@ -47,7 +47,7 @@ #ifdef QT_NO_IMAGEFORMAT_MNG #undef QT_NO_IMAGEFORMAT_MNG #endif -#include "qmnghandler.h" +#include <qmnghandler_p.h> #include <qiodevice.h> #include <qbytearray.h> diff --git a/src/plugins/imageformats/mng/mng.pro b/src/plugins/imageformats/mng/mng.pro index 158f41a..88085f3 100644 --- a/src/plugins/imageformats/mng/mng.pro +++ b/src/plugins/imageformats/mng/mng.pro @@ -3,54 +3,15 @@ include(../../qpluginbase.pri) QTDIR_build:REQUIRES = "!contains(QT_CONFIG, no-mng)" -HEADERS += qmnghandler.h -SOURCES += main.cpp \ - qmnghandler.cpp - symbian: { #Disable warnings in 3rdparty code due to unused variables and arguments QMAKE_CXXFLAGS.CW += -W nounused TARGET.UID3=0x2001E619 } -contains(QT_CONFIG, system-mng) { - unix|win32-g++*:LIBS += -lmng - win32:!win32-g++*:LIBS += libmng.lib -} else { - DEFINES += MNG_BUILD_SO - DEFINES += MNG_NO_INCLUDE_JNG - INCLUDEPATH += ../../../3rdparty/libmng - SOURCES += \ - ../../../3rdparty/libmng/libmng_callback_xs.c \ - ../../../3rdparty/libmng/libmng_chunk_io.c \ - ../../../3rdparty/libmng/libmng_chunk_descr.c \ - ../../../3rdparty/libmng/libmng_chunk_prc.c \ - ../../../3rdparty/libmng/libmng_chunk_xs.c \ - ../../../3rdparty/libmng/libmng_cms.c \ - ../../../3rdparty/libmng/libmng_display.c \ - ../../../3rdparty/libmng/libmng_dither.c \ - ../../../3rdparty/libmng/libmng_error.c \ - ../../../3rdparty/libmng/libmng_filter.c \ - ../../../3rdparty/libmng/libmng_hlapi.c \ - ../../../3rdparty/libmng/libmng_jpeg.c \ - ../../../3rdparty/libmng/libmng_object_prc.c \ - ../../../3rdparty/libmng/libmng_pixels.c \ - ../../../3rdparty/libmng/libmng_prop_xs.c \ - ../../../3rdparty/libmng/libmng_read.c \ - ../../../3rdparty/libmng/libmng_trace.c \ - ../../../3rdparty/libmng/libmng_write.c \ - ../../../3rdparty/libmng/libmng_zlib.c -} - -contains(QT_CONFIG, system-zlib) { - symbian:LIBS_PRIVATE += -llibz - else:if(unix|win32-g++*):LIBS_PRIVATE += -lz - else:LIBS += zdll.lib -} else { - INCLUDEPATH += ../../../3rdparty/zlib -} +include(../../../gui/image/qmnghandler.pri) +SOURCES += main.cpp QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/imageformats target.path += $$[QT_INSTALL_PLUGINS]/imageformats INSTALLS += target - diff --git a/src/plugins/imageformats/tiff/main.cpp b/src/plugins/imageformats/tiff/main.cpp index fbcbd72..c022abe 100644 --- a/src/plugins/imageformats/tiff/main.cpp +++ b/src/plugins/imageformats/tiff/main.cpp @@ -47,7 +47,7 @@ #ifdef QT_NO_IMAGEFORMAT_TIFF #undef QT_NO_IMAGEFORMAT_TIFF #endif -#include "qtiffhandler.h" +#include <qtiffhandler_p.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/imageformats/tiff/tiff.pro b/src/plugins/imageformats/tiff/tiff.pro index 08e471c..e781526 100644 --- a/src/plugins/imageformats/tiff/tiff.pro +++ b/src/plugins/imageformats/tiff/tiff.pro @@ -3,77 +3,8 @@ include(../../qpluginbase.pri) QTDIR_build:REQUIRES = "!contains(QT_CONFIG, no-tiff)" -HEADERS += qtiffhandler.h -SOURCES += main.cpp \ - qtiffhandler.cpp - -contains(QT_CONFIG, system-tiff) { - unix|win32-g++*:LIBS += -ltiff - win32:!win32-g++*:LIBS += libtiff.lib - - contains(QT_CONFIG, system-jpeg) { - unix|win32-g++*:LIBS += -ljpeg - win32:!win32-g++*:LIBS += libjpeg.lib - } -} else { - INCLUDEPATH += ../../../3rdparty/libtiff/libtiff - SOURCES += \ - ../../../3rdparty/libtiff/libtiff/tif_aux.c \ - ../../../3rdparty/libtiff/libtiff/tif_close.c \ - ../../../3rdparty/libtiff/libtiff/tif_codec.c \ - ../../../3rdparty/libtiff/libtiff/tif_color.c \ - ../../../3rdparty/libtiff/libtiff/tif_compress.c \ - ../../../3rdparty/libtiff/libtiff/tif_dir.c \ - ../../../3rdparty/libtiff/libtiff/tif_dirinfo.c \ - ../../../3rdparty/libtiff/libtiff/tif_dirread.c \ - ../../../3rdparty/libtiff/libtiff/tif_dirwrite.c \ - ../../../3rdparty/libtiff/libtiff/tif_dumpmode.c \ - ../../../3rdparty/libtiff/libtiff/tif_error.c \ - ../../../3rdparty/libtiff/libtiff/tif_extension.c \ - ../../../3rdparty/libtiff/libtiff/tif_fax3.c \ - ../../../3rdparty/libtiff/libtiff/tif_fax3sm.c \ - ../../../3rdparty/libtiff/libtiff/tif_flush.c \ - ../../../3rdparty/libtiff/libtiff/tif_getimage.c \ - ../../../3rdparty/libtiff/libtiff/tif_luv.c \ - ../../../3rdparty/libtiff/libtiff/tif_lzw.c \ - ../../../3rdparty/libtiff/libtiff/tif_next.c \ - ../../../3rdparty/libtiff/libtiff/tif_open.c \ - ../../../3rdparty/libtiff/libtiff/tif_packbits.c \ - ../../../3rdparty/libtiff/libtiff/tif_pixarlog.c \ - ../../../3rdparty/libtiff/libtiff/tif_predict.c \ - ../../../3rdparty/libtiff/libtiff/tif_print.c \ - ../../../3rdparty/libtiff/libtiff/tif_read.c \ - ../../../3rdparty/libtiff/libtiff/tif_strip.c \ - ../../../3rdparty/libtiff/libtiff/tif_swab.c \ - ../../../3rdparty/libtiff/libtiff/tif_thunder.c \ - ../../../3rdparty/libtiff/libtiff/tif_tile.c \ - ../../../3rdparty/libtiff/libtiff/tif_version.c \ - ../../../3rdparty/libtiff/libtiff/tif_warning.c \ - ../../../3rdparty/libtiff/libtiff/tif_write.c \ - ../../../3rdparty/libtiff/libtiff/tif_zip.c - win32:!wince*: { - SOURCES += ../../../3rdparty/libtiff/libtiff/tif_win32.c - } - unix: { - SOURCES += ../../../3rdparty/libtiff/libtiff/tif_unix.c - } - wince*: { - SOURCES += ../../../corelib/kernel/qfunctions_wince.cpp \ - ../../../3rdparty/libtiff/libtiff/tif_wince.c \ - ../../../3rdparty/libtiff/libtiff/tif_win32.c - } - symbian: { - SOURCES += ../../../3rdparty/libtiff/port/lfind.c - } -} - -contains(QT_CONFIG, system-zlib) { - symbian:LIBS_PRIVATE += -llibz - else:if(unix|win32-g++*):LIBS_PRIVATE += -lz - else:LIBS += zdll.lib -} else { - INCLUDEPATH += ../../../3rdparty/zlib -} +include(../../../gui/image/qtiffhandler.pri) +SOURCES += main.cpp QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/imageformats target.path += $$[QT_INSTALL_PLUGINS]/imageformats diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 8dc97f5..296901d 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -8181,7 +8181,7 @@ EXPORTS ?rowsInserted@QTreeView@@MAEXABVQModelIndex@@HH@Z @ 8180 NONAME ; void QTreeView::rowsInserted(class QModelIndex const &, int, int) ?rowsRemoved@QTreeView@@IAEXABVQModelIndex@@HH@Z @ 8181 NONAME ; void QTreeView::rowsRemoved(class QModelIndex const &, int, int) ?rubberBandSelectionMode@QGraphicsView@@QBE?AW4ItemSelectionMode@Qt@@XZ @ 8182 NONAME ; enum Qt::ItemSelectionMode QGraphicsView::rubberBandSelectionMode(void) const - ?s60AdjustedPosition@QDialog@@AAE_NXZ @ 8183 NONAME ; bool QDialog::s60AdjustedPosition(void) + ?symbianAdjustedPosition@QDialog@@AAE_NXZ @ 8183 NONAME ; bool QDialog::symbianAdjustedPosition(void) ?s60UpdateIsOpaque@QWidgetPrivate@@QAEXXZ @ 8184 NONAME ; void QWidgetPrivate::s60UpdateIsOpaque(void) ?saturation@QColor@@QBEHXZ @ 8185 NONAME ; int QColor::saturation(void) const ?saturationF@QColor@@QBEMXZ @ 8186 NONAME ; float QColor::saturationF(void) const @@ -12859,4 +12859,24 @@ EXPORTS ?copy@QRasterPixmapData@@UAEXPBVQPixmapData@@ABVQRect@@@Z @ 12858 NONAME ; void QRasterPixmapData::copy(class QPixmapData const *, class QRect const &) ?eglSwapBuffersRegion2NOK@QEgl@@YAHHHHPBH@Z @ 12859 NONAME ; int QEgl::eglSwapBuffersRegion2NOK(int, int, int, int const *) ?swapBuffersRegion2NOK@QEglContext@@QAE_NHPBVQRegion@@@Z @ 12860 NONAME ; bool QEglContext::swapBuffersRegion2NOK(int, class QRegion const *) + ?OpenIniFileLC@QS60MainApplication@@UBEPAVCDictionaryStore@@AAVRFs@@@Z @ 12861 NONAME ; class CDictionaryStore * QS60MainApplication::OpenIniFileLC(class RFs &) const + ?Reserved_MtsmObject@QS60MainAppUi@@MAEXXZ @ 12862 NONAME ; void QS60MainAppUi::Reserved_MtsmObject(void) + ?HandleForegroundEventL@QS60MainAppUi@@MAEXH@Z @ 12863 NONAME ; void QS60MainAppUi::HandleForegroundEventL(int) + ?OpenFileL@QS60MainDocument@@UAEPAVCFileStore@@HABVTDesC16@@AAVRFs@@@Z @ 12864 NONAME ; class CFileStore * QS60MainDocument::OpenFileL(int, class TDesC16 const &, class RFs &) + ?HandleTouchPaneSizeChange@QS60MainAppUi@@UAEXXZ @ 12865 NONAME ; void QS60MainAppUi::HandleTouchPaneSizeChange(void) + ?Reserved_MtsmPosition@QS60MainAppUi@@MAEXXZ @ 12866 NONAME ; void QS60MainAppUi::Reserved_MtsmPosition(void) + ?ApplicationRect@QS60MainAppUi@@UBE?AVTRect@@XZ @ 12867 NONAME ; class TRect QS60MainAppUi::ApplicationRect(void) const + ?HandleSystemEventL@QS60MainAppUi@@MAEXABVTWsEvent@@@Z @ 12868 NONAME ; void QS60MainAppUi::HandleSystemEventL(class TWsEvent const &) + ?HandleApplicationSpecificEventL@QS60MainAppUi@@MAEXHABVTWsEvent@@@Z @ 12869 NONAME ; void QS60MainAppUi::HandleApplicationSpecificEventL(int, class TWsEvent const &) + ?HandleError@QS60MainAppUi@@UAE?AW4TErrorHandlerResponse@@HABUSExtendedError@@AAVTDes16@@1@Z @ 12870 NONAME ; enum TErrorHandlerResponse QS60MainAppUi::HandleError(int, struct SExtendedError const &, class TDes16 &, class TDes16 &) + ?PrepareToExit@QS60MainAppUi@@UAEXXZ @ 12871 NONAME ; void QS60MainAppUi::PrepareToExit(void) + ?MopSupplyObject@QS60MainAppUi@@MAE?AVPtr@TTypeUid@@V3@@Z @ 12872 NONAME ; class TTypeUid::Ptr QS60MainAppUi::MopSupplyObject(class TTypeUid) + ?SetFadedL@QS60MainAppUi@@UAEXH@Z @ 12873 NONAME ; void QS60MainAppUi::SetFadedL(int) + ?Exit@QS60MainAppUi@@UAEXXZ @ 12874 NONAME ; void QS60MainAppUi::Exit(void) + ?ProcessCommandL@QS60MainAppUi@@UAEXH@Z @ 12875 NONAME ; void QS60MainAppUi::ProcessCommandL(int) + ?OpenFileL@QS60MainDocument@@UAEXAAPAVCFileStore@@AAVRFile@@@Z @ 12876 NONAME ; void QS60MainDocument::OpenFileL(class CFileStore * &, class RFile &) + ?HandleScreenDeviceChangedL@QS60MainAppUi@@MAEXXZ @ 12877 NONAME ; void QS60MainAppUi::HandleScreenDeviceChangedL(void) + ?PreDocConstructL@QS60MainApplication@@UAEXXZ @ 12878 NONAME ; void QS60MainApplication::PreDocConstructL(void) + ?NewAppServerL@QS60MainApplication@@UAEXAAPAVCApaAppServer@@@Z @ 12879 NONAME ; void QS60MainApplication::NewAppServerL(class CApaAppServer * &) + ?HandleViewDeactivation@QS60MainAppUi@@UAEXABVTVwsViewId@@0@Z @ 12880 NONAME ; void QS60MainAppUi::HandleViewDeactivation(class TVwsViewId const &, class TVwsViewId const &) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 5b21b97..018cba2 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -5957,7 +5957,7 @@ EXPORTS _ZN7QDialog16staticMetaObjectE @ 5956 NONAME DATA 16 _ZN7QDialog18setSizeGripEnabledEb @ 5957 NONAME _ZN7QDialog19getStaticMetaObjectEv @ 5958 NONAME - _ZN7QDialog19s60AdjustedPositionEv @ 5959 NONAME + _ZN7QDialog23symbianAdjustedPositionEv @ 5959 NONAME _ZN7QDialog4doneEi @ 5960 NONAME _ZN7QDialog4execEv @ 5961 NONAME _ZN7QDialog4openEv @ 5962 NONAME @@ -12060,4 +12060,28 @@ EXPORTS _ZTV18QRuntimePixmapData @ 12059 NONAME _ZN11QEglContext21swapBuffersRegion2NOKEiPK7QRegion @ 12060 NONAME _ZN4QEgl24eglSwapBuffersRegion2NOKEiiiPKi @ 12061 NONAME + _ZN13QS60MainAppUi11HandleErrorEiRK14SExtendedErrorR6TDes16S4_ @ 12062 NONAME + _ZN13QS60MainAppUi13PrepareToExitEv @ 12063 NONAME + _ZN13QS60MainAppUi15MopSupplyObjectE8TTypeUid @ 12064 NONAME + _ZN13QS60MainAppUi15ProcessCommandLEi @ 12065 NONAME + _ZN13QS60MainAppUi18HandleSystemEventLERK8TWsEvent @ 12066 NONAME + _ZN13QS60MainAppUi19Reserved_MtsmObjectEv @ 12067 NONAME + _ZN13QS60MainAppUi21Reserved_MtsmPositionEv @ 12068 NONAME + _ZN13QS60MainAppUi22HandleForegroundEventLEi @ 12069 NONAME + _ZN13QS60MainAppUi22HandleViewDeactivationERK10TVwsViewIdS2_ @ 12070 NONAME + _ZN13QS60MainAppUi25HandleTouchPaneSizeChangeEv @ 12071 NONAME + _ZN13QS60MainAppUi26HandleScreenDeviceChangedLEv @ 12072 NONAME + _ZN13QS60MainAppUi31HandleApplicationSpecificEventLEiRK8TWsEvent @ 12073 NONAME + _ZN13QS60MainAppUi4ExitEv @ 12074 NONAME + _ZN13QS60MainAppUi9SetFadedLEi @ 12075 NONAME + _ZN16QS60MainDocument9OpenFileLERP10CFileStoreR5RFile @ 12076 NONAME + _ZN16QS60MainDocument9OpenFileLEiRK7TDesC16R3RFs @ 12077 NONAME + _ZN19QS60MainApplication13NewAppServerLERP13CApaAppServer @ 12078 NONAME + _ZN19QS60MainApplication16PreDocConstructLEv @ 12079 NONAME + _ZNK13QS60MainAppUi15ApplicationRectEv @ 12080 NONAME + _ZNK19QS60MainApplication13OpenIniFileLCER3RFs @ 12081 NONAME + _ZThn100_N13QS60MainAppUi25HandleTouchPaneSizeChangeEv @ 12082 NONAME + _ZThn24_N13QS60MainAppUi15ProcessCommandLEi @ 12083 NONAME + _ZThn40_N13QS60MainAppUi15MopSupplyObjectE8TTypeUid @ 12084 NONAME + _ZThn92_N13QS60MainAppUi22HandleViewDeactivationERK10TVwsViewIdS2_ @ 12085 NONAME diff --git a/src/src.pro b/src/src.pro index 0573c2d..9704716 100644 --- a/src/src.pro +++ b/src/src.pro @@ -187,4 +187,15 @@ debug.depends = $$EXTRA_DEBUG_TARGETS release.depends = $$EXTRA_RELEASE_TARGETS QMAKE_EXTRA_TARGETS += debug release +# This gives us a top-level runonphone target, which installs Qt and optionally QtWebKit. +contains(CONFIG, run_on_phone) { + src_runonphone_target.target = runonphone + src_runonphone_target.commands = $(MAKE) -C $$QT_BUILD_TREE/src/s60installs runonphone + src_runonphone_target.depends = first + contains(QT_CONFIG, webkit) { + src_runonphone_target.commands += && $(MAKE) -C $$QT_BUILD_TREE/src/3rdparty/webkit/WebCore runonphone + } + QMAKE_EXTRA_TARGETS += src_runonphone_target +} + SUBDIRS += $$SRC_SUBDIRS diff --git a/src/svg/svg.pro b/src/svg/svg.pro index de4bba6..7b5251a 100644 --- a/src/svg/svg.pro +++ b/src/svg/svg.pro @@ -42,11 +42,4 @@ INCLUDEPATH += ../3rdparty/harfbuzz/src symbian:TARGET.UID3=0x2001B2E2 -#zlib support -contains(QT_CONFIG, zlib) { - INCLUDEPATH += ../3rdparty/zlib -} else:!contains(QT_CONFIG, no-zlib) { - symbian:LIBS_PRIVATE += -llibz - else:if(unix|win32-g++*):LIBS_PRIVATE += -lz - else:LIBS += zdll.lib -} +include(../3rdparty/zlib_dependency.pri) diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro index 149291a..a74c9c1 100644 --- a/src/tools/bootstrap/bootstrap.pro +++ b/src/tools/bootstrap/bootstrap.pro @@ -95,25 +95,8 @@ macx: { LIBS += -framework CoreServices } -contains(QT_CONFIG, zlib)|cross_compile { - INCLUDEPATH += ../../3rdparty/zlib - SOURCES+= \ - ../3rdparty/zlib/adler32.c \ - ../3rdparty/zlib/compress.c \ - ../3rdparty/zlib/crc32.c \ - ../3rdparty/zlib/deflate.c \ - ../3rdparty/zlib/gzio.c \ - ../3rdparty/zlib/inffast.c \ - ../3rdparty/zlib/inflate.c \ - ../3rdparty/zlib/inftrees.c \ - ../3rdparty/zlib/trees.c \ - ../3rdparty/zlib/uncompr.c \ - ../3rdparty/zlib/zutil.c -} else:!contains(QT_CONFIG, no-zlib) { - symbian:LIBS_PRIVATE += -llibz - else:if(unix|win32-g++*):LIBS_PRIVATE += -lz - else:LIBS += zdll.lib -} +if(contains(QT_CONFIG, zlib)|cross_compile):include(../../3rdparty/zlib.pri) +else:include(../../3rdparty/zlib_dependency.pri) lib.CONFIG = dummy_install INSTALLS += lib diff --git a/src/winmain/winmain.pro b/src/winmain/winmain.pro index 0c9b214..8c2710c 100644 --- a/src/winmain/winmain.pro +++ b/src/winmain/winmain.pro @@ -12,7 +12,6 @@ win32 { win32-borland:DEFINES += QT_NEEDS_QMAIN SOURCES = qtmain_win.cpp CONFIG += png - CONFIG -= jpeg INCLUDEPATH += tmp $$QMAKE_INCDIR_QT/QtCore } diff --git a/tests/auto/declarative/qdeclarativeimage/data/heart-arm.png b/tests/auto/declarative/qdeclarativeimage/data/heart-arm.png Binary files differnew file mode 100644 index 0000000..3245027 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeimage/data/heart-arm.png diff --git a/tests/auto/declarative/qdeclarativeimage/data/heart-float.png b/tests/auto/declarative/qdeclarativeimage/data/heart-float.png Binary files differdeleted file mode 100644 index 65bd89f..0000000 --- a/tests/auto/declarative/qdeclarativeimage/data/heart-float.png +++ /dev/null diff --git a/tests/auto/declarative/qdeclarativeimage/data/heart200-float.png b/tests/auto/declarative/qdeclarativeimage/data/heart200-arm.png Binary files differindex 786e75d..b16db76 100644 --- a/tests/auto/declarative/qdeclarativeimage/data/heart200-float.png +++ b/tests/auto/declarative/qdeclarativeimage/data/heart200-arm.png diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index ace6712..df029f5 100644 --- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -307,11 +307,10 @@ void tst_qdeclarativeimage::svg() QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart-mac.png")); #elif defined(Q_OS_WIN32) QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart-win32.png")); +#elif defined(QT_ARCH_ARM) + QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart-arm.png")); #else - if (sizeof(qreal) == sizeof(double)) - QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart.png")); - else - QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart-float.png")); + QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart.png")); #endif obj->setSourceSize(QSize(200,200)); @@ -324,11 +323,10 @@ void tst_qdeclarativeimage::svg() QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200-mac.png")); #elif defined(Q_OS_WIN32) QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200-win32.png")); +#elif defined(QT_ARCH_ARM) + QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200-arm.png")); #else - if (sizeof(qreal) == sizeof(double)) - QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200.png")); - else - QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200-float.png")); + QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200.png")); #endif delete obj; } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/qmldir b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/qmldir index 0adb0f6..d15720a 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/qmldir +++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/qmldir @@ -2,4 +2,3 @@ Rectangle 1.5 InstalledTest2.qml LocalLast 1.0 LocalLast.qml InstalledTest 1.4 InstalledTest2.qml InstalledTest 1.0 InstalledTest.qml -InstalledTestTP 0.0 InstalledTest.qml diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest0/InstalledTest.qml b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest0/InstalledTest.qml new file mode 100644 index 0000000..303b5a5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest0/InstalledTest.qml @@ -0,0 +1,2 @@ +import Qt 4.7 as Qt47 +Qt47.Rectangle {} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest0/InstalledTest2.qml b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest0/InstalledTest2.qml new file mode 100644 index 0000000..8c953cb --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest0/InstalledTest2.qml @@ -0,0 +1,2 @@ +import Qt 4.7 +Text {} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest0/qmldir b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest0/qmldir new file mode 100644 index 0000000..b301226 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest0/qmldir @@ -0,0 +1,2 @@ +InstalledTest 1.4 InstalledTest2.qml +InstalledTestTP 0.0 InstalledTest.qml diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index cde25d7..fcdf926 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -1477,12 +1477,12 @@ void tst_qdeclarativelanguage::importsInstalled_data() // import installed QTest::newRow("installed import 0") - << "import com.nokia.installedtest 0.0\n" + << "import com.nokia.installedtest0 0.0\n" "InstalledTestTP {}" << "QDeclarativeRectangle" << ""; QTest::newRow("installed import 0 as TP") - << "import com.nokia.installedtest 0.0 as TP\n" + << "import com.nokia.installedtest0 0.0 as TP\n" "TP.InstalledTestTP {}" << "QDeclarativeRectangle" << ""; @@ -1501,6 +1501,11 @@ void tst_qdeclarativelanguage::importsInstalled_data() "InstalledTest {}" << "QDeclarativeText" << ""; + QTest::newRow("installed import minor version not available") // QTBUG-11936 + << "import com.nokia.installedtest 0.1\n" + "InstalledTest {}" + << "" + << "module \"com.nokia.installedtest\" version 0.1 is not installed"; QTest::newRow("installed import minor version not available") // QTBUG-9627 << "import com.nokia.installedtest 1.10\n" "InstalledTest {}" diff --git a/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp b/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp index f1018b2..0c7780c 100644 --- a/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp +++ b/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp @@ -138,42 +138,37 @@ void tst_qdeclarativepixmapcache::single() expectedError = "Cannot open: " + target.toString(); } - QPixmap pixmap; + QDeclarativePixmap pixmap; QVERIFY(pixmap.width() <= 0); // Check Qt assumption - QString errorString; - QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(target, &pixmap, &errorString); + + pixmap.load(&engine, target); if (incache) { - QCOMPARE(errorString, expectedError); + QCOMPARE(pixmap.error(), expectedError); if (exists) { - QVERIFY(status == QDeclarativePixmapReply::Ready); + QVERIFY(pixmap.status() == QDeclarativePixmap::Ready); QVERIFY(pixmap.width() > 0); } else { - QVERIFY(status == QDeclarativePixmapReply::Error); + QVERIFY(pixmap.status() == QDeclarativePixmap::Error); QVERIFY(pixmap.width() <= 0); } } else { - QDeclarativePixmapReply *reply = QDeclarativePixmapCache::request(&engine, target); - QVERIFY(reply); QVERIFY(pixmap.width() <= 0); Slotter getter; - connect(reply, SIGNAL(finished()), &getter, SLOT(got())); + pixmap.connectFinished(&getter, SLOT(got())); QTestEventLoop::instance().enterLoop(10); QVERIFY(!QTestEventLoop::instance().timeout()); QVERIFY(getter.gotslot); - QString errorString; if (exists) { - QVERIFY(QDeclarativePixmapCache::get(target, &pixmap, &errorString) == QDeclarativePixmapReply::Ready); + QVERIFY(pixmap.status() == QDeclarativePixmap::Ready); QVERIFY(pixmap.width() > 0); } else { - QVERIFY(QDeclarativePixmapCache::get(target, &pixmap, &errorString) == QDeclarativePixmapReply::Error); + QVERIFY(pixmap.status() == QDeclarativePixmap::Error); QVERIFY(pixmap.width() <= 0); } - QCOMPARE(errorString, expectedError); + QCOMPARE(pixmap.error(), expectedError); } - - QCOMPARE(QDeclarativePixmapCache::pendingRequests(), 0); } void tst_qdeclarativepixmapcache::parallel_data() @@ -185,47 +180,36 @@ void tst_qdeclarativepixmapcache::parallel_data() QTest::addColumn<QUrl>("target2"); QTest::addColumn<int>("incache"); QTest::addColumn<int>("cancel"); // which one to cancel - QTest::addColumn<int>("requests"); QTest::newRow("local") << thisfile.resolved(QUrl("data/exists1.png")) << thisfile.resolved(QUrl("data/exists2.png")) << (localfile_optimized ? 2 : 0) - << -1 - << (localfile_optimized ? 0 : 2) - ; + << -1; QTest::newRow("remote") << QUrl("http://127.0.0.1:14452/exists2.png") << QUrl("http://127.0.0.1:14452/exists3.png") << 0 - << -1 - << 2 - ; + << -1; QTest::newRow("remoteagain") << QUrl("http://127.0.0.1:14452/exists2.png") << QUrl("http://127.0.0.1:14452/exists3.png") << 2 - << -1 - << 0 - ; + << -1; QTest::newRow("remotecopy") << QUrl("http://127.0.0.1:14452/exists4.png") << QUrl("http://127.0.0.1:14452/exists4.png") << 0 - << -1 - << 1 - ; + << -1; QTest::newRow("remotecopycancel") << QUrl("http://127.0.0.1:14452/exists5.png") << QUrl("http://127.0.0.1:14452/exists5.png") << 0 - << 0 - << 1 - ; + << 0; } void tst_qdeclarativepixmapcache::parallel() @@ -234,38 +218,38 @@ void tst_qdeclarativepixmapcache::parallel() QFETCH(QUrl, target2); QFETCH(int, incache); QFETCH(int, cancel); - QFETCH(int, requests); QList<QUrl> targets; targets << target1 << target2; - QList<QDeclarativePixmapReply*> replies; + QList<QDeclarativePixmap *> pixmaps; + QList<bool> pending; QList<Slotter*> getters; + for (int i=0; i<targets.count(); ++i) { QUrl target = targets.at(i); - QPixmap pixmap; - QString errorString; - QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(target, &pixmap, &errorString); - QDeclarativePixmapReply *reply = 0; - QVERIFY(status != QDeclarativePixmapReply::Error); - if (status != QDeclarativePixmapReply::Error && status != QDeclarativePixmapReply::Ready) - reply = QDeclarativePixmapCache::request(&engine, target); - replies.append(reply); - if (!reply) { - QVERIFY(pixmap.width() > 0); + QDeclarativePixmap *pixmap = new QDeclarativePixmap; + + pixmap->load(&engine, target); + + QVERIFY(pixmap->status() != QDeclarativePixmap::Error); + pixmaps.append(pixmap); + if (pixmap->isReady()) { + QVERIFY(pixmap->width() > 0); getters.append(0); + pending.append(false); } else { - QVERIFY(pixmap.width() <= 0); + QVERIFY(pixmap->width() <= 0); getters.append(new Slotter); - connect(reply, SIGNAL(finished()), getters[i], SLOT(got())); + pixmap->connectFinished(getters[i], SLOT(got())); + pending.append(true); } } QCOMPARE(incache+slotters, targets.count()); - QCOMPARE(QDeclarativePixmapCache::pendingRequests(), requests); if (cancel >= 0) { - QDeclarativePixmapCache::cancel(targets.at(cancel), getters[cancel]); + pixmaps.at(cancel)->clear(getters[cancel]); slotters--; } @@ -275,22 +259,21 @@ void tst_qdeclarativepixmapcache::parallel() } for (int i=0; i<targets.count(); ++i) { - QDeclarativePixmapReply *reply = replies[i]; - if (reply) { - if (i == cancel) { - QVERIFY(!getters[i]->gotslot); - } else { + QDeclarativePixmap *pixmap = pixmaps[i]; + + if (i == cancel) { + QVERIFY(!getters[i]->gotslot); + } else { + if (pending[i]) QVERIFY(getters[i]->gotslot); - QPixmap pixmap; - QString errorString; - QVERIFY(QDeclarativePixmapCache::get(targets[i], &pixmap, &errorString) == QDeclarativePixmapReply::Ready); - QVERIFY(pixmap.width() > 0); - } + + QVERIFY(pixmap->isReady()); + QVERIFY(pixmap->width() > 0); delete getters[i]; } } - QCOMPARE(QDeclarativePixmapCache::pendingRequests(), 0); + qDeleteAll(pixmaps); } QTEST_MAIN(tst_qdeclarativepixmapcache) diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index fc329c8..2025504 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -53,9 +53,11 @@ #include <private/qdeclarativetextedit_p_p.h> #include <QFontMetrics> #include <QDeclarativeView> +#include <QDir> #include <QStyle> #include <QInputContext> #include <private/qapplication_p.h> +#include <private/qtextcontrol_p.h> #ifdef Q_OS_SYMBIAN // In Symbian OS test data is located in applications private dir @@ -306,17 +308,17 @@ void tst_qdeclarativetextedit::alignments_data() QTest::addColumn<int>("vAlign"); QTest::addColumn<QString>("expectfile"); - QTest::newRow("LT") << int(Qt::AlignLeft) << int(Qt::AlignTop) << SRCDIR "/data/alignments_lt.png"; - QTest::newRow("RT") << int(Qt::AlignRight) << int(Qt::AlignTop) << SRCDIR "/data/alignments_rt.png"; - QTest::newRow("CT") << int(Qt::AlignHCenter) << int(Qt::AlignTop) << SRCDIR "/data/alignments_ct.png"; + QTest::newRow("LT") << int(Qt::AlignLeft) << int(Qt::AlignTop) << "alignments_lt"; + QTest::newRow("RT") << int(Qt::AlignRight) << int(Qt::AlignTop) << "alignments_rt"; + QTest::newRow("CT") << int(Qt::AlignHCenter) << int(Qt::AlignTop) << "alignments_ct"; - QTest::newRow("LB") << int(Qt::AlignLeft) << int(Qt::AlignBottom) << SRCDIR "/data/alignments_lb.png"; - QTest::newRow("RB") << int(Qt::AlignRight) << int(Qt::AlignBottom) << SRCDIR "/data/alignments_rb.png"; - QTest::newRow("CB") << int(Qt::AlignHCenter) << int(Qt::AlignBottom) << SRCDIR "/data/alignments_cb.png"; + QTest::newRow("LB") << int(Qt::AlignLeft) << int(Qt::AlignBottom) << "alignments_lb"; + QTest::newRow("RB") << int(Qt::AlignRight) << int(Qt::AlignBottom) << "alignments_rb"; + QTest::newRow("CB") << int(Qt::AlignHCenter) << int(Qt::AlignBottom) << "alignments_cb"; - QTest::newRow("LC") << int(Qt::AlignLeft) << int(Qt::AlignVCenter) << SRCDIR "/data/alignments_lc.png"; - QTest::newRow("RC") << int(Qt::AlignRight) << int(Qt::AlignVCenter) << SRCDIR "/data/alignments_rc.png"; - QTest::newRow("CC") << int(Qt::AlignHCenter) << int(Qt::AlignVCenter) << SRCDIR "/data/alignments_cc.png"; + QTest::newRow("LC") << int(Qt::AlignLeft) << int(Qt::AlignVCenter) << "alignments_lc"; + QTest::newRow("RC") << int(Qt::AlignRight) << int(Qt::AlignVCenter) << "alignments_rc"; + QTest::newRow("CC") << int(Qt::AlignHCenter) << int(Qt::AlignVCenter) << "alignments_cc"; } @@ -326,13 +328,6 @@ void tst_qdeclarativetextedit::alignments() QFETCH(int, vAlign); QFETCH(QString, expectfile); -#ifdef Q_WS_X11 - // Font-specific, but not likely platform-specific, so only test on one platform - QFont fn; - fn.setRawName("-misc-fixed-medium-r-*-*-8-*-*-*-*-*-*-*"); - QApplication::setFont(fn); -#endif - QDeclarativeView *canvas = createView(SRCDIR "/data/alignments.qml"); canvas->show(); @@ -350,14 +345,20 @@ void tst_qdeclarativetextedit::alignments() QPainter p(&actual); canvas->render(&p); - QImage expect(expectfile); + // XXX This will be replaced by some clever persistent platform image store. + QString persistent_dir = SRCDIR "/data"; + QString arch = "unknown-architecture"; // QTest needs to help with this. + + expectfile = persistent_dir + QDir::separator() + expectfile + "-" + arch + ".png"; -#ifdef Q_WS_X11 - // Font-specific, but not likely platform-specific, so only test on one platform - if (QApplicationPrivate::graphics_system_name == "raster" || QApplicationPrivate::graphics_system_name == "") { - QCOMPARE(actual,expect); + if (!QFile::exists(expectfile)) { + actual.save(expectfile); + qWarning() << "created" << expectfile; } -#endif + + QImage expect(expectfile); + + QCOMPARE(actual,expect); } @@ -492,6 +493,23 @@ void tst_qdeclarativetextedit::font() void tst_qdeclarativetextedit::color() { + //test initial color + { + QString componentStr = "import Qt 4.7\nTextEdit { text: \"Hello World\" }"; + QDeclarativeComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); + + QDeclarativeTextEditPrivate *textEditPrivate = static_cast<QDeclarativeTextEditPrivate*>(QDeclarativeItemPrivate::get(textEditObject)); + + QVERIFY(textEditObject); + QVERIFY(textEditPrivate); + QVERIFY(textEditPrivate->control); + + QPalette pal = textEditPrivate->control->palette(); + QCOMPARE(textEditPrivate->color, QColor("black")); + QCOMPARE(textEditPrivate->color, pal.color(QPalette::Text)); + } //test normal for (int i = 0; i < colorStrings.size(); i++) { diff --git a/tests/auto/declarative/qdeclarativetextinput/data/inputmethodhints.qml b/tests/auto/declarative/qdeclarativetextinput/data/inputmethods.qml index da6b81f..405ee22 100644 --- a/tests/auto/declarative/qdeclarativetextinput/data/inputmethodhints.qml +++ b/tests/auto/declarative/qdeclarativetextinput/data/inputmethods.qml @@ -3,4 +3,5 @@ import Qt 4.7 TextInput { text: "Hello world!" inputMethodHints: Qt.ImhNoPredictiveText + Keys.onLeftPressed: {} } diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index a21630b..5354f42 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -79,7 +79,7 @@ private slots: void maxLength(); void masks(); void validators(); - void inputMethodHints(); + void inputMethods(); void cursorDelegate(); void navigation(); @@ -175,7 +175,8 @@ void tst_qdeclarativetextinput::width() QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); QVERIFY(textinputObject != 0); - QCOMPARE(textinputObject->width(), qreal(metricWidth) + 1.);//1 for the cursor + int delta = abs(int(textinputObject->width()) - metricWidth); + QVERIFY(delta <= 3.0); // As best as we can hope for cross-platform. delete textinputObject; } @@ -608,18 +609,31 @@ void tst_qdeclarativetextinput::validators() delete canvas; } -void tst_qdeclarativetextinput::inputMethodHints() +void tst_qdeclarativetextinput::inputMethods() { - QDeclarativeView *canvas = createView(SRCDIR "/data/inputmethodhints.qml"); + QDeclarativeView *canvas = createView(SRCDIR "/data/inputmethods.qml"); canvas->show(); canvas->setFocus(); + QApplication::setActiveWindow(canvas); + QTest::qWaitForWindowShown(canvas); + // test input method hints QVERIFY(canvas->rootObject() != 0); - QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput *>(canvas->rootObject()); - QVERIFY(textinputObject != 0); - QVERIFY(textinputObject->inputMethodHints() & Qt::ImhNoPredictiveText); - textinputObject->setInputMethodHints(Qt::ImhUppercaseOnly); - QVERIFY(textinputObject->inputMethodHints() & Qt::ImhUppercaseOnly); + QDeclarativeTextInput *input = qobject_cast<QDeclarativeTextInput *>(canvas->rootObject()); + QVERIFY(input != 0); + QVERIFY(input->inputMethodHints() & Qt::ImhNoPredictiveText); + input->setInputMethodHints(Qt::ImhUppercaseOnly); + QVERIFY(input->inputMethodHints() & Qt::ImhUppercaseOnly); + + QVERIFY(canvas->rootObject() != 0); + + input->setFocus(true); + QVERIFY(input->hasFocus() == true); + // test that input method event is committed + QInputMethodEvent event; + event.setCommitString( "My ", -12, 0); + QApplication::sendEvent(canvas, &event); + QCOMPARE(input->text(), QString("My Hello world!")); delete canvas; } diff --git a/tests/auto/qdatetime/tst_qdatetime.cpp b/tests/auto/qdatetime/tst_qdatetime.cpp index 47c54a5..0900b35 100644 --- a/tests/auto/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/qdatetime/tst_qdatetime.cpp @@ -1456,6 +1456,12 @@ void tst_QDateTime::fromString() dt = QDateTime::fromString("2002-10-01", Qt::ISODate); QCOMPARE(dt, QDateTime(QDate(2002, 10, 1), QTime(0, 0, 0, 0))); + dt = QDateTime::fromString("1987-02-13T13:24:51+01:00", Qt::ISODate); + QCOMPARE(dt, QDateTime(QDate(1987, 2, 13), QTime(12, 24, 51), Qt::UTC)); + + dt = QDateTime::fromString("1987-02-13T13:24:51-01:00", Qt::ISODate); + QCOMPARE(dt, QDateTime(QDate(1987, 2, 13), QTime(14, 24, 51), Qt::UTC)); + dt = QDateTime::fromString("Thu Jan 1 00:12:34 1970 GMT"); QCOMPARE(dt.toUTC(), QDateTime(QDate(1970, 1, 1), QTime(0, 12, 34), Qt::UTC)); diff --git a/tests/benchmarks/gui/text/qtext/main.cpp b/tests/benchmarks/gui/text/qtext/main.cpp index eaa23e9..63daae0 100644 --- a/tests/benchmarks/gui/text/qtext/main.cpp +++ b/tests/benchmarks/gui/text/qtext/main.cpp @@ -84,9 +84,11 @@ private slots: void newLineReplacement(); void formatManipulation(); + void fontResolution(); void layout_data(); void layout(); + void formattedLayout(); void paintLayoutToPixmap(); void paintLayoutToPixmap_painterFill(); @@ -306,6 +308,18 @@ void tst_QText::formatManipulation() } } +void tst_QText::fontResolution() +{ + QFont font; + QFont font2; + font.setFamily("DejaVu"); + font2.setBold(true); + + QBENCHMARK { + QFont res = font.resolve(font2); + } +} + void tst_QText::layout_data() { QTest::addColumn<bool>("wrap"); @@ -339,6 +353,33 @@ void tst_QText::layout() } }*/ +void tst_QText::formattedLayout() +{ + //set up formatting + QList<QTextLayout::FormatRange> ranges; + { + QTextCharFormat format; + format.setForeground(QColor("steelblue")); + + QTextLayout::FormatRange formatRange; + formatRange.format = format; + formatRange.start = 0; + formatRange.length = 50; + + ranges.append(formatRange); + } + + QTextLayout layout(m_shortLorem); + layout.setAdditionalFormats(ranges); + setupTextLayout(&layout); + + QBENCHMARK { + QTextLayout layout(m_shortLorem); + layout.setAdditionalFormats(ranges); + setupTextLayout(&layout); + } +} + void tst_QText::paintLayoutToPixmap() { QTextLayout layout(m_shortLorem); diff --git a/tools/assistant/tools/qcollectiongenerator/main.cpp b/tools/assistant/tools/qcollectiongenerator/main.cpp index 7fcb4e1..b3f6bd9 100644 --- a/tools/assistant/tools/qcollectiongenerator/main.cpp +++ b/tools/assistant/tools/qcollectiongenerator/main.cpp @@ -459,6 +459,8 @@ int main(int argc, char *argv[]) return -1; } } + if (!config.filesToRegister().isEmpty()) + CollectionConfiguration::updateLastRegisterTime(helpEngine); if (!config.title().isEmpty()) CollectionConfiguration::setWindowTitle(helpEngine, config.title()); diff --git a/tools/configure/configure.pro b/tools/configure/configure.pro index 64a6d9a..73f3317 100644 --- a/tools/configure/configure.pro +++ b/tools/configure/configure.pro @@ -23,7 +23,8 @@ win32-msvc* { PRECOMPILED_HEADER = configure_pch.h -INCPATH += $$QT_SOURCE_TREE/src/corelib/arch/generic \ +INCLUDEPATH += \ + $$QT_SOURCE_TREE/src/corelib/arch/generic \ $$QT_SOURCE_TREE/src/corelib/global \ $$QT_BUILD_TREE/include \ $$QT_BUILD_TREE/include/QtCore \ diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index c3de09e..952d4e0 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -581,17 +581,13 @@ void Configure::parseCmdLine() // Image formats -------------------------------------------- else if (configCmdLine.at(i) == "-no-gif") dictionary[ "GIF" ] = "no"; - else if( configCmdLine.at(i) == "-qt-gif" ) - dictionary[ "GIF" ] = "auto"; else if (configCmdLine.at(i) == "-no-libtiff") { dictionary[ "TIFF"] = "no"; dictionary[ "LIBTIFF" ] = "no"; } else if (configCmdLine.at(i) == "-qt-libtiff") { - dictionary[ "TIFF" ] = "plugin"; dictionary[ "LIBTIFF" ] = "qt"; } else if (configCmdLine.at(i) == "-system-libtiff") { - dictionary[ "TIFF" ] = "plugin"; dictionary[ "LIBTIFF" ] = "system"; } @@ -599,10 +595,8 @@ void Configure::parseCmdLine() dictionary[ "JPEG" ] = "no"; dictionary[ "LIBJPEG" ] = "no"; } else if (configCmdLine.at(i) == "-qt-libjpeg") { - dictionary[ "JPEG" ] = "plugin"; dictionary[ "LIBJPEG" ] = "qt"; } else if (configCmdLine.at(i) == "-system-libjpeg") { - dictionary[ "JPEG" ] = "plugin"; dictionary[ "LIBJPEG" ] = "system"; } @@ -610,10 +604,8 @@ void Configure::parseCmdLine() dictionary[ "PNG" ] = "no"; dictionary[ "LIBPNG" ] = "no"; } else if (configCmdLine.at(i) == "-qt-libpng") { - dictionary[ "PNG" ] = "qt"; dictionary[ "LIBPNG" ] = "qt"; } else if (configCmdLine.at(i) == "-system-libpng") { - dictionary[ "PNG" ] = "qt"; dictionary[ "LIBPNG" ] = "system"; } @@ -621,10 +613,8 @@ void Configure::parseCmdLine() dictionary[ "MNG" ] = "no"; dictionary[ "LIBMNG" ] = "no"; } else if (configCmdLine.at(i) == "-qt-libmng") { - dictionary[ "MNG" ] = "qt"; dictionary[ "LIBMNG" ] = "qt"; } else if (configCmdLine.at(i) == "-system-libmng") { - dictionary[ "MNG" ] = "qt"; dictionary[ "LIBMNG" ] = "system"; } @@ -1750,22 +1740,22 @@ bool Configure::displayHelp() desc("ZLIB", "qt", "-qt-zlib", "Use the zlib bundled with Qt."); desc("ZLIB", "system", "-system-zlib", "Use zlib from the operating system.\nSee http://www.gzip.org/zlib\n"); - desc("GIF", "no", "-no-gif", "Do not compile the plugin for GIF reading support."); - desc("GIF", "auto", "-qt-gif", "Compile the plugin for GIF reading support.\nSee also src/plugins/imageformats/gif/qgifhandler.h\n"); + desc("GIF", "no", "-no-gif", "Do not compile GIF reading support."); + desc("GIF", "auto", "-qt-gif", "Compile GIF reading support.\nSee also src/gui/image/qgifhandler.h\n"); - desc("LIBPNG", "no", "-no-libpng", "Do not compile in PNG support."); + desc("LIBPNG", "no", "-no-libpng", "Do not compile PNG support."); desc("LIBPNG", "qt", "-qt-libpng", "Use the libpng bundled with Qt."); desc("LIBPNG", "system","-system-libpng", "Use libpng from the operating system.\nSee http://www.libpng.org/pub/png\n"); - desc("LIBMNG", "no", "-no-libmng", "Do not compile in MNG support."); + desc("LIBMNG", "no", "-no-libmng", "Do not compile MNG support."); desc("LIBMNG", "qt", "-qt-libmng", "Use the libmng bundled with Qt."); desc("LIBMNG", "system","-system-libmng", "Use libmng from the operating system.\nSee See http://www.libmng.com\n"); - desc("LIBTIFF", "no", "-no-libtiff", "Do not compile the plugin for TIFF support."); + desc("LIBTIFF", "no", "-no-libtiff", "Do not compile TIFF support."); desc("LIBTIFF", "qt", "-qt-libtiff", "Use the libtiff bundled with Qt."); desc("LIBTIFF", "system","-system-libtiff", "Use libtiff from the operating system.\nSee http://www.libtiff.org\n"); - desc("LIBJPEG", "no", "-no-libjpeg", "Do not compile the plugin for JPEG support."); + desc("LIBJPEG", "no", "-no-libjpeg", "Do not compile JPEG support."); desc("LIBJPEG", "qt", "-qt-libjpeg", "Use the libjpeg bundled with Qt."); desc("LIBJPEG", "system","-system-libjpeg", "Use libjpeg from the operating system.\nSee http://www.ijg.org\n"); @@ -1957,21 +1947,28 @@ QString Configure::defaultTo(const QString &option) || option == "LIBTIFF") return "system"; - // We want PNG built-in + // PNG is always built-in, never a plugin if (option == "PNG") - return "qt"; + return "yes"; - // The JPEG image library can only be a plugin - if (option == "JPEG" - || option == "MNG" || option == "TIFF") - return "plugin"; - - // GIF off by default - if (option == "GIF") { - if (dictionary["SHARED"] == "yes") + // These database drivers and image formats can be built-in or plugins. + // Prefer plugins when Qt is shared. + if (dictionary[ "SHARED" ] == "yes") { + if (option == "SQL_MYSQL" + || option == "SQL_MYSQL" + || option == "SQL_ODBC" + || option == "SQL_OCI" + || option == "SQL_PSQL" + || option == "SQL_TDS" + || option == "SQL_DB2" + || option == "SQL_SQLITE" + || option == "SQL_SQLITE2" + || option == "SQL_IBASE" + || option == "JPEG" + || option == "MNG" + || option == "TIFF" + || option == "GIF") return "plugin"; - else - return "yes"; } // By default we do not want to compile OCI driver when compiling with @@ -1981,18 +1978,6 @@ QString Configure::defaultTo(const QString &option) && option == "SQL_OCI") return "no"; - if (option == "SQL_MYSQL" - || option == "SQL_MYSQL" - || option == "SQL_ODBC" - || option == "SQL_OCI" - || option == "SQL_PSQL" - || option == "SQL_TDS" - || option == "SQL_DB2" - || option == "SQL_SQLITE" - || option == "SQL_SQLITE2" - || option == "SQL_IBASE") - return "plugin"; - if (option == "SYNCQT" && (!QFile::exists(sourcePath + "/bin/syncqt") || !QFile::exists(sourcePath + "/bin/syncqt.bat"))) @@ -2469,14 +2454,14 @@ void Configure::generateOutputVars() if (dictionary[ "PNG" ] == "no") qtConfig += "no-png"; - else if( dictionary[ "PNG" ] == "qt" ) + else if (dictionary[ "PNG" ] == "yes") qtConfig += "png"; if (dictionary[ "LIBPNG" ] == "system") qtConfig += "system-png"; if (dictionary[ "MNG" ] == "no") qtConfig += "no-mng"; - else if( dictionary[ "MNG" ] == "qt" ) + else if (dictionary[ "MNG" ] == "yes") qtConfig += "mng"; if (dictionary[ "LIBMNG" ] == "system") qtConfig += "system-mng"; @@ -3048,10 +3033,10 @@ void Configure::generateConfigfiles() if (dictionary["STYLE_GTK"] != "yes") qconfigList += "QT_NO_STYLE_GTK"; if (dictionary["GIF"] == "yes") qconfigList += "QT_BUILTIN_GIF_READER=1"; - if (dictionary["PNG"] == "no") qconfigList += "QT_NO_IMAGEFORMAT_PNG"; - if (dictionary["MNG"] == "no") qconfigList += "QT_NO_IMAGEFORMAT_MNG"; - if (dictionary["JPEG"] == "no") qconfigList += "QT_NO_IMAGEFORMAT_JPEG"; - if (dictionary["TIFF"] == "no") qconfigList += "QT_NO_IMAGEFORMAT_TIFF"; + if (dictionary["PNG"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_PNG"; + if (dictionary["MNG"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_MNG"; + if (dictionary["JPEG"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_JPEG"; + if (dictionary["TIFF"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_TIFF"; if (dictionary["ZLIB"] == "no") { qconfigList += "QT_NO_ZLIB"; qconfigList += "QT_NO_COMPRESS"; diff --git a/tools/designer/src/components/buddyeditor/buddyeditor.cpp b/tools/designer/src/components/buddyeditor/buddyeditor.cpp index 9da257e..e367f9a 100644 --- a/tools/designer/src/components/buddyeditor/buddyeditor.cpp +++ b/tools/designer/src/components/buddyeditor/buddyeditor.cpp @@ -405,6 +405,7 @@ QWidget *BuddyEditor::findBuddy(QLabel *l, const QWidgetList &existingBuddies) c const int y = geom.center().y(); QWidget *neighbour = 0; switch (l->layoutDirection()) { + case Qt::LayoutDirectionAuto: case Qt::LeftToRight: { // Walk right to find next managed neighbour const int xEnd = parent->size().width(); for (int x = geom.right() + 1; x < xEnd; x += DeltaX) diff --git a/tools/designer/src/components/formeditor/qmdiarea_container.cpp b/tools/designer/src/components/formeditor/qmdiarea_container.cpp index 5971094..5e266f4 100644 --- a/tools/designer/src/components/formeditor/qmdiarea_container.cpp +++ b/tools/designer/src/components/formeditor/qmdiarea_container.cpp @@ -105,6 +105,7 @@ void QMdiAreaContainer::positionNewMdiChild(const QWidget *area, QWidget *mdiChi const QPoint pos = mdiChild->pos(); const QSize areaSize = area->size(); switch (QApplication::layoutDirection()) { + case Qt::LayoutDirectionAuto: case Qt::LeftToRight: { const QSize fullSize = QSize(areaSize.width() - pos.x(), areaSize.height() - pos.y()); if (fullSize.width() > MinSize && fullSize.height() > MinSize) diff --git a/tools/designer/src/lib/shared/qdesigner_menu.cpp b/tools/designer/src/lib/shared/qdesigner_menu.cpp index ba512e4..31a226a 100644 --- a/tools/designer/src/lib/shared/qdesigner_menu.cpp +++ b/tools/designer/src/lib/shared/qdesigner_menu.cpp @@ -77,6 +77,7 @@ using namespace qdesigner_internal; static inline void extendClickableArea(QRect *subMenuRect, Qt::LayoutDirection dir) { switch (dir) { + case Qt::LayoutDirectionAuto: // Should never happen case Qt::LeftToRight: subMenuRect->setLeft(subMenuRect->left() - 20); break; @@ -931,8 +932,8 @@ void QDesignerMenu::moveUp(bool ctrl) if (ctrl) (void) swap(m_currentIndex, m_currentIndex - 1); - - m_currentIndex = qMax(0, --m_currentIndex); + --m_currentIndex; + m_currentIndex = qMax(0, m_currentIndex); // Always re-select, swapping destroys order update(); selectCurrentAction(); @@ -947,7 +948,8 @@ void QDesignerMenu::moveDown(bool ctrl) if (ctrl) (void) swap(m_currentIndex + 1, m_currentIndex); - m_currentIndex = qMin(actions().count() - 1, ++m_currentIndex); + ++m_currentIndex; + m_currentIndex = qMin(actions().count() - 1, m_currentIndex); update(); if (!ctrl) selectCurrentAction(); diff --git a/tools/designer/src/lib/shared/qdesigner_toolbar.cpp b/tools/designer/src/lib/shared/qdesigner_toolbar.cpp index 02a2f6d..e3bc64c 100644 --- a/tools/designer/src/lib/shared/qdesigner_toolbar.cpp +++ b/tools/designer/src/lib/shared/qdesigner_toolbar.cpp @@ -467,6 +467,7 @@ QRect ToolBarEventFilter::freeArea(const QToolBar *tb) switch (tb->orientation()) { case Qt::Horizontal: switch (tb->layoutDirection()) { + case Qt::LayoutDirectionAuto: // Should never happen case Qt::LeftToRight: rc.setX(exclusionRectangle.right() + 1); break; diff --git a/tools/qdoc3/doc/qdoc-manual.qdoc b/tools/qdoc3/doc/qdoc-manual.qdoc index 57c17ba..c3ab731 100644 --- a/tools/qdoc3/doc/qdoc-manual.qdoc +++ b/tools/qdoc3/doc/qdoc-manual.qdoc @@ -8075,6 +8075,27 @@ qhp.Qt.subprojects.examples.indexTitle = Qt Examples qhp.Qt.subprojects.examples.selectors = fake:example \endcode + + To create a table of contents for a manual, create a subproject with + a \c{type} property and set it to \c{manual}. The page in the documentation + referred to by the \c{indexTitle} property must contain a list of links + that acts as a table of contents for the whole manual. QDoc will take the + information in this list and create a table of contents for the subproject. + + For example, the configuration file for Qt Creator defines only one + subproject for its documentation, including all the documentation in a + single manual: + + \code + qhp.QtCreator.subprojects = manual + qhp.QtCreator.subprojects.manual.title = Qt Creator Manual + qhp.QtCreator.subprojects.manual.indexTitle = Qt Creator Manual + qhp.QtCreator.subprojects.manual.type = manual + \endcode + + In this example, the page entitled "Qt Creator Manual" contains a nested + list of links to pages in the documentation which is duplicated in + Qt Assistant's Contents tab. */ /*! diff --git a/tools/qdoc3/helpprojectwriter.cpp b/tools/qdoc3/helpprojectwriter.cpp index edba097..98246c4 100644 --- a/tools/qdoc3/helpprojectwriter.cpp +++ b/tools/qdoc3/helpprojectwriter.cpp @@ -41,7 +41,7 @@ #include <QHash> #include <QMap> -#include <qdebug.h> +//#include <qdebug.h> #include "atom.h" #include "helpprojectwriter.h" @@ -91,6 +91,7 @@ HelpProjectWriter::HelpProjectWriter(const Config &config, const QString &defaul subproject.title = config.getString(subprefix + "title"); subproject.indexTitle = config.getString(subprefix + "indexTitle"); subproject.sortPages = config.getBool(subprefix + "sortPages"); + subproject.type = config.getString(subprefix + "type"); readSelectors(subproject, config.getStringList(subprefix + "selectors")); project.subprojects[name] = subproject; } @@ -625,44 +626,99 @@ void HelpProjectWriter::generateProject(HelpProject &project) foreach (const QString &name, project.subprojects.keys()) { SubProject subproject = project.subprojects[name]; - if (!name.isEmpty()) { - writer.writeStartElement("section"); - QString indexPath = tree->fullDocumentLocation(tree->findFakeNodeByTitle(subproject.indexTitle)); - writer.writeAttribute("ref", HtmlGenerator::cleanRef(indexPath)); - writer.writeAttribute("title", subproject.title); - project.files.insert(indexPath); - } - if (subproject.sortPages) { - QStringList titles = subproject.nodes.keys(); - titles.sort(); - foreach (const QString &title, titles) - writeNode(project, writer, subproject.nodes[title]); + if (subproject.type == QLatin1String("manual")) { + + const FakeNode *indexPage = tree->findFakeNodeByTitle(subproject.indexTitle); + if (indexPage) { + Text indexBody = indexPage->doc().body(); + const Atom *atom = indexBody.firstAtom(); + QStack<int> sectionStack; + bool inItem = false; + + while (atom) { + switch (atom->type()) { + case Atom::ListLeft: + sectionStack.push(0); + break; + case Atom::ListRight: + if (sectionStack.pop() > 0) + writer.writeEndElement(); // section + break; + case Atom::ListItemLeft: + inItem = true; + break; + case Atom::ListItemRight: + inItem = false; + break; + case Atom::Link: + if (inItem) { + if (sectionStack.top() > 0) + writer.writeEndElement(); // section + + const FakeNode *page = tree->findFakeNodeByTitle(atom->string()); + writer.writeStartElement("section"); + QString indexPath = tree->fullDocumentLocation(page); + writer.writeAttribute("ref", HtmlGenerator::cleanRef(indexPath)); + writer.writeAttribute("title", atom->string()); + project.files.insert(indexPath); + + sectionStack.top() += 1; + } + break; + default: + ; + } + + if (atom == indexBody.lastAtom()) + break; + atom = atom->next(); + } + } else + rootNode->doc().location().warning( + tr("Failed to find index: %1").arg(subproject.indexTitle) + ); + } else { - // Find a contents node and navigate from there, using the NextLink values. - foreach (const Node *node, subproject.nodes) { - QString nextTitle = node->links().value(Node::NextLink).first; - if (!nextTitle.isEmpty() && - node->links().value(Node::ContentsLink).first.isEmpty()) { - - FakeNode *nextPage = const_cast<FakeNode *>(tree->findFakeNodeByTitle(nextTitle)); - - // Write the contents node. - writeNode(project, writer, node); - - while (nextPage) { - writeNode(project, writer, nextPage); - nextTitle = nextPage->links().value(Node::NextLink).first; - if(nextTitle.isEmpty()) - break; - nextPage = const_cast<FakeNode *>(tree->findFakeNodeByTitle(nextTitle)); + + if (!name.isEmpty()) { + writer.writeStartElement("section"); + QString indexPath = tree->fullDocumentLocation(tree->findFakeNodeByTitle(subproject.indexTitle)); + writer.writeAttribute("ref", HtmlGenerator::cleanRef(indexPath)); + writer.writeAttribute("title", subproject.title); + project.files.insert(indexPath); + } + if (subproject.sortPages) { + QStringList titles = subproject.nodes.keys(); + titles.sort(); + foreach (const QString &title, titles) + writeNode(project, writer, subproject.nodes[title]); + } else { + // Find a contents node and navigate from there, using the NextLink values. + foreach (const Node *node, subproject.nodes) { + QString nextTitle = node->links().value(Node::NextLink).first; + if (!nextTitle.isEmpty() && + node->links().value(Node::ContentsLink).first.isEmpty()) { + + FakeNode *nextPage = const_cast<FakeNode *>(tree->findFakeNodeByTitle(nextTitle)); + + // Write the contents node. + writeNode(project, writer, node); + + while (nextPage) { + writeNode(project, writer, nextPage); + nextTitle = nextPage->links().value(Node::NextLink).first; + if(nextTitle.isEmpty()) + break; + nextPage = const_cast<FakeNode *>(tree->findFakeNodeByTitle(nextTitle)); + } + break; } - break; } } - } - if (!name.isEmpty()) - writer.writeEndElement(); // section + if (!name.isEmpty()) + writer.writeEndElement(); // section + } } writer.writeEndElement(); // section diff --git a/tools/qdoc3/helpprojectwriter.h b/tools/qdoc3/helpprojectwriter.h index 511a9dd..7a67dff 100644 --- a/tools/qdoc3/helpprojectwriter.h +++ b/tools/qdoc3/helpprojectwriter.h @@ -60,6 +60,7 @@ struct SubProject QString indexTitle; QHash<Node::Type, QSet<FakeNode::SubType> > selectors; bool sortPages; + QString type; QHash<QString, const Node *> nodes; }; diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 9f745c5..49ba5f6 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -61,6 +61,7 @@ QT_BEGIN_NAMESPACE #define COMMAND_VERSION Doc::alias("version") int HtmlGenerator::id = 0; +bool HtmlGenerator::debugging_on = false; QString HtmlGenerator::sinceTitles[] = { @@ -2703,6 +2704,7 @@ void HtmlGenerator::generateQmlItem(const Node *node, marked.replace("</@type>", ""); } out() << highlightedCode(marked, marker, relative); + debugging_on = false; } #endif @@ -3097,9 +3099,8 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode, for (int k = 0; k != 3; ++k) { if (parseArg(src, typeTags[k], &i, n, &arg, &par1)) { par1 = QStringRef(); - QString link = linkForNode( - marker->resolveTarget(arg.toString(), myTree, relative), - relative); + const Node* n = marker->resolveTarget(arg.toString(), myTree, relative); + QString link = linkForNode(n,relative); addLink(link, arg, &html); handled = true; break; @@ -4464,14 +4465,13 @@ void HtmlGenerator::generateDetailedQmlMember(const Node *node, while (p != qpgn->childNodes().end()) { if ((*p)->type() == Node::QmlProperty) { qpn = static_cast<const QmlPropertyNode*>(*p); - - if (++numTableRows % 2 == 1) - out() << "<tr class=\"odd\">"; - else - out() << "<tr class=\"even\">"; + if (++numTableRows % 2 == 1) + out() << "<tr class=\"odd\">"; + else + out() << "<tr class=\"even\">"; - out() << "<td><p>"; - //out() << "<tr><td>"; // old + out() << "<td><p>"; + out() << "<a name=\"" + refForNode(qpn) + "\"></a>"; if (!qpn->isWritable()) out() << "<span class=\"qmlreadonly\">read-only</span>"; diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index e060257..aad5021 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -341,6 +341,8 @@ class HtmlGenerator : public PageGenerator NewClassMaps newClassMaps; NewClassMaps newQmlClassMaps; static int id; + public: + static bool debugging_on; }; #define HTMLGENERATOR_ADDRESS "address" diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index e888bc4..31c9d5a 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -160,7 +160,7 @@ HTML.footer = " <!-- /div -->\n" \ " <div id=\"feedbackBox\">\n" \ " <div id=\"feedcloseX\" class=\"feedclose t_button\">X</div>\n" \ " <form id=\"feedform\" action=\"http://doc.qt.nokia.com/docFeedbck/feedback.php\" method=\"get\">\n" \ - " <p>Thank you for giving your feedback. <div class=\"note\">Make sure it is related the page. For more general bugs and \n" \ + " <p id=\"noteHead\">Thank you for giving your feedback. <div class=\"note\">Make sure it is related the page. For more general bugs and \n" \ " requests, please use the <a href=\"http://bugreports.qt.nokia.com/secure/Dashboard.jspa\">Qt Bug Tracker</a></div></p>\n" \ " <p><textarea id=\"feedbox\" name=\"feedText\" rows=\"5\" cols=\"40\"></textarea></p>\n" \ " <p><input id=\"feedsubmit\" class=\"feedclose\" type=\"submit\" name=\"feedback\" /></p>\n" \ diff --git a/tools/qdoc3/test/style/style.css b/tools/qdoc3/test/style/style.css index 9c290f5..dff0772 100644 --- a/tools/qdoc3/test/style/style.css +++ b/tools/qdoc3/test/style/style.css @@ -776,12 +776,14 @@ } .qmlreadonly { + padding-left: 3px; float: right; color: #254117; } .qmldefault { + padding-left: 3px; float: right; color: red; } diff --git a/tools/qdoc3/tree.cpp b/tools/qdoc3/tree.cpp index d31de4d..d3de46c 100644 --- a/tools/qdoc3/tree.cpp +++ b/tools/qdoc3/tree.cpp @@ -171,7 +171,8 @@ const Node *Tree::findNode(const QStringList &path, if (node && i == path.size() && (!(findFlags & NonFunction) || node->type() != Node::Function || ((FunctionNode *)node)->metaness() == FunctionNode::MacroWithoutParams)) - return node; + if (node->subType() != Node::QmlPropertyGroup) + return node; relative = relative->parent(); } while (relative); diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 900a464..d0817bc 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -91,7 +91,7 @@ void showWarnings() void myMessageOutput(QtMsgType type, const char *msg) { - if (!logger.isNull()) { + if (!logger.isNull() && !QCoreApplication::closingDown()) { QString strMsg = QString::fromAscii(msg); QMetaObject::invokeMethod(logger.data(), "append", Q_ARG(QString, strMsg)); } else { |