Commit Graph

366 Commits

Author SHA1 Message Date
Simon Hausmann 9d7b27f5bf Clean up JS .import/.pragma directive scanning
There's a scanner in QQmlJS::Lexer::scanDirectives that can parse those, so
let's get rid of extra parser that operates on a string. Instead this way we
can do the scanning all in one shot, avoid detaching a copy of the source code
string and (most importantly) bring the parser closer to the copy in Qt
Creator, which uses the directives approach to extract imports and pragma.

Change-Id: Iff6eb8d91a45d8a70f383f953115692be48259de
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@theqtcompany.com>
2015-01-08 22:08:19 +01:00
Konstantin Ritt 802a996693 Fix build on MinGW
- alloca() needs malloc.h
- crtdbg.h couldn't be found on MinGW

Change-Id: Ibbf91a58d39ef1e2572baae3c409393acf7aa5df
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-12-28 18:46:59 +01:00
Lars Knoll d3a6412c66 Remove most of the places where getPointer() is used
This is no longer required, and simply uglifies the code

Change-Id: Iba91a1d7735ebe23a43437f137a488423b6eb743
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-12-20 07:39:55 +01:00
Lars Knoll 05bf96997c Return Heap::ExecutionContext for globalContext()
Change-Id: Ide7c81735be4662ff45bf268cfe750ff1f784453
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-12-19 18:52:07 +01:00
Alain Martin 362e1de06d Add -P argument to qmlscene to specify plugins search path
Allow users to specify locations of compiled QML plugins.

Change-Id: I0ad764282a7891013ce0cfa008a1cf8164cb083b
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
2014-12-17 20:54:36 +01:00
Simon Hausmann 88508e9f40 Remove QML bundle code
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>
2014-12-12 06:13:47 +01:00
Lars Knoll 4322c8d768 Better encapsulate access to the global object
Change-Id: I8a76112d821cb3fc172ba0d16ee8410d39b4422a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-12-11 08:40:48 +01:00
Lars Knoll ddfe9defa8 Encapsulate accesses to the root context
Change-Id: I668cef1363a5c1a5c5b9a7e138f3bd0338712eea
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-12-11 08:40:41 +01:00
Simon Hausmann ff466a1881 Merge remote-tracking branch 'origin/5.4' into dev
Conflicts:
	src/qml/jsruntime/qv4arraydata.cpp
	src/qml/jsruntime/qv4context_p.h
	src/qml/jsruntime/qv4globalobject.cpp
	src/qml/jsruntime/qv4internalclass.cpp
	src/quick/items/qquicktext_p.h
	src/quick/items/qquicktextedit_p.h
	src/quick/items/qquicktextinput_p.h

Change-Id: If07e483e03197cb997ef47a9c647a479cdb09f4c
2014-12-09 15:09:26 +01:00
Lars Knoll 3dc7b5ddf6 Cleanup exception catching code
Change-Id: I85afd5758f72e19c280dc196601ee145f0c25f01
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-11-15 13:16:28 +01:00
Lars Knoll 7cc5fb2b53 Cleanup: remove Value::toString/Object overloads taking a context
Change-Id: I4cb63c3cc4eb9bb81f10f9826f80e581b4e1990c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-11-15 11:25:09 +01:00
Pasi Petäjäjärvi e6a419d0e3 qml: obey QT_NO_REGULAREXPRESSION define
Not all platforms do have QRegularExpression as it is based on
pcre.

Change-Id: I3247f8b2213f78a6e537f6781d97b0c6382482ad
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-11-11 11:11:41 +01:00
Lars Knoll ef8ad8234b Move Data of FunctionObject and related classes into Heap
Change-Id: Iadf74f953798c1884e0ec704ccb7c70d971e3273
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-11-08 19:47:34 +01:00
Pierre Rossi 868def84fe qmlscene: Simplify context sharing logic.
We can use the new application attribute for this now.

Change-Id: Ia0a6d13d36316ec9becfb5d3251b8461ac73a2d0
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
2014-11-07 17:24:26 +01:00
Thiago Macieira be9c969b13 Don't use qDebug and qWarning for formatted output
They are not meant to be used like that. If you want formatted output to
the console, use stdio.h functions or std::cout. Otherwise, you get
something like:

 $ qmlscene -h
 [233103.196] (126848)(usage|?qmlscene?|__libc_start_main|?qmlscene?): Usage: qmlscene [options] <filename>
 [233103.197] (126848)(usage|?qmlscene?|__libc_start_main|?qmlscene?):
 [233103.197] (126848)(usage|?qmlscene?|__libc_start_main|?qmlscene?):  Options:
 [233103.198] (126848)(usage|?qmlscene?|__libc_start_main|?qmlscene?):   --maximized ............................... Run maximized
 [...]

