aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlimport.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Doc: replace Mac OS X with OS XNico Vertriest2015-07-151-1/+1
| | | | | | Task-number: QTBUG-40759 Change-Id: If21b4551eb95af3370cc21edd7a6721fc06e1346 Reviewed-by: Martin Smith <martin.smith@digia.com>
* Fix null pointer dereference in QQmlImportNamespaceVishesh Handa2015-05-201-4/+6
| | | | | Change-Id: Iaf61f38790b0dfddb924043e0a25eb8a882571c8 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Changed QML type lockingSimon Hausmann2015-04-161-1/+1
| | | | | | | | | | Replace the use of QReadWriteLock with a plain QMutex. At this point QReadWriteLock adds a lot of overhead due to its internal QHash and otherwise offers little over a recursive mutex, especially given that there is most of the time only one reading thread and one writing thread. Change-Id: I0a91e4a64cff5d25e4a133ed46b08912e81bb055 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fixing yet another memory leakRobert Griebl2015-03-251-2/+1
| | | | | Change-Id: I1c083a488f963f8dd40f3bd6db5a46ac9db66ffb Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-121-7/+7
| | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: I61120571787870c0ed17066afb31779b1e6e30e9 Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
* Typeloader cleanupSimon Hausmann2015-01-231-4/+0
| | | | | | | | | | | | | | | | | | The QQmlDataBlob base class had a typeloader member that was provided with startLoading() later, just to allow calling the url interceptor. The one sub-class of QQmlDataBlob - QQmlTypeLoader::Blob - also had a typeloader pointer, provided at constructor time. This patch cleans this up by removing the duplicated typeloader pointer in the sub-class and passing it straight through to the base-class at construction type. This also allows moving the url interception to the constructor. Also fixed the findCachedCompilationUnit calls to use the url after applying the intercept and removed one unnecessary findCachedCompilationUnit call - the QFile::exists call is sufficient. Change-Id: If5c49d38a6ec66fea6cd7c21013c046cf75acafd Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Allow importing protected modules with different major versionsJ-P Nurmi2015-01-081-8/+8
| | | | | | | | This allows QtQuick.Controls 1.x and 2.x imports to co-exist even if they are two different plugins with the same module directive. Change-Id: Idee302439e3c2fd6813ba2f41b69144fbae7902c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove QML bundle codeSimon Hausmann2014-12-121-42/+9
| | | | | | | | | | This feature is effectively not maintained, experimental and undocumented. Consensus on the mailing list is to remove it: http://lists.qt-project.org/pipermail/development/2014-December/019384.html Change-Id: Iaa73b3e90806c338ef81bbd4307ddd2addd37964 Reviewed-by: Christopher Adams <chris.adams@jollamobile.com>
* Fix loading of .ui.qml form files with cached compilation unitsSimon Hausmann2014-12-021-15/+21
| | | | | | | | | Simplify the type loading logic and try the Type -> Type.qml and Type -> Type.ui.qml mapping in a simple loop that tries off-disk and cached compilation unit loading. Change-Id: I537feabd0a158a71f330bede9e6988291298ae81 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* introduce *.ui.qml file types as new forms file typeTim Jenssen2014-08-291-0/+7
| | | | | Change-Id: I1f07b6c1ab8afac7ee7ad05e988fe313ba904705 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
* Add new property "designersupported" to qmldirTim Jenssen2014-08-281-0/+16
| | | | | | | | | | | | | | | | | This patch adds a property called "designersupported" to qmldir. This allows the Qt Quick Designer to only load plugins that have the line ""designersupported"" in their qmldir file. So the designer can load sub components without risking to load plugins that have never been tested in the designer and that might crash. The check for "designersupported"" is activated by using QQmlImports::setDesignerSupportRequired(). Change-Id: I4bf07cc163faa47996eacb1365a7961c51c51060 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com> Reviewed-by: Tim Jenssen <tim.jenssen@digia.com>
* Update license headers and add new licensesJani Heikkinen2014-08-251-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 & LICENSE.GPLv2 - Removed LICENSE.GPL Change-Id: I84a565e2e0caa3b76bf291a7d188a57a4b00e1b0 Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>
* Fix potential null pointer dereferencingFrederik Gladhorn2014-05-301-6/+10
| | | | | | | | | These were found by http://www.viva64.com/en/b/025 most issues are rather cosmetic. Change-Id: I7cc12610aae6a43d26bedb9b480863c0695ddfa3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix cached compilation units for file importsSimon Hausmann2014-05-261-0/+2
| | | | | | | | | | If the file doesn't exist in the file system anymore, check if it's at least in the unit cache, as we can still load it from there. This is used for file imports where 'import "someDirectory"' results us in trying to locate someDirectory/<Type>.qml for any instantiation of <Type>. Change-Id: I590161f1d2d133a49ca1b611d9a7e96d52d0bf13 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Extend the QML bootstrap library by the IR buildersSimon Hausmann2014-04-231-2/+3
| | | | | | | | | | | | | This is among other things needed to fix the qml import scanner to detect dependencies from .js files correctly. The patch also fixes the use of Q_QML_EXPORT towards Q_QML_PRIVATE_EXPORT where appropriate and corrects the wrong include path for the double conversion code to actually be relative to the file it is included from. This worked by accident because of other include paths present in the build. Change-Id: I338583dad2f76300819af8ab0dae8e5724c84430 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* CleanupSimon Hausmann2014-03-191-5/+5
| | | | | | | | Get rid of QQmlScript::Import in favor of operating on QV4::CompiledData::Import structures throughout the type loader. Change-Id: I29de369373a3dc4fd8e7f30517b804edcce93e7a Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix QmldirCache object leakLiang Jian2014-03-141-3/+18
| | | | | | | Delete all the QmldirCache objects in the linked list Change-Id: I9948ccce3d72aaed4f8b14b131e040177d7a15ef Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Static plugins: support loading static plugins from several enginesRichard Moe Gustavsen2014-03-131-12/+52
| | | | | | | | | | | | | When loading dynamic plugins, we register them as loaded so that we don't try to register their types several times if using several engines. The same was not done for static plugins. This patch will ensure that we follow the same logic also for static plugins. Task-number: QTBUG-36532 Change-Id: Icc1e089ae5d682c38b2d36bf4808f1c753c122a4 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Make QML import thread safe.Ulf Hermann2014-01-301-7/+14
| | | | | | | | Protect the common qmlEnginePluginsWithRegisteredTypes by a mutex. Task-number: QTBUG-36542 Change-Id: Ia3c731f030b778d862239486cc6c1bfa441503e6 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* fix whitespaceOswald Buddenhagen2014-01-221-2/+2
| | | | | | | remove trailing spaces and expand tabs Change-Id: Ieacb9d096b612c45d1a64700044c114d1f7522bc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* 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>