summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-04-29 04:33:52 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-04-29 04:33:52 (GMT)
commite79ce618a079c7f1664959da5d9d13b5f4e1d370 (patch)
treedabf9efe361c27cec4377de04e1a24ae3eca03fb
parentf49f040660fd004ea6289cdc3a92a7ad42338237 (diff)
parent9ba03ca32ae12f8b135f3b4f80c445edc3e6b55e (diff)
downloadQt-e79ce618a079c7f1664959da5d9d13b5f4e1d370.zip
Qt-e79ce618a079c7f1664959da5d9d13b5f4e1d370.tar.gz
Qt-e79ce618a079c7f1664959da5d9d13b5f4e1d370.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
-rw-r--r--demos/declarative/calculator/CalcButton.qml64
-rw-r--r--demos/declarative/calculator/calculator.qml208
-rw-r--r--demos/declarative/mediabrowser/content/PhoneInfoContainer.qml6
-rw-r--r--demos/qtdemo/colors.cpp31
-rw-r--r--demos/qtdemo/colors.h4
-rw-r--r--demos/qtdemo/mainwindow.cpp15
-rw-r--r--demos/qtdemo/xml/examples.xml7
-rw-r--r--dist/README12
-rw-r--r--dist/changes-4.5.2123
-rw-r--r--dist/changes-4.6.041
-rw-r--r--doc/doc.pri2
-rw-r--r--doc/src/declarative/pics/axisrotation.pngbin0 -> 3425 bytes
-rw-r--r--doc/src/examples.qdoc3
-rw-r--r--doc/src/examples/fancybrowser.qdoc51
-rw-r--r--doc/src/examples/googlechat.qdoc51
-rw-r--r--doc/src/examples/googlesuggest.qdoc51
-rw-r--r--doc/src/images/fancybrowser-example.pngbin0 -> 98031 bytes
-rw-r--r--doc/src/images/googlechat-example.pngbin0 -> 52624 bytes
-rw-r--r--doc/src/images/googlesuggest-example.pngbin0 -> 18809 bytes
-rw-r--r--doc/src/known-issues.qdoc9
-rw-r--r--doc/src/licenses.qdoc18
-rw-r--r--doc/src/phonon-api.qdoc4
-rw-r--r--doc/src/qnamespace.qdoc15
-rw-r--r--doc/src/snippets/code/doc_src_qtestlib.qdoc2
-rw-r--r--examples/declarative/animation/animation.qml79
-rw-r--r--examples/declarative/behaviours/MyRect.qml15
-rw-r--r--examples/declarative/behaviours/test.qml140
-rw-r--r--examples/declarative/connections/connections.qml38
-rw-r--r--examples/declarative/contacts/contacts.qml165
-rw-r--r--examples/declarative/dial/DialLibrary/Dial.qml54
-rw-r--r--examples/declarative/dial/dial.qml52
-rw-r--r--examples/declarative/follow/follow.qml113
-rw-r--r--examples/declarative/listview/highlight.qml133
-rw-r--r--examples/declarative/listview/listview.qml184
-rw-r--r--examples/declarative/listview/recipes.qml289
-rw-r--r--examples/declarative/minehunt/Description.qml48
-rw-r--r--examples/declarative/minehunt/Explosion.qml27
-rw-r--r--examples/declarative/minehunt/minehunt.qml6
-rw-r--r--examples/declarative/mouseregion/mouse.qml2
-rw-r--r--examples/declarative/scrollbar/ScrollBar.qml62
-rw-r--r--examples/declarative/scrollbar/display.qml91
-rw-r--r--examples/declarative/slideswitch/Switch.qml104
-rw-r--r--examples/declarative/slideswitch/display.qml11
-rw-r--r--examples/declarative/states/states.qml119
-rw-r--r--examples/declarative/states/transitions.qml179
-rw-r--r--examples/declarative/tutorials/t1/tutorial1.qml17
-rw-r--r--examples/declarative/tutorials/t2/Cell.qml23
-rw-r--r--examples/declarative/tutorials/t2/tutorial2.qml52
-rw-r--r--examples/declarative/tutorials/t3/Cell.qml23
-rw-r--r--examples/declarative/tutorials/t3/tutorial3.qml105
-rw-r--r--examples/graphicsview/elasticnodes/edge.cpp9
-rw-r--r--examples/itemviews/chart/pieview.cpp2
-rw-r--r--examples/network/googlesuggest/googlesuggest.cpp223
-rw-r--r--examples/network/googlesuggest/googlesuggest.h (renamed from src/gui/painting/qwindowsurface_d3d_p.h)60
-rw-r--r--examples/network/googlesuggest/googlesuggest.pro9
-rw-r--r--examples/network/googlesuggest/main.cpp (renamed from doc/src/snippets/webkit/simple/main.cpp)16
-rw-r--r--examples/network/googlesuggest/searchbox.cpp69
-rw-r--r--examples/network/googlesuggest/searchbox.h64
-rw-r--r--examples/network/network.pro1
-rw-r--r--examples/webkit/fancybrowser/fancybrowser.pro11
-rw-r--r--examples/webkit/fancybrowser/jquery.min.js19
-rw-r--r--examples/webkit/fancybrowser/jquery.qrc5
-rw-r--r--examples/webkit/fancybrowser/main.cpp51
-rw-r--r--examples/webkit/fancybrowser/mainwindow.cpp167
-rw-r--r--examples/webkit/fancybrowser/mainwindow.h76
-rw-r--r--examples/webkit/googlechat/form.ui214
-rw-r--r--examples/webkit/googlechat/googlechat.cpp163
-rw-r--r--examples/webkit/googlechat/googlechat.h71
-rw-r--r--examples/webkit/googlechat/googlechat.pro11
-rw-r--r--examples/webkit/googlechat/main.cpp51
-rw-r--r--examples/webkit/webkit.pro4
-rw-r--r--src/3rdparty/webkit/ChangeLog8
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/ChangeLog57
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp1
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/parser/Lexer.h2
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp2
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/parser/Nodes.h2
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp8
-rw-r--r--src/3rdparty/webkit/VERSION2
-rw-r--r--src/3rdparty/webkit/WebCore/ChangeLog108
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/FontQt.cpp33
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp78
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageBufferQt.cpp59
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageQt.cpp5
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp74
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/WheelEventQt.cpp13
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp6
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp17
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp14
-rw-r--r--src/3rdparty/webkit/WebKit/qt/ChangeLog39
-rw-r--r--src/3rdparty/webkit/WebKit/qt/docs/docs.pri15
-rw-r--r--src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc (renamed from doc/src/qtwebkit.qdoc)6
-rw-r--r--src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdocconf195
-rw-r--r--src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/qtwebkit_build_snippet.qdoc (renamed from doc/src/snippets/code/doc_src_qtwebkit.qdoc)0
-rw-r--r--src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/qtwebkit_qwebview_snippet.cpp (renamed from doc/src/snippets/code/src_3rdparty_webkit_WebKit_qt_Api_qwebview.cpp)0
-rw-r--r--src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/simple/main.cpp34
-rw-r--r--src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/simple/simple.pro (renamed from doc/src/snippets/webkit/simple/simple.pro)0
-rw-r--r--src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webpage/main.cpp (renamed from doc/src/snippets/webkit/webpage/main.cpp)19
-rw-r--r--src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webpage/webpage.pro (renamed from doc/src/snippets/webkit/webpage/webpage.pro)0
-rw-r--r--src/corelib/animation/qanimationgroup.cpp2
-rw-r--r--src/corelib/codecs/qtsciicodec.cpp3
-rw-r--r--src/corelib/codecs/qutfcodec.cpp4
-rw-r--r--src/corelib/global/qfeatures.h22
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp15
-rw-r--r--src/corelib/kernel/qcoreevent.cpp1
-rw-r--r--src/corelib/kernel/qeventdispatcher_glib.cpp3
-rw-r--r--src/corelib/kernel/qeventloop.cpp5
-rw-r--r--src/corelib/kernel/qvariant.cpp158
-rw-r--r--src/corelib/kernel/qvariant.h17
-rw-r--r--src/corelib/kernel/qvariant_p.h43
-rw-r--r--src/corelib/thread/qthread_unix.cpp3
-rw-r--r--src/corelib/thread/qthread_win.cpp3
-rw-r--r--src/corelib/tools/qbytearraymatcher.cpp3
-rw-r--r--src/corelib/tools/qbytearraymatcher.h7
-rw-r--r--src/declarative/canvas/qsimplecanvas.cpp195
-rw-r--r--src/declarative/canvas/qsimplecanvas.h2
-rw-r--r--src/declarative/canvas/qsimplecanvas_graphicsview.cpp28
-rw-r--r--src/declarative/canvas/qsimplecanvas_opengl.cpp70
-rw-r--r--src/declarative/canvas/qsimplecanvas_opengl1.cpp50
-rw-r--r--src/declarative/canvas/qsimplecanvas_p.h2
-rw-r--r--src/declarative/canvas/qsimplecanvas_software.cpp36
-rw-r--r--src/declarative/canvas/qsimplecanvasfilter.cpp26
-rw-r--r--src/declarative/canvas/qsimplecanvasitem.cpp394
-rw-r--r--src/declarative/canvas/qsimplecanvasitem_p.h2
-rw-r--r--src/declarative/canvas/qsimplecanvasserver.cpp8
-rw-r--r--src/declarative/extra/qmlsqlquery.cpp2
-rw-r--r--src/declarative/extra/qmlxmllistmodel.cpp2
-rw-r--r--src/declarative/fx/fx.pri2
-rw-r--r--src/declarative/fx/qfxanchors.cpp10
-rw-r--r--src/declarative/fx/qfxanimatedimageitem.cpp20
-rw-r--r--src/declarative/fx/qfxblendedimage.cpp24
-rw-r--r--src/declarative/fx/qfxblurfilter.cpp16
-rw-r--r--src/declarative/fx/qfxcomponentinstance.cpp14
-rw-r--r--src/declarative/fx/qfxcontentwrapper.cpp2
-rw-r--r--src/declarative/fx/qfxevents.cpp121
-rw-r--r--src/declarative/fx/qfxevents_p.h36
-rw-r--r--src/declarative/fx/qfxflickable.cpp92
-rw-r--r--src/declarative/fx/qfxflipable.cpp220
-rw-r--r--src/declarative/fx/qfxflipable.h96
-rw-r--r--src/declarative/fx/qfxfocuspanel.cpp2
-rw-r--r--src/declarative/fx/qfxgridview.cpp13
-rw-r--r--src/declarative/fx/qfxhighlightfilter.cpp20
-rw-r--r--src/declarative/fx/qfximage.cpp91
-rw-r--r--src/declarative/fx/qfximage_p.h2
-rw-r--r--src/declarative/fx/qfximageitem.cpp21
-rw-r--r--src/declarative/fx/qfxitem.cpp144
-rw-r--r--src/declarative/fx/qfxitem_p.h6
-rw-r--r--src/declarative/fx/qfxkeyactions.cpp51
-rw-r--r--src/declarative/fx/qfxkeyproxy.cpp12
-rw-r--r--src/declarative/fx/qfxlayouts.cpp106
-rw-r--r--src/declarative/fx/qfxlistview.cpp18
-rw-r--r--src/declarative/fx/qfxmouseregion.cpp79
-rw-r--r--src/declarative/fx/qfxmouseregion.h2
-rw-r--r--src/declarative/fx/qfxmouseregion_p.h22
-rw-r--r--src/declarative/fx/qfxpainted.cpp2
-rw-r--r--src/declarative/fx/qfxparticles.cpp14
-rw-r--r--src/declarative/fx/qfxpath.cpp42
-rw-r--r--src/declarative/fx/qfxpathview.cpp60
-rw-r--r--src/declarative/fx/qfxpixmap.cpp20
-rw-r--r--src/declarative/fx/qfxrect.cpp52
-rw-r--r--src/declarative/fx/qfxrect_p.h2
-rw-r--r--src/declarative/fx/qfxreflectionfilter.cpp16
-rw-r--r--src/declarative/fx/qfxrepeater.cpp29
-rw-r--r--src/declarative/fx/qfxrepeater.h1
-rw-r--r--src/declarative/fx/qfxscalegrid.cpp16
-rw-r--r--src/declarative/fx/qfxshadowfilter.cpp4
-rw-r--r--src/declarative/fx/qfxtext.cpp34
-rw-r--r--src/declarative/fx/qfxtext_p.h2
-rw-r--r--src/declarative/fx/qfxtextedit.cpp4
-rw-r--r--src/declarative/fx/qfxtransform.cpp522
-rw-r--r--src/declarative/fx/qfxtransform.h174
-rw-r--r--src/declarative/fx/qfxvisualitemmodel.cpp80
-rw-r--r--src/declarative/fx/qfxwebview.cpp12
-rw-r--r--src/declarative/fx/qfxwidgetcontainer.cpp8
-rw-r--r--src/declarative/opengl/glbasicshaders.cpp30
-rw-r--r--src/declarative/opengl/glsave.h2
-rw-r--r--src/declarative/opengl/gltexture.cpp36
-rw-r--r--src/declarative/qml/parser/javascript.g2666
-rw-r--r--src/declarative/qml/parser/javascriptast.cpp912
-rw-r--r--src/declarative/qml/parser/javascriptast_p.h2445
-rw-r--r--src/declarative/qml/parser/javascriptastfwd_p.h164
-rw-r--r--src/declarative/qml/parser/javascriptastvisitor.cpp58
-rw-r--r--src/declarative/qml/parser/javascriptastvisitor_p.h326
-rw-r--r--src/declarative/qml/parser/javascriptengine_p.cpp157
-rw-r--r--src/declarative/qml/parser/javascriptengine_p.h144
-rw-r--r--src/declarative/qml/parser/javascriptgrammar.cpp696
-rw-r--r--src/declarative/qml/parser/javascriptgrammar_p.h197
-rw-r--r--src/declarative/qml/parser/javascriptlexer.cpp1128
-rw-r--r--src/declarative/qml/parser/javascriptlexer_p.h250
-rw-r--r--src/declarative/qml/parser/javascriptmemorypool_p.h130
-rw-r--r--src/declarative/qml/parser/javascriptnodepool_p.h139
-rw-r--r--src/declarative/qml/parser/javascriptparser.cpp1571
-rw-r--r--src/declarative/qml/parser/javascriptparser_p.h215
-rw-r--r--src/declarative/qml/parser/javascriptprettypretty.cpp1334
-rw-r--r--src/declarative/qml/parser/javascriptprettypretty_p.h329
-rw-r--r--src/declarative/qml/parser/javascriptvalue.h6
-rw-r--r--src/declarative/qml/parser/parser.pri21
-rw-r--r--src/declarative/qml/qml.h4
-rw-r--r--src/declarative/qml/qml.pri7
-rw-r--r--src/declarative/qml/qmlbindablevalue.cpp30
-rw-r--r--src/declarative/qml/qmlboundsignal.cpp12
-rw-r--r--src/declarative/qml/qmlcompiledcomponent.cpp24
-rw-r--r--src/declarative/qml/qmlcompiledcomponent_p.h4
-rw-r--r--src/declarative/qml/qmlcompiler.cpp368
-rw-r--r--src/declarative/qml/qmlcompiler_p.h1
-rw-r--r--src/declarative/qml/qmlcomponent.cpp55
-rw-r--r--src/declarative/qml/qmlcomponent_p.h1
-rw-r--r--src/declarative/qml/qmlcompositetypemanager.cpp56
-rw-r--r--src/declarative/qml/qmlcompositetypemanager_p.h5
-rw-r--r--src/declarative/qml/qmlcontext.cpp32
-rw-r--r--src/declarative/qml/qmldom.cpp104
-rw-r--r--src/declarative/qml/qmlengine.cpp150
-rw-r--r--src/declarative/qml/qmlinfo.cpp2
-rw-r--r--src/declarative/qml/qmlinstruction.cpp2
-rw-r--r--src/declarative/qml/qmlmetaproperty.cpp220
-rw-r--r--src/declarative/qml/qmlmetatype.cpp108
-rw-r--r--src/declarative/qml/qmlmetatype.h4
-rw-r--r--src/declarative/qml/qmlparser.cpp28
-rw-r--r--src/declarative/qml/qmlparser_p.h1
-rw-r--r--src/declarative/qml/qmlparserstatus.cpp2
-rw-r--r--src/declarative/qml/qmlprivate.h6
-rw-r--r--src/declarative/qml/qmlproxymetaobject.cpp18
-rw-r--r--src/declarative/qml/qmlrefcount.cpp2
-rw-r--r--src/declarative/qml/qmlscriptparser.cpp632
-rw-r--r--src/declarative/qml/qmlscriptparser_p.h57
-rw-r--r--src/declarative/qml/qmlstringconverters.cpp34
-rw-r--r--src/declarative/qml/qmlvme.cpp128
-rw-r--r--src/declarative/qml/qmlvmemetaobject.cpp22
-rw-r--r--src/declarative/qml/qmlxmlparser.cpp41
-rw-r--r--src/declarative/qml/qmlxmlparser_p.h7
-rw-r--r--src/declarative/qml/script/generator/main.cpp12
-rw-r--r--src/declarative/qml/script/qmlbasicscript.cpp108
-rw-r--r--src/declarative/test/qfxtestengine.cpp90
-rw-r--r--src/declarative/test/qfxtestobjects.cpp32
-rw-r--r--src/declarative/timeline/qmltimeline.cpp126
-rw-r--r--src/declarative/timeline/qmltimelinevalueproxy.h4
-rw-r--r--src/declarative/util/qfxglobal.h4
-rw-r--r--src/declarative/util/qfxview.cpp22
-rw-r--r--src/declarative/util/qmlanimation.cpp278
-rw-r--r--src/declarative/util/qmlanimation_p.h2
-rw-r--r--src/declarative/util/qmlbehaviour.cpp10
-rw-r--r--src/declarative/util/qmlbind.cpp2
-rw-r--r--src/declarative/util/qmlconnection.cpp8
-rw-r--r--src/declarative/util/qmllistaccessor.cpp12
-rw-r--r--src/declarative/util/qmllistmodel.cpp80
-rw-r--r--src/declarative/util/qmlopenmetaobject.cpp22
-rw-r--r--src/declarative/util/qmlpackage.cpp12
-rw-r--r--src/declarative/util/qmlscript.cpp2
-rw-r--r--src/declarative/util/qmlsetproperties.cpp10
-rw-r--r--src/declarative/util/qmlstate.cpp66
-rw-r--r--src/declarative/util/qmlstategroup.cpp70
-rw-r--r--src/declarative/util/qmlstateoperations.cpp16
-rw-r--r--src/declarative/util/qmltransition.cpp6
-rw-r--r--src/declarative/util/qperformancelog.cpp20
-rw-r--r--src/declarative/widgets/graphicslayouts.cpp6
-rw-r--r--src/declarative/widgets/graphicswidgets.cpp6
-rw-r--r--src/gui/dialogs/qfiledialog.cpp263
-rw-r--r--src/gui/dialogs/qfilesystemmodel_p.h18
-rw-r--r--src/gui/dialogs/qfontdialog_mac.mm67
-rw-r--r--src/gui/dialogs/qsidebar.cpp4
-rw-r--r--src/gui/embedded/qscreentransformed_qws.cpp4
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp41
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h1
-rw-r--r--src/gui/graphicsview/qgraphicsview.cpp4
-rw-r--r--src/gui/image/qpixmap.cpp14
-rw-r--r--src/gui/image/qpixmap.h2
-rw-r--r--src/gui/image/qpixmap_raster.cpp9
-rw-r--r--src/gui/image/qpixmap_raster_p.h7
-rw-r--r--src/gui/image/qpixmapcache.cpp5
-rw-r--r--src/gui/itemviews/qsortfilterproxymodel.cpp51
-rw-r--r--src/gui/kernel/kernel.pri2
-rw-r--r--src/gui/kernel/qaction.cpp47
-rw-r--r--src/gui/kernel/qaction_p.h1
-rw-r--r--src/gui/kernel/qapplication.cpp19
-rw-r--r--src/gui/kernel/qapplication_win.cpp3
-rw-r--r--src/gui/kernel/qapplication_x11.cpp24
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm76
-rw-r--r--src/gui/kernel/qshortcut.cpp20
-rw-r--r--src/gui/kernel/qshortcutmap.cpp9
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac.mm12
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac_p.h1
-rw-r--r--src/gui/kernel/qwidget.cpp37
-rw-r--r--src/gui/kernel/qwidget_mac.mm88
-rw-r--r--src/gui/kernel/qwidget_p.h7
-rw-r--r--src/gui/kernel/qwidget_win.cpp47
-rw-r--r--src/gui/mac/images/leopard-unified-toolbar-on.pngbin0 -> 356 bytes
-rw-r--r--src/gui/mac/macresources.qrc (renamed from src/gui/mac/maccursors.qrc)3
-rw-r--r--src/gui/painting/painting.pri10
-rw-r--r--src/gui/painting/qbackingstore.cpp11
-rw-r--r--src/gui/painting/qmemrotate.cpp1
-rw-r--r--src/gui/painting/qmemrotate_p.h1
-rw-r--r--src/gui/painting/qpaintengine.cpp4
-rw-r--r--src/gui/painting/qpaintengine_d3d.cpp4576
-rw-r--r--src/gui/painting/qpaintengine_d3d.fx608
-rw-r--r--src/gui/painting/qpaintengine_d3d.qrc5
-rw-r--r--src/gui/painting/qpaintengine_d3d_p.h120
-rw-r--r--src/gui/painting/qpaintengine_p.h12
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp14
-rw-r--r--src/gui/painting/qpainter.cpp6
-rw-r--r--src/gui/painting/qprintengine_win.cpp2
-rw-r--r--src/gui/painting/qprinter.cpp14
-rw-r--r--src/gui/painting/qwindowsurface_d3d.cpp169
-rw-r--r--src/gui/styles/gtksymbols.cpp4
-rw-r--r--src/gui/styles/qcommonstyle.cpp4
-rw-r--r--src/gui/styles/qgtkstyle.cpp5
-rw-r--r--src/gui/styles/qmacstyle_mac.mm50
-rw-r--r--src/gui/styles/qstylehelper.cpp70
-rw-r--r--src/gui/styles/qstylehelper_p.h4
-rw-r--r--src/gui/styles/qstylesheetstyle.cpp51
-rw-r--r--src/gui/styles/qstylesheetstyle_p.h2
-rw-r--r--src/gui/widgets/qlabel.cpp22
-rw-r--r--src/gui/widgets/qlineedit.cpp2
-rw-r--r--src/gui/widgets/qmainwindowlayout_mac.mm4
-rw-r--r--src/gui/widgets/qtabbar.cpp4
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp8
-rw-r--r--src/network/socket/qlocalserver_unix.cpp6
-rw-r--r--src/network/socket/qlocalsocket_win.cpp2
-rw-r--r--src/opengl/qgl.cpp4
-rw-r--r--src/opengl/qwindowsurface_gl.cpp2
-rw-r--r--src/plugins/gfxdrivers/directfb/directfb.pro4
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp130
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp19
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp130
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h1
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp26
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp83
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.h2
-rw-r--r--src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c68
-rw-r--r--src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h2
-rw-r--r--src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp12
-rw-r--r--src/plugins/imageformats/ico/qicohandler.cpp60
-rw-r--r--src/plugins/qpluginbase.pri2
-rw-r--r--src/svg/qsvgstyle.cpp1
-rw-r--r--src/svg/qsvgwidget.cpp16
-rw-r--r--src/testlib/qtestcase.cpp2
-rw-r--r--tests/auto/qaction/tst_qaction.cpp33
-rw-r--r--tests/auto/qbytearraymatcher/qbytearraymatcher.pro4
-rw-r--r--tests/auto/qbytearraymatcher/tst_qbytearraymatcher.cpp124
-rw-r--r--tests/auto/qgl/tst_qgl.cpp65
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp49
-rw-r--r--tests/auto/qimagereader/baseline/35floppy.icobin0 -> 4286 bytes
-rw-r--r--tests/auto/qimagereader/baseline/kde_favicon.icobin0 -> 1150 bytes
-rw-r--r--tests/auto/qimagereader/baseline/semitransparent.icobin0 -> 9662 bytes
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp30
-rw-r--r--tests/auto/qlocalsocket/test/test.pro14
-rw-r--r--tests/auto/qlocalsocket/tst_qlocalsocket.cpp22
-rw-r--r--tests/auto/qpainter/tst_qpainter.cpp3
-rw-r--r--tests/auto/qpixmapcache/tst_qpixmapcache.cpp10
-rw-r--r--tests/auto/qshortcut/tst_qshortcut.cpp7
-rw-r--r--tests/auto/qsidebar/tst_qsidebar.cpp26
-rw-r--r--tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp10
-rw-r--r--tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp54
-rw-r--r--tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp44
-rw-r--r--tests/auto/qtextcodec/tst_qtextcodec.cpp12
-rw-r--r--tests/auto/qtransform/tst_qtransform.cpp10
-rw-r--r--tests/auto/qvariant/tst_qvariant.cpp50
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp98
-rw-r--r--tests/auto/uiloader/baseline/css_borderimage_allwidgets.ui210
-rw-r--r--tests/auto/uiloader/baseline/images/splitter_horizontal.pngbin0 -> 199 bytes
-rw-r--r--tests/auto/uiloader/baseline/images/splitter_vertical.pngbin0 -> 193 bytes
-rw-r--r--tools/assistant/tools/assistant/centralwidget.cpp459
-rw-r--r--tools/assistant/tools/assistant/centralwidget.h17
-rw-r--r--tools/assistant/tools/assistant/doc/assistant.qdocconf5
-rw-r--r--tools/assistant/tools/assistant/helpviewer.cpp13
-rw-r--r--tools/assistant/tools/assistant/helpviewer.h6
-rw-r--r--tools/assistant/tools/assistant/indexwindow.cpp2
-rw-r--r--tools/assistant/tools/assistant/mainwindow.cpp88
-rw-r--r--tools/assistant/tools/assistant/mainwindow.h4
-rw-r--r--tools/assistant/tools/assistant/searchwidget.cpp73
-rw-r--r--tools/assistant/tools/assistant/searchwidget.h4
-rw-r--r--tools/configure/configureapp.cpp59
-rw-r--r--tools/designer/src/components/propertyeditor/propertyeditor.cpp7
-rw-r--r--tools/qdoc3/cppcodeparser.cpp25
-rw-r--r--tools/qdoc3/cppcodeparser.h9
-rw-r--r--tools/qdoc3/qdoc3.pro7
-rw-r--r--tools/qdoc3/test/assistant.qdocconf4
-rw-r--r--tools/qdoc3/test/carbide-eclipse-integration.qdocconf6
-rw-r--r--tools/qdoc3/test/designer.qdocconf4
-rw-r--r--tools/qdoc3/test/eclipse-integration.qdocconf2
-rw-r--r--tools/qdoc3/test/jambi.qdocconf4
-rw-r--r--tools/qdoc3/test/linguist.qdocconf4
-rw-r--r--tools/qdoc3/test/qmake.qdocconf4
-rw-r--r--tools/qdoc3/test/qt-build-docs.qdocconf7
-rw-r--r--tools/qdoc3/test/qt-html-templates.qdocconf3
-rw-r--r--tools/qdoc3/test/qt-inc.qdocconf7
-rw-r--r--tools/qdoc3/test/qt.qdocconf7
-rw-r--r--tools/qdoc3/test/standalone-eclipse-integration.qdocconf6
-rw-r--r--tools/qmlconv/qmlconv.cpp480
-rw-r--r--tools/qmlconv/qmlconv.pro10
-rw-r--r--tools/qvfb/config.ui1665
-rw-r--r--tools/qvfb/qvfb.cpp5
-rw-r--r--tools/qvfb/qvfbview.cpp66
-rw-r--r--tools/qvfb/qvfbview.h5
-rw-r--r--tools/tools.pro2
-rw-r--r--util/qlalr/doc/qlalr.qdocconf2
-rwxr-xr-xutil/scripts/make_qfeatures_dot_h12
398 files changed, 24508 insertions, 11233 deletions
diff --git a/demos/declarative/calculator/CalcButton.qml b/demos/declarative/calculator/CalcButton.qml
index c925314..f240000 100644
--- a/demos/declarative/calculator/CalcButton.qml
+++ b/demos/declarative/calculator/CalcButton.qml
@@ -1,12 +1,13 @@
-<Item id="Button" width="50" height="30">
+Item {
+ id: Button; width: 50; height: 30
- <properties>
- <Property name="operation" type="string"/>
- <Property name="toggable" value="false"/>
- <Property name="toggled" value="false"/>
- </properties>
+ properties: [
+ Property { name: "operation"; type: "string" },
+ Property { name: "toggable"; value: false },
+ Property { name: "toggled"; value: false }
+ ]
- <Script>
+ Script {
function buttonClicked(operation) {
if (Button.toggable == true) {
if (Button.toggled == true) {
@@ -20,21 +21,42 @@
else
doOp(operation);
}
- </Script>
+ }
- <Image id="Image" src="pics/button.sci" width="{Button.width}" height="{Button.height}"/>
- <Image id="ImagePressed" src="pics/button-pressed.sci" width="{Button.width}" height="{Button.height}" opacity="0"/>
- <Text anchors.centeredIn="{Image}" text="{Button.operation}" color="white" font.bold="true"/>
- <MouseRegion id="MouseRegion" anchors.fill="{Button}" onClicked="buttonClicked(Button.operation)"/>
+ Image {
+ id: Image
+ src: "pics/button.sci"
+ width: Button.width; height: Button.height
+ }
- <states>
- <State name="Pressed" when="{MouseRegion.pressed == true}">
- <SetProperties target="{ImagePressed}" opacity="1"/>
- </State>
- <State name="Toggled" when="{Button.toggled == true}">
- <SetProperties target="{ImagePressed}" opacity="1"/>
- </State>
- </states>
+ Image {
+ id: ImagePressed
+ src: "pics/button-pressed.sci"
+ width: Button.width; height: Button.height
+ opacity: 0
+ }
-</Item>
+ Text {
+ anchors.centeredIn: Image
+ text: Button.operation
+ color: "white"
+ font.bold: true
+ }
+ MouseRegion {
+ id: MouseRegion
+ anchors.fill: Button
+ onClicked: { buttonClicked(Button.operation) }
+ }
+
+ states: [
+ State {
+ name: "Pressed"; when: MouseRegion.pressed == true
+ SetProperties { target: ImagePressed; opacity: 1 }
+ },
+ State {
+ name: "Toggled"; when: Button.toggled == true
+ SetProperties { target: ImagePressed; opacity: 1 }
+ }
+ ]
+}
diff --git a/demos/declarative/calculator/calculator.qml b/demos/declarative/calculator/calculator.qml
index 4ada896..1e7c30a 100644
--- a/demos/declarative/calculator/calculator.qml
+++ b/demos/declarative/calculator/calculator.qml
@@ -1,83 +1,127 @@
-<Rect id="MainWindow" width="320" height="270" color="black">
- <Script src="calculator.js"/>
-
- <VerticalLayout spacing="2" margin="2">
- <Rect id="Container" height="60" z="2" width="316" pen.color="white" color="#343434">
- <Text id="CurNum" font.bold="true" color="white" font.size="16" anchors.right="{Container.right}" anchors.rightMargin="5"
- anchors.verticalCenter="{Container.verticalCenter}"/>
- <Text id="CurrentOperation" color="white" font.bold="true" font.size="16" anchors.left="{Container.left}" anchors.leftMargin="5"
- anchors.verticalCenter="{Container.verticalCenter}"/>
- </Rect>
-
- <Item width="320" height="30">
- <CalcButton id="AdvancedCheckBox" x="55" width="206" operation="Advanced Mode" toggable="true"/>
- </Item>
-
- <Item width="320">
- <Item id="BasicButtons" x="55" width="160" height="160">
- <CalcButton operation="Bksp" id="Bksp" width="67" opacity="0"/>
- <CalcButton operation="C" id="C" width="76"/>
- <CalcButton operation="AC" id="AC" x="78" width="76"/>
-
- <GridLayout id="NumKeypad" y="32" spacing="2" columns="3">
- <CalcButton operation="7"/>
- <CalcButton operation="8"/>
- <CalcButton operation="9"/>
- <CalcButton operation="4"/>
- <CalcButton operation="5"/>
- <CalcButton operation="6"/>
- <CalcButton operation="1"/>
- <CalcButton operation="2"/>
- <CalcButton operation="3"/>
- </GridLayout>
-
- <HorizontalLayout y="128" spacing="2">
- <CalcButton operation="0" width="50"/>
- <CalcButton operation="." x="77" width="50"/>
- <CalcButton operation="=" id="Equals" x="77" width="102"/>
- </HorizontalLayout>
-
- <VerticalLayout id="SimpleOperations" x="156" y="0" spacing="2">
- <CalcButton operation="x"/>
- <CalcButton operation="/"/>
- <CalcButton operation="-"/>
- <CalcButton operation="+"/>
- </VerticalLayout>
- </Item>
-
- <GridLayout id="AdvancedButtons" x="350" spacing="2" columns="2" opacity="0">
- <CalcButton operation="Abs"/>
- <CalcButton operation="Int"/>
- <CalcButton operation="MC"/>
- <CalcButton operation="Sqrt"/>
- <CalcButton operation="MR"/>
- <CalcButton operation="^2"/>
- <CalcButton operation="MS"/>
- <CalcButton operation="1/x"/>
- <CalcButton operation="M+"/>
- <CalcButton operation="+/-"/>
- </GridLayout>
- </Item>
- </VerticalLayout>
-
- <states>
- <State name="Advanced" when="{AdvancedCheckBox.toggled == true}">
- <SetProperties target="{BasicButtons}" x="0"/>
- <SetProperties target="{SimpleOperations}" y="32"/>
- <SetProperties target="{Bksp}" opacity="1"/>
- <SetProperties target="{C}" x="69" width="67"/>
- <SetProperties target="{AC}" x="138" width="67"/>
- <SetProperties target="{Equals}" width="50"/>
- <SetProperties target="{AdvancedButtons}" x="210" opacity="1"/>
- </State>
- </states>
-
- <transitions>
- <Transition>
- <NumericAnimation properties="x,y,width" easing="easeOutBounce" duration="500"/>
- <NumericAnimation properties="opacity" easing="easeInOutQuad" duration="500"/>
- </Transition>
- </transitions>
-
-</Rect>
+Rect {
+ id: MainWindow;
+ width: 320; height: 270; color: "black"
+ Script { src: "calculator.js" }
+
+ VerticalLayout {
+ spacing: 2; margin: 2
+
+ Rect {
+ id: Container
+ width: 316; height: 60; z: 2
+ pen.color: "white"; color: "#343434"
+
+ Text {
+ id: CurNum
+ font.bold: true; font.size: 16
+ color: "white"
+ anchors.right: Container.right
+ anchors.rightMargin: 5
+ anchors.verticalCenter: Container.verticalCenter
+ }
+
+ Text {
+ id: CurrentOperation
+ color: "white"
+ font.bold: true; font.size: 16
+ anchors.left: Container.left
+ anchors.leftMargin: 5
+ anchors.verticalCenter: Container.verticalCenter
+ }
+ }
+
+ Item {
+ width: 320; height: 30
+
+ CalcButton {
+ id: AdvancedCheckBox
+ x: 55; width: 206
+ operation: "Advanced Mode"
+ toggable: true
+ }
+ }
+
+ Item {
+ width: 320
+
+ Item {
+ id: BasicButtons
+ x: 55; width: 160; height: 160
+
+ CalcButton { operation: "Bksp"; id: Bksp; width: 67; opacity: 0 }
+ CalcButton { operation: "C"; id: C; width: 76 }
+ CalcButton { operation: "AC"; id: AC; x: 78; width: 76 }
+
+ GridLayout {
+ id: NumKeypad; y: 32; spacing: 2; columns: 3
+
+ CalcButton { operation: 7 }
+ CalcButton { operation: 8 }
+ CalcButton { operation: 9 }
+ CalcButton { operation: 4 }
+ CalcButton { operation: 5 }
+ CalcButton { operation: 6 }
+ CalcButton { operation: 1 }
+ CalcButton { operation: 2 }
+ CalcButton { operation: 3 }
+ }
+
+ HorizontalLayout {
+ y: 128; spacing: 2
+
+ CalcButton { operation: 0; width: 50 }
+ CalcButton { operation: "."; x: 77; width: 50 }
+ CalcButton { operation: "="; id: Equals; x: 77; width: 102 }
+ }
+
+ VerticalLayout {
+ id: SimpleOperations
+ x: 156; y: 0; spacing: 2
+
+ CalcButton { operation: "x" }
+ CalcButton { operation: "/" }
+ CalcButton { operation: "-" }
+ CalcButton { operation: "+" }
+ }
+ }
+
+ GridLayout {
+ id: AdvancedButtons
+ x: 350; spacing: 2; columns: 2; opacity: 0
+
+ CalcButton { operation: "Abs" }
+ CalcButton { operation: "Int" }
+ CalcButton { operation: "MC" }
+ CalcButton { operation: "Sqrt" }
+ CalcButton { operation: "MR" }
+ CalcButton { operation: "^2" }
+ CalcButton { operation: "MS" }
+ CalcButton { operation: "1/x" }
+ CalcButton { operation: "M+" }
+ CalcButton { operation: "+/-" }
+ }
+
+ }
+ }
+
+ states: [
+ State {
+ name: "Advanced"; when: AdvancedCheckBox.toggled == true
+ SetProperties { target: BasicButtons; x: 0 }
+ SetProperties { target: SimpleOperations; y: 32 }
+ SetProperties { target: Bksp; opacity: 1 }
+ SetProperties { target: C; x: 69; width: 67 }
+ SetProperties { target: AC; x: 138; width: 67 }
+ SetProperties { target: Equals; width: 50 }
+ SetProperties { target: AdvancedButtons; x: 210; opacity: 1 }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ NumericAnimation { properties: "x,y,width"; easing: "easeOutBounce"; duration: 500 }
+ NumericAnimation { properties: "opacity"; easing: "easeInOutQuad"; duration: 500 }
+ }
+ ]
+}
diff --git a/demos/declarative/mediabrowser/content/PhoneInfoContainer.qml b/demos/declarative/mediabrowser/content/PhoneInfoContainer.qml
index dbf25f5..5e387dd 100644
--- a/demos/declarative/mediabrowser/content/PhoneInfoContainer.qml
+++ b/demos/declarative/mediabrowser/content/PhoneInfoContainer.qml
@@ -14,7 +14,7 @@
</signals>
<transform>
- <Axis id="Axis" xStart="{Container.width / 2}" xEnd="{Container.width / 2}" yEnd="1" />
+ <AxisRotation id="Axis" axis.startX="{Container.width / 2}" axis.endX="{Container.width / 2}" axis.endY="1" />
</transform>
<front>
@@ -53,13 +53,13 @@
<states>
<State name="Back">
- <SetProperty target="{Axis}" property="rotation" value="180"/>
+ <SetProperty target="{Axis}" property="angle" value="180"/>
</State>
</states>
<transitions>
<Transition>
- <NumericAnimation easing="easeInOutQuad" properties="rotation" duration="500"/>
+ <NumericAnimation easing="easeInOutQuad" properties="angle" duration="500"/>
</Transition>
</transitions>
diff --git a/demos/qtdemo/colors.cpp b/demos/qtdemo/colors.cpp
index 41bbfb3..733b285 100644
--- a/demos/qtdemo/colors.cpp
+++ b/demos/qtdemo/colors.cpp
@@ -72,10 +72,8 @@ int Colors::contentHeight = 510;
// Properties:
bool Colors::openGlRendering = false;
-bool Colors::direct3dRendering = false;
bool Colors::softwareRendering = false;
-bool Colors::openGlAwailable = true;
-bool Colors::direct3dAwailable = true;
+bool Colors::openGlAvailable = true;
bool Colors::xRenderPresent = true;
bool Colors::noTicker = false;
@@ -206,8 +204,6 @@ void Colors::parseArgs(int argc, char *argv[])
QString s(argv[i]);
if (s == "-opengl")
Colors::openGlRendering = true;
- else if (s == "-direct3d")
- Colors::direct3dRendering = true;
else if (s == "-software")
Colors::softwareRendering = true;
else if (s == "-no-opengl") // support old style
@@ -270,7 +266,7 @@ void Colors::parseArgs(int argc, char *argv[])
Colors::fps = int(parseFloat(s, "-fps"));
else if (s.startsWith("-h") || s.startsWith("-help")){
QMessageBox::warning(0, "Arguments",
- QString("Usage: qtdemo [-verbose] [-no-adapt] [-opengl] [-direct3d] [-software] [-fullscreen] [-ticker[0|1]] ")
+ QString("Usage: qtdemo [-verbose] [-no-adapt] [-opengl] [-software] [-fullscreen] [-ticker[0|1]] ")
+ "[-animations[0|1]] [-no-blending] [-no-sync] [-use-timer-update[0|1]] [-pause[0|1]] "
+ "[-use-window-mask] [-no-rescale] "
+ "[-use-pixmaps] [-show-fps] [-show-br] [-8bit[0|1]] [-menu<int>] [-use-loop] [-use-balls] "
@@ -290,7 +286,6 @@ void Colors::parseArgs(int argc, char *argv[])
void Colors::setLowSettings()
{
Colors::openGlRendering = false;
- Colors::direct3dRendering = false;
Colors::softwareRendering = true;
Colors::noTicker = true;
Colors::noTimerUpdate = true;
@@ -325,15 +320,11 @@ void Colors::detectSystemResources()
qDebug() << "- OpenGL not supported by current build of Qt";
#endif
{
- Colors::openGlAwailable = false;
+ Colors::openGlAvailable = false;
if (Colors::verbose)
qDebug("- OpenGL not recommended on this system");
}
-#if defined(Q_WS_WIN)
- Colors::direct3dAwailable = false; // for now.
-#endif
-
#if defined(Q_WS_X11)
// check if X render is present:
QPixmap tmp(1, 1);
@@ -369,21 +360,9 @@ void Colors::postConfigure()
}
}
-#if !defined(Q_WS_WIN)
- if (Colors::direct3dRendering){
- Colors::direct3dRendering = false;
- qDebug() << "- WARNING: Direct3D specified, but not supported on this platform";
- }
-#endif
-
- if (!Colors::openGlRendering && !Colors::direct3dRendering && !Colors::softwareRendering){
+ if (!Colors::openGlRendering && !Colors::softwareRendering){
// The user has not decided rendering system. So we do it instead:
-#if defined(Q_WS_WIN)
- if (Colors::direct3dAwailable)
- Colors::direct3dRendering = true;
- else
-#endif
- if (Colors::openGlAwailable)
+ if (Colors::openGlAvailable)
Colors::openGlRendering = true;
else
Colors::softwareRendering = true;
diff --git a/demos/qtdemo/colors.h b/demos/qtdemo/colors.h
index 58865c6..31eb93b 100644
--- a/demos/qtdemo/colors.h
+++ b/demos/qtdemo/colors.h
@@ -81,11 +81,9 @@ public:
static int contentHeight;
// properties:
+ static bool openGlAvailable;
static bool openGlRendering;
- static bool direct3dRendering;
static bool softwareRendering;
- static bool openGlAwailable;
- static bool direct3dAwailable;
static bool xRenderPresent;
static bool noAdapt;
static bool noTicker;
diff --git a/demos/qtdemo/mainwindow.cpp b/demos/qtdemo/mainwindow.cpp
index 8723823..0da69b2 100644
--- a/demos/qtdemo/mainwindow.cpp
+++ b/demos/qtdemo/mainwindow.cpp
@@ -100,14 +100,8 @@ void MainWindow::setRenderingSystem()
{
QWidget *viewport = 0;
- if (Colors::direct3dRendering){
- viewport->setAttribute(Qt::WA_MSWindowsUseDirect3D);
- setCacheMode(QGraphicsView::CacheNone);
- if (Colors::verbose)
- qDebug() << "- using Direct3D";
- }
#ifndef QT_NO_OPENGL
- else if (Colors::openGlRendering){
+ if (Colors::openGlRendering) {
QGLWidget *glw = new QGLWidget(QGLFormat(QGL::SampleBuffers));
if (Colors::noScreenSync)
glw->format().setSwapInterval(0);
@@ -116,9 +110,10 @@ void MainWindow::setRenderingSystem()
setCacheMode(QGraphicsView::CacheNone);
if (Colors::verbose)
qDebug() << "- using OpenGL";
- }
+ } else // software rendering
#endif
- else{ // software rendering
+ {
+ // software rendering
viewport = new QWidget;
setCacheMode(QGraphicsView::CacheBackground);
if (Colors::verbose)
@@ -389,8 +384,6 @@ void MainWindow::keyPressEvent(QKeyEvent *event)
s += "Rendering system: ";
if (Colors::openGlRendering)
s += "OpenGL";
- else if (Colors::direct3dRendering)
- s += "Direct3D";
else
s += "software";
diff --git a/demos/qtdemo/xml/examples.xml b/demos/qtdemo/xml/examples.xml
index 03b59f3..96a3e80 100644
--- a/demos/qtdemo/xml/examples.xml
+++ b/demos/qtdemo/xml/examples.xml
@@ -118,6 +118,7 @@
<example filename="threadedfortuneserver" name="Threaded Fort. Server" />
<example filename="torrent" name="Torrent Client" />
<example filename="securesocketclient" name="Secure Socket Client" />
+ <example filename="googlesuggest" name="Google Suggest" />
</category>
<category dirname="opengl" name="OpenGL">
<example filename="2dpainting" name="2D Painting" />
@@ -213,6 +214,12 @@
<example filename="wiggly" name="Wiggly" />
<example filename="windowflags" name="Window Flags" />
</category>
+ <category dirname="webkit" name="WebKit">
+ <example filename="formextractor" name="Form Extractor" />
+ <example filename="previewer" name="HTML Previewer" />
+ <example filename="fancybrowser" name="Fancy Browser" />
+ <example filename="googlechat" name="Google Chat" />
+ </category>
<category dirname="xml" name="XML">
<example filename="saxbookmarks" name="SAX Bookmarks" />
<example filename="dombookmarks" name="DOM Bookmarks" />
diff --git a/dist/README b/dist/README
index 38b3a1c..c9e7677 100644
--- a/dist/README
+++ b/dist/README
@@ -2,11 +2,11 @@ This is Qt version %VERSION%.
Qt is a comprehensive cross-platform C++ application framework. Qt 4
introduces new features and many improvements over the 3.x series. See
-http://doc.trolltech.com/latest/qt4-intro.html for details.
+http://doc.qtsoftware.com/latest/qt4-intro.html for details.
The Qt 4.x series is not binary compatible or source compatible with
the 3.x series. For more information on porting from Qt 3 to Qt 4, see
-http://doc.trolltech.com/latest/porting4.html.
+http://doc.qtsoftware.com/latest/porting4.html .
INSTALLING Qt
@@ -37,7 +37,7 @@ The Qt reference documentation is available locally in Qt's doc/html
directory. You can use Qt Assistant to view it; to launch Assistant,
type 'assistant' on the command line or use the Start menu. On Mac OS
X, you can find it in /Developer/Applications/Qt. The latest
-documentation is available at http://doc.trolltech.com/.
+documentation is available at http://doc.qtsoftware.com/ .
SUPPORTED PLATFORMS
@@ -90,10 +90,10 @@ For this release, the following platforms have been tested:
wincewm60standard-msvc2008
For a complete list of supported platforms, see
-http://www.qtsoftware.com/developer/supported-platforms/supported-platforms/
+http://doc.qtsoftware.com/latest/supported-platforms.html
For a description of Qt's platform support policy, see
-http://www.qtsoftware.com/support-services/support/platform-support-policy
+http://qtsoftware.com/support-services/support/platform-support-policy
COMMERCIAL EDITIONS
@@ -106,7 +106,7 @@ the QtCore, QtGui (except QGraphicsView), QtTest, QtDBus and
Qt3Support modules.
For a full listing of the contents of each module, please refer to
-http://doc.trolltech.com/4.4/modules.html.
+http://doc.qtsoftware.com/latest/modules.html
HOW TO REPORT A BUG
diff --git a/dist/changes-4.5.2 b/dist/changes-4.5.2
new file mode 100644
index 0000000..a772bf7
--- /dev/null
+++ b/dist/changes-4.5.2
@@ -0,0 +1,123 @@
+Qt 4.5.2 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 4.5.0. For more details,
+refer to the online documentation included in this distribution. The
+documentation is also available online:
+
+ http://doc.trolltech.com/4.5
+
+The Qt version 4.5 series is binary compatible with the 4.4.x series.
+Applications compiled for 4.4 will continue to run with 4.5.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Task Tracker:
+
+ http://www.qtsoftware.com/developer/task-tracker
+
+Each of these identifiers can be entered in the task tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* General *
+****************************************************************************
+
+General Improvements
+--------------------
+
+- Documentation and Examples
+
+Third party components
+----------------------
+
+
+****************************************************************************
+* Library *
+****************************************************************************
+
+
+****************************************************************************
+* Database Drivers *
+****************************************************************************
+
+
+****************************************************************************
+* Platform Specific Changes *
+****************************************************************************
+
+Qt for Linux/X11
+----------------
+
+
+Qt for Windows
+--------------
+
+
+Qt for Mac OS X
+---------------
+
+
+Qt for Embedded Linux
+---------------------
+
+
+Qt for Windows CE
+-----------------
+
+
+****************************************************************************
+* Compiler Specific Changes *
+****************************************************************************
+
+
+****************************************************************************
+* Tools *
+****************************************************************************
+
+- Build System
+
+- Assistant
+
+
+- Designer
+
+
+- Linguist
+ - Linguist GUI
+
+ - lupdate
+
+ - lrelease
+
+
+- rcc
+
+
+- moc
+
+
+- uic
+
+
+- uic3
+
+
+- qmake
+
+
+- configure
+
+
+- qtconfig
+
+
+- qt3to4
+
+
+****************************************************************************
+* Plugins *
+****************************************************************************
+
+
+****************************************************************************
+* Important Behavior Changes *
+****************************************************************************
+
diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0
new file mode 100644
index 0000000..db4ab5f
--- /dev/null
+++ b/dist/changes-4.6.0
@@ -0,0 +1,41 @@
+Qt 4.6 introduces many new features and improvements as well as bugfixes
+over the 4.5.x series. For more details, refer to the online documentation
+included in this distribution. The documentation is also available online:
+
+ http://doc.trolltech.com/4.6
+
+The Qt version 4.6 series is binary compatible with the 4.5.x series.
+Applications compiled for 4.5 will continue to run with 4.6.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Task Tracker:
+
+ http://www.qtsoftware.com/developer/task-tracker
+
+Each of these identifiers can be entered in the task tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* General *
+****************************************************************************
+
+
+
+****************************************************************************
+* Library *
+****************************************************************************
+
+
+****************************************************************************
+* Platform Specific Changes *
+****************************************************************************
+
+
+
+****************************************************************************
+* Important Behavior Changes *
+****************************************************************************
+
+ - The experimental Direct3D paint engine has been removed. The
+ reasons for this is that Qt Software focuses on OpenGL for desktop
+ hardware accelerated rendering. \ No newline at end of file
diff --git a/doc/doc.pri b/doc/doc.pri
index 46df3cb..a4c77fe 100644
--- a/doc/doc.pri
+++ b/doc/doc.pri
@@ -4,7 +4,7 @@
win32 {
QT_WINCONFIG = release/
- CONFIG(debug, debug|release) {
+ !CONFIG(release, debug|release) {
QT_WINCONFIG = debug/
}
}
diff --git a/doc/src/declarative/pics/axisrotation.png b/doc/src/declarative/pics/axisrotation.png
new file mode 100644
index 0000000..409a9e9
--- /dev/null
+++ b/doc/src/declarative/pics/axisrotation.png
Binary files differ
diff --git a/doc/src/examples.qdoc b/doc/src/examples.qdoc
index b750aa0..06d7727 100644
--- a/doc/src/examples.qdoc
+++ b/doc/src/examples.qdoc
@@ -209,6 +209,7 @@
\o \l{network/loopback}{Loopback}
\o \l{network/threadedfortuneserver}{Threaded Fortune Server}\raisedaster
\o \l{network/torrent}{Torrent}
+ \o \l{network/googlesuggest}{Google Suggest}
\endlist
\section1 OpenGL
@@ -354,6 +355,8 @@
\list
\o \l{webkit/previewer}{Previewer}\raisedaster
\o \l{webkit/formextractor}{Form Extractor}
+ \o \l{webkit/googlechat}{Google Chat}
+ \o \l{webkit/fancybrowser}{Fancy Browser}
\endlist
\section1 Widgets
diff --git a/doc/src/examples/fancybrowser.qdoc b/doc/src/examples/fancybrowser.qdoc
new file mode 100644
index 0000000..9001c20
--- /dev/null
+++ b/doc/src/examples/fancybrowser.qdoc
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example webkit/fancybrowser
+ \title Fancy Browser Example
+
+ The Fancy Browser example shows how to use jQuery with QtWebKit to
+ make a web browser with some special effects and content manipulation.
+
+ \image fancybrowser-example.png
+
+*/
diff --git a/doc/src/examples/googlechat.qdoc b/doc/src/examples/googlechat.qdoc
new file mode 100644
index 0000000..f2d61cf
--- /dev/null
+++ b/doc/src/examples/googlechat.qdoc
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example webkit/googlechat
+ \title Google Chat Example
+
+ The Google Chat example shows how to use implement a simple Google Chat
+ client with QtWebKit.
+
+ \image googlechat-example.png
+
+*/
diff --git a/doc/src/examples/googlesuggest.qdoc b/doc/src/examples/googlesuggest.qdoc
new file mode 100644
index 0000000..a9b09f9
--- /dev/null
+++ b/doc/src/examples/googlesuggest.qdoc
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example network/googlesuggest
+ \title Google Suggest Example
+
+ The Google Suggest example shows how to use the network access manager
+ to get the list of suggested search terms from Google.
+
+ \image googlesuggest-example.png
+
+*/
diff --git a/doc/src/images/fancybrowser-example.png b/doc/src/images/fancybrowser-example.png
new file mode 100644
index 0000000..717ac9d
--- /dev/null
+++ b/doc/src/images/fancybrowser-example.png
Binary files differ
diff --git a/doc/src/images/googlechat-example.png b/doc/src/images/googlechat-example.png
new file mode 100644
index 0000000..0338445
--- /dev/null
+++ b/doc/src/images/googlechat-example.png
Binary files differ
diff --git a/doc/src/images/googlesuggest-example.png b/doc/src/images/googlesuggest-example.png
new file mode 100644
index 0000000..4ef072a
--- /dev/null
+++ b/doc/src/images/googlesuggest-example.png
Binary files differ
diff --git a/doc/src/known-issues.qdoc b/doc/src/known-issues.qdoc
index 60fd63d..91e122f 100644
--- a/doc/src/known-issues.qdoc
+++ b/doc/src/known-issues.qdoc
@@ -60,11 +60,10 @@
\section2 Intel Compiler Support
- Although it is possible to build applications against Qt 4.5.0 using Intel
- CC 10, these applications will crash when run. A fix for this issue is
- scheduled for Qt 4.5.1. We recommend that developers who rely on this
- compiler wait until the fix is applied before upgrading to the Qt 4.5.x
- series of releases.
+ Although it is possible to build applications against Qt 4.5.x using Intel
+ CC 10, these applications will crash when run. We recommend that developers
+ who rely on this compiler wait until a fix is available before upgrading to
+ the Qt 4.5.x series of releases.
\section2 X11 Hardware Support
diff --git a/doc/src/licenses.qdoc b/doc/src/licenses.qdoc
index b42b882..1c3f6d2 100644
--- a/doc/src/licenses.qdoc
+++ b/doc/src/licenses.qdoc
@@ -239,6 +239,24 @@
\o Parts of the internal QImageSmoothScaler::scale() function use code
based on pnmscale.c by Jef Poskanzer.
\endlist
+
+ \hr
+
+ jQuery JavaScript Library v1.3.2
+ http://jquery.com/
+
+ Copyright (c) 2009 John Resig
+ Dual licensed under the MIT and GPL licenses.
+ http://docs.jquery.com/License
+
+ Sizzle CSS Selector Engine - v0.9.3
+ Copyright 2009, The Dojo Foundation
+ Released under the MIT, BSD, and GPL Licenses.
+ More information: http://sizzlejs.com/
+
+ \list
+ \o examples/webkit/fancybrowser/jquery.min.js
+ \endlist
*/
/*!
diff --git a/doc/src/phonon-api.qdoc b/doc/src/phonon-api.qdoc
index 3d04c68..501b5a5 100644
--- a/doc/src/phonon-api.qdoc
+++ b/doc/src/phonon-api.qdoc
@@ -4457,12 +4457,12 @@
*/
/*!
- \fn QList<int> Phonon::GlobalConfig::audioOutputDeviceListFor(Phonon::Category category, HideAdvancedDevicesOverride override = FromSettings) const
+ \fn QList<int> Phonon::GlobalConfig::audioOutputDeviceListFor(Phonon::Category category, int override = AdvancedDevicesFromSettings) const
\internal
*/
/*!
- \fn int Phonon::GlobalConfig::audioOutputDeviceFor(Phonon::Category category) const
+ \fn int Phonon::GlobalConfig::audioOutputDeviceFor(Phonon::Category category, int override = AdvancedDevicesFromSettings) const
\internal
*/
diff --git a/doc/src/qnamespace.qdoc b/doc/src/qnamespace.qdoc
index d9f001e..097333b 100644
--- a/doc/src/qnamespace.qdoc
+++ b/doc/src/qnamespace.qdoc
@@ -129,13 +129,8 @@
Therefore, if it is important to minimize resource
consumption, do not set this attribute.
- \value AA_MSWindowsUseDirect3DByDefault Is a Windows specific
- attribute, that will make the Direct3D paint engine the
- default Qt widget paint engine. Note that you can toggle
- usage of the Direct3D engine on individual QWidgets by
- setting/clearing the \c WA_MSWindowsUseDirect3D attribute
- on a specific widget. \bold {This functionality is
- experimental}.
+ \value AA_MSWindowsUseDirect3DByDefault This value is obsolete and
+ has no effect.
\value AA_DontShowIconsInMenus Actions with the Icon property won't be
shown in any menus unless specifically set by the
@@ -948,10 +943,8 @@
position. This is set/cleared by QWidget::move() and
by QWidget::setGeometry().
- \value WA_MSWindowsUseDirect3D Makes drawing to a widget
- with this attribute set use the Direct3D paint engine, if the
- Direct3D paint engine is available. \bold {This functionality
- is experimental.}
+ \value WA_MSWindowsUseDirect3D This value is obsolete and has no
+ effect.
\value WA_NoBackground This value is obsolete. Use
WA_OpaquePaintEvent instead.
diff --git a/doc/src/snippets/code/doc_src_qtestlib.qdoc b/doc/src/snippets/code/doc_src_qtestlib.qdoc
index ff52b2f..a0e4944 100644
--- a/doc/src/snippets/code/doc_src_qtestlib.qdoc
+++ b/doc/src/snippets/code/doc_src_qtestlib.qdoc
@@ -61,7 +61,7 @@ void TestQString::toUpper()
//! [9]
-/myTestDirectory$ qmake -project "QT += testlib"
+/myTestDirectory$ qmake -project "CONFIG += qtestlib"
/myTestDirectory$ qmake
/myTestDirectory$ make
//! [9]
diff --git a/examples/declarative/animation/animation.qml b/examples/declarative/animation/animation.qml
index 1d60ac0..5cb471e 100644
--- a/examples/declarative/animation/animation.qml
+++ b/examples/declarative/animation/animation.qml
@@ -1,28 +1,51 @@
-<Rect width="400" height="200" color="white">
- <Rect width="40" height="40" y="80" color="#FF0000" radius="10">
-
- <x>
- <!--
- Animate the x property. Setting repeat to true makes the
- animation repeat indefinitely, otherwise it would only run once.
- -->
- <SequentialAnimation running="true" repeat="true">
- <!-- Move from 0 to 360 in 500ms, using the easeInOutQuad easing function -->
- <NumericAnimation from="0" to="360" easing="easeInOutQuad" duration="500"/>
- <!-- Then pause for 200ms -->
- <PauseAnimation duration="200"/>
- <!-- Then move back to 0 in 2 seconds, using the easeInOutElastic easing function -->
- <NumericAnimation from="360" to="0" easing="easeInOutElastic" duration="2000"/>
- </SequentialAnimation>
- </x>
-
- <color>
- <!-- Alternate color between red and green -->
- <SequentialAnimation running="true" repeat="true">
- <ColorAnimation from="#FF0000" to="#00FF00" duration="5000"/>
- <ColorAnimation from="#00FF00" to="#FF0000" duration="5000"/>
- </SequentialAnimation>
- </color>
-
- </Rect>
-</Rect>
+Rect {
+ width: 400
+ height: 200
+ color: "white"
+ Rect {
+ width: 40
+ height: 40
+ y: 80
+ color: "#FF0000"
+ radius: 10
+ // Animate the x property. Setting repeat to true makes the
+ // animation repeat indefinitely, otherwise it would only run once.
+ x: SequentialAnimation {
+ running: true
+ repeat: true
+ // Move from 0 to 360 in 500ms, using the easeInOutQuad easing function
+ NumericAnimation {
+ from: 0
+ to: 360
+ easing: "easeInOutQuad"
+ duration: 500
+ }
+ // Then pause for 200ms
+ PauseAnimation {
+ duration: 200
+ }
+ // Then move back to 0 in 2 seconds, using the easeInOutElastic easing function
+ NumericAnimation {
+ from: 360
+ to: 0
+ easing: "easeInOutElastic"
+ duration: 2000
+ }
+ }
+ // Alternate color between red and green
+ color: SequentialAnimation {
+ running: true
+ repeat: true
+ ColorAnimation {
+ from: "#FF0000"
+ to: "#00FF00"
+ duration: 5000
+ }
+ ColorAnimation {
+ from: "#00FF00"
+ to: "#FF0000"
+ duration: 5000
+ }
+ }
+ }
+}
diff --git a/examples/declarative/behaviours/MyRect.qml b/examples/declarative/behaviours/MyRect.qml
index e40bd1b..dc9a094 100644
--- a/examples/declarative/behaviours/MyRect.qml
+++ b/examples/declarative/behaviours/MyRect.qml
@@ -1,4 +1,11 @@
-<Rect radius="15" pen.color="black" width="100" height="100" id="Page">
- <MouseRegion anchors.fill="{parent}" onClicked="bluerect.parent = Page; bluerect.x=0" />
-</Rect>
-
+Rect {
+ radius: 15
+ pen.color: "black"
+ width: 100
+ height: 100
+ id: Page
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: { bluerect.parent = Page; bluerect.x=0 }
+ }
+}
diff --git a/examples/declarative/behaviours/test.qml b/examples/declarative/behaviours/test.qml
index a544028..bb7109e 100644
--- a/examples/declarative/behaviours/test.qml
+++ b/examples/declarative/behaviours/test.qml
@@ -1,37 +1,103 @@
-<Rect color="lightsteelblue" width="800" height="600" id="Page">
- <MouseRegion anchors.fill="{parent}" onClicked="bluerect.parent = Page; bluerect.x = mouseX;" />
-
- <MyRect color="green" x="200" y="200" />
- <MyRect color="red" x="400" y="200" />
- <MyRect color="yellow" x="400" y="400" />
- <MyRect color="orange" x="400" y="500" />
- <MyRect color="pink" x="400" y="0" />
- <MyRect color="lightsteelblue" x="100" y="500" />
- <MyRect color="black" x="0" y="200" />
- <MyRect color="white" x="400" y="0" />
-
- <Rect color="blue" x="0" y="0" width="100" height="100" id="bluerect">
- <x>
- <Behaviour>
- <SequentialAnimation>
- <NumericAnimation target="{bluerect}" properties="y" from="0" to="10" easing="easeOutBounce(amplitude:30)" duration="250" />
- <NumericAnimation target="{bluerect}" properties="y" from="10" to="0" easing="easeOutBounce(amplitude:30)" duration="250" />
- </SequentialAnimation>
- <NumericAnimation target="{bluerect}" property="x" duration="500" />
- </Behaviour>
- </x>
-
- <parent>
- <Behaviour>
- <SequentialAnimation>
- <NumericAnimation target="{bluerect}" properties="opacity" to="0" duration="150" />
- <SetPropertyAction target="{bluerect}" property="parent" />
- <NumericAnimation target="{bluerect}" properties="opacity" to="1" duration="150"/>
- </SequentialAnimation>
- </Behaviour>
- </parent>
-
- </Rect>
-
-
-</Rect>
+Rect {
+ color: "lightsteelblue"
+ width: 800
+ height: 600
+ id: Page
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: { bluerect.parent = Page; bluerect.x = mouseX; }
+ }
+ MyRect {
+ color: "green"
+ x: 200
+ y: 200
+ }
+ MyRect {
+ color: "red"
+ x: 400
+ y: 200
+ }
+ MyRect {
+ color: "yellow"
+ x: 400
+ y: 400
+ }
+ MyRect {
+ color: "orange"
+ x: 400
+ y: 500
+ }
+ MyRect {
+ color: "pink"
+ x: 400
+ y: 0
+ }
+ MyRect {
+ color: "lightsteelblue"
+ x: 100
+ y: 500
+ }
+ MyRect {
+ color: "black"
+ x: 0
+ y: 200
+ }
+ MyRect {
+ color: "white"
+ x: 400
+ y: 0
+ }
+ Rect {
+ color: "blue"
+ x: 0
+ y: 0
+ width: 100
+ height: 100
+ id: bluerect
+ x: Behaviour {
+ SequentialAnimation {
+ NumericAnimation {
+ target: bluerect
+ properties: "y"
+ from: 0
+ to: 10
+ easing: "easeOutBounce(amplitude:30)"
+ duration: 250
+ }
+ NumericAnimation {
+ target: bluerect
+ properties: "y"
+ from: 10
+ to: 0
+ easing: "easeOutBounce(amplitude:30)"
+ duration: 250
+ }
+ }
+ NumericAnimation {
+ target: bluerect
+ property: "x"
+ duration: 500
+ }
+ }
+ parent: Behaviour {
+ SequentialAnimation {
+ NumericAnimation {
+ target: bluerect
+ properties: "opacity"
+ to: 0
+ duration: 150
+ }
+ SetPropertyAction {
+ target: bluerect
+ property: "parent"
+ }
+ NumericAnimation {
+ target: bluerect
+ properties: "opacity"
+ to: 1
+ duration: 150
+ }
+ }
+ }
+ }
+}
diff --git a/examples/declarative/connections/connections.qml b/examples/declarative/connections/connections.qml
index 45c0e99..e66875a 100644
--- a/examples/declarative/connections/connections.qml
+++ b/examples/declarative/connections/connections.qml
@@ -1,9 +1,29 @@
-<Rect id="rect" color="blue" width="40" height="30">
- <Rect id="dot" color="red" width="3" height="3" x="{rect.width/2}" y="{rect.height/2}"/>
- <MouseRegion id="mr" anchors.fill="{rect}"/>
- <Connection sender="{mr}" signal="clicked(mouse)">
- color="green";
- dot.x = mouse.x-1;
- dot.y = mouse.y-1;
- </Connection>
-</Rect>
+Rect {
+ id: rect
+ color: "blue"
+ width: 40
+ height: 30
+ Rect {
+ id: dot
+ color: "red"
+ width: 3
+ height: 3
+ x: rect.width/2
+ y: rect.height/2
+ }
+ MouseRegion {
+ id: mr
+ anchors.fill: rect
+ }
+ Connection {
+ sender: mr
+ signal: "clicked(mouse)"
+ script: {
+
+ color="green";
+ dot.x = mouse.x-1;
+ dot.y = mouse.y-1;
+
+ }
+ }
+}
diff --git a/examples/declarative/contacts/contacts.qml b/examples/declarative/contacts/contacts.qml
index d4647f9..fa50010 100644
--- a/examples/declarative/contacts/contacts.qml
+++ b/examples/declarative/contacts/contacts.qml
@@ -1,44 +1,121 @@
-<Rect id="page" width="320" height="480" color="white">
- <resources>
- <Component id="contactDelegate">
- <Rect id="wrapper" x="20" width="{List.width-40}" color="#FEFFEE" pen.color="#FFBE4F" radius="5">
- <filter><Shadow xOffset="5" yOffset="5" /></filter>
- <MouseRegion id="pageMouse" anchors.fill="{parent}" onClicked="if (wrapper.state == 'Details') { wrapper.state = '';} else {wrapper.state = 'Details';}"/>
- <Image id="portraitPic" src="{portrait}" x="10" y="10" />
- <Text id="name" text="{firstName + ' ' + lastName}" anchors.left="{portraitPic.right}" anchors.leftMargin="10"
- anchors.top="{portraitPic.top}" anchors.right="{wrapper.right}" anchors.rightMargin="10"
- font.family="Comic Sans MS" font.bold="true" font.size="11"/>
- <VerticalLayout id="email_layout" anchors.left="{name.left}" anchors.top="{name.bottom}" anchors.topMargin="10">
- <Repeater id="email_list" dataSource="{emails}" >
- <Component>
- <Text text="{modelData}" height="18" font.italic="true" color="midnightblue" />
- </Component>
- </Repeater>
- </VerticalLayout>
- <height>{Math.max(email_layout.height + name.height + 25, portraitPic.height+20)}</height>
-
- <states>
- <State name="Details">
- <SetProperty target="{wrapper}" property="color" value="white" />
- <SetProperty target="{wrapper}" property="x" value="0" />
- <SetProperty target="{wrapper}" property="height" value="{List.height}" />
- <SetProperty target="{wrapper}" property="width" value="{List.width}" />
- <SetProperty target="{wrapper.ListView.view}" property="yPosition" value="{wrapper.y}"/>
- <SetProperty target="{wrapper.ListView.view}" property="locked" value="1"/>
- </State>
- </states>
-
- <transitions>
- <Transition>
- <ParallelAnimation>
- <ColorAnimation duration="500" />
- <NumericAnimation duration="150" properties="x,yPosition,height,width"/>
- </ParallelAnimation>
- </Transition>
- </transitions>
- </Rect>
- </Component>
- </resources>
-
- <ListView id="List" model="{contactModel}" width="320" height="480" clip="true" delegate="{contactDelegate}"/>
-</Rect>
+Rect {
+ id: page
+ width: 320
+ height: 480
+ color: "white"
+ resources: [
+ Component {
+ id: contactDelegate
+ Rect {
+ id: wrapper
+ x: 20
+ width: List.width-40
+ color: "#FEFFEE"
+ pen.color: "#FFBE4F"
+ radius: 5
+ filter: Shadow {
+ xOffset: 5
+ yOffset: 5
+ }
+ MouseRegion {
+ id: pageMouse
+ anchors.fill: parent
+ onClicked: { if (wrapper.state == 'Details') { wrapper.state = '';} else {wrapper.state = 'Details';} }
+ }
+ Image {
+ id: portraitPic
+ src: portrait
+ x: 10
+ y: 10
+ }
+ Text {
+ id: name
+ text: firstName + ' ' + lastName
+ anchors.left: portraitPic.right
+ anchors.leftMargin: 10
+ anchors.top: portraitPic.top
+ anchors.right: wrapper.right
+ anchors.rightMargin: 10
+ font.family: "Comic Sans MS"
+ font.bold: true
+ font.size: 11
+ }
+ VerticalLayout {
+ id: email_layout
+ anchors.left: name.left
+ anchors.top: name.bottom
+ anchors.topMargin: 10
+ Repeater {
+ id: email_list
+ dataSource: emails
+ Component {
+ Text {
+ text: modelData
+ height: 18
+ font.italic: true
+ color: "midnightblue"
+ }
+ }
+ }
+ }
+ height: Math.max(email_layout.height + name.height + 25, portraitPic.height+20)
+ states: [
+ State {
+ name: "Details"
+ SetProperty {
+ target: wrapper
+ property: "color"
+ value: "white"
+ }
+ SetProperty {
+ target: wrapper
+ property: "x"
+ value: 0
+ }
+ SetProperty {
+ target: wrapper
+ property: "height"
+ value: List.height
+ }
+ SetProperty {
+ target: wrapper
+ property: "width"
+ value: List.width
+ }
+ SetProperty {
+ target: wrapper.ListView.view
+ property: "yPosition"
+ value: wrapper.y
+ }
+ SetProperty {
+ target: wrapper.ListView.view
+ property: "locked"
+ value: 1
+ }
+ }
+ ]
+ transitions: [
+ Transition {
+ ParallelAnimation {
+ ColorAnimation {
+ duration: 500
+ }
+ NumericAnimation {
+ duration: 150
+ properties: "x,yPosition,height,width"
+ }
+ }
+ }
+ ]
+ }
+ }
+ ]
+ ListView {
+ id: List
+ model: contactModel
+ width: 320
+ height: 480
+ clip: true
+ delegate: contactDelegate
+ }
+}
diff --git a/examples/declarative/dial/DialLibrary/Dial.qml b/examples/declarative/dial/DialLibrary/Dial.qml
index e2a11b1..8336a70 100644
--- a/examples/declarative/dial/DialLibrary/Dial.qml
+++ b/examples/declarative/dial/DialLibrary/Dial.qml
@@ -1,12 +1,42 @@
-<Item width="210" height="210">
- <properties><Property name="value" type="real" value="0"/></properties>
- <Image id="Background" src="background.svg"/>
- <Item x="104" y="102" rotation="{Needle.rotation}">
- <Image src="needle_shadow.svg" x="-104" y="-102"/>
- </Item>
- <Item id="Needle" x="102" y="98" rotation="-130">
- <rotation><Follow spring="1.4" damping=".15" source="{Math.min(Math.max(-130, value*2.2 - 130), 133)}"/></rotation>
- <Image src="needle.svg" x="-102" y="-98"/>
- </Item>
- <Image src="overlay.svg"/>
-</Item>
+Item {
+ width: 210
+ height: 210
+ properties: Property {
+ name: "value"
+ type: "real"
+ value: 0
+ }
+ Image {
+ id: Background
+ src: "background.svg"
+ }
+ Item {
+ x: 104
+ y: 102
+ rotation: Needle.rotation
+ Image {
+ src: "needle_shadow.svg"
+ x: -104
+ y: -102
+ }
+ }
+ Item {
+ id: Needle
+ x: 102
+ y: 98
+ rotation: -130
+ rotation: Follow {
+ spring: 1.4
+ damping: .15
+ source: Math.min(Math.max(-130, value*2.2 - 130), 133)
+ }
+ Image {
+ src: "needle.svg"
+ x: -102
+ y: -98
+ }
+ }
+ Image {
+ src: "overlay.svg"
+ }
+}
diff --git a/examples/declarative/dial/dial.qml b/examples/declarative/dial/dial.qml
index bda9b41..fa11d79 100644
--- a/examples/declarative/dial/dial.qml
+++ b/examples/declarative/dial/dial.qml
@@ -1,14 +1,38 @@
-<?qtfx namespacepath:=DialLibrary ?>
-<Rect color="white" width="210" height="240">
- <!-- Dial with a slider to adjust it -->
- <Dial id="Dial" value="{Slider.x-2}"/>
- <Rect anchors.top="{Dial.bottom}" x="20" width="160" height="16" color="steelblue" gradientColor="lightsteelblue" radius="8" opacity="0.7">
- <Rect id="Slider" x="2" y="2" width="30" height="12" color="lightgray" gradientColor="gray" radius="6">
- <MouseRegion anchors.fill="{parent}"
- drag.target="{parent}"
- drag.axis="x"
- drag.xmin="2"
- drag.xmax="128"/>
- </Rect>
- </Rect>
-</Rect>
+import "DialLibrary"
+Rect {
+ color: "white"
+ width: 210
+ height: 240
+ // Dial with a slider to adjust it
+ Dial {
+ id: Dial
+ value: Slider.x-2
+ }
+ Rect {
+ anchors.top: Dial.bottom
+ x: 20
+ width: 160
+ height: 16
+ color: "steelblue"
+ gradientColor: "lightsteelblue"
+ radius: 8
+ opacity: 0.7
+ Rect {
+ id: Slider
+ x: 2
+ y: 2
+ width: 30
+ height: 12
+ color: "lightgray"
+ gradientColor: "gray"
+ radius: 6
+ MouseRegion {
+ anchors.fill: parent
+ drag.target: parent
+ drag.axis: "x"
+ drag.xmin: 2
+ drag.xmax: 128
+ }
+ }
+ }
+}
diff --git a/examples/declarative/follow/follow.qml b/examples/declarative/follow/follow.qml
index 0f3e772..598d953 100644
--- a/examples/declarative/follow/follow.qml
+++ b/examples/declarative/follow/follow.qml
@@ -1,35 +1,78 @@
-<Rect width="320" height="240" color="#ffffff">
- <Rect id="Rect" y="{200}" color="#00ff00" width="60" height="20">
- <y>
- <SequentialAnimation running="true" repeat="true">
- <NumericAnimation to="{200}" easing="easeOutBounce(amplitude:180)" duration="2000" />
- <PauseAnimation duration="1000" />
- </SequentialAnimation>
- </y>
- </Rect>
- <!-- Velocity -->
- <Rect x="{Rect.width}" color="#ff0000" width="{Rect.width}" height="20">
- <y>
- <Follow source="{Rect.y}" velocity="200"/>
- </y>
- </Rect>
- <Text x="{Rect.width}" y="220" text="Velocity"/>
- <!-- Spring -->
- <Rect x="{Rect.width * 2}" color="#ff0000" width="{Rect.width}" height="20">
- <y>
- <Follow source="{Rect.y}" spring="1.2" damping="0.1"/>
- </y>
- </Rect>
- <Text x="{Rect.width * 2}" y="220" text="Spring"/>
- <!-- Follow mouse -->
- <MouseRegion id="Mouse" anchors.fill="{parent}">
- <Rect width="20" height="20" radius="10" color="#0000ff">
- <x>
- <Follow source="{Mouse.mouseX-10}" spring="1.0" damping="0.05"/>
- </x>
- <y>
- <Follow source="{Mouse.mouseY-10}" spring="1.0" damping="0.05"/>
- </y>
- </Rect>
- </MouseRegion>
-</Rect>
+Rect {
+ width: 320
+ height: 240
+ color: "#ffffff"
+ Rect {
+ id: Rect
+ y: 200
+ color: "#00ff00"
+ width: 60
+ height: 20
+ y: SequentialAnimation {
+ running: true
+ repeat: true
+ NumericAnimation {
+ to: 200
+ easing: "easeOutBounce(amplitude:180)"
+ duration: 2000
+ }
+ PauseAnimation {
+ duration: 1000
+ }
+ }
+ }
+ // Velocity
+ Rect {
+ x: Rect.width
+ color: "#ff0000"
+ width: Rect.width
+ height: 20
+ y: Follow {
+ source: Rect.y
+ velocity: 200
+ }
+ }
+ Text {
+ x: Rect.width
+ y: 220
+ text: "Velocity"
+ }
+ // Spring
+ Rect {
+ x: Rect.width * 2
+ color: "#ff0000"
+ width: Rect.width
+ height: 20
+ y: Follow {
+ source: Rect.y
+ spring: 1.2
+ damping: 0.1
+ }
+ }
+ Text {
+ x: Rect.width * 2
+ y: 220
+ text: "Spring"
+ }
+ // Follow mouse
+ MouseRegion {
+ id: Mouse
+ anchors.fill: parent
+ Rect {
+ width: 20
+ height: 20
+ radius: 10
+ color: "#0000ff"
+ x: Follow {
+ source: Mouse.mouseX-10
+ spring: 1.0
+ damping: 0.05
+ }
+ y: Follow {
+ source: Mouse.mouseY-10
+ spring: 1.0
+ damping: 0.05
+ }
+ }
+ }
+}
diff --git a/examples/declarative/listview/highlight.qml b/examples/declarative/listview/highlight.qml
index 5ce7acb..cbadb72 100644
--- a/examples/declarative/listview/highlight.qml
+++ b/examples/declarative/listview/highlight.qml
@@ -1,56 +1,77 @@
-<Rect width="400" height="300" color="white">
-
- <!--
- MyPets model is defined in dummydata/MyPetsModel.qml
- The viewer automatically loads files in dummydata/* to assist
- development without a real data source.
- This one contains my pets.
- -->
-
- <!--
- Define a delegate component. A component will be
- instantiated for each visible item in the list.
- -->
- <Component id="PetDelegate">
- <Item id="Wrapper" width="200" height="50">
- <VerticalLayout>
- <Text text="{'Name: ' + name}"/>
- <Text text="{'Type: ' + type}"/>
- <Text text="{'Age: ' + age}"/>
- </VerticalLayout>
-
- <!--
- Use the ListView.isCurrentItem attached property to
- indent the item if it is the current item.
- -->
- <states>
- <State name="Current" when="{Wrapper.ListView.isCurrentItem}">
- <SetProperty target="{Wrapper}" property="x" value="10"/>
- </State>
- </states>
- <transitions>
- <Transition>
- <NumericAnimation properties="x" duration="200" />
- </Transition>
- </transitions>
- </Item>
- </Component>
-
- <!--
- Specify a highlight with custom movement. Note that autoHighlight
- is set to false in the ListView so that we can control how the
- highlight moves to the current item.
- -->
- <Component id="PetHighlight">
- <Rect width="200" height="50" color="#FFFF88">
- <y>
- <Follow source="{List1.current.y}" spring="3" damping="0.1"/>
- </y>
- </Rect>
- </Component>
-
- <ListView id="List1" width="200" height="{parent.height}" model="{MyPetsModel}"
- delegate="{PetDelegate}" highlight="{PetHighlight}" autoHighlight="false"
- focus="true"/>
-
-</Rect>
+Rect {
+ width: 400
+ height: 300
+ color: "white"
+ // MyPets model is defined in dummydata/MyPetsModel.qml
+ // The viewer automatically loads files in dummydata/* to assist
+ // development without a real data source.
+ // This one contains my pets.
+ // Define a delegate component. A component will be
+ // instantiated for each visible item in the list.
+ Component {
+ id: PetDelegate
+ Item {
+ id: Wrapper
+ width: 200
+ height: 50
+ VerticalLayout {
+ Text {
+ text: 'Name: ' + name
+ }
+ Text {
+ text: 'Type: ' + type
+ }
+ Text {
+ text: 'Age: ' + age
+ }
+ }
+ // Use the ListView.isCurrentItem attached property to
+ // indent the item if it is the current item.
+ states: [
+ State {
+ name: "Current"
+ when: Wrapper.ListView.isCurrentItem
+ SetProperty {
+ target: Wrapper
+ property: "x"
+ value: 10
+ }
+ }
+ ]
+ transitions: [
+ Transition {
+ NumericAnimation {
+ properties: "x"
+ duration: 200
+ }
+ }
+ ]
+ }
+ }
+ // Specify a highlight with custom movement. Note that autoHighlight
+ // is set to false in the ListView so that we can control how the
+ // highlight moves to the current item.
+ Component {
+ id: PetHighlight
+ Rect {
+ width: 200
+ height: 50
+ color: "#FFFF88"
+ y: Follow {
+ source: List1.current.y
+ spring: 3
+ damping: 0.1
+ }
+ }
+ }
+ ListView {
+ id: List1
+ width: 200
+ height: parent.height
+ model: MyPetsModel
+ delegate: PetDelegate
+ highlight: PetHighlight
+ autoHighlight: false
+ focus: true
+ }
+}
diff --git a/examples/declarative/listview/listview.qml b/examples/declarative/listview/listview.qml
index 6cacdd1..b71ed4e 100644
--- a/examples/declarative/listview/listview.qml
+++ b/examples/declarative/listview/listview.qml
@@ -1,81 +1,103 @@
-<Rect width="600" height="300" color="white">
-
- <!--
- MyPets model is defined in dummydata/MyPetsModel.qml
- The viewer automatically loads files in dummydata/* to assist
- development without a real data source.
- This one contains my pets.
- -->
-
- <!--
- Define a delegate component. A component will be
- instantiated for each visible item in the list.
- -->
- <Component id="PetDelegate">
- <Item id="Wrapper" width="200" height="50">
- <VerticalLayout>
- <Text text="{'Name: ' + name}"/>
- <Text text="{'Type: ' + type}"/>
- <Text text="{'Age: ' + age}"/>
- </VerticalLayout>
- </Item>
- </Component>
-
- <!--
- Define a highlight component. Just one of these will be instantiated
- by each ListView and placed behind the current item.
- -->
- <Component id="PetHighlight">
- <Rect color="#FFFF88"/>
- </Component>
-
- <!--
- Show the model in three lists, with different currentItemPositioning.
- currentItemPositioning determines how the list behaves when the
- current item changes. Note that the second and third ListView
- set their currentIndex to be the same as the first, and that
- the first ListView is given keyboard focus.
-
- The default mode, Free, allows the currentItem to move freely
- within the visible area. If it would move outside the visible
- area, the view is scrolled to keep it visible.
-
- Snap currentItemPositioning attempts to keep the current item
- aligned with the snapPosition by scrolling the view, however the
- items will not scroll beyond the beginning or end of the view.
-
- SnapAuto currentItemPositioning always keeps the current item on
- the snapPosition by scrolling the view. It also automatically
- sets the current item as is scrolled with the mouse. Note
- that the first ListView sets its currentIndex to be equal to
- the third ListView's currentIndex. By flicking List3 with
- the mouse, the current index of List1 will be changed.
- -->
-
- <ListView id="List1" width="200" height="{parent.height}" model="{MyPetsModel}"
- delegate="{PetDelegate}" highlight="{PetHighlight}"
- currentIndex="{List3.currentIndex}" focus="true"/>
-
- <ListView id="List2" x="200" width="200" height="{parent.height}" model="{MyPetsModel}"
- delegate="{PetDelegate}" highlight="{PetHighlight}"
- currentItemPositioning="Snap" snapPosition="125"
- currentIndex="{List1.currentIndex}"/>
-
- <ListView id="List3" x="400" width="200" height="{parent.height}" model="{MyPetsModel}"
- delegate="{PetDelegate}"
- currentItemPositioning="SnapAuto" snapPosition="125"
- currentIndex="{List1.currentIndex}">
- <children>
- <!--
- Position a static highlight rather than a normal highlight so that
- when the view is flicked, the highlight does not move.
- By positioning the highlight at the same position as the snapPosition
- the item under the highlight will always be the current item.
- Note that we specify the 'children' property. This is because
- the default property of a ListView is 'delegate'.
- -->
- <Rect y="125" width="200" height="50" color="#FFFF88" z="-1"/>
- </children>
- </ListView>
-
-</Rect>
+Rect {
+ width: 600
+ height: 300
+ color: "white"
+ // MyPets model is defined in dummydata/MyPetsModel.qml
+ // The viewer automatically loads files in dummydata/* to assist
+ // development without a real data source.
+ // This one contains my pets.
+ // Define a delegate component. A component will be
+ // instantiated for each visible item in the list.
+ Component {
+ id: PetDelegate
+ Item {
+ id: Wrapper
+ width: 200
+ height: 50
+ VerticalLayout {
+ Text {
+ text: 'Name: ' + name
+ }
+ Text {
+ text: 'Type: ' + type
+ }
+ Text {
+ text: 'Age: ' + age
+ }
+ }
+ }
+ }
+ // Define a highlight component. Just one of these will be instantiated
+ // by each ListView and placed behind the current item.
+ Component {
+ id: PetHighlight
+ Rect {
+ color: "#FFFF88"
+ }
+ }
+ // Show the model in three lists, with different currentItemPositioning.
+ // currentItemPositioning determines how the list behaves when the
+ // current item changes. Note that the second and third ListView
+ // set their currentIndex to be the same as the first, and that
+ // the first ListView is given keyboard focus.
+ // The default mode, Free, allows the currentItem to move freely
+ // within the visible area. If it would move outside the visible
+ // area, the view is scrolled to keep it visible.
+ // Snap currentItemPositioning attempts to keep the current item
+ // aligned with the snapPosition by scrolling the view, however the
+ // items will not scroll beyond the beginning or end of the view.
+ // SnapAuto currentItemPositioning always keeps the current item on
+ // the snapPosition by scrolling the view. It also automatically
+ // sets the current item as is scrolled with the mouse. Note
+ // that the first ListView sets its currentIndex to be equal to
+ // the third ListView's currentIndex. By flicking List3 with
+ // the mouse, the current index of List1 will be changed.
+ ListView {
+ id: List1
+ width: 200
+ height: parent.height
+ model: MyPetsModel
+ delegate: PetDelegate
+ highlight: PetHighlight
+ currentIndex: List3.currentIndex
+ focus: true
+ }
+ ListView {
+ id: List2
+ x: 200
+ width: 200
+ height: parent.height
+ model: MyPetsModel
+ delegate: PetDelegate
+ highlight: PetHighlight
+ currentItemPositioning: "Snap"
+ snapPosition: 125
+ currentIndex: List1.currentIndex
+ }
+ ListView {
+ id: List3
+ x: 400
+ width: 200
+ height: parent.height
+ model: MyPetsModel
+ delegate: PetDelegate
+ currentItemPositioning: "SnapAuto"
+ snapPosition: 125
+ currentIndex: List1.currentIndex
+ children: [
+ // Position a static highlight rather than a normal highlight so that
+ // when the view is flicked, the highlight does not move.
+ // By positioning the highlight at the same position as the snapPosition
+ // the item under the highlight will always be the current item.
+ // Note that we specify the 'children' property. This is because
+ // the default property of a ListView is 'delegate'.
+ Rect {
+ y: 125
+ width: 200
+ height: 50
+ color: "#FFFF88"
+ z: -1
+ }
+ ]
+ }
+}
diff --git a/examples/declarative/listview/recipes.qml b/examples/declarative/listview/recipes.qml
index 6826b78..0f6324f 100644
--- a/examples/declarative/listview/recipes.qml
+++ b/examples/declarative/listview/recipes.qml
@@ -1,85 +1,204 @@
-<!-- This example illustrates expanding a list item to show a more detailed view -->
-<?qtfx namespacepath:=content ?>
-<Rect id="page" width="400" height="240" color="black">
- <resources>
- <!--
- Delegate for the recipes. This delegate has two modes:
- 1. the list mode (default), which just shows the picture and title of the recipe.
- 2. the details mode, which also shows the ingredients and method.
- -->
- <Component id="recipeDelegate">
- <Item id="wrapper" width="{List.width}">
- <!--
- Create a property to contain the visibility of the details.
- We can bind multiple element's opacity to this one property,
- rather than having a "SetProperty" line for each element we
- want to fade.
- -->
- <properties><Property name="detailsOpacity" value="0" type="real"/></properties>
- <!-- A simple rounded rectangle for the background -->
- <Rect id="background" x="1" y="2" width="{parent.width-2}" height="{parent.height-4}" color="#FEFFEE" pen.color="#FFBE4F" radius="5"/>
- <!--
- This mouse region covers the entire delegate.
- When clicked it changes mode to 'Details'. If we are already
- in Details mode, then no change will happen.
- -->
- <MouseRegion id="pageMouse" anchors.fill="{parent}" onClicked="wrapper.state = 'Details'"/>
- <!--
- Layout the page. Picture, title and ingredients at the top, method at the
- bottom. Note that elements that should not be visible in the list
- mode have their opacity set to wrapper.detailsOpacity.
- -->
- <HorizontalLayout id="topLayout" x="10" y="10" spacing="10" height="{recipePic.height}" width="{parent.width}">
- <Image id="recipePic" src="{picture}" width="48" height="48"/>
- <VerticalLayout height="{recipePic.height}" spacing="5" width="{background.width-recipePic.width-20}">
- <Text id="name" text="{title}" font.bold="true" font.size="16"/>
- <Text opacity="{wrapper.detailsOpacity}" text="Ingredients" font.size="12" font.bold="true"/>
- <Text opacity="{wrapper.detailsOpacity}" text="{ingredients}" wrap="true" width="{parent.width}"/>
- </VerticalLayout>
- </HorizontalLayout>
- <Item id="details" x="10" width="{parent.width-20}" anchors.top="{topLayout.bottom}" anchors.topMargin="10"
- anchors.bottom="{parent.bottom}" anchors.bottomMargin="10" opacity="{wrapper.detailsOpacity}">
- <Text id="methodTitle" text="Method" font.size="12" font.bold="true" anchors.top="{parent.top}"/>
- <Flickable id="flick" anchors.top="{methodTitle.bottom}" anchors.bottom="{parent.bottom}" width="{parent.width}" viewportHeight="{methodText.height}" clip="true">
- <Text id="methodText" text="{method}" wrap="true" width="{details.width}"/>
- </Flickable>
- <Image anchors.right="{flick.right}" anchors.top="{flick.top}" src="content/pics/moreUp.png" opacity="{flick.atYBeginning ? 0 : 1}"/>
- <Image anchors.right="{flick.right}" anchors.bottom="{flick.bottom}" src="content/pics/moreDown.png" opacity="{flick.atYEnd ? 0 : 1}"/>
- </Item>
- <!-- A button to close the detailed view, i.e. set the state back to default (''). -->
- <MediaButton anchors.right="{background.right}" anchors.rightMargin="5" y="10" opacity="{wrapper.detailsOpacity}" text="Close" onClicked="wrapper.state = ''"/>
- <!-- Make the default height equal the hight of the picture, plus margin. -->
- <height>68</height>
-
- <states>
- <State name="Details">
- <SetProperty target="{background}" property="color" value="white" />
- <!-- Make the picture bigger -->
- <SetProperties target="{recipePic}" width="128" height="128" />
- <!-- Make details visible -->
- <SetProperties target="{wrapper}" detailsOpacity="1" x="0"/>
- <!-- Make the detailed view fill the entire list area -->
- <SetProperty target="{wrapper}" property="height" value="{List.height}"/>
- <!-- Move the list so that this item is at the top. -->
- <SetProperty target="{wrapper.ListView.view}" property="yPosition" value="{wrapper.y}"/>
- <!-- Disallow flicking while we're in detailed view -->
- <SetProperty target="{wrapper.ListView.view}" property="locked" value="1"/>
- </State>
- </states>
-
- <transitions>
- <Transition>
- <!-- Make the state changes smooth -->
- <ParallelAnimation>
- <ColorAnimation duration="500" />
- <NumericAnimation duration="300" properties="detailsOpacity,x,yPosition,height,width"/>
- </ParallelAnimation>
- </Transition>
- </transitions>
- </Item>
- </Component>
- </resources>
-
- <!-- The actual list -->
- <ListView id="List" model="{Recipies}" anchors.fill="{parent}" clip="true" delegate="{recipeDelegate}"/>
-</Rect>
+import "content"
+// This example illustrates expanding a list item to show a more detailed view
+Rect {
+ id: page
+ width: 400
+ height: 240
+ color: "black"
+ resources: [
+ // Delegate for the recipes. This delegate has two modes:
+ // 1. the list mode (default), which just shows the picture and title of the recipe.
+ // 2. the details mode, which also shows the ingredients and method.
+ Component {
+ id: recipeDelegate
+ Item {
+ id: wrapper
+ width: List.width
+ // Create a property to contain the visibility of the details.
+ // We can bind multiple element's opacity to this one property,
+ // rather than having a "SetProperty" line for each element we
+ // want to fade.
+ properties: Property {
+ name: "detailsOpacity"
+ value: 0
+ type: "real"
+ }
+ // A simple rounded rectangle for the background
+ Rect {
+ id: background
+ x: 1
+ y: 2
+ width: parent.width-2
+ height: parent.height-4
+ color: "#FEFFEE"
+ pen.color: "#FFBE4F"
+ radius: 5
+ }
+ // This mouse region covers the entire delegate.
+ // When clicked it changes mode to 'Details'. If we are already
+ // in Details mode, then no change will happen.
+ MouseRegion {
+ id: pageMouse
+ anchors.fill: parent
+ onClicked: { wrapper.state = 'Details' }
+ }
+ // Layout the page. Picture, title and ingredients at the top, method at the
+ // bottom. Note that elements that should not be visible in the list
+ // mode have their opacity set to wrapper.detailsOpacity.
+ HorizontalLayout {
+ id: topLayout
+ x: 10
+ y: 10
+ spacing: 10
+ height: recipePic.height
+ width: parent.width
+ Image {
+ id: recipePic
+ src: picture
+ width: 48
+ height: 48
+ }
+ VerticalLayout {
+ height: recipePic.height
+ spacing: 5
+ width: background.width-recipePic.width-20
+ Text {
+ id: name
+ text: title
+ font.bold: true
+ font.size: 16
+ }
+ Text {
+ opacity: wrapper.detailsOpacity
+ text: "Ingredients"
+ font.size: 12
+ font.bold: true
+ }
+ Text {
+ opacity: wrapper.detailsOpacity
+ text: ingredients
+ wrap: true
+ width: parent.width
+ }
+ }
+ }
+ Item {
+ id: details
+ x: 10
+ width: parent.width-20
+ anchors.top: topLayout.bottom
+ anchors.topMargin: 10
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 10
+ opacity: wrapper.detailsOpacity
+ Text {
+ id: methodTitle
+ text: "Method"
+ font.size: 12
+ font.bold: true
+ anchors.top: parent.top
+ }
+ Flickable {
+ id: flick
+ anchors.top: methodTitle.bottom
+ anchors.bottom: parent.bottom
+ width: parent.width
+ viewportHeight: methodText.height
+ clip: true
+ Text {
+ id: methodText
+ text: method
+ wrap: true
+ width: details.width
+ }
+ }
+ Image {
+ anchors.right: flick.right
+ anchors.top: flick.top
+ src: "content/pics/moreUp.png"
+ opacity: flick.atYBeginning ? 0 : 1
+ }
+ Image {
+ anchors.right: flick.right
+ anchors.bottom: flick.bottom
+ src: "content/pics/moreDown.png"
+ opacity: flick.atYEnd ? 0 : 1
+ }
+ }
+ // A button to close the detailed view, i.e. set the state back to default ('').
+ MediaButton {
+ anchors.right: background.right
+ anchors.rightMargin: 5
+ y: 10
+ opacity: wrapper.detailsOpacity
+ text: "Close"
+ onClicked: { wrapper.state = '' }
+ }
+ // Make the default height equal the hight of the picture, plus margin.
+ height: 68
+ states: [
+ State {
+ name: "Details"
+ SetProperty {
+ target: background
+ property: "color"
+ value: "white"
+ }
+ // Make the picture bigger
+ SetProperties {
+ target: recipePic
+ width: 128
+ height: 128
+ }
+ // Make details visible
+ SetProperties {
+ target: wrapper
+ detailsOpacity: 1
+ x: 0
+ }
+ // Make the detailed view fill the entire list area
+ SetProperty {
+ target: wrapper
+ property: "height"
+ value: List.height
+ }
+ // Move the list so that this item is at the top.
+ SetProperty {
+ target: wrapper.ListView.view
+ property: "yPosition"
+ value: wrapper.y
+ }
+ // Disallow flicking while we're in detailed view
+ SetProperty {
+ target: wrapper.ListView.view
+ property: "locked"
+ value: 1
+ }
+ }
+ ]
+ transitions: [
+ Transition {
+ // Make the state changes smooth
+ ParallelAnimation {
+ ColorAnimation {
+ duration: 500
+ }
+ NumericAnimation {
+ duration: 300
+ properties: "detailsOpacity,x,yPosition,height,width"
+ }
+ }
+ }
+ ]
+ }
+ }
+ ]
+ // The actual list
+ ListView {
+ id: List
+ model: Recipies
+ anchors.fill: parent
+ clip: true
+ delegate: recipeDelegate
+ }
+}
diff --git a/examples/declarative/minehunt/Description.qml b/examples/declarative/minehunt/Description.qml
index 5bda5f8..f59c8f9 100644
--- a/examples/declarative/minehunt/Description.qml
+++ b/examples/declarative/minehunt/Description.qml
@@ -1,10 +1,38 @@
-<Item id="Page" height="{MyText.height + 20}" >
- <properties><Property name="text" /></properties>
- <MouseRegion anchors.fill="{parent}" drag.target="{Page}" drag.axis="xy" drag.xmin="0" drag.xmax="1000" drag.ymin="0" drag.ymax="1000"/>
- <Rect radius="10" anchors.fill="{parent}" color="lightsteelblue" />
- <Item x="10" y="10" width="{parent.width - 20}" height="{parent.height - 20}">
- <Text id="MyText" text="{Page.text}" width="{parent.width}" clip="true" wrap="true"/>
- </Item>
-
- <filter><Shadow xOffset="5" yOffset="5" /></filter>
-</Item>
+Item {
+ id: Page
+ height: MyText.height + 20
+ properties: Property {
+ name: "text"
+ }
+ MouseRegion {
+ anchors.fill: parent
+ drag.target: Page
+ drag.axis: "xy"
+ drag.xmin: 0
+ drag.xmax: 1000
+ drag.ymin: 0
+ drag.ymax: 1000
+ }
+ Rect {
+ radius: 10
+ anchors.fill: parent
+ color: "lightsteelblue"
+ }
+ Item {
+ x: 10
+ y: 10
+ width: parent.width - 20
+ height: parent.height - 20
+ Text {
+ id: MyText
+ text: Page.text
+ width: parent.width
+ clip: true
+ wrap: true
+ }
+ }
+ filter: Shadow {
+ xOffset: 5
+ yOffset: 5
+ }
+}
diff --git a/examples/declarative/minehunt/Explosion.qml b/examples/declarative/minehunt/Explosion.qml
index aec685b..1e4f03d 100644
--- a/examples/declarative/minehunt/Explosion.qml
+++ b/examples/declarative/minehunt/Explosion.qml
@@ -1,6 +1,21 @@
-<Item>
- <properties>
- <Property name="explode" type="Bool" value="false"/>
- </properties>
- <Particles width="38" height="21" lifeSpan="3600000" lifeSpanDeviation="0" src="pics/star.png" count="200" angle="270" angleDeviation="360" velocity="100" velocityDeviation="20" z="100" emitting="{explode}"/>
-</Item>
+Item {
+ properties: Property {
+ name: "explode"
+ type: "Bool"
+ value: false
+ }
+ Particles {
+ width: 38
+ height: 21
+ lifeSpan: 3600000
+ lifeSpanDeviation: 0
+ src: "pics/star.png"
+ count: 200
+ angle: 270
+ angleDeviation: 360
+ velocity: 100
+ velocityDeviation: 20
+ z: 100
+ emitting: explode
+ }
+}
diff --git a/examples/declarative/minehunt/minehunt.qml b/examples/declarative/minehunt/minehunt.qml
index 9db0e84..20c3874 100644
--- a/examples/declarative/minehunt/minehunt.qml
+++ b/examples/declarative/minehunt/minehunt.qml
@@ -7,7 +7,7 @@
<Component id="tile">
<Flipable id="flipable" width="40" height="40">
<transform>
- <Axis id="axis" xStart="20" xEnd="20" yStart="20" yEnd="0" />
+ <AxisRotation id="axis" axis.startX="20" axis.endX="20" axis.startY="20" axis.endY="0" />
</transform>
<front>
<Image src="pics/front.png" width="40" height="40">
@@ -34,14 +34,14 @@
</back>
<states>
<State name="back" when="{modelData.flipped == true}">
- <SetProperty target="{axis}" property="rotation" value="180" />
+ <SetProperty target="{axis}" property="angle" value="180" />
</State>
</states>
<transitions>
<Transition>
<SequentialAnimation>
<PauseAnimation duration="{var ret = Math.abs(flipable.parent.x-field.clickx) + Math.abs(flipable.parent.y-field.clicky); if (ret > 0) {if(modelData.hasMine==true &amp;&amp; modelData.flipped==true){ret*3;}else{ret;}} else {0}}"/>
- <NumericAnimation easing="easeInOutQuad" properties="rotation"/>
+ <NumericAnimation easing="easeInOutQuad" properties="angle"/>
</SequentialAnimation>
</Transition>
</transitions>
diff --git a/examples/declarative/mouseregion/mouse.qml b/examples/declarative/mouseregion/mouse.qml
index 9581da2..7aaf51a 100644
--- a/examples/declarative/mouseregion/mouse.qml
+++ b/examples/declarative/mouseregion/mouse.qml
@@ -1,7 +1,7 @@
<Rect color="white" width="200" height="200">
<Rect width="50" height="50" color="red">
<Text text="Click" anchors.centeredIn="{parent}"/>
- <MouseRegion onPressed="print('press (x: ' + mouse.x + ' y: ' + mouse.y + ')')"
+ <MouseRegion onPressed="print('press (x: ' + mouse.x + ' y: ' + mouse.y + ' button: ' + (mouse.button == Qt.RightButton ? 'right' : 'left') + ' Shift: ' + (mouse.modifiers &amp; Qt.ShiftModifier ? 'true' : 'false') + ')')"
onReleased="print('release (x: ' + mouse.x + ' y: ' + mouse.y + ' isClick: ' + mouse.isClick + ' wasHeld: ' + mouse.wasHeld + ')')"
onClicked="print('click (x: ' + mouse.x + ' y: ' + mouse.y + ' wasHeld: ' + mouse.wasHeld + ')')"
onDoubleClicked="print('double click (x: ' + mouse.x + ' y: ' + mouse.y + ')')"
diff --git a/examples/declarative/scrollbar/ScrollBar.qml b/examples/declarative/scrollbar/ScrollBar.qml
index 470a170..e3ca0c2 100644
--- a/examples/declarative/scrollbar/ScrollBar.qml
+++ b/examples/declarative/scrollbar/ScrollBar.qml
@@ -1,26 +1,36 @@
-<Item id="ScrollBar">
- <!--
- The properties that define the scrollbar's state.
- position and pageSize are in the range 0.0 - 1.0. They are relative to the
- height of the page, i.e. a pageSize of 0.5 means that you can see 50%
- of the height of the view.
- orientation can be either 'Vertical' or 'Horizontal'
- -->
- <properties>
- <Property name="position"/>
- <Property name="pageSize"/>
- <Property name="orientation" value="Vertical"/>
- </properties>
-
- <!-- A light, semi-transparent background -->
- <Rect id="Background" radius="{orientation == 'Vertical' ? (width/2) : (height/2)}" color="white" opacity="0.3" anchors.fill="{parent}"/>
-
- <!-- Size the bar to the required size, depending upon the orientation. -->
- <Rect opacity="0.6" color="black"
- radius="{orientation == 'Vertical' ? (width/2) : (height/2)}"
- x="{orientation == 'Vertical' ? 2 : (ScrollBar.position * (ScrollBar.width-4) + 2)}"
- y="{orientation == 'Vertical' ? (ScrollBar.position * (ScrollBar.height-4) + 2) : 2}"
- width="{orientation == 'Vertical' ? (parent.width-4) : (ScrollBar.pageSize * (ScrollBar.width-4))}"
- height="{orientation == 'Vertical' ? (ScrollBar.pageSize * (ScrollBar.height-4)) : (parent.height-4)}"
- />
-</Item>
+Item {
+ id: ScrollBar
+ // The properties that define the scrollbar's state.
+ // position and pageSize are in the range 0.0 - 1.0. They are relative to the
+ // height of the page, i.e. a pageSize of 0.5 means that you can see 50%
+ // of the height of the view.
+ // orientation can be either 'Vertical' or 'Horizontal'
+ properties: Property {
+ name: "position"
+ }
+ properties: Property {
+ name: "pageSize"
+ }
+ properties: Property {
+ name: "orientation"
+ value: "Vertical"
+ }
+ // A light, semi-transparent background
+ Rect {
+ id: Background
+ radius: orientation == 'Vertical' ? (width/2) : (height/2)
+ color: "white"
+ opacity: 0.3
+ anchors.fill: parent
+ }
+ // Size the bar to the required size, depending upon the orientation.
+ Rect {
+ opacity: 0.6
+ color: "black"
+ radius: orientation == 'Vertical' ? (width/2) : (height/2)
+ x: orientation == 'Vertical' ? 2 : (ScrollBar.position * (ScrollBar.width-4) + 2)
+ y: orientation == 'Vertical' ? (ScrollBar.position * (ScrollBar.height-4) + 2) : 2
+ width: orientation == 'Vertical' ? (parent.width-4) : (ScrollBar.pageSize * (ScrollBar.width-4))
+ height: orientation == 'Vertical' ? (ScrollBar.pageSize * (ScrollBar.height-4)) : (parent.height-4)
+ }
+}
diff --git a/examples/declarative/scrollbar/display.qml b/examples/declarative/scrollbar/display.qml
index 697b68a..4412d7f 100644
--- a/examples/declarative/scrollbar/display.qml
+++ b/examples/declarative/scrollbar/display.qml
@@ -1,28 +1,63 @@
-<Rect width="640" height="480">
-
- <!-- Create a flickable to view a large image. -->
- <Flickable id="View" anchors.fill="{parent}">
- <Image id="Picture" src="pics/niagara_falls.jpg"/>
- <viewportWidth>{Picture.width}</viewportWidth>
- <viewportHeight>{Picture.height}</viewportHeight>
-
- <!-- Only show the scrollbars when the view is moving. -->
- <states>
- <State name="ShowBars" when="{View.moving}">
- <SetProperty target="{SBV}" property="opacity" value="1" />
- <SetProperty target="{SBH}" property="opacity" value="1" />
- </State>
- </states>
- <transitions>
- <Transition fromState="*" toState="*">
- <NumericAnimation properties="opacity" duration="400"/>
- </Transition>
- </transitions>
-
- </Flickable>
-
- <!-- Attach scrollbars to the right and bottom edges of the view. -->
- <ScrollBar id="SBV" opacity="0" orientation="Vertical" position="{View.pageYPosition}" pageSize="{View.pageHeight}" width="12" height="{View.height-12}" anchors.right="{View.right}"/>
- <ScrollBar id="SBH" opacity="0" orientation="Horizontal" position="{View.pageXPosition}" pageSize="{View.pageWidth}" height="12" width="{View.width-12}" anchors.bottom="{View.bottom}"/>
-
-</Rect>
+Rect {
+ width: 640
+ height: 480
+ // Create a flickable to view a large image.
+ Flickable {
+ id: View
+ anchors.fill: parent
+ Image {
+ id: Picture
+ src: "pics/niagara_falls.jpg"
+ }
+ viewportWidth: Picture.width
+ viewportHeight: Picture.height
+ // Only show the scrollbars when the view is moving.
+ states: [
+ State {
+ name: "ShowBars"
+ when: View.moving
+ SetProperty {
+ target: SBV
+ property: "opacity"
+ value: 1
+ }
+ SetProperty {
+ target: SBH
+ property: "opacity"
+ value: 1
+ }
+ }
+ ]
+ transitions: [
+ Transition {
+ fromState: "*"
+ toState: "*"
+ NumericAnimation {
+ properties: "opacity"
+ duration: 400
+ }
+ }
+ ]
+ }
+ // Attach scrollbars to the right and bottom edges of the view.
+ ScrollBar {
+ id: SBV
+ opacity: 0
+ orientation: "Vertical"
+ position: View.pageYPosition
+ pageSize: View.pageHeight
+ width: 12
+ height: View.height-12
+ anchors.right: View.right
+ }
+ ScrollBar {
+ id: SBH
+ opacity: 0
+ orientation: "Horizontal"
+ position: View.pageXPosition
+ pageSize: View.pageWidth
+ height: 12
+ width: View.width-12
+ anchors.bottom: View.bottom
+ }
+}
diff --git a/examples/declarative/slideswitch/Switch.qml b/examples/declarative/slideswitch/Switch.qml
index 90e6e64..f62e4b6 100644
--- a/examples/declarative/slideswitch/Switch.qml
+++ b/examples/declarative/slideswitch/Switch.qml
@@ -1,6 +1,12 @@
-<Item id="Switch" width="{Groove.width}" height="{Groove.height}">
- <properties><Property name="on"/></properties>
- <Script>
+Item {
+ id: Switch
+ width: Groove.width
+ height: Groove.height
+ properties: Property {
+ name: "on"
+ }
+ Script {
+
function toggle() {
if(Switch.state == "On")
Switch.state = "Off";
@@ -21,32 +27,66 @@
toggle();
}
- </Script>
- <Image id="Groove" src="background.svg"/>
- <MouseRegion anchors.fill="{Groove}" onClicked="toggle()"/>
- <Image id="Knob" src="knob.svg" x="1" y="2"/>
- <MouseRegion anchors.fill="{Knob}"
- onClicked="toggle()"
- onReleased="if (!isClick) dorelease()"
- drag.target="{Knob}"
- drag.axis="x"
- drag.xmin="1"
- drag.xmax="78"/>
-
- <states>
- <State name="On">
- <SetProperty target="{Knob}" property="x" value="78" />
- <SetProperty target="{Switch}" property="on" value="true" />
- </State>
- <State name="Off">
- <SetProperty target="{Knob}" property="x" value="1" />
- <SetProperty target="{Switch}" property="on" value="false" />
- </State>
- </states>
-
- <transitions>
- <Transition>
- <NumericAnimation properties="x" easing="easeInOutQuad" duration="200"/>
- </Transition>
- </transitions>
-</Item>
+
+ }
+ Image {
+ id: Groove
+ src: "background.svg"
+ }
+ MouseRegion {
+ anchors.fill: Groove
+ onClicked: { toggle() }
+ }
+ Image {
+ id: Knob
+ src: "knob.svg"
+ x: 1
+ y: 2
+ }
+ MouseRegion {
+ anchors.fill: Knob
+ onClicked: { toggle() }
+ onReleased: { if (!isClick) dorelease() }
+ drag.target: Knob
+ drag.axis: "x"
+ drag.xmin: 1
+ drag.xmax: 78
+ }
+ states: [
+ State {
+ name: "On"
+ SetProperty {
+ target: Knob
+ property: "x"
+ value: 78
+ }
+ SetProperty {
+ target: Switch
+ property: "on"
+ value: true
+ }
+ },
+ State {
+ name: "Off"
+ SetProperty {
+ target: Knob
+ property: "x"
+ value: 1
+ }
+ SetProperty {
+ target: Switch
+ property: "on"
+ value: false
+ }
+ }
+ ]
+ transitions: [
+ Transition {
+ NumericAnimation {
+ properties: "x"
+ easing: "easeInOutQuad"
+ duration: 200
+ }
+ }
+ ]
+}
diff --git a/examples/declarative/slideswitch/display.qml b/examples/declarative/slideswitch/display.qml
index b62422c..cea89b6 100644
--- a/examples/declarative/slideswitch/display.qml
+++ b/examples/declarative/slideswitch/display.qml
@@ -1,3 +1,8 @@
-<Rect color="white" width="150" height="150">
- <Switch anchors.centeredIn="{parent}"/>
-</Rect>
+Rect {
+ color: "white"
+ width: 150
+ height: 150
+ Switch {
+ anchors.centeredIn: parent
+ }
+}
diff --git a/examples/declarative/states/states.qml b/examples/declarative/states/states.qml
index e540d25..0c27637 100644
--- a/examples/declarative/states/states.qml
+++ b/examples/declarative/states/states.qml
@@ -1,40 +1,79 @@
-<Rect id="Page" width="300" height="300" color="white">
-
- <!-- A target region. Clicking in here sets the state to '' - the default state -->
- <Rect width="50" height="50" x="0" y="0" color="transparent" pen.color="black">
- <MouseRegion anchors.fill="{parent}" onClicked="Page.state=''"/>
- </Rect>
-
- <!-- Another target region. Clicking in here sets the state to 'Position1' -->
- <Rect width="50" height="50" x="150" y="50" color="transparent" pen.color="black">
- <MouseRegion anchors.fill="{parent}" onClicked="Page.state='Position1'"/>
- </Rect>
-
- <!-- Another target region. Clicking in here sets the state to 'Position2' -->
- <Rect width="50" height="50" x="0" y="200" color="transparent" pen.color="black">
- <MouseRegion anchors.fill="{parent}" onClicked="Page.state='Position2'"/>
- </Rect>
-
- <!-- Rect which will be moved when my state changes -->
- <Rect id="myrect" width="50" height="50" color="red"/>
-
- <states>
-
- <!-- In state 'Position1', change the 'myrect' item x, y to 150, 50. -->
- <State name="Position1">
- <SetProperty target="{myrect}" property="x" value="150"/>
- <SetProperty target="{myrect}" property="y" value="50"/>
- </State>
-
- <!--
- In state 'Position2', change y to 100. We do not specify 'x' here -
- it will therefore be restored to its default value of 0, if it
- had been changed.
- -->
- <State name="Position2">
- <SetProperty target="{myrect}" property="y" value="200"/>
- </State>
-
- </states>
-
-</Rect>
+Rect {
+ id: Page
+ width: 300
+ height: 300
+ color: "white"
+ // A target region. Clicking in here sets the state to '' - the default state
+ Rect {
+ width: 50
+ height: 50
+ x: 0
+ y: 0
+ color: "transparent"
+ pen.color: "black"
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: { Page.state='' }
+ }
+ }
+ // Another target region. Clicking in here sets the state to 'Position1'
+ Rect {
+ width: 50
+ height: 50
+ x: 150
+ y: 50
+ color: "transparent"
+ pen.color: "black"
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: { Page.state='Position1' }
+ }
+ }
+ // Another target region. Clicking in here sets the state to 'Position2'
+ Rect {
+ width: 50
+ height: 50
+ x: 0
+ y: 200
+ color: "transparent"
+ pen.color: "black"
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: { Page.state='Position2' }
+ }
+ }
+ // Rect which will be moved when my state changes
+ Rect {
+ id: myrect
+ width: 50
+ height: 50
+ color: "red"
+ }
+ states: [
+ // In state 'Position1', change the 'myrect' item x, y to 150, 50.
+ State {
+ name: "Position1"
+ SetProperty {
+ target: myrect
+ property: "x"
+ value: 150
+ }
+ SetProperty {
+ target: myrect
+ property: "y"
+ value: 50
+ }
+ } // In state 'Position2', change y to 100. We do not specify 'x' here -
+ // it will therefore be restored to its default value of 0, if it
+ // had been changed.
+,
+ State {
+ name: "Position2"
+ SetProperty {
+ target: myrect
+ property: "y"
+ value: 200
+ }
+ }
+ ]
+}
diff --git a/examples/declarative/states/transitions.qml b/examples/declarative/states/transitions.qml
index c3f3515..c7fc656 100644
--- a/examples/declarative/states/transitions.qml
+++ b/examples/declarative/states/transitions.qml
@@ -1,68 +1,111 @@
-<Rect id="Page" width="300" height="300" color="white">
-
- <!-- A target region. Clicking in here sets the state to '' - the default state -->
- <Rect width="50" height="50" x="0" y="0" color="transparent" pen.color="black">
- <MouseRegion anchors.fill="{parent}" onClicked="Page.state=''"/>
- </Rect>
-
- <!-- Another target region. Clicking in here sets the state to 'Position1' -->
- <Rect width="50" height="50" x="150" y="50" color="transparent" pen.color="black">
- <MouseRegion anchors.fill="{parent}" onClicked="Page.state='Position1'"/>
- </Rect>
-
- <!-- Another target region. Clicking in here sets the state to 'Position2' -->
- <Rect width="50" height="50" x="0" y="200" color="transparent" pen.color="black">
- <MouseRegion anchors.fill="{parent}" onClicked="Page.state='Position2'"/>
- </Rect>
-
- <!-- Rect which will be moved when my state changes -->
- <Rect id="myrect" width="50" height="50" color="red"/>
-
- <states>
-
- <!-- In state 'Position1', change the 'myrect' item x, y to 150, 50. -->
- <State name="Position1">
- <SetProperty target="{myrect}" property="x" value="150"/>
- <SetProperty target="{myrect}" property="y" value="50"/>
- </State>
-
- <!--
- In state 'Position2', change y to 100. We do not specify 'x' here -
- it will therefore be restored to its default value of 0, if it
- had been changed.
- -->
- <State name="Position2">
- <SetProperty target="{myrect}" property="y" value="200"/>
- </State>
-
- </states>
-
- <!-- transitions define how the properties change. -->
- <transitions>
-
- <!--
- When transitioning to 'Position1' move x,y over a duration of 1 second,
- with easeOutBounce easing function.
- -->
- <Transition fromState="*" toState="Position1">
- <NumericAnimation properties="x,y" easing="easeOutBounce" duration="1000" />
- </Transition>
-
- <!--
- When transitioning to 'Position2' move x,y over a duration of 2 seconds,
- with easeInOutQuad easing function.
- -->
- <Transition fromState="*" toState="Position2">
- <NumericAnimation properties="x,y" easing="easeInOutQuad" duration="2000" />
- </Transition>
-
- <!--
- For any other state changes move x,y linearly over duration of 200ms.
- -->
- <Transition>
- <NumericAnimation properties="x,y" duration="200" />
- </Transition>
-
- </transitions>
-
-</Rect>
+Rect {
+ id: Page
+ width: 300
+ height: 300
+ color: "white"
+ // A target region. Clicking in here sets the state to '' - the default state
+ Rect {
+ width: 50
+ height: 50
+ x: 0
+ y: 0
+ color: "transparent"
+ pen.color: "black"
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: { Page.state='' }
+ }
+ }
+ // Another target region. Clicking in here sets the state to 'Position1'
+ Rect {
+ width: 50
+ height: 50
+ x: 150
+ y: 50
+ color: "transparent"
+ pen.color: "black"
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: { Page.state='Position1' }
+ }
+ }
+ // Another target region. Clicking in here sets the state to 'Position2'
+ Rect {
+ width: 50
+ height: 50
+ x: 0
+ y: 200
+ color: "transparent"
+ pen.color: "black"
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: { Page.state='Position2' }
+ }
+ }
+ // Rect which will be moved when my state changes
+ Rect {
+ id: myrect
+ width: 50
+ height: 50
+ color: "red"
+ }
+ states: [
+ // In state 'Position1', change the 'myrect' item x, y to 150, 50.
+ State {
+ name: "Position1"
+ SetProperty {
+ target: myrect
+ property: "x"
+ value: 150
+ }
+ SetProperty {
+ target: myrect
+ property: "y"
+ value: 50
+ }
+ } // In state 'Position2', change y to 100. We do not specify 'x' here -
+ // it will therefore be restored to its default value of 0, if it
+ // had been changed.
+,
+ State {
+ name: "Position2"
+ SetProperty {
+ target: myrect
+ property: "y"
+ value: 200
+ }
+ }
+ ]
+ // transitions define how the properties change.
+ transitions: [
+ // When transitioning to 'Position1' move x,y over a duration of 1 second,
+ // with easeOutBounce easing function.
+ Transition {
+ fromState: "*"
+ toState: "Position1"
+ NumericAnimation {
+ properties: "x,y"
+ easing: "easeOutBounce"
+ duration: 1000
+ }
+ } // When transitioning to 'Position2' move x,y over a duration of 2 seconds,
+ // with easeInOutQuad easing function.
+,
+ Transition {
+ fromState: "*"
+ toState: "Position2"
+ NumericAnimation {
+ properties: "x,y"
+ easing: "easeInOutQuad"
+ duration: 2000
+ }
+ } // For any other state changes move x,y linearly over duration of 200ms.
+,
+ Transition {
+ NumericAnimation {
+ properties: "x,y"
+ duration: 200
+ }
+ }
+ ]
+}
diff --git a/examples/declarative/tutorials/t1/tutorial1.qml b/examples/declarative/tutorials/t1/tutorial1.qml
index e4de571..ec29f4f 100644
--- a/examples/declarative/tutorials/t1/tutorial1.qml
+++ b/examples/declarative/tutorials/t1/tutorial1.qml
@@ -1,3 +1,14 @@
-<Rect id="Page" width="480" height="200" color="white">
- <Text id="HelloText" text="Hello world!" font.size="24" font.bold="true" y="30" anchors.horizontalCenter="{Page.horizontalCenter}"/>
-</Rect>
+Rect {
+ id: Page
+ width: 480
+ height: 200
+ color: "white"
+ Text {
+ id: HelloText
+ text: "Hello world!"
+ font.size: 24
+ font.bold: true
+ y: 30
+ anchors.horizontalCenter: Page.horizontalCenter
+ }
+}
diff --git a/examples/declarative/tutorials/t2/Cell.qml b/examples/declarative/tutorials/t2/Cell.qml
index 5d6ff52..bd5bbe7 100644
--- a/examples/declarative/tutorials/t2/Cell.qml
+++ b/examples/declarative/tutorials/t2/Cell.qml
@@ -1,7 +1,16 @@
-<Item id="CellContainer" width="40" height="25">
- <properties>
- <Property name="color"/>
- </properties>
- <Rect anchors.fill="{parent}" color="{CellContainer.color}"/>
- <MouseRegion anchors.fill="{parent}" onClicked="HelloText.color = CellContainer.color" />
-</Item>
+Item {
+ id: CellContainer
+ width: 40
+ height: 25
+ properties: Property {
+ name: "color"
+ }
+ Rect {
+ anchors.fill: parent
+ color: CellContainer.color
+ }
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: { HelloText.color = CellContainer.color }
+ }
+}
diff --git a/examples/declarative/tutorials/t2/tutorial2.qml b/examples/declarative/tutorials/t2/tutorial2.qml
index 1e3af16..08ea9eb 100644
--- a/examples/declarative/tutorials/t2/tutorial2.qml
+++ b/examples/declarative/tutorials/t2/tutorial2.qml
@@ -1,11 +1,41 @@
-<Rect id="Page" width="480" height="200" color="white">
- <Text id="HelloText" text="Hello world!" font.size="24" font.bold="true" y="30" anchors.horizontalCenter="{Page.horizontalCenter}"/>
- <GridLayout id="ColorPicker" x="0" anchors.bottom="{Page.bottom}" width="120" height="50" columns="3" rows="2">
- <Cell color="#ff0000"/>
- <Cell color="#00ff00"/>
- <Cell color="#0000ff"/>
- <Cell color="#ffff00"/>
- <Cell color="#00ffff"/>
- <Cell color="#ff00ff"/>
- </GridLayout>
-</Rect>
+Rect {
+ id: Page
+ width: 480
+ height: 200
+ color: "white"
+ Text {
+ id: HelloText
+ text: "Hello world!"
+ font.size: 24
+ font.bold: true
+ y: 30
+ anchors.horizontalCenter: Page.horizontalCenter
+ }
+ GridLayout {
+ id: ColorPicker
+ x: 0
+ anchors.bottom: Page.bottom
+ width: 120
+ height: 50
+ columns: 3
+ rows: 2
+ Cell {
+ color: "#ff0000"
+ }
+ Cell {
+ color: "#00ff00"
+ }
+ Cell {
+ color: "#0000ff"
+ }
+ Cell {
+ color: "#ffff00"
+ }
+ Cell {
+ color: "#00ffff"
+ }
+ Cell {
+ color: "#ff00ff"
+ }
+ }
+}
diff --git a/examples/declarative/tutorials/t3/Cell.qml b/examples/declarative/tutorials/t3/Cell.qml
index 5d6ff52..bd5bbe7 100644
--- a/examples/declarative/tutorials/t3/Cell.qml
+++ b/examples/declarative/tutorials/t3/Cell.qml
@@ -1,7 +1,16 @@
-<Item id="CellContainer" width="40" height="25">
- <properties>
- <Property name="color"/>
- </properties>
- <Rect anchors.fill="{parent}" color="{CellContainer.color}"/>
- <MouseRegion anchors.fill="{parent}" onClicked="HelloText.color = CellContainer.color" />
-</Item>
+Item {
+ id: CellContainer
+ width: 40
+ height: 25
+ properties: Property {
+ name: "color"
+ }
+ Rect {
+ anchors.fill: parent
+ color: CellContainer.color
+ }
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: { HelloText.color = CellContainer.color }
+ }
+}
diff --git a/examples/declarative/tutorials/t3/tutorial3.qml b/examples/declarative/tutorials/t3/tutorial3.qml
index f9f1415..8e2b697 100644
--- a/examples/declarative/tutorials/t3/tutorial3.qml
+++ b/examples/declarative/tutorials/t3/tutorial3.qml
@@ -1,27 +1,78 @@
-<Rect id="Page" width="480" height="200" color="white">
- <Text id="HelloText" text="Hello world!" font.size="24" font.bold="true" y="30" anchors.horizontalCenter="{Page.horizontalCenter}">
- <states>
- <State name="down" when="{MouseRegion.pressed == true}">
- <SetProperty target="{HelloText}" property="y" value="160"/>
- <SetProperty target="{HelloText}" property="color" value="red"/>
- </State>
- </states>
- <transitions>
- <Transition fromState="*" toState="down" reversible="true">
- <ParallelAnimation>
- <NumericAnimation properties="y" duration="500" easing="easeOutBounce"/>
- <ColorAnimation duration="500"/>
- </ParallelAnimation>
- </Transition>
- </transitions>
- </Text>
- <MouseRegion id="MouseRegion" anchors.fill="{HelloText}"/>
- <GridLayout id="ColorPicker" x="0" anchors.bottom="{Page.bottom}" width="120" height="50" columns="3" rows="2">
- <Cell color="#ff0000"/>
- <Cell color="#00ff00"/>
- <Cell color="#0000ff"/>
- <Cell color="#ffff00"/>
- <Cell color="#00ffff"/>
- <Cell color="#ff00ff"/>
- </GridLayout>
-</Rect>
+Rect {
+ id: Page
+ width: 480
+ height: 200
+ color: "white"
+ Text {
+ id: HelloText
+ text: "Hello world!"
+ font.size: 24
+ font.bold: true
+ y: 30
+ anchors.horizontalCenter: Page.horizontalCenter
+ states: [
+ State {
+ name: "down"
+ when: MouseRegion.pressed == true
+ SetProperty {
+ target: HelloText
+ property: "y"
+ value: 160
+ }
+ SetProperty {
+ target: HelloText
+ property: "color"
+ value: "red"
+ }
+ }
+ ]
+ transitions: [
+ Transition {
+ fromState: "*"
+ toState: "down"
+ reversible: true
+ ParallelAnimation {
+ NumericAnimation {
+ properties: "y"
+ duration: 500
+ easing: "easeOutBounce"
+ }
+ ColorAnimation {
+ duration: 500
+ }
+ }
+ }
+ ]
+ }
+ MouseRegion {
+ id: MouseRegion
+ anchors.fill: HelloText
+ }
+ GridLayout {
+ id: ColorPicker
+ x: 0
+ anchors.bottom: Page.bottom
+ width: 120
+ height: 50
+ columns: 3
+ rows: 2
+ Cell {
+ color: "#ff0000"
+ }
+ Cell {
+ color: "#00ff00"
+ }
+ Cell {
+ color: "#0000ff"
+ }
+ Cell {
+ color: "#ffff00"
+ }
+ Cell {
+ color: "#00ffff"
+ }
+ Cell {
+ color: "#ff00ff"
+ }
+ }
+}
diff --git a/examples/graphicsview/elasticnodes/edge.cpp b/examples/graphicsview/elasticnodes/edge.cpp
index e32a35a..eb02143 100644
--- a/examples/graphicsview/elasticnodes/edge.cpp
+++ b/examples/graphicsview/elasticnodes/edge.cpp
@@ -96,7 +96,7 @@ void Edge::adjust()
prepareGeometryChange();
- if (!qFuzzyCompare(length, qreal(0.0))) {
+ if (length > qreal(20.)) {
QPointF edgeOffset((line.dx() * 10) / length, (line.dy() * 10) / length);
sourcePoint = line.p1() + edgeOffset;
destPoint = line.p2() - edgeOffset;
@@ -124,12 +124,15 @@ void Edge::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
if (!source || !dest)
return;
- // Draw the line itself
QLineF line(sourcePoint, destPoint);
+ if (qFuzzyCompare(line.length(), qreal(0.)))
+ return;
+
+ // Draw the line itself
painter->setPen(QPen(Qt::black, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
painter->drawLine(line);
- // Draw the arrows if there's enough room
+ // Draw the arrows
double angle = ::acos(line.dx() / line.length());
if (line.dy() >= 0)
angle = TwoPi - angle;
diff --git a/examples/itemviews/chart/pieview.cpp b/examples/itemviews/chart/pieview.cpp
index 6b62f25..48f4073 100644
--- a/examples/itemviews/chart/pieview.cpp
+++ b/examples/itemviews/chart/pieview.cpp
@@ -254,7 +254,7 @@ void PieView::mousePressEvent(QMouseEvent *event)
QAbstractItemView::mousePressEvent(event);
origin = event->pos();
if (!rubberBand)
- rubberBand = new QRubberBand(QRubberBand::Rectangle, this);
+ rubberBand = new QRubberBand(QRubberBand::Rectangle, viewport());
rubberBand->setGeometry(QRect(origin, QSize()));
rubberBand->show();
}
diff --git a/examples/network/googlesuggest/googlesuggest.cpp b/examples/network/googlesuggest/googlesuggest.cpp
new file mode 100644
index 0000000..285a018
--- /dev/null
+++ b/examples/network/googlesuggest/googlesuggest.cpp
@@ -0,0 +1,223 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore>
+#include <QtGui>
+#include <QtNetwork>
+
+#include "googlesuggest.h"
+
+#define GSUGGEST_URL "http://google.com/complete/search?output=toolbar&q=%1"
+
+GSuggestCompletion::GSuggestCompletion(QLineEdit *parent): QObject(parent), editor(parent)
+{
+ popup = new QTreeWidget;
+ popup->setColumnCount(2);
+ popup->setUniformRowHeights(true);
+ popup->setRootIsDecorated(false);
+ popup->setEditTriggers(QTreeWidget::NoEditTriggers);
+ popup->setSelectionBehavior(QTreeWidget::SelectRows);
+ popup->setFrameStyle(QFrame::Box | QFrame::Plain);
+ popup->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+
+ popup->header()->hide();
+ popup->installEventFilter(this);
+ popup->setMouseTracking(true);
+
+ connect(popup, SIGNAL(itemClicked(QTreeWidgetItem*, int)),
+ SLOT(doneCompletion()));
+
+ popup->setWindowFlags(Qt::Popup);
+ popup->setFocusPolicy(Qt::NoFocus);
+ popup->setFocusProxy(parent);
+
+ timer = new QTimer(this);
+ timer->setSingleShot(true);
+ timer->setInterval(500);
+ connect(timer, SIGNAL(timeout()), SLOT(autoSuggest()));
+ connect(editor, SIGNAL(textEdited(QString)), timer, SLOT(start()));
+
+ connect(&networkManager, SIGNAL(finished(QNetworkReply*)),
+ this, SLOT(handleNetworkData(QNetworkReply*)));
+
+}
+
+GSuggestCompletion::~GSuggestCompletion()
+{
+ delete popup;
+}
+
+bool GSuggestCompletion::eventFilter(QObject *obj, QEvent *ev)
+{
+ if (obj != popup)
+ return false;
+
+ if (ev->type() == QEvent::MouseButtonPress) {
+ popup->hide();
+ editor->setFocus();
+ return true;
+ }
+
+ if (ev->type() == QEvent::KeyPress) {
+
+ bool consumed = false;
+ int key = static_cast<QKeyEvent*>(ev)->key();
+ switch (key) {
+ case Qt::Key_Enter:
+ case Qt::Key_Return:
+ doneCompletion();
+ consumed = true;
+
+ case Qt::Key_Escape:
+ editor->setFocus();
+ popup->hide();
+ consumed = true;
+
+ case Qt::Key_Up:
+ case Qt::Key_Down:
+ case Qt::Key_Home:
+ case Qt::Key_End:
+ case Qt::Key_PageUp:
+ case Qt::Key_PageDown:
+ break;
+
+ default:
+ editor->setFocus();
+ editor->event(ev);
+ popup->hide();
+ break;
+ }
+
+ return consumed;
+ }
+
+ return false;
+}
+
+void GSuggestCompletion::showCompletion(const QStringList &choices, const QStringList &hits)
+{
+
+ if (choices.isEmpty() || choices.count() != hits.count())
+ return;
+
+ const QPalette &pal = editor->palette();
+ QColor color = pal.color(QPalette::Disabled, QPalette::WindowText);
+
+ popup->setUpdatesEnabled(false);
+ popup->clear();
+ for (int i = 0; i < choices.count(); ++i) {
+ QTreeWidgetItem * item;
+ item = new QTreeWidgetItem(popup);
+ item->setText(0, choices[i]);
+ item->setText(1, hits[i]);
+ item->setTextAlignment(1, Qt::AlignRight);
+ item->setTextColor(1, color);
+ }
+ popup->setCurrentItem(popup->topLevelItem(0));
+ popup->resizeColumnToContents(0);
+ popup->resizeColumnToContents(1);
+ popup->adjustSize();
+ popup->setUpdatesEnabled(true);
+
+ int h = popup->sizeHintForRow(0) * qMin(7, choices.count()) + 3;
+ popup->resize(popup->width(), h);
+
+ popup->move(editor->mapToGlobal(QPoint(0, editor->height())));
+ popup->setFocus();
+ popup->show();
+}
+
+void GSuggestCompletion::doneCompletion()
+{
+ timer->stop();
+ popup->hide();
+ editor->setFocus();
+ QTreeWidgetItem *item = popup->currentItem();
+ if (item) {
+ editor->setText(item->text(0));
+ QKeyEvent *e;
+ e = new QKeyEvent(QEvent::KeyPress, Qt::Key_Enter, Qt::NoModifier);
+ QApplication::postEvent(editor, e);
+ e = new QKeyEvent(QEvent::KeyRelease, Qt::Key_Enter, Qt::NoModifier);
+ QApplication::postEvent(editor, e);
+ }
+}
+
+void GSuggestCompletion::preventSuggest()
+{
+ timer->stop();
+}
+
+void GSuggestCompletion::autoSuggest()
+{
+ QString str = editor->text();
+ QString url = QString(GSUGGEST_URL).arg(str);
+ networkManager.get(QNetworkRequest(QString(url)));
+}
+
+void GSuggestCompletion::handleNetworkData(QNetworkReply *networkReply)
+{
+ QUrl url = networkReply->url();
+ if (!networkReply->error()) {
+ QStringList choices;
+ QStringList hits;
+
+ QString response(networkReply->readAll());
+ QXmlStreamReader xml(response);
+ while (!xml.atEnd()) {
+ xml.readNext();
+ if (xml.tokenType() == QXmlStreamReader::StartElement)
+ if (xml.name() == "suggestion") {
+ QStringRef str = xml.attributes().value("data");
+ choices << str.toString();
+ }
+ if (xml.tokenType() == QXmlStreamReader::StartElement)
+ if (xml.name() == "num_queries") {
+ QStringRef str = xml.attributes().value("int");
+ hits << str.toString();
+ }
+ }
+
+ showCompletion(choices, hits);
+ }
+
+ networkReply->deleteLater();
+}
diff --git a/src/gui/painting/qwindowsurface_d3d_p.h b/examples/network/googlesuggest/googlesuggest.h
index 9cdfe29..0267709 100644
--- a/src/gui/painting/qwindowsurface_d3d_p.h
+++ b/examples/network/googlesuggest/googlesuggest.h
@@ -3,7 +3,7 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
@@ -39,46 +39,42 @@
**
****************************************************************************/
-#ifndef QWINDOWSURFACE_D3D_P_H
-#define QWINDOWSURFACE_D3D_P_H
+#ifndef GOOGLESUGGEST_H
+#define GOOGLESUGGEST_H
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qglobal.h>
-#include "private/qwindowsurface_p.h"
+#include <QObject>
+#include <QNetworkAccessManager>
QT_BEGIN_NAMESPACE
+class QLineEdit;
+class QNetworkReply;
+class QTimer;
+class QTreeWidget;
+QT_END_NAMESPACE
-class QPaintDevice;
-class QPoint;
-class QRegion;
-class QWidget;
-struct QD3DWindowSurfacePrivate;
-
-class QD3DWindowSurface : public QWindowSurface
+class GSuggestCompletion : public QObject
{
+ Q_OBJECT
+
public:
- QD3DWindowSurface(QWidget *widget);
- ~QD3DWindowSurface();
+ GSuggestCompletion(QLineEdit *parent = 0);
+ ~GSuggestCompletion();
+ bool eventFilter(QObject *obj, QEvent *ev);
+ void showCompletion(const QStringList &choices, const QStringList &hits);
+
+public slots:
- QPaintDevice *paintDevice();
- void flush(QWidget *widget, const QRegion &region, const QPoint &offset);
- void setGeometry(const QRect &rect);
- bool scroll(const QRegion &area, int dx, int dy);
+ void doneCompletion();
+ void preventSuggest();
+ void autoSuggest();
+ void handleNetworkData(QNetworkReply *networkReply);
private:
- QD3DWindowSurfacePrivate *d_ptr;
+ QLineEdit *editor;
+ QTreeWidget *popup;
+ QTimer *timer;
+ QNetworkAccessManager networkManager;
};
-QT_END_NAMESPACE
+#endif // GOOGLESUGGEST_H
-#endif // QWINDOWSURFACE_D3D_P_H
diff --git a/examples/network/googlesuggest/googlesuggest.pro b/examples/network/googlesuggest/googlesuggest.pro
new file mode 100644
index 0000000..afd600f
--- /dev/null
+++ b/examples/network/googlesuggest/googlesuggest.pro
@@ -0,0 +1,9 @@
+QT += network
+SOURCES = main.cpp searchbox.cpp googlesuggest.cpp
+HEADERS = searchbox.h googlesuggest.h
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/webkit/googlesuggest
+sources.files = $$SOURCES $$HEADERS *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/webkit/googlesuggest
+INSTALLS += target sources
diff --git a/doc/src/snippets/webkit/simple/main.cpp b/examples/network/googlesuggest/main.cpp
index a6a4fc2..f8d9bc5 100644
--- a/doc/src/snippets/webkit/simple/main.cpp
+++ b/examples/network/googlesuggest/main.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the documentation of the Qt Toolkit.
+** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
@@ -40,17 +40,13 @@
****************************************************************************/
#include <QApplication>
-#include <QUrl>
-#include <QWebView>
-int main(int argc, char *argv[])
+#include "searchbox.h"
+
+int main(int argc, char * argv[])
{
QApplication app(argc, argv);
- QWidget *parent = 0;
-//! [Using QWebView]
- QWebView *view = new QWebView(parent);
- view->load(QUrl("http://qtsoftware.com/"));
- view->show();
-//! [Using QWebView]
+ SearchBox *searchEdit = new SearchBox;
+ searchEdit->show();
return app.exec();
}
diff --git a/examples/network/googlesuggest/searchbox.cpp b/examples/network/googlesuggest/searchbox.cpp
new file mode 100644
index 0000000..cd7b122
--- /dev/null
+++ b/examples/network/googlesuggest/searchbox.cpp
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QDesktopServices>
+#include <QUrl>
+
+#include "searchbox.h"
+#include "googlesuggest.h"
+
+#define GSEARCH_URL "http://www.google.com/search?q=%1"
+
+
+SearchBox::SearchBox(QWidget *parent): QLineEdit(parent)
+{
+ completer = new GSuggestCompletion(this);
+
+ connect(this, SIGNAL(returnPressed()), SLOT(doSearch()));
+
+ setWindowTitle("Search with Google");
+
+ adjustSize();
+ resize(400, height());
+ setFocus();
+}
+
+void SearchBox::doSearch()
+{
+ completer->preventSuggest();
+ QString url = QString(GSEARCH_URL).arg(text());
+ QDesktopServices::openUrl(QUrl(url));
+}
diff --git a/examples/network/googlesuggest/searchbox.h b/examples/network/googlesuggest/searchbox.h
new file mode 100644
index 0000000..75ceffd
--- /dev/null
+++ b/examples/network/googlesuggest/searchbox.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef SEARCHBOX_H
+#define SEARCHBOX_H
+
+#include <QLineEdit>
+
+class GSuggestCompletion;
+
+class SearchBox: public QLineEdit
+{
+ Q_OBJECT
+
+public:
+ SearchBox(QWidget *parent = 0);
+
+protected slots:
+ void doSearch();
+
+private:
+ GSuggestCompletion *completer;
+};
+
+
+#endif // SEARCHBOX_H
diff --git a/examples/network/network.pro b/examples/network/network.pro
index 13b3116..8c45745 100644
--- a/examples/network/network.pro
+++ b/examples/network/network.pro
@@ -11,6 +11,7 @@ SUBDIRS = blockingfortuneclient \
http \
loopback \
threadedfortuneserver \
+ googlesuggest \
torrent
contains(QT_CONFIG, openssl):SUBDIRS += securesocketclient
diff --git a/examples/webkit/fancybrowser/fancybrowser.pro b/examples/webkit/fancybrowser/fancybrowser.pro
new file mode 100644
index 0000000..3de3036
--- /dev/null
+++ b/examples/webkit/fancybrowser/fancybrowser.pro
@@ -0,0 +1,11 @@
+QT += webkit
+HEADERS = mainwindow.h
+SOURCES = main.cpp \
+ mainwindow.cpp
+RESOURCES = jquery.qrc
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/webkit/fancybrowser
+sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/webkit/fancybrowser
+INSTALLS += target sources
diff --git a/examples/webkit/fancybrowser/jquery.min.js b/examples/webkit/fancybrowser/jquery.min.js
new file mode 100644
index 0000000..b1ae21d
--- /dev/null
+++ b/examples/webkit/fancybrowser/jquery.min.js
@@ -0,0 +1,19 @@
+/*
+ * jQuery JavaScript Library v1.3.2
+ * http://jquery.com/
+ *
+ * Copyright (c) 2009 John Resig
+ * Dual licensed under the MIT and GPL licenses.
+ * http://docs.jquery.com/License
+ *
+ * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
+ * Revision: 6246
+ */
+(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}});
+/*
+ * Sizzle CSS Selector Engine - v0.9.3
+ * Copyright 2009, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ * More information: http://sizzlejs.com/
+ */
+(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML=' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); \ No newline at end of file
diff --git a/examples/webkit/fancybrowser/jquery.qrc b/examples/webkit/fancybrowser/jquery.qrc
new file mode 100644
index 0000000..1022d68
--- /dev/null
+++ b/examples/webkit/fancybrowser/jquery.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/" >
+ <file>jquery.min.js</file>
+ </qresource>
+</RCC>
diff --git a/examples/webkit/fancybrowser/main.cpp b/examples/webkit/fancybrowser/main.cpp
new file mode 100644
index 0000000..5936469
--- /dev/null
+++ b/examples/webkit/fancybrowser/main.cpp
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include "mainwindow.h"
+
+int main(int argc, char * argv[])
+{
+ QApplication app(argc, argv);
+ MainWindow *browser = new MainWindow;
+ browser->show();
+ return app.exec();
+}
diff --git a/examples/webkit/fancybrowser/mainwindow.cpp b/examples/webkit/fancybrowser/mainwindow.cpp
new file mode 100644
index 0000000..bf61f9c
--- /dev/null
+++ b/examples/webkit/fancybrowser/mainwindow.cpp
@@ -0,0 +1,167 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include <QtWebKit>
+#include "mainwindow.h"
+
+MainWindow::MainWindow()
+{
+ progress = 0;
+
+ QFile file;
+ file.setFileName(":/jquery.min.js");
+ file.open(QIODevice::ReadOnly);
+ jQuery = file.readAll();
+ file.close();
+
+ view = new QWebView(this);
+ view->load(QUrl("http://www.google.com/ncr"));
+ connect(view, SIGNAL(loadFinished(bool)), SLOT(adjustLocation()));
+ connect(view, SIGNAL(titleChanged(const QString&)), SLOT(adjustTitle()));
+ connect(view, SIGNAL(loadProgress(int)), SLOT(setProgress(int)));
+ connect(view, SIGNAL(loadFinished(bool)), SLOT(finishLoading(bool)));
+
+ locationEdit = new QLineEdit(this);
+ locationEdit->setSizePolicy(QSizePolicy::Expanding, locationEdit->sizePolicy().verticalPolicy());
+ connect(locationEdit, SIGNAL(returnPressed()), SLOT(changeLocation()));
+
+ QToolBar *toolBar = addToolBar(tr("Navigation"));
+ toolBar->addAction(view->pageAction(QWebPage::Back));
+ toolBar->addAction(view->pageAction(QWebPage::Forward));
+ toolBar->addAction(view->pageAction(QWebPage::Reload));
+ toolBar->addAction(view->pageAction(QWebPage::Stop));
+ toolBar->addWidget(locationEdit);
+
+ QMenu *effectMenu = menuBar()->addMenu(tr("&Effect"));
+ effectMenu->addAction("Highlight all links", this, SLOT(highlightAllLinks()));
+
+ QAction *rotateAction = new QAction(this);
+ rotateAction->setIcon(style()->standardIcon(QStyle::SP_FileDialogDetailedView));
+ rotateAction->setCheckable(true);
+ rotateAction->setText(tr("Turn images upside down"));
+ connect(rotateAction, SIGNAL(toggled(bool)), this, SLOT(rotateImages(bool)));
+ effectMenu->addAction(rotateAction);
+
+ QMenu *toolsMenu = menuBar()->addMenu(tr("&Tools"));
+ toolsMenu->addAction(tr("Remove GIF images"), this, SLOT(removeGifImages()));
+ toolsMenu->addAction(tr("Remove all inline frames"), this, SLOT(removeInlineFrames()));
+ toolsMenu->addAction(tr("Remove all object elements"), this, SLOT(removeObjectElements()));
+ toolsMenu->addAction(tr("Remove all embedded elements"), this, SLOT(removeEmbeddedElements()));
+
+ setCentralWidget(view);
+}
+
+void MainWindow::adjustLocation()
+{
+ locationEdit->setText(view->url().toString());
+}
+
+void MainWindow::changeLocation()
+{
+ QUrl url = QUrl(locationEdit->text());
+ locationEdit->setText(url.toString());
+ view->load(url);
+ view->setFocus();
+}
+
+void MainWindow::adjustTitle()
+{
+ if (progress <= 0 || progress >= 100)
+ setWindowTitle(view->title());
+ else
+ setWindowTitle(QString("%1 (%2%)").arg(view->title()).arg(progress));
+}
+
+void MainWindow::setProgress(int p)
+{
+ progress = p;
+ adjustTitle();
+}
+
+void MainWindow::finishLoading(bool)
+{
+ progress = 100;
+ adjustTitle();
+ view->page()->mainFrame()->evaluateJavaScript(jQuery);
+}
+
+void MainWindow::highlightAllLinks()
+{
+ QString code = "$('a').each( function () { $(this).css('background-color', 'yellow') } )";
+ view->page()->mainFrame()->evaluateJavaScript(code);
+}
+
+void MainWindow::rotateImages(bool toggle)
+{
+ QString code = "$('img').each( function () { $(this).css('-webkit-transition', '-webkit-transform 2s') } )";
+ view->page()->mainFrame()->evaluateJavaScript(code);
+ if (toggle)
+ code = "$('img').each( function () { $(this).css('-webkit-transform', 'rotate(180deg)') } )";
+ else
+ code = "$('img').each( function () { $(this).css('-webkit-transform', 'rotate(0deg)') } )";
+ view->page()->mainFrame()->evaluateJavaScript(code);
+}
+
+void MainWindow::removeGifImages()
+{
+ QString code = "$('[src*=gif]').remove()";
+ view->page()->mainFrame()->evaluateJavaScript(code);
+}
+
+void MainWindow::removeInlineFrames()
+{
+ QString code = "$('iframe').remove()";
+ view->page()->mainFrame()->evaluateJavaScript(code);
+}
+
+void MainWindow::removeObjectElements()
+{
+ QString code = "$('object').remove()";
+ view->page()->mainFrame()->evaluateJavaScript(code);
+}
+
+void MainWindow::removeEmbeddedElements()
+{
+ QString code = "$('embed').remove()";
+ view->page()->mainFrame()->evaluateJavaScript(code);
+}
+
diff --git a/examples/webkit/fancybrowser/mainwindow.h b/examples/webkit/fancybrowser/mainwindow.h
new file mode 100644
index 0000000..9362ca7
--- /dev/null
+++ b/examples/webkit/fancybrowser/mainwindow.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QMainWindow>
+
+QT_BEGIN_NAMESPACE
+class QWebView;
+class QLineEdit;
+QT_END_NAMESPACE
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ MainWindow();
+
+protected slots:
+
+ void adjustLocation();
+ void changeLocation();
+ void adjustTitle();
+ void setProgress(int p);
+ void finishLoading(bool);
+
+ void highlightAllLinks();
+ void rotateImages(bool toggle);
+ void removeGifImages();
+ void removeInlineFrames();
+ void removeObjectElements();
+ void removeEmbeddedElements();
+
+private:
+ QString jQuery;
+ QWebView *view;
+ QLineEdit *locationEdit;
+ int progress;
+};
diff --git a/examples/webkit/googlechat/form.ui b/examples/webkit/googlechat/form.ui
new file mode 100644
index 0000000..3b9fb82
--- /dev/null
+++ b/examples/webkit/googlechat/form.ui
@@ -0,0 +1,214 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Form</class>
+ <widget class="QWidget" name="Form">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>286</width>
+ <height>413</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Google Talk Client</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QStackedWidget" name="stackedWidget">
+ <property name="currentIndex">
+ <number>1</number>
+ </property>
+ <widget class="QWidget" name="page_3">
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <spacer name="verticalSpacer_4">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>170</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="statusLabel">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QProgressBar" name="progressBar">
+ <property name="value">
+ <number>24</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_5">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>169</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="page">
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <spacer name="verticalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>119</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="userNameLabel">
+ <property name="text">
+ <string>Google username:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="userNameEdit"/>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>17</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="passwordLabel">
+ <property name="text">
+ <string>Password:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="passwordEdit">
+ <property name="echoMode">
+ <enum>QLineEdit::Password</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>118</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="loginButton">
+ <property name="text">
+ <string>Login</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="page_2">
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QWebView" name="webView">
+ <property name="url">
+ <url>
+ <string>about:blank</string>
+ </url>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>QWebView</class>
+ <extends>QWidget</extends>
+ <header>QtWebKit/QWebView</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/examples/webkit/googlechat/googlechat.cpp b/examples/webkit/googlechat/googlechat.cpp
new file mode 100644
index 0000000..9ac2cd2
--- /dev/null
+++ b/examples/webkit/googlechat/googlechat.cpp
@@ -0,0 +1,163 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include <QtWebKit>
+
+#include "googlechat.h"
+
+#define GOOGLECHAT_URL "http://talkgadget.google.com/talkgadget/m"
+
+GoogleChat::GoogleChat(): QWidget() {
+ form.setupUi(this);
+ setFixedSize(320, 480);
+
+ form.userNameEdit->setFocus();
+ connect(form.userNameEdit, SIGNAL(textChanged(QString)), SLOT(adjustLoginButton()));
+ connect(form.userNameEdit, SIGNAL(returnPressed()), SLOT(inputPassword()));
+
+ connect(form.passwordEdit, SIGNAL(textChanged(QString)), SLOT(adjustLoginButton()));
+ connect(form.passwordEdit, SIGNAL(returnPressed()), SLOT(doLogin()));
+
+ form.loginButton->setEnabled(false);
+ connect(form.loginButton, SIGNAL(clicked()), SLOT(doLogin()));
+
+ connect(form.webView, SIGNAL(loadFinished(bool)), SLOT(initialPage(bool)));
+ connect(form.webView, SIGNAL(loadProgress(int)),
+ form.progressBar, SLOT(setValue(int)));
+ form.webView->setUrl((QUrl(GOOGLECHAT_URL)));
+ form.webView->setContextMenuPolicy(Qt::PreventContextMenu);
+
+ showStatus("Wait...");
+}
+
+void GoogleChat::showStatus(const QString &msg) {
+ form.statusLabel->setText(msg);
+ form.stackedWidget->setCurrentIndex(0);
+}
+
+void GoogleChat::showError(const QString &msg) {
+ form.progressBar->hide();
+ showStatus(QString("Error: %1").arg(msg));
+}
+
+QString GoogleChat::evalJS(const QString &js) {
+ QWebFrame *frame = form.webView->page()->mainFrame();
+ return frame->evaluateJavaScript(js).toString();
+}
+
+void GoogleChat::adjustLoginButton() {
+ userName = form.userNameEdit->text();
+ password = form.passwordEdit->text();
+ bool ok = !userName.isEmpty() && !password.isEmpty();
+ form.loginButton->setEnabled(ok);
+}
+
+void GoogleChat::inputPassword() {
+ if (!form.userNameEdit->text().isEmpty())
+ form.passwordEdit->setFocus();
+}
+
+void GoogleChat::doLogin() {
+ userName = form.userNameEdit->text();
+ password = form.passwordEdit->text();
+ bool ok = !userName.isEmpty() && !password.isEmpty();
+ if (!ok)
+ return;
+
+ form.progressBar->setValue(0);
+ form.progressBar->show();
+ connect(form.webView, SIGNAL(loadFinished(bool)), SLOT(loginPage(bool)));
+ connect(form.webView, SIGNAL(loadProgress(int)),
+ form.progressBar, SLOT(setValue(int)));
+ showStatus("Logging in...");
+
+ QString userEmail = userName + "@gmail.com";
+ evalJS(QString("document.getElementById('Email').value = \"%1\";").arg(userEmail));
+ evalJS(QString("document.getElementById('Passwd').value = \"%1\";").arg(password));
+ evalJS("document.getElementById('gaia_loginform').submit();");
+}
+
+void GoogleChat::initialPage(bool ok) {
+ if (ok) {
+ QString s1 = evalJS("document.getElementById('Email').name");
+ QString s2 = evalJS("document.getElementById('Passwd').name");
+ QString s3 = evalJS("document.getElementById('gaia_loginform').id");
+ if (s1 == "Email" && s2 == "Passwd" && s3 == "gaia_loginform") {
+ form.stackedWidget->setCurrentIndex(1);
+ form.webView->disconnect();
+ return;
+ }
+ }
+
+ showError("SERVICE unavailable.");
+}
+
+void GoogleChat::hideElements()
+{
+ evalJS("var e = document.getElementsByClassName('footer-footer')[0]; e.parentElement.removeChild(e)");
+ evalJS("var e = document.getElementsByClassName('title-bar-bg title-bar')[0]; e.parentElement.removeChild(e)");
+ QTimer::singleShot(2000, this, SLOT(hideElements()));
+}
+
+void GoogleChat::loginPage(bool ok) {
+ QString location = form.webView->url().toString();
+ if (!ok) {
+ if (location.indexOf("CheckCookie"))
+ return;
+ showError("Service unavailable");
+ } else {
+ // check for any error message
+ QString c = evalJS("document.getElementsByClassName('errormsg').length");
+ if (c == "0") {
+ form.stackedWidget->setCurrentIndex(2);
+ QTimer::singleShot(500, this, SLOT(hideElements()));
+ return;
+ }
+
+ QString err = "Unknown login failure.";
+ if (c == "1") {
+ err = evalJS("document.getElementsByClassName('errormsg')[0].textContent");
+ err = err.simplified();
+ }
+ showError(err);
+ }
+}
diff --git a/examples/webkit/googlechat/googlechat.h b/examples/webkit/googlechat/googlechat.h
new file mode 100644
index 0000000..c92632c
--- /dev/null
+++ b/examples/webkit/googlechat/googlechat.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QWidget>
+
+#include "ui_form.h"
+
+class GoogleChat: public QWidget
+{
+ Q_OBJECT
+
+public:
+ GoogleChat();
+
+protected:
+ void showStatus(const QString &msg);
+ void showError(const QString &msg);
+ QString evalJS(const QString &js);
+
+private slots:
+
+ void adjustLoginButton();
+ void inputPassword();
+ void doLogin();
+ void initialPage(bool ok);
+ void loginPage(bool ok);
+ void hideElements();
+
+private:
+ Ui::Form form;
+ QString userName;
+ QString password;
+};
diff --git a/examples/webkit/googlechat/googlechat.pro b/examples/webkit/googlechat/googlechat.pro
new file mode 100644
index 0000000..14b7085
--- /dev/null
+++ b/examples/webkit/googlechat/googlechat.pro
@@ -0,0 +1,11 @@
+QT += webkit
+HEADERS = googlechat.h
+SOURCES = main.cpp \
+ googlechat.cpp
+FORMS = form.ui
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/webkit/googlechat
+sources.files = $$SOURCES $$HEADERS $$FORMS *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/webkit/googlechat
+INSTALLS += target sources
diff --git a/examples/webkit/googlechat/main.cpp b/examples/webkit/googlechat/main.cpp
new file mode 100644
index 0000000..26feeea
--- /dev/null
+++ b/examples/webkit/googlechat/main.cpp
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include "googlechat.h"
+
+int main(int argc, char * argv[])
+{
+ QApplication app(argc, argv);
+ GoogleChat *chat = new GoogleChat;
+ chat->show();
+ return app.exec();
+}
diff --git a/examples/webkit/webkit.pro b/examples/webkit/webkit.pro
index 3777eec..225816a 100644
--- a/examples/webkit/webkit.pro
+++ b/examples/webkit/webkit.pro
@@ -1,6 +1,8 @@
TEMPLATE = subdirs
SUBDIRS += formextractor \
- previewer
+ previewer \
+ fancybrowser \
+ googlechat
# install
target.path = $$[QT_INSTALL_EXAMPLES]/webkit
diff --git a/src/3rdparty/webkit/ChangeLog b/src/3rdparty/webkit/ChangeLog
index ec8242d..76cfc80 100644
--- a/src/3rdparty/webkit/ChangeLog
+++ b/src/3rdparty/webkit/ChangeLog
@@ -1,3 +1,11 @@
+2009-04-24 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Ariya Hidayat.
+
+ Added support for generating API docs in the Qt build using "make docs"
+
+ * WebKit.pro: Include docs.pri for "make docs" target.
+
2008-12-19 Marco Barisione <marco.barisione@collabora.co.uk>
Reviewed by Holger Freyther.
diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog
index fe85bb9..3321570 100644
--- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog
+++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog
@@ -1,3 +1,60 @@
+2009-01-22 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ <rdar://problem/6516853> (r39682-r39736) JSFunFuzz: crash on "(function(){({ x2: x }), })()"
+ <https://bugs.webkit.org/show_bug.cgi?id=23479>
+
+ Automatic semicolon insertion was resulting in this being accepted in the initial
+ nodeless parsing, but subsequent reparsing for code generation would fail, leading
+ to a crash. The solution is to ensure that reparsing a function performs parsing
+ in the same state as the initial parse. We do this by modifying the saved source
+ ranges to include rather than exclude the opening and closing braces.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::reparseForExceptionInfoIfNecessary): add an assertion for successful recompile
+ * parser/Lexer.h:
+ (JSC::Lexer::sourceCode): include rather than exclude braces.
+ * parser/Nodes.h:
+ (JSC::FunctionBodyNode::toSourceString): No need to append braces anymore.
+
+2009-01-21 Alexey Proskuryakov <ap@webkit.org>
+
+ Suggested by Oliver Hunt. Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23456
+ Function argument names leak
+
+ * parser/Nodes.cpp: (JSC::FunctionBodyNode::~FunctionBodyNode): Destruct parameter names.
+
+2009-01-22 Beth Dakin <bdakin@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=23461 LayoutTests/
+ fast/js/numeric-conversion.html is broken, and corresponding
+ <rdar://problem/6514842>
+
+ The basic problem here is that parseInt(Infinity) should be NaN,
+ but we were returning 0. NaN matches Safari 3.2.1 and Firefox.
+
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncParseInt):
+
+2009-01-13 Beth Dakin <bdakin@apple.com>
+
+ Reviewed by Darin Adler and Oliver Hunt.
+
+ <rdar://problem/6489314> REGRESSION: Business widget's front side
+ fails to render correctly when flipping widget
+
+ The problem here is that parseInt was parsing NaN as 0. This patch
+ corrects that by parsing NaN as NaN. This matches our old behavior
+ and Firefox.
+
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncParseInt):
+
2009-02-13 Adam Treat <adam.treat@torchmobile.com>
Reviewed by George Staikos.
diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp
index 91fb1c0..9207c8a 100644
--- a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp
@@ -1397,6 +1397,7 @@ void CodeBlock::reparseForExceptionInfoIfNecessary(CallFrame* callFrame)
case FunctionCode: {
FunctionBodyNode* ownerFunctionBodyNode = static_cast<FunctionBodyNode*>(m_ownerNode);
RefPtr<FunctionBodyNode> newFunctionBody = m_globalData->parser->reparse<FunctionBodyNode>(m_globalData, ownerFunctionBodyNode);
+ ASSERT(newFunctionBody);
newFunctionBody->finishParsing(ownerFunctionBodyNode->copyParameters(), ownerFunctionBodyNode->parameterCount());
CodeBlock& newCodeBlock = newFunctionBody->bytecodeForExceptionInfoReparse(scopeChain);
ASSERT(newCodeBlock.m_exceptionInfo);
diff --git a/src/3rdparty/webkit/JavaScriptCore/parser/Lexer.h b/src/3rdparty/webkit/JavaScriptCore/parser/Lexer.h
index cb553af..afcf09f 100644
--- a/src/3rdparty/webkit/JavaScriptCore/parser/Lexer.h
+++ b/src/3rdparty/webkit/JavaScriptCore/parser/Lexer.h
@@ -88,7 +88,7 @@ namespace JSC {
bool sawError() const { return m_error; }
void clear();
- SourceCode sourceCode(int openBrace, int closeBrace, int firstLine) { return SourceCode(m_source->provider(), openBrace + 1, closeBrace, firstLine); }
+ SourceCode sourceCode(int openBrace, int closeBrace, int firstLine) { return SourceCode(m_source->provider(), openBrace, closeBrace + 1, firstLine); }
private:
friend class JSGlobalData;
diff --git a/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp b/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp
index bdc5d2f..201af28 100644
--- a/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp
@@ -2552,6 +2552,8 @@ FunctionBodyNode::FunctionBodyNode(JSGlobalData* globalData, SourceElements* chi
FunctionBodyNode::~FunctionBodyNode()
{
ASSERT(!m_refCount);
+ for (size_t i = 0; i < m_parameterCount; ++i)
+ m_parameters[i].~Identifier();
fastFree(m_parameters);
}
diff --git a/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.h b/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.h
index f8512f7..20885c3 100644
--- a/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.h
+++ b/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.h
@@ -2205,7 +2205,7 @@ namespace JSC {
void finishParsing(const SourceCode&, ParameterNode*);
void finishParsing(Identifier* parameters, size_t parameterCount);
- UString toSourceString() const JSC_FAST_CALL { return UString("{") + source().toString() + UString("}"); }
+ UString toSourceString() const JSC_FAST_CALL { return source().toString(); }
// These objects are ref/deref'd a lot in the scope chain, so this is a faster ref/deref.
// If the virtual machine changes so this doesn't happen as much we can change back.
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
index f12d2f3..ecdddcf 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
@@ -302,9 +302,11 @@ JSValuePtr globalFuncParseInt(ExecState* exec, JSObject*, JSValuePtr, const ArgL
if (JSImmediate::isImmediate(value))
return value;
double d = value->uncheckedGetNumber();
- if (!isfinite(d))
- return JSImmediate::zeroImmediate();
- return jsNumber(exec, floor(d));
+ if (isfinite(d))
+ return jsNumber(exec, floor(d));
+ if (isnan(d) || isinf(d))
+ return jsNaN(&exec->globalData());
+ return JSImmediate::zeroImmediate();
}
return jsNumber(exec, parseInt(value->toString(exec), radix));
diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION
index bfaefa2..26ce489 100644
--- a/src/3rdparty/webkit/VERSION
+++ b/src/3rdparty/webkit/VERSION
@@ -8,4 +8,4 @@ The commit imported was from the
and has the sha1 checksum
- 450331808bfe11b1472c213a8cb311190355c2de
+ a6ebe3865025e2bb4d767a79435af4daf5a9b4db
diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog
index 9be6e72..00bd427 100644
--- a/src/3rdparty/webkit/WebCore/ChangeLog
+++ b/src/3rdparty/webkit/WebCore/ChangeLog
@@ -1,3 +1,111 @@
+2009-03-13 Adam Bergkvist <adam.bergkvist@ericsson.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24349
+ [QT] HTTP status text is never set
+
+ Set HTTP status text to the reason phrase attribute of QNetworkReply.
+
+ * platform/network/qt/QNetworkReplyHandler.cpp:
+ (WebCore::QNetworkReplyHandler::sendResponseIfNeeded):
+
+2009-03-02 Dirk Schulze <krit@webkit.org>
+
+ Reviewed by Holger Freyther.
+
+ Added putImageData to Qt. Discussed with Ariya Hidayat.
+
+ [Qt] lacks putImageData support in Canvas
+ https://bugs.webkit.org/show_bug.cgi?id=22186
+
+ * platform/graphics/qt/ImageBufferQt.cpp:
+ (WebCore::ImageBuffer::putImageData):
+
+2009-03-01 Larry Ewing <lewing@novell.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24080
+ NPN_GetValue casting to the wrong type and writing outside bounds
+
+ Make sure to cast the value to the correct type so that only
+ memory owned by the value is written to.
+
+ * plugins/gtk/PluginViewGtk.cpp (PluginView::getValueStatic):
+ * plugins/qt/PluginViewQt.cpp (PluginView::getValueStatic):
+ * plugins/mac/PluginViewMac.cpp (PluginView::getValueStatic):
+ (PluginView::getValue):
+
+2009-02-27 Adam Treat <adam.treat@torchmobile.com>
+
+ Reviewed by Eric Seidel.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24229
+ If an image has no alpha channel there is no reason to use SourceOver.
+
+ * platform/graphics/qt/ImageQt.cpp:
+ (WebCore::Image::drawPattern):
+ (WebCore::BitmapImage::draw):
+
+2009-02-27 Zack Rusin <zack@kde.org>
+
+ Reviewed by Nikolas Zimmermann.
+
+ Qt: be more reasonable about scrolled lines
+
+ cMouseWheelPixelsPerLineStep is currently a constant set to 13.3. it doesn't
+ match our metrics meaning that Qt scrolls by ~2 lines by default which is quite
+ irritating. so lets scroll vertically by the Qt set number of lines * Qt default
+ single step scroll
+
+ * platform/qt/WheelEventQt.cpp:
+
+2009-02-25 Dirk Schulze <krit@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Ported arcTo to Qt. Qt has no native support for arcTo. This changes
+ calculate the behavior of arcTo and draws it with lineTo and arc.
+
+ [QT] implement Canvas arcTo
+ https://bugs.webkit.org/show_bug.cgi?id=23873
+
+ * platform/graphics/qt/PathQt.cpp:
+ (WebCore::Path::addArcTo):
+
+2009-03-12 Adam Treat <adam.treat@torchmobile.com>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24498
+ Fix the Qt port to use the same algorithm for drawing dashed and dotted
+ borders as the other ports. This makes the Qt port pixel-for-pixel perfect
+ compared to border drawing with Apple's canonical mac port and much closer
+ to konqueror and firefox behavior.
+
+ * platform/graphics/qt/GraphicsContextQt.cpp:
+ (WebCore::GraphicsContext::drawLine):
+
+2009-03-09 Adam Treat <adam.treat@torchmobile.com>
+
+ Reviewed by George Staikos.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24463
+ WebCore::qstring is detaching and copying twice for every single
+ WebCore::TextRun that is processed and drawn. This elevates this method
+ to one of the top-ten most expensive methods in all of QtWebKit according
+ to profiling. This changes the method so that QString only detaches
+ when absolutely necessary.
+
+ * platform/graphics/qt/FontQt.cpp:
+ (WebCore::qstring):
+ (WebCore::fixSpacing):
+ (WebCore::Font::drawComplexText):
+ (WebCore::Font::floatWidthForComplexText):
+ (WebCore::Font::offsetForPositionForComplexText):
+ (WebCore::Font::selectionRectForComplexText):
+
2009-02-04 Simon Hausmann <simon.hausmann@nokia.com>
Unreviewed Qt build fix.
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontQt.cpp
index deeea99..4e78083 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontQt.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontQt.cpp
@@ -37,20 +37,27 @@
#if QT_VERSION >= 0x040400
namespace WebCore {
-static QString qstring(const TextRun& run)
+static const QString qstring(const TextRun& run)
{
- QString string((QChar *)run.characters(), run.length());
- QChar *uc = string.data();
+ //We don't detach
+ return QString::fromRawData((const QChar *)run.characters(), run.length());
+}
+
+static const QString fixSpacing(const QString &string)
+{
+ //Only detach if we're actually changing something
+ QString possiblyDetached = string;
for (int i = 0; i < string.length(); ++i) {
- if (Font::treatAsSpace(uc[i].unicode()))
- uc[i] = 0x20;
- else if (Font::treatAsZeroWidthSpace(uc[i].unicode()))
- uc[i] = 0x200c;
+ const QChar c = string.at(i);
+ if (c.unicode() != 0x20 && Font::treatAsSpace(c.unicode())) {
+ possiblyDetached[i] = 0x20; //detach
+ } else if (c.unicode() != 0x200c && Font::treatAsZeroWidthSpace(c.unicode())) {
+ possiblyDetached[i] = 0x200c; //detach
+ }
}
- return string;
+ return possiblyDetached;
}
-
static QTextLine setupLayout(QTextLayout* layout, const TextRun& style)
{
int flags = style.rtl() ? Qt::TextForceRightToLeft : Qt::TextForceLeftToRight;
@@ -75,7 +82,7 @@ void Font::drawComplexText(GraphicsContext* ctx, const TextRun& run, const Float
Color color = ctx->fillColor();
p->setPen(QColor(color));
- QString string = qstring(run);
+ const QString string = fixSpacing(qstring(run));
// text shadow
IntSize shadowSize;
@@ -144,7 +151,7 @@ float Font::floatWidthForComplexText(const TextRun& run) const
{
if (!run.length())
return 0;
- QString string = qstring(run);
+ const QString string = fixSpacing(qstring(run));
QTextLayout layout(string, font());
QTextLine line = setupLayout(&layout, run);
int w = int(line.naturalTextWidth());
@@ -157,7 +164,7 @@ float Font::floatWidthForComplexText(const TextRun& run) const
int Font::offsetForPositionForComplexText(const TextRun& run, int position, bool includePartialGlyphs) const
{
- QString string = qstring(run);
+ const QString string = fixSpacing(qstring(run));
QTextLayout layout(string, font());
QTextLine line = setupLayout(&layout, run);
return line.xToCursor(position);
@@ -165,7 +172,7 @@ int Font::offsetForPositionForComplexText(const TextRun& run, int position, bool
FloatRect Font::selectionRectForComplexText(const TextRun& run, const IntPoint& pt, int h, int from, int to) const
{
- QString string = qstring(run);
+ const QString string = fixSpacing(qstring(run));
QTextLayout layout(string, font());
QTextLine line = setupLayout(&layout, run);
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index 936c1ea..6c90ea3 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -470,13 +470,21 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2)
if (paintingDisabled())
return;
+ StrokeStyle style = strokeStyle();
+ Color color = strokeColor();
+ if (style == NoStroke || !color.alpha())
+ return;
+
+ float width = strokeThickness();
+
FloatPoint p1 = point1;
FloatPoint p2 = point2;
+ bool isVerticalLine = (p1.x() == p2.x());
QPainter *p = m_data->p();
const bool antiAlias = p->testRenderHint(QPainter::Antialiasing);
p->setRenderHint(QPainter::Antialiasing, m_data->antiAliasingForRectsAndLines);
- adjustLineToPixelBoundaries(p1, p2, strokeThickness(), strokeStyle());
+ adjustLineToPixelBoundaries(p1, p2, width, style);
IntSize shadowSize;
int shadowBlur;
@@ -489,8 +497,76 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2)
p->restore();
}
+ int patWidth = 0;
+ switch (style) {
+ case NoStroke:
+ case SolidStroke:
+ break;
+ case DottedStroke:
+ patWidth = (int)width;
+ break;
+ case DashedStroke:
+ patWidth = 3 * (int)width;
+ break;
+ }
+
+ if (patWidth) {
+ p->save();
+
+ // Do a rect fill of our endpoints. This ensures we always have the
+ // appearance of being a border. We then draw the actual dotted/dashed line.
+ if (isVerticalLine) {
+ p->fillRect(FloatRect(p1.x() - width / 2, p1.y() - width, width, width), color);
+ p->fillRect(FloatRect(p2.x() - width / 2, p2.y(), width, width), color);
+ } else {
+ p->fillRect(FloatRect(p1.x() - width, p1.y() - width / 2, width, width), color);
+ p->fillRect(FloatRect(p2.x(), p2.y() - width / 2, width, width), color);
+ }
+
+ // Example: 80 pixels with a width of 30 pixels.
+ // Remainder is 20. The maximum pixels of line we could paint
+ // will be 50 pixels.
+ int distance = (isVerticalLine ? (point2.y() - point1.y()) : (point2.x() - point1.x())) - 2*(int)width;
+ int remainder = distance % patWidth;
+ int coverage = distance - remainder;
+ int numSegments = coverage / patWidth;
+
+ float patternOffset = 0.0f;
+ // Special case 1px dotted borders for speed.
+ if (patWidth == 1)
+ patternOffset = 1.0f;
+ else {
+ bool evenNumberOfSegments = numSegments % 2 == 0;
+ if (remainder)
+ evenNumberOfSegments = !evenNumberOfSegments;
+ if (evenNumberOfSegments) {
+ if (remainder) {
+ patternOffset += patWidth - remainder;
+ patternOffset += remainder / 2;
+ } else
+ patternOffset = patWidth / 2;
+ } else {
+ if (remainder)
+ patternOffset = (patWidth - remainder)/2;
+ }
+ }
+
+ QVector<qreal> dashes;
+ dashes << qreal(patWidth) / width << qreal(patWidth) / width;
+
+ QPen pen = p->pen();
+ pen.setWidthF(width);
+ pen.setCapStyle(Qt::FlatCap);
+ pen.setDashPattern(dashes);
+ pen.setDashOffset(patternOffset / width);
+ p->setPen(pen);
+ }
+
p->drawLine(p1, p2);
+ if (patWidth)
+ p->restore();
+
p->setRenderHint(QPainter::Antialiasing, antiAlias);
}
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageBufferQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageBufferQt.cpp
index d1009b5..29a02d4 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageBufferQt.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageBufferQt.cpp
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
* Copyright (C) 2008 Holger Hans Peter Freyther
+ * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -31,7 +32,6 @@
#include "GraphicsContext.h"
#include "ImageData.h"
#include "MIMETypeRegistry.h"
-#include "NotImplemented.h"
#include "StillImageQt.h"
#include <QBuffer>
@@ -111,9 +111,7 @@ PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const
endy = m_size.height();
int numRows = endy - originy;
- QImage image = m_data.m_pixmap.toImage();
- if (image.format() != QImage::Format_ARGB32)
- image = image.convertToFormat(QImage::Format_ARGB32);
+ QImage image = m_data.m_pixmap.toImage().convertToFormat(QImage::Format_ARGB32);
ASSERT(!image.isNull());
unsigned destBytesPerRow = 4 * rect.width();
@@ -134,9 +132,58 @@ PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const
return result;
}
-void ImageBuffer::putImageData(ImageData*, const IntRect&, const IntPoint&)
+void ImageBuffer::putImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint)
{
- notImplemented();
+ ASSERT(sourceRect.width() > 0);
+ ASSERT(sourceRect.height() > 0);
+
+ int originx = sourceRect.x();
+ int destx = destPoint.x() + sourceRect.x();
+ ASSERT(destx >= 0);
+ ASSERT(destx < m_size.width());
+ ASSERT(originx >= 0);
+ ASSERT(originx <= sourceRect.right());
+
+ int endx = destPoint.x() + sourceRect.right();
+ ASSERT(endx <= m_size.width());
+
+ int numColumns = endx - destx;
+
+ int originy = sourceRect.y();
+ int desty = destPoint.y() + sourceRect.y();
+ ASSERT(desty >= 0);
+ ASSERT(desty < m_size.height());
+ ASSERT(originy >= 0);
+ ASSERT(originy <= sourceRect.bottom());
+
+ int endy = destPoint.y() + sourceRect.bottom();
+ ASSERT(endy <= m_size.height());
+ int numRows = endy - desty;
+
+ unsigned srcBytesPerRow = 4 * source->width();
+
+ bool isPainting = m_data.m_painter->isActive();
+ if (isPainting)
+ m_data.m_painter->end();
+
+ QImage image = m_data.m_pixmap.toImage().convertToFormat(QImage::Format_ARGB32);
+ ASSERT(!image.isNull());
+
+ unsigned char* srcRows = source->data()->data() + originy * srcBytesPerRow + originx * 4;
+ for (int y = 0; y < numRows; ++y) {
+ quint32* scanLine = reinterpret_cast<quint32*>(image.scanLine(y + desty));
+ for (int x = 0; x < numColumns; x++) {
+ int basex = x * 4;
+ scanLine[x + destx] = reinterpret_cast<quint32*>(srcRows + basex)[0];
+ }
+
+ srcRows += srcBytesPerRow;
+ }
+
+ m_data.m_pixmap = QPixmap::fromImage(image);
+
+ if (isPainting)
+ m_data.m_painter->begin(&m_data.m_pixmap);
}
// We get a mimeType here but QImageWriter does not support mimetypes but
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageQt.cpp
index be7d1e0..e266c07 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageQt.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageQt.cpp
@@ -109,6 +109,8 @@ void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, const
ctxt->save();
ctxt->setCompositeOperation(op);
QPainter* p = ctxt->platformContext();
+ if (!pixmap.hasAlpha() && p->compositionMode() == QPainter::CompositionMode_SourceOver)
+ p->setCompositionMode(QPainter::CompositionMode_Source);
p->setBrushOrigin(phase);
p->fillRect(destRect, b);
ctxt->restore();
@@ -146,6 +148,9 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst,
QPainter* painter(ctxt->platformContext());
+ if (!image->hasAlpha() && painter->compositionMode() == QPainter::CompositionMode_SourceOver)
+ painter->setCompositionMode(QPainter::CompositionMode_Source);
+
// Test using example site at
// http://www.meyerweb.com/eric/css/edge/complexspiral/demo.html
painter->drawPixmap(dst, *image, src);
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp
index 90b342e..e68be2b 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp
@@ -1,6 +1,7 @@
/*
- * Copyright (C) 2006 Zack Rusin <zack@kde.org>
- * 2006 Rob Buis <buis@kde.org>
+ * Copyright (C) 2006 Zack Rusin <zack@kde.org>
+ * 2006 Rob Buis <buis@kde.org>
+ * 2009 Dirk Schulze <krit@webkit.org>
*
* All rights reserved.
*
@@ -139,9 +140,72 @@ void Path::addBezierCurveTo(const FloatPoint& cp1, const FloatPoint& cp2, const
void Path::addArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius)
{
- //FIXME: busted
- qWarning("arcTo is busted");
- m_path->arcTo(p1.x(), p1.y(), p2.x(), p2.y(), radius, 90);
+ FloatPoint p0(m_path->currentPosition());
+
+ if ((p1.x() == p0.x() && p1.y() == p0.y()) || (p1.x() == p2.x() && p1.y() == p2.y()) || radius == 0.f) {
+ m_path->lineTo(p1);
+ return;
+ }
+
+ FloatPoint p1p0((p0.x() - p1.x()),(p0.y() - p1.y()));
+ FloatPoint p1p2((p2.x() - p1.x()),(p2.y() - p1.y()));
+ float p1p0_length = sqrtf(p1p0.x() * p1p0.x() + p1p0.y() * p1p0.y());
+ float p1p2_length = sqrtf(p1p2.x() * p1p2.x() + p1p2.y() * p1p2.y());
+
+ double cos_phi = (p1p0.x() * p1p2.x() + p1p0.y() * p1p2.y()) / (p1p0_length * p1p2_length);
+ // all points on a line logic
+ if (cos_phi == -1) {
+ m_path->lineTo(p1);
+ return;
+ }
+ if (cos_phi == 1) {
+ // add infinite far away point
+ unsigned int max_length = 65535;
+ double factor_max = max_length / p1p0_length;
+ FloatPoint ep((p0.x() + factor_max * p1p0.x()), (p0.y() + factor_max * p1p0.y()));
+ m_path->lineTo(ep);
+ return;
+ }
+
+ float tangent = radius / tan(acos(cos_phi) / 2);
+ float factor_p1p0 = tangent / p1p0_length;
+ FloatPoint t_p1p0((p1.x() + factor_p1p0 * p1p0.x()), (p1.y() + factor_p1p0 * p1p0.y()));
+
+ FloatPoint orth_p1p0(p1p0.y(), -p1p0.x());
+ float orth_p1p0_length = sqrt(orth_p1p0.x() * orth_p1p0.x() + orth_p1p0.y() * orth_p1p0.y());
+ float factor_ra = radius / orth_p1p0_length;
+
+ // angle between orth_p1p0 and p1p2 to get the right vector orthographic to p1p0
+ double cos_alpha = (orth_p1p0.x() * p1p2.x() + orth_p1p0.y() * p1p2.y()) / (orth_p1p0_length * p1p2_length);
+ if (cos_alpha < 0.f)
+ orth_p1p0 = FloatPoint(-orth_p1p0.x(), -orth_p1p0.y());
+
+ FloatPoint p((t_p1p0.x() + factor_ra * orth_p1p0.x()), (t_p1p0.y() + factor_ra * orth_p1p0.y()));
+
+ // calculate angles for addArc
+ orth_p1p0 = FloatPoint(-orth_p1p0.x(), -orth_p1p0.y());
+ float sa = acos(orth_p1p0.x() / orth_p1p0_length);
+ if (orth_p1p0.y() < 0.f)
+ sa = 2 * piDouble - sa;
+
+ // anticlockwise logic
+ bool anticlockwise = false;
+
+ float factor_p1p2 = tangent / p1p2_length;
+ FloatPoint t_p1p2((p1.x() + factor_p1p2 * p1p2.x()), (p1.y() + factor_p1p2 * p1p2.y()));
+ FloatPoint orth_p1p2((t_p1p2.x() - p.x()),(t_p1p2.y() - p.y()));
+ float orth_p1p2_length = sqrtf(orth_p1p2.x() * orth_p1p2.x() + orth_p1p2.y() * orth_p1p2.y());
+ float ea = acos(orth_p1p2.x() / orth_p1p2_length);
+ if (orth_p1p2.y() < 0)
+ ea = 2 * piDouble - ea;
+ if ((sa > ea) && ((sa - ea) < piDouble))
+ anticlockwise = true;
+ if ((sa < ea) && ((ea - sa) > piDouble))
+ anticlockwise = true;
+
+ m_path->lineTo(t_p1p0);
+
+ addArc(p, radius, sa, ea, anticlockwise);
}
void Path::closeSubpath()
diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
index 2de2125..2c730a6 100644
--- a/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
@@ -269,8 +269,10 @@ void QNetworkReplyHandler::sendResponseIfNeeded()
const bool isLocalFileReply = (m_reply->url().scheme() == QLatin1String("file"));
int statusCode = m_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
- if (!isLocalFileReply)
+ if (!isLocalFileReply) {
response.setHTTPStatusCode(statusCode);
+ response.setHTTPStatusText(m_reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray().constData());
+ }
else if (m_reply->error() == QNetworkReply::ContentNotFoundError)
response.setHTTPStatusCode(404);
diff --git a/src/3rdparty/webkit/WebCore/platform/qt/WheelEventQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/WheelEventQt.cpp
index cc8acd2..b25ae7a 100644
--- a/src/3rdparty/webkit/WebCore/platform/qt/WheelEventQt.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/qt/WheelEventQt.cpp
@@ -21,7 +21,9 @@
#include "PlatformWheelEvent.h"
#include "PlatformMouseEvent.h"
+#include "Scrollbar.h"
+#include <qapplication.h>
#include <QWheelEvent>
namespace WebCore {
@@ -54,9 +56,14 @@ PlatformWheelEvent::PlatformWheelEvent(QWheelEvent* e)
m_deltaY = (e->delta() / 120);
}
- // FIXME: retrieve the user setting for the number of lines to scroll on each wheel event
- m_deltaX *= horizontalLineMultiplier();
- m_deltaY *= verticalLineMultiplier();
+ m_deltaX *= QApplication::wheelScrollLines();
+ // use the same single scroll step as QTextEdit (in
+ // QTextEditPrivate::init [h,v]bar->setSingleStep )
+ // and divide by the default WebKit scroll step to
+ // get the Qt mouse wheel scroll behavior
+ static const float cDefaultQtScrollStep = 20.f;
+ m_deltaY *= QApplication::wheelScrollLines() *
+ (cDefaultQtScrollStep / cMouseWheelPixelsPerLineStep);
}
#endif // QT_NO_WHEELEVENT
diff --git a/src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.cpp b/src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.cpp
index 1d7d570..3229922 100644
--- a/src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.cpp
+++ b/src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.cpp
@@ -220,11 +220,11 @@ NPError PluginView::getValueStatic(NPNVariable variable, void* value)
switch (variable) {
case NPNVToolkit:
- *((uint32 *)value) = 0;
+ *static_cast<uint32*>(value) = 0;
return NPERR_NO_ERROR;
case NPNVjavascriptEnabledBool:
- *((uint32 *)value) = true;
+ *static_cast<NPBool*>(value) = true;
return NPERR_NO_ERROR;
default:
@@ -275,7 +275,7 @@ NPError PluginView::getValue(NPNVariable variable, void* value)
}
case NPNVsupportsCoreGraphicsBool:
- *((uint32 *)value) = true;
+ *static_cast<NPBool*>(value) = true;
return NPERR_NO_ERROR;
default:
diff --git a/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp b/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp
index 5aa8933..c8dd0e5 100644
--- a/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp
+++ b/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp
@@ -301,15 +301,15 @@ NPError PluginView::getValueStatic(NPNVariable variable, void* value)
{
switch (variable) {
case NPNVToolkit:
- *((uint32 *)value) = 0;
+ *static_cast<uint32*>(value) = 0;
return NPERR_NO_ERROR;
case NPNVSupportsXEmbedBool:
- *((uint32 *)value) = true;
+ *static_cast<NPBool*>(value) = true;
return NPERR_NO_ERROR;
case NPNVjavascriptEnabledBool:
- *((uint32 *)value) = true;
+ *static_cast<NPBool*>(value) = true;
return NPERR_NO_ERROR;
default:
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
index e17306d..01b68eb 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
@@ -1095,7 +1095,7 @@ QVariant QWebPage::inputMethodQuery(Qt::InputMethodQuery property) const
This enum describes the types of action which can be performed on the web page.
Actions only have an effect when they are applicable. The availability of
- actions can be be determined by checking \l{QAction::}{enabled()} on the
+ actions can be be determined by checking \l{QAction::}{isEnabled()} on the
action returned by \l{QWebPage::}{action()}.
One method of enabling the text editing, cursor movement, and text selection actions
@@ -1198,18 +1198,18 @@ QVariant QWebPage::inputMethodQuery(Qt::InputMethodQuery property) const
Suppose we have a \c Thumbnail class as follows:
- \snippet doc/src/snippets/webkit/webpage/main.cpp 0
+ \snippet webkitsnippets/webpage/main.cpp 0
The \c Thumbnail's constructor takes in a \a url. We connect our QWebPage
object's \l{QWebPage::}{loadFinished()} signal to our private slot,
\c render().
- \snippet doc/src/snippets/webkit/webpage/main.cpp 1
+ \snippet webkitsnippets/webpage/main.cpp 1
The \c render() function shows how we can paint a thumbnail using a
QWebPage object.
- \snippet doc/src/snippets/webkit/webpage/main.cpp 2
+ \snippet webkitsnippets/webpage/main.cpp 2
We begin by setting the \l{QWebPage::viewportSize()}{viewportSize} and
then we instantiate a QImage object, \c image, with the same size as our
@@ -1450,9 +1450,16 @@ void QWebPage::triggerAction(WebAction action, bool checked)
openNewWindow(url, frame);
break;
}
- case CopyLinkToClipboard:
+ case CopyLinkToClipboard: {
+#if defined(Q_WS_X11)
+ bool oldSelectionMode = Pasteboard::generalPasteboard()->isSelectionMode();
+ Pasteboard::generalPasteboard()->setSelectionMode(true);
+ editor->copyURL(d->hitTestResult.linkUrl(), d->hitTestResult.linkText());
+ Pasteboard::generalPasteboard()->setSelectionMode(oldSelectionMode);
+#endif
editor->copyURL(d->hitTestResult.linkUrl(), d->hitTestResult.linkText());
break;
+ }
case OpenImageInNewWindow:
openNewWindow(d->hitTestResult.imageUrl(), frame);
break;
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp
index a843eba..9753f4f 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp
@@ -86,7 +86,7 @@ public:
Qt Widgets, the show() function must be invoked in order to display
QWebView. The snippet below illustrates this:
- \snippet doc/src/snippets/webkit/simple/main.cpp Using QWebView
+ \snippet webkitsnippets/simple/main.cpp Using QWebView
Alternatively, setUrl() can also be used to load a web site. If you have
the HTML content readily available, you can use setHtml() instead.
@@ -325,7 +325,7 @@ void QWebView::setContent(const QByteArray &data, const QString &mimeType, const
It is equivalent to
- \snippet doc/src/snippets/code/src_3rdparty_webkit_WebKit_qt_Api_qwebview.cpp 0
+ \snippet webkitsnippets/qtwebkit_qwebview_snippet.cpp 0
*/
QWebHistory *QWebView::history() const
{
@@ -337,7 +337,7 @@ QWebHistory *QWebView::history() const
It is equivalent to
- \snippet doc/src/snippets/code/src_3rdparty_webkit_WebKit_qt_Api_qwebview.cpp 1
+ \snippet webkitsnippets/qtwebkit_qwebview_snippet.cpp 1
\sa QWebSettings::globalSettings()
*/
@@ -429,7 +429,7 @@ QAction *QWebView::pageAction(QWebPage::WebAction action) const
The following example triggers the copy action and therefore copies any
selected text to the clipboard.
- \snippet doc/src/snippets/code/src_3rdparty_webkit_WebKit_qt_Api_qwebview.cpp 2
+ \snippet webkitsnippets/qtwebkit_qwebview_snippet.cpp 2
\sa pageAction()
*/
@@ -606,7 +606,7 @@ void QWebView::print(QPrinter *printer) const
It is equivalent to
- \snippet doc/src/snippets/code/src_3rdparty_webkit_WebKit_qt_Api_qwebview.cpp 3
+ \snippet webkitsnippets/qtwebkit_qwebview_snippet.cpp 3
\sa reload(), pageAction(), loadFinished()
*/
@@ -622,7 +622,7 @@ void QWebView::stop()
It is equivalent to
- \snippet doc/src/snippets/code/src_3rdparty_webkit_WebKit_qt_Api_qwebview.cpp 4
+ \snippet webkitsnippets/qtwebkit_qwebview_snippet.cpp 4
\sa forward(), pageAction()
*/
@@ -638,7 +638,7 @@ void QWebView::back()
It is equivalent to
- \snippet doc/src/snippets/code/src_3rdparty_webkit_WebKit_qt_Api_qwebview.cpp 5
+ \snippet webkitsnippets/qtwebkit_qwebview_snippet.cpp 5
\sa back(), pageAction()
*/
diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog
index 5a23200..c3bd633 100644
--- a/src/3rdparty/webkit/WebKit/qt/ChangeLog
+++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog
@@ -1,3 +1,42 @@
+2009-04-24 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Rubber-stamped by Ariya Hidayat.
+
+ Fix qdoc warning about link to QAction::isEnabled.
+
+ * Api/qwebpage.cpp:
+
+2009-04-24 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Ariya Hidayat.
+
+ Added support for generating API docs in the Qt build using "make docs"
+
+ Added code snippets and overview from the Qt sources references in the API docs.
+
+ * Api/qwebpage.cpp: Adjust paths to snippets.
+ * Api/qwebview.cpp: Ditto.
+ * docs/docs.pri: Added.
+ * docs/qtwebkit.qdoc: Added.
+ * docs/qtwebkit.qdocconf: Added.
+ * docs/webkitsnippets/qtwebkit_build_snippet.qdoc: Added.
+ * docs/webkitsnippets/qtwebkit_qwebview_snippet.cpp: Added.
+ * docs/webkitsnippets/simple/main.cpp: Added.
+ * docs/webkitsnippets/simple/simple.pro: Added.
+ * docs/webkitsnippets/webpage/main.cpp: Added.
+ * docs/webkitsnippets/webpage/webpage.pro: Added.
+
+2009-03-02 Benjamin C Meyer <benjamin.meyer@torchmobile.com>
+
+ Reviewed by George Staikos.
+
+ https://bugs.webkit.org/show_bug.cgi?id=21230
+ On X11 match the behavior of Firefox and also copy the url to the
+ clipboard selection when the action Copy Link Location is executed.
+
+ * Api/qwebpage.cpp:
+ (QWebPage::triggerAction):
+
2009-03-07 Adam Treat <adam.treat@torchmobile.com>
Reviewed by Cameron Zwarich.
diff --git a/src/3rdparty/webkit/WebKit/qt/docs/docs.pri b/src/3rdparty/webkit/WebKit/qt/docs/docs.pri
new file mode 100644
index 0000000..4a8c165
--- /dev/null
+++ b/src/3rdparty/webkit/WebKit/qt/docs/docs.pri
@@ -0,0 +1,15 @@
+include(../../../WebKit.pri)
+
+unix {
+ QDOC = SRCDIR=$$PWD/../../.. OUTPUT_DIR=$$OUTPUT_DIR $$(QTDIR)/tools/qdoc3/qdoc3
+} else {
+ QDOC = $$(QTDIR)\tools\qdoc3\release\qdoc3.exe
+}
+
+unix {
+docs.commands = $$QDOC $$PWD/qtwebkit.qdocconf
+} else {
+docs.commands = \"$$QDOC $$PWD/qtwebkit.qdocconf\"
+}
+
+QMAKE_EXTRA_TARGETS += docs
diff --git a/doc/src/qtwebkit.qdoc b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc
index 0092950..06305e0 100644
--- a/doc/src/qtwebkit.qdoc
+++ b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc
@@ -59,7 +59,7 @@
project file ensures that an application is compiled and linked
appropriately:
- \snippet doc/src/snippets/code/doc_src_qtwebkit.qdoc 0
+ \snippet webkitsnippets/qtwebkit_build_snippet.qdoc 0
This line is necessary because only the QtCore and QtGui modules are used
in the default build process.
@@ -67,7 +67,7 @@
To include the definitions of the module's classes, use the following
directive:
- \snippet doc/src/snippets/code/doc_src_qtwebkit.qdoc 1
+ \snippet webkitsnippets/qtwebkit_build_snippet.qdoc 1
\section1 Architecture
@@ -75,7 +75,7 @@
widget it can be embedded into your forms or a graphics view, and it
provides convenience functions for downloading and rendering web sites.
- \snippet snippets/webkit/simple/main.cpp Using QWebView
+ \snippet webkitsnippets/simple/main.cpp Using QWebView
QWebView acts as a view onto Web pages, each of which is represented by an
instance of the QWebPage class. QWebPage provides access to the document
diff --git a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdocconf b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdocconf
new file mode 100644
index 0000000..e60e586
--- /dev/null
+++ b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdocconf
@@ -0,0 +1,195 @@
+# Run qdoc from the directory that contains this file.
+
+project = qtwebkit
+description = "Qt WebKit API Documentation"
+
+headerdirs = $SRCDIR/WebKit/qt/Api
+sourcedirs = $SRCDIR/WebKit/qt/Api $SRCDIR/WebKit/qt/docs
+outputdir = $OUTPUT_DIR/doc/html
+outputformats = HTML
+sources.fileextensions = "*.cpp *.doc *.qdoc *.h"
+exampledirs = $SRCDIR/WebKit/qt/docs
+
+indexes = $QTDIR/doc/html/qt.index
+
+# macros.qdocconf
+
+macro.aring.HTML = "&aring;"
+macro.Auml.HTML = "&Auml;"
+macro.author = "\\bold{Author:}"
+macro.br.HTML = "<br />"
+macro.BR.HTML = "<br />"
+macro.aacute.HTML = "&aacute;"
+macro.eacute.HTML = "&eacute;"
+macro.iacute.HTML = "&iacute;"
+macro.gui = "\\bold"
+macro.hr.HTML = "<hr />"
+macro.key = "\\bold"
+macro.menu = "\\bold"
+macro.note = "\\bold{Note:}"
+macro.oslash.HTML = "&oslash;"
+macro.ouml.HTML = "&ouml;"
+macro.QA = "\\e{Qt Assistant}"
+macro.QD = "\\e{Qt Designer}"
+macro.QL = "\\e{Qt Linguist}"
+macro.param = "\\e"
+macro.raisedaster.HTML = "<sup>*</sup>"
+macro.reg.HTML = "<sup>&reg;</sup>"
+macro.return = "Returns"
+macro.starslash = "\\c{*/}"
+macro.uuml.HTML = "&uuml;"
+macro.mdash.HTML = "&mdash;"
+
+# compat.qdocconf
+
+alias.i = e
+alias.include = input
+
+macro.0 = "\\\\0"
+macro.b = "\\\\b"
+macro.n = "\\\\n"
+macro.r = "\\\\r"
+macro.i = "\\o"
+macro.i11 = "\\o{1,1}"
+macro.i12 = "\\o{1,2}"
+macro.i13 = "\\o{1,3}"
+macro.i14 = "\\o{1,4}"
+macro.i15 = "\\o{1,5}"
+macro.i16 = "\\o{1,6}"
+macro.i17 = "\\o{1,7}"
+macro.i18 = "\\o{1,8}"
+macro.i19 = "\\o{1,9}"
+macro.i21 = "\\o{2,1}"
+macro.i31 = "\\o{3,1}"
+macro.i41 = "\\o{4,1}"
+macro.i51 = "\\o{5,1}"
+macro.i61 = "\\o{6,1}"
+macro.i71 = "\\o{7,1}"
+macro.i81 = "\\o{8,1}"
+macro.i91 = "\\o{9,1}"
+macro.img = "\\image"
+macro.endquote = "\\endquotation"
+
+spurious = "Missing comma in .*" \
+ "Missing pattern .*"
+
+# Doxygen compatibility commands
+
+macro.see = "\\sa"
+macro.function = "\\fn"
+
+# qt-cpp-ignore.qdocconf
+
+Cpp.ignoretokens = QAXFACTORY_EXPORT \
+ QDESIGNER_COMPONENTS_LIBRARY \
+ QDESIGNER_EXTENSION_LIBRARY \
+ QDESIGNER_SDK_LIBRARY \
+ QDESIGNER_SHARED_LIBRARY \
+ QDESIGNER_UILIB_LIBRARY \
+ QM_EXPORT_CANVAS \
+ QM_EXPORT_DNS \
+ QM_EXPORT_DOM \
+ QM_EXPORT_FTP \
+ QM_EXPORT_HTTP \
+ QM_EXPORT_ICONVIEW \
+ QM_EXPORT_NETWORK \
+ QM_EXPORT_OPENGL \
+ QM_EXPORT_SQL \
+ QM_EXPORT_TABLE \
+ QM_EXPORT_WORKSPACE \
+ QM_EXPORT_XML \
+ QT_ASCII_CAST_WARN \
+ QT_ASCII_CAST_WARN_CONSTRUCTOR \
+ QT_BEGIN_HEADER \
+ QT_DESIGNER_STATIC \
+ QT_END_HEADER \
+ QT_FASTCALL \
+ QT_WIDGET_PLUGIN_EXPORT \
+ Q_COMPAT_EXPORT \
+ Q_CORE_EXPORT \
+ Q_EXPLICIT \
+ Q_EXPORT \
+ Q_EXPORT_CODECS_CN \
+ Q_EXPORT_CODECS_JP \
+ Q_EXPORT_CODECS_KR \
+ Q_EXPORT_PLUGIN \
+ Q_GFX_INLINE \
+ Q_GUI_EXPORT \
+ Q_GUI_EXPORT_INLINE \
+ Q_GUI_EXPORT_STYLE_CDE \
+ Q_GUI_EXPORT_STYLE_COMPACT \
+ Q_GUI_EXPORT_STYLE_MAC \
+ Q_GUI_EXPORT_STYLE_MOTIF \
+ Q_GUI_EXPORT_STYLE_MOTIFPLUS \
+ Q_GUI_EXPORT_STYLE_PLATINUM \
+ Q_GUI_EXPORT_STYLE_POCKETPC \
+ Q_GUI_EXPORT_STYLE_SGI \
+ Q_GUI_EXPORT_STYLE_WINDOWS \
+ Q_GUI_EXPORT_STYLE_WINDOWSXP \
+ QHELP_EXPORT \
+ Q_INLINE_TEMPLATE \
+ Q_INTERNAL_WIN_NO_THROW \
+ Q_NETWORK_EXPORT \
+ Q_OPENGL_EXPORT \
+ Q_OUTOFLINE_TEMPLATE \
+ Q_SQL_EXPORT \
+ Q_SVG_EXPORT \
+ Q_SCRIPT_EXPORT \
+ Q_TESTLIB_EXPORT \
+ Q_TYPENAME \
+ Q_XML_EXPORT \
+ Q_XMLSTREAM_EXPORT \
+ Q_XMLPATTERNS_EXPORT \
+ QDBUS_EXPORT \
+ QT_BEGIN_NAMESPACE \
+ QT_BEGIN_INCLUDE_NAMESPACE \
+ QT_END_NAMESPACE \
+ QT_END_INCLUDE_NAMESPACE \
+ PHONON_EXPORT \
+ EXTENSIONSYSTEM_EXPORT
+Cpp.ignoredirectives = Q_DECLARE_HANDLE \
+ Q_DECLARE_INTERFACE \
+ Q_DECLARE_METATYPE \
+ Q_DECLARE_OPERATORS_FOR_FLAGS \
+ Q_DECLARE_PRIVATE \
+ Q_DECLARE_PUBLIC \
+ Q_DECLARE_SHARED \
+ Q_DECLARE_TR_FUNCTIONS \
+ Q_DECLARE_TYPEINFO \
+ Q_DISABLE_COPY \
+ QT_FORWARD_DECLARE_CLASS \
+ Q_DUMMY_COMPARISON_OPERATOR \
+ Q_ENUMS \
+ Q_FLAGS \
+ Q_INTERFACES \
+ __attribute__ \
+ K_DECLARE_PRIVATE \
+ PHONON_OBJECT \
+ PHONON_HEIR
+
+
+
+HTML.style = "" \
+ "h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }"\
+ "a:link { color: #004faf; text-decoration: none }"\
+ "a:visited { color: #672967; text-decoration: none }"\
+ "td.postheader { font-family: sans-serif }"\
+ "tr.address { font-family: sans-serif }"\
+ "body { background: #ffffff; color: black }"\
+ "table tr.odd { background: #f0f0f0; color: black; }"\
+ "table tr.even { background: #e4e4e4; color: black; }"\
+ "table.annotated th { padding: 3px; text-align: left }"\
+ "table.annotated td { padding: 3px; } "\
+ "table tr pre { padding-top: none; padding-bottom: none; padding-left: none; padding-right: none; border: none; background: none }"\
+ "tr.qt-style { background: #a2c511; color: black }"\
+ "body pre { padding: 0.2em; border: #e7e7e7 1px solid; background: #f1f1f1; color: black }"\
+ "span.preprocessor, span.preprocessor a { color: darkblue; }"\
+ "span.comment { color: darkred; font-style: italic }"\
+ "span.string,span.char { color: darkgreen; }"\
+ ".title { text-align: center }"\
+ ".subtitle { font-size: 0.8em }"\
+ ".small-subtitle { font-size: 0.65em }"
+
+HTML.postheader = ""
+
+HTML.footer = ""
diff --git a/doc/src/snippets/code/doc_src_qtwebkit.qdoc b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/qtwebkit_build_snippet.qdoc
index d4fc2bd..d4fc2bd 100644
--- a/doc/src/snippets/code/doc_src_qtwebkit.qdoc
+++ b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/qtwebkit_build_snippet.qdoc
diff --git a/doc/src/snippets/code/src_3rdparty_webkit_WebKit_qt_Api_qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/qtwebkit_qwebview_snippet.cpp
index f04cd29..f04cd29 100644
--- a/doc/src/snippets/code/src_3rdparty_webkit_WebKit_qt_Api_qwebview.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/qtwebkit_qwebview_snippet.cpp
diff --git a/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/simple/main.cpp b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/simple/main.cpp
new file mode 100644
index 0000000..82f5b6c
--- /dev/null
+++ b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/simple/main.cpp
@@ -0,0 +1,34 @@
+/*
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <QApplication>
+#include <QUrl>
+#include <QWebView>
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ QWidget *parent = 0;
+//! [Using QWebView]
+ QWebView *view = new QWebView(parent);
+ view->load(QUrl("http://qtsoftware.com/"));
+ view->show();
+//! [Using QWebView]
+ return app.exec();
+}
diff --git a/doc/src/snippets/webkit/simple/simple.pro b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/simple/simple.pro
index 61cd3bf..61cd3bf 100644
--- a/doc/src/snippets/webkit/simple/simple.pro
+++ b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/simple/simple.pro
diff --git a/doc/src/snippets/webkit/webpage/main.cpp b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webpage/main.cpp
index b433ac2..b91bc30 100644
--- a/doc/src/snippets/webkit/webpage/main.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webpage/main.cpp
@@ -1,3 +1,22 @@
+/*
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
#include <QtGui>
#include <QWebPage>
#include <QWebFrame>
diff --git a/doc/src/snippets/webkit/webpage/webpage.pro b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webpage/webpage.pro
index fcad03b..fcad03b 100644
--- a/doc/src/snippets/webkit/webpage/webpage.pro
+++ b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webpage/webpage.pro
diff --git a/src/corelib/animation/qanimationgroup.cpp b/src/corelib/animation/qanimationgroup.cpp
index 03573bb..c4066ce 100644
--- a/src/corelib/animation/qanimationgroup.cpp
+++ b/src/corelib/animation/qanimationgroup.cpp
@@ -41,7 +41,7 @@
/*!
\class QAnimationGroup
- \brief The QAnimationGroup is an abstract base class for group of animations.
+ \brief The QAnimationGroup class is an abstract base class for group of animations.
\since 4.5
\ingroup animation
\preliminary
diff --git a/src/corelib/codecs/qtsciicodec.cpp b/src/corelib/codecs/qtsciicodec.cpp
index 14d2c9c..0ec0567 100644
--- a/src/corelib/codecs/qtsciicodec.cpp
+++ b/src/corelib/codecs/qtsciicodec.cpp
@@ -180,8 +180,7 @@ QByteArray QTsciiCodec::name() const
*/
int QTsciiCodec::mibEnum() const
{
- /* There is no MIBEnum for TSCII now */
- return -3197;
+ return 2107;
}
static const int UnToTsLast = 124; // 125 items -- so the last will be 124
diff --git a/src/corelib/codecs/qutfcodec.cpp b/src/corelib/codecs/qutfcodec.cpp
index 281bf75..1ac592e 100644
--- a/src/corelib/codecs/qutfcodec.cpp
+++ b/src/corelib/codecs/qutfcodec.cpp
@@ -413,9 +413,7 @@ QByteArray QUtf16Codec::name() const
QList<QByteArray> QUtf16Codec::aliases() const
{
- QList<QByteArray> list;
- list << "ISO-10646-UCS-2";
- return list;
+ return QList<QByteArray>();
}
int QUtf16BECodec::mibEnum() const
diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h
index c172f5f..f11c9df 100644
--- a/src/corelib/global/qfeatures.h
+++ b/src/corelib/global/qfeatures.h
@@ -386,11 +386,6 @@
#define QT_NO_PHONON_VOLUMESLIDER
#endif
-// QPrinter
-#if !defined(QT_NO_PRINTER) && (defined(QT_NO_TEXTSTREAM))
-#define QT_NO_PRINTER
-#endif
-
// QProcess
#if !defined(QT_NO_PROCESS) && (defined(QT_NO_THREAD))
#define QT_NO_PROCESS
@@ -516,6 +511,11 @@
#define QT_NO_LIBRARY
#endif
+// QPrinter
+#if !defined(QT_NO_PRINTER) && (defined(QT_NO_TEXTSTREAM) || defined(QT_NO_PICTURE))
+#define QT_NO_PRINTER
+#endif
+
// QScrollArea
#if !defined(QT_NO_SCROLLAREA) && (defined(QT_NO_SCROLLBAR))
#define QT_NO_SCROLLAREA
@@ -646,11 +646,6 @@
#define QT_NO_WHATSTHIS
#endif
-// Common UNIX Printing System
-#if !defined(QT_NO_CUPS) && (defined(QT_NO_PRINTER) || defined(QT_NO_LIBRARY))
-#define QT_NO_CUPS
-#endif
-
// QDirModel
#if !defined(QT_NO_DIRMODEL) && (defined(QT_NO_ITEMVIEWS))
#define QT_NO_DIRMODEL
@@ -731,6 +726,11 @@
#define QT_NO_COMPLETER
#endif
+// Common UNIX Printing System
+#if !defined(QT_NO_CUPS) && (defined(QT_NO_PRINTER) || defined(QT_NO_LIBRARY))
+#define QT_NO_CUPS
+#endif
+
// QDataWidgetMapper
#if !defined(QT_NO_DATAWIDGETMAPPER) && (defined(QT_NO_ITEMVIEWS) || defined(QT_NO_PROPERTIES))
#define QT_NO_DATAWIDGETMAPPER
@@ -762,7 +762,7 @@
#endif
// QPrintPreviewWidget
-#if !defined(QT_NO_PRINTPREVIEWWIDGET) && (defined(QT_NO_GRAPHICSVIEW) || defined(QT_NO_PRINTER) || defined(QT_NO_PICTURE))
+#if !defined(QT_NO_PRINTPREVIEWWIDGET) && (defined(QT_NO_GRAPHICSVIEW) || defined(QT_NO_PRINTER))
#define QT_NO_PRINTPREVIEWWIDGET
#endif
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index a23b2dd..e4bd664 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -377,12 +377,12 @@ QString qAppName()
QLibrary) can be retrieved with libraryPaths() and manipulated by
setLibraryPaths(), addLibraryPath(), and removeLibraryPath().
- On Unix/Linux Qt is configured to use the system local settings by
- default. This can cause a conflict when using POSIX functions, for
- instance, when converting between data types such as floats and
- strings, since the notation may differ between locales. To get
- around this problem call the POSIX function setlocale(LC_NUMERIC,"C")
- right after initializing QApplication or QCoreApplication to reset
+ On Unix/Linux Qt is configured to use the system local settings by
+ default. This can cause a conflict when using POSIX functions, for
+ instance, when converting between data types such as floats and
+ strings, since the notation may differ between locales. To get
+ around this problem call the POSIX function setlocale(LC_NUMERIC,"C")
+ right after initializing QApplication or QCoreApplication to reset
the locale that is used for number formatting to "C"-locale.
\sa QApplication, QAbstractEventDispatcher, QEventLoop,
@@ -1908,8 +1908,7 @@ QStringList QCoreApplication::arguments()
l1arg == "-qdebug" ||
l1arg == "-reverse" ||
l1arg == "-stylesheet" ||
- l1arg == "-widgetcount" ||
- l1arg == "-direct3d")
+ l1arg == "-widgetcount")
;
else if (l1arg.startsWith("-style="))
;
diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp
index fc1cefb..4b4dfe5 100644
--- a/src/corelib/kernel/qcoreevent.cpp
+++ b/src/corelib/kernel/qcoreevent.cpp
@@ -260,6 +260,7 @@ QT_BEGIN_NAMESPACE
\omitvalue ApplicationActivated
\omitvalue ApplicationDeactivated
\omitvalue MacGLWindowChange
+ \omitvalue MacGLClearDrawable
\omitvalue NetworkReplyUpdated
\omitvalue FutureCallOut
\omitvalue CocoaRequestModal
diff --git a/src/corelib/kernel/qeventdispatcher_glib.cpp b/src/corelib/kernel/qeventdispatcher_glib.cpp
index 3fd768a..3c5b277 100644
--- a/src/corelib/kernel/qeventdispatcher_glib.cpp
+++ b/src/corelib/kernel/qeventdispatcher_glib.cpp
@@ -42,6 +42,7 @@
#include "qeventdispatcher_glib_p.h"
#include "qeventdispatcher_unix_p.h"
+#include <private/qmutexpool_p.h>
#include <private/qthread_p.h>
#include "qcoreapplication.h"
@@ -224,6 +225,8 @@ QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(GMainContext *context)
: mainContext(context)
{
if (qgetenv("QT_NO_THREADED_GLIB").isEmpty()) {
+ static int dummyValue = 0; // only used for its address
+ QMutexLocker locker(QMutexPool::instance()->get(&dummyValue));
if (!g_thread_supported())
g_thread_init(NULL);
}
diff --git a/src/corelib/kernel/qeventloop.cpp b/src/corelib/kernel/qeventloop.cpp
index 92bdf73..600f787 100644
--- a/src/corelib/kernel/qeventloop.cpp
+++ b/src/corelib/kernel/qeventloop.cpp
@@ -188,8 +188,9 @@ int QEventLoop::exec(ProcessEventsFlags flags)
d->threadData->eventLoops.push(this);
// remove posted quit events when entering a new event loop
- if (qApp->thread() == thread())
- QCoreApplication::removePostedEvents(qApp, QEvent::Quit);
+ QCoreApplication *app = QCoreApplication::instance();
+ if (app && app->thread() == thread())
+ QCoreApplication::removePostedEvents(app, QEvent::Quit);
#if defined(QT_NO_EXCEPTIONS)
while (!d->exit)
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index b4427c0..b53e91f 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -71,27 +71,6 @@ QT_BEGIN_NAMESPACE
# define FLT_DIG 6
#endif
-
-static const void *constDataHelper(const QVariant::Private &d)
-{
- switch (d.type) {
- case QVariant::Int:
- return &d.data.i;
- case QVariant::UInt:
- return &d.data.u;
- case QVariant::Bool:
- return &d.data.b;
- case QVariant::LongLong:
- return &d.data.ll;
- case QVariant::ULongLong:
- return &d.data.ull;
- case QVariant::Double:
- return &d.data.d;
- default:
- return d.is_shared ? d.data.shared->ptr : reinterpret_cast<const void *>(&d.data.ptr);
- }
-}
-
static void construct(QVariant::Private *x, const void *copy)
{
x->is_shared = false;
@@ -179,6 +158,9 @@ static void construct(QVariant::Private *x, const void *copy)
case QVariant::Double:
x->data.d = copy ? *static_cast<const double*>(copy) : 0.0;
break;
+ case QMetaType::Float:
+ x->data.f = copy ? *static_cast<const float*>(copy) : 0.0f;
+ break;
case QVariant::LongLong:
x->data.ll = copy ? *static_cast<const qlonglong *>(copy) : Q_INT64_C(0);
break;
@@ -274,6 +256,7 @@ static void clear(QVariant::Private *d)
case QVariant::LongLong:
case QVariant::ULongLong:
case QVariant::Double:
+ case QMetaType::Float:
break;
case QVariant::Invalid:
case QVariant::UserType:
@@ -342,6 +325,7 @@ static bool isNull(const QVariant::Private *d)
case QVariant::ULongLong:
case QVariant::Bool:
case QVariant::Double:
+ case QMetaType::Float:
break;
}
return d->is_null;
@@ -433,6 +417,8 @@ static bool compare(const QVariant::Private *a, const QVariant::Private *b)
return a->data.b == b->data.b;
case QVariant::Double:
return a->data.d == b->data.d;
+ case QMetaType::Float:
+ return a->data.f == b->data.f;
case QVariant::Date:
return *v_cast<QDate>(a) == *v_cast<QDate>(b);
case QVariant::Time:
@@ -491,7 +477,7 @@ static qlonglong qMetaTypeNumber(const QVariant::Private *d)
case QMetaType::Long:
return qlonglong(*static_cast<long *>(d->data.shared->ptr));
case QMetaType::Float:
- return qRound64(*static_cast<float *>(d->data.shared->ptr));
+ return qRound64(d->data.f);
case QVariant::Double:
return qRound64(d->data.d);
}
@@ -628,7 +614,7 @@ static bool convert(const QVariant::Private *d, QVariant::Type t, void *result,
*str = QString::number(qMetaTypeUNumber(d));
break;
case QMetaType::Float:
- *str = QString::number(*static_cast<float *>(d->data.shared->ptr), 'g', FLT_DIG);
+ *str = QString::number(d->data.f, 'g', FLT_DIG);
break;
case QVariant::Double:
*str = QString::number(d->data.d, 'g', DBL_DIG);
@@ -799,7 +785,7 @@ static bool convert(const QVariant::Private *d, QVariant::Type t, void *result,
*ba = QByteArray::number(d->data.d, 'g', DBL_DIG);
break;
case QMetaType::Float:
- *ba = QByteArray::number(*static_cast<float *>(d->data.shared->ptr), 'g', FLT_DIG);
+ *ba = QByteArray::number(d->data.f, 'g', FLT_DIG);
break;
case QMetaType::Char:
case QMetaType::UChar:
@@ -901,7 +887,7 @@ static bool convert(const QVariant::Private *d, QVariant::Type t, void *result,
*f = double(d->data.b);
break;
case QMetaType::Float:
- *f = *static_cast<float *>(d->data.shared->ptr);
+ *f = double(d->data.f);
break;
case QVariant::LongLong:
case QVariant::Int:
@@ -1355,7 +1341,7 @@ void QVariant::create(int type, const void *copy)
QVariant::~QVariant()
{
- if (d.type > Char && (!d.is_shared || !d.data.shared->ref.deref()))
+ if (d.type > Char && d.type != QMetaType::Float && (!d.is_shared || !d.data.shared->ref.deref()))
handler->clear(&d);
}
@@ -1371,7 +1357,7 @@ QVariant::QVariant(const QVariant &p)
{
if (d.is_shared) {
d.data.shared->ref.ref();
- } else if (p.d.type > Char) {
+ } else if (p.d.type > Char && p.d.type != QMetaType::Float) {
handler->construct(&d, p.constData());
d.is_null = p.d.is_null;
}
@@ -1565,6 +1551,12 @@ QVariant::QVariant(const char *val)
*/
/*!
+ \fn QVariant::QVariant(float val)
+
+ Constructs a new variant with a floating point value, \a val.
+*/
+
+/*!
\fn QVariant::QVariant(const QList<QVariant> &val)
Constructs a new variant with a list value, \a val.
@@ -1619,44 +1611,44 @@ QVariant::QVariant(double val)
{ d.is_null = false; d.type = Double; d.data.d = val; }
QVariant::QVariant(const QByteArray &val)
-{ create(ByteArray, &val); }
+{ d.is_null = false; d.type = ByteArray; v_construct<QByteArray>(&d, val); }
QVariant::QVariant(const QBitArray &val)
-{ create(BitArray, &val); }
+{ d.is_null = false; d.type = BitArray; v_construct<QBitArray>(&d, val); }
QVariant::QVariant(const QString &val)
-{ create(String, &val); }
+{ d.is_null = false; d.type = String; v_construct<QString>(&d, val); }
QVariant::QVariant(const QChar &val)
-{ create (Char, &val); }
+{ d.is_null = false; d.type = Char; v_construct<QChar>(&d, val); }
QVariant::QVariant(const QLatin1String &val)
-{ QString str(val); create(String, &str); }
+{ QString str(val); d.is_null = false; d.type = String; v_construct<QString>(&d, str); }
QVariant::QVariant(const QStringList &val)
-{ create(StringList, &val); }
+{ d.is_null = false; d.type = StringList; v_construct<QStringList>(&d, val); }
QVariant::QVariant(const QDate &val)
-{ create(Date, &val); }
+{ d.is_null = false; d.type = Date; v_construct<QDate>(&d, val); }
QVariant::QVariant(const QTime &val)
-{ create(Time, &val); }
+{ d.is_null = false; d.type = Time; v_construct<QTime>(&d, val); }
QVariant::QVariant(const QDateTime &val)
-{ create(DateTime, &val); }
+{ d.is_null = false; d.type = DateTime; v_construct<QDateTime>(&d, val); }
QVariant::QVariant(const QList<QVariant> &list)
-{ create(List, &list); }
+{ d.is_null = false; d.type = List; v_construct<QVariantList>(&d, list); }
QVariant::QVariant(const QMap<QString, QVariant> &map)
-{ create(Map, &map); }
+{ d.is_null = false; d.type = Map; v_construct<QVariantMap>(&d, map); }
QVariant::QVariant(const QHash<QString, QVariant> &hash)
-{ create(Hash, &hash); }
+{ d.is_null = false; d.type = Hash; v_construct<QVariantHash>(&d, hash); }
#ifndef QT_NO_GEOM_VARIANT
-QVariant::QVariant(const QPoint &pt) { create(Point, &pt); }
-QVariant::QVariant(const QPointF &pt) { create (PointF, &pt); }
-QVariant::QVariant(const QRectF &r) { create (RectF, &r); }
-QVariant::QVariant(const QLineF &l) { create (LineF, &l); }
-QVariant::QVariant(const QLine &l) { create (Line, &l); }
-QVariant::QVariant(const QRect &r) { create(Rect, &r); }
-QVariant::QVariant(const QSize &s) { create(Size, &s); }
-QVariant::QVariant(const QSizeF &s) { create(SizeF, &s); }
+QVariant::QVariant(const QPoint &pt) { d.is_null = false; d.type = Point; v_construct<QPoint>(&d, pt); }
+QVariant::QVariant(const QPointF &pt) { d.is_null = false; d.type = PointF; v_construct<QPointF>(&d, pt); }
+QVariant::QVariant(const QRectF &r) { d.is_null = false; d.type = RectF; v_construct<QRectF>(&d, r); }
+QVariant::QVariant(const QLineF &l) { d.is_null = false; d.type = LineF; v_construct<QLineF>(&d, l); }
+QVariant::QVariant(const QLine &l) { d.is_null = false; d.type = Line; v_construct<QLine>(&d, l); }
+QVariant::QVariant(const QRect &r) { d.is_null = false; d.type = Rect; v_construct<QRect>(&d, r); }
+QVariant::QVariant(const QSize &s) { d.is_null = false; d.type = Size; v_construct<QSize>(&d, s); }
+QVariant::QVariant(const QSizeF &s) { d.is_null = false; d.type = SizeF; v_construct<QSizeF>(&d, s); }
#endif
-QVariant::QVariant(const QUrl &u) { create(Url, &u); }
-QVariant::QVariant(const QLocale &l) { create(Locale, &l); }
+QVariant::QVariant(const QUrl &u) { d.is_null = false; d.type = Url; v_construct<QUrl>(&d, u); }
+QVariant::QVariant(const QLocale &l) { d.is_null = false; d.type = Locale; v_construct<QLocale>(&d, l); }
#ifndef QT_NO_REGEXP
-QVariant::QVariant(const QRegExp &regExp) { create(RegExp, &regExp); }
+QVariant::QVariant(const QRegExp &regExp) { d.is_null = false; d.type = RegExp; v_construct<QRegExp>(&d, regExp); }
#endif
QVariant::QVariant(Qt::GlobalColor color) { create(62, &color); }
@@ -1721,7 +1713,7 @@ QVariant& QVariant::operator=(const QVariant &variant)
if (variant.d.is_shared) {
variant.d.data.shared->ref.ref();
d = variant.d;
- } else if (variant.d.type > Char) {
+ } else if (variant.d.type > Char && variant.d.type != QMetaType::Float) {
d.type = variant.d.type;
handler->construct(&d, variant.constData());
d.is_null = variant.d.is_null;
@@ -1907,7 +1899,7 @@ void QVariant::load(QDataStream &s)
}
// const cast is safe since we operate on a newly constructed variant
- if (!QMetaType::load(s, d.type, const_cast<void *>(constDataHelper(d)))) {
+ if (!QMetaType::load(s, d.type, const_cast<void *>(constData()))) {
s.setStatus(QDataStream::ReadCorruptData);
qWarning("QVariant::load: unable to load type %d.", d.type);
}
@@ -1947,7 +1939,7 @@ void QVariant::save(QDataStream &s) const
return;
}
- if (!QMetaType::save(s, d.type, constDataHelper(d))) {
+ if (!QMetaType::save(s, d.type, constData())) {
Q_ASSERT_X(false, "QVariant::save", "Invalid type to save");
qWarning("QVariant::save: unable to save type %d.", d.type);
}
@@ -2565,57 +2557,63 @@ static const quint32 qCanConvertMatrix[QVariant::LastCoreType + 1] =
*/
bool QVariant::canConvert(Type t) const
{
- if (d.type == uint(t))
+ //we can treat floats as double
+ //the reason for not doing it the "proper" way is that QMetaType::Float's value is 135,
+ //which can't be handled by qCanConvertMatrix
+ //In addition QVariant::Type doesn't have a Float value, so we're using QMetaType::Float
+ const uint currentType = ((d.type == QMetaType::Float) ? QVariant::Double : d.type);
+ if (uint(t) == uint(QMetaType::Float)) t = QVariant::Double;
+
+ if (currentType == uint(t))
return true;
- if (d.type > QVariant::LastCoreType || t > QVariant::LastCoreType) {
+ if (currentType > QVariant::LastCoreType || t > QVariant::LastCoreType) {
switch (uint(t)) {
case QVariant::Int:
- return d.type == QVariant::KeySequence
- || d.type == QMetaType::ULong
- || d.type == QMetaType::Long
- || d.type == QMetaType::UShort
- || d.type == QMetaType::UChar
- || d.type == QMetaType::Char
- || d.type == QMetaType::Short;
+ return currentType == QVariant::KeySequence
+ || currentType == QMetaType::ULong
+ || currentType == QMetaType::Long
+ || currentType == QMetaType::UShort
+ || currentType == QMetaType::UChar
+ || currentType == QMetaType::Char
+ || currentType == QMetaType::Short;
case QVariant::Image:
- return d.type == QVariant::Pixmap || d.type == QVariant::Bitmap;
+ return currentType == QVariant::Pixmap || currentType == QVariant::Bitmap;
case QVariant::Pixmap:
- return d.type == QVariant::Image || d.type == QVariant::Bitmap
- || d.type == QVariant::Brush;
+ return currentType == QVariant::Image || currentType == QVariant::Bitmap
+ || currentType == QVariant::Brush;
case QVariant::Bitmap:
- return d.type == QVariant::Pixmap || d.type == QVariant::Image;
+ return currentType == QVariant::Pixmap || currentType == QVariant::Image;
case QVariant::ByteArray:
- return d.type == QVariant::Color;
+ return currentType == QVariant::Color;
case QVariant::String:
- return d.type == QVariant::KeySequence || d.type == QVariant::Font
- || d.type == QVariant::Color;
+ return currentType == QVariant::KeySequence || currentType == QVariant::Font
+ || currentType == QVariant::Color;
case QVariant::KeySequence:
- return d.type == QVariant::String || d.type == QVariant::Int;
+ return currentType == QVariant::String || currentType == QVariant::Int;
case QVariant::Font:
- return d.type == QVariant::String;
+ return currentType == QVariant::String;
case QVariant::Color:
- return d.type == QVariant::String || d.type == QVariant::ByteArray
- || d.type == QVariant::Brush;
+ return currentType == QVariant::String || currentType == QVariant::ByteArray
+ || currentType == QVariant::Brush;
case QVariant::Brush:
- return d.type == QVariant::Color || d.type == QVariant::Pixmap;
+ return currentType == QVariant::Color || currentType == QVariant::Pixmap;
case QMetaType::Long:
case QMetaType::Char:
case QMetaType::UChar:
case QMetaType::ULong:
case QMetaType::Short:
case QMetaType::UShort:
- case QMetaType::Float:
- return qCanConvertMatrix[QVariant::Int] & (1 << d.type) || d.type == QVariant::Int;
+ return qCanConvertMatrix[QVariant::Int] & (1 << currentType) || currentType == QVariant::Int;
default:
return false;
}
}
- if(t == String && d.type == StringList)
+ if(t == String && currentType == StringList)
return v_cast<QStringList>(&d)->count() == 1;
else
- return qCanConvertMatrix[t] & (1 << d.type);
+ return qCanConvertMatrix[t] & (1 << currentType);
}
/*!
@@ -2726,7 +2724,7 @@ bool QVariant::cmp(const QVariant &v) const
const void *QVariant::constData() const
{
- return constDataHelper(d);
+ return d.is_shared ? d.data.shared->ptr : reinterpret_cast<const void *>(&d.data.ptr);
}
/*!
@@ -2739,7 +2737,7 @@ const void *QVariant::constData() const
void* QVariant::data()
{
detach();
- return const_cast<void *>(constDataHelper(d));
+ return const_cast<void *>(constData());
}
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index 580b101..d73fcbc 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -128,7 +128,7 @@ class Q_CORE_EXPORT QVariant
LineF = 24,
Point = 25,
PointF = 26,
- RegExp = 27,
+ RegExp = 27,
Hash = 28,
LastCoreType = Hash,
@@ -181,6 +181,7 @@ class Q_CORE_EXPORT QVariant
QVariant(qulonglong ull);
QVariant(bool b);
QVariant(double d);
+ QVariant(float f) { d.is_null = false; d.type = QMetaType::Float; d.data.f = f; }
#ifndef QT_NO_CAST_FROM_ASCII
QT_ASCII_CAST_WARN_CONSTRUCTOR QVariant(const char *str);
#endif
@@ -349,6 +350,7 @@ class Q_CORE_EXPORT QVariant
uint u;
bool b;
double d;
+ float f;
qlonglong ll;
qulonglong ull;
void *ptr;
@@ -443,7 +445,18 @@ inline QVariant qVariantFromValue(const QVariant &t) { return t; }
template <typename T>
inline void qVariantSetValue(QVariant &v, const T &t)
{
- v = QVariant(qMetaTypeId<T>(reinterpret_cast<T *>(0)), &t);
+ //if possible we reuse the current QVariant private
+ const int type = qMetaTypeId<T>(reinterpret_cast<T *>(0));
+ QVariant::Private &d = v.data_ptr();
+ if (type <= int(QVariant::Char) || (type == d.type && v.isDetached())) {
+ d.type = type;
+ T *old = reinterpret_cast<T*>(d.is_shared ? d.data.shared->ptr : &d.data.ptr);
+ if (QTypeInfo<T>::isComplex)
+ old->~T();
+ new (old) T(t); //call the copy constructor
+ } else {
+ v = QVariant(type, &t);
+ }
}
inline QVariant::QVariant() {}
diff --git a/src/corelib/kernel/qvariant_p.h b/src/corelib/kernel/qvariant_p.h
index 0764fe3..074575b 100644
--- a/src/corelib/kernel/qvariant_p.h
+++ b/src/corelib/kernel/qvariant_p.h
@@ -60,8 +60,6 @@
QT_BEGIN_NAMESPACE
-extern Q_CORE_EXPORT const QVariant::Handler *qExtendedVariantHandler;
-
#ifdef Q_CC_SUN // Sun CC picks the wrong overload, so introduce awful hack
template <typename T>
@@ -70,7 +68,7 @@ inline T *v_cast(const QVariant::Private *nd, T * = 0)
QVariant::Private *d = const_cast<QVariant::Private *>(nd);
return ((sizeof(T) > sizeof(QVariant::Private::Data))
? static_cast<T *>(d->data.shared->ptr)
- : reinterpret_cast<T*>(&d->data.c));
+ : static_cast<T *>(static_cast<void *>(&d->data.c)));
}
#else // every other compiler in this world
@@ -80,7 +78,7 @@ inline const T *v_cast(const QVariant::Private *d, T * = 0)
{
return ((sizeof(T) > sizeof(QVariant::Private::Data))
? static_cast<const T *>(d->data.shared->ptr)
- : reinterpret_cast<const T *>(&d->data.c));
+ : static_cast<const T *>(static_cast<const void *>(&d->data.c)));
}
template <typename T>
@@ -88,15 +86,17 @@ inline T *v_cast(QVariant::Private *d, T * = 0)
{
return ((sizeof(T) > sizeof(QVariant::Private::Data))
? static_cast<T *>(d->data.shared->ptr)
- : reinterpret_cast<T *>(&d->data.c));
+ : static_cast<T *>(static_cast<void *>(&d->data.c)));
}
#endif
-//a simple template that avoids to allocate 2 buffers when creating a QVariant
+
+//a simple template that avoids to allocate 2 memory chunks when creating a QVariant
template <class T> class QVariantPrivateSharedEx : public QVariant::PrivateShared
{
public:
+ QVariantPrivateSharedEx() : QVariant::PrivateShared(&m_t) { }
QVariantPrivateSharedEx(const T&t) : QVariant::PrivateShared(&m_t), m_t(t) { }
private:
@@ -105,14 +105,12 @@ private:
// constructs a new variant if copy is 0, otherwise copy-constructs
template <class T>
-inline void v_construct(QVariant::Private *x, const T& t)
+inline void v_construct(QVariant::Private *x, const T &t)
{
- x->type = qMetaTypeId<T>(reinterpret_cast<T *>(0));
if (sizeof(T) > sizeof(QVariant::Private::Data)) {
x->data.shared = new QVariantPrivateSharedEx<T>(t);
x->is_shared = true;
} else {
- x->is_shared = false;
new (&x->data.ptr) T(t);
}
}
@@ -120,24 +118,31 @@ inline void v_construct(QVariant::Private *x, const T& t)
template <class T>
inline void v_construct(QVariant::Private *x, const void *copy, T * = 0)
{
- if (copy) {
- v_construct<T>(x, *reinterpret_cast<const T*>(copy));
+ if (sizeof(T) > sizeof(QVariant::Private::Data)) {
+ x->data.shared = copy ? new QVariantPrivateSharedEx<T>(*static_cast<const T *>(copy))
+ : new QVariantPrivateSharedEx<T>;
+ x->is_shared = true;
} else {
- T t;
- v_construct<T>(x, t);
+ if (copy)
+ new (&x->data.ptr) T(*static_cast<const T *>(copy));
+ else
+ new (&x->data.ptr) T;
}
}
-
// deletes the internal structures
template <class T>
inline void v_clear(QVariant::Private *d, T* = 0)
{
- //now we need to call the destructor in any case
- //because QVariant::PrivateShared doesn't have a virtual destructor
- v_cast<T>(d)->~T();
- if (sizeof(T) > sizeof(QVariant::Private::Data))
- delete d->data.shared;
+
+ if (sizeof(T) > sizeof(QVariant::Private::Data)) {
+ //now we need to cast
+ //because QVariant::PrivateShared doesn't have a virtual destructor
+ delete static_cast<QVariantPrivateSharedEx<T>*>(d->data.shared);
+ } else {
+ v_cast<T>(d)->~T();
+ }
+
}
QT_END_NAMESPACE
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp
index f602821..8f1c698 100644
--- a/src/corelib/thread/qthread_unix.cpp
+++ b/src/corelib/thread/qthread_unix.cpp
@@ -180,8 +180,7 @@ void *QThreadPrivate::start(void *arg)
data->quitNow = false;
// ### TODO: allow the user to create a custom event dispatcher
- if (QCoreApplication::instance())
- createEventDispatcher(data);
+ createEventDispatcher(data);
emit thr->started();
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp
index 27193c6..7094e3d 100644
--- a/src/corelib/thread/qthread_win.cpp
+++ b/src/corelib/thread/qthread_win.cpp
@@ -292,8 +292,7 @@ unsigned int __stdcall QThreadPrivate::start(void *arg)
data->quitNow = false;
// ### TODO: allow the user to create a custom event dispatcher
- if (QCoreApplication::instance())
- createEventDispatcher(data);
+ createEventDispatcher(data);
#if !defined(QT_NO_DEBUG) && defined(Q_CC_MSVC) && !defined(Q_OS_WINCE)
// sets the name of the current thread.
diff --git a/src/corelib/tools/qbytearraymatcher.cpp b/src/corelib/tools/qbytearraymatcher.cpp
index cd4cf90..211d190 100644
--- a/src/corelib/tools/qbytearraymatcher.cpp
+++ b/src/corelib/tools/qbytearraymatcher.cpp
@@ -120,6 +120,7 @@ QByteArrayMatcher::QByteArrayMatcher()
: d(0)
{
p.p = 0;
+ p.l = 0;
qMemSet(p.q_skiptable, 0, sizeof(p.q_skiptable));
}
@@ -170,7 +171,7 @@ QByteArrayMatcher::~QByteArrayMatcher()
QByteArrayMatcher &QByteArrayMatcher::operator=(const QByteArrayMatcher &other)
{
q_pattern = other.q_pattern;
- qMemCopy(p.q_skiptable, other.p.q_skiptable, sizeof(p.q_skiptable));
+ qMemCopy(&p, &other.p, sizeof(p));
return *this;
}
diff --git a/src/corelib/tools/qbytearraymatcher.h b/src/corelib/tools/qbytearraymatcher.h
index d7f2366..633e92c 100644
--- a/src/corelib/tools/qbytearraymatcher.h
+++ b/src/corelib/tools/qbytearraymatcher.h
@@ -67,7 +67,12 @@ public:
int indexIn(const QByteArray &ba, int from = 0) const;
int indexIn(const char *str, int len, int from = 0) const;
- inline QByteArray pattern() const { return q_pattern; }
+ inline QByteArray pattern() const
+ {
+ if (q_pattern.isNull())
+ return QByteArray((const char*)p.p, p.l);
+ return q_pattern;
+ }
private:
QByteArrayMatcherPrivate *d;
diff --git a/src/declarative/canvas/qsimplecanvas.cpp b/src/declarative/canvas/qsimplecanvas.cpp
index 4d2cc5b..1911b35 100644
--- a/src/declarative/canvas/qsimplecanvas.cpp
+++ b/src/declarative/canvas/qsimplecanvas.cpp
@@ -73,7 +73,7 @@ public:
{
int entry = (_first + _size) % s;
_array[entry] = t;
- if(_size == s)
+ if (_size == s)
_first = (_first + 1) % s;
else
_size++;
@@ -127,14 +127,14 @@ void QSimpleCanvasRootLayer::remDirty(QSimpleCanvasItem *i)
void QSimpleCanvasPrivate::clearFocusPanel(QSimpleCanvasItem *panel)
{
- if(q->activeFocusPanel() == panel) {
+ if (q->activeFocusPanel() == panel) {
focusPanels.pop();
switchToFocusPanel(q->activeFocusPanel(), panel, Qt::OtherFocusReason);
panel->activePanelOutEvent();
} else {
- for(int ii = 0; ii < focusPanels.count(); ++ii)
- if(focusPanels.at(ii) == panel) {
+ for (int ii = 0; ii < focusPanels.count(); ++ii)
+ if (focusPanels.at(ii) == panel) {
focusPanels.remove(ii);
break;
}
@@ -143,35 +143,35 @@ void QSimpleCanvasPrivate::clearFocusPanel(QSimpleCanvasItem *panel)
void QSimpleCanvasPrivate::switchToFocusPanel(QSimpleCanvasItem *panel, QSimpleCanvasItem *wasPanel, Qt::FocusReason focusReason)
{
- if(panel)
+ if (panel)
panel->activePanelInEvent();
QSimpleCanvasItem *wasFocusRoot = focusPanelData.value(wasPanel);
- if(wasFocusRoot)
+ if (wasFocusRoot)
clearActiveFocusItem(wasFocusRoot, focusReason);
QSimpleCanvasItem *newFocusRoot = focusPanelData.value(panel);
- if(newFocusRoot)
+ if (newFocusRoot)
setFocusItem(newFocusRoot, focusReason);
}
void QSimpleCanvasPrivate::setActiveFocusPanel(QSimpleCanvasItem *panel, Qt::FocusReason focusReason)
{
- if(q->activeFocusPanel() == panel)
+ if (q->activeFocusPanel() == panel)
return;
- if(panel) {
- for(int ii = 0; ii < focusPanels.count(); ++ii)
- if(focusPanels.at(ii) == panel) {
+ if (panel) {
+ for (int ii = 0; ii < focusPanels.count(); ++ii)
+ if (focusPanels.at(ii) == panel) {
focusPanels.remove(ii);
break;
}
}
QSimpleCanvasItem *old = q->activeFocusPanel();
- if(panel)
+ if (panel)
focusPanels << panel;
switchToFocusPanel(panel, old, focusReason);
- if(old)
+ if (old)
old->activePanelOutEvent();
}
@@ -181,13 +181,13 @@ void QSimpleCanvasPrivate::clearActiveFocusItem(QSimpleCanvasItem *item,
if (!item || !item->d_func())
return;
- if(!item->d_func()->hasActiveFocus)
+ if (!item->d_func()->hasActiveFocus)
return;
item->d_func()->hasActiveFocus = false;
- if(item->options() & QSimpleCanvasItem::IsFocusRealm) {
+ if (item->options() & QSimpleCanvasItem::IsFocusRealm) {
QSimpleCanvasItem *newItem = focusPanelData.value(item);
- if(newItem) {
+ if (newItem) {
clearActiveFocusItem(newItem, focusReason);
} else {
focusItem = 0;
@@ -200,8 +200,8 @@ void QSimpleCanvasPrivate::clearActiveFocusItem(QSimpleCanvasItem *item,
item->focusOutEvent(&event);
}
- if(item->options() & QSimpleCanvasItem::AcceptsInputMethods){
- if(q->testAttribute(Qt::WA_InputMethodEnabled))
+ if (item->options() & QSimpleCanvasItem::AcceptsInputMethods){
+ if (q->testAttribute(Qt::WA_InputMethodEnabled))
q->setAttribute(Qt::WA_InputMethodEnabled,false);
}
item->activeFocusChanged(true);
@@ -213,9 +213,9 @@ void QSimpleCanvasPrivate::setActiveFocusItem(QSimpleCanvasItem *item,
while(true) {
item->d_func()->setActiveFocus(true);
item->activeFocusChanged(true);
- if(item->options() & QSimpleCanvasItem::IsFocusRealm) {
+ if (item->options() & QSimpleCanvasItem::IsFocusRealm) {
QSimpleCanvasItem *newItem = focusPanelData.value(item);
- if(newItem)
+ if (newItem)
item = newItem;
else
break;
@@ -224,8 +224,8 @@ void QSimpleCanvasPrivate::setActiveFocusItem(QSimpleCanvasItem *item,
}
}
- if(item->options() & QSimpleCanvasItem::AcceptsInputMethods){
- if(!q->testAttribute(Qt::WA_InputMethodEnabled))
+ if (item->options() & QSimpleCanvasItem::AcceptsInputMethods){
+ if (!q->testAttribute(Qt::WA_InputMethodEnabled))
q->setAttribute(Qt::WA_InputMethodEnabled,true);
}
focusItem = item;
@@ -244,9 +244,9 @@ void QSimpleCanvasPrivate::clearFocusItem(QSimpleCanvasItem *item)
QSimpleCanvasItem *scope = 0;
QSimpleCanvasItem *citem = item;
while(citem && !scope) {
- if(citem->options() & QSimpleCanvasItem::IsFocusPanel)
+ if (citem->options() & QSimpleCanvasItem::IsFocusPanel)
scope = citem;
- else if(citem != item && citem->options() & QSimpleCanvasItem::IsFocusRealm)
+ else if (citem != item && citem->options() & QSimpleCanvasItem::IsFocusRealm)
scope = citem;
citem = citem->parent();
}
@@ -254,23 +254,23 @@ void QSimpleCanvasPrivate::clearFocusItem(QSimpleCanvasItem *item)
bool isActive = false;
- if(scope->options() & QSimpleCanvasItem::IsFocusPanel)
+ if (scope->options() & QSimpleCanvasItem::IsFocusPanel)
isActive = (scope == q->activeFocusPanel());
- else if(scope->options() & QSimpleCanvasItem::IsFocusRealm)
+ else if (scope->options() & QSimpleCanvasItem::IsFocusRealm)
isActive = scope->hasActiveFocus();
- if(isActive) clearActiveFocusItem(item, Qt::OtherFocusReason);
+ if (isActive) clearActiveFocusItem(item, Qt::OtherFocusReason);
item->d_func()->setFocus(false);
item->focusChanged(false);
focusPanelData.insert(scope, 0);
- if(lastFocusItem == item)
+ if (lastFocusItem == item)
lastFocusItem = 0;
- if(focusItem == item)
+ if (focusItem == item)
focusItem = 0;
- if(scope->options() & QSimpleCanvasItem::IsFocusRealm && scope->hasActiveFocus()) {
+ if (scope->options() & QSimpleCanvasItem::IsFocusRealm && scope->hasActiveFocus()) {
setActiveFocusItem(scope, Qt::OtherFocusReason);
} else {
QSimpleCanvasItem *item = QSimpleCanvasItem::findNextFocus(scope);
@@ -291,21 +291,21 @@ void QSimpleCanvasPrivate::setFocusItem(QSimpleCanvasItem *item,
item = item->focusProxy();
#endif
- if(item == focusItem)
+ if (item == focusItem)
return;
QSimpleCanvasItem *scope = 0;
QSimpleCanvasItem *citem = item;
while(citem && !scope) {
- if(citem->options() & QSimpleCanvasItem::IsFocusPanel)
+ if (citem->options() & QSimpleCanvasItem::IsFocusPanel)
scope = citem;
- else if(citem != item && citem->options() & QSimpleCanvasItem::IsFocusRealm)
+ else if (citem != item && citem->options() & QSimpleCanvasItem::IsFocusRealm)
scope = citem;
citem = citem->parent();
}
Q_ASSERT(scope); // At the very least we'll find the canvas root
- if(!overwrite && focusPanelData.contains(scope)) {
+ if (!overwrite && focusPanelData.contains(scope)) {
item->d_func()->setFocus(false);
item->focusChanged(false);
return;
@@ -314,26 +314,26 @@ void QSimpleCanvasPrivate::setFocusItem(QSimpleCanvasItem *item,
QSimpleCanvasItem *oldFocus = focusPanelData.value(scope);
bool isActive = false;
- if(scope->options() & QSimpleCanvasItem::IsFocusPanel)
+ if (scope->options() & QSimpleCanvasItem::IsFocusPanel)
isActive = (scope == q->activeFocusPanel());
- else if(scope->options() & QSimpleCanvasItem::IsFocusRealm)
+ else if (scope->options() & QSimpleCanvasItem::IsFocusRealm)
isActive = scope->hasActiveFocus();
- if(oldFocus) {
- if(isActive) clearActiveFocusItem(oldFocus, focusReason);
+ if (oldFocus) {
+ if (isActive) clearActiveFocusItem(oldFocus, focusReason);
oldFocus->d_func()->setFocus(false);
oldFocus->focusChanged(false);
}
focusPanelData.insert(scope, item);
- if(isActive)
+ if (isActive)
lastFocusItem = item;
if (item) {
item->d_func()->setFocus(true);
item->focusChanged(true);
- if(isActive)
+ if (isActive)
setActiveFocusItem(item, focusReason);
}
}
@@ -351,8 +351,8 @@ bool QSimpleCanvas::eventFilter(QObject *obj, QEvent *event)
case QEvent::GraphicsSceneMousePress:
case QEvent::GraphicsSceneMouseRelease: {
//same logic as filter() function
- for(int ii = 0; ii < d->mouseFilters.count(); ++ii) {
- if(d->mouseFilters.at(ii)->mouseFilter((QGraphicsSceneMouseEvent*)event))
+ for (int ii = 0; ii < d->mouseFilters.count(); ++ii) {
+ if (d->mouseFilters.at(ii)->mouseFilter((QGraphicsSceneMouseEvent*)event))
return true;
}
break;
@@ -375,12 +375,12 @@ void QSimpleCanvasPrivate::removeMouseFilter(QSimpleCanvasItem *item)
bool QSimpleCanvasPrivate::filter(QMouseEvent *e)
{
- if(mouseFilters.isEmpty())
+ if (mouseFilters.isEmpty())
return false;
QGraphicsSceneMouseEvent *me = mouseEventToSceneMouseEvent(e, e->pos());
- for(int ii = 0; ii < mouseFilters.count(); ++ii) {
- if(mouseFilters.at(ii)->mouseFilter(me)) {
+ for (int ii = 0; ii < mouseFilters.count(); ++ii) {
+ if (mouseFilters.at(ii)->mouseFilter(me)) {
delete me;
return true;
}
@@ -411,6 +411,7 @@ QGraphicsSceneMouseEvent *QSimpleCanvasPrivate::mouseEventToSceneMouseEvent(QMou
QGraphicsSceneMouseEvent *me = new QGraphicsSceneMouseEvent(t);
me->setButton(e->button());
me->setButtons(e->buttons());
+ me->setModifiers(e->modifiers());
me->setPos(item);
me->setScreenPos(e->pos());
me->setScenePos(e->pos());
@@ -419,36 +420,36 @@ QGraphicsSceneMouseEvent *QSimpleCanvasPrivate::mouseEventToSceneMouseEvent(QMou
bool QSimpleCanvasPrivate::deliverMousePress(QSimpleCanvasItem *base, QMouseEvent *e, bool seenChildFilter)
{
- if(base->clipType()) {
+ if (base->clipType()) {
QRectF br = base->boundingRect();
QPointF pos = base->mapFromScene(e->pos());
- if(!br.contains(pos.toPoint()))
+ if (!br.contains(pos.toPoint()))
return false;
}
const QList<QSimpleCanvasItem *> &children = base->d_func()->children;
- if(base->options() & QSimpleCanvasItem::ChildMouseFilter)
+ if (base->options() & QSimpleCanvasItem::ChildMouseFilter)
seenChildFilter = true;
- for(int ii = children.count() - 1; ii >= 0; --ii) {
- if(children.at(ii)->visible() != 0.)
- if(deliverMousePress(children.at(ii), e, seenChildFilter))
+ for (int ii = children.count() - 1; ii >= 0; --ii) {
+ if (children.at(ii)->visible() != 0.)
+ if (deliverMousePress(children.at(ii), e, seenChildFilter))
return true;
}
- if(base->acceptedMouseButtons() & e->button() || base->options() & QSimpleCanvasItem::ChildMouseFilter) {
+ if (base->acceptedMouseButtons() & e->button() || base->options() & QSimpleCanvasItem::ChildMouseFilter) {
QRectF br = base->boundingRect();
QPoint pos = base->mapFromScene(e->pos()).toPoint();
- if(br.contains(pos)) {
+ if (br.contains(pos)) {
QGraphicsSceneMouseEvent *me = mouseEventToSceneMouseEvent(e, pos);
sendMouseEvent(base, me);
bool isAccepted = me->isAccepted();
delete me;
- if(isAccepted) {
+ if (isAccepted) {
lastMouseItem = base;
return true;
}
@@ -462,8 +463,8 @@ void QSimpleCanvasPrivate::sendMouseEvent(QSimpleCanvasItem *item, QGraphicsScen
{
QSimpleCanvasItem *p = item->parent();
while(p) {
- if(p->options() & QSimpleCanvasItem::ChildMouseFilter) {
- if(p->mouseFilter(e))
+ if (p->options() & QSimpleCanvasItem::ChildMouseFilter) {
+ if (p->mouseFilter(e))
return;
}
p = p->parent();
@@ -532,7 +533,7 @@ void QSimpleCanvasGraphicsView::paintEvent(QPaintEvent *pe)
int frametimer = canvas->frameTimer.elapsed();
gfxCanvasTiming.append(QSimpleCanvasTiming(r, frametimer, canvas->lrpTime, tbf));
canvas->lrpTime = 0;
- if(canvas->canvasServer)
+ if (canvas->canvasServer)
canvas->canvasServer->addTiming(canvas->lrpTime, frametimer, tbf);
}
@@ -562,20 +563,20 @@ void QSimpleCanvasPrivate::init(QSimpleCanvas::CanvasMode mode)
{
this->mode = mode;
- if(mode == QSimpleCanvas::SimpleCanvas)
+ if (mode == QSimpleCanvas::SimpleCanvas)
qWarning("QSimpleCanvas: Using simple canvas");
else
qWarning("QSimpleCanvas: Using GraphicsView canvas");
- if(fullUpdate())
+ if (fullUpdate())
qWarning("QSimpleCanvas: Full update enabled");
- if(continuousUpdate())
+ if (continuousUpdate())
qWarning("QSimpleCanvas: Continuous update enabled");
QByteArray env = qgetenv("GFX_CANVAS_SERVER_PORT");
- if(!env.isEmpty()){
+ if (!env.isEmpty()){
int port = env.toInt();
- if(port >= 1024)
+ if (port >= 1024)
canvasServer = new QSimpleCanvasServer(port, q);
}
@@ -583,7 +584,7 @@ void QSimpleCanvasPrivate::init(QSimpleCanvas::CanvasMode mode)
root->setActiveFocusPanel(true);
q->setFocusPolicy(Qt::StrongFocus);
- if(mode == QSimpleCanvas::GraphicsView) {
+ if (mode == QSimpleCanvas::GraphicsView) {
view = new QSimpleCanvasGraphicsView(this);
QHBoxLayout *layout = new QHBoxLayout(q);
layout->setSpacing(0);
@@ -620,7 +621,7 @@ QSimpleCanvas::~QSimpleCanvas()
void QSimpleCanvasPrivate::paint(QPainter &p)
{
#if defined(QFX_RENDER_QPAINTER)
- if(!isSetup)
+ if (!isSetup)
root->d_func()->setupPainting(0, q->rect());
lrpTimer.start();
@@ -659,7 +660,7 @@ void QSimpleCanvas::keyReleaseEvent(QKeyEvent *event)
void QSimpleCanvas::inputMethodEvent(QInputMethodEvent *event)
{
- if(d->focusItem)
+ if (d->focusItem)
d->focusItem->inputMethodEvent(event);
else
QWidget::inputMethodEvent(event);
@@ -667,14 +668,14 @@ void QSimpleCanvas::inputMethodEvent(QInputMethodEvent *event)
QVariant QSimpleCanvas::inputMethodQuery(Qt::InputMethodQuery query) const
{
- if(d->focusItem)
+ if (d->focusItem)
return d->focusItem->inputMethodQuery(query);
return QWidget::inputMethodQuery(query);
}
void QSimpleCanvas::mousePressEvent(QMouseEvent *e)
{
- if(d->isSimpleCanvas() &&
+ if (d->isSimpleCanvas() &&
(d->filter(e) || d->deliverMousePress(d->root, e))) {
e->accept();
} else {
@@ -684,7 +685,7 @@ void QSimpleCanvas::mousePressEvent(QMouseEvent *e)
void QSimpleCanvas::mouseDoubleClickEvent(QMouseEvent *e)
{
- if(d->isSimpleCanvas() &&
+ if (d->isSimpleCanvas() &&
(d->filter(e) || d->deliverMousePress(d->root, e))) {
e->accept();
} else {
@@ -694,9 +695,9 @@ void QSimpleCanvas::mouseDoubleClickEvent(QMouseEvent *e)
void QSimpleCanvas::mouseMoveEvent(QMouseEvent *e)
{
- if(d->isSimpleCanvas() && d->filter(e)) {
+ if (d->isSimpleCanvas() && d->filter(e)) {
e->accept();
- } else if(d->isSimpleCanvas() && d->lastMouseItem) {
+ } else if (d->isSimpleCanvas() && d->lastMouseItem) {
QPoint p = d->lastMouseItem->mapFromScene(e->pos()).toPoint();
QGraphicsSceneMouseEvent *me = d->mouseEventToSceneMouseEvent(e, p);
d->sendMouseEvent(d->lastMouseItem, me);
@@ -709,9 +710,9 @@ void QSimpleCanvas::mouseMoveEvent(QMouseEvent *e)
void QSimpleCanvas::mouseReleaseEvent(QMouseEvent *e)
{
- if(d->isSimpleCanvas() && d->filter(e)) {
+ if (d->isSimpleCanvas() && d->filter(e)) {
e->accept();
- } else if(d->isSimpleCanvas() && d->lastMouseItem) {
+ } else if (d->isSimpleCanvas() && d->lastMouseItem) {
QPoint p = d->lastMouseItem->mapFromScene(e->pos()).toPoint();
QGraphicsSceneMouseEvent *me = d->mouseEventToSceneMouseEvent(e, p);
d->sendMouseEvent(d->lastMouseItem, me);
@@ -733,7 +734,7 @@ void QSimpleCanvas::focusInEvent(QFocusEvent *event)
} else {
QSimpleCanvasItem *panel = activeFocusPanel();
QSimpleCanvasItem *focusItem = 0;
- if(panel->isFocusable())
+ if (panel->isFocusable())
focusItem = panel;
else
focusItem = QSimpleCanvasItem::findNextFocus(panel);
@@ -774,7 +775,7 @@ bool QSimpleCanvas::focusNextPrevChild(bool)
QSimpleCanvasItem *panel = activeFocusPanel();
QSimpleCanvasItem *item = 0;
- if(panel->isFocusable())
+ if (panel->isFocusable())
item = panel;
else
item = next ? QSimpleCanvasItem::findNextFocus(panel) : QSimpleCanvasItem::findPrevFocus(panel);
@@ -797,7 +798,7 @@ void QSimpleCanvas::showEvent(QShowEvent *e)
#if defined(QFX_RENDER_OPENGL)
d->egl.resize(width(), height());
#endif
- if(d->isGraphicsView())
+ if (d->isGraphicsView())
d->view->setSceneRect(rect());
QWidget::showEvent(e);
@@ -808,7 +809,7 @@ void QSimpleCanvas::resizeEvent(QResizeEvent *e)
#if defined(QFX_RENDER_OPENGL)
d->egl.resize(width(), height());
#endif
- if(d->isGraphicsView())
+ if (d->isGraphicsView())
d->view->setSceneRect(rect());
QWidget::resizeEvent(e);
}
@@ -821,7 +822,7 @@ void QSimpleCanvas::remDirty(QSimpleCanvasItem *c)
void QSimpleCanvas::queueUpdate()
{
- if(!d->timer) {
+ if (!d->timer) {
QCoreApplication::postEvent(this, new QEvent(QEvent::User));
d->timer = 1;
}
@@ -830,15 +831,15 @@ void QSimpleCanvas::queueUpdate()
void QSimpleCanvas::addDirty(QSimpleCanvasItem *c)
{
queueUpdate();
- if(d->isSimpleCanvas()) {
+ if (d->isSimpleCanvas()) {
d->oldDirty |= c->d_func()->data()->lastPaintRect;
#if defined(QFX_RENDER_OPENGL)
// Check for filters
QSimpleCanvasItem *fi = c->parent();
while(fi) {
- if(fi->d_func()->data()->dirty) {
+ if (fi->d_func()->data()->dirty) {
break;
- } else if(fi->filter()) {
+ } else if (fi->filter()) {
fi->update();
break;
}
@@ -852,14 +853,14 @@ void QSimpleCanvas::addDirty(QSimpleCanvasItem *c)
QRect QSimpleCanvasPrivate::dirtyItemClip() const
{
QRect rv;
- if(isSimpleCanvas()) {
+ if (isSimpleCanvas()) {
#if defined(QFX_RENDER_OPENGL)
QRectF r;
- for(int ii = 0; ii < dirtyItems.count(); ++ii)
+ for (int ii = 0; ii < dirtyItems.count(); ++ii)
r |= dirtyItems.at(ii)->d_func()->data()->lastPaintRect;
rv = egl.map(r);
#else
- for(int ii = 0; ii < dirtyItems.count(); ++ii)
+ for (int ii = 0; ii < dirtyItems.count(); ++ii)
rv |= dirtyItems.at(ii)->d_func()->data()->lastPaintRect;
#endif
}
@@ -868,7 +869,7 @@ QRect QSimpleCanvasPrivate::dirtyItemClip() const
QRegion QSimpleCanvasPrivate::resetDirty()
{
- if(isSimpleCanvas()) {
+ if (isSimpleCanvas()) {
#if defined(QFX_RENDER_OPENGL)
QRect r = egl.map(oldDirty) | dirtyItemClip();
#else
@@ -876,12 +877,12 @@ QRegion QSimpleCanvasPrivate::resetDirty()
#endif
if (!r.isEmpty())
r.adjust(-1,-1,2,2); //make sure we get everything (since we rounded from floats to ints)
- for(int ii = 0; ii < dirtyItems.count(); ++ii)
+ for (int ii = 0; ii < dirtyItems.count(); ++ii)
static_cast<QSimpleCanvasItemPrivate*>(dirtyItems.at(ii)->d_ptr)->data()->dirty = false;
dirtyItems.clear();
oldDirty = QRect();
- if(fullUpdate())
+ if (fullUpdate())
return QRegion();
else
return QRegion(r);
@@ -897,7 +898,7 @@ QSimpleCanvasItem *QSimpleCanvas::focusItem() const
QSimpleCanvasItem *QSimpleCanvas::activeFocusPanel() const
{
- if(d->focusPanels.isEmpty())
+ if (d->focusPanels.isEmpty())
return 0;
else
return d->focusPanels.top();
@@ -905,7 +906,7 @@ QSimpleCanvasItem *QSimpleCanvas::activeFocusPanel() const
bool QSimpleCanvas::event(QEvent *e)
{
- if(e->type() == QEvent::User && d->isSimpleCanvas()) {
+ if (e->type() == QEvent::User && d->isSimpleCanvas()) {
d->timer = 0;
d->isSetup = true;
#if defined(QFX_RENDER_OPENGL1)
@@ -920,7 +921,7 @@ bool QSimpleCanvas::event(QEvent *e)
int tbf = d->frameTimer.restart();
#if defined(QFX_RENDER_QPAINTER)
- if(r.isEmpty() || fullUpdate())
+ if (r.isEmpty() || fullUpdate())
repaint();
else
repaint(r);
@@ -929,7 +930,7 @@ bool QSimpleCanvas::event(QEvent *e)
QRect br = r.boundingRect();
QRect nr(br.x(), height() - br.y() - br.height(), br.width(), br.height());
- if(r.isEmpty() || fullUpdate())
+ if (r.isEmpty() || fullUpdate())
d->egl.updateGL();
else
d->egl.updateGL(nr);
@@ -939,10 +940,10 @@ bool QSimpleCanvas::event(QEvent *e)
int frametimer = d->frameTimer.elapsed();
gfxCanvasTiming.append(QSimpleCanvasTiming(r, frametimer, d->lrpTime, tbf));
- if(d->canvasServer)
+ if (d->canvasServer)
d->canvasServer->addTiming(d->lrpTime, frametimer, tbf);
d->lrpTime = 0;
- if(continuousUpdate())
+ if (continuousUpdate())
queueUpdate();
return true;
@@ -954,7 +955,7 @@ bool QSimpleCanvas::event(QEvent *e)
void QSimpleCanvas::paintEvent(QPaintEvent *)
{
#if defined(QFX_RENDER_QPAINTER)
- if(d->mode == SimpleCanvas) {
+ if (d->mode == SimpleCanvas) {
QPainter p(this);
d->paint(p);
}
@@ -963,7 +964,7 @@ void QSimpleCanvas::paintEvent(QPaintEvent *)
void QSimpleCanvas::dumpTiming()
{
- for(int ii = 0; ii < gfxCanvasTiming.size(); ++ii) {
+ for (int ii = 0; ii < gfxCanvasTiming.size(); ++ii) {
const QSimpleCanvasTiming &t = gfxCanvasTiming[ii];
qreal repaintFps = 1000. / qreal(t.time);
@@ -984,9 +985,9 @@ void QSimpleCanvas::dumpItems()
void QSimpleCanvas::checkState()
{
- if(d->isSimpleCanvas()) {
+ if (d->isSimpleCanvas()) {
QSimpleCanvasItemPrivate::FocusStateCheckRDatas r;
- if(d->root->d_func()->checkFocusState(0, &r))
+ if (d->root->d_func()->checkFocusState(0, &r))
qWarning() << "State OK";
}
}
@@ -996,7 +997,7 @@ void QSimpleCanvas::checkState()
*/
QImage QSimpleCanvas::asImage() const
{
- if(d->isSimpleCanvas()) {
+ if (d->isSimpleCanvas()) {
#if defined(QFX_RENDER_QPAINTER)
QImage img(width(),height(),QImage::Format_RGB32);
QPainter p(&img);
diff --git a/src/declarative/canvas/qsimplecanvas.h b/src/declarative/canvas/qsimplecanvas.h
index 3da7251..a35cbf5 100644
--- a/src/declarative/canvas/qsimplecanvas.h
+++ b/src/declarative/canvas/qsimplecanvas.h
@@ -100,7 +100,7 @@ namespace QSimpleCanvasConfig
(type == Translucent && f == QImage::Format_ARGB32_Premultiplied));
}
inline Image convert(ImageType type, const Image &img) {
- if(type == Opaque)
+ if (type == Opaque)
return img.convertToFormat(QImage::Format_RGB16);
else
return img.convertToFormat(QImage::Format_ARGB32_Premultiplied);
diff --git a/src/declarative/canvas/qsimplecanvas_graphicsview.cpp b/src/declarative/canvas/qsimplecanvas_graphicsview.cpp
index e3cdf19..dd4012b 100644
--- a/src/declarative/canvas/qsimplecanvas_graphicsview.cpp
+++ b/src/declarative/canvas/qsimplecanvas_graphicsview.cpp
@@ -90,8 +90,8 @@ void QSimpleGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
QSimpleCanvasItem *p = owner->parent();
while(p) {
- if(p->options() & QSimpleCanvasItem::ChildMouseFilter) {
- if(p->mouseFilter(event))
+ if (p->options() & QSimpleCanvasItem::ChildMouseFilter) {
+ if (p->mouseFilter(event))
return;
}
p = p->parent();
@@ -103,8 +103,8 @@ void QSimpleGraphicsItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
QSimpleCanvasItem *p = owner->parent();
while(p) {
- if(p->options() & QSimpleCanvasItem::ChildMouseFilter) {
- if(p->mouseFilter(event))
+ if (p->options() & QSimpleCanvasItem::ChildMouseFilter) {
+ if (p->mouseFilter(event))
return;
}
p = p->parent();
@@ -117,8 +117,8 @@ void QSimpleGraphicsItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
{
QSimpleCanvasItem *p = owner->parent();
while(p) {
- if(p->options() & QSimpleCanvasItem::ChildMouseFilter) {
- if(p->mouseFilter(event))
+ if (p->options() & QSimpleCanvasItem::ChildMouseFilter) {
+ if (p->mouseFilter(event))
return;
}
p = p->parent();
@@ -130,8 +130,8 @@ void QSimpleGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
QSimpleCanvasItem *p = owner->parent();
while(p) {
- if(p->options() & QSimpleCanvasItem::ChildMouseFilter) {
- if(p->mouseFilter(event))
+ if (p->options() & QSimpleCanvasItem::ChildMouseFilter) {
+ if (p->mouseFilter(event))
return;
}
p = p->parent();
@@ -142,14 +142,14 @@ void QSimpleGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
bool QSimpleGraphicsItem::sceneEvent(QEvent *event)
{
bool rv = QGraphicsItem::sceneEvent(event);
- if(event->type() == QEvent::UngrabMouse)
+ if (event->type() == QEvent::UngrabMouse)
owner->mouseUngrabEvent();
return rv;
}
QVariant QSimpleGraphicsItem::itemChange(GraphicsItemChange change, const QVariant &value)
{
- if(change == ItemSceneHasChanged) {
+ if (change == ItemSceneHasChanged) {
QSimpleCanvasItemPrivate *owner_d = static_cast<QSimpleCanvasItemPrivate*>(owner->d_ptr);
QSimpleCanvas *oldCanvas = owner_d->canvas;
owner_d->canvas = sceneMap[scene()];
@@ -164,13 +164,13 @@ QVariant QSimpleGraphicsItem::itemChange(GraphicsItemChange change, const QVaria
}
}
}
- if(owner->options() & QSimpleCanvasItem::MouseFilter)
+ if (owner->options() & QSimpleCanvasItem::MouseFilter)
owner_d->gvRemoveMouseFilter();
if (oldCanvas != owner_d->canvas)
owner->canvasChanged();
- if(owner->options() & QSimpleCanvasItem::MouseFilter)
+ if (owner->options() & QSimpleCanvasItem::MouseFilter)
owner_d->gvAddMouseFilter();
}
@@ -198,7 +198,7 @@ void QSimpleGraphicsItem::focusInEvent(QFocusEvent *)
void QSimpleCanvasItemPrivate::gvRemoveMouseFilter()
{
QGraphicsScene *scene = graphicsItem->scene();
- if(!scene) return;
+ if (!scene) return;
scene->removeEventFilter(q_ptr);
}
@@ -206,7 +206,7 @@ void QSimpleCanvasItemPrivate::gvRemoveMouseFilter()
void QSimpleCanvasItemPrivate::gvAddMouseFilter()
{
QGraphicsScene *scene = graphicsItem->scene();
- if(!scene) return;
+ if (!scene) return;
scene->installEventFilter(q_ptr);
}
diff --git a/src/declarative/canvas/qsimplecanvas_opengl.cpp b/src/declarative/canvas/qsimplecanvas_opengl.cpp
index f508aea..98f92d7 100644
--- a/src/declarative/canvas/qsimplecanvas_opengl.cpp
+++ b/src/declarative/canvas/qsimplecanvas_opengl.cpp
@@ -66,7 +66,7 @@ void CanvasEGLWidget::updateGL()
void CanvasEGLWidget::updateGL(const QRect &r)
{
- if(r.isEmpty())
+ if (r.isEmpty())
return;
_clip = r;
@@ -117,7 +117,7 @@ void QSimpleCanvasPrivate::paintGL()
p.stencilValue = 0;
p.opacity = 1;
p.forceParamRefresh = false;
- if(!isSetup)
+ if (!isSetup)
root->d_func()->setupPainting(0, QRect());
root->d_func()->paint(p);
@@ -126,12 +126,12 @@ void QSimpleCanvasPrivate::paintGL()
QGLFramebufferObject *QSimpleCanvasPrivate::acquire(int w, int h)
{
- if(w <= 0 || h <= 0)
+ if (w <= 0 || h <= 0)
return 0;
int size = qMax(w, h);
- for(int ii = 0; ii < frameBuffers.count(); ++ii) {
- if(frameBuffers.at(ii)->width() >= size) {
+ for (int ii = 0; ii < frameBuffers.count(); ++ii) {
+ if (frameBuffers.at(ii)->width() >= size) {
QGLFramebufferObject *rv = frameBuffers.at(ii);
frameBuffers.removeAt(ii);
return rv;
@@ -154,8 +154,8 @@ QGLFramebufferObject *QSimpleCanvasPrivate::acquire(int w, int h)
void QSimpleCanvasPrivate::release(QGLFramebufferObject *buf)
{
int size = qMax(buf->width(), buf->height());
- for(int ii = 0; ii < frameBuffers.count(); ++ii) {
- if(frameBuffers.at(ii)->width() >= size) {
+ for (int ii = 0; ii < frameBuffers.count(); ++ii) {
+ if (frameBuffers.at(ii)->width() >= size) {
frameBuffers.insert(ii, buf);
return;
}
@@ -178,7 +178,7 @@ QSimpleCanvas::Matrix QSimpleCanvasItemPrivate::localTransform() const
trans.translate(to.x(), to.y());
trans.scale(q->scale(), q->scale());
trans.translate(-to.x(), -to.y());
- if(data()->transformUser)
+ if (data()->transformUser)
trans *= *data()->transformUser;
return trans;
}
@@ -188,13 +188,13 @@ void QSimpleCanvasItemPrivate::simplePaintChild(const GLPaintParameters &params,
Q_Q(QSimpleCanvasItem);
GLPaintParameters childParams = params;
- if(clip)
+ if (clip)
++childParams.stencilValue;
- if(child->d_func()->data()->activeOpacity != 0) {
+ if (child->d_func()->data()->activeOpacity != 0) {
childParams.boundingRect = child->boundingRect();
- if(child->filter() && child->filter()->enabled()) {
+ if (child->filter() && child->filter()->enabled()) {
QSimpleCanvasItem::GLPainter painter(q);
painter.activeTransform = child->d_func()->data()->transformActive;
painter.activeOpacity = child->d_func()->data()->activeOpacity;
@@ -209,7 +209,7 @@ void QSimpleCanvasItemPrivate::simplePaintChild(const GLPaintParameters &params,
void QSimpleCanvasItemPrivate::paintChild(const GLPaintParameters &params,
QSimpleCanvasItem *child)
{
- if(params.forceParamRefresh) {
+ if (params.forceParamRefresh) {
QSimpleCanvas::Matrix t = child->d_func()->data()->transformActive;
qreal o = child->d_func()->data()->activeOpacity;
setupChildState(child);
@@ -226,10 +226,10 @@ void QSimpleCanvasItemPrivate::setupChildState(QSimpleCanvasItem *child)
{
qreal visible = child->visible();
child->d_func()->data()->activeOpacity = data()->activeOpacity;
- if(visible != 1)
+ if (visible != 1)
child->d_func()->data()->activeOpacity *= visible;
- if(child->d_func()->data()->activeOpacity != 0) {
+ if (child->d_func()->data()->activeOpacity != 0) {
// Calculate child's transform
qreal x = child->x();
qreal y = child->y();
@@ -238,19 +238,19 @@ void QSimpleCanvasItemPrivate::setupChildState(QSimpleCanvasItem *child)
QSimpleCanvas::Matrix &am = child->d_func()->data()->transformActive;
am = data()->transformActive;
- if(x != 0 || y != 0)
+ if (x != 0 || y != 0)
am.translate(x, y);
- if(scale != 1) {
+ if (scale != 1) {
QPointF to = child->d_func()->transformOrigin();
- if(to.x() != 0. || to.y() != 0.)
+ if (to.x() != 0. || to.y() != 0.)
am.translate(to.x(), to.y());
am.scale(scale, scale);
- if(to.x() != 0. || to.y() != 0.)
+ if (to.x() != 0. || to.y() != 0.)
am.translate(-to.x(), -to.y());
}
- if(child->d_func()->data()->transformUser)
+ if (child->d_func()->data()->transformUser)
am *= *child->d_func()->data()->transformUser;
- if(flip) {
+ if (flip) {
QRectF br = child->boundingRect();
am.translate(br.width() / 2., br.height() / 2);
am.rotate(180, (flip & QSimpleCanvasItem::VerticalFlip)?1:0, (flip & QSimpleCanvasItem::HorizontalFlip)?1:0, 0);
@@ -265,15 +265,15 @@ QRectF QSimpleCanvasItemPrivate::setupPainting(int version, const QRect &boundin
Q_Q(QSimpleCanvasItem);
QRectF filteredBoundRect = q->boundingRect();
- if(filter)
+ if (filter)
filteredBoundRect = filter->itemBoundingRect(filteredBoundRect);
QRectF rv = data()->transformActive.mapRect(filteredBoundRect);
- for(int ii = 0; ii < children.count(); ++ii) {
+ for (int ii = 0; ii < children.count(); ++ii) {
QSimpleCanvasItem *child = children.at(ii);
setupChildState(child);
- if(child->d_func()->data()->activeOpacity != 0)
+ if (child->d_func()->data()->activeOpacity != 0)
rv |= child->d_func()->setupPainting(version, bounding);
}
@@ -283,7 +283,7 @@ QRectF QSimpleCanvasItemPrivate::setupPainting(int version, const QRect &boundin
void QSimpleCanvasItemPrivate::paint(GLPaintParameters &oldParams, QSimpleCanvasFilter::Layer layer)
{
- if(!layer)
+ if (!layer)
return;
Q_Q(QSimpleCanvasItem);
@@ -299,8 +299,8 @@ void QSimpleCanvasItemPrivate::paint(GLPaintParameters &oldParams, QSimpleCanvas
width, 0 };
// XXX Handle separate cliping modes
- if(clip) {
- if(params.stencilValue == 255)
+ if (clip) {
+ if (params.stencilValue == 255)
qWarning()
<< "OpenGL: Clip recursion greater than 255 not permitted.";
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
@@ -341,17 +341,17 @@ void QSimpleCanvasItemPrivate::paint(GLPaintParameters &oldParams, QSimpleCanvas
zOrderChildren();
int upto = 0;
- for(upto = 0; upto < children.count(); ++upto) {
+ for (upto = 0; upto < children.count(); ++upto) {
QSimpleCanvasItem *c = children.at(upto);
- if(c->z() < 0) {
- if(layer & QSimpleCanvasFilter::ChildrenUnderItem)
+ if (c->z() < 0) {
+ if (layer & QSimpleCanvasFilter::ChildrenUnderItem)
paintChild(params, c);
} else {
break;
}
}
- if(layer & QSimpleCanvasFilter::Item &&
+ if (layer & QSimpleCanvasFilter::Item &&
q->options() & QSimpleCanvasItem::HasContents) {
QSimpleCanvasItem::GLPainter painter(q);
painter.activeTransform = data()->transformActive;
@@ -361,14 +361,14 @@ void QSimpleCanvasItemPrivate::paint(GLPaintParameters &oldParams, QSimpleCanvas
q->paintGLContents(painter);
}
- if(layer & QSimpleCanvasFilter::ChildrenAboveItem) {
- for(; upto < children.count(); ++upto) {
+ if (layer & QSimpleCanvasFilter::ChildrenAboveItem) {
+ for (; upto < children.count(); ++upto) {
QSimpleCanvasItem *c = children.at(upto);
paintChild(params, c);
}
}
- if(clip) {
+ if (clip) {
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
glStencilFunc(GL_EQUAL, params.stencilValue + 1, 0xFFFFFFFF);
glStencilOp(GL_KEEP, GL_KEEP, GL_DECR);
@@ -389,7 +389,7 @@ void QSimpleCanvasItemPrivate::paint(GLPaintParameters &oldParams, QSimpleCanvas
QGLShaderProgram *QSimpleCanvasItem::GLPainter::useTextureShader()
{
- if(activeOpacity == 1.) {
+ if (activeOpacity == 1.) {
item->basicShaders()->singleTexture()->enable();
item->basicShaders()->singleTexture()->setTransform(activeTransform);
return item->basicShaders()->singleTexture();
@@ -406,7 +406,7 @@ QGLShaderProgram *QSimpleCanvasItem::GLPainter::useColorShader(const QColor &col
{
QColor c = color;
item->basicShaders()->constantColor()->enable();
- if(activeOpacity != 1.) {
+ if (activeOpacity != 1.) {
c.setAlpha(int(c.alpha() * activeOpacity));
}
diff --git a/src/declarative/canvas/qsimplecanvas_opengl1.cpp b/src/declarative/canvas/qsimplecanvas_opengl1.cpp
index ad21c77..3fd8490 100644
--- a/src/declarative/canvas/qsimplecanvas_opengl1.cpp
+++ b/src/declarative/canvas/qsimplecanvas_opengl1.cpp
@@ -57,7 +57,7 @@ void CanvasEGLWidget::updateGL()
void CanvasEGLWidget::updateGL(const QRect &r)
{
- if(r.isEmpty())
+ if (r.isEmpty())
return;
_clip = r;
@@ -66,7 +66,7 @@ void CanvasEGLWidget::updateGL(const QRect &r)
void CanvasEGLWidget::paintGL()
{
- if(!_clip.isEmpty()) {
+ if (!_clip.isEmpty()) {
glEnable(GL_SCISSOR_TEST);
glScissor(_clip.x(), _clip.y(), _clip.width(), _clip.height());
} else {
@@ -124,7 +124,7 @@ void QSimpleCanvasPrivate::paintGL()
p.clipRect = p.sceneRect;
p.opacity = 1;
p.forceParamRefresh = false;
- if(!isSetup) {
+ if (!isSetup) {
unsigned int zero = 0;
root->d_func()->setupPainting(0, QRect(), &zero);
}
@@ -151,7 +151,7 @@ void QSimpleCanvasItemPrivate::simplePaintChild(const GLPaintParameters &params,
{
GLPaintParameters childParams = params;
- if(child->d_func()->activeOpacity != 0) {
+ if (child->d_func()->activeOpacity != 0) {
childParams.boundingRect = child->boundingRect();
child->d_func()->paint(childParams);
}
@@ -160,7 +160,7 @@ void QSimpleCanvasItemPrivate::simplePaintChild(const GLPaintParameters &params,
void QSimpleCanvasItemPrivate::paintChild(const GLPaintParameters &params,
QSimpleCanvasItem *child)
{
- if(params.forceParamRefresh) {
+ if (params.forceParamRefresh) {
QSimpleCanvas::Matrix t = child->d_func()->transformActive;
qreal o = child->d_func()->activeOpacity;
setupChildState(child);
@@ -177,10 +177,10 @@ void QSimpleCanvasItemPrivate::setupChildState(QSimpleCanvasItem *child)
{
qreal visible = child->visible().value();
child->d_func()->activeOpacity = activeOpacity;
- if(visible != 1)
+ if (visible != 1)
child->d_func()->activeOpacity *= visible;
- if(child->d_func()->activeOpacity != 0) {
+ if (child->d_func()->activeOpacity != 0) {
// Calculate child's transform
qreal x = child->x();
qreal y = child->y();
@@ -189,19 +189,19 @@ void QSimpleCanvasItemPrivate::setupChildState(QSimpleCanvasItem *child)
QSimpleCanvas::Matrix &am = child->d_func()->transformActive;
am = transformActive;
- if(x != 0 || y != 0)
+ if (x != 0 || y != 0)
am.translate(x, y);
- if(scale != 1) {
+ if (scale != 1) {
QPointF to = child->d_func()->transformOrigin();
- if(to.x() != 0. || to.y() != 0.)
+ if (to.x() != 0. || to.y() != 0.)
am.translate(to.x(), to.y());
am.scale(scale, scale);
- if(to.x() != 0. || to.y() != 0.)
+ if (to.x() != 0. || to.y() != 0.)
am.translate(-to.x(), -to.y());
}
- if(child->d_func()->transformUserSet)
+ if (child->d_func()->transformUserSet)
am *= child->d_func()->transformUser;
- if(flip) {
+ if (flip) {
QRectF br = child->boundingRect();
am.translate(br.width() / 2., br.height() / 2);
am.rotate(180, (flip & QSimpleCanvasItem::VerticalFlip)?1:0, (flip & QSimpleCanvasItem::HorizontalFlip)?1:0, 0);
@@ -218,15 +218,15 @@ QRectF QSimpleCanvasItemPrivate::setupPainting(int version, const QRect &boundin
unsigned int oldZero = *zero;
- for(int ii = 0; ii < children.count(); ++ii) {
+ for (int ii = 0; ii < children.count(); ++ii) {
QSimpleCanvasItem *child = children.at(ii);
setupChildState(child);
- if(child->d_func()->activeOpacity != 0)
+ if (child->d_func()->activeOpacity != 0)
rv |= child->d_func()->setupPainting(version, bounding, zero);
}
- if(clip || oldZero != *zero)
+ if (clip || oldZero != *zero)
(*zero)++;
transformActive.translate(0, 0, *zero);
@@ -241,17 +241,17 @@ void QSimpleCanvasItemPrivate::paintNoClip(GLPaintParameters &params, QSimpleCan
zOrderChildren();
int upto = 0;
- for(upto = 0; upto < children.count(); ++upto) {
+ for (upto = 0; upto < children.count(); ++upto) {
QSimpleCanvasItem *c = children.at(upto);
- if(c->zValue().value() < 0) {
- if(layer & QSimpleCanvasFilter::ChildrenUnderItem)
+ if (c->zValue().value() < 0) {
+ if (layer & QSimpleCanvasFilter::ChildrenUnderItem)
paintChild(params, c);
} else {
break;
}
}
- if(layer & QSimpleCanvasFilter::Item &&
+ if (layer & QSimpleCanvasFilter::Item &&
q->options() & QSimpleCanvasItem::HasContents) {
QSimpleCanvasItem::GLPainter painter(q);
painter.activeTransform = transformActive;
@@ -261,8 +261,8 @@ void QSimpleCanvasItemPrivate::paintNoClip(GLPaintParameters &params, QSimpleCan
q->paintGLContents(painter);
}
- if(layer & QSimpleCanvasFilter::ChildrenAboveItem) {
- for(; upto < children.count(); ++upto) {
+ if (layer & QSimpleCanvasFilter::ChildrenAboveItem) {
+ for (; upto < children.count(); ++upto) {
QSimpleCanvasItem *c = children.at(upto);
paintChild(params, c);
}
@@ -271,11 +271,11 @@ void QSimpleCanvasItemPrivate::paintNoClip(GLPaintParameters &params, QSimpleCan
void QSimpleCanvasItemPrivate::paint(GLPaintParameters &params, QSimpleCanvasFilter::Layer layer)
{
- if(!layer)
+ if (!layer)
return;
// XXX Handle separate cliping modes
- if(clip) {
+ if (clip) {
GLSaveScissor ss;
qreal width = params.boundingRect.width();
@@ -331,7 +331,7 @@ void QSimpleCanvasItemPrivate::paint(GLPaintParameters &params, QSimpleCanvasFil
int sr_height = ::ceilf(r.bottom()) - sr_y;
QRect sr(sr_x, sr_y, sr_width, sr_height);
- if(ss.wasEnabled())
+ if (ss.wasEnabled())
sr &= ss.rect();
glScissor(sr.x(), sr.y(), sr.width(), sr.height());
diff --git a/src/declarative/canvas/qsimplecanvas_p.h b/src/declarative/canvas/qsimplecanvas_p.h
index 44e5a7e..7bc7330 100644
--- a/src/declarative/canvas/qsimplecanvas_p.h
+++ b/src/declarative/canvas/qsimplecanvas_p.h
@@ -176,7 +176,7 @@ public:
GLBasicShaders *basicShaders() const
{
#if defined(QFX_RENDER_OPENGL2)
- if(!basicShadersInstance)
+ if (!basicShadersInstance)
basicShadersInstance = new GLBasicShaders;
return basicShadersInstance;
#else
diff --git a/src/declarative/canvas/qsimplecanvas_software.cpp b/src/declarative/canvas/qsimplecanvas_software.cpp
index 06e221e..c130a62 100644
--- a/src/declarative/canvas/qsimplecanvas_software.cpp
+++ b/src/declarative/canvas/qsimplecanvas_software.cpp
@@ -52,18 +52,18 @@ QRect QSimpleCanvasItemPrivate::setupPainting(int version, const QRect &bounding
QRect rv =
data()->transformActive.mapRect(boundingRectActive).toAlignedRect() & bounding;
QRect myBounding = bounding;
- if(q->clip())
+ if (q->clip())
myBounding &= rv;
- for(int ii = 0; ii < children.count(); ++ii) {
+ for (int ii = 0; ii < children.count(); ++ii) {
QSimpleCanvasItem *child = children.at(ii);
qreal visible = child->visible();
child->d_func()->data()->activeOpacity = data()->activeOpacity;
- if(visible != 1)
+ if (visible != 1)
child->d_func()->data()->activeOpacity *= visible;
- if(child->d_func()->data()->activeOpacity != 0) {
+ if (child->d_func()->data()->activeOpacity != 0) {
// Calculate child's transform
qreal x = child->x();
qreal y = child->y();
@@ -72,21 +72,21 @@ QRect QSimpleCanvasItemPrivate::setupPainting(int version, const QRect &bounding
QSimpleCanvas::Matrix &am = child->d_func()->data()->transformActive;
am = data()->transformActive;
- if(x != 0 || y != 0)
+ if (x != 0 || y != 0)
am.translate(x, y);
- if(scale != 1) {
+ if (scale != 1) {
QPointF to = child->d_func()->transformOrigin();
- if(to.x() != 0. || to.y() != 0.)
+ if (to.x() != 0. || to.y() != 0.)
am.translate(to.x(), to.y());
am.scale(scale, scale);
- if(to.x() != 0. || to.y() != 0.)
+ if (to.x() != 0. || to.y() != 0.)
am.translate(-to.x(), -to.y());
}
- if(child->d_func()->data()->transformUser)
+ if (child->d_func()->data()->transformUser)
am = *child->d_func()->data()->transformUser * am;
- if(flip) {
+ if (flip) {
QRectF br = child->boundingRect();
am.translate(br.width() / 2., br.height() / 2);
am.scale((flip & QSimpleCanvasItem::HorizontalFlip)?-1:1,
@@ -107,7 +107,7 @@ void QSimpleCanvasItemPrivate::paint(QPainter &p)
Q_Q(QSimpleCanvasItem);
QRect oldUcr;
- if(clip) {
+ if (clip) {
p.save();
QRectF boundingRectActive = q->boundingRect();
@@ -138,13 +138,13 @@ void QSimpleCanvasItemPrivate::paint(QPainter &p)
}
p.setWorldTransform(data()->transformActive);
- if(p.clipRegion().isEmpty()) {
+ if (p.clipRegion().isEmpty()) {
p.setClipRect(cr);
} else {
p.setClipRect(cr, Qt::IntersectClip);
}
- if(p.clipRegion().isEmpty()) {
+ if (p.clipRegion().isEmpty()) {
p.restore();
return;
}
@@ -153,9 +153,9 @@ void QSimpleCanvasItemPrivate::paint(QPainter &p)
zOrderChildren();
int upto = 0;
- for(upto = 0; upto < children.count(); ++upto) {
+ for (upto = 0; upto < children.count(); ++upto) {
QSimpleCanvasItem *c = children.at(upto);
- if(c->z() < 0) {
+ if (c->z() < 0) {
paintChild(p, c);
} else {
break;
@@ -165,18 +165,18 @@ void QSimpleCanvasItemPrivate::paint(QPainter &p)
p.setWorldTransform(data()->transformActive);
q->paintContents(p);
- for(; upto < children.count(); ++upto) {
+ for (; upto < children.count(); ++upto) {
QSimpleCanvasItem *c = children.at(upto);
paintChild(p, c);
}
- if(clip)
+ if (clip)
p.restore();
}
void QSimpleCanvasItemPrivate::paintChild(QPainter &p, QSimpleCanvasItem *c)
{
- if(c->d_func()->data()->activeOpacity != 0) {
+ if (c->d_func()->data()->activeOpacity != 0) {
qreal op = p.opacity();
p.setOpacity(c->d_func()->data()->activeOpacity);
diff --git a/src/declarative/canvas/qsimplecanvasfilter.cpp b/src/declarative/canvas/qsimplecanvasfilter.cpp
index 00c88c5..5bc6b35 100644
--- a/src/declarative/canvas/qsimplecanvasfilter.cpp
+++ b/src/declarative/canvas/qsimplecanvasfilter.cpp
@@ -64,7 +64,7 @@ QSimpleCanvasFilter::QSimpleCanvasFilter(QObject *parent)
QSimpleCanvasFilter::~QSimpleCanvasFilter()
{
- if(d->item) d->item->setFilter(0);
+ if (d->item) d->item->setFilter(0);
delete d; d = 0;
}
@@ -80,7 +80,7 @@ bool QSimpleCanvasFilter::enabled() const
void QSimpleCanvasFilter::setEnabled(bool e)
{
- if(e == d->enabled)
+ if (e == d->enabled)
return;
d->enabled = e;
emit enabledChanged();
@@ -96,7 +96,7 @@ QGLFramebufferObject *QSimpleCanvasFilter::renderToFBO(float scale, const QRectF
QSimpleCanvasItem *item = d->item;
QRect br = item->itemBoundingRect();
- if(br.isEmpty())
+ if (br.isEmpty())
return 0;
QGLFramebufferObject *fbo =
item->canvas()->d->acquire(int(br.width() * scale), int(br.height() * scale));
@@ -141,7 +141,7 @@ QGLFramebufferObject *QSimpleCanvasFilter::renderToFBO(const QRectF &src, const
QSimpleCanvasItem *item = d->item;
QRect br = item->itemBoundingRect();
- if(br.isEmpty())
+ if (br.isEmpty())
return 0;
QGLFramebufferObject *fbo =
item->canvas()->d->acquire(br.width(), br.height());
@@ -181,7 +181,7 @@ QGLFramebufferObject *QSimpleCanvasFilter::acquireFBO(const QSize &s)
#if defined(QFX_RENDER_OPENGL2)
QSize size;
QSimpleCanvasItem *item = d->item;
- if(size.isNull()) {
+ if (size.isNull()) {
QRect br = item->itemBoundingRect();
size = br.size();
} else {
@@ -245,14 +245,14 @@ QSimpleCanvasItem *QSimpleCanvasFilter::item() const
void QSimpleCanvasFilter::setItem(QSimpleCanvasItem *i)
{
- if(d->item == i)
+ if (d->item == i)
return;
- if(d->item) {
+ if (d->item) {
d->item->setFilter(0);
d->item = 0;
}
- if(i->filter() != this) {
+ if (i->filter() != this) {
i->setFilter(this);
} else {
d->item = i;
@@ -283,23 +283,23 @@ void QSimpleCanvasFilter::filter(QPainter &)
void QSimpleCanvasFilter::update()
{
- if(d->item)
+ if (d->item)
d->item->update();
}
#if defined(QFX_RENDER_OPENGL2)
bool QSimpleCanvasFilterPrivate::isSimpleItem(QSimpleCanvasItem *item, QSimpleCanvasItem **out, QSimpleCanvas::Matrix *mout)
{
- if(item->options() & QSimpleCanvasItem::SimpleItem && !item->hasChildren()) {
+ if (item->options() & QSimpleCanvasItem::SimpleItem && !item->hasChildren()) {
*out = item;
return true;
- } else if(!(item->options() & QSimpleCanvasItem::HasContents) &&
+ } else if (!(item->options() & QSimpleCanvasItem::HasContents) &&
item->children().count() == 1) {
QSimpleCanvasItem *child = item->children().first();
- if(child->filter() && child->filter()->enabled())
+ if (child->filter() && child->filter()->enabled())
return false;
bool rv = isSimpleItem(child, out, mout);
- if(rv)
+ if (rv)
*mout *= child->d_func()->localTransform();
return rv;
} else {
diff --git a/src/declarative/canvas/qsimplecanvasitem.cpp b/src/declarative/canvas/qsimplecanvasitem.cpp
index 446e331..62a44e4 100644
--- a/src/declarative/canvas/qsimplecanvasitem.cpp
+++ b/src/declarative/canvas/qsimplecanvasitem.cpp
@@ -57,7 +57,7 @@ QSimpleCanvasItemData::QSimpleCanvasItemData()
QSimpleCanvasItemData::~QSimpleCanvasItemData()
{
- if(transformUser)
+ if (transformUser)
delete transformUser;
}
@@ -265,7 +265,7 @@ QSimpleCanvasItem::TransformOrigin QSimpleCanvasItem::transformOrigin() const
void QSimpleCanvasItem::setTransformOrigin(TransformOrigin origin)
{
Q_D(QSimpleCanvasItem);
- if(origin != d->origin) {
+ if (origin != d->origin) {
d->origin = origin;
update();
}
@@ -297,7 +297,7 @@ QSimpleCanvasItem *QSimpleCanvasItem::parent() const
void QSimpleCanvasItemPrivate::zOrderChildren()
{
- if(!needsZOrder || children.count() <= 1)
+ if (!needsZOrder || children.count() <= 1)
return;
needsZOrder = false;
@@ -310,10 +310,10 @@ void QSimpleCanvasItemPrivate::zOrderChildren()
swap = false;
QSimpleCanvasItem *item = children.first();
qreal z = item->z();
- for(int ii = 1; ii < children.count(); ++ii) {
+ for (int ii = 1; ii < children.count(); ++ii) {
QSimpleCanvasItem *i2 = children.at(ii);
qreal z2 = i2->z();
- if(z2 < z) {
+ if (z2 < z) {
swap = true;
children[ii] = item;
children[ii - 1] = i2;
@@ -329,21 +329,21 @@ void QSimpleCanvasItemPrivate::canvasChanged(QSimpleCanvas *newCanvas, QSimpleCa
{
Q_Q(QSimpleCanvasItem);
canvas = newCanvas;
- if(options & QSimpleCanvasItem::MouseFilter) {
- if(oldCanvas) oldCanvas->d->removeMouseFilter(q);
- if(newCanvas) newCanvas->d->installMouseFilter(q);
+ if (options & QSimpleCanvasItem::MouseFilter) {
+ if (oldCanvas) oldCanvas->d->removeMouseFilter(q);
+ if (newCanvas) newCanvas->d->installMouseFilter(q);
}
- if(newCanvas) {
- if(!oldCanvas && hasFocus)
+ if (newCanvas) {
+ if (!oldCanvas && hasFocus)
newCanvas->d->setFocusItem(q, Qt::OtherFocusReason, false);
- if(wantsActiveFocusPanelPendingCanvas) {
+ if (wantsActiveFocusPanelPendingCanvas) {
hasBeenActiveFocusPanel = true;
newCanvas->d->setActiveFocusPanel(q);
wantsActiveFocusPanelPendingCanvas = false;
}
}
- for(int ii = 0; ii < children.count(); ++ii)
+ for (int ii = 0; ii < children.count(); ++ii)
children.at(ii)->d_func()->canvasChanged(newCanvas, oldCanvas);
q->canvasChanged();
}
@@ -351,12 +351,12 @@ void QSimpleCanvasItemPrivate::canvasChanged(QSimpleCanvas *newCanvas, QSimpleCa
void QSimpleCanvasItem::setFocus(bool focus)
{
Q_D(QSimpleCanvasItem);
- if(d->hasFocus == focus)
+ if (d->hasFocus == focus)
return;
QSimpleCanvas *c = canvas();
- if(c) {
- if(focus)
+ if (c) {
+ if (focus)
c->d->setFocusItem(this, Qt::OtherFocusReason);
else
c->d->clearFocusItem(this);
@@ -369,9 +369,9 @@ void QSimpleCanvasItem::setFocus(bool focus)
qreal QSimpleCanvasItem::x() const
{
Q_D(const QSimpleCanvasItem);
- if(d->graphicsItem)
+ if (d->graphicsItem)
return d->graphicsItem->x();
- else if(d->data_ptr)
+ else if (d->data_ptr)
return d->data()->x;
else
return 0;
@@ -380,9 +380,9 @@ qreal QSimpleCanvasItem::x() const
qreal QSimpleCanvasItem::y() const
{
Q_D(const QSimpleCanvasItem);
- if(d->graphicsItem)
+ if (d->graphicsItem)
return d->graphicsItem->y();
- else if(d->data_ptr)
+ else if (d->data_ptr)
return d->data()->y;
else
return 0;
@@ -391,9 +391,9 @@ qreal QSimpleCanvasItem::y() const
qreal QSimpleCanvasItem::z() const
{
Q_D(const QSimpleCanvasItem);
- if(d->graphicsItem)
+ if (d->graphicsItem)
return d->graphicsItem->zValue();
- else if(d->data_ptr)
+ else if (d->data_ptr)
return d->data()->z;
else
return 0;
@@ -402,12 +402,12 @@ qreal QSimpleCanvasItem::z() const
void QSimpleCanvasItem::setX(qreal x)
{
Q_D(QSimpleCanvasItem);
- if(x == this->x())
+ if (x == this->x())
return;
qreal oldX = this->x();
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
d->graphicsItem->setPos(x, y());
} else {
d->data()->x = x;
@@ -421,12 +421,12 @@ void QSimpleCanvasItem::setX(qreal x)
void QSimpleCanvasItem::setY(qreal y)
{
Q_D(QSimpleCanvasItem);
- if(y == this->y())
+ if (y == this->y())
return;
qreal oldY = this->y();
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
d->graphicsItem->setPos(x(), y);
} else {
d->data()->y = y;
@@ -440,12 +440,12 @@ void QSimpleCanvasItem::setY(qreal y)
void QSimpleCanvasItem::setZ(qreal z)
{
Q_D(QSimpleCanvasItem);
- if(z == this->z())
+ if (z == this->z())
return;
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
- if(z < 0)
+ if (z < 0)
d->graphicsItem->setFlag(QGraphicsItem::ItemStacksBehindParent,
true);
else
@@ -455,11 +455,11 @@ void QSimpleCanvasItem::setZ(qreal z)
d->graphicsItem->setZValue(z);
} else {
- if(d->data()->z == z)
+ if (d->data()->z == z)
return;
d->data()->z = z;
- if(parent())
+ if (parent())
static_cast<QSimpleCanvasItemPrivate*>(parent()->d_ptr)->needsZOrder = true;
update();
}
@@ -475,7 +475,7 @@ void QSimpleCanvasItem::setWidth(qreal w)
{
Q_D(QSimpleCanvasItem);
d->widthValid = true;
- if(d->width == w)
+ if (d->width == w)
return;
qreal oldWidth = d->width;
@@ -490,7 +490,7 @@ void QSimpleCanvasItem::setWidth(qreal w)
void QSimpleCanvasItem::setImplicitWidth(qreal w)
{
Q_D(QSimpleCanvasItem);
- if(d->width == w || widthValid())
+ if (d->width == w || widthValid())
return;
qreal oldWidth = d->width;
@@ -518,7 +518,7 @@ void QSimpleCanvasItem::setHeight(qreal h)
{
Q_D(QSimpleCanvasItem);
d->heightValid = true;
- if(d->height == h)
+ if (d->height == h)
return;
qreal oldHeight = d->height;
@@ -533,7 +533,7 @@ void QSimpleCanvasItem::setHeight(qreal h)
void QSimpleCanvasItem::setImplicitHeight(qreal h)
{
Q_D(QSimpleCanvasItem);
- if(d->height == h || heightValid())
+ if (d->height == h || heightValid())
return;
qreal oldHeight = d->height;
@@ -557,7 +557,7 @@ void QSimpleCanvasItem::setPos(const QPointF &point)
qreal oldX = x();
qreal oldY = y();
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
d->graphicsItem->setPos(point);
} else {
d->data()->x = point.x();
@@ -579,13 +579,13 @@ void QSimpleCanvasItem::setScale(qreal s)
{
Q_D(QSimpleCanvasItem);
d->scale = s;
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
QTransform t;
QPointF to = transformOriginPoint();
- if(to.x() != 0. || to.y() != 0.)
+ if (to.x() != 0. || to.y() != 0.)
t.translate(to.x(), to.y());
t.scale(s, s);
- if(to.x() != 0. || to.y() != 0.)
+ if (to.x() != 0. || to.y() != 0.)
t.translate(-to.x(), -to.y());
d->graphicsItem->setTransform(t * d->graphicsItem->transform);
} else {
@@ -595,9 +595,9 @@ void QSimpleCanvasItem::setScale(qreal s)
bool QSimpleCanvasItem::isVisible() const
{
- if(visible() <= 0)
+ if (visible() <= 0)
return false;
- else if(!parent())
+ else if (!parent())
return true;
else
return parent()->isVisible();
@@ -606,9 +606,9 @@ bool QSimpleCanvasItem::isVisible() const
qreal QSimpleCanvasItem::visible() const
{
Q_D(const QSimpleCanvasItem);
- if(d->graphicsItem)
+ if (d->graphicsItem)
return d->graphicsItem->opacity();
- else if(d->data_ptr)
+ else if (d->data_ptr)
return d->data()->visible;
else
return 1;
@@ -617,17 +617,17 @@ qreal QSimpleCanvasItem::visible() const
void QSimpleCanvasItem::setVisible(qreal v)
{
Q_D(QSimpleCanvasItem);
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
d->graphicsItem->setOpacity(v);
} else {
- if(v == visible())
+ if (v == visible())
return;
- if(v == 0)
+ if (v == 0)
update();
d->data()->visible = v;
- if(v != 0)
+ if (v != 0)
update();
}
}
@@ -636,7 +636,7 @@ void QSimpleCanvasItem::addChild(QSimpleCanvasItem *c)
{
Q_D(QSimpleCanvasItem);
d->children.append(c);
- if(!d->graphicsItem)
+ if (!d->graphicsItem)
d->needsZOrder = true;
childrenChanged();
}
@@ -660,11 +660,11 @@ QSimpleCanvasItem takes ownership of filter.
void QSimpleCanvasItem::setFilter(QSimpleCanvasFilter *f)
{
Q_D(QSimpleCanvasItem);
- if(!d || f == d->filter)
+ if (!d || f == d->filter)
return;
d->filter = f;
- if(d->filter)
+ if (d->filter)
d->filter->setItem(this);
update();
}
@@ -683,7 +683,7 @@ bool QSimpleCanvasItem::hasChildren() const
QSimpleCanvasLayer *QSimpleCanvasItem::layer()
{
- if(parent())
+ if (parent())
return parent()->layer();
else
return 0;
@@ -692,18 +692,18 @@ QSimpleCanvasLayer *QSimpleCanvasItem::layer()
void QSimpleCanvasItem::update()
{
Q_D(QSimpleCanvasItem);
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
d->graphicsItem->update();
} else {
- if(!parent())
+ if (!parent())
return;
- if(d->data()->dirty || 0. == d->data()->visible) return;
+ if (d->data()->dirty || 0. == d->data()->visible) return;
QSimpleCanvasLayer *l = layer();
- if(l == this && parent())
+ if (l == this && parent())
l = parent()->layer();
- if(l) {
+ if (l) {
l->addDirty(this);
d->data()->dirty = true;
d->data()->transformValid = false;
@@ -720,10 +720,10 @@ bool QSimpleCanvasItem::clip() const
void QSimpleCanvasItem::setClip(bool c)
{
Q_D(const QSimpleCanvasItem);
- if(bool(d->clip) == c)
+ if (bool(d->clip) == c)
return;
- if(c)
+ if (c)
setClipType(ClipToRect);
else
setClipType(NoClip);
@@ -741,7 +741,7 @@ void QSimpleCanvasItem::setClipType(ClipType c)
{
Q_D(QSimpleCanvasItem);
d->clip = c;
- if(d->graphicsItem)
+ if (d->graphicsItem)
d->graphicsItem->setFlag(QGraphicsItem::ItemClipsChildrenToShape, bool(c));
else
update();
@@ -750,9 +750,9 @@ void QSimpleCanvasItem::setClipType(ClipType c)
Qt::MouseButtons QSimpleCanvasItem::acceptedMouseButtons() const
{
Q_D(const QSimpleCanvasItem);
- if(d->graphicsItem)
+ if (d->graphicsItem)
return d->graphicsItem->acceptedMouseButtons();
- else if(d->data_ptr)
+ else if (d->data_ptr)
return (Qt::MouseButtons)d->data()->buttons;
else
return Qt::NoButton;
@@ -761,7 +761,7 @@ Qt::MouseButtons QSimpleCanvasItem::acceptedMouseButtons() const
void QSimpleCanvasItem::setAcceptedMouseButtons(Qt::MouseButtons buttons)
{
Q_D(QSimpleCanvasItem);
- if(d->graphicsItem)
+ if (d->graphicsItem)
d->graphicsItem->setAcceptedMouseButtons(buttons);
else
d->data()->buttons = buttons;
@@ -776,7 +776,7 @@ QRect QSimpleCanvasItem::itemBoundingRect()
QPointF QSimpleCanvasItemPrivate::adjustFrom(const QPointF &p) const
{
#if defined(QFX_RENDER_OPENGL)
- if(!canvas)
+ if (!canvas)
return p;
QPointF rv(-1. + 2. * p.x() / qreal(canvas->width()),
@@ -791,7 +791,7 @@ QPointF QSimpleCanvasItemPrivate::adjustFrom(const QPointF &p) const
QRectF QSimpleCanvasItemPrivate::adjustFrom(const QRectF &r) const
{
#if defined(QFX_RENDER_OPENGL)
- if(!canvas)
+ if (!canvas)
return r;
qreal width = r.width() * 2. / qreal(canvas->width());
@@ -808,7 +808,7 @@ QRectF QSimpleCanvasItemPrivate::adjustFrom(const QRectF &r) const
QPointF QSimpleCanvasItemPrivate::adjustTo(const QPointF &p) const
{
#if defined(QFX_RENDER_OPENGL)
- if(!canvas)
+ if (!canvas)
return p;
QPointF rv(0.5 * (p.x() + 1.) * qreal(canvas->width()),
@@ -823,7 +823,7 @@ QPointF QSimpleCanvasItemPrivate::adjustTo(const QPointF &p) const
QRectF QSimpleCanvasItemPrivate::adjustTo(const QRectF &r) const
{
#if defined(QFX_RENDER_OPENGL)
- if(!canvas)
+ if (!canvas)
return r;
qreal width = 0.5 * r.width() * qreal(canvas->width());
@@ -840,7 +840,7 @@ QRectF QSimpleCanvasItemPrivate::adjustTo(const QRectF &r) const
QPointF QSimpleCanvasItem::mapFromScene(const QPointF &p) const
{
Q_D(const QSimpleCanvasItem);
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
return d->graphicsItem->mapFromScene(p);
} else {
QPointF mp = d->adjustFrom(p);
@@ -865,7 +865,7 @@ QPointF QSimpleCanvasItem::mapFromScene(const QPointF &p) const
QRectF QSimpleCanvasItem::mapFromScene(const QRectF &r) const
{
Q_D(const QSimpleCanvasItem);
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
return d->graphicsItem->mapFromScene(r).boundingRect();
} else {
QRectF mr = d->adjustFrom(r);
@@ -902,7 +902,7 @@ QRectF QSimpleCanvasItem::mapFromScene(const QRectF &r) const
QPointF QSimpleCanvasItem::mapToScene(const QPointF &p) const
{
Q_D(const QSimpleCanvasItem);
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
return d->graphicsItem->mapToScene(p);
} else {
d->freshenTransforms();
@@ -914,7 +914,7 @@ QPointF QSimpleCanvasItem::mapToScene(const QPointF &p) const
QRectF QSimpleCanvasItem::mapToScene(const QRectF &r) const
{
Q_D(const QSimpleCanvasItem);
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
return d->graphicsItem->mapToScene(r).boundingRect();
} else {
d->freshenTransforms();
@@ -927,7 +927,7 @@ int QSimpleCanvasItemPrivate::nextTransformVersion = 1;
void QSimpleCanvasItemPrivate::freshenTransforms() const
{
- if(freshenNeeded())
+ if (freshenNeeded())
doFreshenTransforms();
}
@@ -941,9 +941,9 @@ bool QSimpleCanvasItemPrivate::freshenNeeded() const
#else
const QSimpleCanvasItemPrivate *me = this;
while(me) {
- if(me->data_ptr && !me->data_ptr->transformValid)
+ if (me->data_ptr && !me->data_ptr->transformValid)
return true;
- if(me->parent)
+ if (me->parent)
me = me->parent->d_func();
else
me = 0;
@@ -955,31 +955,31 @@ bool QSimpleCanvasItemPrivate::freshenNeeded() const
void QSimpleCanvasItemPrivate::doFreshenTransforms() const
{
Q_Q(const QSimpleCanvasItem);
- if(parent)
+ if (parent)
parent->d_func()->doFreshenTransforms();
- if(freshenNeeded()) {
- if(parent)
+ if (freshenNeeded()) {
+ if (parent)
data()->transformActive = parent->d_func()->data()->transformActive;
else
data()->transformActive = QSimpleCanvas::Matrix();
data()->transformActive.translate(q->x(), q->y());
- if(scale != 1.) {
+ if (scale != 1.) {
QPointF to = transformOrigin();
- if(to.x() != 0. || to.y() != 0.)
+ if (to.x() != 0. || to.y() != 0.)
data()->transformActive.translate(to.x(), to.y());
data()->transformActive.scale(scale, scale);
- if(to.x() != 0. || to.y() != 0.)
+ if (to.x() != 0. || to.y() != 0.)
data()->transformActive.translate(-to.x(), -to.y());
}
Q_Q(const QSimpleCanvasItem);
#if defined(QFX_RENDER_OPENGL)
- if(q->d_func()->data()->transformUser)
+ if (q->d_func()->data()->transformUser)
data()->transformActive *= *q->d_func()->data()->transformUser;
#endif
- if(data()->flip) {
+ if (data()->flip) {
QRectF br = q->boundingRect();
data()->transformActive.translate(br.width() / 2., br.height() / 2);
#if defined(QFX_RENDER_OPENGL)
@@ -996,9 +996,9 @@ void QSimpleCanvasItemPrivate::doFreshenTransforms() const
QSimpleCanvas::Matrix QSimpleCanvasItem::transform() const
{
Q_D(const QSimpleCanvasItem);
- if(d->graphicsItem)
+ if (d->graphicsItem)
return QSimpleCanvasConfig::transformToMatrix(d->graphicsItem->transform);
- else if(d->data()->transformUser)
+ else if (d->data()->transformUser)
return *d->data()->transformUser;
else
return QSimpleCanvas::Matrix();
@@ -1007,11 +1007,11 @@ QSimpleCanvas::Matrix QSimpleCanvasItem::transform() const
void QSimpleCanvasItem::setTransform(const QSimpleCanvas::Matrix &m)
{
Q_D(QSimpleCanvasItem);
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
d->graphicsItem->transform = QSimpleCanvasConfig::matrixToTransform(m);
d->graphicsItem->setTransform(QTransform::fromScale(d->scale, d->scale) * d->graphicsItem->transform);
} else {
- if(!d->data()->transformUser)
+ if (!d->data()->transformUser)
d->data()->transformUser = new QSimpleCanvas::Matrix;
*d->data()->transformUser = m;
update();
@@ -1021,16 +1021,16 @@ void QSimpleCanvasItem::setTransform(const QSimpleCanvas::Matrix &m)
QSimpleCanvasItem *QSimpleCanvasItem::mouseGrabberItem() const
{
Q_D(const QSimpleCanvasItem);
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
QGraphicsScene *s = d->graphicsItem->scene();
- if(s) {
+ if (s) {
QGraphicsItem *item = s->mouseGrabberItem();
QSimpleGraphicsItem *dgi = static_cast<QSimpleGraphicsItem *>(item);
return dgi?static_cast<QSimpleCanvasItem*>(dgi->owner):0;
}
} else {
QSimpleCanvas *c = canvas();
- if(c)
+ if (c)
return c->d->lastMouseItem;
}
return 0;
@@ -1039,11 +1039,11 @@ QSimpleCanvasItem *QSimpleCanvasItem::mouseGrabberItem() const
void QSimpleCanvasItem::ungrabMouse()
{
Q_D(QSimpleCanvasItem);
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
d->graphicsItem->ungrabMouse();
} else {
QSimpleCanvas *c = canvas();
- if(c && c->d->lastMouseItem == this) {
+ if (c && c->d->lastMouseItem == this) {
c->d->lastMouseItem->mouseUngrabEvent();
c->d->lastMouseItem = 0;
}
@@ -1053,13 +1053,13 @@ void QSimpleCanvasItem::ungrabMouse()
void QSimpleCanvasItem::grabMouse()
{
Q_D(QSimpleCanvasItem);
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
d->graphicsItem->grabMouse();
} else {
QSimpleCanvas *c = canvas();
- if(c) {
- if(c->d->lastMouseItem != this) {
- if(c->d->lastMouseItem)
+ if (c) {
+ if (c->d->lastMouseItem != this) {
+ if (c->d->lastMouseItem)
c->d->lastMouseItem->mouseUngrabEvent();
c->d->lastMouseItem = this;
}
@@ -1094,7 +1094,7 @@ void QSimpleCanvasItemPrivate::setActiveFocus(bool f)
{
hasActiveFocus = f;
- if(graphicsItem) {
+ if (graphicsItem) {
if (f) {
if (!(graphicsItem->flags() & QGraphicsItem::ItemIsFocusable))
graphicsItem->setFlag(QGraphicsItem::ItemIsFocusable);
@@ -1111,9 +1111,9 @@ void QSimpleCanvasItemPrivate::setActiveFocus(bool f)
QSimpleCanvasItem::Flip QSimpleCanvasItem::flip() const
{
Q_D(const QSimpleCanvasItem);
- if(d->graphicsItem)
+ if (d->graphicsItem)
return NoFlip;
- else if(d->data_ptr)
+ else if (d->data_ptr)
return d->data()->flip;
else
return NoFlip;
@@ -1122,10 +1122,10 @@ QSimpleCanvasItem::Flip QSimpleCanvasItem::flip() const
void QSimpleCanvasItem::setFlip(Flip f)
{
Q_D(QSimpleCanvasItem);
- if(d->graphicsItem)
+ if (d->graphicsItem)
return;
- if(d->data()->flip == f)
+ if (d->data()->flip == f)
return;
d->data()->flip = f;
@@ -1142,15 +1142,15 @@ void QSimpleCanvasItem::setFlip(Flip f)
void QSimpleCanvasItem::stackUnder(QSimpleCanvasItem *item)
{
Q_D(QSimpleCanvasItem);
- if(d->graphicsItem)
+ if (d->graphicsItem)
return; // XXX
QSimpleCanvasItem *p = parent();
- if(!p || !item || item == this) return;
+ if (!p || !item || item == this) return;
QSimpleCanvasItemPrivate *parent_d_ptr = static_cast<QSimpleCanvasItemPrivate*>(p->d_ptr);
int idx = parent_d_ptr->children.indexOf(item);
- if(idx == -1) return;
+ if (idx == -1) return;
parent_d_ptr->children.removeAll(this);
idx = parent_d_ptr->children.indexOf(item);
@@ -1170,15 +1170,15 @@ void QSimpleCanvasItem::stackUnder(QSimpleCanvasItem *item)
void QSimpleCanvasItem::stackOver(QSimpleCanvasItem *item)
{
Q_D(QSimpleCanvasItem);
- if(d->graphicsItem)
+ if (d->graphicsItem)
return; // XXX
QSimpleCanvasItem *p = parent();
- if(!p || !item || item == this) return;
+ if (!p || !item || item == this) return;
QSimpleCanvasItemPrivate *parent_d_ptr = static_cast<QSimpleCanvasItemPrivate*>(p->d_ptr);
int idx = parent_d_ptr->children.indexOf(item);
- if(idx == -1) return;
+ if (idx == -1) return;
parent_d_ptr->children.removeAll(this);
idx = parent_d_ptr->children.indexOf(item);
@@ -1200,17 +1200,17 @@ void QSimpleCanvasItem::stackOver(QSimpleCanvasItem *item)
void QSimpleCanvasItem::stackAt(int index)
{
Q_D(QSimpleCanvasItem);
- if(d->graphicsItem)
+ if (d->graphicsItem)
return; // XXX
QSimpleCanvasItem *p = parent();
- if(!p) return;
+ if (!p) return;
QSimpleCanvasItemPrivate *parent_d_ptr = static_cast<QSimpleCanvasItemPrivate*>(p->d_ptr);
parent_d_ptr->children.removeAll(this);
- if(index < 0) index = 0;
- if(index > parent_d_ptr->children.size()) index = parent_d_ptr->children.size();
+ if (index < 0) index = 0;
+ if (index > parent_d_ptr->children.size()) index = parent_d_ptr->children.size();
parent_d_ptr->children.insert(index, this);
parent_d_ptr->needsZOrder = true;
@@ -1233,13 +1233,13 @@ int QSimpleCanvasItem::indexForChild(QSimpleCanvasItem *item)
bool QSimpleCanvasItem::eventFilter(QObject *o, QEvent *e)
{
Q_D(QSimpleCanvasItem);
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
switch(e->type()) {
case QEvent::GraphicsSceneMouseDoubleClick:
case QEvent::GraphicsSceneMouseMove:
case QEvent::GraphicsSceneMousePress:
case QEvent::GraphicsSceneMouseRelease:
- if(mouseFilter(static_cast<QGraphicsSceneMouseEvent *>(e)))
+ if (mouseFilter(static_cast<QGraphicsSceneMouseEvent *>(e)))
return true;
break;
default:
@@ -1255,44 +1255,44 @@ void QSimpleCanvasItem::setOptions(Options options, bool set)
Q_D(QSimpleCanvasItem);
Options old = (Options)d->options;
- if(options & IsFocusPanel) {
- if(!set) {
+ if (options & IsFocusPanel) {
+ if (!set) {
qWarning("QSimpleCanvasItem::setOptions: Cannot unset IsFocusPanel");
return;
- } else if(hasChildren()) {
+ } else if (hasChildren()) {
qWarning("QSimpleCanvasItem::setOptions: Cannot set IsFocusPanel once item has children");
return;
}
}
- if(options & IsFocusRealm) {
- if(!set) {
+ if (options & IsFocusRealm) {
+ if (!set) {
qWarning("QSimpleCanvasItem::setOptions: Cannot unset IsFocusRealm");
return;
}
}
- if(set)
+ if (set)
d->options |= options;
else
d->options &= ~options;
- if((d->options & IsFocusPanel) && (d->options & IsFocusRealm)) {
+ if ((d->options & IsFocusPanel) && (d->options & IsFocusRealm)) {
qWarning("QSimpleCanvasItem::setOptions: Cannot set both IsFocusPanel and IsFocusRealm. IsFocusRealm will be unset.");
d->options &= ~IsFocusRealm;
}
- if((old & MouseFilter) != (d->options & MouseFilter)) {
- if(d->graphicsItem) {
- if(d->options & MouseFilter)
+ if ((old & MouseFilter) != (d->options & MouseFilter)) {
+ if (d->graphicsItem) {
+ if (d->options & MouseFilter)
d->gvAddMouseFilter();
else
d->gvRemoveMouseFilter();
} else {
QSimpleCanvas *c = canvas();
- if(c) {
- if(d->options & MouseFilter)
+ if (c) {
+ if (d->options & MouseFilter)
c->d->installMouseFilter(this);
else
c->d->removeMouseFilter(this);
@@ -1314,7 +1314,7 @@ QSimpleCanvasItem::QSimpleCanvasItem(QSimpleCanvasItem *p)
QSimpleCanvasItem::~QSimpleCanvasItem()
{
Q_D(QSimpleCanvasItem);
- if(d->graphicsItem) {
+ if (d->graphicsItem) {
if ((d->options & (IsFocusPanel|IsFocusRealm)) && d->canvas)
d->canvas->d->focusPanelData.remove(this);
if (d->hasFocus && d->canvas) {
@@ -1324,24 +1324,24 @@ QSimpleCanvasItem::~QSimpleCanvasItem()
if (prnt && d->canvas->d->focusPanelData.value(prnt) == this)
d->canvas->d->focusPanelData.remove(prnt);
}
- if(d->filter)
+ if (d->filter)
delete d->filter;
qDeleteAll(children());
- if(parent())
+ if (parent())
parent()->remChild(this);
delete d->graphicsItem;
} else {
setOptions(MouseFilter, false);
- if(d->canvas){
- if(d->canvas->focusItem() == this)
+ if (d->canvas){
+ if (d->canvas->focusItem() == this)
d->canvas->d->focusItem = 0;
- if(d->canvas->d->lastFocusItem == this)
+ if (d->canvas->d->lastFocusItem == this)
d->canvas->d->lastFocusItem = 0;
- if(d->hasBeenActiveFocusPanel)
+ if (d->hasBeenActiveFocusPanel)
d->canvas->d->clearFocusPanel(this);
- if(d->hasFocus)
+ if (d->hasFocus)
d->canvas->d->clearFocusItem(this);
}
@@ -1354,7 +1354,7 @@ QSimpleCanvasItem::~QSimpleCanvasItem()
if (parent() && d->data_ptr && d->data()->dirty) {
QSimpleCanvasLayer *l = parent()->layer();
- if(l) {
+ if (l) {
l->remDirty(this);
}
}
@@ -1362,7 +1362,7 @@ QSimpleCanvasItem::~QSimpleCanvasItem()
d->parent->remChild(this);
- if(d->data_ptr)
+ if (d->data_ptr)
delete d->data_ptr;
}
}
@@ -1370,8 +1370,8 @@ QSimpleCanvasItem::~QSimpleCanvasItem()
QSimpleCanvasItem::operator QGraphicsItem *()
{
Q_D(QSimpleCanvasItem);
- if(!d->graphicsItem) {
- if(parent()) {
+ if (!d->graphicsItem) {
+ if (parent()) {
qWarning("QSimpleCanvasItem: Only the root item can be converted into a QGraphicsItem");
return 0;
}
@@ -1413,42 +1413,42 @@ void QSimpleCanvasItemPrivate::setParentInternal(QSimpleCanvasItem *p)
{
Q_Q(QSimpleCanvasItem);
QSimpleCanvasItem *oldParent = parent;
- if(graphicsItem) {
- if(oldParent)
+ if (graphicsItem) {
+ if (oldParent)
oldParent->remChild(q);
parent = p;
graphicsItem->setParentItem(p->d_func()->graphicsItem);
- if(parent)
+ if (parent)
p->addChild(q);
} else {
bool canvasChange = false;
- if(p)
+ if (p)
canvasChange = (p->d_func()->canvas != canvas);
QSimpleCanvas *old = canvas;
QSimpleCanvasLayer *o = q->layer();
- if(q->parent()) {
+ if (q->parent()) {
q->update();
q->parent()->remChild(q);
}
parent = p;
QSimpleCanvasLayer *n = 0;
- if(q->parent()) {
+ if (q->parent()) {
q->parent()->addChild(q);
n = q->layer();
}
- if(o != n) {
+ if (o != n) {
data()->dirty = false;
data()->transformValid = false;
- if(o) o->remDirty(q);
- if(n) n->addDirty(q);
+ if (o) o->remDirty(q);
+ if (n) n->addDirty(q);
}
- if(canvasChange)
+ if (canvasChange)
canvasChanged(p->d_func()->canvas, old);
q->update();
@@ -1460,25 +1460,25 @@ void QSimpleCanvasItemPrivate::convertToGraphicsItem(QGraphicsItem *parent)
Q_Q(QSimpleCanvasItem);
Q_ASSERT(!graphicsItem);
graphicsItem = new QSimpleGraphicsItem(q);
- if(parent)
+ if (parent)
graphicsItem->setParentItem(parent);
QSimpleCanvasItemData *old = data_ptr;
data_ptr = 0;
- if(old) {
+ if (old) {
q->QSimpleCanvasItem::setX(old->x);
q->QSimpleCanvasItem::setY(old->y);
q->QSimpleCanvasItem::setZ(old->z);
q->QSimpleCanvasItem::setVisible(old->visible);
- if(old->transformUser)
+ if (old->transformUser)
q->QSimpleCanvasItem::setTransform(*old->transformUser);
q->QSimpleCanvasItem::setFlip(old->flip);
q->QSimpleCanvasItem::setAcceptedMouseButtons((Qt::MouseButtons)old->buttons);
delete old;
}
- if(scale != 1) {
+ if (scale != 1) {
qreal s = scale;
scale = 1;
q->QSimpleCanvasItem::setScale(s);
@@ -1486,9 +1486,9 @@ void QSimpleCanvasItemPrivate::convertToGraphicsItem(QGraphicsItem *parent)
q->setClipType(clip);
- for(int ii = 0; ii < children.count(); ++ii) {
+ for (int ii = 0; ii < children.count(); ++ii) {
static_cast<QSimpleCanvasItemPrivate*>(children.at(ii)->d_ptr)->convertToGraphicsItem(graphicsItem);
- if(children.at(ii)->z() == 0)
+ if (children.at(ii)->z() == 0)
children.at(ii)->setZ(ii);
}
}
@@ -1501,14 +1501,14 @@ void QSimpleCanvasItemPrivate::convertToGraphicsItem(QGraphicsItem *parent)
void QSimpleCanvasItem::setParent(QSimpleCanvasItem *p)
{
Q_D(QSimpleCanvasItem);
- if(p == parent() || !p) return;
+ if (p == parent() || !p) return;
QObject::setParent(p);
- if(d->graphicsItem && !static_cast<QSimpleCanvasItemPrivate*>(p->d_ptr)->graphicsItem)
+ if (d->graphicsItem && !static_cast<QSimpleCanvasItemPrivate*>(p->d_ptr)->graphicsItem)
qWarning("QSimpleCanvasItem: Cannot reparent a QGraphicsView item to a QSimpleCanvas item");
- if(static_cast<QSimpleCanvasItemPrivate*>(p->d_ptr)->graphicsItem && !d->graphicsItem) {
+ if (static_cast<QSimpleCanvasItemPrivate*>(p->d_ptr)->graphicsItem && !d->graphicsItem) {
d->setParentInternal(0);
d->convertToGraphicsItem();
}
@@ -1524,45 +1524,45 @@ int QSimpleCanvasItemPrivate::dump(int indent)
QByteArray ba(indent * 2, ' ');
QByteArray state;
- if(options & QSimpleCanvasItem::MouseFilter)
+ if (options & QSimpleCanvasItem::MouseFilter)
state.append("i");
else
state.append("-");
- if(options & QSimpleCanvasItem::HoverEvents)
+ if (options & QSimpleCanvasItem::HoverEvents)
state.append("h");
else
state.append("-");
- if(options & QSimpleCanvasItem::MouseEvents)
+ if (options & QSimpleCanvasItem::MouseEvents)
state.append("m");
else
state.append("-");
- if(options & QSimpleCanvasItem::HasContents)
+ if (options & QSimpleCanvasItem::HasContents)
state.append("c");
else
state.append("-");
- if(options & QSimpleCanvasItem::SimpleItem)
+ if (options & QSimpleCanvasItem::SimpleItem)
state.append("s");
else
state.append("-");
- if(options & QSimpleCanvasItem::IsFocusPanel) {
- if(q->activeFocusPanel())
+ if (options & QSimpleCanvasItem::IsFocusPanel) {
+ if (q->activeFocusPanel())
state.append("P");
else
state.append("p");
} else {
state.append("-");
}
- if(options & QSimpleCanvasItem::IsFocusRealm)
+ if (options & QSimpleCanvasItem::IsFocusRealm)
state.append("r");
else
state.append("-");
- if(q->hasFocus()) {
- if(q->hasActiveFocus())
+ if (q->hasFocus()) {
+ if (q->hasActiveFocus())
state.append("F");
else
state.append("f");
} else {
- if(q->hasActiveFocus())
+ if (q->hasActiveFocus())
state.append("X");
else
state.append("-");
@@ -1570,13 +1570,13 @@ int QSimpleCanvasItemPrivate::dump(int indent)
QByteArray name;
QFxItem *i = qobject_cast<QFxItem *>(q);
- if(i)
+ if (i)
name = i->id().toLatin1();
qWarning().nospace() << ba.constData() << state.constData() << " " << children.count() << " " << q << " " << name.constData();
int rv = 0;
- for(int ii = 0; ii < children.count(); ++ii)
+ for (int ii = 0; ii < children.count(); ++ii)
rv += children.at(ii)->d_func()->dump(indent + 1);
return rv + 1;
@@ -1591,10 +1591,10 @@ bool QSimpleCanvasItemPrivate::checkFocusState(FocusStateCheckDatas d,
bool isRealm = (options & QSimpleCanvasItem::IsFocusPanel ||
options & QSimpleCanvasItem::IsFocusRealm);
- if(options & QSimpleCanvasItem::IsFocusPanel) {
+ if (options & QSimpleCanvasItem::IsFocusPanel) {
- if(q->activeFocusPanel()) {
- if(d & InActivePanel) {
+ if (q->activeFocusPanel()) {
+ if (d & InActivePanel) {
qWarning() << "State ERROR: Nested active focus panels";
rv = false;
}
@@ -1606,23 +1606,23 @@ bool QSimpleCanvasItemPrivate::checkFocusState(FocusStateCheckDatas d,
}
- if(q->hasActiveFocus()) {
- if(!(d & InActivePanel)) {
+ if (q->hasActiveFocus()) {
+ if (!(d & InActivePanel)) {
qWarning() << "State ERROR: Active focus in non-active panel";
rv = false;
}
- if(d & InRealm && !(d & InActiveFocusedRealm)) {
+ if (d & InRealm && !(d & InActiveFocusedRealm)) {
qWarning() << "State ERROR: Active focus in non-active-focused realm";
rv = false;
}
- if(!q->hasFocus()) {
+ if (!q->hasFocus()) {
qWarning() << "State ERROR: Active focus on element that does not have focus";
rv = false;
}
- if(*r & SeenActiveFocus) {
+ if (*r & SeenActiveFocus) {
qWarning() << "State ERROR: Two active focused elements in same realm";
rv = false;
}
@@ -1630,8 +1630,8 @@ bool QSimpleCanvasItemPrivate::checkFocusState(FocusStateCheckDatas d,
*r |= SeenActiveFocus;
}
- if(q->hasFocus()) {
- if(*r & SeenFocus) {
+ if (q->hasFocus()) {
+ if (*r & SeenFocus) {
qWarning() << "State ERROR: Two focused elements in same realm";
rv = false;
}
@@ -1639,20 +1639,20 @@ bool QSimpleCanvasItemPrivate::checkFocusState(FocusStateCheckDatas d,
*r |= SeenFocus;
}
- if(options & QSimpleCanvasItem::IsFocusRealm) {
+ if (options & QSimpleCanvasItem::IsFocusRealm) {
d |= InRealm;
- if(q->hasActiveFocus())
+ if (q->hasActiveFocus())
d |= InActiveFocusedRealm;
else
d &= ~InActiveFocusedRealm;
}
FocusStateCheckRDatas newR = NoCheckRData;
- if(isRealm)
+ if (isRealm)
r = &newR;
- for(int ii = 0; ii < children.count(); ++ii)
+ for (int ii = 0; ii < children.count(); ++ii)
rv &= children.at(ii)->d_func()->checkFocusState(d, r);
return rv;
@@ -1661,7 +1661,7 @@ bool QSimpleCanvasItemPrivate::checkFocusState(FocusStateCheckDatas d,
bool QSimpleCanvasItem::activeFocusPanel() const
{
QSimpleCanvas *c = canvas();
- if(!c) {
+ if (!c) {
Q_D(const QSimpleCanvasItem);
return d->wantsActiveFocusPanelPendingCanvas;
} else {
@@ -1671,18 +1671,18 @@ bool QSimpleCanvasItem::activeFocusPanel() const
void QSimpleCanvasItem::setActiveFocusPanel(bool b)
{
- if(!(options() & IsFocusPanel)) {
+ if (!(options() & IsFocusPanel)) {
qWarning("QSimpleCanvasItem::setActiveFocusPanel: Item is not a focus panel");
return;
}
QSimpleCanvas *c = canvas();
Q_D(QSimpleCanvasItem);
- if(c) {
- if(b) {
+ if (c) {
+ if (b) {
d->hasBeenActiveFocusPanel = true;
c->d->setActiveFocusPanel(this);
- } else if(d->hasBeenActiveFocusPanel) {
+ } else if (d->hasBeenActiveFocusPanel) {
d->hasBeenActiveFocusPanel = false;
c->d->clearFocusPanel(this);
}
@@ -1705,7 +1705,7 @@ QSimpleCanvasItem *QSimpleCanvasItem::findFirstFocusChild() const
for (int i = 0; i < children.count(); ++i) {
QSimpleCanvasItem *child = children.at(i);
- if(child->options() & IsFocusPanel)
+ if (child->options() & IsFocusPanel)
continue;
if (child->isFocusable())
@@ -1727,7 +1727,7 @@ QSimpleCanvasItem *QSimpleCanvasItem::findLastFocusChild() const
for (int i = children.count()-1; i >= 0; --i) {
QSimpleCanvasItem *child = children.at(i);
- if(child->options() & IsFocusPanel)
+ if (child->options() & IsFocusPanel)
continue;
if (child->isFocusable())
@@ -1746,8 +1746,8 @@ QSimpleCanvasItem *QSimpleCanvasItem::findPrevFocus(QSimpleCanvasItem *item)
if (focusChild)
return focusChild;
- if(item->options() & IsFocusPanel) {
- if(item->isFocusable())
+ if (item->options() & IsFocusPanel) {
+ if (item->isFocusable())
return item;
else
return 0;
@@ -1762,7 +1762,7 @@ QSimpleCanvasItem *QSimpleCanvasItem::findPrevFocus(QSimpleCanvasItem *item)
if (idx > 0) {
while (--idx >= 0) {
testFocus = children.at(idx);
- if(testFocus->options() & IsFocusPanel)
+ if (testFocus->options() & IsFocusPanel)
continue;
if (testFocus->isFocusable())
return testFocus;
@@ -1771,8 +1771,8 @@ QSimpleCanvasItem *QSimpleCanvasItem::findPrevFocus(QSimpleCanvasItem *item)
return testFocus;
}
}
- if(parent->options() & IsFocusPanel) {
- if(parent->isFocusable())
+ if (parent->options() & IsFocusPanel) {
+ if (parent->isFocusable())
return parent;
else
return 0;
@@ -1790,8 +1790,8 @@ QSimpleCanvasItem *QSimpleCanvasItem::findNextFocus(QSimpleCanvasItem *item)
if (focusChild)
return focusChild;
- if(item->options() & IsFocusPanel) {
- if(item->isFocusable())
+ if (item->options() & IsFocusPanel) {
+ if (item->isFocusable())
return item;
else
return 0;
@@ -1806,7 +1806,7 @@ QSimpleCanvasItem *QSimpleCanvasItem::findNextFocus(QSimpleCanvasItem *item)
if (idx >= 0) {
while (++idx < children.count()) {
testFocus = children.at(idx);
- if(testFocus->options() & IsFocusPanel)
+ if (testFocus->options() & IsFocusPanel)
continue;
if (testFocus->isFocusable())
return testFocus;
@@ -1815,8 +1815,8 @@ QSimpleCanvasItem *QSimpleCanvasItem::findNextFocus(QSimpleCanvasItem *item)
return testFocus;
}
}
- if(parent->options() & IsFocusPanel) {
- if(parent->isFocusable())
+ if (parent->options() & IsFocusPanel) {
+ if (parent->isFocusable())
return parent;
else
return 0;
diff --git a/src/declarative/canvas/qsimplecanvasitem_p.h b/src/declarative/canvas/qsimplecanvasitem_p.h
index 7a90c24..27a75bd 100644
--- a/src/declarative/canvas/qsimplecanvasitem_p.h
+++ b/src/declarative/canvas/qsimplecanvasitem_p.h
@@ -156,7 +156,7 @@ public:
QSimpleGraphicsItem *graphicsItem;
inline QSimpleCanvasItemData *data() const {
- if(!data_ptr) data_ptr = new QSimpleCanvasItemData;
+ if (!data_ptr) data_ptr = new QSimpleCanvasItemData;
return data_ptr;
}
mutable QSimpleCanvasItemData *data_ptr;
diff --git a/src/declarative/canvas/qsimplecanvasserver.cpp b/src/declarative/canvas/qsimplecanvasserver.cpp
index 7eebe65..4d4adda 100644
--- a/src/declarative/canvas/qsimplecanvasserver.cpp
+++ b/src/declarative/canvas/qsimplecanvasserver.cpp
@@ -55,7 +55,7 @@ QSimpleCanvasServer::QSimpleCanvasServer(int port, QObject *parent)
_time.start();
- if(!_tcpServer->listen(QHostAddress::Any, port)) {
+ if (!_tcpServer->listen(QHostAddress::Any, port)) {
qWarning() << "QSimpleCanvasServer: Cannot listen on port" << port;
return;
}
@@ -85,7 +85,7 @@ void QSimpleCanvasServer::addTiming(quint32 paint,
QByteArray ba = d.toLatin1();
// XXX
- for(int ii = 0; ii < _tcpClients.count(); ++ii)
+ for (int ii = 0; ii < _tcpClients.count(); ++ii)
// _tcpClients.at(ii)->write((const char *)data, 12);
_tcpClients.at(ii)->write(ba.constData(), ba.length());
}
@@ -94,8 +94,8 @@ void QSimpleCanvasServer::disconnected()
{
QTcpSocket *socket = static_cast<QTcpSocket *>(sender());
- for(int ii = 0; ii < _tcpClients.count(); ++ii) {
- if(_tcpClients.at(ii) == socket) {
+ for (int ii = 0; ii < _tcpClients.count(); ++ii) {
+ if (_tcpClients.at(ii) == socket) {
socket->disconnect();
socket->deleteLater();
_tcpClients.removeAt(ii);
diff --git a/src/declarative/extra/qmlsqlquery.cpp b/src/declarative/extra/qmlsqlquery.cpp
index 39d3aa2..39f4c1e 100644
--- a/src/declarative/extra/qmlsqlquery.cpp
+++ b/src/declarative/extra/qmlsqlquery.cpp
@@ -72,7 +72,7 @@ public:
/*!
\class QmlSqlBind
- \brief the QmlSqlBind class specifies a value binding for a QmlSqlQuery.
+ \brief The QmlSqlBind class specifies a value binding for a QmlSqlQuery.
\qmltext
diff --git a/src/declarative/extra/qmlxmllistmodel.cpp b/src/declarative/extra/qmlxmllistmodel.cpp
index 44787b5..562a1c8 100644
--- a/src/declarative/extra/qmlxmllistmodel.cpp
+++ b/src/declarative/extra/qmlxmllistmodel.cpp
@@ -255,7 +255,7 @@ void QmlXmlListModel::fetch()
void QmlXmlListModel::requestFinished()
{
Q_D(QmlXmlListModel);
- if(d->reply->error() != QNetworkReply::NoError) {
+ if (d->reply->error() != QNetworkReply::NoError) {
d->reply->deleteLater();
d->reply = 0;
} else {
diff --git a/src/declarative/fx/fx.pri b/src/declarative/fx/fx.pri
index 7fe86fe..ef059c7 100644
--- a/src/declarative/fx/fx.pri
+++ b/src/declarative/fx/fx.pri
@@ -11,6 +11,7 @@ HEADERS += \
fx/qfxevents_p.h \
fx/qfxflickable.h \
fx/qfxflickable_p.h \
+ fx/qfxflipable.h \
fx/qfxfocuspanel.h \
fx/qfxfocusrealm.h \
fx/qfxgridview.h \
@@ -60,6 +61,7 @@ SOURCES += \
fx/qfxcontentwrapper.cpp \
fx/qfxevents.cpp \
fx/qfxflickable.cpp \
+ fx/qfxflipable.cpp \
fx/qfxfocuspanel.cpp \
fx/qfxfocusrealm.cpp \
fx/qfxgridview.cpp \
diff --git a/src/declarative/fx/qfxanchors.cpp b/src/declarative/fx/qfxanchors.cpp
index 7372866..f537da9 100644
--- a/src/declarative/fx/qfxanchors.cpp
+++ b/src/declarative/fx/qfxanchors.cpp
@@ -165,7 +165,7 @@ QFxItem *QFxAnchors::fill() const
void QFxAnchors::setFill(QFxItem *f)
{
Q_D(QFxAnchors);
- if(d->fill) {
+ if (d->fill) {
QObject::disconnect(d->fill, SIGNAL(leftChanged()), this, SLOT(fillChanged()));
QObject::disconnect(d->fill, SIGNAL(topChanged()), this, SLOT(fillChanged()));
QObject::disconnect(d->fill, SIGNAL(widthChanged()), this, SLOT(fillChanged()));
@@ -214,11 +214,11 @@ QFxItem *QFxAnchors::centeredIn() const
void QFxAnchors::setCenteredIn(QFxItem* c)
{
Q_D(QFxAnchors);
- if(!c){
+ if (!c){
qmlInfo(d->item) << "Cannot center in null item.";
return;
}
- if(c != d->item->itemParent() && c->itemParent() != d->item->itemParent()){
+ if (c != d->item->itemParent() && c->itemParent() != d->item->itemParent()){
qmlInfo(d->item) << "Can't anchor to an item that isn't a parent or sibling.";
return;
}
@@ -822,7 +822,7 @@ bool QFxAnchorsPrivate::checkHAnchorValid(QFxAnchorLine anchor) const
if (anchor.anchorLine & QFxAnchorLine::Vertical_Mask) {
qmlInfo(item) << "Can't anchor a horizontal edge to a vertical edge.";
return false;
- }else if(anchor.item == item){
+ }else if (anchor.item == item){
qmlInfo(item) << "Can't anchor item to self.";
return false;
}
@@ -847,7 +847,7 @@ bool QFxAnchorsPrivate::checkVAnchorValid(QFxAnchorLine anchor) const
if (anchor.anchorLine & QFxAnchorLine::Horizontal_Mask) {
qmlInfo(item) << "Can't anchor a vertical edge to a horizontal edge.";
return false;
- }else if(anchor.item == item){
+ }else if (anchor.item == item){
qmlInfo(item) << "Can't anchor item to self.";
return false;
}
diff --git a/src/declarative/fx/qfxanimatedimageitem.cpp b/src/declarative/fx/qfxanimatedimageitem.cpp
index b5f0cc4..8f930d5 100644
--- a/src/declarative/fx/qfxanimatedimageitem.cpp
+++ b/src/declarative/fx/qfxanimatedimageitem.cpp
@@ -102,7 +102,7 @@ QFxAnimatedImageItem::~QFxAnimatedImageItem()
bool QFxAnimatedImageItem::isPlaying() const
{
Q_D(const QFxAnimatedImageItem);
- if(!d->_movie)
+ if (!d->_movie)
return false;
return d->_movie->state()==QMovie::Running;
}
@@ -110,9 +110,9 @@ bool QFxAnimatedImageItem::isPlaying() const
void QFxAnimatedImageItem::setPlaying(bool play)
{
Q_D(QFxAnimatedImageItem);
- if(!d->_movie)
+ if (!d->_movie)
return;
- if(play)
+ if (play)
d->_movie->start();
else
d->_movie->stop();
@@ -129,7 +129,7 @@ void QFxAnimatedImageItem::setPlaying(bool play)
int QFxAnimatedImageItem::currentFrame() const
{
Q_D(const QFxAnimatedImageItem);
- if(!d->_movie)
+ if (!d->_movie)
return -1;
return d->_movie->currentFrameNumber();
}
@@ -137,7 +137,7 @@ int QFxAnimatedImageItem::currentFrame() const
void QFxAnimatedImageItem::setCurrentFrame(int frame)
{
Q_D(QFxAnimatedImageItem);
- if(!d->_movie)
+ if (!d->_movie)
return;
d->_movie->jumpToFrame(frame);
}
@@ -145,7 +145,7 @@ void QFxAnimatedImageItem::setCurrentFrame(int frame)
int QFxAnimatedImageItem::frameCount() const
{
Q_D(const QFxAnimatedImageItem);
- if(!d->_movie)
+ if (!d->_movie)
return 0;
return d->_movie->frameCount();
}
@@ -153,13 +153,13 @@ int QFxAnimatedImageItem::frameCount() const
void QFxAnimatedImageItem::setSource(const QString &url)
{
Q_D(QFxAnimatedImageItem);
- if(url == d->source)
+ if (url == d->source)
return;
delete d->_movie;
d->_movie = 0;
- if(d->reply) {
+ if (d->reply) {
d->reply->deleteLater();
d->reply = 0;
}
@@ -167,7 +167,7 @@ void QFxAnimatedImageItem::setSource(const QString &url)
d->source = url;
d->url = qmlContext(this)->resolvedUrl(url);
- if(url.isEmpty()) {
+ if (url.isEmpty()) {
delete d->_movie;
d->status = Idle;
} else {
@@ -186,7 +186,7 @@ void QFxAnimatedImageItem::movieRequestFinished()
{
Q_D(QFxAnimatedImageItem);
d->_movie = new QMovie(d->reply);
- if(!d->_movie->isValid()){
+ if (!d->_movie->isValid()){
qWarning() << "Error Reading File " << d->url;
delete d->_movie;
d->_movie = 0;
diff --git a/src/declarative/fx/qfxblendedimage.cpp b/src/declarative/fx/qfxblendedimage.cpp
index ec2b9cc..3326ea8 100644
--- a/src/declarative/fx/qfxblendedimage.cpp
+++ b/src/declarative/fx/qfxblendedimage.cpp
@@ -173,7 +173,7 @@ bool QFxBlendedImage::smoothTransform() const
void QFxBlendedImage::setSmoothTransform(bool s)
{
- if(_smooth == s)
+ if (_smooth == s)
return;
_smooth = s;
update();
@@ -186,7 +186,7 @@ void QFxBlendedImage::paintContents(QPainter &p)
if (primSrc.isNull() && secSrc.isNull())
return;
- if(_smooth) {
+ if (_smooth) {
p.save();
p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, _smooth);
}
@@ -196,7 +196,7 @@ void QFxBlendedImage::paintContents(QPainter &p)
else
p.drawImage(0, 0, secPix);
- if(_smooth) {
+ if (_smooth) {
p.restore();
}
}
@@ -206,10 +206,10 @@ void QFxBlendedImage::paintContents(QPainter &p)
void QFxBlendedImage::paintGLContents(GLPainter &p)
{
static DualTextureBlendShader *shader = 0;
- if(!shader)
+ if (!shader)
shader = new DualTextureBlendShader();
- if(dirty) {
+ if (dirty) {
prim.clear();
sec.clear();
prim.setImage(primPix);
@@ -218,7 +218,7 @@ void QFxBlendedImage::paintGLContents(GLPainter &p)
dirty = false;
}
- if(prim.isNull() || sec.isNull()) {
+ if (prim.isNull() || sec.isNull()) {
return;
}
@@ -228,9 +228,9 @@ void QFxBlendedImage::paintGLContents(GLPainter &p)
float widthV = width();
float heightV = height();
- if(!widthV)
+ if (!widthV)
widthV = qMax(primPix.width(), secPix.width());
- if(!heightV)
+ if (!heightV)
heightV = qMax(primPix.height(), secPix.height());
vertices[0] = 0; vertices[1] = heightV;
@@ -243,12 +243,12 @@ void QFxBlendedImage::paintGLContents(GLPainter &p)
texVertices[4] = 0; texVertices[5] = 1;
texVertices[6] = 1; texVertices[7] = 1;
- if(_blend == 0 || _blend == 1) {
+ if (_blend == 0 || _blend == 1) {
QGLShaderProgram *tshader = p.useTextureShader();
GLTexture *tex = 0;
- if(_blend == 0)
+ if (_blend == 0)
tex = &prim;
else
tex = &sec;
@@ -271,8 +271,8 @@ void QFxBlendedImage::paintGLContents(GLPainter &p)
shader->enable();
shader->setOpacity(1);
qreal b = _blend;
- if(b > 1) b = 1;
- else if(b < 0) b = 0;
+ if (b > 1) b = 1;
+ else if (b < 0) b = 0;
shader->setBlend(b);
shader->setTransform(p.activeTransform);
diff --git a/src/declarative/fx/qfxblurfilter.cpp b/src/declarative/fx/qfxblurfilter.cpp
index 748fd8b..ad3eebc 100644
--- a/src/declarative/fx/qfxblurfilter.cpp
+++ b/src/declarative/fx/qfxblurfilter.cpp
@@ -124,7 +124,7 @@ qreal QFxBlurFilter::radius() const
void QFxBlurFilter::setRadius(qreal radius)
{
- if(d->radius == radius) return;
+ if (d->radius == radius) return;
d->radius = radius;
emit radiusChanged(radius);
update();
@@ -133,7 +133,7 @@ void QFxBlurFilter::setRadius(qreal radius)
QRectF QFxBlurFilter::itemBoundingRect(const QRectF &r) const
{
QRectF rv = r;
- if(d->radius > 0)
+ if (d->radius > 0)
rv.adjust(-d->radius, -d->radius, d->radius, d->radius);
return rv;
}
@@ -143,7 +143,7 @@ void QFxBlurFilter::filterGL(QSimpleCanvasItem::GLPainter &p)
{
#if defined(QFX_RENDER_OPENGL2)
#if 1
- if(d->radius <= 0) {
+ if (d->radius <= 0) {
renderToScreen();
return;
}
@@ -156,7 +156,7 @@ void QFxBlurFilter::filterGL(QSimpleCanvasItem::GLPainter &p)
radius *= blurScale;
QGLFramebufferObject *fbo = renderToFBO(blurScale);
- if(!fbo)
+ if (!fbo)
return;
float height = r.height();
@@ -201,7 +201,7 @@ void QFxBlurFilter::filterGL(QSimpleCanvasItem::GLPainter &p)
BlurTextureShader *shader = item->basicShaders()->blurTexture();
shader->enable();
shader->setTransform(trans);
- if(steps > 1) {
+ if (steps > 1) {
shader->setStep(xstep * 2);
shader->setSteps(steps / 2);
} else {
@@ -252,7 +252,7 @@ void QFxBlurFilter::filterGL(QSimpleCanvasItem::GLPainter &p)
BlurTextureShader *shader = item->basicShaders()->blurTexture();
shader->enable();
shader->setTransform(trans);
- if(steps > 1) {
+ if (steps > 1) {
shader->setStep(ystep * 2);
shader->setSteps(steps / 2);
} else {
@@ -303,7 +303,7 @@ void QFxBlurFilter::filterGL(QSimpleCanvasItem::GLPainter &p)
releaseFBO(fbo);
#else
#if 0
- if(d->radius <= 0) {
+ if (d->radius <= 0) {
renderToScreen();
return;
}
@@ -314,7 +314,7 @@ void QFxBlurFilter::filterGL(QSimpleCanvasItem::GLPainter &p)
float scale = 0.5;
float scalePercent = scale / d->radius;
QGLFramebufferObject *fbo = renderToFBO(scalePercent);
- if(!fbo)
+ if (!fbo)
return;
QGLFramebufferObject *xfbo = acquireFBO(QSize(scale * r.width(), fbo->height()));
diff --git a/src/declarative/fx/qfxcomponentinstance.cpp b/src/declarative/fx/qfxcomponentinstance.cpp
index 02a6c86..951c25d 100644
--- a/src/declarative/fx/qfxcomponentinstance.cpp
+++ b/src/declarative/fx/qfxcomponentinstance.cpp
@@ -97,7 +97,7 @@ QmlComponent *QFxComponentInstance::component() const
void QFxComponentInstance::setComponent(QmlComponent *c)
{
Q_D(QFxComponentInstance);
- if(d->component) {
+ if (d->component) {
qmlInfo(this) << "component is a write-once property.";
return;
}
@@ -108,11 +108,11 @@ void QFxComponentInstance::setComponent(QmlComponent *c)
void QFxComponentInstance::create()
{
Q_D(QFxComponentInstance);
- if(d->component) {
+ if (d->component) {
QObject *obj= d->component->create(qmlContext(this));
- if(obj) {
+ if (obj) {
QFxItem *objitem = qobject_cast<QFxItem *>(obj);
- if(objitem) {
+ if (objitem) {
d->instance = objitem;
objitem->setItemParent(this);
objitem->setFocus(true);
@@ -130,10 +130,10 @@ void QFxComponentInstance::create()
void QFxComponentInstance::updateSize()
{
QFxItem *i = instance();
- if(i) {
- if(!widthValid())
+ if (i) {
+ if (!widthValid())
setImplicitWidth(i->width());
- if(!heightValid())
+ if (!heightValid())
setImplicitHeight(i->height());
}
}
diff --git a/src/declarative/fx/qfxcontentwrapper.cpp b/src/declarative/fx/qfxcontentwrapper.cpp
index 5ce5430..a155d2b 100644
--- a/src/declarative/fx/qfxcontentwrapper.cpp
+++ b/src/declarative/fx/qfxcontentwrapper.cpp
@@ -76,7 +76,7 @@ void QFxContentWrapper::componentComplete()
target = target->itemParent();
QList<QFxItem*> myContent(*content());
- for(int ii = 0; ii < myContent.count(); ++ii)
+ for (int ii = 0; ii < myContent.count(); ++ii)
myContent.at(ii)->setParent(target);
}
diff --git a/src/declarative/fx/qfxevents.cpp b/src/declarative/fx/qfxevents.cpp
index a3fa6af..7d04f5d 100644
--- a/src/declarative/fx/qfxevents.cpp
+++ b/src/declarative/fx/qfxevents.cpp
@@ -42,10 +42,74 @@
#include "qfxevents_p.h"
QT_BEGIN_NAMESPACE
+/*!
+ \qmlclass KeyEvent QFxKeyEvent
+ \brief The KeyEvent element provides information about a key event.
+
+ For example, the following changes the Item's state property when the Enter
+ key is pressed:
+ \code
+ <Item focus="true">
+ <onKeyPress>if (event.key == Qt.Key_Enter) state = 'ShowDetails';</onKeyPress>
+ </Item>
+ \endcode
+
+ The \l KeyActions element could also be used to achieve the above with
+ a clearer syntax.
+
+ \sa KeyActions
+*/
+
+/*!
+ \internal
+ \class QFxKeyEvent
+*/
+
+/*!
+ \qmlproperty int KeyEvent::key
+
+ This property holds the code of the key that was pressed or released.
+
+ See \l {Qt::Key}{Qt.Key} for the list of keyboard codes. These codes are
+ independent of the underlying window system. Note that this
+ function does not distinguish between capital and non-capital
+ letters, use the text() function (returning the Unicode text the
+ key generated) for this purpose.
+
+ A value of either 0 or \l {Qt::Key_unknown}{Qt.Key_Unknown} means that the event is not
+ the result of a known key; for example, it may be the result of
+ a compose sequence, a keyboard macro, or due to key event
+ compression.
+*/
+
+/*!
+ \qmlproperty string KeyEvent::text
+
+ This property holds the Unicode text that the key generated.
+ The text returned can be an empty string in cases where modifier keys,
+ such as Shift, Control, Alt, and Meta, are being pressed or released.
+ In such cases \c key will contain a valid value
+*/
+
+/*!
+ \qmlproperty bool KeyEvent::isAutoRepeat
+
+ This property holds whether this event comes from an auto-repeating key.
+*/
+
+/*!
+ \qmlproperty int KeyEvent::count
+
+ This property holds the number of keys involved in this event. If \l KeyEvent::text
+ is not empty, this is simply the length of the string.
+*/
/*!
\qmlclass MouseEvent QFxMouseEvent
\brief The MouseEvent element provides information about a mouse event.
+
+ The position of the mouse can be found via the x and y properties.
+ The button that caused the event is available via the button property.
*/
/*!
@@ -54,16 +118,65 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \qmlproperty int x
- \qmlproperty int y
+ \qmlproperty int MouseEvent::x
+ \qmlproperty int MouseEvent::y
These properties hold the position of the mouse event.
*/
/*!
- \qmlproperty enum button
+ \qmlproperty enum MouseEvent::button
+
+ This property holds the button that caused the event. It can be one of:
+ \list
+ \o Qt.LeftButton
+ \o Qt.RightButton
+ \o Qt.MidButton
+ \endlist
+*/
+
+/*!
+ \qmlproperty int MouseEvent::buttons
+
+ This property holds the mouse buttons pressed when the event was generated.
+ For mouse move events, this is all buttons that are pressed down. For mouse
+ press and double click events this includes the button that caused the event.
+ For mouse release events this excludes the button that caused the event.
+
+ It contains a bitwise combination of:
+ \list
+ \o Qt.LeftButton
+ \o Qt.RightButton
+ \o Qt.MidButton
+ \endlist
+*/
+
+/*!
+ \qmlproperty int MouseEvent::modifiers
+
+ This property holds the keyboard modifier flags that existed immediately
+ before the event occurred.
+
+ It contains a bitwise combination of:
+ \list
+ \o Qt.NoModifier - No modifier key is pressed.
+ \o Qt.ShiftModifier - A Shift key on the keyboard is pressed.
+ \o Qt.ControlModifier - A Ctrl key on the keyboard is pressed.
+ \o Qt.AltModifier - An Alt key on the keyboard is pressed.
+ \o Qt.MetaModifier - A Meta key on the keyboard is pressed.
+ \o Qt.KeypadModifier - A keypad button is pressed.
+ \endlist
- This property holds the button that caused the event.
+ For example, to react to a Shift key + Left mouse button click:
+ \code
+ <MouseRegion>
+ <onClick>
+ <![CDATA[
+ if (mouse.button == Qt.LeftButton && mouse.modifiers & Qt.ShiftModifier) doSomething();
+ ]]>
+ </onclick>
+ </MouseRegion>
+ \endcode
*/
QML_DEFINE_NOCREATE_TYPE(QFxKeyEvent);
diff --git a/src/declarative/fx/qfxevents_p.h b/src/declarative/fx/qfxevents_p.h
index d096a90..30717ef 100644
--- a/src/declarative/fx/qfxevents_p.h
+++ b/src/declarative/fx/qfxevents_p.h
@@ -52,12 +52,12 @@ QT_BEGIN_NAMESPACE
class QFxKeyEvent : public QObject
{
Q_OBJECT
- Q_PROPERTY(int key READ key);
- Q_PROPERTY(QString text READ text);
- Q_PROPERTY(Qt::KeyboardModifiers modifiers READ modifiers);
- Q_PROPERTY(bool isAutoRepeat READ isAutoRepeat);
- Q_PROPERTY(int count READ count);
- Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted);
+ Q_PROPERTY(int key READ key)
+ Q_PROPERTY(QString text READ text)
+ Q_PROPERTY(int modifiers READ modifiers)
+ Q_PROPERTY(bool isAutoRepeat READ isAutoRepeat)
+ Q_PROPERTY(int count READ count)
+ Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted)
public:
QFxKeyEvent(QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, const QString &text=QString(), bool autorep=false, ushort count=1)
@@ -67,7 +67,7 @@ public:
int key() const { return event.key(); }
QString text() const { return event.text(); }
- Qt::KeyboardModifiers modifiers() const { return event.modifiers(); }
+ int modifiers() const { return event.modifiers(); }
bool isAutoRepeat() const { return event.isAutoRepeat(); }
int count() const { return event.count(); }
@@ -83,14 +83,14 @@ QML_DECLARE_TYPE(QFxKeyEvent);
class QFxMouseEvent : public QObject
{
Q_OBJECT
- Q_PROPERTY(int x READ x);
- Q_PROPERTY(int y READ y);
- Q_PROPERTY(Qt::MouseButton button READ button);
- Q_PROPERTY(Qt::MouseButtons buttons READ buttons);
- Q_PROPERTY(Qt::KeyboardModifiers modifiers READ modifiers);
- Q_PROPERTY(bool wasHeld READ wasHeld);
- Q_PROPERTY(bool isClick READ isClick);
- Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted);
+ Q_PROPERTY(int x READ x)
+ Q_PROPERTY(int y READ y)
+ Q_PROPERTY(int button READ button)
+ Q_PROPERTY(int buttons READ buttons)
+ Q_PROPERTY(int modifiers READ modifiers)
+ Q_PROPERTY(bool wasHeld READ wasHeld)
+ Q_PROPERTY(bool isClick READ isClick)
+ Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted)
public:
QFxMouseEvent(int x, int y, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers
@@ -100,9 +100,9 @@ public:
int x() const { return _x; }
int y() const { return _y; }
- Qt::MouseButton button() const { return _button; }
- Qt::MouseButtons buttons() const { return _buttons; }
- Qt::KeyboardModifiers modifiers() const { return _modifiers; }
+ int button() const { return _button; }
+ int buttons() const { return _buttons; }
+ int modifiers() const { return _modifiers; }
bool wasHeld() const { return _wasHeld; }
bool isClick() const { return _isClick; }
diff --git a/src/declarative/fx/qfxflickable.cpp b/src/declarative/fx/qfxflickable.cpp
index b6eaa8e..671d65d 100644
--- a/src/declarative/fx/qfxflickable.cpp
+++ b/src/declarative/fx/qfxflickable.cpp
@@ -121,16 +121,16 @@ void QFxFlickablePrivate::init()
void QFxFlickablePrivate::fixupX()
{
Q_Q(QFxFlickable);
- if(!q->xflick() || _moveX.timeLine())
+ if (!q->xflick() || _moveX.timeLine())
return;
vTime = _tl.time();
- if(_moveX.value() > q->minXExtent() || q->maxXExtent() > 0) {
+ if (_moveX.value() > q->minXExtent() || q->maxXExtent() > 0) {
_tl.move(_moveX, q->minXExtent(), QEasingCurve(QEasingCurve::InOutQuad), 200);
flicked = false;
//emit flickingChanged();
- } else if(_moveX.value() < q->maxXExtent()) {
+ } else if (_moveX.value() < q->maxXExtent()) {
_tl.move(_moveX, q->maxXExtent(), QEasingCurve(QEasingCurve::InOutQuad), 200);
flicked = false;
//emit flickingChanged();
@@ -140,15 +140,15 @@ void QFxFlickablePrivate::fixupX()
void QFxFlickablePrivate::fixupY()
{
Q_Q(QFxFlickable);
- if(!q->yflick() || _moveY.timeLine())
+ if (!q->yflick() || _moveY.timeLine())
return;
vTime = _tl.time();
- if(_moveY.value() > q->minYExtent() || (q->maxYExtent() > q->minYExtent())) {
+ if (_moveY.value() > q->minYExtent() || (q->maxYExtent() > q->minYExtent())) {
_tl.move(_moveY, q->minYExtent(), QEasingCurve(QEasingCurve::InOutQuad), 200);
//emit flickingChanged();
- } else if(_moveY.value() < q->maxYExtent()) {
+ } else if (_moveY.value() < q->maxYExtent()) {
_tl.move(_moveY, q->maxYExtent(), QEasingCurve(QEasingCurve::InOutQuad), 200);
//emit flickingChanged();
} else {
@@ -560,17 +560,17 @@ void QFxFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event)
bool rejectX = false;
bool moved = false;
- if(q->yflick()) {
+ if (q->yflick()) {
int dy = int(event->pos().y() - pressPos.y());
if (qAbs(dy) > FlickThreshold || pressTime.elapsed() > 200) {
qreal newY = dy + pressY;
const qreal minY = q->minYExtent();
const qreal maxY = q->maxYExtent();
- if(newY > minY)
+ if (newY > minY)
newY = minY + (newY - minY) / 2;
- if(newY < maxY && maxY - minY < 0)
+ if (newY < maxY && maxY - minY < 0)
newY = maxY + (newY - maxY) / 2;
- if(q->overShoot() || (newY <= minY && newY >= maxY)) {
+ if (q->overShoot() || (newY <= minY && newY >= maxY)) {
if (dragMode == QFxFlickable::Hard)
_moveY.setValue(newY);
else
@@ -583,11 +583,11 @@ void QFxFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event)
}
}
- if(q->xflick()) {
+ if (q->xflick()) {
int dx = int(event->pos().x() - pressPos.x());
if (qAbs(dx) > FlickThreshold || pressTime.elapsed() > 200) {
qreal newX = dx + pressX;
- if(q->overShoot() || (newX <= q->minXExtent() && newX >= q->maxXExtent())) {
+ if (q->overShoot() || (newX <= q->minXExtent() && newX >= q->maxXExtent())) {
if (dragMode == QFxFlickable::Hard)
_moveX.setValue(newX);
else
@@ -600,23 +600,23 @@ void QFxFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event)
}
}
- if(!lastPos.isNull()) {
+ if (!lastPos.isNull()) {
qreal elapsed = qreal(lastPosTime.restart()) / 1000.;
- if(elapsed <= 0)
+ if (elapsed <= 0)
elapsed = 1;
- if(q->yflick()) {
+ if (q->yflick()) {
qreal diff = event->pos().y() - lastPos.y();
velocityY = diff / elapsed;
}
- if(q->xflick()) {
+ if (q->xflick()) {
qreal diff = event->pos().x() - lastPos.x();
velocityX = diff / elapsed;
}
}
- if(rejectY) velocityY = 0;
- if(rejectX) velocityX = 0;
+ if (rejectY) velocityY = 0;
+ if (rejectX) velocityX = 0;
if (moved) {
q->viewportMoved();
@@ -640,20 +640,20 @@ void QFxFlickablePrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEvent *)
}
vTime = _tl.time();
- if(qAbs(velocityY) > 10) {
+ if (qAbs(velocityY) > 10) {
qreal maxDistance = -1;
// -ve velocity means list is moving up
- if(velocityY > 0) {
- if(_moveY.value() < q->minYExtent())
+ if (velocityY > 0) {
+ if (_moveY.value() < q->minYExtent())
maxDistance = qAbs(q->minYExtent() -_moveY.value() + (overShoot?30:0));
} else {
- if(_moveY.value() > q->maxYExtent())
+ if (_moveY.value() > q->maxYExtent())
maxDistance = qAbs(q->maxYExtent() - _moveY.value()) + (overShoot?30:0);
}
- if(maxDistance > 0) {
+ if (maxDistance > 0) {
qreal v = velocityY;
- if(maxVelocity != -1 && maxVelocity < qAbs(v)) {
- if(v < 0)
+ if (maxVelocity != -1 && maxVelocity < qAbs(v)) {
+ if (v < 0)
v = -maxVelocity;
else
v = maxVelocity;
@@ -669,20 +669,20 @@ void QFxFlickablePrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEvent *)
} else {
fixupY();
}
- if(qAbs(velocityX) > 10) {
+ if (qAbs(velocityX) > 10) {
qreal maxDistance = -1;
// -ve velocity means list is moving up
- if(velocityX > 0) {
- if(_moveX.value() < q->minXExtent())
+ if (velocityX > 0) {
+ if (_moveX.value() < q->minXExtent())
maxDistance = qAbs(q->minXExtent()) -_moveX.value() + (overShoot?30:0);
} else {
- if(_moveX.value() > q->maxXExtent())
+ if (_moveX.value() > q->maxXExtent())
maxDistance = qAbs(q->maxXExtent() - _moveX.value()) + (overShoot?30:0);
}
- if(maxDistance > 0) {
+ if (maxDistance > 0) {
qreal v = velocityX;
- if(maxVelocity != -1 && maxVelocity < qAbs(v)) {
- if(v < 0)
+ if (maxVelocity != -1 && maxVelocity < qAbs(v)) {
+ if (v < 0)
v = -maxVelocity;
else
v = maxVelocity;
@@ -701,7 +701,7 @@ void QFxFlickablePrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEvent *)
stealMouse = false;
lastPosTime = QTime();
- if(!_tl.isActive())
+ if (!_tl.isActive())
q->movementEnding();
}
@@ -766,7 +766,7 @@ void QFxFlickable::viewportMoved()
qreal prevY = d->lastFlickablePosition.x();
qreal prevX = d->lastFlickablePosition.y();
d->velocityTimeline.clear();
- if(d->pressed) {
+ if (d->pressed) {
qreal xVelocity = (prevX - d->_moveX.value()) * 1000 / elapsed;
qreal yVelocity = (prevY - d->_moveY.value()) * 1000 / elapsed;
d->velocityTimeline.move(d->xVelocity, xVelocity, d->velocityDecay);
@@ -804,7 +804,7 @@ void QFxFlickablePrivate::data_append(QObject *o)
{
Q_Q(QFxFlickable);
QFxItem *i = qobject_cast<QFxItem *>(o);
- if(i)
+ if (i)
_flick->children()->append(i);
else
o->setParent(q);
@@ -901,7 +901,7 @@ void QFxFlickable::setViewportWidth(int w)
if (d->vWidth == w)
return;
d->vWidth = w;
- if(w < 0)
+ if (w < 0)
d->_flick->setWidth(width());
else
d->_flick->setWidth(w);
@@ -913,7 +913,7 @@ void QFxFlickable::setWidth(int w)
{
Q_D(QFxFlickable);
QFxItem::setWidth(w);
- if(d->vWidth < 0) {
+ if (d->vWidth < 0) {
d->_flick->setWidth(w);
emit viewportWidthChanged();
d->updateBeginningEnd();
@@ -924,7 +924,7 @@ void QFxFlickable::setHeight(int h)
{
Q_D(QFxFlickable);
QFxItem::setHeight(h);
- if(d->vHeight < 0) {
+ if (d->vHeight < 0) {
d->_flick->setHeight(h);
emit viewportHeightChanged();
d->updateBeginningEnd();
@@ -947,7 +947,7 @@ void QFxFlickable::setViewportHeight(int h)
if (d->vHeight == h)
return;
d->vHeight = h;
- if(h < 0)
+ if (h < 0)
d->_flick->setHeight(height());
else
d->_flick->setHeight(h);
@@ -958,7 +958,7 @@ void QFxFlickable::setViewportHeight(int h)
int QFxFlickable::vWidth() const
{
Q_D(const QFxFlickable);
- if(d->vWidth < 0)
+ if (d->vWidth < 0)
return width();
else
return d->vWidth;
@@ -967,7 +967,7 @@ int QFxFlickable::vWidth() const
int QFxFlickable::vHeight() const
{
Q_D(const QFxFlickable);
- if(d->vHeight < 0)
+ if (d->vHeight < 0)
return height();
else
return d->vHeight;
@@ -1028,7 +1028,7 @@ bool QFxFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event)
bool QFxFlickable::mouseFilter(QGraphicsSceneMouseEvent *e)
{
- if(!isVisible())
+ if (!isVisible())
return false;
switch (e->type()) {
case QEvent::GraphicsSceneMousePress:
@@ -1060,7 +1060,7 @@ int QFxFlickable::maximumFlickVelocity() const
void QFxFlickable::setMaximumFlickVelocity(int v)
{
Q_D(QFxFlickable);
- if(v == d->maxVelocity)
+ if (v == d->maxVelocity)
return;
d->maxVelocity = v;
}
@@ -1081,7 +1081,7 @@ void QFxFlickable::setVelocityDecay(int decay)
{
Q_D(QFxFlickable);
Q_ASSERT(decay >= 0);
- if(decay == d->velocityDecay)
+ if (decay == d->velocityDecay)
return;
d->velocityDecay = decay;
emit velocityDecayChanged(decay);
@@ -1096,7 +1096,7 @@ bool QFxFlickable::isMoving() const
void QFxFlickable::movementStarting()
{
Q_D(QFxFlickable);
- if(!d->moving) {
+ if (!d->moving) {
d->moving = true;
emit movingChanged();
emit movementStarted();
@@ -1106,7 +1106,7 @@ void QFxFlickable::movementStarting()
void QFxFlickable::movementEnding()
{
Q_D(QFxFlickable);
- if(d->moving) {
+ if (d->moving) {
d->moving = false;
emit movingChanged();
emit movementEnded();
diff --git a/src/declarative/fx/qfxflipable.cpp b/src/declarative/fx/qfxflipable.cpp
new file mode 100644
index 0000000..9db0b57
--- /dev/null
+++ b/src/declarative/fx/qfxflipable.cpp
@@ -0,0 +1,220 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qfxflipable.h"
+#include "private/qfxitem_p.h"
+#include "qfxtransform.h"
+#include <QtDeclarative/qmlinfo.h>
+
+QML_DEFINE_TYPE(QFxFlipable,Flipable);
+
+class QFxFlipablePrivate : public QFxItemPrivate
+{
+public:
+ QFxFlipablePrivate() : current(QFxFlipable::Front), front(0), back(0) {}
+
+ QFxFlipable::Side current;
+ QFxItem *front;
+ QFxItem *back;
+};
+
+/*!
+ \qmlclass Flipable QFxFlipable
+ \brief The Flipable element provides a surface that can be flipped.
+ \inherits Item
+
+ Flipable allows you to specify a front and a back and then flip between those sides.
+
+ \code
+ <Flipable id="flipable" width="40" height="40">
+ <transform>
+ <Axis id="axis" xStart="20" xEnd="20" yStart="20" yEnd="0" />
+ </transform>
+ <front>
+ <Image file="front.png"/>
+ </front>
+ <back>
+ <Image file="back.png"/>
+ </back>
+ <states>
+ <State name="back">
+ <SetProperty target="{axis}" property="rotation" value="180" />
+ </State>
+ </states>
+ <transitions>
+ <Transition>
+ <NumericAnimation easing="easeInOutQuad" properties="rotation"/>
+ </Transition>
+ </transitions>
+ </Flipable>
+ \endcode
+
+ \image flipable.gif
+*/
+
+/*!
+ \internal
+ \class QFxFlipable
+ \brief The QFxFlipable class provides a flipable surface.
+
+ \ingroup group_widgets
+
+ QFxFlipable allows you to specify a front and a back, as well as an
+ axis for the flip.
+*/
+
+QFxFlipable::QFxFlipable(QFxItem *parent)
+: QFxItem(*(new QFxFlipablePrivate), parent)
+{
+}
+
+QFxFlipable::~QFxFlipable()
+{
+}
+
+/*!
+ \qmlproperty Item Flipable::front
+ \qmlproperty Item Flipable::back
+
+ The front and back sides of the flipable.
+*/
+
+QFxItem *QFxFlipable::front()
+{
+ Q_D(const QFxFlipable);
+ return d->front;
+}
+
+void QFxFlipable::setFront(QFxItem *front)
+{
+ Q_D(QFxFlipable);
+ if (d->front) {
+ qmlInfo(this) << "front is a write-once property";
+ return;
+ }
+ d->front = front;
+ children()->append(d->front);
+ if (Back == d->current)
+ d->front->setOpacity(0.);
+}
+
+QFxItem *QFxFlipable::back()
+{
+ Q_D(const QFxFlipable);
+ return d->back;
+}
+
+void QFxFlipable::setBack(QFxItem *back)
+{
+ Q_D(QFxFlipable);
+ if (d->back) {
+ qmlInfo(this) << "back is a write-once property";
+ return;
+ }
+ d->back = back;
+ children()->append(d->back);
+ if (Front == d->current)
+ d->back->setOpacity(0.);
+}
+
+/*!
+ \qmlproperty enumeration Flipable::side
+
+ The side of the Flippable currently visible. Possible values are \c
+ Front and \c Back.
+*/
+QFxFlipable::Side QFxFlipable::side() const
+{
+ Q_D(const QFxFlipable);
+ return d->current;
+}
+
+void QFxFlipable::transformChanged(const QSimpleCanvas::Matrix &trans)
+{
+ Q_D(QFxFlipable);
+ QPointF p1(0, 0);
+ QPointF p2(1, 0);
+ QPointF p3(1, 1);
+
+ p1 = trans.map(p1);
+ p2 = trans.map(p2);
+ p3 = trans.map(p3);
+
+ qreal cross = (p1.x() - p2.x()) * (p3.y() - p2.y()) -
+ (p1.y() - p2.y()) * (p3.x() - p2.x());
+
+ Side newSide;
+ if (cross > 0) {
+ newSide = Back;
+ } else {
+ newSide = Front;
+ }
+
+ if (newSide != d->current) {
+ d->current = newSide;
+ if (d->current==Back) {
+ QSimpleCanvas::Matrix mat;
+#ifdef QFX_RENDER_OPENGL
+ mat.translate(d->back->width()/2,d->back->height()/2, 0);
+ if (d->back->width() && p1.x() >= p2.x())
+ mat.rotate(180, 0, 1, 0);
+ if (d->back->height() && p2.y() >= p3.y())
+ mat.rotate(180, 1, 0, 0);
+ mat.translate(-d->back->width()/2,-d->back->height()/2, 0);
+#else
+ mat.translate(d->back->width()/2,d->back->height()/2);
+ if (d->back->width() && p1.x() >= p2.x())
+ mat.rotate(180, Qt::YAxis);
+ if (d->back->height() && p2.y() >= p3.y())
+ mat.rotate(180, Qt::XAxis);
+ mat.translate(-d->back->width()/2,-d->back->height()/2);
+#endif
+ d->back->setTransform(mat);
+ }
+ if (d->front)
+ d->front->setOpacity((d->current==Front)?1.:0.);
+ if (d->back)
+ d->back->setOpacity((d->current==Back)?1.:0.);
+ emit sideChanged();
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/declarative/fx/qfxflipable.h b/src/declarative/fx/qfxflipable.h
new file mode 100644
index 0000000..2c6c849
--- /dev/null
+++ b/src/declarative/fx/qfxflipable.h
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QFXFLIPABLE_H
+#define QFXFLIPABLE_H
+
+#include <QObject>
+#include <QTransform>
+#if defined(QFX_RENDER_OPENGL)
+#include <QtGui/qmatrix4x4.h>
+#endif
+#include <qfxitem.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Declarative)
+
+class QFxFlipablePrivate;
+class Q_DECLARATIVE_EXPORT QFxFlipable : public QFxItem
+{
+ Q_OBJECT
+
+ Q_ENUMS(Side);
+ Q_PROPERTY(QFxItem *front READ front WRITE setFront)
+ Q_PROPERTY(QFxItem *back READ back WRITE setBack)
+ Q_PROPERTY(Side side READ side NOTIFY sideChanged)
+public:
+ QFxFlipable(QFxItem *parent=0);
+ ~QFxFlipable();
+
+ QFxItem *front();
+ void setFront(QFxItem *);
+
+ QFxItem *back();
+ void setBack(QFxItem *);
+
+ enum Side { Front, Back };
+ Side side() const;
+
+protected:
+ virtual void transformChanged(const QSimpleCanvas::Matrix &);
+
+Q_SIGNALS:
+ void sideChanged();
+
+private:
+ Q_DISABLE_COPY(QFxFlipable)
+ Q_DECLARE_PRIVATE(QFxFlipable)
+};
+QML_DECLARE_TYPE(QFxFlipable);
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QFXFLIPABLE_H
diff --git a/src/declarative/fx/qfxfocuspanel.cpp b/src/declarative/fx/qfxfocuspanel.cpp
index 1bca424..67c456e 100644
--- a/src/declarative/fx/qfxfocuspanel.cpp
+++ b/src/declarative/fx/qfxfocuspanel.cpp
@@ -79,7 +79,7 @@ QFxFocusPanel::~QFxFocusPanel()
bool QFxFocusPanel::isActive() const
{
QSimpleCanvas *canvas = QSimpleCanvasItem::canvas();
- if(canvas)
+ if (canvas)
return canvas->activeFocusPanel() == this;
else
return false;
diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp
index 25c1565..c8b8d27 100644
--- a/src/declarative/fx/qfxgridview.cpp
+++ b/src/declarative/fx/qfxgridview.cpp
@@ -79,8 +79,11 @@ public:
}
static QFxGridViewAttached *properties(QObject *obj) {
- QFxGridViewAttached *rv = new QFxGridViewAttached(obj);
- attachedProperties.insert(obj, rv);
+ QFxGridViewAttached *rv = attachedProperties.value(obj);
+ if (!rv) {
+ rv = new QFxGridViewAttached(obj);
+ attachedProperties.insert(obj, rv);
+ }
return rv;
}
@@ -995,7 +998,7 @@ int QFxGridView::cacheBuffer() const
void QFxGridView::setCacheBuffer(int buffer)
{
Q_D(QFxGridView);
- if(d->buffer != buffer) {
+ if (d->buffer != buffer) {
d->buffer = buffer;
if (isComponentComplete())
refill();
@@ -1327,8 +1330,8 @@ void QFxGridView::itemsInserted(int modelIndex, int count)
}
}
// everything is in order now - emit add() signal
- foreach(FxGridItem *item, added)
- item->attached->emitAdd();
+ for (int j = 0; j < added.count(); ++j)
+ added.at(j)->attached->emitAdd();
d->layout();
emit countChanged();
}
diff --git a/src/declarative/fx/qfxhighlightfilter.cpp b/src/declarative/fx/qfxhighlightfilter.cpp
index d99b9e5..ab0512c 100644
--- a/src/declarative/fx/qfxhighlightfilter.cpp
+++ b/src/declarative/fx/qfxhighlightfilter.cpp
@@ -131,7 +131,7 @@ void QFxHighlightFilter::imageLoaded()
{
QImage img = QFxPixmap(d->url);
#if defined(QFX_RENDER_OPENGL2)
- if(!img.isNull())
+ if (!img.isNull())
d->tex.setImage(img);
#endif
emit sourceChanged(d->source);
@@ -142,14 +142,14 @@ void QFxHighlightFilter::setSource(const QString &f)
{
if (d->source == f)
return;
- if(!d->source.isEmpty())
+ if (!d->source.isEmpty())
QFxPixmap::cancelGet(d->url, this, SLOT(imageLoaded()));
d->source = f;
d->url = qmlContext(this)->resolvedUrl(f);
#if defined(QFX_RENDER_OPENGL2)
d->tex.clear();
#endif
- if(!f.isEmpty())
+ if (!f.isEmpty())
QFxPixmap::get(qmlEngine(this), d->url, this, SLOT(imageLoaded()));
else
emit sourceChanged(d->source);
@@ -171,13 +171,13 @@ bool QFxHighlightFilter::tiled() const
void QFxHighlightFilter::setTiled(bool t)
{
- if(t == d->tiled)
+ if (t == d->tiled)
return;
d->tiled = t;
#if defined(QFX_RENDER_OPENGL2)
- if(d->tiled) {
+ if (d->tiled) {
d->tex.setHorizontalWrap(GLTexture::ClampToEdge);
d->tex.setVerticalWrap(GLTexture::ClampToEdge);
} else {
@@ -206,7 +206,7 @@ int QFxHighlightFilter::xOffset() const
void QFxHighlightFilter::setXOffset(int x)
{
- if(x == d->xOffset)
+ if (x == d->xOffset)
return;
d->xOffset = x;
@@ -227,7 +227,7 @@ int QFxHighlightFilter::yOffset() const
void QFxHighlightFilter::setYOffset(int y)
{
- if(y == d->yOffset)
+ if (y == d->yOffset)
return;
d->yOffset = y;
@@ -240,7 +240,7 @@ void QFxHighlightFilter::setYOffset(int y)
void QFxHighlightFilter::filterGL(QSimpleCanvasItem::GLPainter &p)
{
#if defined(QFX_RENDER_OPENGL2)
- if(d->tex.isNull()) {
+ if (d->tex.isNull()) {
renderToScreen();
} else {
QSimpleCanvasItem *item = this->item();
@@ -266,9 +266,9 @@ void QFxHighlightFilter::filterGL(QSimpleCanvasItem::GLPainter &p)
float texXOffset = 0;
float texYOffset = 0;
- if(xOffset())
+ if (xOffset())
texXOffset = float(xOffset()) / float(d->tex.width());
- if(yOffset())
+ if (yOffset())
texYOffset = float(yOffset()) / float(d->tex.height());
GLfloat addTexVert[] = { texXOffset, texYOffset,
diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp
index 2d0dbc7..a34cd12 100644
--- a/src/declarative/fx/qfximage.cpp
+++ b/src/declarative/fx/qfximage.cpp
@@ -124,7 +124,7 @@ QFxImage::QFxImage(QFxImagePrivate &dd, QFxItem *parent)
QFxImage::~QFxImage()
{
Q_D(const QFxImage);
- if(d->reply)
+ if (d->reply)
d->reply->deleteLater();
}
@@ -183,7 +183,8 @@ void QFxImage::setPixmap(const QPixmap &pix)
Each scale grid property (left, right, top, and bottom) specifies an offset from the respective side. For example, \c scaleGrid.bottom="10" sets the bottom scale grid line 10 pixels up from the bottom of the image.
- A scale grid can also be specified using a \l {Imagexmlpropertysrc}{.sci file}.
+ A scale grid can also be specified using a
+ \l {Image::src}{.sci file}.
*/
QFxScaleGrid *QFxImage::scaleGrid()
{
@@ -250,7 +251,7 @@ bool QFxImage::isOpaque() const
void QFxImage::setOpaque(bool o)
{
Q_D(QFxImage);
- if(o == d->_opaque)
+ if (o == d->_opaque)
return;
d->_opaque = o;
d->_pix.setOpaque(o);
@@ -299,7 +300,7 @@ bool QFxImage::smoothTransform() const
void QFxImage::setSmoothTransform(bool s)
{
Q_D(QFxImage);
- if(d->_smooth == s)
+ if (d->_smooth == s)
return;
d->_smooth = s;
update();
@@ -317,10 +318,10 @@ void QFxImage::dump(int depth)
void QFxImage::paintContents(QPainter &p)
{
Q_D(QFxImage);
- if(d->_pix.isNull())
+ if (d->_pix.isNull())
return;
- if(d->_smooth) {
+ if (d->_smooth) {
p.save();
p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, d->_smooth);
}
@@ -347,7 +348,7 @@ void QFxImage::paintContents(QPainter &p)
p.restore();
} else if (!d->_scaleGrid || d->_scaleGrid->isNull()) {
- if(width() != pix.width() || height() != pix.height()) {
+ if (width() != pix.width() || height() != pix.height()) {
QTransform scale;
scale.scale(width() / qreal(pix.width()),
height() / qreal(pix.height()));
@@ -367,45 +368,45 @@ void QFxImage::paintContents(QPainter &p)
const int ySide = sgt + sgb;
// Upper left
- if(sgt && sgl)
+ if (sgt && sgl)
p.drawImage(QRect(0, 0, sgl, sgt), pix, QRect(0, 0, sgl, sgt));
// Upper middle
- if(pix.width() - xSide && sgt)
+ if (pix.width() - xSide && sgt)
p.drawImage(QRect(sgl, 0, width() - xSide, sgt), pix,
QRect(sgl, 0, pix.width() - xSide, sgt));
// Upper right
- if(sgt && pix.width() - sgr)
+ if (sgt && pix.width() - sgr)
p.drawImage(QPoint(width()-sgr, 0), pix,
QRect(pix.width()-sgr, 0, sgr, sgt));
// Middle left
- if(sgl && pix.height() - ySide)
+ if (sgl && pix.height() - ySide)
p.drawImage(QRect(0, sgt, sgl, height() - ySide), pix,
QRect(0, sgt, sgl, pix.height() - ySide));
// Middle
- if(pix.width() - xSide && pix.height() - ySide)
+ if (pix.width() - xSide && pix.height() - ySide)
p.drawImage(QRect(sgl, sgt, width() - xSide, height() - ySide),
pix,
QRect(sgl, sgt, pix.width() - xSide, pix.height() - ySide));
// Middle right
- if(sgr && pix.height() - ySide)
+ if (sgr && pix.height() - ySide)
p.drawImage(QRect(width()-sgr, sgt, sgr, height() - ySide), pix,
QRect(pix.width()-sgr, sgt, sgr, pix.height() - ySide));
// Lower left
- if(sgl && sgr)
+ if (sgl && sgr)
p.drawImage(QPoint(0, height() - sgb), pix,
QRect(0, pix.height() - sgb, sgl, sgb));
// Lower Middle
- if(pix.width() - xSide && sgb)
+ if (pix.width() - xSide && sgb)
p.drawImage(QRect(sgl, height() - sgb, width() - xSide, sgb), pix,
QRect(sgl, pix.height() - sgb, pix.width() - xSide, sgb));
// Lower Right
- if(sgr && sgb)
+ if (sgr && sgb)
p.drawImage(QPoint(width()-sgr, height() - sgb), pix,
QRect(pix.width()-sgr, pix.height() - sgb, sgr, sgb));
}
- if(d->_smooth) {
+ if (d->_smooth) {
p.restore();
}
}
@@ -415,10 +416,10 @@ uint QFxImage::glSimpleItemData(float *vertices, float *texVertices,
{
Q_D(QFxImage);
- if(d->_pix.isNull() || (d->_scaleGrid && !d->_scaleGrid->isNull()))
+ if (d->_pix.isNull() || (d->_scaleGrid && !d->_scaleGrid->isNull()))
return 0;
- if(count < 8)
+ if (count < 8)
return 8;
d->checkDirty();
@@ -433,7 +434,7 @@ uint QFxImage::glSimpleItemData(float *vertices, float *texVertices,
*texture = &d->_tex;
- if(d->_tiled) {
+ if (d->_tiled) {
float tileWidth = widthV / d->_pix.width();
float tileHeight = heightV / d->_pix.height();
texVertices[0] = 0; texVertices[1] = 0;
@@ -452,7 +453,7 @@ uint QFxImage::glSimpleItemData(float *vertices, float *texVertices,
void QFxImagePrivate::checkDirty()
{
- if(_texDirty && !_pix.isNull()) {
+ if (_texDirty && !_pix.isNull()) {
_tex.setImage(_pix);
_tex.setHorizontalWrap(GLTexture::Repeat);
_tex.setVerticalWrap(GLTexture::Repeat);
@@ -464,18 +465,18 @@ void QFxImagePrivate::checkDirty()
void QFxImage::paintGLContents(GLPainter &p)
{
Q_D(QFxImage);
- if(d->_pix.isNull())
+ if (d->_pix.isNull())
return;
QGLShaderProgram *shader = p.useTextureShader();
bool restoreBlend = false;
- if(isOpaque() && p.activeOpacity == 1) {
+ if (isOpaque() && p.activeOpacity == 1) {
glDisable(GL_BLEND);
restoreBlend = true;
}
- if(d->_tiled || (!d->_scaleGrid || d->_scaleGrid->isNull())) {
+ if (d->_tiled || (!d->_scaleGrid || d->_scaleGrid->isNull())) {
GLfloat vertices[8];
GLfloat texVertices[8];
@@ -497,7 +498,7 @@ void QFxImage::paintGLContents(GLPainter &p)
float imgWidth = d->_pix.width();
float imgHeight = d->_pix.height();
- if(!imgWidth || !imgHeight) {
+ if (!imgWidth || !imgHeight) {
if (restoreBlend)
glEnable(GL_BLEND);
return;
@@ -520,19 +521,19 @@ void QFxImage::paintGLContents(GLPainter &p)
const int sgt = d->_scaleGrid->top();
const int sgb = d->_scaleGrid->bottom();
- if(sgl) {
+ if (sgl) {
texleft = float(sgl) / imgWidth;
imgleft = sgl;
}
- if(sgr) {
+ if (sgr) {
texright = 1. - float(sgr) / imgWidth;
imgright = widthV - sgr;
}
- if(sgt) {
+ if (sgt) {
textop = 1. - float(sgb) / imgHeight;
imgtop = sgt;
}
- if(sgb) {
+ if (sgb) {
texbottom = float(sgt) / imgHeight;
imgbottom = heightV - sgb;
}
@@ -609,20 +610,20 @@ void QFxImage::paintGLContents(GLPainter &p)
void QFxImage::paintGLContents(GLPainter &p)
{
Q_D(QFxImage);
- if(d->_pix.isNull())
+ if (d->_pix.isNull())
return;
glMatrixMode(GL_MODELVIEW);
glLoadMatrixf(p.activeTransform.data());
bool restoreBlend = false;
- if(isOpaque() && p.activeOpacity == 1) {
+ if (isOpaque() && p.activeOpacity == 1) {
glDisable(GL_BLEND);
restoreBlend = true;
}
glEnable(GL_TEXTURE_2D);
- if(p.activeOpacity == 1.) {
+ if (p.activeOpacity == 1.) {
GLint i = GL_REPLACE;
glTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, &i);
} else {
@@ -631,7 +632,7 @@ void QFxImage::paintGLContents(GLPainter &p)
glColor4f(1, 1, 1, p.activeOpacity);
}
- if(d->_tiled || !d->_scaleGrid || d->_scaleGrid->isNull()) {
+ if (d->_tiled || !d->_scaleGrid || d->_scaleGrid->isNull()) {
GLfloat vertices[8];
GLfloat texVertices[8];
@@ -659,7 +660,7 @@ void QFxImage::paintGLContents(GLPainter &p)
float imgWidth = d->_pix.width();
float imgHeight = d->_pix.height();
- if(!imgWidth || !imgHeight) {
+ if (!imgWidth || !imgHeight) {
if (restoreBlend)
glEnable(GL_BLEND);
return;
@@ -682,19 +683,19 @@ void QFxImage::paintGLContents(GLPainter &p)
const int sgt = d->_scaleGrid->top();
const int sgb = d->_scaleGrid->bottom();
- if(sgl) {
+ if (sgl) {
texleft = float(sgl) / imgWidth;
imgleft = sgl;
}
- if(sgr) {
+ if (sgr) {
texright = 1. - float(sgr) / imgWidth;
imgright = widthV - sgr;
}
- if(sgt) {
+ if (sgt) {
textop = 1. - float(sgb) / imgHeight;
imgtop = sgt;
}
- if(sgb) {
+ if (sgb) {
texbottom = float(sgt) / imgHeight;
imgbottom = heightV - sgb;
}
@@ -792,11 +793,9 @@ QFxImage::Status QFxImage::status() const
Image can handle any image format supported by Qt, loaded from any URL scheme supported by Qt.
- \target Imagexmlpropertysrc
-
It can also handle .sci files, which are a Qml-specific format. A .sci file uses a simple text-based format that specifies
\list
- \i the grid lines describing a \l {ImagexmlpropertiesscaleGrid}{scale grid}.
+ \i the grid lines describing a \l {Image::scaleGrid.left}{scale grid}.
\i an image file.
\endlist
@@ -828,10 +827,10 @@ QString QFxImage::source() const
void QFxImage::setSource(const QString &url)
{
Q_D(QFxImage);
- if(url == d->source)
+ if (url == d->source)
return;
- if(d->reply) {
+ if (d->reply) {
d->reply->deleteLater();
d->reply = 0;
}
@@ -845,7 +844,7 @@ void QFxImage::setSource(const QString &url)
d->url = qmlContext(this)->resolvedUrl(url);
d->sciurl = QUrl();
- if(url.isEmpty()) {
+ if (url.isEmpty()) {
setPixmap(QPixmap());
d->status = Idle;
} else {
@@ -899,7 +898,7 @@ void QFxImage::requestFinished()
void QFxImage::sciRequestFinished()
{
Q_D(QFxImage);
- if(d->reply->error() != QNetworkReply::NoError) {
+ if (d->reply->error() != QNetworkReply::NoError) {
d->status = Error;
d->reply->deleteLater();
d->reply = 0;
@@ -916,7 +915,7 @@ void QFxImage::sciRequestFinished()
void QFxImage::setGridScaledImage(const QFxGridScaledImage& sci)
{
Q_D(QFxImage);
- if(!sci.isValid()) {
+ if (!sci.isValid()) {
d->status = Error;
emit statusChanged(d->status);
} else {
diff --git a/src/declarative/fx/qfximage_p.h b/src/declarative/fx/qfximage_p.h
index 46aea49..fbb4c44 100644
--- a/src/declarative/fx/qfximage_p.h
+++ b/src/declarative/fx/qfximage_p.h
@@ -89,7 +89,7 @@ public:
QFxScaleGrid *scaleGrid()
{
- if(!_scaleGrid)
+ if (!_scaleGrid)
_scaleGrid = new QFxScaleGrid;
return _scaleGrid;
}
diff --git a/src/declarative/fx/qfximageitem.cpp b/src/declarative/fx/qfximageitem.cpp
index a6f6d8f..52ab009 100644
--- a/src/declarative/fx/qfximageitem.cpp
+++ b/src/declarative/fx/qfximageitem.cpp
@@ -119,8 +119,7 @@ void QFxImageItem::dirtyCache(const QRect& rect)
void QFxImageItem::clearCache()
{
Q_D(QFxImageItem);
- foreach (QFxImageItemPrivate::ImageCacheItem* i, d->imagecache)
- delete i;
+ qDeleteAll(d->imagecache);
d->imagecache.clear();
}
@@ -155,7 +154,7 @@ QSize QFxImageItem::contentsSize() const
void QFxImageItem::setSmooth(bool smooth)
{
Q_D(QFxImageItem);
- if(d->smooth == smooth) return;
+ if (d->smooth == smooth) return;
d->smooth = smooth;
clearCache();
update();
@@ -169,7 +168,7 @@ void QFxImageItem::setSmooth(bool smooth)
void QFxImageItem::setContentsSize(const QSize &size)
{
Q_D(QFxImageItem);
- if(d->contentsSize == size) return;
+ if (d->contentsSize == size) return;
d->contentsSize = size;
clearCache();
update();
@@ -232,8 +231,9 @@ void QFxImageItem::paintGLContents(GLPainter &p)
return;
#if defined(QFX_RENDER_QPAINTER)
- if(d->smooth) {
- p.save();
+ bool oldAntiAliasing = p.testRenderHint(QPainter::Antialiasing);
+ bool oldSmoothPixmap = p.testRenderHint(QPainter::SmoothPixmapTransform);
+ if (d->smooth) {
p.setRenderHints(QPainter::Antialiasing, true);
p.setRenderHints(QPainter::SmoothPixmapTransform, true);
}
@@ -303,7 +303,8 @@ void QFxImageItem::paintGLContents(GLPainter &p)
}
const QRegion bigger = QRegion(biggerrect) & uncached;
const QVector<QRect> rects = bigger.rects();
- foreach (QRect r, rects) {
+ for (int i = 0; i < rects.count(); ++i) {
+ const QRect &r = rects.at(i);
#if defined(QFX_RENDER_QPAINTER)
QImage img(r.size(),QImage::Format_ARGB32_Premultiplied);
#else
@@ -335,8 +336,10 @@ void QFxImageItem::paintGLContents(GLPainter &p)
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
#endif
#if defined(QFX_RENDER_QPAINTER)
- if(d->smooth)
- p.restore();
+ if (d->smooth) {
+ p.setRenderHints(QPainter::Antialiasing, oldAntiAliasing);
+ p.setRenderHints(QPainter::SmoothPixmapTransform, oldSmoothPixmap);
+ }
#endif
}
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp
index 644e812..11b7dd3 100644
--- a/src/declarative/fx/qfxitem.cpp
+++ b/src/declarative/fx/qfxitem.cpp
@@ -151,12 +151,15 @@ void QFxContents::calcHeight()
int top = INT_MAX;
int bottom = 0;
- foreach(const QSimpleCanvasItem *child,
- _item->QSimpleCanvasItem::children()) {
- if (child->y() + child->height() > bottom)
- bottom = (int)child->y() + child->height();
- if (child->y() < top)
- top = (int)child->y();
+
+ const QList<QSimpleCanvasItem *> &children = _item->QSimpleCanvasItem::children();
+ for (int i = 0; i < children.count(); ++i) {
+ const QSimpleCanvasItem *child = children.at(i);
+ int y = int(child->y());
+ if (y + child->height() > bottom)
+ bottom = y + child->height();
+ if (y < top)
+ top = y;
}
_height = bottom - top;
@@ -171,12 +174,14 @@ void QFxContents::calcWidth()
int left = INT_MAX;
int right = 0;
- foreach(const QSimpleCanvasItem *child,
- _item->QSimpleCanvasItem::children()) {
- if (child->x() + child->width() > right)
- right = (int)child->x() + child->width();
- if (child->x() < left)
- left = (int)child->x();
+ const QList<QSimpleCanvasItem *> &children = _item->QSimpleCanvasItem::children();
+ for (int i = 0; i < children.count(); ++i) {
+ const QSimpleCanvasItem *child = children.at(i);
+ int x = int(child->x());
+ if (x + child->width() > right)
+ right = x + child->width();
+ if (x < left)
+ left = x;
}
_width = right - left;
@@ -188,8 +193,9 @@ void QFxContents::setItem(QFxItem *item)
{
_item = item;
- foreach(const QSimpleCanvasItem *child,
- _item->QSimpleCanvasItem::children()) {
+ const QList<QSimpleCanvasItem *> &children = _item->QSimpleCanvasItem::children();
+ for (int i = 0; i < children.count(); ++i) {
+ const QSimpleCanvasItem *child = children.at(i);
connect(child, SIGNAL(bottomChanged()), this, SLOT(calcHeight()));
connect(child, SIGNAL(rightChanged()), this, SLOT(calcWidth()));
}
@@ -322,33 +328,27 @@ void QFxContents::setItem(QFxItem *item)
*/
/*!
- \fn void QFxItem::keyPress(QObject *event)
+ \qmlsignal Item::onKeyPress(event)
- This signal is emitted when a key is pressed.
+ This handler is called when a key is pressed.
- The key event is available in QML via the QFxKeyEvent \a event
- property.
+ The key event is available via the KeyEvent \a event.
\qml
<Item onKeyPress="if (event.key == Qt.Key_Enter) state='Enter'"/>
\endqml
-
- \sa keyRelease()
*/
/*!
- \fn void QFxItem::keyRelease(QObject *event)
+ \qmlsignal Item::onKeyRelease(event)
- This signal is emitted when a key is released.
+ This handler is called when a key is released.
- The key event is available in QML via the QFxKeyEvent \a event
- property.
+ The key event is available in via the KeyEvent \a event.
\qml
<Item onKeyRelease="if (event.key == Qt.Key_Enter) state='Enter'"/>
\endqml
-
- \sa keyPress()
*/
/*!
@@ -380,7 +380,7 @@ void QFxContents::setItem(QFxItem *item)
This signal is emitted when the item's focus state changes.
- \sa setFocus()
+ \sa QSimpleCanvasItem::setFocus()
*/
/*!
@@ -457,7 +457,7 @@ void QFxItem::setItemParent(QFxItem *parent)
*/
void QFxItem::moveToParent(QFxItem *parent)
{
- if(parent && itemParent()) {
+ if (parent && itemParent()) {
QPointF me = itemParent()->mapToScene(QPointF(0,0));
QPointF them = parent->mapToScene(QPointF(0,0));
@@ -482,25 +482,25 @@ void QFxItem::moveToParent(QFxItem *parent)
qreal yDiff = them.y() - me.y();
- if(themx.x() == 0.) {
+ if (themx.x() == 0.) {
ry = xDiff / themy.x();
rx = (yDiff - ry * themy.y()) / themx.y();
- } else if(themy.x() == 0.) {
+ } else if (themy.x() == 0.) {
rx = xDiff / themx.x();
ry = (yDiff - rx * themx.y()) / themy.y();
- } else if(themx.y() == 0.) {
+ } else if (themx.y() == 0.) {
ry = yDiff / themy.y();
rx = (xDiff - ry * themy.x()) / themx.x();
- } else if(themy.y() == 0.) {
+ } else if (themy.y() == 0.) {
rx = yDiff / themx.y();
ry = (xDiff - rx * themx.x()) / themy.x();
} else {
qreal div = (themy.x() * themx.y() - themy.y() * themx.x());
- if(div != 0.)
+ if (div != 0.)
rx = (themx.y() * xDiff - themx.x() * yDiff) / div;
- if(themy.y() != 0.) ry = (yDiff - rx * themx.y()) / themy.y();
+ if (themy.y() != 0.) ry = (yDiff - rx * themx.y()) / themy.y();
}
setX(x() - rx);
@@ -576,7 +576,7 @@ bool QFxItem::isClassComplete() const
It is often desireable to delay some processing until the component is
completed.
- \sa componentComplete().
+ \sa componentComplete()
*/
bool QFxItem::isComponentComplete() const
{
@@ -609,7 +609,7 @@ void QFxItemPrivate::data_append(QObject *o)
{
Q_Q(QFxItem);
QFxItem *i = qobject_cast<QFxItem *>(o);
- if(i)
+ if (i)
q->children()->append(i);
else
resources_append(o);
@@ -806,9 +806,9 @@ void QFxItem::setQml(const QString &qml)
if (d->_qml == qml)
return;
- if(!d->_qml.isEmpty()) {
+ if (!d->_qml.isEmpty()) {
QmlChildren::Iterator iter = d->_qmlChildren.find(d->_qml);
- if(iter != d->_qmlChildren.end())
+ if (iter != d->_qmlChildren.end())
(*iter)->setOpacity(0.);
}
@@ -816,20 +816,20 @@ void QFxItem::setQml(const QString &qml)
d->_qmlurl = qmlContext(this)->resolvedUri(qml);
d->qmlItem = 0;
- if(d->_qml.isEmpty()) {
+ if (d->_qml.isEmpty()) {
emit qmlChanged();
return;
}
QmlChildren::Iterator iter = d->_qmlChildren.find(d->_qml);
- if(iter != d->_qmlChildren.end()) {
+ if (iter != d->_qmlChildren.end()) {
(*iter)->setOpacity(1.);
d->qmlItem = (*iter);
emit qmlChanged();
} else {
d->_qmlcomp =
new QmlComponent(qmlEngine(this), d->_qmlurl, this);
- if(!d->_qmlcomp->isLoading())
+ if (!d->_qmlcomp->isLoading())
qmlLoaded();
else
QObject::connect(d->_qmlcomp, SIGNAL(statusChanged(QmlComponent::Status)),
@@ -846,7 +846,7 @@ void QFxItem::qmlLoaded()
// ###
for (int i=0; i<d->_qmlnewloading.length(); ++i) {
QmlComponent *c = d->_qmlnewcomp.at(i);
- if(c->isLoading())
+ if (c->isLoading())
continue;
QmlContext *ctxt = new QmlContext(qmlContext(this));
@@ -872,7 +872,7 @@ void QFxItem::qmlLoaded()
QObject *obj = d->_qmlcomp->create(ctxt);
QFxItem *qmlChild = qobject_cast<QFxItem *>(obj);
- if(qmlChild) {
+ if (qmlChild) {
qmlChild->setItemParent(this);
d->_qmlChildren.insert(d->_qml, qmlChild);
d->qmlItem = qmlChild;
@@ -990,23 +990,23 @@ void QFxItem::geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry)
{
Q_D(QFxItem);
- if(newGeometry.width() != oldGeometry.width()) {
+ if (newGeometry.width() != oldGeometry.width()) {
int xoffset = oldGeometry.width() - newGeometry.width();
d->handleWidthChange(xoffset);
}
- if(newGeometry.height() != oldGeometry.height()) {
+ if (newGeometry.height() != oldGeometry.height()) {
int yoffset = oldGeometry.height() - newGeometry.height();
d->handleHeightChange(yoffset);
}
- if(newGeometry.x() != oldGeometry.x()) {
+ if (newGeometry.x() != oldGeometry.x()) {
emit leftChanged();
emit hcenterChanged();
emit rightChanged();
}
- if(newGeometry.y() != oldGeometry.y()) {
+ if (newGeometry.y() != oldGeometry.y()) {
emit topChanged();
emit vcenterChanged();
emit bottomChanged();
@@ -1016,7 +1016,7 @@ void QFxItem::geometryChanged(const QRectF &newGeometry,
void QFxItemPrivate::handleWidthChange(int xoffset)
{
Q_Q(QFxItem);
- if(!_anchors) {
+ if (!_anchors) {
emit q->hcenterChanged();
emit q->rightChanged();
} else {
@@ -1032,9 +1032,9 @@ void QFxItemPrivate::handleWidthChange(int xoffset)
emit q->rightChanged();
}
}
- if(q->rotation() && q->transformOrigin() != QFxItem::TopLeft)
+ if (q->rotation() && q->transformOrigin() != QFxItem::TopLeft)
q->setRotation(q->rotation());
- if(q->scale() && q->transformOrigin() != QFxItem::TopLeft)
+ if (q->scale() && q->transformOrigin() != QFxItem::TopLeft)
q->setScale(q->scale());
emit q->widthChanged();
}
@@ -1042,7 +1042,7 @@ void QFxItemPrivate::handleWidthChange(int xoffset)
void QFxItemPrivate::handleHeightChange(int yoffset)
{
Q_Q(QFxItem);
- if(!_anchors) {
+ if (!_anchors) {
emit q->vcenterChanged();
emit q->bottomChanged();
emit q->baselineChanged();
@@ -1064,9 +1064,9 @@ void QFxItemPrivate::handleHeightChange(int yoffset)
emit q->baselineChanged();
}
}
- if(q->rotation() && q->transformOrigin() != QFxItem::TopLeft)
+ if (q->rotation() && q->transformOrigin() != QFxItem::TopLeft)
q->setRotation(q->rotation());
- if(q->scale() && q->transformOrigin() != QFxItem::TopLeft)
+ if (q->scale() && q->transformOrigin() != QFxItem::TopLeft)
q->setScale(q->scale());
emit q->heightChanged();
}
@@ -1092,7 +1092,7 @@ bool QFxItem::flipVertically() const
void QFxItem::setFlipVertically(bool v)
{
- if(v)
+ if (v)
setFlip((QSimpleCanvasItem::Flip)(flip() | VerticalFlip));
else
setFlip((QSimpleCanvasItem::Flip)(flip() & ~VerticalFlip));
@@ -1111,7 +1111,7 @@ bool QFxItem::flipHorizontally() const
void QFxItem::setFlipHorizontally(bool v)
{
- if(v)
+ if (v)
setFlip((QSimpleCanvasItem::Flip)(flip() | HorizontalFlip));
else
setFlip((QSimpleCanvasItem::Flip)(flip() & ~HorizontalFlip));
@@ -1561,11 +1561,11 @@ qreal QFxItem::opacity() const
void QFxItem::setOpacity(qreal v)
{
- if(v == QSimpleCanvasItem::visible())
+ if (v == QSimpleCanvasItem::visible())
return;
- if(v < 0) v = 0;
- else if(v > 1) v = 1;
+ if (v < 0) v = 0;
+ else if (v > 1) v = 1;
QSimpleCanvasItem::setVisible(v);
emit opacityChanged();
@@ -1715,7 +1715,7 @@ QmlList<QmlTransition *>* QFxItem::transitions()
QmlState *QFxItem::findState(const QString &name) const
{
Q_D(const QFxItem);
- if(!d->_stateGroup)
+ if (!d->_stateGroup)
return 0;
else
return d->_stateGroup->findState(name);
@@ -1775,7 +1775,7 @@ QmlState *QFxItem::findState(const QString &name) const
QString QFxItem::state() const
{
Q_D(const QFxItem);
- if(!d->_stateGroup)
+ if (!d->_stateGroup)
return QString();
else
return d->_stateGroup->state();
@@ -1840,11 +1840,11 @@ bool QFxItem::isVisible() const
void QFxItem::setVisible(bool visible)
{
Q_D(QFxItem);
- if(visible == d->visible)
+ if (visible == d->visible)
return;
d->visible = visible;
- if(visible)
+ if (visible)
setOpacity(d->visibleOp);
else {
d->visibleOp = opacity();
@@ -1887,7 +1887,7 @@ void QFxItem::newChild(const QString &type)
d->_qmlnewloading.append(url);
d->_qmlnewcomp.append(new QmlComponent(qmlEngine(this), url, this));
- if(!d->_qmlnewcomp.last()->isLoading())
+ if (!d->_qmlnewcomp.last()->isLoading())
qmlLoaded();
else
connect(d->_qmlnewcomp.last(), SIGNAL(statusChanged(QmlComponent::Status)),
@@ -1905,7 +1905,7 @@ void QFxItem::classBegin()
Q_D(QFxItem);
d->_classComplete = false;
d->_componentComplete = false;
- if(d->_stateGroup)
+ if (d->_stateGroup)
d->_stateGroup->classBegin();
}
@@ -1921,7 +1921,7 @@ void QFxItem::classComplete()
#endif
Q_D(QFxItem);
d->_classComplete = true;
- if(d->_stateGroup)
+ if (d->_stateGroup)
d->_stateGroup->classComplete();
}
@@ -1935,13 +1935,13 @@ void QFxItem::componentComplete()
{
Q_D(QFxItem);
d->_componentComplete = true;
- if(d->_stateGroup)
+ if (d->_stateGroup)
d->_stateGroup->componentComplete();
- if(d->_anchors) {
+ if (d->_anchors) {
d->anchors()->connectHAnchors();
d->anchors()->connectVAnchors();
}
- if(!d->_transform.isEmpty())
+ if (!d->_transform.isEmpty())
updateTransform();
}
@@ -1966,9 +1966,9 @@ void QFxItem::updateTransform()
{
Q_D(QFxItem);
QSimpleCanvas::Matrix trans;
- for(int ii = d->_transform.count() - 1; ii >= 0; --ii) {
+ for (int ii = d->_transform.count() - 1; ii >= 0; --ii) {
QFxTransform *a = d->_transform.at(ii);
- if(!a->isIdentity())
+ if (!a->isIdentity())
trans = a->transform() * trans;
}
@@ -1986,9 +1986,9 @@ void QFxItem::transformChanged(const QSimpleCanvas::Matrix &)
QmlStateGroup *QFxItemPrivate::states()
{
Q_Q(QFxItem);
- if(!_stateGroup) {
+ if (!_stateGroup) {
_stateGroup = new QmlStateGroup(q);
- if(!_classComplete)
+ if (!_classComplete)
_stateGroup->classBegin();
QObject::connect(_stateGroup, SIGNAL(stateChanged(QString)),
q, SIGNAL(stateChanged(QString)));
diff --git a/src/declarative/fx/qfxitem_p.h b/src/declarative/fx/qfxitem_p.h
index 71fc912..f2da3ba 100644
--- a/src/declarative/fx/qfxitem_p.h
+++ b/src/declarative/fx/qfxitem_p.h
@@ -85,7 +85,7 @@ public:
{
Q_Q(QFxItem);
- if(parent)
+ if (parent)
q->setItemParent(parent);
_baselineOffset.invalidate();
q->setAcceptedMouseButtons(Qt::NoButton);
@@ -122,7 +122,7 @@ public:
QList<QFxTransform *> _transform;
QFxAnchors *anchors() {
- if(!_anchors) {
+ if (!_anchors) {
Q_Q(QFxItem);
_anchors = new QFxAnchors;
_anchors->setItem(q);
@@ -160,7 +160,7 @@ public:
mutable AnchorLines *_anchorLines;
AnchorLines *anchorLines() const {
Q_Q(const QFxItem);
- if(!_anchorLines) _anchorLines =
+ if (!_anchorLines) _anchorLines =
new AnchorLines(const_cast<QFxItem *>(q));
return _anchorLines;
}
diff --git a/src/declarative/fx/qfxkeyactions.cpp b/src/declarative/fx/qfxkeyactions.cpp
index d16c305..69d4679 100644
--- a/src/declarative/fx/qfxkeyactions.cpp
+++ b/src/declarative/fx/qfxkeyactions.cpp
@@ -78,15 +78,15 @@ QFxKeyActionsPrivate::QFxKeyActionsPrivate()
int QFxKeyActionsPrivate::keyToBit(Qt::Key k) const
{
- if(k >= Qt::Key_A && k <= Qt::Key_Z ) {
+ if (k >= Qt::Key_A && k <= Qt::Key_Z ) {
return k - Qt::Key_A;
- } else if(k >= Qt::Key_Left && k <= Qt::Key_Down) {
+ } else if (k >= Qt::Key_Left && k <= Qt::Key_Down) {
return 26 + k - Qt::Key_Left;
- } else if(k >= Qt::Key_0 && k <= Qt::Key_9) {
+ } else if (k >= Qt::Key_0 && k <= Qt::Key_9) {
return 30 + k - Qt::Key_0;
- } else if(k >= Qt::Key_Context1 && k <= Qt::Key_Flip) {
+ } else if (k >= Qt::Key_Context1 && k <= Qt::Key_Flip) {
return 40 + k - Qt::Key_Context1;
- } else if(k >= Qt::Key_Select && k <= Qt::Key_No) {
+ } else if (k >= Qt::Key_Select && k <= Qt::Key_No) {
return 47 + k - Qt::Key_Select;
} else {
const int start = 50;
@@ -117,7 +117,7 @@ bool QFxKeyActionsPrivate::key(Qt::Key k) const
{
int b = keyToBit(k);
bool rv = testBit(b);
- if(!rv && k != Qt::Key_Shift)
+ if (!rv && k != Qt::Key_Shift)
rv = testBit(keyToBit(Qt::Key_unknown));
return rv;
}
@@ -125,7 +125,7 @@ bool QFxKeyActionsPrivate::key(Qt::Key k) const
QString QFxKeyActionsPrivate::action(Qt::Key k) const
{
int b = keyToBit(k);
- if(b != -1 && testBit(b))
+ if (b != -1 && testBit(b))
return actions.value(k);
else
return actions.value(Qt::Key_unknown);
@@ -134,7 +134,7 @@ QString QFxKeyActionsPrivate::action(Qt::Key k) const
void QFxKeyActionsPrivate::setKey(Qt::Key k, bool v)
{
int b = keyToBit(k);
- if(b == -1)
+ if (b == -1)
return;
setBit(b, v);
@@ -142,10 +142,10 @@ void QFxKeyActionsPrivate::setKey(Qt::Key k, bool v)
bool QFxKeyActionsPrivate::testBit(int b) const
{
- if(b < 0)
+ if (b < 0)
return false;
- if(b < 32)
+ if (b < 32)
return keys1 & (1 << b);
else
return keys2 & (1 << (b - 32));
@@ -153,13 +153,13 @@ bool QFxKeyActionsPrivate::testBit(int b) const
void QFxKeyActionsPrivate::setBit(int b, bool v)
{
- if(v) {
- if(b < 32)
+ if (v) {
+ if (b < 32)
keys1 |= (1 << b);
else
keys2 |= (1 << (b - 32));
} else {
- if(b < 32)
+ if (b < 32)
keys1 &= ~(1 << b);
else
keys2 &= ~(1 << (b - 32));
@@ -198,7 +198,7 @@ QFxKeyActions::~QFxKeyActions()
QString QFxKeyActionsPrivate::keyExpr(Qt::Key k) const
{
- if(key(k))
+ if (key(k))
return actions.value(k);
else
return QString();
@@ -206,8 +206,8 @@ QString QFxKeyActionsPrivate::keyExpr(Qt::Key k) const
void QFxKeyActionsPrivate::setKeyExpr(Qt::Key k, const QString &expr)
{
- if(expr.isEmpty()) {
- if(key(k)) {
+ if (expr.isEmpty()) {
+ if (key(k)) {
actions.remove(k);
setKey(k, false);
}
@@ -231,7 +231,7 @@ bool QFxKeyActions::enabled() const
void QFxKeyActions::setEnabled(bool e)
{
- if(d->enabled == e)
+ if (d->enabled == e)
return;
d->enabled = e;
@@ -239,12 +239,7 @@ void QFxKeyActions::setEnabled(bool e)
}
/*!
- \qmlproperty string KeyActions::keyA
- \qmlproperty string KeyActions::keyB
- \qmlproperty string KeyActions::keyC
- \qmlproperty ... KeyActions::...
- \qmlproperty string KeyActions::keyY
- \qmlproperty string KeyActions::keyZ
+ \qmlproperty string KeyActions::keyA...keyZ
The action to take for the given letter.
@@ -569,11 +564,7 @@ void QFxKeyActions::setKey_Down(const QString &s)
}
/*!
- \qmlproperty string KeyActions::digit0
- \qmlproperty string KeyActions::digit1
- \qmlproperty string KeyActions::digit2
- \qmlproperty ... KeyActions::...
- \qmlproperty string KeyActions::digit9
+ \qmlproperty string KeyActions::digit0...digit9
The action to take for the given number key.
@@ -907,7 +898,7 @@ void QFxKeyActions::setKey_Any(const QString &s)
void QFxKeyActions::keyPressEvent(QKeyEvent *event)
{
Qt::Key key = (Qt::Key)event->key();
- if(d->enabled && d->key(key)) {
+ if (d->enabled && d->key(key)) {
QmlExpression b(qmlContext(this), d->action(key), this, false);
b.value();
event->accept();
@@ -919,7 +910,7 @@ void QFxKeyActions::keyPressEvent(QKeyEvent *event)
void QFxKeyActions::keyReleaseEvent(QKeyEvent *event)
{
Qt::Key key = (Qt::Key)event->key();
- if(d->enabled && d->key(key)) {
+ if (d->enabled && d->key(key)) {
event->accept();
} else {
QFxItem::keyReleaseEvent(event);
diff --git a/src/declarative/fx/qfxkeyproxy.cpp b/src/declarative/fx/qfxkeyproxy.cpp
index 7d5726f..6d92441 100644
--- a/src/declarative/fx/qfxkeyproxy.cpp
+++ b/src/declarative/fx/qfxkeyproxy.cpp
@@ -93,22 +93,22 @@ QList<QFxItem *> *QFxKeyProxy::targets() const
void QFxKeyProxy::keyPressEvent(QKeyEvent *e)
{
- for(int ii = 0; ii < d->targets.count(); ++ii) {
+ for (int ii = 0; ii < d->targets.count(); ++ii) {
QSimpleCanvasItem *i = d->targets.at(ii);
- if(i)
+ if (i)
i->keyPressEvent(e);
- if(e->isAccepted())
+ if (e->isAccepted())
return;
}
}
void QFxKeyProxy::keyReleaseEvent(QKeyEvent *e)
{
- for(int ii = 0; ii < d->targets.count(); ++ii) {
+ for (int ii = 0; ii < d->targets.count(); ++ii) {
QSimpleCanvasItem *i = d->targets.at(ii);
- if(i)
+ if (i)
i->keyReleaseEvent(e);
- if(e->isAccepted())
+ if (e->isAccepted())
return;
}
}
diff --git a/src/declarative/fx/qfxlayouts.cpp b/src/declarative/fx/qfxlayouts.cpp
index b89e795..76afeb0 100644
--- a/src/declarative/fx/qfxlayouts.cpp
+++ b/src/declarative/fx/qfxlayouts.cpp
@@ -96,7 +96,7 @@ int QFxBaseLayout::spacing() const
void QFxBaseLayout::setSpacing(int s)
{
Q_D(QFxBaseLayout);
- if(s==d->_spacing)
+ if (s==d->_spacing)
return;
d->_spacing = s;
preLayout();
@@ -116,7 +116,7 @@ int QFxBaseLayout::margin() const
void QFxBaseLayout::setMargin(int s)
{
Q_D(QFxBaseLayout);
- if(s==d->_margin)
+ if (s==d->_margin)
return;
d->_margin = s;
preLayout();
@@ -223,7 +223,7 @@ QFxItem *QFxBaseLayout::layoutItem() const
void QFxBaseLayout::setLayoutItem(QFxItem *li)
{
Q_D(QFxBaseLayout);
- if(li == d->_layoutItem)
+ if (li == d->_layoutItem)
return;
d->_layoutItem = li;
emit layoutItemChanged();
@@ -246,7 +246,7 @@ void QFxBaseLayout::childrenChanged()
bool QFxBaseLayout::event(QEvent *e)
{
Q_D(QFxBaseLayout);
- if(e->type() == QEvent::User) {
+ if (e->type() == QEvent::User) {
d->_ep = false;
d->_stableItems += d->_newItems;
d->_leavingItems.clear();
@@ -288,22 +288,22 @@ QSet<QFxItem *>* QFxBaseLayout::leavingItems()
void QFxBaseLayout::preLayout()
{
Q_D(QFxBaseLayout);
- if(!isComponentComplete() || d->_movingItem)
+ if (!isComponentComplete() || d->_movingItem)
return;
- if(!d->_ep) {
+ if (!d->_ep) {
d->_ep = true;
QCoreApplication::postEvent(this, new QEvent(QEvent::User));
}
- if(d->stateGroup) {
+ if (d->stateGroup) {
delete d->stateGroup; d->stateGroup = 0;
}
QSet<QFxItem *> allItems;
- for(int ii = 0; ii < this->QSimpleCanvasItem::children().count(); ++ii) {
+ for (int ii = 0; ii < this->QSimpleCanvasItem::children().count(); ++ii) {
QFxItem *child = qobject_cast<QFxItem *>(this->QSimpleCanvasItem::children().at(ii));
- if(!child)
+ if (!child)
continue;
- if(!d->_items.contains(child)){
+ if (!d->_items.contains(child)){
QObject::connect(child, SIGNAL(visibleChanged()),
this, SLOT(preLayout()));
QObject::connect(child, SIGNAL(heightChanged()),
@@ -312,20 +312,20 @@ void QFxBaseLayout::preLayout()
this, SLOT(preLayout()));
d->_items += child;
}
- if(!child->isVisible()){
- if(d->_stableItems.contains(child)){
+ if (!child->isVisible()){
+ if (d->_stableItems.contains(child)){
d->_leavingItems += child;
d->_stableItems -= child;
}
- }else if(!d->_stableItems.contains(child)){
+ }else if (!d->_stableItems.contains(child)){
d->_newItems+=child;
}
allItems += child;
}
QSet<QFxItem *> deletedItems = d->_items - allItems;
foreach(QFxItem *child, d->_items){
- if(!allItems.contains(child)){
- if(!deletedItems.contains(child)) {
+ if (!allItems.contains(child)){
+ if (!deletedItems.contains(child)) {
QObject::disconnect(child, SIGNAL(visibleChanged()),
this, SLOT(preLayout()));
QObject::disconnect(child, SIGNAL(heightChanged()),
@@ -343,8 +343,8 @@ void QFxBaseLayout::preLayout()
qreal width=0;
qreal height=0;
foreach(QFxItem *item, d->_items){
- if(item->isVisible()){
- if(!d->_animated.contains(item)){
+ if (item->isVisible()){
+ if (!d->_animated.contains(item)){
setMovingItem(item);
item->setPos(QPointF(item->x()+d->_margin, item->y()+d->_margin));
setMovingItem(0);
@@ -356,11 +356,11 @@ void QFxBaseLayout::preLayout()
width += d->_margin;
height+= d->_margin;
- if(d->aut & Horizontal)
+ if (d->aut & Horizontal)
setWidth(int(width));
else
setImplicitWidth(itemParent()->width());
- if(d->aut & Vertical)
+ if (d->aut & Vertical)
setHeight(int(height));
else
setImplicitHeight(itemParent()->height());
@@ -372,20 +372,20 @@ void QFxBaseLayout::applyTransition(const QList<QPair<QString, QVariant> >& chan
QFxItem* target, QmlTransition* trans)
{
Q_D(QFxBaseLayout);
- if(!trans||!target)//TODO: if !trans, just apply changes
+ if (!trans||!target)//TODO: if !trans, just apply changes
return;
setLayoutItem(target);
- if(d->stateGroup)
+ if (d->stateGroup)
delete d->stateGroup;
d->stateGroup = new QmlStateGroup(this);
QmlState *state = new QmlState;
*(d->stateGroup->statesProperty()) << state;
- for(int ii=0; ii<changes.size(); ++ii){
+ for (int ii=0; ii<changes.size(); ++ii){
QmlSetProperty *sp = new QmlSetProperty(state);
sp->setObject(target);
QVariant val = changes[ii].second;
- if(d->_margin &&
+ if (d->_margin &&
(changes[ii].first == QLatin1String("x") || changes[ii].first == QLatin1String("y"))){
val = QVariant(val.toInt() + d->_margin);
}
@@ -589,14 +589,14 @@ void QFxVerticalLayout::doLayout()
int voffset = 0;
foreach(QFxItem* item, *leavingItems()){
- if(remove()){
+ if (remove()){
QList<QPair<QString,QVariant> > changes;
applyRemove(changes, item);
}
}
- for(int ii = 0; ii < this->QSimpleCanvasItem::children().count(); ++ii) {
+ for (int ii = 0; ii < this->QSimpleCanvasItem::children().count(); ++ii) {
QFxItem *child = qobject_cast<QFxItem *>(this->QSimpleCanvasItem::children().at(ii));
- if(!child || !child->isVisible())
+ if (!child || !child->isVisible())
continue;
bool needMove = (child->y() != voffset || child->x());
@@ -604,11 +604,11 @@ void QFxVerticalLayout::doLayout()
QList<QPair<QString, QVariant> > changes;
changes << qMakePair(QString(QLatin1String("y")),QVariant(voffset));
changes << qMakePair(QString(QLatin1String("x")),QVariant(0));
- if(needMove && items()->contains(child) && move()) {
+ if (needMove && items()->contains(child) && move()) {
applyMove(changes,child);
- } else if(!items()->contains(child) && add()) {
+ } else if (!items()->contains(child) && add()) {
applyAdd(changes,child);
- } else if(needMove) {
+ } else if (needMove) {
setMovingItem(child);
child->setY(voffset);
setMovingItem(0);
@@ -742,14 +742,14 @@ void QFxHorizontalLayout::doLayout()
int hoffset = 0;
foreach(QFxItem* item, *leavingItems()){
- if(remove()){
+ if (remove()){
QList<QPair<QString,QVariant> > changes;
applyRemove(changes, item);
}
}
- for(int ii = 0; ii < this->QSimpleCanvasItem::children().count(); ++ii) {
+ for (int ii = 0; ii < this->QSimpleCanvasItem::children().count(); ++ii) {
QFxItem *child = qobject_cast<QFxItem *>(this->QSimpleCanvasItem::children().at(ii));
- if(!child || !child->isVisible())
+ if (!child || !child->isVisible())
continue;
bool needMove = (child->x() != hoffset || child->y());
@@ -757,11 +757,11 @@ void QFxHorizontalLayout::doLayout()
QList<QPair<QString, QVariant> > changes;
changes << qMakePair(QString(QLatin1String("x")),QVariant(hoffset));
changes << qMakePair(QString(QLatin1String("y")),QVariant(0));
- if(needMove && items()->contains(child) && move()) {
+ if (needMove && items()->contains(child) && move()) {
applyMove(changes,child);
- } else if(!items()->contains(child) && add()) {
+ } else if (!items()->contains(child) && add()) {
applyAdd(changes,child);
- } else if(needMove) {
+ } else if (needMove) {
setMovingItem(child);
child->setX(hoffset);
setMovingItem(0);
@@ -950,32 +950,32 @@ void QFxGridLayout::doLayout()
{
int c=_columns,r=_rows;//Actual number of rows/columns
int numVisible = items()->size() + newItems()->size();
- if(_columns==-1 && _rows==-1){
+ if (_columns==-1 && _rows==-1){
c = 4;
r = (numVisible+2)/3;
- }else if(_rows==-1){
+ }else if (_rows==-1){
r = (numVisible+(_columns-1))/_columns;
- }else if(_columns==-1){
+ }else if (_columns==-1){
c = (numVisible+(_rows-1))/_rows;
}
QList<int> maxColWidth;
QList<int> maxRowHeight;
int childIndex =0;
- for(int i=0; i<r; i++){
- for(int j=0; j<c; j++){
- if(j==0)
+ for (int i=0; i<r; i++){
+ for (int j=0; j<c; j++){
+ if (j==0)
maxRowHeight << 0;
- if(i==0)
+ if (i==0)
maxColWidth << 0;
- if(childIndex == this->QSimpleCanvasItem::children().count())
+ if (childIndex == this->QSimpleCanvasItem::children().count())
continue;
QFxItem *child = qobject_cast<QFxItem *>(this->QSimpleCanvasItem::children().at(childIndex++));
- if(!child || !child->isVisible())
+ if (!child || !child->isVisible())
continue;
- if(child->width() > maxColWidth[j])
+ if (child->width() > maxColWidth[j])
maxColWidth[j] = child->width();
- if(child->height() > maxRowHeight[i])
+ if (child->height() > maxRowHeight[i])
maxRowHeight[i] = child->height();
}
}
@@ -985,23 +985,23 @@ void QFxGridLayout::doLayout()
int curRow =0;
int curCol =0;
foreach(QFxItem* item, *leavingItems()){
- if(remove()){
+ if (remove()){
QList<QPair<QString,QVariant> > changes;
applyRemove(changes, item);
}
}
foreach(QSimpleCanvasItem* schild, this->QSimpleCanvasItem::children()){
QFxItem *child = qobject_cast<QFxItem *>(schild);
- if(!child || !child->isVisible())
+ if (!child || !child->isVisible())
continue;
bool needMove = (child->x()!=xoffset)||(child->y()!=yoffset);
QList<QPair<QString, QVariant> > changes;
changes << qMakePair(QString(QLatin1String("x")),QVariant(xoffset));
changes << qMakePair(QString(QLatin1String("y")),QVariant(yoffset));
- if(newItems()->contains(child) && add()) {
+ if (newItems()->contains(child) && add()) {
applyAdd(changes,child);
- } else if(needMove) {
- if(move()){
+ } else if (needMove) {
+ if (move()){
applyMove(changes,child);
}else{
setMovingItem(child);
@@ -1012,11 +1012,11 @@ void QFxGridLayout::doLayout()
xoffset+=maxColWidth[curCol]+spacing();
curCol++;
curCol%=c;
- if(!curCol){
+ if (!curCol){
yoffset+=maxRowHeight[curRow]+spacing();
xoffset=0;
curRow++;
- if(curRow>=r)
+ if (curRow>=r)
return;
}
}
diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp
index c85d8ce..0724e3a 100644
--- a/src/declarative/fx/qfxlistview.cpp
+++ b/src/declarative/fx/qfxlistview.cpp
@@ -98,8 +98,11 @@ public:
}
static QFxListViewAttached *properties(QObject *obj) {
- QFxListViewAttached *rv = new QFxListViewAttached(obj);
- attachedProperties.insert(obj, rv);
+ QFxListViewAttached *rv = attachedProperties.value(obj);
+ if (!rv) {
+ rv = new QFxListViewAttached(obj);
+ attachedProperties.insert(obj, rv);
+ }
return rv;
}
@@ -582,7 +585,7 @@ void QFxListViewPrivate::createHighlight()
if (nobj) {
highlightContext->setParent(nobj);
item = qobject_cast<QFxItem *>(nobj);
- if(!item) {
+ if (!item) {
delete nobj;
} else {
item->setParent(q->viewport());
@@ -1191,7 +1194,7 @@ int QFxListView::cacheBuffer() const
void QFxListView::setCacheBuffer(int b)
{
Q_D(QFxListView);
- if(d->buffer != b) {
+ if (d->buffer != b) {
d->buffer = b;
if (isComponentComplete())
refill();
@@ -1230,7 +1233,7 @@ QString QFxListView::sectionExpression() const
void QFxListView::setSectionExpression(const QString &expression)
{
Q_D(QFxListView);
- if(d->sectionExpression != expression) {
+ if (d->sectionExpression != expression) {
d->sectionExpression = expression;
emit sectionExpressionChanged();
}
@@ -1543,9 +1546,8 @@ void QFxListView::itemsInserted(int modelIndex, int count)
}
}
// everything is in order now - emit add() signal
- foreach(FxListItem *item, added)
- item->attached->emitAdd();
-
+ for (int j = 0; j < added.count(); ++j)
+ added.at(j)->attached->emitAdd();
emit countChanged();
}
diff --git a/src/declarative/fx/qfxmouseregion.cpp b/src/declarative/fx/qfxmouseregion.cpp
index be56786..d197c9a 100644
--- a/src/declarative/fx/qfxmouseregion.cpp
+++ b/src/declarative/fx/qfxmouseregion.cpp
@@ -155,7 +155,7 @@ void QFxDrag::setYmax(int m)
</Rect>
\endcode
- Many MouseRegion signals pass a \l {qml-mouseevent}{mouse} parameter that contains
+ Many MouseRegion signals pass a \l {MouseEvent}{mouse} parameter that contains
additional information about the mouse event, such as the position, button,
and any key modifiers.
@@ -163,13 +163,15 @@ void QFxDrag::setYmax(int m)
example extended so as to give a different color when you right click.
\code
<Rect width="100" height="100">
- <MouseRegion anchors.fill="{parent}" onClick="if(mouse.button=='Right') { parent.color='blue';} else { parent.color = 'red';}"/>
+ <MouseRegion anchors.fill="{parent}" onClick="if (mouse.button==Qt.RightButton) { parent.color='blue';} else { parent.color = 'red';}"/>
</Rect>
\endcode
For basic key handling, see \l KeyActions.
MouseRegion is an invisible element: it is never painted.
+
+ \sa MouseEvent
*/
/*!
@@ -201,6 +203,15 @@ void QFxDrag::setYmax(int m)
*/
/*!
+ \qmlsignal MouseRegion::onPositionChanged(mouse)
+
+ This handler is called when the mouse position changes.
+
+ The \l {MouseEvent}{mouse} parameter provides information about the mouse, including the x and y
+ position, and any buttons currently pressed.
+*/
+
+/*!
\qmlsignal MouseRegion::onClicked(mouse)
This handler is called when there is a click. A click is defined as a press followed by a release,
@@ -215,8 +226,8 @@ void QFxDrag::setYmax(int m)
\qmlsignal MouseRegion::onPressed(mouse)
This handler is called when there is a press.
- The \l {MouseEvent}{mouse} parameter provides information about the click, including the x and y
- position of the release of the click, and whether the click wasHeld.
+ The \l {MouseEvent}{mouse} parameter provides information about the press, including the x and y
+ position and which button was pressed.
*/
/*!
@@ -231,8 +242,8 @@ void QFxDrag::setYmax(int m)
\qmlsignal MouseRegion::onPressAndHold(mouse)
This handler is called when there is a long press (currently 800ms).
- The \l {MouseEvent}{mouse} parameter provides information about the click, including the x and y
- position of the release of the click, and whether the click wasHeld.
+ The \l {MouseEvent}{mouse} parameter provides information about the press, including the x and y
+ position of the press, and which button is pressed.
*/
/*!
@@ -309,29 +320,11 @@ void QFxMouseRegion::setEnabled(bool a)
d->absorb = a;
}
-void QFxMouseRegionPrivate::bindButtonValue(Qt::MouseButton b)
-{
- Q_Q(QFxMouseRegion);
- QString bString;
- switch(b){
- case Qt::LeftButton:
- bString = QLatin1String("Left"); break;
- case Qt::RightButton:
- bString = QLatin1String("Right"); break;
- case Qt::MidButton:
- bString = QLatin1String("Middle"); break;
- default:
- bString = QLatin1String("None"); break;
- }
- // ### is this needed anymore?
- qmlContext(q)->setContextProperty(QLatin1String("mouseButton"), bString);
-}
-
void QFxMouseRegion::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QFxMouseRegion);
d->moved = false;
- if(!d->absorb)
+ if (!d->absorb)
QFxItem::mousePressEvent(event);
else {
if (!d->inside) {
@@ -348,9 +341,7 @@ void QFxMouseRegion::mousePressEvent(QGraphicsSceneMouseEvent *event)
// ### we should only start timer if pressAndHold is connected to (but connectNotify doesn't work)
d->pressAndHoldTimer.start(PressAndHoldDelay, this);
setKeepMouseGrab(false);
- d->bindButtonValue(event->button());
setPressed(true);
- emit positionChanged();
event->accept();
}
}
@@ -358,7 +349,7 @@ void QFxMouseRegion::mousePressEvent(QGraphicsSceneMouseEvent *event)
void QFxMouseRegion::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QFxMouseRegion);
- if(!d->absorb) {
+ if (!d->absorb) {
QFxItem::mouseMoveEvent(event);
return;
}
@@ -378,10 +369,10 @@ void QFxMouseRegion::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
emit reenteredWhilePressed();
}
- if(drag()->target()) {
- if(!d->moved) {
- if(d->dragX) d->startX = int(drag()->target()->x()); //### change startX and startY to qreal?
- if(d->dragY) d->startY = int(drag()->target()->y());
+ if (drag()->target()) {
+ if (!d->moved) {
+ if (d->dragX) d->startX = int(drag()->target()->x()); //### change startX and startY to qreal?
+ if (d->dragY) d->startY = int(drag()->target()->y());
}
QPointF startLocalPos;
@@ -406,7 +397,7 @@ void QFxMouseRegion::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
}
}
- if(d->dragX) {
+ if (d->dragX) {
qreal x = (curLocalPos.x() - startLocalPos.x()) + d->startX;
if (x < drag()->xmin())
x = drag()->xmin();
@@ -414,7 +405,7 @@ void QFxMouseRegion::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
x = drag()->xmax();
drag()->target()->setX(x);
}
- if(d->dragY) {
+ if (d->dragY) {
qreal y = (curLocalPos.y() - startLocalPos.y()) + d->startY;
if (y < drag()->ymin())
y = drag()->ymin();
@@ -424,7 +415,8 @@ void QFxMouseRegion::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
}
}
d->moved = true;
- emit positionChanged();
+ QFxMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, false, d->longPress);
+ emit positionChanged(&me);
event->accept();
}
@@ -432,7 +424,7 @@ void QFxMouseRegion::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
void QFxMouseRegion::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QFxMouseRegion);
- if(!d->absorb)
+ if (!d->absorb)
QFxItem::mouseReleaseEvent(event);
else {
d->saveEvent(event);
@@ -446,7 +438,7 @@ void QFxMouseRegion::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void QFxMouseRegion::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QFxMouseRegion);
- if(!d->absorb)
+ if (!d->absorb)
QFxItem::mouseDoubleClickEvent(event);
else {
//d->inside = true;
@@ -462,7 +454,7 @@ void QFxMouseRegion::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
void QFxMouseRegion::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{
Q_D(QFxMouseRegion);
- if(!d->absorb)
+ if (!d->absorb)
QFxItem::hoverEnterEvent(event);
else {
setHovered(true);
@@ -473,7 +465,7 @@ void QFxMouseRegion::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
void QFxMouseRegion::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{
Q_D(QFxMouseRegion);
- if(!d->absorb)
+ if (!d->absorb)
QFxItem::hoverLeaveEvent(event);
else {
setHovered(false);
@@ -533,7 +525,7 @@ bool QFxMouseRegion::pressed()
void QFxMouseRegion::setHovered(bool h)
{
Q_D(QFxMouseRegion);
- if(d->hovered != h) {
+ if (d->hovered != h) {
d->hovered = h;
emit hoveredChanged();
}
@@ -544,12 +536,13 @@ void QFxMouseRegion::setPressed(bool p)
Q_D(QFxMouseRegion);
bool isclick = d->pressed == true && p == false && d->dragged == false && d->inside == true;
- if(d->pressed != p) {
+ if (d->pressed != p) {
d->pressed = p;
QFxMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, isclick, d->longPress);
- if(d->pressed)
+ if (d->pressed) {
+ emit positionChanged(&me);
emit pressed(&me);
- else {
+ } else {
emit released(&me);
if (isclick)
emit clicked(&me);
diff --git a/src/declarative/fx/qfxmouseregion.h b/src/declarative/fx/qfxmouseregion.h
index 2e2a1d4..2ba4a50 100644
--- a/src/declarative/fx/qfxmouseregion.h
+++ b/src/declarative/fx/qfxmouseregion.h
@@ -121,7 +121,7 @@ public:
Q_SIGNALS:
void hoveredChanged();
void pressedChanged();
- void positionChanged();
+ void positionChanged(QFxMouseEvent *mouse);
void pressed(QFxMouseEvent *mouse);
void pressAndHold(QFxMouseEvent *mouse);
diff --git a/src/declarative/fx/qfxmouseregion_p.h b/src/declarative/fx/qfxmouseregion_p.h
index e9d1986..e444bf2 100644
--- a/src/declarative/fx/qfxmouseregion_p.h
+++ b/src/declarative/fx/qfxmouseregion_p.h
@@ -66,7 +66,7 @@ class QFxMouseRegionPrivate : public QFxItemPrivate
public:
QFxMouseRegionPrivate()
- : absorb(true), hovered(false), inside(true), pressed(false), longPress(0), drag(0)
+ : absorb(true), hovered(false), inside(true), pressed(false), longPress(false), drag(0)
{
}
@@ -77,8 +77,6 @@ public:
q->setOptions(QSimpleCanvasItem::HoverEvents | QSimpleCanvasItem::MouseEvents);
}
- void bindButtonValue(Qt::MouseButton);
-
void saveEvent(QGraphicsSceneMouseEvent *event) {
lastPos = event->pos();
lastButton = event->button();
@@ -86,16 +84,16 @@ public:
lastModifiers = event->modifiers();
}
- bool absorb;
- bool hovered;
- bool inside;
- bool pressed;
- bool longPress;
+ bool absorb : 1;
+ bool hovered : 1;
+ bool inside : 1;
+ bool pressed : 1;
+ bool longPress : 1;
+ bool moved : 1;
+ bool dragX : 1;
+ bool dragY : 1;
+ bool dragged : 1;
QFxDrag drag;
- bool moved;
- bool dragX;
- bool dragY;
- bool dragged;
QPointF start;
QPointF startScene;
int startX;
diff --git a/src/declarative/fx/qfxpainted.cpp b/src/declarative/fx/qfxpainted.cpp
index ad1b3ad..7c88ce3 100644
--- a/src/declarative/fx/qfxpainted.cpp
+++ b/src/declarative/fx/qfxpainted.cpp
@@ -46,7 +46,7 @@
QT_BEGIN_NAMESPACE
/*!
\class QFxPainted
- \brief QFxPainted is an abstract base class for QFxView items that paint using QPainter.
+ \brief The QFxPainted class is an abstract base class for QFxView items that paint using QPainter.
\ingroup group_coreitems
diff --git a/src/declarative/fx/qfxparticles.cpp b/src/declarative/fx/qfxparticles.cpp
index 8b16098..309ebe8 100644
--- a/src/declarative/fx/qfxparticles.cpp
+++ b/src/declarative/fx/qfxparticles.cpp
@@ -268,14 +268,14 @@ void QFxParticleMotionGravity::advance(QFxParticle &p, int interval)
*/
/*!
- \qmlproperty QFxParticleMotionWander::xvariance
- \qmlproperty QFxParticleMotionWander::yvariance
+ \qmlproperty int QFxParticleMotionWander::xvariance
+ \qmlproperty int QFxParticleMotionWander::yvariance
These properties set the amount to wander in the x and y directions.
*/
/*!
- \qmlproperty QFxParticleMotionWander::pace
+ \qmlproperty int QFxParticleMotionWander::pace
This property holds how quickly the paricles will move from side to side.
*/
@@ -413,17 +413,17 @@ void QFxParticlesPrivate::tick(int time)
if (!addParticleTime)
addParticleTime = time;
- if(particles.count() < count && emitting) {
+ if (particles.count() < count && emitting) {
qreal perc = (lifeSpanDev <= 0)?(1.):(qreal(time - addParticleTime) / qreal(lifeSpanDev));
int percCount = addParticleCount + (int)perc * (count - addParticleCount);
int streamWidth = -1;
- if(stream){
- if(streamDelay > time){
+ if (stream){
+ if (streamDelay > time){
streamWidth = 0;
}else{
int missed = time - streamDelay;
qreal streamWidthReal = qreal(count)/qreal(lifeSpan);
- if(streamWidthReal < 1){
+ if (streamWidthReal < 1){
streamDelay = time + (int)(1.0/streamWidthReal);
streamWidth = 1;
streamWidth += missed/streamDelay;
diff --git a/src/declarative/fx/qfxpath.cpp b/src/declarative/fx/qfxpath.cpp
index 2009237..f08671d 100644
--- a/src/declarative/fx/qfxpath.cpp
+++ b/src/declarative/fx/qfxpath.cpp
@@ -185,7 +185,7 @@ QList<QFxPathElement *>* QFxPath::pathElements()
void QFxPath::interpolate(int idx, const QString &name, qreal value)
{
Q_D(QFxPath);
- if(!idx)
+ if (!idx)
return;
qreal lastValue = 0;
@@ -193,7 +193,7 @@ void QFxPath::interpolate(int idx, const QString &name, qreal value)
int search = idx - 1;
while(search >= 0) {
const AttributePoint &point = d->_attributePoints.at(search);
- if(point.values.contains(name)) {
+ if (point.values.contains(name)) {
lastValue = point.values.value(name);
lastPercent = point.origpercent;
break;
@@ -205,7 +205,7 @@ void QFxPath::interpolate(int idx, const QString &name, qreal value)
const AttributePoint &curPoint = d->_attributePoints.at(idx);
- for(int ii = search; ii < idx; ++ii) {
+ for (int ii = search; ii < idx; ++ii) {
AttributePoint &point = d->_attributePoints[ii];
qreal val = lastValue + (value - lastValue) * (point.origpercent - lastPercent) / (curPoint.origpercent - lastPercent);
@@ -218,10 +218,10 @@ void QFxPath::endpoint(const QString &name)
Q_D(QFxPath);
const AttributePoint &first = d->_attributePoints.first();
qreal val = first.values.value(name);
- for(int ii = d->_attributePoints.count() - 1; ii >= 0; ii--) {
+ for (int ii = d->_attributePoints.count() - 1; ii >= 0; ii--) {
const AttributePoint &point = d->_attributePoints.at(ii);
- if(point.values.contains(name)) {
- for(int jj = ii + 1; jj < d->_attributePoints.count(); ++jj) {
+ if (point.values.contains(name)) {
+ for (int jj = ii + 1; jj < d->_attributePoints.count(); ++jj) {
AttributePoint &setPoint = d->_attributePoints[jj];
setPoint.values.insert(name, val);
}
@@ -239,23 +239,23 @@ void QFxPath::processPath()
d->_path = QPainterPath();
AttributePoint first;
- for(int ii = 0; ii < d->_attributes.count(); ++ii)
+ for (int ii = 0; ii < d->_attributes.count(); ++ii)
first.values[d->_attributes.at(ii)] = 0;
d->_attributePoints << first;
d->_path.moveTo(d->startX, d->startY);
foreach (QFxPathElement *pathElement, d->_pathElements) {
- if(QFxCurve *curve = qobject_cast<QFxCurve *>(pathElement)) {
+ if (QFxCurve *curve = qobject_cast<QFxCurve *>(pathElement)) {
curve->addToPath(d->_path);
AttributePoint p;
p.origpercent = d->_path.length();
d->_attributePoints << p;
- } else if(QFxPathAttribute *attribute = qobject_cast<QFxPathAttribute *>(pathElement)) {
+ } else if (QFxPathAttribute *attribute = qobject_cast<QFxPathAttribute *>(pathElement)) {
AttributePoint &point = d->_attributePoints.last();
point.values[attribute->name()] = attribute->value();
interpolate(d->_attributePoints.count() - 1, attribute->name(), attribute->value());
- } else if(QFxPathPercent *percent = qobject_cast<QFxPathPercent *>(pathElement)) {
+ } else if (QFxPathPercent *percent = qobject_cast<QFxPathPercent *>(pathElement)) {
AttributePoint &point = d->_attributePoints.last();
point.values[QLatin1String("_qfx_percent")] = percent->value();
interpolate(d->_attributePoints.count() - 1, QLatin1String("_qfx_percent"), percent->value());
@@ -264,8 +264,8 @@ void QFxPath::processPath()
// Fixup end points
const AttributePoint &last = d->_attributePoints.last();
- for(int ii = 0; ii < d->_attributes.count(); ++ii) {
- if(!last.values.contains(d->_attributes.at(ii)))
+ for (int ii = 0; ii < d->_attributes.count(); ++ii) {
+ if (!last.values.contains(d->_attributes.at(ii)))
endpoint(d->_attributes.at(ii));
}
@@ -273,9 +273,9 @@ void QFxPath::processPath()
qreal length = d->_path.length();
qreal prevpercent = 0;
qreal prevorigpercent = 0;
- for(int ii = 0; ii < d->_attributePoints.count(); ++ii) {
+ for (int ii = 0; ii < d->_attributePoints.count(); ++ii) {
const AttributePoint &point = d->_attributePoints.at(ii);
- if(point.values.contains(QLatin1String("_qfx_percent"))) { //special string for QFxPathPercent
+ if (point.values.contains(QLatin1String("_qfx_percent"))) { //special string for QFxPathPercent
if ( ii > 0) {
qreal scale = (d->_attributePoints[ii].origpercent/length - prevorigpercent) /
(point.values.value(QLatin1String("_qfx_percent"))-prevpercent);
@@ -300,7 +300,7 @@ void QFxPath::componentComplete()
QSet<QString> attrs;
// First gather up all the attributes
foreach (QFxPathElement *pathElement, d->_pathElements) {
- if(QFxPathAttribute *attribute =
+ if (QFxPathAttribute *attribute =
qobject_cast<QFxPathAttribute *>(pathElement))
attrs.insert(attribute->name());
}
@@ -383,10 +383,10 @@ void QFxPath::createPointCache() const
//find which set we are in
qreal prevPercent = 0;
qreal prevOrigPercent = 0;
- for(int ii = 0; ii < d->_attributePoints.count(); ++ii) {
+ for (int ii = 0; ii < d->_attributePoints.count(); ++ii) {
qreal percent = qreal(i)/points;
const AttributePoint &point = d->_attributePoints.at(ii);
- if(percent < point.percent || ii == d->_attributePoints.count() - 1) { //### || is special case for very last item
+ if (percent < point.percent || ii == d->_attributePoints.count() - 1) { //### || is special case for very last item
qreal elementPercent = (percent - prevPercent);
qreal spc = prevOrigPercent + elementPercent * point.scale;
@@ -430,15 +430,15 @@ QPointF QFxPath::pointAt(qreal p) const
qreal QFxPath::attributeAt(const QString &name, qreal percent) const
{
Q_D(const QFxPath);
- if(percent < 0 || percent > 1)
+ if (percent < 0 || percent > 1)
return 0;
- for(int ii = 0; ii < d->_attributePoints.count(); ++ii) {
+ for (int ii = 0; ii < d->_attributePoints.count(); ++ii) {
const AttributePoint &point = d->_attributePoints.at(ii);
- if(point.percent == percent) {
+ if (point.percent == percent) {
return point.values.value(name);
- } else if(point.percent > percent) {
+ } else if (point.percent > percent) {
qreal lastValue =
ii?(d->_attributePoints.at(ii - 1).values.value(name)):0;
qreal lastPercent =
diff --git a/src/declarative/fx/qfxpathview.cpp b/src/declarative/fx/qfxpathview.cpp
index 59c7cd1..c0d3ab2 100644
--- a/src/declarative/fx/qfxpathview.cpp
+++ b/src/declarative/fx/qfxpathview.cpp
@@ -246,7 +246,7 @@ void QFxPathView::setCurrentIndex(int idx)
d->currentIndex = idx;
d->snapToCurrent();
int itemIndex = (idx - d->firstIndex + d->model->count()) % d->model->count();
- if(itemIndex < d->items.count())
+ if (itemIndex < d->items.count())
d->items.at(itemIndex)->setFocus(true);
emit currentIndexChanged();
}
@@ -392,7 +392,7 @@ int QFxPathView::pathItemCount() const
void QFxPathView::setPathItemCount(int i)
{
Q_D(QFxPathView);
- if(i == d->pathItems)
+ if (i == d->pathItems)
return;
d->pathItems = i;
d->regenerate();
@@ -553,7 +553,7 @@ bool QFxPathView::sendMouseEvent(QGraphicsSceneMouseEvent *event)
bool QFxPathView::mouseFilter(QGraphicsSceneMouseEvent *e)
{
- if(!isVisible())
+ if (!isVisible())
return false;
switch (e->type()) {
@@ -579,7 +579,7 @@ void QFxPathViewPrivate::regenerate()
if (!model || model->count() <= 0 || !model->delegate() || !path)
return;
- for(int i=0; i<items.count(); i++){
+ for (int i=0; i<items.count(); i++){
QFxItem *p = items[i];
q->attachedProperties.remove(p);
model->release(p);
@@ -592,7 +592,7 @@ void QFxPathViewPrivate::regenerate()
int numItems = (pathItems>=0 ? pathItems : model->count());
qreal minDiff = 1e9;
int minI = -1;
- for(int i=0; i<numItems; i++){
+ for (int i=0; i<numItems; i++){
QFxItem *item = model->item(i);
if (!item)
return;
@@ -603,7 +603,7 @@ void QFxPathViewPrivate::regenerate()
percent /= 100.0;
updateItem(items.last(), percent);
qreal diff = qAbs(percent - snapPos);
- if(diff < minDiff){
+ if (diff < minDiff){
minDiff = diff;
minI = i;
}
@@ -615,8 +615,8 @@ void QFxPathViewPrivate::regenerate()
void QFxPathViewPrivate::updateItem(QFxItem *item, qreal percent)
{
- if(QObject *obj = QFxPathView::attachedProperties.value(item)) {
- foreach(QString attr, path->attributes())
+ if (QObject *obj = QFxPathView::attachedProperties.value(item)) {
+ foreach(const QString &attr, path->attributes())
static_cast<QFxPathViewAttached *>(obj)->setValue(attr.toLatin1(), path->attributeAt(attr, percent));
}
@@ -632,36 +632,36 @@ void QFxPathView::refill()
return;
QList<qreal> positions;
- for(int i=0; i<d->items.count(); i++){
+ for (int i=0; i<d->items.count(); i++){
qreal percent = i * (100. / d->items.count());
percent = percent + d->_offset;
percent = fmod(percent,100.);
positions << qAbs(percent/100.0);
}
- if(d->pathItems==-1){
- for(int i=0; i<positions.count(); i++){
+ if (d->pathItems==-1){
+ for (int i=0; i<positions.count(); i++){
d->updateItem(d->items.at(i), positions[i]);
}
return;
}
QList<qreal> rotatedPositions;
- for(int i=0; i<d->items.count(); i++)
+ for (int i=0; i<d->items.count(); i++)
rotatedPositions << positions[(i + d->pathOffset + d->items.count()) % d->items.count()];
int firstFind = -1;
int i;
- for(i=0; i<d->items.count()-1; i++)
+ for (i=0; i<d->items.count()-1; i++)
{
- if(rotatedPositions[i] > rotatedPositions[i+1]){
+ if (rotatedPositions[i] > rotatedPositions[i+1]){
firstFind = i;
break;
}
}
- if(firstFind!=-1 ){
+ if (firstFind!=-1 ){
//A wraparound has occured
- if(firstFind<(d->items.count()/2)){
+ if (firstFind<(d->items.count()/2)){
while(firstFind-- >= 0){
QFxItem* p = d->items.takeFirst();
attachedProperties.remove(p);
@@ -681,21 +681,21 @@ void QFxPathView::refill()
attachedProperties.remove(p);
d->model->release(p);
d->firstIndex--;
- if(d->firstIndex<0)
+ if (d->firstIndex<0)
d->firstIndex = d->model->count() - 1;
d->items.prepend(d->model->item(d->firstIndex));
d->items.first()->setZ(d->firstIndex);
d->items.first()->setParent(this);
d->pathOffset--;
- if(d->pathOffset<0)
+ if (d->pathOffset<0)
d->pathOffset = d->items.count() - 1;
}
}
- for(int i=0; i<d->items.count(); i++)
+ for (int i=0; i<d->items.count(); i++)
rotatedPositions[i] = positions[(i + d->pathOffset + d->items.count())
% d->items.count()];
}
- for(int i=0; i<d->items.count(); i++){
+ for (int i=0; i<d->items.count(); i++){
d->updateItem(d->items.at(i), rotatedPositions[i]);
}
}
@@ -712,26 +712,26 @@ int QFxPathViewPrivate::calcCurrentIndex()
int current = -1;
if (model && items.count()) {
_offset = fmod(_offset, 100.0);
- if(_offset < 0)
+ if (_offset < 0)
_offset += 100.0;
- if(pathItems == -1){
+ if (pathItems == -1){
qreal delta = fmod(_offset - snapPos, 100.0);
if (delta < 0)
delta = 100.0 + delta;
int ii = model->count() - qRound(delta * model->count() / 100);
- if(ii < 0)
+ if (ii < 0)
ii = 0;
current = ii;
}else{
qreal bestDiff=1e9;
int bestI=-1;
- for(int i=0; i<items.count(); i++){
+ for (int i=0; i<items.count(); i++){
qreal percent = i * (100. / items.count());
percent = percent + _offset;
percent = fmod(percent,100.);
qreal diff = qAbs(snapPos - (percent/100.0));
- if(diff < bestDiff){
+ if (diff < bestDiff){
bestDiff = diff;
bestI = i;
}
@@ -755,7 +755,7 @@ void QFxPathViewPrivate::updateCurrent()
if (model && idx != currentIndex) {
currentIndex = idx;
int itemIndex = (idx - firstIndex + model->count()) % model->count();
- if(itemIndex < items.count())
+ if (itemIndex < items.count())
items.at(itemIndex)->setFocus(true);
emit q->currentIndexChanged();
}
@@ -783,7 +783,7 @@ void QFxPathViewPrivate::snapToCurrent()
//Rounds is the number of times round to make the current item visible
int rounds = itemIndex / items.count();
int otherWayRounds = (model->count() - (itemIndex))/items.count() + 1;
- if(otherWayRounds < rounds)
+ if (otherWayRounds < rounds)
rounds = -otherWayRounds;
itemIndex += pathOffset;
@@ -799,12 +799,12 @@ void QFxPathViewPrivate::snapToCurrent()
tl.clear();
moveOffset.setValue(_offset);
- if(rounds!=0){
+ if (rounds!=0){
//Compensate if the targetOffset would bring the target it from off the screen
qreal distance = targetOffset - _offset;
- if(distance <= -50)
+ if (distance <= -50)
rounds--;
- if(distance > 50)
+ if (distance > 50)
rounds++;
tl.move(moveOffset, targetOffset + 100.0*(-rounds), QEasingCurve(QEasingCurve::InOutQuad),
int(100*items.count()*qMax((qreal)(2.0/items.count()),(qreal)qAbs(rounds))));
diff --git a/src/declarative/fx/qfxpixmap.cpp b/src/declarative/fx/qfxpixmap.cpp
index 5a08679..0d456c6 100644
--- a/src/declarative/fx/qfxpixmap.cpp
+++ b/src/declarative/fx/qfxpixmap.cpp
@@ -67,7 +67,7 @@ public:
int refCount;
void addRef() { ++refCount; }
- void release() { Q_ASSERT(refCount > 0); --refCount; if(refCount == 0) { qfxPixmapCache.remove(key); delete this; } }
+ void release() { Q_ASSERT(refCount > 0); --refCount; if (refCount == 0) { qfxPixmapCache.remove(key); delete this; } }
};
static QFxPixmapCacheItem qfxPixmapCacheDummyItem;
@@ -104,7 +104,7 @@ QFxPixmap::QFxPixmap(const QUrl &url)
#endif
QString key = url.toString();
QFxPixmapCache::Iterator iter = qfxPixmapCache.find(key);
- if(iter == qfxPixmapCache.end()) {
+ if (iter == qfxPixmapCache.end()) {
qWarning() << "QFxPixmap: URL not loaded" << url;
} else {
QNetworkReply *reply = (*iter)->reply;
@@ -180,10 +180,10 @@ QPixmap QFxPixmap::pixmap() const
void QFxPixmap::setPixmap(const QPixmap &pix)
{
QFxPixmapCache::Iterator iter = qfxPixmapCache.find(QString::number(pix.cacheKey()));
- if(iter == qfxPixmapCache.end()) {
+ if (iter == qfxPixmapCache.end()) {
QFxPixmapCacheItem *item = new QFxPixmapCacheItem;
item->key = QString::number(pix.cacheKey());
- if(d->pixmap)
+ if (d->pixmap)
d->pixmap->release();
d->pixmap = item;
d->pixmap->image = pix.toImage();
@@ -195,7 +195,7 @@ void QFxPixmap::setPixmap(const QPixmap &pix)
#if 0
int size = 0;
- for(QFxPixmapCache::Iterator iter = qfxPixmapCache.begin(); iter != qfxPixmapCache.end(); ++iter) {
+ for (QFxPixmapCache::Iterator iter = qfxPixmapCache.begin(); iter != qfxPixmapCache.end(); ++iter) {
size += (*iter)->image.width() * (*iter)->image.height();
}
qWarning() << qfxPixmapCache.count() << size;
@@ -207,8 +207,8 @@ QFxPixmap::operator const QSimpleCanvasConfig::Image &() const
#if defined(QFX_RENDER_OPENGL)
return d->pixmap->image;
#else
- if(d->opaque) {
- if(!d->pixmap->image.isNull() && d->pixmap->opaqueImage.isNull()) {
+ if (d->opaque) {
+ if (!d->pixmap->image.isNull() && d->pixmap->opaqueImage.isNull()) {
#ifdef Q_ENABLE_PERFORMANCE_LOG
QFxPerfTimer<QFxPerf::PixmapLoad> perf;
#endif
@@ -218,7 +218,7 @@ QFxPixmap::operator const QSimpleCanvasConfig::Image &() const
}
return d->pixmap->opaqueImage;
} else {
- if(!d->pixmap->image.isNull() && d->pixmap->image.format() != QImage::Format_ARGB32_Premultiplied) {
+ if (!d->pixmap->image.isNull() && d->pixmap->image.format() != QImage::Format_ARGB32_Premultiplied) {
#ifdef Q_ENABLE_PERFORMANCE_LOG
QFxPerfTimer<QFxPerf::PixmapLoad> perf;
#endif
@@ -238,7 +238,7 @@ void QFxPixmap::get(QmlEngine *engine, const QUrl& url, QObject* obj, const char
{
QString key = url.toString();
QFxPixmapCache::Iterator iter = qfxPixmapCache.find(key);
- if(iter == qfxPixmapCache.end()) {
+ if (iter == qfxPixmapCache.end()) {
QFxPixmapCacheItem *item = new QFxPixmapCacheItem;
item->addRef(); // XXX - will never get deleted. Need to revisit caching
item->key = key;
@@ -274,7 +274,7 @@ void QFxPixmap::cancelGet(const QUrl& url, QObject* obj, const char* slot)
{
QString key = url.toString();
QFxPixmapCache::Iterator iter = qfxPixmapCache.find(key);
- if(iter == qfxPixmapCache.end())
+ if (iter == qfxPixmapCache.end())
return;
if ((*iter)->reply)
QObject::disconnect((*iter)->reply, SIGNAL(finished()), obj, slot);
diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp
index a761ec5..2bfc149 100644
--- a/src/declarative/fx/qfxrect.cpp
+++ b/src/declarative/fx/qfxrect.cpp
@@ -238,7 +238,7 @@ QColor QFxRect::color() const
void QFxRect::setColor(const QColor &c)
{
Q_D(QFxRect);
- if(d->_color == c)
+ if (d->_color == c)
return;
d->_color = c;
@@ -281,7 +281,7 @@ QColor QFxRect::tintColor() const
void QFxRect::setTintColor(const QColor &c)
{
Q_D(QFxRect);
- if(d->_tintColor == c)
+ if (d->_tintColor == c)
return;
d->_tintColor = c;
@@ -290,11 +290,11 @@ void QFxRect::setTintColor(const QColor &c)
QColor QFxRectPrivate::getColor()
{
- if(_tintColor.isValid()) {
+ if (_tintColor.isValid()) {
int a = _tintColor.alpha();
- if(a == 0xFF)
+ if (a == 0xFF)
return _tintColor;
- else if(a == 0x00)
+ else if (a == 0x00)
return _color;
else {
uint src = _tintColor.rgba();
@@ -304,7 +304,7 @@ QColor QFxRectPrivate::getColor()
((0xFF - a) * (dest & 0xFF00FF))) >> 8) & 0xFF00FF;
res |= (((a * ((src >> 8) & 0xFF00FF)) +
((0xFF - a) * ((dest >> 8) & 0xFF00FF)))) & 0xFF00FF00;
- if((src & 0xFF000000) == 0xFF000000)
+ if ((src & 0xFF000000) == 0xFF000000)
res |= 0xFF000000;
return QColor::fromRgba(res);
@@ -344,7 +344,7 @@ QColor QFxRect::gradientColor() const
void QFxRect::setGradientColor(const QColor &c)
{
Q_D(QFxRect);
- if(d->_gradcolor == c)
+ if (d->_gradcolor == c)
return;
d->_gradcolor = c;
@@ -438,14 +438,14 @@ void QFxRect::paintContents(QPainter &p)
void QFxRect::drawRect(QPainter &p)
{
Q_D(QFxRect);
- if(d->_gradcolor.isValid() /*|| p.usingQt() */) {
+ if (d->_gradcolor.isValid() /*|| p.usingQt() */) {
// XXX This path is still slower than the image path
// Image path won't work for gradients though
p.save();
QPen pn(QColor(pen()->color()), pen()->width());
p.setRenderHint(QPainter::Antialiasing);
p.setPen(pn);
- if(d->_gradcolor.isValid()){
+ if (d->_gradcolor.isValid()){
QLinearGradient grad(0, 0, 0, height());
grad.setColorAt(0, d->_color);
grad.setColorAt(1, d->_gradcolor);
@@ -453,7 +453,7 @@ void QFxRect::drawRect(QPainter &p)
}else{
p.setBrush(d->_color);
}
- if(d->_radius)
+ if (d->_radius)
p.drawRoundedRect(0, 0, width(), height(), d->_radius, d->_radius);
else
p.drawRect(0, 0, width(), height());
@@ -477,36 +477,36 @@ void QFxRect::drawRect(QPainter &p)
p.drawImage(QRect(0, 0, offset, offset), d->_rectImage, QRect(0, 0, offset, offset));
// Upper middle
- if(d->_rectImage.width() - xSide)
+ if (d->_rectImage.width() - xSide)
p.drawImage(QRect(offset, 0, width() - xSide, offset), d->_rectImage,
QRect(offset, 0, d->_rectImage.width() - xSide, offset));
// Upper right
- if(d->_rectImage.width() - offset) {
+ if (d->_rectImage.width() - offset) {
p.drawImage(QPoint(width()-offset, 0), d->_rectImage,
QRect(d->_rectImage.width()-offset, 0, offset, offset));
}
// Middle left
- if(d->_rectImage.height() - ySide)
+ if (d->_rectImage.height() - ySide)
p.drawImage(QRect(0, offset, offset, height() - ySide), d->_rectImage,
QRect(0, offset, offset, d->_rectImage.height() - ySide));
// Middle
- if(d->_rectImage.width() - xSide && d->_rectImage.height() - ySide)
+ if (d->_rectImage.width() - xSide && d->_rectImage.height() - ySide)
p.drawImage(QRect(offset, offset, width() - xSide, height() - ySide), d->_rectImage,
QRect(offset, offset, d->_rectImage.width() - xSide, d->_rectImage.height() - ySide));
// Midlle right
- if(d->_rectImage.height() - ySide)
+ if (d->_rectImage.height() - ySide)
p.drawImage(QRect(width()-offset, offset, offset, height() - ySide), d->_rectImage,
QRect(d->_rectImage.width()-offset, offset, offset, d->_rectImage.height() - ySide));
// Lower left
p.drawImage(QPoint(0, height() - offset), d->_rectImage, QRect(0, d->_rectImage.height() - offset, offset, offset));
// Lower Middle
- if(d->_rectImage.width() - xSide)
+ if (d->_rectImage.width() - xSide)
p.drawImage(QRect(offset, height() - offset, width() - xSide, offset), d->_rectImage,
QRect(offset, d->_rectImage.height() - offset, d->_rectImage.width() - xSide, offset));
// Lower Right
- if(d->_rectImage.width() - offset)
+ if (d->_rectImage.width() - offset)
p.drawImage(QPoint(width()-offset, height() - offset), d->_rectImage,
QRect(d->_rectImage.width()-offset, d->_rectImage.height() - offset, offset, offset));
}
@@ -519,8 +519,8 @@ void QFxRect::drawRect(QPainter &p)
void QFxRect::paintGLContents(GLPainter &p)
{
Q_D(QFxRect);
- if(d->_radius == 0 && (!d->_pen || !d->_pen->isValid())) {
- if(d->_gradcolor.isValid()) {
+ if (d->_radius == 0 && (!d->_pen || !d->_pen->isValid())) {
+ if (d->_gradcolor.isValid()) {
float widthV = width();
float heightV = height();
@@ -582,7 +582,7 @@ void QFxRect::paintGLContents(GLPainter &p)
float imgWidth = d->_rectTexture.width();
float imgHeight = d->_rectTexture.height();
- if(!imgWidth || !imgHeight)
+ if (!imgWidth || !imgHeight)
return;
float widthV = width();
@@ -607,7 +607,7 @@ void QFxRect::paintGLContents(GLPainter &p)
imgbottom = heightV - offset;
//Bug 231768: Inappropriate interpolation was occuring on 3x3 textures
- if(offset==1)
+ if (offset==1)
texleft=texright=textop=texbottom=0.5;
float vert1[] = { 0, 0,
@@ -686,7 +686,7 @@ void QFxRect::paintGLContents(GLPainter &p)
glMatrixMode(GL_MODELVIEW);
glLoadMatrixf(p.activeTransform.data());
- if(d->_radius == 0 && (!d->_pen || !d->_pen->isValid())) {
+ if (d->_radius == 0 && (!d->_pen || !d->_pen->isValid())) {
GLfloat vertices[] = { 0, heightV,
widthV, heightV,
0, 0,
@@ -696,7 +696,7 @@ void QFxRect::paintGLContents(GLPainter &p)
glVertexPointer(2,GL_FLOAT,0,vertices);
QColor c;
- if(d->_gradcolor.isValid())
+ if (d->_gradcolor.isValid())
c = d->_color;
else
c = d->getColor();
@@ -707,7 +707,7 @@ void QFxRect::paintGLContents(GLPainter &p)
float r2 = r; float g2 = g; float b2 = b; float a2 = a;
- if(d->_gradcolor.isValid()) {
+ if (d->_gradcolor.isValid()) {
r2 = d->_gradcolor.redF();
g2 = d->_gradcolor.greenF();
b2 = d->_gradcolor.blueF();
@@ -736,7 +736,7 @@ void QFxRect::paintGLContents(GLPainter &p)
offset = d->pen()->width();
}
- if(p.activeOpacity == 1.) {
+ if (p.activeOpacity == 1.) {
GLint i = GL_REPLACE;
glTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, &i);
} else {
@@ -747,7 +747,7 @@ void QFxRect::paintGLContents(GLPainter &p)
float imgWidth = d->_rectTexture.width();
float imgHeight = d->_rectTexture.height();
- if(!imgWidth || !imgHeight)
+ if (!imgWidth || !imgHeight)
return;
float widthV = width();
diff --git a/src/declarative/fx/qfxrect_p.h b/src/declarative/fx/qfxrect_p.h
index 3cb46fa..2fd555f 100644
--- a/src/declarative/fx/qfxrect_p.h
+++ b/src/declarative/fx/qfxrect_p.h
@@ -88,7 +88,7 @@ public:
QColor _gradcolor;
QColor _tintColor;
QFxPen *pen() {
- if(!_pen) {
+ if (!_pen) {
Q_Q(QFxRect);
_pen = new QFxPen;
QObject::connect(_pen, SIGNAL(updated()), q, SLOT(doUpdate()));
diff --git a/src/declarative/fx/qfxreflectionfilter.cpp b/src/declarative/fx/qfxreflectionfilter.cpp
index 39342d7..e02bc16 100644
--- a/src/declarative/fx/qfxreflectionfilter.cpp
+++ b/src/declarative/fx/qfxreflectionfilter.cpp
@@ -135,7 +135,7 @@ qreal QFxReflectionFilter::alpha() const
void QFxReflectionFilter::setAlpha(qreal a)
{
- if(d->alpha == a) return;
+ if (d->alpha == a) return;
d->alpha = a;
emit alphaChanged(a);
update();
@@ -202,7 +202,7 @@ int QFxReflectionFilter::height() const
void QFxReflectionFilter::setHeight(int h)
{
- if(d->height == h) return;
+ if (d->height == h) return;
d->height = h;
emit heightChanged(h);
update();
@@ -219,7 +219,7 @@ int QFxReflectionFilter::offset()
void QFxReflectionFilter::setOffset(int o)
{
- if(d->offset == o) return;
+ if (d->offset == o) return;
d->offset = o;
emit offsetChanged(o);
update();
@@ -236,7 +236,7 @@ qreal QFxReflectionFilter::scale() const
void QFxReflectionFilter::setScale(qreal s)
{
- if(d->scale == s) return;
+ if (d->scale == s) return;
d->scale = s;
emit scaleChanged(s);
update();
@@ -259,12 +259,12 @@ void QFxReflectionFilter::filterGL(QSimpleCanvasItem::GLPainter &p)
float height = r.height();
float refHeight = height;
- if(d->height > 0)
+ if (d->height > 0)
refHeight = min(height, d->height);
QSimpleCanvas::Matrix simpMat;
QSimpleCanvasItem *simpItem = 0;
- if(isSimpleItem(&simpItem, &simpMat) &&
+ if (isSimpleItem(&simpItem, &simpMat) &&
simpItem->glSimpleItemData(0, 0, 0, 0)) {
GLfloat vertices[8];
@@ -276,7 +276,7 @@ void QFxReflectionFilter::filterGL(QSimpleCanvasItem::GLPainter &p)
GLfloat opacity[4];
float invRefHeight = 1. / refHeight;
- for(int ii = 0; ii < 4; ++ii) {
+ for (int ii = 0; ii < 4; ++ii) {
float vertex = vertices[ii * 2 + 1];
float o = (1. - (height - vertex) * invRefHeight);
opacity[ii] = o * d->alpha * p.activeOpacity;
@@ -285,7 +285,7 @@ void QFxReflectionFilter::filterGL(QSimpleCanvasItem::GLPainter &p)
QSimpleCanvas::Matrix trans = p.activeTransform;
trans.rotate(180, 1, 0, 0);
trans.translate(0, -r.height() - d->offset);
- if(d->scale != 1)
+ if (d->scale != 1)
trans.scale(1, d->scale, 1);
trans.translate(0, -r.height());
trans *= simpMat;
diff --git a/src/declarative/fx/qfxrepeater.cpp b/src/declarative/fx/qfxrepeater.cpp
index ad4081b..7ee949d 100644
--- a/src/declarative/fx/qfxrepeater.cpp
+++ b/src/declarative/fx/qfxrepeater.cpp
@@ -235,6 +235,15 @@ void QFxRepeater::setComponent(QmlComponent *_c)
/*!
\internal
*/
+void QFxRepeater::componentComplete()
+{
+ QFxItem::componentComplete();
+ regenerate();
+}
+
+/*!
+ \internal
+ */
void QFxRepeater::parentChanged(QSimpleCanvasItem *o, QSimpleCanvasItem *n)
{
QFxItem::parentChanged(o, n);
@@ -250,15 +259,15 @@ void QFxRepeater::regenerate()
qDeleteAll(d->deletables);
d->deletables.clear();
- if(!d->component || !itemParent())
+ if (!d->component || !itemParent() || !isComponentComplete())
return;
QFxItem *lastItem = this;
- if(d->dataSource.type() == QVariant::StringList) {
+ if (d->dataSource.type() == QVariant::StringList) {
QStringList sl = qvariant_cast<QStringList>(d->dataSource);
- for(int ii = 0; ii < sl.size(); ++ii) {
+ for (int ii = 0; ii < sl.size(); ++ii) {
QmlContext *ctxt = new QmlContext(qmlContext(this), this);
d->deletables << ctxt;
@@ -268,12 +277,12 @@ void QFxRepeater::regenerate()
if (QFxItem *item = d->addItem(ctxt, lastItem))
lastItem = item;
}
- } else if(QmlMetaType::isList(d->dataSource)) {
+ } else if (QmlMetaType::isList(d->dataSource)) {
int cnt = QmlMetaType::listCount(d->dataSource);
- if(cnt <= 0)
+ if (cnt <= 0)
return;
- for(int ii = 0; ii < cnt; ++ii) {
+ for (int ii = 0; ii < cnt; ++ii) {
QVariant v = QmlMetaType::listAt(d->dataSource, ii);
QObject *o = QmlMetaType::toQObject(v);
@@ -288,10 +297,10 @@ void QFxRepeater::regenerate()
}
} else if (QListModelInterface *model = qobject_cast<QListModelInterface*>(d->dataSource.value<QObject*>())) {
int cnt = model->count();
- if(cnt <= 0)
+ if (cnt <= 0)
return;
- for(int ii = 0; ii < cnt; ++ii) {
+ for (int ii = 0; ii < cnt; ++ii) {
QmlContext *ctxt = new QmlContext(qmlContext(this), this);
d->deletables << ctxt;
@@ -330,11 +339,11 @@ void QFxRepeater::regenerate()
d->addItem(ctxt, lastItem);
- } else if(d->dataSource.canConvert(QVariant::Int)){
+ } else if (d->dataSource.canConvert(QVariant::Int)){
int count = qvariant_cast<int>(d->dataSource);
- for(int ii = 0; ii < count; ++ii) {
+ for (int ii = 0; ii < count; ++ii) {
QmlContext *ctxt = new QmlContext(qmlContext(this), this);
d->deletables << ctxt;
diff --git a/src/declarative/fx/qfxrepeater.h b/src/declarative/fx/qfxrepeater.h
index f6c4584..8efd281 100644
--- a/src/declarative/fx/qfxrepeater.h
+++ b/src/declarative/fx/qfxrepeater.h
@@ -72,6 +72,7 @@ private:
void regenerate();
protected:
+ virtual void componentComplete();
virtual void parentChanged(QSimpleCanvasItem *, QSimpleCanvasItem *);
QFxRepeater(QFxRepeaterPrivate &dd, QFxItem *parent);
diff --git a/src/declarative/fx/qfxscalegrid.cpp b/src/declarative/fx/qfxscalegrid.cpp
index d84f5e8..325f7d9 100644
--- a/src/declarative/fx/qfxscalegrid.cpp
+++ b/src/declarative/fx/qfxscalegrid.cpp
@@ -153,29 +153,29 @@ QFxGridScaledImage::QFxGridScaledImage(QIODevice *data)
while(!data->atEnd()) {
QString line = QString::fromUtf8(data->readLine().trimmed());
- if(line.isEmpty() || line.startsWith(QLatin1String("#")))
+ if (line.isEmpty() || line.startsWith(QLatin1String("#")))
continue;
QStringList list = line.split(QLatin1Char(':'));
- if(list.count() != 2)
+ if (list.count() != 2)
return;
list[0] = list[0].trimmed();
list[1] = list[1].trimmed();
- if(list[0] == QLatin1String("gridLeft"))
+ if (list[0] == QLatin1String("gridLeft"))
l = list[1].toInt();
- else if(list[0] == QLatin1String("gridRight"))
+ else if (list[0] == QLatin1String("gridRight"))
r = list[1].toInt();
- else if(list[0] == QLatin1String("gridTop"))
+ else if (list[0] == QLatin1String("gridTop"))
t = list[1].toInt();
- else if(list[0] == QLatin1String("gridBottom"))
+ else if (list[0] == QLatin1String("gridBottom"))
b = list[1].toInt();
- else if(list[0] == QLatin1String("imageFile"))
+ else if (list[0] == QLatin1String("imageFile"))
imgFile = list[1];
}
- if(l < 0 || r < 0 || t < 0 || b < 0 || imgFile.isEmpty())
+ if (l < 0 || r < 0 || t < 0 || b < 0 || imgFile.isEmpty())
return;
_l = l; _r = r; _t = t; _b = b;
diff --git a/src/declarative/fx/qfxshadowfilter.cpp b/src/declarative/fx/qfxshadowfilter.cpp
index 3760a4d..38d1c31 100644
--- a/src/declarative/fx/qfxshadowfilter.cpp
+++ b/src/declarative/fx/qfxshadowfilter.cpp
@@ -122,7 +122,7 @@ int QFxShadowFilter::xOffset() const
*/
void QFxShadowFilter::setXOffset(int offset)
{
- if(d->x == offset) return;
+ if (d->x == offset) return;
d->x = offset;
emit offsetChanged(d->x, d->y);
}
@@ -138,7 +138,7 @@ int QFxShadowFilter::yOffset() const
void QFxShadowFilter::setYOffset(int offset)
{
- if(d->y == offset) return;
+ if (d->y == offset) return;
d->y = offset;
emit offsetChanged(d->x, d->y);
}
diff --git a/src/declarative/fx/qfxtext.cpp b/src/declarative/fx/qfxtext.cpp
index e7085d8..5cb31e1 100644
--- a/src/declarative/fx/qfxtext.cpp
+++ b/src/declarative/fx/qfxtext.cpp
@@ -165,7 +165,7 @@ void QFxText::setText(const QString &n)
QFxPerfTimer<QFxPerf::QFxText_setText> st;
#endif
Q_D(QFxText);
- if(d->text == n)
+ if (d->text == n)
return;
d->richText = Qt::mightBeRichText(n); // ### what's the cost?
@@ -205,7 +205,7 @@ QString QFxText::text() const
void QFxText::setColor(const QColor &color)
{
Q_D(QFxText);
- if(d->color == color)
+ if (d->color == color)
return;
d->imgDirty = true;
@@ -270,7 +270,7 @@ QFxText::TextStyle QFxText::style() const
void QFxText::setStyle(QFxText::TextStyle style)
{
Q_D(QFxText);
- if(d->style == style)
+ if (d->style == style)
return;
d->imgDirty = true;
@@ -281,7 +281,7 @@ void QFxText::setStyle(QFxText::TextStyle style)
void QFxText::setStyleColor(const QColor &color)
{
Q_D(QFxText);
- if(d->styleColor == color)
+ if (d->styleColor == color)
return;
d->imgDirty = true;
@@ -424,7 +424,7 @@ void QFxText::geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry)
{
Q_D(QFxText);
- if(newGeometry.width() != oldGeometry.width()) {
+ if (newGeometry.width() != oldGeometry.width()) {
if (d->wrap || d->elideMode != Qt::ElideNone) {
d->imgDirty = true;
d->updateSize();
@@ -446,10 +446,10 @@ void QFxTextPrivate::updateSize()
{
Q_Q(QFxText);
if (q->isComponentComplete()) {
- if(text.isEmpty()) {
+ if (text.isEmpty()) {
return;
}
- QFont f; if(_font) f = _font->font();
+ QFont f; if (_font) f = _font->font();
QFontMetrics fm(f);
int dy = q->height();
@@ -573,7 +573,7 @@ QSize QFxTextPrivate::setupTextLayout(QTextLayout *layout)
Q_Q(QFxText);
layout->setCacheEnabled(true);
- QFont f; if(_font) f = _font->font();
+ QFont f; if (_font) f = _font->font();
QFontMetrics fm = QFontMetrics(f);
int leading = fm.leading();
@@ -613,7 +613,7 @@ QImage QFxTextPrivate::wrappedTextImage(bool drawStyle)
{
//do layout
Q_Q(const QFxText);
- QFont f; if(_font) f = _font->font();
+ QFont f; if (_font) f = _font->font();
QString tmp = text;
if (singleline && elideMode != Qt::ElideNone && q->widthValid()) {
QFontMetrics fm(f);
@@ -626,11 +626,11 @@ QImage QFxTextPrivate::wrappedTextImage(bool drawStyle)
int x = 0;
for (int i = 0; i < textLayout.lineCount(); ++i) {
QTextLine line = textLayout.lineAt(i);
- if(hAlign == QFxText::AlignLeft) {
+ if (hAlign == QFxText::AlignLeft) {
x = 0;
- } else if(hAlign == QFxText::AlignRight) {
+ } else if (hAlign == QFxText::AlignRight) {
x = size.width() - (int)line.naturalTextWidth();
- } else if(hAlign == QFxText::AlignHCenter) {
+ } else if (hAlign == QFxText::AlignHCenter) {
x = (size.width() - (int)line.naturalTextWidth()) / 2;
}
line.setPosition(QPoint(x, (int)line.y()));
@@ -679,7 +679,7 @@ QImage QFxTextPrivate::richTextImage(bool drawStyle)
void QFxTextPrivate::checkImgCache()
{
- if(!imgDirty)
+ if (!imgDirty)
return;
bool empty = text.isEmpty();
@@ -722,7 +722,7 @@ void QFxText::paintContents(QPainter &p)
{
Q_D(QFxText);
d->checkImgCache();
- if(d->imgCache.isNull())
+ if (d->imgCache.isNull())
return;
int w = width();
@@ -763,7 +763,7 @@ void QFxText::paintGLContents(GLPainter &p)
{
Q_D(QFxText);
d->checkImgCache();
- if(d->imgCache.isNull())
+ if (d->imgCache.isNull())
return;
int w = width();
@@ -826,7 +826,7 @@ void QFxText::paintGLContents(GLPainter &p)
{
Q_D(QFxText);
d->checkImgCache();
- if(d->imgCache.isNull())
+ if (d->imgCache.isNull())
return;
int w = width();
@@ -875,7 +875,7 @@ void QFxText::paintGLContents(GLPainter &p)
glMatrixMode(GL_MODELVIEW);
glLoadMatrixf(p.activeTransform.data());
glEnable(GL_TEXTURE_2D);
- if(p.activeOpacity == 1.) {
+ if (p.activeOpacity == 1.) {
GLint i = GL_REPLACE;
glTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, &i);
} else {
diff --git a/src/declarative/fx/qfxtext_p.h b/src/declarative/fx/qfxtext_p.h
index 7be4309..4296891 100644
--- a/src/declarative/fx/qfxtext_p.h
+++ b/src/declarative/fx/qfxtext_p.h
@@ -98,7 +98,7 @@ public:
QString text;
QmlFont *font()
{
- if(!_font) {
+ if (!_font) {
Q_Q(QFxText);
_font = new QmlFont;
QObject::connect(_font, SIGNAL(updated()), q, SLOT(fontChanged()));
diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp
index 7efb826..68aea01 100644
--- a/src/declarative/fx/qfxtextedit.cpp
+++ b/src/declarative/fx/qfxtextedit.cpp
@@ -270,7 +270,7 @@ QColor QFxTextEdit::color() const
void QFxTextEdit::setColor(const QColor &color)
{
Q_D(QFxTextEdit);
- if(d->color == color)
+ if (d->color == color)
return;
clearCache();
@@ -370,7 +370,7 @@ void QFxTextEdit::setWrap(bool w)
void QFxTextEdit::geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry)
{
- if(newGeometry.width() != oldGeometry.width())
+ if (newGeometry.width() != oldGeometry.width())
updateSize();
QFxImageItem::geometryChanged(newGeometry, oldGeometry);
}
diff --git a/src/declarative/fx/qfxtransform.cpp b/src/declarative/fx/qfxtransform.cpp
index a001214..9f18413 100644
--- a/src/declarative/fx/qfxtransform.cpp
+++ b/src/declarative/fx/qfxtransform.cpp
@@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE
#define M_PI 3.14159265358979323846
#endif
-QML_DEFINE_TYPE(QFxTransform,Transform);
+QML_DEFINE_NOCREATE_TYPE(QFxTransform);
/*!
\qmlclass Transform
@@ -62,6 +62,10 @@ QFxTransform::QFxTransform(QObject *parent) :
{
}
+QFxTransform::~QFxTransform()
+{
+}
+
bool QFxTransform::isIdentity() const
{
return true;
@@ -75,143 +79,192 @@ QSimpleCanvas::Matrix QFxTransform::transform() const
void QFxTransform::update()
{
QFxItem *item = qobject_cast<QFxItem *>(parent());
- if(item)
+ if (item)
item->updateTransform();
}
-QML_DEFINE_TYPE(QFxAxis,Axis);
+/*!
+ \qmlclass Axis
+ \brief An axis that can be used for rotation or translation.
+*/
+
+QML_DEFINE_TYPE(QFxAxis, Axis);
QFxAxis::QFxAxis(QObject *parent)
-: QFxTransform(parent), _xStart(0), _yStart(0), _xEnd(0), _yEnd(0), _zEnd(0), _rotation(0),
- _translation(0), _distanceToPlane(1024.), _dirty(true)
+: QObject(parent), _startX(0), _startY(0), _endX(0), _endY(0), _endZ(0)
{
}
-qreal QFxAxis::xStart() const
+QFxAxis::~QFxAxis()
{
- return _xStart;
}
-void QFxAxis::setXStart(qreal x)
+qreal QFxAxis::startX() const
{
- _xStart = x;
- update();
+ return _startX;
}
-qreal QFxAxis::yStart() const
+void QFxAxis::setStartX(qreal x)
{
- return _yStart;
+ _startX = x;
+ emit updated();
}
-void QFxAxis::setYStart(qreal y)
+qreal QFxAxis::startY() const
{
- _yStart = y;
- update();
+ return _startY;
}
-qreal QFxAxis::xEnd() const
+void QFxAxis::setStartY(qreal y)
{
- return _xEnd;
+ _startY = y;
+ emit updated();
}
-void QFxAxis::setXEnd(qreal x)
+qreal QFxAxis::endX() const
{
- _xEnd = x;
- update();
+ return _endX;
}
-qreal QFxAxis::yEnd() const
+void QFxAxis::setEndX(qreal x)
{
- return _yEnd;
+ _endX = x;
+ emit updated();
}
-void QFxAxis::setYEnd(qreal y)
+qreal QFxAxis::endY() const
{
- _yEnd = y;
- update();
+ return _endY;
}
-qreal QFxAxis::zEnd() const
+void QFxAxis::setEndY(qreal y)
{
- return _zEnd;
+ _endY = y;
+ emit updated();
}
-void QFxAxis::setZEnd(qreal z)
+qreal QFxAxis::endZ() const
{
-#if !defined(QFX_RENDER_OPENGL)
- if(z != 0. && translation() != 0.) {
- qmlInfo(this) << "QTransform cannot translate along Z-axis";
- return;
- }
-#endif
+ return _endZ;
+}
- _zEnd = z;
- update();
+void QFxAxis::setEndZ(qreal z)
+{
+ _endZ = z;
+ emit updated();
}
-qreal QFxAxis::rotation() const
+/*!
+ \qmlclass AxisRotation
+ \brief The AxisRotation element provides a way to rotate an Item around an axis.
+
+ Here is an example of various rotations applied to an \l Image.
+ \code
+ <HorizontalLayout margin="10" spacing="10">
+ <Image src="qt.png"/>
+ <Image src="qt.png">
+ <transform>
+ <AxisRotation axis.startX="30" axis.endX="30" axis.endY="60" angle="18"/>
+ </transform>
+ </Image>
+ <Image src="qt.png">
+ <transform>
+ <AxisRotation axis.startX="30" axis.endX="30" axis.endY="60" angle="36"/>
+ </transform>
+ </Image>
+ <Image src="qt.png">
+ <transform>
+ <AxisRotation axis.startX="30" axis.endX="30" axis.endY="60" angle="54"/>
+ </transform>
+ </Image>
+ <Image src="qt.png">
+ <transform>
+ <AxisRotation axis.startX="30" axis.endX="30" axis.endY="60" angle="72"/>
+ </transform>
+ </Image>
+ </HorizontalLayout>
+ \endcode
+
+ \image axisrotation.png
+*/
+
+QML_DEFINE_TYPE(QFxRotation,AxisRotation);
+
+QFxRotation::QFxRotation(QObject *parent)
+: QFxTransform(parent), _angle(0), _distanceToPlane(1024.), _dirty(true)
{
- return _rotation;
+ connect(&_axis, SIGNAL(updated()), this, SLOT(update()));
}
-void QFxAxis::setRotation(qreal r)
+QFxRotation::~QFxRotation()
{
- _rotation = r;
- update();
}
-qreal QFxAxis::translation() const
+/*!
+ \qmlproperty real AxisRotation::axis.startX
+ \qmlproperty real AxisRotation::axis.startY
+ \qmlproperty real AxisRotation::axis.endX
+ \qmlproperty real AxisRotation::axis.endY
+ \qmlproperty real AxisRotation::axis.endZ
+
+ A rotation axis is specified by 2 points in 3D space: a start point and
+ an end point. The z-position of the start point is assumed to be 0, and cannot
+ be changed.
+*/
+QFxAxis *QFxRotation::axis()
{
- return _translation;
+ return &_axis;
}
-void QFxAxis::setTranslation(qreal t)
+/*!
+ \qmlproperty real AxisRotation::angle
+
+ The angle, in degrees, to rotate around the specified axis.
+*/
+qreal QFxRotation::angle() const
{
-#if !defined(QFX_RENDER_OPENGL)
- if(zEnd() != 0. && t != 0.) {
- qmlInfo(this) << "QTransform cannot translate along Z-axis";
- return;
- }
-#endif
+ return _angle;
+}
- _translation = t;
+void QFxRotation::setAngle(qreal angle)
+{
+ _angle = angle;
update();
}
-bool QFxAxis::isIdentity() const
+bool QFxRotation::isIdentity() const
{
- return (_rotation == 0. && _translation == 0.) ||
- (zEnd() == 0. && yEnd() == yStart() && xEnd() == xStart());
+ return (_angle == 0.) || (_axis.endZ() == 0. && _axis.endY() == _axis.startY() && _axis.endX() == _axis.startX());
}
#if defined(QFX_RENDER_QPAINTER)
const qreal inv_dist_to_plane = 1. / 1024.;
-QTransform QFxAxis::transform() const
+QTransform QFxRotation::transform() const
{
- if(_dirty) {
+ if (_dirty) {
_transform = QTransform();
- if(!isIdentity()) {
- if(rotation() != 0.) {
+ if (!isIdentity()) {
+ if (angle() != 0.) {
QTransform rotTrans;
- rotTrans.translate(-xStart(), -yStart());
+ rotTrans.translate(-_axis.startX(), -_axis.startY());
QTransform rotTrans2;
- rotTrans2.translate(xStart(), yStart());
+ rotTrans2.translate(_axis.startX(), _axis.startY());
- qreal rad = rotation() * 2. * M_PI / 360.;
+ qreal rad = angle() * 2. * M_PI / 360.;
qreal c = ::cos(rad);
qreal s = ::sin(rad);
- qreal x = xEnd() - xStart();
- qreal y = yEnd() - yStart();
- qreal z = zEnd();
+ qreal x = _axis.endX() - _axis.startX();
+ qreal y = _axis.endY() - _axis.startY();
+ qreal z = _axis.endZ();
qreal idtp = inv_dist_to_plane;
- if(distanceToPlane() != 1024.)
+ if (distanceToPlane() != 1024.)
idtp = 1. / distanceToPlane();
qreal len = x * x + y * y + z * z;
- if(len != 1.) {
+ if (len != 1.) {
len = ::sqrt(len);
x /= len;
y /= len;
@@ -226,13 +279,6 @@ QTransform QFxAxis::transform() const
_transform *= rot;
_transform *= rotTrans2;
}
-
- if(translation() != 0.) {
- QTransform trans;
- trans.translate((xEnd() - xStart()) * translation(),
- (yEnd() - yStart()) * translation());
- _transform *= trans;
- }
}
_dirty = false;
@@ -241,27 +287,22 @@ QTransform QFxAxis::transform() const
return _transform;
}
#elif defined(QFX_RENDER_OPENGL)
-QMatrix4x4 QFxAxis::transform() const
+QMatrix4x4 QFxRotation::transform() const
{
- if(_dirty) {
+ if (_dirty) {
_dirty = false;
_transform = QMatrix4x4();
- if(!isIdentity()) {
- if(rotation() != 0.) {
- qreal x = xEnd() - xStart();
- qreal y = yEnd() - yStart();
- qreal z = zEnd();
+ if (!isIdentity()) {
+ if (angle() != 0.) {
+ qreal x = _axis.endX() - _axis.startX();
+ qreal y = _axis.endY() - _axis.startY();
+ qreal z = _axis.endZ();
- _transform.translate(xStart(), yStart(), 0);
- _transform.rotate(rotation(), x, y, z);
- _transform.translate(-xStart(), -yStart(), 0);
+ _transform.translate(_axis.startX(), _axis.startY(), 0);
+ _transform.rotate(angle(), x, y, z);
+ _transform.translate(-_axis.startX(), -_axis.startY(), 0);
}
-
- if(translation() != 0.)
- _transform.translate((xEnd() - xStart()) * translation(),
- (yEnd() - yStart()) * translation(),
- (zEnd()) * translation());
}
}
@@ -269,198 +310,161 @@ QMatrix4x4 QFxAxis::transform() const
}
#endif
-qreal QFxAxis::distanceToPlane() const
+/*!
+ \qmlproperty real AxisRotation::distanceToPlane
+*/
+qreal QFxRotation::distanceToPlane() const
{
return _distanceToPlane;
}
-void QFxAxis::setDistanceToPlane(qreal d)
+void QFxRotation::setDistanceToPlane(qreal d)
{
_distanceToPlane = d;
update();
}
-void QFxAxis::update()
+void QFxRotation::update()
{
_dirty = true;
QFxItem *item = qobject_cast<QFxItem *>(parent());
- if(item)
+ if (item)
item->updateTransform();
}
-QML_DEFINE_TYPE(QFxFlipable,Flipable);
-
-class QFxFlipablePrivate : public QFxItemPrivate
-{
-public:
- QFxFlipablePrivate() : current(QFxFlipable::Front), front(0), back(0) {}
-
- QFxFlipable::Side current;
- QFxItem *front;
- QFxItem *back;
-};
-
/*!
- \qmlclass Flipable QFxFlipable
- \brief The Flipable element provides a surface that can be flipped.
- \inherits Item
-
- Flipable allows you to specify a front and a back and then flip between those sides.
+ \qmlclass AxisTranslation
+ \brief The AxisTranslation element provides a way to move an Item along an axis.
+ The following example translates the image to 10, 3.
\code
- <Flipable id="flipable" width="40" height="40">
+ <Image src="logo.png">
<transform>
- <Axis id="axis" xStart="20" xEnd="20" yStart="20" yEnd="0" />
+ <AxisTranslation axis.startX="0" axis.startY="0" axis.endX="1" axis.endY=".3" distance="10"/>
</transform>
- <front>
- <Image file="front.png"/>
- </front>
- <back>
- <Image file="back.png"/>
- </back>
- <states>
- <State name="back">
- <SetProperty target="{axis}" property="rotation" value="180" />
- </State>
- </states>
- <transitions>
- <Transition>
- <NumericAnimation easing="easeInOutQuad" properties="rotation"/>
- </Transition>
- </transitions>
- </Flipable>
+ </Image>
\endcode
-
- \image flipable.gif
*/
-/*!
- \internal
- \class QFxFlipable
- \brief The QFxFlipable class provides a flipable surface.
-
- \ingroup group_widgets
+QML_DEFINE_TYPE(QFxTranslation,AxisTranslation);
- QFxFlipable allows you to specify a front and a back, as well as an
- axis for the flip.
-*/
+QFxTranslation::QFxTranslation(QObject *parent)
+: QFxTransform(parent), _distance(0), _dirty(true)
+{
+ connect(&_axis, SIGNAL(updated()), this, SLOT(update()));
+}
-QFxFlipable::QFxFlipable(QFxItem *parent)
-: QFxItem(*(new QFxFlipablePrivate), parent)
+QFxTranslation::~QFxTranslation()
{
}
-QFxFlipable::~QFxFlipable()
+/*!
+ \qmlproperty real AxisTranslation::axis.startX
+ \qmlproperty real AxisTranslation::axis.startY
+ \qmlproperty real AxisTranslation::axis.endX
+ \qmlproperty real AxisTranslation::axis.endY
+ \qmlproperty real AxisTranslation::axis.endZ
+
+ A translation axis is specified by 2 points in 3D space: a start point and
+ an end point. The z-position of the start point is assumed to be 0, and cannot
+ be changed. Changing the z-position of the end point is only valid when running
+ under OpenGL.
+*/
+QFxAxis *QFxTranslation::axis()
{
+ return &_axis;
}
/*!
- \qmlproperty Item Flipable::front
- \qmlproperty Item Flipable::back
+ \qmlproperty real AxisTranslation::distance
- The front and back sides of the flipable.
-*/
+ The distance to translate along the specified axis. distance is a multiplier;
+ in the example below, a distance of 1 would translate to 100, 50, while a distance
+ of 0.5 would translate to 50, 25.
-QFxItem *QFxFlipable::front()
+ \code
+ <AxisTranslation axis.startX="0" axis.startY="0" axis.endX="100" axis.endY="50"/>
+ \endcode
+*/
+qreal QFxTranslation::distance() const
{
- Q_D(const QFxFlipable);
- return d->front;
+ return _distance;
}
-void QFxFlipable::setFront(QFxItem *front)
+void QFxTranslation::setDistance(qreal distance)
{
- Q_D(QFxFlipable);
- if(d->front) {
- qmlInfo(this) << "front is a write-once property";
- return;
- }
- d->front = front;
- children()->append(d->front);
- if(Back == d->current)
- d->front->setOpacity(0.);
+ _distance = distance;
+ update();
}
-QFxItem *QFxFlipable::back()
+bool QFxTranslation::isIdentity() const
{
- Q_D(const QFxFlipable);
- return d->back;
+ return (_distance == 0.) || (_axis.endZ() == 0. && _axis.endY() == _axis.startY() && _axis.endX() == _axis.startX());
}
-void QFxFlipable::setBack(QFxItem *back)
+#if defined(QFX_RENDER_QPAINTER)
+QTransform QFxTranslation::transform() const
{
- Q_D(QFxFlipable);
- if(d->back) {
- qmlInfo(this) << "back is a write-once property";
- return;
- }
- d->back = back;
- children()->append(d->back);
- if(Front == d->current)
- d->back->setOpacity(0.);
-}
+ if (_dirty) {
+ _transform = QTransform();
-/*!
- \qmlproperty enumeration Flipable::side
+ if (!isIdentity()) {
+ if (distance() != 0.) {
+ QTransform trans;
+ trans.translate((_axis.endX() - _axis.startX()) * distance(),
+ (_axis.endY() - _axis.startY()) * distance());
+ _transform *= trans;
+ }
+ }
- The side of the Flippable currently visible. Possible values are \c
- Front and \c Back.
-*/
-QFxFlipable::Side QFxFlipable::side() const
-{
- Q_D(const QFxFlipable);
- return d->current;
-}
+ _dirty = false;
+ }
-void QFxFlipable::transformChanged(const QSimpleCanvas::Matrix &trans)
+ return _transform;
+}
+#elif defined(QFX_RENDER_OPENGL)
+QMatrix4x4 QFxRotation::transform() const
{
- Q_D(QFxFlipable);
- QPointF p1(0, 0);
- QPointF p2(1, 0);
- QPointF p3(1, 1);
-
- p1 = trans.map(p1);
- p2 = trans.map(p2);
- p3 = trans.map(p3);
+ if (_dirty) {
+ _dirty = false;
+ _transform = QMatrix4x4();
- qreal cross = (p1.x() - p2.x()) * (p3.y() - p2.y()) -
- (p1.y() - p2.y()) * (p3.x() - p2.x());
+ if (!isIdentity()) {
+ if (distance() != 0.)
+ _transform.translate((_axis.endX() - _axis.startX()) * distance(),
+ (_axis.endY() - _axis.startY()) * distance(),
+ (_axis.endZ()) * distance());
- Side newSide;
- if(cross > 0) {
- newSide = Back;
- } else {
- newSide = Front;
+ }
}
- if(newSide != d->current) {
- d->current = newSide;
- if (d->current==Back) {
- QSimpleCanvas::Matrix mat;
-#ifdef QFX_RENDER_OPENGL
- mat.translate(d->back->width()/2,d->back->height()/2, 0);
- if(d->back->width() && p1.x() >= p2.x())
- mat.rotate(180, 0, 1, 0);
- if(d->back->height() && p2.y() >= p3.y())
- mat.rotate(180, 1, 0, 0);
- mat.translate(-d->back->width()/2,-d->back->height()/2, 0);
-#else
- mat.translate(d->back->width()/2,d->back->height()/2);
- if(d->back->width() && p1.x() >= p2.x())
- mat.rotate(180, Qt::YAxis);
- if(d->back->height() && p2.y() >= p3.y())
- mat.rotate(180, Qt::XAxis);
- mat.translate(-d->back->width()/2,-d->back->height()/2);
+ return _transform;
+}
#endif
- d->back->setTransform(mat);
- }
- if(d->front)
- d->front->setOpacity((d->current==Front)?1.:0.);
- if(d->back)
- d->back->setOpacity((d->current==Back)?1.:0.);
- emit sideChanged();
+
+void QFxTranslation::update()
+{
+ _dirty = true;
+
+#if !defined(QFX_RENDER_OPENGL)
+ if (_axis.endZ() != 0. && distance() != 0.) {
+ qmlInfo(this) << "QTransform cannot translate along Z-axis.";
}
+#endif
+
+ QFxItem *item = qobject_cast<QFxItem *>(parent());
+ if (item)
+ item->updateTransform();
}
+/*!
+ \qmlclass Perspective
+ \brief The Perspective element specifies a perspective transformation.
+
+ A Perspective transform only affects an item when running under OpenGL; when running under software
+ rasterization it has no effect.
+*/
+
QML_DEFINE_TYPE(QFxPerspective,Perspective);
QFxPerspective::QFxPerspective(QObject *parent)
@@ -468,6 +472,10 @@ QFxPerspective::QFxPerspective(QObject *parent)
{
}
+QFxPerspective::~QFxPerspective()
+{
+}
+
#if defined(QFX_RENDER_OPENGL)
bool QFxPerspective::isIdentity() const
{
@@ -486,6 +494,33 @@ QMatrix4x4 QFxPerspective::transform() const
}
#endif
+/*!
+ \qmlproperty real Perspective::angle
+*/
+
+/*!
+ \qmlproperty real Perspective::aspect
+*/
+
+/*!
+ \qmlproperty real Perspective::x
+*/
+
+/*!
+ \qmlproperty real Perspective::y
+*/
+
+/*!
+ \qmlproperty real Perspective::scale
+*/
+
+/*!
+ \qmlclass Squish
+ \brief The Squish element allows you to distort an items appearance by 'squishing' it.
+
+ A Squish transform only affects an item when running under OpenGL; when running under software
+ rasterization it has no effect.
+*/
QML_DEFINE_TYPE(QFxSquish,Squish);
QFxSquish::QFxSquish(QObject *parent)
@@ -493,6 +528,13 @@ QFxSquish::QFxSquish(QObject *parent)
{
}
+QFxSquish::~QFxSquish()
+{
+}
+
+/*!
+ \qmlproperty real Squish::x
+*/
qreal QFxSquish::x() const
{
return p.x();
@@ -504,6 +546,9 @@ void QFxSquish::setX(qreal v)
update();
}
+/*!
+ \qmlproperty real Squish::y
+*/
qreal QFxSquish::y() const
{
return p.y();
@@ -515,6 +560,9 @@ void QFxSquish::setY(qreal v)
update();
}
+/*!
+ \qmlproperty real Squish::width
+*/
qreal QFxSquish::width() const
{
return s.width();
@@ -526,6 +574,9 @@ void QFxSquish::setWidth(qreal v)
update();
}
+/*!
+ \qmlproperty real Squish::height
+*/
qreal QFxSquish::height() const
{
return s.height();
@@ -537,6 +588,10 @@ void QFxSquish::setHeight(qreal v)
update();
}
+/*!
+ \qmlproperty real Squish::topLeftX
+ \qmlproperty real Squish::topLeftY
+*/
qreal QFxSquish::topLeft_x() const
{
return p1.x();
@@ -559,6 +614,10 @@ void QFxSquish::settopLeft_y(qreal v)
update();
}
+/*!
+ \qmlproperty real Squish::topRightX
+ \qmlproperty real Squish::topRightY
+*/
qreal QFxSquish::topRight_x() const
{
return p2.x();
@@ -581,6 +640,10 @@ void QFxSquish::settopRight_y(qreal v)
update();
}
+/*!
+ \qmlproperty real Squish::bottomLeftX
+ \qmlproperty real Squish::bottomLeftY
+*/
qreal QFxSquish::bottomLeft_x() const
{
return p3.x();
@@ -603,6 +666,10 @@ void QFxSquish::setbottomLeft_y(qreal v)
update();
}
+/*!
+ \qmlproperty real Squish::bottomRightX
+ \qmlproperty real Squish::bottomRightY
+*/
qreal QFxSquish::bottomRight_x() const
{
return p4.x();
@@ -628,7 +695,7 @@ void QFxSquish::setbottomRight_y(qreal v)
void QFxSquish::update()
{
QFxItem *item = qobject_cast<QFxItem *>(parent());
- if(item)
+ if (item)
item->updateTransform();
}
@@ -647,10 +714,11 @@ QMatrix4x4 QFxSquish::transform() const
QTransform t;
QMatrix4x4 rv;
- if(QTransform::quadToQuad(poly, poly2, t))
+ if (QTransform::quadToQuad(poly, poly2, t))
rv = QMatrix4x4(t);
return rv;
}
-QT_END_NAMESPACE
#endif
+
+QT_END_NAMESPACE
diff --git a/src/declarative/fx/qfxtransform.h b/src/declarative/fx/qfxtransform.h
index 129a4b4..8a4eab1 100644
--- a/src/declarative/fx/qfxtransform.h
+++ b/src/declarative/fx/qfxtransform.h
@@ -49,17 +49,18 @@
#endif
#include <qfxitem.h>
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+
class Q_DECLARATIVE_EXPORT QFxTransform : public QObject
{
Q_OBJECT
public:
QFxTransform(QObject *parent=0);
+ ~QFxTransform();
void update();
@@ -68,37 +69,61 @@ public:
};
QML_DECLARE_TYPE(QFxTransform);
-class Q_DECLARATIVE_EXPORT QFxAxis : public QFxTransform
+class Q_DECLARATIVE_EXPORT QFxAxis : public QObject
{
Q_OBJECT
- Q_PROPERTY(qreal xStart READ xStart WRITE setXStart)
- Q_PROPERTY(qreal yStart READ yStart WRITE setYStart)
- Q_PROPERTY(qreal xEnd READ xEnd WRITE setXEnd)
- Q_PROPERTY(qreal yEnd READ yEnd WRITE setYEnd)
- Q_PROPERTY(qreal zEnd READ zEnd WRITE setZEnd)
- Q_PROPERTY(qreal rotation READ rotation WRITE setRotation)
- Q_PROPERTY(qreal translation READ translation WRITE setTranslation)
- Q_PROPERTY(qreal distanceToPlane READ distanceToPlane WRITE setDistanceToPlane)
+ Q_PROPERTY(qreal startX READ startX WRITE setStartX)
+ Q_PROPERTY(qreal startY READ startY WRITE setStartY)
+ Q_PROPERTY(qreal endX READ endX WRITE setEndX)
+ Q_PROPERTY(qreal endY READ endY WRITE setEndY)
+ Q_PROPERTY(qreal endZ READ endZ WRITE setEndZ)
public:
QFxAxis(QObject *parent=0);
+ ~QFxAxis();
+
+ qreal startX() const;
+ void setStartX(qreal);
+
+ qreal startY() const;
+ void setStartY(qreal);
+
+ qreal endX() const;
+ void setEndX(qreal);
+
+ qreal endY() const;
+ void setEndY(qreal);
+
+ qreal endZ() const;
+ void setEndZ(qreal);
+
+Q_SIGNALS:
+ void updated();
+
+private:
+ qreal _startX;
+ qreal _startY;
+ qreal _endX;
+ qreal _endY;
+ qreal _endZ;
+};
+QML_DECLARE_TYPE(QFxAxis);
+
+class Q_DECLARATIVE_EXPORT QFxRotation : public QFxTransform
+{
+ Q_OBJECT
- qreal xStart() const;
- void setXStart(qreal);
- qreal yStart() const;
- void setYStart(qreal);
+ Q_PROPERTY(QFxAxis *axis READ axis)
+ Q_PROPERTY(qreal angle READ angle WRITE setAngle)
+ Q_PROPERTY(qreal distanceToPlane READ distanceToPlane WRITE setDistanceToPlane)
+public:
+ QFxRotation(QObject *parent=0);
+ ~QFxRotation();
- qreal xEnd() const;
- void setXEnd(qreal);
- qreal yEnd() const;
- void setYEnd(qreal);
- qreal zEnd() const;
- void setZEnd(qreal);
+ QFxAxis *axis();
- qreal rotation() const;
- void setRotation(qreal);
- qreal translation() const;
- void setTranslation(qreal);
+ qreal angle() const;
+ void setAngle(qreal);
qreal distanceToPlane() const;
void setDistanceToPlane(qreal);
@@ -106,22 +131,46 @@ public:
virtual bool isIdentity() const;
virtual QSimpleCanvas::Matrix transform() const;
-private:
+private Q_SLOTS:
void update();
-
- qreal _xStart;
- qreal _yStart;
- qreal _xEnd;
- qreal _yEnd;
- qreal _zEnd;
- qreal _rotation;
- qreal _translation;
+private:
+ QFxAxis _axis;
+ qreal _angle;
qreal _distanceToPlane;
mutable bool _dirty;
mutable QSimpleCanvas::Matrix _transform;
};
-QML_DECLARE_TYPE(QFxAxis);
+QML_DECLARE_TYPE(QFxRotation);
+
+class Q_DECLARATIVE_EXPORT QFxTranslation : public QFxTransform
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QFxAxis *axis READ axis)
+ Q_PROPERTY(qreal distance READ distance WRITE setDistance)
+public:
+ QFxTranslation(QObject *parent=0);
+ ~QFxTranslation();
+
+ QFxAxis *axis();
+
+ qreal distance() const;
+ void setDistance(qreal);
+
+ virtual bool isIdentity() const;
+ virtual QSimpleCanvas::Matrix transform() const;
+
+private Q_SLOTS:
+ void update();
+private:
+ QFxAxis _axis;
+ qreal _distance;
+
+ mutable bool _dirty;
+ mutable QSimpleCanvas::Matrix _transform;
+};
+QML_DECLARE_TYPE(QFxTranslation);
class Q_DECLARATIVE_EXPORT QFxPerspective : public QFxTransform
{
@@ -134,6 +183,7 @@ class Q_DECLARATIVE_EXPORT QFxPerspective : public QFxTransform
Q_PROPERTY(qreal scale READ scale WRITE setScale)
public:
QFxPerspective(QObject *parent=0);
+ ~QFxPerspective();
qreal angle() const { return _angle; }
void setAngle(qreal v) { _angle = v; update(); }
@@ -171,16 +221,17 @@ class Q_DECLARATIVE_EXPORT QFxSquish : public QFxTransform
Q_PROPERTY(qreal y READ y WRITE setY)
Q_PROPERTY(qreal width READ width WRITE setWidth)
Q_PROPERTY(qreal height READ height WRITE setHeight)
- Q_PROPERTY(qreal topLeft_x READ topLeft_x WRITE settopLeft_x)
- Q_PROPERTY(qreal topLeft_y READ topLeft_y WRITE settopLeft_y)
- Q_PROPERTY(qreal topRight_x READ topRight_x WRITE settopRight_x)
- Q_PROPERTY(qreal topRight_y READ topRight_y WRITE settopRight_y)
- Q_PROPERTY(qreal bottomLeft_x READ bottomLeft_x WRITE setbottomLeft_x)
- Q_PROPERTY(qreal bottomLeft_y READ bottomLeft_y WRITE setbottomLeft_y)
- Q_PROPERTY(qreal bottomRight_y READ bottomRight_y WRITE setbottomRight_y)
- Q_PROPERTY(qreal bottomRight_x READ bottomRight_x WRITE setbottomRight_x)
+ Q_PROPERTY(qreal topLeftX READ topLeft_x WRITE settopLeft_x)
+ Q_PROPERTY(qreal topLeftY READ topLeft_y WRITE settopLeft_y)
+ Q_PROPERTY(qreal topRightX READ topRight_x WRITE settopRight_x)
+ Q_PROPERTY(qreal topRightY READ topRight_y WRITE settopRight_y)
+ Q_PROPERTY(qreal bottomLeftX READ bottomLeft_x WRITE setbottomLeft_x)
+ Q_PROPERTY(qreal bottomLeftY READ bottomLeft_y WRITE setbottomLeft_y)
+ Q_PROPERTY(qreal bottomRightX READ bottomRight_x WRITE setbottomRight_x)
+ Q_PROPERTY(qreal bottomRightY READ bottomRight_y WRITE setbottomRight_y)
public:
QFxSquish(QObject *parent=0);
+ ~QFxSquish();
qreal x() const;
void setX(qreal);
@@ -230,45 +281,10 @@ private:
QSizeF s;
QPointF p1, p2, p3, p4;
};
-
QML_DECLARE_TYPE(QFxSquish);
-class QFxFlipablePrivate;
-class Q_DECLARATIVE_EXPORT QFxFlipable : public QFxItem
-{
- Q_OBJECT
-
- Q_ENUMS(Side);
- Q_PROPERTY(QFxItem *front READ front WRITE setFront)
- Q_PROPERTY(QFxItem *back READ back WRITE setBack)
- Q_PROPERTY(Side side READ side NOTIFY sideChanged)
-public:
- QFxFlipable(QFxItem *parent=0);
- ~QFxFlipable();
-
- QFxItem *front();
- void setFront(QFxItem *);
-
- QFxItem *back();
- void setBack(QFxItem *);
-
- enum Side { Front, Back };
- Side side() const;
-
-protected:
- virtual void transformChanged(const QSimpleCanvas::Matrix &);
-
-Q_SIGNALS:
- void sideChanged();
-
-private:
- Q_DISABLE_COPY(QFxFlipable)
- Q_DECLARE_PRIVATE(QFxFlipable)
-};
-QML_DECLARE_TYPE(QFxFlipable);
-
-
QT_END_NAMESPACE
QT_END_HEADER
-#endif // _TRANSFORM_H_
+
+#endif // QFXTRANSFORM_H
diff --git a/src/declarative/fx/qfxvisualitemmodel.cpp b/src/declarative/fx/qfxvisualitemmodel.cpp
index e851bad..7d0d7a5 100644
--- a/src/declarative/fx/qfxvisualitemmodel.cpp
+++ b/src/declarative/fx/qfxvisualitemmodel.cpp
@@ -85,13 +85,13 @@ public:
QmlListAccessor *m_modelList;
int modelCount() const {
- if(m_visualItemModel)
+ if (m_visualItemModel)
return m_visualItemModel->count();
- if(m_listModelInterface)
+ if (m_listModelInterface)
return m_listModelInterface->count();
- if(m_abstractItemModel)
+ if (m_abstractItemModel)
return m_abstractItemModel->rowCount();
- if(m_modelList)
+ if (m_modelList)
return m_modelList->count();
return 0;
}
@@ -162,10 +162,10 @@ int QFxVisualItemModelDataMetaObject::createProperty(const char *name, const cha
return QmlOpenMetaObject::createProperty(name, type);
} else {
const QLatin1String sname(name);
- for(QHash<int, QString>::ConstIterator iter = data->m_model->m_roleNames.begin();
+ for (QHash<int, QString>::ConstIterator iter = data->m_model->m_roleNames.begin();
iter != data->m_model->m_roleNames.end(); ++iter) {
- if(*iter == sname)
+ if (*iter == sname)
return QmlOpenMetaObject::createProperty(name, type);
}
}
@@ -184,10 +184,10 @@ QFxVisualItemModelDataMetaObject::propertyCreated(int, QMetaPropertyBuilder &pro
&& data->m_model->m_modelList) {
return data->m_model->m_modelList->at(data->m_index);
} else if (data->m_model->m_listModelInterface) {
- for(QHash<int, QString>::ConstIterator iter = data->m_model->m_roleNames.begin();
+ for (QHash<int, QString>::ConstIterator iter = data->m_model->m_roleNames.begin();
iter != data->m_model->m_roleNames.end(); ++iter) {
- if(*iter == name) {
+ if (*iter == name) {
roles.append(iter.key());
QHash<int,QVariant> values = data->m_model->m_listModelInterface->data(data->m_index, QList<int>() << iter.key());
if (values.isEmpty())
@@ -197,10 +197,10 @@ QFxVisualItemModelDataMetaObject::propertyCreated(int, QMetaPropertyBuilder &pro
}
}
} else if (data->m_model->m_abstractItemModel) {
- for(QHash<int, QString>::ConstIterator iter = data->m_model->m_roleNames.begin();
+ for (QHash<int, QString>::ConstIterator iter = data->m_model->m_roleNames.begin();
iter != data->m_model->m_roleNames.end(); ++iter) {
- if(*iter == name) {
+ if (*iter == name) {
roles.append(iter.key());
QModelIndex index = data->m_model->m_abstractItemModel->index(data->m_index, 0);
return data->m_model->m_abstractItemModel->data(index, iter.key());
@@ -297,7 +297,7 @@ QFxVisualItemModel::QFxVisualItemModel(QmlContext *ctxt)
QFxVisualItemModel::~QFxVisualItemModel()
{
Q_D(QFxVisualItemModel);
- if(d->m_modelList)
+ if (d->m_modelList)
delete d->m_modelList;
}
@@ -311,7 +311,7 @@ void QFxVisualItemModel::setModel(const QVariant &model)
{
Q_D(QFxVisualItemModel);
d->m_modelVariant = model;
- if(d->m_listModelInterface) {
+ if (d->m_listModelInterface) {
// Assume caller has released all items.
QObject::disconnect(d->m_listModelInterface, SIGNAL(itemsChanged(int,int,QList<int>)),
this, SLOT(_q_itemsChanged(int,int,QList<int>)));
@@ -329,7 +329,7 @@ void QFxVisualItemModel::setModel(const QVariant &model)
this, SLOT(_q_rowsRemoved(const QModelIndex &,int,int)));
QObject::disconnect(d->m_abstractItemModel, SIGNAL(dataChanged(const QModelIndex&,const QModelIndex&)),
this, SLOT(_q_dataChanged(const QModelIndex&,const QModelIndex&)));
- } else if(d->m_visualItemModel) {
+ } else if (d->m_visualItemModel) {
QObject::disconnect(d->m_visualItemModel, SIGNAL(itemsInserted(int,int)),
this, SIGNAL(itemsInserted(int,int)));
QObject::disconnect(d->m_visualItemModel, SIGNAL(itemsRemoved(int,int)),
@@ -343,9 +343,9 @@ void QFxVisualItemModel::setModel(const QVariant &model)
if (object && (d->m_listModelInterface = qobject_cast<QListModelInterface *>(object))) {
d->m_roles.clear();
d->m_roleNames.clear();
- if(d->m_listModelInterface) {
+ if (d->m_listModelInterface) {
d->m_roles = d->m_listModelInterface->roles();
- for(int ii = 0; ii < d->m_roles.count(); ++ii)
+ for (int ii = 0; ii < d->m_roles.count(); ++ii)
d->m_roleNames.insert(d->m_roles.at(ii),
d->m_listModelInterface->toString(d->m_roles.at(ii)));
}
@@ -359,7 +359,7 @@ void QFxVisualItemModel::setModel(const QVariant &model)
QObject::connect(d->m_listModelInterface, SIGNAL(itemsMoved(int,int,int)),
this, SLOT(_q_itemsMoved(int,int,int)));
- if(d->m_delegate && d->m_listModelInterface->count())
+ if (d->m_delegate && d->m_listModelInterface->count())
emit itemsInserted(0, d->m_listModelInterface->count());
return;
} else if (object && (d->m_abstractItemModel = qobject_cast<QAbstractItemModel *>(object))) {
@@ -390,7 +390,7 @@ void QFxVisualItemModel::setModel(const QVariant &model)
if (!d->m_modelList)
d->m_modelList = new QmlListAccessor;
d->m_modelList->setList(model);
- if(d->m_delegate && d->modelCount())
+ if (d->m_delegate && d->modelCount())
emit itemsInserted(0, d->modelCount());
}
@@ -405,7 +405,7 @@ void QFxVisualItemModel::setDelegate(QmlComponent *delegate)
Q_D(QFxVisualItemModel);
d->m_delegate = delegate;
- if(d->modelCount())
+ if (d->modelCount())
emit itemsInserted(0, d->modelCount());
}
@@ -430,7 +430,7 @@ int QFxVisualItemModel::count() const
QFxItem *QFxVisualItemModel::item(int index, bool complete)
{
Q_D(QFxVisualItemModel);
- if(d->m_visualItemModel)
+ if (d->m_visualItemModel)
return d->m_visualItemModel->item(index, d->m_part.toLatin1(), complete);
return item(index, QByteArray(), complete);
}
@@ -471,7 +471,7 @@ void QFxVisualItemModel::release(QFxItem *item)
QObject *QFxVisualItemModel::parts()
{
Q_D(QFxVisualItemModel);
- if(!d->m_parts)
+ if (!d->m_parts)
d->m_parts = new QFxVisualItemModelParts(this);
return d->m_parts;
}
@@ -479,18 +479,18 @@ QObject *QFxVisualItemModel::parts()
QFxItem *QFxVisualItemModel::item(int index, const QByteArray &viewId, bool complete)
{
Q_D(QFxVisualItemModel);
- if(d->m_visualItemModel)
+ if (d->m_visualItemModel)
return d->m_visualItemModel->item(index, viewId, complete);
- if(d->modelCount() <= 0 || !d->m_delegate)
+ if (d->modelCount() <= 0 || !d->m_delegate)
return 0;
QObject *nobj = 0;
- if(d->m_cache.contains(index)) {
+ if (d->m_cache.contains(index)) {
nobj = d->m_cache[index];
} else {
QmlContext *ccontext = d->m_context;
- if(!ccontext) ccontext = qmlContext(this);
+ if (!ccontext) ccontext = qmlContext(this);
QmlContext *ctxt = new QmlContext(ccontext);
QFxVisualItemModelData *data = new QFxVisualItemModelData(index, d);
ctxt->setContextProperty(QLatin1String("model"), data);
@@ -507,7 +507,7 @@ QFxItem *QFxVisualItemModel::item(int index, const QByteArray &viewId, bool comp
QFxItem *item = qobject_cast<QFxItem *>(nobj);
if (!item) {
QmlPackage *package = qobject_cast<QmlPackage *>(nobj);
- if(package) {
+ if (package) {
QObject *o = package->part(QLatin1String(viewId));
item = qobject_cast<QFxItem *>(o);
d->m_packaged[o] = package;
@@ -520,7 +520,7 @@ QFxItem *QFxVisualItemModel::item(int index, const QByteArray &viewId, bool comp
void QFxVisualItemModel::completeItem()
{
Q_D(QFxVisualItemModel);
- if(d->m_visualItemModel) {
+ if (d->m_visualItemModel) {
d->m_visualItemModel->completeItem();
return;
}
@@ -534,11 +534,11 @@ QVariant QFxVisualItemModel::evaluate(int index, const QString &expression, QObj
if (d->m_visualItemModel)
return d->m_visualItemModel->evaluate(index, expression, objectContext);
- if((!d->m_listModelInterface && !d->m_abstractItemModel) || !d->m_delegate)
+ if ((!d->m_listModelInterface && !d->m_abstractItemModel) || !d->m_delegate)
return QVariant();
QVariant value;
- if(d->m_cache.contains(index)) {
+ if (d->m_cache.contains(index)) {
QObject *nobj = d->m_cache[index];
QFxItem *item = qobject_cast<QFxItem *>(nobj);
if (item) {
@@ -548,7 +548,7 @@ QVariant QFxVisualItemModel::evaluate(int index, const QString &expression, QObj
}
} else {
QmlContext *ccontext = d->m_context;
- if(!ccontext) ccontext = qmlContext(this);
+ if (!ccontext) ccontext = qmlContext(this);
QmlContext *ctxt = new QmlContext(ccontext);
QFxVisualItemModelData *data = new QFxVisualItemModelData(index, d);
ctxt->addDefaultObject(data);
@@ -567,17 +567,17 @@ void QFxVisualItemModel::_q_itemsChanged(int index, int count,
{
Q_D(QFxVisualItemModel);
// XXX - highly inefficient
- for(int ii = index; ii < index + count; ++ii) {
+ for (int ii = index; ii < index + count; ++ii) {
- if(d->m_cache.contains(ii)) {
+ if (d->m_cache.contains(ii)) {
QObject *item = d->m_cache[ii];
QFxVisualItemModelData *data = d->data(item);
- for(int prop = 0; prop < data->count(); ++prop) {
+ for (int prop = 0; prop < data->count(); ++prop) {
int role = data->role(prop);
- if(roles.contains(role)) {
+ if (roles.contains(role)) {
if (d->m_listModelInterface) {
data->setValue(prop, *d->m_listModelInterface->data(ii, QList<int>() << role).begin());
} else if (d->m_abstractItemModel) {
@@ -596,10 +596,10 @@ void QFxVisualItemModel::_q_itemsInserted(int index, int count)
Q_D(QFxVisualItemModel);
// XXX - highly inefficient
QHash<int, QObject *> items;
- for(QHash<int, QObject *>::Iterator iter = d->m_cache.begin();
+ for (QHash<int, QObject *>::Iterator iter = d->m_cache.begin();
iter != d->m_cache.end(); ) {
- if(iter.key() >= index) {
+ if (iter.key() >= index) {
QObject *item = *iter;
int index = iter.key() + count;
iter = d->m_cache.erase(iter);
@@ -622,15 +622,15 @@ void QFxVisualItemModel::_q_itemsRemoved(int index, int count)
Q_D(QFxVisualItemModel);
// XXX - highly inefficient
QHash<int, QObject *> items;
- for(QHash<int, QObject *>::Iterator iter = d->m_cache.begin();
+ for (QHash<int, QObject *>::Iterator iter = d->m_cache.begin();
iter != d->m_cache.end(); ) {
- if(iter.key() >= index && iter.key() < index + count) {
+ if (iter.key() >= index && iter.key() < index + count) {
QObject *item = *iter;
iter = d->m_cache.erase(iter);
items.insertMulti(-1, item); //XXX perhaps better to maintain separately
QFxVisualItemModelData *data = d->data(item);
data->setIndex(-1);
- } else if(iter.key() >= index + count) {
+ } else if (iter.key() >= index + count) {
QObject *item = *iter;
int index = iter.key() - count;
iter = d->m_cache.erase(iter);
@@ -651,10 +651,10 @@ void QFxVisualItemModel::_q_itemsMoved(int from, int to, int count)
Q_D(QFxVisualItemModel);
// XXX - highly inefficient
QHash<int, QObject *> items;
- for(QHash<int, QObject *>::Iterator iter = d->m_cache.begin();
+ for (QHash<int, QObject *>::Iterator iter = d->m_cache.begin();
iter != d->m_cache.end(); ) {
- if(iter.key() >= from && iter.key() < from + count) {
+ if (iter.key() >= from && iter.key() < from + count) {
QObject *item = *iter;
int index = iter.key() - from + to;
iter = d->m_cache.erase(iter);
diff --git a/src/declarative/fx/qfxwebview.cpp b/src/declarative/fx/qfxwebview.cpp
index 8af4158..b2ad06c 100644
--- a/src/declarative/fx/qfxwebview.cpp
+++ b/src/declarative/fx/qfxwebview.cpp
@@ -361,7 +361,7 @@ QString QFxWebView::url() const
void QFxWebView::setUrl(const QString &n)
{
Q_D(QFxWebView);
- if(n == page()->mainFrame()->url().toString())
+ if (n == page()->mainFrame()->url().toString())
return;
page()->setViewportSize(QSize(
@@ -399,7 +399,7 @@ int QFxWebView::idealWidth() const
void QFxWebView::setIdealWidth(int iw)
{
Q_D(QFxWebView);
- if(d->idealwidth == iw) return;
+ if (d->idealwidth == iw) return;
d->idealwidth = iw;
expandToWebPage();
emit idealWidthChanged();
@@ -422,7 +422,7 @@ int QFxWebView::idealHeight() const
void QFxWebView::setIdealHeight(int ih)
{
Q_D(QFxWebView);
- if(d->idealheight == ih) return;
+ if (d->idealheight == ih) return;
d->idealheight = ih;
expandToWebPage();
emit idealHeightChanged();
@@ -449,7 +449,7 @@ bool QFxWebView::interactive() const
void QFxWebView::setInteractive(bool i)
{
Q_D(QFxWebView);
- if(d->interactive == i) return;
+ if (d->interactive == i) return;
d->interactive = i;
emit interactiveChanged();
}
@@ -471,7 +471,7 @@ bool QFxWebView::smooth() const
void QFxWebView::setSmooth(bool i)
{
Q_D(QFxWebView);
- if(d->smooth == i) return;
+ if (d->smooth == i) return;
d->smooth = i;
update();
}
@@ -506,7 +506,7 @@ void QFxWebView::expandToWebPage()
void QFxWebView::geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry)
{
- if(newGeometry.size() != oldGeometry.size())
+ if (newGeometry.size() != oldGeometry.size())
expandToWebPage();
QFxItem::geometryChanged(newGeometry, oldGeometry);
}
diff --git a/src/declarative/fx/qfxwidgetcontainer.cpp b/src/declarative/fx/qfxwidgetcontainer.cpp
index f86c8dc..fccdad1 100644
--- a/src/declarative/fx/qfxwidgetcontainer.cpp
+++ b/src/declarative/fx/qfxwidgetcontainer.cpp
@@ -78,16 +78,16 @@ QGraphicsWidget *QFxWidgetContainer::graphicsWidget() const
*/
void QFxWidgetContainer::setGraphicsWidget(QGraphicsWidget *widget)
{
- if(widget == _graphicsWidget)
+ if (widget == _graphicsWidget)
return;
_graphicsWidget = widget;
QSimpleCanvas *c = canvas();
- if(!c)
+ if (!c)
return;
- if(c->canvasMode() != QSimpleCanvas::GraphicsView) {
+ if (c->canvasMode() != QSimpleCanvas::GraphicsView) {
qWarning("QFxWidgetContainer: Cannot add a widget to a non-graphicsview canvas. You might need to set QFX_USE_GRAPHICSVIEW=1");
return;
}
@@ -98,7 +98,7 @@ void QFxWidgetContainer::setGraphicsWidget(QGraphicsWidget *widget)
void QFxWidgetContainer::canvasChanged()
{
- if(_graphicsWidget) {
+ if (_graphicsWidget) {
QGraphicsWidget *w = _graphicsWidget;
_graphicsWidget = 0;
setGraphicsWidget(w);
diff --git a/src/declarative/opengl/glbasicshaders.cpp b/src/declarative/opengl/glbasicshaders.cpp
index e95e53f..f546c0b 100644
--- a/src/declarative/opengl/glbasicshaders.cpp
+++ b/src/declarative/opengl/glbasicshaders.cpp
@@ -127,7 +127,7 @@ BlurTextureShader::BlurTextureShader()
{\
mediump vec4 accum = vec4(0, 0, 0, 0); \
mediump vec2 offset; \
- if(horizontal) \
+ if (horizontal) \
offset = vec2(blurStep, 0); \
else \
offset = vec2(0, blurStep); \
@@ -150,22 +150,22 @@ BlurTextureShader::BlurTextureShader()
{\
mediump vec4 accum = vec4(0, 0, 0, 0); \
mediump vec2 offset; \
- if(horizontal) \
+ if (horizontal) \
offset = vec2(blurStep, 0); \
else \
offset = vec2(0, blurStep); \
mediump float sum = 0.0; \
- for(int ii = 0; ii < blurSteps; ++ii) { \
+ for (int ii = 0; ii < blurSteps; ++ii) { \
mediump float frac = float(blurSteps - ii) / float(blurSteps); \
mediump vec2 coord = myTexCoord + -float(ii) * offset; \
- if(coord.x >= 0.0 && coord.y >= 0.0 && coord.y <= 1.0 && coord.x <=1.0) \
+ if (coord.x >= 0.0 && coord.y >= 0.0 && coord.y <= 1.0 && coord.x <=1.0) \
accum += texture2D(sampler2d, coord) * frac; \
sum += frac; \
} \
- for(int ii = 1; ii < blurSteps; ++ii) { \
+ for (int ii = 1; ii < blurSteps; ++ii) { \
mediump float frac = float(blurSteps - ii) / float(blurSteps); \
mediump vec2 coord = myTexCoord + float(ii) * offset; \
- if(coord.x <= 1.0 && coord.y <= 1.0 && coord.x >= 0.0 && coord.y >= 0.0) \
+ if (coord.x <= 1.0 && coord.y <= 1.0 && coord.x >= 0.0 && coord.y >= 0.0) \
accum += texture2D(sampler2d, coord) * frac; \
sum += frac; \
} \
@@ -207,7 +207,7 @@ void BlurTextureShader::setSteps(int s)
void BlurTextureShader::setMode(Mode m)
{
- if(m == Horizontal)
+ if (m == Horizontal)
setUniformValue(mode, 1);
else
setUniformValue(mode, 0);
@@ -545,49 +545,49 @@ GLBasicShaders::~GLBasicShaders()
BlurTextureShader *GLBasicShaders::blurTexture()
{
- if(!d->blurTexture) d->blurTexture = new BlurTextureShader();
+ if (!d->blurTexture) d->blurTexture = new BlurTextureShader();
return d->blurTexture;
}
SingleTextureShader *GLBasicShaders::singleTexture()
{
- if(!d->singleTexture) d->singleTexture = new SingleTextureShader();
+ if (!d->singleTexture) d->singleTexture = new SingleTextureShader();
return d->singleTexture;
}
SingleTextureOpacityShader *GLBasicShaders::singleTextureOpacity()
{
- if(!d->singleTextureOpacity) d->singleTextureOpacity = new SingleTextureOpacityShader();
+ if (!d->singleTextureOpacity) d->singleTextureOpacity = new SingleTextureOpacityShader();
return d->singleTextureOpacity;
}
DualTextureAddShader *GLBasicShaders::dualTextureAdd()
{
- if(!d->dualTextureAdd) d->dualTextureAdd = new DualTextureAddShader();
+ if (!d->dualTextureAdd) d->dualTextureAdd = new DualTextureAddShader();
return d->dualTextureAdd;
}
SingleTextureVertexOpacityShader *GLBasicShaders::singleTextureVertexOpacity()
{
- if(!d->singleTextureVertexOpacity) d->singleTextureVertexOpacity = new SingleTextureVertexOpacityShader();
+ if (!d->singleTextureVertexOpacity) d->singleTextureVertexOpacity = new SingleTextureVertexOpacityShader();
return d->singleTextureVertexOpacity;
}
SingleTextureShadowShader *GLBasicShaders::singleTextureShadow()
{
- if(!d->singleTextureShadow) d->singleTextureShadow = new SingleTextureShadowShader();
+ if (!d->singleTextureShadow) d->singleTextureShadow = new SingleTextureShadowShader();
return d->singleTextureShadow;
}
ConstantColorShader *GLBasicShaders::constantColor()
{
- if(!d->constantColor) d->constantColor = new ConstantColorShader();
+ if (!d->constantColor) d->constantColor = new ConstantColorShader();
return d->constantColor;
}
ColorShader *GLBasicShaders::color()
{
- if(!d->color) d->color = new ColorShader();
+ if (!d->color) d->color = new ColorShader();
return d->color;
}
diff --git a/src/declarative/opengl/glsave.h b/src/declarative/opengl/glsave.h
index 3a67fb0..cca3d3c 100644
--- a/src/declarative/opengl/glsave.h
+++ b/src/declarative/opengl/glsave.h
@@ -82,7 +82,7 @@ public:
~GLSaveScissor()
{
- if(enabled)
+ if (enabled)
glEnable(GL_SCISSOR_TEST);
else
glDisable(GL_SCISSOR_TEST);
diff --git a/src/declarative/opengl/gltexture.cpp b/src/declarative/opengl/gltexture.cpp
index 73deece..6d737ad 100644
--- a/src/declarative/opengl/gltexture.cpp
+++ b/src/declarative/opengl/gltexture.cpp
@@ -96,7 +96,7 @@ public:
void GLTexturePrivate::genTexture()
{
- if(texture)
+ if (texture)
return;
glGenTextures(1, &texture);
@@ -116,7 +116,7 @@ GLTexture::GLTexture(const QString &file)
: d(new GLTexturePrivate(this))
{
QImage img(file);
- if(!img.isNull())
+ if (!img.isNull())
setImage(img);
}
@@ -128,7 +128,7 @@ GLTexture::GLTexture(const QImage &img)
GLTexture::~GLTexture()
{
- if(d->texture)
+ if (d->texture)
glDeleteTextures(1, &d->texture);
delete d;
d = 0;
@@ -141,7 +141,7 @@ bool GLTexture::isNull() const
void GLTexture::clear()
{
- if(d->texture) {
+ if (d->texture) {
glDeleteTextures(1, &d->texture);
d->texture = 0;
d->width = 0;
@@ -168,7 +168,7 @@ static inline int npot(int size)
*/
void GLTexture::setImage(const QImage &img)
{
- if(img.isNull())
+ if (img.isNull())
return;
d->genTexture();
@@ -187,9 +187,9 @@ void GLTexture::setImage(const QImage &img)
#if 0
glGenerateMipmap(GL_TEXTURE_2D);
int e = glGetError();
- if(d->magFilter == Linear)
+ if (d->magFilter == Linear)
setMagFilter(MipmapLinear);
- if(d->minFilter == Linear)
+ if (d->minFilter == Linear)
setMinFilter((GLTexture::FilterMode)GL_LINEAR_MIPMAP_LINEAR);
#endif
}
@@ -228,7 +228,7 @@ int GLTexture::height() const
*/
void GLTexture::setSize(const QSize &size)
{
- if(size.width() <= 0 || size.height() <= 0) {
+ if (size.width() <= 0 || size.height() <= 0) {
clear();
return;
}
@@ -253,13 +253,13 @@ GLTexture::WrapMode GLTexture::verticalWrap() const
void GLTexture::setHorizontalWrap(WrapMode mode)
{
d->horizWrap = mode;
- if(d->texture) {
+ if (d->texture) {
GLint last;
glGetIntegerv(GL_TEXTURE_BINDING_2D, &last);
- if(GLuint(last) != d->texture)
+ if (GLuint(last) != d->texture)
glBindTexture(GL_TEXTURE_2D, d->texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, mode);
- if(GLuint(last) != d->texture)
+ if (GLuint(last) != d->texture)
glBindTexture(GL_TEXTURE_2D, last);
}
}
@@ -270,13 +270,13 @@ void GLTexture::setHorizontalWrap(WrapMode mode)
void GLTexture::setVerticalWrap(WrapMode mode)
{
d->vertWrap = mode;
- if(d->texture) {
+ if (d->texture) {
GLint last;
glGetIntegerv(GL_TEXTURE_BINDING_2D, &last);
- if(GLuint(last) != d->texture)
+ if (GLuint(last) != d->texture)
glBindTexture(GL_TEXTURE_2D, d->texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, mode);
- if(GLuint(last) != d->texture)
+ if (GLuint(last) != d->texture)
glBindTexture(GL_TEXTURE_2D, last);
}
}
@@ -293,10 +293,10 @@ GLTexture::FilterMode GLTexture::magFilter() const
void GLTexture::setMinFilter(FilterMode f)
{
- if(d->minFilter == f)
+ if (d->minFilter == f)
return;
d->minFilter = f;
- if(d->texture) {
+ if (d->texture) {
glBindTexture(GL_TEXTURE_2D, d->texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, d->minFilter);
}
@@ -304,10 +304,10 @@ void GLTexture::setMinFilter(FilterMode f)
void GLTexture::setMagFilter(FilterMode f)
{
- if(d->magFilter == f)
+ if (d->magFilter == f)
return;
d->magFilter = f;
- if(d->texture) {
+ if (d->texture) {
glBindTexture(GL_TEXTURE_2D, d->texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, d->magFilter);
}
diff --git a/src/declarative/qml/parser/javascript.g b/src/declarative/qml/parser/javascript.g
new file mode 100644
index 0000000..961041e
--- /dev/null
+++ b/src/declarative/qml/parser/javascript.g
@@ -0,0 +1,2666 @@
+----------------------------------------------------------------------------
+--
+-- Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+-- Contact: Qt Software Information (qt-info@nokia.com)
+--
+-- This file is part of the QtScript module of the Qt Toolkit.
+--
+-- $QT_BEGIN_LICENSE:LGPL$
+-- No Commercial Usage
+-- This file contains pre-release code and may not be distributed.
+-- You may use this file in accordance with the terms and conditions
+-- contained in the either Technology Preview License Agreement or the
+-- Beta Release License Agreement.
+--
+-- GNU Lesser General Public License Usage
+-- Alternatively, this file may be used under the terms of the GNU Lesser
+-- General Public License version 2.1 as published by the Free Software
+-- Foundation and appearing in the file LICENSE.LGPL included in the
+-- packaging of this file. Please review the following information to
+-- ensure the GNU Lesser General Public License version 2.1 requirements
+-- will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+--
+-- In addition, as a special exception, Nokia gives you certain
+-- additional rights. These rights are described in the Nokia Qt LGPL
+-- Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+-- package.
+--
+-- GNU General Public License Usage
+-- Alternatively, this file may be used under the terms of the GNU
+-- General Public License version 3.0 as published by the Free Software
+-- Foundation and appearing in the file LICENSE.GPL included in the
+-- packaging of this file. Please review the following information to
+-- ensure the GNU General Public License version 3.0 requirements will be
+-- met: http://www.gnu.org/copyleft/gpl.html.
+--
+-- If you are unsure which license is appropriate for your use, please
+-- contact the sales department at qt-sales@nokia.com.
+-- $QT_END_LICENSE$
+--
+-- This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+-- WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+--
+----------------------------------------------------------------------------
+
+%parser JavaScriptGrammar
+%decl javascriptparser_p.h
+%impl javascriptparser.cpp
+%expect 2
+%expect-rr 1
+
+%token T_AND "&" T_AND_AND "&&" T_AND_EQ "&="
+%token T_BREAK "break" T_CASE "case" T_CATCH "catch"
+%token T_COLON ":" T_COMMA ";" T_CONTINUE "continue"
+%token T_DEFAULT "default" T_DELETE "delete" T_DIVIDE_ "/"
+%token T_DIVIDE_EQ "/=" T_DO "do" T_DOT "."
+%token T_ELSE "else" T_EQ "=" T_EQ_EQ "=="
+%token T_EQ_EQ_EQ "===" T_FINALLY "finally" T_FOR "for"
+%token T_FUNCTION "function" T_GE ">=" T_GT ">"
+%token T_GT_GT ">>" T_GT_GT_EQ ">>=" T_GT_GT_GT ">>>"
+%token T_GT_GT_GT_EQ ">>>=" T_IDENTIFIER "identifier" T_IF "if"
+%token T_IN "in" T_INSTANCEOF "instanceof" T_LBRACE "{"
+%token T_LBRACKET "[" T_LE "<=" T_LPAREN "("
+%token T_LT "<" T_LT_LT "<<" T_LT_LT_EQ "<<="
+%token T_MINUS "-" T_MINUS_EQ "-=" T_MINUS_MINUS "--"
+%token T_NEW "new" T_NOT "!" T_NOT_EQ "!="
+%token T_NOT_EQ_EQ "!==" T_NUMERIC_LITERAL "numeric literal" T_OR "|"
+%token T_OR_EQ "|=" T_OR_OR "||" T_PLUS "+"
+%token T_PLUS_EQ "+=" T_PLUS_PLUS "++" T_QUESTION "?"
+%token T_RBRACE "}" T_RBRACKET "]" T_REMAINDER "%"
+%token T_REMAINDER_EQ "%=" T_RETURN "return" T_RPAREN ")"
+%token T_SEMICOLON ";" T_AUTOMATIC_SEMICOLON T_STAR "*"
+%token T_STAR_EQ "*=" T_STRING_LITERAL "string literal"
+%token T_SWITCH "switch" T_THIS "this" T_THROW "throw"
+%token T_TILDE "~" T_TRY "try" T_TYPEOF "typeof"
+%token T_VAR "var" T_VOID "void" T_WHILE "while"
+%token T_WITH "with" T_XOR "^" T_XOR_EQ "^="
+%token T_NULL "null" T_TRUE "true" T_FALSE "false"
+%token T_CONST "const"
+%token T_DEBUGGER "debugger"
+%token T_RESERVED_WORD "reserved word"
+
+--- context keywords.
+%token T_PUBLIC "public"
+%token T_IMPORT "import"
+
+%nonassoc SHIFT_THERE
+%nonassoc T_IDENTIFIER T_COLON
+%nonassoc REDUCE_HERE
+
+%start Program
+
+/.
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtScript module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QtDebug>
+
+#include <string.h>
+
+#include "javascriptengine_p.h"
+#include "javascriptlexer_p.h"
+#include "javascriptast_p.h"
+#include "javascriptnodepool_p.h"
+
+./
+
+/:
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtScript module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+//
+// This file is automatically generated from javascript.g.
+// Changes will be lost.
+//
+
+#ifndef JAVASCRIPTPARSER_P_H
+#define JAVASCRIPTPARSER_P_H
+
+#include "javascriptgrammar_p.h"
+#include "javascriptast_p.h"
+#include <QtCore/QList>
+
+QT_BEGIN_NAMESPACE
+
+class QString;
+class JavaScriptEnginePrivate;
+class JavaScriptNameIdImpl;
+
+class JavaScriptParser: protected $table
+{
+public:
+ union Value {
+ int ival;
+ double dval;
+ JavaScriptNameIdImpl *sval;
+ JavaScript::AST::ArgumentList *ArgumentList;
+ JavaScript::AST::CaseBlock *CaseBlock;
+ JavaScript::AST::CaseClause *CaseClause;
+ JavaScript::AST::CaseClauses *CaseClauses;
+ JavaScript::AST::Catch *Catch;
+ JavaScript::AST::DefaultClause *DefaultClause;
+ JavaScript::AST::ElementList *ElementList;
+ JavaScript::AST::Elision *Elision;
+ JavaScript::AST::ExpressionNode *Expression;
+ JavaScript::AST::Finally *Finally;
+ JavaScript::AST::FormalParameterList *FormalParameterList;
+ JavaScript::AST::FunctionBody *FunctionBody;
+ JavaScript::AST::FunctionDeclaration *FunctionDeclaration;
+ JavaScript::AST::Node *Node;
+ JavaScript::AST::PropertyName *PropertyName;
+ JavaScript::AST::PropertyNameAndValueList *PropertyNameAndValueList;
+ JavaScript::AST::SourceElement *SourceElement;
+ JavaScript::AST::SourceElements *SourceElements;
+ JavaScript::AST::Statement *Statement;
+ JavaScript::AST::StatementList *StatementList;
+ JavaScript::AST::Block *Block;
+ JavaScript::AST::VariableDeclaration *VariableDeclaration;
+ JavaScript::AST::VariableDeclarationList *VariableDeclarationList;
+
+ JavaScript::AST::UiProgram *UiProgram;
+ JavaScript::AST::UiImportList *UiImportList;
+ JavaScript::AST::UiImport *UiImport;
+ JavaScript::AST::UiPublicMember *UiPublicMember;
+ JavaScript::AST::UiObjectDefinition *UiObjectDefinition;
+ JavaScript::AST::UiObjectInitializer *UiObjectInitializer;
+ JavaScript::AST::UiObjectBinding *UiObjectBinding;
+ JavaScript::AST::UiScriptBinding *UiScriptBinding;
+ JavaScript::AST::UiArrayBinding *UiArrayBinding;
+ JavaScript::AST::UiObjectMember *UiObjectMember;
+ JavaScript::AST::UiObjectMemberList *UiObjectMemberList;
+ JavaScript::AST::UiQualifiedId *UiQualifiedId;
+ };
+
+ struct DiagnosticMessage {
+ enum Kind { Warning, Error };
+
+ DiagnosticMessage()
+ : kind(Error), line(0), column(0) {}
+
+ DiagnosticMessage(Kind kind, int line, int column, const QString &message)
+ : kind(kind), line(line), column(column), message(message) {}
+
+ bool isWarning() const
+ { return kind == Warning; }
+
+ bool isError() const
+ { return kind == Error; }
+
+ Kind kind;
+ int line;
+ int column;
+ QString message;
+ };
+
+public:
+ JavaScriptParser();
+ ~JavaScriptParser();
+
+ bool parse(JavaScriptEnginePrivate *driver);
+
+ JavaScript::AST::UiProgram *ast()
+ { return sym(1).UiProgram; }
+
+ QList<DiagnosticMessage> diagnosticMessages() const
+ { return diagnostic_messages; }
+
+ inline DiagnosticMessage diagnosticMessage() const
+ {
+ foreach (const DiagnosticMessage &d, diagnostic_messages) {
+ if (! d.kind == DiagnosticMessage::Warning)
+ return d;
+ }
+
+ return DiagnosticMessage();
+ }
+
+ inline QString errorMessage() const
+ { return diagnosticMessage().message; }
+
+ inline int errorLineNumber() const
+ { return diagnosticMessage().line; }
+
+ inline int errorColumnNumber() const
+ { return diagnosticMessage().column; }
+
+protected:
+ void reallocateStack();
+
+ inline Value &sym(int index)
+ { return sym_stack [tos + index - 1]; }
+
+ inline JavaScript::AST::SourceLocation &loc(int index)
+ { return location_stack [tos + index - 1]; }
+
+protected:
+ int tos;
+ int stack_size;
+ Value *sym_stack;
+ int *state_stack;
+ JavaScript::AST::SourceLocation *location_stack;
+
+ // error recovery
+ enum { TOKEN_BUFFER_SIZE = 3 };
+
+ struct SavedToken {
+ int token;
+ double dval;
+ JavaScript::AST::SourceLocation loc;
+ };
+
+ double yylval;
+ JavaScript::AST::SourceLocation yylloc;
+ JavaScript::AST::SourceLocation yyprevlloc;
+
+ SavedToken token_buffer[TOKEN_BUFFER_SIZE];
+ SavedToken *first_token;
+ SavedToken *last_token;
+
+ QList<DiagnosticMessage> diagnostic_messages;
+};
+
+:/
+
+
+/.
+
+#include "javascriptparser_p.h"
+
+//
+// This file is automatically generated from javascript.g.
+// Changes will be lost.
+//
+
+using namespace JavaScript;
+
+QT_BEGIN_NAMESPACE
+
+void JavaScriptParser::reallocateStack()
+{
+ if (! stack_size)
+ stack_size = 128;
+ else
+ stack_size <<= 1;
+
+ sym_stack = reinterpret_cast<Value*> (qRealloc(sym_stack, stack_size * sizeof(Value)));
+ state_stack = reinterpret_cast<int*> (qRealloc(state_stack, stack_size * sizeof(int)));
+ location_stack = reinterpret_cast<AST::SourceLocation*> (qRealloc(location_stack, stack_size * sizeof(AST::SourceLocation)));
+}
+
+inline static bool automatic(JavaScriptEnginePrivate *driver, int token)
+{
+ return token == $table::T_RBRACE
+ || token == 0
+ || driver->lexer()->prevTerminator();
+}
+
+
+JavaScriptParser::JavaScriptParser():
+ tos(0),
+ stack_size(0),
+ sym_stack(0),
+ state_stack(0),
+ location_stack(0),
+ first_token(0),
+ last_token(0)
+{
+}
+
+JavaScriptParser::~JavaScriptParser()
+{
+ if (stack_size) {
+ qFree(sym_stack);
+ qFree(state_stack);
+ qFree(location_stack);
+ }
+}
+
+static inline AST::SourceLocation location(Lexer *lexer)
+{
+ AST::SourceLocation loc;
+ loc.offset = lexer->tokenOffset();
+ loc.length = lexer->tokenLength();
+ loc.startLine = lexer->startLineNo();
+ loc.startColumn = lexer->startColumnNo();
+ return loc;
+}
+
+bool JavaScriptParser::parse(JavaScriptEnginePrivate *driver)
+{
+ Lexer *lexer = driver->lexer();
+ bool hadErrors = false;
+ int yytoken = -1;
+ int action = 0;
+
+ first_token = last_token = 0;
+
+ tos = -1;
+
+ do {
+ if (++tos == stack_size)
+ reallocateStack();
+
+ state_stack[tos] = action;
+
+ _Lcheck_token:
+ if (yytoken == -1 && -TERMINAL_COUNT != action_index[action]) {
+ yyprevlloc = yylloc;
+
+ if (first_token == last_token) {
+ yytoken = lexer->lex();
+ yylval = lexer->dval();
+ yylloc = location(lexer);
+ } else {
+ yytoken = first_token->token;
+ yylval = first_token->dval;
+ yylloc = first_token->loc;
+ ++first_token;
+ }
+ }
+
+ action = t_action(action, yytoken);
+ if (action > 0) {
+ if (action != ACCEPT_STATE) {
+ yytoken = -1;
+ sym(1).dval = yylval;
+ loc(1) = yylloc;
+ } else {
+ --tos;
+ return ! hadErrors;
+ }
+ } else if (action < 0) {
+ const int r = -action - 1;
+ tos -= rhs[r];
+
+ switch (r) {
+./
+
+--------------------------------------------------------------------------------------------------------
+-- Declarative UI
+--------------------------------------------------------------------------------------------------------
+
+Program: UiImportListOpt UiObjectMemberList ;
+/.
+case $rule_number: {
+ sym(1).Node = makeAstNode<AST::UiProgram> (driver->nodePool(), sym(1).UiImportList,
+ sym(2).UiObjectMemberList->finish());
+} break;
+./
+
+UiImportListOpt: Empty ;
+UiImportListOpt: UiImportList ;
+/.
+case $rule_number: {
+ sym(1).Node = sym(1).UiImportList->finish();
+} break;
+./
+
+UiImportList: UiImport ;
+/.
+case $rule_number: {
+ sym(1).Node = makeAstNode<AST::UiImportList> (driver->nodePool(), sym(1).UiImport);
+} break;
+./
+
+UiImportList: UiImportList UiImport ;
+/.
+case $rule_number: {
+ sym(1).Node = makeAstNode<AST::UiImportList> (driver->nodePool(),
+ sym(1).UiImportList, sym(2).UiImport);
+} break;
+./
+
+UiImport: T_IMPORT T_STRING_LITERAL T_AUTOMATIC_SEMICOLON;
+UiImport: T_IMPORT T_STRING_LITERAL T_SEMICOLON;
+/.
+case $rule_number: {
+ AST::UiImport *node = makeAstNode<AST::UiImport>(driver->nodePool(), sym(2).sval);
+ node->importToken = loc(1);
+ node->fileNameToken = loc(2);
+ node->semicolonToken = loc(3);
+ sym(1).Node = node;
+} break;
+./
+
+Empty: ;
+/.
+case $rule_number: {
+ sym(1).Node = 0;
+} break;
+./
+
+UiObjectMemberList: UiObjectMember ;
+/.
+case $rule_number: {
+ sym(1).Node = makeAstNode<AST::UiObjectMemberList> (driver->nodePool(), sym(1).UiObjectMember);
+} break;
+./
+
+UiObjectMemberList: UiObjectMemberList UiObjectMember ;
+/.
+case $rule_number: {
+ AST::UiObjectMemberList *node = makeAstNode<AST:: UiObjectMemberList> (driver->nodePool(),
+ sym(1).UiObjectMemberList, sym(2).UiObjectMember);
+ sym(1).Node = node;
+} break;
+./
+
+UiArrayMemberList: UiArrayObjectMember ;
+/.
+case $rule_number: {
+ sym(1).Node = makeAstNode<AST::UiObjectMemberList> (driver->nodePool(), sym(1).UiObjectMember);
+} break;
+./
+
+UiArrayMemberList: UiArrayMemberList T_COMMA UiArrayObjectMember ;
+/.
+case $rule_number: {
+ AST::UiObjectMemberList *node = makeAstNode<AST:: UiObjectMemberList> (driver->nodePool(),
+ sym(1).UiObjectMemberList, sym(3).UiObjectMember);
+ sym(1).Node = node;
+} break;
+./
+
+UiObjectInitializer: T_LBRACE T_RBRACE ;
+/.
+case $rule_number: {
+ AST::UiObjectInitializer *node = makeAstNode<AST::UiObjectInitializer> (driver->nodePool(), (AST::UiObjectMemberList*)0);
+ node->lbraceToken = loc(1);
+ node->rbraceToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+UiObjectInitializer: T_LBRACE UiObjectMemberList T_RBRACE ;
+/.
+case $rule_number: {
+ AST::UiObjectInitializer *node = makeAstNode<AST::UiObjectInitializer> (driver->nodePool(), sym(2).UiObjectMemberList->finish());
+ node->lbraceToken = loc(1);
+ node->rbraceToken = loc(3);
+ sym(1).Node = node;
+} break;
+./
+
+UiArrayObjectMember: UiQualifiedId T_COLON T_IDENTIFIER UiObjectInitializer ;
+/. case $rule_number: ./
+UiObjectMember: UiQualifiedId T_COLON T_IDENTIFIER UiObjectInitializer ;
+/.
+case $rule_number: {
+ AST::UiObjectBinding *node = makeAstNode<AST::UiObjectBinding> (driver->nodePool(), sym(1).UiQualifiedId->finish(),
+ sym(3).sval, sym(4).UiObjectInitializer);
+ node->colonToken = loc(2);
+ node->identifierToken = loc(3);
+ sym(1).Node = node;
+} break;
+./
+
+UiArrayObjectMember: T_IDENTIFIER UiObjectInitializer ;
+/. case $rule_number: ./
+UiObjectMember: T_IDENTIFIER UiObjectInitializer ;
+/.
+case $rule_number: {
+ AST::UiObjectDefinition *node = makeAstNode<AST::UiObjectDefinition> (driver->nodePool(), sym(1).sval,
+ sym(2).UiObjectInitializer);
+ node->identifierToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+UiArrayObjectMember: UiQualifiedId T_COLON T_LBRACKET UiArrayMemberList T_RBRACKET ;
+/. case $rule_number: ./
+UiObjectMember: UiQualifiedId T_COLON T_LBRACKET UiArrayMemberList T_RBRACKET ;
+/.
+case $rule_number: {
+ AST::UiArrayBinding *node = makeAstNode<AST::UiArrayBinding> (driver->nodePool(), sym(1).UiQualifiedId->finish(),
+ sym(4).UiObjectMemberList->finish());
+ node->colonToken = loc(2);
+ node->lbracketToken = loc(3);
+ node->rbraceToken = loc(5);
+ sym(1).Node = node;
+} break;
+./
+
+UiArrayObjectMember: UiQualifiedId T_COLON Statement ;
+/. case $rule_number: ./
+UiObjectMember: UiQualifiedId T_COLON Statement ;
+/.
+case $rule_number: {
+ AST::UiScriptBinding *node = makeAstNode<AST::UiScriptBinding> (driver->nodePool(), sym(1).UiQualifiedId->finish(),
+ sym(3).Statement);
+ node->colonToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+UiObjectMember: T_PUBLIC T_IDENTIFIER T_IDENTIFIER ;
+/.
+case $rule_number: {
+ AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval);
+ node->publicToken = loc(1);
+ node->attributeTypeToken = loc(2);
+ node->identifierToken = loc(3);
+ sym(1).Node = node;
+} break;
+./
+
+UiObjectMember: T_PUBLIC T_IDENTIFIER T_IDENTIFIER T_COLON Expression ;
+/.
+case $rule_number: {
+ AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval,
+ sym(5).Expression);
+ node->publicToken = loc(1);
+ node->attributeTypeToken = loc(2);
+ node->identifierToken = loc(3);
+ node->colonToken = loc(4);
+ sym(1).Node = node;
+} break;
+./
+
+UiObjectMember: FunctionDeclaration ;
+/.
+case $rule_number: {
+ sym(1).Node = makeAstNode<AST::UiSourceElement>(driver->nodePool(), sym(1).Node);
+} break;
+./
+
+UiObjectMember: VariableStatement ;
+/.
+case $rule_number: {
+ sym(1).Node = makeAstNode<AST::UiSourceElement>(driver->nodePool(), sym(1).Node);
+} break;
+./
+
+UiQualifiedId: T_IDENTIFIER ;
+/.
+case $rule_number: {
+ AST::UiQualifiedId *node = makeAstNode<AST::UiQualifiedId> (driver->nodePool(), sym(1).sval);
+ node->identifierToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+UiQualifiedId: UiQualifiedId T_DOT T_IDENTIFIER ;
+/.
+case $rule_number: {
+ AST::UiQualifiedId *node = makeAstNode<AST::UiQualifiedId> (driver->nodePool(), sym(1).UiQualifiedId, sym(3).sval);
+ node->identifierToken = loc(3);
+ sym(1).Node = node;
+} break;
+./
+
+
+--------------------------------------------------------------------------------------------------------
+-- Expressions
+--------------------------------------------------------------------------------------------------------
+PrimaryExpression: T_THIS ;
+/.
+case $rule_number: {
+ AST::ThisExpression *node = makeAstNode<AST::ThisExpression> (driver->nodePool());
+ node->thisToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+PrimaryExpression: T_IDENTIFIER ;
+/.
+case $rule_number: {
+ AST::IdentifierExpression *node = makeAstNode<AST::IdentifierExpression> (driver->nodePool(), sym(1).sval);
+ node->identifierToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+PrimaryExpression: T_NULL ;
+/.
+case $rule_number: {
+ AST::NullExpression *node = makeAstNode<AST::NullExpression> (driver->nodePool());
+ node->nullToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+PrimaryExpression: T_TRUE ;
+/.
+case $rule_number: {
+ AST::TrueLiteral *node = makeAstNode<AST::TrueLiteral> (driver->nodePool());
+ node->trueToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+PrimaryExpression: T_FALSE ;
+/.
+case $rule_number: {
+ AST::FalseLiteral *node = makeAstNode<AST::FalseLiteral> (driver->nodePool());
+ node->falseToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+PrimaryExpression: T_NUMERIC_LITERAL ;
+/.
+case $rule_number: {
+ AST::NumericLiteral *node = makeAstNode<AST::NumericLiteral> (driver->nodePool(), sym(1).dval);
+ node->literalToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+PrimaryExpression: T_STRING_LITERAL ;
+/.
+case $rule_number: {
+ AST::StringLiteral *node = makeAstNode<AST::StringLiteral> (driver->nodePool(), sym(1).sval);
+ node->literalToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+PrimaryExpression: T_DIVIDE_ ;
+/:
+#define J_SCRIPT_REGEXPLITERAL_RULE1 $rule_number
+:/
+/.
+case $rule_number: {
+ bool rx = lexer->scanRegExp(Lexer::NoPrefix);
+ if (!rx) {
+ diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, lexer->startLineNo(),
+ lexer->startColumnNo(), lexer->errorMessage()));
+ return false;
+ }
+ AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);
+ node->literalToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+PrimaryExpression: T_DIVIDE_EQ ;
+/:
+#define J_SCRIPT_REGEXPLITERAL_RULE2 $rule_number
+:/
+/.
+case $rule_number: {
+ bool rx = lexer->scanRegExp(Lexer::EqualPrefix);
+ if (!rx) {
+ diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, lexer->startLineNo(),
+ lexer->startColumnNo(), lexer->errorMessage()));
+ return false;
+ }
+ AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);
+ node->literalToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+PrimaryExpression: T_LBRACKET ElisionOpt T_RBRACKET ;
+/.
+case $rule_number: {
+ AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).Elision);
+ node->lbracketToken = loc(1);
+ node->rbracketToken = loc(3);
+ sym(1).Node = node;
+} break;
+./
+
+PrimaryExpression: T_LBRACKET ElementList T_RBRACKET ;
+/.
+case $rule_number: {
+ AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish ());
+ node->lbracketToken = loc(1);
+ node->rbracketToken = loc(3);
+ sym(1).Node = node;
+} break;
+./
+
+PrimaryExpression: T_LBRACKET ElementList T_COMMA ElisionOpt T_RBRACKET ;
+/.
+case $rule_number: {
+ AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish (), sym(4).Elision);
+ node->lbracketToken = loc(1);
+ node->commaToken = loc(3);
+ node->rbracketToken = loc(5);
+ sym(1).Node = node;
+} break;
+./
+
+-- PrimaryExpression: T_LBRACE T_RBRACE ;
+-- /.
+-- case $rule_number: {
+-- sym(1).Node = makeAstNode<AST::ObjectLiteral> (driver->nodePool());
+-- } break;
+-- ./
+
+PrimaryExpression: T_LBRACE PropertyNameAndValueListOpt T_RBRACE ;
+/.
+case $rule_number: {
+ AST::ObjectLiteral *node = 0;
+ if (sym(2).Node)
+ node = makeAstNode<AST::ObjectLiteral> (driver->nodePool(),
+ sym(2).PropertyNameAndValueList->finish ());
+ else
+ node = makeAstNode<AST::ObjectLiteral> (driver->nodePool());
+ node->lbraceToken = loc(1);
+ node->lbraceToken = loc(3);
+ sym(1).Node = node;
+} break;
+./
+
+PrimaryExpression: T_LBRACE PropertyNameAndValueList T_COMMA T_RBRACE ;
+/.
+case $rule_number: {
+ AST::ObjectLiteral *node = makeAstNode<AST::ObjectLiteral> (driver->nodePool(),
+ sym(2).PropertyNameAndValueList->finish ());
+ node->lbraceToken = loc(1);
+ node->lbraceToken = loc(4);
+ sym(1).Node = node;
+} break;
+./
+
+PrimaryExpression: T_LPAREN Expression T_RPAREN ;
+/.
+case $rule_number: {
+ AST::NestedExpression *node = makeAstNode<AST::NestedExpression>(driver->nodePool(), sym(2).Expression);
+ node->lparenToken = loc(1);
+ node->rparenToken = loc(3);
+ sym(1).Node = node;
+} break;
+./
+
+ElementList: ElisionOpt AssignmentExpression ;
+/.
+case $rule_number: {
+ sym(1).Node = makeAstNode<AST::ElementList> (driver->nodePool(), sym(1).Elision, sym(2).Expression);
+} break;
+./
+
+ElementList: ElementList T_COMMA ElisionOpt AssignmentExpression ;
+/.
+case $rule_number: {
+ AST::ElementList *node = makeAstNode<AST::ElementList> (driver->nodePool(), sym(1).ElementList, sym(3).Elision, sym(4).Expression);
+ node->commaToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+Elision: T_COMMA ;
+/.
+case $rule_number: {
+ AST::Elision *node = makeAstNode<AST::Elision> (driver->nodePool());
+ node->commaToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+Elision: Elision T_COMMA ;
+/.
+case $rule_number: {
+ AST::Elision *node = makeAstNode<AST::Elision> (driver->nodePool(), sym(1).Elision);
+ node->commaToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+ElisionOpt: %prec SHIFT_THERE ;
+/.
+case $rule_number: {
+ sym(1).Node = 0;
+} break;
+./
+
+ElisionOpt: Elision ;
+/.
+case $rule_number: {
+ sym(1).Elision = sym(1).Elision->finish ();
+} break;
+./
+
+PropertyNameAndValueList: PropertyName T_COLON AssignmentExpression ;
+/.
+case $rule_number: {
+ AST::PropertyNameAndValueList *node = makeAstNode<AST::PropertyNameAndValueList> (driver->nodePool(),
+ sym(1).PropertyName, sym(3).Expression);
+ node->colonToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+PropertyNameAndValueList: PropertyNameAndValueList T_COMMA PropertyName T_COLON AssignmentExpression ;
+/.
+case $rule_number: {
+ AST::PropertyNameAndValueList *node = makeAstNode<AST::PropertyNameAndValueList> (driver->nodePool(),
+ sym(1).PropertyNameAndValueList, sym(3).PropertyName, sym(5).Expression);
+ node->commaToken = loc(2);
+ node->colonToken = loc(4);
+ sym(1).Node = node;
+} break;
+./
+
+PropertyName: T_IDENTIFIER %prec REDUCE_HERE ;
+/.
+case $rule_number: {
+ AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval);
+ node->propertyNameToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+PropertyName: T_STRING_LITERAL ;
+/.
+case $rule_number: {
+ AST::StringLiteralPropertyName *node = makeAstNode<AST::StringLiteralPropertyName> (driver->nodePool(), sym(1).sval);
+ node->propertyNameToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+PropertyName: T_NUMERIC_LITERAL ;
+/.
+case $rule_number: {
+ AST::NumericLiteralPropertyName *node = makeAstNode<AST::NumericLiteralPropertyName> (driver->nodePool(), sym(1).dval);
+ node->propertyNameToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+PropertyName: ReservedIdentifier ;
+/.
+case $rule_number: {
+ AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval);
+ node->propertyNameToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+ReservedIdentifier: T_BREAK ;
+/.
+case $rule_number:
+./
+ReservedIdentifier: T_CASE ;
+/.
+case $rule_number:
+./
+ReservedIdentifier: T_CATCH ;
+/.
+case $rule_number:
+./
+ReservedIdentifier: T_CONTINUE ;
+/.
+case $rule_number:
+./
+ReservedIdentifier: T_DEFAULT ;
+/.
+case $rule_number:
+./
+ReservedIdentifier: T_DELETE ;
+/.
+case $rule_number:
+./
+ReservedIdentifier: T_DO ;
+/.
+case $rule_number:
+./
+ReservedIdentifier: T_ELSE ;
+/.
+case $rule_number:
+./
+ReservedIdentifier: T_FALSE ;
+/.
+case $rule_number:
+./
+ReservedIdentifier: T_FINALLY ;
+/.
+case $rule_number:
+./
+ReservedIdentifier: T_FOR ;
+/.
+case $rule_number:
+./
+ReservedIdentifier: T_FUNCTION ;
+/.
+case $rule_number:
+./
+ReservedIdentifier: T_IF ;
+/.
+case $rule_number:
+./
+ReservedIdentifier: T_IN ;
+/.
+case $rule_number:
+./
+ReservedIdentifier: T_INSTANCEOF ;
+/.
+case $rule_number:
+./
+ReservedIdentifier: T_NEW ;
+/.
+case $rule_number:
+./
+ReservedIdentifier: T_NULL ;
+/.
+case $rule_number:
+./
+ReservedIdentifier: T_RETURN ;
+/.
+case $rule_number:
+./
+ReservedIdentifier: T_SWITCH ;
+/.
+case $rule_number:
+./
+ReservedIdentifier: T_THIS ;
+/.
+case $rule_number:
+./
+ReservedIdentifier: T_THROW ;
+/.
+case $rule_number:
+./
+ReservedIdentifier: T_TRUE ;
+/.
+case $rule_number:
+./
+ReservedIdentifier: T_TRY ;
+/.
+case $rule_number:
+./
+ReservedIdentifier: T_TYPEOF ;
+/.
+case $rule_number:
+./
+ReservedIdentifier: T_VAR ;
+/.
+case $rule_number:
+./
+ReservedIdentifier: T_VOID ;
+/.
+case $rule_number:
+./
+ReservedIdentifier: T_WHILE ;
+/.
+case $rule_number:
+./
+ReservedIdentifier: T_CONST ;
+/.
+case $rule_number:
+./
+ReservedIdentifier: T_DEBUGGER ;
+/.
+case $rule_number:
+./
+ReservedIdentifier: T_RESERVED_WORD ;
+/.
+case $rule_number:
+./
+ReservedIdentifier: T_WITH ;
+/.
+case $rule_number:
+{
+ sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount());
+} break;
+./
+
+PropertyIdentifier: T_IDENTIFIER ;
+PropertyIdentifier: ReservedIdentifier ;
+
+MemberExpression: PrimaryExpression ;
+MemberExpression: FunctionExpression ;
+
+MemberExpression: MemberExpression T_LBRACKET Expression T_RBRACKET ;
+/.
+case $rule_number: {
+ AST::ArrayMemberExpression *node = makeAstNode<AST::ArrayMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression);
+ node->lbracketToken = loc(2);
+ node->rbracketToken = loc(4);
+ sym(1).Node = node;
+} break;
+./
+
+MemberExpression: MemberExpression T_DOT PropertyIdentifier ;
+/.
+case $rule_number: {
+ AST::FieldMemberExpression *node = makeAstNode<AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval);
+ node->dotToken = loc(2);
+ node->identifierToken = loc(3);
+ sym(1).Node = node;
+} break;
+./
+
+MemberExpression: T_NEW MemberExpression T_LPAREN ArgumentListOpt T_RPAREN ;
+/.
+case $rule_number: {
+ AST::NewMemberExpression *node = makeAstNode<AST::NewMemberExpression> (driver->nodePool(), sym(2).Expression, sym(4).ArgumentList);
+ node->newToken = loc(1);
+ node->lparenToken = loc(3);
+ node->rparenToken = loc(5);
+ sym(1).Node = node;
+} break;
+./
+
+NewExpression: MemberExpression ;
+
+NewExpression: T_NEW NewExpression ;
+/.
+case $rule_number: {
+ AST::NewExpression *node = makeAstNode<AST::NewExpression> (driver->nodePool(), sym(2).Expression);
+ node->newToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+CallExpression: MemberExpression T_LPAREN ArgumentListOpt T_RPAREN ;
+/.
+case $rule_number: {
+ AST::CallExpression *node = makeAstNode<AST::CallExpression> (driver->nodePool(), sym(1).Expression, sym(3).ArgumentList);
+ node->lparenToken = loc(2);
+ node->rparenToken = loc(4);
+ sym(1).Node = node;
+} break;
+./
+
+CallExpression: CallExpression T_LPAREN ArgumentListOpt T_RPAREN ;
+/.
+case $rule_number: {
+ AST::CallExpression *node = makeAstNode<AST::CallExpression> (driver->nodePool(), sym(1).Expression, sym(3).ArgumentList);
+ node->lparenToken = loc(2);
+ node->rparenToken = loc(4);
+ sym(1).Node = node;
+} break;
+./
+
+CallExpression: CallExpression T_LBRACKET Expression T_RBRACKET ;
+/.
+case $rule_number: {
+ AST::ArrayMemberExpression *node = makeAstNode<AST::ArrayMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression);
+ node->lbracketToken = loc(2);
+ node->rbracketToken = loc(4);
+ sym(1).Node = node;
+} break;
+./
+
+CallExpression: CallExpression T_DOT PropertyIdentifier ;
+/.
+case $rule_number: {
+ AST::FieldMemberExpression *node = makeAstNode<AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval);
+ node->dotToken = loc(2);
+ node->identifierToken = loc(3);
+ sym(1).Node = node;
+} break;
+./
+
+ArgumentListOpt: ;
+/.
+case $rule_number: {
+ sym(1).Node = 0;
+} break;
+./
+
+ArgumentListOpt: ArgumentList ;
+/.
+case $rule_number: {
+ sym(1).Node = sym(1).ArgumentList->finish();
+} break;
+./
+
+ArgumentList: AssignmentExpression ;
+/.
+case $rule_number: {
+ sym(1).Node = makeAstNode<AST::ArgumentList> (driver->nodePool(), sym(1).Expression);
+} break;
+./
+
+ArgumentList: ArgumentList T_COMMA AssignmentExpression ;
+/.
+case $rule_number: {
+ AST::ArgumentList *node = makeAstNode<AST::ArgumentList> (driver->nodePool(), sym(1).ArgumentList, sym(3).Expression);
+ node->commaToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+LeftHandSideExpression: NewExpression ;
+LeftHandSideExpression: CallExpression ;
+PostfixExpression: LeftHandSideExpression ;
+
+PostfixExpression: LeftHandSideExpression T_PLUS_PLUS ;
+/.
+case $rule_number: {
+ AST::PostIncrementExpression *node = makeAstNode<AST::PostIncrementExpression> (driver->nodePool(), sym(1).Expression);
+ node->incrementToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+PostfixExpression: LeftHandSideExpression T_MINUS_MINUS ;
+/.
+case $rule_number: {
+ AST::PostDecrementExpression *node = makeAstNode<AST::PostDecrementExpression> (driver->nodePool(), sym(1).Expression);
+ node->decrementToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+UnaryExpression: PostfixExpression ;
+
+UnaryExpression: T_DELETE UnaryExpression ;
+/.
+case $rule_number: {
+ AST::DeleteExpression *node = makeAstNode<AST::DeleteExpression> (driver->nodePool(), sym(2).Expression);
+ node->deleteToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+UnaryExpression: T_VOID UnaryExpression ;
+/.
+case $rule_number: {
+ AST::VoidExpression *node = makeAstNode<AST::VoidExpression> (driver->nodePool(), sym(2).Expression);
+ node->voidToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+UnaryExpression: T_TYPEOF UnaryExpression ;
+/.
+case $rule_number: {
+ AST::TypeOfExpression *node = makeAstNode<AST::TypeOfExpression> (driver->nodePool(), sym(2).Expression);
+ node->typeofToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+UnaryExpression: T_PLUS_PLUS UnaryExpression ;
+/.
+case $rule_number: {
+ AST::PreIncrementExpression *node = makeAstNode<AST::PreIncrementExpression> (driver->nodePool(), sym(2).Expression);
+ node->incrementToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+UnaryExpression: T_MINUS_MINUS UnaryExpression ;
+/.
+case $rule_number: {
+ AST::PreDecrementExpression *node = makeAstNode<AST::PreDecrementExpression> (driver->nodePool(), sym(2).Expression);
+ node->decrementToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+UnaryExpression: T_PLUS UnaryExpression ;
+/.
+case $rule_number: {
+ AST::UnaryPlusExpression *node = makeAstNode<AST::UnaryPlusExpression> (driver->nodePool(), sym(2).Expression);
+ node->plusToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+UnaryExpression: T_MINUS UnaryExpression ;
+/.
+case $rule_number: {
+ AST::UnaryMinusExpression *node = makeAstNode<AST::UnaryMinusExpression> (driver->nodePool(), sym(2).Expression);
+ node->minusToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+UnaryExpression: T_TILDE UnaryExpression ;
+/.
+case $rule_number: {
+ AST::TildeExpression *node = makeAstNode<AST::TildeExpression> (driver->nodePool(), sym(2).Expression);
+ node->tildeToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+UnaryExpression: T_NOT UnaryExpression ;
+/.
+case $rule_number: {
+ AST::NotExpression *node = makeAstNode<AST::NotExpression> (driver->nodePool(), sym(2).Expression);
+ node->notToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+MultiplicativeExpression: UnaryExpression ;
+
+MultiplicativeExpression: MultiplicativeExpression T_STAR UnaryExpression ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Mul, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+MultiplicativeExpression: MultiplicativeExpression T_DIVIDE_ UnaryExpression ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Div, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+MultiplicativeExpression: MultiplicativeExpression T_REMAINDER UnaryExpression ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Mod, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+AdditiveExpression: MultiplicativeExpression ;
+
+AdditiveExpression: AdditiveExpression T_PLUS MultiplicativeExpression ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Add, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+AdditiveExpression: AdditiveExpression T_MINUS MultiplicativeExpression ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Sub, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+ShiftExpression: AdditiveExpression ;
+
+ShiftExpression: ShiftExpression T_LT_LT AdditiveExpression ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::LShift, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+ShiftExpression: ShiftExpression T_GT_GT AdditiveExpression ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::RShift, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+ShiftExpression: ShiftExpression T_GT_GT_GT AdditiveExpression ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::URShift, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+RelationalExpression: ShiftExpression ;
+
+RelationalExpression: RelationalExpression T_LT ShiftExpression ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Lt, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+RelationalExpression: RelationalExpression T_GT ShiftExpression ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Gt, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+RelationalExpression: RelationalExpression T_LE ShiftExpression ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Le, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+RelationalExpression: RelationalExpression T_GE ShiftExpression ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Ge, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+RelationalExpression: RelationalExpression T_INSTANCEOF ShiftExpression ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::InstanceOf, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+RelationalExpression: RelationalExpression T_IN ShiftExpression ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::In, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+RelationalExpressionNotIn: ShiftExpression ;
+
+RelationalExpressionNotIn: RelationalExpressionNotIn T_LT ShiftExpression ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Lt, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+RelationalExpressionNotIn: RelationalExpressionNotIn T_GT ShiftExpression ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Gt, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+RelationalExpressionNotIn: RelationalExpressionNotIn T_LE ShiftExpression ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Le, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+RelationalExpressionNotIn: RelationalExpressionNotIn T_GE ShiftExpression ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Ge, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+RelationalExpressionNotIn: RelationalExpressionNotIn T_INSTANCEOF ShiftExpression ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::InstanceOf, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+EqualityExpression: RelationalExpression ;
+
+EqualityExpression: EqualityExpression T_EQ_EQ RelationalExpression ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Equal, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+EqualityExpression: EqualityExpression T_NOT_EQ RelationalExpression ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::NotEqual, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+EqualityExpression: EqualityExpression T_EQ_EQ_EQ RelationalExpression ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::StrictEqual, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+EqualityExpression: EqualityExpression T_NOT_EQ_EQ RelationalExpression ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::StrictNotEqual, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+EqualityExpressionNotIn: RelationalExpressionNotIn ;
+
+EqualityExpressionNotIn: EqualityExpressionNotIn T_EQ_EQ RelationalExpressionNotIn ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Equal, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+EqualityExpressionNotIn: EqualityExpressionNotIn T_NOT_EQ RelationalExpressionNotIn;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::NotEqual, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+EqualityExpressionNotIn: EqualityExpressionNotIn T_EQ_EQ_EQ RelationalExpressionNotIn ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::StrictEqual, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+EqualityExpressionNotIn: EqualityExpressionNotIn T_NOT_EQ_EQ RelationalExpressionNotIn ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::StrictNotEqual, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+BitwiseANDExpression: EqualityExpression ;
+
+BitwiseANDExpression: BitwiseANDExpression T_AND EqualityExpression ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::BitAnd, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+BitwiseANDExpressionNotIn: EqualityExpressionNotIn ;
+
+BitwiseANDExpressionNotIn: BitwiseANDExpressionNotIn T_AND EqualityExpressionNotIn ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::BitAnd, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+BitwiseXORExpression: BitwiseANDExpression ;
+
+BitwiseXORExpression: BitwiseXORExpression T_XOR BitwiseANDExpression ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::BitXor, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+BitwiseXORExpressionNotIn: BitwiseANDExpressionNotIn ;
+
+BitwiseXORExpressionNotIn: BitwiseXORExpressionNotIn T_XOR BitwiseANDExpressionNotIn ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::BitXor, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+BitwiseORExpression: BitwiseXORExpression ;
+
+BitwiseORExpression: BitwiseORExpression T_OR BitwiseXORExpression ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::BitOr, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+BitwiseORExpressionNotIn: BitwiseXORExpressionNotIn ;
+
+BitwiseORExpressionNotIn: BitwiseORExpressionNotIn T_OR BitwiseXORExpressionNotIn ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::BitOr, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+LogicalANDExpression: BitwiseORExpression ;
+
+LogicalANDExpression: LogicalANDExpression T_AND_AND BitwiseORExpression ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::And, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+LogicalANDExpressionNotIn: BitwiseORExpressionNotIn ;
+
+LogicalANDExpressionNotIn: LogicalANDExpressionNotIn T_AND_AND BitwiseORExpressionNotIn ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::And, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+LogicalORExpression: LogicalANDExpression ;
+
+LogicalORExpression: LogicalORExpression T_OR_OR LogicalANDExpression ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Or, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+LogicalORExpressionNotIn: LogicalANDExpressionNotIn ;
+
+LogicalORExpressionNotIn: LogicalORExpressionNotIn T_OR_OR LogicalANDExpressionNotIn ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Or, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+ConditionalExpression: LogicalORExpression ;
+
+ConditionalExpression: LogicalORExpression T_QUESTION AssignmentExpression T_COLON AssignmentExpression ;
+/.
+case $rule_number: {
+ AST::ConditionalExpression *node = makeAstNode<AST::ConditionalExpression> (driver->nodePool(), sym(1).Expression,
+ sym(3).Expression, sym(5).Expression);
+ node->questionToken = loc(2);
+ node->colonToken = loc(4);
+ sym(1).Node = node;
+} break;
+./
+
+ConditionalExpressionNotIn: LogicalORExpressionNotIn ;
+
+ConditionalExpressionNotIn: LogicalORExpressionNotIn T_QUESTION AssignmentExpressionNotIn T_COLON AssignmentExpressionNotIn ;
+/.
+case $rule_number: {
+ AST::ConditionalExpression *node = makeAstNode<AST::ConditionalExpression> (driver->nodePool(), sym(1).Expression,
+ sym(3).Expression, sym(5).Expression);
+ node->questionToken = loc(2);
+ node->colonToken = loc(4);
+ sym(1).Node = node;
+} break;
+./
+
+AssignmentExpression: ConditionalExpression ;
+
+AssignmentExpression: LeftHandSideExpression AssignmentOperator AssignmentExpression ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ sym(2).ival, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+AssignmentExpressionNotIn: ConditionalExpressionNotIn ;
+
+AssignmentExpressionNotIn: LeftHandSideExpression AssignmentOperator AssignmentExpressionNotIn ;
+/.
+case $rule_number: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ sym(2).ival, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+AssignmentOperator: T_EQ ;
+/.
+case $rule_number: {
+ sym(1).ival = QSOperator::Assign;
+} break;
+./
+
+AssignmentOperator: T_STAR_EQ ;
+/.
+case $rule_number: {
+ sym(1).ival = QSOperator::InplaceMul;
+} break;
+./
+
+AssignmentOperator: T_DIVIDE_EQ ;
+/.
+case $rule_number: {
+ sym(1).ival = QSOperator::InplaceDiv;
+} break;
+./
+
+AssignmentOperator: T_REMAINDER_EQ ;
+/.
+case $rule_number: {
+ sym(1).ival = QSOperator::InplaceMod;
+} break;
+./
+
+AssignmentOperator: T_PLUS_EQ ;
+/.
+case $rule_number: {
+ sym(1).ival = QSOperator::InplaceAdd;
+} break;
+./
+
+AssignmentOperator: T_MINUS_EQ ;
+/.
+case $rule_number: {
+ sym(1).ival = QSOperator::InplaceSub;
+} break;
+./
+
+AssignmentOperator: T_LT_LT_EQ ;
+/.
+case $rule_number: {
+ sym(1).ival = QSOperator::InplaceLeftShift;
+} break;
+./
+
+AssignmentOperator: T_GT_GT_EQ ;
+/.
+case $rule_number: {
+ sym(1).ival = QSOperator::InplaceRightShift;
+} break;
+./
+
+AssignmentOperator: T_GT_GT_GT_EQ ;
+/.
+case $rule_number: {
+ sym(1).ival = QSOperator::InplaceURightShift;
+} break;
+./
+
+AssignmentOperator: T_AND_EQ ;
+/.
+case $rule_number: {
+ sym(1).ival = QSOperator::InplaceAnd;
+} break;
+./
+
+AssignmentOperator: T_XOR_EQ ;
+/.
+case $rule_number: {
+ sym(1).ival = QSOperator::InplaceXor;
+} break;
+./
+
+AssignmentOperator: T_OR_EQ ;
+/.
+case $rule_number: {
+ sym(1).ival = QSOperator::InplaceOr;
+} break;
+./
+
+Expression: AssignmentExpression ;
+
+Expression: Expression T_COMMA AssignmentExpression ;
+/.
+case $rule_number: {
+ AST::Expression *node = makeAstNode<AST::Expression> (driver->nodePool(), sym(1).Expression, sym(3).Expression);
+ node->commaToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+ExpressionOpt: ;
+/.
+case $rule_number: {
+ sym(1).Node = 0;
+} break;
+./
+
+ExpressionOpt: Expression ;
+
+ExpressionNotIn: AssignmentExpressionNotIn ;
+
+ExpressionNotIn: ExpressionNotIn T_COMMA AssignmentExpressionNotIn ;
+/.
+case $rule_number: {
+ AST::Expression *node = makeAstNode<AST::Expression> (driver->nodePool(), sym(1).Expression, sym(3).Expression);
+ node->commaToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+ExpressionNotInOpt: ;
+/.
+case $rule_number: {
+ sym(1).Node = 0;
+} break;
+./
+
+ExpressionNotInOpt: ExpressionNotIn ;
+
+Statement: Block ;
+Statement: VariableStatement ;
+Statement: EmptyStatement ;
+Statement: ExpressionStatement ;
+Statement: IfStatement ;
+Statement: IterationStatement ;
+Statement: ContinueStatement ;
+Statement: BreakStatement ;
+Statement: ReturnStatement ;
+Statement: WithStatement ;
+Statement: LabelledStatement ;
+Statement: SwitchStatement ;
+Statement: ThrowStatement ;
+Statement: TryStatement ;
+Statement: DebuggerStatement ;
+
+
+Block: T_LBRACE StatementListOpt T_RBRACE ;
+/.
+case $rule_number: {
+ AST::Block *node = makeAstNode<AST::Block> (driver->nodePool(), sym(2).StatementList);
+ node->lbraceToken = loc(1);
+ node->rbraceToken = loc(3);
+ sym(1).Node = node;
+} break;
+./
+
+StatementList: Statement ;
+/.
+case $rule_number: {
+ sym(1).Node = makeAstNode<AST::StatementList> (driver->nodePool(), sym(1).Statement);
+} break;
+./
+
+StatementList: StatementList Statement ;
+/.
+case $rule_number: {
+ sym(1).Node = makeAstNode<AST::StatementList> (driver->nodePool(), sym(1).StatementList, sym(2).Statement);
+} break;
+./
+
+StatementListOpt: ;
+/.
+case $rule_number: {
+ sym(1).Node = 0;
+} break;
+./
+
+StatementListOpt: StatementList ;
+/.
+case $rule_number: {
+ sym(1).Node = sym(1).StatementList->finish ();
+} break;
+./
+
+VariableStatement: VariableDeclarationKind VariableDeclarationList T_AUTOMATIC_SEMICOLON ; -- automatic semicolon
+VariableStatement: VariableDeclarationKind VariableDeclarationList T_SEMICOLON ;
+/.
+case $rule_number: {
+ AST::VariableStatement *node = makeAstNode<AST::VariableStatement> (driver->nodePool(),
+ sym(2).VariableDeclarationList->finish (/*readOnly=*/sym(1).ival == T_CONST));
+ node->declarationKindToken = loc(1);
+ node->semicolonToken = loc(3);
+ sym(1).Node = node;
+} break;
+./
+
+VariableDeclarationKind: T_CONST ;
+/.
+case $rule_number: {
+ sym(1).ival = T_CONST;
+} break;
+./
+
+VariableDeclarationKind: T_VAR ;
+/.
+case $rule_number: {
+ sym(1).ival = T_VAR;
+} break;
+./
+
+VariableDeclarationList: VariableDeclaration ;
+/.
+case $rule_number: {
+ sym(1).Node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclaration);
+} break;
+./
+
+VariableDeclarationList: VariableDeclarationList T_COMMA VariableDeclaration ;
+/.
+case $rule_number: {
+ AST::VariableDeclarationList *node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(),
+ sym(1).VariableDeclarationList, sym(3).VariableDeclaration);
+ node->commaToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+VariableDeclarationListNotIn: VariableDeclarationNotIn ;
+/.
+case $rule_number: {
+ sym(1).Node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclaration);
+} break;
+./
+
+VariableDeclarationListNotIn: VariableDeclarationListNotIn T_COMMA VariableDeclarationNotIn ;
+/.
+case $rule_number: {
+ sym(1).Node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclarationList, sym(3).VariableDeclaration);
+} break;
+./
+
+VariableDeclaration: T_IDENTIFIER InitialiserOpt ;
+/.
+case $rule_number: {
+ AST::VariableDeclaration *node = makeAstNode<AST::VariableDeclaration> (driver->nodePool(), sym(1).sval, sym(2).Expression);
+ node->identifierToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+VariableDeclarationNotIn: T_IDENTIFIER InitialiserNotInOpt ;
+/.
+case $rule_number: {
+ AST::VariableDeclaration *node = makeAstNode<AST::VariableDeclaration> (driver->nodePool(), sym(1).sval, sym(2).Expression);
+ node->identifierToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+Initialiser: T_EQ AssignmentExpression ;
+/.
+case $rule_number: {
+ // ### TODO: AST for initializer
+ sym(1) = sym(2);
+} break;
+./
+
+InitialiserOpt: ;
+/.
+case $rule_number: {
+ sym(1).Node = 0;
+} break;
+./
+
+InitialiserOpt: Initialiser ;
+
+InitialiserNotIn: T_EQ AssignmentExpressionNotIn ;
+/.
+case $rule_number: {
+ // ### TODO: AST for initializer
+ sym(1) = sym(2);
+} break;
+./
+
+InitialiserNotInOpt: ;
+/.
+case $rule_number: {
+ sym(1).Node = 0;
+} break;
+./
+
+InitialiserNotInOpt: InitialiserNotIn ;
+
+EmptyStatement: T_SEMICOLON ;
+/.
+case $rule_number: {
+ AST::EmptyStatement *node = makeAstNode<AST::EmptyStatement> (driver->nodePool());
+ node->semicolonToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+ExpressionStatement: Expression T_AUTOMATIC_SEMICOLON ; -- automatic semicolon
+ExpressionStatement: Expression T_SEMICOLON ;
+/.
+case $rule_number: {
+ AST::ExpressionStatement *node = makeAstNode<AST::ExpressionStatement> (driver->nodePool(), sym(1).Expression);
+ node->semicolonToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+IfStatement: T_IF T_LPAREN Expression T_RPAREN Statement T_ELSE Statement ;
+/.
+case $rule_number: {
+ AST::IfStatement *node = makeAstNode<AST::IfStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement, sym(7).Statement);
+ node->ifToken = loc(1);
+ node->lparenToken = loc(2);
+ node->rparenToken = loc(4);
+ node->elseToken = loc(5);
+ sym(1).Node = node;
+} break;
+./
+
+IfStatement: T_IF T_LPAREN Expression T_RPAREN Statement ;
+/.
+case $rule_number: {
+ AST::IfStatement *node = makeAstNode<AST::IfStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement);
+ node->ifToken = loc(1);
+ node->lparenToken = loc(2);
+ node->rparenToken = loc(4);
+ sym(1).Node = node;
+} break;
+./
+
+
+IterationStatement: T_DO Statement T_WHILE T_LPAREN Expression T_RPAREN T_AUTOMATIC_SEMICOLON ; -- automatic semicolon
+IterationStatement: T_DO Statement T_WHILE T_LPAREN Expression T_RPAREN T_SEMICOLON ;
+/.
+case $rule_number: {
+ AST::DoWhileStatement *node = makeAstNode<AST::DoWhileStatement> (driver->nodePool(), sym(2).Statement, sym(5).Expression);
+ node->doToken = loc(1);
+ node->whileToken = loc(3);
+ node->lparenToken = loc(4);
+ node->rparenToken = loc(6);
+ node->semicolonToken = loc(7);
+ sym(1).Node = node;
+} break;
+./
+
+IterationStatement: T_WHILE T_LPAREN Expression T_RPAREN Statement ;
+/.
+case $rule_number: {
+ AST::WhileStatement *node = makeAstNode<AST::WhileStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement);
+ node->whileToken = loc(1);
+ node->lparenToken = loc(2);
+ node->rparenToken = loc(4);
+ sym(1).Node = node;
+} break;
+./
+
+IterationStatement: T_FOR T_LPAREN ExpressionNotInOpt T_SEMICOLON ExpressionOpt T_SEMICOLON ExpressionOpt T_RPAREN Statement ;
+/.
+case $rule_number: {
+ AST::ForStatement *node = makeAstNode<AST::ForStatement> (driver->nodePool(), sym(3).Expression,
+ sym(5).Expression, sym(7).Expression, sym(9).Statement);
+ node->forToken = loc(1);
+ node->lparenToken = loc(2);
+ node->firstSemicolonToken = loc(4);
+ node->secondSemicolonToken = loc(6);
+ node->rparenToken = loc(8);
+ sym(1).Node = node;
+} break;
+./
+
+IterationStatement: T_FOR T_LPAREN T_VAR VariableDeclarationListNotIn T_SEMICOLON ExpressionOpt T_SEMICOLON ExpressionOpt T_RPAREN Statement ;
+/.
+case $rule_number: {
+ AST::LocalForStatement *node = makeAstNode<AST::LocalForStatement> (driver->nodePool(),
+ sym(4).VariableDeclarationList->finish (/*readOnly=*/false), sym(6).Expression,
+ sym(8).Expression, sym(10).Statement);
+ node->forToken = loc(1);
+ node->lparenToken = loc(2);
+ node->varToken = loc(3);
+ node->firstSemicolonToken = loc(5);
+ node->secondSemicolonToken = loc(7);
+ node->rparenToken = loc(9);
+ sym(1).Node = node;
+} break;
+./
+
+IterationStatement: T_FOR T_LPAREN LeftHandSideExpression T_IN Expression T_RPAREN Statement ;
+/.
+case $rule_number: {
+ AST:: ForEachStatement *node = makeAstNode<AST::ForEachStatement> (driver->nodePool(), sym(3).Expression,
+ sym(5).Expression, sym(7).Statement);
+ node->forToken = loc(1);
+ node->lparenToken = loc(2);
+ node->inToken = loc(4);
+ node->rparenToken = loc(6);
+ sym(1).Node = node;
+} break;
+./
+
+IterationStatement: T_FOR T_LPAREN T_VAR VariableDeclarationNotIn T_IN Expression T_RPAREN Statement ;
+/.
+case $rule_number: {
+ AST::LocalForEachStatement *node = makeAstNode<AST::LocalForEachStatement> (driver->nodePool(),
+ sym(4).VariableDeclaration, sym(6).Expression, sym(8).Statement);
+ node->forToken = loc(1);
+ node->lparenToken = loc(2);
+ node->varToken = loc(3);
+ node->inToken = loc(5);
+ node->rparenToken = loc(7);
+ sym(1).Node = node;
+} break;
+./
+
+ContinueStatement: T_CONTINUE T_AUTOMATIC_SEMICOLON ; -- automatic semicolon
+ContinueStatement: T_CONTINUE T_SEMICOLON ;
+/.
+case $rule_number: {
+ AST::ContinueStatement *node = makeAstNode<AST::ContinueStatement> (driver->nodePool());
+ node->continueToken = loc(1);
+ node->semicolonToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+ContinueStatement: T_CONTINUE T_IDENTIFIER T_AUTOMATIC_SEMICOLON ; -- automatic semicolon
+ContinueStatement: T_CONTINUE T_IDENTIFIER T_SEMICOLON ;
+/.
+case $rule_number: {
+ AST::ContinueStatement *node = makeAstNode<AST::ContinueStatement> (driver->nodePool(), sym(2).sval);
+ node->continueToken = loc(1);
+ node->identifierToken = loc(2);
+ node->semicolonToken = loc(3);
+ sym(1).Node = node;
+} break;
+./
+
+BreakStatement: T_BREAK T_AUTOMATIC_SEMICOLON ; -- automatic semicolon
+BreakStatement: T_BREAK T_SEMICOLON ;
+/.
+case $rule_number: {
+ AST::BreakStatement *node = makeAstNode<AST::BreakStatement> (driver->nodePool());
+ node->breakToken = loc(1);
+ node->semicolonToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+BreakStatement: T_BREAK T_IDENTIFIER T_AUTOMATIC_SEMICOLON ; -- automatic semicolon
+BreakStatement: T_BREAK T_IDENTIFIER T_SEMICOLON ;
+/.
+case $rule_number: {
+ AST::BreakStatement *node = makeAstNode<AST::BreakStatement> (driver->nodePool(), sym(2).sval);
+ node->breakToken = loc(1);
+ node->identifierToken = loc(2);
+ node->semicolonToken = loc(3);
+ sym(1).Node = node;
+} break;
+./
+
+ReturnStatement: T_RETURN ExpressionOpt T_AUTOMATIC_SEMICOLON ; -- automatic semicolon
+ReturnStatement: T_RETURN ExpressionOpt T_SEMICOLON ;
+/.
+case $rule_number: {
+ AST::ReturnStatement *node = makeAstNode<AST::ReturnStatement> (driver->nodePool(), sym(2).Expression);
+ node->returnToken = loc(1);
+ node->semicolonToken = loc(3);
+ sym(1).Node = node;
+} break;
+./
+
+WithStatement: T_WITH T_LPAREN Expression T_RPAREN Statement ;
+/.
+case $rule_number: {
+ AST::WithStatement *node = makeAstNode<AST::WithStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement);
+ node->withToken = loc(1);
+ node->lparenToken = loc(2);
+ node->rparenToken = loc(4);
+ sym(1).Node = node;
+} break;
+./
+
+SwitchStatement: T_SWITCH T_LPAREN Expression T_RPAREN CaseBlock ;
+/.
+case $rule_number: {
+ AST::SwitchStatement *node = makeAstNode<AST::SwitchStatement> (driver->nodePool(), sym(3).Expression, sym(5).CaseBlock);
+ node->switchToken = loc(1);
+ node->lparenToken = loc(2);
+ node->rparenToken = loc(4);
+ sym(1).Node = node;
+} break;
+./
+
+CaseBlock: T_LBRACE CaseClausesOpt T_RBRACE ;
+/.
+case $rule_number: {
+ AST::CaseBlock *node = makeAstNode<AST::CaseBlock> (driver->nodePool(), sym(2).CaseClauses);
+ node->lbraceToken = loc(1);
+ node->rbraceToken = loc(3);
+ sym(1).Node = node;
+} break;
+./
+
+CaseBlock: T_LBRACE CaseClausesOpt DefaultClause CaseClausesOpt T_RBRACE ;
+/.
+case $rule_number: {
+ AST::CaseBlock *node = makeAstNode<AST::CaseBlock> (driver->nodePool(), sym(2).CaseClauses, sym(3).DefaultClause, sym(4).CaseClauses);
+ node->lbraceToken = loc(1);
+ node->rbraceToken = loc(5);
+ sym(1).Node = node;
+} break;
+./
+
+CaseClauses: CaseClause ;
+/.
+case $rule_number: {
+ sym(1).Node = makeAstNode<AST::CaseClauses> (driver->nodePool(), sym(1).CaseClause);
+} break;
+./
+
+CaseClauses: CaseClauses CaseClause ;
+/.
+case $rule_number: {
+ sym(1).Node = makeAstNode<AST::CaseClauses> (driver->nodePool(), sym(1).CaseClauses, sym(2).CaseClause);
+} break;
+./
+
+CaseClausesOpt: ;
+/.
+case $rule_number: {
+ sym(1).Node = 0;
+} break;
+./
+
+CaseClausesOpt: CaseClauses ;
+/.
+case $rule_number: {
+ sym(1).Node = sym(1).CaseClauses->finish ();
+} break;
+./
+
+CaseClause: T_CASE Expression T_COLON StatementListOpt ;
+/.
+case $rule_number: {
+ AST::CaseClause *node = makeAstNode<AST::CaseClause> (driver->nodePool(), sym(2).Expression, sym(4).StatementList);
+ node->caseToken = loc(1);
+ node->colonToken = loc(3);
+ sym(1).Node = node;
+} break;
+./
+
+DefaultClause: T_DEFAULT T_COLON StatementListOpt ;
+/.
+case $rule_number: {
+ AST::DefaultClause *node = makeAstNode<AST::DefaultClause> (driver->nodePool(), sym(3).StatementList);
+ node->defaultToken = loc(1);
+ node->colonToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+LabelledStatement: T_IDENTIFIER T_COLON Statement ;
+/.
+case $rule_number: {
+ AST::LabelledStatement *node = makeAstNode<AST::LabelledStatement> (driver->nodePool(), sym(1).sval, sym(3).Statement);
+ node->identifierToken = loc(1);
+ node->colonToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+ThrowStatement: T_THROW Expression T_AUTOMATIC_SEMICOLON ; -- automatic semicolon
+ThrowStatement: T_THROW Expression T_SEMICOLON ;
+/.
+case $rule_number: {
+ AST::ThrowStatement *node = makeAstNode<AST::ThrowStatement> (driver->nodePool(), sym(2).Expression);
+ node->throwToken = loc(1);
+ node->semicolonToken = loc(3);
+ sym(1).Node = node;
+} break;
+./
+
+TryStatement: T_TRY Block Catch ;
+/.
+case $rule_number: {
+ AST::TryStatement *node = makeAstNode<AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Catch);
+ node->tryToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+TryStatement: T_TRY Block Finally ;
+/.
+case $rule_number: {
+ AST::TryStatement *node = makeAstNode<AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Finally);
+ node->tryToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+TryStatement: T_TRY Block Catch Finally ;
+/.
+case $rule_number: {
+ AST::TryStatement *node = makeAstNode<AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Catch, sym(4).Finally);
+ node->tryToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+Catch: T_CATCH T_LPAREN T_IDENTIFIER T_RPAREN Block ;
+/.
+case $rule_number: {
+ AST::Catch *node = makeAstNode<AST::Catch> (driver->nodePool(), sym(3).sval, sym(5).Block);
+ node->catchToken = loc(1);
+ node->lparenToken = loc(2);
+ node->identifierToken = loc(3);
+ node->rparenToken = loc(4);
+ sym(1).Node = node;
+} break;
+./
+
+Finally: T_FINALLY Block ;
+/.
+case $rule_number: {
+ AST::Finally *node = makeAstNode<AST::Finally> (driver->nodePool(), sym(2).Block);
+ node->finallyToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+DebuggerStatement: T_DEBUGGER T_AUTOMATIC_SEMICOLON ; -- automatic semicolon
+DebuggerStatement: T_DEBUGGER T_SEMICOLON ;
+/.
+case $rule_number: {
+ AST::DebuggerStatement *node = makeAstNode<AST::DebuggerStatement> (driver->nodePool());
+ node->debuggerToken = loc(1);
+ node->semicolonToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+FunctionDeclaration: T_FUNCTION T_IDENTIFIER T_LPAREN FormalParameterListOpt T_RPAREN T_LBRACE FunctionBodyOpt T_RBRACE ;
+/.
+case $rule_number: {
+ AST::FunctionDeclaration *node = makeAstNode<AST::FunctionDeclaration> (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody);
+ node->functionToken = loc(1);
+ node->identifierToken = loc(2);
+ node->lparenToken = loc(3);
+ node->rparenToken = loc(5);
+ node->lbraceToken = loc(6);
+ node->rbraceToken = loc(8);
+ sym(1).Node = node;
+} break;
+./
+
+FunctionExpression: T_FUNCTION IdentifierOpt T_LPAREN FormalParameterListOpt T_RPAREN T_LBRACE FunctionBodyOpt T_RBRACE ;
+/.
+case $rule_number: {
+ AST::FunctionExpression *node = makeAstNode<AST::FunctionExpression> (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody);
+ node->functionToken = loc(1);
+ if (sym(2).sval)
+ node->identifierToken = loc(2);
+ node->lparenToken = loc(3);
+ node->rparenToken = loc(5);
+ node->lbraceToken = loc(6);
+ node->rbraceToken = loc(8);
+ sym(1).Node = node;
+} break;
+./
+
+FormalParameterList: T_IDENTIFIER ;
+/.
+case $rule_number: {
+ AST::FormalParameterList *node = makeAstNode<AST::FormalParameterList> (driver->nodePool(), sym(1).sval);
+ node->identifierToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+FormalParameterList: FormalParameterList T_COMMA T_IDENTIFIER ;
+/.
+case $rule_number: {
+ AST::FormalParameterList *node = makeAstNode<AST::FormalParameterList> (driver->nodePool(), sym(1).FormalParameterList, sym(3).sval);
+ node->commaToken = loc(2);
+ node->identifierToken = loc(3);
+ sym(1).Node = node;
+} break;
+./
+
+FormalParameterListOpt: ;
+/.
+case $rule_number: {
+ sym(1).Node = 0;
+} break;
+./
+
+FormalParameterListOpt: FormalParameterList ;
+/.
+case $rule_number: {
+ sym(1).Node = sym(1).FormalParameterList->finish ();
+} break;
+./
+
+FunctionBodyOpt: ;
+/.
+case $rule_number: {
+ sym(1).Node = 0;
+} break;
+./
+
+FunctionBodyOpt: FunctionBody ;
+
+FunctionBody: SourceElements ;
+/.
+case $rule_number: {
+ sym(1).Node = makeAstNode<AST::FunctionBody> (driver->nodePool(), sym(1).SourceElements->finish ());
+} break;
+./
+
+--JavaScriptProgram: SourceElements ;
+--/.
+--case $rule_number: {
+-- sym(1).Node = makeAstNode<AST::Program> (driver->nodePool(), sym(1).SourceElements->finish ());
+-- driver->changeAbstractSyntaxTree(sym(1).Node);
+--} break;
+--./
+
+SourceElements: SourceElement ;
+/.
+case $rule_number: {
+ sym(1).Node = makeAstNode<AST::SourceElements> (driver->nodePool(), sym(1).SourceElement);
+} break;
+./
+
+SourceElements: SourceElements SourceElement ;
+/.
+case $rule_number: {
+ sym(1).Node = makeAstNode<AST::SourceElements> (driver->nodePool(), sym(1).SourceElements, sym(2).SourceElement);
+} break;
+./
+
+SourceElement: Statement ;
+/.
+case $rule_number: {
+ sym(1).Node = makeAstNode<AST::StatementSourceElement> (driver->nodePool(), sym(1).Statement);
+} break;
+./
+
+SourceElement: FunctionDeclaration ;
+/.
+case $rule_number: {
+ sym(1).Node = makeAstNode<AST::FunctionSourceElement> (driver->nodePool(), sym(1).FunctionDeclaration);
+} break;
+./
+
+IdentifierOpt: ;
+/.
+case $rule_number: {
+ sym(1).sval = 0;
+} break;
+./
+
+IdentifierOpt: T_IDENTIFIER ;
+
+PropertyNameAndValueListOpt: ;
+/.
+case $rule_number: {
+ sym(1).Node = 0;
+} break;
+./
+
+PropertyNameAndValueListOpt: PropertyNameAndValueList ;
+
+/.
+ } // switch
+ action = nt_action(state_stack[tos], lhs[r] - TERMINAL_COUNT);
+ } // if
+ } while (action != 0);
+
+ if (first_token == last_token) {
+ const int errorState = state_stack[tos];
+
+ // automatic insertion of `;'
+ if (t_action(errorState, T_AUTOMATIC_SEMICOLON) && automatic(driver, yytoken)) {
+ SavedToken &tk = token_buffer[0];
+ tk.token = yytoken;
+ tk.dval = yylval;
+ tk.loc = yylloc;
+
+ yylloc.length = 0;
+
+ const QString msg = QString::fromUtf8("Missing `;'");
+
+ diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning,
+ yyprevlloc.startLine, yyprevlloc.startColumn, msg));
+
+ first_token = &token_buffer[0];
+ last_token = &token_buffer[1];
+
+ yytoken = T_SEMICOLON;
+ yylval = 0;
+
+ action = errorState;
+
+ goto _Lcheck_token;
+ }
+
+ hadErrors = true;
+
+ token_buffer[0].token = yytoken;
+ token_buffer[0].dval = yylval;
+ token_buffer[0].loc = yylloc;
+
+ token_buffer[1].token = yytoken = lexer->lex();
+ token_buffer[1].dval = yylval = lexer->dval();
+ token_buffer[1].loc = yylloc = location(lexer);
+
+ if (t_action(errorState, yytoken)) {
+ const QString msg = QString::fromUtf8("Unexpected token `%1'").arg(QLatin1String(spell[token_buffer[0].token]));
+
+ diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error,
+ token_buffer[0].loc.startLine, token_buffer[0].loc.startColumn, msg));
+
+ action = errorState;
+ goto _Lcheck_token;
+ }
+
+ static int tokens[] = {
+ T_PLUS,
+ T_EQ,
+
+ T_COMMA,
+ T_COLON,
+ T_SEMICOLON,
+
+ T_RPAREN, T_RBRACKET, T_RBRACE,
+
+ T_NUMERIC_LITERAL,
+ T_IDENTIFIER,
+
+ T_LPAREN, T_LBRACKET, T_LBRACE,
+
+ EOF_SYMBOL
+ };
+
+ for (int *tk = tokens; *tk != EOF_SYMBOL; ++tk) {
+ int a = t_action(errorState, *tk);
+ if (a > 0 && t_action(a, yytoken)) {
+ const QString msg = QString::fromUtf8("Expected token `%1'").arg(QLatin1String(spell[*tk]));
+
+ diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error,
+ token_buffer[0].loc.startLine, token_buffer[0].loc.startColumn, msg));
+
+ yytoken = *tk;
+ yylval = 0;
+ yylloc = token_buffer[0].loc;
+
+ first_token = &token_buffer[0];
+ last_token = &token_buffer[2];
+
+ action = errorState;
+ goto _Lcheck_token;
+ }
+ }
+
+ for (int tk = 1; tk < TERMINAL_COUNT; ++tk) {
+ if (tk == T_AUTOMATIC_SEMICOLON)
+ continue;
+
+ int a = t_action(errorState, tk);
+ if (a > 0 && t_action(a, yytoken)) {
+ const QString msg = QString::fromUtf8("Expected token `%1'").arg(QLatin1String(spell[tk]));
+ diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error,
+ token_buffer[0].loc.startLine, token_buffer[0].loc.startColumn, msg));
+
+ yytoken = tk;
+ yylval = 0;
+ yylloc = token_buffer[0].loc;
+
+ action = errorState;
+ goto _Lcheck_token;
+ }
+ }
+
+ const QString msg = QString::fromUtf8("Syntax error");
+ diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error,
+ token_buffer[0].loc.startLine, token_buffer[0].loc.startColumn, msg));
+ }
+
+ return false;
+}
+
+QT_END_NAMESPACE
+
+
+./
+/:
+QT_END_NAMESPACE
+
+
+
+#endif // JAVASCRIPTPARSER_P_H
+:/
diff --git a/src/declarative/qml/parser/javascriptast.cpp b/src/declarative/qml/parser/javascriptast.cpp
new file mode 100644
index 0000000..8a10650
--- /dev/null
+++ b/src/declarative/qml/parser/javascriptast.cpp
@@ -0,0 +1,912 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtScript module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "javascriptast_p.h"
+
+
+
+#include "javascriptastvisitor_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace JavaScript { namespace AST {
+
+ExpressionNode *Node::expressionCast()
+{
+ return 0;
+}
+
+BinaryExpression *Node::binaryExpressionCast()
+{
+ return 0;
+}
+
+Statement *Node::statementCast()
+{
+ return 0;
+}
+
+ExpressionNode *ExpressionNode::expressionCast()
+{
+ return this;
+}
+
+BinaryExpression *BinaryExpression::binaryExpressionCast()
+{
+ return this;
+}
+
+Statement *Statement::statementCast()
+{
+ return this;
+}
+
+void NestedExpression::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(expression, visitor);
+ }
+ visitor->endVisit(this);
+}
+
+void ThisExpression::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ }
+
+ visitor->endVisit(this);
+}
+
+void IdentifierExpression::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ }
+
+ visitor->endVisit(this);
+}
+
+void NullExpression::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ }
+
+ visitor->endVisit(this);
+}
+
+void TrueLiteral::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ }
+
+ visitor->endVisit(this);
+}
+
+void FalseLiteral::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ }
+
+ visitor->endVisit(this);
+}
+
+void StringLiteral::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ }
+
+ visitor->endVisit(this);
+}
+
+void NumericLiteral::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ }
+
+ visitor->endVisit(this);
+}
+
+void RegExpLiteral::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ }
+
+ visitor->endVisit(this);
+}
+
+void ArrayLiteral::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(elements, visitor);
+ acceptChild(elision, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void ObjectLiteral::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(properties, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void ElementList::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ ElementList *it = this;
+ do {
+ acceptChild(it->elision, visitor);
+ acceptChild(it->expression, visitor);
+ it = it->next;
+ } while (it);
+ }
+
+ visitor->endVisit(this);
+}
+
+void Elision::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ // ###
+ }
+
+ visitor->endVisit(this);
+}
+
+void PropertyNameAndValueList::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ PropertyNameAndValueList *it = this;
+ do {
+ acceptChild(it->name, visitor);
+ acceptChild(it->value, visitor);
+ it = it->next;
+ } while (it);
+ }
+
+ visitor->endVisit(this);
+}
+
+void IdentifierPropertyName::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ }
+
+ visitor->endVisit(this);
+}
+
+void StringLiteralPropertyName::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ }
+
+ visitor->endVisit(this);
+}
+
+void NumericLiteralPropertyName::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ }
+
+ visitor->endVisit(this);
+}
+
+void ArrayMemberExpression::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(base, visitor);
+ acceptChild(expression, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void FieldMemberExpression::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(base, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void NewMemberExpression::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(base, visitor);
+ acceptChild(arguments, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void NewExpression::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(expression, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void CallExpression::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(base, visitor);
+ acceptChild(arguments, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void ArgumentList::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ ArgumentList *it = this;
+ do {
+ acceptChild(it->expression, visitor);
+ it = it->next;
+ } while (it);
+ }
+
+ visitor->endVisit(this);
+}
+
+void PostIncrementExpression::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(base, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void PostDecrementExpression::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(base, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void DeleteExpression::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(expression, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void VoidExpression::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(expression, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void TypeOfExpression::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(expression, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void PreIncrementExpression::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(expression, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void PreDecrementExpression::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(expression, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void UnaryPlusExpression::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(expression, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void UnaryMinusExpression::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(expression, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void TildeExpression::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(expression, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void NotExpression::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(expression, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void BinaryExpression::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(left, visitor);
+ acceptChild(right, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void ConditionalExpression::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(expression, visitor);
+ acceptChild(ok, visitor);
+ acceptChild(ko, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void Expression::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(left, visitor);
+ acceptChild(right, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void Block::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(statements, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void StatementList::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ StatementList *it = this;
+ do {
+ acceptChild(it->statement, visitor);
+ it = it->next;
+ } while (it);
+ }
+
+ visitor->endVisit(this);
+}
+
+void VariableStatement::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(declarations, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void VariableDeclarationList::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ VariableDeclarationList *it = this;
+ do {
+ acceptChild(it->declaration, visitor);
+ it = it->next;
+ } while (it);
+ }
+
+ visitor->endVisit(this);
+}
+
+void VariableDeclaration::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(expression, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void EmptyStatement::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ }
+
+ visitor->endVisit(this);
+}
+
+void ExpressionStatement::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(expression, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void IfStatement::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(expression, visitor);
+ acceptChild(ok, visitor);
+ acceptChild(ko, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void DoWhileStatement::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(statement, visitor);
+ acceptChild(expression, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void WhileStatement::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(expression, visitor);
+ acceptChild(statement, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void ForStatement::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(initialiser, visitor);
+ acceptChild(condition, visitor);
+ acceptChild(expression, visitor);
+ acceptChild(statement, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void LocalForStatement::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(declarations, visitor);
+ acceptChild(condition, visitor);
+ acceptChild(expression, visitor);
+ acceptChild(statement, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void ForEachStatement::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(initialiser, visitor);
+ acceptChild(expression, visitor);
+ acceptChild(statement, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void LocalForEachStatement::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(declaration, visitor);
+ acceptChild(expression, visitor);
+ acceptChild(statement, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void ContinueStatement::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ }
+
+ visitor->endVisit(this);
+}
+
+void BreakStatement::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ }
+
+ visitor->endVisit(this);
+}
+
+void ReturnStatement::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(expression, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void WithStatement::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(expression, visitor);
+ acceptChild(statement, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void SwitchStatement::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(expression, visitor);
+ acceptChild(block, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void CaseBlock::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(clauses, visitor);
+ acceptChild(defaultClause, visitor);
+ acceptChild(moreClauses, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void CaseClauses::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ CaseClauses *it = this;
+ do {
+ acceptChild(it->clause, visitor);
+ it = it->next;
+ } while (it);
+ }
+
+ visitor->endVisit(this);
+}
+
+void CaseClause::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(expression, visitor);
+ acceptChild(statements, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void DefaultClause::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(statements, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void LabelledStatement::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(statement, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void ThrowStatement::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(expression, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void TryStatement::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(statement, visitor);
+ acceptChild(catchExpression, visitor);
+ acceptChild(finallyExpression, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void Catch::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(statement, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void Finally::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(statement, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void FunctionDeclaration::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(formals, visitor);
+ acceptChild(body, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void FunctionExpression::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(formals, visitor);
+ acceptChild(body, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void FormalParameterList::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ // ###
+ }
+
+ visitor->endVisit(this);
+}
+
+void FunctionBody::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(elements, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void Program::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(elements, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void SourceElements::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ SourceElements *it = this;
+ do {
+ acceptChild(it->element, visitor);
+ it = it->next;
+ } while (it);
+ }
+
+ visitor->endVisit(this);
+}
+
+void FunctionSourceElement::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(declaration, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void StatementSourceElement::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(statement, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void DebuggerStatement::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ }
+
+ visitor->endVisit(this);
+}
+
+
+void UiProgram::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ for (UiObjectMemberList *it = members; it; it = it->next)
+ acceptChild(it->member, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void UiPublicMember::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(expression, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void UiObjectDefinition::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(initializer, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void UiObjectInitializer::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ for (UiObjectMemberList *it = members; it; it = it->next)
+ acceptChild(it->member, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void UiObjectBinding::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(qualifiedId, visitor);
+ acceptChild(initializer, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void UiScriptBinding::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(qualifiedId, visitor);
+ acceptChild(statement, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void UiArrayBinding::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(qualifiedId, visitor);
+ for (UiObjectMemberList *it = members; it; it = it->next)
+ acceptChild(it->member, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void UiObjectMemberList::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ for (UiObjectMemberList *it = this; it; it = it->next)
+ acceptChild(it->member, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void UiQualifiedId::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ }
+
+ visitor->endVisit(this);
+}
+
+void UiImport::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ }
+
+ visitor->endVisit(this);
+}
+
+void UiImportList::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(import, visitor);
+ acceptChild(next, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void UiSourceElement::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ acceptChild(sourceElement, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+} } // namespace JavaScript::AST
+
+QT_END_NAMESPACE
+
+
diff --git a/src/declarative/qml/parser/javascriptast_p.h b/src/declarative/qml/parser/javascriptast_p.h
new file mode 100644
index 0000000..69958e5
--- /dev/null
+++ b/src/declarative/qml/parser/javascriptast_p.h
@@ -0,0 +1,2445 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtScript module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef JAVASCRIPTAST_P_H
+#define JAVASCRIPTAST_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/QString>
+
+
+
+#include "javascriptastvisitor_p.h"
+
+QT_BEGIN_NAMESPACE
+
+#define JAVASCRIPT_DECLARE_AST_NODE(name) \
+ enum { K = Kind_##name };
+
+class JavaScriptNameIdImpl;
+
+namespace QSOperator // ### rename
+{
+
+enum Op {
+ Add,
+ And,
+ InplaceAnd,
+ Assign,
+ BitAnd,
+ BitOr,
+ BitXor,
+ InplaceSub,
+ Div,
+ InplaceDiv,
+ Equal,
+ Ge,
+ Gt,
+ In,
+ InplaceAdd,
+ InstanceOf,
+ Le,
+ LShift,
+ InplaceLeftShift,
+ Lt,
+ Mod,
+ InplaceMod,
+ Mul,
+ InplaceMul,
+ NotEqual,
+ Or,
+ InplaceOr,
+ RShift,
+ InplaceRightShift,
+ StrictEqual,
+ StrictNotEqual,
+ Sub,
+ URShift,
+ InplaceURightShift,
+ InplaceXor
+};
+
+} // namespace QSOperator
+
+namespace JavaScript { namespace AST {
+
+template <typename _T1, typename _T2>
+_T1 cast(_T2 *ast)
+{
+ if (ast && ast->kind == static_cast<_T1>(0)->K)
+ return static_cast<_T1>(ast);
+
+ return 0;
+}
+
+class SourceLocation
+{
+public:
+ SourceLocation(quint32 offset = 0, quint32 length = 0)
+ : offset(offset), length(length),
+ startLine(0), startColumn(0)
+ { }
+
+// attributes
+ // ### encode
+ quint32 offset;
+ quint32 length;
+ quint32 startLine;
+ quint32 startColumn;
+};
+
+class Node
+{
+public:
+ enum Kind {
+ Kind_Undefined,
+
+ Kind_ArgumentList,
+ Kind_ArrayLiteral,
+ Kind_ArrayMemberExpression,
+ Kind_BinaryExpression,
+ Kind_Block,
+ Kind_BreakStatement,
+ Kind_CallExpression,
+ Kind_CaseBlock,
+ Kind_CaseClause,
+ Kind_CaseClauses,
+ Kind_Catch,
+ Kind_ConditionalExpression,
+ Kind_ContinueStatement,
+ Kind_DebuggerStatement,
+ Kind_DefaultClause,
+ Kind_DeleteExpression,
+ Kind_DoWhileStatement,
+ Kind_ElementList,
+ Kind_Elision,
+ Kind_EmptyStatement,
+ Kind_Expression,
+ Kind_ExpressionStatement,
+ Kind_FalseLiteral,
+ Kind_FieldMemberExpression,
+ Kind_Finally,
+ Kind_ForEachStatement,
+ Kind_ForStatement,
+ Kind_FormalParameterList,
+ Kind_FunctionBody,
+ Kind_FunctionDeclaration,
+ Kind_FunctionExpression,
+ Kind_FunctionSourceElement,
+ Kind_IdentifierExpression,
+ Kind_IdentifierPropertyName,
+ Kind_IfStatement,
+ Kind_LabelledStatement,
+ Kind_LocalForEachStatement,
+ Kind_LocalForStatement,
+ Kind_NewExpression,
+ Kind_NewMemberExpression,
+ Kind_NotExpression,
+ Kind_NullExpression,
+ Kind_NumericLiteral,
+ Kind_NumericLiteralPropertyName,
+ Kind_ObjectLiteral,
+ Kind_PostDecrementExpression,
+ Kind_PostIncrementExpression,
+ Kind_PreDecrementExpression,
+ Kind_PreIncrementExpression,
+ Kind_Program,
+ Kind_PropertyName,
+ Kind_PropertyNameAndValueList,
+ Kind_RegExpLiteral,
+ Kind_ReturnStatement,
+ Kind_SourceElement,
+ Kind_SourceElements,
+ Kind_StatementList,
+ Kind_StatementSourceElement,
+ Kind_StringLiteral,
+ Kind_StringLiteralPropertyName,
+ Kind_SwitchStatement,
+ Kind_ThisExpression,
+ Kind_ThrowStatement,
+ Kind_TildeExpression,
+ Kind_TrueLiteral,
+ Kind_TryStatement,
+ Kind_TypeOfExpression,
+ Kind_UnaryMinusExpression,
+ Kind_UnaryPlusExpression,
+ Kind_VariableDeclaration,
+ Kind_VariableDeclarationList,
+ Kind_VariableStatement,
+ Kind_VoidExpression,
+ Kind_WhileStatement,
+ Kind_WithStatement,
+ Kind_NestedExpression,
+
+ Kind_UiArrayBinding,
+ Kind_UiImport,
+ Kind_UiImportList,
+ Kind_UiObjectBinding,
+ Kind_UiObjectDefinition,
+ Kind_UiObjectInitializer,
+ Kind_UiObjectMemberList,
+ Kind_UiProgram,
+ Kind_UiPublicMember,
+ Kind_UiQualifiedId,
+ Kind_UiScriptBinding,
+ Kind_UiSourceElement
+ };
+
+ inline Node()
+ : kind(Kind_Undefined) {}
+
+ virtual ~Node() {}
+
+ virtual ExpressionNode *expressionCast();
+ virtual BinaryExpression *binaryExpressionCast();
+ virtual Statement *statementCast();
+
+ inline void accept(Visitor *visitor)
+ {
+ if (visitor->preVisit(this)) {
+ accept0(visitor);
+ visitor->postVisit(this);
+ }
+ }
+
+ static void acceptChild(Node *node, Visitor *visitor)
+ {
+ if (node)
+ node->accept(visitor);
+ }
+
+ virtual void accept0(Visitor *visitor) = 0;
+
+// attributes
+ int kind;
+};
+
+class ExpressionNode: public Node
+{
+public:
+ ExpressionNode() {}
+ virtual ~ExpressionNode() {}
+
+ virtual ExpressionNode *expressionCast();
+
+ virtual SourceLocation firstSourceLocation() const = 0;
+ virtual SourceLocation lastSourceLocation() const = 0;
+};
+
+class Statement: public Node
+{
+public:
+ Statement() {}
+ virtual ~Statement() {}
+
+ virtual Statement *statementCast();
+
+ virtual SourceLocation firstSourceLocation() const = 0;
+ virtual SourceLocation lastSourceLocation() const = 0;
+};
+
+class NestedExpression: public ExpressionNode
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(NestedExpression)
+
+ NestedExpression(ExpressionNode *expression)
+ : expression(expression)
+ { kind = K; }
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return lparenToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return rparenToken; }
+
+// attributes
+ ExpressionNode *expression;
+ SourceLocation lparenToken;
+ SourceLocation rparenToken;
+};
+
+class ThisExpression: public ExpressionNode
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(ThisExpression)
+
+ ThisExpression() { kind = K; }
+ virtual ~ThisExpression() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return thisToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return thisToken; }
+
+// attributes
+ SourceLocation thisToken;
+};
+
+class IdentifierExpression: public ExpressionNode
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(IdentifierExpression)
+
+ IdentifierExpression(JavaScriptNameIdImpl *n):
+ name (n) { kind = K; }
+
+ virtual ~IdentifierExpression() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return identifierToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return identifierToken; }
+
+// attributes
+ JavaScriptNameIdImpl *name;
+ SourceLocation identifierToken;
+};
+
+class NullExpression: public ExpressionNode
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(NullExpression)
+
+ NullExpression() { kind = K; }
+ virtual ~NullExpression() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return nullToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return nullToken; }
+
+// attributes
+ SourceLocation nullToken;
+};
+
+class TrueLiteral: public ExpressionNode
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(TrueLiteral)
+
+ TrueLiteral() { kind = K; }
+ virtual ~TrueLiteral() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return trueToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return trueToken; }
+
+// attributes
+ SourceLocation trueToken;
+};
+
+class FalseLiteral: public ExpressionNode
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(FalseLiteral)
+
+ FalseLiteral() { kind = K; }
+ virtual ~FalseLiteral() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return falseToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return falseToken; }
+
+// attributes
+ SourceLocation falseToken;
+};
+
+class NumericLiteral: public ExpressionNode
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(NumericLiteral)
+
+ NumericLiteral(double v):
+ value (v) { kind = K; }
+ virtual ~NumericLiteral() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return literalToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return literalToken; }
+
+// attributes:
+ double value;
+ SourceLocation literalToken;
+};
+
+class StringLiteral: public ExpressionNode
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(StringLiteral)
+
+ StringLiteral(JavaScriptNameIdImpl *v):
+ value (v) { kind = K; }
+
+ virtual ~StringLiteral() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return literalToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return literalToken; }
+
+// attributes:
+ JavaScriptNameIdImpl *value;
+ SourceLocation literalToken;
+};
+
+class RegExpLiteral: public ExpressionNode
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(RegExpLiteral)
+
+ RegExpLiteral(JavaScriptNameIdImpl *p, int f):
+ pattern (p), flags (f) { kind = K; }
+
+ virtual ~RegExpLiteral() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return literalToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return literalToken; }
+
+// attributes:
+ JavaScriptNameIdImpl *pattern;
+ int flags;
+ SourceLocation literalToken;
+};
+
+class ArrayLiteral: public ExpressionNode
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(ArrayLiteral)
+
+ ArrayLiteral(Elision *e):
+ elements (0), elision (e)
+ { kind = K; }
+
+ ArrayLiteral(ElementList *elts):
+ elements (elts), elision (0)
+ { kind = K; }
+
+ ArrayLiteral(ElementList *elts, Elision *e):
+ elements (elts), elision (e)
+ { kind = K; }
+
+ virtual ~ArrayLiteral() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return lbracketToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return rbracketToken; }
+
+// attributes
+ ElementList *elements;
+ Elision *elision;
+ SourceLocation lbracketToken;
+ SourceLocation commaToken;
+ SourceLocation rbracketToken;
+};
+
+class ObjectLiteral: public ExpressionNode
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(ObjectLiteral)
+
+ ObjectLiteral():
+ properties (0) { kind = K; }
+
+ ObjectLiteral(PropertyNameAndValueList *plist):
+ properties (plist) { kind = K; }
+
+ virtual ~ObjectLiteral() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return lbraceToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return rbraceToken; }
+
+// attributes
+ PropertyNameAndValueList *properties;
+ SourceLocation lbraceToken;
+ SourceLocation rbraceToken;
+};
+
+class ElementList: public Node
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(ElementList)
+
+ ElementList(Elision *e, ExpressionNode *expr):
+ elision (e), expression (expr), next (this)
+ { kind = K; }
+
+ ElementList(ElementList *previous, Elision *e, ExpressionNode *expr):
+ elision (e), expression (expr)
+ {
+ kind = K;
+ next = previous->next;
+ previous->next = this;
+ }
+
+ virtual ~ElementList() {}
+
+ inline ElementList *finish ()
+ {
+ ElementList *front = next;
+ next = 0;
+ return front;
+ }
+
+ virtual void accept0(Visitor *visitor);
+
+// attributes
+ Elision *elision;
+ ExpressionNode *expression;
+ ElementList *next;
+ SourceLocation commaToken;
+};
+
+class Elision: public Node
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(Elision)
+
+ Elision():
+ next (this) { kind = K; }
+
+ Elision(Elision *previous)
+ {
+ kind = K;
+ next = previous->next;
+ previous->next = this;
+ }
+
+ virtual ~Elision() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ inline Elision *finish ()
+ {
+ Elision *front = next;
+ next = 0;
+ return front;
+ }
+
+// attributes
+ Elision *next;
+ SourceLocation commaToken;
+};
+
+class PropertyNameAndValueList: public Node
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(PropertyNameAndValueList)
+
+ PropertyNameAndValueList(PropertyName *n, ExpressionNode *v):
+ name (n), value (v), next (this)
+ { kind = K; }
+
+ PropertyNameAndValueList(PropertyNameAndValueList *previous, PropertyName *n, ExpressionNode *v):
+ name (n), value (v)
+ {
+ kind = K;
+ next = previous->next;
+ previous->next = this;
+ }
+
+ virtual ~PropertyNameAndValueList() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ inline PropertyNameAndValueList *finish ()
+ {
+ PropertyNameAndValueList *front = next;
+ next = 0;
+ return front;
+ }
+
+// attributes
+ PropertyName *name;
+ ExpressionNode *value;
+ PropertyNameAndValueList *next;
+ SourceLocation colonToken;
+ SourceLocation commaToken;
+};
+
+class PropertyName: public Node
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(PropertyName)
+
+ PropertyName() { kind = K; }
+ virtual ~PropertyName() {}
+
+// attributes
+ SourceLocation propertyNameToken;
+};
+
+class IdentifierPropertyName: public PropertyName
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(IdentifierPropertyName)
+
+ IdentifierPropertyName(JavaScriptNameIdImpl *n):
+ id (n) { kind = K; }
+
+ virtual ~IdentifierPropertyName() {}
+
+ virtual void accept0(Visitor *visitor);
+
+// attributes
+ JavaScriptNameIdImpl *id;
+};
+
+class StringLiteralPropertyName: public PropertyName
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(StringLiteralPropertyName)
+
+ StringLiteralPropertyName(JavaScriptNameIdImpl *n):
+ id (n) { kind = K; }
+ virtual ~StringLiteralPropertyName() {}
+
+ virtual void accept0(Visitor *visitor);
+
+// attributes
+ JavaScriptNameIdImpl *id;
+};
+
+class NumericLiteralPropertyName: public PropertyName
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(NumericLiteralPropertyName)
+
+ NumericLiteralPropertyName(double n):
+ id (n) { kind = K; }
+ virtual ~NumericLiteralPropertyName() {}
+
+ virtual void accept0(Visitor *visitor);
+
+// attributes
+ double id;
+};
+
+class ArrayMemberExpression: public ExpressionNode
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(ArrayMemberExpression)
+
+ ArrayMemberExpression(ExpressionNode *b, ExpressionNode *e):
+ base (b), expression (e)
+ { kind = K; }
+
+ virtual ~ArrayMemberExpression() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return base->firstSourceLocation(); }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return rbracketToken; }
+
+// attributes
+ ExpressionNode *base;
+ ExpressionNode *expression;
+ SourceLocation lbracketToken;
+ SourceLocation rbracketToken;
+};
+
+class FieldMemberExpression: public ExpressionNode
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(FieldMemberExpression)
+
+ FieldMemberExpression(ExpressionNode *b, JavaScriptNameIdImpl *n):
+ base (b), name (n)
+ { kind = K; }
+
+ virtual ~FieldMemberExpression() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return base->firstSourceLocation(); }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return identifierToken; }
+
+ // attributes
+ ExpressionNode *base;
+ JavaScriptNameIdImpl *name;
+ SourceLocation dotToken;
+ SourceLocation identifierToken;
+};
+
+class NewMemberExpression: public ExpressionNode
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(NewMemberExpression)
+
+ NewMemberExpression(ExpressionNode *b, ArgumentList *a):
+ base (b), arguments (a)
+ { kind = K; }
+
+ virtual ~NewMemberExpression() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return newToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return rparenToken; }
+
+ // attributes
+ ExpressionNode *base;
+ ArgumentList *arguments;
+ SourceLocation newToken;
+ SourceLocation lparenToken;
+ SourceLocation rparenToken;
+};
+
+class NewExpression: public ExpressionNode
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(NewExpression)
+
+ NewExpression(ExpressionNode *e):
+ expression (e) { kind = K; }
+
+ virtual ~NewExpression() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return newToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return expression->lastSourceLocation(); }
+
+// attributes
+ ExpressionNode *expression;
+ SourceLocation newToken;
+};
+
+class CallExpression: public ExpressionNode
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(CallExpression)
+
+ CallExpression(ExpressionNode *b, ArgumentList *a):
+ base (b), arguments (a)
+ { kind = K; }
+
+ virtual ~CallExpression() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return base->firstSourceLocation(); }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return rparenToken; }
+
+// attributes
+ ExpressionNode *base;
+ ArgumentList *arguments;
+ SourceLocation lparenToken;
+ SourceLocation rparenToken;
+};
+
+class ArgumentList: public Node
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(ArgumentList)
+
+ ArgumentList(ExpressionNode *e):
+ expression (e), next (this)
+ { kind = K; }
+
+ ArgumentList(ArgumentList *previous, ExpressionNode *e):
+ expression (e)
+ {
+ kind = K;
+ next = previous->next;
+ previous->next = this;
+ }
+
+ virtual ~ArgumentList() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ inline ArgumentList *finish ()
+ {
+ ArgumentList *front = next;
+ next = 0;
+ return front;
+ }
+
+// attributes
+ ExpressionNode *expression;
+ ArgumentList *next;
+ SourceLocation commaToken;
+};
+
+class PostIncrementExpression: public ExpressionNode
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(PostIncrementExpression)
+
+ PostIncrementExpression(ExpressionNode *b):
+ base (b) { kind = K; }
+
+ virtual ~PostIncrementExpression() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return base->firstSourceLocation(); }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return incrementToken; }
+
+// attributes
+ ExpressionNode *base;
+ SourceLocation incrementToken;
+};
+
+class PostDecrementExpression: public ExpressionNode
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(PostDecrementExpression)
+
+ PostDecrementExpression(ExpressionNode *b):
+ base (b) { kind = K; }
+
+ virtual ~PostDecrementExpression() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return base->firstSourceLocation(); }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return decrementToken; }
+
+// attributes
+ ExpressionNode *base;
+ SourceLocation decrementToken;
+};
+
+class DeleteExpression: public ExpressionNode
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(DeleteExpression)
+
+ DeleteExpression(ExpressionNode *e):
+ expression (e) { kind = K; }
+ virtual ~DeleteExpression() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return deleteToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return expression->lastSourceLocation(); }
+
+// attributes
+ ExpressionNode *expression;
+ SourceLocation deleteToken;
+};
+
+class VoidExpression: public ExpressionNode
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(VoidExpression)
+
+ VoidExpression(ExpressionNode *e):
+ expression (e) { kind = K; }
+
+ virtual ~VoidExpression() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return voidToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return expression->lastSourceLocation(); }
+
+// attributes
+ ExpressionNode *expression;
+ SourceLocation voidToken;
+};
+
+class TypeOfExpression: public ExpressionNode
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(TypeOfExpression)
+
+ TypeOfExpression(ExpressionNode *e):
+ expression (e) { kind = K; }
+
+ virtual ~TypeOfExpression() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return typeofToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return expression->lastSourceLocation(); }
+
+// attributes
+ ExpressionNode *expression;
+ SourceLocation typeofToken;
+};
+
+class PreIncrementExpression: public ExpressionNode
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(PreIncrementExpression)
+
+ PreIncrementExpression(ExpressionNode *e):
+ expression (e) { kind = K; }
+
+ virtual ~PreIncrementExpression() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return incrementToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return expression->lastSourceLocation(); }
+
+// attributes
+ ExpressionNode *expression;
+ SourceLocation incrementToken;
+};
+
+class PreDecrementExpression: public ExpressionNode
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(PreDecrementExpression)
+
+ PreDecrementExpression(ExpressionNode *e):
+ expression (e) { kind = K; }
+
+ virtual ~PreDecrementExpression() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return decrementToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return expression->lastSourceLocation(); }
+
+// attributes
+ ExpressionNode *expression;
+ SourceLocation decrementToken;
+};
+
+class UnaryPlusExpression: public ExpressionNode
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(UnaryPlusExpression)
+
+ UnaryPlusExpression(ExpressionNode *e):
+ expression (e) { kind = K; }
+
+ virtual ~UnaryPlusExpression() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return plusToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return expression->lastSourceLocation(); }
+
+// attributes
+ ExpressionNode *expression;
+ SourceLocation plusToken;
+};
+
+class UnaryMinusExpression: public ExpressionNode
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(UnaryMinusExpression)
+
+ UnaryMinusExpression(ExpressionNode *e):
+ expression (e) { kind = K; }
+
+ virtual ~UnaryMinusExpression() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return minusToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return expression->lastSourceLocation(); }
+
+// attributes
+ ExpressionNode *expression;
+ SourceLocation minusToken;
+};
+
+class TildeExpression: public ExpressionNode
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(TildeExpression)
+
+ TildeExpression(ExpressionNode *e):
+ expression (e) { kind = K; }
+
+ virtual ~TildeExpression() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return tildeToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return expression->lastSourceLocation(); }
+
+// attributes
+ ExpressionNode *expression;
+ SourceLocation tildeToken;
+};
+
+class NotExpression: public ExpressionNode
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(NotExpression)
+
+ NotExpression(ExpressionNode *e):
+ expression (e) { kind = K; }
+
+ virtual ~NotExpression() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return notToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return expression->lastSourceLocation(); }
+
+// attributes
+ ExpressionNode *expression;
+ SourceLocation notToken;
+};
+
+class BinaryExpression: public ExpressionNode
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(BinaryExpression)
+
+ BinaryExpression(ExpressionNode *l, int o, ExpressionNode *r):
+ left (l), op (o), right (r)
+ { kind = K; }
+
+ virtual ~BinaryExpression() {}
+
+ virtual BinaryExpression *binaryExpressionCast();
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return left->firstSourceLocation(); }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return right->lastSourceLocation(); }
+
+// attributes
+ ExpressionNode *left;
+ int op;
+ ExpressionNode *right;
+ SourceLocation operatorToken;
+};
+
+class ConditionalExpression: public ExpressionNode
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(ConditionalExpression)
+
+ ConditionalExpression(ExpressionNode *e, ExpressionNode *t, ExpressionNode *f):
+ expression (e), ok (t), ko (f)
+ { kind = K; }
+
+ virtual ~ConditionalExpression() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return expression->firstSourceLocation(); }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return ko->lastSourceLocation(); }
+
+// attributes
+ ExpressionNode *expression;
+ ExpressionNode *ok;
+ ExpressionNode *ko;
+ SourceLocation questionToken;
+ SourceLocation colonToken;
+};
+
+class Expression: public ExpressionNode // ### rename
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(Expression)
+
+ Expression(ExpressionNode *l, ExpressionNode *r):
+ left (l), right (r) { kind = K; }
+
+ virtual ~Expression() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return left->firstSourceLocation(); }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return right->lastSourceLocation(); }
+
+// attributes
+ ExpressionNode *left;
+ ExpressionNode *right;
+ SourceLocation commaToken;
+};
+
+class Block: public Statement
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(Block)
+
+ Block(StatementList *slist):
+ statements (slist) { kind = K; }
+
+ virtual ~Block() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return lbraceToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return rbraceToken; }
+
+ // attributes
+ StatementList *statements;
+ SourceLocation lbraceToken;
+ SourceLocation rbraceToken;
+};
+
+class StatementList: public Node
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(StatementList)
+
+ StatementList(Statement *stmt):
+ statement (stmt), next (this)
+ { kind = K; }
+
+ StatementList(StatementList *previous, Statement *stmt):
+ statement (stmt)
+ {
+ kind = K;
+ next = previous->next;
+ previous->next = this;
+ }
+
+ virtual ~StatementList() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ inline StatementList *finish ()
+ {
+ StatementList *front = next;
+ next = 0;
+ return front;
+ }
+
+// attributes
+ Statement *statement;
+ StatementList *next;
+};
+
+class VariableStatement: public Statement
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(VariableStatement)
+
+ VariableStatement(VariableDeclarationList *vlist):
+ declarations (vlist)
+ { kind = K; }
+
+ virtual ~VariableStatement() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return declarationKindToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return semicolonToken; }
+
+// attributes
+ VariableDeclarationList *declarations;
+ SourceLocation declarationKindToken;
+ SourceLocation semicolonToken;
+};
+
+class VariableDeclaration: public Node
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(VariableDeclaration)
+
+ VariableDeclaration(JavaScriptNameIdImpl *n, ExpressionNode *e):
+ name (n), expression (e), readOnly(false)
+ { kind = K; }
+
+ virtual ~VariableDeclaration() {}
+
+ virtual void accept0(Visitor *visitor);
+
+// attributes
+ JavaScriptNameIdImpl *name;
+ ExpressionNode *expression;
+ bool readOnly;
+ SourceLocation identifierToken;
+};
+
+class VariableDeclarationList: public Node
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(VariableDeclarationList)
+
+ VariableDeclarationList(VariableDeclaration *decl):
+ declaration (decl), next (this)
+ { kind = K; }
+
+ VariableDeclarationList(VariableDeclarationList *previous, VariableDeclaration *decl):
+ declaration (decl)
+ {
+ kind = K;
+ next = previous->next;
+ previous->next = this;
+ }
+
+ virtual ~VariableDeclarationList() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ inline VariableDeclarationList *finish (bool readOnly)
+ {
+ VariableDeclarationList *front = next;
+ next = 0;
+ if (readOnly) {
+ VariableDeclarationList *vdl;
+ for (vdl = front; vdl != 0; vdl = vdl->next)
+ vdl->declaration->readOnly = true;
+ }
+ return front;
+ }
+
+// attributes
+ VariableDeclaration *declaration;
+ VariableDeclarationList *next;
+ SourceLocation commaToken;
+};
+
+class EmptyStatement: public Statement
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(EmptyStatement)
+
+ EmptyStatement() { kind = K; }
+ virtual ~EmptyStatement() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return semicolonToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return semicolonToken; }
+
+// attributes
+ SourceLocation semicolonToken;
+};
+
+class ExpressionStatement: public Statement
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(ExpressionStatement)
+
+ ExpressionStatement(ExpressionNode *e):
+ expression (e) { kind = K; }
+
+ virtual ~ExpressionStatement() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return expression->firstSourceLocation(); }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return semicolonToken; }
+
+// attributes
+ ExpressionNode *expression;
+ SourceLocation semicolonToken;
+};
+
+class IfStatement: public Statement
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(IfStatement)
+
+ IfStatement(ExpressionNode *e, Statement *t, Statement *f = 0):
+ expression (e), ok (t), ko (f)
+ { kind = K; }
+
+ virtual ~IfStatement() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return ifToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ {
+ if (ko)
+ return ko->lastSourceLocation();
+
+ return ok->lastSourceLocation();
+ }
+
+// attributes
+ ExpressionNode *expression;
+ Statement *ok;
+ Statement *ko;
+ SourceLocation ifToken;
+ SourceLocation lparenToken;
+ SourceLocation rparenToken;
+ SourceLocation elseToken;
+};
+
+class DoWhileStatement: public Statement
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(DoWhileStatement)
+
+ DoWhileStatement(Statement *stmt, ExpressionNode *e):
+ statement (stmt), expression (e)
+ { kind = K; }
+
+ virtual ~DoWhileStatement() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return doToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return semicolonToken; }
+
+// attributes
+ Statement *statement;
+ ExpressionNode *expression;
+ SourceLocation doToken;
+ SourceLocation whileToken;
+ SourceLocation lparenToken;
+ SourceLocation rparenToken;
+ SourceLocation semicolonToken;
+};
+
+class WhileStatement: public Statement
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(WhileStatement)
+
+ WhileStatement(ExpressionNode *e, Statement *stmt):
+ expression (e), statement (stmt)
+ { kind = K; }
+
+ virtual ~WhileStatement() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return whileToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return statement->lastSourceLocation(); }
+
+// attributes
+ ExpressionNode *expression;
+ Statement *statement;
+ SourceLocation whileToken;
+ SourceLocation lparenToken;
+ SourceLocation rparenToken;
+};
+
+class ForStatement: public Statement
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(ForStatement)
+
+ ForStatement(ExpressionNode *i, ExpressionNode *c, ExpressionNode *e, Statement *stmt):
+ initialiser (i), condition (c), expression (e), statement (stmt)
+ { kind = K; }
+
+ virtual ~ForStatement() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return forToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return statement->lastSourceLocation(); }
+
+// attributes
+ ExpressionNode *initialiser;
+ ExpressionNode *condition;
+ ExpressionNode *expression;
+ Statement *statement;
+ SourceLocation forToken;
+ SourceLocation lparenToken;
+ SourceLocation firstSemicolonToken;
+ SourceLocation secondSemicolonToken;
+ SourceLocation rparenToken;
+};
+
+class LocalForStatement: public Statement
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(LocalForStatement)
+
+ LocalForStatement(VariableDeclarationList *vlist, ExpressionNode *c, ExpressionNode *e, Statement *stmt):
+ declarations (vlist), condition (c), expression (e), statement (stmt)
+ { kind = K; }
+
+ virtual ~LocalForStatement() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return forToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return statement->lastSourceLocation(); }
+
+// attributes
+ VariableDeclarationList *declarations;
+ ExpressionNode *condition;
+ ExpressionNode *expression;
+ Statement *statement;
+ SourceLocation forToken;
+ SourceLocation lparenToken;
+ SourceLocation varToken;
+ SourceLocation firstSemicolonToken;
+ SourceLocation secondSemicolonToken;
+ SourceLocation rparenToken;
+};
+
+class ForEachStatement: public Statement
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(ForEachStatement)
+
+ ForEachStatement(ExpressionNode *i, ExpressionNode *e, Statement *stmt):
+ initialiser (i), expression (e), statement (stmt)
+ { kind = K; }
+
+ virtual ~ForEachStatement() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return forToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return statement->lastSourceLocation(); }
+
+// attributes
+ ExpressionNode *initialiser;
+ ExpressionNode *expression;
+ Statement *statement;
+ SourceLocation forToken;
+ SourceLocation lparenToken;
+ SourceLocation inToken;
+ SourceLocation rparenToken;
+};
+
+class LocalForEachStatement: public Statement
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(LocalForEachStatement)
+
+ LocalForEachStatement(VariableDeclaration *v, ExpressionNode *e, Statement *stmt):
+ declaration (v), expression (e), statement (stmt)
+ { kind = K; }
+
+ virtual ~LocalForEachStatement() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return forToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return statement->lastSourceLocation(); }
+
+// attributes
+ VariableDeclaration *declaration;
+ ExpressionNode *expression;
+ Statement *statement;
+ SourceLocation forToken;
+ SourceLocation lparenToken;
+ SourceLocation varToken;
+ SourceLocation inToken;
+ SourceLocation rparenToken;
+};
+
+class ContinueStatement: public Statement
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(ContinueStatement)
+
+ ContinueStatement(JavaScriptNameIdImpl *l = 0):
+ label (l) { kind = K; }
+
+ virtual ~ContinueStatement() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return continueToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return semicolonToken; }
+
+// attributes
+ JavaScriptNameIdImpl *label;
+ SourceLocation continueToken;
+ SourceLocation identifierToken;
+ SourceLocation semicolonToken;
+};
+
+class BreakStatement: public Statement
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(BreakStatement)
+
+ BreakStatement(JavaScriptNameIdImpl *l = 0):
+ label (l) { kind = K; }
+
+ virtual ~BreakStatement() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return breakToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return semicolonToken; }
+
+ // attributes
+ JavaScriptNameIdImpl *label;
+ SourceLocation breakToken;
+ SourceLocation identifierToken;
+ SourceLocation semicolonToken;
+};
+
+class ReturnStatement: public Statement
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(ReturnStatement)
+
+ ReturnStatement(ExpressionNode *e):
+ expression (e) { kind = K; }
+
+ virtual ~ReturnStatement() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return returnToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return semicolonToken; }
+
+// attributes
+ ExpressionNode *expression;
+ SourceLocation returnToken;
+ SourceLocation semicolonToken;
+};
+
+class WithStatement: public Statement
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(WithStatement)
+
+ WithStatement(ExpressionNode *e, Statement *stmt):
+ expression (e), statement (stmt)
+ { kind = K; }
+
+ virtual ~WithStatement() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return withToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return statement->lastSourceLocation(); }
+
+// attributes
+ ExpressionNode *expression;
+ Statement *statement;
+ SourceLocation withToken;
+ SourceLocation lparenToken;
+ SourceLocation rparenToken;
+};
+
+class CaseBlock: public Node
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(CaseBlock)
+
+ CaseBlock(CaseClauses *c, DefaultClause *d = 0, CaseClauses *r = 0):
+ clauses (c), defaultClause (d), moreClauses (r)
+ { kind = K; }
+
+ virtual ~CaseBlock() {}
+
+ virtual void accept0(Visitor *visitor);
+
+// attributes
+ CaseClauses *clauses;
+ DefaultClause *defaultClause;
+ CaseClauses *moreClauses;
+ SourceLocation lbraceToken;
+ SourceLocation rbraceToken;
+};
+
+class SwitchStatement: public Statement
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(SwitchStatement)
+
+ SwitchStatement(ExpressionNode *e, CaseBlock *b):
+ expression (e), block (b)
+ { kind = K; }
+
+ virtual ~SwitchStatement() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return switchToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return block->rbraceToken; }
+
+// attributes
+ ExpressionNode *expression;
+ CaseBlock *block;
+ SourceLocation switchToken;
+ SourceLocation lparenToken;
+ SourceLocation rparenToken;
+};
+
+class CaseClauses: public Node
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(CaseClauses)
+
+ CaseClauses(CaseClause *c):
+ clause (c), next (this)
+ { kind = K; }
+
+ CaseClauses(CaseClauses *previous, CaseClause *c):
+ clause (c)
+ {
+ kind = K;
+ next = previous->next;
+ previous->next = this;
+ }
+
+ virtual ~CaseClauses() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ inline CaseClauses *finish ()
+ {
+ CaseClauses *front = next;
+ next = 0;
+ return front;
+ }
+
+//attributes
+ CaseClause *clause;
+ CaseClauses *next;
+};
+
+class CaseClause: public Node
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(CaseClause)
+
+ CaseClause(ExpressionNode *e, StatementList *slist):
+ expression (e), statements (slist)
+ { kind = K; }
+
+ virtual ~CaseClause() {}
+
+ virtual void accept0(Visitor *visitor);
+
+// attributes
+ ExpressionNode *expression;
+ StatementList *statements;
+ SourceLocation caseToken;
+ SourceLocation colonToken;
+};
+
+class DefaultClause: public Node
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(DefaultClause)
+
+ DefaultClause(StatementList *slist):
+ statements (slist)
+ { kind = K; }
+
+ virtual ~DefaultClause() {}
+
+ virtual void accept0(Visitor *visitor);
+
+// attributes
+ StatementList *statements;
+ SourceLocation defaultToken;
+ SourceLocation colonToken;
+};
+
+class LabelledStatement: public Statement
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(LabelledStatement)
+
+ LabelledStatement(JavaScriptNameIdImpl *l, Statement *stmt):
+ label (l), statement (stmt)
+ { kind = K; }
+
+ virtual ~LabelledStatement() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return identifierToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return statement->lastSourceLocation(); }
+
+// attributes
+ JavaScriptNameIdImpl *label;
+ Statement *statement;
+ SourceLocation identifierToken;
+ SourceLocation colonToken;
+};
+
+class ThrowStatement: public Statement
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(ThrowStatement)
+
+ ThrowStatement(ExpressionNode *e):
+ expression (e) { kind = K; }
+
+ virtual ~ThrowStatement() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return throwToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return semicolonToken; }
+
+ // attributes
+ ExpressionNode *expression;
+ SourceLocation throwToken;
+ SourceLocation semicolonToken;
+};
+
+class Catch: public Node
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(Catch)
+
+ Catch(JavaScriptNameIdImpl *n, Block *stmt):
+ name (n), statement (stmt)
+ { kind = K; }
+
+ virtual ~Catch() {}
+
+ virtual void accept0(Visitor *visitor);
+
+// attributes
+ JavaScriptNameIdImpl *name;
+ Block *statement;
+ SourceLocation catchToken;
+ SourceLocation lparenToken;
+ SourceLocation identifierToken;
+ SourceLocation rparenToken;
+};
+
+class Finally: public Node
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(Finally)
+
+ Finally(Block *stmt):
+ statement (stmt)
+ { kind = K; }
+
+ virtual ~Finally() {}
+
+ virtual void accept0(Visitor *visitor);
+
+// attributes
+ Block *statement;
+ SourceLocation finallyToken;
+};
+
+class TryStatement: public Statement
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(TryStatement)
+
+ TryStatement(Statement *stmt, Catch *c, Finally *f):
+ statement (stmt), catchExpression (c), finallyExpression (f)
+ { kind = K; }
+
+ TryStatement(Statement *stmt, Finally *f):
+ statement (stmt), catchExpression (0), finallyExpression (f)
+ { kind = K; }
+
+ TryStatement(Statement *stmt, Catch *c):
+ statement (stmt), catchExpression (c), finallyExpression (0)
+ { kind = K; }
+
+ virtual ~TryStatement() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return tryToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ {
+ if (finallyExpression)
+ return finallyExpression->statement->rbraceToken;
+ else if (catchExpression)
+ return catchExpression->statement->rbraceToken;
+
+ return statement->lastSourceLocation();
+ }
+
+// attributes
+ Statement *statement;
+ Catch *catchExpression;
+ Finally *finallyExpression;
+ SourceLocation tryToken;
+};
+
+class FunctionExpression: public ExpressionNode
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(FunctionExpression)
+
+ FunctionExpression(JavaScriptNameIdImpl *n, FormalParameterList *f, FunctionBody *b):
+ name (n), formals (f), body (b)
+ { kind = K; }
+
+ virtual ~FunctionExpression() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return functionToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return rbraceToken; }
+
+// attributes
+ JavaScriptNameIdImpl *name;
+ FormalParameterList *formals;
+ FunctionBody *body;
+ SourceLocation functionToken;
+ SourceLocation identifierToken;
+ SourceLocation lparenToken;
+ SourceLocation rparenToken;
+ SourceLocation lbraceToken;
+ SourceLocation rbraceToken;
+};
+
+class FunctionDeclaration: public FunctionExpression
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(FunctionDeclaration)
+
+ FunctionDeclaration(JavaScriptNameIdImpl *n, FormalParameterList *f, FunctionBody *b):
+ FunctionExpression(n, f, b)
+ { kind = K; }
+
+ virtual ~FunctionDeclaration() {}
+
+ virtual void accept0(Visitor *visitor);
+};
+
+class FormalParameterList: public Node
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(FormalParameterList)
+
+ FormalParameterList(JavaScriptNameIdImpl *n):
+ name (n), next (this)
+ { kind = K; }
+
+ FormalParameterList(FormalParameterList *previous, JavaScriptNameIdImpl *n):
+ name (n)
+ {
+ kind = K;
+ next = previous->next;
+ previous->next = this;
+ }
+
+ virtual ~FormalParameterList() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ inline FormalParameterList *finish ()
+ {
+ FormalParameterList *front = next;
+ next = 0;
+ return front;
+ }
+
+// attributes
+ JavaScriptNameIdImpl *name;
+ FormalParameterList *next;
+ SourceLocation commaToken;
+ SourceLocation identifierToken;
+};
+
+class FunctionBody: public Node
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(FunctionBody)
+
+ FunctionBody(SourceElements *elts):
+ elements (elts)
+ { kind = K; }
+
+ virtual ~FunctionBody() {}
+
+ virtual void accept0(Visitor *visitor);
+
+// attributes
+ SourceElements *elements;
+};
+
+class Program: public Node
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(Program)
+
+ Program(SourceElements *elts):
+ elements (elts)
+ { kind = K; }
+
+ virtual ~Program() {}
+
+ virtual void accept0(Visitor *visitor);
+
+// attributes
+ SourceElements *elements;
+};
+
+class SourceElements: public Node
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(SourceElements)
+
+ SourceElements(SourceElement *elt):
+ element (elt), next (this)
+ { kind = K; }
+
+ SourceElements(SourceElements *previous, SourceElement *elt):
+ element (elt)
+ {
+ kind = K;
+ next = previous->next;
+ previous->next = this;
+ }
+
+ virtual ~SourceElements() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ inline SourceElements *finish ()
+ {
+ SourceElements *front = next;
+ next = 0;
+ return front;
+ }
+
+// attributes
+ SourceElement *element;
+ SourceElements *next;
+};
+
+class SourceElement: public Node
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(SourceElement)
+
+ inline SourceElement()
+ { kind = K; }
+
+ virtual ~SourceElement() {}
+};
+
+class FunctionSourceElement: public SourceElement
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(FunctionSourceElement)
+
+ FunctionSourceElement(FunctionDeclaration *f):
+ declaration (f)
+ { kind = K; }
+
+ virtual ~FunctionSourceElement() {}
+
+ virtual void accept0(Visitor *visitor);
+
+// attributes
+ FunctionDeclaration *declaration;
+};
+
+class StatementSourceElement: public SourceElement
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(StatementSourceElement)
+
+ StatementSourceElement(Statement *stmt):
+ statement (stmt)
+ { kind = K; }
+
+ virtual ~StatementSourceElement() {}
+
+ virtual void accept0(Visitor *visitor);
+
+// attributes
+ Statement *statement;
+};
+
+class DebuggerStatement: public Statement
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(DebuggerStatement)
+
+ DebuggerStatement()
+ { kind = K; }
+
+ virtual ~DebuggerStatement() {}
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return debuggerToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return semicolonToken; }
+
+// attributes
+ SourceLocation debuggerToken;
+ SourceLocation semicolonToken;
+};
+
+class UiProgram: public Node
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(UiProgram)
+
+ UiProgram(UiImportList *imports, UiObjectMemberList *members)
+ : imports(imports), members(members)
+ { kind = K; }
+
+ virtual void accept0(Visitor *visitor);
+
+// attributes
+ UiImportList *imports;
+ UiObjectMemberList *members;
+};
+
+class UiImport: public Node
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(UiImport)
+
+ UiImport(JavaScriptNameIdImpl *fileName)
+ : fileName(fileName)
+ { kind = K; }
+
+ virtual void accept0(Visitor *visitor);
+
+// attributes
+ JavaScriptNameIdImpl *fileName;
+ SourceLocation importToken;
+ SourceLocation fileNameToken;
+ SourceLocation semicolonToken;
+};
+
+class UiImportList: public Node
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(UiImportList)
+
+ UiImportList(UiImport *import)
+ : import(import),
+ next(this)
+ { kind = K; }
+
+ UiImportList(UiImportList *previous, UiImport *import)
+ : import(import)
+ {
+ kind = K;
+ next = previous->next;
+ previous->next = this;
+ }
+
+ UiImportList *finish()
+ {
+ UiImportList *head = next;
+ next = 0;
+ return head;
+ }
+
+ virtual void accept0(Visitor *visitor);
+
+// attributes
+ UiImport *import;
+ UiImportList *next;
+};
+
+class UiObjectMember: public Node
+{
+};
+
+class UiPublicMember: public UiObjectMember
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(UiPublicMember)
+
+ UiPublicMember(JavaScriptNameIdImpl *memberType,
+ JavaScriptNameIdImpl *name)
+ : memberType(memberType), name(name), expression(0)
+ { kind = K; }
+
+ UiPublicMember(JavaScriptNameIdImpl *memberType,
+ JavaScriptNameIdImpl *name,
+ ExpressionNode *expression)
+ : memberType(memberType), name(name), expression(expression)
+ { kind = K; }
+
+ virtual void accept0(Visitor *visitor);
+
+// attributes
+ JavaScriptNameIdImpl *memberType;
+ JavaScriptNameIdImpl *name;
+ ExpressionNode *expression;
+ SourceLocation publicToken;
+ SourceLocation attributeTypeToken;
+ SourceLocation identifierToken;
+ SourceLocation colonToken;
+};
+
+class UiObjectDefinition: public UiObjectMember
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(UiObjectDefinition)
+
+ UiObjectDefinition(JavaScriptNameIdImpl *name,
+ UiObjectInitializer *initializer)
+ : name(name), initializer(initializer)
+ { kind = K; }
+
+ virtual void accept0(Visitor *visitor);
+
+// attributes
+ JavaScriptNameIdImpl *name;
+ UiObjectInitializer *initializer;
+ SourceLocation identifierToken;
+};
+
+class UiObjectInitializer: public Node
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(UiObjectInitializer)
+
+ UiObjectInitializer(UiObjectMemberList *members)
+ : members(members)
+ { kind = K; }
+
+ virtual void accept0(Visitor *visitor);
+
+// attributes
+ SourceLocation lbraceToken;
+ UiObjectMemberList *members;
+ SourceLocation rbraceToken;
+};
+
+class UiSourceElement: public UiObjectMember
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(UiSourceElement)
+
+ UiSourceElement(Node *sourceElement)
+ : sourceElement(sourceElement)
+ { kind = K; }
+
+ virtual void accept0(Visitor *visitor);
+
+// attributes
+ Node *sourceElement;
+};
+
+class UiObjectBinding: public UiObjectMember
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(UiObjectBinding)
+
+ UiObjectBinding(UiQualifiedId *qualifiedId,
+ JavaScriptNameIdImpl *name,
+ UiObjectInitializer *initializer)
+ : qualifiedId(qualifiedId),
+ name(name),
+ initializer(initializer)
+ { kind = K; }
+
+ virtual void accept0(Visitor *visitor);
+
+// attributes
+ UiQualifiedId *qualifiedId;
+ JavaScriptNameIdImpl *name;
+ UiObjectInitializer *initializer;
+ SourceLocation colonToken;
+ SourceLocation identifierToken;
+};
+
+class UiScriptBinding: public UiObjectMember
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(UiScriptBinding)
+
+ UiScriptBinding(UiQualifiedId *qualifiedId,
+ Statement *statement)
+ : qualifiedId(qualifiedId),
+ statement(statement)
+ { kind = K; }
+
+ virtual void accept0(Visitor *visitor);
+
+// attributes
+ UiQualifiedId *qualifiedId;
+ Statement *statement;
+ SourceLocation colonToken;
+};
+
+class UiArrayBinding: public UiObjectMember
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(UiArrayBinding)
+
+ UiArrayBinding(UiQualifiedId *qualifiedId,
+ UiObjectMemberList *members)
+ : qualifiedId(qualifiedId),
+ members(members)
+ { kind = K; }
+
+ virtual void accept0(Visitor *visitor);
+
+// attributes
+ UiQualifiedId *qualifiedId;
+ UiObjectMemberList *members;
+ SourceLocation colonToken;
+ SourceLocation lbracketToken;
+ SourceLocation rbraceToken;
+};
+
+class UiObjectMemberList: public Node
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(UiObjectMemberList)
+
+ UiObjectMemberList(UiObjectMember *member)
+ : next(this), member(member)
+ { kind = K; }
+
+ UiObjectMemberList(UiObjectMemberList *previous, UiObjectMember *member)
+ : member(member)
+ {
+ kind = K;
+ next = previous->next;
+ previous->next = this;
+ }
+
+ virtual void accept0(Visitor *visitor);
+
+ UiObjectMemberList *finish()
+ {
+ UiObjectMemberList *head = next;
+ next = 0;
+ return head;
+ }
+
+// attributes
+ UiObjectMemberList *next;
+ UiObjectMember *member;
+};
+
+class UiQualifiedId: public Node
+{
+public:
+ JAVASCRIPT_DECLARE_AST_NODE(UiQualifiedId)
+
+ UiQualifiedId(JavaScriptNameIdImpl *name)
+ : next(this), name(name)
+ { kind = K; }
+
+ UiQualifiedId(UiQualifiedId *previous, JavaScriptNameIdImpl *name)
+ : name(name)
+ {
+ kind = K;
+ next = previous->next;
+ previous->next = this;
+ }
+
+ virtual ~UiQualifiedId() {}
+
+ UiQualifiedId *finish()
+ {
+ UiQualifiedId *head = next;
+ next = 0;
+ return head;
+ }
+
+ virtual void accept0(Visitor *visitor);
+
+// attributes
+ UiQualifiedId *next;
+ JavaScriptNameIdImpl *name;
+ SourceLocation identifierToken;
+};
+
+
+} } // namespace AST
+
+
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/declarative/qml/parser/javascriptastfwd_p.h b/src/declarative/qml/parser/javascriptastfwd_p.h
new file mode 100644
index 0000000..858e393
--- /dev/null
+++ b/src/declarative/qml/parser/javascriptastfwd_p.h
@@ -0,0 +1,164 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtScript module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef JAVASCRIPTAST_FWD_P_H
+#define JAVASCRIPTAST_FWD_P_H
+
+#include <QtCore/qglobal.h>
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+QT_BEGIN_NAMESPACE
+
+namespace JavaScript { namespace AST {
+
+class SourceLocation;
+
+class Visitor;
+class Node;
+class ExpressionNode;
+class Statement;
+class ThisExpression;
+class IdentifierExpression;
+class NullExpression;
+class TrueLiteral;
+class FalseLiteral;
+class NumericLiteral;
+class StringLiteral;
+class RegExpLiteral;
+class ArrayLiteral;
+class ObjectLiteral;
+class ElementList;
+class Elision;
+class PropertyNameAndValueList;
+class PropertyName;
+class IdentifierPropertyName;
+class StringLiteralPropertyName;
+class NumericLiteralPropertyName;
+class ArrayMemberExpression;
+class FieldMemberExpression;
+class NewMemberExpression;
+class NewExpression;
+class CallExpression;
+class ArgumentList;
+class PostIncrementExpression;
+class PostDecrementExpression;
+class DeleteExpression;
+class VoidExpression;
+class TypeOfExpression;
+class PreIncrementExpression;
+class PreDecrementExpression;
+class UnaryPlusExpression;
+class UnaryMinusExpression;
+class TildeExpression;
+class NotExpression;
+class BinaryExpression;
+class ConditionalExpression;
+class Expression; // ### rename
+class Block;
+class StatementList;
+class VariableStatement;
+class VariableDeclarationList;
+class VariableDeclaration;
+class EmptyStatement;
+class ExpressionStatement;
+class IfStatement;
+class DoWhileStatement;
+class WhileStatement;
+class ForStatement;
+class LocalForStatement;
+class ForEachStatement;
+class LocalForEachStatement;
+class ContinueStatement;
+class BreakStatement;
+class ReturnStatement;
+class WithStatement;
+class SwitchStatement;
+class CaseBlock;
+class CaseClauses;
+class CaseClause;
+class DefaultClause;
+class LabelledStatement;
+class ThrowStatement;
+class TryStatement;
+class Catch;
+class Finally;
+class FunctionDeclaration;
+class FunctionExpression;
+class FormalParameterList;
+class FunctionBody;
+class Program;
+class SourceElements;
+class SourceElement;
+class FunctionSourceElement;
+class StatementSourceElement;
+class DebuggerStatement;
+class NestedExpression;
+
+// ui elements
+class UiProgram;
+class UiImportList;
+class UiImport;
+class UiPublicMember;
+class UiObjectDefinition;
+class UiObjectInitializer;
+class UiObjectBinding;
+class UiScriptBinding;
+class UiSourceElement;
+class UiArrayBinding;
+class UiObjectMember;
+class UiObjectMemberList;
+class UiQualifiedId;
+
+} } // namespace AST
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/declarative/qml/parser/javascriptastvisitor.cpp b/src/declarative/qml/parser/javascriptastvisitor.cpp
new file mode 100644
index 0000000..eac291d
--- /dev/null
+++ b/src/declarative/qml/parser/javascriptastvisitor.cpp
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtScript module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "javascriptastvisitor_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace JavaScript { namespace AST {
+
+Visitor::Visitor()
+{
+}
+
+Visitor::~Visitor()
+{
+}
+
+} } // namespace JavaScript::AST
+
+QT_END_NAMESPACE
diff --git a/src/declarative/qml/parser/javascriptastvisitor_p.h b/src/declarative/qml/parser/javascriptastvisitor_p.h
new file mode 100644
index 0000000..81df364
--- /dev/null
+++ b/src/declarative/qml/parser/javascriptastvisitor_p.h
@@ -0,0 +1,326 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtScript module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef JAVASCRIPTASTVISITOR_P_H
+#define JAVASCRIPTASTVISITOR_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "javascriptastfwd_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace JavaScript { namespace AST {
+
+class Visitor
+{
+public:
+ Visitor();
+ virtual ~Visitor();
+
+ virtual bool preVisit(Node *) { return true; }
+ virtual void postVisit(Node *) {}
+
+ // Ui
+ virtual bool visit(UiProgram *) { return true; }
+ virtual bool visit(UiImportList *) { return true; }
+ virtual bool visit(UiImport *) { return true; }
+ virtual bool visit(UiPublicMember *) { return true; }
+ virtual bool visit(UiSourceElement *) { return true; }
+ virtual bool visit(UiObjectDefinition *) { return true; }
+ virtual bool visit(UiObjectInitializer *) { return true; }
+ virtual bool visit(UiObjectBinding *) { return true; }
+ virtual bool visit(UiScriptBinding *) { return true; }
+ virtual bool visit(UiArrayBinding *) { return true; }
+ virtual bool visit(UiObjectMemberList *) { return true; }
+ virtual bool visit(UiQualifiedId *) { return true; }
+
+ virtual void endVisit(UiProgram *) {}
+ virtual void endVisit(UiImportList *) {}
+ virtual void endVisit(UiImport *) {}
+ virtual void endVisit(UiPublicMember *) {}
+ virtual void endVisit(UiSourceElement *) {}
+ virtual void endVisit(UiObjectDefinition *) {}
+ virtual void endVisit(UiObjectInitializer *) {}
+ virtual void endVisit(UiObjectBinding *) {}
+ virtual void endVisit(UiScriptBinding *) {}
+ virtual void endVisit(UiArrayBinding *) {}
+ virtual void endVisit(UiObjectMemberList *) {}
+ virtual void endVisit(UiQualifiedId *) {}
+
+ // JavaScript
+ virtual bool visit(ThisExpression *) { return true; }
+ virtual void endVisit(ThisExpression *) {}
+
+ virtual bool visit(IdentifierExpression *) { return true; }
+ virtual void endVisit(IdentifierExpression *) {}
+
+ virtual bool visit(NullExpression *) { return true; }
+ virtual void endVisit(NullExpression *) {}
+
+ virtual bool visit(TrueLiteral *) { return true; }
+ virtual void endVisit(TrueLiteral *) {}
+
+ virtual bool visit(FalseLiteral *) { return true; }
+ virtual void endVisit(FalseLiteral *) {}
+
+ virtual bool visit(StringLiteral *) { return true; }
+ virtual void endVisit(StringLiteral *) {}
+
+ virtual bool visit(NumericLiteral *) { return true; }
+ virtual void endVisit(NumericLiteral *) {}
+
+ virtual bool visit(RegExpLiteral *) { return true; }
+ virtual void endVisit(RegExpLiteral *) {}
+
+ virtual bool visit(ArrayLiteral *) { return true; }
+ virtual void endVisit(ArrayLiteral *) {}
+
+ virtual bool visit(ObjectLiteral *) { return true; }
+ virtual void endVisit(ObjectLiteral *) {}
+
+ virtual bool visit(ElementList *) { return true; }
+ virtual void endVisit(ElementList *) {}
+
+ virtual bool visit(Elision *) { return true; }
+ virtual void endVisit(Elision *) {}
+
+ virtual bool visit(PropertyNameAndValueList *) { return true; }
+ virtual void endVisit(PropertyNameAndValueList *) {}
+
+ virtual bool visit(NestedExpression *) { return true; }
+ virtual void endVisit(NestedExpression *) {}
+
+ virtual bool visit(IdentifierPropertyName *) { return true; }
+ virtual void endVisit(IdentifierPropertyName *) {}
+
+ virtual bool visit(StringLiteralPropertyName *) { return true; }
+ virtual void endVisit(StringLiteralPropertyName *) {}
+
+ virtual bool visit(NumericLiteralPropertyName *) { return true; }
+ virtual void endVisit(NumericLiteralPropertyName *) {}
+
+ virtual bool visit(ArrayMemberExpression *) { return true; }
+ virtual void endVisit(ArrayMemberExpression *) {}
+
+ virtual bool visit(FieldMemberExpression *) { return true; }
+ virtual void endVisit(FieldMemberExpression *) {}
+
+ virtual bool visit(NewMemberExpression *) { return true; }
+ virtual void endVisit(NewMemberExpression *) {}
+
+ virtual bool visit(NewExpression *) { return true; }
+ virtual void endVisit(NewExpression *) {}
+
+ virtual bool visit(CallExpression *) { return true; }
+ virtual void endVisit(CallExpression *) {}
+
+ virtual bool visit(ArgumentList *) { return true; }
+ virtual void endVisit(ArgumentList *) {}
+
+ virtual bool visit(PostIncrementExpression *) { return true; }
+ virtual void endVisit(PostIncrementExpression *) {}
+
+ virtual bool visit(PostDecrementExpression *) { return true; }
+ virtual void endVisit(PostDecrementExpression *) {}
+
+ virtual bool visit(DeleteExpression *) { return true; }
+ virtual void endVisit(DeleteExpression *) {}
+
+ virtual bool visit(VoidExpression *) { return true; }
+ virtual void endVisit(VoidExpression *) {}
+
+ virtual bool visit(TypeOfExpression *) { return true; }
+ virtual void endVisit(TypeOfExpression *) {}
+
+ virtual bool visit(PreIncrementExpression *) { return true; }
+ virtual void endVisit(PreIncrementExpression *) {}
+
+ virtual bool visit(PreDecrementExpression *) { return true; }
+ virtual void endVisit(PreDecrementExpression *) {}
+
+ virtual bool visit(UnaryPlusExpression *) { return true; }
+ virtual void endVisit(UnaryPlusExpression *) {}
+
+ virtual bool visit(UnaryMinusExpression *) { return true; }
+ virtual void endVisit(UnaryMinusExpression *) {}
+
+ virtual bool visit(TildeExpression *) { return true; }
+ virtual void endVisit(TildeExpression *) {}
+
+ virtual bool visit(NotExpression *) { return true; }
+ virtual void endVisit(NotExpression *) {}
+
+ virtual bool visit(BinaryExpression *) { return true; }
+ virtual void endVisit(BinaryExpression *) {}
+
+ virtual bool visit(ConditionalExpression *) { return true; }
+ virtual void endVisit(ConditionalExpression *) {}
+
+ virtual bool visit(Expression *) { return true; }
+ virtual void endVisit(Expression *) {}
+
+ virtual bool visit(Block *) { return true; }
+ virtual void endVisit(Block *) {}
+
+ virtual bool visit(StatementList *) { return true; }
+ virtual void endVisit(StatementList *) {}
+
+ virtual bool visit(VariableStatement *) { return true; }
+ virtual void endVisit(VariableStatement *) {}
+
+ virtual bool visit(VariableDeclarationList *) { return true; }
+ virtual void endVisit(VariableDeclarationList *) {}
+
+ virtual bool visit(VariableDeclaration *) { return true; }
+ virtual void endVisit(VariableDeclaration *) {}
+
+ virtual bool visit(EmptyStatement *) { return true; }
+ virtual void endVisit(EmptyStatement *) {}
+
+ virtual bool visit(ExpressionStatement *) { return true; }
+ virtual void endVisit(ExpressionStatement *) {}
+
+ virtual bool visit(IfStatement *) { return true; }
+ virtual void endVisit(IfStatement *) {}
+
+ virtual bool visit(DoWhileStatement *) { return true; }
+ virtual void endVisit(DoWhileStatement *) {}
+
+ virtual bool visit(WhileStatement *) { return true; }
+ virtual void endVisit(WhileStatement *) {}
+
+ virtual bool visit(ForStatement *) { return true; }
+ virtual void endVisit(ForStatement *) {}
+
+ virtual bool visit(LocalForStatement *) { return true; }
+ virtual void endVisit(LocalForStatement *) {}
+
+ virtual bool visit(ForEachStatement *) { return true; }
+ virtual void endVisit(ForEachStatement *) {}
+
+ virtual bool visit(LocalForEachStatement *) { return true; }
+ virtual void endVisit(LocalForEachStatement *) {}
+
+ virtual bool visit(ContinueStatement *) { return true; }
+ virtual void endVisit(ContinueStatement *) {}
+
+ virtual bool visit(BreakStatement *) { return true; }
+ virtual void endVisit(BreakStatement *) {}
+
+ virtual bool visit(ReturnStatement *) { return true; }
+ virtual void endVisit(ReturnStatement *) {}
+
+ virtual bool visit(WithStatement *) { return true; }
+ virtual void endVisit(WithStatement *) {}
+
+ virtual bool visit(SwitchStatement *) { return true; }
+ virtual void endVisit(SwitchStatement *) {}
+
+ virtual bool visit(CaseBlock *) { return true; }
+ virtual void endVisit(CaseBlock *) {}
+
+ virtual bool visit(CaseClauses *) { return true; }
+ virtual void endVisit(CaseClauses *) {}
+
+ virtual bool visit(CaseClause *) { return true; }
+ virtual void endVisit(CaseClause *) {}
+
+ virtual bool visit(DefaultClause *) { return true; }
+ virtual void endVisit(DefaultClause *) {}
+
+ virtual bool visit(LabelledStatement *) { return true; }
+ virtual void endVisit(LabelledStatement *) {}
+
+ virtual bool visit(ThrowStatement *) { return true; }
+ virtual void endVisit(ThrowStatement *) {}
+
+ virtual bool visit(TryStatement *) { return true; }
+ virtual void endVisit(TryStatement *) {}
+
+ virtual bool visit(Catch *) { return true; }
+ virtual void endVisit(Catch *) {}
+
+ virtual bool visit(Finally *) { return true; }
+ virtual void endVisit(Finally *) {}
+
+ virtual bool visit(FunctionDeclaration *) { return true; }
+ virtual void endVisit(FunctionDeclaration *) {}
+
+ virtual bool visit(FunctionExpression *) { return true; }
+ virtual void endVisit(FunctionExpression *) {}
+
+ virtual bool visit(FormalParameterList *) { return true; }
+ virtual void endVisit(FormalParameterList *) {}
+
+ virtual bool visit(FunctionBody *) { return true; }
+ virtual void endVisit(FunctionBody *) {}
+
+ virtual bool visit(Program *) { return true; }
+ virtual void endVisit(Program *) {}
+
+ virtual bool visit(SourceElements *) { return true; }
+ virtual void endVisit(SourceElements *) {}
+
+ virtual bool visit(FunctionSourceElement *) { return true; }
+ virtual void endVisit(FunctionSourceElement *) {}
+
+ virtual bool visit(StatementSourceElement *) { return true; }
+ virtual void endVisit(StatementSourceElement *) {}
+
+ virtual bool visit(DebuggerStatement *) { return true; }
+ virtual void endVisit(DebuggerStatement *) {}
+};
+
+} } // namespace AST
+
+QT_END_NAMESPACE
+
+#endif // JAVASCRIPTASTVISITOR_P_H
diff --git a/src/declarative/qml/parser/javascriptengine_p.cpp b/src/declarative/qml/parser/javascriptengine_p.cpp
new file mode 100644
index 0000000..ca15b75
--- /dev/null
+++ b/src/declarative/qml/parser/javascriptengine_p.cpp
@@ -0,0 +1,157 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+**
+**************************************************************************/
+
+#include "javascriptengine_p.h"
+#include "javascriptnodepool_p.h"
+#include "javascriptvalue.h"
+#include <qnumeric.h>
+#include <QHash>
+
+QT_BEGIN_NAMESPACE
+
+namespace JavaScript {
+
+QString numberToString(qjsreal value)
+{ return QString::number(value); }
+
+int Ecma::RegExp::flagFromChar(const QChar &ch)
+{
+ static QHash<QChar, int> flagsHash;
+ if (flagsHash.isEmpty()) {
+ flagsHash[QLatin1Char('g')] = Global;
+ flagsHash[QLatin1Char('i')] = IgnoreCase;
+ flagsHash[QLatin1Char('m')] = Multiline;
+ }
+ QHash<QChar, int>::const_iterator it;
+ it = flagsHash.constFind(ch);
+ if (it == flagsHash.constEnd())
+ return 0;
+ return it.value();
+}
+
+QString Ecma::RegExp::flagsToString(int flags)
+{
+ QString result;
+ if (flags & Global)
+ result += QLatin1Char('g');
+ if (flags & IgnoreCase)
+ result += QLatin1Char('i');
+ if (flags & Multiline)
+ result += QLatin1Char('m');
+ return result;
+}
+
+NodePool::NodePool(const QString &fileName, JavaScriptEnginePrivate *engine)
+ : m_fileName(fileName), m_engine(engine)
+{
+}
+
+NodePool::~NodePool()
+{
+}
+
+Code *NodePool::createCompiledCode(AST::Node *, CompilationUnit &)
+{
+ Q_ASSERT(0);
+ return 0;
+}
+
+static int toDigit(char c)
+{
+ if ((c >= '0') && (c <= '9'))
+ return c - '0';
+ else if ((c >= 'a') && (c <= 'z'))
+ return 10 + c - 'a';
+ else if ((c >= 'A') && (c <= 'Z'))
+ return 10 + c - 'A';
+ return -1;
+}
+
+qjsreal integerFromString(const char *buf, int size, int radix)
+{
+ if (size == 0)
+ return qSNaN();
+
+ qjsreal sign = 1.0;
+ int i = 0;
+ if (buf[0] == '+') {
+ ++i;
+ } else if (buf[0] == '-') {
+ sign = -1.0;
+ ++i;
+ }
+
+ if (((size-i) >= 2) && (buf[i] == '0')) {
+ if (((buf[i+1] == 'x') || (buf[i+1] == 'X'))
+ && (radix < 34)) {
+ if ((radix != 0) && (radix != 16))
+ return 0;
+ radix = 16;
+ i += 2;
+ } else {
+ if (radix == 0) {
+ radix = 8;
+ ++i;
+ }
+ }
+ } else if (radix == 0) {
+ radix = 10;
+ }
+
+ int j = i;
+ for ( ; i < size; ++i) {
+ int d = toDigit(buf[i]);
+ if ((d == -1) || (d >= radix))
+ break;
+ }
+ qjsreal result;
+ if (j == i) {
+ if (!qstrcmp(buf, "Infinity"))
+ result = qInf();
+ else
+ result = qSNaN();
+ } else {
+ result = 0;
+ qjsreal multiplier = 1;
+ for (--i ; i >= j; --i, multiplier *= radix)
+ result += toDigit(buf[i]) * multiplier;
+ }
+ result *= sign;
+ return result;
+}
+
+qjsreal integerFromString(const QString &str, int radix)
+{
+ QByteArray ba = str.trimmed().toUtf8();
+ return integerFromString(ba.constData(), ba.size(), radix);
+}
+
+} // end of namespace JavaScript
+
+QT_END_NAMESPACE
diff --git a/src/declarative/qml/parser/javascriptengine_p.h b/src/declarative/qml/parser/javascriptengine_p.h
new file mode 100644
index 0000000..1e6e568
--- /dev/null
+++ b/src/declarative/qml/parser/javascriptengine_p.h
@@ -0,0 +1,144 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+**
+**************************************************************************/
+
+#ifndef JAVASCRIPTENGINE_P_H
+#define JAVASCRIPTENGINE_P_H
+
+#include "javascriptvalue.h"
+#include <QString>
+#include <QSet>
+
+QT_BEGIN_NAMESPACE
+
+namespace JavaScript {
+
+class Node;
+class Lexer;
+class NodePool;
+
+namespace AST {
+
+class Node;
+
+} // end of namespace AST
+
+namespace Ecma {
+
+class RegExp
+{
+public:
+ enum RegExpFlag {
+ Global = 0x01,
+ IgnoreCase = 0x02,
+ Multiline = 0x04
+ };
+
+public:
+ static int flagFromChar(const QChar &);
+ static QString flagsToString(int flags);
+};
+
+} // end of namespace Ecma
+
+} // end of namespace JavaScript
+
+
+
+class JavaScriptNameIdImpl
+{
+ QString _text;
+
+public:
+ JavaScriptNameIdImpl(const QChar *u, int s)
+ : _text(u, s)
+ { }
+
+ const QString asString() const
+ { return _text; }
+
+ bool operator == (const JavaScriptNameIdImpl &other) const
+ { return _text == other._text; }
+
+ bool operator != (const JavaScriptNameIdImpl &other) const
+ { return _text != other._text; }
+
+ bool operator < (const JavaScriptNameIdImpl &other) const
+ { return _text < other._text; }
+};
+
+inline uint qHash(const JavaScriptNameIdImpl &id)
+{ return qHash(id.asString()); }
+
+class JavaScriptEnginePrivate
+{
+ JavaScript::Lexer *_lexer;
+ JavaScript::NodePool *_nodePool;
+ JavaScript::AST::Node *_ast;
+ QSet<JavaScriptNameIdImpl> _literals;
+
+public:
+ JavaScriptEnginePrivate()
+ : _lexer(0), _nodePool(0), _ast(0)
+ { }
+
+ QSet<JavaScriptNameIdImpl> literals() const
+ { return _literals; }
+
+ JavaScriptNameIdImpl *intern(const QChar *u, int s)
+ { return const_cast<JavaScriptNameIdImpl *>(&*_literals.insert(JavaScriptNameIdImpl(u, s))); }
+
+ static QString toString(JavaScriptNameIdImpl *id)
+ { return id->asString(); }
+
+ JavaScript::Lexer *lexer() const
+ { return _lexer; }
+
+ void setLexer(JavaScript::Lexer *lexer)
+ { _lexer = lexer; }
+
+ JavaScript::NodePool *nodePool() const
+ { return _nodePool; }
+
+ void setNodePool(JavaScript::NodePool *nodePool)
+ { _nodePool = nodePool; }
+
+ JavaScript::AST::Node *ast() const
+ { return _ast; }
+
+ JavaScript::AST::Node *changeAbstractSyntaxTree(JavaScript::AST::Node *node)
+ {
+ JavaScript::AST::Node *previousAST = _ast;
+ _ast = node;
+ return previousAST;
+ }
+};
+
+QT_END_NAMESPACE
+
+#endif // JAVASCRIPTENGINE_P_H
diff --git a/src/declarative/qml/parser/javascriptgrammar.cpp b/src/declarative/qml/parser/javascriptgrammar.cpp
new file mode 100644
index 0000000..b06fd32
--- /dev/null
+++ b/src/declarative/qml/parser/javascriptgrammar.cpp
@@ -0,0 +1,696 @@
+// This file was generated by qlalr - DO NOT EDIT!
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "javascriptgrammar_p.h"
+
+const char *const JavaScriptGrammar::spell [] = {
+ "end of file", "&", "&&", "&=", "break", "case", "catch", ":", ";", "continue",
+ "default", "delete", "/", "/=", "do", ".", "else", "=", "==", "===",
+ "finally", "for", "function", ">=", ">", ">>", ">>=", ">>>", ">>>=", "identifier",
+ "if", "in", "instanceof", "{", "[", "<=", "(", "<", "<<", "<<=",
+ "-", "-=", "--", "new", "!", "!=", "!==", "numeric literal", "|", "|=",
+ "||", "+", "+=", "++", "?", "}", "]", "%", "%=", "return",
+ ")", ";", 0, "*", "*=", "string literal", "switch", "this", "throw", "~",
+ "try", "typeof", "var", "void", "while", "with", "^", "^=", "null", "true",
+ "false", "const", "debugger", "reserved word", "public", "import", 0, 0};
+
+const int JavaScriptGrammar::lhs [] = {
+ 88, 89, 89, 92, 92, 93, 93, 91, 90, 90,
+ 95, 95, 97, 97, 96, 94, 96, 94, 96, 94,
+ 96, 94, 94, 94, 94, 94, 98, 98, 103, 103,
+ 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
+ 103, 103, 103, 105, 105, 109, 109, 104, 104, 107,
+ 107, 110, 110, 110, 110, 111, 111, 111, 111, 111,
+ 111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
+ 111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
+ 111, 111, 111, 111, 111, 111, 112, 112, 113, 113,
+ 113, 113, 113, 116, 116, 117, 117, 117, 117, 115,
+ 115, 118, 118, 119, 119, 120, 120, 120, 121, 121,
+ 121, 121, 121, 121, 121, 121, 121, 121, 122, 122,
+ 122, 122, 123, 123, 123, 124, 124, 124, 124, 125,
+ 125, 125, 125, 125, 125, 125, 126, 126, 126, 126,
+ 126, 126, 127, 127, 127, 127, 127, 128, 128, 128,
+ 128, 128, 129, 129, 130, 130, 131, 131, 132, 132,
+ 133, 133, 134, 134, 135, 135, 136, 136, 137, 137,
+ 138, 138, 139, 139, 140, 140, 108, 108, 141, 141,
+ 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
+ 142, 142, 100, 100, 143, 143, 144, 144, 145, 145,
+ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 146, 161, 161, 160, 160,
+ 102, 102, 162, 162, 163, 163, 165, 165, 164, 166,
+ 169, 167, 167, 170, 168, 168, 147, 148, 148, 149,
+ 149, 150, 150, 150, 150, 150, 150, 150, 151, 151,
+ 151, 151, 152, 152, 152, 152, 153, 153, 154, 156,
+ 171, 171, 174, 174, 172, 172, 175, 173, 155, 157,
+ 157, 158, 158, 158, 176, 177, 159, 159, 101, 114,
+ 181, 181, 178, 178, 179, 179, 182, 183, 183, 184,
+ 184, 180, 180, 106, 106, 185};
+
+const int JavaScriptGrammar:: rhs[] = {
+ 2, 1, 1, 1, 2, 3, 3, 0, 1, 2,
+ 1, 3, 2, 3, 4, 4, 2, 2, 5, 5,
+ 3, 3, 3, 5, 1, 1, 1, 3, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 3, 3, 5,
+ 3, 4, 3, 2, 4, 1, 2, 0, 1, 3,
+ 5, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 4, 3, 5, 1, 2, 4, 4, 4, 3, 0,
+ 1, 1, 3, 1, 1, 1, 2, 2, 1, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 1, 3,
+ 3, 3, 1, 3, 3, 1, 3, 3, 3, 1,
+ 3, 3, 3, 3, 3, 3, 1, 3, 3, 3,
+ 3, 3, 1, 3, 3, 3, 3, 1, 3, 3,
+ 3, 3, 1, 3, 1, 3, 1, 3, 1, 3,
+ 1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
+ 1, 3, 1, 5, 1, 5, 1, 3, 1, 3,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 3, 0, 1, 1, 3, 0, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 3, 1, 2, 0, 1,
+ 3, 3, 1, 1, 1, 3, 1, 3, 2, 2,
+ 2, 0, 1, 2, 0, 1, 1, 2, 2, 7,
+ 5, 7, 7, 5, 9, 10, 7, 8, 2, 2,
+ 3, 3, 2, 2, 3, 3, 3, 3, 5, 5,
+ 3, 5, 1, 2, 0, 1, 4, 3, 3, 3,
+ 3, 3, 3, 4, 5, 2, 2, 2, 8, 8,
+ 1, 3, 0, 1, 0, 1, 1, 1, 2, 1,
+ 1, 0, 1, 0, 1, 2};
+
+const int JavaScriptGrammar::action_default [] = {
+ 8, 2, 0, 0, 4, 3, 0, 296, 0, 6,
+ 7, 5, 25, 223, 0, 27, 0, 224, 9, 1,
+ 0, 0, 26, 0, 283, 284, 0, 281, 0, 282,
+ 0, 285, 126, 193, 157, 165, 161, 201, 208, 105,
+ 177, 207, 215, 203, 153, 0, 204, 286, 0, 291,
+ 90, 205, 206, 211, 106, 169, 173, 94, 123, 104,
+ 109, 89, 143, 209, 130, 288, 287, 290, 212, 0,
+ 0, 0, 0, 36, 37, 0, 33, 0, 292, 30,
+ 0, 294, 48, 0, 0, 0, 0, 0, 31, 34,
+ 0, 0, 195, 237, 35, 0, 29, 0, 0, 32,
+ 0, 0, 0, 0, 0, 213, 214, 119, 202, 210,
+ 0, 0, 106, 125, 292, 30, 294, 108, 107, 0,
+ 0, 0, 121, 122, 120, 0, 293, 283, 0, 0,
+ 285, 0, 280, 0, 295, 0, 55, 56, 57, 58,
+ 83, 59, 84, 60, 61, 62, 63, 64, 65, 66,
+ 67, 52, 68, 69, 70, 71, 72, 54, 85, 73,
+ 53, 74, 75, 76, 77, 78, 79, 80, 81, 82,
+ 86, 0, 50, 0, 0, 42, 0, 51, 41, 124,
+ 0, 154, 0, 0, 0, 0, 144, 0, 0, 0,
+ 0, 0, 0, 134, 0, 0, 0, 128, 129, 127,
+ 132, 136, 135, 133, 131, 146, 145, 147, 0, 162,
+ 0, 158, 0, 0, 100, 99, 88, 87, 0, 0,
+ 98, 194, 101, 0, 102, 0, 103, 97, 238, 239,
+ 279, 0, 190, 183, 181, 188, 189, 187, 186, 192,
+ 185, 184, 182, 191, 178, 0, 166, 0, 0, 170,
+ 0, 0, 174, 0, 0, 100, 92, 0, 91, 0,
+ 96, 289, 253, 0, 254, 255, 256, 249, 0, 250,
+ 251, 252, 277, 278, 110, 0, 0, 0, 0, 0,
+ 242, 243, 199, 197, 159, 167, 163, 179, 155, 200,
+ 0, 106, 171, 175, 148, 137, 0, 0, 156, 0,
+ 0, 0, 0, 149, 0, 0, 0, 0, 0, 141,
+ 139, 142, 140, 138, 151, 150, 152, 0, 164, 0,
+ 160, 0, 198, 106, 0, 180, 195, 196, 0, 195,
+ 0, 0, 245, 0, 0, 0, 247, 0, 168, 0,
+ 0, 172, 0, 0, 176, 235, 0, 227, 236, 230,
+ 0, 234, 0, 195, 228, 0, 195, 0, 0, 246,
+ 0, 0, 0, 248, 293, 0, 269, 0, 0, 0,
+ 241, 0, 240, 217, 220, 0, 56, 83, 59, 84,
+ 61, 62, 33, 66, 67, 30, 68, 71, 31, 34,
+ 195, 35, 74, 29, 76, 32, 78, 79, 80, 81,
+ 82, 86, 218, 216, 94, 95, 100, 0, 93, 0,
+ 257, 258, 0, 0, 0, 260, 265, 263, 266, 0,
+ 0, 264, 265, 0, 261, 0, 262, 219, 268, 0,
+ 219, 267, 0, 270, 271, 0, 219, 272, 273, 0,
+ 0, 274, 0, 0, 0, 275, 276, 112, 111, 0,
+ 0, 0, 244, 0, 0, 0, 259, 0, 49, 0,
+ 46, 48, 39, 0, 45, 40, 47, 44, 38, 0,
+ 43, 116, 114, 118, 115, 113, 117, 0, 18, 13,
+ 0, 14, 10, 0, 23, 0, 24, 0, 0, 22,
+ 30, 48, 16, 27, 0, 11, 0, 17, 0, 20,
+ 12, 0, 21, 30, 48, 15, 0, 19, 28, 232,
+ 225, 0, 233, 229, 0, 231, 221, 0, 222, 226};
+
+const int JavaScriptGrammar::goto_default [] = {
+ 2, 6, 19, 1, 5, 4, 18, 494, 495, 478,
+ 20, 373, 45, 12, 108, 61, 459, 457, 135, 134,
+ 33, 458, 133, 136, 215, 57, 50, 223, 59, 39,
+ 222, 54, 60, 107, 58, 32, 64, 62, 294, 44,
+ 288, 34, 284, 36, 286, 35, 285, 55, 292, 56,
+ 293, 40, 287, 283, 324, 409, 289, 290, 37, 43,
+ 46, 51, 52, 41, 38, 63, 109, 53, 68, 105,
+ 106, 42, 375, 374, 21, 511, 510, 346, 347, 513,
+ 349, 512, 348, 415, 419, 422, 418, 417, 437, 438,
+ 26, 48, 125, 25, 47, 66, 65, 0};
+
+const int JavaScriptGrammar::action_index [] = {
+ -25, -88, 89, 70, -88, -15, 251, -88, 85, -88,
+ -88, -88, -88, -88, 56, 48, 46, -88, -88, 262,
+ 127, 72, -88, -17, -9, 20, -29, -88, -3, -88,
+ -6, 1289, 112, -88, 13, -44, -76, -88, -88, 212,
+ -88, -88, -88, -88, 253, 228, -88, -88, -10, -88,
+ -88, -88, -88, -88, 347, 53, 87, 154, 274, -88,
+ -88, -88, 287, -88, 191, -88, 1289, -88, -88, 199,
+ 194, 115, 557, -88, -88, 1205, -88, 66, 71, 77,
+ 63, 1541, 79, 557, 557, 557, 480, 557, -88, -88,
+ 557, 557, 557, -88, -88, 60, -88, 557, 557, -88,
+ 41, 557, 557, 42, 44, -88, -88, -88, -88, -88,
+ 557, 557, 83, 177, -24, -88, 1037, -88, -88, 557,
+ 557, 557, -88, -88, -88, 25, -88, -18, -58, -8,
+ 1289, -26, -88, 58, 64, 67, -88, -88, -88, -88,
+ -88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
+ -88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
+ -88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
+ -88, 557, -88, 1121, 55, -88, 557, -88, -88, 175,
+ 557, 250, 557, 557, 557, 557, 404, 557, 557, 557,
+ 557, 557, 557, 158, 557, 557, 557, 80, 73, 81,
+ 197, 238, 220, 159, 167, 277, 404, 317, 557, 14,
+ 557, 90, 953, 557, 557, -88, -88, -88, 108, 557,
+ -88, -88, 65, 49, -88, 557, -88, -88, -88, -88,
+ -88, 557, -88, -88, -88, -88, -88, -88, -88, -88,
+ -88, -88, -88, -88, -88, 557, 45, 557, 557, 75,
+ 69, 557, -88, 953, 557, 557, -88, 153, -88, 6,
+ -88, -88, -88, 105, -88, -88, -88, -88, 111, -88,
+ -88, -88, -88, -88, -88, 21, 62, 557, 122, 95,
+ -88, -88, 634, -88, 39, -30, -59, -88, 259, 8,
+ -46, 417, 19, 125, 339, 188, -7, 557, 248, 557,
+ 557, 557, 557, 339, 557, 557, 557, 557, 557, 187,
+ 166, 192, 206, 232, 339, 339, 339, 557, -59, 557,
+ 39, 557, -88, 380, 557, -88, 557, -5, -60, 557,
+ -48, 1205, -88, 557, 142, 1205, -88, 557, -38, 557,
+ 557, 7, 0, 557, -88, 17, 84, 22, -88, -88,
+ 557, -88, 27, 557, -88, -13, 557, 52, 1205, -88,
+ 557, 102, 1205, -88, 28, 1205, -88, 557, 100, 1205,
+ 34, 1205, -88, -88, 1205, -19, 139, 9, 149, 82,
+ 557, 1205, 23, 1, 119, 36, 10, 480, 40, 120,
+ 869, 35, 5, 26, 557, 37, -1, 557, 29, 557,
+ 31, 33, -88, -88, 205, -88, 557, -11, -88, 78,
+ -88, -88, 557, 98, 38, -88, 47, -88, 54, 198,
+ 557, -88, 30, 32, -88, -4, -88, 1205, -88, 107,
+ 1205, -88, 213, -88, -88, 113, 1205, 43, -88, 18,
+ 24, -88, -21, -54, -20, -88, -88, -88, -88, 557,
+ 143, 1205, -88, 557, 110, 1205, -88, 118, 16, 788,
+ -88, 15, -88, 711, -88, -88, -88, -88, -88, 121,
+ -88, -88, -88, -88, -88, -88, -88, 298, -88, -88,
+ 284, -88, -88, 59, 76, 557, 74, 1373, 57, -88,
+ 147, 130, -88, 61, 97, -88, 96, -88, 50, -88,
+ -88, 1457, -88, 116, 99, -88, 109, -88, -88, 51,
+ -88, 190, -88, -88, 557, -88, -88, 68, -88, -88,
+
+ -98, -98, -98, -98, -98, 30, 13, -98, -98, -98,
+ -98, -98, -98, -98, -98, -98, -98, -98, -98, 87,
+ -98, -98, -98, -98, -98, -98, -98, -98, -98, -98,
+ -98, 83, -98, -98, -98, -98, -98, -98, -98, -98,
+ -98, -98, -98, -98, -98, -98, -98, -98, -98, -98,
+ -98, -98, -98, -98, -43, -98, -98, -98, -98, -98,
+ -98, -98, -98, -98, -98, -98, 184, -98, -98, -98,
+ -98, -98, 113, -98, -98, -9, -98, -98, -98, -98,
+ -98, -98, -98, 42, 116, 112, 127, 146, -98, -98,
+ 151, 147, 40, -98, -98, -98, -98, 37, 89, -98,
+ -10, 90, 86, -98, -98, -98, -98, -98, -98, -98,
+ 77, 94, -98, -98, -98, -98, -98, -98, -98, 106,
+ 103, 98, -98, -98, -98, -98, -98, -47, -98, -98,
+ 253, -98, -98, -98, -98, -98, -98, -98, -98, -98,
+ -98, -98, -98, -98, -98, -98, -98, -98, -98, -98,
+ -98, -98, -98, -98, -98, -98, -98, -98, -98, -98,
+ -98, -98, -98, -98, -98, -98, -98, -98, -98, -98,
+ -98, -7, -98, 0, -98, -98, -3, -98, -98, -98,
+ 136, -98, 117, 119, 132, 134, -98, 130, 49, 36,
+ 35, 61, 64, -98, 47, 46, 38, -98, -98, -98,
+ -98, -98, -98, -98, -98, -98, -98, -98, 59, -98,
+ 58, -98, 24, 32, 17, -98, -98, -98, -98, 21,
+ -98, -98, -98, -98, -98, 8, -98, -98, -98, -98,
+ -98, 4, -98, -98, -98, -98, -98, -98, -98, -98,
+ -98, -98, -98, -98, -98, 60, -98, 57, -19, -98,
+ -98, -17, -98, 118, 44, 133, -98, -98, -98, -98,
+ -98, -98, -98, -98, -98, -98, -98, -98, -98, -98,
+ -98, -98, -98, -98, -98, -98, -98, 3, -98, -98,
+ -98, -98, 67, -98, -98, -98, -98, -98, -98, -98,
+ -98, -98, -98, -98, -98, -98, -98, 186, -98, 196,
+ 183, 177, 187, -98, 82, 76, 79, 96, 99, -98,
+ -98, -98, -98, -98, -98, -98, -98, 168, -98, 158,
+ -98, 156, -98, -98, 175, -98, 102, -98, -98, 104,
+ -98, 25, -98, 27, -98, 29, -98, 155, -98, 154,
+ 157, -98, -98, 167, -98, -98, -98, -98, -98, -98,
+ 193, -98, -48, 126, -98, -98, 128, -98, 15, -98,
+ 19, -98, 22, -98, -98, 23, -98, 20, -98, 18,
+ -98, 34, -98, -98, 53, -98, -98, -98, -98, -98,
+ 93, 52, -98, -98, -98, -98, -98, 81, -98, -98,
+ 45, -98, -98, -98, 43, -98, -35, 137, -98, 141,
+ -98, -98, -98, -98, -98, -98, 131, -98, -98, -98,
+ -98, -98, -8, -98, -98, -98, -98, -98, -77, -98,
+ 6, -98, -76, -98, -98, -98, -98, -52, -98, -98,
+ -51, -98, -98, -98, -98, -98, -98, -75, -98, -98,
+ -46, -98, -98, -98, -49, -98, -98, -98, -98, 7,
+ -98, 5, -98, -12, -98, 75, -98, -98, -98, -14,
+ -98, -11, -98, -13, -98, -98, -98, -98, -98, -98,
+ -98, -98, -98, -98, -98, -98, -98, 73, -98, -98,
+ 56, -98, -98, -98, -98, 41, -98, 39, -98, -98,
+ 50, 48, -98, 51, -98, -98, -98, -98, 66, -98,
+ -98, 31, -98, 16, 166, -98, -98, -98, -98, -98,
+ -98, -98, -98, -98, 26, -98, -98, -38, -98, -98};
+
+const int JavaScriptGrammar::action_info [] = {
+ 210, 329, 129, 219, 208, 126, 444, 343, 443, 337,
+ 317, 27, 331, 436, 180, 326, 321, 319, 317, 24,
+ 27, 337, 345, 460, 466, 130, 29, 31, 28, 132,
+ -64, 30, 436, -75, 350, 420, 403, 282, -223, 427,
+ 297, 412, -53, -52, -77, 230, 367, -72, 356, 408,
+ 371, 426, 420, 360, 442, 245, 345, 436, -224, 420,
+ 3, 127, 176, 440, 24, 171, 260, 449, 514, 453,
+ 3, 416, 173, 225, 436, 483, 251, 245, 449, 493,
+ 453, 477, 219, 485, 365, 23, 508, 460, 484, 7,
+ 210, 180, 352, 208, 477, 276, 412, 509, 277, 367,
+ 364, 509, 282, 501, 0, 498, 219, 460, 219, 227,
+ 219, 488, 358, 110, 430, 219, 219, 498, 219, 439,
+ 110, 110, 178, 365, 111, 117, 461, -54, 493, 219,
+ 219, 111, 111, 440, 487, 8, 118, 247, 460, 411,
+ 410, 248, 488, 273, 272, 353, 10, 9, 126, 477,
+ 219, 219, 110, 499, 365, -292, 281, 280, 414, 493,
+ 369, 219, 362, 111, 220, 507, 266, 265, 263, 253,
+ 455, 0, 271, 270, 462, 339, 273, 272, 268, 340,
+ 477, 470, 279, 194, 194, 195, 195, 119, 254, 119,
+ 255, 194, 194, 195, 195, 0, 196, 196, 517, 0,
+ 264, 262, 335, 451, 196, 196, 0, 0, 423, 258,
+ 269, 267, 194, 194, 195, 195, 194, 194, 195, 195,
+ 253, 219, 194, 268, 195, 196, 196, 212, 263, 196,
+ 196, 194, 120, 195, 120, 196, 219, 0, 121, 254,
+ 121, 406, 0, 0, 196, 194, 213, 195, 214, 0,
+ 0, 518, 516, 424, 0, 269, 267, 194, 196, 195,
+ 264, 262, 0, 194, 0, 195, 299, 300, 182, 183,
+ 196, 182, 183, 14, 434, 433, 196, 299, 300, 0,
+ 15, 0, 0, 0, 14, 0, 119, 0, 0, 229,
+ 228, 15, 0, 301, 302, 184, 185, 0, 184, 185,
+ 187, 188, 0, 0, 301, 302, 14, 0, 189, 190,
+ 187, 188, 191, 15, 192, 0, 0, 0, 189, 190,
+ 14, 0, 191, 17, 192, 0, 0, 15, 0, 0,
+ 0, 120, 13, 0, 17, 16, 0, 121, 0, 481,
+ 187, 188, 0, 13, 0, 0, 16, 0, 189, 190,
+ 232, 0, 191, 479, 192, 0, 17, 0, 0, 0,
+ 233, 0, 304, 305, 234, 13, 0, 0, 16, 0,
+ 17, 306, 0, 235, 307, 236, 308, 0, 0, 13,
+ 0, 0, 16, 232, 0, 0, 237, 0, 238, 117,
+ 0, 0, 0, 233, 0, 0, 239, 234, 0, 240,
+ 118, 0, 0, 0, 0, 241, 235, 0, 236, 0,
+ 0, 242, 0, 0, 0, 0, 0, 0, 0, 237,
+ 232, 238, 117, 0, 243, 0, 0, 187, 188, 239,
+ 233, 0, 240, 118, 234, 189, 190, 0, 241, 191,
+ 0, 192, 0, 235, 242, 236, 0, 0, 333, 0,
+ 0, 0, 0, 0, 0, 0, 237, 243, 238, 117,
+ 0, 0, 0, 0, 0, 0, 239, 0, 0, 240,
+ 118, 0, 0, 0, 0, 241, 0, 0, 0, 0,
+ 0, 242, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 73, 74, 243, 0, 0, 0, 0, 0,
+ 0, 0, 114, 0, 0, 0, 0, 0, 0, 115,
+ 0, 0, 0, 116, 82, 0, 83, 0, 0, 0,
+ 0, 0, 0, 86, 0, 0, 0, 89, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 94, 0, 96, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 88, 99,
+ 76, 0, 0, 0, 0, 0, 0, 0, 72, 73,
+ 74, 0, 0, 0, 0, 0, 0, 0, 0, 114,
+ 0, 0, 0, 0, 0, 0, 115, 0, 0, 0,
+ 116, 82, 0, 83, 0, 0, 0, 84, 0, 85,
+ 86, 87, 0, 0, 89, 0, 0, 0, 90, 0,
+ 91, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 94, 0, 96, 0, 98, 0, 101, 0,
+ 102, 0, 0, 0, 0, 88, 99, 76, 0, 0,
+ 0, 0, 0, 0, 0, 72, 73, 74, 0, 0,
+ 0, 0, 0, 0, 0, 0, 114, 0, 0, 0,
+ 0, 0, 0, 115, 0, 0, 0, 116, 82, 0,
+ 83, 0, 0, 0, 84, 0, 85, 86, 87, 0,
+ 0, 89, 0, 0, 0, 90, 0, 91, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 94,
+ 0, 96, 0, 98, 0, 101, 296, 102, 0, 0,
+ 0, 0, 88, 99, 76, 0, 0, 0, 0, 0,
+ 0, 0, 72, 73, 74, 0, 0, 0, 0, 0,
+ 0, 0, 0, 114, 0, 0, 0, 0, 0, 0,
+ 115, 0, 0, 0, 116, 82, 0, 83, 0, 0,
+ 0, 84, 0, 85, 86, 87, 0, 0, 89, 0,
+ 0, 0, 90, 0, 91, 0, 0, 465, 0, 0,
+ 0, 0, 0, 0, 0, 0, 94, 0, 96, 0,
+ 98, 0, 101, 0, 102, 0, 0, 0, 0, 88,
+ 99, 76, 0, 0, 0, 0, 0, 0, 0, 72,
+ 73, 74, 0, 0, 0, 0, 0, 0, 0, 0,
+ 114, 0, 0, 0, 0, 0, 0, 115, 0, 0,
+ 0, 116, 82, 0, 83, 0, 0, 0, 84, 0,
+ 85, 86, 87, 0, 0, 89, 0, 0, 0, 90,
+ 0, 91, 0, 0, 468, 0, 0, 0, 0, 0,
+ 0, 0, 0, 94, 0, 96, 0, 98, 0, 101,
+ 0, 102, 0, 0, 0, 0, 88, 99, 76, 0,
+ 0, 0, 0, 0, 0, 0, -73, 0, 0, 0,
+ 72, 73, 74, 0, 0, 0, 0, 0, 0, 0,
+ 0, 114, 0, 0, 0, 0, 0, 0, 115, 0,
+ 0, 0, 116, 82, 0, 83, 0, 0, 0, 84,
+ 0, 85, 86, 87, 0, 0, 89, 0, 0, 0,
+ 90, 0, 91, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 94, 0, 96, 0, 98, 0,
+ 101, 0, 102, 0, 0, 0, 0, 88, 99, 76,
+ 0, 0, 0, 0, 0, 0, 0, 137, 138, 139,
+ 0, 0, 141, 143, 144, 0, 0, 145, 0, 146,
+ 0, 0, 0, 148, 149, 150, 0, 0, 0, 0,
+ 0, 0, 217, 152, 153, 154, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 155, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 159, 0, 0, 0, 0, 0, 0, 161,
+ 162, 163, 0, 165, 166, 167, 168, 169, 170, 0,
+ 0, 156, 164, 147, 140, 142, 158, 0, 0, 0,
+ 0, 137, 138, 139, 0, 0, 141, 143, 144, 0,
+ 0, 145, 0, 146, 0, 0, 0, 148, 149, 150,
+ 0, 0, 0, 0, 0, 0, 151, 152, 153, 154,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 155, 0, 0, 0, 157, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 159, 0, 0, 0,
+ 0, 0, 160, 161, 162, 163, 0, 165, 166, 167,
+ 168, 169, 170, 0, 0, 156, 164, 147, 140, 142,
+ 158, 0, 0, 0, 0, 137, 138, 139, 0, 0,
+ 141, 143, 144, 0, 0, 145, 0, 146, 0, 0,
+ 0, 148, 149, 150, 0, 0, 0, 0, 0, 0,
+ 151, 152, 153, 154, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 155, 0, 0, 0, 157, 0,
+ 0, 0, 0, 0, 0, 0, 175, 0, 0, 0,
+ 159, 0, 0, 0, 0, 0, 160, 161, 162, 163,
+ 0, 165, 166, 167, 168, 169, 170, 0, 0, 156,
+ 164, 147, 140, 142, 158, 0, 0, 0, 0, 69,
+ 0, 0, 0, 0, 70, 0, 72, 73, 74, 75,
+ 0, 0, 0, 0, 0, 0, 77, 114, 0, 0,
+ 0, 0, 0, 0, 79, 80, 0, 0, 81, 82,
+ 0, 83, 0, 0, 0, 84, 0, 85, 86, 87,
+ 0, 0, 89, 0, 0, 0, 90, 0, 91, 0,
+ 0, 0, 0, 0, 92, 0, 93, 0, 0, 0,
+ 94, 95, 96, 97, 98, 100, 101, 17, 102, 103,
+ 104, 0, 0, 88, 99, 76, 13, 71, 0, 0,
+ 0, 0, 0, 69, 0, 0, 0, 0, 70, 0,
+ 72, 73, 74, 75, 0, 0, 0, 0, 0, 0,
+ 77, 78, 0, 0, 0, 0, 0, 0, 79, 80,
+ 0, 0, 81, 82, 0, 83, 0, 0, 0, 84,
+ 0, 85, 86, 87, 0, 0, 89, 0, 0, 0,
+ 90, 0, 91, 0, 0, 0, 0, 0, 92, 0,
+ 93, 0, 0, 0, 94, 95, 96, 97, 98, 100,
+ 101, 17, 102, 103, 104, 0, 0, 88, 99, 76,
+ 13, 71, 0, 0, 0, 0, 0, 69, 0, 0,
+ 0, 0, 70, 0, 72, 73, 74, 75, 0, 0,
+ 0, 0, 0, 0, 77, 114, 0, 0, 0, 0,
+ 0, 0, 490, 80, 0, 0, 81, 491, 0, 83,
+ 0, 0, 0, 84, 0, 85, 86, 87, 0, 0,
+ 89, 0, 0, 0, 90, 0, 91, 0, 0, 0,
+ 0, 0, 92, 0, 93, 0, 0, 0, 94, 95,
+ 96, 97, 98, 100, 101, 17, 102, 103, 104, 0,
+ 0, 88, 99, 76, 13, 71, 0, 0, 0, 0,
+ 0, 69, 0, 0, 0, 0, 70, 0, 72, 73,
+ 74, 75, 0, 0, 0, 0, 0, 0, 77, 114,
+ 0, 0, 0, 0, 0, 0, 503, 80, 0, 0,
+ 81, 504, 0, 83, 0, 0, 0, 84, 0, 85,
+ 86, 87, 0, 0, 89, 0, 0, 0, 90, 0,
+ 91, 0, 0, 0, 0, 0, 92, 0, 93, 0,
+ 0, 0, 94, 95, 96, 97, 98, 100, 101, 17,
+ 102, 103, 104, 0, 0, 88, 99, 76, 13, 71,
+ 0, 0, 0, 0, 0, 376, 138, 139, 0, 0,
+ 378, 143, 380, 73, 74, 381, 0, 146, 0, 0,
+ 0, 148, 383, 384, 0, 0, 0, 0, 0, 0,
+ 385, 386, 153, 154, 81, 82, 0, 83, 0, 0,
+ 0, 84, 0, 85, 387, 87, 0, 0, 389, 0,
+ 0, 0, 90, 0, 91, 0, -219, 0, 0, 0,
+ 390, 0, 93, 0, 0, 0, 391, 392, 393, 394,
+ 98, 396, 397, 398, 399, 400, 401, 0, 0, 388,
+ 395, 382, 377, 379, 158, 0, 0, 0, 0,
+
+ 454, 250, 275, 252, 413, 463, 467, 464, 425, 445,
+ 421, 231, 446, 172, 441, 278, 452, 177, 429, 450,
+ 428, 431, 174, 435, 244, 505, 359, 22, 226, 370,
+ 354, 361, 368, 363, 366, 11, 332, 224, 519, 334,
+ 336, 221, 502, 128, 218, 372, 515, 216, 435, 432,
+ 489, 0, 327, 486, 469, 432, 257, 327, 496, 492,
+ 497, 0, 482, 275, 402, 0, 112, 112, 0, 112,
+ 22, 202, 201, 199, 500, 480, 496, 112, 112, 0,
+ 112, 198, 197, 0, 0, 200, 456, 22, 112, 112,
+ 112, 112, 112, 482, 67, 112, 49, 203, 291, 211,
+ 204, 22, 209, 295, 249, 246, 404, 112, 112, 405,
+ 112, 113, 310, 112, 327, 311, 327, 112, 309, 448,
+ 112, 112, 476, 447, 112, 112, 274, 112, 179, 112,
+ 112, 124, 312, 0, 112, 313, 123, 112, 327, 122,
+ 327, 216, 256, 112, 112, 472, 274, 112, 112, 471,
+ 112, 224, 404, 224, 186, 405, 205, 328, 407, 330,
+ 259, 112, 0, 112, 0, 112, 193, 112, 112, 206,
+ 447, 207, 112, 506, 448, 181, 496, 112, 112, 473,
+ 475, 355, 112, 357, 474, 112, 112, 323, 323, 112,
+ 295, 295, 295, 295, 295, 67, 0, 49, 323, 112,
+ 320, 338, 341, 295, 295, 0, 323, 0, 112, 322,
+ 342, 295, 318, 295, 112, 315, 0, 112, 112, 295,
+ 344, 314, 295, 295, 323, 316, 298, 112, 325, 295,
+ 0, 0, 295, 0, 303, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 351, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 67, 0, 49, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 261, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 131, 0, 0, 0, 0, 0,
+ 0};
+
+const int JavaScriptGrammar::action_check [] = {
+ 76, 61, 60, 8, 48, 29, 60, 7, 29, 2,
+ 48, 29, 60, 33, 1, 61, 8, 76, 48, 36,
+ 29, 2, 29, 8, 8, 33, 29, 33, 8, 55,
+ 7, 60, 33, 7, 17, 5, 55, 36, 29, 7,
+ 1, 36, 7, 7, 7, 55, 36, 7, 61, 60,
+ 16, 55, 5, 31, 36, 2, 29, 33, 29, 5,
+ 85, 36, 7, 20, 36, 7, 60, 36, 17, 36,
+ 85, 33, 8, 8, 33, 29, 7, 2, 36, 29,
+ 36, 33, 8, 7, 7, 29, 29, 8, 29, 0,
+ 76, 1, 8, 48, 33, 74, 36, 29, 36, 36,
+ 29, 29, 36, 7, -1, 8, 8, 8, 8, 60,
+ 8, 15, 60, 40, 7, 8, 8, 8, 8, 6,
+ 40, 40, 55, 7, 51, 42, 8, 7, 29, 8,
+ 8, 51, 51, 20, 7, 65, 53, 50, 8, 61,
+ 62, 54, 15, 61, 62, 61, 61, 62, 29, 33,
+ 8, 8, 40, 56, 7, 36, 61, 62, 60, 29,
+ 60, 8, 60, 51, 56, 56, 61, 62, 29, 15,
+ 60, -1, 61, 62, 56, 50, 61, 62, 29, 54,
+ 33, 60, 60, 25, 25, 27, 27, 12, 34, 12,
+ 36, 25, 25, 27, 27, -1, 38, 38, 8, -1,
+ 61, 62, 60, 60, 38, 38, -1, -1, 10, 56,
+ 61, 62, 25, 25, 27, 27, 25, 25, 27, 27,
+ 15, 8, 25, 29, 27, 38, 38, 15, 29, 38,
+ 38, 25, 57, 27, 57, 38, 8, -1, 63, 34,
+ 63, 36, -1, -1, 38, 25, 34, 27, 36, -1,
+ -1, 61, 62, 55, -1, 61, 62, 25, 38, 27,
+ 61, 62, -1, 25, -1, 27, 18, 19, 18, 19,
+ 38, 18, 19, 22, 61, 62, 38, 18, 19, -1,
+ 29, -1, -1, -1, 22, -1, 12, -1, -1, 61,
+ 62, 29, -1, 45, 46, 45, 46, -1, 45, 46,
+ 23, 24, -1, -1, 45, 46, 22, -1, 31, 32,
+ 23, 24, 35, 29, 37, -1, -1, -1, 31, 32,
+ 22, -1, 35, 72, 37, -1, -1, 29, -1, -1,
+ -1, 57, 81, -1, 72, 84, -1, 63, -1, 55,
+ 23, 24, -1, 81, -1, -1, 84, -1, 31, 32,
+ 3, -1, 35, 55, 37, -1, 72, -1, -1, -1,
+ 13, -1, 23, 24, 17, 81, -1, -1, 84, -1,
+ 72, 32, -1, 26, 35, 28, 37, -1, -1, 81,
+ -1, -1, 84, 3, -1, -1, 39, -1, 41, 42,
+ -1, -1, -1, 13, -1, -1, 49, 17, -1, 52,
+ 53, -1, -1, -1, -1, 58, 26, -1, 28, -1,
+ -1, 64, -1, -1, -1, -1, -1, -1, -1, 39,
+ 3, 41, 42, -1, 77, -1, -1, 23, 24, 49,
+ 13, -1, 52, 53, 17, 31, 32, -1, 58, 35,
+ -1, 37, -1, 26, 64, 28, -1, -1, 31, -1,
+ -1, -1, -1, -1, -1, -1, 39, 77, 41, 42,
+ -1, -1, -1, -1, -1, -1, 49, -1, -1, 52,
+ 53, -1, -1, -1, -1, 58, -1, -1, -1, -1,
+ -1, 64, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 12, 13, 77, -1, -1, -1, -1, -1,
+ -1, -1, 22, -1, -1, -1, -1, -1, -1, 29,
+ -1, -1, -1, 33, 34, -1, 36, -1, -1, -1,
+ -1, -1, -1, 43, -1, -1, -1, 47, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 65, -1, 67, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 78, 79,
+ 80, -1, -1, -1, -1, -1, -1, -1, 11, 12,
+ 13, -1, -1, -1, -1, -1, -1, -1, -1, 22,
+ -1, -1, -1, -1, -1, -1, 29, -1, -1, -1,
+ 33, 34, -1, 36, -1, -1, -1, 40, -1, 42,
+ 43, 44, -1, -1, 47, -1, -1, -1, 51, -1,
+ 53, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 65, -1, 67, -1, 69, -1, 71, -1,
+ 73, -1, -1, -1, -1, 78, 79, 80, -1, -1,
+ -1, -1, -1, -1, -1, 11, 12, 13, -1, -1,
+ -1, -1, -1, -1, -1, -1, 22, -1, -1, -1,
+ -1, -1, -1, 29, -1, -1, -1, 33, 34, -1,
+ 36, -1, -1, -1, 40, -1, 42, 43, 44, -1,
+ -1, 47, -1, -1, -1, 51, -1, 53, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 65,
+ -1, 67, -1, 69, -1, 71, 72, 73, -1, -1,
+ -1, -1, 78, 79, 80, -1, -1, -1, -1, -1,
+ -1, -1, 11, 12, 13, -1, -1, -1, -1, -1,
+ -1, -1, -1, 22, -1, -1, -1, -1, -1, -1,
+ 29, -1, -1, -1, 33, 34, -1, 36, -1, -1,
+ -1, 40, -1, 42, 43, 44, -1, -1, 47, -1,
+ -1, -1, 51, -1, 53, -1, -1, 56, -1, -1,
+ -1, -1, -1, -1, -1, -1, 65, -1, 67, -1,
+ 69, -1, 71, -1, 73, -1, -1, -1, -1, 78,
+ 79, 80, -1, -1, -1, -1, -1, -1, -1, 11,
+ 12, 13, -1, -1, -1, -1, -1, -1, -1, -1,
+ 22, -1, -1, -1, -1, -1, -1, 29, -1, -1,
+ -1, 33, 34, -1, 36, -1, -1, -1, 40, -1,
+ 42, 43, 44, -1, -1, 47, -1, -1, -1, 51,
+ -1, 53, -1, -1, 56, -1, -1, -1, -1, -1,
+ -1, -1, -1, 65, -1, 67, -1, 69, -1, 71,
+ -1, 73, -1, -1, -1, -1, 78, 79, 80, -1,
+ -1, -1, -1, -1, -1, -1, 7, -1, -1, -1,
+ 11, 12, 13, -1, -1, -1, -1, -1, -1, -1,
+ -1, 22, -1, -1, -1, -1, -1, -1, 29, -1,
+ -1, -1, 33, 34, -1, 36, -1, -1, -1, 40,
+ -1, 42, 43, 44, -1, -1, 47, -1, -1, -1,
+ 51, -1, 53, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 65, -1, 67, -1, 69, -1,
+ 71, -1, 73, -1, -1, -1, -1, 78, 79, 80,
+ -1, -1, -1, -1, -1, -1, -1, 4, 5, 6,
+ -1, -1, 9, 10, 11, -1, -1, 14, -1, 16,
+ -1, -1, -1, 20, 21, 22, -1, -1, -1, -1,
+ -1, -1, 29, 30, 31, 32, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 43, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 59, -1, -1, -1, -1, -1, -1, 66,
+ 67, 68, -1, 70, 71, 72, 73, 74, 75, -1,
+ -1, 78, 79, 80, 81, 82, 83, -1, -1, -1,
+ -1, 4, 5, 6, -1, -1, 9, 10, 11, -1,
+ -1, 14, -1, 16, -1, -1, -1, 20, 21, 22,
+ -1, -1, -1, -1, -1, -1, 29, 30, 31, 32,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 43, -1, -1, -1, 47, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 59, -1, -1, -1,
+ -1, -1, 65, 66, 67, 68, -1, 70, 71, 72,
+ 73, 74, 75, -1, -1, 78, 79, 80, 81, 82,
+ 83, -1, -1, -1, -1, 4, 5, 6, -1, -1,
+ 9, 10, 11, -1, -1, 14, -1, 16, -1, -1,
+ -1, 20, 21, 22, -1, -1, -1, -1, -1, -1,
+ 29, 30, 31, 32, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 43, -1, -1, -1, 47, -1,
+ -1, -1, -1, -1, -1, -1, 55, -1, -1, -1,
+ 59, -1, -1, -1, -1, -1, 65, 66, 67, 68,
+ -1, 70, 71, 72, 73, 74, 75, -1, -1, 78,
+ 79, 80, 81, 82, 83, -1, -1, -1, -1, 4,
+ -1, -1, -1, -1, 9, -1, 11, 12, 13, 14,
+ -1, -1, -1, -1, -1, -1, 21, 22, -1, -1,
+ -1, -1, -1, -1, 29, 30, -1, -1, 33, 34,
+ -1, 36, -1, -1, -1, 40, -1, 42, 43, 44,
+ -1, -1, 47, -1, -1, -1, 51, -1, 53, -1,
+ -1, -1, -1, -1, 59, -1, 61, -1, -1, -1,
+ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
+ 75, -1, -1, 78, 79, 80, 81, 82, -1, -1,
+ -1, -1, -1, 4, -1, -1, -1, -1, 9, -1,
+ 11, 12, 13, 14, -1, -1, -1, -1, -1, -1,
+ 21, 22, -1, -1, -1, -1, -1, -1, 29, 30,
+ -1, -1, 33, 34, -1, 36, -1, -1, -1, 40,
+ -1, 42, 43, 44, -1, -1, 47, -1, -1, -1,
+ 51, -1, 53, -1, -1, -1, -1, -1, 59, -1,
+ 61, -1, -1, -1, 65, 66, 67, 68, 69, 70,
+ 71, 72, 73, 74, 75, -1, -1, 78, 79, 80,
+ 81, 82, -1, -1, -1, -1, -1, 4, -1, -1,
+ -1, -1, 9, -1, 11, 12, 13, 14, -1, -1,
+ -1, -1, -1, -1, 21, 22, -1, -1, -1, -1,
+ -1, -1, 29, 30, -1, -1, 33, 34, -1, 36,
+ -1, -1, -1, 40, -1, 42, 43, 44, -1, -1,
+ 47, -1, -1, -1, 51, -1, 53, -1, -1, -1,
+ -1, -1, 59, -1, 61, -1, -1, -1, 65, 66,
+ 67, 68, 69, 70, 71, 72, 73, 74, 75, -1,
+ -1, 78, 79, 80, 81, 82, -1, -1, -1, -1,
+ -1, 4, -1, -1, -1, -1, 9, -1, 11, 12,
+ 13, 14, -1, -1, -1, -1, -1, -1, 21, 22,
+ -1, -1, -1, -1, -1, -1, 29, 30, -1, -1,
+ 33, 34, -1, 36, -1, -1, -1, 40, -1, 42,
+ 43, 44, -1, -1, 47, -1, -1, -1, 51, -1,
+ 53, -1, -1, -1, -1, -1, 59, -1, 61, -1,
+ -1, -1, 65, 66, 67, 68, 69, 70, 71, 72,
+ 73, 74, 75, -1, -1, 78, 79, 80, 81, 82,
+ -1, -1, -1, -1, -1, 4, 5, 6, -1, -1,
+ 9, 10, 11, 12, 13, 14, -1, 16, -1, -1,
+ -1, 20, 21, 22, -1, -1, -1, -1, -1, -1,
+ 29, 30, 31, 32, 33, 34, -1, 36, -1, -1,
+ -1, 40, -1, 42, 43, 44, -1, -1, 47, -1,
+ -1, -1, 51, -1, 53, -1, 55, -1, -1, -1,
+ 59, -1, 61, -1, -1, -1, 65, 66, 67, 68,
+ 69, 70, 71, 72, 73, 74, 75, -1, -1, 78,
+ 79, 80, 81, 82, 83, -1, -1, -1, -1,
+
+ 12, 20, 11, 20, 12, 16, 20, 20, 84, 58,
+ 87, 54, 58, 20, 89, 12, 11, 20, 12, 12,
+ 72, 72, 22, 58, 20, 9, 11, 14, 20, 11,
+ 78, 12, 12, 11, 11, 5, 11, 20, 76, 12,
+ 11, 20, 11, 90, 12, 11, 20, 23, 58, 12,
+ 11, -1, 12, 12, 12, 12, 12, 12, 10, 9,
+ 9, -1, 6, 11, 11, -1, 31, 31, -1, 31,
+ 14, 36, 36, 35, 8, 2, 10, 31, 31, -1,
+ 31, 35, 35, -1, -1, 36, 11, 14, 31, 31,
+ 31, 31, 31, 6, 11, 31, 13, 36, 31, 41,
+ 36, 14, 43, 36, 47, 45, 25, 31, 31, 28,
+ 31, 34, 36, 31, 12, 36, 12, 31, 36, 33,
+ 31, 31, 33, 33, 31, 31, 33, 31, 34, 31,
+ 31, 33, 36, -1, 31, 36, 33, 31, 12, 33,
+ 12, 23, 24, 31, 31, 33, 33, 31, 31, 33,
+ 31, 20, 25, 20, 37, 28, 37, 55, 27, 55,
+ 27, 31, -1, 31, -1, 31, 36, 31, 31, 37,
+ 33, 37, 31, 7, 33, 39, 10, 31, 31, 33,
+ 33, 55, 31, 55, 33, 31, 31, 31, 31, 31,
+ 36, 36, 36, 36, 36, 11, -1, 13, 31, 31,
+ 42, 46, 48, 36, 36, -1, 31, -1, 31, 53,
+ 53, 36, 44, 36, 31, 38, -1, 31, 31, 36,
+ 53, 38, 36, 36, 31, 38, 40, 31, 53, 36,
+ -1, -1, 36, -1, 38, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 53, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 11, -1, 13, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 96, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 91, -1, -1, -1, -1, -1,
+ -1};
+
diff --git a/src/declarative/qml/parser/javascriptgrammar_p.h b/src/declarative/qml/parser/javascriptgrammar_p.h
new file mode 100644
index 0000000..490acb2
--- /dev/null
+++ b/src/declarative/qml/parser/javascriptgrammar_p.h
@@ -0,0 +1,197 @@
+// This file was generated by qlalr - DO NOT EDIT!
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#ifndef JAVASCRIPTGRAMMAR_P_H
+#define JAVASCRIPTGRAMMAR_P_H
+
+class JavaScriptGrammar
+{
+public:
+ enum {
+ EOF_SYMBOL = 0,
+ REDUCE_HERE = 87,
+ SHIFT_THERE = 86,
+ T_AND = 1,
+ T_AND_AND = 2,
+ T_AND_EQ = 3,
+ T_AUTOMATIC_SEMICOLON = 62,
+ T_BREAK = 4,
+ T_CASE = 5,
+ T_CATCH = 6,
+ T_COLON = 7,
+ T_COMMA = 8,
+ T_CONST = 81,
+ T_CONTINUE = 9,
+ T_DEBUGGER = 82,
+ T_DEFAULT = 10,
+ T_DELETE = 11,
+ T_DIVIDE_ = 12,
+ T_DIVIDE_EQ = 13,
+ T_DO = 14,
+ T_DOT = 15,
+ T_ELSE = 16,
+ T_EQ = 17,
+ T_EQ_EQ = 18,
+ T_EQ_EQ_EQ = 19,
+ T_FALSE = 80,
+ T_FINALLY = 20,
+ T_FOR = 21,
+ T_FUNCTION = 22,
+ T_GE = 23,
+ T_GT = 24,
+ T_GT_GT = 25,
+ T_GT_GT_EQ = 26,
+ T_GT_GT_GT = 27,
+ T_GT_GT_GT_EQ = 28,
+ T_IDENTIFIER = 29,
+ T_IF = 30,
+ T_IMPORT = 85,
+ T_IN = 31,
+ T_INSTANCEOF = 32,
+ T_LBRACE = 33,
+ T_LBRACKET = 34,
+ T_LE = 35,
+ T_LPAREN = 36,
+ T_LT = 37,
+ T_LT_LT = 38,
+ T_LT_LT_EQ = 39,
+ T_MINUS = 40,
+ T_MINUS_EQ = 41,
+ T_MINUS_MINUS = 42,
+ T_NEW = 43,
+ T_NOT = 44,
+ T_NOT_EQ = 45,
+ T_NOT_EQ_EQ = 46,
+ T_NULL = 78,
+ T_NUMERIC_LITERAL = 47,
+ T_OR = 48,
+ T_OR_EQ = 49,
+ T_OR_OR = 50,
+ T_PLUS = 51,
+ T_PLUS_EQ = 52,
+ T_PLUS_PLUS = 53,
+ T_PUBLIC = 84,
+ T_QUESTION = 54,
+ T_RBRACE = 55,
+ T_RBRACKET = 56,
+ T_REMAINDER = 57,
+ T_REMAINDER_EQ = 58,
+ T_RESERVED_WORD = 83,
+ T_RETURN = 59,
+ T_RPAREN = 60,
+ T_SEMICOLON = 61,
+ T_STAR = 63,
+ T_STAR_EQ = 64,
+ T_STRING_LITERAL = 65,
+ T_SWITCH = 66,
+ T_THIS = 67,
+ T_THROW = 68,
+ T_TILDE = 69,
+ T_TRUE = 79,
+ T_TRY = 70,
+ T_TYPEOF = 71,
+ T_VAR = 72,
+ T_VOID = 73,
+ T_WHILE = 74,
+ T_WITH = 75,
+ T_XOR = 76,
+ T_XOR_EQ = 77,
+
+ ACCEPT_STATE = 7,
+ RULE_COUNT = 296,
+ STATE_COUNT = 520,
+ TERMINAL_COUNT = 88,
+ NON_TERMINAL_COUNT = 98,
+
+ GOTO_INDEX_OFFSET = 520,
+ GOTO_INFO_OFFSET = 1629,
+ GOTO_CHECK_OFFSET = 1629
+ };
+
+ static const char *const spell [];
+ static const int lhs [];
+ static const int rhs [];
+ static const int goto_default [];
+ static const int action_default [];
+ static const int action_index [];
+ static const int action_info [];
+ static const int action_check [];
+
+ static inline int nt_action (int state, int nt)
+ {
+ const int *const goto_index = &action_index [GOTO_INDEX_OFFSET];
+ const int *const goto_check = &action_check [GOTO_CHECK_OFFSET];
+
+ const int yyn = goto_index [state] + nt;
+
+ if (yyn < 0 || goto_check [yyn] != nt)
+ return goto_default [nt];
+
+ const int *const goto_info = &action_info [GOTO_INFO_OFFSET];
+ return goto_info [yyn];
+ }
+
+ static inline int t_action (int state, int token)
+ {
+ const int yyn = action_index [state] + token;
+
+ if (yyn < 0 || action_check [yyn] != token)
+ return - action_default [state];
+
+ return action_info [yyn];
+ }
+};
+
+
+#endif // JAVASCRIPTGRAMMAR_P_H
+
diff --git a/src/declarative/qml/parser/javascriptlexer.cpp b/src/declarative/qml/parser/javascriptlexer.cpp
new file mode 100644
index 0000000..80a558d
--- /dev/null
+++ b/src/declarative/qml/parser/javascriptlexer.cpp
@@ -0,0 +1,1128 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtScript module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "javascriptengine_p.h"
+
+
+
+
+
+
+
+#include "javascriptlexer_p.h"
+#include "javascriptgrammar_p.h"
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+QT_BEGIN_NAMESPACE
+
+extern double qstrtod(const char *s00, char const **se, bool *ok);
+
+#define shiftWindowsLineBreak() \
+ do { \
+ if (((current == '\r') && (next1 == '\n')) \
+ || ((current == '\n') && (next1 == '\r'))) { \
+ shift(1); \
+ } \
+ } \
+ while (0)
+
+namespace JavaScript {
+extern qjsreal integerFromString(const char *buf, int size, int radix);
+}
+
+JavaScript::Lexer::Lexer(JavaScriptEnginePrivate *eng)
+ : driver(eng),
+ yylineno(0),
+ done(false),
+ size8(128), size16(128),
+ pos8(0), pos16(0),
+ terminator(false),
+ restrKeyword(false),
+ delimited(false),
+ stackToken(-1),
+ state(Start),
+ pos(0),
+ code(0), length(0),
+ yycolumn(0),
+ startpos(0),
+ startlineno(0), startcolumn(0),
+ bol(true),
+ current(0), next1(0), next2(0), next3(0),
+ err(NoError),
+ wantRx(false),
+ check_reserved(true),
+ parenthesesState(IgnoreParentheses),
+ parenthesesCount(0),
+ prohibitAutomaticSemicolon(false)
+{
+ // allocate space for read buffers
+ buffer8 = new char[size8];
+ buffer16 = new QChar[size16];
+ pattern = 0;
+ flags = 0;
+
+}
+
+JavaScript::Lexer::~Lexer()
+{
+ delete [] buffer8;
+ delete [] buffer16;
+}
+
+void JavaScript::Lexer::setCode(const QString &c, int lineno)
+{
+ errmsg = QString();
+ yylineno = lineno;
+ yycolumn = 1;
+ restrKeyword = false;
+ delimited = false;
+ stackToken = -1;
+ pos = 0;
+ code = c.unicode();
+ length = c.length();
+ bol = true;
+
+ // read first characters
+ current = (length > 0) ? code[0].unicode() : 0;
+ next1 = (length > 1) ? code[1].unicode() : 0;
+ next2 = (length > 2) ? code[2].unicode() : 0;
+ next3 = (length > 3) ? code[3].unicode() : 0;
+}
+
+void JavaScript::Lexer::shift(uint p)
+{
+ while (p--) {
+ ++pos;
+ ++yycolumn;
+ current = next1;
+ next1 = next2;
+ next2 = next3;
+ next3 = (pos + 3 < length) ? code[pos+3].unicode() : 0;
+ }
+}
+
+void JavaScript::Lexer::setDone(State s)
+{
+ state = s;
+ done = true;
+}
+
+int JavaScript::Lexer::findReservedWord(const QChar *c, int size) const
+{
+ switch (size) {
+ case 2: {
+ if (c[0] == QLatin1Char('d') && c[1] == QLatin1Char('o'))
+ return JavaScriptGrammar::T_DO;
+ else if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('f'))
+ return JavaScriptGrammar::T_IF;
+ else if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('n'))
+ return JavaScriptGrammar::T_IN;
+ } break;
+
+ case 3: {
+ if (c[0] == QLatin1Char('f') && c[1] == QLatin1Char('o') && c[2] == QLatin1Char('r'))
+ return JavaScriptGrammar::T_FOR;
+ else if (c[0] == QLatin1Char('n') && c[1] == QLatin1Char('e') && c[2] == QLatin1Char('w'))
+ return JavaScriptGrammar::T_NEW;
+ else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('r') && c[2] == QLatin1Char('y'))
+ return JavaScriptGrammar::T_TRY;
+ else if (c[0] == QLatin1Char('v') && c[1] == QLatin1Char('a') && c[2] == QLatin1Char('r'))
+ return JavaScriptGrammar::T_VAR;
+ else if (check_reserved) {
+ if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('n') && c[2] == QLatin1Char('t'))
+ return JavaScriptGrammar::T_RESERVED_WORD;
+ }
+ } break;
+
+ case 4: {
+ if (c[0] == QLatin1Char('c') && c[1] == QLatin1Char('a')
+ && c[2] == QLatin1Char('s') && c[3] == QLatin1Char('e'))
+ return JavaScriptGrammar::T_CASE;
+ else if (c[0] == QLatin1Char('e') && c[1] == QLatin1Char('l')
+ && c[2] == QLatin1Char('s') && c[3] == QLatin1Char('e'))
+ return JavaScriptGrammar::T_ELSE;
+ else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('h')
+ && c[2] == QLatin1Char('i') && c[3] == QLatin1Char('s'))
+ return JavaScriptGrammar::T_THIS;
+ else if (c[0] == QLatin1Char('v') && c[1] == QLatin1Char('o')
+ && c[2] == QLatin1Char('i') && c[3] == QLatin1Char('d'))
+ return JavaScriptGrammar::T_VOID;
+ else if (c[0] == QLatin1Char('w') && c[1] == QLatin1Char('i')
+ && c[2] == QLatin1Char('t') && c[3] == QLatin1Char('h'))
+ return JavaScriptGrammar::T_WITH;
+ else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('r')
+ && c[2] == QLatin1Char('u') && c[3] == QLatin1Char('e'))
+ return JavaScriptGrammar::T_TRUE;
+ else if (c[0] == QLatin1Char('n') && c[1] == QLatin1Char('u')
+ && c[2] == QLatin1Char('l') && c[3] == QLatin1Char('l'))
+ return JavaScriptGrammar::T_NULL;
+ else if (check_reserved) {
+ if (c[0] == QLatin1Char('e') && c[1] == QLatin1Char('n')
+ && c[2] == QLatin1Char('u') && c[3] == QLatin1Char('m'))
+ return JavaScriptGrammar::T_RESERVED_WORD;
+ else if (c[0] == QLatin1Char('b') && c[1] == QLatin1Char('y')
+ && c[2] == QLatin1Char('t') && c[3] == QLatin1Char('e'))
+ return JavaScriptGrammar::T_RESERVED_WORD;
+ else if (c[0] == QLatin1Char('l') && c[1] == QLatin1Char('o')
+ && c[2] == QLatin1Char('n') && c[3] == QLatin1Char('g'))
+ return JavaScriptGrammar::T_RESERVED_WORD;
+ else if (c[0] == QLatin1Char('c') && c[1] == QLatin1Char('h')
+ && c[2] == QLatin1Char('a') && c[3] == QLatin1Char('r'))
+ return JavaScriptGrammar::T_RESERVED_WORD;
+ else if (c[0] == QLatin1Char('g') && c[1] == QLatin1Char('o')
+ && c[2] == QLatin1Char('t') && c[3] == QLatin1Char('o'))
+ return JavaScriptGrammar::T_RESERVED_WORD;
+ }
+ } break;
+
+ case 5: {
+ if (c[0] == QLatin1Char('b') && c[1] == QLatin1Char('r')
+ && c[2] == QLatin1Char('e') && c[3] == QLatin1Char('a')
+ && c[4] == QLatin1Char('k'))
+ return JavaScriptGrammar::T_BREAK;
+ else if (c[0] == QLatin1Char('c') && c[1] == QLatin1Char('a')
+ && c[2] == QLatin1Char('t') && c[3] == QLatin1Char('c')
+ && c[4] == QLatin1Char('h'))
+ return JavaScriptGrammar::T_CATCH;
+ else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('h')
+ && c[2] == QLatin1Char('r') && c[3] == QLatin1Char('o')
+ && c[4] == QLatin1Char('w'))
+ return JavaScriptGrammar::T_THROW;
+ else if (c[0] == QLatin1Char('w') && c[1] == QLatin1Char('h')
+ && c[2] == QLatin1Char('i') && c[3] == QLatin1Char('l')
+ && c[4] == QLatin1Char('e'))
+ return JavaScriptGrammar::T_WHILE;
+ else if (c[0] == QLatin1Char('c') && c[1] == QLatin1Char('o')
+ && c[2] == QLatin1Char('n') && c[3] == QLatin1Char('s')
+ && c[4] == QLatin1Char('t'))
+ return JavaScriptGrammar::T_CONST;
+ else if (c[0] == QLatin1Char('f') && c[1] == QLatin1Char('a')
+ && c[2] == QLatin1Char('l') && c[3] == QLatin1Char('s')
+ && c[4] == QLatin1Char('e'))
+ return JavaScriptGrammar::T_FALSE;
+ else if (check_reserved) {
+ if (c[0] == QLatin1Char('s') && c[1] == QLatin1Char('h')
+ && c[2] == QLatin1Char('o') && c[3] == QLatin1Char('r')
+ && c[4] == QLatin1Char('t'))
+ return JavaScriptGrammar::T_RESERVED_WORD;
+ else if (c[0] == QLatin1Char('s') && c[1] == QLatin1Char('u')
+ && c[2] == QLatin1Char('p') && c[3] == QLatin1Char('e')
+ && c[4] == QLatin1Char('r'))
+ return JavaScriptGrammar::T_RESERVED_WORD;
+ else if (c[0] == QLatin1Char('f') && c[1] == QLatin1Char('i')
+ && c[2] == QLatin1Char('n') && c[3] == QLatin1Char('a')
+ && c[4] == QLatin1Char('l'))
+ return JavaScriptGrammar::T_RESERVED_WORD;
+ else if (c[0] == QLatin1Char('c') && c[1] == QLatin1Char('l')
+ && c[2] == QLatin1Char('a') && c[3] == QLatin1Char('s')
+ && c[4] == QLatin1Char('s'))
+ return JavaScriptGrammar::T_RESERVED_WORD;
+ else if (c[0] == QLatin1Char('f') && c[1] == QLatin1Char('l')
+ && c[2] == QLatin1Char('o') && c[3] == QLatin1Char('a')
+ && c[4] == QLatin1Char('t'))
+ return JavaScriptGrammar::T_RESERVED_WORD;
+ }
+ } break;
+
+ case 6: {
+ if (c[0] == QLatin1Char('d') && c[1] == QLatin1Char('e')
+ && c[2] == QLatin1Char('l') && c[3] == QLatin1Char('e')
+ && c[4] == QLatin1Char('t') && c[5] == QLatin1Char('e'))
+ return JavaScriptGrammar::T_DELETE;
+ else if (c[0] == QLatin1Char('r') && c[1] == QLatin1Char('e')
+ && c[2] == QLatin1Char('t') && c[3] == QLatin1Char('u')
+ && c[4] == QLatin1Char('r') && c[5] == QLatin1Char('n'))
+ return JavaScriptGrammar::T_RETURN;
+ else if (c[0] == QLatin1Char('s') && c[1] == QLatin1Char('w')
+ && c[2] == QLatin1Char('i') && c[3] == QLatin1Char('t')
+ && c[4] == QLatin1Char('c') && c[5] == QLatin1Char('h'))
+ return JavaScriptGrammar::T_SWITCH;
+ else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('y')
+ && c[2] == QLatin1Char('p') && c[3] == QLatin1Char('e')
+ && c[4] == QLatin1Char('o') && c[5] == QLatin1Char('f'))
+ return JavaScriptGrammar::T_TYPEOF;
+ else if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('m')
+ && c[2] == QLatin1Char('p') && c[3] == QLatin1Char('o')
+ && c[4] == QLatin1Char('r') && c[5] == QLatin1Char('t'))
+ return JavaScriptGrammar::T_IMPORT;
+ else if (check_reserved) {
+ if (c[0] == QLatin1Char('e') && c[1] == QLatin1Char('x')
+ && c[2] == QLatin1Char('p') && c[3] == QLatin1Char('o')
+ && c[4] == QLatin1Char('r') && c[5] == QLatin1Char('t'))
+ return JavaScriptGrammar::T_RESERVED_WORD;
+ else if (c[0] == QLatin1Char('s') && c[1] == QLatin1Char('t')
+ && c[2] == QLatin1Char('a') && c[3] == QLatin1Char('t')
+ && c[4] == QLatin1Char('i') && c[5] == QLatin1Char('c'))
+ return JavaScriptGrammar::T_RESERVED_WORD;
+ else if (c[0] == QLatin1Char('d') && c[1] == QLatin1Char('o')
+ && c[2] == QLatin1Char('u') && c[3] == QLatin1Char('b')
+ && c[4] == QLatin1Char('l') && c[5] == QLatin1Char('e'))
+ return JavaScriptGrammar::T_RESERVED_WORD;
+ else if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('m')
+ && c[2] == QLatin1Char('p') && c[3] == QLatin1Char('o')
+ && c[4] == QLatin1Char('r') && c[5] == QLatin1Char('t'))
+ return JavaScriptGrammar::T_RESERVED_WORD;
+ else if (c[0] == QLatin1Char('p') && c[1] == QLatin1Char('u')
+ && c[2] == QLatin1Char('b') && c[3] == QLatin1Char('l')
+ && c[4] == QLatin1Char('i') && c[5] == QLatin1Char('c'))
+ return JavaScriptGrammar::T_RESERVED_WORD;
+ else if (c[0] == QLatin1Char('n') && c[1] == QLatin1Char('a')
+ && c[2] == QLatin1Char('t') && c[3] == QLatin1Char('i')
+ && c[4] == QLatin1Char('v') && c[5] == QLatin1Char('e'))
+ return JavaScriptGrammar::T_RESERVED_WORD;
+ else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('h')
+ && c[2] == QLatin1Char('r') && c[3] == QLatin1Char('o')
+ && c[4] == QLatin1Char('w') && c[5] == QLatin1Char('s'))
+ return JavaScriptGrammar::T_RESERVED_WORD;
+ }
+ } break;
+
+ case 7: {
+ if (c[0] == QLatin1Char('d') && c[1] == QLatin1Char('e')
+ && c[2] == QLatin1Char('f') && c[3] == QLatin1Char('a')
+ && c[4] == QLatin1Char('u') && c[5] == QLatin1Char('l')
+ && c[6] == QLatin1Char('t'))
+ return JavaScriptGrammar::T_DEFAULT;
+ else if (c[0] == QLatin1Char('f') && c[1] == QLatin1Char('i')
+ && c[2] == QLatin1Char('n') && c[3] == QLatin1Char('a')
+ && c[4] == QLatin1Char('l') && c[5] == QLatin1Char('l')
+ && c[6] == QLatin1Char('y'))
+ return JavaScriptGrammar::T_FINALLY;
+ else if (check_reserved) {
+ if (c[0] == QLatin1Char('b') && c[1] == QLatin1Char('o')
+ && c[2] == QLatin1Char('o') && c[3] == QLatin1Char('l')
+ && c[4] == QLatin1Char('e') && c[5] == QLatin1Char('a')
+ && c[6] == QLatin1Char('n'))
+ return JavaScriptGrammar::T_RESERVED_WORD;
+ else if (c[0] == QLatin1Char('e') && c[1] == QLatin1Char('x')
+ && c[2] == QLatin1Char('t') && c[3] == QLatin1Char('e')
+ && c[4] == QLatin1Char('n') && c[5] == QLatin1Char('d')
+ && c[6] == QLatin1Char('s'))
+ return JavaScriptGrammar::T_RESERVED_WORD;
+ else if (c[0] == QLatin1Char('p') && c[1] == QLatin1Char('a')
+ && c[2] == QLatin1Char('c') && c[3] == QLatin1Char('k')
+ && c[4] == QLatin1Char('a') && c[5] == QLatin1Char('g')
+ && c[6] == QLatin1Char('e'))
+ return JavaScriptGrammar::T_RESERVED_WORD;
+ else if (c[0] == QLatin1Char('p') && c[1] == QLatin1Char('r')
+ && c[2] == QLatin1Char('i') && c[3] == QLatin1Char('v')
+ && c[4] == QLatin1Char('a') && c[5] == QLatin1Char('t')
+ && c[6] == QLatin1Char('e'))
+ return JavaScriptGrammar::T_RESERVED_WORD;
+ }
+ } break;
+
+ case 8: {
+ if (c[0] == QLatin1Char('c') && c[1] == QLatin1Char('o')
+ && c[2] == QLatin1Char('n') && c[3] == QLatin1Char('t')
+ && c[4] == QLatin1Char('i') && c[5] == QLatin1Char('n')
+ && c[6] == QLatin1Char('u') && c[7] == QLatin1Char('e'))
+ return JavaScriptGrammar::T_CONTINUE;
+ else if (c[0] == QLatin1Char('f') && c[1] == QLatin1Char('u')
+ && c[2] == QLatin1Char('n') && c[3] == QLatin1Char('c')
+ && c[4] == QLatin1Char('t') && c[5] == QLatin1Char('i')
+ && c[6] == QLatin1Char('o') && c[7] == QLatin1Char('n'))
+ return JavaScriptGrammar::T_FUNCTION;
+ else if (c[0] == QLatin1Char('d') && c[1] == QLatin1Char('e')
+ && c[2] == QLatin1Char('b') && c[3] == QLatin1Char('u')
+ && c[4] == QLatin1Char('g') && c[5] == QLatin1Char('g')
+ && c[6] == QLatin1Char('e') && c[7] == QLatin1Char('r'))
+ return JavaScriptGrammar::T_DEBUGGER;
+ else if (check_reserved) {
+ if (c[0] == QLatin1Char('a') && c[1] == QLatin1Char('b')
+ && c[2] == QLatin1Char('s') && c[3] == QLatin1Char('t')
+ && c[4] == QLatin1Char('r') && c[5] == QLatin1Char('a')
+ && c[6] == QLatin1Char('c') && c[7] == QLatin1Char('t'))
+ return JavaScriptGrammar::T_RESERVED_WORD;
+ else if (c[0] == QLatin1Char('v') && c[1] == QLatin1Char('o')
+ && c[2] == QLatin1Char('l') && c[3] == QLatin1Char('a')
+ && c[4] == QLatin1Char('t') && c[5] == QLatin1Char('i')
+ && c[6] == QLatin1Char('l') && c[7] == QLatin1Char('e'))
+ return JavaScriptGrammar::T_RESERVED_WORD;
+ }
+ } break;
+
+ case 9: {
+ if (check_reserved) {
+ if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('n')
+ && c[2] == QLatin1Char('t') && c[3] == QLatin1Char('e')
+ && c[4] == QLatin1Char('r') && c[5] == QLatin1Char('f')
+ && c[6] == QLatin1Char('a') && c[7] == QLatin1Char('c')
+ && c[8] == QLatin1Char('e'))
+ return JavaScriptGrammar::T_RESERVED_WORD;
+ else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('r')
+ && c[2] == QLatin1Char('a') && c[3] == QLatin1Char('n')
+ && c[4] == QLatin1Char('s') && c[5] == QLatin1Char('i')
+ && c[6] == QLatin1Char('e') && c[7] == QLatin1Char('n')
+ && c[8] == QLatin1Char('t'))
+ return JavaScriptGrammar::T_RESERVED_WORD;
+ else if (c[0] == QLatin1Char('p') && c[1] == QLatin1Char('r')
+ && c[2] == QLatin1Char('o') && c[3] == QLatin1Char('t')
+ && c[4] == QLatin1Char('e') && c[5] == QLatin1Char('c')
+ && c[6] == QLatin1Char('t') && c[7] == QLatin1Char('e')
+ && c[8] == QLatin1Char('d'))
+ return JavaScriptGrammar::T_RESERVED_WORD;
+ }
+ } break;
+
+ case 10: {
+ if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('n')
+ && c[2] == QLatin1Char('s') && c[3] == QLatin1Char('t')
+ && c[4] == QLatin1Char('a') && c[5] == QLatin1Char('n')
+ && c[6] == QLatin1Char('c') && c[7] == QLatin1Char('e')
+ && c[8] == QLatin1Char('o') && c[9] == QLatin1Char('f'))
+ return JavaScriptGrammar::T_INSTANCEOF;
+ else if (check_reserved) {
+ if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('m')
+ && c[2] == QLatin1Char('p') && c[3] == QLatin1Char('l')
+ && c[4] == QLatin1Char('e') && c[5] == QLatin1Char('m')
+ && c[6] == QLatin1Char('e') && c[7] == QLatin1Char('n')
+ && c[8] == QLatin1Char('t') && c[9] == QLatin1Char('s'))
+ return JavaScriptGrammar::T_RESERVED_WORD;
+ }
+ } break;
+
+ case 12: {
+ if (check_reserved) {
+ if (c[0] == QLatin1Char('s') && c[1] == QLatin1Char('y')
+ && c[2] == QLatin1Char('n') && c[3] == QLatin1Char('c')
+ && c[4] == QLatin1Char('h') && c[5] == QLatin1Char('r')
+ && c[6] == QLatin1Char('o') && c[7] == QLatin1Char('n')
+ && c[8] == QLatin1Char('i') && c[9] == QLatin1Char('z')
+ && c[10] == QLatin1Char('e') && c[11] == QLatin1Char('d'))
+ return JavaScriptGrammar::T_RESERVED_WORD;
+ }
+ } break;
+
+ } // switch
+
+ return -1;
+}
+
+int JavaScript::Lexer::lex()
+{
+ int token = 0;
+ state = Start;
+ ushort stringType = 0; // either single or double quotes
+ pos8 = pos16 = 0;
+ done = false;
+ terminator = false;
+
+ // did we push a token on the stack previously ?
+ // (after an automatic semicolon insertion)
+ if (stackToken >= 0) {
+ setDone(Other);
+ token = stackToken;
+ stackToken = -1;
+ }
+
+ while (!done) {
+ switch (state) {
+ case Start:
+ if (isWhiteSpace()) {
+ // do nothing
+ } else if (current == '/' && next1 == '/') {
+ recordStartPos();
+ shift(1);
+ state = InSingleLineComment;
+ } else if (current == '/' && next1 == '*') {
+ recordStartPos();
+ shift(1);
+ state = InMultiLineComment;
+ } else if (current == 0) {
+ syncProhibitAutomaticSemicolon();
+ if (!terminator && !delimited && !prohibitAutomaticSemicolon) {
+ // automatic semicolon insertion if program incomplete
+ token = JavaScriptGrammar::T_SEMICOLON;
+ stackToken = 0;
+ setDone(Other);
+ } else {
+ setDone(Eof);
+ }
+ } else if (isLineTerminator()) {
+ shiftWindowsLineBreak();
+ yylineno++;
+ yycolumn = 0;
+ bol = true;
+ terminator = true;
+ syncProhibitAutomaticSemicolon();
+ if (restrKeyword) {
+ token = JavaScriptGrammar::T_SEMICOLON;
+ setDone(Other);
+ }
+ } else if (current == '"' || current == '\'') {
+ recordStartPos();
+ state = InString;
+ stringType = current;
+ } else if (isIdentLetter(current)) {
+ recordStartPos();
+ record16(current);
+ state = InIdentifier;
+ } else if (current == '0') {
+ recordStartPos();
+ record8(current);
+ state = InNum0;
+ } else if (isDecimalDigit(current)) {
+ recordStartPos();
+ record8(current);
+ state = InNum;
+ } else if (current == '.' && isDecimalDigit(next1)) {
+ recordStartPos();
+ record8(current);
+ state = InDecimal;
+ } else {
+ recordStartPos();
+ token = matchPunctuator(current, next1, next2, next3);
+ if (token != -1) {
+ if (terminator && !delimited && !prohibitAutomaticSemicolon
+ && (token == JavaScriptGrammar::T_PLUS_PLUS
+ || token == JavaScriptGrammar::T_MINUS_MINUS)) {
+ // automatic semicolon insertion
+ stackToken = token;
+ token = JavaScriptGrammar::T_SEMICOLON;
+ }
+ setDone(Other);
+ }
+ else {
+ setDone(Bad);
+ err = IllegalCharacter;
+ errmsg = QLatin1String("Illegal character");
+ }
+ }
+ break;
+ case InString:
+ if (current == stringType) {
+ shift(1);
+ setDone(String);
+ } else if (current == 0 || isLineTerminator()) {
+ setDone(Bad);
+ err = UnclosedStringLiteral;
+ errmsg = QLatin1String("Unclosed string at end of line");
+ } else if (current == '\\') {
+ state = InEscapeSequence;
+ } else {
+ record16(current);
+ }
+ break;
+ // Escape Sequences inside of strings
+ case InEscapeSequence:
+ if (isOctalDigit(current)) {
+ if (current >= '0' && current <= '3' &&
+ isOctalDigit(next1) && isOctalDigit(next2)) {
+ record16(convertOctal(current, next1, next2));
+ shift(2);
+ state = InString;
+ } else if (isOctalDigit(current) &&
+ isOctalDigit(next1)) {
+ record16(convertOctal('0', current, next1));
+ shift(1);
+ state = InString;
+ } else if (isOctalDigit(current)) {
+ record16(convertOctal('0', '0', current));
+ state = InString;
+ } else {
+ setDone(Bad);
+ err = IllegalEscapeSequence;
+ errmsg = QLatin1String("Illegal escape squence");
+ }
+ } else if (current == 'x')
+ state = InHexEscape;
+ else if (current == 'u')
+ state = InUnicodeEscape;
+ else {
+ if (isLineTerminator()) {
+ shiftWindowsLineBreak();
+ yylineno++;
+ yycolumn = 0;
+ bol = true;
+ } else {
+ record16(singleEscape(current));
+ }
+ state = InString;
+ }
+ break;
+ case InHexEscape:
+ if (isHexDigit(current) && isHexDigit(next1)) {
+ state = InString;
+ record16(QLatin1Char(convertHex(current, next1)));
+ shift(1);
+ } else if (current == stringType) {
+ record16(QLatin1Char('x'));
+ shift(1);
+ setDone(String);
+ } else {
+ record16(QLatin1Char('x'));
+ record16(current);
+ state = InString;
+ }
+ break;
+ case InUnicodeEscape:
+ if (isHexDigit(current) && isHexDigit(next1) &&
+ isHexDigit(next2) && isHexDigit(next3)) {
+ record16(convertUnicode(current, next1, next2, next3));
+ shift(3);
+ state = InString;
+ } else if (current == stringType) {
+ record16(QLatin1Char('u'));
+ shift(1);
+ setDone(String);
+ } else {
+ setDone(Bad);
+ err = IllegalUnicodeEscapeSequence;
+ errmsg = QLatin1String("Illegal unicode escape sequence");
+ }
+ break;
+ case InSingleLineComment:
+ if (isLineTerminator()) {
+ shiftWindowsLineBreak();
+ yylineno++;
+ yycolumn = 0;
+ terminator = true;
+ bol = true;
+ if (restrKeyword) {
+ token = JavaScriptGrammar::T_SEMICOLON;
+ setDone(Other);
+ } else
+ state = Start;
+ } else if (current == 0) {
+ setDone(Eof);
+ }
+ break;
+ case InMultiLineComment:
+ if (current == 0) {
+ setDone(Bad);
+ err = UnclosedComment;
+ errmsg = QLatin1String("Unclosed comment at end of file");
+ } else if (isLineTerminator()) {
+ shiftWindowsLineBreak();
+ yylineno++;
+ } else if (current == '*' && next1 == '/') {
+ state = Start;
+ shift(1);
+ }
+ break;
+ case InIdentifier:
+ if (isIdentLetter(current) || isDecimalDigit(current)) {
+ record16(current);
+ break;
+ }
+ setDone(Identifier);
+ break;
+ case InNum0:
+ if (current == 'x' || current == 'X') {
+ record8(current);
+ state = InHex;
+ } else if (current == '.') {
+ record8(current);
+ state = InDecimal;
+ } else if (current == 'e' || current == 'E') {
+ record8(current);
+ state = InExponentIndicator;
+ } else if (isOctalDigit(current)) {
+ record8(current);
+ state = InOctal;
+ } else if (isDecimalDigit(current)) {
+ record8(current);
+ state = InDecimal;
+ } else {
+ setDone(Number);
+ }
+ break;
+ case InHex:
+ if (isHexDigit(current))
+ record8(current);
+ else
+ setDone(Hex);
+ break;
+ case InOctal:
+ if (isOctalDigit(current)) {
+ record8(current);
+ } else if (isDecimalDigit(current)) {
+ record8(current);
+ state = InDecimal;
+ } else {
+ setDone(Octal);
+ }
+ break;
+ case InNum:
+ if (isDecimalDigit(current)) {
+ record8(current);
+ } else if (current == '.') {
+ record8(current);
+ state = InDecimal;
+ } else if (current == 'e' || current == 'E') {
+ record8(current);
+ state = InExponentIndicator;
+ } else {
+ setDone(Number);
+ }
+ break;
+ case InDecimal:
+ if (isDecimalDigit(current)) {
+ record8(current);
+ } else if (current == 'e' || current == 'E') {
+ record8(current);
+ state = InExponentIndicator;
+ } else {
+ setDone(Number);
+ }
+ break;
+ case InExponentIndicator:
+ if (current == '+' || current == '-') {
+ record8(current);
+ } else if (isDecimalDigit(current)) {
+ record8(current);
+ state = InExponent;
+ } else {
+ setDone(Bad);
+ err = IllegalExponentIndicator;
+ errmsg = QLatin1String("Illegal syntax for exponential number");
+ }
+ break;
+ case InExponent:
+ if (isDecimalDigit(current)) {
+ record8(current);
+ } else {
+ setDone(Number);
+ }
+ break;
+ default:
+ Q_ASSERT_X(0, "Lexer::lex", "Unhandled state in switch statement");
+ }
+
+ // move on to the next character
+ if (!done)
+ shift(1);
+ if (state != Start && state != InSingleLineComment)
+ bol = false;
+ }
+
+ // no identifiers allowed directly after numeric literal, e.g. "3in" is bad
+ if ((state == Number || state == Octal || state == Hex)
+ && isIdentLetter(current)) {
+ state = Bad;
+ err = IllegalIdentifier;
+ errmsg = QLatin1String("Identifier cannot start with numeric literal");
+ }
+
+ // terminate string
+ buffer8[pos8] = '\0';
+
+ double dval = 0;
+ if (state == Number) {
+ dval = qstrtod(buffer8, 0, 0);
+ } else if (state == Hex) { // scan hex numbers
+ dval = JavaScript::integerFromString(buffer8, pos8, 16);
+ state = Number;
+ } else if (state == Octal) { // scan octal number
+ dval = JavaScript::integerFromString(buffer8, pos8, 8);
+ state = Number;
+ }
+
+ restrKeyword = false;
+ delimited = false;
+
+ switch (parenthesesState) {
+ case IgnoreParentheses:
+ break;
+ case CountParentheses:
+ if (token == JavaScriptGrammar::T_RPAREN) {
+ --parenthesesCount;
+ if (parenthesesCount == 0)
+ parenthesesState = BalancedParentheses;
+ } else if (token == JavaScriptGrammar::T_LPAREN) {
+ ++parenthesesCount;
+ }
+ break;
+ case BalancedParentheses:
+ parenthesesState = IgnoreParentheses;
+ break;
+ }
+
+ switch (state) {
+ case Eof:
+ return 0;
+ case Other:
+ if (token == JavaScriptGrammar::T_RBRACE || token == JavaScriptGrammar::T_SEMICOLON)
+ delimited = true;
+ return token;
+ case Identifier:
+ if ((token = findReservedWord(buffer16, pos16)) < 0) {
+ /* TODO: close leak on parse error. same holds true for String */
+ if (driver)
+ qsyylval.ustr = driver->intern(buffer16, pos16);
+ else
+ qsyylval.ustr = 0;
+ return JavaScriptGrammar::T_IDENTIFIER;
+ }
+ if (token == JavaScriptGrammar::T_CONTINUE || token == JavaScriptGrammar::T_BREAK
+ || token == JavaScriptGrammar::T_RETURN || token == JavaScriptGrammar::T_THROW) {
+ restrKeyword = true;
+ } else if (token == JavaScriptGrammar::T_IF || token == JavaScriptGrammar::T_FOR
+ || token == JavaScriptGrammar::T_WHILE || token == JavaScriptGrammar::T_WITH) {
+ parenthesesState = CountParentheses;
+ parenthesesCount = 0;
+ } else if (token == JavaScriptGrammar::T_DO) {
+ parenthesesState = BalancedParentheses;
+ }
+ return token;
+ case String:
+ if (driver)
+ qsyylval.ustr = driver->intern(buffer16, pos16);
+ else
+ qsyylval.ustr = 0;
+ return JavaScriptGrammar::T_STRING_LITERAL;
+ case Number:
+ qsyylval.dval = dval;
+ return JavaScriptGrammar::T_NUMERIC_LITERAL;
+ case Bad:
+ return -1;
+ default:
+ Q_ASSERT(!"unhandled numeration value in switch");
+ return -1;
+ }
+}
+
+bool JavaScript::Lexer::isWhiteSpace() const
+{
+ return (current == ' ' || current == '\t' ||
+ current == 0x0b || current == 0x0c);
+}
+
+bool JavaScript::Lexer::isLineTerminator() const
+{
+ return (current == '\n' || current == '\r');
+}
+
+bool JavaScript::Lexer::isIdentLetter(ushort c)
+{
+ /* TODO: allow other legitimate unicode chars */
+ return ((c >= 'a' && c <= 'z')
+ || (c >= 'A' && c <= 'Z')
+ || c == '$'
+ || c == '_');
+}
+
+bool JavaScript::Lexer::isDecimalDigit(ushort c)
+{
+ return (c >= '0' && c <= '9');
+}
+
+bool JavaScript::Lexer::isHexDigit(ushort c) const
+{
+ return ((c >= '0' && c <= '9')
+ || (c >= 'a' && c <= 'f')
+ || (c >= 'A' && c <= 'F'));
+}
+
+bool JavaScript::Lexer::isOctalDigit(ushort c) const
+{
+ return (c >= '0' && c <= '7');
+}
+
+int JavaScript::Lexer::matchPunctuator(ushort c1, ushort c2,
+ ushort c3, ushort c4)
+{
+ if (c1 == '>' && c2 == '>' && c3 == '>' && c4 == '=') {
+ shift(4);
+ return JavaScriptGrammar::T_GT_GT_GT_EQ;
+ } else if (c1 == '=' && c2 == '=' && c3 == '=') {
+ shift(3);
+ return JavaScriptGrammar::T_EQ_EQ_EQ;
+ } else if (c1 == '!' && c2 == '=' && c3 == '=') {
+ shift(3);
+ return JavaScriptGrammar::T_NOT_EQ_EQ;
+ } else if (c1 == '>' && c2 == '>' && c3 == '>') {
+ shift(3);
+ return JavaScriptGrammar::T_GT_GT_GT;
+ } else if (c1 == '<' && c2 == '<' && c3 == '=') {
+ shift(3);
+ return JavaScriptGrammar::T_LT_LT_EQ;
+ } else if (c1 == '>' && c2 == '>' && c3 == '=') {
+ shift(3);
+ return JavaScriptGrammar::T_GT_GT_EQ;
+ } else if (c1 == '<' && c2 == '=') {
+ shift(2);
+ return JavaScriptGrammar::T_LE;
+ } else if (c1 == '>' && c2 == '=') {
+ shift(2);
+ return JavaScriptGrammar::T_GE;
+ } else if (c1 == '!' && c2 == '=') {
+ shift(2);
+ return JavaScriptGrammar::T_NOT_EQ;
+ } else if (c1 == '+' && c2 == '+') {
+ shift(2);
+ return JavaScriptGrammar::T_PLUS_PLUS;
+ } else if (c1 == '-' && c2 == '-') {
+ shift(2);
+ return JavaScriptGrammar::T_MINUS_MINUS;
+ } else if (c1 == '=' && c2 == '=') {
+ shift(2);
+ return JavaScriptGrammar::T_EQ_EQ;
+ } else if (c1 == '+' && c2 == '=') {
+ shift(2);
+ return JavaScriptGrammar::T_PLUS_EQ;
+ } else if (c1 == '-' && c2 == '=') {
+ shift(2);
+ return JavaScriptGrammar::T_MINUS_EQ;
+ } else if (c1 == '*' && c2 == '=') {
+ shift(2);
+ return JavaScriptGrammar::T_STAR_EQ;
+ } else if (c1 == '/' && c2 == '=') {
+ shift(2);
+ return JavaScriptGrammar::T_DIVIDE_EQ;
+ } else if (c1 == '&' && c2 == '=') {
+ shift(2);
+ return JavaScriptGrammar::T_AND_EQ;
+ } else if (c1 == '^' && c2 == '=') {
+ shift(2);
+ return JavaScriptGrammar::T_XOR_EQ;
+ } else if (c1 == '%' && c2 == '=') {
+ shift(2);
+ return JavaScriptGrammar::T_REMAINDER_EQ;
+ } else if (c1 == '|' && c2 == '=') {
+ shift(2);
+ return JavaScriptGrammar::T_OR_EQ;
+ } else if (c1 == '<' && c2 == '<') {
+ shift(2);
+ return JavaScriptGrammar::T_LT_LT;
+ } else if (c1 == '>' && c2 == '>') {
+ shift(2);
+ return JavaScriptGrammar::T_GT_GT;
+ } else if (c1 == '&' && c2 == '&') {
+ shift(2);
+ return JavaScriptGrammar::T_AND_AND;
+ } else if (c1 == '|' && c2 == '|') {
+ shift(2);
+ return JavaScriptGrammar::T_OR_OR;
+ }
+
+ switch(c1) {
+ case '=': shift(1); return JavaScriptGrammar::T_EQ;
+ case '>': shift(1); return JavaScriptGrammar::T_GT;
+ case '<': shift(1); return JavaScriptGrammar::T_LT;
+ case ',': shift(1); return JavaScriptGrammar::T_COMMA;
+ case '!': shift(1); return JavaScriptGrammar::T_NOT;
+ case '~': shift(1); return JavaScriptGrammar::T_TILDE;
+ case '?': shift(1); return JavaScriptGrammar::T_QUESTION;
+ case ':': shift(1); return JavaScriptGrammar::T_COLON;
+ case '.': shift(1); return JavaScriptGrammar::T_DOT;
+ case '+': shift(1); return JavaScriptGrammar::T_PLUS;
+ case '-': shift(1); return JavaScriptGrammar::T_MINUS;
+ case '*': shift(1); return JavaScriptGrammar::T_STAR;
+ case '/': shift(1); return JavaScriptGrammar::T_DIVIDE_;
+ case '&': shift(1); return JavaScriptGrammar::T_AND;
+ case '|': shift(1); return JavaScriptGrammar::T_OR;
+ case '^': shift(1); return JavaScriptGrammar::T_XOR;
+ case '%': shift(1); return JavaScriptGrammar::T_REMAINDER;
+ case '(': shift(1); return JavaScriptGrammar::T_LPAREN;
+ case ')': shift(1); return JavaScriptGrammar::T_RPAREN;
+ case '{': shift(1); return JavaScriptGrammar::T_LBRACE;
+ case '}': shift(1); return JavaScriptGrammar::T_RBRACE;
+ case '[': shift(1); return JavaScriptGrammar::T_LBRACKET;
+ case ']': shift(1); return JavaScriptGrammar::T_RBRACKET;
+ case ';': shift(1); return JavaScriptGrammar::T_SEMICOLON;
+
+ default: return -1;
+ }
+}
+
+ushort JavaScript::Lexer::singleEscape(ushort c) const
+{
+ switch(c) {
+ case 'b':
+ return 0x08;
+ case 't':
+ return 0x09;
+ case 'n':
+ return 0x0A;
+ case 'v':
+ return 0x0B;
+ case 'f':
+ return 0x0C;
+ case 'r':
+ return 0x0D;
+ case '"':
+ return 0x22;
+ case '\'':
+ return 0x27;
+ case '\\':
+ return 0x5C;
+ default:
+ return c;
+ }
+}
+
+ushort JavaScript::Lexer::convertOctal(ushort c1, ushort c2,
+ ushort c3) const
+{
+ return ((c1 - '0') * 64 + (c2 - '0') * 8 + c3 - '0');
+}
+
+unsigned char JavaScript::Lexer::convertHex(ushort c)
+{
+ if (c >= '0' && c <= '9')
+ return (c - '0');
+ else if (c >= 'a' && c <= 'f')
+ return (c - 'a' + 10);
+ else
+ return (c - 'A' + 10);
+}
+
+unsigned char JavaScript::Lexer::convertHex(ushort c1, ushort c2)
+{
+ return ((convertHex(c1) << 4) + convertHex(c2));
+}
+
+QChar JavaScript::Lexer::convertUnicode(ushort c1, ushort c2,
+ ushort c3, ushort c4)
+{
+ return QChar((convertHex(c3) << 4) + convertHex(c4),
+ (convertHex(c1) << 4) + convertHex(c2));
+}
+
+void JavaScript::Lexer::record8(ushort c)
+{
+ Q_ASSERT(c <= 0xff);
+
+ // enlarge buffer if full
+ if (pos8 >= size8 - 1) {
+ char *tmp = new char[2 * size8];
+ memcpy(tmp, buffer8, size8 * sizeof(char));
+ delete [] buffer8;
+ buffer8 = tmp;
+ size8 *= 2;
+ }
+
+ buffer8[pos8++] = (char) c;
+}
+
+void JavaScript::Lexer::record16(QChar c)
+{
+ // enlarge buffer if full
+ if (pos16 >= size16 - 1) {
+ QChar *tmp = new QChar[2 * size16];
+ memcpy(tmp, buffer16, size16 * sizeof(QChar));
+ delete [] buffer16;
+ buffer16 = tmp;
+ size16 *= 2;
+ }
+
+ buffer16[pos16++] = c;
+}
+
+void JavaScript::Lexer::recordStartPos()
+{
+ startpos = pos;
+ startlineno = yylineno;
+ startcolumn = yycolumn;
+}
+
+bool JavaScript::Lexer::scanRegExp(RegExpBodyPrefix prefix)
+{
+ pos16 = 0;
+ bool lastWasEscape = false;
+
+ if (prefix == EqualPrefix)
+ record16(QLatin1Char('='));
+
+ while (1) {
+ if (isLineTerminator() || current == 0) {
+ errmsg = QLatin1String("Unterminated regular expression literal");
+ return false;
+ }
+ else if (current != '/' || lastWasEscape == true)
+ {
+ record16(current);
+ lastWasEscape = !lastWasEscape && (current == '\\');
+ }
+ else {
+ if (driver)
+ pattern = driver->intern(buffer16, pos16);
+ else
+ pattern = 0;
+ pos16 = 0;
+ shift(1);
+ break;
+ }
+ shift(1);
+ }
+
+ flags = 0;
+ while (isIdentLetter(current)) {
+ int flag = JavaScript::Ecma::RegExp::flagFromChar(current);
+ if (flag == 0) {
+ errmsg = QString::fromLatin1("Invalid regular expression flag '%0'")
+ .arg(QChar(current));
+ return false;
+ }
+ flags |= flag;
+ record16(current);
+ shift(1);
+ }
+
+ return true;
+}
+
+void JavaScript::Lexer::syncProhibitAutomaticSemicolon()
+{
+ if (parenthesesState == BalancedParentheses) {
+ // we have seen something like "if (foo)", which means we should
+ // never insert an automatic semicolon at this point, since it would
+ // then be expanded into an empty statement (ECMA-262 7.9.1)
+ prohibitAutomaticSemicolon = true;
+ parenthesesState = IgnoreParentheses;
+ } else {
+ prohibitAutomaticSemicolon = false;
+ }
+}
+
+QT_END_NAMESPACE
+
+
diff --git a/src/declarative/qml/parser/javascriptlexer_p.h b/src/declarative/qml/parser/javascriptlexer_p.h
new file mode 100644
index 0000000..e71c10c
--- /dev/null
+++ b/src/declarative/qml/parser/javascriptlexer_p.h
@@ -0,0 +1,250 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtScript module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef JAVASCRIPTLEXER_P_H
+#define JAVASCRIPTLEXER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/QString>
+
+
+
+QT_BEGIN_NAMESPACE
+
+class JavaScriptEnginePrivate;
+class JavaScriptNameIdImpl;
+
+namespace JavaScript {
+
+class Lexer
+{
+public:
+ Lexer(JavaScriptEnginePrivate *eng);
+ ~Lexer();
+
+ void setCode(const QString &c, int lineno);
+ int lex();
+
+ int currentLineNo() const { return yylineno; }
+ int currentColumnNo() const { return yycolumn; }
+
+ int tokenOffset() const { return startpos; }
+ int tokenLength() const { return pos - startpos; }
+
+ int startLineNo() const { return startlineno; }
+ int startColumnNo() const { return startcolumn; }
+
+ int endLineNo() const { return currentLineNo(); }
+ int endColumnNo() const
+ { int col = currentColumnNo(); return (col > 0) ? col - 1 : col; }
+
+ bool prevTerminator() const { return terminator; }
+
+ enum State { Start,
+ Identifier,
+ InIdentifier,
+ InSingleLineComment,
+ InMultiLineComment,
+ InNum,
+ InNum0,
+ InHex,
+ InOctal,
+ InDecimal,
+ InExponentIndicator,
+ InExponent,
+ Hex,
+ Octal,
+ Number,
+ String,
+ Eof,
+ InString,
+ InEscapeSequence,
+ InHexEscape,
+ InUnicodeEscape,
+ Other,
+ Bad };
+
+ enum Error {
+ NoError,
+ IllegalCharacter,
+ UnclosedStringLiteral,
+ IllegalEscapeSequence,
+ IllegalUnicodeEscapeSequence,
+ UnclosedComment,
+ IllegalExponentIndicator,
+ IllegalIdentifier
+ };
+
+ enum ParenthesesState {
+ IgnoreParentheses,
+ CountParentheses,
+ BalancedParentheses
+ };
+
+ enum RegExpBodyPrefix {
+ NoPrefix,
+ EqualPrefix
+ };
+
+ bool scanRegExp(RegExpBodyPrefix prefix = NoPrefix);
+
+ JavaScriptNameIdImpl *pattern;
+ int flags;
+
+ State lexerState() const
+ { return state; }
+
+ QString errorMessage() const
+ { return errmsg; }
+ void setErrorMessage(const QString &err)
+ { errmsg = err; }
+ void setErrorMessage(const char *err)
+ { setErrorMessage(QString::fromLatin1(err)); }
+
+ Error error() const
+ { return err; }
+ void clearError()
+ { err = NoError; }
+
+private:
+ JavaScriptEnginePrivate *driver;
+ int yylineno;
+ bool done;
+ char *buffer8;
+ QChar *buffer16;
+ uint size8, size16;
+ uint pos8, pos16;
+ bool terminator;
+ bool restrKeyword;
+ // encountered delimiter like "'" and "}" on last run
+ bool delimited;
+ int stackToken;
+
+ State state;
+ void setDone(State s);
+ uint pos;
+ void shift(uint p);
+ int lookupKeyword(const char *);
+
+ bool isWhiteSpace() const;
+ bool isLineTerminator() const;
+ bool isHexDigit(ushort c) const;
+ bool isOctalDigit(ushort c) const;
+
+ int matchPunctuator(ushort c1, ushort c2,
+ ushort c3, ushort c4);
+ ushort singleEscape(ushort c) const;
+ ushort convertOctal(ushort c1, ushort c2,
+ ushort c3) const;
+public:
+ static unsigned char convertHex(ushort c1);
+ static unsigned char convertHex(ushort c1, ushort c2);
+ static QChar convertUnicode(ushort c1, ushort c2,
+ ushort c3, ushort c4);
+ static bool isIdentLetter(ushort c);
+ static bool isDecimalDigit(ushort c);
+
+ inline int ival() const { return qsyylval.ival; }
+ inline double dval() const { return qsyylval.dval; }
+ inline JavaScriptNameIdImpl *ustr() const { return qsyylval.ustr; }
+
+ const QChar *characterBuffer() const { return buffer16; }
+ int characterCount() const { return pos16; }
+
+private:
+ void record8(ushort c);
+ void record16(QChar c);
+ void recordStartPos();
+
+ int findReservedWord(const QChar *buffer, int size) const;
+
+ void syncProhibitAutomaticSemicolon();
+
+ const QChar *code;
+ uint length;
+ int yycolumn;
+ int startpos;
+ int startlineno;
+ int startcolumn;
+ int bol; // begin of line
+
+ union {
+ int ival;
+ double dval;
+ JavaScriptNameIdImpl *ustr;
+ } qsyylval;
+
+ // current and following unicode characters
+ ushort current, next1, next2, next3;
+
+ struct keyword {
+ const char *name;
+ int token;
+ };
+
+ QString errmsg;
+ Error err;
+
+ bool wantRx;
+ bool check_reserved;
+
+ ParenthesesState parenthesesState;
+ int parenthesesCount;
+ bool prohibitAutomaticSemicolon;
+};
+
+} // namespace JavaScript
+
+QT_END_NAMESPACE
+
+
+
+#endif
diff --git a/src/declarative/qml/parser/javascriptmemorypool_p.h b/src/declarative/qml/parser/javascriptmemorypool_p.h
new file mode 100644
index 0000000..cff7677
--- /dev/null
+++ b/src/declarative/qml/parser/javascriptmemorypool_p.h
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtScript module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef JAVASCRIPTMEMORYPOOL_P_H
+#define JAVASCRIPTMEMORYPOOL_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qglobal.h>
+#include <QtCore/qshareddata.h>
+#include <string.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace JavaScript {
+
+class MemoryPool : public QSharedData
+{
+public:
+ enum { maxBlockCount = -1 };
+ enum { defaultBlockSize = 1 << 12 };
+
+ MemoryPool() {
+ m_blockIndex = maxBlockCount;
+ m_currentIndex = 0;
+ m_storage = 0;
+ m_currentBlock = 0;
+ m_currentBlockSize = 0;
+ }
+
+ virtual ~MemoryPool() {
+ for (int index = 0; index < m_blockIndex + 1; ++index)
+ qFree(m_storage[index]);
+
+ qFree(m_storage);
+ }
+
+ char *allocate(int bytes) {
+ bytes += (8 - bytes) & 7; // ensure multiple of 8 bytes (maintain alignment)
+ if (m_currentBlock == 0 || m_currentBlockSize < m_currentIndex + bytes) {
+ ++m_blockIndex;
+ m_currentBlockSize = defaultBlockSize << m_blockIndex;
+
+ m_storage = reinterpret_cast<char**>(qRealloc(m_storage, sizeof(char*) * (1 + m_blockIndex)));
+ m_currentBlock = m_storage[m_blockIndex] = reinterpret_cast<char*>(qMalloc(m_currentBlockSize));
+ ::memset(m_currentBlock, 0, m_currentBlockSize);
+
+ m_currentIndex = (8 - quintptr(m_currentBlock)) & 7; // ensure first chunk is 64-bit aligned
+ Q_ASSERT(m_currentIndex + bytes <= m_currentBlockSize);
+ }
+
+ char *p = reinterpret_cast<char *>
+ (m_currentBlock + m_currentIndex);
+
+ m_currentIndex += bytes;
+
+ return p;
+ }
+
+ int bytesAllocated() const {
+ int bytes = 0;
+ for (int index = 0; index < m_blockIndex; ++index)
+ bytes += (defaultBlockSize << index);
+ bytes += m_currentIndex;
+ return bytes;
+ }
+
+private:
+ int m_blockIndex;
+ int m_currentIndex;
+ char *m_currentBlock;
+ int m_currentBlockSize;
+ char **m_storage;
+
+private:
+ Q_DISABLE_COPY(MemoryPool)
+};
+
+} // namespace JavaScript
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/declarative/qml/parser/javascriptnodepool_p.h b/src/declarative/qml/parser/javascriptnodepool_p.h
new file mode 100644
index 0000000..3f59123
--- /dev/null
+++ b/src/declarative/qml/parser/javascriptnodepool_p.h
@@ -0,0 +1,139 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtScript module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef JAVASCRIPTNODEPOOL_P_H
+#define JAVASCRIPTNODEPOOL_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/QHash>
+#include <QtCore/QString>
+
+#include "javascriptmemorypool_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class JavaScriptEnginePrivate;
+
+namespace JavaScript {
+
+namespace AST {
+class Node;
+} // namespace AST
+
+class Code;
+class CompilationUnit;
+
+template <typename NodeType>
+inline NodeType *makeAstNode(MemoryPool *storage)
+{
+ NodeType *node = new (storage->allocate(sizeof(NodeType))) NodeType();
+ return node;
+}
+
+template <typename NodeType, typename Arg1>
+inline NodeType *makeAstNode(MemoryPool *storage, Arg1 arg1)
+{
+ NodeType *node = new (storage->allocate(sizeof(NodeType))) NodeType(arg1);
+ return node;
+}
+
+template <typename NodeType, typename Arg1, typename Arg2>
+inline NodeType *makeAstNode(MemoryPool *storage, Arg1 arg1, Arg2 arg2)
+{
+ NodeType *node = new (storage->allocate(sizeof(NodeType))) NodeType(arg1, arg2);
+ return node;
+}
+
+template <typename NodeType, typename Arg1, typename Arg2, typename Arg3>
+inline NodeType *makeAstNode(MemoryPool *storage, Arg1 arg1, Arg2 arg2, Arg3 arg3)
+{
+ NodeType *node = new (storage->allocate(sizeof(NodeType))) NodeType(arg1, arg2, arg3);
+ return node;
+}
+
+template <typename NodeType, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
+inline NodeType *makeAstNode(MemoryPool *storage, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4)
+{
+ NodeType *node = new (storage->allocate(sizeof(NodeType))) NodeType(arg1, arg2, arg3, arg4);
+ return node;
+}
+
+class NodePool : public MemoryPool
+{
+public:
+ NodePool(const QString &fileName, JavaScriptEnginePrivate *engine);
+ virtual ~NodePool();
+
+ Code *createCompiledCode(AST::Node *node, CompilationUnit &compilation);
+
+ inline QString fileName() const { return m_fileName; }
+ inline JavaScriptEnginePrivate *engine() const { return m_engine; }
+#ifndef J_SCRIPT_NO_EVENT_NOTIFY
+ inline qint64 id() const { return m_id; }
+#endif
+
+private:
+ QHash<AST::Node*, Code*> m_codeCache;
+ QString m_fileName;
+ JavaScriptEnginePrivate *m_engine;
+#ifndef J_SCRIPT_NO_EVENT_NOTIFY
+ qint64 m_id;
+#endif
+
+private:
+ Q_DISABLE_COPY(NodePool)
+};
+
+} // namespace JavaScript
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/declarative/qml/parser/javascriptparser.cpp b/src/declarative/qml/parser/javascriptparser.cpp
new file mode 100644
index 0000000..6221386
--- /dev/null
+++ b/src/declarative/qml/parser/javascriptparser.cpp
@@ -0,0 +1,1571 @@
+// This file was generated by qlalr - DO NOT EDIT!
+
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtScript module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QtDebug>
+
+#include <string.h>
+
+#include "javascriptengine_p.h"
+#include "javascriptlexer_p.h"
+#include "javascriptast_p.h"
+#include "javascriptnodepool_p.h"
+
+
+
+#include "javascriptparser_p.h"
+
+//
+// This file is automatically generated from javascript.g.
+// Changes will be lost.
+//
+
+using namespace JavaScript;
+
+QT_BEGIN_NAMESPACE
+
+void JavaScriptParser::reallocateStack()
+{
+ if (! stack_size)
+ stack_size = 128;
+ else
+ stack_size <<= 1;
+
+ sym_stack = reinterpret_cast<Value*> (qRealloc(sym_stack, stack_size * sizeof(Value)));
+ state_stack = reinterpret_cast<int*> (qRealloc(state_stack, stack_size * sizeof(int)));
+ location_stack = reinterpret_cast<AST::SourceLocation*> (qRealloc(location_stack, stack_size * sizeof(AST::SourceLocation)));
+}
+
+inline static bool automatic(JavaScriptEnginePrivate *driver, int token)
+{
+ return token == JavaScriptGrammar::T_RBRACE
+ || token == 0
+ || driver->lexer()->prevTerminator();
+}
+
+
+JavaScriptParser::JavaScriptParser():
+ tos(0),
+ stack_size(0),
+ sym_stack(0),
+ state_stack(0),
+ location_stack(0),
+ first_token(0),
+ last_token(0)
+{
+}
+
+JavaScriptParser::~JavaScriptParser()
+{
+ if (stack_size) {
+ qFree(sym_stack);
+ qFree(state_stack);
+ qFree(location_stack);
+ }
+}
+
+static inline AST::SourceLocation location(Lexer *lexer)
+{
+ AST::SourceLocation loc;
+ loc.offset = lexer->tokenOffset();
+ loc.length = lexer->tokenLength();
+ loc.startLine = lexer->startLineNo();
+ loc.startColumn = lexer->startColumnNo();
+ return loc;
+}
+
+bool JavaScriptParser::parse(JavaScriptEnginePrivate *driver)
+{
+ Lexer *lexer = driver->lexer();
+ bool hadErrors = false;
+ int yytoken = -1;
+ int action = 0;
+
+ first_token = last_token = 0;
+
+ tos = -1;
+
+ do {
+ if (++tos == stack_size)
+ reallocateStack();
+
+ state_stack[tos] = action;
+
+ _Lcheck_token:
+ if (yytoken == -1 && -TERMINAL_COUNT != action_index[action]) {
+ yyprevlloc = yylloc;
+
+ if (first_token == last_token) {
+ yytoken = lexer->lex();
+ yylval = lexer->dval();
+ yylloc = location(lexer);
+ } else {
+ yytoken = first_token->token;
+ yylval = first_token->dval;
+ yylloc = first_token->loc;
+ ++first_token;
+ }
+ }
+
+ action = t_action(action, yytoken);
+ if (action > 0) {
+ if (action != ACCEPT_STATE) {
+ yytoken = -1;
+ sym(1).dval = yylval;
+ loc(1) = yylloc;
+ } else {
+ --tos;
+ return ! hadErrors;
+ }
+ } else if (action < 0) {
+ const int r = -action - 1;
+ tos -= rhs[r];
+
+ switch (r) {
+
+case 0: {
+ sym(1).Node = makeAstNode<AST::UiProgram> (driver->nodePool(), sym(1).UiImportList,
+ sym(2).UiObjectMemberList->finish());
+} break;
+
+case 2: {
+ sym(1).Node = sym(1).UiImportList->finish();
+} break;
+
+case 3: {
+ sym(1).Node = makeAstNode<AST::UiImportList> (driver->nodePool(), sym(1).UiImport);
+} break;
+
+case 4: {
+ sym(1).Node = makeAstNode<AST::UiImportList> (driver->nodePool(),
+ sym(1).UiImportList, sym(2).UiImport);
+} break;
+
+case 6: {
+ AST::UiImport *node = makeAstNode<AST::UiImport>(driver->nodePool(), sym(2).sval);
+ node->importToken = loc(1);
+ node->fileNameToken = loc(2);
+ node->semicolonToken = loc(3);
+ sym(1).Node = node;
+} break;
+
+case 7: {
+ sym(1).Node = 0;
+} break;
+
+case 8: {
+ sym(1).Node = makeAstNode<AST::UiObjectMemberList> (driver->nodePool(), sym(1).UiObjectMember);
+} break;
+
+case 9: {
+ AST::UiObjectMemberList *node = makeAstNode<AST:: UiObjectMemberList> (driver->nodePool(),
+ sym(1).UiObjectMemberList, sym(2).UiObjectMember);
+ sym(1).Node = node;
+} break;
+
+case 10: {
+ sym(1).Node = makeAstNode<AST::UiObjectMemberList> (driver->nodePool(), sym(1).UiObjectMember);
+} break;
+
+case 11: {
+ AST::UiObjectMemberList *node = makeAstNode<AST:: UiObjectMemberList> (driver->nodePool(),
+ sym(1).UiObjectMemberList, sym(3).UiObjectMember);
+ sym(1).Node = node;
+} break;
+
+case 12: {
+ AST::UiObjectInitializer *node = makeAstNode<AST::UiObjectInitializer> (driver->nodePool(), (AST::UiObjectMemberList*)0);
+ node->lbraceToken = loc(1);
+ node->rbraceToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 13: {
+ AST::UiObjectInitializer *node = makeAstNode<AST::UiObjectInitializer> (driver->nodePool(), sym(2).UiObjectMemberList->finish());
+ node->lbraceToken = loc(1);
+ node->rbraceToken = loc(3);
+ sym(1).Node = node;
+} break;
+ case 14:
+case 15: {
+ AST::UiObjectBinding *node = makeAstNode<AST::UiObjectBinding> (driver->nodePool(), sym(1).UiQualifiedId->finish(),
+ sym(3).sval, sym(4).UiObjectInitializer);
+ node->colonToken = loc(2);
+ node->identifierToken = loc(3);
+ sym(1).Node = node;
+} break;
+ case 16:
+case 17: {
+ AST::UiObjectDefinition *node = makeAstNode<AST::UiObjectDefinition> (driver->nodePool(), sym(1).sval,
+ sym(2).UiObjectInitializer);
+ node->identifierToken = loc(1);
+ sym(1).Node = node;
+} break;
+ case 18:
+case 19: {
+ AST::UiArrayBinding *node = makeAstNode<AST::UiArrayBinding> (driver->nodePool(), sym(1).UiQualifiedId->finish(),
+ sym(4).UiObjectMemberList->finish());
+ node->colonToken = loc(2);
+ node->lbracketToken = loc(3);
+ node->rbraceToken = loc(5);
+ sym(1).Node = node;
+} break;
+ case 20:
+case 21: {
+ AST::UiScriptBinding *node = makeAstNode<AST::UiScriptBinding> (driver->nodePool(), sym(1).UiQualifiedId->finish(),
+ sym(3).Statement);
+ node->colonToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 22: {
+ AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval);
+ node->publicToken = loc(1);
+ node->attributeTypeToken = loc(2);
+ node->identifierToken = loc(3);
+ sym(1).Node = node;
+} break;
+
+case 23: {
+ AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval,
+ sym(5).Expression);
+ node->publicToken = loc(1);
+ node->attributeTypeToken = loc(2);
+ node->identifierToken = loc(3);
+ node->colonToken = loc(4);
+ sym(1).Node = node;
+} break;
+
+case 24: {
+ sym(1).Node = makeAstNode<AST::UiSourceElement>(driver->nodePool(), sym(1).Node);
+} break;
+
+case 25: {
+ sym(1).Node = makeAstNode<AST::UiSourceElement>(driver->nodePool(), sym(1).Node);
+} break;
+
+case 26: {
+ AST::UiQualifiedId *node = makeAstNode<AST::UiQualifiedId> (driver->nodePool(), sym(1).sval);
+ node->identifierToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 27: {
+ AST::UiQualifiedId *node = makeAstNode<AST::UiQualifiedId> (driver->nodePool(), sym(1).UiQualifiedId, sym(3).sval);
+ node->identifierToken = loc(3);
+ sym(1).Node = node;
+} break;
+
+case 28: {
+ AST::ThisExpression *node = makeAstNode<AST::ThisExpression> (driver->nodePool());
+ node->thisToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 29: {
+ AST::IdentifierExpression *node = makeAstNode<AST::IdentifierExpression> (driver->nodePool(), sym(1).sval);
+ node->identifierToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 30: {
+ AST::NullExpression *node = makeAstNode<AST::NullExpression> (driver->nodePool());
+ node->nullToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 31: {
+ AST::TrueLiteral *node = makeAstNode<AST::TrueLiteral> (driver->nodePool());
+ node->trueToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 32: {
+ AST::FalseLiteral *node = makeAstNode<AST::FalseLiteral> (driver->nodePool());
+ node->falseToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 33: {
+ AST::NumericLiteral *node = makeAstNode<AST::NumericLiteral> (driver->nodePool(), sym(1).dval);
+ node->literalToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 34: {
+ AST::StringLiteral *node = makeAstNode<AST::StringLiteral> (driver->nodePool(), sym(1).sval);
+ node->literalToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 35: {
+ bool rx = lexer->scanRegExp(Lexer::NoPrefix);
+ if (!rx) {
+ diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, lexer->startLineNo(),
+ lexer->startColumnNo(), lexer->errorMessage()));
+ return false;
+ }
+ AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);
+ node->literalToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 36: {
+ bool rx = lexer->scanRegExp(Lexer::EqualPrefix);
+ if (!rx) {
+ diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, lexer->startLineNo(),
+ lexer->startColumnNo(), lexer->errorMessage()));
+ return false;
+ }
+ AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);
+ node->literalToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 37: {
+ AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).Elision);
+ node->lbracketToken = loc(1);
+ node->rbracketToken = loc(3);
+ sym(1).Node = node;
+} break;
+
+case 38: {
+ AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish ());
+ node->lbracketToken = loc(1);
+ node->rbracketToken = loc(3);
+ sym(1).Node = node;
+} break;
+
+case 39: {
+ AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish (), sym(4).Elision);
+ node->lbracketToken = loc(1);
+ node->commaToken = loc(3);
+ node->rbracketToken = loc(5);
+ sym(1).Node = node;
+} break;
+
+case 40: {
+ AST::ObjectLiteral *node = 0;
+ if (sym(2).Node)
+ node = makeAstNode<AST::ObjectLiteral> (driver->nodePool(),
+ sym(2).PropertyNameAndValueList->finish ());
+ else
+ node = makeAstNode<AST::ObjectLiteral> (driver->nodePool());
+ node->lbraceToken = loc(1);
+ node->lbraceToken = loc(3);
+ sym(1).Node = node;
+} break;
+
+case 41: {
+ AST::ObjectLiteral *node = makeAstNode<AST::ObjectLiteral> (driver->nodePool(),
+ sym(2).PropertyNameAndValueList->finish ());
+ node->lbraceToken = loc(1);
+ node->lbraceToken = loc(4);
+ sym(1).Node = node;
+} break;
+
+case 42: {
+ AST::NestedExpression *node = makeAstNode<AST::NestedExpression>(driver->nodePool(), sym(2).Expression);
+ node->lparenToken = loc(1);
+ node->rparenToken = loc(3);
+ sym(1).Node = node;
+} break;
+
+case 43: {
+ sym(1).Node = makeAstNode<AST::ElementList> (driver->nodePool(), sym(1).Elision, sym(2).Expression);
+} break;
+
+case 44: {
+ AST::ElementList *node = makeAstNode<AST::ElementList> (driver->nodePool(), sym(1).ElementList, sym(3).Elision, sym(4).Expression);
+ node->commaToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 45: {
+ AST::Elision *node = makeAstNode<AST::Elision> (driver->nodePool());
+ node->commaToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 46: {
+ AST::Elision *node = makeAstNode<AST::Elision> (driver->nodePool(), sym(1).Elision);
+ node->commaToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 47: {
+ sym(1).Node = 0;
+} break;
+
+case 48: {
+ sym(1).Elision = sym(1).Elision->finish ();
+} break;
+
+case 49: {
+ AST::PropertyNameAndValueList *node = makeAstNode<AST::PropertyNameAndValueList> (driver->nodePool(),
+ sym(1).PropertyName, sym(3).Expression);
+ node->colonToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 50: {
+ AST::PropertyNameAndValueList *node = makeAstNode<AST::PropertyNameAndValueList> (driver->nodePool(),
+ sym(1).PropertyNameAndValueList, sym(3).PropertyName, sym(5).Expression);
+ node->commaToken = loc(2);
+ node->colonToken = loc(4);
+ sym(1).Node = node;
+} break;
+
+case 51: {
+ AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval);
+ node->propertyNameToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 52: {
+ AST::StringLiteralPropertyName *node = makeAstNode<AST::StringLiteralPropertyName> (driver->nodePool(), sym(1).sval);
+ node->propertyNameToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 53: {
+ AST::NumericLiteralPropertyName *node = makeAstNode<AST::NumericLiteralPropertyName> (driver->nodePool(), sym(1).dval);
+ node->propertyNameToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 54: {
+ AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval);
+ node->propertyNameToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 55:
+
+case 56:
+
+case 57:
+
+case 58:
+
+case 59:
+
+case 60:
+
+case 61:
+
+case 62:
+
+case 63:
+
+case 64:
+
+case 65:
+
+case 66:
+
+case 67:
+
+case 68:
+
+case 69:
+
+case 70:
+
+case 71:
+
+case 72:
+
+case 73:
+
+case 74:
+
+case 75:
+
+case 76:
+
+case 77:
+
+case 78:
+
+case 79:
+
+case 80:
+
+case 81:
+
+case 82:
+
+case 83:
+
+case 84:
+
+case 85:
+{
+ sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount());
+} break;
+
+case 90: {
+ AST::ArrayMemberExpression *node = makeAstNode<AST::ArrayMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression);
+ node->lbracketToken = loc(2);
+ node->rbracketToken = loc(4);
+ sym(1).Node = node;
+} break;
+
+case 91: {
+ AST::FieldMemberExpression *node = makeAstNode<AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval);
+ node->dotToken = loc(2);
+ node->identifierToken = loc(3);
+ sym(1).Node = node;
+} break;
+
+case 92: {
+ AST::NewMemberExpression *node = makeAstNode<AST::NewMemberExpression> (driver->nodePool(), sym(2).Expression, sym(4).ArgumentList);
+ node->newToken = loc(1);
+ node->lparenToken = loc(3);
+ node->rparenToken = loc(5);
+ sym(1).Node = node;
+} break;
+
+case 94: {
+ AST::NewExpression *node = makeAstNode<AST::NewExpression> (driver->nodePool(), sym(2).Expression);
+ node->newToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 95: {
+ AST::CallExpression *node = makeAstNode<AST::CallExpression> (driver->nodePool(), sym(1).Expression, sym(3).ArgumentList);
+ node->lparenToken = loc(2);
+ node->rparenToken = loc(4);
+ sym(1).Node = node;
+} break;
+
+case 96: {
+ AST::CallExpression *node = makeAstNode<AST::CallExpression> (driver->nodePool(), sym(1).Expression, sym(3).ArgumentList);
+ node->lparenToken = loc(2);
+ node->rparenToken = loc(4);
+ sym(1).Node = node;
+} break;
+
+case 97: {
+ AST::ArrayMemberExpression *node = makeAstNode<AST::ArrayMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression);
+ node->lbracketToken = loc(2);
+ node->rbracketToken = loc(4);
+ sym(1).Node = node;
+} break;
+
+case 98: {
+ AST::FieldMemberExpression *node = makeAstNode<AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval);
+ node->dotToken = loc(2);
+ node->identifierToken = loc(3);
+ sym(1).Node = node;
+} break;
+
+case 99: {
+ sym(1).Node = 0;
+} break;
+
+case 100: {
+ sym(1).Node = sym(1).ArgumentList->finish();
+} break;
+
+case 101: {
+ sym(1).Node = makeAstNode<AST::ArgumentList> (driver->nodePool(), sym(1).Expression);
+} break;
+
+case 102: {
+ AST::ArgumentList *node = makeAstNode<AST::ArgumentList> (driver->nodePool(), sym(1).ArgumentList, sym(3).Expression);
+ node->commaToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 106: {
+ AST::PostIncrementExpression *node = makeAstNode<AST::PostIncrementExpression> (driver->nodePool(), sym(1).Expression);
+ node->incrementToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 107: {
+ AST::PostDecrementExpression *node = makeAstNode<AST::PostDecrementExpression> (driver->nodePool(), sym(1).Expression);
+ node->decrementToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 109: {
+ AST::DeleteExpression *node = makeAstNode<AST::DeleteExpression> (driver->nodePool(), sym(2).Expression);
+ node->deleteToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 110: {
+ AST::VoidExpression *node = makeAstNode<AST::VoidExpression> (driver->nodePool(), sym(2).Expression);
+ node->voidToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 111: {
+ AST::TypeOfExpression *node = makeAstNode<AST::TypeOfExpression> (driver->nodePool(), sym(2).Expression);
+ node->typeofToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 112: {
+ AST::PreIncrementExpression *node = makeAstNode<AST::PreIncrementExpression> (driver->nodePool(), sym(2).Expression);
+ node->incrementToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 113: {
+ AST::PreDecrementExpression *node = makeAstNode<AST::PreDecrementExpression> (driver->nodePool(), sym(2).Expression);
+ node->decrementToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 114: {
+ AST::UnaryPlusExpression *node = makeAstNode<AST::UnaryPlusExpression> (driver->nodePool(), sym(2).Expression);
+ node->plusToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 115: {
+ AST::UnaryMinusExpression *node = makeAstNode<AST::UnaryMinusExpression> (driver->nodePool(), sym(2).Expression);
+ node->minusToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 116: {
+ AST::TildeExpression *node = makeAstNode<AST::TildeExpression> (driver->nodePool(), sym(2).Expression);
+ node->tildeToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 117: {
+ AST::NotExpression *node = makeAstNode<AST::NotExpression> (driver->nodePool(), sym(2).Expression);
+ node->notToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 119: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Mul, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 120: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Div, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 121: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Mod, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 123: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Add, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 124: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Sub, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 126: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::LShift, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 127: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::RShift, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 128: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::URShift, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 130: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Lt, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 131: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Gt, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 132: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Le, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 133: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Ge, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 134: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::InstanceOf, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 135: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::In, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 137: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Lt, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 138: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Gt, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 139: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Le, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 140: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Ge, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 141: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::InstanceOf, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 143: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Equal, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 144: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::NotEqual, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 145: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::StrictEqual, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 146: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::StrictNotEqual, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 148: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Equal, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 149: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::NotEqual, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 150: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::StrictEqual, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 151: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::StrictNotEqual, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 153: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::BitAnd, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 155: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::BitAnd, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 157: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::BitXor, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 159: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::BitXor, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 161: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::BitOr, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 163: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::BitOr, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 165: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::And, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 167: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::And, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 169: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Or, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 171: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Or, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 173: {
+ AST::ConditionalExpression *node = makeAstNode<AST::ConditionalExpression> (driver->nodePool(), sym(1).Expression,
+ sym(3).Expression, sym(5).Expression);
+ node->questionToken = loc(2);
+ node->colonToken = loc(4);
+ sym(1).Node = node;
+} break;
+
+case 175: {
+ AST::ConditionalExpression *node = makeAstNode<AST::ConditionalExpression> (driver->nodePool(), sym(1).Expression,
+ sym(3).Expression, sym(5).Expression);
+ node->questionToken = loc(2);
+ node->colonToken = loc(4);
+ sym(1).Node = node;
+} break;
+
+case 177: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ sym(2).ival, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 179: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ sym(2).ival, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 180: {
+ sym(1).ival = QSOperator::Assign;
+} break;
+
+case 181: {
+ sym(1).ival = QSOperator::InplaceMul;
+} break;
+
+case 182: {
+ sym(1).ival = QSOperator::InplaceDiv;
+} break;
+
+case 183: {
+ sym(1).ival = QSOperator::InplaceMod;
+} break;
+
+case 184: {
+ sym(1).ival = QSOperator::InplaceAdd;
+} break;
+
+case 185: {
+ sym(1).ival = QSOperator::InplaceSub;
+} break;
+
+case 186: {
+ sym(1).ival = QSOperator::InplaceLeftShift;
+} break;
+
+case 187: {
+ sym(1).ival = QSOperator::InplaceRightShift;
+} break;
+
+case 188: {
+ sym(1).ival = QSOperator::InplaceURightShift;
+} break;
+
+case 189: {
+ sym(1).ival = QSOperator::InplaceAnd;
+} break;
+
+case 190: {
+ sym(1).ival = QSOperator::InplaceXor;
+} break;
+
+case 191: {
+ sym(1).ival = QSOperator::InplaceOr;
+} break;
+
+case 193: {
+ AST::Expression *node = makeAstNode<AST::Expression> (driver->nodePool(), sym(1).Expression, sym(3).Expression);
+ node->commaToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 194: {
+ sym(1).Node = 0;
+} break;
+
+case 197: {
+ AST::Expression *node = makeAstNode<AST::Expression> (driver->nodePool(), sym(1).Expression, sym(3).Expression);
+ node->commaToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 198: {
+ sym(1).Node = 0;
+} break;
+
+case 215: {
+ AST::Block *node = makeAstNode<AST::Block> (driver->nodePool(), sym(2).StatementList);
+ node->lbraceToken = loc(1);
+ node->rbraceToken = loc(3);
+ sym(1).Node = node;
+} break;
+
+case 216: {
+ sym(1).Node = makeAstNode<AST::StatementList> (driver->nodePool(), sym(1).Statement);
+} break;
+
+case 217: {
+ sym(1).Node = makeAstNode<AST::StatementList> (driver->nodePool(), sym(1).StatementList, sym(2).Statement);
+} break;
+
+case 218: {
+ sym(1).Node = 0;
+} break;
+
+case 219: {
+ sym(1).Node = sym(1).StatementList->finish ();
+} break;
+
+case 221: {
+ AST::VariableStatement *node = makeAstNode<AST::VariableStatement> (driver->nodePool(),
+ sym(2).VariableDeclarationList->finish (/*readOnly=*/sym(1).ival == T_CONST));
+ node->declarationKindToken = loc(1);
+ node->semicolonToken = loc(3);
+ sym(1).Node = node;
+} break;
+
+case 222: {
+ sym(1).ival = T_CONST;
+} break;
+
+case 223: {
+ sym(1).ival = T_VAR;
+} break;
+
+case 224: {
+ sym(1).Node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclaration);
+} break;
+
+case 225: {
+ AST::VariableDeclarationList *node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(),
+ sym(1).VariableDeclarationList, sym(3).VariableDeclaration);
+ node->commaToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 226: {
+ sym(1).Node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclaration);
+} break;
+
+case 227: {
+ sym(1).Node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclarationList, sym(3).VariableDeclaration);
+} break;
+
+case 228: {
+ AST::VariableDeclaration *node = makeAstNode<AST::VariableDeclaration> (driver->nodePool(), sym(1).sval, sym(2).Expression);
+ node->identifierToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 229: {
+ AST::VariableDeclaration *node = makeAstNode<AST::VariableDeclaration> (driver->nodePool(), sym(1).sval, sym(2).Expression);
+ node->identifierToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 230: {
+ // ### TODO: AST for initializer
+ sym(1) = sym(2);
+} break;
+
+case 231: {
+ sym(1).Node = 0;
+} break;
+
+case 233: {
+ // ### TODO: AST for initializer
+ sym(1) = sym(2);
+} break;
+
+case 234: {
+ sym(1).Node = 0;
+} break;
+
+case 236: {
+ AST::EmptyStatement *node = makeAstNode<AST::EmptyStatement> (driver->nodePool());
+ node->semicolonToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 238: {
+ AST::ExpressionStatement *node = makeAstNode<AST::ExpressionStatement> (driver->nodePool(), sym(1).Expression);
+ node->semicolonToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 239: {
+ AST::IfStatement *node = makeAstNode<AST::IfStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement, sym(7).Statement);
+ node->ifToken = loc(1);
+ node->lparenToken = loc(2);
+ node->rparenToken = loc(4);
+ node->elseToken = loc(5);
+ sym(1).Node = node;
+} break;
+
+case 240: {
+ AST::IfStatement *node = makeAstNode<AST::IfStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement);
+ node->ifToken = loc(1);
+ node->lparenToken = loc(2);
+ node->rparenToken = loc(4);
+ sym(1).Node = node;
+} break;
+
+case 242: {
+ AST::DoWhileStatement *node = makeAstNode<AST::DoWhileStatement> (driver->nodePool(), sym(2).Statement, sym(5).Expression);
+ node->doToken = loc(1);
+ node->whileToken = loc(3);
+ node->lparenToken = loc(4);
+ node->rparenToken = loc(6);
+ node->semicolonToken = loc(7);
+ sym(1).Node = node;
+} break;
+
+case 243: {
+ AST::WhileStatement *node = makeAstNode<AST::WhileStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement);
+ node->whileToken = loc(1);
+ node->lparenToken = loc(2);
+ node->rparenToken = loc(4);
+ sym(1).Node = node;
+} break;
+
+case 244: {
+ AST::ForStatement *node = makeAstNode<AST::ForStatement> (driver->nodePool(), sym(3).Expression,
+ sym(5).Expression, sym(7).Expression, sym(9).Statement);
+ node->forToken = loc(1);
+ node->lparenToken = loc(2);
+ node->firstSemicolonToken = loc(4);
+ node->secondSemicolonToken = loc(6);
+ node->rparenToken = loc(8);
+ sym(1).Node = node;
+} break;
+
+case 245: {
+ AST::LocalForStatement *node = makeAstNode<AST::LocalForStatement> (driver->nodePool(),
+ sym(4).VariableDeclarationList->finish (/*readOnly=*/false), sym(6).Expression,
+ sym(8).Expression, sym(10).Statement);
+ node->forToken = loc(1);
+ node->lparenToken = loc(2);
+ node->varToken = loc(3);
+ node->firstSemicolonToken = loc(5);
+ node->secondSemicolonToken = loc(7);
+ node->rparenToken = loc(9);
+ sym(1).Node = node;
+} break;
+
+case 246: {
+ AST:: ForEachStatement *node = makeAstNode<AST::ForEachStatement> (driver->nodePool(), sym(3).Expression,
+ sym(5).Expression, sym(7).Statement);
+ node->forToken = loc(1);
+ node->lparenToken = loc(2);
+ node->inToken = loc(4);
+ node->rparenToken = loc(6);
+ sym(1).Node = node;
+} break;
+
+case 247: {
+ AST::LocalForEachStatement *node = makeAstNode<AST::LocalForEachStatement> (driver->nodePool(),
+ sym(4).VariableDeclaration, sym(6).Expression, sym(8).Statement);
+ node->forToken = loc(1);
+ node->lparenToken = loc(2);
+ node->varToken = loc(3);
+ node->inToken = loc(5);
+ node->rparenToken = loc(7);
+ sym(1).Node = node;
+} break;
+
+case 249: {
+ AST::ContinueStatement *node = makeAstNode<AST::ContinueStatement> (driver->nodePool());
+ node->continueToken = loc(1);
+ node->semicolonToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 251: {
+ AST::ContinueStatement *node = makeAstNode<AST::ContinueStatement> (driver->nodePool(), sym(2).sval);
+ node->continueToken = loc(1);
+ node->identifierToken = loc(2);
+ node->semicolonToken = loc(3);
+ sym(1).Node = node;
+} break;
+
+case 253: {
+ AST::BreakStatement *node = makeAstNode<AST::BreakStatement> (driver->nodePool());
+ node->breakToken = loc(1);
+ node->semicolonToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 255: {
+ AST::BreakStatement *node = makeAstNode<AST::BreakStatement> (driver->nodePool(), sym(2).sval);
+ node->breakToken = loc(1);
+ node->identifierToken = loc(2);
+ node->semicolonToken = loc(3);
+ sym(1).Node = node;
+} break;
+
+case 257: {
+ AST::ReturnStatement *node = makeAstNode<AST::ReturnStatement> (driver->nodePool(), sym(2).Expression);
+ node->returnToken = loc(1);
+ node->semicolonToken = loc(3);
+ sym(1).Node = node;
+} break;
+
+case 258: {
+ AST::WithStatement *node = makeAstNode<AST::WithStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement);
+ node->withToken = loc(1);
+ node->lparenToken = loc(2);
+ node->rparenToken = loc(4);
+ sym(1).Node = node;
+} break;
+
+case 259: {
+ AST::SwitchStatement *node = makeAstNode<AST::SwitchStatement> (driver->nodePool(), sym(3).Expression, sym(5).CaseBlock);
+ node->switchToken = loc(1);
+ node->lparenToken = loc(2);
+ node->rparenToken = loc(4);
+ sym(1).Node = node;
+} break;
+
+case 260: {
+ AST::CaseBlock *node = makeAstNode<AST::CaseBlock> (driver->nodePool(), sym(2).CaseClauses);
+ node->lbraceToken = loc(1);
+ node->rbraceToken = loc(3);
+ sym(1).Node = node;
+} break;
+
+case 261: {
+ AST::CaseBlock *node = makeAstNode<AST::CaseBlock> (driver->nodePool(), sym(2).CaseClauses, sym(3).DefaultClause, sym(4).CaseClauses);
+ node->lbraceToken = loc(1);
+ node->rbraceToken = loc(5);
+ sym(1).Node = node;
+} break;
+
+case 262: {
+ sym(1).Node = makeAstNode<AST::CaseClauses> (driver->nodePool(), sym(1).CaseClause);
+} break;
+
+case 263: {
+ sym(1).Node = makeAstNode<AST::CaseClauses> (driver->nodePool(), sym(1).CaseClauses, sym(2).CaseClause);
+} break;
+
+case 264: {
+ sym(1).Node = 0;
+} break;
+
+case 265: {
+ sym(1).Node = sym(1).CaseClauses->finish ();
+} break;
+
+case 266: {
+ AST::CaseClause *node = makeAstNode<AST::CaseClause> (driver->nodePool(), sym(2).Expression, sym(4).StatementList);
+ node->caseToken = loc(1);
+ node->colonToken = loc(3);
+ sym(1).Node = node;
+} break;
+
+case 267: {
+ AST::DefaultClause *node = makeAstNode<AST::DefaultClause> (driver->nodePool(), sym(3).StatementList);
+ node->defaultToken = loc(1);
+ node->colonToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 268: {
+ AST::LabelledStatement *node = makeAstNode<AST::LabelledStatement> (driver->nodePool(), sym(1).sval, sym(3).Statement);
+ node->identifierToken = loc(1);
+ node->colonToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 270: {
+ AST::ThrowStatement *node = makeAstNode<AST::ThrowStatement> (driver->nodePool(), sym(2).Expression);
+ node->throwToken = loc(1);
+ node->semicolonToken = loc(3);
+ sym(1).Node = node;
+} break;
+
+case 271: {
+ AST::TryStatement *node = makeAstNode<AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Catch);
+ node->tryToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 272: {
+ AST::TryStatement *node = makeAstNode<AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Finally);
+ node->tryToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 273: {
+ AST::TryStatement *node = makeAstNode<AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Catch, sym(4).Finally);
+ node->tryToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 274: {
+ AST::Catch *node = makeAstNode<AST::Catch> (driver->nodePool(), sym(3).sval, sym(5).Block);
+ node->catchToken = loc(1);
+ node->lparenToken = loc(2);
+ node->identifierToken = loc(3);
+ node->rparenToken = loc(4);
+ sym(1).Node = node;
+} break;
+
+case 275: {
+ AST::Finally *node = makeAstNode<AST::Finally> (driver->nodePool(), sym(2).Block);
+ node->finallyToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 277: {
+ AST::DebuggerStatement *node = makeAstNode<AST::DebuggerStatement> (driver->nodePool());
+ node->debuggerToken = loc(1);
+ node->semicolonToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 278: {
+ AST::FunctionDeclaration *node = makeAstNode<AST::FunctionDeclaration> (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody);
+ node->functionToken = loc(1);
+ node->identifierToken = loc(2);
+ node->lparenToken = loc(3);
+ node->rparenToken = loc(5);
+ node->lbraceToken = loc(6);
+ node->rbraceToken = loc(8);
+ sym(1).Node = node;
+} break;
+
+case 279: {
+ AST::FunctionExpression *node = makeAstNode<AST::FunctionExpression> (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody);
+ node->functionToken = loc(1);
+ if (sym(2).sval)
+ node->identifierToken = loc(2);
+ node->lparenToken = loc(3);
+ node->rparenToken = loc(5);
+ node->lbraceToken = loc(6);
+ node->rbraceToken = loc(8);
+ sym(1).Node = node;
+} break;
+
+case 280: {
+ AST::FormalParameterList *node = makeAstNode<AST::FormalParameterList> (driver->nodePool(), sym(1).sval);
+ node->identifierToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 281: {
+ AST::FormalParameterList *node = makeAstNode<AST::FormalParameterList> (driver->nodePool(), sym(1).FormalParameterList, sym(3).sval);
+ node->commaToken = loc(2);
+ node->identifierToken = loc(3);
+ sym(1).Node = node;
+} break;
+
+case 282: {
+ sym(1).Node = 0;
+} break;
+
+case 283: {
+ sym(1).Node = sym(1).FormalParameterList->finish ();
+} break;
+
+case 284: {
+ sym(1).Node = 0;
+} break;
+
+case 286: {
+ sym(1).Node = makeAstNode<AST::FunctionBody> (driver->nodePool(), sym(1).SourceElements->finish ());
+} break;
+
+case 287: {
+ sym(1).Node = makeAstNode<AST::SourceElements> (driver->nodePool(), sym(1).SourceElement);
+} break;
+
+case 288: {
+ sym(1).Node = makeAstNode<AST::SourceElements> (driver->nodePool(), sym(1).SourceElements, sym(2).SourceElement);
+} break;
+
+case 289: {
+ sym(1).Node = makeAstNode<AST::StatementSourceElement> (driver->nodePool(), sym(1).Statement);
+} break;
+
+case 290: {
+ sym(1).Node = makeAstNode<AST::FunctionSourceElement> (driver->nodePool(), sym(1).FunctionDeclaration);
+} break;
+
+case 291: {
+ sym(1).sval = 0;
+} break;
+
+case 293: {
+ sym(1).Node = 0;
+} break;
+
+ } // switch
+ action = nt_action(state_stack[tos], lhs[r] - TERMINAL_COUNT);
+ } // if
+ } while (action != 0);
+
+ if (first_token == last_token) {
+ const int errorState = state_stack[tos];
+
+ // automatic insertion of `;'
+ if (t_action(errorState, T_AUTOMATIC_SEMICOLON) && automatic(driver, yytoken)) {
+ SavedToken &tk = token_buffer[0];
+ tk.token = yytoken;
+ tk.dval = yylval;
+ tk.loc = yylloc;
+
+ yylloc.length = 0;
+
+ const QString msg = QString::fromUtf8("Missing `;'");
+
+ diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning,
+ yyprevlloc.startLine, yyprevlloc.startColumn, msg));
+
+ first_token = &token_buffer[0];
+ last_token = &token_buffer[1];
+
+ yytoken = T_SEMICOLON;
+ yylval = 0;
+
+ action = errorState;
+
+ goto _Lcheck_token;
+ }
+
+ hadErrors = true;
+
+ token_buffer[0].token = yytoken;
+ token_buffer[0].dval = yylval;
+ token_buffer[0].loc = yylloc;
+
+ token_buffer[1].token = yytoken = lexer->lex();
+ token_buffer[1].dval = yylval = lexer->dval();
+ token_buffer[1].loc = yylloc = location(lexer);
+
+ if (t_action(errorState, yytoken)) {
+ const QString msg = QString::fromUtf8("Unexpected token `%1'").arg(QLatin1String(spell[token_buffer[0].token]));
+
+ diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error,
+ token_buffer[0].loc.startLine, token_buffer[0].loc.startColumn, msg));
+
+ action = errorState;
+ goto _Lcheck_token;
+ }
+
+ static int tokens[] = {
+ T_PLUS,
+ T_EQ,
+
+ T_COMMA,
+ T_COLON,
+ T_SEMICOLON,
+
+ T_RPAREN, T_RBRACKET, T_RBRACE,
+
+ T_NUMERIC_LITERAL,
+ T_IDENTIFIER,
+
+ T_LPAREN, T_LBRACKET, T_LBRACE,
+
+ EOF_SYMBOL
+ };
+
+ for (int *tk = tokens; *tk != EOF_SYMBOL; ++tk) {
+ int a = t_action(errorState, *tk);
+ if (a > 0 && t_action(a, yytoken)) {
+ const QString msg = QString::fromUtf8("Expected token `%1'").arg(QLatin1String(spell[*tk]));
+
+ diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error,
+ token_buffer[0].loc.startLine, token_buffer[0].loc.startColumn, msg));
+
+ yytoken = *tk;
+ yylval = 0;
+ yylloc = token_buffer[0].loc;
+
+ first_token = &token_buffer[0];
+ last_token = &token_buffer[2];
+
+ action = errorState;
+ goto _Lcheck_token;
+ }
+ }
+
+ for (int tk = 1; tk < TERMINAL_COUNT; ++tk) {
+ if (tk == T_AUTOMATIC_SEMICOLON)
+ continue;
+
+ int a = t_action(errorState, tk);
+ if (a > 0 && t_action(a, yytoken)) {
+ const QString msg = QString::fromUtf8("Expected token `%1'").arg(QLatin1String(spell[tk]));
+ diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error,
+ token_buffer[0].loc.startLine, token_buffer[0].loc.startColumn, msg));
+
+ yytoken = tk;
+ yylval = 0;
+ yylloc = token_buffer[0].loc;
+
+ action = errorState;
+ goto _Lcheck_token;
+ }
+ }
+
+ const QString msg = QString::fromUtf8("Syntax error");
+ diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error,
+ token_buffer[0].loc.startLine, token_buffer[0].loc.startColumn, msg));
+ }
+
+ return false;
+}
+
+QT_END_NAMESPACE
+
+
diff --git a/src/declarative/qml/parser/javascriptparser_p.h b/src/declarative/qml/parser/javascriptparser_p.h
new file mode 100644
index 0000000..c08a14a
--- /dev/null
+++ b/src/declarative/qml/parser/javascriptparser_p.h
@@ -0,0 +1,215 @@
+// This file was generated by qlalr - DO NOT EDIT!
+
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtScript module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+//
+// This file is automatically generated from javascript.g.
+// Changes will be lost.
+//
+
+#ifndef JAVASCRIPTPARSER_P_H
+#define JAVASCRIPTPARSER_P_H
+
+#include "javascriptgrammar_p.h"
+#include "javascriptast_p.h"
+#include <QtCore/QList>
+
+QT_BEGIN_NAMESPACE
+
+class QString;
+class JavaScriptEnginePrivate;
+class JavaScriptNameIdImpl;
+
+class JavaScriptParser: protected JavaScriptGrammar
+{
+public:
+ union Value {
+ int ival;
+ double dval;
+ JavaScriptNameIdImpl *sval;
+ JavaScript::AST::ArgumentList *ArgumentList;
+ JavaScript::AST::CaseBlock *CaseBlock;
+ JavaScript::AST::CaseClause *CaseClause;
+ JavaScript::AST::CaseClauses *CaseClauses;
+ JavaScript::AST::Catch *Catch;
+ JavaScript::AST::DefaultClause *DefaultClause;
+ JavaScript::AST::ElementList *ElementList;
+ JavaScript::AST::Elision *Elision;
+ JavaScript::AST::ExpressionNode *Expression;
+ JavaScript::AST::Finally *Finally;
+ JavaScript::AST::FormalParameterList *FormalParameterList;
+ JavaScript::AST::FunctionBody *FunctionBody;
+ JavaScript::AST::FunctionDeclaration *FunctionDeclaration;
+ JavaScript::AST::Node *Node;
+ JavaScript::AST::PropertyName *PropertyName;
+ JavaScript::AST::PropertyNameAndValueList *PropertyNameAndValueList;
+ JavaScript::AST::SourceElement *SourceElement;
+ JavaScript::AST::SourceElements *SourceElements;
+ JavaScript::AST::Statement *Statement;
+ JavaScript::AST::StatementList *StatementList;
+ JavaScript::AST::Block *Block;
+ JavaScript::AST::VariableDeclaration *VariableDeclaration;
+ JavaScript::AST::VariableDeclarationList *VariableDeclarationList;
+
+ JavaScript::AST::UiProgram *UiProgram;
+ JavaScript::AST::UiImportList *UiImportList;
+ JavaScript::AST::UiImport *UiImport;
+ JavaScript::AST::UiPublicMember *UiPublicMember;
+ JavaScript::AST::UiObjectDefinition *UiObjectDefinition;
+ JavaScript::AST::UiObjectInitializer *UiObjectInitializer;
+ JavaScript::AST::UiObjectBinding *UiObjectBinding;
+ JavaScript::AST::UiScriptBinding *UiScriptBinding;
+ JavaScript::AST::UiArrayBinding *UiArrayBinding;
+ JavaScript::AST::UiObjectMember *UiObjectMember;
+ JavaScript::AST::UiObjectMemberList *UiObjectMemberList;
+ JavaScript::AST::UiQualifiedId *UiQualifiedId;
+ };
+
+ struct DiagnosticMessage {
+ enum Kind { Warning, Error };
+
+ DiagnosticMessage()
+ : kind(Error), line(0), column(0) {}
+
+ DiagnosticMessage(Kind kind, int line, int column, const QString &message)
+ : kind(kind), line(line), column(column), message(message) {}
+
+ bool isWarning() const
+ { return kind == Warning; }
+
+ bool isError() const
+ { return kind == Error; }
+
+ Kind kind;
+ int line;
+ int column;
+ QString message;
+ };
+
+public:
+ JavaScriptParser();
+ ~JavaScriptParser();
+
+ bool parse(JavaScriptEnginePrivate *driver);
+
+ JavaScript::AST::UiProgram *ast()
+ { return sym(1).UiProgram; }
+
+ QList<DiagnosticMessage> diagnosticMessages() const
+ { return diagnostic_messages; }
+
+ inline DiagnosticMessage diagnosticMessage() const
+ {
+ foreach (const DiagnosticMessage &d, diagnostic_messages) {
+ if (! d.kind == DiagnosticMessage::Warning)
+ return d;
+ }
+
+ return DiagnosticMessage();
+ }
+
+ inline QString errorMessage() const
+ { return diagnosticMessage().message; }
+
+ inline int errorLineNumber() const
+ { return diagnosticMessage().line; }
+
+ inline int errorColumnNumber() const
+ { return diagnosticMessage().column; }
+
+protected:
+ void reallocateStack();
+
+ inline Value &sym(int index)
+ { return sym_stack [tos + index - 1]; }
+
+ inline JavaScript::AST::SourceLocation &loc(int index)
+ { return location_stack [tos + index - 1]; }
+
+protected:
+ int tos;
+ int stack_size;
+ Value *sym_stack;
+ int *state_stack;
+ JavaScript::AST::SourceLocation *location_stack;
+
+ // error recovery
+ enum { TOKEN_BUFFER_SIZE = 3 };
+
+ struct SavedToken {
+ int token;
+ double dval;
+ JavaScript::AST::SourceLocation loc;
+ };
+
+ double yylval;
+ JavaScript::AST::SourceLocation yylloc;
+ JavaScript::AST::SourceLocation yyprevlloc;
+
+ SavedToken token_buffer[TOKEN_BUFFER_SIZE];
+ SavedToken *first_token;
+ SavedToken *last_token;
+
+ QList<DiagnosticMessage> diagnostic_messages;
+};
+
+
+#define J_SCRIPT_REGEXPLITERAL_RULE1 35
+
+#define J_SCRIPT_REGEXPLITERAL_RULE2 36
+
+QT_END_NAMESPACE
+
+
+
+#endif // JAVASCRIPTPARSER_P_H
diff --git a/src/declarative/qml/parser/javascriptprettypretty.cpp b/src/declarative/qml/parser/javascriptprettypretty.cpp
new file mode 100644
index 0000000..6e632b7
--- /dev/null
+++ b/src/declarative/qml/parser/javascriptprettypretty.cpp
@@ -0,0 +1,1334 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtScript module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "javascriptprettypretty_p.h"
+
+
+
+#include "javascriptengine_p.h"
+
+
+
+
+#include "javascriptast_p.h"
+
+#include <QtCore/QString>
+#include <QtCore/QTextStream>
+#include <QtCore/QtDebug>
+
+QT_BEGIN_NAMESPACE
+
+namespace JavaScript {
+QString numberToString(qjsreal value);
+}
+
+using namespace JavaScript;
+
+PrettyPretty::PrettyPretty(QTextStream &o):
+ out(o), m_indentLevel(0)
+{
+}
+
+PrettyPretty::~PrettyPretty()
+{
+}
+
+void PrettyPretty::acceptAsBlock(AST::Node *node)
+{
+ out << "{";
+ pushIndentLevel();
+ newlineAndIndent();
+ accept(node);
+ popIndentLevel();
+ newlineAndIndent();
+ out << "}";
+}
+
+int PrettyPretty::operatorPrecedenceLevel(int op)
+{
+ switch (op) {
+ case QSOperator::Div:
+ case QSOperator::Mod:
+ case QSOperator::Mul:
+ return 5;
+ case QSOperator::Add:
+ case QSOperator::Sub:
+ return 6;
+ case QSOperator::LShift:
+ case QSOperator::RShift:
+ case QSOperator::URShift:
+ return 7;
+ case QSOperator::Ge:
+ case QSOperator::Gt:
+ case QSOperator::In:
+ case QSOperator::InstanceOf:
+ case QSOperator::Le:
+ case QSOperator::Lt:
+ return 8;
+ case QSOperator::Equal:
+ case QSOperator::NotEqual:
+ case QSOperator::StrictEqual:
+ case QSOperator::StrictNotEqual:
+ return 9;
+ case QSOperator::BitAnd:
+ return 10;
+ case QSOperator::BitXor:
+ return 11;
+ case QSOperator::BitOr:
+ return 12;
+ case QSOperator::And:
+ return 13;
+ case QSOperator::Or:
+ return 14;
+ case QSOperator::InplaceAnd:
+ case QSOperator::InplaceSub:
+ case QSOperator::InplaceDiv:
+ case QSOperator::InplaceAdd:
+ case QSOperator::InplaceLeftShift:
+ case QSOperator::InplaceMod:
+ case QSOperator::InplaceMul:
+ case QSOperator::InplaceOr:
+ case QSOperator::InplaceRightShift:
+ case QSOperator::InplaceURightShift:
+ case QSOperator::InplaceXor:
+ case QSOperator::Assign:
+ return 16;
+ default:
+ Q_ASSERT_X(false, "PrettyPretty::operatorPrecedenceLevel()", "bad operator");
+ }
+ return 0;
+}
+
+int PrettyPretty::compareOperatorPrecedence(int op1, int op2)
+{
+ int prec1 = operatorPrecedenceLevel(op1);
+ int prec2 = operatorPrecedenceLevel(op2);
+ if (prec1 == prec2)
+ return 0;
+ if (prec1 > prec2)
+ return -1;
+ return 1;
+}
+
+QTextStream &PrettyPretty::operator () (AST::Node *node, int level)
+{
+ int was = indentLevel(level);
+ accept(node);
+ indentLevel(was);
+ return out;
+}
+
+QTextStream &PrettyPretty::newlineAndIndent()
+{
+ enum { IND = 4 };
+ out << endl << QString().fill(QLatin1Char(' '), m_indentLevel * IND);
+ return out;
+}
+
+void PrettyPretty::accept(AST::Node *node)
+{
+ AST::Node::acceptChild(node, this);
+}
+
+bool PrettyPretty::visit(AST::ThisExpression *node)
+{
+ Q_UNUSED(node);
+ out << "this";
+ return true;
+}
+
+void PrettyPretty::endVisit(AST::ThisExpression *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::IdentifierExpression *node)
+{
+ out << JavaScriptEnginePrivate::toString(node->name);
+ return true;
+}
+
+void PrettyPretty::endVisit(AST::IdentifierExpression *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::NullExpression *node)
+{
+ Q_UNUSED(node);
+ out << "null";
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::NullExpression *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::TrueLiteral *node)
+{
+ Q_UNUSED(node);
+ out << "true";
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::TrueLiteral *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::FalseLiteral *node)
+{
+ Q_UNUSED(node);
+ out << "false";
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::FalseLiteral *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::StringLiteral *node)
+{
+ QString lit = JavaScriptEnginePrivate::toString(node->value);
+ lit.replace(QLatin1String("\\"), QLatin1String("\\\\"));
+ out << "\"" << lit << "\"";
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::StringLiteral *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::NumericLiteral *node)
+{
+ out << JavaScript::numberToString(node->value);
+ return true;
+}
+
+void PrettyPretty::endVisit(AST::NumericLiteral *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::RegExpLiteral *node)
+{
+ out << "/" << JavaScriptEnginePrivate::toString(node->pattern) << "/";
+ if (node->flags)
+ out << JavaScript::Ecma::RegExp::flagsToString(node->flags);
+
+ return true;
+}
+
+void PrettyPretty::endVisit(AST::RegExpLiteral *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::ArrayLiteral *node)
+{
+ out << "[";
+ accept(node->elements);
+ accept(node->elision);
+ out << "]";
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::ArrayLiteral *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::ObjectLiteral *node)
+{
+ out << "{";
+ if (node->properties) {
+ pushIndentLevel();
+ AST::PropertyNameAndValueList *prop;
+ for (prop = node->properties; prop != 0; prop = prop->next) {
+ newlineAndIndent();
+ accept(prop);
+ if (prop->next)
+ out << ",";
+ }
+ popIndentLevel();
+ newlineAndIndent();
+ }
+ out << "}";
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::ObjectLiteral *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::ElementList *node)
+{
+ accept(node->elision);
+ accept(node->expression);
+ for (node = node->next; node != 0; node = node->next) {
+ out << ", ";
+ accept(node->elision);
+ accept(node->expression);
+ }
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::ElementList *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::Elision *node)
+{
+ out << ", ";
+ for (AST::Elision *eit = node->next; eit != 0; eit = eit->next)
+ out << ", ";
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::Elision *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::PropertyNameAndValueList *node)
+{
+ accept(node->name);
+ out << ": ";
+ accept(node->value);
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::PropertyNameAndValueList *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::IdentifierPropertyName *node)
+{
+ out << JavaScriptEnginePrivate::toString(node->id);
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::IdentifierPropertyName *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::StringLiteralPropertyName *node)
+{
+ QString lit = JavaScriptEnginePrivate::toString(node->id);
+ lit.replace(QLatin1String("\\"), QLatin1String("\\\\"));
+ out << lit;
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::StringLiteralPropertyName *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::NumericLiteralPropertyName *node)
+{
+ out << node->id;
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::NumericLiteralPropertyName *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::ArrayMemberExpression *node)
+{
+ accept(node->base);
+ out << "[";
+ accept(node->expression);
+ out << "]";
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::ArrayMemberExpression *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::FieldMemberExpression *node)
+{
+ accept(node->base);
+ out << "." << JavaScriptEnginePrivate::toString(node->name);
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::FieldMemberExpression *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::NewMemberExpression *node)
+{
+ out << "new ";
+ accept(node->base);
+ out << "(";
+ accept(node->arguments);
+ out << ")";
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::NewMemberExpression *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::NewExpression *node)
+{
+ Q_UNUSED(node);
+ out << "new ";
+ return true;
+}
+
+void PrettyPretty::endVisit(AST::NewExpression *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::CallExpression *node)
+{
+ accept(node->base);
+ out << "(";
+ accept(node->arguments);
+ out << ")";
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::CallExpression *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::ArgumentList *node)
+{
+ accept(node->expression);
+ for (node = node->next; node != 0; node = node->next) {
+ out << ", ";
+ accept(node->expression);
+ }
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::ArgumentList *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::PostIncrementExpression *node)
+{
+ Q_UNUSED(node);
+ return true;
+}
+
+void PrettyPretty::endVisit(AST::PostIncrementExpression *node)
+{
+ Q_UNUSED(node);
+ out << "++";
+}
+
+bool PrettyPretty::visit(AST::PostDecrementExpression *node)
+{
+ Q_UNUSED(node);
+ return true;
+}
+
+void PrettyPretty::endVisit(AST::PostDecrementExpression *node)
+{
+ Q_UNUSED(node);
+ out << "--";
+}
+
+bool PrettyPretty::visit(AST::DeleteExpression *node)
+{
+ Q_UNUSED(node);
+ out << "delete ";
+ return true;
+}
+
+void PrettyPretty::endVisit(AST::DeleteExpression *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::VoidExpression *node)
+{
+ Q_UNUSED(node);
+ out << "void ";
+ return true;
+}
+
+void PrettyPretty::endVisit(AST::VoidExpression *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::TypeOfExpression *node)
+{
+ Q_UNUSED(node);
+ out << "typeof ";
+ return true;
+}
+
+void PrettyPretty::endVisit(AST::TypeOfExpression *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::PreIncrementExpression *node)
+{
+ Q_UNUSED(node);
+ out << "++";
+ return true;
+}
+
+void PrettyPretty::endVisit(AST::PreIncrementExpression *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::PreDecrementExpression *node)
+{
+ Q_UNUSED(node);
+ out << "--";
+ return true;
+}
+
+void PrettyPretty::endVisit(AST::PreDecrementExpression *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::UnaryPlusExpression *node)
+{
+ out << "+";
+ bool needParens = (node->expression->binaryExpressionCast() != 0);
+ if (needParens)
+ out << "(";
+ accept(node->expression);
+ if (needParens)
+ out << ")";
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::UnaryPlusExpression *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::UnaryMinusExpression *node)
+{
+ out << "-";
+ bool needParens = (node->expression->binaryExpressionCast() != 0);
+ if (needParens)
+ out << "(";
+ accept(node->expression);
+ if (needParens)
+ out << ")";
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::UnaryMinusExpression *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::TildeExpression *node)
+{
+ out << "~";
+ bool needParens = (node->expression->binaryExpressionCast() != 0);
+ if (needParens)
+ out << "(";
+ accept(node->expression);
+ if (needParens)
+ out << ")";
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::TildeExpression *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::NotExpression *node)
+{
+ out << "!";
+ bool needParens = (node->expression->binaryExpressionCast() != 0);
+ if (needParens)
+ out << "(";
+ accept(node->expression);
+ if (needParens)
+ out << ")";
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::NotExpression *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::BinaryExpression *node)
+{
+ bool needParens = node->left->binaryExpressionCast()
+ && (compareOperatorPrecedence(node->left->binaryExpressionCast()->op, node->op) < 0);
+ if (needParens)
+ out << "(";
+ accept(node->left);
+ if (needParens)
+ out << ")";
+ QString s;
+ switch (node->op) {
+ case QSOperator::Add:
+ s = QLatin1String("+"); break;
+ case QSOperator::And:
+ s = QLatin1String("&&"); break;
+ case QSOperator::InplaceAnd:
+ s = QLatin1String("&="); break;
+ case QSOperator::Assign:
+ s = QLatin1String("="); break;
+ case QSOperator::BitAnd:
+ s = QLatin1String("&"); break;
+ case QSOperator::BitOr:
+ s = QLatin1String("|"); break;
+ case QSOperator::BitXor:
+ s = QLatin1String("^"); break;
+ case QSOperator::InplaceSub:
+ s = QLatin1String("-="); break;
+ case QSOperator::Div:
+ s = QLatin1String("/"); break;
+ case QSOperator::InplaceDiv:
+ s = QLatin1String("/="); break;
+ case QSOperator::Equal:
+ s = QLatin1String("=="); break;
+ case QSOperator::Ge:
+ s = QLatin1String(">="); break;
+ case QSOperator::Gt:
+ s = QLatin1String(">"); break;
+ case QSOperator::In:
+ s = QLatin1String("in"); break;
+ case QSOperator::InplaceAdd:
+ s = QLatin1String("+="); break;
+ case QSOperator::InstanceOf:
+ s = QLatin1String("instanceof"); break;
+ case QSOperator::Le:
+ s = QLatin1String("<="); break;
+ case QSOperator::LShift:
+ s = QLatin1String("<<"); break;
+ case QSOperator::InplaceLeftShift:
+ s = QLatin1String("<<="); break;
+ case QSOperator::Lt:
+ s = QLatin1String("<"); break;
+ case QSOperator::Mod:
+ s = QLatin1String("%"); break;
+ case QSOperator::InplaceMod:
+ s = QLatin1String("%="); break;
+ case QSOperator::Mul:
+ s = QLatin1String("*"); break;
+ case QSOperator::InplaceMul:
+ s = QLatin1String("*="); break;
+ case QSOperator::NotEqual:
+ s = QLatin1String("!="); break;
+ case QSOperator::Or:
+ s = QLatin1String("||"); break;
+ case QSOperator::InplaceOr:
+ s = QLatin1String("|="); break;
+ case QSOperator::RShift:
+ s = QLatin1String(">>"); break;
+ case QSOperator::InplaceRightShift:
+ s = QLatin1String(">>="); break;
+ case QSOperator::StrictEqual:
+ s = QLatin1String("==="); break;
+ case QSOperator::StrictNotEqual:
+ s = QLatin1String("!=="); break;
+ case QSOperator::Sub:
+ s = QLatin1String("-"); break;
+ case QSOperator::URShift:
+ s = QLatin1String(">>>"); break;
+ case QSOperator::InplaceURightShift:
+ s = QLatin1String(">>>="); break;
+ case QSOperator::InplaceXor:
+ s = QLatin1String("^="); break;
+ default:
+ Q_ASSERT (0);
+ }
+ out << " " << s << " ";
+ needParens = node->right->binaryExpressionCast()
+ && (compareOperatorPrecedence(node->right->binaryExpressionCast()->op, node->op) <= 0);
+ if (needParens)
+ out << "(";
+ accept(node->right);
+ if (needParens)
+ out << ")";
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::BinaryExpression *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::ConditionalExpression *node)
+{
+ accept(node->expression);
+ out << " ? ";
+ accept(node->ok);
+ out << " : ";
+ accept(node->ko);
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::ConditionalExpression *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::Expression *node)
+{
+ accept(node->left);
+ out << ", ";
+ accept(node->right);
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::Expression *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::Block *node)
+{
+ Q_UNUSED(node);
+ return true;
+}
+
+void PrettyPretty::endVisit(AST::Block *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::StatementList *node)
+{
+ accept(node->statement);
+ for (node = node->next; node != 0; node = node->next) {
+ newlineAndIndent();
+ accept(node->statement);
+ }
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::StatementList *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::VariableDeclarationList *node)
+{
+ AST::VariableDeclarationList *it = node;
+
+ do {
+ it->declaration->accept(this);
+ it = it->next;
+ if (it)
+ out << ", ";
+ } while (it);
+
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::VariableDeclarationList *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::VariableStatement *node)
+{
+ out << "var ";
+ Q_UNUSED(node);
+ return true;
+}
+
+void PrettyPretty::endVisit(AST::VariableStatement *node)
+{
+ Q_UNUSED(node);
+ out << ";";
+}
+
+bool PrettyPretty::visit(AST::VariableDeclaration *node)
+{
+ out << JavaScriptEnginePrivate::toString(node->name);
+ if (node->expression) {
+ out << " = ";
+ accept(node->expression);
+ }
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::VariableDeclaration *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::EmptyStatement *node)
+{
+ Q_UNUSED(node);
+ out << ";";
+ return true;
+}
+
+void PrettyPretty::endVisit(AST::EmptyStatement *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::ExpressionStatement *node)
+{
+ accept(node->expression);
+ out << ";";
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::ExpressionStatement *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::IfStatement *node)
+{
+ out << "if (";
+ accept(node->expression);
+ out << ") ";
+ acceptAsBlock(node->ok);
+ if (node->ko) {
+ out << " else ";
+ acceptAsBlock(node->ko);
+ }
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::IfStatement *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::DoWhileStatement *node)
+{
+ out << "do ";
+ acceptAsBlock(node->statement);
+ out << " while (";
+ accept(node->expression);
+ out << ");";
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::DoWhileStatement *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::WhileStatement *node)
+{
+ out << "while (";
+ accept(node->expression);
+ out << ") ";
+ acceptAsBlock(node->statement);
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::WhileStatement *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::ForStatement *node)
+{
+ out << "for (";
+ accept(node->initialiser);
+ out << "; ";
+ accept(node->condition);
+ out << "; ";
+ accept(node->expression);
+ out << ") ";
+ acceptAsBlock(node->statement);
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::ForStatement *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::LocalForStatement *node)
+{
+ out << "for (var ";
+ accept(node->declarations);
+ out << "; ";
+ accept(node->condition);
+ out << "; ";
+ accept(node->expression);
+ out << ") ";
+ acceptAsBlock(node->statement);
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::LocalForStatement *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::ForEachStatement *node)
+{
+ out << "for (";
+ accept(node->initialiser);
+ out << " in ";
+ accept(node->expression);
+ out << ") ";
+ acceptAsBlock(node->statement);
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::ForEachStatement *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::LocalForEachStatement *node)
+{
+ out << "for (var ";
+ accept(node->declaration);
+ out << " in ";
+ accept(node->expression);
+ out << ") ";
+ acceptAsBlock(node->statement);
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::LocalForEachStatement *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::ContinueStatement *node)
+{
+ out << "continue";
+ if (node->label) {
+ out << " " << JavaScriptEnginePrivate::toString(node->label);
+ }
+ out << ";";
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::ContinueStatement *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::BreakStatement *node)
+{
+ out << "break";
+ if (node->label) {
+ out << " " << JavaScriptEnginePrivate::toString(node->label);
+ }
+ out << ";";
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::BreakStatement *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::ReturnStatement *node)
+{
+ out << "return";
+ if (node->expression) {
+ out << " ";
+ accept(node->expression);
+ }
+ out << ";";
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::ReturnStatement *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::WithStatement *node)
+{
+ out << "with (";
+ accept(node->expression);
+ out << ") ";
+ acceptAsBlock(node->statement);
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::WithStatement *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::SwitchStatement *node)
+{
+ out << "switch (";
+ accept(node->expression);
+ out << ") ";
+ acceptAsBlock(node->block);
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::SwitchStatement *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::CaseBlock *node)
+{
+ accept(node->clauses);
+ if (node->defaultClause) {
+ newlineAndIndent();
+ accept(node->defaultClause);
+ }
+ if (node->moreClauses) {
+ newlineAndIndent();
+ accept(node->moreClauses);
+ }
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::CaseBlock *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::CaseClauses *node)
+{
+ accept(node->clause);
+ for (node = node->next; node != 0; node = node->next) {
+ newlineAndIndent();
+ accept(node->clause);
+ }
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::CaseClauses *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::CaseClause *node)
+{
+ out << "case ";
+ accept(node->expression);
+ out << ":";
+ if (node->statements) {
+ newlineAndIndent();
+ accept(node->statements);
+ }
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::CaseClause *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::DefaultClause *node)
+{
+ Q_UNUSED(node);
+ out << "default:";
+ newlineAndIndent();
+ return true;
+}
+
+void PrettyPretty::endVisit(AST::DefaultClause *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::LabelledStatement *node)
+{
+ out << JavaScriptEnginePrivate::toString(node->label) << ": ";
+ return true;
+}
+
+void PrettyPretty::endVisit(AST::LabelledStatement *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::ThrowStatement *node)
+{
+ Q_UNUSED(node);
+ out << "throw ";
+ accept(node->expression);
+ out << ";";
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::ThrowStatement *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::TryStatement *node)
+{
+ out << "try ";
+ acceptAsBlock(node->statement);
+ if (node->catchExpression) {
+ out << " catch (" << JavaScriptEnginePrivate::toString(node->catchExpression->name) << ") ";
+ acceptAsBlock(node->catchExpression->statement);
+ }
+ if (node->finallyExpression) {
+ out << " finally ";
+ acceptAsBlock(node->finallyExpression->statement);
+ }
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::TryStatement *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::Catch *node)
+{
+ Q_UNUSED(node);
+ return true;
+}
+
+void PrettyPretty::endVisit(AST::Catch *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::Finally *node)
+{
+ Q_UNUSED(node);
+ out << "finally ";
+ return true;
+}
+
+void PrettyPretty::endVisit(AST::Finally *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::FunctionDeclaration *node)
+{
+ out << "function";
+
+ if (node->name)
+ out << " " << JavaScriptEnginePrivate::toString(node->name);
+
+ // the arguments
+ out << "(";
+ for (AST::FormalParameterList *it = node->formals; it; it = it->next) {
+ if (it->name)
+ out << JavaScriptEnginePrivate::toString(it->name);
+
+ if (it->next)
+ out << ", ";
+ }
+ out << ")";
+
+ // the function body
+ out << " {";
+
+ if (node->body) {
+ pushIndentLevel();
+ newlineAndIndent();
+ accept(node->body);
+ popIndentLevel();
+ newlineAndIndent();
+ }
+
+ out << "}";
+
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::FunctionDeclaration *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::FunctionExpression *node)
+{
+ out << "function";
+
+ if (node->name)
+ out << " " << JavaScriptEnginePrivate::toString(node->name);
+
+ // the arguments
+ out << "(";
+ for (AST::FormalParameterList *it = node->formals; it; it = it->next) {
+ if (it->name)
+ out << JavaScriptEnginePrivate::toString(it->name);
+
+ if (it->next)
+ out << ", ";
+ }
+ out << ")";
+
+ // the function body
+ out << " {";
+
+ if (node->body) {
+ pushIndentLevel();
+ newlineAndIndent();
+ accept(node->body);
+ popIndentLevel();
+ newlineAndIndent();
+ }
+
+ out << "}";
+
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::FunctionExpression *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::FormalParameterList *node)
+{
+ Q_UNUSED(node);
+ return true;
+}
+
+void PrettyPretty::endVisit(AST::FormalParameterList *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::FunctionBody *node)
+{
+ Q_UNUSED(node);
+ return true;
+}
+
+void PrettyPretty::endVisit(AST::FunctionBody *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::Program *node)
+{
+ Q_UNUSED(node);
+ return true;
+}
+
+void PrettyPretty::endVisit(AST::Program *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::SourceElements *node)
+{
+ Q_UNUSED(node);
+ accept(node->element);
+ for (node = node->next; node != 0; node = node->next) {
+ newlineAndIndent();
+ accept(node->element);
+ }
+ return false;
+}
+
+void PrettyPretty::endVisit(AST::SourceElements *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::FunctionSourceElement *node)
+{
+ Q_UNUSED(node);
+ return true;
+}
+
+void PrettyPretty::endVisit(AST::FunctionSourceElement *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::StatementSourceElement *node)
+{
+ Q_UNUSED(node);
+ return true;
+}
+
+void PrettyPretty::endVisit(AST::StatementSourceElement *node)
+{
+ Q_UNUSED(node);
+}
+
+bool PrettyPretty::visit(AST::DebuggerStatement *node)
+{
+ Q_UNUSED(node);
+ out << "debugger";
+ return true;
+}
+
+void PrettyPretty::endVisit(AST::DebuggerStatement *node)
+{
+ Q_UNUSED(node);
+ out << ";";
+}
+
+bool PrettyPretty::preVisit(AST::Node *node)
+{
+ Q_UNUSED(node);
+ return true;
+}
+
+QT_END_NAMESPACE
+
+
diff --git a/src/declarative/qml/parser/javascriptprettypretty_p.h b/src/declarative/qml/parser/javascriptprettypretty_p.h
new file mode 100644
index 0000000..c692da5
--- /dev/null
+++ b/src/declarative/qml/parser/javascriptprettypretty_p.h
@@ -0,0 +1,329 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtScript module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef JAVASCRIPTPRETTYPRETTY_P_H
+#define JAVASCRIPTPRETTYPRETTY_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qglobal.h>
+
+#include "javascriptastvisitor_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QTextStream;
+
+namespace JavaScript {
+
+class PrettyPretty: protected AST::Visitor
+{
+public:
+ PrettyPretty(QTextStream &out);
+ virtual ~PrettyPretty();
+
+ QTextStream &operator () (AST::Node *node, int level = 0);
+
+protected:
+ void accept(AST::Node *node);
+
+ virtual bool preVisit(AST::Node *node);
+
+ virtual bool visit(AST::ThisExpression *node);
+ virtual void endVisit(AST::ThisExpression *node);
+
+ virtual bool visit(AST::IdentifierExpression *node);
+ virtual void endVisit(AST::IdentifierExpression *node);
+
+ virtual bool visit(AST::NullExpression *node);
+ virtual void endVisit(AST::NullExpression *node);
+
+ virtual bool visit(AST::TrueLiteral *node);
+ virtual void endVisit(AST::TrueLiteral *node);
+
+ virtual bool visit(AST::FalseLiteral *node);
+ virtual void endVisit(AST::FalseLiteral *node);
+
+ virtual bool visit(AST::StringLiteral *node);
+ virtual void endVisit(AST::StringLiteral *node);
+
+ virtual bool visit(AST::NumericLiteral *node);
+ virtual void endVisit(AST::NumericLiteral *node);
+
+ virtual bool visit(AST::RegExpLiteral *node);
+ virtual void endVisit(AST::RegExpLiteral *node);
+
+ virtual bool visit(AST::ArrayLiteral *node);
+ virtual void endVisit(AST::ArrayLiteral *node);
+
+ virtual bool visit(AST::ObjectLiteral *node);
+ virtual void endVisit(AST::ObjectLiteral *node);
+
+ virtual bool visit(AST::ElementList *node);
+ virtual void endVisit(AST::ElementList *node);
+
+ virtual bool visit(AST::Elision *node);
+ virtual void endVisit(AST::Elision *node);
+
+ virtual bool visit(AST::PropertyNameAndValueList *node);
+ virtual void endVisit(AST::PropertyNameAndValueList *node);
+
+ virtual bool visit(AST::IdentifierPropertyName *node);
+ virtual void endVisit(AST::IdentifierPropertyName *node);
+
+ virtual bool visit(AST::StringLiteralPropertyName *node);
+ virtual void endVisit(AST::StringLiteralPropertyName *node);
+
+ virtual bool visit(AST::NumericLiteralPropertyName *node);
+ virtual void endVisit(AST::NumericLiteralPropertyName *node);
+
+ virtual bool visit(AST::ArrayMemberExpression *node);
+ virtual void endVisit(AST::ArrayMemberExpression *node);
+
+ virtual bool visit(AST::FieldMemberExpression *node);
+ virtual void endVisit(AST::FieldMemberExpression *node);
+
+ virtual bool visit(AST::NewMemberExpression *node);
+ virtual void endVisit(AST::NewMemberExpression *node);
+
+ virtual bool visit(AST::NewExpression *node);
+ virtual void endVisit(AST::NewExpression *node);
+
+ virtual bool visit(AST::CallExpression *node);
+ virtual void endVisit(AST::CallExpression *node);
+
+ virtual bool visit(AST::ArgumentList *node);
+ virtual void endVisit(AST::ArgumentList *node);
+
+ virtual bool visit(AST::PostIncrementExpression *node);
+ virtual void endVisit(AST::PostIncrementExpression *node);
+
+ virtual bool visit(AST::PostDecrementExpression *node);
+ virtual void endVisit(AST::PostDecrementExpression *node);
+
+ virtual bool visit(AST::DeleteExpression *node);
+ virtual void endVisit(AST::DeleteExpression *node);
+
+ virtual bool visit(AST::VoidExpression *node);
+ virtual void endVisit(AST::VoidExpression *node);
+
+ virtual bool visit(AST::TypeOfExpression *node);
+ virtual void endVisit(AST::TypeOfExpression *node);
+
+ virtual bool visit(AST::PreIncrementExpression *node);
+ virtual void endVisit(AST::PreIncrementExpression *node);
+
+ virtual bool visit(AST::PreDecrementExpression *node);
+ virtual void endVisit(AST::PreDecrementExpression *node);
+
+ virtual bool visit(AST::UnaryPlusExpression *node);
+ virtual void endVisit(AST::UnaryPlusExpression *node);
+
+ virtual bool visit(AST::UnaryMinusExpression *node);
+ virtual void endVisit(AST::UnaryMinusExpression *node);
+
+ virtual bool visit(AST::TildeExpression *node);
+ virtual void endVisit(AST::TildeExpression *node);
+
+ virtual bool visit(AST::NotExpression *node);
+ virtual void endVisit(AST::NotExpression *node);
+
+ virtual bool visit(AST::BinaryExpression *node);
+ virtual void endVisit(AST::BinaryExpression *node);
+
+ virtual bool visit(AST::ConditionalExpression *node);
+ virtual void endVisit(AST::ConditionalExpression *node);
+
+ virtual bool visit(AST::Expression *node);
+ virtual void endVisit(AST::Expression *node);
+
+ virtual bool visit(AST::Block *node);
+ virtual void endVisit(AST::Block *node);
+
+ virtual bool visit(AST::StatementList *node);
+ virtual void endVisit(AST::StatementList *node);
+
+ virtual bool visit(AST::VariableStatement *node);
+ virtual void endVisit(AST::VariableStatement *node);
+
+ virtual bool visit(AST::VariableDeclarationList *node);
+ virtual void endVisit(AST::VariableDeclarationList *node);
+
+ virtual bool visit(AST::VariableDeclaration *node);
+ virtual void endVisit(AST::VariableDeclaration *node);
+
+ virtual bool visit(AST::EmptyStatement *node);
+ virtual void endVisit(AST::EmptyStatement *node);
+
+ virtual bool visit(AST::ExpressionStatement *node);
+ virtual void endVisit(AST::ExpressionStatement *node);
+
+ virtual bool visit(AST::IfStatement *node);
+ virtual void endVisit(AST::IfStatement *node);
+
+ virtual bool visit(AST::DoWhileStatement *node);
+ virtual void endVisit(AST::DoWhileStatement *node);
+
+ virtual bool visit(AST::WhileStatement *node);
+ virtual void endVisit(AST::WhileStatement *node);
+
+ virtual bool visit(AST::ForStatement *node);
+ virtual void endVisit(AST::ForStatement *node);
+
+ virtual bool visit(AST::LocalForStatement *node);
+ virtual void endVisit(AST::LocalForStatement *node);
+
+ virtual bool visit(AST::ForEachStatement *node);
+ virtual void endVisit(AST::ForEachStatement *node);
+
+ virtual bool visit(AST::LocalForEachStatement *node);
+ virtual void endVisit(AST::LocalForEachStatement *node);
+
+ virtual bool visit(AST::ContinueStatement *node);
+ virtual void endVisit(AST::ContinueStatement *node);
+
+ virtual bool visit(AST::BreakStatement *node);
+ virtual void endVisit(AST::BreakStatement *node);
+
+ virtual bool visit(AST::ReturnStatement *node);
+ virtual void endVisit(AST::ReturnStatement *node);
+
+ virtual bool visit(AST::WithStatement *node);
+ virtual void endVisit(AST::WithStatement *node);
+
+ virtual bool visit(AST::SwitchStatement *node);
+ virtual void endVisit(AST::SwitchStatement *node);
+
+ virtual bool visit(AST::CaseBlock *node);
+ virtual void endVisit(AST::CaseBlock *node);
+
+ virtual bool visit(AST::CaseClauses *node);
+ virtual void endVisit(AST::CaseClauses *node);
+
+ virtual bool visit(AST::CaseClause *node);
+ virtual void endVisit(AST::CaseClause *node);
+
+ virtual bool visit(AST::DefaultClause *node);
+ virtual void endVisit(AST::DefaultClause *node);
+
+ virtual bool visit(AST::LabelledStatement *node);
+ virtual void endVisit(AST::LabelledStatement *node);
+
+ virtual bool visit(AST::ThrowStatement *node);
+ virtual void endVisit(AST::ThrowStatement *node);
+
+ virtual bool visit(AST::TryStatement *node);
+ virtual void endVisit(AST::TryStatement *node);
+
+ virtual bool visit(AST::Catch *node);
+ virtual void endVisit(AST::Catch *node);
+
+ virtual bool visit(AST::Finally *node);
+ virtual void endVisit(AST::Finally *node);
+
+ virtual bool visit(AST::FunctionDeclaration *node);
+ virtual void endVisit(AST::FunctionDeclaration *node);
+
+ virtual bool visit(AST::FunctionExpression *node);
+ virtual void endVisit(AST::FunctionExpression *node);
+
+ virtual bool visit(AST::FormalParameterList *node);
+ virtual void endVisit(AST::FormalParameterList *node);
+
+ virtual bool visit(AST::FunctionBody *node);
+ virtual void endVisit(AST::FunctionBody *node);
+
+ virtual bool visit(AST::Program *node);
+ virtual void endVisit(AST::Program *node);
+
+ virtual bool visit(AST::SourceElements *node);
+ virtual void endVisit(AST::SourceElements *node);
+
+ virtual bool visit(AST::FunctionSourceElement *node);
+ virtual void endVisit(AST::FunctionSourceElement *node);
+
+ virtual bool visit(AST::StatementSourceElement *node);
+ virtual void endVisit(AST::StatementSourceElement *node);
+
+ virtual bool visit(AST::DebuggerStatement *node);
+ virtual void endVisit(AST::DebuggerStatement *node);
+
+ int indentLevel(int level)
+ {
+ int was = m_indentLevel;
+ m_indentLevel = level;
+ return was;
+ }
+
+ void pushIndentLevel()
+ { ++m_indentLevel; }
+
+ void popIndentLevel()
+ { --m_indentLevel; }
+
+ QTextStream &newlineAndIndent();
+
+ void acceptAsBlock(AST::Node *node);
+
+ static int operatorPrecedenceLevel(int op);
+ static int compareOperatorPrecedence(int op1, int op2);
+
+private:
+ QTextStream &out;
+ int m_indentLevel;
+
+ Q_DISABLE_COPY(PrettyPretty)
+};
+
+} // namespace JavaScript
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/declarative/qml/parser/javascriptvalue.h b/src/declarative/qml/parser/javascriptvalue.h
new file mode 100644
index 0000000..c68b817
--- /dev/null
+++ b/src/declarative/qml/parser/javascriptvalue.h
@@ -0,0 +1,6 @@
+#ifndef JAVASCRIPTVALUE_H
+#define JAVASCRIPTVALUE_H
+
+typedef double qjsreal;
+
+#endif // JAVASCRIPTVALUE_H
diff --git a/src/declarative/qml/parser/parser.pri b/src/declarative/qml/parser/parser.pri
new file mode 100644
index 0000000..130aeaf
--- /dev/null
+++ b/src/declarative/qml/parser/parser.pri
@@ -0,0 +1,21 @@
+
+HEADERS += $$PWD/javascriptast_p.h \
+ $$PWD/javascriptastfwd_p.h \
+ $$PWD/javascriptastvisitor_p.h \
+ $$PWD/javascriptengine_p.h \
+ $$PWD/javascriptgrammar_p.h \
+ $$PWD/javascriptlexer_p.h \
+ $$PWD/javascriptmemorypool_p.h \
+ $$PWD/javascriptnodepool_p.h \
+ $$PWD/javascriptparser_p.h \
+ $$PWD/javascriptprettypretty_p.h \
+ $$PWD/javascriptvalue.h \
+
+SOURCES += $$PWD/javascriptast.cpp \
+ $$PWD/javascriptastvisitor.cpp \
+ $$PWD/javascriptengine_p.cpp \
+ $$PWD/javascriptgrammar.cpp \
+ $$PWD/javascriptlexer.cpp \
+ $$PWD/javascriptprettypretty.cpp \
+ $$PWD/javascriptparser.cpp
+
diff --git a/src/declarative/qml/qml.h b/src/declarative/qml/qml.h
index 2d8d83e..1c662a7 100644
--- a/src/declarative/qml/qml.h
+++ b/src/declarative/qml/qml.h
@@ -100,10 +100,10 @@ QObject *qmlAttachedPropertiesObject(const QObject *obj)
// ### is this threadsafe?
static int idx = -1;
- if(idx == -1)
+ if (idx == -1)
idx = QmlMetaType::attachedPropertiesFuncId(&T::staticMetaObject);
- if(idx == -1 || !obj)
+ if (idx == -1 || !obj)
return 0;
return qmlAttachedPropertiesObjectById(obj, idx);
diff --git a/src/declarative/qml/qml.pri b/src/declarative/qml/qml.pri
index c44e8c5..00e3ccb 100644
--- a/src/declarative/qml/qml.pri
+++ b/src/declarative/qml/qml.pri
@@ -62,3 +62,10 @@ HEADERS += qml/qmlparser_p.h \
# for qtscript debugger
QT += scripttools
include(script/script.pri)
+
+# new language front-end
+include(parser/parser.pri)
+
+HEADERS += qml/qmlscriptparser_p.h
+
+SOURCES += qml/qmlscriptparser.cpp
diff --git a/src/declarative/qml/qmlbindablevalue.cpp b/src/declarative/qml/qmlbindablevalue.cpp
index c2632da..b312b40 100644
--- a/src/declarative/qml/qmlbindablevalue.cpp
+++ b/src/declarative/qml/qmlbindablevalue.cpp
@@ -80,7 +80,7 @@ void QmlBindableValue::setTarget(const QmlMetaProperty &prop)
void QmlBindableValue::init()
{
- if(_inited)
+ if (_inited)
return;
_inited = true;
update();
@@ -98,30 +98,30 @@ void QmlBindableValue::update()
#ifdef Q_ENABLE_PERFORMANCE_LOG
QFxPerfTimer<QFxPerf::BindableValueUpdate> bu;
#endif
- if(!_inited)
+ if (!_inited)
return;
- if(_property.propertyCategory() == QmlMetaProperty::List) {
+ if (_property.propertyCategory() == QmlMetaProperty::List) {
QVariant value = this->value();
int listType = QmlMetaType::listType(_property.propertyType());
- if(value.userType() == qMetaTypeId<QList<QObject *> >()) {
+ if (value.userType() == qMetaTypeId<QList<QObject *> >()) {
const QList<QObject *> &list =
qvariant_cast<QList<QObject *> >(value);
QVariant listVar = _property.read();
QmlMetaType::clear(listVar);
- for(int ii = 0; ii < list.count(); ++ii) {
+ for (int ii = 0; ii < list.count(); ++ii) {
QVariant v = QmlMetaType::fromObject(list.at(ii), listType);
QmlMetaType::append(listVar, v);
}
- } else if(value.type() == uint(listType) ||
+ } else if (value.type() == uint(listType) ||
value.userType() == listType) {
QVariant listVar = _property.read();
QmlMetaType::clear(listVar);
QmlMetaType::append(listVar, value);
}
- } else if(_property.propertyCategory() == QmlMetaProperty::QmlList) {
+ } else if (_property.propertyCategory() == QmlMetaProperty::QmlList) {
// XXX - optimize!
QVariant value = this->value();
QVariant list = _property.read();
@@ -137,13 +137,13 @@ void QmlBindableValue::update()
const QMetaObject *objMo = obj->metaObject();
bool found = false;
while(!found && objMo) {
- if(objMo == mo)
+ if (objMo == mo)
found = true;
else
objMo = objMo->superClass();
}
- if(!found) {
+ if (!found) {
qWarning() << "Unable to assign object to list";
return;
}
@@ -153,7 +153,7 @@ void QmlBindableValue::update()
void *d = (void *)&obj;
li->append(d);
}
- } else if(_property.propertyCategory() == QmlMetaProperty::Bindable) {
+ } else if (_property.propertyCategory() == QmlMetaProperty::Bindable) {
// NOTE: We assume that only core properties can have
// propertyType == Bindable
@@ -166,12 +166,12 @@ void QmlBindableValue::update()
_property.object()->qt_metacall(QMetaObject::WriteProperty,
idx, a);
- } else if(_property.propertyCategory() == QmlMetaProperty::Object) {
+ } else if (_property.propertyCategory() == QmlMetaProperty::Object) {
QVariant value = this->value();
- if((int)value.type() != qMetaTypeId<QObject *>()) {
- if(scriptWarnings()) {
- if(!value.isValid()) {
+ if ((int)value.type() != qMetaTypeId<QObject *>()) {
+ if (scriptWarnings()) {
+ if (!value.isValid()) {
qWarning() << "QmlBindableValue: Unable to assign invalid value to object property";
} else {
qWarning() << "QmlBindableValue: Unable to assign non-object to object property";
@@ -194,7 +194,7 @@ void QmlBindableValue::update()
_property.object()->qt_metacall(QMetaObject::WriteProperty,
idx, a);
- } else if(_property.propertyCategory() == QmlMetaProperty::Normal) {
+ } else if (_property.propertyCategory() == QmlMetaProperty::Normal) {
QVariant value = this->value();
_property.write(value);
}
diff --git a/src/declarative/qml/qmlboundsignal.cpp b/src/declarative/qml/qmlboundsignal.cpp
index 5359753..67e3dcf 100644
--- a/src/declarative/qml/qmlboundsignal.cpp
+++ b/src/declarative/qml/qmlboundsignal.cpp
@@ -59,7 +59,7 @@ QmlBoundSignal::QmlBoundSignal(QmlContext *ctxt, const QString &val, QObject *me
// This is thread safe. Although it may be updated by two threads, they
// will both set it to the same value - so the worst thing that can happen
// is that they both do the work to figure it out. Boo hoo.
- if(evaluateIdx == -1) evaluateIdx = QmlExpressionObject::staticMetaObject.indexOfMethod("value()");
+ if (evaluateIdx == -1) evaluateIdx = QmlExpressionObject::staticMetaObject.indexOfMethod("value()");
setTrackChange(false);
QFx_setParent_noEvent(this, parent);
@@ -78,7 +78,7 @@ QmlBoundSignalProxy::QmlBoundSignalProxy(QmlContext *ctxt, const QString &val, Q
int QmlBoundSignalProxy::qt_metacall(QMetaObject::Call c, int id, void **a)
{
- if(c == QMetaObject::InvokeMetaMethod && id == evaluateIdx) {
+ if (c == QMetaObject::InvokeMetaMethod && id == evaluateIdx) {
params->setValues(a);
value();
params->clearValues();
@@ -103,17 +103,17 @@ QmlBoundSignalParameters::QmlBoundSignalParameters(const QMetaMethod &method,
QList<QByteArray> paramTypes = method.parameterTypes();
QList<QByteArray> paramNames = method.parameterNames();
types = new int[paramTypes.count()];
- for(int ii = 0; ii < paramTypes.count(); ++ii) {
+ for (int ii = 0; ii < paramTypes.count(); ++ii) {
const QByteArray &type = paramTypes.at(ii);
const QByteArray &name = paramNames.at(ii);
- if(name.isEmpty() || type.isEmpty()) {
+ if (name.isEmpty() || type.isEmpty()) {
types[ii] = 0;
continue;
}
QVariant::Type t = (QVariant::Type)QMetaType::type(type.constData());
- if(QmlMetaType::isObject(t)) {
+ if (QmlMetaType::isObject(t)) {
types[ii] = QMetaType::QObjectStar;
QMetaPropertyBuilder prop = mob.addProperty(name, "QObject*");
prop.setWritable(false);
@@ -147,7 +147,7 @@ void QmlBoundSignalParameters::clearValues()
int QmlBoundSignalParameters::metaCall(QMetaObject::Call c, int id, void **a)
{
- if(c == QMetaObject::ReadProperty && id >= 1) {
+ if (c == QMetaObject::ReadProperty && id >= 1) {
QmlMetaType::copy(types[id - 1], a[0], values[id]);
return -1;
} else {
diff --git a/src/declarative/qml/qmlcompiledcomponent.cpp b/src/declarative/qml/qmlcompiledcomponent.cpp
index a8b2be0..2c76f0c 100644
--- a/src/declarative/qml/qmlcompiledcomponent.cpp
+++ b/src/declarative/qml/qmlcompiledcomponent.cpp
@@ -56,21 +56,21 @@ QmlCompiledComponent::QmlCompiledComponent()
QmlCompiledComponent::~QmlCompiledComponent()
{
- for(int ii = 0; ii < mos.count(); ++ii)
+ for (int ii = 0; ii < mos.count(); ++ii)
qFree(mos.at(ii));
}
void QmlCompiledComponent::dumpInstructions()
{
- if(!compilerDump())
+ if (!compilerDump())
return;
- if(!name.isEmpty())
+ if (!name.isEmpty())
qWarning() << name;
qWarning() << "Index\tLine\tOperation\t\tData1\tData2\t\tComments";
qWarning() << "-------------------------------------------------------------------------------";
- for(int ii = 0; ii < bytecode.count(); ++ii) {
+ for (int ii = 0; ii < bytecode.count(); ++ii) {
dump(&bytecode[ii], ii);
}
qWarning() << "-------------------------------------------------------------------------------";
@@ -79,29 +79,29 @@ void QmlCompiledComponent::dumpInstructions()
void QmlCompiledComponent::dump(int indent, Property *p)
{
QByteArray ba(indent * 4, ' ');
- for(int ii = 0; ii < p->values.count(); ++ii)
+ for (int ii = 0; ii < p->values.count(); ++ii)
dump(indent, p->values.at(ii));
- if(p->value)
+ if (p->value)
dump(indent, p->value);
}
void QmlCompiledComponent::dump(int indent, Object *o)
{
QByteArray ba(indent * 4, ' ');
- if(o->type != -1) {
+ if (o->type != -1) {
qWarning() << ba.constData() << "Object:" << types.at(o->type).className;
} else {
qWarning() << ba.constData() << "Object: fetched";
}
- for(QHash<QByteArray, Property *>::ConstIterator iter = o->properties.begin();
+ for (QHash<QByteArray, Property *>::ConstIterator iter = o->properties.begin();
iter != o->properties.end();
++iter) {
qWarning() << ba.constData() << " Property" << iter.key();
dump(indent + 1, *iter);
}
- if(o->defaultProperty) {
+ if (o->defaultProperty) {
qWarning() << ba.constData() << " Default property";
dump(indent + 1, o->defaultProperty);
}
@@ -142,7 +142,7 @@ void QmlCompiledComponent::dump(int indent, Value *v)
};
QByteArray ba(indent * 4, ' ');
- if(v->object) {
+ if (v->object) {
qWarning() << ba.constData() << "Value (" << type << "):";
dump(indent + 1, v->object);
} else {
@@ -152,7 +152,7 @@ void QmlCompiledComponent::dump(int indent, Value *v)
void QmlCompiledComponent::dumpPre()
{
- if(!(dumpStatus & DumpPre)) {
+ if (!(dumpStatus & DumpPre)) {
dumpInstructions();
dumpStatus = (DumpStatus)(dumpStatus | DumpPre);
}
@@ -160,7 +160,7 @@ void QmlCompiledComponent::dumpPre()
void QmlCompiledComponent::dumpPost()
{
- if(!(dumpStatus & DumpPost)) {
+ if (!(dumpStatus & DumpPost)) {
dumpInstructions();
dumpStatus = (DumpStatus)(dumpStatus | DumpPost);
}
diff --git a/src/declarative/qml/qmlcompiledcomponent_p.h b/src/declarative/qml/qmlcompiledcomponent_p.h
index fa68eab..883ad64 100644
--- a/src/declarative/qml/qmlcompiledcomponent_p.h
+++ b/src/declarative/qml/qmlcompiledcomponent_p.h
@@ -46,8 +46,8 @@
#include <private/qmlinstruction_p.h>
#include <private/qmlcompiler_p.h>
#include <private/qmlrefcount_p.h>
-class QmlXmlParser;
+QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
namespace QmlParser {
class Property;
@@ -77,4 +77,6 @@ private:
QT_END_NAMESPACE
+QT_END_HEADER
+
#endif // QMLCOMPILEDCOMPONENT_P_H
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp
index 7535bc7..fae0f43 100644
--- a/src/declarative/qml/qmlcompiler.cpp
+++ b/src/declarative/qml/qmlcompiler.cpp
@@ -42,7 +42,7 @@
#include "private/qmlcompiler_p.h"
#include <qfxperf.h>
#include "qmlparser_p.h"
-#include "private/qmlxmlparser_p.h"
+#include "private/qmlscriptparser_p.h"
#include <qmlpropertyvaluesource.h>
#include <qmlcomponent.h>
#include "private/qmetaobjectbuilder_p.h"
@@ -60,6 +60,8 @@
#include <qmlmetatype.h>
#include <QtCore/qdebug.h>
+#include "qmlscriptparser_p.h"
+
QT_BEGIN_NAMESPACE
/*
New properties and signals can be added to any QObject type from QML.
@@ -78,7 +80,7 @@ using namespace QmlParser;
int QmlCompiledData::indexForString(const QString &data)
{
int idx = primitives.indexOf(data);
- if(idx == -1) {
+ if (idx == -1) {
idx = primitives.count();
primitives << data;
}
@@ -88,7 +90,7 @@ int QmlCompiledData::indexForString(const QString &data)
int QmlCompiledData::indexForByteArray(const QByteArray &data)
{
int idx = datas.indexOf(data);
- if(idx == -1) {
+ if (idx == -1) {
idx = datas.count();
datas << data;
}
@@ -99,21 +101,21 @@ int QmlCompiledData::indexForFloat(float *data, int count)
{
Q_ASSERT(count > 0);
- for(int ii = 0; ii < floatData.count() - count; ++ii) {
+ for (int ii = 0; ii < floatData.count() - count; ++ii) {
bool found = true;
- for(int jj = 0; jj < count; ++jj) {
- if(floatData.at(ii + jj) != data[jj]) {
+ for (int jj = 0; jj < count; ++jj) {
+ if (floatData.at(ii + jj) != data[jj]) {
found = false;
break;
}
}
- if(found)
+ if (found)
return ii;
}
int idx = floatData.count();
- for(int ii = 0; ii < count; ++ii)
+ for (int ii = 0; ii < count; ++ii)
floatData << data[ii];
return idx;
@@ -123,21 +125,21 @@ int QmlCompiledData::indexForInt(int *data, int count)
{
Q_ASSERT(count > 0);
- for(int ii = 0; ii < floatData.count() - count; ++ii) {
+ for (int ii = 0; ii < floatData.count() - count; ++ii) {
bool found = true;
- for(int jj = 0; jj < count; ++jj) {
- if(intData.at(ii + jj) != data[jj]) {
+ for (int jj = 0; jj < count; ++jj) {
+ if (intData.at(ii + jj) != data[jj]) {
found = false;
break;
}
}
- if(found)
+ if (found)
return ii;
}
int idx = intData.count();
- for(int ii = 0; ii < count; ++ii)
+ for (int ii = 0; ii < count; ++ii)
intData << data[ii];
return idx;
@@ -165,12 +167,12 @@ QString QmlCompiler::errorDescription() const
bool QmlCompiler::isValidId(const QString &val)
{
- if(val.isEmpty())
+ if (val.isEmpty())
return false;
QChar u(QLatin1Char('_'));
- for(int ii = 0; ii < val.count(); ++ii)
- if(val.at(ii) != u &&
+ for (int ii = 0; ii < val.count(); ++ii)
+ if (val.at(ii) != u &&
((ii == 0 && !val.at(ii).isLetter()) ||
(ii != 0 && !val.at(ii).isLetterOrNumber())) )
return false;
@@ -206,15 +208,15 @@ QmlCompiler::generateStoreInstruction(QmlCompiledData &cdata,
int coreIdx, int primitive,
const QString *string)
{
- if(!prop.isWritable())
+ if (!prop.isWritable())
return ReadOnly;
- if(prop.isEnumType()) {
+ if (prop.isEnumType()) {
int value;
if (prop.isFlagType()) {
value = prop.enumerator().keysToValue(string->toLatin1().constData());
} else
value = prop.enumerator().keyToValue(string->toLatin1().constData());
- if(value == -1)
+ if (value == -1)
return InvalidData;
instr.type = QmlInstruction::StoreInteger;
instr.storeInteger.propertyIndex = coreIdx;
@@ -226,7 +228,7 @@ QmlCompiler::generateStoreInstruction(QmlCompiledData &cdata,
case -1:
instr.type = QmlInstruction::StoreVariant;
instr.storeString.propertyIndex = coreIdx;
- if(primitive == -1)
+ if (primitive == -1)
primitive = cdata.indexForString(*string);
instr.storeString.value = primitive;
break;
@@ -235,11 +237,11 @@ QmlCompiler::generateStoreInstruction(QmlCompiledData &cdata,
{
instr.type = QmlInstruction::StoreString;
instr.storeString.propertyIndex = coreIdx;
- if(string->startsWith(QLatin1Char('\'')) && string->endsWith(QLatin1Char('\''))) {
+ if (string->startsWith(QLatin1Char('\'')) && string->endsWith(QLatin1Char('\''))) {
QString unquotedString = string->mid(1, string->length() - 2);
primitive = cdata.indexForString(unquotedString);
} else {
- if(primitive == -1)
+ if (primitive == -1)
primitive = cdata.indexForString(*string);
}
instr.storeString.value = primitive;
@@ -393,7 +395,7 @@ QmlCompiler::generateStoreInstruction(QmlCompiledData &cdata,
default:
{
int t = prop.type();
- if(t == QVariant::UserType)
+ if (t == QVariant::UserType)
t = prop.userType();
QmlMetaType::StringConverter converter =
QmlMetaType::customStringConverter(t);
@@ -404,7 +406,7 @@ QmlCompiler::generateStoreInstruction(QmlCompiledData &cdata,
instr.assignCustomType.valueIndex = index;
QmlCompiledData::CustomTypeData data;
- if(primitive == -1)
+ if (primitive == -1)
primitive = cdata.indexForString(*string);
data.index = primitive;
data.type = t;
@@ -426,8 +428,8 @@ void QmlCompiler::reset(QmlCompiledComponent *cc, bool deleteMemory)
cc->intData.clear();
cc->customTypeData.clear();
cc->datas.clear();
- if(deleteMemory) {
- for(int ii = 0; ii < cc->mos.count(); ++ii)
+ if (deleteMemory) {
+ for (int ii = 0; ii < cc->mos.count(); ++ii)
qFree(cc->mos.at(ii));
}
cc->mos.clear();
@@ -462,23 +464,23 @@ bool QmlCompiler::compile(QmlEngine *engine,
output = out;
// Compile types
- for(int ii = 0; ii < unit->types.count(); ++ii) {
+ for (int ii = 0; ii < unit->types.count(); ++ii) {
QmlCompositeTypeData::TypeReference &tref = unit->types[ii];
QmlCompiledComponent::TypeReference ref;
- if(tref.type)
+ if (tref.type)
ref.type = tref.type;
- else if(tref.unit) {
+ else if (tref.unit) {
ref.component = tref.unit->toComponent(engine);
ref.ref = tref.unit;
ref.ref->addref();
- } else if(tref.parser)
+ } else if (tref.parser)
ref.parser = tref.parser;
ref.className = unit->data.types().at(ii).toLatin1();
out->types << ref;
}
Object *root = unit->data.tree();
- if(!root) {
+ if (!root) {
exceptionDescription = QLatin1String("Can't compile because of earlier errors");
output = 0;
return false;
@@ -486,7 +488,7 @@ bool QmlCompiler::compile(QmlEngine *engine,
compileTree(root);
- if(!isError()) {
+ if (!isError()) {
out->dumpPre();
} else {
reset(out, true);
@@ -504,7 +506,7 @@ void QmlCompiler::compileTree(Object *tree)
init.init.dataSize = 0;
output->bytecode << init;
- if(!compileObject(tree, 0)) // Compile failed
+ if (!compileObject(tree, 0)) // Compile failed
return;
QmlInstruction def;
@@ -517,12 +519,12 @@ void QmlCompiler::compileTree(Object *tree)
bool QmlCompiler::compileObject(Object *obj, int ctxt)
{
- if(obj->type != -1) {
+ if (obj->type != -1) {
obj->metatype =
QmlMetaType::metaObjectForType(output->types.at(obj->type).className);
}
- if(output->types.at(obj->type).className == "Component") {
+ if (output->types.at(obj->type).className == "Component") {
COMPILE_CHECK(compileComponent(obj, ctxt));
return true;
}
@@ -533,24 +535,24 @@ bool QmlCompiler::compileObject(Object *obj, int ctxt)
// doesn't have already have them
bool ignoreProperties = false;
bool ignoreSignals = false;
- if(obj->metatype && obj->metatype->indexOfProperty(PROPERTIES_NAME) != -1)
+ if (obj->metatype && obj->metatype->indexOfProperty(PROPERTIES_NAME) != -1)
ignoreProperties = true;
- if(obj->metatype && obj->metatype->indexOfProperty(SIGNALS_NAME) != -1)
+ if (obj->metatype && obj->metatype->indexOfProperty(SIGNALS_NAME) != -1)
ignoreSignals = true;
Property *propertiesProperty = ignoreProperties?0:obj->getProperty(PROPERTIES_NAME, false);
Property *signalsProperty = ignoreSignals?0:obj->getProperty(SIGNALS_NAME, false);
- if(propertiesProperty) {
+ if (propertiesProperty) {
obj->dynamicPropertiesProperty = propertiesProperty;
obj->properties.remove(PROPERTIES_NAME);
}
- if(signalsProperty) {
+ if (signalsProperty) {
obj->dynamicSignalsProperty = signalsProperty;
obj->properties.remove(SIGNALS_NAME);
}
- if(obj->type != -1 && output->types.at(obj->type).parser) {
+ if (obj->type != -1 && output->types.at(obj->type).parser) {
QByteArray data = obj->custom;
int ref = output->indexForByteArray(data);
@@ -571,15 +573,15 @@ bool QmlCompiler::compileObject(Object *obj, int ctxt)
COMPILE_CHECK(compileDynamicPropertiesAndSignals(obj));
- if(obj->type != -1) {
- if(output->types.at(obj->type).component) {
+ if (obj->type != -1) {
+ if (output->types.at(obj->type).component) {
QmlInstruction begin;
begin.type = QmlInstruction::TryBeginObject;
begin.line = obj->line;
output->bytecode << begin;
} else {
int cast = QmlMetaType::qmlParserStatusCast(QmlMetaType::type(output->types.at(obj->type).className));
- if(cast != -1) {
+ if (cast != -1) {
QmlInstruction begin;
begin.type = QmlInstruction::BeginObject;
begin.begin.castValue = cast;
@@ -590,9 +592,9 @@ bool QmlCompiler::compileObject(Object *obj, int ctxt)
}
foreach(Property *prop, obj->properties) {
- if(!ignoreProperties && prop->name == PROPERTIES_NAME) {
- } else if(!ignoreSignals && prop->name == SIGNALS_NAME) {
- } else if(prop->name.length() >= 3 && prop->name.startsWith("on") &&
+ if (!ignoreProperties && prop->name == PROPERTIES_NAME) {
+ } else if (!ignoreSignals && prop->name == SIGNALS_NAME) {
+ } else if (prop->name.length() >= 3 && prop->name.startsWith("on") &&
('A' <= prop->name.at(2) && 'Z' >= prop->name.at(2))) {
COMPILE_CHECK(compileSignal(prop, obj));
} else {
@@ -600,18 +602,18 @@ bool QmlCompiler::compileObject(Object *obj, int ctxt)
}
}
- if(obj->defaultProperty)
+ if (obj->defaultProperty)
COMPILE_CHECK(compileProperty(obj->defaultProperty, obj, ctxt));
- if(obj->type != -1) {
- if(output->types.at(obj->type).component) {
+ if (obj->type != -1) {
+ if (output->types.at(obj->type).component) {
QmlInstruction complete;
complete.type = QmlInstruction::TryCompleteObject;
complete.line = obj->line;
output->bytecode << complete;
} else {
int cast = QmlMetaType::qmlParserStatusCast(QmlMetaType::type(output->types.at(obj->type).className));
- if(cast != -1) {
+ if (cast != -1) {
QmlInstruction complete;
complete.type = QmlInstruction::CompleteObject;
complete.complete.castValue = cast;
@@ -627,30 +629,30 @@ bool QmlCompiler::compileObject(Object *obj, int ctxt)
bool QmlCompiler::compileComponent(Object *obj, int ctxt)
{
Property *idProp = 0;
- if(obj->properties.count() > 1 ||
+ if (obj->properties.count() > 1 ||
(obj->properties.count() == 1 && obj->properties.begin().key() != "id"))
COMPILE_EXCEPTION("Invalid component specification");
- if(obj->defaultProperty &&
+ if (obj->defaultProperty &&
(obj->defaultProperty->value || obj->defaultProperty->values.count() > 1 ||
(obj->defaultProperty->values.count() == 1 && !obj->defaultProperty->values.first()->object)))
COMPILE_EXCEPTION("Invalid component body specification");
- if(obj->properties.count())
+ if (obj->properties.count())
idProp = *obj->properties.begin();
- if(idProp && (idProp->value || idProp->values.count() > 1))
+ if (idProp && (idProp->value || idProp->values.count() > 1))
COMPILE_EXCEPTION("Invalid component id specification");
Object *root = 0;
- if(obj->defaultProperty && obj->defaultProperty->values.count())
+ if (obj->defaultProperty && obj->defaultProperty->values.count())
root = obj->defaultProperty->values.first()->object;
COMPILE_CHECK(compileComponentFromRoot(root, ctxt));
- if(idProp && idProp->values.count()) {
+ if (idProp && idProp->values.count()) {
QString val = idProp->values.at(0)->primitive;
- if(!isValidId(val))
+ if (!isValidId(val))
COMPILE_EXCEPTION("Invalid id property value");
- if(ids.contains(val))
+ if (ids.contains(val))
COMPILE_EXCEPTION("id is not unique");
ids.insert(val);
@@ -682,7 +684,7 @@ bool QmlCompiler::compileComponentFromRoot(Object *obj, int ctxt)
QSet<QString> oldIds = ids;
ids.clear();
- if(obj)
+ if (obj)
COMPILE_CHECK(compileObject(obj, ctxt));
ids = oldIds;
@@ -696,11 +698,11 @@ bool QmlCompiler::compileComponentFromRoot(Object *obj, int ctxt)
bool QmlCompiler::compileFetchedObject(Object *obj, int ctxt)
{
- if(obj->defaultProperty)
+ if (obj->defaultProperty)
COMPILE_CHECK(compileProperty(obj->defaultProperty, obj, ctxt));
foreach(Property *prop, obj->properties) {
- if(prop->name.length() >= 3 && prop->name.startsWith("on") &&
+ if (prop->name.length() >= 3 && prop->name.startsWith("on") &&
('A' <= prop->name.at(2) && 'Z' >= prop->name.at(2))) {
COMPILE_CHECK(compileSignal(prop, obj));
} else {
@@ -713,18 +715,18 @@ bool QmlCompiler::compileFetchedObject(Object *obj, int ctxt)
bool QmlCompiler::compileSignal(Property *prop, Object *obj)
{
- if(prop->values.isEmpty() && !prop->value)
+ if (prop->values.isEmpty() && !prop->value)
return true;
- if(prop->value || prop->values.count() > 1)
+ if (prop->value || prop->values.count() > 1)
COMPILE_EXCEPTION("Incorrectly specified signal");
- if(prop->values.at(0)->object) {
+ if (prop->values.at(0)->object) {
int pr = output->indexForByteArray(prop->name);
bool rv = compileObject(prop->values.at(0)->object, 0);
- if(rv) {
+ if (rv) {
QmlInstruction assign;
assign.type = QmlInstruction::AssignSignalObject;
assign.line = prop->values.at(0)->line;
@@ -739,10 +741,10 @@ bool QmlCompiler::compileSignal(Property *prop, Object *obj)
} else {
QString script = prop->values.at(0)->primitive.trimmed();
- if(script.isEmpty())
+ if (script.isEmpty())
return true;
- if(isBinding(script))
+ if (isBinding(script))
COMPILE_EXCEPTION("Cannot assign binding to signal property");
int idx = output->indexForString(script);
@@ -764,25 +766,25 @@ bool QmlCompiler::compileSignal(Property *prop, Object *obj)
bool QmlCompiler::compileProperty(Property *prop, Object *obj, int ctxt)
{
- if(prop->values.isEmpty() && !prop->value)
+ if (prop->values.isEmpty() && !prop->value)
return true;
// First we're going to need a reference to this property
- if(obj->type != -1) {
+ if (obj->type != -1) {
const QMetaObject *mo = obj->metaObject();
- if(mo) {
- if(prop->isDefault) {
+ if (mo) {
+ if (prop->isDefault) {
QMetaProperty p = QmlMetaType::defaultProperty(mo);
// XXX
// Currently we don't handle enums in the static analysis
// so we let them drop through to generateStoreInstruction()
- if(p.name() && !p.isEnumType()) {
+ if (p.name() && !p.isEnumType()) {
prop->index = mo->indexOfProperty(p.name());
prop->name = p.name();
int t = p.type();
- if(t == QVariant::UserType)
+ if (t == QVariant::UserType)
t = p.userType();
prop->type = t;
@@ -793,9 +795,9 @@ bool QmlCompiler::compileProperty(Property *prop, Object *obj, int ctxt)
// XXX
// Currently we don't handle enums in the static analysis
// so we let them drop through to generateStoreInstruction()
- if(p.name() && !p.isEnumType()) {
+ if (p.name() && !p.isEnumType()) {
int t = p.type();
- if(t == QVariant::UserType)
+ if (t == QVariant::UserType)
t = p.userType();
prop->type = t;
@@ -804,41 +806,41 @@ bool QmlCompiler::compileProperty(Property *prop, Object *obj, int ctxt)
}
} else {
const QMetaObject *mo = obj->metaObject();
- if(mo) {
- if(prop->isDefault) {
+ if (mo) {
+ if (prop->isDefault) {
QMetaProperty p = QmlMetaType::defaultProperty(mo);
- if(p.name()) {
+ if (p.name()) {
prop->index = mo->indexOfProperty(p.name());
prop->name = p.name();
}
int t = p.type();
- if(t == QVariant::UserType)
+ if (t == QVariant::UserType)
t = p.userType();
prop->type = t;
} else {
prop->index = mo->indexOfProperty(prop->name.constData());
QMetaProperty p = mo->property(prop->index);
int t = p.type();
- if(t == QVariant::UserType)
+ if (t == QVariant::UserType)
t = p.userType();
prop->type = t;
}
}
}
- if(prop->name == "id") {
+ if (prop->name == "id") {
COMPILE_CHECK(compileIdProperty(prop, obj));
- } else if(isAttachedProperty(prop->name)) {
+ } else if (isAttachedProperty(prop->name)) {
COMPILE_CHECK(compileAttachedProperty(prop, obj, ctxt));
- } else if(prop->value) {
+ } else if (prop->value) {
COMPILE_CHECK(compileNestedProperty(prop, ctxt));
- } else if(QmlMetaType::isQmlList(prop->type) ||
+ } else if (QmlMetaType::isQmlList(prop->type) ||
QmlMetaType::isList(prop->type)) {
COMPILE_CHECK(compileListProperty(prop, obj, ctxt));
@@ -855,24 +857,24 @@ bool QmlCompiler::compileProperty(Property *prop, Object *obj, int ctxt)
bool QmlCompiler::compileIdProperty(QmlParser::Property *prop,
QmlParser::Object *obj)
{
- if(prop->value)
+ if (prop->value)
COMPILE_EXCEPTION("The 'id' property cannot be fetched");
- if(prop->values.count() > 1)
+ if (prop->values.count() > 1)
COMPILE_EXCEPTION("The 'id' property cannot be multiset");
- if(prop->values.count() == 1) {
- if(prop->values.at(0)->object)
+ if (prop->values.count() == 1) {
+ if (prop->values.at(0)->object)
COMPILE_EXCEPTION("Cannot assign an object as an id");
QString val = prop->values.at(0)->primitive;
- if(!isValidId(val))
+ if (!isValidId(val))
COMPILE_EXCEPTION(val << "is not a valid id");
- if(ids.contains(val))
+ if (ids.contains(val))
COMPILE_EXCEPTION("id is not unique");
ids.insert(val);
int pref = output->indexForString(val);
- if(prop->type == QVariant::String) {
+ if (prop->type == QVariant::String) {
QmlInstruction assign;
assign.type = QmlInstruction::StoreString;
assign.storeString.propertyIndex = prop->index;
@@ -903,14 +905,14 @@ bool QmlCompiler::compileAttachedProperty(QmlParser::Property *prop,
QmlParser::Object *obj,
int ctxt)
{
- if(!prop->value)
+ if (!prop->value)
COMPILE_EXCEPTION("Incorrect usage of an attached property");
QmlInstruction fetch;
fetch.type = QmlInstruction::FetchAttached;
fetch.line = prop->line;
int id = QmlMetaType::attachedPropertiesFuncId(prop->name);
- if(id == -1)
+ if (id == -1)
COMPILE_EXCEPTION("Non-existant attached property object" << prop->name);
fetch.fetchAttached.id = id;
output->bytecode << fetch;
@@ -928,11 +930,11 @@ bool QmlCompiler::compileAttachedProperty(QmlParser::Property *prop,
bool QmlCompiler::compileNestedProperty(QmlParser::Property *prop,
int ctxt)
{
- if(prop->type != 0)
+ if (prop->type != 0)
prop->value->metatype = QmlMetaType::metaObjectForType(prop->type);
QmlInstruction fetch;
- if(prop->index != -1 &&
+ if (prop->index != -1 &&
QmlMetaType::isObject(prop->value->metatype)) {
fetch.type = QmlInstruction::FetchObject;
fetch.fetch.property = prop->index;
@@ -959,7 +961,7 @@ bool QmlCompiler::compileListProperty(QmlParser::Property *prop,
int ctxt)
{
int t = prop->type;
- if(QmlMetaType::isQmlList(t)) {
+ if (QmlMetaType::isQmlList(t)) {
QmlInstruction fetch;
fetch.line = prop->line;
fetch.type = QmlInstruction::FetchQmlList;
@@ -967,9 +969,9 @@ bool QmlCompiler::compileListProperty(QmlParser::Property *prop,
fetch.fetchQmlList.type = QmlMetaType::qmlListType(t);
output->bytecode << fetch;
- for(int ii = 0; ii < prop->values.count(); ++ii) {
+ for (int ii = 0; ii < prop->values.count(); ++ii) {
Value *v = prop->values.at(ii);
- if(v->object) {
+ if (v->object) {
v->type = Value::CreatedObject;
COMPILE_CHECK(compileObject(v->object, ctxt));
QmlInstruction assign;
@@ -997,9 +999,9 @@ bool QmlCompiler::compileListProperty(QmlParser::Property *prop,
output->bytecode << fetch;
bool assignedBinding = false;
- for(int ii = 0; ii < prop->values.count(); ++ii) {
+ for (int ii = 0; ii < prop->values.count(); ++ii) {
Value *v = prop->values.at(ii);
- if(v->object) {
+ if (v->object) {
v->type = Value::CreatedObject;
COMPILE_CHECK(compileObject(v->object, ctxt));
QmlInstruction assign;
@@ -1008,8 +1010,8 @@ bool QmlCompiler::compileListProperty(QmlParser::Property *prop,
assign.assignObject.property = output->indexForByteArray(prop->name);
assign.assignObject.castValue = 0;
output->bytecode << assign;
- } else if(isBinding(v->primitive)) {
- if(assignedBinding)
+ } else if (isBinding(v->primitive)) {
+ if (assignedBinding)
COMPILE_EXCEPTION("Can only assign one binding to lists");
compileBinding(v->primitive, prop, ctxt, obj->metaObject(), v->line);
@@ -1031,9 +1033,9 @@ bool QmlCompiler::compilePropertyAssignment(QmlParser::Property *prop,
QmlParser::Object *obj,
int ctxt)
{
- for(int ii = 0; ii < prop->values.count(); ++ii) {
+ for (int ii = 0; ii < prop->values.count(); ++ii) {
Value *v = prop->values.at(ii);
- if(v->object) {
+ if (v->object) {
COMPILE_CHECK(compilePropertyObjectAssignment(prop, obj, v, ctxt));
@@ -1052,10 +1054,10 @@ bool QmlCompiler::compilePropertyObjectAssignment(QmlParser::Property *prop,
QmlParser::Value *v,
int ctxt)
{
- if(v->object->type != -1)
+ if (v->object->type != -1)
v->object->metatype = QmlMetaType::metaObjectForType(output->types.at(v->object->type).className);
- if(v->object->metaObject()) {
+ if (v->object->metaObject()) {
const QMetaObject *propmo =
QmlMetaType::rawMetaObjectForType(prop->type);
@@ -1063,7 +1065,7 @@ bool QmlCompiler::compilePropertyObjectAssignment(QmlParser::Property *prop,
bool isPropertyValue = false;
bool isAssignable = false;
- if(propmo) {
+ if (propmo) {
// We want to raw metaObject here as the raw metaobject is the
// actual property type before we applied any extensions
const QMetaObject *c = v->object->metatype;
@@ -1080,14 +1082,14 @@ bool QmlCompiler::compilePropertyObjectAssignment(QmlParser::Property *prop,
}
}
- if(!propmo && !isPropertyValue) {
+ if (!propmo && !isPropertyValue) {
COMPILE_CHECK(compileObject(v->object, ctxt));
QmlInstruction assign;
assign.type = QmlInstruction::AssignObject;
assign.line = v->object->line;
assign.assignObject.castValue = 0;
- if(prop->isDefault)
+ if (prop->isDefault)
assign.assignObject.property = -1;
else
assign.assignObject.property =
@@ -1095,7 +1097,7 @@ bool QmlCompiler::compilePropertyObjectAssignment(QmlParser::Property *prop,
output->bytecode << assign;
v->type = Value::CreatedObject;
- } else if(isAssignable) {
+ } else if (isAssignable) {
COMPILE_CHECK(compileObject(v->object, ctxt));
QmlInstruction assign;
@@ -1107,7 +1109,7 @@ bool QmlCompiler::compilePropertyObjectAssignment(QmlParser::Property *prop,
output->bytecode << assign;
v->type = Value::CreatedObject;
- } else if(propmo == &QmlComponent::staticMetaObject) {
+ } else if (propmo == &QmlComponent::staticMetaObject) {
COMPILE_CHECK(compileComponentFromRoot(v->object, ctxt));
@@ -1120,7 +1122,7 @@ bool QmlCompiler::compilePropertyObjectAssignment(QmlParser::Property *prop,
output->bytecode << assign;
v->type = Value::Component;
- } else if(isPropertyValue) {
+ } else if (isPropertyValue) {
COMPILE_CHECK(compileObject(v->object, ctxt));
if (prop->index != -1) {
@@ -1163,7 +1165,7 @@ bool QmlCompiler::compilePropertyLiteralAssignment(QmlParser::Property *prop,
QmlParser::Value *v,
int ctxt)
{
- if(isBinding(v->primitive)) {
+ if (isBinding(v->primitive)) {
compileBinding(v->primitive, prop, ctxt, obj->metaObject(), v->line);
@@ -1175,28 +1177,28 @@ bool QmlCompiler::compilePropertyLiteralAssignment(QmlParser::Property *prop,
assign.line = v->line;
bool doassign = true;
- if(prop->index != -1) {
+ if (prop->index != -1) {
StoreInstructionResult r =
generateStoreInstruction(*output, assign, obj->metaObject()->property(prop->index), prop->index, -1, &v->primitive);
- if(r == Ok) {
+ if (r == Ok) {
doassign = false;
- } else if(r == InvalidData) {
+ } else if (r == InvalidData) {
//### we are restricted to a rather generic message here. If we can find a way to move
// the exception into generateStoreInstruction we could potentially have better messages.
// (the problem is that both compile and run exceptions can be generated, though)
COMPILE_EXCEPTION("Cannot assign value" << v->primitive << "to property" << obj->metaObject()->property(prop->index).name());
doassign = false;
- } else if(r == ReadOnly) {
+ } else if (r == ReadOnly) {
COMPILE_EXCEPTION("Cannot assign value" << v->primitive << "to the read-only property" << obj->metaObject()->property(prop->index).name());
} else {
doassign = true;
}
}
- if(doassign) {
+ if (doassign) {
assign.type = QmlInstruction::AssignConstant;
- if(prop->isDefault) {
+ if (prop->isDefault) {
assign.assignConstant.property = -1;
} else {
assign.assignConstant.property =
@@ -1236,17 +1238,17 @@ bool QmlCompiler::findDynamicProperties(QmlParser::Property *prop,
sizeof(propTypeNameToTypes[0]);
- if(prop->value)
+ if (prop->value)
COMPILE_EXCEPTION("Invalid property specification");
bool seenDefault = false;
- for(int ii = 0; ii < prop->values.count(); ++ii) {
+ for (int ii = 0; ii < prop->values.count(); ++ii) {
QmlParser::Value *val = prop->values.at(ii);
- if(!val->object)
+ if (!val->object)
COMPILE_EXCEPTION("Invalid property specification");
QmlParser::Object *obj = val->object;
- if(obj->type == -1 || output->types.at(obj->type).className != "Property")
+ if (obj->type == -1 || output->types.at(obj->type).className != "Property")
COMPILE_EXCEPTION("Use Property tag to specify properties");
@@ -1257,75 +1259,75 @@ bool QmlCompiler::findDynamicProperties(QmlParser::Property *prop,
Object::DynamicProperty propDef;
- for(QHash<QByteArray, QmlParser::Property *>::ConstIterator iter =
+ for (QHash<QByteArray, QmlParser::Property *>::ConstIterator iter =
obj->properties.begin();
iter != obj->properties.end();
++iter) {
QmlParser::Property *property = *iter;
- if(property->name == "name") {
+ if (property->name == "name") {
if (seen & Name)
COMPILE_EXCEPTION("May only specify Property name once");
seen = (Seen)(seen | Name);
- if(property->value || property->values.count() != 1 ||
+ if (property->value || property->values.count() != 1 ||
property->values.at(0)->object)
COMPILE_EXCEPTION("Invalid Property name");
propDef.name = property->values.at(0)->primitive.toLatin1();
- } else if(property->name == "type") {
+ } else if (property->name == "type") {
if (seen & Type)
COMPILE_EXCEPTION("May only specify Property type once");
seen = (Seen)(seen | Type);
- if(property->value || property->values.count() != 1 ||
+ if (property->value || property->values.count() != 1 ||
property->values.at(0)->object)
COMPILE_EXCEPTION("Invalid Property type");
QString type = property->values.at(0)->primitive.toLower();
bool found = false;
- for(int ii = 0; !found && ii < propTypeNameToTypesCount; ++ii) {
- if(type == QLatin1String(propTypeNameToTypes[ii].name)){
+ for (int ii = 0; !found && ii < propTypeNameToTypesCount; ++ii) {
+ if (type == QLatin1String(propTypeNameToTypes[ii].name)){
found = true;
propDef.type = propTypeNameToTypes[ii].type;
}
}
- if(!found)
+ if (!found)
COMPILE_EXCEPTION("Invalid Property type");
- } else if(property->name == "value") {
+ } else if (property->name == "value") {
if (seen & Value)
COMPILE_EXCEPTION("May only specify Property value once");
seen = (Seen)(seen | Value);
propDef.defaultValue = property;
- } else if(property->name == "onValueChanged") {
+ } else if (property->name == "onValueChanged") {
if (seen & ValueChanged)
COMPILE_EXCEPTION("May only specify Property onValueChanged once");
seen = (Seen)(seen | ValueChanged);
- if(property->value || property->values.count() != 1 ||
+ if (property->value || property->values.count() != 1 ||
property->values.at(0)->object)
COMPILE_EXCEPTION("Invalid Property onValueChanged");
propDef.onValueChanged = property->values.at(0)->primitive;
- } else if(property->name == "default") {
- if(seen & Default)
+ } else if (property->name == "default") {
+ if (seen & Default)
COMPILE_EXCEPTION("May only specify Property default once");
seen = (Seen)(seen | Default);
- if(property->value || property->values.count() != 1 ||
+ if (property->value || property->values.count() != 1 ||
property->values.at(0)->object)
COMPILE_EXCEPTION("Invalid Property default");
bool defaultValue =
QmlStringConverters::boolFromString(property->values.at(0)->primitive);
propDef.isDefaultProperty = defaultValue;
- if(defaultValue) {
- if(seenDefault)
+ if (defaultValue) {
+ if (seenDefault)
COMPILE_EXCEPTION("Only one property may be the default");
seenDefault = true;
}
@@ -1335,15 +1337,15 @@ bool QmlCompiler::findDynamicProperties(QmlParser::Property *prop,
}
}
- if(obj->defaultProperty) {
- if(seen & Value)
+ if (obj->defaultProperty) {
+ if (seen & Value)
COMPILE_EXCEPTION("May only specify Property value once");
seen = (Seen)(seen | Value);
propDef.defaultValue = obj->defaultProperty;
}
- if(!(seen & Name))
+ if (!(seen & Name))
COMPILE_EXCEPTION("Must specify Property name");
definedProperties << propDef;
@@ -1358,33 +1360,33 @@ bool QmlCompiler::findDynamicSignals(QmlParser::Property *sigs,
{
QList<Object::DynamicSignal> definedSignals;
- if(sigs->value)
+ if (sigs->value)
COMPILE_EXCEPTION("Invalid signal specification");
- for(int ii = 0; ii < sigs->values.count(); ++ii) {
+ for (int ii = 0; ii < sigs->values.count(); ++ii) {
QmlParser::Value *val = sigs->values.at(ii);
- if(!val->object)
+ if (!val->object)
COMPILE_EXCEPTION("Invalid signal specification");
QmlParser::Object *obj = val->object;
- if(obj->type == -1 || output->types.at(obj->type).className != "Signal")
+ if (obj->type == -1 || output->types.at(obj->type).className != "Signal")
COMPILE_EXCEPTION("Use Signal tag to specify signals");
enum Seen { None = 0, Name = 0x01 } seen = None;
Object::DynamicSignal sigDef;
- for(QHash<QByteArray, QmlParser::Property *>::ConstIterator iter =
+ for (QHash<QByteArray, QmlParser::Property *>::ConstIterator iter =
obj->properties.begin();
iter != obj->properties.end();
++iter) {
QmlParser::Property *property = *iter;
- if(property->name == "name") {
+ if (property->name == "name") {
if (seen & Name)
COMPILE_EXCEPTION("May only specify Signal name once");
seen = (Seen)(seen | Name);
- if(property->value || property->values.count() != 1 ||
+ if (property->value || property->values.count() != 1 ||
property->values.at(0)->object)
COMPILE_EXCEPTION("Invalid Signal name");
@@ -1396,10 +1398,10 @@ bool QmlCompiler::findDynamicSignals(QmlParser::Property *sigs,
}
- if(obj->defaultProperty)
+ if (obj->defaultProperty)
COMPILE_EXCEPTION("Invalid Signal property");
- if(!(seen & Name))
+ if (!(seen & Name))
COMPILE_EXCEPTION("Must specify Signal name");
definedSignals << sigDef;
@@ -1411,23 +1413,23 @@ bool QmlCompiler::findDynamicSignals(QmlParser::Property *sigs,
bool QmlCompiler::compileDynamicPropertiesAndSignals(QmlParser::Object *obj)
{
- if(obj->dynamicPropertiesProperty)
+ if (obj->dynamicPropertiesProperty)
findDynamicProperties(obj->dynamicPropertiesProperty, obj);
- if(obj->dynamicSignalsProperty)
+ if (obj->dynamicSignalsProperty)
findDynamicSignals(obj->dynamicSignalsProperty, obj);
- if(obj->dynamicProperties.isEmpty() && obj->dynamicSignals.isEmpty())
+ if (obj->dynamicProperties.isEmpty() && obj->dynamicSignals.isEmpty())
return true;
QMetaObjectBuilder builder;
- if(obj->metatype)
+ if (obj->metatype)
builder.setClassName(QByteArray(obj->metatype->className()) + "QML");
builder.setFlags(QMetaObjectBuilder::DynamicMetaObject);
- for(int ii = 0; ii < obj->dynamicProperties.count(); ++ii) {
+ for (int ii = 0; ii < obj->dynamicProperties.count(); ++ii) {
const Object::DynamicProperty &p = obj->dynamicProperties.at(ii);
- if(p.isDefaultProperty)
+ if (p.isDefaultProperty)
builder.addClassInfo("DefaultProperty", p.name);
QByteArray type;
@@ -1459,12 +1461,12 @@ bool QmlCompiler::compileDynamicPropertiesAndSignals(QmlParser::Object *obj)
builder.addProperty(p.name, type, ii);
}
- for(int ii = 0; ii < obj->dynamicSignals.count(); ++ii) {
+ for (int ii = 0; ii < obj->dynamicSignals.count(); ++ii) {
const Object::DynamicSignal &s = obj->dynamicSignals.at(ii);
builder.addSignal(s.name + "()");
}
- if(obj->metatype)
+ if (obj->metatype)
builder.setSuperClass(obj->metatype);
obj->extObject = builder.toMetaObject();
@@ -1476,16 +1478,16 @@ bool QmlCompiler::compileDynamicPropertiesAndSignals(QmlParser::Object *obj)
store.line = obj->line;
output->bytecode << store;
- for(int ii = 0; ii < obj->dynamicProperties.count(); ++ii) {
+ for (int ii = 0; ii < obj->dynamicProperties.count(); ++ii) {
const Object::DynamicProperty &p = obj->dynamicProperties.at(ii);
- if(p.defaultValue) {
+ if (p.defaultValue) {
p.defaultValue->name = p.name;
p.defaultValue->isDefault = false;
COMPILE_CHECK(compileProperty(p.defaultValue, obj, 0));
}
- if(!p.onValueChanged.isEmpty()) {
+ if (!p.onValueChanged.isEmpty()) {
QmlInstruction assign;
assign.type = QmlInstruction::AssignSignal;
assign.line = obj->line;
@@ -1510,7 +1512,7 @@ void QmlCompiler::compileBinding(const QString &str, QmlParser::Property *prop,
bs.compile(bind.toLatin1());
int bref;
- if(bs.isValid()) {
+ if (bs.isValid()) {
bref = output->indexForByteArray(QByteArray(bs.compileData(), bs.compileDataSize()));
} else {
bref = output->indexForString(bind);
@@ -1519,8 +1521,8 @@ void QmlCompiler::compileBinding(const QString &str, QmlParser::Property *prop,
QmlInstruction assign;
assign.assignBinding.context = ctxt;
assign.line = line;
- if(prop->index != -1) {
- if(bs.isValid())
+ if (prop->index != -1) {
+ if (bs.isValid())
assign.type = QmlInstruction::StoreCompiledBinding;
else
assign.type = QmlInstruction::StoreBinding;
@@ -1528,13 +1530,13 @@ void QmlCompiler::compileBinding(const QString &str, QmlParser::Property *prop,
assign.assignBinding.property = prop->index;
assign.assignBinding.value = bref;
assign.assignBinding.category = QmlMetaProperty::Unknown;
- if(mo) {
+ if (mo) {
//XXX we should generate an exception if the property is read-only
QMetaProperty mp = mo->property(assign.assignBinding.property);
assign.assignBinding.category = QmlMetaProperty::propertyCategory(mp);
}
} else {
- if(bs.isValid())
+ if (bs.isValid())
assign.type = QmlInstruction::AssignCompiledBinding;
else
assign.type = QmlInstruction::AssignBinding;
@@ -1551,42 +1553,42 @@ int QmlCompiler::optimizeExpressions(int start, int end, int patch)
int saveCount = 0;
int newInstrs = 0;
- for(int ii = start; ii <= end; ++ii) {
+ for (int ii = start; ii <= end; ++ii) {
const QmlInstruction &instr = output->bytecode.at(ii);
- if(instr.type == QmlInstruction::CreateComponent) {
+ if (instr.type == QmlInstruction::CreateComponent) {
ii += instr.createComponent.count - 1;
continue;
}
- if(instr.type == QmlInstruction::SetId) {
+ if (instr.type == QmlInstruction::SetId) {
QString id = output->primitives.at(instr.setId.value);
ids.insert(id, ii);
}
}
- for(int ii = start; ii <= end; ++ii) {
+ for (int ii = start; ii <= end; ++ii) {
const QmlInstruction &instr = output->bytecode.at(ii);
- if(instr.type == QmlInstruction::CreateComponent) {
+ if (instr.type == QmlInstruction::CreateComponent) {
ii += instr.createComponent.count - 1;
continue;
}
- if(instr.type == QmlInstruction::StoreCompiledBinding) {
+ if (instr.type == QmlInstruction::StoreCompiledBinding) {
QmlBasicScript s(output->datas.at(instr.assignBinding.value).constData());
- if(s.isSingleLoad()) {
+ if (s.isSingleLoad()) {
QString slt = QLatin1String(s.singleLoadTarget());
- if(!slt.at(0).isUpper())
+ if (!slt.at(0).isUpper())
continue;
- if(ids.contains(slt) &&
+ if (ids.contains(slt) &&
instr.assignBinding.category == QmlMetaProperty::Object) {
int id = ids[slt];
int saveId = -1;
- if(output->bytecode.at(id).setId.save != -1) {
+ if (output->bytecode.at(id).setId.save != -1) {
saveId = output->bytecode.at(id).setId.save;
} else {
output->bytecode[id].setId.save = saveCount;
@@ -1613,7 +1615,7 @@ int QmlCompiler::optimizeExpressions(int start, int end, int patch)
}
- if(saveCount)
+ if (saveCount)
output->bytecode[patch].init.dataSize = saveCount;
return newInstrs;
@@ -1630,8 +1632,8 @@ QmlCompiledData::QmlCompiledData(const QmlCompiledData &other)
QmlCompiledData::~QmlCompiledData()
{
- for(int ii = 0; ii < types.count(); ++ii) {
- if(types.at(ii).ref)
+ for (int ii = 0; ii < types.count(); ++ii) {
+ if (types.at(ii).ref)
types.at(ii).ref->release();
}
}
@@ -1651,12 +1653,12 @@ QmlCompiledData &QmlCompiledData::operator=(const QmlCompiledData &other)
QObject *QmlCompiledData::TypeReference::createInstance(QmlContext *ctxt) const
{
- if(type) {
+ if (type) {
QObject *rv = type->create();
- if(rv)
+ if (rv)
QmlEngine::setContextForObject(rv, ctxt);
return rv;
- } else if(component) {
+ } else if (component) {
return component->create(ctxt);
} else {
return 0;
diff --git a/src/declarative/qml/qmlcompiler_p.h b/src/declarative/qml/qmlcompiler_p.h
index 286cda8..2a06f73 100644
--- a/src/declarative/qml/qmlcompiler_p.h
+++ b/src/declarative/qml/qmlcompiler_p.h
@@ -50,7 +50,6 @@
class QStringList;
QT_BEGIN_NAMESPACE
-class QmlXmlParser;
class QmlEngine;
class QmlComponent;
class QmlCompiledComponent;
diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp
index 83d500c..2c3ebd6 100644
--- a/src/declarative/qml/qmlcomponent.cpp
+++ b/src/declarative/qml/qmlcomponent.cpp
@@ -51,15 +51,26 @@
#include <qmlengine.h>
#include <QFileInfo>
#include <qmlbindablevalue.h>
-#include "private/qmlxmlparser_p.h"
#include "qmlcompiledcomponent_p.h"
#include <QtCore/qdebug.h>
#include <QApplication>
+#include "qmlscriptparser_p.h"
QT_BEGIN_NAMESPACE
class QByteArray;
+bool QmlComponentPrivate::isXml(const QByteArray &ba)
+{
+ for (int i = 0; i < ba.size(); ++i) {
+ char c = ba.at(i);
+ if (c == ' ' || c == '\n' || c == '\r' || c == '\t')
+ continue;
+ return (c == '<');
+ }
+ return true;
+}
+
/*!
\class QmlComponent
\brief The QmlComponent class encapsulates a QML component description.
@@ -119,7 +130,7 @@ void QmlComponentPrivate::fromTypeData(QmlCompositeTypeData *data)
url = QUrl(data->url);
QmlCompiledComponent *c = data->toCompiledComponent(engine);
- if(!c) {
+ if (!c) {
Q_ASSERT(data->status == QmlCompositeTypeData::Error);
errorDescription = data->errorDescription;
@@ -137,13 +148,13 @@ void QmlComponentPrivate::fromTypeData(QmlCompositeTypeData *data)
void QmlComponentPrivate::clear()
{
- if(typeData) {
+ if (typeData) {
typeData->remWaiter(this);
typeData->release();
typeData = 0;
}
- if(cc) {
+ if (cc) {
cc->release();
cc = 0;
}
@@ -175,11 +186,11 @@ QmlComponent::Status QmlComponent::status() const
{
Q_D(const QmlComponent);
- if(d->typeData)
+ if (d->typeData)
return Loading;
- else if(d->engine && d->cc)
+ else if (d->engine && d->cc)
return Ready;
- else if(!d->errorDescription.isEmpty())
+ else if (!d->errorDescription.isEmpty())
return Error;
else
return Null;
@@ -296,7 +307,7 @@ void QmlComponent::setData(const QByteArray &data, const QUrl &url)
QmlCompositeTypeData *typeData =
d->engine->d_func()->typeManager.getImmediate(data, url);
- if(typeData->status == QmlCompositeTypeData::Waiting) {
+ if (typeData->status == QmlCompositeTypeData::Waiting) {
d->typeData = typeData;
d->typeData->addWaiter(d);
@@ -324,7 +335,7 @@ void QmlComponent::loadUrl(const QUrl &url)
QmlCompositeTypeData *data =
d->engine->d_func()->typeManager.get(url);
- if(data->status == QmlCompositeTypeData::Waiting) {
+ if (data->status == QmlCompositeTypeData::Waiting) {
d->typeData = data;
d->typeData->addWaiter(d);
@@ -341,7 +352,7 @@ void QmlComponent::loadUrl(const QUrl &url)
QString QmlComponent::errorDescription() const
{
Q_D(const QmlComponent);
- if(isError())
+ if (isError())
return d->errorDescription;
else
return QString();
@@ -377,10 +388,10 @@ QObject *QmlComponent::create(QmlContext *context)
{
Q_D(QmlComponent);
- if(!context)
+ if (!context)
context = d->engine->rootContext();
- if(context->engine() != d->engine) {
+ if (context->engine() != d->engine) {
qWarning("QmlComponent::create(): Must create component in context from the same QmlEngine");
return 0;
}
@@ -417,12 +428,12 @@ QObject *QmlComponent::beginCreate(QmlContext *context)
{
Q_D(QmlComponent);
- if(!context) {
+ if (!context) {
qWarning("QmlComponent::beginCreate(): Cannot create a component in a null context");
return 0;
}
- if(context->engine() != d->engine) {
+ if (context->engine() != d->engine) {
qWarning("QmlComponent::beginCreate(): Must create component in context from the same QmlEngine");
return 0;
}
@@ -432,7 +443,7 @@ QObject *QmlComponent::beginCreate(QmlContext *context)
return 0;
}
- if(!isReady()) {
+ if (!isReady()) {
qWarning("QmlComponent: Cannot create un-ready component");
return 0;
}
@@ -440,7 +451,7 @@ QObject *QmlComponent::beginCreate(QmlContext *context)
#ifdef Q_ENABLE_PERFORMANCE_LOG
QFxPerfTimer<QFxPerf::CreateComponent> perf;
#endif
- if(!d->engine->d_func()->rootComponent)
+ if (!d->engine->d_func()->rootComponent)
d->engine->d_func()->rootComponent = this;
QmlContext *ctxt =
@@ -451,7 +462,7 @@ QObject *QmlComponent::beginCreate(QmlContext *context)
QmlVME vme;
QObject *rv = vme.run(ctxt, d->cc, d->start, d->count);
- if(vme.isError()) {
+ if (vme.isError()) {
qWarning().nospace()
#ifdef QML_VERBOSEERRORS_ENABLED
<< "QmlComponent: "
@@ -463,10 +474,10 @@ QObject *QmlComponent::beginCreate(QmlContext *context)
ctxt->deactivate();
- if(rv) {
+ if (rv) {
QFx_setParent_noEvent(ctxt, rv);
QmlEnginePrivate *ep = d->engine->d_func();
- if(ep->rootComponent == this) {
+ if (ep->rootComponent == this) {
ep->rootComponent = 0;
d->bindValues = ep->currentBindValues;
@@ -497,13 +508,13 @@ void QmlComponent::completeCreate()
#ifdef Q_ENABLE_PERFORMANCE_LOG
QFxPerfTimer<QFxPerf::BindInit> bi;
#endif
- for(int ii = 0; ii < d->bindValues.count(); ++ii)
+ for (int ii = 0; ii < d->bindValues.count(); ++ii)
d->bindValues.at(ii)->init();
}
QSet<QmlParserStatus *> done;
- for(int ii = 0; ii < d->parserStatus.count(); ++ii) {
+ for (int ii = 0; ii < d->parserStatus.count(); ++ii) {
QmlParserStatus *ps = d->parserStatus.at(ii);
- if(!done.contains(ps)) {
+ if (!done.contains(ps)) {
done.insert(ps);
ps->componentComplete();
}
diff --git a/src/declarative/qml/qmlcomponent_p.h b/src/declarative/qml/qmlcomponent_p.h
index 8074775..bb5f7bb 100644
--- a/src/declarative/qml/qmlcomponent_p.h
+++ b/src/declarative/qml/qmlcomponent_p.h
@@ -81,6 +81,7 @@ public:
QmlEngine *engine;
void clear();
+ static bool isXml(const QByteArray &);
};
#endif // QMLCOMPONENT_P_H
diff --git a/src/declarative/qml/qmlcompositetypemanager.cpp b/src/declarative/qml/qmlcompositetypemanager.cpp
index b0d121c..7f2cc58 100644
--- a/src/declarative/qml/qmlcompositetypemanager.cpp
+++ b/src/declarative/qml/qmlcompositetypemanager.cpp
@@ -40,7 +40,7 @@
****************************************************************************/
#include <private/qmlcompositetypemanager_p.h>
-#include <private/qmlxmlparser_p.h>
+#include <private/qmlscriptparser_p.h>
#include <private/qmlcompiledcomponent_p.h>
#include <QtDeclarative/qmlengine.h>
#include <QtNetwork/qnetworkreply.h>
@@ -57,13 +57,13 @@ QmlCompositeTypeData::QmlCompositeTypeData()
QmlCompositeTypeData::~QmlCompositeTypeData()
{
- for(int ii = 0; ii < dependants.count(); ++ii)
+ for (int ii = 0; ii < dependants.count(); ++ii)
dependants.at(ii)->release();
- if(compiledComponent)
+ if (compiledComponent)
compiledComponent->release();
- if(component)
+ if (component)
delete component;
}
@@ -79,10 +79,10 @@ void QmlCompositeTypeData::remWaiter(QmlComponentPrivate *p)
QmlComponent *QmlCompositeTypeData::toComponent(QmlEngine *engine)
{
- if(!component) {
+ if (!component) {
QmlCompiledComponent *cc = toCompiledComponent(engine);
- if(cc) {
+ if (cc) {
component = new QmlComponent(engine, cc, -1, -1, 0);
} else {
component = new QmlComponent(engine, 0);
@@ -96,14 +96,14 @@ QmlComponent *QmlCompositeTypeData::toComponent(QmlEngine *engine)
QmlCompiledComponent *
QmlCompositeTypeData::toCompiledComponent(QmlEngine *engine)
{
- if(status == Complete && !compiledComponent) {
+ if (status == Complete && !compiledComponent) {
compiledComponent = new QmlCompiledComponent;
compiledComponent->url = QUrl(url);
compiledComponent->name = url.toLatin1(); // ###
QmlCompiler compiler;
- if(!compiler.compile(engine, this, compiledComponent)) {
+ if (!compiler.compile(engine, this, compiledComponent)) {
status = Error;
errorDescription = compiler.errorDescription() +
QLatin1String("@") +
@@ -117,7 +117,7 @@ QmlCompositeTypeData::toCompiledComponent(QmlEngine *engine)
data.clear();
}
- if(compiledComponent)
+ if (compiledComponent)
compiledComponent->addref();
return compiledComponent;
@@ -137,7 +137,7 @@ QmlCompositeTypeData *QmlCompositeTypeManager::get(const QUrl &url)
{
QmlCompositeTypeData *unit = components.value(url.toString());
- if(!unit) {
+ if (!unit) {
unit = new QmlCompositeTypeData;
unit->status = QmlCompositeTypeData::Waiting;
unit->url = url.toString();
@@ -162,8 +162,8 @@ QmlCompositeTypeManager::getImmediate(const QByteArray &data, const QUrl &url)
void QmlCompositeTypeManager::clearCache()
{
- for(Components::Iterator iter = components.begin(); iter != components.end();) {
- if((*iter)->status != QmlCompositeTypeData::Waiting) {
+ for (Components::Iterator iter = components.begin(); iter != components.end();) {
+ if ((*iter)->status != QmlCompositeTypeData::Waiting) {
(*iter)->release();
iter = components.erase(iter);
} else {
@@ -180,7 +180,7 @@ void QmlCompositeTypeManager::replyFinished()
QmlCompositeTypeData *unit = components.value(reply->url().toString());
Q_ASSERT(unit);
- if(reply->error() != QNetworkReply::NoError) {
+ if (reply->error() != QNetworkReply::NoError) {
QString errorDescription;
// ### - Fill in error
@@ -204,10 +204,10 @@ void QmlCompositeTypeManager::loadSource(QmlCompositeTypeData *unit)
{
QUrl url(unit->url);
- if(url.scheme() == QLatin1String("file")) {
+ if (url.scheme() == QLatin1String("file")) {
QFile file(url.toLocalFile());
- if(file.open(QFile::ReadOnly)) {
+ if (file.open(QFile::ReadOnly)) {
QByteArray data = file.readAll();
setData(unit, data, url);
} else {
@@ -231,7 +231,7 @@ void QmlCompositeTypeManager::setData(QmlCompositeTypeData *unit,
const QByteArray &data,
const QUrl &url)
{
- if(!unit->data.parse(data, url)) {
+ if (!unit->data.parse(data, url)) {
unit->status = QmlCompositeTypeData::Error;
unit->errorDescription = unit->data.errorDescription();
@@ -247,7 +247,7 @@ void QmlCompositeTypeManager::setData(QmlCompositeTypeData *unit,
void QmlCompositeTypeManager::doComplete(QmlCompositeTypeData *unit)
{
- for(int ii = 0; ii < unit->dependants.count(); ++ii) {
+ for (int ii = 0; ii < unit->dependants.count(); ++ii) {
checkComplete(unit->dependants.at(ii));
unit->dependants.at(ii)->release();
}
@@ -261,26 +261,26 @@ void QmlCompositeTypeManager::doComplete(QmlCompositeTypeData *unit)
void QmlCompositeTypeManager::checkComplete(QmlCompositeTypeData *unit)
{
- if(unit->status != QmlCompositeTypeData::Waiting)
+ if (unit->status != QmlCompositeTypeData::Waiting)
return;
int waiting = 0;
- for(int ii = 0; ii < unit->types.count(); ++ii) {
+ for (int ii = 0; ii < unit->types.count(); ++ii) {
QmlCompositeTypeData *u = unit->types.at(ii).unit;
- if(!u)
+ if (!u)
continue;
- if(u->status == QmlCompositeTypeData::Error) {
+ if (u->status == QmlCompositeTypeData::Error) {
unit->status = QmlCompositeTypeData::Error;
unit->errorDescription = u->errorDescription;
doComplete(unit);
return;
- } else if(u->status == QmlCompositeTypeData::Waiting) {
+ } else if (u->status == QmlCompositeTypeData::Waiting) {
waiting++;
}
}
- if(!waiting) {
+ if (!waiting) {
unit->status = QmlCompositeTypeData::Complete;
doComplete(unit);
}
@@ -291,7 +291,7 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit)
QStringList typeNames = unit->data.types();
int waiting = 0;
- for(int ii = 0; ii < typeNames.count(); ++ii) {
+ for (int ii = 0; ii < typeNames.count(); ++ii) {
QByteArray type = typeNames.at(ii).toLatin1();
QmlCompositeTypeData::TypeReference ref;
@@ -304,14 +304,14 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit)
QmlCustomParser *parser =
QmlMetaType::customParser(type);
- if(parser) {
+ if (parser) {
ref.parser = parser;
unit->types << ref;
continue;
}
ref.type = QmlMetaType::qmlType(type);
- if(ref.type) {
+ if (ref.type) {
ref.parser = parser;
unit->types << ref;
continue;
@@ -320,7 +320,7 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit)
QUrl url = engine->componentUrl(QUrl(type + ".qml"), QUrl(unit->url));
QmlCompositeTypeData *urlUnit = components.value(url.toString());
- if(!urlUnit) {
+ if (!urlUnit) {
urlUnit = new QmlCompositeTypeData;
urlUnit->status = QmlCompositeTypeData::Waiting;
urlUnit->url = url.toString();
@@ -351,7 +351,7 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit)
unit->types << ref;
}
- if(waiting) {
+ if (waiting) {
unit->status = QmlCompositeTypeData::Waiting;
} else {
unit->status = QmlCompositeTypeData::Complete;
diff --git a/src/declarative/qml/qmlcompositetypemanager_p.h b/src/declarative/qml/qmlcompositetypemanager_p.h
index 814e753..ffa4fda 100644
--- a/src/declarative/qml/qmlcompositetypemanager_p.h
+++ b/src/declarative/qml/qmlcompositetypemanager_p.h
@@ -43,12 +43,11 @@
#define QMLCOMPOSITETYPEMANAGER_P_H
#include <qglobal.h>
-#include <private/qmlxmlparser_p.h>
+#include <private/qmlscriptparser_p.h>
#include <private/qmlrefcount_p.h>
QT_BEGIN_NAMESPACE
-class QmlXmlParser;
class QmlEngine;
class QmlCompiledComponent;
class QmlComponentPrivate;
@@ -100,7 +99,7 @@ private:
friend class QmlCompositeTypeManager;
friend class QmlCompiler;
- QmlXmlParser data;
+ QmlScriptParser data;
QList<QmlComponentPrivate *> waiters;
QmlComponent *component;
QmlCompiledComponent *compiledComponent;
diff --git a/src/declarative/qml/qmlcontext.cpp b/src/declarative/qml/qmlcontext.cpp
index 40e33c2..c1acdc7 100644
--- a/src/declarative/qml/qmlcontext.cpp
+++ b/src/declarative/qml/qmlcontext.cpp
@@ -68,16 +68,16 @@ void QmlContextPrivate::dump(int depth)
QByteArray ba(depth * 4, ' ');
qWarning() << ba << properties.keys();
qWarning() << ba << variantProperties.keys();
- if(parent)
+ if (parent)
parent->d_func()->dump(depth + 1);
}
void QmlContextPrivate::destroyed(QObject *obj)
{
defaultObjects.removeAll(obj);
- for(QHash<QString, QObject *>::Iterator iter = properties.begin();
+ for (QHash<QString, QObject *>::Iterator iter = properties.begin();
iter != properties.end(); ) {
- if(*iter == obj)
+ if (*iter == obj)
iter = properties.erase(iter);
else
++iter;
@@ -102,13 +102,13 @@ void QmlContextPrivate::init()
void QmlContextPrivate::addDefaultObject(QObject *object, Priority priority)
{
- if(defaultObjects.count() >= (MAXIMUM_DEFAULT_OBJECTS - 1)) {
+ if (defaultObjects.count() >= (MAXIMUM_DEFAULT_OBJECTS - 1)) {
qWarning("QmlContext: Cannot have more than %d default objects on "
"one bind context.", MAXIMUM_DEFAULT_OBJECTS - 1);
return;
}
- if(priority == HighPriority) {
+ if (priority == HighPriority) {
defaultObjects.insert(highPriorityCount++, object);
} else {
defaultObjects.append(object);
@@ -233,7 +233,7 @@ QmlContext::QmlContext(QmlContext *parentContext, QObject *parent)
QmlContext::~QmlContext()
{
Q_D(QmlContext);
- if(d->component) d->component->release();
+ if (d->component) d->component->release();
}
@@ -313,7 +313,7 @@ void QmlContext::deactivate()
QmlEnginePrivate *ep = engine()->d_func();
Q_ASSERT(ep->activeContexts.top() == this);
ep->activeContexts.pop();
- if(ep->activeContexts.isEmpty())
+ if (ep->activeContexts.isEmpty())
ep->setCurrentBindContext(0);
else
ep->setCurrentBindContext(ep->activeContexts.top());
@@ -332,7 +332,7 @@ void QmlContext::deactivate()
QmlContext *QmlContext::activeContext()
{
QmlEngine *engine = QmlEngine::activeEngine();
- if(engine)
+ if (engine)
return engine->activeContext();
else
return 0;
@@ -351,16 +351,16 @@ QmlContext *QmlContext::activeContext()
QUrl QmlContext::resolvedUrl(const QUrl &src)
{
QmlContext *ctxt = this;
- if(src.isRelative()) {
- if(ctxt) {
+ if (src.isRelative()) {
+ if (ctxt) {
while(ctxt) {
- if(ctxt->d_func()->component)
+ if (ctxt->d_func()->component)
break;
else
ctxt = ctxt->parentContext();
}
- if(ctxt)
+ if (ctxt)
return ctxt->d_func()->component->url.resolved(src);
}
return QUrl();
@@ -380,16 +380,16 @@ QUrl QmlContext::resolvedUrl(const QUrl &src)
QUrl QmlContext::resolvedUri(const QUrl &src)
{
QmlContext *ctxt = this;
- if(src.isRelative()) {
- if(ctxt) {
+ if (src.isRelative()) {
+ if (ctxt) {
while(ctxt) {
- if(ctxt->d_func()->component)
+ if (ctxt->d_func()->component)
break;
else
ctxt = ctxt->parentContext();
}
- if(ctxt)
+ if (ctxt)
return ctxt->d_func()->engine->componentUrl(src, ctxt->d_func()->component->url);
}
return QUrl();
diff --git a/src/declarative/qml/qmldom.cpp b/src/declarative/qml/qmldom.cpp
index 274b542..72c1c76 100644
--- a/src/declarative/qml/qmldom.cpp
+++ b/src/declarative/qml/qmldom.cpp
@@ -41,12 +41,13 @@
#include "qmldom.h"
#include "qmldom_p.h"
-#include "private/qmlxmlparser_p.h"
#include "private/qmlcompiler_p.h"
#include "qmlcompiledcomponent_p.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qstring.h>
+#include "qmlscriptparser_p.h"
+
QT_BEGIN_NAMESPACE
QmlDomDocumentPrivate::QmlDomDocumentPrivate()
@@ -58,12 +59,12 @@ QmlDomDocumentPrivate::QmlDomDocumentPrivate(const QmlDomDocumentPrivate &other)
: QSharedData(other), root(0)
{
root = other.root;
- if(root) root->addref();
+ if (root) root->addref();
}
QmlDomDocumentPrivate::~QmlDomDocumentPrivate()
{
- if(root) root->release();
+ if (root) root->release();
}
/*!
@@ -150,8 +151,8 @@ bool QmlDomDocument::load(QmlEngine *engine, const QByteArray &data)
{
d->error = QString();
- QmlXmlParser parser;
- if(!parser.parse(data)) {
+ QmlScriptParser parser;
+ if (!parser.parse(data)) {
d->error = parser.errorDescription();
return false;
}
@@ -161,12 +162,12 @@ bool QmlDomDocument::load(QmlEngine *engine, const QByteArray &data)
// ###
// compiler.compile(engine, parser, &component);
- if(compiler.isError()) {
+ if (compiler.isError()) {
d->error = compiler.errorDescription();
return false;
}
- if(parser.tree()) {
+ if (parser.tree()) {
component.dump(0, parser.tree());
d->root = parser.tree();
d->root->addref();
@@ -175,6 +176,7 @@ bool QmlDomDocument::load(QmlEngine *engine, const QByteArray &data)
return true;
}
+
/*!
Returns the last load error. The load error will be reset after a
successful call to load().
@@ -212,7 +214,7 @@ QmlDomObject QmlDomDocument::rootObject() const
{
QmlDomObject rv;
rv.d->object = d->root;
- if(rv.d->object) rv.d->object->addref();
+ if (rv.d->object) rv.d->object->addref();
return rv;
}
@@ -225,12 +227,12 @@ QmlDomPropertyPrivate::QmlDomPropertyPrivate(const QmlDomPropertyPrivate &other)
: QSharedData(other), property(0)
{
property = other.property;
- if(property) property->addref();
+ if (property) property->addref();
}
QmlDomPropertyPrivate::~QmlDomPropertyPrivate()
{
- if(property) property->release();
+ if (property) property->release();
}
/*!
@@ -311,7 +313,7 @@ QByteArray QmlDomProperty::propertyName() const
*/
QList<QByteArray> QmlDomProperty::propertyNameParts() const
{
- if(d->propertyName.isEmpty()) return QList<QByteArray>();
+ if (d->propertyName.isEmpty()) return QList<QByteArray>();
else return d->propertyName.split('.');
}
@@ -342,7 +344,7 @@ bool QmlDomProperty::isDefaultProperty() const
QmlDomValue QmlDomProperty::value() const
{
QmlDomValue rv;
- if(d->property) {
+ if (d->property) {
rv.d->property = d->property;
rv.d->value = d->property->values.at(0);
rv.d->property->addref();
@@ -369,13 +371,13 @@ QmlDomObjectPrivate::QmlDomObjectPrivate(const QmlDomObjectPrivate &other)
: QSharedData(other), object(0), isVirtualComponent(false)
{
object = other.object;
- if(object) object->addref();
+ if (object) object->addref();
isVirtualComponent = other.isVirtualComponent;
}
QmlDomObjectPrivate::~QmlDomObjectPrivate()
{
- if(object) object->release();
+ if (object) object->release();
}
QmlDomObjectPrivate::Properties
@@ -383,7 +385,7 @@ QmlDomObjectPrivate::properties() const
{
Properties rv;
- for(QHash<QByteArray, QmlParser::Property *>::ConstIterator iter =
+ for (QHash<QByteArray, QmlParser::Property *>::ConstIterator iter =
object->properties.begin();
iter != object->properties.end();
++iter) {
@@ -399,9 +401,9 @@ QmlDomObjectPrivate::properties(QmlParser::Property *property) const
{
Properties rv;
- if(property->value) {
+ if (property->value) {
- for(QHash<QByteArray, QmlParser::Property *>::ConstIterator iter =
+ for (QHash<QByteArray, QmlParser::Property *>::ConstIterator iter =
property->value->properties.begin();
iter != property->value->properties.end();
++iter) {
@@ -411,13 +413,13 @@ QmlDomObjectPrivate::properties(QmlParser::Property *property) const
}
QByteArray name(property->name + ".");
- for(Properties::Iterator iter = rv.begin(); iter != rv.end(); ++iter)
+ for (Properties::Iterator iter = rv.begin(); iter != rv.end(); ++iter)
iter->second.prepend(name);
} else {
// We don't display "id" sets as a property in the dom
- if(property->values.count() != 1 ||
+ if (property->values.count() != 1 ||
property->values.at(0)->type != QmlParser::Value::Id)
rv << qMakePair(property, property->name);
@@ -513,7 +515,7 @@ bool QmlDomObject::isValid() const
*/
QByteArray QmlDomObject::objectType() const
{
- if(d->object) return d->object->typeName;
+ if (d->object) return d->object->typeName;
else return QByteArray();
}
@@ -528,7 +530,7 @@ QByteArray QmlDomObject::objectType() const
*/
QByteArray QmlDomObject::objectId() const
{
- if(d->object) return d->object->id;
+ if (d->object) return d->object->id;
else return QByteArray();
}
@@ -555,11 +557,11 @@ QList<QmlDomProperty> QmlDomObject::properties() const
{
QList<QmlDomProperty> rv;
- if(!d->object)
+ if (!d->object)
return rv;
QmlDomObjectPrivate::Properties properties = d->properties();
- for(int ii = 0; ii < properties.count(); ++ii) {
+ for (int ii = 0; ii < properties.count(); ++ii) {
QmlDomProperty domProperty;
domProperty.d->property = properties.at(ii).first;
@@ -569,7 +571,7 @@ QList<QmlDomProperty> QmlDomObject::properties() const
}
- if(d->object->defaultProperty) {
+ if (d->object->defaultProperty) {
QmlDomProperty domProperty;
domProperty.d->property = d->object->defaultProperty;
domProperty.d->property->addref();
@@ -594,8 +596,8 @@ QList<QmlDomProperty> QmlDomObject::properties() const
QmlDomProperty QmlDomObject::property(const QByteArray &name) const
{
QList<QmlDomProperty> props = properties();
- for(int ii = 0; ii < props.count(); ++ii)
- if(props.at(ii).propertyName() == name)
+ for (int ii = 0; ii < props.count(); ++ii)
+ if (props.at(ii).propertyName() == name)
return props.at(ii);
return QmlDomProperty();
}
@@ -682,7 +684,7 @@ bool QmlDomObject::isComponent() const
QmlDomComponent QmlDomObject::toComponent() const
{
QmlDomComponent rv;
- if(isComponent())
+ if (isComponent())
rv.d = d;
return rv;
}
@@ -696,12 +698,12 @@ QmlDomBasicValuePrivate::QmlDomBasicValuePrivate(const QmlDomBasicValuePrivate &
: QSharedData(other), value(0)
{
value = other.value;
- if(value) value->addref();
+ if (value) value->addref();
}
QmlDomBasicValuePrivate::~QmlDomBasicValuePrivate()
{
- if(value) value->release();
+ if (value) value->release();
}
/*!
@@ -759,7 +761,7 @@ QmlDomValueLiteral &QmlDomValueLiteral::operator=(const QmlDomValueLiteral &othe
*/
QString QmlDomValueLiteral::literal() const
{
- if(d->value) return d->value->primitive;
+ if (d->value) return d->value->primitive;
else return QString();
}
@@ -825,7 +827,7 @@ QmlDomValueBinding &QmlDomValueBinding::operator=(const QmlDomValueBinding &othe
*/
QString QmlDomValueBinding::binding() const
{
- if(d->value)
+ if (d->value)
return d->value->primitive.mid(1, d->value->primitive.length() - 2);
else
return QString();
@@ -905,7 +907,7 @@ QmlDomValueValueSource &QmlDomValueValueSource::operator=(const QmlDomValueValue
QmlDomObject QmlDomValueValueSource::object() const
{
QmlDomObject rv;
- if(d->value) {
+ if (d->value) {
rv.d->object = d->value->object;
rv.d->object->addref();
}
@@ -931,14 +933,14 @@ QmlDomValuePrivate::QmlDomValuePrivate(const QmlDomValuePrivate &other)
{
property = other.property;
value = other.value;
- if(property) property->addref();
- if(value) value->addref();
+ if (property) property->addref();
+ if (value) value->addref();
}
QmlDomValuePrivate::~QmlDomValuePrivate()
{
- if(property) property->release();
- if(value) value->release();
+ if (property) property->release();
+ if (value) value->release();
}
/*!
@@ -967,13 +969,13 @@ QmlDomValuePrivate::~QmlDomValuePrivate()
QmlDomObject root = document.rootObject();
QmlDomProperty text = root.property("text");
- if(text.value().isLiteral()) {
+ if (text.value().isLiteral()) {
QmlDomValueLiteral literal = text.value().toLiteral();
qDebug() << literal.literal();
}
QmlDomProperty y = root.property("y");
- if(y.value().isBinding()) {
+ if (y.value().isBinding()) {
QmlDomValueBinding binding = y.value().toBinding();
qDebug() << binding.binding();
}
@@ -1030,8 +1032,8 @@ QmlDomValue &QmlDomValue::operator=(const QmlDomValue &other)
*/
QmlDomValue::Type QmlDomValue::type() const
{
- if(d->property)
- if(QmlMetaType::isList(d->property->type) ||
+ if (d->property)
+ if (QmlMetaType::isList(d->property->type) ||
QmlMetaType::isQmlList(d->property->type) ||
(d->property && d->property->values.count() > 1))
return List;
@@ -1119,7 +1121,7 @@ bool QmlDomValue::isList() const
QmlDomValueLiteral QmlDomValue::toLiteral() const
{
QmlDomValueLiteral rv;
- if(type() == Literal) {
+ if (type() == Literal) {
rv.d->value = d->value;
rv.d->value->addref();
}
@@ -1135,7 +1137,7 @@ QmlDomValueLiteral QmlDomValue::toLiteral() const
QmlDomValueBinding QmlDomValue::toBinding() const
{
QmlDomValueBinding rv;
- if(type() == PropertyBinding) {
+ if (type() == PropertyBinding) {
rv.d->value = d->value;
rv.d->value->addref();
}
@@ -1151,7 +1153,7 @@ QmlDomValueBinding QmlDomValue::toBinding() const
QmlDomValueValueSource QmlDomValue::toValueSource() const
{
QmlDomValueValueSource rv;
- if(type() == ValueSource) {
+ if (type() == ValueSource) {
rv.d->value = d->value;
rv.d->value->addref();
}
@@ -1167,7 +1169,7 @@ QmlDomValueValueSource QmlDomValue::toValueSource() const
QmlDomObject QmlDomValue::toObject() const
{
QmlDomObject rv;
- if(type() == Object) {
+ if (type() == Object) {
rv.d->object = d->value->object;
rv.d->object->addref();
}
@@ -1183,7 +1185,7 @@ QmlDomObject QmlDomValue::toObject() const
QmlDomList QmlDomValue::toList() const
{
QmlDomList rv;
- if(type() == List) {
+ if (type() == List) {
rv.d = d;
}
return rv;
@@ -1252,10 +1254,10 @@ QmlDomList &QmlDomList::operator=(const QmlDomList &other)
QList<QmlDomValue> QmlDomList::values() const
{
QList<QmlDomValue> rv;
- if(!d->property)
+ if (!d->property)
return rv;
- for(int ii = 0; ii < d->property->values.count(); ++ii) {
+ for (int ii = 0; ii < d->property->values.count(); ++ii) {
QmlDomValue v;
v.d->value = d->property->values.at(ii);
v.d->value->addref();
@@ -1340,17 +1342,17 @@ QmlDomComponent &QmlDomComponent::operator=(const QmlDomComponent &other)
QmlDomObject QmlDomComponent::componentRoot() const
{
QmlDomObject rv;
- if(d->isVirtualComponent) {
+ if (d->isVirtualComponent) {
rv.d->object = d->object;
rv.d->object->addref();
- } else if(d->object) {
+ } else if (d->object) {
QmlParser::Object *obj = 0;
- if(d->object->defaultProperty &&
+ if (d->object->defaultProperty &&
d->object->defaultProperty->values.count() == 1 &&
d->object->defaultProperty->values.at(0)->object)
obj = d->object->defaultProperty->values.at(0)->object;
- if(obj) {
+ if (obj) {
rv.d->object = obj;
rv.d->object->addref();
}
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index ad4a627..30848c1 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -86,7 +86,7 @@ QML_DEFINE_TYPE(QObject,Object);
static QScriptValue qmlMetaProperty_emit(QScriptContext *ctx, QScriptEngine *engine)
{
QmlMetaProperty mp = qscriptvalue_cast<QmlMetaProperty>(ctx->thisObject());
- if(mp.type() & QmlMetaProperty::Signal)
+ if (mp.type() & QmlMetaProperty::Signal)
mp.emitSignal();
return engine->nullValue();
}
@@ -118,8 +118,8 @@ QmlEngineStack::QmlEngineStack()
QStack<QmlEngine *> *QmlEngineStack::engines()
{
- if(mainThread== 0) {
- if(!QCoreApplication::instance())
+ if (mainThread== 0) {
+ if (!QCoreApplication::instance())
return 0;
mainThread = QCoreApplication::instance()->thread();
}
@@ -127,11 +127,11 @@ QStack<QmlEngine *> *QmlEngineStack::engines()
// Note: This is very slightly faster than just using the thread storage
// for everything.
QStack<QmlEngine *> *engines = 0;
- if(QThread::currentThread() == mainThread) {
+ if (QThread::currentThread() == mainThread) {
engines = &mainThreadEngines;
} else {
engines = storage.localData();
- if(!engines) {
+ if (!engines) {
engines = new QStack<QmlEngine *>;
storage.setLocalData(engines);
}
@@ -171,7 +171,7 @@ void QmlEnginePrivate::init()
objectClass = new QmlObjectScriptClass(q);
rootContext = new QmlContext(q);
#ifdef QT_SCRIPTTOOLS_LIB
- if(debuggerEnabled()){
+ if (debuggerEnabled()){
debugger = new QScriptEngineDebugger(q);
debugger->attachTo(&scriptEngine);
}
@@ -196,7 +196,7 @@ QmlEnginePrivate::queryObject(const QString &propName,
QScriptClass::QueryFlags rv = 0;
QmlMetaProperty prop(obj, propName);
- if(prop.type() == QmlMetaProperty::Invalid) {
+ if (prop.type() == QmlMetaProperty::Invalid) {
QPair<const QMetaObject *, QString> key =
qMakePair(obj->metaObject(), propName);
bool isFunction = false;
@@ -209,7 +209,7 @@ QmlEnginePrivate::queryObject(const QString &propName,
functionCache()->insert(key, isFunction);
}
- if(isFunction) {
+ if (isFunction) {
*id = QmlScriptClass::FunctionId;
rv |= QScriptClass::HandlesReadAccess;
}
@@ -218,7 +218,7 @@ QmlEnginePrivate::queryObject(const QString &propName,
*id |= prop.save();
rv |= QScriptClass::HandlesReadAccess;
- if(prop.isWritable())
+ if (prop.isWritable())
rv |= QScriptClass::HandlesWriteAccess;
}
@@ -228,25 +228,25 @@ QmlEnginePrivate::queryObject(const QString &propName,
QScriptValue QmlEnginePrivate::propertyObject(const QScriptString &propName,
QObject *obj, uint id)
{
- if(id == QmlScriptClass::FunctionId) {
+ if (id == QmlScriptClass::FunctionId) {
QScriptValue sobj = scriptEngine.newQObject(obj);
QScriptValue func = sobj.property(propName);
return func;
} else {
QmlMetaProperty prop;
prop.restore(id, obj);
- if(!prop.isValid())
+ if (!prop.isValid())
return QScriptValue();
- if(prop.type() & QmlMetaProperty::Signal) {
+ if (prop.type() & QmlMetaProperty::Signal) {
return scriptEngine.newVariant(qVariantFromValue(prop));
} else {
QVariant var = prop.read();
capturedProperties << prop;
QObject *varobj = QmlMetaType::toQObject(var);
- if(!varobj)
+ if (!varobj)
varobj = qvariant_cast<QObject *>(var);
- if(varobj) {
+ if (varobj) {
return scriptEngine.newObject(objectClass, scriptEngine.newVariant(QVariant::fromValue(varobj)));
} else {
if (var.type() == QVariant::Bool)
@@ -263,20 +263,20 @@ void QmlEnginePrivate::contextActivated(QmlContext *)
{
Q_Q(QmlEngine);
QmlEngineStack *stack = engineStack();
- if(!stack)
+ if (!stack)
return;
QStack<QmlEngine *> *engines = stack->engines();
- if(engines)
+ if (engines)
engines->push(q);
}
void QmlEnginePrivate::contextDeactivated(QmlContext *)
{
QmlEngineStack *stack = engineStack();
- if(!stack)
+ if (!stack)
return;
QStack<QmlEngine *> *engines = stack->engines();
- if(engines) {
+ if (engines) {
Q_ASSERT(engines->top() == q_func());
engines->pop();
}
@@ -289,19 +289,19 @@ bool QmlEnginePrivate::fetchCache(QmlBasicScriptNodeCache &cache, const QString
{
QmlMetaProperty prop(obj, propName);
- if(!prop.isValid())
+ if (!prop.isValid())
return false;
capturedProperties << prop;
- if(prop.type() & QmlMetaProperty::Attached) {
+ if (prop.type() & QmlMetaProperty::Attached) {
cache.object = obj;
cache.type = QmlBasicScriptNodeCache::Attached;
cache.attached = prop.d->attachedObject();
return true;
- } else if(prop.type() & QmlMetaProperty::Property) {
+ } else if (prop.type() & QmlMetaProperty::Property) {
cache.object = obj;
cache.type = QmlBasicScriptNodeCache::Core;
@@ -309,14 +309,14 @@ bool QmlEnginePrivate::fetchCache(QmlBasicScriptNodeCache &cache, const QString
cache.coreType = prop.propertyType();
return true;
- } else if(prop.type() & QmlMetaProperty::SignalProperty) {
+ } else if (prop.type() & QmlMetaProperty::SignalProperty) {
cache.object = obj;
cache.type = QmlBasicScriptNodeCache::SignalProperty;
cache.core = prop.coreIndex();
return true;
- } else if(prop.type() & QmlMetaProperty::Signal) {
+ } else if (prop.type() & QmlMetaProperty::Signal) {
cache.object = obj;
cache.type = QmlBasicScriptNodeCache::Signal;
@@ -331,25 +331,25 @@ bool QmlEnginePrivate::fetchCache(QmlBasicScriptNodeCache &cache, const QString
bool QmlEnginePrivate::loadCache(QmlBasicScriptNodeCache &cache, const QString &propName, QmlContextPrivate *context)
{
while(context) {
- if(context->variantProperties.contains(propName)) {
+ if (context->variantProperties.contains(propName)) {
cache.object = 0;
cache.type = QmlBasicScriptNodeCache::Variant;
cache.context = context;
return true;
}
- if(context->properties.contains(propName)) {
+ if (context->properties.contains(propName)) {
cache.object = context->properties[propName];
cache.type = QmlBasicScriptNodeCache::Explicit;
return true;
}
foreach(QObject *obj, context->defaultObjects) {
- if(fetchCache(cache, propName, obj))
+ if (fetchCache(cache, propName, obj))
return true;
}
- if(context->parent)
+ if (context->parent)
context = context->parent->d_func();
else
context = 0;
@@ -453,7 +453,7 @@ QmlContext *QmlEngine::rootContext()
QmlContext *QmlEngine::activeContext()
{
Q_D(QmlEngine);
- if(d->currentBindContext)
+ if (d->currentBindContext)
return d->currentBindContext;
else
return 0;
@@ -591,7 +591,7 @@ void QmlEngine::setNetworkAccessManager(QNetworkAccessManager *network)
QNetworkAccessManager *QmlEngine::networkAccessManager() const
{
Q_D(const QmlEngine);
- if(!d->networkAccessManager)
+ if (!d->networkAccessManager)
d->networkAccessManager = new QNetworkAccessManager;
return d->networkAccessManager;
}
@@ -613,12 +613,12 @@ void QmlEngine::setContextForObject(QObject *object, QmlContext *context)
QmlSimpleDeclarativeData *data =
static_cast<QmlSimpleDeclarativeData *>(priv->declarativeData);
- if(data && data->context) {
+ if (data && data->context) {
qWarning("QmlEngine::setContextForObject(): Object already has a QmlContext");
return;
}
- if(!data) {
+ if (!data) {
priv->declarativeData = &context->d_func()->contextData;
} else {
// ### - Don't have to use extended data here
@@ -648,23 +648,23 @@ QObject *qmlAttachedPropertiesObjectById(int id, const QObject *object)
QmlExtendedDeclarativeData *edata = (data && data->flags & QmlSimpleDeclarativeData::Extended)?static_cast<QmlExtendedDeclarativeData *>(data):0;
- if(edata) {
+ if (edata) {
QObject *rv = edata->attachedProperties.value(id);
- if(rv)
+ if (rv)
return rv;
}
QmlAttachedPropertiesFunc pf = QmlMetaType::attachedPropertiesFuncById(id);
- if(!pf)
+ if (!pf)
return 0;
QObject *rv = pf(const_cast<QObject *>(object));
- if(rv) {
- if(!edata) {
+ if (rv) {
+ if (!edata) {
edata = new QmlExtendedDeclarativeData;
- if(data) edata->context = data->context;
+ if (data) edata->context = data->context;
priv->declarativeData = edata;
}
@@ -697,15 +697,15 @@ QScriptEngine *QmlEngine::scriptEngine()
QmlEngine *QmlEngine::activeEngine()
{
QmlEngineStack *stack = engineStack();
- if(!stack) return 0;
+ if (!stack) return 0;
QStack<QmlEngine *> *engines = stack->engines();
- if(!engines) {
+ if (!engines) {
qWarning("QmlEngine::activeEngine() cannot be called before the construction of QCoreApplication");
return 0;
}
- if(engines->isEmpty())
+ if (engines->isEmpty())
return 0;
else
return engines->top();
@@ -726,7 +726,7 @@ QmlExpressionPrivate::QmlExpressionPrivate(QmlExpression *b, void *expr, QmlRefC
QmlExpressionPrivate::QmlExpressionPrivate(QmlExpression *b, const QString &expr, bool ssecompile)
: q(b), ctxt(0), expression(expr), sseData(0), proxy(0), me(0), trackChange(true)
{
- if(ssecompile) {
+ if (ssecompile) {
#ifdef Q_ENABLE_PERFORMANCE_LOG
QFxPerfTimer<QFxPerf::BindCompile> pt;
#endif
@@ -816,7 +816,7 @@ QmlContext *QmlExpression::context() const
*/
QString QmlExpression::expression() const
{
- if(d->sse.isValid())
+ if (d->sse.isValid())
return QLatin1String(d->sse.expression());
else
return d->expression;
@@ -835,7 +835,7 @@ void QmlExpression::clearExpression()
*/
void QmlExpression::setExpression(const QString &expression)
{
- if(d->sseData) {
+ if (d->sseData) {
d->sse.deleteScriptState(d->sseData);
d->sseData = 0;
}
@@ -844,7 +844,7 @@ void QmlExpression::setExpression(const QString &expression)
d->expression = expression;
- if(d->expression.isEmpty())
+ if (d->expression.isEmpty())
d->sse.clear();
else
d->sse.compile(expression.toLatin1());
@@ -875,10 +875,10 @@ void BindExpressionProxy::changed()
*/
QVariant QmlExpression::value()
{
- if(bindValueDebug())
+ if (bindValueDebug())
qWarning() << "QmlEngine: Evaluating:" << expression();
QVariant rv;
- if(!d->ctxt || (!d->sse.isValid() && d->expression.isEmpty()))
+ if (!d->ctxt || (!d->sse.isValid() && d->expression.isEmpty()))
return rv;
#ifdef Q_ENABLE_PERFORMANCE_LOG
@@ -890,14 +890,14 @@ QVariant QmlExpression::value()
QmlEnginePrivate *ep = engine()->d_func();
QmlExpression *lastCurrentExpression = ep->currentExpression;
ep->currentExpression = this;
- if(d->sse.isValid()) {
+ if (d->sse.isValid()) {
#ifdef Q_ENABLE_PERFORMANCE_LOG
QFxPerfTimer<QFxPerf::BindValueSSE> perfsse;
#endif
context()->d_func()->defaultObjects.insert(context()->d_func()->highPriorityCount, d->me);
- if(!d->sseData)
+ if (!d->sseData)
d->sseData = d->sse.newScriptState();
rv = d->sse.run(context(), d->sseData, &cacheState);
@@ -917,15 +917,29 @@ QVariant QmlExpression::value()
scriptEngine->currentContext()->pushScope(context()->d_func()->scopeChain.at(i));
}
QScriptValue svalue = scriptEngine->evaluate(expression());
+ if (scriptEngine->hasUncaughtException()) {
+ if (scriptEngine->uncaughtException().isError()){
+ QScriptValue exception = scriptEngine->uncaughtException();
+ if (!exception.property(QLatin1String("fileName")).toString().isEmpty()){
+ qWarning() << exception.property(QLatin1String("fileName")).toString()
+ << scriptEngine->uncaughtExceptionLineNumber()
+ << exception.toString();
+
+ } else {
+ qWarning() << exception.toString();
+ }
+ }
+ }
+
context()->d_func()->defaultObjects.removeAt(context()->d_func()->highPriorityCount);
- if(svalue.isArray()) {
+ if (svalue.isArray()) {
int length = svalue.property(QLatin1String("length")).toInt32();
- if(length && svalue.property(0).isObject()) {
+ if (length && svalue.property(0).isObject()) {
QList<QObject *> list;
- for(int ii = 0; ii < length; ++ii) {
+ for (int ii = 0; ii < length; ++ii) {
QScriptValue arrayItem = svalue.property(ii);
QObject *d = qvariant_cast<QObject *>(arrayItem.data().toVariant());
- if(d) {
+ if (d) {
list << d;
} else {
list << 0;
@@ -940,7 +954,7 @@ QVariant QmlExpression::value()
if (objValue.isValid())
rv = objValue.toVariant();
}
- if(rv.isNull()) {
+ if (rv.isNull()) {
rv = svalue.toVariant();
}
@@ -953,35 +967,35 @@ QVariant QmlExpression::value()
}
ep->currentExpression = lastCurrentExpression;
- if(cacheState != QmlBasicScript::NoChange) {
- if(cacheState != QmlBasicScript::Incremental && d->proxy) {
+ if (cacheState != QmlBasicScript::NoChange) {
+ if (cacheState != QmlBasicScript::Incremental && d->proxy) {
delete d->proxy;
d->proxy = 0;
}
- if(trackChange() && ep->capturedProperties.count()) {
- if(!d->proxy)
+ if (trackChange() && ep->capturedProperties.count()) {
+ if (!d->proxy)
d->proxy = new BindExpressionProxy(this);
static int changedIndex = -1;
- if(changedIndex == -1)
+ if (changedIndex == -1)
changedIndex = BindExpressionProxy::staticMetaObject.indexOfSlot("changed()");
- if(bindValueDebug())
+ if (bindValueDebug())
qWarning() << " Depends on:";
- for(int ii = 0; ii < ep->capturedProperties.count(); ++ii) {
+ for (int ii = 0; ii < ep->capturedProperties.count(); ++ii) {
const QmlMetaProperty &prop =
ep->capturedProperties.at(ii);
- if(prop.hasChangedNotifier()) {
+ if (prop.hasChangedNotifier()) {
prop.connectNotifier(d->proxy, changedIndex);
- if(bindValueDebug())
+ if (bindValueDebug())
qWarning() << " property"
<< prop.name()
<< prop.object()
<< prop.object()->metaObject()->superClass()->className();
- } else if(bindValueDebug()) {
+ } else if (bindValueDebug()) {
qWarning() << " non-subscribable property"
<< prop.name()
<< prop.object()
@@ -992,7 +1006,7 @@ QVariant QmlExpression::value()
}
ep->capturedProperties.clear();
- if(bindValueDebug())
+ if (bindValueDebug())
qWarning() << " Result:" << rv
<< "(SSE: " << d->sse.isValid() << ")";
return rv;
@@ -1163,10 +1177,10 @@ QmlContextScriptClass::queryProperty(const QScriptValue &object,
*id = ObjectListPropertyId;
}
- for(int ii = 0; !rv && ii < bindContext->d_func()->defaultObjects.count(); ++ii) {
+ for (int ii = 0; !rv && ii < bindContext->d_func()->defaultObjects.count(); ++ii) {
rv = engine->d_func()->queryObject(propName, id,
bindContext->d_func()->defaultObjects.at(ii));
- if(rv)
+ if (rv)
*id |= (ii << 24);
}
@@ -1220,7 +1234,7 @@ QScriptValue QmlContextScriptClass::property(const QScriptValue &object,
QObject *obj = bindContext->d_func()->defaultObjects.at(objId);
QScriptValue rv = engine->d_func()->propertyObject(name, obj,
id & ~QmlScriptClass::ClassIdSelectorMask);
- if(rv.isValid()) {
+ if (rv.isValid()) {
#ifdef PROPERTY_DEBUG
qWarning() << "~Property: Resolved property" << propName
<< "to context default object" << bindContext << obj <<". Value:" << rv.toVariant();
@@ -1326,7 +1340,7 @@ QScriptValue QmlObjectScriptClass::property(const QScriptValue &object,
#endif
QScriptValue rv = engine->d_func()->propertyObject(name, obj, id);
- if(rv.isValid()) {
+ if (rv.isValid()) {
#ifdef PROPERTY_DEBUG
qWarning() << "~Property: Resolved property" << propName
<< "to object" << obj <<". Value:" << rv.toVariant();
diff --git a/src/declarative/qml/qmlinfo.cpp b/src/declarative/qml/qmlinfo.cpp
index dc7f44c..a2b304f 100644
--- a/src/declarative/qml/qmlinfo.cpp
+++ b/src/declarative/qml/qmlinfo.cpp
@@ -75,7 +75,7 @@ QmlInfo::QmlInfo(QObject *object)
: QDebug(QtWarningMsg)
{
*this << "QML";
- if(object)
+ if (object)
*this << object->metaObject()->className();
*this << "(unknown location):";
}
diff --git a/src/declarative/qml/qmlinstruction.cpp b/src/declarative/qml/qmlinstruction.cpp
index 848c8db..82924c8 100644
--- a/src/declarative/qml/qmlinstruction.cpp
+++ b/src/declarative/qml/qmlinstruction.cpp
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
void QmlCompiledComponent::dump(QmlInstruction *instr, int idx)
{
QByteArray lineNumber = QByteArray::number(instr->line);
- if(instr->line == (unsigned short)-1)
+ if (instr->line == (unsigned short)-1)
lineNumber = "NA";
const char *line = lineNumber.constData();
diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp
index 780f8a8..1a511eb 100644
--- a/src/declarative/qml/qmlmetaproperty.cpp
+++ b/src/declarative/qml/qmlmetaproperty.cpp
@@ -127,13 +127,13 @@ QmlMetaProperty::QmlMetaProperty(QObject *obj, QmlContext *ctxt)
void QmlMetaProperty::initDefault(QObject *obj)
{
- if(!obj)
+ if (!obj)
return;
d->object = obj;
QHash<const QMetaObject *, QMetaPropertyEx>::ConstIterator iter =
qmlCacheDefProp.find(obj->metaObject());
- if(iter != qmlCacheDefProp.end()) {
+ if (iter != qmlCacheDefProp.end()) {
d->prop = *iter;
d->propType = iter->propertyType;
d->coreIdx = iter->propertyType;
@@ -142,10 +142,10 @@ void QmlMetaProperty::initDefault(QObject *obj)
d->prop = p;
d->propType = p.propertyType;
d->coreIdx = d->prop.propertyIndex();
- if(!QObjectPrivate::get(obj)->metaObject)
+ if (!QObjectPrivate::get(obj)->metaObject)
qmlCacheDefProp.insert(obj->metaObject(), d->prop);
}
- if(d->prop.name() != 0) {
+ if (d->prop.name() != 0) {
d->type = Property | Default;
d->name = QLatin1String(d->prop.name());
}
@@ -169,7 +169,7 @@ QmlMetaProperty::QmlMetaProperty(QObject *obj, int idx, PropertyCategory cat, Qm
d->prop = p;
d->propType = p.propertyType;
d->coreIdx = idx;
- if(d->prop.name() != 0)
+ if (d->prop.name() != 0)
d->name = QLatin1String(d->prop.name());
}
@@ -203,22 +203,22 @@ void QmlMetaProperty::initProperty(QObject *obj, const QString &name)
{
d->name = name;
d->object = obj;
- if(name.isEmpty() || !obj)
+ if (name.isEmpty() || !obj)
return;
- if(name.at(0).isUpper()) {
+ if (name.at(0).isUpper()) {
// Attached property
d->attachedFunc = QmlMetaType::attachedPropertiesFuncId(name.toLatin1());
- if(d->attachedFunc != -1)
+ if (d->attachedFunc != -1)
d->type = Property | Attached;
return;
- } else if(name.count() >= 3 && name.startsWith(QLatin1String("on")) && name.at(2).isUpper()) {
+ } else if (name.count() >= 3 && name.startsWith(QLatin1String("on")) && name.at(2).isUpper()) {
// Signal
QString signalName = name.mid(2);
signalName[0] = signalName.at(0).toLower();
d->findSignalInt(obj, signalName);
- if(d->signal.signature() != 0) {
+ if (d->signal.signature() != 0) {
d->type = SignalProperty;
return;
}
@@ -227,7 +227,7 @@ void QmlMetaProperty::initProperty(QObject *obj, const QString &name)
// Property
QHash<QString, QMetaPropertyEx> &props = qmlCacheProps[obj->metaObject()];
QHash<QString, QMetaPropertyEx>::ConstIterator iter = props.find(name);
- if(iter != props.end()) {
+ if (iter != props.end()) {
d->prop = *iter;
d->propType = iter->propertyType;
d->coreIdx = iter->propertyIndex();
@@ -239,12 +239,12 @@ void QmlMetaProperty::initProperty(QObject *obj, const QString &name)
if (!QObjectPrivate::get(obj)->metaObject)
props.insert(name, p);
}
- if(d->prop.name() != 0)
+ if (d->prop.name() != 0)
d->type = Property;
- if(d->type == Invalid) {
+ if (d->type == Invalid) {
int sig = findSignal(obj, name.toLatin1());
- if(sig != -1) {
+ if (sig != -1) {
d->signal = obj->metaObject()->method(sig);
d->type = Signal;
d->coreIdx = sig;
@@ -271,17 +271,17 @@ QmlMetaProperty::PropertyCategory QmlMetaProperty::propertyCategory() const
QmlMetaProperty::PropertyCategory
QmlMetaPropertyPrivate::propertyCategory() const
{
- if(category == QmlMetaProperty::Unknown) {
+ if (category == QmlMetaProperty::Unknown) {
int type = propertyType();
- if(type == QmlMetaProperty::Invalid)
+ if (type == QmlMetaProperty::Invalid)
category = QmlMetaProperty::InvalidProperty;
- else if(type == qMetaTypeId<QmlBindableValue *>())
+ else if (type == qMetaTypeId<QmlBindableValue *>())
category = QmlMetaProperty::Bindable;
- else if(QmlMetaType::isList(type))
+ else if (QmlMetaType::isList(type))
category = QmlMetaProperty::List;
- else if(QmlMetaType::isQmlList(type))
+ else if (QmlMetaType::isQmlList(type))
category = QmlMetaProperty::QmlList;
- else if(QmlMetaType::isObject(type))
+ else if (QmlMetaType::isObject(type))
category = QmlMetaProperty::Object;
else
category = QmlMetaProperty::Normal;
@@ -295,22 +295,22 @@ QmlMetaPropertyPrivate::propertyCategory() const
QmlMetaProperty::PropertyCategory
QmlMetaProperty::propertyCategory(const QMetaProperty &prop)
{
- if(prop.name()) {
+ if (prop.name()) {
int type = 0;
- if(prop.type() == QVariant::LastType)
+ if (prop.type() == QVariant::LastType)
type = qMetaTypeId<QVariant>();
- else if(prop.type() == QVariant::UserType)
+ else if (prop.type() == QVariant::UserType)
type = prop.userType();
else
type = prop.type();
- if(type == qMetaTypeId<QmlBindableValue *>())
+ if (type == qMetaTypeId<QmlBindableValue *>())
return Bindable;
- else if(QmlMetaType::isList(type))
+ else if (QmlMetaType::isList(type))
return List;
- else if(QmlMetaType::isQmlList(type))
+ else if (QmlMetaType::isQmlList(type))
return QmlList;
- else if(QmlMetaType::isObject(type))
+ else if (QmlMetaType::isObject(type))
return Object;
else
return Normal;
@@ -325,7 +325,7 @@ QmlMetaProperty::propertyCategory(const QMetaProperty &prop)
*/
const char *QmlMetaProperty::propertyTypeName() const
{
- if(d->prop.name()) {
+ if (d->prop.name()) {
return d->prop.typeName();
} else {
return 0;
@@ -357,12 +357,12 @@ int QmlMetaPropertyPrivate::propertyType() const
{
int rv = QVariant::Invalid;
- if(prop.name()) {
- if(propType == (int)QVariant::LastType)
+ if (prop.name()) {
+ if (propType == (int)QVariant::LastType)
rv = qMetaTypeId<QVariant>();
else
rv = propType;
- } else if(attachedFunc) {
+ } else if (attachedFunc) {
rv = qMetaTypeId<QObject *>();
}
@@ -423,11 +423,11 @@ QmlMetaProperty &QmlMetaProperty::operator=(const QmlMetaProperty &other)
*/
bool QmlMetaProperty::isWritable() const
{
- if(propertyCategory() == List || propertyCategory() == QmlList)
+ if (propertyCategory() == List || propertyCategory() == QmlList)
return true;
- else if(d->prop.name() != 0)
+ else if (d->prop.name() != 0)
return d->prop.isWritable();
- else if(type() & SignalProperty)
+ else if (type() & SignalProperty)
return true;
else
return false;
@@ -438,7 +438,7 @@ bool QmlMetaProperty::isWritable() const
*/
bool QmlMetaProperty::isDesignable() const
{
- if(d->prop.name() != 0)
+ if (d->prop.name() != 0)
return d->prop.isDesignable();
else
return false;
@@ -458,12 +458,12 @@ bool QmlMetaProperty::isValid() const
*/
QStringList QmlMetaProperty::properties(QObject *obj)
{
- if(!obj)
+ if (!obj)
return QStringList();
QStringList rv;
const QMetaObject *mo = obj->metaObject();
- for(int ii = 0; ii < mo->propertyCount(); ++ii) {
+ for (int ii = 0; ii < mo->propertyCount(); ++ii) {
QMetaProperty prop = mo->property(ii);
rv << QLatin1String(prop.name());
}
@@ -490,16 +490,16 @@ const QMetaProperty &QmlMetaProperty::property() const
*/
QmlBindableValue *QmlMetaProperty::binding()
{
- if(!isProperty() || type() & Attached)
+ if (!isProperty() || type() & Attached)
return 0;
const QObjectList &children = object()->children();
- for(QObjectList::ConstIterator iter = children.begin();
+ for (QObjectList::ConstIterator iter = children.begin();
iter != children.end(); ++iter) {
QObject *child = *iter;
- if(child->metaObject() == &QmlBindableValue::staticMetaObject) {
+ if (child->metaObject() == &QmlBindableValue::staticMetaObject) {
QmlBindableValue *v = static_cast<QmlBindableValue *>(child);
- if(v->property() == *this)
+ if (v->property() == *this)
return v;
}
}
@@ -511,16 +511,16 @@ int QmlMetaProperty::findSignal(const QObject *obj, const char *name)
{
const QMetaObject *mo = obj->metaObject();
int methods = mo->methodCount();
- for(int ii = 0; ii < methods; ++ii) {
+ for (int ii = 0; ii < methods; ++ii) {
QMetaMethod method = mo->method(ii);
- if(method.methodType() != QMetaMethod::Signal)
+ if (method.methodType() != QMetaMethod::Signal)
continue;
QByteArray methodName = method.signature();
int idx = methodName.indexOf('(');
methodName = methodName.left(idx);
- if(methodName == name)
+ if (methodName == name)
return ii;
}
return -1;
@@ -531,13 +531,13 @@ void QmlMetaPropertyPrivate::findSignalInt(QObject *obj, const QString &name)
const QMetaObject *mo = obj->metaObject();
int methods = mo->methodCount();
- for(int ii = 0; ii < methods; ++ii) {
+ for (int ii = 0; ii < methods; ++ii) {
QMetaMethod method = mo->method(ii);
QString methodName = QLatin1String(method.signature());
int idx = methodName.indexOf(QLatin1Char('('));
methodName = methodName.left(idx);
- if(methodName == name) {
+ if (methodName == name) {
signal = method;
coreIdx = ii;
return;
@@ -547,7 +547,7 @@ void QmlMetaPropertyPrivate::findSignalInt(QObject *obj, const QString &name)
QObject *QmlMetaPropertyPrivate::attachedObject() const
{
- if(attachedFunc == -1)
+ if (attachedFunc == -1)
return 0;
else
return qmlAttachedPropertiesObjectById(attachedFunc, object);
@@ -558,17 +558,17 @@ QObject *QmlMetaPropertyPrivate::attachedObject() const
*/
QVariant QmlMetaProperty::read() const
{
- if(type() & SignalProperty) {
+ if (type() & SignalProperty) {
const QObjectList &children = object()->children();
- for(int ii = 0; ii < children.count(); ++ii) {
+ for (int ii = 0; ii < children.count(); ++ii) {
QmlBoundSignal *sig = qobject_cast<QmlBoundSignal *>(children.at(ii));
- if(sig && sig->index() == d->coreIdx)
+ if (sig && sig->index() == d->coreIdx)
return sig->expression();
}
- } else if(type() & Property) {
- if(type() & Attached)
+ } else if (type() & Property) {
+ if (type() & Attached)
return QVariant::fromValue(d->attachedObject());
else
return d->prop.read(object());
@@ -583,10 +583,10 @@ void QmlMetaPropertyPrivate::writeSignalProperty(const QVariant &value)
QString expr = value.toString();
const QObjectList &children = object->children();
- for(int ii = 0; ii < children.count(); ++ii) {
+ for (int ii = 0; ii < children.count(); ++ii) {
QmlBoundSignal *sig = qobject_cast<QmlBoundSignal *>(children.at(ii));
- if(sig && sig->index() == coreIdx) {
- if(expr.isEmpty()) {
+ if (sig && sig->index() == coreIdx) {
+ if (expr.isEmpty()) {
sig->disconnect();
sig->deleteLater();
} else {
@@ -596,7 +596,7 @@ void QmlMetaPropertyPrivate::writeSignalProperty(const QVariant &value)
}
}
- if(!expr.isEmpty()) {
+ if (!expr.isEmpty()) {
// XXX scope
(void *)new QmlBoundSignal(QmlContext::activeContext(), expr, object,
coreIdx, object);
@@ -605,7 +605,7 @@ void QmlMetaPropertyPrivate::writeSignalProperty(const QVariant &value)
void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value)
{
- if(prop.isEnumType()) {
+ if (prop.isEnumType()) {
QVariant v = value;
if (value.type() == QVariant::Double) { //enum values come through the script engine as doubles
double integral;
@@ -615,43 +615,43 @@ void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value)
}
prop.write(object, v);
} else {
- if(!value.isValid())
+ if (!value.isValid())
return;
int t = propertyType();
int vt = value.type();
- if(vt == t ||
+ if (vt == t ||
value.userType() == t) {
void *a[1];
a[0] = (void *)value.constData();
QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a);
- } else if(qMetaTypeId<QVariant>() == t) {
+ } else if (qMetaTypeId<QVariant>() == t) {
prop.write(object, value);
- } else if(propertyCategory() == QmlMetaProperty::Object) {
+ } else if (propertyCategory() == QmlMetaProperty::Object) {
QObject *o = QmlMetaType::toQObject(value);
- if(o)
+ if (o)
prop.write(object, QmlMetaType::fromObject(o, propertyType()));
} else if (propertyCategory() == QmlMetaProperty::List) {
int listType = QmlMetaType::listType(t);
- if(value.userType() == qMetaTypeId<QList<QObject *> >()) {
+ if (value.userType() == qMetaTypeId<QList<QObject *> >()) {
const QList<QObject *> &list =
qvariant_cast<QList<QObject *> >(value);
QVariant listVar = prop.read(object);
QmlMetaType::clear(listVar);
- for(int ii = 0; ii < list.count(); ++ii) {
+ for (int ii = 0; ii < list.count(); ++ii) {
QVariant v = QmlMetaType::fromObject(list.at(ii), listType);
QmlMetaType::append(listVar, v);
}
- } else if(vt == listType ||
+ } else if (vt == listType ||
value.userType() == listType) {
QVariant listVar = prop.read(object);
if (!QmlMetaType::append(listVar, value)) {
@@ -673,13 +673,13 @@ void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value)
const QMetaObject *objMo = obj->metaObject();
bool found = false;
while(!found && objMo) {
- if(objMo == mo)
+ if (objMo == mo)
found = true;
else
objMo = objMo->superClass();
}
- if(!found) {
+ if (!found) {
qWarning() << "Unable to assign object to list";
return;
}
@@ -689,22 +689,22 @@ void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value)
void *d = (void *)&obj;
li->append(d);
}
- } else if(propertyCategory() == QmlMetaProperty::Normal) {
+ } else if (propertyCategory() == QmlMetaProperty::Normal) {
switch(t) {
case QVariant::Double:
{
qreal r;
bool found = true;
- if(vt == QVariant::Int) {
+ if (vt == QVariant::Int) {
r = value.toInt();
- } else if(vt == QVariant::UInt) {
+ } else if (vt == QVariant::UInt) {
r = value.toUInt();
} else {
found = false;
}
- if(found) {
+ if (found) {
void *a[1];
a[0] = &r;
QMetaObject::metacall(object,
@@ -719,15 +719,15 @@ void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value)
{
int i;
bool found = true;
- if(vt == QVariant::Double) {
+ if (vt == QVariant::Double) {
i = (int)value.toDouble();
- } else if(vt == QVariant::UInt) {
+ } else if (vt == QVariant::UInt) {
i = (int)value.toUInt();
} else {
found = false;
}
- if(found) {
+ if (found) {
void *a[1];
a[0] = &i;
QMetaObject::metacall(object,
@@ -742,13 +742,13 @@ void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value)
{
QString s;
bool found = true;
- if(vt == QVariant::ByteArray) {
+ if (vt == QVariant::ByteArray) {
s = QLatin1String(value.toByteArray());
} else {
found = false;
}
- if(found) {
+ if (found) {
void *a[1];
a[0] = &s;
QMetaObject::metacall(object,
@@ -774,13 +774,13 @@ void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value)
*/
void QmlMetaProperty::write(const QVariant &value) const
{
- if(type() & SignalProperty) {
+ if (type() & SignalProperty) {
d->writeSignalProperty(value);
- } else if(d->prop.name()) {
+ } else if (d->prop.name()) {
- if(d->prop.isEnumType()) {
+ if (d->prop.isEnumType()) {
QVariant v = value;
if (value.type() == QVariant::Double) { //enum values come through the script engine as doubles
double integral;
@@ -790,43 +790,43 @@ void QmlMetaProperty::write(const QVariant &value) const
}
d->prop.write(object(), v);
} else {
- if(!value.isValid())
+ if (!value.isValid())
return;
int t = propertyType();
int vt = value.type();
- if(vt == t ||
+ if (vt == t ||
value.userType() == t) {
void *a[1];
a[0] = (void *)value.constData();
QMetaObject::metacall(object(), QMetaObject::WriteProperty, d->coreIdx, a);
- } else if(qMetaTypeId<QVariant>() == t) {
+ } else if (qMetaTypeId<QVariant>() == t) {
d->prop.write(object(), value);
- } else if(propertyCategory() == Object) {
+ } else if (propertyCategory() == Object) {
QObject *o = QmlMetaType::toQObject(value);
- if(o)
+ if (o)
d->prop.write(object(), QmlMetaType::fromObject(o, propertyType()));
} else if (propertyCategory() == List) {
int listType = QmlMetaType::listType(t);
- if(value.userType() == qMetaTypeId<QList<QObject *> >()) {
+ if (value.userType() == qMetaTypeId<QList<QObject *> >()) {
const QList<QObject *> &list =
qvariant_cast<QList<QObject *> >(value);
QVariant listVar = d->prop.read(object());
QmlMetaType::clear(listVar);
- for(int ii = 0; ii < list.count(); ++ii) {
+ for (int ii = 0; ii < list.count(); ++ii) {
QVariant v = QmlMetaType::fromObject(list.at(ii), listType);
QmlMetaType::append(listVar, v);
}
- } else if(vt == listType ||
+ } else if (vt == listType ||
value.userType() == listType) {
QVariant listVar = d->prop.read(object());
if (!QmlMetaType::append(listVar, value)) {
@@ -848,13 +848,13 @@ void QmlMetaProperty::write(const QVariant &value) const
const QMetaObject *objMo = obj->metaObject();
bool found = false;
while(!found && objMo) {
- if(objMo == mo)
+ if (objMo == mo)
found = true;
else
objMo = objMo->superClass();
}
- if(!found) {
+ if (!found) {
qWarning() << "Unable to assign object to list";
return;
}
@@ -864,22 +864,22 @@ void QmlMetaProperty::write(const QVariant &value) const
void *d = (void *)&obj;
li->append(d);
}
- } else if(propertyCategory() == Normal) {
+ } else if (propertyCategory() == Normal) {
switch(t) {
case QVariant::Double:
{
qreal r;
bool found = true;
- if(vt == QVariant::Int) {
+ if (vt == QVariant::Int) {
r = value.toInt();
- } else if(vt == QVariant::UInt) {
+ } else if (vt == QVariant::UInt) {
r = value.toUInt();
} else {
found = false;
}
- if(found) {
+ if (found) {
void *a[1];
a[0] = &r;
QMetaObject::metacall(object(),
@@ -894,15 +894,15 @@ void QmlMetaProperty::write(const QVariant &value) const
{
int i;
bool found = true;
- if(vt == QVariant::Double) {
+ if (vt == QVariant::Double) {
i = (int)value.toDouble();
- } else if(vt == QVariant::UInt) {
+ } else if (vt == QVariant::UInt) {
i = (int)value.toUInt();
} else {
found = false;
}
- if(found) {
+ if (found) {
void *a[1];
a[0] = &i;
QMetaObject::metacall(object(),
@@ -917,13 +917,13 @@ void QmlMetaProperty::write(const QVariant &value) const
{
QString s;
bool found = true;
- if(vt == QVariant::ByteArray) {
+ if (vt == QVariant::ByteArray) {
s = QLatin1String(value.toByteArray());
} else {
found = false;
}
- if(found) {
+ if (found) {
void *a[1];
a[0] = &s;
QMetaObject::metacall(object(),
@@ -950,7 +950,7 @@ void QmlMetaProperty::write(const QVariant &value) const
*/
bool QmlMetaProperty::hasChangedNotifier() const
{
- if(type() & Property && !(type() & Attached)) {
+ if (type() & Property && !(type() & Attached)) {
return d->prop.hasNotifySignal();
}
return false;
@@ -966,10 +966,10 @@ bool QmlMetaProperty::hasChangedNotifier() const
*/
bool QmlMetaProperty::connectNotifier(QObject *dest, int method) const
{
- if(!(type() & Property) || type() & Attached)
+ if (!(type() & Property) || type() & Attached)
return false;
- if(d->prop.hasNotifySignal()) {
+ if (d->prop.hasNotifySignal()) {
return QMetaObject::connect(d->object, d->prop.notifySignalIndex(), dest, method, Qt::DirectConnection);
} else {
return false;
@@ -986,10 +986,10 @@ bool QmlMetaProperty::connectNotifier(QObject *dest, int method) const
*/
bool QmlMetaProperty::connectNotifier(QObject *dest, const char *slot) const
{
- if(!(type() & Property) || type() & Attached)
+ if (!(type() & Property) || type() & Attached)
return false;
- if(d->prop.hasNotifySignal()) {
+ if (d->prop.hasNotifySignal()) {
QByteArray signal(QByteArray("2") + d->prop.notifySignal().signature());
return QObject::connect(d->object, signal.constData(), dest, slot);
} else {
@@ -1000,8 +1000,8 @@ bool QmlMetaProperty::connectNotifier(QObject *dest, const char *slot) const
/*! \internal */
void QmlMetaProperty::emitSignal()
{
- if(type() & Signal) {
- if(d->signal.parameterTypes().isEmpty())
+ if (type() & Signal) {
+ if (d->signal.parameterTypes().isEmpty())
d->object->metaObject()->activate(d->object, d->coreIdx, 0);
else
qWarning() << "QmlMetaProperty: Cannot emit signal with parameters";
@@ -1023,9 +1023,9 @@ int QmlMetaProperty::coreIndex() const
quint32 QmlMetaProperty::save() const
{
quint32 rv = 0;
- if(type() & Attached) {
+ if (type() & Attached) {
rv = d->attachedFunc;
- } else if(type() != Invalid) {
+ } else if (type() != Invalid) {
rv = d->coreIdx;
}
@@ -1050,14 +1050,14 @@ void QmlMetaProperty::restore(quint32 id, QObject *obj)
d->type = id >> 16;
id &= 0xFFFF;
- if(d->type & Attached) {
+ if (d->type & Attached) {
d->attachedFunc = id;
- } else if(d->type & Property) {
+ } else if (d->type & Property) {
QMetaPropertyEx p(obj->metaObject()->property(id));
d->prop = p;
d->propType = p.propertyType;
d->coreIdx = id;
- } else if(d->type & SignalProperty || d->type & Signal) {
+ } else if (d->type & SignalProperty || d->type & Signal) {
d->signal = obj->metaObject()->method(id);
d->coreIdx = id;
}
diff --git a/src/declarative/qml/qmlmetatype.cpp b/src/declarative/qml/qmlmetatype.cpp
index c12f01a..9b99917 100644
--- a/src/declarative/qml/qmlmetatype.cpp
+++ b/src/declarative/qml/qmlmetatype.cpp
@@ -164,7 +164,7 @@ QmlType::QmlType(int type, int listType, int qmlListType,
d->m_extFunc = extFunc;
d->m_index = index;
- if(extMetaObject)
+ if (extMetaObject)
d->m_extMetaObject = extMetaObject;
}
@@ -175,16 +175,16 @@ QmlType::~QmlType()
void QmlTypePrivate::init() const
{
- if(m_isSetup) return;
+ if (m_isSetup) return;
QWriteLocker lock(metaTypeDataLock());
- if(m_isSetup)
+ if (m_isSetup)
return;
// Setup extended meta object
// XXX - very inefficient
const QMetaObject *mo = m_baseMetaObject;
- if(m_extFunc) {
+ if (m_extFunc) {
QMetaObject *mmo = new QMetaObject;
*mmo = *m_extMetaObject;
mmo->d.superdata = mo;
@@ -195,12 +195,12 @@ void QmlTypePrivate::init() const
mo = mo->d.superdata;
while(mo) {
QmlType *t = metaTypeData()->metaObjectToType.value(mo);
- if(t) {
- if(t->d->m_extFunc) {
+ if (t) {
+ if (t->d->m_extFunc) {
QMetaObject *mmo = new QMetaObject;
*mmo = *t->d->m_extMetaObject;
mmo->d.superdata = m_baseMetaObject;
- if(!m_metaObjects.isEmpty())
+ if (!m_metaObjects.isEmpty())
m_metaObjects.last().metaObject->d.superdata = mmo;
QmlProxyMetaObject::ProxyData data = { mmo, t->d->m_extFunc, 0 };
m_metaObjects << data;
@@ -209,7 +209,7 @@ void QmlTypePrivate::init() const
mo = mo->d.superdata;
}
- for(int ii = 0; ii < m_metaObjects.count(); ++ii)
+ for (int ii = 0; ii < m_metaObjects.count(); ++ii)
m_metaObjects[ii].propertyOffset =
m_metaObjects.at(ii).metaObject->propertyOffset();
@@ -218,7 +218,7 @@ void QmlTypePrivate::init() const
const QMetaObject *myMetaObject = m_metaObjects.isEmpty()?m_baseMetaObject:m_metaObjects.first().metaObject;
- for(int ii = 0; ii < myMetaObject->propertyCount(); ++ii) {
+ for (int ii = 0; ii < myMetaObject->propertyCount(); ++ii) {
QMetaProperty prop = myMetaObject->property(ii);
hashData.append(prop.type());
hashData.append("|");
@@ -226,7 +226,7 @@ void QmlTypePrivate::init() const
hashData.append("|");
}
- for(int ii = 0; ii < myMetaObject->methodCount(); ++ii) {
+ for (int ii = 0; ii < myMetaObject->methodCount(); ++ii) {
QMetaMethod method = myMetaObject->method(ii);
hashData.append(method.signature());
hashData.append("|");
@@ -240,7 +240,7 @@ void QmlTypePrivate::init() const
QByteArray QmlType::typeName() const
{
- if(d->m_baseMetaObject)
+ if (d->m_baseMetaObject)
return d->m_baseMetaObject->className();
else
return QByteArray();
@@ -324,7 +324,7 @@ const QMetaObject *QmlType::metaObject() const
{
d->init();
- if(d->m_metaObjects.isEmpty())
+ if (d->m_metaObjects.isEmpty())
return d->m_baseMetaObject;
else
return d->m_metaObjects.first().metaObject;
@@ -383,11 +383,11 @@ int QmlMetaType::registerInterface(const QmlPrivate::MetaTypeIds &id,
data->idToType.insert(type->qmlListTypeId(), type);
data->nameToType.insert(type->qmlTypeName(), type);
- if(data->interfaces.size() < id.typeId)
+ if (data->interfaces.size() < id.typeId)
data->interfaces.resize(id.typeId + 16);
- if(data->qmllists.size() < id.qmlListId)
+ if (data->qmllists.size() < id.qmlListId)
data->qmllists.resize(id.qmlListId + 16);
- if(data->lists.size() < id.listId)
+ if (data->lists.size() < id.listId)
data->lists.resize(id.listId + 16);
data->interfaces.setBit(id.typeId, true);
data->qmllists.setBit(id.qmlListId, true);
@@ -403,8 +403,8 @@ int QmlMetaType::registerType(const QmlPrivate::MetaTypeIds &id, QmlPrivate::Fun
QmlMetaTypeData *data = metaTypeData();
QString name = QLatin1String(cname);
- for(int ii = 0; ii < name.count(); ++ii) {
- if(!name.at(ii).isLetterOrNumber()) {
+ for (int ii = 0; ii < name.count(); ++ii) {
+ if (!name.at(ii).isLetterOrNumber()) {
qWarning("QmlMetaType: Invalid QML name %s", cname);
return -1;
}
@@ -421,16 +421,16 @@ int QmlMetaType::registerType(const QmlPrivate::MetaTypeIds &id, QmlPrivate::Fun
data->idToType.insert(type->qListTypeId(), type);
data->idToType.insert(type->qmlListTypeId(), type);
- if(!type->qmlTypeName().isEmpty())
+ if (!type->qmlTypeName().isEmpty())
data->nameToType.insert(type->qmlTypeName(), type);
data->metaObjectToType.insert(type->baseMetaObject(), type);
- if(data->objects.size() <= id.typeId)
+ if (data->objects.size() <= id.typeId)
data->objects.resize(id.typeId + 16);
- if(data->qmllists.size() <= id.qmlListId)
+ if (data->qmllists.size() <= id.qmlListId)
data->qmllists.resize(id.qmlListId + 16);
- if(data->lists.size() <= id.listId)
+ if (data->lists.size() <= id.listId)
data->lists.resize(id.listId + 16);
data->objects.setBit(id.typeId, true);
data->qmllists.setBit(id.qmlListId, true);
@@ -446,7 +446,7 @@ void QmlMetaType::registerCustomParser(const char *qmlName,
QmlMetaTypeData *data = metaTypeData();
Q_ASSERT(parser);
- if(data->customParsers.contains(qmlName)) {
+ if (data->customParsers.contains(qmlName)) {
delete parser;
return;
}
@@ -468,7 +468,7 @@ int QmlMetaType::qmlParserStatusCast(int userType)
QReadLocker lock(metaTypeDataLock());
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->idToType.value(userType);
- if(type && type->typeId() == userType)
+ if (type && type->typeId() == userType)
return type->parserStatusCast();
else
return -1;
@@ -476,7 +476,7 @@ int QmlMetaType::qmlParserStatusCast(int userType)
QObject *QmlMetaType::toQObject(const QVariant &v)
{
- if(!isObject(v.userType()))
+ if (!isObject(v.userType()))
return 0;
// NOTE: This assumes a cast to QObject does not alter the
@@ -493,7 +493,7 @@ int QmlMetaType::listType(int id)
QReadLocker lock(metaTypeDataLock());
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->idToType.value(id);
- if(type && type->qListTypeId() == id)
+ if (type && type->qListTypeId() == id)
return type->typeId();
else
return 0;
@@ -507,7 +507,7 @@ int QmlMetaType::qmlListType(int id)
QReadLocker lock(metaTypeDataLock());
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->idToType.value(id);
- if(type && type->qmlListTypeId() == id)
+ if (type && type->qmlListTypeId() == id)
return type->typeId();
else
return 0;
@@ -520,7 +520,7 @@ bool QmlMetaType::clear(const QVariant &list)
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->idToType.value(userType);
lock.unlock();
- if(type && type->qListTypeId() == userType) {
+ if (type && type->qListTypeId() == userType) {
type->listClear(list);
return true;
} else {
@@ -535,7 +535,7 @@ bool QmlMetaType::append(const QVariant &list, const QVariant &item)
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->idToType.value(userType);
lock.unlock();
- if(type && type->qListTypeId() == userType &&
+ if (type && type->qListTypeId() == userType &&
item.userType() == type->typeId()) {
type->listAppend(list, item);
return true;
@@ -551,7 +551,7 @@ QObject *QmlMetaType::create(const QByteArray &name)
lock.unlock();
QmlType *type = data->nameToType.value(name);
- if(type)
+ if (type)
return type->create();
else
return 0;
@@ -563,7 +563,7 @@ QVariant QmlMetaType::fromObject(QObject *obj, int typeId)
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->idToType.value(typeId);
- if(type && type->typeId() == typeId)
+ if (type && type->typeId() == typeId)
return type->fromObject(obj);
else
return QVariant();
@@ -575,7 +575,7 @@ const QMetaObject *QmlMetaType::rawMetaObjectForType(int id)
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->idToType.value(id);
- if(type && type->typeId() == id)
+ if (type && type->typeId() == id)
return type->baseMetaObject();
else
return 0;
@@ -587,7 +587,7 @@ const QMetaObject *QmlMetaType::rawMetaObjectForType(const QByteArray &name)
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->nameToType.value(name);
- if(type)
+ if (type)
return type->baseMetaObject();
else
return 0;
@@ -600,7 +600,7 @@ const QMetaObject *QmlMetaType::metaObjectForType(int id)
QmlType *type = data->idToType.value(id);
lock.unlock();
- if(type && type->typeId() == id)
+ if (type && type->typeId() == id)
return type->metaObject();
else
return 0;
@@ -613,7 +613,7 @@ const QMetaObject *QmlMetaType::metaObjectForType(const QByteArray &name)
QmlType *type = data->nameToType.value(name);
lock.unlock();
- if(type)
+ if (type)
return type->metaObject();
else
return 0;
@@ -625,7 +625,7 @@ int QmlMetaType::type(const QByteArray &name)
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->nameToType.value(name);
- if(type)
+ if (type)
return type->typeId();
else
return 0;
@@ -637,7 +637,7 @@ int QmlMetaType::attachedPropertiesFuncId(const QByteArray &name)
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->nameToType.value(name);
- if(type && type->attachedPropertiesFunction())
+ if (type && type->attachedPropertiesFunction())
return type->index();
else
return -1;
@@ -649,7 +649,7 @@ int QmlMetaType::attachedPropertiesFuncId(const QMetaObject *mo)
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->metaObjectToType.value(mo);
- if(type && type->attachedPropertiesFunction())
+ if (type && type->attachedPropertiesFunction())
return type->index();
else
return -1;
@@ -657,7 +657,7 @@ int QmlMetaType::attachedPropertiesFuncId(const QMetaObject *mo)
QmlAttachedPropertiesFunc QmlMetaType::attachedPropertiesFuncById(int id)
{
- if(id < 0)
+ if (id < 0)
return 0;
QReadLocker lock(metaTypeDataLock());
QmlMetaTypeData *data = metaTypeData();
@@ -670,7 +670,7 @@ QmlMetaType::attachedPropertiesFunc(const QByteArray &name)
QReadLocker lock(metaTypeDataLock());
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->nameToType.value(name);
- if(type)
+ if (type)
return type->attachedPropertiesFunction();
else
return 0;
@@ -679,15 +679,15 @@ QmlMetaType::attachedPropertiesFunc(const QByteArray &name)
QMetaProperty QmlMetaType::defaultProperty(const QMetaObject *metaObject)
{
int idx = metaObject->indexOfClassInfo("DefaultProperty");
- if(-1 == idx)
+ if (-1 == idx)
return QMetaProperty();
QMetaClassInfo info = metaObject->classInfo(idx);
- if(!info.value())
+ if (!info.value())
return QMetaProperty();
idx = metaObject->indexOfProperty(info.value());
- if(-1 == idx)
+ if (-1 == idx)
return QMetaProperty();
return metaObject->property(idx);
@@ -695,7 +695,7 @@ QMetaProperty QmlMetaType::defaultProperty(const QMetaObject *metaObject)
QMetaProperty QmlMetaType::defaultProperty(QObject *obj)
{
- if(!obj)
+ if (!obj)
return QMetaProperty();
const QMetaObject *metaObject = obj->metaObject();
@@ -705,15 +705,15 @@ QMetaProperty QmlMetaType::defaultProperty(QObject *obj)
QMetaMethod QmlMetaType::defaultMethod(const QMetaObject *metaObject)
{
int idx = metaObject->indexOfClassInfo("DefaultMethod");
- if(-1 == idx)
+ if (-1 == idx)
return QMetaMethod();
QMetaClassInfo info = metaObject->classInfo(idx);
- if(!info.value())
+ if (!info.value())
return QMetaMethod();
idx = metaObject->indexOfMethod(info.value());
- if(-1 == idx)
+ if (-1 == idx)
return QMetaMethod();
return metaObject->method(idx);
@@ -721,7 +721,7 @@ QMetaMethod QmlMetaType::defaultMethod(const QMetaObject *metaObject)
QMetaMethod QmlMetaType::defaultMethod(QObject *obj)
{
- if(!obj)
+ if (!obj)
return QMetaMethod();
const QMetaObject *metaObject = obj->metaObject();
@@ -739,13 +739,13 @@ QMetaProperty QmlMetaType::property(QObject *obj, const QByteArray &bname)
*/
QMetaProperty QmlMetaType::property(QObject *obj, const char *name)
{
- if(!obj)
+ if (!obj)
return QMetaProperty();
const QMetaObject *metaObject = obj->metaObject();
int idx = metaObject->indexOfProperty(name);
- if(-1 == idx)
+ if (-1 == idx)
return QMetaProperty();
return metaObject->property(idx);
@@ -771,7 +771,7 @@ const char *QmlMetaType::interfaceIId(int userType)
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->idToType.value(userType);
lock.unlock();
- if(type && type->isInterface() && type->typeId() == userType)
+ if (type && type->isInterface() && type->typeId() == userType)
return type->interfaceIId();
else
return 0;
@@ -780,7 +780,7 @@ const char *QmlMetaType::interfaceIId(int userType)
bool QmlMetaType::isObject(const QMetaObject *mo)
{
while(mo) {
- if(mo == &QObject::staticMetaObject)
+ if (mo == &QObject::staticMetaObject)
return true;
mo = mo->superClass();
}
@@ -815,7 +815,7 @@ int QmlMetaType::listCount(const QVariant &v)
QmlType *type = data->idToType.value(userType);
lock.unlock();
- if(type && type->qListTypeId() == userType)
+ if (type && type->qListTypeId() == userType)
return type->listCount(v);
else
return 0;
@@ -830,7 +830,7 @@ QVariant QmlMetaType::listAt(const QVariant &v, int idx)
QmlType *type = data->idToType.value(userType);
lock.unlock();
- if(type && type->qListTypeId() == userType)
+ if (type && type->qListTypeId() == userType)
return type->listAt(v, idx);
else
return 0;
@@ -856,7 +856,7 @@ void QmlMetaType::registerCustomStringConverter(int type, StringConverter conver
QWriteLocker lock(metaTypeDataLock());
QmlMetaTypeData *data = metaTypeData();
- if(data->stringConverters.contains(type))
+ if (data->stringConverters.contains(type))
return;
data->stringConverters.insert(type, converter);
}
diff --git a/src/declarative/qml/qmlmetatype.h b/src/declarative/qml/qmlmetatype.h
index c17d47f..83fb60b 100644
--- a/src/declarative/qml/qmlmetatype.h
+++ b/src/declarative/qml/qmlmetatype.h
@@ -199,7 +199,7 @@ int qmlRegisterExtendedType(const char *typeName)
QmlAttachedPropertiesFunc attached =
QmlPrivate::attachedPropertiesFunc<E>();
- if(!attached)
+ if (!attached)
attached = QmlPrivate::attachedPropertiesFunc<T>();
return QmlMetaType::registerType(ids, QmlPrivate::list_nocreate_op<T>, 0,
@@ -221,7 +221,7 @@ int qmlRegisterExtendedType(const char *qmlName, const char *typeName)
QmlAttachedPropertiesFunc attached =
QmlPrivate::attachedPropertiesFunc<E>();
- if(!attached)
+ if (!attached)
attached = QmlPrivate::attachedPropertiesFunc<T>();
return QmlMetaType::registerType(ids, QmlPrivate::list_op<T>,
diff --git a/src/declarative/qml/qmlparser.cpp b/src/declarative/qml/qmlparser.cpp
index 54db32e..ecb6f0b 100644
--- a/src/declarative/qml/qmlparser.cpp
+++ b/src/declarative/qml/qmlparser.cpp
@@ -55,8 +55,8 @@
#include <qmlbasicscript.h>
#include "private/qmetaobjectbuilder_p.h"
#include <private/qmlvmemetaobject_p.h>
-#include "private/qmlxmlparser_p.h"
#include <private/qmlcompiler_p.h>
+#include <QtDebug>
QT_BEGIN_NAMESPACE
@@ -70,16 +70,16 @@ QmlParser::Object::Object()
QmlParser::Object::~Object()
{
- if(defaultProperty) defaultProperty->release();
+ if (defaultProperty) defaultProperty->release();
foreach(Property *prop, properties)
prop->release();
- if(dynamicPropertiesProperty) dynamicPropertiesProperty->release();
- if(dynamicSignalsProperty) dynamicSignalsProperty->release();
+ if (dynamicPropertiesProperty) dynamicPropertiesProperty->release();
+ if (dynamicSignalsProperty) dynamicSignalsProperty->release();
}
const QMetaObject *Object::metaObject() const
{
- if(extObject && metatype)
+ if (extObject && metatype)
return extObject;
else
return metatype;
@@ -87,15 +87,15 @@ const QMetaObject *Object::metaObject() const
QmlParser::Property *Object::getDefaultProperty()
{
- if(!defaultProperty)
+ if (!defaultProperty)
defaultProperty = new Property;
return defaultProperty;
}
Property *QmlParser::Object::getProperty(const QByteArray &name, bool create)
{
- if(!properties.contains(name)) {
- if(create)
+ if (!properties.contains(name)) {
+ if (create)
properties.insert(name, new Property(name));
else
return 0;
@@ -140,17 +140,23 @@ QmlParser::Property::~Property()
{
foreach(Value *value, values)
value->release();
- if(value) value->release();
+ if (value) value->release();
}
Object *QmlParser::Property::getValue()
{
- if(!value) value = new Object;
+ if (!value) value = new Object;
return value;
}
void QmlParser::Property::addValue(Value *v)
{
+ if (::getenv("DUI_DEBUG")) {
+ if (v->object)
+ qDebug() << "Property" << name << "addValue Object(" << v->object->typeName << ")";
+ else
+ qDebug() << "Property" << name << "addValue" << v->primitive;
+ }
values << v;
}
@@ -161,7 +167,7 @@ QmlParser::Value::Value()
QmlParser::Value::~Value()
{
- if(object) object->release();
+ if (object) object->release();
}
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlparser_p.h b/src/declarative/qml/qmlparser_p.h
index 9d3f3f6..e29cdbf 100644
--- a/src/declarative/qml/qmlparser_p.h
+++ b/src/declarative/qml/qmlparser_p.h
@@ -55,7 +55,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlXmlParser;
/*
XXX
diff --git a/src/declarative/qml/qmlparserstatus.cpp b/src/declarative/qml/qmlparserstatus.cpp
index 3bb421d..1f49553 100644
--- a/src/declarative/qml/qmlparserstatus.cpp
+++ b/src/declarative/qml/qmlparserstatus.cpp
@@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QmlParserStatus
- \brief provides updates on the parser state.
+ \brief The QmlParserStatus class provides updates on the parser state.
*/
/*!
diff --git a/src/declarative/qml/qmlprivate.h b/src/declarative/qml/qmlprivate.h
index 183f42b..590e0c0 100644
--- a/src/declarative/qml/qmlprivate.h
+++ b/src/declarative/qml/qmlprivate.h
@@ -221,7 +221,7 @@ int QmlPrivate::list_op(QmlPrivate::ListOp op, int val,
const QVariant &value,
void **out)
{
- if(op == QmlPrivate::Create) {
+ if (op == QmlPrivate::Create) {
QObject *obj = static_cast<QObject *>(new T);
*((QObject **)out) = obj;
return 0;
@@ -256,7 +256,7 @@ int QmlPrivate::list_op(QmlPrivate::ListOp op, int val,
{
QObject *fromObj = value.value<QObject *>();
T *me = qobject_cast<T *>(fromObj);
- if(me) {
+ if (me) {
*((QVariant *)*out) = QVariant::fromValue(me);
}
}
@@ -304,7 +304,7 @@ int QmlPrivate::list_nocreate_op(QmlPrivate::ListOp op, int val,
{
QObject *fromObj = value.value<QObject *>();
T *me = qobject_cast<T *>(fromObj);
- if(me) {
+ if (me) {
*((QVariant *)*out) = QVariant::fromValue(me);
}
}
diff --git a/src/declarative/qml/qmlproxymetaobject.cpp b/src/declarative/qml/qmlproxymetaobject.cpp
index 3b9f6ca..d24c5c4 100644
--- a/src/declarative/qml/qmlproxymetaobject.cpp
+++ b/src/declarative/qml/qmlproxymetaobject.cpp
@@ -53,7 +53,7 @@ QmlProxyMetaObject::QmlProxyMetaObject(QObject *obj, QList<ProxyData> *mList)
*static_cast<QMetaObject *>(this) = *metaObjects->last().metaObject;
QObjectPrivate *op = QObjectPrivate::get(obj);
- if(op->metaObject)
+ if (op->metaObject)
parent = static_cast<QAbstractDynamicMetaObject*>(op->metaObject);
op->metaObject = this;
@@ -69,31 +69,31 @@ QmlProxyMetaObject::QmlProxyMetaObject(QObject *obj, QList<ProxyData> *mList)
QmlProxyMetaObject::~QmlProxyMetaObject()
{
- if(parent)
+ if (parent)
delete parent;
parent = 0;
- if(proxies)
+ if (proxies)
delete [] proxies;
proxies = 0;
}
int QmlProxyMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
{
- if((c == QMetaObject::ReadProperty ||
+ if ((c == QMetaObject::ReadProperty ||
c == QMetaObject::WriteProperty) &&
id >= metaObjects->last().propertyOffset) {
- for(int ii = 0; ii < metaObjects->count(); ++ii) {
+ for (int ii = 0; ii < metaObjects->count(); ++ii) {
const ProxyData &data = metaObjects->at(ii);
- if(id >= data.propertyOffset) {
- if(!proxies) {
+ if (id >= data.propertyOffset) {
+ if (!proxies) {
proxies = new QObject*[metaObjects->count()];
::memset(proxies, 0,
sizeof(QObject *) * metaObjects->count());
}
- if(!proxies[ii])
+ if (!proxies[ii])
proxies[ii] = data.createFunc(object);
int proxyOffset = proxies[ii]->metaObject()->propertyOffset();
@@ -104,7 +104,7 @@ int QmlProxyMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
}
}
- if(parent)
+ if (parent)
return parent->metaCall(c, id, a);
else
return object->qt_metacall(c, id, a);
diff --git a/src/declarative/qml/qmlrefcount.cpp b/src/declarative/qml/qmlrefcount.cpp
index 4e47ee1..8f71f1b 100644
--- a/src/declarative/qml/qmlrefcount.cpp
+++ b/src/declarative/qml/qmlrefcount.cpp
@@ -60,7 +60,7 @@ void QmlRefCount::release()
{
Q_ASSERT(refCount > 0);
--refCount;
- if(refCount == 0)
+ if (refCount == 0)
delete this;
}
diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp
new file mode 100644
index 0000000..317a3bf
--- /dev/null
+++ b/src/declarative/qml/qmlscriptparser.cpp
@@ -0,0 +1,632 @@
+
+#include "qmlscriptparser_p.h"
+#include "qmlxmlparser_p.h"
+#include "qmlparser_p.h"
+
+#include "parser/javascriptengine_p.h"
+#include "parser/javascriptparser_p.h"
+#include "parser/javascriptlexer_p.h"
+#include "parser/javascriptnodepool_p.h"
+#include "parser/javascriptastvisitor_p.h"
+#include "parser/javascriptast_p.h"
+
+#include <QStack>
+#include <QtDebug>
+
+QT_BEGIN_NAMESPACE
+
+using namespace JavaScript;
+using namespace QmlParser;
+
+namespace {
+
+class ProcessAST: protected AST::Visitor
+{
+ struct State {
+ State() : object(0), property(0) {}
+ State(Object *o) : object(o), property(0) {}
+ State(Object *o, Property *p) : object(o), property(p) {}
+
+ Object *object;
+ Property *property;
+ };
+
+ struct StateStack : public QStack<State>
+ {
+ void pushObject(Object *obj)
+ {
+ push(State(obj));
+ }
+
+ void pushProperty(const QString &name, int lineNumber)
+ {
+ const State &state = top();
+ if (state.property) {
+ State s(state.property->getValue(),
+ state.property->getValue()->getProperty(name.toLatin1()));
+ s.property->line = lineNumber;
+ push(s);
+ } else {
+ State s(state.object,
+ state.object->getProperty(name.toLatin1()));
+ s.property->line = lineNumber;
+ push(s);
+ }
+ }
+ };
+
+public:
+ ProcessAST(QmlScriptParser *parser);
+ virtual ~ProcessAST();
+
+ void operator()(const QString &code, AST::Node *node);
+
+protected:
+ Object *defineObjectBinding(int line,
+ AST::UiQualifiedId *propertyName,
+ const QString &objectType,
+ AST::UiObjectInitializer *initializer = 0);
+ Object *defineObjectBinding_helper(int line,
+ AST::UiQualifiedId *propertyName,
+ const QString &objectType,
+ AST::UiObjectInitializer *initializer = 0);
+ QString getPrimitive(const QByteArray &propertyName, AST::ExpressionNode *expr);
+ void defineProperty(const QString &propertyName, int line, const QString &primitive);
+
+ using AST::Visitor::visit;
+ using AST::Visitor::endVisit;
+
+ virtual bool visit(AST::UiProgram *node);
+ virtual bool visit(AST::UiImport *node);
+ virtual bool visit(AST::UiObjectDefinition *node);
+ virtual bool visit(AST::UiPublicMember *node);
+ virtual bool visit(AST::UiObjectBinding *node);
+
+ virtual bool visit(AST::UiScriptBinding *node);
+ virtual bool visit(AST::UiArrayBinding *node);
+ virtual bool visit(AST::UiSourceElement *node);
+
+ void accept(AST::Node *node);
+
+ QString asString(AST::UiQualifiedId *node) const;
+
+ const State state() const;
+ Object *currentObject() const;
+ Property *currentProperty() const;
+
+ QString qualifiedNameId() const;
+
+ QString textAt(const AST::SourceLocation &loc) const
+ { return _contents.mid(loc.offset, loc.length); }
+
+ QString textAt(const AST::SourceLocation &first,
+ const AST::SourceLocation &last) const
+ { return _contents.mid(first.offset, last.offset + last.length - first.offset); }
+
+ QString asString(AST::ExpressionNode *expr) const
+ {
+ if (! expr)
+ return QString();
+
+ return textAt(expr->firstSourceLocation(), expr->lastSourceLocation());
+ }
+
+ QString asString(AST::Statement *stmt) const
+ {
+ if (! stmt)
+ return QString();
+
+ QString s = textAt(stmt->firstSourceLocation(), stmt->lastSourceLocation());
+ s += QLatin1Char('\n');
+ return s;
+ }
+
+private:
+ QmlScriptParser *_parser;
+ StateStack _stateStack;
+ QStringList _scope;
+ QString _contents;
+
+ inline bool isSignalProperty(const QByteArray &propertyName) const {
+ return (propertyName.length() >= 3 && propertyName.startsWith("on") &&
+ ('A' <= propertyName.at(2) && 'Z' >= propertyName.at(2)));
+ }
+
+};
+
+ProcessAST::ProcessAST(QmlScriptParser *parser)
+ : _parser(parser)
+{
+}
+
+ProcessAST::~ProcessAST()
+{
+}
+
+void ProcessAST::operator()(const QString &code, AST::Node *node)
+{
+ _contents = code;
+ accept(node);
+}
+
+void ProcessAST::accept(AST::Node *node)
+{
+ AST::Node::acceptChild(node, this);
+}
+
+const ProcessAST::State ProcessAST::state() const
+{
+ if (_stateStack.isEmpty())
+ return State();
+
+ return _stateStack.back();
+}
+
+Object *ProcessAST::currentObject() const
+{
+ return state().object;
+}
+
+Property *ProcessAST::currentProperty() const
+{
+ return state().property;
+}
+
+QString ProcessAST::qualifiedNameId() const
+{
+ return _scope.join(QLatin1String("/"));
+}
+
+QString ProcessAST::asString(AST::UiQualifiedId *node) const
+{
+ QString s;
+
+ for (AST::UiQualifiedId *it = node; it; it = it->next) {
+ s.append(it->name->asString());
+
+ if (it->next)
+ s.append(QLatin1Char('.'));
+ }
+
+ return s;
+}
+
+Object *ProcessAST::defineObjectBinding_helper(int line,
+ AST::UiQualifiedId *propertyName,
+ const QString &objectType,
+ AST::UiObjectInitializer *initializer)
+{
+ bool isType = !objectType.isEmpty() && objectType.at(0).isUpper() && !objectType.contains(QLatin1Char('.'));
+ if (!isType) {
+ qWarning() << "bad name for a class"; // ### FIXME
+ return false;
+ }
+
+ int propertyCount = 0;
+ for (; propertyName; propertyName = propertyName->next){
+ ++propertyCount;
+ _stateStack.pushProperty(propertyName->name->asString(), propertyName->identifierToken.startLine);
+ }
+
+ // Class
+ const int typeId = _parser->findOrCreateTypeId(objectType);
+
+ Object *obj = new Object;
+ obj->type = typeId;
+ _scope.append(objectType);
+ obj->typeName = qualifiedNameId().toLatin1();
+ _scope.removeLast();
+ obj->line = line;
+
+ if (propertyCount) {
+ Property *prop = currentProperty();
+ Value *v = new Value;
+ v->object = obj;
+ v->line = line;
+ prop->addValue(v);
+
+ while (propertyCount--)
+ _stateStack.pop();
+
+ } else {
+
+ if (! _parser->tree()) {
+ _parser->setTree(obj);
+
+ if (!_parser->scriptFile().isEmpty()) {
+ _stateStack.pushObject(obj);
+ Object *scriptObject= defineObjectBinding(line, 0, QLatin1String("Script"));
+ _stateStack.pushObject(scriptObject);
+ defineProperty(QLatin1String("src"), line, _parser->scriptFile());
+ _stateStack.pop(); // scriptObject
+ _stateStack.pop(); // object
+ }
+
+ } else {
+ const State state = _stateStack.top();
+ Value *v = new Value;
+ v->object = obj;
+ v->line = line;
+ if (state.property)
+ state.property->addValue(v);
+ else
+ state.object->getDefaultProperty()->addValue(v);
+ }
+ }
+
+ _stateStack.pushObject(obj);
+ accept(initializer);
+ _stateStack.pop();
+
+ return obj;
+}
+
+Object *ProcessAST::defineObjectBinding(int line,
+ AST::UiQualifiedId *qualifiedId,
+ const QString &objectType,
+ AST::UiObjectInitializer *initializer)
+{
+ if (objectType == QLatin1String("Connection")) {
+
+ Object *obj = defineObjectBinding_helper(line, 0, QLatin1String("Connection"));
+
+ _stateStack.pushObject(obj);
+
+ AST::UiObjectMemberList *it = initializer->members;
+ for (; it; it = it->next) {
+ AST::UiScriptBinding *scriptBinding = AST::cast<AST::UiScriptBinding *>(it->member);
+ if (! scriptBinding)
+ continue;
+
+ QString propertyName = asString(scriptBinding->qualifiedId);
+ if (propertyName == QLatin1String("script")) {
+ QString script;
+ if (AST::ExpressionStatement *stmt = AST::cast<AST::ExpressionStatement *>(scriptBinding->statement)) {
+ script = getPrimitive("script", stmt->expression);
+ } else {
+ script = asString(scriptBinding->statement);
+ }
+ defineProperty(QLatin1String("script"), line, script);
+ } else {
+ accept(it->member);
+ }
+ }
+
+ _stateStack.pop(); // object
+
+ return obj;
+ }
+
+ return defineObjectBinding_helper(line, qualifiedId, objectType, initializer);
+}
+
+void ProcessAST::defineProperty(const QString &propertyName, int line, const QString &primitive)
+{
+ _stateStack.pushProperty(propertyName, line);
+ Value *value = new Value;
+ value->primitive = primitive;
+ value->line = line;
+ currentProperty()->addValue(value);
+ _stateStack.pop();
+}
+
+// UiProgram: UiImportListOpt UiObjectMemberList ;
+bool ProcessAST::visit(AST::UiProgram *node)
+{
+ accept(node->imports);
+ accept(node->members->member);
+ return false;
+}
+
+// UiImport: T_IMPORT T_STRING_LITERAL ;
+bool ProcessAST::visit(AST::UiImport *node)
+{
+ QString fileName = node->fileName->asString();
+ _parser->addNamespacePath(fileName);
+ return false;
+}
+
+// UiObjectMember: T_PUBLIC UiMemberType T_IDENTIFIER T_COLON Expression
+// UiObjectMember: T_PUBLIC UiMemberType T_IDENTIFIER
+//
+// UiMemberType: "property" | "signal"
+bool ProcessAST::visit(AST::UiPublicMember *node)
+{
+ const QString memberType = node->memberType->asString();
+ const QString name = node->name->asString();
+
+ if (memberType == QLatin1String("property")) {
+ _stateStack.pushProperty(QLatin1String("properties"), node->publicToken.startLine);
+
+ Object *obj = defineObjectBinding(node->identifierToken.startLine,
+ 0,
+ QLatin1String("Property"));
+
+ _stateStack.pushObject(obj);
+
+ defineProperty(QLatin1String("name"), node->identifierToken.startLine, name);
+ if (node->expression) // default value
+ defineProperty(QLatin1String("value"), node->identifierToken.startLine, getPrimitive("value", node->expression));
+
+ _stateStack.pop(); // object
+ _stateStack.pop(); // properties
+
+ } else if (memberType == QLatin1String("signal")) {
+ _stateStack.pushProperty(QLatin1String("signals"), node->publicToken.startLine);
+
+ Object *obj = defineObjectBinding(node->identifierToken.startLine,
+ 0,
+ QLatin1String("Signal"));
+
+ _stateStack.pushObject(obj);
+
+ defineProperty(QLatin1String("name"), node->identifierToken.startLine, name);
+
+ _stateStack.pop(); // object
+ _stateStack.pop(); // signals
+ } else {
+ qWarning() << "bad public identifier" << memberType; // ### FIXME
+ }
+
+
+ // ### TODO drop initializer (unless some example needs differnet properties than name and type and value.
+
+ return false;
+}
+
+
+// UiObjectMember: T_IDENTIFIER UiObjectInitializer ;
+bool ProcessAST::visit(AST::UiObjectDefinition *node)
+{
+
+ defineObjectBinding(node->identifierToken.startLine,
+ 0,
+ node->name->asString(),
+ node->initializer);
+
+ return false;
+}
+
+
+// UiObjectMember: UiQualifiedId T_COLON T_IDENTIFIER UiObjectInitializer ;
+bool ProcessAST::visit(AST::UiObjectBinding *node)
+{
+ defineObjectBinding(node->identifierToken.startLine,
+ node->qualifiedId,
+ node->name->asString(),
+ node->initializer);
+
+ return false;
+}
+
+QString ProcessAST::getPrimitive(const QByteArray &propertyName, AST::ExpressionNode *expr)
+{
+ QString primitive;
+
+ if (isSignalProperty(propertyName)) {
+ primitive = asString(expr);
+ } else if (propertyName == "id" && expr && expr->kind == AST::Node::Kind_IdentifierExpression) {
+ primitive = asString(expr);
+ } else if (AST::StringLiteral *lit = AST::cast<AST::StringLiteral *>(expr)) {
+ // hack: emulate weird XML feature that string literals are not quoted.
+ //This needs to be fixed in the qmlcompiler once xml goes away.
+ primitive = lit->value->asString();
+ } else if (expr->kind == AST::Node::Kind_TrueLiteral
+ || expr->kind == AST::Node::Kind_FalseLiteral
+ || expr->kind == AST::Node::Kind_NumericLiteral
+ ) {
+ primitive = asString(expr);
+ } else {
+ // create a binding
+ primitive += QLatin1Char('{');
+ primitive += asString(expr);
+ primitive += QLatin1Char('}');
+ }
+ return primitive;
+}
+
+
+// UiObjectMember: UiQualifiedId T_COLON Statement ;
+bool ProcessAST::visit(AST::UiScriptBinding *node)
+{
+ int propertyCount = 0;
+ AST::UiQualifiedId *propertyName = node->qualifiedId;
+ for (; propertyName; propertyName = propertyName->next){
+ ++propertyCount;
+ _stateStack.pushProperty(propertyName->name->asString(), propertyName->identifierToken.startLine);
+ }
+
+ Property *prop = currentProperty();
+ QString primitive;
+
+ if (AST::ExpressionStatement *stmt = AST::cast<AST::ExpressionStatement *>(node->statement)) {
+ primitive = getPrimitive(prop->name, stmt->expression);
+ } else if (isSignalProperty(prop->name)) {
+ if (AST::Block *block = AST::cast<AST::Block *>(node->statement)) {
+ const int start = block->lbraceToken.offset + block->rbraceToken.length;
+ primitive += _contents.mid(start, block->rbraceToken.offset - start);
+ } else {
+ primitive += asString(node->statement);
+ }
+ } else { // do binding
+ primitive += QLatin1Char('{');
+ primitive += asString(node->statement);
+ primitive += QLatin1Char('}');
+ }
+
+ Value *v = new Value;
+ v->primitive = primitive;
+ v->line = node->colonToken.startLine;
+ prop->addValue(v);
+
+ while (propertyCount--)
+ _stateStack.pop();
+
+ return true;
+}
+
+// UiObjectMember: UiQualifiedId T_COLON T_LBRACKET UiObjectMemberList T_RBRACKET ;
+bool ProcessAST::visit(AST::UiArrayBinding *node)
+{
+ int propertyCount = 0;
+ AST::UiQualifiedId *propertyName = node->qualifiedId;
+ for (; propertyName; propertyName = propertyName->next){
+ ++propertyCount;
+ _stateStack.pushProperty(propertyName->name->asString(), propertyName->identifierToken.startLine);
+ }
+
+ accept(node->members);
+
+ while (propertyCount--)
+ _stateStack.pop();
+
+ return false;
+}
+
+bool ProcessAST::visit(AST::UiSourceElement *node)
+{
+ QmlParser::Object *obj = currentObject();
+ if (! (obj && obj->typeName == "Script")) {
+ // ### warning
+ return false;
+ }
+
+ QString source;
+
+ int line = 0;
+ if (AST::FunctionDeclaration *funDecl = AST::cast<AST::FunctionDeclaration *>(node->sourceElement)) {
+ line = funDecl->functionToken.startLine;
+ source = asString(funDecl);
+ } else if (AST::VariableStatement *varStmt = AST::cast<AST::VariableStatement *>(node->sourceElement)) {
+ // ignore variable declarations
+ line = varStmt->declarationKindToken.startLine;
+ }
+
+ Value *value = new Value;
+ value->primitive = source;
+ value->line = line;
+
+ obj->getDefaultProperty()->addValue(value);
+
+ return false;
+}
+
+} // end of anonymous namespace
+
+
+QmlScriptParser::QmlScriptParser()
+ : root(0), _errorLine(-1)
+{
+
+}
+
+QmlScriptParser::~QmlScriptParser()
+{
+}
+
+bool QmlScriptParser::parse(const QByteArray &data, const QUrl &url)
+{
+ if (QmlComponentPrivate::isXml(data)) {
+ // parse using the XML parser.
+ QmlXmlParser xmlParser;
+ if (xmlParser.parse(data, url)) {
+ _nameSpacePaths = xmlParser.nameSpacePaths();
+ root = xmlParser.takeTree();
+ _typeNames = xmlParser.types();
+ return true;
+ }
+
+ _error = xmlParser.errorDescription();
+ _errorLine = 0; // ### FIXME
+ return false;
+ }
+
+ const QString fileName = url.toString();
+ const QString code = QString::fromUtf8(data); // ### FIXME
+
+ JavaScriptParser parser;
+ JavaScriptEnginePrivate driver;
+
+ NodePool nodePool(fileName, &driver);
+ driver.setNodePool(&nodePool);
+
+ Lexer lexer(&driver);
+ lexer.setCode(code, /*line = */ 1);
+ driver.setLexer(&lexer);
+
+ if (! parser.parse(&driver)) {
+ _error = parser.errorMessage();
+ _errorLine = parser.errorLineNumber();
+ return false;
+ }
+
+ ProcessAST process(this);
+ process(code, parser.ast());
+
+ return true;
+}
+
+QString QmlScriptParser::errorDescription() const
+{
+ return _error;
+}
+
+int QmlScriptParser::errorLine() const
+{
+ return _errorLine;
+}
+
+QMap<QString,QString> QmlScriptParser::nameSpacePaths() const
+{
+ return _nameSpacePaths;
+}
+
+QStringList QmlScriptParser::types() const
+{
+ return _typeNames;
+}
+
+Object *QmlScriptParser::tree() const
+{
+ return root;
+}
+
+void QmlScriptParser::clear()
+{
+ if (root) {
+ root->release();
+ root = 0;
+ }
+ _nameSpacePaths.clear();
+ _typeNames.clear();
+ _error.clear();
+ _scriptFile.clear();
+ _errorLine = 0;
+}
+
+int QmlScriptParser::findOrCreateTypeId(const QString &name)
+{
+ int index = _typeNames.indexOf(name);
+
+ if (index == -1) {
+ index = _typeNames.size();
+ _typeNames.append(name);
+ }
+
+ return index;
+}
+
+void QmlScriptParser::setTree(Object *tree)
+{
+ Q_ASSERT(! root);
+
+ root = tree;
+}
+
+void QmlScriptParser::addNamespacePath(const QString &path)
+{
+ _nameSpacePaths.insertMulti(QString(), path);
+}
+
+
+QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlscriptparser_p.h b/src/declarative/qml/qmlscriptparser_p.h
new file mode 100644
index 0000000..0d89268
--- /dev/null
+++ b/src/declarative/qml/qmlscriptparser_p.h
@@ -0,0 +1,57 @@
+#ifndef QMLSCRIPTPARSER_P_H
+#define QMLSCRIPTPARSER_P_H
+
+#include <QtCore/QList>
+#include <QtCore/QUrl>
+#include <qml.h>
+
+QT_BEGIN_HEADER
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Declarative)
+
+namespace QmlParser {
+ class Object;
+}
+
+class QByteArray;
+
+class QmlScriptParser
+{
+public:
+ QmlScriptParser();
+ ~QmlScriptParser();
+
+ bool parse(const QByteArray &data, const QUrl &url = QUrl());
+ QString errorDescription() const;
+ int errorLine() const;
+
+ QMap<QString,QString> nameSpacePaths() const;
+ QStringList types() const;
+
+ QmlParser::Object *tree() const;
+
+ void clear();
+
+// ### private:
+ int findOrCreateTypeId(const QString &name);
+ void setTree(QmlParser::Object *tree);
+
+ void setScriptFile(const QString &filename) {_scriptFile = filename; }
+ QString scriptFile() const { return _scriptFile; }
+
+ void addNamespacePath(const QString &path);
+
+private:
+ QMap<QString,QString> _nameSpacePaths;
+ QmlParser::Object *root;
+ QStringList _typeNames;
+ QString _error;
+ int _errorLine;
+ QString _scriptFile;
+};
+
+QT_END_NAMESPACE
+QT_END_HEADER
+
+#endif // QMLSCRIPTPARSER_P_H
diff --git a/src/declarative/qml/qmlstringconverters.cpp b/src/declarative/qml/qmlstringconverters.cpp
index 82d6eee..c1f4b8c 100644
--- a/src/declarative/qml/qmlstringconverters.cpp
+++ b/src/declarative/qml/qmlstringconverters.cpp
@@ -51,18 +51,18 @@ QT_BEGIN_NAMESPACE
static uchar fromHex(const uchar c, const uchar c2)
{
uchar rv = 0;
- if(c >= '0' && c <= '9')
+ if (c >= '0' && c <= '9')
rv += (c - '0') * 16;
- else if(c >= 'A' && c <= 'F')
+ else if (c >= 'A' && c <= 'F')
rv += (c - 'A' + 10) * 16;
- else if(c >= 'a' && c <= 'f')
+ else if (c >= 'a' && c <= 'f')
rv += (c - 'a' + 10) * 16;
- if(c2 >= '0' && c2 <= '9')
+ if (c2 >= '0' && c2 <= '9')
rv += (c2 - '0');
- else if(c2 >= 'A' && c2 <= 'F')
+ else if (c2 >= 'A' && c2 <= 'F')
rv += (c2 - 'A' + 10);
- else if(c2 >= 'a' && c2 <= 'f')
+ else if (c2 >= 'a' && c2 <= 'f')
rv += (c2 - 'a' + 10);
return rv;
@@ -77,41 +77,41 @@ static uchar fromHex(const QString &s, int idx)
QVariant QmlStringConverters::variantFromString(const QString &s)
{
- if(s.isEmpty())
+ if (s.isEmpty())
return QVariant(s);
- if(s.startsWith(QLatin1Char('\'')) && s.endsWith(QLatin1Char('\''))) {
+ if (s.startsWith(QLatin1Char('\'')) && s.endsWith(QLatin1Char('\''))) {
QString data = s.mid(1, s.length() - 2);
return QVariant(data);
}
bool ok = false;
QRectF r = rectFFromString(s, &ok);
- if(ok) return QVariant(r);
+ if (ok) return QVariant(r);
QColor c = colorFromString(s, &ok);
- if(ok) return QVariant(c);
+ if (ok) return QVariant(c);
QPointF p = pointFFromString(s, &ok);
- if(ok) return QVariant(p);
+ if (ok) return QVariant(p);
QSizeF sz = sizeFFromString(s, &ok);
- if(ok) return QVariant(sz);
+ if (ok) return QVariant(sz);
bool b = boolFromString(s, &ok);
- if(ok) return QVariant(b);
+ if (ok) return QVariant(b);
return QVariant(s);
}
QColor QmlStringConverters::colorFromString(const QString &s, bool *ok)
{
- if(s.startsWith(QLatin1Char('#')) && s.length() == 9) {
+ if (s.startsWith(QLatin1Char('#')) && s.length() == 9) {
uchar a = fromHex(s, 1);
uchar r = fromHex(s, 3);
uchar g = fromHex(s, 5);
uchar b = fromHex(s, 7);
- if(ok) *ok = true;
+ if (ok) *ok = true;
return QColor(r, g, b, a);
} else {
QColor rv;
- if(s.startsWith(QLatin1Char('#')) || QColor::colorNames().contains(s.toLower()))
+ if (s.startsWith(QLatin1Char('#')) || QColor::colorNames().contains(s.toLower()))
rv = QColor(s);
- if(ok) *ok = rv.isValid();
+ if (ok) *ok = rv.isValid();
return rv;
}
}
diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp
index 62a0864..253e9a7 100644
--- a/src/declarative/qml/qmlvme.cpp
+++ b/src/declarative/qml/qmlvme.cpp
@@ -224,13 +224,13 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QStack<QmlMetaProperty> pushedProperties;
QObject **savedObjects = 0;
- if(start == -1) start = 0;
- if(count == -1) count = comp->bytecode.count();
+ if (start == -1) start = 0;
+ if (count == -1) count = comp->bytecode.count();
- for(int ii = start; !isError() && ii < (start + count); ++ii) {
+ for (int ii = start; !isError() && ii < (start + count); ++ii) {
QmlInstruction &instr = comp->bytecode[ii];
- if(instr.type >= QmlInstruction::StoreInstructionsStart &&
+ if (instr.type >= QmlInstruction::StoreInstructionsStart &&
instr.type <= QmlInstruction::StoreInstructionsEnd) {
runStoreInstruction(stack, instr, comp);
@@ -240,7 +240,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
switch(instr.type) {
case QmlInstruction::Init:
{
- if(instr.init.dataSize) {
+ if (instr.init.dataSize) {
savedObjects = new QObject*[instr.init.dataSize];
::memset(savedObjects, 0,
sizeof(QObject *)*instr.init.dataSize);
@@ -254,10 +254,10 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QFxCompilerTimer<QFxCompiler::InstrCreateObject> cc;
#endif
QObject *o = types.at(instr.create.type).createInstance(QmlContext::activeContext());
- if(!o)
+ if (!o)
VME_EXCEPTION("Unable to create object of type" << types.at(instr.create.type).className);
- if(!stack.isEmpty()) {
+ if (!stack.isEmpty()) {
QObject *parent = stack.top();
o->setParent(parent);
}
@@ -274,11 +274,11 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
types.at(instr.createCustom.type).parser->create(datas.at(instr.createCustom.data));
// XXX
QObject *o = QmlMetaType::toQObject(v);
- if(!o)
+ if (!o)
VME_EXCEPTION("Unable to create" << types.at(instr.create.type).className);
QmlEngine::setContextForObject(o, QmlContext::activeContext());
- if(!stack.isEmpty()) {
+ if (!stack.isEmpty()) {
QObject *parent = stack.top();
o->setParent(parent);
}
@@ -296,7 +296,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QmlContext::activeContext();
ctxt->setContextProperty(primitives.at(instr.setId.value), target);
- if(instr.setId.save != -1)
+ if (instr.setId.save != -1)
savedObjects[instr.setId.save] = target;
}
break;
@@ -365,14 +365,14 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
const QByteArray &pr = datas.at(sigIdx);
QmlMetaProperty prop(target, QLatin1String(pr));
- if(prop.type() & QmlMetaProperty::SignalProperty) {
+ if (prop.type() & QmlMetaProperty::SignalProperty) {
int coreIdx = prop.coreIndex();
int primRef = instr.assignSignal.value;
instr.type = QmlInstruction::StoreSignal;
instr.storeSignal.signalIndex = coreIdx;
instr.storeSignal.value = primRef;
--ii;
- } else if(prop.type() & QmlMetaProperty::Property) {
+ } else if (prop.type() & QmlMetaProperty::Property) {
int prop = sigIdx;
int primRef = instr.assignSignal.value;
instr.type = QmlInstruction::AssignConstant;
@@ -398,18 +398,18 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
const QByteArray &pr = datas.at(sigIdx);
QmlMetaProperty prop(target, QLatin1String(pr));
- if(prop.type() & QmlMetaProperty::SignalProperty) {
+ if (prop.type() & QmlMetaProperty::SignalProperty) {
QMetaMethod method = QmlMetaType::defaultMethod(assign);
- if(method.signature() == 0)
+ if (method.signature() == 0)
VME_EXCEPTION("Cannot assign object type" << assign->metaObject()->className() << "with no default method");
- if(!QMetaObject::checkConnectArgs(prop.method().signature(), method.signature()))
+ if (!QMetaObject::checkConnectArgs(prop.method().signature(), method.signature()))
VME_EXCEPTION("Cannot connect mismatched signal/slot" << method.signature() << prop.method().signature());
QMetaObject::connect(target, prop.coreIndex(), assign, method.methodIndex());
- } else if(prop.type() & QmlMetaProperty::Property) {
+ } else if (prop.type() & QmlMetaProperty::Property) {
instr.type = QmlInstruction::AssignObject;
instr.assignObject.castValue = 0;
instr.assignObject.property = sigIdx;
@@ -432,7 +432,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QMetaMethod signal =
target->metaObject()->method(instr.storeSignal.signalIndex);
- if(signal.parameterTypes().isEmpty()) {
+ if (signal.parameterTypes().isEmpty()) {
(void *)new QmlBoundSignal(QmlContext::activeContext(), primitives.at(instr.storeSignal.value), target, instr.storeSignal.signalIndex, target);
} else {
(void *)new QmlBoundSignalProxy(new QmlContext(QmlContext::activeContext(), target), primitives.at(instr.storeSignal.value), target, instr.storeSignal.signalIndex, target);
@@ -450,9 +450,9 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
int propIdx = instr.assignConstant.property;
int idx = instr.assignConstant.constant;
QByteArray pr;
- if(propIdx == -1) {
+ if (propIdx == -1) {
pr = QmlMetaType::defaultProperty(target).name();
- if(pr.isEmpty())
+ if (pr.isEmpty())
VME_EXCEPTION("Cannot resolve defalt property on type" << target->metaObject()->className());
} else {
pr = datas.at(propIdx);
@@ -460,14 +460,14 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
int coreIdx = qIndexOfProperty(target, pr);
- if(coreIdx != -1) {
+ if (coreIdx != -1) {
QMetaProperty prop =
target->metaObject()->property(coreIdx);
bool replace = !prop.isDynamic();
QmlInstruction *writeInstr = 0;
QmlInstruction dummy;
- if(replace) {
+ if (replace) {
writeInstr = &instr;
} else {
writeInstr = &dummy;
@@ -476,8 +476,8 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QmlCompiler::StoreInstructionResult r = QmlCompiler::generateStoreInstruction(*comp, *writeInstr, prop,
coreIdx, idx, &primitives.at(idx));
- if(r != QmlCompiler::Ok) {
- if(prop.isEnumType()){
+ if (r != QmlCompiler::Ok) {
+ if (prop.isEnumType()){
VME_EXCEPTION(primitives.at(idx) << "is not a valid enumeration value");
} else if (r == QmlCompiler::UnknownType) {
VME_EXCEPTION("Property" << prop.name() << "is of an unknown type");
@@ -507,7 +507,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QmlParserStatus *status =
qobject_cast<QmlParserStatus *>(target);
- if(status) {
+ if (status) {
instr.type = QmlInstruction::BeginObject;
instr.begin.castValue = int(reinterpret_cast<char *>(status) - reinterpret_cast<char *>(target));
--ii;
@@ -538,7 +538,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QmlParserStatus *status =
qobject_cast<QmlParserStatus *>(target);
- if(status) {
+ if (status) {
instr.type = QmlInstruction::CompleteObject;
instr.complete.castValue = int(reinterpret_cast<char *>(status) - reinterpret_cast<char *>(target));
--ii;
@@ -570,10 +570,10 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
int idx = qIndexOfProperty(target, pr);
// XXX - need to check if the type is QmlBindableValue*
- if(idx == -1) {
+ if (idx == -1) {
VME_EXCEPTION("Unknown property" << pr);
} else {
- if(QmlInstruction::AssignCompiledBinding == instr.type)
+ if (QmlInstruction::AssignCompiledBinding == instr.type)
instr.type = QmlInstruction::StoreCompiledBinding;
else
instr.type = QmlInstruction::StoreBinding;
@@ -589,16 +589,16 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QObject *target = stack.at(stack.count() - 2);
int propIdx = instr.assignValueSource.property;
QByteArray pr;
- if(propIdx == -1) {
+ if (propIdx == -1) {
pr = QmlMetaType::defaultProperty(target).name();
- if(pr.isEmpty())
+ if (pr.isEmpty())
VME_EXCEPTION("Unable to resolve default property");
} else {
pr = datas.at(propIdx);
}
int coreIdx = qIndexOfProperty(target, pr);
- if(coreIdx != -1) {
+ if (coreIdx != -1) {
instr.type = QmlInstruction::StoreValueSource;
instr.assignValueSource.property = coreIdx;
ii--;
@@ -685,18 +685,18 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
#endif
QObject *assign = stack.pop();
const ListInstance &list = qliststack.top();
- if(list.qmlListInterface) {
+ if (list.qmlListInterface) {
int type = list.type;
void *d = 0;
void *ptr = 0;
bool found = false;
- if(QmlMetaType::isInterface(type)) {
+ if (QmlMetaType::isInterface(type)) {
const char *iid = QmlMetaType::interfaceIId(type);
- if(iid)
+ if (iid)
ptr = assign->qt_metacast(iid);
- if(ptr) {
+ if (ptr) {
d = &ptr;
found = true;
}
@@ -706,7 +706,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
const QMetaObject *assignMo = assign->metaObject();
while(!found && assignMo) {
- if(assignMo == mo)
+ if (assignMo == mo)
found = true;
else
assignMo = assignMo->superClass();
@@ -718,7 +718,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
}
- if(!found)
+ if (!found)
VME_EXCEPTION("Cannot assign object to list");
list.qmlListInterface->append(d);
@@ -726,10 +726,10 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
} else {
int type = list.type;
- if(QmlMetaType::isInterface(type)) {
+ if (QmlMetaType::isInterface(type)) {
void *ptr = 0;
const char *iid = QmlMetaType::interfaceIId(type);
- if(iid)
+ if (iid)
ptr = assign->qt_metacast(iid);
QVariant v(list.type, &ptr);
QmlMetaType::append(list.list, v);
@@ -750,7 +750,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QObject *target = stack.top();
QByteArray property;
- if(instr.assignObject.property == -1) {
+ if (instr.assignObject.property == -1) {
// XXX - optimize!
property =
QmlMetaType::defaultProperty(target).name();
@@ -760,17 +760,17 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
int coreIdx = qIndexOfProperty(target, property);
- if(coreIdx != -1) {
+ if (coreIdx != -1) {
QMetaProperty prop =
target->metaObject()->property(coreIdx);
int t = prop.userType();
// XXX - optimize!
- if(QmlMetaType::isList(t)) {
+ if (QmlMetaType::isList(t)) {
QVariant list = prop.read(target);
int listtype = QmlMetaType::listType(t);
QVariant v = QmlMetaType::fromObject(assign, listtype);
QmlMetaType::append(list, v);
- } else if(QmlMetaType::isQmlList(t)) {
+ } else if (QmlMetaType::isQmlList(t)) {
// XXX - optimize!
QVariant list = prop.read(target);
@@ -785,13 +785,13 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
const QMetaObject *assignMo = assign->metaObject();
bool found = false;
while(!found && assignMo) {
- if(assignMo == mo)
+ if (assignMo == mo)
found = true;
else
assignMo = assignMo->superClass();
}
- if(!found)
+ if (!found)
VME_EXCEPTION("Cannot assign object to list");
// NOTE: This assumes a cast to QObject does not alter
@@ -799,12 +799,12 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
void *d = (void *)&assign;
li->append(d);
- } else if(QmlMetaType::isInterface(t)) {
+ } else if (QmlMetaType::isInterface(t)) {
const char *iid = QmlMetaType::interfaceIId(t);
bool ok = false;
- if(iid) {
+ if (iid) {
void *ptr = assign->qt_metacast(iid);
- if(ptr) {
+ if (ptr) {
void *a[1];
a[0] = &ptr;
QMetaObject::metacall(target, QMetaObject::WriteProperty,
@@ -813,10 +813,10 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
}
}
- if(!ok)
+ if (!ok)
VME_EXCEPTION("Cannot assign object to interface property" << property);
- } else if(prop.userType() == -1 /* means qvariant */) {
+ } else if (prop.userType() == -1 /* means qvariant */) {
prop.write(target, qVariantFromValue(assign));
} else {
const QMetaObject *propmo =
@@ -831,11 +831,11 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
c = c->superClass();
}
- if(isAssignable) {
+ if (isAssignable) {
// XXX - optimize!
QVariant v = QmlMetaType::fromObject(assign, t);
prop.write(target, v);
- } else if(isPropertyValue) {
+ } else if (isPropertyValue) {
QmlPropertyValueSource *vs =
static_cast<QmlPropertyValueSource *>(assign);
vs->setParent(target);
@@ -862,7 +862,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QObject *qmlObject = qmlAttachedPropertiesObjectById(instr.fetchAttached.id, target);
- if(!qmlObject)
+ if (!qmlObject)
VME_EXCEPTION("Unable to create attached object");
stack.push(qmlObject);
@@ -883,7 +883,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
a[0] = &list;
QMetaObject::metacall(target, QMetaObject::ReadProperty,
instr.fetchQmlList.property, a);
- if(!list)
+ if (!list)
VME_EXCEPTION("Cannot assign to null list");
qliststack.push(ListInstance(list, instr.fetchQmlList.type));
@@ -911,14 +911,14 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QObject *target = stack.top();
const QByteArray &pr = datas.at(instr.fetch.property);
int idx = qIndexOfProperty(target, pr);
- if(idx == -1)
+ if (idx == -1)
VME_EXCEPTION("Cannot resolve property" << pr);
QMetaProperty prop = target->metaObject()->property(idx);
instr.type = QmlInstruction::FetchObject;
instr.fetch.property = idx;
- if(QmlMetaType::isObject(prop.userType())) {
+ if (QmlMetaType::isObject(prop.userType())) {
instr.fetch.isObject = true;
- } else if(prop.userType() == -1) {
+ } else if (prop.userType() == -1) {
instr.fetch.isObject = false;
} else {
VME_EXCEPTION("Cannot set properties on" << prop.name() << "as it is of unknown type");
@@ -935,7 +935,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QObject *target = stack.top();
QObject *obj = 0;
- if(instr.fetch.isObject) {
+ if (instr.fetch.isObject) {
// NOTE: This assumes a cast to QObject does not alter the
// object pointer
void *a[1];
@@ -952,7 +952,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
}
- if(!obj)
+ if (!obj)
VME_EXCEPTION("Cannot set properties on" << target->metaObject()->property(instr.fetch.property).name() << "as it is null");
stack.push(obj);
@@ -994,13 +994,13 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
bool found = false;
while(!found && assignMo) {
- if(assignMo == mo)
+ if (assignMo == mo)
found = true;
else
assignMo = assignMo->superClass();
}
- if(!found)
+ if (!found)
VME_EXCEPTION("Unable to assign object");
instr.type = QmlInstruction::StoreStackObject;
@@ -1042,8 +1042,8 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
}
}
- if(isError()) {
- if(!stack.isEmpty()) {
+ if (isError()) {
+ if (!stack.isEmpty()) {
delete stack.at(0);
}
return 0;
@@ -1055,10 +1055,10 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
comp->dumpPost();
- if(savedObjects)
+ if (savedObjects)
delete [] savedObjects;
- if(stack.isEmpty())
+ if (stack.isEmpty())
return 0;
else
return stack.top();
diff --git a/src/declarative/qml/qmlvmemetaobject.cpp b/src/declarative/qml/qmlvmemetaobject.cpp
index 2b1060b..f7d2635 100644
--- a/src/declarative/qml/qmlvmemetaobject.cpp
+++ b/src/declarative/qml/qmlvmemetaobject.cpp
@@ -52,7 +52,7 @@ QmlVMEMetaObject::QmlVMEMetaObject(QObject *obj,
QmlRefCount *rc)
: object(obj), ref(rc)
{
- if(ref)
+ if (ref)
ref->addref();
*static_cast<QMetaObject *>(this) = *other;
@@ -64,9 +64,9 @@ QmlVMEMetaObject::QmlVMEMetaObject(QObject *obj,
data = new QVariant[propertyCount() - baseProp];
vTypes.resize(propertyCount() - baseProp);
- for(int ii = baseProp; ii < propertyCount(); ++ii) {
+ for (int ii = baseProp; ii < propertyCount(); ++ii) {
QMetaProperty prop = property(ii);
- if((int)prop.type() != -1) {
+ if ((int)prop.type() != -1) {
data[ii - baseProp] = QVariant((QVariant::Type)prop.userType());
} else {
vTypes.setBit(ii - baseProp, true);
@@ -76,27 +76,27 @@ QmlVMEMetaObject::QmlVMEMetaObject(QObject *obj,
QmlVMEMetaObject::~QmlVMEMetaObject()
{
- if(ref)
+ if (ref)
ref->release();
delete [] data;
}
int QmlVMEMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
{
- if(id >= baseProp) {
+ if (id >= baseProp) {
int propId = id - baseProp;
bool needActivate = false;
- if(vTypes.testBit(propId)) {
- if(c == QMetaObject::ReadProperty) {
+ if (vTypes.testBit(propId)) {
+ if (c == QMetaObject::ReadProperty) {
*reinterpret_cast<QVariant *>(a[0]) = data[propId];
- } else if(c == QMetaObject::WriteProperty) {
+ } else if (c == QMetaObject::WriteProperty) {
needActivate =
(data[propId] != *reinterpret_cast<QVariant *>(a[0]));
data[propId] = *reinterpret_cast<QVariant *>(a[0]);
}
} else {
- if(c == QMetaObject::ReadProperty) {
+ if (c == QMetaObject::ReadProperty) {
switch(data[propId].type()) {
case QVariant::Int:
*reinterpret_cast<int *>(a[0]) = data[propId].toInt();
@@ -120,7 +120,7 @@ int QmlVMEMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
qFatal("Unknown type");
break;
}
- } else if(c == QMetaObject::WriteProperty) {
+ } else if (c == QMetaObject::WriteProperty) {
QVariant value = QVariant((QVariant::Type)data[propId].type(), a[0]);
needActivate = (data[propId] != value);
@@ -128,7 +128,7 @@ int QmlVMEMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
}
}
- if(c == QMetaObject::WriteProperty && needActivate) {
+ if (c == QMetaObject::WriteProperty && needActivate) {
activate(object, baseSig + propId, 0);
}
diff --git a/src/declarative/qml/qmlxmlparser.cpp b/src/declarative/qml/qmlxmlparser.cpp
index f001bda..b3565a0 100644
--- a/src/declarative/qml/qmlxmlparser.cpp
+++ b/src/declarative/qml/qmlxmlparser.cpp
@@ -70,7 +70,7 @@ struct QmlXmlParserStateStack : public QStack<QmlXmlParserState>
void pushProperty(const QString &name, int lineNumber)
{
const QmlXmlParserState &state = top();
- if(state.property) {
+ if (state.property) {
QmlXmlParserState s(state.property->getValue(),
state.property->getValue()->getProperty(name.toLatin1()));
s.property->line = lineNumber;
@@ -86,7 +86,7 @@ struct QmlXmlParserStateStack : public QStack<QmlXmlParserState>
QmlXmlParser::~QmlXmlParser()
{
- if(root)
+ if (root)
root->release();
}
@@ -189,7 +189,7 @@ bool QmlXmlParser::parse(const QByteArray &data, const QUrl &url)
if (isType) {
// Class
int typeId = _typeNames.indexOf(qualifiedname);
- if(typeId == -1) {
+ if (typeId == -1) {
typeId = _typeNames.count();
_typeNames.append(qualifiedname);
}
@@ -214,7 +214,7 @@ bool QmlXmlParser::parse(const QByteArray &data, const QUrl &url)
}
- if(!root) {
+ if (!root) {
root = obj;
states.pushObject(obj);
} else {
@@ -222,7 +222,7 @@ bool QmlXmlParser::parse(const QByteArray &data, const QUrl &url)
Value *v = new Value;
v->object = obj;
v->line = line;
- if(state.property)
+ if (state.property)
state.property->addValue(v);
else
state.object->getDefaultProperty()->addValue(v);
@@ -235,7 +235,7 @@ bool QmlXmlParser::parse(const QByteArray &data, const QUrl &url)
break;
}
QStringList str = name.split(QLatin1Char('.'));
- for(int ii = 0; ii < str.count(); ++ii) {
+ for (int ii = 0; ii < str.count(); ++ii) {
QString s = str.at(ii);
states.pushProperty(s, line);
}
@@ -253,7 +253,7 @@ bool QmlXmlParser::parse(const QByteArray &data, const QUrl &url)
foreach(QXmlStreamAttribute attr, attrs) {
QStringList str = attr.name().toString().split(QLatin1Char('.'));
- for(int ii = 0; ii < str.count(); ++ii) {
+ for (int ii = 0; ii < str.count(); ++ii) {
QString s = str.at(ii);
states.pushProperty(s, line);
}
@@ -264,7 +264,7 @@ bool QmlXmlParser::parse(const QByteArray &data, const QUrl &url)
v->line = reader.lineNumber();
state.property->addValue(v);
- for(int ii = str.count() - 1; ii >= 0; --ii)
+ for (int ii = str.count() - 1; ii >= 0; --ii)
states.pop();
}
}
@@ -280,24 +280,24 @@ bool QmlXmlParser::parse(const QByteArray &data, const QUrl &url)
{
QString name = reader.name().toString();
Q_ASSERT(!name.isEmpty());
- if(name.at(0).isUpper() && !name.contains(QLatin1Char('.'))) {
+ if (name.at(0).isUpper() && !name.contains(QLatin1Char('.'))) {
// Class
states.pop();
} else {
// Property
QStringList str = name.split(QLatin1Char('.'));
- for(int ii = 0; ii < str.count(); ++ii)
+ for (int ii = 0; ii < str.count(); ++ii)
states.pop();
}
}
break;
case QXmlStreamReader::Characters:
- if(!reader.isWhitespace()) {
+ if (!reader.isWhitespace()) {
const QmlXmlParserState &state = states.top();
Value *v = new Value;
v->primitive = reader.text().toString();
v->line = reader.lineNumber();
- if(state.property)
+ if (state.property)
state.property->addValue(v);
else
state.object->getDefaultProperty()->addValue(v);
@@ -309,11 +309,11 @@ bool QmlXmlParser::parse(const QByteArray &data, const QUrl &url)
case QXmlStreamReader::EntityReference:
break;
case QXmlStreamReader::ProcessingInstruction:
- if(reader.processingInstructionTarget() == QLatin1String("qtfx")) {
+ if (reader.processingInstructionTarget() == QLatin1String("qtfx")) {
QString str = reader.processingInstructionData().toString();
QString token, data;
int idx = str.indexOf(QLatin1Char(':'));
- if(-1 != idx) {
+ if (-1 != idx) {
token = str.left(idx);
data = str.mid(idx + 1);
} else {
@@ -324,7 +324,7 @@ bool QmlXmlParser::parse(const QByteArray &data, const QUrl &url)
// <?qtfx namespacepath: namespace=path>
- if(token == QLatin1String("namespacepath")) {
+ if (token == QLatin1String("namespacepath")) {
int eq=data.indexOf(QLatin1Char('='));
if (eq>=0) {
_nameSpacePaths.insertMulti(data.left(eq),data.mid(eq+1));
@@ -338,7 +338,7 @@ bool QmlXmlParser::parse(const QByteArray &data, const QUrl &url)
}
}
- if(reader.hasError()) {
+ if (reader.hasError()) {
if (root) {
root->release();
root = 0;
@@ -365,6 +365,13 @@ QmlParser::Object *QmlXmlParser::tree() const
return root;
}
+QmlParser::Object *QmlXmlParser::takeTree()
+{
+ QmlParser::Object *r = root;
+ root = 0;
+ return r;
+}
+
QString QmlXmlParser::errorDescription() const
{
return _error;
@@ -372,7 +379,7 @@ QString QmlXmlParser::errorDescription() const
void QmlXmlParser::clear()
{
- if(root) {
+ if (root) {
root->release();
root = 0;
}
diff --git a/src/declarative/qml/qmlxmlparser_p.h b/src/declarative/qml/qmlxmlparser_p.h
index 3680172..9b45e28 100644
--- a/src/declarative/qml/qmlxmlparser_p.h
+++ b/src/declarative/qml/qmlxmlparser_p.h
@@ -70,6 +70,7 @@ public:
QStringList types() const;
QmlParser::Object *tree() const;
+ QmlParser::Object *takeTree();
void clear();
@@ -80,9 +81,9 @@ private:
QString _error;
};
-#endif // QMLXMLPARSER_P_H
-
-
QT_END_NAMESPACE
QT_END_HEADER
+
+#endif // QMLXMLPARSER_P_H
+
diff --git a/src/declarative/qml/script/generator/main.cpp b/src/declarative/qml/script/generator/main.cpp
index 676671f..a841cbc 100644
--- a/src/declarative/qml/script/generator/main.cpp
+++ b/src/declarative/qml/script/generator/main.cpp
@@ -72,7 +72,7 @@ void newState(QList<State> &states, const char *token, const char *lexem)
while(*lexem) {
int next = states[state].next[(int)*lexem];
- if(!next) {
+ if (!next) {
next = states.size();
states += State(character?"CHARACTER":"INCOMPLETE");
states[state].next[(int)*lexem] = next;
@@ -89,7 +89,7 @@ void newState(QList<State> &states, const char *token, const char *lexem)
void newState(QList<State> &states, const char *token, char lexem)
{
int next = states[0].next[(int)lexem];
- if(!next) {
+ if (!next) {
next = states.size();
states += State(token);
states[0].next[(int)lexem] = next;
@@ -111,11 +111,11 @@ int main()
newState(states, "CHARACTER", '_');
// add digits
- for(int cc = '0'; cc <= '9'; ++cc)
+ for (int cc = '0'; cc <= '9'; ++cc)
newState(states, "DIGIT", cc);
// keywords
- for(int ii = 0; keywords[ii].lexem; ++ii)
+ for (int ii = 0; keywords[ii].lexem; ++ii)
newState(states, keywords[ii].token, keywords[ii].lexem);
::printf("static const struct\n{\n"
@@ -123,9 +123,9 @@ int main()
" char next[128];\n"
"} keywords[] = {\n");
- for(int ii = 0; ii < states.size(); ++ii) {
+ for (int ii = 0; ii < states.size(); ++ii) {
printf("%s { %s, { ", ii?",\n":"", states[ii].token.data());
- for(int jj = 0; jj < 128; jj++)
+ for (int jj = 0; jj < 128; jj++)
printf("%s%d", jj?",":"", states[ii].next[jj]);
printf(" } }");
}
diff --git a/src/declarative/qml/script/qmlbasicscript.cpp b/src/declarative/qml/script/qmlbasicscript.cpp
index 4f40016..8b38e08 100644
--- a/src/declarative/qml/script/qmlbasicscript.cpp
+++ b/src/declarative/qml/script/qmlbasicscript.cpp
@@ -48,7 +48,7 @@ public:
static unsigned int alignRound(int s)
{
- if(s % 4)
+ if (s % 4)
s += 4 - (s % 4);
return s;
}
@@ -171,7 +171,7 @@ static QVariant fetch_value(QObject *o, int idx, int type)
break;
default:
{
- if(QmlMetaType::isObject(type)) {
+ if (QmlMetaType::isObject(type)) {
// NOTE: This assumes a cast to QObject does not alter the
// object pointer
QObject *val = 0;
@@ -180,7 +180,7 @@ static QVariant fetch_value(QObject *o, int idx, int type)
return QVariant::fromValue(val);
} else {
QVariant var = o->metaObject()->property(idx).read(o);
- if(QmlMetaType::isObject(var.userType())) {
+ if (QmlMetaType::isObject(var.userType())) {
QObject *obj = 0;
obj = *(QObject **)var.data();
var = QVariant::fromValue(obj);
@@ -299,7 +299,7 @@ QmlBasicScript::QmlBasicScript()
QmlBasicScript::QmlBasicScript(const char *data, QmlRefCount *owner)
: flags(0), d((QmlBasicScriptPrivate *)data), rc(owner)
{
- if(rc) rc->addref();
+ if (rc) rc->addref();
}
/*!
@@ -307,7 +307,7 @@ QmlBasicScript::QmlBasicScript(const char *data, QmlRefCount *owner)
*/
QByteArray QmlBasicScript::expression() const
{
- if(!d)
+ if (!d)
return QByteArray();
else
return QByteArray(d->expr());
@@ -318,9 +318,9 @@ QByteArray QmlBasicScript::expression() const
*/
QmlBasicScript::~QmlBasicScript()
{
- if(flags & QmlBasicScriptPrivate::OwnData)
+ if (flags & QmlBasicScriptPrivate::OwnData)
free(d);
- if(rc) rc->release();
+ if (rc) rc->release();
d = 0;
rc = 0;
}
@@ -331,9 +331,9 @@ QmlBasicScript::~QmlBasicScript()
*/
void QmlBasicScript::clear()
{
- if(flags & QmlBasicScriptPrivate::OwnData)
+ if (flags & QmlBasicScriptPrivate::OwnData)
free(d);
- if(rc) rc->release();
+ if (rc) rc->release();
d = 0;
rc = 0;
flags = 0;
@@ -345,7 +345,7 @@ void QmlBasicScript::clear()
*/
void *QmlBasicScript::newScriptState()
{
- if(!d) {
+ if (!d) {
return 0;
} else {
void *rv = ::malloc(d->stateSize * sizeof(QmlBasicScriptNodeCache));
@@ -359,7 +359,7 @@ void *QmlBasicScript::newScriptState()
*/
void QmlBasicScript::deleteScriptState(void *data)
{
- if(!data) return;
+ if (!data) return;
Q_ASSERT(d);
clearCache(data);
free(data);
@@ -370,12 +370,12 @@ void QmlBasicScript::deleteScriptState(void *data)
*/
void QmlBasicScript::dump()
{
- if(!d)
+ if (!d)
return;
qWarning() << d->instructionCount << "instructions:";
const char *data = d->data();
- for(int ii = 0; ii < d->instructionCount; ++ii) {
+ for (int ii = 0; ii < d->instructionCount; ++ii) {
const ScriptInstruction &instr = d->instructions()[ii];
switch(instr.type) {
@@ -438,7 +438,7 @@ bool QmlBasicScript::compile(const QByteArray &src)
*/
bool QmlBasicScript::compile(const char *src)
{
- if(!src) return false;
+ if (!src) return false;
QmlBasicScriptCompiler bsc;
bsc.script = this;
@@ -446,14 +446,14 @@ bool QmlBasicScript::compile(const char *src)
bsc.src = src;
// dumpTokens(src, bsc.tokens);
- if(d) {
- if(flags & QmlBasicScriptPrivate::OwnData)
+ if (d) {
+ if (flags & QmlBasicScriptPrivate::OwnData)
free(d);
d = 0;
flags = 0;
}
- if(bsc.compile()) {
+ if (bsc.compile()) {
int len = ::strlen(src);
flags = QmlBasicScriptPrivate::OwnData;
int size = sizeof(QmlBasicScriptPrivate) +
@@ -465,7 +465,7 @@ bool QmlBasicScript::compile(const char *src)
d->instructionCount = bsc.bytecode.count();
d->exprLen = len;
::memcpy((char *)d->expr(), src, len + 1);
- for(int ii = 0; ii < d->instructionCount; ++ii)
+ for (int ii = 0; ii < d->instructionCount; ++ii)
d->instructions()[ii] = bsc.bytecode.at(ii);
::memcpy((char *)d->data(), bsc.data.constData(), bsc.data.count());
}
@@ -481,21 +481,21 @@ void QmlBasicScriptCompiler::skipWhitespace()
bool QmlBasicScriptCompiler::compile()
{
- if(!compileExpr())
+ if (!compileExpr())
return false;
skipWhitespace();
- if(atEnd())
+ if (atEnd())
return true;
int t = token();
- if(t != AND)
+ if (t != AND)
return false;
adv();
skipWhitespace();
- if(!compileExpr())
+ if (!compileExpr())
return false;
ScriptInstruction instr;
@@ -513,12 +513,12 @@ bool QmlBasicScriptCompiler::compileExpr()
EXPRESSION := <NAME><OPERATOR>[<CONSTANT>|<NAME>]
*/
- if(!parseName())
+ if (!parseName())
return false;
skipWhitespace();
- if(atEnd())
+ if (atEnd())
return true;
int t = token();
@@ -539,7 +539,7 @@ bool QmlBasicScriptCompiler::compileExpr()
skipWhitespace();
- if(!parseConstant() &&
+ if (!parseConstant() &&
!parseName())
return false;
@@ -578,18 +578,18 @@ bool QmlBasicScriptCompiler::parseName()
bool pushed = false;
while(!atEnd()) {
int t = token();
- if(t == CHARACTER) {
+ if (t == CHARACTER) {
named = true;
seendot = false;
seenchar = true;
namestart = index();
adv();
- } else if(t == DIGIT) {
- if(!seenchar) break;
+ } else if (t == DIGIT) {
+ if (!seenchar) break;
adv();
- } else if(t == DOT) {
+ } else if (t == DOT) {
seendot = true;
- if(namestart == -1)
+ if (namestart == -1)
break;
seenchar = false;
@@ -598,7 +598,7 @@ bool QmlBasicScriptCompiler::parseName()
data.append(name);
data.append('\0');
ScriptInstruction instr;
- if(pushed)
+ if (pushed)
instr.type = ScriptInstruction::Fetch;
else
instr.type = ScriptInstruction::Load;
@@ -613,13 +613,13 @@ bool QmlBasicScriptCompiler::parseName()
}
}
- if(namestart != -1) {
+ if (namestart != -1) {
QByteArray name = string(namestart, index() - 1);
int nref = data.count();
data.append(name);
data.append('\0');
ScriptInstruction instr;
- if(pushed)
+ if (pushed)
instr.type = ScriptInstruction::Fetch;
else
instr.type = ScriptInstruction::Load;
@@ -629,7 +629,7 @@ bool QmlBasicScriptCompiler::parseName()
++stateSize;
}
- if(seendot)
+ if (seendot)
return false;
else
return named;
@@ -688,7 +688,7 @@ int QmlBasicScriptCompiler::index() const
QByteArray QmlBasicScriptCompiler::string(int from, int to)
{
QByteArray rv;
- for(int ii = from; ii <= to; ++ii) {
+ for (int ii = from; ii <= to; ++ii) {
const LexerToken &token = tokens.at(ii);
rv.append(QByteArray(src + token.start, token.end - token.start + 1));
}
@@ -703,8 +703,8 @@ void QmlBasicScript::clearCache(void *voidCache)
QmlBasicScriptNodeCache *dataCache =
reinterpret_cast<QmlBasicScriptNodeCache *>(voidCache);
- for(int ii = 0; ii < d->stateSize; ++ii) {
- if(!dataCache[ii].isCore() && !dataCache[ii].isExplicit() &&
+ for (int ii = 0; ii < d->stateSize; ++ii) {
+ if (!dataCache[ii].isCore() && !dataCache[ii].isExplicit() &&
dataCache[ii].object) {
QMetaObject::removeGuard(&dataCache[ii].object);
dataCache[ii].object = 0;
@@ -715,9 +715,9 @@ void QmlBasicScript::clearCache(void *voidCache)
void QmlBasicScript::guard(QmlBasicScriptNodeCache &n)
{
- if(n.object) {
- if(n.isExplicit()) {
- } else if(n.isCore()) {
+ if (n.object) {
+ if (n.isExplicit()) {
+ } else if (n.isCore()) {
n.metaObject =
n.object->metaObject();
} else {
@@ -750,7 +750,7 @@ bool QmlBasicScript::valid(QmlBasicScriptNodeCache &n, QObject *obj)
*/
QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *cached)
{
- if(!isValid())
+ if (!isValid())
return QVariant();
QmlBasicScriptNodeCache *dataCache =
@@ -763,7 +763,7 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c
const char *data = d->data();
- if(dataCache[0].type == QmlBasicScriptNodeCache::Invalid) {
+ if (dataCache[0].type == QmlBasicScriptNodeCache::Invalid) {
resetting = true;
hasReset = true;
}
@@ -771,7 +771,7 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c
CacheState state = NoChange;
dataCacheItem = 0;
- for(int idx = 0; idx < d->instructionCount; ++idx) {
+ for (int idx = 0; idx < d->instructionCount; ++idx) {
const ScriptInstruction &instr = d->instructions()[idx];
switch(instr.type) {
@@ -781,9 +781,9 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c
const char *id = data + instr.fetch.idx;
QmlBasicScriptNodeCache &n = dataCache[dataCacheItem];
- if(instr.type == ScriptInstruction::Load) {
+ if (instr.type == ScriptInstruction::Load) {
- if(n.type == QmlBasicScriptNodeCache::Invalid) {
+ if (n.type == QmlBasicScriptNodeCache::Invalid) {
context->engine()->d_func()->loadCache(n, QLatin1String(id), static_cast<QmlContextPrivate*>(context->d_ptr));
state = Incremental;
}
@@ -792,9 +792,9 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c
QVariant o = stack.pop();
QObject *obj = qvariant_cast<QObject *>(o);
- if(!obj) {
- if(n.type == QmlBasicScriptNodeCache::Invalid) {
- if(scriptWarnings())
+ if (!obj) {
+ if (n.type == QmlBasicScriptNodeCache::Invalid) {
+ if (scriptWarnings())
qWarning() << "QmlBasicScript: Unable to convert" << o;
*cached = state;
return QVariant();
@@ -804,11 +804,11 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c
CacheState dummy;
return run(context, voidCache, &dummy);
}
- } else if(n.type == QmlBasicScriptNodeCache::Invalid) {
+ } else if (n.type == QmlBasicScriptNodeCache::Invalid) {
context->engine()->d_func()->fetchCache(n, QLatin1String(id), obj);
guard(n);
state = Incremental;
- } else if(!valid(n, obj)) {
+ } else if (!valid(n, obj)) {
clearCache(dataCache);
*cached = Reset;
CacheState dummy;
@@ -875,7 +875,7 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c
*cached = state;
- if(stack.isEmpty())
+ if (stack.isEmpty())
return QVariant();
else
return stack.top();
@@ -895,7 +895,7 @@ const char *QmlBasicScript::compileData() const
*/
unsigned int QmlBasicScript::compileDataSize() const
{
- if(d)
+ if (d)
return d->size;
else
return 0;
@@ -903,7 +903,7 @@ unsigned int QmlBasicScript::compileDataSize() const
bool QmlBasicScript::isSingleLoad() const
{
- if(!d)
+ if (!d)
return false;
return d->instructionCount == 1 &&
@@ -912,7 +912,7 @@ bool QmlBasicScript::isSingleLoad() const
QByteArray QmlBasicScript::singleLoadTarget() const
{
- if(!isSingleLoad())
+ if (!isSingleLoad())
return QByteArray();
// We know there is one instruction and it is a load
diff --git a/src/declarative/test/qfxtestengine.cpp b/src/declarative/test/qfxtestengine.cpp
index d9e3533..70e600d 100644
--- a/src/declarative/test/qfxtestengine.cpp
+++ b/src/declarative/test/qfxtestengine.cpp
@@ -110,15 +110,15 @@ public:
bool QFxTestEnginePrivate::compare(const QImage &img1, const QImage &img2)
{
- if(img1.size() != img2.size())
+ if (img1.size() != img2.size())
return false;
int errorCount = 0;
- for(int yy = 0; yy < img1.height(); ++yy) {
- for(int xx = 0; xx < img1.width(); ++xx) {
- if(img1.pixel(xx, yy) != img2.pixel(xx, yy)) {
+ for (int yy = 0; yy < img1.height(); ++yy) {
+ for (int xx = 0; xx < img1.width(); ++xx) {
+ if (img1.pixel(xx, yy) != img2.pixel(xx, yy)) {
errorCount++;
- if(errorCount > MAX_MISMATCHED_PIXELS)
+ if (errorCount > MAX_MISMATCHED_PIXELS)
return false;
}
}
@@ -138,13 +138,13 @@ QFxTestEngine::QFxTestEngine(TestMode mode, const QString &dir,
d->testDirectory = dir;
d->testMode = mode;
- if(d->testMode == RecordTest) {
+ if (d->testMode == RecordTest) {
qWarning("QFxTestEngine: Record ON");
- } else if(d->testMode == PlaybackTest) {
+ } else if (d->testMode == PlaybackTest) {
QString fileName(d->testDirectory + QLatin1String("/manifest.xml"));
QFile f(fileName);
- if(!f.open(QIODevice::ReadOnly)) {
+ if (!f.open(QIODevice::ReadOnly)) {
qWarning() << "QFxTestEngine: Unable to open file" << fileName;
return;
}
@@ -153,7 +153,7 @@ QFxTestEngine::QFxTestEngine(TestMode mode, const QString &dir,
QmlComponent c(&d->engine, data, QUrl(d->testDirectory + QLatin1String("/manifest.xml")));
QObject *o = c.create();
TestLog *log = qobject_cast<TestLog *>(o);
- if(log) {
+ if (log) {
log->setParent(this);
d->playbackTestData.actions() = log->actions();
qWarning("QFxTestEngine: Playback ON");
@@ -164,18 +164,18 @@ QFxTestEngine::QFxTestEngine(TestMode mode, const QString &dir,
}
}
- if(d->testMode != NoTest) {
+ if (d->testMode != NoTest) {
QUnifiedTimer::instance()->setConsistentTiming(true);
QObject::connect(canvas, SIGNAL(framePainted()),
this, SLOT(framePainted()));
canvas->installEventFilter(this);
- for(int ii = 0; ii < d->playbackTestData.actions().count(); ++ii) {
+ for (int ii = 0; ii < d->playbackTestData.actions().count(); ++ii) {
TestObject *o = d->playbackTestData.actions().at(ii);
- if(TestMouse *m = qobject_cast<TestMouse *>(o))
+ if (TestMouse *m = qobject_cast<TestMouse *>(o))
d->toPost << m;
- else if(TestKey *k = qobject_cast<TestKey *>(o))
+ else if (TestKey *k = qobject_cast<TestKey *>(o))
d->toPost << k;
}
}
@@ -190,7 +190,7 @@ void QFxTestEngine::framePainted()
{
QImage img = d->canvas->asImage();
- if(d->fullFrame) {
+ if (d->fullFrame) {
d->fullFrame = false;
d->recordFullFrameEvent(img);
} else {
@@ -207,11 +207,11 @@ void QFxTestEnginePrivate::recordFullFrameEvent(const QImage &img)
fullFrames << img;
testData.actions() << ff;
- if(testMode == QFxTestEngine::PlaybackTest) {
+ if (testMode == QFxTestEngine::PlaybackTest) {
TestFullFrame *pf = qobject_cast<TestFullFrame *>(playbackTestData.next());
QString filename = testDirectory + QLatin1String("/image") + QString::number(pf->frameId()) + QLatin1String(".png");
QImage recImg(filename);
- if(!pf || !compare(recImg, img) || pf->time() != QUnifiedTimer::instance()->elapsedTime()) {
+ if (!pf || !compare(recImg, img) || pf->time() != QUnifiedTimer::instance()->elapsedTime()) {
message(Fail, "FFrame mismatch");
} else {
message(Success, "FFrame OK");
@@ -226,11 +226,11 @@ static QByteArray toHex(uchar c)
QByteArray rv;
uint h = c / 16;
uint l = c % 16;
- if(h >= 10)
+ if (h >= 10)
rv.append(h - 10 + 'A');
else
rv.append(h + '0');
- if(l >= 10)
+ if (l >= 10)
rv.append(l - 10 + 'A');
else
rv.append(l + '0');
@@ -245,7 +245,7 @@ void QFxTestEnginePrivate::recordFrameEvent(const QImage &img)
QByteArray result = hash.result();
QByteArray hexResult;
- for(int ii = 0; ii < result.count(); ++ii)
+ for (int ii = 0; ii < result.count(); ++ii)
hexResult.append(toHex(result.at(ii)));
TestFrame *f = new TestFrame(q);
@@ -253,13 +253,13 @@ void QFxTestEnginePrivate::recordFrameEvent(const QImage &img)
f->setHash(QLatin1String(hexResult));
testData.actions() << f;
- if(testMode == QFxTestEngine::PlaybackTest) {
+ if (testMode == QFxTestEngine::PlaybackTest) {
TestObject *o = playbackTestData.next();
TestFrame *f = qobject_cast<TestFrame *>(o);
- if(!f || f->time() != QUnifiedTimer::instance()->elapsedTime() ||
+ if (!f || f->time() != QUnifiedTimer::instance()->elapsedTime() ||
f->hash() != QLatin1String(hexResult)) {
mismatchedFrames++;
- if(mismatchedFrames > MAX_MISMATCHED_FRAMES ||
+ if (mismatchedFrames > MAX_MISMATCHED_FRAMES ||
lastFrameMismatch)
message(Fail, "Frame mismatch");
else
@@ -276,23 +276,23 @@ void QFxTestEnginePrivate::recordFrameEvent(const QImage &img)
void QFxTestEnginePrivate::updateCurrentTime(int)
{
- if(status != Working)
+ if (status != Working)
return;
while(!toPost.isEmpty()) {
int t = QUnifiedTimer::instance()->elapsedTime();
TestObject *o = toPost.first();
- if(testMode == QFxTestEngine::RecordTest)
+ if (testMode == QFxTestEngine::RecordTest)
o->setTime(t);
- else if(o->time() != t)
+ else if (o->time() != t)
return;
toPost.takeFirst();
- if(TestMouse *m = qobject_cast<TestMouse *>(o)) {
+ if (TestMouse *m = qobject_cast<TestMouse *>(o)) {
QMouseEvent e((QEvent::Type)m->type(), m->pos(), m->globalPos(), (Qt::MouseButton)m->button(), (Qt::MouseButtons)m->buttons(), (Qt::KeyboardModifiers)0);
postedEvents.insert(&e);
QApplication::sendEvent(canvas, &e);
- } else if(TestKey *k = qobject_cast<TestKey *>(o)) {
+ } else if (TestKey *k = qobject_cast<TestKey *>(o)) {
QKeyEvent e((QEvent::Type)k->type(), k->key(), (Qt::KeyboardModifiers)k->modifiers(), k->text());
postedEvents.insert(&e);
QApplication::sendEvent(canvas, &e);
@@ -302,25 +302,25 @@ void QFxTestEnginePrivate::updateCurrentTime(int)
bool QFxTestEngine::eventFilter(QObject *, QEvent *event)
{
- if(d->status != QFxTestEnginePrivate::Working)
+ if (d->status != QFxTestEnginePrivate::Working)
return false;
- if(event->type() == QEvent::MouseButtonPress ||
+ if (event->type() == QEvent::MouseButtonPress ||
event->type() == QEvent::MouseButtonDblClick ||
event->type() == QEvent::MouseButtonRelease ||
event->type() == QEvent::MouseMove) {
- if(d->testMode == RecordTest && d->postedEvents.contains(event)) {
+ if (d->testMode == RecordTest && d->postedEvents.contains(event)) {
d->postedEvents.remove(event);
} else {
d->recordMouseEvent(static_cast<QMouseEvent *>(event));
return d->testMode == RecordTest;
}
- } else if(event->type() == QEvent::KeyPress ||
+ } else if (event->type() == QEvent::KeyPress ||
event->type() == QEvent::KeyRelease) {
QKeyEvent *key = static_cast<QKeyEvent *>(event);
- if(key->key() < Qt::Key_F1 || key->key() > Qt::Key_F9) {
+ if (key->key() < Qt::Key_F1 || key->key() > Qt::Key_F9) {
- if(d->testMode == RecordTest && d->postedEvents.contains(event)) {
+ if (d->testMode == RecordTest && d->postedEvents.contains(event)) {
d->postedEvents.remove(event);
} else {
d->recordKeyEvent(key);
@@ -344,9 +344,9 @@ void QFxTestEnginePrivate::recordMouseEvent(QMouseEvent *e)
m->setPos(e->pos());
testData.actions() << m;
- if(testMode == QFxTestEngine::PlaybackTest) {
+ if (testMode == QFxTestEngine::PlaybackTest) {
TestMouse *m = qobject_cast<TestMouse *>(playbackTestData.next());
- if(!m || m->time() != QUnifiedTimer::instance()->elapsedTime() ||
+ if (!m || m->time() != QUnifiedTimer::instance()->elapsedTime() ||
m->type() != e->type() ||
m->button() != e->button() ||
m->buttons() != e->buttons() ||
@@ -372,9 +372,9 @@ void QFxTestEnginePrivate::recordKeyEvent(QKeyEvent *e)
k->setText(e->text());
k->setKey(e->key());
testData.actions() << k;
- if(testMode == QFxTestEngine::PlaybackTest) {
+ if (testMode == QFxTestEngine::PlaybackTest) {
TestKey *f = qobject_cast<TestKey *>(playbackTestData.next());
- if(!f || f->time() != QUnifiedTimer::instance()->elapsedTime() ||
+ if (!f || f->time() != QUnifiedTimer::instance()->elapsedTime() ||
f->type() != e->type() ||
f->modifiers() != e->QInputEvent::modifiers() ||
f->text() != e->text() ||
@@ -396,10 +396,10 @@ void QFxTestEngine::captureFullFrame()
void QFxTestEnginePrivate::message(MessageType t, const char *message)
{
- if(exitOnFail)
+ if (exitOnFail)
qWarning("%s", message);
- if(t == Fail) {
- if(exitOnFail) {
+ if (t == Fail) {
+ if (exitOnFail) {
save(QLatin1String("manifest-fail.xml"), false);
qFatal("Failed");
} else {
@@ -417,15 +417,15 @@ void QFxTestEnginePrivate::save(const QString &filename, bool images)
testData.save(&manifest);
manifest.close();
- if(images) {
- for(int ii = 0; ii < fullFrames.count(); ++ii)
+ if (images) {
+ for (int ii = 0; ii < fullFrames.count(); ++ii)
fullFrames.at(ii).save(testDirectory + QLatin1String("/image") + QString::number(ii) + QLatin1String(".png"));
}
}
void QFxTestEngine::save()
{
- if(d->testMode != RecordTest)
+ if (d->testMode != RecordTest)
return;
d->save(QLatin1String("manifest.xml"));
@@ -433,9 +433,9 @@ void QFxTestEngine::save()
void QFxTestEnginePrivate::testPass()
{
- if(playbackTestData.atEnd()) {
+ if (playbackTestData.atEnd()) {
qWarning("Test PASSED");
- if(exitOnFail) {
+ if (exitOnFail) {
save(QLatin1String("manifest-play.xml"));
exit(0);
} else {
diff --git a/src/declarative/test/qfxtestobjects.cpp b/src/declarative/test/qfxtestobjects.cpp
index e93b9ed..be1ab07 100644
--- a/src/declarative/test/qfxtestobjects.cpp
+++ b/src/declarative/test/qfxtestobjects.cpp
@@ -71,7 +71,7 @@ int TestObject::time() const
void TestObject::setTime(int t)
{
- if(t == _time)
+ if (t == _time)
return;
_time = t;
emit dataChanged();
@@ -97,7 +97,7 @@ QString TestFrame::hash() const
void TestFrame::setHash(const QString &h)
{
- if(_hash == h)
+ if (_hash == h)
return;
_hash = h;
emit frameChanged();
@@ -123,7 +123,7 @@ int TestFullFrame::frameId() const
void TestFullFrame::setFrameId(int id)
{
- if(id == _frameId)
+ if (id == _frameId)
return;
_frameId = id;
emit frameChanged();
@@ -149,7 +149,7 @@ int TestMouse::type() const
void TestMouse::setType(int t)
{
- if(_type == t)
+ if (_type == t)
return;
_type = t;
emit mouseChanged();
@@ -162,7 +162,7 @@ int TestMouse::button() const
void TestMouse::setButton(int b)
{
- if(b == _button)
+ if (b == _button)
return;
_button = b;
emit mouseChanged();
@@ -175,7 +175,7 @@ int TestMouse::buttons() const
void TestMouse::setButtons(int buttons)
{
- if(_buttons == buttons)
+ if (_buttons == buttons)
return;
_buttons = buttons;
emit mouseChanged();
@@ -188,7 +188,7 @@ QPoint TestMouse::globalPos() const
void TestMouse::setGlobalPos(const QPoint &g)
{
- if(_globalPos == g)
+ if (_globalPos == g)
return;
_globalPos = g;
emit mouseChanged();
@@ -201,7 +201,7 @@ QPoint TestMouse::pos() const
void TestMouse::setPos(const QPoint &p)
{
- if(p == _pos)
+ if (p == _pos)
return;
_pos = p;
emit mouseChanged();
@@ -231,7 +231,7 @@ int TestKey::type() const
void TestKey::setType(int t)
{
- if(t == _type)
+ if (t == _type)
return;
_type = t;
emit keyChanged();
@@ -244,7 +244,7 @@ int TestKey::modifiers() const
void TestKey::setModifiers(int m)
{
- if(m == _modifiers)
+ if (m == _modifiers)
return;
_modifiers = m;
emit keyChanged();
@@ -257,7 +257,7 @@ QString TestKey::text() const
void TestKey::setText(const QString &t)
{
- if(_text == t)
+ if (_text == t)
return;
_text = t;
emit keyChanged();
@@ -270,7 +270,7 @@ int TestKey::key() const
void TestKey::setKey(int k)
{
- if(_key == k)
+ if (_key == k)
return;
_key = k;
emit keyChanged();
@@ -283,7 +283,7 @@ void TestKey::save(QXmlStreamWriter *device)
device->writeAttribute(QLatin1String("type"), QString::number(type()));
device->writeAttribute(QLatin1String("modifiers"), QString::number(modifiers()));
device->writeAttribute(QLatin1String("key"), QString::number(key()));
- if(key() != Qt::Key_Escape)
+ if (key() != Qt::Key_Escape)
device->writeAttribute(QLatin1String("text"), text());
device->writeEndElement();
}
@@ -317,7 +317,7 @@ void TestLog::save(QIODevice *device)
writer.setAutoFormatting(true);
writer.writeStartDocument(QLatin1String("1.0"));
writer.writeStartElement(QLatin1String("TestLog"));
- for(int ii = 0; ii < _actions.count(); ++ii)
+ for (int ii = 0; ii < _actions.count(); ++ii)
_actions.at(ii)->save(&writer);
writer.writeEndElement();
writer.writeEndDocument();
@@ -325,7 +325,7 @@ void TestLog::save(QIODevice *device)
TestObject *TestLog::next()
{
- if(atEnd())
+ if (atEnd())
return 0;
TestObject *rv = _actions.at(_current);
_current++;
@@ -334,7 +334,7 @@ TestObject *TestLog::next()
bool TestLog::atEnd() const
{
- if(_current >= _actions.count())
+ if (_current >= _actions.count())
return true;
else
return false;
diff --git a/src/declarative/timeline/qmltimeline.cpp b/src/declarative/timeline/qmltimeline.cpp
index fc901eb..b9f79ac 100644
--- a/src/declarative/timeline/qmltimeline.cpp
+++ b/src/declarative/timeline/qmltimeline.cpp
@@ -141,7 +141,7 @@ QmlTimeLinePrivate::QmlTimeLinePrivate(QmlTimeLine *parent)
void QmlTimeLinePrivate::add(QmlTimeLineObject &g, const Op &o)
{
- if(g._t && g._t != q) {
+ if (g._t && g._t != q) {
qWarning() << "QmlTimeLine: Cannot modify a QmlTimeLineValue owned by"
<< "another timeline.";
return;
@@ -149,12 +149,12 @@ void QmlTimeLinePrivate::add(QmlTimeLineObject &g, const Op &o)
g._t = q;
Ops::Iterator iter = ops.find(&g);
- if(iter == ops.end()) {
+ if (iter == ops.end()) {
iter = ops.insert(&g, TimeLine());
- if(syncPoint > 0)
+ if (syncPoint > 0)
q->pause(g, syncPoint);
}
- if(!iter->ops.isEmpty() &&
+ if (!iter->ops.isEmpty() &&
o.type == Op::Pause &&
iter->ops.last().type == Op::Pause) {
iter->ops.last().length += o.length;
@@ -164,22 +164,22 @@ void QmlTimeLinePrivate::add(QmlTimeLineObject &g, const Op &o)
iter->length += o.length;
}
- if(iter->length > length)
+ if (iter->length > length)
length = iter->length;
- if(!clockRunning) {
+ if (!clockRunning) {
q->stop();
prevTime = 0;
clockRunning = true;
- if(syncMode == QmlTimeLine::LocalSync) {
+ if (syncMode == QmlTimeLine::LocalSync) {
syncAdj = -1;
} else {
syncAdj = 0;
}
q->start();
/* q->tick(0);
- if(syncMode == QmlTimeLine::LocalSync) {
+ if (syncMode == QmlTimeLine::LocalSync) {
syncAdj = -1;
} else {
syncAdj = 0;
@@ -201,33 +201,33 @@ qreal QmlTimeLinePrivate::value(const Op &op, int time, qreal base, bool *change
case Op::Set:
return op.value;
case Op::Move:
- if(time == 0) {
+ if (time == 0) {
return base;
- } else if(time == (op.length)) {
+ } else if (time == (op.length)) {
return op.value;
} else {
qreal delta = op.value - base;
qreal pTime = (qreal)(time) / (qreal)op.length;
- if(op.easing.type() == QEasingCurve::Linear)
+ if (op.easing.type() == QEasingCurve::Linear)
return base + delta * pTime;
else
return base + delta * op.easing.valueForProgress(pTime);
}
case Op::MoveBy:
- if(time == 0) {
+ if (time == 0) {
return base;
- } else if(time == (op.length)) {
+ } else if (time == (op.length)) {
return base + op.value;
} else {
qreal delta = op.value;
qreal pTime = (qreal)(time) / (qreal)op.length;
- if(op.easing.type() == QEasingCurve::Linear)
+ if (op.easing.type() == QEasingCurve::Linear)
return base + delta * pTime;
else
return base + delta * op.easing.valueForProgress(pTime);
}
case Op::Accel:
- if(time == 0) {
+ if (time == 0) {
return base;
} else {
qreal t = (qreal)(time) / 1000.0f;
@@ -235,9 +235,9 @@ qreal QmlTimeLinePrivate::value(const Op &op, int time, qreal base, bool *change
return base + delta;
}
case Op::AccelDistance:
- if(time == 0) {
+ if (time == 0) {
return base;
- } else if(time == (op.length)) {
+ } else if (time == (op.length)) {
return base + op.value2;
} else {
qreal t = (qreal)(time) / 1000.0f;
@@ -326,7 +326,7 @@ QmlTimeLine::QmlTimeLine(QObject *parent)
*/
QmlTimeLine::~QmlTimeLine()
{
- for(QmlTimeLinePrivate::Ops::Iterator iter = d->ops.begin();
+ for (QmlTimeLinePrivate::Ops::Iterator iter = d->ops.begin();
iter != d->ops.end();
++iter)
iter.key()->_t = 0;
@@ -359,7 +359,7 @@ void QmlTimeLine::setSyncMode(SyncMode syncMode)
*/
void QmlTimeLine::pause(QmlTimeLineObject &obj, int time)
{
- if(time <= 0) return;
+ if (time <= 0) return;
QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::Pause, time, 0., 0., d->order++);
d->add(obj, op);
}
@@ -390,7 +390,7 @@ void QmlTimeLine::set(QmlTimeLineValue &timeLineValue, qreal value)
*/
int QmlTimeLine::accel(QmlTimeLineValue &timeLineValue, qreal velocity, qreal acceleration)
{
- if((velocity > 0.0f) == (acceleration > 0.0f))
+ if ((velocity > 0.0f) == (acceleration > 0.0f))
acceleration = acceleration * -1.0f;
int time = static_cast<int>(-1000 * velocity / acceleration);
@@ -416,10 +416,10 @@ int QmlTimeLine::accel(QmlTimeLineValue &timeLineValue, qreal velocity, qreal ac
Q_ASSERT(acceleration >= 0.0f && maxDistance >= 0.0f);
qreal maxAccel = (velocity * velocity) / (2.0f * maxDistance);
- if(maxAccel > acceleration)
+ if (maxAccel > acceleration)
acceleration = maxAccel;
- if((velocity > 0.0f) == (acceleration > 0.0f))
+ if ((velocity > 0.0f) == (acceleration > 0.0f))
acceleration = acceleration * -1.0f;
int time = static_cast<int>(-1000 * velocity / acceleration);
@@ -457,7 +457,7 @@ int QmlTimeLine::accelDistance(QmlTimeLineValue &timeLineValue, qreal velocity,
*/
void QmlTimeLine::move(QmlTimeLineValue &timeLineValue, qreal destination, int time)
{
- if(time <= 0) return;
+ if (time <= 0) return;
QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::Move, time, destination, 0.0f, d->order++);
d->add(timeLineValue, op);
}
@@ -468,7 +468,7 @@ void QmlTimeLine::move(QmlTimeLineValue &timeLineValue, qreal destination, int t
*/
void QmlTimeLine::move(QmlTimeLineValue &timeLineValue, qreal destination, const QEasingCurve &easing, int time)
{
- if(time <= 0) return;
+ if (time <= 0) return;
QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::Move, time, destination, 0.0f, d->order++, QmlTimeLineEvent(), easing);
d->add(timeLineValue, op);
}
@@ -479,7 +479,7 @@ void QmlTimeLine::move(QmlTimeLineValue &timeLineValue, qreal destination, const
*/
void QmlTimeLine::moveBy(QmlTimeLineValue &timeLineValue, qreal change, int time)
{
- if(time <= 0) return;
+ if (time <= 0) return;
QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::MoveBy, time, change, 0.0f, d->order++);
d->add(timeLineValue, op);
}
@@ -490,7 +490,7 @@ void QmlTimeLine::moveBy(QmlTimeLineValue &timeLineValue, qreal change, int time
*/
void QmlTimeLine::moveBy(QmlTimeLineValue &timeLineValue, qreal change, const QEasingCurve &easing, int time)
{
- if(time <= 0) return;
+ if (time <= 0) return;
QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::MoveBy, time, change, 0.0f, d->order++, QmlTimeLineEvent(), easing);
d->add(timeLineValue, op);
}
@@ -500,9 +500,9 @@ void QmlTimeLine::moveBy(QmlTimeLineValue &timeLineValue, qreal change, const QE
*/
void QmlTimeLine::reset(QmlTimeLineValue &timeLineValue)
{
- if(!timeLineValue._t)
+ if (!timeLineValue._t)
return;
- if(timeLineValue._t != this) {
+ if (timeLineValue._t != this) {
qWarning() << "QmlTimeLine: Cannot reset a QmlTimeLineValue owned by another timeline.";
return;
}
@@ -529,12 +529,12 @@ int QmlTimeLine::duration() const
void QmlTimeLine::sync(QmlTimeLineValue &timeLineValue, QmlTimeLineValue &syncTo)
{
QmlTimeLinePrivate::Ops::Iterator iter = d->ops.find(&syncTo);
- if(iter == d->ops.end())
+ if (iter == d->ops.end())
return;
int length = iter->length;
iter = d->ops.find(&timeLineValue);
- if(iter == d->ops.end()) {
+ if (iter == d->ops.end()) {
pause(timeLineValue, length);
} else {
int glength = iter->length;
@@ -554,7 +554,7 @@ void QmlTimeLine::sync(QmlTimeLineValue &timeLineValue, QmlTimeLineValue &syncTo
void QmlTimeLine::sync(QmlTimeLineValue &timeLineValue)
{
QmlTimeLinePrivate::Ops::Iterator iter = d->ops.find(&timeLineValue);
- if(iter == d->ops.end()) {
+ if (iter == d->ops.end()) {
pause(timeLineValue, d->length);
} else {
pause(timeLineValue, d->length - iter->length);
@@ -591,7 +591,7 @@ void QmlTimeLine::sync(QmlTimeLineValue &timeLineValue)
/*void QmlTimeLine::sync()
{
- for(QmlTimeLinePrivate::Ops::Iterator iter = d->ops.begin();
+ for (QmlTimeLinePrivate::Ops::Iterator iter = d->ops.begin();
iter != d->ops.end();
++iter)
pause(*iter.key(), d->length - iter->length);
@@ -658,7 +658,7 @@ void QmlTimeLine::complete()
*/
void QmlTimeLine::clear()
{
- for(QmlTimeLinePrivate::Ops::ConstIterator iter = d->ops.begin(); iter != d->ops.end(); ++iter)
+ for (QmlTimeLinePrivate::Ops::ConstIterator iter = d->ops.begin(); iter != d->ops.end(); ++iter)
iter.key()->_t = 0;
d->ops.clear();
d->length = 0;
@@ -680,13 +680,13 @@ int QmlTimeLine::time() const
void QmlTimeLine::updateCurrentTime(int v)
{
- if(d->syncAdj == -1)
+ if (d->syncAdj == -1)
d->syncAdj = v;
v -= d->syncAdj;
int timeChanged = v - d->prevTime;
#if 0
- if(!timeChanged)
+ if (!timeChanged)
return;
#endif
d->prevTime = v;
@@ -694,18 +694,18 @@ void QmlTimeLine::updateCurrentTime(int v)
emit updated();
// Do we need to stop the clock?
- if(d->ops.isEmpty()) {
+ if (d->ops.isEmpty()) {
stop();
d->prevTime = 0;
d->clockRunning = false;
emit completed();
- } /*else if(pauseTime > 0) {
+ } /*else if (pauseTime > 0) {
GfxClock::cancelClock();
d->prevTime = 0;
GfxClock::pauseFor(pauseTime);
d->syncAdj = 0;
d->clockRunning = false;
- }*/ else if(/*!GfxClock::isActive()*/ state() != Running) {
+ }*/ else if (/*!GfxClock::isActive()*/ state() != Running) {
stop();
d->prevTime = 0;
d->clockRunning = true;
@@ -729,14 +729,14 @@ int QmlTimeLinePrivate::advance(int t)
pauseTime = -1;
// Minimal advance time
int advanceTime = t;
- for(Ops::Iterator iter = ops.begin(); iter != ops.end(); ++iter) {
+ for (Ops::Iterator iter = ops.begin(); iter != ops.end(); ++iter) {
TimeLine &tl = *iter;
Op &op = tl.ops.first();
int length = op.length - tl.consumedOpLength;
- if(length < advanceTime) {
+ if (length < advanceTime) {
advanceTime = length;
- if(advanceTime == 0)
+ if (advanceTime == 0)
break;
}
}
@@ -746,28 +746,28 @@ int QmlTimeLinePrivate::advance(int t)
// sets.
QList<QPair<int, Update> > updates;
- for(Ops::Iterator iter = ops.begin(); iter != ops.end(); ) {
+ for (Ops::Iterator iter = ops.begin(); iter != ops.end(); ) {
QmlTimeLineValue *v = static_cast<QmlTimeLineValue *>(iter.key());
TimeLine &tl = *iter;
Q_ASSERT(!tl.ops.isEmpty());
do {
Op &op = tl.ops.first();
- if(advanceTime == 0 && op.length != 0)
+ if (advanceTime == 0 && op.length != 0)
continue;
- if(tl.consumedOpLength == 0 &&
+ if (tl.consumedOpLength == 0 &&
op.type != Op::Pause &&
op.type != Op::Execute)
tl.base = v->value();
- if((tl.consumedOpLength + advanceTime) == op.length) {
- if(op.type == Op::Execute) {
+ if ((tl.consumedOpLength + advanceTime) == op.length) {
+ if (op.type == Op::Execute) {
updates << qMakePair(op.order, Update(op.event));
} else {
bool changed = false;
qreal val = value(op, op.length, tl.base, &changed);
- if(changed)
+ if (changed)
updates << qMakePair(op.order, Update(v, val));
}
tl.length -= qMin(advanceTime, tl.length);
@@ -777,7 +777,7 @@ int QmlTimeLinePrivate::advance(int t)
tl.consumedOpLength += advanceTime;
bool changed = false;
qreal val = value(op, tl.consumedOpLength, tl.base, &changed);
- if(changed)
+ if (changed)
updates << qMakePair(op.order, Update(v, val));
tl.length -= qMin(advanceTime, tl.length);
break;
@@ -786,13 +786,13 @@ int QmlTimeLinePrivate::advance(int t)
} while(!tl.ops.isEmpty() && advanceTime == 0 && tl.ops.first().length == 0);
- if(tl.ops.isEmpty()) {
+ if (tl.ops.isEmpty()) {
iter = ops.erase(iter);
v->_t = 0;
} else {
- if(tl.ops.first().type == Op::Pause && pauseTime != 0) {
+ if (tl.ops.first().type == Op::Pause && pauseTime != 0) {
int opPauseTime = tl.ops.first().length - tl.consumedOpLength;
- if(pauseTime == -1 || opPauseTime < pauseTime)
+ if (pauseTime == -1 || opPauseTime < pauseTime)
pauseTime = opPauseTime;
} else {
pauseTime = 0;
@@ -806,9 +806,9 @@ int QmlTimeLinePrivate::advance(int t)
qSort(updates.begin(), updates.end());
updateQueue = &updates;
- for(int ii = 0; ii < updates.count(); ++ii) {
+ for (int ii = 0; ii < updates.count(); ++ii) {
const Update &v = updates.at(ii).second;
- if(v.g)
+ if (v.g)
v.g->setValue(v.v);
else
v.e.execute();
@@ -826,27 +826,27 @@ void QmlTimeLine::remove(QmlTimeLineObject *v)
int len = iter->length;
d->ops.erase(iter);
- if(len == d->length) {
+ if (len == d->length) {
// We need to recalculate the length
d->length = 0;
- for(QmlTimeLinePrivate::Ops::Iterator iter = d->ops.begin();
+ for (QmlTimeLinePrivate::Ops::Iterator iter = d->ops.begin();
iter != d->ops.end();
++iter) {
- if(iter->length > d->length)
+ if (iter->length > d->length)
d->length = iter->length;
}
}
- if(d->ops.isEmpty()) {
+ if (d->ops.isEmpty()) {
stop();
d->clockRunning = false;
- } else if(/*!GfxClock::isActive()*/ state() != Running) {
+ } else if (/*!GfxClock::isActive()*/ state() != Running) {
stop();
d->prevTime = 0;
d->clockRunning = true;
- if(d->syncMode == QmlTimeLine::LocalSync) {
+ if (d->syncMode == QmlTimeLine::LocalSync) {
d->syncAdj = -1;
} else {
d->syncAdj = 0;
@@ -854,9 +854,9 @@ void QmlTimeLine::remove(QmlTimeLineObject *v)
start();
}
- if(d->updateQueue) {
- for(int ii = 0; ii < d->updateQueue->count(); ++ii) {
- if(d->updateQueue->at(ii).second.g == v ||
+ if (d->updateQueue) {
+ for (int ii = 0; ii < d->updateQueue->count(); ++ii) {
+ if (d->updateQueue->at(ii).second.g == v ||
d->updateQueue->at(ii).second.e.eventObject() == v) {
d->updateQueue->removeAt(ii);
--ii;
@@ -906,7 +906,7 @@ QmlTimeLineObject::QmlTimeLineObject()
QmlTimeLineObject::~QmlTimeLineObject()
{
- if(_t) {
+ if (_t) {
_t->remove(this);
_t = 0;
}
diff --git a/src/declarative/timeline/qmltimelinevalueproxy.h b/src/declarative/timeline/qmltimelinevalueproxy.h
index add45dd..853db4e 100644
--- a/src/declarative/timeline/qmltimelinevalueproxy.h
+++ b/src/declarative/timeline/qmltimelinevalueproxy.h
@@ -69,8 +69,8 @@ public:
virtual void setValue(qreal v)
{
QmlTimeLineValue::setValue(v);
- if(_setFunctionReal) (_class->*_setFunctionReal)(v);
- else if(_setFunctionInt) (_class->*_setFunctionInt)((int)v);
+ if (_setFunctionReal) (_class->*_setFunctionReal)(v);
+ else if (_setFunctionInt) (_class->*_setFunctionInt)((int)v);
}
private:
diff --git a/src/declarative/util/qfxglobal.h b/src/declarative/util/qfxglobal.h
index 52cf021..887351d 100644
--- a/src/declarative/util/qfxglobal.h
+++ b/src/declarative/util/qfxglobal.h
@@ -88,10 +88,10 @@ QT_MODULE(Declarative)
static bool name() \
{ \
static enum { Yes, No, Unknown } status = Unknown; \
- if(status == Unknown) { \
+ if (status == Unknown) { \
QByteArray v = qgetenv(#var); \
bool value = !v.isEmpty() && v != "0" && v != "false"; \
- if(value) status = Yes; \
+ if (value) status = Yes; \
else status = No; \
} \
return status == Yes; \
diff --git a/src/declarative/util/qfxview.cpp b/src/declarative/util/qfxview.cpp
index 993d5cb..1e9d5a4 100644
--- a/src/declarative/util/qfxview.cpp
+++ b/src/declarative/util/qfxview.cpp
@@ -200,7 +200,7 @@ void QFxView::execute()
d->component = new QmlComponent(&d->engine, d->xml.toUtf8(), d->source);
}
- if(!d->component->isLoading()) {
+ if (!d->component->isLoading()) {
continueExecute();
} else {
connect(d->component, SIGNAL(statusChanged(QmlComponent::Status)), this, SLOT(continueExecute()));
@@ -211,18 +211,18 @@ void QFxView::continueExecute()
{
disconnect(d->component, SIGNAL(statusChanged(QmlComponent::Status)), this, SLOT(continueExecute()));
- if(!d->component){
+ if (!d->component){
qWarning() << "Error in loading" << d->source;
return;
}
QObject *obj = d->component->create();
rootContext()->deactivate();
- if(obj) {
- if(QFxItem *item = qobject_cast<QFxItem *>(obj)) {
+ if (obj) {
+ if (QFxItem *item = qobject_cast<QFxItem *>(obj)) {
item->QSimpleCanvasItem::setParent(QSimpleCanvas::root());
- if(itemTreeDump())
+ if (itemTreeDump())
item->dump();
QPerformanceLog::displayData();
@@ -231,7 +231,7 @@ void QFxView::continueExecute()
connect(item, SIGNAL(widthChanged()), this, SLOT(sizeChanged()));
connect(item, SIGNAL(heightChanged()), this, SLOT(sizeChanged()));
sizeChanged();
- } else if(QWidget *wid = qobject_cast<QWidget *>(obj)) {
+ } else if (QWidget *wid = qobject_cast<QWidget *>(obj)) {
window()->setAttribute(Qt::WA_OpaquePaintEvent, false);
window()->setAttribute(Qt::WA_NoSystemBackground, false);
if (!layout()) {
@@ -256,14 +256,14 @@ void QFxView::sizeChanged()
QFxItem* QFxView::addItem(const QString &xml, QFxItem* parent)
{
- if(!d->root)
+ if (!d->root)
return 0;
QmlComponent component(&d->engine, xml.toUtf8(), QUrl());
QObject *obj = component.create();
- if(obj){
+ if (obj){
QFxItem *item = static_cast<QFxItem *>(obj);
- if(!parent)
+ if (!parent)
parent = d->root;
item->setItemParent(parent);
@@ -280,7 +280,7 @@ void QFxView::reset()
void QFxView::clearItems()
{
- if(!d->root)
+ if (!d->root)
return;
delete d->root;
d->root = 0;
@@ -293,7 +293,7 @@ QFxItem *QFxView::root() const
void QFxView::resizeEvent(QResizeEvent *e)
{
- if(d->root) {
+ if (d->root) {
d->root->setWidth(width());
d->root->setHeight(height());
}
diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp
index 91a5361..c09b378 100644
--- a/src/declarative/util/qmlanimation.cpp
+++ b/src/declarative/util/qmlanimation.cpp
@@ -73,9 +73,9 @@ QEasingCurve stringToCurve(const QString &curve)
bool hasParams = curve.contains(QLatin1Char('('));
QStringList props;
- if(hasParams) {
+ if (hasParams) {
QString easeName = curve.trimmed();
- if(!easeName.endsWith(QLatin1Char(')'))) {
+ if (!easeName.endsWith(QLatin1Char(')'))) {
qWarning("QEasingCurve: Unmatched perenthesis in easing function '%s'",
curve.toLatin1().constData());
return easingCurve;
@@ -104,10 +104,10 @@ QEasingCurve stringToCurve(const QString &curve)
easingCurve.setType((QEasingCurve::Type)value);
if (hasParams) {
- foreach(QString str, props) {
+ foreach(const QString &str, props) {
int sep = str.indexOf(QLatin1Char(':'));
- if(sep == -1) {
+ if (sep == -1) {
qWarning("QEasingCurve: Improperly specified property in easing function '%s'",
curve.toLatin1().constData());
return easingCurve;
@@ -117,7 +117,7 @@ QEasingCurve stringToCurve(const QString &curve)
bool isOk;
qreal propValue = str.mid(sep + 1).trimmed().toDouble(&isOk);
- if(propName.isEmpty() || !isOk) {
+ if (propName.isEmpty() || !isOk) {
qWarning("QEasingCurve: Improperly specified property in easing function '%s'",
curve.toLatin1().constData());
return easingCurve;
@@ -188,13 +188,13 @@ QmlAbstractAnimation::QmlAbstractAnimation(QmlAbstractAnimationPrivate &dd, QObj
Likewise, the \c running property can be read to determine if the animation
is running. In the following example the text element will indicate whether
or not the animation is running.
-
+
\code
<NumericAnimation id="MyAnimation" />
<Text text="{MyAnimation.running?'Animation is running':'Animation is not running'}" />
\endcode
- Animations can also be started and stopped imperatively from JavaScript
+ Animations can also be started and stopped imperatively from JavaScript
using the \c start() and \c stop() methods.
By default, animations are not running.
@@ -211,7 +211,7 @@ void QmlAbstractAnimationPrivate::commence()
q->prepare(userProperty.value);
q->qtAnimation()->start();
- if(!q->qtAnimation()->state() == QAbstractAnimation::Running) {
+ if (!q->qtAnimation()->state() == QAbstractAnimation::Running) {
running = false;
emit q->completed();
}
@@ -220,17 +220,17 @@ void QmlAbstractAnimationPrivate::commence()
void QmlAbstractAnimation::setRunning(bool r)
{
Q_D(QmlAbstractAnimation);
- if(d->running == r)
+ if (d->running == r)
return;
- if(d->group) {
+ if (d->group) {
qWarning("QmlAbstractAnimation: setRunning() cannot be used on non-root animation nodes");
return;
}
d->running = r;
- if(d->running) {
- if(!d->connectedTimeLine) {
+ if (d->running) {
+ if (!d->connectedTimeLine) {
QObject::connect(qtAnimation(), SIGNAL(finished()),
this, SLOT(timelineComplete()));
d->connectedTimeLine = true;
@@ -241,7 +241,7 @@ void QmlAbstractAnimation::setRunning(bool r)
d->startOnCompletion = true;
emit started();
} else {
- if(!d->finishPlaying)
+ if (!d->finishPlaying)
qtAnimation()->stop();
emit completed();
}
@@ -272,7 +272,7 @@ void QmlAbstractAnimation::componentComplete()
calling the \c stop() method. The \c complete() method is not effected
by this value.
- This behaviour is most useful when the \c repeat property is set, as the
+ This behaviour is most useful when the \c repeat property is set, as the
animation will finish playing normally but not restart.
By default, the finishPlaying property is not set.
@@ -286,7 +286,7 @@ bool QmlAbstractAnimation::finishPlaying() const
void QmlAbstractAnimation::setFinishPlaying(bool f)
{
Q_D(QmlAbstractAnimation);
- if(d->finishPlaying == f)
+ if (d->finishPlaying == f)
return;
d->finishPlaying = f;
@@ -297,7 +297,7 @@ void QmlAbstractAnimation::setFinishPlaying(bool f)
\qmlproperty bool Animation::repeat
This property holds whether the animation should repeat.
- If set, the animation will continuously repeat until it is explicitly
+ If set, the animation will continuously repeat until it is explicitly
stopped - either by setting the \c running property to false, or by calling
the \c stop() method.
@@ -320,7 +320,7 @@ bool QmlAbstractAnimation::repeat() const
void QmlAbstractAnimation::setRepeat(bool r)
{
Q_D(QmlAbstractAnimation);
- if(r == d->repeat)
+ if (r == d->repeat)
return;
d->repeat = r;
@@ -338,20 +338,20 @@ QmlAnimationGroup *QmlAbstractAnimation::group() const
void QmlAbstractAnimation::setGroup(QmlAnimationGroup *g)
{
Q_D(QmlAbstractAnimation);
- if(d->group == g)
+ if (d->group == g)
return;
- if(d->group)
+ if (d->group)
static_cast<QmlAnimationGroupPrivate *>(d->group->d_ptr)->animations.removeAll(this);
d->group = g;
- if(d->group && !static_cast<QmlAnimationGroupPrivate *>(d->group->d_ptr)->animations.contains(this))
+ if (d->group && !static_cast<QmlAnimationGroupPrivate *>(d->group->d_ptr)->animations.contains(this))
static_cast<QmlAnimationGroupPrivate *>(d->group->d_ptr)->animations.append(this);
if (d->group)
((QAnimationGroup*)d->group->qtAnimation())->addAnimation(qtAnimation());
- //if(g) //if removed from a group, then the group should no longer be the parent
+ //if (g) //if removed from a group, then the group should no longer be the parent
setParent(g);
}
@@ -371,11 +371,11 @@ QObject *QmlAbstractAnimation::target() const
void QmlAbstractAnimation::setTarget(QObject *o)
{
Q_D(QmlAbstractAnimation);
- if(d->target == o)
+ if (d->target == o)
return;
d->target = o;
- if(d->target && !d->propertyName.isEmpty()) {
+ if (d->target && !d->propertyName.isEmpty()) {
d->userProperty = QmlMetaProperty(d->target, d->propertyName);
} else {
d->userProperty.invalidate();
@@ -400,11 +400,11 @@ QString QmlAbstractAnimation::property() const
void QmlAbstractAnimation::setProperty(const QString &n)
{
Q_D(QmlAbstractAnimation);
- if(d->propertyName == n)
+ if (d->propertyName == n)
return;
d->propertyName = n;
- if(d->target && !d->propertyName.isEmpty()) {
+ if (d->target && !d->propertyName.isEmpty()) {
d->userProperty = QmlMetaProperty(d->target, d->propertyName);
} else {
d->userProperty.invalidate();
@@ -443,7 +443,7 @@ void QmlAbstractAnimation::start()
\endcode
was stopped at time 250ms, the \c x property will have a value of 50.
- However, if the \c finishPlaying property is set, the animation will
+ However, if the \c finishPlaying property is set, the animation will
continue running until it completes and then stop. The \c running property
will still become false immediately.
*/
@@ -482,12 +482,12 @@ void QmlAbstractAnimation::restart()
</Rect>
\endcode
calling \c stop() at time 250ms will result in the \c x property having
- a value of 50, while calling \c complete() will set the \c x property to
+ a value of 50, while calling \c complete() will set the \c x property to
100, exactly as though the animation had played the whole way through.
*/
void QmlAbstractAnimation::complete()
{
- if(isRunning()) {
+ if (isRunning()) {
qtAnimation()->setCurrentTime(qtAnimation()->duration());
}
}
@@ -495,7 +495,7 @@ void QmlAbstractAnimation::complete()
void QmlAbstractAnimation::setTarget(const QmlMetaProperty &p)
{
Q_D(QmlAbstractAnimation);
- if(d->userProperty.isNull)
+ if (d->userProperty.isNull)
d->userProperty = p;
}
@@ -588,13 +588,13 @@ int QmlPauseAnimation::duration() const
void QmlPauseAnimation::setDuration(int duration)
{
- if(duration < 0) {
+ if (duration < 0) {
qWarning("QmlPauseAnimation: Cannot set a duration of < 0");
return;
}
Q_D(QmlPauseAnimation);
- if(d->pa->duration() == duration)
+ if (d->pa->duration() == duration)
return;
d->pa->setDuration(duration);
emit durationChanged(duration);
@@ -603,7 +603,7 @@ void QmlPauseAnimation::setDuration(int duration)
void QmlPauseAnimation::prepare(QmlMetaProperty &p)
{
Q_D(QmlPauseAnimation);
- if(d->userProperty.isNull)
+ if (d->userProperty.isNull)
d->property = p;
else
d->property = d->userProperty;
@@ -678,13 +678,13 @@ int QmlColorAnimation::duration() const
void QmlColorAnimation::setDuration(int duration)
{
- if(duration < 0) {
+ if (duration < 0) {
qWarning("QmlColorAnimation: Cannot set a duration of < 0");
return;
}
Q_D(QmlColorAnimation);
- if(d->ca->duration() == duration)
+ if (d->ca->duration() == duration)
return;
d->ca->setDuration(duration);
emit durationChanged(duration);
@@ -707,7 +707,7 @@ QColor QmlColorAnimation::from() const
void QmlColorAnimation::setFrom(const QColor &f)
{
Q_D(QmlColorAnimation);
- if(d->fromValue.isValid() && f == d->fromValue)
+ if (d->fromValue.isValid() && f == d->fromValue)
return;
d->fromValue = f;
emit fromChanged(f);
@@ -730,7 +730,7 @@ QColor QmlColorAnimation::to() const
void QmlColorAnimation::setTo(const QColor &t)
{
Q_D(QmlColorAnimation);
- if(d->toValue.isValid() && t == d->toValue)
+ if (d->toValue.isValid() && t == d->toValue)
return;
d->toValue = t;
emit toChanged(t);
@@ -753,7 +753,7 @@ QString QmlColorAnimation::easing() const
void QmlColorAnimation::setEasing(const QString &e)
{
Q_D(QmlColorAnimation);
- if(d->easing == e)
+ if (d->easing == e)
return;
d->easing = e;
@@ -766,7 +766,7 @@ void QmlColorAnimation::setEasing(const QString &e)
This property holds the items selected to be affected by this animation (all if not set).
\sa exclude
*/
-QList<QObject *> *QmlColorAnimation::filter()
+QList<QObject *> *QmlColorAnimation::filter()
{
Q_D(QmlColorAnimation);
return &d->filter;
@@ -786,7 +786,7 @@ QList<QObject *> *QmlColorAnimation::exclude()
void QmlColorAnimation::prepare(QmlMetaProperty &p)
{
Q_D(QmlColorAnimation);
- if(d->userProperty.isNull)
+ if (d->userProperty.isNull)
d->property = p;
else
d->property = d->userProperty;
@@ -813,7 +813,7 @@ void QmlColorAnimation::transition(QmlStateActions &actions,
QmlStateActions actions;
void write(QmlMetaProperty &property, const QColor &color)
{
- if(property.propertyType() == qMetaTypeId<QColor>()) {
+ if (property.propertyType() == qMetaTypeId<QColor>()) {
property.write(color);
}
}
@@ -821,17 +821,17 @@ void QmlColorAnimation::transition(QmlStateActions &actions,
void setValue(qreal v)
{
QmlTimeLineValue::setValue(v);
- for(int ii = 0; ii < actions.count(); ++ii) {
+ for (int ii = 0; ii < actions.count(); ++ii) {
Action &action = actions[ii];
QColor to(action.toValue.value<QColor>());
- if(v == 1.) {
+ if (v == 1.) {
write(action.property, to);
} else {
- if(action.fromValue.isNull()) {
+ if (action.fromValue.isNull()) {
action.fromValue = action.property.read();
- if(action.fromValue.isNull())
+ if (action.fromValue.isNull())
action.fromValue = QVariant(QColor());
}
@@ -852,26 +852,26 @@ void QmlColorAnimation::transition(QmlStateActions &actions,
//XXX should we get rid of this?
QStringList props;
props << QLatin1String("color");
- if(!d->propertyName.isEmpty() && !props.contains(d->propertyName))
+ if (!d->propertyName.isEmpty() && !props.contains(d->propertyName))
props.append(d->propertyName);
NTransitionData *data = new NTransitionData;
QSet<QObject *> objs;
- for(int ii = 0; ii < actions.count(); ++ii) {
+ for (int ii = 0; ii < actions.count(); ++ii) {
Action &action = actions[ii];
QObject *obj = action.property.object();
QString propertyName = action.property.name();
- if((d->filter.isEmpty() || d->filter.contains(obj)) &&
+ if ((d->filter.isEmpty() || d->filter.contains(obj)) &&
(!d->exclude.contains(obj)) && props.contains(propertyName) &&
(!target() || target() == obj)) {
objs.insert(obj);
Action myAction = action;
- if(d->fromValue.isValid())
+ if (d->fromValue.isValid())
myAction.fromValue = QVariant(d->fromValue);
- if(d->toValue.isValid())
+ if (d->toValue.isValid())
myAction.toValue = QVariant(d->toValue);
modified << action.property;
@@ -880,13 +880,13 @@ void QmlColorAnimation::transition(QmlStateActions &actions,
}
}
- if(d->toValue.isValid() && target() && !objs.contains(target())) {
+ if (d->toValue.isValid() && target() && !objs.contains(target())) {
QObject *obj = target();
- for(int jj = 0; jj < props.count(); ++jj) {
+ for (int jj = 0; jj < props.count(); ++jj) {
Action myAction;
myAction.property = QmlMetaProperty(obj, props.at(jj));
- if(d->fromValue.isValid())
+ if (d->fromValue.isValid())
myAction.fromValue = QVariant(d->fromValue);
myAction.toValue = QVariant(d->toValue);
@@ -896,7 +896,7 @@ void QmlColorAnimation::transition(QmlStateActions &actions,
}
}
- if(data->actions.count())
+ if (data->actions.count())
d->ca->setAnimValue(data, QAbstractAnimation::DeleteWhenStopped);
else
delete data;
@@ -905,8 +905,8 @@ void QmlColorAnimation::transition(QmlStateActions &actions,
void QmlColorAnimationPrivate::valueChanged(qreal v)
{
- if(!fromSourced) {
- if(!fromValue.isValid()) {
+ if (!fromSourced) {
+ if (!fromValue.isValid()) {
fromValue = QColor(qvariant_cast<QColor>(property.read()));
}
fromSourced = true;
@@ -918,7 +918,7 @@ void QmlColorAnimationPrivate::valueChanged(qreal v)
uint blue = uint(qreal(fromValue.blue()) + v * (qreal(toValue.blue()) - qreal(fromValue.blue())));
uint alpha = uint(qreal(fromValue.alpha()) + v * (qreal(toValue.alpha()) - qreal(fromValue.alpha())));
- if(property.propertyType() == qMetaTypeId<QColor>()) {
+ if (property.propertyType() == qMetaTypeId<QColor>()) {
property.write(QColor(red, green, blue, alpha));
}
}
@@ -967,7 +967,7 @@ QString QmlRunScriptAction::script() const
void QmlRunScriptAction::setScript(const QString &script)
{
Q_D(QmlRunScriptAction);
- if(script == d->script)
+ if (script == d->script)
return;
d->script = script;
emit scriptChanged(script);
@@ -986,7 +986,7 @@ QString QmlRunScriptAction::file() const
void QmlRunScriptAction::setFile(const QString &file)
{
Q_D(QmlRunScriptAction);
- if(file == d->file)
+ if (file == d->file)
return;
d->file = file;
emit fileChanged(file);
@@ -996,14 +996,14 @@ void QmlRunScriptActionPrivate::execute()
{
Q_Q(QmlRunScriptAction);
QString scriptStr = script;
- if(!file.isEmpty()){
+ if (!file.isEmpty()){
QFile scriptFile(file);
- if(scriptFile.open(QIODevice::ReadOnly | QIODevice::Text)){
+ if (scriptFile.open(QIODevice::ReadOnly | QIODevice::Text)){
scriptStr = QString::fromUtf8(scriptFile.readAll());
}
}
- if(!scriptStr.isEmpty()) {
+ if (!scriptStr.isEmpty()) {
QmlExpression expr(qmlContext(q), scriptStr, q);
expr.setTrackChange(false);
expr.value();
@@ -1074,7 +1074,7 @@ QString QmlSetPropertyAction::properties() const
void QmlSetPropertyAction::setProperties(const QString &p)
{
Q_D(QmlSetPropertyAction);
- if(d->properties == p)
+ if (d->properties == p)
return;
d->properties = p;
emit propertiesChanged(p);
@@ -1116,7 +1116,7 @@ QVariant QmlSetPropertyAction::value() const
void QmlSetPropertyAction::setValue(const QVariant &v)
{
Q_D(QmlSetPropertyAction);
- if(d->value.isNull || d->value != v) {
+ if (d->value.isNull || d->value != v) {
d->value = v;
emit valueChanged(v);
}
@@ -1137,7 +1137,7 @@ void QmlSetPropertyAction::prepare(QmlMetaProperty &p)
{
Q_D(QmlSetPropertyAction);
- if(d->userProperty.isNull)
+ if (d->userProperty.isNull)
d->property = p;
else
d->property = d->userProperty;
@@ -1157,7 +1157,7 @@ void QmlSetPropertyAction::transition(QmlStateActions &actions,
QmlStateActions actions;
virtual void doAction()
{
- for(int ii = 0; ii < actions.count(); ++ii) {
+ for (int ii = 0; ii < actions.count(); ++ii) {
const Action &action = actions.at(ii);
QmlBehaviour::_ignore = true;
action.property.write(action.toValue);
@@ -1167,27 +1167,27 @@ void QmlSetPropertyAction::transition(QmlStateActions &actions,
};
QStringList props = d->properties.split(QLatin1Char(','));
- for(int ii = 0; ii < props.count(); ++ii)
+ for (int ii = 0; ii < props.count(); ++ii)
props[ii] = props.at(ii).trimmed();
- if(!d->propertyName.isEmpty() && !props.contains(d->propertyName))
+ if (!d->propertyName.isEmpty() && !props.contains(d->propertyName))
props.append(d->propertyName);
QmlSetPropertyAnimationAction *data = new QmlSetPropertyAnimationAction;
QSet<QObject *> objs;
- for(int ii = 0; ii < actions.count(); ++ii) {
+ for (int ii = 0; ii < actions.count(); ++ii) {
Action &action = actions[ii];
QObject *obj = action.property.object();
QString propertyName = action.property.name();
- if((d->filter.isEmpty() || d->filter.contains(obj)) &&
+ if ((d->filter.isEmpty() || d->filter.contains(obj)) &&
(!d->exclude.contains(obj)) && props.contains(propertyName) &&
(!target() || target() == obj)) {
objs.insert(obj);
Action myAction = action;
- if(d->value.isValid())
+ if (d->value.isValid())
myAction.toValue = d->value;
modified << action.property;
@@ -1196,9 +1196,9 @@ void QmlSetPropertyAction::transition(QmlStateActions &actions,
}
}
- if(d->value.isValid() && target() && !objs.contains(target())) {
+ if (d->value.isValid() && target() && !objs.contains(target())) {
QObject *obj = target();
- for(int jj = 0; jj < props.count(); ++jj) {
+ for (int jj = 0; jj < props.count(); ++jj) {
Action myAction;
myAction.property = QmlMetaProperty(obj, props.at(jj));
myAction.toValue = d->value;
@@ -1206,7 +1206,7 @@ void QmlSetPropertyAction::transition(QmlStateActions &actions,
}
}
- if(data->actions.count()) {
+ if (data->actions.count()) {
d->spa->setAnimAction(data, QAbstractAnimation::DeleteWhenStopped);
} else {
delete data;
@@ -1249,9 +1249,9 @@ void QmlParentChangeAction::prepare(QmlMetaProperty &p)
{
Q_D(QmlParentChangeAction);
- if(d->userProperty.isNull)
+ if (d->userProperty.isNull)
d->property = p;
- else
+ else
d->property = d->userProperty;
//XXX
@@ -1275,7 +1275,7 @@ void QmlParentChangeAction::transition(QmlStateActions &actions,
QmlStateActions actions;
virtual void doAction()
{
- for(int ii = 0; ii < actions.count(); ++ii) {
+ for (int ii = 0; ii < actions.count(); ++ii) {
const Action &action = actions.at(ii);
QmlBehaviour::_ignore = true;
action.property.write(action.toValue);
@@ -1287,17 +1287,17 @@ void QmlParentChangeAction::transition(QmlStateActions &actions,
QmlParentChangeActionData *data = new QmlParentChangeActionData;
QSet<QObject *> objs;
- for(int ii = 0; ii < actions.count(); ++ii) {
+ for (int ii = 0; ii < actions.count(); ++ii) {
Action &action = actions[ii];
QObject *obj = action.property.object();
QString propertyName = action.property.name();
- if((!target() || target() == obj) && propertyName == QString(QLatin1String("moveToParent"))) {
+ if ((!target() || target() == obj) && propertyName == QString(QLatin1String("moveToParent"))) {
objs.insert(obj);
Action myAction = action;
- /*if(d->value.isValid())
+ /*if (d->value.isValid())
myAction.toValue = d->value;*/
modified << action.property;
@@ -1306,9 +1306,9 @@ void QmlParentChangeAction::transition(QmlStateActions &actions,
}
}
- /*if(d->value.isValid() && target() && !objs.contains(target())) {
+ /*if (d->value.isValid() && target() && !objs.contains(target())) {
QObject *obj = target();
- for(int jj = 0; jj < props.count(); ++jj) {
+ for (int jj = 0; jj < props.count(); ++jj) {
Action myAction;
myAction.property = QmlMetaProperty(obj, props.at(jj));
myAction.toValue = d->value;
@@ -1316,7 +1316,7 @@ void QmlParentChangeAction::transition(QmlStateActions &actions,
}
}*/
- if(data->actions.count()) {
+ if (data->actions.count()) {
d->cpa->setAnimAction(data, QAbstractAnimation::DeleteWhenStopped);
} else {
delete data;
@@ -1387,13 +1387,13 @@ int QmlNumericAnimation::duration() const
void QmlNumericAnimation::setDuration(int duration)
{
- if(duration < 0) {
+ if (duration < 0) {
qWarning("QmlNumericAnimation: Cannot set a duration of < 0");
return;
}
Q_D(QmlNumericAnimation);
- if(d->na->duration() == duration)
+ if (d->na->duration() == duration)
return;
d->na->setDuration(duration);
emit durationChanged(duration);
@@ -1417,7 +1417,7 @@ qreal QmlNumericAnimation::from() const
void QmlNumericAnimation::setFrom(qreal f)
{
Q_D(QmlNumericAnimation);
- if(!d->from.isNull && f == d->from)
+ if (!d->from.isNull && f == d->from)
return;
d->from = f;
emit fromChanged(f);
@@ -1441,7 +1441,7 @@ qreal QmlNumericAnimation::to() const
void QmlNumericAnimation::setTo(qreal t)
{
Q_D(QmlNumericAnimation);
- if(!d->to.isNull && t == d->to)
+ if (!d->to.isNull && t == d->to)
return;
d->to = t;
emit toChanged(t);
@@ -1513,7 +1513,7 @@ QString QmlNumericAnimation::easing() const
void QmlNumericAnimation::setEasing(const QString &e)
{
Q_D(QmlNumericAnimation);
- if(d->easing == e)
+ if (d->easing == e)
return;
d->easing = e;
@@ -1544,7 +1544,7 @@ QString QmlNumericAnimation::properties() const
void QmlNumericAnimation::setProperties(const QString &prop)
{
Q_D(QmlNumericAnimation);
- if(d->properties == prop)
+ if (d->properties == prop)
return;
d->properties = prop;
@@ -1556,7 +1556,7 @@ void QmlNumericAnimation::setProperties(const QString &prop)
This property holds the items selected to be affected by this animation (all if not set).
\sa exclude
*/
-QList<QObject *> *QmlNumericAnimation::filter()
+QList<QObject *> *QmlNumericAnimation::filter()
{
Q_D(QmlNumericAnimation);
return &d->filter;
@@ -1575,8 +1575,8 @@ QList<QObject *> *QmlNumericAnimation::exclude()
void QmlNumericAnimationPrivate::valueChanged(qreal r)
{
- if(!fromSourced) {
- if(from.isNull) {
+ if (!fromSourced) {
+ if (from.isNull) {
fromValue = qvariant_cast<qreal>(property.read());
} else {
fromValue = from;
@@ -1584,7 +1584,7 @@ void QmlNumericAnimationPrivate::valueChanged(qreal r)
fromSourced = true;
}
- if(r == 1.) {
+ if (r == 1.) {
property.write(to.value);
} else {
qreal val = fromValue + (to-fromValue) * r;
@@ -1595,7 +1595,7 @@ void QmlNumericAnimationPrivate::valueChanged(qreal r)
void QmlNumericAnimation::prepare(QmlMetaProperty &p)
{
Q_D(QmlNumericAnimation);
- if(d->userProperty.isNull)
+ if (d->userProperty.isNull)
d->property = p;
else
d->property = d->userProperty;
@@ -1623,16 +1623,16 @@ void QmlNumericAnimation::transition(QmlStateActions &actions,
void setValue(qreal v)
{
QmlTimeLineValue::setValue(v);
- for(int ii = 0; ii < actions.count(); ++ii) {
+ for (int ii = 0; ii < actions.count(); ++ii) {
Action &action = actions[ii];
QmlBehaviour::_ignore = true;
- if(v == 1.)
+ if (v == 1.)
action.property.write(action.toValue.toDouble());
else {
- if(action.fromValue.isNull()) {
+ if (action.fromValue.isNull()) {
action.fromValue = action.property.read();
- if(action.fromValue.isNull()) {
+ if (action.fromValue.isNull()) {
action.fromValue = QVariant(0.);
}
}
@@ -1647,31 +1647,31 @@ void QmlNumericAnimation::transition(QmlStateActions &actions,
};
QStringList props = d->properties.split(QLatin1Char(','));
- for(int ii = 0; ii < props.count(); ++ii)
+ for (int ii = 0; ii < props.count(); ++ii)
props[ii] = props.at(ii).trimmed();
- if(!d->propertyName.isEmpty() && !props.contains(d->propertyName))
+ if (!d->propertyName.isEmpty() && !props.contains(d->propertyName))
props.append(d->propertyName);
NTransitionData *data = new NTransitionData;
QSet<QObject *> objs;
- for(int ii = 0; ii < actions.count(); ++ii) {
+ for (int ii = 0; ii < actions.count(); ++ii) {
Action &action = actions[ii];
QObject *obj = action.property.object();
QString propertyName = action.property.name();
- if((d->filter.isEmpty() || d->filter.contains(obj)) &&
+ if ((d->filter.isEmpty() || d->filter.contains(obj)) &&
(!d->exclude.contains(obj)) && props.contains(propertyName) &&
(!target() || target() == obj)) {
objs.insert(obj);
Action myAction = action;
- if(d->from.isValid()) {
+ if (d->from.isValid()) {
myAction.fromValue = QVariant(d->from);
} else {
myAction.fromValue = QVariant();
}
- if(d->to.isValid())
+ if (d->to.isValid())
myAction.toValue = QVariant(d->to);
modified << action.property;
@@ -1681,13 +1681,13 @@ void QmlNumericAnimation::transition(QmlStateActions &actions,
}
}
- if(d->to.isValid() && target() && !objs.contains(target())) {
+ if (d->to.isValid() && target() && !objs.contains(target())) {
QObject *obj = target();
- for(int jj = 0; jj < props.count(); ++jj) {
+ for (int jj = 0; jj < props.count(); ++jj) {
Action myAction;
myAction.property = QmlMetaProperty(obj, props.at(jj));
- if(d->from.isValid())
+ if (d->from.isValid())
myAction.fromValue = QVariant(d->from);
myAction.toValue = QVariant(d->to);
@@ -1697,7 +1697,7 @@ void QmlNumericAnimation::transition(QmlStateActions &actions,
}
}
- if(data->actions.count()) {
+ if (data->actions.count()) {
d->na->setAnimValue(data, QAbstractAnimation::DeleteWhenStopped);
} else {
delete data;
@@ -1755,7 +1755,7 @@ QmlSequentialAnimation::~QmlSequentialAnimation()
void QmlSequentialAnimation::prepare(QmlMetaProperty &p)
{
Q_D(QmlAnimationGroup);
- if(d->userProperty.isNull)
+ if (d->userProperty.isNull)
d->property = p;
else
d->property = d->userProperty;
@@ -1778,7 +1778,7 @@ void QmlSequentialAnimation::transition(QmlStateActions &actions,
int inc = 1;
int from = 0;
- if(direction == Backward) {
+ if (direction == Backward) {
inc = -1;
from = d->animations.count() - 1;
}
@@ -1787,7 +1787,7 @@ void QmlSequentialAnimation::transition(QmlStateActions &actions,
for (int i = d->ag->animationCount()-1; i >= 0; --i)
d->ag->takeAnimationAt(i);
- for(int ii = from; ii < d->animations.count() && ii >= 0; ii += inc) {
+ for (int ii = from; ii < d->animations.count() && ii >= 0; ii += inc) {
d->animations.at(ii)->transition(actions, modified, direction);
d->ag->addAnimation(d->animations.at(ii)->qtAnimation());
}
@@ -1805,7 +1805,7 @@ QML_DEFINE_TYPE(QmlSequentialAnimation,SequentialAnimation);
Animations contained in ParallelAnimation will be run at the same time.
- The following animation demonstrates animating the \c MyItem item
+ The following animation demonstrates animating the \c MyItem item
to (100,100) by animating the x and y properties in parallel.
\code
@@ -1846,7 +1846,7 @@ QmlParallelAnimation::~QmlParallelAnimation()
void QmlParallelAnimation::prepare(QmlMetaProperty &p)
{
Q_D(QmlAnimationGroup);
- if(d->userProperty.isNull)
+ if (d->userProperty.isNull)
d->property = p;
else
d->property = d->userProperty;
@@ -1867,7 +1867,7 @@ void QmlParallelAnimation::transition(QmlStateActions &actions,
{
Q_D(QmlAnimationGroup);
- for(int ii = 0; ii < d->animations.count(); ++ii) {
+ for (int ii = 0; ii < d->animations.count(); ++ii) {
d->animations.at(ii)->transition(actions, modified, direction);
}
}
@@ -1976,13 +1976,13 @@ int QmlVariantAnimation::duration() const
void QmlVariantAnimation::setDuration(int duration)
{
- if(duration < 0) {
+ if (duration < 0) {
qWarning("QmlVariantAnimation: Cannot set a duration of < 0");
return;
}
Q_D(QmlVariantAnimation);
- if(d->va->duration() == duration)
+ if (d->va->duration() == duration)
return;
d->va->setDuration(duration);
emit durationChanged(duration);
@@ -2006,7 +2006,7 @@ QVariant QmlVariantAnimation::from() const
void QmlVariantAnimation::setFrom(const QVariant &f)
{
Q_D(QmlVariantAnimation);
- if(!d->from.isNull && f == d->from)
+ if (!d->from.isNull && f == d->from)
return;
d->from = f;
emit fromChanged(f);
@@ -2030,7 +2030,7 @@ QVariant QmlVariantAnimation::to() const
void QmlVariantAnimation::setTo(const QVariant &t)
{
Q_D(QmlVariantAnimation);
- if(!d->to.isNull && t == d->to)
+ if (!d->to.isNull && t == d->to)
return;
d->to = t;
emit toChanged(t);
@@ -2059,7 +2059,7 @@ QString QmlVariantAnimation::easing() const
void QmlVariantAnimation::setEasing(const QString &e)
{
Q_D(QmlVariantAnimation);
- if(d->easing == e)
+ if (d->easing == e)
return;
d->easing = e;
@@ -2090,7 +2090,7 @@ QString QmlVariantAnimation::properties() const
void QmlVariantAnimation::setProperties(const QString &prop)
{
Q_D(QmlVariantAnimation);
- if(d->properties == prop)
+ if (d->properties == prop)
return;
d->properties = prop;
@@ -2121,8 +2121,8 @@ QList<QObject *> *QmlVariantAnimation::exclude()
void QmlVariantAnimationPrivate::valueChanged(qreal r)
{
- if(!fromSourced) {
- if(from.isNull) {
+ if (!fromSourced) {
+ if (from.isNull) {
fromValue = property.read();
} else {
fromValue = from;
@@ -2130,7 +2130,7 @@ void QmlVariantAnimationPrivate::valueChanged(qreal r)
fromSourced = true;
}
- if(r == 1.) {
+ if (r == 1.) {
property.write(to.value);
} else {
QVariant val = interpolateVariant(fromValue, to.value, r);
@@ -2147,7 +2147,7 @@ QAbstractAnimation *QmlVariantAnimation::qtAnimation()
void QmlVariantAnimation::prepare(QmlMetaProperty &p)
{
Q_D(QmlVariantAnimation);
- if(d->userProperty.isNull)
+ if (d->userProperty.isNull)
d->property = p;
else
d->property = d->userProperty;
@@ -2174,15 +2174,15 @@ void QmlVariantAnimation::transition(QmlStateActions &actions,
void setValue(qreal v)
{
QmlTimeLineValue::setValue(v);
- for(int ii = 0; ii < actions.count(); ++ii) {
+ for (int ii = 0; ii < actions.count(); ++ii) {
Action &action = actions[ii];
- if(v == 1.)
+ if (v == 1.)
action.property.write(action.toValue);
else {
- if(action.fromValue.isNull()) {
+ if (action.fromValue.isNull()) {
action.fromValue = action.property.read();
- /*if(action.fromValue.isNull())
+ /*if (action.fromValue.isNull())
action.fromValue = QVariant(0.);*/ //XXX can we give a default value for any type?
}
QVariant val = QmlVariantAnimationPrivate::interpolateVariant(action.fromValue, action.toValue, v);
@@ -2193,29 +2193,32 @@ void QmlVariantAnimation::transition(QmlStateActions &actions,
};
QStringList props = d->properties.split(QLatin1Char(','));
- for(int ii = 0; ii < props.count(); ++ii)
+ for (int ii = 0; ii < props.count(); ++ii)
props[ii] = props.at(ii).trimmed();
- if(!d->propertyName.isEmpty() && !props.contains(d->propertyName))
+ if (!d->propertyName.isEmpty() && !props.contains(d->propertyName))
props.append(d->propertyName);
NTransitionData *data = new NTransitionData;
QSet<QObject *> objs;
- for(int ii = 0; ii < actions.count(); ++ii) {
+ for (int ii = 0; ii < actions.count(); ++ii) {
Action &action = actions[ii];
QObject *obj = action.property.object();
QString propertyName = action.property.name();
- if((d->filter.isEmpty() || d->filter.contains(obj)) &&
+ if ((d->filter.isEmpty() || d->filter.contains(obj)) &&
(!d->exclude.contains(obj)) && props.contains(propertyName) &&
(!target() || target() == obj)) {
objs.insert(obj);
Action myAction = action;
- if(d->from.isValid())
+ if (d->from.isValid()) {
myAction.fromValue = QVariant(d->from);
- if(d->to.isValid())
+ } else {
+ myAction.fromValue = QVariant();
+ }
+ if (d->to.isValid())
myAction.toValue = QVariant(d->to);
d->convertVariant(myAction.fromValue, (QVariant::Type)myAction.property.propertyType());
@@ -2228,13 +2231,13 @@ void QmlVariantAnimation::transition(QmlStateActions &actions,
}
}
- if(d->to.isValid() && target() && !objs.contains(target())) {
+ if (d->to.isValid() && target() && !objs.contains(target())) {
QObject *obj = target();
- for(int jj = 0; jj < props.count(); ++jj) {
+ for (int jj = 0; jj < props.count(); ++jj) {
Action myAction;
myAction.property = QmlMetaProperty(obj, props.at(jj));
- if(d->from.isValid()) {
+ if (d->from.isValid()) {
d->convertVariant(d->from.value, (QVariant::Type)myAction.property.propertyType());
myAction.fromValue = QVariant(d->from);
}
@@ -2247,7 +2250,7 @@ void QmlVariantAnimation::transition(QmlStateActions &actions,
}
}
- if(data->actions.count()) {
+ if (data->actions.count()) {
d->va->setAnimValue(data, QAbstractAnimation::DeleteWhenStopped);
} else {
delete data;
@@ -2257,5 +2260,4 @@ void QmlVariantAnimation::transition(QmlStateActions &actions,
//XXX whats the best name for this? (just Animation?)
QML_DEFINE_TYPE(QmlVariantAnimation,VariantAnimation);
-
QT_END_NAMESPACE
diff --git a/src/declarative/util/qmlanimation_p.h b/src/declarative/util/qmlanimation_p.h
index 80cc7f7..728584c 100644
--- a/src/declarative/util/qmlanimation_p.h
+++ b/src/declarative/util/qmlanimation_p.h
@@ -334,7 +334,7 @@ public:
QmlAnimationGroupPrivate *anim;
};
-
+
AnimationList animations;
QAnimationGroup *ag;
};
diff --git a/src/declarative/util/qmlbehaviour.cpp b/src/declarative/util/qmlbehaviour.cpp
index 3fff06c..58e515f 100644
--- a/src/declarative/util/qmlbehaviour.cpp
+++ b/src/declarative/util/qmlbehaviour.cpp
@@ -182,12 +182,12 @@ bool QmlBehaviour::_ignore = false;
void QmlBehaviour::propertyValueChanged()
{
Q_D(QmlBehaviour);
- if(_ignore)
+ if (_ignore)
return;
QVariant newValue = d->property.read();
- if((!fromValue().isValid() || fromValue() == d->currentValue) &&
+ if ((!fromValue().isValid() || fromValue() == d->currentValue) &&
(!toValue().isValid() || toValue() == newValue)) {
//### does this clean up everything needed?
@@ -208,11 +208,11 @@ void QmlBehaviour::propertyValueChanged()
d->property.write(d->currentValue);
QList<QmlMetaProperty> after;
- for(int ii = 0; ii < d->operations.count(); ++ii) {
+ for (int ii = 0; ii < d->operations.count(); ++ii) {
d->operations.at(ii)->transition(actions, after, QmlAbstractAnimation::Forward);
}
d->group->start();
- if(!after.contains(d->property))
+ if (!after.contains(d->property))
d->property.write(newValue);
_ignore = false;
}
@@ -231,7 +231,7 @@ void QmlBehaviour::setTarget(const QmlMetaProperty &property)
void QmlBehaviour::classBegin()
{
Q_D(QmlBehaviour);
- if(!d->context) {
+ if (!d->context) {
d->context = new QmlContext(qmlContext(this), this);
d->context->addDefaultObject(d->valueData);
}
diff --git a/src/declarative/util/qmlbind.cpp b/src/declarative/util/qmlbind.cpp
index 4451ca2..3b51c6a 100644
--- a/src/declarative/util/qmlbind.cpp
+++ b/src/declarative/util/qmlbind.cpp
@@ -193,7 +193,7 @@ void QmlBind::setValue(const QVariant &v)
void QmlBind::eval()
{
Q_D(QmlBind);
- if(!d->obj || d->value.isNull || !d->when)
+ if (!d->obj || d->value.isNull || !d->when)
return;
QmlMetaProperty prop(d->obj, d->prop);
diff --git a/src/declarative/util/qmlconnection.cpp b/src/declarative/util/qmlconnection.cpp
index b2fd450..5cd4371 100644
--- a/src/declarative/util/qmlconnection.cpp
+++ b/src/declarative/util/qmlconnection.cpp
@@ -64,7 +64,7 @@ public:
\qmlclass Connection QmlConnection
\brief The Connection element describes generalized connections to signals.
- JavaScript-in-HTML style \l {qmlformatsignalscpp}{signal properties} do not allow:
+ JavaScript-in-HTML style signal properties do not allow:
\list
\i connecting to signals with the same name but different parameters
\i conformance checking that parameters are correctly named
@@ -165,7 +165,7 @@ void QmlConnection::connectIfValid()
QList<QByteArray> sigparams;
if (lparen >= 0 && d->signal.length() > lparen+2) {
QStringList l = d->signal.mid(lparen+1,d->signal.length()-lparen-2).split(QLatin1Char(','));
- foreach (QString s, l) {
+ foreach (const QString &s, l) {
sigparams.append(s.toLatin1());
}
}
@@ -173,12 +173,12 @@ void QmlConnection::connectIfValid()
QObject *sender = d->signalSender ? d->signalSender : parent();
const QMetaObject *mo = sender->metaObject();
int methods = mo->methodCount();
- for(int ii = 0; ii < methods; ++ii) {
+ for (int ii = 0; ii < methods; ++ii) {
QMetaMethod method = mo->method(ii);
QString methodName = QLatin1String(method.signature());
int idx = methodName.indexOf(QLatin1Char('('));
methodName = methodName.left(idx);
- if(methodName == signalname && (lparen<0 || method.parameterNames() == sigparams)) {
+ if (methodName == signalname && (lparen<0 || method.parameterNames() == sigparams)) {
sigIdx = ii;
break;
}
diff --git a/src/declarative/util/qmllistaccessor.cpp b/src/declarative/util/qmllistaccessor.cpp
index 9387bbc..da54b6e 100644
--- a/src/declarative/util/qmllistaccessor.cpp
+++ b/src/declarative/util/qmllistaccessor.cpp
@@ -64,20 +64,20 @@ void QmlListAccessor::setList(const QVariant &v)
{
d = v;
- if(!d.isValid()) {
+ if (!d.isValid()) {
type = Invalid;
- } else if(d.type() == QVariant::StringList) {
+ } else if (d.type() == QVariant::StringList) {
type = StringList;
- } else if(d.type() != QVariant::UserType) {
+ } else if (d.type() != QVariant::UserType) {
type = Instance;
- } else if(QmlMetaType::isObject(d.userType())) {
+ } else if (QmlMetaType::isObject(d.userType())) {
QObject *data = 0;
data = *(QObject **)v.constData();
d = QVariant::fromValue(data);
type = Instance;
- } else if(QmlMetaType::isQmlList(d.userType())) {
+ } else if (QmlMetaType::isQmlList(d.userType())) {
type = QmlList;
- } else if(QmlMetaType::isList(d.userType())) {
+ } else if (QmlMetaType::isList(d.userType())) {
type = QList;
} else {
type = Invalid;
diff --git a/src/declarative/util/qmllistmodel.cpp b/src/declarative/util/qmllistmodel.cpp
index 24f2d5c..54aea2c 100644
--- a/src/declarative/util/qmllistmodel.cpp
+++ b/src/declarative/util/qmllistmodel.cpp
@@ -70,7 +70,7 @@ public:
{
type = QmlListModel::Invalid;
model = QVariant();
- if(listModelInterface)
+ if (listModelInterface)
listModelInterface->disconnect(q);
listModelInterface = 0;
singleObject = 0;
@@ -80,11 +80,11 @@ public:
void updateRoleCache()
{
- if(roleCacheValid)
+ if (roleCacheValid)
return;
roleCacheValid = true;
- if(type == QmlListModel::SingleObject)
+ if (type == QmlListModel::SingleObject)
roleCache = QmlMetaProperty::properties(singleObject);
}
@@ -164,7 +164,7 @@ bool QmlListModel::setModel(const QVariant &model)
d->clear();
QListModelInterface *iface = qvariant_cast<QListModelInterface *>(model);
- if(iface) {
+ if (iface) {
QObject::connect(iface, SIGNAL(itemsInserted(int,int)),
this, SIGNAL(itemsInserted(int,int)));
QObject::connect(iface, SIGNAL(itemsRemoved(int,int)),
@@ -180,14 +180,14 @@ bool QmlListModel::setModel(const QVariant &model)
}
QObject *object = qvariant_cast<QObject *>(model);
- if(object) {
+ if (object) {
d->singleObject = object;
d->type = SingleObject;
d->model = model;
return true;
}
- if(QmlMetaType::isList(model)) {
+ if (QmlMetaType::isList(model)) {
d->type = SimpleList;
d->model = model;
return true;
@@ -214,7 +214,7 @@ QList<int> QmlListModel::roles() const
case SingleObject:
{
QList<int> rv;
- for(int ii = 0; ii < d->roleCache.count(); ++ii)
+ for (int ii = 0; ii < d->roleCache.count(); ++ii)
rv << ii;
return rv;
}
@@ -230,14 +230,14 @@ QString QmlListModel::toString(int role) const
case Invalid:
return QString();
case SimpleList:
- if(role == DATA_ROLE_ID)
+ if (role == DATA_ROLE_ID)
return QLatin1String(DATA_ROLE_NAME);
else
return QString();
case ListInterface:
return d->listModelInterface->toString(role);
case SingleObject:
- if(role >= d->roleCache.count())
+ if (role >= d->roleCache.count())
return QString();
else
return d->roleCache.at(role);
@@ -272,14 +272,14 @@ QHash<int,QVariant> QmlListModel::data(int index, const QList<int> &roles) const
case Invalid:
break;
case SimpleList:
- if(roles.contains(DATA_ROLE_ID))
+ if (roles.contains(DATA_ROLE_ID))
rv.insert(DATA_ROLE_ID, QmlMetaType::listAt(d->model, index));
break;
case ListInterface:
return d->listModelInterface->data(index, roles);
case SingleObject:
{
- for(int ii = 0; ii < roles.count(); ++ii) {
+ for (int ii = 0; ii < roles.count(); ++ii) {
QmlMetaProperty prop(d->singleObject, toString(roles.at(ii)));
rv.insert(roles.at(ii), prop.read());
}
@@ -344,7 +344,7 @@ struct ModelNode
QHash<QString, ModelNode *> properties;
ListModel *model() {
- if(!modelCache) {
+ if (!modelCache) {
modelCache = new ListModel;
modelCache->_root = this;
}
@@ -352,7 +352,7 @@ struct ModelNode
}
ModelObject *object() {
- if(!objectCache) {
+ if (!objectCache) {
objectCache = new ModelObject(this);
QHash<QString, ModelNode *>::iterator it;
for (it = properties.begin(); it != properties.end(); ++it) {
@@ -382,13 +382,13 @@ ListModel::ListModel(QObject *parent)
void ListModel::checkRoles() const
{
- if(_rolesOk)
+ if (_rolesOk)
return;
- for(int ii = 0; ii < _root->values.count(); ++ii) {
+ for (int ii = 0; ii < _root->values.count(); ++ii) {
ModelNode *node = qvariant_cast<ModelNode *>(_root->values.at(ii));
- if(node) {
- foreach(QString role, node->properties.keys())
+ if (node) {
+ foreach (const QString &role, node->properties.keys())
addRole(role);
}
}
@@ -398,7 +398,7 @@ void ListModel::checkRoles() const
void ListModel::addRole(const QString &role) const
{
- if(!roleStrings.contains(role))
+ if (!roleStrings.contains(role))
roleStrings << role;
}
@@ -406,7 +406,7 @@ QList<int> ListModel::roles() const
{
checkRoles();
QList<int> rv;
- for(int ii = 0; ii < roleStrings.count(); ++ii)
+ for (int ii = 0; ii < roleStrings.count(); ++ii)
rv << ii;
return rv;
}
@@ -414,7 +414,7 @@ QList<int> ListModel::roles() const
QString ListModel::toString(int role) const
{
checkRoles();
- if(role < roleStrings.count())
+ if (role < roleStrings.count())
return roleStrings.at(role);
else
return QString();
@@ -424,30 +424,30 @@ QVariant ListModel::valueForNode(ModelNode *node) const
{
QObject *rv = 0;
- if(!node->properties.isEmpty()) {
+ if (!node->properties.isEmpty()) {
// Object
rv = node->object();
- } else if(node->values.count() == 0) {
+ } else if (node->values.count() == 0) {
// Invalid
return QVariant();
- } else if(node->values.count() == 1) {
+ } else if (node->values.count() == 1) {
// Value
QVariant &var = node->values[0];
ModelNode *valueNode = qvariant_cast<ModelNode *>(var);
- if(valueNode) {
- if(!valueNode->properties.isEmpty())
+ if (valueNode) {
+ if (!valueNode->properties.isEmpty())
rv = valueNode->object();
else
rv = valueNode->model();
} else {
return var;
}
- } else if(node->values.count() > 1) {
+ } else if (node->values.count() > 1) {
// List
rv = node->model();
}
- if(rv)
+ if (rv)
return QVariant::fromValue(rv);
else
return QVariant();
@@ -457,19 +457,19 @@ QHash<int,QVariant> ListModel::data(int index, const QList<int> &roles) const
{
checkRoles();
QHash<int, QVariant> rv;
- if(index >= count())
+ if (index >= count())
return rv;
ModelNode *node = qvariant_cast<ModelNode *>(_root->values.at(index));
- if(!node)
+ if (!node)
return rv;
- for(int ii = 0; ii < roles.count(); ++ii) {
+ for (int ii = 0; ii < roles.count(); ++ii) {
const QString &roleString = roleStrings.at(roles.at(ii));
QHash<QString, ModelNode *>::ConstIterator iter =
node->properties.find(roleString);
- if(iter != node->properties.end()) {
+ if (iter != node->properties.end()) {
ModelNode *row = *iter;
rv.insert(roles.at(ii), valueForNode(row));
}
@@ -480,7 +480,7 @@ QHash<int,QVariant> ListModel::data(int index, const QList<int> &roles) const
int ListModel::count() const
{
- if(!_root) return 0;
+ if (!_root) return 0;
return _root->values.count();
}
@@ -503,9 +503,9 @@ static void dump(ModelNode *node, int ind)
QByteArray indentBa(ind * 4, ' ');
const char *indent = indentBa.constData();
- for(int ii = 0; ii < node->values.count(); ++ii) {
+ for (int ii = 0; ii < node->values.count(); ++ii) {
ModelNode *subNode = qvariant_cast<ModelNode *>(node->values.at(ii));
- if(subNode) {
+ if (subNode) {
qWarning().nospace() << indent << "Sub-node " << ii << ": class " << subNode->className;
dump(subNode, ind + 1);
} else {
@@ -513,7 +513,7 @@ static void dump(ModelNode *node, int ind)
}
}
- for(QHash<QString, ModelNode *>::ConstIterator iter = node->properties.begin(); iter != node->properties.end(); ++iter) {
+ for (QHash<QString, ModelNode *>::ConstIterator iter = node->properties.begin(); iter != node->properties.end(); ++iter) {
qWarning().nospace() << indent << "Property " << iter.key() << ":";
dump(iter.value(), ind + 1);
}
@@ -527,11 +527,11 @@ ModelNode::ModelNode()
ModelNode::~ModelNode()
{
qDeleteAll(properties);
- for(int ii = 0; ii < values.count(); ++ii) {
+ for (int ii = 0; ii < values.count(); ++ii) {
ModelNode *node = qvariant_cast<ModelNode *>(values.at(ii));
- if(node) { delete node; node = 0; }
+ if (node) { delete node; node = 0; }
}
- if(modelCache) { delete modelCache; modelCache = 0; }
+ if (modelCache) { delete modelCache; modelCache = 0; }
}
struct ListModelData
@@ -650,7 +650,7 @@ QByteArray ListModelParser::compile(QXmlStreamReader& reader, bool *ok)
lmd->dataOffset = sizeof(ListModelData) +
instr.count() * sizeof(ListInstruction);
lmd->instrCount = instr.count();
- for(int ii = 0; ii < instr.count(); ++ii)
+ for (int ii = 0; ii < instr.count(); ++ii)
lmd->instructions()[ii] = instr.at(ii);
::memcpy(rv.data() + lmd->dataOffset, data.constData(), data.count());
@@ -668,7 +668,7 @@ QVariant ListModelParser::create(const QByteArray &d)
const ListModelData *lmd = (const ListModelData *)d.constData();
const char *data = ((const char *)lmd) + lmd->dataOffset;
- for(int ii = 0; ii < lmd->instrCount; ++ii) {
+ for (int ii = 0; ii < lmd->instrCount; ++ii) {
const ListInstruction &instr = lmd->instructions()[ii];
switch(instr.type) {
diff --git a/src/declarative/util/qmlopenmetaobject.cpp b/src/declarative/util/qmlopenmetaobject.cpp
index 09d71bd..87d8f4d 100644
--- a/src/declarative/util/qmlopenmetaobject.cpp
+++ b/src/declarative/util/qmlopenmetaobject.cpp
@@ -51,7 +51,7 @@ QmlOpenMetaObject::QmlOpenMetaObject(QObject *obj, bool automatic)
mob.setFlags(QMetaObjectBuilder::DynamicMetaObject);
QObjectPrivate *op = QObjectPrivate::get(obj);
- if(op->metaObject)
+ if (op->metaObject)
mob.setSuperClass(op->metaObject);
mem = mob.toMetaObject();
@@ -63,21 +63,21 @@ QmlOpenMetaObject::QmlOpenMetaObject(QObject *obj, bool automatic)
QmlOpenMetaObject::~QmlOpenMetaObject()
{
- if(parent)
+ if (parent)
delete parent;
qFree(mem);
}
int QmlOpenMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
{
- if(( c == QMetaObject::ReadProperty || c == QMetaObject::WriteProperty)
+ if (( c == QMetaObject::ReadProperty || c == QMetaObject::WriteProperty)
&& id >= _propertyOffset) {
int propId = id - _propertyOffset;
- if(c == QMetaObject::ReadProperty) {
+ if (c == QMetaObject::ReadProperty) {
propertyRead(propId);
*reinterpret_cast<QVariant *>(a[0]) = data[propId];
- } else if(c == QMetaObject::WriteProperty) {
- if(data[propId] != *reinterpret_cast<QVariant *>(a[0])) {
+ } else if (c == QMetaObject::WriteProperty) {
+ if (data[propId] != *reinterpret_cast<QVariant *>(a[0])) {
propertyWrite(propId);
data[propId] = *reinterpret_cast<QVariant *>(a[0]);
activate(_object, _signalOffset + propId, 0);
@@ -85,7 +85,7 @@ int QmlOpenMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
}
return -1;
} else {
- if(parent)
+ if (parent)
return parent->metaCall(c, id, a);
else
return _object->qt_metacall(c, id, a);
@@ -108,7 +108,7 @@ void QmlOpenMetaObject::setValue(int id, const QVariant &value)
QVariant QmlOpenMetaObject::value(const QByteArray &name) const
{
QHash<QByteArray, int>::ConstIterator iter = names.find(name);
- if(iter == names.end())
+ if (iter == names.end())
return QVariant();
return data.at(*iter);
@@ -119,13 +119,13 @@ void QmlOpenMetaObject::setValue(const QByteArray &name, const QVariant &val)
QHash<QByteArray, int>::ConstIterator iter = names.find(name);
int id = -1;
- if(iter == names.end()) {
+ if (iter == names.end()) {
id = doCreateProperty(name.constData()) - _propertyOffset;
} else {
id = *iter;
}
- if(data[id] == val)
+ if (data[id] == val)
return;
data[id] = val;
@@ -134,7 +134,7 @@ void QmlOpenMetaObject::setValue(const QByteArray &name, const QVariant &val)
int QmlOpenMetaObject::createProperty(const char *name, const char *)
{
- if(autoCreate)
+ if (autoCreate)
return doCreateProperty(name);
else
return -1;
diff --git a/src/declarative/util/qmlpackage.cpp b/src/declarative/util/qmlpackage.cpp
index 264d186..aa7ed38 100644
--- a/src/declarative/util/qmlpackage.cpp
+++ b/src/declarative/util/qmlpackage.cpp
@@ -109,10 +109,10 @@ QmlList<QObject *> *QmlPackage::data()
bool QmlPackage::hasPart(const QString &name)
{
Q_D(QmlPackage);
- for(int ii = 0; ii < d->dataList.count(); ++ii) {
+ for (int ii = 0; ii < d->dataList.count(); ++ii) {
QObject *obj = d->dataList.at(ii);
QmlPackageAttached *a = QmlPackageAttached::attached.value(obj);
- if(a && a->name() == name)
+ if (a && a->name() == name)
return true;
}
return false;
@@ -121,17 +121,17 @@ bool QmlPackage::hasPart(const QString &name)
QObject *QmlPackage::part(const QString &name)
{
Q_D(QmlPackage);
- if(name.isEmpty() && !d->dataList.isEmpty())
+ if (name.isEmpty() && !d->dataList.isEmpty())
return d->dataList.at(0);
- for(int ii = 0; ii < d->dataList.count(); ++ii) {
+ for (int ii = 0; ii < d->dataList.count(); ++ii) {
QObject *obj = d->dataList.at(ii);
QmlPackageAttached *a = QmlPackageAttached::attached.value(obj);
- if(a && a->name() == name)
+ if (a && a->name() == name)
return obj;
}
- if(name == QLatin1String("default") && !d->dataList.isEmpty())
+ if (name == QLatin1String("default") && !d->dataList.isEmpty())
return d->dataList.at(0);
return 0;
diff --git a/src/declarative/util/qmlscript.cpp b/src/declarative/util/qmlscript.cpp
index 73c8c07..fbaf56e 100644
--- a/src/declarative/util/qmlscript.cpp
+++ b/src/declarative/util/qmlscript.cpp
@@ -194,7 +194,7 @@ void QmlScriptPrivate::addScriptToEngine(const QString &script, const QString &f
if (scriptEngine->hasUncaughtException()) {
if (scriptEngine->uncaughtException().isError()){
QScriptValue exception = scriptEngine->uncaughtException();
- if(!exception.property(QLatin1String("fileName")).toString().isEmpty()){
+ if (!exception.property(QLatin1String("fileName")).toString().isEmpty()){
qWarning() << exception.property(QLatin1String("fileName")).toString()
<< scriptEngine->uncaughtExceptionLineNumber()
<< exception.toString();
diff --git a/src/declarative/util/qmlsetproperties.cpp b/src/declarative/util/qmlsetproperties.cpp
index 61890b9..108f2b2 100644
--- a/src/declarative/util/qmlsetproperties.cpp
+++ b/src/declarative/util/qmlsetproperties.cpp
@@ -80,7 +80,7 @@ QmlSetPropertiesMetaObject::QmlSetPropertiesMetaObject(QObject *obj)
void QmlSetPropertiesMetaObject::propertyRead(int id)
{
- if(!value(id).isValid())
+ if (!value(id).isValid())
setValue(id, QVariant::fromValue((QObject *)new QmlSetPropertiesProxyObject(object())));
QmlOpenMetaObject::propertyRead(id);
@@ -88,10 +88,10 @@ void QmlSetPropertiesMetaObject::propertyRead(int id)
void QmlSetPropertiesMetaObject::propertyWrite(int id)
{
- if(value(id).userType() == qMetaTypeId<QObject *>()) {
+ if (value(id).userType() == qMetaTypeId<QObject *>()) {
QObject *val = qvariant_cast<QObject *>(value(id));
QmlSetPropertiesProxyObject *proxy = qobject_cast<QmlSetPropertiesProxyObject *>(val);
- if(proxy) {
+ if (proxy) {
setValue(id, QVariant());
delete proxy;
}
@@ -203,9 +203,9 @@ QmlSetProperties::doAction(QmlSetPropertiesMetaObject *metaObject,
QmlMetaProperty prop(object, QLatin1String(name));
- if(po) {
+ if (po) {
QObject *objVal = QmlMetaType::toQObject(prop.read());
- if(!objVal) {
+ if (!objVal) {
qmlInfo(this) << object->metaObject()->className()
<< "has no object property named" << name;
continue;
diff --git a/src/declarative/util/qmlstate.cpp b/src/declarative/util/qmlstate.cpp
index 9b1b695..5850a97 100644
--- a/src/declarative/util/qmlstate.cpp
+++ b/src/declarative/util/qmlstate.cpp
@@ -170,7 +170,7 @@ void QmlState::setWhen(QmlBindableValue *when)
{
Q_D(QmlState);
d->when = when;
- if(d->group)
+ if (d->group)
d->group->updateAutoState();
}
@@ -238,10 +238,10 @@ QmlState &QmlState::operator<<(QmlStateOperation *op)
#if 0
static void dump(const QmlStateOperation::ActionList &list)
{
- if(!QString(getenv("STATE_DEBUG")).isEmpty())
+ if (!QString(getenv("STATE_DEBUG")).isEmpty())
return;
- for(int ii = 0; ii < list.count(); ++ii) {
+ for (int ii = 0; ii < list.count(); ++ii) {
const Action &action = list.at(ii);
qWarning() << action.property.object << action.property.name << action.toValue;
}
@@ -260,9 +260,9 @@ void QmlStatePrivate::complete()
}
//////////////////////////////////////////////////////////
- for(int ii = 0; ii < reverting.count(); ++ii) {
- for(int jj = 0; jj < revertList.count(); ++jj) {
- if(revertList.at(jj).property == reverting.at(ii)) {
+ for (int ii = 0; ii < reverting.count(); ++ii) {
+ for (int jj = 0; jj < revertList.count(); ++jj) {
+ if (revertList.at(jj).property == reverting.at(ii)) {
revertList.removeAt(jj);
break;
}
@@ -270,7 +270,7 @@ void QmlStatePrivate::complete()
}
reverting.clear();
- for(int ii = 0; ii < completeList.count(); ++ii) {
+ for (int ii = 0; ii < completeList.count(); ++ii) {
const QmlMetaProperty &prop = completeList.at(ii).property;
prop.write(completeList.at(ii).value);
}
@@ -283,15 +283,15 @@ void QmlStatePrivate::complete()
QmlStateOperation::ActionList QmlStatePrivate::generateActionList(QmlStateGroup *group) const
{
QmlStateOperation::ActionList applyList;
- if(inState)
+ if (inState)
return applyList;
inState = true;
- if(!extends.isEmpty()) {
+ if (!extends.isEmpty()) {
QList<QmlState *> states = group->states();
- for(int ii = 0; ii < states.count(); ++ii)
- if(states.at(ii)->name() == extends)
+ for (int ii = 0; ii < states.count(); ++ii)
+ if (states.at(ii)->name() == extends)
applyList = static_cast<QmlStatePrivate*>(states.at(ii)->d_ptr)->generateActionList(group);
}
@@ -328,41 +328,41 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
Q_D(QmlState);
cancel();
- if(revert)
+ if (revert)
revert->cancel();
d->revertList.clear();
d->reverting.clear();
d->bindingsList.clear();
- if(revert)
+ if (revert)
d->revertList = static_cast<QmlStatePrivate*>(revert->d_ptr)->revertList;
QmlStateOperation::RevertActionList additionalReverts;
QmlStateOperation::ActionList applyList = d->generateActionList(group);
- for(int ii = 0; ii < applyList.count(); ++ii) {
+ for (int ii = 0; ii < applyList.count(); ++ii) {
const Action &action = applyList.at(ii);
- if(action.event)
+ if (action.event)
continue;
bool found = false;
- for(int jj = 0; !found && jj < d->revertList.count(); ++jj) {
- if(d->revertList.at(jj).property == action.property)
+ for (int jj = 0; !found && jj < d->revertList.count(); ++jj) {
+ if (d->revertList.at(jj).property == action.property)
found = true;
}
- if(!found) {
+ if (!found) {
RevertAction r(action);
additionalReverts << r;
}
}
- for(int ii = 0; ii < d->revertList.count(); ++ii) {
+ for (int ii = 0; ii < d->revertList.count(); ++ii) {
bool found = false;
- for(int jj = 0; !found && jj < applyList.count(); ++jj) {
+ for (int jj = 0; !found && jj < applyList.count(); ++jj) {
const Action &action = applyList.at(jj);
- if(action.property == d->revertList.at(ii).property)
+ if (action.property == d->revertList.at(ii).property)
found = true;
}
- if(!found) {
+ if (!found) {
QVariant cur = d->revertList.at(ii).property.read();
Action a;
a.property = d->revertList.at(ii).property;
@@ -384,7 +384,7 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
//### 4 foreach loops!
////////////////////////////////////////////////////////////////////
foreach(const Action &action, applyList) {
- if(stateChangeDebug())
+ if (stateChangeDebug())
qWarning() << " Action:" << action.property.object() << action.property.name() << action.toValue;
if (action.bv && !action.toBinding.isEmpty()) {
@@ -397,14 +397,14 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
foreach(const Action &action, applyList) {
if (action.bv && !action.toBinding.isEmpty()) {
action.bv->setExpression(action.toBinding);
- } else if(!action.event) {
+ } else if (!action.event) {
action.property.write(action.toValue);
}
}
for (int ii = 0; ii < applyList.size(); ++ii) {
Action *action = &applyList[ii];
- if(action->event)
+ if (action->event)
continue;
const QmlMetaProperty &prop = action->property;
@@ -414,7 +414,7 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
}
foreach(const Action &action, applyList) {
- if(action.event)
+ if (action.event)
continue;
if (action.bv && !action.toBinding.isEmpty())
@@ -427,23 +427,23 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
QmlStateOperation::ActionList modList = applyList;
QList<QmlMetaProperty> touched;
d->completeList.clear();
- if(trans) {
+ if (trans) {
d->transition = trans;
trans->prepare(modList, touched, this);
- for(int ii = 0; ii < modList.count(); ++ii) {
+ for (int ii = 0; ii < modList.count(); ++ii) {
const Action &action = modList.at(ii);
- if(action.event) {
- if(action.actionDone) {
+ if (action.event) {
+ if (action.actionDone) {
modList.removeAt(ii);
--ii;
}
} else {
- if(action.toValue != action.fromValue) {
+ if (action.toValue != action.fromValue) {
d->completeList << RevertAction(action, false);
}
- if(touched.contains(action.property)) {
+ if (touched.contains(action.property)) {
modList.removeAt(ii);
--ii;
}
@@ -452,7 +452,7 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
}
foreach(const Action &action, modList) {
- if(action.event)
+ if (action.event)
action.event->execute();
else
action.property.write(action.toValue);
diff --git a/src/declarative/util/qmlstategroup.cpp b/src/declarative/util/qmlstategroup.cpp
index 36fea4e..cabef63 100644
--- a/src/declarative/util/qmlstategroup.cpp
+++ b/src/declarative/util/qmlstategroup.cpp
@@ -68,7 +68,7 @@ public:
:group(g) {}
void append(QmlState *s) {
QmlConcreteList<QmlState *>::append(s);
- if(s) s->setStateGroup(group);
+ if (s) s->setStateGroup(group);
}
private:
QmlStateGroup *group;
@@ -121,7 +121,7 @@ QString QmlStateGroup::state() const
void QmlStateGroup::setState(const QString &state)
{
Q_D(QmlStateGroup);
- if(d->currentState == state)
+ if (d->currentState == state)
return;
d->setCurrentStateInternal(state);
@@ -152,27 +152,27 @@ void QmlStateGroup::updateAutoState()
void QmlStateGroupPrivate::updateAutoState()
{
Q_Q(QmlStateGroup);
- if(!classComplete)
+ if (!classComplete)
return;
bool revert = false;
- for(int ii = 0; ii < states.count(); ++ii) {
+ for (int ii = 0; ii < states.count(); ++ii) {
QmlState *state = states.at(ii);
- if(state->isWhenKnown()) {
- if(!state->name().isEmpty()) {
- if(state->when() && state->when()->value().toBool()) {
- if(stateChangeDebug())
+ if (state->isWhenKnown()) {
+ if (!state->name().isEmpty()) {
+ if (state->when() && state->when()->value().toBool()) {
+ if (stateChangeDebug())
qWarning() << "Setting auto state due to:"
<< state->when()->expression();
q->setState(state->name());
return;
- } else if(state->name() == currentState) {
+ } else if (state->name() == currentState) {
revert = true;
}
}
}
}
- if(revert)
+ if (revert)
q->setState(QString());
}
@@ -183,11 +183,11 @@ QmlTransition *QmlStateGroupPrivate::findTransition(const QString &from, const Q
bool reversed = false;
bool done = false;
- for(int ii = 0; !done && ii < transitions.count(); ++ii) {
+ for (int ii = 0; !done && ii < transitions.count(); ++ii) {
QmlTransition *t = transitions.at(ii);
- for(int ii = 0; ii < 2; ++ii)
+ for (int ii = 0; ii < 2; ++ii)
{
- if(ii && (!t->reversible() ||
+ if (ii && (!t->reversible() ||
(t->fromState() == QLatin1String("*") &&
t->toState() == QLatin1String("*"))))
break;
@@ -196,40 +196,40 @@ QmlTransition *QmlStateGroupPrivate::findTransition(const QString &from, const Q
fromState = t->fromState().split(QLatin1Char(','));
toState = t->toState().split(QLatin1Char(','));
- if(ii == 1)
+ if (ii == 1)
qSwap(fromState, toState);
int tScore = 0;
- if(fromState.contains(from))
+ if (fromState.contains(from))
tScore += 2;
- else if(fromState.contains(QLatin1String("*")))
+ else if (fromState.contains(QLatin1String("*")))
tScore += 1;
else
continue;
- if(toState.contains(to))
+ if (toState.contains(to))
tScore += 2;
- else if(toState.contains(QLatin1String("*")))
+ else if (toState.contains(QLatin1String("*")))
tScore += 1;
else
continue;
- if(ii == 1)
+ if (ii == 1)
reversed = true;
else
reversed = false;
- if(tScore == 4) {
+ if (tScore == 4) {
highest = t;
done = true;
break;
- } else if(tScore > score) {
+ } else if (tScore > score) {
score = tScore;
highest = t;
}
}
}
- if(highest)
+ if (highest)
highest->setReversed(reversed);
return highest;
@@ -239,21 +239,21 @@ void QmlStateGroupPrivate::setCurrentStateInternal(const QString &state,
bool ignoreTrans)
{
Q_Q(QmlStateGroup);
- if(!componentComplete)
+ if (!componentComplete)
return;
QmlTransition *transition = (ignoreTrans || ignoreTrans) ? 0 : findTransition(currentState, state);
- if(stateChangeDebug()) {
+ if (stateChangeDebug()) {
qWarning() << this << "Changing state. From" << currentState << ". To" << state;
- if(transition)
+ if (transition)
qWarning() << " using transition" << transition->fromState()
<< transition->toState();
}
QmlState *oldState = 0;
- if(!currentState.isEmpty()) {
- for(int ii = 0; ii < states.count(); ++ii) {
- if(states.at(ii)->name() == currentState) {
+ if (!currentState.isEmpty()) {
+ for (int ii = 0; ii < states.count(); ++ii) {
+ if (states.at(ii)->name() == currentState) {
oldState = states.at(ii);
break;
}
@@ -263,17 +263,17 @@ void QmlStateGroupPrivate::setCurrentStateInternal(const QString &state,
currentState = state;
QmlState *newState = 0;
- for(int ii = 0; ii < states.count(); ++ii) {
- if(states.at(ii)->name() == currentState) {
+ for (int ii = 0; ii < states.count(); ++ii) {
+ if (states.at(ii)->name() == currentState) {
newState = states.at(ii);
break;
}
}
- if(oldState == 0 || newState == 0) {
- if(!nullState) { nullState = new QmlState(q); }
- if(!oldState) oldState = nullState;
- if(!newState) newState = nullState;
+ if (oldState == 0 || newState == 0) {
+ if (!nullState) { nullState = new QmlState(q); }
+ if (!oldState) oldState = nullState;
+ if (!newState) newState = nullState;
}
newState->apply(q, transition, oldState);
@@ -284,7 +284,7 @@ void QmlStateGroup::componentComplete()
Q_D(QmlStateGroup);
d->updateAutoState();
d->componentComplete = true;
- if(!d->currentState.isEmpty()) {
+ if (!d->currentState.isEmpty()) {
QString cs = d->currentState;
d->currentState = QString();
d->setCurrentStateInternal(cs, true);
diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp
index c70977a..8a10ca3 100644
--- a/src/declarative/util/qmlstateoperations.cpp
+++ b/src/declarative/util/qmlstateoperations.cpp
@@ -109,7 +109,7 @@ void QmlParentChange::setParent(QObject *parent)
QmlStateOperation::ActionList QmlParentChange::actions()
{
Q_D(QmlParentChange);
- if(!d->target || !d->parent)
+ if (!d->target || !d->parent)
return ActionList();
QString propName(QLatin1String("moveToParent"));
@@ -118,7 +118,7 @@ QmlStateOperation::ActionList QmlParentChange::actions()
qmlInfo(this) << d->target->metaObject()->className()
<< "has no property named" << propName;
return ActionList();
- }else if(!prop.isWritable()){
+ }else if (!prop.isWritable()){
qmlInfo(this) << d->target->metaObject()->className() << propName
<< "is not a writable property and cannot be set.";
return ActionList();
@@ -187,7 +187,7 @@ void QmlRunScript::setName(const QString &n)
void QmlRunScript::execute()
{
Q_D(QmlRunScript);
- if(!d->script.isEmpty()) {
+ if (!d->script.isEmpty()) {
QmlExpression expr(qmlContext(this), d->script, this);
expr.setTrackChange(false);
expr.value();
@@ -354,7 +354,7 @@ void QmlSetProperty::setBinding(const QString &binding)
QmlSetProperty::ActionList QmlSetProperty::actions()
{
Q_D(QmlSetProperty);
- if(!d->obj)
+ if (!d->obj)
return ActionList();
QObject *obj = d->obj;
@@ -362,10 +362,10 @@ QmlSetProperty::ActionList QmlSetProperty::actions()
if (d->prop.contains(QLatin1Char('.'))) { //handle dot properties
QStringList str = d->prop.split(QLatin1Char('.'));
- for(int ii = 0; ii < str.count()-1; ++ii) {
+ for (int ii = 0; ii < str.count()-1; ++ii) {
const QString &s = str.at(ii);
QmlMetaProperty prop(obj, s);
- if(!prop.isValid()) {
+ if (!prop.isValid()) {
qmlInfo(this) << obj->metaObject()->className()
<< "has no property named" << s;
return ActionList();
@@ -386,7 +386,7 @@ QmlSetProperty::ActionList QmlSetProperty::actions()
qmlInfo(this) << obj->metaObject()->className()
<< "has no property named" << propName;
return ActionList();
- }else if(!prop.isWritable()){
+ }else if (!prop.isWritable()){
qmlInfo(this) << obj->metaObject()->className() << propName
<< "is not a writable property and cannot be set.";
return ActionList();
@@ -399,7 +399,7 @@ QmlSetProperty::ActionList QmlSetProperty::actions()
a.toValue = d->value;
if (!d->binding.isEmpty()) {
QmlBindableValue *bv = prop.binding();
- if(bv) {
+ if (bv) {
a.fromBinding = bv->expression();
a.bv = bv;
}
diff --git a/src/declarative/util/qmltransition.cpp b/src/declarative/util/qmltransition.cpp
index 181fdb9..a515f58 100644
--- a/src/declarative/util/qmltransition.cpp
+++ b/src/declarative/util/qmltransition.cpp
@@ -165,12 +165,12 @@ void QmlTransition::prepare(QmlStateOperation::ActionList &actions,
{
Q_D(QmlTransition);
- if(d->reversed) {
- for(int ii = d->operations.count() - 1; ii >= 0; --ii) {
+ if (d->reversed) {
+ for (int ii = d->operations.count() - 1; ii >= 0; --ii) {
d->operations.at(ii)->transition(actions, after, QmlAbstractAnimation::Backward);
}
} else {
- for(int ii = 0; ii < d->operations.count(); ++ii) {
+ for (int ii = 0; ii < d->operations.count(); ++ii) {
d->operations.at(ii)->transition(actions, after, QmlAbstractAnimation::Forward);
}
}
diff --git a/src/declarative/util/qperformancelog.cpp b/src/declarative/util/qperformancelog.cpp
index 52ccc0d..8065f9d 100644
--- a/src/declarative/util/qperformancelog.cpp
+++ b/src/declarative/util/qperformancelog.cpp
@@ -77,22 +77,22 @@ QPerformanceLog::LogData::LogData(const char *desc)
QPerformanceLog::LogMetric::LogMetric(LogData *l, int id, const char *desc)
{
- if(id < 0)
+ if (id < 0)
qFatal("QPerformanceLog: Invalid log id %d ('%s')", id, desc);
QPerformanceLogData *logData = performanceLogData();
QPerformanceLogData::Logs::Iterator logIter = logData->logs.find(l);
- if(logIter == logData->logs.end())
+ if (logIter == logData->logs.end())
qFatal("QPerformanceLog: Unable to locate log for metric '%s'", desc);
QPerformanceLogData::Log &log = *logIter;
- if(log.descriptions.contains(id))
+ if (log.descriptions.contains(id))
qFatal("QPerformanceLog: Duplicate log metric %d ('%s')", id, desc);
log.descriptions.insert(id, desc);
- if(log.maxId < id) {
+ if (log.maxId < id) {
log.maxId = id;
- if(l->data) delete [] l->data;
+ if (l->data) delete [] l->data;
l->data = new unsigned int[2 * (log.maxId + 1)];
::memset(l->data, 0, 2 * (log.maxId + 1) * sizeof(unsigned int));
}
@@ -107,7 +107,7 @@ static void QPerformanceLog_displayData(const QPerformanceLog::LogData *l, const
{
qWarning() << pl->logDescription << "performance data";
unsigned int total = 0;
- for(QHash<int, const char *>::ConstIterator iter = pl->descriptions.begin();
+ for (QHash<int, const char *>::ConstIterator iter = pl->descriptions.begin();
iter != pl->descriptions.end();
++iter) {
@@ -126,7 +126,7 @@ void QPerformanceLog::displayData()
{
QPerformanceLogData *logData = performanceLogData();
- for(QPerformanceLogData::Logs::ConstIterator iter = logData->logs.begin();
+ for (QPerformanceLogData::Logs::ConstIterator iter = logData->logs.begin();
iter != logData->logs.end();
++iter) {
QPerformanceLog_displayData(iter.key(), &(*iter));
@@ -137,7 +137,7 @@ void QPerformanceLog::clear()
{
QPerformanceLogData *logData = performanceLogData();
- for(QPerformanceLogData::Logs::ConstIterator iter = logData->logs.begin();
+ for (QPerformanceLogData::Logs::ConstIterator iter = logData->logs.begin();
iter != logData->logs.end();
++iter) {
QPerformanceLog_clear(iter.key(), &(*iter));
@@ -148,7 +148,7 @@ void QPerformanceLog::displayData(LogData *l)
{
QPerformanceLogData *logData = performanceLogData();
QPerformanceLogData::Logs::ConstIterator iter = logData->logs.find(l);
- if(iter == logData->logs.end())
+ if (iter == logData->logs.end())
qFatal("QPerformanceLog: Internal corruption - unable to locate log");
QPerformanceLog_displayData(iter.key(), &(*iter));
@@ -158,7 +158,7 @@ void QPerformanceLog::clear(LogData *l)
{
QPerformanceLogData *logData = performanceLogData();
QPerformanceLogData::Logs::ConstIterator iter = logData->logs.find(l);
- if(iter == logData->logs.end())
+ if (iter == logData->logs.end())
qFatal("QPerformanceLog: Internal corruption - unable to locate log");
QPerformanceLog_clear(iter.key(), &(*iter));
diff --git a/src/declarative/widgets/graphicslayouts.cpp b/src/declarative/widgets/graphicslayouts.cpp
index 8e0081b..d6c4ac2 100644
--- a/src/declarative/widgets/graphicslayouts.cpp
+++ b/src/declarative/widgets/graphicslayouts.cpp
@@ -119,7 +119,7 @@ void QGraphicsLinearLayoutObject::insertLayoutItem(int index, QGraphicsLayoutIte
insertItem(index, item);
//connect attached properties
- if(QObject *obj = attachedProperties.value(item)) {
+ if (QObject *obj = attachedProperties.value(item)) {
setStretchFactor(item, static_cast<LinearLayoutAttached *>(obj)->stretchFactor());
setAlignment(item, static_cast<LinearLayoutAttached *>(obj)->alignment());
QObject::connect(obj, SIGNAL(stretchChanged(QGraphicsLayoutItem*,int)),
@@ -261,7 +261,7 @@ QGraphicsGridLayoutObject::~QGraphicsGridLayoutObject()
void QGraphicsGridLayoutObject::addWidget(QGraphicsWidget *wid)
{
//use attached properties
- if(QObject *obj = attachedProperties.value(qobject_cast<QGraphicsLayoutItem*>(wid))) {
+ if (QObject *obj = attachedProperties.value(qobject_cast<QGraphicsLayoutItem*>(wid))) {
int row = static_cast<GridLayoutAttached *>(obj)->row();
int column = static_cast<GridLayoutAttached *>(obj)->column();
int rowSpan = static_cast<GridLayoutAttached *>(obj)->rowSpan();
@@ -277,7 +277,7 @@ void QGraphicsGridLayoutObject::addWidget(QGraphicsWidget *wid)
void QGraphicsGridLayoutObject::addLayoutItem(QGraphicsLayoutItem *item)
{
//use attached properties
- if(QObject *obj = attachedProperties.value(item)) {
+ if (QObject *obj = attachedProperties.value(item)) {
int row = static_cast<GridLayoutAttached *>(obj)->row();
int column = static_cast<GridLayoutAttached *>(obj)->column();
int rowSpan = static_cast<GridLayoutAttached *>(obj)->rowSpan();
diff --git a/src/declarative/widgets/graphicswidgets.cpp b/src/declarative/widgets/graphicswidgets.cpp
index 1d0e638..b808807 100644
--- a/src/declarative/widgets/graphicswidgets.cpp
+++ b/src/declarative/widgets/graphicswidgets.cpp
@@ -84,13 +84,13 @@ private:
virtual void clear()
{
for (int i = 0; i < count(); ++i)
- if(QGraphicsWidget *w = qobject_cast<QGraphicsWidget *>(at(i)))
+ if (QGraphicsWidget *w = qobject_cast<QGraphicsWidget *>(at(i)))
static_cast<QGraphicsScene *>(q)->removeItem(w);
QmlConcreteList<QObject *>::clear();
}
virtual void removeAt(int i)
{
- if(QGraphicsWidget *w = qobject_cast<QGraphicsWidget *>(at(i)))
+ if (QGraphicsWidget *w = qobject_cast<QGraphicsWidget *>(at(i)))
static_cast<QGraphicsScene *>(q)->removeItem(w);
QmlConcreteList<QObject *>::removeAt(i);
}
@@ -99,7 +99,7 @@ private:
QmlConcreteList<QObject *>::insert(i, o);
//XXX are there any cases when insertion should be different from appension?
- if(QGraphicsWidget *w = qobject_cast<QGraphicsWidget *>(o))
+ if (QGraphicsWidget *w = qobject_cast<QGraphicsWidget *>(o))
static_cast<QGraphicsScene *>(q)->addItem(w);
//else if (QWidget *w = qobject_cast<QWidget *>(o))
// static_cast<QGraphicsScene *>(q)->addWidget(w);
diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp
index d786f3e..073c25b 100644
--- a/src/gui/dialogs/qfiledialog.cpp
+++ b/src/gui/dialogs/qfiledialog.cpp
@@ -1538,52 +1538,51 @@ extern QString qt_win_get_existing_directory(const QFileDialogArgs &args);
#endif
/*!
- This is a convenience static function that returns an existing file
- selected by the user. If the user presses Cancel, it returns a null
- string.
+ This is a convenience static function that returns an existing file
+ selected by the user. If the user presses Cancel, it returns a null string.
- \snippet doc/src/snippets/code/src_gui_dialogs_qfiledialog.cpp 8
+ \snippet doc/src/snippets/code/src_gui_dialogs_qfiledialog.cpp 8
- The function creates a modal file dialog with the given \a parent widget.
- If the parent is not 0, the dialog will be shown centered over the
- parent widget.
+ The function creates a modal file dialog with the given \a parent widget.
+ If \a parent is not 0, the dialog will be shown centered over the parent
+ widget.
- The file dialog's working directory will be set to \a dir. If \a
- dir includes a file name, the file will be selected. Only files
- that match the given \a filter are shown. The filter selected is
- set to \a selectedFilter. The parameters \a dir, \a
- selectedFilter, and \a filter may be empty strings. If you want
- multiple filters, separate them with ';;', for example:
+ The file dialog's working directory will be set to \a dir. If \a dir
+ includes a file name, the file will be selected. Only files that match the
+ given \a filter are shown. The filter selected is set to \a selectedFilter.
+ The parameters \a dir, \a selectedFilter, and \a filter may be empty
+ strings. If you want multiple filters, separate them with ';;', for
+ example:
- \code
+ \code
"Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)"
- \endcode
+ \endcode
- The \a options argument holds various
- options about how to run the dialog, see the QFileDialog::Option enum for
- more information on the flags you can pass.
+ The \a options argument holds various options about how to run the dialog,
+ see the QFileDialog::Option enum for more information on the flags you can
+ pass.
- The dialog's caption is set to \a caption. If \a caption is not
- specified then a default caption will be used.
+ The dialog's caption is set to \a caption. If \a caption is not specified
+ then a default caption will be used.
- Under Windows and Mac OS X, this static function will use the native
- file dialog and not a QFileDialog.
+ On Windows and Mac OS X, this static function will use the native file
+ dialog and not a QFileDialog.
- Note that on Windows the dialog will spin a blocking modal event loop
- that will not dispatch any QTimers, and if parent is not 0 then it will
- position the dialog just under the parent's title bar.
+ On Windows the dialog will spin a blocking modal event loop that will not
+ dispatch any QTimers, and if \a parent is not 0 then it will position the
+ dialog just below the parent's title bar.
- Under Unix/X11, the normal behavior of the file dialog is to resolve
- and follow symlinks. For example, if \c{/usr/tmp} is a symlink to
- \c{/var/tmp}, the file dialog will change to \c{/var/tmp} after
- entering \c{/usr/tmp}. If \a options includes DontResolveSymlinks,
- the file dialog will treat symlinks as regular directories.
+ On Unix/X11, the normal behavior of the file dialog is to resolve and
+ follow symlinks. For example, if \c{/usr/tmp} is a symlink to \c{/var/tmp},
+ the file dialog will change to \c{/var/tmp} after entering \c{/usr/tmp}. If
+ \a options includes DontResolveSymlinks, the file dialog will treat
+ symlinks as regular directories.
- \warning Do not delete \a parent during the execution of the dialog.
- If you want to do this, you should create the dialog
- yourself using one of the QFileDialog constructors.
+ \warning Do not delete \a parent during the execution of the dialog. If you
+ want to do this, you should create the dialog yourself using one of the
+ QFileDialog constructors.
- \sa getOpenFileNames(), getSaveFileName(), getExistingDirectory()
+ \sa getOpenFileNames(), getSaveFileName(), getExistingDirectory()
*/
QString QFileDialog::getOpenFileName(QWidget *parent,
const QString &caption,
@@ -1626,54 +1625,53 @@ QString QFileDialog::getOpenFileName(QWidget *parent,
}
/*!
- This is a convenience static function that will return one or more
- existing files selected by the user.
+ This is a convenience static function that will return one or more existing
+ files selected by the user.
- \snippet doc/src/snippets/code/src_gui_dialogs_qfiledialog.cpp 9
+ \snippet doc/src/snippets/code/src_gui_dialogs_qfiledialog.cpp 9
- This function creates a modal file dialog with the given \a parent
- widget. If the parent is not 0, the dialog will be shown centered
- over the parent widget.
+ This function creates a modal file dialog with the given \a parent widget.
+ If \a parent is not 0, the dialog will be shown centered over the parent
+ widget.
- The file dialog's working directory will be set to \a dir. If \a
- dir includes a file name, the file will be selected. The filter
- is set to \a filter so that only those files which match the filter
- are shown. The filter selected is set to \a selectedFilter. The parameters
- \a dir, \a selectedFilter and \a filter may be empty strings. If you
- need multiple filters, separate them with ';;', for instance:
+ The file dialog's working directory will be set to \a dir. If \a dir
+ includes a file name, the file will be selected. The filter is set to
+ \a filter so that only those files which match the filter are shown. The
+ filter selected is set to \a selectedFilter. The parameters \a dir,
+ \a selectedFilter and \a filter may be empty strings. If you need multiple
+ filters, separate them with ';;', for instance:
- \code
+ \code
"Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)"
- \endcode
+ \endcode
- The dialog's caption is set to \a caption. If \a caption is not
- specified then a default caption will be used.
+ The dialog's caption is set to \a caption. If \a caption is not specified
+ then a default caption will be used.
- Under Windows and Mac OS X, this static function will use the native
- file dialog and not a QFileDialog. On Mac OS X, the \a dir argument
- is ignored, the native dialog always displays the last visited directory.
+ On Windows and Mac OS X, this static function will use the native file
+ dialog and not a QFileDialog.
- Note that on Windows the dialog will spin a blocking modal event loop
- that will not dispatch any QTimers, and if parent is not 0 then it will
- position the dialog just under the parent's title bar.
+ On Windows the dialog will spin a blocking modal event loop that will not
+ dispatch any QTimers, and if \a parent is not 0 then it will position the
+ dialog just below the parent's title bar.
- Under Unix/X11, the normal behavior of the file dialog is to resolve
- and follow symlinks. For example, if \c{/usr/tmp} is a symlink to
- \c{/var/tmp}, the file dialog will change to \c{/var/tmp} after
- entering \c{/usr/tmp}. The \a options argument holds various
- options about how to run the dialog, see the QFileDialog::Option enum for
- more information on the flags you can pass.
+ On Unix/X11, the normal behavior of the file dialog is to resolve and
+ follow symlinks. For example, if \c{/usr/tmp} is a symlink to \c{/var/tmp},
+ the file dialog will change to \c{/var/tmp} after entering \c{/usr/tmp}.
+ The \a options argument holds various options about how to run the dialog,
+ see the QFileDialog::Option enum for more information on the flags you can
+ pass.
- Note that if you want to iterate over the list of files, you should
- iterate over a copy. For example:
+ \note If you want to iterate over the list of files, you should iterate
+ over a copy. For example:
\snippet doc/src/snippets/code/src_gui_dialogs_qfiledialog.cpp 10
- \warning Do not delete \a parent during the execution of the dialog.
- If you want to do this, you should create the dialog
- yourself using one of the QFileDialog constructors.
+ \warning Do not delete \a parent during the execution of the dialog. If you
+ want to do this, you should create the dialog yourself using one of the
+ QFileDialog constructors.
- \sa getOpenFileName(), getSaveFileName(), getExistingDirectory()
+ \sa getOpenFileName(), getSaveFileName(), getExistingDirectory()
*/
QStringList QFileDialog::getOpenFileNames(QWidget *parent,
const QString &caption,
@@ -1717,54 +1715,54 @@ QStringList QFileDialog::getOpenFileNames(QWidget *parent,
}
/*!
- This is a convenience static function that will return a file name
- selected by the user. The file does not have to exist.
+ This is a convenience static function that will return a file name selected
+ by the user. The file does not have to exist.
- It creates a modal file dialog with the given \a parent widget. If the
- parent is not 0, the dialog will be shown centered over the parent
- widget.
+ It creates a modal file dialog with the given \a parent widget. If
+ \a parent is not 0, the dialog will be shown centered over the parent
+ widget.
- \snippet doc/src/snippets/code/src_gui_dialogs_qfiledialog.cpp 11
+ \snippet doc/src/snippets/code/src_gui_dialogs_qfiledialog.cpp 11
- The file dialog's working directory will be set to \a dir. If \a
- dir includes a file name, the file will be selected. Only files that
- match the \a filter are shown. The filter selected is set to
- \a selectedFilter. The parameters \a dir, \a selectedFilter, and
- \a filter may be empty strings. Multiple filters are separated with ';;'.
- For instance:
+ The file dialog's working directory will be set to \a dir. If \a dir
+ includes a file name, the file will be selected. Only files that match the
+ \a filter are shown. The filter selected is set to \a selectedFilter. The
+ parameters \a dir, \a selectedFilter, and \a filter may be empty strings.
+ Multiple filters are separated with ';;'. For instance:
- \code
+ \code
"Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)"
- \endcode
+ \endcode
- The \a options argument holds various
- options about how to run the dialog, see the QFileDialog::Option enum for
- more information on the flags you can pass.
+ The \a options argument holds various options about how to run the dialog,
+ see the QFileDialog::Option enum for more information on the flags you can
+ pass.
- The default filter can be chosen by setting \a selectedFilter to the desired value.
+ The default filter can be chosen by setting \a selectedFilter to the
+ desired value.
- The dialog's caption is set to \a caption. If \a caption is not
- specified then a default caption will be used.
+ The dialog's caption is set to \a caption. If \a caption is not specified,
+ a default caption will be used.
- Under Windows and Mac OS X, this static function will use the native
- file dialog and not a QFileDialog.
+ On Windows and Mac OS X, this static function will use the native file
+ dialog and not a QFileDialog.
- Note that on Windows the dialog will spin a blocking modal event loop
- that will not dispatch any QTimers, and if parent is not 0 then it will
- position the dialog just under the parent's title bar.
- On Mac OS X, the filter argument is ignored.
+ On Windows the dialog will spin a blocking modal event loop that will not
+ dispatch any QTimers, and if \a parent is not 0 then it will position the
+ dialog just below the parent's title bar. On Mac OS X, with its native file
+ dialog, the filter argument is ignored.
- Under Unix/X11, the normal behavior of the file dialog is to resolve
- and follow symlinks. For example, if \c{/usr/tmp} is a symlink to
- \c{/var/tmp}, the file dialog will change to \c{/var/tmp} after
- entering \c{/usr/tmp}. If \a options includes DontResolveSymlinks,
- the file dialog will treat symlinks as regular directories.
+ On Unix/X11, the normal behavior of the file dialog is to resolve and
+ follow symlinks. For example, if \c{/usr/tmp} is a symlink to \c{/var/tmp},
+ the file dialog will change to \c{/var/tmp} after entering \c{/usr/tmp}. If
+ \a options includes DontResolveSymlinks the file dialog will treat symlinks
+ as regular directories.
- \warning Do not delete \a parent during the execution of the dialog.
- If you want to do this, you should create the dialog
- yourself using one of the QFileDialog constructors.
+ \warning Do not delete \a parent during the execution of the dialog. If you
+ want to do this, you should create the dialog yourself using one of the
+ QFileDialog constructors.
- \sa getOpenFileName(), getOpenFileNames(), getExistingDirectory()
+ \sa getOpenFileName(), getOpenFileNames(), getExistingDirectory()
*/
QString QFileDialog::getSaveFileName(QWidget *parent,
const QString &caption,
@@ -1810,46 +1808,43 @@ QString QFileDialog::getSaveFileName(QWidget *parent,
}
/*!
- This is a convenience static function that will return an existing
- directory selected by the user.
+ This is a convenience static function that will return an existing
+ directory selected by the user.
- \snippet doc/src/snippets/code/src_gui_dialogs_qfiledialog.cpp 12
+ \snippet doc/src/snippets/code/src_gui_dialogs_qfiledialog.cpp 12
- This function creates a modal file dialog with the given \a parent
- widget. If the parent is not 0, the dialog will be shown centered over
- the parent widget.
+ This function creates a modal file dialog with the given \a parent widget.
+ If \a parent is not 0, the dialog will be shown centered over the parent
+ widget.
- The dialog's working directory is set to \a dir, and the caption is
- set to \a caption. Either of these may be an empty string in which case
- the current directory and a default caption will be used
- respectively.
+ The dialog's working directory is set to \a dir, and the caption is set to
+ \a caption. Either of these may be an empty string in which case the
+ current directory and a default caption will be used respectively.
- The \a options argument holds various
- options about how to run the dialog, see the QFileDialog::Option enum for
- more information on the flags you can pass. Note that \l{QFileDialog::}{ShowDirsOnly}
- must be set to ensure a native file dialog.
+ The \a options argument holds various options about how to run the dialog,
+ see the QFileDialog::Option enum for more information on the flags you can
+ pass. To ensure a native file dialog, \l{QFileDialog::}{ShowDirsOnly} must
+ be set.
- Under Windows and Mac OS X, this static function will use the native
- file dialog and not a QFileDialog. On Mac OS X, the \a dir argument
- is ignored, the native dialog always displays the last visited directory.
- On Windows CE, if the device has no native file dialog, a QFileDialog
- will be used.
+ On Windows and Mac OS X, this static function will use the native file
+ dialog and not a QFileDialog. On Windows CE, if the device has no native
+ file dialog, a QFileDialog will be used.
- Under Unix/X11, the normal behavior of the file dialog is to resolve
- and follow symlinks. For example, if \c{/usr/tmp} is a symlink to
- \c{/var/tmp}, the file dialog will change to \c{/var/tmp} after
- entering \c{/usr/tmp}. If \a options includes DontResolveSymlinks,
- the file dialog will treat symlinks as regular directories.
+ On Unix/X11, the normal behavior of the file dialog is to resolve and
+ follow symlinks. For example, if \c{/usr/tmp} is a symlink to \c{/var/tmp},
+ the file dialog will change to \c{/var/tmp} after entering \c{/usr/tmp}. If
+ \a options includes DontResolveSymlinks, the file dialog will treat
+ symlinks as regular directories.
- Note that on Windows the dialog will spin a blocking modal event loop
- that will not dispatch any QTimers, and if parent is not 0 then it will
- position the dialog just under the parent's title bar.
+ On Windows the dialog will spin a blocking modal event loop that will not
+ dispatch any QTimers, and if \a parent is not 0 then it will position the
+ dialog just below the parent's title bar.
- \warning Do not delete \a parent during the execution of the dialog.
- If you want to do this, you should create the dialog
- yourself using one of the QFileDialog constructors.
+ \warning Do not delete \a parent during the execution of the dialog. If you
+ want to do this, you should create the dialog yourself using one of the
+ QFileDialog constructors.
- \sa getOpenFileName(), getOpenFileNames(), getSaveFileName()
+ \sa getOpenFileName(), getOpenFileNames(), getSaveFileName()
*/
QString QFileDialog::getExistingDirectory(QWidget *parent,
const QString &caption,
diff --git a/src/gui/dialogs/qfilesystemmodel_p.h b/src/gui/dialogs/qfilesystemmodel_p.h
index 0a1265a..61e8b4c 100644
--- a/src/gui/dialogs/qfilesystemmodel_p.h
+++ b/src/gui/dialogs/qfilesystemmodel_p.h
@@ -164,9 +164,12 @@ public:
QHash<QString, QFileSystemNode *>::const_iterator iterator;
for(iterator = children.constBegin() ; iterator != children.constEnd() ; ++iterator) {
//On windows the root (My computer) has no path so we don't want to add a / for nothing (e.g. /C:/)
- if (!path.isEmpty())
- iterator.value()->updateIcon(iconProvider, path + QLatin1Char('/') + iterator.value()->fileName);
- else
+ if (!path.isEmpty()) {
+ if (path.endsWith(QLatin1Char('/')))
+ iterator.value()->updateIcon(iconProvider, path + iterator.value()->fileName);
+ else
+ iterator.value()->updateIcon(iconProvider, path + QLatin1Char('/') + iterator.value()->fileName);
+ } else
iterator.value()->updateIcon(iconProvider, iterator.value()->fileName);
}
}
@@ -177,9 +180,12 @@ public:
QHash<QString, QFileSystemNode *>::const_iterator iterator;
for(iterator = children.constBegin() ; iterator != children.constEnd() ; ++iterator) {
//On windows the root (My computer) has no path so we don't want to add a / for nothing (e.g. /C:/)
- if (!path.isEmpty())
- iterator.value()->retranslateStrings(iconProvider, path + QLatin1Char('/') + iterator.value()->fileName);
- else
+ if (!path.isEmpty()) {
+ if (path.endsWith(QLatin1Char('/')))
+ iterator.value()->retranslateStrings(iconProvider, path + iterator.value()->fileName);
+ else
+ iterator.value()->retranslateStrings(iconProvider, path + QLatin1Char('/') + iterator.value()->fileName);
+ } else
iterator.value()->retranslateStrings(iconProvider, iterator.value()->fileName);
}
}
diff --git a/src/gui/dialogs/qfontdialog_mac.mm b/src/gui/dialogs/qfontdialog_mac.mm
index 42be3be..50917a1 100644
--- a/src/gui/dialogs/qfontdialog_mac.mm
+++ b/src/gui/dialogs/qfontdialog_mac.mm
@@ -87,7 +87,6 @@ const int StyleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWin
NSButton *mOkButton;
NSButton *mCancelButton;
QFontDialogPrivate *mPriv;
- NSFont *mCocoaFont;
QFont *mQtFont;
BOOL mPanelHackedWithButtons;
CGFloat mDialogExtraWidth;
@@ -119,6 +118,29 @@ const int StyleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWin
- (void)cleanUpAfterMyself;
@end
+static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont)
+{
+ QFont newFont;
+ if (cocoaFont) {
+ int pSize = qRound([cocoaFont pointSize]);
+ QString family(QCFString::toQString(reinterpret_cast<CFStringRef>([cocoaFont familyName])));
+ QString typeface(QCFString::toQString(reinterpret_cast<CFStringRef>([cocoaFont fontName])));
+// qDebug() << "original family" << family << "typeface" << typeface << "psize" << pSize;
+ int hyphenPos = typeface.indexOf(QLatin1Char('-'));
+ if (hyphenPos != -1) {
+ typeface.remove(0, hyphenPos + 1);
+ } else {
+ typeface = QLatin1String("Normal");
+ }
+// qDebug() << " massaged family" << family << "typeface" << typeface << "psize" << pSize;
+ newFont = QFontDatabase().font(family, typeface, pSize);
+ newFont.setUnderline(resolveFont.underline());
+ newFont.setStrikeOut(resolveFont.strikeOut());
+
+ }
+ return newFont;
+}
+
@implementation QCocoaFontPanelDelegate
- (id)initWithFontPanel:(NSFontPanel *)panel
stolenContentView:(NSView *)stolenContentView
@@ -134,7 +156,6 @@ const int StyleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWin
mOkButton = okButton;
mCancelButton = cancelButton;
mPriv = priv;
- mCocoaFont = 0;
mPanelHackedWithButtons = (okButton != 0);
mDialogExtraWidth = extraWidth;
mDialogExtraHeight = extraHeight;
@@ -155,42 +176,14 @@ const int StyleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWin
- (void)dealloc
{
- if (mCocoaFont)
- [mCocoaFont release];
delete mQtFont;
[super dealloc];
}
- (void)changeFont:(id)sender
{
- Q_UNUSED(sender);
-
- QFont newFont;
-
- if (mCocoaFont)
- [mCocoaFont autorelease];
NSFont *dummyFont = [NSFont userFontOfSize:12.0];
- mCocoaFont = [sender convertFont:dummyFont];
- if (mCocoaFont) {
- [mCocoaFont retain];
-
- int pSize = qRound([mCocoaFont pointSize]);
- QString family(QCFString::toQString(reinterpret_cast<CFStringRef>([mCocoaFont familyName])));
- QString typeface(QCFString::toQString(reinterpret_cast<CFStringRef>([mCocoaFont fontName])));
-// qDebug() << "original family" << family << "typeface" << typeface << "psize" << pSize;
- int hyphenPos = typeface.indexOf(QLatin1Char('-'));
- if (hyphenPos != -1) {
- typeface.remove(0, hyphenPos + 1);
- } else {
- typeface = QLatin1String("Normal");
- }
-// qDebug() << " massaged family" << family << "typeface" << typeface << "psize" << pSize;
- newFont = QFontDatabase().font(family, typeface, pSize);
- newFont.setUnderline(mQtFont->underline());
- newFont.setStrikeOut(mQtFont->strikeOut());
- }
-
- [self setQtFont:newFont];
+ [self setQtFont:qfontForCocoaFont([sender convertFont:dummyFont], *mQtFont)];
if (mPriv)
mPriv->updateSampleFont(*mQtFont);
}
@@ -317,6 +310,9 @@ const int StyleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWin
- (void)onOkClicked
{
Q_ASSERT(mPanelHackedWithButtons);
+ NSFontManager *fontManager = [NSFontManager sharedFontManager];
+ [self setQtFont:qfontForCocoaFont([fontManager convertFont:[fontManager selectedFont]],
+ *mQtFont)];
[[mStolenContentView window] close];
[self finishOffWithCode:NSOKButton];
}
@@ -374,16 +370,7 @@ const int StyleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWin
mModalSession = 0;
}
- // temporary hack to work around bug in deleteLater() in Qt/Mac Cocoa
-#if 1
- bool deleteDialog = mPriv->fontDialog()->testAttribute(Qt::WA_DeleteOnClose);
- mPriv->fontDialog()->setAttribute(Qt::WA_DeleteOnClose, false);
-#endif
mPriv->done((code == NSOKButton) ? QDialog::Accepted : QDialog::Rejected);
-#if 1
- if (deleteDialog)
- delete mPriv->fontDialog();
-#endif
} else {
[NSApp stopModalWithCode:code];
}
diff --git a/src/gui/dialogs/qsidebar.cpp b/src/gui/dialogs/qsidebar.cpp
index bfdb37e..26108d7 100644
--- a/src/gui/dialogs/qsidebar.cpp
+++ b/src/gui/dialogs/qsidebar.cpp
@@ -248,7 +248,11 @@ void QUrlModel::addUrls(const QList<QUrl> &list, int row, bool move)
if (!url.isValid() || url.scheme() != QLatin1String("file"))
continue;
for (int j = 0; move && j < rowCount(); ++j) {
+#if defined(Q_OS_WIN)
+ if (index(j, 0).data(UrlRole).toUrl().toLocalFile().toLower() == url.toLocalFile().toLower()) {
+#else
if (index(j, 0).data(UrlRole) == url) {
+#endif
removeRow(j);
if (j <= row)
row--;
diff --git a/src/gui/embedded/qscreentransformed_qws.cpp b/src/gui/embedded/qscreentransformed_qws.cpp
index f988789..46ac1d1 100644
--- a/src/gui/embedded/qscreentransformed_qws.cpp
+++ b/src/gui/embedded/qscreentransformed_qws.cpp
@@ -410,7 +410,9 @@ void QTransformedScreen::blit(const QImage &image, const QPoint &topLeft,
#endif
#ifdef QT_QWS_DEPTH_8
case 8:
- if (image.depth() == 16)
+ if (image.format() == QImage::Format_RGB444)
+ SET_BLIT_FUNC(quint8, qrgb444, trans, func);
+ else if (image.depth() == 16)
SET_BLIT_FUNC(quint8, quint16, trans, func);
else
SET_BLIT_FUNC(quint8, quint32, trans, func);
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 7971711..92be62f 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -885,6 +885,38 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, bool de
/*!
\internal
+ Returns the bounding rect of this item's children (excluding itself).
+*/
+void QGraphicsItemPrivate::childrenBoundingRectHelper(QTransform *x, QRectF *rect)
+{
+ for (int i = 0; i < children.size(); ++i) {
+ QGraphicsItem *child = children.at(i);
+ QGraphicsItemPrivate *childd = child->d_ptr;
+ bool hasX = childd->hasTransform;
+ bool hasPos = !childd->pos.isNull();
+ if (hasPos || hasX) {
+ QTransform matrix;
+ if (hasX)
+ matrix = child->transform();
+ if (hasPos) {
+ const QPointF &p = childd->pos;
+ matrix *= QTransform::fromTranslate(p.x(), p.y());
+ }
+ matrix *= *x;
+ *rect |= matrix.mapRect(child->boundingRect());
+ if (!childd->children.isEmpty())
+ childd->childrenBoundingRectHelper(&matrix, rect);
+ } else {
+ *rect |= x->mapRect(child->boundingRect());
+ if (!childd->children.isEmpty())
+ childd->childrenBoundingRectHelper(x, rect);
+ }
+ }
+}
+
+/*!
+ \internal
+
Empty all cached pixmaps from the pixmap cache.
*/
void QGraphicsItemCache::purge()
@@ -3255,13 +3287,8 @@ void QGraphicsItem::setZValue(qreal z)
QRectF QGraphicsItem::childrenBoundingRect() const
{
QRectF childRect;
- foreach (QGraphicsItem *child, children()) {
- QPointF childPos = child->pos();
- QTransform matrix = child->transform();
- if (!childPos.isNull())
- matrix *= QTransform::fromTranslate(childPos.x(), childPos.y());
- childRect |= matrix.mapRect(child->boundingRect() | child->childrenBoundingRect());
- }
+ QTransform x;
+ d_ptr->childrenBoundingRectHelper(&x, &childRect);
return childRect;
}
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index fb0bd2d..bcbd737 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -187,6 +187,7 @@ public:
void addChild(QGraphicsItem *child);
void removeChild(QGraphicsItem *child);
void setParentItemHelper(QGraphicsItem *parent, bool deleting);
+ void childrenBoundingRectHelper(QTransform *x, QRectF *rect);
virtual void resolveFont(uint inheritedMask)
{
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp
index a9d585c..7720a10 100644
--- a/src/gui/graphicsview/qgraphicsview.cpp
+++ b/src/gui/graphicsview/qgraphicsview.cpp
@@ -2809,9 +2809,7 @@ void QGraphicsView::setupViewport(QWidget *widget)
const bool isGLWidget = widget->inherits("QGLWidget");
- d->accelerateScrolling = !(isGLWidget
- || widget->testAttribute(Qt::WA_MSWindowsUseDirect3D)
- || qApp->testAttribute(Qt::AA_MSWindowsUseDirect3DByDefault));
+ d->accelerateScrolling = !(isGLWidget);
widget->setFocusPolicy(Qt::StrongFocus);
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 3b82da8..f495b31 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -1359,14 +1359,6 @@ bool QPixmap::isDetached() const
void QPixmap::deref()
{
if (data && !data->ref.deref()) { // Destroy image if last ref
-#if !defined(QT_NO_DIRECT3D) && defined(Q_WS_WIN)
- if (data->classId() == QPixmapData::RasterClass) {
- QRasterPixmapData *rData = static_cast<QRasterPixmapData*>(data);
- if (rData->texture)
- rData->texture->Release();
- rData->texture = 0;
- }
-#endif
if (data->is_cached && qt_pixmap_cleanup_hook_64)
qt_pixmap_cleanup_hook_64(cacheKey());
delete data;
@@ -1938,12 +1930,6 @@ void QPixmap::detach()
if (id == QPixmapData::RasterClass) {
QRasterPixmapData *rasterData = static_cast<QRasterPixmapData*>(data);
rasterData->image.detach();
-#if defined(Q_WS_WIN) && !defined(QT_NO_DIRECT3D)
- if (rasterData->texture) {
- rasterData->texture->Release();
- rasterData->texture = 0;
- }
-#endif
}
if (data->is_cached && qt_pixmap_cleanup_hook_64 && data->ref == 1)
diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h
index cd3b465..a5609e4 100644
--- a/src/gui/image/qpixmap.h
+++ b/src/gui/image/qpixmap.h
@@ -254,8 +254,6 @@ private:
friend class QWidgetPrivate;
friend class QRasterPaintEngine;
friend class QRasterBuffer;
- friend class QDirect3DPaintEngine;
- friend class QDirect3DPaintEnginePrivate;
friend class QDetachedPixmap;
#if !defined(QT_NO_DATASTREAM)
friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPixmap &);
diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp
index 145b02a..b5556cd 100644
--- a/src/gui/image/qpixmap_raster.cpp
+++ b/src/gui/image/qpixmap_raster.cpp
@@ -50,12 +50,6 @@
#include <private/qwidget_p.h>
#include <private/qdrawhelper_p.h>
-#if !defined(QT_NO_DIRECT3D) && defined(Q_WS_WIN)
-#include <private/qpaintengine_d3d_p.h>
-#include <d3d9.h>
-extern QDirect3DPaintEngine *qt_d3dEngine();
-#endif
-
QT_BEGIN_NAMESPACE
const uchar qt_pixmap_bit_mask[] = { 0x01, 0x02, 0x04, 0x08,
@@ -63,9 +57,6 @@ const uchar qt_pixmap_bit_mask[] = { 0x01, 0x02, 0x04, 0x08,
QRasterPixmapData::QRasterPixmapData(PixelType type)
: QPixmapData(type, RasterClass)
-#if defined(Q_WS_WIN) && !defined(QT_NO_DIRECT3D)
- , texture(0)
-#endif
{
}
diff --git a/src/gui/image/qpixmap_raster_p.h b/src/gui/image/qpixmap_raster_p.h
index 48d5cf8..9d3bf72 100644
--- a/src/gui/image/qpixmap_raster_p.h
+++ b/src/gui/image/qpixmap_raster_p.h
@@ -58,9 +58,6 @@
#ifdef Q_WS_WIN
# include "qt_windows.h"
-# ifndef QT_NO_DIRECT3D
-# include <d3d9.h>
-# endif
#endif
QT_BEGIN_NAMESPACE
@@ -88,10 +85,6 @@ protected:
int metric(QPaintDevice::PaintDeviceMetric metric) const;
private:
-#if defined(Q_WS_WIN) && !defined(QT_NO_DIRECT3D)
- friend class QDirect3DPaintEnginePrivate;
- IDirect3DTexture9 *texture;
-#endif
friend class QPixmap;
friend class QBitmap;
friend class QDetachedPixmap;
diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp
index eedb6a3..458d6b9 100644
--- a/src/gui/image/qpixmapcache.cpp
+++ b/src/gui/image/qpixmapcache.cpp
@@ -187,6 +187,11 @@ bool QPMCache::insert(const QString& key, const QPixmap &pixmap, int cost)
cacheKeys.insert(key, cacheKey);
return true;
}
+ qint64 oldCacheKey = cacheKeys.value(key, -1);
+ //If for the same key we add already a pixmap we should delete it
+ if (oldCacheKey != -1)
+ QCache<qint64, QDetachedPixmap>::remove(oldCacheKey);
+
bool success = QCache<qint64, QDetachedPixmap>::insert(cacheKey, new QDetachedPixmap(pixmap), cost);
if (success) {
cacheKeys.insert(key, cacheKey);
diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp
index 91431c4..fee19c9 100644
--- a/src/gui/itemviews/qsortfilterproxymodel.cpp
+++ b/src/gui/itemviews/qsortfilterproxymodel.cpp
@@ -56,6 +56,15 @@ QT_BEGIN_NAMESPACE
typedef QList<QPair<QModelIndex, QPersistentModelIndex> > QModelIndexPairList;
+static inline QSet<int> qVectorToSet(const QVector<int> &vector)
+{
+ QSet<int> set;
+ set.reserve(vector.size());
+ for(int i=0; i < vector.size(); ++i)
+ set << vector.at(i);
+ return set;
+}
+
class QSortFilterProxyModelLessThan
{
public:
@@ -223,8 +232,8 @@ public:
QModelIndexPairList store_persistent_indexes();
void update_persistent_indexes(const QModelIndexPairList &source_indexes);
- void filter_changed();
- void handle_filter_changed(
+ void filter_changed(const QModelIndex &source_parent = QModelIndex());
+ QSet<int> handle_filter_changed(
QVector<int> &source_to_proxy, QVector<int> &proxy_to_source,
const QModelIndex &source_parent, Qt::Orientation orient);
@@ -928,27 +937,39 @@ void QSortFilterProxyModelPrivate::update_persistent_indexes(
q->changePersistentIndexList(from, to);
}
+
/*!
\internal
Updates the proxy model (adds/removes rows) based on the
new filter.
*/
-void QSortFilterProxyModelPrivate::filter_changed()
+void QSortFilterProxyModelPrivate::filter_changed(const QModelIndex &source_parent)
{
- QMap<QModelIndex, Mapping *>::const_iterator it;
- for (it = source_index_mapping.constBegin(); it != source_index_mapping.constEnd(); ++it) {
- QModelIndex source_parent = it.key();
- Mapping *m = it.value();
- handle_filter_changed(m->proxy_rows, m->source_rows, source_parent, Qt::Vertical);
- handle_filter_changed(m->proxy_columns, m->source_columns, source_parent, Qt::Horizontal);
+ IndexMap::const_iterator it = source_index_mapping.constFind(source_parent);
+ if (it == source_index_mapping.constEnd())
+ return;
+ Mapping *m = it.value();
+ QSet<int> rows_removed = handle_filter_changed(m->proxy_rows, m->source_rows, source_parent, Qt::Vertical);
+ QSet<int> columns_removed = handle_filter_changed(m->proxy_columns, m->source_columns, source_parent, Qt::Horizontal);
+ QVector<QModelIndex>::iterator it2 = m->mapped_children.end();
+ while (it2 != m->mapped_children.begin()) {
+ --it2;
+ const QModelIndex source_child_index = *it2;
+ if (rows_removed.contains(source_child_index.row()) || columns_removed.contains(source_child_index.column())) {
+ it2 = m->mapped_children.erase(it2);
+ remove_from_mapping(source_child_index);
+ } else {
+ filter_changed(source_child_index);
+ }
}
}
/*!
\internal
+ returns the removed items indexes
*/
-void QSortFilterProxyModelPrivate::handle_filter_changed(
+QSet<int> QSortFilterProxyModelPrivate::handle_filter_changed(
QVector<int> &source_to_proxy, QVector<int> &proxy_to_source,
const QModelIndex &source_parent, Qt::Orientation orient)
{
@@ -985,6 +1006,7 @@ void QSortFilterProxyModelPrivate::handle_filter_changed(
insert_source_items(source_to_proxy, proxy_to_source,
source_items_insert, source_parent, orient);
}
+ return qVectorToSet(source_items_remove);
}
void QSortFilterProxyModelPrivate::_q_sourceDataChanged(const QModelIndex &source_top_left,
@@ -1035,15 +1057,14 @@ void QSortFilterProxyModelPrivate::_q_sourceDataChanged(const QModelIndex &sourc
if (!source_rows_remove.isEmpty()) {
remove_source_items(m->proxy_rows, m->source_rows,
source_rows_remove, source_parent, Qt::Vertical);
- QSet<int> source_rows_remove_set = source_rows_remove.toList().toSet();
- QVector<QModelIndex>::iterator it = m->mapped_children.begin();
- while (it != m->mapped_children.end()) {
+ QSet<int> source_rows_remove_set = qVectorToSet(source_rows_remove);
+ QVector<QModelIndex>::iterator it = m->mapped_children.end();
+ while (it != m->mapped_children.begin()) {
+ --it;
const QModelIndex source_child_index = *it;
if (source_rows_remove_set.contains(source_child_index.row())) {
it = m->mapped_children.erase(it);
remove_from_mapping(source_child_index);
- } else {
- ++it;
}
}
}
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri
index cb2b014..a1b982a 100644
--- a/src/gui/kernel/kernel.pri
+++ b/src/gui/kernel/kernel.pri
@@ -193,7 +193,7 @@ embedded {
MENU_NIB.path = Resources
MENU_NIB.version = Versions
QMAKE_BUNDLE_DATA += MENU_NIB
- RESOURCES += mac/maccursors.qrc
+ RESOURCES += mac/macresources.qrc
LIBS += -framework AppKit
}
diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp
index 921be22..c6addc1 100644
--- a/src/gui/kernel/qaction.cpp
+++ b/src/gui/kernel/qaction.cpp
@@ -136,27 +136,25 @@ void QActionPrivate::redoGrab(QShortcutMap &map)
void QActionPrivate::redoGrabAlternate(QShortcutMap &map)
{
Q_Q(QAction);
- for (int i = 0; i < alternateShortcutIds.size(); ++i)
- if (int id = alternateShortcutIds.at(i))
+ foreach (int id, alternateShortcutIds)
+ if (id)
map.removeShortcut(id, q);
alternateShortcutIds.clear();
if (alternateShortcuts.isEmpty())
return;
- for (int i = 0; i < alternateShortcuts.size(); ++i) {
- const QKeySequence &alternate = alternateShortcuts.at(i);
+ foreach (const QKeySequence& alternate, alternateShortcuts) {
if (!alternate.isEmpty())
alternateShortcutIds.append(map.addShortcut(q, alternate, shortcutContext));
else
alternateShortcutIds.append(0);
}
-
if (!enabled) {
- for (int i = 0; i < alternateShortcutIds.size(); ++i)
- map.setShortcutEnabled(false, alternateShortcutIds.at(i), q);
+ foreach (int id, alternateShortcutIds)
+ map.setShortcutEnabled(false, id, q);
}
if (!autorepeat) {
- for (int i = 0; i < alternateShortcutIds.size(); ++i)
- map.setShortcutAutoRepeat(false, alternateShortcutIds.at(i), q);
+ foreach (int id, alternateShortcutIds)
+ map.setShortcutAutoRepeat(false, id, q);
}
}
@@ -165,26 +163,10 @@ void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map)
Q_Q(QAction);
if (shortcutId)
map.setShortcutEnabled(enable, shortcutId, q);
- for (int i = 0; i < alternateShortcutIds.size(); ++i)
- if (int id = alternateShortcutIds.at(i))
+ foreach (int id, alternateShortcutIds)
+ if (id)
map.setShortcutEnabled(enable, id, q);
}
-
-void QActionPrivate::removeAll(QShortcutMap &map)
-{
- Q_Q(QAction);
- if (shortcutId) {
- map.removeShortcut(shortcutId, q);
- shortcutId = 0;
- }
-
- for (int i = 0; i < alternateShortcutIds.size(); ++i)
- if (int id = alternateShortcutIds.at(i))
- map.removeShortcut(id, q);
-
- alternateShortcutIds.clear();
-}
-
#endif // QT_NO_SHORTCUT
@@ -633,8 +615,8 @@ QAction::~QAction()
#ifndef QT_NO_SHORTCUT
if (d->shortcutId && qApp) {
qApp->d_func()->shortcutMap.removeShortcut(d->shortcutId, this);
- for (int i = 0; i < d->alternateShortcutIds.size(); ++i)
- qApp->d_func()->shortcutMap.removeShortcut(d->alternateShortcutIds.at(i), this);
+ foreach (int id, d->alternateShortcutIds)
+ qApp->d_func()->shortcutMap.removeShortcut(id, this);
}
#endif
}
@@ -1067,12 +1049,7 @@ void QAction::setVisible(bool b)
d->visible = b;
d->enabled = b && !d->forceDisabled && (!d->group || d->group->isEnabled()) ;
#ifndef QT_NO_SHORTCUT
- if (b) {
- d->redoGrab(qApp->d_func()->shortcutMap);
- d->redoGrabAlternate(qApp->d_func()->shortcutMap);
- } else {
- d->removeAll(qApp->d_func()->shortcutMap);
- }
+ d->setShortcutEnabled(d->enabled, qApp->d_func()->shortcutMap);
#endif
d->sendDataChanged();
}
diff --git a/src/gui/kernel/qaction_p.h b/src/gui/kernel/qaction_p.h
index a5b3731..0617ef5 100644
--- a/src/gui/kernel/qaction_p.h
+++ b/src/gui/kernel/qaction_p.h
@@ -111,7 +111,6 @@ public:
void redoGrab(QShortcutMap &map);
void redoGrabAlternate(QShortcutMap &map);
void setShortcutEnabled(bool enable, QShortcutMap &map);
- void removeAll(QShortcutMap &map);
static QShortcutMap *globalMap;
#endif // QT_NO_SHORTCUT
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index fd189c7..34c135c 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -107,9 +107,6 @@ static void initResources()
Q_INIT_RESOURCE(qstyle);
#endif
-#if !defined(QT_NO_DIRECT3D) && defined(Q_WS_WIN)
- Q_INIT_RESOURCE(qpaintengine_d3d);
-#endif
Q_INIT_RESOURCE(qmessagebox);
#if !defined(QT_NO_PRINTDIALOG)
Q_INIT_RESOURCE(qprintdialog);
@@ -620,13 +617,6 @@ void QApplicationPrivate::process_cmdline()
and QPixmaps. Available options are \c{raster} and \c{opengl}.
\endlist
- The Windows version of Qt supports an additional command line option, if
- Direct3D support has been compiled into Qt:
- \list
- \o -direct3d will make the Direct3D paint engine the default widget
- paint engine in Qt. \bold {This functionality is experimental.}
- \endlist
-
The X11 version of Qt supports some traditional X11 command line options:
\list
\o -display \e display, sets the X display (default is $DISPLAY).
@@ -832,12 +822,13 @@ QApplication::QApplication(Display *dpy, int &argc, char **argv,
#endif // Q_WS_X11
+extern void qInitDrawhelperAsm();
/*!
+ \fn void QApplicationPrivate::initialize()
+
Initializes the QApplication object, called from the constructors.
*/
-extern void qInitDrawhelperAsm();
-
void QApplicationPrivate::initialize()
{
QWidgetPrivate::mapper = new QWidgetMapper;
@@ -2106,8 +2097,8 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason)
if (that)
QApplication::sendEvent(that->style(), &in);
}
+ emit qApp->focusChanged(prev, focus_widget);
}
- emit qApp->focusChanged(prev, focus_widget);
}
}
@@ -3504,7 +3495,7 @@ void QApplication::changeOverrideCursor(const QCursor &cursor)
It is necessary to call this function to start event handling. The main
event loop receives events from the window system and dispatches these to
the application widgets.
-
+
Generally, no user interaction can take place before calling exec(). As a
special case, modal widgets like QMessageBox can be used before calling
exec(), because modal widgets call exec() to start a local event loop.
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index 2f2fc2c..c1cb7e2 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -745,9 +745,6 @@ void qt_init(QApplicationPrivate *priv, int)
appNoGrab = !appNoGrab;
else
#endif // QT_DEBUG
- if (qstrcmp(argv[i], "-direct3d") == 0)
- QApplication::setAttribute(Qt::AA_MSWindowsUseDirect3DByDefault);
- else
argv[j++] = argv[i];
}
if(j < priv->argc) {
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index 366e576..d7ca2f4 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -402,7 +402,7 @@ extern bool qt_xdnd_dragging;
// gui or non-gui from qapplication.cpp
extern bool qt_is_gui_used;
-/*!
+/*!
\internal
Try to resolve a \a symbol from \a library with the version specified
by \a vernum.
@@ -840,7 +840,7 @@ bool QApplicationPrivate::x11_apply_settings()
}
int kdeSessionVersion = QString::fromLocal8Bit(qgetenv("KDE_SESSION_VERSION")).toInt();
-
+
if (!appFont) {
QFont font(QApplication::font());
QString fontDescription;
@@ -1583,6 +1583,7 @@ static PtrWacomConfigOpenDevice ptrWacomConfigOpenDevice = 0;
static PtrWacomConfigGetRawParam ptrWacomConfigGetRawParam = 0;
static PtrWacomConfigCloseDevice ptrWacomConfigCloseDevice = 0;
static PtrWacomConfigTerm ptrWacomConfigTerm = 0;
+Q_GLOBAL_STATIC(QByteArray, wacomDeviceName)
#endif
#endif
@@ -1952,11 +1953,17 @@ void qt_init(QApplicationPrivate *priv, int,
{
QString displayName = QLatin1String(XDisplayName(NULL));
- // apparently MITSHM only works for local displays, so do a quick check here
- // to determine whether the display is local or not (not 100 % accurate)
+ // MITSHM only works for local displays, so do a quick check here
+ // to determine whether the display is local or not (not 100 % accurate).
+ // BGR server layouts are not supported either, since it requires the raster
+ // engine to work on a QImage with BGR layout.
bool local = displayName.isEmpty() || displayName.lastIndexOf(QLatin1Char(':')) == 0;
- if (local && (qgetenv("QT_X11_NO_MITSHM").toInt() == 0))
- X11->use_mitshm = mitshm_pixmaps;
+ if (local && (qgetenv("QT_X11_NO_MITSHM").toInt() == 0)) {
+ Visual *defaultVisual = DefaultVisual(X11->display, DefaultScreen(X11->display));
+ X11->use_mitshm = mitshm_pixmaps && (defaultVisual->red_mask == 0xff0000
+ && defaultVisual->green_mask == 0xff00
+ && defaultVisual->blue_mask == 0xff);
+ }
}
#endif // QT_NO_MITSHM
@@ -2377,6 +2384,8 @@ void qt_init(QApplicationPrivate *priv, int,
#else
if (devs->type == ATOM(XWacomStylus)) {
deviceType = QTabletEvent::Stylus;
+ if (wacomDeviceName()->isEmpty())
+ wacomDeviceName()->append(devs->name);
gotStylus = true;
} else if (devs->type == ATOM(XWacomEraser)) {
deviceType = QTabletEvent::XFreeEraser;
@@ -4511,8 +4520,7 @@ void fetchWacomToolId(int &deviceType, qint64 &serialId)
WACOMCONFIG *config = ptrWacomConfigInit(X11->display, 0);
if (config == 0)
return;
- const char *name = "stylus"; // TODO get this from the X config instead (users may have called it differently)
- WACOMDEVICE *device = ptrWacomConfigOpenDevice (config, name);
+ WACOMDEVICE *device = ptrWacomConfigOpenDevice (config, wacomDeviceName()->constData());
if (device == 0)
return;
unsigned keys[1];
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index dcb3564..cf66605 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -293,9 +293,18 @@ extern "C" {
QPoint posDrag(localPoint.x, localPoint.y);
NSDragOperation nsActions = [sender draggingSourceOperationMask];
Qt::DropActions qtAllowed = qt_mac_mapNSDragOperations(nsActions);
+ QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec.lastOperation) = nsActions;
+ Qt::KeyboardModifiers modifiers = Qt::NoModifier;
+ if ([sender draggingSource] != nil) {
+ // modifier flags might have changed, update it here since we don't send any input events.
+ QApplicationPrivate::modifier_buttons = qt_cocoaModifiers2QtModifiers([[NSApp currentEvent] modifierFlags]);
+ modifiers = QApplication::keyboardModifiers();
+ } else {
+ // when the source is from another application the above technique will not work.
+ modifiers = qt_cocoaDragOperation2QtModifiers(nsActions);
+ }
// send the drag enter event to the widget.
- QDragEnterEvent qDEEvent(posDrag, qtAllowed, mimeData,
- QApplication::mouseButtons(), QApplication::keyboardModifiers());
+ QDragEnterEvent qDEEvent(posDrag, qtAllowed, mimeData, QApplication::mouseButtons(), modifiers);
QApplication::sendEvent(qwidget, &qDEEvent);
if (!qDEEvent.isAccepted()) {
// widget is not interested in this drag, so ignore this drop data.
@@ -303,24 +312,23 @@ extern "C" {
return NSDragOperationNone;
} else {
// send a drag move event immediately after a drag enter event (as per documentation).
- QDragMoveEvent qDMEvent(posDrag, qtAllowed, mimeData,
- QApplication::mouseButtons(), QApplication::keyboardModifiers());
+ QDragMoveEvent qDMEvent(posDrag, qtAllowed, mimeData, QApplication::mouseButtons(), modifiers);
qDMEvent.setDropAction(qDEEvent.dropAction());
qDMEvent.accept(); // accept by default, since enter event was accepted.
QApplication::sendEvent(qwidget, &qDMEvent);
if (!qDMEvent.isAccepted() || qDMEvent.dropAction() == Qt::IgnoreAction) {
// since we accepted the drag enter event, the widget expects
// future drage move events.
- // ### check if we need to treat this like the drag enter event.
+ // ### check if we need to treat this like the drag enter event.
nsActions = QT_PREPEND_NAMESPACE(qt_mac_mapDropAction)(qDEEvent.dropAction());
} else {
nsActions = QT_PREPEND_NAMESPACE(qt_mac_mapDropAction)(qDMEvent.dropAction());
- }
+ }
QT_PREPEND_NAMESPACE(qt_mac_copy_answer_rect)(qDMEvent);
- return nsActions;
+ return nsActions;
}
}
-
+
- (NSDragOperation)draggingUpdated:(id < NSDraggingInfo >)sender
{
// drag enter event was rejected, so ignore the move event.
@@ -338,11 +346,19 @@ extern "C" {
// send drag move event to the widget
QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec.lastOperation) = nsActions;
Qt::DropActions qtAllowed = QT_PREPEND_NAMESPACE(qt_mac_mapNSDragOperations)(nsActions);
+ Qt::KeyboardModifiers modifiers = Qt::NoModifier;
+ if ([sender draggingSource] != nil) {
+ // modifier flags might have changed, update it here since we don't send any input events.
+ QApplicationPrivate::modifier_buttons = qt_cocoaModifiers2QtModifiers([[NSApp currentEvent] modifierFlags]);
+ modifiers = QApplication::keyboardModifiers();
+ } else {
+ // when the source is from another application the above technique will not work.
+ modifiers = qt_cocoaDragOperation2QtModifiers(nsActions);
+ }
QMimeData *mimeData = dropData;
if (QDragManager::self()->source())
mimeData = QDragManager::self()->dragPrivate()->data;
- QDragMoveEvent qDMEvent(posDrag, qtAllowed, mimeData,
- QApplication::mouseButtons(), QApplication::keyboardModifiers());
+ QDragMoveEvent qDMEvent(posDrag, qtAllowed, mimeData, QApplication::mouseButtons(), modifiers);
qDMEvent.setDropAction(QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec).lastAction);
qDMEvent.accept();
QApplication::sendEvent(qwidget, &qDMEvent);
@@ -371,12 +387,12 @@ extern "C" {
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
[self addDropData:sender];
-
+
NSPoint windowPoint = [sender draggingLocation];
NSPoint globalPoint = [[sender draggingDestinationWindow] convertBaseToScreen:windowPoint];
NSPoint localPoint = [self convertPoint:windowPoint fromView:nil];
QPoint posDrop(localPoint.x, localPoint.y);
-
+
NSDragOperation nsActions = [sender draggingSourceOperationMask];
Qt::DropActions qtAllowed = qt_mac_mapNSDragOperations(nsActions);
QMimeData *mimeData = dropData;
@@ -388,6 +404,8 @@ extern "C" {
if (QDragManager::self()->object)
QDragManager::self()->dragPrivate()->target = qwidget;
QApplication::sendEvent(qwidget, &de);
+ if (QDragManager::self()->object)
+ QDragManager::self()->dragPrivate()->executed_action = de.dropAction();
if (!de.isAccepted())
return NO;
else
@@ -419,10 +437,9 @@ extern "C" {
- (void) setFrameSize:(NSSize)newSize
{
[super setFrameSize:newSize];
-
+
// A change in size has required the view to be invalidated.
- if ([self inLiveResize])
- {
+ if ([self inLiveResize]) {
NSRect rects[4];
NSInteger count;
[self getRectsExposedDuringLiveResize:rects count:&count];
@@ -430,9 +447,7 @@ extern "C" {
{
[self setNeedsDisplayInRect:rects[count]];
}
- }
- else
- {
+ } else {
[self setNeedsDisplay:YES];
}
}
@@ -567,7 +582,7 @@ extern "C" {
if (!qAppInstance()->activeModalWidget() || QApplicationPrivate::tryModalHelper(qwidget, 0)) {
QApplication::sendEvent(qwidget, &enterEvent);
qt_mouseover = qwidget;
-
+
// Update cursor and dispatch hover events.
qt_mac_update_cursor_at_global_pos(flipPoint(globalPoint).toPoint());
if (qwidget->testAttribute(Qt::WA_Hover) &&
@@ -622,7 +637,7 @@ extern "C" {
[viewsToLookAt addObject:qt_mac_nativeview_for(parentWidget)];
parentWidget = parentWidget->parentWidget();
}
-
+
// Now walk through the subviews of each view and determine which subview should
// get the event. We look through all the subviews at a given level with
// the assumption that the last item to be found the candidate has a higher z-order.
@@ -758,7 +773,7 @@ extern "C" {
if (currentIManager && [currentIManager wantsToHandleMouseEvents]) {
[currentIManager handleMouseEvent:theEvent];
}
-
+
NSPoint windowPoint = [theEvent locationInWindow];
NSPoint globalPoint = [[theEvent window] convertBaseToScreen:windowPoint];
NSPoint localPoint = [self convertPoint:windowPoint fromView:nil];
@@ -767,7 +782,7 @@ extern "C" {
Qt::MouseButton buttons = cocoaButton2QtButton([theEvent buttonNumber]);
bool wheelOK = false;
Qt::KeyboardModifiers keyMods = qt_cocoaModifiers2QtModifiers([theEvent modifierFlags]);
-
+
// Mouse wheel deltas seem to tick in at increments of 0.1. Qt widgets
// expect the delta to be a multiple of 120.
const int ScrollFactor = 10 * 120;
@@ -789,7 +804,7 @@ extern "C" {
wheelOK = qwe2.isAccepted();
}
}
-
+
if (deltaY) {
QWheelEvent qwe(qlocal, qglobal, deltaY, buttons, keyMods, Qt::Vertical);
qt_sendSpontaneousEvent(qwidget, &qwe);
@@ -802,7 +817,7 @@ extern "C" {
wheelOK = qwe2.isAccepted();
}
}
-
+
if (deltaZ) {
// Qt doesn't explicitly support wheels with a Z component. In a misguided attempt to
// try to be ahead of the pack, I'm adding this extra value.
@@ -891,6 +906,11 @@ extern "C" {
Q_UNUSED(anImage);
Q_UNUSED(aPoint);
qMacDnDParams()->performedAction = operation;
+ if (QDragManager::self()->object
+ && QDragManager::self()->dragPrivate()->executed_action != Qt::ActionMask) {
+ qMacDnDParams()->performedAction =
+ qt_mac_mapDropAction(QDragManager::self()->dragPrivate()->executed_action);
+ }
}
- (QWidget *)qt_qwidget
@@ -1214,13 +1234,13 @@ Qt::DropAction QDragManager::drag(QDrag *o)
so we just bail early to prevent it */
if(!(GetCurrentEventButtonState() & kEventMouseButtonPrimary))
return Qt::IgnoreAction;
-
+
if(object) {
dragPrivate()->source->removeEventFilter(this);
cancel();
beingCancelled = false;
}
-
+
object = o;
dragPrivate()->target = 0;
@@ -1232,7 +1252,7 @@ Qt::DropAction QDragManager::drag(QDrag *o)
QMacPasteboard dragBoard((CFStringRef) NSDragPboard, QMacPasteboardMime::MIME_DND);
dragPrivate()->data->setData(QLatin1String("application/x-qt-mime-type-name"), QByteArray());
dragBoard.setMimeData(dragPrivate()->data);
-
+
// create the image
QPoint hotspot;
QPixmap pix = dragPrivate()->pixmap;
@@ -1278,6 +1298,7 @@ Qt::DropAction QDragManager::drag(QDrag *o)
NSSize mouseOffset = {0.0, 0.0};
NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard];
NSPoint windowPoint = [dndParams->theEvent locationInWindow];
+ dragPrivate()->executed_action = Qt::ActionMask;
// do the drag
[dndParams->view retain];
[dndParams->view dragImage:image
@@ -1289,6 +1310,7 @@ Qt::DropAction QDragManager::drag(QDrag *o)
slideBack:YES];
[dndParams->view release];
[image release];
+ dragPrivate()->executed_action = Qt::IgnoreAction;
object = 0;
Qt::DropAction performedAction(qt_mac_mapNSDragOperation(dndParams->performedAction));
// do post drag processing, if required.
diff --git a/src/gui/kernel/qshortcut.cpp b/src/gui/kernel/qshortcut.cpp
index f3c93c6..50b6e59 100644
--- a/src/gui/kernel/qshortcut.cpp
+++ b/src/gui/kernel/qshortcut.cpp
@@ -385,21 +385,19 @@ bool QShortcut::event(QEvent *e)
{
Q_D(QShortcut);
bool handled = false;
- if (e->type() == QEvent::Shortcut) {
+ if (d->sc_enabled && e->type() == QEvent::Shortcut) {
QShortcutEvent *se = static_cast<QShortcutEvent *>(e);
if (se->shortcutId() == d->sc_id && se->key() == d->sc_sequence){
- if (d->sc_enabled) {
#ifndef QT_NO_WHATSTHIS
- if (QWhatsThis::inWhatsThisMode()) {
- QWhatsThis::showText(QCursor::pos(), d->sc_whatsthis);
- handled = true;
- } else
+ if (QWhatsThis::inWhatsThisMode()) {
+ QWhatsThis::showText(QCursor::pos(), d->sc_whatsthis);
+ handled = true;
+ } else
#endif
- if (se->isAmbiguous())
- emit activatedAmbiguously();
- else
- emit activated();
- }
+ if (se->isAmbiguous())
+ emit activatedAmbiguously();
+ else
+ emit activated();
handled = true;
}
}
diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp
index 9766a69..ed9654b 100644
--- a/src/gui/kernel/qshortcutmap.cpp
+++ b/src/gui/kernel/qshortcutmap.cpp
@@ -370,8 +370,9 @@ bool QShortcutMap::tryShortcutEvent(QObject *o, QKeyEvent *e)
default:
break;
}
-
- return true;
+ // If nextState is QKeySequence::ExactMatch && identicals.count == 0
+ // we've only found disabled shortcuts
+ return identicalMatches > 0 || result == QKeySequence::PartialMatch;
}
/*! \internal
@@ -493,7 +494,9 @@ QKeySequence::SequenceMatch QShortcutMap::find(QKeyEvent *e)
// We don't need partials, if we have identicals
if (d->identicals.size())
break;
- partialFound = true;
+ // We only care about enabled partials, so we don't consume
+ // key events when all partials are disabled!
+ partialFound |= (*it).enabled;
}
}
++it;
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm
index 52e76d8..f000292 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac.mm
+++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm
@@ -515,6 +515,18 @@ Qt::KeyboardModifiers qt_cocoaModifiers2QtModifiers(ulong modifierFlags)
return qtMods;
}
+Qt::KeyboardModifiers qt_cocoaDragOperation2QtModifiers(uint dragOperations)
+{
+ Qt::KeyboardModifiers qtMods =Qt::NoModifier;
+ if (dragOperations & NSDragOperationLink)
+ qtMods |= Qt::MetaModifier;
+ if (dragOperations & NSDragOperationGeneric)
+ qtMods |= Qt::ControlModifier;
+ if (dragOperations & NSDragOperationCopy)
+ qtMods |= Qt::AltModifier;
+ return qtMods;
+}
+
static inline QEvent::Type cocoaEvent2QtEvent(NSUInteger eventType)
{
// Handle the trivial cases that can be determined from the type.
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac_p.h b/src/gui/kernel/qt_cocoa_helpers_mac_p.h
index ef55aa4..63a301c 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac_p.h
+++ b/src/gui/kernel/qt_cocoa_helpers_mac_p.h
@@ -141,6 +141,7 @@ inline QApplication *qAppInstance() { return static_cast<QApplication *>(QCoreAp
struct ::TabletProximityRec;
void qt_dispatchTabletProximityEvent(const ::TabletProximityRec &proxRec);
Qt::KeyboardModifiers qt_cocoaModifiers2QtModifiers(ulong modifierFlags);
+Qt::KeyboardModifiers qt_cocoaDragOperation2QtModifiers(uint dragOperations);
inline int flipYCoordinate(int y)
{
return QApplication::desktop()->screenGeometry(0).height() - y;
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 9f5f18d..9f0d2a4 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -183,6 +183,7 @@ QWidgetPrivate::QWidgetPrivate(int version) :
,inDirtyList(0)
,isScrolled(0)
,isMoved(0)
+ ,usesDoubleBufferedGLContext(0)
#ifdef Q_WS_WIN
,noPaintOnScreen(0)
#endif
@@ -2132,6 +2133,10 @@ QWidget *QWidget::find(WId id)
If a widget is non-native (alien) and winId() is invoked on it, that widget
will be provided a native handle.
+ On Mac OS X, the type returned depends on which framework Qt was linked
+ against. If Qt is using Carbon, the {WId} is actually an HIViewRef. If Qt
+ is using Cocoa, {WId} is a pointer to an NSView.
+
\note We recommend that you do not store this value as it is likely to
change at run-time.
@@ -4714,10 +4719,13 @@ void QWidget::render(QPaintDevice *target, const QPoint &targetOffset,
if (redirected) {
target = redirected;
offset -= redirectionOffset;
- if (!inRenderWithPainter) { // Clip handled by shared painter (in qpainter.cpp).
- const QRegion redirectedSystemClip = redirected->paintEngine()->systemClip();
- if (!redirectedSystemClip.isEmpty())
- paintRegion &= redirectedSystemClip.translated(-offset);
+ }
+
+ if (!inRenderWithPainter) { // Clip handled by shared painter (in qpainter.cpp).
+ if (QPaintEngine *targetEngine = target->paintEngine()) {
+ const QRegion targetSystemClip = targetEngine->systemClip();
+ if (!targetSystemClip.isEmpty())
+ paintRegion &= targetSystemClip.translated(-offset);
}
}
@@ -9792,27 +9800,6 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
QEvent e(QEvent::MouseTrackingChange);
QApplication::sendEvent(this, &e);
break; }
-#if !defined(QT_NO_DIRECT3D) && defined(Q_WS_WIN)
- case Qt::WA_MSWindowsUseDirect3D:
- if (!qApp->testAttribute(Qt::AA_MSWindowsUseDirect3DByDefault)) {
- if (on) {
- if (!d->extra)
- d->createExtra();
- d->extra->had_auto_fill_bg = d->extra->autoFillBackground;
- d->extra->had_no_system_bg = testAttribute(Qt::WA_NoSystemBackground);
- d->extra->had_paint_on_screen = testAttribute(Qt::WA_PaintOnScreen);
- // enforce the opaque widget state D3D needs
- d->extra->autoFillBackground = true;
- setAttribute(Qt::WA_PaintOnScreen);
- setAttribute(Qt::WA_NoSystemBackground);
- } else if (d->extra) {
- d->extra->autoFillBackground = d->extra->had_auto_fill_bg;
- setAttribute(Qt::WA_PaintOnScreen, d->extra->had_paint_on_screen);
- setAttribute(Qt::WA_NoSystemBackground, d->extra->had_no_system_bg);
- }
- }
- break;
-#endif
case Qt::WA_NativeWindow: {
QInputContext *ic = 0;
if (on && !internalWinId() && testAttribute(Qt::WA_InputMethodEnabled) && hasFocus()) {
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 013fc1e..0f74c32 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -3995,6 +3995,33 @@ void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &oldRect)
}
}
+void QWidgetPrivate::applyMaxAndMinSizeConstraints(int &w, int &h)
+{
+ if (QWExtra *extra = extraData()) {
+ w = qMin(w, extra->maxw);
+ h = qMin(h, extra->maxh);
+ w = qMax(w, extra->minw);
+ h = qMax(h, extra->minh);
+
+ // Deal with size increment
+ if (QTLWExtra *top = topData()) {
+ if(top->incw) {
+ w = w/top->incw;
+ w *= top->incw;
+ }
+ if(top->inch) {
+ h = h/top->inch;
+ h *= top->inch;
+ }
+ }
+ }
+
+ if (isRealWindow()) {
+ w = qMax(0, w);
+ h = qMax(0, h);
+ }
+}
+
void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
{
Q_Q(QWidget);
@@ -4005,7 +4032,9 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
QMacCocoaAutoReleasePool pool;
bool realWindow = isRealWindow();
+
if (realWindow && !(w == 0 && h == 0) && !q->testAttribute(Qt::WA_DontShowOnScreen)) {
+ applyMaxAndMinSizeConstraints(w, h);
topData()->isSetGeometry = 1;
topData()->isMove = isMove;
#ifndef QT_MAC_USE_COCOA
@@ -4031,10 +4060,26 @@ void QWidgetPrivate::setGeometry_sys_helper(int x, int y, int w, int h, bool isM
{
Q_Q(QWidget);
bool realWindow = isRealWindow();
- if(QWExtra *extra = extraData()) { // any size restrictions?
- if(realWindow) {
+
+ QPoint oldp = q->pos();
+ QSize olds = q->size();
+ const bool isResize = (olds != QSize(w, h));
+
+ if (!realWindow && !isResize && QPoint(x, y) == oldp)
+ return;
+
+ if (isResize)
+ data.window_state = data.window_state & ~Qt::WindowMaximized;
+
+ const bool visible = q->isVisible();
+ data.crect = QRect(x, y, w, h);
+
+ if (realWindow) {
+ if (QWExtra *extra = extraData()) {
+ applyMaxAndMinSizeConstraints(w, h);
qt_mac_update_sizer(q);
- if(q->windowFlags() & Qt::WindowMaximizeButtonHint) {
+
+ if (q->windowFlags() & Qt::WindowMaximizeButtonHint) {
#ifndef QT_MAC_USE_COCOA
OSWindowRef window = qt_mac_window_for(q);
if(extra->maxw && extra->maxh && extra->maxw == extra->minw
@@ -4045,43 +4090,8 @@ void QWidgetPrivate::setGeometry_sys_helper(int x, int y, int w, int h, bool isM
}
#endif
}
- }
-
- w = qMin(w,extra->maxw);
- h = qMin(h,extra->maxh);
- w = qMax(w,extra->minw);
- h = qMax(h,extra->minh);
-
- // Deal with size increment
- if(QTLWExtra *top = topData()) {
- if(top->incw) {
- w = w/top->incw;
- w *= top->incw;
- }
- if(top->inch) {
- h = h/top->inch;
- h *= top->inch;
- }
- }
- }
-
- if (realWindow) {
- w = qMax(0, w);
- h = qMax(0, h);
- }
-
- QPoint oldp = q->pos();
- QSize olds = q->size();
- const bool isResize = (olds != QSize(w, h));
- if(!realWindow && !isResize && QPoint(x, y) == oldp)
- return;
- if(isResize && q->isMaximized())
- data.window_state = data.window_state & ~Qt::WindowMaximized;
- const bool visible = q->isVisible();
- data.crect = QRect(x, y, w, h);
- if(realWindow) {
- if(QWExtra *extra = extraData()) { //set constraints
+ // Update max and min constraints:
const float max_f(20000);
#ifndef QT_MAC_USE_COCOA
#define SF(x) ((x > max_f) ? max_f : x)
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index 9e93f66..8731551 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -177,11 +177,6 @@ struct QWExtra {
//bit flags at the end to improve packing
#if defined(Q_WS_WIN)
uint shown_mode : 8; // widget show mode
-#ifndef QT_NO_DIRECT3D
- uint had_paint_on_screen : 1;
- uint had_no_system_bg : 1;
- uint had_auto_fill_bg : 1;
-#endif
#endif
#if defined(Q_WS_X11)
uint compress_events : 1;
@@ -257,6 +252,7 @@ public:
void macUpdateIsOpaque();
void setEnabled_helper_sys(bool enable);
bool isRealWindow() const;
+ void applyMaxAndMinSizeConstraints(int &w, int &h);
#endif
void raise_sys();
@@ -535,6 +531,7 @@ public:
uint inDirtyList : 1;
uint isScrolled : 1;
uint isMoved : 1;
+ uint usesDoubleBufferedGLContext : 1;
#ifdef Q_WS_WIN
uint noPaintOnScreen : 1; // see qwidget_win.cpp ::paintEngine()
diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp
index ffbb341..7374994 100644
--- a/src/gui/kernel/qwidget_win.cpp
+++ b/src/gui/kernel/qwidget_win.cpp
@@ -56,12 +56,6 @@
#include "private/qbackingstore_p.h"
#include "private/qwindowsurface_raster_p.h"
-#ifndef QT_NO_DIRECT3D
-#include "private/qpaintengine_d3d_p.h"
-#include "private/qwindowsurface_d3d_p.h"
-#endif
-
-
#include <qdebug.h>
#include <private/qapplication_p.h>
@@ -1716,11 +1710,6 @@ void QWidgetPrivate::createSysExtra()
#ifndef QT_NO_DRAGANDDROP
extra->dropTarget = 0;
#endif
-#ifndef QT_NO_DIRECT3D
- extra->had_auto_fill_bg = 0;
- extra->had_paint_on_screen = 0;
- extra->had_no_system_bg = 0;
-#endif
}
void QWidgetPrivate::deleteSysExtra()
@@ -1931,22 +1920,6 @@ void QWidgetPrivate::setWindowOpacity_sys(qreal level)
// };
// Q_GLOBAL_STATIC(QGlobalRasterPaintEngine, globalRasterPaintEngine)
-#ifndef QT_NO_DIRECT3D
-static void cleanup_d3d_engine();
-Q_GLOBAL_STATIC_WITH_INITIALIZER(QDirect3DPaintEngine, _qt_d3dEngine,
- {
- qAddPostRoutine(cleanup_d3d_engine);
- })
-static void cleanup_d3d_engine()
-{
- _qt_d3dEngine()->cleanup();
-}
-QDirect3DPaintEngine* qt_d3dEngine()
-{
- return _qt_d3dEngine();
-}
-#endif
-
#ifndef QT_NO_DIRECTDRAW
static uchar *qt_primary_surface_bits;
@@ -2059,19 +2032,6 @@ void qt_win_initialize_directdraw() { }
QPaintEngine *QWidget::paintEngine() const
{
-#ifndef QT_NO_DIRECT3D
- if ((qApp->testAttribute(Qt::AA_MSWindowsUseDirect3DByDefault)
- || testAttribute(Qt::WA_MSWindowsUseDirect3D))
- && qt_d3dEngine()->hasDirect3DSupport())
- {
- QDirect3DPaintEngine *engine = qt_d3dEngine();
- if (qApp->testAttribute(Qt::AA_MSWindowsUseDirect3DByDefault))
- engine->setFlushOnEnd(false);
- else
- engine->setFlushOnEnd(true);
- return engine;
- }
-#endif
#ifndef QT_NO_DIRECTDRAW
QOnScreenRasterPaintEngine *pe = onScreenPaintEngine();
pe->widget = this;
@@ -2100,13 +2060,6 @@ QPaintEngine *QWidget::paintEngine() const
QWindowSurface *QWidgetPrivate::createDefaultWindowSurface_sys()
{
Q_Q(QWidget);
-#ifndef QT_NO_DIRECT3D
- extern QDirect3DPaintEngine *qt_d3dEngine();
- if (qApp->testAttribute(Qt::AA_MSWindowsUseDirect3DByDefault) && (q->windowOpacity() == 1.0f)
- && qt_d3dEngine()->hasDirect3DSupport()) {
- return new QD3DWindowSurface(q);
- }
-#endif
return new QRasterWindowSurface(q);
}
diff --git a/src/gui/mac/images/leopard-unified-toolbar-on.png b/src/gui/mac/images/leopard-unified-toolbar-on.png
new file mode 100644
index 0000000..6716597
--- /dev/null
+++ b/src/gui/mac/images/leopard-unified-toolbar-on.png
Binary files differ
diff --git a/src/gui/mac/maccursors.qrc b/src/gui/mac/macresources.qrc
index d80a63b..9696002 100644
--- a/src/gui/mac/maccursors.qrc
+++ b/src/gui/mac/macresources.qrc
@@ -6,4 +6,7 @@
<file>images/waitcursor.png</file>
<file>images/pluscursor.png</file>
</qresource>
+<qresource prefix="/trolltech/mac/style">
+<file>images/leopard-unified-toolbar-on.png</file>
+</qresource>
</RCC>
diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri
index 528559c..34d1779 100644
--- a/src/gui/painting/painting.pri
+++ b/src/gui/painting/painting.pri
@@ -103,12 +103,6 @@ win32 {
painting/qprinterinfo_win.cpp \
painting/qregion_win.cpp
!win32-borland:!wince*:LIBS += -lmsimg32
- contains(QT_CONFIG, direct3d) {
- HEADERS += painting/qpaintengine_d3d_p.h
- SOURCES += painting/qpaintengine_d3d.cpp
- RESOURCES += painting/qpaintengine_d3d.qrc
- LIBS += -ldxguid
- }
}
embedded {
@@ -362,8 +356,4 @@ embedded {
SOURCES += painting/qwindowsurface_qws.cpp
}
-win32:contains(QT_CONFIG, direct3d) {
- HEADERS += painting/qwindowsurface_d3d_p.h
- SOURCES += painting/qwindowsurface_d3d.cpp
-}
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp
index fbac811a..34df6c9 100644
--- a/src/gui/painting/qbackingstore.cpp
+++ b/src/gui/painting/qbackingstore.cpp
@@ -1517,13 +1517,20 @@ void QWidgetPrivate::repaint_sys(const QRegion &rgn)
extra->staticContentsSize = data.crect.size();
}
+ QPaintEngine *engine = q->paintEngine();
+ // QGLWidget does not support partial updates if:
+ // 1) The context is double buffered
+ // 2) The context is single buffered and auto-fill background is enabled.
+ const bool noPartialUpdateSupport = (engine && engine->type() == QPaintEngine::OpenGL)
+ && (usesDoubleBufferedGLContext || q->autoFillBackground());
+ QRegion toBePainted(noPartialUpdateSupport ? q->rect() : rgn);
+
#ifdef Q_WS_MAC
// No difference between update() and repaint() on the Mac.
- update_sys(rgn);
+ update_sys(toBePainted);
return;
#endif
- QRegion toBePainted(rgn);
toBePainted &= clipRect();
clipToEffectiveMask(toBePainted);
if (toBePainted.isEmpty())
diff --git a/src/gui/painting/qmemrotate.cpp b/src/gui/painting/qmemrotate.cpp
index 7ad0e42..4058143 100644
--- a/src/gui/painting/qmemrotate.cpp
+++ b/src/gui/painting/qmemrotate.cpp
@@ -537,6 +537,7 @@ QT_IMPL_MEMROTATE(quint32, quint24)
QT_IMPL_MEMROTATE(quint32, quint18)
QT_IMPL_MEMROTATE(quint32, quint8)
QT_IMPL_MEMROTATE(quint16, quint8)
+QT_IMPL_MEMROTATE(qrgb444, quint8)
QT_IMPL_MEMROTATE(quint8, quint8)
#ifdef QT_QWS_DEPTH_GENERIC
QT_IMPL_MEMROTATE(quint32, qrgb_generic16)
diff --git a/src/gui/painting/qmemrotate_p.h b/src/gui/painting/qmemrotate_p.h
index bd6006b..c1eb93e 100644
--- a/src/gui/painting/qmemrotate_p.h
+++ b/src/gui/painting/qmemrotate_p.h
@@ -90,6 +90,7 @@ QT_DECL_MEMROTATE(quint32, quint24);
QT_DECL_MEMROTATE(quint32, quint18);
QT_DECL_MEMROTATE(quint32, quint8);
QT_DECL_MEMROTATE(quint16, quint8);
+QT_DECL_MEMROTATE(qrgb444, quint8);
QT_DECL_MEMROTATE(quint8, quint8);
#ifdef QT_QWS_DEPTH_GENERIC
QT_DECL_MEMROTATE(quint32, qrgb_generic16);
diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp
index ad09060..7de1ec4 100644
--- a/src/gui/painting/qpaintengine.cpp
+++ b/src/gui/painting/qpaintengine.cpp
@@ -949,8 +949,8 @@ void QPaintEngine::setSystemClip(const QRegion &region)
Q_D(QPaintEngine);
d->systemClip = region;
// Be backward compatible and only call d->systemStateChanged()
- // if we currently have a system transform set.
- if (d->hasSystemTransform) {
+ // if we currently have a system transform/viewport set.
+ if (d->hasSystemTransform || d->hasSystemViewport) {
d->transformSystemClip();
d->systemStateChanged();
}
diff --git a/src/gui/painting/qpaintengine_d3d.cpp b/src/gui/painting/qpaintengine_d3d.cpp
deleted file mode 100644
index 9a7638b..0000000
--- a/src/gui/painting/qpaintengine_d3d.cpp
+++ /dev/null
@@ -1,4576 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qdebug.h>
-#include "qpaintengine_d3d_p.h"
-
-#include "private/qdrawhelper_p.h"
-#include "private/qfont_p.h"
-#include "private/qfontengine_p.h"
-#include "private/qpaintengine_p.h"
-#include "private/qtessellator_p.h"
-#include <private/qbezier_p.h>
-#include <private/qpainter_p.h>
-#include <private/qpixmap_raster_p.h>
-#include <private/qpolygonclipper_p.h>
-#include <qbuffer.h>
-#include <qcache.h>
-#include <qdir.h>
-#include <qfileinfo.h>
-#include <qlibrary.h>
-#include <qlibraryinfo.h>
-#include <qmath.h>
-#include <qpaintdevice.h>
-#include <qpixmapcache.h>
-
-#include <qwidget.h>
-#include <d3d9.h>
-#include <d3dx9.h>
-
-#include <mmintrin.h>
-#include <xmmintrin.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifndef M_PI
- #define M_PI 3.14159265358979323846
-#endif
-
-#define QD3D_MASK_MARGIN 1
-#define QD3D_BATCH_SIZE 256
-
-// for the ClearType detection stuff..
-#ifndef SPI_GETFONTSMOOTHINGTYPE
-#define SPI_GETFONTSMOOTHINGTYPE 0x200A
-#endif
-
-#ifndef FE_FONTSMOOTHINGCLEARTYPE
-#define FE_FONTSMOOTHINGCLEARTYPE 0x0002
-#endif
-
-//#include <performance.h>
-#define PM_INIT
-#define PM_MEASURE(A)
-#define PM_DISPLAY
-
-//debugging
-//#define QT_DEBUG_VERTEXBUFFER_ACCESS
-//#define QT_DEBUG_D3D
-//#define QT_DEBUG_D3D_CALLS
-
-#define QD3D_SET_MARK(output) \
- D3DPERF_SetMarker(0, QString(output).utf16());
-
-#define QT_VERTEX_RESET_LIMIT 24576
-#define QT_VERTEX_BUF_SIZE 32768
-#define QD3DFVF_CSVERTEX (D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX2 | D3DFVF_TEXCOORDSIZE4(0) | D3DFVF_TEXCOORDSIZE4(1))
-
-// this is a different usage of the effect framework than intended,
-// but it's convenient for us to use (See effect file)
-#define PASS_STENCIL_ODDEVEN 0
-#define PASS_STENCIL_WINDING 1
-#define PASS_STENCIL_DRAW 2
-#define PASS_STENCIL_DRAW_DIRECT 3
-#define PASS_STENCIL_CLIP 4
-#define PASS_STENCIL_NOSTENCILCHECK 5
-#define PASS_STENCIL_NOSTENCILCHECK_DIRECT 6
-#define PASS_TEXT 7
-#define PASS_CLEARTYPE_TEXT 8
-#define PASS_ALIASED_LINES 9
-#define PASS_ALIASED_LINES_DIRECT 10
-
-#define PASS_AA_CREATEMASK 0
-#define PASS_AA_DRAW 1
-#define PASS_AA_DRAW_DIRECT 2
-
-#define D3D_STAGE_COUNT 2
-#define D3D_RENDER_STATES 210
-#define D3D_TEXTURE_STATES 33
-#define D3D_SAMPLE_STATES 14
-
-
-typedef HRESULT (APIENTRY *PFND3DXCREATEBUFFER)(DWORD, LPD3DXBUFFER *);
-typedef HRESULT (APIENTRY *PFND3DXCREATEEFFECT)(LPDIRECT3DDEVICE9, LPCVOID, UINT, CONST D3DXMACRO *,
- LPD3DXINCLUDE, DWORD, LPD3DXEFFECTPOOL,
- LPD3DXEFFECT *, LPD3DXBUFFER *);
-typedef D3DXMATRIX *(APIENTRY *PFND3DXMATRIXORTHOOFFCENTERLH)(D3DMATRIX *, FLOAT, FLOAT,
- FLOAT, FLOAT, FLOAT, FLOAT);
-typedef IDirect3D9 *(APIENTRY *PFNDIRECT3DCREATE9)(uint);
-
-static PFNDIRECT3DCREATE9 pDirect3DCreate9 = 0;
-static PFND3DXCREATEBUFFER pD3DXCreateBuffer = 0;
-static PFND3DXCREATEEFFECT pD3DXCreateEffect = 0;
-static PFND3DXMATRIXORTHOOFFCENTERLH pD3DXMatrixOrthoOffCenterLH = 0;
-
-
-class QD3DSurfaceManager : public QObject {
- Q_OBJECT
-
-public:
- enum QD3DSurfaceManagerStatus {
- NoStatus = 0,
- NeedsResetting = 0x01,
- MaxSizeChanged = 0x02
- };
-
- QD3DSurfaceManager();
- ~QD3DSurfaceManager();
-
- void init(LPDIRECT3D9 object);
-
- void setPaintDevice(QPaintDevice *pd);
-
- int status() const;
- void reset();
-
- LPDIRECT3DSURFACE9 renderTarget();
-
- LPDIRECT3DSURFACE9 surface(QPaintDevice *pd);
- LPDIRECT3DSWAPCHAIN9 swapChain(QPaintDevice *pd);
- void releasePaintDevice(QPaintDevice *pd);
-
- LPDIRECT3DDEVICE9 device();
- void cleanup();
-
- QSize maxSize() const;
-
-private:
- struct D3DSwapChain {
- QSize size;
- LPDIRECT3DSWAPCHAIN9 swapchain;
- LPDIRECT3DSURFACE9 surface;
- };
-
- void updateMaxSize();
- void initPresentParameters(D3DPRESENT_PARAMETERS *params);
- D3DSwapChain *createSwapChain(QWidget *w);
-
- QSize m_max_size;
- int m_status;
- QMap<QPaintDevice *, D3DSwapChain *> m_swapchains;
-
- LPDIRECT3DDEVICE9 m_device;
- QPaintDevice *m_pd;
- HWND m_dummy;
- D3DSwapChain *m_current;
-
-private Q_SLOTS:
- void cleanupPaintDevice(QObject *);
-};
-
-struct vertex {
- D3DVECTOR pos;
- DWORD color;
- FLOAT s0, t0, r0, q0;
- FLOAT s1, t1, r1, q1;
-};
-
-struct QD3DMaskPosition {
- int x, y, channel;
-};
-
-
-struct QD3DBatchItem {
- enum QD3DBatchInfo {
- BI_WINDING = 0x0001,
- BI_AA = 0x0002,
- BI_BRECT = 0x0004,
- BI_MASKFULL = 0x0008,
- BI_TEXT = 0x0010,
- BI_MASK = 0x0020,
- BI_CLIP = 0x0040,
- BI_SCISSOR = 0x0080,
-
- BI_PIXMAP = 0x0100,
- BI_IMAGE = 0x0200,
- BI_COMPLEXBRUSH = 0x0400,
-
- BI_CLEARCLIP = 0x0800, // clip nothing (filling the clip mask with 0)
- BI_TRANSFORM = 0x1000,
- BI_MASKSCISSOR = 0x2000,
- BI_FASTLINE = 0x4000,
- BI_COSMETICPEN = 0x8000
- };
-
- int m_info;
-
- int m_count;
- int m_offset;
-
- QD3DMaskPosition m_maskpos;
- qreal m_xoffset;
- qreal m_yoffset;
- qreal m_opacity;
-
- QPixmap m_pixmap;
- QRectF m_brect;
- QBrush m_brush;
-
- IDirect3DTexture9 *m_texture;
-
- qreal m_width;
- qreal m_distance;
-
- QTransform m_matrix;
- QPainter::CompositionMode m_cmode;
-
- QVector<int> m_pointstops;
-};
-
-struct QD3DBatch {
- int m_item_index;
- QD3DBatchItem items[QD3D_BATCH_SIZE];
-};
-
-class QD3DStateManager;
-class QD3DFontCache;
-class QD3DDrawHelper;
-class QD3DGradientCache;
-
-class QDirect3DPaintEnginePrivate : public QPaintEnginePrivate
-{
- Q_DECLARE_PUBLIC(QDirect3DPaintEngine)
-
-public:
- enum RenderTechnique {
- RT_NoTechnique,
- RT_Antialiased,
- RT_Aliased,
- };
-
- QDirect3DPaintEnginePrivate()
- : m_d3d_object(0)
- , m_d3d_device(0)
- , m_txop(QTransform::TxNone)
- , m_effect(0)
- , m_flush_on_end(0)
- { init(); }
-
- ~QDirect3DPaintEnginePrivate();
-
- bool init();
- void initDevice();
-
- inline QD3DBatchItem *nextBatchItem();
-
- QPolygonF brushCoordinates(const QRectF &r, bool stroke, qreal *fp) const;
- void fillAliasedPath(QPainterPath path, const QRectF &brect, const QTransform &txform);
- void fillAntialiasedPath(const QPainterPath &path, const QRectF &brect,
- const QTransform &txform, bool stroke);
- void fillPath(const QPainterPath &path, QRectF brect);
-
- void strokePath(const QPainterPath &path, QRectF brect, bool simple = false);
- QPainterPath strokePathFastPen(const QPainterPath &path);
- void strokeAliasedPath(QPainterPath path, const QRectF &brect, const QTransform &txform);
-
- void flushBatch();
- int flushAntialiased(int offset);
- void flushAliased(QD3DBatchItem *item, int offset);
- void flushText(QD3DBatchItem *item, int offset);
- void flushLines(QD3DBatchItem *item, int offset);
-
- void updateTransform(const QTransform &matrix);
- void updatePen(const QPen &pen);
- void updateBrush(const QBrush &pen);
- void updateClipRegion(const QRegion &clipregion, Qt::ClipOperation op = Qt::ReplaceClip);
- void updateClipPath(const QPainterPath &clipregion, Qt::ClipOperation op = Qt::ReplaceClip);
- void updateFont(const QFont &font);
-
- void setRenderTechnique(RenderTechnique technique);
-
- QPointF transformPoint(const QPointF &p, qreal *w) const;
-
- bool prepareBatch(QD3DBatchItem *item, int offset);
- void prepareItem(QD3DBatchItem *item);
- void cleanupItem(QD3DBatchItem *item);
- void setCompositionMode(QPainter::CompositionMode mode);
-
- void verifyTexture(const QPixmap &pixmap);
-
- bool isFastRect(const QRectF &rect);
-
- void releaseDC();
-
- void cleanup();
- bool testCaps();
-
- QPixmap getPattern(Qt::BrushStyle style) const;
-
- // clipping
- QPainterPath m_sysclip_path;
- QPainterPath m_clip_path;
- QRegion m_sysclip_region;
- QRegion m_clip_region;
-
- qreal m_opacity;
- D3DCOLOR m_opacity_color;
-
- int m_current_state;
-
- ID3DXEffect* m_effect;
-
- RenderTechnique m_current_technique;
-
- QTransform m_matrix;
- qreal m_inv_scale;
-
- QPen m_pen;
- Qt::BrushStyle m_pen_brush_style;
- QTransform m_inv_pen_matrix;
- D3DCOLOR m_pen_color;
- qreal m_pen_width;
-
- QBrush m_brush;
- Qt::BrushStyle m_brush_style;
- QTransform m_inv_brush_matrix;
- D3DCOLOR m_brush_color;
- QTransform m_brush_origin;
-
- uint m_clipping_enabled : 1;
- uint m_has_complex_clipping : 1;
- uint m_cleartype_text: 1;
- uint m_has_pen : 1;
- uint m_has_cosmetic_pen : 1;
- uint m_has_brush : 1;
- uint m_has_fast_pen : 1;
- uint m_has_aa_fast_pen : 1;
- uint m_flush_on_end : 1;
- uint m_supports_d3d : 1;
-
- QTransform::TransformationType m_txop;
-
- QPainter::CompositionMode m_cmode;
-
- QD3DSurfaceManager m_surface_manager;
- QSize m_surface_size;
-
- LPDIRECT3D9 m_d3d_object;
- LPDIRECT3DDEVICE9 m_d3d_device;
- IDirect3DSurface9 *m_current_surface;
- bool m_in_scene;
-
- QD3DGradientCache *m_gradient_cache;
- QD3DDrawHelper *m_draw_helper;
- QD3DBatch m_batch;
- QD3DStateManager *m_statemanager;
-
- HDC m_dc;
- IDirect3DSurface9 *m_dcsurface;
-
- QMap<Qt::BrushStyle, QPixmap> m_patterns;
-};
-
-
-class QD3DStateManager : public ID3DXEffectStateManager {
-public:
- QD3DStateManager(LPDIRECT3DDEVICE9 pDevice, ID3DXEffect *effect);
- void reset();
-
- inline void startStateBlock();
- inline void endStateBlock();
-
- inline void setCosmeticPen(bool enabled);
- inline void setBrushMode(int mode);
- inline void setTexture(LPDIRECT3DBASETEXTURE9 pTexture);
- inline void setTexture(LPDIRECT3DBASETEXTURE9 pTexture, QGradient::Spread spread);
- inline void setTransformation(const QTransform *matrix = 0);
- inline void setProjection(const D3DXMATRIX *pMatrix);
- inline void setMaskChannel(int channel);
- inline void setMaskOffset(qreal x, qreal y);
- inline void setFocalDistance(const qreal &fd);
-
- inline void beginPass(int pass);
- inline void endPass();
-
- STDMETHOD(QueryInterface)(REFIID iid, LPVOID *ppv);
- STDMETHOD_(ULONG, AddRef)();
- STDMETHOD_(ULONG, Release)();
-
- STDMETHOD(SetTransform)(D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX *pMatrix);
- STDMETHOD(SetMaterial)(CONST D3DMATERIAL9 *pMaterial);
- STDMETHOD(SetLight)(DWORD Index, CONST D3DLIGHT9 *pLight);
- STDMETHOD(LightEnable)(DWORD Index, BOOL Enable);
- STDMETHOD(SetRenderState)(D3DRENDERSTATETYPE State, DWORD Value);
- STDMETHOD(SetTexture)(DWORD Stage, LPDIRECT3DBASETEXTURE9 pTexture);
- STDMETHOD(SetTextureStageState)(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value);
- STDMETHOD(SetSamplerState)(DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value);
- STDMETHOD(SetNPatchMode)(FLOAT NumSegments);
- STDMETHOD(SetFVF)(DWORD FVF);
- STDMETHOD(SetVertexShader)(LPDIRECT3DVERTEXSHADER9 pShader);
- STDMETHOD(SetVertexShaderConstantF)(UINT RegisterIndex, CONST FLOAT *pConstantData, UINT RegisterCount);
- STDMETHOD(SetVertexShaderConstantI)(UINT RegisterIndex, CONST INT *pConstantData, UINT RegisterCount);
- STDMETHOD(SetVertexShaderConstantB)(UINT RegisterIndex, CONST BOOL *pConstantData, UINT RegisterCount);
- STDMETHOD(SetPixelShader)(LPDIRECT3DPIXELSHADER9 pShader);
- STDMETHOD(SetPixelShaderConstantF)(UINT RegisterIndex, CONST FLOAT *pConstantData, UINT RegisterCount);
- STDMETHOD(SetPixelShaderConstantI)(UINT RegisterIndex, CONST INT *pConstantData, UINT RegisterCount);
- STDMETHOD(SetPixelShaderConstantB)(UINT RegisterIndex, CONST BOOL *pConstantData, UINT RegisterCount);
-private:
- LPDIRECT3DVERTEXSHADER9 m_vertexshader;
- LPDIRECT3DPIXELSHADER9 m_pixelshader;
-
- LPDIRECT3DBASETEXTURE9 m_textures[D3D_STAGE_COUNT];
- DWORD m_texturestates[D3D_STAGE_COUNT][D3D_TEXTURE_STATES];
- DWORD m_samplerstates[D3D_STAGE_COUNT][D3D_SAMPLE_STATES];
- DWORD m_renderstate[D3D_RENDER_STATES];
-
- qreal m_radgradfd;
-
- bool m_cosmetic_pen;
- int m_pass;
- int m_maskchannel;
- int m_brushmode;
- LPDIRECT3DBASETEXTURE9 m_texture;
- D3DXMATRIX m_projection;
-
- D3DXMATRIX m_d3dIdentityMatrix;
- bool m_isIdentity;
- QTransform m_transformation;
-
- LPDIRECT3DDEVICE9 m_pDevice;
- ID3DXEffect *m_effect;
-
- LONG m_refs;
- bool m_changed;
- qreal m_xoffset, m_yoffset;
- static int m_mask_channels[4][4];
-};
-
-//
-// font cache stuff
-//
-
-struct QD3DGlyphCoord {
- // stores the offset and size of a glyph texture
- qreal x;
- qreal y;
- qreal width;
- qreal height;
- qreal log_width;
- qreal log_height;
- QFixed x_offset;
- QFixed y_offset;
-};
-
-struct QD3DFontTexture {
- int x_offset; // current glyph offset within the texture
- int y_offset;
- int width;
- int height;
- IDirect3DTexture9 *texture;
-};
-
-typedef QHash<glyph_t, QD3DGlyphCoord*> QD3DGlyphHash;
-typedef QHash<QFontEngine*, QD3DGlyphHash*> QD3DFontGlyphHash;
-typedef QHash<quint64, QD3DFontTexture*> QD3DFontTexHash;
-
-class QD3DGlyphCache : public QObject
-{
- Q_OBJECT
-public:
- QD3DGlyphCache()
- : QObject(0)
- , current_cache(0) {}
- ~QD3DGlyphCache();
- QD3DGlyphCoord *lookup(QFontEngine *, glyph_t);
- void cacheGlyphs(QDirect3DPaintEngine *, const QTextItemInt &, const QVarLengthArray<glyph_t> &,
- bool);
- void cleanCache();
- inline QD3DFontTexture *fontTexture(QFontEngine *engine) {
- return font_textures.constFind(reinterpret_cast<quint64>(engine)).value();
- }
-
-public slots:
- void fontEngineDestroyed(QObject *);
-
-private:
- QImage clearTypeGlyph(QFontEngine *, glyph_t glyph);
- QD3DGlyphHash *current_cache;
- QD3DFontTexHash font_textures;
- QD3DFontGlyphHash font_cache;
-};
-
-QD3DGlyphCache::~QD3DGlyphCache()
-{
-}
-
-QD3DGlyphCoord *QD3DGlyphCache::lookup(QFontEngine *, glyph_t g)
-{
- Q_ASSERT(current_cache != 0);
- QD3DGlyphHash::const_iterator it = current_cache->constFind(g);
- if (it == current_cache->constEnd())
- return 0;
- return it.value();
-}
-
-void QD3DGlyphCache::cleanCache()
-{
- QList<quint64> keys = font_textures.keys();
- for (int i=0; i<keys.size(); ++i)
- font_textures.value(keys.at(i))->texture->Release();
-
- qDeleteAll(font_textures);
- qDeleteAll(font_cache);
- font_textures.clear();
- font_cache.clear();
- current_cache = 0;
-}
-
-void QD3DGlyphCache::fontEngineDestroyed(QObject *object)
-{
-// qDebug() << "=> font engine destroyed: " << object;
- QFontEngine *engine = static_cast<QFontEngine *>(object);
-
- QD3DFontGlyphHash::iterator cache_it = font_cache.find(engine);
- if (cache_it != font_cache.end()) {
- QD3DGlyphHash *cache = font_cache.take(engine);
- delete cache;
- }
-
- quint64 font_key = reinterpret_cast<quint64>(engine);
- QD3DFontTexture *tex = font_textures.take(font_key);
- if (tex) {
- tex->texture->Release();
- delete tex;
- }
-}
-
-QImage QD3DGlyphCache::clearTypeGlyph(QFontEngine *engine, glyph_t glyph)
-{
- glyph_metrics_t gm = engine->boundingBox(glyph);
- int glyph_x = qFloor(gm.x.toReal());
- int glyph_y = qFloor(gm.y.toReal());
- int glyph_width = qCeil((gm.x + gm.width).toReal()) - glyph_x + 2;
- int glyph_height = qCeil((gm.y + gm.height).toReal()) - glyph_y + 2;
-
- if (glyph_width + glyph_x <= 0 || glyph_height <= 0)
- return QImage();
- QImage im(glyph_width + glyph_x, glyph_height, QImage::Format_ARGB32_Premultiplied);
- im.fill(0xff000000); // solid black
- QPainter p(&im);
-
- p.setPen(Qt::white);
- p.setBrush(Qt::NoBrush);
-
- QTextItemInt ti;
- ti.ascent = engine->ascent();
- ti.descent = engine->descent();
- ti.width = glyph_width;
- ti.fontEngine = engine;
-
- QGlyphLayoutArray<1> glyphLayout;
- ti.glyphs = glyphLayout;
- ti.glyphs.glyphs[0] = glyph;
- ti.glyphs.advances_x[0] = glyph_width;
- p.drawTextItem(QPointF(-glyph_x, -glyph_y), ti);
- p.end();
- return im;
-}
-
-#if 0
-static void dump_font_texture(QD3DFontTexture *tex)
-{
- QColor color(Qt::red);
- D3DLOCKED_RECT rect;
- if (FAILED(tex->texture->LockRect(0, &rect, 0, 0))) {
- qDebug() << "debug: unable to lock texture rect.";
- return;
- }
-
-// cleartype version
-// uint *tex_data = (uint *) rect.pBits;
-// QImage im(tex->width, tex->height, QImage::Format_ARGB32);
-// for (int y=0; y<tex->height; ++y) {
-// for (int x=0; x<tex->width; ++x) {
-// im.setPixel(x, y, ((*(tex_data+x+y*tex->width))));
-// }
-// }
- uchar *tex_data = (uchar *) rect.pBits;
- QImage im(rect.Pitch, tex->height, QImage::Format_ARGB32);
- for (int y=0; y<tex->height; ++y) {
- for (int x=0; x<rect.Pitch; ++x) {
- uchar val = ((*(tex_data+x+y*rect.Pitch)));
- im.setPixel(x, y, 0xff000000 | (val << 16) | (val << 8) | val);
- }
- }
- tex->texture->UnlockRect(0);
- static int i= 0;
- im.save(QString("tx%1.png").arg(i++));
-}
-#endif
-
-void QD3DGlyphCache::cacheGlyphs(QDirect3DPaintEngine *engine, const QTextItemInt &ti,
- const QVarLengthArray<glyph_t> &glyphs, bool clearType)
-{
- IDirect3DDevice9 *device = engine->d_func()->m_d3d_device;
- QD3DFontGlyphHash::const_iterator cache_it = font_cache.constFind(ti.fontEngine);
- QD3DGlyphHash *cache = 0;
- if (cache_it == font_cache.constEnd()) {
- cache = new QD3DGlyphHash;
- font_cache.insert(ti.fontEngine, cache);
- connect(ti.fontEngine, SIGNAL(destroyed(QObject *)), SLOT(fontEngineDestroyed(QObject *)));
- } else {
- cache = cache_it.value();
- }
-
- current_cache = cache;
-
- D3DFORMAT tex_format = clearType ? D3DFMT_A8R8G8B8 : D3DFMT_A8;
- quint64 font_key = reinterpret_cast<quint64>(ti.fontEngine);
- QD3DFontTexHash::const_iterator it = font_textures.constFind(font_key);
- QD3DFontTexture *font_tex = 0;
- if (it == font_textures.constEnd()) {
- // alloc a new texture, put it into the cache
- int tex_height = qCeil(ti.ascent.toReal() + ti.descent.toReal()) + 5;
- int tex_width = tex_height * 30; // ###
- IDirect3DTexture9 *tex;
- if (FAILED(device->CreateTexture(tex_width, tex_height, 1, 0,
- tex_format, D3DPOOL_MANAGED, &tex, NULL)))
- {
- qWarning("QD3DGlyphCache::cacheGlyphs(): can't allocate font texture (%dx%d).",
- tex_width, tex_height);
- return;
- } else {
-// qDebug() << "=> new font texture: " << QSize(tex_width,tex_height);
- font_tex = new QD3DFontTexture;
- font_tex->texture = tex;
- font_tex->x_offset = 0;
- font_tex->y_offset = 0;
- font_tex->width = tex_width;
- font_tex->height = tex_height;
- font_textures.insert(font_key, font_tex);
- }
- } else {
- font_tex = it.value();
- // make it current render target..
- }
-
- // cache each glyph
- for (int i=0; i<glyphs.size(); ++i) {
- QD3DGlyphHash::const_iterator it = cache->constFind(glyphs[i]);
- if (it == cache->constEnd()) {
- glyph_metrics_t metrics = ti.fontEngine->boundingBox(glyphs[i]);
- int glyph_width = qCeil(metrics.width.toReal()) + 5;
- int glyph_height = qCeil(ti.ascent.toReal() + ti.descent.toReal()) + 5;
- if (font_tex->x_offset + glyph_width > font_tex->width) {
- // no room on the current line, start new glyph strip
- int strip_height = glyph_height;
- font_tex->x_offset = 0;
- font_tex->y_offset += strip_height;
- if (font_tex->y_offset >= font_tex->height) {
- // if no room in the current texture - realloc a larger texture
- int old_tex_height = font_tex->height;
- font_tex->height += strip_height;
-
- IDirect3DTexture9 *new_tex;
- if (FAILED(device->CreateTexture(font_tex->width, font_tex->height, 1, 0,
- tex_format, D3DPOOL_MANAGED, &new_tex, NULL)))
- {
- qWarning("QD3DGlyphCache(): can't re-allocate font texture.");
- return;
- } else {
-// qDebug() << " -> new glyph strip added:" << QSize(font_tex->width,font_tex->height);
-
- D3DLOCKED_RECT new_rect, old_rect;
- if (FAILED(font_tex->texture->LockRect(0, &old_rect, 0, D3DLOCK_READONLY))) {
- qDebug() << "QD3DGlyphCache: unable to lock texture rect.";
- return;
- }
- if (FAILED(new_tex->LockRect(0, &new_rect, 0, 0))) {
- qDebug() << "QD3DGlyphCache: unable to lock texture rect.";
- return;
- }
- memcpy(new_rect.pBits, old_rect.pBits, new_rect.Pitch * old_tex_height);
- font_tex->texture->UnlockRect(0);
- new_tex->UnlockRect(0);
- engine->d_func()->flushBatch();
- font_tex->texture->Release();
- font_tex->texture = new_tex;
- }
-
- // update the texture coords and the y offset for the existing glyphs in
- // the cache, because of the texture size change
- QD3DGlyphHash::iterator it = cache->begin();
- while (it != cache->end()) {
- it.value()->height = (it.value()->height * old_tex_height) / font_tex->height;
- it.value()->y = (it.value()->y * old_tex_height) / font_tex->height;
- ++it;
- }
- }
- }
- QD3DGlyphCoord *d3d_glyph = new QD3DGlyphCoord;
- d3d_glyph->x = qreal(font_tex->x_offset) / font_tex->width;
- d3d_glyph->y = qreal(font_tex->y_offset) / font_tex->height;
- d3d_glyph->width = qreal(glyph_width) / font_tex->width;
- d3d_glyph->height = qreal(glyph_height) / font_tex->height;
- d3d_glyph->log_width = d3d_glyph->width * font_tex->width;
- d3d_glyph->log_height = d3d_glyph->height * font_tex->height;
- d3d_glyph->x_offset = -metrics.x;
- d3d_glyph->y_offset = metrics.y;
-
- QImage glyph_im;
- if (clearType)
- glyph_im = clearTypeGlyph(ti.fontEngine, glyphs[i]);
- else
- glyph_im = ti.fontEngine->alphaMapForGlyph(glyphs[i]).convertToFormat(QImage::Format_Indexed8);
-
- // write glyph to texture
- D3DLOCKED_RECT rect;
- RECT glyph_rect = { font_tex->x_offset, font_tex->y_offset,
- font_tex->x_offset + glyph_im.width(),
- font_tex->y_offset + glyph_im.height() };
-
-// qDebug() << " > new glyph char added:" << QSize(glyph_im.width(), glyph_im.height());
- if (FAILED(font_tex->texture->LockRect(0, &rect, &glyph_rect, 0))) {
- qDebug() << "QD3DGlyphCache: unable to lock texture rect.";
- return;
- }
-
- // ### unify these loops
- if (clearType) {
- int ppl = rect.Pitch / 4;
- uint *tex_data = (uint *) rect.pBits;
- for (int y=0; y<glyph_im.height(); ++y) {
- uint *s = (uint *) glyph_im.scanLine(y);
- for (int x=0; x<glyph_im.width(); ++x) {
- tex_data[ppl*y + x] = *s;
- ++s;
- }
- }
- } else {
- int ppl = rect.Pitch;
- uchar *tex_data = (uchar *) rect.pBits;
- for (int y=0; y<glyph_im.height(); ++y) {
- uchar *s = (uchar *) glyph_im.scanLine(y);
- for (int x=0; x<glyph_im.width(); ++x) {
- tex_data[ppl*y + x] = *s;
- ++s;
- }
- }
- }
- font_tex->texture->UnlockRect(0);
-
- // debug
-// dump_font_texture(font_tex);
-
- if (font_tex->x_offset + glyph_width > font_tex->width) {
- font_tex->x_offset = 0;
- font_tex->y_offset += glyph_height;
- } else {
- font_tex->x_offset += glyph_width;
- }
-
- cache->insert(glyphs[i], d3d_glyph);
- }
- }
-}
-
-Q_GLOBAL_STATIC(QD3DGlyphCache, qd3d_glyph_cache)
-
-//
-// end font caching stuff
-//
-
-
-//
-// D3D image cache stuff
-//
-
-// ### keep the GL stuff in mind..
-typedef void (*_qt_image_cleanup_hook_64)(qint64);
-extern Q_GUI_EXPORT _qt_image_cleanup_hook_64 qt_image_cleanup_hook_64;
-
-static void qd3d_image_cleanup(qint64 key);
-
-class QD3DImage
-{
-public:
- QD3DImage(IDirect3DDevice9 *device, const QImage &image);
- ~QD3DImage();
-
- IDirect3DTexture9 *texture;
-};
-
-static QList<IDirect3DTexture9 *> qd3d_release_list;
-
-QD3DImage::QD3DImage(IDirect3DDevice9 *device, const QImage &image)
-{
- texture = 0;
- Q_ASSERT(device);
- QImage im = image.convertToFormat(QImage::Format_ARGB32);
- if (FAILED(device->CreateTexture(im.width(), im.height(), 1, 0,
- D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &texture, 0))) {
- qWarning("QD3DImage(): unable to create Direct3D texture.");
- return;
- }
-// qDebug(" -> created image texture: %p - 0x%08x%08x",texture,uint (image.cacheKey() >> 32),uint (image.cacheKey() & 0xffffffff));
- D3DLOCKED_RECT rect;
- if (FAILED(texture->LockRect(0, &rect, 0, 0))) {
- qDebug() << "QD3DImage: unable to lock texture rect.";
- return;
- }
- DWORD *dst = (DWORD *) rect.pBits;
- DWORD *src = (DWORD *) im.scanLine(0);
-
- Q_ASSERT((rect.Pitch/4) == (im.bytesPerLine()/4));
- memcpy(dst, src, rect.Pitch*im.height());
- texture->UnlockRect(0);
-}
-
-QD3DImage::~QD3DImage()
-{
- if (texture)
- qd3d_release_list.append(texture);
-}
-
-static int qd3d_cache_limit = 64*1024; // cache ~64 MB worth of textures
-typedef QCache<quint64, QD3DImage> QD3DImageCache;
-
-class QD3DImageManager
-{
-public:
- QD3DImageManager() {
- // ### GL does the same!
- qt_image_cleanup_hook_64 = qd3d_image_cleanup;
- cache.setMaxCost(qd3d_cache_limit);
- }
- ~QD3DImageManager() {
-// qDebug() << "unhooking d3d image cache";
- qt_image_cleanup_hook_64 = 0;
- cache.clear();
- }
-
- IDirect3DTexture9 *lookup(IDirect3DDevice9 *device, const QImage &image);
- void remove(quint64 key);
-
-private:
- QD3DImageCache cache;
-};
-
-IDirect3DTexture9 *QD3DImageManager::lookup(IDirect3DDevice9 *device, const QImage &image)
-{
- QD3DImage *tex_image = 0;
-
- tex_image = cache.object(image.cacheKey());
- if (!tex_image) {
- // to avoid cache thrashing we remove images from the cache
- // that have the same serial no as the cached image, since
- // that image is most likely destoyed already, and we got a
- // stale cache entry
- uint serial = (uint) (image.cacheKey() >> 32);
- QList<quint64> keys = cache.keys();
- for (int i=0; i<keys.size(); ++i) {
- if ((uint)(keys.at(i) >> 32) == serial) {
- cache.remove(keys.at(i));
- break;
- }
- }
-// qDebug(" => cached: %d, adding cache image: 0x%08x%08x",cache.size(), uint (image.cacheKey() >> 32),uint (image.cacheKey() & 0xffffffff));
- // add cache entry
- int cost = image.width()*image.height()*4/1024;
- if (cache.totalCost() + cost > cache.maxCost()) {
- // no room for new entries? kick out half the cached images
- int old_max_cost = cache.maxCost();
- cache.setMaxCost(old_max_cost/2);
- cache.setMaxCost(old_max_cost);
- }
- tex_image = new QD3DImage(device, image);
- cache.insert(image.cacheKey(), tex_image, cost);
-// qDebug() << "==> total cache cost: " << cache.totalCost() << cost;
- }
-
- return tex_image->texture;
-}
-
-void QD3DImageManager::remove(quint64 key)
-{
-// QList<quint64> keys = cache.keys();
-// if (keys.contains(key))
-// qDebug() << "entery removed from cache";
- cache.remove(key);
-}
-
-Q_GLOBAL_STATIC(QD3DImageManager, qd3d_image_cache)
-
-static void qd3d_image_cleanup(qint64 key)
-{
-// qDebug() << "qd3d_image_cleanup:";
-// qDebug(" => key: 0x%08x%08x", (uint) (key >> 32), (uint)(key & 0xffffffff));
- qd3d_image_cache()->remove(key);
-}
-
-//
-// end D3D image cache stuff
-//
-
-class QD3DDrawHelper : public QTessellator
-{
-public:
- QD3DDrawHelper(QDirect3DPaintEnginePrivate *pe);
- ~QD3DDrawHelper();
-
- bool needsFlushing() const;
- QD3DMaskPosition allocateMaskPosition(const QRectF &brect, bool *breakbatch);
-
- void setClipPath(const QPainterPath &path, QD3DBatchItem **item);
-
- void queueAntialiasedMask(const QPolygonF &poly, QD3DBatchItem **item, const QRectF &brect);
- QRectF queueAliasedMask(const QPainterPath &path, QD3DBatchItem **item, D3DCOLOR color);
-
- void queueRect(const QRectF &rect, QD3DBatchItem *item, D3DCOLOR color, const QPolygonF &trect);
- void queueRect(const QRectF &rect, QD3DBatchItem *item, D3DCOLOR color);
-
- void queueTextGlyph(const QRectF &rect, const qreal *tex_coords, QD3DBatchItem *item,
- D3DCOLOR color);
-
- void queueAntialiasedLines(const QPainterPath &path, QD3DBatchItem **item, const QRectF &brect);
- void queueAliasedLines(const QLineF *lines, int lineCount, QD3DBatchItem **item);
-
- int drawAntialiasedMask(int offset, int maxoffset);
- void drawAliasedMask(int offset);
- void drawAntialiasedBoundingRect(QD3DBatchItem *item);
- void drawAliasedBoundingRect(QD3DBatchItem *item);
- void drawTextItem(QD3DBatchItem *item);
- void drawAliasedLines(QD3DBatchItem *item);
-
- void setMaskSize(QSize size);
-
- void beforeReset();
- void afterReset();
-
- IDirect3DSurface9 *freeMaskSurface();
-
- inline void lockVertexBuffer();
- inline void unlockVertexBuffer();
-
- inline int index() { return m_index; }
-
-#ifdef QT_DEBUG_VERTEXBUFFER_ACCESS
- enum VertexBufferAccess {
- CLEAR = 0x00,
- READ = 0x01,
- WRITE = 0x02
- };
- int accesscontrol[QT_VERTEX_BUF_SIZE];
-#endif
-
-private:
- void addTrap(const Trapezoid &trap);
- void tessellate(const QPolygonF &poly);
- inline void lineToStencil(qreal x, qreal y);
- inline void curveToStencil(const QPointF &cp1, const QPointF &cp2, const QPointF &ep);
- QRectF pathToVertexArrays(const QPainterPath &path);
- void resetMask();
-
- QDirect3DPaintEnginePrivate *m_pe;
-
- qreal m_xoffset, m_yoffset;
- int m_startindex;
- int m_index;
- int m_height, m_width;
- LPDIRECT3DVERTEXBUFFER9 m_d3dvbuff;
- vertex *m_vbuff;
- QD3DBatchItem *m_item;
- QRectF m_boundingRect;
-
- qreal max_x;
- qreal max_y;
- qreal min_x;
- qreal min_y;
- qreal firstx;
- qreal firsty;
-
- QPointF tess_lastpoint;
- int tess_index;
-
- bool m_locked;
- IDirect3DTexture9 *m_mask;
- IDirect3DSurface9 *m_maskSurface;
- IDirect3DSurface9 *m_depthStencilSurface;
-
- D3DCOLOR m_color;
- bool m_clearmask;
- bool m_isLine;
- bool m_firstPoint;
-
- QD3DMaskPosition m_mask_position;
- int m_mask_offsetX2;
- int m_mask_offsetY2;
-};
-
-QD3DStateManager::QD3DStateManager(LPDIRECT3DDEVICE9 pDevice, ID3DXEffect *effect)
- : m_pDevice(pDevice), m_effect(effect), m_refs(0)
-{
- if (FAILED(D3DXMatrixIdentity(&m_d3dIdentityMatrix))) {
- qWarning("QDirect3DPaintEngine: D3DXMatrixIdentity failed");
- }
- reset();
-}
-
-void QD3DStateManager::reset()
-{
- m_radgradfd = -1;
-
- m_cosmetic_pen = false;
- m_pass = -1;
- m_maskchannel = -1;
- m_brushmode = -1;
- m_texture = 0;
- m_xoffset = INT_MAX;
- m_yoffset = INT_MAX;
-
- m_vertexshader = 0;
- m_pixelshader = 0;
-
- m_isIdentity = true;
- m_transformation = QTransform();
- m_effect->SetMatrix("g_mTransformation", &m_d3dIdentityMatrix);
-
- ZeroMemory(&m_projection, sizeof(D3DMATRIX));
- ZeroMemory(m_textures, sizeof(LPDIRECT3DBASETEXTURE9) * D3D_STAGE_COUNT);
- FillMemory(m_samplerstates, sizeof(DWORD) * D3D_SAMPLE_STATES * D3D_STAGE_COUNT, 0xFFFFFFFE);
- FillMemory(m_texturestates, sizeof(DWORD) * D3D_TEXTURE_STATES * D3D_STAGE_COUNT, 0xFFFFFFFE);
- FillMemory(m_renderstate, sizeof(DWORD) * D3D_RENDER_STATES, 0xFFFFFFFE);
-}
-
-inline void QD3DStateManager::beginPass(int pass)
-{
- if (pass != m_pass) {
- if (m_pass != -1)
- m_effect->EndPass();
- m_effect->BeginPass(pass);
- m_pass = pass;
- }
-}
-
-inline void QD3DStateManager::endPass()
-{
- if (m_pass != -1) {
- m_pass = -1;
- m_effect->EndPass();
- }
-}
-
-inline void QD3DStateManager::startStateBlock() {
- m_changed = false;
-}
-
-inline void QD3DStateManager::setCosmeticPen(bool enabled)
-{
- if (enabled != m_cosmetic_pen) {
- m_effect->SetBool("g_mCosmeticPen", enabled);
- m_cosmetic_pen = enabled;
- m_changed = true;
- }
-}
-
-inline void QD3DStateManager::setBrushMode(int mode)
-{
- if (mode != m_brushmode) {
- m_effect->SetInt("g_mBrushMode", mode);
- m_brushmode = mode;
- m_changed = true;
- }
-}
-
-inline void QD3DStateManager::setTexture(LPDIRECT3DBASETEXTURE9 pTexture)
-{
- SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_BORDER);
- SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
-
- if (pTexture != m_texture) {
- m_texture = pTexture;
- m_effect->SetTexture("g_mTexture", pTexture);
- m_changed = true;
- }
-}
-
-inline void QD3DStateManager::setTexture(LPDIRECT3DBASETEXTURE9 pTexture, QGradient::Spread spread)
-{
- switch(spread) {
- case QGradient::RepeatSpread:
- SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_WRAP);
- SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_WRAP);
- break;
- case QGradient::ReflectSpread:
- SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_MIRROR);
- SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_MIRROR);
- break;
- default:
- SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
- SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
- break;
- };
-
- if (pTexture != m_texture) {
- m_texture = pTexture;
- m_effect->SetTexture("g_mTexture", pTexture);
- m_changed = true;
- }
-}
-
-inline void QD3DStateManager::setTransformation(const QTransform *matrix)
-{
- if (matrix) {
- if (*matrix != m_transformation) {
- D3DXMATRIX dxmatrix(matrix->m11(), matrix->m12(), 0, matrix->m13(),
- matrix->m21(), matrix->m22(), 0, matrix->m23(),
- 0, 0, 1, 0,
- matrix->dx(), matrix->dy(), 0, 1);
- m_effect->SetMatrix("g_mTransformation", &dxmatrix);
- m_transformation = *matrix;
- m_changed = true;
- m_isIdentity = false;
- }
- } else if (!m_isIdentity) {
- m_effect->SetMatrix("g_mTransformation", &m_d3dIdentityMatrix);
- m_transformation = QTransform();
- m_changed = true;
- m_isIdentity = true;
- }
-}
-
-inline void QD3DStateManager::setProjection(const D3DXMATRIX *pMatrix)
-{
- if (*pMatrix != m_projection) {
- m_effect->SetMatrix("g_mViewProjection", pMatrix);
- m_projection = *pMatrix;
- m_changed = true;
- }
-}
-
-inline void QD3DStateManager::setFocalDistance(const qreal &fd)
-{
- if (fd != m_radgradfd) {
- m_effect->SetFloat("g_mFocalDist", fd);
- m_changed = true;
- m_radgradfd = fd;
- }
-}
-
-inline void QD3DStateManager::setMaskOffset(qreal x, qreal y)
-{
- if (x != m_xoffset || y != m_yoffset) {
- float offset[2] = {x, y};
- m_effect->SetFloatArray("g_mMaskOffset", offset, 2);
- m_xoffset = x;
- m_yoffset = y;
- m_changed = true;
- }
-}
-
-inline void QD3DStateManager::setMaskChannel(int channel)
-{
- if (m_maskchannel != channel) {
- m_effect->SetIntArray("g_mChannel", m_mask_channels[channel], 4);
- m_maskchannel = channel;
- m_changed = true;
- }
-}
-
-inline void QD3DStateManager::endStateBlock()
-{
- if (m_changed) {
- m_effect->CommitChanges();
- m_changed = false;
- }
-}
-
-STDMETHODIMP QD3DStateManager::QueryInterface(REFIID iid, LPVOID *ppv)
-{
- if(iid == IID_IUnknown || iid == IID_ID3DXEffectStateManager)
- {
- *ppv = this;
- ++m_refs;
- return NOERROR;
- }
- *ppv = NULL;
- return ResultFromScode(E_NOINTERFACE);
-}
-
-STDMETHODIMP_(ULONG) QD3DStateManager::AddRef(void)
-{
- return (ULONG)InterlockedIncrement( &m_refs );
-}
-
-
-STDMETHODIMP_(ULONG) QD3DStateManager::Release(void)
-{
- if( 0L == InterlockedDecrement( &m_refs ) ) {
- delete this;
- return 0L;
- }
-
- return m_refs;
-}
-STDMETHODIMP QD3DStateManager::SetTransform(D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX *pMatrix)
-{
- return m_pDevice->SetTransform(State, pMatrix);
-}
-
-STDMETHODIMP QD3DStateManager::SetMaterial(CONST D3DMATERIAL9 *pMaterial)
-{
- return m_pDevice->SetMaterial(pMaterial);
-}
-
-STDMETHODIMP QD3DStateManager::SetLight(DWORD Index, CONST D3DLIGHT9 *pLight)
-{
- return m_pDevice->SetLight(Index, pLight);
-}
-
-STDMETHODIMP QD3DStateManager::LightEnable(DWORD Index, BOOL Enable)
-{
- return m_pDevice->LightEnable(Index, Enable);
-}
-
-STDMETHODIMP QD3DStateManager::SetRenderState(D3DRENDERSTATETYPE State, DWORD Value)
-{
- if (State < D3D_RENDER_STATES) {
- if (m_renderstate[State] == Value)
- return S_OK;
- m_renderstate[State] = Value;
- }
- return m_pDevice->SetRenderState(State, Value);
-}
-
-STDMETHODIMP QD3DStateManager::SetTexture(DWORD Stage, LPDIRECT3DBASETEXTURE9 pTexture)
-{
- if (Stage < D3D_STAGE_COUNT) {
- if (m_textures[Stage] == pTexture)
- return S_OK;
- m_textures[Stage] = pTexture;
- }
- return m_pDevice->SetTexture(Stage, pTexture);
-}
-
-STDMETHODIMP QD3DStateManager::SetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value)
-{
- if (Stage < D3D_STAGE_COUNT && Type < D3D_TEXTURE_STATES) {
- if (m_texturestates[Stage][Type] == Value)
- return S_OK;
- m_texturestates[Stage][Type] = Value;
- }
- return m_pDevice->SetTextureStageState(Stage, Type, Value);
-}
-
-STDMETHODIMP QD3DStateManager::SetSamplerState(DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value)
-{
- if (Sampler < D3D_STAGE_COUNT && Type < D3D_SAMPLE_STATES) {
- if (m_samplerstates[Sampler][Type] == Value)
- return S_OK;
- m_samplerstates[Sampler][Type] = Value;
- }
- return m_pDevice->SetSamplerState(Sampler, Type, Value);
-}
-
-STDMETHODIMP QD3DStateManager::SetNPatchMode(FLOAT NumSegments)
-{
- return m_pDevice->SetNPatchMode(NumSegments);
-}
-
-STDMETHODIMP QD3DStateManager::SetFVF(DWORD FVF)
-{
- return m_pDevice->SetFVF(FVF);
-}
-
-STDMETHODIMP QD3DStateManager::SetVertexShader(LPDIRECT3DVERTEXSHADER9 pShader)
-{
- if (m_vertexshader == pShader)
- return S_OK;
- m_vertexshader = pShader;
- return m_pDevice->SetVertexShader(pShader);
-}
-
-STDMETHODIMP QD3DStateManager::SetVertexShaderConstantF(UINT RegisterIndex, CONST FLOAT *pConstantData, UINT RegisterCount)
-{
- return m_pDevice->SetVertexShaderConstantF(RegisterIndex, pConstantData, RegisterCount);
-}
-
-STDMETHODIMP QD3DStateManager::SetVertexShaderConstantI(UINT RegisterIndex, CONST INT *pConstantData, UINT RegisterCount)
-{
- return m_pDevice->SetVertexShaderConstantI(RegisterIndex, pConstantData, RegisterCount);
-}
-
-STDMETHODIMP QD3DStateManager::SetVertexShaderConstantB(UINT RegisterIndex, CONST BOOL *pConstantData, UINT RegisterCount)
-{
- return m_pDevice->SetVertexShaderConstantB(RegisterIndex, pConstantData, RegisterCount);
-}
-
-STDMETHODIMP QD3DStateManager::SetPixelShader(LPDIRECT3DPIXELSHADER9 pShader)
-{
- if (m_pixelshader == pShader)
- return S_OK;
- m_pixelshader = pShader;
- return m_pDevice->SetPixelShader(pShader);
-}
-
-STDMETHODIMP QD3DStateManager::SetPixelShaderConstantF(UINT RegisterIndex, CONST FLOAT *pConstantData, UINT RegisterCount)
-{
- return m_pDevice->SetPixelShaderConstantF(RegisterIndex, pConstantData, RegisterCount);
-}
-
-STDMETHODIMP QD3DStateManager::SetPixelShaderConstantI(UINT RegisterIndex, CONST INT *pConstantData, UINT RegisterCount)
-{
- return m_pDevice->SetPixelShaderConstantI(RegisterIndex, pConstantData, RegisterCount);
-}
-
-STDMETHODIMP QD3DStateManager::SetPixelShaderConstantB(UINT RegisterIndex, CONST BOOL *pConstantData, UINT RegisterCount)
-{
- return m_pDevice->SetPixelShaderConstantB(RegisterIndex, pConstantData, RegisterCount);
-}
-
-#define QD3D_GRADIENT_CACHE_SIZE 60
-#define QD3D_GRADIENT_PALETTE_SIZE 1024
-
-class QD3DGradientCache
-{
- struct CacheInfo
- {
- inline CacheInfo(QGradientStops s, qreal op) :
- stops(s), opacity(op) {}
-
- IDirect3DTexture9 *texture;
- QGradientStops stops;
- qreal opacity;
- };
-
- typedef QMultiHash<quint64, CacheInfo> QD3DGradientColorTableHash;
-
-public:
- QD3DGradientCache(LPDIRECT3DDEVICE9 device);
- ~QD3DGradientCache();
-
- inline IDirect3DTexture9 *getBuffer(const QGradientStops &stops, qreal opacity);
-
-protected:
- inline void generateGradientColorTable(const QGradientStops& s,
- uint *colorTable,
- int size, qreal opacity) const;
- IDirect3DTexture9 *addCacheElement(quint64 hash_val, const QGradientStops &stops, qreal opacity);
- void cleanCache();
-
- QD3DGradientColorTableHash cache;
- LPDIRECT3DDEVICE9 m_device;
-};
-
-QD3DGradientCache::QD3DGradientCache(LPDIRECT3DDEVICE9 device)
- : m_device(device)
-{
-
-}
-
-QD3DGradientCache::~QD3DGradientCache()
-{
- cleanCache();
-}
-
-inline IDirect3DTexture9 *QD3DGradientCache::getBuffer(const QGradientStops &stops, qreal opacity)
-{
- quint64 hash_val = 0;
-
- for (int i = 0; i < stops.size() && i <= 2; i++)
- hash_val += stops[i].second.rgba();
-
- QD3DGradientColorTableHash::const_iterator it = cache.constFind(hash_val);
-
- if (it == cache.constEnd())
- return addCacheElement(hash_val, stops, opacity);
- else {
- do {
- const CacheInfo &cache_info = it.value();
- if (cache_info.stops == stops && cache_info.opacity == opacity) {
- return cache_info.texture;
- }
- ++it;
- } while (it != cache.constEnd() && it.key() == hash_val);
- // an exact match for these stops and opacity was not found, create new cache
- return addCacheElement(hash_val, stops, opacity);
- }
-}
-
-void QD3DGradientCache::generateGradientColorTable(const QGradientStops& s, uint *colorTable, int size, qreal opacity) const
-{
- int pos = 0;
- qreal fpos = 0.0;
- qreal incr = 1.0 / qreal(size);
- QVector<uint> colors(s.size());
-
- for (int i = 0; i < s.size(); ++i)
- colors[i] = s[i].second.rgba();
-
- uint alpha = qRound(opacity * 255);
- while (fpos < s.first().first) {
- colorTable[pos] = ARGB_COMBINE_ALPHA(colors[0], alpha);
- pos++;
- fpos += incr;
- }
-
- for (int i = 0; i < s.size() - 1; ++i) {
- qreal delta = 1/(s[i+1].first - s[i].first);
- while (fpos < s[i+1].first && pos < size) {
- int dist = int(256 * ((fpos - s[i].first) * delta));
- int idist = 256 - dist;
- uint current_color = ARGB_COMBINE_ALPHA(colors[i], alpha);
- uint next_color = ARGB_COMBINE_ALPHA(colors[i+1], alpha);
-#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
- colorTable[pos] = INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist);
-#else
- uint c = INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist);
- colorTable[pos] = ( (c << 24) & 0xff000000)
- | ((c >> 24) & 0x000000ff)
- | ((c << 8) & 0x00ff0000)
- | ((c >> 8) & 0x0000ff00);
-#endif // Q_BYTE_ORDER
- ++pos;
- fpos += incr;
- }
- }
- for (;pos < size; ++pos)
- colorTable[pos] = colors[s.size() - 1];
-}
-
-IDirect3DTexture9 *QD3DGradientCache::addCacheElement(quint64 hash_val, const QGradientStops &stops, qreal opacity)
-{
- if (cache.size() == QD3D_GRADIENT_CACHE_SIZE) {
- int elem_to_remove = qrand() % QD3D_GRADIENT_CACHE_SIZE;
- uint key = cache.keys()[elem_to_remove];
-
- // need to call release on each removed cache entry:
- QD3DGradientColorTableHash::const_iterator it = cache.constFind(key);
- do {
- it.value().texture->Release();
- } while (++it != cache.constEnd() && it.key() == key);
-
- cache.remove(key); // may remove more than 1, but OK
- }
-
- CacheInfo cache_entry(stops, opacity);
- uint buffer[QD3D_GRADIENT_PALETTE_SIZE];
- generateGradientColorTable(stops, buffer, QD3D_GRADIENT_PALETTE_SIZE, opacity);
-
- if (FAILED(m_device->CreateTexture(QD3D_GRADIENT_PALETTE_SIZE, 1, 1, 0,
- D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &cache_entry.texture, 0))) {
- qWarning("QD3DGradientCache::addCacheElement(): unable to create Direct3D texture.");
- return 0;
- }
-
- D3DLOCKED_RECT rect;
- if (FAILED(cache_entry.texture->LockRect(0, &rect, 0, 0))) {
- qDebug() << "QD3DGradientCache::addCacheElement(): unable to lock texture rect.";
- return 0;
- }
- memcpy(rect.pBits, buffer, rect.Pitch);
- cache_entry.texture->UnlockRect(0);
-
- return cache.insert(hash_val, cache_entry).value().texture;
-}
-
-void QD3DGradientCache::cleanCache()
-{
- QD3DGradientColorTableHash::const_iterator it = cache.constBegin();
- for (; it != cache.constEnd(); ++it) {
- const CacheInfo &cache_info = it.value();
- cache_info.texture->Release();
- }
- cache.clear();
-}
-
-QD3DSurfaceManager::QD3DSurfaceManager() :
- m_status(NoStatus), m_dummy(0), m_device(0), m_pd(0), m_current(0)
-{
-
-}
-
-QD3DSurfaceManager::~QD3DSurfaceManager()
-{
-}
-
-void QD3DSurfaceManager::setPaintDevice(QPaintDevice *pd)
-{
- m_status = NoStatus;
- m_pd = pd;
- m_current = 0;
-
- if (m_device->TestCooperativeLevel() != D3D_OK) {
- m_status = NeedsResetting;
- return;
- }
-
- m_current = m_swapchains.value(pd, 0);
- QWidget *w = static_cast<QWidget*>(pd);
-
- if (m_current) {
- if (m_current->size != w->size()) {
- m_swapchains.remove(pd);
- m_current->surface->Release();
- m_current->swapchain->Release();
- delete m_current;
- m_current = 0;
- }
- }
-
- if (!m_current) {
- m_current = createSwapChain(w);
- updateMaxSize();
- }
-}
-
-int QD3DSurfaceManager::status() const
-{
- return m_status;
-}
-
-void QD3DSurfaceManager::reset()
-{
- QList<QPaintDevice *> pds = m_swapchains.keys();
-
- QMap<QPaintDevice *, D3DSwapChain *>::const_iterator i = m_swapchains.constBegin();
- while (i != m_swapchains.constEnd()) {
- i.value()->surface->Release();
- i.value()->swapchain->Release();
- ++i;
- }
- qDeleteAll(m_swapchains.values());
- m_swapchains.clear();
-
- D3DPRESENT_PARAMETERS params;
- initPresentParameters(&params);
- params.hDeviceWindow = m_dummy;
-
- HRESULT res = m_device->Reset(&params);
- if (FAILED(res)) {
- switch (res) {
- case D3DERR_DEVICELOST:
- qWarning("QDirect3DPaintEngine: Reset failed (D3DERR_DEVICELOST)");
- break;
- case D3DERR_DRIVERINTERNALERROR:
- qWarning("QDirect3DPaintEngine: Reset failed (D3DERR_DRIVERINTERNALERROR)");
- break;
- case D3DERR_OUTOFVIDEOMEMORY:
- qWarning("QDirect3DPaintEngine: Reset failed (D3DERR_OUTOFVIDEOMEMORY)");
- break;
- default:
- qWarning("QDirect3DPaintEngine: Reset failed");
- };
- }
-
- for (int i=0; i<pds.count(); ++i) {
- QWidget *w = static_cast<QWidget*>(pds.at(i));
- createSwapChain(w);
- }
-
- // reset the mask as well
- m_status = MaxSizeChanged;
-
- setPaintDevice(m_pd);
- updateMaxSize();
-}
-
-LPDIRECT3DSURFACE9 QD3DSurfaceManager::renderTarget()
-{
- return m_current ? m_current->surface : 0;
-}
-
-LPDIRECT3DSURFACE9 QD3DSurfaceManager::surface(QPaintDevice *pd)
-{
- D3DSwapChain *swapchain = m_swapchains.value(pd, 0);
- return swapchain ? swapchain->surface : 0;
-}
-
-LPDIRECT3DSWAPCHAIN9 QD3DSurfaceManager::swapChain(QPaintDevice *pd)
-{
- D3DSwapChain *swapchain = m_swapchains.value(pd, 0);
- return swapchain ? swapchain->swapchain : 0;
-}
-
-void QD3DSurfaceManager::releasePaintDevice(QPaintDevice *pd)
-{
- D3DSwapChain *swapchain = m_swapchains.take(pd);
-
- if (swapchain) {
- swapchain->surface->Release();
- swapchain->swapchain->Release();
- delete swapchain;
- if (swapchain == m_current)
- m_current = 0;
- }
-}
-
-LPDIRECT3DDEVICE9 QD3DSurfaceManager::device()
-{
- return m_device;
-}
-
-void QD3DSurfaceManager::cleanup()
-{
- QPixmapCache::clear();
- qd3d_glyph_cache()->cleanCache();
-
- // release doomed textures
- for (int k=0; k<qd3d_release_list.size(); ++k)
- qd3d_release_list.at(k)->Release();
- qd3d_release_list.clear();
-
- QMap<QPaintDevice *, D3DSwapChain *>::const_iterator i = m_swapchains.constBegin();
- while (i != m_swapchains.constEnd()) {
- i.value()->surface->Release();
- i.value()->swapchain->Release();
- ++i;
- }
- qDeleteAll(m_swapchains.values());
-
- if (m_device)
- m_device->Release();
-
- DestroyWindow(m_dummy);
- QString cname(QLatin1String("qt_d3d_dummy"));
- QT_WA({
- UnregisterClass((TCHAR*)cname.utf16(), (HINSTANCE)qWinAppInst());
- } , {
- UnregisterClassA(cname.toLatin1(), (HINSTANCE)qWinAppInst());
- });
-}
-
-QSize QD3DSurfaceManager::maxSize() const
-{
- return m_max_size;
-}
-
-extern "C" {
- LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
-};
-
-void QD3DSurfaceManager::init(LPDIRECT3D9 object)
-{
- QString cname(QLatin1String("qt_d3d_dummy"));
- uint style = CS_DBLCLKS | CS_SAVEBITS;
- ATOM atom;
- QT_WA({
- WNDCLASS wc;
- wc.style = style;
- wc.lpfnWndProc = (WNDPROC)QtWndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = (HINSTANCE)qWinAppInst();
- wc.hIcon = 0;
- wc.hCursor = 0;
- wc.hbrBackground = 0;
- wc.lpszMenuName = 0;
- wc.lpszClassName = (TCHAR*)cname.utf16();
- atom = RegisterClass(&wc);
- } , {
- WNDCLASSA wc;
- wc.style = style;
- wc.lpfnWndProc = (WNDPROC)QtWndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = (HINSTANCE)qWinAppInst();
- wc.hIcon = 0;
- wc.hCursor = 0;
- wc.hbrBackground = 0;
- wc.lpszMenuName = 0;
- QByteArray tempArray = cname.toLatin1();
- wc.lpszClassName = tempArray;
- atom = RegisterClassA(&wc);
- });
-
- QT_WA({
- const TCHAR *className = (TCHAR*)cname.utf16();
- m_dummy = CreateWindow(className, className, 0,
- 0, 0, 1, 1,
- 0, 0, qWinAppInst(), 0);
- } , {
- m_dummy = CreateWindowA(cname.toLatin1(), cname.toLatin1(), 0,
- 0, 0, 1, 1,
- 0, 0, qWinAppInst(), 0);
- });
-
- D3DPRESENT_PARAMETERS params;
- initPresentParameters(&params);
- params.hDeviceWindow = m_dummy;
-
- HRESULT res = object->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, 0,
- D3DCREATE_PUREDEVICE|D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_NOWINDOWCHANGES|D3DCREATE_FPU_PRESERVE,
- &params, &m_device);
-
- if (FAILED(res) || m_device == 0)
- qWarning("QDirect3DPaintEngine: failed to create Direct3D device (error=0x%x).", res);
-}
-
-void QD3DSurfaceManager::updateMaxSize()
-{
- int w = 0, h = 0;
- QMap<QPaintDevice *, D3DSwapChain *>::const_iterator i = m_swapchains.constBegin();
- while (i != m_swapchains.constEnd()) {
-
- int nw = i.key()->width();
- if (nw > w)
- w = nw;
-
- int nh = i.key()->height();
- if (nh > h)
- h = nh;
-
- ++i;
- }
-
- QSize newsize = QSize(w, h);
- if (newsize != m_max_size) {
- m_status |= MaxSizeChanged;
- m_max_size = newsize;
- }
-}
-
-void QD3DSurfaceManager::initPresentParameters(D3DPRESENT_PARAMETERS *params)
-{
- ZeroMemory(params, sizeof(D3DPRESENT_PARAMETERS));
- params->Windowed = true;
- params->SwapEffect = D3DSWAPEFFECT_COPY;
- params->BackBufferFormat = D3DFMT_UNKNOWN;
- params->PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
- params->Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;
-}
-
-QD3DSurfaceManager::D3DSwapChain *QD3DSurfaceManager::createSwapChain(QWidget *w)
-{
- D3DPRESENT_PARAMETERS params;
- initPresentParameters(&params);
- params.hDeviceWindow = w->winId();
- D3DSwapChain *swapchain = new D3DSwapChain();
- swapchain->size = w->size();
- if (FAILED(m_device->CreateAdditionalSwapChain(&params, &swapchain->swapchain)))
- qWarning("QDirect3DPaintEngine: CreateAdditionalSwapChain failed");
- if (FAILED(swapchain->swapchain->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &swapchain->surface)))
- qWarning("QDirect3DPaintEngine: GetBackBuffer failed");
- m_swapchains.insert(w, swapchain);
- connect(w, SIGNAL(destroyed(QObject *)), SLOT(cleanupPaintDevice(QObject *)));
-
- // init with background color
- QColor bg = w->palette().color(QPalette::Background);
- m_device->ColorFill(swapchain->surface, 0, D3DCOLOR_ARGB(bg.alpha(), bg.red(),bg.green(),bg.blue()));
-
- return swapchain;
-}
-
-void QD3DSurfaceManager::cleanupPaintDevice(QObject *object)
-{
- QWidget *w = static_cast<QWidget *>(object);
- releasePaintDevice(w);
-}
-
-int QD3DStateManager::m_mask_channels[4][4] =
- {{1,0,0,0},{0,1,0,0},{0,0,1,0},{0,0,0,1}};
-
-QD3DDrawHelper::QD3DDrawHelper(QDirect3DPaintEnginePrivate *pe)
- : m_pe(pe), m_d3dvbuff(0), m_maskSurface(0), m_depthStencilSurface(0),
- m_locked(false), m_mask(0), m_startindex(0), m_index(0), m_vbuff(0), m_clearmask(true),
- m_isLine(false), m_firstPoint(true)
-{
- resetMask();
-#ifdef QT_DEBUG_VERTEXBUFFER_ACCESS
- memset(accesscontrol, 0, QT_VERTEX_BUF_SIZE * sizeof(VertexBufferAccess));
-#endif
-
- // create vertex buffer
- afterReset();
-}
-
-QD3DDrawHelper::~QD3DDrawHelper()
-{
- if (m_maskSurface)
- m_maskSurface->Release();
-
- if (m_mask)
- m_mask->Release();
-
- if (m_depthStencilSurface)
- m_depthStencilSurface->Release();
-
- if (m_d3dvbuff)
- m_d3dvbuff->Release();
-}
-
-inline void QD3DDrawHelper::lockVertexBuffer()
-{
- if (!m_locked) {
- DWORD lockflags = D3DLOCK_NOOVERWRITE;
- if (m_startindex >= QT_VERTEX_RESET_LIMIT) {
- m_startindex = 0;
- m_index = 0;
-
-#ifdef QT_DEBUG_VERTEXBUFFER_ACCESS
- for (int i=0; i<QT_VERTEX_BUF_SIZE; ++i) {
- if (accesscontrol[i] != (WRITE|READ) && accesscontrol[i] != CLEAR)
- qDebug() << "Vertex Buffer: Access Error";
- }
- memset(accesscontrol, 0, QT_VERTEX_BUF_SIZE * sizeof(VertexBufferAccess));
-#endif
-
- lockflags = D3DLOCK_DISCARD;
- }
-
- if (FAILED(m_d3dvbuff->Lock(0, 0, (void**)&m_vbuff, lockflags))) {
- qWarning() << "QDirect3DPaintEngine: unable to lock vertex buffer.";
- }
- m_locked = true;
- }
-}
-
-inline void QD3DDrawHelper::unlockVertexBuffer()
-{
- if (m_locked) {
- if (FAILED(m_d3dvbuff->Unlock())) {
- qWarning() << "QDirect3DPaintEngine: unable to unlock vertex buffer.";
- }
- m_locked = false;
- }
-}
-
-void QD3DDrawHelper::setClipPath(const QPainterPath &path, QD3DBatchItem **item)
-{
- lockVertexBuffer();
-
- m_item = *item;
- m_item->m_maskpos.x = m_item->m_maskpos.y = 0;
- m_item->m_maskpos.channel = 3;
- m_item->m_info |= QD3DBatchItem::BI_CLIP;
-
- bool winding = (path.fillRule() == Qt::WindingFill);
- if (winding)
- m_item->m_info |= QD3DBatchItem::BI_WINDING;
-
- if (!path.isEmpty()) {
- m_item->m_info |= QD3DBatchItem::BI_MASK;
- m_item->m_info &= ~QD3DBatchItem::BI_AA;
- m_color = 0;
- QRectF brect = pathToVertexArrays(path);
- queueRect(brect, m_item, 0);
- }
-
- *item = m_item;
-}
-
-
-
-void QD3DDrawHelper::queueAntialiasedMask(const QPolygonF &poly, QD3DBatchItem **item, const QRectF &brect)
-{
- lockVertexBuffer();
-
- m_item = *item;
- m_item->m_info |= QD3DBatchItem::BI_MASK;
- setWinding(m_item->m_info & QD3DBatchItem::BI_WINDING);
-
- int xoffset = m_item->m_maskpos.x;
- int yoffset = m_item->m_maskpos.y;
-
- int x = brect.left();
- int y = brect.top();
-
- m_item->m_xoffset = (xoffset - x) + 1;
- m_item->m_yoffset = (yoffset - y) + 1;
-
- m_boundingRect = brect;
- tessellate(poly);
-
- *item = m_item;
-}
-
-QRectF QD3DDrawHelper::queueAliasedMask(const QPainterPath &path, QD3DBatchItem **item, D3DCOLOR color)
-{
- lockVertexBuffer();
-
- m_color = color;
- m_item = *item;
- m_item->m_info |= QD3DBatchItem::BI_MASK;
-
- bool winding = (path.fillRule() == Qt::WindingFill);
- if (winding)
- m_item->m_info |= QD3DBatchItem::BI_WINDING;
-
- QRectF result = pathToVertexArrays(path);
- *item = m_item;
- return result;
-}
-
-// used for drawing aliased transformed rects directly
-// don't use for antialiased or masked drawing
-void QD3DDrawHelper::queueRect(const QRectF &rect, QD3DBatchItem *item, D3DCOLOR color, const QPolygonF &trect)
-{
- lockVertexBuffer();
-
- qreal zval = (item->m_info & QD3DBatchItem::BI_CLIP) ? 0.0f : 0.5f;
- item->m_info |= QD3DBatchItem::BI_BRECT;
-
- // if the item does not have a mask, the offset is different
- if (!(item->m_info & QD3DBatchItem::BI_MASK)) {
- item->m_offset = m_index;
- item->m_count = (item->m_info & QD3DBatchItem::BI_AA) ? 0 : -2;
- }
-
- qreal x1 = rect.left();
- qreal y1 = rect.top();
- qreal x2 = rect.right();
- qreal y2 = rect.bottom();
-
- QPointF tc = trect.at(0);
- vertex v1 = { {x1, y1, zval} , color,
- tc.x(), tc.y(), 0.f, 0.f,
- 0.f , 0.f , 0.f, 0.f };
-
- tc = trect.at(1);
- vertex v2 = { {x2, y1, zval} , color,
- tc.x(), tc.y(), 0.f, 0.f,
- 0.f , 0.f , 0.f, 0.f};
-
- tc = trect.at(2);
- vertex v3 = { {x2, y2, zval} , color,
- tc.x(), tc.y(), 0.f, 0.f,
- 0.f , 0.f , 0.f, 0.f};;
-
- tc = trect.at(3);
- vertex v4 = { {x1, y2, zval} , color,
- tc.x(), tc.y(), 0.f, 0.f,
- 0.f , 0.f , 0.f, 0.f};
-
-#ifdef QT_DEBUG_VERTEXBUFFER_ACCESS
- for (int i=m_index; i<(m_index + 4); ++i) {
- if ((m_index + 4) > QT_VERTEX_BUF_SIZE)
- qDebug() << "Vertex Buffer: Buffer overflow";
- if (accesscontrol[i] != CLEAR)
- qDebug() << "Vertex Buffer: Access Error";
- accesscontrol[i] |= WRITE;
- }
-#endif
-
- m_vbuff[m_index++] = v1;
- m_vbuff[m_index++] = v2;
- m_vbuff[m_index++] = v3;
- m_vbuff[m_index++] = v4;
-
- m_startindex = m_index;
-}
-
-
-QD3DMaskPosition QD3DDrawHelper::allocateMaskPosition(const QRectF &brect, bool *breakbatch)
-{
- int w = brect.width();
- int h = brect.height();
-
- w += 3;
- h += 3;
-
- if (w > m_width)
- w = m_width;
- if (h > m_height)
- h = m_height;
-
- *breakbatch = false;
-
- if ((m_height - m_mask_offsetY2) >= h && (m_width - m_mask_position.x) >= w) {
- m_mask_position.y = m_mask_offsetY2;
- } else if ((m_width - m_mask_offsetX2) >= w) {
- m_mask_position.y = QD3D_MASK_MARGIN;
- m_mask_position.x = m_mask_offsetX2;
- } else if (m_mask_position.channel < 3) {
- ++m_mask_position.channel;
- m_mask_position.x = m_mask_position.y = QD3D_MASK_MARGIN;
- m_mask_offsetX2 = m_mask_offsetY2 = QD3D_MASK_MARGIN;
- } else {
- resetMask();
- *breakbatch = true;
- }
-
- int newoffset = m_mask_position.x + w;
- if (m_mask_offsetX2 < newoffset)
- m_mask_offsetX2 = newoffset;
- m_mask_offsetY2 = (m_mask_position.y + h);
-
- return m_mask_position;
-
-}
-
-void QD3DDrawHelper::queueRect(const QRectF &rect, QD3DBatchItem *item, D3DCOLOR color)
-{
- lockVertexBuffer();
-
- QRectF brect;
- item->m_info |= QD3DBatchItem::BI_BRECT;
- qreal zval = (item->m_info & QD3DBatchItem::BI_CLIP) ? 0.0f : 0.5f;
-
- if (item->m_info & QD3DBatchItem::BI_AA) {
- int xoffset = item->m_maskpos.x;
- int yoffset = item->m_maskpos.y;
-
- int x = rect.left();
- int y = rect.top();
-
- brect = QRectF(x, y, rect.width() + 1, rect.height() + 1);
-
- item->m_xoffset = (xoffset - x) + 1;
- item->m_yoffset = (yoffset - y) + 1;
-
- // if the item does not have a mask, the offset is different
- if (!(item->m_info & QD3DBatchItem::BI_MASK)) {
- item->m_offset = m_index;
- item->m_count = 0;
- }
- } else {
- brect = rect;
-
- if (!(item->m_info & QD3DBatchItem::BI_MASK)) {
- item->m_offset = m_index;
- item->m_count = -2;
- }
- }
-
- qreal left = brect.left();
- qreal right = brect.right();
- qreal top = brect.top();
- qreal bottom = brect.bottom();
-
- vertex v1 = { {left, bottom, zval}, color,
- 0.f, 0.f, 0.f, 0.f,
- 0.f, 0.f, 0.f, 0.f};
- vertex v2 = { {left, top, zval}, color,
- 0.f, 0.f, 0.f, 0.f,
- 0.f, 0.f, 0.f, 0.f};
- vertex v3 = { {right, top, zval}, color,
- 0.f, 0.f, 0.f, 0.f,
- 0.f, 0.f, 0.f, 0.f};
- vertex v4 = { {right, bottom, zval}, color,
- 0.f, 0.f, 0.f, 0.f,
- 0.f, 0.f, 0.f, 0.f};
-
-#ifdef QT_DEBUG_VERTEXBUFFER_ACCESS
- for (int i=m_index; i<(m_index + 4); ++i) {
- if ((m_index + 4) > QT_VERTEX_BUF_SIZE)
- qDebug() << "Vertex Buffer: Buffer overflow";
- if (accesscontrol[i] != CLEAR)
- qDebug() << "Vertex Buffer: Access Error";
- accesscontrol[i] |= WRITE;
- }
-#endif
-
- m_vbuff[m_index++] = v1;
- m_vbuff[m_index++] = v2;
- m_vbuff[m_index++] = v3;
- m_vbuff[m_index++] = v4;
-
- m_startindex = m_index;
-}
-
-void QD3DDrawHelper::queueAntialiasedLines(const QPainterPath &path, QD3DBatchItem **item, const QRectF &brect)
-{
- lockVertexBuffer();
-
- m_item = *item;
- m_item->m_info |= QD3DBatchItem::BI_MASK;
- setWinding(m_item->m_info & QD3DBatchItem::BI_WINDING);
-
- int xoffset = m_item->m_maskpos.x;
- int yoffset = m_item->m_maskpos.y;
- int x = brect.left();
- int y = brect.top();
-
- m_item->m_xoffset = (xoffset - x) + 1;
- m_item->m_yoffset = (yoffset - y) + 1;
-
- m_boundingRect = brect;
-
- m_xoffset = (x - xoffset) + 0.5f;
- m_yoffset = (y - yoffset) + 0.5f;
-
- QPointF last;
- for (int i = 0; i < path.elementCount(); ++i) {
- QPainterPath::Element element = path.elementAt(i);
-
- //Q_ASSERT(!element.isCurveTo());
-
- if (element.isLineTo())
- QTessellator::tessellateRect(last, element, m_item->m_width);
-
- last = element;
- }
-
- m_item->m_offset = m_startindex;
- m_item->m_count = ( m_index - m_startindex ) / 3;
- m_startindex = m_index;
-
- *item = m_item;
-}
-
-void QD3DDrawHelper::queueAliasedLines(const QLineF *lines, int lineCount, QD3DBatchItem **item)
-{
- lockVertexBuffer();
-
- m_item = *item;
- m_item->m_info |= QD3DBatchItem::BI_FASTLINE;
-
- for (int i=0; i<lineCount; ++i) {
- const QLineF line = lines[i];
- qreal p1x = line.p1().x();
- qreal p1y = line.p1().y();
- qreal p2x = line.p2().x();
- qreal p2y = line.p2().y();
-
- vertex v1 = { {p1x, p1y, m_pe->m_pen_width} , m_pe->m_pen_color,
- -1.f, -1.f, p2x, p2y,
- 0.f, 0.f, 0.f, 0.f };
- vertex v2 = { {p1x, p1y, m_pe->m_pen_width} , m_pe->m_pen_color,
- 1.f, -1.f, p2x, p2y,
- 0.f, 0.f, 0.f, 0.f };
- vertex v3 = { {p1x, p1y, m_pe->m_pen_width} , m_pe->m_pen_color,
- 1.f, 1.f, p2x, p2y,
- 0.f, 0.f, 0.f, 0.f };
- vertex v4 = { {p1x, p1y, m_pe->m_pen_width} , m_pe->m_pen_color,
- -1.f, 1.f, p2x, p2y,
- 0.f, 0.f, 0.f, 0.f };
-
- m_vbuff[m_index++] = v1;
- m_vbuff[m_index++] = v2;
- m_vbuff[m_index++] = v4;
- m_vbuff[m_index++] = v4;
- m_vbuff[m_index++] = v2;
- m_vbuff[m_index++] = v3;
-
- if (m_index >= (QT_VERTEX_BUF_SIZE - 16)) {
- m_item->m_offset = m_startindex;
- m_item->m_count = ( m_index - m_startindex ) / 2;
- m_startindex = m_index;
-
- QD3DBatchItem itemcopy = *m_item;
- m_item = m_pe->nextBatchItem();
- *m_item = itemcopy;
-
- lockVertexBuffer();
- }
- }
-
- m_item->m_offset = m_startindex;
- m_item->m_count = ( m_index - m_startindex ) - 2;
- m_startindex = m_index;
-
- *item = m_item;
-}
-
-void QD3DDrawHelper::queueTextGlyph(const QRectF &rect, const qreal *tex_coords,
- QD3DBatchItem *item, D3DCOLOR color)
-{
- lockVertexBuffer();
-
- qreal x1 = rect.left();
- qreal y1 = rect.top();
- qreal x2 = rect.right();
- qreal y2 = rect.bottom();
-
- vertex v1 = { {x1, y1, 0.5f}, color,
- tex_coords[0], tex_coords[1], 0.f, 0.f,
- 0.f , 0.f , 0.f, 0.f};
- vertex v2 = { {x2, y1, 0.5f}, color,
- tex_coords[2], tex_coords[1], 0.f, 0.f,
- 0.f , 0.f , 0.f, 0.f};
- vertex v3 = { {x2, y2, 0.5f}, color,
- tex_coords[2], tex_coords[3], 0.f, 0.f,
- 0.f , 0.f , 0.f, 0.f};
- vertex v4 = { {x1, y1, 0.5f}, color,
- tex_coords[0], tex_coords[1], 0.f, 0.f,
- 0.f , 0.f , 0.f, 0.f};
- vertex v5 = { {x2, y2, 0.5f}, color,
- tex_coords[2], tex_coords[3], 0.f, 0.f,
- 0.f , 0.f , 0.f, 0.f};
- vertex v6 = { {x1, y2, 0.5f}, color,
- tex_coords[0], tex_coords[3], 0.f, 0.f,
- 0.f , 0.f , 0.f, 0.f};
-
-#ifdef QT_DEBUG_VERTEXBUFFER_ACCESS
- for (int i=m_index; i<(m_index + 6); ++i) {
- if ((m_index + 6) > QT_VERTEX_BUF_SIZE)
- qDebug() << "Vertex Buffer: Buffer overflow";
- if (accesscontrol[i] != CLEAR)
- qDebug() << "Vertex Buffer: Access Error";
- accesscontrol[i] |= WRITE;
- }
-#endif
-
- m_vbuff[m_index++] = v1;
- m_vbuff[m_index++] = v2;
- m_vbuff[m_index++] = v3;
- m_vbuff[m_index++] = v4;
- m_vbuff[m_index++] = v5;
- m_vbuff[m_index++] = v6;
-
- m_startindex = m_index;
- ++item->m_count;
-}
-
-bool QD3DDrawHelper::needsFlushing() const
-{
- return (m_pe->m_batch.m_item_index >= QD3D_BATCH_SIZE || m_startindex >= QT_VERTEX_RESET_LIMIT);
-}
-
-void QD3DDrawHelper::setMaskSize(QSize size)
-{
- m_width = size.width();
- m_height = size.height();
-
- if (m_maskSurface)
- m_maskSurface->Release();
-
- if (m_mask)
- m_mask->Release();
-
- if (FAILED(m_pe->m_d3d_device->CreateTexture(m_width, m_height, 1, D3DUSAGE_RENDERTARGET,
- D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &m_mask, NULL))) {
- qWarning() << "QDirect3DPaintEngine: CreateTexture() failed.";
- }
-
- if (m_depthStencilSurface)
- m_depthStencilSurface->Release();
-
- if (FAILED(m_pe->m_d3d_device->CreateDepthStencilSurface(m_width, m_height, D3DFMT_D24S8, D3DMULTISAMPLE_NONE, 0,
- TRUE, &m_depthStencilSurface, NULL))) {
- qWarning() << "QDirect3DPaintEngine: CreateDepthStencilSurface() failed.";
- }
-
- m_pe->m_d3d_device->SetDepthStencilSurface(m_depthStencilSurface);
- m_pe->m_d3d_device->Clear(0, 0, D3DCLEAR_ZBUFFER|D3DCLEAR_STENCIL, 0, 0.0f, 0);
-
- if (FAILED(m_mask->GetSurfaceLevel(0, &m_maskSurface))) {
- qWarning() << "QDirect3DPaintEngine: GetSurfaceLevel() failed.";
- }
-
- m_pe->m_d3d_device->ColorFill(m_maskSurface, 0, D3DCOLOR_ARGB(0,0,0,0));
- D3DXMATRIX projMatrix;
- pD3DXMatrixOrthoOffCenterLH(&projMatrix, 0, m_width, m_height, 0, 0, 1);
- m_pe->m_effect->SetMatrix("g_mMaskProjection", &projMatrix);
- m_pe->m_effect->SetTexture("g_mAAMask", m_mask);
-}
-
-void QD3DDrawHelper::beforeReset()
-{
- resetMask();
- m_clearmask = true;
-
- if (m_maskSurface) {
- m_maskSurface->Release();
- m_maskSurface = 0;
- }
-
- if (m_mask) {
- m_mask->Release();
- m_mask = 0;
- }
-
- if (m_depthStencilSurface) {
- m_depthStencilSurface->Release();
- m_depthStencilSurface = 0;
- }
-
- if (m_d3dvbuff)
- m_d3dvbuff->Release();
-}
-
-void QD3DDrawHelper::afterReset()
-{
- if (FAILED(m_pe->m_d3d_device->CreateVertexBuffer(QT_VERTEX_BUF_SIZE*sizeof(vertex), D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY,
- QD3DFVF_CSVERTEX,
- D3DPOOL_DEFAULT, &m_d3dvbuff, NULL))) {
- qWarning() << "QDirect3DPaintEngine: failed to create vertex buffer.";
- }
-
- m_pe->m_d3d_device->SetStreamSource(0, m_d3dvbuff, 0, sizeof(vertex));
- m_pe->m_d3d_device->SetFVF(QD3DFVF_CSVERTEX);
-
- m_startindex = 0;
- m_index = 0;
-}
-
-IDirect3DSurface9 *QD3DDrawHelper::freeMaskSurface()
-{
- // we need to make sure the mask is cleared when it's used for something else
- resetMask();
- m_clearmask = true;
-
- return m_maskSurface;
-}
-
-int QD3DDrawHelper::drawAntialiasedMask(int offset, int maxoffset)
-{
- int newoffset = offset;
- QD3DBatchItem *item = &(m_pe->m_batch.items[offset]);
-
- // set mask as render target
- if (FAILED(m_pe->m_d3d_device->SetRenderTarget(0, m_maskSurface)))
- qWarning() << "QDirect3DPaintEngine: SetRenderTarget failed!";
-
- if (m_clearmask) {
- m_pe->m_d3d_device->Clear(0, 0, D3DCLEAR_TARGET,D3DCOLOR_ARGB(0,0,0,0), 0, 0);
- m_clearmask = false;
- }
-
- // fill the mask
- m_pe->m_statemanager->beginPass(PASS_AA_CREATEMASK);
- for (; newoffset<maxoffset; ++newoffset) {
- item = &(m_pe->m_batch.items[newoffset]);
- if (!(item->m_info & QD3DBatchItem::BI_AA) || !(item->m_info & QD3DBatchItem::BI_MASK)) {
- break;
- } else if (item->m_info & QD3DBatchItem::BI_MASKFULL) {
- item->m_info &= ~QD3DBatchItem::BI_MASKFULL;
- m_clearmask = true;
- break;
- }
-
- m_pe->m_statemanager->startStateBlock();
- if (item->m_info & QD3DBatchItem::BI_MASKSCISSOR) {
- RECT rect;
- QRectF srect = item->m_brect.adjusted(item->m_xoffset, item->m_yoffset,
- item->m_xoffset, item->m_yoffset);
- rect.left = qMax(qRound(srect.left()), 0);
- rect.top = qMax(qRound(srect.top()), 0);
- rect.bottom = qMin(m_height, qRound(srect.bottom()));
- rect.right = qMin(m_width, qRound(srect.right()));
- m_pe->m_d3d_device->SetScissorRect(&rect);
- m_pe->m_statemanager->SetRenderState(D3DRS_SCISSORTESTENABLE, TRUE);
- }
- m_pe->m_statemanager->setMaskChannel(item->m_maskpos.channel);
- m_pe->m_statemanager->endStateBlock();
-
-#ifdef QT_DEBUG_VERTEXBUFFER_ACCESS
- int vbstart = item->m_offset;
- for (int i=vbstart; i<(vbstart + (item->m_count * 3)); ++i) {
- if (accesscontrol[i] != WRITE)
- qDebug() << "Vertex Buffer: Access Error";
- accesscontrol[i] |= READ;
- }
-#endif
-
- m_pe->m_d3d_device->DrawPrimitive(D3DPT_TRIANGLELIST, item->m_offset, item->m_count);
-
- if (item->m_info & QD3DBatchItem::BI_MASKSCISSOR) {
- m_pe->m_statemanager->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
- }
- }
- m_pe->m_statemanager->endPass();
-
- return newoffset;
-}
-
-void QD3DDrawHelper::drawAliasedMask(int offset)
-{
- QD3DBatchItem *item = &(m_pe->m_batch.items[offset]);
- if (item->m_info & QD3DBatchItem::BI_MASK) {
- m_pe->m_statemanager->beginPass( (item->m_info & QD3DBatchItem::BI_WINDING) ? PASS_STENCIL_WINDING : PASS_STENCIL_ODDEVEN );
- int prev_stop = 0;
- for (int i=0; i<item->m_pointstops.count(); ++i) {
- int stop = item->m_pointstops.at(i);
-
-#ifdef QT_DEBUG_VERTEXBUFFER_ACCESS
- int vbstart = (item->m_offset + prev_stop);
- for (int j=vbstart; j<(vbstart+(stop - prev_stop)); ++j) {
- if (accesscontrol[j] != WRITE)
- qDebug() << "Vertex Buffer: Access Error";
- accesscontrol[j] |= READ;
- }
-#endif
- m_pe->m_d3d_device->DrawPrimitive(D3DPT_TRIANGLEFAN, item->m_offset + prev_stop, (stop - prev_stop) - 2);
- prev_stop = stop;
- }
- m_pe->m_statemanager->endPass();
- }
-}
-
-void QD3DDrawHelper::drawTextItem(QD3DBatchItem *item)
-{
-#ifdef QT_DEBUG_VERTEXBUFFER_ACCESS
- int vbstart = item->m_offset;
- for (int j=vbstart; j<(vbstart + ((item->m_count * 2) * 3)); ++j) {
- if (accesscontrol[j] != WRITE)
- qDebug() << "Vertex Buffer: Access Error";
- accesscontrol[j] |= READ;
- }
-#endif
- m_pe->m_d3d_device->DrawPrimitive(D3DPT_TRIANGLELIST, item->m_offset, item->m_count*2);
-}
-
-void QD3DDrawHelper::drawAliasedLines(QD3DBatchItem *item)
-{
- m_pe->m_statemanager->setCosmeticPen(item->m_info & QD3DBatchItem::BI_COSMETICPEN);
- if (item->m_info & QD3DBatchItem::BI_TRANSFORM) {
- m_pe->m_statemanager->setTransformation(&item->m_matrix);
- } else {
- m_pe->m_statemanager->setTransformation();
- }
- int pass = (item->m_info & QD3DBatchItem::BI_MASK)
- ? PASS_ALIASED_LINES
- : PASS_ALIASED_LINES_DIRECT;
- m_pe->m_statemanager->beginPass(pass);
- m_pe->m_d3d_device->DrawPrimitive(D3DPT_TRIANGLELIST, item->m_offset, (item->m_count + 2) / 3);
- m_pe->m_statemanager->endPass();
-}
-
-void QD3DDrawHelper::drawAntialiasedBoundingRect(QD3DBatchItem *item)
-{
- if (item->m_info & QD3DBatchItem::BI_SCISSOR) {
- RECT rect;
- rect.left = qMax(qRound(item->m_brect.left()), 0);
- rect.top = qMax(qRound(item->m_brect.top()), 0);
- rect.bottom = qMin(m_height, qRound(item->m_brect.bottom()));
- rect.right = qMin(m_width, qRound(item->m_brect.right()));
- m_pe->m_d3d_device->SetScissorRect(&rect);
- m_pe->m_statemanager->SetRenderState(D3DRS_SCISSORTESTENABLE, TRUE);
- }
-
-#ifdef QT_DEBUG_VERTEXBUFFER_ACCESS
- int vbstart = item->m_offset + (item->m_count * 3);
- for (int j=vbstart; j<(vbstart + 4); ++j) {
- if (accesscontrol[j] != WRITE)
- qDebug() << "Vertex Buffer: Access Error";
- accesscontrol[j] |= READ;
- }
-#endif
-
- m_pe->m_d3d_device->DrawPrimitive(D3DPT_TRIANGLEFAN, item->m_offset + (item->m_count * 3), 2);
-
- if (item->m_info & QD3DBatchItem::BI_SCISSOR) {
- m_pe->m_statemanager->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
- }
-}
-
-void QD3DDrawHelper::drawAliasedBoundingRect(QD3DBatchItem *item)
-{
-#ifdef QT_DEBUG_VERTEXBUFFER_ACCESS
- int vbstart = (item->m_offset + item->m_count + 2);
- for (int j=vbstart; j<(vbstart + 4); ++j) {
- if (accesscontrol[j] != WRITE)
- qDebug() << "Vertex Buffer: Access Error";
- accesscontrol[j] |= READ;
- }
-#endif
-
- m_pe->m_d3d_device->DrawPrimitive(D3DPT_TRIANGLEFAN, item->m_offset + item->m_count + 2, 2);
-}
-
-void QD3DDrawHelper::addTrap(const Trapezoid &trap)
-{
- qreal topLeftY = Q27Dot5ToDouble(trap.topLeft->y) - m_yoffset;
- qreal topLeftX = Q27Dot5ToDouble(trap.topLeft->x) - m_xoffset;
- qreal topRightY = Q27Dot5ToDouble(trap.topRight->y) - m_yoffset;
- qreal topRightX = Q27Dot5ToDouble(trap.topRight->x) - m_xoffset;
- qreal top = Q27Dot5ToDouble(trap.top) - m_yoffset;
- qreal bottom = Q27Dot5ToDouble(trap.bottom) - m_yoffset;
-
- Q27Dot5 _h = trap.topLeft->y - trap.bottomLeft->y;
- Q27Dot5 _w = trap.topLeft->x - trap.bottomLeft->x;
- qreal _leftA = (qreal)_w/_h;
- qreal _leftB = topLeftX - _leftA * topLeftY;
-
- _h = trap.topRight->y - trap.bottomRight->y;
- _w = trap.topRight->x - trap.bottomRight->x;
- qreal _rightA = (qreal)_w/_h;
- qreal _rightB = topRightX - _rightA * topRightY;
-
- qreal invLeftA = qFuzzyIsNull(_leftA) ? 0.0 : 1.0 / _leftA;
- qreal invRightA = qFuzzyIsNull(_rightA) ? 0.0 : 1.0 / _rightA;
-
- vertex v1 = { {1.f, top - 1.f, 0.5f}, 0.f,
- top, bottom, invLeftA, -invRightA,
- _leftA, _leftB, _rightA, _rightB};
- vertex v2 = { {0.f, top - 1.f, 0.5f}, 0.f,
- top, bottom, invLeftA, -invRightA,
- _leftA, _leftB, _rightA, _rightB};
- vertex v3 = { {0.f, bottom + 1.f, 0.5f}, 0.f,
- top, bottom, invLeftA, -invRightA,
- _leftA, _leftB, _rightA, _rightB};
-
- vertex v4 = { {1.f, top - 1.f, 0.5f}, 0.f,
- top, bottom, invLeftA, -invRightA,
- _leftA, _leftB, _rightA, _rightB};
- vertex v5 = { {0.f, bottom + 1.f, 0.5f}, 0.f,
- top, bottom, invLeftA, -invRightA,
- _leftA, _leftB, _rightA, _rightB};
- vertex v6 = { {1.f, bottom + 1.f, 0.5f}, 0.f,
- top, bottom, invLeftA, -invRightA,
- _leftA, _leftB, _rightA, _rightB};
-
-#ifdef QT_DEBUG_VERTEXBUFFER_ACCESS
- for (int i=m_index; i<(m_index + 6); ++i) {
- if ((m_index + 6) > QT_VERTEX_BUF_SIZE)
- qDebug() << "Vertex Buffer: Buffer overflow";
- if (accesscontrol[i] != CLEAR)
- qDebug() << "Vertex Buffer: Access Error";
- accesscontrol[i] |= WRITE;
- }
-#endif
-
- m_vbuff[m_index++] = v1;
- m_vbuff[m_index++] = v2;
- m_vbuff[m_index++] = v3;
- m_vbuff[m_index++] = v4;
- m_vbuff[m_index++] = v5;
- m_vbuff[m_index++] = v6;
-
- // check if buffer is full
- if (m_index >= (QT_VERTEX_BUF_SIZE - 16)) {
- m_item->m_offset = m_startindex;
- m_item->m_count = ( m_index - m_startindex ) / 3;
- m_startindex = m_index;
-
- QD3DBatchItem itemcopy = *m_item;
- m_item = m_pe->nextBatchItem();
- *m_item = itemcopy;
- m_item->m_info &= ~QD3DBatchItem::BI_MASKFULL;
-
- lockVertexBuffer();
- }
-}
-
-void QD3DDrawHelper::tessellate(const QPolygonF &poly) {
- int xoffset = m_item->m_maskpos.x;
- int yoffset = m_item->m_maskpos.y;
-
- int x = m_boundingRect.left();
- int y = m_boundingRect.top();
- m_xoffset = (x - xoffset) + 0.5f;
- m_yoffset = (y - yoffset) + 0.5f;
-
- QTessellator::tessellate(poly.data(), poly.count());
-
- m_item->m_offset = m_startindex;
- m_item->m_count = ( m_index - m_startindex ) / 3;
- m_startindex = m_index;
-}
-
-inline void QD3DDrawHelper::lineToStencil(qreal x, qreal y)
-{
- QPointF lastPt = tess_lastpoint;
- tess_lastpoint = QPointF(x, y);
-
- if (m_isLine && m_firstPoint)
- return;
-
-
-#ifdef QT_DEBUG_VERTEXBUFFER_ACCESS
- if (m_index > QT_VERTEX_BUF_SIZE)
- qDebug() << "Vertex Buffer: Buffer overflow";
- if (accesscontrol[m_index] != CLEAR)
- qDebug() << "Vertex Buffer: Access Error";
- accesscontrol[m_index] |= WRITE;
-#endif
-
- vertex v;
- if (m_isLine) {
- vertex v1 = { {lastPt.x(), lastPt.y(), m_pe->m_pen_width }, m_color,
- -1.f, -1.f, x, y,
- 0.f, 0.f, 0.f, 0.f};
- vertex v2 = { {lastPt.x(), lastPt.y(), m_pe->m_pen_width }, m_color,
- 1.f, -1.f, x, y,
- 0.f, 0.f, 0.f, 0.f};
- vertex v3 = { {lastPt.x(), lastPt.y(), m_pe->m_pen_width }, m_color,
- 1.f, 1.f, x, y,
- 0.f, 0.f, 0.f, 0.f};
- vertex v4 = { {lastPt.x(), lastPt.y(), m_pe->m_pen_width }, m_color,
- -1.f, 1.f, x, y,
- 0.f, 0.f, 0.f, 0.f};
- m_vbuff[m_index++] = v1;
- m_vbuff[m_index++] = v2;
- m_vbuff[m_index++] = v4;
- m_vbuff[m_index++] = v4;
- m_vbuff[m_index++] = v2;
- m_vbuff[m_index++] = v3;
- } else {
- vertex v1 = { {x, y, 0.5f}, m_color,
- 0.f, 0.f, 0.f, 0.f,
- 0.f, 0.f, 0.f, 0.f};
- m_vbuff[m_index++] = v1;
- v = v1;
- }
- ++tess_index;
-
- // check if buffer is full
- if (m_index >= (QT_VERTEX_BUF_SIZE - 16)) {
- int firstindex = m_startindex;
- if (!m_item->m_pointstops.isEmpty())
- firstindex = m_item->m_pointstops.last();
-
- vertex first = m_vbuff[firstindex];
-
- // finish current polygon
- m_item->m_pointstops.append(tess_index);
- m_item->m_offset = m_startindex;
- m_startindex = m_index;
-
- // copy item
- QD3DBatchItem itemcopy = *m_item;
- m_item = m_pe->nextBatchItem();
- *m_item = itemcopy;
-
- // start new polygon
- lockVertexBuffer();
- m_item->m_pointstops.clear();
- if (!m_isLine) {
- tess_index = 2;
-
-#ifdef QT_DEBUG_VERTEXBUFFER_ACCESS
- if (accesscontrol[m_index] != CLEAR)
- qDebug() << "Vertex Buffer: Access Error";
- accesscontrol[m_index] |= WRITE;
-#endif
-
- m_vbuff[m_index++] = first;
-
-#ifdef QT_DEBUG_VERTEXBUFFER_ACCESS
- if (accesscontrol[m_index] != CLEAR)
- qDebug() << "Vertex Buffer: Access Error";
- accesscontrol[m_index] |= WRITE;
-#endif
-
- m_vbuff[m_index++] = v;
- } else {
- tess_index = 0;
- }
- }
-
- if (x > max_x)
- max_x = x;
- else if (x < min_x)
- min_x = x;
- if (y > max_y)
- max_y = y;
- else if (y < min_y)
- min_y = y;
-}
-
-inline void QD3DDrawHelper::curveToStencil(const QPointF &cp1, const QPointF &cp2,
- const QPointF &ep)
-{
- qreal inverseScale = 0.5f;
- qreal inverseScaleHalf = inverseScale / 2;
-
- QBezier beziers[32];
- beziers[0] = QBezier::fromPoints(tess_lastpoint, cp1, cp2, ep);
- QBezier *b = beziers;
- while (b >= beziers) {
- // check if we can pop the top bezier curve from the stack
- qreal l = qAbs(b->x4 - b->x1) + qAbs(b->y4 - b->y1);
- qreal d;
- if (l > inverseScale) {
- d = qAbs( (b->x4 - b->x1)*(b->y1 - b->y2) - (b->y4 - b->y1)*(b->x1 - b->x2) )
- + qAbs( (b->x4 - b->x1)*(b->y1 - b->y3) - (b->y4 - b->y1)*(b->x1 - b->x3) );
- d /= l;
- } else {
- d = qAbs(b->x1 - b->x2) + qAbs(b->y1 - b->y2) +
- qAbs(b->x1 - b->x3) + qAbs(b->y1 - b->y3);
- }
- if (d < inverseScaleHalf || b == beziers + 31) {
- // good enough, we pop it off and add the endpoint
- lineToStencil(b->x4, b->y4);
- --b;
- } else {
- // split, second half of the polygon goes lower into the stack
- b->split(b+1, b);
- ++b;
- }
- }
-}
-
-QRectF QD3DDrawHelper::pathToVertexArrays(const QPainterPath &path)
-{
- m_isLine = (m_item->m_info & QD3DBatchItem::BI_FASTLINE);
- const QPainterPath::Element &first = path.elementAt(0);
- firstx = first.x;
- firsty = first.y;
- min_x = max_x = firstx;
- min_y = max_y = firsty;
-
- m_firstPoint = true;
- tess_index = 0;
- m_item->m_pointstops.clear();
- lineToStencil(firstx, firsty);
- m_firstPoint = false;
-
- for (int i=1; i<path.elementCount(); ++i) {
- const QPainterPath::Element &e = path.elementAt(i);
- switch (e.type) {
- case QPainterPath::MoveToElement:
- m_item->m_pointstops.append(tess_index);
- m_firstPoint = true;
- lineToStencil(e.x, e.y);
- m_firstPoint = false;
- break;
- case QPainterPath::LineToElement:
- lineToStencil(e.x, e.y);
- break;
- case QPainterPath::CurveToElement:
- curveToStencil(e, path.elementAt(i+1), path.elementAt(i+2));
- i+=2;
- break;
- default:
- break;
- }
- }
-
- if (!m_isLine)
- lineToStencil(firstx, firsty);
-
- m_item->m_pointstops.append(tess_index);
-
- m_item->m_offset = m_startindex;
- m_item->m_count = ( m_index - m_startindex ) - 2;
- m_startindex = m_index;
-
- QRectF result;
- result.setLeft(min_x);
- result.setRight(max_x);
- result.setTop(min_y);
- result.setBottom(max_y);
-
- if (m_isLine)
- result.adjust(0,0,1,1);
-
- return result;
-}
-
-void QD3DDrawHelper::resetMask()
-{
- m_mask_position.x = m_mask_position.y = QD3D_MASK_MARGIN;
- m_mask_position.channel = 0;
- m_mask_offsetX2 = m_mask_offsetY2 = QD3D_MASK_MARGIN;
-}
-
-
-static inline QPainterPath strokeForPath(const QPainterPath &path, const QPen &cpen) {
- QPainterPathStroker stroker;
- if (cpen.style() == Qt::CustomDashLine)
- stroker.setDashPattern(cpen.dashPattern());
- else
- stroker.setDashPattern(cpen.style());
-
- stroker.setCapStyle(cpen.capStyle());
- stroker.setJoinStyle(cpen.joinStyle());
- stroker.setMiterLimit(cpen.miterLimit());
- stroker.setWidth(cpen.widthF());
-
- QPainterPath stroke = stroker.createStroke(path);
- stroke.setFillRule(Qt::WindingFill);
- return stroke;
-}
-
-
-QDirect3DPaintEnginePrivate::~QDirect3DPaintEnginePrivate()
-{
-
-}
-
-void QDirect3DPaintEnginePrivate::updateClipPath(const QPainterPath &path, Qt::ClipOperation op)
-{
- //#### remove me
- QRegion r(path.toFillPolygon().toPolygon(), path.fillRule());
- updateClipRegion(r, op);
-
-/* if (m_draw_helper->needsFlushing())
- flushBatch();
-
- if (op == Qt::IntersectClip && !has_clipping)
- op = Qt::ReplaceClip;
-
- // switch to paths
- if (!m_has_complex_clipping) {
- m_clip_path = QPainterPath();
- m_clip_path.addRegion(m_clip_region);
- m_clip_region = QRegion();
- m_sysclip_path = QPainterPath();
- m_sysclip_path.addRegion(m_sysclip_region);
- m_sysclip_region = QRegion();
- m_has_complex_clipping = true;
- }
-
- QPainterPath cpath = m_matrix.map(path);
-
- QD3DBatchItem *item = &m_batch.items[m_batch.m_item_index++];
- item->m_info = QD3DBatchItem::BI_COMPLEXCLIP;
-
- switch (op) {
- case Qt::UniteClip:
- has_clipping = true;
- m_clip_path = m_clip_path.united(cpath);
- break;
- case Qt::ReplaceClip:
- has_clipping = true;
- m_clip_path = cpath;
- break;
- case Qt::NoClip:
- m_has_complex_clipping = false;
- has_clipping = false;
- item->m_info |= QD3DBatchItem::BI_CLEARCLIP;
- break;
- default: // intersect clip
- has_clipping = true;
- m_clip_path = m_clip_path.intersected(cpath);
- break;
- }
-
- if (!m_sysclip_path.isEmpty()) {
- item->m_info &= ~QD3DBatchItem::BI_CLEARCLIP;
- if (has_clipping)
- m_clip_path = m_clip_path.intersected(m_sysclip_path);
- else
- m_clip_path = m_sysclip_path;
- }
-
- // update the aliased clipping mask
- m_draw_helper->setClipPath(m_clip_path, item);
-
- // update the antialiased clipping mask
- if (m_draw_helper->needsFlushing())
- flushBatch();
-
- QD3DBatchItem *aaitem = &m_batch.items[m_batch.m_item_index++];
- aaitem->m_info = item->m_info|QD3DBatchItem::BI_AA;
- m_draw_helper->setClipPath(m_clip_path, aaitem); */
-}
-
-extern QPainterPath qt_regionToPath(const QRegion &region);
-
-void QDirect3DPaintEnginePrivate::updateClipRegion(const QRegion &clipregion, Qt::ClipOperation op)
-{
- if (m_draw_helper->needsFlushing())
- flushBatch();
- if (m_has_complex_clipping) {
- QPainterPath path = qt_regionToPath(clipregion);
- updateClipPath(path, op);
- return;
- }
-
- if (op == Qt::IntersectClip && m_clip_region.isEmpty())
- op = Qt::ReplaceClip;
-
- QRegion cregion = m_matrix.map(clipregion);
-
- QD3DBatchItem *item = nextBatchItem();
- item->m_info &= ~QD3DBatchItem::BI_AA;
-
- switch (op) {
- case Qt::UniteClip:
- m_clip_region = m_clip_region.united(cregion);
- break;
- case Qt::ReplaceClip:
- m_clip_region = cregion;
- break;
- case Qt::NoClip:
- m_clip_region = QRegion();
- item->m_info |= QD3DBatchItem::BI_CLEARCLIP;
- break;
- default: // intersect clip
- m_clip_region = m_clip_region.intersected(cregion);
- break;
- }
-
- QRegion crgn = m_clip_region;
- if (!m_sysclip_region.isEmpty()) {
- item->m_info &= ~QD3DBatchItem::BI_CLEARCLIP;
- if (!crgn.isEmpty())
- crgn = crgn.intersected(m_sysclip_region);
- else
- crgn = m_sysclip_region;
- }
-
- QPainterPath path = qt_regionToPath(crgn);
- m_draw_helper->setClipPath(path, &item);
-}
-
-void QDirect3DPaintEnginePrivate::updateFont(const QFont &)
-{
-}
-
-void QDirect3DPaintEnginePrivate::setRenderTechnique(RenderTechnique technique)
-{
- if (m_current_technique != technique) {
- if (m_current_technique != RT_NoTechnique)
- m_effect->End();
-
- if (technique == RT_Aliased) {
- m_effect->SetTechnique("Aliased");
- m_effect->Begin(0,D3DXFX_DONOTSAVESTATE);
- } else if (technique == RT_Antialiased) {
- m_effect->SetTechnique("Antialiased");
- m_effect->Begin(0,D3DXFX_DONOTSAVESTATE);
- }
- }
-
- m_current_technique = technique;
-}
-
-/*QPolygonF QDirect3DPaintEnginePrivate::transformedRect(const QRectF &brect) const
-{
- QPolygonF poly(brect);
- return m_matrix.map(poly);
-}
-
-QPolygonF QDirect3DPaintEnginePrivate::calcTextureCoords(const QPolygonF &trect) const
-{
- QPolygonF result(4);
- QRectF brect = trect.boundingRect();
- qreal angle = atan(trect.at(0).x() -
-}
-
-QPolygonF QDirect3DPaintEnginePrivate::offsetTextureCoords(const QRectF &brect, const QPolygonF &trect) const
-{
-
-}*/
-
-inline QD3DBatchItem *QDirect3DPaintEnginePrivate::nextBatchItem()
-{
- if (m_draw_helper->needsFlushing())
- flushBatch();
-
- QD3DBatchItem *item = &m_batch.items[m_batch.m_item_index++];
- item->m_info = m_current_state;
- item->m_cmode = m_cmode;
- return item;
-}
-
-qreal calculateAngle(qreal dx, qreal dy)
-{
- qreal angle;
-
- if (qFuzzyIsNull(dx)) {
- angle = (dy < 0) ? -M_PI/2 : M_PI/2;
- } else {
- angle = atanf(dy/dx);
- if (dx < 0)
- angle += M_PI;
- }
-
- return angle;
-}
-
-QPolygonF QDirect3DPaintEnginePrivate::brushCoordinates(const QRectF &r, bool stroke, qreal *fd) const
-{
- QBrush brush;
- QTransform matrix;
- Qt::BrushStyle style;
-
- if (stroke) {
- brush = m_pen.brush();
- matrix = m_inv_pen_matrix;
- style = m_pen_brush_style;
- } else {
- brush = m_brush;
- matrix = m_inv_brush_matrix;
- style = m_brush_style;
- }
-
- QPolygonF bpoly;
- switch(style) {
- case Qt::TexturePattern: {
- QTransform totxcoords;
- QRectF adj_brect = r.adjusted(-0.5f, -0.5f, -0.5f, -0.5f);
- totxcoords.scale(1.0f/brush.texture().width(),
- 1.0f/brush.texture().height());
- bpoly = matrix.map(QPolygonF(adj_brect));
- bpoly = totxcoords.map(bpoly);
- break; }
- case Qt::LinearGradientPattern: {
- const QLinearGradient *g = static_cast<const QLinearGradient *>(brush.gradient());
- QPointF start = g->start();
- QPointF stop = g->finalStop();
- qreal dx = stop.x() - start.x();
- qreal dy = stop.y() - start.y();
- qreal length = sqrt(dx * dx + dy * dy);
- qreal angle = calculateAngle(dx, dy);
- QTransform totxcoords;
- QRectF adj_brect = r.adjusted(-0.5f, -0.5f, -0.5f, -0.5f);
- totxcoords.scale(1.0f/length, 1.0f/length);
- totxcoords.rotateRadians(-angle);
- totxcoords.translate(-start.x(), -start.y());
- bpoly = matrix.map(QPolygonF(adj_brect));
- bpoly = totxcoords.map(bpoly);
- break; }
- case Qt::ConicalGradientPattern: {
- const QConicalGradient *g = static_cast<const QConicalGradient *>(brush.gradient());
- QPointF center = g->center();
- qreal angle = g->angle();
- QTransform totxcoords;
- totxcoords.rotate(angle);
- totxcoords.translate(-center.x(), -center.y());
- bpoly = matrix.map(QPolygonF(r));
- bpoly = totxcoords.map(bpoly);
- break; }
- case Qt::RadialGradientPattern: {
- const QRadialGradient *g = static_cast<const QRadialGradient *>(brush.gradient());
- QPointF center = g->center();
- QPointF focalpoint = g->focalPoint();
- qreal dx = focalpoint.x() - center.x();
- qreal dy = focalpoint.y() - center.y();
- qreal radius = g->radius();
- *fd = sqrt(dx * dx + dy * dy) / radius;
- qreal angle = calculateAngle(dx, dy);
- QTransform totxcoords;
- totxcoords.scale(1.0f/radius, 1.0f/radius);
- totxcoords.rotateRadians(-angle);
- totxcoords.translate(-center.x(), -center.y());
- bpoly = matrix.map(QPolygonF(r));
- bpoly = totxcoords.map(bpoly);
- break; }
- default: {
- QTransform totxcoords;
- QRectF adj_brect = r.adjusted(-0.5f, -0.5f, -0.5f, -0.5f);
- QPixmap pat = getPattern(style);
- totxcoords.scale(1.0f/pat.width(),
- 1.0f/pat.height());
- bpoly = matrix.map(QPolygonF(adj_brect));
- bpoly = totxcoords.map(bpoly); }
- };
-
- return bpoly;
-}
-
-void QDirect3DPaintEnginePrivate::strokeAliasedPath(QPainterPath path, const QRectF &brect, const QTransform &txform)
-{
- D3DCOLOR solid_color;
- QD3DBatchItem *item = nextBatchItem();
-
- if (!txform.isIdentity())
- path = txform.map(path);
-
- QRectF trect;
- QPolygonF txcoord;
-
- solid_color = m_pen_color;
- bool has_complex_brush = false;
- if (m_pen_brush_style != Qt::SolidPattern) {
- has_complex_brush = true;
- item->m_brush = m_pen.brush();
- item->m_info |= QD3DBatchItem::BI_COMPLEXBRUSH;
- item->m_opacity = m_opacity;
- }
-
- if (m_has_fast_pen) {
- item->m_info |= QD3DBatchItem::BI_FASTLINE;
- if (m_pen_brush_style == Qt::SolidPattern) {
- m_draw_helper->queueAliasedMask(path, &item, solid_color);
- item->m_info &= ~QD3DBatchItem::BI_MASK; // bypass stencil buffer
- return;
- }
- }
-
- QRectF txrect = m_draw_helper->queueAliasedMask(path, &item, 0);
-
- if (has_complex_brush) {
- trect = brect;
- txcoord = brushCoordinates(brect, true, &item->m_distance);
- item->m_info |= QD3DBatchItem::BI_TRANSFORM;
- item->m_matrix = m_matrix;
- } else {
- trect = txrect;
- static const QPolygonF empty_poly(4);
- txcoord = empty_poly;
- }
-
- m_draw_helper->queueRect(trect, item, solid_color, txcoord);
-}
-
-void QDirect3DPaintEnginePrivate::fillAliasedPath(QPainterPath path, const QRectF &brect, const QTransform &txform)
-{
- D3DCOLOR solid_color;
- QD3DBatchItem *item = nextBatchItem();
-
- if (!txform.isIdentity())
- path = txform.map(path);
-
- QRectF trect;
- QPolygonF txcoord;
-
- solid_color = m_brush_color;
- bool has_complex_brush = false;
- if (m_brush_style != Qt::SolidPattern) {
- has_complex_brush = true;
- item->m_brush = m_brush;
- item->m_info |= QD3DBatchItem::BI_COMPLEXBRUSH;
- item->m_opacity = m_opacity;
- }
-
- QRectF txrect = m_draw_helper->queueAliasedMask(path, &item, 0);
-
- if (has_complex_brush) {
- trect = brect;
- txcoord = brushCoordinates(brect, false, &item->m_distance);
- item->m_info |= QD3DBatchItem::BI_TRANSFORM;
- item->m_matrix = m_matrix;
- } else {
- trect = txrect;
- static const QPolygonF empty_poly(4);
- txcoord = empty_poly;
- }
-
- m_draw_helper->queueRect(trect, item, solid_color, txcoord);
-}
-
-void QDirect3DPaintEnginePrivate::fillAntialiasedPath(const QPainterPath &path, const QRectF &brect,
- const QTransform &txform, bool stroke)
-{
- D3DCOLOR solid_color;
- bool winding = (path.fillRule() == Qt::WindingFill);
- QPolygonF poly;
- QRectF txrect;
- QPainterPath tpath;
-
- if (m_has_aa_fast_pen && stroke) {
- tpath = txform.map(path);
- txrect = tpath.controlPointRect();
- txrect.adjust(-(m_pen_width/2),-(m_pen_width/2), m_pen_width, m_pen_width);
- } else {
- poly = path.toFillPolygon(txform);
- txrect = poly.boundingRect();
- }
-
- // brect = approx. bounding rect before transformation
- // txrect = exact bounding rect after transformation
- // trect = the rectangle to be drawn
- // txcoord = the texture coordinates
- // adj_txrect = adjusted rect to include aliased outline
-
- bool use_scissor = false;
- if (txrect.left() < 0) {
- txrect.adjust(-txrect.left(),0,0,0);
- use_scissor = true;
- }
- if (txrect.top() < 0) {
- txrect.adjust(0,-txrect.top(),0,0);
- use_scissor = true;
- }
-
- if (!txrect.isValid())
- return;
-
- QD3DBatchItem *item = nextBatchItem();
-
- QRectF adj_txrect = txrect.adjusted(-1,-1,1,1);
- QRectF trect;
- QPolygonF txcoord;
-
- bool has_complex_brush = false;
- if (stroke) {
- solid_color = m_pen_color;
- if (m_pen_brush_style != Qt::SolidPattern) {
- has_complex_brush = true;
- item->m_brush = m_pen.brush();
- }
- item->m_width = m_pen_width;
- } else {
- solid_color = m_brush_color;
- if (m_brush_style != Qt::SolidPattern) {
- has_complex_brush = true;
- item->m_brush = m_brush;
- }
- }
-
- qreal focaldist = 0;
- if (has_complex_brush) {
- trect = brect;
- txcoord = brushCoordinates(brect, stroke, &focaldist);
- } else {
- trect = adj_txrect;
- static const QPolygonF empty_poly(4);
- txcoord = empty_poly;
- }
-
- bool maskfull;
- item->m_maskpos = m_draw_helper->allocateMaskPosition(txrect, &maskfull);
- if (maskfull)
- item->m_info |= QD3DBatchItem::BI_MASKFULL;
- item->m_distance = focaldist;
-
- if (winding)
- item->m_info |= QD3DBatchItem::BI_WINDING;
-
- if (has_complex_brush) {
- item->m_info |= QD3DBatchItem::BI_SCISSOR|QD3DBatchItem::BI_COMPLEXBRUSH|
- QD3DBatchItem::BI_TRANSFORM;
- item->m_brect = adj_txrect;
- item->m_matrix = m_matrix;
- item->m_opacity = m_opacity;
- }
- if (use_scissor) {
- item->m_info |= QD3DBatchItem::BI_MASKSCISSOR;
- item->m_brect = adj_txrect;
- }
-
- if (m_has_aa_fast_pen && stroke) {
- m_draw_helper->queueAntialiasedLines(tpath, &item, txrect);
- } else {
- m_draw_helper->queueAntialiasedMask(poly, &item, txrect);
- }
-
- m_draw_helper->queueRect(trect, item, solid_color, txcoord);
-}
-
-QPainterPath QDirect3DPaintEnginePrivate::strokePathFastPen(const QPainterPath &path)
-{
- QPainterPath result;
- QBezier beziers[32];
- for (int i=0; i<path.elementCount(); ++i) {
- const QPainterPath::Element &e = path.elementAt(i);
- switch (e.type) {
- case QPainterPath::MoveToElement:
- result.moveTo(e.x, e.y);
- break;
- case QPainterPath::LineToElement:
- result.lineTo(e.x, e.y);
- break;
-
- case QPainterPath::CurveToElement:
- {
- QPointF sp = path.elementAt(i-1);
- QPointF cp2 = path.elementAt(i+1);
- QPointF ep = path.elementAt(i+2);
- i+=2;
-
- qreal inverseScaleHalf = m_inv_scale / 2;
- beziers[0] = QBezier::fromPoints(sp, e, cp2, ep);
- QBezier *b = beziers;
- while (b >= beziers) {
- // check if we can pop the top bezier curve from the stack
- qreal l = qAbs(b->x4 - b->x1) + qAbs(b->y4 - b->y1);
- qreal d;
- if (l > m_inv_scale) {
- d = qAbs( (b->x4 - b->x1)*(b->y1 - b->y2)
- - (b->y4 - b->y1)*(b->x1 - b->x2) )
- + qAbs( (b->x4 - b->x1)*(b->y1 - b->y3)
- - (b->y4 - b->y1)*(b->x1 - b->x3) );
- d /= l;
- } else {
- d = qAbs(b->x1 - b->x2) + qAbs(b->y1 - b->y2) +
- qAbs(b->x1 - b->x3) + qAbs(b->y1 - b->y3);
- }
- if (d < inverseScaleHalf || b == beziers + 31) {
- // good enough, we pop it off and add the endpoint
- result.lineTo(b->x4, b->y4);
- --b;
- } else {
- // split, second half of the polygon goes lower into the stack
- b->split(b+1, b);
- ++b;
- }
- }
- } // case CurveToElement
- default:
- break;
- } // end of switch
- }
- return result;
-}
-
-void QDirect3DPaintEnginePrivate::strokePath(const QPainterPath &path, QRectF brect, bool simple)
-{
- QTransform txform;
- QPainterPath tpath;
-
- if (m_has_fast_pen || m_has_aa_fast_pen) {
- if (!simple)
- tpath = strokePathFastPen(path);
- else
- tpath = path; //already only lines
- } else {
- tpath = strokeForPath(path, m_pen);
- }
-
- if (tpath.isEmpty())
- return;
-
- //brect is null if the path is not transformed
- if (brect.isNull())
- txform = m_matrix;
-
- if (!brect.isNull()) {
- // brect is set when the path is transformed already,
- // this is the case when we have a cosmetic pen.
- brect.adjust(-(m_pen_width/2),-(m_pen_width/2), m_pen_width, m_pen_width);
- }
-
- if (brect.isNull())
- brect = tpath.controlPointRect();
- brect.adjust(-m_inv_scale,-m_inv_scale,m_inv_scale,m_inv_scale); //adjust for antialiasing
-
- if (m_current_state & QD3DBatchItem::BI_AA) {
- fillAntialiasedPath(tpath, brect, txform, true);
- } else {
- strokeAliasedPath(tpath, brect, txform);
- }
-}
-
-void QDirect3DPaintEnginePrivate::fillPath(const QPainterPath &path, QRectF brect)
-{
- QTransform txform;
-
- //brect is null if the path is not transformed
- if (brect.isNull())
- txform = m_matrix;
-
- if (brect.isNull())
- brect = path.controlPointRect();
- brect.adjust(-m_inv_scale,-m_inv_scale,m_inv_scale,m_inv_scale); //adjust for antialiasing
-
- if (m_current_state & QD3DBatchItem::BI_AA) {
- fillAntialiasedPath(path, brect, txform, false);
- } else {
- fillAliasedPath(path, brect, txform);
- }
-}
-
-
-bool QDirect3DPaintEnginePrivate::init()
-{
-#ifdef QT_DEBUG_D3D_CALLS
- qDebug() << "QDirect3DPaintEnginePrivate::init()";
-#endif
-
- m_draw_helper = 0;
- m_gradient_cache = 0;
- m_dc = 0;
- m_dcsurface = 0;
-
- m_supports_d3d = false;
- m_current_state = 0;
- m_in_scene = false;
- m_has_fast_pen = false;
- m_has_aa_fast_pen = false;
- m_has_pen = false;
- m_has_brush = false;
- m_pen_color = 0;
- m_brush_color = 0;
- m_current_surface = 0;
- m_batch.m_item_index = 0;
- m_current_technique = RT_NoTechnique;
-
- if (!pDirect3DCreate9) {
- QLibrary d3d_lib(QLatin1String("d3d9.dll"));
- pDirect3DCreate9 = (PFNDIRECT3DCREATE9) d3d_lib.resolve("Direct3DCreate9");
- if (!pDirect3DCreate9) {
- qWarning("QDirect3DPaintEngine: failed to resolve symbols from d3d9.dll.\n"
- "Make sure you have the DirectX run-time installed.");
- return false;
- }
- }
-
- if (!pD3DXCreateBuffer || !pD3DXCreateEffect || !pD3DXMatrixOrthoOffCenterLH) {
- QLibrary d3dx_lib(QLatin1String("d3dx9_32.dll"));
- pD3DXCreateBuffer = (PFND3DXCREATEBUFFER) d3dx_lib.resolve("D3DXCreateBuffer");
- pD3DXCreateEffect = (PFND3DXCREATEEFFECT) d3dx_lib.resolve("D3DXCreateEffect");
- pD3DXMatrixOrthoOffCenterLH = (PFND3DXMATRIXORTHOOFFCENTERLH)
- d3dx_lib.resolve("D3DXMatrixOrthoOffCenterLH");
- if (!(pD3DXCreateBuffer && pD3DXCreateEffect && pD3DXMatrixOrthoOffCenterLH)) {
- qWarning("QDirect3DPaintEngine: failed to resolve symbols from d3dx9_32.dll.\n"
- "Make sure you have the DirectX run-time installed.");
- return false;
- }
- }
-
- if (!m_d3d_object) {
- m_d3d_object = pDirect3DCreate9(D3D_SDK_VERSION);
- if (!m_d3d_object) {
- qWarning("QDirect3DPaintEngine: failed to create Direct3D object.\n"
- "Direct3D support in Qt will be disabled.");
- return false;
- }
- }
-
- m_supports_d3d = testCaps();
- if (!m_supports_d3d)
- return false;
-
- m_surface_manager.init(m_d3d_object);
- m_d3d_device = m_surface_manager.device();
-
- if (!m_d3d_device)
- return false;
-
- /* load shaders */
- QFile file(QLatin1String(":/qpaintengine_d3d.fx"));
- QByteArray fxFile;
- if (file.open(QFile::ReadOnly))
- fxFile = file.readAll();
-
- if (fxFile.size() > 0) {
- LPD3DXBUFFER compout;
- pD3DXCreateBuffer(4096, &compout);
- DWORD dwShaderFlags = D3DXFX_NOT_CLONEABLE|D3DXFX_DONOTSAVESTATE|D3DXSHADER_OPTIMIZATION_LEVEL3;
- if(FAILED(pD3DXCreateEffect(m_d3d_device, fxFile.constData(), fxFile.size(),
- NULL, NULL, dwShaderFlags, NULL, &m_effect, &compout))) {
- qWarning("QDirect3DPaintEngine: failed to compile effect file");
- if (compout)
- qWarning((char *)compout->GetBufferPointer());
- m_supports_d3d = false;
- return false;
- }
- if (m_effect) {
- m_statemanager = new QD3DStateManager(m_d3d_device, m_effect);
- m_effect->SetStateManager(m_statemanager);
- m_draw_helper = new QD3DDrawHelper(this);
- initDevice();
- m_gradient_cache = new QD3DGradientCache(m_d3d_device);
- }
- } else {
- return false;
- }
-
- return true;
-}
-
-QPixmap QDirect3DPaintEnginePrivate::getPattern(Qt::BrushStyle style) const
-{
- if (!m_patterns.contains(style)) {
- QImage img(16,16,QImage::Format_ARGB32);
- img.fill(0);
- QPainter p(&img);
- p.setBrush(QBrush(Qt::white, style));
- p.setPen(Qt::NoPen);
- p.drawRect(0,0,16,16);
- p.end();
- QPixmap pattern(QPixmap::fromImage(img));
- QDirect3DPaintEnginePrivate *ct = const_cast<QDirect3DPaintEnginePrivate *>(this);
- ct->verifyTexture(pattern);
- ct->m_patterns.insert(style, pattern);
- }
-
- return m_patterns.value(style);
-}
-
-bool QDirect3DPaintEnginePrivate::testCaps()
-{
- D3DCAPS9 caps;
- if (FAILED(m_d3d_object->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &caps)))
- return false;
-
- if ((caps.PresentationIntervals & D3DPRESENT_INTERVAL_IMMEDIATE)
- && (caps.DevCaps & D3DDEVCAPS_PUREDEVICE)
- && (caps.RasterCaps & D3DPRASTERCAPS_SCISSORTEST)
- && (caps.StencilCaps & D3DSTENCILCAPS_TWOSIDED))
- return true;
-#if 0
- qDebug() << "Direct3D caps:";
- qDebug() << "D3DPRESENT_INTERVAL_IMMEDIATE:" << ((caps.PresentationIntervals & D3DPRESENT_INTERVAL_IMMEDIATE) != 0);
- qDebug() << "D3DDEVCAPS_PUREDEVICE:" << ((caps.DevCaps & D3DDEVCAPS_PUREDEVICE) != 0);
- qDebug() << "D3DPRASTERCAPS_SCISSORTEST:" << ((caps.RasterCaps & D3DPRASTERCAPS_SCISSORTEST) != 0);
- qDebug() << "D3DSTENCILCAPS_TWOSIDED:" << ((caps.StencilCaps & D3DSTENCILCAPS_TWOSIDED) != 0);
-#endif
- return false;
-}
-
-void QDirect3DPaintEnginePrivate::initDevice()
-{
- m_statemanager->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
- m_statemanager->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
- m_statemanager->SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
- m_statemanager->SetRenderState(D3DRS_LIGHTING, FALSE);
- m_statemanager->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
- m_statemanager->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
- m_statemanager->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_DESTALPHA);
-}
-
-void QDirect3DPaintEnginePrivate::updatePen(const QPen &pen)
-{
-#ifdef QT_DEBUG_D3D_CALLS
- qDebug() << "QDirect3DPaintEngine::updatePen";
-#endif
- m_pen = pen;
- m_has_cosmetic_pen = false;
- m_has_pen = (m_pen.style() != Qt::NoPen);
- if (m_has_pen) {
- m_pen_brush_style = m_pen.brush().style();
-
- if (m_pen_brush_style >= Qt::SolidPattern && m_pen_brush_style <= Qt::DiagCrossPattern) {
- int a, r, g, b;
- m_pen.color().getRgb(&r, &g, &b, &a);
- m_pen_color = D3DCOLOR_ARGB((int)(a * m_opacity),r,g,b);
- } else {
- m_pen_color = m_opacity_color;
- }
-
- m_has_cosmetic_pen = m_pen.isCosmetic();
-
- if (m_pen_brush_style != Qt::NoBrush &&
- m_pen_brush_style != Qt::SolidPattern) {
- bool ok;
- m_inv_pen_matrix = m_pen.brush().transform().inverted(&ok);
- if (!ok)
- qWarning() << "QDirect3DPaintEngine: No inverse matix for pen brush matrix.";
- }
-
- m_pen_width = m_pen.widthF();
- if (m_pen_width == 0.0f)
- m_pen_width = 1.0f;
- }
-}
-
-void QDirect3DPaintEnginePrivate::updateBrush(const QBrush &brush)
-{
-#ifdef QT_DEBUG_D3D_CALLS
- qDebug() << "QDirect3DPaintEngine::updateBrush";
-#endif
- m_brush = brush;
- m_brush_style = m_brush.style();
- m_has_brush = (m_brush_style != Qt::NoBrush);
- if (m_has_brush) {
- if (m_brush_style >= Qt::SolidPattern && m_brush_style <= Qt::DiagCrossPattern) {
- int a, r, g, b;
- m_brush.color().getRgb(&r, &g, &b, &a);
- m_brush_color = D3DCOLOR_ARGB((int)(a * m_opacity),r,g,b);
- } else {
- m_brush_color = m_opacity_color;
- }
-
- if (m_brush_style != Qt::SolidPattern) {
- bool ok;
- m_inv_brush_matrix = (m_brush.transform() * m_brush_origin).inverted(&ok);
- if (!ok)
- qWarning() << "QDirect3DPaintEngine: No inverse matix for brush matrix.";
-
- // make sure the texture is loaded as a texture
- if (m_brush_style == Qt::TexturePattern)
- verifyTexture(m_brush.texture());
-
-
- }
- }
-}
-
-void QDirect3DPaintEnginePrivate::updateTransform(const QTransform &matrix)
-{
-#ifdef QT_DEBUG_D3D_CALLS
- qDebug() << "QDirect3DPaintEngine::updateTransform";
-#endif
- m_matrix = matrix;
- m_inv_scale = qMax(1 / qMax( qMax(qAbs(m_matrix.m11()), qAbs(m_matrix.m22())),
- qMax(qAbs(m_matrix.m12()), qAbs(m_matrix.m21())) ), 0.0001);
- m_txop = matrix.type();
-}
-
-int QDirect3DPaintEnginePrivate::flushAntialiased(int offset)
-{
- // fills the mask (returns number of items added to the mask)
- int newoffset = m_draw_helper->drawAntialiasedMask(offset, m_batch.m_item_index);
-
- // set the render target to the current output surface
- if (FAILED(m_d3d_device->SetRenderTarget(0, m_current_surface)))
- qWarning() << "QDirect3DPaintEngine: SetRenderTarget failed!";
-
- // draw the bounding boxes (using the mask generated by drawAntialiasedMask)
- for (int i=offset; i<newoffset; ++i) {
- QD3DBatchItem *item = &(m_batch.items[i]);
- int pass = (item->m_info & QD3DBatchItem::BI_COMPLEXBRUSH) ? PASS_AA_DRAW : PASS_AA_DRAW_DIRECT;
- m_statemanager->beginPass(pass);
- prepareItem(item);
- if (item->m_info & QD3DBatchItem::BI_BRECT)
- m_draw_helper->drawAntialiasedBoundingRect(item);
- cleanupItem(item);
- }
-
- m_statemanager->endPass();
-
- return newoffset;
-}
-
-bool QDirect3DPaintEnginePrivate::prepareBatch(QD3DBatchItem *item, int offset)
-{
- if (item->m_info & QD3DBatchItem::BI_CLIP) {
- setRenderTechnique(RT_Aliased);
- if (item->m_info & QD3DBatchItem::BI_CLEARCLIP) {
- m_d3d_device->Clear(0, 0, D3DCLEAR_ZBUFFER, 0, 0.0f, 0);
- return true;
- }
-
- m_draw_helper->drawAliasedMask(offset);
- m_d3d_device->Clear(0, 0, D3DCLEAR_ZBUFFER, 0, 1.0f, 0);
- if (item->m_info & QD3DBatchItem::BI_BRECT) {
- m_statemanager->beginPass(PASS_STENCIL_CLIP);
- m_draw_helper->drawAliasedBoundingRect(item);
- m_statemanager->endPass();
- }
-
- return true;
- }
-
- if (item->m_info & QD3DBatchItem::BI_AA) {
- setRenderTechnique(RT_Antialiased);
- } else {
- setRenderTechnique(RT_Aliased);
- }
-
- return false;
-}
-
-void QDirect3DPaintEnginePrivate::prepareItem(QD3DBatchItem *item) {
- // pixmap
- int brushmode = 0;
- m_statemanager->startStateBlock();
- if ((item->m_info & QD3DBatchItem::BI_PIXMAP) || (item->m_info & QD3DBatchItem::BI_IMAGE)) {
- QRasterPixmapData *data = static_cast<QRasterPixmapData*>(item->m_pixmap.data);
- IDirect3DTexture9 *tex = (item->m_info & QD3DBatchItem::BI_PIXMAP) ?
- data->texture : item->m_texture;
- m_statemanager->setTexture(tex);
- brushmode = 5;
- }
-
- if (item->m_info & QD3DBatchItem::BI_AA) {
- m_statemanager->setMaskChannel(item->m_maskpos.channel);
- m_statemanager->setMaskOffset(item->m_xoffset, item->m_yoffset);
- }
-
- if (item->m_info & QD3DBatchItem::BI_COMPLEXBRUSH) {
- const QBrush brush = item->m_brush;
- switch (brush.style()) {
- case Qt::TexturePattern: {
- QRasterPixmapData *data = static_cast<QRasterPixmapData*>(brush.texture().data);
- m_statemanager->setTexture(data->texture, QGradient::RepeatSpread);
- brushmode = 1;
- break;
- }
- case Qt::LinearGradientPattern:
- m_statemanager->setTexture(m_gradient_cache->
- getBuffer(brush.gradient()->stops(), item->m_opacity),
- brush.gradient()->spread());
- brushmode = 2;
- break;
- case Qt::ConicalGradientPattern:
- m_statemanager->setTexture(m_gradient_cache->
- getBuffer(brush.gradient()->stops(), item->m_opacity),
- brush.gradient()->spread());
- brushmode = 3;
- break;
- case Qt::RadialGradientPattern:
- m_statemanager->setTexture(m_gradient_cache->
- getBuffer(brush.gradient()->stops(), item->m_opacity),
- brush.gradient()->spread());
- m_statemanager->setFocalDistance(item->m_distance);
- brushmode = 4;
- break;
- default: {
- QRasterPixmapData *data = static_cast<QRasterPixmapData*>(getPattern(brush.style()).data);
- m_statemanager->setTexture(data->texture, QGradient::RepeatSpread);
- brushmode = 5;
- }
- };
- }
-
- if (item->m_info & QD3DBatchItem::BI_TRANSFORM) {
- m_statemanager->setTransformation(&item->m_matrix);
- } else {
- m_statemanager->setTransformation();
- }
-
- m_statemanager->setBrushMode(brushmode);
- setCompositionMode(item->m_cmode);
- m_statemanager->endStateBlock();
-}
-
-
-void QDirect3DPaintEnginePrivate::releaseDC()
-{
- if (m_dc) {
- m_dcsurface->ReleaseDC(m_dc);
- m_dcsurface = 0;
- m_dc = 0;
- }
-}
-
-
-void QDirect3DPaintEnginePrivate::cleanupItem(QD3DBatchItem *item)
-{
- if (item->m_info & QD3DBatchItem::BI_PIXMAP)
- item->m_pixmap = QPixmap();
- item->m_brush = QBrush();
-}
-
-void QDirect3DPaintEnginePrivate::verifyTexture(const QPixmap &pm)
-{
- QRasterPixmapData *pmData = static_cast<QRasterPixmapData*>(pm.data);
- if (!pmData->texture) {
- QImage im = pmData->image;
- // bitmaps are drawn with the current pen color
- if (im.depth() == 1) {
- QVector<QRgb> colors(2);
- colors[0] = 0;
- colors[1] = m_pen.color().rgba();
- im.setColorTable(colors);
- }
- im = im.convertToFormat(QImage::Format_ARGB32);
- if (FAILED(m_d3d_device->CreateTexture(im.width(), im.height(), 1, 0,
- D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &pmData->texture, 0)))
- {
- qWarning("QDirect3DPaintEngine: unable to create Direct3D texture from pixmap.");
- return;
- }
- D3DLOCKED_RECT rect;
- if (FAILED(pmData->texture->LockRect(0, &rect, 0, 0))) {
- qDebug() << "QDirect3DPaintEngine: unable to lock texture rect.";
- return;
- }
- DWORD *dst = (DWORD *) rect.pBits;
- DWORD *src = (DWORD *) im.scanLine(0);
-
- Q_ASSERT((rect.Pitch/4) == (im.bytesPerLine()/4));
- memcpy(dst, src, rect.Pitch*im.height());
- pmData->texture->UnlockRect(0);
- }
-}
-
-bool QDirect3DPaintEnginePrivate::isFastRect(const QRectF &rect)
-{
- if (m_matrix.type() < QTransform::TxRotate) {
- QRectF r = m_matrix.mapRect(rect);
- return r.topLeft().toPoint() == r.topLeft()
- && r.bottomRight().toPoint() == r.bottomRight();
- }
-
- return false;
-}
-
-void QDirect3DPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode mode)
-{
- switch(mode) {
- case QPainter::CompositionMode_SourceOver:
- default:
- m_statemanager->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
- m_statemanager->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
- };
-}
-
-void QDirect3DPaintEnginePrivate::cleanup()
-{
- // clean batch
- for(int i=0; i<QD3D_BATCH_SIZE; ++i) {
- m_batch.items[i].m_brush = QBrush();
- m_batch.items[i].m_pixmap = QPixmap();
- }
-
- m_surface_manager.cleanup();
- m_patterns.clear();
-
- delete m_gradient_cache;
- delete m_draw_helper;
-
- if (m_effect)
- m_effect->Release();
-
- if (m_d3d_object)
- m_d3d_object->Release();
-
- m_effect = 0;
- m_d3d_object = 0;
- m_gradient_cache = 0;
- m_draw_helper = 0;
-}
-
-void QDirect3DPaintEnginePrivate::flushAliased(QD3DBatchItem *item, int offset)
-{
- m_draw_helper->drawAliasedMask(offset);
-
- if (item->m_info & QD3DBatchItem::BI_BRECT) {
- int pass = (item->m_info & QD3DBatchItem::BI_MASK) ? PASS_STENCIL_DRAW_DIRECT : PASS_STENCIL_NOSTENCILCHECK_DIRECT;
- if (item->m_info & (QD3DBatchItem::BI_COMPLEXBRUSH|QD3DBatchItem::BI_IMAGE|QD3DBatchItem::BI_PIXMAP) )
- pass = (item->m_info & QD3DBatchItem::BI_MASK) ? PASS_STENCIL_DRAW : PASS_STENCIL_NOSTENCILCHECK;
- m_statemanager->beginPass(pass);
- prepareItem(item);
- m_draw_helper->drawAliasedBoundingRect(item);
- cleanupItem(item);
- m_statemanager->endPass();
- }
-}
-
-void QDirect3DPaintEnginePrivate::flushText(QD3DBatchItem *item, int)
-{
- prepareItem(item);
- m_statemanager->setTexture(item->m_texture);
- m_statemanager->setBrushMode(1);
-// m_statemanager->SetRenderState(D3DRS_BLENDFACTOR, item->m_brush.color().rgba());
- m_statemanager->beginPass(m_cleartype_text ? PASS_CLEARTYPE_TEXT : PASS_TEXT);
- m_draw_helper->drawTextItem(item);
- m_statemanager->endPass();
- cleanupItem(item);
-}
-
-void QDirect3DPaintEnginePrivate::flushLines(QD3DBatchItem *item, int)
-{
- m_draw_helper->drawAliasedLines(item);
-
- if (item->m_info & QD3DBatchItem::BI_BRECT) {
- int pass = (item->m_info & QD3DBatchItem::BI_COMPLEXBRUSH) ? PASS_STENCIL_DRAW : PASS_STENCIL_DRAW_DIRECT;
- m_statemanager->beginPass(pass);
- prepareItem(item);
- m_draw_helper->drawAliasedBoundingRect(item);
- cleanupItem(item);
- m_statemanager->endPass();
- }
-}
-
-void QDirect3DPaintEnginePrivate::flushBatch()
-{
-// static int dbgcounter = 0;
-// ++dbgcounter;
-// qDebug() << " -> flush" << dbgcounter;
-
- int offset = 0;
- m_draw_helper->unlockVertexBuffer();
- releaseDC();
-
- // iterate over all items in the batch
- while (offset != m_batch.m_item_index) {
- QD3DBatchItem *item = &(m_batch.items[offset]);
-
- if (prepareBatch(item, offset)) {
- ++offset;
- continue;
- }
-
- if (item->m_info & QD3DBatchItem::BI_FASTLINE) {
- flushLines(item, offset++);
- } else if (item->m_info & QD3DBatchItem::BI_AA) {
- offset = flushAntialiased(offset);
- } else if (item->m_info & QD3DBatchItem::BI_TEXT) {
- flushText(item, offset++);
- } else {
- flushAliased(item, offset++);
- }
- }
-
- // reset batch
- m_batch.m_item_index = 0;
-
- // release doomed textures
- for (int i=0; i<qd3d_release_list.size(); ++i)
- qd3d_release_list.at(i)->Release();
- qd3d_release_list.clear();
-}
-
-QDirect3DPaintEngine::QDirect3DPaintEngine()
- : QPaintEngine(*(new QDirect3DPaintEnginePrivate),
- PaintEngineFeatures(AllFeatures & ~ObjectBoundingModeGradients))
-{ }
-
-QDirect3DPaintEngine::~QDirect3DPaintEngine()
-{
-}
-
-bool QDirect3DPaintEngine::begin(QPaintDevice *device)
-{
-#ifdef QT_DEBUG_D3D_CALLS
- qDebug() << "QDirect3DPaintEngine::begin";
-#endif
- Q_D(QDirect3DPaintEngine);
- setActive(true);
-
- QSize old_size = d->m_surface_size;
- d->m_surface_size = QRect(0, 0, device->width(), device->height()).size();
-
- d->m_current_state = 0;
- d->m_inv_scale = 1;
- d->m_opacity = 1.0f;
- d->m_opacity_color = D3DCOLOR_ARGB(255,255,255,255);
- d->m_matrix = QTransform();
- d->m_brush_origin = QTransform();
- d->m_txop = QTransform::TxNone;
- d->m_cmode = QPainter::CompositionMode_SourceOver;
-
- Q_ASSERT(device && device->devType() == QInternal::Widget);
- if (d->m_d3d_device == 0) {
- qWarning() << "QDirect3DPaintEngine: No Device!";
- return false;
- }
-
- d->m_cleartype_text = false;
-// QT_WA({
-// UINT result;
-// BOOL ok;
-// ok = SystemParametersInfoW(SPI_GETFONTSMOOTHINGTYPE, 0, &result, 0);
-// if (ok)
-// d->m_cleartype_text = (result == FE_FONTSMOOTHINGCLEARTYPE);
-// }, {
-// UINT result;
-// BOOL ok;
-// ok = SystemParametersInfoA(SPI_GETFONTSMOOTHINGTYPE, 0, &result, 0);
-// if (ok)
-// d->m_cleartype_text = (result == FE_FONTSMOOTHINGCLEARTYPE);
-// });
-
- d->m_surface_manager.setPaintDevice(device);
- int status = d->m_surface_manager.status();
- if (status & QD3DSurfaceManager::NeedsResetting) {
- d->m_effect->OnLostDevice();
- d->m_draw_helper->beforeReset();
- d->m_statemanager->reset();
- d->m_surface_manager.reset();
- d->m_draw_helper->afterReset();
- d->m_effect->OnResetDevice();
- d->initDevice();
- }
-
- LPDIRECT3DSURFACE9 newsurface = d->m_surface_manager.renderTarget();
- if (d->m_current_surface != newsurface) {
- d->m_current_surface = newsurface;
- if (FAILED(d->m_d3d_device->SetRenderTarget(0, newsurface)))
- qWarning() << "QDirect3DPaintEngine: SetRenderTarget failed!";
- }
-
- status = d->m_surface_manager.status();
- if (status & QD3DSurfaceManager::MaxSizeChanged) {
- QSize maxsize = d->m_surface_manager.maxSize();
- d->m_draw_helper->setMaskSize(maxsize);
- int masksize[2] = {maxsize.width(), maxsize.height()};
- d->m_effect->SetIntArray("g_mMaskSize", masksize, 2);
- }
-
- if (old_size != d->m_surface_size) {
- D3DXMATRIX projMatrix;
- pD3DXMatrixOrthoOffCenterLH(&projMatrix, 0, d->m_surface_size.width(), d->m_surface_size.height(), 0, 0.0f, 1.0f);
- d->m_statemanager->setProjection(&projMatrix);
- }
-
- if (!d->m_in_scene) {
- if (FAILED(d->m_d3d_device->BeginScene())) {
- qWarning() << "QDirect3DPaintEngine: BeginScene() failed.";
- return false;
- }
- QWidget *widget = static_cast<QWidget *>(device);
- if (widget->autoFillBackground() == true) {
- QColor color = widget->palette().brush(widget->backgroundRole()).color();
- RECT rect = {0, 0, widget->width(), widget->height()};
- d->m_d3d_device->ColorFill(d->m_current_surface, &rect,
- D3DCOLOR_ARGB(color.alpha(), color.red(), color.green(), color.blue()));
- }
- d->m_in_scene = true;
- }
-
- // set system clip
- d->m_clipping_enabled = false;
- d->m_has_complex_clipping = false;
-
- d->m_sysclip_region = systemClip();
- QVector<QRect> rects = d->m_sysclip_region.rects();
- if (rects.count() == 1 && rects.at(0).size() == d->m_surface_size)
- d->m_sysclip_region = QRegion();
-
- d->updateClipRegion(QRegion(), Qt::NoClip);
-
- return true;
-}
-
-void QDirect3DPaintEngine::drawEllipse(const QRectF &rect)
-{
-#ifdef QT_DEBUG_D3D_CALLS
- qDebug() << "QDirect3DPaintEngine::drawEllipse (float)";
-#endif
- QPaintEngine::drawEllipse(rect);
-}
-
-void QDirect3DPaintEngine::drawEllipse(const QRect &rect)
-{
-#ifdef QT_DEBUG_D3D_CALLS
- qDebug() << "QDirect3DPaintEngine::drawEllipse";
-#endif
- QPaintEngine::drawEllipse(rect);
-}
-
-void QDirect3DPaintEngine::drawImage(const QRectF &r, const QImage &image, const QRectF &sr,
- Qt::ImageConversionFlags)
-{
-#ifdef QT_DEBUG_D3D_CALLS
- qDebug() << "QDirect3DPaintEngine::drawImage";
-#endif
-
- Q_D(QDirect3DPaintEngine);
- int width = image.width();
- int height = image.height();
-
- // transform rectangle
- QPolygonF txrect(QRectF(sr.left() / width, sr.top() / height,
- sr.width() / width, sr.height() / height));
-
- QD3DBatchItem *item = d->nextBatchItem();
- item->m_info = QD3DBatchItem::BI_IMAGE | QD3DBatchItem::BI_TRANSFORM;
- item->m_texture = qd3d_image_cache()->lookup(d->m_d3d_device, image);
- item->m_matrix = d->m_matrix;
- d->m_draw_helper->queueRect(r.adjusted(-0.5f,-0.5f,-0.5f,-0.5f), item, d->m_opacity_color, txrect);
-}
-
-void QDirect3DPaintEngine::drawLines(const QLineF *lines, int lineCount)
-{
-#ifdef QT_DEBUG_D3D_CALLS
- qDebug() << "QDirect3DPaintEngine::drawLines (float)";
-#endif
- Q_D(QDirect3DPaintEngine);
-
- if (!d->m_has_pen)
- return;
-
- if (d->m_has_fast_pen && (d->m_pen_brush_style == Qt::SolidPattern)) {
- QD3DBatchItem *item = d->nextBatchItem();
- if (d->m_pen.isCosmetic())
- item->m_info |= QD3DBatchItem::BI_COSMETICPEN;
- item->m_info |= QD3DBatchItem::BI_TRANSFORM;
- item->m_matrix = d->m_matrix;
- d->m_draw_helper->queueAliasedLines(lines, lineCount, &item);
- } else {
- QRectF brect;
- QPainterPath path;
-
- // creates a path with the lines
- path.moveTo(lines[0].x1(), lines[0].y1());
- qreal lastx = lines[0].x2();
- qreal lasty = lines[0].y2();
- path.lineTo(lastx, lasty);
-
- for (int i=1; i<lineCount; ++i) {
- qreal x = lines[i].x1();
- qreal y = lines[i].y1();
- if (lastx != x || lasty != y) {
- path.moveTo(x, y);
- }
- path.lineTo(lines[i].x2(), lines[i].y2());
- }
-
- if (d->m_has_cosmetic_pen) {
- brect = path.controlPointRect();
- path = d->m_matrix.map(path);
- }
-
- d->strokePath(path, brect, true);
- }
-}
-
-void QDirect3DPaintEngine::drawLines(const QLine *lines, int lineCount)
-{
-#ifdef QT_DEBUG_D3D_CALLS
- qDebug() << "QDirect3DPaintEngine::drawLines";
-#endif
- QPaintEngine::drawLines(lines, lineCount);
-}
-
-void QDirect3DPaintEngine::drawPath(const QPainterPath &path)
-{
-#ifdef QT_DEBUG_D3D_CALLS
- qDebug() << "QDirect3DPaintEngine::drawPath";
-#endif
- Q_D(QDirect3DPaintEngine);
-
- if (path.isEmpty())
- return;
-
- QRectF brect;
- QPainterPath tpath;
-
- if (d->m_has_cosmetic_pen) {
- brect = path.controlPointRect();
- tpath = d->m_matrix.map(path);
- } else {
- tpath = path;
- }
-
- if (d->m_has_brush)
- d->fillPath(tpath, brect);
-
- if (d->m_has_pen)
- d->strokePath(tpath, brect);
-}
-
-
-QPointF QDirect3DPaintEnginePrivate::transformPoint(const QPointF &p, qreal *w) const
-{
- (*w) = 1.0f;
- qreal fx = p.x();
- qreal fy = p.y();
- qreal nx = m_matrix.m11()*fx + m_matrix.m21()*fy + m_matrix.m31();
- qreal ny = m_matrix.m12()*fx + m_matrix.m22()*fy + m_matrix.m32();
- if (!m_matrix.isAffine()) {
- *w = m_matrix.m13()*fx + m_matrix.m23()*fy + m_matrix.m33();
- //*w = 1/(*w);
- nx = nx/(*w);
- ny = ny/(*w);
- }
- return QPointF(nx, ny);
-}
-
-void QDirect3DPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
-{
-#ifdef QT_DEBUG_D3D_CALLS
- qDebug() << "QDirect3DPaintEngine::drawPixmap";
-#endif
- Q_D(QDirect3DPaintEngine);
-
- if (d->m_draw_helper->needsFlushing())
- d->flushBatch();
-
- int width = pm.width();
- int height = pm.height();
-
- // transform rectangle
- QPolygonF txrect(QRectF(sr.left() / width, sr.top() / height,
- sr.width() / width, sr.height() / height));
-
- QD3DBatchItem *item = d->nextBatchItem();
- item->m_info = QD3DBatchItem::BI_PIXMAP|QD3DBatchItem::BI_TRANSFORM;
-
- item->m_pixmap = pm;
- d->verifyTexture(item->m_pixmap);
-
- item->m_matrix = d->m_matrix;
- d->m_draw_helper->queueRect(r.adjusted(-0.5f,-0.5f,-0.5f,-0.5f), item, d->m_opacity_color, txrect);
-}
-
-void QDirect3DPaintEngine::drawPoints(const QPointF *points, int pointCount)
-{
-#ifdef QT_DEBUG_D3D_CALLS
- qDebug() << "QDirect3DPaintEngine::drawPoints (float)";
-#endif
- QPaintEngine::drawPoints(points, pointCount);
-}
-
-void QDirect3DPaintEngine::drawPoints(const QPoint *points, int pointCount)
-{
-#ifdef QT_DEBUG_D3D_CALLS
- qDebug() << "QDirect3DPaintEngine::drawPoints";
-#endif
- QPaintEngine::drawPoints(points, pointCount);
-}
-
-void QDirect3DPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
-{
-#ifdef QT_DEBUG_D3D_CALLS
- qDebug() << "QDirect3DPaintEngine::drawPolygon";
-#endif
- Q_D(QDirect3DPaintEngine);
-
- if (d->m_has_brush && mode != PolylineMode) {
- QPainterPath path;
- path.setFillRule(mode == WindingMode ? Qt::WindingFill : Qt::OddEvenFill);
- path.moveTo(points[0]);
- for (int i=1; i<pointCount; ++i)
- path.lineTo(points[i]);
- if (path.isEmpty())
- return;
- d->fillPath(path, QRectF());
- }
-
- if (d->m_has_pen) {
- QPainterPath path(points[0]);
- for (int i = 1; i < pointCount; ++i)
- path.lineTo(points[i]);
- if (mode != PolylineMode)
- path.lineTo(points[0]);
-
- if (path.isEmpty())
- return;
- QRectF brect;
- if (d->m_has_cosmetic_pen) {
- brect = path.controlPointRect();
- path = d->m_matrix.map(path);
- }
-
- d->strokePath(path, brect);
- }
-}
-
-void QDirect3DPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode)
-{
-#ifdef QT_DEBUG_D3D_CALLS
- qDebug() << "QDirect3DPaintEngine::drawPolygon";
-#endif
- QPaintEngine::drawPolygon(points, pointCount, mode);
-}
-
-void QDirect3DPaintEngine::drawRects(const QRectF *rects, int rectCount)
-{
- Q_D(QDirect3DPaintEngine);
-#ifdef QT_DEBUG_D3D_CALLS
- qDebug() << "QDirect3DPaintEngine::drawRects (float)";
-#endif
- for (int i=0; i<rectCount; ++i) {
- if ((d->m_brush_style == Qt::SolidPattern) &&
- (!(d->m_current_state & QD3DBatchItem::BI_AA) || d->isFastRect(rects[i]))) {
- QD3DBatchItem *item = d->nextBatchItem();
- item->m_info |= QD3DBatchItem::BI_TRANSFORM;
- item->m_info &= ~QD3DBatchItem::BI_AA;
- item->m_matrix = d->m_matrix;
- const QRectF rect = rects[i];
- d->m_draw_helper->queueRect(rect, item, d->m_brush_color);
-
- if (d->m_has_pen) {
- if (d->m_has_fast_pen && (d->m_pen_brush_style == Qt::SolidPattern)) {
- QLineF lines[4];
- qreal x1 = rect.x();
- qreal y1 = rect.y();
- qreal x2 = rect.width() + x1;
- qreal y2 = rect.height() + y1;
- lines[0] = QLineF(x1, y1, x2, y1);
- lines[1] = QLineF(x2, y1, x2, y2);
- lines[2] = QLineF(x2, y2, x1, y2);
- lines[3] = QLineF(x1, y2, x1, y1);
- QD3DBatchItem *item = d->nextBatchItem();
- if (d->m_pen.isCosmetic())
- item->m_info |= QD3DBatchItem::BI_COSMETICPEN;
- item->m_info |= QD3DBatchItem::BI_TRANSFORM;
- item->m_matrix = d->m_matrix;
- d->m_draw_helper->queueAliasedLines(lines, 4, &item);
- } else {
- QPainterPath path;
- QRectF brect;
-
- path.addRect(rects[i]);
- if (d->m_has_cosmetic_pen) {
- brect = path.controlPointRect();
- path = d->m_matrix.map(path);
- }
-
- d->strokePath(path, brect, true);
- }
- }
- } else {
- QPainterPath path;
- QRectF brect;
-
- path.addRect(rects[i]);
- if (d->m_has_cosmetic_pen) {
- brect = path.controlPointRect();
- path = d->m_matrix.map(path);
- }
-
- if (d->m_has_brush)
- d->fillPath(path, brect);
-
- if (d->m_has_pen)
- d->strokePath(path, brect, true);
- }
- }
-}
-
-void QDirect3DPaintEngine::drawRects(const QRect *rects, int rectCount)
-{
-#ifdef QT_DEBUG_D3D_CALLS
- qDebug() << "QDirect3DPaintEngine::drawRects";
-#endif
- QPaintEngine::drawRects(rects, rectCount);
-}
-
-
-void QDirect3DPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem)
-{
- Q_D(QDirect3DPaintEngine);
-
-#ifdef QT_DEBUG_D3D_CALLS
- qDebug() << "QDirect3DPaintEngine::drawTextItem";
-#endif
-// if (d->m_matrix.isScaling() || (d->m_pen_brush_style >= Qt::LinearGradientPattern
-// && d->m_pen_brush_style <= Qt::ConicalGradientPattern)) {
-// QPaintEngine::drawTextItem(p, textItem);
-// return;
-// }
-
- const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem);
- QVarLengthArray<QFixedPoint> positions;
- QVarLengthArray<glyph_t> glyphs;
- QTransform matrix;
- matrix.translate(p.x(), p.y());
- ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions);
-
- qd3d_glyph_cache()->cacheGlyphs(this, ti, glyphs, d->m_cleartype_text);
- QD3DFontTexture *font_tex = qd3d_glyph_cache()->fontTexture(ti.fontEngine);
-
- QD3DBatchItem *item = d->nextBatchItem();
- d->m_draw_helper->lockVertexBuffer();
-
- item->m_info = QD3DBatchItem::BI_TEXT
- | (d->m_current_state & ~QD3DBatchItem::BI_AA) | QD3DBatchItem::BI_TRANSFORM;
- item->m_texture = font_tex->texture;
- item->m_offset = d->m_draw_helper->index();
- item->m_matrix = d->m_matrix;
- item->m_count = 0;
- item->m_brush = d->m_pen.brush();
-
- for (int i=0; i< glyphs.size(); ++i) {
- QD3DGlyphCoord *g = qd3d_glyph_cache()->lookup(ti.fontEngine, glyphs[i]);
-
- // we don't cache glyphs with no width/height
- if (!g)
- continue;
-
- // texture coords
- qreal tex_coords[] = { g->x, g->y, g->x + g->width, g->y + g->height };
- QPointF logical_pos(qRound((positions[i].x - g->x_offset).toReal()) - 0.5f,
- qRound((positions[i].y + g->y_offset).toReal()) - 0.5f);
-
- QRectF glyph_rect(logical_pos, QSizeF(g->log_width, g->log_height));
- d->m_draw_helper->queueTextGlyph(glyph_rect, tex_coords, item, d->m_pen_color);
- }
-}
-
-void QDirect3DPaintEngine::drawTiledPixmap(const QRectF &rect, const QPixmap &pixmap, const QPointF &p)
-{
-#ifdef QT_DEBUG_D3D_CALLS
- qDebug() << "QDirect3DPaintEngine::drawTiledPixmap";
-#endif
- QPaintEngine::drawTiledPixmap(rect, pixmap, p);
-}
-
-bool QDirect3DPaintEngine::end()
-{
- Q_D(QDirect3DPaintEngine);
-
- d->flushBatch();
-
- if (d->m_flush_on_end) {
- QPaintDevice *pdev = paintDevice();
- LPDIRECT3DSWAPCHAIN9 swapchain = swapChain(pdev);
-
-
- QWidget *w = 0;
- if (pdev->devType() == QInternal::Widget) {
- w = static_cast<QWidget *>(pdev);
- }
-
- if (w && swapchain) {
- QRect br = w->rect();
- QRect wbr = br;//.translated(-w->pos());
-
- RECT destrect;
- destrect.left = wbr.x();
- destrect.top = wbr.y();
- destrect.right = destrect.left + wbr.width();
- destrect.bottom = destrect.top + wbr.height();
-
- RECT srcrect;
- srcrect.left = br.x();// + w->x();
- srcrect.top = br.y();// + w->y();
- srcrect.right = wbr.width() + srcrect.left;
- srcrect.bottom = wbr.height() + srcrect.top;
- int devwidth = w->width();
- int devheight = w->height();
-
- if (devwidth <= srcrect.right) {
- int diff = srcrect.right - devwidth;
- srcrect.right -= diff;
- destrect.right -= diff;
- if (srcrect.right <= srcrect.left)
- return false;
- }
- if (devheight <= srcrect.bottom) {
- int diff = srcrect.bottom - devheight;
- srcrect.bottom -= diff;
- destrect.bottom -= diff;
- if (srcrect.bottom <= srcrect.top)
- return false;
- }
-
- if (FAILED(swapchain->Present(&srcrect, &destrect, w->winId(), 0, 0)))
- qWarning("QDirect3DPaintEngine: failed to present back buffer.");
- }
- }
-
-
- return true;
-}
-
-void QDirect3DPaintEngine::updateState(const QPaintEngineState &state)
-{
-#ifdef QT_DEBUG_D3D_CALLS
- qDebug() << "QDirect3DPaintEngine::updateState";
-#endif
- Q_D(QDirect3DPaintEngine);
-
- bool update_fast_pen = false;
- DirtyFlags flags = state.state();
-
- if (flags & DirtyOpacity) {
- d->m_opacity = state.opacity();
- if (d->m_opacity > 1.0f)
- d->m_opacity = 1.0f;
- if (d->m_opacity < 0.f)
- d->m_opacity = 0.f;
- uint c = (d->m_opacity * 255);
- d->m_opacity_color = D3DCOLOR_ARGB(c,c,c,c);
- flags |= (DirtyPen | DirtyBrush);
- }
-
- if (flags & DirtyCompositionMode) {
- d->m_cmode = state.compositionMode();
- }
-
- if (flags & DirtyTransform) {
- d->updateTransform(state.transform());
- update_fast_pen = true;
- }
-
- if (flags & DirtyHints) {
- if (state.renderHints() & QPainter::Antialiasing)
- d->m_current_state |= QD3DBatchItem::BI_AA;
- else
- d->m_current_state &= ~QD3DBatchItem::BI_AA;
- update_fast_pen = true;
- }
-
- if (flags & DirtyFont) {
- d->updateFont(state.font());
- }
-
- if (state.state() & DirtyClipEnabled) {
- if (state.isClipEnabled() && !d->m_clipping_enabled) {
- d->m_clipping_enabled = true;
- if (d->m_has_complex_clipping)
- d->updateClipPath(painter()->clipPath(), Qt::ReplaceClip);
- else
- d->updateClipRegion(painter()->clipRegion(), Qt::ReplaceClip);
- } else if (!state.isClipEnabled() && d->m_clipping_enabled) {
- d->m_clipping_enabled = false;
- if (d->m_has_complex_clipping)
- d->updateClipPath(QPainterPath(), Qt::NoClip);
- else
- d->updateClipRegion(QRegion(), Qt::NoClip);
- }
- }
-
- if (flags & DirtyClipRegion) {
- d->updateClipRegion(state.clipRegion(), state.clipOperation());
- }
-
- if (flags & DirtyClipPath) {
- d->updateClipPath(state.clipPath(), state.clipOperation());
- }
-
- if (flags & DirtyBrushOrigin) {
- d->m_brush_origin = QTransform();
- d->m_brush_origin.translate(-state.brushOrigin().x(),
- -state.brushOrigin().y());
- flags |= DirtyBrush;
- }
-
- if (flags & DirtyPen) {
- d->updatePen(state.pen());
- update_fast_pen = true;
- }
-
- if (flags & DirtyBrush)
- d->updateBrush(state.brush());
-
- if (update_fast_pen && d->m_has_pen) {
- if (d->m_current_state & QD3DBatchItem::BI_AA) {
- d->m_has_fast_pen = false;
- d->m_has_aa_fast_pen = ((d->m_txop <= QTransform::TxTranslate) || d->m_has_cosmetic_pen)
- && (d->m_pen_width <= 1.0f)
- && (d->m_pen.style() == Qt::SolidLine);
- } else {
- d->m_has_aa_fast_pen = false;
- d->m_has_fast_pen = ((d->m_txop <= QTransform::TxTranslate) || d->m_has_cosmetic_pen)
- && (d->m_pen.style() == Qt::SolidLine)
- && (d->m_pen.capStyle() == Qt::SquareCap);
- }
- }
-}
-
-void QDirect3DPaintEngine::cleanup()
-{
- Q_D(QDirect3DPaintEngine);
- d->cleanup();
-}
-
-void QDirect3DPaintEngine::scroll(QPaintDevice *pd, const RECT &srcrect, const RECT &destrect)
-{
- Q_D(QDirect3DPaintEngine);
- LPDIRECT3DSURFACE9 srcsurf = d->m_surface_manager.surface(pd);
- LPDIRECT3DSURFACE9 masksurf = d->m_draw_helper->freeMaskSurface();
- if (FAILED(d->m_d3d_device->StretchRect(srcsurf, &srcrect, masksurf, &srcrect, D3DTEXF_NONE)))
- qWarning("QDirect3DPaintEngine: StretchRect failed.");
- if (FAILED(d->m_d3d_device->StretchRect(masksurf, &srcrect, srcsurf, &destrect, D3DTEXF_NONE)))
- qWarning("QDirect3DPaintEngine: StretchRect failed.");
-}
-
-LPDIRECT3DSWAPCHAIN9 QDirect3DPaintEngine::swapChain(QPaintDevice *pd)
-{
- Q_D(QDirect3DPaintEngine);
-
- if (d->m_in_scene) {
- if (d->m_d3d_device == 0) {
- qWarning("QDirect3DPaintEngine: No device!");
- return false;
- }
-
- d->setRenderTechnique(QDirect3DPaintEnginePrivate::RT_NoTechnique);
- if (FAILED(d->m_d3d_device->EndScene()))
- qWarning("QDirect3DPaintEngine: failed to end scene.");
-
- d->m_in_scene = false;
- }
-
- return d->m_surface_manager.swapChain(pd);
-}
-
-void QDirect3DPaintEngine::releaseSwapChain(QPaintDevice *pd)
-{
- Q_D(QDirect3DPaintEngine);
- d->m_surface_manager.releasePaintDevice(pd);
-}
-
-HDC QDirect3DPaintEngine::getDC() const
-{
- QDirect3DPaintEnginePrivate *d = const_cast<QDirect3DPaintEnginePrivate *>(d_func());
-
- if (!d->m_dc && d->m_current_surface) {
- d->m_dcsurface = d->m_current_surface;
- if (FAILED(d->m_current_surface->GetDC(&d->m_dc)))
- qWarning() << "QDirect3DPaintEngine::getDC() failed!";
- }
-
- return d->m_dc;
-}
-
-void QDirect3DPaintEngine::setFlushOnEnd(bool flushOnEnd)
-{
- Q_D(QDirect3DPaintEngine);
-
- d->m_flush_on_end = flushOnEnd;
-}
-
-bool QDirect3DPaintEngine::hasDirect3DSupport()
-{
- Q_D(QDirect3DPaintEngine);
- return d->m_supports_d3d;
-}
-
-QT_END_NAMESPACE
-
-#include "qpaintengine_d3d.moc"
diff --git a/src/gui/painting/qpaintengine_d3d.fx b/src/gui/painting/qpaintengine_d3d.fx
deleted file mode 100644
index 1148b2a..0000000
--- a/src/gui/painting/qpaintengine_d3d.fx
+++ /dev/null
@@ -1,608 +0,0 @@
-bool g_mCosmeticPen;
-int4 g_mChannel;
-float2 g_mMaskOffset;
-int2 g_mMaskSize;
-float4x4 g_mMaskProjection;
-float4x4 g_mViewProjection;
-float4x4 g_mTransformation;
-texture g_mAAMask;
-texture g_mTexture;
-int g_mBrushMode;
-float g_mFocalDist;
-
-#define M_PI 3.14159265358979323846
-
-sampler PixmapSampler = sampler_state
-{
- texture = <g_mTexture>;
- MIPFILTER = NONE;
- MINFILTER = LINEAR;
- MAGFILTER = LINEAR;
-};
-
-sampler TextSampler = sampler_state
-{
- texture = <g_mTexture>;
- MIPFILTER = NONE;
- MINFILTER = POINT;
- MAGFILTER = POINT;
-};
-
-sampler AAMaskSampler = sampler_state
-{
- texture = <g_mAAMask>;
- AddressU = WRAP;
- AddressV = WRAP;
- AddressW = WRAP;
- MIPFILTER = NONE;
- MINFILTER = POINT;
- MAGFILTER = POINT;
-};
-
-struct VS_FULL
-{
- float4 Position : POSITION;
- float4 Diffuse : COLOR0;
- float4 TexCoords0 : TEXCOORD0;
- float4 TexCoords1 : TEXCOORD1;
-};
-
-VS_FULL TrapezoidVS( float4 Position : POSITION,
- float4 Diffuse : COLOR0,
- float4 TexCoords0 : TEXCOORD0,
- float4 TexCoords1 : TEXCOORD1)
-{
- VS_FULL Output;
-
- float a = (TexCoords1.x * Position.x) + (TexCoords1.z * (1.0 - Position.x) ); // left or right a
- float b = (TexCoords1.y * Position.x) + (TexCoords1.w * (1.0 - Position.x) ); // left or right b
- float d = 1.0 - (Position.x * 2);
-
- Position.x = (a * Position.y + b) + ( sqrt( abs(a * a) ) * d );
- //Position.x += step(abs(a), 0) * d;
- Position.x += (0.5 * d);
-
- Output.Position = mul(Position, g_mMaskProjection);
- Output.Diffuse = Diffuse;
- Output.TexCoords0 = TexCoords0;
- Output.TexCoords1 = TexCoords1;
-
- return Output;
-}
-
-struct PS_OUTPUT
-{
- float4 Color : COLOR0;
-};
-
-PS_OUTPUT TrapezoidPS(VS_FULL In, float2 pixelPos : VPOS)
-{
- PS_OUTPUT Out;
-
- float top = max(pixelPos.y - 0.5, In.TexCoords0.x);
- float bottom = min(pixelPos.y + 0.5, In.TexCoords0.y);
-
- float area = bottom - top;
-
- float left = pixelPos.x - 0.5;
- float right = pixelPos.x + 0.5;
-
- // use line equations to compute intersections of left/right edges with top/bottom of truncated pixel
- // vecX: x = (left, top), y = (left, bottom), z = (right, top), w = (right, bottom)
- float4 vecX = In.TexCoords1.xxzz * float2(top, bottom).xyxy + In.TexCoords1.yyww;
-
- float2 invA = In.TexCoords0.zw;
-
- // transform right line to left to be able to use same calculations for both
- vecX.zw = 2 * pixelPos.x - vecX.zw;
-
- float2 topX = float2(vecX.x, vecX.z);
- float2 bottomX = float2(vecX.y, vecX.w);
-
- // transform lines such that top intersection is to the right of bottom intersection
- float2 topXTemp = max(topX, bottomX);
- float2 bottomXTemp = min(topX, bottomX);
-
- // make sure line slope reflects mirrored lines
- invA = lerp(invA, -invA, step(topX, bottomX));
-
- float2 vecLeftRight = float2(left, right);
-
- // compute the intersections of the lines with the left and right edges of the pixel
- // intersectY: x = (left_line, left), y = (left_line, right), z = (right_line, left), w = (right_line, right)
- float4 intersectY = top + (vecLeftRight.xyxy - topXTemp.xxyy) * invA.xxyy;
-
- float2 temp = lerp(area - 0.5 * (right - bottomXTemp) * (bottom - intersectY.yw), // left < bottom < right < top
- (0.5 * (topXTemp + bottomXTemp) - left) * area, // left < bottom < top < right
- step(topXTemp, right));
-
- float2 excluded = 0.5 * (intersectY.xz - top) * (topXTemp - left); // bottom < left < top < right
-
- excluded = lerp(0.5 * (intersectY.yw + intersectY.xz) - top, // bottom < left < right < top
- excluded, step(topXTemp, right));
-
- excluded = lerp(temp, // left < bottom < right (see calculation of temp)
- excluded, step(bottomXTemp, left));
-
- excluded = lerp(float2(area, area), // right < bottom < top
- excluded, step(bottomXTemp, right));
-
- excluded *= step(left, topXTemp);
-
- float result = (area - excluded.x - excluded.y) * step(top, bottom);
- Out.Color.r = result * g_mChannel[0];
- Out.Color.g = result * g_mChannel[1];
- Out.Color.b = result * g_mChannel[2];
- Out.Color.a = result * g_mChannel[3];
-
- return Out;
-}
-
-VS_FULL ViewProjectionVS( float4 Position : POSITION,
- float4 Diffuse : COLOR0,
- float4 TexCoords0 : TEXCOORD0,
- float4 TexCoords1 : TEXCOORD1)
-{
- VS_FULL Output;
-
- Output.Position = mul(Position, g_mTransformation);
- Output.Position = mul(Output.Position, g_mViewProjection);
- Output.Diffuse = Diffuse;
- Output.TexCoords0 = TexCoords0;
- Output.TexCoords1 = TexCoords1;
-
- return Output;
-}
-
-PS_OUTPUT DirectMaskPS(VS_FULL In, float2 pixelPos : VPOS)
-{
- PS_OUTPUT Out;
- Out.Color = In.Diffuse;
-
- float2 maskcoords = ( (pixelPos + g_mMaskOffset) - 0.5 ) / g_mMaskSize;
- float2 clipcoords = (pixelPos - 0.5) / g_mMaskSize;
-
- float4 c = tex2D(AAMaskSampler, maskcoords.xy) * Out.Color.a;
- Out.Color.a = c.r * g_mChannel[0];
- Out.Color.a += c.g * g_mChannel[1];
- Out.Color.a += c.b * g_mChannel[2];
- Out.Color.a += c.a * g_mChannel[3];
-
- return Out;
-}
-
-PS_OUTPUT MaskPS(VS_FULL In, float2 pixelPos : VPOS)
-{
- PS_OUTPUT Out;
-
- if (g_mBrushMode == 1) {
- float x = In.TexCoords0.x;
- float y = In.TexCoords0.y;
- x = x - int(x);
- y = y - int(y);
- Out.Color = tex2D(PixmapSampler, float2(x, y));
- Out.Color.a = Out.Color.a * In.Diffuse.a;
- } else if (g_mBrushMode == 2) {
- Out.Color = tex1D(PixmapSampler, In.TexCoords0.x);
- } else if (g_mBrushMode == 3) {
- float t = atan2(In.TexCoords0.y, -In.TexCoords0.x) / (2 * M_PI);
- Out.Color = tex1D(PixmapSampler, t + 0.5);
- } else if (g_mBrushMode == 4) {
- float2 tc = float2(In.TexCoords0.x, abs(In.TexCoords0.y));
- float a = (tc.x - g_mFocalDist) / tc.y;
- float b = g_mFocalDist;
-
- float A = 1 + (a * a);
- float B = 2.0 * a * b;
- float C = (b * b) - 1;
-
- float y = (-B + sqrt(B*B - 4.0*A*C)) / (2.0*A);
- Out.Color = tex1D(PixmapSampler, (tc.y / y) );
- } else if (g_mBrushMode == 5) {
- Out.Color = tex2D(PixmapSampler, In.TexCoords0.xy);
- Out.Color = Out.Color * In.Diffuse;
- } else {
- Out.Color = In.Diffuse;
- }
-
- float2 maskcoords = ( (pixelPos + g_mMaskOffset) - 0.5 ) / g_mMaskSize;
-
- float4 c = tex2D(AAMaskSampler, maskcoords.xy) * Out.Color.a;
- Out.Color.a = c.r * g_mChannel[0];
- Out.Color.a += c.g * g_mChannel[1];
- Out.Color.a += c.b * g_mChannel[2];
- Out.Color.a += c.a * g_mChannel[3];
-
- return Out;
-}
-
-struct VS_NORMAL
-{
- float4 Position : POSITION;
- float4 Diffuse : COLOR0;
- float4 TexCoords : TEXCOORD0;
-};
-
-VS_NORMAL MaskProjectionVS(VS_NORMAL In)
-{
- VS_NORMAL Output;
-
- Output.Position = mul(In.Position, g_mMaskProjection);
- Output.Diffuse = In.Diffuse;
- Output.TexCoords = In.TexCoords;
-
- return Output;
-}
-
-float4 DirectSimplePS(float4 Color : COLOR0) : COLOR0
-{
- return Color;
-}
-
-float4 SimplePS(float4 Color : COLOR0, float4 TexCoords : TEXCOORD0) : COLOR0
-{
- if (g_mBrushMode == 1) {
- float opacity = Color.a;
- float x = TexCoords.x;
- float y = TexCoords.y;
- x = x - int(x);
- y = y - int(y);
- Color = tex2D(PixmapSampler, float2(x, y));
- Color.a = Color.a * opacity;
- } else if (g_mBrushMode == 2) {
- Color = tex1D(PixmapSampler, TexCoords.x);
- } else if (g_mBrushMode == 3) {
- float t = atan2(TexCoords.y, -TexCoords.x) / (2 * M_PI);
- Color = tex1D(PixmapSampler, t + 0.5);
- } else if (g_mBrushMode == 4) {
- float2 tc = float2(TexCoords.x, abs(TexCoords.y));
- float a = (tc.x - g_mFocalDist) / tc.y;
- float b = g_mFocalDist;
-
- float A = 1 + (a * a);
- float B = 2.0 * a * b;
- float C = (b * b) - 1;
-
- float y = (-B + sqrt(B*B - 4.0*A*C)) / (2.0*A);
- Color = tex1D(PixmapSampler, (tc.y / y) );
- } else if (g_mBrushMode == 5) {
- Color = tex2D(PixmapSampler, TexCoords.xy) * Color;
- }
-
- return Color;
-}
-
-float4 TextPS(float4 Color : COLOR0, float4 TexCoords : TEXCOORD0) : COLOR0
-{
- Color.a *= tex2D(TextSampler, TexCoords.xy).a;
- return Color;
-}
-
-float4 ClearTypePS(float4 Color : COLOR0, float4 TexCoords : TEXCOORD0) : COLOR0
-{
-// if (g_mUsePixmap) {
-// float4 MaskColor = tex2D(PixmapSampler, TexCoords.xy);
-// Color = float4(1.0, 0.0, 0.0, 1.0);
-// Color.a = (1 - MaskColor.a) + MaskColor.a * Color.a;
-// Color.r = (1.0 - MaskColor.r) + (MaskColor.r * Color.r);
-// Color.g = (1.0 - MaskColor.g) + (MaskColor.g * Color.g);
-// Color.b = (1.0 - MaskColor.b) + (MaskColor.b * Color.b);
-// Color = MaskColor;
- return tex2D(PixmapSampler, TexCoords.xy);
-}
-
-VS_NORMAL NoTxAliasedVS(VS_NORMAL In)
-{
- VS_NORMAL Output;
-
- Output.Position = mul(In.Position, g_mViewProjection);
- Output.Diffuse = In.Diffuse;
- Output.TexCoords = In.TexCoords;
-
- return Output;
-}
-
-VS_NORMAL AliasedVS(VS_NORMAL In)
-{
- VS_NORMAL Output;
-
- Output.Position = mul(In.Position, g_mTransformation);
- Output.Position = mul(Output.Position, g_mViewProjection);
- Output.Diffuse = In.Diffuse;
- Output.TexCoords = In.TexCoords;
-
- return Output;
-}
-
-VS_NORMAL AliasedLinesVS(VS_NORMAL In)
-{
- VS_NORMAL Output;
-
- float4 start = float4(In.Position.x, In.Position.y, 0.5, In.Position.w);
- float4 end = float4(In.TexCoords.z, In.TexCoords.w, 0.5, In.Position.w);
- if (g_mCosmeticPen) {
- start = mul(start, g_mTransformation);
- end = mul(end, g_mTransformation);
- }
-
- float2 line_vec = end - start;
- float2 vec = normalize(line_vec);
- float2 norm = float2(-vec.y, vec.x);
-
- float pen_width = In.Position.z;
- norm = norm * pen_width * 0.5;
- vec = vec * pen_width * 0.5;
-
- Output.Position.w = In.Position.w;
- Output.Position.x = start.x + (vec.x * In.TexCoords.x);
- Output.Position.x = Output.Position.x + (norm.x * In.TexCoords.y);
- Output.Position.x = Output.Position.x + (line_vec.x * step(0, In.TexCoords.x));
- Output.Position.y = start.y + (vec.y * In.TexCoords.x);
- Output.Position.y = Output.Position.y + (norm.y * In.TexCoords.y);
- Output.Position.y = Output.Position.y + (line_vec.y * step(0, In.TexCoords.x));
- Output.Position.z = 0.5;
-
- if (!g_mCosmeticPen) {
- Output.Position = mul(Output.Position, g_mTransformation);
- }
- Output.Position = mul(Output.Position, g_mViewProjection);
-
- Output.Diffuse = In.Diffuse;
- Output.TexCoords = In.TexCoords;
-
- return Output;
-}
-
-
-technique Antialiased
-{
- pass PASS_AA_CREATEMASK
- {
- StencilEnable = False;
- ZWriteEnable = False;
- ColorWriteEnable = 0x0f;
- ZEnable = False;
-
- SrcBlend = One;
- DestBlend = One;
-
- VertexShader = compile vs_3_0 TrapezoidVS();
- PixelShader = compile ps_3_0 TrapezoidPS();
- }
-
- pass PASS_AA_DRAW
- {
- StencilEnable = False;
- ZFunc = Greater;
- ZWriteEnable = False;
- ZEnable = True;
- ColorWriteEnable = 0x0f;
-
- VertexShader = compile vs_3_0 ViewProjectionVS();
- PixelShader = compile ps_3_0 MaskPS();
- }
-
- pass PASS_AA_DRAW_DIRECT
- {
- StencilEnable = False;
- ZFunc = Greater;
- ZEnable = True;
- ZWriteEnable = False;
- ColorWriteEnable = 0x0f;
-
- VertexShader = compile vs_3_0 ViewProjectionVS();
- PixelShader = compile ps_3_0 DirectMaskPS();
- }
-}
-
-technique Aliased
-{
- pass PASS_STENCIL_ODDEVEN
- {
- TwoSidedStencilMode = False;
- StencilEnable = True;
- StencilPass = Invert;
- StencilFunc = Always;
- ColorWriteEnable = 0;
-
- ZEnable = False;
- ZWriteEnable = False;
-
- VertexShader = compile vs_1_1 NoTxAliasedVS();
- PixelShader = compile ps_2_0 DirectSimplePS();
- }
-
- pass PASS_STENCIL_WINDING
- {
- TwoSidedStencilMode = True;
- StencilEnable = True;
- StencilRef = 0;
- StencilMask = 0xFFFFFFFF;
-
- CCW_StencilPass = Incr;
- CCW_StencilFunc = Always;
-
- StencilPass = Decr;
- StencilFunc = Always;
-
- ColorWriteEnable = 0;
-
- ZEnable = False;
- ZWriteEnable = False;
-
- VertexShader = compile vs_1_1 NoTxAliasedVS();
- PixelShader = compile ps_2_0 DirectSimplePS();
- }
-
- pass PASS_STENCIL_DRAW
- {
- TwoSidedStencilMode = False;
- StencilEnable = True;
- StencilFunc = NotEqual;
- StencilMask = 0xFFFFFFFF;
- StencilRef = 0;
- StencilPass = Zero;
- StencilFail = Zero;
- StencilZFail = Zero;
-
- ColorWriteEnable = 0x0f;
- ZEnable = True;
- ZWriteEnable = False;
- ZFunc = Greater;
-
- VertexShader = compile vs_1_1 AliasedVS();
- PixelShader = compile ps_2_0 SimplePS();
- }
-
- pass PASS_STENCIL_DRAW_DIRECT
- {
- TwoSidedStencilMode = False;
- StencilEnable = True;
- StencilFunc = NotEqual;
- StencilMask = 0xFFFFFFFF;
- StencilRef = 0;
- StencilPass = Zero;
- StencilFail = Zero;
- StencilZFail = Zero;
-
- ColorWriteEnable = 0x0f;
- ZEnable = True;
- ZWriteEnable = False;
- ZFunc = Greater;
-
- VertexShader = compile vs_1_1 AliasedVS();
- PixelShader = compile ps_2_0 DirectSimplePS();
- }
-
- pass PASS_STENCIL_CLIP
- {
- TwoSidedStencilMode = False;
- StencilEnable = True;
- StencilFunc = NotEqual;
- StencilMask = 0xFFFFFFFF;
- StencilRef = 0;
- StencilPass = Zero;
- StencilFail = Zero;
- StencilZFail = Zero;
-
- ColorWriteEnable = 0;
- ZEnable = True;
- ZWriteEnable = True;
- ZFunc = Always;
-
- VertexShader = compile vs_1_1 NoTxAliasedVS();
- PixelShader = compile ps_2_0 DirectSimplePS();
- }
-
- pass PASS_STENCIL_NOSTENCILCHECK
- {
- StencilEnable = False;
-
- ZEnable = True;
- ZWriteEnable = False;
- ZFunc = Greater;
-
- ColorWriteEnable = 0x0f;
-
- SrcBlend = SrcAlpha;
- DestBlend = InvSrcAlpha;
-
- VertexShader = compile vs_1_1 AliasedVS();
- PixelShader = compile ps_2_0 SimplePS();
- }
-
- pass PASS_STENCIL_NOSTENCILCHECK_DIRECT
- {
- StencilEnable = False;
-
- ZEnable = True;
- ZWriteEnable = False;
- ZFunc = Greater;
-
- ColorWriteEnable = 0x0f;
-
- SrcBlend = SrcAlpha;
- DestBlend = InvSrcAlpha;
-
- VertexShader = compile vs_1_1 AliasedVS();
- PixelShader = compile ps_2_0 DirectSimplePS();
- }
-
- pass PASS_TEXT
- {
- StencilEnable = False;
-
- ZEnable = True;
- ZWriteEnable = False;
- ZFunc = Greater;
-
- ColorWriteEnable = 0x0f;
-
- SrcBlend = SrcAlpha;
- DestBlend = InvSrcAlpha;
-
- VertexShader = compile vs_1_1 AliasedVS();
- PixelShader = compile ps_2_0 TextPS();
- }
-
- pass PASS_CLEARTYPE_TEXT
- {
- StencilEnable = False;
-
- ZEnable = True;
- ZWriteEnable = False;
- ZFunc = Greater;
-
- ColorWriteEnable = 0x0f;
-
-// SrcBlend = SrcAlpha;
-// DestBlend = InvSrcAlpha;
-
-// SrcBlend = DestColor;
-// DestBlend = Zero;
- SrcBlend = BlendFactor;
- DestBlend = InvSrcColor;
-
-// SrcBlend = Zero;
-// DestBlend = SrcColor;
-
-// SrcBlend = One;
-// DestBlend = Zero;
-
- VertexShader = compile vs_3_0 AliasedVS();
- PixelShader = compile ps_3_0 ClearTypePS();
- }
-
- pass PASS_ALIASED_LINES
- {
- TwoSidedStencilMode = False;
- StencilEnable = True;
- StencilPass = Invert;
- StencilFunc = Always;
- ColorWriteEnable = 0;
-
- ZEnable = False;
- ZWriteEnable = False;
-
- VertexShader = compile vs_1_1 AliasedLinesVS();
- PixelShader = compile ps_2_0 DirectSimplePS();
- }
-
- pass PASS_ALIASED_LINES_DIRECT
- {
- StencilEnable = False;
-
- ZEnable = True;
- ZWriteEnable = False;
- ZFunc = Greater;
-
- ColorWriteEnable = 0x0f;
-
- SrcBlend = SrcAlpha;
- DestBlend = InvSrcAlpha;
-
- VertexShader = compile vs_1_1 AliasedLinesVS();
- PixelShader = compile ps_2_0 DirectSimplePS();
- }
-}
-
diff --git a/src/gui/painting/qpaintengine_d3d.qrc b/src/gui/painting/qpaintengine_d3d.qrc
deleted file mode 100644
index c106f2b..0000000
--- a/src/gui/painting/qpaintengine_d3d.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
- <file>qpaintengine_d3d.fx</file>
-</qresource>
-</RCC>
diff --git a/src/gui/painting/qpaintengine_d3d_p.h b/src/gui/painting/qpaintengine_d3d_p.h
deleted file mode 100644
index 8fa5cf6..0000000
--- a/src/gui/painting/qpaintengine_d3d_p.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QPAINTENGINE_D3D_P_H
-#define QPAINTENGINE_D3D_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "QtGui/qpaintengine.h"
-#include <d3d9.h>
-
-QT_BEGIN_NAMESPACE
-
-class QDirect3DPaintEnginePrivate;
-class QDirect3DPaintEngine : public QPaintEngine
-{
- Q_DECLARE_PRIVATE(QDirect3DPaintEngine)
-public:
- QDirect3DPaintEngine();
- ~QDirect3DPaintEngine();
- bool begin(QPaintDevice *device);
-
- void drawEllipse(const QRectF &rect);
- void drawEllipse(const QRect &rect);
-
- void drawImage(const QRectF &rectangle, const QImage &image, const QRectF &sr,
- Qt::ImageConversionFlags flags = Qt::AutoColor);
-
- void drawLines(const QLineF *lines, int lineCount);
- void drawLines(const QLine *lines, int lineCount);
-
- void drawPath(const QPainterPath &path);
-
- void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
-
- void drawPoints(const QPointF *points, int pointCount);
- void drawPoints(const QPoint *points, int pointCount);
-
- void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode);
- void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode);
-
- void drawRects(const QRectF *rects, int rectCount);
- void drawRects(const QRect * rects, int rectCount);
-
- void drawTextItem(const QPointF &p, const QTextItem &textItem);
-
- void drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr);
-
- bool end();
-
- Type type() const { return Direct3D; }
- void updateState(const QPaintEngineState &state);
-
- void cleanup();
-
- HDC getDC() const;
- void setFlushOnEnd(bool flushOnEnd);
- bool hasDirect3DSupport();
-
-public:
- void scroll(QPaintDevice *pd, const RECT &srcrect, const RECT &destrect);
- LPDIRECT3DSWAPCHAIN9 swapChain(QPaintDevice *pd);
- void releaseSwapChain(QPaintDevice *pd);
-
-private:
- Q_DISABLE_COPY(QDirect3DPaintEngine)
- friend class QPixmap;
- friend class QD3DGlyphCache;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/gui/painting/qpaintengine_p.h b/src/gui/painting/qpaintengine_p.h
index eeba7ec..0b5e175 100644
--- a/src/gui/painting/qpaintengine_p.h
+++ b/src/gui/painting/qpaintengine_p.h
@@ -83,10 +83,12 @@ public:
if (systemClip.isEmpty())
return;
- if (systemTransform.type() <= QTransform::TxTranslate)
- systemClip.translate(qRound(systemTransform.dx()), qRound(systemTransform.dy()));
- else
- systemClip = systemTransform.map(systemClip);
+ if (hasSystemTransform) {
+ if (systemTransform.type() <= QTransform::TxTranslate)
+ systemClip.translate(qRound(systemTransform.dx()), qRound(systemTransform.dy()));
+ else
+ systemClip = systemTransform.map(systemClip);
+ }
// Make sure we're inside the viewport.
if (hasSystemViewport) {
@@ -101,7 +103,7 @@ public:
inline void setSystemTransform(const QTransform &xform)
{
systemTransform = xform;
- if ((hasSystemTransform = !xform.isIdentity()))
+ if ((hasSystemTransform = !xform.isIdentity()) || hasSystemViewport)
transformSystemClip();
systemStateChanged();
}
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index d2b1ed7..295abc5 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -4409,6 +4409,9 @@ void QClipData::fixup()
*/
void QClipData::setClipRect(const QRect &rect)
{
+ if (rect == clipRect)
+ return;
+
// qDebug() << "setClipRect" << clipSpanHeight << count << allocated << rect;
hasRectClip = true;
clipRect = rect;
@@ -4418,6 +4421,11 @@ void QClipData::setClipRect(const QRect &rect)
ymin = qMin(rect.y(), clipSpanHeight);
ymax = qMin(rect.y() + rect.height(), clipSpanHeight);
+ if (m_spans) {
+ delete m_spans;
+ m_spans = 0;
+ }
+
// qDebug() << xmin << xmax << ymin << ymax;
}
@@ -4441,6 +4449,12 @@ void QClipData::setClipRegion(const QRegion &region)
ymin = rect.y();
ymax = rect.y() + rect.height();
}
+
+ if (m_spans) {
+ delete m_spans;
+ m_spans = 0;
+ }
+
}
/*!
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index caed293..d9c7937 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -5167,6 +5167,9 @@ void QPainter::drawPixmap(const QPointF &p, const QPixmap &pm)
Q_D(QPainter);
+ if (!d->engine)
+ return;
+
#ifndef QT_NO_DEBUG
qt_painter_thread_test(d->device->devType(), "drawPixmap()");
#endif
@@ -5176,9 +5179,6 @@ void QPainter::drawPixmap(const QPointF &p, const QPixmap &pm)
return;
}
- if (!d->engine)
- return;
-
qreal x = p.x();
qreal y = p.y();
diff --git a/src/gui/painting/qprintengine_win.cpp b/src/gui/painting/qprintengine_win.cpp
index c8674b7..7601beb 100644
--- a/src/gui/painting/qprintengine_win.cpp
+++ b/src/gui/painting/qprintengine_win.cpp
@@ -1532,7 +1532,7 @@ QVariant QWin32PrintEngine::property(PrintEnginePropertyKey key) const
value = rect;
} else {
value = QTransform(1/d->stretch_x, 0, 0, 1/d->stretch_y, 0, 0)
- .mapRect(d->fullPage ? d->devPaperRect : d->devPageRect);
+ .mapRect(d->fullPage ? d->devPhysicalPageRect : d->devPageRect);
}
break;
diff --git a/src/gui/painting/qprinter.cpp b/src/gui/painting/qprinter.cpp
index 4f3e71c..5161e32 100644
--- a/src/gui/painting/qprinter.cpp
+++ b/src/gui/painting/qprinter.cpp
@@ -834,11 +834,15 @@ void QPrinter::setPrinterName(const QString &name)
#endif
QList<QPrinterInfo> prnList = QPrinterInfo::availablePrinters();
- d->validPrinter = false;
- for (int i = 0; i < prnList.size(); ++i) {
- if (prnList[i].printerName() == name) {
- d->validPrinter = true;
- break;
+ if (name.isEmpty()) {
+ d->validPrinter = d->outputFormat == QPrinter::PdfFormat || d->outputFormat == QPrinter::PostScriptFormat;
+ } else {
+ d->validPrinter = false;
+ for (int i = 0; i < prnList.size(); ++i) {
+ if (prnList[i].printerName() == name) {
+ d->validPrinter = true;
+ break;
+ }
}
}
diff --git a/src/gui/painting/qwindowsurface_d3d.cpp b/src/gui/painting/qwindowsurface_d3d.cpp
deleted file mode 100644
index 2b7f633..0000000
--- a/src/gui/painting/qwindowsurface_d3d.cpp
+++ /dev/null
@@ -1,169 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//#define D3D_DEBUG_BACKBUFFER
-
-#include <QtGui/QPaintDevice>
-#include <QtGui/QWidget>
-#include "qdebug.h"
-
-#include "qpaintengine_d3d_p.h"
-#include "qwindowsurface_d3d_p.h"
-#include "private/qwidget_p.h"
-#include "private/qbackingstore_p.h"
-
-#include <d3d9.h>
-
-QT_BEGIN_NAMESPACE
-
-extern QDirect3DPaintEngine *qt_d3dEngine();
-
-struct QD3DWindowSurfacePrivate
-{
- QSize m_lastSize;
- QWidget *m_widget;
-};
-
-QD3DWindowSurface::QD3DWindowSurface(QWidget *window)
- : QWindowSurface(window), d_ptr(new QD3DWindowSurfacePrivate)
-{
- Q_ASSERT(window->isTopLevel());
- d_ptr->m_widget = window;
-}
-
-
-QD3DWindowSurface::~QD3DWindowSurface()
-{
- delete d_ptr;
-}
-
-QPaintDevice *QD3DWindowSurface::paintDevice()
-{
- return d_ptr->m_widget;
-}
-
-
-void QD3DWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint &offset)
-{
- QPoint wOffset = qt_qwidget_data(widget)->wrect.topLeft();
-
- QDirect3DPaintEngine *engine = qt_d3dEngine();
- LPDIRECT3DSWAPCHAIN9 swapchain = engine->swapChain(d_ptr->m_widget);
-
- if (swapchain) {
- QRect br = rgn.boundingRect();
- QRect wbr = br.translated(-wOffset);
-
- RECT destrect;
- destrect.left = wbr.x();
- destrect.top = wbr.y();
- destrect.right = destrect.left + wbr.width();
- destrect.bottom = destrect.top + wbr.height();
-
- RECT srcrect;
- srcrect.left = br.x() + offset.x();
- srcrect.top = br.y() + offset.y();
- srcrect.right = wbr.width() + srcrect.left;
- srcrect.bottom = wbr.height() + srcrect.top;
- int devwidth = d_ptr->m_lastSize.width();
- int devheight = d_ptr->m_lastSize.height();
-
- if (devwidth <= srcrect.right) {
- int diff = srcrect.right - devwidth;
- srcrect.right -= diff;
- destrect.right -= diff;
- if (srcrect.right <= srcrect.left)
- return;
- }
- if (devheight <= srcrect.bottom) {
- int diff = srcrect.bottom - devheight;
- srcrect.bottom -= diff;
- destrect.bottom -= diff;
- if (srcrect.bottom <= srcrect.top)
- return;
- }
-
- if (FAILED(swapchain->Present(&srcrect, &destrect, widget->winId(), 0, 0)))
- qWarning("QDirect3DPaintEngine: failed to present back buffer.");
-
-#ifdef D3D_DEBUG_BACKBUFFER
- qDebug() << widget << srcrect.left << srcrect.top << wbr.width() << wbr.height() << "Dest: " << destrect.left << destrect.top;
- IDirect3DSurface9 *surface;
- swapchain->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &surface);
- QString filename("C:\\test.bmp");
- D3DXSaveSurfaceToFile(filename.utf16(), D3DXIFF_BMP, surface, 0, 0);
- surface->Release();
-#endif
- }
-}
-
-void QD3DWindowSurface::setGeometry(const QRect &rect)
-{
- if (rect.isEmpty())
- qt_d3dEngine()->releaseSwapChain(d_ptr->m_widget);
-
- d_ptr->m_lastSize = rect.size();
- QWindowSurface::setGeometry(rect);
-}
-
-
-bool QD3DWindowSurface::scroll(const QRegion &area, int dx, int dy)
-{
- QDirect3DPaintEngine *engine = qt_d3dEngine();
- QRect rect = area.boundingRect();
-
- RECT destrect;
- destrect.left = rect.x()+dx;
- destrect.top = rect.y()+dy;
- destrect.right = rect.width() + destrect.left;
- destrect.bottom = rect.height() + destrect.top;
-
- RECT srcrect;
- srcrect.left = rect.x();
- srcrect.top = rect.y();
- srcrect.right = rect.width() + srcrect.left;
- srcrect.bottom = rect.height() + srcrect.top;
-
- engine->scroll(d_ptr->m_widget, srcrect, destrect);
- return true;
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/styles/gtksymbols.cpp b/src/gui/styles/gtksymbols.cpp
index acb8437..0842ec7 100644
--- a/src/gui/styles/gtksymbols.cpp
+++ b/src/gui/styles/gtksymbols.cpp
@@ -746,9 +746,9 @@ static void setupGtkFileChooser(GtkWidget* gtkFileChooser, QWidget *parent,
foreach (const QString &rawfilter, filters) {
GtkFileFilter *gtkFilter = QGtk::gtk_file_filter_new ();
QString name = rawfilter.left(rawfilter.indexOf(QLatin1Char('(')));
- QGtk::gtk_file_filter_set_name(gtkFilter, qPrintable(name));
-
QStringList extensions = extract_filter(rawfilter);
+ QGtk::gtk_file_filter_set_name(gtkFilter, qPrintable(name.isEmpty() ? extensions.join(QLS(", ")) : name));
+
foreach (const QString &fileExtension, extensions) {
QGtk::gtk_file_filter_add_pattern (gtkFilter, qPrintable(fileExtension));
}
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp
index be80d37..f8ae1a6 100644
--- a/src/gui/styles/qcommonstyle.cpp
+++ b/src/gui/styles/qcommonstyle.cpp
@@ -2019,7 +2019,9 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
: QIcon::Disabled);
QPixmap tabIcon = tabV2.icon.pixmap(iconSize,
(tabV2.state & State_Enabled) ? QIcon::Normal
- : QIcon::Disabled);
+ : QIcon::Disabled,
+ (tabV2.state & State_Selected) ? QIcon::On
+ : QIcon::Off);
int offset = 6;
int left = opt->rect.left();
diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp
index b7fa575..ca71da2 100644
--- a/src/gui/styles/qgtkstyle.cpp
+++ b/src/gui/styles/qgtkstyle.cpp
@@ -951,14 +951,15 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element,
"interior-focus", &interior_focus,
"focus-line-width", &focus_line_width, NULL);
+ // See https://bugzilla.mozilla.org/show_bug.cgi?id=405421 for info about this hack
+ g_object_set_data(G_OBJECT(gtkEntry), "transparent-bg-hint", GINT_TO_POINTER(TRUE));
+
if (!interior_focus && option->state & State_HasFocus)
rect.adjust(focus_line_width, focus_line_width, -focus_line_width, -focus_line_width);
-
gtkPainter.paintShadow(gtkEntry, "entry", rect, option->state & State_Enabled ?
GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE,
GTK_SHADOW_IN, gtkEntry->style,
option->state & State_HasFocus ? QLS("focus") : QString());
-
if (!interior_focus && option->state & State_HasFocus)
gtkPainter.paintShadow(gtkEntry, "entry", option->rect, option->state & State_Enabled ?
GTK_STATE_ACTIVE : GTK_STATE_INSENSITIVE,
diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm
index 5d08c58..e32c5e2 100644
--- a/src/gui/styles/qmacstyle_mac.mm
+++ b/src/gui/styles/qmacstyle_mac.mm
@@ -2649,6 +2649,9 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
case PM_MenuHMargin:
ret = 0;
break;
+ case PM_ToolBarFrameWidth:
+ ret = 0;
+ break;
default:
ret = QWindowsStyle::pixelMetric(metric, opt, widget);
break;
@@ -3679,8 +3682,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
if (tb->toolButtonStyle != Qt::ToolButtonIconOnly) {
needText = true;
if (tb->toolButtonStyle == Qt::ToolButtonTextUnderIcon) {
- pr.setHeight(pixmap.size().height() + 6);
- cr.adjust(0, pr.bottom(), 0, -3);
+ pr.setHeight(pixmap.size().height());
+ cr.adjust(0, pr.bottom() + 1, 0, 1);
alignment |= Qt::AlignCenter;
} else {
pr.setWidth(pixmap.width() + 8);
@@ -3688,7 +3691,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
alignment |= Qt::AlignLeft | Qt::AlignVCenter;
}
}
- if (down) {
+ if (opt->state & State_Sunken) {
pr.translate(shiftX, shiftY);
pixmap = darkenPixmap(pixmap);
}
@@ -3718,7 +3721,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
}
drawItemText(p, cr, alignment, pal,
tb->state & State_Enabled, tb->text, role);
- if (QSysInfo::MacintoshVersion < QSysInfo::MV_10_5 && down) {
+ if (QSysInfo::MacintoshVersion < QSysInfo::MV_10_5 &&
+ (tb->state & State_Sunken)) {
// Draw a "drop shadow" in earlier versions.
drawItemText(p, cr.adjusted(0, 1, 0, 1), alignment,
tb->palette, tb->state & State_Enabled, tb->text);
@@ -4544,9 +4548,10 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
case CE_ToolBar: {
// For unified tool bars, draw nothing.
if (w) {
- if (QMainWindow * mainWindow = qobject_cast<QMainWindow *>(w->window()))
+ if (QMainWindow * mainWindow = qobject_cast<QMainWindow *>(w->window())) {
if (mainWindow->unifiedTitleAndToolBarOnMac())
break;
+ }
}
// draw background gradient
@@ -5270,6 +5275,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
if (const QStyleOptionToolButton *tb
= qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
if (widget && qobject_cast<QToolBar *>(widget->parentWidget())) {
+// p->fillRect(tb->rect, QColor(155, 0, 155, 155));
if (tb->subControls & SC_ToolButtonMenu) {
QStyleOption arrowOpt(0);
arrowOpt.rect = subControlRect(cc, tb, SC_ToolButtonMenu, widget);
@@ -5282,16 +5288,22 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
drawToolbarButtonArrow(tb->rect, tds, cg);
}
if (tb->state & State_On) {
- QPen oldPen = p->pen();
- p->setPen(QColor(0, 0, 0, 0x3a));
- p->fillRect(tb->rect.adjusted(1, 1, -1, -1), QColor(0, 0, 0, 0x12));
- p->drawLine(tb->rect.left() + 1, tb->rect.top(),
- tb->rect.right() - 1, tb->rect.top());
- p->drawLine(tb->rect.left() + 1, tb->rect.bottom(),
- tb->rect.right() - 1, tb->rect.bottom());
- p->drawLine(tb->rect.topLeft(), tb->rect.bottomLeft());
- p->drawLine(tb->rect.topRight(), tb->rect.bottomRight());
- p->setPen(oldPen);
+ if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) {
+ static QPixmap pm(QLatin1String(":/trolltech/mac/style/images/leopard-unified-toolbar-on.png"));
+ p->setRenderHint(QPainter::SmoothPixmapTransform);
+ QStyleHelper::drawBorderPixmap(pm, p, tb->rect, 2, 2, 2, 2);
+ } else {
+ QPen oldPen = p->pen();
+ p->setPen(QColor(0, 0, 0, 0x3a));
+ p->fillRect(tb->rect.adjusted(1, 1, -1, -1), QColor(0, 0, 0, 0x12));
+ p->drawLine(tb->rect.left() + 1, tb->rect.top(),
+ tb->rect.right() - 1, tb->rect.top());
+ p->drawLine(tb->rect.left() + 1, tb->rect.bottom(),
+ tb->rect.right() - 1, tb->rect.bottom());
+ p->drawLine(tb->rect.topLeft(), tb->rect.bottomLeft());
+ p->drawLine(tb->rect.topRight(), tb->rect.bottomRight());
+ p->setPen(oldPen);
+ }
}
drawControl(CE_ToolButtonLabel, opt, p, widget);
} else {
@@ -6009,6 +6021,14 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
}
break;
case CT_ToolButton:
+ if (widget && qobject_cast<const QToolBar *>(widget->parentWidget())) {
+ sz.rwidth() += 4;
+ if (sz.height() <= 32) {
+ // Workaround strange HIToolBar bug when getting constraints.
+ sz.rheight() += 1;
+ }
+ return sz;
+ }
sz.rwidth() += 10;
sz.rheight() += 10;
return sz;
diff --git a/src/gui/styles/qstylehelper.cpp b/src/gui/styles/qstylehelper.cpp
index 3320970..69f8cd2 100644
--- a/src/gui/styles/qstylehelper.cpp
+++ b/src/gui/styles/qstylehelper.cpp
@@ -50,9 +50,10 @@
QT_BEGIN_NAMESPACE
-const bool QStyleHelper::UsePixmapCache = true;
+namespace QStyleHelper {
+const bool UsePixmapCache = true;
-QString QStyleHelper::uniqueName(const QString &key, const QStyleOption *option, const QSize &size)
+QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size)
{
QString tmp;
const QStyleOptionComplex *complexOption = qstyleoption_cast<const QStyleOptionComplex *>(option);
@@ -74,7 +75,7 @@ QString QStyleHelper::uniqueName(const QString &key, const QStyleOption *option,
#ifndef QT_NO_DIAL
-int QStyleHelper::calcBigLineSize(int radius)
+int calcBigLineSize(int radius)
{
int bigLineSize = radius / 6;
if (bigLineSize < 4)
@@ -107,7 +108,7 @@ static QPointF calcRadialPos(const QStyleOptionSlider *dial, qreal offset)
return pos;
}
-qreal QStyleHelper::angle(const QPointF &p1, const QPointF &p2)
+qreal angle(const QPointF &p1, const QPointF &p2)
{
static const qreal rad_factor = 180 / Q_PI;
qreal _angle = 0;
@@ -139,7 +140,7 @@ qreal QStyleHelper::angle(const QPointF &p1, const QPointF &p2)
return _angle;
}
-QPolygonF QStyleHelper::calcLines(const QStyleOptionSlider *dial)
+QPolygonF calcLines(const QStyleOptionSlider *dial)
{
QPolygonF poly;
int width = dial->rect.width();
@@ -182,7 +183,7 @@ QPolygonF QStyleHelper::calcLines(const QStyleOptionSlider *dial)
// This will draw a nice and shiny QDial for us. We don't want
// all the shinyness in QWindowsStyle, hence we place it here
-void QStyleHelper::drawDial(const QStyleOptionSlider *option, QPainter *painter)
+void drawDial(const QStyleOptionSlider *option, QPainter *painter)
{
QPalette pal = option->palette;
QColor buttonColor = pal.button().color();
@@ -292,4 +293,61 @@ void QStyleHelper::drawDial(const QStyleOptionSlider *option, QPainter *painter)
}
#endif //QT_NO_DIAL
+void drawBorderPixmap(const QPixmap &pixmap, QPainter *painter, const QRect &rect,
+ int left, int top, int right,
+ int bottom)
+{
+ QSize size = pixmap.size();
+ //painter->setRenderHint(QPainter::SmoothPixmapTransform);
+
+ //top
+ if (top > 0) {
+ painter->drawPixmap(QRect(rect.left() + left, rect.top(), rect.width() -right - left, top), pixmap,
+ QRect(left, 0, size.width() -right - left, top));
+
+ //top-left
+ if(left > 0)
+ painter->drawPixmap(QRect(rect.left(), rect.top(), left, top), pixmap,
+ QRect(0, 0, left, top));
+
+ //top-right
+ if (right > 0)
+ painter->drawPixmap(QRect(rect.left() + rect.width() - right, rect.top(), right, top), pixmap,
+ QRect(size.width() - right, 0, right, top));
+ }
+
+ //left
+ if (left > 0)
+ painter->drawPixmap(QRect(rect.left(), rect.top()+top, left, rect.height() - top - bottom), pixmap,
+ QRect(0, top, left, size.height() - bottom - top));
+
+ //center
+ painter->drawPixmap(QRect(rect.left() + left, rect.top()+top, rect.width() -right - left,
+ rect.height() - bottom - top), pixmap,
+ QRect(left, top, size.width() -right -left,
+ size.height() - bottom - top));
+ //right
+ if (right > 0)
+ painter->drawPixmap(QRect(rect.left() +rect.width() - right, rect.top()+top, right, rect.height() - top - bottom), pixmap,
+ QRect(size.width() - right, top, right, size.height() - bottom - top));
+
+ //bottom
+ if (bottom > 0) {
+ painter->drawPixmap(QRect(rect.left() +left, rect.top() + rect.height() - bottom,
+ rect.width() - right - left, bottom), pixmap,
+ QRect(left, size.height() - bottom,
+ size.width() - right - left, bottom));
+ //bottom-left
+ if (left > 0)
+ painter->drawPixmap(QRect(rect.left(), rect.top() + rect.height() - bottom, left, bottom), pixmap,
+ QRect(0, size.height() - bottom, left, bottom));
+
+ //bottom-right
+ if (right > 0)
+ painter->drawPixmap(QRect(rect.left() + rect.width() - right, rect.top() + rect.height() - bottom, right, bottom), pixmap,
+ QRect(size.width() - right, size.height() - bottom, right, bottom));
+
+ }
+}
+}
QT_END_NAMESPACE
diff --git a/src/gui/styles/qstylehelper_p.h b/src/gui/styles/qstylehelper_p.h
index d9b2e28..711bd2d 100644
--- a/src/gui/styles/qstylehelper_p.h
+++ b/src/gui/styles/qstylehelper_p.h
@@ -19,6 +19,7 @@
QT_BEGIN_NAMESPACE
class QPainter;
+class QPixmap;
class QStyleOptionSlider;
class QStyleOption;
@@ -32,6 +33,9 @@ namespace QStyleHelper
int calcBigLineSize(int radius);
void drawDial(const QStyleOptionSlider *dial, QPainter *painter);
#endif //QT_NO_DIAL
+ void drawBorderPixmap(const QPixmap &pixmap, QPainter *painter, const QRect &rect,
+ int left = 0, int top = 0, int right = 0,
+ int bottom = 0);
}
QT_END_NAMESPACE
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp
index 49ac57a..f480008 100644
--- a/src/gui/styles/qstylesheetstyle.cpp
+++ b/src/gui/styles/qstylesheetstyle.cpp
@@ -2876,12 +2876,6 @@ void QStyleSheetStyle::polish(QWidget *w)
QRenderRule rule = renderRule(w, PseudoElement_None, PseudoClass_Any);
if (rule.hasDrawable() || rule.hasBox()) {
if (w->metaObject() == &QWidget::staticMetaObject
-#ifndef QT_NO_MENUBAR
- || qobject_cast<QMenuBar *>(w)
-#endif
-#ifndef QT_NO_MENU
- || qobject_cast<QMenu *>(w)
-#endif
#ifndef QT_NO_ITEMVIEWS
|| qobject_cast<QHeaderView *>(w)
#endif
@@ -4164,9 +4158,8 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
rule.configurePalette(&frmOpt.palette, QPalette::Text, QPalette::Base);
frmOpt.rect = rule.borderRect(frmOpt.rect);
baseStyle()->drawControl(ce, &frmOpt, p, w);
- } else {
- rule.drawBorder(p, rule.borderRect(opt->rect));
}
+ // else, borders are already drawn in PE_Widget
}
return;
@@ -4220,12 +4213,6 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
QRect rect = opt->rect;
switch (pe) {
- case PE_PanelStatusBar:
- if (rule.hasDrawable()) {
- rule.drawRule(p, opt->rect);
- return;
- }
- break;
case PE_FrameStatusBar: {
QRenderRule subRule = renderRule(w->parentWidget(), opt, PseudoElement_Item);
@@ -4337,36 +4324,34 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
return;
case PE_Widget:
- if (!rule.hasBackground()) {
+ if (!rule.hasDrawable()) {
QWidget *container = containerWidget(w);
if (autoFillDisabledWidgets->contains(container)
- && (container == w || !renderRule(container, opt).hasBackground())) {
+ && (container == w || !renderRule(container, opt).hasDrawable())) {
//we do not have a background, but we disabled the autofillbackground anyway. so fill the background now.
// (this may happen if we have rules like :focus)
p->fillRect(opt->rect, opt->palette.brush(w->backgroundRole()));
}
break;
}
-
#ifndef QT_NO_SCROLLAREA
if (const QAbstractScrollArea *sa = qobject_cast<const QAbstractScrollArea *>(w)) {
const QAbstractScrollAreaPrivate *sap = sa->d_func();
rule.drawBackground(p, opt->rect, sap->contentsOffset());
- } else
-#endif
- {
- rule.drawBackground(p, opt->rect);
+ if (rule.hasBorder())
+ rule.drawBorder(p, rule.borderRect(opt->rect));
+ break;
}
-
- return;
-
- case PE_FrameMenu:
+#endif
+ //fall tghought
+ case PE_PanelMenu:
case PE_PanelMenuBar:
- if (!rule.hasNativeBorder()) {
- rule.drawBorder(p, rule.borderRect(opt->rect));
+ case PE_PanelStatusBar:
+ if(rule.hasDrawable()) {
+ rule.drawRule(p, opt->rect);
return;
}
- break;
+ break;
case PE_IndicatorToolBarSeparator:
case PE_IndicatorToolBarHandle: {
@@ -5887,13 +5872,11 @@ void QStyleSheetStyle::clearWidgetFont(QWidget* w) const
w->setProperty("_q_styleSheetWidgetFont", QVariant(QVariant::Invalid));
}
-// Returns the palette that should be used when the particular widget is focused.
-// This needs to be called by some widgets that do drawing themselves instead
-// of through the style.
-// ### This should be removed ideally by Qt 4.5, and at least by Qt 5, and fixed
-// for good by letting the style draw everything.
+// Polish palette that should be used for a particular widget, with particular states
+// (eg. :focus, :hover, ...)
+// this is called by widgets that paint themself in their paint event
// Returns true if there is a new palette in pal.
-bool QStyleSheetStyle::focusPalette(const QWidget* w, const QStyleOption* opt, QPalette* pal)
+bool QStyleSheetStyle::styleSheetPalette(const QWidget* w, const QStyleOption* opt, QPalette* pal)
{
if (!w || !opt || !pal)
return false;
diff --git a/src/gui/styles/qstylesheetstyle_p.h b/src/gui/styles/qstylesheetstyle_p.h
index 1f61445..e057274 100644
--- a/src/gui/styles/qstylesheetstyle_p.h
+++ b/src/gui/styles/qstylesheetstyle_p.h
@@ -131,7 +131,7 @@ public:
void saveWidgetFont(QWidget* w, const QFont& font) const;
void clearWidgetFont(QWidget* w) const;
- bool focusPalette(const QWidget* w, const QStyleOption* opt, QPalette* pal);
+ bool styleSheetPalette(const QWidget* w, const QStyleOption* opt, QPalette* pal);
protected Q_SLOTS:
QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *opt = 0,
diff --git a/src/gui/widgets/qlabel.cpp b/src/gui/widgets/qlabel.cpp
index 63c1315..016b7c1 100644
--- a/src/gui/widgets/qlabel.cpp
+++ b/src/gui/widgets/qlabel.cpp
@@ -971,6 +971,13 @@ void QLabel::paintEvent(QPaintEvent *)
#endif
if (d->isTextLabel) {
QRectF lr = d->layoutRect();
+ QStyleOption opt;
+ opt.initFrom(this);
+#ifndef QT_NO_STYLE_STYLESHEET
+ if (QStyleSheetStyle* cssStyle = qobject_cast<QStyleSheetStyle*>(style)) {
+ cssStyle->styleSheetPalette(this, &opt, &opt.palette);
+ }
+#endif
if (d->control) {
#ifndef QT_NO_SHORTCUT
const bool underline = (bool)style->styleHint(QStyle::SH_UnderlineShortcut, 0, this, 0);
@@ -984,11 +991,9 @@ void QLabel::paintEvent(QPaintEvent *)
d->ensureTextLayouted();
QAbstractTextDocumentLayout::PaintContext context;
- QStyleOption opt(0);
- opt.init(this);
if (!isEnabled() && style->styleHint(QStyle::SH_EtchDisabledText, &opt, this)) {
- context.palette = palette();
+ context.palette = opt.palette;
context.palette.setColor(QPalette::Text, context.palette.light().color());
painter.save();
painter.translate(lr.x() + 1, lr.y() + 1);
@@ -999,12 +1004,7 @@ void QLabel::paintEvent(QPaintEvent *)
}
// Adjust the palette
- context.palette = palette();
-#ifndef QT_NO_STYLE_STYLESHEET
- if (QStyleSheetStyle* cssStyle = qobject_cast<QStyleSheetStyle*>(style)) {
- cssStyle->focusPalette(this, &opt, &context.palette);
- }
-#endif
+ context.palette = opt.palette;
if (foregroundRole() != QPalette::Text && isEnabled())
context.palette.setColor(QPalette::Text, context.palette.color(foregroundRole()));
@@ -1019,12 +1019,10 @@ void QLabel::paintEvent(QPaintEvent *)
int flags = align;
if (d->hasShortcut) {
flags |= Qt::TextShowMnemonic;
- QStyleOption opt;
- opt.initFrom(this);
if (!style->styleHint(QStyle::SH_UnderlineShortcut, &opt, this))
flags |= Qt::TextHideMnemonic;
}
- style->drawItemText(&painter, lr.toRect(), flags, palette(), isEnabled(), d->text, foregroundRole());
+ style->drawItemText(&painter, lr.toRect(), flags, opt.palette, isEnabled(), d->text, foregroundRole());
}
} else
#ifndef QT_NO_PICTURE
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp
index e243ad0..d16ed10 100644
--- a/src/gui/widgets/qlineedit.cpp
+++ b/src/gui/widgets/qlineedit.cpp
@@ -2518,7 +2518,7 @@ void QLineEdit::paintEvent(QPaintEvent *)
// draw text, selections and cursors
#ifndef QT_NO_STYLE_STYLESHEET
if (QStyleSheetStyle* cssStyle = qobject_cast<QStyleSheetStyle*>(style())) {
- cssStyle->focusPalette(this, &panel, &pal);
+ cssStyle->styleSheetPalette(this, &panel, &pal);
}
#endif
p.setPen(pal.text().color());
diff --git a/src/gui/widgets/qmainwindowlayout_mac.mm b/src/gui/widgets/qmainwindowlayout_mac.mm
index c807afb..53e1ad5 100644
--- a/src/gui/widgets/qmainwindowlayout_mac.mm
+++ b/src/gui/widgets/qmainwindowlayout_mac.mm
@@ -502,11 +502,11 @@ void QMainWindowLayout::fixSizeInUnifiedToolbar(QToolBar *tb) const
QMacCocoaAutoReleasePool pool;
QWidgetItem layoutItem(tb);
QSize size = layoutItem.maximumSize();
- NSSize nssize = NSMakeSize(size.width(), size.height());
+ NSSize nssize = NSMakeSize(size.width(), size.height() - 2);
[item setMaxSize:nssize];
size = layoutItem.minimumSize();
nssize.width = size.width();
- nssize.height = size.height();
+ nssize.height = size.height() - 2;
[item setMinSize:nssize];
}
}
diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp
index b562b1f..49de8c1 100644
--- a/src/gui/widgets/qtabbar.cpp
+++ b/src/gui/widgets/qtabbar.cpp
@@ -1941,8 +1941,10 @@ void QTabBar::changeEvent(QEvent *event)
if (event->type() == QEvent::StyleChange) {
d->elideMode = Qt::TextElideMode(style()->styleHint(QStyle::SH_TabBar_ElideMode, 0, this));
d->useScrollButtons = !style()->styleHint(QStyle::SH_TabBar_PreferNoArrows, 0, this);
+ d->refresh();
+ } else if (event->type() == QEvent::FontChange) {
+ d->refresh();
}
- d->refresh();
QWidget::changeEvent(event);
}
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index 980c0e0..5940fba 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -265,6 +265,11 @@ bool QHttpNetworkConnectionPrivate::ensureConnection(QAbstractSocket *socket)
if (socket->state() != QAbstractSocket::ConnectedState) {
// connect to the host if not already connected.
int index = indexOf(socket);
+ // resend this request after we receive the disconnected signal
+ if (socket->state() == QAbstractSocket::ClosingState) {
+ channels[index].resendCurrent = true;
+ return false;
+ }
channels[index].state = ConnectingState;
channels[index].pendingEncrypt = encrypt;
@@ -982,6 +987,9 @@ void QHttpNetworkConnectionPrivate::_q_disconnected()
channels[i].state = ReadingState;
if (channels[i].reply)
receiveReply(socket, channels[i].reply);
+ } else if (channels[i].state == IdleState && channels[i].resendCurrent) {
+ // re-sending request because the socket was in ClosingState
+ QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection);
}
channels[i].state = IdleState;
}
diff --git a/src/network/socket/qlocalserver_unix.cpp b/src/network/socket/qlocalserver_unix.cpp
index 065a9de..e7d2252 100644
--- a/src/network/socket/qlocalserver_unix.cpp
+++ b/src/network/socket/qlocalserver_unix.cpp
@@ -148,9 +148,11 @@ void QLocalServerPrivate::closeServer()
QT_CLOSE(listenSocket);
listenSocket = -1;
- if (socketNotifier)
+ if (socketNotifier) {
+ socketNotifier->setEnabled(false); // Otherwise, closed socket is checked before deleter runs
socketNotifier->deleteLater();
- socketNotifier = 0;
+ socketNotifier = 0;
+ }
if (!fullServerName.isEmpty())
QFile::remove(fullServerName);
diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp
index e759d0b..39c9284 100644
--- a/src/network/socket/qlocalsocket_win.cpp
+++ b/src/network/socket/qlocalsocket_win.cpp
@@ -298,7 +298,7 @@ qint64 QLocalSocketPrivate::bytesAvailable()
if (PeekNamedPipe(handle, NULL, 0, NULL, &bytes, NULL)) {
return bytes;
} else {
- if (ERROR_BROKEN_PIPE == GetLastError() && !pipeClosed) {
+ if (!pipeClosed) {
pipeClosed = true;
QTimer::singleShot(0, q, SLOT(_q_pipeClosed()));
}
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index b8fa133..18d9125 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -2452,6 +2452,10 @@ bool QGLContext::create(const QGLContext* shareContext)
return false;
reset();
d->valid = chooseContext(shareContext);
+ if (d->valid && d->paintDevice->devType() == QInternal::Widget) {
+ QWidgetPrivate *wd = qt_widget_private(static_cast<QWidget *>(d->paintDevice));
+ wd->usesDoubleBufferedGLContext = d->glFormat.doubleBuffer();
+ }
if (d->sharing) // ok, we managed to share
qgl_share_reg()->addShare(this, shareContext);
return d->valid;
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp
index 837ccf2..b41adf9 100644
--- a/src/opengl/qwindowsurface_gl.cpp
+++ b/src/opengl/qwindowsurface_gl.cpp
@@ -86,7 +86,7 @@ QT_BEGIN_NAMESPACE
// QGLGraphicsSystem
//
#ifdef Q_WS_WIN
-Q_GUI_EXPORT bool qt_win_owndc_required;
+extern Q_GUI_EXPORT bool qt_win_owndc_required;
#endif
QGLGraphicsSystem::QGLGraphicsSystem()
: QGraphicsSystem()
diff --git a/src/plugins/gfxdrivers/directfb/directfb.pro b/src/plugins/gfxdrivers/directfb/directfb.pro
index 89a289c..1ee9030 100644
--- a/src/plugins/gfxdrivers/directfb/directfb.pro
+++ b/src/plugins/gfxdrivers/directfb/directfb.pro
@@ -3,7 +3,7 @@ include(../../qpluginbase.pri)
QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/gfxdrivers
-# These defines might be necessary if your DirectFB driver doesn't
+# These defines might be necessary if your DirectFB driver doesn't
# support all of the DirectFB API.
#
#DEFINES += QT_NO_DIRECTFB_WM
@@ -14,6 +14,8 @@ QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/gfxdrivers
#DEFINES += QT_NO_DIRECTFB_KEYBOARD
#DEFINES += QT_DIRECTFB_TIMING
#DEFINES += QT_NO_DIRECTFB_OPAQUE_DETECTION
+#DEFINES += QT_DIRECTFB_WARN_ON_RASTERFALLBACKS
+#DEFINES += QT_DIRECTFB_DISABLE_RASTERFALLBACKS
target.path = $$[QT_INSTALL_PLUGINS]/gfxdrivers
INSTALLS += target
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp
index cd19f69..368b9f9 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp
@@ -173,6 +173,22 @@ void QDirectFBKeyboardHandlerPrivate::readKeyboardData()
Qt::KeyboardModifiers modifiers = Qt::NoModifier;
+ // Not implemented:
+ // if (input.modifiers & DIMM_SUPER)
+ // if (input.modifiers & DIMM_HYPER)
+
+ if (!(input.flags & DIEF_KEYSYMBOL) ||
+ !(input.flags & DIEF_KEYID) ||
+ !(input.type & (DIET_KEYPRESS|DIET_KEYRELEASE)))
+ {
+ static bool first = true;
+ if (first) {
+ qWarning("QDirectFBKeyboardHandler - Getting unexpected non-keyboard related events");
+ first = false;
+ }
+ break;
+ }
+
if (input.flags & DIEF_MODIFIERS) {
if (input.modifiers & DIMM_SHIFT)
modifiers |= Qt::ShiftModifier;
@@ -185,31 +201,15 @@ void QDirectFBKeyboardHandlerPrivate::readKeyboardData()
if (input.modifiers & DIMM_META)
modifiers |= Qt::MetaModifier;
}
- // Not implemented:
- // if (input.modifiers & DIMM_SUPER)
- // if (input.modifiers & DIMM_HYPER)
- if ( !(input.flags & DIEF_KEYSYMBOL) ||
- !(input.flags & DIEF_KEYID) ||
- !(input.type & (DIET_KEYPRESS | DIET_KEYRELEASE)) )
- {
- static int warningCount = 0;
- if (!warningCount) {
- qWarning("QDirectFBKeyboardHandler - Getting unexpected non-keyboard related events");
- warningCount = 100;
- }
- else
- warningCount--;
- break;
- }
- bool press = input.type & DIET_KEYPRESS;
+ const bool press = input.type & DIET_KEYPRESS;
DFBInputDeviceKeySymbol symbol = input.key_symbol;
int unicode = -1;
int keycode = 0;
keycode = keymap()->value(symbol);
- if (keycode == 0 && DFB_KEY_TYPE(symbol) == DIKT_UNICODE)
+ if (DFB_KEY_TYPE(symbol) == DIKT_UNICODE)
unicode = symbol;
if (unicode != -1 || keycode != 0) {
@@ -314,6 +314,100 @@ KeyMap::KeyMap()
insert(DIKS_DEAD_SEMIVOICED_SOUND , Qt::Key_Dead_Semivoiced_Sound);
insert(DIKS_DEAD_TILDE , Qt::Key_Dead_Tilde);
insert(DIKS_DEAD_VOICED_SOUND , Qt::Key_Dead_Voiced_Sound);
+ insert(DIKS_SPACE , Qt::Key_Space);
+ insert(DIKS_EXCLAMATION_MARK , Qt::Key_Exclam);
+ insert(DIKS_QUOTATION , Qt::Key_QuoteDbl);
+ insert(DIKS_NUMBER_SIGN , Qt::Key_NumberSign);
+ insert(DIKS_DOLLAR_SIGN , Qt::Key_Dollar);
+ insert(DIKS_PERCENT_SIGN , Qt::Key_Percent);
+ insert(DIKS_AMPERSAND , Qt::Key_Ampersand);
+ insert(DIKS_APOSTROPHE , Qt::Key_Apostrophe);
+ insert(DIKS_PARENTHESIS_LEFT , Qt::Key_ParenLeft);
+ insert(DIKS_PARENTHESIS_RIGHT , Qt::Key_ParenRight);
+ insert(DIKS_ASTERISK , Qt::Key_Asterisk);
+ insert(DIKS_PLUS_SIGN , Qt::Key_Plus);
+ insert(DIKS_COMMA , Qt::Key_Comma);
+ insert(DIKS_MINUS_SIGN , Qt::Key_Minus);
+ insert(DIKS_PERIOD , Qt::Key_Period);
+ insert(DIKS_SLASH , Qt::Key_Slash);
+ insert(DIKS_0 , Qt::Key_0);
+ insert(DIKS_1 , Qt::Key_1);
+ insert(DIKS_2 , Qt::Key_2);
+ insert(DIKS_3 , Qt::Key_3);
+ insert(DIKS_4 , Qt::Key_4);
+ insert(DIKS_5 , Qt::Key_5);
+ insert(DIKS_6 , Qt::Key_6);
+ insert(DIKS_7 , Qt::Key_7);
+ insert(DIKS_8 , Qt::Key_8);
+ insert(DIKS_9 , Qt::Key_9);
+ insert(DIKS_COLON , Qt::Key_Colon);
+ insert(DIKS_SEMICOLON , Qt::Key_Semicolon);
+ insert(DIKS_LESS_THAN_SIGN , Qt::Key_Less);
+ insert(DIKS_EQUALS_SIGN , Qt::Key_Equal);
+ insert(DIKS_GREATER_THAN_SIGN , Qt::Key_Greater);
+ insert(DIKS_QUESTION_MARK , Qt::Key_Question);
+ insert(DIKS_AT , Qt::Key_At);
+ insert(DIKS_CAPITAL_A , Qt::Key_A);
+ insert(DIKS_CAPITAL_B , Qt::Key_B);
+ insert(DIKS_CAPITAL_C , Qt::Key_C);
+ insert(DIKS_CAPITAL_D , Qt::Key_D);
+ insert(DIKS_CAPITAL_E , Qt::Key_E);
+ insert(DIKS_CAPITAL_F , Qt::Key_F);
+ insert(DIKS_CAPITAL_G , Qt::Key_G);
+ insert(DIKS_CAPITAL_H , Qt::Key_H);
+ insert(DIKS_CAPITAL_I , Qt::Key_I);
+ insert(DIKS_CAPITAL_J , Qt::Key_J);
+ insert(DIKS_CAPITAL_K , Qt::Key_K);
+ insert(DIKS_CAPITAL_L , Qt::Key_L);
+ insert(DIKS_CAPITAL_M , Qt::Key_M);
+ insert(DIKS_CAPITAL_N , Qt::Key_N);
+ insert(DIKS_CAPITAL_O , Qt::Key_O);
+ insert(DIKS_CAPITAL_P , Qt::Key_P);
+ insert(DIKS_CAPITAL_Q , Qt::Key_Q);
+ insert(DIKS_CAPITAL_R , Qt::Key_R);
+ insert(DIKS_CAPITAL_S , Qt::Key_S);
+ insert(DIKS_CAPITAL_T , Qt::Key_T);
+ insert(DIKS_CAPITAL_U , Qt::Key_U);
+ insert(DIKS_CAPITAL_V , Qt::Key_V);
+ insert(DIKS_CAPITAL_W , Qt::Key_W);
+ insert(DIKS_CAPITAL_X , Qt::Key_X);
+ insert(DIKS_CAPITAL_Y , Qt::Key_Y);
+ insert(DIKS_CAPITAL_Z , Qt::Key_Z);
+ insert(DIKS_SQUARE_BRACKET_LEFT , Qt::Key_BracketLeft);
+ insert(DIKS_BACKSLASH , Qt::Key_Backslash);
+ insert(DIKS_SQUARE_BRACKET_RIGHT , Qt::Key_BracketRight);
+ insert(DIKS_CIRCUMFLEX_ACCENT , Qt::Key_AsciiCircum);
+ insert(DIKS_UNDERSCORE , Qt::Key_Underscore);
+ insert(DIKS_SMALL_A , Qt::Key_A);
+ insert(DIKS_SMALL_B , Qt::Key_B);
+ insert(DIKS_SMALL_C , Qt::Key_C);
+ insert(DIKS_SMALL_D , Qt::Key_D);
+ insert(DIKS_SMALL_E , Qt::Key_E);
+ insert(DIKS_SMALL_F , Qt::Key_F);
+ insert(DIKS_SMALL_G , Qt::Key_G);
+ insert(DIKS_SMALL_H , Qt::Key_H);
+ insert(DIKS_SMALL_I , Qt::Key_I);
+ insert(DIKS_SMALL_J , Qt::Key_J);
+ insert(DIKS_SMALL_K , Qt::Key_K);
+ insert(DIKS_SMALL_L , Qt::Key_L);
+ insert(DIKS_SMALL_M , Qt::Key_M);
+ insert(DIKS_SMALL_N , Qt::Key_N);
+ insert(DIKS_SMALL_O , Qt::Key_O);
+ insert(DIKS_SMALL_P , Qt::Key_P);
+ insert(DIKS_SMALL_Q , Qt::Key_Q);
+ insert(DIKS_SMALL_R , Qt::Key_R);
+ insert(DIKS_SMALL_S , Qt::Key_S);
+ insert(DIKS_SMALL_T , Qt::Key_T);
+ insert(DIKS_SMALL_U , Qt::Key_U);
+ insert(DIKS_SMALL_V , Qt::Key_V);
+ insert(DIKS_SMALL_W , Qt::Key_W);
+ insert(DIKS_SMALL_X , Qt::Key_X);
+ insert(DIKS_SMALL_Y , Qt::Key_Y);
+ insert(DIKS_SMALL_Z , Qt::Key_Z);
+ insert(DIKS_CURLY_BRACKET_LEFT , Qt::Key_BraceLeft);
+ insert(DIKS_VERTICAL_BAR , Qt::Key_Bar);
+ insert(DIKS_CURLY_BRACKET_RIGHT , Qt::Key_BraceRight);
+ insert(DIKS_TILDE , Qt::Key_AsciiTilde);
}
#include "qdirectfbkeyboard.moc"
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp
index 2a2ef5c..924090c 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp
@@ -56,23 +56,16 @@ IDirectFBSurface *QDirectFBPaintDevice::directFBSurface() const
}
-// Locks the dfb surface and creates a QImage (lockedImage) from the pointer
-void QDirectFBPaintDevice::lockDirectFB() {
-
+void QDirectFBPaintDevice::lockDirectFB()
+{
if (lockedImage)
return; // Already locked
- void *mem;
- int w, h;
- DFBResult result = dfbSurface->Lock(dfbSurface, DSLF_WRITE, &mem, &bpl);
- if (result != DFB_OK || !mem) {
- DirectFBError("QDirectFBPixmapData::buffer()", result);
- return;
+ if (uchar *mem = QDirectFBScreen::lockSurface(dfbSurface, DSLF_WRITE, &bpl)) {
+ const QSize s = size();
+ lockedImage = new QImage(mem, s.width(), s.height(), bpl,
+ QDirectFBScreen::getImageFormat(dfbSurface));
}
-
- dfbSurface->GetSize(dfbSurface, &w, &h);
- lockedImage = new QImage(static_cast<uchar*>(mem), w, h, bpl,
- QDirectFBScreen::getImageFormat(dfbSurface));
}
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
index d9346fd..ba5d71a 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
@@ -54,6 +54,70 @@
#include <private/qpixmapdata_p.h>
#include <private/qpixmap_raster_p.h>
+#ifdef QT_DIRECTFB_WARN_ON_RASTERFALLBACKS
+template <typename T> inline const T *ptr(const T &t) { return &t; }
+template <> inline const bool* ptr<bool>(const bool &) { return 0; }
+template <typename device, typename T1, typename T2, typename T3>
+static void rasterFallbackWarn(const char *msg, const char *func, const device *dev,
+ bool matrixScale, bool matrixRotShear, bool simplePen,
+ bool dfbHandledClip, bool forceRasterPrimitives,
+ const char *nameOne, const T1 &one,
+ const char *nameTwo, const T2 &two,
+ const char *nameThree, const T3 &three)
+{
+ QString out;
+ QDebug dbg(&out);
+ dbg << msg << (QByteArray(func) + "()") << "painting on";
+ if (dev->devType() == QInternal::Widget) {
+ dbg << static_cast<const QWidget*>(dev);
+ } else {
+ dbg << dev << "of type" << dev->devType();
+ }
+
+ dbg << "matrixScale" << matrixScale
+ << "matrixRotShear" << matrixRotShear
+ << "simplePen" << simplePen
+ << "dfbHandledClip" << dfbHandledClip
+ << "forceRasterPrimitives" << forceRasterPrimitives;
+
+ const T1 *t1 = ptr(one);
+ const T2 *t2 = ptr(two);
+ const T3 *t3 = ptr(three);
+
+ if (t1) {
+ dbg << nameOne << *t1;
+ if (t2) {
+ dbg << nameTwo << *t2;
+ if (t3) {
+ dbg << nameThree << *t3;
+ }
+ }
+ }
+ qWarning("%s", qPrintable(out));
+}
+#endif
+
+#if defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS && defined QT_DIRECTFB_DISABLE_RASTERFALLBACKS
+#define RASTERFALLBACK(one, two, three) rasterFallbackWarn("Disabled raster engine operation", \
+ __FUNCTION__, state()->painter->device(), \
+ d_func()->matrixScale, d_func()->matrixRotShear, \
+ d_func()->simplePen, d_func()->dfbCanHandleClip(), \
+ d_func()->forceRasterPrimitives, \
+ #one, one, #two, two, #three, three); \
+ return;
+#elif defined QT_DIRECTFB_DISABLE_RASTERFALLBACKS
+#define RASTERFALLBACK(one, two, three) return;
+#elif defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS
+#define RASTERFALLBACK(one, two, three) rasterFallbackWarn("Falling back to raster engine for", \
+ __FUNCTION__, state()->painter->device(), \
+ d_func()->matrixScale, d_func()->matrixRotShear, \
+ d_func()->simplePen, d_func()->dfbCanHandleClip(), \
+ d_func()->forceRasterPrimitives, \
+ #one, one, #two, two, #three, three);
+#else
+#define RASTERFALLBACK(one, two, three)
+#endif
+
static inline uint ALPHA_MUL(uint x, uint a)
{
uint t = x * a;
@@ -181,20 +245,17 @@ public:
IDirectFBSurface *surface;
QPen pen;
- QBrush brush;
bool antialiased;
bool forceRasterPrimitives;
bool simplePen;
- bool simpleBrush;
bool matrixRotShear;
bool matrixScale;
void setTransform(const QTransform &m);
void setPen(const QPen &pen);
- void setBrush(const QBrush &brush);
void setCompositionMode(QPainter::CompositionMode mode);
void setOpacity(quint8 value);
void setRenderHints(QPainter::RenderHints hints);
@@ -207,6 +268,7 @@ public:
inline bool dfbCanHandleClip(const QRect &rect) const;
inline bool dfbCanHandleClip(const QRectF &rect) const;
inline bool dfbCanHandleClip() const;
+ inline bool isSimpleBrush(const QBrush &brush) const;
void drawLines(const QLine *lines, int count) const;
void drawLines(const QLineF *lines, int count) const;
@@ -217,6 +279,7 @@ public:
void fillRects(const QRectF *rects, int count) const;
void drawRects(const QRectF *rects, int count) const;
+
void drawPixmap(const QRectF &dest,
const QPixmap &pixmap, const QRectF &src);
void drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap);
@@ -253,7 +316,7 @@ private:
QDirectFBPaintEnginePrivate::QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p)
: surface(0), antialiased(false), forceRasterPrimitives(false), simplePen(false),
- simpleBrush(false), matrixRotShear(false), matrixScale(false), lastLockedHeight(-1),
+ matrixRotShear(false), matrixScale(false), lastLockedHeight(-1),
fbWidth(-1), fbHeight(-1), opacity(255), drawFlagsFromCompositionMode(0),
blitFlagsFromCompositionMode(0), porterDuffRule(DSPD_SRC_OVER), dirtyClip(true),
dfbHandledClip(false), dfbDevice(0), q(p)
@@ -287,6 +350,11 @@ bool QDirectFBPaintEnginePrivate::dfbCanHandleClip() const
return dfbHandledClip;
}
+bool QDirectFBPaintEnginePrivate::isSimpleBrush(const QBrush &brush) const
+{
+ return (brush.style() == Qt::NoBrush) || (brush.style() == Qt::SolidPattern && !antialiased);
+}
+
void QDirectFBPaintEnginePrivate::setClipDirty()
{
dirtyClip = true;
@@ -366,13 +434,6 @@ void QDirectFBPaintEnginePrivate::setPen(const QPen &p)
&& (pen.widthF() <= 1 && !matrixScale));
}
-void QDirectFBPaintEnginePrivate::setBrush(const QBrush &b)
-{
- brush = b;
- simpleBrush = (brush.style() == Qt::NoBrush) ||
- (brush.style() == Qt::SolidPattern && !antialiased);
-}
-
void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode mode)
{
blitFlagsFromCompositionMode = DSBLIT_NOFX;
@@ -755,14 +816,6 @@ void QDirectFBPaintEngine::penChanged()
QRasterPaintEngine::penChanged();
}
-void QDirectFBPaintEngine::brushChanged()
-{
- Q_D(QDirectFBPaintEngine);
- d->setBrush(state()->brush);
-
- QRasterPaintEngine::brushChanged();
-}
-
void QDirectFBPaintEngine::opacityChanged()
{
Q_D(QDirectFBPaintEngine);
@@ -801,7 +854,6 @@ void QDirectFBPaintEngine::setState(QPainterState *s)
QRasterPaintEngine::setState(s);
d->setClipDirty();
d->setPen(state()->pen);
- d->setBrush(state()->brush);
d->setOpacity(quint8(state()->opacity * 255));
d->setCompositionMode(state()->compositionMode());
d->setTransform(state()->transform());
@@ -834,8 +886,11 @@ void QDirectFBPaintEngine::drawRects(const QRect *rects, int rectCount)
{
Q_D(QDirectFBPaintEngine);
d->updateClip();
- if (!d->dfbCanHandleClip() || d->matrixRotShear || !d->simpleBrush
- || !d->simplePen || d->forceRasterPrimitives) {
+ const QBrush &brush = state()->brush;
+ if (!d->dfbCanHandleClip() || d->matrixRotShear
+ || !d->simplePen || d->forceRasterPrimitives
+ || !d->isSimpleBrush(brush)) {
+ RASTERFALLBACK(rectCount, static_cast<bool>(false), static_cast<bool>(false));
d->lock();
QRasterPaintEngine::drawRects(rects, rectCount);
return;
@@ -843,8 +898,8 @@ void QDirectFBPaintEngine::drawRects(const QRect *rects, int rectCount)
d->unlock();
- if (d->brush != Qt::NoBrush) {
- d->setDFBColor(d->brush.color());
+ if (brush != Qt::NoBrush) {
+ d->setDFBColor(brush.color());
d->fillRects(rects, rectCount);
}
if (d->pen != Qt::NoPen) {
@@ -857,8 +912,10 @@ void QDirectFBPaintEngine::drawRects(const QRectF *rects, int rectCount)
{
Q_D(QDirectFBPaintEngine);
d->updateClip();
- if (!d->dfbCanHandleClip() || d->matrixRotShear || !d->simpleBrush
- || !d->simplePen || d->forceRasterPrimitives) {
+ const QBrush &brush = state()->brush;
+ if (!d->dfbCanHandleClip() || d->matrixRotShear
+ || !d->simplePen || d->forceRasterPrimitives
+ || !d->isSimpleBrush(brush)) {
d->lock();
QRasterPaintEngine::drawRects(rects, rectCount);
return;
@@ -866,8 +923,8 @@ void QDirectFBPaintEngine::drawRects(const QRectF *rects, int rectCount)
d->unlock();
- if (d->brush != Qt::NoBrush) {
- d->setDFBColor(d->brush.color());
+ if (brush != Qt::NoBrush) {
+ d->setDFBColor(brush.color());
d->fillRects(rects, rectCount);
}
if (d->pen != Qt::NoPen) {
@@ -881,6 +938,7 @@ void QDirectFBPaintEngine::drawLines(const QLine *lines, int lineCount)
Q_D(QDirectFBPaintEngine);
d->updateClip();
if (!d->simplePen || !d->dfbCanHandleClip() || d->forceRasterPrimitives) {
+ RASTERFALLBACK(lineCount, static_cast<bool>(false), static_cast<bool>(false));
d->lock();
QRasterPaintEngine::drawLines(lines, lineCount);
return;
@@ -898,6 +956,7 @@ void QDirectFBPaintEngine::drawLines(const QLineF *lines, int lineCount)
Q_D(QDirectFBPaintEngine);
d->updateClip();
if (!d->simplePen || !d->dfbCanHandleClip() || d->forceRasterPrimitives) {
+ RASTERFALLBACK(lineCount, static_cast<bool>(false), static_cast<bool>(false));
d->lock();
QRasterPaintEngine::drawLines(lines, lineCount);
return;
@@ -923,6 +982,7 @@ void QDirectFBPaintEngine::drawImage(const QRectF &r, const QImage &image,
|| QDirectFBScreen::getSurfacePixelFormat(image.format()) == DSPF_UNKNOWN)
#endif
{
+ RASTERFALLBACK(r, image.size(), sr);
d->lock();
QRasterPaintEngine::drawImage(r, image, sr, flags);
return;
@@ -946,9 +1006,11 @@ void QDirectFBPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap,
d->updateClip();
if (pixmap.pixmapData()->classId() != QPixmapData::DirectFBClass) {
+ // not using RASTERFALLBACK since this is the way we do bitmaps?
d->lock();
QRasterPaintEngine::drawPixmap(r, pixmap, sr);
} else if (!d->dfbCanHandleClip(r) || d->matrixRotShear) {
+ RASTERFALLBACK(r, pixmap.size(), sr);
const QImage *img = static_cast<QDirectFBPixmapData*>(pixmap.pixmapData())->buffer();
d->lock();
QRasterPaintEngine::drawImage(r, *img, sr);
@@ -973,6 +1035,7 @@ void QDirectFBPaintEngine::drawTiledPixmap(const QRectF &r,
d->lock();
QRasterPaintEngine::drawTiledPixmap(r, pixmap, sp);
} else if (!d->dfbCanHandleClip(r) || d->matrixRotShear || !sp.isNull()) {
+ RASTERFALLBACK(r, pixmap.size(), sp);
const QImage *img = static_cast<QDirectFBPixmapData*>(pixmap.pixmapData())->buffer();
d->lock();
QRasterPixmapData *data = new QRasterPixmapData(QPixmapData::PixmapType);
@@ -995,6 +1058,7 @@ void QDirectFBPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
void QDirectFBPaintEngine::drawPath(const QPainterPath &path)
{
+ RASTERFALLBACK(path.boundingRect(), static_cast<bool>(false), static_cast<bool>(false));
Q_D(QDirectFBPaintEngine);
d->lock();
QRasterPaintEngine::drawPath(path);
@@ -1002,6 +1066,7 @@ void QDirectFBPaintEngine::drawPath(const QPainterPath &path)
void QDirectFBPaintEngine::drawPoints(const QPointF *points, int pointCount)
{
+ RASTERFALLBACK(pointCount, static_cast<bool>(false), static_cast<bool>(false));
Q_D(QDirectFBPaintEngine);
d->lock();
QRasterPaintEngine::drawPoints(points, pointCount);
@@ -1009,6 +1074,7 @@ void QDirectFBPaintEngine::drawPoints(const QPointF *points, int pointCount)
void QDirectFBPaintEngine::drawPoints(const QPoint *points, int pointCount)
{
+ RASTERFALLBACK(pointCount, static_cast<bool>(false), static_cast<bool>(false));
Q_D(QDirectFBPaintEngine);
d->lock();
QRasterPaintEngine::drawPoints(points, pointCount);
@@ -1016,6 +1082,7 @@ void QDirectFBPaintEngine::drawPoints(const QPoint *points, int pointCount)
void QDirectFBPaintEngine::drawEllipse(const QRectF &rect)
{
+ RASTERFALLBACK(rect, static_cast<bool>(false), static_cast<bool>(false));
Q_D(QDirectFBPaintEngine);
d->lock();
QRasterPaintEngine::drawEllipse(rect);
@@ -1024,6 +1091,7 @@ void QDirectFBPaintEngine::drawEllipse(const QRectF &rect)
void QDirectFBPaintEngine::drawPolygon(const QPointF *points, int pointCount,
PolygonDrawMode mode)
{
+ RASTERFALLBACK(pointCount, mode, static_cast<bool>(false));
Q_D(QDirectFBPaintEngine);
d->lock();
QRasterPaintEngine::drawPolygon(points, pointCount, mode);
@@ -1032,6 +1100,7 @@ void QDirectFBPaintEngine::drawPolygon(const QPointF *points, int pointCount,
void QDirectFBPaintEngine::drawPolygon(const QPoint *points, int pointCount,
PolygonDrawMode mode)
{
+ RASTERFALLBACK(pointCount, mode, static_cast<bool>(false));
Q_D(QDirectFBPaintEngine);
d->lock();
QRasterPaintEngine::drawPolygon(points, pointCount, mode);
@@ -1040,6 +1109,7 @@ void QDirectFBPaintEngine::drawPolygon(const QPoint *points, int pointCount,
void QDirectFBPaintEngine::drawTextItem(const QPointF &p,
const QTextItem &textItem)
{
+ RASTERFALLBACK(p, textItem.text(), static_cast<bool>(false));
Q_D(QDirectFBPaintEngine);
d->lock();
QRasterPaintEngine::drawTextItem(p, textItem);
@@ -1047,6 +1117,7 @@ void QDirectFBPaintEngine::drawTextItem(const QPointF &p,
void QDirectFBPaintEngine::fill(const QVectorPath &path, const QBrush &brush)
{
+ RASTERFALLBACK(path, brush, static_cast<bool>(false));
Q_D(QDirectFBPaintEngine);
d->lock();
QRasterPaintEngine::fill(path, brush);
@@ -1080,6 +1151,7 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
break;
}
}
+ RASTERFALLBACK(rect, brush, static_cast<bool>(false));
d->lock();
QRasterPaintEngine::fillRect(rect, brush);
}
@@ -1089,6 +1161,7 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QColor &color)
Q_D(QDirectFBPaintEngine);
d->updateClip();
if (!d->dfbCanHandleClip() || d->matrixRotShear || d->forceRasterPrimitives) {
+ RASTERFALLBACK(rect, color, static_cast<bool>(false));
d->lock();
QRasterPaintEngine::fillRect(rect, color);
} else {
@@ -1105,6 +1178,7 @@ void QDirectFBPaintEngine::drawColorSpans(const QSpan *spans, int count,
{
Q_D(QDirectFBPaintEngine);
if (d->forceRasterPrimitives) {
+ RASTERFALLBACK(count, color, static_cast<bool>(false));
d->lock();
QRasterPaintEngine::drawColorSpans(spans, count, color);
} else {
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h
index 3c2cefa..e79ec61 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h
@@ -96,7 +96,6 @@ public:
virtual void clipEnabledChanged();
virtual void penChanged();
- virtual void brushChanged();
virtual void opacityChanged();
virtual void compositionModeChanged();
virtual void renderHintsChanged();
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
index 0a1696a..ea9bb3a 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
@@ -157,10 +157,13 @@ static bool checkForAlphaPixels(const QImage &img)
return false;
}
-void QDirectFBPixmapData::fromImage(const QImage &img,
+void QDirectFBPixmapData::fromImage(const QImage &i,
Qt::ImageConversionFlags flags)
{
- Q_ASSERT(img.depth() != 1); // these should be handled by QRasterPixmapData
+#ifdef QT_NO_DIRECTFB_OPAQUE_DETECTION
+ Q_UNUSED(flags);
+#endif
+ const QImage img = (i.depth() == 1 ? i.convertToFormat(screen->alphaPixmapFormat()) : i);
if (img.hasAlphaChannel()
#ifndef QT_NO_DIRECTFB_OPAQUE_DETECTION
&& (flags & Qt::NoOpaqueDetection || ::checkForAlphaPixels(img))
@@ -267,16 +270,17 @@ void QDirectFBPixmapData::fill(const QColor &color)
if (forceRaster) {
// in DSPF_RGB32 all dfb drawing causes the Alpha byte to be
// set to 0. This causes issues for the raster engine.
- char *mem;
- int bpl;
- const int h = QPixmapData::height();
- dfbSurface->Lock(dfbSurface, DSLF_WRITE, (void**)&mem, &bpl);
- const int c = color.rgba();
- for (int i = 0; i < h; ++i) {
- memset(mem, c, bpl);
- mem += bpl;
+ uchar *mem = QDirectFBScreen::lockSurface(dfbSurface, DSLF_WRITE, &bpl);
+ if (mem) {
+ const int h = QPixmapData::height();
+ const int w = QPixmapData::width() * 4; // 4 bytes per 32 bit pixel
+ const int c = color.rgba();
+ for (int i = 0; i < h; ++i) {
+ memset(mem, c, w);
+ mem += bpl;
+ }
+ dfbSurface->Unlock(dfbSurface);
}
- dfbSurface->Unlock(dfbSurface);
} else {
dfbSurface->Clear(dfbSurface, color.red(), color.green(), color.blue(),
color.alpha());
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index 041d522..3e54e7f 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -159,15 +159,17 @@ IDirectFBSurface* QDirectFBScreen::createDFBSurface(const QImage &img, SurfaceCr
IDirectFBSurface *surface = createDFBSurface(&desc, options);
#ifdef QT_NO_DIRECTFB_PREALLOCATED
if (surface) {
- char *mem;
int bpl;
- surface->Lock(surface, DSLF_WRITE, (void**)&mem, &bpl);
- const int h = img.height();
- for (int i = 0; i < h; ++i) {
- memcpy(mem, img.scanLine(i), bpl);
- mem += bpl;
+ uchar *mem = QDirectFBScreen::lockSurface(surface, DSLF_WRITE, &bpl);
+ if (mem) {
+ const int h = img.height();
+ const int w = img.width() * img.depth() / 8;
+ for (int i = 0; i < h; ++i) {
+ memcpy(mem, img.scanLine(i), w);
+ mem += bpl;
+ }
+ surface->Unlock(surface);
}
- surface->Unlock(surface);
}
#endif
#ifndef QT_NO_DIRECTFB_PALETTE
@@ -317,15 +319,17 @@ IDirectFBSurface *QDirectFBScreen::copyToDFBSurface(const QImage &img,
imgSurface->Release(imgSurface);
#else // QT_NO_DIRECTFB_PREALLOCATED
Q_ASSERT(image.format() == pixmapFormat);
- char *mem;
int bpl;
- dfbSurface->Lock(dfbSurface, DSLF_WRITE, (void**)&mem, &bpl);
- const int w = image.width() * image.depth() / 8;
- for (int i = 0; i < image.height(); ++i) {
- memcpy(mem, image.scanLine(i), w);
- mem += bpl;
+ uchar *mem = QDirectFBScreen::lockSurface(dfbSurface, DSLF_WRITE, &bpl);
+ if (mem) {
+ const int h = image.height();
+ const int w = image.width() * image.depth() / 8;
+ for (int i=0; i<h; ++i) {
+ memcpy(mem, image.scanLine(i), w);
+ mem += bpl;
+ }
+ dfbSurface->Unlock(dfbSurface);
}
- dfbSurface->Unlock(dfbSurface);
#endif
return dfbSurface;
}
@@ -833,15 +837,15 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
description.flags = DFBSurfaceDescriptionFlags(description.flags | DSDESC_WIDTH);
if (::setIntOption(displayArgs, QLatin1String("height"), &description.height))
description.flags = DFBSurfaceDescriptionFlags(description.flags | DSDESC_HEIGHT);
- description.caps = DFBSurfaceCapabilities(DSCAPS_PRIMARY
- | DSCAPS_DOUBLE
- | DSCAPS_STATIC_ALLOC);
- if (displayArgs.contains(QLatin1String("forcepremultiplied"),
- Qt::CaseInsensitive)) {
- description.caps = DFBSurfaceCapabilities(description.caps
- | DSCAPS_PREMULTIPLIED);
+ uint caps = DSCAPS_PRIMARY|DSCAPS_DOUBLE;
+ if (displayArgs.contains(QLatin1String("static_alloc")))
+ caps |= DSCAPS_STATIC_ALLOC;
+
+ if (displayArgs.contains(QLatin1String("forcepremultiplied"), Qt::CaseInsensitive)) {
+ caps |= DSCAPS_PREMULTIPLIED;
}
+ description.caps = DFBSurfaceCapabilities(caps);
// We don't track the primary surface as it's released in disconnect
d_ptr->dfbSurface = createDFBSurface(&description, DontTrackSurface);
if (!d_ptr->dfbSurface) {
@@ -952,16 +956,15 @@ void QDirectFBScreen::disconnect()
bool QDirectFBScreen::initDevice()
{
- QWSServer *server = QWSServer::instance();
#ifndef QT_NO_DIRECTFB_MOUSE
if (qgetenv("QWS_MOUSE_PROTO").isEmpty()) {
- server->setDefaultMouse("None");
+ QWSServer::instance()->setDefaultMouse("None");
d_ptr->mouse = new QDirectFBMouseHandler;
}
#endif
#ifndef QT_NO_DIRECTFB_KEYBOARD
if (qgetenv("QWS_KEYBOARD").isEmpty()) {
- server->setDefaultKeyboard("None");
+ QWSServer::instance()->setDefaultKeyboard("None");
d_ptr->keyboard = new QDirectFBKeyboardHandler(QString());
}
#endif
@@ -1188,23 +1191,23 @@ void QDirectFBScreen::blit(IDirectFBSurface *src, const QPoint &topLeft,
points.data(), n);
}
+// This function is only ever called by QScreen::drawBackground which
+// is only ever called by QScreen::compose which is never called with
+// DirectFB so it's really a noop.
void QDirectFBScreen::solidFill(const QColor &color, const QRegion &region)
{
if (region.isEmpty())
return;
if (QDirectFBScreen::getImageFormat(d_ptr->dfbSurface) == QImage::Format_RGB32) {
- uchar *mem;
- int bpl;
- d_ptr->dfbSurface->Lock(d_ptr->dfbSurface, DSLF_WRITE, (void**)&mem, &bpl);
- QImage img(mem, w, h, bpl, QImage::Format_RGB32);
- QPainter p(&img);
- p.setBrush(color);
- p.setPen(Qt::NoPen);
- const QVector<QRect> rects = region.rects();
- p.drawRects(rects.constData(), rects.size());
- p.end();
+ data = QDirectFBScreen::lockSurface(d_ptr->dfbSurface, DSLF_WRITE, &lstep);
+ if (!data)
+ return;
+
+ QScreen::solidFill(color, region);
d_ptr->dfbSurface->Unlock(d_ptr->dfbSurface);
+ data = 0;
+ lstep = 0;
} else {
d_ptr->dfbSurface->SetColor(d_ptr->dfbSurface,
color.red(), color.green(), color.blue(),
@@ -1241,3 +1244,15 @@ bool QDirectFBScreen::initSurfaceDescriptionPixelFormat(DFBSurfaceDescription *d
}
return true;
}
+
+uchar *QDirectFBScreen::lockSurface(IDirectFBSurface *surface, DFBSurfaceLockFlags flags, int *bpl)
+{
+ void *mem;
+ const DFBResult result = surface->Lock(surface, flags, static_cast<void**>(&mem), bpl);
+ if (result != DFB_OK) {
+ DirectFBError("QDirectFBPixmapData::lockSurface()", result);
+ }
+
+ return reinterpret_cast<uchar*>(mem);
+}
+
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
index f394ac1..8dd38dc 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
@@ -127,6 +127,8 @@ public:
const QImage &image);
#endif
+ static uchar *lockSurface(IDirectFBSurface *surface, DFBSurfaceLockFlags flags, int *bpl = 0);
+
private:
void compose(const QRegion &r);
void blit(IDirectFBSurface *src, const QPoint &topLeft,
diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c
index 5c37253..4771d14 100644
--- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c
+++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c
@@ -72,7 +72,7 @@ static int pvrQwsInitFbScreen(int screen)
/* Bail out if already initialized, or the number is incorrect */
if (screen < 0 || screen >= PVRQWS_MAX_SCREENS)
return 0;
- if (pvrQwsDisplay.screens[screen].mapped)
+ if (pvrQwsDisplay.screens[screen].initialized)
return 1;
/* Open the framebuffer and fetch its properties */
@@ -125,26 +125,33 @@ static int pvrQwsInitFbScreen(int screen)
start = fix.smem_start;
length = var.xres_virtual * var.yres_virtual * bytesPerPixel;
- /* Map the framebuffer region into memory */
- mapped = mmap(0, length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
- if (!mapped || mapped == (void *)(-1)) {
- perror("mmap");
- close(fd);
- return 0;
- }
-
- /* Allocate a PVR2D memory region for the framebuffer */
- memInfo = 0;
- if (pvrQwsDisplay.context) {
- pageAddresses[0] = start & 0xFFFFF000;
- pageAddresses[1] = 0;
- if (PVR2DMemWrap
- (pvrQwsDisplay.context, mapped, PVR2D_WRAPFLAG_CONTIGUOUS,
- length, pageAddresses, &memInfo) != PVR2D_OK) {
- munmap(mapped, length);
+ if (screen == 0) {
+ /* We use PVR2DGetFrameBuffer to map the first screen.
+ On some chipsets it is more reliable than using PVR2DMemWrap */
+ mapped = 0;
+ memInfo = 0;
+ } else {
+ /* Other screens: map the framebuffer region into memory */
+ mapped = mmap(0, length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ if (!mapped || mapped == (void *)(-1)) {
+ perror("mmap");
close(fd);
return 0;
}
+
+ /* Allocate a PVR2D memory region for the framebuffer */
+ memInfo = 0;
+ if (pvrQwsDisplay.context) {
+ pageAddresses[0] = start & 0xFFFFF000;
+ pageAddresses[1] = 0;
+ if (PVR2DMemWrap
+ (pvrQwsDisplay.context, mapped, PVR2D_WRAPFLAG_CONTIGUOUS,
+ length, pageAddresses, &memInfo) != PVR2D_OK) {
+ munmap(mapped, length);
+ close(fd);
+ return 0;
+ }
+ }
}
/* We don't need the file descriptor any more */
@@ -158,11 +165,17 @@ static int pvrQwsInitFbScreen(int screen)
pvrQwsDisplay.screens[screen].screenStride = stride;
pvrQwsDisplay.screens[screen].pixelFormat = format;
pvrQwsDisplay.screens[screen].bytesPerPixel = bytesPerPixel;
- pvrQwsDisplay.screens[screen].frameBuffer = memInfo;
pvrQwsDisplay.screens[screen].screenDrawable = 0;
- pvrQwsDisplay.screens[screen].mapped = mapped;
+ if (mapped) {
+ /* Don't set these fields if mapped is 0, because PVR2DGetFrameBuffer
+ may have already been called and set them */
+ pvrQwsDisplay.screens[screen].frameBuffer = memInfo;
+ pvrQwsDisplay.screens[screen].mapped = mapped;
+ }
pvrQwsDisplay.screens[screen].mappedLength = length;
pvrQwsDisplay.screens[screen].screenStart = start;
+ pvrQwsDisplay.screens[screen].needsUnmap = (mapped != 0);
+ pvrQwsDisplay.screens[screen].initialized = 1;
return 1;
}
@@ -209,7 +222,7 @@ static int pvrQwsAddDrawable(void)
/* Create the PVR2DMEMINFO blocks for the active framebuffers */
for (screen = 0; screen < PVRQWS_MAX_SCREENS; ++screen) {
- if (pvrQwsDisplay.screens[screen].mapped) {
+ if (screen != 0 && pvrQwsDisplay.screens[screen].mapped) {
pageAddresses[0]
= pvrQwsDisplay.screens[screen].screenStart & 0xFFFFF000;
pageAddresses[1] = 0;
@@ -224,6 +237,17 @@ static int pvrQwsAddDrawable(void)
return 0;
}
pvrQwsDisplay.screens[screen].frameBuffer = memInfo;
+ } else if (screen == 0) {
+ if (PVR2DGetFrameBuffer
+ (pvrQwsDisplay.context,
+ PVR2D_FB_PRIMARY_SURFACE, &memInfo) != PVR2D_OK) {
+ fprintf(stderr, "QWSWSEGL: could not get the primary framebuffer surface\n");
+ PVR2DDestroyDeviceContext(pvrQwsDisplay.context);
+ pvrQwsDisplay.context = 0;
+ return 0;
+ }
+ pvrQwsDisplay.screens[screen].frameBuffer = memInfo;
+ pvrQwsDisplay.screens[screen].mapped = memInfo->pBase;
}
}
@@ -330,7 +354,7 @@ void pvrQwsDisplayClose(void)
pvrQwsDestroyDrawableForced(info->screenDrawable);
if (info->frameBuffer)
PVR2DMemFree(pvrQwsDisplay.context, info->frameBuffer);
- if (info->mapped)
+ if (info->mapped && info->needsUnmap)
munmap(info->mapped, info->mappedLength);
}
diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h
index d6c42a6..4f3ea90 100644
--- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h
+++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h
@@ -76,6 +76,8 @@ typedef struct {
void *mapped;
int mappedLength;
unsigned long screenStart;
+ int needsUnmap;
+ int initialized;
} PvrQwsScreenInfo;
diff --git a/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp b/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp
index 7fdf81f..c7249d3 100644
--- a/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp
+++ b/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp
@@ -121,7 +121,7 @@ QSize QSvgIconEngine::actualSize(const QSize &size, QIcon::Mode mode,
if (!pm.isNull() && pm.size() == size)
return size;
}
-
+
QSvgRenderer renderer;
d->loadDataForModeAndState(&renderer, mode, state);
if (renderer.isValid()) {
@@ -158,9 +158,13 @@ void QSvgIconEnginePrivate::loadDataForModeAndState(QSvgRenderer *renderer, QIco
QPixmap QSvgIconEngine::pixmap(const QSize &size, QIcon::Mode mode,
QIcon::State state)
-{
+{
QPixmap pm;
+ QString pmckey(d->pmcKey(size, mode, state));
+ if (QPixmapCache::find(pmckey, pm))
+ return pm;
+
if (d->addedPixmaps) {
pm = d->addedPixmaps->value(d->hashKey(mode, state));
if (!pm.isNull() && pm.size() == size)
@@ -176,10 +180,6 @@ QPixmap QSvgIconEngine::pixmap(const QSize &size, QIcon::Mode mode,
if (!actualSize.isNull())
actualSize.scale(size, Qt::KeepAspectRatio);
- QString pmckey(d->pmcKey(actualSize, mode, state));
- if (QPixmapCache::find(pmckey, pm))
- return pm;
-
QImage img(actualSize, QImage::Format_ARGB32_Premultiplied);
img.fill(0x00000000);
QPainter p(&img);
diff --git a/src/plugins/imageformats/ico/qicohandler.cpp b/src/plugins/imageformats/ico/qicohandler.cpp
index aa53370..da5ae15 100644
--- a/src/plugins/imageformats/ico/qicohandler.cpp
+++ b/src/plugins/imageformats/ico/qicohandler.cpp
@@ -80,7 +80,7 @@ typedef struct
typedef struct { // BMP information header
quint32 biSize; // size of this struct
quint32 biWidth; // pixmap width
- quint32 biHeight; // pixmap height
+ quint32 biHeight; // pixmap height (specifies the combined height of the XOR and AND masks)
quint16 biPlanes; // should be 1
quint16 biBitCount; // number of bits per pixel
quint32 biCompression; // compression method
@@ -108,7 +108,7 @@ private:
bool readHeader();
bool readIconEntry(int index, ICONDIRENTRY * iconEntry);
- bool readBMPHeader(ICONDIRENTRY & iconEntry, BMP_INFOHDR * header);
+ bool readBMPHeader(quint32 imageOffset, BMP_INFOHDR * header);
void findColorInfo(QImage & image);
void readColorTable(QImage & image);
@@ -343,7 +343,7 @@ bool ICOReader::readHeader()
return headerRead;
}
-bool ICOReader::readIconEntry(int index, ICONDIRENTRY * iconEntry)
+bool ICOReader::readIconEntry(int index, ICONDIRENTRY *iconEntry)
{
if (iod) {
if (iod->seek(startpos + ICONDIR_SIZE + (index * ICONDIRENTRY_SIZE))) {
@@ -355,37 +355,12 @@ bool ICOReader::readIconEntry(int index, ICONDIRENTRY * iconEntry)
-bool ICOReader::readBMPHeader(ICONDIRENTRY & iconEntry, BMP_INFOHDR * header)
+bool ICOReader::readBMPHeader(quint32 imageOffset, BMP_INFOHDR * header)
{
- memset(&icoAttrib, 0, sizeof(IcoAttrib));
if (iod) {
- if (iod->seek(startpos + iconEntry.dwImageOffset)) {
+ if (iod->seek(startpos + imageOffset)) {
if (readBMPInfoHeader(iod, header)) {
-
- icoAttrib.nbits = header->biBitCount ? header->biBitCount : iconEntry.wBitCount;
- icoAttrib.h = header->biHeight / 2; // this height is always double the iconEntry height (for the mask)
- icoAttrib.w = header->biWidth;
-
- switch (icoAttrib.nbits) {
- case 32:
- case 24:
- case 16:
- icoAttrib.depth = 32;
- break;
- case 8:
- case 4:
- icoAttrib.depth = 8;
- break;
- default:
- icoAttrib.depth = 1;
- }
-
- if ( icoAttrib.depth == 32 ) // there's no colormap
- icoAttrib.ncolors = 0;
- else // # colors used
- icoAttrib.ncolors = header->biClrUsed ? header->biClrUsed : 1 << icoAttrib.nbits;
- //qDebug() << "Bits:" << icoAttrib.nbits << "Depth:" << icoAttrib.depth << "Ncols:" << icoAttrib.ncolors;
- return TRUE;
+ return TRUE;
}
}
}
@@ -548,7 +523,28 @@ QImage ICOReader::iconAt(int index)
if (readIconEntry(index, &iconEntry)) {
BMP_INFOHDR header;
- if (readBMPHeader(iconEntry, &header)) {
+ if (readBMPHeader(iconEntry.dwImageOffset, &header)) {
+ icoAttrib.nbits = header.biBitCount ? header.biBitCount : iconEntry.wBitCount;
+
+ switch (icoAttrib.nbits) {
+ case 32:
+ case 24:
+ case 16:
+ icoAttrib.depth = 32;
+ break;
+ case 8:
+ case 4:
+ icoAttrib.depth = 8;
+ break;
+ default:
+ icoAttrib.depth = 1;
+ }
+ if (icoAttrib.depth == 32) // there's no colormap
+ icoAttrib.ncolors = 0;
+ else // # colors used
+ icoAttrib.ncolors = header.biClrUsed ? header.biClrUsed : 1 << icoAttrib.nbits;
+ icoAttrib.w = iconEntry.bWidth;
+ icoAttrib.h = iconEntry.bHeight;
QImage::Format format = QImage::Format_ARGB32;
if (icoAttrib.nbits == 24)
diff --git a/src/plugins/qpluginbase.pri b/src/plugins/qpluginbase.pri
index 446efab..ae39021 100644
--- a/src/plugins/qpluginbase.pri
+++ b/src/plugins/qpluginbase.pri
@@ -1,6 +1,6 @@
TEMPLATE = lib
isEmpty(QT_MAJOR_VERSION) {
- VERSION=4.5.1
+ VERSION=4.5.2
} else {
VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION}
}
diff --git a/src/svg/qsvgstyle.cpp b/src/svg/qsvgstyle.cpp
index b065395..bd0804c 100644
--- a/src/svg/qsvgstyle.cpp
+++ b/src/svg/qsvgstyle.cpp
@@ -808,6 +808,7 @@ void QSvgGradientStyle::resolveStops()
static_cast<QSvgGradientStyle*>(prop);
st->resolveStops();
m_gradient->setStops(st->qgradient()->stops());
+ m_gradientStopsSet = st->gradientStopsSet();
}
}
m_link = QString();
diff --git a/src/svg/qsvgwidget.cpp b/src/svg/qsvgwidget.cpp
index a4200ca..ac8595f 100644
--- a/src/svg/qsvgwidget.cpp
+++ b/src/svg/qsvgwidget.cpp
@@ -83,18 +83,6 @@ class QSvgWidgetPrivate : public QWidgetPrivate
{
Q_DECLARE_PUBLIC(QSvgWidget)
public:
- QSvgWidgetPrivate()
- : QWidgetPrivate()
- {
- Q_Q(QSvgWidget);
- renderer = new QSvgRenderer(q);
- }
- QSvgWidgetPrivate(const QString &file)
- : QWidgetPrivate()
- {
- Q_Q(QSvgWidget);
- renderer = new QSvgRenderer(file, q);
- }
QSvgRenderer *renderer;
};
@@ -104,6 +92,7 @@ public:
QSvgWidget::QSvgWidget(QWidget *parent)
: QWidget(*new QSvgWidgetPrivate, parent, 0)
{
+ d_func()->renderer = new QSvgRenderer(this);
QObject::connect(d_func()->renderer, SIGNAL(repaintNeeded()),
this, SLOT(update()));
}
@@ -113,8 +102,9 @@ QSvgWidget::QSvgWidget(QWidget *parent)
of the specified \a file.
*/
QSvgWidget::QSvgWidget(const QString &file, QWidget *parent)
- : QWidget(*new QSvgWidgetPrivate(file), parent, 0)
+ : QWidget(*new QSvgWidgetPrivate, parent, 0)
{
+ d_func()->renderer = new QSvgRenderer(file, this);
QObject::connect(d_func()->renderer, SIGNAL(repaintNeeded()),
this, SLOT(update()));
}
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index a9b85e8..936b936 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -1487,7 +1487,7 @@ int QTest::qExec(QObject *testObject, int argc, char **argv)
}
#endif
-#if defined(QTEST_NOEXITCODE) || (defined(QT_BUILD_INTERNAL) && !defined(QTEST_FORCE_EXITCODE))
+#if defined(QTEST_NOEXITCODE)
return 0;
#else
diff --git a/tests/auto/qaction/tst_qaction.cpp b/tests/auto/qaction/tst_qaction.cpp
index 1b73f06..1ec21f2 100644
--- a/tests/auto/qaction/tst_qaction.cpp
+++ b/tests/auto/qaction/tst_qaction.cpp
@@ -46,7 +46,6 @@
#include <qevent.h>
#include <qaction.h>
#include <qmenu.h>
-#include <qlineedit.h>
//TESTED_CLASS=
//TESTED_FILES=
@@ -75,7 +74,6 @@ private slots:
void setStandardKeys();
void alternateShortcuts();
void enabledVisibleInteraction();
- void invisibleActionWithComplexShortcut();
void task200823_tooltip();
void task229128TriggeredSignalWithoutActiongroup();
void task229128TriggeredSignalWhenInActiongroup();
@@ -367,36 +365,5 @@ void tst_QAction::task229128TriggeredSignalWhenInActiongroup()
QCOMPARE(actionSpy.count(), 1);
}
-void tst_QAction::invisibleActionWithComplexShortcut()
-{
- QAction action(0);
- action.setShortcut(QKeySequence(Qt::CTRL + Qt::Key_E, Qt::Key_1));
-
- QLineEdit edit;
- edit.addAction(&action);
- edit.show();
- QTest::qWait(100);
-
- QSignalSpy spy(&action, SIGNAL(triggered()));
-
- action.setVisible(true);
- QTest::keyPress(&edit, Qt::Key_E, Qt::ControlModifier);
- QTest::keyRelease(&edit, Qt::Key_E, Qt::ControlModifier);
- QTest::keyPress(&edit, Qt::Key_1, Qt::NoModifier);
- QTest::keyRelease(&edit, Qt::Key_1, Qt::NoModifier);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(edit.text(), QLatin1String(""));
-
- edit.clear();
- spy.clear();
- action.setVisible(false);
- QTest::keyPress(&edit, Qt::Key_E, Qt::ControlModifier);
- QTest::keyRelease(&edit, Qt::Key_E, Qt::ControlModifier);
- QTest::keyPress(&edit, Qt::Key_1, Qt::NoModifier);
- QTest::keyRelease(&edit, Qt::Key_1, Qt::NoModifier);
- QCOMPARE(spy.count(), 0);
- QCOMPARE(edit.text(), QLatin1String("1"));
-}
-
QTEST_MAIN(tst_QAction)
#include "tst_qaction.moc"
diff --git a/tests/auto/qbytearraymatcher/qbytearraymatcher.pro b/tests/auto/qbytearraymatcher/qbytearraymatcher.pro
new file mode 100644
index 0000000..1618c3e
--- /dev/null
+++ b/tests/auto/qbytearraymatcher/qbytearraymatcher.pro
@@ -0,0 +1,4 @@
+load(qttest_p4)
+SOURCES += tst_qbytearraymatcher.cpp
+
+QT = core
diff --git a/tests/auto/qbytearraymatcher/tst_qbytearraymatcher.cpp b/tests/auto/qbytearraymatcher/tst_qbytearraymatcher.cpp
new file mode 100644
index 0000000..c3f2fd9
--- /dev/null
+++ b/tests/auto/qbytearraymatcher/tst_qbytearraymatcher.cpp
@@ -0,0 +1,124 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtTest/QtTest>
+
+#include <qbytearraymatcher.h>
+
+class tst_QByteArrayMatcher : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void interface();
+ void task251958();
+};
+
+static QByteArrayMatcher matcher1;
+
+void tst_QByteArrayMatcher::interface()
+{
+ const char needle[] = "abc123";
+ QByteArray haystack(500, 'a');
+ haystack.insert(6, "123");
+ haystack.insert(31, "abc");
+ haystack.insert(42, "abc123");
+ haystack.insert(84, "abc123");
+
+ matcher1 = QByteArrayMatcher(QByteArray(needle));
+ QByteArrayMatcher matcher2;
+ matcher2.setPattern(QByteArray(needle));
+
+ QByteArrayMatcher matcher3 = QByteArrayMatcher(QByteArray(needle));
+ QByteArrayMatcher matcher4(needle, sizeof(needle - 1));
+ QByteArrayMatcher matcher5(matcher2);
+ QByteArrayMatcher matcher6;
+ matcher6 = matcher3;
+
+ QCOMPARE(matcher1.indexIn(haystack), 42);
+ QCOMPARE(matcher2.indexIn(haystack), 42);
+ QCOMPARE(matcher3.indexIn(haystack), 42);
+ QCOMPARE(matcher4.indexIn(haystack), 42);
+ QCOMPARE(matcher5.indexIn(haystack), 42);
+ QCOMPARE(matcher6.indexIn(haystack), 42);
+
+ QCOMPARE(matcher1.indexIn(haystack.constData(), haystack.length()), 42);
+
+ QCOMPARE(matcher1.indexIn(haystack, 43), 84);
+ QCOMPARE(matcher1.indexIn(haystack.constData(), haystack.length(), 43), 84);
+ QCOMPARE(matcher1.indexIn(haystack, 85), -1);
+ QCOMPARE(matcher1.indexIn(haystack.constData(), haystack.length(), 85), -1);
+
+ QByteArrayMatcher matcher7(QByteArray("123"));
+ QCOMPARE(matcher7.indexIn(haystack), 6);
+
+ matcher7 = QByteArrayMatcher(QByteArray("abc"));
+ QCOMPARE(matcher7.indexIn(haystack), 31);
+
+ matcher7.setPattern(matcher4.pattern());
+ QCOMPARE(matcher7.indexIn(haystack), 42);
+}
+
+
+static QByteArrayMatcher matcher;
+
+void tst_QByteArrayMatcher::task251958()
+{
+ const char p_data[] = { 0x0, 0x0, 0x1 };
+ QByteArray pattern(p_data, sizeof(p_data));
+
+ QByteArray haystack(8, '\0');
+ haystack[7] = 0x1;
+
+ matcher = QByteArrayMatcher(pattern);
+ QCOMPARE(matcher.indexIn(haystack, 0), 5);
+ QCOMPARE(matcher.indexIn(haystack, 1), 5);
+ QCOMPARE(matcher.indexIn(haystack, 2), 5);
+
+ matcher.setPattern(pattern);
+ QCOMPARE(matcher.indexIn(haystack, 0), 5);
+ QCOMPARE(matcher.indexIn(haystack, 1), 5);
+ QCOMPARE(matcher.indexIn(haystack, 2), 5);
+}
+
+QTEST_APPLESS_MAIN(tst_QByteArrayMatcher)
+#include "tst_qbytearraymatcher.moc"
diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp
index a64dfc4..69141f3 100644
--- a/tests/auto/qgl/tst_qgl.cpp
+++ b/tests/auto/qgl/tst_qgl.cpp
@@ -66,6 +66,8 @@ private slots:
void getSetCheck();
void openGLVersionCheck();
void graphicsViewClipping();
+ void partialGLWidgetUpdates_data();
+ void partialGLWidgetUpdates();
};
tst_QGL::tst_QGL()
@@ -404,5 +406,68 @@ void tst_QGL::graphicsViewClipping()
#endif
}
+void tst_QGL::partialGLWidgetUpdates_data()
+{
+ QTest::addColumn<bool>("doubleBufferedContext");
+ QTest::addColumn<bool>("autoFillBackground");
+ QTest::addColumn<bool>("supportsPartialUpdates");
+
+ QTest::newRow("Double buffered context") << true << true << false;
+ QTest::newRow("Double buffered context without auto-fill background") << true << false << false;
+ QTest::newRow("Single buffered context") << false << true << false;
+ QTest::newRow("Single buffered context without auto-fill background") << false << false << true;
+}
+
+void tst_QGL::partialGLWidgetUpdates()
+{
+#ifdef QT_NO_OPENGL
+ QSKIP("QGL not yet supported", SkipAll);
+#else
+ if (!QGLFormat::hasOpenGL())
+ QSKIP("QGL not supported on this platform", SkipAll);
+
+ QFETCH(bool, doubleBufferedContext);
+ QFETCH(bool, autoFillBackground);
+ QFETCH(bool, supportsPartialUpdates);
+
+ class MyGLWidget : public QGLWidget
+ {
+ public:
+ QRegion paintEventRegion;
+ void paintEvent(QPaintEvent *e)
+ {
+ paintEventRegion = e->region();
+ }
+ };
+
+ QGLFormat format = QGLFormat::defaultFormat();
+ format.setDoubleBuffer(doubleBufferedContext);
+ QGLFormat::setDefaultFormat(format);
+
+ MyGLWidget widget;
+ widget.setFixedSize(150, 150);
+ widget.setAutoFillBackground(autoFillBackground);
+ widget.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&widget);
+#endif
+ QTest::qWait(200);
+
+ if (widget.format().doubleBuffer() != doubleBufferedContext)
+ QSKIP("Platform does not support requested format", SkipAll);
+
+ widget.paintEventRegion = QRegion();
+ widget.repaint(50, 50, 50, 50);
+#ifdef Q_WS_MAC
+ // repaint() is not immediate on the Mac; it has to go through the event loop.
+ QTest::qWait(200);
+#endif
+ if (supportsPartialUpdates)
+ QCOMPARE(widget.paintEventRegion, QRegion(50, 50, 50, 50));
+ else
+ QCOMPARE(widget.paintEventRegion, QRegion(widget.rect()));
+#endif
+}
+
QTEST_MAIN(tst_QGL)
#include "tst_qgl.moc"
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 57e441b..88c64d3 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -172,6 +172,7 @@ private slots:
void boundingRects2();
void sceneBoundingRect();
void childrenBoundingRect();
+ void childrenBoundingRectTransformed();
void group();
void setGroup();
void nestedGroups();
@@ -2917,9 +2918,57 @@ void tst_QGraphicsItem::childrenBoundingRect()
childChild->setParentItem(child);
childChild->setPos(500, 500);
child->rotate(90);
+
+
+ scene.addPolygon(parent->mapToScene(parent->boundingRect() | parent->childrenBoundingRect()))->setPen(QPen(Qt::red));;
+
+ QGraphicsView view(&scene);
+ view.show();
+
+ QTest::qWait(5000);
+
QCOMPARE(parent->childrenBoundingRect(), QRectF(-500, -100, 600, 800));
}
+void tst_QGraphicsItem::childrenBoundingRectTransformed()
+{
+ QGraphicsScene scene;
+
+ QGraphicsRectItem *rect = scene.addRect(QRectF(0, 0, 100, 100));
+ QGraphicsRectItem *rect2 = scene.addRect(QRectF(0, 0, 100, 100));
+ QGraphicsRectItem *rect3 = scene.addRect(QRectF(0, 0, 100, 100));
+ QGraphicsRectItem *rect4 = scene.addRect(QRectF(0, 0, 100, 100));
+ QGraphicsRectItem *rect5 = scene.addRect(QRectF(0, 0, 100, 100));
+ rect2->setParentItem(rect);
+ rect3->setParentItem(rect2);
+ rect4->setParentItem(rect3);
+ rect5->setParentItem(rect4);
+
+ rect2->setTransform(QTransform().translate(50, 50).rotate(45));
+ rect2->setPos(25, 25);
+ rect3->setTransform(QTransform().translate(50, 50).rotate(45));
+ rect3->setPos(25, 25);
+ rect4->setTransform(QTransform().translate(50, 50).rotate(45));
+ rect4->setPos(25, 25);
+ rect5->setTransform(QTransform().translate(50, 50).rotate(45));
+ rect5->setPos(25, 25);
+
+ QRectF subTreeRect = rect->childrenBoundingRect();
+ QCOMPARE(subTreeRect.left(), qreal(-206.0660171779821));
+ QCOMPARE(subTreeRect.top(), qreal(75.0));
+ QCOMPARE(subTreeRect.width(), qreal(351.7766952966369));
+ QCOMPARE(subTreeRect.height(), qreal(251.7766952966369));
+
+ rect->rotate(45);
+ rect2->rotate(-45);
+ rect3->rotate(45);
+ rect4->rotate(-45);
+ rect5->rotate(45);
+
+ subTreeRect = rect->childrenBoundingRect();
+ QCOMPARE(rect->childrenBoundingRect(), QRectF(-100, 75, 275, 250));
+}
+
void tst_QGraphicsItem::group()
{
QGraphicsScene scene;
diff --git a/tests/auto/qimagereader/baseline/35floppy.ico b/tests/auto/qimagereader/baseline/35floppy.ico
new file mode 100644
index 0000000..59fd37e
--- /dev/null
+++ b/tests/auto/qimagereader/baseline/35floppy.ico
Binary files differ
diff --git a/tests/auto/qimagereader/baseline/kde_favicon.ico b/tests/auto/qimagereader/baseline/kde_favicon.ico
new file mode 100644
index 0000000..15bcdbb
--- /dev/null
+++ b/tests/auto/qimagereader/baseline/kde_favicon.ico
Binary files differ
diff --git a/tests/auto/qimagereader/baseline/semitransparent.ico b/tests/auto/qimagereader/baseline/semitransparent.ico
new file mode 100644
index 0000000..dd23de9
--- /dev/null
+++ b/tests/auto/qimagereader/baseline/semitransparent.ico
Binary files differ
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp
index 3841111..8f7094c 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -153,6 +153,9 @@ private slots:
void autoDetectImageFormat();
void fileNameProbing();
+
+ void pixelCompareWithBaseline_data();
+ void pixelCompareWithBaseline();
};
// Testing get/set functions
@@ -1368,5 +1371,32 @@ void tst_QImageReader::fileNameProbing()
QCOMPARE(r.fileName(), name);
}
+void tst_QImageReader::pixelCompareWithBaseline_data()
+{
+ QTest::addColumn<QString>("fileName");
+
+ QTest::newRow("floppy (16px,32px - 16 colors)") << "35floppy.ico";
+ QTest::newRow("semitransparent") << "semitransparent.ico";
+ QTest::newRow("slightlybroken") << "kde_favicon.ico";
+}
+
+void tst_QImageReader::pixelCompareWithBaseline()
+{
+ QFETCH(QString, fileName);
+
+ QImage icoImg;
+ // might fail if the plugin does not exist, which is ok.
+ if (icoImg.load(QString::fromAscii("images/%1").arg(fileName))) {
+ QString baselineFileName = QString::fromAscii("baseline/%1").arg(fileName);
+#if 0
+ icoImg.save(baselineFileName);
+#else
+ QImage baseImg;
+ QVERIFY(baseImg.load(baselineFileName));
+ QCOMPARE(baseImg, icoImg);
+#endif
+ }
+}
+
QTEST_MAIN(tst_QImageReader)
#include "tst_qimagereader.moc"
diff --git a/tests/auto/qlocalsocket/test/test.pro b/tests/auto/qlocalsocket/test/test.pro
index 8ce7c50..7befdf9 100644
--- a/tests/auto/qlocalsocket/test/test.pro
+++ b/tests/auto/qlocalsocket/test/test.pro
@@ -1,7 +1,5 @@
load(qttest_p4)
-include(../src/src.pri)
-
DEFINES += QLOCALSERVER_DEBUG
DEFINES += QLOCALSOCKET_DEBUG
!wince*: {
@@ -14,14 +12,16 @@ DEFINES += QLOCALSOCKET_DEBUG
QT = core network
SOURCES += ../tst_qlocalsocket.cpp
-TARGET = ../tst_qlocalsocket
-win32 {
+TARGET = tst_qlocalsocket
+CONFIG(debug_and_release) {
CONFIG(debug, debug|release) {
- TARGET = ../../debug/tst_qlocalsocket
-} else {
- TARGET = ../../release/tst_qlocalsocket
+ DESTDIR = ../debug
+ } else {
+ DESTDIR = ../release
}
+} else {
+ DESTDIR = ..
}
wince* {
diff --git a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
index f741b96..deabda6 100644
--- a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
+++ b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
@@ -95,6 +95,7 @@ private slots:
void longPath();
void waitForDisconnect();
+ void waitForDisconnectByServer();
void removeServer();
@@ -112,6 +113,8 @@ tst_QLocalSocket::tst_QLocalSocket()
#endif
))
qWarning() << "lackey executable doesn't exists!";
+
+ QLocalServer::removeServer("tst_localsocket");
}
tst_QLocalSocket::~tst_QLocalSocket()
@@ -783,6 +786,25 @@ void tst_QLocalSocket::waitForDisconnect()
QVERIFY(timer.elapsed() < 2000);
}
+void tst_QLocalSocket::waitForDisconnectByServer()
+{
+ QString name = "tst_localsocket";
+ LocalServer server;
+ QVERIFY(server.listen(name));
+ LocalSocket socket;
+ QSignalSpy spy(&socket, SIGNAL(disconnected()));
+ QVERIFY(spy.isValid());
+ socket.connectToServer(name);
+ QVERIFY(socket.waitForConnected(3000));
+ QVERIFY(server.waitForNewConnection(3000));
+ QLocalSocket *serverSocket = server.nextPendingConnection();
+ QVERIFY(serverSocket);
+ serverSocket->close();
+ QVERIFY(serverSocket->state() == QLocalSocket::UnconnectedState);
+ QVERIFY(socket.waitForDisconnected(3000));
+ QCOMPARE(spy.count(), 1);
+}
+
void tst_QLocalSocket::removeServer()
{
// this is a hostile takeover, but recovering from a crash results in the same
diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp
index 8b43f9b..c81bf67 100644
--- a/tests/auto/qpainter/tst_qpainter.cpp
+++ b/tests/auto/qpainter/tst_qpainter.cpp
@@ -3792,8 +3792,11 @@ void tst_QPainter::imageBlending()
void tst_QPainter::paintOnNullPixmap()
{
+ QPixmap pix(16, 16);
+
QPixmap textPixmap;
QPainter p(&textPixmap);
+ p.drawPixmap(10, 10, pix);
p.end();
QPixmap textPixmap2(16,16);
diff --git a/tests/auto/qpixmapcache/tst_qpixmapcache.cpp b/tests/auto/qpixmapcache/tst_qpixmapcache.cpp
index c163b52..1f515ff 100644
--- a/tests/auto/qpixmapcache/tst_qpixmapcache.cpp
+++ b/tests/auto/qpixmapcache/tst_qpixmapcache.cpp
@@ -166,6 +166,16 @@ void tst_QPixmapCache::insert()
QVERIFY(estimatedNum - 1 <= num <= estimatedNum + 1);
QPixmap p3;
QPixmapCache::insert("null", p3);
+
+ QPixmap c1(10, 10);
+ c1.fill(Qt::yellow);
+ QPixmapCache::insert("custom", c1);
+ QVERIFY(!c1.isDetached());
+ QPixmap c2(10, 10);
+ c2.fill(Qt::red);
+ QPixmapCache::insert("custom", c2);
+ //We have deleted the old pixmap in the cache for the same key
+ QVERIFY(c1.isDetached());
}
void tst_QPixmapCache::remove()
diff --git a/tests/auto/qshortcut/tst_qshortcut.cpp b/tests/auto/qshortcut/tst_qshortcut.cpp
index cd80204..69ebf74 100644
--- a/tests/auto/qshortcut/tst_qshortcut.cpp
+++ b/tests/auto/qshortcut/tst_qshortcut.cpp
@@ -987,16 +987,17 @@ void tst_QShortcut::keypressConsumption()
cut1->setEnabled(false);
cut2->setEnabled(false);
- edit->clear();
+ // Make sure keypresses is passed on, since all multiple keysequences
+ // with Ctrl+I are disabled
sendKeyEvents(edit, Qt::CTRL + Qt::Key_I, 0); // Send key to edit
QCOMPARE( currentResult, NoResult );
QCOMPARE( ambigResult, NoResult );
- QVERIFY(edit->toPlainText().isEmpty());
+ QVERIFY(edit->toPlainText().endsWith("<Ctrl+I>"));
sendKeyEvents(edit, Qt::Key_A, 'a'); // Send key to edit
QCOMPARE( currentResult, NoResult );
QCOMPARE( ambigResult, NoResult );
- QVERIFY(edit->toPlainText().isEmpty());
+ QVERIFY(edit->toPlainText().endsWith("<Ctrl+I>a"));
clearAllShortcuts();
}
diff --git a/tests/auto/qsidebar/tst_qsidebar.cpp b/tests/auto/qsidebar/tst_qsidebar.cpp
index 7a262e6..705e222 100644
--- a/tests/auto/qsidebar/tst_qsidebar.cpp
+++ b/tests/auto/qsidebar/tst_qsidebar.cpp
@@ -176,6 +176,32 @@ void tst_QSidebar::addUrls()
qsidebar.addUrls(urls, -1);
qsidebar.addUrls(moreUrls, -1);
QCOMPARE(qsidebar.urls()[0], urls[0]);
+
+ QList<QUrl> doubleUrls;
+ //tow exact same paths, we have only one entry
+ doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath());
+ doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath());
+ qsidebar.setUrls(emptyUrls);
+ qsidebar.addUrls(doubleUrls, 1);
+ QCOMPARE(qsidebar.urls().size(), 1);
+
+#if defined(Q_OS_WIN)
+ //Windows is case insensitive so no duplicate entries in that case
+ doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath());
+ doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath().toUpper());
+ qsidebar.setUrls(emptyUrls);
+ qsidebar.addUrls(doubleUrls, 1);
+ QCOMPARE(qsidebar.urls().size(), 1);
+#else
+ //Two different paths we should have two entries
+ doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath());
+ doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath().toUpper());
+ qsidebar.setUrls(emptyUrls);
+ qsidebar.addUrls(doubleUrls, 1);
+ QCOMPARE(qsidebar.urls().size(), 2);
+#endif
+
+
}
void tst_QSidebar::goToUrl()
diff --git a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
index 18aa5fc..ea73a5e 100644
--- a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
+++ b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
@@ -2715,6 +2715,16 @@ void tst_QSortFilterProxyModel::task251296_hiddenChildren()
QCOMPARE(proxy.rowCount(indexA) , 1);
QModelIndex indexC = proxy.index(0, 0, indexA);
QCOMPARE(proxy.data(indexC).toString(), QString::fromLatin1("C VISIBLE"));
+
+ proxy.setFilterRegExp("C");
+ QCOMPARE(proxy.rowCount(QModelIndex()), 0);
+ itemC->setText("invisible");
+ itemA->setText("AC");
+
+ QCOMPARE(proxy.rowCount(QModelIndex()), 1);
+ indexA = proxy.index(0,0);
+ QCOMPARE(proxy.data(indexA).toString(), QString::fromLatin1("AC"));
+ QCOMPARE(proxy.rowCount(indexA) , 0);
}
diff --git a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
index aa63753..33f85d5 100644
--- a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
+++ b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
@@ -81,6 +81,7 @@ private slots:
void onWidgetDestroyed();
void fontPrecedence();
void focusColors();
+ void hoverColors();
void background();
void tabAlignement();
void attributesList();
@@ -759,6 +760,7 @@ void tst_QStyleSheetStyle::focusColors()
combobox->setEditable(true);
combobox->addItems(QStringList() << "TESTING");
widgets << combobox;
+ widgets << new QLabel("TESTING");
#ifdef Q_WS_QWS
// QWS has its own special focus logic which is slightly different
@@ -808,6 +810,56 @@ void tst_QStyleSheetStyle::focusColors()
// }
}
+
+void tst_QStyleSheetStyle::hoverColors()
+{
+ QList<QWidget *> widgets;
+ widgets << new QPushButton("TESTING");
+ widgets << new QLineEdit("TESTING");
+ widgets << new QLabel("TESTING");
+ QSpinBox *spinbox = new QSpinBox;
+ spinbox->setValue(8888);
+ widgets << spinbox;
+ QComboBox *combobox = new QComboBox;
+ combobox->setEditable(true);
+ combobox->addItems(QStringList() << "TESTING");
+ widgets << combobox;
+ widgets << new QLabel("<b>TESTING</b>");
+
+ foreach (QWidget *widget, widgets) {
+ QDialog frame;
+ QLayout* layout = new QGridLayout;
+
+ QLineEdit* dummy = new QLineEdit;
+
+ widget->setStyleSheet("*:hover { border:none; background: #e8ff66; color: #ff0084 }");
+
+ layout->addWidget(dummy);
+ layout->addWidget(widget);
+ frame.setLayout(layout);
+
+ frame.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&frame);
+#endif
+ QApplication::setActiveWindow(&frame);
+ QTest::qWait(60);
+ QTest::mouseMove ( widget, QPoint(5,5));
+ QTest::qWait(60);
+
+ QImage image(frame.width(), frame.height(), QImage::Format_ARGB32);
+ frame.render(&image);
+
+ QVERIFY2(testForColors(image, QColor(0xe8, 0xff, 0x66)),
+ (QString::fromLatin1(widget->metaObject()->className())
+ + " did not contain background color #e8ff66").toLocal8Bit().constData());
+ QVERIFY2(testForColors(image, QColor(0xff, 0x00, 0x84)),
+ (QString::fromLatin1(widget->metaObject()->className())
+ + " did not contain text color #ff0084").toLocal8Bit().constData());
+ }
+
+}
+
class SingleInheritanceDialog : public QDialog
{
Q_OBJECT
@@ -1377,8 +1429,6 @@ void tst_QStyleSheetStyle::task188195_baseBackground()
QVERIFY(!testForColors(image, QColor(0xab, 0x12, 0x51)));
}
-
-
QTEST_MAIN(tst_QStyleSheetStyle)
#include "tst_qstylesheetstyle.moc"
diff --git a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp
index 4a17031..4da99da 100644
--- a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp
+++ b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp
@@ -534,16 +534,42 @@ void tst_QSvgRenderer::gradientStops() const
QCOMPARE(image, refImage);
}
+ const char *svgs[] = {
+ "<svg>"
+ "<defs>"
+ "<linearGradient id=\"gradient\">"
+ "<stop offset=\"0\" stop-color=\"red\" stop-opacity=\"0\"/>"
+ "<stop offset=\"1\" stop-color=\"blue\"/>"
+ "</linearGradient>"
+ "</defs>"
+ "<rect fill=\"url(#gradient)\" height=\"8\" width=\"256\" x=\"0\" y=\"0\"/>"
+ "</svg>",
+ "<svg>"
+ "<defs>"
+ "<linearGradient id=\"gradient\" xlink:href=\"#gradient0\">"
+ "</linearGradient>"
+ "<linearGradient id=\"gradient0\">"
+ "<stop offset=\"0\" stop-color=\"red\" stop-opacity=\"0\"/>"
+ "<stop offset=\"1\" stop-color=\"blue\"/>"
+ "</linearGradient>"
+ "</defs>"
+ "<rect fill=\"url(#gradient)\" height=\"8\" width=\"256\" x=\"0\" y=\"0\"/>"
+ "</svg>",
+ "<svg>"
+ "<defs>"
+ "<linearGradient id=\"gradient0\">"
+ "<stop offset=\"0\" stop-color=\"red\" stop-opacity=\"0\"/>"
+ "<stop offset=\"1\" stop-color=\"blue\"/>"
+ "</linearGradient>"
+ "<linearGradient id=\"gradient\" xlink:href=\"#gradient0\">"
+ "</linearGradient>"
+ "</defs>"
+ "<rect fill=\"url(#gradient)\" height=\"8\" width=\"256\" x=\"0\" y=\"0\"/>"
+ "</svg>"
+ };
+ for (int i = 0 ; i < sizeof(svgs) / sizeof(svgs[0]) ; ++i)
{
- QByteArray data("<svg>"
- "<defs>"
- "<linearGradient id=\"gradient\">"
- "<stop offset=\"0\" stop-color=\"red\" stop-opacity=\"0\"/>"
- "<stop offset=\"1\" stop-color=\"blue\"/>"
- "</linearGradient>"
- "</defs>"
- "<rect fill=\"url(#gradient)\" height=\"8\" width=\"256\" x=\"0\" y=\"0\"/>"
- "</svg>");
+ QByteArray data = svgs[i];
QSvgRenderer renderer(data);
QImage image(256, 8, QImage::Format_ARGB32_Premultiplied);
diff --git a/tests/auto/qtextcodec/tst_qtextcodec.cpp b/tests/auto/qtextcodec/tst_qtextcodec.cpp
index b1bfb86..cf4135b 100644
--- a/tests/auto/qtextcodec/tst_qtextcodec.cpp
+++ b/tests/auto/qtextcodec/tst_qtextcodec.cpp
@@ -68,6 +68,8 @@ private slots:
void flagEFBFBF() const;
void decode0D() const;
void codecForIndex() const;
+ void aliasForUTF16() const;
+ void mibForTSCII() const;
void utf8Codec_data();
void utf8Codec();
@@ -453,6 +455,16 @@ void tst_QTextCodec::codecForIndex() const
{
}
+void tst_QTextCodec::aliasForUTF16() const
+{
+ QVERIFY(QTextCodec::codecForName("UTF-16")->aliases().isEmpty());
+}
+
+void tst_QTextCodec::mibForTSCII() const
+{
+ QCOMPARE(QTextCodec::codecForName("TSCII")->mibEnum(), 2107);
+}
+
static QString fromInvalidUtf8Sequence(const QByteArray &ba)
{
return QString().fill(QChar::ReplacementCharacter, ba.size());
diff --git a/tests/auto/qtransform/tst_qtransform.cpp b/tests/auto/qtransform/tst_qtransform.cpp
index 8516ddb..74c405e 100644
--- a/tests/auto/qtransform/tst_qtransform.cpp
+++ b/tests/auto/qtransform/tst_qtransform.cpp
@@ -593,6 +593,16 @@ void tst_QTransform::types()
m3.translate(5.0f, 5.0f);
QCOMPARE(m3.type(), QTransform::TxScale);
QCOMPARE(m3.inverted().type(), QTransform::TxScale);
+
+ m3.setMatrix(1.0f, 0.0f, 0.0f,
+ 0.0f, 1.0f, 0.0f,
+ 0.0f, 0.0f, 2.0f);
+ QCOMPARE(m3.type(), QTransform::TxProject);
+
+ m3.setMatrix(0.0f, 2.0f, 0.0f,
+ 1.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 2.0f);
+ QCOMPARE(m3.type(), QTransform::TxProject);
}
diff --git a/tests/auto/qvariant/tst_qvariant.cpp b/tests/auto/qvariant/tst_qvariant.cpp
index d15f9c8..0ede920 100644
--- a/tests/auto/qvariant/tst_qvariant.cpp
+++ b/tests/auto/qvariant/tst_qvariant.cpp
@@ -440,6 +440,9 @@ void tst_QVariant::canConvert_data()
var = QVariant((double)0.1);
QTest::newRow("Double")
<< var << N << N << Y << N << Y << Y << N << N << N << N << N << Y << N << N << N << Y << N << N << N << Y << N << N << N << N << N << N << N << N << N << N << Y << N << N << Y << Y;
+ var = QVariant(0.1f);
+ QTest::newRow("Float")
+ << var << N << N << Y << N << Y << Y << N << N << N << N << N << Y << N << N << N << Y << N << N << N << Y << N << N << N << N << N << N << N << N << N << N << Y << N << N << Y << Y;
var = qVariantFromValue(QFont());
QTest::newRow("Font")
<< var << N << N << N << N << N << N << N << N << N << N << N << N << Y << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << Y << N << N << N << N;
@@ -573,6 +576,7 @@ void tst_QVariant::canConvert()
QCOMPARE(val.canConvert(QVariant::Date), DateCast);
QCOMPARE(val.canConvert(QVariant::DateTime), DateTimeCast);
QCOMPARE(val.canConvert(QVariant::Double), DoubleCast);
+ QCOMPARE(val.canConvert(QVariant::Type(QMetaType::Float)), DoubleCast);
QCOMPARE(val.canConvert(QVariant::Font), FontCast);
#ifdef QT3_SUPPORT
QCOMPARE(val.canConvert(QVariant::IconSet), IconSetCast);
@@ -615,6 +619,7 @@ void tst_QVariant::toInt_data()
QTest::newRow( "invalid" ) << QVariant() << 0 << false;
QTest::newRow( "int" ) << QVariant( 123 ) << 123 << true;
QTest::newRow( "double" ) << QVariant( 3.1415927 ) << 3 << true;
+ QTest::newRow( "float" ) << QVariant( 3.1415927f ) << 3 << true;
QTest::newRow( "uint" ) << QVariant( 123u ) << 123 << true;
#ifdef QT3_SUPPORT
QTest::newRow( "bool" ) << QVariant( true, 42 ) << 1 << true;
@@ -627,6 +632,7 @@ void tst_QVariant::toInt_data()
QTest::newRow( "ulonglong1" ) << QVariant( uintMax1 ) << 0 << true;
QTest::newRow( "signedint" ) << QVariant( -123 ) << -123 << true;
QTest::newRow( "signeddouble" ) << QVariant( -3.1415927 ) << -3 << true;
+ QTest::newRow( "signedfloat" ) << QVariant( -3.1415927f ) << -3 << true;
QTest::newRow( "signedint-string" ) << QVariant( QString("-123") ) << -123 << true;
QTest::newRow( "signedlonglong0" ) << QVariant( (qlonglong)-34 ) << -34 << true;
QTest::newRow( "QChar" ) << QVariant(QChar('a')) << int('a') << true;
@@ -666,6 +672,7 @@ void tst_QVariant::toUInt_data()
QTest::newRow( "int" ) << QVariant( 123 ) << (uint)123 << true;
QTest::newRow( "double" ) << QVariant( 3.1415927 ) << (uint)3 << true;
+ QTest::newRow( "float" ) << QVariant( 3.1415927f ) << (uint)3 << true;
QTest::newRow( "uint" ) << QVariant( 123u ) << (uint)123 << true;
#ifdef QT3_SUPPORT
QTest::newRow( "bool" ) << QVariant( true, 42 ) << (uint)1 << true;
@@ -679,6 +686,7 @@ void tst_QVariant::toUInt_data()
QTest::newRow( "ulonglong1" ) << QVariant( uintMax1 ) << (uint)0 << true;
QTest::newRow( "negativeint" ) << QVariant( -123 ) << (uint)-123 << true;
QTest::newRow( "negativedouble" ) << QVariant( -3.1415927 ) << (uint)-3 << true;
+ QTest::newRow( "negativefloat" ) << QVariant( -3.1415927f ) << (uint)-3 << true;
QTest::newRow( "negativeint-string" ) << QVariant( QString("-123") ) << (uint)0 << false;
QTest::newRow( "negativelonglong0" ) << QVariant( (qlonglong)-34 ) << (uint)-34 << true;
QTest::newRow( "QChar" ) << QVariant(QChar('a')) << uint('a') << true;
@@ -860,7 +868,9 @@ void tst_QVariant::toBool_data()
QTest::newRow( "uint0" ) << QVariant( 0u ) << false;
QTest::newRow( "uint1" ) << QVariant( 123u ) << true;
QTest::newRow( "double0" ) << QVariant( 0.0 ) << false;
+ QTest::newRow( "float0" ) << QVariant( 0.0f ) << false;
QTest::newRow( "double1" ) << QVariant( 3.1415927 ) << true;
+ QTest::newRow( "float1" ) << QVariant( 3.1415927f ) << true;
#ifdef QT3_SUPPORT
QTest::newRow( "bool0" ) << QVariant( false, 42 ) << false;
QTest::newRow( "bool1" ) << QVariant( true, 42 ) << true;
@@ -1090,6 +1100,7 @@ void tst_QVariant::toLongLong_data()
QTest::newRow( "int0" ) << QVariant( 123 ) << (qlonglong)123 << true;
QTest::newRow( "double" ) << QVariant( 3.1415927 ) << (qlonglong)3 << true;
+ QTest::newRow( "float" ) << QVariant( 3.1415927f ) << (qlonglong)3 << true;
QTest::newRow( "uint" ) << QVariant( 123u ) << (qlonglong)123 << true;
#ifdef QT3_SUPPORT
QTest::newRow( "bool" ) << QVariant( true, 42 ) << (qlonglong)1 << true;
@@ -1130,6 +1141,7 @@ void tst_QVariant::toULongLong_data()
QTest::newRow( "int0" ) << QVariant( 123 ) << (qulonglong)123 << true;
QTest::newRow( "double" ) << QVariant( 3.1415927 ) << (qulonglong)3 << true;
+ QTest::newRow( "float" ) << QVariant( 3.1415927f ) << (qulonglong)3 << true;
QTest::newRow( "uint" ) << QVariant( 123u ) << (qulonglong)123 << true;
#ifdef QT3_SUPPORT
QTest::newRow( "bool" ) << QVariant( true, 42 ) << (qulonglong)1 << true;
@@ -1218,6 +1230,7 @@ void tst_QVariant::toByteArray_data()
QTest::newRow( "int" ) << QVariant( -123 ) << QByteArray( "-123" );
QTest::newRow( "uint" ) << QVariant( (uint)123 ) << QByteArray( "123" );
QTest::newRow( "double" ) << QVariant( 123.456 ) << QByteArray( "123.456" );
+ QTest::newRow( "float" ) << QVariant( 123.456f ) << QByteArray( "123.456" );
QTest::newRow( "longlong" ) << QVariant( (qlonglong)34 ) << QByteArray( "34" );
QTest::newRow( "ulonglong" ) << QVariant( (qulonglong)34 ) << QByteArray( "34" );
}
@@ -1243,6 +1256,7 @@ void tst_QVariant::toString_data()
QTest::newRow( "int" ) << QVariant( -123 ) << QString( "-123" );
QTest::newRow( "uint" ) << QVariant( (uint)123 ) << QString( "123" );
QTest::newRow( "double" ) << QVariant( 123.456 ) << QString( "123.456" );
+ QTest::newRow( "float" ) << QVariant( 123.456f ) << QString( "123.456" );
#ifdef QT3_SUPPORT
QTest::newRow( "bool" ) << QVariant( true, 0 ) << QString( "true" );
#else
@@ -1450,6 +1464,7 @@ void tst_QVariant::writeToReadFromDataStream_data()
QTest::newRow( "datetime_invalid" ) << QVariant( QDateTime() ) << true;
QTest::newRow( "datetime_valid" ) << QVariant( QDateTime( QDate( 2002, 07, 06 ), QTime( 14, 0, 0 ) ) ) << false;
QTest::newRow( "double_valid" ) << QVariant( 123.456 ) << false;
+ QTest::newRow( "float_valid" ) << QVariant( 123.456f ) << false;
QTest::newRow( "font_valid" ) << qVariantFromValue( QFont( "times", 12 ) ) << false;
QTest::newRow( "pixmap_invalid" ) << qVariantFromValue( QPixmap() ) << true;
QPixmap pixmap( 10, 10 );
@@ -1476,6 +1491,7 @@ void tst_QVariant::writeToReadFromDataStream_data()
vMap.insert( "int", QVariant( 1 ) );
vMap.insert( "string", QVariant( QString("Two") ) );
vMap.insert( "double", QVariant( 3.45 ) );
+ vMap.insert( "float", QVariant( 3.45f ) );
QTest::newRow( "map_valid" ) << QVariant( vMap ) << false;
QTest::newRow( "palette_valid" ) << qVariantFromValue(QPalette(QColor("turquoise"))) << false;
QTest::newRow( "pen_valid" ) << qVariantFromValue( QPen( Qt::red ) ) << false;
@@ -1669,6 +1685,10 @@ void tst_QVariant::operator_eq_eq_data()
QVariant mDoubleString(QByteArray("42.11"));
QVariant mDoubleQString(QString("42.11"));
+ QVariant mFloat(42.11f);
+ QVariant mFloatString(QByteArray("42.11"));
+ QVariant mFloatQString(QString("42.11"));
+
QVariant mLongLong((qlonglong)-42);
QVariant mLongLongString(QByteArray("-42"));
QVariant mLongLongQString(QString("-42"));
@@ -1686,6 +1706,7 @@ void tst_QVariant::operator_eq_eq_data()
QVariant mBoolQString(QString("false"));
QTest::newRow( "double_int" ) << QVariant(42.0) << QVariant(42) << true;
+ QTest::newRow( "float_int" ) << QVariant(42.f) << QVariant(42) << true;
QTest::newRow( "mInt_mIntString" ) << mInt << mIntString << true;
QTest::newRow( "mIntString_mInt" ) << mIntString << mInt << true;
QTest::newRow( "mInt_mIntQString" ) << mInt << mIntQString << true;
@@ -1701,6 +1722,11 @@ void tst_QVariant::operator_eq_eq_data()
QTest::newRow( "mDouble_mDoubleQString" ) << mDouble << mDoubleQString << true;
QTest::newRow( "mDoubleQString_mDouble" ) << mDoubleQString << mDouble << true;
+ QTest::newRow( "mFloat_mFloatString" ) << mFloat << mFloatString << true;
+ QTest::newRow( "mFloatString_mFloat" ) << mFloatString << mFloat << true;
+ QTest::newRow( "mFloat_mFloatQString" ) << mFloat << mFloatQString << true;
+ QTest::newRow( "mFloatQString_mFloat" ) << mFloatQString << mFloat << true;
+
QTest::newRow( "mLongLong_mLongLongString" ) << mLongLong << mLongLongString << true;
QTest::newRow( "mLongLongString_mLongLong" ) << mLongLongString << mLongLong << true;
QTest::newRow( "mLongLong_mLongLongQString" ) << mLongLong << mLongLongQString << true;
@@ -1900,6 +1926,7 @@ void tst_QVariant::typeName_data()
QTest::newRow("17") << int(QVariant::UInt) << QByteArray("uint");
QTest::newRow("18") << int(QVariant::Bool) << QByteArray("bool");
QTest::newRow("19") << int(QVariant::Double) << QByteArray("double");
+ QTest::newRow("20") << int(QMetaType::Float) << QByteArray("float");
QTest::newRow("21") << int(QVariant::Polygon) << QByteArray("QPolygon");
QTest::newRow("22") << int(QVariant::Region) << QByteArray("QRegion");
QTest::newRow("23") << int(QVariant::Bitmap) << QByteArray("QBitmap");
@@ -2233,6 +2260,13 @@ void tst_QVariant::basicUserType()
QCOMPARE(v.toDouble(), 4.4);
{
+ float f = 4.5f;
+ v = QVariant(QMetaType::Float, &f);
+ }
+ QCOMPARE(v.userType(), int(QMetaType::Float));
+ QCOMPARE(v.toDouble(), 4.5);
+
+ {
QByteArray ba("bar");
v = QVariant(QMetaType::QByteArray, &ba);
}
@@ -2246,6 +2280,7 @@ void tst_QVariant::data_()
QVariant i = 1;
QVariant d = 1.12;
+ QVariant f = 1.12f;
QVariant ll = (qlonglong)2;
QVariant ull = (qulonglong)3;
QVariant s(QString("hallo"));
@@ -2259,6 +2294,10 @@ void tst_QVariant::data_()
QVERIFY(v.data());
QCOMPARE(*static_cast<double *>(v.data()), d.toDouble());
+ v = f;
+ QVERIFY(v.data());
+ QCOMPARE(*static_cast<float *>(v.data()), qVariantValue<float>(v));
+
v = ll;
QVERIFY(v.data());
QCOMPARE(*static_cast<qlonglong *>(v.data()), ll.toLongLong());
@@ -2282,6 +2321,7 @@ void tst_QVariant::constData()
int i = 1;
double d = 1.12;
+ float f = 1.12f;
qlonglong ll = 2;
qulonglong ull = 3;
QString s("hallo");
@@ -2295,6 +2335,10 @@ void tst_QVariant::constData()
QVERIFY(v.constData());
QCOMPARE(*static_cast<const double *>(v.constData()), d);
+ v = QVariant(f);
+ QVERIFY(v.constData());
+ QCOMPARE(*static_cast<const float *>(v.constData()), f);
+
v = QVariant(ll);
QVERIFY(v.constData());
QCOMPARE(*static_cast<const qlonglong *>(v.constData()), ll);
@@ -2339,6 +2383,7 @@ void tst_QVariant::variant_to()
qVariantSetValue(v4, foo);
QCOMPARE(qvariant_cast<double>(v1), 4.2);
+ QCOMPARE(qvariant_cast<float>(v1), 4.2f);
QCOMPARE(qvariant_cast<int>(v2), 5);
QCOMPARE(qvariant_cast<QStringList>(v3), sl);
QCOMPARE(qvariant_cast<QString>(v3), QString::fromLatin1("blah"));
@@ -2354,6 +2399,7 @@ void tst_QVariant::variant_to()
QCOMPARE(qvariant_cast<int>(n), 42);
QCOMPARE(qvariant_cast<uint>(n), 42u);
QCOMPARE(qvariant_cast<double>(n), 42.0);
+ QCOMPARE(qvariant_cast<float>(n), 42.f);
QCOMPARE(qvariant_cast<short>(n), short(42));
QCOMPARE(qvariant_cast<ushort>(n), ushort(42));
@@ -2361,6 +2407,7 @@ void tst_QVariant::variant_to()
QCOMPARE(qvariant_cast<int>(n), 43);
QCOMPARE(qvariant_cast<uint>(n), 43u);
QCOMPARE(qvariant_cast<double>(n), 43.0);
+ QCOMPARE(qvariant_cast<float>(n), 43.f);
QCOMPARE(qvariant_cast<long>(n), 43l);
n = QLatin1String("44");
@@ -2742,6 +2789,9 @@ void tst_QVariant::task172061_invalidDate() const
variant = foo;
QVERIFY(!variant.convert(QVariant::Double));
+
+ variant = foo;
+ QVERIFY(!variant.convert(QVariant::Type(QMetaType::Float)));
}
struct WontCompare
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index 9547c8f..b32bc4d 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -283,6 +283,8 @@ private slots:
void render_task217815();
void render_windowOpacity();
void render_systemClip();
+ void render_systemClip2_data();
+ void render_systemClip2();
void setContentsMargins();
@@ -6938,6 +6940,102 @@ void tst_QWidget::render_systemClip()
#endif
}
+void tst_QWidget::render_systemClip2_data()
+{
+ QTest::addColumn<bool>("autoFillBackground");
+ QTest::addColumn<bool>("usePaintEvent");
+ QTest::addColumn<QColor>("expectedColor");
+
+ QTest::newRow("Only auto-fill background") << true << false << QColor(Qt::blue);
+ QTest::newRow("Only draw in paintEvent") << false << true << QColor(Qt::green);
+ QTest::newRow("Auto-fill background and draw in paintEvent") << true << true << QColor(Qt::green);
+}
+
+void tst_QWidget::render_systemClip2()
+{
+ QFETCH(bool, autoFillBackground);
+ QFETCH(bool, usePaintEvent);
+ QFETCH(QColor, expectedColor);
+
+ Q_ASSERT_X(expectedColor != QColor(Qt::red), Q_FUNC_INFO,
+ "Qt::red is the reference color for the image, pick another color");
+
+ class MyWidget : public QWidget
+ {
+ public:
+ bool usePaintEvent;
+ void paintEvent(QPaintEvent *)
+ {
+ if (usePaintEvent)
+ QPainter(this).fillRect(rect(), Qt::green);
+ }
+ };
+
+ MyWidget widget;
+ widget.usePaintEvent = usePaintEvent;
+ widget.setPalette(Qt::blue);
+ // NB! widget.setAutoFillBackground(autoFillBackground) won't do the
+ // trick here since the widget is a top-level. The background is filled
+ // regardless, unless Qt::WA_OpaquePaintEvent or Qt::WA_NoSystemBackground
+ // is set. We therefore use the opaque attribute to turn off auto-fill.
+ if (!autoFillBackground)
+ widget.setAttribute(Qt::WA_OpaquePaintEvent);
+ widget.resize(100, 100);
+
+ QImage image(widget.size(), QImage::Format_RGB32);
+ image.fill(QColor(Qt::red).rgb());
+
+ QPaintEngine *paintEngine = image.paintEngine();
+ QVERIFY(paintEngine);
+
+ QRegion systemClip(QRegion(50, 0, 50, 10));
+ systemClip += QRegion(90, 10, 10, 40);
+ paintEngine->setSystemClip(systemClip);
+
+ // Render entire widget directly onto device.
+ widget.render(&image);
+
+#ifndef RENDER_DEBUG
+ image.save("systemclip_with_device.png");
+#endif
+ // All pixels within the system clip should now be
+ // the expectedColor, and the rest should be red.
+ for (int i = 0; i < image.height(); ++i) {
+ for (int j = 0; j < image.width(); ++j) {
+ if (systemClip.contains(QPoint(j, i)))
+ QCOMPARE(image.pixel(j, i), expectedColor.rgb());
+ else
+ QCOMPARE(image.pixel(j, i), QColor(Qt::red).rgb());
+ }
+ }
+
+ // Refill image with red.
+ image.fill(QColor(Qt::red).rgb());
+
+ // Do the same with an untransformed painter.
+ QPainter painter(&image);
+ //Make sure we're using the same paint engine and has the right clip set.
+ paintEngine->setSystemClip(systemClip);
+ QCOMPARE(painter.paintEngine(), paintEngine);
+ QCOMPARE(paintEngine->systemClip(), systemClip);
+
+ widget.render(&painter);
+
+#ifndef RENDER_DEBUG
+ image.save("systemclip_with_untransformed_painter.png");
+#endif
+ // All pixels within the system clip should now be
+ // the expectedColor, and the rest should be red.
+ for (int i = 0; i < image.height(); ++i) {
+ for (int j = 0; j < image.width(); ++j) {
+ if (systemClip.contains(QPoint(j, i)))
+ QCOMPARE(image.pixel(j, i), expectedColor.rgb());
+ else
+ QCOMPARE(image.pixel(j, i), QColor(Qt::red).rgb());
+ }
+ }
+}
+
void tst_QWidget::setContentsMargins()
{
QLabel label("why does it always rain on me?");
diff --git a/tests/auto/uiloader/baseline/css_borderimage_allwidgets.ui b/tests/auto/uiloader/baseline/css_borderimage_allwidgets.ui
new file mode 100644
index 0000000..baba66b
--- /dev/null
+++ b/tests/auto/uiloader/baseline/css_borderimage_allwidgets.ui
@@ -0,0 +1,210 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Form</class>
+ <widget class="QWidget" name="Form">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>553</width>
+ <height>368</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">* { border-image: url(&quot;images/pushbutton.png&quot;) 6 6 6 6; border-width:6px; }</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QFrame" name="frame">
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Each widget should have a background image. including the top level</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pushButton">
+ <property name="text">
+ <string>PushButton</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QProgressBar" name="progressBar">
+ <property name="value">
+ <number>24</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QWidget" name="widget" native="true">
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QPushButton" name="pushButton_2">
+ <property name="text">
+ <string>PushButton</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="spinBox"/>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="radioButton">
+ <property name="text">
+ <string>RadioButton</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QScrollArea" name="scrollArea">
+ <property name="widgetResizable">
+ <bool>true</bool>
+ </property>
+ <widget class="QWidget" name="scrollAreaWidgetContents">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>260</width>
+ <height>197</height>
+ </rect>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="2" column="0" colspan="2">
+ <widget class="QSlider" name="horizontalSlider">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLCDNumber" name="lcdNumber"/>
+ </item>
+ <item row="0" column="1">
+ <widget class="QRadioButton" name="radioButton_2">
+ <property name="text">
+ <string>RadioButton</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QRadioButton" name="radioButton_3">
+ <property name="text">
+ <string>RadioButton</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QCheckBox" name="checkBox_2">
+ <property name="text">
+ <string>CheckBox</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QCheckBox" name="checkBox_3">
+ <property name="text">
+ <string>CheckBox</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>GroupBox</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QCheckBox" name="checkBox">
+ <property name="text">
+ <string>CheckBox</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="lineEdit">
+ <property name="text">
+ <string>Line Edit</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QListWidget" name="listWidget">
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/tests/auto/uiloader/baseline/images/splitter_horizontal.png b/tests/auto/uiloader/baseline/images/splitter_horizontal.png
new file mode 100644
index 0000000..66107cf
--- /dev/null
+++ b/tests/auto/uiloader/baseline/images/splitter_horizontal.png
Binary files differ
diff --git a/tests/auto/uiloader/baseline/images/splitter_vertical.png b/tests/auto/uiloader/baseline/images/splitter_vertical.png
new file mode 100644
index 0000000..f907c0b
--- /dev/null
+++ b/tests/auto/uiloader/baseline/images/splitter_vertical.png
Binary files differ
diff --git a/tools/assistant/tools/assistant/centralwidget.cpp b/tools/assistant/tools/assistant/centralwidget.cpp
index 1b0e671..f953ab7 100644
--- a/tools/assistant/tools/assistant/centralwidget.cpp
+++ b/tools/assistant/tools/assistant/centralwidget.cpp
@@ -72,7 +72,8 @@
QT_BEGIN_NAMESPACE
namespace {
- HelpViewer* helpViewerFromTabPosition(const QTabWidget *widget, const QPoint &point)
+ HelpViewer* helpViewerFromTabPosition(const QTabWidget *widget,
+ const QPoint &point)
{
QTabBar *tabBar = qFindChild<QTabBar*>(widget);
for (int i = 0; i < tabBar->count(); ++i) {
@@ -87,38 +88,32 @@ namespace {
FindWidget::FindWidget(QWidget *parent)
: QWidget(parent)
{
- QString system = QLatin1String("win");
QHBoxLayout *hboxLayout = new QHBoxLayout(this);
-#ifdef Q_OS_MAC
- system = QLatin1String("mac");
-#else
- hboxLayout->setSpacing(6);
+ QString resourcePath = QLatin1String(":/trolltech/assistant/images/");
+
+#ifndef Q_OS_MAC
hboxLayout->setMargin(0);
+ hboxLayout->setSpacing(6);
+ resourcePath.append(QLatin1String("win"));
+#else
+ resourcePath.append(QLatin1String("mac"));
#endif
- toolClose = new QToolButton(this);
- toolClose->setIcon(QIcon(QString::fromUtf8(":/trolltech/assistant/images/%1/closetab.png").arg(system)));
- toolClose->setAutoRaise(true);
+ toolClose = setupToolButton(QLatin1String(""),
+ resourcePath + QLatin1String("/closetab.png"));
hboxLayout->addWidget(toolClose);
editFind = new QLineEdit(this);
- editFind->setMinimumSize(QSize(150, 0));
- connect(editFind, SIGNAL(textChanged(const QString&)),
- this, SLOT(updateButtons()));
hboxLayout->addWidget(editFind);
+ editFind->setMinimumSize(QSize(150, 0));
+ connect(editFind, SIGNAL(textChanged(QString)), this, SLOT(updateButtons()));
- toolPrevious = new QToolButton(this);
- toolPrevious->setAutoRaise(true);
- toolPrevious->setText(tr("Previous"));
- toolPrevious->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
- toolPrevious->setIcon(QIcon(QString::fromUtf8(":/trolltech/assistant/images/%1/previous.png").arg(system)));
+ toolPrevious = setupToolButton(tr("Previous"),
+ resourcePath + QLatin1String("/previous.png"));
hboxLayout->addWidget(toolPrevious);
- toolNext = new QToolButton(this);
- toolNext->setAutoRaise(true);
- toolNext->setText(tr("Next"));
- toolNext->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
- toolNext->setIcon(QIcon(QString::fromUtf8(":/trolltech/assistant/images/%1/next.png").arg(system)));
+ toolNext = setupToolButton(tr("Next"),
+ resourcePath + QLatin1String("/next.png"));
hboxLayout->addWidget(toolNext);
checkCase = new QCheckBox(tr("Case Sensitive"), this);
@@ -131,15 +126,17 @@ FindWidget::FindWidget(QWidget *parent)
#endif
labelWrapped = new QLabel(this);
+ labelWrapped->setScaledContents(true);
+ labelWrapped->setTextFormat(Qt::RichText);
labelWrapped->setMinimumSize(QSize(0, 20));
labelWrapped->setMaximumSize(QSize(105, 20));
- labelWrapped->setTextFormat(Qt::RichText);
- labelWrapped->setScaledContents(true);
- labelWrapped->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter);
- labelWrapped->setText(tr("<img src=\":/trolltech/assistant/images/wrap.png\">&nbsp;Search wrapped"));
+ labelWrapped->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
+ labelWrapped->setText(tr("<img src=\":/trolltech/assistant/images/wrap.png\""
+ ">&nbsp;Search wrapped"));
hboxLayout->addWidget(labelWrapped);
- QSpacerItem *spacerItem = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+ QSpacerItem *spacerItem = new QSpacerItem(20, 20, QSizePolicy::Expanding,
+ QSizePolicy::Minimum);
hboxLayout->addItem(spacerItem);
setMinimumWidth(minimumSizeHint().width());
labelWrapped->hide();
@@ -162,38 +159,54 @@ void FindWidget::updateButtons()
}
}
+QToolButton* FindWidget::setupToolButton(const QString &text, const QString &icon)
+{
+ QToolButton *toolButton = new QToolButton(this);
+
+ toolButton->setText(text);
+ toolButton->setAutoRaise(true);
+ toolButton->setIcon(QIcon(icon));
+ toolButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
+
+ return toolButton;
+}
+
+
+// --
+
CentralWidget::CentralWidget(QHelpEngine *engine, MainWindow *parent)
: QWidget(parent)
+ , lastTabPage(0)
+ , collectionFile(engine->collectionFile())
, findBar(0)
, tabWidget(0)
+ , findWidget(0)
, helpEngine(engine)
, printer(0)
+ , usesDefaultCollection(parent->usesDefaultCollection())
, m_searchWidget(0)
{
- staticCentralWidget = this;
-
- lastTabPage = 0;
globalActionList.clear();
- collectionFile = helpEngine->collectionFile();
- usesDefaultCollection = parent->usesDefaultCollection();
-
- QString system = QLatin1String("win");
+ staticCentralWidget = this;
QVBoxLayout *vboxLayout = new QVBoxLayout(this);
+ QString resourcePath = QLatin1String(":/trolltech/assistant/images/");
-#ifdef Q_OS_MAC
- system = QLatin1String("mac");
-#else
+#ifndef Q_OS_MAC
vboxLayout->setMargin(0);
+ resourcePath.append(QLatin1String("win"));
+#else
+ resourcePath.append(QLatin1String("mac"));
#endif
tabWidget = new QTabWidget(this);
- connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(currentPageChanged(int)));
+ connect(tabWidget, SIGNAL(currentChanged(int)), this,
+ SLOT(currentPageChanged(int)));
QToolButton *newTabButton = new QToolButton(this);
newTabButton->setAutoRaise(true);
newTabButton->setToolTip(tr("Add new page"));
- newTabButton->setIcon(QIcon(QString::fromUtf8(":/trolltech/assistant/images/%1/addtab.png").arg(system)));
+ newTabButton->setIcon(QIcon(resourcePath + QLatin1String("/addtab.png")));
tabWidget->setCornerWidget(newTabButton, Qt::TopLeftCorner);
connect(newTabButton, SIGNAL(clicked()), this, SLOT(newTab()));
@@ -202,7 +215,7 @@ CentralWidget::CentralWidget(QHelpEngine *engine, MainWindow *parent)
closeTabButton->setEnabled(false);
closeTabButton->setAutoRaise(true);
closeTabButton->setToolTip(tr("Close current page"));
- closeTabButton->setIcon(QIcon(QString::fromUtf8(":/trolltech/assistant/images/%1/closetab.png").arg(system)));
+ closeTabButton->setIcon(QIcon(resourcePath + QLatin1String("/closetab.png")));
tabWidget->setCornerWidget(closeTabButton, Qt::TopRightCorner);
connect(closeTabButton, SIGNAL(clicked()), this, SLOT(closeTab()));
@@ -216,19 +229,20 @@ CentralWidget::CentralWidget(QHelpEngine *engine, MainWindow *parent)
vboxLayout->addWidget(findBar);
findBar->hide();
findWidget->editFind->installEventFilter(this);
- connect(findWidget->toolClose, SIGNAL(clicked()), findBar, SLOT(hide()));
+ connect(findWidget->toolClose, SIGNAL(clicked()), findBar, SLOT(hide()));
connect(findWidget->toolNext, SIGNAL(clicked()), this, SLOT(findNext()));
connect(findWidget->editFind, SIGNAL(returnPressed()), this, SLOT(findNext()));
- connect(findWidget->editFind, SIGNAL(textChanged(const QString&)), this, SLOT(findCurrentText(const QString&)));
+ connect(findWidget->editFind, SIGNAL(textChanged(QString)), this,
+ SLOT(findCurrentText(QString)));
connect(findWidget->toolPrevious, SIGNAL(clicked()), this, SLOT(findPrevious()));
QTabBar *tabBar = qFindChild<QTabBar*>(tabWidget);
if (tabBar) {
tabBar->installEventFilter(this);
tabBar->setContextMenuPolicy(Qt::CustomContextMenu);
- connect(tabBar, SIGNAL(customContextMenuRequested(const QPoint&)),
- this, SLOT(showTabBarContextMenu(const QPoint&)));
+ connect(tabBar, SIGNAL(customContextMenuRequested(QPoint)), this,
+ SLOT(showTabBarContextMenu(QPoint)));
}
QPalette p = qApp->palette();
@@ -247,19 +261,17 @@ CentralWidget::~CentralWidget()
QString zoomCount;
QString currentPages;
- QLatin1Char sep('|');
- for (int i = 1; i < tabWidget->count(); ++i) {
+ QLatin1Char separator('|');
+ int i = m_searchWidget->isAttached() ? 1 : 0;
+
+ for (; i < tabWidget->count(); ++i) {
HelpViewer *viewer = qobject_cast<HelpViewer*>(tabWidget->widget(i));
if (viewer && viewer->source().isValid()) {
- currentPages.append(viewer->source().toString()).append(sep);
-#if !defined(QT_NO_WEBKIT)
- zoomCount.append(QString::number(viewer->textSizeMultiplier())).
- append(sep);
-#else
- zoomCount.append(QString::number(viewer->zoom())).append(sep);
-#endif
+ currentPages += viewer->source().toString() + separator;
+ zoomCount += QString::number(viewer->zoom()) + separator;
}
}
+
engine.setCustomValue(QLatin1String("LastTabPage"), lastTabPage);
engine.setCustomValue(QLatin1String("LastShownPages"), currentPages);
#if !defined(QT_NO_WEBKIT)
@@ -276,14 +288,18 @@ CentralWidget *CentralWidget::instance()
void CentralWidget::newTab()
{
- HelpViewer* viewer = currentHelpViewer();
+ HelpViewer *viewer = currentHelpViewer();
+#if !defined(QT_NO_WEBKIT)
+ if (viewer && viewer->hasLoadFinished())
+#else
if (viewer)
+#endif
setSourceInNewTab(viewer->source());
}
void CentralWidget::zoomIn()
{
- HelpViewer* viewer = currentHelpViewer();
+ HelpViewer *viewer = currentHelpViewer();
if (viewer)
viewer->zoomIn();
@@ -293,7 +309,7 @@ void CentralWidget::zoomIn()
void CentralWidget::zoomOut()
{
- HelpViewer* viewer = currentHelpViewer();
+ HelpViewer *viewer = currentHelpViewer();
if (viewer)
viewer->zoomOut();
@@ -316,7 +332,7 @@ void CentralWidget::nextPage()
void CentralWidget::resetZoom()
{
- HelpViewer* viewer = currentHelpViewer();
+ HelpViewer *viewer = currentHelpViewer();
if (viewer)
viewer->resetZoom();
@@ -340,7 +356,7 @@ void CentralWidget::findPrevious()
void CentralWidget::closeTab()
{
- HelpViewer* viewer = currentHelpViewer();
+ HelpViewer *viewer = currentHelpViewer();
if (!viewer|| tabWidget->count() == 1)
return;
@@ -350,8 +366,8 @@ void CentralWidget::closeTab()
void CentralWidget::setSource(const QUrl &url)
{
- HelpViewer* viewer = currentHelpViewer();
- HelpViewer* lastViewer = qobject_cast<HelpViewer*>(tabWidget->widget(lastTabPage));
+ HelpViewer *viewer = currentHelpViewer();
+ HelpViewer *lastViewer = qobject_cast<HelpViewer*>(tabWidget->widget(lastTabPage));
if (!viewer && !lastViewer) {
viewer = new HelpViewer(helpEngine, this);
@@ -359,8 +375,9 @@ void CentralWidget::setSource(const QUrl &url)
lastTabPage = tabWidget->addTab(viewer, QString());
tabWidget->setCurrentIndex(lastTabPage);
connectSignals();
- } else
+ } else {
viewer = lastViewer;
+ }
viewer->setSource(url);
currentPageChanged(lastTabPage);
@@ -371,48 +388,46 @@ void CentralWidget::setSource(const QUrl &url)
void CentralWidget::setLastShownPages()
{
+ const QLatin1String key("LastShownPages");
+ QString value = helpEngine->customValue(key, QString()).toString();
+ const QStringList lastShownPageList = value.split(QLatin1Char('|'),
+ QString::SkipEmptyParts);
+
+ const int pageCount = lastShownPageList.count();
+ if (pageCount == 0 && usesDefaultCollection)
+ return setSource(QUrl(QLatin1String("help")));
+
#if !defined(QT_NO_WEBKIT)
- QLatin1String zoom("LastPagesZoomWebView");
+ const QLatin1String zoom("LastPagesZoomWebView");
#else
- QLatin1String zoom("LastPagesZoomTextBrowser");
+ const QLatin1String zoom("LastPagesZoomTextBrowser");
#endif
- const QStringList lastShownPageList =
- helpEngine->customValue(QLatin1String("LastShownPages")).toString().
- split(QLatin1Char('|'), QString::SkipEmptyParts);
-
- if (!lastShownPageList.isEmpty()) {
- QVector<QString>zoomList = helpEngine->customValue(zoom).toString().
- split(QLatin1Char('|'), QString::SkipEmptyParts).toVector();
- if (zoomList.isEmpty())
- zoomList.fill(QLatin1String("0.0"), lastShownPageList.size());
- else if(zoomList.count() < lastShownPageList.count()) {
- zoomList.insert(zoomList.count(),
- lastShownPageList.count() - zoomList.count(), QLatin1String("0.0"));
- }
+ value = helpEngine->customValue(zoom, QString()).toString();
+ QVector<QString> zoomVector = value.split(QLatin1Char('|'),
+ QString::SkipEmptyParts).toVector();
- QVector<QString>::const_iterator zIt = zoomList.constBegin();
- QStringList::const_iterator it = lastShownPageList.constBegin();
- for (; it != lastShownPageList.constEnd(); ++it, ++zIt)
- setSourceInNewTab((*it), (*zIt).toFloat());
+ const int zoomCount = zoomVector.count();
+ zoomVector.insert(zoomCount, pageCount - zoomCount, QLatin1String("0.0"));
- tabWidget->setCurrentIndex(helpEngine->customValue(
- QLatin1String("LastTabPage"), 1).toInt());
- } else {
- if (usesDefaultCollection)
- setSource(QUrl(QLatin1String("help")));
- }
+ QVector<QString>::const_iterator zIt = zoomVector.constBegin();
+ QStringList::const_iterator it = lastShownPageList.constBegin();
+ for (; it != lastShownPageList.constEnd(); ++it, ++zIt)
+ setSourceInNewTab((*it), (*zIt).toFloat());
+
+ const QLatin1String lastTab("LastTabPage");
+ tabWidget->setCurrentIndex(helpEngine->customValue(lastTab, 1).toInt());
}
bool CentralWidget::hasSelection() const
{
- const HelpViewer* viewer = currentHelpViewer();
+ const HelpViewer *viewer = currentHelpViewer();
return viewer ? viewer->hasSelection() : false;
}
QUrl CentralWidget::currentSource() const
{
- const HelpViewer* viewer = currentHelpViewer();
+ const HelpViewer *viewer = currentHelpViewer();
if (viewer)
return viewer->source();
@@ -421,7 +436,7 @@ QUrl CentralWidget::currentSource() const
QString CentralWidget::currentTitle() const
{
- const HelpViewer* viewer = currentHelpViewer();
+ const HelpViewer *viewer = currentHelpViewer();
if (viewer)
return viewer->documentTitle();
@@ -430,7 +445,7 @@ QString CentralWidget::currentTitle() const
void CentralWidget::copySelection()
{
- HelpViewer* viewer = currentHelpViewer();
+ HelpViewer *viewer = currentHelpViewer();
if (viewer)
viewer->copy();
}
@@ -453,7 +468,7 @@ void CentralWidget::initPrinter()
void CentralWidget::print()
{
#ifndef QT_NO_PRINTER
- HelpViewer* viewer = currentHelpViewer();
+ HelpViewer *viewer = currentHelpViewer();
if (!viewer)
return;
@@ -479,7 +494,8 @@ void CentralWidget::printPreview()
#ifndef QT_NO_PRINTER
initPrinter();
QPrintPreviewDialog preview(printer, this);
- connect(&preview, SIGNAL(paintRequested(QPrinter *)), SLOT(printPreview(QPrinter *)));
+ connect(&preview, SIGNAL(paintRequested(QPrinter*)),
+ SLOT(printPreview(QPrinter*)));
preview.exec();
#endif
}
@@ -509,14 +525,14 @@ bool CentralWidget::isHomeAvailable() const
void CentralWidget::home()
{
- HelpViewer* viewer = currentHelpViewer();
+ HelpViewer *viewer = currentHelpViewer();
if (viewer)
viewer->home();
}
bool CentralWidget::isForwardAvailable() const
{
- const HelpViewer* viewer = currentHelpViewer();
+ const HelpViewer *viewer = currentHelpViewer();
if (viewer)
return viewer->isForwardAvailable();
@@ -525,14 +541,14 @@ bool CentralWidget::isForwardAvailable() const
void CentralWidget::forward()
{
- HelpViewer* viewer = currentHelpViewer();
+ HelpViewer *viewer = currentHelpViewer();
if (viewer)
viewer->forward();
}
bool CentralWidget::isBackwardAvailable() const
{
- const HelpViewer* viewer = currentHelpViewer();
+ const HelpViewer *viewer = currentHelpViewer();
if (viewer)
return viewer->isBackwardAvailable();
@@ -541,7 +557,7 @@ bool CentralWidget::isBackwardAvailable() const
void CentralWidget::backward()
{
- HelpViewer* viewer = currentHelpViewer();
+ HelpViewer *viewer = currentHelpViewer();
if (viewer)
viewer->backward();
}
@@ -559,7 +575,7 @@ void CentralWidget::setGlobalActions(const QList<QAction*> &actions)
void CentralWidget::setSourceInNewTab(const QUrl &url, qreal zoom)
{
- HelpViewer* viewer;
+ HelpViewer *viewer;
#if defined(QT_NO_WEBKIT)
viewer = currentHelpViewer();
@@ -582,20 +598,20 @@ void CentralWidget::setSourceInNewTab(const QUrl &url, qreal zoom)
}
#if !defined(QT_NO_WEBKIT)
- QWebSettings* settings = QWebSettings::globalSettings();
+ QWebSettings *settings = QWebSettings::globalSettings();
if (!userFont) {
int fontSize = settings->fontSize(QWebSettings::DefaultFontSize);
QString fontFamily = settings->fontFamily(QWebSettings::StandardFont);
font = QFont(fontFamily, fontSize);
}
- QWebView* view = qobject_cast<QWebView*> (viewer);
+ QWebView *view = qobject_cast<QWebView*> (viewer);
if (view) {
settings = view->settings();
settings->setFontFamily(QWebSettings::StandardFont, font.family());
settings->setFontSize(QWebSettings::DefaultFontSize, font.pointSize());
} else if (viewer) {
- viewer->setFont(font);
+ viewer->setFont(font);
}
viewer->setTextSizeMultiplier(zoom == 0.0 ? 1.0 : zoom);
#else
@@ -609,7 +625,7 @@ void CentralWidget::setSourceInNewTab(const QUrl &url, qreal zoom)
HelpViewer *CentralWidget::newEmptyTab()
{
- HelpViewer* viewer = new HelpViewer(helpEngine, this);
+ HelpViewer *viewer = new HelpViewer(helpEngine, this);
viewer->installEventFilter(this);
viewer->setFocus(Qt::OtherFocusReason);
#if defined(QT_NO_WEBKIT)
@@ -628,15 +644,20 @@ void CentralWidget::findCurrentText(const QString &text)
void CentralWidget::connectSignals()
{
- const HelpViewer* viewer = currentHelpViewer();
+ const HelpViewer *viewer = currentHelpViewer();
if (viewer) {
- connect(viewer, SIGNAL(copyAvailable(bool)), this, SIGNAL(copyAvailable(bool)));
- connect(viewer, SIGNAL(forwardAvailable(bool)), this, SIGNAL(forwardAvailable(bool)));
- connect(viewer, SIGNAL(backwardAvailable(bool)), this, SIGNAL(backwardAvailable(bool)));
- connect(viewer, SIGNAL(sourceChanged(const QUrl&)), this, SIGNAL(sourceChanged(const QUrl&)));
- connect(viewer, SIGNAL(highlighted(const QString&)), this, SIGNAL(highlighted(const QString&)));
-
- connect(viewer, SIGNAL(sourceChanged(const QUrl&)), this, SLOT(setTabTitle(const QUrl&)));
+ connect(viewer, SIGNAL(copyAvailable(bool)), this,
+ SIGNAL(copyAvailable(bool)));
+ connect(viewer, SIGNAL(forwardAvailable(bool)), this,
+ SIGNAL(forwardAvailable(bool)));
+ connect(viewer, SIGNAL(backwardAvailable(bool)), this,
+ SIGNAL(backwardAvailable(bool)));
+ connect(viewer, SIGNAL(sourceChanged(QUrl)), this,
+ SIGNAL(sourceChanged(QUrl)));
+ connect(viewer, SIGNAL(highlighted(QString)), this,
+ SIGNAL(highlighted(QString)));
+ connect(viewer, SIGNAL(sourceChanged(QUrl)), this,
+ SLOT(setTabTitle(QUrl)));
}
}
@@ -658,85 +679,72 @@ void CentralWidget::activateTab(bool onlyHelpViewer)
}
}
-void CentralWidget::setTabTitle(const QUrl& url)
+void CentralWidget::setTabTitle(const QUrl &url)
{
- int tab = lastTabPage;
- HelpViewer* viewer = currentHelpViewer();
-
+ Q_UNUSED(url)
#if !defined(QT_NO_WEBKIT)
- if (!viewer || viewer->source() != url) {
- QTabBar *tabBar = qFindChild<QTabBar*>(tabWidget);
- for (tab = 0; tab < tabBar->count(); ++tab) {
- viewer = qobject_cast<HelpViewer*>(tabWidget->widget(tab));
- if (viewer && viewer->source() == url)
- break;
- }
+ QTabBar *tabBar = qFindChild<QTabBar*>(tabWidget);
+ for (int tab = 0; tab < tabBar->count(); ++tab) {
+ HelpViewer *viewer = qobject_cast<HelpViewer*>(tabWidget->widget(tab));
+ if (viewer)
+ tabWidget->setTabText(tab, viewer->documentTitle().trimmed());
}
#else
- Q_UNUSED(url)
-#endif
-
+ HelpViewer *viewer = currentHelpViewer();
if (viewer) {
- tabWidget->setTabText(tab,
+ tabWidget->setTabText(lastTabPage,
quoteTabTitle(viewer->documentTitle().trimmed()));
}
+#endif
}
void CentralWidget::currentPageChanged(int index)
{
const HelpViewer *viewer = currentHelpViewer();
-
- if (viewer || tabWidget->count() == 1)
+ if (viewer)
lastTabPage = index;
- bool enabled = false;
- if (viewer) {
- enabled = true;
- if (!m_searchWidget)
- enabled = tabWidget->count() > 1;
- }
+ QWidget *widget = tabWidget->cornerWidget(Qt::TopRightCorner);
+ widget->setEnabled(viewer && enableTabCloseAction());
- tabWidget->cornerWidget(Qt::TopRightCorner)->setEnabled(enabled);
- tabWidget->cornerWidget(Qt::TopLeftCorner)->setEnabled(m_searchWidget ? enabled : true);
+ widget = tabWidget->cornerWidget(Qt::TopLeftCorner);
+ widget->setEnabled(viewer ? true : false);
- emit currentViewerChanged();
+ emit currentViewerChanged();
}
void CentralWidget::showTabBarContextMenu(const QPoint &point)
{
- HelpViewer* viewer = helpViewerFromTabPosition(tabWidget, point);
+ HelpViewer *viewer = helpViewerFromTabPosition(tabWidget, point);
if (!viewer)
return;
QTabBar *tabBar = qFindChild<QTabBar*>(tabWidget);
QMenu menu(QLatin1String(""), tabBar);
- QAction *new_page = menu.addAction(tr("Add New Page"));
- QAction *close_page = menu.addAction(tr("Close This Page"));
- QAction *close_pages = menu.addAction(tr("Close Other Pages"));
- menu.addSeparator();
- QAction *newBookmark = menu.addAction(tr("Add Bookmark for this Page..."));
+ QAction *newPage = menu.addAction(tr("Add New Page"));
- if (tabBar->count() == 1) {
- close_page->setEnabled(false);
- close_pages->setEnabled(false);
- } else if (m_searchWidget && tabBar->count() == 2) {
- close_pages->setEnabled(false);
- }
+ bool enableAction = enableTabCloseAction();
+ QAction *closePage = menu.addAction(tr("Close This Page"));
+ closePage->setEnabled(enableAction);
- QAction *picked_action = menu.exec(tabBar->mapToGlobal(point));
- if (!picked_action)
- return;
+ QAction *closePages = menu.addAction(tr("Close Other Pages"));
+ closePages->setEnabled(enableAction);
+
+ menu.addSeparator();
- if (picked_action == new_page)
+ QAction *newBookmark = menu.addAction(tr("Add Bookmark for this Page..."));
+
+ QAction *pickedAction = menu.exec(tabBar->mapToGlobal(point));
+ if (pickedAction == newPage)
setSourceInNewTab(viewer->source());
- if (picked_action == close_page) {
+ if (pickedAction == closePage) {
tabWidget->removeTab(tabWidget->indexOf(viewer));
QTimer::singleShot(0, viewer, SLOT(deleteLater()));
}
- if (picked_action == close_pages) {
+ if (pickedAction == closePages) {
int currentPage = tabWidget->indexOf(viewer);
for (int i = tabBar->count() -1; i >= 0; --i) {
viewer = qobject_cast<HelpViewer*>(tabWidget->widget(i));
@@ -750,58 +758,68 @@ void CentralWidget::showTabBarContextMenu(const QPoint &point)
}
}
- if (picked_action == newBookmark)
+ if (pickedAction == newBookmark)
emit addNewBookmark(viewer->documentTitle(), viewer->source().toString());
}
bool CentralWidget::eventFilter(QObject *object, QEvent *e)
{
- if (currentHelpViewer() == object && e->type() == QEvent::KeyPress){
+ if (e->type() == QEvent::KeyPress) {
QKeyEvent *ke = static_cast<QKeyEvent*>(e);
- if (ke->key() == Qt::Key_Backspace) {
- HelpViewer *viewer = currentHelpViewer();
+ switch (ke->key()) {
+ default: {
+ return QWidget::eventFilter(object, e);
+ } break;
+
+ case Qt::Key_Escape: {
+ if (findWidget->editFind == object) {
+ findBar->hide();
+ if (HelpViewer *viewer = currentHelpViewer())
+ viewer->setFocus();
+ }
+ } break;
+
+ case Qt::Key_Backspace: {
+ HelpViewer *viewer = currentHelpViewer();
+ if (viewer == object) {
#if defined(QT_NO_WEBKIT)
- if (viewer && viewer->isBackwardAvailable()) {
+ if (viewer->isBackwardAvailable()) {
#else
- if (viewer && viewer->isBackwardAvailable() && !viewer->hasFocus()) {
+ if (viewer->isBackwardAvailable() && !viewer->hasFocus()) {
#endif
- viewer->backward();
- return true;
- }
+ viewer->backward();
+ return true;
+ }
+ }
+ } break;
}
}
- QTabBar *tabBar = qobject_cast<QTabBar*>(object);
- bool mousRel = e->type() == QEvent::MouseButtonRelease;
- bool dblClick = e->type() == QEvent::MouseButtonDblClick;
-
- if (tabBar && (mousRel || dblClick)) {
- QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(e);
- HelpViewer *viewer = helpViewerFromTabPosition(tabWidget, mouseEvent->pos());
- if (!m_searchWidget && tabWidget->count() <= 1)
- return QWidget::eventFilter(object, e);
-
- if (viewer && (mouseEvent->button() == Qt::MidButton || dblClick)) {
- tabWidget->removeTab(tabWidget->indexOf(viewer));
- QTimer::singleShot(0, viewer, SLOT(deleteLater()));
- currentPageChanged(tabWidget->currentIndex());
- return true;
- }
- } else if (object == findWidget->editFind && e->type() == QEvent::KeyPress) {
- QKeyEvent *ke = static_cast<QKeyEvent*>(e);
- if (ke->key() == Qt::Key_Escape) {
- findBar->hide();
- HelpViewer *hv = currentHelpViewer();
- if (hv)
- hv->setFocus();
+ if (QTabBar *tabBar = qobject_cast<QTabBar*>(object)) {
+ const bool dblClick = e->type() == QEvent::MouseButtonDblClick;
+ if ((e->type() == QEvent::MouseButtonRelease) || dblClick) {
+ QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(e);
+ HelpViewer *viewer = helpViewerFromTabPosition(tabWidget,
+ mouseEvent->pos());
+ if (viewer) {
+ if ((mouseEvent->button() == Qt::MidButton) || dblClick) {
+ if (availableHelpViewer() > 1) {
+ tabWidget->removeTab(tabWidget->indexOf(viewer));
+ QTimer::singleShot(0, viewer, SLOT(deleteLater()));
+ currentPageChanged(tabWidget->currentIndex());
+ return true;
+ }
+ }
+ }
}
}
+
return QWidget::eventFilter(object, e);
}
void CentralWidget::keyPressEvent(QKeyEvent *e)
{
- QString text = e->text();
+ const QString &text = e->text();
if (text.startsWith(QLatin1Char('/'))) {
if (!findBar->isVisible()) {
findBar->show();
@@ -821,7 +839,7 @@ void CentralWidget::find(QString ttf, bool forward, bool backward)
QTextDocument *doc = 0;
QTextBrowser *browser = 0;
- HelpViewer* viewer = currentHelpViewer();
+ HelpViewer *viewer = currentHelpViewer();
QPalette p = findWidget->editFind->palette();
p.setColor(QPalette::Active, QPalette::Base, Qt::white);
@@ -860,7 +878,7 @@ void CentralWidget::find(QString ttf, bool forward, bool backward)
}
if (tabWidget->currentWidget() == m_searchWidget) {
- QTextBrowser* browser = qFindChild<QTextBrowser*>(m_searchWidget);
+ QTextBrowser *browser = qFindChild<QTextBrowser*>(m_searchWidget);
if (browser) {
doc = browser->document();
cursor = browser->textCursor();
@@ -872,8 +890,10 @@ void CentralWidget::find(QString ttf, bool forward, bool backward)
QTextDocument::FindFlags options;
- if (cursor.hasSelection())
- cursor.setPosition(forward ? cursor.position() : cursor.anchor(), QTextCursor::MoveAnchor);
+ if (cursor.hasSelection()) {
+ cursor.setPosition(forward ? cursor.position() : cursor.anchor(),
+ QTextCursor::MoveAnchor);
+ }
QTextCursor newCursor = cursor;
@@ -915,15 +935,6 @@ void CentralWidget::find(QString ttf, bool forward, bool backward)
findWidget->editFind->setPalette(p);
}
-void CentralWidget::activateSearch()
-{
- if (tabWidget->widget(0) != m_searchWidget)
- createSearchWidget(helpEngine->searchEngine());
-
- tabWidget->setCurrentWidget(m_searchWidget);
- m_searchWidget->setFocus();
-}
-
void CentralWidget::updateBrowserFont()
{
QFont font = qApp->font();
@@ -934,7 +945,7 @@ void CentralWidget::updateBrowserFont()
}
#if !defined(QT_NO_WEBKIT)
- QWebSettings* settings = QWebSettings::globalSettings();
+ QWebSettings *settings = QWebSettings::globalSettings();
if (!userFont) {
int fontSize = settings->fontSize(QWebSettings::DefaultFontSize);
QString fontFamily = settings->fontFamily(QWebSettings::StandardFont);
@@ -942,11 +953,11 @@ void CentralWidget::updateBrowserFont()
}
#endif
- QWidget* widget = 0;
+ QWidget *widget = 0;
for (int i = 0; i < tabWidget->count(); ++i) {
widget = tabWidget->widget(i);
#if !defined(QT_NO_WEBKIT)
- QWebView* view = qobject_cast<QWebView*> (widget);
+ QWebView *view = qobject_cast<QWebView*> (widget);
if (view) {
settings = view->settings();
settings->setFontFamily(QWebSettings::StandardFont, font.family());
@@ -967,17 +978,47 @@ void CentralWidget::createSearchWidget(QHelpSearchEngine *searchEngine)
{
if (!m_searchWidget) {
m_searchWidget = new SearchWidget(searchEngine, this);
- connect(m_searchWidget, SIGNAL(requestShowLink(const QUrl&)), this,
- SLOT(setSourceFromSearch(const QUrl&)));
- connect(m_searchWidget, SIGNAL(requestShowLinkInNewTab(const QUrl&)), this,
- SLOT(setSourceFromSearchInNewTab(const QUrl&)));
+ connect(m_searchWidget, SIGNAL(requestShowLink(QUrl)), this,
+ SLOT(setSourceFromSearch(QUrl)));
+ connect(m_searchWidget, SIGNAL(requestShowLinkInNewTab(QUrl)), this,
+ SLOT(setSourceFromSearchInNewTab(QUrl)));
}
tabWidget->insertTab(0, m_searchWidget, tr("Search"));
+ m_searchWidget->setAttached(true);
+}
+
+void CentralWidget::activateSearchWidget()
+{
+ if (!m_searchWidget->isAttached())
+ createSearchWidget(helpEngine->searchEngine());
+
+ tabWidget->setCurrentWidget(m_searchWidget);
+ m_searchWidget->setFocus();
}
void CentralWidget::removeSearchWidget()
{
- tabWidget->removeTab(0);
+ if (m_searchWidget && m_searchWidget->isAttached()) {
+ tabWidget->removeTab(0);
+ m_searchWidget->setAttached(false);
+ }
+}
+
+int CentralWidget::availableHelpViewer() const
+{
+ int count = tabWidget->count();
+ if (m_searchWidget && m_searchWidget->isAttached())
+ count--;
+ return count;
+}
+
+bool CentralWidget::enableTabCloseAction() const
+{
+ int minTabCount = 1;
+ if (m_searchWidget && m_searchWidget->isAttached())
+ minTabCount = 2;
+
+ return (tabWidget->count() > minTabCount);
}
QString CentralWidget::quoteTabTitle(const QString &title) const
@@ -1008,7 +1049,7 @@ CentralWidget::highlightSearchTerms()
if (!viewer)
return;
- QHelpSearchEngine* searchEngine = helpEngine->searchEngine();
+ QHelpSearchEngine *searchEngine = helpEngine->searchEngine();
QList<QHelpSearchQuery> queryList = searchEngine->query();
QStringList terms;
diff --git a/tools/assistant/tools/assistant/centralwidget.h b/tools/assistant/tools/assistant/centralwidget.h
index 75bd8be..2c28091 100644
--- a/tools/assistant/tools/assistant/centralwidget.h
+++ b/tools/assistant/tools/assistant/centralwidget.h
@@ -83,6 +83,9 @@ private slots:
void updateButtons();
private:
+ QToolButton* setupToolButton(const QString &text, const QString &icon);
+
+private:
QLineEdit *editFind;
QCheckBox *checkCase;
QLabel *labelWrapped;
@@ -113,10 +116,14 @@ public:
void setGlobalActions(const QList<QAction*> &actions);
HelpViewer *currentHelpViewer() const;
void activateTab(bool onlyHelpViewer = false);
- void activateSearch();
+
void createSearchWidget(QHelpSearchEngine *searchEngine);
+ void activateSearchWidget();
void removeSearchWidget();
+ int availableHelpViewer() const;
+ bool enableTabCloseAction() const;
+
void closeTabAt(int index);
QMap<int, QString> currentSourceFileList() const;
@@ -167,7 +174,7 @@ private slots:
void setSourceFromSearchInNewTab(const QUrl &url);
private:
- void connectSignals();
+ void connectSignals();
bool eventFilter(QObject *object, QEvent *e);
void find(QString ttf, bool forward, bool backward);
void initPrinter();
@@ -180,13 +187,13 @@ private:
QList<QAction*> globalActionList;
QWidget *findBar;
- QTabWidget* tabWidget;
+ QTabWidget *tabWidget;
FindWidget *findWidget;
QHelpEngine *helpEngine;
QPrinter *printer;
bool usesDefaultCollection;
-
- SearchWidget* m_searchWidget;
+
+ SearchWidget *m_searchWidget;
};
QT_END_NAMESPACE
diff --git a/tools/assistant/tools/assistant/doc/assistant.qdocconf b/tools/assistant/tools/assistant/doc/assistant.qdocconf
index 0d2271d..aca97ed 100644
--- a/tools/assistant/tools/assistant/doc/assistant.qdocconf
+++ b/tools/assistant/tools/assistant/doc/assistant.qdocconf
@@ -10,8 +10,7 @@ description = "Qt Assistant"
HTML.{postheader,address} = ""
HTML.footer = "<p /><address><hr /><div align=\"center\">\n" \
"<table width=\"100%\" cellspacing=\"0\" border=\"0\"><tr class=\"address\">\n" \
- "<td width=\"30%\" align=\"left\">Copyright &copy; 2009 Nokia Corporation " \
- "and/or its subsidiary(-ies)</td>\n" \
+ "<td width=\"30%\" align=\"left\">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>\n" \
"<td width=\"40%\" align=\"center\">Trademarks</td>\n" \
- "<td width=\"30%\" align=\"right\"><div align=\"right\">Qt 4.5.1</div></td>\n" \
+ "<td width=\"30%\" align=\"right\"><div align=\"right\">Qt 4.5.2</div></td>\n" \
"</tr></table></div></address>"
diff --git a/tools/assistant/tools/assistant/helpviewer.cpp b/tools/assistant/tools/assistant/helpviewer.cpp
index f7225fa..5726136 100644
--- a/tools/assistant/tools/assistant/helpviewer.cpp
+++ b/tools/assistant/tools/assistant/helpviewer.cpp
@@ -269,7 +269,10 @@ bool HelpPage::acceptNavigationRequest(QWebFrame *,
}
HelpViewer::HelpViewer(QHelpEngine *engine, CentralWidget *parent)
- : QWebView(parent), helpEngine(engine), parentWidget(parent)
+ : QWebView(parent)
+ , helpEngine(engine)
+ , parentWidget(parent)
+ , loadFinished(false)
{
setAcceptDrops(false);
@@ -295,10 +298,12 @@ HelpViewer::HelpViewer(QHelpEngine *engine, CentralWidget *parent)
connect(page(), SIGNAL(linkHovered(QString, QString, QString)), this,
SIGNAL(highlighted(QString)));
connect(this, SIGNAL(urlChanged(QUrl)), this, SIGNAL(sourceChanged(QUrl)));
+ connect(this, SIGNAL(loadFinished(bool)), this, SLOT(setLoadFinished(bool)));
}
void HelpViewer::setSource(const QUrl &url)
{
+ loadFinished = false;
if (url.toString() == QLatin1String("help")) {
load(QUrl(QLatin1String("qthelp://com.trolltech.com."
"assistantinternal_1.0.0/assistant/assistant.html")));
@@ -385,6 +390,12 @@ void HelpViewer::mousePressEvent(QMouseEvent *event)
QWebView::mousePressEvent(event);
}
+void HelpViewer::setLoadFinished(bool ok)
+{
+ loadFinished = ok;
+ emit sourceChanged(url());
+}
+
#else // !defined(QT_NO_WEBKIT)
HelpViewer::HelpViewer(QHelpEngine *engine, CentralWidget *parent)
diff --git a/tools/assistant/tools/assistant/helpviewer.h b/tools/assistant/tools/assistant/helpviewer.h
index eea7340..37545c7 100644
--- a/tools/assistant/tools/assistant/helpviewer.h
+++ b/tools/assistant/tools/assistant/helpviewer.h
@@ -92,6 +92,10 @@ public:
{ return pageAction(QWebPage::Forward)->isEnabled(); }
inline bool isBackwardAvailable() const
{ return pageAction(QWebPage::Back)->isEnabled(); }
+ inline bool hasLoadFinished() const
+ { return loadFinished; }
+ inline qreal zoom() const
+ { return textSizeMultiplier(); }
public Q_SLOTS:
void home();
@@ -111,10 +115,12 @@ protected:
private Q_SLOTS:
void actionChanged();
+ void setLoadFinished(bool ok);
private:
QHelpEngine *helpEngine;
CentralWidget* parentWidget;
+ bool loadFinished;
};
#else
diff --git a/tools/assistant/tools/assistant/indexwindow.cpp b/tools/assistant/tools/assistant/indexwindow.cpp
index 0beb5ee..a2c0950 100644
--- a/tools/assistant/tools/assistant/indexwindow.cpp
+++ b/tools/assistant/tools/assistant/indexwindow.cpp
@@ -197,6 +197,8 @@ void IndexWindow::open(QHelpIndexWidget* indexWidget, const QModelIndex &index)
url = tc.link();
} else if (links.count() == 1) {
url = links.constBegin().value();
+ } else {
+ return;
}
if (url.path().endsWith(QLatin1String(".pdf"), Qt::CaseInsensitive))
diff --git a/tools/assistant/tools/assistant/mainwindow.cpp b/tools/assistant/tools/assistant/mainwindow.cpp
index bcafacc..426a828 100644
--- a/tools/assistant/tools/assistant/mainwindow.cpp
+++ b/tools/assistant/tools/assistant/mainwindow.cpp
@@ -86,9 +86,9 @@ QT_BEGIN_NAMESPACE
MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent)
: QMainWindow(parent)
+ , m_filterCombo(0)
, m_toolBarMenu(0)
, m_cmdLine(cmdLine)
- , m_searchWidget(0)
, m_progressWidget(0)
, m_qtDocInstaller(0)
, m_connectedInitSignals(false)
@@ -125,20 +125,7 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent)
connect(searchEngine, SIGNAL(indexingStarted()), this, SLOT(indexingStarted()));
connect(searchEngine, SIGNAL(indexingFinished()), this, SLOT(indexingFinished()));
-#ifdef QT_CLUCENE_SUPPORT
m_centralWidget->createSearchWidget(searchEngine);
-#else
- QDockWidget *dock = new QDockWidget(tr("Search"), this);
- dock->setObjectName(QLatin1String("SearchWindow"));
- m_searchWidget = new SearchWidget(searchEngine, this);
- dock->setWidget(m_searchWidget);
- addDockWidget(Qt::LeftDockWidgetArea, dock);
-
- connect(m_searchWidget, SIGNAL(requestShowLink(const QUrl&)),
- m_centralWidget, SLOT(setSource(const QUrl&)));
- connect(m_searchWidget, SIGNAL(requestShowLinkInNewTab(const QUrl&)),
- m_centralWidget, SLOT(setSourceInNewTab(const QUrl&)));
-#endif
QString defWindowTitle = tr("Qt Assistant");
setWindowTitle(defWindowTitle);
@@ -228,6 +215,20 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent)
else if (m_cmdLine->bookmarks() == CmdLineParser::Activate)
showBookmarks();
+ if (!m_cmdLine->currentFilter().isEmpty()) {
+ const QString &curFilter = m_cmdLine->currentFilter();
+ m_helpEngine->setCurrentFilter(curFilter);
+ if (m_filterCombo) {
+ int idx = m_filterCombo->findText(curFilter);
+ if (idx >= 0) {
+ bool blocked = m_filterCombo->signalsBlocked();
+ m_filterCombo->blockSignals(true);
+ m_filterCombo->setCurrentIndex(idx);
+ m_filterCombo->blockSignals(blocked);
+ }
+ }
+ }
+
if (usesDefaultCollection())
QTimer::singleShot(0, this, SLOT(lookForNewQtDocumentation()));
else
@@ -304,6 +305,7 @@ bool MainWindow::initHelpDB()
hc.addCustomFilter(tr("Unfiltered"), QStringList());
hc.setCustomValue(unfiltered, 1);
}
+
m_helpEngine->blockSignals(true);
m_helpEngine->setCurrentFilter(tr("Unfiltered"));
m_helpEngine->blockSignals(false);
@@ -318,10 +320,10 @@ bool MainWindow::initHelpDB()
void MainWindow::lookForNewQtDocumentation()
{
m_qtDocInstaller = new QtDocInstaller(m_helpEngine->collectionFile());
- connect(m_qtDocInstaller, SIGNAL(errorMessage(const QString&)),
- this, SLOT(displayInstallationError(const QString&)));
- connect(m_qtDocInstaller, SIGNAL(docsInstalled(bool)),
- this, SLOT(qtDocumentationInstalled(bool)));
+ connect(m_qtDocInstaller, SIGNAL(errorMessage(QString)), this,
+ SLOT(displayInstallationError(QString)));
+ connect(m_qtDocInstaller, SIGNAL(docsInstalled(bool)), this,
+ SLOT(qtDocumentationInstalled(bool)));
QString versionKey = QString(QLatin1String("qtVersion%1$$$qt")).
arg(QLatin1String(QT_VERSION_STR));
@@ -353,8 +355,8 @@ void MainWindow::checkInitState()
if (!m_connectedInitSignals) {
connect(m_helpEngine->contentModel(), SIGNAL(contentsCreated()),
this, SLOT(checkInitState()));
- connect(m_helpEngine->indexModel(), SIGNAL(indexCreated()),
- this, SLOT(checkInitState()));
+ connect(m_helpEngine->indexModel(), SIGNAL(indexCreated()), this,
+ SLOT(checkInitState()));
m_connectedInitSignals = true;
}
} else {
@@ -533,6 +535,8 @@ void MainWindow::setupActions()
SLOT(copyAvailable(bool)));
connect(m_centralWidget, SIGNAL(currentViewerChanged()), this,
SLOT(updateNavigationItems()));
+ connect(m_centralWidget, SIGNAL(currentViewerChanged()), this,
+ SLOT(updateTabCloseAction()));
connect(m_centralWidget, SIGNAL(forwardAvailable(bool)), this,
SLOT(updateNavigationItems()));
connect(m_centralWidget, SIGNAL(backwardAvailable(bool)), this,
@@ -601,8 +605,8 @@ void MainWindow::setupFilterToolbar()
connect(m_helpEngine, SIGNAL(setupFinished()), this,
SLOT(setupFilterCombo()));
- connect(m_filterCombo, SIGNAL(activated(const QString&)), this,
- SLOT(filterDocumentation(const QString&)));
+ connect(m_filterCombo, SIGNAL(activated(QString)), this,
+ SLOT(filterDocumentation(QString)));
setupFilterCombo();
}
@@ -626,12 +630,12 @@ void MainWindow::setupAddressToolbar()
toolBarMenu()->addAction(addressToolBar->toggleViewAction());
// address lineedit
- connect(m_addressLineEdit, SIGNAL(returnPressed()),
- this, SLOT(gotoAddress()));
- connect(m_centralWidget, SIGNAL(currentViewerChanged()),
- this, SLOT(showNewAddress()));
- connect(m_centralWidget, SIGNAL(sourceChanged(const QUrl&)),
- this, SLOT(showNewAddress(const QUrl&)));
+ connect(m_addressLineEdit, SIGNAL(returnPressed()), this,
+ SLOT(gotoAddress()));
+ connect(m_centralWidget, SIGNAL(currentViewerChanged()), this,
+ SLOT(showNewAddress()));
+ connect(m_centralWidget, SIGNAL(sourceChanged(QUrl)), this,
+ SLOT(showNewAddress(QUrl)));
}
void MainWindow::updateAboutMenuText()
@@ -695,10 +699,14 @@ void MainWindow::updateNavigationItems()
m_printAction->setEnabled(hasCurrentViewer);
m_nextAction->setEnabled(m_centralWidget->isForwardAvailable());
m_backAction->setEnabled(m_centralWidget->isBackwardAvailable());
- m_closeTabAction->setEnabled(hasCurrentViewer);
m_newTabAction->setEnabled(hasCurrentViewer);
}
+void MainWindow::updateTabCloseAction()
+{
+ m_closeTabAction->setEnabled(m_centralWidget->enableTabCloseAction());
+}
+
void MainWindow::showTopicChooser(const QMap<QString, QUrl> &links,
const QString &keyword)
{
@@ -712,10 +720,10 @@ void MainWindow::showPreferences()
{
PreferencesDialog dia(m_helpEngine, this);
- connect(&dia, SIGNAL(updateApplicationFont()),
- this, SLOT(updateApplicationFont()));
- connect(&dia, SIGNAL(updateBrowserFont()),
- m_centralWidget, SLOT(updateBrowserFont()));
+ connect(&dia, SIGNAL(updateApplicationFont()), this,
+ SLOT(updateApplicationFont()));
+ connect(&dia, SIGNAL(updateBrowserFont()), m_centralWidget,
+ SLOT(updateBrowserFont()));
dia.showDialog();
}
@@ -869,19 +877,12 @@ void MainWindow::activateCurrentCentralWidgetTab()
void MainWindow::showSearch()
{
- if (m_searchWidget)
- activateDockWidget(m_searchWidget);
- else
- m_centralWidget->activateSearch();
+ m_centralWidget->activateSearchWidget();
}
void MainWindow::hideSearch()
{
- if (m_searchWidget) {
- m_searchWidget->parentWidget()->parentWidget()->hide();
- } else {
- m_centralWidget->removeSearchWidget();
- }
+ m_centralWidget->removeSearchWidget();
}
void MainWindow::updateApplicationFont()
@@ -950,8 +951,7 @@ QWidget* MainWindow::setupBookmarkWidget()
{
m_bookmarkManager = new BookmarkManager(m_helpEngine);
m_bookmarkWidget = new BookmarkWidget(m_bookmarkManager, this);
- connect(m_bookmarkWidget, SIGNAL(addBookmark()),
- this, SLOT(addBookmark()));
+ connect(m_bookmarkWidget, SIGNAL(addBookmark()), this, SLOT(addBookmark()));
return m_bookmarkWidget;
}
diff --git a/tools/assistant/tools/assistant/mainwindow.h b/tools/assistant/tools/assistant/mainwindow.h
index c716b1c..7d08a74 100644
--- a/tools/assistant/tools/assistant/mainwindow.h
+++ b/tools/assistant/tools/assistant/mainwindow.h
@@ -62,8 +62,6 @@ class BookmarkWidget;
class CmdLineParser;
class QtDocInstaller;
-class SearchWidget;
-
class MainWindow : public QMainWindow
{
Q_OBJECT
@@ -106,6 +104,7 @@ private slots:
void showAboutDialog();
void copyAvailable(bool yes);
void updateNavigationItems();
+ void updateTabCloseAction();
void showNewAddress(const QUrl &url);
void addNewBookmark(const QString &title, const QString &url);
void showTopicChooser(const QMap<QString, QUrl> &links, const QString &keyword);
@@ -159,7 +158,6 @@ private:
QMenu *m_toolBarMenu;
CmdLineParser *m_cmdLine;
- SearchWidget *m_searchWidget;
QWidget *m_progressWidget;
QtDocInstaller *m_qtDocInstaller;
diff --git a/tools/assistant/tools/assistant/searchwidget.cpp b/tools/assistant/tools/assistant/searchwidget.cpp
index 000c73d..c40a9c4 100644
--- a/tools/assistant/tools/assistant/searchwidget.cpp
+++ b/tools/assistant/tools/assistant/searchwidget.cpp
@@ -62,6 +62,7 @@ QT_BEGIN_NAMESPACE
SearchWidget::SearchWidget(QHelpSearchEngine *engine, QWidget *parent)
: QWidget(parent)
, zoomCount(0)
+ , attached(false)
, searchEngine(engine)
{
QVBoxLayout *vLayout = new QVBoxLayout(this);
@@ -70,16 +71,18 @@ SearchWidget::SearchWidget(QHelpSearchEngine *engine, QWidget *parent)
QHelpSearchQueryWidget *queryWidget = searchEngine->queryWidget();
vLayout->addWidget(queryWidget);
- vLayout->addWidget(resultWidget);
-
+ vLayout->addWidget(resultWidget);
+
setFocusProxy(queryWidget);
connect(queryWidget, SIGNAL(search()), this, SLOT(search()));
- connect(resultWidget, SIGNAL(requestShowLink(const QUrl&)),
- this, SIGNAL(requestShowLink(const QUrl&)));
+ connect(resultWidget, SIGNAL(requestShowLink(QUrl)), this,
+ SIGNAL(requestShowLink(QUrl)));
- connect(searchEngine, SIGNAL(searchingStarted()), this, SLOT(searchingStarted()));
- connect(searchEngine, SIGNAL(searchingFinished(int)), this, SLOT(searchingFinished(int)));
+ connect(searchEngine, SIGNAL(searchingStarted()), this,
+ SLOT(searchingStarted()));
+ connect(searchEngine, SIGNAL(searchingFinished(int)), this,
+ SLOT(searchingFinished(int)));
QTextBrowser* browser = qFindChild<QTextBrowser*>(resultWidget);
browser->viewport()->installEventFilter(this);
@@ -92,10 +95,6 @@ SearchWidget::~SearchWidget()
void SearchWidget::zoomIn()
{
-#ifndef QT_CLUCENE_SUPPORT
- return;
-#endif
-
QTextBrowser* browser = qFindChild<QTextBrowser*>(resultWidget);
if (browser && zoomCount != 10) {
zoomCount++;
@@ -105,10 +104,6 @@ void SearchWidget::zoomIn()
void SearchWidget::zoomOut()
{
-#ifndef QT_CLUCENE_SUPPORT
- return;
-#endif
-
QTextBrowser* browser = qFindChild<QTextBrowser*>(resultWidget);
if (browser && zoomCount != -5) {
zoomCount--;
@@ -118,10 +113,6 @@ void SearchWidget::zoomOut()
void SearchWidget::resetZoom()
{
-#ifndef QT_CLUCENE_SUPPORT
- return;
-#endif
-
if (zoomCount == 0)
return;
@@ -132,6 +123,16 @@ void SearchWidget::resetZoom()
}
}
+bool SearchWidget::isAttached() const
+{
+ return attached;
+}
+
+void SearchWidget::setAttached(bool state)
+{
+ attached = state;
+}
+
void SearchWidget::search() const
{
QList<QHelpSearchQuery> query = searchEngine->queryWidget()->query();
@@ -152,7 +153,8 @@ void SearchWidget::searchingFinished(int hits)
bool SearchWidget::eventFilter(QObject* o, QEvent *e)
{
QTextBrowser* browser = qFindChild<QTextBrowser*>(resultWidget);
- if (browser && o == browser->viewport() && e->type() == QEvent::MouseButtonRelease){
+ if (browser && o == browser->viewport()
+ && e->type() == QEvent::MouseButtonRelease){
QMouseEvent *me = static_cast<QMouseEvent*>(e);
QUrl link = resultWidget->linkAt(me->pos());
if (!link.isEmpty() || link.isValid()) {
@@ -179,7 +181,6 @@ void SearchWidget::contextMenuEvent(QContextMenuEvent *contextMenuEvent)
QMenu menu;
QPoint point = contextMenuEvent->globalPos();
-#ifdef QT_CLUCENE_SUPPORT
QTextBrowser* browser = qFindChild<QTextBrowser*>(resultWidget);
if (!browser)
return;
@@ -190,22 +191,25 @@ void SearchWidget::contextMenuEvent(QContextMenuEvent *contextMenuEvent)
QUrl link = browser->anchorAt(point);
- QAction *copyAction = menu.addAction(tr("&Copy") +
- QString(QLatin1String("\t") + QString(QKeySequence(Qt::CTRL | Qt::Key_C))));
+ QKeySequence keySeq(QKeySequence::Copy);
+ QAction *copyAction = menu.addAction(tr("&Copy") + QLatin1String("\t") +
+ keySeq.toString(QKeySequence::NativeText));
copyAction->setEnabled(QTextCursor(browser->textCursor()).hasSelection());
QAction *copyAnchorAction = menu.addAction(tr("Copy &Link Location"));
copyAnchorAction->setEnabled(!link.isEmpty() && link.isValid());
- QAction *newTabAction = menu.addAction(tr("Open Link in New Tab") +
- QString(QLatin1String("\t") + QString(QKeySequence(Qt::CTRL))) +
+ keySeq = QKeySequence(Qt::CTRL);
+ QAction *newTabAction = menu.addAction(tr("Open Link in New Tab") +
+ QLatin1String("\t") + keySeq.toString(QKeySequence::NativeText) +
QLatin1String("LMB"));
newTabAction->setEnabled(!link.isEmpty() && link.isValid());
menu.addSeparator();
- QAction *selectAllAction = menu.addAction(tr("Select All") +
- QString(QLatin1String("\t") + QString(QKeySequence(Qt::CTRL | Qt::Key_A))));
+ keySeq = QKeySequence::SelectAll;
+ QAction *selectAllAction = menu.addAction(tr("Select All") +
+ QLatin1String("\t") + keySeq.toString(QKeySequence::NativeText));
QAction *usedAction = menu.exec(mapToGlobal(contextMenuEvent->pos()));
if (usedAction == copyAction) {
@@ -222,25 +226,10 @@ void SearchWidget::contextMenuEvent(QContextMenuEvent *contextMenuEvent)
}
else if (usedAction == newTabAction) {
emit requestShowLinkInNewTab(link);
- }
+ }
else if (usedAction == selectAllAction) {
browser->selectAll();
}
-#else
- point = resultWidget->mapFromGlobal(point);
- QUrl link = resultWidget->linkAt(point);
- if (link.isEmpty() || !link.isValid())
- return;
-
- QAction *curTab = menu.addAction(tr("Open Link"));
- QAction *newTab = menu.addAction(tr("Open Link in New Tab"));
-
- QAction *action = menu.exec(mapToGlobal(contextMenuEvent->pos()));
- if (curTab == action)
- emit requestShowLink(link);
- else if (newTab == action)
- emit requestShowLinkInNewTab(link);
-#endif
}
QT_END_NAMESPACE
diff --git a/tools/assistant/tools/assistant/searchwidget.h b/tools/assistant/tools/assistant/searchwidget.h
index 22fe80d..34eb86f 100644
--- a/tools/assistant/tools/assistant/searchwidget.h
+++ b/tools/assistant/tools/assistant/searchwidget.h
@@ -65,6 +65,9 @@ public:
void zoomOut();
void resetZoom();
+ bool isAttached() const;
+ void setAttached(bool state);
+
signals:
void requestShowLink(const QUrl &url);
void requestShowLinkInNewTab(const QUrl &url);
@@ -81,6 +84,7 @@ private:
private:
int zoomCount;
+ bool attached;
QHelpSearchEngine *searchEngine;
QHelpSearchResultWidget *resultWidget;
};
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index 9930da8..40bf59f 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -315,7 +315,6 @@ Configure::Configure( int& argc, char** argv )
dictionary[ "QT3SUPPORT" ] = "yes";
dictionary[ "ACCESSIBILITY" ] = "yes";
dictionary[ "OPENGL" ] = "yes";
- dictionary[ "DIRECT3D" ] = "auto";
dictionary[ "IPV6" ] = "yes"; // Always, dynamicly loaded
dictionary[ "OPENSSL" ] = "auto";
dictionary[ "DBUS" ] = "auto";
@@ -818,11 +817,7 @@ void Configure::parseCmdLine()
else if (configCmdLine.at(i) == "-iwmmxt")
dictionary[ "IWMMXT" ] = "yes";
- else if (configCmdLine.at(i) == "-no-direct3d") {
- dictionary["DIRECT3D"] = "no";
- }else if (configCmdLine.at(i) == "-direct3d") {
- dictionary["DIRECT3D"] = "auto"; // have to pass auto detection to enable Direct3D
- } else if( configCmdLine.at(i) == "-no-openssl" ) {
+ else if( configCmdLine.at(i) == "-no-openssl" ) {
dictionary[ "OPENSSL"] = "no";
} else if( configCmdLine.at(i) == "-openssl" ) {
dictionary[ "OPENSSL" ] = "yes";
@@ -1320,7 +1315,6 @@ void Configure::applySpecSpecifics()
dictionary[ "MMX" ] = "no";
dictionary[ "IWMMXT" ] = "no";
dictionary[ "CE_CRT" ] = "yes";
- dictionary[ "DIRECT3D" ] = "no";
dictionary[ "WEBKIT" ] = "no";
dictionary[ "PHONON" ] = "yes";
dictionary[ "DIRECTSHOW" ] = "no";
@@ -1419,7 +1413,7 @@ bool Configure::displayHelp()
"[-system-libtiff] [-no-libjpeg] [-qt-libjpeg] [-system-libjpeg]\n"
"[-no-libmng] [-qt-libmng] [-system-libmng] [-no-qt3support] [-mmx]\n"
"[-no-mmx] [-3dnow] [-no-3dnow] [-sse] [-no-sse] [-sse2] [-no-sse2]\n"
- "[-no-iwmmxt] [-iwmmxt] [-direct3d] [-openssl] [-openssl-linked]\n"
+ "[-no-iwmmxt] [-iwmmxt] [-openssl] [-openssl-linked]\n"
"[-no-openssl] [-no-dbus] [-dbus] [-dbus-linked] [-platform <spec>]\n"
"[-qtnamespace <namespace>] [-no-phonon] [-phonon]\n"
"[-no-phonon-backend] [-phonon-backend]\n"
@@ -1583,7 +1577,6 @@ bool Configure::displayHelp()
desc("SSE", "yes", "-sse", "Compile with use of SSE instructions");
desc("SSE2", "no", "-no-sse2", "Do not compile with use of SSE2 instructions");
desc("SSE2", "yes", "-sse2", "Compile with use of SSE2 instructions");
- desc("DIRECT3D", "yes", "-direct3d", "Compile in Direct3D support (experimental - see INSTALL for more info)");
desc("OPENSSL", "no", "-no-openssl", "Do not compile in OpenSSL support");
desc("OPENSSL", "yes", "-openssl", "Compile in run-time OpenSSL support");
desc("OPENSSL", "linked","-openssl-linked", "Compile in linked OpenSSL support");
@@ -1831,47 +1824,6 @@ bool Configure::checkAvailability(const QString &part)
&& dictionary.value("QMAKESPEC") != "win32-msvc.net" // Leave for now, since we can't be sure if they are using 2002 or 2003 with this spec
&& dictionary.value("QMAKESPEC") != "win32-msvc2002"
&& dictionary.value("EXCEPTIONS") == "yes";
- } else if (part == "DIRECT3D") {
- QString sdk_dir(QString::fromLocal8Bit(getenv("DXSDK_DIR")));
- QDir dir;
- bool has_d3d = false;
-
- if (!sdk_dir.isEmpty() && dir.exists(sdk_dir))
- has_d3d = true;
-
- if (has_d3d && !QFile::exists(sdk_dir + QLatin1String("\\include\\d3d9.h"))) {
- cout << "No Direct3D version 9 SDK found." << endl;
- has_d3d = false;
- }
-
- // find the first dxguid.lib in the current LIB paths, if it is NOT
- // the D3D SDK one, we're most likely in trouble..
- if (has_d3d) {
- has_d3d = false;
- QString env_lib(QString::fromLocal8Bit(getenv("LIB")));
- QStringList lib_paths = env_lib.split(';');
- for (int i=0; i<lib_paths.size(); ++i) {
- QString lib_path = lib_paths.at(i);
- if (QFile::exists(lib_path + QLatin1String("\\dxguid.lib")))
- {
- if (lib_path.startsWith(sdk_dir)) {
- has_d3d = true;
- } else {
- cout << "Your D3D/Platform SDK library paths seem to appear in the wrong order." << endl;
- }
- break;
- }
- }
- }
-
- available = has_d3d;
- if (!has_d3d) {
- cout << "Setting Direct3D to NO, since the proper Direct3D SDK was not detected." << endl
- << "Make sure you have the Direct3D SDK installed, and that you have run" << endl
- << "the <path to SDK>\\Utilities\\Bin\\dx_setenv.cmd script." << endl
- << "The D3D SDK library path *needs* to appear before the Platform SDK library" << endl
- << "path in your LIB environment variable." << endl;
- }
} else if (part == "PHONON") {
available = findFile("vmr9.h") && findFile("dshow.h") && findFile("strmiids.lib") &&
findFile("dmoguids.lib") && findFile("msdmo.lib") && findFile("d3d9.h");
@@ -1965,8 +1917,6 @@ void Configure::autoDetection()
dictionary["SCRIPTTOOLS"] = checkAvailability("SCRIPTTOOLS") ? "yes" : "no";
if (dictionary["XMLPATTERNS"] == "auto")
dictionary["XMLPATTERNS"] = checkAvailability("XMLPATTERNS") ? "yes" : "no";
- if (dictionary["DIRECT3D"] == "auto")
- dictionary["DIRECT3D"] = checkAvailability("DIRECT3D") ? "yes" : "no";
if (dictionary["PHONON"] == "auto")
dictionary["PHONON"] = checkAvailability("PHONON") ? "yes" : "no";
if (dictionary["WEBKIT"] == "auto")
@@ -2291,9 +2241,6 @@ void Configure::generateOutputVars()
if ( dictionary["DIRECTSHOW"] == "yes" )
qtConfig += "directshow";
- if (dictionary[ "DIRECT3D" ] == "yes")
- qtConfig += "direct3d";
-
if (dictionary[ "OPENSSL" ] == "yes")
qtConfig += "openssl";
else if (dictionary[ "OPENSSL" ] == "linked")
@@ -2676,7 +2623,6 @@ void Configure::generateConfigfiles()
if(dictionary["ACCESSIBILITY"] == "no") qconfigList += "QT_NO_ACCESSIBILITY";
if(dictionary["EXCEPTIONS"] == "no") qconfigList += "QT_NO_EXCEPTIONS";
if(dictionary["OPENGL"] == "no") qconfigList += "QT_NO_OPENGL";
- if(dictionary["DIRECT3D"] == "no") qconfigList += "QT_NO_DIRECT3D";
if(dictionary["OPENSSL"] == "no") qconfigList += "QT_NO_OPENSSL";
if(dictionary["OPENSSL"] == "linked") qconfigList += "QT_LINKED_OPENSSL";
if(dictionary["DBUS"] == "no") qconfigList += "QT_NO_DBUS";
@@ -2937,7 +2883,6 @@ void Configure::displayConfig()
cout << "SSE2 support................" << dictionary[ "SSE2" ] << endl;
cout << "IWMMXT support.............." << dictionary[ "IWMMXT" ] << endl;
cout << "OpenGL support.............." << dictionary[ "OPENGL" ] << endl;
- cout << "Direct3D support............" << dictionary[ "DIRECT3D" ] << endl;
cout << "OpenSSL support............." << dictionary[ "OPENSSL" ] << endl;
cout << "QtDBus support.............." << dictionary[ "DBUS" ] << endl;
cout << "QtXmlPatterns support......." << dictionary[ "XMLPATTERNS" ] << endl;
diff --git a/tools/designer/src/components/propertyeditor/propertyeditor.cpp b/tools/designer/src/components/propertyeditor/propertyeditor.cpp
index ead404b..eab7a12 100644
--- a/tools/designer/src/components/propertyeditor/propertyeditor.cpp
+++ b/tools/designer/src/components/propertyeditor/propertyeditor.cpp
@@ -200,14 +200,15 @@ PropertyEditor::PropertyEditor(QDesignerFormEditorInterface *core, QWidget *pare
colors.push_back(QColor(234, 191, 255));
colors.push_back(QColor(255, 191, 239));
m_colors.reserve(colors.count());
+ const int darknessFactor = 250;
for (int i = 0; i < colors.count(); i++) {
QColor c = colors.at(i);
- m_colors.push_back(qMakePair(c, c.darker(150)));
+ m_colors.push_back(qMakePair(c, c.darker(darknessFactor)));
}
QColor dynamicColor(191, 207, 255);
QColor layoutColor(255, 191, 191);
- m_dynamicColor = qMakePair(dynamicColor, dynamicColor.darker(150));
- m_layoutColor = qMakePair(layoutColor, layoutColor.darker(150));
+ m_dynamicColor = qMakePair(dynamicColor, dynamicColor.darker(darknessFactor));
+ m_layoutColor = qMakePair(layoutColor, layoutColor.darker(darknessFactor));
updateForegroundBrightness();
diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp
index e271590..7e84c90 100644
--- a/tools/qdoc3/cppcodeparser.cpp
+++ b/tools/qdoc3/cppcodeparser.cpp
@@ -694,7 +694,7 @@ Node *CppCodeParser::processTopicCommand(const Doc& doc,
QString element;
QString name;
QmlClassNode* qmlClass = 0;
- if (splitQmlArg(arg,element,name)) {
+ if (splitQmlArg(doc,arg,element,name)) {
Node* n = tre->findNode(QStringList(element),Node::Fake);
if (n && n->subType() == Node::QmlClass) {
qmlClass = static_cast<const QmlClassNode*>(n);
@@ -721,7 +721,8 @@ Node *CppCodeParser::processTopicCommand(const Doc& doc,
and returns true. If any of the parts isn't found,
a debug message is output and false is returned.
*/
-bool CppCodeParser::splitQmlPropertyArg(const QString& arg,
+bool CppCodeParser::splitQmlPropertyArg(const Doc& doc,
+ const QString& arg,
QString& type,
QString& element,
QString& property)
@@ -736,10 +737,10 @@ bool CppCodeParser::splitQmlPropertyArg(const QString& arg,
return true;
}
else
- qDebug() << "Missing QML element name or property name";
+ doc.location().warning(tr("Missing QML element name or property name"));
}
else
- qDebug() << "Missing QML property type or property path";
+ doc.location().warning(tr("Missing QML property type or property path"));
return false;
}
@@ -753,7 +754,8 @@ bool CppCodeParser::splitQmlPropertyArg(const QString& arg,
true. If either of the parts isn't found, a debug
message is output and false is returned.
*/
-bool CppCodeParser::splitQmlArg(const QString& arg,
+bool CppCodeParser::splitQmlArg(const Doc& doc,
+ const QString& arg,
QString& element,
QString& name)
{
@@ -764,7 +766,7 @@ bool CppCodeParser::splitQmlArg(const QString& arg,
return true;
}
else
- qDebug() << "Missing QML element name or signal/method name";
+ doc.location().warning(tr("Missing QML element name or signal/method name"));
return false;
}
@@ -773,7 +775,8 @@ bool CppCodeParser::splitQmlArg(const QString& arg,
Currently, this function is called only for \e{qmlproperty}.
*/
-Node *CppCodeParser::processTopicCommandGroup(const QString& command,
+Node *CppCodeParser::processTopicCommandGroup(const Doc& doc,
+ const QString& command,
const QStringList& args)
{
QmlPropGroupNode* qmlPropGroup = 0;
@@ -782,7 +785,7 @@ Node *CppCodeParser::processTopicCommandGroup(const QString& command,
QString element;
QString property;
QStringList::ConstIterator arg = args.begin();
- if (splitQmlPropertyArg(*arg,type,element,property)) {
+ if (splitQmlPropertyArg(doc,(*arg),type,element,property)) {
Node* n = tre->findNode(QStringList(element),Node::Fake);
if (n && n->subType() == Node::QmlClass) {
QmlClassNode* qmlClass = static_cast<QmlClassNode*>(n);
@@ -794,7 +797,7 @@ Node *CppCodeParser::processTopicCommandGroup(const QString& command,
new QmlPropertyNode(qmlPropGroup,property,type);
++arg;
while (arg != args.end()) {
- if (splitQmlPropertyArg(*arg,type,element,property)) {
+ if (splitQmlPropertyArg(doc,(*arg),type,element,property)) {
new QmlPropertyNode(qmlPropGroup,property,type);
}
++arg;
@@ -1974,7 +1977,7 @@ bool CppCodeParser::matchDocsAndStuff()
#ifdef QDOC_QML
if (topic == COMMAND_QMLPROPERTY) {
Doc nodeDoc = doc;
- Node *node = processTopicCommandGroup(topic, args);
+ Node *node = processTopicCommandGroup(nodeDoc,topic,args);
if (node != 0) {
nodes.append(node);
docs.append(nodeDoc);
@@ -1984,7 +1987,7 @@ bool CppCodeParser::matchDocsAndStuff()
QStringList::ConstIterator a = args.begin();
while (a != args.end()) {
Doc nodeDoc = doc;
- Node *node = processTopicCommand(nodeDoc, topic, *a);
+ Node *node = processTopicCommand(nodeDoc,topic,*a);
if (node != 0) {
nodes.append(node);
docs.append(nodeDoc);
diff --git a/tools/qdoc3/cppcodeparser.h b/tools/qdoc3/cppcodeparser.h
index 2eb2fb3..3864990 100644
--- a/tools/qdoc3/cppcodeparser.h
+++ b/tools/qdoc3/cppcodeparser.h
@@ -92,13 +92,16 @@ class CppCodeParser : public CodeParser
const QString& arg);
#ifdef QDOC_QML
// might need to implement this in QsCodeParser as well.
- virtual Node *processTopicCommandGroup(const QString& command,
+ virtual Node *processTopicCommandGroup(const Doc& doc,
+ const QString& command,
const QStringList& args);
- bool splitQmlPropertyArg(const QString& arg,
+ bool splitQmlPropertyArg(const Doc& doc,
+ const QString& arg,
QString& type,
QString& element,
QString& property);
- bool splitQmlArg(const QString& arg,
+ bool splitQmlArg(const Doc& doc,
+ const QString& arg,
QString& element,
QString& name);
#endif
diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro
index 3268585..2bba8fb 100644
--- a/tools/qdoc3/qdoc3.pro
+++ b/tools/qdoc3/qdoc3.pro
@@ -99,10 +99,3 @@ SOURCES += apigenerator.cpp \
webxmlgenerator.cpp \
yyindent.cpp
-
-win32 {
- QT_WINCONFIG = release
- CONFIG(debug, debug|release) {
- QT_WINCONFIG = debug
- }
-}
diff --git a/tools/qdoc3/test/assistant.qdocconf b/tools/qdoc3/test/assistant.qdocconf
index c023c51..b82507f 100644
--- a/tools/qdoc3/test/assistant.qdocconf
+++ b/tools/qdoc3/test/assistant.qdocconf
@@ -6,14 +6,14 @@ include(qt-defines.qdocconf)
project = Qt Assistant
description = Qt Assistant Manual
-url = http://doc.trolltech.com/4.5
+url = http://doc.qtsoftware.com/4.5
indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index
qhp.projects = Assistant
qhp.Assistant.file = assistant.qhp
-qhp.Assistant.namespace = com.trolltech.assistant.451
+qhp.Assistant.namespace = com.trolltech.assistant.452
qhp.Assistant.virtualFolder = qdoc
qhp.Assistant.indexTitle = Qt Assistant Manual
qhp.Assistant.extraFiles = classic.css images/qt-logo.png images/trolltech-logo.png
diff --git a/tools/qdoc3/test/carbide-eclipse-integration.qdocconf b/tools/qdoc3/test/carbide-eclipse-integration.qdocconf
index 683048d..aee5e17 100644
--- a/tools/qdoc3/test/carbide-eclipse-integration.qdocconf
+++ b/tools/qdoc3/test/carbide-eclipse-integration.qdocconf
@@ -6,7 +6,7 @@ macro.TheEclipseIntegration = Carbide.c++
HTML.footer = "<p /><address><hr /><div align=\"center\">\n" \
"<table width=\"100%\" cellspacing=\"0\" border=\"0\"><tr class=\"address\">\n" \
- "<td width=\"40%\" align="left">Copyright &copy; 2009 <a href=\"http://doc.trolltech.com/trolltech.html\">Nokia Corporation</a></td>\n" \
- "<td width=\"30%\" align=\"center\"><a href=\"http://doc.trolltech.com\">Trademarks</a></td>\n" \
- "<td width=\"40%\" align=\"right\"><div align=\"right\">Carbide.c++</div></td>\n" \
+ "<td width=\"30%\" align=\"left\">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>\n" \
+ "<td width=\"40%\" align=\"center\"><a href=\"http://doc.qtsoftware.com\">Trademarks</a></td>\n" \
+ "<td width=\"30%\" align=\"right\"><div align=\"right\">Carbide.c++</div></td>\n" \
"</tr></table></div></address>"
diff --git a/tools/qdoc3/test/designer.qdocconf b/tools/qdoc3/test/designer.qdocconf
index 45bb4b5..9c0790e 100644
--- a/tools/qdoc3/test/designer.qdocconf
+++ b/tools/qdoc3/test/designer.qdocconf
@@ -6,14 +6,14 @@ include(qt-defines.qdocconf)
project = Qt Designer
description = Qt Designer Manual
-url = http://doc.trolltech.com/4.5
+url = http://doc.qtsoftware.com/4.5
indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index
qhp.projects = Designer
qhp.Designer.file = designer.qhp
-qhp.Designer.namespace = com.trolltech.designer.451
+qhp.Designer.namespace = com.trolltech.designer.452
qhp.Designer.virtualFolder = qdoc
qhp.Designer.indexTitle = Qt Designer Manual
qhp.Designer.extraFiles = classic.css images/qt-logo.png images/trolltech-logo.png
diff --git a/tools/qdoc3/test/eclipse-integration.qdocconf b/tools/qdoc3/test/eclipse-integration.qdocconf
index 1fdaa1b..d9e4ac7 100644
--- a/tools/qdoc3/test/eclipse-integration.qdocconf
+++ b/tools/qdoc3/test/eclipse-integration.qdocconf
@@ -8,6 +8,6 @@ outputdir = $QTDIR/../qteclipsetools/main/doc/html
project = Qt Eclipse Integration
description = "Qt Eclipse Integration"
-url = http://doc.trolltech.com/eclipse-integration-4.4
+url = http://doc.qtsoftware.com/qt-eclipse-1.5
HTML.{postheader,address} = ""
diff --git a/tools/qdoc3/test/jambi.qdocconf b/tools/qdoc3/test/jambi.qdocconf
index 3644b69..101b33a 100644
--- a/tools/qdoc3/test/jambi.qdocconf
+++ b/tools/qdoc3/test/jambi.qdocconf
@@ -3,7 +3,7 @@ include(macros.qdocconf)
project = Qt Jambi
description = Qt Jambi Reference Documentation
-url = http://doc.trolltech.com/qtjambi
+url = http://doc.qtsoftware.com/qtjambi
version = 4.4.0_01
@@ -41,7 +41,7 @@ HTML.postheader = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0
HTML.footer = "<p /><address><hr /><div align=\"center\">\n" \
"<table width=\"100%\" cellspacing=\"0\" border=\"0\"><tr class=\"address\">\n" \
- "<td width=\"30%\">Copyright &copy; \$THISYEAR\$ <a href=\"trolltech.html\">Trolltech</a></td>\n" \
+ "<td width=\"30%\" align=\"left\">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>\n" \
"<td width=\"40%\" align=\"center\"><a href=\"trademarks.html\">Trademarks</a></td>\n" \
"<td width=\"30%\" align=\"right\"><div align=\"right\">Qt Jambi \\version</div></td>\n" \
"</tr></table></div></address>"
diff --git a/tools/qdoc3/test/linguist.qdocconf b/tools/qdoc3/test/linguist.qdocconf
index f4ee211..da49abe 100644
--- a/tools/qdoc3/test/linguist.qdocconf
+++ b/tools/qdoc3/test/linguist.qdocconf
@@ -6,14 +6,14 @@ include(qt-defines.qdocconf)
project = Qt Linguist
description = Qt Linguist Manual
-url = http://doc.trolltech.com/4.5
+url = http://doc.qtsoftware.com/4.5
indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index
qhp.projects = Linguist
qhp.Linguist.file = linguist.qhp
-qhp.Linguist.namespace = com.trolltech.linguist.451
+qhp.Linguist.namespace = com.trolltech.linguist.452
qhp.Linguist.virtualFolder = qdoc
qhp.Linguist.indexTitle = Qt Linguist Manual
qhp.Linguist.extraFiles = classic.css images/qt-logo.png images/trolltech-logo.png
diff --git a/tools/qdoc3/test/qmake.qdocconf b/tools/qdoc3/test/qmake.qdocconf
index 642e3be..5e2cac7 100644
--- a/tools/qdoc3/test/qmake.qdocconf
+++ b/tools/qdoc3/test/qmake.qdocconf
@@ -6,14 +6,14 @@ include(qt-defines.qdocconf)
project = QMake
description = QMake Manual
-url = http://doc.trolltech.com/4.5
+url = http://doc.qtsoftware.com/4.5
indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index
qhp.projects = qmake
qhp.qmake.file = qmake.qhp
-qhp.qmake.namespace = com.trolltech.qmake.451
+qhp.qmake.namespace = com.trolltech.qmake.452
qhp.qmake.virtualFolder = qdoc
qhp.qmake.indexTitle = QMake Manual
qhp.qmake.extraFiles = classic.css images/qt-logo.png images/trolltech-logo.png
diff --git a/tools/qdoc3/test/qt-build-docs.qdocconf b/tools/qdoc3/test/qt-build-docs.qdocconf
index 1b3063b..6e0253a 100644
--- a/tools/qdoc3/test/qt-build-docs.qdocconf
+++ b/tools/qdoc3/test/qt-build-docs.qdocconf
@@ -6,7 +6,7 @@ include(qt-defines.qdocconf)
project = Qt
description = Qt Reference Documentation
-url = http://doc.trolltech.com/4.5
+url = http://doc.qtsoftware.com/4.5
edition.Console.modules = QtCore QtDBus QtNetwork QtScript QtSql QtXml \
QtXmlPatterns QtTest
@@ -20,7 +20,7 @@ edition.DesktopLight.groups = -graphicsview-api
qhp.projects = Qt
qhp.Qt.file = qt.qhp
-qhp.Qt.namespace = com.trolltech.qt.451
+qhp.Qt.namespace = com.trolltech.qt.452
qhp.Qt.virtualFolder = qdoc
qhp.Qt.indexTitle = Qt Reference Documentation
qhp.Qt.indexRoot =
@@ -105,7 +105,8 @@ exampledirs = $QT_SOURCE_TREE/doc/src \
$QT_SOURCE_TREE/examples \
$QT_SOURCE_TREE/examples/tutorials \
$QT_SOURCE_TREE \
- $QT_SOURCE_TREE/qmake/examples
+ $QT_SOURCE_TREE/qmake/examples \
+ $QT_SOURCE_TREE/src/3rdparty/webkit/WebKit/qt/docs
imagedirs = $QT_SOURCE_TREE/doc/src/images \
$QT_SOURCE_TREE/examples \
$QT_SOURCE_TREE/doc/src/declarative/pics
diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf
index f09192a..dc027d0 100644
--- a/tools/qdoc3/test/qt-html-templates.qdocconf
+++ b/tools/qdoc3/test/qt-html-templates.qdocconf
@@ -25,8 +25,7 @@ HTML.postheader = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0
HTML.footer = "<p /><address><hr /><div align=\"center\">\n" \
"<table width=\"100%\" cellspacing=\"0\" border=\"0\"><tr class=\"address\">\n" \
- "<td width=\"30%\" align=\"left\">Copyright &copy; %THISYEAR% Nokia Corporation " \
- "and/or its subsidiary(-ies)</td>\n" \
+ "<td width=\"30%\" align=\"left\">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>\n" \
"<td width=\"40%\" align=\"center\"><a href=\"trademarks.html\">Trademarks</a></td>\n" \
"<td width=\"30%\" align=\"right\"><div align=\"right\">Qt \\version</div></td>\n" \
"</tr></table></div></address>"
diff --git a/tools/qdoc3/test/qt-inc.qdocconf b/tools/qdoc3/test/qt-inc.qdocconf
index 97893dc..d6cb0e6 100644
--- a/tools/qdoc3/test/qt-inc.qdocconf
+++ b/tools/qdoc3/test/qt-inc.qdocconf
@@ -3,7 +3,7 @@ include(macros.qdocconf)
project = Qt
description = Qt Reference Documentation
-url = http://doc.trolltech.com/4.5
+url = http://doc.qtsoftware.com/4.5
edition.Console = QtCore QtNetwork QtSql QtXml QtScript QtTest
edition.Desktop = QtCore QtGui QtNetwork QtOpenGL QtSql QtSvg QtXml QtScript \
@@ -20,7 +20,8 @@ headerdirs = $QDOC_CURRENT_DIR
exampledirs = $QTDIR/doc/src \
$QTDIR/examples \
$QTDIR \
- $QTDIR/qmake/examples
+ $QTDIR/qmake/examples \
+ $QTDIR/src/3rdparty/webkit/WebKit/qt/docs
imagedirs = $QTDIR/doc/src/images \
$QTDIR/examples
outputdir = $QTDIR/doc/html
@@ -140,7 +141,7 @@ HTML.postheader = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0
HTML.footer = "<p /><address><hr /><div align=\"center\">\n" \
"<table width=\"100%\" cellspacing=\"0\" border=\"0\"><tr class=\"address\">\n" \
- "<td width=\"30%\">Copyright &copy; %THISYEAR% <a href=\"trolltech.html\">Trolltech</a></td>\n" \
+ "<td width=\"30%\" align=\"left\">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>\n" \
"<td width=\"40%\" align=\"center\"><a href=\"trademarks.html\">Trademarks</a></td>\n" \
"<td width=\"30%\" align=\"right\"><div align=\"right\">Qt \\version</div></td>\n" \
"</tr></table></div></address>"
diff --git a/tools/qdoc3/test/qt.qdocconf b/tools/qdoc3/test/qt.qdocconf
index ac86348..e1ce8d3 100644
--- a/tools/qdoc3/test/qt.qdocconf
+++ b/tools/qdoc3/test/qt.qdocconf
@@ -8,7 +8,7 @@ project = Qt
versionsym =
version = %VERSION%
description = Qt Reference Documentation
-url = http://doc.trolltech.com/4.5
+url = http://doc.qtsoftware.com/4.5
edition.Console.modules = QtCore QtDBus QtNetwork QtScript QtSql QtXml \
QtXmlPatterns QtTest
@@ -22,7 +22,7 @@ edition.DesktopLight.groups = -graphicsview-api
qhp.projects = Qt
qhp.Qt.file = qt.qhp
-qhp.Qt.namespace = com.trolltech.qt.451
+qhp.Qt.namespace = com.trolltech.qt.452
qhp.Qt.virtualFolder = qdoc
qhp.Qt.indexTitle = Qt Reference Documentation
qhp.Qt.indexRoot =
@@ -107,7 +107,8 @@ exampledirs = $QTDIR/doc/src \
$QTDIR/examples \
$QTDIR/examples/tutorials \
$QTDIR \
- $QTDIR/qmake/examples
+ $QTDIR/qmake/examples \
+ $QTDIR/src/3rdparty/webkit/WebKit/qt/docs
imagedirs = $QTDIR/doc/src/images \
$QTDIR/examples \
$QTDIR/doc/src/declarative/pics
diff --git a/tools/qdoc3/test/standalone-eclipse-integration.qdocconf b/tools/qdoc3/test/standalone-eclipse-integration.qdocconf
index c3c4291..127b578 100644
--- a/tools/qdoc3/test/standalone-eclipse-integration.qdocconf
+++ b/tools/qdoc3/test/standalone-eclipse-integration.qdocconf
@@ -5,7 +5,7 @@ macro.TheEclipseIntegration = The Qt Eclipse Integration
HTML.footer = "<p /><address><hr /><div align=\"center\">\n" \
"<table width=\"100%\" cellspacing=\"0\" border=\"0\"><tr class=\"address\">\n" \
- "<td width=\"40%\" align="left">Copyright &copy; 2009 <a href=\"http://doc.trolltech.com\">Nokia Corporation</a></td>\n" \
- "<td width=\"30%\" align=\"center\"><a href=\"http://doc.trolltech.com/trademarks.html\">Trademarks</a></td>\n" \
- "<td width=\"40%\" align=\"right\"><div align=\"right\">Qt Eclipse Integration 1.4.3</div></td>\n" \
+ "<td width=\"30%\" align=\"left\">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>\n" \
+ "<td width=\"40%\" align=\"center\"><a href=\"http://doc.qtsoftware.com/trademarks.html\">Trademarks</a></td>\n" \
+ "<td width=\"30%\" align=\"right\"><div align=\"right\">Qt Eclipse Integration 1.4.3</div></td>\n" \
"</tr></table></div></address>"
diff --git a/tools/qmlconv/qmlconv.cpp b/tools/qmlconv/qmlconv.cpp
new file mode 100644
index 0000000..3ba40a4
--- /dev/null
+++ b/tools/qmlconv/qmlconv.cpp
@@ -0,0 +1,480 @@
+#include <QtCore/QCoreApplication>
+#include <QtCore/QFile>
+#include <QtCore/QXmlStreamReader>
+#include <QtCore/QStack>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+
+
+static bool optionInPlace = false;
+
+class Reader
+{
+ QString outString;
+ QTextStream out;
+ QXmlStreamReader xml;
+ int depth;
+ bool supressIndent;
+
+ QStringList knownListProperties;
+ inline QString depthString() {if (supressIndent) { supressIndent = false; return QString(); }
+ return QString(depth*4, QLatin1Char(' '));}
+
+public:
+ Reader(QIODevice *in)
+ :xml(in) {
+
+ knownListProperties << "states" << "transitions" << "children" << "resources"
+ << "transform" << "notes";
+ depth = 0;
+ supressIndent = false;
+
+ out.setString(&outString);
+
+ loop();
+
+ out.flush();
+
+ if (! optionInPlace) {
+ QTextStream print(stdout);
+ print << outString;
+ }
+ }
+
+ QString output() const
+ {
+ return outString;
+ }
+
+ void comment()
+ {
+ if (xml.isComment()) {
+ out << depthString() << "// "
+ << xml.text().toString().trimmed().replace(QRegExp("\n\\s*"),"\n"+depthString()+"// ")
+ << endl;
+ }
+ }
+
+ void emptyLoop() {
+ while (!xml.atEnd()) {
+ xml.readNext();
+ comment();
+ if (xml.tokenType() == QXmlStreamReader::EndElement)
+ return;
+ }
+ }
+
+ void loop()
+ {
+ while (!xml.atEnd()) {
+ xml.readNext();
+ if (xml.tokenType() == QXmlStreamReader::EndElement)
+ return;
+ else if (xml.tokenType() == QXmlStreamReader::StartElement)
+ startElement();
+ else if (xml.tokenType() == QXmlStreamReader::ProcessingInstruction) {
+ if (xml.processingInstructionTarget() == QLatin1String("qtfx")) {
+ QString data = xml.processingInstructionData().toString().trimmed();
+ if (data.startsWith(QLatin1String("namespacepath:="))) {
+ outString.prepend( QLatin1String("import \"") + data.mid(data.indexOf(QLatin1Char('='))+1) + QLatin1String("\"\n"));
+ }
+ }
+ }
+ comment();
+ }
+ }
+
+ void startElement() {
+
+ if (!propertyChangeSet.isEmpty()
+ && xml.name() != "SetProperties"
+ && xml.name() != "SetProperty") {
+ clearPropertyChangeSet();
+ }
+
+ if (false && xml.name() == "properties")
+ startDeclareProperties();
+ else if (false && xml.name() == "signals")
+ startDeclareSignals();
+ else if (false && xml.name() == "states")
+ loop(); // ignore
+ else if (false && xml.name() == "transitions")
+ loop(); // ignore
+ else if (knownListProperties.contains(xml.name().toString()))
+ startList();
+ else if (false && xml.name() == "SetProperties")
+ startSetProperties();
+ else if (false && xml.name() == "SetProperty")
+ startSetProperty();
+ else if (false && xml.name() == "ParentChange")
+ startParentChange();
+ else if (true && xml.name() == "Connection")
+ startConnection();
+ else if (false && xml.name() == "Script")
+ startScript();
+ else if (xml.name().at(0).isLower() && xml.attributes().isEmpty())
+ startObjectProperty();
+ else
+ startItem();
+ }
+
+ static void possiblyRemoveBraces(QString *s) {
+ if (s->startsWith('{') && s->endsWith('}'))
+ *s = s->mid(1, s->length() - 2);
+ }
+
+ static bool isNumber(const QString &s) {
+ bool ok = true;
+ s.toFloat(&ok);
+ return ok;
+ }
+
+ static bool isSignalHandler(const QString &s) {
+ return s.size() > 3
+ && s.startsWith("on")
+ && s.at(2).isUpper();
+ }
+
+ static bool isEnum(const QString &property, const QString &value) {
+ return !value.contains(' ') && (property == "vAlign" || property == "hAlign"
+ || property == "style");
+ }
+
+ static bool isIdentifier(const QString &s) {
+ if (s.isEmpty())
+ return false;
+ if (!s.at(1).isLetter())
+ return false;
+ for (int i = 1; i < s.size(); ++i) {
+ QChar c = s.at(i);
+ if (c.isLetterOrNumber()
+ || c == QLatin1Char('_')
+ || c == QLatin1Char('-'))
+ continue;
+ return false;
+ }
+ return true;
+ }
+
+
+ void setProperty(const QString &property, const QString &value, bool newline = true) {
+ QString v = value.trimmed();
+ if (v.startsWith('{')) {
+ possiblyRemoveBraces(&v);
+ } else if (v == "true"
+ || v == "false"
+ || isNumber(v)
+ || property == "id"
+ || isEnum(property, value)
+ ) {
+ ;
+ } else if (isSignalHandler(property)) {
+ // if not a function name, create an anonymous function
+ if (!isIdentifier(v)) {
+ v.prepend("{ ");
+ v.append(" }");
+ }
+ } else
+
+ // if (property == "text" || property == "name" || value.contains(' ')
+ // || value.contains("/") || value.startsWith('#')
+ // || property == "filename" || property == "source" || property == "src"
+ // || property == "title" || property == "movieTitle" || property == "movieDescription"
+ // || property == "properties" || property == "fromState" || property == "toState"
+ // )
+ {
+ v.prepend('\"');
+ v.append('\"');
+ }
+
+// QByteArray semiColon = ";";
+// if (v.endsWith(QLatin1Char('}')) || v.endsWith(QLatin1Char(';')))
+// semiColon.clear();
+
+ if (!newline)
+ out << property << ": " << v /* << semiColon.constData() */;
+ else
+ out << depthString() << property << ": " << v /* << semiColon.constData() */ << endl;
+ }
+
+
+ typedef QPair<QString,QString> StringPair;
+ QList<StringPair> propertyChangeSet;
+ void startItem(bool inList = false) {
+
+ QString name = xml.name().toString();
+
+ out << depthString() << name << " {" << endl;
+ ++depth;
+
+ foreach (QXmlStreamAttribute attribute, xml.attributes()) {
+ setProperty(attribute.name().toString(), attribute.value().toString());
+ }
+
+ if (name == "Script") {
+ QString text = xml.readElementText();
+ if (!text.trimmed().isEmpty()) {
+ out << text << endl;
+ }
+ } else {
+ loop();
+ }
+
+ if (name == "State")
+ clearPropertyChangeSet();
+
+ --depth;
+ out << depthString() << "}";
+ if (!inList)
+ out << endl;
+ }
+
+ void clearPropertyChangeSet() {
+ if (propertyChangeSet.isEmpty())
+ return;
+
+ out << depthString() << "PropertyChangeSet" << " {" << endl;
+ ++depth;
+ foreach(StringPair pair, propertyChangeSet)
+ setProperty(pair.first, pair.second);
+ --depth;
+ out << depthString() << "}" << endl;
+ propertyChangeSet.clear();
+ }
+
+ void startObjectProperty() {
+
+ QString name = xml.name().toString();
+ bool hasElements = false;
+ while (!xml.atEnd()) {
+ xml.readNext();
+ if (xml.tokenType() == QXmlStreamReader::EndElement)
+ break;
+ if (xml.tokenType() == QXmlStreamReader::StartElement) {
+ hasElements = true;
+ out << depthString() << name << ": ";
+ supressIndent = true;
+ startElement();
+ } else if (!hasElements && xml.tokenType() == QXmlStreamReader::Characters) {
+ if (!xml.text().toString().trimmed().isEmpty()) {
+ setProperty(name, xml.text().toString());
+ }
+ }
+ comment();
+ }
+ }
+
+ void startDeclareProperty() {
+ out << depthString() << "public property ";
+
+ if (xml.attributes().hasAttribute("type"))
+ out << "/* " << xml.attributes().value("type").toString() << " */ ";
+
+ QString name = xml.attributes().value("name").toString();
+
+ if (xml.attributes().hasAttribute("value"))
+ setProperty(name, xml.attributes().value("value").toString(), false);
+ else out << name;
+
+ QMap<QString, QString> attributes;
+ foreach (QXmlStreamAttribute attribute, xml.attributes()) {
+ if (attribute.name() == "name" || attribute.name() == "value")
+ continue;
+ attributes.insert(attribute.name().toString(), attribute.value().toString());
+ }
+ out << endl;
+ emptyLoop();
+ }
+
+ void startDeclareProperties() {
+ while (!xml.atEnd()) {
+ xml.readNext();
+ if (xml.tokenType() == QXmlStreamReader::EndElement)
+ return;
+ if (xml.tokenType() == QXmlStreamReader::StartElement) {
+ if (xml.name() == "Property")
+ startDeclareProperty();
+ }
+ comment();
+ }
+ }
+
+ void startDeclareSignal() {
+ out << depthString() << "public signal " << xml.attributes().value("name").toString() << endl;
+ emptyLoop();
+ }
+
+ void startDeclareSignals() {
+ while (!xml.atEnd()) {
+ xml.readNext();
+ if (xml.tokenType() == QXmlStreamReader::EndElement)
+ return;
+ if (xml.tokenType() == QXmlStreamReader::StartElement) {
+ if (xml.name() == "Signal")
+ startDeclareSignal();
+ }
+ comment();
+ }
+ }
+
+
+ void startSetProperties() {
+ QString target = xml.attributes().value("target").toString();
+ possiblyRemoveBraces(&target);
+ foreach (QXmlStreamAttribute attribute, xml.attributes()) {
+ if (attribute.name() == "target")
+ continue;
+ propertyChangeSet += StringPair(target + "." + attribute.name().toString(), attribute.value().toString());
+ }
+ emptyLoop();
+ }
+
+ void startSetProperty() {
+ QString target = xml.attributes().value("target").toString();
+ possiblyRemoveBraces(&target);
+ propertyChangeSet += StringPair(target + "." + xml.attributes().value("property").toString(),
+ xml.attributes().value("value").toString());
+
+ emptyLoop();
+ }
+
+ void startParentChange() {
+ QString target = xml.attributes().value("target").toString();
+ possiblyRemoveBraces(&target);
+
+ out << depthString() << "ParentChangeSet" << " {" << endl;
+ ++depth;
+ setProperty(target + ".parent", xml.attributes().value("parent").toString());
+ --depth;
+ out << depthString() << "}" << endl;
+
+// propertyChangeSet += StringPair(target + ".moveToParent", xml.attributes().value("parent").toString());
+
+ emptyLoop();
+ }
+
+ void startConnection() {
+ QString sender = xml.attributes().value("sender").toString();
+ possiblyRemoveBraces(&sender);
+ out << depthString() << "Connection {" << endl;
+ ++depth;
+ if (! sender.isEmpty())
+ out << depthString() << "sender: " << sender << endl;
+ if (xml.attributes().hasAttribute("signal"))
+ out << depthString() << "signal: \"" << xml.attributes().value("signal").toString() << '"' << endl;
+ if (xml.attributes().hasAttribute("script")) {
+ out << depthString() << "script: { " << xml.attributes().value("script").toString() << " }" << endl;
+ --depth;
+ out << depthString() << "}" << endl;
+ } else {
+ QString text;
+ while (!xml.atEnd()) {
+ xml.readNext();
+ if (xml.tokenType() == QXmlStreamReader::EndElement)
+ break;
+ else if (xml.tokenType() == QXmlStreamReader::Characters)
+ text.append(xml.text());
+ }
+
+ out << depthString() << "script: {" << endl;
+ foreach (QString line, text.split(QLatin1Char('\n'))) {
+ out << depthString() << line << endl;
+ }
+ out << depthString() << "}" << endl;
+ --depth;
+ out << depthString() << "}" << endl;
+ }
+ emptyLoop();
+ }
+
+ void startScript() {
+ if (xml.attributes().hasAttribute(QLatin1String("src"))) {
+ /*
+ QString import;
+ QTextStream ts(&import);
+ ts << "import \"";
+ ts << xml.attributes().value(QLatin1String("src")).toString();
+ ts << "\"" << endl;
+ ts.flush();
+ outString.prepend(import);
+ */
+ }
+ QString text = xml.readElementText();
+ if (!text.trimmed().isEmpty()) {
+ out << text << endl;
+ }
+ if (xml.tokenType() != QXmlStreamReader::EndElement)
+ emptyLoop();
+ }
+
+ void startList()
+ {
+ out << depthString() << xml.name().toString() << ": [" << endl;
+ ++depth;
+ bool needComma = false;
+
+ while (!xml.atEnd()) {
+ xml.readNext();
+ if (xml.tokenType() == QXmlStreamReader::EndElement)
+ break;
+ if (xml.tokenType() == QXmlStreamReader::StartElement) {
+ if (needComma)
+ out << "," << endl;
+ startItem(true);
+ needComma = true;
+ }
+ comment();
+ }
+
+ out << endl;
+ --depth;
+ out << depthString() << "]" << endl;
+ }
+
+};
+
+
+
+int main(int argc, char *argv[])
+{
+ QCoreApplication a(argc, argv);
+
+ QStringList args = a.arguments();
+ args.removeFirst();
+
+again:
+ if (args.isEmpty()) {
+ qWarning() << "Usage: qmlconf [-i] filename";
+ exit(1);
+ }
+
+ if (args.first() == QLatin1String("-i")) {
+ optionInPlace = true;
+ args.removeFirst();
+ goto again;
+ }
+
+ const QString fileName = args.first();
+
+ QFile file(fileName);
+ if (! file.open(QIODevice::ReadOnly)) {
+ qWarning() << "qmlconv: no input file";
+ exit(1);
+ }
+
+ Reader r(&file);
+ file.close();
+
+ if (optionInPlace) {
+ if (! file.open(QFile::WriteOnly)) {
+ qWarning() << "qmlconv: cannot open file" << qPrintable(fileName);
+ exit(1);
+ }
+
+ QTextStream out(&file);
+ out << r.output();
+ file.close();
+ }
+
+ return 0;
+}
diff --git a/tools/qmlconv/qmlconv.pro b/tools/qmlconv/qmlconv.pro
new file mode 100644
index 0000000..331f4ee
--- /dev/null
+++ b/tools/qmlconv/qmlconv.pro
@@ -0,0 +1,10 @@
+DESTDIR = ../../bin
+QT -= gui
+# Input
+SOURCES += qmlconv.cpp
+
+target.path=$$[QT_INSTALL_BINS]
+INSTALLS += target
+
+CONFIG += console
+macx:CONFIG -= app_bundle
diff --git a/tools/qvfb/config.ui b/tools/qvfb/config.ui
index 7a45bfe..82a3d38 100644
--- a/tools/qvfb/config.ui
+++ b/tools/qvfb/config.ui
@@ -1,4 +1,5 @@
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
<comment>*********************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
@@ -40,181 +41,145 @@
**
*********************************************************************</comment>
<class>Config</class>
- <widget class="QDialog" name="Config" >
- <property name="geometry" >
+ <widget class="QDialog" name="Config">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
- <height>650</height>
+ <height>665</height>
</rect>
</property>
- <property name="windowTitle" >
+ <property name="windowTitle">
<string>Configure</string>
</property>
- <property name="sizeGripEnabled" >
+ <property name="sizeGripEnabled">
<bool>true</bool>
</property>
- <layout class="QVBoxLayout" >
- <property name="spacing" >
+ <layout class="QVBoxLayout">
+ <property name="spacing">
<number>6</number>
</property>
- <property name="leftMargin" >
- <number>8</number>
- </property>
- <property name="topMargin" >
- <number>8</number>
- </property>
- <property name="rightMargin" >
- <number>8</number>
- </property>
- <property name="bottomMargin" >
+ <property name="margin">
<number>8</number>
</property>
<item>
- <layout class="QHBoxLayout" >
- <property name="spacing" >
+ <layout class="QHBoxLayout">
+ <property name="spacing">
<number>6</number>
</property>
- <property name="leftMargin" >
- <number>0</number>
- </property>
- <property name="topMargin" >
- <number>0</number>
- </property>
- <property name="rightMargin" >
- <number>0</number>
- </property>
- <property name="bottomMargin" >
+ <property name="margin">
<number>0</number>
</property>
<item>
- <widget class="QGroupBox" name="ButtonGroup1" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
+ <widget class="QGroupBox" name="ButtonGroup1">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="title" >
+ <property name="title">
<string>Size</string>
</property>
- <layout class="QVBoxLayout" >
- <property name="spacing" >
+ <layout class="QVBoxLayout">
+ <property name="spacing">
<number>6</number>
</property>
- <property name="leftMargin" >
- <number>11</number>
- </property>
- <property name="topMargin" >
- <number>11</number>
- </property>
- <property name="rightMargin" >
- <number>11</number>
- </property>
- <property name="bottomMargin" >
+ <property name="margin">
<number>11</number>
</property>
<item>
- <widget class="QRadioButton" name="size_176_220" >
- <property name="text" >
- <string>176x220 "SmartPhone"</string>
+ <widget class="QRadioButton" name="size_176_220">
+ <property name="text">
+ <string>176x220 &quot;SmartPhone&quot;</string>
</property>
</widget>
</item>
<item>
- <widget class="QRadioButton" name="size_240_320" >
- <property name="text" >
- <string>240x320 "PDA"</string>
+ <widget class="QRadioButton" name="size_240_320">
+ <property name="text">
+ <string>240x320 &quot;PDA&quot;</string>
</property>
</widget>
</item>
<item>
- <widget class="QRadioButton" name="size_320_240" >
- <property name="text" >
- <string>320x240 "TV" / "QVGA"</string>
+ <widget class="QRadioButton" name="size_320_240">
+ <property name="text">
+ <string>320x240 &quot;TV&quot; / &quot;QVGA&quot;</string>
</property>
</widget>
</item>
<item>
- <widget class="QRadioButton" name="size_640_480" >
- <property name="text" >
- <string>640x480 "VGA"</string>
+ <widget class="QRadioButton" name="size_640_480">
+ <property name="text">
+ <string>640x480 &quot;VGA&quot;</string>
</property>
</widget>
</item>
<item>
- <widget class="QRadioButton" name="size_800_600" >
- <property name="text" >
+ <widget class="QRadioButton" name="size_800_600">
+ <property name="text">
<string>800x600</string>
</property>
</widget>
</item>
<item>
- <widget class="QRadioButton" name="size_1024_768" >
- <property name="text" >
+ <widget class="QRadioButton" name="size_1024_768">
+ <property name="text">
<string>1024x768</string>
</property>
</widget>
</item>
<item>
- <layout class="QHBoxLayout" >
- <property name="spacing" >
+ <layout class="QHBoxLayout">
+ <property name="spacing">
<number>6</number>
</property>
- <property name="leftMargin" >
- <number>0</number>
- </property>
- <property name="topMargin" >
- <number>0</number>
- </property>
- <property name="rightMargin" >
- <number>0</number>
- </property>
- <property name="bottomMargin" >
+ <property name="margin">
<number>0</number>
</property>
<item>
- <widget class="QRadioButton" name="size_custom" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+ <widget class="QRadioButton" name="size_custom">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="text" >
+ <property name="text">
<string>Custom</string>
</property>
</widget>
</item>
<item>
- <widget class="QSpinBox" name="size_width" >
- <property name="minimum" >
+ <widget class="QSpinBox" name="size_width">
+ <property name="minimum">
<number>1</number>
</property>
- <property name="maximum" >
+ <property name="maximum">
<number>1280</number>
</property>
- <property name="singleStep" >
+ <property name="singleStep">
<number>16</number>
</property>
- <property name="value" >
+ <property name="value">
<number>400</number>
</property>
</widget>
</item>
<item>
- <widget class="QSpinBox" name="size_height" >
- <property name="minimum" >
+ <widget class="QSpinBox" name="size_height">
+ <property name="minimum">
<number>1</number>
</property>
- <property name="maximum" >
+ <property name="maximum">
<number>1024</number>
</property>
- <property name="singleStep" >
+ <property name="singleStep">
<number>16</number>
</property>
- <property name="value" >
+ <property name="value">
<number>300</number>
</property>
</widget>
@@ -225,135 +190,128 @@
</widget>
</item>
<item>
- <widget class="QGroupBox" name="ButtonGroup2" >
- <property name="title" >
+ <widget class="QGroupBox" name="ButtonGroup2">
+ <property name="title">
<string>Depth</string>
</property>
- <layout class="QVBoxLayout" >
- <property name="spacing" >
- <number>6</number>
- </property>
- <property name="leftMargin" >
- <number>11</number>
- </property>
- <property name="topMargin" >
- <number>11</number>
- </property>
- <property name="rightMargin" >
- <number>11</number>
- </property>
- <property name="bottomMargin" >
- <number>11</number>
- </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
<item>
- <widget class="QRadioButton" name="depth_1" >
- <property name="text" >
+ <widget class="QRadioButton" name="depth_1">
+ <property name="text">
<string>1 bit monochrome</string>
</property>
</widget>
</item>
<item>
- <widget class="QRadioButton" name="depth_4gray" >
- <property name="text" >
+ <widget class="QRadioButton" name="depth_2gray">
+ <property name="text">
+ <string>2 bit grayscale</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="depth_4gray">
+ <property name="text">
<string>4 bit grayscale</string>
</property>
</widget>
</item>
<item>
- <widget class="QRadioButton" name="depth_8" >
- <property name="text" >
+ <widget class="QRadioButton" name="depth_8">
+ <property name="text">
<string>8 bit</string>
</property>
</widget>
</item>
<item>
- <widget class="QRadioButton" name="depth_12" >
- <property name="text" >
+ <widget class="QRadioButton" name="depth_12">
+ <property name="text">
<string>12 (16) bit</string>
</property>
</widget>
</item>
<item>
- <widget class="QRadioButton" name="depth_15" >
- <property name="text" >
+ <widget class="QRadioButton" name="depth_15">
+ <property name="text">
<string>15 bit</string>
</property>
</widget>
</item>
<item>
- <widget class="QRadioButton" name="depth_16" >
- <property name="text" >
+ <widget class="QRadioButton" name="depth_16">
+ <property name="text">
<string>16 bit</string>
</property>
</widget>
</item>
<item>
- <widget class="QRadioButton" name="depth_18" >
- <property name="text" >
+ <widget class="QRadioButton" name="depth_18">
+ <property name="text">
<string>18 bit</string>
</property>
</widget>
</item>
<item>
- <widget class="QRadioButton" name="depth_24" >
- <property name="text" >
+ <widget class="QRadioButton" name="depth_24">
+ <property name="text">
<string>24 bit</string>
</property>
</widget>
</item>
<item>
- <widget class="QRadioButton" name="depth_32" >
- <property name="text" >
+ <widget class="QRadioButton" name="depth_32">
+ <property name="text">
<string>32 bit</string>
</property>
</widget>
</item>
<item>
- <widget class="QRadioButton" name="depth_32_argb" >
- <property name="text" >
+ <widget class="QRadioButton" name="depth_32_argb">
+ <property name="text">
<string>32 bit ARGB</string>
</property>
</widget>
</item>
+ <item>
+ <widget class="QCheckBox" name="rgbSwapped">
+ <property name="toolTip">
+ <string>Swap red and blue channels</string>
+ </property>
+ <property name="text">
+ <string>BGR format</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
- <layout class="QHBoxLayout" >
- <property name="spacing" >
+ <layout class="QHBoxLayout">
+ <property name="spacing">
<number>6</number>
</property>
- <property name="leftMargin" >
- <number>0</number>
- </property>
- <property name="topMargin" >
- <number>0</number>
- </property>
- <property name="rightMargin" >
- <number>0</number>
- </property>
- <property name="bottomMargin" >
+ <property name="margin">
<number>0</number>
</property>
<item>
- <widget class="QLabel" name="TextLabel1_3" >
- <property name="text" >
+ <widget class="QLabel" name="TextLabel1_3">
+ <property name="text">
<string>Skin</string>
</property>
</widget>
</item>
<item>
- <widget class="QComboBox" name="skin" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+ <widget class="QComboBox" name="skin">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
- <property name="text" >
+ <property name="text">
<string>None</string>
</property>
</item>
@@ -362,25 +320,25 @@
</layout>
</item>
<item>
- <widget class="QCheckBox" name="touchScreen" >
- <property name="text" >
+ <widget class="QCheckBox" name="touchScreen">
+ <property name="text">
<string>Emulate touch screen (no mouse move)</string>
</property>
</widget>
</item>
<item>
- <widget class="QCheckBox" name="lcdScreen" >
- <property name="text" >
+ <widget class="QCheckBox" name="lcdScreen">
+ <property name="text">
<string>Emulate LCD screen (Only with fixed zoom of 3.0 times magnification)</string>
</property>
</widget>
</item>
<item>
<spacer>
- <property name="orientation" >
+ <property name="orientation">
<enum>Qt::Vertical</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
@@ -389,204 +347,192 @@
</spacer>
</item>
<item>
- <widget class="QLabel" name="TextLabel1" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
+ <widget class="QLabel" name="TextLabel1">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="text" >
- <string>&lt;p>Note that any applications using the virtual framebuffer will be terminated if you change the Size or Depth &lt;i>above&lt;/i>. You may freely modify the Gamma &lt;i>below&lt;/i>.</string>
+ <property name="text">
+ <string>&lt;p&gt;Note that any applications using the virtual framebuffer will be terminated if you change the Size or Depth &lt;i&gt;above&lt;/i&gt;. You may freely modify the Gamma &lt;i&gt;below&lt;/i&gt;.</string>
</property>
- <property name="wordWrap" >
+ <property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
- <widget class="QGroupBox" name="GroupBox1" >
- <property name="title" >
+ <widget class="QGroupBox" name="GroupBox1">
+ <property name="title">
<string>Gamma</string>
</property>
- <layout class="QGridLayout" >
- <property name="leftMargin" >
- <number>11</number>
- </property>
- <property name="topMargin" >
- <number>11</number>
- </property>
- <property name="rightMargin" >
- <number>11</number>
- </property>
- <property name="bottomMargin" >
+ <layout class="QGridLayout">
+ <property name="margin">
<number>11</number>
</property>
- <property name="horizontalSpacing" >
+ <property name="spacing">
<number>6</number>
</property>
- <property name="verticalSpacing" >
- <number>6</number>
- </property>
- <item row="6" column="0" >
- <widget class="QLabel" name="TextLabel3" >
- <property name="text" >
+ <item row="6" column="0">
+ <widget class="QLabel" name="TextLabel3">
+ <property name="text">
<string>Blue</string>
</property>
</widget>
</item>
- <item row="6" column="1" >
- <widget class="QSlider" name="bslider" >
- <property name="palette" >
+ <item row="6" column="1">
+ <widget class="QSlider" name="bslider">
+ <property name="palette">
<palette>
<active>
- <colorrole role="WindowText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="WindowText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Button" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Button">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Light" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Light">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>127</red>
<green>127</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Midlight" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Midlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>38</red>
<green>38</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Dark" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Dark">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Mid" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Mid">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>170</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Text" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Text">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="BrightText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="BrightText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="ButtonText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="ButtonText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Base" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Base">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Window" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Window">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>220</red>
<green>220</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Shadow" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Shadow">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Highlight" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Highlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>10</red>
<green>95</green>
<blue>137</blue>
</color>
</brush>
</colorrole>
- <colorrole role="HighlightedText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="HighlightedText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Link" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Link">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="LinkVisited" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="LinkVisited">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="AlternateBase" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="AlternateBase">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>232</red>
<green>232</green>
<blue>232</blue>
@@ -595,153 +541,153 @@
</colorrole>
</active>
<inactive>
- <colorrole role="WindowText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="WindowText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Button" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Button">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Light" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Light">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>127</red>
<green>127</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Midlight" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Midlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>38</red>
<green>38</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Dark" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Dark">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Mid" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Mid">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>170</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Text" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Text">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="BrightText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="BrightText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="ButtonText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="ButtonText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Base" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Base">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Window" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Window">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>220</red>
<green>220</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Shadow" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Shadow">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Highlight" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Highlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>10</red>
<green>95</green>
<blue>137</blue>
</color>
</brush>
</colorrole>
- <colorrole role="HighlightedText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="HighlightedText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Link" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Link">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="LinkVisited" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="LinkVisited">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="AlternateBase" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="AlternateBase">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>232</red>
<green>232</green>
<blue>232</blue>
@@ -750,153 +696,153 @@
</colorrole>
</inactive>
<disabled>
- <colorrole role="WindowText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="WindowText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Button" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Button">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Light" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Light">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>127</red>
<green>127</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Midlight" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Midlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>38</red>
<green>38</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Dark" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Dark">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Mid" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Mid">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>170</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Text" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Text">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="BrightText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="BrightText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="ButtonText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="ButtonText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Base" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Base">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Window" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Window">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>220</red>
<green>220</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Shadow" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Shadow">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Highlight" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Highlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>10</red>
<green>95</green>
<blue>137</blue>
</color>
</brush>
</colorrole>
- <colorrole role="HighlightedText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="HighlightedText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Link" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Link">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="LinkVisited" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="LinkVisited">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="AlternateBase" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="AlternateBase">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>232</red>
<green>232</green>
<blue>232</blue>
@@ -906,183 +852,183 @@
</disabled>
</palette>
</property>
- <property name="maximum" >
+ <property name="maximum">
<number>400</number>
</property>
- <property name="value" >
+ <property name="value">
<number>100</number>
</property>
- <property name="orientation" >
+ <property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
- <item row="6" column="2" >
- <widget class="QLabel" name="blabel" >
- <property name="text" >
+ <item row="6" column="2">
+ <widget class="QLabel" name="blabel">
+ <property name="text">
<string>1.0</string>
</property>
</widget>
</item>
- <item row="4" column="0" >
- <widget class="QLabel" name="TextLabel2" >
- <property name="text" >
+ <item row="4" column="0">
+ <widget class="QLabel" name="TextLabel2">
+ <property name="text">
<string>Green</string>
</property>
</widget>
</item>
- <item row="4" column="1" >
- <widget class="QSlider" name="gslider" >
- <property name="palette" >
+ <item row="4" column="1">
+ <widget class="QSlider" name="gslider">
+ <property name="palette">
<palette>
<active>
- <colorrole role="WindowText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="WindowText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Button" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Button">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>255</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Light" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Light">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>127</red>
<green>255</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Midlight" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Midlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>38</red>
<green>255</green>
<blue>38</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Dark" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Dark">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>127</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Mid" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Mid">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>170</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Text" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Text">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="BrightText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="BrightText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="ButtonText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="ButtonText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Base" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Base">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Window" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Window">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>220</red>
<green>220</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Shadow" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Shadow">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Highlight" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Highlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>10</red>
<green>95</green>
<blue>137</blue>
</color>
</brush>
</colorrole>
- <colorrole role="HighlightedText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="HighlightedText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Link" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Link">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="LinkVisited" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="LinkVisited">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="AlternateBase" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="AlternateBase">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>232</red>
<green>232</green>
<blue>232</blue>
@@ -1091,153 +1037,153 @@
</colorrole>
</active>
<inactive>
- <colorrole role="WindowText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="WindowText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Button" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Button">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>255</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Light" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Light">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>127</red>
<green>255</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Midlight" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Midlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>38</red>
<green>255</green>
<blue>38</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Dark" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Dark">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>127</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Mid" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Mid">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>170</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Text" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Text">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="BrightText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="BrightText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="ButtonText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="ButtonText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Base" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Base">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Window" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Window">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>220</red>
<green>220</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Shadow" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Shadow">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Highlight" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Highlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>10</red>
<green>95</green>
<blue>137</blue>
</color>
</brush>
</colorrole>
- <colorrole role="HighlightedText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="HighlightedText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Link" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Link">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="LinkVisited" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="LinkVisited">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="AlternateBase" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="AlternateBase">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>232</red>
<green>232</green>
<blue>232</blue>
@@ -1246,153 +1192,153 @@
</colorrole>
</inactive>
<disabled>
- <colorrole role="WindowText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="WindowText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Button" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Button">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>255</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Light" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Light">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>127</red>
<green>255</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Midlight" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Midlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>38</red>
<green>255</green>
<blue>38</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Dark" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Dark">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>127</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Mid" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Mid">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>170</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Text" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Text">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="BrightText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="BrightText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="ButtonText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="ButtonText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Base" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Base">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Window" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Window">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>220</red>
<green>220</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Shadow" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Shadow">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Highlight" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Highlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>10</red>
<green>95</green>
<blue>137</blue>
</color>
</brush>
</colorrole>
- <colorrole role="HighlightedText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="HighlightedText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Link" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Link">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="LinkVisited" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="LinkVisited">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="AlternateBase" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="AlternateBase">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>232</red>
<green>232</green>
<blue>232</blue>
@@ -1402,190 +1348,190 @@
</disabled>
</palette>
</property>
- <property name="maximum" >
+ <property name="maximum">
<number>400</number>
</property>
- <property name="value" >
+ <property name="value">
<number>100</number>
</property>
- <property name="orientation" >
+ <property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
- <item row="4" column="2" >
- <widget class="QLabel" name="glabel" >
- <property name="text" >
+ <item row="4" column="2">
+ <widget class="QLabel" name="glabel">
+ <property name="text">
<string>1.0</string>
</property>
</widget>
</item>
- <item row="0" column="0" >
- <widget class="QLabel" name="TextLabel7" >
- <property name="text" >
+ <item row="0" column="0">
+ <widget class="QLabel" name="TextLabel7">
+ <property name="text">
<string>All</string>
</property>
</widget>
</item>
- <item row="0" column="2" >
- <widget class="QLabel" name="TextLabel8" >
- <property name="text" >
+ <item row="0" column="2">
+ <widget class="QLabel" name="TextLabel8">
+ <property name="text">
<string>1.0</string>
</property>
</widget>
</item>
- <item row="0" column="1" >
- <widget class="QSlider" name="gammaslider" >
- <property name="palette" >
+ <item row="0" column="1">
+ <widget class="QSlider" name="gammaslider">
+ <property name="palette">
<palette>
<active>
- <colorrole role="WindowText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="WindowText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Button" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Button">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Light" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Light">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Midlight" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Midlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Dark" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Dark">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>127</red>
<green>127</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Mid" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Mid">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>170</red>
<green>170</green>
<blue>170</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Text" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Text">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="BrightText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="BrightText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="ButtonText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="ButtonText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Base" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Base">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Window" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Window">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>220</red>
<green>220</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Shadow" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Shadow">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Highlight" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Highlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>10</red>
<green>95</green>
<blue>137</blue>
</color>
</brush>
</colorrole>
- <colorrole role="HighlightedText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="HighlightedText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Link" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Link">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="LinkVisited" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="LinkVisited">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="AlternateBase" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="AlternateBase">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>232</red>
<green>232</green>
<blue>232</blue>
@@ -1594,153 +1540,153 @@
</colorrole>
</active>
<inactive>
- <colorrole role="WindowText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="WindowText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Button" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Button">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Light" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Light">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Midlight" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Midlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Dark" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Dark">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>127</red>
<green>127</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Mid" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Mid">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>170</red>
<green>170</green>
<blue>170</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Text" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Text">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="BrightText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="BrightText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="ButtonText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="ButtonText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Base" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Base">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Window" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Window">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>220</red>
<green>220</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Shadow" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Shadow">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Highlight" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Highlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>10</red>
<green>95</green>
<blue>137</blue>
</color>
</brush>
</colorrole>
- <colorrole role="HighlightedText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="HighlightedText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Link" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Link">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="LinkVisited" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="LinkVisited">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="AlternateBase" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="AlternateBase">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>232</red>
<green>232</green>
<blue>232</blue>
@@ -1749,153 +1695,153 @@
</colorrole>
</inactive>
<disabled>
- <colorrole role="WindowText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="WindowText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Button" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Button">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Light" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Light">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Midlight" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Midlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Dark" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Dark">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>127</red>
<green>127</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Mid" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Mid">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>170</red>
<green>170</green>
<blue>170</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Text" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Text">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="BrightText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="BrightText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="ButtonText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="ButtonText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Base" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Base">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Window" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Window">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>220</red>
<green>220</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Shadow" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Shadow">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Highlight" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Highlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>10</red>
<green>95</green>
<blue>137</blue>
</color>
</brush>
</colorrole>
- <colorrole role="HighlightedText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="HighlightedText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Link" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Link">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="LinkVisited" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="LinkVisited">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="AlternateBase" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="AlternateBase">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>232</red>
<green>232</green>
<blue>232</blue>
@@ -1905,183 +1851,183 @@
</disabled>
</palette>
</property>
- <property name="maximum" >
+ <property name="maximum">
<number>400</number>
</property>
- <property name="value" >
+ <property name="value">
<number>100</number>
</property>
- <property name="orientation" >
+ <property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
- <item row="2" column="0" >
- <widget class="QLabel" name="TextLabel1_2" >
- <property name="text" >
+ <item row="2" column="0">
+ <widget class="QLabel" name="TextLabel1_2">
+ <property name="text">
<string>Red</string>
</property>
</widget>
</item>
- <item row="2" column="2" >
- <widget class="QLabel" name="rlabel" >
- <property name="text" >
+ <item row="2" column="2">
+ <widget class="QLabel" name="rlabel">
+ <property name="text">
<string>1.0</string>
</property>
</widget>
</item>
- <item row="2" column="1" >
- <widget class="QSlider" name="rslider" >
- <property name="palette" >
+ <item row="2" column="1">
+ <widget class="QSlider" name="rslider">
+ <property name="palette">
<palette>
<active>
- <colorrole role="WindowText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="WindowText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Button" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Button">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Light" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Light">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>127</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Midlight" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Midlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>38</green>
<blue>38</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Dark" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Dark">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>127</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Mid" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Mid">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>170</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Text" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Text">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="BrightText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="BrightText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="ButtonText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="ButtonText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Base" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Base">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Window" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Window">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>220</red>
<green>220</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Shadow" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Shadow">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Highlight" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Highlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>10</red>
<green>95</green>
<blue>137</blue>
</color>
</brush>
</colorrole>
- <colorrole role="HighlightedText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="HighlightedText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Link" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Link">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="LinkVisited" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="LinkVisited">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="AlternateBase" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="AlternateBase">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>232</red>
<green>232</green>
<blue>232</blue>
@@ -2090,153 +2036,153 @@
</colorrole>
</active>
<inactive>
- <colorrole role="WindowText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="WindowText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Button" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Button">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Light" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Light">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>127</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Midlight" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Midlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>38</green>
<blue>38</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Dark" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Dark">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>127</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Mid" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Mid">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>170</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Text" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Text">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="BrightText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="BrightText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="ButtonText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="ButtonText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Base" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Base">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Window" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Window">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>220</red>
<green>220</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Shadow" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Shadow">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Highlight" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Highlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>10</red>
<green>95</green>
<blue>137</blue>
</color>
</brush>
</colorrole>
- <colorrole role="HighlightedText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="HighlightedText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Link" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Link">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="LinkVisited" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="LinkVisited">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="AlternateBase" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="AlternateBase">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>232</red>
<green>232</green>
<blue>232</blue>
@@ -2245,153 +2191,153 @@
</colorrole>
</inactive>
<disabled>
- <colorrole role="WindowText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="WindowText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Button" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Button">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Light" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Light">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>127</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Midlight" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Midlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>38</green>
<blue>38</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Dark" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Dark">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>127</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Mid" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Mid">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>170</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Text" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Text">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="BrightText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="BrightText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="ButtonText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="ButtonText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Base" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Base">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Window" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Window">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>220</red>
<green>220</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Shadow" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Shadow">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Highlight" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Highlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>10</red>
<green>95</green>
<blue>137</blue>
</color>
</brush>
</colorrole>
- <colorrole role="HighlightedText" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="HighlightedText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
- <colorrole role="Link" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="Link">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="LinkVisited" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="LinkVisited">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
- <colorrole role="AlternateBase" >
- <brush brushstyle="SolidPattern" >
- <color alpha="255" >
+ <colorrole role="AlternateBase">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
<red>232</red>
<green>232</green>
<blue>232</blue>
@@ -2401,53 +2347,44 @@
</disabled>
</palette>
</property>
- <property name="maximum" >
+ <property name="maximum">
<number>400</number>
</property>
- <property name="value" >
+ <property name="value">
<number>100</number>
</property>
- <property name="orientation" >
+ <property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
- <item row="8" column="0" colspan="3" >
- <widget class="QPushButton" name="PushButton3" >
- <property name="text" >
+ <item row="8" column="0" colspan="3">
+ <widget class="QPushButton" name="PushButton3">
+ <property name="text">
<string>Set all to 1.0</string>
</property>
</widget>
</item>
- <item rowspan="9" row="0" column="3" >
- <widget class="GammaView" native="1" name="MyCustomWidget1" />
+ <item row="0" column="3" rowspan="9">
+ <widget class="GammaView" name="MyCustomWidget1" native="true"/>
</item>
</layout>
</widget>
</item>
<item>
- <layout class="QHBoxLayout" >
- <property name="spacing" >
+ <layout class="QHBoxLayout">
+ <property name="spacing">
<number>6</number>
</property>
- <property name="leftMargin" >
- <number>0</number>
- </property>
- <property name="topMargin" >
- <number>0</number>
- </property>
- <property name="rightMargin" >
- <number>0</number>
- </property>
- <property name="bottomMargin" >
+ <property name="margin">
<number>0</number>
</property>
<item>
<spacer>
- <property name="orientation" >
+ <property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
@@ -2456,24 +2393,24 @@
</spacer>
</item>
<item>
- <widget class="QPushButton" name="buttonOk" >
- <property name="text" >
+ <widget class="QPushButton" name="buttonOk">
+ <property name="text">
<string>&amp;OK</string>
</property>
- <property name="autoDefault" >
+ <property name="autoDefault">
<bool>true</bool>
</property>
- <property name="default" >
+ <property name="default">
<bool>true</bool>
</property>
</widget>
</item>
<item>
- <widget class="QPushButton" name="buttonCancel" >
- <property name="text" >
+ <widget class="QPushButton" name="buttonCancel">
+ <property name="text">
<string>&amp;Cancel</string>
</property>
- <property name="autoDefault" >
+ <property name="autoDefault">
<bool>true</bool>
</property>
</widget>
@@ -2482,7 +2419,7 @@
</item>
</layout>
</widget>
- <layoutdefault spacing="6" margin="11" />
+ <layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>GammaView</class>
@@ -2498,11 +2435,11 @@
<receiver>size_custom</receiver>
<slot>click()</slot>
<hints>
- <hint type="sourcelabel" >
+ <hint type="sourcelabel">
<x>152</x>
<y>193</y>
</hint>
- <hint type="destinationlabel" >
+ <hint type="destinationlabel">
<x>94</x>
<y>199</y>
</hint>
@@ -2514,11 +2451,11 @@
<receiver>size_custom</receiver>
<slot>click()</slot>
<hints>
- <hint type="sourcelabel" >
+ <hint type="sourcelabel">
<x>259</x>
<y>196</y>
</hint>
- <hint type="destinationlabel" >
+ <hint type="destinationlabel">
<x>64</x>
<y>188</y>
</hint>
diff --git a/tools/qvfb/qvfb.cpp b/tools/qvfb/qvfb.cpp
index 62149a1..8de638f 100644
--- a/tools/qvfb/qvfb.cpp
+++ b/tools/qvfb/qvfb.cpp
@@ -635,6 +635,7 @@ void QVFb::configure()
config->touchScreen->setChecked(view->touchScreenEmulation());
config->lcdScreen->setChecked(view->lcdScreenEmulation());
chooseDepth(view->displayDepth(), view->displayFormat());
+ config->rgbSwapped->setChecked(view->rgbSwapped());
connect(config->skin, SIGNAL(activated(int)), this, SLOT(skinConfigChosen(int)));
if ( view->gammaRed() == view->gammaGreen() && view->gammaGreen() == view->gammaBlue() ) {
config->gammaslider->setValue(int(view->gammaRed()*400));
@@ -678,6 +679,8 @@ void QVFb::configure()
int d;
if ( config->depth_1->isChecked() )
d=1;
+ else if ( config->depth_2gray->isChecked() )
+ d=2;
else if ( config->depth_4gray->isChecked() )
d=4;
else if ( config->depth_8->isChecked() )
@@ -708,6 +711,7 @@ void QVFb::configure()
}
view->setViewFormat(displayFormat);
view->setTouchscreenEmulation( config->touchScreen->isChecked() );
+ view->setRgbSwapped(config->rgbSwapped->isChecked());
bool lcdEmulation = config->lcdScreen->isChecked();
view->setLcdScreenEmulation( lcdEmulation );
if ( lcdEmulation )
@@ -741,6 +745,7 @@ void QVFb::chooseSize(const QSize& sz)
void QVFb::chooseDepth(int depth, QVFbView::PixelFormat displayFormat)
{
config->depth_1->setChecked(depth==1);
+ config->depth_2gray->setChecked(depth==2);
config->depth_4gray->setChecked(depth==4);
config->depth_8->setChecked(depth==8);
config->depth_12->setChecked(depth==12);
diff --git a/tools/qvfb/qvfbview.cpp b/tools/qvfb/qvfbview.cpp
index 53a5360..e7c99ed 100644
--- a/tools/qvfb/qvfbview.cpp
+++ b/tools/qvfb/qvfbview.cpp
@@ -89,7 +89,7 @@ QVFbAbstractView::~QVFbAbstractView()
QVFbView::QVFbView(int id, int w, int h, int d, Rotation r, QWidget *parent)
: QVFbAbstractView(parent),
- viewdepth(d), viewFormat(DefaultFormat), rsh(0), gsh(0), bsh(0), rmax(15), gmax(15), bmax(15),
+ viewdepth(d), viewFormat(DefaultFormat), rgb_swapped(0), rsh(0), gsh(0), bsh(0), rmax(15), gmax(15), bmax(15),
contentsWidth(w), contentsHeight(h), gred(1.0), ggreen(1.0), gblue(1.0),
gammatable(0), refreshRate(30), animation(0),
hzm(0.0), vzm(0.0), mView(0),
@@ -457,6 +457,67 @@ QImage QVFbView::getBuffer(const QRect &r, int &leading) const
}
break;
}
+
+ case 2: {
+ if (requiredSize > buffer.size())
+ buffer.resize(requiredSize);
+
+ // XXX: hw: replace by drawhelper functionality
+
+ const int pixelsPerByte = 4;
+ quint8 *src = reinterpret_cast<quint8*>(mView->data())
+ + r.y() * mView->linestep() + r.x() / pixelsPerByte;
+ const int align = qMin(r.width(), (4 - (r.x() & 3)) & 3);
+ const int doAlign = (align > 0 ? 1 : 0);
+ const int tail = qMin(r.width(), (r.width() - align) & 3);
+ const int doTail = (tail > 0 ? 1 : 0);
+ const int width8 = (r.width() - align) / pixelsPerByte;
+ const int stride = mView->linestep() - (width8 + doAlign);
+
+ uchar *b = reinterpret_cast<uchar*>(buffer.data());
+ img = QImage(b, r.width(), r.height(), QImage::Format_RGB32);
+ for (int y = 0; y < r.height(); ++y) {
+ quint32 *dest = reinterpret_cast<quint32*>(img.scanLine(y));
+ quint8 c;
+
+ if (doAlign) {
+ switch (align) {
+ case 3: c = ((*src & 0x30) >> 4) * 0x55;
+ *dest++ = qRgb(c, c, c);
+ case 2: c = ((*src & 0x0c) >> 2) * 0x55;
+ *dest++ = qRgb(c, c, c);
+ case 1: c = ((*src & 0x03)) * 0x55;
+ *dest++ = qRgb(c, c, c);
+ }
+ ++src;
+ }
+ for (int i = 0; i < width8; ++i) {
+ c = ((*src & 0xc0) >> 6) * 0x55;
+ *dest++ = qRgb(c, c, c);
+ c = ((*src & 0x30) >> 4) * 0x55;
+ *dest++ = qRgb(c, c, c);
+ c = ((*src & 0x0c) >> 2) * 0x55;
+ *dest++ = qRgb(c, c, c);
+ c = ((*src & 0x03)) * 0x55;
+ *dest++ = qRgb(c, c, c);
+
+ ++src;
+ }
+ if (doTail) {
+ switch (tail) {
+ case 3: c = ((*src & 0x0c) >> 2) * 0x55;
+ dest[2] = qRgb(c, c, c);
+ case 2: c = ((*src & 0x30) >> 4) * 0x55;
+ dest[1] = qRgb(c, c, c);
+ case 1: c = ((*src & 0xc0) >> 6) * 0x55;
+ dest[0] = qRgb(c, c, c);
+ }
+ }
+ src += stride;
+ }
+ break;
+ }
+
case 4: {
if (requiredSize > buffer.size())
buffer.resize(requiredSize);
@@ -540,6 +601,9 @@ QImage QVFbView::getBuffer(const QRect &r, int &leading) const
break;
}
+ if (rgb_swapped)
+ img = img.rgbSwapped();
+
if ( brightness != 255 ) {
if (img.format() == QImage::Format_Indexed8) {
QVector<QRgb> c = img.colorTable();
diff --git a/tools/qvfb/qvfbview.h b/tools/qvfb/qvfbview.h
index d533613..1d43bdc 100644
--- a/tools/qvfb/qvfbview.h
+++ b/tools/qvfb/qvfbview.h
@@ -77,6 +77,7 @@ public:
virtual int displayHeight() const = 0;
virtual int displayDepth() const = 0;
virtual PixelFormat displayFormat() const { return DefaultFormat; }
+ virtual bool rgbSwapped() const { return false; }
virtual Rotation displayRotation() const = 0;
virtual void setGamma(double gr, double gg, double gb) = 0;
@@ -105,6 +106,7 @@ public slots:
virtual void skinKeyPressEvent( int code, const QString& text, bool autorep=FALSE ) = 0;
virtual void skinKeyReleaseEvent( int code, const QString& text, bool autorep=FALSE ) = 0;
virtual void setViewFormat(PixelFormat) {}
+ virtual void setRgbSwapped( bool ) {};
virtual void embedDisplay(WId) {}
};
@@ -120,6 +122,7 @@ public:
int displayHeight() const;
int displayDepth() const;
PixelFormat displayFormat() const;
+ bool rgbSwapped() const { return rgb_swapped; }
Rotation displayRotation() const;
bool touchScreenEmulation() const { return emulateTouchscreen; }
@@ -151,6 +154,7 @@ public slots:
void skinKeyPressEvent(int code, const QString& text, bool autorep=FALSE);
void skinKeyReleaseEvent(int code, const QString& text, bool autorep=FALSE);
void setViewFormat(PixelFormat);
+ void setRgbSwapped(bool b) { rgb_swapped = b; }
#ifdef Q_WS_X11
void embedDisplay(WId id);
#endif
@@ -180,6 +184,7 @@ private:
void setDirty(const QRect&);
int viewdepth; // "faked" depth
PixelFormat viewFormat;
+ bool rgb_swapped;
int rsh;
int gsh;
int bsh;
diff --git a/tools/tools.pro b/tools/tools.pro
index da4ff67..12da18c 100644
--- a/tools/tools.pro
+++ b/tools/tools.pro
@@ -24,7 +24,7 @@ mac {
SUBDIRS += kmap2qmap
-contains(QT_CONFIG, declarative):SUBDIRS += duiviewer
+contains(QT_CONFIG, declarative):SUBDIRS += duiviewer qmlconv
contains(QT_CONFIG, dbus):SUBDIRS += qdbus
!wince*:contains(QT_CONFIG, xmlpatterns): SUBDIRS += xmlpatterns
embedded: SUBDIRS += makeqpf
diff --git a/util/qlalr/doc/qlalr.qdocconf b/util/qlalr/doc/qlalr.qdocconf
index d97ff7d..a97ef6a 100644
--- a/util/qlalr/doc/qlalr.qdocconf
+++ b/util/qlalr/doc/qlalr.qdocconf
@@ -59,7 +59,7 @@ HTML.postheader = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0
HTML.footer = "<p /><address><hr /><div align=\"center\">\n" \
"<table width=\"100%\" cellspacing=\"0\" border=\"0\"><tr class=\"address\">\n" \
- "<td width=\"30%\">Copyright &copy; \$THISYEAR\$ <a href=\"trolltech.html\">Trolltech</a></td>\n" \
+ "<td width=\"30%\" align=\"left\">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>\n" \
"<td width=\"40%\" align=\"center\"><a href=\"trademarks.html\">Trademarks</a></td>\n" \
"<td width=\"30%\" align=\"right\"><div align=\"right\">Qt \\version</div></td>\n" \
"</tr></table></div></address>"
diff --git a/util/scripts/make_qfeatures_dot_h b/util/scripts/make_qfeatures_dot_h
index 056c113..27f43e9 100755
--- a/util/scripts/make_qfeatures_dot_h
+++ b/util/scripts/make_qfeatures_dot_h
@@ -2,9 +2,9 @@
#
# Usage: make_qfeatures_dot_h
#
-# Generates core/base/qfeatures.h from core/base/qfeatures.txt.
+# Generates src/corelib/global/qfeatures.h from src/corelib/global/qfeatures.txt.
#
-# The tools/qfeatures.txt file can contain redundancies, and this program
+# The qfeatures.txt file can contain redundancies, and this program
# will show them.
#
@@ -86,11 +86,11 @@ print OUT
'/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Qt Software Information (qt-info\@nokia.com)
**
** This file is part of the QtCore module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** \$QT_BEGIN_LICENSE:LGPL\$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
@@ -119,8 +119,8 @@ print OUT
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
+** contact the sales department at qt-sales\@nokia.com.
+** \$QT_END_LICENSE\$
**
****************************************************************************/