I've replaced all qDebug with puts/printf and most qWarning with fprintf
to stderr. In my opinion, some of the qWarnings aren't errors, so I
replaced those with puts/printf too.

Change-Id: I3e493950bc4a588059fec6c7441b010c2780dffd
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-10-31 19:16:47 +01:00
Shawn Rutledge 05d8ffb4df Revert: use the new form of QTranslator::load() for more flexibility
This reverts commit 427646b8d7.
It seems that it should have been more correct, but we are still not
shipping English translations, and static QString find_translation()
in qtranslator.cpp will return any language which is in
QLocale::uiLanguages() for which the translation file is found.
That is a long list on OSX.

Reverting the patch means find_translation() is not called in
such cases.  This change can be re-done whenever we are more sure
that the attempt to find a translation will succeed in finding a
sensible one, or fall back to not translating, rather than choosing
a language that the user didn't intend.

Task-number: QTBUG-41977
Change-Id: I425946cc71cec96b4f38629eb2b7e80220c5236d
Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
2014-10-28 12:37:05 +01:00
Shawn Rutledge 427646b8d7 use the new form of QTranslator::load() for more flexibility
As the docs explain, the variant of QTranslator::load() taking a
const QLocale& is better because it "uses QLocale::uiLanguages()
and not simply the locale name, which refers to the formatting of
dates and numbers and not necessarily the UI language."  And, using
a default-constructed QLocale permits QLocale::setDefault() to
override the system locale, so for example an application's
main.cpp can do that before constructing a QQmlApplicationEngine.

Task-number: QTBUG-7329
Change-Id: Ia29a4c894087c92b071c0fe484728866f2660fe6
Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
2014-10-01 15:14:23 +02:00
Shawn Rutledge 3ec6520117 qmlimportscanner: parse "depends" lines in qmldir files
These lines specify additional hidden dependencies.  The first use case
is in QtQuick.Dialogs: DefaultFileDialog.qml uses FolderListModel, but
this file is not listed in the qmldir because the decision whether to
use it is made at runtime.  So QtQuick.Dialogs qmldir contains this:
depends Qt.labs.folderlistmodel 1.0

Task-number: QTBUG-41489
Change-Id: Ide4bca2ce2e342b95e9a87cc418d26f331372d12
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
2014-10-01 14:40:52 +02:00
Fawzi Mohamed 26387cf498 qmlimportscanner: allow a qmlFile to come from stdin
Change-Id: I22b0e45a8aa25d232791cdbeca15b5bc7400ae7d
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
2014-09-25 16:13:34 +02:00
Friedemann Kleint 3f1156ee5f qmlplugindump: Use _CrtSetReportMode() for MSVC only.
Fix warnings when using MinGW:

main.cpp: In function 'int main(int, char**)':
main.cpp:734:55: warning: statement has no effect [-Wunused-value]
     _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
                                                       ^
main.cpp:735:53: warning: statement has no effect [-Wunused-value]
     _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG);
                                                     ^
main.cpp:736:54: warning: statement has no effect [-Wunused-value]
     _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG);

where _CrtSetReportMode() is an empty macro.

Change-Id: I644bc207b5a3df62d6390811f53b2c0948979d58
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
2014-09-19 12:41:00 +02:00
Shawn Rutledge 4d861e830a qmlscene: load master translation file before more specific ones
It was giving up too early because qmlscene_??.qm doesn't exist.
The file qt_??.qm links to all existing Qt-provided translation files,
so it is enough by itself unless there are application-specific
translations besides.

Change-Id: Iebedf54ddb4eef4f4d7da8a7fade1850a366aee8
Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
2014-09-04 14:32:11 +02:00
Jani Heikkinen e7ceacda70 Update license headers and add new licenses
- 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>
2014-08-25 11:28:46 +02:00
Ulf Hermann 74f483f231 Write memory events into tracefiles generated by qmlprofiler
Change-Id: Ic01505194f29967ed1aad16fe36e14dc5532ae25
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-08-12 10:16:40 +02:00
Gunnar Sletta 9737b35ac0 Merge branch '5.3' into dev
Conflicts:
	src/quick/items/context2d/qquickcontext2d.cpp
	src/quick/items/context2d/qquickcontext2dtexture.cpp

Change-Id: I1a9b911b3a92333a5dddbaf43275f71bad2006f0
2014-08-07 11:31:23 +02:00
Sérgio Martins 4e65caefe6 Introducing qmllint tool.
A command line program that returns 0 if a .qml file is syntactically
correct.

Ideal to integrate into continuous integration systems.

[ChangeLog][QtQml] Added QML linter tool.

