diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-03-28 23:18:16 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-03-28 23:18:16 (GMT) |
commit | bd0e2aa6c99747551966fb787ea86c21f426a791 (patch) | |
tree | 8c3de7b8aa0cf856633934f3df5adaa2bdcd0d7a | |
parent | 0a114cf91058e215f4b6f8bbea09aa9e9ad57069 (diff) | |
parent | 6cce231a2d8da6fb232908a8c815ba3a433cfad7 (diff) | |
download | Qt-bd0e2aa6c99747551966fb787ea86c21f426a791.zip Qt-bd0e2aa6c99747551966fb787ea86c21f426a791.tar.gz Qt-bd0e2aa6c99747551966fb787ea86c21f426a791.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
43 files changed, 399 insertions, 151 deletions
diff --git a/config.tests/unix/stl/stltest.cpp b/config.tests/unix/stl/stltest.cpp index ff9b8f9..382f5cb 100644 --- a/config.tests/unix/stl/stltest.cpp +++ b/config.tests/unix/stl/stltest.cpp @@ -69,7 +69,7 @@ class DummyIterator public: T *i; typedef std::random_access_iterator_tag iterator_category; - typedef ptrdiff_t difference_type; + typedef std::ptrdiff_t difference_type; typedef T value_type; typedef T *pointer; typedef T &reference; diff --git a/demos/declarative/minehunt/minehunt.qml b/demos/declarative/minehunt/minehunt.qml index 9e99706..2ca6c4c 100644 --- a/demos/declarative/minehunt/minehunt.qml +++ b/demos/declarative/minehunt/minehunt.qml @@ -1,5 +1,5 @@ import Qt 4.6 -import MinehuntCore 1.0 +import "MinehuntCore" 1.0 Item { id: field diff --git a/demos/declarative/photoviewer/photoviewer.qml b/demos/declarative/photoviewer/photoviewer.qml index 8feee02..662ea12 100644 --- a/demos/declarative/photoviewer/photoviewer.qml +++ b/demos/declarative/photoviewer/photoviewer.qml @@ -1,5 +1,5 @@ import Qt 4.6 -import PhotoViewerCore 1.0 +import "PhotoViewerCore" 1.0 Rectangle { id: mainWindow diff --git a/demos/declarative/samegame/samegame.qml b/demos/declarative/samegame/samegame.qml index f084ff6..6c58d49 100644 --- a/demos/declarative/samegame/samegame.qml +++ b/demos/declarative/samegame/samegame.qml @@ -1,5 +1,5 @@ import Qt 4.6 -import SamegameCore 1.0 +import "SamegameCore" 1.0 import "SamegameCore/samegame.js" as Logic Rectangle { diff --git a/demos/declarative/twitter/twitter.qml b/demos/declarative/twitter/twitter.qml index 259f79a..94d53f1 100644 --- a/demos/declarative/twitter/twitter.qml +++ b/demos/declarative/twitter/twitter.qml @@ -1,5 +1,5 @@ import Qt 4.6 -import TwitterCore 1.0 as Twitter +import "TwitterCore" 1.0 as Twitter Item { id: screen; width: 320; height: 480 diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc index cc61c01..f310484 100644 --- a/doc/src/declarative/declarativeui.qdoc +++ b/doc/src/declarative/declarativeui.qdoc @@ -94,6 +94,7 @@ completely new applications. QML is fully \l {Extending QML in C++}{extensible \o \l {qdeclarativefocus.html}{Keyboard Focus} \o \l {Extending types from QML} \o \l {Dynamic Object Creation} +\o \l {qmlruntime.html}{The Qt Declarative Runtime} \endlist \section1 Reference: diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index 8c096da..3dce8c3 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -693,6 +693,19 @@ it in two steps, like this: myProperty: 10 \endcode +If a default value is not supplied or set later in the file, each type has a +default value for when none is explictly set. Below are the default values +of some of the types. For the remaining types the default values are undefined. + +\table +\header \o QML Type \o Default Value +\row \o bool \o false +\row \o int \o 0 +\row \o double, real \o 0.0 +\row \o string, url \o "" (an empty string) +\row \o color \o #000000 (black) +\endtable + If specified, the optional "default" attribute marks the new property as the types default property, overriding any existing default property. Using the default attribute twice in the same type block is an error. diff --git a/doc/src/declarative/modules.qdoc b/doc/src/declarative/modules.qdoc index 53de32c..f90e23b 100644 --- a/doc/src/declarative/modules.qdoc +++ b/doc/src/declarative/modules.qdoc @@ -42,14 +42,79 @@ /*! \page qdeclarativemodules.html \title Modules +\section1 QML Modules. +QUERY: Is a directory with no qmldir really a module? Assumed NO. -A \bold module is a collection of QML types. +A \bold module is a collection of QML types. These types can be defined in QML, or in C++ +through a QDeclarativeExtensionPlugin. They can then be collected into a directory to comprise +a module. + +Additionally a module can also be a collection of types which was compiled into your application, see \l{Extending QML in C++}. + +While a directory containing types can be used to organize QML components, QML modules also contain a \c qmldir file. +This file provides a manifest of all types available in the module, +and allows versioned imports (among other things). A directory containing only QML files or plugins behaves similarly +to a module, but a QML module requires a \c qmldir file (unless it is written in C++ and compiled into your application). + +\section2 The \c qmldir File + +QML modules containing installed files and remote content require a file \c qmldir which specifies the +mapping from all type names to versioned QML files. It is a list of lines of the form: + +\code +# <Comment> +<TypeName> <InitialVersion> <File> +plugin <Name> [<Path>] +\endcode + +# <Comment> lines are ignored, and can be used for comments. + +<TypeName> <InitialVersion> <File> lines are used to add QML files as types. +<TypeName> is the type being made available; <InitialVersion> is a version +number like \c 4.0; <File> is the (relative) +file name of the QML file defining the type. + +plugin <Name> [<Path>] lines are used to add plugins (QDeclarativeExtensionPlugin subclasses +written in C++) to the module. The line starts with the keyword 'plugin'; <Name> is the +name of the library; <Path> is an optional argument specifying the full path to the directory +containing the plugin file, if it is omitted then the directory is assumed to be the same as +the directory of the qmldir file. Note that <Name> is not usually the same as the file name +of the plugin binary, which is platform dependent e.g. the library MyAppTypes would produce a libMyAppTypes.so on linux and MyAppTypes.dll on windows. + +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), +since the \e first name-version match is used. + +Installed files do not need to import the module of which they are a part, as they can refer +to the other QML files in the module as relative (local) files. +If the module is imported from a remote location, those files must nevertheless be listed in +the \c qmldir file. Internal files can be marked with the \c internal keyword, to ensure +they are not visible outside the module: + +\code +internal <TypeName> <File> +\endcode + +Installed and remote files \e must be referred to by version information described above, +local files \e may have it. + +The versioning system ensures that a given QML file will work regardless of the version +of installed software, since a versioned import \e only imports types for that version, +leaving other identifiers available, even if the actual installed version might otherwise +use those identifiers. + +\section1 Importing Modules To use types from a module it must be imported using the \c import statement. Successive import statements override earlier import statements, however, since imports have version qualifiers, changes in modules do not alter the semantics of imports. -\section1 Importing Types Defined in C++ +While it is possible to import some modules without specifying a version this is only advisable +during prototyping, where version numbers mean very little. The rest of the time it is recommended that +you take advantage of the versioning capabilities of the language. + +You can import a directory in the same way that you import a module, except that you cannot specify a version +number. This will import all the types in that directory as QML files or as part of plugins. Types \link adding-types defined in C++\endlink can be from types your application defines, standard QML types, or types defined in plugins. To use any such types, you must import @@ -90,7 +155,7 @@ Installed plugins and QML files can both contribute types to the same module. The specification of types to versions is given by a special file, \c qmldir which must exist in the module directory. The syntax is described below. -The \c -L option to the \l {qmlviewer}{viewer} application also adds paths to the import path. +The \c -L option to the \l {qmlviewer}{runtime} application also adds paths to the import path. \section2 Local QML Files @@ -103,62 +168,31 @@ import "path" \endcode This allows all components defined in the directory \c path to be used in -the component where this statement appears. +the component where this statement appears. Because no version number is specified, +all types in the directory will be imported. -In this case, and only this case, it is not necessary for the module directory to include +In this case, and only this case, it is not necessary for the directory to include a \c qmldir file, nor is it necessary to provide a version qualifier. The basis of this is that the files in the subdirectory are assumed to be packaged with the importer, and therefore -they form a single versioned unit. - - -\section2 Remote QML Files - -To import types defined in QML file at arbitrary network locations, a quoted absolute URL is used: +they form a single versioned unit. It is however recommended that you add a qmldir file and create +a QML module, as this provides additional options such as more flexible versioning. If the directory +is a module then you can use a version qualifier, like below \code -import "http://url/.../" 1.0 +import "path" 1.0 \endcode -This works the same as for relative directory imports, except that the target location \e must -include a \c qmldir file, and a version qualifier must be given. - -\section2 The \c qmldir File - -Directories of installed files and remote content must include a file \c qmldir which specifies the -mapping from all type names to versioned QML files. It is a list of lines of the form: - -\code -# <Comment> -<TypeName> <InitialVersion> <File> -\endcode - -<TypeName> is the type being made available; <InitialVersion> is a version -number like \c 4.0; <File> is the (relative) -file name of the QML file defining the type. - -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), -since the \e first name-version match is used. +\section2 Remote QML Files -Installed files do not need to import the module of which they are a part, as they can refer -to the other QML files in the module as relative (local) files. -If the module is imported from a remote location, those files must nevertheless be listed in -the \c qmldir file. Internal files can be marked with the \c internal keyword, to ensure -they are not visible outside the module: +To import types defined in QML file at arbitrary network locations, a quoted absolute URL is used: \code -internal <TypeName> <File> +import "http://url/.../" 1.0 \endcode -Installed and remote files \e must be referred to by version information described above, -local files \e may have it. - -The versioning system ensures that a given QML file will work regardless of the version -of installed software, since a versioned import \e only imports types for that version, -leaving other identifiers available, even if the actual installed version might otherwise -use those identifiers. - +This works the same as for relative directory imports, except that the target location contain a QML module (\e must +include a \c qmldir file), and a version qualifier must be given. \section1 Namespaces - Named Imports @@ -185,6 +219,17 @@ modules can be imported into the global namespace: import Qt 4.6 as Nokia import Ovi 1.0 as Nokia \endcode + +There is one special module, called Qt, which contains all of the types that are part of +Qt Declarative. While it still needs to be imported, this module can be used in all QML +files. + +While import statements are need to make any types available in QML, the directory of the +current file is implicitly loaded. This is the exact same as if you had added 'import "."' to +every QML file. The effect of this is that you can automatically use Types defined in C++ plugins +or QML files if they reside in the same directory. + + */ /* diff --git a/doc/src/declarative/qmlruntime.qdoc b/doc/src/declarative/qmlruntime.qdoc index 6d3e109..710a030 100644 --- a/doc/src/declarative/qmlruntime.qdoc +++ b/doc/src/declarative/qmlruntime.qdoc @@ -41,32 +41,82 @@ /*! \page qmlruntime.html - \title Qt Declarative UI Viewer (qmlviewer) + \title Qt Declarative UI Runtime \ingroup qttools \keyword qmlviewer - This page documents the \e{Declarative UI Viewer} for the Qt GUI - toolkit. The \c qmlviewer reads a declarative user interface definition + This page documents the \e{Declarative UI Runtime} for the Qt GUI + toolkit, and the \c qml executable which can be used to run apps + written for the runtime. The \c qml executable reads a declarative user interface definition (\c .qml) file and displays the user interface it describes. - qmlviewer is a development tool. It is not intended to be - installed in a production environment. + QML is a runtime, as you can run plain qml files which pull in their required modules. + To run apps with the QML runtime, you can either start the runtime + from your on application (using a QDeclarativeView) or with the simple \c qml application. + The \c qml application can be + installed in a production environment, assuming that it is not already + present in the system. It is generally packaged alongside Qt. - \section1 Options + To deploy an application using the QML runtime, you have two options. You can either write your + own Qt application including a QDeclarative view and deploy it the same as + any other Qt application (not discussed further on this page). Alternatively you can write a main QML file for + your application, and run your application using the \c qml executable. If a qml file + is passed as an argument to the \c qml executable, it will automatically run it. - When run with the \c -help option, qmlviewer shows available options. + Deploying a QML application via the \c qml executable allows for QML only deployments, but can also + include custom C++ modules just as easily. Below is an example of how you might structure + a complex application deployed via the qml runtime, it is a listing of the files that would + be included in the deployment package. - \section1 Dummy Data + \code + MyApp.qml + MyAppCore/qmldir + MyAppCore/libMyAppCore.so + MyAppCore/MyAppCore.dll + MyAppCore/AnAppElement.qml + MyAppCore/AnotherElement.qml + MyAppCore/images/Logo.png + OtherModule/qmldir + OtherModule/OtherElement.qml + \endcode + + Note that this example is for deploying the example to both windows and linux. You will still need to compile the C++ + modules for each target platform, but you can deploy multiple versions of the modules across platforms with different naming conventions, + as the appropriate module file is chosen based on platform naming conventions. The C++ + modules must contain a QDeclarativeExtentionPlugin subclass. + + The application would be executed either with your own application, the command 'qml MyApp.qml' or by + opening the qml file if your system has the \c qml executable registered as the handler for qml files. The MyApp.qml file would have access + to all of the deployed types using the import statements such as the following: - One use of qmlviewer is to allow QML files to be viewed stand-alone, - rather than being loaded from within a Qt program. Qt applications will - usually bind objects and properties into the execution context before - running the QML. To stand-in for such bindings, you can provide dummy - data: create a directory called "dummydata" in the same directory as + \code + import "MyAppCore" + import "OtherModule" 1.0 as Other + \endcode + + \section1 \c qml application functionality + The \c qml application implements some additional functionality to help it serve the role of a launcher + for myriad applications. If you implement your own launcher application, you may also wish to reimplement + some or all of this functionality. However, much of this functionality is intended to aid the prototyping of + qml applications and may not be necessary for a deployed application. + + \section2 Options + + When run with the \c -help option, qml shows available options. + + \section2 Dummy Data + + The secondary use of the qml runtime is to allow QML files to be viewed with + dummy data. This is useful when prototyping the UI, as the dummy data can + be later replaced with actual data and bindings from a C++ plugin. + To provide dummy data: create a directory called "dummydata" in the same directory as the target QML file and create files there with the "qml" extension. All such files will be loaded as QML objects and bound to the root context as a property with the name of the file (without ".qml"). + To replace this with real data, you simply bind the real object to + the root context in C++. + For example, if the Qt application has a "clock.time" property that is a qreal from 0 to 86400 representing the number of seconds since midnight, dummy data for this could be provided by \c dummydata/clock.qml: @@ -76,9 +126,9 @@ Any QML can be used in the dummy data files. You could even animate the fictional data! - \section1 Screen Orientation + \section2 Screen Orientation - A special piece of dummy data which is integrated into the viewer is + A special piece of dummy data which is integrated into the runtime is a simple orientation property. The orientation can be set via the settings menu in the application, or by pressing Ctrl+T to toggle it. @@ -96,4 +146,8 @@ } \endcode + This allows your application to respond to the orientation of the screen changing. The runtime + will automatically update this on some platforms (currently the N900 only) to match the physical + screen's orientation. On other plaforms orientation changes will only happen when explictly asked for. + */ diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp index b8d67ff..5a234b7 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp @@ -152,7 +152,7 @@ void QDeclarativeImageBase::load() } else { d->status = Loading; int reqwidth = d->sourcesize.width(); - int reqheight = d->sourcesize.width(); + int reqheight = d->sourcesize.height(); QSize impsize; QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(d->url, &d->pix, &impsize, d->async, reqwidth, reqheight); if (status != QDeclarativePixmapReply::Ready && status != QDeclarativePixmapReply::Error) { diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp index 7a0d33a..5e91224 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp +++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp @@ -602,7 +602,9 @@ Grid { \qmlproperty Transition Grid::add This property holds the transition to apply when adding an item to the positioner. The transition is only applied to the added item(s). - Positioner transitions will only affect the position (x,y) of items. + Positioner transitions will only affect the position (x,y) of items, + as that is all the positioners affect. To animate other property change + you will have to do so based on how you have changed those properties. Added can mean that either the object has been created or reparented, and thus is now a child or the positioner, or that the diff --git a/src/declarative/graphicsitems/qdeclarativetranslate_p.h b/src/declarative/graphicsitems/qdeclarativetranslate_p.h index 1371f71..939692b 100644 --- a/src/declarative/graphicsitems/qdeclarativetranslate_p.h +++ b/src/declarative/graphicsitems/qdeclarativetranslate_p.h @@ -52,7 +52,7 @@ QT_MODULE(Declarative) class QDeclarativeTranslatePrivate; -class Q_GUI_EXPORT QDeclarativeTranslate : public QGraphicsTransform +class Q_DECLARATIVE_EXPORT QDeclarativeTranslate : public QGraphicsTransform { Q_OBJECT diff --git a/src/declarative/qml/parser/qdeclarativejs.g b/src/declarative/qml/parser/qdeclarativejs.g index 0256c52..c7524a4 100644 --- a/src/declarative/qml/parser/qdeclarativejs.g +++ b/src/declarative/qml/parser/qdeclarativejs.g @@ -656,7 +656,7 @@ case $rule_number: { } else if (AST::UiQualifiedId *qualifiedId = reparseAsQualifiedId(sym(2).Expression)) { QString text; for (AST::UiQualifiedId *q = qualifiedId; q; q = q->next) { - text += q->name->asString(); + text += q->name->asString(); if (q->next) text += QLatin1String("."); } node = makeAstNode<AST::UiImport>(driver->nodePool(), qualifiedId); @@ -1109,6 +1109,9 @@ case $rule_number: { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage())); return false; // ### remove me } + + loc(1).length = lexer->tokenLength(); + AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags); node->literalToken = loc(1); sym(1).Node = node; @@ -1126,6 +1129,9 @@ case $rule_number: { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage())); return false; } + + loc(1).length = lexer->tokenLength(); + AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags); node->literalToken = loc(1); sym(1).Node = node; diff --git a/src/declarative/qml/parser/qdeclarativejsparser.cpp b/src/declarative/qml/parser/qdeclarativejsparser.cpp index 9205ef4..2949e88 100644 --- a/src/declarative/qml/parser/qdeclarativejsparser.cpp +++ b/src/declarative/qml/parser/qdeclarativejsparser.cpp @@ -275,7 +275,7 @@ case 20: { } else if (AST::UiQualifiedId *qualifiedId = reparseAsQualifiedId(sym(2).Expression)) { QString text; for (AST::UiQualifiedId *q = qualifiedId; q; q = q->next) { - text += q->name->asString(); + text += q->name->asString(); if (q->next) text += QLatin1String("."); } node = makeAstNode<AST::UiImport>(driver->nodePool(), qualifiedId); @@ -571,6 +571,9 @@ case 76: { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage())); return false; // ### remove me } + + loc(1).length = lexer->tokenLength(); + AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags); node->literalToken = loc(1); sym(1).Node = node; @@ -582,6 +585,9 @@ case 77: { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage())); return false; } + + loc(1).length = lexer->tokenLength(); + AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags); node->literalToken = loc(1); sym(1).Node = node; diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 2f0ec24..dea5a40 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -580,13 +580,13 @@ void QDeclarativeEngine::removeImageProvider(const QString &providerId) delete d->imageProviders.take(providerId); } -QImage QDeclarativeEnginePrivate::getImageFromProvider(const QUrl &url) +QImage QDeclarativeEnginePrivate::getImageFromProvider(const QUrl &url, QSize *size, const QSize& req_size) { QMutexLocker locker(&mutex); QImage image; QDeclarativeImageProvider *provider = imageProviders.value(url.host()); if (provider) - image = provider->request(url.path().mid(1)); + image = provider->request(url.path().mid(1), size, req_size); return image; } @@ -1405,7 +1405,9 @@ struct QDeclarativeEnginePrivate::ImportedNamespace { foreach (const QDeclarativeDirParser::Component &c, qmldircomponents) { if (c.typeName == typeName) { typeWasDeclaredInQmldir = true; - if (c.majorVersion < vmaj || (c.majorVersion == vmaj && vmin >= c.minorVersion)) { + + // importing version -1 means import ALL versions + if ((vmaj == -1) || (c.majorVersion < vmaj || (c.majorVersion == vmaj && vmin >= c.minorVersion))) { QUrl candidate = url.resolved(QUrl(c.fileName)); if (c.internal && base) { if (base->resolved(QUrl(c.fileName)) != candidate) @@ -1494,10 +1496,10 @@ public: QStringList paths; - if (!base.isEmpty()) { - QString baseDir = QFileInfo(toLocalFileOrQrc(base)).path(); - paths += baseDir; - } +// if (!base.isEmpty()) { +// QString baseDir = QFileInfo(toLocalFileOrQrc(base)).path(); +// paths += baseDir; +// } QString applicationDirPath = QCoreApplication::applicationDirPath(); if (!applicationDirPath.isEmpty()) @@ -1557,9 +1559,9 @@ public: // user import paths QStringList paths; // base.. - QString localFileOrQrc = toLocalFileOrQrc(base); - QString localFileOrQrcPath = QFileInfo(localFileOrQrc).path(); - paths += localFileOrQrcPath; +// QString localFileOrQrc = toLocalFileOrQrc(base); +// QString localFileOrQrcPath = QFileInfo(localFileOrQrc).path(); +// paths += localFileOrQrcPath; paths += QDeclarativeEnginePrivate::get(engine)->fileImportPath; QString applicationDirPath = QCoreApplication::applicationDirPath(); diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h index 06b5027..84bf061 100644 --- a/src/declarative/qml/qdeclarativeengine_p.h +++ b/src/declarative/qml/qdeclarativeengine_p.h @@ -225,7 +225,7 @@ public: mutable QDeclarativeNetworkAccessManagerFactory *networkAccessManagerFactory; QHash<QString,QDeclarativeImageProvider*> imageProviders; - QImage getImageFromProvider(const QUrl &url); + QImage getImageFromProvider(const QUrl &url, QSize *size, const QSize& req_size); mutable QMutex mutex; diff --git a/src/declarative/qml/qdeclarativeimageprovider.cpp b/src/declarative/qml/qdeclarativeimageprovider.cpp index 9ef8545..b992b9f 100644 --- a/src/declarative/qml/qdeclarativeimageprovider.cpp +++ b/src/declarative/qml/qdeclarativeimageprovider.cpp @@ -61,10 +61,14 @@ QDeclarativeImageProvider::~QDeclarativeImageProvider() } /*! - \fn QImage QDeclarativeImageProvider::request(const QString &id) + \fn QImage QDeclarativeImageProvider::request(const QString &id, QSize *size, const QSize& requested_size) Implement this method to return the image with \a id. + If \a requested_size is a valid size, resize the image to that size before returning. + + In any case, \a size must be set to the (original) size of the image. + Note: this method may be called by multiple threads, so ensure the implementation of this method is reentrant. */ diff --git a/src/declarative/qml/qdeclarativeimageprovider.h b/src/declarative/qml/qdeclarativeimageprovider.h index 6ee7bcf..50b73fe 100644 --- a/src/declarative/qml/qdeclarativeimageprovider.h +++ b/src/declarative/qml/qdeclarativeimageprovider.h @@ -54,7 +54,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeImageProvider { public: virtual ~QDeclarativeImageProvider(); - virtual QImage request(const QString &id) = 0; + virtual QImage request(const QString &id, QSize *size, const QSize& requested_size) = 0; }; QT_END_NAMESPACE diff --git a/src/declarative/util/qdeclarativepixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp index 54dccce..1d90bf8 100644 --- a/src/declarative/util/qdeclarativepixmapcache.cpp +++ b/src/declarative/util/qdeclarativepixmapcache.cpp @@ -255,7 +255,9 @@ bool QDeclarativeImageRequestHandler::event(QEvent *event) // fetch if (url.scheme() == QLatin1String("image")) { // Use QmlImageProvider - QImage image = QDeclarativeEnginePrivate::get(engine)->getImageFromProvider(url); + 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()) { diff --git a/src/declarative/util/qdeclarativestategroup.cpp b/src/declarative/util/qdeclarativestategroup.cpp index bc4582c..258a9e9 100644 --- a/src/declarative/util/qdeclarativestategroup.cpp +++ b/src/declarative/util/qdeclarativestategroup.cpp @@ -69,6 +69,7 @@ public: static void append_state(QDeclarativeListProperty<QDeclarativeState> *list, QDeclarativeState *state); static int count_state(QDeclarativeListProperty<QDeclarativeState> *list); static QDeclarativeState *at_state(QDeclarativeListProperty<QDeclarativeState> *list, int index); + static void clear_states(QDeclarativeListProperty<QDeclarativeState> *list); QList<QDeclarativeState *> states; QList<QDeclarativeTransition *> transitions; @@ -150,7 +151,8 @@ QDeclarativeListProperty<QDeclarativeState> QDeclarativeStateGroup::statesProper Q_D(QDeclarativeStateGroup); return QDeclarativeListProperty<QDeclarativeState>(this, &d->states, &QDeclarativeStateGroupPrivate::append_state, &QDeclarativeStateGroupPrivate::count_state, - &QDeclarativeStateGroupPrivate::at_state); + &QDeclarativeStateGroupPrivate::at_state, + &QDeclarativeStateGroupPrivate::clear_states); } void QDeclarativeStateGroupPrivate::append_state(QDeclarativeListProperty<QDeclarativeState> *list, QDeclarativeState *state) @@ -175,6 +177,16 @@ QDeclarativeState *QDeclarativeStateGroupPrivate::at_state(QDeclarativeListPrope return _this->d_func()->states.at(index); } +void QDeclarativeStateGroupPrivate::clear_states(QDeclarativeListProperty<QDeclarativeState> *list) +{ + QDeclarativeStateGroup *_this = static_cast<QDeclarativeStateGroup *>(list->object); + _this->d_func()->setCurrentStateInternal(QString(), true); + for (int i = 0; i < _this->d_func()->states.count(); ++i) { + _this->d_func()->states.at(i)->setStateGroup(0); + } + _this->d_func()->states.clear(); +} + /*! \qmlproperty list<Transition> StateGroup::transitions This property holds a list of transitions defined by the state group. diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index 7097291..074dd89 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -434,13 +434,13 @@ static inline bool isTreeView(const QWidget *widget) QString qt_mac_removeMnemonics(const QString &original) { - // copied from qt_format_text (to be bug-for-bug compatible). QString returnText(original.size(), 0); int finalDest = 0; int currPos = 0; int l = original.length(); while (l) { - if (original.at(currPos) == QLatin1Char('&')) { + if (original.at(currPos) == QLatin1Char('&') + && (l == 1 || original.at(currPos + 1) != QLatin1Char('&'))) { ++currPos; --l; if (l == 0) diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm index 9a14ce6..6a0eb53 100644 --- a/src/gui/widgets/qmenu_mac.mm +++ b/src/gui/widgets/qmenu_mac.mm @@ -1391,7 +1391,11 @@ QMenuPrivate::QMacMenuPrivate::syncAction(QMacMenuAction *action) } else { [item setTitle: qt_mac_QStringToNSString(finalString)]; } - [item setTitle:qt_mac_QStringToNSString(qt_mac_removeMnemonics(text))]; + + if (action->action->menuRole() == QAction::AboutRole || action->action->menuRole() == QAction::QuitRole) + [item setTitle:qt_mac_QStringToNSString(text)]; + else + [item setTitle:qt_mac_QStringToNSString(qt_mac_removeMnemonics(text))]; // Cocoa Enabled [item setEnabled: action->action->isEnabled()]; diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h index 5e93193..11f5d96 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.h +++ b/src/plugins/bearer/corewlan/qcorewlanengine.h @@ -102,7 +102,7 @@ protected: void getUserConfigurations(); QString getNetworkNameFromSsid(const QString &ssid); QString getSsidFromNetworkName(const QString &name); - QStringList foundNetwork(const QString &id, const QString &ssid, const QNetworkConfiguration::StateFlags state, const QString &interfaceName); + QStringList foundNetwork(const QString &id, const QString &ssid, const QNetworkConfiguration::StateFlags state, const QString &interfaceName, const QNetworkConfiguration::Purpose purpose); }; QT_END_NAMESPACE diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index a366d00..b59ccee 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -271,7 +271,7 @@ void QCoreWlanEngine::connectToId(const QString &id) SecKeychainAttributeList attributeList = {3,attributes}; SecKeychainSearchRef searchRef; - OSErr result = SecKeychainSearchCreateFromAttributes(NULL, kSecGenericPasswordItemClass, &attributeList, &searchRef); + SecKeychainSearchCreateFromAttributes(NULL, kSecGenericPasswordItemClass, &attributeList, &searchRef); NSString *password = @""; SecKeychainItemRef searchItem; @@ -429,7 +429,14 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName) state = QNetworkConfiguration::Undefined; } } - found.append(foundNetwork(id, networkSsid, state, interfaceName)); + QNetworkConfiguration::Purpose purpose = QNetworkConfiguration::UnknownPurpose; + if([[apNetwork securityMode] intValue] == kCWSecurityModeOpen) { + purpose = QNetworkConfiguration::PublicPurpose; + } else { + purpose = QNetworkConfiguration::PrivatePurpose; + } + + found.append(foundNetwork(id, networkSsid, state, interfaceName, purpose)); } //end row } //end error @@ -470,13 +477,13 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName) state = QNetworkConfiguration::Defined; } - found.append(foundNetwork(id, networkName, state, interfaceName)); + found.append(foundNetwork(id, networkName, state, interfaceName, QNetworkConfiguration::UnknownPurpose)); } } return found; } -QStringList QCoreWlanEngine::foundNetwork(const QString &id, const QString &name, const QNetworkConfiguration::StateFlags state, const QString &interfaceName) +QStringList QCoreWlanEngine::foundNetwork(const QString &id, const QString &name, const QNetworkConfiguration::StateFlags state, const QString &interfaceName, const QNetworkConfiguration::Purpose purpose) { QStringList found; QMutexLocker locker(&mutex); @@ -507,6 +514,10 @@ QStringList QCoreWlanEngine::foundNetwork(const QString &id, const QString &name changed = true; } + if (ptr->purpose != purpose) { + ptr->purpose = purpose; + changed = true; + } ptr->mutex.unlock(); if (changed) { @@ -524,6 +535,7 @@ QStringList QCoreWlanEngine::foundNetwork(const QString &id, const QString &name ptr->state = state; ptr->type = QNetworkConfiguration::InternetAccessPoint; ptr->bearer = QLatin1String("WLAN"); + ptr->purpose = purpose; accessPointConfigurations.insert(ptr->id, ptr); configurationInterface.insert(ptr->id, interfaceName); diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index 28ee38e..72d6838 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -602,7 +602,11 @@ void QNetworkManagerEngine::newAccessPoint(const QString &path, const QDBusObjec ptr->isValid = true; ptr->id = QString::number(qHash(objectPath.path())); ptr->type = QNetworkConfiguration::InternetAccessPoint; - ptr->purpose = QNetworkConfiguration::PublicPurpose; + if(accessPoint->flags() == NM_802_11_AP_FLAGS_PRIVACY) { + ptr->purpose = QNetworkConfiguration::PrivatePurpose; + } else { + ptr->purpose = QNetworkConfiguration::PublicPurpose; + } ptr->state = QNetworkConfiguration::Undefined; ptr->bearer = QLatin1String("WLAN"); @@ -718,6 +722,7 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri if (connectionType == QLatin1String("802-3-ethernet")) { cpPriv->bearer = QLatin1String("Ethernet"); + cpPriv->purpose = QNetworkConfiguration::PublicPurpose; foreach (const QDBusObjectPath &devicePath, interface->getDevices()) { QNetworkManagerInterfaceDevice device(devicePath.path()); @@ -734,7 +739,12 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri cpPriv->bearer = QLatin1String("WLAN"); const QString connectionSsid = map.value("802-11-wireless").value("ssid").toString(); - + const QString connectionSecurity = map.value("802-11-wireless").value("security").toString(); + if(!connectionSecurity.isEmpty()) { + cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; + } else { + cpPriv->purpose = QNetworkConfiguration::PublicPurpose; + } for (int i = 0; i < accessPoints.count(); ++i) { if (connectionSsid == accessPoints.at(i)->ssid()) { cpPriv->state |= QNetworkConfiguration::Discovered; diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowmediatype.cpp b/src/plugins/mediaservices/directshow/mediaplayer/directshowmediatype.cpp index cf6d45b..f8f519d 100644 --- a/src/plugins/mediaservices/directshow/mediaplayer/directshowmediatype.cpp +++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowmediatype.cpp @@ -130,9 +130,17 @@ QVideoSurfaceFormat DirectShowMediaType::formatFromType(const AM_MEDIA_TYPE &typ if (header->AvgTimePerFrame > 0) format.setFrameRate(10000 /header->AvgTimePerFrame); - format.setScanLineDirection(header->bmiHeader.biHeight < 0 - ? QVideoSurfaceFormat::TopToBottom - : QVideoSurfaceFormat::BottomToTop); + switch (qt_typeLookup[i].pixelFormat) { + case QVideoFrame::Format_RGB32: + case QVideoFrame::Format_BGR24: + case QVideoFrame::Format_RGB565: + case QVideoFrame::Format_RGB555: + if (header->bmiHeader.biHeight >= 0) + format.setScanLineDirection(QVideoSurfaceFormat::BottomToTop); + break; + default: + break; + } return format; } else if (IsEqualGUID(type.formattype, FORMAT_VideoInfo2)) { @@ -145,9 +153,17 @@ QVideoSurfaceFormat DirectShowMediaType::formatFromType(const AM_MEDIA_TYPE &typ if (header->AvgTimePerFrame > 0) format.setFrameRate(10000 / header->AvgTimePerFrame); - format.setScanLineDirection(header->bmiHeader.biHeight < 0 - ? QVideoSurfaceFormat::TopToBottom - : QVideoSurfaceFormat::BottomToTop); + switch (qt_typeLookup[i].pixelFormat) { + case QVideoFrame::Format_RGB32: + case QVideoFrame::Format_BGR24: + case QVideoFrame::Format_RGB565: + case QVideoFrame::Format_RGB555: + if (header->bmiHeader.biHeight >= 0) + format.setScanLineDirection(QVideoSurfaceFormat::BottomToTop); + break; + default: + break; + } return format; } diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp index d54d188..a5f143f 100644 --- a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp +++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp @@ -191,6 +191,8 @@ void DirectShowPlayerService::load(const QMediaContent &media, QIODevice *stream m_atEnd = false; m_metaDataControl->updateGraph(0, 0); + QCoreApplication::postEvent(this, new QEvent(QEvent::Type(VideoOutputChange))); + if (m_resources.isEmpty() && !stream) { m_pendingTasks = 0; m_graphStatus = NoMedia; @@ -464,6 +466,8 @@ void DirectShowPlayerService::doRender(QMutexLocker *locker) QCoreApplication::postEvent(this, new QEvent(QEvent::Type(Error))); } + QCoreApplication::postEvent(this, new QEvent(QEvent::Type(VideoOutputChange))); + m_executedTasks |= Render; } } @@ -1144,6 +1148,9 @@ void DirectShowPlayerService::customEvent(QEvent *event) QMutexLocker locker(&m_mutex); m_playerControl->updatePosition(m_position); + } else if (event->type() == QEvent::Type(VideoOutputChange)) { + if (m_videoWindowControl) + m_videoWindowControl->updateNativeSize(); } else { QMediaService::customEvent(event); } diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.h b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.h index 23515d0..d3ef809 100644 --- a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.h +++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.h @@ -164,7 +164,8 @@ private: DurationChange, StatusChange, EndOfMedia, - PositionChange + PositionChange, + VideoOutputChange }; enum GraphStatus diff --git a/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp b/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp index 4b9aeb8..e25dd99 100644 --- a/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp +++ b/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp @@ -51,6 +51,7 @@ Vmr9VideoWindowControl::Vmr9VideoWindowControl(QObject *parent) , m_filter(com_new<IBaseFilter>(CLSID_VideoMixingRenderer9, IID_IBaseFilter)) , m_windowId(0) , m_dirtyValues(0) + , m_aspectRatioMode(Qt::KeepAspectRatio) , m_brightness(0) , m_contrast(0) , m_hue(0) @@ -90,33 +91,30 @@ void Vmr9VideoWindowControl::setWinId(WId id) QRect Vmr9VideoWindowControl::displayRect() const { - QRect rect; - - if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>( - m_filter, IID_IVMRWindowlessControl9)) { - RECT sourceRect; - RECT displayRect; - - if (control->GetVideoPosition(&sourceRect, &displayRect) == S_OK) { - rect = QRect( - displayRect.left, - displayRect.bottom, - displayRect.right - displayRect.left, - displayRect.bottom - displayRect.top); - } - control->Release(); - } - return rect; + return m_displayRect; } void Vmr9VideoWindowControl::setDisplayRect(const QRect &rect) { + m_displayRect = rect; + if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>( m_filter, IID_IVMRWindowlessControl9)) { RECT sourceRect = { 0, 0, 0, 0 }; RECT displayRect = { rect.left(), rect.top(), rect.right(), rect.bottom() }; control->GetNativeVideoSize(&sourceRect.right, &sourceRect.bottom, 0, 0); + + if (m_aspectRatioMode == Qt::KeepAspectRatioByExpanding) { + QSize clippedSize = rect.size(); + clippedSize.scale(sourceRect.right, sourceRect.bottom, Qt::KeepAspectRatio); + + sourceRect.left = (sourceRect.right - clippedSize.width()) / 2; + sourceRect.top = (sourceRect.bottom - clippedSize.height()) / 2; + sourceRect.right = sourceRect.left + clippedSize.width(); + sourceRect.bottom = sourceRect.top + clippedSize.height(); + } + control->SetVideoPosition(&sourceRect, &displayRect); control->Release(); } @@ -134,7 +132,6 @@ void Vmr9VideoWindowControl::setFullScreen(bool fullScreen) void Vmr9VideoWindowControl::repaint() { - if (QWidget *widget = QWidget::find(m_windowId)) { HDC dc = widget->getDC(); if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>( @@ -164,21 +161,13 @@ QSize Vmr9VideoWindowControl::nativeSize() const Qt::AspectRatioMode Vmr9VideoWindowControl::aspectRatioMode() const { - Qt::AspectRatioMode mode = Qt::KeepAspectRatio; - - if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>( - m_filter, IID_IVMRWindowlessControl9)) { - DWORD arMode; - - if (control->GetAspectRatioMode(&arMode) == S_OK && arMode == VMR9ARMode_None) - mode = Qt::IgnoreAspectRatio; - control->Release(); - } - return mode; + return m_aspectRatioMode; } void Vmr9VideoWindowControl::setAspectRatioMode(Qt::AspectRatioMode mode) { + m_aspectRatioMode = mode; + if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>( m_filter, IID_IVMRWindowlessControl9)) { switch (mode) { @@ -188,10 +177,15 @@ void Vmr9VideoWindowControl::setAspectRatioMode(Qt::AspectRatioMode mode) case Qt::KeepAspectRatio: control->SetAspectRatioMode(VMR9ARMode_LetterBox); break; + case Qt::KeepAspectRatioByExpanding: + control->SetAspectRatioMode(VMR9ARMode_LetterBox); + break; default: break; } control->Release(); + + setDisplayRect(m_displayRect); } } @@ -259,6 +253,13 @@ void Vmr9VideoWindowControl::setSaturation(int saturation) emit saturationChanged(saturation); } +void Vmr9VideoWindowControl::updateNativeSize() +{ + setDisplayRect(m_displayRect); + + emit nativeSizeChanged(); +} + void Vmr9VideoWindowControl::setProcAmpValues() { if (IVMRMixerControl9 *control = com_cast<IVMRMixerControl9>(m_filter, IID_IVMRMixerControl9)) { diff --git a/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.h b/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.h index bf4fb42..beac433 100644 --- a/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.h +++ b/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.h @@ -90,6 +90,8 @@ public: int saturation() const; void setSaturation(int saturation); + void updateNativeSize(); + private: void setProcAmpValues(); float scaleProcAmpValue( @@ -98,6 +100,8 @@ private: IBaseFilter *m_filter; WId m_windowId; DWORD m_dirtyValues; + Qt::AspectRatioMode m_aspectRatioMode; + QRect m_displayRect; int m_brightness; int m_contrast; int m_hue; diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp b/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp index 427d514..f381f7f 100644 --- a/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp +++ b/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp @@ -192,21 +192,36 @@ void QGstreamerVideoOverlay::surfaceFormatChanged() void QGstreamerVideoOverlay::setScaledDisplayRect() { + QRect formatViewport = m_surface->surfaceFormat().viewport(); + switch (m_aspectRatioMode) { case Qt::KeepAspectRatio: { - QSize size = m_surface->surfaceFormat().viewport().size(); - + QSize size = m_surface->surfaceFormat().sizeHint(); size.scale(m_displayRect.size(), Qt::KeepAspectRatio); QRect rect(QPoint(0, 0), size); rect.moveCenter(m_displayRect.center()); m_surface->setDisplayRect(rect); + m_surface->setViewport(formatViewport); } break; case Qt::IgnoreAspectRatio: m_surface->setDisplayRect(m_displayRect); + m_surface->setViewport(formatViewport); + break; + case Qt::KeepAspectRatioByExpanding: + { + QSize size = m_displayRect.size(); + size.scale(m_surface->surfaceFormat().sizeHint(), Qt::KeepAspectRatio); + + QRect viewport(QPoint(0, 0), size); + viewport.moveCenter(formatViewport.center()); + + m_surface->setDisplayRect(m_displayRect); + m_surface->setViewport(viewport); + } break; }; } diff --git a/src/plugins/mediaservices/gstreamer/qx11videosurface.cpp b/src/plugins/mediaservices/gstreamer/qx11videosurface.cpp index cbd5a76..70b8527 100644 --- a/src/plugins/mediaservices/gstreamer/qx11videosurface.cpp +++ b/src/plugins/mediaservices/gstreamer/qx11videosurface.cpp @@ -213,6 +213,16 @@ void QX11VideoSurface::setDisplayRect(const QRect &rect) m_displayRect = rect; } +QRect QX11VideoSurface::viewport() const +{ + return m_viewport; +} + +void QX11VideoSurface::setViewport(const QRect &rect) +{ + m_viewport = rect; +} + int QX11VideoSurface::brightness() const { return getAttribute("XV_BRIGHTNESS", m_brightnessRange.first, m_brightnessRange.second); diff --git a/src/plugins/mediaservices/gstreamer/qx11videosurface.h b/src/plugins/mediaservices/gstreamer/qx11videosurface.h index 1be963e..10f79a6 100644 --- a/src/plugins/mediaservices/gstreamer/qx11videosurface.h +++ b/src/plugins/mediaservices/gstreamer/qx11videosurface.h @@ -67,6 +67,9 @@ public: QRect displayRect() const; void setDisplayRect(const QRect &rect); + QRect viewport() const; + void setViewport(const QRect &rect); + int brightness() const; void setBrightness(int brightness); diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp index 83a811b..0477454 100644 --- a/src/script/bridge/qscriptqobject.cpp +++ b/src/script/bridge/qscriptqobject.cpp @@ -2074,6 +2074,7 @@ void QObjectConnectionManager::execute(int slotIndex, void **argv) JSC::JSValue slot; JSC::JSValue senderWrapper; int signalIndex = -1; + QScript::APIShim shim(engine); for (int i = 0; i < connections.size(); ++i) { const QVector<QObjectConnection> &cs = connections.at(i); for (int j = 0; j < cs.size(); ++j) { diff --git a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp index adea384..16efba9 100644 --- a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp +++ b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp @@ -340,6 +340,7 @@ void tst_qdeclarativedom::loadImports() "Item {}"; QDeclarativeEngine engine; + engine.addImportPath(SRCDIR "/data"); QDeclarativeDomDocument document; QVERIFY(document.load(&engine, qml, QUrl::fromLocalFile(SRCDIR "/data/dummy.qml"))); diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 041fd4d..2791722c 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -1248,7 +1248,6 @@ void tst_qdeclarativeecmascript::regExpBug() QDeclarativeComponent component(&engine, TEST_FILE("regExp.qml")); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); QVERIFY(object != 0); - QEXPECT_FAIL("", "QTBUG-9367", Continue); QCOMPARE(object->regExp().pattern(), QLatin1String("[a-zA-z]")); } diff --git a/tests/auto/declarative/qdeclarativeimage/data/heart-mac.png b/tests/auto/declarative/qdeclarativeimage/data/heart-mac.png Binary files differnew file mode 100644 index 0000000..d7df0e4 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeimage/data/heart-mac.png diff --git a/tests/auto/declarative/qdeclarativeimage/data/heart200-mac.png b/tests/auto/declarative/qdeclarativeimage/data/heart200-mac.png Binary files differnew file mode 100644 index 0000000..df22325 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeimage/data/heart200-mac.png diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index 9073750..bbf7421 100644 --- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -155,7 +155,7 @@ void tst_qdeclarativeimage::imageSource() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeImage *obj = qobject_cast<QDeclarativeImage*>(component.create()); QVERIFY(obj != 0); - + if (remote || async) TRY_WAIT(obj->status() == QDeclarativeImage::Loading); @@ -266,7 +266,11 @@ void tst_qdeclarativeimage::svg() QCOMPARE(obj->pixmap().height(), 300); QCOMPARE(obj->width(), 550.0); QCOMPARE(obj->height(), 500.0); +#if defined(Q_OS_MAC) + QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart-mac.png")); +#else QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart.png")); +#endif obj->setSourceSize(QSize(200,200)); @@ -274,8 +278,11 @@ void tst_qdeclarativeimage::svg() QCOMPARE(obj->pixmap().height(), 200); QCOMPARE(obj->width(), 550.0); QCOMPARE(obj->height(), 500.0); +#if defined(Q_OS_MAC) + QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200-mac.png")); +#else QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200.png")); - +#endif delete obj; } diff --git a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp index c5bdfc8..fe5f5a2 100644 --- a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp +++ b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp @@ -43,6 +43,7 @@ #include <QtDeclarative/qdeclarativeengine.h> #include <QtDeclarative/qdeclarativeimageprovider.h> #include <private/qdeclarativeimage_p.h> +#include <QImageReader> // QDeclarativeImageProvider::request() is run in an idle thread where possible // Be generous in our timeout. @@ -76,28 +77,35 @@ private: class TestProvider : public QDeclarativeImageProvider { public: - QImage request(const QString &id) { - QImage image; - image.load(SRCDIR "/data/" + id); - return image; + QImage request(const QString &id, QSize *size, const QSize& requested_size) { + QImageReader io(SRCDIR "/data/" + id); + if (size) *size = io.size(); + if (requested_size.isValid()) + io.setScaledSize(requested_size); + return io.read(); } }; void tst_qdeclarativeimageprovider::imageSource_data() { QTest::addColumn<QString>("source"); + QTest::addColumn<QString>("properties"); + QTest::addColumn<QSize>("size"); QTest::addColumn<QString>("error"); - QTest::newRow("exists") << "image://test/exists.png" << ""; - QTest::newRow("missing") << "image://test/no-such-file.png" + QTest::newRow("exists") << "image://test/exists.png" << "" << QSize(100,100) << ""; + QTest::newRow("scaled") << "image://test/exists.png" << "sourceSize: \"80x30\"" << QSize(80,30) << ""; + QTest::newRow("missing") << "image://test/no-such-file.png" << "" << QSize() << "\"Failed to get image from provider: image://test/no-such-file.png\" "; - QTest::newRow("unknown provider") << "image://bogus/exists.png" + QTest::newRow("unknown provider") << "image://bogus/exists.png" << "" << QSize() << "\"Failed to get image from provider: image://bogus/exists.png\" "; } void tst_qdeclarativeimageprovider::imageSource() { QFETCH(QString, source); + QFETCH(QString, properties); + QFETCH(QSize, size); QFETCH(QString, error); if (!error.isEmpty()) @@ -106,7 +114,7 @@ void tst_qdeclarativeimageprovider::imageSource() engine.addImageProvider("test", new TestProvider); QVERIFY(engine.imageProvider("test") != 0); - QString componentStr = "import Qt 4.6\nImage { source: \"" + source + "\" }"; + QString componentStr = "import Qt 4.6\nImage { source: \"" + source + "\"; " + properties + " }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeImage *obj = qobject_cast<QDeclarativeImage*>(component.create()); @@ -118,8 +126,10 @@ void tst_qdeclarativeimageprovider::imageSource() if (error.isEmpty()) { TRY_WAIT(obj->status() == QDeclarativeImage::Ready); - QCOMPARE(obj->width(), 100.); - QCOMPARE(obj->height(), 100.); + QCOMPARE(obj->width(), 100.0); + QCOMPARE(obj->height(), 100.0); + QCOMPARE(obj->pixmap().width(), size.width()); + QCOMPARE(obj->pixmap().height(), size.height()); QCOMPARE(obj->fillMode(), QDeclarativeImage::Stretch); QCOMPARE(obj->progress(), 1.0); } else { diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/InstalledTest.qml b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/InstalledTest.qml index d8a22a8..38cf6bb 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/InstalledTest.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/InstalledTest.qml @@ -1,2 +1,2 @@ -import Qt 4.6 -Rectangle {} +import Qt 4.6 as Qt +Qt.Rectangle {} diff --git a/tests/auto/declarative/qdeclarativetextinput/data/validators.qml b/tests/auto/declarative/qdeclarativetextinput/data/validators.qml index efe7570..531a232 100644 --- a/tests/auto/declarative/qdeclarativetextinput/data/validators.qml +++ b/tests/auto/declarative/qdeclarativetextinput/data/validators.qml @@ -15,7 +15,7 @@ Item { validator: DoubleValidator{top: 12.12; bottom: 2.93; decimals: 2; notation: DoubleValidator.StandardNotation} } TextInput { id: strInput; - validator: RegExpValidator { regExp: RegExp(/[a-zA-z]{2,4}/) } + validator: RegExpValidator { regExp: /[a-zA-z]{2,4}/ } } } diff --git a/tools/designer/src/lib/shared/qtresourceview.cpp b/tools/designer/src/lib/shared/qtresourceview.cpp index 3c7010c..18fd07b 100644 --- a/tools/designer/src/lib/shared/qtresourceview.cpp +++ b/tools/designer/src/lib/shared/qtresourceview.cpp @@ -421,7 +421,7 @@ void QtResourceViewPrivate::filterOutResources() // 3) we hide these items which has pathToVisible value false. const bool matchAll = m_filterPattern.isEmpty(); - const QString root(QLatin1Char(':')); + const QString root(QLatin1String(":/")); QQueue<QString> pathQueue; pathQueue.enqueue(root); |