aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlimport.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QQmlImport: Don't try use a dangling pointer.Robin Burchell2013-12-031-2/+1
| | | | | | | | | | | toUtf8 would return a temporary, and constData would hold a pointer inside that temporary. This isn't even remotely safe. Move the pointer use down to the initializeEngine call so it is kept around long enough for us to do our stuff. Task-number: QTBUG-35355 Task-number: QTBUG-35343 Change-Id: Ie816d0d1a37e42607f26d9ad02cf999f3d459cd9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Check that the pathlist is not empty before calling sort() on itLars Knoll2013-11-201-1/+2
| | | | | | | | | | Try to fix QTBUG-34834, where the app crashes because we replaced qSort with std::sort(). Apparently std::sort always dereferences begin(), even if it is the same as end(). Task-number: QTBUG-34834 Change-Id: I6207a27f61f21265dd964d7f4a6b78d059c615c8 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix various compiler warnings in order to remove warn_off in the near futureErik Verbruggen2013-11-041-3/+5
| | | | | Change-Id: Ic0492fbe31a1e134674bc6c20381f735dd6d5b7a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* qqmlimport: avoid deadlock by scoping the usage of QWriteLockerRichard Moe Gustavsen2013-10-161-31/+34
| | | | | | | | | | | | | | | | | Change a9cf828559b00bc70f59250b7f3cf38458774715 refactored QQmlImportDatabase::importPlugin() to be used for both dynamic and static plugin loading. In the process, the scope of a QWriteLocker protecting a call to registerTypes ended up to wide. That caused a deadlock to occur for some static qml applications since the lock remained active during a subsequent call to initializeEngine. So narrow the the scope down to be exactly as it wore before the change. This will remove the deadlock. Change-Id: Ibb15c953c0f693fe75dab24f0093c3bddb3f0cbb Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Support statically linked module pluginsRichard Moe Gustavsen2013-10-111-109/+241
| | | | | | | | | | | | | | | | | | | | | | | | | Up til now, QQmlImports would always assume module plugins are dynamically linked, and as such, go looking for them on the file system. This would fail for plugins linked in statically. This patch will hook into QQmlImports at the place where it iterates through all plugins in a qmldir and try to load them dynamically. If some plugins cannot be resolved, we now do an extra interation over static plugins to check if any of them has the correct uri specified in their metadata. Hooking into the loading process this late, will ensure that as much code as possible is shared between dynamic and static plugin loading so that setting up base urls, namespaces and guards will remain the same. Note: this patch is one out of several patches that is needed to build QML2 apps statically, and depends on plugins reporting their URI through the plugin meta data system. This will be injected automatically by qmake+moc. Task-number: QTBUG-28357 Change-Id: If9a204e942ca7003448e188a1a47eec69b34c37b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add Singleton support for QMLAntti Piira2013-09-211-16/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces Singleton support for QML (Composite Singleton). For now, the Singleton support is only availabe for QML types in modules or (remote and local) directories with qmldir file. However, in the future this support may be expanded to arbitrary QML file imports without by leaving out the qmldir requirement. You define a QML type as a Singleton with the following two steps: 1. By adding a pragma Singleton to a type's QML file: pragma Singleton The pragma and import statements can be mixed and their order does not matter. Singleton is the only supported pragma for now. Others will generate errors. 2. By specifying a qmldir file for the directory of your imported type and prepending the type with "singleton" keyword as follows: singleton TestTypeSingleton TestTypeSingleton.qml Alternatively you may specify a qmldir file for a module and specify your type as a singleton as follows: singleton TestTypeSingleton 1.0 TestTypeSingleton.qml Composite Singletons may be included in a module and may be used with a local namespace qualifier when imported with: "import xxx as NameSpace" A singleton instance is created at first use and stored into the QmlEngine (one instance per engine) and eventually released by the engine's destructor. CompositeSingletonType has a dual nature and will return true to both isComposite() and isSingleton() calls. In most cases its enough to check for just isComposite() or isSingleton(). However, there is a isCompositeSingleton() available as well. I used "qlalr --no-debug --no-lines --qt qqmljs.g" to generate the qqmljsparser and qqmljsgrammar files from qqmljs.g. Unit tests are included. Change-Id: I91b303612c5e132143b325b9a8f982e9355bc90e Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
* Remove qSort usages from declarativeGiuseppe D'Angelo2013-09-131-1/+3
| | | | | | | | | QtAlgorithms is getting deprecated, see http://www.mail-archive.com/development@qt-project.org/msg01603.html Change-Id: I8fa7d0186cc8f0ba562695974829e37f1eb87f2f Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Merge branch 'stable' into devSergio Ahumada2013-09-061-16/+38
|\ | | | | | | | | | | | | | | | | Conflicts: src/qml/debugger/qv8debugservice.cpp src/qml/qml/v8/qv8engine.cpp tests/auto/quick/qquickitem/qquickitem.pro Change-Id: Ic4a1dcdd8b8a84155d2f2abefdf1da5c3a56af31
| * Fix qmlClearEnginePlugins() to clear engine plugins.Dominik Holland2013-09-051-16/+38
| | | | | | | | | | | | | | Task-number: QTBUG-32078 Change-Id: I2d3aeb6b91ffdb9b8c70ad93d1e43daada84fb7f Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
* | Remove an overoptimisation that was only used (wrongly) in one placeLars Knoll2013-06-281-1/+1
| | | | | | | | | | | | | | | | Let's simplify this code. The goal is to replace most of the code in qhashedstring with an identifier based hash table. Change-Id: I2f9a38ad0bb2f43a2b2b87914823c23ed231f48c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-05-281-0/+8
|\| | | | | | | | | | | | | | | Conflicts: src/quick/doc/src/appdevguide/porting.qdoc sync.profile Change-Id: Iec5516c596c3eca60a3e6ceb1d45f2a7a1595c12
| * Add qmlClearRegisteredTypes FunctionAlan Alpert2013-05-071-0/+8
| | | | | | | | | | | | | | | | | | | | | | Registered types are stored in a global static variable, not on an engine instance. For applications managing multiple engines over their lifetime, there needs to be a way to clear the existing types so they can register new ones and avoid memory leaks. Task-Number: QTBUG-28572 Change-Id: Ic70a4dd1e29d99399b21fb42eaf10d4a52bf2adf Reviewed-by: Christopher Adams <chris.adams@jollamobile.com>
* | Adjust ifdefs to accommodate WinRTAndrew Knight2013-05-031-1/+1
|/ | | | | | | | | | Slight preprocessor changes for the upcoming platform. Change-Id: Ia13ef22f511afa781d31a759f75eae4d745558fa Reviewed-by: Oliver Wolff <oliver.wolff@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Alan Alpert <aalpert@blackberry.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Delay loading implicit importAlan Alpert2013-03-271-4/+10
| | | | | | | | As a performance improvement to avoid extra filesystem access, only import "." if it is needed for type resolution. Change-Id: If9be25deb3205f8c81f9f418404d9fb41bebb84f Reviewed-by: Christopher Adams <chris.adams@jollamobile.com>
* Compile fix.Samuel Rødal2013-03-131-1/+1
| | | | | | | | Some compilers don't allow the first argument to printf and similar functions to be a non-literal string. Change-Id: Idd11ae6679d5c0585b5d10b76c991dcfdb4f65da Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Make the base URL available to QQmlExtensionPluginShawn Rutledge2013-02-191-0/+6
| | | | | | | | This is for the benefit of any plugin which needs to interact with the QML files or related assets which are also located in its import directory. Change-Id: Id23ec279b4d017bd3f620c3a7916dac9f9ac29bc Reviewed-by: Alan Alpert <aalpert@rim.com>
* Add Composite Types to QQmlTypeAlan Alpert2013-02-181-42/+65
| | | | | | | | | When a composite type is loaded from a QML file, it now generates a QQmlType entry in QQmlMetaTypeData. Change-Id: I9b127dff7955456aacb25138fa6ea8efb7bb9221 Reviewed-by: Christopher Adams <chris.adams@jollamobile.com> Reviewed-by: Alan Alpert <aalpert@rim.com>
* Fix lupdate-warnings in qqmlimport.cpp.Friedemann Kleint2013-02-061-13/+9
| | | | | | | | | | qqmlimport.cpp:738: Class 'QQmlImportsPrivate' lacks Q_OBJECT Remove tr()-function and use QQmlImportDatabase::tr() directly. Change-Id: I3a1561c57a6ee90d271a6043b0175e17a7828666 Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
* Fix memory leakAlan Alpert2013-01-291-0/+1
| | | | | | | | | The cache is filled with dynamically created entries, so clear is not quite enough. Change-Id: I40a49ce5d1a3d6da1b419e85cae95f2f95011a19 Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Christopher Adams <chris.adams@jollamobile.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-101-1/+1
| | | | | | Change-Id: I6c3bd7bebe3d62d1cfd0fa6334544c9db8398c76 Reviewed-by: Akseli Salovaara <akseli.salovaara@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Fix other warnings in qtdeclarative found by GCC 4.7Thiago Macieira2012-12-231-0/+1
| | | | | | | | | | | | | qml/qml/qqmlimport.cpp:982:30: error: unused parameter 'errors' [-Werror=unused-parameter] quick/util/qquickanimationcontroller.cpp:66:6: error: unused parameter 'job' [-Werror=unused-parameter]' quick/items/qquickshadereffectnode.cpp:160:17: error: case value '38' not in enumerated type 'QVariant::Type' [-Werror=switch] quick/items/qquickwindowmanager.cpp:286:60: error: 'renderTime' may be used uninitialized in this function [-Werror=maybe-uninitialized] quick/items/qquickitem.cpp:5267:67: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] and a few more repeated from the above Change-Id: Id1950c6ba98f7f8475975716b21bd795ecb4bd20 Reviewed-by: Alan Alpert <aalpert@rim.com>
* Use the new QLibraryInfo::Qml2ImportsPath path for QML 2.Thiago Macieira2012-11-191-3/+3
| | | | | | | | | | Also change the environment variable to be QML2_IMPORT_PATH. This splits the imports from QML 1 (the QtDeclarative library). Change-Id: Icadbf96283b1cf071ed0deb04e8c8476da664009 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Christopher Adams <chris.adams@jollamobile.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-231-24/+24
| | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: Ie7f5d49ed8235d7a7845ab68f99ad1c220e64d5c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Refactor singleton type registration codeChris Adams2012-08-281-20/+2
| | | | | | | | | | | Previously each singleton type was registered as an implicit separate import. This commit changes the code so that these types are treated just like any other type in the registration sense. It also ensures that singleton types are instantiated per-engine. Change-Id: I5c81c4ca5bf65210f7125d74a62a282a21838068 Reviewed-by: Matthew Vogt <matthew.vogt@nokia.com>
* Change error messages to reflect new module terminologyChris Adams2012-08-091-3/+3
| | | | | | | | | | | | | Previously, modules which registered types into a protected type namespace were known as "strict" modules; now they are known as "identified" modules. This commit also adds a unit test to ensure that the module identifier directive is the first command in the qmldir file. Change-Id: I90e9d2c5b51ecb2b9d058c9fe9d9310fd3cd4f45 Reviewed-by: Matthew Vogt <matthew.vogt@nokia.com> Reviewed-by: Bea Lam <bea.lam@nokia.com>
* Add type name to singleton (module api) implementations.Glenn Watson2012-08-081-4/+15
| | | | | | | | | | | | | This change renames the previous module api implementation to singleton types. When a singleton type is registered, a type name must be provided that is used when accessing the API from QML. This makes the implementation more consistent with the rest of QML. Task-number: QTBUG-26549 Change-Id: Iab0bb1ccf516bd3ae20aee562a64d22976e0aecd Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* Implement strict mode for qmldir modulesMatthew Vogt2012-07-311-4/+49
| | | | | | | | | | | | | | | Allow a module's qmldir to contain a module directive, which when present specifies 'strict mode' import processing. In strict mode, type registrations are only permitted into the namespace identified in the qmldir file's module directive. In addition, any type registrations to that namespace originating from other modules are treated as error conditions. Task-number: QTBUG-26551 Change-Id: I081bde2d3b83d3f28524440177fb2cd1ccee34ad Reviewed-by: Chris Adams <christopher.adams@nokia.com> Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* Fix QML import paths in Qt resources.Aaron McCarthy2012-07-271-0/+5
| | | | | | | | | | | | | | | Allow adding qrc: urls as import paths. Store an import path of the form :/import/path as qrc:/import/path which is expected by other parts of the code. Update documentation for QQmlEngine::addImportPath() to explicitly state what types of paths are supported. Add auto tests to check that importing a module from a Qt resource works. Change-Id: If0e75c75078a608b20d7a5c4080bccf6241e97f6 Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* Select appropriate version for located module componentsMatthew Vogt2012-07-171-26/+28
| | | | | | | | | When a located module is imported with a version specifier, ensure that the components resolved from that module use the appropriate version. Task-number: QTBUG-26473 Change-Id: I33209ddef3fe9bb0ab9d096dfe19aff233744afc Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* Improved error message wordingMatthew Vogt2012-07-171-2/+2
| | | | | | | | | When a qmldir contains multiple definitions with the same name and version numbers, the error message should indicate that the problem is localized to that qmldir file. Change-Id: I02cd4862c9ead2fd7ed1c75d0fa6949ab3eda6f6 Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* Support remote import pathsMatthew Vogt2012-07-161-351/+578
| | | | | | | | | | | Probe for installed modules in import path elements which are not local to the machine. Note that all local paths in the import path list will be tried before any remote locations are probed. Task-number: QTBUG-21386 Change-Id: I4f7b9e54e54c1d62a5e7cb7f059ee1e9319ef054 Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* load plugins properly when QT_NO_SETTINGS is definedTasuku Suzuki2012-07-101-2/+0
| | | | | Change-Id: I2d28d698f4bb5cc299f1ce83b1ecb7fa87bc5fdb Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Report clashing qmldir entries for components and scriptsMatthew Vogt2012-06-221-7/+33
| | | | | | | | | | If a qmldir contains multiple lines that install the same versioned property for a single component name or script qualifier, report an error rather than silently suppress one entry. Task-number: QTBUG-25834 Change-Id: I25d3a24102a5a4fa3d82f1d31d7e52505026fff7 Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* Optimize type resolutionMartin Jones2012-05-171-28/+33
| | | | | | | Faster qmlType() and resolveType() lookup. Change-Id: I096439f23bf6071e8bfdf0cda366cc71e00293ba Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* QtQuick: Fix string related warnings, single character strings.Friedemann Kleint2012-05-141-4/+4
| | | | | | | | | - Fix warnings about truncation from size_t to int (MSVC 2010, 64bit). - Remove single character strings. Change-Id: Iaf4406e4e04d55d2d8b762f3433269868842a6f9 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* Enable QML_IMPORT_TRACE for setImportPathList and setPluginPathListDenis Mingulov2012-05-091-0/+6
| | | | | | | | | | | | | Currently QQmlImportDatabase methods addPluginPath and addImportPath are providing a debug output by QML_IMPORT_TRACE environment variable. QQmlImportDatabase::setImportPathList and QQmlImportDatabase - do not. So the current import/plugin path list might be inconsistent with the provided debug output. This commit adds support for QML_IMPORT_TRACE for both 'set' methods. Change-Id: I52bb3c7b7e7e5c1119f5b73c7574da2952f4242d Reviewed-by: Matthew Vogt <matthew.vogt@nokia.com>
* Minor optimizations and cleanupAaron Kennedy2012-05-041-37/+59
| | | | | Change-Id: Iecbd5c46af00f649b1f1d78cdf5f2b40a2844897 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* Initial bundle supportAaron Kennedy2012-05-041-402/+567
| | | | | Change-Id: I095249f64ecf4ef1e3fbfb164e3d50edffab61e8 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* Remove relative directory elements in import pathsMatthew Vogt2012-04-261-7/+34
| | | | | | | | Avoid unnecessary conversions to/from QUrl. Change-Id: If52e78cfdaf4fe344f34d961e300b21dd4a11fb2 Reviewed-by: Michael Brasser <michael.brasser@nokia.com> Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* Make QML work with the new QUrl implementation.Martin Jones2012-04-191-0/+3
| | | | | Change-Id: Ie7a41670e467108ed68b67deb4987936465094a0 Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* Re-order imports statements to import nested imports laterMatthew Vogt2012-03-291-18/+18
| | | | | | | | | | | | | Re-order the imports for a script by increasing order of URI length. This ensures that an import of the type 'import X.Y' is processed after the import of 'import X' which contains the type definitions for the namespace X.Y. Task-number: QTBUG-24369 Change-Id: I1b06e9d114a97c9f47279f8f33383a27e0efb4bb Reviewed-by: Chris Adams <christopher.adams@nokia.com> Reviewed-by: Michael Brasser <michael.brasser@nokia.com> Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Ensure JS files imported inside modules work correctlyMatthew Vogt2012-03-191-13/+15
| | | | | | | | | When a module exports functionality provided by a script, ensure that imported script modules inside that script resolve correctly. Task-number: QTBUG-24596 Change-Id: I3885dcc56946423f0d7cf00afdcdfaa0cb11967a Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* Remove the usage of deprecated qdoc macros.Casper van Donderen2012-03-131-9/+9
| | | | | | | | | | QDoc now has support for Doxygen style commands for italics, bold and list items. This change applies that change in QDoc to the actual documentation. Task-number: QTBUG-24578 Change-Id: I62d203f21df63a95ee236e578b10418fd9680707 Reviewed-by: Jerome Pasion <jerome.pasion@nokia.com>
* Rename QDeclarative symbols to QQuick and QQmlMatthew Vogt2012-02-241-0/+1183
Symbols beginning with QDeclarative are already exported by the quick1 module. Users can apply the bin/rename-qtdeclarative-symbols.sh script to modify client code using the previous names of the renamed symbols. Task-number: QTBUG-23737 Change-Id: Ifaa482663767634931e8711a8e9bf6e404859e66 Reviewed-by: Martin Jones <martin.jones@nokia.com>