Change-Id: Id420159298e9d2390acd870fee9cf1c3d08e2dec
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-08-05 18:49:30 +02:00
Jocelyn Turcotte ead09e6b1f Use the renamed qt_gl_global_share_context
Change-Id: I438c33a1dc83fd0cd1ec08bb4e4a1257a3216ca2
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
2014-08-05 12:29:25 +02:00
Fawzi Mohamed d676b0ec01 qmlplugindumper: do not pop up a window if an assert is triggered
On windows the debug version of qmlplugindumper used to show a panel on
assert failure. Failure should be silent.

Done-with: Thomas Hartmann <thomas.hartmann@digia.com>
Task-number: QTCREATORBUG-12644
Change-Id: Ib5036754b37cdd5e3820e0cfd60b3ef7df3f1fb6
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
2014-08-01 22:18:29 +02:00
Erik Verbruggen d10b97563f Rename main.cpp to qmljs.cpp.
Finding the one "right" main.cpp (when there are 90 of them) is hard. So
give at least this important one a good name.

Change-Id: I121f8cbd67bfa9e8ba9ccac384eed45eb46f0b75
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-07-23 17:22:41 +02:00
Lars Knoll da9d501661 Fix Managed::as<>() method
The as<> casting method was not doing the right thing
in 100% of the cases. It only checked if the object in
question was exactly of the type being asked for. It
however didn't check if the object was derived from the
type.

This commit fixes this by adding a parent chain to the
vtables, that is then being used to check this safely
at runtime.

Change-Id: I9e0b13adbda668aee8c7451e2bb71cd6d4e316d9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-07-22 13:49:20 +02:00
Simon Hausmann b393c405b7 Change the object allocation scheme
Instead of allocating the data directly, centralize the object and its ::Data
allocation in one place in the memory manager. This is in preparation for
additional pointer indirection later.

Change-Id: I7880e1e7354b3258b6a8965be378cd09c9467d25
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-07-22 13:49:19 +02:00
Lars Knoll dba56a752c Convert remaining FunctionObject's to new constructor scheme
Change-Id: I440d5b128d0ee28566ebfa82c2505a4bd97bba6b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-07-22 13:49:18 +02:00
Lars Knoll 33593f00e8 Get rid of StringRef
Remove the Ref classes, as they won't be required
anymore once Managed and Managed::Data are separated.

Change-Id: Ic6bec2d5b4ecf2595ce129dbb45bbf6a385138a5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-07-22 13:49:12 +02:00
Lars Knoll 9744e8bd42 Convert ExecutionContext to new storage scheme
Change-Id: I9fcc13da5360f37cef3149b114ed9263b9b74281
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-07-22 13:49:11 +02:00
Lars Knoll 05f17e841f Get rid of different macros for vtable specializations
Detect existence of a a vtable entry at compile time.

Change-Id: Ieed5d34b063184bc4435b22c6685ac0e3fabf493
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-07-22 13:48:54 +02:00
Lars Knoll 4427576fe5 Avoid calling destroy() on most objects
The method is now optional, and we can simply avoid
calling it if all members an object has are themselves
garbage collected.

Change-Id: If560fce051908bcc10409ead1a7d8a5bd5fa71d2
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-07-22 13:48:53 +02:00
Shawn Rutledge 6622b87482 Tools and examples: consistently use organization name QtProject
This affects the location of the QSettings files or registry entries.
Other parts of Qt are using this organization name so it's good to
have all the settings in the same place.

[ChangeLog][QtQuick] tools and examples consistently use the
QtProject organization name

Change-Id: I1fae4eaed0248411fe95dda9572d38006648b162
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
2014-07-02 09:08:06 +02:00
Daiwei Li 8e1b88e457 Delete objects created by qmlplugindump
This helps plugin objects to shut down cleanly

Change-Id: I167f63220a35a7428f50715a4cb9072320ef1c87
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
2014-06-30 11:10:27 +02:00
Ulf Hermann ac56e7cda7 Javascript heap profiler
This profiler tracks every memory allocation and deallocation, by the
MemoryManager as well as the V4 VM, and exposes them as a stream of
events to the profiler service.

Change-Id: I85297d498f0a7eb55df5d7829c4b7307de980519
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-06-06 18:18:35 +02:00
Ulf Hermann 2371ec96da Properly support all events in trace files and clean up a bit.
In particular, use both message and range type to identify events so
that we can get rid of the messy type aliasing.

Task-number: QTBUG-36953
Change-Id: I691a7501aa285f78f7ce5b7017ef50628f44fcf7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-06-06 09:51:33 +02:00
Simon Hausmann 11a11d1280 Merge remote-tracking branch 'origin/stable' into dev
The merge conflict is about the removal of "d1" from the register
set on ARM, but that was already done in dev in commit ddb33ee9ba

The change in src/quick/scenegraph/coreapi/qsgrenderer.cpp with commit 2414f1675e
was reverted to what it was before, per Laszlo's advice.

Conflicts:
	src/qml/jit/qv4isel_masm.cpp

Change-Id: I7bce546c5cdee01e37853a476d82279d4e72948b
2014-06-04 17:02:55 +02:00
Simon Hausmann 69c6d26488 Disable qmlscene and qmlplugindump when doing static builds
Both of these tools rely on the ability to load plugins in order to function.
QmlScene in particular can theoretically be used with just "QtQml" imports
and QObjects, but that's not very useful for the _scene_ type of applications
qmlscene is intended for ;-). And in a static build it can't load QtQuick.

Task-number: QTBUG-39003
Change-Id: I0d4328dc4eb5c4e3153668e65a12f8eb3757f660
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
2014-06-02 15:36:11 +02:00
Frederik Gladhorn bf332f213b Merge remote-tracking branch 'origin/stable' into dev
Change-Id: I24827851643247b938b3a1b7182864293e5c3fe7
2014-05-13 22:12:48 +02:00
Frederik Gladhorn 66646dd8c3 Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
	.qmake.conf
	src/plugins/accessible/quick/quick.pro
	src/quick/items/qquickpincharea.cpp
	src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
	src/quick/scenegraph/qsgthreadedrenderloop.cpp

Manually adjusted for TestHTTPServer constructor change:
    tests/auto/quick/qquickimage/tst_qquickimage.cpp

Change-Id: I5e58a7c08ea92d6fc5e3bce98571c54f7b2ce08f
2014-05-10 11:53:47 +02:00
Jeff Tranter 52a46d332c Fix some typos in usage string.
Fix some spelling errors in the command usage string.

Change-Id: Iee94987d0a3dff78e39f588b4c21415ed40a514c
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
2014-05-09 16:08:38 +02:00
Friedemann Kleint 24bd75e08a qmlplugindump: Fix platform plugin specification.
Fix warning:
Project WARNING: CONFIG+=qpa_minimal_plugin is deprecated. Use QTPLUGIN.platforms=qminimal instead.

Change-Id: I81f92f86bd699854253b4e3fb7d0ae6eeab4aafc
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2014-05-05 18:04:30 +02:00
Simon Hausmann 41f0925dc8 Fix parsing of JS imports from JS files
If a .js file had an import of another .js file itself, like so:

    .import "otherFile.js" as Blah

then the import scanner would keep the quotes and store

    "\"otherFile.js\""

in the JSON as opposed to

    "otherFile.js"

This is fixed by making use of the same code for extracting the .import
statements from JS files that is also used by the engine itself.

Additionally this fixes the use of comments in .import lines (and other
whitespace characters not producing tokens).

Change-Id: I4dd4a5217308f6fc93b6b148cd8e13392f97d2a6
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-04-24 15:36:42 +02:00
Fawzi Mohamed 007683512f qmlplugindump: correctly merge composite types
When hiding part of the hierarchy during the merging of composite
types properties/methods/signals that are hidden should not be dumped
twice.

Task-number: QTBUG-38354
Change-Id: I328cf25dd5a70e1c0fce017e8ae572e8a9e56245
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
2014-04-18 07:39:38 +02:00
Fawzi Mohamed 1658aa971b qmlplugindump: set isCreatable true in composite types
the qmlengine defines isCreatable as "is creatable through the C++
interface", for the qmltypes and qml code model it makes sense to
define isCreatable as "can appear as component in QML"

Change-Id: Ib26cf25dd5a70e1c03ce017e8ae572e8a9e562c1
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
2014-04-09 22:16:15 +02:00
Jocelyn Turcotte 82e4ee0391 Use global context sharing from QtGui instead of QSGContext
This removes QSGContext::sharedOpenGLContext and replace its uses
with QOpenGLContextPrivate::globalShareContext, which is also going
to be used by QOpenGLWidget and QQuickWidget.

Change-Id: I1e296c3e6832f717caaf31ba7d7b27c06249219b
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
2014-04-04 13:49:51 +02:00
Simon Hausmann 869a199da9 Enable GL context sharing for QtQuick windows by default
This is required for running QWebEngine inside qmlscene. It can be disabled
with --disable-context-sharing and it remains off in QtQuick. Instead apps have
to use QWebEngine API to enable this, where this patch here is merely
convenience.

Change-Id: I123893a7c8c644c49c66fe2b42d2b7b2e03622d9
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
2014-03-29 15:14:07 +01:00