summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin McPherson <justin.mcpherson@nokia.com>2010-01-07 07:21:30 (GMT)
committerJustin McPherson <justin.mcpherson@nokia.com>2010-01-07 07:21:30 (GMT)
commita3c1b0703575ed5fc364011c73dc104ecdb8ef0c (patch)
tree4e57559b1753c7b1eb3f375aa59eee6ea1108f70
parentf9ffe24a87d67f39bb877224f7e2b6f7b3ad6c02 (diff)
parent7a5bca82738e6b782047e50a813972eccd928307 (diff)
downloadQt-a3c1b0703575ed5fc364011c73dc104ecdb8ef0c.zip
Qt-a3c1b0703575ed5fc364011c73dc104ecdb8ef0c.tar.gz
Qt-a3c1b0703575ed5fc364011c73dc104ecdb8ef0c.tar.bz2
Merge branch '4.6' of ../../4.6 into 4.6
Conflicts: examples/multimedia/audiodevices/audiodevices.cpp
-rw-r--r--.gitignore1
-rw-r--r--config.tests/unix/neon/neon.cpp51
-rw-r--r--config.tests/unix/neon/neon.pro2
-rwxr-xr-xconfigure73
-rw-r--r--demos/demos.pro21
-rw-r--r--demos/embedded/anomaly/src/BrowserWindow.cpp147
-rw-r--r--demos/embedded/anomaly/src/BrowserWindow.h12
-rw-r--r--demos/embedded/anomaly/src/flickcharm.cpp287
-rw-r--r--demos/embedded/fluidlauncher/fluidlauncher.pro5
-rw-r--r--demos/embedded/weatherinfo/weatherinfo.cpp3
-rw-r--r--dist/changes-4.6.19
-rw-r--r--doc/src/deployment/deployment.qdoc4
-rw-r--r--doc/src/development/assistant-manual.qdoc9
-rw-r--r--doc/src/development/designer-manual.qdoc2
-rw-r--r--doc/src/examples/fademessage.qdoc10
-rw-r--r--doc/src/frameworks-technologies/animation.qdoc4
-rw-r--r--doc/src/frameworks-technologies/dnd.qdoc9
-rw-r--r--doc/src/getting-started/examples.qdoc16
-rw-r--r--doc/src/getting-started/installation.qdoc43
-rw-r--r--doc/src/modules.qdoc91
-rw-r--r--doc/src/objectmodel/signalsandslots.qdoc39
-rw-r--r--doc/src/platforms/symbian-introduction.qdoc7
-rw-r--r--doc/src/qt4-intro.qdoc2
-rw-r--r--doc/src/snippets/code/doc_src_deployment.qdoc6
-rw-r--r--doc/src/snippets/code/doc_src_installation.qdoc2
-rw-r--r--examples/multimedia/audiodevices/audiodevices.cpp73
-rw-r--r--examples/multimedia/audiodevices/audiodevices.h6
-rw-r--r--examples/multimedia/audiodevices/audiodevices.pro2
-rw-r--r--examples/multimedia/audiodevices/audiodevicesbase.ui64
-rw-r--r--examples/webkit/fancybrowser/main.cpp4
-rw-r--r--examples/webkit/googlechat/main.cpp4
-rw-r--r--examples/webkit/previewer/main.cpp4
-rw-r--r--mkspecs/features/symbian/platform_paths.prf22
-rw-r--r--mkspecs/features/symbian/qt.prf7
-rw-r--r--mkspecs/features/unix/separate_debug_info.prf2
-rw-r--r--mkspecs/hpux-g++-64/qmake.conf4
-rw-r--r--mkspecs/hpux-g++-64/qplatformdefs.h2
-rw-r--r--mkspecs/linux-g++-maemo/qmake.conf1
-rw-r--r--mkspecs/linux-g++/qplatformdefs.h1
-rw-r--r--mkspecs/solaris-cc-64-stlport/qmake.conf8
-rw-r--r--mkspecs/solaris-cc-64-stlport/qplatformdefs.h42
-rw-r--r--mkspecs/solaris-cc-stlport/qmake.conf8
-rw-r--r--mkspecs/solaris-cc-stlport/qplatformdefs.h42
-rw-r--r--mkspecs/unsupported/linux-host-g++/qmake.conf2
-rw-r--r--qmake/generators/symbian/symmake.cpp36
-rw-r--r--qmake/generators/symbian/symmake.h1
-rw-r--r--qmake/generators/symbian/symmake_abld.cpp48
-rw-r--r--qmake/generators/symbian/symmake_sbsv2.cpp42
-rw-r--r--qmake/generators/win32/msvc_objectmodel.cpp4
-rw-r--r--qmake/generators/win32/msvc_objectmodel.h3
-rw-r--r--src/3rdparty/easing/easing.cpp22
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-hebrew.c4
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp3
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSObject.cpp10
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/ChangeLog22
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h30
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h12
-rw-r--r--src/3rdparty/webkit/VERSION2
-rw-r--r--src/3rdparty/webkit/WebCore/ChangeLog106
-rw-r--r--src/3rdparty/webkit/WebCore/WebCore.pro27
-rw-r--r--src/3rdparty/webkit/WebCore/dom/XMLTokenizer.h2
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp1
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp8
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/NetworkStateNotifier.h10
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/qt/NetworkStateNotifierPrivate.h49
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/qt/NetworkStateNotifierQt.cpp73
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/SVGImage.cpp5
-rw-r--r--src/3rdparty/webkit/WebCore/svg/graphics/SVGImage.h2
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp5
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp63
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebview.h5
-rw-r--r--src/3rdparty/webkit/WebKit/qt/ChangeLog86
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp9
-rw-r--r--src/3rdparty/webkit/WebKit/qt/symbian/bwins/QtWebKitu.def (renamed from src/s60installs/bwins/QtWebKitu.def)0
-rw-r--r--src/3rdparty/webkit/WebKit/qt/symbian/eabi/QtWebKitu.def (renamed from src/s60installs/eabi/QtWebKitu.def)0
-rw-r--r--src/activeqt/container/qaxbase.cpp2
-rw-r--r--src/corelib/animation/qvariantanimation.cpp7
-rw-r--r--src/corelib/concurrent/qtconcurrentiteratekernel.cpp3
-rw-r--r--src/corelib/global/qglobal.cpp62
-rw-r--r--src/corelib/io/qdebug.h2
-rw-r--r--src/corelib/io/qdir.cpp7
-rw-r--r--src/corelib/io/qfileinfo.cpp2
-rw-r--r--src/corelib/io/qfsfileengine.cpp2
-rw-r--r--src/corelib/io/qfsfileengine_unix.cpp5
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp9
-rw-r--r--src/corelib/io/qiodevice.cpp12
-rw-r--r--src/corelib/io/qresource.cpp2
-rw-r--r--src/corelib/io/qtextstream.cpp9
-rw-r--r--src/corelib/io/qurl.cpp14
-rw-r--r--src/corelib/kernel/qeventdispatcher_glib.cpp5
-rw-r--r--src/corelib/kernel/qeventdispatcher_glib_p.h2
-rw-r--r--src/corelib/kernel/qmath.h154
-rw-r--r--src/corelib/kernel/qmetaobject.cpp1
-rw-r--r--src/corelib/kernel/qobject.cpp64
-rw-r--r--src/corelib/kernel/qobject_p.h11
-rw-r--r--src/corelib/kernel/qvariant.h2
-rw-r--r--src/corelib/statemachine/qsignaltransition.cpp2
-rw-r--r--src/corelib/thread/qthread_p.h2
-rw-r--r--src/corelib/thread/qthread_unix.cpp4
-rw-r--r--src/corelib/thread/qthreadstorage.cpp97
-rw-r--r--src/corelib/tools/qcache.h3
-rw-r--r--src/corelib/tools/qline.cpp4
-rw-r--r--src/corelib/tools/qlocale.cpp8
-rw-r--r--src/corelib/tools/qregexp.h2
-rw-r--r--src/dbus/qdbusabstractinterface.cpp10
-rw-r--r--src/dbus/qdbusconnection.cpp4
-rw-r--r--src/dbus/qdbusconnection_p.h22
-rw-r--r--src/dbus/qdbusintegrator.cpp114
-rw-r--r--src/dbus/qdbusmarshaller.cpp4
-rw-r--r--src/dbus/qdbuspendingcall.cpp2
-rw-r--r--src/dbus/qdbuspendingreply.h1
-rw-r--r--src/gui/dialogs/qcolordialog_mac.mm36
-rw-r--r--src/gui/dialogs/qfiledialog.cpp46
-rw-r--r--src/gui/dialogs/qfilesystemmodel.cpp5
-rw-r--r--src/gui/dialogs/qfontdialog_mac.mm4
-rw-r--r--src/gui/dialogs/qmessagebox.cpp17
-rw-r--r--src/gui/effects/qgraphicseffect.cpp40
-rw-r--r--src/gui/effects/qgraphicseffect_p.h11
-rw-r--r--src/gui/embedded/directfb.pri1
-rw-r--r--src/gui/embedded/qscreen_qws.cpp1
-rw-r--r--src/gui/embedded/qscreen_qws.h2
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout.cpp23
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout_p.cpp7
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp134
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h2
-rw-r--r--src/gui/graphicsview/qgraphicslayout.cpp4
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp50
-rw-r--r--src/gui/graphicsview/qgraphicsview.cpp56
-rw-r--r--src/gui/graphicsview/qgraphicsview.h1
-rw-r--r--src/gui/graphicsview/qgraphicsview_p.h3
-rw-r--r--src/gui/graphicsview/qgraphicswidget.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicswidget_p.cpp4
-rw-r--r--src/gui/graphicsview/qgraphicswidget_p.h2
-rw-r--r--src/gui/graphicsview/qgridlayoutengine.cpp7
-rw-r--r--src/gui/image/qimage.cpp19
-rw-r--r--src/gui/image/qimage.h6
-rw-r--r--src/gui/image/qimagereader.cpp42
-rw-r--r--src/gui/image/qpixmap.cpp9
-rw-r--r--src/gui/image/qpixmap.h2
-rw-r--r--src/gui/image/qpixmap_raster.cpp2
-rw-r--r--src/gui/image/qpixmap_s60.cpp103
-rw-r--r--src/gui/image/qpixmap_s60_p.h6
-rw-r--r--src/gui/image/qpixmap_x11.cpp2
-rw-r--r--src/gui/image/qpixmapcache.cpp5
-rw-r--r--src/gui/image/qpixmapfilter.cpp364
-rw-r--r--src/gui/image/qpnghandler.cpp5
-rw-r--r--src/gui/image/qppmhandler.cpp2
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_s60.cpp3
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp32
-rw-r--r--src/gui/itemviews/qabstractitemview_p.h1
-rw-r--r--src/gui/itemviews/qlistwidget.cpp2
-rw-r--r--src/gui/itemviews/qsortfilterproxymodel.cpp33
-rw-r--r--src/gui/itemviews/qtableview.cpp14
-rw-r--r--src/gui/itemviews/qtreeview.cpp1
-rw-r--r--src/gui/kernel/qapplication.cpp54
-rw-r--r--src/gui/kernel/qapplication_s60.cpp170
-rw-r--r--src/gui/kernel/qboxlayout.cpp6
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm11
-rw-r--r--src/gui/kernel/qevent.cpp8
-rw-r--r--src/gui/kernel/qgesturemanager.cpp42
-rw-r--r--src/gui/kernel/qgesturemanager_p.h4
-rw-r--r--src/gui/kernel/qguieventdispatcher_glib.cpp2
-rw-r--r--src/gui/kernel/qt_s60_p.h14
-rw-r--r--src/gui/kernel/qwidget.cpp25
-rw-r--r--src/gui/kernel/qwidget_mac.mm7
-rw-r--r--src/gui/kernel/qwidget_x11.cpp2
-rw-r--r--src/gui/painting/painting.pri7
-rw-r--r--src/gui/painting/qbezier.cpp20
-rw-r--r--src/gui/painting/qbezier_p.h2
-rw-r--r--src/gui/painting/qblendfunctions.cpp2
-rw-r--r--src/gui/painting/qdrawhelper.cpp33
-rw-r--r--src/gui/painting/qdrawhelper_neon.cpp260
-rw-r--r--src/gui/painting/qdrawhelper_neon_p.h76
-rw-r--r--src/gui/painting/qmatrix.h2
-rw-r--r--src/gui/painting/qmemrotate.cpp21
-rw-r--r--src/gui/painting/qmemrotate_p.h2
-rw-r--r--src/gui/painting/qpaintdevice.h2
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp4
-rw-r--r--src/gui/painting/qpainter.cpp84
-rw-r--r--src/gui/painting/qpathclipper.cpp2
-rw-r--r--src/gui/painting/qprinterinfo_unix.cpp50
-rw-r--r--src/gui/painting/qregion.h2
-rw-r--r--src/gui/painting/qstroker.cpp4
-rw-r--r--src/gui/painting/qtextureglyphcache_p.h5
-rw-r--r--src/gui/painting/qwindowsurface_s60.cpp8
-rw-r--r--src/gui/statemachine/qguistatemachine.cpp2
-rw-r--r--src/gui/styles/qcommonstyle.cpp2
-rw-r--r--src/gui/styles/qs60style.cpp333
-rw-r--r--src/gui/styles/qs60style_p.h13
-rw-r--r--src/gui/styles/qs60style_s60.cpp817
-rw-r--r--src/gui/styles/qs60style_simulated.cpp5
-rw-r--r--src/gui/styles/qstylehelper.cpp2
-rw-r--r--src/gui/styles/styles.pri2
-rw-r--r--src/gui/text/qfontdatabase.cpp14
-rw-r--r--src/gui/text/qfontengine.cpp120
-rw-r--r--src/gui/text/qfontengine_mac.mm8
-rw-r--r--src/gui/text/qfontengine_p.h16
-rw-r--r--src/gui/text/qfontengineglyphcache_p.h7
-rw-r--r--src/gui/text/qtextcontrol.cpp6
-rw-r--r--src/gui/text/qtextcursor.cpp55
-rw-r--r--src/gui/text/qtextodfwriter.cpp13
-rw-r--r--src/gui/util/qsystemtrayicon_p.h1
-rw-r--r--src/gui/util/qsystemtrayicon_win.cpp21
-rw-r--r--src/gui/widgets/qabstractspinbox.cpp69
-rw-r--r--src/gui/widgets/qabstractspinbox_p.h3
-rw-r--r--src/gui/widgets/qcombobox.cpp5
-rw-r--r--src/gui/widgets/qdial.cpp3
-rw-r--r--src/gui/widgets/qdockarealayout.cpp4
-rw-r--r--src/gui/widgets/qlcdnumber.h3
-rw-r--r--src/gui/widgets/qlineedit.cpp16
-rw-r--r--src/gui/widgets/qlineedit.h1
-rw-r--r--src/gui/widgets/qlineedit_p.cpp20
-rw-r--r--src/gui/widgets/qlineedit_p.h2
-rw-r--r--src/gui/widgets/qmainwindow.h2
-rw-r--r--src/gui/widgets/qmainwindowlayout_mac.mm3
-rw-r--r--src/gui/widgets/qmdiarea.cpp16
-rw-r--r--src/gui/widgets/qplaintextedit.cpp11
-rw-r--r--src/gui/widgets/qprintpreviewwidget.h2
-rw-r--r--src/gui/widgets/qtextedit.cpp2
-rw-r--r--src/network/access/qnetworkreply.cpp2
-rw-r--r--src/network/access/qnetworkreplyimpl.cpp4
-rw-r--r--src/network/kernel/qhostinfo.cpp297
-rw-r--r--src/network/kernel/qhostinfo_p.h148
-rw-r--r--src/network/kernel/qhostinfo_win.cpp6
-rw-r--r--src/network/socket/qabstractsocket.cpp22
-rw-r--r--src/network/socket/qhttpsocketengine.cpp20
-rw-r--r--src/network/socket/qhttpsocketengine_p.h2
-rw-r--r--src/opengl/gl2paintengineex/qglcustomshaderstage_p.h2
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadermanager.cpp242
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadermanager_p.h8
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadersource_p.h66
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp826
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h109
-rw-r--r--src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp216
-rw-r--r--src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h123
-rw-r--r--src/opengl/gl2paintengineex/qtriangulatingstroker.cpp10
-rw-r--r--src/opengl/opengl.pro6
-rw-r--r--src/opengl/qgl.cpp199
-rw-r--r--src/opengl/qgl.h4
-rw-r--r--src/opengl/qgl_egl.cpp36
-rw-r--r--src/opengl/qgl_mac.mm2
-rw-r--r--src/opengl/qgl_p.h81
-rw-r--r--src/opengl/qgl_win.cpp2
-rw-r--r--src/opengl/qgl_x11.cpp95
-rw-r--r--src/opengl/qgl_x11egl.cpp164
-rw-r--r--src/opengl/qglframebufferobject.cpp6
-rw-r--r--src/opengl/qglpixelbuffer.cpp2
-rw-r--r--src/opengl/qglpixmapfilter.cpp754
-rw-r--r--src/opengl/qpaintengine_opengl.cpp14
-rw-r--r--src/opengl/qpixmapdata_gl.cpp17
-rw-r--r--src/openvg/openvg.pro6
-rw-r--r--src/openvg/qpaintengine_vg.cpp48
-rw-r--r--src/openvg/qpixmapdata_vg.cpp102
-rw-r--r--src/openvg/qpixmapdata_vg_p.h17
-rw-r--r--src/openvg/qpixmapfilter_vg.cpp25
-rw-r--r--src/openvg/qvgimagepool.cpp215
-rw-r--r--src/openvg/qvgimagepool_p.h157
-rw-r--r--src/openvg/qwindowsurface_vgegl.cpp4
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp36
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp1
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp76
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.h3
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp4
-rw-r--r--src/plugins/imageformats/gif/qgifhandler.cpp40
-rw-r--r--src/plugins/imageformats/jpeg/qjpeghandler.cpp407
-rw-r--r--src/plugins/imageformats/jpeg/qjpeghandler.h4
-rw-r--r--src/plugins/imageformats/tiff/qtiffhandler.cpp7
-rw-r--r--src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro2
-rw-r--r--src/s60installs/bwins/QtCoreu.def2
-rw-r--r--src/s60installs/bwins/QtGuiu.def21
-rw-r--r--src/s60installs/eabi/QtGuiu.def51
-rw-r--r--src/s60installs/eabi/QtOpenVGu.def8
-rw-r--r--src/s60installs/qt.iby26
-rw-r--r--src/s60installs/s60installs.pro9
-rw-r--r--src/s60main/qts60main.cpp59
-rw-r--r--src/s60main/qts60main_mcrt0.cpp53
-rw-r--r--src/script/bridge/qscriptobject.cpp17
-rw-r--r--src/script/bridge/qscriptobject_p.h4
-rw-r--r--src/script/bridge/qscriptqobject.cpp140
-rw-r--r--src/script/bridge/qscriptqobject_p.h4
-rw-r--r--src/sql/drivers/oci/qsql_oci.cpp4
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.cpp30
-rw-r--r--src/svg/qsvghandler.cpp36
-rw-r--r--src/svg/qsvgstyle.cpp4
-rw-r--r--src/tools/moc/generator.cpp11
-rw-r--r--src/tools/uic/cpp/cppwriteinitialization.cpp7
-rw-r--r--src/xml/sax/qxml.cpp4
-rw-r--r--src/xmlpatterns/api/api.pri116
-rw-r--r--src/xmlpatterns/api/qcoloringmessagehandler.cpp (renamed from tools/xmlpatterns/qcoloringmessagehandler.cpp)3
-rw-r--r--src/xmlpatterns/api/qcoloringmessagehandler_p.h (renamed from tools/xmlpatterns/qcoloringmessagehandler_p.h)0
-rw-r--r--src/xmlpatterns/api/qcoloroutput.cpp (renamed from tools/xmlpatterns/qcoloroutput.cpp)117
-rw-r--r--src/xmlpatterns/api/qcoloroutput_p.h (renamed from tools/xmlpatterns/qcoloroutput_p.h)0
-rw-r--r--src/xmlpatterns/api/qxmlpatternistcli_p.h74
-rw-r--r--src/xmlpatterns/xmlpatterns.pro34
-rw-r--r--tests/arthur/data/qps/aliasing.qps156
-rw-r--r--tests/arthur/data/qps/aliasing_qps.pngbin0 -> 30531 bytes
-rw-r--r--tests/auto/headers/tst_headers.cpp4
-rw-r--r--tests/auto/moc/tst_moc.cpp35
-rw-r--r--tests/auto/modeltest/dynamictreemodel.cpp (renamed from tests/auto/qabstractitemmodel/dynamictreemodel.cpp)0
-rw-r--r--tests/auto/modeltest/dynamictreemodel.h (renamed from tests/auto/qabstractitemmodel/dynamictreemodel.h)0
-rw-r--r--tests/auto/modeltest/modeltest.cpp20
-rw-r--r--tests/auto/modeltest/modeltest.pro4
-rw-r--r--tests/auto/modeltest/tst_modeltest.cpp157
-rw-r--r--tests/auto/qabstractitemmodel/qabstractitemmodel.pro7
-rw-r--r--tests/auto/qabstractitemview/tst_qabstractitemview.cpp23
-rw-r--r--tests/auto/qboxlayout/tst_qboxlayout.cpp27
-rw-r--r--tests/auto/qdbuspendingreply/tst_qdbuspendingreply.cpp25
-rw-r--r--tests/auto/qdbusreply/tst_qdbusreply.cpp16
-rw-r--r--tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp12
-rw-r--r--tests/auto/qfile/tst_qfile.cpp116
-rw-r--r--tests/auto/qfiledialog/tst_qfiledialog.cpp1
-rw-r--r--tests/auto/qfiledialog2/tst_qfiledialog2.cpp108
-rw-r--r--tests/auto/qfileinfo/tst_qfileinfo.cpp12
-rw-r--r--tests/auto/qfontcombobox/tst_qfontcombobox.cpp4
-rw-r--r--tests/auto/qftp/tst_qftp.cpp5
-rw-r--r--tests/auto/qgl/tst_qgl.cpp52
-rw-r--r--tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp20
-rw-r--r--tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp49
-rw-r--r--tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp2
-rw-r--r--tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp382
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp40
-rw-r--r--tests/auto/qgraphicsview/tst_qgraphicsview.cpp117
-rw-r--r--tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp32
-rw-r--r--tests/auto/qhostinfo/tst_qhostinfo.cpp49
-rw-r--r--tests/auto/qhttp/tst_qhttp.cpp5
-rw-r--r--tests/auto/qimagereader/images/endless-anim.gifbin0 -> 819 bytes
-rw-r--r--tests/auto/qimagereader/images/four-frames.gifbin0 -> 427 bytes
-rw-r--r--tests/auto/qimagereader/qimagereader.qrc2
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp148
-rw-r--r--tests/auto/qlistwidget/tst_qlistwidget.cpp8
-rw-r--r--tests/auto/qobject/tst_qobject.cpp152
-rw-r--r--tests/auto/qpauseanimation/tst_qpauseanimation.cpp4
-rw-r--r--tests/auto/qpixmap/tst_qpixmap.cpp6
-rw-r--r--tests/auto/qpixmapcache/tst_qpixmapcache.cpp19
-rw-r--r--tests/auto/qresourceengine/tst_qresourceengine.cpp22
-rw-r--r--tests/auto/qscriptable/tst_qscriptable.cpp1
-rw-r--r--tests/auto/qsharedmemory/tst_qsharedmemory.cpp4
-rw-r--r--tests/auto/qsqldatabase/tst_qsqldatabase.cpp59
-rw-r--r--tests/auto/qsqlquery/tst_qsqlquery.cpp62
-rw-r--r--tests/auto/qsslsocket/tst_qsslsocket.cpp11
-rw-r--r--tests/auto/qtcpserver/test/test.pro2
-rw-r--r--tests/auto/qtcpserver/tst_qtcpserver.cpp180
-rw-r--r--tests/auto/qtcpsocket/test/test.pro2
-rw-r--r--tests/auto/qtcpsocket/tst_qtcpsocket.cpp24
-rw-r--r--tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp4
-rw-r--r--tests/auto/qudpsocket/test/test.pro1
-rw-r--r--tests/auto/qudpsocket/tst_qudpsocket.cpp18
-rw-r--r--tests/auto/qurl/tst_qurl.cpp7
-rw-r--r--tests/auto/qvariant/tst_qvariant.cpp17
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp30
-rw-r--r--tests/auto/selftests/tst_selftests.cpp6
-rw-r--r--tests/auto/uic/baseline/config_fromuic3.ui1647
-rw-r--r--tests/auto/uic/baseline/config_fromuic3.ui.h715
-rw-r--r--tests/auto/uic3/baseline/config.ui11
-rw-r--r--tests/auto/uic3/baseline/config.ui.410
-rw-r--r--tests/benchmarks/benchmarks.pro23
-rw-r--r--tests/benchmarks/containers-sequential/main.cpp17
-rw-r--r--tests/benchmarks/events/main.cpp15
-rw-r--r--tests/benchmarks/qbytearray/main.cpp5
-rw-r--r--tests/benchmarks/qdiriterator/main.cpp10
-rwxr-xr-xtests/benchmarks/qdiriterator/qdiriterator.pro2
-rw-r--r--tests/benchmarks/qfile/main.cpp58
-rw-r--r--tests/benchmarks/qgraphicsview/qgraphicsview.pro8
-rw-r--r--tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp238
-rw-r--r--tests/benchmarks/qhostinfo/main.cpp96
-rwxr-xr-xtests/benchmarks/qhostinfo/qhostinfo.pro13
-rw-r--r--tests/benchmarks/qstringlist/qstringlist.pro2
-rw-r--r--tests/benchmarks/qstylesheetstyle/main.cpp19
-rw-r--r--tests/benchmarks/qtcpserver/qtcpserver.pro13
-rw-r--r--tests/benchmarks/qtcpserver/tst_qtcpserver.cpp277
-rw-r--r--tests/benchmarks/qthreadstorage/qthreadstorage.pro6
-rw-r--r--tests/benchmarks/qthreadstorage/tst_qthreadstorage.cpp124
-rw-r--r--tests/manual/qgraphicsitemgroup/customitem.cpp107
-rw-r--r--tests/manual/qgraphicsitemgroup/customitem.h77
-rw-r--r--tests/manual/qgraphicsitemgroup/main.cpp51
-rw-r--r--tests/manual/qgraphicsitemgroup/qgraphicsitemgroup.pro8
-rw-r--r--tests/manual/qgraphicsitemgroup/widget.cpp260
-rw-r--r--tests/manual/qgraphicsitemgroup/widget.h93
-rw-r--r--tests/manual/qgraphicsitemgroup/widget.ui319
-rw-r--r--tools/assistant/lib/qhelpindexwidget.cpp4
-rw-r--r--tools/assistant/lib/qhelpsearchengine.h2
-rw-r--r--tools/assistant/tools/assistant/bookmarkmanager.cpp116
-rw-r--r--tools/designer/src/components/formeditor/itemview_propertysheet.cpp183
-rw-r--r--tools/designer/src/components/formeditor/itemview_propertysheet.h10
-rw-r--r--tools/designer/src/components/formeditor/widgetselection.cpp4
-rw-r--r--tools/designer/src/components/objectinspector/objectinspector.pri8
-rw-r--r--tools/designer/src/components/propertyeditor/propertyeditor.pri11
-rw-r--r--tools/designer/src/lib/shared/actionrepository.cpp2
-rw-r--r--tools/linguist/linguist/messageeditor.h2
-rw-r--r--tools/linguist/lrelease/main.cpp7
-rw-r--r--tools/qdoc3/cppcodeparser.cpp6
-rw-r--r--tools/qdoc3/generator.cpp45
-rw-r--r--tools/qdoc3/generator.h2
-rw-r--r--tools/qdoc3/htmlgenerator.cpp4
-rw-r--r--tools/runonphone/main.cpp219
-rw-r--r--tools/runonphone/runonphone.pro19
-rw-r--r--tools/runonphone/serenum.h56
-rw-r--r--tools/runonphone/serenum_win.cpp114
-rw-r--r--tools/runonphone/trk/bluetoothlistener.cpp224
-rw-r--r--tools/runonphone/trk/bluetoothlistener.h101
-rw-r--r--tools/runonphone/trk/bluetoothlistener_gui.cpp111
-rw-r--r--tools/runonphone/trk/bluetoothlistener_gui.h87
-rw-r--r--tools/runonphone/trk/callback.h160
-rw-r--r--tools/runonphone/trk/communicationstarter.cpp260
-rw-r--r--tools/runonphone/trk/communicationstarter.h160
-rw-r--r--tools/runonphone/trk/launcher.cpp715
-rw-r--r--tools/runonphone/trk/launcher.h170
-rw-r--r--tools/runonphone/trk/trk.pri23
-rw-r--r--tools/runonphone/trk/trkdevice.cpp1073
-rw-r--r--tools/runonphone/trk/trkdevice.h133
-rw-r--r--tools/runonphone/trk/trkutils.cpp486
-rw-r--r--tools/runonphone/trk/trkutils.h189
-rw-r--r--tools/runonphone/trksignalhandler.cpp189
-rw-r--r--tools/runonphone/trksignalhandler.h80
-rw-r--r--tools/shared/qtpropertybrowser/qteditorfactory.cpp3
-rw-r--r--tools/shared/qtpropertybrowser/qtpropertybrowserutils.cpp21
-rw-r--r--tools/shared/qtpropertybrowser/qtpropertybrowserutils_p.h3
-rw-r--r--tools/shared/qtpropertybrowser/qtpropertymanager.cpp45
-rw-r--r--tools/xmlpatterns/main.cpp2
-rw-r--r--tools/xmlpatterns/main.h10
-rw-r--r--tools/xmlpatterns/xmlpatterns.pro8
-rw-r--r--translations/assistant_pl.ts56
-rw-r--r--translations/designer_pl.ts108
-rw-r--r--translations/linguist_pl.ts50
-rw-r--r--translations/qt_help_pl.ts45
-rw-r--r--translations/qt_pl.ts1094
-rw-r--r--translations/qvfb_pl.ts11
-rw-r--r--util/s60pixelmetrics/pm_mapper.hrh9
-rw-r--r--util/s60pixelmetrics/pm_mapper.rss4
-rw-r--r--util/s60pixelmetrics/pm_mapperapp.cpp138
-rw-r--r--util/s60pixelmetrics/pm_mapperapp.h14
-rw-r--r--util/s60pixelmetrics/pm_mapperview.cpp12
-rw-r--r--util/s60pixelmetrics/pm_mapperview.h2
433 files changed, 18914 insertions, 5802 deletions
diff --git a/.gitignore b/.gitignore
index 33c9b7c..2069ad5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -93,7 +93,6 @@ tests/auto/qprocess/fileWriterProcess.txt
.com.apple.timemachine.supported
tests/auto/qlibrary/libmylib.so*
tests/auto/qresourceengine/runtime_resource.rcc
-tools/qdoc3/qdoc3*
tools/qtestlib/updater/updater*
tools/activeqt/testcon/testcon.tlb
translations/*.qm
diff --git a/config.tests/unix/neon/neon.cpp b/config.tests/unix/neon/neon.cpp
new file mode 100644
index 0000000..c31a9fd
--- /dev/null
+++ b/config.tests/unix/neon/neon.cpp
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the config.tests 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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <arm_neon.h>
+
+int main(int, char**)
+{
+ int32x4_t null = vdupq_n_s32(0x0);
+
+ int result;
+ vst1q_lane_s32(&result, null, 0);
+ return result;
+}
diff --git a/config.tests/unix/neon/neon.pro b/config.tests/unix/neon/neon.pro
new file mode 100644
index 0000000..de20c4e
--- /dev/null
+++ b/config.tests/unix/neon/neon.pro
@@ -0,0 +1,2 @@
+SOURCES = neon.cpp
+CONFIG -= x11 qt
diff --git a/configure b/configure
index 436be8a..cf9f06a 100755
--- a/configure
+++ b/configure
@@ -106,6 +106,28 @@ QMakeVar()
echo "$2" "$eq" "$3" >> "$QMAKE_VARS_FILE"
}
+# Helper function for getQMakeConf. It parses include statements in
+# qmake.conf and prints out the expanded file
+getQMakeConf1()
+{
+ while read line; do case "$line" in
+ include*)
+ inc_file=`echo "$line" | sed -n -e "/^include.*(.*)/s/include.*(\(.*\)).*$/\1/p"`
+ current_dir=`dirname "$1"`
+ conf_file="$current_dir/$inc_file"
+ if [ ! -e "$conf_file" ]; then
+ echo "WARNING: Unable to find file $conf_file" >&2
+ continue
+ fi
+ getQMakeConf1 "$conf_file"
+ ;;
+ *)
+ echo "$line"
+ ;;
+ esac; done < "$1"
+}
+
+
# relies on $QMAKESPEC being set correctly. parses include statements in
# qmake.conf and prints out the expanded file
getQMakeConf()
@@ -114,15 +136,7 @@ getQMakeConf()
if [ -n "$1" ]; then
tmpSPEC="$1"
fi
- $AWK -v "QMAKESPEC=$tmpSPEC" '
-/^include\(.+\)$/{
- fname = QMAKESPEC "/" substr($0, 9, length($0) - 9)
- while ((getline line < fname) > 0)
- print line
- close(fname)
- next
-}
-{ print }' "$tmpSPEC/qmake.conf"
+ getQMakeConf1 "$tmpSPEC/qmake.conf"
}
# relies on $TEST_COMPILER being set correctly
@@ -713,6 +727,7 @@ CFG_PTMALLOC=no
CFG_STL=auto
CFG_PRECOMPILE=auto
CFG_SEPARATE_DEBUG_INFO=auto
+CFG_SEPARATE_DEBUG_INFO_NOCOPY=no
CFG_REDUCE_EXPORTS=auto
CFG_MMX=auto
CFG_3DNOW=auto
@@ -730,6 +745,7 @@ CFG_HOST_ENDIAN=auto
CFG_DOUBLEFORMAT=auto
CFG_ARMFPA=auto
CFG_IWMMXT=no
+CFG_NEON=auto
CFG_CLOCK_GETTIME=auto
CFG_CLOCK_MONOTONIC=auto
CFG_MREMAP=auto
@@ -1544,6 +1560,9 @@ while [ "$#" -gt 0 ]; do
separate-debug-info)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_SEPARATE_DEBUG_INFO="$VAL"
+ elif [ "$VAL" = "nocopy" ] ; then
+ CFG_SEPARATE_DEBUG_INFO="yes"
+ CFG_SEPARATE_DEBUG_INFO_NOCOPY="yes"
else
UNKNOWN_OPT=yes
fi
@@ -1586,6 +1605,13 @@ while [ "$#" -gt 0 ]; do
iwmmxt)
CFG_IWMMXT="yes"
;;
+ neon)
+ if [ "$VAL" = "no" ]; then
+ CFG_NEON="$VAL"
+ else
+ UNKNOWN_OPT=yes
+ fi
+ ;;
reduce-relocations)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_REDUCE_RELOCATIONS="$VAL"
@@ -2902,7 +2928,7 @@ fi
# pass on $CFG_SDK to the configure tests.
if [ '!' -z "$CFG_SDK" ]; then
- MAC_CONFIG_TEST_COMMANDLINE="-sdk $CFG_SDK"
+ MAC_CONFIG_TEST_COMMANDLINE="$MAC_CONFIG_TEST_COMMANDLINE -sdk $CFG_SDK"
fi
# find the default framework value
@@ -2922,6 +2948,10 @@ fi
QMAKE_CONF_COMPILER=`getQMakeConf "$XQMAKESPEC" | grep "^QMAKE_CXX[^_A-Z0-9]" | sed "s,.* *= *\(.*\)$,\1," | tail -1`
TEST_COMPILER="$CC"
[ -z "$TEST_COMPILER" ] && TEST_COMPILER=$QMAKE_CONF_COMPILER
+if [ -z "$TEST_COMPILER" ]; then
+ echo "ERROR: Cannot set the compiler for the configuration tests"
+ exit 1
+fi
# auto-detect precompiled header support
if [ "$CFG_PRECOMPILE" = "auto" ]; then
@@ -3867,6 +3897,7 @@ Qt for Embedded Linux only:
-iwmmxt ............ Compile using the iWMMXt instruction set
(available on some XScale CPUs).
+ -no-neon ........... Do not compile with use of NEON instructions.
EOF
fi
@@ -4487,6 +4518,15 @@ if [ "$CFG_IWMMXT" = "yes" ]; then
fi
fi
+# detect neon support
+if ([ "$CFG_ARCH" = "arm" ] || [ "$CFG_ARCH" = "armv6" ]) && [ "${CFG_NEON}" = "auto" ]; then
+ if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/neon "neon" $L_FLAGS $I_FLAGS $l_FLAGS "-mfpu=neon"; then
+ CFG_NEON=yes
+ else
+ CFG_NEON=no
+ fi
+fi
+
# detect zlib
if [ "$CFG_ZLIB" = "no" ]; then
# Note: Qt no longer support builds without zlib
@@ -5067,7 +5107,7 @@ if [ "$PLATFORM_X11" = "yes" ]; then
if [ $? != "0" ]; then
echo "The OpenGL ES 1.x Common Lite Profile functionality test failed!"
echo " You might need to modify the include and library search paths by editing"
- echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
+ echo " QMAKE_INCDIR_OPENGL_ES1CL, QMAKE_LIBDIR_OPENGL_ES1CL and QMAKE_LIBS_OPENGL_ES1CL in"
echo " ${XQMAKESPEC}."
exit 1
fi
@@ -5077,7 +5117,7 @@ if [ "$PLATFORM_X11" = "yes" ]; then
if [ $? != "0" ]; then
echo "The OpenGL ES 1.x functionality test failed!"
echo " You might need to modify the include and library search paths by editing"
- echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
+ echo " QMAKE_INCDIR_OPENGL_ES1, QMAKE_LIBDIR_OPENGL_ES1 and QMAKE_LIBS_OPENGL_ES1 in"
echo " ${XQMAKESPEC}."
exit 1
fi
@@ -5087,7 +5127,7 @@ if [ "$PLATFORM_X11" = "yes" ]; then
if [ $? != "0" ]; then
echo "The OpenGL ES 2.0 functionality test failed!"
echo " You might need to modify the include and library search paths by editing"
- echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
+ echo " QMAKE_INCDIR_OPENGL_ES2, QMAKE_LIBDIR_OPENGL_ES2 and QMAKE_LIBS_OPENGL_ES2 in"
echo " ${XQMAKESPEC}."
exit 1
fi
@@ -6094,11 +6134,15 @@ if [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then
QMakeVar add QMAKE_CXXFLAGS -g
QMAKE_CONFIG="$QMAKE_CONFIG separate_debug_info"
fi
+if [ "$CFG_SEPARATE_DEBUG_INFO_NOCOPY" = "yes" ] ; then
+ QMAKE_CONFIG="$QMAKE_CONFIG separate_debug_info_nocopy"
+fi
[ "$CFG_MMX" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG mmx"
[ "$CFG_3DNOW" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG 3dnow"
[ "$CFG_SSE" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse"
[ "$CFG_SSE2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse2"
[ "$CFG_IWMMXT" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG iwmmxt"
+[ "$CFG_NEON" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG neon"
[ "$PLATFORM_MAC" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG $CFG_MAC_ARCHS"
if [ "$CFG_IPV6" = "yes" ]; then
QT_CONFIG="$QT_CONFIG ipv6"
@@ -7391,8 +7435,9 @@ echo "Declarative module .. $CFG_DECLARATIVE"
echo "STL support ......... $CFG_STL"
echo "PCH support ......... $CFG_PRECOMPILE"
echo "MMX/3DNOW/SSE/SSE2.. ${CFG_MMX}/${CFG_3DNOW}/${CFG_SSE}/${CFG_SSE2}"
-if [ "${CFG_ARCH}" = "arm" ]; then
+if [ "$CFG_ARCH" = "arm" ] || [ "$CFG_ARCH" = "armv6" ]; then
echo "iWMMXt support ...... ${CFG_IWMMXT}"
+ echo "NEON support ........ ${CFG_NEON}"
fi
[ "${PLATFORM_QWS}" != "yes" ] && echo "Graphics System ..... $CFG_GRAPHICS_SYSTEM"
echo "IPv6 support ........ $CFG_IPV6"
diff --git a/demos/demos.pro b/demos/demos.pro
index a943bfd..5a9b6db 100644
--- a/demos/demos.pro
+++ b/demos/demos.pro
@@ -20,7 +20,24 @@ symbian: SUBDIRS = \
demos_shared \
demos_deform \
demos_pathstroke
-
+
+wince*: SUBDIRS = \
+ demos_shared \
+ demos_deform \
+ demos_gradients \
+ demos_pathstroke \
+ demos_affine \
+ demos_composition \
+ demos_books \
+ demos_interview \
+ demos_mainwindow \
+ demos_spreadsheet \
+ demos_textedit \
+ # demos_chip \
+ demos_embeddeddialogs \
+ demos_undo \
+ demos_sub-attaq
+
contains(QT_CONFIG, opengl):!contains(QT_CONFIG, opengles1):!contains(QT_CONFIG, opengles1cl):!contains(QT_CONFIG, opengles2):{
SUBDIRS += demos_boxes
}
@@ -33,7 +50,7 @@ wince*|symbian|embedded|x11: SUBDIRS += embedded
!cross_compile:{
contains(QT_BUILD_PARTS, tools):{
!wince*:SUBDIRS += demos_sqlbrowser demos_qtdemo
-wince*: SUBDIRS += demos_sqlbrowser
+wince*:SUBDIRS += demos_sqlbrowser
}
}
contains(QT_CONFIG, phonon):!static:SUBDIRS += demos_mediaplayer
diff --git a/demos/embedded/anomaly/src/BrowserWindow.cpp b/demos/embedded/anomaly/src/BrowserWindow.cpp
index 1036735..30b6b91 100644
--- a/demos/embedded/anomaly/src/BrowserWindow.cpp
+++ b/demos/embedded/anomaly/src/BrowserWindow.cpp
@@ -43,92 +43,44 @@
#include <QtCore>
#include <QtGui>
+#include <QPropertyAnimation>
+#include <QResizeEvent>
#include "BrowserView.h"
#include "HomeView.h"
BrowserWindow::BrowserWindow()
- : QWidget()
- , m_homeView(0)
- , m_browserView(0)
+ : m_slidingSurface(new QWidget(this))
+ , m_homeView(new HomeView(m_slidingSurface))
+ , m_browserView(new BrowserView(m_slidingSurface))
+ , m_animation(new QPropertyAnimation(this, "slideValue"))
{
- m_timeLine = new QTimeLine(300, this);
- m_timeLine->setCurveShape(QTimeLine::EaseInOutCurve);
- QTimer::singleShot(0, this, SLOT(initialize()));
-}
-
-void BrowserWindow::initialize()
-{
- m_homeView = new HomeView(this);
- m_browserView = new BrowserView(this);
+ m_slidingSurface->setAutoFillBackground(true);
- m_homeView->hide();
m_homeView->resize(size());
- m_homeView->move(0, 0);
- m_browserView->hide();
m_browserView->resize(size());
- m_browserView->move(0, 0);
connect(m_homeView, SIGNAL(addressEntered(QString)), SLOT(gotoAddress(QString)));
connect(m_homeView, SIGNAL(urlActivated(QUrl)), SLOT(navigate(QUrl)));
connect(m_browserView, SIGNAL(menuButtonClicked()), SLOT(showHomeView()));
- m_homeView->setVisible(false);
- m_browserView->setVisible(false);
- slide(0);
+ m_animation->setDuration(200);
+ connect(m_animation, SIGNAL(finished()), SLOT(animationFinished()));
- connect(m_timeLine, SIGNAL(frameChanged(int)), SLOT(slide(int)));
+ setSlideValue(0.0f);
}
-
-// from Demo Browser
-QUrl guessUrlFromString(const QString &string)
+void BrowserWindow::gotoAddress(const QString &address)
{
- QString urlStr = string.trimmed();
- QRegExp test(QLatin1String("^[a-zA-Z]+\\:.*"));
-
- // Check if it looks like a qualified URL. Try parsing it and see.
- bool hasSchema = test.exactMatch(urlStr);
- if (hasSchema) {
- QUrl url = QUrl::fromEncoded(urlStr.toUtf8(), QUrl::TolerantMode);
- if (url.isValid())
- return url;
- }
-
- // Might be a file.
- if (QFile::exists(urlStr)) {
- QFileInfo info(urlStr);
- return QUrl::fromLocalFile(info.absoluteFilePath());
- }
-
- // Might be a shorturl - try to detect the schema.
- if (!hasSchema) {
- int dotIndex = urlStr.indexOf(QLatin1Char('.'));
- if (dotIndex != -1) {
- QString prefix = urlStr.left(dotIndex).toLower();
- QString schema = (prefix == QString("ftp")) ? prefix.toLatin1() : QString("http");
- QString location = schema + "://" + urlStr;
- QUrl url = QUrl::fromEncoded(location.toUtf8(), QUrl::TolerantMode);
- if (url.isValid())
- return url;
- }
- }
-
- // Fall back to QUrl's own tolerant parser.
- QUrl url = QUrl::fromEncoded(string.toUtf8(), QUrl::TolerantMode);
-
- // finally for cases where the user just types in a hostname add http
- if (url.scheme().isEmpty())
- url = QUrl::fromEncoded("http://" + string.toUtf8(), QUrl::TolerantMode);
- return url;
+ m_browserView->navigate(QUrl::fromUserInput(address));
+ showBrowserView();
}
-void BrowserWindow::gotoAddress(const QString &address)
+void BrowserWindow::animationFinished()
{
- m_browserView->navigate(guessUrlFromString(address));
- showBrowserView();
+ m_animation->setDirection(QAbstractAnimation::Forward);
}
void BrowserWindow::navigate(const QUrl &url)
@@ -137,31 +89,44 @@ void BrowserWindow::navigate(const QUrl &url)
showBrowserView();
}
-void BrowserWindow::slide(int pos)
+void BrowserWindow::setSlideValue(qreal slideRatio)
{
- m_browserView->move(pos, 0);
- m_homeView->move(pos - width(), 0);
- m_browserView->show();
- m_homeView->show();
+ // we use a ratio to handle resize corectly
+ const int pos = -qRound(slideRatio * width());
+ m_slidingSurface->scroll(pos - m_homeView->x(), 0);
+
+ if (qFuzzyCompare(slideRatio, static_cast<qreal>(1.0f))) {
+ m_browserView->show();
+ m_homeView->hide();
+ } else if (qFuzzyCompare(slideRatio, static_cast<qreal>(0.0f))) {
+ m_homeView->show();
+ m_browserView->hide();
+ } else {
+ m_browserView->show();
+ m_homeView->show();
+ }
}
-void BrowserWindow::showHomeView()
+qreal BrowserWindow::slideValue() const
{
- if (m_timeLine->state() != QTimeLine::NotRunning)
- return;
+ Q_ASSERT(m_slidingSurface->x() < width());
+ return static_cast<qreal>(qAbs(m_homeView->x())) / width();
+}
- m_timeLine->setFrameRange(0, width());
- m_timeLine->start();
+void BrowserWindow::showHomeView()
+{
+ m_animation->setStartValue(slideValue());
+ m_animation->setEndValue(0.0f);
+ m_animation->start();
m_homeView->setFocus();
}
void BrowserWindow::showBrowserView()
{
- if (m_timeLine->state() != QTimeLine::NotRunning)
- return;
+ m_animation->setStartValue(slideValue());
+ m_animation->setEndValue(1.0f);
+ m_animation->start();
- m_timeLine->setFrameRange(width(), 0);
- m_timeLine->start();
m_browserView->setFocus();
}
@@ -170,18 +135,32 @@ void BrowserWindow::keyReleaseEvent(QKeyEvent *event)
QWidget::keyReleaseEvent(event);
if (event->key() == Qt::Key_F3) {
- if (m_homeView->isVisible())
- showBrowserView();
- else
+ if (m_animation->state() == QAbstractAnimation::Running) {
+ const QAbstractAnimation::Direction direction = m_animation->direction() == QAbstractAnimation::Forward
+ ? QAbstractAnimation::Forward
+ : QAbstractAnimation::Backward;
+ m_animation->setDirection(direction);
+ } else if (qFuzzyCompare(slideValue(), static_cast<qreal>(1.0f)))
showHomeView();
+ else
+ showBrowserView();
+ event->accept();
}
}
void BrowserWindow::resizeEvent(QResizeEvent *event)
{
- if (m_homeView)
- m_homeView->resize(size());
+ const QSize oldSize = event->oldSize();
+ const qreal oldSlidingRatio = static_cast<qreal>(qAbs(m_homeView->x())) / oldSize.width();
+
+ const QSize newSize = event->size();
+ m_slidingSurface->resize(newSize.width() * 2, newSize.height());
+
+ m_homeView->resize(newSize);
+ m_homeView->move(0, 0);
+
+ m_browserView->resize(newSize);
+ m_browserView->move(newSize.width(), 0);
- if (m_browserView)
- m_browserView->resize(size());
+ setSlideValue(oldSlidingRatio);
}
diff --git a/demos/embedded/anomaly/src/BrowserWindow.h b/demos/embedded/anomaly/src/BrowserWindow.h
index 9647efb..2b77939 100644
--- a/demos/embedded/anomaly/src/BrowserWindow.h
+++ b/demos/embedded/anomaly/src/BrowserWindow.h
@@ -43,7 +43,7 @@
#define BROWSERWINDOW_H
#include <QWidget>
-class QTimeLine;
+class QPropertyAnimation;
class QUrl;
class BrowserView;
@@ -52,28 +52,32 @@ class HomeView;
class BrowserWindow : public QWidget
{
Q_OBJECT
+ Q_PROPERTY(qreal slideValue READ slideValue WRITE setSlideValue)
public:
BrowserWindow();
private slots:
- void initialize();
void navigate(const QUrl &url);
void gotoAddress(const QString &address);
+ void animationFinished();
public slots:
void showBrowserView();
void showHomeView();
- void slide(int);
protected:
void keyReleaseEvent(QKeyEvent *event);
void resizeEvent(QResizeEvent *event);
private:
+ void setSlideValue(qreal);
+ qreal slideValue() const;
+
+ QWidget *m_slidingSurface;
HomeView *m_homeView;
BrowserView *m_browserView;
- QTimeLine *m_timeLine;
+ QPropertyAnimation *m_animation;
};
#endif // BROWSERWINDOW_H
diff --git a/demos/embedded/anomaly/src/flickcharm.cpp b/demos/embedded/anomaly/src/flickcharm.cpp
index 0b9e68e..b7e2151 100644
--- a/demos/embedded/anomaly/src/flickcharm.cpp
+++ b/demos/embedded/anomaly/src/flickcharm.cpp
@@ -49,20 +49,112 @@
#include <QList>
#include <QMouseEvent>
#include <QScrollBar>
+#include <QTime>
#include <QWebFrame>
#include <QWebView>
#include <QDebug>
+const int fingerAccuracyThreshold = 3;
+
struct FlickData {
- typedef enum { Steady, Pressed, ManualScroll, AutoScroll, Stop } State;
+ typedef enum {
+ Steady, // Interaction without scrolling
+ ManualScroll, // Scrolling manually with the finger on the screen
+ AutoScroll, // Scrolling automatically
+ AutoScrollAcceleration // Scrolling automatically but a finger is on the screen
+ } State;
State state;
QWidget *widget;
QPoint pressPos;
- QPoint offset;
- QPoint dragPos;
+ QPoint lastPos;
QPoint speed;
+ QTime speedTimer;
QList<QEvent*> ignored;
+ QTime accelerationTimer;
+ bool lastPosValid:1;
+ bool waitingAcceleration:1;
+
+ FlickData()
+ : lastPosValid(false)
+ , waitingAcceleration(false)
+ {}
+
+ void resetSpeed()
+ {
+ speed = QPoint();
+ lastPosValid = false;
+ }
+ void updateSpeed(const QPoint &newPosition)
+ {
+ if (lastPosValid) {
+ const int timeElapsed = speedTimer.elapsed();
+ if (timeElapsed) {
+ const QPoint newPixelDiff = (newPosition - lastPos);
+ const QPoint pixelsPerSecond = newPixelDiff * (1000 / timeElapsed);
+ // fingers are inacurates, we ignore small changes to avoid stopping the autoscroll because
+ // of a small horizontal offset when scrolling vertically
+ const int newSpeedY = (qAbs(pixelsPerSecond.y()) > fingerAccuracyThreshold) ? pixelsPerSecond.y() : 0;
+ const int newSpeedX = (qAbs(pixelsPerSecond.x()) > fingerAccuracyThreshold) ? pixelsPerSecond.x() : 0;
+ if (state == AutoScrollAcceleration) {
+ const int max = 4000; // px by seconds
+ const int oldSpeedY = speed.y();
+ const int oldSpeedX = speed.x();
+ if ((oldSpeedY <= 0 && newSpeedY <= 0) || (oldSpeedY >= 0 && newSpeedY >= 0)
+ && (oldSpeedX <= 0 && newSpeedX <= 0) || (oldSpeedX >= 0 && newSpeedX >= 0)) {
+ speed.setY(qBound(-max, (oldSpeedY + (newSpeedY / 4)), max));
+ speed.setX(qBound(-max, (oldSpeedX + (newSpeedX / 4)), max));
+ } else {
+ speed = QPoint();
+ }
+ } else {
+ const int max = 2500; // px by seconds
+ // we average the speed to avoid strange effects with the last delta
+ if (!speed.isNull()) {
+ speed.setX(qBound(-max, (speed.x() / 4) + (newSpeedX * 3 / 4), max));
+ speed.setY(qBound(-max, (speed.y() / 4) + (newSpeedY * 3 / 4), max));
+ } else {
+ speed = QPoint(newSpeedX, newSpeedY);
+ }
+ }
+ }
+ } else {
+ lastPosValid = true;
+ }
+ speedTimer.start();
+ lastPos = newPosition;
+ }
+
+ // scroll by dx, dy
+ // return true if the widget was scrolled
+ bool scrollWidget(const int dx, const int dy)
+ {
+ QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea*>(widget);
+ if (scrollArea) {
+ const int x = scrollArea->horizontalScrollBar()->value();
+ const int y = scrollArea->verticalScrollBar()->value();
+ scrollArea->horizontalScrollBar()->setValue(x - dx);
+ scrollArea->verticalScrollBar()->setValue(y - dy);
+ return (scrollArea->horizontalScrollBar()->value() != x
+ || scrollArea->verticalScrollBar()->value() != y);
+ }
+
+ QWebView *webView = qobject_cast<QWebView*>(widget);
+ if (webView) {
+ QWebFrame *frame = webView->page()->mainFrame();
+ const QPoint position = frame->scrollPosition();
+ frame->setScrollPosition(position - QPoint(dx, dy));
+ return frame->scrollPosition() != position;
+ }
+ return false;
+ }
+
+ bool scrollTo(const QPoint &newPosition)
+ {
+ const QPoint delta = newPosition - lastPos;
+ updateSpeed(newPosition);
+ return scrollWidget(delta.x(), delta.y());
+ }
};
class FlickCharmPrivate
@@ -70,6 +162,13 @@ class FlickCharmPrivate
public:
QHash<QWidget*, FlickData*> flickData;
QBasicTimer ticker;
+ QTime timeCounter;
+ void startTicker(QObject *object)
+ {
+ if (!ticker.isActive())
+ ticker.start(15, object);
+ timeCounter.start();
+ }
};
FlickCharm::FlickCharm(QObject *parent): QObject(parent)
@@ -148,46 +247,14 @@ void FlickCharm::deactivateFrom(QWidget *widget)
}
}
-static QPoint scrollOffset(QWidget *widget)
+static QPoint deaccelerate(const QPoint &speed, const int deltatime)
{
- int x = 0, y = 0;
-
- QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea*>(widget);
- if (scrollArea) {
- x = scrollArea->horizontalScrollBar()->value();
- y = scrollArea->verticalScrollBar()->value();
- }
-
- QWebView *webView = qobject_cast<QWebView*>(widget);
- if (webView) {
- QWebFrame *frame = webView->page()->mainFrame();
- x = frame->evaluateJavaScript("window.scrollX").toInt();
- y = frame->evaluateJavaScript("window.scrollY").toInt();
- }
-
- return QPoint(x, y);
-}
-
-static void setScrollOffset(QWidget *widget, const QPoint &p)
-{
- QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea*>(widget);
- if (scrollArea) {
- scrollArea->horizontalScrollBar()->setValue(p.x());
- scrollArea->verticalScrollBar()->setValue(p.y());
- }
+ const int deltaSpeed = deltatime;
- QWebView *webView = qobject_cast<QWebView*>(widget);
- QWebFrame *frame = webView ? webView->page()->mainFrame() : 0;
- if (frame)
- frame->evaluateJavaScript(QString("window.scrollTo(%1,%2);").arg(p.x()).arg(p.y()));
-}
-
-static QPoint deaccelerate(const QPoint &speed, int a = 1, int max = 64)
-{
- int x = qBound(-max, speed.x(), max);
- int y = qBound(-max, speed.y(), max);
- x = (x == 0) ? x : (x > 0) ? qMax(0, x - a) : qMin(0, x + a);
- y = (y == 0) ? y : (y > 0) ? qMax(0, y - a) : qMin(0, y + a);
+ int x = speed.x();
+ int y = speed.y();
+ x = (x == 0) ? x : (x > 0) ? qMax(0, x - deltaSpeed) : qMin(0, x + deltaSpeed);
+ y = (y == 0) ? y : (y > 0) ? qMax(0, y - deltaSpeed) : qMin(0, y + deltaSpeed);
return QPoint(x, y);
}
@@ -196,22 +263,24 @@ bool FlickCharm::eventFilter(QObject *object, QEvent *event)
if (!object->isWidgetType())
return false;
- QEvent::Type type = event->type();
- if (type != QEvent::MouseButtonPress &&
- type != QEvent::MouseButtonRelease &&
- type != QEvent::MouseMove)
- return false;
+ const QEvent::Type type = event->type();
- QMouseEvent *mouseEvent = 0;
- switch (event->type()) {
- case QEvent::MouseButtonPress:
- case QEvent::MouseButtonRelease:
- case QEvent::MouseMove:
- mouseEvent = static_cast<QMouseEvent*>(event);
- break;
+ switch (type) {
+ case QEvent::MouseButtonPress:
+ case QEvent::MouseMove:
+ case QEvent::MouseButtonRelease:
+ break;
+ case QEvent::MouseButtonDblClick: // skip double click
+ return true;
+ default:
+ return false;
}
- if (!mouseEvent || mouseEvent->modifiers() != Qt::NoModifier)
+ QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
+ if (type == QEvent::MouseMove && mouseEvent->buttons() != Qt::LeftButton)
+ return false;
+
+ if (mouseEvent->modifiers() != Qt::NoModifier)
return false;
QWidget *viewport = qobject_cast<QWidget*>(object);
@@ -219,89 +288,83 @@ bool FlickCharm::eventFilter(QObject *object, QEvent *event)
if (!viewport || !data || data->ignored.removeAll(event))
return false;
+ const QPoint mousePos = mouseEvent->pos();
bool consumed = false;
switch (data->state) {
case FlickData::Steady:
- if (mouseEvent->type() == QEvent::MouseButtonPress)
- if (mouseEvent->buttons() == Qt::LeftButton) {
- consumed = true;
- data->state = FlickData::Pressed;
- data->pressPos = mouseEvent->pos();
- data->offset = scrollOffset(data->widget);
- }
- break;
-
- case FlickData::Pressed:
- if (mouseEvent->type() == QEvent::MouseButtonRelease) {
+ if (type == QEvent::MouseButtonPress) {
+ consumed = true;
+ data->pressPos = mousePos;
+ } else if (type == QEvent::MouseButtonRelease) {
consumed = true;
- data->state = FlickData::Steady;
-
QMouseEvent *event1 = new QMouseEvent(QEvent::MouseButtonPress,
data->pressPos, Qt::LeftButton,
Qt::LeftButton, Qt::NoModifier);
- QMouseEvent *event2 = new QMouseEvent(*mouseEvent);
+ QMouseEvent *event2 = new QMouseEvent(QEvent::MouseButtonRelease,
+ data->pressPos, Qt::LeftButton,
+ Qt::LeftButton, Qt::NoModifier);
data->ignored << event1;
data->ignored << event2;
QApplication::postEvent(object, event1);
QApplication::postEvent(object, event2);
- }
- if (mouseEvent->type() == QEvent::MouseMove) {
+ } else if (type == QEvent::MouseMove) {
consumed = true;
- data->state = FlickData::ManualScroll;
- data->dragPos = QCursor::pos();
- if (!d->ticker.isActive())
- d->ticker.start(20, this);
+ data->scrollTo(mousePos);
+
+ const QPoint delta = mousePos - data->pressPos;
+ if (delta.x() > fingerAccuracyThreshold || delta.y() > fingerAccuracyThreshold)
+ data->state = FlickData::ManualScroll;
}
break;
case FlickData::ManualScroll:
- if (mouseEvent->type() == QEvent::MouseMove) {
+ if (type == QEvent::MouseMove) {
consumed = true;
- QPoint delta = mouseEvent->pos() - data->pressPos;
- setScrollOffset(data->widget, data->offset - delta);
- }
- if (mouseEvent->type() == QEvent::MouseButtonRelease) {
+ data->scrollTo(mousePos);
+ } else if (type == QEvent::MouseButtonRelease) {
consumed = true;
data->state = FlickData::AutoScroll;
+ data->lastPosValid = false;
+ d->startTicker(this);
}
break;
case FlickData::AutoScroll:
- if (mouseEvent->type() == QEvent::MouseButtonPress) {
+ if (type == QEvent::MouseButtonPress) {
consumed = true;
- data->state = FlickData::Stop;
- data->speed = QPoint(0, 0);
- data->pressPos = mouseEvent->pos();
- data->offset = scrollOffset(data->widget);
- }
- if (mouseEvent->type() == QEvent::MouseButtonRelease) {
+ data->state = FlickData::AutoScrollAcceleration;
+ data->waitingAcceleration = true;
+ data->accelerationTimer.start();
+ data->updateSpeed(mousePos);
+ data->pressPos = mousePos;
+ } else if (type == QEvent::MouseButtonRelease) {
consumed = true;
data->state = FlickData::Steady;
- data->speed = QPoint(0, 0);
+ data->resetSpeed();
}
break;
- case FlickData::Stop:
- if (mouseEvent->type() == QEvent::MouseButtonRelease) {
+ case FlickData::AutoScrollAcceleration:
+ if (type == QEvent::MouseMove) {
consumed = true;
- data->state = FlickData::Steady;
- }
- if (mouseEvent->type() == QEvent::MouseMove) {
+ data->updateSpeed(mousePos);
+ data->accelerationTimer.start();
+ if (data->speed.isNull())
+ data->state = FlickData::ManualScroll;
+ } else if (type == QEvent::MouseButtonRelease) {
consumed = true;
- data->state = FlickData::ManualScroll;
- data->dragPos = QCursor::pos();
- if (!d->ticker.isActive())
- d->ticker.start(20, this);
+ data->state = FlickData::AutoScroll;
+ data->waitingAcceleration = false;
+ data->lastPosValid = false;
}
break;
-
default:
break;
}
-
- return consumed;
+ data->lastPos = mousePos;
+ return true;
}
void FlickCharm::timerEvent(QTimerEvent *event)
@@ -311,25 +374,29 @@ void FlickCharm::timerEvent(QTimerEvent *event)
while (item.hasNext()) {
item.next();
FlickData *data = item.value();
-
- if (data->state == FlickData::ManualScroll) {
- count++;
- data->speed = QCursor::pos() - data->dragPos;
- data->dragPos = QCursor::pos();
+ if (data->state == FlickData::AutoScrollAcceleration
+ && data->waitingAcceleration
+ && data->accelerationTimer.elapsed() > 40) {
+ data->state = FlickData::ManualScroll;
+ data->resetSpeed();
}
+ if (data->state == FlickData::AutoScroll || data->state == FlickData::AutoScrollAcceleration) {
+ const int timeElapsed = d->timeCounter.elapsed();
+ const QPoint delta = (data->speed) * timeElapsed / 1000;
+ bool hasScrolled = data->scrollWidget(delta.x(), delta.y());
- if (data->state == FlickData::AutoScroll) {
- count++;
- data->speed = deaccelerate(data->speed);
- QPoint p = scrollOffset(data->widget);
- setScrollOffset(data->widget, p - data->speed);
- if (data->speed == QPoint(0, 0))
+ if (data->speed.isNull() || !hasScrolled)
data->state = FlickData::Steady;
+ else
+ count++;
+ data->speed = deaccelerate(data->speed, timeElapsed);
}
}
if (!count)
d->ticker.stop();
+ else
+ d->timeCounter.start();
QObject::timerEvent(event);
}
diff --git a/demos/embedded/fluidlauncher/fluidlauncher.pro b/demos/embedded/fluidlauncher/fluidlauncher.pro
index b47f6a0..bb8835b 100644
--- a/demos/embedded/fluidlauncher/fluidlauncher.pro
+++ b/demos/embedded/fluidlauncher/fluidlauncher.pro
@@ -163,6 +163,11 @@ symbian {
resource.sources += $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/anomaly.rsc
mifs.sources += \
$${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/anomaly.mif
+
+ # Since Fluidlauncher itself doesn't link webkit, we won't get dependency automatically
+ executables.pkg_prerules += \
+ "; Dependency to Qt Webkit" \
+ "(0x200267C2), $${QT_MAJOR_VERSION}, $${QT_MINOR_VERSION}, $${QT_PATCH_VERSION}, {\"QtWebKit\"}"
}
contains(QT_CONFIG, phonon) {
diff --git a/demos/embedded/weatherinfo/weatherinfo.cpp b/demos/embedded/weatherinfo/weatherinfo.cpp
index 842f05b..3b78a5f 100644
--- a/demos/embedded/weatherinfo/weatherinfo.cpp
+++ b/demos/embedded/weatherinfo/weatherinfo.cpp
@@ -105,9 +105,8 @@ private slots:
void delayedInit() {
#if defined(Q_OS_SYMBIAN)
qt_SetDefaultIap();
-#else
- request("Oslo");
#endif
+ request("Oslo");
}
private slots:
diff --git a/dist/changes-4.6.1 b/dist/changes-4.6.1
index 5efa0e2..2397228 100644
--- a/dist/changes-4.6.1
+++ b/dist/changes-4.6.1
@@ -148,7 +148,14 @@ Qt for Windows CE
****************************************************************************
- Designer
- * foo
+ * [QTBUG-6863] Fixed static linking on Mac.
+ * [QTBUG-6760] Fixed display of action shortcut in action editor.
+ * [QTBUG-6505] Fixed handling of QHeaderView properties.
+ * [QTBUG-5335] Fixed handling of layout margins of custom containers.
+
+ - uic
+ * [QTBUG-5824] Fixed code generation to generate a call to
+ QMainWindow::setCentralWidget() for promoted widgets as well.
- qdoc3
* bar
diff --git a/doc/src/deployment/deployment.qdoc b/doc/src/deployment/deployment.qdoc
index 6a1760e..f2038b2 100644
--- a/doc/src/deployment/deployment.qdoc
+++ b/doc/src/deployment/deployment.qdoc
@@ -1567,12 +1567,12 @@
By default \c .pkg file generated by \c qmake adds support for all
S60 3rd edition FP1, S60 3rd edition FP2 and S60 5th edition devices.
- As a last step we will embed the Open C, Open C++ and Qt \c .sis files to the Wiggly
+ As a last step we will embed the \c qt_installer.sis file to the Wiggly
deployment file:
\snippet doc/src/snippets/code/doc_src_deployment.qdoc 58
- By embedding all dependencies to the application deployment file, the
+ When \c qt_installer.sis is embedded to the application deployment file, the
end-user does not need to download and install all dependencies separately.
The drawback of \c .sis embedding is that the application \c .sis file size becomes
big. To address these problems Forum Nokia is planning to release a smart installer
diff --git a/doc/src/development/assistant-manual.qdoc b/doc/src/development/assistant-manual.qdoc
index 8de500e..5a30e43 100644
--- a/doc/src/development/assistant-manual.qdoc
+++ b/doc/src/development/assistant-manual.qdoc
@@ -130,7 +130,7 @@
\o -collectionFile <file.qhc>
\o Uses the specified collection file instead of the default one.
\row
- \o -showUrl URL
+ \o -showUrl <URL>
\o Shows the document referenced by URL.
\row
\o -enableRemoteControl
@@ -156,7 +156,12 @@
\o Unregisters the specified compressed help file from the given
collection file.
\row
- \o -setCurrentFilter filter
+ \o -remove-search-index
+ \o Purges the help search engine's index. This option is
+ useful in case the associated index files get corrupted.
+ \QA will re-index the documentation at the next start-up.
+ \row
+ \o -setCurrentFilter <filter>
\o Sets the given filter as the active filter.
\row
\o -quiet
diff --git a/doc/src/development/designer-manual.qdoc b/doc/src/development/designer-manual.qdoc
index bfd8066..d7666f6 100644
--- a/doc/src/development/designer-manual.qdoc
+++ b/doc/src/development/designer-manual.qdoc
@@ -371,7 +371,7 @@
{setValue()} slot.
To do this, you have to switch to \gui{Edit Signals/Slots} mode, either by
- pressing \key{F4} or something \gui{Edit Signals/Slots} from the \gui{Edit}
+ pressing \key{F4} or selecting \gui{Edit Signals/Slots} from the \gui{Edit}
menu.
\table
diff --git a/doc/src/examples/fademessage.qdoc b/doc/src/examples/fademessage.qdoc
index ecea095..6063fa7 100644
--- a/doc/src/examples/fademessage.qdoc
+++ b/doc/src/examples/fademessage.qdoc
@@ -43,5 +43,13 @@
\example effects/fademessage
\title Fade Message Effect Example
- \image fademessageeffect-example.png
+ \raw HTML
+ <div style="text-align: center">
+ \endraw
+ \inlineimage fademessageeffect-example.png
+ \inlineimage fademessageeffect-example-faded.png
+ \raw HTML
+ </div>
+ \endraw
+
*/
diff --git a/doc/src/frameworks-technologies/animation.qdoc b/doc/src/frameworks-technologies/animation.qdoc
index cd6e304..77cc8dc 100644
--- a/doc/src/frameworks-technologies/animation.qdoc
+++ b/doc/src/frameworks-technologies/animation.qdoc
@@ -352,11 +352,11 @@
QStateMachine *machine = new QStateMachine;
- QState *state1 = new QState(machine->rootState());
+ QState *state1 = new QState(machine);
state1->assignProperty(button, "geometry", QRect(0, 0, 100, 30));
machine->setInitialState(state1);
- QState *state2 = new QState(machine->rootState());
+ QState *state2 = new QState(machine);
state2->assignProperty(button, "geometry", QRect(250, 250, 100, 30));
QSignalTransition *transition1 = state1->addTransition(button,
diff --git a/doc/src/frameworks-technologies/dnd.qdoc b/doc/src/frameworks-technologies/dnd.qdoc
index a7b1622..65fddfb 100644
--- a/doc/src/frameworks-technologies/dnd.qdoc
+++ b/doc/src/frameworks-technologies/dnd.qdoc
@@ -426,6 +426,7 @@
\legalese
Copyright 1996 Daniel Dardailler.
+ Copyright 1999 Matt Koss
Permission to use, copy, modify, distribute, and sell this software
for any purpose is hereby granted without fee, provided that the above
@@ -436,13 +437,11 @@
written prior permission. Daniel Dardailler makes no representations
about the suitability of this software for any purpose. It is
provided "as is" without express or implied warranty.
-
- Modifications Copyright 1999 Matt Koss, under the same license as
- above.
\endlegalese
- \omit NOTE: The copyright notice is from qmotifdnd_x11.cpp. \endomit
+ \omit NOTE: The original version of this copyright notice can be found
+ in qmotifdnd_x11.cpp. \endomit
- Note: The Motif Drag \& Drop Protocol only allows receivers to
+ \note The Motif Drag \& Drop Protocol only allows receivers to
request data in response to a QDropEvent. If you attempt to
request data in response to e.g. a QDragMoveEvent, an empty
QByteArray is returned.
diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc
index f0a6799..2d4f5c9 100644
--- a/doc/src/getting-started/examples.qdoc
+++ b/doc/src/getting-started/examples.qdoc
@@ -546,6 +546,14 @@
\o \l{graphicsview/portedcanvas}{Ported Canvas}
\endlist
+ Some examples demonstrate the use of graphics effects with canvas items.
+
+ \list
+ \o \l{effects/blurpicker}{Blur Picker Effect}
+ \o \l{effects/fademessage}{Fade Message Effect}
+ \o \l{effects/lighting}{Lighting Effect}
+ \endlist
+
Examples marked with an asterisk (*) are fully documented.
*/
@@ -851,11 +859,13 @@
\section1 Multimedia
- Qt provides low-level audio support on linux,windows and mac platforms by default and
- an audio plugin API to allow developers to implement there own audio support for
+ Qt provides low-level audio support on Linux, Windows and Mac OS X by default and
+ an audio plugin API to allow developers to implement their own audio support for
custom devices and platforms.
- These examples demonstrate the basic techniques used to take advantage of
+ \section1 Audio Handling
+
+ These examples demonstrate the basic techniques used to take advantage of the
Audio API in Qt applications.
\list
diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc
index b052c3c..73d3709 100644
--- a/doc/src/getting-started/installation.qdoc
+++ b/doc/src/getting-started/installation.qdoc
@@ -511,19 +511,27 @@ in the \l{Qt for the Symbian platform Requirements} document.
\note Qt must be installed on the same drive as the Symbian SDK you are
using, and the install path must not contain any spaces.
+ \o Install Qt into a device
+
+ To run Qt applications on a device, \c{qt_installer.sis} found
+ in the Qt installation directory must be first installed into the device.
+ \c{Qt_installer.sis} contains Qt libraries and Open C libraries all in one
+ convenient package.
+ Begin installation by connecting your device via USB cable to a computer that
+ has the \l{http://www.nokia.com/pcsuite}{Nokia PC Suite} installed.
+ On the device, select "PC Suite mode". In Windows Explorer right click
+ on the \c{qt_installer.sis} file, select "Install with Nokia Application
+ Installer" and follow the instructions.
+
\o Running Qt demos
We've included a subset of the Qt demos in this package for you
to try out. An excellent starting point is the "fluidlauncher"
- demo. To run the demo on a real device, you first have to install
- \c{qt.sis} and \c{fluidlauncher.sis} found in the Qt installation
- directory. Also, check if the device needs additional
- \l{Qt for the Symbian platform Requirements}{requirements}.
- Begin by connecting your device via USB cable to a computer that has
- the \l{http://www.nokia.com/pcsuite}{Nokia PC Suite} installed.
- On the device, select "PC Suite mode". In Windows Explorer right click
- on the \c{.sis} files, select "Install with Nokia Application Installer"
- and follow the instructions.
+ demo.
+
+ To run the demo on a real device, install \c{fluidlauncher.sis}
+ found in the Qt installation directory to a device that already has Qt installed.
+ After installation, you can find fluidlauncher in the applications folder of the device.
To run the demos and examples on the emulator, you need to build them first.
Open the "Qt for the Symbian platform Command Prompt" from the Start menu and type:
@@ -1013,15 +1021,26 @@ If you are using pre-built binaries, follow the instructions given in the
which is not available free of charge.
\endlist
- Running Qt on real device requires the following packages to be installed on your device.
- The packages can be found in the Symbian SDK where you installed Open C/C++:
+ Running Qt on real device requires the Open C to be installed on the device.
+ The Open C installation packages are embedded into \c{qt_installer.sis}, which is included in
+ Qt for Symbian binary package. If you are building Qt from scratch, you can find the
+ required packages in the Symbian SDK where you installed Open C/C++:
\list
\o \c{nokia_plugin\openc\s60opencsis\pips_s60_<version>.sis}
\o \c{nokia_plugin\openc\s60opencsis\openc_ssl_s60_<version>.sis}
\o \c{nokia_plugin\opencpp\s60opencppsis\stdcpp_s60_<version>.sis}
\endlist
- We recommend you to take a look of \l{http://developer.symbian.org/wiki/index.php/Qt_Quick_Start}{Symbian Foundation - Qt Quick Start}
+ If you wish to do hardware debugging with Carbide or run applications in real devices using "make run" command,
+ TRK must be installed to the device. \bold{Note:} TRK is not required if you just want to install and run
+ applications manually on the device.
+ \list
+ \o \l{http://tools.ext.nokia.com/trk/}{Application TRK}. Choose the correct
+ installation package based on the S60 version of your device (S60_<S60-version>_app_trk_<TRK-version>.sisx).
+ \endlist
+
+
+ We recommend you to take a look at \l{http://developer.symbian.org/wiki/index.php/Qt_Quick_Start}{Symbian Foundation - Qt Quick Start}
to get more information about how to setup the development environment.
\sa {Known Issues in %VERSION%}
diff --git a/doc/src/modules.qdoc b/doc/src/modules.qdoc
index 3058b84..5e759db 100644
--- a/doc/src/modules.qdoc
+++ b/doc/src/modules.qdoc
@@ -409,59 +409,58 @@
*/
/*!
- \module QtSvg
- \title QtSvg Module
- \since 4.1
- \contentspage All Qt Modules
- \previouspage QtSql
- \nextpage QtWebKit
- \ingroup modules
+ \module QtSvg
+ \title QtSvg Module
+ \since 4.1
+ \contentspage All Qt Modules
+ \previouspage QtSql
+ \nextpage QtWebKit
+ \ingroup modules
- \brief The QtSvg module provides classes for displaying the contents of SVG
- files.
+ \brief The QtSvg module provides classes for displaying and creating SVG files.
- To include the definitions of the module's classes, use the
- following directive:
+ To include the definitions of the module's classes, use the
+ following directive:
- \snippet doc/src/snippets/code/doc_src_qtsvg.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qtsvg.qdoc 0
- To link against the module, add this line to your \l qmake \c
- .pro file:
+ To link against the module, add this line to your \l qmake \c
+ .pro file:
- \snippet doc/src/snippets/code/doc_src_qtsvg.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qtsvg.qdoc 1
- The QtSvg module is part of the \l{Qt Full Framework Edition} and the
- \l{Open Source Versions of Qt}.
+ The QtSvg module is part of the \l{Qt Full Framework Edition} and the
+ \l{Open Source Versions of Qt}.
- \section1 License Information
-
- Some code for arc handling in this module is derived from code with
- the following license:
-
- \legalese
- Copyright 2002 USC/Information Sciences Institute
-
- Permission to use, copy, modify, distribute, and sell this software
- and its documentation for any purpose is hereby granted without
- fee, provided that the above copyright notice appear in all copies
- and that both that copyright notice and this permission notice
- appear in supporting documentation, and that the name of
- Information Sciences Institute not be used in advertising or
- publicity pertaining to distribution of the software without
- specific, written prior permission. Information Sciences Institute
- makes no representations about the suitability of this software for
- any purpose. It is provided "as is" without express or implied
- warranty.
-
- INFORMATION SCIENCES INSTITUTE DISCLAIMS ALL WARRANTIES WITH REGARD
- TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL INFORMATION SCIENCES
- INSTITUTE BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
- DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
- OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- PERFORMANCE OF THIS SOFTWARE.
- \endlegalese
+ \section1 License Information
+
+ Some code for arc handling in this module is derived from code with
+ the following license:
+
+ \legalese
+ Copyright 2002 USC/Information Sciences Institute
+
+ Permission to use, copy, modify, distribute, and sell this software
+ and its documentation for any purpose is hereby granted without
+ fee, provided that the above copyright notice appear in all copies
+ and that both that copyright notice and this permission notice
+ appear in supporting documentation, and that the name of
+ Information Sciences Institute not be used in advertising or
+ publicity pertaining to distribution of the software without
+ specific, written prior permission. Information Sciences Institute
+ makes no representations about the suitability of this software for
+ any purpose. It is provided "as is" without express or implied
+ warranty.
+
+ INFORMATION SCIENCES INSTITUTE DISCLAIMS ALL WARRANTIES WITH REGARD
+ TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL INFORMATION SCIENCES
+ INSTITUTE BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
+ OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ PERFORMANCE OF THIS SOFTWARE.
+ \endlegalese
*/
/*!
diff --git a/doc/src/objectmodel/signalsandslots.qdoc b/doc/src/objectmodel/signalsandslots.qdoc
index 9515904..d5e3280 100644
--- a/doc/src/objectmodel/signalsandslots.qdoc
+++ b/doc/src/objectmodel/signalsandslots.qdoc
@@ -376,6 +376,45 @@
Some irrelevant member functions have been omitted from this
example.
+ \section1 Signals And Slots With Default Arguments
+
+ The signatures of signals and slots may contain arguments, and the
+ arguments can have defualt values. Consider QObject::destroyed():
+
+ \code
+ void destroyed(QObject* = 0);
+ \endcode
+
+ When a QObject is deleted, it emits this QObject::destroyed()
+ signal. We want to catch this signal, wherever we might have a
+ dangling reference to the deleted QObject, so we can clean it up.
+ A suitable slot signature might be:
+
+ \code
+ void objectDestroyed(QObject* obj = 0);
+ \endcode
+
+ To connect the signal to the slot, we use QObject::connect() and
+ the \c{SIGNAL()} and \c{SLOT()} macros. The rule about whether to
+ include arguments or not in the \c{SIGNAL()} and \c{SLOT()}
+ macros, if the arguments have default values, is that the
+ signature passed to the \c{SIGNAL()} macro must \e not have fewer
+ arguments than the signature passed to the \c{SLOT()} macro.
+
+ All of these would work:
+ \code
+ connect(sender, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(Qbject*)));
+ connect(sender, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed()));
+ connect(sender, SIGNAL(destroyed()), this, SLOT(objectDestroyed()));
+ \endcode
+ But this one won't work:
+ \code
+ connect(sender, SIGNAL(destroyed()), this, SLOT(objectDestroyed(QObject*)));
+ \endcode
+
+ ...because the slot will be expecting a QObject that the signal
+ will not send. This connection will report a runtime error.
+
\section1 Advanced Signals and Slots Usage
For cases where you may require information on the sender of the
diff --git a/doc/src/platforms/symbian-introduction.qdoc b/doc/src/platforms/symbian-introduction.qdoc
index c0c4fb3..477e629 100644
--- a/doc/src/platforms/symbian-introduction.qdoc
+++ b/doc/src/platforms/symbian-introduction.qdoc
@@ -124,7 +124,12 @@
\row \o \c release-gcce \o Build release binaries for hardware using GCCE.
\row \o \c debug-armv5 \o Build debug binaries for hardware using RVCT.
\row \o \c release-armv5 \o Build release binaries for hardware using RVCT.
- \row \o \c run \o Run the emulator binaries from the build directory.
+ \row \o \c run \o Run the application. Environment variable
+ \c QT_SIS_TARGET (see below) can be used to specify which
+ build target is run. By default it is the last build target.
+ Note that running the application on real device
+ using this command requires \c TRK application to be running
+ on the device.
\row \o \c sis \o Create signed \c .sis file for project.
\endtable
diff --git a/doc/src/qt4-intro.qdoc b/doc/src/qt4-intro.qdoc
index fb1d0e4..a90544f 100644
--- a/doc/src/qt4-intro.qdoc
+++ b/doc/src/qt4-intro.qdoc
@@ -549,7 +549,7 @@
the state machine, it is also easier to use the framework for
animating GUIs, for instance.
- See \l{The State Machine Framework} documentation for more infromation.
+ See \l{The State Machine Framework} documentation for more information.
\section1 Multi-Touch and Gestures
diff --git a/doc/src/snippets/code/doc_src_deployment.qdoc b/doc/src/snippets/code/doc_src_deployment.qdoc
index 2d6a78f..8211abe 100644
--- a/doc/src/snippets/code/doc_src_deployment.qdoc
+++ b/doc/src/snippets/code/doc_src_deployment.qdoc
@@ -476,12 +476,8 @@ default_deployment.pkg_prerules += supported_platforms
//! [58]
embedded_deployments = \
- "; Embed Open C dependencies" \
- "@\"$${EPOCROOT}nokia_plugin/openc/s60opencsis/pips_s60_1_6_SS.sis\",(0x20013851)" \
- "@\"$${EPOCROOT}nokia_plugin/openc/s60opencsis/openc_ssl_s60_1_6_SS.sis\",(0x200110CB)" \
- "@\"$${EPOCROOT}nokia_plugin/opencpp/s60opencppsis/STDCPP_s60_1_6_SS.sis\",(0x2000F866)" \
"; Embed Qt dependencies" \
- "@\"$$[QT_INSTALL_PREFIX]/qt_rndsigned.sis\",(0x2001E61C)"
+ "@\"$$[QT_INSTALL_PREFIX]/qt_installer.sis\",(0x2001E62D)"
default_deployment.pkg_prerules += embedded_deployments
//! [58]
diff --git a/doc/src/snippets/code/doc_src_installation.qdoc b/doc/src/snippets/code/doc_src_installation.qdoc
index c810706..bc61702 100644
--- a/doc/src/snippets/code/doc_src_installation.qdoc
+++ b/doc/src/snippets/code/doc_src_installation.qdoc
@@ -198,6 +198,8 @@ make release-armv5
//! [29]
cd src\s60installs
make sis QT_SIS_OPTIONS=-i QT_SIS_CERTIFICATE=<certificate file> QT_SIS_KEY=<certificate key file>
+cd ..\3rdparty\webkit\WebCore
+make sis QT_SIS_OPTIONS=-i QT_SIS_CERTIFICATE=<certificate file> QT_SIS_KEY=<certificate key file>
//! [29]
//! [30]
diff --git a/examples/multimedia/audiodevices/audiodevices.cpp b/examples/multimedia/audiodevices/audiodevices.cpp
index beb31b4..a0ca5b8 100644
--- a/examples/multimedia/audiodevices/audiodevices.cpp
+++ b/examples/multimedia/audiodevices/audiodevices.cpp
@@ -40,45 +40,33 @@
****************************************************************************/
-#include <QDebug>
#include <QAudioDeviceInfo>
#include "audiodevices.h"
-AudioDevicesBase::AudioDevicesBase( QMainWindow *parent, Qt::WFlags f )
+AudioDevicesBase::AudioDevicesBase(QWidget *parent, Qt::WFlags f)
+ : QMainWindow(parent, f)
{
- Q_UNUSED(parent)
- Q_UNUSED(f)
- setupUi( this );
+ setupUi(this);
}
AudioDevicesBase::~AudioDevicesBase() {}
-AudioTest::AudioTest( QMainWindow *parent, Qt::WFlags f )
- : AudioDevicesBase( parent, f )
+AudioTest::AudioTest(QWidget *parent, Qt::WFlags f)
+ : AudioDevicesBase(parent, f)
{
- nearestFreq->setDisabled(true);
- nearestChannel->setDisabled(true);
- nearestCodec->setDisabled(true);
- nearestSampleSize->setDisabled(true);
- nearestSampleType->setDisabled(true);
- nearestEndian->setDisabled(true);
- logOutput->setDisabled(true);
-
mode = QAudio::AudioOutput;
- modeBox->addItem("Input");
- modeBox->addItem("Output");
- connect(testButton,SIGNAL(clicked()),SLOT(test()));
- connect(modeBox,SIGNAL(activated(int)),SLOT(modeChanged(int)));
- connect(deviceBox,SIGNAL(activated(int)),SLOT(deviceChanged(int)));
- connect(frequencyBox,SIGNAL(activated(int)),SLOT(freqChanged(int)));
- connect(channelsBox,SIGNAL(activated(int)),SLOT(channelChanged(int)));
- connect(codecsBox,SIGNAL(activated(int)),SLOT(codecChanged(int)));
- connect(sampleSizesBox,SIGNAL(activated(int)),SLOT(sampleSizeChanged(int)));
- connect(sampleTypesBox,SIGNAL(activated(int)),SLOT(sampleTypeChanged(int)));
- connect(endianBox,SIGNAL(activated(int)),SLOT(endianChanged(int)));
+ connect(testButton, SIGNAL(clicked()), SLOT(test()));
+ connect(modeBox, SIGNAL(activated(int)), SLOT(modeChanged(int)));
+ connect(deviceBox, SIGNAL(activated(int)), SLOT(deviceChanged(int)));
+ connect(frequencyBox, SIGNAL(activated(int)), SLOT(freqChanged(int)));
+ connect(channelsBox, SIGNAL(activated(int)), SLOT(channelChanged(int)));
+ connect(codecsBox, SIGNAL(activated(int)), SLOT(codecChanged(int)));
+ connect(sampleSizesBox, SIGNAL(activated(int)), SLOT(sampleSizeChanged(int)));
+ connect(sampleTypesBox, SIGNAL(activated(int)), SLOT(sampleTypeChanged(int)));
+ connect(endianBox, SIGNAL(activated(int)), SLOT(endianChanged(int)));
modeBox->setCurrentIndex(0);
modeChanged(0);
@@ -98,7 +86,7 @@ void AudioTest::test()
if (!deviceInfo.isNull()) {
if (deviceInfo.isFormatSupported(settings)) {
- logOutput->append("Success");
+ logOutput->append(tr("Success"));
nearestFreq->setText("");
nearestChannel->setText("");
nearestCodec->setText("");
@@ -136,16 +124,16 @@ void AudioTest::test()
}
}
else
- logOutput->append("No Device");
+ logOutput->append(tr("No Device"));
}
void AudioTest::modeChanged(int idx)
{
// mode has changed
- if(idx == 0)
- mode=QAudio::AudioInput;
+ if (idx == 0)
+ mode = QAudio::AudioInput;
else
- mode=QAudio::AudioOutput;
+ mode = QAudio::AudioOutput;
deviceBox->clear();
foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(mode))
@@ -176,23 +164,23 @@ void AudioTest::deviceChanged(int idx)
codecsBox->clear();
QStringList codecz = deviceInfo.supportedCodecs();
- for(int i = 0; i < codecz.size(); ++i)
+ for (int i = 0; i < codecz.size(); ++i)
codecsBox->addItem(QString("%1").arg(codecz.at(i)));
- if(codecz.size())
+ if (codecz.size())
settings.setCodec(codecz.at(0));
// Add false to create failed condition!
codecsBox->addItem("audio/test");
sampleSizesBox->clear();
QList<int> sampleSizez = deviceInfo.supportedSampleSizes();
- for(int i = 0; i < sampleSizez.size(); ++i)
+ for (int i = 0; i < sampleSizez.size(); ++i)
sampleSizesBox->addItem(QString("%1").arg(sampleSizez.at(i)));
- if(sampleSizez.size())
+ if (sampleSizez.size())
settings.setSampleSize(sampleSizez.at(0));
sampleTypesBox->clear();
QList<QAudioFormat::SampleType> sampleTypez = deviceInfo.supportedSampleTypes();
- for(int i = 0; i < sampleTypez.size(); ++i) {
+ for (int i = 0; i < sampleTypez.size(); ++i) {
switch(sampleTypez.at(i)) {
case QAudioFormat::SignedInt:
sampleTypesBox->addItem("SignedInt");
@@ -206,14 +194,14 @@ void AudioTest::deviceChanged(int idx)
case QAudioFormat::Unknown:
sampleTypesBox->addItem("Unknown");
}
- if(sampleTypez.size())
+ if (sampleTypez.size())
settings.setSampleType(sampleTypez.at(0));
}
endianBox->clear();
QList<QAudioFormat::Endian> endianz = deviceInfo.supportedByteOrders();
- for(int i = 0; i < endianz.size(); ++i) {
- switch(endianz.at(i)) {
+ for (int i = 0; i < endianz.size(); ++i) {
+ switch (endianz.at(i)) {
case QAudioFormat::LittleEndian:
endianBox->addItem("Little Endian");
break;
@@ -222,7 +210,7 @@ void AudioTest::deviceChanged(int idx)
break;
}
}
- if(endianz.size())
+ if (endianz.size())
settings.setByteOrder(endianz.at(0));
}
@@ -249,7 +237,7 @@ void AudioTest::sampleSizeChanged(int idx)
void AudioTest::sampleTypeChanged(int idx)
{
- switch(sampleTypesBox->itemText(idx).toInt()) {
+ switch (sampleTypesBox->itemText(idx).toInt()) {
case QAudioFormat::SignedInt:
settings.setSampleType(QAudioFormat::SignedInt);
break;
@@ -263,7 +251,7 @@ void AudioTest::sampleTypeChanged(int idx)
void AudioTest::endianChanged(int idx)
{
- switch(endianBox->itemText(idx).toInt()) {
+ switch (endianBox->itemText(idx).toInt()) {
case QAudioFormat::LittleEndian:
settings.setByteOrder(QAudioFormat::LittleEndian);
break;
@@ -271,4 +259,3 @@ void AudioTest::endianChanged(int idx)
settings.setByteOrder(QAudioFormat::BigEndian);
}
}
-
diff --git a/examples/multimedia/audiodevices/audiodevices.h b/examples/multimedia/audiodevices/audiodevices.h
index 5fe5547..bd4b7c4 100644
--- a/examples/multimedia/audiodevices/audiodevices.h
+++ b/examples/multimedia/audiodevices/audiodevices.h
@@ -49,7 +49,7 @@
class AudioDevicesBase : public QMainWindow, public Ui::AudioDevicesBase
{
public:
- AudioDevicesBase( QMainWindow *parent = 0, Qt::WFlags f = 0 );
+ AudioDevicesBase(QWidget *parent = 0, Qt::WFlags f = 0);
virtual ~AudioDevicesBase();
};
@@ -57,10 +57,10 @@ class AudioTest : public AudioDevicesBase
{
Q_OBJECT
public:
- AudioTest( QMainWindow *parent = 0, Qt::WFlags f = 0 );
+ AudioTest(QWidget *parent = 0, Qt::WFlags f = 0);
virtual ~AudioTest();
- QAudioDeviceInfo deviceInfo;
+ QAudioDeviceInfo deviceInfo;
QAudioFormat settings;
QAudio::Mode mode;
diff --git a/examples/multimedia/audiodevices/audiodevices.pro b/examples/multimedia/audiodevices/audiodevices.pro
index 232da09..1cb4679 100644
--- a/examples/multimedia/audiodevices/audiodevices.pro
+++ b/examples/multimedia/audiodevices/audiodevices.pro
@@ -1,7 +1,7 @@
HEADERS = audiodevices.h
SOURCES = audiodevices.cpp \
main.cpp
-FORMS += audiodevicesbase.ui
+FORMS += audiodevicesbase.ui
QT += multimedia
diff --git a/examples/multimedia/audiodevices/audiodevicesbase.ui b/examples/multimedia/audiodevices/audiodevicesbase.ui
index 5207338..faa39dc 100644
--- a/examples/multimedia/audiodevices/audiodevicesbase.ui
+++ b/examples/multimedia/audiodevices/audiodevicesbase.ui
@@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
- <string>AudioDevicesBase</string>
+ <string>Audio Devices</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
@@ -41,7 +41,18 @@
<widget class="QComboBox" name="deviceBox"/>
</item>
<item row="1" column="1">
- <widget class="QComboBox" name="modeBox"/>
+ <widget class="QComboBox" name="modeBox">
+ <item>
+ <property name="text">
+ <string>Input</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Output</string>
+ </property>
+ </item>
+ </widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="actualLabel">
@@ -93,7 +104,11 @@
<widget class="QComboBox" name="frequencyBox"/>
</item>
<item row="4" column="1">
- <widget class="QLineEdit" name="nearestFreq"/>
+ <widget class="QLineEdit" name="nearestFreq">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="actualChannelsLabel">
@@ -113,7 +128,11 @@
<widget class="QComboBox" name="channelsBox"/>
</item>
<item row="6" column="1">
- <widget class="QLineEdit" name="nearestChannel"/>
+ <widget class="QLineEdit" name="nearestChannel">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="actualCodecLabel">
@@ -133,7 +152,11 @@
<widget class="QComboBox" name="codecsBox"/>
</item>
<item row="8" column="1">
- <widget class="QLineEdit" name="nearestCodec"/>
+ <widget class="QLineEdit" name="nearestCodec">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="actualSampleSizeLabel">
@@ -153,7 +176,11 @@
<widget class="QComboBox" name="sampleSizesBox"/>
</item>
<item row="10" column="1">
- <widget class="QLineEdit" name="nearestSampleSize"/>
+ <widget class="QLineEdit" name="nearestSampleSize">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="actualSampleTypeLabel">
@@ -173,7 +200,11 @@
<widget class="QComboBox" name="sampleTypesBox"/>
</item>
<item row="12" column="1">
- <widget class="QLineEdit" name="nearestSampleType"/>
+ <widget class="QLineEdit" name="nearestSampleType">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
</item>
<item row="13" column="0">
<widget class="QLabel" name="actualEndianLabel">
@@ -193,10 +224,17 @@
<widget class="QComboBox" name="endianBox"/>
</item>
<item row="14" column="1">
- <widget class="QLineEdit" name="nearestEndian"/>
+ <widget class="QLineEdit" name="nearestEndian">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
</item>
<item row="15" column="0" colspan="2">
<widget class="QTextEdit" name="logOutput">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
<property name="minimumSize">
<size>
<width>0</width>
@@ -216,16 +254,6 @@
</item>
</layout>
</widget>
- <widget class="QMenuBar" name="menubar">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>504</width>
- <height>19</height>
- </rect>
- </property>
- </widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
diff --git a/examples/webkit/fancybrowser/main.cpp b/examples/webkit/fancybrowser/main.cpp
index 7f3c983..7ca862d 100644
--- a/examples/webkit/fancybrowser/main.cpp
+++ b/examples/webkit/fancybrowser/main.cpp
@@ -45,7 +45,7 @@
int main(int argc, char * argv[])
{
QApplication app(argc, argv);
- MainWindow *browser = new MainWindow;
- browser->show();
+ MainWindow browser;
+ browser.show();
return app.exec();
}
diff --git a/examples/webkit/googlechat/main.cpp b/examples/webkit/googlechat/main.cpp
index 6b5e11f..ca94131 100644
--- a/examples/webkit/googlechat/main.cpp
+++ b/examples/webkit/googlechat/main.cpp
@@ -49,7 +49,7 @@ int main(int argc, char * argv[])
QNetworkProxyFactory::setUseSystemConfiguration(true);
- GoogleChat *chat = new GoogleChat;
- chat->show();
+ GoogleChat chat;
+ chat.show();
return app.exec();
}
diff --git a/examples/webkit/previewer/main.cpp b/examples/webkit/previewer/main.cpp
index 183b03f..1c80c19 100644
--- a/examples/webkit/previewer/main.cpp
+++ b/examples/webkit/previewer/main.cpp
@@ -46,8 +46,8 @@
int main(int argc, char * argv[])
{
QApplication app(argc, argv);
- MainWindow *mainWindow = new MainWindow;
- mainWindow->show();
+ MainWindow mainWindow;
+ mainWindow.show();
return app.exec();
}
//! [0]
diff --git a/mkspecs/features/symbian/platform_paths.prf b/mkspecs/features/symbian/platform_paths.prf
index bec9811..f5caae0 100644
--- a/mkspecs/features/symbian/platform_paths.prf
+++ b/mkspecs/features/symbian/platform_paths.prf
@@ -216,10 +216,11 @@ exists($${EPOCROOT}epoc32/include/platform_paths.prf) {
OS_LAYER_SSL_SYSTEMINCLUDE = $$OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/openssl)
# stlportv5 is preferred over stlport as it has the throwing version of operator new
- exists($${EPOCROOT}epoc32/include/stdapis/stlportv5) {
- OS_LAYER_STDCPP_SYSTEMINCLUDE = $$OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/stlportv5)
- } else {
+ exists($${EPOCROOT}epoc32/include/stdapis/stlport) \
+ :!exists($${EPOCROOT}epoc32/include/stdapis/stlportv5) {
OS_LAYER_STDCPP_SYSTEMINCLUDE = $$OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/stlport)
+ } else {
+ OS_LAYER_STDCPP_SYSTEMINCLUDE = $$OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/stlportv5)
}
OS_LAYER_BOOST_SYSTEMINCLUDE = $$OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/boost)
@@ -427,12 +428,15 @@ exists($${EPOCROOT}epoc32/include/platform_paths.prf) {
/epoc32/include/stdapis/openssl
# stlportv5 is preferred over stlport as it has the throwing version of operator new
- exists($${EPOCROOT}epoc32/include/osextensions/stdapis/stlportv5)|exists($${EPOCROOT}epoc32/include/stdapis/stlportv5) {
- OS_LAYER_STDCPP_SYSTEMINCLUDE = $$OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/stlportv5) \
- /epoc32/include/stdapis/stlportv5
- } else {
- OS_LAYER_STDCPP_SYSTEMINCLUDE = $$OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/stlport) \
- /epoc32/include/stdapis/stlport
+ OS_LAYER_STDCPP_SYSTEMINCLUDE = $$OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/stlportv5) \
+ /epoc32/include/stdapis/stlportv5
+ exists($${EPOCROOT}epoc32/include/osextensions/stdapis/stlport) \
+ |exists($${EPOCROOT}epoc32/include/stdapis/stlport) {
+ !exists($${EPOCROOT}epoc32/include/osextensions/stdapis/stlportv5) \
+ :!exists($${EPOCROOT}epoc32/include/stdapis/stlportv5) {
+ OS_LAYER_STDCPP_SYSTEMINCLUDE = $$OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/stlport) \
+ /epoc32/include/stdapis/stlport
+ }
}
OS_LAYER_BOOST_SYSTEMINCLUDE = $$OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/boost) \
diff --git a/mkspecs/features/symbian/qt.prf b/mkspecs/features/symbian/qt.prf
index 0f5b08b..99f5ece 100644
--- a/mkspecs/features/symbian/qt.prf
+++ b/mkspecs/features/symbian/qt.prf
@@ -28,6 +28,13 @@ contains(CONFIG, qt):!contains(TARGET.UID3, 0x2001E61C):!contains(TARGET.UID3, 0
default_deployment.pkg_prerules += \
"; Default dependency to Qt libraries" \
"(0x2001E61C), $${QT_MAJOR_VERSION}, $${QT_MINOR_VERSION}, $${QT_PATCH_VERSION}, {\"Qt\"}"
+
+ # Projects linking to webkit need dependency to webkit
+ contains(QT, webkit): {
+ default_deployment.pkg_prerules += \
+ "; Dependency to Qt Webkit" \
+ "(0x200267C2), $${QT_MAJOR_VERSION}, $${QT_MINOR_VERSION}, $${QT_PATCH_VERSION}, {\"QtWebKit\"}"
+ }
}
isEmpty(TARGET.EPOCSTACKSIZE):TARGET.EPOCSTACKSIZE = 0x14000
diff --git a/mkspecs/features/unix/separate_debug_info.prf b/mkspecs/features/unix/separate_debug_info.prf
index 0c95baf..c675828 100644
--- a/mkspecs/features/unix/separate_debug_info.prf
+++ b/mkspecs/features/unix/separate_debug_info.prf
@@ -1,5 +1,5 @@
-!staticlib:!static:!contains(TEMPLATE, subdirs):!isEmpty(QMAKE_OBJCOPY) {
+!separate_debug_info_nocopy:!staticlib:!static:!contains(TEMPLATE, subdirs):!isEmpty(QMAKE_OBJCOPY) {
QMAKE_SEPARATE_DEBUG_INFO = (test -z \"$(DESTDIR)\" || cd \"$(DESTDIR)\" ; targ=`basename $(TARGET)`; $$QMAKE_OBJCOPY --only-keep-debug \"\$\$targ\" \"\$\$targ.debug\" && $$QMAKE_OBJCOPY --strip-debug \"\$\$targ\" && $$QMAKE_OBJCOPY --add-gnu-debuglink=\"\$\$targ.debug\" \"\$\$targ\" && chmod -x \"\$\$targ.debug\" ) ;
QMAKE_INSTALL_SEPARATE_DEBUG_INFO = test -z "$(DESTDIR)" || cd \"$(DESTDIR)\" ; $(INSTALL_FILE) `basename $(TARGET)`.debug $(INSTALL_ROOT)/\$\$target_path/
diff --git a/mkspecs/hpux-g++-64/qmake.conf b/mkspecs/hpux-g++-64/qmake.conf
index 38595c9..f76bd4e 100644
--- a/mkspecs/hpux-g++-64/qmake.conf
+++ b/mkspecs/hpux-g++-64/qmake.conf
@@ -15,7 +15,7 @@ QMAKE_LEX = flex
QMAKE_LEXFLAGS =
QMAKE_YACC = yacc
QMAKE_YACCFLAGS = -d
-QMAKE_CFLAGS = +DA2.0W
+QMAKE_CFLAGS =
QMAKE_CFLAGS_DEPS = -M
QMAKE_CFLAGS_WARN_ON = -Wall -W
QMAKE_CFLAGS_WARN_OFF = -w
@@ -51,7 +51,7 @@ QMAKE_LINK = g++
QMAKE_LINK_SHLIB = g++
QMAKE_LINK_C = gcc
QMAKE_LINK_C_SHLIB = gcc
-QMAKE_LFLAGS = +DA2.0W -Wl,+s -lpthread
+QMAKE_LFLAGS = -Wl,+s -lpthread
QMAKE_LFLAGS_RELEASE =
QMAKE_LFLAGS_DEBUG =
QMAKE_LFLAGS_SHLIB = -fPIC -shared
diff --git a/mkspecs/hpux-g++-64/qplatformdefs.h b/mkspecs/hpux-g++-64/qplatformdefs.h
index a8d06d8..ac13799 100644
--- a/mkspecs/hpux-g++-64/qplatformdefs.h
+++ b/mkspecs/hpux-g++-64/qplatformdefs.h
@@ -145,7 +145,7 @@
#define QT_SIGNAL_ARGS int
#define QT_SIGNAL_IGNORE SIG_IGN
-#define QT_SOCKLEN_T int
+#define QT_SOCKLEN_T socklen_t
#endif // QPLATFORMDEFS_H
diff --git a/mkspecs/linux-g++-maemo/qmake.conf b/mkspecs/linux-g++-maemo/qmake.conf
index c39ba2c..b0f3ca3 100644
--- a/mkspecs/linux-g++-maemo/qmake.conf
+++ b/mkspecs/linux-g++-maemo/qmake.conf
@@ -5,6 +5,7 @@
MAKEFILE_GENERATOR = UNIX
TEMPLATE = app
CONFIG += qt warn_on release incremental link_prl
+CONFIG += nostrip
QT += core gui
QMAKE_INCREMENTAL_STYLE = sublib
diff --git a/mkspecs/linux-g++/qplatformdefs.h b/mkspecs/linux-g++/qplatformdefs.h
index ecfbc73..00f1b51 100644
--- a/mkspecs/linux-g++/qplatformdefs.h
+++ b/mkspecs/linux-g++/qplatformdefs.h
@@ -67,7 +67,6 @@
#include <grp.h>
#include <pwd.h>
#include <signal.h>
-#include <dlfcn.h>
#include <sys/types.h>
#include <sys/ioctl.h>
diff --git a/mkspecs/solaris-cc-64-stlport/qmake.conf b/mkspecs/solaris-cc-64-stlport/qmake.conf
new file mode 100644
index 0000000..3437b8f
--- /dev/null
+++ b/mkspecs/solaris-cc-64-stlport/qmake.conf
@@ -0,0 +1,8 @@
+#
+# qmake configuration for solaris-cc-64-stlport
+#
+
+include(../solaris-cc-64/qmake.conf)
+
+QMAKE_CXXFLAGS += -library=stlport4
+QMAKE_LFLAGS += -library=stlport4
diff --git a/mkspecs/solaris-cc-64-stlport/qplatformdefs.h b/mkspecs/solaris-cc-64-stlport/qplatformdefs.h
new file mode 100644
index 0000000..7c88722
--- /dev/null
+++ b/mkspecs/solaris-cc-64-stlport/qplatformdefs.h
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the qmake spec 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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "../solaris-cc-64/qplatformdefs.h"
diff --git a/mkspecs/solaris-cc-stlport/qmake.conf b/mkspecs/solaris-cc-stlport/qmake.conf
new file mode 100644
index 0000000..b0df45e
--- /dev/null
+++ b/mkspecs/solaris-cc-stlport/qmake.conf
@@ -0,0 +1,8 @@
+#
+# qmake configuration for solaris-cc-stlport
+#
+
+include(../solaris-cc/qmake.conf)
+
+QMAKE_CXXFLAGS += -library=stlport4
+QMAKE_LFLAGS += -library=stlport4
diff --git a/mkspecs/solaris-cc-stlport/qplatformdefs.h b/mkspecs/solaris-cc-stlport/qplatformdefs.h
new file mode 100644
index 0000000..bb75c1f
--- /dev/null
+++ b/mkspecs/solaris-cc-stlport/qplatformdefs.h
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the qmake spec 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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "../solaris-cc/qplatformdefs.h"
diff --git a/mkspecs/unsupported/linux-host-g++/qmake.conf b/mkspecs/unsupported/linux-host-g++/qmake.conf
index 237477c..8a480c4 100644
--- a/mkspecs/unsupported/linux-host-g++/qmake.conf
+++ b/mkspecs/unsupported/linux-host-g++/qmake.conf
@@ -134,5 +134,5 @@ QMAKE_MKDIR = mkdir -p
QMAKE_INSTALL_FILE = install -m 644 -p
QMAKE_INSTALL_PROGRAM = install -m 755 -p
-include(../common/unix.conf)
+include(../../common/unix.conf)
load(qt_config)
diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp
index 8379ed9..b2709d1 100644
--- a/qmake/generators/symbian/symmake.cpp
+++ b/qmake/generators/symbian/symmake.cpp
@@ -91,7 +91,6 @@
#define OK_SIS_TARGET "ok_sis"
#define FAIL_SIS_NOPKG_TARGET "fail_sis_nopkg"
#define FAIL_SIS_NOCACHE_TARGET "fail_sis_nocache"
-#define RESTORE_BUILD_TARGET "restore_build"
#define PRINT_FILE_CREATE_ERROR(filename) fprintf(stderr, "Error: Could not create '%s'\n", qPrintable(filename));
@@ -1762,9 +1761,14 @@ void SymbianMakefileGenerator::removeSpecialCharacters(QString& str)
void SymbianMakefileGenerator::writeSisTargets(QTextStream &t)
{
- t << SIS_TARGET ": " RESTORE_BUILD_TARGET << endl;
+ t << "-include " MAKE_CACHE_NAME << endl;
+ t << endl;
+
+ t << SIS_TARGET ":" << endl;
QString siscommand = QString("\t$(if $(wildcard %1_template.%2),$(if $(wildcard %3)," \
- "$(MAKE) -s -f $(MAKEFILE) %4,$(MAKE) -s -f $(MAKEFILE) %5)," \
+ "$(MAKE) -s -f $(MAKEFILE) %4," \
+ "$(if $(QT_SIS_TARGET),$(MAKE) -s -f $(MAKEFILE) %4," \
+ "$(MAKE) -s -f $(MAKEFILE) %5))," \
"$(MAKE) -s -f $(MAKEFILE) %6)")
.arg(fixedTarget)
.arg("pkg")
@@ -1789,12 +1793,7 @@ void SymbianMakefileGenerator::writeSisTargets(QTextStream &t)
t << endl;
t << FAIL_SIS_NOCACHE_TARGET ":" << endl;
- t << "\t$(error Project has to be build before calling 'SIS' target)" << endl;
- t << endl;
-
-
- t << RESTORE_BUILD_TARGET ":" << endl;
- t << "-include " MAKE_CACHE_NAME << endl;
+ t << "\t$(error Project has to be built or QT_SIS_TARGET environment variable has to be set before calling 'SIS' target)" << endl;
t << endl;
}
@@ -1852,3 +1851,22 @@ void SymbianMakefileGenerator::generateDistcleanTargets(QTextStream& t)
t << "distclean: clean dodistclean" << endl;
t << endl;
}
+
+void SymbianMakefileGenerator::generateExecutionTargets(QTextStream& t, const QStringList& platforms)
+{
+ // create execution targets
+ if (targetType == TypeExe) {
+ if (platforms.contains("winscw")) {
+ t << "ifeq (\"DEBUG-winscw\", \"$(QT_SIS_TARGET)\")" << endl;
+ t << "run:" << endl;
+ t << "\t-call " << epocRoot() << "epoc32/release/winscw/udeb/" << fixedTarget << ".exe " << "$(QT_RUN_OPTIONS)" << endl;
+ t << "else" << endl;
+ }
+ t << "run: sis" << endl;
+ t << "\trunonphone $(QT_RUN_ON_PHONE_OPTIONS) --sis " << fixedTarget << "_$(QT_SIS_TARGET).sis " << fixedTarget << ".exe " << "$(QT_RUN_OPTIONS)" << endl;
+ if (platforms.contains("winscw")) {
+ t << "endif" << endl;
+ }
+ t << endl;
+ }
+}
diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h
index 1a20e64..6949842 100644
--- a/qmake/generators/symbian/symmake.h
+++ b/qmake/generators/symbian/symmake.h
@@ -148,6 +148,7 @@ protected:
void writeSisTargets(QTextStream &t);
void generateDistcleanTargets(QTextStream& t);
+ void generateExecutionTargets(QTextStream& t, const QStringList& platforms);
// Subclass implements
virtual void writeBldInfExtensionRulesPart(QTextStream& t, const QString &iconTargetFile) = 0;
diff --git a/qmake/generators/symbian/symmake_abld.cpp b/qmake/generators/symbian/symmake_abld.cpp
index 6225720..065af48 100644
--- a/qmake/generators/symbian/symmake_abld.cpp
+++ b/qmake/generators/symbian/symmake_abld.cpp
@@ -88,15 +88,15 @@ void SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, b
t << "# ==============================================================================" << "\n" << endl;
t << endl << endl;
-
+
t << "MAKE = make" << endl;
t << endl;
-
+
t << "VISUAL_CFG = RELEASE" << endl;
- t << "ifeq \"$(CFG)\" \"UDEB\"" << endl;
- t << "VISUAL_CFG = DEBUG" << endl;
- t << "endif" << endl;
- t << endl;
+ t << "ifeq \"$(CFG)\" \"UDEB\"" << endl;
+ t << "VISUAL_CFG = DEBUG" << endl;
+ t << "endif" << endl;
+ t << endl;
t << DO_NOTHING_TARGET " :" << endl;
t << "\t" << "@rem " DO_NOTHING_TARGET << endl << endl;
@@ -113,8 +113,8 @@ void SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, b
cleanDepsWinscw.append(WINSCW_DEPLOYMENT_CLEAN_TARGET);
finalDeps.append(DO_NOTHING_TARGET);
finalDepsWinscw.append(WINSCW_DEPLOYMENT_TARGET);
- wrapperTargets << WINSCW_DEPLOYMENT_TARGET
- << WINSCW_DEPLOYMENT_CLEAN_TARGET
+ wrapperTargets << WINSCW_DEPLOYMENT_TARGET
+ << WINSCW_DEPLOYMENT_CLEAN_TARGET
<< STORE_BUILD_TARGET;
} else {
buildDeps.append(CREATE_TEMPS_TARGET " " PRE_TARGETDEPS_TARGET " " STORE_BUILD_TARGET);
@@ -153,9 +153,9 @@ void SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, b
QString makefile(Option::fixPathToTargetOS(fileInfo(wrapperFileName).canonicalFilePath()));
foreach(QString target, wrapperTargets) {
t << target << " : " << makefile << endl;
- t << "\t-$(MAKE) -f \"" << makefile << "\" " << target << " QT_SIS_TARGET=$(VISUAL_CFG)-$(PLATFORM)" << endl << endl;
- }
-
+ t << "\t-$(MAKE) -f \"" << makefile << "\" " << target << " QT_SIS_TARGET=$(VISUAL_CFG)-$(PLATFORM)" << endl << endl;
+ }
+
t << endl;
} // if(ft.open(QIODevice::WriteOnly))
}
@@ -372,11 +372,29 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool
t << "\t-bldmake clean" << endl;
t << endl;
- // Create execution target
- if (debugPlatforms.contains("winscw") && targetType == TypeExe) {
- t << "run:" << endl;
- t << "\t-call " << epocRoot() << "epoc32\\release\\winscw\\udeb\\" << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".exe")) << endl << endl;
+ t << "clean-debug: $(ABLD)" << endl;
+ foreach(QString item, debugPlatforms) {
+ t << "\t$(ABLD)" << testClause << " reallyclean " << item << " udeb" << endl;
+ }
+ t << endl;
+ t << "clean-release: $(ABLD)" << endl;
+ foreach(QString item, releasePlatforms) {
+ t << "\t$(ABLD)" << testClause << " reallyclean " << item << " urel" << endl;
+ }
+ t << endl;
+
+ // For more specific builds, targets are in this form: clean-build-platform, e.g. clean-release-armv5
+ foreach(QString item, debugPlatforms) {
+ t << "clean-debug-" << item << ": $(ABLD)" << endl;
+ t << "\t$(ABLD)" << testClause << " reallyclean " << item << " udeb" << endl;
}
+ foreach(QString item, releasePlatforms) {
+ t << "clean-release-" << item << ": $(ABLD)" << endl;
+ t << "\t$(ABLD)" << testClause << " reallyclean " << item << " urel" << endl;
+ }
+ t << endl;
+
+ generateExecutionTargets(t, debugPlatforms);
}
void SymbianAbldMakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t, const QString &iconTargetFile)
diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp
index c7eae64..7d6119d 100644
--- a/qmake/generators/symbian/symmake_sbsv2.cpp
+++ b/qmake/generators/symbian/symmake_sbsv2.cpp
@@ -171,18 +171,26 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo
t << "\t$(QMAKE)" << endl;
t << endl;
+ QString winscw("winscw");
t << "debug: " << BLD_INF_FILENAME << endl;
+ t << "\t$(SBS)";
foreach(QString item, debugPlatforms) {
- t << "\t$(SBS) -c " << item << "_udeb" << testClause << endl;
+ if(QString::compare(item, winscw) == 0)
+ t << " -c " << item << "_udeb.mwccinc" << testClause;
+ else
+ t << " -c " << item << "_udeb" << testClause;
}
t << endl;
t << "release: " << BLD_INF_FILENAME << endl;
+ t << "\t$(SBS)";
foreach(QString item, releasePlatforms) {
- t << "\t$(SBS) -c " << item << "_urel" << testClause << endl;
+ if(QString::compare(item, winscw) == 0)
+ t << " -c " << item << "_urel.mwccinc" << testClause;
+ else
+ t << " -c " << item << "_urel" << testClause;
}
t << endl;
- QString winscw("winscw");
// For more specific builds, targets are in this form: build-platform, e.g. release-armv5
foreach(QString item, debugPlatforms) {
t << "debug-" << item << ": " << BLD_INF_FILENAME << endl;
@@ -231,11 +239,31 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo
t << "\t-$(SBS) reallyclean" << endl;
t << endl;
- // create execution target
- if (debugPlatforms.contains("winscw") && targetType == TypeExe) {
- t << "run:" << endl;
- t << "\t-call " << epocRoot() << "epoc32/release/winscw/udeb/" << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".exe")) << endl << endl;
+ t << "clean-debug: " << BLD_INF_FILENAME << endl;
+ t << "\t$(SBS) reallyclean";
+ foreach(QString item, debugPlatforms) {
+ t << " -c " << item << "_udeb" << testClause;
+ }
+ t << endl;
+ t << "clean-release: " << BLD_INF_FILENAME << endl;
+ t << "\t$(SBS) reallyclean";
+ foreach(QString item, releasePlatforms) {
+ t << " -c " << item << "_urel" << testClause;
+ }
+ t << endl;
+
+ // For more specific builds, targets are in this form: clean-build-platform, e.g. clean-release-armv5
+ foreach(QString item, debugPlatforms) {
+ t << "clean-debug-" << item << ": " << BLD_INF_FILENAME << endl;
+ t << "\t$(SBS) reallyclean -c " << item << "_udeb" << testClause << endl;
}
+ foreach(QString item, releasePlatforms) {
+ t << "clean-release-" << item << ": " << BLD_INF_FILENAME << endl;
+ t << "\t$(SBS) reallyclean -c " << item << "_urel" << testClause << endl;
+ }
+ t << endl;
+
+ generateExecutionTargets(t, debugPlatforms);
}
void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t, const QString &iconTargetFile)
diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp
index 7dc456e..593a075 100644
--- a/qmake/generators/win32/msvc_objectmodel.cpp
+++ b/qmake/generators/win32/msvc_objectmodel.cpp
@@ -1394,8 +1394,10 @@ bool VCLinkerTool::parseOption(const char* option)
case 0x0005bb6: // X86
TargetMachine = machineX86;
break;
- // so we put the others in AdditionalOptions...
case 0x0005b94: // X64
+ TargetMachine = machineX64;
+ break;
+ // so we put the others in AdditionalOptions...
case 0x0046063: // AM33
case 0x000466d: // ARM
case 0x0004795: // CEE
diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h
index d178d30..f7fdf3a 100644
--- a/qmake/generators/win32/msvc_objectmodel.h
+++ b/qmake/generators/win32/msvc_objectmodel.h
@@ -298,7 +298,8 @@ enum linkProgressOption {
};
enum machineTypeOption {
machineNotSet,
- machineX86
+ machineX86,
+ machineX64 = 17
};
enum midlCharOption {
midlCharUnsigned,
diff --git a/src/3rdparty/easing/easing.cpp b/src/3rdparty/easing/easing.cpp
index 81af40f..7d70a4d 100644
--- a/src/3rdparty/easing/easing.cpp
+++ b/src/3rdparty/easing/easing.cpp
@@ -252,7 +252,7 @@ static qreal easeOutInQuint(qreal t)
*/
static qreal easeInSine(qreal t)
{
- return (t == 1.0) ? 1.0 : -::cos(t * M_PI_2) + 1.0;
+ return (t == 1.0) ? 1.0 : -::qCos(t * M_PI_2) + 1.0;
}
/**
@@ -263,7 +263,7 @@ static qreal easeInSine(qreal t)
*/
static qreal easeOutSine(qreal t)
{
- return ::sin(t* M_PI_2);
+ return ::qSin(t* M_PI_2);
}
/**
@@ -274,7 +274,7 @@ static qreal easeOutSine(qreal t)
*/
static qreal easeInOutSine(qreal t)
{
- return -0.5 * (::cos(M_PI*t) - 1);
+ return -0.5 * (::qCos(M_PI*t) - 1);
}
/**
@@ -397,15 +397,15 @@ static qreal easeInElastic_helper(qreal t, qreal b, qreal c, qreal d, qreal a, q
if (t_adj==1) return b+c;
qreal s;
- if(a < ::fabs(c)) {
+ if(a < ::qFabs(c)) {
a = c;
s = p / 4.0f;
} else {
- s = p / (2 * M_PI) * ::asin(c / a);
+ s = p / (2 * M_PI) * ::qAsin(c / a);
}
t_adj -= 1.0f;
- return -(a*::qPow(2.0f,10*t_adj) * ::sin( (t_adj*d-s)*(2*M_PI)/p )) + b;
+ return -(a*::qPow(2.0f,10*t_adj) * ::qSin( (t_adj*d-s)*(2*M_PI)/p )) + b;
}
/**
@@ -431,10 +431,10 @@ static qreal easeOutElastic_helper(qreal t, qreal /*b*/, qreal c, qreal /*d*/, q
a = c;
s = p / 4.0f;
} else {
- s = p / (2 * M_PI) * ::asin(c / a);
+ s = p / (2 * M_PI) * ::qAsin(c / a);
}
- return (a*::qPow(2.0f,-10*t) * ::sin( (t-s)*(2*M_PI)/p ) + c);
+ return (a*::qPow(2.0f,-10*t) * ::qSin( (t-s)*(2*M_PI)/p ) + c);
}
/**
@@ -469,11 +469,11 @@ static qreal easeInOutElastic(qreal t, qreal a, qreal p)
a = 1.0;
s = p / 4.0f;
} else {
- s = p / (2 * M_PI) * ::asin(1.0 / a);
+ s = p / (2 * M_PI) * ::qAsin(1.0 / a);
}
- if (t < 1) return -.5*(a*::qPow(2.0f,10*(t-1)) * ::sin( (t-1-s)*(2*M_PI)/p ));
- return a*::qPow(2.0f,-10*(t-1)) * ::sin( (t-1-s)*(2*M_PI)/p )*.5 + 1.0;
+ if (t < 1) return -.5*(a*::qPow(2.0f,10*(t-1)) * ::qSin( (t-1-s)*(2*M_PI)/p ));
+ return a*::qPow(2.0f,-10*(t-1)) * ::qSin( (t-1-s)*(2*M_PI)/p )*.5 + 1.0;
}
/**
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-hebrew.c b/src/3rdparty/harfbuzz/src/harfbuzz-hebrew.c
index 2bda386..67029be 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-hebrew.c
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-hebrew.c
@@ -56,8 +56,6 @@ HB_Bool HB_HebrewShape(HB_ShaperItem *shaper_item)
assert(shaper_item->item.script == HB_Script_Hebrew);
- HB_HeuristicSetGlyphAttributes(shaper_item);
-
#ifndef NO_OPENTYPE
if (HB_SelectScript(shaper_item, hebrew_features)) {
@@ -65,7 +63,7 @@ HB_Bool HB_HebrewShape(HB_ShaperItem *shaper_item)
if (!HB_ConvertStringToGlyphIndices(shaper_item))
return FALSE;
-
+ HB_HeuristicSetGlyphAttributes(shaper_item);
HB_OpenTypeShape(shaper_item, /*properties*/0);
return HB_OpenTypePosition(shaper_item, availableGlyphs, /*doLogClusters*/TRUE);
}
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp
index bfb03ab..bfc7bd4 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp
@@ -980,6 +980,7 @@ HB_Face HB_NewFace(void *font, HB_GetFontTableFunc tableFunc)
HB_Stream gdefStream;
gdefStream = getTableStream(font, tableFunc, TTAG_GDEF);
+ error = HB_Err_Not_Covered;
if (!gdefStream || (error = HB_Load_GDEF_Table(gdefStream, &face->gdef))) {
//DEBUG("error loading gdef table: %d", error);
face->gdef = 0;
@@ -987,6 +988,7 @@ HB_Face HB_NewFace(void *font, HB_GetFontTableFunc tableFunc)
//DEBUG() << "trying to load gsub table";
stream = getTableStream(font, tableFunc, TTAG_GSUB);
+ error = HB_Err_Not_Covered;
if (!stream || (error = HB_Load_GSUB_Table(stream, &face->gsub, face->gdef, gdefStream))) {
face->gsub = 0;
if (error != HB_Err_Not_Covered) {
@@ -998,6 +1000,7 @@ HB_Face HB_NewFace(void *font, HB_GetFontTableFunc tableFunc)
_hb_close_stream(stream);
stream = getTableStream(font, tableFunc, TTAG_GPOS);
+ error = HB_Err_Not_Covered;
if (!stream || (error = HB_Load_GPOS_Table(stream, &face->gpos, face->gdef, gdefStream))) {
face->gpos = 0;
DEBUG("error loading gpos table: %d", error);
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSObject.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSObject.cpp
index d7f5344..01f74ac 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSObject.cpp
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSObject.cpp
@@ -115,9 +115,17 @@ void JSObject::put(ExecState* exec, const Identifier& propertyName, JSValue valu
return;
for (JSObject* obj = this; ; obj = asObject(prototype)) {
+#ifdef QT_BUILD_SCRIPT_LIB
+ PropertyDescriptor descriptor;
+ if (obj->getPropertyDescriptor(exec, propertyName, descriptor)) {
+ JSObject* setterFunc;
+ if ((descriptor.isAccessorDescriptor() && ((setterFunc = asObject(descriptor.setter())), true))
+ || (descriptor.value().isGetterSetter() && ((setterFunc = asGetterSetter(descriptor.value())->setter()), true))) {
+#else
if (JSValue gs = obj->getDirect(propertyName)) {
if (gs.isGetterSetter()) {
- JSObject* setterFunc = asGetterSetter(gs)->setter();
+ JSObject* setterFunc = asGetterSetter(gs)->setter();
+#endif
if (!setterFunc) {
throwSetterError(exec);
return;
diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog
index d7d2d57..a559d9b 100644
--- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog
+++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog
@@ -1,3 +1,25 @@
+2009-12-08 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Reviewed by Darin Adler.
+
+ Make WebKit build correctly on FreeBSD, IA64, and Alpha.
+ Based on work by Petr Salinger <Petr.Salinger@seznam.cz>,
+ and Colin Watson <cjwatson@ubuntu.com>.
+
+ * wtf/Platform.h:
+
+2009-12-18 Yongjun Zhang <yongjun.zhang@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ https://bugs.webkit.org/show_bug.cgi?id=32713
+ [Qt] make wtf/Assertions.h compile in winscw compiler.
+
+ Add string arg before ellipsis to help winscw compiler resolve variadic
+ macro definitions in wtf/Assertions.h.
+
+ * wtf/Assertions.h:
+
2009-11-30 Jan-Arve Sæther <jan-arve.saether@nokia.com>
Reviewed by Simon Hausmann.
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h
index f529a62..aa72e5a 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h
@@ -158,8 +158,8 @@ void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChann
#define ASSERT(assertion) ((void)0)
#if COMPILER(MSVC7)
#define ASSERT_WITH_MESSAGE(assertion) ((void)0)
-#elif PLATFORM(SYMBIAN)
-#define ASSERT_WITH_MESSAGE(assertion...) ((void)0)
+#elif COMPILER(WINSCW)
+#define ASSERT_WITH_MESSAGE(assertion, arg...) ((void)0)
#else
#define ASSERT_WITH_MESSAGE(assertion, ...) ((void)0)
#endif /* COMPILER(MSVC7) */
@@ -176,8 +176,8 @@ void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChann
while (0)
#if COMPILER(MSVC7)
#define ASSERT_WITH_MESSAGE(assertion) ((void)0)
-#elif PLATFORM(SYMBIAN)
-#define ASSERT_WITH_MESSAGE(assertion...) ((void)0)
+#elif COMPILER(WINSCW)
+#define ASSERT_WITH_MESSAGE(assertion, arg...) ((void)0)
#else
#define ASSERT_WITH_MESSAGE(assertion, ...) do \
if (!(assertion)) { \
@@ -219,11 +219,11 @@ while (0)
/* FATAL */
-#if FATAL_DISABLED && !COMPILER(MSVC7) && !PLATFORM(SYMBIAN)
+#if FATAL_DISABLED && !COMPILER(MSVC7) && !COMPILER(WINSCW)
#define FATAL(...) ((void)0)
#elif COMPILER(MSVC7)
#define FATAL() ((void)0)
-#elif PLATFORM(SYMBIAN)
+#elif COMPILER(WINSCW)
#define FATAL(args...) ((void)0)
#else
#define FATAL(...) do { \
@@ -234,24 +234,24 @@ while (0)
/* LOG_ERROR */
-#if ERROR_DISABLED && !COMPILER(MSVC7) && !PLATFORM(SYMBIAN)
+#if ERROR_DISABLED && !COMPILER(MSVC7) && !COMPILER(WINSCW)
#define LOG_ERROR(...) ((void)0)
#elif COMPILER(MSVC7)
#define LOG_ERROR() ((void)0)
-#elif PLATFORM(SYMBIAN)
-#define LOG_ERROR(args...) ((void)0)
+#elif COMPILER(WINSCW)
+#define LOG_ERROR(arg...) ((void)0)
#else
#define LOG_ERROR(...) WTFReportError(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, __VA_ARGS__)
#endif
/* LOG */
-#if LOG_DISABLED && !COMPILER(MSVC7) && !PLATFORM(SYMBIAN)
+#if LOG_DISABLED && !COMPILER(MSVC7) && !COMPILER(WINSCW)
#define LOG(channel, ...) ((void)0)
#elif COMPILER(MSVC7)
#define LOG() ((void)0)
-#elif PLATFORM(SYMBIAN)
-#define LOG(channel, args...) ((void)0)
+#elif COMPILER(WINSCW)
+#define LOG(arg...) ((void)0)
#else
#define LOG(channel, ...) WTFLog(&JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, channel), __VA_ARGS__)
#define JOIN_LOG_CHANNEL_WITH_PREFIX(prefix, channel) JOIN_LOG_CHANNEL_WITH_PREFIX_LEVEL_2(prefix, channel)
@@ -260,12 +260,12 @@ while (0)
/* LOG_VERBOSE */
-#if LOG_DISABLED && !COMPILER(MSVC7) && !PLATFORM(SYMBIAN)
+#if LOG_DISABLED && !COMPILER(MSVC7) && !COMPILER(WINSCW)
#define LOG_VERBOSE(channel, ...) ((void)0)
#elif COMPILER(MSVC7)
#define LOG_VERBOSE(channel) ((void)0)
-#elif PLATFORM(SYMBIAN)
-#define LOG_VERBOSE(channel, args...) ((void)0)
+#elif COMPILER(WINSCW)
+#define LOG_VERBOSE(channel, arg...) ((void)0)
#else
#define LOG_VERBOSE(channel, ...) WTFLogVerbose(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, &JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, channel), __VA_ARGS__)
#endif
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h
index cb6c9b9..3e1093b 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h
@@ -347,6 +347,16 @@
#define WTF_PLATFORM_X86_64 1
#endif
+/* PLATFORM(IA64) */
+#if defined(__ia64__)
+#define WTF_PLATFORM_IA64 1
+#endif
+
+/* PLATFORM(ALPHA) */
+#if defined(__alpha__)
+#define WTF_PLATFORM_ALPHA 1
+#endif
+
/* PLATFORM(SH4) */
#if defined(__SH4__)
#define WTF_PLATFORM_SH4 1
@@ -709,7 +719,7 @@
#endif
#if !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32) && !defined(WTF_USE_JSVALUE32_64)
-#if PLATFORM(X86_64) && (PLATFORM(DARWIN) || PLATFORM(LINUX) || PLATFORM(WIN_OS))
+#if (PLATFORM(X86_64) && (PLATFORM(UNIX) || PLATFORM(WIN_OS))) || PLATFORM(IA64) || PLATFORM(ALPHA)
#define WTF_USE_JSVALUE64 1
#elif PLATFORM(ARM) || PLATFORM(PPC64)
#define WTF_USE_JSVALUE32 1
diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION
index 62acbdf..70913ca 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
- 9de63cde0ac8aa08e207d4ffce2846df1a44a364
+ 865abd2871c801c1d3d0f4eebd985b2daab89ebe
diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog
index 4f6146f..e72293d 100644
--- a/src/3rdparty/webkit/WebCore/ChangeLog
+++ b/src/3rdparty/webkit/WebCore/ChangeLog
@@ -1,3 +1,109 @@
+2010-01-06 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Unreviewed trivial Qt build fix.
+
+ Prefix the phonon includes with phonon/ to avoid conflicts with the S60
+ audio routing API ( http://wiki.forum.nokia.com/index.php/Audio_Routing_API ).
+
+ * platform/graphics/qt/MediaPlayerPrivatePhonon.cpp:
+
+2009-12-31 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Do not include Frame.h under WebCore/html/canvas
+ https://bugs.webkit.org/show_bug.cgi?id=33082
+
+ No new tests, as there is no new functionality.
+
+ * html/canvas/CanvasRenderingContext2D.cpp:
+
+2009-12-30 Janne Koskinen <janne.p.koskinen@digia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Add support for Symbian def files
+
+ * WebCore.pro:
+
+2009-12-30 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Unreviewed Qt/Symbian build fix.
+
+ Don't build network state notifier support when building inside of Qt.
+ Otherwise the Qt build depends on an external module that itself depends
+ on Qt again.
+
+ * WebCore.pro:
+
+2009-12-30 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Turn off DataGrid support by default.
+
+ No new tests, as there is no new functionality.
+
+ * WebCore.pro:
+
+2009-12-17 Yael Aharon <yael.aharon@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] support navigator.onLine and ononline/onoffline events.
+ https://bugs.webkit.org/show_bug.cgi?id=32555
+
+ Hooked up Bearer Management to NetworkStateNotifier. This solution is available
+ only if QtMobility's Bearer Management is installed.
+
+ * WebCore.pro:
+ * platform/network/NetworkStateNotifier.h:
+ * platform/network/qt/NetworkStateNotifierPrivate.h: Added.
+ * platform/network/qt/NetworkStateNotifierQt.cpp: Added.
+ (WebCore::NetworkStateNotifierPrivate::NetworkStateNotifierPrivate):
+ (WebCore::NetworkStateNotifierPrivate::onlineStateChanged):
+ (WebCore::NetworkStateNotifierPrivate::~NetworkStateNotifierPrivate):
+ (WebCore::NetworkStateNotifier::updateState):
+ (WebCore::NetworkStateNotifier::NetworkStateNotifier):
+
+2009-12-17 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ [Qt] Symbian build fix: Don't include QtXml/qxmlstream.h but omit the prefix, to
+ make sure we pick up the header file from QtCore. That is where the implementation
+ is compiled.
+
+ * dom/XMLTokenizer.h:
+
+2009-12-14 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Add manual test for JavaScript prompt corner case
+ https://bugs.webkit.org/show_bug.cgi?id=30914
+
+ The patch is based on the work done by Gupta Manish.
+
+ Verify behavior of the JavaScript prompt function. Currently
+ Qt is not behaving like other WebKit ports and Firefox in
+ regards to accepting the prompt but not entering a text.
+
+ * manual-tests/qt/java-script-prompt.html: Added.
+
+2009-12-21 Andreas Kling <andreas.kling@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ Fix assertion failure when dragging an SVG image.
+ https://bugs.webkit.org/show_bug.cgi?id=32511
+
+ Test: fast/images/drag-svg-as-image.html
+
+ * svg/graphics/SVGImage.cpp:
+ (WebCore::SVGImage::filenameExtension): Return "svg"
+ * svg/graphics/SVGImage.h:
+
2009-11-23 Simon Hausmann <simon.hausmann@nokia.com>
Reviewed by Kenneth Rohde Christiansen.
diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro
index 9239089..be64e3b 100644
--- a/src/3rdparty/webkit/WebCore/WebCore.pro
+++ b/src/3rdparty/webkit/WebCore/WebCore.pro
@@ -136,7 +136,7 @@ contains(DEFINES, ENABLE_SINGLE_THREADED=1) {
!contains(DEFINES, ENABLE_SHARED_WORKERS=.): DEFINES += ENABLE_SHARED_WORKERS=1
!contains(DEFINES, ENABLE_WORKERS=.): DEFINES += ENABLE_WORKERS=1
!contains(DEFINES, ENABLE_XHTMLMP=.): DEFINES += ENABLE_XHTMLMP=0
-!contains(DEFINES, ENABLE_DATAGRID=.): DEFINES += ENABLE_DATAGRID=1
+!contains(DEFINES, ENABLE_DATAGRID=.): DEFINES += ENABLE_DATAGRID=0
# SVG support
!contains(DEFINES, ENABLE_SVG=0) {
@@ -180,6 +180,15 @@ contains(DEFINES, ENABLE_SINGLE_THREADED=1) {
else:DEFINES += ENABLE_XSLT=0
}
+!CONFIG(QTDIR_build):!contains(DEFINES, ENABLE_QT_BEARER=.) {
+ symbian: {
+ exists($${EPOCROOT}epoc32/release/winscw/udeb/QtBearer.lib)| \
+ exists($${EPOCROOT}epoc32/release/armv5/lib/QtBearer.lib) {
+ DEFINES += ENABLE_QT_BEARER=1
+ }
+ }
+}
+
DEFINES += WTF_USE_JAVASCRIPTCORE_BINDINGS=1 WTF_CHANGES=1
# Used to compute defaults for the build-webkit script
@@ -2860,6 +2869,17 @@ contains(DEFINES, ENABLE_XHTMLMP=1) {
FEATURE_DEFINES_JAVASCRIPT += ENABLE_XHTMLMP=1
}
+contains(DEFINES, ENABLE_QT_BEARER=1) {
+ HEADERS += \
+ platform/network/qt/NetworkStateNotifierPrivate.h
+
+ SOURCES += \
+ platform/network/qt/NetworkStateNotifierQt.cpp
+
+ LIBS += -lQtBearer
+
+}
+
contains(DEFINES, ENABLE_SVG=1) {
FEATURE_DEFINES_JAVASCRIPT += ENABLE_SVG=1
@@ -3382,16 +3402,15 @@ CONFIG(QTDIR_build):isEqual(QT_MAJOR_VERSION, 4):greaterThan(QT_MINOR_VERSION, 4
}
}
-# Temporary workaround to pick up the DEF file from the same place as all the others
symbian {
shared {
contains(MMP_RULES, defBlock) {
MMP_RULES -= defBlock
MMP_RULES += "$${LITERAL_HASH}ifdef WINSCW" \
- "DEFFILE ../../../s60installs/bwins/$${TARGET}.def" \
+ "DEFFILE ../WebKit/qt/symbian/bwins/$${TARGET}.def" \
"$${LITERAL_HASH}elif defined EABI" \
- "DEFFILE ../../../s60installs/eabi/$${TARGET}.def" \
+ "DEFFILE ../WebKit/qt/symbian/eabi/$${TARGET}.def" \
"$${LITERAL_HASH}endif"
}
}
diff --git a/src/3rdparty/webkit/WebCore/dom/XMLTokenizer.h b/src/3rdparty/webkit/WebCore/dom/XMLTokenizer.h
index e1ee09f..a83e73a 100644
--- a/src/3rdparty/webkit/WebCore/dom/XMLTokenizer.h
+++ b/src/3rdparty/webkit/WebCore/dom/XMLTokenizer.h
@@ -34,7 +34,7 @@
#include <wtf/OwnPtr.h>
#if USE(QXMLSTREAM)
-#include <QtXml/qxmlstream.h>
+#include <qxmlstream.h>
#else
#include <libxml/tree.h>
#include <libxml/xmlstring.h>
diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp
index 3341901..848771b 100644
--- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp
+++ b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp
@@ -42,7 +42,6 @@
#include "Document.h"
#include "ExceptionCode.h"
#include "FloatConversion.h"
-#include "Frame.h"
#include "GraphicsContext.h"
#include "HTMLCanvasElement.h"
#include "HTMLImageElement.h"
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp
index 9faa234..7a78391 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp
@@ -38,12 +38,10 @@
#include <QUrl>
#include <QEvent>
-#if defined (__SYMBIAN32__)
#include <phonon/path.h>
-#endif
-#include <audiooutput.h>
-#include <mediaobject.h>
-#include <videowidget.h>
+#include <phonon/audiooutput.h>
+#include <phonon/mediaobject.h>
+#include <phonon/videowidget.h>
using namespace Phonon;
diff --git a/src/3rdparty/webkit/WebCore/platform/network/NetworkStateNotifier.h b/src/3rdparty/webkit/WebCore/platform/network/NetworkStateNotifier.h
index 0189f5f..f8c5654 100644
--- a/src/3rdparty/webkit/WebCore/platform/network/NetworkStateNotifier.h
+++ b/src/3rdparty/webkit/WebCore/platform/network/NetworkStateNotifier.h
@@ -46,6 +46,10 @@ typedef const struct __SCDynamicStore * SCDynamicStoreRef;
namespace WebCore {
+#if (PLATFORM(QT) && ENABLE(QT_BEARER))
+class NetworkStateNotifierPrivate;
+#endif
+
class NetworkStateNotifier {
public:
NetworkStateNotifier();
@@ -78,10 +82,14 @@ private:
#elif PLATFORM(CHROMIUM)
NetworkStateNotifierPrivate p;
+
+#elif PLATFORM(QT) && ENABLE(QT_BEARER)
+ friend class NetworkStateNotifierPrivate;
+ NetworkStateNotifierPrivate* p;
#endif
};
-#if !PLATFORM(MAC) && !PLATFORM(WIN) && !PLATFORM(CHROMIUM)
+#if !PLATFORM(MAC) && !PLATFORM(WIN) && !PLATFORM(CHROMIUM) && !(PLATFORM(QT) && ENABLE(QT_BEARER))
inline NetworkStateNotifier::NetworkStateNotifier()
: m_isOnLine(true)
diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/NetworkStateNotifierPrivate.h b/src/3rdparty/webkit/WebCore/platform/network/qt/NetworkStateNotifierPrivate.h
new file mode 100644
index 0000000..7af6392
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/platform/network/qt/NetworkStateNotifierPrivate.h
@@ -0,0 +1,49 @@
+/*
+ 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.
+*/
+
+#ifndef NetworkStateNotifierPrivate_h
+#define NetworkStateNotifierPrivate_h
+
+#include <QObject>
+
+namespace QtMobility {
+class QNetworkConfigurationManager;
+}
+
+namespace WebCore {
+
+class NetworkStateNotifier;
+
+class NetworkStateNotifierPrivate : public QObject {
+ Q_OBJECT
+public:
+ NetworkStateNotifierPrivate(NetworkStateNotifier* notifier);
+ ~NetworkStateNotifierPrivate();
+public slots:
+ void onlineStateChanged(bool);
+
+public:
+ QtMobility::QNetworkConfigurationManager* m_configurationManager;
+ bool m_online;
+ NetworkStateNotifier* m_notifier;
+};
+
+} // namespace WebCore
+
+#endif
diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/NetworkStateNotifierQt.cpp b/src/3rdparty/webkit/WebCore/platform/network/qt/NetworkStateNotifierQt.cpp
new file mode 100644
index 0000000..f74398b
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/platform/network/qt/NetworkStateNotifierQt.cpp
@@ -0,0 +1,73 @@
+/*
+ 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 "config.h"
+#include "NetworkStateNotifier.h"
+
+#include "NetworkStateNotifierPrivate.h"
+#include "qnetworkconfigmanager.h"
+
+using namespace QtMobility;
+
+namespace WebCore {
+
+NetworkStateNotifierPrivate::NetworkStateNotifierPrivate(NetworkStateNotifier* notifier)
+ : m_configurationManager(new QNetworkConfigurationManager())
+ , m_online(m_configurationManager->isOnline())
+ , m_notifier(notifier)
+{
+ Q_ASSERT(notifier);
+ connect(m_configurationManager, SIGNAL(onlineStateChanged(bool)), this, SLOT(onlineStateChanged(bool)));
+}
+
+void NetworkStateNotifierPrivate::onlineStateChanged(bool isOnline)
+{
+ if (m_online == isOnline)
+ return;
+
+ m_online = isOnline;
+ m_notifier->updateState();
+}
+
+NetworkStateNotifierPrivate::~NetworkStateNotifierPrivate()
+{
+ delete m_configurationManager;
+}
+
+void NetworkStateNotifier::updateState()
+{
+ if (m_isOnLine == p->m_online)
+ return;
+
+ m_isOnLine = p->m_online;
+ if (m_networkStateChangedFunction)
+ m_networkStateChangedFunction();
+}
+
+NetworkStateNotifier::NetworkStateNotifier()
+ : m_isOnLine(true)
+ , m_networkStateChangedFunction(0)
+{
+ p = new NetworkStateNotifierPrivate(this);
+ m_isOnLine = p->m_online;
+}
+
+} // namespace WebCore
+
+#include "moc_NetworkStateNotifierPrivate.cpp"
diff --git a/src/3rdparty/webkit/WebCore/svg/graphics/SVGImage.cpp b/src/3rdparty/webkit/WebCore/svg/graphics/SVGImage.cpp
index 0a506f8..b74e912 100644
--- a/src/3rdparty/webkit/WebCore/svg/graphics/SVGImage.cpp
+++ b/src/3rdparty/webkit/WebCore/svg/graphics/SVGImage.cpp
@@ -267,6 +267,11 @@ bool SVGImage::dataChanged(bool allDataReceived)
return m_page;
}
+String SVGImage::filenameExtension() const
+{
+ return "svg";
+}
+
}
#endif // ENABLE(SVG)
diff --git a/src/3rdparty/webkit/WebCore/svg/graphics/SVGImage.h b/src/3rdparty/webkit/WebCore/svg/graphics/SVGImage.h
index 2cea91a..0f05429 100644
--- a/src/3rdparty/webkit/WebCore/svg/graphics/SVGImage.h
+++ b/src/3rdparty/webkit/WebCore/svg/graphics/SVGImage.h
@@ -47,6 +47,8 @@ namespace WebCore {
private:
virtual ~SVGImage();
+ virtual String filenameExtension() const;
+
virtual void setContainerSize(const IntSize&);
virtual bool usesContainerSize() const;
virtual bool hasRelativeWidth() const;
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp
index f43cbbf..1145744 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp
@@ -139,6 +139,9 @@ QSize QWebInspector::sizeHint() const
/*! \reimp */
bool QWebInspector::event(QEvent* ev)
{
+ if (ev->type() == QEvent::Close && d->page)
+ d->page->d->inspectorController()->setWindowVisible(false);
+
return QWidget::event(ev);
}
@@ -159,8 +162,6 @@ void QWebInspector::showEvent(QShowEvent* event)
/*! \reimp */
void QWebInspector::hideEvent(QHideEvent* event)
{
- if (d->page)
- d->page->d->inspectorController()->setWindowVisible(false);
}
/*! \internal */
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
index 1bdc3ed..6d08c32 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
@@ -1849,7 +1849,8 @@ bool QWebPage::javaScriptConfirm(QWebFrame *frame, const QString& msg)
The program may provide an optional message, \a msg, as well as a default value for the input in \a defaultValue.
If the prompt was cancelled by the user the implementation should return false; otherwise the
- result should be written to \a result and true should be returned.
+ result should be written to \a result and true should be returned. If the prompt was not cancelled by the
+ user, the implementation should return true and the result string must not be null.
The default implementation uses QInputDialog::getText.
*/
@@ -3080,7 +3081,7 @@ QString QWebPage::userAgentForUrl(const QUrl& url) const
Q_UNUSED(url)
QString ua = QLatin1String("Mozilla/5.0 ("
- // Plastform
+ // Platform
#ifdef Q_WS_MAC
"Macintosh"
#elif defined Q_WS_QWS
@@ -3089,19 +3090,22 @@ QString QWebPage::userAgentForUrl(const QUrl& url) const
"Windows"
#elif defined Q_WS_X11
"X11"
+#elif defined Q_OS_SYMBIAN
+ "SymbianOS"
#else
"Unknown"
#endif
- "; "
+ // Placeholder for Platform Version
+ "%1; "
// Placeholder for security strength (N or U)
- "%1; "
+ "%2; "
// Subplatform"
#ifdef Q_OS_AIX
"AIX"
#elif defined Q_OS_WIN32
- "%2"
+ "%3"
#elif defined Q_OS_DARWIN
#ifdef __i386__ || __x86_64__
"Intel Mac OS X"
@@ -3153,6 +3157,8 @@ QString QWebPage::userAgentForUrl(const QUrl& url) const
"Sun Solaris"
#elif defined Q_OS_ULTRIX
"DEC Ultrix"
+#elif defined Q_WS_S60
+ "Series60"
#elif defined Q_OS_UNIX
"UNIX BSD/SYSV system"
#elif defined Q_OS_UNIXWARE
@@ -3160,7 +3166,28 @@ QString QWebPage::userAgentForUrl(const QUrl& url) const
#else
"Unknown"
#endif
- "; ");
+ // Placeholder for SubPlatform Version
+ "%4; ");
+
+ // Platform Version
+ QString osVer;
+#ifdef Q_OS_SYMBIAN
+ QSysInfo::SymbianVersion symbianVersion = QSysInfo::symbianVersion();
+ switch (symbianVersion) {
+ case QSysInfo::SV_9_2:
+ osVer = "/9.2";
+ break;
+ case QSysInfo::SV_9_3:
+ osVer = "/9.3";
+ break;
+ case QSysInfo::SV_9_4:
+ osVer = "/9.4";
+ break;
+ default:
+ osVer = "Unknown";
+ }
+#endif
+ ua = ua.arg(osVer);
QChar securityStrength(QLatin1Char('N'));
#if !defined(QT_NO_OPENSSL)
@@ -3224,6 +3251,26 @@ QString QWebPage::userAgentForUrl(const QUrl& url) const
ua = QString(ua).arg(ver);
#endif
+ // SubPlatform Version
+ QString subPlatformVer;
+#ifdef Q_OS_SYMBIAN
+ QSysInfo::S60Version s60Version = QSysInfo::s60Version();
+ switch (s60Version) {
+ case QSysInfo::SV_S60_3_1:
+ subPlatformVer = "/3.1";
+ break;
+ case QSysInfo::SV_S60_3_2:
+ subPlatformVer = "/3.2";
+ break;
+ case QSysInfo::SV_S60_5_0:
+ subPlatformVer = "/5.0";
+ break;
+ default:
+ subPlatformVer = " Unknown";
+ }
+#endif
+ ua = ua.arg(subPlatformVer);
+
// Language
QLocale locale;
if (view())
@@ -3407,9 +3454,9 @@ quint64 QWebPage::bytesReceived() const
/*!
\fn void QWebPage::unsupportedContent(QNetworkReply *reply)
- This signals is emitted when webkit cannot handle a link the user navigated to.
+ This signal is emitted when WebKit cannot handle a link the user navigated to.
- At signal emissions time the meta data of the QNetworkReply \a reply is available.
+ At signal emission time the meta-data of the QNetworkReply \a reply is available.
\note This signal is only emitted if the forwardUnsupportedContent property is set to true.
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.h
index e9c1ec8..0f79c70 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.h
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.h
@@ -51,12 +51,7 @@ class QWEBKIT_EXPORT QWebView : public QWidget {
Q_PROPERTY(qreal textSizeMultiplier READ textSizeMultiplier WRITE setTextSizeMultiplier DESIGNABLE false)
Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor)
-// FIXME: temporary work around for elftran issue that it couldn't find the QPainter::staticMetaObject
-// symbol from Qt lib; it should be reverted after the right symbol is exported.
-// See bug: http://qt.nokia.com/developer/task-tracker/index_html?method=entry&id=258893
-#if defined(Q_QDOC) || !defined(Q_OS_SYMBIAN)
Q_PROPERTY(QPainter::RenderHints renderHints READ renderHints WRITE setRenderHints)
-#endif
Q_FLAGS(QPainter::RenderHints)
public:
explicit QWebView(QWidget* parent = 0);
diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog
index 2f0bf17..4ab5bfb 100644
--- a/src/3rdparty/webkit/WebKit/qt/ChangeLog
+++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog
@@ -1,3 +1,89 @@
+2009-12-30 Janne Koskinen <janne.p.koskinen@digia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Upstream Symbian def files from Qt 4.6.
+
+ These files define the ABI of QtWebKit on Symbian.
+
+ * symbian/bwins/QtWebKitu.def: Added.
+ * symbian/eabi/QtWebKitu.def: Added.
+
+2009-12-14 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Fix JavaScript prompt behavior for empty/null strings.
+ https://bugs.webkit.org/show_bug.cgi?id=30914
+
+ The patch is based on the work done by Gupta Manish.
+
+ In the default implementation of the JavaScript prompt
+ we are using a QInputDialog to get the text and this has
+ one quirk with regard to not entering any text.
+
+ In other WebKit ports and in Firefox an empty string is
+ returned but in the Qt case it is a null string.
+
+ Change the API documentation in QWebPage to mention we want to
+ have a non null string but do the fixup in the ChromeClientQt
+ to support existing code.
+
+ * Api/qwebpage.cpp:
+ (QWebPage::javaScriptPrompt): Change API documentation
+ * WebCoreSupport/ChromeClientQt.cpp:
+ (WebCore::ChromeClientQt::runJavaScriptPrompt): Fixup null QString
+
+2009-12-21 David Boddie <dboddie@trolltech.com>
+
+ Reviewed by Simon Hausmann.
+
+ Doc: Minor fixes to language.
+
+ * Api/qwebpage.cpp:
+
+2009-12-15 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Reviewed by NOBODY (OOPS!).
+
+ [Qt] Do not disable the inspector on show and hide
+ https://bugs.webkit.org/show_bug.cgi?id=31851
+
+ On Qt/X11 with some window managers the window will be
+ hidden when switching windows. In this case all the results
+ are gone when coming back to the window.
+
+ Attempt to use the CloseEvent to figure out if the window
+ was closed and withdrawn as this is more friendly to the
+ user of the inspector client.
+
+ * Api/qwebinspector.cpp:
+ (QWebInspector::event):
+ (QWebInspector::hideEvent):
+
+2009-12-13 Simon Hausmann <hausmann@webkit.org>
+
+ Reviewed by Holger Freyther.
+
+ [Qt] Re-enable QWebView::renderHints property for Qt for Symbian
+
+ https://bugs.webkit.org/show_bug.cgi?id=28273
+
+ The bug in Qt's moc that triggered a linking error when declaring this
+ property has been fixed and we can remove the workaround.
+
+ * Api/qwebview.h:
+
+2009-11-30 Abhinav Mithal <abhinav.mithal@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt][Symbian] Report SymbianOS in user agent string for Symbian
+ https://bugs.webkit.org/show_bug.cgi?id=31961
+
+ * Api/qwebpage.cpp:
+ (QWebPage::userAgentForUrl):
+
2009-11-28 Simon Hausmann <simon.hausmann@nokia.com>
Reviewed by Kenneth Rohde Christiansen.
diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
index 26cf6f6..c5d2792 100644
--- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
@@ -278,7 +278,14 @@ bool ChromeClientQt::runJavaScriptPrompt(Frame* f, const String& message, const
QString x = result;
FrameLoaderClientQt *fl = static_cast<FrameLoaderClientQt*>(f->loader()->client());
bool rc = m_webPage->javaScriptPrompt(fl->webFrame(), (QString)message, (QString)defaultValue, &x);
- result = x;
+
+ // Fix up a quirk in the QInputDialog class. If no input happened the string should be empty
+ // but it is null. See https://bugs.webkit.org/show_bug.cgi?id=30914.
+ if (rc && result.isNull())
+ result = String("");
+ else
+ result = x;
+
return rc;
}
diff --git a/src/s60installs/bwins/QtWebKitu.def b/src/3rdparty/webkit/WebKit/qt/symbian/bwins/QtWebKitu.def
index e5631f8..e5631f8 100644
--- a/src/s60installs/bwins/QtWebKitu.def
+++ b/src/3rdparty/webkit/WebKit/qt/symbian/bwins/QtWebKitu.def
diff --git a/src/s60installs/eabi/QtWebKitu.def b/src/3rdparty/webkit/WebKit/qt/symbian/eabi/QtWebKitu.def
index 4aad884..4aad884 100644
--- a/src/s60installs/eabi/QtWebKitu.def
+++ b/src/3rdparty/webkit/WebKit/qt/symbian/eabi/QtWebKitu.def
diff --git a/src/activeqt/container/qaxbase.cpp b/src/activeqt/container/qaxbase.cpp
index 3795f56..ed7ac29 100644
--- a/src/activeqt/container/qaxbase.cpp
+++ b/src/activeqt/container/qaxbase.cpp
@@ -909,7 +909,7 @@ QAxMetaObject *QAxBase::internalMetaObject() const
\property QAxBase::control
\brief the name of the COM object wrapped by this QAxBase object.
- Setting this property initilializes the COM object. Any COM object
+ Setting this property initializes the COM object. Any COM object
previously set is shut down.
The most efficient way to set this property is by using the
diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp
index d529f67..bc0d35e 100644
--- a/src/corelib/animation/qvariantanimation.cpp
+++ b/src/corelib/animation/qvariantanimation.cpp
@@ -373,6 +373,13 @@ QVariantAnimation::~QVariantAnimation()
Another example is QEasingCurve::InOutElastic, which provides an
elastic effect on the values of the interpolated variant.
+ QVariantAnimation will use the QEasingCurve::valueForProgress() to
+ transform the "normalized progress" (currentTime / totalDuration)
+ of the animation into the effective progress actually
+ used by the animation. It is this effective progress that will be
+ the progress when interpolated() is called. Also, the steps in the
+ keyValues are referring to this effective progress.
+
The easing curve is used with the interpolator, the interpolated()
virtual function, the animation's duration, and iterationCount, to
control how the current value changes as the animation progresses.
diff --git a/src/corelib/concurrent/qtconcurrentiteratekernel.cpp b/src/corelib/concurrent/qtconcurrentiteratekernel.cpp
index 15b8ecd..e93394f 100644
--- a/src/corelib/concurrent/qtconcurrentiteratekernel.cpp
+++ b/src/corelib/concurrent/qtconcurrentiteratekernel.cpp
@@ -46,6 +46,9 @@
#include <mach/mach_time.h>
#include <unistd.h>
#elif defined(Q_OS_UNIX)
+#if defined(Q_OS_HURD)
+#include <sys/time.h>
+#endif
#include <time.h>
#include <unistd.h>
#elif defined(Q_OS_WIN)
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 62b5409..dfe610c 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -77,6 +77,7 @@
#include <e32def.h>
#include <e32debug.h>
#include <f32file.h>
+#include <e32math.h>
# include "private/qcore_symbian_p.h"
_LIT(qt_S60Filter, "Series60v?.*.sis");
@@ -1225,7 +1226,7 @@ bool qSharedBuild()
Defined on Mac OS X.
- \sa Q_WS_WIN, Q_WS_X11, Q_WS_QWS
+ \sa Q_WS_WIN, Q_WS_X11, Q_WS_QWS, Q_WS_S60
*/
/*!
@@ -1234,7 +1235,7 @@ bool qSharedBuild()
Defined on Windows.
- \sa Q_WS_MAC, Q_WS_X11, Q_WS_QWS
+ \sa Q_WS_MAC, Q_WS_X11, Q_WS_QWS, Q_WS_S60
*/
/*!
@@ -1243,7 +1244,7 @@ bool qSharedBuild()
Defined on X11.
- \sa Q_WS_MAC, Q_WS_WIN, Q_WS_QWS
+ \sa Q_WS_MAC, Q_WS_WIN, Q_WS_QWS, Q_WS_S60
*/
/*!
@@ -1252,7 +1253,7 @@ bool qSharedBuild()
Defined on Qt for Embedded Linux.
- \sa Q_WS_MAC, Q_WS_WIN, Q_WS_X11
+ \sa Q_WS_MAC, Q_WS_WIN, Q_WS_X11, Q_WS_S60
*/
/*!
@@ -1598,6 +1599,29 @@ bool qSharedBuild()
Optimizing C++ Compilers.
*/
+/*!
+ \macro Q_OS_MAC
+ \relates <QtGlobal>
+
+ Defined on MAC OS (synonym for Darwin).
+ */
+
+/*!
+ \macro Q_OS_SYMBIAN
+ \relates <QtGlobal>
+
+ Defined on Symbian.
+ */
+
+/*!
+ \macro Q_WS_S60
+ \relates <QtGlobal>
+
+ Defined on S60.
+
+ \sa Q_WS_MAC, Q_WS_WIN, Q_WS_X11, Q_WS_QWS
+ */
+
#if defined(QT_BUILD_QMAKE)
// needed to bootstrap qmake
static const unsigned int qt_one = 1;
@@ -2493,7 +2517,7 @@ bool qputenv(const char *varName, const QByteArray& value)
#endif
}
-#if (defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN)
+#if (defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD)
# if defined(Q_OS_INTEGRITY) && defined(__GHS_VERSION_NUMBER) && (__GHS_VERSION_NUMBER < 500)
// older versions of INTEGRITY used a long instead of a uint for the seed.
@@ -2516,8 +2540,6 @@ Q_GLOBAL_STATIC(SeedStorage, randTLS) // Thread Local Storage for seed value
Sets the argument \a seed to be used to generate a new random number sequence of
pseudo random integers to be returned by qrand().
- If no seed value is provided, qrand() is automatically seeded with a value of 1.
-
The sequence of random numbers generated is deterministic per thread. For example,
if two threads call qsrand(1) and subsequently calls qrand(), the threads will get
the same random number sequence.
@@ -2541,8 +2563,9 @@ void qsrand(uint seed)
srand(seed);
}
#else
- // On Windows srand() and rand() already use Thread-Local-Storage
+ // On Windows and Symbian srand() and rand() already use Thread-Local-Storage
// to store the seed between calls
+ // this is also valid for QT_NO_THREAD
srand(seed);
#endif
}
@@ -2558,7 +2581,7 @@ void qsrand(uint seed)
*/
void qsrand()
{
-#if (defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN)
+#if (defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD)
SeedStorage *seedStorage = randTLS();
if (seedStorage) {
SeedStorageType *pseed = seedStorage->localData();
@@ -2572,24 +2595,28 @@ void qsrand()
*pseed = QDateTime::currentDateTime().toTime_t()
+ quintptr(&pseed)
+ serial.fetchAndAddRelaxed(1);
-#if defined(Q_OS_WIN)
- // for Windows the srand function must still be called.
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+ // for Windows and Symbian the srand function must still be called.
srand(*pseed);
#endif
}
-#elif defined(Q_OS_WIN)
+//QT_NO_THREAD implementations
+#else
static unsigned int seed = 0;
if (seed)
return;
+#if defined(Q_OS_SYMBIAN)
+ seed = Math::Random();
+#elif defined(Q_OS_WIN)
seed = GetTickCount();
- srand(seed);
#else
- // Symbian?
-
-#endif // defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN)
+ seed = quintptr(&seed) + QDateTime::currentDateTime().toTime_t();
+#endif
+ srand(seed);
+#endif // defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD)
}
/*!
@@ -2626,8 +2653,9 @@ int qrand()
return rand();
}
#else
- // On Windows srand() and rand() already use Thread-Local-Storage
+ // On Windows and Symbian srand() and rand() already use Thread-Local-Storage
// to store the seed between calls
+ // this is also valid for QT_NO_THREAD
return rand();
#endif
}
diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h
index ff8c6c8..c1c7812 100644
--- a/src/corelib/io/qdebug.h
+++ b/src/corelib/io/qdebug.h
@@ -93,7 +93,7 @@ public:
inline QDebug &maybeSpace() { if (stream->space) stream->ts << ' '; return *this; }
inline QDebug &operator<<(QChar t) { stream->ts << '\'' << t << '\''; return maybeSpace(); }
- inline QDebug &operator<<(QBool t) { stream->ts << (bool(t) ? "true" : "false"); return maybeSpace(); }
+ inline QDebug &operator<<(QBool t) { stream->ts << (bool(t != 0) ? "true" : "false"); return maybeSpace(); }
inline QDebug &operator<<(bool t) { stream->ts << (t ? "true" : "false"); return maybeSpace(); }
inline QDebug &operator<<(char t) { stream->ts << t; return maybeSpace(); }
inline QDebug &operator<<(signed short t) { stream->ts << t; return maybeSpace(); }
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index 59db9a6..bac508a 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -1125,10 +1125,11 @@ QDir::Filters QDir::filter() const
execute access. The Executable value needs to be
combined with Dirs or Files.
\value Modified Only list files that have been modified (ignored
- under Unix).
- \value Hidden List hidden files (on Unix, files starting with a .).
+ on Unix).
+ \value Hidden List hidden files (on Unix, files starting with a ".").
\value System List system files (on Unix, FIFOs, sockets and
- device files)
+ device files are included; on Windows, \c {.lnk}
+ files are included)
\value CaseSensitive The filter should be case sensitive.
\omitvalue DefaultFilter
diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp
index 61081a1..0a435b9 100644
--- a/src/corelib/io/qfileinfo.cpp
+++ b/src/corelib/io/qfileinfo.cpp
@@ -573,6 +573,8 @@ QString QFileInfo::canonicalFilePath() const
QString QFileInfo::absolutePath() const
{
Q_D(const QFileInfo);
+ if (d->data->fileName.isEmpty())
+ qWarning("QFileInfo::absolutePath: Constructed with empty filename");
if(!d->data->fileEngine)
return QLatin1String("");
return d->getFileName(QAbstractFileEngine::AbsolutePathName);
diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp
index e4c4e3f..c064d5a 100644
--- a/src/corelib/io/qfsfileengine.cpp
+++ b/src/corelib/io/qfsfileengine.cpp
@@ -144,7 +144,7 @@ QString QFSFileEnginePrivate::canonicalized(const QString &path)
return path;
#endif
// Mac OS X 10.5.x doesn't support the realpath(X,0) extenstion we use here.
-#if defined(Q_OS_LINIX) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_LINUX) || defined(Q_OS_SYMBIAN)
char *ret = realpath(path.toLocal8Bit().constData(), (char*)0);
if (ret) {
QString canonicalPath = QDir::cleanPath(QString::fromLocal8Bit(ret));
diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp
index 71414ce..ea262bf 100644
--- a/src/corelib/io/qfsfileengine_unix.cpp
+++ b/src/corelib/io/qfsfileengine_unix.cpp
@@ -825,10 +825,9 @@ QAbstractFileEngine::FileFlags QFSFileEngine::fileFlags(FileFlags type) const
ret |= RootFlag;
} else {
QString baseName = fileName(BaseName);
- if ((baseName.size() > 1
- && baseName.at(0) == QLatin1Char('.') && baseName.at(1) != QLatin1Char('.'))
+ if ((baseName.size() > 0 && baseName.at(0) == QLatin1Char('.'))
# if !defined(QWS) && defined(Q_OS_MAC)
- || _q_isMacHidden(d->filePath)
+ || _q_isMacHidden(d->filePath)
# endif
) {
ret |= HiddenFlag;
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index a6cb5a9..a7719a8 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -1595,13 +1595,10 @@ QAbstractFileEngine::FileFlags QFSFileEngine::fileFlags(QAbstractFileEngine::Fil
ret |= LocalDiskFlag;
if (d->doStat()) {
ret |= ExistsFlag;
- if (d->filePath == QLatin1String("/") || isDriveRoot(d->filePath) || isUncRoot(d->filePath)) {
+ if (d->filePath == QLatin1String("/") || isDriveRoot(d->filePath) || isUncRoot(d->filePath))
ret |= RootFlag;
- } else if (d->fileAttrib & FILE_ATTRIBUTE_HIDDEN) {
- QString baseName = fileName(BaseName);
- if (baseName != QLatin1String(".") && baseName != QLatin1String(".."))
- ret |= HiddenFlag;
- }
+ else if (d->fileAttrib & FILE_ATTRIBUTE_HIDDEN)
+ ret |= HiddenFlag;
}
}
return ret;
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index 0e5a2de..8dcccb4 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -965,7 +965,15 @@ QByteArray QIODevice::readAll()
QByteArray result;
qint64 readBytes = 0;
- if (d->isSequential() || (readBytes = size()) == 0) {
+
+ // flush internal read buffer
+ if (!(d->openMode & Text) && !d->buffer.isEmpty()) {
+ result = d->buffer.readAll();
+ readBytes = result.size();
+ }
+
+ qint64 theSize;
+ if (d->isSequential() || (theSize = size()) == 0) {
// Size is unknown, read incrementally.
qint64 readResult;
do {
@@ -977,7 +985,7 @@ QByteArray QIODevice::readAll()
} else {
// Read it all in one go.
// If resize fails, don't read anything.
- result.resize(int(readBytes - d->pos));
+ result.resize(int(theSize - d->pos));
readBytes = read(result.data(), result.size());
}
diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp
index 5c543d4..a061ad1 100644
--- a/src/corelib/io/qresource.cpp
+++ b/src/corelib/io/qresource.cpp
@@ -273,7 +273,7 @@ QResourcePrivate::load(const QString &file)
QString cleaned = cleanPath(file);
for(int i = 0; i < list->size(); ++i) {
QResourceRoot *res = list->at(i);
- const int node = res->findNode(cleaned);
+ const int node = res->findNode(cleaned, locale);
if(node != -1) {
if(related.isEmpty()) {
container = res->isContainer(node);
diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp
index 594718e..47f340c 100644
--- a/src/corelib/io/qtextstream.cpp
+++ b/src/corelib/io/qtextstream.cpp
@@ -440,7 +440,7 @@ QTextStreamPrivate::QTextStreamPrivate(QTextStream *q_ptr)
readConverterSavedState(0),
#endif
readConverterSavedStateOffset(0),
- locale(QLocale::C)
+ locale(QLocale::c())
{
this->q_ptr = q_ptr;
reset();
@@ -1806,8 +1806,7 @@ QTextStreamPrivate::NumberParsingStatus QTextStreamPrivate::getNumber(qulonglong
if (ch.isDigit()) {
val *= 10;
val += ch.digitValue();
- } else if (locale.language() != QLocale::C
- && ch == locale.groupSeparator()) {
+ } else if (locale != QLocale::c() && ch == locale.groupSeparator()) {
continue;
} else {
ungetChar(ch);
@@ -1958,7 +1957,7 @@ bool QTextStreamPrivate::getReal(double *f)
else if (lc == locale.negativeSign().toLower()
|| lc == locale.positiveSign().toLower())
input = InputSign;
- else if (locale.language() != QLocale::C // backward-compatibility
+ else if (locale != QLocale::c() // backward-compatibility
&& lc == locale.groupSeparator().toLower())
input = InputDigit; // well, it isn't a digit, but no one cares.
else
@@ -2283,7 +2282,7 @@ bool QTextStreamPrivate::putNumber(qulonglong number, bool negative)
// add thousands group separators. For backward compatibility we
// don't add a group separator for C locale.
- if (locale.language() != QLocale::C)
+ if (locale != QLocale::c())
flags |= QLocalePrivate::ThousandsGroup;
const QLocalePrivate *dd = locale.d();
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index fd51bcf..6ac6468 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -3864,14 +3864,18 @@ QByteArray QUrlPrivate::toEncoded(QUrl::FormattingOptions options) const
url += "//";
if ((options & QUrl::RemoveUserInfo) != QUrl::RemoveUserInfo) {
+ bool hasUserOrPass = false;
if (!userName.isEmpty()) {
url += encodedUserName;
- if (!(options & QUrl::RemovePassword) && !password.isEmpty()) {
- url += ':';
- url += encodedPassword;
- }
- url += '@';
+ hasUserOrPass = true;
}
+ if (!(options & QUrl::RemovePassword) && !password.isEmpty()) {
+ url += ':';
+ url += encodedPassword;
+ hasUserOrPass = true;
+ }
+ if (hasUserOrPass)
+ url += '@';
}
if (host.startsWith(QLatin1Char('['))) {
diff --git a/src/corelib/kernel/qeventdispatcher_glib.cpp b/src/corelib/kernel/qeventdispatcher_glib.cpp
index 665b73e..16871c3 100644
--- a/src/corelib/kernel/qeventdispatcher_glib.cpp
+++ b/src/corelib/kernel/qeventdispatcher_glib.cpp
@@ -341,6 +341,11 @@ QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(GMainContext *context)
g_source_attach(&idleTimerSource->source, mainContext);
}
+void QEventDispatcherGlibPrivate::runTimersOnceWithNormalPriority()
+{
+ timerSource->runWithIdlePriority = false;
+}
+
QEventDispatcherGlib::QEventDispatcherGlib(QObject *parent)
: QAbstractEventDispatcher(*(new QEventDispatcherGlibPrivate), parent)
{
diff --git a/src/corelib/kernel/qeventdispatcher_glib_p.h b/src/corelib/kernel/qeventdispatcher_glib_p.h
index 6a4e726..57cbf94 100644
--- a/src/corelib/kernel/qeventdispatcher_glib_p.h
+++ b/src/corelib/kernel/qeventdispatcher_glib_p.h
@@ -110,6 +110,8 @@ public:
GSocketNotifierSource *socketNotifierSource;
GTimerSource *timerSource;
GIdleTimerSource *idleTimerSource;
+
+ void runTimersOnceWithNormalPriority();
};
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qmath.h b/src/corelib/kernel/qmath.h
index 820f424..16e6bb7 100644
--- a/src/corelib/kernel/qmath.h
+++ b/src/corelib/kernel/qmath.h
@@ -46,6 +46,10 @@
#include <QtCore/qglobal.h>
+#ifdef Q_OS_SYMBIAN
+# include <e32math.h>
+#endif
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@@ -88,82 +92,130 @@ inline qreal qFabs(qreal v)
inline qreal qSin(qreal v)
{
-#ifdef QT_USE_MATH_H_FLOATS
- if (sizeof(qreal) == sizeof(float))
- return sinf(float(v));
- else
+#ifdef Q_OS_SYMBIAN
+ TReal sin_v;
+ Math::Sin(sin_v, static_cast<TReal>(v));
+ return static_cast<qreal>(sin_v);
+#else
+# ifdef QT_USE_MATH_H_FLOATS
+ if (sizeof(qreal) == sizeof(float))
+ return sinf(float(v));
+ else
+# endif
+ return sin(v);
#endif
- return sin(v);
}
inline qreal qCos(qreal v)
{
-#ifdef QT_USE_MATH_H_FLOATS
- if (sizeof(qreal) == sizeof(float))
- return cosf(float(v));
- else
+#ifdef Q_OS_SYMBIAN
+ TReal cos_v;
+ Math::Cos(cos_v, static_cast<TReal>(v));
+ return static_cast<qreal>(cos_v);
+#else
+# ifdef QT_USE_MATH_H_FLOATS
+ if (sizeof(qreal) == sizeof(float))
+ return cosf(float(v));
+ else
+# endif
+ return cos(v);
#endif
- return cos(v);
}
inline qreal qTan(qreal v)
{
-#ifdef QT_USE_MATH_H_FLOATS
- if (sizeof(qreal) == sizeof(float))
- return tanf(float(v));
- else
+#ifdef Q_OS_SYMBIAN
+ TReal tan_v;
+ Math::Tan(tan_v, static_cast<TReal>(v));
+ return static_cast<qreal>(tan_v);
+#else
+# ifdef QT_USE_MATH_H_FLOATS
+ if (sizeof(qreal) == sizeof(float))
+ return tanf(float(v));
+ else
+# endif
+ return tan(v);
#endif
- return tan(v);
}
inline qreal qAcos(qreal v)
{
-#ifdef QT_USE_MATH_H_FLOATS
- if (sizeof(qreal) == sizeof(float))
- return acosf(float(v));
- else
+#ifdef Q_OS_SYMBIAN
+ TReal acos_v;
+ Math::ACos(acos_v, static_cast<TReal>(v));
+ return static_cast<qreal>(acos_v);
+#else
+# ifdef QT_USE_MATH_H_FLOATS
+ if (sizeof(qreal) == sizeof(float))
+ return acosf(float(v));
+ else
+# endif
+ return acos(v);
#endif
- return acos(v);
}
inline qreal qAsin(qreal v)
{
-#ifdef QT_USE_MATH_H_FLOATS
- if (sizeof(qreal) == sizeof(float))
- return asinf(float(v));
- else
+#ifdef Q_OS_SYMBIAN
+ TReal asin_v;
+ Math::ASin(asin_v, static_cast<TReal>(v));
+ return static_cast<qreal>(asin_v);
+#else
+# ifdef QT_USE_MATH_H_FLOATS
+ if (sizeof(qreal) == sizeof(float))
+ return asinf(float(v));
+ else
+# endif
+ return asin(v);
#endif
- return asin(v);
}
inline qreal qAtan(qreal v)
{
-#ifdef QT_USE_MATH_H_FLOATS
- if(sizeof(qreal) == sizeof(float))
- return atanf(float(v));
- else
+#ifdef Q_OS_SYMBIAN
+ TReal atan_v;
+ Math::ATan(atan_v, static_cast<TReal>(v));
+ return static_cast<qreal>(atan_v);
+#else
+# ifdef QT_USE_MATH_H_FLOATS
+ if(sizeof(qreal) == sizeof(float))
+ return atanf(float(v));
+ else
+# endif
+ return atan(v);
#endif
- return atan(v);
}
inline qreal qAtan2(qreal x, qreal y)
{
-#ifdef QT_USE_MATH_H_FLOATS
- if(sizeof(qreal) == sizeof(float))
- return atan2f(float(x), float(y));
- else
+#ifdef Q_OS_SYMBIAN
+ TReal atan2_v;
+ Math::ATan(atan2_v, static_cast<TReal>(x), static_cast<TReal>(y));
+ return static_cast<qreal>(atan2_v);
+#else
+# ifdef QT_USE_MATH_H_FLOATS
+ if(sizeof(qreal) == sizeof(float))
+ return atan2f(float(x), float(y));
+ else
+# endif
+ return atan2(x, y);
#endif
- return atan2(x, y);
}
inline qreal qSqrt(qreal v)
{
-#ifdef QT_USE_MATH_H_FLOATS
- if (sizeof(qreal) == sizeof(float))
- return sqrtf(float(v));
- else
+#ifdef Q_OS_SYMBIAN
+ TReal sqrt_v;
+ Math::Sqrt(sqrt_v, static_cast<TReal>(v));
+ return static_cast<qreal>(sqrt_v);
+#else
+# ifdef QT_USE_MATH_H_FLOATS
+ if (sizeof(qreal) == sizeof(float))
+ return sqrtf(float(v));
+ else
+# endif
+ return sqrt(v);
#endif
- return sqrt(v);
}
inline qreal qLn(qreal v)
@@ -178,19 +230,31 @@ inline qreal qLn(qreal v)
inline qreal qExp(qreal v)
{
+#ifdef Q_OS_SYMBIAN
+ TReal exp_v;
+ Math::Exp(exp_v, static_cast<TReal>(v));
+ return static_cast<qreal>(exp_v);
+#else
// only one signature
// exists, exp(double)
return exp(v);
+#endif
}
inline qreal qPow(qreal x, qreal y)
{
-#ifdef QT_USE_MATH_H_FLOATS
- if (sizeof(qreal) == sizeof(float))
- return powf(float(x), float(y));
- else
+#ifdef Q_OS_SYMBIAN
+ TReal pow_v;
+ Math::Pow(pow_v, static_cast<TReal>(x), static_cast<TReal>(y));
+ return static_cast<qreal>(pow_v);
+#else
+# ifdef QT_USE_MATH_H_FLOATS
+ if (sizeof(qreal) == sizeof(float))
+ return powf(float(x), float(y));
+ else
+# endif
+ return pow(x, y);
#endif
- return pow(x, y);
}
#ifndef M_PI
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index 6e6da19..72d6786 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -2648,6 +2648,7 @@ const char* QMetaClassInfo::value() const
*/
int QMetaObjectPrivate::originalClone(const QMetaObject *mobj, int local_method_index)
{
+ Q_ASSERT(local_method_index < get(mobj)->methodCount);
int handle = get(mobj)->methodData + 5 * local_method_index;
while (mobj->d.data[handle + 4] & MethodCloned) {
Q_ASSERT(local_method_index > 0);
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 30cd011..305ec4f 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -145,7 +145,7 @@ QObjectPrivate::QObjectPrivate(int version)
receiveChildEvents = true;
postedEvents = 0;
extraData = 0;
- connectedSignals = 0;
+ connectedSignals[0] = connectedSignals[1] = 0;
inEventHandler = false;
inThreadChangeEvent = false;
deleteWatch = 0;
@@ -578,12 +578,13 @@ int QMetaCallEvent::placeMetaCall(QObject *object)
protected functions connectNotify() and disconnectNotify() make
it possible to track connections.
- QObjects organize themselves in object trees. When you create a
- QObject with another object as parent, the object will
- automatically add itself to the parent's children() list. The
- parent takes ownership of the object; i.e., it will automatically
- delete its children in its destructor. You can look for an object
- by name and optionally type using findChild() or findChildren().
+ QObjects organize themselves in \l {Object Trees and Object
+ Ownership} {object trees}. When you create a QObject with another
+ object as parent, the object will automatically add itself to the
+ parent's children() list. The parent takes ownership of the
+ object; i.e., it will automatically delete its children in its
+ destructor. You can look for an object by name and optionally type
+ using findChild() or findChildren().
Every object has an objectName() and its class name can be found
via the corresponding metaObject() (see QMetaObject::className()).
@@ -682,7 +683,7 @@ int QMetaCallEvent::placeMetaCall(QObject *object)
\l{Writing Source Code for Translation} document.
\sa QMetaObject, QPointer, QObjectCleanupHandler, Q_DISABLE_COPY()
- {Object Trees and Object Ownership}
+ \sa {Object Trees and Object Ownership}
*/
/*!
@@ -2850,6 +2851,27 @@ void QObject::disconnectNotify(const char *)
{
}
+/* \internal
+ convert a signal index from the method range to the signal range
+ */
+static int methodIndexToSignalIndex(const QMetaObject *metaObject, int signal_index)
+{
+ if (signal_index < 0)
+ return signal_index;
+ while (metaObject && metaObject->methodOffset() > signal_index)
+ metaObject = metaObject->superClass();
+
+ if (metaObject) {
+ int signalOffset, methodOffset;
+ computeOffsets(metaObject, &signalOffset, &methodOffset);
+ if (signal_index < metaObject->methodCount())
+ signal_index = QMetaObjectPrivate::originalClone(metaObject, signal_index - methodOffset) + signalOffset;
+ else
+ signal_index = signal_index - methodOffset + signalOffset;
+ }
+ return signal_index;
+}
+
/*!\internal
\a types is a 0-terminated vector of meta types for queued
connections.
@@ -2860,16 +2882,7 @@ void QObject::disconnectNotify(const char *)
bool QMetaObject::connect(const QObject *sender, int signal_index,
const QObject *receiver, int method_index, int type, int *types)
{
- if (signal_index > 0) {
- const QMetaObject *mo = sender->metaObject();
- while (mo && mo->methodOffset() > signal_index)
- mo = mo->superClass();
- if (mo) {
- int signalOffset, methodOffset;
- computeOffsets(mo, &signalOffset, &methodOffset);
- signal_index = QMetaObjectPrivate::originalClone(mo, signal_index - methodOffset) + signalOffset;
- }
- }
+ signal_index = methodIndexToSignalIndex(sender->metaObject(), signal_index);
return QMetaObjectPrivate::connect(sender, signal_index,
receiver, method_index, type, types);
}
@@ -2924,9 +2937,9 @@ bool QMetaObjectPrivate::connect(const QObject *sender, int signal_index,
QObjectPrivate *const sender_d = QObjectPrivate::get(s);
if (signal_index < 0) {
- sender_d->connectedSignals = ~ulong(0);
+ sender_d->connectedSignals[0] = sender_d->connectedSignals[1] = ~0;
} else if (signal_index < (int)sizeof(sender_d->connectedSignals) * 8) {
- sender_d->connectedSignals |= ulong(1) << signal_index;
+ sender_d->connectedSignals[signal_index >> 5] |= (1 << (signal_index & 0x1f));
}
return true;
@@ -2938,16 +2951,7 @@ bool QMetaObjectPrivate::connect(const QObject *sender, int signal_index,
bool QMetaObject::disconnect(const QObject *sender, int signal_index,
const QObject *receiver, int method_index)
{
- if (signal_index > 0) {
- const QMetaObject *mo = sender->metaObject();
- while (mo && mo->methodOffset() > signal_index)
- mo = mo->superClass();
- if (mo) {
- int signalOffset, methodOffset;
- computeOffsets(mo, &signalOffset, &methodOffset);
- signal_index = QMetaObjectPrivate::originalClone(mo, signal_index - methodOffset) + signalOffset;
- }
- }
+ signal_index = methodIndexToSignalIndex(sender->metaObject(), signal_index);
return QMetaObjectPrivate::disconnect(sender, signal_index,
receiver, method_index);
}
diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h
index f899c78..d1841be 100644
--- a/src/corelib/kernel/qobject_p.h
+++ b/src/corelib/kernel/qobject_p.h
@@ -172,7 +172,7 @@ public:
}
int signalIndex(const char *signalName) const;
- inline bool isSignalConnected(int signalIdx) const;
+ inline bool isSignalConnected(uint signalIdx) const;
public:
QString objectName;
@@ -183,7 +183,7 @@ public:
Connection *senders; // linked list of connections connected to this object
Sender *currentSender; // object currently activating the object
- mutable ulong connectedSignals;
+ mutable quint32 connectedSignals[2];
#ifdef QT3_SUPPORT
QList<QObject *> pendingChildInsertedEvents;
@@ -205,6 +205,7 @@ public:
int *deleteWatch;
};
+
/*! \internal
Returns true if the signal with index \a signal_index from object \a sender is connected.
@@ -213,12 +214,12 @@ public:
\a signal_index must be the index returned by QObjectPrivate::signalIndex;
*/
-inline bool QObjectPrivate::isSignalConnected(int signal_index) const
+inline bool QObjectPrivate::isSignalConnected(uint signal_index) const
{
- return signal_index >= (int)sizeof(connectedSignals) * 8
+ return signal_index >= sizeof(connectedSignals) * 8
|| qt_signal_spy_callback_set.signal_begin_callback
|| qt_signal_spy_callback_set.signal_end_callback
- || (connectedSignals & (ulong(1) << signal_index));
+ || (connectedSignals[signal_index >> 5] & (1 << (signal_index & 0x1f)));
}
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index 3c10788..74ff17f 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -458,7 +458,7 @@ inline void qVariantSetValue(QVariant &v, const T &t)
//if possible we reuse the current QVariant private
const uint type = qMetaTypeId<T>(reinterpret_cast<T *>(0));
QVariant::Private &d = v.data_ptr();
- if (v.isDetached() && (type <= uint(QVariant::Char) || type == d.type)) {
+ if (v.isDetached() && (type == d.type || (type <= uint(QVariant::Char) && d.type <= uint(QVariant::Char)))) {
d.type = type;
d.is_null = false;
T *old = reinterpret_cast<T*>(d.is_shared ? d.data.shared->ptr : &d.data.ptr);
diff --git a/src/corelib/statemachine/qsignaltransition.cpp b/src/corelib/statemachine/qsignaltransition.cpp
index f55f634..d35c12e 100644
--- a/src/corelib/statemachine/qsignaltransition.cpp
+++ b/src/corelib/statemachine/qsignaltransition.cpp
@@ -76,7 +76,7 @@ QT_BEGIN_NAMESPACE
CheckedTransition(QCheckBox *check)
: QSignalTransition(check, SIGNAL(stateChanged(int))) {}
protected:
- bool eventTest(QEvent *e) const {
+ bool eventTest(QEvent *e) {
if (!QSignalTransition::eventTest(e))
return false;
QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(e);
diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h
index af68434..3db308f 100644
--- a/src/corelib/thread/qthread_p.h
+++ b/src/corelib/thread/qthread_p.h
@@ -202,7 +202,7 @@ public:
QStack<QEventLoop *> eventLoops;
QPostEventList postEventList;
bool canWait;
- QMap<int, void *> tls;
+ QVector<void *> tls;
QMutex mutex;
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp
index 21b5e65..0309c67 100644
--- a/src/corelib/thread/qthread_unix.cpp
+++ b/src/corelib/thread/qthread_unix.cpp
@@ -74,6 +74,10 @@
# endif
#endif
+#ifdef Q_OS_HPUX
+#include <sys/pstat.h>
+#endif
+
#if defined(Q_OS_MAC)
# ifdef qDebug
# define old_qDebug qDebug
diff --git a/src/corelib/thread/qthreadstorage.cpp b/src/corelib/thread/qthreadstorage.cpp
index 8b1f255..a7d53d0 100644
--- a/src/corelib/thread/qthreadstorage.cpp
+++ b/src/corelib/thread/qthreadstorage.cpp
@@ -71,27 +71,32 @@ void qtsDebug(const char *fmt, ...)
# define DEBUG_MSG if(false)qDebug
#endif
-static QBasicAtomicInt idCounter = Q_BASIC_ATOMIC_INITIALIZER(INT_MAX);
Q_GLOBAL_STATIC(QMutex, mutex)
-typedef QMap<int, void (*)(void *)> DestructorMap;
+typedef QVector<void (*)(void *)> DestructorMap;
Q_GLOBAL_STATIC(DestructorMap, destructors)
QThreadStorageData::QThreadStorageData(void (*func)(void *))
- : id(idCounter.fetchAndAddRelaxed(-1))
{
QMutexLocker locker(mutex());
- destructors()->insert(id, func);
-
+ DestructorMap *destr = destructors();
+ for (id = 0; id < destr->count(); id++) {
+ if (destr->at(id) == 0)
+ break;
+ }
+ if (id == destr->count()) {
+ destr->append(func);
+ } else {
+ (*destr)[id] = func;
+ }
DEBUG_MSG("QThreadStorageData: Allocated id %d, destructor %p", id, func);
}
QThreadStorageData::~QThreadStorageData()
{
+ DEBUG_MSG("QThreadStorageData: Released id %d", id);
QMutexLocker locker(mutex());
if (destructors())
- destructors()->remove(id);
-
- DEBUG_MSG("QThreadStorageData: Released id %d", id);
+ (*destructors())[id] = 0;
}
void **QThreadStorageData::get() const
@@ -101,14 +106,17 @@ void **QThreadStorageData::get() const
qWarning("QThreadStorage::get: QThreadStorage can only be used with threads started with QThread");
return 0;
}
- QMap<int, void *>::const_iterator it = data->tls.constFind(id);
+ QVector<void *> &tls = data->tls;
+ if (tls.size() <= id)
+ tls.resize(id + 1);
+ void **v = &tls[id];
+
DEBUG_MSG("QThreadStorageData: Returning storage %d, data %p, for thread %p",
id,
- it != data->tls.end() ? it.value() : 0,
+ *v,
data->thread);
- // const_cast below is a bit evil - but we have to make sure not to detach here
- // otherwise we'll go bonkers in oom situations
- return it != data->tls.constEnd() && it.value() != 0 ? const_cast<void **>(&it.value()) : 0;
+
+ return *v ? v : 0;
}
void **QThreadStorageData::set(void *p)
@@ -118,51 +126,46 @@ void **QThreadStorageData::set(void *p)
qWarning("QThreadStorage::set: QThreadStorage can only be used with threads started with QThread");
return 0;
}
+ QVector<void *> &tls = data->tls;
+ if (tls.size() <= id)
+ tls.resize(id + 1);
+
+ void *&value = tls[id];
+ // delete any previous data
+ if (value != 0) {
+ DEBUG_MSG("QThreadStorageData: Deleting previous storage %d, data %p, for thread %p",
+ id,
+ value,
+ data->thread);
- QMap<int, void *>::iterator it = data->tls.find(id);
- if (it != data->tls.end()) {
- // delete any previous data
- if (it.value() != 0) {
- DEBUG_MSG("QThreadStorageData: Deleting previous storage %d, data %p, for thread %p",
- id,
- it.value(),
- data->thread);
-
- void *q = it.value();
- it.value() = 0;
-
- QMutexLocker locker(mutex());
- void (*destructor)(void *) = destructors()->value(id);
- locker.unlock();
+ QMutexLocker locker(mutex());
+ void (*destructor)(void *) = destructors()->value(id);
+ locker.unlock();
- destructor(q);
- }
+ void *q = value;
+ value = 0;
- // store new data
- it.value() = p;
- DEBUG_MSG("QThreadStorageData: Set storage %d for thread %p to %p", id, data->thread, p);
- } else {
- it = data->tls.insert(id, p);
- DEBUG_MSG("QThreadStorageData: Inserted storage %d, data %p, for thread %p", id, p, data->thread);
+ destructor(q);
}
- return &it.value();
+ // store new data
+ value = p;
+ DEBUG_MSG("QThreadStorageData: Set storage %d for thread %p to %p", id, data->thread, p);
+ return &value;
}
void QThreadStorageData::finish(void **p)
{
- QMap<int, void *> *tls = reinterpret_cast<QMap<int, void *> *>(p);
+ QVector<void *> *tls = reinterpret_cast<QVector<void *> *>(p);
if (!tls || tls->isEmpty() || !mutex())
return; // nothing to do
DEBUG_MSG("QThreadStorageData: Destroying storage for thread %p", QThread::currentThread());
- QMap<int, void *>::iterator it = tls->begin();
- while (it != tls->end()) {
- int id = it.key();
- void *q = it.value();
- it.value() = 0;
- ++it;
+ for(int i = tls->size() - 1; i >= 0; i--) {
+ void *&value = (*tls)[i];
+ void *q = value;
+ value = 0;
if (!q) {
// data already deleted
@@ -170,16 +173,16 @@ void QThreadStorageData::finish(void **p)
}
QMutexLocker locker(mutex());
- void (*destructor)(void *) = destructors()->value(id);
+ void (*destructor)(void *) = destructors()->value(i);
locker.unlock();
if (!destructor) {
if (QThread::currentThread())
qWarning("QThreadStorage: Thread %p exited after QThreadStorage %d destroyed",
- QThread::currentThread(), id);
+ QThread::currentThread(), i);
continue;
}
- destructor(q);
+ destructor(q); //crash here might mean the thread exited after qthreadstorage was destroyed
}
tls->clear();
}
diff --git a/src/corelib/tools/qcache.h b/src/corelib/tools/qcache.h
index 46e20b1..66f9f73 100644
--- a/src/corelib/tools/qcache.h
+++ b/src/corelib/tools/qcache.h
@@ -70,8 +70,9 @@ class QCache
if (l == &n) l = n.p;
if (f == &n) f = n.n;
total -= n.c;
- delete n.t;
+ T *obj = n.t;
hash.remove(*n.keyPtr);
+ delete obj;
}
inline T *relink(const Key &key) {
typename QHash<Key, Node>::iterator i = hash.find(key);
diff --git a/src/corelib/tools/qline.cpp b/src/corelib/tools/qline.cpp
index d0afb7a..8112757 100644
--- a/src/corelib/tools/qline.cpp
+++ b/src/corelib/tools/qline.cpp
@@ -574,7 +574,7 @@ qreal QLineF::angle() const
const qreal dx = pt2.x() - pt1.x();
const qreal dy = pt2.y() - pt1.y();
- const qreal theta = atan2(-dy, dx) * 360.0 / M_2PI;
+ const qreal theta = qAtan2(-dy, dx) * 360.0 / M_2PI;
const qreal theta_normalized = theta < 0 ? theta + 360 : theta;
@@ -814,7 +814,7 @@ qreal QLineF::angle(const QLineF &l) const
qreal cos_line = (dx()*l.dx() + dy()*l.dy()) / (length()*l.length());
qreal rad = 0;
// only accept cos_line in the range [-1,1], if it is outside, use 0 (we return 0 rather than PI for those cases)
- if (cos_line >= -1.0 && cos_line <= 1.0) rad = acos( cos_line );
+ if (cos_line >= -1.0 && cos_line <= 1.0) rad = qAcos( cos_line );
return rad * 360 / M_2PI;
}
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index 4a66b92..8645f17 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -1187,14 +1187,14 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
}
case DateFormatLong:
case DateFormatShort:
- return macToQtFormat(getMacDateFormat(type == DateFormatShort
+ return getMacDateFormat(type == DateFormatShort
? kCFDateFormatterShortStyle
- : kCFDateFormatterLongStyle));
+ : kCFDateFormatterLongStyle);
case TimeFormatLong:
case TimeFormatShort:
- return macToQtFormat(getMacTimeFormat(type == TimeFormatShort
+ return getMacTimeFormat(type == TimeFormatShort
? kCFDateFormatterShortStyle
- : kCFDateFormatterLongStyle));
+ : kCFDateFormatterLongStyle);
case DayNameLong:
case DayNameShort:
return macDayName(in.toInt(), (type == DayNameShort));
diff --git a/src/corelib/tools/qregexp.h b/src/corelib/tools/qregexp.h
index 2bad40e..8a46b98 100644
--- a/src/corelib/tools/qregexp.h
+++ b/src/corelib/tools/qregexp.h
@@ -119,7 +119,9 @@ public:
#endif
int matchedLength() const;
#ifndef QT_NO_REGEXP_CAPTURE
+#ifdef QT_DEPRECATED
QT_DEPRECATED int numCaptures() const;
+#endif
int captureCount() const;
QStringList capturedTexts() const;
QStringList capturedTexts();
diff --git a/src/dbus/qdbusabstractinterface.cpp b/src/dbus/qdbusabstractinterface.cpp
index 994da10..ff0a93e 100644
--- a/src/dbus/qdbusabstractinterface.cpp
+++ b/src/dbus/qdbusabstractinterface.cpp
@@ -561,13 +561,7 @@ void QDBusAbstractInterface::connectNotify(const char *signal)
QDBusConnectionPrivate *conn = d->connectionPrivate();
if (conn) {
- // do we know what our owner is?
- QString owner;
- if (!d->service.isEmpty() && d->currentOwner.isNull())
- owner = QLatin1String("");
- else
- owner = d->currentOwner;
- conn->connectRelay(d->service, owner, d->path, d->interface,
+ conn->connectRelay(d->service, d->path, d->interface,
this, signal);
}
}
@@ -585,7 +579,7 @@ void QDBusAbstractInterface::disconnectNotify(const char *signal)
QDBusConnectionPrivate *conn = d->connectionPrivate();
if (conn)
- conn->disconnectRelay(d->service, d->currentOwner, d->path, d->interface,
+ conn->disconnectRelay(d->service, d->path, d->interface,
this, signal);
}
diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp
index d7088ff..47893cc 100644
--- a/src/dbus/qdbusconnection.cpp
+++ b/src/dbus/qdbusconnection.cpp
@@ -619,10 +619,8 @@ bool QDBusConnection::connect(const QString &service, const QString &path, const
if (interface.isEmpty() && name.isEmpty())
return false;
- QString owner = d->getNameOwner(service); // we don't care if the owner is empty
- // it might get started later
QDBusWriteLocker locker(ConnectAction, d);
- return d->connectSignal(service, owner, path, interface, name, argumentMatch, signature, receiver, slot);
+ return d->connectSignal(service, path, interface, name, argumentMatch, signature, receiver, slot);
}
/*!
diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h
index d6f7598..32e057c 100644
--- a/src/dbus/qdbusconnection_p.h
+++ b/src/dbus/qdbusconnection_p.h
@@ -119,7 +119,7 @@ public:
struct SignalHook
{
inline SignalHook() : obj(0), midx(-1) { }
- QString owner, service, path, signature;
+ QString service, path, signature;
QObject* obj;
int midx;
QList<int> params;
@@ -155,7 +155,13 @@ public:
typedef QMultiHash<QString, SignalHook> SignalHookHash;
typedef QHash<QString, QDBusMetaObject* > MetaObjectHash;
typedef QHash<QByteArray, int> MatchRefCountHash;
- typedef QHash<QString, int> WatchedServicesHash;
+
+ struct WatchedServiceData {
+ WatchedServiceData() : refcount(0) {}
+ QString owner;
+ int refcount;
+ };
+ typedef QHash<QString, WatchedServiceData> WatchedServicesHash;
public:
// public methods are entry points from other objects
@@ -177,7 +183,7 @@ public:
QDBusPendingCallPrivate *sendWithReplyAsync(const QDBusMessage &message, int timeout = -1);
int sendWithReplyAsync(const QDBusMessage &message, QObject *receiver,
const char *returnMethod, const char *errorMethod, int timeout = -1);
- bool connectSignal(const QString &service, const QString &owner, const QString &path, const QString& interface,
+ bool connectSignal(const QString &service, const QString &path, const QString& interface,
const QString &name, const QStringList &argumentMatch, const QString &signature,
QObject *receiver, const char *slot);
void connectSignal(const QString &key, const SignalHook &hook);
@@ -186,10 +192,10 @@ public:
const QString &name, const QStringList &argumentMatch, const QString &signature,
QObject *receiver, const char *slot);
void registerObject(const ObjectTreeNode *node);
- void connectRelay(const QString &service, const QString &currentOwner,
+ void connectRelay(const QString &service,
const QString &path, const QString &interface,
QDBusAbstractInterface *receiver, const char *signal);
- void disconnectRelay(const QString &service, const QString &currentOwner,
+ void disconnectRelay(const QString &service,
const QString &path, const QString &interface,
QDBusAbstractInterface *receiver, const char *signal);
@@ -223,6 +229,8 @@ private:
bool isServiceRegisteredByThread(const QString &serviceName) const;
+ QString getNameOwnerNoCache(const QString &service);
+
protected:
void customEvent(QEvent *e);
void timerEvent(QTimerEvent *e);
@@ -271,7 +279,7 @@ public:
QDBusError lastError;
QStringList serviceNames;
- WatchedServicesHash watchedServiceNames;
+ WatchedServicesHash watchedServices;
SignalHookHash signalHooks;
MatchRefCountHash matchRefCounts;
ObjectTreeNode rootNode;
@@ -284,7 +292,7 @@ public:
// static methods
static int findSlot(QObject *obj, const QByteArray &normalizedName, QList<int>& params);
static bool prepareHook(QDBusConnectionPrivate::SignalHook &hook, QString &key,
- const QString &service, const QString &owner,
+ const QString &service,
const QString &path, const QString &interface, const QString &name,
const QStringList &argMatch,
QObject *receiver, const char *signal, int minMIdx,
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index 40febc4..ea02005 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -390,7 +390,7 @@ static void qDBusNewConnection(DBusServer *server, DBusConnection *connection, v
} // extern "C"
-static QByteArray buildMatchRule(const QString &service, const QString & /*owner*/,
+static QByteArray buildMatchRule(const QString &service,
const QString &objectPath, const QString &interface,
const QString &member, const QStringList &argMatch, const QString & /*signature*/)
{
@@ -523,7 +523,7 @@ qDBusSignalFilter(DBusConnection *connection, DBusMessage *message, void *data)
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
QDBusMessage amsg = QDBusMessagePrivate::fromDBusMessage(message);
- qDBusDebug() << QThread::currentThread() << "got message:" << amsg;
+ qDBusDebug() << d << "got message:" << amsg;
return d->handleMessage(amsg) ?
DBUS_HANDLER_RESULT_HANDLED :
@@ -913,7 +913,7 @@ void QDBusConnectionPrivate::deliverCall(QObject *object, int /*flags*/, const Q
if (msg.isReplyRequired() && !msg.isDelayedReply()) {
if (!fail) {
// normal reply
- qDBusDebug() << QThread::currentThread() << "Automatically sending reply:" << outputArgs;
+ qDBusDebug() << this << "Automatically sending reply:" << outputArgs;
send(msg.createReply(outputArgs));
} else {
// generate internal error
@@ -947,7 +947,6 @@ QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p)
QDBusMetaTypeId::init();
rootNode.flags = 0;
- watchedServiceNames[QLatin1String(DBUS_SERVICE_DBUS)] = 1;
}
QDBusConnectionPrivate::~QDBusConnectionPrivate()
@@ -1179,11 +1178,15 @@ void QDBusConnectionPrivate::_q_serviceOwnerChanged(const QString &name,
{
Q_UNUSED(oldOwner);
QDBusWriteLocker locker(UpdateSignalHookOwnerAction, this);
- QMutableHashIterator<QString, SignalHook> it(signalHooks);
- it.toFront();
- while (it.hasNext())
- if (it.next().value().service == name)
- it.value().owner = newOwner;
+ WatchedServicesHash::Iterator it = watchedServices.find(name);
+ if (it == watchedServices.end())
+ return;
+ if (oldOwner != it->owner)
+ qWarning("QDBusConnection: name '%s' had owner '%s' but we thought it was '%s'",
+ qPrintable(name), qPrintable(oldOwner), qPrintable(it->owner));
+
+ qDBusDebug() << this << "Updating name" << name << "from" << oldOwner << "to" << newOwner;
+ it->owner = newOwner;
}
int QDBusConnectionPrivate::findSlot(QObject* obj, const QByteArray &normalizedName,
@@ -1201,7 +1204,7 @@ int QDBusConnectionPrivate::findSlot(QObject* obj, const QByteArray &normalizedN
}
bool QDBusConnectionPrivate::prepareHook(QDBusConnectionPrivate::SignalHook &hook, QString &key,
- const QString &service, const QString &owner,
+ const QString &service,
const QString &path, const QString &interface, const QString &name,
const QStringList &argMatch,
QObject *receiver, const char *signal, int minMIdx,
@@ -1220,7 +1223,6 @@ bool QDBusConnectionPrivate::prepareHook(QDBusConnectionPrivate::SignalHook &hoo
}
hook.service = service;
- hook.owner = owner; // we don't care if the service has an owner yet
hook.path = path;
hook.obj = receiver;
hook.argumentMatch = argMatch;
@@ -1245,7 +1247,7 @@ bool QDBusConnectionPrivate::prepareHook(QDBusConnectionPrivate::SignalHook &hoo
hook.signature += QLatin1String( QDBusMetaType::typeToSignature( hook.params.at(i) ) );
}
- hook.matchRule = buildMatchRule(service, owner, path, interface, mname, argMatch, hook.signature);
+ hook.matchRule = buildMatchRule(service, path, interface, mname, argMatch, hook.signature);
return true; // connect to this signal
}
@@ -1488,8 +1490,14 @@ void QDBusConnectionPrivate::handleSignal(const QString &key, const QDBusMessage
//qDBusDebug() << signalHooks.keys();
for ( ; it != end && it.key() == key; ++it) {
const SignalHook &hook = it.value();
- if (!hook.owner.isNull() && hook.owner != msg.service())
- continue;
+ if (!hook.service.isEmpty()) {
+ const QString owner =
+ shouldWatchService(hook.service) ?
+ watchedServices.value(hook.service).owner :
+ hook.service;
+ if (owner != msg.service())
+ continue;
+ }
if (!hook.path.isEmpty() && hook.path != msg.path())
continue;
if (!hook.signature.isEmpty() && hook.signature != msg.signature())
@@ -1652,15 +1660,18 @@ void QDBusConnectionPrivate::setConnection(DBusConnection *dbc, const QDBusError
}
QString busService = QLatin1String(DBUS_SERVICE_DBUS);
- connectSignal(busService, QString(), QString(), QString(), QLatin1String("NameAcquired"), QStringList(), QString(),
+ WatchedServicesHash::mapped_type &bus = watchedServices[busService];
+ bus.refcount = 1;
+ bus.owner = getNameOwnerNoCache(busService);
+ connectSignal(busService, QString(), QString(), QLatin1String("NameAcquired"), QStringList(), QString(),
this, SLOT(registerService(QString)));
- connectSignal(busService, QString(), QString(), QString(), QLatin1String("NameLost"), QStringList(), QString(),
+ connectSignal(busService, QString(), QString(), QLatin1String("NameLost"), QStringList(), QString(),
this, SLOT(unregisterService(QString)));
q_dbus_connection_add_filter(connection, qDBusSignalFilter, this, 0);
- //qDebug("base service: %s", service);
+ qDBusDebug() << this << ": connected successfully";
// schedule a dispatch:
QMetaObject::invokeMethod(this, "doDispatch", Qt::QueuedConnection);
@@ -1695,7 +1706,7 @@ void QDBusConnectionPrivate::processFinishedCall(QDBusPendingCallPrivate *call)
msg = QDBusMessagePrivate::fromDBusMessage(reply);
q_dbus_message_unref(reply);
}
- qDBusDebug() << QThread::currentThread() << "got message reply (async):" << msg;
+ qDBusDebug() << connection << "got message reply (async):" << msg;
// Check if the reply has the expected signature
call->checkReceivedSignature();
@@ -1763,7 +1774,7 @@ int QDBusConnectionPrivate::send(const QDBusMessage& message)
q_dbus_message_set_no_reply(msg, true); // the reply would not be delivered to anything
- qDBusDebug() << QThread::currentThread() << "sending message (no reply):" << message;
+ qDBusDebug() << this << "sending message (no reply):" << message;
checkThread();
bool isOk = q_dbus_connection_send(connection, msg, 0);
int serial = 0;
@@ -1795,7 +1806,7 @@ QDBusMessage QDBusConnectionPrivate::sendWithReply(const QDBusMessage &message,
return QDBusMessage::createError(err);
}
- qDBusDebug() << QThread::currentThread() << "sending message (blocking):" << message;
+ qDBusDebug() << this << "sending message (blocking):" << message;
QDBusErrorInternal error;
DBusMessage *reply = q_dbus_connection_send_with_reply_and_block(connection, msg, timeout, error);
@@ -1808,7 +1819,7 @@ QDBusMessage QDBusConnectionPrivate::sendWithReply(const QDBusMessage &message,
QDBusMessage amsg = QDBusMessagePrivate::fromDBusMessage(reply);
q_dbus_message_unref(reply);
- qDBusDebug() << QThread::currentThread() << "got message reply (blocking):" << amsg;
+ qDBusDebug() << this << "got message reply (blocking):" << amsg;
return amsg;
} else { // use the event loop
@@ -1835,7 +1846,7 @@ QDBusMessage QDBusConnectionPrivate::sendWithReply(const QDBusMessage &message,
QDBusMessage QDBusConnectionPrivate::sendWithReplyLocal(const QDBusMessage &message)
{
- qDBusDebug() << QThread::currentThread() << "sending message via local-loop:" << message;
+ qDBusDebug() << this << "sending message via local-loop:" << message;
QDBusMessage localCallMsg = QDBusMessagePrivate::makeLocal(*this, message);
bool handled = handleMessage(localCallMsg);
@@ -1862,7 +1873,7 @@ QDBusMessage QDBusConnectionPrivate::sendWithReplyLocal(const QDBusMessage &mess
}
// there is a reply
- qDBusDebug() << QThread::currentThread() << "got message via local-loop:" << localReplyMsg;
+ qDBusDebug() << this << "got message via local-loop:" << localReplyMsg;
return localReplyMsg;
}
@@ -1896,7 +1907,7 @@ QDBusPendingCallPrivate *QDBusConnectionPrivate::sendWithReplyAsync(const QDBusM
return pcall;
}
- qDBusDebug() << QThread::currentThread() << "sending message (async):" << message;
+ qDBusDebug() << this << "sending message (async):" << message;
DBusPendingCall *pending = 0;
QDBusDispatchLocker locker(SendWithReplyAsyncAction, this);
@@ -1968,7 +1979,7 @@ int QDBusConnectionPrivate::sendWithReplyAsync(const QDBusMessage &message, QObj
return 1;
}
-bool QDBusConnectionPrivate::connectSignal(const QString &service, const QString &owner,
+bool QDBusConnectionPrivate::connectSignal(const QString &service,
const QString &path, const QString &interface, const QString &name,
const QStringList &argumentMatch, const QString &signature,
QObject *receiver, const char *slot)
@@ -1981,7 +1992,7 @@ bool QDBusConnectionPrivate::connectSignal(const QString &service, const QString
name2.detach();
hook.signature = signature;
- if (!prepareHook(hook, key, service, owner, path, interface, name, argumentMatch, receiver, slot, 0, false))
+ if (!prepareHook(hook, key, service, path, interface, name, argumentMatch, receiver, slot, 0, false))
return false; // don't connect
// avoid duplicating:
@@ -1990,7 +2001,6 @@ bool QDBusConnectionPrivate::connectSignal(const QString &service, const QString
for ( ; it != end && it.key() == key; ++it) {
const QDBusConnectionPrivate::SignalHook &entry = it.value();
if (entry.service == hook.service &&
- entry.owner == hook.owner &&
entry.path == hook.path &&
entry.signature == hook.signature &&
entry.obj == hook.obj &&
@@ -2035,16 +2045,19 @@ void QDBusConnectionPrivate::connectSignal(const QString &key, const SignalHook
// Successfully connected the signal
// Do we need to watch for this name?
if (shouldWatchService(hook.service)) {
- WatchedServicesHash::Iterator it = watchedServiceNames.find(hook.service);
- if (it != watchedServiceNames.end()) {
+ WatchedServicesHash::mapped_type &data = watchedServices[hook.service];
+ if (data.refcount) {
// already watching
- ++it.value();
+ ++data.refcount;
} else {
// we need to watch for this service changing
QString dbusServerService = QLatin1String(DBUS_SERVICE_DBUS);
- connectSignal(dbusServerService, dbusServerService, QString(), QLatin1String(DBUS_INTERFACE_DBUS),
+ connectSignal(dbusServerService, QString(), QLatin1String(DBUS_INTERFACE_DBUS),
QLatin1String("NameOwnerChanged"), QStringList() << hook.service, QString(),
this, SLOT(_q_serviceOwnerChanged(QString,QString,QString)));
+ data.owner = getNameOwnerNoCache(hook.service);
+ qDBusDebug() << this << "Watching service" << hook.service << "for owner changes (current owner:"
+ << data.owner << ")";
}
}
}
@@ -2064,7 +2077,7 @@ bool QDBusConnectionPrivate::disconnectSignal(const QString &service,
name2.detach();
hook.signature = signature;
- if (!prepareHook(hook, key, service, QString(), path, interface, name, argumentMatch, receiver, slot, 0, false))
+ if (!prepareHook(hook, key, service, path, interface, name, argumentMatch, receiver, slot, 0, false))
return false; // don't disconnect
// avoid duplicating:
@@ -2073,7 +2086,6 @@ bool QDBusConnectionPrivate::disconnectSignal(const QString &service,
for ( ; it != end && it.key() == key; ++it) {
const QDBusConnectionPrivate::SignalHook &entry = it.value();
if (entry.service == hook.service &&
- //entry.owner == hook.owner &&
entry.path == hook.path &&
entry.signature == hook.signature &&
entry.obj == hook.obj &&
@@ -2093,16 +2105,16 @@ QDBusConnectionPrivate::disconnectSignal(SignalHookHash::Iterator &it)
{
const SignalHook &hook = it.value();
- WatchedServicesHash::Iterator sit = watchedServiceNames.find(hook.service);
- if (sit != watchedServiceNames.end()) {
- if (sit.value() == 1) {
- watchedServiceNames.erase(sit);
+ WatchedServicesHash::Iterator sit = watchedServices.find(hook.service);
+ if (sit != watchedServices.end()) {
+ if (sit.value().refcount == 1) {
+ watchedServices.erase(sit);
QString dbusServerService = QLatin1String(DBUS_SERVICE_DBUS);
disconnectSignal(dbusServerService, QString(), QLatin1String(DBUS_INTERFACE_DBUS),
QLatin1String("NameOwnerChanged"), QStringList() << hook.service, QString(),
this, SLOT(_q_serviceOwnerChanged(QString,QString,QString)));
} else {
- --sit.value();
+ --sit.value().refcount;
}
}
@@ -2154,7 +2166,7 @@ void QDBusConnectionPrivate::registerObject(const ObjectTreeNode *node)
}
}
-void QDBusConnectionPrivate::connectRelay(const QString &service, const QString &owner,
+void QDBusConnectionPrivate::connectRelay(const QString &service,
const QString &path, const QString &interface,
QDBusAbstractInterface *receiver,
const char *signal)
@@ -2164,7 +2176,7 @@ void QDBusConnectionPrivate::connectRelay(const QString &service, const QString
SignalHook hook;
QString key;
- if (!prepareHook(hook, key, service, owner, path, interface, QString(), QStringList(), receiver, signal,
+ if (!prepareHook(hook, key, service, path, interface, QString(), QStringList(), receiver, signal,
QDBusAbstractInterface::staticMetaObject.methodCount(), true))
return; // don't connect
@@ -2175,7 +2187,6 @@ void QDBusConnectionPrivate::connectRelay(const QString &service, const QString
for ( ; it != end && it.key() == key; ++it) {
const SignalHook &entry = it.value();
if (entry.service == hook.service &&
- entry.owner == hook.owner &&
entry.path == hook.path &&
entry.signature == hook.signature &&
entry.obj == hook.obj &&
@@ -2186,7 +2197,7 @@ void QDBusConnectionPrivate::connectRelay(const QString &service, const QString
connectSignal(key, hook);
}
-void QDBusConnectionPrivate::disconnectRelay(const QString &service, const QString &owner,
+void QDBusConnectionPrivate::disconnectRelay(const QString &service,
const QString &path, const QString &interface,
QDBusAbstractInterface *receiver,
const char *signal)
@@ -2196,7 +2207,7 @@ void QDBusConnectionPrivate::disconnectRelay(const QString &service, const QStri
SignalHook hook;
QString key;
- if (!prepareHook(hook, key, service, owner, path, interface, QString(), QStringList(), receiver, signal,
+ if (!prepareHook(hook, key, service, path, interface, QString(), QStringList(), receiver, signal,
QDBusAbstractInterface::staticMetaObject.methodCount(), true))
return; // don't connect
@@ -2207,7 +2218,6 @@ void QDBusConnectionPrivate::disconnectRelay(const QString &service, const QStri
for ( ; it != end && it.key() == key; ++it) {
const SignalHook &entry = it.value();
if (entry.service == hook.service &&
- entry.owner == hook.owner &&
entry.path == hook.path &&
entry.signature == hook.signature &&
entry.obj == hook.obj &&
@@ -2225,9 +2235,23 @@ QString QDBusConnectionPrivate::getNameOwner(const QString& serviceName)
{
if (QDBusUtil::isValidUniqueConnectionName(serviceName))
return serviceName;
- if (!connection || !QDBusUtil::isValidBusName(serviceName))
+ if (!connection)
return QString();
+ {
+ // acquire a read lock for the cache
+ QReadLocker locker(&lock);
+ WatchedServicesHash::ConstIterator it = watchedServices.constFind(serviceName);
+ if (it != watchedServices.constEnd())
+ return it->owner;
+ }
+
+ // not cached
+ return getNameOwnerNoCache(serviceName);
+}
+
+QString QDBusConnectionPrivate::getNameOwnerNoCache(const QString &serviceName)
+{
QDBusMessage msg = QDBusMessage::createMethodCall(QLatin1String(DBUS_SERVICE_DBUS),
QLatin1String(DBUS_PATH_DBUS), QLatin1String(DBUS_INTERFACE_DBUS),
QLatin1String("GetNameOwner"));
diff --git a/src/dbus/qdbusmarshaller.cpp b/src/dbus/qdbusmarshaller.cpp
index d732ad0..28cec7d 100644
--- a/src/dbus/qdbusmarshaller.cpp
+++ b/src/dbus/qdbusmarshaller.cpp
@@ -387,7 +387,6 @@ bool QDBusMarshaller::appendVariantInternal(const QVariant &arg)
switch (*signature) {
#ifdef __OPTIMIZE__
case DBUS_TYPE_BYTE:
- case DBUS_TYPE_BOOLEAN:
case DBUS_TYPE_INT16:
case DBUS_TYPE_UINT16:
case DBUS_TYPE_INT32:
@@ -397,6 +396,9 @@ bool QDBusMarshaller::appendVariantInternal(const QVariant &arg)
case DBUS_TYPE_DOUBLE:
qIterAppend(&iterator, ba, *signature, arg.constData());
return true;
+ case DBUS_TYPE_BOOLEAN:
+ append( arg.toBool() );
+ return true;
#else
case DBUS_TYPE_BYTE:
append( qvariant_cast<uchar>(arg) );
diff --git a/src/dbus/qdbuspendingcall.cpp b/src/dbus/qdbuspendingcall.cpp
index ef50b04..9c768ed 100644
--- a/src/dbus/qdbuspendingcall.cpp
+++ b/src/dbus/qdbuspendingcall.cpp
@@ -310,7 +310,7 @@ QDBusPendingCall &QDBusPendingCall::operator=(const QDBusPendingCall &other)
bool QDBusPendingCall::isFinished() const
{
- return d && (d->replyMessage.type() != QDBusMessage::InvalidMessage);
+ return !d || (d->replyMessage.type() != QDBusMessage::InvalidMessage);
}
void QDBusPendingCall::waitForFinished()
diff --git a/src/dbus/qdbuspendingreply.h b/src/dbus/qdbuspendingreply.h
index b7f54e4..4f90c98 100644
--- a/src/dbus/qdbuspendingreply.h
+++ b/src/dbus/qdbuspendingreply.h
@@ -188,6 +188,7 @@ public:
private:
inline void calculateMetaTypes()
{
+ if (!d) return;
int typeIds[Count > 0 ? Count : 1]; // use at least one since zero-sized arrays aren't valid
ForEach::fillMetaTypes(typeIds);
setMetaTypes(Count, typeIds);
diff --git a/src/gui/dialogs/qcolordialog_mac.mm b/src/gui/dialogs/qcolordialog_mac.mm
index 53d2e1e..a350be1 100644
--- a/src/gui/dialogs/qcolordialog_mac.mm
+++ b/src/gui/dialogs/qcolordialog_mac.mm
@@ -79,6 +79,7 @@ QT_USE_NAMESPACE
BOOL mHackedPanel;
NSInteger mResultCode;
BOOL mDialogIsExecuting;
+ BOOL mResultSet;
}
- (id)initWithColorPanel:(NSColorPanel *)panel
stolenContentView:(NSView *)stolenContentView
@@ -116,6 +117,7 @@ QT_USE_NAMESPACE
mHackedPanel = (okButton != 0);
mResultCode = NSCancelButton;
mDialogIsExecuting = false;
+ mResultSet = false;
if (mHackedPanel) {
[self relayout];
@@ -159,11 +161,13 @@ QT_USE_NAMESPACE
- (BOOL)windowShouldClose:(id)window
{
Q_UNUSED(window);
- if (mHackedPanel) {
- [self onCancelClicked];
- } else {
+ if (!mHackedPanel)
[self updateQtColor];
+ if (mDialogIsExecuting) {
[self finishOffWithCode:NSCancelButton];
+ } else {
+ mResultSet = true;
+ mPriv->colorDialog()->reject();
}
return true;
}
@@ -240,11 +244,12 @@ QT_USE_NAMESPACE
- (void)onCancelClicked
{
- Q_ASSERT(mHackedPanel);
- [[mStolenContentView window] close];
- delete mQtColor;
- mQtColor = new QColor();
- [self finishOffWithCode:NSCancelButton];
+ if (mHackedPanel) {
+ [[mStolenContentView window] close];
+ delete mQtColor;
+ mQtColor = new QColor();
+ [self finishOffWithCode:NSCancelButton];
+ }
}
- (void)updateQtColor
@@ -306,10 +311,16 @@ QT_USE_NAMESPACE
} else {
// Since we are not in a modal event loop, we can safely close
// down QColorDialog
- if (mResultCode == NSCancelButton)
- mPriv->colorDialog()->reject();
- else
- mPriv->colorDialog()->accept();
+ // Calling accept() or reject() can in turn call closeCocoaColorPanel.
+ // This check will prevent any such recursion.
+ if (!mResultSet) {
+ mResultSet = true;
+ if (mResultCode == NSCancelButton) {
+ mPriv->colorDialog()->reject();
+ } else {
+ mPriv->colorDialog()->accept();
+ }
+ }
}
}
@@ -336,6 +347,7 @@ QT_USE_NAMESPACE
}
}
+ QAbstractEventDispatcher::instance()->interrupt();
if (mResultCode == NSCancelButton)
mPriv->colorDialog()->reject();
else
diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp
index 45a410f..3c388de 100644
--- a/src/gui/dialogs/qfiledialog.cpp
+++ b/src/gui/dialogs/qfiledialog.cpp
@@ -669,6 +669,9 @@ void QFileDialog::setOptions(Options options)
}
if (changed & HideNameFilterDetails)
setNameFilters(d->nameFilters);
+
+ if (changed & ShowDirsOnly)
+ setFilter((options & ShowDirsOnly) ? filter() & ~QDir::Files : filter() | QDir::Files);
}
QFileDialog::Options QFileDialog::options() const
@@ -995,6 +998,24 @@ bool QFileDialog::isNameFilterDetailsVisible() const
}
+/*
+ Strip the filters by removing the details, e.g. (*.*).
+*/
+QStringList qt_strip_filters(const QStringList &filters)
+{
+ QStringList strippedFilters;
+ QRegExp r(QString::fromLatin1(qt_file_dialog_filter_reg_exp));
+ for (int i = 0; i < filters.count(); ++i) {
+ QString filterName;
+ int index = r.indexIn(filters[i]);
+ if (index >= 0)
+ filterName = r.cap(1);
+ strippedFilters.append(filterName.simplified());
+ }
+ return strippedFilters;
+}
+
+
/*!
\since 4.4
@@ -1021,20 +1042,11 @@ void QFileDialog::setNameFilters(const QStringList &filters)
if (cleanedFilters.isEmpty())
return;
- if (testOption(HideNameFilterDetails)) {
- QStringList strippedFilters;
- QRegExp r(QString::fromLatin1(qt_file_dialog_filter_reg_exp));
- for (int i = 0; i < cleanedFilters.count(); ++i) {
- QString filterName;
- int index = r.indexIn(cleanedFilters[i]);
- if (index >= 0)
- filterName = r.cap(1);
- strippedFilters.append(filterName.simplified());
- }
- d->qFileDialogUi->fileTypeCombo->addItems(strippedFilters);
- } else {
+ if (testOption(HideNameFilterDetails))
+ d->qFileDialogUi->fileTypeCombo->addItems(qt_strip_filters(cleanedFilters));
+ else
d->qFileDialogUi->fileTypeCombo->addItems(cleanedFilters);
- }
+
d->_q_useNameFilter(0);
}
@@ -1085,8 +1097,12 @@ void QFileDialog::selectNameFilter(const QString &filter)
d->selectNameFilter_sys(filter);
return;
}
-
- int i = d->qFileDialogUi->fileTypeCombo->findText(filter);
+ int i;
+ if (testOption(HideNameFilterDetails)) {
+ i = d->qFileDialogUi->fileTypeCombo->findText(qt_strip_filters(qt_make_filter_list(filter)).first());
+ } else {
+ i = d->qFileDialogUi->fileTypeCombo->findText(filter);
+ }
if (i >= 0) {
d->qFileDialogUi->fileTypeCombo->setCurrentIndex(i);
d->_q_useNameFilter(d->qFileDialogUi->fileTypeCombo->currentIndex());
diff --git a/src/gui/dialogs/qfilesystemmodel.cpp b/src/gui/dialogs/qfilesystemmodel.cpp
index 8e78503..6ec80a9 100644
--- a/src/gui/dialogs/qfilesystemmodel.cpp
+++ b/src/gui/dialogs/qfilesystemmodel.cpp
@@ -1223,8 +1223,7 @@ bool QFileSystemModel::dropMimeData(const QMimeData *data, Qt::DropAction action
case Qt::MoveAction:
for (; it != urls.constEnd(); ++it) {
QString path = (*it).toLocalFile();
- success = QFile::copy(path, to + QFileInfo(path).fileName())
- && QFile::remove(path) && success;
+ success = QFile::rename(path, to + QFileInfo(path).fileName()) && success;
}
break;
default:
@@ -1779,7 +1778,7 @@ void QFileSystemModelPrivate::_q_fileSystemChanged(const QString &path, const QL
node->fileName = fileName;
}
- if (info.size() == -1) {
+ if (info.size() == -1 && !info.isSymLink()) {
removeNode(parentNode, fileName);
continue;
}
diff --git a/src/gui/dialogs/qfontdialog_mac.mm b/src/gui/dialogs/qfontdialog_mac.mm
index 0c467cd..31bab2b 100644
--- a/src/gui/dialogs/qfontdialog_mac.mm
+++ b/src/gui/dialogs/qfontdialog_mac.mm
@@ -394,7 +394,9 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont)
}
[mFontPanel setDelegate:nil];
[[NSFontManager sharedFontManager] setDelegate:nil];
+#ifdef QT_MAC_USE_COCOA
[[NSFontManager sharedFontManager] setTarget:nil];
+#endif
}
@end
@@ -518,7 +520,9 @@ void *QFontDialogPrivate::openCocoaFontPanel(const QFont &initial,
extraHeight:dialogExtraHeight];
[ourPanel setDelegate:delegate];
[[NSFontManager sharedFontManager] setDelegate:delegate];
+#ifdef QT_MAC_USE_COCOA
[[NSFontManager sharedFontManager] setTarget:delegate];
+#endif
setFont(delegate, initial);
// hack to get correct initial layout
diff --git a/src/gui/dialogs/qmessagebox.cpp b/src/gui/dialogs/qmessagebox.cpp
index a318c43..8ec8d1c 100644
--- a/src/gui/dialogs/qmessagebox.cpp
+++ b/src/gui/dialogs/qmessagebox.cpp
@@ -188,6 +188,9 @@ public:
bool autoAddOkButton;
QAbstractButton *detectedEscapeButton;
QLabel *informativeLabel;
+#ifdef Q_OS_SYMBIAN
+ QTextEdit *textEdit;
+#endif
QPointer<QObject> receiverToDisconnectOnClose;
QByteArray memberToDisconnectOnClose;
QByteArray signalToDisconnectOnClose;
@@ -2459,10 +2462,24 @@ void QMessageBox::setInformativeText(const QString &text)
#endif
label->setWordWrap(true);
QGridLayout *grid = static_cast<QGridLayout *>(layout());
+#ifdef Q_OS_SYMBIAN
+ label->hide();
+ QTextEdit *textEdit = new QTextEdit(this);
+ textEdit->setReadOnly(true);
+ grid->addWidget(textEdit, 1, 1, 1, 1);
+ d->textEdit = textEdit;
+#else
grid->addWidget(label, 1, 1, 1, 1);
+#endif
d->informativeLabel = label;
}
d->informativeLabel->setText(text);
+
+#ifdef Q_OS_SYMBIAN
+ //We need to put the informative label inside textEdit to enable scrolling of long texts.
+ d->textEdit->setText(d->informativeLabel->text());
+#endif
+
d->updateSize();
}
diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp
index 239e29c..a523bab 100644
--- a/src/gui/effects/qgraphicseffect.cpp
+++ b/src/gui/effects/qgraphicseffect.cpp
@@ -160,6 +160,10 @@ QRectF QGraphicsEffectSource::boundingRect(Qt::CoordinateSystem system) const
/*!
Returns the bounding rectangle of the source mapped to the given \a system.
+ Calling this function with Qt::DeviceCoordinates outside of
+ QGraphicsEffect::draw() will give undefined results, as there is no device
+ context available.
+
\sa draw()
*/
QRectF QGraphicsEffect::sourceBoundingRect(Qt::CoordinateSystem system) const
@@ -309,7 +313,10 @@ QPixmap QGraphicsEffectSource::pixmap(Qt::CoordinateSystem system, QPoint *offse
// Shortcut, no cache for childless pixmap items...
const QGraphicsItem *item = graphicsItem();
if (system == Qt::LogicalCoordinates && mode == QGraphicsEffect::NoPad && item && isPixmap()) {
- return ((QGraphicsPixmapItem *) item)->pixmap();
+ const QGraphicsPixmapItem *pixmapItem = static_cast<const QGraphicsPixmapItem *>(item);
+ if (offset)
+ *offset = pixmapItem->offset().toPoint();
+ return pixmapItem->pixmap();
}
if (system == Qt::DeviceCoordinates && item
@@ -348,6 +355,10 @@ QPixmap QGraphicsEffectSource::pixmap(Qt::CoordinateSystem system, QPoint *offse
The returned pixmap is clipped to the current painter's device rectangle when
\a system is Qt::DeviceCoordinates.
+ Calling this function with Qt::DeviceCoordinates outside of
+ QGraphicsEffect::draw() will give undefined results, as there is no device
+ context available.
+
\sa draw(), boundingRect()
*/
QPixmap QGraphicsEffect::sourcePixmap(Qt::CoordinateSystem system, QPoint *offset, QGraphicsEffect::PixmapPadMode mode) const
@@ -363,10 +374,14 @@ QGraphicsEffectSourcePrivate::~QGraphicsEffectSourcePrivate()
invalidateCache();
}
-void QGraphicsEffectSourcePrivate::invalidateCache(bool effectRectChanged) const
+void QGraphicsEffectSourcePrivate::invalidateCache(InvalidateReason reason) const
{
- if (effectRectChanged && m_cachedMode != QGraphicsEffect::PadToEffectiveBoundingRect)
+ if (m_cachedMode != QGraphicsEffect::PadToEffectiveBoundingRect
+ && (reason == EffectRectChanged
+ || reason == TransformChanged
+ && m_cachedSystem == Qt::LogicalCoordinates))
return;
+
QPixmapCache::remove(m_cacheKey);
}
@@ -398,8 +413,8 @@ QGraphicsEffect::~QGraphicsEffect()
/*!
Returns the effective bounding rectangle for this effect, i.e., the
- bounding rectangle of the source, adjusted by any margins applied by
- the effect itself.
+ bounding rectangle of the source in device coordinates, adjusted by
+ any margins applied by the effect itself.
\sa boundingRectFor(), updateBoundingRect()
*/
@@ -413,7 +428,7 @@ QRectF QGraphicsEffect::boundingRect() const
/*!
Returns the effective bounding rectangle for this effect, given the
- provided \a rect in the source's coordinate space. When writing
+ provided \a rect in the device coordinates. When writing
you own custom effect, you must call updateBoundingRect() whenever any
parameters are changed that may cause this this function to return a
different value.
@@ -512,7 +527,7 @@ void QGraphicsEffect::updateBoundingRect()
Q_D(QGraphicsEffect);
if (d->source) {
d->source->d_func()->effectBoundingRectChanged();
- d->source->d_func()->invalidateCache(true);
+ d->source->d_func()->invalidateCache(QGraphicsEffectSourcePrivate::EffectRectChanged);
}
}
@@ -829,22 +844,19 @@ QRectF QGraphicsBlurEffect::boundingRectFor(const QRectF &rect) const
void QGraphicsBlurEffect::draw(QPainter *painter)
{
Q_D(QGraphicsBlurEffect);
- if (d->filter->radius() <= 0) {
+ if (d->filter->radius() < 1) {
drawSource(painter);
return;
}
PixmapPadMode mode = PadToEffectiveBoundingRect;
if (painter->paintEngine()->type() == QPaintEngine::OpenGL2)
- mode = PadToTransparentBorder;
+ mode = NoPad;
// Draw pixmap in device coordinates to avoid pixmap scaling.
QPoint offset;
- const QPixmap pixmap = sourcePixmap(Qt::DeviceCoordinates, &offset, mode);
- QTransform restoreTransform = painter->worldTransform();
- painter->setWorldTransform(QTransform());
+ QPixmap pixmap = sourcePixmap(Qt::LogicalCoordinates, &offset, mode);
d->filter->draw(painter, offset, pixmap);
- painter->setWorldTransform(restoreTransform);
}
/*!
@@ -1025,7 +1037,7 @@ void QGraphicsDropShadowEffect::draw(QPainter *painter)
PixmapPadMode mode = PadToEffectiveBoundingRect;
if (painter->paintEngine()->type() == QPaintEngine::OpenGL2)
- mode = PadToTransparentBorder;
+ mode = NoPad;
// Draw pixmap in device coordinates to avoid pixmap scaling.
QPoint offset;
diff --git a/src/gui/effects/qgraphicseffect_p.h b/src/gui/effects/qgraphicseffect_p.h
index 0011eef..cab7a48 100644
--- a/src/gui/effects/qgraphicseffect_p.h
+++ b/src/gui/effects/qgraphicseffect_p.h
@@ -108,6 +108,13 @@ public:
, m_cachedMode(QGraphicsEffect::PadToTransparentBorder)
{}
+ enum InvalidateReason
+ {
+ TransformChanged,
+ EffectRectChanged,
+ SourceChanged
+ };
+
virtual ~QGraphicsEffectSourcePrivate();
virtual void detach() = 0;
virtual QRectF boundingRect(Qt::CoordinateSystem system) const = 0;
@@ -121,7 +128,9 @@ public:
virtual QPixmap pixmap(Qt::CoordinateSystem system, QPoint *offset = 0,
QGraphicsEffect::PixmapPadMode mode = QGraphicsEffect::PadToTransparentBorder) const = 0;
virtual void effectBoundingRectChanged() = 0;
- void invalidateCache(bool effectRectChanged = false) const;
+
+ void invalidateCache(InvalidateReason reason = SourceChanged) const;
+ Qt::CoordinateSystem currentCachedSystem() const { return m_cachedSystem; }
friend class QGraphicsScenePrivate;
friend class QGraphicsItem;
diff --git a/src/gui/embedded/directfb.pri b/src/gui/embedded/directfb.pri
index 84253b5..bd1d947 100644
--- a/src/gui/embedded/directfb.pri
+++ b/src/gui/embedded/directfb.pri
@@ -14,6 +14,7 @@
#DEFINES += QT_NO_DIRECTFB_KEYBOARD
#DEFINES += QT_DIRECTFB_TIMING
#DEFINES += QT_NO_DIRECTFB_OPAQUE_DETECTION
+#DEFINES += QT_NO_DIRECTFB_STRETCHBLIT
#DIRECTFB_DRAWINGOPERATIONS=DRAW_RECTS|DRAW_LINES|DRAW_IMAGE|DRAW_PIXMAP|DRAW_TILED_PIXMAP|STROKE_PATH|DRAW_PATH|DRAW_POINTS|DRAW_ELLIPSE|DRAW_POLYGON|DRAW_TEXT|FILL_PATH|FILL_RECT|DRAW_COLORSPANS|DRAW_ROUNDED_RECT
#DEFINES += \"QT_DIRECTFB_WARN_ON_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\"
#DEFINES += \"QT_DIRECTFB_DISABLE_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\"
diff --git a/src/gui/embedded/qscreen_qws.cpp b/src/gui/embedded/qscreen_qws.cpp
index ae5570f..07bb258 100644
--- a/src/gui/embedded/qscreen_qws.cpp
+++ b/src/gui/embedded/qscreen_qws.cpp
@@ -3150,6 +3150,7 @@ int QScreen::subScreenIndexAt(const QPoint &p) const
#if 0
#ifdef QT_LOADABLE_MODULES
+#include <dlfcn.h>
// ### needs update after driver init changes
diff --git a/src/gui/embedded/qscreen_qws.h b/src/gui/embedded/qscreen_qws.h
index b3246f9..7ab49fb 100644
--- a/src/gui/embedded/qscreen_qws.h
+++ b/src/gui/embedded/qscreen_qws.h
@@ -243,7 +243,9 @@ public:
int totalSize() const { return mapsize; }
QRgb * clut() { return screenclut; }
+#ifdef QT_DEPRECATED
QT_DEPRECATED int numCols() { return screencols; }
+#endif
int colorCount() { return screencols; }
virtual QSize mapToDevice(const QSize &) const;
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/gui/graphicsview/qgraphicsanchorlayout.cpp
index 6718a28..f504c54 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout.cpp
+++ b/src/gui/graphicsview/qgraphicsanchorlayout.cpp
@@ -321,14 +321,14 @@ void QGraphicsAnchorLayout::addCornerAnchors(QGraphicsLayoutItem *firstItem,
// Horizontal anchor
Qt::AnchorPoint firstEdge = (firstCorner & 1 ? Qt::AnchorRight: Qt::AnchorLeft);
Qt::AnchorPoint secondEdge = (secondCorner & 1 ? Qt::AnchorRight: Qt::AnchorLeft);
- d->addAnchor(firstItem, firstEdge, secondItem, secondEdge);
+ if (d->addAnchor(firstItem, firstEdge, secondItem, secondEdge)) {
+ // Vertical anchor
+ firstEdge = (firstCorner & 2 ? Qt::AnchorBottom: Qt::AnchorTop);
+ secondEdge = (secondCorner & 2 ? Qt::AnchorBottom: Qt::AnchorTop);
+ d->addAnchor(firstItem, firstEdge, secondItem, secondEdge);
- // Vertical anchor
- firstEdge = (firstCorner & 2 ? Qt::AnchorBottom: Qt::AnchorTop);
- secondEdge = (secondCorner & 2 ? Qt::AnchorBottom: Qt::AnchorTop);
- d->addAnchor(firstItem, firstEdge, secondItem, secondEdge);
-
- invalidate();
+ invalidate();
+ }
}
/*!
@@ -351,11 +351,14 @@ void QGraphicsAnchorLayout::addAnchors(QGraphicsLayoutItem *firstItem,
QGraphicsLayoutItem *secondItem,
Qt::Orientations orientations)
{
+ bool ok = true;
if (orientations & Qt::Horizontal) {
- addAnchor(secondItem, Qt::AnchorLeft, firstItem, Qt::AnchorLeft);
- addAnchor(firstItem, Qt::AnchorRight, secondItem, Qt::AnchorRight);
+ // Currently, if the first is ok, then the rest of the calls should be ok
+ ok = addAnchor(secondItem, Qt::AnchorLeft, firstItem, Qt::AnchorLeft) != 0;
+ if (ok)
+ addAnchor(firstItem, Qt::AnchorRight, secondItem, Qt::AnchorRight);
}
- if (orientations & Qt::Vertical) {
+ if (orientations & Qt::Vertical && ok) {
addAnchor(secondItem, Qt::AnchorTop, firstItem, Qt::AnchorTop);
addAnchor(firstItem, Qt::AnchorBottom, secondItem, Qt::AnchorBottom);
}
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
index 03ed63d..1dc6873 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
+++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
@@ -1666,6 +1666,13 @@ QGraphicsAnchor *QGraphicsAnchorLayoutPrivate::addAnchor(QGraphicsLayoutItem *fi
return 0;
}
+ const QGraphicsLayoutItem *parentWidget = q->parentLayoutItem();
+ if (firstItem == parentWidget || secondItem == parentWidget) {
+ qWarning("QGraphicsAnchorLayout::addAnchor(): "
+ "You cannot add the parent of the layout to the layout.");
+ return 0;
+ }
+
// In QGraphicsAnchorLayout, items are represented in its internal
// graph as four anchors that connect:
// - Left -> HCenter
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 03e8b09..726d571 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -2584,6 +2584,35 @@ void QGraphicsItem::setGraphicsEffect(QGraphicsEffect *effect)
/*!
\internal
\since 4.6
+ Returns the effective bounding rect of the given item space rect.
+ If the item has no effect, the rect is returned unmodified.
+ If the item has an effect, the effective rect can be extend beyond the
+ item's bounding rect, depending on the effect.
+
+ \sa boundingRect()
+*/
+QRectF QGraphicsItemPrivate::effectiveBoundingRect(const QRectF &rect) const
+{
+#ifndef QT_NO_GRAPHICSEFFECT
+ Q_Q(const QGraphicsItem);
+ QGraphicsEffect *effect = graphicsEffect;
+ if (scene && effect && effect->isEnabled()) {
+ QRectF sceneRect = q->mapRectToScene(rect);
+ QRectF sceneEffectRect;
+ foreach (QGraphicsView *view, scene->views()) {
+ QRectF deviceRect = view->d_func()->mapRectFromScene(sceneRect);
+ QRect deviceEffectRect = effect->boundingRectFor(deviceRect).toAlignedRect();
+ sceneEffectRect |= view->d_func()->mapRectToScene(deviceEffectRect);
+ }
+ return q->mapRectFromScene(sceneEffectRect);
+ }
+#endif //QT_NO_GRAPHICSEFFECT
+ return rect;
+}
+
+/*!
+ \internal
+ \since 4.6
Returns the effective bounding rect of the item.
If the item has no effect, this is the same as the item's bounding rect.
If the item has an effect, the effective rect can be larger than the item's
@@ -2594,16 +2623,19 @@ void QGraphicsItem::setGraphicsEffect(QGraphicsEffect *effect)
QRectF QGraphicsItemPrivate::effectiveBoundingRect() const
{
#ifndef QT_NO_GRAPHICSEFFECT
- QGraphicsEffect *effect = graphicsEffect;
- QRectF brect = effect && effect->isEnabled() ? effect->boundingRect() : q_ptr->boundingRect();
+ Q_Q(const QGraphicsItem);
+ QRectF brect = effectiveBoundingRect(q_ptr->boundingRect());
if (ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)
return brect;
const QGraphicsItem *effectParent = parent;
while (effectParent) {
- effect = effectParent->d_ptr->graphicsEffect;
- if (effect && effect->isEnabled())
- brect = effect->boundingRectFor(brect);
+ QGraphicsEffect *effect = effectParent->d_ptr->graphicsEffect;
+ if (scene && effect && effect->isEnabled()) {
+ const QRectF brectInParentSpace = q->mapRectToItem(effectParent, brect);
+ const QRectF effectRectInParentSpace = effectParent->d_ptr->effectiveBoundingRect(brectInParentSpace);
+ brect = effectParent->mapRectToItem(q, effectRectInParentSpace);
+ }
if (effectParent->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)
return brect;
effectParent = effectParent->d_ptr->parent;
@@ -7145,9 +7177,16 @@ void QGraphicsItem::prepareGeometryChange()
QGraphicsItem *parent = this;
while ((parent = parent->d_ptr->parent)) {
- parent->d_ptr->dirtyChildrenBoundingRect = 1;
+ QGraphicsItemPrivate *parentp = parent->d_ptr.data();
+ parentp->dirtyChildrenBoundingRect = 1;
// ### Only do this if the parent's effect applies to the entire subtree.
- parent->d_ptr->notifyBoundingRectChanged = 1;
+ parentp->notifyBoundingRectChanged = 1;
+#ifndef QT_NO_GRAPHICSEFFECT
+ if (parentp->scene && parentp->graphicsEffect) {
+ parentp->notifyInvalidated = 1;
+ static_cast<QGraphicsItemEffectSourcePrivate *>(parentp->graphicsEffect->d_func()->source->d_func())->invalidateCache();
+ }
+#endif
}
}
@@ -10505,6 +10544,20 @@ void QGraphicsItemGroup::addToGroup(QGraphicsItem *item)
if (!item->pos().isNull())
newItemTransform *= QTransform::fromTranslate(-item->x(), -item->y());
+ // removing additional transformations properties applied with itemTransform()
+ QPointF origin = item->transformOriginPoint();
+ QMatrix4x4 m;
+ QList<QGraphicsTransform*> transformList = item->transformations();
+ for (int i = 0; i < transformList.size(); ++i)
+ transformList.at(i)->applyTo(&m);
+ newItemTransform *= m.toTransform().inverted();
+ newItemTransform.translate(origin.x(), origin.y());
+ newItemTransform.rotate(-item->rotation());
+ newItemTransform.scale(1/item->scale(), 1/item->scale());
+ newItemTransform.translate(-origin.x(), -origin.y());
+
+ // ### Expensive, we could maybe use dirtySceneTransform bit for optimization
+
item->setTransform(newItemTransform);
item->d_func()->setIsMemberOfGroup(true);
prepareGeometryChange();
@@ -10529,11 +10582,39 @@ void QGraphicsItemGroup::removeFromGroup(QGraphicsItem *item)
}
QGraphicsItem *newParent = d_ptr->parent;
+
+ // COMBINE
+ bool ok;
+ QTransform itemTransform;
+ if (newParent)
+ itemTransform = item->itemTransform(newParent, &ok);
+ else
+ itemTransform = item->sceneTransform();
+
QPointF oldPos = item->mapToItem(newParent, 0, 0);
item->setParentItem(newParent);
- // ### This function should remap the item's matrix to keep the item's
- // transformation unchanged relative to the scene.
item->setPos(oldPos);
+
+ // removing position from translation component of the new transform
+ if (!item->pos().isNull())
+ itemTransform *= QTransform::fromTranslate(-item->x(), -item->y());
+
+ // removing additional transformations properties applied
+ // with itemTransform() or sceneTransform()
+ QPointF origin = item->transformOriginPoint();
+ QMatrix4x4 m;
+ QList<QGraphicsTransform*> transformList = item->transformations();
+ for (int i = 0; i < transformList.size(); ++i)
+ transformList.at(i)->applyTo(&m);
+ itemTransform *= m.toTransform().inverted();
+ itemTransform.translate(origin.x(), origin.y());
+ itemTransform.rotate(-item->rotation());
+ itemTransform.scale(1 / item->scale(), 1 / item->scale());
+ itemTransform.translate(-origin.x(), -origin.y());
+
+ // ### Expensive, we could maybe use dirtySceneTransform bit for optimization
+
+ item->setTransform(itemTransform);
item->d_func()->setIsMemberOfGroup(item->group() != 0);
// ### Quite expensive. But removeFromGroup() isn't called very often.
@@ -10643,26 +10724,45 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP
qWarning("QGraphicsEffectSource::pixmap: Not yet implemented, lacking device context");
return QPixmap();
}
-
if (!item->d_ptr->scene)
return QPixmap();
QGraphicsScenePrivate *scened = item->d_ptr->scene->d_func();
const QRectF sourceRect = boundingRect(system);
- QRect effectRect;
+ QRectF effectRectF;
+ bool unpadded = false;
if (mode == QGraphicsEffect::PadToEffectiveBoundingRect) {
- effectRect = item->graphicsEffect()->boundingRectFor(sourceRect).toAlignedRect();
+ if (info) {
+ effectRectF = item->graphicsEffect()->boundingRectFor(boundingRect(Qt::DeviceCoordinates));
+ unpadded = (effectRectF.size() == sourceRect.size());
+ if (info && system == Qt::LogicalCoordinates)
+ effectRectF = info->painter->worldTransform().inverted().mapRect(effectRectF);
+ } else {
+ // no choice but to send a logical coordinate bounding rect to boundingRectFor
+ effectRectF = item->graphicsEffect()->boundingRectFor(sourceRect);
+ }
} else if (mode == QGraphicsEffect::PadToTransparentBorder) {
// adjust by 1.5 to account for cosmetic pens
- effectRect = sourceRect.adjusted(-1.5, -1.5, 1.5, 1.5).toAlignedRect();
+ effectRectF = sourceRect.adjusted(-1.5, -1.5, 1.5, 1.5);
} else {
- effectRect = sourceRect.toAlignedRect();
+ effectRectF = sourceRect;
+ unpadded = true;
}
+ QRect effectRect = effectRectF.toAlignedRect();
+
if (offset)
*offset = effectRect.topLeft();
+ bool untransformed = !deviceCoordinates
+ || info->painter->worldTransform().type() <= QTransform::TxTranslate;
+ if (untransformed && unpadded && isPixmap()) {
+ if (offset)
+ *offset = boundingRect(system).topLeft().toPoint();
+ return static_cast<QGraphicsPixmapItem *>(item)->pixmap();
+ }
+
if (deviceCoordinates) {
// Clip to viewport rect.
int left, top, right, bottom;
@@ -10690,12 +10790,6 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP
if (effectRect.isEmpty())
return QPixmap();
- if (system == Qt::LogicalCoordinates
- && effectRect.size() == sourceRect.size()
- && isPixmap()) {
- return static_cast<QGraphicsPixmapItem *>(item)->pixmap();
- }
-
QPixmap pixmap(effectRect.size());
pixmap.fill(Qt::transparent);
QPainter pixmapPainter(&pixmap);
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index 8f9fe54..2d8de65 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -236,6 +236,8 @@ public:
QRectF effectiveBoundingRect() const;
QRectF sceneEffectiveBoundingRect() const;
+ QRectF effectiveBoundingRect(const QRectF &rect) const;
+
virtual void resolveFont(uint inheritedMask)
{
for (int i = 0; i < children.size(); ++i)
diff --git a/src/gui/graphicsview/qgraphicslayout.cpp b/src/gui/graphicsview/qgraphicslayout.cpp
index 2e9a30c..1e426c8 100644
--- a/src/gui/graphicsview/qgraphicslayout.cpp
+++ b/src/gui/graphicsview/qgraphicslayout.cpp
@@ -148,6 +148,10 @@ QT_BEGIN_NAMESPACE
\a parent is passed to QGraphicsLayoutItem's constructor and the
QGraphicsLayoutItem's isLayout argument is set to \e true.
+
+ If \a parent is a QGraphicsWidget the layout will be installed
+ on that widget. (Note that installing a layout will delete the old one
+ installed.)
*/
QGraphicsLayout::QGraphicsLayout(QGraphicsLayoutItem *parent)
: QGraphicsLayoutItem(*new QGraphicsLayoutPrivate)
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 2a53456..774a6d3 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -569,14 +569,10 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
item->d_ptr->clearSubFocus();
- if (!item->d_ptr->inDestructor && item == tabFocusFirst) {
- QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item);
- widget->d_func()->fixFocusChainBeforeReparenting(0, 0);
- }
-
if (item->flags() & QGraphicsItem::ItemSendsScenePositionChanges)
unregisterScenePosItem(item);
+ QGraphicsScene *oldScene = item->d_func()->scene;
item->d_func()->scene = 0;
//We need to remove all children first because they might use their parent
@@ -587,6 +583,11 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
q->removeItem(item->d_ptr->children.at(i));
}
+ if (!item->d_ptr->inDestructor && item == tabFocusFirst) {
+ QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item);
+ widget->d_func()->fixFocusChainBeforeReparenting(0, oldScene, 0);
+ }
+
// Unregister focus proxy.
item->d_ptr->resetFocusProxy();
@@ -1560,7 +1561,10 @@ QGraphicsScene::QGraphicsScene(qreal x, qreal y, qreal width, qreal height, QObj
}
/*!
- Destroys the QGraphicsScene object.
+ Removes and deletes all items from the scene object
+ before destroying the scene object. The scene object
+ is removed from the application's global scene list,
+ and it is removed from all associated views.
*/
QGraphicsScene::~QGraphicsScene()
{
@@ -2442,23 +2446,26 @@ void QGraphicsScene::destroyItemGroup(QGraphicsItemGroup *group)
}
/*!
- Adds or moves the item \a item and all its childen to the scene.
+ Adds or moves the \a item and all its childen to this scene.
+ This scene takes ownership of the \a item.
If the item is visible (i.e., QGraphicsItem::isVisible() returns
true), QGraphicsScene will emit changed() once control goes back
to the event loop.
- If the item is already in a different scene, it will first be removed from
- its old scene, and then added to this scene as a top-level.
+ If the item is already in a different scene, it will first be
+ removed from its old scene, and then added to this scene as a
+ top-level.
- QGraphicsScene will send ItemSceneChange notifications to \a item while
- it is added to the scene. If item does not currently belong to a scene, only one
- notification is sent. If it does belong to scene already (i.e., it is
- moved to this scene), QGraphicsScene will send an addition notification as
- the item is removed from its previous scene.
+ QGraphicsScene will send ItemSceneChange notifications to \a item
+ while it is added to the scene. If item does not currently belong
+ to a scene, only one notification is sent. If it does belong to
+ scene already (i.e., it is moved to this scene), QGraphicsScene
+ will send an addition notification as the item is removed from its
+ previous scene.
- If the item is a panel, the scene is active, and there is no active panel
- in the scene, then the item will be activated.
+ If the item is a panel, the scene is active, and there is no
+ active panel in the scene, then the item will be activated.
\sa removeItem(), addEllipse(), addLine(), addPath(), addPixmap(),
addRect(), addText(), addWidget(), {QGraphicsItem#Sorting}{Sorting}
@@ -4670,10 +4677,13 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
painter->setWorldTransform(*transformPtr);
painter->setOpacity(opacity);
- if (sourced->lastEffectTransform != painter->worldTransform()) {
+ if (sourced->currentCachedSystem() != Qt::LogicalCoordinates
+ && sourced->lastEffectTransform != painter->worldTransform())
+ {
sourced->lastEffectTransform = painter->worldTransform();
- sourced->invalidateCache();
+ sourced->invalidateCache(QGraphicsEffectSourcePrivate::TransformChanged);
}
+
item->d_ptr->graphicsEffect->draw(painter);
painter->setWorldTransform(restoreTransform);
sourced->info = 0;
@@ -5085,6 +5095,10 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool
\snippet doc/src/snippets/graphicssceneadditemsnippet.cpp 0
+ \obsolete Since Qt 4.6, this function is not called anymore unless
+ the QGraphicsView::IndirectPainting flag is given as an Optimization
+ flag.
+
\sa drawBackground(), drawForeground()
*/
void QGraphicsScene::drawItems(QPainter *painter,
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp
index 3f9f443..c8f2c7c 100644
--- a/src/gui/graphicsview/qgraphicsview.cpp
+++ b/src/gui/graphicsview/qgraphicsview.cpp
@@ -217,7 +217,9 @@ static const int QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS = 503; // largest prime <
common side effect is that items that do draw with antialiasing can leave
painting traces behind on the scene as they are moved.
- \omitvalue IndirectPainting
+ \value IndirectPainting Since Qt 4.6, restore the old painting algorithm
+ that calls QGraphicsView::drawItems() and QGraphicsScene::drawItems().
+ To be used only for compatibility with old code.
*/
/*!
@@ -545,6 +547,32 @@ qint64 QGraphicsViewPrivate::verticalScroll() const
/*!
\internal
+
+ Maps the given rectangle to the scene using QTransform::mapRect()
+*/
+QRectF QGraphicsViewPrivate::mapRectToScene(const QRect &rect) const
+{
+ if (dirtyScroll)
+ const_cast<QGraphicsViewPrivate *>(this)->updateScroll();
+ QRectF scrolled = QRectF(rect.translated(scrollX, scrollY));
+ return identityMatrix ? scrolled : matrix.inverted().mapRect(scrolled);
+}
+
+
+/*!
+ \internal
+
+ Maps the given rectangle from the scene using QTransform::mapRect()
+*/
+QRectF QGraphicsViewPrivate::mapRectFromScene(const QRectF &rect) const
+{
+ if (dirtyScroll)
+ const_cast<QGraphicsViewPrivate *>(this)->updateScroll();
+ return (identityMatrix ? rect : matrix.mapRect(rect)).translated(-scrollX, -scrollY);
+}
+
+/*!
+ \internal
*/
void QGraphicsViewPrivate::updateScroll()
{
@@ -1182,6 +1210,11 @@ void QGraphicsView::setTransformationAnchor(ViewportAnchor anchor)
{
Q_D(QGraphicsView);
d->transformationAnchor = anchor;
+
+ // Ensure mouse tracking is enabled in the case we are using AnchorUnderMouse
+ // in order to have up-to-date information for centering the view.
+ if (d->transformationAnchor == AnchorUnderMouse)
+ d->viewport->setMouseTracking(true);
}
/*!
@@ -1209,6 +1242,11 @@ void QGraphicsView::setResizeAnchor(ViewportAnchor anchor)
{
Q_D(QGraphicsView);
d->resizeAnchor = anchor;
+
+ // Ensure mouse tracking is enabled in the case we are using AnchorUnderMouse
+ // in order to have up-to-date information for centering the view.
+ if (d->resizeAnchor == AnchorUnderMouse)
+ d->viewport->setMouseTracking(true);
}
/*!
@@ -2571,9 +2609,12 @@ void QGraphicsView::setupViewport(QWidget *widget)
}
// We are only interested in mouse tracking if items
- // accept hover events or use non-default cursors.
- if (d->scene && (!d->scene->d_func()->allItemsIgnoreHoverEvents
- || !d->scene->d_func()->allItemsUseDefaultCursor)) {
+ // accept hover events or use non-default cursors or if
+ // AnchorUnderMouse is used as transformation or resize anchor.
+ if ((d->scene && (!d->scene->d_func()->allItemsIgnoreHoverEvents
+ || !d->scene->d_func()->allItemsUseDefaultCursor))
+ || d->transformationAnchor == AnchorUnderMouse
+ || d->resizeAnchor == AnchorUnderMouse) {
widget->setMouseTracking(true);
}
@@ -3326,7 +3367,8 @@ void QGraphicsView::paintEvent(QPaintEvent *event)
#define X11 qt_x11Data
#endif
backgroundPainter.setCompositionMode(QPainter::CompositionMode_Source);
- drawBackground(&backgroundPainter, exposedSceneRect);
+ QRectF backgroundExposedSceneRect = mapToScene(d->backgroundPixmapExposed.boundingRect()).boundingRect();
+ drawBackground(&backgroundPainter, backgroundExposedSceneRect);
d->backgroundPixmapExposed = QRegion();
}
@@ -3576,6 +3618,10 @@ void QGraphicsView::drawForeground(QPainter *painter, const QRectF &rect)
The default implementation calls the scene's drawItems() function.
+ \obsolete Since Qt 4.6, this function is not called anymore unless
+ the QGraphicsView::IndirectPainting flag is given as an Optimization
+ flag.
+
\sa drawForeground(), drawBackground(), QGraphicsScene::drawItems()
*/
void QGraphicsView::drawItems(QPainter *painter, int numItems,
diff --git a/src/gui/graphicsview/qgraphicsview.h b/src/gui/graphicsview/qgraphicsview.h
index 2aed0e6..90576e5 100644
--- a/src/gui/graphicsview/qgraphicsview.h
+++ b/src/gui/graphicsview/qgraphicsview.h
@@ -278,6 +278,7 @@ private:
friend class QGraphicsSceneWidget;
friend class QGraphicsScene;
friend class QGraphicsScenePrivate;
+ friend class QGraphicsItemPrivate;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsView::CacheMode)
diff --git a/src/gui/graphicsview/qgraphicsview_p.h b/src/gui/graphicsview/qgraphicsview_p.h
index cd161ad..d4b718e 100644
--- a/src/gui/graphicsview/qgraphicsview_p.h
+++ b/src/gui/graphicsview/qgraphicsview_p.h
@@ -86,6 +86,9 @@ public:
qint64 horizontalScroll() const;
qint64 verticalScroll() const;
+ QRectF mapRectToScene(const QRect &rect) const;
+ QRectF mapRectFromScene(const QRectF &rect) const;
+
QPointF mousePressItemPoint;
QPointF mousePressScenePoint;
QPoint mousePressViewPoint;
diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp
index fe569f4..8de81c2 100644
--- a/src/gui/graphicsview/qgraphicswidget.cpp
+++ b/src/gui/graphicsview/qgraphicswidget.cpp
@@ -1054,7 +1054,7 @@ QVariant QGraphicsWidget::itemChange(GraphicsItemChange change, const QVariant &
break;
case ItemParentChange: {
QGraphicsItem *parent = qVariantValue<QGraphicsItem *>(value);
- d->fixFocusChainBeforeReparenting((parent && parent->isWidget()) ? static_cast<QGraphicsWidget *>(parent) : 0);
+ d->fixFocusChainBeforeReparenting((parent && parent->isWidget()) ? static_cast<QGraphicsWidget *>(parent) : 0, scene());
// Deliver ParentAboutToChange.
QEvent event(QEvent::ParentAboutToChange);
diff --git a/src/gui/graphicsview/qgraphicswidget_p.cpp b/src/gui/graphicsview/qgraphicswidget_p.cpp
index b747a30..5b6490f 100644
--- a/src/gui/graphicsview/qgraphicswidget_p.cpp
+++ b/src/gui/graphicsview/qgraphicswidget_p.cpp
@@ -743,7 +743,7 @@ bool QGraphicsWidgetPrivate::hasDecoration() const
/**
* is called after a reparent has taken place to fix up the focus chain(s)
*/
-void QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(QGraphicsWidget *newParent, QGraphicsScene *newScene)
+void QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(QGraphicsWidget *newParent, QGraphicsScene *oldScene, QGraphicsScene *newScene)
{
Q_Q(QGraphicsWidget);
@@ -789,7 +789,7 @@ void QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(QGraphicsWidget *new
// update tabFocusFirst for oldScene if the item is going to be removed from oldScene
if (newParent)
newScene = newParent->scene();
- QGraphicsScene *oldScene = q->scene();
+
if (oldScene && newScene != oldScene)
oldScene->d_func()->tabFocusFirst = firstOld;
diff --git a/src/gui/graphicsview/qgraphicswidget_p.h b/src/gui/graphicsview/qgraphicswidget_p.h
index eb53649..65e6962 100644
--- a/src/gui/graphicsview/qgraphicswidget_p.h
+++ b/src/gui/graphicsview/qgraphicswidget_p.h
@@ -98,7 +98,7 @@ public:
mutable qreal *margins;
void ensureMargins() const;
- void fixFocusChainBeforeReparenting(QGraphicsWidget *newParent, QGraphicsScene *newScene = 0);
+ void fixFocusChainBeforeReparenting(QGraphicsWidget *newParent, QGraphicsScene *oldScene, QGraphicsScene *newScene = 0);
void setLayout_helper(QGraphicsLayout *l);
// Layouts
diff --git a/src/gui/graphicsview/qgridlayoutengine.cpp b/src/gui/graphicsview/qgridlayoutengine.cpp
index f61360a..1fece7a 100644
--- a/src/gui/graphicsview/qgridlayoutengine.cpp
+++ b/src/gui/graphicsview/qgridlayoutengine.cpp
@@ -51,6 +51,7 @@
#include "qvarlengtharray.h"
#include <QtDebug>
+#include <QtCore/qmath.h>
QT_BEGIN_NAMESPACE
@@ -70,7 +71,7 @@ static void insertOrRemoveItems(QVector<T> &items, int index, int delta)
static qreal growthFactorBelowPreferredSize(qreal desired, qreal sumAvailable, qreal sumDesired)
{
Q_ASSERT(sumDesired != 0.0);
- return desired * ::pow(sumAvailable / sumDesired, desired / sumDesired);
+ return desired * qPow(sumAvailable / sumDesired, desired / sumDesired);
}
static qreal fixedDescent(qreal descent, qreal ascent, qreal targetSize)
@@ -181,9 +182,9 @@ void QGridLayoutRowData::distributeMultiCells()
QVarLengthArray<qreal> newSizes(span);
for (int j = 0; j < NSizes; ++j) {
- qreal extra = compare(totalBox, box, j);
+ qreal extra = compare(box, totalBox, j);
if (extra > 0.0) {
- calculateGeometries(start, end, totalBox.q_sizes(j), dummy.data(), newSizes.data(),
+ calculateGeometries(start, end, box.q_sizes(j), dummy.data(), newSizes.data(),
0, totalBox);
for (int k = 0; k < span; ++k)
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index ec8dd88..be1190b 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -696,7 +696,9 @@ bool QImageData::checkForAlphaPixels() const
/*!
\enum QImage::Format
- The following image formats are available in all versions of Qt:
+ The following image formats are available in Qt. Values greater
+ than QImage::Format_RGB16 were added in Qt 4.4. See the notes
+ after the table.
\value Format_Invalid The image is invalid.
\value Format_Mono The image is stored using 1-bit per pixel. Bytes are
@@ -705,17 +707,12 @@ bool QImageData::checkForAlphaPixels() const
packed with the less significant bit (LSB) first.
\value Format_Indexed8 The image is stored using 8-bit indexes
- into a colormap. \warning Drawing into a
- QImage with Indexed8 format is not
- supported.
+ into a colormap.
\value Format_RGB32 The image is stored using a 32-bit RGB format (0xffRRGGBB).
\value Format_ARGB32 The image is stored using a 32-bit ARGB
- format (0xAARRGGBB). \warning Do not
- render into ARGB32 images using
- QPainter. Format_ARGB32_Premultiplied is
- significantly faster.
+ format (0xAARRGGBB).
\value Format_ARGB32_Premultiplied The image is stored using a premultiplied 32-bit
ARGB format (0xAARRGGBB), i.e. the red,
@@ -744,6 +741,12 @@ bool QImageData::checkForAlphaPixels() const
\value Format_ARGB4444_Premultiplied The image is stored using a
premultiplied 16-bit ARGB format (4-4-4-4).
+ \note Drawing into a QImage with QImage::Format_Indexed8 is not
+ supported.
+
+ \note Do not render into ARGB32 images using QPainter. Using
+ QImage::Format_ARGB32_Premultiplied is significantly faster.
+
\sa format(), convertToFormat()
*/
diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h
index d8809ef..ce7f450 100644
--- a/src/gui/image/qimage.h
+++ b/src/gui/image/qimage.h
@@ -165,12 +165,16 @@ public:
QRect rect() const;
int depth() const;
+#ifdef QT_DEPRECATED
QT_DEPRECATED int numColors() const;
+#endif
int colorCount() const;
QRgb color(int i) const;
void setColor(int i, QRgb c);
+#ifdef QT_DEPRECATED
QT_DEPRECATED void setNumColors(int);
+#endif
void setColorCount(int);
bool allGray() const;
@@ -178,7 +182,9 @@ public:
uchar *bits();
const uchar *bits() const;
+#ifdef QT_DEPRECATED
QT_DEPRECATED int numBytes() const;
+#endif
int byteCount() const;
uchar *scanLine(int);
diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp
index 074f3eb..7580446 100644
--- a/src/gui/image/qimagereader.cpp
+++ b/src/gui/image/qimagereader.cpp
@@ -471,7 +471,6 @@ QImageReaderPrivate::QImageReaderPrivate(QImageReader *qq)
handler = 0;
quality = -1;
imageReaderError = QImageReader::UnknownError;
- errorString = QLatin1String(QT_TRANSLATE_NOOP(QImageReader, "Unknown error"));
q = qq;
}
@@ -1214,11 +1213,12 @@ bool QImageReader::jumpToImage(int imageNumber)
}
/*!
- For image formats that support animation, this function returns
- the number of times the animation should loop. Otherwise, it
- returns -1.
+ For image formats that support animation, this function returns the number
+ of times the animation should loop. If this function returns -1, it can
+ either mean the animation should loop forever, or that an error occurred.
+ If an error occurred, canRead() will return false.
- \sa supportsAnimation(), QImageIOHandler::loopCount()
+ \sa supportsAnimation(), QImageIOHandler::loopCount(), canRead()
*/
int QImageReader::loopCount() const
{
@@ -1228,13 +1228,13 @@ int QImageReader::loopCount() const
}
/*!
- For image formats that support animation, this function returns
- the total number of images in the animation.
+ For image formats that support animation, this function returns the total
+ number of images in the animation. If the format does not support
+ animation, 0 is returned.
- Certain animation formats do not support this feature, in which
- case 0 is returned.
+ This function returns -1 if an error occurred.
- \sa supportsAnimation(), QImageIOHandler::imageCount()
+ \sa supportsAnimation(), QImageIOHandler::imageCount(), canRead()
*/
int QImageReader::imageCount() const
{
@@ -1244,11 +1244,13 @@ int QImageReader::imageCount() const
}
/*!
- For image formats that support animation, this function returns
- the number of milliseconds to wait until displaying the next frame
- in the animation. Otherwise, 0 is returned.
+ For image formats that support animation, this function returns the number
+ of milliseconds to wait until displaying the next frame in the animation.
+ If the image format doesn't support animation, 0 is returned.
+
+ This function returns -1 if an error occurred.
- \sa supportsAnimation(), QImageIOHandler::nextImageDelay()
+ \sa supportsAnimation(), QImageIOHandler::nextImageDelay(), canRead()
*/
int QImageReader::nextImageDelay() const
{
@@ -1258,11 +1260,13 @@ int QImageReader::nextImageDelay() const
}
/*!
- For image formats that support animation, this function returns
- the sequence number of the current frame. Otherwise, -1 is
- returned.
+ For image formats that support animation, this function returns the
+ sequence number of the current frame. If the image format doesn't support
+ animation, 0 is returned.
+
+ This function returns -1 if an error occurred.
- \sa supportsAnimation(), QImageIOHandler::currentImageNumber()
+ \sa supportsAnimation(), QImageIOHandler::currentImageNumber(), canRead()
*/
int QImageReader::currentImageNumber() const
{
@@ -1302,6 +1306,8 @@ QImageReader::ImageReaderError QImageReader::error() const
*/
QString QImageReader::errorString() const
{
+ if (d->errorString.isEmpty())
+ return QLatin1String(QT_TRANSLATE_NOOP(QImageReader, "Unknown error"));
return d->errorString;
}
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 617cfe5..7e4597e 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -831,14 +831,13 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers
if (QPixmapCache::find(key, *this))
return true;
- if (!data)
- data = QPixmapData::create(0, 0, QPixmapData::PixmapType);
-
- if (data->fromFile(fileName, format, flags)) {
+ QPixmapData *tmp = QPixmapData::create(0, 0, QPixmapData::PixmapType);
+ if (tmp->fromFile(fileName, format, flags)) {
+ data = tmp;
QPixmapCache::insert(key, *this);
return true;
}
-
+ delete tmp;
return false;
}
diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h
index d95b4ee..e02b0d6 100644
--- a/src/gui/image/qpixmap.h
+++ b/src/gui/image/qpixmap.h
@@ -185,7 +185,9 @@ public:
const uchar *qwsBits() const;
int qwsBytesPerLine() const;
QRgb *clut() const;
+#ifdef QT_DEPRECATED
QT_DEPRECATED int numCols() const;
+#endif
int colorCount() const;
#elif defined(Q_WS_MAC)
Qt::HANDLE macQDHandle() const;
diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp
index 1b01e6f..3c1d7e9 100644
--- a/src/gui/image/qpixmap_raster.cpp
+++ b/src/gui/image/qpixmap_raster.cpp
@@ -375,7 +375,7 @@ int QRasterPixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const
case QPaintDevice::PdmWidthMM:
return qRound(d->width * 25.4 / qt_defaultDpiX());
case QPaintDevice::PdmHeightMM:
- return qRound(d->width * 25.4 / qt_defaultDpiY());
+ return qRound(d->height * 25.4 / qt_defaultDpiY());
case QPaintDevice::PdmNumColors:
return d->colortable.size();
case QPaintDevice::PdmDepth:
diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp
index dc33ade..8194db5 100644
--- a/src/gui/image/qpixmap_s60.cpp
+++ b/src/gui/image/qpixmap_s60.cpp
@@ -235,7 +235,7 @@ static CFbsBitmap* uncompress(CFbsBitmap* bitmap)
QT_TRAP_THROWING(bitmapGc = CFbsBitGc::NewL());
bitmapGc->Activate(bitmapDevice);
- bitmapGc->DrawBitmap(TPoint(), bitmap);
+ bitmapGc->BitBlt(TPoint(), bitmap);
delete bitmapGc;
delete bitmapDevice;
@@ -346,8 +346,6 @@ QPixmap QPixmap::fromSymbianCFbsBitmap(CFbsBitmap *bitmap)
QS60PixmapData::QS60PixmapData(PixelType type) : QRasterPixmapData(type),
symbianBitmapDataAccess(new QSymbianBitmapDataAccess),
cfbsBitmap(0),
- bitmapDevice(0),
- bitmapGc(0),
pengine(0),
bytes(0),
formatLocked(false)
@@ -385,8 +383,6 @@ void QS60PixmapData::resize(int width, int height)
if(cfbsBitmap->SizeInPixels() != newSize) {
cfbsBitmap->Resize(TSize(width, height));
- bitmapDevice->Resize(TSize(width, height));
- bitmapGc->Resized();
if(pengine) {
delete pengine;
pengine = 0;
@@ -397,21 +393,10 @@ void QS60PixmapData::resize(int width, int height)
}
}
-bool QS60PixmapData::initSymbianBitmapContext()
-{
- QT_TRAP_THROWING(bitmapDevice = CFbsBitmapDevice::NewL(cfbsBitmap));
- QT_TRAP_THROWING(bitmapGc = CFbsBitGc::NewL());
- bitmapGc->Activate(bitmapDevice);
-
- return true;
-}
-
void QS60PixmapData::release()
{
if (cfbsBitmap) {
QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
- delete bitmapGc;
- delete bitmapDevice;
delete cfbsBitmap;
lock.relock();
}
@@ -419,8 +404,6 @@ void QS60PixmapData::release()
delete pengine;
image = QImage();
cfbsBitmap = 0;
- bitmapGc = 0;
- bitmapDevice = 0;
pengine = 0;
bytes = 0;
}
@@ -428,42 +411,52 @@ void QS60PixmapData::release()
/*!
* Takes ownership of bitmap. Used by window surface
*/
-void QS60PixmapData::fromSymbianBitmap(CFbsBitmap* bitmap)
+void QS60PixmapData::fromSymbianBitmap(CFbsBitmap* bitmap, bool lockFormat)
{
- cfbsBitmap = bitmap;
- formatLocked = true;
+ Q_ASSERT(bitmap);
- if(!initSymbianBitmapContext()) {
- qWarning("Could not create CBitmapContext");
- release();
- return;
- }
+ release();
+
+ cfbsBitmap = bitmap;
+ formatLocked = lockFormat;
- setSerialNumber(cfbsBitmap->Handle());
+ setSerialNumber(cfbsBitmap->Handle());
- UPDATE_BUFFER();
+ UPDATE_BUFFER();
- // Create default palette if needed
- if (cfbsBitmap->DisplayMode() == EGray2) {
- image.setColorCount(2);
- image.setColor(0, QColor(Qt::color0).rgba());
- image.setColor(1, QColor(Qt::color1).rgba());
+ // Create default palette if needed
+ if (cfbsBitmap->DisplayMode() == EGray2) {
+ image.setColorCount(2);
+ image.setColor(0, QColor(Qt::color0).rgba());
+ image.setColor(1, QColor(Qt::color1).rgba());
//Symbian thinks set pixels are white/transparent, Qt thinks they are foreground/solid
//So invert mono bitmaps so that masks work correctly.
image.invertPixels();
- } else if (cfbsBitmap->DisplayMode() == EGray256) {
- for (int i=0; i < 256; ++i)
- image.setColor(i, qRgb(i, i, i));
- }else if (cfbsBitmap->DisplayMode() == EColor256) {
- const TColor256Util *palette = TColor256Util::Default();
- for (int i=0; i < 256; ++i)
- image.setColor(i, (QRgb)(palette->Color256(i).Value()));
- }
+ } else if (cfbsBitmap->DisplayMode() == EGray256) {
+ for (int i=0; i < 256; ++i)
+ image.setColor(i, qRgb(i, i, i));
+ } else if (cfbsBitmap->DisplayMode() == EColor256) {
+ const TColor256Util *palette = TColor256Util::Default();
+ for (int i=0; i < 256; ++i)
+ image.setColor(i, (QRgb)(palette->Color256(i).Value()));
+ }
+}
+
+QImage QS60PixmapData::toImage(const QRect &r) const
+{
+ QS60PixmapData *that = const_cast<QS60PixmapData*>(this);
+ that->beginDataAccess();
+ QImage copy = that->image.copy(r);
+ that->endDataAccess();
+
+ return copy;
}
void QS60PixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags)
{
+ release();
+
QImage sourceImage;
if (pixelType() == BitmapType) {
@@ -517,8 +510,8 @@ void QS60PixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags
}
cfbsBitmap = createSymbianCFbsBitmap(TSize(sourceImage.width(), sourceImage.height()), mode);
- if (!(cfbsBitmap && initSymbianBitmapContext())) {
- qWarning("Could not create CFbsBitmap and/or CBitmapContext");
+ if (!cfbsBitmap) {
+ qWarning("Could not create CFbsBitmap");
release();
return;
}
@@ -544,17 +537,8 @@ void QS60PixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags
void QS60PixmapData::copy(const QPixmapData *data, const QRect &rect)
{
- if (data->pixelType() == BitmapType) {
- QBitmap::fromImage(data->toImage().copy(rect));
- return;
- }
-
const QS60PixmapData *s60Data = static_cast<const QS60PixmapData*>(data);
-
- resize(rect.width(), rect.height());
- cfbsBitmap->SetDisplayMode(s60Data->cfbsBitmap->DisplayMode());
-
- bitmapGc->BitBlt(TPoint(0, 0), s60Data->cfbsBitmap, qt_QRect2TRect(rect));
+ fromImage(s60Data->toImage(rect), Qt::AutoColor | Qt::OrderedAlphaDither);
}
bool QS60PixmapData::scroll(int dx, int dy, const QRect &rect)
@@ -661,12 +645,7 @@ void QS60PixmapData::setAlphaChannel(const QPixmap &alphaChannel)
QImage QS60PixmapData::toImage() const
{
- QS60PixmapData *that = const_cast<QS60PixmapData*>(this);
- that->beginDataAccess();
- QImage copy = that->image.copy();
- that->endDataAccess();
-
- return copy;
+ return toImage(QRect());
}
QPaintEngine* QS60PixmapData::paintEngine() const
@@ -820,7 +799,9 @@ void* QS60PixmapData::toNativeType(NativeType type)
if(displayMode == EGray2) {
//Symbian thinks set pixels are white/transparent, Qt thinks they are foreground/solid
//So invert mono bitmaps so that masks work correctly.
+ beginDataAccess();
image.invertPixels();
+ endDataAccess();
needsCopy = true;
}
@@ -828,7 +809,9 @@ void* QS60PixmapData::toNativeType(NativeType type)
QImage source;
if (convertToArgb32) {
+ beginDataAccess();
source = image.convertToFormat(QImage::Format_ARGB32);
+ endDataAccess();
displayMode = EColor16MA;
} else {
source = image;
@@ -858,7 +841,9 @@ void* QS60PixmapData::toNativeType(NativeType type)
if(displayMode == EGray2) {
// restore pixels
+ beginDataAccess();
image.invertPixels();
+ endDataAccess();
}
return reinterpret_cast<void*>(bitmap);
diff --git a/src/gui/image/qpixmap_s60_p.h b/src/gui/image/qpixmap_s60_p.h
index 8631ebd..2d93622 100644
--- a/src/gui/image/qpixmap_s60_p.h
+++ b/src/gui/image/qpixmap_s60_p.h
@@ -109,14 +109,12 @@ public:
private:
void release();
- void fromSymbianBitmap(CFbsBitmap* bitmap);
- bool initSymbianBitmapContext();
+ void fromSymbianBitmap(CFbsBitmap* bitmap, bool lockFormat=false);
+ QImage toImage(const QRect &r) const;
QSymbianBitmapDataAccess *symbianBitmapDataAccess;
CFbsBitmap *cfbsBitmap;
- CFbsBitmapDevice *bitmapDevice;
- CFbsBitGc *bitmapGc;
QPaintEngine *pengine;
uchar* bytes;
diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp
index 7008fbd..f3947ff 100644
--- a/src/gui/image/qpixmap_x11.cpp
+++ b/src/gui/image/qpixmap_x11.cpp
@@ -1932,6 +1932,8 @@ QPixmap QX11PixmapData::transformed(const QTransform &transform,
x11Data->hd = (Qt::HANDLE)XCreatePixmap(X11->display,
RootWindow(X11->display, xinfo.screen()),
w, h, d);
+ x11Data->setSerialNumber(++qt_pixmap_serial);
+
#ifndef QT_NO_XRENDER
if (X11->use_xrender) {
XRenderPictFormat *format = x11Data->d == 32
diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp
index b0b7d72..b7b29d7 100644
--- a/src/gui/image/qpixmapcache.cpp
+++ b/src/gui/image/qpixmapcache.cpp
@@ -424,6 +424,11 @@ QPixmapCache::KeyData* QPMCache::getKeyData(QPixmapCache::Key *key)
Q_GLOBAL_STATIC(QPMCache, pm_cache)
+int Q_AUTOTEST_EXPORT q_QPixmapCache_keyHashSize()
+{
+ return pm_cache()->size();
+}
+
QPixmapCacheEntry::~QPixmapCacheEntry()
{
pm_cache()->releaseKey(key);
diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp
index 3723500..939b86d 100644
--- a/src/gui/image/qpixmapfilter.cpp
+++ b/src/gui/image/qpixmapfilter.cpp
@@ -52,6 +52,10 @@
#include "private/qgraphicssystem_p.h"
#include "private/qpaintengineex_p.h"
#include "private/qpaintengine_raster_p.h"
+#include "qmath.h"
+#include "private/qmath_p.h"
+#include "private/qmemrotate_p.h"
+#include "private/qdrawhelper_p.h"
#ifndef QT_NO_GRAPHICSEFFECT
QT_BEGIN_NAMESPACE
@@ -585,106 +589,338 @@ QGraphicsBlurEffect::BlurHints QPixmapBlurFilter::blurHints() const
return d->hints;
}
+const qreal radiusScale = qreal(2.5);
+
/*!
\internal
*/
QRectF QPixmapBlurFilter::boundingRectFor(const QRectF &rect) const
{
Q_D(const QPixmapBlurFilter);
- const qreal delta = d->radius + 1;
+ const qreal delta = radiusScale * d->radius + 1;
return rect.adjusted(-delta, -delta, delta, delta);
}
-// Blur the image according to the blur radius
-// Based on exponential blur algorithm by Jani Huhtanen
-// (maximum radius is set to 16)
-static QImage blurred(const QImage& image, const QRect& rect, int radius, bool alphaOnly = false)
+template <int shift>
+inline int qt_static_shift(int value)
{
- int tab[] = { 14, 10, 8, 6, 5, 5, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2 };
- int alpha = (radius < 1) ? 16 : (radius > 17) ? 1 : tab[radius-1];
+ if (shift == 0)
+ return value;
+ else if (shift > 0)
+ return value << (uint(shift) & 0x1f);
+ else
+ return value >> (uint(-shift) & 0x1f);
+}
- QImage result = image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
- int r1 = rect.top();
- int r2 = rect.bottom();
- int c1 = rect.left();
- int c2 = rect.right();
+template<int aprec, int zprec>
+inline void qt_blurinner(uchar *bptr, int &zR, int &zG, int &zB, int &zA, int alpha)
+{
+ QRgb *pixel = (QRgb *)bptr;
+
+#define Z_MASK (0xff << zprec)
+ const int A_zprec = qt_static_shift<zprec - 24>(*pixel) & Z_MASK;
+ const int R_zprec = qt_static_shift<zprec - 16>(*pixel) & Z_MASK;
+ const int G_zprec = qt_static_shift<zprec - 8>(*pixel) & Z_MASK;
+ const int B_zprec = qt_static_shift<zprec>(*pixel) & Z_MASK;
+#undef Z_MASK
+
+ const int zR_zprec = zR >> aprec;
+ const int zG_zprec = zG >> aprec;
+ const int zB_zprec = zB >> aprec;
+ const int zA_zprec = zA >> aprec;
+
+ zR += alpha * (R_zprec - zR_zprec);
+ zG += alpha * (G_zprec - zG_zprec);
+ zB += alpha * (B_zprec - zB_zprec);
+ zA += alpha * (A_zprec - zA_zprec);
+
+#define ZA_MASK (0xff << (zprec + aprec))
+ *pixel =
+ qt_static_shift<24 - zprec - aprec>(zA & ZA_MASK)
+ | qt_static_shift<16 - zprec - aprec>(zR & ZA_MASK)
+ | qt_static_shift<8 - zprec - aprec>(zG & ZA_MASK)
+ | qt_static_shift<-zprec - aprec>(zB & ZA_MASK);
+#undef ZA_MASK
+}
- int bpl = result.bytesPerLine();
- int rgba[4];
- unsigned char* p;
+const int alphaIndex = (QSysInfo::ByteOrder == QSysInfo::BigEndian ? 0 : 3);
- int i1 = 0;
- int i2 = 3;
+template<int aprec, int zprec>
+inline void qt_blurinner_alphaOnly(uchar *bptr, int &z, int alpha)
+{
+ const int A_zprec = int(*(bptr)) << zprec;
+ const int z_zprec = z >> aprec;
+ z += alpha * (A_zprec - z_zprec);
+ *(bptr) = z >> (zprec + aprec);
+}
- if (alphaOnly)
- i1 = i2 = (QSysInfo::ByteOrder == QSysInfo::BigEndian ? 0 : 3);
+template<int aprec, int zprec, bool alphaOnly>
+inline void qt_blurrow(QImage & im, int line, int alpha)
+{
+ uchar *bptr = im.scanLine(line);
+
+ int zR = 0, zG = 0, zB = 0, zA = 0;
+
+ if (alphaOnly && im.format() != QImage::Format_Indexed8)
+ bptr += alphaIndex;
+
+ const int stride = im.depth() >> 3;
+ const int im_width = im.width();
+ for (int index = 0; index < im_width; ++index) {
+ if (alphaOnly)
+ qt_blurinner_alphaOnly<aprec, zprec>(bptr, zA, alpha);
+ else
+ qt_blurinner<aprec, zprec>(bptr, zR, zG, zB, zA, alpha);
+ bptr += stride;
+ }
+
+ bptr -= stride;
+
+ for (int index = im_width - 2; index >= 0; --index) {
+ bptr -= stride;
+ if (alphaOnly)
+ qt_blurinner_alphaOnly<aprec, zprec>(bptr, zA, alpha);
+ else
+ qt_blurinner<aprec, zprec>(bptr, zR, zG, zB, zA, alpha);
+ }
+}
+
+/*
+* expblur(QImage &img, int radius)
+*
+* Based on exponential blur algorithm by Jani Huhtanen
+*
+* In-place blur of image 'img' with kernel
+* of approximate radius 'radius'.
+*
+* Blurs with two sided exponential impulse
+* response.
+*
+* aprec = precision of alpha parameter
+* in fixed-point format 0.aprec
+*
+* zprec = precision of state parameters
+* zR,zG,zB and zA in fp format 8.zprec
+*/
+template <int aprec, int zprec, bool alphaOnly>
+void expblur(QImage &img, qreal radius, bool improvedQuality = false, int transposed = 0)
+{
+ // halve the radius if we're using two passes
+ if (improvedQuality)
+ radius *= qreal(0.5);
+
+ Q_ASSERT(img.format() == QImage::Format_ARGB32_Premultiplied
+ || img.format() == QImage::Format_RGB32);
+
+ // choose the alpha such that pixels at radius distance from a fully
+ // saturated pixel will have an alpha component of no greater than
+ // the cutOffIntensity
+ const qreal cutOffIntensity = 2;
+ int alpha = radius <= qreal(1e-5)
+ ? ((1 << aprec)-1)
+ : qRound((1<<aprec)*(1 - qPow(cutOffIntensity * (1 / qreal(255)), 1 / radius)));
+
+ int img_height = img.height();
+ for (int row = 0; row < img_height; ++row) {
+ for (int i = 0; i <= improvedQuality; ++i)
+ qt_blurrow<aprec, zprec, alphaOnly>(img, row, alpha);
+ }
+
+ QImage temp(img.height(), img.width(), img.format());
+ if (transposed >= 0) {
+ if (img.depth() == 8) {
+ qt_memrotate270(reinterpret_cast<const quint8*>(img.bits()),
+ img.width(), img.height(), img.bytesPerLine(),
+ reinterpret_cast<quint8*>(temp.bits()),
+ temp.bytesPerLine());
+ } else {
+ qt_memrotate270(reinterpret_cast<const quint32*>(img.bits()),
+ img.width(), img.height(), img.bytesPerLine(),
+ reinterpret_cast<quint32*>(temp.bits()),
+ temp.bytesPerLine());
+ }
+ } else {
+ if (img.depth() == 8) {
+ qt_memrotate90(reinterpret_cast<const quint8*>(img.bits()),
+ img.width(), img.height(), img.bytesPerLine(),
+ reinterpret_cast<quint8*>(temp.bits()),
+ temp.bytesPerLine());
+ } else {
+ qt_memrotate90(reinterpret_cast<const quint32*>(img.bits()),
+ img.width(), img.height(), img.bytesPerLine(),
+ reinterpret_cast<quint32*>(temp.bits()),
+ temp.bytesPerLine());
+ }
+ }
- for (int col = c1; col <= c2; col++) {
- p = result.scanLine(r1) + col * 4;
- for (int i = i1; i <= i2; i++)
- rgba[i] = p[i] << 4;
+ img_height = temp.height();
+ for (int row = 0; row < img_height; ++row) {
+ for (int i = 0; i <= improvedQuality; ++i)
+ qt_blurrow<aprec, zprec, alphaOnly>(temp, row, alpha);
+ }
- p += bpl;
- for (int j = r1; j < r2; j++, p += bpl)
- for (int i = i1; i <= i2; i++)
- p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
+ if (transposed == 0) {
+ qt_memrotate90(reinterpret_cast<const quint32*>(temp.bits()),
+ temp.width(), temp.height(), temp.bytesPerLine(),
+ reinterpret_cast<quint32*>(img.bits()),
+ img.bytesPerLine());
+ } else {
+ img = temp;
}
+}
+#define AVG(a,b) ( ((((a)^(b)) & 0xfefefefeUL) >> 1) + ((a)&(b)) )
+#define AVG16(a,b) ( ((((a)^(b)) & 0xf7deUL) >> 1) + ((a)&(b)) )
- for (int row = r1; row <= r2; row++) {
- p = result.scanLine(row) + c1 * 4;
- for (int i = i1; i <= i2; i++)
- rgba[i] = p[i] << 4;
+Q_GUI_EXPORT QImage qt_halfScaled(const QImage &source)
+{
+ QImage srcImage = source;
+
+ if (source.format() == QImage::Format_Indexed8) {
+ // assumes grayscale
+ QImage dest(source.width() / 2, source.height() / 2, srcImage.format());
+
+ const uchar *src = reinterpret_cast<const uchar*>(const_cast<const QImage &>(srcImage).bits());
+ int sx = srcImage.bytesPerLine();
+ int sx2 = sx << 1;
+
+ uchar *dst = reinterpret_cast<uchar*>(dest.bits());
+ int dx = dest.bytesPerLine();
+ int ww = dest.width();
+ int hh = dest.height();
+
+ for (int y = hh; y; --y, dst += dx, src += sx2) {
+ const uchar *p1 = src;
+ const uchar *p2 = src + sx;
+ uchar *q = dst;
+ for (int x = ww; x; --x, ++q, p1 += 2, p2 += 2)
+ *q = ((int(p1[0]) + int(p1[1]) + int(p2[0]) + int(p2[1])) + 2) >> 2;
+ }
+
+ return dest;
+ } else if (source.format() == QImage::Format_ARGB8565_Premultiplied) {
+ QImage dest(source.width() / 2, source.height() / 2, srcImage.format());
+
+ const uchar *src = reinterpret_cast<const uchar*>(const_cast<const QImage &>(srcImage).bits());
+ int sx = srcImage.bytesPerLine();
+ int sx2 = sx << 1;
+
+ uchar *dst = reinterpret_cast<uchar*>(dest.bits());
+ int dx = dest.bytesPerLine();
+ int ww = dest.width();
+ int hh = dest.height();
+
+ for (int y = hh; y; --y, dst += dx, src += sx2) {
+ const uchar *p1 = src;
+ const uchar *p2 = src + sx;
+ uchar *q = dst;
+ for (int x = ww; x; --x, q += 3, p1 += 6, p2 += 6) {
+ // alpha
+ q[0] = AVG(AVG(p1[0], p1[3]), AVG(p2[0], p2[3]));
+ // rgb
+ const quint16 p16_1 = (p1[2] << 8) | p1[1];
+ const quint16 p16_2 = (p1[5] << 8) | p1[4];
+ const quint16 p16_3 = (p2[2] << 8) | p2[1];
+ const quint16 p16_4 = (p2[5] << 8) | p2[4];
+ const quint16 result = AVG16(AVG16(p16_1, p16_2), AVG16(p16_3, p16_4));
+ q[1] = result & 0xff;
+ q[2] = result >> 8;
+ }
+ }
- p += 4;
- for (int j = c1; j < c2; j++, p += 4)
- for (int i = i1; i <= i2; i++)
- p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
+ return dest;
+ } else if (source.format() != QImage::Format_ARGB32_Premultiplied
+ && source.format() != QImage::Format_RGB32)
+ {
+ srcImage = source.convertToFormat(QImage::Format_ARGB32_Premultiplied);
}
- for (int col = c1; col <= c2; col++) {
- p = result.scanLine(r2) + col * 4;
- for (int i = i1; i <= i2; i++)
- rgba[i] = p[i] << 4;
+ QImage dest(source.width() / 2, source.height() / 2, srcImage.format());
+
+ const quint32 *src = reinterpret_cast<const quint32*>(const_cast<const QImage &>(srcImage).bits());
+ int sx = srcImage.bytesPerLine() >> 2;
+ int sx2 = sx << 1;
+
+ quint32 *dst = reinterpret_cast<quint32*>(dest.bits());
+ int dx = dest.bytesPerLine() >> 2;
+ int ww = dest.width();
+ int hh = dest.height();
- p -= bpl;
- for (int j = r1; j < r2; j++, p -= bpl)
- for (int i = i1; i <= i2; i++)
- p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
+ for (int y = hh; y; --y, dst += dx, src += sx2) {
+ const quint32 *p1 = src;
+ const quint32 *p2 = src + sx;
+ quint32 *q = dst;
+ for (int x = ww; x; --x, q++, p1 += 2, p2 += 2)
+ *q = AVG(AVG(p1[0], p1[1]), AVG(p2[0], p2[1]));
}
- for (int row = r1; row <= r2; row++) {
- p = result.scanLine(row) + c2 * 4;
- for (int i = i1; i <= i2; i++)
- rgba[i] = p[i] << 4;
+ return dest;
+}
- p -= 4;
- for (int j = c1; j < c2; j++, p -= 4)
- for (int i = i1; i <= i2; i++)
- p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
+Q_GUI_EXPORT void qt_blurImage(QPainter *p, QImage &blurImage, qreal radius, bool quality, bool alphaOnly, int transposed = 0)
+{
+ if (blurImage.format() != QImage::Format_ARGB32_Premultiplied
+ && blurImage.format() != QImage::Format_RGB32)
+ {
+ blurImage = blurImage.convertToFormat(QImage::Format_ARGB32_Premultiplied);
}
- return result;
+ qreal scale = 1;
+ if (radius >= 4) {
+ blurImage = qt_halfScaled(blurImage);
+ scale = 2;
+ radius *= qreal(0.5);
+ }
+
+ if (alphaOnly)
+ expblur<12, 10, true>(blurImage, radius, quality, transposed);
+ else
+ expblur<12, 10, false>(blurImage, radius, quality, transposed);
+
+ if (p) {
+ p->scale(scale, scale);
+ p->setRenderHint(QPainter::SmoothPixmapTransform);
+ p->drawImage(QRect(0, 0, blurImage.width(), blurImage.height()), blurImage);
+ }
+}
+
+Q_GUI_EXPORT void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed = 0)
+{
+ if (blurImage.format() == QImage::Format_Indexed8)
+ expblur<12, 10, true>(blurImage, radius, quality, transposed);
+ else
+ expblur<12, 10, false>(blurImage, radius, quality, transposed);
}
+bool qt_scaleForTransform(const QTransform &transform, qreal *scale);
+
/*!
\internal
*/
-void QPixmapBlurFilter::draw(QPainter *painter, const QPointF &p, const QPixmap &src, const QRectF &srcRect) const
+void QPixmapBlurFilter::draw(QPainter *painter, const QPointF &p, const QPixmap &src, const QRectF &rect) const
{
Q_D(const QPixmapBlurFilter);
if (!painter->isActive())
return;
- if (d->radius <= 0) {
+ QRectF srcRect = rect;
+ if (srcRect.isNull())
+ srcRect = src.rect();
+
+ if (d->radius <= 1) {
painter->drawPixmap(srcRect.translated(p), src, srcRect);
return;
}
+ qreal scaledRadius = radiusScale * d->radius;
+ qreal scale;
+ if (qt_scaleForTransform(painter->transform(), &scale))
+ scaledRadius /= scale;
+
QPixmapFilter *filter = painter->paintEngine() && painter->paintEngine()->isExtended() ?
static_cast<QPaintEngineEx *>(painter->paintEngine())->pixmapFilter(type(), this) : 0;
QPixmapBlurFilter *blurFilter = static_cast<QPixmapBlurFilter*>(filter);
if (blurFilter) {
- blurFilter->setRadius(d->radius);
+ blurFilter->setRadius(scaledRadius);
blurFilter->setBlurHints(d->hints);
blurFilter->draw(painter, p, src, srcRect);
return;
@@ -693,17 +929,17 @@ void QPixmapBlurFilter::draw(QPainter *painter, const QPointF &p, const QPixmap
QImage srcImage;
QImage destImage;
- if (srcRect.isNull()) {
+ if (srcRect == src.rect()) {
srcImage = src.toImage();
- destImage = blurred(srcImage, srcImage.rect(), qRound(d->radius));
} else {
QRect rect = srcRect.toAlignedRect().intersected(src.rect());
-
srcImage = src.copy(rect).toImage();
- destImage = blurred(srcImage, srcImage.rect(), qRound(d->radius));
}
- painter->drawImage(p, destImage);
+ QTransform transform = painter->worldTransform();
+ painter->translate(p);
+ qt_blurImage(painter, srcImage, scaledRadius, (d->hints & QGraphicsBlurEffect::QualityHint), false);
+ painter->setWorldTransform(transform);
}
// grayscales the image to dest (could be same). If rect isn't defined
@@ -1095,7 +1331,13 @@ void QPixmapDropShadowFilter::draw(QPainter *p,
tmpPainter.end();
// blur the alpha channel
- tmp = blurred(tmp, tmp.rect(), qRound(d->radius), true);
+ QImage blurred(tmp.size(), QImage::Format_ARGB32_Premultiplied);
+ blurred.fill(0);
+ QPainter blurPainter(&blurred);
+ qt_blurImage(&blurPainter, tmp, d->radius, false, true);
+ blurPainter.end();
+
+ tmp = blurred;
// blacken the image...
tmpPainter.begin(&tmp);
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index 14c863b..1de0f32 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -67,6 +67,9 @@ QT_BEGIN_NAMESPACE
# define Q_INTERNAL_WIN_NO_THROW
#endif
+// avoid going through QImage::scanLine() which calls detach
+#define FAST_SCAN_LINE(data, bpl, y) (data + (y) * bpl)
+
/*
All PNG files load to the minimal QImage equivalent.
@@ -510,7 +513,7 @@ bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngImage(QImage *outImage)
&& outImage->format() == QImage::Format_Indexed8) {
int color_table_size = outImage->colorCount();
for (int y=0; y<(int)height; ++y) {
- uchar *p = outImage->scanLine(y);
+ uchar *p = FAST_SCAN_LINE(data, bpl, y);
uchar *end = p + width;
while (p < end) {
if (*p >= color_table_size)
diff --git a/src/gui/image/qppmhandler.cpp b/src/gui/image/qppmhandler.cpp
index 8ec9efb..f2d51f7 100644
--- a/src/gui/image/qppmhandler.cpp
+++ b/src/gui/image/qppmhandler.cpp
@@ -264,7 +264,7 @@ static bool write_pbm_image(QIODevice *out, const QImage &sourceImage, const QBy
bool gray = format == "pgm";
if (format == "pbm") {
- image = image.convertToFormat(QImage::Format_MonoLSB);
+ image = image.convertToFormat(QImage::Format_Mono);
} else if (image.depth() == 1) {
image = image.convertToFormat(QImage::Format_Indexed8);
} else {
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
index a295d66..1bf7662 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
+++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
@@ -139,8 +139,7 @@ void QCoeFepInputContext::widgetDestroyed(QWidget *w)
// Make sure that the input capabilities of whatever new widget got focused are queried.
CCoeControl *ctrl = w->effectiveWinId();
if (ctrl->IsFocused()) {
- ctrl->SetFocus(false);
- ctrl->SetFocus(true);
+ queueInputCapabilitiesChanged();
}
}
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index de6e6cb..f447989 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -70,6 +70,7 @@ QAbstractItemViewPrivate::QAbstractItemViewPrivate()
itemDelegate(0),
selectionModel(0),
ctrlDragSelectionFlag(QItemSelectionModel::NoUpdate),
+ noSelectionOnMousePress(false),
selectionMode(QAbstractItemView::ExtendedSelection),
selectionBehavior(QAbstractItemView::SelectItems),
currentlyCommittingEditor(0),
@@ -1622,6 +1623,7 @@ void QAbstractItemView::mousePressEvent(QMouseEvent *event)
d->pressedIndex = index;
d->pressedModifiers = event->modifiers();
QItemSelectionModel::SelectionFlags command = selectionCommand(index, event);
+ d->noSelectionOnMousePress = command == QItemSelectionModel::NoUpdate || !index.isValid();
QPoint offset = d->offset();
if ((command & QItemSelectionModel::Current) == 0)
d->pressedPosition = pos + offset;
@@ -1760,9 +1762,10 @@ void QAbstractItemView::mouseReleaseEvent(QMouseEvent *event)
d->ctrlDragSelectionFlag = QItemSelectionModel::NoUpdate;
- //in the case the user presses on no item we might decide to clear the selection
- if (d->selectionModel && !index.isValid())
- d->selectionModel->select(QModelIndex(), selectionCommand(index, event));
+ if (d->selectionModel && d->noSelectionOnMousePress) {
+ d->noSelectionOnMousePress = false;
+ d->selectionModel->select(index, selectionCommand(index, event));
+ }
setState(NoState);
@@ -2065,9 +2068,13 @@ void QAbstractItemView::focusInEvent(QFocusEvent *event)
{
Q_D(QAbstractItemView);
QAbstractScrollArea::focusInEvent(event);
- if (selectionModel()
+
+ const QItemSelectionModel* model = selectionModel();
+ const bool currentIndexValid = currentIndex().isValid();
+
+ if (model
&& !d->currentIndexSet
- && !currentIndex().isValid()) {
+ && !currentIndexValid) {
bool autoScroll = d->autoScroll;
d->autoScroll = false;
QModelIndex index = moveCursor(MoveNext, Qt::NoModifier); // first visible index
@@ -2075,6 +2082,17 @@ void QAbstractItemView::focusInEvent(QFocusEvent *event)
selectionModel()->setCurrentIndex(index, QItemSelectionModel::NoUpdate);
d->autoScroll = autoScroll;
}
+
+ if (model && currentIndexValid) {
+ if (currentIndex().flags() != Qt::ItemIsEditable)
+ setAttribute(Qt::WA_InputMethodEnabled, false);
+ else
+ setAttribute(Qt::WA_InputMethodEnabled);
+ }
+
+ if (!currentIndexValid)
+ setAttribute(Qt::WA_InputMethodEnabled, false);
+
d->viewport->update();
}
@@ -2867,6 +2885,8 @@ int QAbstractItemView::sizeHintForRow(int row) const
if (row < 0 || row >= d->model->rowCount() || !model())
return -1;
+ ensurePolished();
+
QStyleOptionViewItemV4 option = d->viewOptionsV4();
int height = 0;
int colCount = d->model->columnCount(d->root);
@@ -2896,6 +2916,8 @@ int QAbstractItemView::sizeHintForColumn(int column) const
if (column < 0 || column >= d->model->columnCount() || !model())
return -1;
+ ensurePolished();
+
QStyleOptionViewItemV4 option = d->viewOptionsV4();
int width = 0;
int rows = d->model->rowCount(d->root);
diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h
index 0b5cfbe..7fc6780 100644
--- a/src/gui/itemviews/qabstractitemview_p.h
+++ b/src/gui/itemviews/qabstractitemview_p.h
@@ -347,6 +347,7 @@ public:
QMap<int, QPointer<QAbstractItemDelegate> > columnDelegates;
QPointer<QItemSelectionModel> selectionModel;
QItemSelectionModel::SelectionFlag ctrlDragSelectionFlag;
+ bool noSelectionOnMousePress;
QAbstractItemView::SelectionMode selectionMode;
QAbstractItemView::SelectionBehavior selectionBehavior;
diff --git a/src/gui/itemviews/qlistwidget.cpp b/src/gui/itemviews/qlistwidget.cpp
index 929d688..0ce0e5e 100644
--- a/src/gui/itemviews/qlistwidget.cpp
+++ b/src/gui/itemviews/qlistwidget.cpp
@@ -173,7 +173,7 @@ void QListModel::move(int srcRow, int dstRow)
{
if (srcRow == dstRow
|| srcRow < 0 || srcRow >= items.count()
- || dstRow < 0 || dstRow >= items.count())
+ || dstRow < 0 || dstRow > items.count())
return;
if (!beginMoveRows(QModelIndex(), srcRow, srcRow, QModelIndex(), dstRow))
diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp
index fc82f30..646a3a1 100644
--- a/src/gui/itemviews/qsortfilterproxymodel.cpp
+++ b/src/gui/itemviews/qsortfilterproxymodel.cpp
@@ -734,6 +734,33 @@ void QSortFilterProxyModelPrivate::source_items_inserted(
}
}
+ if (model->rowCount(source_parent) == delta_item_count) {
+ // Items were inserted where there were none before.
+ // If it was new rows make sure to create mappings for columns so that a
+ // valid mapping can be retreived later and vice-versa.
+
+ QVector<int> &orthogonal_proxy_to_source = (orient == Qt::Horizontal) ? m->source_rows : m->source_columns;
+ QVector<int> &orthogonal_source_to_proxy = (orient == Qt::Horizontal) ? m->proxy_rows : m->proxy_columns;
+
+ if (orthogonal_source_to_proxy.isEmpty()) {
+ const int ortho_end = (orient == Qt::Horizontal) ? model->rowCount(source_parent) : model->columnCount(source_parent);
+
+ for (int ortho_item = 0; ortho_item < ortho_end; ++ortho_item) {
+ if ((orient == Qt::Horizontal) ? q->filterAcceptsRow(ortho_item, source_parent)
+ : q->filterAcceptsColumn(ortho_item, source_parent)) {
+ orthogonal_proxy_to_source.append(ortho_item);
+ }
+ }
+ orthogonal_source_to_proxy.resize(orthogonal_proxy_to_source.size());
+
+ if (orient == Qt::Horizontal) {
+ // We're reacting to columnsInserted, but we've just inserted new rows. Sort them.
+ sort_source_rows(orthogonal_proxy_to_source, source_parent);
+ }
+ build_source_to_proxy_mapping(orthogonal_proxy_to_source, orthogonal_source_to_proxy);
+ }
+ }
+
// Sort and insert the items
if (orient == Qt::Vertical) // Only sort rows
sort_source_rows(source_items, source_parent);
@@ -1171,9 +1198,10 @@ void QSortFilterProxyModelPrivate::_q_sourceLayoutAboutToBeChanged()
{
Q_Q(QSortFilterProxyModel);
saved_persistent_indexes.clear();
+ emit q->layoutAboutToBeChanged();
if (persistent.indexes.isEmpty())
return;
- emit q->layoutAboutToBeChanged();
+
saved_persistent_indexes = store_persistent_indexes();
}
@@ -1181,7 +1209,8 @@ void QSortFilterProxyModelPrivate::_q_sourceLayoutChanged()
{
Q_Q(QSortFilterProxyModel);
if (saved_persistent_indexes.isEmpty()) {
- q->invalidate();
+ clear_mapping();
+ emit q->layoutChanged();
return;
}
diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp
index d27e693..26f5a20 100644
--- a/src/gui/itemviews/qtableview.cpp
+++ b/src/gui/itemviews/qtableview.cpp
@@ -2359,12 +2359,22 @@ void QTableView::setColumnHidden(int column, bool hide)
\property QTableView::sortingEnabled
\brief whether sorting is enabled
- If this property is true, sorting is enabled for the table; if the
- property is false, sorting is not enabled. The default value is false.
+ If this property is true, sorting is enabled for the table. If
+ this property is false, sorting is not enabled. The default value
+ is false.
+
+ \note. Setting the property to true with setSortingEnabled()
+ immediately triggers a call to sortByColumn() with the current
+ sort section and order.
\sa sortByColumn()
*/
+/*!
+ If \a enabled true enables sorting for the table and immediately
+ trigger a call to sortByColumn() with the current sort section and
+ order
+ */
void QTableView::setSortingEnabled(bool enable)
{
Q_D(QTableView);
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp
index 3ad9fbb..bcf9cfb 100644
--- a/src/gui/itemviews/qtreeview.cpp
+++ b/src/gui/itemviews/qtreeview.cpp
@@ -2774,6 +2774,7 @@ int QTreeView::sizeHintForColumn(int column) const
d->executePostedLayout();
if (d->viewItems.isEmpty())
return -1;
+ ensurePolished();
int w = 0;
QStyleOptionViewItemV4 option = d->viewOptionsV4();
const QVector<QTreeViewItem> viewItems = d->viewItems;
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 8c63968..cdd0c1b 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -2096,7 +2096,11 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason)
if (prev) {
#ifdef QT_KEYPAD_NAVIGATION
if (QApplication::keypadNavigationEnabled()) {
- if (prev->hasEditFocus() && reason != Qt::PopupFocusReason)
+ if (prev->hasEditFocus() && reason != Qt::PopupFocusReason
+#ifdef Q_OS_SYMBIAN
+ && reason != Qt::ActiveWindowFocusReason
+#endif
+ )
prev->setEditFocus(false);
}
#endif
@@ -3629,12 +3633,46 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
// walk through parents and check for gestures
if (qt_gestureManager) {
- if (receiver->isWidgetType()) {
- if (qt_gestureManager->filterEvent(static_cast<QWidget *>(receiver), e))
- return true;
- } else if (QGesture *gesture = qobject_cast<QGesture *>(receiver)) {
- if (qt_gestureManager->filterEvent(gesture, e))
- return true;
+ switch (e->type()) {
+ case QEvent::Paint:
+ case QEvent::MetaCall:
+ case QEvent::DeferredDelete:
+ case QEvent::DragEnter: case QEvent::DragMove: case QEvent::DragLeave:
+ case QEvent::Drop: case QEvent::DragResponse:
+ case QEvent::ChildAdded: case QEvent::ChildPolished:
+#ifdef QT3_SUPPORT
+ case QEvent::ChildInsertedRequest:
+ case QEvent::ChildInserted:
+ case QEvent::LayoutHint:
+#endif
+ case QEvent::ChildRemoved:
+ case QEvent::UpdateRequest:
+ case QEvent::UpdateLater:
+ case QEvent::AccessibilityPrepare:
+ case QEvent::LocaleChange:
+ case QEvent::Style:
+ case QEvent::IconDrag:
+ case QEvent::StyleChange:
+ case QEvent::AccessibilityHelp:
+ case QEvent::AccessibilityDescription:
+ case QEvent::GraphicsSceneDragEnter:
+ case QEvent::GraphicsSceneDragMove:
+ case QEvent::GraphicsSceneDragLeave:
+ case QEvent::GraphicsSceneDrop:
+ case QEvent::DynamicPropertyChange:
+ case QEvent::NetworkReplyUpdated:
+ break;
+ default:
+ if (receiver->isWidgetType()) {
+ if (qt_gestureManager->filterEvent(static_cast<QWidget *>(receiver), e))
+ return true;
+ } else {
+ // a special case for events that go to QGesture objects.
+ // We pass the object to the gesture manager and it'll figure
+ // out if it's QGesture or not.
+ if (qt_gestureManager->filterEvent(receiver, e))
+ return true;
+ }
}
}
@@ -5192,6 +5230,8 @@ QInputContext *QApplication::inputContext() const
{
Q_D(const QApplication);
Q_UNUSED(d);// only static members being used.
+ if (QApplicationPrivate::is_app_closing)
+ return d->inputContext;
#ifdef Q_WS_X11
if (!X11)
return 0;
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index ab57c32..27f2644 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -361,6 +361,8 @@ void QSymbianControl::ConstructL(bool isWindowOwning, bool desktop)
SetFocusing(true);
m_longTapDetector = QLongTapTimer::NewL(this);
+
+ DrawableWindow()->SetPointerGrab(ETrue);
}
}
@@ -472,41 +474,6 @@ void QSymbianControl::HandlePointerEventL(const TPointerEvent& pEvent)
QT_TRYCATCH_LEAVING(HandlePointerEvent(pEvent));
}
-typedef QPair<QWidget*,QMouseEvent> Event;
-
-/*
- * Helper function called by HandlePointerEvent - separated to keep that function readable
- */
-static void generateEnterLeaveEvents(QList<Event> &events, QWidget *widgetUnderPointer,
- QPoint globalPos, Qt::MouseButton button, Qt::KeyboardModifiers modifiers)
-{
- //moved to another widget, create enter and leave events
- if (S60->lastPointerEventTarget) {
- QMouseEvent mEventLeave(QEvent::Leave, S60->lastPointerEventTarget->mapFromGlobal(
- S60->lastCursorPos), S60->lastCursorPos, button, QApplicationPrivate::mouse_buttons,
- modifiers);
- events.append(Event(S60->lastPointerEventTarget, mEventLeave));
- }
- if (widgetUnderPointer) {
- QMouseEvent mEventEnter(QEvent::Enter, widgetUnderPointer->mapFromGlobal(globalPos),
- globalPos, button, QApplicationPrivate::mouse_buttons, modifiers);
-
- events.append(Event(widgetUnderPointer, mEventEnter));
-#ifndef QT_NO_CURSOR
- S60->curWin = widgetUnderPointer->effectiveWinId();
- if (!QApplication::overrideCursor()) {
-#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
- if (S60->brokenPointerCursors)
- qt_symbian_set_pointer_sprite(widgetUnderPointer->cursor());
- else
-#endif
- qt_symbian_setWindowCursor(widgetUnderPointer->cursor(), S60->curWin);
- }
-#endif
- }
-}
-
-
void QSymbianControl::HandlePointerEvent(const TPointerEvent& pEvent)
{
QMouseEvent::Type type;
@@ -514,85 +481,77 @@ void QSymbianControl::HandlePointerEvent(const TPointerEvent& pEvent)
mapS60MouseEventTypeToQt(&type, &button, &pEvent);
Qt::KeyboardModifiers modifiers = mapToQtModifiers(pEvent.iModifiers);
- if (type == QMouseEvent::None)
- return;
-
- // store events for later sending/saving
- QList<Event > events;
-
QPoint widgetPos = QPoint(pEvent.iPosition.iX, pEvent.iPosition.iY);
TPoint controlScreenPos = PositionRelativeToScreen();
QPoint globalPos = QPoint(controlScreenPos.iX, controlScreenPos.iY) + widgetPos;
+ S60->lastCursorPos = globalPos;
+ S60->lastPointerEventPos = widgetPos;
- // widgets interested in the event
- QWidget *widgetUnderPointer = qwidget->childAt(widgetPos);
- if (!widgetUnderPointer)
- widgetUnderPointer = qwidget; //i.e. this container widget
+ QWidget *mouseGrabber = QWidget::mouseGrabber();
- QWidget *widgetWithMouseGrab = QWidget::mouseGrabber();
+ QWidget *popupWidget = qApp->activePopupWidget();
+ QWidget *popupReceiver = 0;
+ if (popupWidget) {
+ QWidget *popupChild = popupWidget->childAt(popupWidget->mapFromGlobal(globalPos));
+ popupReceiver = popupChild ? popupChild : popupWidget;
+ }
- // handle auto grab of pointer when pressing / releasing
- if (!widgetWithMouseGrab && type == QEvent::MouseButtonPress) {
- //if previously auto-grabbed, generate a fake mouse release (platform bug: mouse release event was lost)
- if (S60->mousePressTarget) {
- QMouseEvent mEvent(QEvent::MouseButtonRelease, S60->mousePressTarget->mapFromGlobal(globalPos), globalPos,
- button, QApplicationPrivate::mouse_buttons, modifiers);
- events.append(Event(S60->mousePressTarget,mEvent));
+ if (mouseGrabber) {
+ if (popupReceiver) {
+ sendMouseEvent(popupReceiver, type, globalPos, button, modifiers);
+ } else {
+ sendMouseEvent(mouseGrabber, type, globalPos, button, modifiers);
}
- //auto grab the mouse
- widgetWithMouseGrab = S60->mousePressTarget = widgetUnderPointer;
- widgetWithMouseGrab->grabMouse();
- }
- if (widgetWithMouseGrab && widgetWithMouseGrab == S60->mousePressTarget && type == QEvent::MouseButtonRelease) {
- //release the auto grab - note this release event still goes to the autograb widget
- S60->mousePressTarget = 0;
- widgetWithMouseGrab->releaseMouse();
+ // No Enter/Leave events in grabbing mode.
+ return;
}
- QWidget *widgetToReceiveMouseEvent;
- if (widgetWithMouseGrab)
- widgetToReceiveMouseEvent = widgetWithMouseGrab;
- else
- widgetToReceiveMouseEvent = widgetUnderPointer;
-
- //queue QEvent::Enter and QEvent::Leave, if the pointer has moved
- if (widgetUnderPointer != S60->lastPointerEventTarget && (type == QEvent::MouseButtonPress || type == QEvent::MouseButtonDblClick || type == QEvent::MouseMove))
- generateEnterLeaveEvents(events, widgetUnderPointer, globalPos, button, modifiers);
+ QWidget *widgetUnderPointer = qwidget->childAt(widgetPos);
+ if (!widgetUnderPointer)
+ widgetUnderPointer = qwidget;
- //save global state
- S60->lastCursorPos = globalPos;
- S60->lastPointerEventPos = widgetPos;
+ QApplicationPrivate::dispatchEnterLeave(widgetUnderPointer, S60->lastPointerEventTarget);
S60->lastPointerEventTarget = widgetUnderPointer;
+ QWidget *receiver;
+ if (!popupReceiver && S60->mousePressTarget && type != QEvent::MouseButtonPress) {
+ receiver = S60->mousePressTarget;
+ if (type == QEvent::MouseButtonRelease)
+ S60->mousePressTarget = 0;
+ } else {
+ receiver = popupReceiver ? popupReceiver : widgetUnderPointer;
+ if (type == QEvent::MouseButtonPress)
+ S60->mousePressTarget = receiver;
+ }
+
#if !defined(QT_NO_CURSOR) && !defined(Q_SYMBIAN_FIXED_POINTER_CURSORS)
if (S60->brokenPointerCursors)
qt_symbian_move_cursor_sprite();
#endif
- //queue this event.
- Q_ASSERT(widgetToReceiveMouseEvent);
- QMouseEvent mEvent(type, widgetToReceiveMouseEvent->mapFromGlobal(globalPos), globalPos,
+ sendMouseEvent(receiver, type, globalPos, button, modifiers);
+}
+
+void QSymbianControl::sendMouseEvent(
+ QWidget *receiver,
+ QEvent::Type type,
+ const QPoint &globalPos,
+ Qt::MouseButton button,
+ Qt::KeyboardModifiers modifiers)
+{
+ Q_ASSERT(receiver);
+ QMouseEvent mEvent(type, receiver->mapFromGlobal(globalPos), globalPos,
button, QApplicationPrivate::mouse_buttons, modifiers);
- events.append(Event(widgetToReceiveMouseEvent,mEvent));
QEventDispatcherS60 *dispatcher;
// It is theoretically possible for someone to install a different event dispatcher.
- if ((dispatcher = qobject_cast<QEventDispatcherS60 *>(widgetToReceiveMouseEvent->d_func()->threadData->eventDispatcher)) != 0) {
+ if ((dispatcher = qobject_cast<QEventDispatcherS60 *>(receiver->d_func()->threadData->eventDispatcher)) != 0) {
if (dispatcher->excludeUserInputEvents()) {
- for (int i=0;i < events.count();++i)
- {
- Event next = events[i];
- dispatcher->saveInputEvent(this, next.first, new QMouseEvent(next.second));
- }
+ dispatcher->saveInputEvent(this, receiver, new QMouseEvent(mEvent));
return;
}
}
- //send events in the queue
- for (int i=0;i < events.count();++i)
- {
- Event next = events[i];
- sendMouseEvent(next.first, &(next.second));
- }
+ sendMouseEvent(receiver, &mEvent);
}
bool QSymbianControl::sendMouseEvent(QWidget *widget, QMouseEvent *mEvent)
@@ -672,27 +631,58 @@ TKeyResponse QSymbianControl::OfferKeyEvent(const TKeyEvent& keyEvent, TEventCod
fakeEvent.iType = TPointerEvent::EButton1Up;
S60->virtualMouseAccel = 1;
S60->virtualMouseLastKey = 0;
+ switch (keyCode) {
+ case Qt::Key_Left:
+ S60->virtualMousePressedKeys &= ~QS60Data::Left;
+ break;
+ case Qt::Key_Right:
+ S60->virtualMousePressedKeys &= ~QS60Data::Right;
+ break;
+ case Qt::Key_Up:
+ S60->virtualMousePressedKeys &= ~QS60Data::Up;
+ break;
+ case Qt::Key_Down:
+ S60->virtualMousePressedKeys &= ~QS60Data::Down;
+ break;
+ case Qt::Key_Select:
+ S60->virtualMousePressedKeys &= ~QS60Data::Select;
+ break;
+ }
}
else if (type == EEventKey) {
switch (keyCode) {
case Qt::Key_Left:
+ S60->virtualMousePressedKeys |= QS60Data::Left;
x -= S60->virtualMouseAccel;
fakeEvent.iType = TPointerEvent::EMove;
break;
case Qt::Key_Right:
+ S60->virtualMousePressedKeys |= QS60Data::Right;
x += S60->virtualMouseAccel;
fakeEvent.iType = TPointerEvent::EMove;
break;
case Qt::Key_Up:
+ S60->virtualMousePressedKeys |= QS60Data::Up;
y -= S60->virtualMouseAccel;
fakeEvent.iType = TPointerEvent::EMove;
break;
case Qt::Key_Down:
+ S60->virtualMousePressedKeys |= QS60Data::Down;
y += S60->virtualMouseAccel;
fakeEvent.iType = TPointerEvent::EMove;
break;
case Qt::Key_Select:
- fakeEvent.iType = TPointerEvent::EButton1Down;
+ // Platform bug. If you start pressing several keys simultaneously (for
+ // example for drag'n'drop), Symbian starts producing spurious up and
+ // down messages for some keys. Therefore, make sure we have a clean slate
+ // of pressed keys before starting a new button press.
+ if (S60->virtualMousePressedKeys != 0) {
+ S60->virtualMousePressedKeys |= QS60Data::Select;
+ return EKeyWasConsumed;
+ } else {
+ S60->virtualMousePressedKeys |= QS60Data::Select;
+ fakeEvent.iType = TPointerEvent::EButton1Down;
+ }
break;
}
}
diff --git a/src/gui/kernel/qboxlayout.cpp b/src/gui/kernel/qboxlayout.cpp
index d965933..fd16861 100644
--- a/src/gui/kernel/qboxlayout.cpp
+++ b/src/gui/kernel/qboxlayout.cpp
@@ -830,9 +830,11 @@ void QBoxLayout::setGeometry(const QRect &r)
if (d->hasHfw && !horz(d->dir)) {
for (int i = 0; i < n; i++) {
QBoxLayoutItem *box = d->list.at(i);
- if (box->item->hasHeightForWidth())
+ if (box->item->hasHeightForWidth()) {
+ int width = qBound(box->item->minimumSize().width(), s.width(), box->item->maximumSize().width());
a[i].sizeHint = a[i].minimumSize =
- box->item->heightForWidth(s.width());
+ box->item->heightForWidth(width);
+ }
}
}
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index ddd8ca6..3352dbd 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -349,7 +349,9 @@ extern "C" {
// 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.
- nsActions = QT_PREPEND_NAMESPACE(qt_mac_mapDropAction)(qDEEvent.dropAction());
+ nsActions = NSDragOperationNone;
+ // Save as ignored in the answer rect.
+ qDMEvent.setDropAction(Qt::IgnoreAction);
} else {
nsActions = QT_PREPEND_NAMESPACE(qt_mac_mapDropAction)(qDMEvent.dropAction());
}
@@ -357,7 +359,6 @@ extern "C" {
return nsActions;
}
}
-
- (NSDragOperation)draggingUpdated:(id < NSDraggingInfo >)sender
{
NSPoint windowPoint = [sender draggingLocation];
@@ -402,13 +403,15 @@ extern "C" {
qDMEvent.setDropAction(QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec).lastAction);
qDMEvent.accept();
QApplication::sendEvent(qwidget, &qDMEvent);
- qt_mac_copy_answer_rect(qDMEvent);
NSDragOperation operation = qt_mac_mapDropAction(qDMEvent.dropAction());
if (!qDMEvent.isAccepted() || qDMEvent.dropAction() == Qt::IgnoreAction) {
// ignore this event (we will still receive further notifications)
operation = NSDragOperationNone;
+ // Save as ignored in the answer rect.
+ qDMEvent.setDropAction(Qt::IgnoreAction);
}
+ qt_mac_copy_answer_rect(qDMEvent);
return operation;
}
@@ -777,7 +780,7 @@ extern "C" {
NSPoint windowPoint = [theEvent locationInWindow];
NSPoint globalPoint = [[theEvent window] convertBaseToScreen:windowPoint];
NSPoint localPoint = [self convertPoint:windowPoint fromView:nil];
- QPoint qlocal = QPoint(localPoint.x, flipYCoordinate(localPoint.y));
+ QPoint qlocal = QPoint(localPoint.x, localPoint.y);
QPoint qglobal = QPoint(globalPoint.x, flipYCoordinate(globalPoint.y));
Qt::MouseButtons buttons = QApplication::mouseButtons();
bool wheelOK = false;
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index c4a25e1..eedf0a7 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -409,7 +409,7 @@ QMouseEventEx::~QMouseEventEx()
consider a top-level window A containing a child B which in turn contains a
child C (all with mouse tracking enabled):
- \image hoverEvents.png
+ \image hoverevents.png
Now, if you move the cursor from the top to the bottom in the middle of A,
you will get the following QEvent::MouseMove events:
@@ -432,7 +432,7 @@ QMouseEventEx::~QMouseEventEx()
\o A::HoverMove, B::HoverMove
\o A::HoverMove, B::HoverMove, C::HoverMove
\endlist
-
+
*/
/*!
@@ -3023,7 +3023,7 @@ QShowEvent::~QShowEvent()
This event is only used to notify the application of a request.
It may be safely ignored.
- \note This class is currently supported for Mac Os X only.
+ \note This class is currently supported for Mac OS X only.
*/
/*!
@@ -3066,6 +3066,8 @@ QFileOpenEvent::~QFileOpenEvent()
\fn QUrl QFileOpenEvent::url() const
Returns the url that is being opened.
+
+ \since 4.6
*/
QUrl QFileOpenEvent::url() const
{
diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp
index 192f9ac..d7cbebd 100644
--- a/src/gui/kernel/qgesturemanager.cpp
+++ b/src/gui/kernel/qgesturemanager.cpp
@@ -187,10 +187,8 @@ QGesture *QGestureManager::getState(QObject *object, QGestureRecognizer *recogni
#endif
}
- QList<QGesture *> states =
- m_objectGestures.value(QGestureManager::ObjectGesture(object, type));
// check if the QGesture for this recognizer has already been created
- foreach (QGesture *state, states) {
+ foreach (QGesture *state, m_objectGestures.value(QGestureManager::ObjectGesture(object, type))) {
if (m_gestureToRecognizer.value(state) == recognizer)
return state;
}
@@ -215,14 +213,13 @@ QGesture *QGestureManager::getState(QObject *object, QGestureRecognizer *recogni
return state;
}
-bool QGestureManager::filterEventThroughContexts(const QMultiHash<QObject *,
+bool QGestureManager::filterEventThroughContexts(const QMultiMap<QObject *,
Qt::GestureType> &contexts,
QEvent *event)
{
QSet<QGesture *> triggeredGestures;
QSet<QGesture *> finishedGestures;
QSet<QGesture *> newMaybeGestures;
- QSet<QGesture *> canceledGestures;
QSet<QGesture *> notGestures;
// TODO: sort contexts by the gesture type and check if one of the contexts
@@ -231,7 +228,7 @@ bool QGestureManager::filterEventThroughContexts(const QMultiHash<QObject *,
bool ret = false;
// filter the event through recognizers
- typedef QHash<QObject *, Qt::GestureType>::const_iterator ContextIterator;
+ typedef QMultiMap<QObject *, Qt::GestureType>::const_iterator ContextIterator;
for (ContextIterator cit = contexts.begin(), ce = contexts.end(); cit != ce; ++cit) {
Qt::GestureType gestureType = cit.value();
QMap<Qt::GestureType, QGestureRecognizer *>::const_iterator
@@ -271,6 +268,9 @@ bool QGestureManager::filterEventThroughContexts(const QMultiHash<QObject *,
}
}
}
+ if (triggeredGestures.isEmpty() && finishedGestures.isEmpty()
+ && newMaybeGestures.isEmpty() && notGestures.isEmpty())
+ return ret;
QSet<QGesture *> startedGestures = triggeredGestures - m_activeGestures;
triggeredGestures &= m_activeGestures;
@@ -280,8 +280,7 @@ bool QGestureManager::filterEventThroughContexts(const QMultiHash<QObject *,
// check if a running gesture switched back to not gesture state,
// i.e. were canceled
- QSet<QGesture *> activeToCancelGestures = m_activeGestures & notGestures;
- canceledGestures += activeToCancelGestures;
+ QSet<QGesture *> canceledGestures = m_activeGestures & notGestures;
// start timers for new gestures in maybe state
foreach (QGesture *state, newMaybeGestures) {
@@ -449,14 +448,14 @@ void QGestureManager::cleanupGesturesForRemovedRecognizer(QGesture *gesture)
// return true if accepted (consumed)
bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event)
{
- QSet<Qt::GestureType> types;
- QMultiHash<QObject *, Qt::GestureType> contexts;
+ QMap<Qt::GestureType, int> types;
+ QMultiMap<QObject *, Qt::GestureType> contexts;
QWidget *w = receiver;
typedef QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator ContextIterator;
if (!w->d_func()->gestureContext.isEmpty()) {
for(ContextIterator it = w->d_func()->gestureContext.begin(),
e = w->d_func()->gestureContext.end(); it != e; ++it) {
- types.insert(it.key());
+ types.insert(it.key(), 0);
contexts.insertMulti(w, it.key());
}
}
@@ -468,7 +467,7 @@ bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event)
e = w->d_func()->gestureContext.end(); it != e; ++it) {
if (!(it.value() & Qt::DontStartGestureOnChildren)) {
if (!types.contains(it.key())) {
- types.insert(it.key());
+ types.insert(it.key(), 0);
contexts.insertMulti(w, it.key());
}
}
@@ -477,20 +476,20 @@ bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event)
break;
w = w->parentWidget();
}
- return filterEventThroughContexts(contexts, event);
+ return contexts.isEmpty() ? false : filterEventThroughContexts(contexts, event);
}
#ifndef QT_NO_GRAPHICSVIEW
bool QGestureManager::filterEvent(QGraphicsObject *receiver, QEvent *event)
{
- QSet<Qt::GestureType> types;
- QMultiHash<QObject *, Qt::GestureType> contexts;
+ QMap<Qt::GestureType, int> types;
+ QMultiMap<QObject *, Qt::GestureType> contexts;
QGraphicsObject *item = receiver;
if (!item->QGraphicsItem::d_func()->gestureContext.isEmpty()) {
typedef QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator ContextIterator;
for(ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.begin(),
e = item->QGraphicsItem::d_func()->gestureContext.end(); it != e; ++it) {
- types.insert(it.key());
+ types.insert(it.key(), 0);
contexts.insertMulti(item, it.key());
}
}
@@ -503,20 +502,23 @@ bool QGestureManager::filterEvent(QGraphicsObject *receiver, QEvent *event)
e = item->QGraphicsItem::d_func()->gestureContext.end(); it != e; ++it) {
if (!(it.value() & Qt::DontStartGestureOnChildren)) {
if (!types.contains(it.key())) {
- types.insert(it.key());
+ types.insert(it.key(), 0);
contexts.insertMulti(item, it.key());
}
}
}
item = item->parentObject();
}
- return filterEventThroughContexts(contexts, event);
+ return contexts.isEmpty() ? false : filterEventThroughContexts(contexts, event);
}
#endif
-bool QGestureManager::filterEvent(QGesture *state, QEvent *event)
+bool QGestureManager::filterEvent(QObject *receiver, QEvent *event)
{
- QMultiHash<QObject *, Qt::GestureType> contexts;
+ if (!m_gestureToRecognizer.contains(static_cast<QGesture *>(receiver)))
+ return false;
+ QGesture *state = static_cast<QGesture *>(receiver);
+ QMultiMap<QObject *, Qt::GestureType> contexts;
contexts.insert(state, state->gestureType());
return filterEventThroughContexts(contexts, event);
}
diff --git a/src/gui/kernel/qgesturemanager_p.h b/src/gui/kernel/qgesturemanager_p.h
index 4efa10b..5329d1d 100644
--- a/src/gui/kernel/qgesturemanager_p.h
+++ b/src/gui/kernel/qgesturemanager_p.h
@@ -73,7 +73,7 @@ public:
void unregisterGestureRecognizer(Qt::GestureType type);
bool filterEvent(QWidget *receiver, QEvent *event);
- bool filterEvent(QGesture *receiver, QEvent *event);
+ bool filterEvent(QObject *receiver, QEvent *event);
#ifndef QT_NO_GRAPHICSVIEW
bool filterEvent(QGraphicsObject *receiver, QEvent *event);
#endif //QT_NO_GRAPHICSVIEW
@@ -86,7 +86,7 @@ public:
protected:
void timerEvent(QTimerEvent *event);
- bool filterEventThroughContexts(const QMultiHash<QObject *, Qt::GestureType> &contexts,
+ bool filterEventThroughContexts(const QMultiMap<QObject *, Qt::GestureType> &contexts,
QEvent *event);
private:
diff --git a/src/gui/kernel/qguieventdispatcher_glib.cpp b/src/gui/kernel/qguieventdispatcher_glib.cpp
index f8a638c..a252499 100644
--- a/src/gui/kernel/qguieventdispatcher_glib.cpp
+++ b/src/gui/kernel/qguieventdispatcher_glib.cpp
@@ -152,6 +152,8 @@ static gboolean x11EventSourceDispatch(GSource *s, GSourceFunc callback, gpointe
out:
+ source->d->runTimersOnceWithNormalPriority();
+
if (callback)
callback(user_data);
return true;
diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h
index 08f8bb5..737e9d7 100644
--- a/src/gui/kernel/qt_s60_p.h
+++ b/src/gui/kernel/qt_s60_p.h
@@ -103,6 +103,14 @@ public:
int defaultDpiY;
WId curWin;
int virtualMouseLastKey;
+ enum PressedKeys {
+ Select = 0x1,
+ Right = 0x2,
+ Down = 0x4,
+ Left = 0x8,
+ Up = 0x10
+ };
+ int virtualMousePressedKeys; // of the above type, but avoids casting problems
int virtualMouseAccel;
int virtualMouseMaxAccel;
#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
@@ -192,6 +200,12 @@ private:
TKeyResponse OfferKeyEvent(const TKeyEvent& aKeyEvent,TEventCode aType);
TKeyResponse sendKeyEvent(QWidget *widget, QKeyEvent *keyEvent);
bool sendMouseEvent(QWidget *widget, QMouseEvent *mEvent);
+ void sendMouseEvent(
+ QWidget *receiver,
+ QEvent::Type type,
+ const QPoint &globalPos,
+ Qt::MouseButton button,
+ Qt::KeyboardModifiers modifiers);
void HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& aPenEventScreenLocation );
#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER
void translateAdvancedPointerEvent(const TAdvancedPointerEvent *event);
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index e551a1d..5c4cc74 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -9774,13 +9774,12 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f)
}
#endif
- if (newParent) {
- if (QWidgetBackingStore *oldBs = oldtlw->d_func()->maybeBackingStore()) {
+ if (QWidgetBackingStore *oldBs = oldtlw->d_func()->maybeBackingStore()) {
+ if (newParent)
oldBs->removeDirtyWidget(this);
- // Move the widget and all its static children from
- // the old backing store to the new one.
- oldBs->moveStaticWidgets(this);
- }
+ // Move the widget and all its static children from
+ // the old backing store to the new one.
+ oldBs->moveStaticWidgets(this);
}
if ((QApplicationPrivate::app_compile_version < 0x040200
@@ -11872,16 +11871,20 @@ void QWidget::ungrabGesture(Qt::GestureType gesture)
mouse when a mouse button is pressed and keeps it until the last
button is released.
- Note that only visible widgets can grab mouse input. If
- isVisible() returns false for a widget, that widget cannot call
- grabMouse().
+ \note Only visible widgets can grab mouse input. If isVisible()
+ returns false for a widget, that widget cannot call grabMouse().
+
+ \note \bold{(Mac OS X developers)} For \e Cocoa, calling
+ grabMouse() on a widget only works when the mouse is inside the
+ frame of that widget. For \e Carbon, it works outside the widget's
+ frame as well, like for Windows and X11.
\sa releaseMouse() grabKeyboard() releaseKeyboard()
*/
/*!
\fn void QWidget::grabMouse(const QCursor &cursor)
- \overload
+ \overload grabMouse()
Grabs the mouse input and changes the cursor shape.
@@ -11891,6 +11894,8 @@ void QWidget::ungrabGesture(Qt::GestureType gesture)
\warning Grabbing the mouse might lock the terminal.
+ \note \bold{(Mac OS X developers)} See the note in QWidget::grabMouse().
+
\sa releaseMouse(), grabKeyboard(), releaseKeyboard(), setCursor()
*/
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 7dc4d85..69f1353 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -3671,6 +3671,7 @@ void QWidgetPrivate::raise_sys()
return;
#if QT_MAC_USE_COCOA
+ QMacCocoaAutoReleasePool pool;
if (isRealWindow()) {
// Calling orderFront shows the window on Cocoa too.
if (!q->testAttribute(Qt::WA_DontShowOnScreen) && q->isVisible()) {
@@ -4493,10 +4494,14 @@ void QWidgetPrivate::createTLSysExtra()
void QWidgetPrivate::deleteTLSysExtra()
{
#ifndef QT_MAC_USE_COCOA
- if(extra->topextra->group) {
+ if (extra->topextra->group) {
qt_mac_release_window_group(extra->topextra->group);
extra->topextra->group = 0;
}
+ if (extra->topextra->windowIcon) {
+ ReleaseIconRef(extra->topextra->windowIcon);
+ extra->topextra->windowIcon = 0;
+ }
#endif
}
diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp
index 0bc9cbc..f9db485 100644
--- a/src/gui/kernel/qwidget_x11.cpp
+++ b/src/gui/kernel/qwidget_x11.cpp
@@ -1084,7 +1084,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
} else {
// release previous focus information participating with
// preedit preservation of qic
- QInputContext *qic = inputContext();
+ QInputContext *qic = QApplicationPrivate::inputContext;
if (qic)
qic->widgetDestroyed(this);
}
diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri
index 628a109..a6cc9c7 100644
--- a/src/gui/painting/painting.pri
+++ b/src/gui/painting/painting.pri
@@ -379,6 +379,13 @@ symbian {
QMAKE_CXXFLAGS.ARMCC *= -O3
}
+neon {
+ DEFINES += QT_HAVE_NEON
+ HEADERS += painting/qdrawhelper_neon_p.h
+ SOURCES += painting/qdrawhelper_neon.cpp
+ QMAKE_CXXFLAGS *= -mfpu=neon
+}
+
contains(QT_CONFIG, zlib) {
INCLUDEPATH += ../3rdparty/zlib
} else:!contains(QT_CONFIG, no-zlib) {
diff --git a/src/gui/painting/qbezier.cpp b/src/gui/painting/qbezier.cpp
index a6b4cef..f626494 100644
--- a/src/gui/painting/qbezier.cpp
+++ b/src/gui/painting/qbezier.cpp
@@ -497,7 +497,7 @@ static bool addCircle(const QBezier *b, qreal offset, QBezier *o)
cos_a = 1.;
if (cos_a < -1.)
cos_a = -1;
- angles[i] = acos(cos_a)/Q_PI;
+ angles[i] = qAcos(cos_a)/Q_PI;
}
if (angles[0] + angles[1] > 1.) {
@@ -816,17 +816,17 @@ bool QBezier::findIntersections(const QBezier &a, const QBezier &b,
QVector<QPair<qreal, qreal> > *t)
{
if (IntersectBB(a, b)) {
- QPointF la1(fabs((a.x3 - a.x2) - (a.x2 - a.x1)),
- fabs((a.y3 - a.y2) - (a.y2 - a.y1)));
- QPointF la2(fabs((a.x4 - a.x3) - (a.x3 - a.x2)),
- fabs((a.y4 - a.y3) - (a.y3 - a.y2)));
+ QPointF la1(qFabs((a.x3 - a.x2) - (a.x2 - a.x1)),
+ qFabs((a.y3 - a.y2) - (a.y2 - a.y1)));
+ QPointF la2(qFabs((a.x4 - a.x3) - (a.x3 - a.x2)),
+ qFabs((a.y4 - a.y3) - (a.y3 - a.y2)));
QPointF la;
if (la1.x() > la2.x()) la.setX(la1.x()); else la.setX(la2.x());
if (la1.y() > la2.y()) la.setY(la1.y()); else la.setY(la2.y());
- QPointF lb1(fabs((b.x3 - b.x2) - (b.x2 - b.x1)),
- fabs((b.y3 - b.y2) - (b.y2 - b.y1)));
- QPointF lb2(fabs((b.x4 - b.x3) - (b.x3 - b.x2)),
- fabs((b.y4 - b.y3) - (b.y3 - b.y2)));
+ QPointF lb1(qFabs((b.x3 - b.x2) - (b.x2 - b.x1)),
+ qFabs((b.y3 - b.y2) - (b.y2 - b.y1)));
+ QPointF lb2(qFabs((b.x4 - b.x3) - (b.x3 - b.x2)),
+ qFabs((b.y4 - b.y3) - (b.y3 - b.y2)));
QPointF lb;
if (lb1.x() > lb2.x()) lb.setX(lb1.x()); else lb.setX(lb2.x());
if (lb1.y() > lb2.y()) lb.setY(lb1.y()); else lb.setY(lb2.y());
@@ -1120,7 +1120,7 @@ static inline void bindInflectionPoint(const QBezier &bez, const qreal t,
qreal ey = 3 * (right.y2 - right.y3);
qreal s4 = qAbs(6 * (ey * ax - ex * ay) / qSqrt(ex * ex + ey * ey)) + 0.00001f;
- qreal tf = pow(qreal(9 * flatness / s4), qreal(1./3.));
+ qreal tf = qPow(qreal(9 * flatness / s4), qreal(1./3.));
*tMinus = t - (1 - t) * tf;
*tPlus = t + (1 - t) * tf;
}
diff --git a/src/gui/painting/qbezier_p.h b/src/gui/painting/qbezier_p.h
index 7dbd0c2..c284871 100644
--- a/src/gui/painting/qbezier_p.h
+++ b/src/gui/painting/qbezier_p.h
@@ -166,8 +166,6 @@ inline void QBezier::coefficients(qreal t, qreal &a, qreal &b, qreal &c, qreal &
inline QPointF QBezier::pointAt(qreal t) const
{
- Q_ASSERT(t >= 0);
- Q_ASSERT(t <= 1);
#if 1
qreal a, b, c, d;
coefficients(t, a, b, c, d);
diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp
index 1d15dac..81d1515 100644
--- a/src/gui/painting/qblendfunctions.cpp
+++ b/src/gui/painting/qblendfunctions.cpp
@@ -605,7 +605,7 @@ static void qt_blend_argb32_on_argb32(uchar *destPixels, int dbpl,
}
-static void qt_blend_rgb32_on_rgb32(uchar *destPixels, int dbpl,
+void qt_blend_rgb32_on_rgb32(uchar *destPixels, int dbpl,
const uchar *srcPixels, int sbpl,
int w, int h,
int const_alpha)
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 4df7f8a..9bb4486 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -44,6 +44,7 @@
#include <private/qpainter_p.h>
#include <private/qdrawhelper_x86_p.h>
#include <private/qdrawhelper_armv6_p.h>
+#include <private/qdrawhelper_neon_p.h>
#include <private/qmath_p.h>
#include <qmath.h>
@@ -1182,7 +1183,7 @@ static const uint * QT_FASTCALL fetchConicalGradient(uint *buffer, const Operato
rx -= data->gradient.conical.center.x;
ry -= data->gradient.conical.center.y;
while (buffer < end) {
- qreal angle = atan2(ry, rx) + data->gradient.conical.angle;
+ qreal angle = qAtan2(ry, rx) + data->gradient.conical.angle;
*buffer = qt_gradient_pixel(&data->gradient, 1 - angle / (2*Q_PI));
@@ -1196,7 +1197,7 @@ static const uint * QT_FASTCALL fetchConicalGradient(uint *buffer, const Operato
if (!rw)
rw = 1;
while (buffer < end) {
- qreal angle = atan2(ry/rw - data->gradient.conical.center.x,
+ qreal angle = qAtan2(ry/rw - data->gradient.conical.center.x,
rx/rw - data->gradient.conical.center.y)
+ data->gradient.conical.angle;
@@ -1363,7 +1364,10 @@ static void QT_FASTCALL comp_func_SourceOver(uint *dest, const uint *src, int le
for (int i = 0; i < length; ++i) {
PRELOAD_COND2(dest, src)
uint s = src[i];
- dest[i] = s + BYTE_MUL(dest[i], qAlpha(~s));
+ if (s >= 0xff000000)
+ dest[i] = s;
+ else if (s != 0)
+ dest[i] = s + BYTE_MUL(dest[i], qAlpha(~s));
}
} else {
for (int i = 0; i < length; ++i) {
@@ -7140,17 +7144,17 @@ void qt_build_pow_tables() {
}
#else
for (int i=0; i<256; ++i) {
- qt_pow_rgb_gamma[i] = uchar(qRound(pow(i / qreal(255.0), smoothing) * 255));
- qt_pow_rgb_invgamma[i] = uchar(qRound(pow(i / qreal(255.), 1 / smoothing) * 255));
+ qt_pow_rgb_gamma[i] = uchar(qRound(qPow(i / qreal(255.0), smoothing) * 255));
+ qt_pow_rgb_invgamma[i] = uchar(qRound(qPow(i / qreal(255.), 1 / smoothing) * 255));
}
#endif
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
const qreal gray_gamma = 2.31;
for (int i=0; i<256; ++i)
- qt_pow_gamma[i] = uint(qRound(pow(i / qreal(255.), gray_gamma) * 2047));
+ qt_pow_gamma[i] = uint(qRound(qPow(i / qreal(255.), gray_gamma) * 2047));
for (int i=0; i<2048; ++i)
- qt_pow_invgamma[i] = uchar(qRound(pow(i / 2047.0, 1 / gray_gamma) * 255));
+ qt_pow_invgamma[i] = uchar(qRound(qPow(i / 2047.0, 1 / gray_gamma) * 255));
#endif
}
@@ -7725,7 +7729,8 @@ enum CPUFeatures {
SSE = 0x10,
SSE2 = 0x20,
CMOV = 0x40,
- IWMMXT = 0x80
+ IWMMXT = 0x80,
+ NEON = 0x100
};
static uint detectCPUFeatures()
@@ -7751,6 +7756,9 @@ static uint detectCPUFeatures()
// runtime detection only available when running as a previlegied process
static const bool doIWMMXT = !qgetenv("QT_NO_IWMMXT").toInt();
return doIWMMXT ? IWMMXT : 0;
+#elif defined(QT_HAVE_NEON)
+ static const bool doNEON = !qgetenv("QT_NO_NEON").toInt();
+ return doNEON ? NEON : 0;
#else
uint features = 0;
#if defined(__x86_64__) || defined(Q_OS_WIN64)
@@ -8122,7 +8130,14 @@ void qInitDrawhelperAsm()
qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_armv6;
qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_armv6;
qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_armv6;
-#endif // Q_CC_RVCT && QT_HAVE_ARMV6
+#elif defined(QT_HAVE_NEON)
+ if (features & NEON) {
+ qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_neon;
+ qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_neon;
+ qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_neon;
+ qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_neon;
+ }
+#endif
if (functionForModeSolidAsm) {
const int destinationMode = QPainter::CompositionMode_Destination;
diff --git a/src/gui/painting/qdrawhelper_neon.cpp b/src/gui/painting/qdrawhelper_neon.cpp
new file mode 100644
index 0000000..7fe11bf
--- /dev/null
+++ b/src/gui/painting/qdrawhelper_neon.cpp
@@ -0,0 +1,260 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <private/qdrawhelper_p.h>
+
+#ifdef QT_HAVE_NEON
+
+#include <private/qdrawhelper_neon_p.h>
+#include <arm_neon.h>
+
+QT_BEGIN_NAMESPACE
+
+static inline int16x8_t qvdiv_255_s16(int16x8_t x, int16x8_t half)
+{
+ // result = (x + (x >> 8) + 0x80) >> 8
+
+ const int16x8_t temp = vshrq_n_s16(x, 8); // x >> 8
+ const int16x8_t sum_part = vaddq_s16(x, half); // x + 0x80
+ const int16x8_t sum = vaddq_s16(temp, sum_part);
+
+ return vreinterpretq_s16_u16(vshrq_n_u16(vreinterpretq_u16_s16(sum), 8));
+}
+
+static inline int16x8_t qvbyte_mul_s16(int16x8_t x, int16x8_t alpha, int16x8_t half)
+{
+ // t = qRound(x * alpha / 255.0)
+
+ const int16x8_t t = vmulq_s16(x, alpha); // t
+ return qvdiv_255_s16(t, half);
+}
+
+static inline int16x8_t qvinterpolate_pixel_255(int16x8_t x, int16x8_t a, int16x8_t y, int16x8_t b, int16x8_t half)
+{
+ // t = x * a + y * b
+
+ const int16x8_t ta = vmulq_s16(x, a);
+ const int16x8_t tb = vmulq_s16(y, b);
+
+ return qvdiv_255_s16(vaddq_s16(ta, tb), half);
+}
+
+static inline int16x8_t qvsource_over_s16(int16x8_t src16, int16x8_t dst16, int16x8_t half, int16x8_t full)
+{
+ const int16x4_t alpha16_high = vdup_lane_s16(vget_high_s16(src16), 3);
+ const int16x4_t alpha16_low = vdup_lane_s16(vget_low_s16(src16), 3);
+
+ const int16x8_t alpha16 = vsubq_s16(full, vcombine_s16(alpha16_low, alpha16_high));
+
+ return vaddq_s16(src16, qvbyte_mul_s16(dst16, alpha16, half));
+}
+
+void qt_blend_argb32_on_argb32_neon(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ int w, int h,
+ int const_alpha)
+{
+ const uint *src = (const uint *) srcPixels;
+ uint *dst = (uint *) destPixels;
+ int16x8_t half = vdupq_n_s16(0x80);
+ int16x8_t full = vdupq_n_s16(0xff);
+ if (const_alpha == 256) {
+ for (int y = 0; y < h; ++y) {
+ int x = 0;
+ for (; x < w-3; x += 4) {
+ int32x4_t src32 = vld1q_s32((int32_t *)&src[x]);
+ if ((src[x] & src[x+1] & src[x+2] & src[x+3]) >= 0xff000000) {
+ // all opaque
+ vst1q_s32((int32_t *)&dst[x], src32);
+ } else if (src[x] | src[x+1] | src[x+2] | src[x+3]) {
+ int32x4_t dst32 = vld1q_s32((int32_t *)&dst[x]);
+
+ const uint8x16_t src8 = vreinterpretq_u8_s32(src32);
+ const uint8x16_t dst8 = vreinterpretq_u8_s32(dst32);
+
+ const uint8x8_t src8_low = vget_low_u8(src8);
+ const uint8x8_t dst8_low = vget_low_u8(dst8);
+
+ const uint8x8_t src8_high = vget_high_u8(src8);
+ const uint8x8_t dst8_high = vget_high_u8(dst8);
+
+ const int16x8_t src16_low = vreinterpretq_s16_u16(vmovl_u8(src8_low));
+ const int16x8_t dst16_low = vreinterpretq_s16_u16(vmovl_u8(dst8_low));
+
+ const int16x8_t src16_high = vreinterpretq_s16_u16(vmovl_u8(src8_high));
+ const int16x8_t dst16_high = vreinterpretq_s16_u16(vmovl_u8(dst8_high));
+
+ const int16x8_t result16_low = qvsource_over_s16(src16_low, dst16_low, half, full);
+ const int16x8_t result16_high = qvsource_over_s16(src16_high, dst16_high, half, full);
+
+ const int32x2_t result32_low = vreinterpret_s32_s8(vmovn_s16(result16_low));
+ const int32x2_t result32_high = vreinterpret_s32_s8(vmovn_s16(result16_high));
+
+ vst1q_s32((int32_t *)&dst[x], vcombine_s32(result32_low, result32_high));
+ }
+ }
+ for (; x<w; ++x) {
+ uint s = src[x];
+ if (s >= 0xff000000)
+ dst[x] = s;
+ else if (s != 0)
+ dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s));
+ }
+ dst = (quint32 *)(((uchar *) dst) + dbpl);
+ src = (const quint32 *)(((const uchar *) src) + sbpl);
+ }
+ } else if (const_alpha != 0) {
+ const_alpha = (const_alpha * 255) >> 8;
+ int16x8_t const_alpha16 = vdupq_n_s16(const_alpha);
+ for (int y = 0; y < h; ++y) {
+ int x = 0;
+ for (; x < w-3; x += 4) {
+ if (src[x] | src[x+1] | src[x+2] | src[x+3]) {
+ int32x4_t src32 = vld1q_s32((int32_t *)&src[x]);
+ int32x4_t dst32 = vld1q_s32((int32_t *)&dst[x]);
+
+ const uint8x16_t src8 = vreinterpretq_u8_s32(src32);
+ const uint8x16_t dst8 = vreinterpretq_u8_s32(dst32);
+
+ const uint8x8_t src8_low = vget_low_u8(src8);
+ const uint8x8_t dst8_low = vget_low_u8(dst8);
+
+ const uint8x8_t src8_high = vget_high_u8(src8);
+ const uint8x8_t dst8_high = vget_high_u8(dst8);
+
+ const int16x8_t src16_low = vreinterpretq_s16_u16(vmovl_u8(src8_low));
+ const int16x8_t dst16_low = vreinterpretq_s16_u16(vmovl_u8(dst8_low));
+
+ const int16x8_t src16_high = vreinterpretq_s16_u16(vmovl_u8(src8_high));
+ const int16x8_t dst16_high = vreinterpretq_s16_u16(vmovl_u8(dst8_high));
+
+ const int16x8_t srcalpha16_low = qvbyte_mul_s16(src16_low, const_alpha16, half);
+ const int16x8_t srcalpha16_high = qvbyte_mul_s16(src16_high, const_alpha16, half);
+
+ const int16x8_t result16_low = qvsource_over_s16(srcalpha16_low, dst16_low, half, full);
+ const int16x8_t result16_high = qvsource_over_s16(srcalpha16_high, dst16_high, half, full);
+
+ const int32x2_t result32_low = vreinterpret_s32_s8(vmovn_s16(result16_low));
+ const int32x2_t result32_high = vreinterpret_s32_s8(vmovn_s16(result16_high));
+
+ vst1q_s32((int32_t *)&dst[x], vcombine_s32(result32_low, result32_high));
+ }
+ }
+ for (; x<w; ++x) {
+ uint s = src[x];
+ if (s != 0) {
+ s = BYTE_MUL(s, const_alpha);
+ dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s));
+ }
+ }
+ dst = (quint32 *)(((uchar *) dst) + dbpl);
+ src = (const quint32 *)(((const uchar *) src) + sbpl);
+ }
+ }
+}
+
+// qblendfunctions.cpp
+void qt_blend_rgb32_on_rgb32(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ int w, int h,
+ int const_alpha);
+
+void qt_blend_rgb32_on_rgb32_neon(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ int w, int h,
+ int const_alpha)
+{
+ if (const_alpha != 256) {
+ if (const_alpha != 0) {
+ const uint *src = (const uint *) srcPixels;
+ uint *dst = (uint *) destPixels;
+ int16x8_t half = vdupq_n_s16(0x80);
+ const_alpha = (const_alpha * 255) >> 8;
+ int one_minus_const_alpha = 255 - const_alpha;
+ int16x8_t const_alpha16 = vdupq_n_s16(const_alpha);
+ int16x8_t one_minus_const_alpha16 = vdupq_n_s16(255 - const_alpha);
+ for (int y = 0; y < h; ++y) {
+ int x = 0;
+ for (; x < w-3; x += 4) {
+ int32x4_t src32 = vld1q_s32((int32_t *)&src[x]);
+ int32x4_t dst32 = vld1q_s32((int32_t *)&dst[x]);
+
+ const uint8x16_t src8 = vreinterpretq_u8_s32(src32);
+ const uint8x16_t dst8 = vreinterpretq_u8_s32(dst32);
+
+ const uint8x8_t src8_low = vget_low_u8(src8);
+ const uint8x8_t dst8_low = vget_low_u8(dst8);
+
+ const uint8x8_t src8_high = vget_high_u8(src8);
+ const uint8x8_t dst8_high = vget_high_u8(dst8);
+
+ const int16x8_t src16_low = vreinterpretq_s16_u16(vmovl_u8(src8_low));
+ const int16x8_t dst16_low = vreinterpretq_s16_u16(vmovl_u8(dst8_low));
+
+ const int16x8_t src16_high = vreinterpretq_s16_u16(vmovl_u8(src8_high));
+ const int16x8_t dst16_high = vreinterpretq_s16_u16(vmovl_u8(dst8_high));
+
+ const int16x8_t result16_low = qvinterpolate_pixel_255(src16_low, const_alpha16, dst16_low, one_minus_const_alpha16, half);
+ const int16x8_t result16_high = qvinterpolate_pixel_255(src16_high, const_alpha16, dst16_high, one_minus_const_alpha16, half);
+
+ const int32x2_t result32_low = vreinterpret_s32_s8(vmovn_s16(result16_low));
+ const int32x2_t result32_high = vreinterpret_s32_s8(vmovn_s16(result16_high));
+
+ vst1q_s32((int32_t *)&dst[x], vcombine_s32(result32_low, result32_high));
+ }
+ for (; x<w; ++x) {
+ uint s = src[x];
+ s = BYTE_MUL(s, const_alpha);
+ dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], one_minus_const_alpha);
+ }
+ dst = (quint32 *)(((uchar *) dst) + dbpl);
+ src = (const quint32 *)(((const uchar *) src) + sbpl);
+ }
+ }
+ } else {
+ qt_blend_rgb32_on_rgb32(destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);
+ }
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_HAVE_NEON
+
diff --git a/src/gui/painting/qdrawhelper_neon_p.h b/src/gui/painting/qdrawhelper_neon_p.h
new file mode 100644
index 0000000..cb9a0d6
--- /dev/null
+++ b/src/gui/painting/qdrawhelper_neon_p.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QDRAWHELPER_NEON_P_H
+#define QDRAWHELPER_NEON_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 <private/qdrawhelper_p.h>
+
+QT_BEGIN_NAMESPACE
+
+#ifdef QT_HAVE_NEON
+
+void qt_blend_argb32_on_argb32_neon(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ int w, int h,
+ int const_alpha);
+
+void qt_blend_rgb32_on_rgb32_neon(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ int w, int h,
+ int const_alpha);
+
+#endif // QT_HAVE_NEON
+
+QT_END_NAMESPACE
+
+#endif // QDRAWHELPER_NEON_P_H
diff --git a/src/gui/painting/qmatrix.h b/src/gui/painting/qmatrix.h
index 152b3c9..af48bcb 100644
--- a/src/gui/painting/qmatrix.h
+++ b/src/gui/painting/qmatrix.h
@@ -102,7 +102,9 @@ public:
bool isInvertible() const { return !qFuzzyIsNull(_m11*_m22 - _m12*_m21); }
qreal determinant() const { return _m11*_m22 - _m12*_m21; }
+#ifdef QT_DEPRECATED
QT_DEPRECATED qreal det() const { return _m11*_m22 - _m12*_m21; }
+#endif
QMatrix inverted(bool *invertible = 0) const;
diff --git a/src/gui/painting/qmemrotate.cpp b/src/gui/painting/qmemrotate.cpp
index 67dc2c7..e3a6f78 100644
--- a/src/gui/painting/qmemrotate.cpp
+++ b/src/gui/painting/qmemrotate.cpp
@@ -572,5 +572,26 @@ QT_IMPL_MEMROTATE(quint32, qrgb_generic16)
QT_IMPL_MEMROTATE(quint16, qrgb_generic16)
#endif
+struct qrgb_gl_rgba
+{
+public:
+ inline qrgb_gl_rgba(quint32 v) {
+ if (QSysInfo::ByteOrder == QSysInfo::LittleEndian)
+ data = ((v << 16) & 0xff0000) | ((v >> 16) & 0xff) | (v & 0xff00ff00);
+ else
+ data = (v << 8) | ((v >> 24) & 0xff);
+ }
+
+ inline operator quint32() const { return data; }
+
+private:
+ quint32 data;
+} Q_PACKED;
+
+void Q_GUI_EXPORT qt_memrotate90_gl(const quint32 *src, int srcWidth, int srcHeight, int srcStride,
+ quint32 *dest, int dstStride)
+{
+ qt_memrotate90_template(src, srcWidth, srcHeight, srcStride, reinterpret_cast<qrgb_gl_rgba *>(dest), dstStride);
+}
QT_END_NAMESPACE
diff --git a/src/gui/painting/qmemrotate_p.h b/src/gui/painting/qmemrotate_p.h
index 676a880..8aee575 100644
--- a/src/gui/painting/qmemrotate_p.h
+++ b/src/gui/painting/qmemrotate_p.h
@@ -81,6 +81,8 @@ QT_BEGIN_NAMESPACE
void Q_GUI_QWS_EXPORT qt_memrotate180(const srctype*, int, int, int, desttype*, int); \
void Q_GUI_QWS_EXPORT qt_memrotate270(const srctype*, int, int, int, desttype*, int)
+void Q_GUI_EXPORT qt_memrotate90(const quint32*, int, int, int, quint32*, int);
+
QT_DECL_MEMROTATE(quint32, quint32);
QT_DECL_MEMROTATE(quint32, quint16);
QT_DECL_MEMROTATE(quint16, quint32);
diff --git a/src/gui/painting/qpaintdevice.h b/src/gui/painting/qpaintdevice.h
index 9148e4b..0f8191e 100644
--- a/src/gui/painting/qpaintdevice.h
+++ b/src/gui/painting/qpaintdevice.h
@@ -96,7 +96,9 @@ public:
int logicalDpiY() const { return metric(PdmDpiY); }
int physicalDpiX() const { return metric(PdmPhysicalDpiX); }
int physicalDpiY() const { return metric(PdmPhysicalDpiY); }
+#ifdef QT_DEPRECATED
QT_DEPRECATED int numColors() const { return metric(PdmNumColors); }
+#endif
int colorCount() const { return metric(PdmNumColors); }
int depth() const { return metric(PdmDepth); }
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 4a72434..aa3b89e 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -3018,10 +3018,10 @@ void QRasterPaintEngine::drawCachedGlyphs(const QPointF &p, const QTextItemInt &
QFontEngineGlyphCache::Type glyphType = ti.fontEngine->glyphFormat >= 0 ? QFontEngineGlyphCache::Type(ti.fontEngine->glyphFormat) : d->glyphCacheType;
QImageTextureGlyphCache *cache =
- (QImageTextureGlyphCache *) ti.fontEngine->glyphCache(glyphType, s->matrix);
+ (QImageTextureGlyphCache *) ti.fontEngine->glyphCache(0, glyphType, s->matrix);
if (!cache) {
cache = new QImageTextureGlyphCache(glyphType, s->matrix);
- ti.fontEngine->setGlyphCache(glyphType, cache);
+ ti.fontEngine->setGlyphCache(0, cache);
}
cache->populate(ti, glyphs, positions);
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 66bf4f7..fd67f96 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -1317,6 +1317,90 @@ void QPainterPrivate::updateState(QPainterState *newState)
Another workaround is to convert the paths to polygons first and then draw the
polygons instead.
+ \section1 Performance
+
+ QPainter is a rich framework that allows developers to do a great
+ variety of graphical operations, such as gradients, composition
+ modes and vector graphics. And QPainter can do this across a
+ variety of different hardware and software stacks. Naturally the
+ underlying combination of hardware and software has some
+ implications for performance, and ensuring that every single
+ operation is fast in combination with all the various combinations
+ of composition modes, brushes, clipping, transformation, etc, is
+ close to an impossible task because of the number of
+ permutations. As a compromise we have selected a subset of the
+ QPainter API and backends, where performance is guaranteed to be as
+ good as we can sensibly get it for the given combination of
+ hardware and software.
+
+ The backends we focus on as high-performance engines are:
+
+ \list
+
+ \o Raster - This backend implements all rendering in pure software
+ and is always used to render into QImages. For optimal performance
+ only use the format types QImage::Format_ARGB32_Premultiplied,
+ QImage::Format_RGB32 or QImage::Format_RGB16. Any other format,
+ including QImage::Format_ARGB32, has significantly worse
+ performance. This engine is also used by default on Windows and on
+ QWS. It can be used as default graphics system on any
+ OS/hardware/software combination by passing \c {-graphicssystem
+ raster} on the command line
+
+ \o OpenGL 2.0 (ES) - This backend is the primary backend for
+ hardware accelerated graphics. It can be run on desktop machines
+ and embedded devices supporting the OpenGL 2.0 or OpenGL/ES 2.0
+ specification. This includes most graphics chips produced in the
+ last couple of years. The engine can be enabled by using QPainter
+ onto a QGLWidget or by passing \c {-graphicssystem opengl} on the
+ command line when the underlying system supports it.
+
+ \o OpenVG - This backend implements the Khronos standard for 2D
+ and Vector Graphics. It is primarily for embedded devices with
+ hardware support for OpenVG. The engine can be enabled by
+ passing \c {-graphicssystem openvg} on the command line when
+ the underlying system supports it.
+
+ \endlist
+
+ These operations are:
+
+ \list
+
+ \o Simple transformations, meaning translation and scaling, pluss
+ 0, 90, 180, 270 degree rotations.
+
+ \o \c drawPixmap() in combination with simple transformations and
+ opacity with non-smooth transformation mode
+ (\c QPainter::SmoothPixmapTransform not enabled as a render hint).
+
+ \o Text drawing with regular font sizes with simple
+ transformations with solid colors using no or 8-bit antialiasing.
+
+ \o Rectangle fills with solid color, two-color linear gradients
+ and simple transforms.
+
+ \o Rectangular clipping with simple transformations and intersect
+ clip.
+
+ \o Composition Modes \c QPainter::CompositionMode_Source and
+ QPainter::CompositionMode_SourceOver
+
+ \o Rounded rectangle filling using solid color and two-color
+ linear gradients fills.
+
+ \o 3x3 patched pixmaps, via qDrawBorderPixmap.
+
+ \endlist
+
+ This list gives an indication of which features to safely use in
+ an application where performance is critical. For certain setups,
+ other operations may be fast too, but before making extensive use
+ of them, it is recommended to benchmark and verify them on the
+ system where the software will run in the end. There are also
+ cases where expensive operations are ok to use, for instance when
+ the result is cached in a QPixmap.
+
\sa QPaintDevice, QPaintEngine, {QtSvg Module}, {Basic Drawing Example},
{Drawing Utility Functions}
*/
diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp
index 51d6195..a41ab6d 100644
--- a/src/gui/painting/qpathclipper.cpp
+++ b/src/gui/painting/qpathclipper.cpp
@@ -1209,7 +1209,7 @@ static qreal computeAngle(const QPointF &v)
}
#else
// doesn't seem to be robust enough
- return atan2(v.x(), v.y()) + Q_PI;
+ return qAtan2(v.x(), v.y()) + Q_PI;
#endif
}
diff --git a/src/gui/painting/qprinterinfo_unix.cpp b/src/gui/painting/qprinterinfo_unix.cpp
index 6684ff7..930785b 100644
--- a/src/gui/painting/qprinterinfo_unix.cpp
+++ b/src/gui/painting/qprinterinfo_unix.cpp
@@ -75,7 +75,9 @@ private:
QString m_name;
bool m_isNull;
bool m_default;
- QList<QPrinter::PaperSize> m_paperSizes;
+ mutable bool m_mustGetPaperSizes;
+ mutable QList<QPrinter::PaperSize> m_paperSizes;
+ int m_cupsPrinterIndex;
QPrinterInfo* q_ptr;
};
@@ -838,16 +840,7 @@ QList<QPrinterInfo> QPrinterInfo::availablePrinters()
list.append(QPrinterInfo(printerName));
if (cupsPrinters[i].is_default)
list[i].d_ptr->m_default = true;
- // Find paper sizes.
- cups.setCurrentPrinter(i);
- const ppd_option_t* sizes = cups.pageSizes();
- if (sizes) {
- for (int j = 0; j < sizes->num_choices; ++j) {
- list[i].d_ptr->m_paperSizes.append(
- QPrinterInfoPrivate::string2PaperSize(
- QLatin1String(sizes->choices[j].choice)));
- }
- }
+ list[i].d_ptr->m_cupsPrinterIndex = i;
}
} else {
#endif
@@ -909,16 +902,7 @@ QPrinterInfo::QPrinterInfo(const QPrinter& printer)
if (printerName == printer.printerName()) {
if (cupsPrinters[i].is_default)
d->m_default = true;
- // Find paper sizes.
- cups.setCurrentPrinter(i);
- const ppd_option_t* sizes = cups.pageSizes();
- if (sizes) {
- for (int j = 0; j < sizes->num_choices; ++j) {
- d->m_paperSizes.append(
- QPrinterInfoPrivate::string2PaperSize(
- QLatin1String(sizes->choices[j].choice)));
- }
- }
+ d->m_cupsPrinterIndex = i;
return;
}
}
@@ -983,6 +967,26 @@ bool QPrinterInfo::isDefault() const
QList< QPrinter::PaperSize> QPrinterInfo::supportedPaperSizes() const
{
const Q_D(QPrinterInfo);
+ if (d->m_mustGetPaperSizes) {
+ d->m_mustGetPaperSizes = false;
+
+#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY)
+ QCUPSSupport cups;
+ if (QCUPSSupport::isAvailable()) {
+ // Find paper sizes from CUPS.
+ cups.setCurrentPrinter(d->m_cupsPrinterIndex);
+ const ppd_option_t* sizes = cups.pageSizes();
+ if (sizes) {
+ for (int j = 0; j < sizes->num_choices; ++j) {
+ d->m_paperSizes.append(
+ QPrinterInfoPrivate::string2PaperSize(
+ QLatin1String(sizes->choices[j].choice)));
+ }
+ }
+ }
+#endif
+
+ }
return d->m_paperSizes;
}
@@ -993,6 +997,8 @@ QPrinterInfoPrivate::QPrinterInfoPrivate()
{
m_isNull = true;
m_default = false;
+ m_mustGetPaperSizes = true;
+ m_cupsPrinterIndex = 0;
q_ptr = 0;
}
@@ -1001,6 +1007,8 @@ QPrinterInfoPrivate::QPrinterInfoPrivate(const QString& name)
m_name = name;
m_isNull = false;
m_default = false;
+ m_mustGetPaperSizes = true;
+ m_cupsPrinterIndex = 0;
q_ptr = 0;
}
diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h
index 2a1be86..f99fbf6 100644
--- a/src/gui/painting/qregion.h
+++ b/src/gui/painting/qregion.h
@@ -116,7 +116,9 @@ public:
QRect boundingRect() const;
QVector<QRect> rects() const;
void setRects(const QRect *rect, int num);
+#ifdef QT_DEPRECATED
QT_DEPRECATED int numRects() const;
+#endif
int rectCount() const;
const QRegion operator|(const QRegion &r) const;
diff --git a/src/gui/painting/qstroker.cpp b/src/gui/painting/qstroker.cpp
index 228a6b1..8bb4728 100644
--- a/src/gui/painting/qstroker.cpp
+++ b/src/gui/painting/qstroker.cpp
@@ -910,8 +910,8 @@ QPointF qt_curves_for_arc(const QRectF &rect, qreal startAngle, qreal sweepLengt
}
}
- int startSegment = int(floor(startAngle / 90));
- int endSegment = int(floor((startAngle + sweepLength) / 90));
+ int startSegment = int(qFloor(startAngle / 90));
+ int endSegment = int(qFloor((startAngle + sweepLength) / 90));
qreal startT = (startAngle - startSegment * 90) / 90;
qreal endT = (startAngle + sweepLength - endSegment * 90) / 90;
diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h
index 57473d1..bb0c630 100644
--- a/src/gui/painting/qtextureglyphcache_p.h
+++ b/src/gui/painting/qtextureglyphcache_p.h
@@ -76,7 +76,7 @@ class Q_GUI_EXPORT QTextureGlyphCache : public QFontEngineGlyphCache
{
public:
QTextureGlyphCache(QFontEngineGlyphCache::Type type, const QTransform &matrix)
- : QFontEngineGlyphCache(matrix), m_w(0), m_h(0), m_cx(0), m_cy(0), m_type(type) { }
+ : QFontEngineGlyphCache(matrix, type), m_w(0), m_h(0), m_cx(0), m_cy(0) { }
virtual ~QTextureGlyphCache() { }
@@ -98,8 +98,6 @@ public:
virtual void resizeTextureData(int width, int height) = 0;
virtual int glyphMargin() const { return 0; }
- QFontEngineGlyphCache::Type cacheType() const { return m_type; }
-
virtual void fillTexture(const Coord &coord, glyph_t glyph) = 0;
inline void createCache(int width, int height) {
@@ -121,7 +119,6 @@ protected:
int m_h; // image height
int m_cx; // current x
int m_cy; // current y
- QFontEngineGlyphCache::Type m_type;
};
diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp
index c66da71..15427c6 100644
--- a/src/gui/painting/qwindowsurface_s60.cpp
+++ b/src/gui/painting/qwindowsurface_s60.cpp
@@ -68,12 +68,14 @@ QS60WindowSurface::QS60WindowSurface(QWidget* widget)
mode = EColor16MA; // Try for transparency anyway
// We create empty CFbsBitmap here -> it will be resized in setGeometry
- CFbsBitmap *bitmap = q_check_ptr(new CFbsBitmap); // CBase derived object needs check on new
+ CFbsBitmap *bitmap = q_check_ptr(new CFbsBitmap); // CBase derived object needs check on new
qt_symbian_throwIfError( bitmap->Create( TSize(0, 0), mode ) );
QS60PixmapData *data = new QS60PixmapData(QPixmapData::PixmapType);
- data->fromSymbianBitmap(bitmap);
- d_ptr->device = QPixmap(data);
+ if (data) {
+ data->fromSymbianBitmap(bitmap, true);
+ d_ptr->device = QPixmap(data);
+ }
setStaticContentsSupport(true);
}
diff --git a/src/gui/statemachine/qguistatemachine.cpp b/src/gui/statemachine/qguistatemachine.cpp
index 4f7806f..c3a9228 100644
--- a/src/gui/statemachine/qguistatemachine.cpp
+++ b/src/gui/statemachine/qguistatemachine.cpp
@@ -186,8 +186,10 @@ static QEvent *cloneEvent(QEvent *e)
case QEvent::DeactivateControl:
return new QEvent(*e);
+#ifndef QT_NO_CONTEXTMENU
case QEvent::ContextMenu:
return new QContextMenuEvent(*static_cast<QContextMenuEvent*>(e));
+#endif
case QEvent::InputMethod:
return new QInputMethodEvent(*static_cast<QInputMethodEvent*>(e));
case QEvent::AccessibilityPrepare:
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp
index 5028e5f..c1beb6a 100644
--- a/src/gui/styles/qcommonstyle.cpp
+++ b/src/gui/styles/qcommonstyle.cpp
@@ -2775,7 +2775,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
QSize size = (sr == SE_TabBarTabLeftButton) ? tab->leftButtonSize : tab->rightButtonSize;
int w = size.width();
int h = size.height();
- int midHeight = static_cast<int>(ceil(float(tr.height() - h) / 2));
+ int midHeight = static_cast<int>(qCeil(float(tr.height() - h) / 2));
int midWidth = ((tr.width() - w) / 2);
bool atTheTop = true;
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index be4f15a..bcc993a 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -84,23 +84,15 @@ extern Q_GUI_EXPORT int qt_defaultDpiY();
const QS60StylePrivate::SkinElementFlags QS60StylePrivate::KDefaultSkinElementFlags =
SkinElementFlags(SF_PointNorth | SF_StateEnabled);
-static const QByteArray propertyKeyLayouts = "layouts";
-static const QByteArray propertyKeyCurrentlayout = "currentlayout";
-
static const qreal goldenRatio = 1.618;
const layoutHeader QS60StylePrivate::m_layoutHeaders[] = {
// *** generated layout data ***
-{240,320,1,15,true,"QVGA Landscape Mirrored"},
-{240,320,1,15,false,"QVGA Landscape"},
-{320,240,1,15,true,"QVGA Portrait Mirrored"},
-{320,240,1,15,false,"QVGA Portrait"},
-{360,640,1,15,true,"NHD Landscape Mirrored"},
-{360,640,1,15,false,"NHD Landscape"},
-{640,360,1,15,true,"NHD Portrait Mirrored"},
-{640,360,1,15,false,"NHD Portrait"},
-{352,800,1,12,true,"E90 Landscape Mirrored"},
-{352,800,1,12,false,"E90 Landscape"}
+{240,320,1,15,"QVGA Landscape"},
+{320,240,1,15,"QVGA Portrait"},
+{360,640,1,15,"NHD Landscape"},
+{640,360,1,15,"NHD Portrait"},
+{352,800,1,12,"E90 Landscape"}
// *** End of generated data ***
};
const int QS60StylePrivate::m_numberOfLayouts =
@@ -108,15 +100,10 @@ const int QS60StylePrivate::m_numberOfLayouts =
const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = {
// *** generated pixel metrics ***
-{5,0,-909,0,0,2,0,0,-1,7,12,19,13,13,6,200,-909,-909,-909,20,13,2,0,0,21,7,18,-909,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,3,3,4,9,13,-909,5,51,11,5,0,6,3,3,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1},
{5,0,-909,0,0,2,0,0,-1,7,12,19,13,13,6,200,-909,-909,-909,20,13,2,0,0,21,7,18,-909,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,3,3,4,9,13,-909,5,51,11,5,0,3,3,6,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1},
-{5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,-909,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,4,4,5,10,15,-909,5,58,13,5,0,7,4,4,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1},
{5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,-909,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,4,4,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1},
-{7,0,-909,0,0,2,0,0,-1,25,69,28,19,19,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,-909,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,5,5,6,8,19,-909,7,74,19,7,0,8,5,5,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1},
{7,0,-909,0,0,2,0,0,-1,25,69,28,19,19,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,-909,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,5,5,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1},
-{7,0,-909,0,0,2,0,0,-1,25,68,28,19,19,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,-909,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,5,5,6,8,19,-909,7,74,22,7,0,8,5,5,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1},
{7,0,-909,0,0,2,0,0,-1,25,68,28,19,19,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,-909,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,5,5,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1},
-{7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,-909,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,5,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,8,6,5,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1},
{7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,-909,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1}
// *** End of generated data ***
};
@@ -203,10 +190,24 @@ void QS60StylePrivate::drawSkinElement(SkinElements element, QPainter *painter,
QS60StyleEnums::SP_QsnCpScrollHandleBottom, Qt::Vertical, painter, rect, flags | SF_PointNorth);
break;
case SE_SliderHandleHorizontal:
- drawPart(QS60StyleEnums::SP_QgnIndiSliderEdit, painter, rect, flags | SF_PointNorth);
+ drawPart(QS60StyleEnums::SP_QgnGrafNsliderMarker, painter, rect, flags | SF_PointNorth);
break;
case SE_SliderHandleVertical:
- drawPart(QS60StyleEnums::SP_QgnIndiSliderEdit, painter, rect, flags | SF_PointEast);
+ drawPart(QS60StyleEnums::SP_QgnGrafNsliderMarker, painter, rect, flags | SF_PointEast);
+ break;
+ case SE_SliderHandleSelectedHorizontal:
+ drawPart(QS60StyleEnums::SP_QgnGrafNsliderMarkerSelected, painter, rect, flags | SF_PointNorth);
+ break;
+ case SE_SliderHandleSelectedVertical:
+ drawPart(QS60StyleEnums::SP_QgnGrafNsliderMarkerSelected, painter, rect, flags | SF_PointEast);
+ break;
+ case SE_SliderGrooveVertical:
+ drawRow(QS60StyleEnums::SP_QgnGrafNsliderEndLeft, QS60StyleEnums::SP_QgnGrafNsliderMiddle,
+ QS60StyleEnums::SP_QgnGrafNsliderEndRight, Qt::Vertical, painter, rect, flags | SF_PointEast);
+ break;
+ case SE_SliderGrooveHorizontal:
+ drawRow(QS60StyleEnums::SP_QgnGrafNsliderEndLeft, QS60StyleEnums::SP_QgnGrafNsliderMiddle,
+ QS60StyleEnums::SP_QgnGrafNsliderEndRight, Qt::Horizontal, painter, rect, flags | SF_PointNorth);
break;
case SE_TabBarTabEastActive:
drawRow(QS60StyleEnums::SP_QgnGrafTabActiveL, QS60StyleEnums::SP_QgnGrafTabActiveM,
@@ -309,8 +310,8 @@ QColor QS60StylePrivate::stateColor(const QColor &color, const QStyleOption *opt
QColor hsvColor = retColor.toHsv();
int colorSat = hsvColor.saturation();
int colorVal = hsvColor.value();
- colorSat = (colorSat!=0) ? (colorSat>>1) : 128;
- colorVal = (colorVal!=0) ? (colorVal>>1) : 128;
+ colorSat = (colorSat != 0) ? (colorSat >> 1) : 128;
+ colorVal = (colorVal != 0) ? (colorVal >> 1) : 128;
hsvColor.setHsv(hsvColor.hue(), colorSat, colorVal);
retColor = hsvColor.toRgb();
}
@@ -338,7 +339,7 @@ QColor QS60StylePrivate::lighterColor(const QColor &baseColor)
bool QS60StylePrivate::drawsOwnThemeBackground(const QWidget *widget)
{
- return qobject_cast<const QDialog *> (widget);
+ return (widget ? (widget->windowType() == Qt::Dialog) : false);
}
QFont QS60StylePrivate::s60Font(
@@ -371,7 +372,6 @@ void QS60StylePrivate::clearCaches(CacheClearReason reason)
case CC_LayoutChange:
// when layout changes, the colors remain in cache, but graphics and fonts can change
m_mappedFontsCache.clear();
- deleteBackground();
QPixmapCache::clear();
break;
case CC_ThemeChange:
@@ -399,10 +399,10 @@ QColor QS60StylePrivate::colorFromFrameGraphics(SkinFrameElements frame) const
if (!cachedColorExists) {
const int frameCornerWidth = pixelMetric(PM_Custom_FrameCornerWidth);
const int frameCornerHeight = pixelMetric(PM_Custom_FrameCornerHeight);
- Q_ASSERT(2*frameCornerWidth<32);
- Q_ASSERT(2*frameCornerHeight<32);
+ Q_ASSERT(2 * frameCornerWidth < 32);
+ Q_ASSERT(2 * frameCornerHeight < 32);
- const QImage frameImage = QS60StylePrivate::frame(frame, QSize(32,32)).toImage();
+ const QImage frameImage = QS60StylePrivate::frame(frame, QSize(32, 32)).toImage();
Q_ASSERT(frameImage.bytesPerLine() > 0);
if (frameImage.isNull())
return Qt::black;
@@ -417,14 +417,14 @@ QColor QS60StylePrivate::colorFromFrameGraphics(SkinFrameElements frame) const
int skips = 0;
int estimations = 0;
- const int topBorderLastPixel = frameCornerHeight*frameImage.width()-1;
- const int bottomBorderFirstPixel = frameImage.width()*frameImage.height()-frameCornerHeight*frameImage.width()-1;
- const int rightBorderFirstPixel = frameImage.width()-frameCornerWidth;
+ const int topBorderLastPixel = frameCornerHeight*frameImage.width() - 1;
+ const int bottomBorderFirstPixel = frameImage.width() * frameImage.height() - frameCornerHeight*frameImage.width() - 1;
+ const int rightBorderFirstPixel = frameImage.width() - frameCornerWidth;
const int leftBorderLastPixel = frameCornerWidth;
while ((skips + estimations) < pixels) {
- if ((skips+estimations) > topBorderLastPixel &&
- (skips+estimations) < bottomBorderFirstPixel) {
+ if ((skips + estimations) > topBorderLastPixel &&
+ (skips + estimations) < bottomBorderFirstPixel) {
for (int rowIndex = 0; rowIndex < frameImage.width(); rowIndex++) {
if (rowIndex > leftBorderLastPixel &&
rowIndex < rightBorderFirstPixel) {
@@ -529,18 +529,18 @@ void QS60StylePrivate::drawRow(QS60StyleEnums::SkinParts start,
endRect = startRect.translated(rect.width() - startRect.width(), 0);
middleRect.adjust(startRect.width(), 0, -startRect.width(), 0);
if (startRect.bottomRight().x() > endRect.topLeft().x()) {
- const int overlap = (startRect.bottomRight().x() - endRect.topLeft().x())>>1;
- startRect.setWidth(startRect.width()-overlap);
- endRect.adjust(overlap,0,0,0);
+ const int overlap = (startRect.bottomRight().x() - endRect.topLeft().x()) >> 1;
+ startRect.setWidth(startRect.width() - overlap);
+ endRect.adjust(overlap, 0, 0, 0);
}
} else {
startRect.setHeight(qMin((rect.height() >> 1) - 1, startRect.height()));
endRect = startRect.translated(0, rect.height() - startRect.height());
middleRect.adjust(0, startRect.height(), 0, -startRect.height());
if (startRect.topRight().y() > endRect.bottomLeft().y()) {
- const int overlap = (startRect.topRight().y() - endRect.bottomLeft().y())>>1;
- startRect.setHeight(startRect.height()-overlap);
- endRect.adjust(0,overlap,0,0);
+ const int overlap = (startRect.topRight().y() - endRect.bottomLeft().y()) >> 1;
+ startRect.setHeight(startRect.height() - overlap);
+ endRect.adjust(0, overlap, 0, 0);
}
}
@@ -808,9 +808,17 @@ QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlag
case QS60StyleEnums::SP_QgnGrafTabActiveL:
//Returned QSize for tabs must not be square, but narrow rectangle with width:height
//ratio of 1:2 for horizontal tab bars (and 2:1 for vertical ones).
- result.setWidth(result.height()>>1);
+ result.setWidth(result.height() >> 1);
break;
- case QS60StyleEnums::SP_QgnIndiSliderEdit:
+
+ case QS60StyleEnums::SP_QgnGrafNsliderEndLeft:
+ case QS60StyleEnums::SP_QgnGrafNsliderEndRight:
+ case QS60StyleEnums::SP_QgnGrafNsliderMiddle:
+ result.setWidth(result.height() >> 1);
+ break;
+
+ case QS60StyleEnums::SP_QgnGrafNsliderMarker:
+ case QS60StyleEnums::SP_QgnGrafNsliderMarkerSelected:
result.scale(pixelMetric(QStyle::PM_SliderLength),
pixelMetric(QStyle::PM_SliderControlThickness), Qt::IgnoreAspectRatio);
break;
@@ -931,22 +939,42 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom
case CC_Slider:
if (const QStyleOptionSlider *optionSlider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- // The groove is just a centered line. Maybe a qgn_graf_line_* at some point
const QRect sliderGroove = subControlRect(control, optionSlider, SC_SliderGroove, widget);
- const QPoint sliderGrooveCenter = sliderGroove.center();
const bool horizontal = optionSlider->orientation == Qt::Horizontal;
- painter->save();
- if (widget)
- painter->setPen(widget->palette().windowText().color());
- if (horizontal)
- painter->drawLine(0, sliderGrooveCenter.y(), sliderGroove.right(), sliderGrooveCenter.y());
- else
- painter->drawLine(sliderGrooveCenter.x(), 0, sliderGrooveCenter.x(), sliderGroove.bottom());
- painter->restore();
+ //Highlight
+/* if (optionSlider->state & QStyle::State_HasFocus)
+ drawPrimitive(PE_FrameFocusRect, optionSlider, painter, widget);*/
+
+ //Groove graphics
+ if (QS60StylePrivate::hasSliderGrooveGraphic()) {
+ const QS60StylePrivate::SkinElements grooveElement = horizontal ?
+ QS60StylePrivate::SE_SliderGrooveHorizontal :
+ QS60StylePrivate::SE_SliderGrooveVertical;
+ QS60StylePrivate::drawSkinElement(grooveElement, painter, sliderGroove, flags);
+ } else {
+ const QRect sliderGroove = subControlRect(control, optionSlider, SC_SliderGroove, widget);
+ const QPoint sliderGrooveCenter = sliderGroove.center();
+ const bool horizontal = optionSlider->orientation == Qt::Horizontal;
+ painter->save();
+ if (widget)
+ painter->setPen(widget->palette().windowText().color());
+ if (horizontal)
+ painter->drawLine(0, sliderGrooveCenter.y(), sliderGroove.right(), sliderGrooveCenter.y());
+ else
+ painter->drawLine(sliderGrooveCenter.x(), 0, sliderGrooveCenter.x(), sliderGroove.bottom());
+ painter->restore();
+ }
+
+ //Handle graphics
const QRect sliderHandle = subControlRect(control, optionSlider, SC_SliderHandle, widget);
- const QS60StylePrivate::SkinElements handleElement =
- horizontal ? QS60StylePrivate::SE_SliderHandleHorizontal : QS60StylePrivate::SE_SliderHandleVertical;
+ QS60StylePrivate::SkinElements handleElement;
+ if (optionSlider->state & QStyle::State_Sunken)
+ handleElement =
+ horizontal ? QS60StylePrivate::SE_SliderHandleSelectedHorizontal : QS60StylePrivate::SE_SliderHandleSelectedVertical;
+ else
+ handleElement =
+ horizontal ? QS60StylePrivate::SE_SliderHandleHorizontal : QS60StylePrivate::SE_SliderHandleVertical;
QS60StylePrivate::drawSkinElement(handleElement, painter, sliderHandle, flags);
}
break;
@@ -963,10 +991,11 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom
buttonOption.QStyleOption::operator=(*cmb);
const int maxHeight = cmbxFrame.height();
const int maxWidth = cmbxFrame.width() - cmbxEditField.width();
- const int topLeftPoint = direction ? cmbxEditField.right()+1 : cmbxEditField.left()+1-maxWidth;
+ const int topLeftPoint = direction ?
+ (cmbxEditField.right() + 1) : (cmbxEditField.left() + 1 - maxWidth);
const QRect buttonRect(topLeftPoint, cmbxEditField.top(), maxWidth, maxHeight);
buttonOption.rect = buttonRect;
- buttonOption.state = cmb->state & (State_Enabled | State_MouseOver);
+ buttonOption.state = cmb->state;
drawPrimitive(PE_PanelButtonCommand, &buttonOption, painter, widget);
// draw label background - label itself is drawn separately
@@ -1320,6 +1349,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
painter->setClipRect(voptAdj.rect);
const bool isSelected = (vopt->state & QStyle::State_Selected);
+ const bool hasFocus = (vopt->state & QStyle::State_HasFocus);
bool isScrollBarVisible = false;
int scrollBarWidth = 0;
@@ -1351,9 +1381,9 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
const QModelIndex index = vopt->index;
//todo: Draw cell background only once - for the first cell.
QStyleOptionViewItemV4 voptAdj2 = voptAdj;
- const QModelIndex indexFirst = itemView->model()->index(0,0);
+ const QModelIndex indexFirst = itemView->model()->index(0, 0);
const QModelIndex indexLast = itemView->model()->index(
- itemView->model()->rowCount()-1,itemView->model()->columnCount()-1);
+ itemView->model()->rowCount() - 1, itemView->model()->columnCount() -1);
if (itemView->viewport())
voptAdj2.rect = QRect( itemView->visualRect(indexFirst).topLeft(),
itemView->visualRect(indexLast).bottomRight()).intersect(itemView->viewport()->rect());
@@ -1362,7 +1392,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
} else { QCommonStyle::drawPrimitive(PE_PanelItemViewItem, &voptAdj, painter, widget);}
// draw the focus rect
- if (isSelected) {
+ if (isSelected | hasFocus) {
QRect highlightRect = option->rect.adjusted(1,1,-1,-1);
QAbstractItemView::SelectionBehavior selectionBehavior =
itemView ? itemView->selectionBehavior() : QAbstractItemView::SelectItems;
@@ -1541,16 +1571,16 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
f.setPointSizeF(f.pointSizeF() * KTabFontMul);
painter->setFont(f);
- if (option->state & QStyle::State_Selected){
+ const bool selected = optionTab.state & State_Selected;
+ if (selected)
optionTab.palette.setColor(QPalette::Active, QPalette::WindowText,
QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 3, option));
- }
const bool verticalTabs = optionTab.shape == QTabBar::RoundedEast
|| optionTab.shape == QTabBar::RoundedWest
|| optionTab.shape == QTabBar::TriangularEast
|| optionTab.shape == QTabBar::TriangularWest;
- const bool selected = optionTab.state & State_Selected;
+
if (verticalTabs) {
painter->save();
int newX, newY, newRotation;
@@ -1588,12 +1618,12 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
QPixmap tabIcon = optionTab.icon.pixmap(iconSize,
(optionTab.state & State_Enabled) ? QIcon::Normal : QIcon::Disabled);
if (tab->text.isEmpty())
- painter->drawPixmap(tr.center().x() - (tabIcon.height() >>1),
- tr.center().y() - (tabIcon.height() >>1),
+ painter->drawPixmap(tr.center().x() - (tabIcon.height() >> 1),
+ tr.center().y() - (tabIcon.height() >> 1),
tabIcon);
else
painter->drawPixmap(tr.left() + tabOverlap,
- tr.center().y() - (tabIcon.height() >>1),
+ tr.center().y() - (tabIcon.height() >> 1),
tabIcon);
tr.setLeft(tr.left() + iconSize.width() + 4);
}
@@ -1622,7 +1652,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
if (optionProgressBar->orientation == Qt::Horizontal) {
progressRect.setWidth(int(progressRect.width() * progressFactor));
if(optionProgressBar->direction == Qt::RightToLeft)
- progressRect.translate(optionProgressBar->rect.width()-progressRect.width(),0);
+ progressRect.translate(optionProgressBar->rect.width()-progressRect.width(), 0);
progressRect.adjust(1, 0, -1, 0);
} else {
progressRect.adjust(0, 1, 0, -1);
@@ -1688,18 +1718,18 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
optionCheckBox.QStyleOptionMenuItem::operator=(*menuItem);
optionCheckBox.rect.setWidth(pixelMetric(PM_IndicatorWidth));
optionCheckBox.rect.setHeight(pixelMetric(PM_IndicatorHeight));
- const int moveByX = optionCheckBox.rect.width()+vSpacing;
+ const int moveByX = optionCheckBox.rect.width() + vSpacing;
if (optionMenuItem.direction == Qt::LeftToRight) {
- textRect.translate(moveByX,0);
+ textRect.translate(moveByX, 0);
iconRect.translate(moveByX, 0);
- iconRect.setWidth(iconRect.width()+vSpacing);
- textRect.setWidth(textRect.width()-moveByX-vSpacing);
- optionCheckBox.rect.translate(vSpacing/2, hSpacing/2);
+ iconRect.setWidth(iconRect.width() + vSpacing);
+ textRect.setWidth(textRect.width() - moveByX - vSpacing);
+ optionCheckBox.rect.translate(vSpacing >> 1, hSpacing >> 1);
} else {
- textRect.setWidth(textRect.width()-moveByX);
- iconRect.setWidth(iconRect.width()+vSpacing);
- iconRect.translate(-optionCheckBox.rect.width()-vSpacing, 0);
- optionCheckBox.rect.translate(textRect.width()+iconRect.width(),0);
+ textRect.setWidth(textRect.width() - moveByX);
+ iconRect.setWidth(iconRect.width() + vSpacing);
+ iconRect.translate(-optionCheckBox.rect.width() - vSpacing, 0);
+ optionCheckBox.rect.translate(textRect.width() + iconRect.width(), 0);
}
drawPrimitive(PE_IndicatorMenuCheckMark, &optionCheckBox, painter, widget);
}
@@ -1710,9 +1740,9 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
if (itemWithIcon) {
drawItemPixmap(painter, iconRect, text_flags, pix);
if (optionMenuItem.direction == Qt::LeftToRight)
- textRect.translate(vSpacing,0);
+ textRect.translate(vSpacing, 0);
else
- textRect.translate(-vSpacing,0);
+ textRect.translate(-vSpacing, 0);
textRect.setWidth(textRect.width()-vSpacing);
}
@@ -1720,7 +1750,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
if (drawSubMenuIndicator) {
QStyleOptionMenuItem arrowOptions;
arrowOptions.QStyleOption::operator=(*menuItem);
- const int indicatorWidth = (pixelMetric(PM_ListViewIconSize, option, widget)>>1) +
+ const int indicatorWidth = (pixelMetric(PM_ListViewIconSize, option, widget) >> 1) +
pixelMetric(QStyle::PM_LayoutVerticalSpacing, option, widget);
if (optionMenuItem.direction == Qt::LeftToRight)
arrowOptions.rect.setLeft(textRect.right());
@@ -1765,8 +1795,8 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
painter->save();
QPen linePen = QPen(QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 1, header));
const int penWidth = (header->orientation == Qt::Horizontal) ?
- linePen.width()+QS60StylePrivate::pixelMetric(PM_Custom_BoldLineWidth)
- : linePen.width()+QS60StylePrivate::pixelMetric(PM_Custom_ThinLineWidth);
+ linePen.width() + QS60StylePrivate::pixelMetric(PM_Custom_BoldLineWidth)
+ : linePen.width() + QS60StylePrivate::pixelMetric(PM_Custom_ThinLineWidth);
linePen.setWidth(penWidth);
painter->setPen(linePen);
if (header->orientation == Qt::Horizontal){
@@ -1785,7 +1815,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
//Make cornerButton slightly smaller so that it is not on top of table border graphic.
QStyleOptionHeader subopt = *header;
const int borderTweak =
- QS60StylePrivate::pixelMetric(PM_Custom_FrameCornerWidth)>>1;
+ QS60StylePrivate::pixelMetric(PM_Custom_FrameCornerWidth) >> 1;
if (subopt.direction == Qt::LeftToRight)
subopt.rect.adjust(borderTweak, borderTweak, 0, -borderTweak);
else
@@ -1878,9 +1908,9 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
} else {
const int frameWidth = QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth);
if (option->direction == Qt::LeftToRight)
- headerRect.adjust(-2*frameWidth, 0, 0, 0);
+ headerRect.adjust(-2 * frameWidth, 0, 0, 0);
else
- headerRect.adjust(0, 0, 2*frameWidth, 0);
+ headerRect.adjust(0, 0, 2 * frameWidth, 0);
}
if (option->palette.brush(QPalette::Button).color() == Qt::transparent)
QS60StylePrivate::drawSkinElement(
@@ -2003,7 +2033,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
QRect tickRect = option->rect;
const int frameBorderWidth = QS60StylePrivate::pixelMetric(PM_Custom_FrameCornerWidth);
// adjust tickmark rect to exclude frame border
- tickRect.adjust(0,-frameBorderWidth,0,-frameBorderWidth);
+ tickRect.adjust(0, -frameBorderWidth, 0, -frameBorderWidth);
QS60StyleEnums::SkinParts skinPart = QS60StyleEnums::SP_QgnIndiMarkedAdd;
QS60StylePrivate::drawSkinPart(skinPart, painter, tickRect,
(flags | QS60StylePrivate::SF_ColorSkinned));
@@ -2015,7 +2045,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
case PE_IndicatorRadioButton: {
QRect buttonRect = option->rect;
//there is empty (a. 33%) space in svg graphics for radiobutton
- const qreal reduceWidth = (qreal)buttonRect.width()/3.0;
+ const qreal reduceWidth = (qreal)buttonRect.width() / 3.0;
const qreal rectWidth = (qreal)option->rect.width() != 0 ? option->rect.width() : 1.0;
// Try to occupy the full area
const qreal scaler = 1 + (reduceWidth/rectWidth);
@@ -2078,27 +2108,28 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
case PE_IndicatorSpinDown:
case PE_IndicatorSpinUp:
if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
- QStyleOptionSpinBox optionSpinBox = *spinBox;
- if (QS60StylePrivate::canDrawThemeBackground(optionSpinBox.palette.base())) {
+ if (QS60StylePrivate::canDrawThemeBackground(spinBox->palette.base())) {
+ QStyleOptionSpinBox optionSpinBox = *spinBox;
const QS60StyleEnums::SkinParts part = (element == PE_IndicatorSpinUp) ?
QS60StyleEnums::SP_QgnGrafScrollArrowUp :
QS60StyleEnums::SP_QgnGrafScrollArrowDown;
- const int adjustment = qMin(optionSpinBox.rect.width(), optionSpinBox.rect.height())/6;
- optionSpinBox.rect.translate(0, (element == PE_IndicatorSpinDown) ? adjustment : -adjustment );
- QS60StylePrivate::drawSkinPart(part, painter, optionSpinBox.rect,flags);
+ const int iconMargin = QS60StylePrivate::pixelMetric(PM_Custom_FrameCornerWidth) >> 1;
+ optionSpinBox.rect.translate(0, (element == PE_IndicatorSpinDown) ? iconMargin : -iconMargin );
+ QS60StylePrivate::drawSkinPart(part, painter, optionSpinBox.rect, flags);
} else {
commonStyleDraws = true;
}
}
+#endif //QT_NO_SPINBOX
#ifndef QT_NO_COMBOBOX
- else if (const QStyleOptionFrame *cmb = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
+ if (const QStyleOptionFrame *cmb = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
if (QS60StylePrivate::canDrawThemeBackground( option->palette.base())) {
// We want to draw down arrow here for comboboxes as well.
+ QStyleOptionFrame optionsComboBox = *cmb;
const QS60StyleEnums::SkinParts part = QS60StyleEnums::SP_QgnGrafScrollArrowDown;
- QStyleOptionFrame comboBox = *cmb;
- const int adjustment = qMin(comboBox.rect.width(), comboBox.rect.height())/6;
- comboBox.rect.translate(0, (element == PE_IndicatorSpinDown) ? adjustment : -adjustment );
- QS60StylePrivate::drawSkinPart(part, painter, comboBox.rect,flags);
+ const int iconMargin = QS60StylePrivate::pixelMetric(PM_Custom_FrameCornerWidth) >> 1;
+ optionsComboBox.rect.translate(0, (element == PE_IndicatorSpinDown) ? iconMargin : -iconMargin );
+ QS60StylePrivate::drawSkinPart(part, painter, optionsComboBox.rect, flags);
} else {
commonStyleDraws = true;
}
@@ -2116,12 +2147,11 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
// We want to draw down arrow here for comboboxes as well.
QStyleOptionFrame comboBox = *cmb;
const int frameWidth = QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth);
- comboBox.rect.adjust(0,frameWidth,0,-frameWidth);
+ comboBox.rect.adjust(0, frameWidth, 0, -frameWidth);
QCommonStyle::drawPrimitive(element, &comboBox, painter, widget);
}
#endif //QT_NO_COMBOBOX
break;
-#endif //QT_NO_SPINBOX
case PE_Widget:
if (QS60StylePrivate::drawsOwnThemeBackground(widget)
#ifndef QT_NO_COMBOBOX
@@ -2131,7 +2161,10 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
|| qobject_cast<const QMenu *> (widget)
#endif //QT_NO_MENU
) {
- if (QS60StylePrivate::canDrawThemeBackground(option->palette.base()))
+ //Need extra check since dialogs have their own theme background
+ if (QS60StylePrivate::canDrawThemeBackground(option->palette.base()) &&
+ option->palette.window().texture().cacheKey() ==
+ QS60StylePrivate::m_themePalette->window().texture().cacheKey())
QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_OptionsMenu, painter, option->rect, flags);
else
commonStyleDraws = true;
@@ -2241,11 +2274,13 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
}
break;
+ case PE_PanelScrollAreaCorner:
+ break;
+
// todo: items are below with #ifdefs "just in case". in final version, remove all non-required cases
case PE_FrameLineEdit:
case PE_IndicatorDockWidgetResizeHandle:
case PE_PanelTipLabel:
- case PE_PanelScrollAreaCorner:
#ifndef QT_NO_TABBAR
case PE_IndicatorTabTear: // No tab tear in S60
@@ -2287,6 +2322,13 @@ int QS60Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const
metricValue = -menuWidth;
}
}
+ //if layout direction is mirrored, switch left and right border margins
+ if (option && option->direction == Qt::RightToLeft) {
+ if (metric == PM_LayoutLeftMargin)
+ metricValue = QS60StylePrivate::pixelMetric(PM_LayoutRightMargin);
+ else if (metric == PM_LayoutRightMargin)
+ metricValue = QS60StylePrivate::pixelMetric(PM_LayoutLeftMargin);
+ }
return metricValue;
}
@@ -2299,22 +2341,22 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt,
case CT_ToolButton:
sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget);
//FIXME properly - style should calculate the location of border frame-part
- sz += QSize(2*pixelMetric(PM_ButtonMargin), 2*pixelMetric(PM_ButtonMargin));
+ sz += QSize(2 * pixelMetric(PM_ButtonMargin), 2 * pixelMetric(PM_ButtonMargin));
if (const QStyleOptionToolButton *toolBtn = qstyleoption_cast<const QStyleOptionToolButton *>(opt))
if (toolBtn->subControls & SC_ToolButtonMenu)
- sz += QSize(pixelMetric(PM_MenuButtonIndicator),0);
+ sz += QSize(pixelMetric(PM_MenuButtonIndicator), 0);
break;
case CT_PushButton:
sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget);
//FIXME properly - style should calculate the location of border frame-part
- sz += QSize(2*pixelMetric(PM_ButtonMargin), 2*pixelMetric(PM_ButtonMargin));
+ sz += QSize(2 * pixelMetric(PM_ButtonMargin), 2 * pixelMetric(PM_ButtonMargin));
if (const QAbstractButton *buttonWidget = (qobject_cast<const QAbstractButton *>(widget)))
if (buttonWidget->isCheckable())
sz += QSize(pixelMetric(PM_IndicatorWidth) + pixelMetric(PM_CheckBoxLabelSpacing), 0);
break;
case CT_LineEdit:
if (const QStyleOptionFrame *f = qstyleoption_cast<const QStyleOptionFrame *>(opt))
- sz += QSize(2*f->lineWidth, 4*f->lineWidth);
+ sz += QSize(2 * f->lineWidth, 4 * f->lineWidth);
break;
case CT_TabBarTab:
{
@@ -2329,7 +2371,7 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt,
if (QS60StylePrivate::isTouchSupported())
//Make itemview easier to use in touch devices
//QCommonStyle does not adjust height with horizontal margin, it only adjusts width
- sz.setHeight(sz.height() + 2*pixelMetric(QStyle::PM_FocusFrameVMargin));
+ sz.setHeight(sz.height() + 2 * pixelMetric(QStyle::PM_FocusFrameVMargin));
break;
default:
sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget);
@@ -2345,10 +2387,10 @@ int QS60Style::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
int retValue = -1;
switch (sh) {
case SH_Table_GridLineColor:
- retValue = int(QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors,2,0).rgba());
+ retValue = int(QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 2, 0).rgba());
break;
case SH_GroupBox_TextLabelColor:
- retValue = int(QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors,6,0).rgba());
+ retValue = int(QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0).rgba());
break;
case SH_ScrollBar_ScrollWhenPointerLeavesControl:
retValue = true;
@@ -2430,7 +2472,7 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple
sliderlen = (qint64(scrollbarOption->pageStep) * maxlen) / (range + scrollbarOption->pageStep);
const int slidermin = pixelMetric(PM_ScrollBarSliderMin, scrollbarOption, widget);
- if (sliderlen < slidermin || range > (INT_MAX>>1))
+ if (sliderlen < slidermin || range > (INT_MAX >> 1))
sliderlen = slidermin;
if (sliderlen > maxlen)
sliderlen = maxlen;
@@ -2481,39 +2523,40 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple
if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
const int frameThickness = spinbox->frame ? pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0;
const int buttonMargin = spinbox->frame ? 2 : 0;
- const int buttonWidth = QS60StylePrivate::pixelMetric(QStyle::PM_ButtonIconSize) + 2*buttonMargin;
+ const int buttonWidth = QS60StylePrivate::pixelMetric(QStyle::PM_ButtonIconSize) + 2 * buttonMargin;
QSize buttonSize;
buttonSize.setHeight(qMax(8, spinbox->rect.height() - frameThickness));
- buttonSize.setWidth(buttonWidth);
+ //width should at least be equal to height
+ buttonSize.setWidth(qMax(buttonSize.height(), buttonWidth));
buttonSize = buttonSize.expandedTo(QApplication::globalStrut());
const int y = frameThickness + spinbox->rect.y();
- const int x = spinbox->rect.x() + spinbox->rect.width() - frameThickness - 2*buttonSize.width();
+ const int x = spinbox->rect.x() + spinbox->rect.width() - frameThickness - 2 * buttonSize.width();
switch (scontrol) {
case SC_SpinBoxUp:
if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons)
return QRect();
- ret = QRect(x, y, buttonWidth, buttonSize.height());
+ ret = QRect(x, y, buttonSize.width(), buttonSize.height());
break;
case SC_SpinBoxDown:
if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons)
return QRect();
- ret = QRect(x+buttonSize.width(), y, buttonWidth, buttonSize.height());
+ ret = QRect(x + buttonSize.width(), y, buttonSize.width(), buttonSize.height());
break;
case SC_SpinBoxEditField:
if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons)
ret = QRect(
frameThickness,
frameThickness,
- spinbox->rect.width() - 2*frameThickness,
- spinbox->rect.height() - 2*frameThickness);
+ spinbox->rect.width() - 2 * frameThickness,
+ spinbox->rect.height() - 2 * frameThickness);
else
ret = QRect(
frameThickness,
frameThickness,
x - frameThickness,
- spinbox->rect.height() - 2*frameThickness);
+ spinbox->rect.height() - 2 * frameThickness);
break;
case SC_SpinBoxFrame:
ret = spinbox->rect;
@@ -2529,29 +2572,29 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple
ret = cmb->rect;
const int width = cmb->rect.width();
const int height = cmb->rect.height();
+ const int buttonIconSize = QS60StylePrivate::pixelMetric(QStyle::PM_ButtonIconSize);
const int buttonMargin = cmb->frame ? 2 : 0;
// lets use spinbox frame here as well, as no combobox specific value available.
const int frameThickness = cmb->frame ? pixelMetric(PM_SpinBoxFrameWidth, cmb, widget) : 0;
- const int buttonWidth = QS60StylePrivate::pixelMetric(QStyle::PM_ButtonIconSize);
+ const int buttonWidth = qMax(cmb->rect.height(), buttonIconSize);
+ const int xposMod = (cmb->rect.x()) + width - buttonMargin - buttonWidth;
+ const int ypos = cmb->rect.y();
QSize buttonSize;
- buttonSize.setHeight(qMax(8, (cmb->rect.height()>>1) - frameThickness)); //minimum of 8 pixels
- buttonSize.setWidth(buttonWidth+2*buttonMargin);
+ buttonSize.setWidth(buttonWidth + 2 * buttonMargin);
+ buttonSize.setHeight(qMax(8, (cmb->rect.height() >> 1) - frameThickness)); //buttons should be squares
buttonSize = buttonSize.expandedTo(QApplication::globalStrut());
switch (scontrol) {
case SC_ComboBoxArrow:
- ret.setRect(
- ret.x() + ret.width() - buttonMargin - buttonWidth,
- ret.y() + buttonMargin,
- buttonWidth,
- height - 2*buttonMargin);
+ ret.setRect(xposMod, ypos + buttonMargin, buttonWidth, height - 2 * buttonMargin);
break;
case SC_ComboBoxEditField: {
- ret.setRect(
- ret.x() + frameThickness,
- ret.y() + frameThickness,
- ret.width() - 2*frameThickness - buttonSize.width(),
- ret.height() - 2*frameThickness);
+ const int withFrameX = cmb->rect.x() + cmb->rect.width() - frameThickness - buttonSize.width();
+ ret = QRect(
+ frameThickness,
+ frameThickness,
+ withFrameX - frameThickness,
+ cmb->rect.height() - 2 * frameThickness);
}
break;
default:
@@ -2568,7 +2611,7 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple
//slightly indent text and boxes, so that dialog border does not mess with them.
const int horizontalSpacing =
QS60StylePrivate::pixelMetric(QStyle::PM_LayoutHorizontalSpacing);
- ret.adjust(2,horizontalSpacing-3,0,0);
+ ret.adjust(2, horizontalSpacing - 3, 0, 0);
}
break;
case SC_GroupBoxFrame: {
@@ -2576,7 +2619,7 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple
const int tbHeight = textBox.height();
ret.translate(0, -ret.y());
// include title to within the groupBox frame
- ret.setHeight(ret.height()+tbHeight);
+ ret.setHeight(ret.height() + tbHeight);
if (widget && ret.bottom() > widget->rect().bottom())
ret.setBottom(widget->rect().bottom());
}
@@ -2588,7 +2631,7 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple
break;
case CC_ToolButton:
if (const QStyleOptionToolButton *toolButton = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
- const int indicatorRect = pixelMetric(PM_MenuButtonIndicator) + 2*pixelMetric(PM_ButtonMargin);
+ const int indicatorRect = pixelMetric(PM_MenuButtonIndicator) + 2 * pixelMetric(PM_ButtonMargin);
const int border = pixelMetric(PM_ButtonMargin) + pixelMetric(PM_DefaultFrameWidth);
ret = toolButton->rect;
const bool popup = (toolButton->features &
@@ -2626,13 +2669,13 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con
// in S60 the input text box doesn't start from line Edit's TL, but
// a bit indented.
QRect lineEditRect = opt->rect;
- const int adjustment = opt->rect.height()>>2;
- lineEditRect.adjust(adjustment,0,0,0);
+ const int adjustment = opt->rect.height() >> 2;
+ lineEditRect.adjust(adjustment, 0, 0, 0);
ret = lineEditRect;
}
break;
case SE_TabBarTearIndicator:
- ret = QRect(0,0,0,0);
+ ret = QRect(0, 0, 0, 0);
break;
case SE_TabWidgetTabBar:
if (const QStyleOptionTabWidgetFrame *optionTab = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) {
@@ -2654,12 +2697,12 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con
// make sure that gain does not set the rect outside of widget boundaries
if (twf->direction == Qt::RightToLeft) {
if ((ret.left() - gain) < widget->rect().left())
- gain = widget->rect().left()-ret.left();
- ret.adjust(-gain,0,0,0);
+ gain = widget->rect().left() - ret.left();
+ ret.adjust(-gain, 0, 0, 0);
} else {
if ((ret.right() + gain) > widget->rect().right())
- gain = widget->rect().right()-ret.right();
- ret.adjust(0,0,gain,0);
+ gain = widget->rect().right() - ret.right();
+ ret.adjust(0, 0, gain, 0);
}
}
break;
@@ -2667,8 +2710,8 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con
default: {
if (widget) {
if ((ret.bottom() + gain) > widget->rect().bottom())
- gain = widget->rect().bottom()-ret.bottom();
- ret.adjust(0,0,0,gain);
+ gain = widget->rect().bottom() - ret.bottom();
+ ret.adjust(0, 0, 0, gain);
}
break;
}
@@ -2694,7 +2737,7 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con
QS60StylePrivate::pixelMetric(QStyle::PM_LayoutVerticalSpacing);
//const int horizontalSpacing = QS60StylePrivate::pixelMetric(QStyle::PM_LayoutHorizontalSpacing);
const int checkBoxRectWidth = subElementRect(SE_ItemViewItemCheckIndicator, opt, widget).width();
- ret.adjust(-checkBoxRectWidth-verticalSpacing,0,-checkBoxRectWidth-verticalSpacing,0);
+ ret.adjust(-checkBoxRectWidth - verticalSpacing, 0, -checkBoxRectWidth - verticalSpacing, 0);
}
} else if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
const bool checkable = menuItem->checkType != QStyleOptionMenuItem::NotCheckable;
@@ -2719,9 +2762,9 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con
if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu){
// submenu indicator is very small, so lets halve the rect
if (menuItem->direction == Qt::LeftToRight)
- ret.adjust(0,0,-(indicatorWidth >> 1),0);
+ ret.adjust(0, 0, -(indicatorWidth >> 1), 0);
else
- ret.adjust((indicatorWidth >> 1),0,0,0);
+ ret.adjust((indicatorWidth >> 1), 0, 0, 0);
}
}
}
@@ -2745,14 +2788,14 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con
const int itemHeight = opt->rect.height();
int heightOffset = 0;
if (indicatorHeight < itemHeight)
- heightOffset = ((itemHeight - indicatorHeight)>>1);
+ heightOffset = ((itemHeight - indicatorHeight) >> 1);
if (checkBoxOnly) {
// Move rect and make it slightly smaller, so that
// a) highlight border does not cross the rect
// b) in s60 list checkbox is smaller than normal checkbox
//todo; magic three
- ret.setRect(opt->rect.left()+3, opt->rect.top() + heightOffset,
- indicatorWidth-3, indicatorHeight-3);
+ ret.setRect(opt->rect.left() + 3, opt->rect.top() + heightOffset,
+ indicatorWidth - 3, indicatorHeight - 3);
} else {
ret.setRect(opt->rect.right() - indicatorWidth - spacing, opt->rect.top() + heightOffset,
indicatorWidth, indicatorHeight);
@@ -2916,7 +2959,7 @@ QIcon QS60Style::standardIconImplementation(StandardPixmap standardIcon,
const QStyleOption *option, const QWidget *widget) const
{
const int iconDimension = QS60StylePrivate::pixelMetric(QStyle::PM_ToolBarIconSize);
- const QRect iconSize = (!option) ? QRect(0,0,iconDimension,iconDimension) : option->rect;
+ const QRect iconSize = (!option) ? QRect(0, 0, iconDimension, iconDimension) : option->rect;
QS60StyleEnums::SkinParts part;
QS60StylePrivate::SkinElementFlags adjustedFlags;
if (option)
diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h
index 5ab2308..65d7574 100644
--- a/src/gui/styles/qs60style_p.h
+++ b/src/gui/styles/qs60style_p.h
@@ -119,6 +119,9 @@ public:
SP_QgnGrafTabPassiveL,
SP_QgnGrafTabPassiveM,
SP_QgnGrafTabPassiveR,
+ SP_QgnGrafNsliderEndLeft,
+ SP_QgnGrafNsliderEndRight,
+ SP_QgnGrafNsliderMiddle,
SP_QgnIndiCheckboxOff,
SP_QgnIndiCheckboxOn,
SP_QgnIndiHlColSuper, // Available in S60 release 3.2 and later.
@@ -131,7 +134,8 @@ public:
SP_QgnIndiNaviArrowRight,
SP_QgnIndiRadiobuttOff,
SP_QgnIndiRadiobuttOn,
- SP_QgnIndiSliderEdit,
+ SP_QgnGrafNsliderMarker,
+ SP_QgnGrafNsliderMarkerSelected,
SP_QgnIndiSubMenu,
SP_QgnNoteErased,
SP_QgnNoteError,
@@ -313,6 +317,10 @@ public:
SE_ScrollBarHandleVertical,
SE_SliderHandleHorizontal,
SE_SliderHandleVertical,
+ SE_SliderHandleSelectedHorizontal,
+ SE_SliderHandleSelectedVertical,
+ SE_SliderGrooveVertical,
+ SE_SliderGrooveHorizontal,
SE_TabBarTabEastActive,
SE_TabBarTabEastInactive,
SE_TabBarTabNorthActive,
@@ -403,6 +411,7 @@ public:
static bool isTouchSupported();
static bool isToolBarBackground();
+ static bool hasSliderGrooveGraphic();
// calculates average color based on button skin graphics (minus borders).
QColor colorFromFrameGraphics(SkinFrameElements frame) const;
@@ -443,7 +452,7 @@ public:
static QSize naviPaneSize();
//Checks that the current brush is transparent or has BrushStyle NoBrush,
- //so that theme graphic background can be drawn.
+ //so that theme graphic background can be drawn.
static bool canDrawThemeBackground(const QBrush &backgroundBrush);
private:
diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp
index 48b8fad..fb9665a 100644
--- a/src/gui/styles/qs60style_s60.cpp
+++ b/src/gui/styles/qs60style_s60.cpp
@@ -62,6 +62,7 @@
#include <AknLayoutFont.h>
#include <aknutils.h>
#include <aknnavi.h>
+#include <gulicon.h>
#if !defined(QT_NO_STYLE_S60) || defined(QT_PLUGIN)
@@ -69,6 +70,7 @@ QT_BEGIN_NAMESPACE
enum TDrawType {
EDrawIcon,
+ EDrawGulIcon,
EDrawBackground,
ENoDraw
};
@@ -80,8 +82,11 @@ enum TSupportRelease {
ES60_5_0 = 0x0004,
ES60_5_1 = 0x0008,
ES60_5_2 = 0x0010,
+ ES60_3_X = ES60_3_1 | ES60_3_2,
+ // Releases before Symbian Foundation
+ ES60_PreSF = ES60_3_1 | ES60_3_2 | ES60_5_0,
// Add all new releases here
- ES60_AllReleases = ES60_3_1 | ES60_3_2 | ES60_5_0 | ES60_5_1 | ES60_5_2
+ ES60_All = ES60_3_1 | ES60_3_2 | ES60_5_0 | ES60_5_1 | ES60_5_2
};
typedef struct {
@@ -101,11 +106,12 @@ public:
static QPixmap colorSkinnedGraphics(const QS60StyleEnums::SkinParts &stylepart,
const QSize &size, QPainter *painter, QS60StylePrivate::SkinElementFlags flags);
static QColor colorValue(const TAknsItemID &colorGroup, int colorIndex);
- static QPixmap fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask, QS60StylePrivate::SkinElementFlags flags, QImage::Format format);
+ static QPixmap fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask, QS60StylePrivate::SkinElementFlags flags, const TSize& targetSize);
static bool disabledPartGraphic(QS60StyleEnums::SkinParts &part);
static bool disabledFrameGraphic(QS60StylePrivate::SkinFrameElements &frame);
static QPixmap generateMissingThemeGraphic(QS60StyleEnums::SkinParts &part, const QSize &size, QS60StylePrivate::SkinElementFlags flags);
static QSize naviPaneSize();
+ static TAknsItemID partSpecificThemeId(int part);
private:
static QPixmap createSkinnedGraphicsLX(QS60StyleEnums::SkinParts part,
@@ -115,209 +121,214 @@ private:
const QSize &size, QPainter *painter, QS60StylePrivate::SkinElementFlags flags);
static void frameIdAndCenterId(QS60StylePrivate::SkinFrameElements frameElement, TAknsItemID &frameId, TAknsItemID &centerId);
static TRect innerRectFromElement(QS60StylePrivate::SkinFrameElements frameElement, const TRect &outerRect);
- static void checkAndUnCompressBitmapL(CFbsBitmap*& aOriginalBitmap);
- static void checkAndUnCompressBitmap(CFbsBitmap*& aOriginalBitmap);
- static void unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap* aTrgBitmap, CFbsBitmap* aSrcBitmap);
- static void fallbackInfo(const QS60StyleEnums::SkinParts &stylepart, TDes& fallbackFileName, TInt& fallbackIndex);
+ static void fallbackInfo(const QS60StyleEnums::SkinParts &stylePart, TInt &fallbackIndex);
static bool checkSupport(const int supportedRelease);
- static TAknsItemID checkAndUpdateReleaseSpecificGraphics(int part);
// Array to match the skin ID, fallback graphics and Qt widget graphics.
static const partMapEntry m_partMap[];
};
const partMapEntry QS60StyleModeSpecifics::m_partMap[] = {
- /* SP_QgnGrafBarWait */ {KAknsIIDQgnGrafBarWaitAnim, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnGrafBarFrameCenter */ {KAknsIIDQgnGrafBarFrameCenter, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnGrafBarFrameSideL */ {KAknsIIDQgnGrafBarFrameSideL, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnGrafBarFrameSideR */ {KAknsIIDQgnGrafBarFrameSideR, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnGrafBarProgress */ {KAknsIIDQgnGrafBarProgress, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnGrafScrollArrowDown */ {KAknsIIDQgnGrafScrollArrowDown, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnGrafScrollArrowLeft */ {KAknsIIDQgnGrafScrollArrowLeft, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnGrafScrollArrowRight */ {KAknsIIDQgnGrafScrollArrowRight, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnGrafScrollArrowUp */ {KAknsIIDQgnGrafScrollArrowUp, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnGrafTabActiveL */ {KAknsIIDQgnGrafTabActiveL, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnGrafTabActiveM */ {KAknsIIDQgnGrafTabActiveM, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnGrafTabActiveR */ {KAknsIIDQgnGrafTabActiveR, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnGrafTabPassiveL */ {KAknsIIDQgnGrafTabPassiveL, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnGrafTabPassiveM */ {KAknsIIDQgnGrafTabPassiveM, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnGrafTabPassiveR */ {KAknsIIDQgnGrafTabPassiveR, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnIndiCheckboxOff */ {KAknsIIDQgnIndiCheckboxOff, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnIndiCheckboxOn */ {KAknsIIDQgnIndiCheckboxOn, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnGrafBarWait */ {KAknsIIDQgnGrafBarWaitAnim, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnGrafBarFrameCenter */ {KAknsIIDQgnGrafBarFrameCenter, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnGrafBarFrameSideL */ {KAknsIIDQgnGrafBarFrameSideL, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnGrafBarFrameSideR */ {KAknsIIDQgnGrafBarFrameSideR, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnGrafBarProgress */ {KAknsIIDQgnGrafBarProgress, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnGrafScrollArrowDown */ {KAknsIIDQgnGrafScrollArrowDown, EDrawGulIcon, ES60_All, -1,-1},
+ /* SP_QgnGrafScrollArrowLeft */ {KAknsIIDQgnGrafScrollArrowLeft, EDrawGulIcon, ES60_All, -1,-1},
+ /* SP_QgnGrafScrollArrowRight */ {KAknsIIDQgnGrafScrollArrowRight, EDrawGulIcon, ES60_All, -1,-1},
+ /* SP_QgnGrafScrollArrowUp */ {KAknsIIDQgnGrafScrollArrowUp, EDrawGulIcon, ES60_All, -1,-1},
+ /* SP_QgnGrafTabActiveL */ {KAknsIIDQgnGrafTabActiveL, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnGrafTabActiveM */ {KAknsIIDQgnGrafTabActiveM, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnGrafTabActiveR */ {KAknsIIDQgnGrafTabActiveR, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnGrafTabPassiveL */ {KAknsIIDQgnGrafTabPassiveL, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnGrafTabPassiveM */ {KAknsIIDQgnGrafTabPassiveM, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnGrafTabPassiveR */ {KAknsIIDQgnGrafTabPassiveR, EDrawIcon, ES60_All, -1,-1},
+
+ // In 3.1 there is no slider groove.
+ /* SP_QgnGrafNsliderEndLeft */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x19cf /* KAknsIIDQgnGrafNsliderEndLeft */},
+ /* SP_QgnGrafNsliderEndRight */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x19d0 /* KAknsIIDQgnGrafNsliderEndRight */},
+ /* SP_QgnGrafNsliderMiddle */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x19d2 /* KAknsIIDQgnGrafNsliderMiddle */},
+ /* SP_QgnIndiCheckboxOff */ {KAknsIIDQgnIndiCheckboxOff, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnIndiCheckboxOn */ {KAknsIIDQgnIndiCheckboxOn, EDrawIcon, ES60_All, -1,-1},
+
// Following 5 items (SP_QgnIndiHlColSuper - SP_QgnIndiHlLineStraight) are available starting from S60 release 3.2.
// In 3.1 CommonStyle drawing is used for these QTreeView elements, since no similar icons in AVKON UI.
- /* SP_QgnIndiHlColSuper */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d5 /* KAknsIIDQgnIndiHlColSuper */},
- /* SP_QgnIndiHlExpSuper */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d6 /* KAknsIIDQgnIndiHlExpSuper */},
- /* SP_QgnIndiHlLineBranch */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d7 /* KAknsIIDQgnIndiHlLineBranch */},
- /* SP_QgnIndiHlLineEnd */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d8 /* KAknsIIDQgnIndiHlLineEnd */},
- /* SP_QgnIndiHlLineStraight */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d9 /* KAknsIIDQgnIndiHlLineStraight */},
- /* SP_QgnIndiMarkedAdd */ {KAknsIIDQgnIndiMarkedAdd, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnIndiNaviArrowLeft */ {KAknsIIDQgnGrafScrollArrowLeft, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnIndiNaviArrowRight */ {KAknsIIDQgnGrafScrollArrowRight, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnIndiRadiobuttOff */ {KAknsIIDQgnIndiRadiobuttOff, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnIndiRadiobuttOn */ {KAknsIIDQgnIndiRadiobuttOn, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnIndiSliderEdit */ {KAknsIIDQgnIndiSliderEdit, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnIndiSubMenu */ {KAknsIIDQgnIndiSubmenu, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnNoteErased */ {KAknsIIDQgnNoteErased, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnNoteError */ {KAknsIIDQgnNoteError, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnNoteInfo */ {KAknsIIDQgnNoteInfo, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnNoteOk */ {KAknsIIDQgnNoteOk, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnNoteQuery */ {KAknsIIDQgnNoteQuery, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnNoteWarning */ {KAknsIIDQgnNoteWarning, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnPropFileSmall */ {KAknsIIDQgnPropFileSmall, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnPropFolderCurrent */ {KAknsIIDQgnPropFolderCurrent, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnPropFolderSmall */ {KAknsIIDQgnPropFolderSmall, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnPropFolderSmallNew */ {KAknsIIDQgnPropFolderSmallNew, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QgnPropPhoneMemcLarge */ {KAknsIIDQgnPropPhoneMemcLarge, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnIndiHlColSuper */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d5 /* KAknsIIDQgnIndiHlColSuper */},
+ /* SP_QgnIndiHlExpSuper */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d6 /* KAknsIIDQgnIndiHlExpSuper */},
+ /* SP_QgnIndiHlLineBranch */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d7 /* KAknsIIDQgnIndiHlLineBranch */},
+ /* SP_QgnIndiHlLineEnd */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d8 /* KAknsIIDQgnIndiHlLineEnd */},
+ /* SP_QgnIndiHlLineStraight */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d9 /* KAknsIIDQgnIndiHlLineStraight */},
+ /* SP_QgnIndiMarkedAdd */ {KAknsIIDQgnIndiMarkedAdd, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnIndiNaviArrowLeft */ {KAknsIIDQgnIndiNaviArrowLeft, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnIndiNaviArrowRight */ {KAknsIIDQgnIndiNaviArrowRight, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnIndiRadiobuttOff */ {KAknsIIDQgnIndiRadiobuttOff, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnIndiRadiobuttOn */ {KAknsIIDQgnIndiRadiobuttOn, EDrawIcon, ES60_All, -1,-1},
+
+ // In 3.1 there different slider graphic and no pressed state.
+ /* SP_QgnGrafNsliderMarker */ {KAknsIIDQgnIndiSliderEdit, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x19d1 /* KAknsIIDQgnGrafNsliderMarker */},
+ /* SP_QgnGrafNsliderMarkerSelected */ {KAknsIIDQgnIndiSliderEdit, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x1a4a /* KAknsIIDQgnGrafNsliderMarkerSelected */},
+ /* SP_QgnIndiSubMenu */ {KAknsIIDQgnIndiSubmenu, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnNoteErased */ {KAknsIIDQgnNoteErased, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnNoteError */ {KAknsIIDQgnNoteError, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnNoteInfo */ {KAknsIIDQgnNoteInfo, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnNoteOk */ {KAknsIIDQgnNoteOk, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnNoteQuery */ {KAknsIIDQgnNoteQuery, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnNoteWarning */ {KAknsIIDQgnNoteWarning, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnPropFileSmall */ {KAknsIIDQgnPropFileSmall, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnPropFolderCurrent */ {KAknsIIDQgnPropFolderCurrent, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnPropFolderSmall */ {KAknsIIDQgnPropFolderSmall, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnPropFolderSmallNew */ {KAknsIIDQgnPropFolderSmallNew, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnPropPhoneMemcLarge */ {KAknsIIDQgnPropPhoneMemcLarge, EDrawIcon, ES60_All, -1,-1},
// 3.1 & 3.2 do not have pressed state for scrollbar, so use normal scrollbar graphics instead.
- /* SP_QsnCpScrollHandleBottomPressed*/ {KAknsIIDQsnCpScrollHandleBottom, EDrawIcon, ES60_3_1 | ES60_3_2, EAknsMajorGeneric, 0x20f8}, /*KAknsIIDQsnCpScrollHandleBottomPressed*/
- /* SP_QsnCpScrollHandleMiddlePressed*/ {KAknsIIDQsnCpScrollHandleMiddle, EDrawIcon, ES60_3_1 | ES60_3_2, EAknsMajorGeneric, 0x20f9}, /*KAknsIIDQsnCpScrollHandleMiddlePressed*/
- /* SP_QsnCpScrollHandleTopPressed*/ {KAknsIIDQsnCpScrollHandleTop, EDrawIcon, ES60_3_1 | ES60_3_2, EAknsMajorGeneric, 0x20fa}, /*KAknsIIDQsnCpScrollHandleTopPressed*/
-
- /* SP_QsnBgScreen */ {KAknsIIDQsnBgScreen, EDrawBackground, ES60_AllReleases, -1,-1},
-
- /* SP_QsnCpScrollBgBottom */ {KAknsIIDQsnCpScrollBgBottom, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QsnCpScrollBgMiddle */ {KAknsIIDQsnCpScrollBgMiddle, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QsnCpScrollBgTop */ {KAknsIIDQsnCpScrollBgTop, EDrawIcon, ES60_AllReleases, -1,-1},
-
- /* SP_QsnCpScrollHandleBottom */ {KAknsIIDQsnCpScrollHandleBottom, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QsnCpScrollHandleMiddle */ {KAknsIIDQsnCpScrollHandleMiddle, EDrawIcon, ES60_AllReleases, -1,-1},
- /* SP_QsnCpScrollHandleTop */ {KAknsIIDQsnCpScrollHandleTop, EDrawIcon, ES60_AllReleases, -1,-1},
-
- /* SP_QsnFrButtonTbCornerTl */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_AllReleases, -1,-1}, //todo: use "normal button" from 5.0 onwards
- /* SP_QsnFrButtonTbCornerTr */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrButtonTbCornerBl */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrButtonTbCornerBr */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrButtonTbSideT */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrButtonTbSideB */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrButtonTbSideL */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrButtonTbSideR */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrButtonTbCenter */ {KAknsIIDQsnFrButtonTbCenter, EDrawIcon, ES60_AllReleases, -1,-1},
-
- /* SP_QsnFrButtonTbCornerTlPressed */{KAknsIIDQsnFrButtonTbCornerTlPressed, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrButtonTbCornerTrPressed */{KAknsIIDQsnFrButtonTbCornerTrPressed, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrButtonTbCornerBlPressed */{KAknsIIDQsnFrButtonTbCornerBlPressed, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrButtonTbCornerBrPressed */{KAknsIIDQsnFrButtonTbCornerBrPressed, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrButtonTbSideTPressed */ {KAknsIIDQsnFrButtonTbSideTPressed, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrButtonTbSideBPressed */ {KAknsIIDQsnFrButtonTbSideBPressed, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrButtonTbSideLPressed */ {KAknsIIDQsnFrButtonTbSideLPressed, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrButtonTbSideRPressed */ {KAknsIIDQsnFrButtonTbSideRPressed, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrButtonTbCenterPressed */ {KAknsIIDQsnFrButtonTbCenterPressed, EDrawIcon, ES60_AllReleases, -1,-1},
-
- /* SP_QsnFrCaleCornerTl */ {KAknsIIDQsnFrCaleCornerTl, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrCaleCornerTr */ {KAknsIIDQsnFrCaleCornerTr, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrCaleCornerBl */ {KAknsIIDQsnFrCaleCornerBl, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrCaleCornerBr */ {KAknsIIDQsnFrCaleCornerBr, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrCaleGSideT */ {KAknsIIDQsnFrCaleSideT, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrCaleGSideB */ {KAknsIIDQsnFrCaleSideB, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrCaleGSideL */ {KAknsIIDQsnFrCaleSideL, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrCaleGSideR */ {KAknsIIDQsnFrCaleSideR, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrCaleCenter */ {KAknsIIDQsnFrCaleCenter, ENoDraw, ES60_AllReleases, -1,-1},
-
- /* SP_QsnFrCaleHeadingCornerTl */ {KAknsIIDQsnFrCaleHeadingCornerTl, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrCaleHeadingCornerTr */ {KAknsIIDQsnFrCaleHeadingCornerTr, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrCaleHeadingCornerBl */ {KAknsIIDQsnFrCaleHeadingCornerBl, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrCaleHeadingCornerBr */ {KAknsIIDQsnFrCaleHeadingCornerBr, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrCaleHeadingSideT */ {KAknsIIDQsnFrCaleHeadingSideT, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrCaleHeadingSideB */ {KAknsIIDQsnFrCaleHeadingSideB, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrCaleHeadingSideL */ {KAknsIIDQsnFrCaleHeadingSideL, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrCaleHeadingSideR */ {KAknsIIDQsnFrCaleHeadingSideR, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrCaleHeadingCenter */ {KAknsIIDQsnFrCaleHeadingCenter, ENoDraw, ES60_AllReleases, -1,-1},
-
- /* SP_QsnFrInputCornerTl */ {KAknsIIDQsnFrInputCornerTl, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrInputCornerTr */ {KAknsIIDQsnFrInputCornerTr, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrInputCornerBl */ {KAknsIIDQsnFrInputCornerBl, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrInputCornerBr */ {KAknsIIDQsnFrInputCornerBr, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrInputSideT */ {KAknsIIDQsnFrInputSideT, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrInputSideB */ {KAknsIIDQsnFrInputSideB, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrInputSideL */ {KAknsIIDQsnFrInputSideL, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrInputSideR */ {KAknsIIDQsnFrInputSideR, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrInputCenter */ {KAknsIIDQsnFrInputCenter, ENoDraw, ES60_AllReleases, -1,-1},
-
- /* SP_QsnFrListCornerTl */ {KAknsIIDQsnFrListCornerTl, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrListCornerTr */ {KAknsIIDQsnFrListCornerTr, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrListCornerBl */ {KAknsIIDQsnFrListCornerBl, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrListCornerBr */ {KAknsIIDQsnFrListCornerBr, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrListSideT */ {KAknsIIDQsnFrListSideT, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrListSideB */ {KAknsIIDQsnFrListSideB, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrListSideL */ {KAknsIIDQsnFrListSideL, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrListSideR */ {KAknsIIDQsnFrListSideR, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrListCenter */ {KAknsIIDQsnFrListCenter, ENoDraw, ES60_AllReleases, -1,-1},
-
- /* SP_QsnFrPopupCornerTl */ {KAknsIIDQsnFrPopupCornerTl, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrPopupCornerTr */ {KAknsIIDQsnFrPopupCornerTr, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrPopupCornerBl */ {KAknsIIDQsnFrPopupCornerBl, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrPopupCornerBr */ {KAknsIIDQsnFrPopupCornerBr, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrPopupSideT */ {KAknsIIDQsnFrPopupSideT, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrPopupSideB */ {KAknsIIDQsnFrPopupSideB, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrPopupSideL */ {KAknsIIDQsnFrPopupSideL, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrPopupSideR */ {KAknsIIDQsnFrPopupSideR, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrPopupCenter */ {KAknsIIDQsnFrPopupCenter, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnCpScrollHandleBottomPressed*/ {KAknsIIDQsnCpScrollHandleBottom, EDrawIcon, ES60_3_X, EAknsMajorGeneric, 0x20f8}, /*KAknsIIDQsnCpScrollHandleBottomPressed*/
+ /* SP_QsnCpScrollHandleMiddlePressed*/ {KAknsIIDQsnCpScrollHandleMiddle, EDrawIcon, ES60_3_X, EAknsMajorGeneric, 0x20f9}, /*KAknsIIDQsnCpScrollHandleMiddlePressed*/
+ /* SP_QsnCpScrollHandleTopPressed*/ {KAknsIIDQsnCpScrollHandleTop, EDrawIcon, ES60_3_X, EAknsMajorGeneric, 0x20fa}, /*KAknsIIDQsnCpScrollHandleTopPressed*/
+
+ /* SP_QsnBgScreen */ {KAknsIIDQsnBgScreen, EDrawBackground, ES60_All, -1,-1},
+
+ /* SP_QsnCpScrollBgBottom */ {KAknsIIDQsnCpScrollBgBottom, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QsnCpScrollBgMiddle */ {KAknsIIDQsnCpScrollBgMiddle, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QsnCpScrollBgTop */ {KAknsIIDQsnCpScrollBgTop, EDrawIcon, ES60_All, -1,-1},
+
+ /* SP_QsnCpScrollHandleBottom */ {KAknsIIDQsnCpScrollHandleBottom, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QsnCpScrollHandleMiddle */ {KAknsIIDQsnCpScrollHandleMiddle, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QsnCpScrollHandleTop */ {KAknsIIDQsnCpScrollHandleTop, EDrawIcon, ES60_All, -1,-1},
+
+ /* SP_QsnFrButtonTbCornerTl */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_All, -1, -1},
+ /* SP_QsnFrButtonTbCornerTr */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_All, -1, -1},
+ /* SP_QsnFrButtonTbCornerBl */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_All, -1, -1},
+ /* SP_QsnFrButtonTbCornerBr */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_All, -1, -1},
+ /* SP_QsnFrButtonTbSideT */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_All, -1, -1},
+ /* SP_QsnFrButtonTbSideB */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_All, -1, -1},
+ /* SP_QsnFrButtonTbSideL */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_All, -1, -1},
+ /* SP_QsnFrButtonTbSideR */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_All, -1, -1},
+ /* SP_QsnFrButtonTbCenter */ {KAknsIIDQsnFrButtonTbCenter, EDrawIcon, ES60_All, -1, -1},
+
+ /* SP_QsnFrButtonTbCornerTlPressed */{KAknsIIDQsnFrButtonTbCornerTlPressed, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrButtonTbCornerTrPressed */{KAknsIIDQsnFrButtonTbCornerTrPressed, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrButtonTbCornerBlPressed */{KAknsIIDQsnFrButtonTbCornerBlPressed, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrButtonTbCornerBrPressed */{KAknsIIDQsnFrButtonTbCornerBrPressed, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrButtonTbSideTPressed */ {KAknsIIDQsnFrButtonTbSideTPressed, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrButtonTbSideBPressed */ {KAknsIIDQsnFrButtonTbSideBPressed, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrButtonTbSideLPressed */ {KAknsIIDQsnFrButtonTbSideLPressed, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrButtonTbSideRPressed */ {KAknsIIDQsnFrButtonTbSideRPressed, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrButtonTbCenterPressed */ {KAknsIIDQsnFrButtonTbCenterPressed, EDrawIcon, ES60_All, -1,-1},
+
+ /* SP_QsnFrCaleCornerTl */ {KAknsIIDQsnFrCaleCornerTl, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleCornerTr */ {KAknsIIDQsnFrCaleCornerTr, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleCornerBl */ {KAknsIIDQsnFrCaleCornerBl, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleCornerBr */ {KAknsIIDQsnFrCaleCornerBr, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleGSideT */ {KAknsIIDQsnFrCaleSideT, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleGSideB */ {KAknsIIDQsnFrCaleSideB, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleGSideL */ {KAknsIIDQsnFrCaleSideL, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleGSideR */ {KAknsIIDQsnFrCaleSideR, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleCenter */ {KAknsIIDQsnFrCaleCenter, ENoDraw, ES60_All, -1,-1},
+
+ /* SP_QsnFrCaleHeadingCornerTl */ {KAknsIIDQsnFrCaleHeadingCornerTl, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleHeadingCornerTr */ {KAknsIIDQsnFrCaleHeadingCornerTr, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleHeadingCornerBl */ {KAknsIIDQsnFrCaleHeadingCornerBl, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleHeadingCornerBr */ {KAknsIIDQsnFrCaleHeadingCornerBr, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleHeadingSideT */ {KAknsIIDQsnFrCaleHeadingSideT, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleHeadingSideB */ {KAknsIIDQsnFrCaleHeadingSideB, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleHeadingSideL */ {KAknsIIDQsnFrCaleHeadingSideL, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleHeadingSideR */ {KAknsIIDQsnFrCaleHeadingSideR, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleHeadingCenter */ {KAknsIIDQsnFrCaleHeadingCenter, ENoDraw, ES60_All, -1,-1},
+
+ /* SP_QsnFrInputCornerTl */ {KAknsIIDQsnFrInputCornerTl, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrInputCornerTr */ {KAknsIIDQsnFrInputCornerTr, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrInputCornerBl */ {KAknsIIDQsnFrInputCornerBl, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrInputCornerBr */ {KAknsIIDQsnFrInputCornerBr, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrInputSideT */ {KAknsIIDQsnFrInputSideT, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrInputSideB */ {KAknsIIDQsnFrInputSideB, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrInputSideL */ {KAknsIIDQsnFrInputSideL, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrInputSideR */ {KAknsIIDQsnFrInputSideR, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrInputCenter */ {KAknsIIDQsnFrInputCenter, ENoDraw, ES60_All, -1,-1},
+
+ /* SP_QsnFrListCornerTl */ {KAknsIIDQsnFrListCornerTl, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrListCornerTr */ {KAknsIIDQsnFrListCornerTr, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrListCornerBl */ {KAknsIIDQsnFrListCornerBl, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrListCornerBr */ {KAknsIIDQsnFrListCornerBr, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrListSideT */ {KAknsIIDQsnFrListSideT, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrListSideB */ {KAknsIIDQsnFrListSideB, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrListSideL */ {KAknsIIDQsnFrListSideL, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrListSideR */ {KAknsIIDQsnFrListSideR, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrListCenter */ {KAknsIIDQsnFrListCenter, ENoDraw, ES60_All, -1,-1},
+
+ /* SP_QsnFrPopupCornerTl */ {KAknsIIDQsnFrPopupCornerTl, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrPopupCornerTr */ {KAknsIIDQsnFrPopupCornerTr, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrPopupCornerBl */ {KAknsIIDQsnFrPopupCornerBl, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrPopupCornerBr */ {KAknsIIDQsnFrPopupCornerBr, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrPopupSideT */ {KAknsIIDQsnFrPopupSideT, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrPopupSideB */ {KAknsIIDQsnFrPopupSideB, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrPopupSideL */ {KAknsIIDQsnFrPopupSideL, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrPopupSideR */ {KAknsIIDQsnFrPopupSideR, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrPopupCenter */ {KAknsIIDQsnFrPopupCenter, ENoDraw, ES60_All, -1,-1},
// ToolTip graphics different in 3.1 vs. 3.2+.
- /* SP_QsnFrPopupPreviewCornerTl */ {KAknsIIDQsnFrPopupCornerTl, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c5}, /* KAknsIIDQsnFrPopupPreviewCornerTl */
- /* SP_QsnFrPopupPreviewCornerTr */ {KAknsIIDQsnFrPopupCornerTr, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c6},
- /* SP_QsnFrPopupPreviewCornerBl */ {KAknsIIDQsnFrPopupCornerBl, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c3},
- /* SP_QsnFrPopupPreviewCornerBr */ {KAknsIIDQsnFrPopupCornerBr, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c4},
- /* SP_QsnFrPopupPreviewSideT */ {KAknsIIDQsnFrPopupSideT, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19ca},
- /* SP_QsnFrPopupPreviewSideB */ {KAknsIIDQsnFrPopupSideB, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c7},
- /* SP_QsnFrPopupPreviewSideL */ {KAknsIIDQsnFrPopupSideL, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c8},
- /* SP_QsnFrPopupPreviewSideR */ {KAknsIIDQsnFrPopupSideR, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c9},
- /* SP_QsnFrPopupPreviewCenter */ {KAknsIIDQsnFrPopupCenter, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c2},
-
- /* SP_QsnFrSetOptCornerTl */ {KAknsIIDQsnFrSetOptCornerTl, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrSetOptCornerTr */ {KAknsIIDQsnFrSetOptCornerTr, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrSetOptCornerBl */ {KAknsIIDQsnFrSetOptCornerBl, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrSetOptCornerBr */ {KAknsIIDQsnFrSetOptCornerBr, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrSetOptSideT */ {KAknsIIDQsnFrSetOptSideT, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrSetOptSideB */ {KAknsIIDQsnFrSetOptSideB, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrSetOptSideL */ {KAknsIIDQsnFrSetOptSideL, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrSetOptSideR */ {KAknsIIDQsnFrSetOptSideR, ENoDraw, ES60_AllReleases, -1,-1},
- /* SP_QsnFrSetOptCenter */ {KAknsIIDQsnFrSetOptCenter, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrPopupPreviewCornerTl */ {KAknsIIDQsnFrPopupCornerTl, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c5}, /* KAknsIIDQsnFrPopupPreviewCornerTl */
+ /* SP_QsnFrPopupPreviewCornerTr */ {KAknsIIDQsnFrPopupCornerTr, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c6},
+ /* SP_QsnFrPopupPreviewCornerBl */ {KAknsIIDQsnFrPopupCornerBl, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c3},
+ /* SP_QsnFrPopupPreviewCornerBr */ {KAknsIIDQsnFrPopupCornerBr, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c4},
+ /* SP_QsnFrPopupPreviewSideT */ {KAknsIIDQsnFrPopupSideT, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19ca},
+ /* SP_QsnFrPopupPreviewSideB */ {KAknsIIDQsnFrPopupSideB, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c7},
+ /* SP_QsnFrPopupPreviewSideL */ {KAknsIIDQsnFrPopupSideL, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c8},
+ /* SP_QsnFrPopupPreviewSideR */ {KAknsIIDQsnFrPopupSideR, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c9},
+ /* SP_QsnFrPopupPreviewCenter */ {KAknsIIDQsnFrPopupCenter, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c2},
+
+ /* SP_QsnFrSetOptCornerTl */ {KAknsIIDQsnFrSetOptCornerTl, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrSetOptCornerTr */ {KAknsIIDQsnFrSetOptCornerTr, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrSetOptCornerBl */ {KAknsIIDQsnFrSetOptCornerBl, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrSetOptCornerBr */ {KAknsIIDQsnFrSetOptCornerBr, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrSetOptSideT */ {KAknsIIDQsnFrSetOptSideT, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrSetOptSideB */ {KAknsIIDQsnFrSetOptSideB, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrSetOptSideL */ {KAknsIIDQsnFrSetOptSideL, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrSetOptSideR */ {KAknsIIDQsnFrSetOptSideR, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrSetOptCenter */ {KAknsIIDQsnFrSetOptCenter, ENoDraw, ES60_All, -1,-1},
// No toolbar frame for 5.0+ releases.
- /* SP_QsnFrPopupSubCornerTl */ {KAknsIIDQsnFrPopupSubCornerTl, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1},
- /* SP_QsnFrPopupSubCornerTr */ {KAknsIIDQsnFrPopupSubCornerTr, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1},
- /* SP_QsnFrPopupSubCornerBl */ {KAknsIIDQsnFrPopupSubCornerBl, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1},
- /* SP_QsnFrPopupSubCornerBr */ {KAknsIIDQsnFrPopupSubCornerBr, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1},
- /* SP_QsnFrPopupSubSideT */ {KAknsIIDQsnFrPopupSubSideT, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1},
- /* SP_QsnFrPopupSubSideB */ {KAknsIIDQsnFrPopupSubSideB, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1},
- /* SP_QsnFrPopupSubSideL */ {KAknsIIDQsnFrPopupSubSideL, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1},
- /* SP_QsnFrPopupSubSideR */ {KAknsIIDQsnFrPopupSubSideR, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1},
- /* SP_QsnFrPopupSubCenter */ {KAknsIIDQsnFrPopupCenterSubmenu, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1},
+ /* SP_QsnFrPopupSubCornerTl */ {KAknsIIDQsnFrPopupSubCornerTl, ENoDraw, ES60_3_X, -1,-1},
+ /* SP_QsnFrPopupSubCornerTr */ {KAknsIIDQsnFrPopupSubCornerTr, ENoDraw, ES60_3_X, -1,-1},
+ /* SP_QsnFrPopupSubCornerBl */ {KAknsIIDQsnFrPopupSubCornerBl, ENoDraw, ES60_3_X, -1,-1},
+ /* SP_QsnFrPopupSubCornerBr */ {KAknsIIDQsnFrPopupSubCornerBr, ENoDraw, ES60_3_X, -1,-1},
+ /* SP_QsnFrPopupSubSideT */ {KAknsIIDQsnFrPopupSubSideT, ENoDraw, ES60_3_X, -1,-1},
+ /* SP_QsnFrPopupSubSideB */ {KAknsIIDQsnFrPopupSubSideB, ENoDraw, ES60_3_X, -1,-1},
+ /* SP_QsnFrPopupSubSideL */ {KAknsIIDQsnFrPopupSubSideL, ENoDraw, ES60_3_X, -1,-1},
+ /* SP_QsnFrPopupSubSideR */ {KAknsIIDQsnFrPopupSubSideR, ENoDraw, ES60_3_X, -1,-1},
+ /* SP_QsnFrPopupSubCenter */ {KAknsIIDQsnFrPopupCenterSubmenu, ENoDraw, ES60_3_X, -1,-1},
// Toolbar graphics is different in 3.1/3.2 vs. 5.0
- /* SP_QsnFrSctrlButtonCornerTl */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2301}, /* KAknsIIDQgnFrSctrlButtonCornerTl*/
- /* SP_QsnFrSctrlButtonCornerTr */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2302},
- /* SP_QsnFrSctrlButtonCornerBl */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2303},
- /* SP_QsnFrSctrlButtonCornerBr */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2304},
- /* SP_QsnFrSctrlButtonSideT */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2305},
- /* SP_QsnFrSctrlButtonSideB */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2306},
- /* SP_QsnFrSctrlButtonSideL */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2307},
- /* SP_QsnFrSctrlButtonSideR */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2308},
- /* SP_QsnFrSctrlButtonCenter */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2309}, /*KAknsIIDQgnFrSctrlButtonCenter*/
+ /* SP_QsnFrSctrlButtonCornerTl */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2301}, /* KAknsIIDQgnFrSctrlButtonCornerTl*/
+ /* SP_QsnFrSctrlButtonCornerTr */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2302},
+ /* SP_QsnFrSctrlButtonCornerBl */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2303},
+ /* SP_QsnFrSctrlButtonCornerBr */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2304},
+ /* SP_QsnFrSctrlButtonSideT */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2305},
+ /* SP_QsnFrSctrlButtonSideB */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2306},
+ /* SP_QsnFrSctrlButtonSideL */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2307},
+ /* SP_QsnFrSctrlButtonSideR */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2308},
+ /* SP_QsnFrSctrlButtonCenter */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2309}, /*KAknsIIDQgnFrSctrlButtonCenter*/
// No pressed state for toolbar button in 3.1/3.2.
- /* SP_QsnFrSctrlButtonCornerTlPressed */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2621}, /*KAknsIIDQsnFrSctrlButtonCornerTlPressed*/
- /* SP_QsnFrSctrlButtonCornerTrPressed */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2622},
- /* SP_QsnFrSctrlButtonCornerBlPressed */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2623},
- /* SP_QsnFrSctrlButtonCornerBrPressed */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2624},
- /* SP_QsnFrSctrlButtonSideTPressed */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2625},
- /* SP_QsnFrSctrlButtonSideBPressed */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2626},
- /* SP_QsnFrSctrlButtonSideLPressed */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2627},
- /* SP_QsnFrSctrlButtonSideRPressed */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2628},
- /* SP_QsnFrSctrlButtonCenterPressed */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2629},
+ /* SP_QsnFrSctrlButtonCornerTlPressed */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2621}, /*KAknsIIDQsnFrSctrlButtonCornerTlPressed*/
+ /* SP_QsnFrSctrlButtonCornerTrPressed */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2622},
+ /* SP_QsnFrSctrlButtonCornerBlPressed */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2623},
+ /* SP_QsnFrSctrlButtonCornerBrPressed */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2624},
+ /* SP_QsnFrSctrlButtonSideTPressed */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2625},
+ /* SP_QsnFrSctrlButtonSideBPressed */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2626},
+ /* SP_QsnFrSctrlButtonSideLPressed */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2627},
+ /* SP_QsnFrSctrlButtonSideRPressed */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2628},
+ /* SP_QsnFrSctrlButtonCenterPressed */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2629},
// No inactive button graphics in 3.1/3.2
- /* SP_QsnFrButtonCornerTlInactive */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b1}, /*KAknsIIDQsnFrButtonCornerTlInactive*/
- /* SP_QsnFrButtonCornerTrInactive */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b2},
- /* SP_QsnFrButtonCornerBlInactive */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b3},
- /* SP_QsnFrButtonCornerTrInactive */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b4},
- /* SP_QsnFrButtonSideTInactive */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b5},
- /* SP_QsnFrButtonSideBInactive */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b6},
- /* SP_QsnFrButtonSideLInactive */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b7},
- /* SP_QsnFrButtonSideRInactive */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b8},
- /* SP_QsnFrButtonCenterInactive */ {KAknsIIDQsnFrButtonTbCenter, EDrawIcon, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b9},
+ /* SP_QsnFrButtonCornerTlInactive */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b1}, /*KAknsIIDQsnFrButtonCornerTlInactive*/
+ /* SP_QsnFrButtonCornerTrInactive */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b2},
+ /* SP_QsnFrButtonCornerBlInactive */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b3},
+ /* SP_QsnFrButtonCornerTrInactive */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b4},
+ /* SP_QsnFrButtonSideTInactive */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b5},
+ /* SP_QsnFrButtonSideBInactive */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b6},
+ /* SP_QsnFrButtonSideLInactive */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b7},
+ /* SP_QsnFrButtonSideRInactive */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b8},
+ /* SP_QsnFrButtonCenterInactive */ {KAknsIIDQsnFrButtonTbCenter, EDrawIcon, ES60_3_X, EAknsMajorSkin, 0x21b9},
};
@@ -349,7 +360,7 @@ QPixmap QS60StyleModeSpecifics::skinnedGraphics(
}
QPixmap QS60StyleModeSpecifics::colorSkinnedGraphics(
- const QS60StyleEnums::SkinParts &stylepart, const QSize &size, QPainter *painter,
+ const QS60StyleEnums::SkinParts &stylepart, const QSize &size, QPainter *painter,
QS60StylePrivate::SkinElementFlags flags)
{
QPixmap colorGraphics;
@@ -357,155 +368,121 @@ QPixmap QS60StyleModeSpecifics::colorSkinnedGraphics(
return error ? QPixmap() : colorGraphics;
}
-void QS60StyleModeSpecifics::fallbackInfo(const QS60StyleEnums::SkinParts &stylepart, TDes& fallbackFileName, TInt& fallbackIndex)
+void QS60StyleModeSpecifics::fallbackInfo(const QS60StyleEnums::SkinParts &stylePart, TInt &fallbackIndex)
{
- switch(stylepart) {
+ switch(stylePart) {
case QS60StyleEnums::SP_QgnGrafBarWait:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_graf_bar_wait_1;
break;
case QS60StyleEnums::SP_QgnGrafBarFrameCenter:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_graf_bar_frame_center;
break;
case QS60StyleEnums::SP_QgnGrafBarFrameSideL:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_graf_bar_frame_side_l;
break;
case QS60StyleEnums::SP_QgnGrafBarFrameSideR:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_graf_bar_frame_side_r;
break;
case QS60StyleEnums::SP_QgnGrafBarProgress:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_graf_bar_progress;
break;
case QS60StyleEnums::SP_QgnGrafTabActiveL:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_graf_tab_active_l;
break;
case QS60StyleEnums::SP_QgnGrafTabActiveM:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_graf_tab_active_m;
break;
case QS60StyleEnums::SP_QgnGrafTabActiveR:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_graf_tab_active_r;
break;
case QS60StyleEnums::SP_QgnGrafTabPassiveL:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_graf_tab_passive_l;
break;
case QS60StyleEnums::SP_QgnGrafTabPassiveM:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_graf_tab_passive_m;
break;
case QS60StyleEnums::SP_QgnGrafTabPassiveR:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_graf_tab_passive_r;
break;
case QS60StyleEnums::SP_QgnIndiCheckboxOff:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_indi_checkbox_off;
break;
case QS60StyleEnums::SP_QgnIndiCheckboxOn:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_indi_checkbox_on;
break;
case QS60StyleEnums::SP_QgnIndiHlColSuper:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = 0x4456; /* EMbmAvkonQgn_indi_hl_col_super */
break;
case QS60StyleEnums::SP_QgnIndiHlExpSuper:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = 0x4458; /* EMbmAvkonQgn_indi_hl_exp_super */
break;
case QS60StyleEnums::SP_QgnIndiHlLineBranch:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = 0x445A; /* EMbmAvkonQgn_indi_hl_line_branch */
break;
case QS60StyleEnums::SP_QgnIndiHlLineEnd:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = 0x445C; /* EMbmAvkonQgn_indi_hl_line_end */
break;
case QS60StyleEnums::SP_QgnIndiHlLineStraight:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = 0x445E; /* EMbmAvkonQgn_indi_hl_line_straight */
break;
case QS60StyleEnums::SP_QgnIndiMarkedAdd:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_indi_marked_add;
break;
case QS60StyleEnums::SP_QgnIndiNaviArrowLeft:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_indi_navi_arrow_left;
break;
case QS60StyleEnums::SP_QgnIndiNaviArrowRight:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_indi_navi_arrow_right;
break;
case QS60StyleEnums::SP_QgnIndiRadiobuttOff:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_indi_radiobutt_off;
break;
case QS60StyleEnums::SP_QgnIndiRadiobuttOn:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_indi_radiobutt_on;
break;
- case QS60StyleEnums::SP_QgnIndiSliderEdit:
- fallbackFileName = KAvkonBitmapFile();
- fallbackIndex = EMbmAvkonQgn_indi_slider_edit;
+ case QS60StyleEnums::SP_QgnGrafNsliderMarker:
+ fallbackIndex = 17572; /* EMbmAvkonQgn_graf_nslider_marker */
+ break;
+ case QS60StyleEnums::SP_QgnGrafNsliderMarkerSelected:
+ fallbackIndex = 17574; /* EMbmAvkonQgn_graf_nslider_marker_selected */
break;
case QS60StyleEnums::SP_QgnIndiSubMenu:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_indi_submenu;
break;
case QS60StyleEnums::SP_QgnNoteErased:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_note_erased;
break;
case QS60StyleEnums::SP_QgnNoteError:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_note_error;
break;
case QS60StyleEnums::SP_QgnNoteInfo:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_note_info;
break;
case QS60StyleEnums::SP_QgnNoteOk:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_note_ok;
break;
case QS60StyleEnums::SP_QgnNoteQuery:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_note_query;
break;
case QS60StyleEnums::SP_QgnNoteWarning:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_note_warning;
break;
case QS60StyleEnums::SP_QgnPropFileSmall:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_prop_file_small;
break;
case QS60StyleEnums::SP_QgnPropFolderCurrent:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_prop_folder_current;
break;
case QS60StyleEnums::SP_QgnPropFolderSmall:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_prop_folder_small;
break;
case QS60StyleEnums::SP_QgnPropFolderSmallNew:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_prop_folder_small_new;
break;
case QS60StyleEnums::SP_QgnPropPhoneMemcLarge:
- fallbackFileName = KAvkonBitmapFile();
fallbackIndex = EMbmAvkonQgn_prop_phone_memc_large;
break;
default:
- fallbackFileName = KNullDesC();
fallbackIndex = -1;
break;
}
@@ -521,8 +498,7 @@ QPixmap QS60StyleModeSpecifics::colorSkinnedGraphicsLX(
TInt fallbackGraphicID = -1;
HBufC* iconFile = HBufC::NewLC( KMaxFileName );
- TPtr fileNamePtr = iconFile->Des();
- fallbackInfo(stylepart, fileNamePtr, fallbackGraphicID);
+ fallbackInfo(stylepart, fallbackGraphicID);
TAknsItemID colorGroup = KAknsIIDQsnIconColors;
TRgb defaultColor = KRgbBlack;
@@ -543,10 +519,18 @@ QPixmap QS60StyleModeSpecifics::colorSkinnedGraphicsLX(
fallbackGraphicID == KErrNotFound?KErrNotFound:fallbackGraphicID+1; //masks are auto-generated as next in mif files
MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
AknsUtils::CreateColorIconLC(
- skinInstance, skinId, colorGroup, colorIndex, icon, iconMask, fileNamePtr, fallbackGraphicID , fallbackGraphicsMaskID, defaultColor);
- User::LeaveIfError(AknIconUtils::SetSize(icon, targetSize, EAspectRatioNotPreserved));
- User::LeaveIfError(AknIconUtils::SetSize(iconMask, targetSize, EAspectRatioNotPreserved));
- QPixmap result = fromFbsBitmap(icon, iconMask, flags, qt_TDisplayMode2Format(icon->DisplayMode()));
+ skinInstance,
+ skinId,
+ colorGroup,
+ colorIndex,
+ icon,
+ iconMask,
+ AknIconUtils::AvkonIconFileName(),
+ fallbackGraphicID,
+ fallbackGraphicsMaskID,
+ defaultColor);
+
+ QPixmap result = fromFbsBitmap(icon, iconMask, flags, targetSize);
CleanupStack::PopAndDestroy(3); //icon, iconMask, iconFile
return result;
}
@@ -566,55 +550,43 @@ struct QAutoFbsBitmapHeapLock
CFbsBitmap* mBmp;
};
-QPixmap QS60StyleModeSpecifics::fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask, QS60StylePrivate::SkinElementFlags flags, QImage::Format format)
+QPixmap QS60StyleModeSpecifics::fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask, QS60StylePrivate::SkinElementFlags flags, const TSize &targetSize)
{
Q_ASSERT(icon);
- const TSize iconSize = icon->SizeInPixels();
- const int iconBytesPerLine = CFbsBitmap::ScanLineLength(iconSize.iWidth, icon->DisplayMode());
- const int iconBytesCount = iconBytesPerLine * iconSize.iHeight;
- QImage iconImage(qt_TSize2QSize(iconSize), format);
- if (iconImage.isNull())
- return QPixmap();
+ AknIconUtils::DisableCompression(icon);
+ TInt error = AknIconUtils::SetSize(icon, targetSize, EAspectRatioNotPreserved);
- checkAndUnCompressBitmap(icon);
- if (!icon) //checkAndUnCompressBitmap might set icon to NULL
+ if (mask && !error) {
+ AknIconUtils::DisableCompression(mask);
+ error = AknIconUtils::SetSize(mask, targetSize, EAspectRatioNotPreserved);
+ }
+ if (error)
return QPixmap();
- icon->LockHeap();
- const uchar *const iconBytes = (uchar*)icon->DataAddress();
- // The icon data needs to be copied, since the color format will be
- // automatically converted to Format_ARGB32 when setAlphaChannel is called.
- memcpy(iconImage.bits(), iconBytes, iconBytesCount);
- icon->UnlockHeap();
- if (mask) {
- checkAndUnCompressBitmap(mask);
- if (mask) { //checkAndUnCompressBitmap might set mask to NULL
- const TSize maskSize = icon->SizeInPixels();
- const int maskBytesPerLine = CFbsBitmap::ScanLineLength(maskSize.iWidth, mask->DisplayMode());
- // heap lock object required because QImage ctor might throw
- QAutoFbsBitmapHeapLock maskHeapLock(mask);
- const uchar *const maskBytes = (uchar *)mask->DataAddress();
- // Since no other bitmap should be locked, we can just "borrow" the mask data for setAlphaChannel
- const QImage maskImage(maskBytes, maskSize.iWidth, maskSize.iHeight, maskBytesPerLine, QImage::Format_Indexed8);
- if (!maskImage.isNull())
- iconImage.setAlphaChannel(maskImage);
+ QPixmap pixmap = QPixmap::fromSymbianCFbsBitmap(icon);
+ if (mask)
+ pixmap.setAlphaChannel(QPixmap::fromSymbianCFbsBitmap(mask));
+
+ if ((flags & QS60StylePrivate::SF_PointEast) ||
+ (flags & QS60StylePrivate::SF_PointSouth) ||
+ (flags & QS60StylePrivate::SF_PointWest)) {
+ QImage iconImage = pixmap.toImage();
+ QTransform imageTransform;
+ if (flags & QS60StylePrivate::SF_PointEast) {
+ imageTransform.rotate(90);
+ } else if (flags & QS60StylePrivate::SF_PointSouth) {
+ imageTransform.rotate(180);
+ iconImage = iconImage.transformed(imageTransform);
+ } else if (flags & QS60StylePrivate::SF_PointWest) {
+ imageTransform.rotate(270);
}
- }
+ if (imageTransform.isRotating())
+ iconImage = iconImage.transformed(imageTransform);
- QTransform imageTransform;
- if (flags & QS60StylePrivate::SF_PointEast) {
- imageTransform.rotate(90);
- } else if (flags & QS60StylePrivate::SF_PointSouth) {
- imageTransform.rotate(180);
- iconImage = iconImage.transformed(imageTransform);
- } else if (flags & QS60StylePrivate::SF_PointWest) {
- imageTransform.rotate(270);
+ pixmap = QPixmap::fromImage(iconImage);
}
- if (imageTransform.isRotating())
- iconImage = iconImage.transformed(imageTransform);
-
- return QPixmap::fromImage(iconImage);
+ return pixmap;
}
bool QS60StylePrivate::isTouchSupported()
@@ -627,6 +599,11 @@ bool QS60StylePrivate::isToolBarBackground()
return (QSysInfo::s60Version() == QSysInfo::SV_S60_3_1 || QSysInfo::s60Version() == QSysInfo::SV_S60_3_2);
}
+bool QS60StylePrivate::hasSliderGrooveGraphic()
+{
+ return QSysInfo::s60Version() != QSysInfo::SV_S60_3_1;
+}
+
QPoint qt_s60_fill_background_offset(const QWidget *targetWidget)
{
CCoeControl *control = targetWidget->effectiveWinId();
@@ -645,7 +622,7 @@ QPoint qt_s60_fill_background_offset(const QWidget *targetWidget)
}
QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(
- QS60StyleEnums::SkinParts part, const QSize &size,
+ QS60StyleEnums::SkinParts part, const QSize &size,
QS60StylePrivate::SkinElementFlags flags)
{
// this function can throw both exceptions and leaves. There are no cleanup dependencies between Qt and Symbian parts.
@@ -653,7 +630,7 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(
return QPixmap();
// Check release support and change part, if necessary.
- const TAknsItemID skinId = checkAndUpdateReleaseSpecificGraphics((int)part);
+ const TAknsItemID skinId = partSpecificThemeId((int)part);
const int stylepartIndex = (int)part;
const TDrawType drawType = m_partMap[stylepartIndex].drawType;
Q_ASSERT(drawType != ENoDraw);
@@ -667,24 +644,34 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(
QPixmap result;
switch (drawType) {
+ case EDrawGulIcon: {
+ CGulIcon* icon = AknsUtils::CreateGulIconL( AknsUtils::SkinInstance(), skinId, EFalse );
+ if (icon)
+ result = fromFbsBitmap(icon->Bitmap(), icon->Mask(), flags, targetSize);
+ delete icon;
+ break;
+ }
case EDrawIcon: {
TInt fallbackGraphicID = -1;
- HBufC* iconFile = HBufC::NewLC( KMaxFileName );
- TPtr fileNamePtr = iconFile->Des();
- fallbackInfo(part, fileNamePtr, fallbackGraphicID);
- // todo: could we instead use AknIconUtils::AvkonIconFileName(); to avoid allocating each time?
+ fallbackInfo(part, fallbackGraphicID);
CFbsBitmap *icon = 0;
CFbsBitmap *iconMask = 0;
const TInt fallbackGraphicsMaskID =
fallbackGraphicID == KErrNotFound?KErrNotFound:fallbackGraphicID+1; //masks are auto-generated as next in mif files
- // QS60WindowSurface::unlockBitmapHeap();
- AknsUtils::CreateIconLC(skinInstance, skinId, icon, iconMask, fileNamePtr, fallbackGraphicID , fallbackGraphicsMaskID);
- User::LeaveIfError(AknIconUtils::SetSize(icon, targetSize, EAspectRatioNotPreserved));
- User::LeaveIfError(AknIconUtils::SetSize(iconMask, targetSize, EAspectRatioNotPreserved));
- result = fromFbsBitmap(icon, iconMask, flags, qt_TDisplayMode2Format(icon->DisplayMode()));
- CleanupStack::PopAndDestroy(3); // iconMask, icon, iconFile
- // QS60WindowSurface::lockBitmapHeap();
+
+ AknsUtils::CreateIconL(
+ skinInstance,
+ skinId,
+ icon,
+ iconMask,
+ AknIconUtils::AvkonIconFileName(),
+ fallbackGraphicID ,
+ fallbackGraphicsMaskID);
+
+ result = fromFbsBitmap(icon, iconMask, flags, targetSize);
+ delete icon;
+ delete iconMask;
break;
}
case EDrawBackground: {
@@ -715,13 +702,16 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(
KAknsDrawParamDefault | KAknsDrawParamRGBOnly);
if (drawn)
- result = fromFbsBitmap(background, NULL, flags, QImage::Format_RGB32);
+ result = fromFbsBitmap(background, NULL, flags, targetSize);
+ // if drawing fails in skin server, just ignore the background (probably OOM occured)
CleanupStack::PopAndDestroy(4, background); //background, dev, gc, bgContext
// QS60WindowSurface::lockBitmapHeap();
break;
}
}
+ if (!result)
+ result = QPixmap();
return result;
}
@@ -755,24 +745,46 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(QS60StylePrivate::SkinFr
User::LeaveIfError(bitmapDev->CreateContext(bitmapGc));
CleanupStack::PushL(bitmapGc);
+#ifndef Q_SYMBIAN_HAS_EXTENDED_BITMAP_TYPE
frame->LockHeap();
memset(frame->DataAddress(), 0, frame->SizeInPixels().iWidth * frame->SizeInPixels().iHeight * 4); // 4: argb bytes
frame->UnlockHeap();
+#endif
const TRect outerRect(TPoint(0, 0), targetSize);
const TRect innerRect = innerRectFromElement(frameElement, outerRect);
TAknsItemID frameSkinID, centerSkinID;
- frameSkinID = centerSkinID = checkAndUpdateReleaseSpecificGraphics(QS60StylePrivate::m_frameElementsData[frameElement].center);
+ frameSkinID = centerSkinID = partSpecificThemeId(QS60StylePrivate::m_frameElementsData[frameElement].center);
frameIdAndCenterId(frameElement, frameSkinID, centerSkinID);
- const TBool drawn = AknsDrawUtils::DrawFrame( skinInstance,
- *bitmapGc, outerRect, innerRect,
- frameSkinID, centerSkinID,
- drawParam );
+
+ TBool drawn = AknsDrawUtils::DrawFrame(
+ skinInstance,
+ *bitmapGc,
+ outerRect,
+ innerRect,
+ frameSkinID,
+ centerSkinID,
+ drawParam );
if (S60->supportsPremultipliedAlpha) {
- if (drawn)
- result = fromFbsBitmap(frame, NULL, flags, QImage::Format_ARGB32_Premultiplied);
+ if (drawn) {
+ result = fromFbsBitmap(frame, NULL, flags, targetSize);
+ } else {
+ // Drawing might fail due to OOM (we can do nothing about that),
+ // or due to skin item not being available.
+ // If the latter occurs, lets try switch to non-release specific items (if available)
+ // and re-try the drawing.
+ frameSkinID = centerSkinID = m_partMap[(int)QS60StylePrivate::m_frameElementsData[frameElement].center].skinID;
+ frameIdAndCenterId(frameElement, frameSkinID, centerSkinID);
+ drawn = AknsDrawUtils::DrawFrame( skinInstance,
+ *bitmapGc, outerRect, innerRect,
+ frameSkinID, centerSkinID,
+ drawParam );
+ // in case drawing fails, even after using default graphics, ignore the error
+ if (drawn)
+ result = fromFbsBitmap(frame, NULL, flags, targetSize);
+ }
} else {
TDisplayMode maskDepth = EGray2;
// Query the skin item for possible frame graphics mask details.
@@ -802,11 +814,12 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(QS60StylePrivate::SkinFr
maskBitGc->Clear();
maskBitGc->SetBrushStyle(CGraphicsContext::ENullBrush);
- AknsDrawUtils::DrawFrame(skinInstance,
+ drawn = AknsDrawUtils::DrawFrame(skinInstance,
*maskBitGc, outerRect, innerRect,
frameSkinID, centerSkinID,
KAknsSDMAlphaOnly |KAknsDrawParamNoClearUnderImage);
- result = fromFbsBitmap(frame, frameMask, flags, QImage::Format_ARGB32);
+ if (drawn)
+ result = fromFbsBitmap(frame, frameMask, flags, targetSize);
}
CleanupStack::PopAndDestroy(3, frameMask);
}
@@ -880,10 +893,12 @@ bool QS60StyleModeSpecifics::checkSupport(const int supportedRelease)
const QSysInfo::S60Version currentRelease = QSysInfo::s60Version();
return ( (currentRelease == QSysInfo::SV_S60_3_1 && supportedRelease & ES60_3_1) ||
(currentRelease == QSysInfo::SV_S60_3_2 && supportedRelease & ES60_3_2) ||
- (currentRelease == QSysInfo::SV_S60_5_0 && supportedRelease & ES60_5_0));
+ (currentRelease == QSysInfo::SV_S60_5_0 && supportedRelease & ES60_5_0) ||
+ (currentRelease == QSysInfo::SV_S60_5_1 && supportedRelease & ES60_5_1) ||
+ (currentRelease == QSysInfo::SV_S60_5_2 && supportedRelease & ES60_5_2));
}
-TAknsItemID QS60StyleModeSpecifics::checkAndUpdateReleaseSpecificGraphics(int part)
+TAknsItemID QS60StyleModeSpecifics::partSpecificThemeId(int part)
{
TAknsItemID newSkinId;
if (!checkSupport(m_partMap[(int)part].supportInfo))
@@ -893,33 +908,6 @@ TAknsItemID QS60StyleModeSpecifics::checkAndUpdateReleaseSpecificGraphics(int pa
return newSkinId;
}
-void QS60StyleModeSpecifics::checkAndUnCompressBitmap(CFbsBitmap*& aOriginalBitmap)
-{
- TRAPD(error, checkAndUnCompressBitmapL(aOriginalBitmap));
- if (error)
- aOriginalBitmap = NULL;
-}
-
-void QS60StyleModeSpecifics::checkAndUnCompressBitmapL(CFbsBitmap*& aOriginalBitmap)
-{
- const TSize iconSize = aOriginalBitmap->SizeInPixels();
- const int iconBytesPerLine = CFbsBitmap::ScanLineLength(iconSize.iWidth, aOriginalBitmap->DisplayMode());
- const int iconBytesCount = iconBytesPerLine * iconSize.iHeight;
- if (aOriginalBitmap->IsCompressedInRAM() || aOriginalBitmap->Header().iBitmapSize < iconBytesCount) {
- const TSize iconSize(aOriginalBitmap->SizeInPixels().iWidth,
- aOriginalBitmap->SizeInPixels().iHeight);
- CFbsBitmap* uncompressedBitmap = new (ELeave) CFbsBitmap();
- CleanupStack::PushL(uncompressedBitmap);
- User::LeaveIfError(uncompressedBitmap->Create(iconSize,
- aOriginalBitmap->DisplayMode()));
- unCompressBitmapL(iconSize, uncompressedBitmap, aOriginalBitmap);
- CleanupStack::Pop(uncompressedBitmap);
- User::LeaveIfError(aOriginalBitmap->Duplicate(
- uncompressedBitmap->Handle()));
- delete uncompressedBitmap;
- }
-}
-
QFont QS60StylePrivate::s60Font_specific(
QS60StyleEnums::FontCategories fontCategory, int pointSize)
{
@@ -972,37 +960,23 @@ void QS60StylePrivate::setActiveLayout()
{
const QSize activeScreenSize(screenSize());
int activeLayoutIndex = -1;
- const bool mirrored = !QApplication::isLeftToRight();
const short screenHeight = (short)activeScreenSize.height();
const short screenWidth = (short)activeScreenSize.width();
for (int i=0; i<m_numberOfLayouts; i++) {
if (screenHeight==m_layoutHeaders[i].height &&
- screenWidth==m_layoutHeaders[i].width &&
- mirrored==m_layoutHeaders[i].mirroring) {
+ screenWidth==m_layoutHeaders[i].width) {
activeLayoutIndex = i;
break;
}
}
- //not found, lets try without mirroring info
- if (activeLayoutIndex==-1){
- for (int i=0; i<m_numberOfLayouts; i++) {
- if (screenHeight==m_layoutHeaders[i].height &&
- screenWidth==m_layoutHeaders[i].width) {
- activeLayoutIndex = i;
- break;
- }
- }
- }
-
//not found, lets try with either of dimensions
if (activeLayoutIndex==-1){
const QSysInfo::S60Version currentRelease = QSysInfo::s60Version();
const bool landscape = screenHeight < screenWidth;
- activeLayoutIndex = (currentRelease == QSysInfo::SV_S60_3_1 || currentRelease == QSysInfo::SV_S60_3_2) ? 0 : 4;
- activeLayoutIndex += (!landscape) ? 2 : 0;
- activeLayoutIndex += (!mirrored) ? 1 : 0;
+ activeLayoutIndex = (currentRelease == QSysInfo::SV_S60_3_1 || currentRelease == QSysInfo::SV_S60_3_2) ? 0 : 2;
+ activeLayoutIndex += (!landscape) ? 1 : 0;
}
m_pmPointer = data[activeLayoutIndex];
@@ -1159,160 +1133,29 @@ QPixmap QS60StylePrivate::frame(SkinFrameElements frame, const QSize &size, Skin
QPixmap QS60StylePrivate::backgroundTexture()
{
+ bool createNewBackground = false;
if (!m_background) {
+ createNewBackground = true;
+ } else {
+ //if background brush does not match screensize, re-create it
+ if (m_background->width() != S60->screenWidthInPixels ||
+ m_background->height() != S60->screenHeightInPixels) {
+ delete m_background;
+ createNewBackground = true;
+ }
+ }
+
+ if (createNewBackground) {
QPixmap background = part(QS60StyleEnums::SP_QsnBgScreen,
- QSize(S60->screenWidthInPixels, S60->screenHeightInPixels), 0, SkinElementFlags());
+ QSize(S60->screenWidthInPixels, S60->screenHeightInPixels), 0, SkinElementFlags());
m_background = new QPixmap(background);
}
return *m_background;
}
-// If the public SDK returns compressed images, please let us also uncompress those!
-void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap* aTrgBitmap, CFbsBitmap* aSrcBitmap)
-{
- if (!aSrcBitmap)
- User::Leave(KErrArgument);
- if (!aTrgBitmap)
- User::Leave(KErrArgument);
-
- // Note! aSrcBitmap->IsCompressedInRAM() is always ETrue, since this method is called only if that applies!
- // Extra note! this function is also being used when bitmaps appear to be compressed (because DataSize is too small)
- // even when they pretend they are not. Assert removed.
-// ASSERT(aSrcBitmap->IsCompressedInRAM());
-
- TDisplayMode displayMode = aSrcBitmap->DisplayMode();
-
- if (displayMode != aTrgBitmap->DisplayMode())
- User::Leave(KErrArgument);
-
- const TSize trgSize = aTrgBitmap->SizeInPixels();
- const TSize srcSize = aSrcBitmap->SizeInPixels();
-
- // calculate the valid drawing area
- TRect drawRect = aTrgRect;
- drawRect.Intersection(TRect(TPoint(0, 0), trgSize));
-
- if (drawRect.IsEmpty())
- return;
-
- CFbsBitmap* realSource = new (ELeave) CFbsBitmap();
- CleanupStack::PushL(realSource);
- User::LeaveIfError(realSource->Create(srcSize, displayMode));
- CFbsBitmapDevice* dev = CFbsBitmapDevice::NewL(realSource);
- CleanupStack::PushL(dev);
- CFbsBitGc* gc = NULL;
- User::LeaveIfError(dev->CreateContext(gc));
- CleanupStack::PushL(gc);
- gc->BitBlt(TPoint(0, 0), aSrcBitmap);
- CleanupStack::PopAndDestroy(2); // dev, gc
-
- // Heap lock for FBServ large chunk is only needed with large bitmaps.
- if (realSource->IsLargeBitmap() || aTrgBitmap->IsLargeBitmap()) {
- aTrgBitmap->LockHeapLC(ETrue); // fbsheaplock
- } else {
- CleanupStack::PushL((TAny*) NULL);
- }
-
- TUint32* srcAddress = realSource->DataAddress();
- TUint32* trgAddress = aTrgBitmap->DataAddress();
-
- const TInt xSkip = (srcSize.iWidth << 8) / aTrgRect.Width();
- const TInt ySkip = (srcSize.iHeight << 8) / aTrgRect.Height();
-
- const TInt drawWidth = drawRect.Width();
- const TInt drawHeight = drawRect.Height();
-
- const TRect offsetRect(aTrgRect.iTl, drawRect.iTl);
- const TInt yPosOffset = ySkip * offsetRect.Height();
- const TInt xPosOffset = xSkip * offsetRect.Width();
-
- if ((displayMode == EGray256) || (displayMode == EColor256)) {
- const TInt srcScanLen8 = CFbsBitmap::ScanLineLength(srcSize.iWidth,
- displayMode);
- const TInt trgScanLen8 = CFbsBitmap::ScanLineLength(trgSize.iWidth,
- displayMode);
-
- TUint8* trgAddress8 = reinterpret_cast<TUint8*> (trgAddress);
-
- TInt yPos = yPosOffset;
- // skip left and top margins in the beginning
- trgAddress8 += trgScanLen8 * drawRect.iTl.iY + drawRect.iTl.iX;
-
- for (TInt y = 0; y < drawHeight; y++) {
- const TUint8* srcAddress8 = reinterpret_cast<const TUint8*> (srcAddress)
- + (srcScanLen8 * (yPos >> 8));
-
- TInt xPos = xPosOffset;
- for (TInt x = 0; x < drawWidth; x++) {
- *(trgAddress8++) = srcAddress8[xPos >> 8];
- xPos += xSkip;
- }
-
- yPos += ySkip;
-
- trgAddress8 += trgScanLen8 - drawWidth;
- }
- } else if (displayMode == EColor4K || displayMode == EColor64K) {
- const TInt srcScanLen16 = CFbsBitmap::ScanLineLength(srcSize.iWidth,
- displayMode) >>1;
- const TInt trgScanLen16 = CFbsBitmap::ScanLineLength(trgSize.iWidth,
- displayMode) >>1;
-
- TUint16* trgAddress16 = reinterpret_cast<TUint16*> (trgAddress);
-
- TInt yPos = yPosOffset;
- // skip left and top margins in the beginning
- trgAddress16 += trgScanLen16 * drawRect.iTl.iY + drawRect.iTl.iX;
-
- for (TInt y = 0; y < drawHeight; y++) {
- const TUint16* srcAddress16 = reinterpret_cast<const TUint16*> (srcAddress)
- + (srcScanLen16 * (yPos >> 8));
-
- TInt xPos = xPosOffset;
- for (TInt x = 0; x < drawWidth; x++) {
- *(trgAddress16++) = srcAddress16[xPos >> 8];
- xPos += xSkip;
- }
-
- yPos += ySkip;
-
- trgAddress16 += trgScanLen16 - drawWidth;
- }
- } else if (displayMode == EColor16MU || displayMode == EColor16MA) {
- const TInt srcScanLen32 = CFbsBitmap::ScanLineLength(srcSize.iWidth,
- displayMode) >>2;
- const TInt trgScanLen32 = CFbsBitmap::ScanLineLength(trgSize.iWidth,
- displayMode) >>2;
-
- TUint32* trgAddress32 = reinterpret_cast<TUint32*> (trgAddress);
-
- TInt yPos = yPosOffset;
- // skip left and top margins in the beginning
- trgAddress32 += trgScanLen32 * drawRect.iTl.iY + drawRect.iTl.iX;
-
- for (TInt y = 0; y < drawHeight; y++) {
- const TUint32* srcAddress32 = reinterpret_cast<const TUint32*> (srcAddress)
- + (srcScanLen32 * (yPos >> 8));
-
- TInt xPos = xPosOffset;
- for (TInt x = 0; x < drawWidth; x++) {
- *(trgAddress32++) = srcAddress32[xPos >> 8];
- xPos += xSkip;
- }
-
- yPos += ySkip;
-
- trgAddress32 += trgScanLen32 - drawWidth;
- }
- } else { User::Leave(KErrUnknown);}
-
- CleanupStack::PopAndDestroy(2); // fbsheaplock, realSource
-}
-
QSize QS60StylePrivate::screenSize()
{
- const TSize screenSize = QS60Data::screenDevice()->SizeInPixels();
- return QSize(screenSize.iWidth, screenSize.iHeight);
+ return QSize(S60->screenWidthInPixels, S60->screenHeightInPixels);
}
QS60Style::QS60Style()
diff --git a/src/gui/styles/qs60style_simulated.cpp b/src/gui/styles/qs60style_simulated.cpp
index 55d5771..e49854f 100644
--- a/src/gui/styles/qs60style_simulated.cpp
+++ b/src/gui/styles/qs60style_simulated.cpp
@@ -337,6 +337,11 @@ bool QS60StylePrivate::isToolBarBackground()
return true;
}
+bool QS60StylePrivate::hasSliderGrooveGraphic()
+{
+ return false;
+}
+
QFont QS60StylePrivate::s60Font_specific(QS60StyleEnums::FontCategories fontCategory, int pointSize)
{
QFont result;
diff --git a/src/gui/styles/qstylehelper.cpp b/src/gui/styles/qstylehelper.cpp
index af30f15..f5af960 100644
--- a/src/gui/styles/qstylehelper.cpp
+++ b/src/gui/styles/qstylehelper.cpp
@@ -154,7 +154,7 @@ qreal angle(const QPointF &p1, const QPointF &p2)
}
qreal m = -(y2 - y1) / (x2 - x1);
- _angle = atan(m) * rad_factor;
+ _angle = qAtan(m) * rad_factor;
if (p1.x() < p2.x())
_angle = 180 - _angle;
diff --git a/src/gui/styles/styles.pri b/src/gui/styles/styles.pri
index 88a2cce..7e5c55a 100644
--- a/src/gui/styles/styles.pri
+++ b/src/gui/styles/styles.pri
@@ -168,7 +168,7 @@ contains( styles, s60 ):contains(QT_CONFIG, s60) {
SOURCES += styles/qs60style.cpp
symbian {
SOURCES += styles/qs60style_s60.cpp
- LIBS += -laknicon -laknskins -laknskinsrv -lfontutils
+ LIBS += -laknicon -laknskins -laknskinsrv -lfontutils -legul
} else {
SOURCES += styles/qs60style_simulated.cpp
RESOURCES += styles/qstyle_s60_simulated.qrc
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 7e93aa0..e9c7b89 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -1482,13 +1482,13 @@ QString QFontDatabase::styleString(const QFontInfo &fontInfo)
and style will look attractive.
If the font family is available from two or more foundries the
- foundry name is included in the family name, e.g. "Helvetica
- [Adobe]" and "Helvetica [Cronyx]". When you specify a family you
- can either use the old hyphenated Qt 2.x "foundry-family" format,
- e.g. "Cronyx-Helvetica", or the new bracketed Qt 3.x "family
- [foundry]" format e.g. "Helvetica [Cronyx]". If the family has a
- foundry it is always returned, e.g. by families(), using the
- bracketed format.
+ foundry name is included in the family name; for example:
+ "Helvetica [Adobe]" and "Helvetica [Cronyx]". When you specify a
+ family, you can either use the old hyphenated "foundry-family"
+ format or the bracketed "family [foundry]" format; for example:
+ "Cronyx-Helvetica" or "Helvetica [Cronyx]". If the family has a
+ foundry it is always returned using the bracketed format, as is
+ the case with the value returned by families().
The font() function returns a QFont given a family, style and
point size.
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 27fc3c1..d364025 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -185,22 +185,11 @@ QFontEngine::QFontEngine()
QFontEngine::~QFontEngine()
{
- for (GlyphPointerHash::const_iterator it = m_glyphPointerHash.constBegin(),
- end = m_glyphPointerHash.constEnd(); it != end; ++it) {
- for (QList<QFontEngineGlyphCache*>::const_iterator it2 = it.value().constBegin(),
- end2 = it.value().constEnd(); it2 != end2; ++it2) {
- delete *it2;
- }
- }
- m_glyphPointerHash.clear();
- for (GlyphIntHash::const_iterator it = m_glyphIntHash.constBegin(),
- end = m_glyphIntHash.constEnd(); it != end; ++it) {
- for (QList<QFontEngineGlyphCache*>::const_iterator it2 = it.value().constBegin(),
- end2 = it.value().constEnd(); it2 != end2; ++it2) {
- delete *it2;
- }
+ for (QLinkedList<GlyphCacheEntry>::const_iterator it = m_glyphCaches.constBegin(),
+ end = m_glyphCaches.constEnd(); it != end; ++it) {
+ delete it->cache;
}
- m_glyphIntHash.clear();
+ m_glyphCaches.clear();
qHBFreeFace(hbFace);
}
@@ -713,103 +702,30 @@ QByteArray QFontEngine::getSfntTable(uint tag) const
return table;
}
-void QFontEngine::expireGlyphCache()
-{
- if (m_glyphCacheQueue.count() > 10) { // hold only 10 caches in memory.
- QFontEngineGlyphCache *old = m_glyphCacheQueue.takeFirst();
- // remove the value from either of our hashes
- for (GlyphPointerHash::iterator i = m_glyphPointerHash.begin(); i != m_glyphPointerHash.end(); ++i) {
- QList<QFontEngineGlyphCache *> list = i.value();
- if (list.removeAll(old)) {
- if (list.isEmpty())
- m_glyphPointerHash.remove(i.key());
- else
- m_glyphPointerHash.insert(i.key(), list);
- break;
- }
- }
- for (GlyphIntHash::iterator i = m_glyphIntHash.begin(); i != m_glyphIntHash.end(); ++i) {
- QList<QFontEngineGlyphCache *> list = i.value();
- if (list.removeAll(old)) {
- if (list.isEmpty())
- m_glyphIntHash.remove(i.key());
- else
- m_glyphIntHash.insert(i.key(), list);
- break;
- }
- }
- delete old;
- }
-}
-
void QFontEngine::setGlyphCache(void *key, QFontEngineGlyphCache *data)
{
Q_ASSERT(data);
- QList<QFontEngineGlyphCache*> items = m_glyphPointerHash.value(key);
-
- for (QList<QFontEngineGlyphCache*>::iterator it = items.begin(), end = items.end(); it != end; ++it) {
- QFontEngineGlyphCache *c = *it;
- if (qtransform_equals_no_translate(c->m_transform, data->m_transform)) {
- if (c == data)
- return;
- items.removeAll(c);
- delete c;
- break;
- }
- }
- items.append(data);
- m_glyphPointerHash.insert(key, items);
- m_glyphCacheQueue.append(data);
- expireGlyphCache();
-}
+ GlyphCacheEntry entry = { key, data };
+ if (m_glyphCaches.contains(entry))
+ return;
-void QFontEngine::setGlyphCache(QFontEngineGlyphCache::Type key, QFontEngineGlyphCache *data)
-{
- Q_ASSERT(data);
- QList<QFontEngineGlyphCache*> items = m_glyphIntHash.value(key);
-
- for (QList<QFontEngineGlyphCache*>::iterator it = items.begin(), end = items.end(); it != end; ++it) {
- QFontEngineGlyphCache *c = *it;
- if (qtransform_equals_no_translate(c->m_transform, data->m_transform)) {
- if (c == data)
- return;
- items.removeAll(c);
- delete c;
- break;
- }
- }
- items.append(data);
- m_glyphIntHash.insert(key, items);
+ // Limit the glyph caches to 4. This covers all 90 degree rotations and limits
+ // memory use when there is continous or random rotation
+ if (m_glyphCaches.size() == 4)
+ delete m_glyphCaches.takeLast().cache;
- m_glyphCacheQueue.append(data);
- expireGlyphCache();
-}
+ m_glyphCaches.push_front(entry);
-QFontEngineGlyphCache *QFontEngine::glyphCache(void *key, const QTransform &transform) const
-{
- QList<QFontEngineGlyphCache*> items = m_glyphPointerHash.value(key);
-
- for (QList<QFontEngineGlyphCache*>::iterator it = items.begin(), end = items.end(); it != end; ++it) {
- QFontEngineGlyphCache *c = *it;
- if (qtransform_equals_no_translate(c->m_transform, transform)) {
- m_glyphCacheQueue.removeAll(c); // last used, move it up
- m_glyphCacheQueue.append(c);
- return c;
- }
- }
- return 0;
}
-QFontEngineGlyphCache *QFontEngine::glyphCache(QFontEngineGlyphCache::Type key, const QTransform &transform) const
+QFontEngineGlyphCache *QFontEngine::glyphCache(void *key, QFontEngineGlyphCache::Type type, const QTransform &transform) const
{
- QList<QFontEngineGlyphCache*> items = m_glyphIntHash.value(key);
-
- for (QList<QFontEngineGlyphCache*>::iterator it = items.begin(), end = items.end(); it != end; ++it) {
- QFontEngineGlyphCache *c = *it;
- if (qtransform_equals_no_translate(c->m_transform, transform)) {
- m_glyphCacheQueue.removeAll(c); // last used, move it up
- m_glyphCacheQueue.append(c);
+ for (QLinkedList<GlyphCacheEntry>::const_iterator it = m_glyphCaches.constBegin(), end = m_glyphCaches.constEnd(); it != end; ++it) {
+ QFontEngineGlyphCache *c = it->cache;
+ if (key == it->context
+ && type == c->cacheType()
+ && qtransform_equals_no_translate(c->m_transform, transform)) {
return c;
}
}
diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm
index a4e7c04..a75d70f 100644
--- a/src/gui/text/qfontengine_mac.mm
+++ b/src/gui/text/qfontengine_mac.mm
@@ -404,7 +404,9 @@ QFixed QCoreTextFontEngine::ascent() const
}
QFixed QCoreTextFontEngine::descent() const
{
- return QFixed::fromReal(CTFontGetDescent(ctfont)).ceil();
+ // subtract a pixel to even out the historical +1 in QFontMetrics::height().
+ // Fix in Qt 5.
+ return QFixed::fromReal(CTFontGetDescent(ctfont)).ceil() - 1;
}
QFixed QCoreTextFontEngine::leading() const
{
@@ -1406,7 +1408,9 @@ QFixed QFontEngineMac::ascent() const
QFixed QFontEngineMac::descent() const
{
- return m_descent;
+ // subtract a pixel to even out the historical +1 in QFontMetrics::height().
+ // Fix in Qt 5.
+ return m_descent - 1;
}
QFixed QFontEngineMac::leading() const
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index 728c344..a9883b4 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -56,6 +56,7 @@
#include "QtCore/qglobal.h"
#include "QtCore/qatomic.h"
#include <QtCore/qvarlengtharray.h>
+#include <QtCore/QLinkedList>
#include "private/qtextengine_p.h"
#include "private/qfont_p.h"
@@ -219,9 +220,7 @@ public:
virtual HB_Error getPointInOutline(HB_Glyph glyph, int flags, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints);
void setGlyphCache(void *key, QFontEngineGlyphCache *data);
- void setGlyphCache(QFontEngineGlyphCache::Type key, QFontEngineGlyphCache *data);
- QFontEngineGlyphCache *glyphCache(void *key, const QTransform &transform) const;
- QFontEngineGlyphCache *glyphCache(QFontEngineGlyphCache::Type key, const QTransform &transform) const;
+ QFontEngineGlyphCache *glyphCache(void *key, QFontEngineGlyphCache::Type type, const QTransform &transform) const;
static const uchar *getCMap(const uchar *table, uint tableSize, bool *isSymbolFont, int *cmapSize);
static quint32 getTrueTypeGlyphIndex(const uchar *cmap, uint unicode);
@@ -254,12 +253,13 @@ protected:
static const QVector<QRgb> &grayPalette();
private:
- /// remove old entries from the glyph cache. Helper method for the setGlyphCache ones.
- void expireGlyphCache();
+ struct GlyphCacheEntry {
+ void *context;
+ QFontEngineGlyphCache *cache;
+ bool operator==(const GlyphCacheEntry &other) { return context == other.context && cache == other.cache; }
+ };
- GlyphPointerHash m_glyphPointerHash;
- GlyphIntHash m_glyphIntHash;
- mutable QList<QFontEngineGlyphCache*> m_glyphCacheQueue;
+ mutable QLinkedList<GlyphCacheEntry> m_glyphCaches;
};
inline bool operator ==(const QFontEngine::FaceId &f1, const QFontEngine::FaceId &f2)
diff --git a/src/gui/text/qfontengineglyphcache_p.h b/src/gui/text/qfontengineglyphcache_p.h
index e04f4ac..c6112ba 100644
--- a/src/gui/text/qfontengineglyphcache_p.h
+++ b/src/gui/text/qfontengineglyphcache_p.h
@@ -75,17 +75,20 @@ QT_BEGIN_NAMESPACE
class QFontEngineGlyphCache
{
public:
- QFontEngineGlyphCache(const QTransform &matrix) : m_transform(matrix) { }
-
enum Type {
Raster_RGBMask,
Raster_A8,
Raster_Mono
};
+ QFontEngineGlyphCache(const QTransform &matrix, Type type) : m_transform(matrix), m_type(type) { }
+
virtual ~QFontEngineGlyphCache() { }
+ Type cacheType() const { return m_type; }
+
QTransform m_transform;
+ QFontEngineGlyphCache::Type m_type;
};
typedef QHash<void *, QList<QFontEngineGlyphCache *> > GlyphPointerHash;
typedef QHash<int, QList<QFontEngineGlyphCache *> > GlyphIntHash;
diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp
index f96f66b..f523226 100644
--- a/src/gui/text/qtextcontrol.cpp
+++ b/src/gui/text/qtextcontrol.cpp
@@ -1938,7 +1938,11 @@ void QTextControlPrivate::focusEvent(QFocusEvent *e)
emit q->updateRequest(q->selectionRect());
if (e->gotFocus()) {
#ifdef QT_KEYPAD_NAVIGATION
- if (!QApplication::keypadNavigationEnabled() || (hasEditFocus && e->reason() == Qt::PopupFocusReason)) {
+ if (!QApplication::keypadNavigationEnabled() || (hasEditFocus && (e->reason() == Qt::PopupFocusReason
+#ifdef Q_OS_SYMBIAN
+ || e->reason() == Qt::ActiveWindowFocusReason
+#endif
+ ))) {
#endif
cursorOn = (interactionFlags & Qt::TextSelectableByKeyboard);
if (interactionFlags & Qt::TextEditable) {
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index ce62834..f1dbf23 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -862,27 +862,28 @@ QTextLayout *QTextCursorPrivate::blockLayout(QTextBlock &block) const{
\ingroup richtext-processing
\ingroup shared
-
- Text cursors are objects that are used to access and modify the contents
- and underlying structure of text documents via a programming interface
- that mimics the behavior of a cursor in a text editor. QTextCursor contains
- information about both the cursor's position within a QTextDocument and any
- selection that it has made.
+ Text cursors are objects that are used to access and modify the
+ contents and underlying structure of text documents via a
+ programming interface that mimics the behavior of a cursor in a
+ text editor. QTextCursor contains information about both the
+ cursor's position within a QTextDocument and any selection that it
+ has made.
QTextCursor is modeled on the way a text cursor behaves in a text
- editor, providing a programmatic means of performing standard actions
- through the user interface. A document can be thought of as a
- single string of characters with the cursor's position() being \e
- between any two characters (or at the very beginning or very end
- of the document). Documents can also contain tables, lists,
- images, and other objects in addition to text but, from the developer's
- point of view, the document can be treated as one long string.
- Some portions of that string can be considered to lie within particular
- blocks (e.g. paragraphs), or within a table's cell, or a list's item,
- or other structural elements. When we refer to "current character" we
- mean the character immediately after the cursor position() in the
- document; similarly the "current block" is the block that contains the
- cursor position().
+ editor, providing a programmatic means of performing standard
+ actions through the user interface. A document can be thought of
+ as a single string of characters. The cursor's current position()
+ then is always either \e between two consecutive characters in the
+ string, or else \e before the very first character or \e after the
+ very last character in the string. Documents can also contain
+ tables, lists, images, and other objects in addition to text but,
+ from the developer's point of view, the document can be treated as
+ one long string. Some portions of that string can be considered
+ to lie within particular blocks (e.g. paragraphs), or within a
+ table's cell, or a list's item, or other structural elements. When
+ we refer to "current character" we mean the character immediately
+ \e before the cursor position() in the document. Similarly, the
+ "current block" is the block that contains the cursor position().
A QTextCursor also has an anchor() position. The text that is
between the anchor() and the position() is the selection. If
@@ -940,11 +941,12 @@ QTextLayout *QTextCursorPrivate::blockLayout(QTextBlock &block) const{
undo/redo) using beginEditBlock() and endEditBlock().
Cursor movements are limited to valid cursor positions. In Latin
- writing this is usually after every character in the text. In some
- other writing systems cursor movements are limited to "clusters"
- (e.g. a syllable in Devanagari, or a base letter plus diacritics).
- Functions such as movePosition() and deleteChar() limit cursor
- movement to these valid positions.
+ writing this is between any two consecutive characters in the
+ text, before the first character, or after the last character. In
+ some other writing systems cursor movements are limited to
+ "clusters" (e.g. a syllable in Devanagari, or a base letter plus
+ diacritics). Functions such as movePosition() and deleteChar()
+ limit cursor movement to these valid positions.
\sa \link richtext.html Rich Text Processing\endlink
@@ -1739,8 +1741,9 @@ void QTextCursor::mergeBlockCharFormat(const QTextCharFormat &modifier)
}
/*!
- Returns the format of the character immediately before the cursor position(). If the cursor is
- positioned at the beginning of a text block that is not empty then the format of the character
+ Returns the format of the character immediately before the cursor
+ position(). If the cursor is positioned at the beginning of a text
+ block that is not empty then the format of the character
immediately after the cursor is returned.
\sa insertText(), blockFormat()
diff --git a/src/gui/text/qtextodfwriter.cpp b/src/gui/text/qtextodfwriter.cpp
index 1bd4dd6..dcc2e7d 100644
--- a/src/gui/text/qtextodfwriter.cpp
+++ b/src/gui/text/qtextodfwriter.cpp
@@ -484,6 +484,10 @@ void QTextOdfWriter::writeBlockFormat(QXmlStreamWriter &writer, QTextBlockFormat
if (format.pageBreakPolicy() & QTextFormat::PageBreak_AlwaysAfter)
writer.writeAttribute(foNS, QString::fromLatin1("break-after"), QString::fromLatin1("page"));
}
+ if (format.hasProperty(QTextFormat::BackgroundBrush)) {
+ QBrush brush = format.background();
+ writer.writeAttribute(foNS, QString::fromLatin1("background-color"), brush.color().name());
+ }
if (format.hasProperty(QTextFormat::BlockNonBreakableLines))
writer.writeAttribute(foNS, QString::fromLatin1("keep-together"),
format.nonBreakableLines() ? QString::fromLatin1("true") : QString::fromLatin1("false"));
@@ -552,8 +556,8 @@ void QTextOdfWriter::writeCharacterFormat(QXmlStreamWriter &writer, QTextCharFor
}
if (format.hasProperty(QTextFormat::FontLetterSpacing))
writer.writeAttribute(foNS, QString::fromLatin1("letter-spacing"), pixelToPoint(format.fontLetterSpacing()));
- if (format.hasProperty(QTextFormat::FontWordSpacing))
- writer.writeAttribute(foNS, QString::fromLatin1("word-spacing"), pixelToPoint(format.fontWordSpacing()));
+ if (format.hasProperty(QTextFormat::FontWordSpacing) && format.fontWordSpacing() != 0)
+ writer.writeAttribute(foNS, QString::fromLatin1("word-spacing"), pixelToPoint(format.fontWordSpacing()));
if (format.hasProperty(QTextFormat::FontUnderline))
writer.writeAttribute(styleNS, QString::fromLatin1("text-underline-type"),
format.fontUnderline() ? QString::fromLatin1("single") : QString::fromLatin1("none"));
@@ -610,9 +614,12 @@ void QTextOdfWriter::writeCharacterFormat(QXmlStreamWriter &writer, QTextCharFor
}
if (format.hasProperty(QTextFormat::ForegroundBrush)) {
QBrush brush = format.foreground();
- // TODO
writer.writeAttribute(foNS, QString::fromLatin1("color"), brush.color().name());
}
+ if (format.hasProperty(QTextFormat::BackgroundBrush)) {
+ QBrush brush = format.background();
+ writer.writeAttribute(foNS, QString::fromLatin1("background-color"), brush.color().name());
+ }
writer.writeEndElement(); // style
}
diff --git a/src/gui/util/qsystemtrayicon_p.h b/src/gui/util/qsystemtrayicon_p.h
index 86de366..029a259 100644
--- a/src/gui/util/qsystemtrayicon_p.h
+++ b/src/gui/util/qsystemtrayicon_p.h
@@ -94,6 +94,7 @@ public:
class QBalloonTip : public QWidget
{
+ Q_OBJECT
public:
static void showBalloon(QSystemTrayIcon::MessageIcon icon, const QString& title,
const QString& msg, QSystemTrayIcon *trayIcon,
diff --git a/src/gui/util/qsystemtrayicon_win.cpp b/src/gui/util/qsystemtrayicon_win.cpp
index 362be5b..474555b 100644
--- a/src/gui/util/qsystemtrayicon_win.cpp
+++ b/src/gui/util/qsystemtrayicon_win.cpp
@@ -83,7 +83,11 @@ struct Q_NOTIFYICONIDENTIFIER {
GUID guidItem;
};
+#define Q_MSGFLT_ALLOW 1
+
typedef HRESULT (WINAPI *PtrShell_NotifyIconGetRect)(const Q_NOTIFYICONIDENTIFIER* identifier, RECT* iconLocation);
+typedef BOOL (WINAPI *PtrChangeWindowMessageFilter)(UINT message, DWORD dwFlag);
+typedef BOOL (WINAPI *PtrChangeWindowMessageFilterEx)(HWND hWnd, UINT message, DWORD action, void* pChangeFilterStruct);
class QSystemTrayIconSys : QWidget
{
@@ -143,6 +147,23 @@ QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *object)
if (!MYWM_TASKBARCREATED) {
MYWM_TASKBARCREATED = RegisterWindowMessage(L"TaskbarCreated");
}
+
+ // Allow the WM_TASKBARCREATED message through the UIPI filter on Windows Vista and higher
+ static PtrChangeWindowMessageFilterEx pChangeWindowMessageFilterEx =
+ (PtrChangeWindowMessageFilterEx)QLibrary::resolve(QLatin1String("user32"), "ChangeWindowMessageFilterEx");
+
+ if (pChangeWindowMessageFilterEx) {
+ // Call the safer ChangeWindowMessageFilterEx API if available
+ pChangeWindowMessageFilterEx(winId(), MYWM_TASKBARCREATED, Q_MSGFLT_ALLOW, 0);
+ } else {
+ static PtrChangeWindowMessageFilter pChangeWindowMessageFilter =
+ (PtrChangeWindowMessageFilter)QLibrary::resolve(QLatin1String("user32"), "ChangeWindowMessageFilter");
+
+ if (pChangeWindowMessageFilter) {
+ // Call the deprecated ChangeWindowMessageFilter API otherwise
+ pChangeWindowMessageFilter(MYWM_TASKBARCREATED, Q_MSGFLT_ALLOW);
+ }
+ }
}
QSystemTrayIconSys::~QSystemTrayIconSys()
diff --git a/src/gui/widgets/qabstractspinbox.cpp b/src/gui/widgets/qabstractspinbox.cpp
index a18af4f..e26d5c3 100644
--- a/src/gui/widgets/qabstractspinbox.cpp
+++ b/src/gui/widgets/qabstractspinbox.cpp
@@ -65,6 +65,11 @@
#include <limits.h>
#endif
+#if defined(Q_OS_SYMBIAN)
+#include <W32STD.H>
+#include <private/qt_s60_p.h>
+#endif
+
//#define QABSTRACTSPINBOX_QSBDEBUG
#ifdef QABSTRACTSPINBOX_QSBDEBUG
# define QASBDEBUG qDebug
@@ -939,10 +944,12 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event)
d->edit->setCursorPosition(d->prefix.size());
int steps = 1;
+ bool isPgUpOrDown = false;
switch (event->key()) {
case Qt::Key_PageUp:
case Qt::Key_PageDown:
steps *= 10;
+ isPgUpOrDown = true;
case Qt::Key_Up:
case Qt::Key_Down: {
#ifdef QT_KEYPAD_NAVIGATION
@@ -964,7 +971,13 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event)
if (style()->styleHint(QStyle::SH_SpinBox_AnimateButton, 0, this)) {
d->buttonState = (Keyboard | (up ? Up : Down));
}
- stepBy(steps);
+ if (d->spinClickTimerId == -1)
+ stepBy(steps);
+ if(event->isAutoRepeat() && !isPgUpOrDown) {
+ if(d->spinClickThresholdTimerId == -1 && d->spinClickTimerId == -1) {
+ d->updateState(up, true);
+ }
+ }
#ifndef QT_NO_ACCESSIBILITY
QAccessible::updateAccessibility(this, 0, QAccessible::ValueChanged);
#endif
@@ -1061,8 +1074,7 @@ void QAbstractSpinBox::keyReleaseEvent(QKeyEvent *event)
{
Q_D(QAbstractSpinBox);
- if (d->buttonState & Keyboard && !event->isAutoRepeat()
- && style()->styleHint(QStyle::SH_SpinBox_AnimateButton, 0, this)) {
+ if (d->buttonState & Keyboard && !event->isAutoRepeat()) {
d->reset();
} else {
d->edit->event(event);
@@ -1148,6 +1160,34 @@ void QAbstractSpinBox::hideEvent(QHideEvent *event)
QWidget::hideEvent(event);
}
+
+/*!
+ \internal
+
+ Used when acceleration is turned on. We need to get the
+ keyboard auto repeat rate from OS. This value is used as
+ argument when starting acceleration related timers.
+
+ Every platform should, either, use native calls to obtain
+ the value or hard code some reasonable rate.
+
+ Remember that time value should be given in msecs.
+*/
+static int getKeyboardAutoRepeatRate() {
+ int ret = 30;
+#if defined(Q_OS_SYMBIAN)
+ TTimeIntervalMicroSeconds32 initialTime;
+ TTimeIntervalMicroSeconds32 time;
+ S60->wsSession().GetKeyboardRepeatRate(initialTime, time);
+ ret = time.Int() / 1000; // msecs
+#elif defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+ DWORD time;
+ if (SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, &time, 0) != FALSE)
+ ret = static_cast<int>(1000 / static_cast<int>(time)); // msecs
+#endif
+ return ret; // msecs
+}
+
/*!
\reimp
*/
@@ -1160,14 +1200,17 @@ void QAbstractSpinBox::timerEvent(QTimerEvent *event)
if (event->timerId() == d->spinClickThresholdTimerId) {
killTimer(d->spinClickThresholdTimerId);
d->spinClickThresholdTimerId = -1;
- d->spinClickTimerId = startTimer(d->spinClickTimerInterval);
+ d->effectiveSpinRepeatRate = d->buttonState & Keyboard
+ ? getKeyboardAutoRepeatRate()
+ : d->spinClickTimerInterval;
+ d->spinClickTimerId = startTimer(d->effectiveSpinRepeatRate);
doStep = true;
} else if (event->timerId() == d->spinClickTimerId) {
if (d->accelerate) {
- d->acceleration = d->acceleration + (int)(d->spinClickTimerInterval * 0.05);
- if (d->spinClickTimerInterval - d->acceleration >= 10) {
+ d->acceleration = d->acceleration + (int)(d->effectiveSpinRepeatRate * 0.05);
+ if (d->effectiveSpinRepeatRate - d->acceleration >= 10) {
killTimer(d->spinClickTimerId);
- d->spinClickTimerId = startTimer(d->spinClickTimerInterval - d->acceleration);
+ d->spinClickTimerId = startTimer(d->effectiveSpinRepeatRate - d->acceleration);
}
}
doStep = true;
@@ -1308,8 +1351,8 @@ void QAbstractSpinBox::mouseReleaseEvent(QMouseEvent *event)
QAbstractSpinBoxPrivate::QAbstractSpinBoxPrivate()
: edit(0), type(QVariant::Invalid), spinClickTimerId(-1),
spinClickTimerInterval(100), spinClickThresholdTimerId(-1), spinClickThresholdTimerInterval(-1),
- buttonState(None), cachedText(QLatin1String("\x01")), cachedState(QValidator::Invalid),
- pendingEmit(false), readOnly(false), wrapping(false),
+ effectiveSpinRepeatRate(1), buttonState(None), cachedText(QLatin1String("\x01")),
+ cachedState(QValidator::Invalid), pendingEmit(false), readOnly(false), wrapping(false),
ignoreCursorPositionChanged(false), frame(true), accelerate(false), keyboardTracking(true),
cleared(false), ignoreUpdateEdit(false), correctionMode(QAbstractSpinBox::CorrectToPreviousValue),
acceleration(0), hoverControl(QStyle::SC_None), buttonSymbols(QAbstractSpinBox::UpDownArrows), validator(0)
@@ -1554,7 +1597,7 @@ void QAbstractSpinBoxPrivate::reset()
Updates the state of the spinbox.
*/
-void QAbstractSpinBoxPrivate::updateState(bool up)
+void QAbstractSpinBoxPrivate::updateState(bool up, bool fromKeyboard /* = false */)
{
Q_Q(QAbstractSpinBox);
if ((up && (buttonState & Up)) || (!up && (buttonState & Down)))
@@ -1563,7 +1606,7 @@ void QAbstractSpinBoxPrivate::updateState(bool up)
if (q && (q->stepEnabled() & (up ? QAbstractSpinBox::StepUpEnabled
: QAbstractSpinBox::StepDownEnabled))) {
spinClickThresholdTimerId = q->startTimer(spinClickThresholdTimerInterval);
- buttonState = (up ? (Mouse | Up) : (Mouse | Down));
+ buttonState = (up ? Up : Down) | (fromKeyboard ? Keyboard : Mouse);
q->stepBy(up ? 1 : -1);
#ifndef QT_NO_ACCESSIBILITY
QAccessible::updateAccessibility(q, 0, QAccessible::ValueChanged);
@@ -1856,8 +1899,10 @@ QValidator::State QSpinBoxValidator::validate(QString &input, int &pos) const
if (dptr->specialValueText.size() > 0 && input == dptr->specialValueText)
return QValidator::Acceptable;
- if (!dptr->prefix.isEmpty() && !input.startsWith(dptr->prefix))
+ if (!dptr->prefix.isEmpty() && !input.startsWith(dptr->prefix)) {
input.prepend(dptr->prefix);
+ pos += dptr->prefix.length();
+ }
if (!dptr->suffix.isEmpty() && !input.endsWith(dptr->suffix))
input.append(dptr->suffix);
diff --git a/src/gui/widgets/qabstractspinbox_p.h b/src/gui/widgets/qabstractspinbox_p.h
index 3020cbc..55f94d7 100644
--- a/src/gui/widgets/qabstractspinbox_p.h
+++ b/src/gui/widgets/qabstractspinbox_p.h
@@ -98,7 +98,7 @@ public:
void init();
void reset();
- void updateState(bool up);
+ void updateState(bool up, bool fromKeyboard = false);
QString stripped(const QString &text, int *pos = 0) const;
bool specialValue() const;
virtual QVariant getZeroVariant() const;
@@ -129,6 +129,7 @@ public:
QVariant value, minimum, maximum, singleStep;
QVariant::Type type;
int spinClickTimerId, spinClickTimerInterval, spinClickThresholdTimerId, spinClickThresholdTimerInterval;
+ int effectiveSpinRepeatRate;
uint buttonState;
mutable QString cachedText;
mutable QVariant cachedValue;
diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp
index bd1d8ba..b7dd20c 100644
--- a/src/gui/widgets/qcombobox.cpp
+++ b/src/gui/widgets/qcombobox.cpp
@@ -931,7 +931,10 @@ void QComboBoxPrivate::init()
QSizePolicy::ComboBox));
setLayoutItemMargins(QStyle::SE_ComboBoxLayoutItem);
q->setModel(new QStandardItemModel(0, 1, q));
- q->setAttribute(Qt::WA_InputMethodEnabled);
+ if (!q->isEditable())
+ q->setAttribute(Qt::WA_InputMethodEnabled, false);
+ else
+ q->setAttribute(Qt::WA_InputMethodEnabled);
}
QComboBoxPrivateContainer* QComboBoxPrivate::viewContainer()
diff --git a/src/gui/widgets/qdial.cpp b/src/gui/widgets/qdial.cpp
index 95e6ed5..dc02c02 100644
--- a/src/gui/widgets/qdial.cpp
+++ b/src/gui/widgets/qdial.cpp
@@ -59,6 +59,7 @@
#ifndef QT_NO_ACCESSIBILITY
#include "qaccessible.h"
#endif
+#include <qmath.h>
QT_BEGIN_NAMESPACE
@@ -135,7 +136,7 @@ int QDialPrivate::valueFromPoint(const QPoint &p) const
Q_Q(const QDial);
double yy = (double)q->height()/2.0 - p.y();
double xx = (double)p.x() - q->width()/2.0;
- double a = (xx || yy) ? atan2(yy, xx) : 0;
+ double a = (xx || yy) ? qAtan2(yy, xx) : 0;
if (a < Q_PI / -2)
a = a + Q_PI * 2;
diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp
index 0a26a77..cf82da0 100644
--- a/src/gui/widgets/qdockarealayout.cpp
+++ b/src/gui/widgets/qdockarealayout.cpp
@@ -1303,9 +1303,9 @@ QDockAreaLayoutInfo *QDockAreaLayoutInfo::info(const QList<int> &path)
index = -index - 1;
if (index >= item_list.count())
return this;
- if (path.count() == 1 || item_list.at(index).subinfo == 0)
+ if (path.count() == 1 || item_list[index].subinfo == 0)
return this;
- return item_list.at(index).subinfo->info(path.mid(1));
+ return item_list[index].subinfo->info(path.mid(1));
}
QRect QDockAreaLayoutInfo::itemRect(int index) const
diff --git a/src/gui/widgets/qlcdnumber.h b/src/gui/widgets/qlcdnumber.h
index e65637d..b7162cd 100644
--- a/src/gui/widgets/qlcdnumber.h
+++ b/src/gui/widgets/qlcdnumber.h
@@ -82,9 +82,10 @@ public:
};
bool smallDecimalPoint() const;
-
+#ifdef QT_DEPRECATED
QT_DEPRECATED int numDigits() const;
QT_DEPRECATED void setNumDigits(int nDigits);
+#endif
int digitCount() const;
void setDigitCount(int nDigits);
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp
index 2c1acdb..573b2b5 100644
--- a/src/gui/widgets/qlineedit.cpp
+++ b/src/gui/widgets/qlineedit.cpp
@@ -1445,6 +1445,16 @@ bool QLineEdit::event(QEvent * e)
d->control->processEvent(e);
} else if (e->type() == QEvent::KeyRelease) {
d->control->setCursorBlinkPeriod(QApplication::cursorFlashTime());
+ } else if (e->type() == QEvent::Show) {
+ //In order to get the cursor blinking if QComboBox::setEditable is called when the combobox has focus
+ if (hasFocus()) {
+ d->control->setCursorBlinkPeriod(QApplication::cursorFlashTime());
+ QStyleOptionFrameV2 opt;
+ initStyleOption(&opt);
+ if ((!hasSelectedText() && d->control->preeditAreaText().isEmpty())
+ || style()->styleHint(QStyle::SH_BlinkCursorWhenTextSelected, &opt, this))
+ d->setCursorVisible(true);
+ }
}
#ifdef QT_KEYPAD_NAVIGATION
@@ -1751,7 +1761,11 @@ void QLineEdit::focusInEvent(QFocusEvent *e)
d->clickCausedFocus = 1;
}
#ifdef QT_KEYPAD_NAVIGATION
- if (!QApplication::keypadNavigationEnabled() || (hasEditFocus() && e->reason() == Qt::PopupFocusReason)){
+ if (!QApplication::keypadNavigationEnabled() || (hasEditFocus() && ( e->reason() == Qt::PopupFocusReason
+#ifdef Q_OS_SYMBIAN
+ || e->reason() == Qt::ActiveWindowFocusReason
+#endif
+ ))) {
#endif
d->control->setCursorBlinkPeriod(QApplication::cursorFlashTime());
QStyleOptionFrameV2 opt;
diff --git a/src/gui/widgets/qlineedit.h b/src/gui/widgets/qlineedit.h
index 594e488..3f159f6 100644
--- a/src/gui/widgets/qlineedit.h
+++ b/src/gui/widgets/qlineedit.h
@@ -288,6 +288,7 @@ private:
#ifdef QT_KEYPAD_NAVIGATION
Q_PRIVATE_SLOT(d_func(), void _q_editFocusChange(bool))
#endif
+ Q_PRIVATE_SLOT(d_func(), void _q_selectionChanged())
};
#endif // QT_NO_LINEEDIT
diff --git a/src/gui/widgets/qlineedit_p.cpp b/src/gui/widgets/qlineedit_p.cpp
index 4437fef..c18ca25 100644
--- a/src/gui/widgets/qlineedit_p.cpp
+++ b/src/gui/widgets/qlineedit_p.cpp
@@ -126,6 +126,21 @@ void QLineEditPrivate::_q_editFocusChange(bool e)
}
#endif
+void QLineEditPrivate::_q_selectionChanged()
+{
+ Q_Q(QLineEdit);
+ if (control->preeditAreaText().isEmpty()) {
+ QStyleOptionFrameV2 opt;
+ q->initStyleOption(&opt);
+ bool showCursor = control->hasSelectedText() ?
+ q->style()->styleHint(QStyle::SH_BlinkCursorWhenTextSelected, &opt, q):
+ true;
+ setCursorVisible(showCursor);
+ }
+
+ emit q->selectionChanged();
+}
+
void QLineEditPrivate::init(const QString& txt)
{
Q_Q(QLineEdit);
@@ -138,7 +153,7 @@ void QLineEditPrivate::init(const QString& txt)
QObject::connect(control, SIGNAL(cursorPositionChanged(int,int)),
q, SLOT(_q_cursorPositionChanged(int,int)));
QObject::connect(control, SIGNAL(selectionChanged()),
- q, SIGNAL(selectionChanged()));
+ q, SLOT(_q_selectionChanged()));
QObject::connect(control, SIGNAL(accepted()),
q, SIGNAL(returnPressed()));
QObject::connect(control, SIGNAL(editingFinished()),
@@ -149,6 +164,9 @@ void QLineEditPrivate::init(const QString& txt)
#endif
QObject::connect(control, SIGNAL(cursorPositionChanged(int,int)),
q, SLOT(updateMicroFocus()));
+
+ QObject::connect(control, SIGNAL(textChanged(const QString &)),
+ q, SLOT(updateMicroFocus()));
// for now, going completely overboard with updates.
QObject::connect(control, SIGNAL(selectionChanged()),
diff --git a/src/gui/widgets/qlineedit_p.h b/src/gui/widgets/qlineedit_p.h
index dc648e8..f13dce2 100644
--- a/src/gui/widgets/qlineedit_p.h
+++ b/src/gui/widgets/qlineedit_p.h
@@ -128,7 +128,7 @@ public:
#ifdef QT_KEYPAD_NAVIGATION
void _q_editFocusChange(bool);
#endif
-
+ void _q_selectionChanged();
#ifndef QT_NO_COMPLETER
void _q_completionHighlighted(QString);
#endif
diff --git a/src/gui/widgets/qmainwindow.h b/src/gui/widgets/qmainwindow.h
index 8ee0507..316bbb8 100644
--- a/src/gui/widgets/qmainwindow.h
+++ b/src/gui/widgets/qmainwindow.h
@@ -102,8 +102,10 @@ public:
Qt::ToolButtonStyle toolButtonStyle() const;
void setToolButtonStyle(Qt::ToolButtonStyle toolButtonStyle);
+#ifndef QT_NO_DOCKWIDGET
bool isAnimated() const;
bool isDockNestingEnabled() const;
+#endif
#ifndef QT_NO_TABBAR
bool documentMode() const;
diff --git a/src/gui/widgets/qmainwindowlayout_mac.mm b/src/gui/widgets/qmainwindowlayout_mac.mm
index 8d8ffa7..6d50678 100644
--- a/src/gui/widgets/qmainwindowlayout_mac.mm
+++ b/src/gui/widgets/qmainwindowlayout_mac.mm
@@ -463,9 +463,6 @@ void QMainWindowLayout::removeFromMacToolbar(QToolBar *toolbar)
NSToolbarItem *item = static_cast<NSToolbarItem *>(it.key());
[[qt_mac_window_for(layoutState.mainWindow->window()) toolbar]
removeItemAtIndex:toolbarItemsCopy.indexOf(item)];
- // In Carbon this hash and list gets emptied via events. In Cocoa, we have to do it ourselves here.
- it = unifiedToolbarHash.erase(it);
- qtoolbarsInUnifiedToolbarList.removeAll(toolbar);
#endif
break;
}
diff --git a/src/gui/widgets/qmdiarea.cpp b/src/gui/widgets/qmdiarea.cpp
index f3dbe34..a4a4cb2 100644
--- a/src/gui/widgets/qmdiarea.cpp
+++ b/src/gui/widgets/qmdiarea.cpp
@@ -1853,11 +1853,11 @@ void QMdiArea::closeAllSubWindows()
}
/*!
- Gives the keyboard focus to the next window in the list of child
- windows. The windows are activated in the order in which they are
- created (CreationOrder).
+ Gives the keyboard focus to another window in the list of child
+ windows. The window activated will be the next one determined
+ by the current \l{QMdiArea::WindowOrder} {activation order}.
- \sa activatePreviousSubWindow()
+ \sa activatePreviousSubWindow(), QMdiArea::WindowOrder
*/
void QMdiArea::activateNextSubWindow()
{
@@ -1871,11 +1871,11 @@ void QMdiArea::activateNextSubWindow()
}
/*!
- Gives the keyboard focus to the previous window in the list of
- child windows. The windows are activated in the order in which
- they are created (CreationOrder).
+ Gives the keyboard focus to another window in the list of child
+ windows. The window activated will be the previous one determined
+ by the current \l{QMdiArea::WindowOrder} {activation order}.
- \sa activateNextSubWindow()
+ \sa activateNextSubWindow(), QMdiArea::WindowOrder
*/
void QMdiArea::activatePreviousSubWindow()
{
diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp
index 89fe7b8..a3624d6 100644
--- a/src/gui/widgets/qplaintextedit.cpp
+++ b/src/gui/widgets/qplaintextedit.cpp
@@ -684,8 +684,12 @@ void QPlainTextEditPrivate::ensureVisible(int position, bool center, bool forceC
qreal h = center ? line.naturalTextRect().center().y() : line.naturalTextRect().bottom();
+ QTextBlock previousVisibleBlock = block;
while (h < height && block.previous().isValid()) {
- block = block.previous();
+ previousVisibleBlock = block;
+ do {
+ block = block.previous();
+ } while (!block.isVisible() && block.previous().isValid());
h += q->blockBoundingRect(block).height();
}
@@ -699,8 +703,8 @@ void QPlainTextEditPrivate::ensureVisible(int position, bool center, bool forceC
++l;
}
- if (block.next().isValid() && l >= lineCount) {
- block = block.next();
+ if (l >= lineCount) {
+ block = previousVisibleBlock;
l = 0;
}
setTopBlock(block.blockNumber(), l);
@@ -761,6 +765,7 @@ void QPlainTextEditPrivate::init(const QString &txt)
QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SLOT(_q_cursorPositionChanged()));
QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorPositionChanged()));
+ QObject::connect(control, SIGNAL(textChanged()), q, SLOT(updateMicroFocus()));
// set a null page size initially to avoid any relayouting until the textedit
// is shown. relayoutDocument() will take care of setting the page size to the
diff --git a/src/gui/widgets/qprintpreviewwidget.h b/src/gui/widgets/qprintpreviewwidget.h
index 08e596d..d8504de 100644
--- a/src/gui/widgets/qprintpreviewwidget.h
+++ b/src/gui/widgets/qprintpreviewwidget.h
@@ -82,7 +82,9 @@ public:
ViewMode viewMode() const;
ZoomMode zoomMode() const;
int currentPage() const;
+#ifdef QT_DEPRECATED
QT_DEPRECATED int numPages() const;
+#endif
int pageCount() const;
void setVisible(bool visible);
diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp
index 1bc0bf1..5d8f134 100644
--- a/src/gui/widgets/qtextedit.cpp
+++ b/src/gui/widgets/qtextedit.cpp
@@ -158,6 +158,8 @@ void QTextEditPrivate::init(const QString &html)
QObject::connect(control, SIGNAL(selectionChanged()), q, SIGNAL(selectionChanged()));
QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorPositionChanged()));
+ QObject::connect(control, SIGNAL(textChanged()), q, SLOT(updateMicroFocus()));
+
QTextDocument *doc = control->document();
// set a null page size initially to avoid any relayouting until the textedit
// is shown. relayoutDocument() will take care of setting the page size to the
diff --git a/src/network/access/qnetworkreply.cpp b/src/network/access/qnetworkreply.cpp
index 9ab4057..e6ca367 100644
--- a/src/network/access/qnetworkreply.cpp
+++ b/src/network/access/qnetworkreply.cpp
@@ -171,7 +171,7 @@ QNetworkReplyPrivate::QNetworkReplyPrivate()
\value UnknownProxyError an unknown proxy-related error
was detected
- \value UnknownContentError an unknonwn error related to
+ \value UnknownContentError an unknown error related to
the remote content was detected
\value ProtocolFailure a breakdown in protocol was
diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp
index c20812e..1667c10 100644
--- a/src/network/access/qnetworkreplyimpl.cpp
+++ b/src/network/access/qnetworkreplyimpl.cpp
@@ -273,7 +273,7 @@ void QNetworkReplyImplPrivate::handleNotifications()
if (state != Working)
return;
- while (!current.isEmpty()) {
+ while (state == Working && !current.isEmpty()) {
InternalNotifications notification = current.dequeue();
switch (notification) {
case NotifyDownstreamReadyWrite:
@@ -580,7 +580,7 @@ QNetworkReplyImpl::~QNetworkReplyImpl()
void QNetworkReplyImpl::abort()
{
Q_D(QNetworkReplyImpl);
- if (d->state == QNetworkReplyImplPrivate::Aborted)
+ if (d->state == QNetworkReplyImplPrivate::Finished || d->state == QNetworkReplyImplPrivate::Aborted)
return;
// stop both upload and download
diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp
index 98a39cd..e77a425 100644
--- a/src/network/kernel/qhostinfo.cpp
+++ b/src/network/kernel/qhostinfo.cpp
@@ -60,11 +60,9 @@
QT_BEGIN_NAMESPACE
-Q_GLOBAL_STATIC(QHostInfoAgent, theAgent)
-void QHostInfoAgent::staticCleanup()
-{
- theAgent()->cleanup();
-}
+#ifndef QT_NO_THREAD
+Q_GLOBAL_STATIC(QHostInfoLookupManager, theHostInfoLookupManager)
+#endif
//#define QHOSTINFO_DEBUG
@@ -143,6 +141,9 @@ static QBasicAtomicInt theIdCounter = Q_BASIC_ATOMIC_INITIALIZER(1);
\snippet doc/src/snippets/code/src_network_kernel_qhostinfo.cpp 4
+ \note There is no guarantee on the order the signals will be emitted
+ if you start multiple requests with lookupHost().
+
\sa abortHostLookup(), addresses(), error(), fromName()
*/
int QHostInfo::lookupHost(const QString &name, QObject *receiver,
@@ -159,38 +160,32 @@ int QHostInfo::lookupHost(const QString &name, QObject *receiver,
qRegisterMetaType<QHostInfo>("QHostInfo");
-#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
- QWindowsSockInit bust; // makes sure WSAStartup was callled
-#endif
-
- QScopedPointer<QHostInfoResult> result(new QHostInfoResult);
- result.data()->autoDelete = false;
- QObject::connect(result.data(), SIGNAL(resultsReady(QHostInfo)),
- receiver, member);
- int id = result.data()->lookupId = theIdCounter.fetchAndAddRelaxed(1);
+ int id = theIdCounter.fetchAndAddRelaxed(1); // generate unique ID
if (name.isEmpty()) {
- QHostInfo info(id);
- info.setError(QHostInfo::HostNotFound);
- info.setErrorString(QObject::tr("No host name given"));
- QMetaObject::invokeMethod(result.data(), "emitResultsReady", Qt::QueuedConnection,
- Q_ARG(QHostInfo, info));
- result.take()->autoDelete = true;
+ QHostInfo hostInfo(id);
+ hostInfo.setError(QHostInfo::HostNotFound);
+ hostInfo.setErrorString(QObject::tr("No host name given"));
+ QScopedPointer<QHostInfoResult> result(new QHostInfoResult);
+ QObject::connect(result.data(), SIGNAL(resultsReady(QHostInfo)),
+ receiver, member, Qt::QueuedConnection);
+ result.data()->emitResultsReady(hostInfo);
return id;
}
- QHostInfoAgent *agent = theAgent();
- agent->addHostName(name, result.take());
-
-#if !defined QT_NO_THREAD
- if (!agent->isRunning())
- agent->start();
+#ifdef QT_NO_THREAD
+ QHostInfo hostInfo = QHostInfoAgent::fromName(name);
+ hostInfo.setLookupId(id);
+ QScopedPointer<QHostInfoResult> result(new QHostInfoResult);
+ QObject::connect(result.data(), SIGNAL(resultsReady(QHostInfo)),
+ receiver, member, Qt::QueuedConnection);
+ result.data()->emitResultsReady(hostInfo);
#else
-// if (!agent->isRunning())
- agent->run();
-// else
-// agent->wakeOne();
+ QHostInfoRunnable* runnable = new QHostInfoRunnable(name, id);
+ QObject::connect(&runnable->resultEmitter, SIGNAL(resultsReady(QHostInfo)), receiver, member, Qt::QueuedConnection);
+ theHostInfoLookupManager()->scheduleLookup(runnable);
#endif
+
return id;
}
@@ -201,8 +196,12 @@ int QHostInfo::lookupHost(const QString &name, QObject *receiver,
*/
void QHostInfo::abortHostLookup(int id)
{
- QHostInfoAgent *agent = theAgent();
- agent->abortLookup(id);
+#ifndef QT_NO_THREAD
+ theHostInfoLookupManager()->abortLookup(id);
+#else
+ // we cannot abort if it was non threaded.. the result signal has already been posted
+ Q_UNUSED(id);
+#endif
}
/*!
@@ -228,70 +227,6 @@ QHostInfo QHostInfo::fromName(const QString &name)
}
/*!
- \internal
- Pops a query off the queries list, performs a blocking call to
- QHostInfoAgent::lookupHost(), and emits the resultsReady()
- signal. This process repeats until the queries list is empty.
-*/
-void QHostInfoAgent::run()
-{
-#ifndef QT_NO_THREAD
- // Dont' allow thread termination during event delivery, but allow it
- // during the actual blocking host lookup stage.
- setTerminationEnabled(false);
- forever
-#endif
- {
- QHostInfoQuery *query;
- {
-#ifndef QT_NO_THREAD
- // the queries list is shared between threads. lock all
- // access to it.
- QMutexLocker locker(&mutex);
- if (!quit && queries.isEmpty())
- cond.wait(&mutex);
- if (quit) {
- // Reset the quit variable in case QCoreApplication is
- // destroyed and recreated.
- quit = false;
- break;
- }
- if (queries.isEmpty())
- continue;
-#else
- if (queries.isEmpty())
- return;
-#endif
- query = queries.takeFirst();
- pendingQueryId = query->object->lookupId;
- }
-
-#if defined(QHOSTINFO_DEBUG)
- qDebug("QHostInfoAgent::run(%p): looking up \"%s\"", this,
- query->hostName.toLatin1().constData());
-#endif
-
-#ifndef QT_NO_THREAD
- // Start query - allow termination at this point, but not outside. We
- // don't want to all termination during event delivery, but we don't
- // want the lookup to prevent the app from quitting (the agent
- // destructor terminates the thread).
- setTerminationEnabled(true);
-#endif
- QHostInfo info = fromName(query->hostName);
-#ifndef QT_NO_THREAD
- setTerminationEnabled(false);
-#endif
-
- int id = query->object->lookupId;
- info.setLookupId(id);
- if (pendingQueryId == id)
- query->object->emitResultsReady(info);
- delete query;
- }
-}
-
-/*!
\enum QHostInfo::HostInfoError
This enum describes the various errors that can occur when trying
@@ -467,4 +402,174 @@ void QHostInfo::setErrorString(const QString &str)
\sa hostName()
*/
+#ifndef QT_NO_THREAD
+QHostInfoRunnable::QHostInfoRunnable(QString hn, int i) : toBeLookedUp(hn), id(i)
+{
+ setAutoDelete(true);
+}
+
+// the QHostInfoLookupManager will at some point call this via a QThreadPool
+void QHostInfoRunnable::run()
+{
+ QHostInfoLookupManager *manager = theHostInfoLookupManager();
+ // check aborted
+ if (manager->wasAborted(id)) {
+ manager->lookupFinished(this);
+ return;
+ }
+
+ // check cache
+ // FIXME
+
+ // if not in cache: OS lookup
+ QHostInfo hostInfo = QHostInfoAgent::fromName(toBeLookedUp);
+
+ // save to cache
+ // FIXME
+
+ // check aborted again
+ if (manager->wasAborted(id)) {
+ manager->lookupFinished(this);
+ return;
+ }
+
+ // signal emission
+ hostInfo.setLookupId(id);
+ resultEmitter.emitResultsReady(hostInfo);
+
+ manager->lookupFinished(this);
+
+ // thread goes back to QThreadPool
+}
+
+QHostInfoLookupManager::QHostInfoLookupManager() : mutex(QMutex::Recursive), wasDeleted(false)
+{
+ moveToThread(QCoreApplicationPrivate::mainThread());
+ threadPool.setMaxThreadCount(5); // do 5 DNS lookups in parallel
+}
+
+QHostInfoLookupManager::~QHostInfoLookupManager()
+{
+ wasDeleted = true;
+}
+
+void QHostInfoLookupManager::work()
+{
+ if (wasDeleted)
+ return;
+
+ // goals of this function:
+ // - launch new lookups via the thread pool
+ // - make sure only one lookup per host/IP is in progress
+
+ QMutexLocker locker(&mutex);
+
+ if (!finishedLookups.isEmpty()) {
+ // remove ID from aborted if it is in there
+ for (int i = 0; i < finishedLookups.length(); i++) {
+ abortedLookups.removeAll(finishedLookups.at(i)->id);
+ }
+
+ finishedLookups.clear();
+ }
+
+ if (!postponedLookups.isEmpty()) {
+ // try to start the postponed ones
+
+ QMutableListIterator<QHostInfoRunnable*> iterator(postponedLookups);
+ while (iterator.hasNext()) {
+ QHostInfoRunnable* postponed = iterator.next();
+
+ // check if none of the postponed hostnames is currently running
+ bool alreadyRunning = false;
+ for (int i = 0; i < currentLookups.length(); i++) {
+ if (currentLookups.at(i)->toBeLookedUp == postponed->toBeLookedUp) {
+ alreadyRunning = true;
+ break;
+ }
+ }
+ if (!alreadyRunning) {
+ iterator.remove();
+ scheduledLookups.prepend(postponed); // prepend! we want to finish it ASAP
+ }
+ }
+ }
+
+ if (!scheduledLookups.isEmpty()) {
+ // try to start the new ones
+ QMutableListIterator<QHostInfoRunnable*> iterator(scheduledLookups);
+ while (iterator.hasNext()) {
+ QHostInfoRunnable *scheduled = iterator.next();
+
+ // check if a lookup for this host is already running, then postpone
+ for (int i = 0; i < currentLookups.size(); i++) {
+ if (currentLookups.at(i)->toBeLookedUp == scheduled->toBeLookedUp) {
+ iterator.remove();
+ postponedLookups.append(scheduled);
+ scheduled = 0;
+ break;
+ }
+ }
+
+ if (scheduled && threadPool.tryStart(scheduled)) {
+ // runnable now running in new thread, track this in currentLookups
+ iterator.remove();
+ currentLookups.append(scheduled);
+ } else if (scheduled) {
+ // wanted to start, but could not because thread pool is busy
+ break;
+ } else {
+ // was postponed, continue iterating
+ continue;
+ }
+ };
+ }
+}
+
+// called by QHostInfo
+void QHostInfoLookupManager::scheduleLookup(QHostInfoRunnable *r)
+{
+ if (wasDeleted)
+ return;
+
+ QMutexLocker locker(&this->mutex);
+ scheduledLookups.enqueue(r);
+ work();
+}
+
+// called by QHostInfo
+void QHostInfoLookupManager::abortLookup(int id)
+{
+ if (wasDeleted)
+ return;
+
+ QMutexLocker locker(&this->mutex);
+ if (!abortedLookups.contains(id))
+ abortedLookups.append(id);
+}
+
+// called from QHostInfoRunnable
+bool QHostInfoLookupManager::wasAborted(int id)
+{
+ if (wasDeleted)
+ return true;
+
+ QMutexLocker locker(&this->mutex);
+ return abortedLookups.contains(id);
+}
+
+// called from QHostInfoRunnable
+void QHostInfoLookupManager::lookupFinished(QHostInfoRunnable *r)
+{
+ if (wasDeleted)
+ return;
+
+ QMutexLocker locker(&this->mutex);
+ currentLookups.removeOne(r);
+ finishedLookups.append(r);
+ work();
+}
+
+#endif // QT_NO_THREAD
+
QT_END_NAMESPACE
diff --git a/src/network/kernel/qhostinfo_p.h b/src/network/kernel/qhostinfo_p.h
index afd3570..643bb73 100644
--- a/src/network/kernel/qhostinfo_p.h
+++ b/src/network/kernel/qhostinfo_p.h
@@ -61,17 +61,17 @@
#include "QtCore/qobject.h"
#include "QtCore/qpointer.h"
-#if !defined QT_NO_THREAD
+#ifndef QT_NO_THREAD
#include "QtCore/qthread.h"
-# define QHostInfoAgentBase QThread
-#else
-# define QHostInfoAgentBase QObject
+#include "QtCore/qthreadpool.h"
+#include "QtCore/qmutex.h"
+#include "QtCore/qrunnable.h"
+#include "QtCore/qlist.h"
+#include "QtCore/qqueue.h"
#endif
QT_BEGIN_NAMESPACE
-static const int QHOSTINFO_THREAD_WAIT = 250; // ms
-
class QHostInfoResult : public QObject
{
Q_OBJECT
@@ -79,102 +79,18 @@ public Q_SLOTS:
inline void emitResultsReady(const QHostInfo &info)
{
emit resultsReady(info);
- if (autoDelete)
- delete this;
}
Q_SIGNALS:
- void resultsReady(const QHostInfo &info);
-
-public:
- int lookupId;
- bool autoDelete;
+ void resultsReady(const QHostInfo info);
};
-struct QHostInfoQuery
-{
- inline QHostInfoQuery() : object(0) {}
- inline ~QHostInfoQuery() { delete object; }
- inline QHostInfoQuery(const QString &name, QHostInfoResult *result)
- : hostName(name), object(result) {}
-
- QString hostName;
- QHostInfoResult *object;
-};
-
-class QHostInfoAgent : public QHostInfoAgentBase
+// needs to be QObject because fromName calls tr()
+class QHostInfoAgent : public QObject
{
Q_OBJECT
public:
- inline QHostInfoAgent()
- {
- // There is a chance that there will be two instances of
- // QHostInfoAgent if two threads try to get Q_GLOBAL_STATIC
- // object at the same time. The second object will be deleted
- // immediately before anyone uses it, but we need to be
- // careful about what we do in the constructor.
- static QBasicAtomicInt done = Q_BASIC_ATOMIC_INITIALIZER(0);
- if (done.testAndSetRelaxed(0, 1))
- qAddPostRoutine(staticCleanup);
- moveToThread(QCoreApplicationPrivate::mainThread());
- quit = false;
- pendingQueryId = -1;
- }
- inline ~QHostInfoAgent()
- { cleanup(); }
-
- void run();
static QHostInfo fromName(const QString &hostName);
-
- inline void addHostName(const QString &name, QHostInfoResult *result)
- {
- QMutexLocker locker(&mutex);
- queries << new QHostInfoQuery(name, result);
- cond.wakeOne();
- }
-
- inline void abortLookup(int id)
- {
- QMutexLocker locker(&mutex);
- for (int i = 0; i < queries.size(); ++i) {
- QHostInfoResult *result = queries.at(i)->object;
- if (result->lookupId == id) {
- result->disconnect();
- delete queries.takeAt(i);
- return;
- }
- }
- if (pendingQueryId == id)
- pendingQueryId = -1;
- }
-
- static void staticCleanup();
-
-public Q_SLOTS:
- inline void cleanup()
- {
- {
- QMutexLocker locker(&mutex);
- qDeleteAll(queries);
- queries.clear();
- quit = true;
- cond.wakeOne();
- }
-#ifndef QT_NO_THREAD
- if (!wait(QHOSTINFO_THREAD_WAIT)) {
- terminate();
- // Don't wait forever; see QTBUG-5296.
- wait(QHOSTINFO_THREAD_WAIT);
- }
-#endif
- }
-
-private:
- QList<QHostInfoQuery *> queries;
- QMutex mutex;
- QWaitCondition cond;
- volatile bool quit;
- int pendingQueryId;
};
class QHostInfoPrivate
@@ -194,6 +110,52 @@ public:
int lookupId;
};
+#ifndef QT_NO_THREAD
+// the following classes are used for the (normal) case: We use multiple threads to lookup DNS
+
+class QHostInfoRunnable : public QRunnable
+{
+public:
+ QHostInfoRunnable (QString hn, int i);
+ void run();
+
+ QString toBeLookedUp;
+ int id;
+ QHostInfoResult resultEmitter;
+};
+
+class QHostInfoLookupManager : public QObject
+{
+ Q_OBJECT
+public:
+ QHostInfoLookupManager();
+ ~QHostInfoLookupManager();
+
+ void work();
+
+ // called from QHostInfo
+ void scheduleLookup(QHostInfoRunnable *r);
+ void abortLookup(int id);
+
+ // called from QHostInfoRunnable
+ void lookupFinished(QHostInfoRunnable *r);
+ bool wasAborted(int id);
+
+protected:
+ QList<QHostInfoRunnable*> currentLookups; // in progress
+ QList<QHostInfoRunnable*> postponedLookups; // postponed because in progress for same host
+ QQueue<QHostInfoRunnable*> scheduledLookups; // not yet started
+ QList<QHostInfoRunnable*> finishedLookups; // recently finished
+ QList<int> abortedLookups; // ids of aborted lookups
+
+ QThreadPool threadPool;
+
+ QMutex mutex;
+
+ bool wasDeleted;
+};
+#endif
+
QT_END_NAMESPACE
#endif // QHOSTINFO_P_H
diff --git a/src/network/kernel/qhostinfo_win.cpp b/src/network/kernel/qhostinfo_win.cpp
index 720aaa5..727a8b0 100644
--- a/src/network/kernel/qhostinfo_win.cpp
+++ b/src/network/kernel/qhostinfo_win.cpp
@@ -105,11 +105,7 @@ static void resolveLibrary()
#include <qmutex.h>
QMutex qPrivCEMutex;
#endif
-/*
- Performs a blocking call to gethostbyname or getaddrinfo, stores
- the results in a QHostInfo structure and emits the
- resultsReady() signal.
-*/
+
QHostInfo QHostInfoAgent::fromName(const QString &hostName)
{
#if defined(Q_OS_WINCE)
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp
index 8b4f364..fda47bd 100644
--- a/src/network/socket/qabstractsocket.cpp
+++ b/src/network/socket/qabstractsocket.cpp
@@ -520,13 +520,13 @@ bool QAbstractSocketPrivate::initSocketLayer(QAbstractSocket::NetworkLayerProtoc
Q_Q(QAbstractSocket);
#if defined (QABSTRACTSOCKET_DEBUG)
QString typeStr;
- if (q->socketType() == QAbstractSocket::TcpSocket) typeStr = "TcpSocket";
- else if (q->socketType() == QAbstractSocket::UdpSocket) typeStr = "UdpSocket";
- else typeStr = "UnknownSocketType";
+ if (q->socketType() == QAbstractSocket::TcpSocket) typeStr = QLatin1String("TcpSocket");
+ else if (q->socketType() == QAbstractSocket::UdpSocket) typeStr = QLatin1String("UdpSocket");
+ else typeStr = QLatin1String("UnknownSocketType");
QString protocolStr;
- if (protocol == QAbstractSocket::IPv4Protocol) protocolStr = "IPv4Protocol";
- else if (protocol == QAbstractSocket::IPv6Protocol) protocolStr = "IPv6Protocol";
- else protocolStr = "UnknownNetworkLayerProtocol";
+ if (protocol == QAbstractSocket::IPv4Protocol) protocolStr = QLatin1String("IPv4Protocol");
+ else if (protocol == QAbstractSocket::IPv6Protocol) protocolStr = QLatin1String("IPv6Protocol");
+ else protocolStr = QLatin1String("UnknownNetworkLayerProtocol");
#endif
resetSocketLayer();
@@ -873,15 +873,19 @@ void QAbstractSocketPrivate::_q_startConnecting(const QHostInfo &hostInfo)
if (state != QAbstractSocket::HostLookupState)
return;
+ if (hostLookupId != -1 && hostLookupId != hostInfo.lookupId()) {
+ qWarning("QAbstractSocketPrivate::_q_startConnecting() received hostInfo for wrong lookup ID %d expected %d", hostInfo.lookupId(), hostLookupId);
+ }
+
addresses = hostInfo.addresses();
#if defined(QABSTRACTSOCKET_DEBUG)
- QString s = "{";
+ QString s = QLatin1String("{");
for (int i = 0; i < addresses.count(); ++i) {
- if (i != 0) s += ", ";
+ if (i != 0) s += QLatin1String(", ");
s += addresses.at(i).toString();
}
- s += '}';
+ s += QLatin1Char('}');
qDebug("QAbstractSocketPrivate::_q_startConnecting(hostInfo == %s)", s.toLatin1().constData());
#endif
diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp
index 5c28318..635a0c6 100644
--- a/src/network/socket/qhttpsocketengine.cpp
+++ b/src/network/socket/qhttpsocketengine.cpp
@@ -212,28 +212,14 @@ qint64 QHttpSocketEngine::bytesAvailable() const
qint64 QHttpSocketEngine::read(char *data, qint64 maxlen)
{
Q_D(QHttpSocketEngine);
- qint64 bytesRead = 0;
-
- if (!d->readBuffer.isEmpty()) {
- // Read as much from the buffer as we can.
- bytesRead = qMin((qint64)d->readBuffer.size(), maxlen);
- memcpy(data, d->readBuffer.constData(), bytesRead);
- data += bytesRead;
- maxlen -= bytesRead;
- d->readBuffer = d->readBuffer.mid(bytesRead);
- }
-
- qint64 bytesReadFromSocket = d->socket->read(data, maxlen);
+ qint64 bytesRead = d->socket->read(data, maxlen);
if (d->socket->state() == QAbstractSocket::UnconnectedState
&& d->socket->bytesAvailable() == 0) {
emitReadNotification();
}
- if (bytesReadFromSocket > 0) {
- // Add to what we read so far.
- bytesRead += bytesReadFromSocket;
- } else if (bytesRead == 0 && bytesReadFromSocket == -1) {
+ if (bytesRead == -1) {
// If nothing has been read so far, and the direct socket read
// failed, return the socket's error. Otherwise, fall through and
// return as much as we read so far.
@@ -560,7 +546,7 @@ void QHttpSocketEngine::slotSocketReadNotification()
}
QHttpResponseHeader responseHeader(QString::fromLatin1(d->readBuffer));
- d->readBuffer.clear();
+ d->readBuffer.clear(); // we parsed the proxy protocol response. from now on direct socket reading will be done
int statusCode = responseHeader.statusCode();
if (statusCode == 200) {
diff --git a/src/network/socket/qhttpsocketengine_p.h b/src/network/socket/qhttpsocketengine_p.h
index 76430db..1432bfb 100644
--- a/src/network/socket/qhttpsocketengine_p.h
+++ b/src/network/socket/qhttpsocketengine_p.h
@@ -162,7 +162,7 @@ public:
QNetworkProxy proxy;
QString peerName;
QTcpSocket *socket;
- QByteArray readBuffer;
+ QByteArray readBuffer; // only used for parsing the proxy response
QHttpSocketEngine::HttpState state;
QAuthenticator authenticator;
bool readNotificationEnabled;
diff --git a/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h b/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h
index e319389..e0033be 100644
--- a/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h
+++ b/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h
@@ -68,7 +68,7 @@ class Q_OPENGL_EXPORT QGLCustomShaderStage
public:
QGLCustomShaderStage();
virtual ~QGLCustomShaderStage();
- virtual void setUniforms(QGLShaderProgram*) = 0;
+ virtual void setUniforms(QGLShaderProgram*) {}
void setUniformsDirty();
diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
index 8a8f483..326ea1f 100644
--- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
+++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
@@ -170,13 +170,15 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context)
source.append(qShaderSnippets[MainVertexShader]);
source.append(qShaderSnippets[PositionOnlyVertexShader]);
vertexShader = new QGLShader(QGLShader::Vertex, context, this);
- vertexShader->compileSourceCode(source);
+ if (!vertexShader->compileSourceCode(source))
+ qWarning("Vertex shader for simpleShaderProg (MainVertexShader & PositionOnlyVertexShader) failed to compile");
source.clear();
source.append(qShaderSnippets[MainFragmentShader]);
source.append(qShaderSnippets[ShockingPinkSrcFragmentShader]);
fragShader = new QGLShader(QGLShader::Fragment, context, this);
- fragShader->compileSourceCode(source);
+ if (!fragShader->compileSourceCode(source))
+ qWarning("Fragment shader for simpleShaderProg (MainFragmentShader & ShockingPinkSrcFragmentShader) failed to compile");
simpleShaderProg = new QGLShaderProgram(context, this);
simpleShaderProg->addShader(vertexShader);
@@ -193,13 +195,15 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context)
source.append(qShaderSnippets[MainWithTexCoordsVertexShader]);
source.append(qShaderSnippets[UntransformedPositionVertexShader]);
vertexShader = new QGLShader(QGLShader::Vertex, context, this);
- vertexShader->compileSourceCode(source);
+ if (!vertexShader->compileSourceCode(source))
+ qWarning("Vertex shader for blitShaderProg (MainWithTexCoordsVertexShader & UntransformedPositionVertexShader) failed to compile");
source.clear();
source.append(qShaderSnippets[MainFragmentShader]);
source.append(qShaderSnippets[ImageSrcFragmentShader]);
fragShader = new QGLShader(QGLShader::Fragment, context, this);
- fragShader->compileSourceCode(source);
+ if (!fragShader->compileSourceCode(source))
+ qWarning("Fragment shader for blitShaderProg (MainFragmentShader & ImageSrcFragmentShader) failed to compile");
blitShaderProg = new QGLShaderProgram(context, this);
blitShaderProg->addShader(vertexShader);
@@ -214,6 +218,23 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context)
}
+QGLEngineSharedShaders::~QGLEngineSharedShaders()
+{
+ QList<QGLEngineShaderProg*>::iterator itr;
+ for (itr = cachedPrograms.begin(); itr != cachedPrograms.end(); ++itr)
+ delete *itr;
+
+ if (blitShaderProg) {
+ delete blitShaderProg;
+ blitShaderProg = 0;
+ }
+
+ if (simpleShaderProg) {
+ delete simpleShaderProg;
+ simpleShaderProg = 0;
+ }
+}
+
#if defined (QT_DEBUG)
QByteArray QGLEngineSharedShaders::snippetNameStr(SnippetName name)
{
@@ -234,84 +255,95 @@ QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineS
}
}
- QByteArray source;
- source.append(qShaderSnippets[prog.mainFragShader]);
- source.append(qShaderSnippets[prog.srcPixelFragShader]);
- if (prog.srcPixelFragShader == CustomImageSrcFragmentShader)
- source.append(prog.customStageSource);
- if (prog.compositionFragShader)
- source.append(qShaderSnippets[prog.compositionFragShader]);
- if (prog.maskFragShader)
- source.append(qShaderSnippets[prog.maskFragShader]);
- QGLShader* fragShader = new QGLShader(QGLShader::Fragment, ctxGuard.context(), this);
- fragShader->compileSourceCode(source);
-
- source.clear();
- source.append(qShaderSnippets[prog.mainVertexShader]);
- source.append(qShaderSnippets[prog.positionVertexShader]);
- QGLShader* vertexShader = new QGLShader(QGLShader::Vertex, ctxGuard.context(), this);
- vertexShader->compileSourceCode(source);
+ QGLShader *vertexShader = 0;
+ QGLShader *fragShader = 0;
+ QGLEngineShaderProg *newProg = 0;
+ bool success = false;
+
+ do {
+ QByteArray source;
+ source.append(qShaderSnippets[prog.mainFragShader]);
+ source.append(qShaderSnippets[prog.srcPixelFragShader]);
+ if (prog.srcPixelFragShader == CustomImageSrcFragmentShader)
+ source.append(prog.customStageSource);
+ if (prog.compositionFragShader)
+ source.append(qShaderSnippets[prog.compositionFragShader]);
+ if (prog.maskFragShader)
+ source.append(qShaderSnippets[prog.maskFragShader]);
+ fragShader = new QGLShader(QGLShader::Fragment, ctxGuard.context(), this);
+ QByteArray description;
+#if defined(QT_DEBUG)
+ // Name the shader for easier debugging
+ description.append("Fragment shader: main=");
+ description.append(snippetNameStr(prog.mainFragShader));
+ description.append(", srcPixel=");
+ description.append(snippetNameStr(prog.srcPixelFragShader));
+ if (prog.compositionFragShader) {
+ description.append(", composition=");
+ description.append(snippetNameStr(prog.compositionFragShader));
+ }
+ if (prog.maskFragShader) {
+ description.append(", mask=");
+ description.append(snippetNameStr(prog.maskFragShader));
+ }
+ fragShader->setObjectName(QString::fromLatin1(description));
+#endif
+ if (!fragShader->compileSourceCode(source)) {
+ qWarning() << "Warning:" << description << "failed to compile!";
+ break;
+ }
+ source.clear();
+ source.append(qShaderSnippets[prog.mainVertexShader]);
+ source.append(qShaderSnippets[prog.positionVertexShader]);
+ vertexShader = new QGLShader(QGLShader::Vertex, ctxGuard.context(), this);
#if defined(QT_DEBUG)
- // Name the shaders for easier debugging
- QByteArray description;
- description.append("Fragment shader: main=");
- description.append(snippetNameStr(prog.mainFragShader));
- description.append(", srcPixel=");
- description.append(snippetNameStr(prog.srcPixelFragShader));
- if (prog.compositionFragShader) {
- description.append(", composition=");
- description.append(snippetNameStr(prog.compositionFragShader));
- }
- if (prog.maskFragShader) {
- description.append(", mask=");
- description.append(snippetNameStr(prog.maskFragShader));
- }
- fragShader->setObjectName(QString::fromLatin1(description));
-
- description.clear();
- description.append("Vertex shader: main=");
- description.append(snippetNameStr(prog.mainVertexShader));
- description.append(", position=");
- description.append(snippetNameStr(prog.positionVertexShader));
- vertexShader->setObjectName(QString::fromLatin1(description));
+ // Name the shader for easier debugging
+ description.clear();
+ description.append("Vertex shader: main=");
+ description.append(snippetNameStr(prog.mainVertexShader));
+ description.append(", position=");
+ description.append(snippetNameStr(prog.positionVertexShader));
+ vertexShader->setObjectName(QString::fromLatin1(description));
#endif
+ if (!vertexShader->compileSourceCode(source)) {
+ qWarning() << "Warning:" << description << "failed to compile!";
+ break;
+ }
- QGLEngineShaderProg* newProg = new QGLEngineShaderProg(prog);
-
- // If the shader program's not found in the cache, create it now.
- newProg->program = new QGLShaderProgram(ctxGuard.context(), this);
- newProg->program->addShader(vertexShader);
- newProg->program->addShader(fragShader);
-
- // We have to bind the vertex attribute names before the program is linked:
- newProg->program->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR);
- if (newProg->useTextureCoords)
- newProg->program->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR);
- if (newProg->useOpacityAttribute)
- newProg->program->bindAttributeLocation("opacityArray", QT_OPACITY_ATTR);
-
- newProg->program->link();
- if (!newProg->program->isLinked()) {
- QLatin1String none("none");
- QLatin1String br("\n");
- QString error;
- error = QLatin1String("Shader program failed to link,")
+ newProg = new QGLEngineShaderProg(prog);
+
+ // If the shader program's not found in the cache, create it now.
+ newProg->program = new QGLShaderProgram(ctxGuard.context(), this);
+ newProg->program->addShader(vertexShader);
+ newProg->program->addShader(fragShader);
+
+ // We have to bind the vertex attribute names before the program is linked:
+ newProg->program->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR);
+ if (newProg->useTextureCoords)
+ newProg->program->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR);
+ if (newProg->useOpacityAttribute)
+ newProg->program->bindAttributeLocation("opacityArray", QT_OPACITY_ATTR);
+
+ newProg->program->link();
+ if (!newProg->program->isLinked()) {
+ QLatin1String none("none");
+ QLatin1String br("\n");
+ QString error;
+ error = QLatin1String("Shader program failed to link,")
#if defined(QT_DEBUG)
- + br
- + QLatin1String(" Shaders Used:") + br
- + QLatin1String(" ") + vertexShader->objectName() + QLatin1String(": ") + br
- + QLatin1String(vertexShader->sourceCode()) + br
- + QLatin1String(" ") + fragShader->objectName() + QLatin1String(": ") + br
- + QLatin1String(fragShader->sourceCode()) + br
+ + br
+ + QLatin1String(" Shaders Used:") + br
+ + QLatin1String(" ") + vertexShader->objectName() + QLatin1String(": ") + br
+ + QLatin1String(vertexShader->sourceCode()) + br
+ + QLatin1String(" ") + fragShader->objectName() + QLatin1String(": ") + br
+ + QLatin1String(fragShader->sourceCode()) + br
#endif
- + QLatin1String(" Error Log:\n")
- + QLatin1String(" ") + newProg->program->log();
- qWarning() << error;
- delete newProg; // Deletes the QGLShaderProgram in it's destructor
- newProg = 0;
- }
- else {
+ + QLatin1String(" Error Log:\n")
+ + QLatin1String(" ") + newProg->program->log();
+ qWarning() << error;
+ break;
+ }
if (cachedPrograms.count() > 30) {
// The cache is full, so delete the last 5 programs in the list.
// These programs will be least used, as a program us bumped to
@@ -323,6 +355,22 @@ QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineS
}
cachedPrograms.insert(0, newProg);
+
+ success = true;
+ } while (false);
+
+ // Clean up everything if we weren't successful
+ if (!success) {
+ if (newProg) {
+ delete newProg; // Also deletes the QGLShaderProgram which in turn deletes the QGLShaders
+ newProg = 0;
+ }
+ else {
+ if (vertexShader)
+ delete vertexShader;
+ if (fragShader)
+ delete fragShader;
+ }
}
return newProg;
@@ -362,8 +410,11 @@ QGLEngineShaderManager::~QGLEngineShaderManager()
removeCustomStage();
}
-uint QGLEngineShaderManager::getUniformLocation(Uniform id)
+GLuint QGLEngineShaderManager::getUniformLocation(Uniform id)
{
+ if (!currentShaderProg)
+ return 0;
+
QVector<uint> &uniformLocations = currentShaderProg->uniformLocations;
if (uniformLocations.isEmpty())
uniformLocations.fill(GLuint(-1), NumUniforms);
@@ -394,9 +445,9 @@ uint QGLEngineShaderManager::getUniformLocation(Uniform id)
}
-void QGLEngineShaderManager::optimiseForBrushTransform(const QTransform &transform)
+void QGLEngineShaderManager::optimiseForBrushTransform(QTransform::TransformationType transformType)
{
- Q_UNUSED(transform); // Currently ignored
+ Q_UNUSED(transformType); // Currently ignored
}
void QGLEngineShaderManager::setDirty()
@@ -406,6 +457,7 @@ void QGLEngineShaderManager::setDirty()
void QGLEngineShaderManager::setSrcPixelType(Qt::BrushStyle style)
{
+ Q_ASSERT(style != Qt::NoBrush);
if (srcPixelType == PixelSrcType(style))
return;
@@ -467,7 +519,30 @@ void QGLEngineShaderManager::removeCustomStage()
QGLShaderProgram* QGLEngineShaderManager::currentProgram()
{
- return currentShaderProg->program;
+ if (currentShaderProg)
+ return currentShaderProg->program;
+ else
+ return sharedShaders->simpleProgram();
+}
+
+void QGLEngineShaderManager::useSimpleProgram()
+{
+ sharedShaders->simpleProgram()->bind();
+ QGLContextPrivate* ctx_d = ctx->d_func();
+ ctx_d->setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, true);
+ ctx_d->setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, false);
+ ctx_d->setVertexAttribArrayEnabled(QT_OPACITY_ATTR, false);
+ shaderProgNeedsChanging = true;
+}
+
+void QGLEngineShaderManager::useBlitProgram()
+{
+ sharedShaders->blitProgram()->bind();
+ QGLContextPrivate* ctx_d = ctx->d_func();
+ ctx_d->setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, true);
+ ctx_d->setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, true);
+ ctx_d->setVertexAttribArrayEnabled(QT_OPACITY_ATTR, false);
+ shaderProgNeedsChanging = true;
}
QGLShaderProgram* QGLEngineShaderManager::simpleProgram()
@@ -678,6 +753,13 @@ bool QGLEngineShaderManager::useCorrectShaderProg()
customSrcStage->setUniforms(currentShaderProg->program);
}
+ // Make sure all the vertex attribute arrays the program uses are enabled (and the ones it
+ // doesn't use are disabled)
+ QGLContextPrivate* ctx_d = ctx->d_func();
+ ctx_d->setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, true);
+ ctx_d->setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, currentShaderProg->useTextureCoords);
+ ctx_d->setVertexAttribArrayEnabled(QT_OPACITY_ATTR, currentShaderProg->useOpacityAttribute);
+
shaderProgNeedsChanging = false;
return true;
}
diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
index 50c1432..a3464d4 100644
--- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
+++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
@@ -344,6 +344,7 @@ public:
*/
QGLEngineSharedShaders(const QGLContext *context);
+ ~QGLEngineSharedShaders();
QGLShaderProgram *simpleProgram() { return simpleShaderProg; }
QGLShaderProgram *blitProgram() { return blitShaderProg; }
@@ -454,7 +455,7 @@ public:
// There are optimisations we can do, depending on the brush transform:
// 1) May not have to apply perspective-correction
// 2) Can use lower precision for matrix
- void optimiseForBrushTransform(const QTransform &transform);
+ void optimiseForBrushTransform(QTransform::TransformationType transformType);
void setSrcPixelType(Qt::BrushStyle);
void setSrcPixelType(PixelSrcType); // For non-brush sources, like pixmaps & images
void setOpacityMode(OpacityMode);
@@ -463,11 +464,14 @@ public:
void setCustomStage(QGLCustomShaderStage* stage);
void removeCustomStage();
- uint getUniformLocation(Uniform id);
+ GLuint getUniformLocation(Uniform id);
void setDirty(); // someone has manually changed the current shader program
bool useCorrectShaderProg(); // returns true if the shader program needed to be changed
+ void useSimpleProgram();
+ void useBlitProgram();
+
QGLShaderProgram* currentProgram(); // Returns pointer to the shader the manager has chosen
QGLShaderProgram* simpleProgram(); // Used to draw into e.g. stencil buffers
QGLShaderProgram* blitProgram(); // Used to blit a texture into the framebuffer
diff --git a/src/opengl/gl2paintengineex/qglengineshadersource_p.h b/src/opengl/gl2paintengineex/qglengineshadersource_p.h
index 2407979..46de124 100644
--- a/src/opengl/gl2paintengineex/qglengineshadersource_p.h
+++ b/src/opengl/gl2paintengineex/qglengineshadersource_p.h
@@ -99,12 +99,15 @@ static const char* const qglslMainWithTexCoordsAndOpacityVertexShader = "\
opacity = opacityArray; \
}";
+// NOTE: We let GL do the perspective correction so texture lookups in the fragment
+// shader are also perspective corrected.
static const char* const qglslPositionOnlyVertexShader = "\
- attribute highp vec4 vertexCoordsArray;\
- uniform highp mat4 pmvMatrix;\
+ attribute highp vec2 vertexCoordsArray;\
+ uniform highp mat3 pmvMatrix;\
void setPosition(void)\
{\
- gl_Position = pmvMatrix * vertexCoordsArray;\
+ vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \
+ gl_Position = vec4(transformedPos.xy, 0.0, transformedPos.z); \
}";
static const char* const qglslUntransformedPositionVertexShader = "\
@@ -116,20 +119,19 @@ static const char* const qglslUntransformedPositionVertexShader = "\
// Pattern Brush - This assumes the texture size is 8x8 and thus, the inverted size is 0.125
static const char* const qglslPositionWithPatternBrushVertexShader = "\
- attribute highp vec4 vertexCoordsArray; \
- uniform highp mat4 pmvMatrix; \
+ attribute highp vec2 vertexCoordsArray; \
+ uniform highp mat3 pmvMatrix; \
uniform mediump vec2 halfViewportSize; \
uniform highp vec2 invertedTextureSize; \
uniform highp mat3 brushTransform; \
varying highp vec2 patternTexCoords; \
void setPosition(void) { \
- gl_Position = pmvMatrix * vertexCoordsArray;\
- gl_Position.xy = gl_Position.xy / gl_Position.w; \
+ vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \
+ gl_Position.xy = transformedPos.xy / transformedPos.z; \
mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \
- mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \
+ mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1.0); \
mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \
- gl_Position.xy = gl_Position.xy * invertedHTexCoordsZ; \
- gl_Position.w = invertedHTexCoordsZ; \
+ gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \
patternTexCoords.xy = (hTexCoords.xy * 0.125) * invertedHTexCoordsZ; \
}";
@@ -147,20 +149,19 @@ static const char* const qglslPatternBrushSrcFragmentShader = "\
// Linear Gradient Brush
static const char* const qglslPositionWithLinearGradientBrushVertexShader = "\
- attribute highp vec4 vertexCoordsArray; \
- uniform highp mat4 pmvMatrix; \
+ attribute highp vec2 vertexCoordsArray; \
+ uniform highp mat3 pmvMatrix; \
uniform mediump vec2 halfViewportSize; \
uniform highp vec3 linearData; \
uniform highp mat3 brushTransform; \
varying mediump float index; \
void setPosition() { \
- gl_Position = pmvMatrix * vertexCoordsArray;\
- gl_Position.xy = gl_Position.xy / gl_Position.w; \
+ vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \
+ gl_Position.xy = transformedPos.xy / transformedPos.z; \
mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \
mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \
mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \
- gl_Position.xy = gl_Position.xy * invertedHTexCoordsZ; \
- gl_Position.w = invertedHTexCoordsZ; \
+ gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \
index = (dot(linearData.xy, hTexCoords.xy) * linearData.z) * invertedHTexCoordsZ; \
}";
@@ -178,20 +179,19 @@ static const char* const qglslLinearGradientBrushSrcFragmentShader = "\
// Conical Gradient Brush
static const char* const qglslPositionWithConicalGradientBrushVertexShader = "\
- attribute highp vec4 vertexCoordsArray;\
- uniform highp mat4 pmvMatrix;\
+ attribute highp vec2 vertexCoordsArray;\
+ uniform highp mat3 pmvMatrix;\
uniform mediump vec2 halfViewportSize; \
uniform highp mat3 brushTransform; \
varying highp vec2 A; \
void setPosition(void)\
{\
- gl_Position = pmvMatrix * vertexCoordsArray;\
- gl_Position.xy = gl_Position.xy / gl_Position.w; \
+ vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \
+ gl_Position.xy = transformedPos.xy / transformedPos.z; \
mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \
mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \
mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \
- gl_Position.xy = gl_Position.xy * invertedHTexCoordsZ; \
- gl_Position.w = invertedHTexCoordsZ; \
+ gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \
A = hTexCoords.xy * invertedHTexCoordsZ; \
}";
@@ -215,8 +215,8 @@ static const char* const qglslConicalGradientBrushSrcFragmentShader = "\n\
// Radial Gradient Brush
static const char* const qglslPositionWithRadialGradientBrushVertexShader = "\
- attribute highp vec4 vertexCoordsArray;\
- uniform highp mat4 pmvMatrix;\
+ attribute highp vec2 vertexCoordsArray;\
+ uniform highp mat3 pmvMatrix;\
uniform mediump vec2 halfViewportSize; \
uniform highp mat3 brushTransform; \
uniform highp vec2 fmp; \
@@ -224,13 +224,12 @@ static const char* const qglslPositionWithRadialGradientBrushVertexShader = "\
varying highp vec2 A; \
void setPosition(void) \
{\
- gl_Position = pmvMatrix * vertexCoordsArray;\
- gl_Position.xy = gl_Position.xy / gl_Position.w; \
+ vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \
+ gl_Position.xy = transformedPos.xy / transformedPos.z; \
mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \
mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \
mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \
- gl_Position.xy = gl_Position.xy * invertedHTexCoordsZ; \
- gl_Position.w = invertedHTexCoordsZ; \
+ gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \
A = hTexCoords.xy * invertedHTexCoordsZ; \
b = 2.0 * dot(A, fmp); \
}";
@@ -253,20 +252,19 @@ static const char* const qglslRadialGradientBrushSrcFragmentShader = "\
// Texture Brush
static const char* const qglslPositionWithTextureBrushVertexShader = "\
- attribute highp vec4 vertexCoordsArray; \
- uniform highp mat4 pmvMatrix; \
+ attribute highp vec2 vertexCoordsArray; \
+ uniform highp mat3 pmvMatrix; \
uniform mediump vec2 halfViewportSize; \
uniform highp vec2 invertedTextureSize; \
uniform highp mat3 brushTransform; \
varying highp vec2 textureCoords; \
void setPosition(void) { \
- gl_Position = pmvMatrix * vertexCoordsArray;\
- gl_Position.xy = gl_Position.xy / gl_Position.w; \
+ vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \
+ gl_Position.xy = transformedPos.xy / transformedPos.z; \
mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \
mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \
mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \
- gl_Position.xy = gl_Position.xy * invertedHTexCoordsZ; \
- gl_Position.w = invertedHTexCoordsZ; \
+ gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \
textureCoords.xy = (hTexCoords.xy * invertedTextureSize) * gl_Position.w; \
}";
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 3fce384..5901601 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -75,15 +75,14 @@
#include <QPaintEngine>
#include <private/qpainter_p.h>
#include <private/qfontengine_p.h>
-#include <private/qtextureglyphcache_p.h>
#include <private/qpixmapdata_gl_p.h>
#include <private/qdatabuffer_p.h>
#include "qglgradientcache_p.h"
#include "qglengineshadermanager_p.h"
#include "qgl2pexvertexarray_p.h"
-
#include "qtriangulatingstroker_p.h"
+#include "qtextureglyphcache_gl_p.h"
#include <QDebug>
@@ -91,254 +90,6 @@ QT_BEGIN_NAMESPACE
//#define QT_GL_NO_SCISSOR_TEST
-static const GLuint GL_STENCIL_HIGH_BIT = 0x80;
-static const GLuint QT_BRUSH_TEXTURE_UNIT = 0;
-static const GLuint QT_IMAGE_TEXTURE_UNIT = 0; //Can be the same as brush texture unit
-static const GLuint QT_MASK_TEXTURE_UNIT = 1;
-static const GLuint QT_BACKGROUND_TEXTURE_UNIT = 2;
-
-#ifdef Q_WS_WIN
-extern Q_GUI_EXPORT bool qt_cleartype_enabled;
-#endif
-
-class QGLTextureGlyphCache : public QObject, public QTextureGlyphCache
-{
- Q_OBJECT
-public:
- QGLTextureGlyphCache(QGLContext *context, QFontEngineGlyphCache::Type type, const QTransform &matrix);
- ~QGLTextureGlyphCache();
-
- virtual void createTextureData(int width, int height);
- virtual void resizeTextureData(int width, int height);
- virtual void fillTexture(const Coord &c, glyph_t glyph);
- virtual int glyphMargin() const;
-
- inline GLuint texture() const { return m_texture; }
-
- inline int width() const { return m_width; }
- inline int height() const { return m_height; }
-
- inline void setPaintEnginePrivate(QGL2PaintEngineExPrivate *p) { pex = p; }
-
-
-public Q_SLOTS:
- void contextDestroyed(const QGLContext *context) {
- if (context == ctx) {
- QList<const QGLContext *> shares = qgl_share_reg()->shares(ctx);
- if (shares.isEmpty()) {
- glDeleteFramebuffers(1, &m_fbo);
- if (m_width || m_height)
- glDeleteTextures(1, &m_texture);
- ctx = 0;
- } else {
- // since the context holding the texture is shared, and
- // about to be destroyed, we have to transfer ownership
- // of the texture to one of the share contexts
- ctx = const_cast<QGLContext *>((ctx == shares.at(0)) ? shares.at(1) : shares.at(0));
- }
- }
- }
-
-private:
- QGLContext *ctx;
-
- QGL2PaintEngineExPrivate *pex;
-
- GLuint m_texture;
- GLuint m_fbo;
-
- int m_width;
- int m_height;
-
- QGLShaderProgram *m_program;
-};
-
-QGLTextureGlyphCache::QGLTextureGlyphCache(QGLContext *context, QFontEngineGlyphCache::Type type, const QTransform &matrix)
- : QTextureGlyphCache(type, matrix)
- , ctx(context)
- , m_width(0)
- , m_height(0)
-{
- glGenFramebuffers(1, &m_fbo);
- connect(QGLSignalProxy::instance(), SIGNAL(aboutToDestroyContext(const QGLContext*)),
- SLOT(contextDestroyed(const QGLContext*)));
-}
-
-QGLTextureGlyphCache::~QGLTextureGlyphCache()
-{
- if (ctx) {
- QGLShareContextScope scope(ctx);
- glDeleteFramebuffers(1, &m_fbo);
-
- if (m_width || m_height)
- glDeleteTextures(1, &m_texture);
- }
-}
-
-void QGLTextureGlyphCache::createTextureData(int width, int height)
-{
- glGenTextures(1, &m_texture);
- glBindTexture(GL_TEXTURE_2D, m_texture);
-
- m_width = width;
- m_height = height;
-
- QVarLengthArray<uchar> data(width * height);
- for (int i = 0; i < data.size(); ++i)
- data[i] = 0;
-
- if (m_type == QFontEngineGlyphCache::Raster_RGBMask)
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, &data[0]);
- else
- glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, &data[0]);
-
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-}
-
-void QGLTextureGlyphCache::resizeTextureData(int width, int height)
-{
- // ### the QTextureGlyphCache API needs to be reworked to allow
- // ### resizeTextureData to fail
-
- int oldWidth = m_width;
- int oldHeight = m_height;
-
- GLuint oldTexture = m_texture;
- createTextureData(width, height);
-
- glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_fbo);
-
- GLuint tmp_texture;
- glGenTextures(1, &tmp_texture);
- glBindTexture(GL_TEXTURE_2D, tmp_texture);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, oldWidth, oldHeight, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, NULL);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glBindTexture(GL_TEXTURE_2D, 0);
- glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
- GL_TEXTURE_2D, tmp_texture, 0);
-
- glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT);
- glBindTexture(GL_TEXTURE_2D, oldTexture);
-
- pex->transferMode(BrushDrawingMode);
-
-#ifndef QT_OPENGL_ES_2
- if (pex->inRenderText)
- glPushAttrib(GL_ENABLE_BIT | GL_VIEWPORT_BIT | GL_SCISSOR_BIT);
-#endif
-
- glDisable(GL_STENCIL_TEST);
- glDisable(GL_DEPTH_TEST);
- glDisable(GL_SCISSOR_TEST);
- glDisable(GL_BLEND);
-
- glViewport(0, 0, oldWidth, oldHeight);
-
- float vertexCoordinateArray[] = { -1, -1, 1, -1, 1, 1, -1, 1 };
- float textureCoordinateArray[] = { 0, 0, 1, 0, 1, 1, 0, 1 };
-
- glEnableVertexAttribArray(QT_VERTEX_COORDS_ATTR);
- glEnableVertexAttribArray(QT_TEXTURE_COORDS_ATTR);
-
- glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, vertexCoordinateArray);
- glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, textureCoordinateArray);
-
- pex->shaderManager->blitProgram()->bind();
- pex->shaderManager->blitProgram()->setUniformValue("imageTexture", QT_IMAGE_TEXTURE_UNIT);
- pex->shaderManager->setDirty();
-
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
-
- glDisableVertexAttribArray(QT_VERTEX_COORDS_ATTR);
- glDisableVertexAttribArray(QT_TEXTURE_COORDS_ATTR);
-
- glBindTexture(GL_TEXTURE_2D, m_texture);
-
-#ifdef QT_OPENGL_ES_2
- QDataBuffer<uchar> buffer(4*oldWidth*oldHeight);
- buffer.resize(4*oldWidth*oldHeight);
- glReadPixels(0, 0, oldWidth, oldHeight, GL_RGBA, GL_UNSIGNED_BYTE, buffer.data());
-
- // do an in-place conversion from GL_RGBA to GL_ALPHA
- for (int i=0; i<oldWidth*oldHeight; ++i)
- buffer.data()[i] = buffer.at(4*i + 3);
-
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, oldWidth, oldHeight,
- GL_ALPHA, GL_UNSIGNED_BYTE, buffer.data());
-#else
- glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, oldWidth, oldHeight);
-#endif
-
- glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
- GL_RENDERBUFFER_EXT, 0);
- glDeleteTextures(1, &tmp_texture);
- glDeleteTextures(1, &oldTexture);
-
- glBindFramebuffer(GL_FRAMEBUFFER_EXT, ctx->d_ptr->current_fbo);
-
- glViewport(0, 0, pex->width, pex->height);
- pex->updateClipScissorTest();
-
-#ifndef QT_OPENGL_ES_2
- if (pex->inRenderText)
- glPopAttrib();
-#endif
-}
-
-void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph)
-{
- QImage mask = textureMapForGlyph(glyph);
- const int maskWidth = mask.width();
- const int maskHeight = mask.height();
-
- if (mask.format() == QImage::Format_Mono) {
- mask = mask.convertToFormat(QImage::Format_Indexed8);
- for (int y = 0; y < maskHeight; ++y) {
- uchar *src = (uchar *) mask.scanLine(y);
- for (int x = 0; x < maskWidth; ++x)
- src[x] = -src[x]; // convert 0 and 1 into 0 and 255
- }
- }
-
-
- glBindTexture(GL_TEXTURE_2D, m_texture);
- if (mask.format() == QImage::Format_RGB32) {
- glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, GL_BGRA, GL_UNSIGNED_BYTE, mask.bits());
- } else {
-#ifdef QT_OPENGL_ES2
- glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, GL_ALPHA, GL_UNSIGNED_BYTE, mask.bits());
-#else
- // glTexSubImage2D() might cause some garbage to appear in the texture if the mask width is
- // not a multiple of four bytes. The bug appeared on a computer with 32-bit Windows Vista
- // and nVidia GeForce 8500GT. GL_UNPACK_ALIGNMENT is set to four bytes, 'mask' has a
- // multiple of four bytes per line, and most of the glyph shows up correctly in the
- // texture, which makes me think that this is a driver bug.
- // One workaround is to make sure the mask width is a multiple of four bytes, for instance
- // by converting it to a format with four bytes per pixel. Another is to copy one line at a
- // time.
-
- for (int i = 0; i < maskHeight; ++i)
- glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y + i, maskWidth, 1, GL_ALPHA, GL_UNSIGNED_BYTE, mask.scanLine(i));
-#endif
- }
-}
-
-int QGLTextureGlyphCache::glyphMargin() const
-{
-#if defined(Q_WS_MAC)
- return 2;
-#elif defined (Q_WS_X11)
- return 0;
-#else
- return m_type == QFontEngineGlyphCache::Raster_RGBMask ? 2 : 0;
-#endif
-}
-
extern QImage qt_imageForBrush(int brushStyle, bool invert);
////////////////////////////////// Private Methods //////////////////////////////////////////
@@ -358,10 +109,10 @@ QGL2PaintEngineExPrivate::~QGL2PaintEngineExPrivate()
void QGL2PaintEngineExPrivate::updateTextureFilter(GLenum target, GLenum wrapMode, bool smoothPixmapTransform, GLuint id)
{
// glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); //### Is it always this texture unit?
- if (id != GLuint(-1) && id == lastTexture)
+ if (id != GLuint(-1) && id == lastTextureUsed)
return;
- lastTexture = id;
+ lastTextureUsed = id;
if (smoothPixmapTransform) {
glTexParameterf(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@@ -386,32 +137,41 @@ inline QColor qt_premultiplyColor(QColor c, GLfloat opacity)
}
-void QGL2PaintEngineExPrivate::setBrush(const QBrush* brush)
+void QGL2PaintEngineExPrivate::setBrush(const QBrush& brush)
{
+ if (qbrush_fast_equals(currentBrush, brush))
+ return;
+
+ const Qt::BrushStyle newStyle = qbrush_style(brush);
+ Q_ASSERT(newStyle != Qt::NoBrush);
+
currentBrush = brush;
- brushTextureDirty = true;
- brushUniformsDirty = true;
- if (currentBrush->style() == Qt::TexturePattern
- && qHasPixmapTexture(*brush) && brush->texture().isQBitmap())
+ brushUniformsDirty = true; // All brushes have at least one uniform
+
+ if (newStyle > Qt::SolidPattern)
+ brushTextureDirty = true;
+
+ if (currentBrush.style() == Qt::TexturePattern
+ && qHasPixmapTexture(brush) && brush.texture().isQBitmap())
{
shaderManager->setSrcPixelType(QGLEngineShaderManager::TextureSrcWithPattern);
} else {
- shaderManager->setSrcPixelType(currentBrush->style());
+ shaderManager->setSrcPixelType(newStyle);
}
- shaderManager->optimiseForBrushTransform(currentBrush->transform());
+ shaderManager->optimiseForBrushTransform(currentBrush.transform().type());
}
void QGL2PaintEngineExPrivate::useSimpleShader()
{
- shaderManager->simpleProgram()->bind();
- shaderManager->setDirty();
+ shaderManager->useSimpleProgram();
if (matrixDirty)
updateMatrix();
if (simpleShaderMatrixUniformDirty) {
- shaderManager->simpleProgram()->setUniformValue("pmvMatrix", pmvMatrix);
+ const GLuint location = shaderManager->simpleProgram()->uniformLocation("pmvMatrix");
+ glUniformMatrix3fv(location, 1, GL_FALSE, (GLfloat*)pmvMatrix);
simpleShaderMatrixUniformDirty = false;
}
}
@@ -420,7 +180,7 @@ void QGL2PaintEngineExPrivate::updateBrushTexture()
{
Q_Q(QGL2PaintEngineEx);
// qDebug("QGL2PaintEngineExPrivate::updateBrushTexture()");
- Qt::BrushStyle style = currentBrush->style();
+ Qt::BrushStyle style = currentBrush.style();
if ( (style >= Qt::Dense1Pattern) && (style <= Qt::DiagCrossPattern) ) {
// Get the image data for the pattern
@@ -433,7 +193,7 @@ void QGL2PaintEngineExPrivate::updateBrushTexture()
else if (style >= Qt::LinearGradientPattern && style <= Qt::ConicalGradientPattern) {
// Gradiant brush: All the gradiants use the same texture
- const QGradient* g = currentBrush->gradient();
+ const QGradient* g = currentBrush.gradient();
// We apply global opacity in the fragment shaders, so we always pass 1.0
// for opacity to the cache.
@@ -450,7 +210,7 @@ void QGL2PaintEngineExPrivate::updateBrushTexture()
updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, q->state()->renderHints & QPainter::SmoothPixmapTransform);
}
else if (style == Qt::TexturePattern) {
- const QPixmap& texPixmap = currentBrush->texture();
+ const QPixmap& texPixmap = currentBrush.texture();
glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT);
QGLTexture *tex = ctx->d_func()->bindTexture(texPixmap, GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption);
@@ -464,15 +224,15 @@ void QGL2PaintEngineExPrivate::updateBrushTexture()
void QGL2PaintEngineExPrivate::updateBrushUniforms()
{
// qDebug("QGL2PaintEngineExPrivate::updateBrushUniforms()");
- Qt::BrushStyle style = currentBrush->style();
+ Qt::BrushStyle style = currentBrush.style();
if (style == Qt::NoBrush)
return;
- QTransform brushQTransform = currentBrush->transform();
+ QTransform brushQTransform = currentBrush.transform();
if (style == Qt::SolidPattern) {
- QColor col = qt_premultiplyColor(currentBrush->color(), (GLfloat)q->state()->opacity);
+ QColor col = qt_premultiplyColor(currentBrush.color(), (GLfloat)q->state()->opacity);
shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::FragmentColor), col);
}
else {
@@ -480,7 +240,7 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms()
QPointF translationPoint;
if (style <= Qt::DiagCrossPattern) {
- QColor col = qt_premultiplyColor(currentBrush->color(), (GLfloat)q->state()->opacity);
+ QColor col = qt_premultiplyColor(currentBrush.color(), (GLfloat)q->state()->opacity);
shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PatternColor), col);
@@ -488,7 +248,7 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms()
shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::HalfViewportSize), halfViewportSize);
}
else if (style == Qt::LinearGradientPattern) {
- const QLinearGradient *g = static_cast<const QLinearGradient *>(currentBrush->gradient());
+ const QLinearGradient *g = static_cast<const QLinearGradient *>(currentBrush.gradient());
QPointF realStart = g->start();
QPointF realFinal = g->finalStop();
@@ -508,7 +268,7 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms()
shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::HalfViewportSize), halfViewportSize);
}
else if (style == Qt::ConicalGradientPattern) {
- const QConicalGradient *g = static_cast<const QConicalGradient *>(currentBrush->gradient());
+ const QConicalGradient *g = static_cast<const QConicalGradient *>(currentBrush.gradient());
translationPoint = g->center();
GLfloat angle = -(g->angle() * 2 * Q_PI) / 360.0;
@@ -519,7 +279,7 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms()
shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::HalfViewportSize), halfViewportSize);
}
else if (style == Qt::RadialGradientPattern) {
- const QRadialGradient *g = static_cast<const QRadialGradient *>(currentBrush->gradient());
+ const QRadialGradient *g = static_cast<const QRadialGradient *>(currentBrush.gradient());
QPointF realCenter = g->center();
QPointF realFocal = g->focalPoint();
qreal realRadius = g->radius();
@@ -537,10 +297,10 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms()
shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::HalfViewportSize), halfViewportSize);
}
else if (style == Qt::TexturePattern) {
- const QPixmap& texPixmap = currentBrush->texture();
+ const QPixmap& texPixmap = currentBrush.texture();
- if (qHasPixmapTexture(*currentBrush) && currentBrush->texture().isQBitmap()) {
- QColor col = qt_premultiplyColor(currentBrush->color(), (GLfloat)q->state()->opacity);
+ if (qHasPixmapTexture(currentBrush) && currentBrush.texture().isQBitmap()) {
+ QColor col = qt_premultiplyColor(currentBrush.color(), (GLfloat)q->state()->opacity);
shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PatternColor), col);
}
@@ -561,7 +321,7 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms()
QTransform gl_to_qt(1, 0, 0, -1, 0, height);
QTransform inv_matrix;
if (style == Qt::TexturePattern && textureInvertedY == -1)
- inv_matrix = gl_to_qt * (QTransform(1, 0, 0, -1, 0, currentBrush->texture().height()) * brushQTransform * matrix).inverted() * translate;
+ inv_matrix = gl_to_qt * (QTransform(1, 0, 0, -1, 0, currentBrush.texture().height()) * brushQTransform * matrix).inverted() * translate;
else
inv_matrix = gl_to_qt * (brushQTransform * matrix).inverted() * translate;
@@ -577,66 +337,59 @@ void QGL2PaintEngineExPrivate::updateMatrix()
{
// qDebug("QGL2PaintEngineExPrivate::updateMatrix()");
- // We set up the 4x4 transformation matrix on the vertex shaders to
- // be the equivalent of glOrtho(0, w, h, 0, -1, 1) * transform:
+ const QTransform& transform = q->state()->matrix;
+
+ // The projection matrix converts from Qt's coordinate system to GL's coordinate system
+ // * GL's viewport is 2x2, Qt's is width x height
+ // * GL has +y -> -y going from bottom -> top, Qt is the other way round
+ // * GL has [0,0] in the center, Qt has it in the top-left
//
- // | 2/width 0 0 -1 | | m11 m21 0 dx |
- // | 0 -2/height 0 1 | | m12 m22 0 dy |
- // | 0 0 -1 0 | * | 0 0 1 0 |
- // | 0 0 0 1 | | m13 m23 0 m33 |
+ // This results in the Projection matrix below, which is multiplied by the painter's
+ // transformation matrix, as shown below:
//
- // We expand out the multiplication to save the cost of a full 4x4
- // matrix multiplication as most of the components are trivial.
- const QTransform& transform = q->state()->matrix;
+ // Projection Matrix Painter Transform
+ // ------------------------------------------------ ------------------------
+ // | 2.0 / width | 0.0 | -1.0 | | m11 | m21 | dx |
+ // | 0.0 | -2.0 / height | 1.0 | * | m12 | m22 | dy |
+ // | 0.0 | 0.0 | 1.0 | | m13 | m23 | m33 |
+ // ------------------------------------------------ ------------------------
+ //
+ // NOTE: The resultant matrix is also transposed, as GL expects column-major matracies
+
+ const GLfloat wfactor = 2.0f / width;
+ const GLfloat hfactor = -2.0f / height;
+ GLfloat dx = transform.dx();
+ GLfloat dy = transform.dy();
+
+ // Non-integer translates can have strange effects for some rendering operations such as
+ // anti-aliased text rendering. In such cases, we snap the translate to the pixel grid.
+ if (snapToPixelGrid && transform.type() == QTransform::TxTranslate) {
+ // 0.50 needs to rounded down to 0.0 for consistency with raster engine:
+ dx = ceilf(dx - 0.5f);
+ dy = ceilf(dy - 0.5f);
+ }
- if (mode == TextDrawingMode) {
- // Text drawing mode is only used for non-scaling transforms
- pmvMatrix[0][0] = 2.0 / width;
- pmvMatrix[0][1] = 0.0;
- pmvMatrix[0][2] = 0.0;
- pmvMatrix[0][3] = 0.0;
- pmvMatrix[1][0] = 0.0;
- pmvMatrix[1][1] = -2.0 / height;
- pmvMatrix[1][2] = 0.0;
- pmvMatrix[1][3] = 0.0;
- pmvMatrix[2][0] = 0.0;
- pmvMatrix[2][1] = 0.0;
- pmvMatrix[2][2] = -1.0;
- pmvMatrix[2][3] = 0.0;
- pmvMatrix[3][0] = pmvMatrix[0][0] * qRound(transform.dx()) - 1.0;
- pmvMatrix[3][1] = pmvMatrix[1][1] * qRound(transform.dy()) + 1.0;
- pmvMatrix[3][2] = 0.0;
- pmvMatrix[3][3] = 1.0;
-
- inverseScale = 1;
- } else {
- qreal wfactor = 2.0 / width;
- qreal hfactor = -2.0 / height;
-
- pmvMatrix[0][0] = wfactor * transform.m11() - transform.m13();
- pmvMatrix[0][1] = hfactor * transform.m12() + transform.m13();
- pmvMatrix[0][2] = 0.0;
- pmvMatrix[0][3] = transform.m13();
- pmvMatrix[1][0] = wfactor * transform.m21() - transform.m23();
- pmvMatrix[1][1] = hfactor * transform.m22() + transform.m23();
- pmvMatrix[1][2] = 0.0;
- pmvMatrix[1][3] = transform.m23();
- pmvMatrix[2][0] = 0.0;
- pmvMatrix[2][1] = 0.0;
- pmvMatrix[2][2] = -1.0;
- pmvMatrix[2][3] = 0.0;
- pmvMatrix[3][0] = wfactor * transform.dx() - transform.m33();
- pmvMatrix[3][1] = hfactor * transform.dy() + transform.m33();
- pmvMatrix[3][2] = 0.0;
- pmvMatrix[3][3] = transform.m33();
-
- // 1/10000 == 0.0001, so we have good enough res to cover curves
- // that span the entire widget...
- inverseScale = qMax(1 / qMax( qMax(qAbs(transform.m11()), qAbs(transform.m22())),
- qMax(qAbs(transform.m12()), qAbs(transform.m21())) ),
- qreal(0.0001));
+ if (addOffset) {
+ dx += 0.49f;
+ dy += 0.49f;
}
+ pmvMatrix[0][0] = (wfactor * transform.m11()) - transform.m13();
+ pmvMatrix[1][0] = (wfactor * transform.m21()) - transform.m23();
+ pmvMatrix[2][0] = (wfactor * dx) - transform.m33();
+ pmvMatrix[0][1] = (hfactor * transform.m12()) + transform.m13();
+ pmvMatrix[1][1] = (hfactor * transform.m22()) + transform.m23();
+ pmvMatrix[2][1] = (hfactor * dy) + transform.m33();
+ pmvMatrix[0][2] = transform.m13();
+ pmvMatrix[1][2] = transform.m23();
+ pmvMatrix[2][2] = transform.m33();
+
+ // 1/10000 == 0.0001, so we have good enough res to cover curves
+ // that span the entire widget...
+ inverseScale = qMax(1 / qMax( qMax(qAbs(transform.m11()), qAbs(transform.m22())),
+ qMax(qAbs(transform.m12()), qAbs(transform.m21())) ),
+ qreal(0.0001));
+
matrixDirty = false;
// The actual data has been updated so both shader program's uniforms need updating
@@ -716,7 +469,19 @@ static inline void setCoords(GLfloat *coords, const QGLRect &rect)
void QGL2PaintEngineExPrivate::drawTexture(const QGLRect& dest, const QGLRect& src, const QSize &textureSize, bool opaque, bool pattern)
{
// Setup for texture drawing
+ currentBrush = noBrush;
shaderManager->setSrcPixelType(pattern ? QGLEngineShaderManager::PatternSrc : QGLEngineShaderManager::ImageSrc);
+
+ if (addOffset) {
+ addOffset = false;
+ matrixDirty = true;
+ }
+
+ if (snapToPixelGrid) {
+ snapToPixelGrid = false;
+ matrixDirty = true;
+ }
+
if (prepareForDraw(opaque))
shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::ImageTexture), QT_IMAGE_TEXTURE_UNIT);
@@ -745,6 +510,10 @@ void QGL2PaintEngineEx::beginNativePainting()
QGLContext *ctx = d->ctx;
glUseProgram(0);
+ // Disable all the vertex attribute arrays:
+ for (int i = 0; i < QT_GL_VERTEX_ARRAY_TRACKED_COUNT; ++i)
+ glDisableVertexAttribArray(i);
+
#ifndef QT_OPENGL_ES_2
// be nice to people who mix OpenGL 1.x code with QPainter commands
// by setting modelview and projection matrices to mirror the GL 1
@@ -771,7 +540,7 @@ void QGL2PaintEngineEx::beginNativePainting()
Q_UNUSED(ctx);
#endif
- d->lastTexture = GLuint(-1);
+ d->lastTextureUsed = GLuint(-1);
d->dirtyStencilRegion = QRect(0, 0, d->width, d->height);
d->resetGLState();
@@ -798,51 +567,26 @@ void QGL2PaintEngineEx::endNativePainting()
d->needsSync = true;
}
-const QGLContext *QGL2PaintEngineEx::context()
-{
- Q_D(QGL2PaintEngineEx);
- return d->ctx;
-}
-
void QGL2PaintEngineExPrivate::transferMode(EngineMode newMode)
{
if (newMode == mode)
return;
if (mode == TextDrawingMode || mode == ImageDrawingMode || mode == ImageArrayDrawingMode) {
- glDisableVertexAttribArray(QT_TEXTURE_COORDS_ATTR);
- glDisableVertexAttribArray(QT_VERTEX_COORDS_ATTR);
- glDisableVertexAttribArray(QT_OPACITY_ATTR);
-
- lastTexture = GLuint(-1);
+ lastTextureUsed = GLuint(-1);
}
- if (mode == TextDrawingMode)
- matrixDirty = true;
-
if (newMode == TextDrawingMode) {
- glEnableVertexAttribArray(QT_VERTEX_COORDS_ATTR);
- glEnableVertexAttribArray(QT_TEXTURE_COORDS_ATTR);
-
glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, vertexCoordinateArray.data());
glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, textureCoordinateArray.data());
-
- matrixDirty = true;
}
if (newMode == ImageDrawingMode) {
- glEnableVertexAttribArray(QT_VERTEX_COORDS_ATTR);
- glEnableVertexAttribArray(QT_TEXTURE_COORDS_ATTR);
-
glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, staticVertexCoordinateArray);
glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, staticTextureCoordinateArray);
}
if (newMode == ImageArrayDrawingMode) {
- glEnableVertexAttribArray(QT_VERTEX_COORDS_ATTR);
- glEnableVertexAttribArray(QT_TEXTURE_COORDS_ATTR);
- glEnableVertexAttribArray(QT_OPACITY_ATTR);
-
glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, vertexCoordinateArray.data());
glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, textureCoordinateArray.data());
glVertexAttribPointer(QT_OPACITY_ATTR, 1, GL_FLOAT, GL_FALSE, 0, opacityArray.data());
@@ -867,13 +611,14 @@ struct QGL2PEVectorPathCache
qreal iscale;
};
-void qopengl2paintengine_cleanup_vectorpath(QPaintEngineEx *engine, void *data)
+void QGL2PaintEngineExPrivate::cleanupVectorPath(QPaintEngineEx *engine, void *data)
{
QGL2PEVectorPathCache *c = (QGL2PEVectorPathCache *) data;
#ifdef QT_OPENGL_CACHE_AS_VBOS
- QGL2PaintEngineExPrivate *d = QGL2PaintEngineExPrivate::getData((QGL2PaintEngineEx *) engine);
- d->unusedVBOSToClean << c->vbo;
+ Q_ASSERT(engine->type() == QPaintEngine::OpenGL2);
+ static_cast<QGL2PaintEngineEx *>(engine)->d_func()->unusedVBOSToClean << c->vbo;
#else
+ Q_UNUSED(engine);
qFree(c->vertices);
#endif
delete c;
@@ -884,6 +629,21 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path)
{
transferMode(BrushDrawingMode);
+ const QOpenGL2PaintEngineState *s = q->state();
+ const bool newAddOffset = !(s->renderHints & QPainter::Antialiasing) &&
+ (qbrush_style(currentBrush) == Qt::SolidPattern) &&
+ !multisamplingAlwaysEnabled;
+
+ if (addOffset != newAddOffset) {
+ addOffset = newAddOffset;
+ matrixDirty = true;
+ }
+
+ if (snapToPixelGrid) {
+ snapToPixelGrid = false;
+ matrixDirty = true;
+ }
+
// Might need to call updateMatrix to re-calculate inverseScale
if (matrixDirty)
updateMatrix();
@@ -893,7 +653,7 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path)
// Check to see if there's any hints
if (path.shape() == QVectorPath::RectangleHint) {
QGLRect rect(points[0].x(), points[0].y(), points[2].x(), points[2].y());
- prepareForDraw(currentBrush->isOpaque());
+ prepareForDraw(currentBrush.isOpaque());
composite(rect);
} else if (path.isConvex()) {
@@ -919,7 +679,7 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path)
} else {
cache = new QGL2PEVectorPathCache;
cache->vertexCount = 0;
- data = const_cast<QVectorPath &>(path).addCacheData(q, cache, qopengl2paintengine_cleanup_vectorpath);
+ data = const_cast<QVectorPath &>(path).addCacheData(q, cache, cleanupVectorPath);
}
// Flatten the path at the current scale factor and fill it into the cache struct.
@@ -930,7 +690,7 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path)
int floatSizeInBytes = vertexCount * 2 * sizeof(float);
cache->vertexCount = vertexCount;
cache->primitiveType = GL_TRIANGLE_FAN;
- cache->iscale = inverseScale;
+ cache->iscale = inverseScale;
#ifdef QT_OPENGL_CACHE_AS_VBOS
glGenBuffers(1, &cache->vbo);
glBindBuffer(GL_ARRAY_BUFFER, cache->vbo);
@@ -941,8 +701,7 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path)
#endif
}
- prepareForDraw(currentBrush->isOpaque());
- glEnableVertexAttribArray(QT_VERTEX_COORDS_ATTR);
+ prepareForDraw(currentBrush.isOpaque());
#ifdef QT_OPENGL_CACHE_AS_VBOS
glBindBuffer(GL_ARRAY_BUFFER, cache->vbo);
glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, false, 0, 0);
@@ -960,7 +719,7 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path)
path.makeCacheable();
vertexCoordinateArray.clear();
vertexCoordinateArray.addPath(path, inverseScale, false);
- prepareForDraw(currentBrush->isOpaque());
+ prepareForDraw(currentBrush.isOpaque());
drawVertexArrays(vertexCoordinateArray, GL_TRIANGLE_FAN);
}
@@ -984,20 +743,11 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path)
// Pass when high bit is set, replace stencil value with 0
glStencilFunc(GL_NOTEQUAL, 0, GL_STENCIL_HIGH_BIT);
}
-
- prepareForDraw(currentBrush->isOpaque());
-
- if (inRenderText)
- prepareDepthRangeForRenderText();
+ prepareForDraw(currentBrush.isOpaque());
// Stencil the brush onto the dest buffer
composite(vertexCoordinateArray.boundingRect());
-
- if (inRenderText)
- restoreDepthRangeForRenderText();
-
glStencilMask(0);
-
updateClipScissorTest();
}
}
@@ -1036,13 +786,6 @@ void QGL2PaintEngineExPrivate::fillStencilWithVertexArray(const float *data,
useSimpleShader();
glEnable(GL_STENCIL_TEST); // For some reason, this has to happen _after_ the simple shader is use()'d
-#ifndef QT_OPENGL_ES_2
- if (inRenderText) {
- glPushAttrib(GL_ENABLE_BIT);
- glDisable(GL_DEPTH_TEST);
- }
-#endif
-
if (mode == WindingFillMode) {
Q_ASSERT(stops && !count);
if (q->state()->clipTestEnabled) {
@@ -1083,10 +826,8 @@ void QGL2PaintEngineExPrivate::fillStencilWithVertexArray(const float *data,
glStencilMask(GL_STENCIL_HIGH_BIT);
#if 0
glStencilOp(GL_KEEP, GL_KEEP, GL_INVERT); // Simply invert the stencil bit
- glEnableVertexAttribArray(QT_VERTEX_COORDS_ATTR);
glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, data);
glDrawArrays(GL_TRIANGLE_STRIP, 0, count);
- glDisableVertexAttribArray(QT_VERTEX_COORDS_ATTR);
#else
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
@@ -1096,21 +837,13 @@ void QGL2PaintEngineExPrivate::fillStencilWithVertexArray(const float *data,
} else {
glStencilFunc(GL_ALWAYS, GL_STENCIL_HIGH_BIT, 0xff);
}
- glEnableVertexAttribArray(QT_VERTEX_COORDS_ATTR);
glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, data);
glDrawArrays(GL_TRIANGLE_STRIP, 0, count);
- glDisableVertexAttribArray(QT_VERTEX_COORDS_ATTR);
#endif
}
// Enable color writes & disable stencil writes
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
-
-#ifndef QT_OPENGL_ES_2
- if (inRenderText)
- glPopAttrib();
-#endif
-
}
/*
@@ -1182,10 +915,10 @@ bool QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque)
: QGLEngineShaderManager::NoOpacity;
if (stateHasOpacity && (mode != ImageDrawingMode)) {
// Using a brush
- bool brushIsPattern = (currentBrush->style() >= Qt::Dense1Pattern) &&
- (currentBrush->style() <= Qt::DiagCrossPattern);
+ bool brushIsPattern = (currentBrush.style() >= Qt::Dense1Pattern) &&
+ (currentBrush.style() <= Qt::DiagCrossPattern);
- if ((currentBrush->style() == Qt::SolidPattern) || brushIsPattern)
+ if ((currentBrush.style() == Qt::SolidPattern) || brushIsPattern)
opacityMode = QGLEngineShaderManager::NoOpacity; // Global opacity handled by srcPixel shader
}
}
@@ -1204,7 +937,7 @@ bool QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque)
updateBrushUniforms();
if (shaderMatrixUniformDirty) {
- shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PmvMatrix), pmvMatrix);
+ glUniformMatrix3fv(location(QGLEngineShaderManager::PmvMatrix), 1, GL_FALSE, (GLfloat*)pmvMatrix);
shaderMatrixUniformDirty = false;
}
@@ -1226,12 +959,8 @@ void QGL2PaintEngineExPrivate::composite(const QGLRect& boundingRect)
boundingRect.right, boundingRect.top
};
- glEnableVertexAttribArray(QT_VERTEX_COORDS_ATTR);
glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, rectVerts);
-
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
-
- glDisableVertexAttribArray(QT_VERTEX_COORDS_ATTR);
}
// Draws the vertex array as a set of <vertexArrayStops.size()> triangle fans.
@@ -1239,7 +968,6 @@ void QGL2PaintEngineExPrivate::drawVertexArrays(const float *data, int *stops, i
GLenum primitive)
{
// Now setup the pointer to the vertex array:
- glEnableVertexAttribArray(QT_VERTEX_COORDS_ATTR);
glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, data);
int previousStop = 0;
@@ -1253,31 +981,6 @@ void QGL2PaintEngineExPrivate::drawVertexArrays(const float *data, int *stops, i
glDrawArrays(primitive, previousStop, stop - previousStop);
previousStop = stop;
}
- glDisableVertexAttribArray(QT_VERTEX_COORDS_ATTR);
-}
-
-void QGL2PaintEngineExPrivate::prepareDepthRangeForRenderText()
-{
-#ifndef QT_OPENGL_ES_2
- // Get the z translation value from the model view matrix and
- // transform it using the ortogonal projection with z-near = 0,
- // and z-far = 1, which is used in QGLWidget::renderText()
- GLdouble model[4][4];
- glGetDoublev(GL_MODELVIEW_MATRIX, &model[0][0]);
- float deviceZ = -2 * model[3][2] - 1;
-
- glGetFloatv(GL_DEPTH_RANGE, depthRange);
- float windowZ = depthRange[0] + (deviceZ + 1) * 0.5 * (depthRange[1] - depthRange[0]);
-
- glDepthRange(windowZ, windowZ);
-#endif
-}
-
-void QGL2PaintEngineExPrivate::restoreDepthRangeForRenderText()
-{
-#ifndef QT_OPENGL_ES_2
- glDepthRange(depthRange[0], depthRange[1]);
-#endif
}
/////////////////////////////////// Public Methods //////////////////////////////////////////
@@ -1295,31 +998,11 @@ void QGL2PaintEngineEx::fill(const QVectorPath &path, const QBrush &brush)
{
Q_D(QGL2PaintEngineEx);
- Qt::BrushStyle style = qbrush_style(brush);
- if (style == Qt::NoBrush)
+ if (qbrush_style(brush) == Qt::NoBrush)
return;
- if (!d->inRenderText)
- ensureActive();
-
- QOpenGL2PaintEngineState *s = state();
- bool doOffset = !(s->renderHints & QPainter::Antialiasing) &&
- (style == Qt::SolidPattern) &&
- !d->multisamplingAlwaysEnabled;
-
- if (doOffset) {
- d->temporaryTransform = s->matrix;
- QTransform tx = QTransform::fromTranslate(.49, .49);
- s->matrix = s->matrix * tx;
- d->matrixDirty = true;
- }
-
- d->setBrush(&brush);
+ ensureActive();
+ d->setBrush(brush);
d->fill(path);
-
- if (doOffset) {
- s->matrix = d->temporaryTransform;
- d->matrixDirty = true;
- }
}
extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp
@@ -1329,9 +1012,8 @@ void QGL2PaintEngineEx::stroke(const QVectorPath &path, const QPen &pen)
{
Q_D(QGL2PaintEngineEx);
- Qt::PenStyle penStyle = qpen_style(pen);
const QBrush &penBrush = qpen_brush(pen);
- if (penStyle == Qt::NoPen || qbrush_style(penBrush) == Qt::NoBrush)
+ if (qpen_style(pen) == Qt::NoPen || qbrush_style(penBrush) == Qt::NoBrush)
return;
QOpenGL2PaintEngineState *s = state();
@@ -1342,53 +1024,57 @@ void QGL2PaintEngineEx::stroke(const QVectorPath &path, const QPen &pen)
}
ensureActive();
+ d->setBrush(penBrush);
+ d->stroke(path, pen);
+}
- bool doOffset = !(s->renderHints & QPainter::Antialiasing) && !d->multisamplingAlwaysEnabled;
- if (doOffset) {
- d->temporaryTransform = s->matrix;
- QTransform tx = QTransform::fromTranslate(0.49, .49);
- s->matrix = s->matrix * tx;
- d->matrixDirty = true;
+void QGL2PaintEngineExPrivate::stroke(const QVectorPath &path, const QPen &pen)
+{
+ const QOpenGL2PaintEngineState *s = q->state();
+ const bool newAddOffset = !(s->renderHints & QPainter::Antialiasing) && !multisamplingAlwaysEnabled;
+ if (addOffset != newAddOffset) {
+ addOffset = newAddOffset;
+ matrixDirty = true;
}
- bool opaque = penBrush.isOpaque() && s->opacity > 0.99;
- d->setBrush(&penBrush);
- d->transferMode(BrushDrawingMode);
+ if (snapToPixelGrid) {
+ snapToPixelGrid = false;
+ matrixDirty = true;
+ }
+
+ const Qt::PenStyle penStyle = qpen_style(pen);
+ const QBrush &penBrush = qpen_brush(pen);
+ const bool opaque = penBrush.isOpaque() && s->opacity > 0.99;
+
+ transferMode(BrushDrawingMode);
// updateMatrix() is responsible for setting the inverse scale on
// the strokers, so we need to call it here and not wait for
// prepareForDraw() down below.
- d->updateMatrix();
+ updateMatrix();
if (penStyle == Qt::SolidLine) {
- d->stroker.process(path, pen);
+ stroker.process(path, pen);
} else { // Some sort of dash
- d->dasher.process(path, pen);
+ dasher.process(path, pen);
- QVectorPath dashStroke(d->dasher.points(),
- d->dasher.elementCount(),
- d->dasher.elementTypes());
- d->stroker.process(dashStroke, pen);
+ QVectorPath dashStroke(dasher.points(),
+ dasher.elementCount(),
+ dasher.elementTypes());
+ stroker.process(dashStroke, pen);
}
-
- QGLContext *ctx = d->ctx;
- Q_UNUSED(ctx);
-
if (opaque) {
- d->prepareForDraw(opaque);
- glEnableVertexAttribArray(QT_VERTEX_COORDS_ATTR);
- glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, false, 0, d->stroker.vertices());
- glDrawArrays(GL_TRIANGLE_STRIP, 0, d->stroker.vertexCount() / 2);
+ prepareForDraw(opaque);
+ glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, false, 0, stroker.vertices());
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, stroker.vertexCount() / 2);
// QBrush b(Qt::green);
// d->setBrush(&b);
// d->prepareForDraw(true);
// glDrawArrays(GL_LINE_STRIP, 0, d->stroker.vertexCount() / 2);
- glDisableVertexAttribArray(QT_VERTEX_COORDS_ATTR);
-
} else {
qreal width = qpen_widthf(pen) / 2;
if (width == 0)
@@ -1398,30 +1084,25 @@ void QGL2PaintEngineEx::stroke(const QVectorPath &path, const QPen &pen)
: width;
if (pen.isCosmetic())
- extra = extra * d->inverseScale;
+ extra = extra * inverseScale;
QRectF bounds = path.controlPointRect().adjusted(-extra, -extra, extra, extra);
- d->fillStencilWithVertexArray(d->stroker.vertices(), d->stroker.vertexCount() / 2,
+ fillStencilWithVertexArray(stroker.vertices(), stroker.vertexCount() / 2,
0, 0, bounds, QGL2PaintEngineExPrivate::TriStripStrokeFillMode);
glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE);
// Pass when any bit is set, replace stencil value with 0
glStencilFunc(GL_NOTEQUAL, 0, GL_STENCIL_HIGH_BIT);
- d->prepareForDraw(false);
+ prepareForDraw(false);
// Stencil the brush onto the dest buffer
- d->composite(bounds);
+ composite(bounds);
glStencilMask(0);
- d->updateClipScissorTest();
- }
-
- if (doOffset) {
- s->matrix = d->temporaryTransform;
- d->matrixDirty = true;
+ updateClipScissorTest();
}
}
@@ -1461,7 +1142,7 @@ void QGL2PaintEngineEx::renderHintsChanged()
#endif
Q_D(QGL2PaintEngineEx);
- d->lastTexture = GLuint(-1);
+ d->lastTextureUsed = GLuint(-1);
d->brushTextureDirty = true;
// qDebug("QGL2PaintEngineEx::renderHintsChanged() not implemented!");
}
@@ -1539,27 +1220,26 @@ void QGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &textItem
{
Q_D(QGL2PaintEngineEx);
- if (!d->inRenderText)
- ensureActive();
+ ensureActive();
QOpenGL2PaintEngineState *s = state();
const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem);
- bool drawCached = true;
+ QTransform::TransformationType txtype = s->matrix.type();
- if (s->matrix.type() > QTransform::TxTranslate)
- drawCached = false;
+ float det = s->matrix.determinant();
+ bool drawCached = txtype < QTransform::TxProject;
- // don't try to cache huge fonts
+ // don't try to cache huge fonts or vastly transformed fonts
const qreal pixelSize = ti.fontEngine->fontDef.pixelSize;
- if (pixelSize * pixelSize * qAbs(s->matrix.determinant()) >= 64 * 64)
+ if (pixelSize * pixelSize * qAbs(det) >= 64 * 64 || det < 0.25f || det > 4.f)
drawCached = false;
QFontEngineGlyphCache::Type glyphType = ti.fontEngine->glyphFormat >= 0
? QFontEngineGlyphCache::Type(ti.fontEngine->glyphFormat)
: d->glyphCacheType;
- if (d->inRenderText)
+ if (txtype > QTransform::TxTranslate)
glyphType = QFontEngineGlyphCache::Raster_A8;
if (glyphType == QFontEngineGlyphCache::Raster_RGBMask
@@ -1581,7 +1261,6 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, QFontEngineGly
const QTextItemInt &ti)
{
Q_Q(QGL2PaintEngineEx);
- QOpenGL2PaintEngineState *s = q->state();
QVarLengthArray<QFixedPoint> positions;
QVarLengthArray<glyph_t> glyphs;
@@ -1589,10 +1268,10 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, QFontEngineGly
ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions);
QGLTextureGlyphCache *cache =
- (QGLTextureGlyphCache *) ti.fontEngine->glyphCache(ctx, s->matrix);
+ (QGLTextureGlyphCache *) ti.fontEngine->glyphCache(ctx, glyphType, QTransform());
if (!cache || cache->cacheType() != glyphType) {
- cache = new QGLTextureGlyphCache(ctx, glyphType, s->matrix);
+ cache = new QGLTextureGlyphCache(ctx, glyphType, QTransform());
ti.fontEngine->setGlyphCache(ctx, cache);
}
@@ -1602,8 +1281,6 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, QFontEngineGly
if (cache->width() == 0 || cache->height() == 0)
return;
- if (inRenderText)
- transferMode(BrushDrawingMode);
transferMode(TextDrawingMode);
int margin = cache->glyphMargin();
@@ -1631,11 +1308,17 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, QFontEngineGly
if (textureCoordinateArray.data() != oldTextureCoordinateDataPtr)
glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, textureCoordinateArray.data());
- QBrush pensBrush = q->state()->pen.brush();
- setBrush(&pensBrush);
+ if (addOffset) {
+ addOffset = false;
+ matrixDirty = true;
+ }
+ if (!snapToPixelGrid) {
+ snapToPixelGrid = true;
+ matrixDirty = true;
+ }
- if (inRenderText)
- prepareDepthRangeForRenderText();
+ QBrush pensBrush = q->state()->pen.brush();
+ setBrush(pensBrush);
if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) {
@@ -1677,7 +1360,7 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, QFontEngineGly
q->state()->opacity = 1;
opacityUniformDirty = true;
pensBrush = Qt::white;
- setBrush(&pensBrush);
+ setBrush(pensBrush);
}
compositionModeDirty = false; // I can handle this myself, thank you very much
@@ -1698,7 +1381,7 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, QFontEngineGly
q->state()->opacity = oldOpacity;
opacityUniformDirty = true;
pensBrush = q->state()->pen.brush();
- setBrush(&pensBrush);
+ setBrush(pensBrush);
}
compositionModeDirty = false;
@@ -1721,27 +1404,40 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, QFontEngineGly
shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::MaskTexture), QT_MASK_TEXTURE_UNIT);
glDrawArrays(GL_TRIANGLES, 0, 6 * glyphs.size());
-
- if (inRenderText)
- restoreDepthRangeForRenderText();
}
void QGL2PaintEngineEx::drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints hints)
{
+ Q_D(QGL2PaintEngineEx);
// Use fallback for extended composition modes.
if (state()->composition_mode > QPainter::CompositionMode_Plus) {
QPaintEngineEx::drawPixmaps(drawingData, dataCount, pixmap, hints);
return;
}
- Q_D(QGL2PaintEngineEx);
+ ensureActive();
+ d->drawPixmaps(drawingData, dataCount, pixmap, hints);
+}
+
+void QGL2PaintEngineExPrivate::drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints hints)
+{
GLfloat dx = 1.0f / pixmap.size().width();
GLfloat dy = 1.0f / pixmap.size().height();
- d->vertexCoordinateArray.clear();
- d->textureCoordinateArray.clear();
- d->opacityArray.reset();
+ vertexCoordinateArray.clear();
+ textureCoordinateArray.clear();
+ opacityArray.reset();
+
+ if (addOffset) {
+ addOffset = false;
+ matrixDirty = true;
+ }
+
+ if (snapToPixelGrid) {
+ snapToPixelGrid = false;
+ matrixDirty = true;
+ }
bool allOpaque = true;
@@ -1758,31 +1454,28 @@ void QGL2PaintEngineEx::drawPixmaps(const QDrawPixmaps::Data *drawingData, int d
QGLPoint bottomRight(right * c - bottom * s, right * s + bottom * c);
QGLPoint bottomLeft(-right * c - bottom * s, -right * s + bottom * c);
- d->vertexCoordinateArray.lineToArray(bottomRight.x + drawingData[i].point.x(), bottomRight.y + drawingData[i].point.y());
- d->vertexCoordinateArray.lineToArray(-bottomLeft.x + drawingData[i].point.x(), -bottomLeft.y + drawingData[i].point.y());
- d->vertexCoordinateArray.lineToArray(-bottomRight.x + drawingData[i].point.x(), -bottomRight.y + drawingData[i].point.y());
- d->vertexCoordinateArray.lineToArray(-bottomRight.x + drawingData[i].point.x(), -bottomRight.y + drawingData[i].point.y());
- d->vertexCoordinateArray.lineToArray(bottomLeft.x + drawingData[i].point.x(), bottomLeft.y + drawingData[i].point.y());
- d->vertexCoordinateArray.lineToArray(bottomRight.x + drawingData[i].point.x(), bottomRight.y + drawingData[i].point.y());
+ vertexCoordinateArray.lineToArray(bottomRight.x + drawingData[i].point.x(), bottomRight.y + drawingData[i].point.y());
+ vertexCoordinateArray.lineToArray(-bottomLeft.x + drawingData[i].point.x(), -bottomLeft.y + drawingData[i].point.y());
+ vertexCoordinateArray.lineToArray(-bottomRight.x + drawingData[i].point.x(), -bottomRight.y + drawingData[i].point.y());
+ vertexCoordinateArray.lineToArray(-bottomRight.x + drawingData[i].point.x(), -bottomRight.y + drawingData[i].point.y());
+ vertexCoordinateArray.lineToArray(bottomLeft.x + drawingData[i].point.x(), bottomLeft.y + drawingData[i].point.y());
+ vertexCoordinateArray.lineToArray(bottomRight.x + drawingData[i].point.x(), bottomRight.y + drawingData[i].point.y());
QGLRect src(drawingData[i].source.left() * dx, drawingData[i].source.top() * dy,
drawingData[i].source.right() * dx, drawingData[i].source.bottom() * dy);
- d->textureCoordinateArray.lineToArray(src.right, src.bottom);
- d->textureCoordinateArray.lineToArray(src.right, src.top);
- d->textureCoordinateArray.lineToArray(src.left, src.top);
- d->textureCoordinateArray.lineToArray(src.left, src.top);
- d->textureCoordinateArray.lineToArray(src.left, src.bottom);
- d->textureCoordinateArray.lineToArray(src.right, src.bottom);
+ textureCoordinateArray.lineToArray(src.right, src.bottom);
+ textureCoordinateArray.lineToArray(src.right, src.top);
+ textureCoordinateArray.lineToArray(src.left, src.top);
+ textureCoordinateArray.lineToArray(src.left, src.top);
+ textureCoordinateArray.lineToArray(src.left, src.bottom);
+ textureCoordinateArray.lineToArray(src.right, src.bottom);
- qreal opacity = drawingData[i].opacity * state()->opacity;
- d->opacityArray << opacity << opacity << opacity << opacity << opacity << opacity;
+ qreal opacity = drawingData[i].opacity * q->state()->opacity;
+ opacityArray << opacity << opacity << opacity << opacity << opacity << opacity;
allOpaque &= (opacity >= 0.99f);
}
- ensureActive();
-
- QGLContext *ctx = d->ctx;
glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT);
QGLTexture *texture = ctx->d_func()->bindTexture(pixmap, GL_TEXTURE_2D, GL_RGBA,
QGLContext::InternalBindOption
@@ -1790,27 +1483,28 @@ void QGL2PaintEngineEx::drawPixmaps(const QDrawPixmaps::Data *drawingData, int d
if (texture->options & QGLContext::InvertedYBindOption) {
// Flip texture y-coordinate.
- QGLPoint *data = d->textureCoordinateArray.data();
+ QGLPoint *data = textureCoordinateArray.data();
for (int i = 0; i < 6 * dataCount; ++i)
data[i].y = 1 - data[i].y;
}
- d->transferMode(ImageArrayDrawingMode);
+ transferMode(ImageArrayDrawingMode);
bool isBitmap = pixmap.isQBitmap();
bool isOpaque = !isBitmap && (!pixmap.hasAlphaChannel() || (hints & QDrawPixmaps::OpaqueHint)) && allOpaque;
- d->updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE,
- state()->renderHints & QPainter::SmoothPixmapTransform, texture->id);
+ updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE,
+ q->state()->renderHints & QPainter::SmoothPixmapTransform, texture->id);
// Setup for texture drawing
- d->shaderManager->setSrcPixelType(isBitmap ? QGLEngineShaderManager::PatternSrc : QGLEngineShaderManager::ImageSrc);
- if (d->prepareForDraw(isOpaque))
- d->shaderManager->currentProgram()->setUniformValue(d->location(QGLEngineShaderManager::ImageTexture), QT_IMAGE_TEXTURE_UNIT);
+ currentBrush = noBrush;
+ shaderManager->setSrcPixelType(isBitmap ? QGLEngineShaderManager::PatternSrc : QGLEngineShaderManager::ImageSrc);
+ if (prepareForDraw(isOpaque))
+ shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::ImageTexture), QT_IMAGE_TEXTURE_UNIT);
if (isBitmap) {
- QColor col = qt_premultiplyColor(state()->pen.color(), (GLfloat)state()->opacity);
- d->shaderManager->currentProgram()->setUniformValue(d->location(QGLEngineShaderManager::PatternColor), col);
+ QColor col = qt_premultiplyColor(q->state()->pen.color(), (GLfloat)q->state()->opacity);
+ shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PatternColor), col);
}
glDrawArrays(GL_TRIANGLES, 0, 6 * dataCount);
@@ -1842,7 +1536,8 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev)
d->compositionModeDirty = true;
d->opacityUniformDirty = true;
d->needsSync = true;
- d->use_system_clip = !systemClip().isEmpty();
+ d->useSystemClip = !systemClip().isEmpty();
+ d->currentBrush = QBrush();
d->dirtyStencilRegion = QRect(0, 0, d->width, d->height);
d->stencilClean = true;
@@ -1861,11 +1556,9 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev)
d->shaderManager = new QGLEngineShaderManager(d->ctx);
- if (!d->inRenderText) {
- glDisable(GL_STENCIL_TEST);
- glDisable(GL_DEPTH_TEST);
- glDisable(GL_SCISSOR_TEST);
- }
+ glDisable(GL_STENCIL_TEST);
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_SCISSOR_TEST);
#if !defined(QT_OPENGL_ES_2)
glDisable(GL_MULTISAMPLE);
@@ -1875,6 +1568,7 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev)
#if !defined(QT_OPENGL_ES_2)
#if defined(Q_WS_WIN)
+ extern Q_GUI_EXPORT bool qt_cleartype_enabled;
if (qt_cleartype_enabled)
#endif
d->glyphCacheType = QFontEngineGlyphCache::Raster_RGBMask;
@@ -1942,6 +1636,7 @@ void QGL2PaintEngineEx::ensureActive()
glViewport(0, 0, d->width, d->height);
d->needsSync = false;
d->shaderManager->setDirty();
+ d->ctx->d_func()->syncGlState();
setState(state());
}
}
@@ -1962,12 +1657,12 @@ void QGL2PaintEngineExPrivate::updateClipScissorTest()
#else
QRect bounds = q->state()->rectangleClip;
if (!q->state()->clipEnabled) {
- if (use_system_clip)
+ if (useSystemClip)
bounds = systemClip.boundingRect();
else
bounds = QRect(0, 0, width, height);
} else {
- if (use_system_clip)
+ if (useSystemClip)
bounds = bounds.intersected(systemClip.boundingRect());
else
bounds = bounds.intersected(QRect(0, 0, width, height));
@@ -2022,6 +1717,15 @@ void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, uint value)
{
transferMode(BrushDrawingMode);
+ if (addOffset) {
+ addOffset = false;
+ matrixDirty = true;
+ }
+ if (snapToPixelGrid) {
+ snapToPixelGrid = false;
+ matrixDirty = true;
+ }
+
if (matrixDirty)
updateMatrix();
@@ -2121,7 +1825,7 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op)
switch (op) {
case Qt::NoClip:
- if (d->use_system_clip) {
+ if (d->useSystemClip) {
state()->clipTestEnabled = true;
state()->currentClip = 1;
} else {
@@ -2193,13 +1897,13 @@ void QGL2PaintEngineExPrivate::systemStateChanged()
q->state()->clipChanged = true;
if (systemClip.isEmpty()) {
- use_system_clip = false;
+ useSystemClip = false;
} else {
if (q->paintDevice()->devType() == QInternal::Widget && currentClipWidget) {
QWidgetPrivate *widgetPrivate = qt_widget_private(currentClipWidget->window());
- use_system_clip = widgetPrivate->extra && widgetPrivate->extra->inRenderWithPainter;
+ useSystemClip = widgetPrivate->extra && widgetPrivate->extra->inRenderWithPainter;
} else {
- use_system_clip = true;
+ useSystemClip = true;
}
}
@@ -2209,19 +1913,19 @@ void QGL2PaintEngineExPrivate::systemStateChanged()
q->state()->currentClip = 1;
maxClip = 1;
- q->state()->rectangleClip = use_system_clip ? systemClip.boundingRect() : QRect(0, 0, width, height);
+ q->state()->rectangleClip = useSystemClip ? systemClip.boundingRect() : QRect(0, 0, width, height);
updateClipScissorTest();
if (systemClip.rectCount() == 1) {
if (systemClip.boundingRect() == QRect(0, 0, width, height))
- use_system_clip = false;
+ useSystemClip = false;
#ifndef QT_GL_NO_SCISSOR_TEST
// scissoring takes care of the system clip
return;
#endif
}
- if (use_system_clip) {
+ if (useSystemClip) {
clearClip(0);
QPainterPath path;
@@ -2300,12 +2004,6 @@ QPainterState *QGL2PaintEngineEx::createState(QPainterState *orig) const
return s;
}
-void QGL2PaintEngineEx::setRenderTextActive(bool active)
-{
- Q_D(QGL2PaintEngineEx);
- d->inRenderText = active;
-}
-
QOpenGL2PaintEngineState::QOpenGL2PaintEngineState(QOpenGL2PaintEngineState &other)
: QPainterState(other)
{
@@ -2330,5 +2028,3 @@ QOpenGL2PaintEngineState::~QOpenGL2PaintEngineState()
}
QT_END_NAMESPACE
-
-#include "qpaintengineex_opengl2.moc"
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
index 0084476..eaae187 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
@@ -73,6 +73,12 @@ enum EngineMode {
QT_BEGIN_NAMESPACE
+#define GL_STENCIL_HIGH_BIT GLuint(0x80)
+#define QT_BRUSH_TEXTURE_UNIT GLuint(0)
+#define QT_IMAGE_TEXTURE_UNIT GLuint(0) //Can be the same as brush texture unit
+#define QT_MASK_TEXTURE_UNIT GLuint(1)
+#define QT_BACKGROUND_TEXTURE_UNIT GLuint(2)
+
class QGL2PaintEngineExPrivate;
@@ -105,13 +111,8 @@ public:
~QGL2PaintEngineEx();
bool begin(QPaintDevice *device);
- bool end();
-
void ensureActive();
-
- virtual void fill(const QVectorPath &path, const QBrush &brush);
- virtual void stroke(const QVectorPath &path, const QPen &pen);
- virtual void clip(const QVectorPath &path, Qt::ClipOperation op);
+ bool end();
virtual void clipEnabledChanged();
virtual void penChanged();
@@ -122,20 +123,21 @@ public:
virtual void renderHintsChanged();
virtual void transformChanged();
-
+ virtual void drawTexture(const QRectF &r, GLuint textureId, const QSize &size, const QRectF &sr);
virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
+ virtual void drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints hints);
virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
Qt::ImageConversionFlags flags = Qt::AutoColor);
- virtual void drawTexture(const QRectF &r, GLuint textureId, const QSize &size, const QRectF &sr);
-
virtual void drawTextItem(const QPointF &p, const QTextItem &textItem);
+ virtual void fill(const QVectorPath &path, const QBrush &brush);
+ virtual void stroke(const QVectorPath &path, const QPen &pen);
+ virtual void clip(const QVectorPath &path, Qt::ClipOperation op);
- virtual void drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints hints);
Type type() const { return OpenGL2; }
- void setState(QPainterState *s);
- QPainterState *createState(QPainterState *orig) const;
+ virtual void setState(QPainterState *s);
+ virtual QPainterState *createState(QPainterState *orig) const;
inline QOpenGL2PaintEngineState *state() {
return static_cast<QOpenGL2PaintEngineState *>(QPaintEngineEx::state());
}
@@ -146,8 +148,6 @@ public:
void beginNativePainting();
void endNativePainting();
- const QGLContext* context();
-
QPixmapFilter *pixmapFilter(int type, const QPixmapFilter *prototype);
void setRenderTextActive(bool);
@@ -169,12 +169,13 @@ public:
QGL2PaintEngineExPrivate(QGL2PaintEngineEx *q_ptr) :
q(q_ptr),
+ shaderManager(0),
width(0), height(0),
ctx(0),
- currentBrush(0),
- inverseScale(1),
- shaderManager(0),
- inRenderText(false)
+ useSystemClip(true),
+ snapToPixelGrid(false),
+ addOffset(false),
+ inverseScale(1)
{ }
~QGL2PaintEngineExPrivate();
@@ -185,45 +186,57 @@ public:
void updateCompositionMode();
void updateTextureFilter(GLenum target, GLenum wrapMode, bool smoothPixmapTransform, GLuint id = -1);
- void setBrush(const QBrush* brush);
-
- void transferMode(EngineMode newMode);
void resetGLState();
- // fill, drawOutline, drawTexture & drawCachedGlyphs are the rendering entry points:
+ // fill, stroke, drawTexture, drawPixmaps & drawCachedGlyphs are the main rendering entry-points,
+ // however writeClip can also be thought of as en entry point as it does similar things.
void fill(const QVectorPath &path);
+ void stroke(const QVectorPath &path, const QPen &pen);
void drawTexture(const QGLRect& dest, const QGLRect& src, const QSize &textureSize, bool opaque, bool pattern = false);
+ void drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints hints);
void drawCachedGlyphs(const QPointF &p, QFontEngineGlyphCache::Type glyphType, const QTextItemInt &ti);
+ // draws whatever is in the vertex array:
void drawVertexArrays(const float *data, int *stops, int stopCount, GLenum primitive);
void drawVertexArrays(QGL2PEXVertexArray &vertexArray, GLenum primitive) {
drawVertexArrays((const float *) vertexArray.data(), vertexArray.stops(), vertexArray.stopCount(), primitive);
}
- // ^ draws whatever is in the vertex array
+ // Composites the bounding rect onto dest buffer:
void composite(const QGLRect& boundingRect);
- // ^ Composites the bounding rect onto dest buffer
+ // Calls drawVertexArrays to render into stencil buffer:
void fillStencilWithVertexArray(const float *data, int count, int *stops, int stopCount, const QGLRect &bounds, StencilFillMode mode);
void fillStencilWithVertexArray(QGL2PEXVertexArray& vertexArray, bool useWindingFill) {
fillStencilWithVertexArray((const float *) vertexArray.data(), 0, vertexArray.stops(), vertexArray.stopCount(),
vertexArray.boundingRect(),
useWindingFill ? WindingFillMode : OddEvenFillMode);
}
- // ^ Calls drawVertexArrays to render into stencil buffer
-
- bool prepareForDraw(bool srcPixelsAreOpaque);
- // ^ returns whether the current program changed or not
+ void setBrush(const QBrush& brush);
+ void transferMode(EngineMode newMode);
+ bool prepareForDraw(bool srcPixelsAreOpaque); // returns true if the program has changed
inline void useSimpleShader();
+ inline GLuint location(const QGLEngineShaderManager::Uniform uniform) {
+ return shaderManager->getUniformLocation(uniform);
+ }
- void prepareDepthRangeForRenderText();
- void restoreDepthRangeForRenderText();
+ void clearClip(uint value);
+ void writeClip(const QVectorPath &path, uint value);
+ void resetClipIfNeeded();
+
+ void updateClipScissorTest();
+ void setScissor(const QRect &rect);
+ void regenerateClip();
+ void systemStateChanged();
static QGLEngineShaderManager* shaderManagerForEngine(QGL2PaintEngineEx *engine) { return engine->d_func()->shaderManager; }
static QGL2PaintEngineExPrivate *getData(QGL2PaintEngineEx *engine) { return engine->d_func(); }
+ static void cleanupVectorPath(QPaintEngineEx *engine, void *data);
+
QGL2PaintEngineEx* q;
+ QGLEngineShaderManager* shaderManager;
QGLPaintDevice* device;
int width, height;
QGLContext *ctx;
@@ -240,44 +253,28 @@ public:
bool opacityUniformDirty;
bool stencilClean; // Has the stencil not been used for clipping so far?
+ bool useSystemClip;
QRegion dirtyStencilRegion;
QRect currentScissorBounds;
uint maxClip;
- const QBrush* currentBrush; // May not be the state's brush!
-
- GLfloat inverseScale;
+ QBrush currentBrush; // May not be the state's brush!
+ const QBrush noBrush;
QGL2PEXVertexArray vertexCoordinateArray;
QGL2PEXVertexArray textureCoordinateArray;
QDataBuffer<GLfloat> opacityArray;
-
GLfloat staticVertexCoordinateArray[8];
GLfloat staticTextureCoordinateArray[8];
- GLfloat pmvMatrix[4][4];
-
- QGLEngineShaderManager* shaderManager;
-
- void clearClip(uint value);
- void writeClip(const QVectorPath &path, uint value);
- void resetClipIfNeeded();
-
- void updateClipScissorTest();
- void setScissor(const QRect &rect);
- void regenerateClip();
- void systemStateChanged();
- uint use_system_clip : 1;
-
- uint location(QGLEngineShaderManager::Uniform uniform)
- {
- return shaderManager->getUniformLocation(uniform);
- }
+ bool snapToPixelGrid;
+ bool addOffset; // When enabled, adds a 0.49,0.49 offset to matrix in updateMatrix
+ GLfloat pmvMatrix[3][3];
+ GLfloat inverseScale;
- GLuint lastTexture;
+ GLuint lastTextureUsed;
bool needsSync;
- bool inRenderText;
bool multisamplingAlwaysEnabled;
GLfloat depthRange[2];
@@ -286,15 +283,11 @@ public:
QTriangulatingStroker stroker;
QDashedStrokeProcessor dasher;
- QTransform temporaryTransform;
QScopedPointer<QPixmapFilter> convolutionFilter;
QScopedPointer<QPixmapFilter> colorizeFilter;
QScopedPointer<QPixmapFilter> blurFilter;
- QScopedPointer<QPixmapFilter> animationBlurFilter;
- QScopedPointer<QPixmapFilter> fastBlurFilter;
QScopedPointer<QPixmapFilter> dropShadowFilter;
- QScopedPointer<QPixmapFilter> fastDropShadowFilter;
QSet<QVectorPath::CacheEntry *> pathCaches;
QVector<GLuint> unusedVBOSToClean;
diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
new file mode 100644
index 0000000..047876f
--- /dev/null
+++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
@@ -0,0 +1,216 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtOpenGL 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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qtextureglyphcache_gl_p.h"
+#include "qpaintengineex_opengl2_p.h"
+
+#ifdef Q_WS_WIN
+extern Q_GUI_EXPORT bool qt_cleartype_enabled;
+#endif
+
+QGLTextureGlyphCache::QGLTextureGlyphCache(QGLContext *context, QFontEngineGlyphCache::Type type, const QTransform &matrix)
+ : QTextureGlyphCache(type, matrix)
+ , ctx(context)
+ , m_width(0)
+ , m_height(0)
+{
+ glGenFramebuffers(1, &m_fbo);
+ connect(QGLSignalProxy::instance(), SIGNAL(aboutToDestroyContext(const QGLContext*)),
+ SLOT(contextDestroyed(const QGLContext*)));
+}
+
+QGLTextureGlyphCache::~QGLTextureGlyphCache()
+{
+ if (ctx) {
+ QGLShareContextScope scope(ctx);
+ glDeleteFramebuffers(1, &m_fbo);
+
+ if (m_width || m_height)
+ glDeleteTextures(1, &m_texture);
+ }
+}
+
+void QGLTextureGlyphCache::createTextureData(int width, int height)
+{
+ glGenTextures(1, &m_texture);
+ glBindTexture(GL_TEXTURE_2D, m_texture);
+
+ m_width = width;
+ m_height = height;
+
+ QVarLengthArray<uchar> data(width * height);
+ for (int i = 0; i < data.size(); ++i)
+ data[i] = 0;
+
+ if (m_type == QFontEngineGlyphCache::Raster_RGBMask)
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, &data[0]);
+ else
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, &data[0]);
+
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+}
+
+void QGLTextureGlyphCache::resizeTextureData(int width, int height)
+{
+ // ### the QTextureGlyphCache API needs to be reworked to allow
+ // ### resizeTextureData to fail
+
+ int oldWidth = m_width;
+ int oldHeight = m_height;
+
+ GLuint oldTexture = m_texture;
+ createTextureData(width, height);
+
+ glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_fbo);
+
+ GLuint tmp_texture;
+ glGenTextures(1, &tmp_texture);
+ glBindTexture(GL_TEXTURE_2D, tmp_texture);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, oldWidth, oldHeight, 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ glBindTexture(GL_TEXTURE_2D, 0);
+ glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
+ GL_TEXTURE_2D, tmp_texture, 0);
+
+ glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT);
+ glBindTexture(GL_TEXTURE_2D, oldTexture);
+
+ pex->transferMode(BrushDrawingMode);
+
+ glDisable(GL_STENCIL_TEST);
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_SCISSOR_TEST);
+ glDisable(GL_BLEND);
+
+ glViewport(0, 0, oldWidth, oldHeight);
+
+ float vertexCoordinateArray[] = { -1, -1, 1, -1, 1, 1, -1, 1 };
+ float textureCoordinateArray[] = { 0, 0, 1, 0, 1, 1, 0, 1 };
+
+ glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, vertexCoordinateArray);
+ glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, textureCoordinateArray);
+
+ pex->shaderManager->useBlitProgram();
+ pex->shaderManager->blitProgram()->setUniformValue("imageTexture", QT_IMAGE_TEXTURE_UNIT);
+
+ glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+
+ glBindTexture(GL_TEXTURE_2D, m_texture);
+
+#ifdef QT_OPENGL_ES_2
+ QDataBuffer<uchar> buffer(4*oldWidth*oldHeight);
+ buffer.resize(4*oldWidth*oldHeight);
+ glReadPixels(0, 0, oldWidth, oldHeight, GL_RGBA, GL_UNSIGNED_BYTE, buffer.data());
+
+ // do an in-place conversion from GL_RGBA to GL_ALPHA
+ for (int i=0; i<oldWidth*oldHeight; ++i)
+ buffer.data()[i] = buffer.at(4*i + 3);
+
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, oldWidth, oldHeight,
+ GL_ALPHA, GL_UNSIGNED_BYTE, buffer.data());
+#else
+ glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, oldWidth, oldHeight);
+#endif
+
+ glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
+ GL_RENDERBUFFER_EXT, 0);
+ glDeleteTextures(1, &tmp_texture);
+ glDeleteTextures(1, &oldTexture);
+
+ glBindFramebuffer(GL_FRAMEBUFFER_EXT, ctx->d_ptr->current_fbo);
+
+ glViewport(0, 0, pex->width, pex->height);
+ pex->updateClipScissorTest();
+}
+
+void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph)
+{
+ QImage mask = textureMapForGlyph(glyph);
+ const int maskWidth = mask.width();
+ const int maskHeight = mask.height();
+
+ if (mask.format() == QImage::Format_Mono) {
+ mask = mask.convertToFormat(QImage::Format_Indexed8);
+ for (int y = 0; y < maskHeight; ++y) {
+ uchar *src = (uchar *) mask.scanLine(y);
+ for (int x = 0; x < maskWidth; ++x)
+ src[x] = -src[x]; // convert 0 and 1 into 0 and 255
+ }
+ }
+
+
+ glBindTexture(GL_TEXTURE_2D, m_texture);
+ if (mask.format() == QImage::Format_RGB32) {
+ glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, GL_BGRA, GL_UNSIGNED_BYTE, mask.bits());
+ } else {
+#ifdef QT_OPENGL_ES2
+ glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, GL_ALPHA, GL_UNSIGNED_BYTE, mask.bits());
+#else
+ // glTexSubImage2D() might cause some garbage to appear in the texture if the mask width is
+ // not a multiple of four bytes. The bug appeared on a computer with 32-bit Windows Vista
+ // and nVidia GeForce 8500GT. GL_UNPACK_ALIGNMENT is set to four bytes, 'mask' has a
+ // multiple of four bytes per line, and most of the glyph shows up correctly in the
+ // texture, which makes me think that this is a driver bug.
+ // One workaround is to make sure the mask width is a multiple of four bytes, for instance
+ // by converting it to a format with four bytes per pixel. Another is to copy one line at a
+ // time.
+
+ for (int i = 0; i < maskHeight; ++i)
+ glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y + i, maskWidth, 1, GL_ALPHA, GL_UNSIGNED_BYTE, mask.scanLine(i));
+#endif
+ }
+}
+
+int QGLTextureGlyphCache::glyphMargin() const
+{
+#if defined(Q_WS_MAC)
+ return 2;
+#elif defined (Q_WS_X11)
+ return 0;
+#else
+ return m_type == QFontEngineGlyphCache::Raster_RGBMask ? 2 : 0;
+#endif
+}
diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h
new file mode 100644
index 0000000..393893c
--- /dev/null
+++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h
@@ -0,0 +1,123 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtOpenGL 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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTEXTUREGLYPHCACHE_GL_P_H
+#define QTEXTUREGLYPHCACHE_GL_P_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 <private/qtextureglyphcache_p.h>
+#include <private/qgl_p.h>
+#include <qglshaderprogram.h>
+
+
+QT_BEGIN_NAMESPACE
+
+class QGL2PaintEngineExPrivate;
+
+class QGLTextureGlyphCache : public QObject, public QTextureGlyphCache
+{
+ Q_OBJECT
+public:
+ QGLTextureGlyphCache(QGLContext *context, QFontEngineGlyphCache::Type type, const QTransform &matrix);
+ ~QGLTextureGlyphCache();
+
+ virtual void createTextureData(int width, int height);
+ virtual void resizeTextureData(int width, int height);
+ virtual void fillTexture(const Coord &c, glyph_t glyph);
+ virtual int glyphMargin() const;
+
+ inline GLuint texture() const { return m_texture; }
+
+ inline int width() const { return m_width; }
+ inline int height() const { return m_height; }
+
+ inline void setPaintEnginePrivate(QGL2PaintEngineExPrivate *p) { pex = p; }
+
+
+public Q_SLOTS:
+ void contextDestroyed(const QGLContext *context) {
+ if (context == ctx) {
+ const QGLContext *nextCtx = qt_gl_transfer_context(ctx);
+ if (!nextCtx) {
+ // the context may not be current, so we cannot directly
+ // destroy the fbo and texture here, but since the context
+ // is about to be destroyed, the GL server will do the
+ // clean up for us anyway
+ m_fbo = 0;
+ m_texture = 0;
+ ctx = 0;
+ } else {
+ // since the context holding the texture is shared, and
+ // about to be destroyed, we have to transfer ownership
+ // of the texture to one of the share contexts
+ ctx = const_cast<QGLContext *>(nextCtx);
+ }
+ }
+ }
+
+private:
+ QGLContext *ctx;
+
+ QGL2PaintEngineExPrivate *pex;
+
+ GLuint m_texture;
+ GLuint m_fbo;
+
+ int m_width;
+ int m_height;
+
+ QGLShaderProgram *m_program;
+};
+
+QT_END_NAMESPACE
+
+#endif
+
diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp
index 6082f49..395b8a3 100644
--- a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp
+++ b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp
@@ -62,8 +62,14 @@ void QTriangulatingStroker::endCapOrJoinClosed(const qreal *start, const qreal *
endCap(cur);
}
int count = m_vertices.size();
- m_vertices.add(m_vertices.at(count-2));
- m_vertices.add(m_vertices.at(count-1));
+
+ // Copy the (x, y) values because QDataBuffer::add(const float& t)
+ // may resize the buffer, which will leave t pointing at the
+ // previous buffer's memory region if we don't copy first.
+ float x = m_vertices.at(count-2);
+ float y = m_vertices.at(count-1);
+ m_vertices.add(x);
+ m_vertices.add(y);
}
diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro
index b2474ed..6076891 100644
--- a/src/opengl/opengl.pro
+++ b/src/opengl/opengl.pro
@@ -54,7 +54,8 @@ SOURCES += qgl.cpp \
gl2paintengineex/qpaintengineex_opengl2_p.h \
gl2paintengineex/qglengineshadersource_p.h \
gl2paintengineex/qglcustomshaderstage_p.h \
- gl2paintengineex/qtriangulatingstroker_p.h
+ gl2paintengineex/qtriangulatingstroker_p.h \
+ gl2paintengineex/qtextureglyphcache_gl_p.h
SOURCES += qglshaderprogram.cpp \
qglpixmapfilter.cpp \
@@ -67,7 +68,8 @@ SOURCES += qgl.cpp \
gl2paintengineex/qgl2pexvertexarray.cpp \
gl2paintengineex/qpaintengineex_opengl2.cpp \
gl2paintengineex/qglcustomshaderstage.cpp \
- gl2paintengineex/qtriangulatingstroker.cpp
+ gl2paintengineex/qtriangulatingstroker.cpp \
+ gl2paintengineex/qtextureglyphcache_gl.cpp
}
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 1bd1b91..c3e4a2e 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -397,8 +397,7 @@ static inline GLint qgluProject(GLdouble objx, GLdouble objy, GLdouble objz,
\i \link setDirectRendering() Direct rendering:\endlink Enabled.
\i \link setOverlay() Overlay:\endlink Disabled.
\i \link setPlane() Plane:\endlink 0 (i.e., normal plane).
- \i \link setSampleBuffers() Multisample buffers:\endlink Enabled on
- OpenGL/ES 2.0, disabled on other platforms.
+ \i \link setSampleBuffers() Multisample buffers:\endlink Disabled.
\endlist
*/
@@ -1437,6 +1436,18 @@ void QGLContextGroup::removeGuard(QGLSharedResourceGuard *guard)
m_guards = guard->m_next;
}
+const QGLContext *qt_gl_transfer_context(const QGLContext *ctx)
+{
+ if (!ctx)
+ return 0;
+ QList<const QGLContext *> shares
+ (QGLContextPrivate::contextGroup(ctx)->shares());
+ if (shares.size() >= 2)
+ return (ctx == shares.at(0)) ? shares.at(1) : shares.at(0);
+ else
+ return 0;
+}
+
QGLContextPrivate::~QGLContextPrivate()
{
if (!group->m_refs.deref()) {
@@ -1485,6 +1496,8 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format)
current_fbo = 0;
default_fbo = 0;
active_engine = 0;
+ for (int i = 0; i < QT_GL_VERTEX_ARRAY_TRACKED_COUNT; ++i)
+ vertexAttributeArraysEnabledState[i] = false;
}
QGLContext* QGLContext::currentCtx = 0;
@@ -1730,12 +1743,6 @@ struct DDSFormat {
#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192
#endif
-Q_GLOBAL_STATIC(QGLShareRegister, _qgl_share_reg)
-Q_OPENGL_EXPORT QGLShareRegister* qgl_share_reg()
-{
- return _qgl_share_reg();
-}
-
/*!
\class QGLContext
\brief The QGLContext class encapsulates an OpenGL rendering context.
@@ -1875,6 +1882,35 @@ void QGLContextPrivate::cleanup()
{
}
+#define ctx q_ptr
+void QGLContextPrivate::setVertexAttribArrayEnabled(int arrayIndex, bool enabled)
+{
+ Q_ASSERT(arrayIndex < QT_GL_VERTEX_ARRAY_TRACKED_COUNT);
+ Q_ASSERT(glEnableVertexAttribArray);
+
+ if (vertexAttributeArraysEnabledState[arrayIndex] && !enabled)
+ glDisableVertexAttribArray(arrayIndex);
+
+ if (!vertexAttributeArraysEnabledState[arrayIndex] && enabled)
+ glEnableVertexAttribArray(arrayIndex);
+
+ vertexAttributeArraysEnabledState[arrayIndex] = enabled;
+}
+
+void QGLContextPrivate::syncGlState()
+{
+ Q_ASSERT(glEnableVertexAttribArray);
+ for (int i = 0; i < QT_GL_VERTEX_ARRAY_TRACKED_COUNT; ++i) {
+ if (vertexAttributeArraysEnabledState[i])
+ glEnableVertexAttribArray(i);
+ else
+ glDisableVertexAttribArray(i);
+ }
+
+}
+#undef ctx
+
+
/*!
\overload
@@ -2064,6 +2100,29 @@ QGLTexture *QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G
// #define QGL_BIND_TEXTURE_DEBUG
+// map from Qt's ARGB endianness-dependent format to GL's big-endian RGBA layout
+static inline void qgl_byteSwapImage(QImage &img, GLenum pixel_type)
+{
+ const int width = img.width();
+ const int height = img.height();
+
+ if (pixel_type == GL_UNSIGNED_INT_8_8_8_8_REV
+ || (pixel_type == GL_UNSIGNED_BYTE && QSysInfo::ByteOrder == QSysInfo::LittleEndian))
+ {
+ for (int i = 0; i < height; ++i) {
+ uint *p = (uint *) img.scanLine(i);
+ for (int x = 0; x < width; ++x)
+ p[x] = ((p[x] << 16) & 0xff0000) | ((p[x] >> 16) & 0xff) | (p[x] & 0xff00ff00);
+ }
+ } else {
+ for (int i = 0; i < height; ++i) {
+ uint *p = (uint *) img.scanLine(i);
+ for (int x = 0; x < width; ++x)
+ p[x] = (p[x] << 8) | ((p[x] >> 24) & 0xff);
+ }
+ }
+}
+
QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, GLint internalFormat,
const qint64 key, QGLContext::BindOptions options)
{
@@ -2216,23 +2275,7 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G
// 32 in the switch above is for the RGB16 case, where we set
// the format to GL_RGB
Q_ASSERT(img.depth() == 32);
- const int width = img.width();
- const int height = img.height();
-
- if (pixel_type == GL_UNSIGNED_INT_8_8_8_8_REV
- || (pixel_type == GL_UNSIGNED_BYTE && QSysInfo::ByteOrder == QSysInfo::LittleEndian)) {
- for (int i=0; i < height; ++i) {
- uint *p = (uint *) img.scanLine(i);
- for (int x=0; x<width; ++x)
- p[x] = ((p[x] << 16) & 0xff0000) | ((p[x] >> 16) & 0xff) | (p[x] & 0xff00ff00);
- }
- } else {
- for (int i=0; i < height; ++i) {
- uint *p = (uint *) img.scanLine(i);
- for (int x=0; x<width; ++x)
- p[x] = (p[x] << 8) | ((p[x] >> 24) & 0xff);
- }
- }
+ qgl_byteSwapImage(img, pixel_type);
}
#ifdef QT_OPENGL_ES
// OpenGL/ES requires that the internal and external formats be identical.
@@ -2948,7 +2991,7 @@ bool QGLContext::create(const QGLContext* shareContext)
wd->usesDoubleBufferedGLContext = d->glFormat.doubleBuffer();
}
if (d->sharing) // ok, we managed to share
- qgl_share_reg()->addShare(this, shareContext);
+ QGLContextGroup::addShare(this, shareContext);
return d->valid;
}
@@ -3804,6 +3847,11 @@ bool QGLWidget::event(QEvent *e)
}
#if defined(QT_OPENGL_ES)
+ // A re-parent is likely to destroy the X11 window and re-create it. It is important
+ // that we free the EGL surface _before_ the winID changes - otherwise we can leak.
+ if (e->type() == QEvent::ParentAboutToChange)
+ d->glcx->d_func()->destroyEglSurfaceForDevice();
+
if ((e->type() == QEvent::ParentChange) || (e->type() == QEvent::WindowStateChange)) {
// The window may have been re-created during re-parent or state change - if so, the EGL
// surface will need to be re-created.
@@ -4291,6 +4339,7 @@ static void qt_save_gl_state()
glDisable(GL_CULL_FACE);
glDisable(GL_LIGHTING);
glDisable(GL_STENCIL_TEST);
+ glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
}
@@ -4344,6 +4393,10 @@ static void qt_gl_draw_text(QPainter *p, int x, int y, const QString &str,
\note This function clears the stencil buffer.
\note This function is not supported on OpenGL/ES systems.
+
+ \note This function temporarily disables depth-testing when the
+ text is drawn.
+
\l{Overpainting Example}{Overpaint} with QPainter::drawText() instead.
*/
@@ -4362,9 +4415,9 @@ void QGLWidget::renderText(int x, int y, const QString &str, const QFont &font,
int height = d->glcx->device()->height();
bool auto_swap = autoBufferSwap();
+ QPaintEngine::Type oldEngineType = qgl_engine_selector()->preferredPaintEngine();
+ qgl_engine_selector()->setPreferredPaintEngine(QPaintEngine::OpenGL);
QPaintEngine *engine = paintEngine();
- if (engine->type() == QPaintEngine::OpenGL2)
- static_cast<QGL2PaintEngineEx *>(engine)->setRenderTextActive(true);
QPainter *p;
bool reuse_painter = false;
if (engine->isActive()) {
@@ -4384,11 +4437,6 @@ void QGLWidget::renderText(int x, int y, const QString &str, const QFont &font,
setAutoBufferSwap(false);
// disable glClear() as a result of QPainter::begin()
d->disable_clear_on_painter_begin = true;
- if (engine->type() == QPaintEngine::OpenGL2) {
- qt_save_gl_state();
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- }
p = new QPainter(this);
}
@@ -4412,11 +4460,8 @@ void QGLWidget::renderText(int x, int y, const QString &str, const QFont &font,
delete p;
setAutoBufferSwap(auto_swap);
d->disable_clear_on_painter_begin = false;
- if (engine->type() == QPaintEngine::OpenGL2)
- qt_restore_gl_state();
}
- if (engine->type() == QPaintEngine::OpenGL2)
- static_cast<QGL2PaintEngineEx *>(engine)->setRenderTextActive(false);
+ qgl_engine_selector()->setPreferredPaintEngine(oldEngineType);
#else // QT_OPENGL_ES
Q_UNUSED(x);
Q_UNUSED(y);
@@ -4434,6 +4479,13 @@ void QGLWidget::renderText(int x, int y, const QString &str, const QFont &font,
have the labels move with the model as it is rotated etc.
\note This function is not supported on OpenGL/ES systems.
+
+ \note If depth testing is enabled before this function is called,
+ then the drawn text will be depth-tested against the models that
+ have already been drawn in the scene. Use \c{glDisable(GL_DEPTH_TEST)}
+ before calling this function to annotate the models without
+ depth-testing the text.
+
\l{Overpainting Example}{Overpaint} with QPainter::drawText() instead.
*/
void QGLWidget::renderText(double x, double y, double z, const QString &str, const QFont &font, int)
@@ -4457,9 +4509,9 @@ void QGLWidget::renderText(double x, double y, double z, const QString &str, con
&win_x, &win_y, &win_z);
win_y = height - win_y; // y is inverted
+ QPaintEngine::Type oldEngineType = qgl_engine_selector()->preferredPaintEngine();
+ qgl_engine_selector()->setPreferredPaintEngine(QPaintEngine::OpenGL);
QPaintEngine *engine = paintEngine();
- if (engine->type() == QPaintEngine::OpenGL2)
- static_cast<QGL2PaintEngineEx *>(engine)->setRenderTextActive(true);
QPainter *p;
bool reuse_painter = false;
bool use_depth_testing = glIsEnabled(GL_DEPTH_TEST);
@@ -4473,8 +4525,6 @@ void QGLWidget::renderText(double x, double y, double z, const QString &str, con
setAutoBufferSwap(false);
// disable glClear() as a result of QPainter::begin()
d->disable_clear_on_painter_begin = true;
- if (engine->type() == QPaintEngine::OpenGL2)
- qt_save_gl_state();
p = new QPainter(this);
}
@@ -4503,13 +4553,10 @@ void QGLWidget::renderText(double x, double y, double z, const QString &str, con
} else {
p->end();
delete p;
- if (engine->type() == QPaintEngine::OpenGL2)
- qt_restore_gl_state();
setAutoBufferSwap(auto_swap);
d->disable_clear_on_painter_begin = false;
}
- if (engine->type() == QPaintEngine::OpenGL2)
- static_cast<QGL2PaintEngineEx *>(engine)->setRenderTextActive(false);
+ qgl_engine_selector()->setPreferredPaintEngine(oldEngineType);
#else // QT_OPENGL_ES
Q_UNUSED(x);
Q_UNUSED(y);
@@ -4823,38 +4870,39 @@ QGLWidget::QGLWidget(QGLContext *context, QWidget *parent,
void QGLExtensions::init_extensions()
{
- QList<QByteArray> extensions = QByteArray(reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS))).split(' ');
- if (extensions.contains("GL_ARB_texture_rectangle"))
+ QGLExtensionMatcher extensions(reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS)));
+
+ if (extensions.match("GL_ARB_texture_rectangle"))
glExtensions |= TextureRectangle;
- if (extensions.contains("GL_ARB_multisample"))
+ if (extensions.match("GL_ARB_multisample"))
glExtensions |= SampleBuffers;
- if (extensions.contains("GL_SGIS_generate_mipmap"))
+ if (extensions.match("GL_SGIS_generate_mipmap"))
glExtensions |= GenerateMipmap;
- if (extensions.contains("GL_ARB_texture_compression"))
+ if (extensions.match("GL_ARB_texture_compression"))
glExtensions |= TextureCompression;
- if (extensions.contains("GL_EXT_texture_compression_s3tc"))
+ if (extensions.match("GL_EXT_texture_compression_s3tc"))
glExtensions |= DDSTextureCompression;
- if (extensions.contains("GL_OES_compressed_ETC1_RGB8_texture"))
+ if (extensions.match("GL_OES_compressed_ETC1_RGB8_texture"))
glExtensions |= ETC1TextureCompression;
- if (extensions.contains("GL_IMG_texture_compression_pvrtc"))
+ if (extensions.match("GL_IMG_texture_compression_pvrtc"))
glExtensions |= PVRTCTextureCompression;
- if (extensions.contains("GL_ARB_fragment_program"))
+ if (extensions.match("GL_ARB_fragment_program"))
glExtensions |= FragmentProgram;
- if (extensions.contains("GL_ARB_fragment_shader"))
+ if (extensions.match("GL_ARB_fragment_shader"))
glExtensions |= FragmentShader;
- if (extensions.contains("GL_ARB_texture_mirrored_repeat"))
+ if (extensions.match("GL_ARB_texture_mirrored_repeat"))
glExtensions |= MirroredRepeat;
- if (extensions.contains("GL_EXT_framebuffer_object"))
+ if (extensions.match("GL_EXT_framebuffer_object"))
glExtensions |= FramebufferObject;
- if (extensions.contains("GL_EXT_stencil_two_side"))
+ if (extensions.match("GL_EXT_stencil_two_side"))
glExtensions |= StencilTwoSide;
- if (extensions.contains("GL_EXT_stencil_wrap"))
+ if (extensions.match("GL_EXT_stencil_wrap"))
glExtensions |= StencilWrap;
- if (extensions.contains("GL_EXT_packed_depth_stencil"))
+ if (extensions.match("GL_EXT_packed_depth_stencil"))
glExtensions |= PackedDepthStencil;
- if (extensions.contains("GL_NV_float_buffer"))
+ if (extensions.match("GL_NV_float_buffer"))
glExtensions |= NVFloatBuffer;
- if (extensions.contains("GL_ARB_pixel_buffer_object"))
+ if (extensions.match("GL_ARB_pixel_buffer_object"))
glExtensions |= PixelBufferObject;
#if defined(QT_OPENGL_ES_2)
glExtensions |= FramebufferObject;
@@ -4862,26 +4910,26 @@ void QGLExtensions::init_extensions()
glExtensions |= FragmentShader;
#endif
#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_1_CL)
- if (extensions.contains("GL_OES_framebuffer_object"))
+ if (extensions.match("GL_OES_framebuffer_object"))
glExtensions |= FramebufferObject;
#endif
#if defined(QT_OPENGL_ES)
- if (extensions.contains("GL_OES_packed_depth_stencil"))
+ if (extensions.match("GL_OES_packed_depth_stencil"))
glExtensions |= PackedDepthStencil;
#endif
- if (extensions.contains("GL_ARB_framebuffer_object")) {
+ if (extensions.match("GL_ARB_framebuffer_object")) {
// ARB_framebuffer_object also includes EXT_framebuffer_blit.
glExtensions |= FramebufferObject;
glExtensions |= FramebufferBlit;
}
- if (extensions.contains("GL_EXT_framebuffer_blit"))
+ if (extensions.match("GL_EXT_framebuffer_blit"))
glExtensions |= FramebufferBlit;
- if (extensions.contains("GL_ARB_texture_non_power_of_two"))
+ if (extensions.match("GL_ARB_texture_non_power_of_two"))
glExtensions |= NPOTTextures;
- if (extensions.contains("GL_EXT_bgra"))
+ if (extensions.match("GL_EXT_bgra"))
glExtensions |= BGRATextureFormat;
}
@@ -4929,7 +4977,7 @@ Q_OPENGL_EXPORT const QString qt_gl_library_name()
}
#endif
-void QGLShareRegister::addShare(const QGLContext *context, const QGLContext *share) {
+void QGLContextGroup::addShare(const QGLContext *context, const QGLContext *share) {
Q_ASSERT(context && share);
if (context->d_ptr->group == share->d_ptr->group)
return;
@@ -4950,11 +4998,7 @@ void QGLShareRegister::addShare(const QGLContext *context, const QGLContext *sha
group->m_shares.append(context);
}
-QList<const QGLContext *> QGLShareRegister::shares(const QGLContext *context) {
- return context->d_ptr->group->m_shares;
-}
-
-void QGLShareRegister::removeShare(const QGLContext *context) {
+void QGLContextGroup::removeShare(const QGLContext *context) {
// Remove the context from the group.
QGLContextGroup *group = context->d_ptr->group;
if (group->m_shares.isEmpty())
@@ -5363,11 +5407,12 @@ QSize QGLTexture::bindCompressedTexturePVR(const char *buf, int len)
// Restore the default pixel alignment for later texture uploads.
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
- // Set the invert flag for the texture.
+ // Set the invert flag for the texture. The "vertical flip"
+ // flag in PVR is the opposite sense to our sense of inversion.
if ((pvrHeader->flags & PVR_VERTICAL_FLIP) != 0)
- options |= QGLContext::InvertedYBindOption;
- else
options &= ~QGLContext::InvertedYBindOption;
+ else
+ options |= QGLContext::InvertedYBindOption;
return QSize(pvrHeader->width, pvrHeader->height);
}
diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h
index 079953f..932ea7e 100644
--- a/src/opengl/qgl.h
+++ b/src/opengl/qgl.h
@@ -393,11 +393,12 @@ private:
friend class QOpenGLPaintEnginePrivate;
friend class QGL2PaintEngineEx;
friend class QGL2PaintEngineExPrivate;
+ friend class QGLEngineShaderManager;
friend class QGLWindowSurface;
friend class QGLPixmapData;
friend class QGLPixmapFilterBase;
friend class QGLTextureGlyphCache;
- friend class QGLShareRegister;
+ friend class QGLContextGroup;
friend class QGLSharedResourceGuard;
friend class QGLPixmapBlurFilter;
friend QGLFormat::OpenGLVersionFlags QGLFormat::openGLVersionFlags();
@@ -546,6 +547,7 @@ private:
friend class QGLPixelBuffer;
friend class QGLPixelBufferPrivate;
friend class QGLContext;
+ friend class QGLContextPrivate;
friend class QGLOverlayWidget;
friend class QOpenGLPaintEngine;
friend class QGLPaintDevice;
diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp
index fbf0349..084db32 100644
--- a/src/opengl/qgl_egl.cpp
+++ b/src/opengl/qgl_egl.cpp
@@ -142,19 +142,7 @@ void QGLContext::reset()
d->cleanup();
doneCurrent();
if (d->eglContext) {
- if (d->eglSurface != EGL_NO_SURFACE) {
-#ifdef Q_WS_X11
- // Make sure we don't call eglDestroySurface on a surface which
- // was created for a different winId:
- if (d->paintDevice->devType() == QInternal::Widget) {
- QGLWidget* w = static_cast<QGLWidget*>(d->paintDevice);
-
- if (w->d_func()->eglSurfaceWindowId == w->winId())
- eglDestroySurface(d->eglContext->display(), d->eglSurface);
- } else
-#endif
- eglDestroySurface(d->eglContext->display(), d->eglSurface);
- }
+ d->destroyEglSurfaceForDevice();
delete d->eglContext;
}
d->eglContext = 0;
@@ -164,7 +152,7 @@ void QGLContext::reset()
d->valid = false;
d->transpColor = QColor();
d->initDone = false;
- qgl_share_reg()->removeShare(this);
+ QGLContextGroup::removeShare(this);
}
void QGLContext::makeCurrent()
@@ -198,6 +186,26 @@ void QGLContext::swapBuffers() const
d->eglContext->swapBuffers(d->eglSurface);
}
+void QGLContextPrivate::destroyEglSurfaceForDevice()
+{
+ if (eglSurface != EGL_NO_SURFACE) {
+#ifdef Q_WS_X11
+ // Make sure we don't call eglDestroySurface on a surface which
+ // was created for a different winId:
+ if (paintDevice->devType() == QInternal::Widget) {
+ QGLWidget* w = static_cast<QGLWidget*>(paintDevice);
+
+ if (w->d_func()->eglSurfaceWindowId == w->winId())
+ eglDestroySurface(eglContext->display(), eglSurface);
+ else
+ qWarning("WARNING: Potential EGL surface leak!");
+ } else
+#endif
+ eglDestroySurface(eglContext->display(), eglSurface);
+ eglSurface = EGL_NO_SURFACE;
+ }
+}
+
void QGLWidget::setMouseTracking(bool enable)
{
QWidget::setMouseTracking(enable);
diff --git a/src/opengl/qgl_mac.mm b/src/opengl/qgl_mac.mm
index 4dd822d..8ecc48b 100644
--- a/src/opengl/qgl_mac.mm
+++ b/src/opengl/qgl_mac.mm
@@ -476,7 +476,7 @@ void QGLContext::reset()
d->valid = false;
d->transpColor = QColor();
d->initDone = false;
- qgl_share_reg()->removeShare(this);
+ QGLContextGroup::removeShare(this);
}
void QGLContext::makeCurrent()
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index 179d69a..fcfe791 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -133,9 +133,6 @@ public:
: ref(1)
{
opts = QGL::DoubleBuffer | QGL::DepthBuffer | QGL::Rgba | QGL::DirectRendering | QGL::StencilBuffer;
-#if defined(QT_OPENGL_ES_2)
- opts |= QGL::SampleBuffers;
-#endif
pln = 0;
depthSize = accumSize = stencilSize = redSize = greenSize = blueSize = alphaSize = -1;
numSamples = -1;
@@ -225,9 +222,8 @@ class QGLSharedResourceGuard;
typedef QHash<QString, GLuint> QGLDDSCache;
// QGLContextPrivate has the responsibility of creating context groups.
-// QGLContextPrivate and QGLShareRegister will both maintain the reference counter and destroy
+// QGLContextPrivate maintains the reference counter and destroys
// context groups when needed.
-// QGLShareRegister has the responsibility of keeping the context pointer up to date.
class QGLContextGroup
{
public:
@@ -236,9 +232,13 @@ public:
QGLExtensionFuncs &extensionFuncs() {return m_extensionFuncs;}
const QGLContext *context() const {return m_context;}
bool isSharing() const { return m_shares.size() >= 2; }
+ QList<const QGLContext *> shares() const { return m_shares; }
void addGuard(QGLSharedResourceGuard *guard);
void removeGuard(QGLSharedResourceGuard *guard);
+
+ static void addShare(const QGLContext *context, const QGLContext *share);
+ static void removeShare(const QGLContext *context);
private:
QGLContextGroup(const QGLContext *context) : m_context(context), m_guards(0), m_refs(1) { }
@@ -252,14 +252,21 @@ private:
void cleanupResources(const QGLContext *ctx);
- friend class QGLShareRegister;
friend class QGLContext;
friend class QGLContextPrivate;
friend class QGLContextResource;
};
+// Get the context that resources for "ctx" will transfer to once
+// "ctx" is destroyed. Returns null if nothing is sharing with ctx.
+Q_OPENGL_EXPORT const QGLContext *qt_gl_transfer_context(const QGLContext *);
+
class QGLTexture;
+// This probably needs to grow to GL_MAX_VERTEX_ATTRIBS, but 3 is ok for now as that's
+// all the GL2 engine uses:
+#define QT_GL_VERTEX_ARRAY_TRACKED_COUNT 3
+
class QGLContextPrivate
{
Q_DECLARE_PUBLIC(QGLContext)
@@ -279,6 +286,9 @@ public:
void cleanup();
+ void setVertexAttribArrayEnabled(int arrayIndex, bool enabled = true);
+ void syncGlState(); // Makes sure the GL context's state is what we think it is
+
#if defined(Q_WS_WIN)
HGLRC rc;
HDC dc;
@@ -291,6 +301,7 @@ public:
#if defined(QT_OPENGL_ES)
QEglContext *eglContext;
EGLSurface eglSurface;
+ void destroyEglSurfaceForDevice();
#elif defined(Q_WS_X11) || defined(Q_WS_MAC)
void* cx;
#endif
@@ -334,6 +345,8 @@ public:
GLuint default_fbo;
QPaintEngine *active_engine;
+ bool vertexAttributeArraysEnabledState[QT_GL_VERTEX_ARRAY_TRACKED_COUNT];
+
static inline QGLContextGroup *contextGroup(const QGLContext *ctx) { return ctx->d_ptr->group; }
#ifdef Q_WS_WIN
@@ -397,19 +410,6 @@ public:
Q_DECLARE_OPERATORS_FOR_FLAGS(QGLExtensions::Extensions)
-class Q_AUTOTEST_EXPORT QGLShareRegister
-{
-public:
- QGLShareRegister() {}
- ~QGLShareRegister() {}
-
- void addShare(const QGLContext *context, const QGLContext *share);
- QList<const QGLContext *> shares(const QGLContext *context);
- void removeShare(const QGLContext *context);
-};
-
-extern Q_OPENGL_EXPORT QGLShareRegister* qgl_share_reg();
-
// Temporarily make a context current if not already current or
// shared with the current contex. The previous context is made
// current when the object goes out of scope.
@@ -613,6 +613,49 @@ private:
friend class QGLContextGroup;
};
+
+// This class can be used to match GL extensions with doing any mallocs. The
+// class assumes that the GL extension string ends with a space character,
+// which it should do on all conformant platforms. Create the object and pass
+// in a pointer to the extension string, then call match() on each extension
+// that should be matched. The match() function takes the extension name
+// *without* the terminating space character as input.
+
+class QGLExtensionMatcher
+{
+public:
+ QGLExtensionMatcher(const char *str)
+ : gl_extensions(str), gl_extensions_length(qstrlen(str))
+ {}
+
+ bool match(const char *str) {
+ int str_length = qstrlen(str);
+ const char *extensions = gl_extensions;
+ int extensions_length = gl_extensions_length;
+
+ while (1) {
+ // the total length that needs to be matched is the str_length +
+ // the space character that terminates the extension name
+ if (extensions_length < str_length + 1)
+ return false;
+ if (qstrncmp(extensions, str, str_length) == 0 && extensions[str_length] == ' ')
+ return true;
+
+ int split_pos = 0;
+ while (split_pos < extensions_length && extensions[split_pos] != ' ')
+ ++split_pos;
+ ++split_pos; // added for the terminating space character
+ extensions += split_pos;
+ extensions_length -= split_pos;
+ }
+ return false;
+ }
+
+private:
+ const char *gl_extensions;
+ int gl_extensions_length;
+};
+
QT_END_NAMESPACE
#endif // QGL_P_H
diff --git a/src/opengl/qgl_win.cpp b/src/opengl/qgl_win.cpp
index 5b5820a..f80025d 100644
--- a/src/opengl/qgl_win.cpp
+++ b/src/opengl/qgl_win.cpp
@@ -1145,7 +1145,7 @@ void QGLContext::reset()
delete d->cmap;
d->cmap = 0;
d->initDone = false;
- qgl_share_reg()->removeShare(this);
+ QGLContextGroup::removeShare(this);
}
//
diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp
index a037282..9fca28c 100644
--- a/src/opengl/qgl_x11.cpp
+++ b/src/opengl/qgl_x11.cpp
@@ -343,8 +343,8 @@ void* qglx_getProcAddress(const char* procName)
static bool triedResolvingGlxGetProcAddress = false;
if (!triedResolvingGlxGetProcAddress) {
triedResolvingGlxGetProcAddress = true;
- QList<QByteArray> glxExt = QByteArray(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS)).split(' ');
- if (glxExt.contains("GLX_ARB_get_proc_address")) {
+ QGLExtensionMatcher extensions(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS));
+ if (extensions.match("GLX_ARB_get_proc_address")) {
#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4)
void *handle = dlopen(NULL, RTLD_LAZY);
if (handle) {
@@ -523,8 +523,8 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
if (!d->gpm)
return false;
}
- QList<QByteArray> glxExt = QByteArray(glXQueryExtensionsString(xinfo->display(), xinfo->screen())).split(' ');
- if (glxExt.contains("GLX_SGI_video_sync")) {
+ QGLExtensionMatcher extensions(glXQueryExtensionsString(xinfo->display(), xinfo->screen()));
+ if (extensions.match("GLX_SGI_video_sync")) {
if (d->glFormat.swapInterval() == -1)
d->glFormat.setSwapInterval(0);
} else {
@@ -630,8 +630,8 @@ void *QGLContext::tryVisual(const QGLFormat& f, int bufDepth)
static bool useTranspExt = false;
static bool useTranspExtChecked = false;
if (f.plane() && !useTranspExtChecked && d->paintDevice) {
- QByteArray estr(glXQueryExtensionsString(xinfo->display(), xinfo->screen()));
- useTranspExt = estr.contains("GLX_EXT_visual_info");
+ QGLExtensionMatcher extensions(glXQueryExtensionsString(xinfo->display(), xinfo->screen()));
+ useTranspExt = extensions.match("GLX_EXT_visual_info");
//# (A bit simplistic; that could theoretically be a substring)
if (useTranspExt) {
QByteArray cstr(glXGetClientString(xinfo->display(), GLX_VENDOR));
@@ -825,7 +825,7 @@ void QGLContext::reset()
d->valid = false;
d->transpColor = QColor();
d->initDone = false;
- qgl_share_reg()->removeShare(this);
+ QGLContextGroup::removeShare(this);
}
@@ -875,8 +875,8 @@ void QGLContext::swapBuffers() const
static bool resolved = false;
if (!resolved) {
const QX11Info *xinfo = qt_x11Info(d->paintDevice);
- QList<QByteArray> glxExt = QByteArray(glXQueryExtensionsString(xinfo->display(), xinfo->screen())).split(' ');
- if (glxExt.contains("GLX_SGI_video_sync")) {
+ QGLExtensionMatcher extensions(glXQueryExtensionsString(xinfo->display(), xinfo->screen()));
+ if (extensions.match("GLX_SGI_video_sync")) {
glXGetVideoSyncSGI = (qt_glXGetVideoSyncSGI)qglx_getProcAddress("glXGetVideoSyncSGI");
glXWaitVideoSyncSGI = (qt_glXWaitVideoSyncSGI)qglx_getProcAddress("glXWaitVideoSyncSGI");
}
@@ -1107,8 +1107,8 @@ void *QGLContext::getProcAddress(const QString &proc) const
if (resolved && !glXGetProcAddressARB)
return 0;
if (!glXGetProcAddressARB) {
- QList<QByteArray> glxExt = QByteArray(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS)).split(' ');
- if (glxExt.contains("GLX_ARB_get_proc_address")) {
+ QGLExtensionMatcher extensions(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS));
+ if (extensions.match("GLX_ARB_get_proc_address")) {
#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4)
void *handle = dlopen(NULL, RTLD_LAZY);
if (handle) {
@@ -1132,6 +1132,72 @@ void *QGLContext::getProcAddress(const QString &proc) const
return glXGetProcAddressARB(reinterpret_cast<const GLubyte *>(proc.toLatin1().data()));
}
+//
+// This class is used to create a temporary, minimal GL context, which is used
+// to retrive GL version and extension info. It's significantly faster to
+// construct than a QGLWidget, and it doesn't have the recursive creation
+// problem that QGLWidget would have. E.g. creating a temporary QGLWidget to
+// retrieve GL info as part of the QGLWidget initialization.
+//
+class QGLTempContext
+{
+public:
+ QGLTempContext(int screen = 0) :
+ initialized(false),
+ old_drawable(0),
+ old_context(0)
+ {
+ int attribs[] = {GLX_RGBA, XNone};
+ XVisualInfo *vi = glXChooseVisual(X11->display, screen, attribs);
+ if (!vi) {
+ qWarning("QGLTempContext: No GL capable X visuals available.");
+ return;
+ }
+
+ int useGL;
+ glXGetConfig(X11->display, vi, GLX_USE_GL, &useGL);
+ if (!useGL) {
+ XFree(vi);
+ return;
+ }
+
+ old_drawable = glXGetCurrentDrawable();
+ old_context = glXGetCurrentContext();
+
+ XSetWindowAttributes a;
+ a.colormap = qt_gl_choose_cmap(X11->display, vi);
+ drawable = XCreateWindow(X11->display, RootWindow(X11->display, screen),
+ 0, 0, 1, 1, 0,
+ vi->depth, InputOutput, vi->visual,
+ CWColormap, &a);
+ context = glXCreateContext(X11->display, vi, 0, True);
+ if (context && glXMakeCurrent(X11->display, drawable, context)) {
+ initialized = true;
+ } else {
+ qWarning("QGLTempContext: Unable to create GL context.");
+ XDestroyWindow(X11->display, drawable);
+ }
+ XFree(vi);
+ }
+
+ ~QGLTempContext() {
+ if (initialized) {
+ glXMakeCurrent(X11->display, 0, 0);
+ glXDestroyContext(X11->display, context);
+ XDestroyWindow(X11->display, drawable);
+ }
+ if (old_drawable && old_context)
+ glXMakeCurrent(X11->display, old_drawable, old_context);
+ }
+
+private:
+ bool initialized;
+ Window drawable;
+ GLXContext context;
+ GLXDrawable old_drawable;
+ GLXContext old_context;
+};
+
/*****************************************************************************
QGLOverlayWidget (Internal overlay class for X11)
*****************************************************************************/
@@ -1574,8 +1640,7 @@ void QGLExtensions::init()
return;
init_done = true;
- QGLWidget dmy;
- dmy.makeCurrent();
+ QGLTempContext context;
init_extensions();
// nvidia 9x.xx unix drivers contain a bug which requires us to call glFinish before releasing an fbo
@@ -1609,8 +1674,8 @@ static bool qt_resolveTextureFromPixmap(QPaintDevice *paintDevice)
return false; // Can't use TFP without NPOT
}
const QX11Info *xinfo = qt_x11Info(paintDevice);
- QList<QByteArray> glxExt = QByteArray(glXQueryExtensionsString(xinfo->display(), xinfo->screen())).split(' ');
- if (glxExt.contains("GLX_EXT_texture_from_pixmap")) {
+ QGLExtensionMatcher extensions(glXQueryExtensionsString(xinfo->display(), xinfo->screen()));
+ if (extensions.match("GLX_EXT_texture_from_pixmap")) {
glXBindTexImageEXT = (qt_glXBindTexImageEXT) qglx_getProcAddress("glXBindTexImageEXT");
glXReleaseTexImageEXT = (qt_glXReleaseTexImageEXT) qglx_getProcAddress("glXReleaseTexImageEXT");
}
diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp
index a868e83..271f4de 100644
--- a/src/opengl/qgl_x11egl.cpp
+++ b/src/opengl/qgl_x11egl.cpp
@@ -52,6 +52,116 @@
QT_BEGIN_NAMESPACE
+
+bool qt_egl_setup_x11_visual(XVisualInfo &vi, EGLDisplay display, EGLConfig config,
+ const QX11Info &x11Info, bool useArgbVisual);
+//
+// QGLTempContext is a lass for creating a temporary GL context (which is
+// needed during QGLWidget initialization to retrieve GL extension info).
+// Faster to construct than a full QGLWidget.
+//
+class QGLTempContext
+{
+public:
+ QGLTempContext(int screen = 0) :
+ initialized(false),
+ window(0),
+ context(0),
+ surface(0)
+ {
+ display = eglGetDisplay(EGLNativeDisplayType(X11->display));
+
+ if (!eglInitialize(display, NULL, NULL)) {
+ qWarning("QGLTempContext: Unable to initialize EGL display.");
+ return;
+ }
+
+ EGLConfig config;
+ int numConfigs = 0;
+ EGLint attribs[] = {
+ EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
+#ifdef QT_OPENGL_ES_2
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
+#endif
+ EGL_NONE
+ };
+
+ eglChooseConfig(display, attribs, &config, 1, &numConfigs);
+ if (!numConfigs) {
+ qWarning("QGLTempContext: No EGL configurations available.");
+ return;
+ }
+
+ XVisualInfo visualInfo;
+ XVisualInfo *vi;
+ int numVisuals;
+ EGLint id = 0;
+
+ eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_ID, &id);
+ if (id == 0) {
+ // EGL_NATIVE_VISUAL_ID is optional and might not be supported
+ // on some implementations - we'll have to do it the hard way
+ QX11Info xinfo;
+ qt_egl_setup_x11_visual(visualInfo, display, config, xinfo, false);
+ } else {
+ visualInfo.visualid = id;
+ }
+ vi = XGetVisualInfo(X11->display, VisualIDMask, &visualInfo, &numVisuals);
+ if (!vi || numVisuals < 1) {
+ qWarning("QGLTempContext: Unable to get X11 visual info id.");
+ return;
+ }
+
+ window = XCreateWindow(X11->display, RootWindow(X11->display, screen),
+ 0, 0, 1, 1, 0,
+ vi->depth, InputOutput, vi->visual,
+ 0, 0);
+
+ surface = eglCreateWindowSurface(display, config, (EGLNativeWindowType) window, NULL);
+
+ if (surface == EGL_NO_SURFACE) {
+ qWarning("QGLTempContext: Error creating EGL surface.");
+ XFree(vi);
+ XDestroyWindow(X11->display, window);
+ return;
+ }
+
+ EGLint contextAttribs[] = {
+#ifdef QT_OPENGL_ES_2
+ EGL_CONTEXT_CLIENT_VERSION, 2,
+#endif
+ EGL_NONE
+ };
+ context = eglCreateContext(display, config, 0, contextAttribs);
+ if (context != EGL_NO_CONTEXT
+ && eglMakeCurrent(display, surface, surface, context))
+ {
+ initialized = true;
+ } else {
+ qWarning("QGLTempContext: Error creating EGL context.");
+ eglDestroySurface(display, surface);
+ XDestroyWindow(X11->display, window);
+ }
+ XFree(vi);
+ }
+
+ ~QGLTempContext() {
+ if (initialized) {
+ eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+ eglDestroyContext(display, context);
+ eglDestroySurface(display, surface);
+ XDestroyWindow(X11->display, window);
+ }
+ }
+
+private:
+ bool initialized;
+ Window window;
+ EGLContext context;
+ EGLSurface surface;
+ EGLDisplay display;
+};
+
bool QGLFormat::hasOpenGLOverlays()
{
return false;
@@ -173,10 +283,16 @@ void QGLWidget::updateOverlayGL()
//handle overlay
}
+//#define QT_DEBUG_X11_VISUAL_SELECTION 1
+
bool qt_egl_setup_x11_visual(XVisualInfo &vi, EGLDisplay display, EGLConfig config, const QX11Info &x11Info, bool useArgbVisual)
{
bool foundVisualIsArgb = useArgbVisual;
+#ifdef QT_DEBUG_X11_VISUAL_SELECTION
+ qDebug("qt_egl_setup_x11_visual() - useArgbVisual=%d", useArgbVisual);
+#endif
+
memset(&vi, 0, sizeof(XVisualInfo));
EGLint eglConfigColorSize;
@@ -199,7 +315,9 @@ bool qt_egl_setup_x11_visual(XVisualInfo &vi, EGLDisplay display, EGLConfig conf
XRenderPictFormat *format;
format = XRenderFindVisualFormat(x11Info.display(), chosenVisualInfo->visual);
if (format->type == PictTypeDirect && format->direct.alphaMask) {
-// qDebug("Using ARGB X Visual ID (%d) provided by EGL", (int)vi.visualid);
+#ifdef QT_DEBUG_X11_VISUAL_SELECTION
+ qDebug("Using ARGB X Visual ID (%d) provided by EGL", (int)vi.visualid);
+#endif
foundVisualIsArgb = true;
vi = *chosenVisualInfo;
}
@@ -212,7 +330,9 @@ bool qt_egl_setup_x11_visual(XVisualInfo &vi, EGLDisplay display, EGLConfig conf
#endif
{
if (eglConfigColorSize == chosenVisualInfo->depth) {
-// qDebug("Using opaque X Visual ID (%d) provided by EGL", (int)vi.visualid);
+#ifdef QT_DEBUG_X11_VISUAL_SELECTION
+ qDebug("Using opaque X Visual ID (%d) provided by EGL", (int)vi.visualid);
+#endif
vi = *chosenVisualInfo;
} else
qWarning("Warning: EGL suggested using X visual ID %d (%d bpp) for config %d (%d bpp), but the depths do not match!",
@@ -248,7 +368,9 @@ bool qt_egl_setup_x11_visual(XVisualInfo &vi, EGLDisplay display, EGLConfig conf
if (format->type == PictTypeDirect && format->direct.alphaMask) {
vi = matchingVisuals[i];
foundVisualIsArgb = true;
-// qDebug("Using X Visual ID (%d) for ARGB visual as provided by XRender", (int)vi.visualid);
+#ifdef QT_DEBUG_X11_VISUAL_SELECTION
+ qDebug("Using X Visual ID (%d) for ARGB visual as provided by XRender", (int)vi.visualid);
+#endif
break;
}
}
@@ -272,24 +394,28 @@ bool qt_egl_setup_x11_visual(XVisualInfo &vi, EGLDisplay display, EGLConfig conf
} else
qWarning(" - Falling back to X11 suggested depth (%d)", depth);
}
-// else
-// qDebug("Using X Visual ID (%d) for EGL provided depth (%d)", (int)vi.visualid, depth);
+#ifdef QT_DEBUG_X11_VISUAL_SELECTION
+ else
+ qDebug("Using X Visual ID (%d) for EGL provided depth (%d)", (int)vi.visualid, depth);
+#endif
// Don't try to use ARGB now unless the visual is 32-bit - even then it might stil fail :-(
if (useArgbVisual)
foundVisualIsArgb = vi.depth == 32; //### We might at some point (soon) get ARGB4444
}
-// qDebug("Visual Info:");
-// qDebug(" bits_per_rgb=%d", vi.bits_per_rgb);
-// qDebug(" red_mask=0x%x", vi.red_mask);
-// qDebug(" green_mask=0x%x", vi.green_mask);
-// qDebug(" blue_mask=0x%x", vi.blue_mask);
-// qDebug(" colormap_size=%d", vi.colormap_size);
-// qDebug(" c_class=%d", vi.c_class);
-// qDebug(" depth=%d", vi.depth);
-// qDebug(" screen=%d", vi.screen);
-// qDebug(" visualid=%d", vi.visualid);
+#ifdef QT_DEBUG_X11_VISUAL_SELECTION
+ qDebug("Visual Info:");
+ qDebug(" bits_per_rgb=%d", vi.bits_per_rgb);
+ qDebug(" red_mask=0x%x", vi.red_mask);
+ qDebug(" green_mask=0x%x", vi.green_mask);
+ qDebug(" blue_mask=0x%x", vi.blue_mask);
+ qDebug(" colormap_size=%d", vi.colormap_size);
+ qDebug(" c_class=%d", vi.c_class);
+ qDebug(" depth=%d", vi.depth);
+ qDebug(" screen=%d", vi.screen);
+ qDebug(" visualid=%d", vi.visualid);
+#endif
return foundVisualIsArgb;
}
@@ -320,7 +446,7 @@ void QGLWidget::setContext(QGLContext *context, const QGLContext* shareContext,
// If the application has set WA_TranslucentBackground and not explicitly set
// the alpha buffer size to zero, modify the format so it have an alpha channel
QGLFormat& fmt = d->glcx->d_func()->glFormat;
- const bool tryArgbVisual = testAttribute(Qt::WA_TranslucentBackground);
+ const bool tryArgbVisual = testAttribute(Qt::WA_TranslucentBackground) || fmt.alpha();
if (tryArgbVisual && fmt.alphaBufferSize() == -1)
fmt.setAlphaBufferSize(1);
@@ -430,12 +556,8 @@ void QGLExtensions::init()
init_done = true;
// We need a context current to initialize the extensions.
- QGLWidget tmpWidget;
- tmpWidget.makeCurrent();
-
+ QGLTempContext context;
init_extensions();
-
- tmpWidget.doneCurrent();
}
// Re-creates the EGL surface if the window ID has changed or if force is true
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index d0297c9..4b5c30a 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -597,6 +597,12 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz,
the constructors that take a QGLFramebufferObject parameter, and set the
QGLFramebufferObject::samples() property to a non-zero value.
+ When painting to a QGLFramebufferObject using QPainter, the state of
+ the current GL context will be altered by the paint engine to reflect
+ its needs. Applications should not rely upon the GL state being reset
+ to its original conditions, particularly the current shader program,
+ GL viewport, texture units, and drawing modes.
+
For multisample framebuffer objects a color render buffer is created,
otherwise a texture with the specified texture target is created.
The color render buffer or texture will have the specified internal
diff --git a/src/opengl/qglpixelbuffer.cpp b/src/opengl/qglpixelbuffer.cpp
index 7c97ebb..fab6efc 100644
--- a/src/opengl/qglpixelbuffer.cpp
+++ b/src/opengl/qglpixelbuffer.cpp
@@ -127,7 +127,7 @@ void QGLPixelBufferPrivate::common_init(const QSize &size, const QGLFormat &form
qctx = new QGLContext(format);
qctx->d_func()->sharing = (shareWidget != 0);
if (shareWidget != 0 && shareWidget->d_func()->glcx) {
- qgl_share_reg()->addShare(qctx, shareWidget->d_func()->glcx);
+ QGLContextGroup::addShare(qctx, shareWidget->d_func()->glcx);
shareWidget->d_func()->glcx->d_func()->sharing = true;
}
diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp
index c478630..d4bcbe9 100644
--- a/src/opengl/qglpixmapfilter.cpp
+++ b/src/opengl/qglpixmapfilter.cpp
@@ -55,11 +55,17 @@
#include "qgl_p.h"
#include "private/qapplication_p.h"
+#include "private/qdrawhelper_p.h"
+#include "private/qmemrotate_p.h"
#include "private/qmath_p.h"
#include "qmath.h"
QT_BEGIN_NAMESPACE
+// qpixmapfilter.cpp
+void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed = 0);
+QImage qt_halfScaled(const QImage &source);
+
void QGLPixmapFilterBase::bindTexture(const QPixmap &src) const
{
const_cast<QGLContext *>(QGLContext::currentContext())->d_func()->bindTexture(src, GL_TEXTURE_2D, GL_RGBA, QGLContext::BindOptions(QGLContext::DefaultBindOption | QGLContext::MemoryManagedBindOption));
@@ -102,48 +108,21 @@ private:
class QGLPixmapBlurFilter : public QGLCustomShaderStage, public QGLPixmapFilter<QPixmapBlurFilter>
{
public:
- QGLPixmapBlurFilter(QGraphicsBlurEffect::BlurHints hints);
-
- void setUniforms(QGLShaderProgram *program);
-
- static QByteArray generateGaussianShader(int radius, bool singlePass = false, bool dropShadow = false);
+ QGLPixmapBlurFilter();
protected:
bool processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &srcRect) const;
-
-private:
-
- mutable QSize m_textureSize;
- mutable bool m_horizontalBlur;
- mutable bool m_singlePass;
- mutable bool m_animatedBlur;
-
- mutable qreal m_t;
- mutable QSize m_targetSize;
-
- mutable bool m_haveCached;
- mutable int m_cachedRadius;
- mutable QGraphicsBlurEffect::BlurHints m_hints;
};
class QGLPixmapDropShadowFilter : public QGLCustomShaderStage, public QGLPixmapFilter<QPixmapDropShadowFilter>
{
public:
- QGLPixmapDropShadowFilter(QGraphicsBlurEffect::BlurHints hints);
+ QGLPixmapDropShadowFilter();
void setUniforms(QGLShaderProgram *program);
protected:
bool processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &srcRect) const;
-
-private:
- mutable QSize m_textureSize;
- mutable bool m_horizontalBlur;
- mutable bool m_singlePass;
-
- mutable bool m_haveCached;
- mutable int m_cachedRadius;
- mutable QGraphicsBlurEffect::BlurHints m_hints;
};
extern QGLWidget *qt_gl_share_widget();
@@ -158,31 +137,14 @@ QPixmapFilter *QGL2PaintEngineEx::pixmapFilter(int type, const QPixmapFilter *pr
return d->colorizeFilter.data();
case QPixmapFilter::BlurFilter: {
- const QPixmapBlurFilter *proto = static_cast<const QPixmapBlurFilter *>(prototype);
- if (proto->blurHints() & QGraphicsBlurEffect::AnimationHint) {
- if (!d->animationBlurFilter)
- d->animationBlurFilter.reset(new QGLPixmapBlurFilter(proto->blurHints()));
- return d->animationBlurFilter.data();
- }
- if ((proto->blurHints() & QGraphicsBlurEffect::QualityHint) && proto->radius() > 5) {
- if (!d->blurFilter)
- d->blurFilter.reset(new QGLPixmapBlurFilter(QGraphicsBlurEffect::QualityHint));
- return d->blurFilter.data();
- }
- if (!d->fastBlurFilter)
- d->fastBlurFilter.reset(new QGLPixmapBlurFilter(QGraphicsBlurEffect::PerformanceHint));
- return d->fastBlurFilter.data();
+ if (!d->blurFilter)
+ d->blurFilter.reset(new QGLPixmapBlurFilter());
+ return d->blurFilter.data();
}
case QPixmapFilter::DropShadowFilter: {
- const QPixmapDropShadowFilter *proto = static_cast<const QPixmapDropShadowFilter *>(prototype);
- if (proto->blurRadius() <= 5) {
- if (!d->fastDropShadowFilter)
- d->fastDropShadowFilter.reset(new QGLPixmapDropShadowFilter(QGraphicsBlurEffect::PerformanceHint));
- return d->fastDropShadowFilter.data();
- }
if (!d->dropShadowFilter)
- d->dropShadowFilter.reset(new QGLPixmapDropShadowFilter(QGraphicsBlurEffect::QualityHint));
+ d->dropShadowFilter.reset(new QGLPixmapDropShadowFilter());
return d->dropShadowFilter.data();
}
@@ -311,59 +273,43 @@ bool QGLPixmapConvolutionFilter::processGL(QPainter *painter, const QPointF &pos
return true;
}
-static const char *qt_gl_texture_sampling_helper =
- "lowp float texture2DAlpha(lowp sampler2D src, highp vec2 srcCoords) {\n"
- " return texture2D(src, srcCoords).a;\n"
- "}\n";
-
-QGLPixmapBlurFilter::QGLPixmapBlurFilter(QGraphicsBlurEffect::BlurHints hints)
- : m_animatedBlur(false)
- , m_haveCached(false)
- , m_cachedRadius(0)
- , m_hints(hints)
-{
-}
-
-// should be even numbers as they will be divided by two
-static const int qCachedBlurLevels[] = { 6, 14, 30 };
-static const int qNumCachedBlurTextures = sizeof(qCachedBlurLevels) / sizeof(*qCachedBlurLevels);
-static const int qMaxCachedBlurLevel = qCachedBlurLevels[qNumCachedBlurTextures - 1];
-
-static qreal qLogBlurLevel(int level)
+QGLPixmapBlurFilter::QGLPixmapBlurFilter()
{
- static bool initialized = false;
- static qreal logBlurLevelCache[qNumCachedBlurTextures];
- if (!initialized) {
- for (int i = 0; i < qNumCachedBlurTextures; ++i)
- logBlurLevelCache[i] = qLn(qCachedBlurLevels[i]);
- initialized = true;
- }
- return logBlurLevelCache[level];
}
class QGLBlurTextureInfo
{
public:
- QGLBlurTextureInfo(QSize size, GLuint textureIds[])
- : m_size(size)
+ QGLBlurTextureInfo(const QImage &image, GLuint tex, qreal r)
+ : m_texture(tex)
+ , m_radius(r)
{
- for (int i = 0; i < qNumCachedBlurTextures; ++i)
- m_textureIds[i] = textureIds[i];
+ m_paddedImage << image;
}
~QGLBlurTextureInfo()
{
- glDeleteTextures(qNumCachedBlurTextures, m_textureIds);
+ glDeleteTextures(1, &m_texture);
}
- QSize size() const { return m_size; }
- GLuint textureId(int i) const { return m_textureIds[i]; }
+ QImage paddedImage(int scaleLevel = 0) const;
+ GLuint texture() const { return m_texture; }
+ qreal radius() const { return m_radius; }
private:
- GLuint m_textureIds[qNumCachedBlurTextures];
- QSize m_size;
+ mutable QList<QImage> m_paddedImage;
+ GLuint m_texture;
+ qreal m_radius;
};
+QImage QGLBlurTextureInfo::paddedImage(int scaleLevel) const
+{
+ for (int i = m_paddedImage.size() - 1; i <= scaleLevel; ++i)
+ m_paddedImage << qt_halfScaled(m_paddedImage.at(i));
+
+ return m_paddedImage.at(scaleLevel);
+}
+
class QGLBlurTextureCache : public QObject
{
public:
@@ -373,7 +319,6 @@ public:
~QGLBlurTextureCache();
QGLBlurTextureInfo *takeBlurTextureInfo(const QPixmap &pixmap);
- bool fitsInCache(const QPixmap &pixmap) const;
bool hasBlurTextureInfo(const QPixmap &pixmap) const;
void insertBlurTextureInfo(const QPixmap &pixmap, QGLBlurTextureInfo *info);
void clearBlurTextureInfo(const QPixmap &pixmap);
@@ -458,12 +403,7 @@ void QGLBlurTextureCache::insertBlurTextureInfo(const QPixmap &pixmap, QGLBlurTe
if (timerId)
killTimer(timerId);
- timerId = startTimer(1000);
-}
-
-bool QGLBlurTextureCache::fitsInCache(const QPixmap &pixmap) const
-{
- return pixmap.width() * pixmap.height() <= cache.maxCost();
+ timerId = startTimer(8000);
}
void QGLBlurTextureCache::pixmapDestroyed(QPixmap *pixmap)
@@ -474,567 +414,217 @@ void QGLBlurTextureCache::pixmapDestroyed(QPixmap *pixmap)
}
}
-static const char *qt_gl_interpolate_filter =
- "uniform lowp float interpolationValue;"
- "uniform lowp sampler2D interpolateTarget;"
- "uniform highp vec4 interpolateMapping;"
- "lowp vec4 customShader(lowp sampler2D src, highp vec2 srcCoords)"
- "{"
- " return mix(texture2D(interpolateTarget, interpolateMapping.xy + interpolateMapping.zw * srcCoords),"
- " texture2D(src, srcCoords), interpolationValue);"
- "}";
+static const int qAnimatedBlurLevelIncrement = 16;
+static const int qMaxBlurHalfScaleLevel = 1;
-static void initializeTexture(GLuint id, int width, int height)
+static GLuint generateBlurTexture(const QSize &size, GLenum format = GL_RGBA)
{
- glBindTexture(GL_TEXTURE_2D, id);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, NULL);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glBindTexture(GL_TEXTURE_2D, 0);
+ GLuint texture;
+ glGenTextures(1, &texture);
+ glBindTexture(GL_TEXTURE_2D, texture);
+ glTexImage2D(GL_TEXTURE_2D, 0, format, size.width(), size.height(), 0, format,
+ GL_UNSIGNED_BYTE, 0);
+ return texture;
}
-bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &) const
+static inline uint nextMultiple(uint x, uint multiplier)
{
- QGLPixmapBlurFilter *filter = const_cast<QGLPixmapBlurFilter *>(this);
-
- QGLContext *ctx = const_cast<QGLContext *>(QGLContext::currentContext());
- QGLBlurTextureCache *blurTextureCache = QGLBlurTextureCache::cacheForContext(ctx);
-
- if ((m_hints & QGraphicsBlurEffect::AnimationHint) && blurTextureCache->fitsInCache(src)) {
- QRect targetRect = src.rect().adjusted(-qMaxCachedBlurLevel, -qMaxCachedBlurLevel, qMaxCachedBlurLevel, qMaxCachedBlurLevel);
- // ensure even dimensions (going to divide by two)
- targetRect.setWidth((targetRect.width() + 1) & ~1);
- targetRect.setHeight((targetRect.height() + 1) & ~1);
-
- QGLBlurTextureInfo *info = 0;
- if (blurTextureCache->hasBlurTextureInfo(src)) {
- info = blurTextureCache->takeBlurTextureInfo(src);
- } else {
- m_animatedBlur = false;
- m_hints = QGraphicsBlurEffect::QualityHint;
- m_singlePass = false;
-
- QGLFramebufferObjectFormat format;
- format.setInternalTextureFormat(GLenum(GL_RGBA));
- QGLFramebufferObject *fbo = qgl_fbo_pool()->acquire(targetRect.size() / 2, format, true);
-
- if (!fbo)
- return false;
-
- QPainter fboPainter(fbo);
- QGL2PaintEngineEx *engine = static_cast<QGL2PaintEngineEx *>(fboPainter.paintEngine());
-
- glClearColor(0, 0, 0, 0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- // ensure GL_LINEAR filtering is used for scaling down to half the size
- fboPainter.setRenderHint(QPainter::SmoothPixmapTransform);
- fboPainter.setCompositionMode(QPainter::CompositionMode_Source);
- fboPainter.drawPixmap(qMaxCachedBlurLevel / 2, qMaxCachedBlurLevel / 2,
- targetRect.width() / 2 - qMaxCachedBlurLevel, targetRect.height() / 2 - qMaxCachedBlurLevel, src);
-
- GLuint textures[qNumCachedBlurTextures]; // blur textures
- glGenTextures(qNumCachedBlurTextures, textures);
- GLuint temp; // temp texture
- glGenTextures(1, &temp);
-
- initializeTexture(temp, fbo->width(), fbo->height());
- m_textureSize = fbo->size();
-
- int currentBlur = 0;
-
- QRect fboRect(0, 0, fbo->width(), fbo->height());
- GLuint sourceTexture = fbo->texture();
- for (int i = 0; i < qNumCachedBlurTextures; ++i) {
- int targetBlur = qCachedBlurLevels[i] / 2;
-
- int blurDelta = qRound(qSqrt(targetBlur * targetBlur - currentBlur * currentBlur));
- QByteArray source = generateGaussianShader(blurDelta);
- filter->setSource(source);
-
- currentBlur = targetBlur;
-
- // now we're going to be nasty and keep using the same FBO with different textures
- glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
- GL_TEXTURE_2D, temp, 0);
-
- m_horizontalBlur = true;
- filter->setOnPainter(&fboPainter);
- engine->drawTexture(fboRect, sourceTexture, fbo->size(), fboRect);
- filter->removeFromPainter(&fboPainter);
-
- sourceTexture = textures[i];
- initializeTexture(sourceTexture, fbo->width(), fbo->height());
-
- glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
- GL_TEXTURE_2D, textures[i], 0);
-
- m_horizontalBlur = false;
- filter->setOnPainter(&fboPainter);
- engine->drawTexture(fboRect, temp, fbo->size(), fboRect);
- filter->removeFromPainter(&fboPainter);
- }
-
- glDeleteTextures(1, &temp);
+ uint mod = x % multiplier;
+ if (mod == 0)
+ return x;
+ return x + multiplier - mod;
+}
- // reattach the original FBO texture
- glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
- GL_TEXTURE_2D, fbo->texture(), 0);
+void qt_memrotate90_gl(const quint32 *src, int srcWidth, int srcHeight, int srcStride,
+ quint32 *dest, int dstStride);
- fboPainter.end();
+bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &) const
+{
+ if (radius() < 1) {
+ painter->drawPixmap(pos, src);
+ return true;
+ }
- qgl_fbo_pool()->release(fbo);
+ qreal actualRadius = radius();
- info = new QGLBlurTextureInfo(fboRect.size(), textures);
- }
+ QGLContext *ctx = const_cast<QGLContext *>(QGLContext::currentContext());
- if (!m_haveCached || !m_animatedBlur) {
- m_haveCached = true;
- m_animatedBlur = true;
- m_hints = QGraphicsBlurEffect::AnimationHint;
- filter->setSource(qt_gl_interpolate_filter);
- }
+ QGLBlurTextureCache *blurTextureCache = QGLBlurTextureCache::cacheForContext(ctx);
+ QGLBlurTextureInfo *info = 0;
+ int padding = nextMultiple(qCeil(actualRadius), qAnimatedBlurLevelIncrement);
+ QRect targetRect = src.rect().adjusted(-padding, -padding, padding, padding);
- QGL2PaintEngineEx *engine = static_cast<QGL2PaintEngineEx *>(painter->paintEngine());
- painter->setRenderHint(QPainter::SmoothPixmapTransform);
- filter->setOnPainter(painter);
+ // pad so that we'll be able to half-scale qMaxBlurHalfScaleLevel times
+ targetRect.setWidth((targetRect.width() + (qMaxBlurHalfScaleLevel-1)) & ~(qMaxBlurHalfScaleLevel-1));
+ targetRect.setHeight((targetRect.height() + (qMaxBlurHalfScaleLevel-1)) & ~(qMaxBlurHalfScaleLevel-1));
- qreal logRadius = qLn(radius());
+ QSize textureSize;
- int t;
- for (t = -1; t < qNumCachedBlurTextures - 2; ++t) {
- if (logRadius < qLogBlurLevel(t+1))
- break;
- }
+ info = blurTextureCache->takeBlurTextureInfo(src);
+ if (!info || info->radius() < actualRadius) {
+ QSize paddedSize = targetRect.size() / 2;
- qreal logBase = t >= 0 ? qLogBlurLevel(t) : 0;
- m_t = qBound(qreal(0), (logRadius - logBase) / (qLogBlurLevel(t+1) - logBase), qreal(1));
+ QImage padded(paddedSize.height(), paddedSize.width(), QImage::Format_ARGB32_Premultiplied);
+ padded.fill(0);
- m_textureSize = info->size();
+ if (info) {
+ int oldPadding = qRound(info->radius());
- glActiveTexture(GL_TEXTURE0 + 3);
- if (t >= 0) {
- glBindTexture(GL_TEXTURE_2D, info->textureId(t));
- m_targetSize = info->size();
+ QPainter p(&padded);
+ p.setCompositionMode(QPainter::CompositionMode_Source);
+ p.drawImage((padding - oldPadding) / 2, (padding - oldPadding) / 2, info->paddedImage());
+ p.end();
} else {
- QGLTexture *texture =
- ctx->d_func()->bindTexture(src, GL_TEXTURE_2D, GL_RGBA,
- QGLContext::InternalBindOption
- | QGLContext::CanFlipNativePixmapBindOption);
- m_targetSize = src.size();
- if (!(texture->options & QGLContext::InvertedYBindOption))
- m_targetSize.setHeight(-m_targetSize.height());
+ // TODO: combine byteswapping and memrotating into one by declaring
+ // custom GL_RGBA pixel type and qt_colorConvert template for it
+ QImage prepadded = qt_halfScaled(src.toImage()).convertToFormat(QImage::Format_ARGB32_Premultiplied);
+
+ // byte-swap and memrotates in one go
+ qt_memrotate90_gl(reinterpret_cast<const quint32*>(prepadded.bits()),
+ prepadded.width(), prepadded.height(), prepadded.bytesPerLine(),
+ reinterpret_cast<quint32*>(padded.scanLine(padding / 2)) + padding / 2,
+ padded.bytesPerLine());
}
- // restrict the target rect to the max of the radii we are interpolating between
- int radiusDelta = qMaxCachedBlurLevel - qCachedBlurLevels[t+1];
- targetRect = targetRect.translated(pos.toPoint()).adjusted(radiusDelta, radiusDelta, -radiusDelta, -radiusDelta);
-
- radiusDelta /= 2;
- QRect sourceRect = QRect(QPoint(), m_textureSize).adjusted(radiusDelta, radiusDelta, -radiusDelta, -radiusDelta);
-
- engine->drawTexture(targetRect, info->textureId(t+1), m_textureSize, sourceRect);
-
- glActiveTexture(GL_TEXTURE0 + 3);
- glBindTexture(GL_TEXTURE_2D, 0);
-
- filter->removeFromPainter(painter);
- blurTextureCache->insertBlurTextureInfo(src, info);
-
- return true;
- }
+ delete info;
+ info = new QGLBlurTextureInfo(padded, generateBlurTexture(paddedSize), padding);
- if (blurTextureCache->hasBlurTextureInfo(src))
- blurTextureCache->clearBlurTextureInfo(src);
-
- int actualRadius = qRound(radius());
- int filterRadius = actualRadius;
- int fastRadii[] = { 1, 2, 3, 5, 8, 15, 25 };
- if (!(m_hints & QGraphicsBlurEffect::QualityHint)) {
- uint i = 0;
- for (; i < (sizeof(fastRadii)/sizeof(*fastRadii))-1; ++i) {
- if (fastRadii[i+1] > filterRadius)
- break;
- }
- filterRadius = fastRadii[i];
+ textureSize = paddedSize;
+ } else {
+ textureSize = QSize(info->paddedImage().height(), info->paddedImage().width());
}
- m_singlePass = filterRadius <= 3;
-
- if (!m_haveCached || m_animatedBlur || filterRadius != m_cachedRadius) {
- // Only regenerate the shader from source if parameters have changed.
- m_haveCached = true;
- m_animatedBlur = false;
- m_cachedRadius = filterRadius;
- QByteArray source = generateGaussianShader(filterRadius, m_singlePass);
- filter->setSource(source);
+ actualRadius *= qreal(0.5);
+ int level = 1;
+ for (; level < qMaxBlurHalfScaleLevel; ++level) {
+ if (actualRadius <= 16)
+ break;
+ actualRadius *= qreal(0.5);
}
- QRect targetRect = QRectF(src.rect()).translated(pos).adjusted(-actualRadius, -actualRadius, actualRadius, actualRadius).toAlignedRect();
+ const int s = (1 << level);
- if (m_singlePass) {
- // prepare for updateUniforms
- m_textureSize = src.size();
+ int prepadding = qRound(info->radius());
+ padding = qMin(prepadding, qCeil(actualRadius) << level);
+ targetRect = src.rect().adjusted(-padding, -padding, padding, padding);
- // ensure GL_LINEAR filtering is used
- painter->setRenderHint(QPainter::SmoothPixmapTransform);
- filter->setOnPainter(painter);
- QBrush pixmapBrush = src;
- pixmapBrush.setTransform(QTransform::fromTranslate(pos.x(), pos.y()));
- painter->fillRect(targetRect, pixmapBrush);
- filter->removeFromPainter(painter);
- } else {
- QGLFramebufferObjectFormat format;
- format.setInternalTextureFormat(GLenum(src.hasAlphaChannel() ? GL_RGBA : GL_RGB));
- QGLFramebufferObject *fbo = qgl_fbo_pool()->acquire(targetRect.size(), format);
+ targetRect.setWidth(targetRect.width() & ~(s-1));
+ targetRect.setHeight(targetRect.height() & ~(s-1));
- if (!fbo)
- return false;
+ int paddingDelta = (prepadding - padding) >> level;
- // prepare for updateUniforms
- m_textureSize = src.size();
+ QRect subRect(paddingDelta, paddingDelta, targetRect.width() >> level, targetRect.height() >> level);
+ QImage sourceImage = info->paddedImage(level-1);
- // horizontal pass, to pixmap
- m_horizontalBlur = true;
+ QImage subImage(subRect.height(), subRect.width(), QImage::Format_ARGB32_Premultiplied);
+ qt_rectcopy((QRgb *)subImage.bits(), ((QRgb *)sourceImage.scanLine(paddingDelta)) + paddingDelta,
+ 0, 0, subRect.height(), subRect.width(), subImage.bytesPerLine(), sourceImage.bytesPerLine());
- QPainter fboPainter(fbo);
+ GLuint texture = info->texture();
- glClearColor(0, 0, 0, 0);
- glClear(GL_COLOR_BUFFER_BIT);
+ qt_blurImage(subImage, actualRadius, blurHints() & QGraphicsBlurEffect::QualityHint, 1);
- // ensure GL_LINEAR filtering is used
- fboPainter.setRenderHint(QPainter::SmoothPixmapTransform);
- fboPainter.setCompositionMode(QPainter::CompositionMode_Source);
- filter->setOnPainter(&fboPainter);
- QBrush pixmapBrush = src;
- pixmapBrush.setTransform(QTransform::fromTranslate(actualRadius, actualRadius));
- fboPainter.fillRect(QRect(0, 0, targetRect.width(), targetRect.height()), pixmapBrush);
- filter->removeFromPainter(&fboPainter);
- fboPainter.end();
+ // subtract one pixel off the end to prevent the bilinear sampling from sampling uninitialized data
+ QRect textureSubRect = subImage.rect().adjusted(0, 0, -1, -1);
+ QRectF targetRectF = QRectF(targetRect).adjusted(0, 0, -targetRect.width() / qreal(textureSize.width()), -targetRect.height() / qreal(textureSize.height()));
- QGL2PaintEngineEx *engine = static_cast<QGL2PaintEngineEx *>(painter->paintEngine());
+ glBindTexture(GL_TEXTURE_2D, texture);
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, subImage.width(), subImage.height(), GL_RGBA,
+ GL_UNSIGNED_BYTE, const_cast<const QImage &>(subImage).bits());
- // vertical pass, to painter
- m_horizontalBlur = false;
- m_textureSize = fbo->size();
+ QGL2PaintEngineEx *engine = static_cast<QGL2PaintEngineEx *>(painter->paintEngine());
+ painter->setRenderHint(QPainter::SmoothPixmapTransform);
- painter->save();
- // ensure GL_LINEAR filtering is used
- painter->setRenderHint(QPainter::SmoothPixmapTransform);
- filter->setOnPainter(painter);
- engine->drawTexture(targetRect, fbo->texture(), fbo->size(), QRect(QPoint(), targetRect.size()).translated(0, fbo->height() - targetRect.height()));
- filter->removeFromPainter(painter);
- painter->restore();
+ // texture is flipped on the y-axis
+ targetRectF = QRectF(targetRectF.x(), targetRectF.bottom(), targetRectF.width(), -targetRectF.height());
+ engine->drawTexture(targetRectF.translated(pos), texture, textureSize, textureSubRect);
- qgl_fbo_pool()->release(fbo);
- }
+ blurTextureCache->insertBlurTextureInfo(src, info);
return true;
}
-void QGLPixmapBlurFilter::setUniforms(QGLShaderProgram *program)
-{
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
- if (m_animatedBlur) {
- program->setUniformValue("interpolateTarget", 3);
- program->setUniformValue("interpolationValue", GLfloat(m_t));
-
- if (m_textureSize == m_targetSize) {
- program->setUniformValue("interpolateMapping", 0.0f, 0.0f, 1.0f, 1.0f);
- } else {
- float offsetX = (-qMaxCachedBlurLevel - 0.5) / qreal(m_targetSize.width());
- float offsetY = (-qMaxCachedBlurLevel - 0.5) / qreal(m_targetSize.height());
-
- if (m_targetSize.height() < 0)
- offsetY = 1 + offsetY;
-
- float scaleX = 2.0f * qreal(m_textureSize.width()) / qreal(m_targetSize.width());
- float scaleY = 2.0f * qreal(m_textureSize.height()) / qreal(m_targetSize.height());
-
- program->setUniformValue("interpolateMapping", offsetX, offsetY, scaleX, scaleY);
- }
-
- return;
- }
+static const char *qt_gl_drop_shadow_filter =
+ "uniform lowp vec4 shadowColor;"
+ "lowp vec4 customShader(lowp sampler2D src, highp vec2 srcCoords)"
+ "{"
+ " return shadowColor * texture2D(src, srcCoords.yx).a;"
+ "}";
- if (m_hints & QGraphicsBlurEffect::QualityHint) {
- if (m_singlePass)
- program->setUniformValue("delta", 1.0 / m_textureSize.width(), 1.0 / m_textureSize.height());
- else if (m_horizontalBlur)
- program->setUniformValue("delta", 1.0 / m_textureSize.width(), 0.0);
- else
- program->setUniformValue("delta", 0.0, 1.0 / m_textureSize.height());
- } else {
- qreal blur = radius() / qreal(m_cachedRadius);
-
- if (m_singlePass)
- program->setUniformValue("delta", blur / m_textureSize.width(), blur / m_textureSize.height());
- else if (m_horizontalBlur)
- program->setUniformValue("delta", blur / m_textureSize.width(), 0.0);
- else
- program->setUniformValue("delta", 0.0, blur / m_textureSize.height());
- }
-}
-static inline qreal gaussian(qreal dx, qreal sigma)
+QGLPixmapDropShadowFilter::QGLPixmapDropShadowFilter()
{
- return exp(-dx * dx / (2 * sigma * sigma)) / (Q_2PI * sigma * sigma);
+ setSource(qt_gl_drop_shadow_filter);
}
-QByteArray QGLPixmapBlurFilter::generateGaussianShader(int radius, bool singlePass, bool dropShadow)
+bool QGLPixmapDropShadowFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &srcRect) const
{
- Q_ASSERT(radius >= 1);
-
- radius = qMin(127, radius);
-
- static QCache<uint, QByteArray> shaderSourceCache;
- uint key = radius | (int(singlePass) << 7) | (int(dropShadow) << 8);
- QByteArray *cached = shaderSourceCache.object(key);
- if (cached)
- return *cached;
-
- QByteArray source;
- source.reserve(1000);
- source.append(qt_gl_texture_sampling_helper);
-
- source.append("uniform highp vec2 delta;\n");
- if (dropShadow)
- source.append("uniform mediump vec4 shadowColor;\n");
- source.append("lowp vec4 customShader(lowp sampler2D src, highp vec2 srcCoords) {\n");
-
- QVector<qreal> sampleOffsets;
- QVector<qreal> weights;
-
- QVector<qreal> gaussianComponents;
-
- qreal sigma = radius / 1.65;
-
- qreal sum = 0;
- for (int i = -radius; i < radius; ++i) {
- float value = gaussian(i, sigma);
- gaussianComponents << value;
- sum += value;
- }
-
- // normalize
- for (int i = 0; i < gaussianComponents.size(); ++i)
- gaussianComponents[i] /= sum;
-
- for (int i = 0; i < gaussianComponents.size() - 1; i += 2) {
- qreal weight = gaussianComponents.at(i) + gaussianComponents.at(i + 1);
- qreal offset = i - radius + gaussianComponents.at(i + 1) / weight;
-
- sampleOffsets << offset;
- weights << weight;
- }
-
- int limit = sampleOffsets.size();
- if (singlePass)
- limit *= limit;
-
- QByteArray baseCoordinate = "srcCoords";
-
- for (int i = 0; i < limit; ++i) {
- QByteArray coordinate = baseCoordinate;
-
- qreal weight;
- if (singlePass) {
- const int xIndex = i % sampleOffsets.size();
- const int yIndex = i / sampleOffsets.size();
-
- const qreal deltaX = sampleOffsets.at(xIndex);
- const qreal deltaY = sampleOffsets.at(yIndex);
- weight = weights.at(xIndex) * weights.at(yIndex);
-
- if (!qFuzzyCompare(deltaX, deltaY)) {
- coordinate.append(" + vec2(delta.x * float(");
- coordinate.append(QByteArray::number(deltaX));
- coordinate.append("), delta.y * float(");
- coordinate.append(QByteArray::number(deltaY));
- coordinate.append("))");
- } else if (!qFuzzyIsNull(deltaX)) {
- coordinate.append(" + delta * float(");
- coordinate.append(QByteArray::number(deltaX));
- coordinate.append(")");
- }
- } else {
- const qreal delta = sampleOffsets.at(i);
- weight = weights.at(i);
- if (!qFuzzyIsNull(delta)) {
- coordinate.append(" + delta * float(");
- coordinate.append(QByteArray::number(delta));
- coordinate.append(")");
- }
- }
-
- if (i == 0) {
- if (dropShadow)
- source.append(" mediump float sample = ");
- else
- source.append(" mediump vec4 sample = ");
- } else {
- if (dropShadow)
- source.append(" sample += ");
- else
- source.append(" sample += ");
- }
+ QGLPixmapDropShadowFilter *filter = const_cast<QGLPixmapDropShadowFilter *>(this);
- source.append("texture2D(src, ");
- source.append(coordinate);
- source.append(")");
+ qreal r = blurRadius();
+ QRectF targetRectUnaligned = QRectF(src.rect()).translated(pos + offset()).adjusted(-r, -r, r, r);
+ QRect targetRect = targetRectUnaligned.toAlignedRect();
- if (dropShadow)
- source.append(".a");
+ // ensure even dimensions (going to divide by two)
+ targetRect.setWidth((targetRect.width() + 1) & ~1);
+ targetRect.setHeight((targetRect.height() + 1) & ~1);
- if (!qFuzzyCompare(weight, qreal(1))) {
- source.append(" * float(");
- source.append(QByteArray::number(weight));
- source.append(");\n");
- } else {
- source.append(";\n");
- }
- }
+ QGLContext *ctx = const_cast<QGLContext *>(QGLContext::currentContext());
+ QGLBlurTextureCache *blurTextureCache = QGLBlurTextureCache::cacheForContext(ctx);
- source.append(" return ");
- if (dropShadow)
- source.append("shadowColor * ");
- source.append("sample;\n");
- source.append("}\n");
+ QGLBlurTextureInfo *info = blurTextureCache->takeBlurTextureInfo(src);
+ if (!info || info->radius() != r) {
+ QImage half = qt_halfScaled(src.toImage().alphaChannel());
- cached = new QByteArray(source);
- shaderSourceCache.insert(key, cached);
+ qreal rx = r + targetRect.left() - targetRectUnaligned.left();
+ qreal ry = r + targetRect.top() - targetRectUnaligned.top();
- return source;
-}
+ QImage image = QImage(targetRect.size() / 2, QImage::Format_Indexed8);
+ image.setColorTable(half.colorTable());
+ image.fill(0);
+ int dx = qRound(rx * qreal(0.5));
+ int dy = qRound(ry * qreal(0.5));
+ qt_rectcopy(image.bits(), half.bits(), dx, dy,
+ half.width(), half.height(),
+ image.bytesPerLine(), half.bytesPerLine());
-QGLPixmapDropShadowFilter::QGLPixmapDropShadowFilter(QGraphicsBlurEffect::BlurHints hints)
- : m_haveCached(false)
- , m_cachedRadius(0)
- , m_hints(hints)
-{
-}
+ qt_blurImage(image, r * qreal(0.5), false, 1);
-bool QGLPixmapDropShadowFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &srcRect) const
-{
- QGLPixmapDropShadowFilter *filter = const_cast<QGLPixmapDropShadowFilter *>(this);
+ GLuint texture = generateBlurTexture(image.size(), GL_ALPHA);
- int actualRadius = qRound(blurRadius());
- int filterRadius = actualRadius;
- m_singlePass = filterRadius <= 3;
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, image.width(), image.height(), GL_ALPHA,
+ GL_UNSIGNED_BYTE, image.bits());
- if (!m_haveCached || filterRadius != m_cachedRadius) {
- // Only regenerate the shader from source if parameters have changed.
- m_haveCached = true;
- m_cachedRadius = filterRadius;
- QByteArray source = QGLPixmapBlurFilter::generateGaussianShader(filterRadius, m_singlePass, true);
- filter->setSource(source);
+ info = new QGLBlurTextureInfo(image, texture, r);
}
- QRect targetRect = QRectF(src.rect()).translated(pos + offset()).adjusted(-actualRadius, -actualRadius, actualRadius, actualRadius).toAlignedRect();
-
- if (m_singlePass) {
- // prepare for updateUniforms
- m_textureSize = src.size();
-
- painter->save();
- // ensure GL_LINEAR filtering is used
- painter->setRenderHint(QPainter::SmoothPixmapTransform);
- filter->setOnPainter(painter);
- QBrush pixmapBrush = src;
- pixmapBrush.setTransform(QTransform::fromTranslate(pos.x() + offset().x(), pos.y() + offset().y()));
- painter->fillRect(targetRect, pixmapBrush);
- filter->removeFromPainter(painter);
- painter->restore();
- } else {
- QGLFramebufferObjectFormat format;
- format.setInternalTextureFormat(GLenum(src.hasAlphaChannel() ? GL_RGBA : GL_RGB));
- QGLFramebufferObject *fbo = qgl_fbo_pool()->acquire(targetRect.size(), format);
-
- if (!fbo)
- return false;
-
- // prepare for updateUniforms
- m_textureSize = src.size();
-
- // horizontal pass, to pixmap
- m_horizontalBlur = true;
-
- QPainter fboPainter(fbo);
+ GLuint texture = info->texture();
- glClearColor(0, 0, 0, 0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- // ensure GL_LINEAR filtering is used
- fboPainter.setRenderHint(QPainter::SmoothPixmapTransform);
- fboPainter.setCompositionMode(QPainter::CompositionMode_Source);
- filter->setOnPainter(&fboPainter);
- QBrush pixmapBrush = src;
- pixmapBrush.setTransform(QTransform::fromTranslate(actualRadius, actualRadius));
- fboPainter.fillRect(QRect(0, 0, targetRect.width(), targetRect.height()), pixmapBrush);
- filter->removeFromPainter(&fboPainter);
- fboPainter.end();
-
- QGL2PaintEngineEx *engine = static_cast<QGL2PaintEngineEx *>(painter->paintEngine());
+ filter->setOnPainter(painter);
- // vertical pass, to painter
- m_horizontalBlur = false;
- m_textureSize = fbo->size();
+ QGL2PaintEngineEx *engine = static_cast<QGL2PaintEngineEx *>(painter->paintEngine());
+ painter->setRenderHint(QPainter::SmoothPixmapTransform);
- painter->save();
- // ensure GL_LINEAR filtering is used
- painter->setRenderHint(QPainter::SmoothPixmapTransform);
- filter->setOnPainter(painter);
- engine->drawTexture(targetRect, fbo->texture(), fbo->size(), QRectF(0, fbo->height() - targetRect.height(), targetRect.width(), targetRect.height()));
- filter->removeFromPainter(painter);
- painter->restore();
+ engine->drawTexture(targetRect, texture, info->paddedImage().size(), info->paddedImage().rect());
- qgl_fbo_pool()->release(fbo);
- }
+ filter->removeFromPainter(painter);
// Now draw the actual pixmap over the top.
painter->drawPixmap(pos, src, srcRect);
+ blurTextureCache->insertBlurTextureInfo(src, info);
+
return true;
}
void QGLPixmapDropShadowFilter::setUniforms(QGLShaderProgram *program)
{
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
QColor col = color();
- if (m_horizontalBlur && !m_singlePass) {
- program->setUniformValue("shadowColor", 1.0f, 1.0f, 1.0f, 1.0f);
- } else {
- qreal alpha = col.alphaF();
- program->setUniformValue("shadowColor", col.redF() * alpha,
- col.greenF() * alpha,
- col.blueF() * alpha,
- alpha);
- }
-
- if (m_hints & QGraphicsBlurEffect::QualityHint) {
- if (m_singlePass)
- program->setUniformValue("delta", 1.0 / m_textureSize.width(), 1.0 / m_textureSize.height());
- else if (m_horizontalBlur)
- program->setUniformValue("delta", 1.0 / m_textureSize.width(), 0.0);
- else
- program->setUniformValue("delta", 0.0, 1.0 / m_textureSize.height());
- } else {
- qreal blur = blurRadius() / qreal(m_cachedRadius);
-
- if (m_singlePass)
- program->setUniformValue("delta", blur / m_textureSize.width(), blur / m_textureSize.height());
- else if (m_horizontalBlur)
- program->setUniformValue("delta", blur / m_textureSize.width(), 0.0);
- else
- program->setUniformValue("delta", 0.0, blur / m_textureSize.height());
- }
+ qreal alpha = col.alphaF();
+ program->setUniformValue("shadowColor", col.redF() * alpha,
+ col.greenF() * alpha,
+ col.blueF() * alpha,
+ alpha);
}
QT_END_NAMESPACE
diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp
index ed7fdff..8dae02a 100644
--- a/src/opengl/qpaintengine_opengl.cpp
+++ b/src/opengl/qpaintengine_opengl.cpp
@@ -4522,6 +4522,12 @@ typedef QHash<QFontEngine*, QGLGlyphHash*> QGLFontGlyphHash;
typedef QHash<quint64, QGLFontTexture*> QGLFontTexHash;
typedef QHash<const QGLContext*, QGLFontGlyphHash*> QGLContextHash;
+static inline void qt_delete_glyph_hash(QGLGlyphHash *hash)
+{
+ qDeleteAll(*hash);
+ delete hash;
+}
+
class QGLGlyphCache : public QObject
{
Q_OBJECT
@@ -4562,7 +4568,7 @@ void QGLGlyphCache::fontEngineDestroyed(QObject *o)
if (font_cache->find(fe) != font_cache->end()) {
ctx = keys.at(i);
QGLGlyphHash *cache = font_cache->take(fe);
- delete cache;
+ qt_delete_glyph_hash(cache);
break;
}
}
@@ -4599,7 +4605,7 @@ void QGLGlyphCache::cleanupContext(const QGLContext *ctx)
QList<QFontEngine *> keys = font_cache->keys();
for (int i=0; i < keys.size(); ++i) {
QFontEngine *fe = keys.at(i);
- delete font_cache->take(fe);
+ qt_delete_glyph_hash(font_cache->take(fe));
quint64 font_key = (reinterpret_cast<quint64>(ctx) << 32) | reinterpret_cast<quint64>(fe);
QGLFontTexture *font_tex = qt_font_textures.take(font_key);
if (font_tex) {
@@ -4640,7 +4646,9 @@ void QGLGlyphCache::cleanCache()
QList<const QGLContext *> keys = qt_context_cache.keys();
for (int i=0; i < keys.size(); ++i) {
QGLFontGlyphHash *font_cache = qt_context_cache.value(keys.at(i));
- qDeleteAll(*font_cache);
+ QGLFontGlyphHash::Iterator it = font_cache->begin();
+ for (; it != font_cache->end(); ++it)
+ qt_delete_glyph_hash(it.value());
font_cache->clear();
}
qDeleteAll(qt_context_cache);
diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp
index 0299cea..92c990b 100644
--- a/src/opengl/qpixmapdata_gl.cpp
+++ b/src/opengl/qpixmapdata_gl.cpp
@@ -341,22 +341,11 @@ void QGLPixmapData::ensureCreated() const
if (!m_source.isNull()) {
if (external_format == GL_RGB) {
- QImage tx = m_source.convertToFormat(QImage::Format_RGB32);
-
- QVector<uchar> pixelData(w * h * 3);
- uchar *p = &pixelData[0];
- QRgb *src = (QRgb *)tx.bits();
-
- for (int i = 0; i < w * h; ++i) {
- *p++ = qRed(*src);
- *p++ = qGreen(*src);
- *p++ = qBlue(*src);
- ++src;
- }
+ const QImage tx = m_source.convertToFormat(QImage::Format_RGB888);
glBindTexture(target, m_texture.id);
glTexSubImage2D(target, 0, 0, 0, w, h, external_format,
- GL_UNSIGNED_BYTE, &pixelData[0]);
+ GL_UNSIGNED_BYTE, tx.bits());
} else {
const QImage tx = ctx->d_func()->convertToGLFormat(m_source, true, external_format);
@@ -424,6 +413,7 @@ bool QGLPixmapData::fromFile(const QString &filename, const char *format,
resize(0, 0);
data = file.readAll();
file.close();
+ QGLShareContextScope ctx(qt_gl_share_widget()->context());
QSize size = m_texture.bindCompressedTexture
(data.constData(), data.size(), format);
if (!size.isEmpty()) {
@@ -449,6 +439,7 @@ bool QGLPixmapData::fromData(const uchar *buffer, uint len, const char *format,
const char *buf = reinterpret_cast<const char *>(buffer);
if (m_texture.canBindCompressedTexture(buf, int(len), format, &alpha)) {
resize(0, 0);
+ QGLShareContextScope ctx(qt_gl_share_widget()->context());
QSize size = m_texture.bindCompressedTexture(buf, int(len), format);
if (!size.isEmpty()) {
w = size.width();
diff --git a/src/openvg/openvg.pro b/src/openvg/openvg.pro
index 8927c4c..c8c9917 100644
--- a/src/openvg/openvg.pro
+++ b/src/openvg/openvg.pro
@@ -16,11 +16,13 @@ HEADERS += \
qpaintengine_vg_p.h \
qpixmapdata_vg_p.h \
qpixmapfilter_vg_p.h \
- qvgcompositionhelper_p.h
+ qvgcompositionhelper_p.h \
+ qvgimagepool_p.h
SOURCES += \
qpaintengine_vg.cpp \
qpixmapdata_vg.cpp \
- qpixmapfilter_vg.cpp
+ qpixmapfilter_vg.cpp \
+ qvgimagepool.cpp
contains(QT_CONFIG, egl) {
HEADERS += \
diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp
index 6b829dd..117c910 100644
--- a/src/openvg/qpaintengine_vg.cpp
+++ b/src/openvg/qpaintengine_vg.cpp
@@ -43,6 +43,7 @@
#include "qpixmapdata_vg_p.h"
#include "qpixmapfilter_vg_p.h"
#include "qvgcompositionhelper_p.h"
+#include "qvgimagepool_p.h"
#if !defined(QT_NO_EGL)
#include <QtGui/private/qegl_p.h>
#include "qwindowsurface_vgegl_p.h"
@@ -199,6 +200,7 @@ public:
QRegion scissorRegion; // Currently active scissor region.
bool scissorActive; // True if scissor region is active.
+ bool scissorDirty; // True if scissor is dirty after native painting.
QPaintEngine::DirtyFlags dirty;
@@ -356,6 +358,7 @@ void QVGPaintEnginePrivate::init()
rawVG = false;
scissorActive = false;
+ scissorDirty = false;
dirty = 0;
@@ -983,6 +986,9 @@ static QImage colorizeBitmap(const QImage &image, const QColor &color)
return dest;
}
+// defined in qpixmapdata_vg.cpp.
+const uchar *qt_vg_imageBits(const QImage& image);
+
static VGImage toVGImage
(const QImage & image, Qt::ImageConversionFlags flags = Qt::AutoColor)
{
@@ -1016,9 +1022,9 @@ static VGImage toVGImage
break;
}
- const uchar *pixels = img.bits();
+ const uchar *pixels = qt_vg_imageBits(img);
- VGImage vgImg = vgCreateImage
+ VGImage vgImg = QVGImagePool::instance()->createPermanentImage
(format, img.width(), img.height(), VG_IMAGE_QUALITY_FASTER);
vgImageSubData
(vgImg, pixels, img.bytesPerLine(), format, 0, 0,
@@ -1060,10 +1066,10 @@ static VGImage toVGImageSubRect
break;
}
- const uchar *pixels = img.bits() + bpp * sr.x() +
+ const uchar *pixels = qt_vg_imageBits(img) + bpp * sr.x() +
img.bytesPerLine() * sr.y();
- VGImage vgImg = vgCreateImage
+ VGImage vgImg = QVGImagePool::instance()->createPermanentImage
(format, sr.width(), sr.height(), VG_IMAGE_QUALITY_FASTER);
vgImageSubData
(vgImg, pixels, img.bytesPerLine(), format, 0, 0,
@@ -1082,9 +1088,9 @@ static VGImage toVGImageWithOpacity(const QImage & image, qreal opacity)
painter.drawImage(0, 0, image);
painter.end();
- const uchar *pixels = img.bits();
+ const uchar *pixels = qt_vg_imageBits(img);
- VGImage vgImg = vgCreateImage
+ VGImage vgImg = QVGImagePool::instance()->createPermanentImage
(VG_sARGB_8888_PRE, img.width(), img.height(), VG_IMAGE_QUALITY_FASTER);
vgImageSubData
(vgImg, pixels, img.bytesPerLine(), VG_sARGB_8888_PRE, 0, 0,
@@ -1104,9 +1110,9 @@ static VGImage toVGImageWithOpacitySubRect
painter.drawImage(QPoint(0, 0), image, sr);
painter.end();
- const uchar *pixels = img.bits();
+ const uchar *pixels = qt_vg_imageBits(img);
- VGImage vgImg = vgCreateImage
+ VGImage vgImg = QVGImagePool::instance()->createPermanentImage
(VG_sARGB_8888_PRE, img.width(), img.height(), VG_IMAGE_QUALITY_FASTER);
vgImageSubData
(vgImg, pixels, img.bytesPerLine(), VG_sARGB_8888_PRE, 0, 0,
@@ -1194,6 +1200,12 @@ VGPaintType QVGPaintEnginePrivate::setBrush
if (pd->classId() == QPixmapData::OpenVGClass) {
QVGPixmapData *vgpd = static_cast<QVGPixmapData *>(pd);
vgImg = vgpd->toVGImage();
+
+ // We don't want the pool to reclaim this image
+ // because we cannot predict when the paint object
+ // will stop using it. Replacing the image with
+ // new data will make the paint object invalid.
+ vgpd->detachImageFromPool();
} else {
vgImg = toVGImage(*(pd->buffer()));
deref = true;
@@ -1201,6 +1213,7 @@ VGPaintType QVGPaintEnginePrivate::setBrush
} else if (pd->classId() == QPixmapData::OpenVGClass) {
QVGPixmapData *vgpd = static_cast<QVGPixmapData *>(pd);
vgImg = vgpd->toVGImage(opacity);
+ vgpd->detachImageFromPool();
} else {
vgImg = toVGImageWithOpacity(*(pd->buffer()), opacity);
deref = true;
@@ -2075,6 +2088,7 @@ void QVGPaintEngine::updateScissor()
// so there is no point doing any scissoring.
vgSeti(VG_SCISSORING, VG_FALSE);
d->scissorActive = false;
+ d->scissorDirty = false;
return;
}
} else
@@ -2092,6 +2106,7 @@ void QVGPaintEngine::updateScissor()
// so there is no point doing any scissoring.
vgSeti(VG_SCISSORING, VG_FALSE);
d->scissorActive = false;
+ d->scissorDirty = false;
return;
}
} else
@@ -2101,11 +2116,12 @@ void QVGPaintEngine::updateScissor()
if (region.isEmpty()) {
vgSeti(VG_SCISSORING, VG_FALSE);
d->scissorActive = false;
+ d->scissorDirty = false;
return;
}
}
- if (d->scissorActive && region == d->scissorRegion)
+ if (d->scissorActive && region == d->scissorRegion && !d->scissorDirty)
return;
QVector<QRect> rects = region.rects();
@@ -2123,6 +2139,7 @@ void QVGPaintEngine::updateScissor()
vgSetiv(VG_SCISSOR_RECTS, count * 4, params.data());
vgSeti(VG_SCISSORING, VG_TRUE);
+ d->scissorDirty = false;
d->scissorActive = true;
d->scissorRegion = region;
}
@@ -3158,15 +3175,15 @@ void QVGFontGlyphCache::cacheGlyphs
if (!scaledImage.isNull()) { // Not a space character
if (scaledImage.format() == QImage::Format_Indexed8) {
vgImage = vgCreateImage(VG_A_8, scaledImage.width(), scaledImage.height(), VG_IMAGE_QUALITY_FASTER);
- vgImageSubData(vgImage, scaledImage.bits(), scaledImage.bytesPerLine(), VG_A_8, 0, 0, scaledImage.width(), scaledImage.height());
+ vgImageSubData(vgImage, qt_vg_imageBits(scaledImage), scaledImage.bytesPerLine(), VG_A_8, 0, 0, scaledImage.width(), scaledImage.height());
} else if (scaledImage.format() == QImage::Format_Mono) {
QImage img = scaledImage.convertToFormat(QImage::Format_Indexed8);
vgImage = vgCreateImage(VG_A_8, img.width(), img.height(), VG_IMAGE_QUALITY_FASTER);
- vgImageSubData(vgImage, img.bits(), img.bytesPerLine(), VG_A_8, 0, 0, img.width(), img.height());
+ vgImageSubData(vgImage, qt_vg_imageBits(img), img.bytesPerLine(), VG_A_8, 0, 0, img.width(), img.height());
} else {
QImage img = scaledImage.convertToFormat(QImage::Format_ARGB32_Premultiplied);
vgImage = vgCreateImage(VG_sARGB_8888_PRE, img.width(), img.height(), VG_IMAGE_QUALITY_FASTER);
- vgImageSubData(vgImage, img.bits(), img.bytesPerLine(), VG_sARGB_8888_PRE, 0, 0, img.width(), img.height());
+ vgImageSubData(vgImage, qt_vg_imageBits(img), img.bytesPerLine(), VG_sARGB_8888_PRE, 0, 0, img.width(), img.height());
}
}
origin[0] = -metrics.x.toReal() + 0.5f;
@@ -3325,6 +3342,7 @@ void QVGPaintEngine::endNativePainting()
d->brushType = (VGPaintType)0;
d->clearColor = QColor();
d->fillPaint = d->brushPaint;
+ d->scissorDirty = true;
restoreState(QPaintEngine::AllDirty);
d->dirty = dirty;
d->rawVG = false;
@@ -3632,7 +3650,7 @@ void QVGCompositionHelper::drawCursorPixmap
if (vgImage == VG_INVALID_HANDLE)
return;
vgImageSubData
- (vgImage, img.bits() + img.bytesPerLine() * (img.height() - 1),
+ (vgImage, qt_vg_imageBits(img) + img.bytesPerLine() * (img.height() - 1),
-(img.bytesPerLine()), VG_sARGB_8888_PRE, 0, 0,
img.width(), img.height());
@@ -3658,15 +3676,17 @@ void QVGCompositionHelper::setScissor(const QRegion& region)
vgSetiv(VG_SCISSOR_RECTS, count * 4, params.data());
vgSeti(VG_SCISSORING, VG_TRUE);
+ d->scissorDirty = false;
d->scissorActive = true;
d->scissorRegion = region;
}
void QVGCompositionHelper::clearScissor()
{
- if (d->scissorActive) {
+ if (d->scissorActive || d->scissorDirty) {
vgSeti(VG_SCISSORING, VG_FALSE);
d->scissorActive = false;
+ d->scissorDirty = false;
}
}
diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp
index 5d5fcbf..7de2212 100644
--- a/src/openvg/qpixmapdata_vg.cpp
+++ b/src/openvg/qpixmapdata_vg.cpp
@@ -43,6 +43,7 @@
#include "qpaintengine_vg_p.h"
#include <QtGui/private/qdrawhelper_p.h>
#include "qvg_p.h"
+#include "qvgimagepool_p.h"
#ifdef QT_SYMBIAN_SUPPORTS_SGIMAGE
#include <graphics/sgimage.h>
@@ -63,6 +64,8 @@ QVGPixmapData::QVGPixmapData(PixelType type)
vgImageOpacity = VG_INVALID_HANDLE;
cachedOpacity = 1.0f;
recreate = true;
+ inImagePool = false;
+ inLRU = false;
#if !defined(QT_NO_EGL)
context = 0;
qt_vg_register_pixmap(this);
@@ -78,32 +81,43 @@ QVGPixmapData::~QVGPixmapData()
#endif
}
+void QVGPixmapData::destroyImages()
+{
+ if (inImagePool) {
+ QVGImagePool *pool = QVGImagePool::instance();
+ if (vgImage != VG_INVALID_HANDLE)
+ pool->releaseImage(this, vgImage);
+ if (vgImageOpacity != VG_INVALID_HANDLE)
+ pool->releaseImage(this, vgImageOpacity);
+ } else {
+ if (vgImage != VG_INVALID_HANDLE)
+ vgDestroyImage(vgImage);
+ if (vgImageOpacity != VG_INVALID_HANDLE)
+ vgDestroyImage(vgImageOpacity);
+ }
+ vgImage = VG_INVALID_HANDLE;
+ vgImageOpacity = VG_INVALID_HANDLE;
+ inImagePool = false;
+}
+
void QVGPixmapData::destroyImageAndContext()
{
if (vgImage != VG_INVALID_HANDLE) {
// We need to have a context current to destroy the image.
#if !defined(QT_NO_EGL)
if (context->isCurrent()) {
- vgDestroyImage(vgImage);
- if (vgImageOpacity != VG_INVALID_HANDLE)
- vgDestroyImage(vgImageOpacity);
+ destroyImages();
} else {
// We don't currently have a widget surface active, but we
// need a surface to make the context current. So use the
// shared pbuffer surface instead.
context->makeCurrent(qt_vg_shared_surface());
- vgDestroyImage(vgImage);
- if (vgImageOpacity != VG_INVALID_HANDLE)
- vgDestroyImage(vgImageOpacity);
+ destroyImages();
context->lazyDoneCurrent();
}
#else
- vgDestroyImage(vgImage);
- if (vgImageOpacity != VG_INVALID_HANDLE)
- vgDestroyImage(vgImageOpacity);
+ destroyImages();
#endif
- vgImage = VG_INVALID_HANDLE;
- vgImageOpacity = VG_INVALID_HANDLE;
}
#if !defined(QT_NO_EGL)
if (context) {
@@ -218,7 +232,7 @@ QPaintEngine* QVGPixmapData::paintEngine() const
// This function works around QImage::bits() making a deep copy if the
// QImage is not const. We force it to be const and then get the bits.
// XXX: Should add a QImage::constBits() in the future to replace this.
-static inline const uchar *qt_vg_imageBits(const QImage& image)
+const uchar *qt_vg_imageBits(const QImage& image)
{
return image.bits();
}
@@ -234,22 +248,22 @@ VGImage QVGPixmapData::toVGImage()
context = qt_vg_create_context(0, QInternal::Pixmap);
#endif
- if (recreate && prevSize != QSize(w, h)) {
- if (vgImage != VG_INVALID_HANDLE) {
- vgDestroyImage(vgImage);
- vgImage = VG_INVALID_HANDLE;
- }
- if (vgImageOpacity != VG_INVALID_HANDLE) {
- vgDestroyImage(vgImageOpacity);
- vgImageOpacity = VG_INVALID_HANDLE;
- }
- } else if (recreate) {
+ if (recreate && prevSize != QSize(w, h))
+ destroyImages();
+ else if (recreate)
cachedOpacity = -1.0f; // Force opacity image to be refreshed later.
- }
if (vgImage == VG_INVALID_HANDLE) {
- vgImage = vgCreateImage
- (VG_sARGB_8888_PRE, w, h, VG_IMAGE_QUALITY_FASTER);
+ vgImage = QVGImagePool::instance()->createImageForPixmap
+ (VG_sARGB_8888_PRE, w, h, VG_IMAGE_QUALITY_FASTER, this);
+
+ // Bail out if we run out of GPU memory - try again next time.
+ if (vgImage == VG_INVALID_HANDLE)
+ return VG_INVALID_HANDLE;
+
+ inImagePool = true;
+ } else if (inImagePool) {
+ QVGImagePool::instance()->useImage(this);
}
if (!source.isNull() && recreate) {
@@ -278,8 +292,17 @@ VGImage QVGPixmapData::toVGImage(qreal opacity)
// Create an alternative image for the selected opacity.
if (vgImageOpacity == VG_INVALID_HANDLE || cachedOpacity != opacity) {
if (vgImageOpacity == VG_INVALID_HANDLE) {
- vgImageOpacity = vgCreateImage
- (VG_sARGB_8888_PRE, w, h, VG_IMAGE_QUALITY_FASTER);
+ if (inImagePool) {
+ vgImageOpacity = QVGImagePool::instance()->createImageForPixmap
+ (VG_sARGB_8888_PRE, w, h, VG_IMAGE_QUALITY_FASTER, this);
+ } else {
+ vgImageOpacity = vgCreateImage
+ (VG_sARGB_8888_PRE, w, h, VG_IMAGE_QUALITY_FASTER);
+ }
+
+ // Bail out if we run out of GPU memory - try again next time.
+ if (vgImageOpacity == VG_INVALID_HANDLE)
+ return VG_INVALID_HANDLE;
}
VGfloat matrix[20] = {
1.0f, 0.0f, 0.0f, 0.0f,
@@ -300,6 +323,14 @@ VGImage QVGPixmapData::toVGImage(qreal opacity)
#endif
}
+void QVGPixmapData::detachImageFromPool()
+{
+ if (inImagePool) {
+ QVGImagePool::instance()->detachImage(this);
+ inImagePool = false;
+ }
+}
+
void QVGPixmapData::hibernate()
{
// If the image was imported (e.g, from an SgImage under Symbian),
@@ -311,6 +342,14 @@ void QVGPixmapData::hibernate()
destroyImageAndContext();
}
+void QVGPixmapData::reclaimImages()
+{
+ if (!inImagePool)
+ return;
+ forceToImage();
+ destroyImages();
+}
+
extern int qt_defaultDpiX();
extern int qt_defaultDpiY();
@@ -403,14 +442,7 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type)
if (!context)
context = qt_vg_create_context(0, QInternal::Pixmap);
- if (vgImage != VG_INVALID_HANDLE) {
- vgDestroyImage(vgImage);
- vgImage = VG_INVALID_HANDLE;
- }
- if (vgImageOpacity != VG_INVALID_HANDLE) {
- vgDestroyImage(vgImageOpacity);
- vgImageOpacity = VG_INVALID_HANDLE;
- }
+ destroyImages();
prevSize = QSize();
TInt err = 0;
diff --git a/src/openvg/qpixmapdata_vg_p.h b/src/openvg/qpixmapdata_vg_p.h
index c0bb098..4ff95c1 100644
--- a/src/openvg/qpixmapdata_vg_p.h
+++ b/src/openvg/qpixmapdata_vg_p.h
@@ -63,6 +63,7 @@ class RSGImage;
QT_BEGIN_NAMESPACE
class QEglContext;
+class QVGImagePool;
#if !defined(QT_NO_EGL)
class QVGPixmapData;
@@ -101,6 +102,9 @@ public:
// Return the VGImage form for a specific opacity setting.
virtual VGImage toVGImage(qreal opacity);
+ // Detach this image from the image pool.
+ virtual void detachImageFromPool();
+
// Release the VG resources associated with this pixmap and copy
// the pixmap's contents out of the GPU back into main memory.
// The VG resource will be automatically recreated the next time
@@ -109,6 +113,10 @@ public:
// process via a SgImage).
virtual void hibernate();
+ // Called when the QVGImagePool wants to reclaim this pixmap's
+ // VGImage objects to reuse storage.
+ virtual void reclaimImages();
+
QSize size() const { return QSize(w, h); }
#if defined(Q_OS_SYMBIAN)
@@ -123,8 +131,13 @@ protected:
void cleanup();
#endif
-#if !defined(QT_NO_EGL)
private:
+ QVGPixmapData *nextLRU;
+ QVGPixmapData *prevLRU;
+ bool inLRU;
+ friend class QVGImagePool;
+
+#if !defined(QT_NO_EGL)
QVGPixmapData *next;
QVGPixmapData *prev;
@@ -140,6 +153,7 @@ protected:
qreal cachedOpacity;
mutable QImage source;
mutable bool recreate;
+ bool inImagePool;
#if !defined(QT_NO_EGL)
mutable QEglContext *context;
#endif
@@ -148,6 +162,7 @@ protected:
QImage::Format sourceFormat() const;
void destroyImageAndContext();
+ void destroyImages();
};
QT_END_NAMESPACE
diff --git a/src/openvg/qpixmapfilter_vg.cpp b/src/openvg/qpixmapfilter_vg.cpp
index e17c728..aa526ed 100644
--- a/src/openvg/qpixmapfilter_vg.cpp
+++ b/src/openvg/qpixmapfilter_vg.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include "qpixmapfilter_vg_p.h"
+#include "qvgimagepool_p.h"
#include <QtCore/qvarlengtharray.h>
#include <QtGui/qpainter.h>
@@ -82,9 +83,9 @@ void QVGPixmapConvolutionFilter::draw
return;
QSize size = pd->size();
- VGImage dstImage = vgCreateImage
+ VGImage dstImage = QVGImagePool::instance()->createTemporaryImage
(VG_sARGB_8888_PRE, size.width(), size.height(),
- VG_IMAGE_QUALITY_FASTER);
+ VG_IMAGE_QUALITY_FASTER, pd);
if (dstImage == VG_INVALID_HANDLE)
return;
@@ -124,7 +125,7 @@ void QVGPixmapConvolutionFilter::draw
if(child != dstImage)
vgDestroyImage(child);
- vgDestroyImage(dstImage);
+ QVGImagePool::instance()->releaseImage(0, dstImage);
}
QVGPixmapColorizeFilter::QVGPixmapColorizeFilter()
@@ -155,9 +156,9 @@ void QVGPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const
return;
QSize size = pd->size();
- VGImage dstImage = vgCreateImage
+ VGImage dstImage = QVGImagePool::instance()->createTemporaryImage
(VG_sARGB_8888_PRE, size.width(), size.height(),
- VG_IMAGE_QUALITY_FASTER);
+ VG_IMAGE_QUALITY_FASTER, pd);
if (dstImage == VG_INVALID_HANDLE)
return;
@@ -217,7 +218,7 @@ void QVGPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const
if(child != dstImage)
vgDestroyImage(child);
- vgDestroyImage(dstImage);
+ QVGImagePool::instance()->releaseImage(0, dstImage);
}
QVGPixmapDropShadowFilter::QVGPixmapDropShadowFilter()
@@ -248,9 +249,9 @@ void QVGPixmapDropShadowFilter::draw(QPainter *painter, const QPointF &dest, con
return;
QSize size = pd->size();
- VGImage dstImage = vgCreateImage
+ VGImage dstImage = QVGImagePool::instance()->createTemporaryImage
(VG_A_8, size.width(), size.height(),
- VG_IMAGE_QUALITY_FASTER);
+ VG_IMAGE_QUALITY_FASTER, pd);
if (dstImage == VG_INVALID_HANDLE)
return;
@@ -282,7 +283,7 @@ void QVGPixmapDropShadowFilter::draw(QPainter *painter, const QPointF &dest, con
if(child != dstImage)
vgDestroyImage(child);
- vgDestroyImage(dstImage);
+ QVGImagePool::instance()->releaseImage(0, dstImage);
// Now draw the actual pixmap over the top.
painter->drawPixmap(dest, src, srect);
@@ -316,9 +317,9 @@ void QVGPixmapBlurFilter::draw(QPainter *painter, const QPointF &dest, const QPi
return;
QSize size = pd->size();
- VGImage dstImage = vgCreateImage
+ VGImage dstImage = QVGImagePool::instance()->createTemporaryImage
(VG_sARGB_8888_PRE, size.width(), size.height(),
- VG_IMAGE_QUALITY_FASTER);
+ VG_IMAGE_QUALITY_FASTER, pd);
if (dstImage == VG_INVALID_HANDLE)
return;
@@ -347,7 +348,7 @@ void QVGPixmapBlurFilter::draw(QPainter *painter, const QPointF &dest, const QPi
if(child != dstImage)
vgDestroyImage(child);
- vgDestroyImage(dstImage);
+ QVGImagePool::instance()->releaseImage(0, dstImage);
}
#endif
diff --git a/src/openvg/qvgimagepool.cpp b/src/openvg/qvgimagepool.cpp
new file mode 100644
index 0000000..93e6e03
--- /dev/null
+++ b/src/openvg/qvgimagepool.cpp
@@ -0,0 +1,215 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtOpenVG 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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qvgimagepool_p.h"
+#include "qpixmapdata_vg_p.h"
+
+QT_BEGIN_NAMESPACE
+
+static QVGImagePool *qt_vg_image_pool = 0;
+
+class QVGImagePoolPrivate
+{
+public:
+ QVGImagePoolPrivate() : lruFirst(0), lruLast(0) {}
+
+ QVGPixmapData *lruFirst;
+ QVGPixmapData *lruLast;
+};
+
+QVGImagePool::QVGImagePool()
+ : d_ptr(new QVGImagePoolPrivate())
+{
+}
+
+QVGImagePool::~QVGImagePool()
+{
+}
+
+QVGImagePool *QVGImagePool::instance()
+{
+ if (!qt_vg_image_pool)
+ qt_vg_image_pool = new QVGImagePool();
+ return qt_vg_image_pool;
+}
+
+void QVGImagePool::setImagePool(QVGImagePool *pool)
+{
+ if (qt_vg_image_pool != pool)
+ delete qt_vg_image_pool;
+ qt_vg_image_pool = pool;
+}
+
+VGImage QVGImagePool::createTemporaryImage(VGImageFormat format,
+ VGint width, VGint height,
+ VGbitfield allowedQuality,
+ QVGPixmapData *keepData)
+{
+ VGImage image;
+ do {
+ image = vgCreateImage(format, width, height, allowedQuality);
+ if (image != VG_INVALID_HANDLE)
+ return image;
+ } while (reclaimSpace(format, width, height, keepData));
+ qWarning("QVGImagePool: cannot reclaim sufficient space for a %dx%d temporary image",
+ width, height);
+ return VG_INVALID_HANDLE;
+}
+
+VGImage QVGImagePool::createImageForPixmap(VGImageFormat format,
+ VGint width, VGint height,
+ VGbitfield allowedQuality,
+ QVGPixmapData *data)
+{
+ VGImage image;
+ do {
+ image = vgCreateImage(format, width, height, allowedQuality);
+ if (image != VG_INVALID_HANDLE) {
+ if (data)
+ moveToHeadOfLRU(data);
+ return image;
+ }
+ } while (reclaimSpace(format, width, height, data));
+ qWarning("QVGImagePool: cannot reclaim sufficient space for a %dx%d pixmap",
+ width, height);
+ return VG_INVALID_HANDLE;
+}
+
+VGImage QVGImagePool::createPermanentImage(VGImageFormat format,
+ VGint width, VGint height,
+ VGbitfield allowedQuality)
+{
+ VGImage image;
+ do {
+ image = vgCreateImage(format, width, height, allowedQuality);
+ if (image != VG_INVALID_HANDLE)
+ return image;
+ } while (reclaimSpace(format, width, height, 0));
+ qWarning("QVGImagePool: cannot reclaim sufficient space for a %dx%d image",
+ width, height);
+ return VG_INVALID_HANDLE;
+}
+
+void QVGImagePool::releaseImage(QVGPixmapData *data, VGImage image)
+{
+ // Very simple strategy at the moment: just destroy the image.
+ if (data)
+ removeFromLRU(data);
+ vgDestroyImage(image);
+}
+
+void QVGImagePool::useImage(QVGPixmapData *data)
+{
+ moveToHeadOfLRU(data);
+}
+
+void QVGImagePool::detachImage(QVGPixmapData *data)
+{
+ removeFromLRU(data);
+}
+
+bool QVGImagePool::reclaimSpace(VGImageFormat format,
+ VGint width, VGint height,
+ QVGPixmapData *data)
+{
+ Q_UNUSED(format); // For future use in picking the best image to eject.
+ Q_UNUSED(width);
+ Q_UNUSED(height);
+
+ if (data)
+ moveToHeadOfLRU(data);
+
+ QVGPixmapData *lrudata = pixmapLRU();
+ if (lrudata && lrudata != data) {
+ lrudata->reclaimImages();
+ return true;
+ }
+
+ return false;
+}
+
+void QVGImagePool::hibernate()
+{
+ // Nothing to do here at the moment since the pool does not
+ // retain VGImage's after they have been released.
+}
+
+void QVGImagePool::moveToHeadOfLRU(QVGPixmapData *data)
+{
+ Q_D(QVGImagePool);
+ if (data->inLRU) {
+ if (!data->prevLRU)
+ return; // Already at the head of the list.
+ removeFromLRU(data);
+ }
+ data->inLRU = true;
+ data->nextLRU = d->lruFirst;
+ data->prevLRU = 0;
+ if (d->lruFirst)
+ d->lruFirst->prevLRU = data;
+ else
+ d->lruLast = data;
+ d->lruFirst = data;
+}
+
+void QVGImagePool::removeFromLRU(QVGPixmapData *data)
+{
+ Q_D(QVGImagePool);
+ if (!data->inLRU)
+ return;
+ if (data->nextLRU)
+ data->nextLRU->prevLRU = data->prevLRU;
+ else
+ d->lruLast = data->prevLRU;
+ if (data->prevLRU)
+ data->prevLRU->nextLRU = data->nextLRU;
+ else
+ d->lruFirst = data->nextLRU;
+ data->inLRU = false;
+}
+
+QVGPixmapData *QVGImagePool::pixmapLRU()
+{
+ Q_D(QVGImagePool);
+ return d->lruLast;
+}
+
+QT_END_NAMESPACE
diff --git a/src/openvg/qvgimagepool_p.h b/src/openvg/qvgimagepool_p.h
new file mode 100644
index 0000000..66a4998
--- /dev/null
+++ b/src/openvg/qvgimagepool_p.h
@@ -0,0 +1,157 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtOpenVG 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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QVGIMAGEPOOL_P_H
+#define QVGIMAGEPOOL_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 "qvg.h"
+#include <QtCore/qscopedpointer.h>
+
+QT_BEGIN_NAMESPACE
+
+class QVGPixmapData;
+class QVGImagePoolPrivate;
+
+class Q_OPENVG_EXPORT QVGImagePool
+{
+public:
+ QVGImagePool();
+ virtual ~QVGImagePool();
+
+ static QVGImagePool *instance();
+
+ // This function can be used from system-specific graphics system
+ // plugins to alter the image allocation strategy.
+ static void setImagePool(QVGImagePool *pool);
+
+ // Create a new VGImage from the pool with the specified parameters
+ // that is not associated with a pixmap. The VGImage is returned to
+ // the pool when releaseImage() is called.
+ //
+ // This function will call reclaimSpace() when vgCreateImage() fails.
+ //
+ // This function is typically called when allocating temporary
+ // VGImage's for pixmap filters. The "keepData" object will not
+ // be reclaimed if reclaimSpace() needs to be called.
+ virtual VGImage createTemporaryImage(VGImageFormat format,
+ VGint width, VGint height,
+ VGbitfield allowedQuality,
+ QVGPixmapData *keepData = 0);
+
+ // Create a new VGImage with the specified parameters and associate
+ // it with "data". The QVGPixmapData will be notified when the
+ // VGImage needs to be reclaimed by the pool.
+ //
+ // This function will call reclaimSpace() when vgCreateImage() fails.
+ virtual VGImage createImageForPixmap(VGImageFormat format,
+ VGint width, VGint height,
+ VGbitfield allowedQuality,
+ QVGPixmapData *data);
+
+ // Create a permanent VGImage with the specified parameters.
+ // If there is insufficient space for the vgCreateImage call,
+ // then this function will call reclaimSpace() and try again.
+ //
+ // The caller is responsible for calling vgDestroyImage()
+ // when it no longer needs the VGImage, as the image is not
+ // recorded in the image pool.
+ //
+ // This function is typically used for pattern brushes where
+ // the OpenVG engine is responsible for managing the lifetime
+ // of the VGImage, destroying it automatically when the brush
+ // is no longer in use.
+ virtual VGImage createPermanentImage(VGImageFormat format,
+ VGint width, VGint height,
+ VGbitfield allowedQuality);
+
+ // Release a VGImage that is no longer required.
+ virtual void releaseImage(QVGPixmapData *data, VGImage image);
+
+ // Notify the pool that a QVGPixmapData object is using
+ // an image again. This allows the pool to move the image
+ // within a least-recently-used list of QVGPixmapData objects.
+ virtual void useImage(QVGPixmapData *data);
+
+ // Notify the pool that the VGImage's associated with a
+ // QVGPixmapData are being detached from the pool. The caller
+ // will become responsible for calling vgDestroyImage().
+ virtual void detachImage(QVGPixmapData *data);
+
+ // Reclaim space for an image allocation with the specified parameters.
+ // Returns true if space was reclaimed, or false if there is no
+ // further space that can be reclaimed. The "data" parameter
+ // indicates the pixmap that is trying to obtain space which should
+ // not itself be reclaimed.
+ virtual bool reclaimSpace(VGImageFormat format,
+ VGint width, VGint height,
+ QVGPixmapData *data);
+
+ // Hibernate the image pool because the context is about to be
+ // destroyed. All VGImage's left in the pool should be released.
+ virtual void hibernate();
+
+protected:
+ // Helper functions for managing the LRU list of QVGPixmapData objects.
+ void moveToHeadOfLRU(QVGPixmapData *data);
+ void removeFromLRU(QVGPixmapData *data);
+ QVGPixmapData *pixmapLRU();
+
+private:
+ QScopedPointer<QVGImagePoolPrivate> d_ptr;
+
+ Q_DECLARE_PRIVATE(QVGImagePool)
+ Q_DISABLE_COPY(QVGImagePool)
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/openvg/qwindowsurface_vgegl.cpp b/src/openvg/qwindowsurface_vgegl.cpp
index 1571083..bda6096 100644
--- a/src/openvg/qwindowsurface_vgegl.cpp
+++ b/src/openvg/qwindowsurface_vgegl.cpp
@@ -42,6 +42,7 @@
#include "qwindowsurface_vgegl_p.h"
#include "qpaintengine_vg_p.h"
#include "qpixmapdata_vg_p.h"
+#include "qvgimagepool_p.h"
#include "qvg_p.h"
#if !defined(QT_NO_EGL)
@@ -360,6 +361,9 @@ void qt_vg_hibernate_pixmaps(QVGSharedContext *shared)
pd = pd->next;
}
+ // Hibernate any remaining VGImage's in the image pool.
+ QVGImagePool::instance()->hibernate();
+
// Don't need the current context any more.
shared->context->lazyDoneCurrent();
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
index c86af73..47b8786 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
@@ -103,6 +103,8 @@ public:
void drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap, const QPointF &pos);
void blit(const QRectF &dest, IDirectFBSurface *surface, const QRectF &src);
+ inline bool supportsStretchBlit() const;
+
inline void updateClip();
virtual void systemStateChanged();
@@ -526,11 +528,12 @@ void QDirectFBPaintEngine::drawImage(const QRectF &r, const QImage &image,
#if !defined QT_NO_DIRECTFB_PREALLOCATED || defined QT_DIRECTFB_IMAGECACHE
if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedBlits)
|| (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
- || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip
+ || (d->clipType == QDirectFBPaintEnginePrivate::ComplexClip)
+ || (!d->supportsStretchBlit() && state()->matrix.mapRect(r).size() != sr.size())
#ifndef QT_DIRECTFB_IMAGECACHE
- || QDirectFBScreen::getSurfacePixelFormat(image.format()) == DSPF_UNKNOWN
+ || (QDirectFBScreen::getSurfacePixelFormat(image.format()) == DSPF_UNKNOWN)
#elif defined QT_NO_DIRECTFB_PREALLOCATED
- || QDirectFBPaintEnginePrivate::cacheCost(image) > imageCache.maxCost()
+ || (QDirectFBPaintEnginePrivate::cacheCost(image) > imageCache.maxCost())
#endif
)
#endif
@@ -573,10 +576,9 @@ void QDirectFBPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap,
Q_ASSERT(data->classId() == QPixmapData::DirectFBClass);
QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(data);
if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedBlits)
- || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
- || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip
- || (state()->renderHints & QPainter::SmoothPixmapTransform
- && state()->matrix.mapRect(r).size() != sr.size())) {
+ || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
+ || (d->clipType == QDirectFBPaintEnginePrivate::ComplexClip)
+ || (!d->supportsStretchBlit() && state()->matrix.mapRect(r).size() != sr.size())) {
RASTERFALLBACK(DRAW_PIXMAP, r, pixmap.size(), sr);
const QImage *img = dfbData->buffer();
d->lock();
@@ -606,8 +608,8 @@ void QDirectFBPaintEngine::drawTiledPixmap(const QRectF &r,
QRasterPaintEngine::drawTiledPixmap(r, pixmap, offset);
} else if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedBlits)
|| (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
- || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip
- || (state()->renderHints & QPainter::SmoothPixmapTransform && state()->matrix.isScaling())) {
+ || (d->clipType == QDirectFBPaintEnginePrivate::ComplexClip)
+ || (!d->supportsStretchBlit() && state()->matrix.isScaling())) {
RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), offset);
QPixmapData *pixmapData = pixmap.pixmapData();
Q_ASSERT(pixmapData->classId() == QPixmapData::DirectFBClass);
@@ -732,7 +734,7 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
case Qt::TexturePattern: {
if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedBlits)
|| (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
- || (state()->renderHints & QPainter::SmoothPixmapTransform && state()->matrix.isScaling())) {
+ || (!d->supportsStretchBlit() && state()->matrix.isScaling())) {
break;
}
@@ -757,7 +759,7 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QColor &color)
return;
Q_D(QDirectFBPaintEngine);
if ((d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported)
- || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip
+ || (d->clipType == QDirectFBPaintEnginePrivate::ComplexClip)
|| !d->testCompositionMode(0, 0, &color)) {
RASTERFALLBACK(FILL_RECT, rect, color, VOID_ARG());
d->lock();
@@ -1049,6 +1051,7 @@ void QDirectFBPaintEnginePrivate::blit(const QRectF &dest, IDirectFBSurface *s,
if (dr.size() == sr.size()) {
result = surface->Blit(surface, s, &sRect, dr.x(), dr.y());
} else {
+ Q_ASSERT(supportsStretchBlit());
const DFBRectangle dRect = { dr.x(), dr.y(), dr.width(), dr.height() };
result = surface->StretchBlit(surface, s, &sRect, &dRect);
}
@@ -1096,6 +1099,7 @@ void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPix
const QSize pixmapSize = dfbData->size();
IDirectFBSurface *sourceSurface = dfbData->directFBSurface();
if (transform.isScaling()) {
+ Q_ASSERT(supportsStretchBlit());
Q_ASSERT(qMin(transform.m11(), transform.m22()) >= 0);
offset.rx() *= transform.m11();
offset.ry() *= transform.m22();
@@ -1184,6 +1188,16 @@ void QDirectFBPaintEnginePrivate::updateClip()
}
}
+bool QDirectFBPaintEnginePrivate::supportsStretchBlit() const
+{
+#ifdef QT_DIRECTFB_STRETCHBLIT
+ return !(q->state()->renderHints & QPainter::SmoothPixmapTransform);
+#else
+ return false;
+#endif
+}
+
+
void QDirectFBPaintEnginePrivate::systemStateChanged()
{
QRasterPaintEnginePrivate::systemStateChanged();
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
index b15888b..e78966c 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
@@ -470,6 +470,7 @@ QPixmap QDirectFBPixmapData::transformed(const QTransform &transform,
return QPixmap();
QDirectFBPixmapData *data = new QDirectFBPixmapData(screen, QPixmapData::PixmapType);
+ data->setSerialNumber(++global_ser_no);
DFBSurfaceBlittingFlags flags = DSBLIT_NOFX;
data->alpha = alpha;
if (alpha) {
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index 4cb0184..bb26d29 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -958,47 +958,47 @@ struct FlagDescription {
};
static const FlagDescription accelerationDescriptions[] = {
- { " DFXL_NONE ", DFXL_NONE },
- { " DFXL_FILLRECTANGLE", DFXL_FILLRECTANGLE },
- { " DFXL_DRAWRECTANGLE", DFXL_DRAWRECTANGLE },
- { " DFXL_DRAWLINE", DFXL_DRAWLINE },
- { " DFXL_FILLTRIANGLE", DFXL_FILLTRIANGLE },
- { " DFXL_BLIT", DFXL_BLIT },
- { " DFXL_STRETCHBLIT", DFXL_STRETCHBLIT },
- { " DFXL_TEXTRIANGLES", DFXL_TEXTRIANGLES },
- { " DFXL_DRAWSTRING", DFXL_DRAWSTRING },
+ { "DFXL_NONE", DFXL_NONE },
+ { "DFXL_FILLRECTANGLE", DFXL_FILLRECTANGLE },
+ { "DFXL_DRAWRECTANGLE", DFXL_DRAWRECTANGLE },
+ { "DFXL_DRAWLINE", DFXL_DRAWLINE },
+ { "DFXL_FILLTRIANGLE", DFXL_FILLTRIANGLE },
+ { "DFXL_BLIT", DFXL_BLIT },
+ { "DFXL_STRETCHBLIT", DFXL_STRETCHBLIT },
+ { "DFXL_TEXTRIANGLES", DFXL_TEXTRIANGLES },
+ { "DFXL_DRAWSTRING", DFXL_DRAWSTRING },
{ 0, 0 }
};
static const FlagDescription blitDescriptions[] = {
- { " DSBLIT_NOFX", DSBLIT_NOFX },
- { " DSBLIT_BLEND_ALPHACHANNEL", DSBLIT_BLEND_ALPHACHANNEL },
- { " DSBLIT_BLEND_COLORALPHA", DSBLIT_BLEND_COLORALPHA },
- { " DSBLIT_COLORIZE", DSBLIT_COLORIZE },
- { " DSBLIT_SRC_COLORKEY", DSBLIT_SRC_COLORKEY },
- { " DSBLIT_DST_COLORKEY", DSBLIT_DST_COLORKEY },
- { " DSBLIT_SRC_PREMULTIPLY", DSBLIT_SRC_PREMULTIPLY },
- { " DSBLIT_DST_PREMULTIPLY", DSBLIT_DST_PREMULTIPLY },
- { " DSBLIT_DEMULTIPLY", DSBLIT_DEMULTIPLY },
- { " DSBLIT_DEINTERLACE", DSBLIT_DEINTERLACE },
+ { "DSBLIT_NOFX", DSBLIT_NOFX },
+ { "DSBLIT_BLEND_ALPHACHANNEL", DSBLIT_BLEND_ALPHACHANNEL },
+ { "DSBLIT_BLEND_COLORALPHA", DSBLIT_BLEND_COLORALPHA },
+ { "DSBLIT_COLORIZE", DSBLIT_COLORIZE },
+ { "DSBLIT_SRC_COLORKEY", DSBLIT_SRC_COLORKEY },
+ { "DSBLIT_DST_COLORKEY", DSBLIT_DST_COLORKEY },
+ { "DSBLIT_SRC_PREMULTIPLY", DSBLIT_SRC_PREMULTIPLY },
+ { "DSBLIT_DST_PREMULTIPLY", DSBLIT_DST_PREMULTIPLY },
+ { "DSBLIT_DEMULTIPLY", DSBLIT_DEMULTIPLY },
+ { "DSBLIT_DEINTERLACE", DSBLIT_DEINTERLACE },
#if (Q_DIRECTFB_VERSION >= 0x000923)
- { " DSBLIT_SRC_PREMULTCOLOR", DSBLIT_SRC_PREMULTCOLOR },
- { " DSBLIT_XOR", DSBLIT_XOR },
+ { "DSBLIT_SRC_PREMULTCOLOR", DSBLIT_SRC_PREMULTCOLOR },
+ { "DSBLIT_XOR", DSBLIT_XOR },
#endif
#if (Q_DIRECTFB_VERSION >= 0x010000)
- { " DSBLIT_INDEX_TRANSLATION", DSBLIT_INDEX_TRANSLATION },
+ { "DSBLIT_INDEX_TRANSLATION", DSBLIT_INDEX_TRANSLATION },
#endif
{ 0, 0 }
};
static const FlagDescription drawDescriptions[] = {
- { " DSDRAW_NOFX", DSDRAW_NOFX },
- { " DSDRAW_BLEND", DSDRAW_BLEND },
- { " DSDRAW_DST_COLORKEY", DSDRAW_DST_COLORKEY },
- { " DSDRAW_SRC_PREMULTIPLY", DSDRAW_SRC_PREMULTIPLY },
- { " DSDRAW_DST_PREMULTIPLY", DSDRAW_DST_PREMULTIPLY },
- { " DSDRAW_DEMULTIPLY", DSDRAW_DEMULTIPLY },
- { " DSDRAW_XOR", DSDRAW_XOR },
+ { "DSDRAW_NOFX", DSDRAW_NOFX },
+ { "DSDRAW_BLEND", DSDRAW_BLEND },
+ { "DSDRAW_DST_COLORKEY", DSDRAW_DST_COLORKEY },
+ { "DSDRAW_SRC_PREMULTIPLY", DSDRAW_SRC_PREMULTIPLY },
+ { "DSDRAW_DST_PREMULTIPLY", DSDRAW_DST_PREMULTIPLY },
+ { "DSDRAW_DEMULTIPLY", DSDRAW_DEMULTIPLY },
+ { "DSDRAW_XOR", DSDRAW_XOR },
{ 0, 0 }
};
#endif
@@ -1063,7 +1063,7 @@ static inline bool setIntOption(const QStringList &arguments, const QString &var
static inline QColor colorFromName(const QString &name)
{
- QRegExp rx("#([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])");
+ QRegExp rx(QLatin1String("#([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])"));
rx.setCaseSensitivity(Qt::CaseInsensitive);
if (rx.exactMatch(name)) {
Q_ASSERT(rx.captureCount() == 4);
@@ -1259,11 +1259,14 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
setIntOption(displayArgs, QLatin1String("height"), &h);
#ifndef QT_NO_DIRECTFB_LAYER
- result = d_ptr->dfb->GetDisplayLayer(d_ptr->dfb, DLID_PRIMARY,
+ int layerId = DLID_PRIMARY;
+ setIntOption(displayArgs, QLatin1String("layerid"), &layerId);
+
+ result = d_ptr->dfb->GetDisplayLayer(d_ptr->dfb, static_cast<DFBDisplayLayerID>(layerId),
&d_ptr->dfbLayer);
if (result != DFB_OK) {
DirectFBError("QDirectFBScreen::connect: "
- "Unable to get primary display layer!", result);
+ "Unable to get display layer!", result);
return false;
}
result = d_ptr->dfbLayer->GetScreen(d_ptr->dfbLayer, &d_ptr->dfbScreen);
@@ -1275,7 +1278,14 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
#ifdef QT_NO_DIRECTFB_WM
result = d_ptr->primarySurface->GetSize(d_ptr->primarySurface, &w, &h);
#elif (Q_DIRECTFB_VERSION >= 0x010000)
- result = d_ptr->dfbScreen->GetSize(d_ptr->dfbScreen, &w, &h);
+ IDirectFBSurface *layerSurface;
+ if (d_ptr->dfbLayer->GetSurface(d_ptr->dfbLayer, &layerSurface) != DFB_OK) {
+ result = layerSurface->GetSize(layerSurface, &w, &h);
+ layerSurface->Release(layerSurface);
+ }
+ if (w <= 0 || h <= 0) {
+ result = d_ptr->dfbScreen->GetSize(d_ptr->dfbScreen, &w, &h);
+ }
#else
qWarning("QDirectFBScreen::connect: DirectFB versions prior to 1.0 do not offer a way\n"
"query the size of the primary surface in windowed mode. You have to specify\n"
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
index 6330582..61d9cf1 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
@@ -69,6 +69,9 @@ QT_MODULE(Gui)
#if !defined QT_NO_DIRECTFB_IMAGEPROVIDER && !defined QT_DIRECTFB_IMAGEPROVIDER
#define QT_DIRECTFB_IMAGEPROVIDER
#endif
+#if !defined QT_NO_DIRECTFB_STRETCHBLIT && !defined QT_DIRECTFB_STRETCHBLIT
+#define QT_DIRECTFB_STRETCHBLIT
+#endif
#if !defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE && !defined QT_NO_DIRECTFB_IMAGEPROVIDER_KEEPALIVE
#define QT_NO_DIRECTFB_IMAGEPROVIDER_KEEPALIVE
#endif
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
index 021d52e..b79418a 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
@@ -128,7 +128,6 @@ IDirectFBWindow *QDirectFBWindowSurface::directFBWindow() const
return (dfbWindow ? dfbWindow : (sibling ? sibling->dfbWindow : 0));
}
-
void QDirectFBWindowSurface::createWindow(const QRect &rect)
{
IDirectFBDisplayLayer *layer = screen->dfbDisplayLayer();
@@ -169,6 +168,9 @@ void QDirectFBWindowSurface::createWindow(const QRect &rect)
DirectFBErrorFatal("QDirectFBWindowSurface::createWindow", result);
if (window()) {
+ if (window()->windowFlags() & Qt::WindowStaysOnTopHint) {
+ dfbWindow->SetStackingClass(dfbWindow, DWSC_UPPER);
+ }
DFBWindowID winid;
result = dfbWindow->GetID(dfbWindow, &winid);
if (result != DFB_OK) {
diff --git a/src/plugins/imageformats/gif/qgifhandler.cpp b/src/plugins/imageformats/gif/qgifhandler.cpp
index c95b63c..dee0e52 100644
--- a/src/plugins/imageformats/gif/qgifhandler.cpp
+++ b/src/plugins/imageformats/gif/qgifhandler.cpp
@@ -54,6 +54,10 @@ QT_BEGIN_NAMESPACE
#define Q_TRANSPARENT 0x00ffffff
+// avoid going through QImage::scanLine() which calls detach
+#define FAST_SCAN_LINE(bits, bpl, y) (bits + (y) * bpl)
+
+
/*
Incremental image decoder for GIF image format.
@@ -135,7 +139,7 @@ private:
int frame;
bool out_of_bounds;
bool digress;
- void nextY(QImage *image);
+ void nextY(unsigned char *bits, int bpl);
void disposePrevious(QImage *image);
};
@@ -232,6 +236,10 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length,
// CompuServe Incorporated. GIF(sm) is a Service Mark property of
// CompuServe Incorporated."
+ image->detach();
+ int bpl = image->bytesPerLine();
+ unsigned char *bits = image->bits();
+
#define LM(l, m) (((m)<<8)|l)
digress = false;
const int initial = length;
@@ -335,7 +343,9 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length,
QImage::Format format = trans_index >= 0 ? QImage::Format_ARGB32 : QImage::Format_RGB32;
if (image->isNull()) {
(*image) = QImage(swidth, sheight, format);
- memset(image->bits(), 0, image->byteCount());
+ bpl = image->bytesPerLine();
+ bits = image->bits();
+ memset(bits, 0, image->byteCount());
// ### size of the upcoming frame, should rather
// be known before decoding it.
@@ -393,11 +403,13 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length,
backingstore = QImage(qMax(backingstore.width(), w),
qMax(backingstore.height(), h),
QImage::Format_RGB32);
- memset(image->bits(), 0, image->byteCount());
+ memset(bits, 0, image->byteCount());
}
+ const int dest_bpl = backingstore.bytesPerLine();
+ unsigned char *dest_data = backingstore.bits();
for (int ln=0; ln<h; ln++) {
- memcpy(backingstore.scanLine(ln),
- image->scanLine(t+ln)+l, w*sizeof(QRgb));
+ memcpy(FAST_SCAN_LINE(dest_data, dest_bpl, ln),
+ FAST_SCAN_LINE(bits, bpl, t+ln) + l, w*sizeof(QRgb));
}
}
@@ -470,14 +482,14 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length,
if (needfirst) {
firstcode=oldcode=code;
if (!out_of_bounds && image->height() > y && firstcode!=trans_index)
- ((QRgb*)image->scanLine(y))[x] = color(firstcode);
+ ((QRgb*)FAST_SCAN_LINE(bits, bpl, y))[x] = color(firstcode);
x++;
if (x>=swidth) out_of_bounds = true;
needfirst=false;
if (x>=left+width) {
x=left;
out_of_bounds = left>=swidth || y>=sheight;
- nextY(image);
+ nextY(bits, bpl);
}
} else {
incode=code;
@@ -515,7 +527,7 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length,
const QRgb *map = lcmap ? localcmap : globalcmap;
QRgb *line = 0;
if (!out_of_bounds && h > y)
- line = (QRgb*)image->scanLine(y);
+ line = (QRgb*)FAST_SCAN_LINE(bits, bpl, y);
while (sp>stack) {
const uchar index = *(--sp);
if (!out_of_bounds && h > y && index!=trans_index) {
@@ -529,9 +541,9 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length,
if (x>=left+width) {
x=left;
out_of_bounds = left>=swidth || y>=sheight;
- nextY(image);
+ nextY(bits, bpl);
if (!out_of_bounds && h > y)
- line = (QRgb*)image->scanLine(y);
+ line = (QRgb*)FAST_SCAN_LINE(bits, bpl, y);
}
}
}
@@ -644,7 +656,7 @@ void QGIFFormat::fillRect(QImage *image, int col, int row, int w, int h, QRgb co
}
}
-void QGIFFormat::nextY(QImage *image)
+void QGIFFormat::nextY(unsigned char *bits, int bpl)
{
int my;
switch (interlace) {
@@ -660,7 +672,7 @@ void QGIFFormat::nextY(QImage *image)
// Don't dup with transparency
if (trans_index < 0) {
for (i=1; i<=my; i++) {
- memcpy(image->scanLine(y+i)+left*sizeof(QRgb), image->scanLine(y)+left*sizeof(QRgb),
+ memcpy(FAST_SCAN_LINE(bits, bpl, y+i)+left*sizeof(QRgb), FAST_SCAN_LINE(bits, bpl, y)+left*sizeof(QRgb),
(right-left+1)*sizeof(QRgb));
}
}
@@ -689,7 +701,7 @@ void QGIFFormat::nextY(QImage *image)
// Don't dup with transparency
if (trans_index < 0) {
for (i=1; i<=my; i++) {
- memcpy(image->scanLine(y+i)+left*sizeof(QRgb), image->scanLine(y)+left*sizeof(QRgb),
+ memcpy(FAST_SCAN_LINE(bits, bpl, y+i)+left*sizeof(QRgb), FAST_SCAN_LINE(bits, bpl, y)+left*sizeof(QRgb),
(right-left+1)*sizeof(QRgb));
}
}
@@ -713,7 +725,7 @@ void QGIFFormat::nextY(QImage *image)
// Don't dup with transparency
if (trans_index < 0) {
for (i=1; i<=my; i++) {
- memcpy(image->scanLine(y+i)+left*sizeof(QRgb), image->scanLine(y)+left*sizeof(QRgb),
+ memcpy(FAST_SCAN_LINE(bits, bpl, y+i)+left*sizeof(QRgb), FAST_SCAN_LINE(bits, bpl, y)+left*sizeof(QRgb),
(right-left+1)*sizeof(QRgb));
}
}
diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.cpp b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
index 54bbcda..11608ef 100644
--- a/src/plugins/imageformats/jpeg/qjpeghandler.cpp
+++ b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
@@ -84,15 +84,12 @@ class QImageSmoothScaler
public:
QImageSmoothScaler(const int w, const int h, const QImage &src);
QImageSmoothScaler(const int srcWidth, const int srcHeight,
- const char *parameters);
+ const int dstWidth, const int dstHeight);
virtual ~QImageSmoothScaler(void);
QImage scale();
-protected:
- int scaledWidth(void) const;
-
private:
QImageSmoothScalerPrivate *d;
virtual QRgb *scanLine(const int line = 0, const QImage *src = 0);
@@ -123,33 +120,9 @@ QImageSmoothScaler::QImageSmoothScaler(const int w, const int h,
}
QImageSmoothScaler::QImageSmoothScaler(const int srcWidth, const int srcHeight,
- const char *parameters)
+ const int dstWidth, const int dstHeight)
{
- char sModeStr[1024];
- int t1;
- int t2;
- int dstWidth;
- int dstHeight;
-
- sModeStr[0] = '\0';
-
d = new QImageSmoothScalerPrivate;
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && defined(_MSC_VER) && _MSC_VER >= 1400
- sscanf_s(parameters, "Scale( %i, %i, %1023s )", &dstWidth, &dstHeight, sModeStr, sizeof(sModeStr));
-#else
- sscanf(parameters, "Scale( %i, %i, %s )", &dstWidth, &dstHeight, sModeStr);
-#endif
- QString sModeQStr = QString::fromLatin1(sModeStr);
-
- t1 = srcWidth * dstHeight;
- t2 = srcHeight * dstWidth;
-
- if (((sModeQStr == QLatin1String("ScaleMin")) && (t1 > t2)) || ((sModeQStr == QLatin1String("ScaleMax")) && (t2 < t2))) {
- dstHeight = t2 / srcWidth;
- } else if (sModeQStr != QLatin1String("ScaleFree")) {
- dstWidth = t1 / srcHeight;
- }
-
d->setup(srcWidth, srcHeight, dstWidth, dstHeight, 0);
}
@@ -164,11 +137,6 @@ void QImageSmoothScalerPrivate::setup(const int srcWidth, const int srcHeight,
hasAlpha = hasAlphaChannel;
}
-int QImageSmoothScaler::scaledWidth() const
-{
- return d->cols;
-}
-
QImageSmoothScaler::~QImageSmoothScaler()
{
delete d;
@@ -467,20 +435,18 @@ QImage QImageSmoothScaler::scale()
class jpegSmoothScaler : public QImageSmoothScaler
{
public:
- jpegSmoothScaler(struct jpeg_decompress_struct *info, const char *params):
- QImageSmoothScaler(info->output_width, info->output_height, params)
+ jpegSmoothScaler(struct jpeg_decompress_struct *info, const QSize& dstSize, const QRect& clipRect)
+ : QImageSmoothScaler(clipRect.width(), clipRect.height(),
+ dstSize.width(), dstSize.height())
{
- cinfo = info;
- cols24Bit = scaledWidth() * 3;
-
- cacheHeight = 1;
- imageCache = QImage( info->output_width, cacheHeight, QImage::Format_RGB32 );
+ cinfo = info;
+ clip = clipRect;
+ imageCache = QImage(info->output_width, 1, QImage::Format_RGB32);
}
private:
- int cols24Bit;
+ QRect clip;
QImage imageCache;
- int cacheHeight;
struct jpeg_decompress_struct *cinfo;
QRgb *scanLine(const int line = 0, const QImage *src = 0)
@@ -492,33 +458,42 @@ private:
Q_UNUSED(src);
uchar* data = imageCache.bits();
+
+ // Read ahead if we haven't reached the first clipped scanline yet.
+ while (int(cinfo->output_scanline) < clip.y() &&
+ cinfo->output_scanline < cinfo->output_height)
+ jpeg_read_scanlines(cinfo, &data, 1);
+
+ // Read the next scanline. We assume that "line"
+ // will never be >= clip.height().
jpeg_read_scanlines(cinfo, &data, 1);
- out = (QRgb*)imageCache.scanLine(0);
+ if (cinfo->output_scanline == cinfo->output_height)
+ jpeg_finish_decompress(cinfo);
+
+ out = ((QRgb*)data) + clip.x();
//
// The smooth scale algorithm only works on 32-bit images;
// convert from (8|24) bits to 32.
//
if (cinfo->output_components == 1) {
- in = (uchar*)out + scaledWidth();
- for (uint i = scaledWidth(); i--; ) {
- in--;
+ in = data + clip.right();
+ for (int i = clip.width(); i--; ) {
out[i] = qRgb(*in, *in, *in);
+ in--;
}
- } else if (cinfo->out_color_space == JCS_CMYK) {
- int cols32Bit = scaledWidth() * 4;
- in = (uchar*)out + cols32Bit;
- for (uint i = scaledWidth(); i--; ) {
- in -= 4;
- int k = in[3];
- out[i] = qRgb(k * in[0] / 255, k * in[1] / 255, k * in[2] / 255);
- //out[i] = qRgb(in[0], in[1], in[2]);
- }
- } else {
- in = (uchar*)out + cols24Bit;
- for (uint i = scaledWidth(); i--; ) {
- in -= 3;
+ } else if (cinfo->out_color_space == JCS_CMYK) {
+ in = data + clip.right() * 4;
+ for (int i = clip.width(); i--; ) {
+ int k = in[3];
+ out[i] = qRgb(k * in[0] / 255, k * in[1] / 255, k * in[2] / 255);
+ in -= 4;
+ }
+ } else {
+ in = data + clip.right() * 3;
+ for (int i = clip.width(); i--; ) {
out[i] = qRgb(in[0], in[1], in[2]);
+ in -= 3;
}
}
@@ -637,18 +612,6 @@ inline my_jpeg_source_mgr::my_jpeg_source_mgr(QIODevice *device)
}
-static void scaleSize(int &reqW, int &reqH, int imgW, int imgH, Qt::AspectRatioMode mode)
-{
- if (mode == Qt::IgnoreAspectRatio)
- return;
- int t1 = imgW * reqH;
- int t2 = reqW * imgH;
- if ((mode == Qt::KeepAspectRatio && (t1 > t2)) || (mode == Qt::KeepAspectRatioByExpanding && (t1 < t2)))
- reqH = t2 / imgW;
- else
- reqW = t1 / imgH;
-}
-
static bool read_jpeg_size(QIODevice *device, int &w, int &h)
{
bool rt = false;
@@ -729,7 +692,7 @@ static bool read_jpeg_format(QIODevice *device, QImage::Format &format)
}
static bool ensureValidImage(QImage *dest, struct jpeg_decompress_struct *info,
- bool dummy = false)
+ const QSize& size)
{
QImage::Format format;
switch (info->output_components) {
@@ -744,13 +707,8 @@ static bool ensureValidImage(QImage *dest, struct jpeg_decompress_struct *info,
return false; // unsupported format
}
- const QSize size(info->output_width, info->output_height);
if (dest->size() != size || dest->format() != format) {
- static uchar dummyImage[1];
- if (dummy) // Create QImage but don't read the pixels
- *dest = QImage(dummyImage, size.width(), size.height(), format);
- else
- *dest = QImage(size, format);
+ *dest = QImage(size, format);
if (format == QImage::Format_Indexed8) {
dest->setColorCount(256);
@@ -763,13 +721,9 @@ static bool ensureValidImage(QImage *dest, struct jpeg_decompress_struct *info,
}
static bool read_jpeg_image(QIODevice *device, QImage *outImage,
- const QByteArray &parameters, QSize scaledSize,
- int inQuality )
+ QSize scaledSize, QRect scaledClipRect,
+ QRect clipRect, int inQuality )
{
-#ifdef QT_NO_IMAGE_SMOOTHSCALE
- Q_UNUSED( scaledSize );
-#endif
-
struct jpeg_decompress_struct cinfo;
struct my_jpeg_source_mgr *iod_src = new my_jpeg_source_mgr(device);
@@ -794,18 +748,53 @@ static bool read_jpeg_image(QIODevice *device, QImage *outImage,
if (quality < 0)
quality = 75;
- QString params = QString::fromLatin1(parameters);
- params.simplified();
- int sWidth = 0, sHeight = 0;
- char sModeStr[1024] = "";
- Qt::AspectRatioMode sMode;
+ // If possible, merge the scaledClipRect into either scaledSize
+ // or clipRect to avoid doing a separate scaled clipping pass.
+ // Best results are achieved by clipping before scaling, not after.
+ if (!scaledClipRect.isEmpty()) {
+ if (scaledSize.isEmpty() && clipRect.isEmpty()) {
+ // No clipping or scaling before final clip.
+ clipRect = scaledClipRect;
+ scaledClipRect = QRect();
+ } else if (scaledSize.isEmpty()) {
+ // Clipping, but no scaling: combine the clip regions.
+ scaledClipRect.translate(clipRect.topLeft());
+ clipRect = scaledClipRect.intersected(clipRect);
+ scaledClipRect = QRect();
+ } else if (clipRect.isEmpty()) {
+ // No clipping, but scaling: if we can map back to an
+ // integer pixel boundary, then clip before scaling.
+ if ((cinfo.image_width % scaledSize.width()) == 0 &&
+ (cinfo.image_height % scaledSize.height()) == 0) {
+ int x = scaledClipRect.x() * cinfo.image_width /
+ scaledSize.width();
+ int y = scaledClipRect.y() * cinfo.image_height /
+ scaledSize.height();
+ int width = (scaledClipRect.right() + 1) *
+ cinfo.image_width / scaledSize.width() - x;
+ int height = (scaledClipRect.bottom() + 1) *
+ cinfo.image_height / scaledSize.height() - y;
+ clipRect = QRect(x, y, width, height);
+ scaledSize = scaledClipRect.size();
+ scaledClipRect = QRect();
+ }
+ } else {
+ // Clipping and scaling: too difficult to figure out,
+ // and not a likely use case, so do it the long way.
+ }
+ }
-#ifndef QT_NO_IMAGE_SMOOTHSCALE
- // If high quality not required, shrink image during decompression
- if (scaledSize.isValid() && !scaledSize.isEmpty() && quality < HIGH_QUALITY_THRESHOLD
- && !params.contains(QLatin1String("GetHeaderInformation")) ) {
- cinfo.scale_denom = qMin(cinfo.image_width / scaledSize.width(),
- cinfo.image_width / scaledSize.height());
+ // Determine the scale factor to pass to libjpeg for quick downscaling.
+ if (!scaledSize.isEmpty()) {
+ if (clipRect.isEmpty()) {
+ cinfo.scale_denom =
+ qMin(cinfo.image_width / scaledSize.width(),
+ cinfo.image_height / scaledSize.height());
+ } else {
+ cinfo.scale_denom =
+ qMin(clipRect.width() / scaledSize.width(),
+ clipRect.height() / scaledSize.height());
+ }
if (cinfo.scale_denom < 2) {
cinfo.scale_denom = 1;
} else if (cinfo.scale_denom < 4) {
@@ -816,9 +805,19 @@ static bool read_jpeg_image(QIODevice *device, QImage *outImage,
cinfo.scale_denom = 8;
}
cinfo.scale_num = 1;
+ if (!clipRect.isEmpty()) {
+ // Correct the scale factor so that we clip accurately.
+ // It is recommended that the clip rectangle be aligned
+ // on an 8-pixel boundary for best performance.
+ while (cinfo.scale_denom > 1 &&
+ ((clipRect.x() % cinfo.scale_denom) != 0 ||
+ (clipRect.y() % cinfo.scale_denom) != 0 ||
+ (clipRect.width() % cinfo.scale_denom) != 0 ||
+ (clipRect.height() % cinfo.scale_denom) != 0)) {
+ cinfo.scale_denom /= 2;
+ }
+ }
}
-#endif
-
// If high quality not required, use fast decompression
if( quality < HIGH_QUALITY_THRESHOLD ) {
@@ -826,132 +825,102 @@ static bool read_jpeg_image(QIODevice *device, QImage *outImage,
cinfo.do_fancy_upsampling = FALSE;
}
+ (void) jpeg_calc_output_dimensions(&cinfo);
- (void) jpeg_start_decompress(&cinfo);
+ // Determine the clip region to extract.
+ QRect imageRect(0, 0, cinfo.output_width, cinfo.output_height);
+ QRect clip;
+ if (clipRect.isEmpty()) {
+ clip = imageRect;
+ } else if (cinfo.scale_denom == 1) {
+ clip = clipRect.intersected(imageRect);
+ } else {
+ // The scale factor was corrected above to ensure that
+ // we don't miss pixels when we scale the clip rectangle.
+ clip = QRect(clipRect.x() / int(cinfo.scale_denom),
+ clipRect.y() / int(cinfo.scale_denom),
+ clipRect.width() / int(cinfo.scale_denom),
+ clipRect.height() / int(cinfo.scale_denom));
+ clip = clip.intersected(imageRect);
+ }
- if (params.contains(QLatin1String("GetHeaderInformation"))) {
- if (!ensureValidImage(outImage, &cinfo, true))
- longjmp(jerr.setjmp_buffer, 1);
- } else if (params.contains(QLatin1String("Scale"))) {
-#if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(Q_OS_WINCE)
- sscanf_s(params.toLatin1().data(), "Scale(%i, %i, %1023s)",
- &sWidth, &sHeight, sModeStr, sizeof(sModeStr));
-#else
- sscanf(params.toLatin1().data(), "Scale(%i, %i, %1023s)",
- &sWidth, &sHeight, sModeStr);
-#endif
+#ifndef QT_NO_IMAGE_SMOOTHSCALE
+ if (scaledSize.isValid() && scaledSize != clip.size()
+ && quality >= HIGH_QUALITY_THRESHOLD) {
- QString sModeQStr(QString::fromLatin1(sModeStr));
- if (sModeQStr == QLatin1String("IgnoreAspectRatio")) {
- sMode = Qt::IgnoreAspectRatio;
- } else if (sModeQStr == QLatin1String("KeepAspectRatio")) {
- sMode = Qt::KeepAspectRatio;
- } else if (sModeQStr == QLatin1String("KeepAspectRatioByExpanding")) {
- sMode = Qt::KeepAspectRatioByExpanding;
- } else {
- qDebug("read_jpeg_image: invalid aspect ratio mode \"%s\", see QImage::AspectRatioMode documentation", sModeStr);
- sMode = Qt::KeepAspectRatio;
- }
+ (void) jpeg_start_decompress(&cinfo);
-// qDebug("Parameters ask to scale the image to %i x %i AspectRatioMode: %s", sWidth, sHeight, sModeStr);
- scaleSize(sWidth, sHeight, cinfo.output_width, cinfo.output_height, sMode);
-// qDebug("Scaling the jpeg to %i x %i", sWidth, sHeight, sModeStr);
-
- if (cinfo.output_components == 3 || cinfo.output_components == 4) {
- if (outImage->size() != QSize(sWidth, sHeight) || outImage->format() != QImage::Format_RGB32)
- *outImage = QImage(sWidth, sHeight, QImage::Format_RGB32);
- } else if (cinfo.output_components == 1) {
- if (outImage->size() != QSize(sWidth, sHeight) || outImage->format() != QImage::Format_Indexed8)
- *outImage = QImage(sWidth, sHeight, QImage::Format_Indexed8);
- outImage->setColorCount(256);
- for (int i = 0; i < 256; ++i)
- outImage->setColor(i, qRgb(i,i,i));
- } else {
- // Unsupported format
- }
- if (outImage->isNull())
+ jpegSmoothScaler scaler(&cinfo, scaledSize, clip);
+ *outImage = scaler.scale();
+ } else
+#endif
+ {
+ // Allocate memory for the clipped QImage.
+ if (!ensureValidImage(outImage, &cinfo, clip.size()))
longjmp(jerr.setjmp_buffer, 1);
- if (!outImage->isNull()) {
- QImage tmpImage(cinfo.output_width, 1, QImage::Format_RGB32);
- uchar* inData = tmpImage.bits();
- uchar* outData = outImage->bits();
- int out_bpl = outImage->bytesPerLine();
+ // Avoid memcpy() overhead if grayscale with no clipping.
+ bool quickGray = (cinfo.output_components == 1 &&
+ clip == imageRect);
+ if (!quickGray) {
+ // Ask the jpeg library to allocate a temporary row.
+ // The library will automatically delete it for us later.
+ // The libjpeg docs say we should do this before calling
+ // jpeg_start_decompress(). We can't use "new" here
+ // because we are inside the setjmp() block and an error
+ // in the jpeg input stream would cause a memory leak.
+ JSAMPARRAY rows = (cinfo.mem->alloc_sarray)
+ ((j_common_ptr)&cinfo, JPOOL_IMAGE,
+ cinfo.output_width * cinfo.output_components, 1);
+
+ (void) jpeg_start_decompress(&cinfo);
+
while (cinfo.output_scanline < cinfo.output_height) {
- int outputLine = sHeight * cinfo.output_scanline / cinfo.output_height;
- (void) jpeg_read_scanlines(&cinfo, &inData, 1);
+ int y = int(cinfo.output_scanline) - clip.y();
+ if (y >= clip.height())
+ break; // We've read the entire clip region, so abort.
+
+ (void) jpeg_read_scanlines(&cinfo, rows, 1);
+
+ if (y < 0)
+ continue; // Haven't reached the starting line yet.
+
if (cinfo.output_components == 3) {
- uchar *in = inData;
- QRgb *out = (QRgb*)outData + outputLine * out_bpl;
- for (uint i=0; i<cinfo.output_width; i++) {
-// ### Only scaling down an image works, I don't think scaling up will work at the moment
-// ### An idea I have to make this a smooth scale is to progressively add the pixel values up
-// When scaling down, multiple values are being over drawn in to the output buffer.
-// Instead, a weighting based on the distance the line or pixel is from the output pixel determines
-// the weight of it when added to the output buffer. At present it is a non-smooth scale which is
-// inefficently implemented, it still uncompresses all the jpeg, an optimization for progressive
-// jpegs could be made if scaling by say 50% or some other special cases
- out[sWidth * i / cinfo.output_width] = qRgb(in[0], in[1], in[2]);
+ // Expand 24->32 bpp.
+ uchar *in = rows[0] + clip.x() * 3;
+ QRgb *out = (QRgb*)outImage->scanLine(y);
+ for (int i = 0; i < clip.width(); ++i) {
+ *out++ = qRgb(in[0], in[1], in[2]);
in += 3;
}
- } else {
-// ### Need to test the case where the jpeg is grayscale, need some black and white jpegs to test
-// this code. (also only scales down and probably won't scale to a larger size)
- uchar *in = inData;
- uchar *out = outData + outputLine*out_bpl;
- for (uint i=0; i<cinfo.output_width; i++) {
- out[sWidth * i / cinfo.output_width] = in[i];
+ } else if (cinfo.out_color_space == JCS_CMYK) {
+ // Convert CMYK->RGB.
+ uchar *in = rows[0] + clip.x() * 4;
+ QRgb *out = (QRgb*)outImage->scanLine(y);
+ for (int i = 0; i < clip.width(); ++i) {
+ int k = in[3];
+ *out++ = qRgb(k * in[0] / 255, k * in[1] / 255,
+ k * in[2] / 255);
+ in += 4;
}
+ } else if (cinfo.output_components == 1) {
+ // Grayscale.
+ memcpy(outImage->scanLine(y),
+ rows[0] + clip.x(), clip.width());
}
}
- (void) jpeg_finish_decompress(&cinfo);
- }
-#ifndef QT_NO_IMAGE_SMOOTHSCALE
- } else if (scaledSize.isValid() && scaledSize != QSize(cinfo.output_width, cinfo.output_height)
- && quality >= HIGH_QUALITY_THRESHOLD) {
-
- jpegSmoothScaler scaler(&cinfo, QString().sprintf("Scale( %d, %d, ScaleFree )",
- scaledSize.width(),
- scaledSize.height()).toLatin1().data());
- *outImage = scaler.scale();
-#endif
- } else {
- if (!ensureValidImage(outImage, &cinfo))
- longjmp(jerr.setjmp_buffer, 1);
-
- uchar* data = outImage->bits();
- int bpl = outImage->bytesPerLine();
- while (cinfo.output_scanline < cinfo.output_height) {
- uchar *d = data + cinfo.output_scanline * bpl;
- (void) jpeg_read_scanlines(&cinfo,
- &d,
- 1);
+ } else {
+ // Load unclipped grayscale data directly into the QImage.
+ (void) jpeg_start_decompress(&cinfo);
+ while (cinfo.output_scanline < cinfo.output_height) {
+ uchar *row = outImage->scanLine(cinfo.output_scanline);
+ (void) jpeg_read_scanlines(&cinfo, &row, 1);
+ }
}
- (void) jpeg_finish_decompress(&cinfo);
- if (cinfo.output_components == 3) {
- // Expand 24->32 bpp.
- for (uint j=0; j<cinfo.output_height; j++) {
- uchar *in = outImage->scanLine(j) + cinfo.output_width * 3;
- QRgb *out = (QRgb*)outImage->scanLine(j);
+ if (cinfo.output_scanline == cinfo.output_height)
+ (void) jpeg_finish_decompress(&cinfo);
- for (uint i=cinfo.output_width; i--;) {
- in-=3;
- out[i] = qRgb(in[0], in[1], in[2]);
- }
- }
- } else if (cinfo.out_color_space == JCS_CMYK) {
- for (uint j = 0; j < cinfo.output_height; ++j) {
- uchar *in = outImage->scanLine(j) + cinfo.output_width * 4;
- QRgb *out = (QRgb*)outImage->scanLine(j);
-
- for (uint i = cinfo.output_width; i--; ) {
- in-=4;
- int k = in[3];
- out[i] = qRgb(k * in[0] / 255, k * in[1] / 255, k * in[2] / 255);
- }
- }
- }
if (cinfo.density_unit == 1) {
outImage->setDotsPerMeterX(int(100. * cinfo.X_density / 2.54));
outImage->setDotsPerMeterY(int(100. * cinfo.Y_density / 2.54));
@@ -960,13 +929,15 @@ static bool read_jpeg_image(QIODevice *device, QImage *outImage,
outImage->setDotsPerMeterY(int(100. * cinfo.Y_density));
}
- if (scaledSize.isValid() && scaledSize != QSize(cinfo.output_width, cinfo.output_height))
+ if (scaledSize.isValid() && scaledSize != clip.size())
*outImage = outImage->scaled(scaledSize, Qt::IgnoreAspectRatio, Qt::FastTransformation);
}
}
jpeg_destroy_decompress(&cinfo);
delete iod_src;
+ if (!scaledClipRect.isEmpty())
+ *outImage = outImage->copy(scaledClipRect);
return !outImage->isNull();
}
@@ -1224,7 +1195,7 @@ bool QJpegHandler::read(QImage *image)
{
if (!canRead())
return false;
- return read_jpeg_image(device(), image, parameters, scaledSize, quality);
+ return read_jpeg_image(device(), image, scaledSize, scaledClipRect, clipRect, quality);
}
bool QJpegHandler::write(const QImage &image)
@@ -1235,9 +1206,9 @@ bool QJpegHandler::write(const QImage &image)
bool QJpegHandler::supportsOption(ImageOption option) const
{
return option == Quality
-#ifndef QT_NO_IMAGE_SMOOTHSCALE
|| option == ScaledSize
-#endif
+ || option == ScaledClipRect
+ || option == ClipRect
|| option == Size
|| option == ImageFormat;
}
@@ -1246,10 +1217,12 @@ QVariant QJpegHandler::option(ImageOption option) const
{
if (option == Quality) {
return quality;
-#ifndef QT_NO_IMAGE_SMOOTHSCALE
} else if (option == ScaledSize) {
return scaledSize;
-#endif
+ } else if (option == ScaledClipRect) {
+ return scaledClipRect;
+ } else if (option == ClipRect) {
+ return clipRect;
} else if (option == Size) {
if (canRead() && !device()->isSequential()) {
qint64 pos = device()->pos();
@@ -1276,10 +1249,12 @@ void QJpegHandler::setOption(ImageOption option, const QVariant &value)
{
if (option == Quality)
quality = value.toInt();
-#ifndef QT_NO_IMAGE_SMOOTHSCALE
else if ( option == ScaledSize )
scaledSize = value.toSize();
-#endif
+ else if ( option == ScaledClipRect )
+ scaledClipRect = value.toRect();
+ else if ( option == ClipRect )
+ clipRect = value.toRect();
}
QByteArray QJpegHandler::name() const
diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.h b/src/plugins/imageformats/jpeg/qjpeghandler.h
index 654c078..6870cd6 100644
--- a/src/plugins/imageformats/jpeg/qjpeghandler.h
+++ b/src/plugins/imageformats/jpeg/qjpeghandler.h
@@ -44,6 +44,7 @@
#include <QtGui/qimageiohandler.h>
#include <QtCore/QSize>
+#include <QtCore/QRect>
QT_BEGIN_NAMESPACE
@@ -66,8 +67,9 @@ public:
private:
int quality;
- QByteArray parameters;
QSize scaledSize;
+ QRect scaledClipRect;
+ QRect clipRect;
};
QT_END_NAMESPACE
diff --git a/src/plugins/imageformats/tiff/qtiffhandler.cpp b/src/plugins/imageformats/tiff/qtiffhandler.cpp
index 9538745..7ac9722 100644
--- a/src/plugins/imageformats/tiff/qtiffhandler.cpp
+++ b/src/plugins/imageformats/tiff/qtiffhandler.cpp
@@ -192,11 +192,10 @@ bool QTiffHandler::read(QImage *image)
return false;
}
+ // BitsPerSample defaults to 1 according to the TIFF spec.
uint16 bitPerSample;
- if (!TIFFGetField(tiff, TIFFTAG_BITSPERSAMPLE, &bitPerSample)) {
- TIFFClose(tiff);
- return false;
- }
+ if (!TIFFGetField(tiff, TIFFTAG_BITSPERSAMPLE, &bitPerSample))
+ bitPerSample = 1;
bool grayscale = photometric == PHOTOMETRIC_MINISBLACK || photometric == PHOTOMETRIC_MINISWHITE;
if (grayscale && bitPerSample == 1) {
diff --git a/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro b/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro
index 9687908..691cce1 100644
--- a/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro
+++ b/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro
@@ -3,7 +3,7 @@ TEMPLATE = subdirs
# We just want to export the sqlite3 binaries for Symbian for platforms that do not have them.
symbian {
- !exists($${EPOCROOT}epoc32/release/armv5/lib/sqlite3.dso) {
+ !symbian_no_export_sqlite:!exists($${EPOCROOT}epoc32/release/armv5/lib/sqlite3.dso) {
BLD_INF_RULES.prj_exports += ":zip SQLite3_v9.2.zip"
}
}
diff --git a/src/s60installs/bwins/QtCoreu.def b/src/s60installs/bwins/QtCoreu.def
index 49c4361..fe752c8 100644
--- a/src/s60installs/bwins/QtCoreu.def
+++ b/src/s60installs/bwins/QtCoreu.def
@@ -2264,7 +2264,7 @@ EXPORTS
?isSequential@QIODevice@@UBE_NXZ @ 2263 NONAME ; bool QIODevice::isSequential(void) const
?isSequential@QIODevicePrivate@@QBE_NXZ @ 2264 NONAME ; bool QIODevicePrivate::isSequential(void) const
?isSequential@QProcess@@UBE_NXZ @ 2265 NONAME ; bool QProcess::isSequential(void) const
- ?isSignalConnected@QObjectPrivate@@QBE_NH@Z @ 2266 NONAME ; bool QObjectPrivate::isSignalConnected(int) const
+ ?isSignalConnected@QObjectPrivate@@QBE_NI@Z @ 2266 NONAME ; bool QObjectPrivate::isSignalConnected(unsigned int) const
?isSimpleText@QString@@QBE_NXZ @ 2267 NONAME ; bool QString::isSimpleText(void) const
?isSingleShot@QTimer@@QBE_NXZ @ 2268 NONAME ; bool QTimer::isSingleShot(void) const
?isSpace@QChar@@QBE_NXZ @ 2269 NONAME ; bool QChar::isSpace(void) const
diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def
index 60df1f5..7a629d7 100644
--- a/src/s60installs/bwins/QtGuiu.def
+++ b/src/s60installs/bwins/QtGuiu.def
@@ -2503,7 +2503,7 @@ EXPORTS
?cacheMode@QMovie@@QAE?AW4CacheMode@1@XZ @ 2502 NONAME ; enum QMovie::CacheMode QMovie::cacheMode(void)
?cacheMode@QMovie@@QBE?AW4CacheMode@1@XZ @ 2503 NONAME ; enum QMovie::CacheMode QMovie::cacheMode(void) const
?cacheStatistics@QFont@@SAXXZ @ 2504 NONAME ; void QFont::cacheStatistics(void)
- ?cacheType@QTextureGlyphCache@@QBE?AW4Type@QFontEngineGlyphCache@@XZ @ 2505 NONAME ; enum QFontEngineGlyphCache::Type QTextureGlyphCache::cacheType(void) const
+ ?cacheType@QTextureGlyphCache@@QBE?AW4Type@QFontEngineGlyphCache@@XZ @ 2505 NONAME ABSENT ; enum QFontEngineGlyphCache::Type QTextureGlyphCache::cacheType(void) const
?calcEffectiveOpacity@QGraphicsItemPrivate@@QBEMXZ @ 2506 NONAME ; float QGraphicsItemPrivate::calcEffectiveOpacity(void) const
?calculateTabWidth@QTextEngine@@QBE?AUQFixed@@HU2@@Z @ 2507 NONAME ; struct QFixed QTextEngine::calculateTabWidth(int, struct QFixed) const
?calendarPopup@QDateTimeEdit@@QBE_NXZ @ 2508 NONAME ; bool QDateTimeEdit::calendarPopup(void) const
@@ -4299,7 +4299,7 @@ EXPORTS
?expandingDirections@QSpacerItem@@UBE?AV?$QFlags@W4Orientation@Qt@@@@XZ @ 4298 NONAME ; class QFlags<enum Qt::Orientation> QSpacerItem::expandingDirections(void) const
?expandingDirections@QWidgetItem@@UBE?AV?$QFlags@W4Orientation@Qt@@@@XZ @ 4299 NONAME ; class QFlags<enum Qt::Orientation> QWidgetItem::expandingDirections(void) const
?expandsOnDoubleClick@QTreeView@@QBE_NXZ @ 4300 NONAME ; bool QTreeView::expandsOnDoubleClick(void) const
- ?expireGlyphCache@QFontEngine@@AAEXXZ @ 4301 NONAME ; void QFontEngine::expireGlyphCache(void)
+ ?expireGlyphCache@QFontEngine@@AAEXXZ @ 4301 NONAME ABSENT ; void QFontEngine::expireGlyphCache(void)
?extension@QDialog@@QBEPAVQWidget@@XZ @ 4302 NONAME ; class QWidget * QDialog::extension(void) const
?extension@QGraphicsEllipseItem@@MBE?AVQVariant@@ABV2@@Z @ 4303 NONAME ; class QVariant QGraphicsEllipseItem::extension(class QVariant const &) const
?extension@QGraphicsItem@@MBE?AVQVariant@@ABV2@@Z @ 4304 NONAME ; class QVariant QGraphicsItem::extension(class QVariant const &) const
@@ -4933,8 +4933,8 @@ EXPORTS
?globalY@QMouseEvent@@QBEHXZ @ 4932 NONAME ; int QMouseEvent::globalY(void) const
?globalY@QTabletEvent@@QBEHXZ @ 4933 NONAME ; int QTabletEvent::globalY(void) const
?globalY@QWheelEvent@@QBEHXZ @ 4934 NONAME ; int QWheelEvent::globalY(void) const
- ?glyphCache@QFontEngine@@QBEPAVQFontEngineGlyphCache@@PAXABVQTransform@@@Z @ 4935 NONAME ; class QFontEngineGlyphCache * QFontEngine::glyphCache(void *, class QTransform const &) const
- ?glyphCache@QFontEngine@@QBEPAVQFontEngineGlyphCache@@W4Type@2@ABVQTransform@@@Z @ 4936 NONAME ; class QFontEngineGlyphCache * QFontEngine::glyphCache(enum QFontEngineGlyphCache::Type, class QTransform const &) const
+ ?glyphCache@QFontEngine@@QBEPAVQFontEngineGlyphCache@@PAXABVQTransform@@@Z @ 4935 NONAME ABSENT ; class QFontEngineGlyphCache * QFontEngine::glyphCache(void *, class QTransform const &) const
+ ?glyphCache@QFontEngine@@QBEPAVQFontEngineGlyphCache@@W4Type@2@ABVQTransform@@@Z @ 4936 NONAME ABSENT ; class QFontEngineGlyphCache * QFontEngine::glyphCache(enum QFontEngineGlyphCache::Type, class QTransform const &) const
?glyphCount@QFontEngine@@UBEHXZ @ 4937 NONAME ; int QFontEngine::glyphCount(void) const
?glyphMargin@QTextureGlyphCache@@UBEHXZ @ 4938 NONAME ; int QTextureGlyphCache::glyphMargin(void) const
?gotFocus@QFocusEvent@@QBE_NXZ @ 4939 NONAME ; bool QFocusEvent::gotFocus(void) const
@@ -9103,7 +9103,7 @@ EXPORTS
?setGestureCancelPolicy@QGesture@@QAEXW4GestureCancelPolicy@1@@Z @ 9102 NONAME ; void QGesture::setGestureCancelPolicy(enum QGesture::GestureCancelPolicy)
?setGlobalStrut@QApplication@@SAXABVQSize@@@Z @ 9103 NONAME ; void QApplication::setGlobalStrut(class QSize const &)
?setGlyphCache@QFontEngine@@QAEXPAXPAVQFontEngineGlyphCache@@@Z @ 9104 NONAME ; void QFontEngine::setGlyphCache(void *, class QFontEngineGlyphCache *)
- ?setGlyphCache@QFontEngine@@QAEXW4Type@QFontEngineGlyphCache@@PAV3@@Z @ 9105 NONAME ; void QFontEngine::setGlyphCache(enum QFontEngineGlyphCache::Type, class QFontEngineGlyphCache *)
+ ?setGlyphCache@QFontEngine@@QAEXW4Type@QFontEngineGlyphCache@@PAV3@@Z @ 9105 NONAME ABSENT ; void QFontEngine::setGlyphCache(enum QFontEngineGlyphCache::Type, class QFontEngineGlyphCache *)
?setGraphicsEffect@QGraphicsItem@@QAEXPAVQGraphicsEffect@@@Z @ 9106 NONAME ; void QGraphicsItem::setGraphicsEffect(class QGraphicsEffect *)
?setGraphicsEffect@QWidget@@QAEXPAVQGraphicsEffect@@@Z @ 9107 NONAME ; void QWidget::setGraphicsEffect(class QGraphicsEffect *)
?setGraphicsEffectSource@QGraphicsEffectPrivate@@QAEXPAVQGraphicsEffectSource@@@Z @ 9108 NONAME ; void QGraphicsEffectPrivate::setGraphicsEffectSource(class QGraphicsEffectSource *)
@@ -12517,9 +12517,12 @@ EXPORTS
?effectiveFocusWidget@QWidgetPrivate@@QAEPAVQWidget@@XZ @ 12516 NONAME ; class QWidget * QWidgetPrivate::effectiveFocusWidget(void)
?ignoreUnusedNavigationEvents@QTextControl@@QBE_NXZ @ 12517 NONAME ; bool QTextControl::ignoreUnusedNavigationEvents(void) const
?setIgnoreUnusedNavigationEvents@QTextControl@@QAEX_N@Z @ 12518 NONAME ; void QTextControl::setIgnoreUnusedNavigationEvents(bool)
- ?discardUpdateRequest@QGraphicsItemPrivate@@QBE_N_N00@Z @ 12519 NONAME ; bool QGraphicsItemPrivate::discardUpdateRequest(bool, bool, bool) const
- ??1QImagePixmapCleanupHooks@@QAE@XZ @ 12520 NONAME ; QImagePixmapCleanupHooks::~QImagePixmapCleanupHooks(void)
+ ??1QImagePixmapCleanupHooks@@QAE@XZ @ 12519 NONAME ; QImagePixmapCleanupHooks::~QImagePixmapCleanupHooks(void)
+ ??1QVectorPath@@QAE@XZ @ 12520 NONAME ; QVectorPath::~QVectorPath(void)
?addCacheData@QVectorPath@@QBEPAUCacheEntry@1@PAVQPaintEngineEx@@PAXP6AX01@Z@Z @ 12521 NONAME ; struct QVectorPath::CacheEntry * QVectorPath::addCacheData(class QPaintEngineEx *, void *, void (*)(class QPaintEngineEx *, void *)) const
- ?makeCacheable@QVectorPath@@QBEXXZ @ 12522 NONAME ; void QVectorPath::makeCacheable(void) const
- ??1QVectorPath@@QAE@XZ @ 12523 NONAME ; QVectorPath::~QVectorPath(void)
+ ?discardUpdateRequest@QGraphicsItemPrivate@@QBE_N_N00@Z @ 12522 NONAME ; bool QGraphicsItemPrivate::discardUpdateRequest(bool, bool, bool) const
+ ?makeCacheable@QVectorPath@@QBEXXZ @ 12523 NONAME ; void QVectorPath::makeCacheable(void) const
+ ??0Tab@QTextOption@@QAE@ABU01@@Z @ 12524 NONAME ; QTextOption::Tab::Tab(struct QTextOption::Tab const &)
+ ?effectiveBoundingRect@QGraphicsItemPrivate@@QBE?AVQRectF@@ABV2@@Z @ 12525 NONAME ; class QRectF QGraphicsItemPrivate::effectiveBoundingRect(class QRectF const &) const
+ ?glyphCache@QFontEngine@@QBEPAVQFontEngineGlyphCache@@PAXW4Type@2@ABVQTransform@@@Z @ 12526 NONAME ; class QFontEngineGlyphCache * QFontEngine::glyphCache(void *, enum QFontEngineGlyphCache::Type, class QTransform const &) const
diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def
index 429ca79..b6862e5 100644
--- a/src/s60installs/eabi/QtGuiu.def
+++ b/src/s60installs/eabi/QtGuiu.def
@@ -698,13 +698,13 @@ EXPORTS
_ZN11QFontDialogD2Ev @ 697 NONAME
_ZN11QFontEngine11boundingBoxEjRK10QTransform @ 698 NONAME
_ZN11QFontEngine11grayPaletteEv @ 699 NONAME
- _ZN11QFontEngine13setGlyphCacheEN21QFontEngineGlyphCache4TypeEPS0_ @ 700 NONAME
+ _ZN11QFontEngine13setGlyphCacheEN21QFontEngineGlyphCache4TypeEPS0_ @ 700 NONAME ABSENT
_ZN11QFontEngine13setGlyphCacheEPvP21QFontEngineGlyphCache @ 701 NONAME
_ZN11QFontEngine15addGlyphsToPathEPjP11QFixedPointiP12QPainterPath6QFlagsIN9QTextItem10RenderFlagEE @ 702 NONAME
_ZN11QFontEngine16addOutlineToPathEffRK12QGlyphLayoutP12QPainterPath6QFlagsIN9QTextItem10RenderFlagEE @ 703 NONAME
_ZN11QFontEngine16alphaMapForGlyphEj @ 704 NONAME
_ZN11QFontEngine16alphaMapForGlyphEjRK10QTransform @ 705 NONAME
- _ZN11QFontEngine16expireGlyphCacheEv @ 706 NONAME
+ _ZN11QFontEngine16expireGlyphCacheEv @ 706 NONAME ABSENT
_ZN11QFontEngine16getUnscaledGlyphEjP12QPainterPathP15glyph_metrics_t @ 707 NONAME
_ZN11QFontEngine16loadKerningPairsE6QFixed @ 708 NONAME
_ZN11QFontEngine16tightBoundingBoxERK12QGlyphLayout @ 709 NONAME
@@ -7615,8 +7615,8 @@ EXPORTS
_ZNK11QFontDialog11currentFontEv @ 7614 NONAME
_ZNK11QFontDialog12selectedFontEv @ 7615 NONAME
_ZNK11QFontDialog7optionsEv @ 7616 NONAME
- _ZNK11QFontEngine10glyphCacheEN21QFontEngineGlyphCache4TypeERK10QTransform @ 7617 NONAME
- _ZNK11QFontEngine10glyphCacheEPvRK10QTransform @ 7618 NONAME
+ _ZNK11QFontEngine10glyphCacheEN21QFontEngineGlyphCache4TypeERK10QTransform @ 7617 NONAME ABSENT
+ _ZNK11QFontEngine10glyphCacheEPvRK10QTransform @ 7618 NONAME ABSENT
_ZNK11QFontEngine10glyphCountEv @ 7619 NONAME
_ZNK11QFontEngine10propertiesEv @ 7620 NONAME
_ZNK11QFontEngine12getSfntTableEj @ 7621 NONAME
@@ -11741,4 +11741,47 @@ EXPORTS
_ZN11QVectorPathD2Ev @ 11740 NONAME
_ZNK11QVectorPath12addCacheDataEP14QPaintEngineExPvPFvS1_S2_E @ 11741 NONAME
_ZNK20QGraphicsItemPrivate20discardUpdateRequestEbbb @ 11742 NONAME
+ _ZN11QEglContext10extensionsEv @ 11743 NONAME ABSENT
+ _ZN11QEglContext10getDisplayEP12QPaintDevice @ 11744 NONAME ABSENT
+ _ZN11QEglContext10waitClientEv @ 11745 NONAME ABSENT
+ _ZN11QEglContext10waitNativeEv @ 11746 NONAME ABSENT
+ _ZN11QEglContext11doneCurrentEv @ 11747 NONAME ABSENT
+ _ZN11QEglContext11errorStringEi @ 11748 NONAME ABSENT
+ _ZN11QEglContext11makeCurrentEi @ 11749 NONAME ABSENT
+ _ZN11QEglContext11openDisplayEP12QPaintDevice @ 11750 NONAME ABSENT
+ _ZN11QEglContext11swapBuffersEi @ 11751 NONAME ABSENT
+ _ZN11QEglContext12chooseConfigERK14QEglPropertiesN4QEgl16PixelFormatMatchE @ 11752 NONAME ABSENT
+ _ZN11QEglContext12hasExtensionEPKc @ 11753 NONAME ABSENT
+ _ZN11QEglContext13createContextEPS_PK14QEglProperties @ 11754 NONAME ABSENT
+ _ZN11QEglContext13createSurfaceEP12QPaintDevicePK14QEglProperties @ 11755 NONAME ABSENT
+ _ZN11QEglContext14currentContextEN4QEgl3APIE @ 11756 NONAME ABSENT
+ _ZN11QEglContext14defaultDisplayEP12QPaintDevice @ 11757 NONAME ABSENT
+ _ZN11QEglContext14destroySurfaceEi @ 11758 NONAME ABSENT
+ _ZN11QEglContext14dumpAllConfigsEv @ 11759 NONAME ABSENT
+ _ZN11QEglContext15lazyDoneCurrentEv @ 11760 NONAME ABSENT
+ _ZN11QEglContext17setCurrentContextEN4QEgl3APIEPS_ @ 11761 NONAME ABSENT
+ _ZN11QEglContext7destroyEv @ 11762 NONAME ABSENT
+ _ZN11QEglContextC1Ev @ 11763 NONAME ABSENT
+ _ZN11QEglContextC2Ev @ 11764 NONAME ABSENT
+ _ZN11QEglContextD1Ev @ 11765 NONAME ABSENT
+ _ZN11QEglContextD2Ev @ 11766 NONAME ABSENT
+ _ZN14QEglProperties11removeValueEi @ 11767 NONAME ABSENT
+ _ZN14QEglProperties14dumpAllConfigsEv @ 11768 NONAME ABSENT
+ _ZN14QEglProperties14setPixelFormatEN6QImage6FormatE @ 11769 NONAME ABSENT
+ _ZN14QEglProperties17setRenderableTypeEN4QEgl3APIE @ 11770 NONAME ABSENT
+ _ZN14QEglProperties19reduceConfigurationEv @ 11771 NONAME ABSENT
+ _ZN14QEglProperties20setPaintDeviceFormatEP12QPaintDevice @ 11772 NONAME ABSENT
+ _ZN14QEglProperties8setValueEii @ 11773 NONAME ABSENT
+ _ZN14QEglPropertiesC1Ei @ 11774 NONAME ABSENT
+ _ZN14QEglPropertiesC1Ev @ 11775 NONAME ABSENT
+ _ZN14QEglPropertiesC2Ei @ 11776 NONAME ABSENT
+ _ZN14QEglPropertiesC2Ev @ 11777 NONAME ABSENT
+ _ZNK11QEglContext12configAttribEiPi @ 11778 NONAME ABSENT
+ _ZNK11QEglContext16configPropertiesEi @ 11779 NONAME ABSENT
+ _ZNK11QEglContext7isValidEv @ 11780 NONAME ABSENT
+ _ZNK11QEglContext9isCurrentEv @ 11781 NONAME ABSENT
+ _ZNK14QEglProperties5valueEi @ 11782 NONAME ABSENT
+ _ZNK14QEglProperties8toStringEv @ 11783 NONAME ABSENT
+ _ZNK11QFontEngine10glyphCacheEPvN21QFontEngineGlyphCache4TypeERK10QTransform @ 11784 NONAME
+ _ZNK20QGraphicsItemPrivate21effectiveBoundingRectERK6QRectF @ 11785 NONAME
diff --git a/src/s60installs/eabi/QtOpenVGu.def b/src/s60installs/eabi/QtOpenVGu.def
index 8458983..7526632 100644
--- a/src/s60installs/eabi/QtOpenVGu.def
+++ b/src/s60installs/eabi/QtOpenVGu.def
@@ -1,8 +1,8 @@
EXPORTS
_Z16qPixmapToVGImageRK7QPixmap @ 1 NONAME
- _Z20qt_vg_create_contextP12QPaintDevice @ 2 NONAME
+ _Z20qt_vg_create_contextP12QPaintDevice @ 2 NONAME ABSENT
_Z20qt_vg_shared_surfacev @ 3 NONAME
- _Z21qt_vg_destroy_contextP11QEglContext @ 4 NONAME
+ _Z21qt_vg_destroy_contextP11QEglContext @ 4 NONAME ABSENT
_Z24qt_vg_image_to_vg_formatN6QImage6FormatE @ 5 NONAME
_Z25qt_vg_config_to_vg_formatP11QEglContext @ 6 NONAME
_Z25qt_vg_create_paint_enginev @ 7 NONAME
@@ -169,4 +169,8 @@ EXPORTS
_ZThn8_NK16QVGWindowSurface6metricEN12QPaintDevice17PaintDeviceMetricE @ 168 NONAME
_ZN14QVGPaintEngine10fillRegionERK7QRegionRK6QColorRK5QSize @ 169 NONAME
_ZN20QVGCompositionHelper10blitWindowEmRK5QSizeRK5QRectRK6QPointi @ 170 NONAME
+ _Z20qt_vg_create_contextP12QPaintDevicei @ 171 NONAME
+ _Z21qt_vg_destroy_contextP11QEglContexti @ 172 NONAME
+ _ZN13QVGPixmapData22destroyImageAndContextEv @ 173 NONAME
+ _ZN13QVGPixmapData9hibernateEv @ 174 NONAME
diff --git a/src/s60installs/qt.iby b/src/s60installs/qt.iby
index 41eb562..f24ac4b 100644
--- a/src/s60installs/qt.iby
+++ b/src/s60installs/qt.iby
@@ -90,27 +90,27 @@ file=ABI_DIR\BUILD_DIR\qts60plugin_5_0.dll SHARED_LIB_DIR\qts60plugin_5_0.dll
S60_APP_RESOURCE(s60main)
// imageformats stubs
-data=\epoc32\winscw\c\resource\qt\plugins\imageformats\qgif.qtplugin resource\qt\plugins\imageformats\qgif.qtplugin
-data=\epoc32\winscw\c\resource\qt\plugins\imageformats\qico.qtplugin resource\qt\plugins\imageformats\qico.qtplugin
-data=\epoc32\winscw\c\resource\qt\plugins\imageformats\qjpeg.qtplugin resource\qt\plugins\imageformats\qjpeg.qtplugin
-data=\epoc32\winscw\c\resource\qt\plugins\imageformats\qmng.qtplugin resource\qt\plugins\imageformats\qmng.qtplugin
-data=\epoc32\winscw\c\resource\qt\plugins\imageformats\qsvg.qtplugin resource\qt\plugins\imageformats\qsvg.qtplugin
-data=\epoc32\winscw\c\resource\qt\plugins\imageformats\qtiff.qtplugin resource\qt\plugins\imageformats\qtiff.qtplugin
+data=\epoc32\data\qt\qtlibspluginstubs\qgif.qtplugin resource\qt\plugins\imageformats\qgif.qtplugin
+data=\epoc32\data\qt\qtlibspluginstubs\qico.qtplugin resource\qt\plugins\imageformats\qico.qtplugin
+data=\epoc32\data\qt\qtlibspluginstubs\qjpeg.qtplugin resource\qt\plugins\imageformats\qjpeg.qtplugin
+data=\epoc32\data\qt\qtlibspluginstubs\qmng.qtplugin resource\qt\plugins\imageformats\qmng.qtplugin
+data=\epoc32\data\qt\qtlibspluginstubs\qsvg.qtplugin resource\qt\plugins\imageformats\qsvg.qtplugin
+data=\epoc32\data\qt\qtlibspluginstubs\qtiff.qtplugin resource\qt\plugins\imageformats\qtiff.qtplugin
// codecs stubs
-data=\epoc32\winscw\c\resource\qt\plugins\codecs\qcncodecs.qtplugin resource\qt\plugins\codecs\qcncodecs.qtplugin
-data=\epoc32\winscw\c\resource\qt\plugins\codecs\qjpcodecs.qtplugin resource\qt\plugins\codecs\qjpcodecs.qtplugin
-data=\epoc32\winscw\c\resource\qt\plugins\codecs\qkrcodecs.qtplugin resource\qt\plugins\codecs\qkrcodecs.qtplugin
-data=\epoc32\winscw\c\resource\qt\plugins\codecs\qtwcodecs.qtplugin resource\qt\plugins\codecs\qtwcodecs.qtplugin
+data=\epoc32\data\qt\qtlibspluginstubs\qcncodecs.qtplugin resource\qt\plugins\codecs\qcncodecs.qtplugin
+data=\epoc32\data\qt\qtlibspluginstubs\qjpcodecs.qtplugin resource\qt\plugins\codecs\qjpcodecs.qtplugin
+data=\epoc32\data\qt\qtlibspluginstubs\qkrcodecs.qtplugin resource\qt\plugins\codecs\qkrcodecs.qtplugin
+data=\epoc32\data\qt\qtlibspluginstubs\qtwcodecs.qtplugin resource\qt\plugins\codecs\qtwcodecs.qtplugin
// iconengines stubs
-data=\epoc32\winscw\c\resource\qt\plugins\iconengines\qsvgicon.qtplugin resource\qt\plugins\iconengines\qsvgicon.qtplugin
+data=\epoc32\data\qt\qtlibspluginstubs\qsvgicon.qtplugin resource\qt\plugins\iconengines\qsvgicon.qtplugin
// Phonon MMF backend
-data=\epoc32\winscw\c\resource\qt\plugins\phonon_backend\phonon_mmf.qtplugin resource\qt\plugins\phonon_backend\phonon_mmf.qtplugin
+data=\epoc32\data\qt\qtlibspluginstubs\phonon_mmf.qtplugin resource\qt\plugins\phonon_backend\phonon_mmf.qtplugin
// graphicssystems
-data=\epoc32\winscw\c\resource\qt\plugins\graphicssystems\qvggraphicssystem.qtplugin resource\qt\plugins\graphicssystems\qvggraphicssystem.qtplugin
+data=\epoc32\data\qt\qtlibspluginstubs\qvggraphicssystem.qtplugin resource\qt\plugins\graphicssystems\qvggraphicssystem.qtplugin
// Stub sis file
data=ZSYSTEM\install\qt.sis System\Install\qt.sis
diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro
index 37adfa9..e024396 100644
--- a/src/s60installs/s60installs.pro
+++ b/src/s60installs/s60installs.pro
@@ -105,10 +105,6 @@ symbian: {
qtlibraries.sources += QtDeclarative.dll
}
- contains(QT_CONFIG, webkit): {
- qtlibraries.sources += QtWebKit.dll
- }
-
graphicssystems_plugins.path = c:$$QT_PLUGINS_BASE_DIR/graphicssystems
contains(QT_CONFIG, openvg) {
qtlibraries.sources += QtOpenVG.dll
@@ -117,4 +113,9 @@ symbian: {
BLD_INF_RULES.prj_exports += "qt.iby $$CORE_MW_LAYER_IBY_EXPORT_PATH(qt.iby)"
BLD_INF_RULES.prj_exports += "qtdemoapps.iby $$CORE_APP_LAYER_IBY_EXPORT_PATH(qtdemoapps.iby)"
+ PLUGIN_STUBS = $$files(qmakepluginstubs/*)
+ for(STUB, PLUGIN_STUBS) {
+ STUB_FILENAME = $$basename(STUB)
+ BLD_INF_RULES.prj_exports += "qmakepluginstubs/$${STUB_FILENAME} /epoc32/data/qt/qtlibspluginstubs/$${STUB_FILENAME}"
+ }
}
diff --git a/src/s60main/qts60main.cpp b/src/s60main/qts60main.cpp
index 725b17c..de7d0be 100644
--- a/src/s60main/qts60main.cpp
+++ b/src/s60main/qts60main.cpp
@@ -6,35 +6,34 @@
**
** This file is part of the Symbian application wrapper 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 Technology Preview License Agreement accompanying
-** this package.
-**
-** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -54,7 +53,7 @@ GLDEF_C TInt E32Main()
{
CTrapCleanup *cleanupStack = q_check_ptr(CTrapCleanup::New());
TInt err = 0;
- TRAP(err, QtMainWrapper());
+ TRAP(err, err = QtMainWrapper());
delete cleanupStack;
return err;
diff --git a/src/s60main/qts60main_mcrt0.cpp b/src/s60main/qts60main_mcrt0.cpp
index edc2fb8..18c09e5 100644
--- a/src/s60main/qts60main_mcrt0.cpp
+++ b/src/s60main/qts60main_mcrt0.cpp
@@ -6,35 +6,34 @@
**
** This file is part of the Symbian application wrapper 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 Technology Preview License Agreement accompanying
-** this package.
-**
-** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/script/bridge/qscriptobject.cpp b/src/script/bridge/qscriptobject.cpp
index 2d71c43..6942eb6 100644
--- a/src/script/bridge/qscriptobject.cpp
+++ b/src/script/bridge/qscriptobject.cpp
@@ -61,6 +61,15 @@ bool QScriptObject::getOwnPropertySlot(JSC::ExecState* exec,
return d->delegate->getOwnPropertySlot(this, exec, propertyName, slot);
}
+bool QScriptObject::getOwnPropertyDescriptor(JSC::ExecState* exec,
+ const JSC::Identifier& propertyName,
+ JSC::PropertyDescriptor& descriptor)
+{
+ if (!d || !d->delegate)
+ return JSC::JSObject::getOwnPropertyDescriptor(exec, propertyName, descriptor);
+ return d->delegate->getOwnPropertyDescriptor(this, exec, propertyName, descriptor);
+}
+
void QScriptObject::put(JSC::ExecState* exec, const JSC::Identifier& propertyName,
JSC::JSValue value, JSC::PutPropertySlot& slot)
{
@@ -164,6 +173,14 @@ bool QScriptObjectDelegate::getOwnPropertySlot(QScriptObject* object, JSC::ExecS
return object->JSC::JSObject::getOwnPropertySlot(exec, propertyName, slot);
}
+bool QScriptObjectDelegate::getOwnPropertyDescriptor(QScriptObject* object, JSC::ExecState* exec,
+ const JSC::Identifier& propertyName,
+ JSC::PropertyDescriptor& descriptor)
+{
+ return object->JSC::JSObject::getOwnPropertyDescriptor(exec, propertyName, descriptor);
+}
+
+
void QScriptObjectDelegate::put(QScriptObject* object, JSC::ExecState* exec,
const JSC::Identifier& propertyName,
JSC::JSValue value, JSC::PutPropertySlot& slot)
diff --git a/src/script/bridge/qscriptobject_p.h b/src/script/bridge/qscriptobject_p.h
index a4faa06..f4b7140 100644
--- a/src/script/bridge/qscriptobject_p.h
+++ b/src/script/bridge/qscriptobject_p.h
@@ -63,6 +63,7 @@ public:
virtual bool getOwnPropertySlot(JSC::ExecState*,
const JSC::Identifier& propertyName,
JSC::PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);
virtual void put(JSC::ExecState* exec, const JSC::Identifier& propertyName,
JSC::JSValue, JSC::PutPropertySlot&);
virtual bool deleteProperty(JSC::ExecState*,
@@ -121,6 +122,9 @@ public:
virtual bool getOwnPropertySlot(QScriptObject*, JSC::ExecState*,
const JSC::Identifier& propertyName,
JSC::PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(QScriptObject*, JSC::ExecState*,
+ const JSC::Identifier& propertyName,
+ JSC::PropertyDescriptor&);
virtual void put(QScriptObject*, JSC::ExecState* exec, const JSC::Identifier& propertyName,
JSC::JSValue, JSC::PutPropertySlot&);
virtual bool deleteProperty(QScriptObject*, JSC::ExecState*,
diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp
index 63ba9ec..b51cb68 100644
--- a/src/script/bridge/qscriptqobject.cpp
+++ b/src/script/bridge/qscriptqobject.cpp
@@ -1173,6 +1173,7 @@ bool QObjectDelegate::getOwnPropertySlot(QScriptObject *object, JSC::ExecState *
const JSC::Identifier &propertyName,
JSC::PropertySlot &slot)
{
+ //Note: this has to be kept in sync with getOwnPropertyDescriptor
#ifndef QT_NO_PROPERTIES
QByteArray name = QString(propertyName.ustring()).toLatin1();
QObject *qobject = data->value;
@@ -1285,6 +1286,142 @@ bool QObjectDelegate::getOwnPropertySlot(QScriptObject *object, JSC::ExecState *
#endif //QT_NO_PROPERTIES
}
+
+bool QObjectDelegate::getOwnPropertyDescriptor(QScriptObject *object, JSC::ExecState *exec,
+ const JSC::Identifier &propertyName,
+ JSC::PropertyDescriptor &descriptor)
+{
+ //Note: this has to be kept in sync with getOwnPropertySlot abd getPropertyAttributes
+#ifndef QT_NO_PROPERTIES
+ QByteArray name = QString(propertyName.ustring()).toLatin1();
+ QObject *qobject = data->value;
+ if (!qobject) {
+ QString message = QString::fromLatin1("cannot access member `%0' of deleted QObject")
+ .arg(QString::fromLatin1(name));
+ descriptor.setValue(JSC::throwError(exec, JSC::GeneralError, message));
+ return true;
+ }
+
+ const QScriptEngine::QObjectWrapOptions &opt = data->options;
+
+ const QMetaObject *meta = qobject->metaObject();
+ {
+ QHash<QByteArray, JSC::JSValue>::const_iterator it = data->cachedMembers.constFind(name);
+ if (it != data->cachedMembers.constEnd()) {
+ int index;
+ if (GeneratePropertyFunctions && ((index = meta->indexOfProperty(name)) != -1)) {
+ QMetaProperty prop = meta->property(index);
+ descriptor.setAccessorDescriptor(it.value(), it.value(), flagsForMetaProperty(prop));
+ if (!prop.isWritable())
+ descriptor.setWritable(false);
+ } else {
+ unsigned attributes = QObjectMemberAttribute;
+ if (opt & QScriptEngine::SkipMethodsInEnumeration)
+ attributes |= JSC::DontEnum;
+ descriptor.setDescriptor(it.value(), attributes);
+ }
+ return true;
+ }
+ }
+
+ QScriptEnginePrivate *eng = scriptEngineFromExec(exec);
+ int index = -1;
+ if (name.contains('(')) {
+ QByteArray normalized = QMetaObject::normalizedSignature(name);
+ if (-1 != (index = meta->indexOfMethod(normalized))) {
+ QMetaMethod method = meta->method(index);
+ if (hasMethodAccess(method, index, opt)) {
+ if (!(opt & QScriptEngine::ExcludeSuperClassMethods)
+ || (index >= meta->methodOffset())) {
+ QtFunction *fun = new (exec)QtFunction(
+ object, index, /*maybeOverloaded=*/false,
+ &exec->globalData(), eng->originalGlobalObject()->functionStructure(),
+ propertyName);
+ data->cachedMembers.insert(name, fun);
+ unsigned attributes = QObjectMemberAttribute;
+ if (opt & QScriptEngine::SkipMethodsInEnumeration)
+ attributes |= JSC::DontEnum;
+ descriptor.setDescriptor(fun, attributes);
+ return true;
+ }
+ }
+ }
+ }
+
+ index = meta->indexOfProperty(name);
+ if (index != -1) {
+ QMetaProperty prop = meta->property(index);
+ if (prop.isScriptable()) {
+ if (!(opt & QScriptEngine::ExcludeSuperClassProperties)
+ || (index >= meta->propertyOffset())) {
+ unsigned attributes = flagsForMetaProperty(prop);
+ if (GeneratePropertyFunctions) {
+ QtPropertyFunction *fun = new (exec)QtPropertyFunction(
+ meta, index, &exec->globalData(),
+ eng->originalGlobalObject()->functionStructure(),
+ propertyName);
+ data->cachedMembers.insert(name, fun);
+ descriptor.setAccessorDescriptor(fun, fun, attributes);
+ if (attributes & JSC::ReadOnly)
+ descriptor.setWritable(false);
+ } else {
+ JSC::JSValue val;
+ if (!prop.isValid())
+ val = JSC::jsUndefined();
+ else
+ val = eng->jscValueFromVariant(prop.read(qobject));
+ descriptor.setDescriptor(val, attributes);
+ }
+ return true;
+ }
+ }
+ }
+
+ index = qobject->dynamicPropertyNames().indexOf(name);
+ if (index != -1) {
+ JSC::JSValue val = eng->jscValueFromVariant(qobject->property(name));
+ descriptor.setDescriptor(val, QObjectMemberAttribute);
+ return true;
+ }
+
+ const int offset = (opt & QScriptEngine::ExcludeSuperClassMethods)
+ ? meta->methodOffset() : 0;
+ for (index = meta->methodCount() - 1; index >= offset; --index) {
+ QMetaMethod method = meta->method(index);
+ if (hasMethodAccess(method, index, opt)
+ && (methodName(method) == name)) {
+ QtFunction *fun = new (exec)QtFunction(
+ object, index, /*maybeOverloaded=*/true,
+ &exec->globalData(), eng->originalGlobalObject()->functionStructure(),
+ propertyName);
+ unsigned attributes = QObjectMemberAttribute;
+ if (opt & QScriptEngine::SkipMethodsInEnumeration)
+ attributes |= JSC::DontEnum;
+ descriptor.setDescriptor(fun, attributes);
+ data->cachedMembers.insert(name, fun);
+ return true;
+ }
+ }
+
+ if (!(opt & QScriptEngine::ExcludeChildObjects)) {
+ QList<QObject*> children = qobject->children();
+ for (index = 0; index < children.count(); ++index) {
+ QObject *child = children.at(index);
+ if (child->objectName() == QString(propertyName.ustring())) {
+ QScriptEngine::QObjectWrapOptions opt = QScriptEngine::PreferExistingWrapperObject;
+ QScriptValue tmp = QScriptEnginePrivate::get(eng)->newQObject(child, QScriptEngine::QtOwnership, opt);
+ descriptor.setDescriptor(eng->scriptValueToJSCValue(tmp), JSC::ReadOnly | JSC::DontDelete | JSC::DontEnum);
+ return true;
+ }
+ }
+ }
+
+ return QScriptObjectDelegate::getOwnPropertyDescriptor(object, exec, propertyName, descriptor);
+#else //QT_NO_PROPERTIES
+ return false;
+#endif //QT_NO_PROPERTIES
+}
+
void QObjectDelegate::put(QScriptObject *object, JSC::ExecState* exec,
const JSC::Identifier& propertyName,
JSC::JSValue value, JSC::PutPropertySlot &slot)
@@ -1437,7 +1574,7 @@ bool QObjectDelegate::getPropertyAttributes(const QScriptObject *object,
unsigned &attributes) const
{
#ifndef QT_NO_PROPERTIES
- // ### try to avoid duplicating logic from getOwnPropertySlot()
+ //Note: this has to be kept in sync with getOwnPropertyDescriptor and getOwnPropertySlot
QByteArray name = ((QString)propertyName.ustring()).toLatin1();
QObject *qobject = data->value;
if (!qobject)
@@ -1688,6 +1825,7 @@ QObjectPrototype::QObjectPrototype(JSC::ExecState* exec, WTF::PassRefPtr<JSC::St
putDirectFunction(exec, new (exec) JSC::PrototypeFunction(exec, prototypeFunctionStructure, /*length=*/0, exec->propertyNames().toString, qobjectProtoFuncToString), JSC::DontEnum);
putDirectFunction(exec, new (exec) JSC::PrototypeFunction(exec, prototypeFunctionStructure, /*length=*/1, JSC::Identifier(exec, "findChild"), qobjectProtoFuncFindChild), JSC::DontEnum);
putDirectFunction(exec, new (exec) JSC::PrototypeFunction(exec, prototypeFunctionStructure, /*length=*/1, JSC::Identifier(exec, "findChildren"), qobjectProtoFuncFindChildren), JSC::DontEnum);
+ this->structure()->setHasGetterSetterProperties(true);
}
const JSC::ClassInfo QMetaObjectWrapperObject::info = { "QMetaObject", 0, 0, 0 };
diff --git a/src/script/bridge/qscriptqobject_p.h b/src/script/bridge/qscriptqobject_p.h
index 41900b5..0e7748d 100644
--- a/src/script/bridge/qscriptqobject_p.h
+++ b/src/script/bridge/qscriptqobject_p.h
@@ -78,6 +78,10 @@ public:
virtual bool getOwnPropertySlot(QScriptObject*, JSC::ExecState*,
const JSC::Identifier& propertyName,
JSC::PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(QScriptObject*, JSC::ExecState*,
+ const JSC::Identifier& propertyName,
+ JSC::PropertyDescriptor&);
+
virtual void put(QScriptObject*, JSC::ExecState* exec,
const JSC::Identifier& propertyName,
JSC::JSValue, JSC::PutPropertySlot&);
diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp
index f130087..a384ba0 100644
--- a/src/sql/drivers/oci/qsql_oci.cpp
+++ b/src/sql/drivers/oci/qsql_oci.cpp
@@ -517,7 +517,7 @@ QVariant::Type qDecodeOCIType(const QString& ocitype, QSql::NumericalPrecisionPo
}
else if (ocitype == QLatin1String("LONG") || ocitype == QLatin1String("NCLOB")
|| ocitype == QLatin1String("CLOB"))
- type = QVariant::ByteArray;
+ type = QVariant::String;
else if (ocitype == QLatin1String("RAW") || ocitype == QLatin1String("LONG RAW")
|| ocitype == QLatin1String("ROWID") || ocitype == QLatin1String("BLOB")
|| ocitype == QLatin1String("CFILE") || ocitype == QLatin1String("BFILE"))
@@ -543,6 +543,7 @@ QVariant::Type qDecodeOCIType(int ocitype, QSql::NumericalPrecisionPolicy precis
case SQLT_AVC:
case SQLT_RDD:
case SQLT_LNG:
+ case SQLT_CLOB:
#ifdef SQLT_INTERVAL_YM
case SQLT_INTERVAL_YM:
#endif
@@ -584,7 +585,6 @@ QVariant::Type qDecodeOCIType(int ocitype, QSql::NumericalPrecisionPolicy precis
case SQLT_NTY:
case SQLT_REF:
case SQLT_RID:
- case SQLT_CLOB:
type = QVariant::ByteArray;
break;
case SQLT_DAT:
diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp
index e686873..55f0696 100644
--- a/src/sql/drivers/odbc/qsql_odbc.cpp
+++ b/src/sql/drivers/odbc/qsql_odbc.cpp
@@ -172,28 +172,39 @@ static QString qWarnODBCHandle(int handleType, SQLHANDLE handle, int *nativeCode
SQLSMALLINT msgLen = 0;
SQLRETURN r = SQL_NO_DATA;
SQLTCHAR state_[SQL_SQLSTATE_SIZE+1];
- SQLTCHAR description_[SQL_MAX_MESSAGE_LENGTH];
+ QVarLengthArray<SQLTCHAR> description_(SQL_MAX_MESSAGE_LENGTH);
QString result;
int i = 1;
description_[0] = 0;
+ r = SQLGetDiagRec(handleType,
+ handle,
+ i,
+ state_,
+ &nativeCode_,
+ 0,
+ NULL,
+ &msgLen);
+ if(r == SQL_NO_DATA)
+ return QString();
+ description_.resize(msgLen+1);
do {
r = SQLGetDiagRec(handleType,
handle,
i,
- (SQLTCHAR*)state_,
+ state_,
&nativeCode_,
- (SQLTCHAR*)description_,
- SQL_MAX_MESSAGE_LENGTH, /* in bytes, not in characters */
+ description_.data(),
+ description_.size(),
&msgLen);
if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) {
if (nativeCode)
*nativeCode = nativeCode_;
QString tmpstore;
#ifdef UNICODE
- tmpstore = QString((const QChar*)description_, msgLen);
+ tmpstore = QString((const QChar*)description_.data(), msgLen);
#else
- tmpstore = QString::fromLocal8Bit((const char*)description_, msgLen);
+ tmpstore = QString::fromLocal8Bit((const char*)description_.data(), msgLen);
#endif
if(result != tmpstore) {
if(!result.isEmpty())
@@ -877,12 +888,17 @@ bool QODBCResult::reset (const QString& query)
(SQLCHAR*) query8.constData(),
(SQLINTEGER) query8.length());
#endif
- if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) {
+ if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO && r!= SQL_NO_DATA) {
setLastError(qMakeError(QCoreApplication::translate("QODBCResult",
"Unable to execute statement"), QSqlError::StatementError, d));
return false;
}
+ if(r == SQL_NO_DATA) {
+ setSelect(false);
+ return true;
+ }
+
SQLINTEGER isScrollable, bufferLength;
r = SQLGetStmtAttr(d->hStmt, SQL_ATTR_CURSOR_SCROLLABLE, &isScrollable, SQL_IS_INTEGER, &bufferLength);
if(r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO)
diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp
index 3ed918e..21c947b 100644
--- a/src/svg/qsvghandler.cpp
+++ b/src/svg/qsvghandler.cpp
@@ -1147,12 +1147,12 @@ static QMatrix parseTransformationMatrix(const QStringRef &value)
if (points.count() != 1)
goto error;
const qreal deg2rad = qreal(0.017453292519943295769);
- matrix.shear(tan(points[0]*deg2rad), 0);
+ matrix.shear(qTan(points[0]*deg2rad), 0);
} else if (state == SkewY) {
if (points.count() != 1)
goto error;
const qreal deg2rad = qreal(0.017453292519943295769);
- matrix.shear(0, tan(points[0]*deg2rad));
+ matrix.shear(0, qTan(points[0]*deg2rad));
}
}
error:
@@ -1481,8 +1481,8 @@ static void pathArc(QPainterPath &path,
yc = 0.5 * (y0 + y1) + sfactor * (x1 - x0);
/* (xc, yc) is center of the circle. */
- th0 = atan2(y0 - yc, x0 - xc);
- th1 = atan2(y1 - yc, x1 - xc);
+ th0 = qAtan2(y0 - yc, x0 - xc);
+ th1 = qAtan2(y1 - yc, x1 - xc);
th_arc = th1 - th0;
if (th_arc < 0 && sweep_flag)
@@ -1578,8 +1578,8 @@ static bool parsePathDataFast(const QStringRef &dataStr, QPainterPath &path)
count--;
break;
}
- x = x0 = num[0] + offsetX;
- y = y0 = num[1] + offsetY;
+ x = num[0] + offsetX;
+ y = num[1] + offsetY;
num += 2;
count -= 2;
path.lineTo(x, y);
@@ -1592,8 +1592,8 @@ static bool parsePathDataFast(const QStringRef &dataStr, QPainterPath &path)
count--;
break;
}
- x = x0 = num[0];
- y = y0 = num[1];
+ x = num[0];
+ y = num[1];
num += 2;
count -= 2;
path.lineTo(x, y);
@@ -2864,14 +2864,8 @@ static QSvgNode *createPolygonNode(QSvgNode *parent,
const QChar *s = pointsStr.constData();
QVector<qreal> points = parseNumbersList(s);
QPolygonF poly(points.count()/2);
- int i = 0;
- QVector<qreal>::const_iterator itr = points.constBegin();
- while (itr != points.constEnd()) {
- qreal one = *itr; ++itr;
- qreal two = *itr; ++itr;
- poly[i] = QPointF(one, two);
- ++i;
- }
+ for (int i = 0; i < poly.size(); ++i)
+ poly[i] = QPointF(points.at(2 * i), points.at(2 * i + 1));
QSvgNode *polygon = new QSvgPolygon(parent, poly);
return polygon;
}
@@ -2886,14 +2880,8 @@ static QSvgNode *createPolylineNode(QSvgNode *parent,
const QChar *s = pointsStr.constData();
QVector<qreal> points = parseNumbersList(s);
QPolygonF poly(points.count()/2);
- int i = 0;
- QVector<qreal>::const_iterator itr = points.constBegin();
- while (itr != points.constEnd()) {
- qreal one = *itr; ++itr;
- qreal two = *itr; ++itr;
- poly[i] = QPointF(one, two);
- ++i;
- }
+ for (int i = 0; i < poly.size(); ++i)
+ poly[i] = QPointF(points.at(2 * i), points.at(2 * i + 1));
QSvgNode *line = new QSvgPolyline(parent, poly);
return line;
diff --git a/src/svg/qsvgstyle.cpp b/src/svg/qsvgstyle.cpp
index 57927fd..c67f7d2 100644
--- a/src/svg/qsvgstyle.cpp
+++ b/src/svg/qsvgstyle.cpp
@@ -771,7 +771,7 @@ void QSvgAnimateTransform::resolveMatrix(QSvgNode *node)
qreal transXDiff = (to1-from1) * percentOfAnimation;
qreal transX = from1 + transXDiff;
m_transform = QTransform();
- m_transform.shear(tan(transX * deg2rad), 0);
+ m_transform.shear(qTan(transX * deg2rad), 0);
break;
}
case SkewY: {
@@ -786,7 +786,7 @@ void QSvgAnimateTransform::resolveMatrix(QSvgNode *node)
qreal transYDiff = (to1 - from1) * percentOfAnimation;
qreal transY = from1 + transYDiff;
m_transform = QTransform();
- m_transform.shear(0, tan(transY * deg2rad));
+ m_transform.shear(0, qTan(transY * deg2rad));
break;
}
default:
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index 8fcc0df..1a75cf6 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -725,16 +725,6 @@ void Generator::generateMetacall()
needEditable |= p.editable.endsWith(')');
needUser |= p.user.endsWith(')');
}
- bool needAnything = needGet
- | needSet
- | needReset
- | needDesignable
- | needScriptable
- | needStored
- | needEditable
- | needUser;
- if (!needAnything)
- goto skip_properties;
fprintf(out, "\n#ifndef QT_NO_PROPERTIES\n ");
if (needElse)
@@ -904,7 +894,6 @@ void Generator::generateMetacall()
fprintf(out, "\n#endif // QT_NO_PROPERTIES");
}
- skip_properties:
if (methodList.size() || cdef->signalList.size() || cdef->propertyList.size())
fprintf(out, "\n ");
fprintf(out,"return _id;\n}\n");
diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp
index 88dfa98..3bc56ae 100644
--- a/src/tools/uic/cpp/cppwriteinitialization.cpp
+++ b/src/tools/uic/cpp/cppwriteinitialization.cpp
@@ -1221,9 +1221,10 @@ void WriteInitialization::writeProperties(const QString &varName,
const DomRect *r = p->elementRect();
m_output << m_indent << varName << "->resize(" << r->elementWidth() << ", " << r->elementHeight() << ");\n";
continue;
- } else if (propertyName == QLatin1String("buttonGroupId") && buttonGroupWidget) { // Q3ButtonGroup support
- m_output << m_indent << m_driver->findOrInsertWidget(buttonGroupWidget) << "->insert("
- << varName << ", " << p->elementNumber() << ");\n";
+ } else if (propertyName == QLatin1String("buttonGroupId")) { // Q3ButtonGroup support
+ if (buttonGroupWidget)
+ m_output << m_indent << m_driver->findOrInsertWidget(buttonGroupWidget) << "->insert("
+ << varName << ", " << p->elementNumber() << ");\n";
continue;
} else if (propertyName == QLatin1String("currentRow") // QListWidget::currentRow
&& m_uic->customWidgetsInfo()->extends(className, QLatin1String("QListWidget"))) {
diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp
index 0a87412..27ec3bd 100644
--- a/src/xml/sax/qxml.cpp
+++ b/src/xml/sax/qxml.cpp
@@ -3063,11 +3063,11 @@ void QXmlSimpleReaderPrivate::initIncrementalParsing()
Aspects of the parsing behavior can be adapted using setFeature()
and setProperty().
+ \snippet doc/src/snippets/code/src_xml_sax_qxml.cpp 0
+
QXmlSimpleReader is not reentrant. If you want to use the class
in threaded code, lock the code using QXmlSimpleReader with a
locking mechanism, such as a QMutex.
-
- \snippet doc/src/snippets/code/src_xml_sax_qxml.cpp 0
*/
static inline bool is_S(QChar ch)
diff --git a/src/xmlpatterns/api/api.pri b/src/xmlpatterns/api/api.pri
index 9fcc2f5..a0adf75 100644
--- a/src/xmlpatterns/api/api.pri
+++ b/src/xmlpatterns/api/api.pri
@@ -1,59 +1,57 @@
-HEADERS += $$PWD/qabstractxmlforwarditerator_p.h \
- $$PWD/qabstractmessagehandler.h \
- $$PWD/qabstracturiresolver.h \
- $$PWD/qabstractxmlnodemodel.h \
- $$PWD/qabstractxmlnodemodel_p.h \
- $$PWD/qabstractxmlpullprovider_p.h \
- $$PWD/qabstractxmlreceiver.h \
- $$PWD/qabstractxmlreceiver_p.h \
- $$PWD/qdeviceresourceloader_p.h \
- $$PWD/qiodevicedelegate_p.h \
- $$PWD/qnetworkaccessdelegator_p.h \
- $$PWD/qpullbridge_p.h \
- $$PWD/qresourcedelegator_p.h \
- $$PWD/qsimplexmlnodemodel.h \
- $$PWD/qsourcelocation.h \
- $$PWD/quriloader_p.h \
- $$PWD/qvariableloader_p.h \
- $$PWD/qxmlformatter.h \
- $$PWD/qxmlname.h \
- $$PWD/qxmlnamepool.h \
- $$PWD/qxmlquery.h \
- $$PWD/qxmlquery_p.h \
- $$PWD/qxmlresultitems.h \
- $$PWD/qxmlresultitems_p.h \
- $$PWD/qxmlschema.h \
- $$PWD/qxmlschema_p.h \
- $$PWD/qxmlschemavalidator.h \
- $$PWD/qxmlschemavalidator_p.h \
- $$PWD/qxmlserializer.h \
- $$PWD/qxmlserializer_p.h \
- $$PWD/../../../tools/xmlpatterns/qcoloringmessagehandler_p.h \
- $$PWD/../../../tools/xmlpatterns/qcoloroutput_p.h
-
-SOURCES += $$PWD/qvariableloader.cpp \
- $$PWD/qabstractmessagehandler.cpp \
- $$PWD/qabstracturiresolver.cpp \
- $$PWD/qabstractxmlnodemodel.cpp \
- $$PWD/qabstractxmlpullprovider.cpp \
- $$PWD/qabstractxmlreceiver.cpp \
- $$PWD/qiodevicedelegate.cpp \
- $$PWD/qnetworkaccessdelegator.cpp \
- $$PWD/qpullbridge.cpp \
- $$PWD/qresourcedelegator.cpp \
- $$PWD/qsimplexmlnodemodel.cpp \
- $$PWD/qsourcelocation.cpp \
- $$PWD/quriloader.cpp \
- $$PWD/qxmlformatter.cpp \
- $$PWD/qxmlname.cpp \
- $$PWD/qxmlnamepool.cpp \
- $$PWD/qxmlquery.cpp \
- $$PWD/qxmlresultitems.cpp \
- $$PWD/qxmlschema.cpp \
- $$PWD/qxmlschema_p.cpp \
- $$PWD/qxmlschemavalidator.cpp \
- $$PWD/qxmlserializer.cpp \
- $$PWD/../../../tools/xmlpatterns/qcoloringmessagehandler.cpp \
- $$PWD/../../../tools/xmlpatterns/qcoloroutput.cpp
-
-INCLUDEPATH += $$PWD/../../../tools/xmlpatterns/
+HEADERS += $$PWD/qabstractxmlforwarditerator_p.h \
+ $$PWD/qabstractmessagehandler.h \
+ $$PWD/qabstracturiresolver.h \
+ $$PWD/qabstractxmlnodemodel.h \
+ $$PWD/qabstractxmlnodemodel_p.h \
+ $$PWD/qabstractxmlpullprovider_p.h \
+ $$PWD/qabstractxmlreceiver.h \
+ $$PWD/qabstractxmlreceiver_p.h \
+ $$PWD/qdeviceresourceloader_p.h \
+ $$PWD/qiodevicedelegate_p.h \
+ $$PWD/qnetworkaccessdelegator_p.h \
+ $$PWD/qpullbridge_p.h \
+ $$PWD/qresourcedelegator_p.h \
+ $$PWD/qsimplexmlnodemodel.h \
+ $$PWD/qsourcelocation.h \
+ $$PWD/quriloader_p.h \
+ $$PWD/qvariableloader_p.h \
+ $$PWD/qxmlformatter.h \
+ $$PWD/qxmlname.h \
+ $$PWD/qxmlnamepool.h \
+ $$PWD/qxmlquery.h \
+ $$PWD/qxmlquery_p.h \
+ $$PWD/qxmlresultitems.h \
+ $$PWD/qxmlresultitems_p.h \
+ $$PWD/qxmlschema.h \
+ $$PWD/qxmlschema_p.h \
+ $$PWD/qxmlschemavalidator.h \
+ $$PWD/qxmlschemavalidator_p.h \
+ $$PWD/qxmlserializer.h \
+ $$PWD/qxmlserializer_p.h \
+ $$PWD/qcoloringmessagehandler_p.h \
+ $$PWD/qcoloroutput_p.h \
+ $$PWD/qxmlpatternistcli_p.h
+SOURCES += $$PWD/qvariableloader.cpp \
+ $$PWD/qabstractmessagehandler.cpp \
+ $$PWD/qabstracturiresolver.cpp \
+ $$PWD/qabstractxmlnodemodel.cpp \
+ $$PWD/qabstractxmlpullprovider.cpp \
+ $$PWD/qabstractxmlreceiver.cpp \
+ $$PWD/qiodevicedelegate.cpp \
+ $$PWD/qnetworkaccessdelegator.cpp \
+ $$PWD/qpullbridge.cpp \
+ $$PWD/qresourcedelegator.cpp \
+ $$PWD/qsimplexmlnodemodel.cpp \
+ $$PWD/qsourcelocation.cpp \
+ $$PWD/quriloader.cpp \
+ $$PWD/qxmlformatter.cpp \
+ $$PWD/qxmlname.cpp \
+ $$PWD/qxmlnamepool.cpp \
+ $$PWD/qxmlquery.cpp \
+ $$PWD/qxmlresultitems.cpp \
+ $$PWD/qxmlschema.cpp \
+ $$PWD/qxmlschema_p.cpp \
+ $$PWD/qxmlschemavalidator.cpp \
+ $$PWD/qxmlserializer.cpp \
+ $$PWD/qcoloringmessagehandler.cpp \
+ $$PWD/qcoloroutput.cpp
diff --git a/tools/xmlpatterns/qcoloringmessagehandler.cpp b/src/xmlpatterns/api/qcoloringmessagehandler.cpp
index a639ddd..7d3eb6f 100644
--- a/tools/xmlpatterns/qcoloringmessagehandler.cpp
+++ b/src/xmlpatterns/api/qcoloringmessagehandler.cpp
@@ -41,9 +41,8 @@
#include <QXmlStreamReader>
-#include "main.h"
-
#include "qcoloringmessagehandler_p.h"
+#include "qxmlpatternistcli_p.h"
QT_BEGIN_NAMESPACE
diff --git a/tools/xmlpatterns/qcoloringmessagehandler_p.h b/src/xmlpatterns/api/qcoloringmessagehandler_p.h
index 3e8d18b..3e8d18b 100644
--- a/tools/xmlpatterns/qcoloringmessagehandler_p.h
+++ b/src/xmlpatterns/api/qcoloringmessagehandler_p.h
diff --git a/tools/xmlpatterns/qcoloroutput.cpp b/src/xmlpatterns/api/qcoloroutput.cpp
index 4f27fd5..abfa656 100644
--- a/tools/xmlpatterns/qcoloroutput.cpp
+++ b/src/xmlpatterns/api/qcoloroutput.cpp
@@ -153,51 +153,56 @@ const char *const ColorOutputPrivate::backgrounds[] =
};
/*!
- \since 4.4
- \nonreentrant
- \brief Outputs colored messages to \c stderr.
- \internal
-
- ColorOutput is a convenience class for outputting messages to \c stderr
- using color escape codes, as mandated in ECMA-48. ColorOutput will only
- color output when it is detected to be suitable. For instance, if \c stderr is
- detected to be attached to a file instead of a TTY, no coloring will be done.
-
- ColorOutput does its best attempt. but it is generally undefined what coloring
- or effect the various coloring flags has. It depends strongly on what terminal
- software that is being used.
-
- When using `echo -e 'my escape sequence'`, \033 works as an initiator but not
- when printing from a C++ program, despite having escaped the backslash.
- That's why we below use characters with value 0x1B.
-
- It can be convenient to subclass ColorOutput with a private scope, such that the
- functions are directly available in the class using it.
-
- \section1 Usage
-
- To output messages, call write() or writeUncolored(). write() takes as second
- argument an integer, which ColorOutput uses as a lookup key to find the color
- it should color the text in. The mapping from keys to colors is done using
- insertMapping(). Typically this is used by having enums for the various kinds
- of messages, which subsequently are registered.
-
- \code
- enum MyMessage
- {
+ \class ColorOutput
+ \since 4.4
+ \nonreentrant
+ \brief Outputs colored messages to \c stderr.
+ \internal
+
+ ColorOutput is a convenience class for outputting messages to \c
+ stderr using color escape codes, as mandated in ECMA-48. ColorOutput
+ will only color output when it is detected to be suitable. For
+ instance, if \c stderr is detected to be attached to a file instead
+ of a TTY, no coloring will be done.
+
+ ColorOutput does its best attempt. but it is generally undefined
+ what coloring or effect the various coloring flags has. It depends
+ strongly on what terminal software that is being used.
+
+ When using `echo -e 'my escape sequence'`, \c{\033} works as an
+ initiator but not when printing from a C++ program, despite having
+ escaped the backslash. That's why we below use characters with
+ value 0x1B.
+
+ It can be convenient to subclass ColorOutput with a private scope,
+ such that the functions are directly available in the class using
+ it.
+
+ \section1 Usage
+
+ To output messages, call write() or writeUncolored(). write() takes
+ as second argument an integer, which ColorOutput uses as a lookup
+ key to find the color it should color the text in. The mapping from
+ keys to colors is done using insertMapping(). Typically this is used
+ by having enums for the various kinds of messages, which
+ subsequently are registered.
+
+ \code
+ enum MyMessage
+ {
Error,
Important
- };
+ };
- ColorOutput output;
- output.insertMapping(Error, ColorOutput::RedForeground);
- output.insertMapping(Import, ColorOutput::BlueForeground);
+ ColorOutput output;
+ output.insertMapping(Error, ColorOutput::RedForeground);
+ output.insertMapping(Import, ColorOutput::BlueForeground);
- output.write("This is important", Important);
- output.write("Jack, I'm only the selected official!", Error);
- \endcode
+ output.write("This is important", Important);
+ output.write("Jack, I'm only the selected official!", Error);
+ \endcode
- \sa {http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html} {Bash Prompt HOWTO, 6.1. Colours}
+ \sa {http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html} {Bash Prompt HOWTO, 6.1. Colours}
{http://linuxgazette.net/issue51/livingston-blade.html} {Linux Gazette, Tweaking Eterm, Edward Livingston-Blade}
{http://www.ecma-international.org/publications/standards/Ecma-048.htm} {Standard ECMA-48, Control Functions for Coded Character Sets, ECMA International},
{http://en.wikipedia.org/wiki/ANSI_escape_code} {Wikipedia, ANSI escape code}
@@ -205,10 +210,34 @@ const char *const ColorOutputPrivate::backgrounds[] =
*/
/*!
- \enum ColorOutput::ColorCode
-
- \value DefaultColor ColorOutput performs no coloring. This typically means black on white
- or white on black, depending on the settings of the user's terminal.
+ \enum ColorOutput::ColorCodeComponent
+ \value BlackForeground
+ \value BlueForeground
+ \value GreenForeground
+ \value CyanForeground
+ \value RedForeground
+ \value PurpleForeground
+ \value BrownForeground
+ \value LightGrayForeground
+ \value DarkGrayForeground
+ \value LightBlueForeground
+ \value LightGreenForeground
+ \value LightCyanForeground
+ \value LightRedForeground
+ \value LightPurpleForeground
+ \value YellowForeground
+ \value WhiteForeground
+ \value BlackBackground
+ \value BlueBackground
+ \value GreenBackground
+ \value CyanBackground
+ \value RedBackground
+ \value PurpleBackground
+ \value BrownBackground
+
+ \value DefaultColor ColorOutput performs no coloring. This typically
+ means black on white or white on black, depending
+ on the settings of the user's terminal.
*/
/*!
diff --git a/tools/xmlpatterns/qcoloroutput_p.h b/src/xmlpatterns/api/qcoloroutput_p.h
index 1917ec7..1917ec7 100644
--- a/tools/xmlpatterns/qcoloroutput_p.h
+++ b/src/xmlpatterns/api/qcoloroutput_p.h
diff --git a/src/xmlpatterns/api/qxmlpatternistcli_p.h b/src/xmlpatterns/api/qxmlpatternistcli_p.h
new file mode 100644
index 0000000..072e4aa
--- /dev/null
+++ b/src/xmlpatterns/api/qxmlpatternistcli_p.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the XMLPatterns 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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@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.
+
+#ifndef Patternist_Cli_h
+#define Patternist_Cli_h
+
+#include <QCoreApplication>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+class QXmlPatternistCLI
+{
+public:
+ Q_DECLARE_TR_FUNCTIONS(QXmlPatternistCLI)
+private:
+ inline QXmlPatternistCLI();
+ Q_DISABLE_COPY(QXmlPatternistCLI)
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/xmlpatterns/xmlpatterns.pro b/src/xmlpatterns/xmlpatterns.pro
index 1df497d..a224762 100644
--- a/src/xmlpatterns/xmlpatterns.pro
+++ b/src/xmlpatterns/xmlpatterns.pro
@@ -1,15 +1,14 @@
-TARGET = QtXmlPatterns
-QPRO_PWD = $$PWD
-QT = core network
-DEFINES += QT_BUILD_XMLPATTERNS_LIB QT_NO_USING_NAMESPACE
+TARGET = QtXmlPatterns
+QPRO_PWD = $$PWD
+QT = core \
+ network
+DEFINES += QT_BUILD_XMLPATTERNS_LIB \
+ QT_NO_USING_NAMESPACE
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x61000000
-
-unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtNetwork
-
+unix:QMAKE_PKGCONFIG_REQUIRES = QtCore \
+ QtNetwork
include(../qbase.pri)
-
PRECOMPILED_HEADER = ../corelib/global/qt_pch.h
-
include($$PWD/common.pri)
include($$PWD/acceltree/acceltree.pri)
include($$PWD/api/api.pri)
@@ -25,14 +24,13 @@ include($$PWD/schema/schema.pri)
include($$PWD/type/type.pri)
include($$PWD/utils/utils.pri)
include($$PWD/qobjectmodel/qobjectmodel.pri, "", true)
+wince*:# The Microsoft MIPS compiler crashes if /Og is specified
+:
-wince*: {
- # The Microsoft MIPS compiler crashes if /Og is specified
- # -O2/1 expands to /Og plus additional arguments.
- contains(DEFINES, MIPS): {
- QMAKE_CXXFLAGS_RELEASE ~= s/-O2/-Oi -Ot -Oy -Ob2/
- QMAKE_CXXFLAGS_RELEASE ~= s/-O1/-Os -Oy -Ob2/
- }
+# -O2/1 expands to /Og plus additional arguments.
+contains(DEFINES, MIPS): {
+ QMAKE_CXXFLAGS_RELEASE ~= s/-O2/-Oi -Ot -Oy -Ob2/
+ QMAKE_CXXFLAGS_RELEASE ~= s/-O1/-Os -Oy -Ob2/
}
-
-symbian:TARGET.UID3=0x2001E62B
+symbian:TARGET.UID3 = 0x2001E62B
+HEADERS +=
diff --git a/tests/arthur/data/qps/aliasing.qps b/tests/arthur/data/qps/aliasing.qps
new file mode 100644
index 0000000..59878f9
--- /dev/null
+++ b/tests/arthur/data/qps/aliasing.qps
@@ -0,0 +1,156 @@
+
+path_moveTo convexPath 25 0
+path_lineTo convexPath 50 50
+path_lineTo convexPath 25 25
+path_lineTo convexPath 0 50
+path_closeSubpath convexPath
+
+pixmap_load border.png pixmap
+
+setRenderHint LineAntialiasing false
+translate 10 10
+
+begin_block drawing
+ setPen black 1
+ setBrush 7f7fff
+ drawPath convexPath
+
+ setFont "monospace" 8
+ setPen black
+ drawText 0 68 "QwErTy@"
+
+
+ setPen black 1
+ setBrush 7f7fff
+ drawRect 0 80 10 5
+
+ setPen black 1
+ setBrush noBrush
+ drawRect 20 80 10 5
+
+ setPen noPen
+ setBrush 7f7fff
+ drawRect 40 80 10 5
+
+
+ setPen black 2
+ setBrush 7f7fff
+ drawRect 0 90 10 5
+
+ setPen black 2
+ setBrush noBrush
+ drawRect 20 90 10 5
+
+ setPen noPen
+ setBrush 7f7fff
+ drawRect 40 90 10 5
+
+
+ setPen black 3
+ setBrush 7f7fff
+ drawRect 0 100 10 5
+
+ setPen black 3
+ setBrush noBrush
+ drawRect 20 100 10 5
+
+ setPen noPen
+ setBrush 7f7fff
+ drawRect 40 100 10 5
+
+
+ setPen black 1
+ setBrush noBrush
+ drawLine 10 110 20 120
+ drawLine 30 120 40 110
+
+ setPen black 2
+ setBrush noBrush
+ drawLine 10 120 20 130
+ drawLine 30 130 40 120
+
+ setPen black 3
+ setBrush noBrush
+ drawLine 10 130 20 140
+ drawLine 30 140 40 130
+
+ drawPixmap pixmap 0 150
+
+ setRenderHint SmoothPixmapTransform false
+ drawPixmap pixmap 20 150 15 15 0 0 10 10
+
+end_block
+
+translate 0 180
+setRenderHint LineAntialiasing true
+repeat_block drawing
+drawText 15 185 "0.0"
+
+resetMatrix
+translate 70.2 10.2
+setRenderHint LineAntialiasing false
+repeat_block drawing
+translate 0 180
+setRenderHint LineAntialiasing true
+repeat_block drawing
+translate -0.2 -0.2
+drawText 15 185 "0.2"
+
+
+resetMatrix
+translate 130.4 10.4
+setRenderHint LineAntialiasing false
+repeat_block drawing
+translate 0 180
+setRenderHint LineAntialiasing true
+repeat_block drawing
+translate -0.4 -0.4
+drawText 15 185 "0.4"
+
+
+resetMatrix
+translate 190.5 10.5
+setRenderHint LineAntialiasing false
+repeat_block drawing
+translate 0 180
+setRenderHint LineAntialiasing true
+repeat_block drawing
+translate -0.5 -0.5
+drawText 15 185 "0.5"
+
+
+resetMatrix
+translate 250.6 10.6
+setRenderHint LineAntialiasing false
+repeat_block drawing
+translate 0 180
+setRenderHint LineAntialiasing true
+repeat_block drawing
+translate -0.6 -0.6
+drawText 15 185 "0.6"
+
+
+resetMatrix
+translate 310.8 10.8
+setRenderHint LineAntialiasing false
+repeat_block drawing
+translate 0 180
+setRenderHint LineAntialiasing true
+repeat_block drawing
+translate -0.8 -0.8
+drawText 15 185 "0.8"
+
+
+resetMatrix
+translate 371 11
+setRenderHint LineAntialiasing false
+repeat_block drawing
+translate 0 180
+setRenderHint LineAntialiasing true
+repeat_block drawing
+drawText 15 185 "1.0"
+
+
+resetMatrix
+drawText 430 95 "Aliased"
+drawText 430 275 "Anti-Aliased" \ No newline at end of file
diff --git a/tests/arthur/data/qps/aliasing_qps.png b/tests/arthur/data/qps/aliasing_qps.png
new file mode 100644
index 0000000..183129b
--- /dev/null
+++ b/tests/arthur/data/qps/aliasing_qps.png
Binary files differ
diff --git a/tests/auto/headers/tst_headers.cpp b/tests/auto/headers/tst_headers.cpp
index 36d25fe..329143d 100644
--- a/tests/auto/headers/tst_headers.cpp
+++ b/tests/auto/headers/tst_headers.cpp
@@ -217,8 +217,8 @@ void tst_Headers::licenseCheck()
QCOMPARE(content.at(i++), QString("/****************************************************************************"));
if (licenseType != "3RDPARTY") {
QCOMPARE(content.at(i++), QString("**"));
- if (sourceFile.endsWith("/tests/auto/qabstractitemmodel/dynamictreemodel.cpp")
- || sourceFile.endsWith("/tests/auto/qabstractitemmodel/dynamictreemodel.h")
+ if (sourceFile.endsWith("/tests/auto/modeltest/dynamictreemodel.cpp")
+ || sourceFile.endsWith("/tests/auto/modeltest/dynamictreemodel.h")
|| sourceFile.endsWith("/src/network/kernel/qnetworkproxy_p.h"))
{
// These files are not copyrighted by Nokia.
diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp
index 2316ba2..1ca2b3a 100644
--- a/tests/auto/moc/tst_moc.cpp
+++ b/tests/auto/moc/tst_moc.cpp
@@ -489,6 +489,7 @@ private slots:
void constructors();
void typenameWithUnsigned();
void warnOnVirtualSignal();
+ void QTBUG5590_dummyProperty();
signals:
void sigWithUnsignedArg(unsigned foo);
void sigWithSignedArg(signed foo);
@@ -1216,6 +1217,40 @@ void tst_Moc::warnOnVirtualSignal()
#endif
}
+
+class QTBUG5590_DummyObject: public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(bool dummy)
+};
+
+class QTBUG5590_PropertyObject: public QTBUG5590_DummyObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int value READ value WRITE setValue)
+ Q_PROPERTY(int value2 READ value2 WRITE setValue2)
+
+ public:
+ QTBUG5590_PropertyObject() : m_value(85), m_value2(40) { }
+ int value() const { return m_value; }
+ void setValue(int value) { m_value = value; }
+ int value2() const { return m_value2; }
+ void setValue2(int value) { m_value2 = value; }
+ private:
+ int m_value, m_value2;
+};
+
+void tst_Moc::QTBUG5590_dummyProperty()
+{
+ QTBUG5590_PropertyObject o;
+ QCOMPARE(o.property("value").toInt(), 85);
+ QCOMPARE(o.property("value2").toInt(), 40);
+ o.setProperty("value", 32);
+ QCOMPARE(o.value(), 32);
+ o.setProperty("value2", 82);
+ QCOMPARE(o.value2(), 82);
+}
+
QTEST_APPLESS_MAIN(tst_Moc)
#include "tst_moc.moc"
diff --git a/tests/auto/qabstractitemmodel/dynamictreemodel.cpp b/tests/auto/modeltest/dynamictreemodel.cpp
index 24d3ab3..24d3ab3 100644
--- a/tests/auto/qabstractitemmodel/dynamictreemodel.cpp
+++ b/tests/auto/modeltest/dynamictreemodel.cpp
diff --git a/tests/auto/qabstractitemmodel/dynamictreemodel.h b/tests/auto/modeltest/dynamictreemodel.h
index 3f0d90d..3f0d90d 100644
--- a/tests/auto/qabstractitemmodel/dynamictreemodel.h
+++ b/tests/auto/modeltest/dynamictreemodel.h
diff --git a/tests/auto/modeltest/modeltest.cpp b/tests/auto/modeltest/modeltest.cpp
index 39d00f6..0ca9e14 100644
--- a/tests/auto/modeltest/modeltest.cpp
+++ b/tests/auto/modeltest/modeltest.cpp
@@ -475,8 +475,8 @@ void ModelTest::data()
void ModelTest::rowsAboutToBeInserted ( const QModelIndex &parent, int start, int end )
{
// Q_UNUSED(end);
- qDebug() << "rowsAboutToBeInserted" << "start=" << start << "end=" << end << "parent=" << model->data ( parent ).toString()
- << "current count of parent=" << model->rowCount ( parent ); // << "display of last=" << model->data( model->index(start-1, 0, parent) );
+// qDebug() << "rowsAboutToBeInserted" << "start=" << start << "end=" << end << "parent=" << model->data ( parent ).toString()
+// << "current count of parent=" << model->rowCount ( parent ); // << "display of last=" << model->data( model->index(start-1, 0, parent) );
// qDebug() << model->index(start-1, 0, parent) << model->data( model->index(start-1, 0, parent) );
Changing c;
c.parent = parent;
@@ -495,14 +495,14 @@ void ModelTest::rowsInserted ( const QModelIndex & parent, int start, int end )
{
Changing c = insert.pop();
Q_ASSERT ( c.parent == parent );
- qDebug() << "rowsInserted" << "start=" << start << "end=" << end << "oldsize=" << c.oldSize
- << "parent=" << model->data ( parent ).toString() << "current rowcount of parent=" << model->rowCount ( parent );
-
- for (int ii=start; ii <= end; ii++)
- {
- qDebug() << "itemWasInserted:" << ii << model->data ( model->index ( ii, 0, parent ));
- }
- qDebug();
+// qDebug() << "rowsInserted" << "start=" << start << "end=" << end << "oldsize=" << c.oldSize
+// << "parent=" << model->data ( parent ).toString() << "current rowcount of parent=" << model->rowCount ( parent );
+
+// for (int ii=start; ii <= end; ii++)
+// {
+// qDebug() << "itemWasInserted:" << ii << model->data ( model->index ( ii, 0, parent ));
+// }
+// qDebug();
Q_ASSERT ( c.oldSize + ( end - start + 1 ) == model->rowCount ( parent ) );
Q_ASSERT ( c.last == model->data ( model->index ( start - 1, 0, c.parent ) ) );
diff --git a/tests/auto/modeltest/modeltest.pro b/tests/auto/modeltest/modeltest.pro
index 6655d85..f157da0 100644
--- a/tests/auto/modeltest/modeltest.pro
+++ b/tests/auto/modeltest/modeltest.pro
@@ -1,6 +1,6 @@
load(qttest_p4)
-SOURCES += tst_modeltest.cpp modeltest.cpp
-HEADERS += modeltest.h
+SOURCES += tst_modeltest.cpp modeltest.cpp dynamictreemodel.cpp
+HEADERS += modeltest.h dynamictreemodel.h
diff --git a/tests/auto/modeltest/tst_modeltest.cpp b/tests/auto/modeltest/tst_modeltest.cpp
index a719168..262b966 100644
--- a/tests/auto/modeltest/tst_modeltest.cpp
+++ b/tests/auto/modeltest/tst_modeltest.cpp
@@ -44,6 +44,7 @@
#include <QtGui/QtGui>
#include "modeltest.h"
+#include "dynamictreemodel.h"
class tst_ModelTest : public QObject
@@ -64,6 +65,8 @@ private slots:
void stringListModel();
void treeWidgetModel();
void standardItemModel();
+ void testInsertThroughProxy();
+ void moveSourceItems();
};
@@ -92,15 +95,15 @@ void tst_ModelTest::stringListModel()
{
QStringListModel model;
QSortFilterProxyModel proxy;
-
+
ModelTest t1(&model);
ModelTest t2(&proxy);
-
+
proxy.setSourceModel(&model);
-
+
model.setStringList(QStringList() << "2" << "3" << "1");
model.setStringList(QStringList() << "a" << "e" << "plop" << "b" << "c" );
-
+
proxy.setDynamicSortFilter(true);
proxy.setFilterRegExp(QRegExp("[^b]"));
}
@@ -110,7 +113,7 @@ void tst_ModelTest::treeWidgetModel()
QTreeWidget widget;
ModelTest t1(widget.model());
-
+
QTreeWidgetItem *root = new QTreeWidgetItem(&widget, QStringList("root"));
for (int i = 0; i < 20; ++i) {
new QTreeWidgetItem(root, QStringList(QString::number(i)));
@@ -120,7 +123,7 @@ void tst_ModelTest::treeWidgetModel()
QTreeWidgetItem *parent = new QTreeWidgetItem(&widget, QStringList("parent"));
new QTreeWidgetItem(parent, QStringList("child"));
widget.setItemHidden(parent, true);
-
+
widget.sortByColumn(0);
}
@@ -128,23 +131,153 @@ void tst_ModelTest::standardItemModel()
{
QStandardItemModel model(10,10);
QSortFilterProxyModel proxy;
-
-
+
+
ModelTest t1(&model);
ModelTest t2(&proxy);
-
+
proxy.setSourceModel(&model);
-
+
model.insertRows(2, 5);
model.removeRows(4, 5);
model.insertColumns(2, 5);
model.removeColumns(4, 5);
-
+
model.insertRows(0,5, model.index(1,1));
model.insertColumns(0,5, model.index(1,3));
-
}
+void tst_ModelTest::testInsertThroughProxy()
+{
+ DynamicTreeModel *model = new DynamicTreeModel(this);
+
+ QSortFilterProxyModel *proxy = new QSortFilterProxyModel(this);
+ proxy->setSourceModel(model);
+
+ new ModelTest(proxy, this);
+
+ ModelInsertCommand *insertCommand = new ModelInsertCommand(model, this);
+ insertCommand->setNumCols(4);
+ insertCommand->setStartRow(0);
+ insertCommand->setEndRow(9);
+ // Parent is QModelIndex()
+ insertCommand->doCommand();
+
+ insertCommand = new ModelInsertCommand(model, this);
+ insertCommand->setNumCols(4);
+ insertCommand->setAncestorRowNumbers(QList<int>() << 5);
+ insertCommand->setStartRow(0);
+ insertCommand->setEndRow(9);
+ insertCommand->doCommand();
+
+ ModelMoveCommand *moveCommand = new ModelMoveCommand(model, this);
+ moveCommand->setNumCols(4);
+ moveCommand->setStartRow(0);
+ moveCommand->setEndRow(0);
+ moveCommand->setDestRow(9);
+ moveCommand->setDestAncestors(QList<int>() << 5);
+ moveCommand->doCommand();
+}
+
+/**
+ Makes the persistent index list publicly accessible
+*/
+class AccessibleProxyModel : public QSortFilterProxyModel
+{
+ Q_OBJECT
+public:
+ AccessibleProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent) {}
+
+ QModelIndexList persistent()
+ {
+ return persistentIndexList();
+ }
+};
+
+class ObservingObject : public QObject
+{
+ Q_OBJECT
+public:
+ ObservingObject(AccessibleProxyModel *proxy, QObject *parent = 0)
+ : QObject(parent),
+ m_proxy(proxy)
+ {
+ connect(m_proxy, SIGNAL(layoutAboutToBeChanged()), SLOT(storePersistent()));
+ connect(m_proxy, SIGNAL(layoutChanged()), SLOT(checkPersistent()));
+ }
+
+public slots:
+
+ void storePersistent(const QModelIndex &parent)
+ {
+ for (int row = 0; row < m_proxy->rowCount(parent); ++row) {
+ QModelIndex proxyIndex = m_proxy->index(row, 0, parent);
+ QModelIndex sourceIndex = m_proxy->mapToSource(proxyIndex);
+ Q_ASSERT(proxyIndex.isValid());
+ Q_ASSERT(sourceIndex.isValid());
+ m_persistentSourceIndexes.append(sourceIndex);
+ m_persistentProxyIndexes.append(proxyIndex);
+ if (m_proxy->hasChildren(proxyIndex))
+ storePersistent(proxyIndex);
+ }
+ }
+
+ void storePersistent()
+ {
+ m_persistentSourceIndexes.clear();
+ m_persistentProxyIndexes.clear();
+ Q_ASSERT(m_proxy->persistent().isEmpty());
+ storePersistent(QModelIndex());
+ Q_ASSERT(!m_proxy->persistent().isEmpty());
+ }
+
+ void checkPersistent()
+ {
+ for (int row = 0; row < m_persistentProxyIndexes.size(); ++row) {
+ QModelIndex updatedProxy = m_persistentProxyIndexes.at(row);
+ QModelIndex updatedSource = m_persistentSourceIndexes.at(row);
+ }
+ for (int row = 0; row < m_persistentProxyIndexes.size(); ++row) {
+ QModelIndex updatedProxy = m_persistentProxyIndexes.at(row);
+ QModelIndex updatedSource = m_persistentSourceIndexes.at(row);
+ QCOMPARE(m_proxy->mapToSource(updatedProxy), updatedSource);
+ }
+ }
+
+private:
+ AccessibleProxyModel *m_proxy;
+ QList<QPersistentModelIndex> m_persistentSourceIndexes;
+ QList<QPersistentModelIndex> m_persistentProxyIndexes;
+};
+
+void tst_ModelTest::moveSourceItems()
+{
+ DynamicTreeModel *model = new DynamicTreeModel(this);
+ AccessibleProxyModel *proxy = new AccessibleProxyModel(this);
+ proxy->setSourceModel(model);
+
+ ModelInsertCommand *insertCommand = new ModelInsertCommand(model, this);
+ insertCommand->setStartRow(0);
+ insertCommand->setEndRow(2);
+ insertCommand->doCommand();
+
+ insertCommand = new ModelInsertCommand(model, this);
+ insertCommand->setAncestorRowNumbers(QList<int>() << 1);
+ insertCommand->setStartRow(0);
+ insertCommand->setEndRow(2);
+ insertCommand->doCommand();
+
+ ObservingObject observer(proxy);
+
+ ModelMoveCommand *moveCommand = new ModelMoveCommand(model, this);
+ moveCommand->setStartRow(0);
+ moveCommand->setEndRow(0);
+ moveCommand->setDestAncestors(QList<int>() << 1);
+ moveCommand->setDestRow(0);
+ moveCommand->doCommand();
+}
+
+
QTEST_MAIN(tst_ModelTest)
#include "tst_modeltest.moc"
diff --git a/tests/auto/qabstractitemmodel/qabstractitemmodel.pro b/tests/auto/qabstractitemmodel/qabstractitemmodel.pro
index a31868b..52c4e96 100644
--- a/tests/auto/qabstractitemmodel/qabstractitemmodel.pro
+++ b/tests/auto/qabstractitemmodel/qabstractitemmodel.pro
@@ -1,6 +1,9 @@
load(qttest_p4)
-SOURCES += tst_qabstractitemmodel.cpp dynamictreemodel.cpp
-HEADERS += dynamictreemodel.h
+
+INCLUDEPATH += $$PWD/../modeltest
+
+SOURCES += tst_qabstractitemmodel.cpp ../modeltest/dynamictreemodel.cpp ../modeltest/modeltest.cpp
+HEADERS += ../modeltest/dynamictreemodel.h ../modeltest/modeltest.h
diff --git a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp
index 6479829..bf3af63 100644
--- a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp
+++ b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp
@@ -48,6 +48,7 @@
#include <qlistview.h>
#include <qlistwidget.h>
#include <qtableview.h>
+#include <qtablewidget.h>
#include <qtreeview.h>
#include <qtreewidget.h>
#include <qheaderview.h>
@@ -226,6 +227,7 @@ private slots:
void shiftSelectionAfterRubberbandSelection();
void ctrlRubberbandSelection();
void QTBUG6407_extendedSelection();
+ void QTBUG6753_selectOnSelection();
};
class MyAbstractItemDelegate : public QAbstractItemDelegate
@@ -1475,5 +1477,26 @@ void tst_QAbstractItemView::QTBUG6407_extendedSelection()
}
+void tst_QAbstractItemView::QTBUG6753_selectOnSelection()
+{
+ QTableWidget table(5, 5);
+ for (int i = 0; i < table.rowCount(); ++i)
+ for (int j = 0; j < table.columnCount(); ++j)
+ table.setItem(i, j, new QTableWidgetItem("choo-be-doo-wah"));
+
+ table.show();
+ table.setSelectionMode(QAbstractItemView::ExtendedSelection);
+ table.selectAll();
+ QTest::qWaitForWindowShown(&table);
+ QModelIndex item = table.model()->index(1,1);
+ QRect itemRect = table.visualRect(item);
+ QTest::mouseMove(table.viewport(), itemRect.center());
+ QTest::mouseClick(table.viewport(), Qt::LeftButton, Qt::NoModifier, itemRect.center());
+ QTest::qWait(20);
+
+ QCOMPARE(table.selectedItems().count(), 1);
+ QCOMPARE(table.selectedItems().first(), table.item(item.row(), item.column()));
+}
+
QTEST_MAIN(tst_QAbstractItemView)
#include "tst_qabstractitemview.moc"
diff --git a/tests/auto/qboxlayout/tst_qboxlayout.cpp b/tests/auto/qboxlayout/tst_qboxlayout.cpp
index 8887288..48235e8 100644
--- a/tests/auto/qboxlayout/tst_qboxlayout.cpp
+++ b/tests/auto/qboxlayout/tst_qboxlayout.cpp
@@ -66,6 +66,8 @@ private slots:
void sizeConstraints();
void setGeometry();
void setStyleShouldChangeSpacing();
+
+ void taskQTBUG_7103_minMaxWidthNotRespected();
};
class CustomLayoutStyle : public QWindowsStyle
@@ -246,6 +248,31 @@ void tst_QBoxLayout::setStyleShouldChangeSpacing()
delete style2;
}
+void tst_QBoxLayout::taskQTBUG_7103_minMaxWidthNotRespected()
+{
+ QLabel *label = new QLabel("Qt uses standard C++, but makes extensive use of the C pre-processor to enrich the language. Qt can also be used in several other programming languages via language bindings. It runs on all major platforms, and has extensive internationalization support. Non-GUI features include SQL database access, XML parsing, thread management, network support and a unified cross-platform API for file handling.");
+ label->setWordWrap(true);
+ label->setFixedWidth(200);
+
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget(label);
+ layout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::Expanding));
+
+ QWidget widget;
+ widget.setLayout(layout);
+ widget.show();
+ QTest::qWaitForWindowShown(&widget);
+
+ int height = label->height();
+
+ QRect g = widget.geometry();
+ g.setWidth(600);
+ widget.setGeometry(g);
+
+ QTest::qWait(50);
+
+ QCOMPARE(label->height(), height);
+}
QTEST_MAIN(tst_QBoxLayout)
#include "tst_qboxlayout.moc"
diff --git a/tests/auto/qdbuspendingreply/tst_qdbuspendingreply.cpp b/tests/auto/qdbuspendingreply/tst_qdbuspendingreply.cpp
index 6398d9c..82e6389 100644
--- a/tests/auto/qdbuspendingreply/tst_qdbuspendingreply.cpp
+++ b/tests/auto/qdbuspendingreply/tst_qdbuspendingreply.cpp
@@ -93,6 +93,7 @@ private slots:
}
void init();
+ void unconnected();
void simpleTypes();
void complexTypes();
void wrongTypes();
@@ -252,6 +253,30 @@ void tst_QDBusPendingReply::init()
QVERIFY(iface->isValid());
}
+void tst_QDBusPendingReply::unconnected()
+{
+ QDBusConnection con("invalid stored connection");
+ QVERIFY(!con.isConnected());
+ QDBusInterface iface("doesnt.matter", "/", "doesnt.matter", con);
+ QVERIFY(!iface.isValid());
+
+ QDBusPendingReply<> rvoid = iface.asyncCall("ReloadConfig");
+ QVERIFY(rvoid.isFinished());
+ QVERIFY(!rvoid.isValid());
+ QVERIFY(rvoid.isError());
+ rvoid.waitForFinished();
+ QVERIFY(!rvoid.isValid());
+ QVERIFY(rvoid.isError());
+
+ QDBusPendingReply<QString> rstring = iface.asyncCall("GetId");
+ QVERIFY(rstring.isFinished());
+ QVERIFY(!rstring.isValid());
+ QVERIFY(rstring.isError());
+ rstring.waitForFinished();
+ QVERIFY(!rstring.isValid());
+ QVERIFY(rstring.isError());
+}
+
void tst_QDBusPendingReply::simpleTypes()
{
QDBusPendingReply<> rvoid = iface->asyncCall("retrieveVoid");
diff --git a/tests/auto/qdbusreply/tst_qdbusreply.cpp b/tests/auto/qdbusreply/tst_qdbusreply.cpp
index 9866302..e36d288 100644
--- a/tests/auto/qdbusreply/tst_qdbusreply.cpp
+++ b/tests/auto/qdbusreply/tst_qdbusreply.cpp
@@ -93,6 +93,7 @@ private slots:
}
void init();
+ void unconnected();
void simpleTypes();
void complexTypes();
void wrongTypes();
@@ -236,6 +237,21 @@ void tst_QDBusReply::init()
QVERIFY(iface->isValid());
}
+void tst_QDBusReply::unconnected()
+{
+ QDBusConnection con("invalid stored connection");
+ QVERIFY(!con.isConnected());
+ QDBusInterface iface("doesnt.matter", "/", "doesnt.matter", con);
+ QVERIFY(!iface.isValid());
+
+ QDBusReply<void> rvoid = iface.asyncCall("ReloadConfig");
+ QVERIFY(!rvoid.isValid());
+
+ QDBusReply<QString> rstring = iface.asyncCall("GetId");
+ QVERIFY(!rstring.isValid());
+ QVERIFY(rstring.value().isEmpty());
+}
+
void tst_QDBusReply::simpleTypes()
{
QDBusReply<bool> rbool = iface->call(QDBus::BlockWithGui, "retrieveBool");
diff --git a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp
index 7f03153..a3f0915 100644
--- a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp
+++ b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp
@@ -148,6 +148,7 @@ private slots:
void task255471_decimalsValidation();
void taskQTBUG_5008_textFromValueAndValidate();
+ void taskQTBUG_6670_selectAllWithPrefix();
public slots:
void valueChangedHelper(const QString &);
@@ -1084,5 +1085,16 @@ void tst_QDoubleSpinBox::taskQTBUG_5008_textFromValueAndValidate()
QCOMPARE(spinbox.text(), spinbox.locale().toString(spinbox.value()));
}
+void tst_QDoubleSpinBox::taskQTBUG_6670_selectAllWithPrefix()
+{
+ DoubleSpinBox spin;
+ spin.setPrefix("$ ");
+ spin.lineEdit()->selectAll();
+ QTest::keyClick(spin.lineEdit(), Qt::Key_1);
+ QCOMPARE(spin.value(), 1.);
+ QTest::keyClick(spin.lineEdit(), Qt::Key_2);
+ QCOMPARE(spin.value(), 12.);
+}
+
QTEST_MAIN(tst_QDoubleSpinBox)
#include "tst_qdoublespinbox.moc"
diff --git a/tests/auto/qfile/tst_qfile.cpp b/tests/auto/qfile/tst_qfile.cpp
index 7ee5665..e88c222 100644
--- a/tests/auto/qfile/tst_qfile.cpp
+++ b/tests/auto/qfile/tst_qfile.cpp
@@ -129,6 +129,8 @@ private slots:
void readLine();
void readLine2();
void readLineNullInLine();
+ void readAll_data();
+ void readAll();
void readAllStdin();
void readLineStdin();
void readLineStdin_lineByLine();
@@ -220,6 +222,9 @@ public:
private:
enum FileType { OpenQFile, OpenFd, OpenStream };
+ void openStandardStreamsFileDescriptors();
+ void openStandardStreamsBufferedStreams();
+
bool openFd(QFile &file, QIODevice::OpenMode mode)
{
int fdMode = QT_OPEN_LARGEFILE | QT_OPEN_BINARY;
@@ -554,6 +559,10 @@ void tst_QFile::size()
QFETCH( QString, filename );
QFETCH( qint64, size );
+#ifdef Q_WS_WINCE
+ filename = QFileInfo(filename).absoluteFilePath();
+#endif
+
{
QFile f( filename );
QCOMPARE( f.size(), size );
@@ -564,24 +573,29 @@ void tst_QFile::size()
{
QFile f;
- int fd = QT_OPEN(filename.toLocal8Bit().constData(), QT_OPEN_RDONLY);
- QVERIFY( fd != -1 );
- QVERIFY( f.open(fd, QIODevice::ReadOnly) );
+ FILE* stream = QT_FOPEN(filename.toLocal8Bit().constData(), "rb");
+ QVERIFY( stream );
+ QVERIFY( f.open(stream, QIODevice::ReadOnly) );
QCOMPARE( f.size(), size );
f.close();
- QT_CLOSE(fd);
+ fclose(stream);
}
{
+#ifdef Q_WS_WINCE
+ QSKIP("Currently low level file I/O not well supported on Windows CE", SkipSingle);
+#endif
QFile f;
- FILE* stream = QT_FOPEN(filename.toLocal8Bit().constData(), "rb");
- QVERIFY( stream );
- QVERIFY( f.open(stream, QIODevice::ReadOnly) );
+
+ int fd = QT_OPEN(filename.toLocal8Bit().constData(), QT_OPEN_RDONLY);
+
+ QVERIFY( fd != -1 );
+ QVERIFY( f.open(fd, QIODevice::ReadOnly) );
QCOMPARE( f.size(), size );
f.close();
- fclose(stream);
+ QT_CLOSE(fd);
}
}
@@ -603,6 +617,7 @@ void tst_QFile::seek()
QVERIFY(file.seek(10));
QCOMPARE(file.pos(), qint64(10));
QCOMPARE(file.size(), qint64(0));
+ file.close();
QFile::remove("newfile.txt");
}
@@ -739,6 +754,45 @@ void tst_QFile::readLineNullInLine()
QCOMPARE(file.readLine(), QByteArray());
}
+void tst_QFile::readAll_data()
+{
+ QTest::addColumn<bool>("textMode");
+ QTest::addColumn<QString>("fileName");
+ QTest::newRow( "TextMode unixfile" ) << true << SRCDIR "testfile.txt";
+ QTest::newRow( "BinaryMode unixfile" ) << false << SRCDIR "testfile.txt";
+ QTest::newRow( "TextMode dosfile" ) << true << SRCDIR "dosfile.txt";
+ QTest::newRow( "BinaryMode dosfile" ) << false << SRCDIR "dosfile.txt";
+ QTest::newRow( "TextMode bigfile" ) << true << SRCDIR "tst_qfile.cpp";
+ QTest::newRow( "BinaryMode bigfile" ) << false << SRCDIR "tst_qfile.cpp";
+ QVERIFY(QFile(SRCDIR "tst_qfile.cpp").size() > 64*1024);
+}
+
+void tst_QFile::readAll()
+{
+ QFETCH( bool, textMode );
+ QFETCH( QString, fileName );
+
+ QFile file(fileName);
+ if (textMode)
+ QVERIFY(file.open(QFile::Text | QFile::ReadOnly));
+ else
+ QVERIFY(file.open(QFile::ReadOnly));
+
+ QByteArray a = file.readAll();
+ file.reset();
+ QVERIFY(file.pos() == 0);
+
+ QVERIFY(file.bytesAvailable() > 7);
+ QByteArray b = file.read(1);
+ char x;
+ file.getChar(&x);
+ b.append(x);
+ b.append(file.read(5));
+ b.append(file.readAll());
+
+ QCOMPARE(a, b);
+}
+
void tst_QFile::readAllStdin()
{
#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
@@ -1128,9 +1182,15 @@ void tst_QFile::copyFallback()
QVERIFY(QFile::exists("file-copy-destination.txt"));
QVERIFY(!file.isOpen());
+#ifdef Q_WS_WINCE
// Need to reset permissions on Windows to be able to delete
QVERIFY(QFile::setPermissions("file-copy-destination.txt",
- QFile::ReadOwner | QFile::WriteOwner));
+ QFile::WriteOther));
+#else
+ // Need to reset permissions on Windows to be able to delete
+ QVERIFY(QFile::setPermissions("file-copy-destination.txt",
+ QFile::ReadOwner | QFile::WriteOwner));
+#endif
QVERIFY(QFile::remove("file-copy-destination.txt"));
// Fallback copy of open file.
@@ -1139,6 +1199,7 @@ void tst_QFile::copyFallback()
QVERIFY(QFile::exists("file-copy-destination.txt"));
QVERIFY(!file.isOpen());
+ file.close();
QFile::remove("file-copy-destination.txt");
}
@@ -2239,6 +2300,7 @@ void tst_QFile::rename()
QFile file(source);
QCOMPARE(file.rename(destination), result);
+
if (result)
QCOMPARE(file.error(), QFile::NoError);
else
@@ -2367,6 +2429,7 @@ void tst_QFile::appendAndRead()
QCOMPARE(readFile.read(1 << j).size(), 1 << j);
}
+ readFile.close();
QFile::remove(QLatin1String("appendfile.txt"));
}
@@ -2608,10 +2671,15 @@ void tst_QFile::map()
QFETCH(QFile::FileError, error);
QString fileName = QDir::currentPath() + '/' + "qfile_map_testfile";
+
+#ifdef Q_WS_WINCE
+ fileName = QFileInfo(fileName).absoluteFilePath();
+#endif
+
if (QFile::exists(fileName)) {
QVERIFY(QFile::setPermissions(fileName,
QFile::WriteOwner | QFile::ReadOwner | QFile::WriteUser | QFile::ReadUser));
- QFile::remove(fileName);
+ QFile::remove(fileName);
}
QFile file(fileName);
@@ -2650,8 +2718,13 @@ void tst_QFile::map()
QCOMPARE(file.error(), QFile::NoError);
// hpux wont let you map multiple times.
-#if !defined(Q_OS_HPUX) && !defined(Q_USE_DEPRECATED_MAP_API)
+#if !defined(Q_OS_HPUX) && !defined(Q_USE_DEPRECATED_MAP_API) && !defined(Q_OS_WINCE)
// exotic test to make sure that multiple maps work
+
+ // note: windows ce does not reference count mutliple maps
+ // it's essentially just the same reference but it
+ // cause a resource lock on the file which prevents it
+ // from being removed uchar *memory1 = file.map(0, file.size());
uchar *memory1 = file.map(0, file.size());
QCOMPARE(file.error(), QFile::NoError);
uchar *memory2 = file.map(0, file.size());
@@ -2687,7 +2760,6 @@ void tst_QFile::map()
QVERIFY(!memory);
QVERIFY(file.setPermissions(originalPermissions));
}
-
QVERIFY(file.remove());
}
@@ -2800,8 +2872,14 @@ void tst_QFile::openDirectory()
f1.close();
}
-void tst_QFile::openStandardStreams()
+void tst_QFile::openStandardStreamsFileDescriptors()
{
+#ifdef Q_WS_WINCE
+ //allthough Windows CE (not mobile!) has functions that allow redirecting
+ //the standard file descriptors to a file (see SetStdioPathW/GetStdioPathW)
+ //it does not have functions to simply open them like below .
+ QSKIP("Opening standard streams on Windows CE via descriptor not implemented", SkipAll);
+#endif
// Using file descriptors
{
QFile in;
@@ -2826,7 +2904,13 @@ void tst_QFile::openStandardStreams()
QCOMPARE( err.size(), (qint64)0 );
QVERIFY( err.isSequential() );
}
+}
+void tst_QFile::openStandardStreamsBufferedStreams()
+{
+#if defined (Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+ QSKIP("Unix only test.", SkipAll);
+#endif
// Using streams
{
QFile in;
@@ -2853,6 +2937,12 @@ void tst_QFile::openStandardStreams()
}
}
+void tst_QFile::openStandardStreams()
+{
+ openStandardStreamsFileDescriptors();
+ openStandardStreamsBufferedStreams();
+}
+
void tst_QFile::writeNothing()
{
for (int i = 0; i < 3; ++i) {
diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp
index 2f9410b..220e1d1 100644
--- a/tests/auto/qfiledialog/tst_qfiledialog.cpp
+++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp
@@ -949,6 +949,7 @@ void tst_QFiledialog::selectFiles()
QLineEdit *lineEdit = qFindChild<QLineEdit*>(dialog, "fileNameEdit");
QVERIFY(lineEdit);
QCOMPARE(lineEdit->text(),QLatin1String("blah"));
+ delete dialog;
}
void tst_QFiledialog::viewMode()
diff --git a/tests/auto/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/qfiledialog2/tst_qfiledialog2.cpp
index 83ddd39..c3f88c4 100644
--- a/tests/auto/qfiledialog2/tst_qfiledialog2.cpp
+++ b/tests/auto/qfiledialog2/tst_qfiledialog2.cpp
@@ -130,6 +130,8 @@ private slots:
void task259105_filtersCornerCases();
void QTBUG4419_lineEditSelectAll();
+ void QTBUG6558_showDirsOnly();
+ void QTBUG4842_selectFilterWithHideNameFilterDetails();
private:
QByteArray userSettings;
@@ -1040,5 +1042,111 @@ void tst_QFiledialog::QTBUG4419_lineEditSelectAll()
QCOMPARE(tempPath + QChar('/') + lineEdit->selectedText(), t->fileName());
}
+void tst_QFiledialog::QTBUG6558_showDirsOnly()
+{
+ const QString tempPath = QDir::tempPath();
+ QDir dirTemp(tempPath);
+ const QString tempName = QLatin1String("showDirsOnly.") + QString::number(qrand());
+ dirTemp.mkdir(tempName);
+ dirTemp.cd(tempName);
+ QTRY_VERIFY(dirTemp.exists());
+
+ const QString dirPath = dirTemp.absolutePath();
+ QDir dir(dirPath);
+
+ //We create two dirs
+ dir.mkdir("a");
+ dir.mkdir("b");
+
+ //Create a file
+ QFile tempFile(dirPath + "/plop.txt");
+ tempFile.open(QIODevice::WriteOnly | QIODevice::Text);
+ QTextStream out(&tempFile);
+ out << "The magic number is: " << 49 << "\n";
+ tempFile.close();
+
+ QNonNativeFileDialog fd(0, "TestFileDialog");
+
+ fd.setDirectory(dir.absolutePath());
+ fd.setViewMode(QFileDialog::List);
+ fd.setAcceptMode(QFileDialog::AcceptSave);
+ fd.setOption(QFileDialog::ShowDirsOnly, true);
+ fd.show();
+
+ QApplication::setActiveWindow(&fd);
+ QTest::qWaitForWindowShown(&fd);
+ QTRY_COMPARE(fd.isVisible(), true);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd));
+
+ QFileSystemModel *model = qFindChild<QFileSystemModel*>(&fd, "qt_filesystem_model");
+ QTRY_COMPARE(model->rowCount(model->index(dir.absolutePath())), 2);
+
+ fd.setOption(QFileDialog::ShowDirsOnly, false);
+ QTRY_COMPARE(model->rowCount(model->index(dir.absolutePath())), 3);
+
+ fd.setOption(QFileDialog::ShowDirsOnly, true);
+ QTRY_COMPARE(model->rowCount(model->index(dir.absolutePath())), 2);
+
+ fd.setFileMode(QFileDialog::DirectoryOnly);
+ QTRY_COMPARE(model->rowCount(model->index(dir.absolutePath())), 2);
+ QTRY_COMPARE(bool(fd.options() & QFileDialog::ShowDirsOnly), true);
+
+ fd.setFileMode(QFileDialog::AnyFile);
+ QTRY_COMPARE(model->rowCount(model->index(dir.absolutePath())), 3);
+ QTRY_COMPARE(bool(fd.options() & QFileDialog::ShowDirsOnly), false);
+
+ fd.setDirectory(QDir::homePath());
+
+ //We remove the dirs
+ dir.rmdir("a");
+ dir.rmdir("b");
+
+ //we delete the file
+ tempFile.remove();
+
+ dirTemp.cdUp();
+ dirTemp.rmdir(tempName);
+}
+
+void tst_QFiledialog::QTBUG4842_selectFilterWithHideNameFilterDetails()
+{
+ QStringList filtersStr;
+ filtersStr << "Images (*.png *.xpm *.jpg)" << "Text files (*.txt)" << "XML files (*.xml)";
+ QString chosenFilterString("Text files (*.txt)");
+
+ QNonNativeFileDialog fd(0, "TestFileDialog");
+ fd.setAcceptMode(QFileDialog::AcceptSave);
+ fd.setOption(QFileDialog::HideNameFilterDetails, true);
+ fd.setNameFilters(filtersStr);
+ fd.selectNameFilter(chosenFilterString);
+ fd.show();
+
+ QApplication::setActiveWindow(&fd);
+ QTest::qWaitForWindowShown(&fd);
+ QTRY_COMPARE(fd.isVisible(), true);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd));
+
+ QComboBox *filters = qFindChild<QComboBox*>(&fd, "fileTypeCombo");
+ //We compare the current combobox text with the stripped version
+ QCOMPARE(filters->currentText(), QString("Text files"));
+
+ QNonNativeFileDialog fd2(0, "TestFileDialog");
+ fd2.setAcceptMode(QFileDialog::AcceptSave);
+ fd2.setOption(QFileDialog::HideNameFilterDetails, false);
+ fd2.setNameFilters(filtersStr);
+ fd2.selectNameFilter(chosenFilterString);
+ fd2.show();
+
+ QApplication::setActiveWindow(&fd2);
+ QTest::qWaitForWindowShown(&fd2);
+ QTRY_COMPARE(fd2.isVisible(), true);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd2));
+
+ QComboBox *filters2 = qFindChild<QComboBox*>(&fd2, "fileTypeCombo");
+ //We compare the current combobox text with the non stripped version
+ QCOMPARE(filters2->currentText(), chosenFilterString);
+
+}
+
QTEST_MAIN(tst_QFiledialog)
#include "tst_qfiledialog2.moc"
diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp
index 1445f5b..5ea7100 100644
--- a/tests/auto/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp
@@ -1074,8 +1074,8 @@ void tst_QFileInfo::isHidden_data()
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
QTest::newRow("C:/RECYCLER") << QString::fromLatin1("C:/RECYCLER") << true;
- QTest::newRow("C:/RECYCLER/.") << QString::fromLatin1("C:/RECYCLER/.") << false;
- QTest::newRow("C:/RECYCLER/..") << QString::fromLatin1("C:/RECYCLER/..") << false;
+ QTest::newRow("C:/RECYCLER/.") << QString::fromLatin1("C:/RECYCLER/.") << true;
+ QTest::newRow("C:/RECYCLER/..") << QString::fromLatin1("C:/RECYCLER/..") << true;
#endif
#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
@@ -1083,13 +1083,9 @@ void tst_QFileInfo::isHidden_data()
&& !QDir().mkdir("./.hidden-directory"))
qWarning("Unable to create directory './.hidden-directory'. Some tests will fail.");
- QTest::newRow("./.hidden-directory") << QString("./.hidden-directory") << true;
- QTest::newRow("./.hidden-directory/.") << QString("./.hidden-directory/.") << false;
- QTest::newRow("./.hidden-directory/..") << QString("./.hidden-directory/..") << false;
-
QTest::newRow("/path/to/.hidden-directory") << QDir::currentPath() + QString("/.hidden-directory") << true;
- QTest::newRow("/path/to/.hidden-directory/.") << QDir::currentPath() + QString("/.hidden-directory/.") << false;
- QTest::newRow("/path/to/.hidden-directory/..") << QDir::currentPath() + QString("/.hidden-directory/..") << false;
+ QTest::newRow("/path/to/.hidden-directory/.") << QDir::currentPath() + QString("/.hidden-directory/.") << true;
+ QTest::newRow("/path/to/.hidden-directory/..") << QDir::currentPath() + QString("/.hidden-directory/..") << true;
#endif
#if defined(Q_OS_MAC)
diff --git a/tests/auto/qfontcombobox/tst_qfontcombobox.cpp b/tests/auto/qfontcombobox/tst_qfontcombobox.cpp
index 657be06..73dfe076 100644
--- a/tests/auto/qfontcombobox/tst_qfontcombobox.cpp
+++ b/tests/auto/qfontcombobox/tst_qfontcombobox.cpp
@@ -123,9 +123,11 @@ void tst_QFontComboBox::currentFont_data()
QTest::addColumn<QFont>("currentFont");
// Normalize the names
QFont defaultFont;
+ QFontInfo fi(defaultFont);
+ defaultFont = QFont(fi.family()); // make sure we have a real font name and not something like 'Sans Serif'.
QTest::newRow("default") << defaultFont;
defaultFont.setPointSize(defaultFont.pointSize() + 10);
- QTest::newRow("default") << defaultFont;
+ QTest::newRow("default2") << defaultFont;
QFontDatabase db;
QStringList list = db.families();
for (int i = 0; i < list.count(); ++i) {
diff --git a/tests/auto/qftp/tst_qftp.cpp b/tests/auto/qftp/tst_qftp.cpp
index 27c2e13..9c1670d 100644
--- a/tests/auto/qftp/tst_qftp.cpp
+++ b/tests/auto/qftp/tst_qftp.cpp
@@ -51,9 +51,6 @@
#include <stdlib.h>
#include <QNetworkProxy>
-#ifndef TEST_QNETWORK_PROXY
-#define TEST_QNETWORK_PROXY
-#endif
#include "../network-settings.h"
//TESTED_CLASS=
@@ -202,11 +199,9 @@ void tst_QFtp::initTestCase_data()
QTest::addColumn<int>("proxyType");
QTest::newRow("WithoutProxy") << false << 0;
-#ifdef TEST_QNETWORK_PROXY
QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy);
//### doesn't work well yet.
//QTest::newRow("WithHttpProxy") << true << int(QNetworkProxy::HttpProxy);
-#endif
}
void tst_QFtp::initTestCase()
diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp
index 5dc072d..a61eb8d 100644
--- a/tests/auto/qgl/tst_qgl.cpp
+++ b/tests/auto/qgl/tst_qgl.cpp
@@ -75,6 +75,7 @@ private slots:
void graphicsViewClipping();
void partialGLWidgetUpdates_data();
void partialGLWidgetUpdates();
+ void glWidgetWithAlpha();
void glWidgetRendering();
void glFBOSimpleRendering();
void glFBORendering();
@@ -251,15 +252,10 @@ void tst_QGL::getSetCheck()
// bool QGLFormat::sampleBuffers()
// void QGLFormat::setSampleBuffers(bool)
-#if !defined(QT_OPENGL_ES_2)
QCOMPARE(false, obj1.sampleBuffers());
QVERIFY(!obj1.testOption(QGL::SampleBuffers));
QVERIFY(obj1.testOption(QGL::NoSampleBuffers));
-#else
- QCOMPARE(true, obj1.sampleBuffers());
- QVERIFY(obj1.testOption(QGL::SampleBuffers));
- QVERIFY(!obj1.testOption(QGL::NoSampleBuffers));
-#endif
+
obj1.setSampleBuffers(false);
QCOMPARE(false, obj1.sampleBuffers());
QVERIFY(obj1.testOption(QGL::NoSampleBuffers));
@@ -927,6 +923,17 @@ void tst_QGL::glPBufferRendering()
QFUZZY_COMPARE_IMAGES(fb, reference);
}
+void tst_QGL::glWidgetWithAlpha()
+{
+ QGLWidget* w = new QGLWidget(QGLFormat(QGL::AlphaChannel));
+ w->show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(w);
+#endif
+
+ delete w;
+}
+
class GLWidget : public QGLWidget
{
public:
@@ -1817,17 +1824,12 @@ Q_GLOBAL_STATIC_WITH_ARGS(QGLContextResource, qt_shared_test, (qt_shared_test_fr
void tst_QGL::shareRegister()
{
#ifdef QT_BUILD_INTERNAL
- QGLShareRegister *shareReg = qgl_share_reg();
- QVERIFY(shareReg != 0);
-
// Create a context.
QGLWidget *glw1 = new QGLWidget();
glw1->makeCurrent();
// Nothing should be sharing with glw1's context yet.
- QList<const QGLContext *> list;
- list = shareReg->shares(glw1->context());
- QCOMPARE(list.size(), 0);
+ QVERIFY(!glw1->isSharing());
// Create a guard for the first context.
QGLSharedResourceGuard guard(glw1->context());
@@ -1860,16 +1862,6 @@ void tst_QGL::shareRegister()
QVERIFY(guard.context() == glw1->context());
QVERIFY(guard.id() == 3);
- // Now there are two items in the share lists.
- list = shareReg->shares(glw1->context());
- QCOMPARE(list.size(), 2);
- QVERIFY(list.contains(glw1->context()));
- QVERIFY(list.contains(glw2->context()));
- list = shareReg->shares(glw2->context());
- QCOMPARE(list.size(), 2);
- QVERIFY(list.contains(glw1->context()));
- QVERIFY(list.contains(glw2->context()));
-
// Check the sharing relationships.
QVERIFY(QGLContext::areSharing(glw1->context(), glw1->context()));
QVERIFY(QGLContext::areSharing(glw2->context(), glw2->context()));
@@ -1895,18 +1887,6 @@ void tst_QGL::shareRegister()
QVERIFY(qt_shared_test()->value(glw2->context()) == res1);
QVERIFY(qt_shared_test()->value(glw3->context()) == res3);
- // First two should still be sharing, but third is in its own list.
- list = shareReg->shares(glw1->context());
- QCOMPARE(list.size(), 2);
- QVERIFY(list.contains(glw1->context()));
- QVERIFY(list.contains(glw2->context()));
- list = shareReg->shares(glw2->context());
- QCOMPARE(list.size(), 2);
- QVERIFY(list.contains(glw1->context()));
- QVERIFY(list.contains(glw2->context()));
- list = shareReg->shares(glw3->context());
- QCOMPARE(list.size(), 0);
-
// Check the sharing relationships again.
QVERIFY(QGLContext::areSharing(glw1->context(), glw1->context()));
QVERIFY(QGLContext::areSharing(glw2->context(), glw2->context()));
@@ -1944,10 +1924,6 @@ void tst_QGL::shareRegister()
QVERIFY(guard3.context() == glw3->context());
QVERIFY(guard3.id() == 5);
- // Re-check the share list for the second context (should be empty now).
- list = shareReg->shares(glw2->context());
- QCOMPARE(list.size(), 0);
-
// Clean up and check that the resources are properly deleted.
delete glw2;
QCOMPARE(tst_QGLResource::deletions, 1);
diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
index 6e78522..1cb9f0d 100644
--- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
+++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
@@ -90,6 +90,7 @@ private slots:
void parallelToHalfLayout();
void globalSpacing();
void graphicsAnchorHandling();
+ void invalidHierarchyCheck();
};
class RectWidget : public QGraphicsWidget
@@ -2058,5 +2059,24 @@ void tst_QGraphicsAnchorLayout::graphicsAnchorHandling()
delete a;
}
+void tst_QGraphicsAnchorLayout::invalidHierarchyCheck()
+{
+ QGraphicsWidget window(0, Qt::Window);
+ QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout;
+ window.setLayout(l);
+
+ QCOMPARE(l->count(), 0);
+ QTest::ignoreMessage(QtWarningMsg, "QGraphicsAnchorLayout::addAnchor(): "
+ "You cannot add the parent of the layout to the layout.");
+ QVERIFY(!l->addAnchor(l, Qt::AnchorLeft, &window, Qt::AnchorLeft));
+ QTest::ignoreMessage(QtWarningMsg, "QGraphicsAnchorLayout::addAnchor(): "
+ "You cannot add the parent of the layout to the layout.");
+ l->addAnchors(l, &window);
+ QTest::ignoreMessage(QtWarningMsg, "QGraphicsAnchorLayout::addAnchor(): "
+ "You cannot add the parent of the layout to the layout.");
+ l->addCornerAnchors(l, Qt::TopLeftCorner, &window, Qt::TopLeftCorner);
+ QCOMPARE(l->count(), 0);
+}
+
QTEST_MAIN(tst_QGraphicsAnchorLayout)
#include "tst_qgraphicsanchorlayout.moc"
diff --git a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
index 259df4d..69fc118 100644
--- a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
+++ b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
@@ -69,6 +69,7 @@ private slots:
void opacity();
void grayscale();
void colorize();
+ void drawPixmapItem();
};
void tst_QGraphicsEffect::initTestCase()
@@ -465,6 +466,54 @@ void tst_QGraphicsEffect::colorize()
QCOMPARE(image.pixel(10, 10), qRgb(122, 193, 66));
}
+class PixmapItemEffect : public QGraphicsEffect
+{
+public:
+ PixmapItemEffect(const QPixmap &source)
+ : QGraphicsEffect()
+ , pixmap(source)
+ , repaints(0)
+ {}
+
+ QRectF boundingRectFor(const QRectF &rect) const
+ { return rect; }
+
+ void draw(QPainter *painter)
+ {
+ QVERIFY(sourcePixmap(Qt::LogicalCoordinates).pixmapData() == pixmap.pixmapData());
+ QVERIFY((painter->worldTransform().type() <= QTransform::TxTranslate) == (sourcePixmap(Qt::DeviceCoordinates).pixmapData() == pixmap.pixmapData()));
+
+ ++repaints;
+ }
+ QPixmap pixmap;
+ int repaints;
+};
+
+void tst_QGraphicsEffect::drawPixmapItem()
+{
+ QImage image(32, 32, QImage::Format_RGB32);
+ QPainter p(&image);
+ p.fillRect(0, 0, 32, 16, Qt::blue);
+ p.fillRect(0, 16, 32, 16, Qt::red);
+ p.end();
+
+ QGraphicsScene scene;
+ QGraphicsPixmapItem *item = new QGraphicsPixmapItem(QPixmap::fromImage(image));
+ scene.addItem(item);
+
+ PixmapItemEffect *effect = new PixmapItemEffect(item->pixmap());
+ item->setGraphicsEffect(effect);
+
+ QGraphicsView view(&scene);
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+
+ item->rotate(180);
+ QTest::qWait(50);
+
+ QTRY_VERIFY(effect->repaints >= 2);
+}
+
QTEST_MAIN(tst_QGraphicsEffect)
#include "tst_qgraphicseffect.moc"
diff --git a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
index 9991ab4..7a0d40a 100644
--- a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
+++ b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
@@ -352,7 +352,7 @@ void tst_QGraphicsEffectSource::pixmapPadding_data()
QTest::newRow("log,effectrect") << int(Qt::LogicalCoordinates)
<< int(QGraphicsEffect::PadToEffectiveBoundingRect)
- << QSize(30, 30) << QPoint(-10, -10)
+ << QSize(20, 20) << QPoint(-5, -5)
<< 0x00000000u;
QTest::newRow("dev,nopad") << int(Qt::DeviceCoordinates)
diff --git a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
index cd1eedd..3d95f92 100644
--- a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
+++ b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
@@ -108,6 +108,157 @@ private slots:
void task236367_maxSizeHint();
};
+class RectWidget : public QGraphicsWidget
+{
+public:
+ RectWidget(QGraphicsItem *parent = 0) : QGraphicsWidget(parent){}
+
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+ {
+ Q_UNUSED(option);
+ Q_UNUSED(widget);
+ painter->drawRoundRect(rect());
+ painter->drawLine(rect().topLeft(), rect().bottomRight());
+ painter->drawLine(rect().bottomLeft(), rect().topRight());
+ }
+
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const
+ {
+ if (m_sizeHints[which].isValid()) {
+ return m_sizeHints[which];
+ }
+ return QGraphicsWidget::sizeHint(which, constraint);
+ }
+
+ void setSizeHint(Qt::SizeHint which, const QSizeF &size) {
+ m_sizeHints[which] = size;
+ updateGeometry();
+ }
+
+ QSizeF m_sizeHints[Qt::NSizeHints];
+};
+
+struct ItemDesc
+{
+ ItemDesc(int row, int col)
+ : m_pos(qMakePair(row, col)),
+ m_rowSpan(1),
+ m_colSpan(1),
+ m_sizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred)),
+ m_align(0)
+ {
+ }
+
+ ItemDesc &rowSpan(int span) {
+ m_rowSpan = span;
+ return (*this);
+ }
+
+ ItemDesc &colSpan(int span) {
+ m_colSpan = span;
+ return (*this);
+ }
+
+ ItemDesc &sizePolicy(const QSizePolicy &sp) {
+ m_sizePolicy = sp;
+ return (*this);
+ }
+
+ ItemDesc &sizePolicy(QSizePolicy::Policy horAndVer) {
+ m_sizePolicy = QSizePolicy(horAndVer, horAndVer);
+ return (*this);
+ }
+
+ ItemDesc &sizePolicyH(QSizePolicy::Policy hor) {
+ m_sizePolicy.setHorizontalPolicy(hor);
+ return (*this);
+ }
+
+ ItemDesc &sizePolicyV(QSizePolicy::Policy ver) {
+ m_sizePolicy.setVerticalPolicy(ver);
+ return (*this);
+ }
+
+ ItemDesc &sizePolicy(QSizePolicy::Policy hor, QSizePolicy::Policy ver) {
+ m_sizePolicy = QSizePolicy(hor, ver);
+ return (*this);
+ }
+
+ ItemDesc &sizeHint(Qt::SizeHint which, const QSizeF &sh) {
+ m_sizeHints[which] = sh;
+ return (*this);
+ }
+
+ ItemDesc &preferredSizeHint(const QSizeF &sh) {
+ m_sizeHints[Qt::PreferredSize] = sh;
+ return (*this);
+ }
+
+ ItemDesc &minSize(const QSizeF &sz) {
+ m_sizes[Qt::MinimumSize] = sz;
+ return (*this);
+ }
+ ItemDesc &preferredSize(const QSizeF &sz) {
+ m_sizes[Qt::PreferredSize] = sz;
+ return (*this);
+ }
+ ItemDesc &maxSize(const QSizeF &sz) {
+ m_sizes[Qt::MaximumSize] = sz;
+ return (*this);
+ }
+
+ ItemDesc &alignment(Qt::Alignment alignment) {
+ m_align = alignment;
+ return (*this);
+ }
+
+ void apply(QGraphicsGridLayout *layout, QGraphicsWidget *item) {
+ item->setSizePolicy(m_sizePolicy);
+ for (int i = 0; i < Qt::NSizeHints; ++i) {
+ if (!m_sizes[i].isValid())
+ continue;
+ switch ((Qt::SizeHint)i) {
+ case Qt::MinimumSize:
+ item->setMinimumSize(m_sizes[i]);
+ break;
+ case Qt::PreferredSize:
+ item->setPreferredSize(m_sizes[i]);
+ break;
+ case Qt::MaximumSize:
+ item->setMaximumSize(m_sizes[i]);
+ break;
+ default:
+ qWarning("not implemented");
+ break;
+ }
+ }
+ layout->addItem(item, m_pos.first, m_pos.second, m_rowSpan, m_colSpan);
+ layout->setAlignment(item, m_align);
+ }
+
+ void apply(QGraphicsGridLayout *layout, RectWidget *item) {
+ for (int i = 0; i < Qt::NSizeHints; ++i)
+ item->setSizeHint((Qt::SizeHint)i, m_sizeHints[i]);
+ apply(layout, static_cast<QGraphicsWidget*>(item));
+ }
+
+//private:
+ QPair<int,int> m_pos; // row,col
+ int m_rowSpan;
+ int m_colSpan;
+ QSizePolicy m_sizePolicy;
+ QSizeF m_sizeHints[Qt::NSizeHints];
+ QSizeF m_sizes[Qt::NSizeHints];
+ Qt::Alignment m_align;
+};
+
+typedef QList<ItemDesc> ItemList;
+Q_DECLARE_METATYPE(ItemList);
+
+typedef QList<QSizeF> SizeList;
+Q_DECLARE_METATYPE(SizeList);
+
+
// This will be called before the first test function is executed.
// It is only called once.
void tst_QGraphicsGridLayout::initTestCase()
@@ -190,36 +341,6 @@ void tst_QGraphicsGridLayout::qgraphicsgridlayout()
layout.verticalSpacing();
}
-class RectWidget : public QGraphicsWidget
-{
-public:
- RectWidget(QGraphicsItem *parent = 0) : QGraphicsWidget(parent){}
-
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
- {
- Q_UNUSED(option);
- Q_UNUSED(widget);
- painter->drawRoundRect(rect());
- painter->drawLine(rect().topLeft(), rect().bottomRight());
- painter->drawLine(rect().bottomLeft(), rect().topRight());
- }
-
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const
- {
- if (m_sizeHints[which].isValid()) {
- return m_sizeHints[which];
- }
- return QGraphicsWidget::sizeHint(which, constraint);
- }
-
- void setSizeHint(Qt::SizeHint which, const QSizeF &size) {
- m_sizeHints[which] = size;
- updateGeometry();
- }
-
- QSizeF m_sizeHints[Qt::NSizeHints];
-};
-
static void populateLayout(QGraphicsGridLayout *gridLayout, int width, int height)
{
for (int y = 0; y < height; ++y) {
@@ -1144,7 +1265,7 @@ void tst_QGraphicsGridLayout::setColumnSpacing()
}
void tst_QGraphicsGridLayout::setGeometry_data()
-{
+{
QTest::addColumn<QRectF>("rect");
QTest::newRow("null") << QRectF();
QTest::newRow("normal") << QRectF(0,0, 50, 50);
@@ -1233,28 +1354,84 @@ void tst_QGraphicsGridLayout::setSpacing()
void tst_QGraphicsGridLayout::sizeHint_data()
{
+ QTest::addColumn<ItemList>("itemDescriptions");
+ QTest::addColumn<QSizeF>("expectedMinimumSizeHint");
+ QTest::addColumn<QSizeF>("expectedPreferredSizeHint");
+ QTest::addColumn<QSizeF>("expectedMaximumSizeHint");
+
+ QTest::newRow("rowSpan_larger_than_rows") << (ItemList()
+ << ItemDesc(0,0)
+ .minSize(QSizeF(50,300))
+ .maxSize(QSizeF(50,300))
+ .rowSpan(2)
+ << ItemDesc(0,1)
+ .minSize(QSizeF(50,0))
+ .preferredSize(QSizeF(50,50))
+ .maxSize(QSize(50, 1000))
+ << ItemDesc(1,1)
+ .minSize(QSizeF(50,0))
+ .preferredSize(QSizeF(50,50))
+ .maxSize(QSize(50, 1000))
+ )
+ << QSizeF(100, 300)
+ << QSizeF(100, 300)
+ << QSizeF(100, 2000);
+
+ QTest::newRow("rowSpan_smaller_than_rows") << (ItemList()
+ << ItemDesc(0,0)
+ .minSize(QSizeF(50, 0))
+ .preferredSize(QSizeF(50, 50))
+ .maxSize(QSizeF(50, 300))
+ .rowSpan(2)
+ << ItemDesc(0,1)
+ .minSize(QSizeF(50, 50))
+ .preferredSize(QSizeF(50, 50))
+ .maxSize(QSize(50, 50))
+ << ItemDesc(1,1)
+ .minSize(QSizeF(50, 50))
+ .preferredSize(QSizeF(50, 50))
+ .maxSize(QSize(50, 50))
+ )
+ << QSizeF(100, 100)
+ << QSizeF(100, 100)
+ << QSizeF(100, 100);
- /*
- QTest::addColumn<Qt::SizeHint>("which");
- QTest::addColumn<QSizeF>("constraint");
- QTest::addColumn<QSizeF>("sizeHint");
- QTest::newRow("null") << 0;
- */
}
// public QSizeF sizeHint(Qt::SizeHint which, QSizeF const& constraint = QSizeF()) const
void tst_QGraphicsGridLayout::sizeHint()
{
- /*
- QFETCH(Qt::SizeHint, which);
- QFETCH(QSizeF, constraint);
- QFETCH(QSizeF, sizeHint);
+ QFETCH(ItemList, itemDescriptions);
+ QFETCH(QSizeF, expectedMinimumSizeHint);
+ QFETCH(QSizeF, expectedPreferredSizeHint);
+ QFETCH(QSizeF, expectedMaximumSizeHint);
- QGraphicsGridLayout layout;
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+ QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window);
+ QGraphicsGridLayout *layout = new QGraphicsGridLayout;
+ scene.addItem(widget);
+ widget->setLayout(layout);
+ layout->setContentsMargins(0, 0, 0, 0);
+ layout->setSpacing(0.0);
+ widget->setContentsMargins(0, 0, 0, 0);
+
+ int i;
+ for (i = 0; i < itemDescriptions.count(); ++i) {
+ ItemDesc desc = itemDescriptions.at(i);
+ RectWidget *item = new RectWidget(widget);
+ desc.apply(layout, item);
+ }
+
+ QApplication::sendPostedEvents(0, 0);
+
+ widget->show();
+ view.show();
+ view.resize(400,300);
+ QCOMPARE(layout->sizeHint(Qt::MinimumSize), expectedMinimumSizeHint);
+ QCOMPARE(layout->sizeHint(Qt::PreferredSize), expectedPreferredSizeHint);
+ QCOMPARE(layout->sizeHint(Qt::MaximumSize), expectedMaximumSizeHint);
- layout.sizeHint();
- */
- QSKIP("Test unimplemented", SkipSingle);
}
void tst_QGraphicsGridLayout::verticalSpacing_data()
@@ -1373,121 +1550,6 @@ void tst_QGraphicsGridLayout::removeLayout()
QCOMPARE(pushButton->geometry(), r2);
}
-struct ItemDesc
-{
- ItemDesc(int row, int col)
- : m_pos(qMakePair(row, col)),
- m_rowSpan(1),
- m_colSpan(1),
- m_sizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred)),
- m_align(0)
- {
- }
-
- ItemDesc &rowSpan(int span) {
- m_rowSpan = span;
- return (*this);
- }
-
- ItemDesc &colSpan(int span) {
- m_colSpan = span;
- return (*this);
- }
-
- ItemDesc &sizePolicy(const QSizePolicy &sp) {
- m_sizePolicy = sp;
- return (*this);
- }
-
- ItemDesc &sizePolicy(QSizePolicy::Policy horAndVer) {
- m_sizePolicy = QSizePolicy(horAndVer, horAndVer);
- return (*this);
- }
-
- ItemDesc &sizePolicyH(QSizePolicy::Policy hor) {
- m_sizePolicy.setHorizontalPolicy(hor);
- return (*this);
- }
-
- ItemDesc &sizePolicyV(QSizePolicy::Policy ver) {
- m_sizePolicy.setVerticalPolicy(ver);
- return (*this);
- }
-
- ItemDesc &sizePolicy(QSizePolicy::Policy hor, QSizePolicy::Policy ver) {
- m_sizePolicy = QSizePolicy(hor, ver);
- return (*this);
- }
-
- ItemDesc &sizeHint(Qt::SizeHint which, const QSizeF &sh) {
- m_sizeHints[which] = sh;
- return (*this);
- }
-
- ItemDesc &preferredSizeHint(const QSizeF &sh) {
- m_sizeHints[Qt::PreferredSize] = sh;
- return (*this);
- }
-
- ItemDesc &minSize(const QSizeF &sz) {
- m_sizes[Qt::MinimumSize] = sz;
- return (*this);
- }
- ItemDesc &preferredSize(const QSizeF &sz) {
- m_sizes[Qt::PreferredSize] = sz;
- return (*this);
- }
- ItemDesc &maxSize(const QSizeF &sz) {
- m_sizes[Qt::MaximumSize] = sz;
- return (*this);
- }
-
- ItemDesc &alignment(Qt::Alignment alignment) {
- m_align = alignment;
- return (*this);
- }
-
- void apply(QGraphicsGridLayout *layout, RectWidget *item) {
- item->setSizePolicy(m_sizePolicy);
- for (int i = 0; i < Qt::NSizeHints; ++i) {
- item->setSizeHint((Qt::SizeHint)i, m_sizeHints[i]);
- if (!m_sizes[i].isValid())
- continue;
- switch ((Qt::SizeHint)i) {
- case Qt::MinimumSize:
- item->setMinimumSize(m_sizes[i]);
- break;
- case Qt::PreferredSize:
- item->setPreferredSize(m_sizes[i]);
- break;
- case Qt::MaximumSize:
- item->setMaximumSize(m_sizes[i]);
- break;
- default:
- qWarning("not implemented");
- break;
- }
- }
- layout->addItem(item, m_pos.first, m_pos.second, m_rowSpan, m_colSpan);
- layout->setAlignment(item, m_align);
- }
-
-//private:
- QPair<int,int> m_pos; // row,col
- int m_rowSpan;
- int m_colSpan;
- QSizePolicy m_sizePolicy;
- QSizeF m_sizeHints[Qt::NSizeHints];
- QSizeF m_sizes[Qt::NSizeHints];
- Qt::Alignment m_align;
-};
-
-typedef QList<ItemDesc> ItemList;
-Q_DECLARE_METATYPE(ItemList);
-
-typedef QList<QSizeF> SizeList;
-Q_DECLARE_METATYPE(SizeList);
-
void tst_QGraphicsGridLayout::defaultStretchFactors_data()
{
QTest::addColumn<ItemList>("itemDescriptions");
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 6266933..03a587a 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -233,6 +233,7 @@ public:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{
hints = painter->renderHints();
+ painter->setBrush(brush);
painter->drawRect(boundingRect());
++repaints;
}
@@ -247,6 +248,7 @@ public:
QPainter::RenderHints hints;
int repaints;
QRectF br;
+ QBrush brush;
};
class tst_QGraphicsItem : public QObject
@@ -316,6 +318,7 @@ private slots:
void childrenBoundingRect3();
void group();
void setGroup();
+ void setGroup2();
void nestedGroups();
void warpChildrenIntoGroup();
void removeFromGroup();
@@ -1351,6 +1354,7 @@ void tst_QGraphicsItem::selected()
view.setFixedSize(250, 250);
view.show();
+ QTest::qWaitForWindowShown(&view);
qApp->processEvents();
qApp->processEvents();
@@ -3343,6 +3347,35 @@ void tst_QGraphicsItem::setGroup()
QCOMPARE(rect->parentItem(), (QGraphicsItem *)0);
}
+void tst_QGraphicsItem::setGroup2()
+{
+ QGraphicsScene scene;
+ QGraphicsItemGroup group;
+ scene.addItem(&group);
+
+ QGraphicsRectItem *rect = scene.addRect(50,50,50,50,Qt::NoPen,Qt::black);
+ rect->setTransformOriginPoint(50,50);
+ rect->setRotation(45);
+ rect->setScale(1.5);
+ rect->translate(20,20);
+ group.translate(-30,-40);
+ group.setRotation(180);
+ group.setScale(0.5);
+
+ QTransform oldSceneTransform = rect->sceneTransform();
+ rect->setGroup(&group);
+ QCOMPARE(rect->sceneTransform(), oldSceneTransform);
+
+ group.setRotation(20);
+ group.setScale(2);
+ rect->setRotation(90);
+ rect->setScale(0.8);
+
+ oldSceneTransform = rect->sceneTransform();
+ rect->setGroup(0);
+ QCOMPARE(rect->sceneTransform(), oldSceneTransform);
+}
+
void tst_QGraphicsItem::nestedGroups()
{
QGraphicsItemGroup *group1 = new QGraphicsItemGroup;
@@ -7646,17 +7679,20 @@ void tst_QGraphicsItem::hitTestGraphicsEffectItem()
EventTester *item1 = new EventTester;
item1->br = itemBoundingRect;
item1->setPos(-200, -200);
+ item1->brush = Qt::red;
EventTester *item2 = new EventTester;
item2->br = itemBoundingRect;
item2->setFlag(QGraphicsItem::ItemIgnoresTransformations);
item2->setParentItem(item1);
item2->setPos(200, 200);
+ item2->brush = Qt::green;
EventTester *item3 = new EventTester;
item3->br = itemBoundingRect;
item3->setParentItem(item2);
item3->setPos(80, 80);
+ item3->brush = Qt::blue;
scene.addItem(item1);
QTest::qWait(100);
@@ -7671,8 +7707,8 @@ void tst_QGraphicsItem::hitTestGraphicsEffectItem()
item1->setGraphicsEffect(shadow);
QTest::qWait(50);
- // Make sure all items are repainted.
- QCOMPARE(item1->repaints, 1);
+ // Make sure all visible items are repainted.
+ QCOMPARE(item1->repaints, 0);
QCOMPARE(item2->repaints, 1);
QCOMPARE(item3->repaints, 1);
diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
index 797e1fb..9e4321b 100644
--- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
@@ -211,6 +211,7 @@ private slots:
void centerOnDirtyItem();
void mouseTracking();
void mouseTracking2();
+ void mouseTracking3();
void render();
void exposeRegion();
void update_data();
@@ -3403,6 +3404,102 @@ void tst_QGraphicsView::mouseTracking2()
QCOMPARE(spy.count(), 1);
}
+void tst_QGraphicsView::mouseTracking3()
+{
+ // Mouse tracking should be automatically enabled if AnchorUnderMouse is used for
+ // view transform or resize. We never disable mouse tracking if it is already enabled.
+
+ { // Make sure we enable mouse tracking when using AnchorUnderMouse for view transformation.
+ QGraphicsScene scene(-10000, -10000, 20000, 20000);
+ QGraphicsView view(&scene);
+ QVERIFY(!view.viewport()->hasMouseTracking());
+
+ view.setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
+ QVERIFY(view.viewport()->hasMouseTracking());
+ }
+
+ { // Make sure we enable mouse tracking when using AnchorUnderMouse for view resizing.
+ QGraphicsScene scene(-10000, -10000, 20000, 20000);
+ QGraphicsView view(&scene);
+ QVERIFY(!view.viewport()->hasMouseTracking());
+
+ view.setResizeAnchor(QGraphicsView::AnchorUnderMouse);
+ QVERIFY(view.viewport()->hasMouseTracking());
+ }
+
+ { // Make sure we don't disable mouse tracking in setViewport/setScene (transformation anchor).
+ QGraphicsView view;
+ view.setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
+ QVERIFY(view.viewport()->hasMouseTracking());
+
+ QWidget *viewport = new QWidget;
+ view.setViewport(viewport);
+ QVERIFY(viewport->hasMouseTracking());
+
+ QGraphicsScene scene(-10000, -10000, 20000, 20000);
+ view.setScene(&scene);
+ QVERIFY(viewport->hasMouseTracking());
+ }
+
+ { // Make sure we don't disable mouse tracking in setViewport/setScene (resize anchor).
+ QGraphicsView view;
+ view.setResizeAnchor(QGraphicsView::AnchorUnderMouse);
+ QVERIFY(view.viewport()->hasMouseTracking());
+
+ QWidget *viewport = new QWidget;
+ view.setViewport(viewport);
+ QVERIFY(viewport->hasMouseTracking());
+
+ QGraphicsScene scene(-10000, -10000, 20000, 20000);
+ view.setScene(&scene);
+ QVERIFY(viewport->hasMouseTracking());
+ }
+
+ // Make sure we don't disable mouse tracking when adding an item (transformation anchor).
+ { // Adding an item to the scene before the scene is set on the view.
+ QGraphicsScene scene(-10000, -10000, 20000, 20000);
+ QGraphicsRectItem *item = new QGraphicsRectItem(10, 10, 10, 10);
+ scene.addItem(item);
+
+ QGraphicsView view;
+ view.setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
+ view.setScene(&scene);
+ QVERIFY(view.viewport()->hasMouseTracking());
+ }
+
+ { // Adding an item to the scene after the scene is set on the view.
+ QGraphicsScene scene(-10000, -10000, 20000, 20000);
+ QGraphicsView view(&scene);
+ view.setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
+
+ QGraphicsRectItem *item = new QGraphicsRectItem(10, 10, 10, 10);
+ scene.addItem(item);
+ QVERIFY(view.viewport()->hasMouseTracking());
+ }
+
+ // Make sure we don't disable mouse tracking when adding an item (resize anchor).
+ { // Adding an item to the scene before the scene is set on the view.
+ QGraphicsScene scene(-10000, -10000, 20000, 20000);
+ QGraphicsRectItem *item = new QGraphicsRectItem(10, 10, 10, 10);
+ scene.addItem(item);
+
+ QGraphicsView view;
+ view.setResizeAnchor(QGraphicsView::AnchorUnderMouse);
+ view.setScene(&scene);
+ QVERIFY(view.viewport()->hasMouseTracking());
+ }
+
+ { // Adding an item to the scene after the scene is set on the view.
+ QGraphicsScene scene(-10000, -10000, 20000, 20000);
+ QGraphicsView view(&scene);
+ view.setResizeAnchor(QGraphicsView::AnchorUnderMouse);
+
+ QGraphicsRectItem *item = new QGraphicsRectItem(10, 10, 10, 10);
+ scene.addItem(item);
+ QVERIFY(view.viewport()->hasMouseTracking());
+ }
+}
+
class RenderTester : public QGraphicsRectItem
{
public:
@@ -3601,7 +3698,7 @@ void tst_QGraphicsView::inputMethodSensitivity()
item->setFlag(QGraphicsItem::ItemIsFocusable);
scene.addItem(item);
scene.setFocusItem(item);
- QCOMPARE(scene.focusItem(), item);
+ QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item));
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true);
item->setFlag(QGraphicsItem::ItemAcceptsInputMethod, false);
@@ -3616,35 +3713,35 @@ void tst_QGraphicsView::inputMethodSensitivity()
scene.addItem(item2);
scene.setFocusItem(item2);
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false);
- QCOMPARE(scene.focusItem(), item2);
+ QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item2));
scene.setFocusItem(item);
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true);
- QCOMPARE(scene.focusItem(), item);
+ QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item));
view.setScene(0);
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false);
- QCOMPARE(scene.focusItem(), item);
+ QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item));
view.setScene(&scene);
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true);
- QCOMPARE(scene.focusItem(), item);
+ QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item));
scene.setFocusItem(item2);
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false);
- QCOMPARE(scene.focusItem(), item2);
+ QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item2));
view.setScene(0);
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false);
- QCOMPARE(scene.focusItem(), item2);
+ QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item2));
scene.setFocusItem(item);
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false);
- QCOMPARE(scene.focusItem(), item);
+ QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item));
view.setScene(&scene);
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true);
- QCOMPARE(scene.focusItem(), item);
+ QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item));
}
class InputContextTester : public QInputContext
@@ -3878,7 +3975,7 @@ void tst_QGraphicsView::QTBUG_5859_exposedRect()
{ lastBackgroundExposedRect = rect; }
QRectF lastBackgroundExposedRect;
};
-
+
class CustomRectItem : public QGraphicsRectItem
{
public:
diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
index 3303df5..a835259 100644
--- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -168,6 +168,7 @@ private slots:
void task236127_bspTreeIndexFails();
void task243004_setStyleCrash();
void task250119_shortcutContext();
+ void QT_BUG_6544_tabFocusFirstUnsetWhenRemovingItems();
};
@@ -2855,6 +2856,37 @@ void tst_QGraphicsWidget::polishEvent2()
QVERIFY(widget->events.contains(QEvent::Polish));
}
+void tst_QGraphicsWidget::QT_BUG_6544_tabFocusFirstUnsetWhenRemovingItems()
+{
+ QGraphicsScene scene;
+ QGraphicsWidget* parent1 = new QGraphicsWidget;
+ QGraphicsWidget* child1_0 = new QGraphicsWidget;
+ QGraphicsWidget* child1_1 = new QGraphicsWidget;
+
+ QGraphicsWidget* parent2 = new QGraphicsWidget;
+
+ // Add the parent and child to the scene.
+ scene.addItem(parent1);
+ child1_0->setParentItem(parent1);
+ child1_1->setParentItem(parent1);
+
+ // Hide and show the child.
+ child1_0->setParentItem(NULL);
+ scene.removeItem(child1_0);
+
+ // Remove parent from the scene.
+ scene.removeItem(parent1);
+
+ delete child1_0;
+ delete child1_1;
+ delete parent1;
+
+ // Add an item into the scene.
+ scene.addItem(parent2);
+
+ //This should not crash
+}
+
QTEST_MAIN(tst_QGraphicsWidget)
#include "tst_qgraphicswidget.moc"
diff --git a/tests/auto/qhostinfo/tst_qhostinfo.cpp b/tests/auto/qhostinfo/tst_qhostinfo.cpp
index 4d63e10..348c41b 100644
--- a/tests/auto/qhostinfo/tst_qhostinfo.cpp
+++ b/tests/auto/qhostinfo/tst_qhostinfo.cpp
@@ -88,6 +88,7 @@
#endif
#include "../network-settings.h"
+#include "../../shared/util.h"
//TESTED_CLASS=
//TESTED_FILES=
@@ -124,6 +125,9 @@ private slots:
void raceCondition();
void threadSafety();
+ void multipleSameLookups();
+ void multipleDifferentLookups();
+
protected slots:
void resultsReady(const QHostInfo &);
@@ -131,6 +135,7 @@ private:
bool ipv6LookupsAvailable;
bool ipv6Available;
bool lookupDone;
+ int lookupsDoneCounter;
QHostInfo lookupResults;
};
@@ -411,11 +416,53 @@ void tst_QHostInfo::threadSafety()
}
}
+// this test is for the multi-threaded QHostInfo rewrite. It is about getting results at all,
+// not about getting correct IPs
+void tst_QHostInfo::multipleSameLookups()
+{
+ const int COUNT = 10;
+ lookupsDoneCounter = 0;
+
+ for (int i = 0; i < COUNT; i++)
+ QHostInfo::lookupHost("localhost", this, SLOT(resultsReady(const QHostInfo)));
+
+ QTRY_VERIFY(lookupsDoneCounter == COUNT);
+
+ // spin two seconds more to see if it is not more :)
+ QTestEventLoop::instance().enterLoop(2);
+ QTRY_VERIFY(lookupsDoneCounter == COUNT);
+}
+
+// this test is for the multi-threaded QHostInfo rewrite. It is about getting results at all,
+// not about getting correct IPs
+void tst_QHostInfo::multipleDifferentLookups()
+{
+ QStringList hostnameList;
+ hostnameList << "www.ovi.com" << "www.nokia.com" << "qt.nokia.com" << "www.trolltech.com" << "troll.no"
+ << "www.qtcentre.org" << "forum.nokia.com" << "www.forum.nokia.com" << "wiki.forum.nokia.com"
+ << "www.nokia.no" << "nokia.de" << "127.0.0.1" << "----";
+
+ const int COUNT = hostnameList.size();
+ lookupsDoneCounter = 0;
+
+ for (int i = 0; i < hostnameList.size(); i++)
+ QHostInfo::lookupHost(hostnameList.at(i), this, SLOT(resultsReady(const QHostInfo)));
+
+ // give some time
+ QTestEventLoop::instance().enterLoop(5);
+ // try_verify gives some more time
+ QTRY_VERIFY(lookupsDoneCounter == COUNT);
+
+ // spin two seconds more to see if it is not more than expected
+ QTestEventLoop::instance().enterLoop(2);
+ QTRY_VERIFY(lookupsDoneCounter == COUNT);
+}
+
void tst_QHostInfo::resultsReady(const QHostInfo &hi)
{
lookupDone = true;
lookupResults = hi;
-
+ lookupsDoneCounter++;
QTestEventLoop::instance().exitLoop();
}
diff --git a/tests/auto/qhttp/tst_qhttp.cpp b/tests/auto/qhttp/tst_qhttp.cpp
index b4b6ceb..92ab3d8 100644
--- a/tests/auto/qhttp/tst_qhttp.cpp
+++ b/tests/auto/qhttp/tst_qhttp.cpp
@@ -57,9 +57,6 @@
# include <qsslsocket.h>
#endif
-#ifndef TEST_QNETWORK_PROXY
-#define TEST_QNETWORK_PROXY
-#endif
#include "../network-settings.h"
//TESTED_CLASS=
@@ -198,9 +195,7 @@ void tst_QHttp::initTestCase_data()
QTest::addColumn<int>("proxyType");
QTest::newRow("WithoutProxy") << false << 0;
-#ifdef TEST_QNETWORK_PROXY
QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy);
-#endif
}
void tst_QHttp::initTestCase()
diff --git a/tests/auto/qimagereader/images/endless-anim.gif b/tests/auto/qimagereader/images/endless-anim.gif
new file mode 100644
index 0000000..00df8da
--- /dev/null
+++ b/tests/auto/qimagereader/images/endless-anim.gif
Binary files differ
diff --git a/tests/auto/qimagereader/images/four-frames.gif b/tests/auto/qimagereader/images/four-frames.gif
new file mode 100644
index 0000000..6aff2e0
--- /dev/null
+++ b/tests/auto/qimagereader/images/four-frames.gif
Binary files differ
diff --git a/tests/auto/qimagereader/qimagereader.qrc b/tests/auto/qimagereader/qimagereader.qrc
index 11b9406..58f2f74 100644
--- a/tests/auto/qimagereader/qimagereader.qrc
+++ b/tests/auto/qimagereader/qimagereader.qrc
@@ -57,5 +57,7 @@
<file>images/qt6.gif</file>
<file>images/qt7.gif</file>
<file>images/qt8.gif</file>
+ <file>images/endless-anim.gif</file>
+ <file>images/four-frames.gif</file>
</qresource>
</RCC>
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp
index 15b1c1c..8cfaac5 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -141,6 +141,7 @@ private slots:
#if defined QTEST_HAVE_GIF
void gifHandlerBugs();
void animatedGif();
+ void gifImageCount();
#endif
void readCorruptImage_data();
@@ -322,7 +323,15 @@ void tst_QImageReader::setScaledSize_data()
QTest::newRow("PPM: test") << "test.ppm" << QSize(10, 10) << QByteArray("ppm");
QTest::newRow("XBM: gnus") << "gnus" << QSize(200, 200) << QByteArray("xbm");
#ifdef QTEST_HAVE_JPEG
- QTest::newRow("JPEG: beavis") << "beavis" << QSize(200, 200) << QByteArray("jpeg");
+ QTest::newRow("JPEG: beavis A") << "beavis" << QSize(200, 200) << QByteArray("jpeg");
+ QTest::newRow("JPEG: beavis B") << "beavis" << QSize(175, 175) << QByteArray("jpeg");
+ QTest::newRow("JPEG: beavis C") << "beavis" << QSize(100, 100) << QByteArray("jpeg");
+ QTest::newRow("JPEG: beavis D") << "beavis" << QSize(100, 200) << QByteArray("jpeg");
+ QTest::newRow("JPEG: beavis E") << "beavis" << QSize(200, 100) << QByteArray("jpeg");
+ QTest::newRow("JPEG: beavis F") << "beavis" << QSize(87, 87) << QByteArray("jpeg");
+ QTest::newRow("JPEG: beavis G") << "beavis" << QSize(50, 45) << QByteArray("jpeg");
+ QTest::newRow("JPEG: beavis H") << "beavis" << QSize(43, 43) << QByteArray("jpeg");
+ QTest::newRow("JPEG: beavis I") << "beavis" << QSize(25, 25) << QByteArray("jpeg");
#endif // QTEST_HAVE_JPEG
#ifdef QTEST_HAVE_GIF
QTest::newRow("GIF: earth") << "earth" << QSize(200, 200) << QByteArray("gif");
@@ -717,6 +726,13 @@ void tst_QImageReader::gifHandlerBugs()
QVERIFY(!im1.isNull()); QVERIFY(!im2.isNull());
QCOMPARE(im1.convertToFormat(QImage::Format_ARGB32), im2.convertToFormat(QImage::Format_ARGB32));
}
+
+ // Check the undocumented feature.
+ {
+ QImageReader io(prefix + "endless-anim.gif");
+ QVERIFY(io.canRead());
+ QCOMPARE(io.loopCount(), -1);
+ }
}
void tst_QImageReader::animatedGif()
@@ -731,6 +747,136 @@ void tst_QImageReader::animatedGif()
image = io.read();
}
}
+
+// http://bugreports.qt.nokia.com/browse/QTBUG-6696
+// Check the count of images in various call orders...
+void tst_QImageReader::gifImageCount()
+{
+ // just read every frame... and see how much we got..
+ {
+ QImageReader io(":images/four-frames.gif");
+
+ QVERIFY(io.canRead());
+ QImage blackFrame = io.read();
+
+ QVERIFY(io.canRead());
+ QImage whiteFrame = io.read();
+
+ QVERIFY(io.canRead());
+ QImage greenFrame = io.read();
+
+ QVERIFY(io.canRead());
+ QImage blueFrame = io.read();
+
+ QVERIFY(!io.canRead());
+ QImage emptyFrame = io.read();
+
+ QVERIFY(!io.canRead());
+ QCOMPARE(blackFrame.pixel(0,0), qRgb(0, 0, 0));
+ QCOMPARE(blackFrame.size(), QSize(64,64));
+
+ QCOMPARE(whiteFrame.pixel(0,0), qRgb(0xff, 0xff, 0xff));
+ QCOMPARE(whiteFrame.size(), QSize(64,64));
+
+ QCOMPARE(greenFrame.pixel(0,0), qRgb(0x0, 0xff, 0x0));
+ QCOMPARE(greenFrame.size(), QSize(64,64));
+
+ QCOMPARE(blueFrame.pixel(0,0), qRgb(0x0, 0x0, 0xff));
+ QCOMPARE(blueFrame.size(), QSize(64,64));
+ QVERIFY(emptyFrame.isNull());
+ }
+
+ // Read and get the size
+ {
+ QImageReader io(":images/four-frames.gif");
+
+ QVERIFY(io.canRead());
+ QCOMPARE(io.size(), QSize(64,64));
+
+ QVERIFY(io.canRead());
+ QCOMPARE(io.size(), QSize(64,64));
+ QCOMPARE(io.size(), QSize(64,64));
+ QVERIFY(io.canRead());
+ QImage blackFrame = io.read();
+
+ QVERIFY(io.canRead());
+ QCOMPARE(io.size(), QSize(64,64));
+ QCOMPARE(io.size(), QSize(64,64));
+ QVERIFY(io.canRead());
+ QImage whiteFrame = io.read();
+
+ QVERIFY(io.canRead());
+ QCOMPARE(io.size(), QSize(64,64));
+ QCOMPARE(io.size(), QSize(64,64));
+ QVERIFY(io.canRead());
+ QImage greenFrame = io.read();
+
+ QVERIFY(io.canRead());
+ QCOMPARE(io.size(), QSize(64,64));
+ QCOMPARE(io.size(), QSize(64,64));
+ QVERIFY(io.canRead());
+ QImage blueFrame = io.read();
+
+ QVERIFY(!io.canRead());
+ QCOMPARE(io.size(), QSize());
+ QCOMPARE(io.size(), QSize());
+ QVERIFY(!io.canRead());
+ QImage emptyFrame = io.read();
+
+ QVERIFY(!io.canRead());
+ QCOMPARE(blackFrame.pixel(0,0), qRgb(0, 0, 0));
+ QCOMPARE(blackFrame.size(), QSize(64,64));
+
+ QCOMPARE(whiteFrame.pixel(0,0), qRgb(0xff, 0xff, 0xff));
+ QCOMPARE(whiteFrame.size(), QSize(64,64));
+
+ QCOMPARE(greenFrame.pixel(0,0), qRgb(0x0, 0xff, 0x0));
+ QCOMPARE(greenFrame.size(), QSize(64,64));
+
+ QCOMPARE(blueFrame.pixel(0,0), qRgb(0x0, 0x0, 0xff));
+ QCOMPARE(blueFrame.size(), QSize(64,64));
+ QVERIFY(emptyFrame.isNull());
+ }
+
+ // Do a Size query as substitute for canRead
+ {
+ QImageReader io(":images/four-frames.gif");
+
+ QCOMPARE(io.size(), QSize(64,64));
+ QCOMPARE(io.size(), QSize(64,64));
+ QImage blackFrame = io.read();
+
+ QCOMPARE(io.size(), QSize(64,64));
+ QCOMPARE(io.size(), QSize(64,64));
+ QImage whiteFrame = io.read();
+
+ QCOMPARE(io.size(), QSize(64,64));
+ QCOMPARE(io.size(), QSize(64,64));
+ QImage greenFrame = io.read();
+
+ QCOMPARE(io.size(), QSize(64,64));
+ QCOMPARE(io.size(), QSize(64,64));
+ QImage blueFrame = io.read();
+
+ QCOMPARE(io.size(), QSize());
+ QVERIFY(!io.canRead());
+ QImage emptyFrame = io.read();
+
+ QVERIFY(!io.canRead());
+ QCOMPARE(blackFrame.pixel(0,0), qRgb(0, 0, 0));
+ QCOMPARE(blackFrame.size(), QSize(64,64));
+
+ QCOMPARE(whiteFrame.pixel(0,0), qRgb(0xff, 0xff, 0xff));
+ QCOMPARE(whiteFrame.size(), QSize(64,64));
+
+ QCOMPARE(greenFrame.pixel(0,0), qRgb(0x0, 0xff, 0x0));
+ QCOMPARE(greenFrame.size(), QSize(64,64));
+
+ QCOMPARE(blueFrame.pixel(0,0), qRgb(0x0, 0x0, 0xff));
+ QCOMPARE(blueFrame.size(), QSize(64,64));
+ QVERIFY(emptyFrame.isNull());
+ }
+}
#endif
class Server : public QObject
diff --git a/tests/auto/qlistwidget/tst_qlistwidget.cpp b/tests/auto/qlistwidget/tst_qlistwidget.cpp
index 863c308..e165190 100644
--- a/tests/auto/qlistwidget/tst_qlistwidget.cpp
+++ b/tests/auto/qlistwidget/tst_qlistwidget.cpp
@@ -862,12 +862,18 @@ void tst_QListWidget::moveItemsPriv_data()
QTest::newRow("Empty") << 0 << 0 << 0 << false;
QTest::newRow("Overflow src") << 5 << 5 << 2 << false;
QTest::newRow("Underflow src") << 5 << -1 << 2 << false;
- QTest::newRow("Overflow dst") << 5 << 2 << 5 << false;
+ QTest::newRow("Overflow dst") << 5 << 2 << 6 << false;
QTest::newRow("Underflow dst") << 5 << 2 << -1 << false;
QTest::newRow("Same place") << 5 << 2 << 2 << false;
QTest::newRow("Up") << 5 << 4 << 2 << true;
QTest::newRow("Down") << 5 << 2 << 4 << true;
QTest::newRow("QTBUG-6532 assert") << 5 << 0 << 1 << false;
+ QTest::newRow("QTBUG-6565 to the end") << 5 << 3 << 5 << true;
+ QTest::newRow("Same place 2") << 2 << 0 << 1 << false;
+ QTest::newRow("swap") << 2 << 0 << 2 << true;
+ QTest::newRow("swap2") << 4 << 1 << 3 << true;
+ QTest::newRow("swap3") << 4 << 3 << 2 << true;
+ QTest::newRow("swap4") << 2 << 1 << 0 << true;
}
void tst_QListWidget::moveItemsPriv()
diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp
index 67a9c46..75d7a0a 100644
--- a/tests/auto/qobject/tst_qobject.cpp
+++ b/tests/auto/qobject/tst_qobject.cpp
@@ -126,6 +126,7 @@ private slots:
void deleteQObjectWhenDeletingEvent();
void overloads();
void isSignalConnected();
+ void qMetaObjectConnect();
protected:
};
@@ -3058,10 +3059,8 @@ void tst_QObject::isSignalConnected()
QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig05()")));
QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig15()")));
QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig29()")));
- if (sizeof(void *) >= 8) { //on 32bit isSignalConnected only works with the first 32 signals
- QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig60()")));
- QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig61()")));
- }
+ QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig60()")));
+ QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig61()")));
#endif
QObject::connect(&o, SIGNAL(sig00()), &o, SIGNAL(sig69()));
@@ -3115,6 +3114,8 @@ void tst_QObject::isSignalConnected()
QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig04()")));
QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig21()")));
QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig25()")));
+ QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig55()")));
+ QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig61()")));
#endif
emit o.sig00();
@@ -3125,5 +3126,148 @@ void tst_QObject::isSignalConnected()
QCOMPARE(o.rec, 2);
}
+void tst_QObject::qMetaObjectConnect()
+{
+ SenderObject *s = new SenderObject;
+ ReceiverObject *r1 = new ReceiverObject;
+ ReceiverObject *r2 = new ReceiverObject;
+ r1->reset();
+ r2->reset();
+ ReceiverObject::sequence = 0;
+
+ int signal1Index = s->metaObject()->indexOfSignal("signal1()");
+ int signal3Index = s->metaObject()->indexOfSignal("signal3()");
+ int slot1Index = r1->metaObject()->indexOfSlot("slot1()");
+ int slot2Index = r1->metaObject()->indexOfSlot("slot2()");
+ int slot3Index = r1->metaObject()->indexOfSlot("slot3()");
+
+ QVERIFY(slot1Index > 0);
+ QVERIFY(slot2Index > 0);
+ QVERIFY(slot3Index > 0);
+
+ QVERIFY( QMetaObject::connect( s, signal1Index, r1, slot1Index) );
+ QVERIFY( QMetaObject::connect( s, signal3Index, r2, slot3Index) );
+ QVERIFY( QMetaObject::connect( s, -1, r2, slot2Index) );
+
+ QCOMPARE( r1->count_slot1, 0 );
+ QCOMPARE( r1->count_slot2, 0 );
+ QCOMPARE( r1->count_slot3, 0 );
+ QCOMPARE( r2->count_slot1, 0 );
+ QCOMPARE( r2->count_slot2, 0 );
+ QCOMPARE( r2->count_slot3, 0 );
+
+ s->emitSignal1();
+
+ QCOMPARE( r1->count_slot1, 1 );
+ QCOMPARE( r1->count_slot2, 0 );
+ QCOMPARE( r1->count_slot3, 0 );
+ QCOMPARE( r2->count_slot1, 0 );
+ QCOMPARE( r2->count_slot2, 1 );
+ QCOMPARE( r2->count_slot3, 0 );
+
+ s->emitSignal2();
+ s->emitSignal3();
+ s->emitSignal4();
+
+ QCOMPARE( r1->count_slot1, 1 );
+ QCOMPARE( r1->count_slot2, 0 );
+ QCOMPARE( r1->count_slot3, 0 );
+ QCOMPARE( r2->count_slot1, 0 );
+ QCOMPARE( r2->count_slot2, 4 );
+ QCOMPARE( r2->count_slot3, 1 );
+
+ QVERIFY( QMetaObject::disconnect( s, signal1Index, r1, slot1Index) );
+ QVERIFY( QMetaObject::disconnect( s, signal3Index, r2, slot3Index) );
+ QVERIFY( QMetaObject::disconnect( s, -1, r2, slot2Index) );
+
+ s->emitSignal1();
+ s->emitSignal2();
+ s->emitSignal3();
+ s->emitSignal4();
+
+ QCOMPARE( r1->count_slot1, 1 );
+ QCOMPARE( r1->count_slot2, 0 );
+ QCOMPARE( r1->count_slot3, 0 );
+ QCOMPARE( r2->count_slot1, 0 );
+ QCOMPARE( r2->count_slot2, 4 );
+ QCOMPARE( r2->count_slot3, 1 );
+
+ //some "dynamic" signal
+ QVERIFY( QMetaObject::connect( s, s->metaObject()->methodOffset() + 20, r1, slot3Index) );
+ QVERIFY( QMetaObject::connect( s, s->metaObject()->methodOffset() + 35, r2, slot1Index) );
+ QVERIFY( QMetaObject::connect( s, -1, r1, slot2Index) );
+
+ r1->reset();
+ r2->reset();
+
+ void *args[] = { 0 , 0 };
+ QMetaObject::activate(s, s->metaObject()->methodOffset() + 20, args);
+ QMetaObject::activate(s, s->metaObject()->methodOffset() + 48, args);
+ QCOMPARE( r1->count_slot1, 0 );
+ QCOMPARE( r1->count_slot2, 2 );
+ QCOMPARE( r1->count_slot3, 1 );
+ QCOMPARE( r2->count_slot1, 0 );
+ QCOMPARE( r2->count_slot2, 0 );
+ QCOMPARE( r2->count_slot3, 0 );
+
+ QMetaObject::activate(s, s->metaObject()->methodOffset() + 35, args);
+ s->emitSignal1();
+ s->emitSignal2();
+
+ QCOMPARE( r1->count_slot1, 0 );
+ QCOMPARE( r1->count_slot2, 5 );
+ QCOMPARE( r1->count_slot3, 1 );
+ QCOMPARE( r2->count_slot1, 1 );
+ QCOMPARE( r2->count_slot2, 0 );
+ QCOMPARE( r2->count_slot3, 0 );
+
+ delete s;
+ r1->reset();
+ r2->reset();
+
+#define SIGNAL_INDEX(S) obj1.metaObject()->indexOfSignal(QMetaObject::normalizedSignature(#S))
+ OverloadObject obj1;
+ QObject obj2, obj3;
+
+ QMetaObject::connect(&obj1, SIGNAL_INDEX(sig(int)) , r1, slot1Index);
+ QMetaObject::connect(&obj1, SIGNAL_INDEX(sig(QObject *, QObject *, QObject *)) , r2, slot1Index);
+
+ QMetaObject::connect(&obj1, SIGNAL_INDEX(sig(QObject *, QObject *, QObject *, QObject *)) , r1, slot2Index);
+ QMetaObject::connect(&obj1, SIGNAL_INDEX(sig(QObject *)) , r2, slot2Index);
+ QMetaObject::connect(&obj1, SIGNAL_INDEX(sig(int, int)) , r1, slot3Index);
+
+ emit obj1.sig(0.5); //connected to nothing
+ emit obj1.sig(1, 'a'); //connected to nothing
+ QCOMPARE( r1->count_slot1, 0 );
+ QCOMPARE( r1->count_slot2, 0 );
+ QCOMPARE( r1->count_slot3, 0 );
+ QCOMPARE( r2->count_slot1, 0 );
+ QCOMPARE( r2->count_slot2, 0 );
+ QCOMPARE( r2->count_slot3, 0 );
+
+ emit obj1.sig(1); //this signal is connected
+ emit obj1.sig(&obj2);
+
+ QCOMPARE( r1->count_slot1, 1 );
+ QCOMPARE( r1->count_slot2, 0 );
+ QCOMPARE( r1->count_slot3, 1 );
+ QCOMPARE( r2->count_slot1, 0 );
+ QCOMPARE( r2->count_slot2, 1 );
+ QCOMPARE( r2->count_slot3, 0 );
+
+ emit obj1.sig(&obj2, &obj3); //this signal is connected
+
+ QCOMPARE( r1->count_slot1, 1 );
+ QCOMPARE( r1->count_slot2, 1 );
+ QCOMPARE( r1->count_slot3, 1 );
+ QCOMPARE( r2->count_slot1, 1 );
+ QCOMPARE( r2->count_slot2, 1 );
+ QCOMPARE( r2->count_slot3, 0 );
+
+ delete r1;
+ delete r2;
+
+}
+
QTEST_MAIN(tst_QObject)
#include "tst_qobject.moc"
diff --git a/tests/auto/qpauseanimation/tst_qpauseanimation.cpp b/tests/auto/qpauseanimation/tst_qpauseanimation.cpp
index 4d0a7a7..a421228 100644
--- a/tests/auto/qpauseanimation/tst_qpauseanimation.cpp
+++ b/tests/auto/qpauseanimation/tst_qpauseanimation.cpp
@@ -99,7 +99,7 @@ private slots:
void changeDirectionWhileRunning();
void noTimerUpdates_data();
void noTimerUpdates();
- void mulitplePauseAnimations();
+ void multiplePauseAnimations();
void pauseAndPropertyAnimations();
void pauseResume();
void sequentialPauseGroup();
@@ -169,7 +169,7 @@ void tst_QPauseAnimation::noTimerUpdates()
QCOMPARE(animation.m_updateCurrentTimeCount, 1 + loopCount);
}
-void tst_QPauseAnimation::mulitplePauseAnimations()
+void tst_QPauseAnimation::multiplePauseAnimations()
{
EnableConsistentTiming enabled;
diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp
index 0effd01..0164c9d 100644
--- a/tests/auto/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/qpixmap/tst_qpixmap.cpp
@@ -1289,6 +1289,12 @@ void tst_QPixmap::copy()
QPixmap expected(10, 10);
expected.fill(Qt::blue);
QVERIFY(lenientCompare(dest, expected));
+
+ QPixmap trans;
+ trans.fill(Qt::transparent);
+
+ QPixmap transCopy = trans.copy();
+ QVERIFY(pixmapsAreEqual(&trans, &transCopy));
}
#ifdef QT3_SUPPORT
diff --git a/tests/auto/qpixmapcache/tst_qpixmapcache.cpp b/tests/auto/qpixmapcache/tst_qpixmapcache.cpp
index 9775d36..c89a182 100644
--- a/tests/auto/qpixmapcache/tst_qpixmapcache.cpp
+++ b/tests/auto/qpixmapcache/tst_qpixmapcache.cpp
@@ -70,6 +70,7 @@ private slots:
void remove();
void clear();
void pixmapKey();
+ void noLeak();
};
static QPixmapCache::KeyData* getPrivate(QPixmapCache::Key &key)
@@ -482,5 +483,23 @@ void tst_QPixmapCache::pixmapKey()
QVERIFY(!getPrivate(key8));
}
+extern int q_QPixmapCache_keyHashSize();
+
+void tst_QPixmapCache::noLeak()
+{
+ QPixmapCache::Key key;
+
+ int oldSize = q_QPixmapCache_keyHashSize();
+ for (int i = 0; i < 100; ++i) {
+ QPixmap pm(128, 128);
+ pm.fill(Qt::transparent);
+ key = QPixmapCache::insert(pm);
+ QPixmapCache::remove(key);
+ }
+ int newSize = q_QPixmapCache_keyHashSize();
+
+ QCOMPARE(oldSize, newSize);
+}
+
QTEST_MAIN(tst_QPixmapCache)
#include "tst_qpixmapcache.moc"
diff --git a/tests/auto/qresourceengine/tst_qresourceengine.cpp b/tests/auto/qresourceengine/tst_qresourceengine.cpp
index cc6eda3..ed7de23 100644
--- a/tests/auto/qresourceengine/tst_qresourceengine.cpp
+++ b/tests/auto/qresourceengine/tst_qresourceengine.cpp
@@ -62,6 +62,7 @@ private slots:
void searchPath_data();
void searchPath();
void doubleSlashInRoot();
+ void setLocale();
private:
QString builddir;
@@ -460,6 +461,27 @@ void tst_QResourceEngine::doubleSlashInRoot()
QVERIFY(QFile::exists("://secondary_root/runtime_resource/search_file.txt"));
}
+void tst_QResourceEngine::setLocale()
+{
+ QLocale::setDefault(QLocale::c());
+
+ // default constructed QResource gets the default locale
+ QResource resource;
+ resource.setFileName("aliasdir/aliasdir.txt");
+ QVERIFY(!resource.isCompressed());
+
+ // change the default locale and make sure it doesn't affect the resource
+ QLocale::setDefault(QLocale("de_CH"));
+ QVERIFY(!resource.isCompressed());
+
+ // then explicitly set the locale on qresource
+ resource.setLocale(QLocale("de_CH"));
+ QVERIFY(resource.isCompressed());
+
+ // the reset the default locale back
+ QLocale::setDefault(QLocale::system());
+}
+
QTEST_MAIN(tst_QResourceEngine)
#include "tst_qresourceengine.moc"
diff --git a/tests/auto/qscriptable/tst_qscriptable.cpp b/tests/auto/qscriptable/tst_qscriptable.cpp
index c0945d8..7ed0a8a 100644
--- a/tests/auto/qscriptable/tst_qscriptable.cpp
+++ b/tests/auto/qscriptable/tst_qscriptable.cpp
@@ -332,7 +332,6 @@ void tst_QScriptable::thisObject()
{
QVERIFY(!m_scriptable.oofThisObject().isValid());
m_engine.evaluate("o.oof = 123");
- QEXPECT_FAIL("", "QTBUG-5749: Setter doesn't get called when it's in the prototype", Continue);
QVERIFY(m_scriptable.oofThisObject().strictlyEquals(m_engine.evaluate("o")));
}
{
diff --git a/tests/auto/qsharedmemory/tst_qsharedmemory.cpp b/tests/auto/qsharedmemory/tst_qsharedmemory.cpp
index f72b6f7..4148594 100644
--- a/tests/auto/qsharedmemory/tst_qsharedmemory.cpp
+++ b/tests/auto/qsharedmemory/tst_qsharedmemory.cpp
@@ -756,12 +756,12 @@ void tst_QSharedMemory::simpleProcessProducerConsumer()
++failedProcesses;
}
- producer.waitForFinished(5000);
+ QVERIFY(producer.waitForFinished(5000));
bool consumerFailed = false;
while (!consumers.isEmpty()) {
- consumers.first()->waitForFinished(2000);
+ QVERIFY(consumers.first()->waitForFinished(3000));
if (consumers.first()->state() == QProcess::Running ||
consumers.first()->exitStatus() != QProcess::NormalExit ||
consumers.first()->exitCode() != 0) {
diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
index cb4e103..1d39c67 100644
--- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
+++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
@@ -768,9 +768,7 @@ void tst_QSqlDatabase::checkValues(const FieldDef fieldDefs[], QSqlDatabase db)
rec->setValue(fieldDefs[ i ].fieldName(), fieldDefs[ i ].val);
// qDebug(QString("inserting %1 into %2").arg(fieldDefs[ i ].val.toString()).arg(fieldDefs[ i ].fieldName()));
}
- if (!cur.insert()) {
- QFAIL(QString("Couldn't insert record: %1 %2").arg(cur.lastError().databaseText()).arg(cur.lastError().driverText()));
- }
+ QVERIFY_SQL(cur, insert());
cur.setForwardOnly(true);
QVERIFY_SQL(cur, select("id = " + QString::number(pkey - 1)));
QVERIFY_SQL(cur, next());
@@ -833,9 +831,7 @@ void tst_QSqlDatabase::checkNullValues(const FieldDef fieldDefs[], QSqlDatabase
else
rec->setValue(fieldDefs[ i ].fieldName(), fieldDefs[ i ].val);
}
- if (!cur.insert()) {
- QFAIL(QString("Couldn't insert record: %1 %2").arg(cur.lastError().databaseText()).arg(cur.lastError().driverText()));
- }
+ QVERIFY_SQL(cur, insert());
cur.setForwardOnly(true);
QVERIFY_SQL(cur, select("id = " + QString::number(pkey - 1)));
QVERIFY_SQL(cur, next());
@@ -907,12 +903,8 @@ void tst_QSqlDatabase::recordOCI()
CHECK_DATABASE(db);
// runtime check for Oracle version since V8 doesn't support TIMESTAMPs
- if (tst_Databases::getOraVersion(db) >= 9) {
- qDebug("Detected Oracle >= 9, TIMESTAMP test enabled");
- hasTimeStamp = true;
- } else {
- qDebug("Detected Oracle < 9, TIMESTAMP test disabled");
- }
+ if (tst_Databases::getOraVersion(db) >= 9)
+ hasTimeStamp = true;
FieldDef tsdef;
FieldDef tstzdef;
@@ -923,11 +915,11 @@ void tst_QSqlDatabase::recordOCI()
static const QDateTime dt(QDate::currentDate(), QTime(1, 2, 3, 0));
if (hasTimeStamp) {
- tsdef = FieldDef("timestamp", QVariant::DateTime, dt);
- tstzdef = FieldDef("timestamp with time zone", QVariant::DateTime, dt);
- tsltzdef = FieldDef("timestamp with local time zone", QVariant::DateTime, dt);
- intytm = FieldDef("interval year to month", QVariant::String, QString("+01-01"));
- intdts = FieldDef("interval day to second", QVariant::String, QString("+01 00:00:01.000000"));
+ tsdef = FieldDef("timestamp", QVariant::DateTime, dt);
+ tstzdef = FieldDef("timestamp with time zone", QVariant::DateTime, dt);
+ tsltzdef = FieldDef("timestamp with local time zone", QVariant::DateTime, dt);
+ intytm = FieldDef("interval year to month", QVariant::String, QString("+01-01"));
+ intdts = FieldDef("interval day to second", QVariant::String, QString("+01 00:00:01.000000"));
}
const FieldDef fieldDefs[] = {
@@ -937,21 +929,19 @@ void tst_QSqlDatabase::recordOCI()
FieldDef("nvarchar2(20)", QVariant::String, QString("blah4")),
FieldDef("number(10,5)", QVariant::Double, 1.1234567),
FieldDef("date", QVariant::DateTime, dt),
-#ifdef QT3_SUPPORT
-//X? FieldDef("long raw", QVariant::ByteArray, QByteArray(Q3CString("blah5"))),
- FieldDef("raw(2000)", QVariant::ByteArray, QByteArray(Q3CString("blah6")), false),
- FieldDef("blob", QVariant::ByteArray, QByteArray(Q3CString("blah7"))),
-#endif
-//FIXME FieldDef("clob", QVariant::CString, Q3CString("blah8")),
-//FIXME FieldDef("nclob", QVariant::CString, Q3CString("blah9")),
-//X FieldDef("bfile", QVariant::ByteArray, QByteArray(Q3CString("blah10"))),
-
- intytm,
- intdts,
- tsdef,
- tstzdef,
- tsltzdef,
- FieldDef()
+ FieldDef("long raw", QVariant::ByteArray, QByteArray("blah5")),
+ FieldDef("raw(2000)", QVariant::ByteArray, QByteArray("blah6"), false),
+ FieldDef("blob", QVariant::ByteArray, QByteArray("blah7")),
+ FieldDef("clob", QVariant::String, QString("blah8")),
+ FieldDef("nclob", QVariant::String, QString("blah9")),
+// FieldDef("bfile", QVariant::ByteArray, QByteArray("blah10")),
+
+ intytm,
+ intdts,
+ tsdef,
+ tstzdef,
+ tsltzdef,
+ FieldDef()
};
const int fieldCount = createFieldTable(fieldDefs, db);
@@ -959,9 +949,8 @@ void tst_QSqlDatabase::recordOCI()
commonFieldTest(fieldDefs, db, fieldCount);
checkNullValues(fieldDefs, db);
- for (int i = 0; i < ITERATION_COUNT; ++i) {
- checkValues(fieldDefs, db);
- }
+ for (int i = 0; i < ITERATION_COUNT; ++i)
+ checkValues(fieldDefs, db);
// some additional tests
QSqlRecord rec = db.record(qTableName("qtestfields"));
diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp
index a8908fd..5b6da30 100644
--- a/tests/auto/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp
@@ -201,6 +201,10 @@ private slots:
void QTBUG_5251();
void QTBUG_6421_data() { generic_data("QOCI"); }
void QTBUG_6421();
+ void QTBUG_6618_data() { generic_data("QODBC"); }
+ void QTBUG_6618();
+ void QTBUG_6852_data() { generic_data("QMYSQL"); }
+ void QTBUG_6852();
private:
// returns all database connections
@@ -2961,5 +2965,63 @@ void tst_QSqlQuery::QTBUG_6421()
QCOMPARE(q.value(0).toString(), QLatin1String("\"COL3\""));
}
+void tst_QSqlQuery::QTBUG_6618()
+{
+ QFETCH( QString, dbName );
+ QSqlDatabase db = QSqlDatabase::database( dbName );
+ CHECK_DATABASE( db );
+ if (!tst_Databases::isSqlServer( db ))
+ QSKIP("SQL Server specific test", SkipSingle);
+
+ QSqlQuery q(db);
+ q.exec( "drop procedure " + qTableName( "tst_raiseError" ) ); //non-fatal
+ QString errorString;
+ for (int i=0;i<110;i++)
+ errorString+="reallylong";
+ errorString+=" error";
+ QVERIFY_SQL( q, exec("create procedure " + qTableName( "tst_raiseError" ) + " as\n"
+ "begin\n"
+ " raiserror('" + errorString + "', 16, 1)\n"
+ "end\n" ));
+ q.exec( "{call " + qTableName( "tst_raiseError" ) + "}" );
+ QVERIFY(q.lastError().text().contains(errorString));
+}
+
+void tst_QSqlQuery::QTBUG_6852()
+{
+ QFETCH( QString, dbName );
+ QSqlDatabase db = QSqlDatabase::database( dbName );
+ CHECK_DATABASE( db );
+ if ( tst_Databases::getMySqlVersion( db ).section( QChar('.'), 0, 0 ).toInt()<5 )
+ QSKIP( "Test requires MySQL >= 5.0", SkipSingle );
+
+ QSqlQuery q(db);
+ QString tableName(qTableName(QLatin1String("bug6421"))), procName(qTableName(QLatin1String("bug6421_proc")));
+
+ QVERIFY_SQL(q, exec("DROP PROCEDURE IF EXISTS "+procName));
+ tst_Databases::safeDropTable(db, tableName);
+ QVERIFY_SQL(q, exec("CREATE TABLE "+tableName+"(\n"
+ "MainKey INT NOT NULL,\n"
+ "OtherTextCol VARCHAR(45) NOT NULL,\n"
+ "PRIMARY KEY(`MainKey`))"));
+ QVERIFY_SQL(q, exec("INSERT INTO "+tableName+" VALUES(0, \"Disabled\")"));
+ QVERIFY_SQL(q, exec("INSERT INTO "+tableName+" VALUES(5, \"Error Only\")"));
+ QVERIFY_SQL(q, exec("INSERT INTO "+tableName+" VALUES(10, \"Enabled\")"));
+ QVERIFY_SQL(q, exec("INSERT INTO "+tableName+" VALUES(15, \"Always\")"));
+ QVERIFY_SQL(q, exec("CREATE PROCEDURE "+procName+"()\n"
+ "READS SQL DATA\n"
+ "BEGIN\n"
+ " SET @st = 'SELECT MainKey, OtherTextCol from "+tableName+"';\n"
+ " PREPARE stmt from @st;\n"
+ " EXECUTE stmt;\n"
+ "END;"));
+
+ QVERIFY_SQL(q, exec("CALL "+procName+"()"));
+ QVERIFY_SQL(q, next());
+ QCOMPARE(q.value(0).toInt(), 0);
+ QCOMPARE(q.value(1).toString(), QLatin1String("Disabled"));
+}
+
+
QTEST_MAIN( tst_QSqlQuery )
#include "tst_qsqlquery.moc"
diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp
index 169a688..09c8c5f 100644
--- a/tests/auto/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp
@@ -51,13 +51,8 @@
#include <QtNetwork/qtcpserver.h>
#include <QtTest/QtTest>
-#ifndef TEST_QNETWORK_PROXY
-#define TEST_QNETWORK_PROXY
-#endif
-#ifdef TEST_QNETWORK_PROXY
#include <QNetworkProxy>
#include <QAuthenticator>
-#endif
#include "../network-settings.h"
@@ -253,7 +248,6 @@ void tst_QSslSocket::initTestCase_data()
QTest::addColumn<int>("proxyType");
QTest::newRow("WithoutProxy") << false << 0;
-#ifdef TEST_QNETWORK_PROXY
QTest::newRow("WithSocks5Proxy") << true << int(Socks5Proxy);
QTest::newRow("WithSocks5ProxyAuth") << true << int(Socks5Proxy | AuthBasic);
@@ -261,14 +255,12 @@ void tst_QSslSocket::initTestCase_data()
QTest::newRow("WithHttpProxyBasicAuth") << true << int(HttpProxy | AuthBasic);
// uncomment the line below when NTLM works
// QTest::newRow("WithHttpProxyNtlmAuth") << true << int(HttpProxy | AuthNtlm);
-#endif
}
void tst_QSslSocket::init()
{
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
QString fluke = QHostInfo::fromName(QtNetworkSettings::serverName()).addresses().first().toString();
QNetworkProxy proxy;
@@ -295,15 +287,12 @@ void tst_QSslSocket::init()
break;
}
QNetworkProxy::setApplicationProxy(proxy);
-#endif
}
}
void tst_QSslSocket::cleanup()
{
-#ifdef TEST_QNETWORK_PROXY
QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy);
-#endif
}
#ifndef QT_NO_OPENSSL
diff --git a/tests/auto/qtcpserver/test/test.pro b/tests/auto/qtcpserver/test/test.pro
index bdeaa92..123c79e 100644
--- a/tests/auto/qtcpserver/test/test.pro
+++ b/tests/auto/qtcpserver/test/test.pro
@@ -32,7 +32,5 @@ QT = core network
MOC_DIR=tmp
-DEFINES += TEST_QNETWORK_PROXY
-
diff --git a/tests/auto/qtcpserver/tst_qtcpserver.cpp b/tests/auto/qtcpserver/tst_qtcpserver.cpp
index 8b86111..4567435 100644
--- a/tests/auto/qtcpserver/tst_qtcpserver.cpp
+++ b/tests/auto/qtcpserver/tst_qtcpserver.cpp
@@ -66,11 +66,9 @@
#include <qplatformdefs.h>
#include <qhostinfo.h>
-#ifdef TEST_QNETWORK_PROXY
-# include <QNetworkProxy>
+#include <QNetworkProxy>
Q_DECLARE_METATYPE(QNetworkProxy)
Q_DECLARE_METATYPE(QList<QNetworkProxy>)
-#endif
#include "../network-settings.h"
@@ -95,9 +93,6 @@ private slots:
void constructing();
void clientServerLoop();
void ipv6Server();
- void ipv4LoopbackPerformanceTest();
- void ipv6LoopbackPerformanceTest();
- void ipv4PerformanceTest();
void crashTests();
void maxPendingConnections();
void listenError();
@@ -106,12 +101,10 @@ private slots:
void listenWhileListening();
void addressReusable();
void setNewSocketDescriptorBlocking();
-#ifdef TEST_QNETWORK_PROXY
void invalidProxy_data();
void invalidProxy();
void proxyFactory_data();
void proxyFactory();
-#endif
};
// Testing get/set functions
@@ -143,29 +136,23 @@ void tst_QTcpServer::initTestCase_data()
QTest::addColumn<int>("proxyType");
QTest::newRow("WithoutProxy") << false << 0;
-#ifdef TEST_QNETWORK_PROXY
QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy);
-#endif
}
void tst_QTcpServer::init()
{
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
if (proxyType == QNetworkProxy::Socks5Proxy) {
QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080));
}
-#endif
}
}
void tst_QTcpServer::cleanup()
{
-#ifdef TEST_QNETWORK_PROXY
QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy);
-#endif
}
//----------------------------------------------------------------------------------
@@ -258,159 +245,6 @@ void tst_QTcpServer::ipv6Server()
}
//----------------------------------------------------------------------------------
-void tst_QTcpServer::ipv4LoopbackPerformanceTest()
-{
- QFETCH_GLOBAL(bool, setProxy);
- if (setProxy)
- return;
-
- QTcpServer server;
- QVERIFY(server.listen(QHostAddress::LocalHost));
-
- QVERIFY(server.isListening());
-
- QTcpSocket clientA;
- clientA.connectToHost(QHostAddress::LocalHost, server.serverPort());
- QVERIFY(clientA.waitForConnected(5000));
- QVERIFY(clientA.state() == QAbstractSocket::ConnectedState);
-
- QVERIFY(server.waitForNewConnection());
- QTcpSocket *clientB = server.nextPendingConnection();
- QVERIFY(clientB);
-
- QByteArray buffer(16384, '@');
- QTime stopWatch;
- stopWatch.start();
- qlonglong totalWritten = 0;
- while (stopWatch.elapsed() < 5000) {
- QVERIFY(clientA.write(buffer.data(), buffer.size()) > 0);
- clientA.flush();
- totalWritten += buffer.size();
- while (clientB->waitForReadyRead(100)) {
- if (clientB->bytesAvailable() == 16384)
- break;
- }
- clientB->read(buffer.data(), buffer.size());
- clientB->write(buffer.data(), buffer.size());
- clientB->flush();
- totalWritten += buffer.size();
- while (clientA.waitForReadyRead(100)) {
- if (clientA.bytesAvailable() == 16384)
- break;
- }
- clientA.read(buffer.data(), buffer.size());
- }
-
- qDebug("\t\t%s: %.1fMB/%.1fs: %.1fMB/s",
- server.serverAddress().toString().toLatin1().constData(),
- totalWritten / (1024.0 * 1024.0),
- stopWatch.elapsed() / 1000.0,
- (totalWritten / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024));
-
- delete clientB;
-}
-
-//----------------------------------------------------------------------------------
-void tst_QTcpServer::ipv6LoopbackPerformanceTest()
-{
-#if defined(Q_OS_SYMBIAN)
- QSKIP("Symbian: IPv6 is not yet supported", SkipAll);
-#endif
- QTcpServer server;
- if (!server.listen(QHostAddress::LocalHostIPv6, 0)) {
- QVERIFY(server.serverError() == QAbstractSocket::UnsupportedSocketOperationError);
- } else {
- QTcpSocket clientA;
- clientA.connectToHost(server.serverAddress(), server.serverPort());
- QVERIFY(clientA.waitForConnected(5000));
-
- QVERIFY(server.waitForNewConnection(5000));
- QTcpSocket *clientB = server.nextPendingConnection();
- QVERIFY(clientB);
-
- QByteArray buffer(16384, '@');
- QTime stopWatch;
- stopWatch.start();
- qlonglong totalWritten = 0;
- while (stopWatch.elapsed() < 5000) {
- clientA.write(buffer.data(), buffer.size());
- clientA.flush();
- totalWritten += buffer.size();
- while (clientB->waitForReadyRead(100)) {
- if (clientB->bytesAvailable() == 16384)
- break;
- }
- clientB->read(buffer.data(), buffer.size());
- clientB->write(buffer.data(), buffer.size());
- clientB->flush();
- totalWritten += buffer.size();
- while (clientA.waitForReadyRead(100)) {
- if (clientA.bytesAvailable() == 16384)
- break;
- }
- clientA.read(buffer.data(), buffer.size());
- }
-
- qDebug("\t\t%s: %.1fMB/%.1fs: %.1fMB/s",
- server.serverAddress().toString().toLatin1().constData(),
- totalWritten / (1024.0 * 1024.0),
- stopWatch.elapsed() / 1000.0,
- (totalWritten / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024));
- delete clientB;
- }
-}
-
-//----------------------------------------------------------------------------------
-void tst_QTcpServer::ipv4PerformanceTest()
-{
- QTcpSocket probeSocket;
- probeSocket.connectToHost(QtNetworkSettings::serverName(), 143);
- QVERIFY(probeSocket.waitForConnected(5000));
-
- QTcpServer server;
- QVERIFY(server.listen(probeSocket.localAddress(), 0));
-
- QTcpSocket clientA;
- clientA.connectToHost(server.serverAddress(), server.serverPort());
- QVERIFY(clientA.waitForConnected(5000));
-
- QVERIFY(server.waitForNewConnection(5000));
- QTcpSocket *clientB = server.nextPendingConnection();
- QVERIFY(clientB);
-
- QByteArray buffer(16384, '@');
- QTime stopWatch;
- stopWatch.start();
- qlonglong totalWritten = 0;
- while (stopWatch.elapsed() < 5000) {
- qlonglong writtenA = clientA.write(buffer.data(), buffer.size());
- clientA.flush();
- totalWritten += buffer.size();
- while (clientB->waitForReadyRead(100)) {
- if (clientB->bytesAvailable() == writtenA)
- break;
- }
- clientB->read(buffer.data(), buffer.size());
- qlonglong writtenB = clientB->write(buffer.data(), buffer.size());
- clientB->flush();
- totalWritten += buffer.size();
- while (clientA.waitForReadyRead(100)) {
- if (clientA.bytesAvailable() == writtenB)
- break;
- }
- clientA.read(buffer.data(), buffer.size());
- }
-
- qDebug("\t\t%s: %.1fMB/%.1fs: %.1fMB/s",
- probeSocket.localAddress().toString().toLatin1().constData(),
- totalWritten / (1024.0 * 1024.0),
- stopWatch.elapsed() / 1000.0,
- (totalWritten / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024));
-
- delete clientB;
-}
-
-//----------------------------------------------------------------------------------
void tst_QTcpServer::crashTests()
{
QTcpServer server;
@@ -423,12 +257,10 @@ void tst_QTcpServer::maxPendingConnections()
{
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
if (proxyType == QNetworkProxy::Socks5Proxy) {
QSKIP("With socks5 only 1 connection is allowed ever", SkipAll);
}
-#endif
}
//### sees to fail sometimes ... a timing issue with the test on windows
QTcpServer server;
@@ -464,12 +296,10 @@ void tst_QTcpServer::listenError()
{
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
if (proxyType == QNetworkProxy::Socks5Proxy) {
QSKIP("With socks5 we can not make hard requirements on the address or port", SkipAll);
}
-#endif
}
QTcpServer server;
QVERIFY(!server.listen(QHostAddress("1.2.3.4"), 0));
@@ -513,12 +343,10 @@ void tst_QTcpServer::waitForConnectionTest()
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
if (proxyType == QNetworkProxy::Socks5Proxy) {
QSKIP("Localhost servers don't work well with SOCKS5", SkipAll);
}
-#endif
}
QTcpSocket findLocalIpSocket;
@@ -624,12 +452,10 @@ void tst_QTcpServer::addressReusable()
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
if (proxyType == QNetworkProxy::Socks5Proxy) {
QSKIP("With socks5 this test does not make senans at the momment", SkipAll);
}
-#endif
}
#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
QString signalName = QString::fromLatin1("/test_signal.txt");
@@ -667,12 +493,10 @@ void tst_QTcpServer::setNewSocketDescriptorBlocking()
{
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
if (proxyType == QNetworkProxy::Socks5Proxy) {
QSKIP("With socks5 we can not make the socket descripter blocking", SkipAll);
}
-#endif
}
SeverWithBlockingSockets server;
QVERIFY(server.listen());
@@ -683,7 +507,6 @@ void tst_QTcpServer::setNewSocketDescriptorBlocking()
QVERIFY(server.ok);
}
-#ifdef TEST_QNETWORK_PROXY
void tst_QTcpServer::invalidProxy_data()
{
QTest::addColumn<int>("type");
@@ -838,7 +661,6 @@ void tst_QTcpServer::proxyFactory()
// Sometimes, error codes change for the better
QTEST(int(server.serverError()), "expectedError");
}
-#endif
QTEST_MAIN(tst_QTcpServer)
#include "tst_qtcpserver.moc"
diff --git a/tests/auto/qtcpsocket/test/test.pro b/tests/auto/qtcpsocket/test/test.pro
index 0f93def..c4369df 100644
--- a/tests/auto/qtcpsocket/test/test.pro
+++ b/tests/auto/qtcpsocket/test/test.pro
@@ -13,8 +13,6 @@ vxworks:QT -= gui
symbian: TARGET.EPOCHEAPSIZE="0x100 0x1000000"
-#DEFINES += TEST_QNETWORK_PROXY
-
TARGET = tst_qtcpsocket
win32 {
diff --git a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
index 863b8f5..c6d39ba 100644
--- a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
+++ b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
@@ -82,9 +82,6 @@
#include <QTime>
#include <QTimer>
#include <QDebug>
-#ifndef TEST_QNETWORK_PROXY
-#define TEST_QNETWORK_PROXY
-#endif
// RVCT compiles also unused inline methods
# include <QNetworkProxy>
@@ -194,12 +191,11 @@ private slots:
void increaseReadBufferSize();
void taskQtBug5799ConnectionErrorWaitForConnected();
void taskQtBug5799ConnectionErrorEventLoop();
-#ifdef TEST_QNETWORK_PROXY
+
void invalidProxy_data();
void invalidProxy();
void proxyFactory_data();
void proxyFactory();
-#endif
protected slots:
void nonBlockingIMAP_hostFound();
@@ -270,17 +266,15 @@ void tst_QTcpSocket::initTestCase_data()
qDebug() << QtNetworkSettings::serverName();
QTest::newRow("WithoutProxy") << false << 0 << false;
-#ifdef TEST_QNETWORK_PROXY
QTest::newRow("WithSocks5Proxy") << true << int(Socks5Proxy) << false;
QTest::newRow("WithSocks5ProxyAuth") << true << int(Socks5Proxy | AuthBasic) << false;
QTest::newRow("WithHttpProxy") << true << int(HttpProxy) << false;
QTest::newRow("WithHttpProxyBasicAuth") << true << int(HttpProxy | AuthBasic) << false;
// QTest::newRow("WithHttpProxyNtlmAuth") << true << int(HttpProxy | AuthNtlm) << false;
-#endif
+
#ifndef QT_NO_OPENSSL
QTest::newRow("WithoutProxy SSL") << false << 0 << true;
-#ifdef TEST_QNETWORK_PROXY
QTest::newRow("WithSocks5Proxy SSL") << true << int(Socks5Proxy) << true;
QTest::newRow("WithSocks5AuthProxy SSL") << true << int(Socks5Proxy | AuthBasic) << true;
@@ -288,14 +282,12 @@ void tst_QTcpSocket::initTestCase_data()
QTest::newRow("WithHttpProxyBasicAuth SSL") << true << int(HttpProxy | AuthBasic) << true;
// QTest::newRow("WithHttpProxyNtlmAuth SSL") << true << int(HttpProxy | AuthNtlm) << true;
#endif
-#endif
}
void tst_QTcpSocket::init()
{
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
QString fluke = QHostInfo::fromName(QtNetworkSettings::serverName()).addresses().first().toString();
QNetworkProxy proxy;
@@ -322,7 +314,6 @@ void tst_QTcpSocket::init()
break;
}
QNetworkProxy::setApplicationProxy(proxy);
-#endif
}
}
@@ -345,9 +336,7 @@ QTcpSocket *tst_QTcpSocket::newSocket() const
void tst_QTcpSocket::cleanup()
{
-#ifdef TEST_QNETWORK_PROXY
QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy);
-#endif
}
void tst_QTcpSocket::proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *auth)
@@ -1322,9 +1311,7 @@ void tst_QTcpSocket::synchronousApi()
void tst_QTcpSocket::dontCloseOnTimeout()
{
QTcpServer server;
-#ifdef TEST_QNETWORK_PROXY
server.setProxy(QNetworkProxy(QNetworkProxy::NoProxy));
-#endif
QVERIFY(server.listen());
QHostAddress serverAddress = QHostAddress::LocalHost;
@@ -1793,9 +1780,6 @@ void tst_QTcpSocket::readyReadSignalsAfterWaitForReadyRead()
QCOMPARE(readyReadSpy.count(), 1);
QString s = socket->readLine();
-#ifdef TEST_QNETWORK_PROXY
- QNetworkProxy::ProxyType proxyType = QNetworkProxy::applicationProxy().type();
-#endif
QCOMPARE(s.toLatin1().constData(), QtNetworkSettings::expectedReplyIMAP().constData());
QCOMPARE(socket->bytesAvailable(), qint64(0));
@@ -2252,9 +2236,6 @@ void tst_QTcpSocket::taskQtBug5799ConnectionErrorEventLoop()
QString("Could not reach server: %1").arg(socket.errorString()).toLocal8Bit());
}
-
-
-#ifdef TEST_QNETWORK_PROXY
void tst_QTcpSocket::invalidProxy_data()
{
QTest::addColumn<int>("type");
@@ -2433,7 +2414,6 @@ void tst_QTcpSocket::proxyFactory()
delete socket;
}
-#endif
QTEST_MAIN(tst_QTcpSocket)
diff --git a/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp b/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp
index cfcbcfb..a61de99 100644
--- a/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp
+++ b/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp
@@ -175,6 +175,10 @@ void tst_QTextOdfWriter::testWriteStyle1_data()
"<style:style style:name=\"c4\" style:family=\"text\"><style:text-properties fo:font-style=\"italic\" fo:font-family=\"Sans\"/></style:style>";
QTest::newRow("bold+italic") << text1 << 25 <<
"<style:style style:name=\"c4\" style:family=\"text\"><style:text-properties fo:font-style=\"italic\" fo:font-weight=\"bold\" fo:font-family=\"Sans\"/></style:style>";
+ QString colorText = "<span style=\"color: #00FF00; background-color: #FF0000;\"> Color Text </span>";
+ QTest::newRow("green/red") << colorText << 3 <<
+ "<style:style style:name=\"c4\" style:family=\"text\"><style:text-properties fo:font-family=\"Sans\" fo:color=\"#00ff00\" fo:background-color=\"#ff0000\"/></style:style>";
+
}
void tst_QTextOdfWriter::testWriteStyle1()
diff --git a/tests/auto/qudpsocket/test/test.pro b/tests/auto/qudpsocket/test/test.pro
index 2e0a020..44d3d30 100644
--- a/tests/auto/qudpsocket/test/test.pro
+++ b/tests/auto/qudpsocket/test/test.pro
@@ -3,7 +3,6 @@ SOURCES += ../tst_qudpsocket.cpp
QT = core network
MOC_DIR=tmp
-DEFINES += TEST_QNETWORK_PROXY
win32 {
CONFIG(debug, debug|release) {
diff --git a/tests/auto/qudpsocket/tst_qudpsocket.cpp b/tests/auto/qudpsocket/tst_qudpsocket.cpp
index 160d74c..e3ab9bc 100644
--- a/tests/auto/qudpsocket/tst_qudpsocket.cpp
+++ b/tests/auto/qudpsocket/tst_qudpsocket.cpp
@@ -49,10 +49,7 @@
#include <qhostaddress.h>
#include <qhostinfo.h>
#include <qmap.h>
-#ifdef TEST_QNETWORK_PROXY
-# include <QNetworkProxy>
-#endif
-
+#include <QNetworkProxy>
#include <qstringlist.h>
#include "../network-settings.h"
@@ -118,32 +115,23 @@ void tst_QUdpSocket::initTestCase_data()
QTest::addColumn<int>("proxyType");
QTest::newRow("WithoutProxy") << false << 0;
-#ifdef TEST_QNETWORK_PROXY
QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy);
-#endif
}
void tst_QUdpSocket::init()
{
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
if (proxyType == QNetworkProxy::Socks5Proxy) {
QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080));
}
-#endif
}
}
void tst_QUdpSocket::cleanup()
{
- QFETCH_GLOBAL(bool, setProxy);
- if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy);
-#endif
- }
}
@@ -204,12 +192,10 @@ void tst_QUdpSocket::broadcasting()
{
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
if (proxyType == QNetworkProxy::Socks5Proxy) {
QSKIP("With socks5 Broadcast is not supported.", SkipSingle);
}
-#endif
}
#ifdef Q_OS_AIX
QSKIP("Broadcast does not work on darko", SkipAll);
@@ -539,12 +525,10 @@ void tst_QUdpSocket::bindMode()
{
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
if (proxyType == QNetworkProxy::Socks5Proxy) {
QSKIP("With socks5 explicit port binding is not supported.", SkipAll);
}
-#endif
}
QUdpSocket socket;
diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp
index 03e77aa..70cfb61 100644
--- a/tests/auto/qurl/tst_qurl.cpp
+++ b/tests/auto/qurl/tst_qurl.cpp
@@ -1682,6 +1682,12 @@ void tst_QUrl::toString_constructed_data()
<< QByteArray("//qt.nokia.com/index.html");
QTest::newRow("data2") << QString::fromLatin1("file") << n << n << n << -1 << QString::fromLatin1("/root") << QByteArray()
<< n << QString::fromLatin1("file:///root") << QByteArray("file:///root");
+ QTest::newRow("userAndPass") << QString::fromLatin1("http") << QString::fromLatin1("dfaure") << QString::fromLatin1("kde")
+ << "kde.org" << 443 << QString::fromLatin1("/") << QByteArray() << n
+ << QString::fromLatin1("http://dfaure:kde@kde.org:443/") << QByteArray("http://dfaure:kde@kde.org:443/");
+ QTest::newRow("PassWithoutUser") << QString::fromLatin1("http") << n << QString::fromLatin1("kde")
+ << "kde.org" << 443 << QString::fromLatin1("/") << QByteArray() << n
+ << QString::fromLatin1("http://:kde@kde.org:443/") << QByteArray("http://:kde@kde.org:443/");
}
void tst_QUrl::toString_constructed()
@@ -1717,6 +1723,7 @@ void tst_QUrl::toString_constructed()
QVERIFY(url.isValid());
QCOMPARE(url.toString(), asString);
+ QCOMPARE(QString::fromLatin1(url.toEncoded()), QString::fromLatin1(asEncoded)); // readable in case of differences
QCOMPARE(url.toEncoded(), asEncoded);
}
diff --git a/tests/auto/qvariant/tst_qvariant.cpp b/tests/auto/qvariant/tst_qvariant.cpp
index 3d68a73..ae0131c 100644
--- a/tests/auto/qvariant/tst_qvariant.cpp
+++ b/tests/auto/qvariant/tst_qvariant.cpp
@@ -272,6 +272,8 @@ private slots:
void numericalConvert();
void moreCustomTypes();
void variantInVariant();
+
+ void colorInteger();
};
Q_DECLARE_METATYPE(QDate)
@@ -3388,5 +3390,20 @@ void tst_QVariant::variantInVariant()
QCOMPARE(qvariant_cast<QVariant>(var9), var1);
}
+void tst_QVariant::colorInteger()
+{
+ QVariant v = QColor(Qt::red);
+ QCOMPARE(v.type(), QVariant::Color);
+ QCOMPARE(v.value<QColor>(), QColor(Qt::red));
+
+ v.setValue(1000);
+ QCOMPARE(v.type(), QVariant::Int);
+ QCOMPARE(v.toInt(), 1000);
+
+ v.setValue(QColor(Qt::yellow));
+ QCOMPARE(v.type(), QVariant::Color);
+ QCOMPARE(v.value<QColor>(), QColor(Qt::yellow));
+}
+
QTEST_MAIN(tst_QVariant)
#include "tst_qvariant.moc"
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index 3e14b56..2d04cc5 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -66,6 +66,8 @@
#include <private/qapplication_p.h>
#include <qcalendarwidget.h>
#include <qmainwindow.h>
+#include <qdockwidget.h>
+#include <qtoolbar.h>
#include <QtGui/qpaintengine.h>
#include <private/qbackingstore_p.h>
@@ -356,6 +358,7 @@ private slots:
void paintOnScreenPossible();
#endif
void reparentStaticWidget();
+ void QTBUG6883_reparentStaticWidget2();
#ifdef Q_WS_QWS
void updateOutsideSurfaceClip();
#endif
@@ -8728,6 +8731,31 @@ void tst_QWidget::reparentStaticWidget()
// Please don't crash.
paintOnScreen.resize(paintOnScreen.size() + QSize(2, 2));
QTest::qWait(20);
+
+}
+
+void tst_QWidget::QTBUG6883_reparentStaticWidget2()
+{
+ QMainWindow mw;
+ QDockWidget *one = new QDockWidget("one", &mw);
+ mw.addDockWidget(Qt::LeftDockWidgetArea, one , Qt::Vertical);
+
+ QWidget *child = new QWidget();
+ child->setPalette(Qt::red);
+ child->setAutoFillBackground(true);
+ child->setAttribute(Qt::WA_StaticContents);
+ child->resize(100, 100);
+ one->setWidget(child);
+
+ QToolBar *mainTools = mw.addToolBar("Main Tools");
+ mainTools->addWidget(new QLineEdit);
+
+ mw.show();
+ QTest::qWaitForWindowShown(&mw);
+
+ one->setFloating(true);
+ QTest::qWait(20);
+ //do not crash
}
#ifdef Q_WS_QWS
@@ -9726,7 +9754,7 @@ public:
void deleteBackingStore()
{
if (static_cast<QWidgetPrivate*>(d_ptr.data())->maybeBackingStore()) {
- delete static_cast<QWidgetPrivate*>(d_ptr.data())->topData()->backingStore;
+ delete static_cast<QWidgetPrivate*>(d_ptr.data())->topData()->backingStore;
static_cast<QWidgetPrivate*>(d_ptr.data())->topData()->backingStore = 0;
}
}
diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp
index 579f4eb..ed3b08e 100644
--- a/tests/auto/selftests/tst_selftests.cpp
+++ b/tests/auto/selftests/tst_selftests.cpp
@@ -182,12 +182,12 @@ void tst_Selftests::runSubTest_data()
#endif
QTest::newRow("benchlibeventcounter") << "benchlibeventcounter" << QStringList("-eventcounter");
QTest::newRow("benchliboptions") << "benchliboptions" << QStringList("-eventcounter");
- QTest::newRow("benchlibwalltime") << "benchlibwalltime" << QStringList();
- //### This test is affected by the speed of the CPU and whether the tick counter is
- //### monotonically increasing. It won't work on some machines so leave it off by default.
+ //### These tests are affected by timing and whether the CPU tick counter is
+ //### monotonically increasing. They won't work on some machines so leave them off by default.
//### Feel free to uncomment for your own testing.
#if 0
+ QTest::newRow("benchlibwalltime") << "benchlibwalltime" << QStringList();
QTest::newRow("benchlibtickcounter") << "benchlibtickcounter" << QStringList("-tickcounter");
#endif
diff --git a/tests/auto/uic/baseline/config_fromuic3.ui b/tests/auto/uic/baseline/config_fromuic3.ui
new file mode 100644
index 0000000..0bd6256
--- /dev/null
+++ b/tests/auto/uic/baseline/config_fromuic3.ui
@@ -0,0 +1,1647 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0" stdsetdef="1">
+ <author></author>
+ <comment>*********************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+*********************************************************************</comment>
+ <exportmacro></exportmacro>
+ <class>Config</class>
+ <widget class="QDialog" name="Config">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>481</width>
+ <height>645</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Configure</string>
+ </property>
+ <property name="windowIcon">
+ <pixmap>logo.png</pixmap>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <layout class="QGridLayout">
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <item row="0" column="1">
+ <widget class="Q3ButtonGroup" name="ButtonGroup2">
+ <property name="title">
+ <string>Depth</string>
+ </property>
+ <widget class="QRadioButton" name="depth_1">
+ <property name="geometry">
+ <rect>
+ <x>11</x>
+ <y>19</y>
+ <width>229</width>
+ <height>19</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>1 bit monochrome</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" name="depth_4gray">
+ <property name="geometry">
+ <rect>
+ <x>11</x>
+ <y>44</y>
+ <width>229</width>
+ <height>19</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>4 bit grayscale</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" name="depth_8">
+ <property name="geometry">
+ <rect>
+ <x>11</x>
+ <y>69</y>
+ <width>229</width>
+ <height>19</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>8 bit</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" name="depth_12">
+ <property name="geometry">
+ <rect>
+ <x>11</x>
+ <y>94</y>
+ <width>229</width>
+ <height>19</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>12 (16) bit</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" name="depth_16">
+ <property name="geometry">
+ <rect>
+ <x>11</x>
+ <y>119</y>
+ <width>229</width>
+ <height>19</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>16 bit</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" name="depth_32">
+ <property name="geometry">
+ <rect>
+ <x>11</x>
+ <y>144</y>
+ <width>229</width>
+ <height>19</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>32 bit</string>
+ </property>
+ </widget>
+ </widget>
+ </item>
+ <item row="4" column="0" rowspan="1" colspan="2">
+ <layout class="QHBoxLayout">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <item>
+ <spacer name="Horizontal Spacing2">
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonOk">
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonCancel">
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="0" rowspan="1" colspan="2">
+ <widget class="QCheckBox" name="touchScreen">
+ <property name="text">
+ <string>Emulate touch screen (no mouse move).</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" rowspan="1" colspan="2">
+ <widget class="Q3GroupBox" name="GroupBox1">
+ <property name="title">
+ <string>Gamma</string>
+ </property>
+ <layout class="QGridLayout">
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <item row="6" column="0">
+ <widget class="QLabel" name="TextLabel3">
+ <property name="text">
+ <string>Blue</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="1">
+ <widget class="QSlider" name="bslider">
+ <property name="palette">
+ <palette>
+ <active>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>127</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>63</red>
+ <green>63</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>170</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </active>
+ <inactive>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>127</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>38</red>
+ <green>38</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>170</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </inactive>
+ <disabled>
+ <color>
+ <red>128</red>
+ <green>128</green>
+ <blue>128</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>127</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>38</red>
+ <green>38</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>170</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>128</red>
+ <green>128</green>
+ <blue>128</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </disabled>
+ </palette>
+ </property>
+ <property name="maximum">
+ <number>400</number>
+ </property>
+ <property name="value">
+ <number>100</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="2">
+ <widget class="QLabel" name="blabel">
+ <property name="text">
+ <string>1.0</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1">
+ <spacer name="Spacer3">
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ </spacer>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="TextLabel2">
+ <property name="text">
+ <string>Green</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <widget class="QSlider" name="gslider">
+ <property name="palette">
+ <palette>
+ <active>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>255</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>255</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>63</red>
+ <green>255</green>
+ <blue>63</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>127</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>170</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </active>
+ <inactive>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>255</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>255</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>38</red>
+ <green>255</green>
+ <blue>38</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>127</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>170</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </inactive>
+ <disabled>
+ <color>
+ <red>128</red>
+ <green>128</green>
+ <blue>128</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>255</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>255</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>38</red>
+ <green>255</green>
+ <blue>38</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>127</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>170</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>128</red>
+ <green>128</green>
+ <blue>128</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </disabled>
+ </palette>
+ </property>
+ <property name="maximum">
+ <number>400</number>
+ </property>
+ <property name="value">
+ <number>100</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="2">
+ <widget class="QLabel" name="glabel">
+ <property name="text">
+ <string>1.0</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="TextLabel7">
+ <property name="text">
+ <string>All</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QLabel" name="TextLabel8">
+ <property name="text">
+ <string>1.0</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QSlider" name="gammaslider">
+ <property name="palette">
+ <palette>
+ <active>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>127</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>170</red>
+ <green>170</green>
+ <blue>170</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </active>
+ <inactive>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>127</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>170</red>
+ <green>170</green>
+ <blue>170</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </inactive>
+ <disabled>
+ <color>
+ <red>128</red>
+ <green>128</green>
+ <blue>128</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>127</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>170</red>
+ <green>170</green>
+ <blue>170</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>128</red>
+ <green>128</green>
+ <blue>128</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </disabled>
+ </palette>
+ </property>
+ <property name="maximum">
+ <number>400</number>
+ </property>
+ <property name="value">
+ <number>100</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="TextLabel1_2">
+ <property name="text">
+ <string>Red</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <widget class="QLabel" name="rlabel">
+ <property name="text">
+ <string>1.0</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QSlider" name="rslider">
+ <property name="palette">
+ <palette>
+ <active>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>127</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>63</green>
+ <blue>63</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>170</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </active>
+ <inactive>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>127</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>38</green>
+ <blue>38</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>170</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </inactive>
+ <disabled>
+ <color>
+ <red>128</red>
+ <green>128</green>
+ <blue>128</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>127</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>38</green>
+ <blue>38</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>170</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>128</red>
+ <green>128</green>
+ <blue>128</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </disabled>
+ </palette>
+ </property>
+ <property name="maximum">
+ <number>400</number>
+ </property>
+ <property name="value">
+ <number>100</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <spacer name="Spacer2">
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="1">
+ <spacer name="Spacer4">
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ </spacer>
+ </item>
+ <item row="8" column="0" rowspan="1" colspan="3">
+ <widget class="QPushButton" name="PushButton3">
+ <property name="text">
+ <string>Set all to 1.0</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="3" rowspan="9" colspan="1">
+ <widget class="GammaView" name="MyCustomWidget1"/>
+ </item>
+ <item row="7" column="1">
+ <spacer name="Spacer5">
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="Q3ButtonGroup" name="ButtonGroup1">
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Size</string>
+ </property>
+ <layout class="QVBoxLayout">
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <item>
+ <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 &quot;TV&quot;</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="size_640_480">
+ <property name="text">
+ <string>640x480 &quot;VGA&quot;</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QRadioButton" name="size_custom">
+ <property name="text">
+ <string>Custom</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="size_width">
+ <property name="maximum">
+ <number>1280</number>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="singleStep">
+ <number>16</number>
+ </property>
+ <property name="value">
+ <number>400</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="size_height">
+ <property name="maximum">
+ <number>1024</number>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="singleStep">
+ <number>16</number>
+ </property>
+ <property name="value">
+ <number>300</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QRadioButton" name="size_skin">
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Skin</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="skin">
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <item>
+ <property name="text">
+ <string>pda.skin</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>ipaq.skin</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>qpe.skin</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>cassiopeia.skin</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>other.skin</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="1" column="0" rowspan="1" colspan="2">
+ <widget class="QLabel" name="TextLabel1">
+ <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">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="test_for_useless_buttongroupId">
+ <property name="text">
+ <string>Test</string>
+ </property>
+ <property name="buttonGroupId">
+ <string>1</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <customwidgets>
+ <customwidget>
+ <class>GammaView</class>
+ <extends>QWidget</extends>
+ <header location="local">gammaview.h</header>
+ <sizehint>
+ <width>64</width>
+ <height>64</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>3</hordata>
+ <verdata>3</verdata>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+ </customwidgets>
+ <images>
+ <image name="image0">
+ <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
+ </image>
+ </images>
+ <connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>Config</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>Config</receiver>
+ <slot>reject()</slot>
+ </connection>
+ </connections>
+</ui>
diff --git a/tests/auto/uic/baseline/config_fromuic3.ui.h b/tests/auto/uic/baseline/config_fromuic3.ui.h
new file mode 100644
index 0000000..ec20d05
--- /dev/null
+++ b/tests/auto/uic/baseline/config_fromuic3.ui.h
@@ -0,0 +1,715 @@
+/*
+*********************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+*********************************************************************
+*/
+
+/********************************************************************************
+** Form generated from reading UI file 'config_fromuic3.ui'
+**
+** Created: Thu Dec 17 12:48:42 2009
+** by: Qt User Interface Compiler version 4.6.1
+**
+** WARNING! All changes made in this file will be lost when recompiling UI file!
+********************************************************************************/
+
+#ifndef CONFIG_FROMUIC3_H
+#define CONFIG_FROMUIC3_H
+
+#include <Qt3Support/Q3ButtonGroup>
+#include <Qt3Support/Q3GroupBox>
+#include <QtCore/QVariant>
+#include <QtGui/QAction>
+#include <QtGui/QApplication>
+#include <QtGui/QButtonGroup>
+#include <QtGui/QCheckBox>
+#include <QtGui/QComboBox>
+#include <QtGui/QDialog>
+#include <QtGui/QGridLayout>
+#include <QtGui/QHBoxLayout>
+#include <QtGui/QHeaderView>
+#include <QtGui/QLabel>
+#include <QtGui/QPushButton>
+#include <QtGui/QRadioButton>
+#include <QtGui/QSlider>
+#include <QtGui/QSpacerItem>
+#include <QtGui/QSpinBox>
+#include <QtGui/QVBoxLayout>
+#include "gammaview.h"
+
+QT_BEGIN_NAMESPACE
+
+class Ui_Config
+{
+public:
+ QGridLayout *gridLayout;
+ Q3ButtonGroup *ButtonGroup2;
+ QRadioButton *depth_1;
+ QRadioButton *depth_4gray;
+ QRadioButton *depth_8;
+ QRadioButton *depth_12;
+ QRadioButton *depth_16;
+ QRadioButton *depth_32;
+ QHBoxLayout *hboxLayout;
+ QSpacerItem *Horizontal_Spacing2;
+ QPushButton *buttonOk;
+ QPushButton *buttonCancel;
+ QCheckBox *touchScreen;
+ Q3GroupBox *GroupBox1;
+ QGridLayout *gridLayout1;
+ QLabel *TextLabel3;
+ QSlider *bslider;
+ QLabel *blabel;
+ QSpacerItem *Spacer3;
+ QLabel *TextLabel2;
+ QSlider *gslider;
+ QLabel *glabel;
+ QLabel *TextLabel7;
+ QLabel *TextLabel8;
+ QSlider *gammaslider;
+ QLabel *TextLabel1_2;
+ QLabel *rlabel;
+ QSlider *rslider;
+ QSpacerItem *Spacer2;
+ QSpacerItem *Spacer4;
+ QPushButton *PushButton3;
+ GammaView *MyCustomWidget1;
+ QSpacerItem *Spacer5;
+ Q3ButtonGroup *ButtonGroup1;
+ QVBoxLayout *vboxLayout;
+ QRadioButton *size_240_320;
+ QRadioButton *size_320_240;
+ QRadioButton *size_640_480;
+ QHBoxLayout *hboxLayout1;
+ QRadioButton *size_custom;
+ QSpinBox *size_width;
+ QSpinBox *size_height;
+ QHBoxLayout *hboxLayout2;
+ QRadioButton *size_skin;
+ QComboBox *skin;
+ QLabel *TextLabel1;
+ QRadioButton *test_for_useless_buttongroupId;
+
+ void setupUi(QDialog *Config)
+ {
+ if (Config->objectName().isEmpty())
+ Config->setObjectName(QString::fromUtf8("Config"));
+ Config->resize(481, 645);
+ Config->setWindowIcon(QPixmap(QString::fromUtf8("logo.png")));
+ Config->setSizeGripEnabled(true);
+ gridLayout = new QGridLayout(Config);
+ gridLayout->setSpacing(6);
+ gridLayout->setContentsMargins(11, 11, 11, 11);
+ gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
+ ButtonGroup2 = new Q3ButtonGroup(Config);
+ ButtonGroup2->setObjectName(QString::fromUtf8("ButtonGroup2"));
+ depth_1 = new QRadioButton(ButtonGroup2);
+ depth_1->setObjectName(QString::fromUtf8("depth_1"));
+ depth_1->setGeometry(QRect(11, 19, 229, 19));
+ depth_4gray = new QRadioButton(ButtonGroup2);
+ depth_4gray->setObjectName(QString::fromUtf8("depth_4gray"));
+ depth_4gray->setGeometry(QRect(11, 44, 229, 19));
+ depth_8 = new QRadioButton(ButtonGroup2);
+ depth_8->setObjectName(QString::fromUtf8("depth_8"));
+ depth_8->setGeometry(QRect(11, 69, 229, 19));
+ depth_12 = new QRadioButton(ButtonGroup2);
+ depth_12->setObjectName(QString::fromUtf8("depth_12"));
+ depth_12->setGeometry(QRect(11, 94, 229, 19));
+ depth_16 = new QRadioButton(ButtonGroup2);
+ depth_16->setObjectName(QString::fromUtf8("depth_16"));
+ depth_16->setGeometry(QRect(11, 119, 229, 19));
+ depth_32 = new QRadioButton(ButtonGroup2);
+ depth_32->setObjectName(QString::fromUtf8("depth_32"));
+ depth_32->setGeometry(QRect(11, 144, 229, 19));
+
+ gridLayout->addWidget(ButtonGroup2, 0, 1, 1, 1);
+
+ hboxLayout = new QHBoxLayout();
+ hboxLayout->setSpacing(6);
+ hboxLayout->setContentsMargins(0, 0, 0, 0);
+ hboxLayout->setObjectName(QString::fromUtf8("hboxLayout"));
+ Horizontal_Spacing2 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+
+ hboxLayout->addItem(Horizontal_Spacing2);
+
+ buttonOk = new QPushButton(Config);
+ buttonOk->setObjectName(QString::fromUtf8("buttonOk"));
+ buttonOk->setAutoDefault(true);
+ buttonOk->setDefault(true);
+
+ hboxLayout->addWidget(buttonOk);
+
+ buttonCancel = new QPushButton(Config);
+ buttonCancel->setObjectName(QString::fromUtf8("buttonCancel"));
+ buttonCancel->setAutoDefault(true);
+
+ hboxLayout->addWidget(buttonCancel);
+
+
+ gridLayout->addLayout(hboxLayout, 4, 0, 1, 2);
+
+ touchScreen = new QCheckBox(Config);
+ touchScreen->setObjectName(QString::fromUtf8("touchScreen"));
+
+ gridLayout->addWidget(touchScreen, 2, 0, 1, 2);
+
+ GroupBox1 = new Q3GroupBox(Config);
+ GroupBox1->setObjectName(QString::fromUtf8("GroupBox1"));
+ GroupBox1->setColumnLayout(0, Qt::Vertical);
+ GroupBox1->layout()->setSpacing(6);
+ GroupBox1->layout()->setContentsMargins(11, 11, 11, 11);
+ gridLayout1 = new QGridLayout();
+ QBoxLayout *boxlayout = qobject_cast<QBoxLayout *>(GroupBox1->layout());
+ if (boxlayout)
+ boxlayout->addLayout(gridLayout1);
+ gridLayout1->setAlignment(Qt::AlignTop);
+ gridLayout1->setObjectName(QString::fromUtf8("gridLayout1"));
+ TextLabel3 = new QLabel(GroupBox1);
+ TextLabel3->setObjectName(QString::fromUtf8("TextLabel3"));
+ TextLabel3->setWordWrap(false);
+
+ gridLayout1->addWidget(TextLabel3, 6, 0, 1, 1);
+
+ bslider = new QSlider(GroupBox1);
+ bslider->setObjectName(QString::fromUtf8("bslider"));
+ QPalette palette;
+ palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(0), QColor(0, 0, 0));
+ palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(1), QColor(0, 0, 255));
+ palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(2), QColor(127, 127, 255));
+ palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(3), QColor(63, 63, 255));
+ palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(4), QColor(0, 0, 127));
+ palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(5), QColor(0, 0, 170));
+ palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(6), QColor(0, 0, 0));
+ palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(7), QColor(255, 255, 255));
+ palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(8), QColor(0, 0, 0));
+ palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(9), QColor(255, 255, 255));
+ palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(10), QColor(220, 220, 220));
+ palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(11), QColor(0, 0, 0));
+ palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(12), QColor(10, 95, 137));
+ palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(13), QColor(255, 255, 255));
+ palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(14), QColor(0, 0, 0));
+ palette.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(15), QColor(0, 0, 0));
+ palette.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(0), QColor(0, 0, 0));
+ palette.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(1), QColor(0, 0, 255));
+ palette.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(2), QColor(127, 127, 255));
+ palette.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(3), QColor(38, 38, 255));
+ palette.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(4), QColor(0, 0, 127));
+ palette.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(5), QColor(0, 0, 170));
+ palette.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(6), QColor(0, 0, 0));
+ palette.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(7), QColor(255, 255, 255));
+ palette.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(8), QColor(0, 0, 0));
+ palette.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(9), QColor(255, 255, 255));
+ palette.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(10), QColor(220, 220, 220));
+ palette.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(11), QColor(0, 0, 0));
+ palette.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(12), QColor(10, 95, 137));
+ palette.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(13), QColor(255, 255, 255));
+ palette.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(14), QColor(0, 0, 0));
+ palette.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(15), QColor(0, 0, 0));
+ palette.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(0), QColor(128, 128, 128));
+ palette.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(1), QColor(0, 0, 255));
+ palette.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(2), QColor(127, 127, 255));
+ palette.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(3), QColor(38, 38, 255));
+ palette.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(4), QColor(0, 0, 127));
+ palette.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(5), QColor(0, 0, 170));
+ palette.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(6), QColor(0, 0, 0));
+ palette.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(7), QColor(255, 255, 255));
+ palette.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(8), QColor(128, 128, 128));
+ palette.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(9), QColor(255, 255, 255));
+ palette.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(10), QColor(220, 220, 220));
+ palette.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(11), QColor(0, 0, 0));
+ palette.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(12), QColor(10, 95, 137));
+ palette.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(13), QColor(255, 255, 255));
+ palette.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(14), QColor(0, 0, 0));
+ palette.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(15), QColor(0, 0, 0));
+ bslider->setPalette(palette);
+ bslider->setMaximum(400);
+ bslider->setValue(100);
+ bslider->setOrientation(Qt::Horizontal);
+
+ gridLayout1->addWidget(bslider, 6, 1, 1, 1);
+
+ blabel = new QLabel(GroupBox1);
+ blabel->setObjectName(QString::fromUtf8("blabel"));
+ blabel->setWordWrap(false);
+
+ gridLayout1->addWidget(blabel, 6, 2, 1, 1);
+
+ Spacer3 = new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding);
+
+ gridLayout1->addItem(Spacer3, 5, 1, 1, 1);
+
+ TextLabel2 = new QLabel(GroupBox1);
+ TextLabel2->setObjectName(QString::fromUtf8("TextLabel2"));
+ TextLabel2->setWordWrap(false);
+
+ gridLayout1->addWidget(TextLabel2, 4, 0, 1, 1);
+
+ gslider = new QSlider(GroupBox1);
+ gslider->setObjectName(QString::fromUtf8("gslider"));
+ QPalette palette1;
+ palette1.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(0), QColor(0, 0, 0));
+ palette1.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(1), QColor(0, 255, 0));
+ palette1.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(2), QColor(127, 255, 127));
+ palette1.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(3), QColor(63, 255, 63));
+ palette1.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(4), QColor(0, 127, 0));
+ palette1.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(5), QColor(0, 170, 0));
+ palette1.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(6), QColor(0, 0, 0));
+ palette1.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(7), QColor(255, 255, 255));
+ palette1.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(8), QColor(0, 0, 0));
+ palette1.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(9), QColor(255, 255, 255));
+ palette1.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(10), QColor(220, 220, 220));
+ palette1.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(11), QColor(0, 0, 0));
+ palette1.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(12), QColor(10, 95, 137));
+ palette1.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(13), QColor(255, 255, 255));
+ palette1.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(14), QColor(0, 0, 0));
+ palette1.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(15), QColor(0, 0, 0));
+ palette1.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(0), QColor(0, 0, 0));
+ palette1.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(1), QColor(0, 255, 0));
+ palette1.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(2), QColor(127, 255, 127));
+ palette1.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(3), QColor(38, 255, 38));
+ palette1.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(4), QColor(0, 127, 0));
+ palette1.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(5), QColor(0, 170, 0));
+ palette1.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(6), QColor(0, 0, 0));
+ palette1.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(7), QColor(255, 255, 255));
+ palette1.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(8), QColor(0, 0, 0));
+ palette1.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(9), QColor(255, 255, 255));
+ palette1.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(10), QColor(220, 220, 220));
+ palette1.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(11), QColor(0, 0, 0));
+ palette1.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(12), QColor(10, 95, 137));
+ palette1.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(13), QColor(255, 255, 255));
+ palette1.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(14), QColor(0, 0, 0));
+ palette1.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(15), QColor(0, 0, 0));
+ palette1.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(0), QColor(128, 128, 128));
+ palette1.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(1), QColor(0, 255, 0));
+ palette1.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(2), QColor(127, 255, 127));
+ palette1.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(3), QColor(38, 255, 38));
+ palette1.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(4), QColor(0, 127, 0));
+ palette1.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(5), QColor(0, 170, 0));
+ palette1.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(6), QColor(0, 0, 0));
+ palette1.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(7), QColor(255, 255, 255));
+ palette1.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(8), QColor(128, 128, 128));
+ palette1.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(9), QColor(255, 255, 255));
+ palette1.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(10), QColor(220, 220, 220));
+ palette1.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(11), QColor(0, 0, 0));
+ palette1.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(12), QColor(10, 95, 137));
+ palette1.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(13), QColor(255, 255, 255));
+ palette1.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(14), QColor(0, 0, 0));
+ palette1.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(15), QColor(0, 0, 0));
+ gslider->setPalette(palette1);
+ gslider->setMaximum(400);
+ gslider->setValue(100);
+ gslider->setOrientation(Qt::Horizontal);
+
+ gridLayout1->addWidget(gslider, 4, 1, 1, 1);
+
+ glabel = new QLabel(GroupBox1);
+ glabel->setObjectName(QString::fromUtf8("glabel"));
+ glabel->setWordWrap(false);
+
+ gridLayout1->addWidget(glabel, 4, 2, 1, 1);
+
+ TextLabel7 = new QLabel(GroupBox1);
+ TextLabel7->setObjectName(QString::fromUtf8("TextLabel7"));
+ TextLabel7->setWordWrap(false);
+
+ gridLayout1->addWidget(TextLabel7, 0, 0, 1, 1);
+
+ TextLabel8 = new QLabel(GroupBox1);
+ TextLabel8->setObjectName(QString::fromUtf8("TextLabel8"));
+ TextLabel8->setWordWrap(false);
+
+ gridLayout1->addWidget(TextLabel8, 0, 2, 1, 1);
+
+ gammaslider = new QSlider(GroupBox1);
+ gammaslider->setObjectName(QString::fromUtf8("gammaslider"));
+ QPalette palette2;
+ palette2.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(0), QColor(0, 0, 0));
+ palette2.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(1), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(2), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(3), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(4), QColor(127, 127, 127));
+ palette2.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(5), QColor(170, 170, 170));
+ palette2.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(6), QColor(0, 0, 0));
+ palette2.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(7), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(8), QColor(0, 0, 0));
+ palette2.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(9), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(10), QColor(220, 220, 220));
+ palette2.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(11), QColor(0, 0, 0));
+ palette2.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(12), QColor(10, 95, 137));
+ palette2.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(13), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(14), QColor(0, 0, 0));
+ palette2.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(15), QColor(0, 0, 0));
+ palette2.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(0), QColor(0, 0, 0));
+ palette2.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(1), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(2), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(3), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(4), QColor(127, 127, 127));
+ palette2.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(5), QColor(170, 170, 170));
+ palette2.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(6), QColor(0, 0, 0));
+ palette2.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(7), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(8), QColor(0, 0, 0));
+ palette2.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(9), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(10), QColor(220, 220, 220));
+ palette2.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(11), QColor(0, 0, 0));
+ palette2.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(12), QColor(10, 95, 137));
+ palette2.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(13), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(14), QColor(0, 0, 0));
+ palette2.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(15), QColor(0, 0, 0));
+ palette2.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(0), QColor(128, 128, 128));
+ palette2.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(1), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(2), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(3), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(4), QColor(127, 127, 127));
+ palette2.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(5), QColor(170, 170, 170));
+ palette2.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(6), QColor(0, 0, 0));
+ palette2.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(7), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(8), QColor(128, 128, 128));
+ palette2.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(9), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(10), QColor(220, 220, 220));
+ palette2.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(11), QColor(0, 0, 0));
+ palette2.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(12), QColor(10, 95, 137));
+ palette2.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(13), QColor(255, 255, 255));
+ palette2.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(14), QColor(0, 0, 0));
+ palette2.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(15), QColor(0, 0, 0));
+ gammaslider->setPalette(palette2);
+ gammaslider->setMaximum(400);
+ gammaslider->setValue(100);
+ gammaslider->setOrientation(Qt::Horizontal);
+
+ gridLayout1->addWidget(gammaslider, 0, 1, 1, 1);
+
+ TextLabel1_2 = new QLabel(GroupBox1);
+ TextLabel1_2->setObjectName(QString::fromUtf8("TextLabel1_2"));
+ TextLabel1_2->setWordWrap(false);
+
+ gridLayout1->addWidget(TextLabel1_2, 2, 0, 1, 1);
+
+ rlabel = new QLabel(GroupBox1);
+ rlabel->setObjectName(QString::fromUtf8("rlabel"));
+ rlabel->setWordWrap(false);
+
+ gridLayout1->addWidget(rlabel, 2, 2, 1, 1);
+
+ rslider = new QSlider(GroupBox1);
+ rslider->setObjectName(QString::fromUtf8("rslider"));
+ QPalette palette3;
+ palette3.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(0), QColor(0, 0, 0));
+ palette3.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(1), QColor(255, 0, 0));
+ palette3.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(2), QColor(255, 127, 127));
+ palette3.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(3), QColor(255, 63, 63));
+ palette3.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(4), QColor(127, 0, 0));
+ palette3.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(5), QColor(170, 0, 0));
+ palette3.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(6), QColor(0, 0, 0));
+ palette3.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(7), QColor(255, 255, 255));
+ palette3.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(8), QColor(0, 0, 0));
+ palette3.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(9), QColor(255, 255, 255));
+ palette3.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(10), QColor(220, 220, 220));
+ palette3.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(11), QColor(0, 0, 0));
+ palette3.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(12), QColor(10, 95, 137));
+ palette3.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(13), QColor(255, 255, 255));
+ palette3.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(14), QColor(0, 0, 0));
+ palette3.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(15), QColor(0, 0, 0));
+ palette3.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(0), QColor(0, 0, 0));
+ palette3.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(1), QColor(255, 0, 0));
+ palette3.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(2), QColor(255, 127, 127));
+ palette3.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(3), QColor(255, 38, 38));
+ palette3.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(4), QColor(127, 0, 0));
+ palette3.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(5), QColor(170, 0, 0));
+ palette3.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(6), QColor(0, 0, 0));
+ palette3.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(7), QColor(255, 255, 255));
+ palette3.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(8), QColor(0, 0, 0));
+ palette3.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(9), QColor(255, 255, 255));
+ palette3.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(10), QColor(220, 220, 220));
+ palette3.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(11), QColor(0, 0, 0));
+ palette3.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(12), QColor(10, 95, 137));
+ palette3.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(13), QColor(255, 255, 255));
+ palette3.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(14), QColor(0, 0, 0));
+ palette3.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(15), QColor(0, 0, 0));
+ palette3.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(0), QColor(128, 128, 128));
+ palette3.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(1), QColor(255, 0, 0));
+ palette3.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(2), QColor(255, 127, 127));
+ palette3.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(3), QColor(255, 38, 38));
+ palette3.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(4), QColor(127, 0, 0));
+ palette3.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(5), QColor(170, 0, 0));
+ palette3.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(6), QColor(0, 0, 0));
+ palette3.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(7), QColor(255, 255, 255));
+ palette3.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(8), QColor(128, 128, 128));
+ palette3.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(9), QColor(255, 255, 255));
+ palette3.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(10), QColor(220, 220, 220));
+ palette3.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(11), QColor(0, 0, 0));
+ palette3.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(12), QColor(10, 95, 137));
+ palette3.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(13), QColor(255, 255, 255));
+ palette3.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(14), QColor(0, 0, 0));
+ palette3.setColor(QPalette::Disabled, static_cast<QPalette::ColorRole>(15), QColor(0, 0, 0));
+ rslider->setPalette(palette3);
+ rslider->setMaximum(400);
+ rslider->setValue(100);
+ rslider->setOrientation(Qt::Horizontal);
+
+ gridLayout1->addWidget(rslider, 2, 1, 1, 1);
+
+ Spacer2 = new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding);
+
+ gridLayout1->addItem(Spacer2, 3, 1, 1, 1);
+
+ Spacer4 = new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding);
+
+ gridLayout1->addItem(Spacer4, 1, 1, 1, 1);
+
+ PushButton3 = new QPushButton(GroupBox1);
+ PushButton3->setObjectName(QString::fromUtf8("PushButton3"));
+
+ gridLayout1->addWidget(PushButton3, 8, 0, 1, 3);
+
+ MyCustomWidget1 = new GammaView(GroupBox1);
+ MyCustomWidget1->setObjectName(QString::fromUtf8("MyCustomWidget1"));
+
+ gridLayout1->addWidget(MyCustomWidget1, 0, 3, 9, 1);
+
+ Spacer5 = new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding);
+
+ gridLayout1->addItem(Spacer5, 7, 1, 1, 1);
+
+
+ gridLayout->addWidget(GroupBox1, 3, 0, 1, 2);
+
+ ButtonGroup1 = new Q3ButtonGroup(Config);
+ ButtonGroup1->setObjectName(QString::fromUtf8("ButtonGroup1"));
+ QSizePolicy sizePolicy(static_cast<QSizePolicy::Policy>(5), static_cast<QSizePolicy::Policy>(5));
+ sizePolicy.setHorizontalStretch(0);
+ sizePolicy.setVerticalStretch(0);
+ sizePolicy.setHeightForWidth(ButtonGroup1->sizePolicy().hasHeightForWidth());
+ ButtonGroup1->setSizePolicy(sizePolicy);
+ ButtonGroup1->setColumnLayout(0, Qt::Vertical);
+ ButtonGroup1->layout()->setSpacing(6);
+ ButtonGroup1->layout()->setContentsMargins(11, 11, 11, 11);
+ vboxLayout = new QVBoxLayout();
+ QBoxLayout *boxlayout1 = qobject_cast<QBoxLayout *>(ButtonGroup1->layout());
+ if (boxlayout1)
+ boxlayout1->addLayout(vboxLayout);
+ vboxLayout->setAlignment(Qt::AlignTop);
+ vboxLayout->setObjectName(QString::fromUtf8("vboxLayout"));
+ size_240_320 = new QRadioButton(ButtonGroup1);
+ size_240_320->setObjectName(QString::fromUtf8("size_240_320"));
+
+ vboxLayout->addWidget(size_240_320);
+
+ size_320_240 = new QRadioButton(ButtonGroup1);
+ size_320_240->setObjectName(QString::fromUtf8("size_320_240"));
+
+ vboxLayout->addWidget(size_320_240);
+
+ size_640_480 = new QRadioButton(ButtonGroup1);
+ size_640_480->setObjectName(QString::fromUtf8("size_640_480"));
+
+ vboxLayout->addWidget(size_640_480);
+
+ hboxLayout1 = new QHBoxLayout();
+ hboxLayout1->setSpacing(6);
+ hboxLayout1->setContentsMargins(0, 0, 0, 0);
+ hboxLayout1->setObjectName(QString::fromUtf8("hboxLayout1"));
+ size_custom = new QRadioButton(ButtonGroup1);
+ size_custom->setObjectName(QString::fromUtf8("size_custom"));
+
+ hboxLayout1->addWidget(size_custom);
+
+ size_width = new QSpinBox(ButtonGroup1);
+ size_width->setObjectName(QString::fromUtf8("size_width"));
+ size_width->setMaximum(1280);
+ size_width->setMinimum(1);
+ size_width->setSingleStep(16);
+ size_width->setValue(400);
+
+ hboxLayout1->addWidget(size_width);
+
+ size_height = new QSpinBox(ButtonGroup1);
+ size_height->setObjectName(QString::fromUtf8("size_height"));
+ size_height->setMaximum(1024);
+ size_height->setMinimum(1);
+ size_height->setSingleStep(16);
+ size_height->setValue(300);
+
+ hboxLayout1->addWidget(size_height);
+
+
+ vboxLayout->addLayout(hboxLayout1);
+
+ hboxLayout2 = new QHBoxLayout();
+ hboxLayout2->setSpacing(6);
+ hboxLayout2->setContentsMargins(0, 0, 0, 0);
+ hboxLayout2->setObjectName(QString::fromUtf8("hboxLayout2"));
+ size_skin = new QRadioButton(ButtonGroup1);
+ size_skin->setObjectName(QString::fromUtf8("size_skin"));
+ QSizePolicy sizePolicy1(static_cast<QSizePolicy::Policy>(0), static_cast<QSizePolicy::Policy>(0));
+ sizePolicy1.setHorizontalStretch(0);
+ sizePolicy1.setVerticalStretch(0);
+ sizePolicy1.setHeightForWidth(size_skin->sizePolicy().hasHeightForWidth());
+ size_skin->setSizePolicy(sizePolicy1);
+
+ hboxLayout2->addWidget(size_skin);
+
+ skin = new QComboBox(ButtonGroup1);
+ skin->setObjectName(QString::fromUtf8("skin"));
+ QSizePolicy sizePolicy2(static_cast<QSizePolicy::Policy>(5), static_cast<QSizePolicy::Policy>(0));
+ sizePolicy2.setHorizontalStretch(0);
+ sizePolicy2.setVerticalStretch(0);
+ sizePolicy2.setHeightForWidth(skin->sizePolicy().hasHeightForWidth());
+ skin->setSizePolicy(sizePolicy2);
+
+ hboxLayout2->addWidget(skin);
+
+
+ vboxLayout->addLayout(hboxLayout2);
+
+
+ gridLayout->addWidget(ButtonGroup1, 0, 0, 1, 1);
+
+ TextLabel1 = new QLabel(Config);
+ TextLabel1->setObjectName(QString::fromUtf8("TextLabel1"));
+ TextLabel1->setWordWrap(false);
+
+ gridLayout->addWidget(TextLabel1, 1, 0, 1, 2);
+
+ test_for_useless_buttongroupId = new QRadioButton(Config);
+ test_for_useless_buttongroupId->setObjectName(QString::fromUtf8("test_for_useless_buttongroupId"));
+
+ gridLayout->addWidget(test_for_useless_buttongroupId, 0, 0, 1, 1);
+
+
+ retranslateUi(Config);
+ QObject::connect(buttonOk, SIGNAL(clicked()), Config, SLOT(accept()));
+ QObject::connect(buttonCancel, SIGNAL(clicked()), Config, SLOT(reject()));
+
+ QMetaObject::connectSlotsByName(Config);
+ } // setupUi
+
+ void retranslateUi(QDialog *Config)
+ {
+ Config->setWindowTitle(QApplication::translate("Config", "Configure", 0, QApplication::UnicodeUTF8));
+ ButtonGroup2->setTitle(QApplication::translate("Config", "Depth", 0, QApplication::UnicodeUTF8));
+ depth_1->setText(QApplication::translate("Config", "1 bit monochrome", 0, QApplication::UnicodeUTF8));
+ depth_4gray->setText(QApplication::translate("Config", "4 bit grayscale", 0, QApplication::UnicodeUTF8));
+ depth_8->setText(QApplication::translate("Config", "8 bit", 0, QApplication::UnicodeUTF8));
+ depth_12->setText(QApplication::translate("Config", "12 (16) bit", 0, QApplication::UnicodeUTF8));
+ depth_16->setText(QApplication::translate("Config", "16 bit", 0, QApplication::UnicodeUTF8));
+ depth_32->setText(QApplication::translate("Config", "32 bit", 0, QApplication::UnicodeUTF8));
+ buttonOk->setText(QApplication::translate("Config", "&OK", 0, QApplication::UnicodeUTF8));
+ buttonCancel->setText(QApplication::translate("Config", "&Cancel", 0, QApplication::UnicodeUTF8));
+ touchScreen->setText(QApplication::translate("Config", "Emulate touch screen (no mouse move).", 0, QApplication::UnicodeUTF8));
+ GroupBox1->setTitle(QApplication::translate("Config", "Gamma", 0, QApplication::UnicodeUTF8));
+ TextLabel3->setText(QApplication::translate("Config", "Blue", 0, QApplication::UnicodeUTF8));
+ blabel->setText(QApplication::translate("Config", "1.0", 0, QApplication::UnicodeUTF8));
+ TextLabel2->setText(QApplication::translate("Config", "Green", 0, QApplication::UnicodeUTF8));
+ glabel->setText(QApplication::translate("Config", "1.0", 0, QApplication::UnicodeUTF8));
+ TextLabel7->setText(QApplication::translate("Config", "All", 0, QApplication::UnicodeUTF8));
+ TextLabel8->setText(QApplication::translate("Config", "1.0", 0, QApplication::UnicodeUTF8));
+ TextLabel1_2->setText(QApplication::translate("Config", "Red", 0, QApplication::UnicodeUTF8));
+ rlabel->setText(QApplication::translate("Config", "1.0", 0, QApplication::UnicodeUTF8));
+ PushButton3->setText(QApplication::translate("Config", "Set all to 1.0", 0, QApplication::UnicodeUTF8));
+ ButtonGroup1->setTitle(QApplication::translate("Config", "Size", 0, QApplication::UnicodeUTF8));
+ size_240_320->setText(QApplication::translate("Config", "240x320 \"PDA\"", 0, QApplication::UnicodeUTF8));
+ size_320_240->setText(QApplication::translate("Config", "320x240 \"TV\"", 0, QApplication::UnicodeUTF8));
+ size_640_480->setText(QApplication::translate("Config", "640x480 \"VGA\"", 0, QApplication::UnicodeUTF8));
+ size_custom->setText(QApplication::translate("Config", "Custom", 0, QApplication::UnicodeUTF8));
+ size_skin->setText(QApplication::translate("Config", "Skin", 0, QApplication::UnicodeUTF8));
+ skin->clear();
+ skin->insertItems(0, QStringList()
+ << QApplication::translate("Config", "pda.skin", 0, QApplication::UnicodeUTF8)
+ << QApplication::translate("Config", "ipaq.skin", 0, QApplication::UnicodeUTF8)
+ << QApplication::translate("Config", "qpe.skin", 0, QApplication::UnicodeUTF8)
+ << QApplication::translate("Config", "cassiopeia.skin", 0, QApplication::UnicodeUTF8)
+ << QApplication::translate("Config", "other.skin", 0, QApplication::UnicodeUTF8)
+ );
+ TextLabel1->setText(QApplication::translate("Config", "<p>Note that any applications using the virtual framebuffer will be terminated if you change the Size or Depth <i>above</i>. You may freely modify the Gamma <i>below</i>.", 0, QApplication::UnicodeUTF8));
+ test_for_useless_buttongroupId->setText(QApplication::translate("Config", "Test", 0, QApplication::UnicodeUTF8));
+ } // retranslateUi
+
+
+protected:
+ enum IconID
+ {
+ image0_ID,
+ unknown_ID
+ };
+ static QPixmap qt_get_icon(IconID id)
+ {
+ static const char* const image0_data[] = {
+"22 22 2 1",
+". c None",
+"# c #a4c610",
+"........######........",
+".....###########......",
+"....##############....",
+"...################...",
+"..######......######..",
+"..#####........#####..",
+".#####.......#..#####.",
+".####.......###..####.",
+"####.......#####..####",
+"####......#####...####",
+"####....#######...####",
+"####....######....####",
+"####...########...####",
+".####.##########..####",
+".####..####.#########.",
+".#####..##...########.",
+"..#####.......#######.",
+"..######......######..",
+"...###################",
+"....##################",
+"......###########.###.",
+"........######.....#.."};
+
+
+ switch (id) {
+ case image0_ID: return QPixmap((const char**)image0_data);
+ default: return QPixmap();
+ } // switch
+ } // icon
+
+};
+
+namespace Ui {
+ class Config: public Ui_Config {};
+} // namespace Ui
+
+QT_END_NAMESPACE
+
+#endif // CONFIG_FROMUIC3_H
diff --git a/tests/auto/uic3/baseline/config.ui b/tests/auto/uic3/baseline/config.ui
index 1ffeab3..dc02682 100644
--- a/tests/auto/uic3/baseline/config.ui
+++ b/tests/auto/uic3/baseline/config.ui
@@ -1648,6 +1648,17 @@
<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>
</widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>test_for_useless_buttongroupId</cstring>
+ </property>
+ <property name="text">
+ <string>Test</string>
+ </property>
+ <property name="buttonGroupId">
+ <string>1</string>
+ </property>
+ </widget>
</grid>
</widget>
<customwidgets>
diff --git a/tests/auto/uic3/baseline/config.ui.4 b/tests/auto/uic3/baseline/config.ui.4
index 17e6a7c..0bd6256 100644
--- a/tests/auto/uic3/baseline/config.ui.4
+++ b/tests/auto/uic3/baseline/config.ui.4
@@ -1595,6 +1595,16 @@
</property>
</widget>
</item>
+ <item>
+ <widget class="QRadioButton" name="test_for_useless_buttongroupId">
+ <property name="text">
+ <string>Test</string>
+ </property>
+ <property name="buttonGroupId">
+ <string>1</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
diff --git a/tests/benchmarks/benchmarks.pro b/tests/benchmarks/benchmarks.pro
index 9170039..7bb4bb1 100644
--- a/tests/benchmarks/benchmarks.pro
+++ b/tests/benchmarks/benchmarks.pro
@@ -5,6 +5,7 @@ SUBDIRS = containers-associative \
qbytearray \
qfileinfo \
qfile_vs_qnetworkaccessmanager \
+ qhostinfo \
qpainter \
qtestlib-simple events \
qiodevice \
@@ -20,6 +21,26 @@ SUBDIRS = containers-associative \
qregion \
qvariant \
qwidget \
- qtwidgets
+ qtwidgets \
+ qapplication \
+ qdir \
+ qdiriterator \
+ qgraphicsanchorlayout \
+ qgraphicsitem \
+ qgraphicswidget \
+ qmetaobject \
+ qpixmapcache \
+ qquaternion \
+ qscriptclass \
+ qscriptengine \
+ qscriptvalue \
+ qstringbuilder \
+ qstylesheetstyle \
+ qsvgrenderer \
+ qtcpserver \
+ qtableview \
+ qthreadstorage
+
+
contains(QT_CONFIG, opengl): SUBDIRS += opengl
diff --git a/tests/benchmarks/containers-sequential/main.cpp b/tests/benchmarks/containers-sequential/main.cpp
index 76643ca..885db3e 100644
--- a/tests/benchmarks/containers-sequential/main.cpp
+++ b/tests/benchmarks/containers-sequential/main.cpp
@@ -59,7 +59,7 @@ public:
};
template <typename T>
-static T * f(T *ts) // dummy function to prevent code from being optimized away by the compiler
+T * f(T *ts) // dummy function to prevent code from being optimized away by the compiler
{
return ts;
}
@@ -81,7 +81,7 @@ class UseCases_QVector : public UseCases<T>
void lookup(int size)
{
QVector<T> v;
-
+
T t;
for (int i = 0; i < size; ++i)
v.append(t);
@@ -113,7 +113,7 @@ class UseCases_stdvector : public UseCases<T>
void lookup(int size)
{
std::vector<T> v;
-
+
T t;
for (int i = 0; i < size; ++i)
v.push_back(t);
@@ -132,6 +132,13 @@ struct Large { // A "large" item type
int x[1000];
};
+// Symbian devices typically have limited memory
+#ifdef Q_OS_SYMBIAN
+# define LARGE_MAX_SIZE 2000
+#else
+# define LARGE_MAX_SIZE 20000
+#endif
+
class tst_vector_vs_std : public QObject
{
Q_OBJECT
@@ -190,7 +197,7 @@ void tst_vector_vs_std::insert_Large_data()
QTest::addColumn<bool>("useStd");
QTest::addColumn<int>("size");
- for (int size = 10; size < 20000; size += 100) {
+ for (int size = 10; size < LARGE_MAX_SIZE; size += 100) {
const QByteArray sizeString = QByteArray::number(size);
QTest::newRow(("std::vector-Large--" + sizeString).constData()) << true << size;
QTest::newRow(("QVector-Large--" + sizeString).constData()) << false << size;
@@ -236,7 +243,7 @@ void tst_vector_vs_std::lookup_Large_data()
QTest::addColumn<bool>("useStd");
QTest::addColumn<int>("size");
- for (int size = 10; size < 20000; size += 100) {
+ for (int size = 10; size < LARGE_MAX_SIZE; size += 100) {
const QByteArray sizeString = QByteArray::number(size);
QTest::newRow(("std::vector-Large--" + sizeString).constData()) << true << size;
QTest::newRow(("QVector-Large--" + sizeString).constData()) << false << size;
diff --git a/tests/benchmarks/events/main.cpp b/tests/benchmarks/events/main.cpp
index 7c9de8f..09d6c53 100644
--- a/tests/benchmarks/events/main.cpp
+++ b/tests/benchmarks/events/main.cpp
@@ -47,6 +47,7 @@ class PingPong : public QObject
{
public:
void setPeer(QObject *peer);
+ void resetCounter() {m_counter = 100;}
protected:
bool event(QEvent *e);
@@ -69,7 +70,7 @@ bool PingPong::event(QEvent *)
QEvent *e = new QEvent(QEvent::User);
QCoreApplication::postEvent(m_peer, e);
} else {
- QCoreApplication::quit();
+ QTestEventLoop::instance().exitLoop();
}
return true;
}
@@ -149,6 +150,10 @@ void EventsBench::sendEvent()
void EventsBench::postEvent_data()
{
QTest::addColumn<bool>("filterEvents");
+ // The first time an eventloop is executed, the case runs radically slower at least
+ // on some platforms, so test the "no eventfilter" case to get a comparable results
+ // with the "eventfilter" case.
+ QTest::newRow("first time, no eventfilter") << false;
QTest::newRow("no eventfilter") << false;
QTest::newRow("eventfilter") << true;
}
@@ -164,8 +169,14 @@ void EventsBench::postEvent()
ping.installEventFilter(this);
pong.installEventFilter(this);
}
- QEvent *e = new QEvent(QEvent::User);
+
QBENCHMARK {
+ // In case multiple iterations are done, event needs to be created inside the QBENCHMARK,
+ // or it gets deleted once first iteration exits and can cause a crash. Similarly,
+ // ping and pong need their counters reset.
+ QEvent *e = new QEvent(QEvent::User);
+ ping.resetCounter();
+ pong.resetCounter();
QCoreApplication::postEvent(&ping, e);
QTestEventLoop::instance().enterLoop( 61 );
}
diff --git a/tests/benchmarks/qbytearray/main.cpp b/tests/benchmarks/qbytearray/main.cpp
index 6a481f1..78c5b16 100644
--- a/tests/benchmarks/qbytearray/main.cpp
+++ b/tests/benchmarks/qbytearray/main.cpp
@@ -73,6 +73,11 @@ void tst_qbytearray::append()
{
QFETCH(int, size);
+#ifdef Q_OS_SYMBIAN
+ if (size > 1000000)
+ QSKIP("Skipped due to limited memory in many Symbian devices.", SkipSingle);
+#endif
+
QByteArray ba;
QBENCHMARK {
QByteArray ba2(size, 'x');
diff --git a/tests/benchmarks/qdiriterator/main.cpp b/tests/benchmarks/qdiriterator/main.cpp
index 2a400e3..9e4e53e 100644
--- a/tests/benchmarks/qdiriterator/main.cpp
+++ b/tests/benchmarks/qdiriterator/main.cpp
@@ -73,7 +73,7 @@ private slots:
void tst_qdiriterator::data()
{
-#ifdef Q_OS_WINCE
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
QByteArray qtdir = qPrintable(QCoreApplication::applicationDirPath());
qtdir += "/depot";
#else
@@ -148,9 +148,9 @@ static int posix_helper(const char *dirpath)
int count = 0;
while ((entry = ::readdir(dir))) {
- if (qstrcmp(entry->d_name, ".") == 0)
+ if (qstrcmp(entry->d_name, ".") == 0)
continue;
- if (qstrcmp(entry->d_name, "..") == 0)
+ if (qstrcmp(entry->d_name, "..") == 0)
continue;
++count;
QByteArray ba = dirpath;
@@ -198,7 +198,7 @@ void tst_qdiriterator::diriterator()
//QDir::AllEntries | QDir::Hidden,
QDir::Files,
QDirIterator::Subdirectories);
-
+
while (dir.hasNext()) {
dir.next();
//printf("%s\n", qPrintable(dir.fileName()));
@@ -231,7 +231,7 @@ void tst_qdiriterator::fsiterator()
//QDir::Files | QDir::NoDotAndDotDot,
QDir::Files,
QFileSystemIterator::Subdirectories);
-
+
for (; !dir.atEnd(); dir.next()) {
dump && printf("%d %s\n",
dir.fileInfo().isDir(),
diff --git a/tests/benchmarks/qdiriterator/qdiriterator.pro b/tests/benchmarks/qdiriterator/qdiriterator.pro
index fb4b753..e06d746 100755
--- a/tests/benchmarks/qdiriterator/qdiriterator.pro
+++ b/tests/benchmarks/qdiriterator/qdiriterator.pro
@@ -15,7 +15,7 @@ SOURCES += main.cpp
SOURCES += qfilesystemiterator.cpp
HEADERS += qfilesystemiterator.h
-wince*: {
+wince*|symbian: {
corelibdir.sources = $$QT_SOURCE_TREE/src/corelib
corelibdir.path = ./depot/src
DEPLOYMENT += corelibdir
diff --git a/tests/benchmarks/qfile/main.cpp b/tests/benchmarks/qfile/main.cpp
index d3f6ab5..4217077 100644
--- a/tests/benchmarks/qfile/main.cpp
+++ b/tests/benchmarks/qfile/main.cpp
@@ -128,12 +128,18 @@ private:
QString tmpDirName;
};
+Q_DECLARE_METATYPE(tst_qfile::BenchmarkType)
+Q_DECLARE_METATYPE(QIODevice::OpenMode)
+Q_DECLARE_METATYPE(QIODevice::OpenModeFlag)
+
void tst_qfile::createFile()
{
+ removeFile(); // Cleanup in case previous test case aborted before cleaning up
+
QTemporaryFile tmpFile;
tmpFile.setAutoRemove(false);
if (!tmpFile.open())
- ::_exit(1);
+ ::exit(1);
filename = tmpFile.fileName();
tmpFile.close();
}
@@ -217,7 +223,6 @@ void tst_qfile::readBigFile_data(BenchmarkType type, QIODevice::OpenModeFlag t,
for (int i=0; i<bs_entries; ++i)
QTest::newRow((QString("BS: %1, Flags: %2" )).arg(bs[i]).arg(flagstring).toLatin1().constData()) << type << bs[i] << t << b;
-
}
void tst_qfile::readBigFile()
@@ -227,8 +232,12 @@ void tst_qfile::readBigFile()
QFETCH(QFile::OpenModeFlag, textMode);
QFETCH(QFile::OpenModeFlag, bufferedMode);
- char buffer[BUFSIZE]; // we can't allocate buffers nice and dynamically in c++
- removeFile();
+#ifndef Q_OS_WIN
+ if (testType == Win32Benchmark)
+ QSKIP("This is Windows only benchmark.", SkipSingle);
+#endif
+
+ char *buffer = new char[BUFSIZE];
createFile();
fillFile();
@@ -297,6 +306,9 @@ void tst_qfile::readBigFile()
}
break;
}
+
+ removeFile();
+ delete[] buffer;
}
void tst_qfile::seek_data()
@@ -374,6 +386,8 @@ void tst_qfile::seek()
}
break;
}
+
+ removeFile();
}
void tst_qfile::open_data()
@@ -392,7 +406,6 @@ void tst_qfile::open()
{
QFETCH(tst_qfile::BenchmarkType, testType);
- removeFile();
createFile();
switch (testType) {
@@ -435,6 +448,7 @@ void tst_qfile::open()
file.open(cfile, QIODevice::ReadOnly);
file.close();
}
+ ::fclose(cfile);
}
break;
case(Win32Benchmark): {
@@ -456,6 +470,7 @@ void tst_qfile::open()
break;
}
+ removeFile();
}
@@ -515,15 +530,20 @@ void tst_qfile::readSmallFiles_data(BenchmarkType type, QIODevice::OpenModeFlag
void tst_qfile::createSmallFiles()
{
QDir dir = QDir::temp();
- Q_ASSERT(dir.mkdir("tst"));
+ dir.mkdir("tst");
dir.cd("tst");
tmpDirName = dir.absolutePath();
+#ifdef Q_OS_SYMBIAN
+ for (int i = 0; i < 100; ++i)
+#else
for (int i = 0; i < 1000; ++i)
+#endif
{
QFile f(tmpDirName+"/"+QString::number(i));
f.open(QIODevice::WriteOnly);
- f.seek(512);
+ f.seek(511);
+ f.putChar('\n');
f.close();
}
}
@@ -544,17 +564,22 @@ void tst_qfile::readSmallFiles()
QFETCH(QFile::OpenModeFlag, textMode);
QFETCH(QFile::OpenModeFlag, bufferedMode);
- removeSmallFiles();
+#ifndef Q_OS_WIN
+ if (testType == Win32Benchmark)
+ QSKIP("This is Windows only benchmark.", SkipSingle);
+#endif
+
createSmallFiles();
+
QDir dir(tmpDirName);
- const QStringList files = dir.entryList(QDir::NoDotAndDotDot|QDir::NoSymLinks);
- char buffer[BUFSIZE]; // we can't allocate buffers nice and dynamically in c++
+ const QStringList files = dir.entryList(QDir::NoDotAndDotDot|QDir::NoSymLinks|QDir::Files);
+ char *buffer = new char[BUFSIZE];
switch (testType) {
case(QFileBenchmark): {
QList<QFile*> fileList;
Q_FOREACH(QString file, files) {
- QFile *f = new QFile(file);
+ QFile *f = new QFile(tmpDirName+ "/" + file);
f->open(QIODevice::ReadOnly|textMode|bufferedMode);
fileList.append(f);
}
@@ -576,7 +601,7 @@ void tst_qfile::readSmallFiles()
case(QFSFileEngineBenchmark): {
QList<QFSFileEngine*> fileList;
Q_FOREACH(QString file, files) {
- QFSFileEngine *fse = new QFSFileEngine(file);
+ QFSFileEngine *fse = new QFSFileEngine(tmpDirName+ "/" + file);
fse->open(QIODevice::ReadOnly|textMode|bufferedMode);
fileList.append(fse);
}
@@ -596,7 +621,7 @@ void tst_qfile::readSmallFiles()
case(PosixBenchmark): {
QList<FILE*> fileList;
Q_FOREACH(QString file, files) {
- fileList.append(::fopen(QFile::encodeName(file).constData(), "rb"));
+ fileList.append(::fopen(QFile::encodeName(tmpDirName+ "/" + file).constData(), "rb"));
}
QBENCHMARK {
@@ -640,11 +665,10 @@ void tst_qfile::readSmallFiles()
}
break;
}
-}
-Q_DECLARE_METATYPE(tst_qfile::BenchmarkType)
-Q_DECLARE_METATYPE(QIODevice::OpenMode)
-Q_DECLARE_METATYPE(QIODevice::OpenModeFlag)
+ removeSmallFiles();
+ delete[] buffer;
+}
QTEST_MAIN(tst_qfile)
diff --git a/tests/benchmarks/qgraphicsview/qgraphicsview.pro b/tests/benchmarks/qgraphicsview/qgraphicsview.pro
index d9db8c9..927d731 100644
--- a/tests/benchmarks/qgraphicsview/qgraphicsview.pro
+++ b/tests/benchmarks/qgraphicsview/qgraphicsview.pro
@@ -6,3 +6,11 @@ SOURCES += tst_qgraphicsview.cpp
RESOURCES += qgraphicsview.qrc
include(chiptester/chiptester.pri)
+
+symbian {
+ qt_not_deployed {
+ plugins.sources = qjpeg.dll
+ plugins.path = imageformats
+ DEPLOYMENT += plugins
+ }
+}
diff --git a/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp b/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp
index aadd56c..cf65e5d 100644
--- a/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp
@@ -62,25 +62,25 @@ class QEventWaiter : public QEventLoop
{
public:
QEventWaiter(QObject *receiver, QEvent::Type type)
- : waiting(false), t(type)
+ : waiting(false), t(type)
{
- receiver->installEventFilter(this);
+ receiver->installEventFilter(this);
}
void wait()
{
- waiting = true;
- exec();
+ waiting = true;
+ exec();
}
bool eventFilter(QObject *receiver, QEvent *event)
{
- Q_UNUSED(receiver);
- if (waiting && event->type() == t) {
- waiting = false;
- exit();
- }
- return false;
+ Q_UNUSED(receiver);
+ if (waiting && event->type() == t) {
+ waiting = false;
+ exit();
+ }
+ return false;
}
private:
@@ -166,20 +166,26 @@ void tst_QGraphicsView::paintSingleItem()
QImage image(100, 100, QImage::Format_ARGB32_Premultiplied);
QPainter painter(&image);
QBENCHMARK {
- view.viewport()->render(&painter);
+ view.viewport()->render(&painter);
}
}
+#ifdef Q_OS_SYMBIAN
+# define DEEP_STACKING_COUNT 200
+#else
+# define DEEP_STACKING_COUNT 1000
+#endif
+
void tst_QGraphicsView::paintDeepStackingItems()
{
QGraphicsScene scene(0, 0, 100, 100);
QGraphicsRectItem *item = scene.addRect(0, 0, 10, 10);
QGraphicsRectItem *lastRect = item;
- for (int i = 0; i < 1000; ++i) {
- QGraphicsRectItem *rect = scene.addRect(0, 0, 10, 10);
- rect->setPos(1, 1);
- rect->setParentItem(lastRect);
- lastRect = rect;
+ for (int i = 0; i < DEEP_STACKING_COUNT; ++i) {
+ QGraphicsRectItem *rect = scene.addRect(0, 0, 10, 10);
+ rect->setPos(1, 1);
+ rect->setParentItem(lastRect);
+ lastRect = rect;
}
QGraphicsView view(&scene);
@@ -192,7 +198,7 @@ void tst_QGraphicsView::paintDeepStackingItems()
QImage image(100, 100, QImage::Format_ARGB32_Premultiplied);
QPainter painter(&image);
QBENCHMARK {
- view.viewport()->render(&painter);
+ view.viewport()->render(&painter);
}
}
@@ -202,11 +208,11 @@ void tst_QGraphicsView::paintDeepStackingItems_clipped()
QGraphicsRectItem *item = scene.addRect(0, 0, 10, 10);
item->setFlag(QGraphicsItem::ItemClipsChildrenToShape);
QGraphicsRectItem *lastRect = item;
- for (int i = 0; i < 1000; ++i) {
- QGraphicsRectItem *rect = scene.addRect(0, 0, 10, 10);
- rect->setPos(1, 1);
- rect->setParentItem(lastRect);
- lastRect = rect;
+ for (int i = 0; i < DEEP_STACKING_COUNT; ++i) {
+ QGraphicsRectItem *rect = scene.addRect(0, 0, 10, 10);
+ rect->setPos(1, 1);
+ rect->setParentItem(lastRect);
+ lastRect = rect;
}
QGraphicsView view(&scene);
@@ -219,7 +225,7 @@ void tst_QGraphicsView::paintDeepStackingItems_clipped()
QImage image(100, 100, QImage::Format_ARGB32_Premultiplied);
QPainter painter(&image);
QBENCHMARK {
- view.viewport()->render(&painter);
+ view.viewport()->render(&painter);
}
}
@@ -239,8 +245,8 @@ void tst_QGraphicsView::moveSingleItem()
int n = 1;
QBENCHMARK {
item->setPos(25 * n, 25 * n);
- waiter.wait();
- n = n ? 0 : 1;
+ waiter.wait();
+ n = n ? 0 : 1;
}
}
@@ -382,18 +388,18 @@ void tst_QGraphicsView::chipTester()
tester.setOpenGL(opengl);
tester.setOperation(ChipTester::Operation(operation));
QBENCHMARK {
- tester.runBenchmark();
+ tester.runBenchmark();
}
}
static void addChildHelper(QGraphicsItem *parent, int n, bool rotate)
{
if (!n)
- return;
+ return;
QGraphicsRectItem *item = new QGraphicsRectItem(QRectF(0, 0, 50, 50), parent);
item->setPos(10, 10);
if (rotate)
- item->rotate(10);
+ item->rotate(10);
addChildHelper(item, n - 1, rotate);
}
@@ -421,12 +427,12 @@ void tst_QGraphicsView::deepNesting()
QGraphicsScene scene;
for (int y = 0; y < 15; ++y) {
- for (int x = 0; x < 15; ++x) {
- QGraphicsItem *item1 = scene.addRect(QRectF(0, 0, 50, 50));
- if (rotate) item1->rotate(10);
- item1->setPos(x * 25, y * 25);
- addChildHelper(item1, 30, rotate);
- }
+ for (int x = 0; x < 15; ++x) {
+ QGraphicsItem *item1 = scene.addRect(QRectF(0, 0, 50, 50));
+ if (rotate) item1->rotate(10);
+ item1->setPos(x * 25, y * 25);
+ addChildHelper(item1, 30, rotate);
+ }
}
scene.setItemIndexMethod(bsp ? QGraphicsScene::BspTreeIndex : QGraphicsScene::NoIndex);
scene.setSortCacheEnabled(sortCache);
@@ -441,11 +447,11 @@ void tst_QGraphicsView::deepNesting()
QBENCHMARK {
#ifdef CALLGRIND_DEBUG
- CALLGRIND_START_INSTRUMENTATION
+ CALLGRIND_START_INSTRUMENTATION
#endif
- view.viewport()->repaint();
+ view.viewport()->repaint();
#ifdef CALLGRIND_DEBUG
- CALLGRIND_STOP_INSTRUMENTATION
+ CALLGRIND_STOP_INSTRUMENTATION
#endif
}
}
@@ -456,36 +462,36 @@ public:
AnimatedPixmapItem(int x, int y, bool rot, bool scal, QGraphicsItem *parent = 0)
: QGraphicsPixmapItem(parent), rotateFactor(0), scaleFactor(0)
{
- rotate = rot;
- scale = scal;
- xspeed = x;
- yspeed = y;
+ rotate = rot;
+ scale = scal;
+ xspeed = x;
+ yspeed = y;
}
protected:
void advance(int i)
- {
- if (!i)
- return;
- int x = int(pos().x()) + pixmap().width();
- x += xspeed;
- x = (x % (300 + pixmap().width() * 2)) - pixmap().width();
- int y = int(pos().y()) + pixmap().width();
- y += yspeed;
- y = (y % (300 + pixmap().width() * 2)) - pixmap().width();
- setPos(x, y);
-
- int rot = rotateFactor;
- int sca = scaleFactor;
+ {
+ if (!i)
+ return;
+ int x = int(pos().x()) + pixmap().width();
+ x += xspeed;
+ x = (x % (300 + pixmap().width() * 2)) - pixmap().width();
+ int y = int(pos().y()) + pixmap().width();
+ y += yspeed;
+ y = (y % (300 + pixmap().width() * 2)) - pixmap().width();
+ setPos(x, y);
+
+ int rot = rotateFactor;
+ int sca = scaleFactor;
if (rotate)
- rotateFactor = 1 + (rot + xspeed) % 360;
+ rotateFactor = 1 + (rot + xspeed) % 360;
if (scale)
- scaleFactor = 1 + (sca + yspeed) % 50;
+ scaleFactor = 1 + (sca + yspeed) % 50;
- if (rotate || scale) {
- qreal s = 0.5 + scaleFactor / 50.0;
- setTransform(QTransform().rotate(rotateFactor).scale(s, s));
- }
+ if (rotate || scale) {
+ qreal s = 0.5 + scaleFactor / 50.0;
+ setTransform(QTransform().rotate(rotateFactor).scale(s, s));
+ }
}
private:
@@ -543,38 +549,38 @@ void tst_QGraphicsView::imageRiver()
view.show();
QPixmap pix(":/images/designer.png");
- QVERIFY(!pix.isNull());
+ QVERIFY(!pix.isNull());
QList<QGraphicsItem *> items;
QFile file(":/random.data");
QVERIFY(file.open(QIODevice::ReadOnly));
QDataStream str(&file);
for (int i = 0; i < 100; ++i) {
- AnimatedPixmapItem *item;
- if (direction == 0) item = new AnimatedPixmapItem((i % 4) + 1, 0, rotation, scale);
- if (direction == 1) item = new AnimatedPixmapItem(0, (i % 4) + 1, rotation, scale);
- if (direction == 2) item = new AnimatedPixmapItem((i % 4) + 1, (i % 4) + 1, rotation, scale);
- item->setPixmap(pix);
+ AnimatedPixmapItem *item;
+ if (direction == 0) item = new AnimatedPixmapItem((i % 4) + 1, 0, rotation, scale);
+ if (direction == 1) item = new AnimatedPixmapItem(0, (i % 4) + 1, rotation, scale);
+ if (direction == 2) item = new AnimatedPixmapItem((i % 4) + 1, (i % 4) + 1, rotation, scale);
+ item->setPixmap(pix);
int rnd1, rnd2;
str >> rnd1 >> rnd2;
- item->setPos(-pix.width() + rnd1 % (view.width() + pix.width()),
- -pix.height() + rnd2 % (view.height() + pix.height()));
- scene.addItem(item);
+ item->setPos(-pix.width() + rnd1 % (view.width() + pix.width()),
+ -pix.height() + rnd2 % (view.height() + pix.height()));
+ scene.addItem(item);
}
view.count = 0;
QBENCHMARK {
#ifdef CALLGRIND_DEBUG
- CALLGRIND_START_INSTRUMENTATION
+ CALLGRIND_START_INSTRUMENTATION
#endif
- for (int i = 0; i < 100; ++i) {
- scene.advance();
- while (view.count < (i+1))
- qApp->processEvents();
- }
+ for (int i = 0; i < 100; ++i) {
+ scene.advance();
+ while (view.count < (i+1))
+ qApp->processEvents();
+ }
#ifdef CALLGRIND_DEBUG
- CALLGRIND_STOP_INSTRUMENTATION
+ CALLGRIND_STOP_INSTRUMENTATION
#endif
}
}
@@ -585,38 +591,38 @@ public:
AnimatedTextItem(int x, int y, bool rot, bool scal, QGraphicsItem *parent = 0)
: QGraphicsSimpleTextItem(parent), rotateFactor(0), scaleFactor(25)
{
- setText("River of text");
- rotate = rot;
- scale = scal;
- xspeed = x;
- yspeed = y;
+ setText("River of text");
+ rotate = rot;
+ scale = scal;
+ xspeed = x;
+ yspeed = y;
}
protected:
void advance(int i)
- {
- if (!i)
- return;
- QRect r = boundingRect().toRect();
- int x = int(pos().x()) + r.width();
- x += xspeed;
- x = (x % (300 + r.width() * 2)) - r.width();
- int y = int(pos().y()) + r.width();
- y += yspeed;
- y = (y % (300 + r.width() * 2)) - r.width();
- setPos(x, y);
-
- int rot = rotateFactor;
- int sca = scaleFactor;
+ {
+ if (!i)
+ return;
+ QRect r = boundingRect().toRect();
+ int x = int(pos().x()) + r.width();
+ x += xspeed;
+ x = (x % (300 + r.width() * 2)) - r.width();
+ int y = int(pos().y()) + r.width();
+ y += yspeed;
+ y = (y % (300 + r.width() * 2)) - r.width();
+ setPos(x, y);
+
+ int rot = rotateFactor;
+ int sca = scaleFactor;
if (rotate)
- rotateFactor = 1 + (rot + xspeed) % 360;
+ rotateFactor = 1 + (rot + xspeed) % 360;
if (scale)
- scaleFactor = 1 + (sca + yspeed) % 50;
+ scaleFactor = 1 + (sca + yspeed) % 50;
- if (rotate || scale) {
- qreal s = 0.5 + scaleFactor / 50.0;
- setTransform(QTransform().rotate(rotateFactor).scale(s, s));
- }
+ if (rotate || scale) {
+ qreal s = 0.5 + scaleFactor / 50.0;
+ setTransform(QTransform().rotate(rotateFactor).scale(s, s));
+ }
}
private:
@@ -657,37 +663,37 @@ void tst_QGraphicsView::textRiver()
view.show();
QPixmap pix(":/images/designer.png");
- QVERIFY(!pix.isNull());
+ QVERIFY(!pix.isNull());
QList<QGraphicsItem *> items;
QFile file(":/random.data");
QVERIFY(file.open(QIODevice::ReadOnly));
QDataStream str(&file);
for (int i = 0; i < 100; ++i) {
- AnimatedTextItem *item;
- if (direction == 0) item = new AnimatedTextItem((i % 4) + 1, 0, rotation, scale);
- if (direction == 1) item = new AnimatedTextItem(0, (i % 4) + 1, rotation, scale);
- if (direction == 2) item = new AnimatedTextItem((i % 4) + 1, (i % 4) + 1, rotation, scale);
+ AnimatedTextItem *item;
+ if (direction == 0) item = new AnimatedTextItem((i % 4) + 1, 0, rotation, scale);
+ if (direction == 1) item = new AnimatedTextItem(0, (i % 4) + 1, rotation, scale);
+ if (direction == 2) item = new AnimatedTextItem((i % 4) + 1, (i % 4) + 1, rotation, scale);
int rnd1, rnd2;
str >> rnd1 >> rnd2;
- item->setPos(-pix.width() + rnd1 % (view.width() + pix.width()),
- -pix.height() + rnd2 % (view.height() + pix.height()));
- scene.addItem(item);
+ item->setPos(-pix.width() + rnd1 % (view.width() + pix.width()),
+ -pix.height() + rnd2 % (view.height() + pix.height()));
+ scene.addItem(item);
}
view.count = 0;
QBENCHMARK {
#ifdef CALLGRIND_DEBUG
- CALLGRIND_START_INSTRUMENTATION
+ CALLGRIND_START_INSTRUMENTATION
#endif
- for (int i = 0; i < 100; ++i) {
- scene.advance();
- while (view.count < (i+1))
- qApp->processEvents();
- }
+ for (int i = 0; i < 100; ++i) {
+ scene.advance();
+ while (view.count < (i+1))
+ qApp->processEvents();
+ }
#ifdef CALLGRIND_DEBUG
- CALLGRIND_STOP_INSTRUMENTATION
+ CALLGRIND_STOP_INSTRUMENTATION
#endif
}
}
diff --git a/tests/benchmarks/qhostinfo/main.cpp b/tests/benchmarks/qhostinfo/main.cpp
new file mode 100644
index 0000000..80d0fd8
--- /dev/null
+++ b/tests/benchmarks/qhostinfo/main.cpp
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QDebug>
+#include <QHostInfo>
+#include <QStringList>
+#include <QString>
+
+#include <qtest.h>
+#include <qtesteventloop.h>
+
+class tst_qhostinfo : public QObject
+{
+ Q_OBJECT
+private slots:
+ void lookupSpeed();
+};
+
+class SignalReceiver : public QObject
+{
+ Q_OBJECT
+public:
+ SignalReceiver(int nrc) : receiveCount(0), neededReceiveCount(nrc) {};
+ int receiveCount;
+ int neededReceiveCount;
+public slots:
+ void resultsReady(const QHostInfo) {
+ receiveCount++;
+ if (receiveCount == neededReceiveCount)
+ QTestEventLoop::instance().exitLoop();
+ }
+};
+
+void tst_qhostinfo::lookupSpeed()
+{
+ QStringList hostnameList;
+ hostnameList << "www.ovi.com" << "www.nokia.com" << "qt.nokia.com" << "www.trolltech.com" << "troll.no"
+ << "www.qtcentre.org" << "forum.nokia.com" << "www.forum.nokia.com" << "wiki.forum.nokia.com"
+ << "www.nokia.no" << "nokia.de" << "127.0.0.1" << "----";
+ // also add some duplicates:
+ hostnameList << "www.nokia.com" << "127.0.0.1" << "www.trolltech.com";
+ const int COUNT = hostnameList.size();
+
+ SignalReceiver receiver(COUNT);
+
+ QBENCHMARK {
+ for (int i = 0; i < hostnameList.size(); i++)
+ QHostInfo::lookupHost(hostnameList.at(i), &receiver, SLOT(resultsReady(const QHostInfo)));
+ QTestEventLoop::instance().enterLoop(20);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+ }
+}
+
+
+QTEST_MAIN(tst_qhostinfo)
+
+#include "main.moc"
diff --git a/tests/benchmarks/qhostinfo/qhostinfo.pro b/tests/benchmarks/qhostinfo/qhostinfo.pro
new file mode 100755
index 0000000..f18d6d7
--- /dev/null
+++ b/tests/benchmarks/qhostinfo/qhostinfo.pro
@@ -0,0 +1,13 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = tst_qhostinfo
+DEPENDPATH += .
+INCLUDEPATH += .
+
+QT -= gui
+QT += network
+
+CONFIG += release
+
+# Input
+SOURCES += main.cpp
diff --git a/tests/benchmarks/qstringlist/qstringlist.pro b/tests/benchmarks/qstringlist/qstringlist.pro
index f9ebd59..11cceb0 100644
--- a/tests/benchmarks/qstringlist/qstringlist.pro
+++ b/tests/benchmarks/qstringlist/qstringlist.pro
@@ -2,3 +2,5 @@ load(qttest_p4)
TARGET = tst_qstringlist
QT -= gui
SOURCES += main.cpp
+
+symbian: LIBS += -llibpthread
diff --git a/tests/benchmarks/qstylesheetstyle/main.cpp b/tests/benchmarks/qstylesheetstyle/main.cpp
index 19efcab..d6fa48c 100644
--- a/tests/benchmarks/qstylesheetstyle/main.cpp
+++ b/tests/benchmarks/qstylesheetstyle/main.cpp
@@ -49,16 +49,16 @@ class tst_qstylesheetstyle : public QObject
private slots:
void empty();
void empty_events();
-
+
void simple();
void simple_events();
-
+
void grid_data();
void grid();
-
+
private:
QWidget *buildSimpleWidgets();
-
+
};
@@ -103,7 +103,7 @@ void tst_qstylesheetstyle::empty_events()
delete w;
}
-static const char *simple_css =
+static const char *simple_css =
" QLineEdit { background: red; } QPushButton { border: 1px solid yellow; color: pink; } \n"
" QCheckBox { margin: 3px 5px; background-color:red; } QAbstractButton { background-color: #456; } \n"
" QFrame { padding: 3px; } QLabel { color: black } QSpinBox:hover { background-color:blue; } ";
@@ -138,7 +138,7 @@ void tst_qstylesheetstyle::grid_data()
QTest::addColumn<bool>("events");
QTest::addColumn<bool>("show");
QTest::addColumn<int>("N");
- for (int n = 5; n <= 25; n += 5) {
+ for (int n = 5; n <= 25; n += 5) {
const QByteArray nString = QByteArray::number(n*n);
QTest::newRow(("simple--" + nString).constData()) << false << false << n;
QTest::newRow(("events--" + nString).constData()) << true << false << n;
@@ -153,6 +153,13 @@ void tst_qstylesheetstyle::grid()
QFETCH(bool, show);
QFETCH(int, N);
+#ifdef Q_OS_SYMBIAN
+ // Symbian has limited stack (max 80k), which will run out when N >= 20 due to
+ // QWidget::show() using recursion among grid labels somewhere down the line.
+ if (show && N >= 20)
+ QSKIP("Grid too big for device to show", SkipSingle);
+#endif
+
QWidget *w = new QWidget();
QGridLayout *layout = new QGridLayout(w);
w->setLayout(layout);
diff --git a/tests/benchmarks/qtcpserver/qtcpserver.pro b/tests/benchmarks/qtcpserver/qtcpserver.pro
new file mode 100644
index 0000000..e7bf13a
--- /dev/null
+++ b/tests/benchmarks/qtcpserver/qtcpserver.pro
@@ -0,0 +1,13 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = tst_qtcpserver
+DEPENDPATH += .
+INCLUDEPATH += .
+
+QT -= gui
+QT += network
+
+CONFIG += release
+
+# Input
+SOURCES += tst_qtcpserver.cpp
diff --git a/tests/benchmarks/qtcpserver/tst_qtcpserver.cpp b/tests/benchmarks/qtcpserver/tst_qtcpserver.cpp
new file mode 100644
index 0000000..07640b8
--- /dev/null
+++ b/tests/benchmarks/qtcpserver/tst_qtcpserver.cpp
@@ -0,0 +1,277 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// Just to get Q_OS_SYMBIAN
+#include <qglobal.h>
+
+#include <QtTest/QtTest>
+
+
+#include <qcoreapplication.h>
+#include <qtcpsocket.h>
+#include <qtcpserver.h>
+#include <qhostaddress.h>
+#include <qprocess.h>
+#include <qstringlist.h>
+#include <qplatformdefs.h>
+#include <qhostinfo.h>
+
+#include <QNetworkProxy>
+Q_DECLARE_METATYPE(QNetworkProxy)
+Q_DECLARE_METATYPE(QList<QNetworkProxy>)
+
+#include "../../auto/network-settings.h"
+
+//TESTED_CLASS=
+//TESTED_FILES=
+
+class tst_QTcpServer : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QTcpServer();
+ virtual ~tst_QTcpServer();
+
+
+public slots:
+ void initTestCase_data();
+ void init();
+ void cleanup();
+private slots:
+ void ipv4LoopbackPerformanceTest();
+ void ipv6LoopbackPerformanceTest();
+ void ipv4PerformanceTest();
+};
+
+tst_QTcpServer::tst_QTcpServer()
+{
+ Q_SET_DEFAULT_IAP
+}
+
+tst_QTcpServer::~tst_QTcpServer()
+{
+}
+
+void tst_QTcpServer::initTestCase_data()
+{
+ QTest::addColumn<bool>("setProxy");
+ QTest::addColumn<int>("proxyType");
+
+ QTest::newRow("WithoutProxy") << false << 0;
+ QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy);
+}
+
+void tst_QTcpServer::init()
+{
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy) {
+ QFETCH_GLOBAL(int, proxyType);
+ if (proxyType == QNetworkProxy::Socks5Proxy) {
+ QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080));
+ }
+ }
+}
+
+void tst_QTcpServer::cleanup()
+{
+ QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy);
+}
+
+//----------------------------------------------------------------------------------
+void tst_QTcpServer::ipv4LoopbackPerformanceTest()
+{
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy)
+ return;
+
+ QTcpServer server;
+ QVERIFY(server.listen(QHostAddress::LocalHost));
+
+ QVERIFY(server.isListening());
+
+ QTcpSocket clientA;
+ clientA.connectToHost(QHostAddress::LocalHost, server.serverPort());
+ QVERIFY(clientA.waitForConnected(5000));
+ QVERIFY(clientA.state() == QAbstractSocket::ConnectedState);
+
+ QVERIFY(server.waitForNewConnection());
+ QTcpSocket *clientB = server.nextPendingConnection();
+ QVERIFY(clientB);
+
+ QByteArray buffer(16384, '@');
+ QTime stopWatch;
+ stopWatch.start();
+ qlonglong totalWritten = 0;
+ while (stopWatch.elapsed() < 5000) {
+ QVERIFY(clientA.write(buffer.data(), buffer.size()) > 0);
+ clientA.flush();
+ totalWritten += buffer.size();
+ while (clientB->waitForReadyRead(100)) {
+ if (clientB->bytesAvailable() == 16384)
+ break;
+ }
+ clientB->read(buffer.data(), buffer.size());
+ clientB->write(buffer.data(), buffer.size());
+ clientB->flush();
+ totalWritten += buffer.size();
+ while (clientA.waitForReadyRead(100)) {
+ if (clientA.bytesAvailable() == 16384)
+ break;
+ }
+ clientA.read(buffer.data(), buffer.size());
+ }
+
+ qDebug("\t\t%s: %.1fMB/%.1fs: %.1fMB/s",
+ server.serverAddress().toString().toLatin1().constData(),
+ totalWritten / (1024.0 * 1024.0),
+ stopWatch.elapsed() / 1000.0,
+ (totalWritten / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024));
+
+ delete clientB;
+}
+
+//----------------------------------------------------------------------------------
+void tst_QTcpServer::ipv6LoopbackPerformanceTest()
+{
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy)
+ return;
+
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Symbian: IPv6 is not yet supported", SkipAll);
+#endif
+ QTcpServer server;
+ if (!server.listen(QHostAddress::LocalHostIPv6, 0)) {
+ QVERIFY(server.serverError() == QAbstractSocket::UnsupportedSocketOperationError);
+ } else {
+ QTcpSocket clientA;
+ clientA.connectToHost(server.serverAddress(), server.serverPort());
+ QVERIFY(clientA.waitForConnected(5000));
+
+ QVERIFY(server.waitForNewConnection(5000));
+ QTcpSocket *clientB = server.nextPendingConnection();
+ QVERIFY(clientB);
+
+ QByteArray buffer(16384, '@');
+ QTime stopWatch;
+ stopWatch.start();
+ qlonglong totalWritten = 0;
+ while (stopWatch.elapsed() < 5000) {
+ clientA.write(buffer.data(), buffer.size());
+ clientA.flush();
+ totalWritten += buffer.size();
+ while (clientB->waitForReadyRead(100)) {
+ if (clientB->bytesAvailable() == 16384)
+ break;
+ }
+ clientB->read(buffer.data(), buffer.size());
+ clientB->write(buffer.data(), buffer.size());
+ clientB->flush();
+ totalWritten += buffer.size();
+ while (clientA.waitForReadyRead(100)) {
+ if (clientA.bytesAvailable() == 16384)
+ break;
+ }
+ clientA.read(buffer.data(), buffer.size());
+ }
+
+ qDebug("\t\t%s: %.1fMB/%.1fs: %.1fMB/s",
+ server.serverAddress().toString().toLatin1().constData(),
+ totalWritten / (1024.0 * 1024.0),
+ stopWatch.elapsed() / 1000.0,
+ (totalWritten / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024));
+ delete clientB;
+ }
+}
+
+//----------------------------------------------------------------------------------
+void tst_QTcpServer::ipv4PerformanceTest()
+{
+ QTcpSocket probeSocket;
+ probeSocket.connectToHost(QtNetworkSettings::serverName(), 143);
+ QVERIFY(probeSocket.waitForConnected(5000));
+
+ QTcpServer server;
+ QVERIFY(server.listen(probeSocket.localAddress(), 0));
+
+ QTcpSocket clientA;
+ clientA.connectToHost(server.serverAddress(), server.serverPort());
+ QVERIFY(clientA.waitForConnected(5000));
+
+ QVERIFY(server.waitForNewConnection(5000));
+ QTcpSocket *clientB = server.nextPendingConnection();
+ QVERIFY(clientB);
+
+ QByteArray buffer(16384, '@');
+ QTime stopWatch;
+ stopWatch.start();
+ qlonglong totalWritten = 0;
+ while (stopWatch.elapsed() < 5000) {
+ qlonglong writtenA = clientA.write(buffer.data(), buffer.size());
+ clientA.flush();
+ totalWritten += buffer.size();
+ while (clientB->waitForReadyRead(100)) {
+ if (clientB->bytesAvailable() == writtenA)
+ break;
+ }
+ clientB->read(buffer.data(), buffer.size());
+ qlonglong writtenB = clientB->write(buffer.data(), buffer.size());
+ clientB->flush();
+ totalWritten += buffer.size();
+ while (clientA.waitForReadyRead(100)) {
+ if (clientA.bytesAvailable() == writtenB)
+ break;
+ }
+ clientA.read(buffer.data(), buffer.size());
+ }
+
+ qDebug("\t\t%s: %.1fMB/%.1fs: %.1fMB/s",
+ probeSocket.localAddress().toString().toLatin1().constData(),
+ totalWritten / (1024.0 * 1024.0),
+ stopWatch.elapsed() / 1000.0,
+ (totalWritten / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024));
+
+ delete clientB;
+}
+
+QTEST_MAIN(tst_QTcpServer)
+#include "tst_qtcpserver.moc"
diff --git a/tests/benchmarks/qthreadstorage/qthreadstorage.pro b/tests/benchmarks/qthreadstorage/qthreadstorage.pro
new file mode 100644
index 0000000..f9c1978
--- /dev/null
+++ b/tests/benchmarks/qthreadstorage/qthreadstorage.pro
@@ -0,0 +1,6 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = tst_qthreadstorage
+
+SOURCES += tst_qthreadstorage.cpp
+
diff --git a/tests/benchmarks/qthreadstorage/tst_qthreadstorage.cpp b/tests/benchmarks/qthreadstorage/tst_qthreadstorage.cpp
new file mode 100644
index 0000000..c00bf5a
--- /dev/null
+++ b/tests/benchmarks/qthreadstorage/tst_qthreadstorage.cpp
@@ -0,0 +1,124 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QtCore>
+
+//TESTED_FILES=
+
+QThreadStorage<int *> dummy[8];
+
+QThreadStorage<QString *> tls1;
+
+class tst_QThreadStorage : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QThreadStorage();
+ virtual ~tst_QThreadStorage();
+
+public slots:
+ void init();
+ void cleanup();
+
+private slots:
+ void construct();
+ void get();
+ void set();
+};
+
+tst_QThreadStorage::tst_QThreadStorage()
+{
+}
+
+tst_QThreadStorage::~tst_QThreadStorage()
+{
+}
+
+void tst_QThreadStorage::init()
+{
+ dummy[1].setLocalData(new int(5));
+ dummy[2].setLocalData(new int(4));
+ dummy[3].setLocalData(new int(3));
+ tls1.setLocalData(new QString());
+}
+
+void tst_QThreadStorage::cleanup()
+{
+}
+
+void tst_QThreadStorage::construct()
+{
+ QBENCHMARK {
+ QThreadStorage<int *> ts;
+ }
+}
+
+
+void tst_QThreadStorage::get()
+{
+ QThreadStorage<int *> ts;
+ ts.setLocalData(new int(45));
+
+ int count = 0;
+ QBENCHMARK {
+ int *i = ts.localData();
+ count += *i;
+ }
+ ts.setLocalData(0);
+}
+
+void tst_QThreadStorage::set()
+{
+ QThreadStorage<int *> ts;
+
+ int count = 0;
+ QBENCHMARK {
+ ts.setLocalData(new int(count));
+ count++;
+ }
+ ts.setLocalData(0);
+}
+
+
+QTEST_MAIN(tst_QThreadStorage)
+#include "tst_qthreadstorage.moc"
diff --git a/tests/manual/qgraphicsitemgroup/customitem.cpp b/tests/manual/qgraphicsitemgroup/customitem.cpp
new file mode 100644
index 0000000..16da0c5
--- /dev/null
+++ b/tests/manual/qgraphicsitemgroup/customitem.cpp
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "customitem.h"
+
+#include <QPainter>
+#include <QStyle>
+#include <QStyleOption>
+
+QList<CustomGroup*> CustomScene::selectedCustomGroups() const
+{
+ QList<QGraphicsItem*> all = selectedItems();
+ QList<CustomGroup*> groups;
+
+ foreach (QGraphicsItem *item, all) {
+ CustomGroup* group = dynamic_cast<CustomGroup*>(item);
+ if (group)
+ groups.append(group);
+ }
+
+ return groups;
+}
+
+QList<CustomItem*> CustomScene::selectedCustomItems() const
+{
+ QList<QGraphicsItem*> all = selectedItems();
+ QList<CustomItem*> items;
+
+ foreach (QGraphicsItem *item, all) {
+ CustomItem* citem = dynamic_cast<CustomItem*>(item);
+ if (citem)
+ items.append(citem);
+ }
+
+ return items;
+}
+
+CustomGroup::CustomGroup() :
+ QGraphicsItemGroup()
+{
+ setFlag(QGraphicsItem::ItemIsMovable);
+ setFlag(QGraphicsItem::ItemIsSelectable);
+}
+
+void CustomGroup::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+ if (option->state & QStyle::State_Selected)
+ painter->setOpacity(1.);
+ else
+ painter->setOpacity(0.2);
+
+ painter->setPen(QPen(QColor(100, 100, 100), 2, Qt::DashLine));
+ painter->drawRect(boundingRect().adjusted(-2, -2, 2, 2));
+}
+
+QRectF CustomGroup::boundingRect() const
+{
+ return QGraphicsItemGroup::boundingRect().adjusted(-4, -4, 4 ,4);
+}
+
+CustomItem::CustomItem(qreal x, qreal y, qreal width, qreal height, const QBrush &brush) :
+ QGraphicsRectItem(x, y, width, height)
+{
+ setFlag(QGraphicsItem::ItemIsMovable);
+ setFlag(QGraphicsItem::ItemIsSelectable);
+ setBrush(brush);
+ setPen(Qt::NoPen);
+ setTransformOriginPoint(boundingRect().center());
+}
diff --git a/tests/manual/qgraphicsitemgroup/customitem.h b/tests/manual/qgraphicsitemgroup/customitem.h
new file mode 100644
index 0000000..387c8ce
--- /dev/null
+++ b/tests/manual/qgraphicsitemgroup/customitem.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CUSTOMITEM_H
+#define CUSTOMITEM_H
+
+#include <QGraphicsItem>
+#include <QBrush>
+#include <QGraphicsScene>
+
+class CustomGroup : public QGraphicsItemGroup
+{
+public:
+ CustomGroup();
+ virtual ~CustomGroup() { }
+
+protected:
+ virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+ virtual QRectF boundingRect() const;
+};
+
+class CustomItem : public QGraphicsRectItem
+{
+public:
+ CustomItem(qreal x, qreal y, qreal width, qreal height, const QBrush & brush = QBrush());
+ virtual ~CustomItem() { }
+};
+
+class CustomScene : public QGraphicsScene
+{
+ Q_OBJECT
+public:
+ CustomScene() : QGraphicsScene() { }
+
+ QList<CustomItem*> selectedCustomItems() const;
+ QList<CustomGroup*> selectedCustomGroups() const;
+};
+
+#endif // CUSTOMITEM_H
diff --git a/tests/manual/qgraphicsitemgroup/main.cpp b/tests/manual/qgraphicsitemgroup/main.cpp
new file mode 100644
index 0000000..e7a6e11
--- /dev/null
+++ b/tests/manual/qgraphicsitemgroup/main.cpp
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui/QApplication>
+#include "widget.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ Widget w;
+ w.show();
+ return a.exec();
+}
diff --git a/tests/manual/qgraphicsitemgroup/qgraphicsitemgroup.pro b/tests/manual/qgraphicsitemgroup/qgraphicsitemgroup.pro
new file mode 100644
index 0000000..6676a2e
--- /dev/null
+++ b/tests/manual/qgraphicsitemgroup/qgraphicsitemgroup.pro
@@ -0,0 +1,8 @@
+TARGET = qgraphicsitemgroup
+TEMPLATE = app
+SOURCES += main.cpp \
+ widget.cpp \
+ customitem.cpp
+HEADERS += widget.h \
+ customitem.h
+FORMS += widget.ui
diff --git a/tests/manual/qgraphicsitemgroup/widget.cpp b/tests/manual/qgraphicsitemgroup/widget.cpp
new file mode 100644
index 0000000..23bee3f
--- /dev/null
+++ b/tests/manual/qgraphicsitemgroup/widget.cpp
@@ -0,0 +1,260 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "widget.h"
+#include "ui_widget.h"
+#include <QGraphicsOpacityEffect>
+#include <QPropertyAnimation>
+
+Widget::Widget(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::Widget),
+ previousSelectionCount(0)
+{
+ ui->setupUi(this);
+
+ effect = new QGraphicsOpacityEffect;
+ effect->setOpacity(0.3);
+ ui->groupBox->setGraphicsEffect(effect);
+
+ fadeIn = new QPropertyAnimation(effect, "opacity");
+ fadeIn->setDuration(200);
+ fadeIn->setStartValue(0.3);
+ fadeIn->setEndValue(1.);
+
+ fadeOut = new QPropertyAnimation(effect, "opacity");
+ fadeOut->setDuration(200);
+ fadeOut->setStartValue(1.);
+ fadeOut->setEndValue(0.3);
+
+ scene = new CustomScene;
+ scene->setSceneRect(-250,-250,500,500);
+ ui->view->setScene(scene);
+ scene->setBackgroundBrush(Qt::white);
+ ui->view->setInteractive(true);
+ ui->view->setDragMode(QGraphicsView::RubberBandDrag);
+ ui->view->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
+ ui->view->setRenderHints( QPainter::SmoothPixmapTransform |
+ QPainter::TextAntialiasing |
+ QPainter::Antialiasing );
+
+ rectBlue = new CustomItem(-100, -100, 50, 50, QColor(80, 80, 200));
+ scene->addItem(rectBlue);
+ rectGreen = new CustomItem(100, -100, 50, 50, QColor(80, 200, 80));
+ scene->addItem(rectGreen);
+ rectRed = new CustomItem(-100, 100, 50, 50, QColor(200, 80, 80));
+ scene->addItem(rectRed);
+ rectYellow = new CustomItem(100, 100, 50, 50, QColor(200, 200, 20));
+ scene->addItem(rectYellow);
+
+ connect(scene, SIGNAL(selectionChanged()), this, SLOT(onSceneSelectionChanged()));
+}
+
+Widget::~Widget()
+{
+ delete ui;
+ delete fadeIn;
+ delete fadeOut;
+}
+
+void Widget::on_rotate_valueChanged(int value)
+{
+ if (scene->selectedItems().count() != 1)
+ return;
+
+ QGraphicsItem *item = scene->selectedItems().at(0);
+ item->setRotation(value);
+ ui->rotateItem->setValue(checkedItem()->rotation());
+}
+
+void Widget::on_scale_valueChanged(int value)
+{
+ if (scene->selectedItems().count() != 1)
+ return;
+
+ QGraphicsItem *item = scene->selectedItems().at(0);
+ item->setScale(value / 10.);
+ ui->scaleItem->setValue(checkedItem()->scale() * 10);
+}
+
+void Widget::on_rotateItem_valueChanged(int value)
+{
+ if (!scene->selectedItems().empty() && scene->selectedItems().at(0) == checkedItem())
+ ui->rotate->setValue(value);
+ else
+ checkedItem()->setRotation(value);
+}
+
+void Widget::on_scaleItem_valueChanged(int value)
+{
+ if (!scene->selectedItems().empty() && scene->selectedItems().at(0) == checkedItem())
+ ui->scale->setValue(value);
+ else
+ checkedItem()->setScale(value / 10.);
+}
+
+void Widget::on_group_clicked()
+{
+ QList<QGraphicsItem*> all = scene->selectedItems();
+ if (all.size() < 2)
+ return;
+
+ QList<CustomItem*> items = scene->selectedCustomItems();
+ QList<CustomGroup*> groups = scene->selectedCustomGroups();
+
+ if (groups.size() == 1) {
+ foreach (CustomItem *item, items) {
+ item->setSelected(false);
+ groups[0]->addToGroup(item);
+ }
+
+ return;
+ }
+
+ CustomGroup* group = new CustomGroup;
+ scene->addItem(group);
+ foreach (QGraphicsItem *item, all) {
+ item->setSelected(false);
+ group->addToGroup(item);
+ }
+ group->setSelected(true);
+
+ updateUngroupButton();
+}
+
+void Widget::on_dismantle_clicked()
+{
+ QList<CustomGroup*> groups = scene->selectedCustomGroups();
+
+ foreach (CustomGroup *group, groups) {
+ foreach (QGraphicsItem *item, group->childItems())
+ group->removeFromGroup(item);
+
+ delete group;
+ }
+
+ updateUngroupButton();
+}
+
+void Widget::on_merge_clicked()
+{
+ QList<CustomGroup*> groups = scene->selectedCustomGroups();
+ if (groups.size() < 2)
+ return;
+
+ CustomGroup *newBigGroup = groups.takeFirst();
+ foreach (CustomGroup *group, groups) {
+ foreach (QGraphicsItem *item, group->childItems())
+ item->setGroup(newBigGroup);
+
+ delete group;
+ }
+}
+
+void Widget::onSceneSelectionChanged()
+{
+ QList<QGraphicsItem*> all = scene->selectedItems();
+ QList<CustomGroup*> groups = scene->selectedCustomGroups();
+
+ if (all.empty() && all.count() != previousSelectionCount) {
+ fadeOut->start();
+ } else if (previousSelectionCount == 0) {
+ fadeIn->start();
+ }
+
+ if (all.count() == 1) {
+ QGraphicsItem *item = all.at(0);
+ ui->rotate->setValue(item->rotation());
+ ui->scale->setValue(item->scale() * 10);
+ } else {
+ ui->rotate->setValue(ui->rotate->minimum());
+ ui->scale->setValue(ui->scale->minimum());
+ }
+
+ ui->rotate->setEnabled(all.size() == 1);
+ ui->scale->setEnabled(all.size() == 1);
+ ui->group->setEnabled(all.size() > 1);
+ ui->dismantle->setEnabled(!groups.empty());
+ ui->merge->setEnabled(groups.size() > 1);
+
+ previousSelectionCount = all.size();
+
+ updateUngroupButton();
+}
+
+void Widget::on_ungroup_clicked()
+{
+ QGraphicsItemGroup *oldGroup = checkedItem()->group();
+ checkedItem()->setGroup(0);
+ if (oldGroup && oldGroup->childItems().empty())
+ delete oldGroup;
+
+ updateUngroupButton();
+}
+
+void Widget::updateUngroupButton()
+{
+ ui->ungroup->setEnabled(checkedItem()->group() != 0);
+}
+
+CustomItem * Widget::checkedItem() const
+{
+ CustomItem *item;
+
+ if (ui->blue->isChecked())
+ item = rectBlue;
+ else if (ui->red->isChecked())
+ item = rectRed;
+ else if (ui->green->isChecked())
+ item = rectGreen;
+ else if (ui->yellow->isChecked())
+ item = rectYellow;
+
+ return item;
+}
+
+void Widget::on_buttonGroup_buttonClicked()
+{
+ ui->rotateItem->setValue(checkedItem()->rotation());
+ ui->scaleItem->setValue(checkedItem()->scale() * 10);
+
+ updateUngroupButton();
+}
diff --git a/tests/manual/qgraphicsitemgroup/widget.h b/tests/manual/qgraphicsitemgroup/widget.h
new file mode 100644
index 0000000..affc436
--- /dev/null
+++ b/tests/manual/qgraphicsitemgroup/widget.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef WIDGET_H
+#define WIDGET_H
+
+#include "customitem.h"
+
+#include <QWidget>
+#include <QGraphicsItemGroup>
+#include <QPainter>
+
+namespace Ui {
+ class Widget;
+}
+
+class QGraphicsOpacityEffect;
+class QPropertyAnimation;
+
+class Widget : public QWidget
+{
+ Q_OBJECT
+public:
+ Widget(QWidget *parent = 0);
+ ~Widget();
+
+protected Q_SLOTS:
+ void on_rotate_valueChanged(int value);
+ void on_scale_valueChanged(int value);
+ void on_rotateItem_valueChanged(int value);
+ void on_scaleItem_valueChanged(int value);
+ void on_group_clicked();
+ void on_dismantle_clicked();
+ void on_merge_clicked();
+ void onSceneSelectionChanged();
+ void on_ungroup_clicked();
+ void on_buttonGroup_buttonClicked();
+
+private:
+ void updateUngroupButton();
+ CustomItem * checkedItem() const;
+
+ Ui::Widget *ui;
+ CustomScene *scene;
+ CustomItem *rectBlue;
+ CustomItem *rectRed;
+ CustomItem *rectGreen;
+ CustomItem *rectYellow;
+ QGraphicsOpacityEffect* effect;
+ QPropertyAnimation *fadeIn;
+ QPropertyAnimation *fadeOut;
+ int previousSelectionCount;
+};
+
+#endif // WIDGET_H
diff --git a/tests/manual/qgraphicsitemgroup/widget.ui b/tests/manual/qgraphicsitemgroup/widget.ui
new file mode 100644
index 0000000..7e3a4df
--- /dev/null
+++ b/tests/manual/qgraphicsitemgroup/widget.ui
@@ -0,0 +1,319 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Widget</class>
+ <widget class="QWidget" name="Widget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>782</width>
+ <height>695</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Widget</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="title">
+ <string>Items</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_6">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <widget class="QRadioButton" name="blue">
+ <property name="text">
+ <string>Blue</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <attribute name="buttonGroup">
+ <string>buttonGroup</string>
+ </attribute>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="red">
+ <property name="text">
+ <string>Red</string>
+ </property>
+ <attribute name="buttonGroup">
+ <string>buttonGroup</string>
+ </attribute>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="green">
+ <property name="text">
+ <string>Green</string>
+ </property>
+ <attribute name="buttonGroup">
+ <string>buttonGroup</string>
+ </attribute>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="yellow">
+ <property name="text">
+ <string>Yellow</string>
+ </property>
+ <attribute name="buttonGroup">
+ <string>buttonGroup</string>
+ </attribute>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_5">
+ <item>
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Rotate</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSlider" name="rotateItem">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>120</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximum">
+ <number>360</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Scale</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSlider" name="scaleItem">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>120</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="minimum">
+ <number>5</number>
+ </property>
+ <property name="maximum">
+ <number>30</number>
+ </property>
+ <property name="value">
+ <number>10</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QPushButton" name="ungroup">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Ungroup</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>50</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>300</width>
+ <height>164</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>300</width>
+ <height>164</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>Selection</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Rotate</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSlider" name="rotate">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>120</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximum">
+ <number>360</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Scale</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSlider" name="scale">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>120</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="minimum">
+ <number>5</number>
+ </property>
+ <property name="maximum">
+ <number>30</number>
+ </property>
+ <property name="value">
+ <number>10</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QPushButton" name="group">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Group</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="merge">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Merge Groups</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="dismantle">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Dismantle Group</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </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>
+ <item>
+ <widget class="QGraphicsView" name="view"/>
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <resources/>
+ <connections/>
+ <buttongroups>
+ <buttongroup name="buttonGroup"/>
+ </buttongroups>
+</ui>
diff --git a/tools/assistant/lib/qhelpindexwidget.cpp b/tools/assistant/lib/qhelpindexwidget.cpp
index 475a1fe..6cf1a72 100644
--- a/tools/assistant/lib/qhelpindexwidget.cpp
+++ b/tools/assistant/lib/qhelpindexwidget.cpp
@@ -130,6 +130,7 @@ void QHelpIndexProvider::stopCollecting()
m_abort = true;
m_mutex.unlock();
wait();
+ m_abort = false;
}
QStringList QHelpIndexProvider::indices() const
@@ -164,7 +165,6 @@ void QHelpIndexProvider::run()
foreach (QString dbFileName, m_helpEngine->fileNameReaderMap.keys()) {
m_mutex.lock();
if (m_abort) {
- m_abort = false;
m_mutex.unlock();
return;
}
@@ -181,7 +181,6 @@ void QHelpIndexProvider::run()
foreach (QString s, lst)
indicesSet.insert(s);
if (m_abort) {
- m_abort = false;
m_mutex.unlock();
return;
}
@@ -194,7 +193,6 @@ void QHelpIndexProvider::run()
m_mutex.lock();
m_indices = indicesSet.values();
qSort(m_indices.begin(), m_indices.end(), caseInsensitiveLessThan);
- m_abort = false;
m_mutex.unlock();
}
diff --git a/tools/assistant/lib/qhelpsearchengine.h b/tools/assistant/lib/qhelpsearchengine.h
index 21f04c5..632ac0b 100644
--- a/tools/assistant/lib/qhelpsearchengine.h
+++ b/tools/assistant/lib/qhelpsearchengine.h
@@ -86,7 +86,9 @@ public:
QHelpSearchQueryWidget* queryWidget();
QHelpSearchResultWidget* resultWidget();
+#ifdef QT_DEPRECATED
QT_DEPRECATED int hitsCount() const;
+#endif
int hitCount() const;
typedef QPair<QString, QString> SearchHit;
diff --git a/tools/assistant/tools/assistant/bookmarkmanager.cpp b/tools/assistant/tools/assistant/bookmarkmanager.cpp
index 70f3157..523525e 100644
--- a/tools/assistant/tools/assistant/bookmarkmanager.cpp
+++ b/tools/assistant/tools/assistant/bookmarkmanager.cpp
@@ -69,9 +69,12 @@ BookmarkDialog::BookmarkDialog(BookmarkManager *manager, const QString &title,
, m_title(title)
, bookmarkManager(manager)
{
+ ui.setupUi(this);
+
installEventFilter(this);
+ ui.treeView->installEventFilter(this);
+ ui.treeView->viewport()->installEventFilter(this);
- ui.setupUi(this);
ui.bookmarkEdit->setText(title);
ui.newFolderButton->setVisible(false);
ui.buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
@@ -264,12 +267,14 @@ void BookmarkDialog::currentChanged(const QModelIndex &current)
bool BookmarkDialog::eventFilter(QObject *object, QEvent *e)
{
- if (object == this && e->type() == QEvent::KeyPress) {
- QKeyEvent *ke = static_cast<QKeyEvent*>(e);
+ if (object != ui.treeView && object != ui.treeView->viewport())
+ return QWidget::eventFilter(object, e);
- QModelIndex index = ui.treeView->currentIndex();
+ if (e->type() == QEvent::KeyPress) {
+ QKeyEvent *ke = static_cast<QKeyEvent*>(e);
switch (ke->key()) {
case Qt::Key_F2: {
+ const QModelIndex &index = ui.treeView->currentIndex();
const QModelIndex &source = proxyModel->mapToSource(index);
QStandardItem *item =
bookmarkManager->treeBookmarkModel()->itemFromIndex(source);
@@ -281,13 +286,13 @@ bool BookmarkDialog::eventFilter(QObject *object, QEvent *e)
} break;
case Qt::Key_Delete: {
+ const QModelIndex &index = ui.treeView->currentIndex();
bookmarkManager->removeBookmarkItem(ui.treeView,
proxyModel->mapToSource(index));
ui.bookmarkFolders->clear();
ui.bookmarkFolders->addItems(bookmarkManager->bookmarkFolders());
QString name = tr("Bookmarks");
- index = ui.treeView->currentIndex();
if (index.isValid())
name = index.data().toString();
ui.bookmarkFolders->setCurrentIndex(ui.bookmarkFolders->findText(name));
@@ -297,6 +302,7 @@ bool BookmarkDialog::eventFilter(QObject *object, QEvent *e)
break;
}
}
+
return QObject::eventFilter(object, e);
}
@@ -312,7 +318,10 @@ BookmarkWidget::BookmarkWidget(BookmarkManager *manager, QWidget *parent,
, bookmarkManager(manager)
{
setup(showButtons);
+
installEventFilter(this);
+ treeView->installEventFilter(this);
+ treeView->viewport()->installEventFilter(this);
}
BookmarkWidget::~BookmarkWidget()
@@ -484,7 +493,6 @@ void BookmarkWidget::setup(bool showButtons)
treeView->setAutoExpandDelay(1000);
treeView->setDropIndicatorShown(true);
treeView->header()->setVisible(false);
- treeView->viewport()->installEventFilter(this);
treeView->setContextMenuPolicy(Qt::CustomContextMenu);
connect(treeView, SIGNAL(expanded(QModelIndex)), this,
@@ -530,59 +538,71 @@ void BookmarkWidget::focusInEvent(QFocusEvent *e)
bool BookmarkWidget::eventFilter(QObject *object, QEvent *e)
{
- if ((object == this) || (object == treeView->viewport())) {
- QModelIndex index = treeView->currentIndex();
- if (e->type() == QEvent::KeyPress) {
- QKeyEvent *ke = static_cast<QKeyEvent*>(e);
- if (index.isValid() && searchField->text().isEmpty()) {
+ if (object != this && object != treeView
+ && object != treeView->viewport()) {
+ return QWidget::eventFilter(object, e);
+ }
+
+ if (e->type() == QEvent::KeyPress) {
+ QKeyEvent *ke = static_cast<QKeyEvent*>(e);
+ const bool tree = object == treeView || object == treeView->viewport();
+ switch (ke->key()) {
+ case Qt::Key_F2: {
+ const QModelIndex &index = treeView->currentIndex();
const QModelIndex &src = filterBookmarkModel->mapToSource(index);
- if (ke->key() == Qt::Key_F2) {
- QStandardItem *item =
- bookmarkManager->treeBookmarkModel()->itemFromIndex(src);
- if (item) {
+ if (tree && searchField->text().isEmpty()) {
+ if (QStandardItem *item = bookmarkManager->treeBookmarkModel()
+ ->itemFromIndex(src)) {
item->setEditable(true);
treeView->edit(index);
item->setEditable(false);
}
- } else if (ke->key() == Qt::Key_Delete) {
- bookmarkManager->removeBookmarkItem(treeView, src);
}
- }
+ } break;
+
+ case Qt::Key_Enter: {
+ case Qt::Key_Return:
+ if (tree) {
+ const QString &data = treeView->selectionModel()->currentIndex()
+ .data(Qt::UserRole + 10).toString();
+ if (!data.isEmpty() && data != QLatin1String("Folder"))
+ emit requestShowLink(data);
+ }
+ } break;
- switch (ke->key()) {
- default: break;
- case Qt::Key_Up: {
- case Qt::Key_Down:
+ case Qt::Key_Delete: {
+ const QModelIndex &index = treeView->currentIndex();
+ const QModelIndex &src = filterBookmarkModel->mapToSource(index);
+ if (tree && searchField->text().isEmpty())
+ bookmarkManager->removeBookmarkItem(treeView, src);
+ } break;
+
+ case Qt::Key_Up: {
+ case Qt::Key_Down:
+ if (!tree)
treeView->subclassKeyPressEvent(ke);
- } break;
-
- case Qt::Key_Enter: {
- case Qt::Key_Return:
- index = treeView->selectionModel()->currentIndex();
- if (index.isValid()) {
- QString data = index.data(Qt::UserRole + 10).toString();
- if (!data.isEmpty() && data != QLatin1String("Folder"))
- emit requestShowLink(data);
- }
- } break;
+ } break;
- case Qt::Key_Escape: {
- emit escapePressed();
- } break;
- }
- } else if (e->type() == QEvent::MouseButtonRelease) {
- if (index.isValid()) {
- QMouseEvent *me = static_cast<QMouseEvent*>(e);
- bool controlPressed = me->modifiers() & Qt::ControlModifier;
- if(((me->button() == Qt::LeftButton) && controlPressed)
- || (me->button() == Qt::MidButton)) {
- QString data = index.data(Qt::UserRole + 10).toString();
- if (!data.isEmpty() && data != QLatin1String("Folder"))
- CentralWidget::instance()->setSourceInNewTab(data);
- }
- }
+ case Qt::Key_Escape: {
+ emit escapePressed();
+ } break;
+
+ default: break;
}
}
+
+ if (e->type() == QEvent::MouseButtonRelease) {
+ QMouseEvent *me = static_cast<QMouseEvent*>(e);
+ bool controlPressed = me->modifiers() & Qt::ControlModifier;
+ if(((me->button() == Qt::LeftButton) && controlPressed)
+ || (me->button() == Qt::MidButton)) {
+ const QModelIndex &index = treeView->currentIndex();
+ const QString &data = index.data(Qt::UserRole + 10).toString();
+ if (!data.isEmpty() && data != QLatin1String("Folder"))
+ CentralWidget::instance()->setSourceInNewTab(data);
+ }
+ }
+
return QWidget::eventFilter(object, e);
}
diff --git a/tools/designer/src/components/formeditor/itemview_propertysheet.cpp b/tools/designer/src/components/formeditor/itemview_propertysheet.cpp
index 38f73e7..96d159a 100644
--- a/tools/designer/src/components/formeditor/itemview_propertysheet.cpp
+++ b/tools/designer/src/components/formeditor/itemview_propertysheet.cpp
@@ -45,6 +45,7 @@
#include <QtGui/QAbstractItemView>
#include <QtGui/QHeaderView>
+#include <QtCore/QDebug>
QT_BEGIN_NAMESPACE
@@ -54,41 +55,27 @@ struct Property {
Property() : m_sheet(0),m_id(-1) {}
Property(QDesignerPropertySheetExtension *sheet, int id)
: m_sheet(sheet), m_id(id) {}
- bool operator==(const Property &p) { return m_sheet == p.m_sheet && m_id == p.m_id; }
- uint qHash() {
- return ((int)(m_sheet-(QDesignerPropertySheetExtension*)(0))) & m_id;
- }
QDesignerPropertySheetExtension *m_sheet;
int m_id;
};
-class ItemViewPropertySheetPrivate {
+typedef QMap<int, Property> FakePropertyMap;
-public:
- ItemViewPropertySheetPrivate(QHeaderView *horizontalHeader,
- QHeaderView *verticalHeader,
- QObject *parent);
+struct ItemViewPropertySheetPrivate {
+ ItemViewPropertySheetPrivate(QDesignerFormEditorInterface *core,
+ QHeaderView *horizontalHeader,
+ QHeaderView *verticalHeader);
- inline void createMapping(int fakeId, QHeaderView *header, const QString &headerName);
inline QStringList realPropertyNames();
inline QString fakePropertyName(const QString &prefix, const QString &realName);
- QDesignerFormEditorInterface *m_core;
-
- // Maps index of fake property
- // to index of real property in respective sheet
- QHash<int, Property> m_propertyIdMap;
+ // Maps index of fake property to index of real property in respective sheet
+ FakePropertyMap m_propertyIdMap;
- // Maps name of fake property
- // to name of real property
+ // Maps name of fake property to name of real property
QHash<QString, QString> m_propertyNameMap;
-private:
- static QDesignerFormEditorInterface *formEditorForObject(QObject *o);
-
- QHeaderView *m_hHeader;
- QHeaderView *m_vHeader;
QHash<QHeaderView *, QDesignerPropertySheetExtension *> m_propertySheet;
QStringList m_realPropertyNames;
};
@@ -111,43 +98,18 @@ using namespace qdesigner_internal;
/***************** ItemViewPropertySheetPrivate *********************/
-ItemViewPropertySheetPrivate::ItemViewPropertySheetPrivate(QHeaderView *horizontalHeader,
- QHeaderView *verticalHeader,
- QObject *parent)
- : m_core(formEditorForObject(parent)),
- m_hHeader(horizontalHeader),
- m_vHeader(verticalHeader)
+ItemViewPropertySheetPrivate::ItemViewPropertySheetPrivate(QDesignerFormEditorInterface *core,
+ QHeaderView *horizontalHeader,
+ QHeaderView *verticalHeader)
{
if (horizontalHeader)
m_propertySheet.insert(horizontalHeader,
qt_extension<QDesignerPropertySheetExtension*>
- (m_core->extensionManager(), horizontalHeader));
+ (core->extensionManager(), horizontalHeader));
if (verticalHeader)
m_propertySheet.insert(verticalHeader,
qt_extension<QDesignerPropertySheetExtension*>
- (m_core->extensionManager(), verticalHeader));
-}
-
-// Find the form editor in the hierarchy.
-// We know that the parent of the sheet is the extension manager
-// whose parent is the core.
-QDesignerFormEditorInterface *ItemViewPropertySheetPrivate::formEditorForObject(QObject *o)
-{
- do {
- if (QDesignerFormEditorInterface* core = qobject_cast<QDesignerFormEditorInterface*>(o))
- return core;
- o = o->parent();
- } while(o);
- Q_ASSERT(o);
- return 0;
-}
-
-void ItemViewPropertySheetPrivate::createMapping(int fakeId, QHeaderView *header,
- const QString &headerName)
-{
- const int realPropertyId = m_propertySheet.value(header)->indexOf(headerName);
- QDesignerPropertySheetExtension *propertySheet = m_propertySheet.value(header);
- m_propertyIdMap.insert(fakeId, Property(propertySheet, realPropertyId));
+ (core->extensionManager(), verticalHeader));
}
QStringList ItemViewPropertySheetPrivate::realPropertyNames()
@@ -194,46 +156,19 @@ QString ItemViewPropertySheetPrivate::fakePropertyName(const QString &prefix,
ItemViewPropertySheet::ItemViewPropertySheet(QTreeView *treeViewObject, QObject *parent)
: QDesignerPropertySheet(treeViewObject, parent),
- d(new ItemViewPropertySheetPrivate(treeViewObject->header(), 0, parent))
+ d(new ItemViewPropertySheetPrivate(core(), treeViewObject->header(), 0))
{
- QHeaderView *hHeader = treeViewObject->header();
-
- foreach (const QString &realPropertyName, d->realPropertyNames()) {
- const QString fakePropertyName
- = d->fakePropertyName(QLatin1String("header"), realPropertyName);
- d->createMapping(createFakeProperty(fakePropertyName, 0), hHeader, realPropertyName);
- }
-
- foreach (int id, d->m_propertyIdMap.keys()) {
- setAttribute(id, true);
- setPropertyGroup(id, QLatin1String(headerGroup));
- }
+ initHeaderProperties(treeViewObject->header(), QLatin1String("header"));
}
-
ItemViewPropertySheet::ItemViewPropertySheet(QTableView *tableViewObject, QObject *parent)
: QDesignerPropertySheet(tableViewObject, parent),
- d(new ItemViewPropertySheetPrivate(tableViewObject->horizontalHeader(),
- tableViewObject->verticalHeader(), parent))
+ d(new ItemViewPropertySheetPrivate(core(),
+ tableViewObject->horizontalHeader(),
+ tableViewObject->verticalHeader()))
{
- QHeaderView *hHeader = tableViewObject->horizontalHeader();
- QHeaderView *vHeader = tableViewObject->verticalHeader();
-
- foreach (const QString &realPropertyName, d->realPropertyNames()) {
- const QString fakePropertyName
- = d->fakePropertyName(QLatin1String("horizontalHeader"), realPropertyName);
- d->createMapping(createFakeProperty(fakePropertyName, 0), hHeader, realPropertyName);
- }
- foreach (const QString &realPropertyName, d->realPropertyNames()) {
- const QString fakePropertyName
- = d->fakePropertyName(QLatin1String("verticalHeader"), realPropertyName);
- d->createMapping(createFakeProperty(fakePropertyName, 0), vHeader, realPropertyName);
- }
-
- foreach (int id, d->m_propertyIdMap.keys()) {
- setAttribute(id, true);
- setPropertyGroup(id, QLatin1String(headerGroup));
- }
+ initHeaderProperties(tableViewObject->horizontalHeader(), QLatin1String("horizontalHeader"));
+ initHeaderProperties(tableViewObject->verticalHeader(), QLatin1String("verticalHeader"));
}
ItemViewPropertySheet::~ItemViewPropertySheet()
@@ -241,6 +176,24 @@ ItemViewPropertySheet::~ItemViewPropertySheet()
delete d;
}
+void ItemViewPropertySheet::initHeaderProperties(QHeaderView *hv, const QString &prefix)
+{
+ QDesignerPropertySheetExtension *headerSheet = d->m_propertySheet.value(hv);
+ Q_ASSERT(headerSheet);
+ const QString headerGroupS = QLatin1String(headerGroup);
+ foreach (const QString &realPropertyName, d->realPropertyNames()) {
+ const int headerIndex = headerSheet->indexOf(realPropertyName);
+ Q_ASSERT(headerIndex != -1);
+ const QVariant defaultValue = realPropertyName == QLatin1String(visibleProperty) ?
+ QVariant(true) : headerSheet->property(headerIndex);
+ const QString fakePropertyName = d->fakePropertyName(prefix, realPropertyName);
+ const int fakeIndex = createFakeProperty(fakePropertyName, defaultValue);
+ d->m_propertyIdMap.insert(fakeIndex, Property(headerSheet, headerIndex));
+ setAttribute(fakeIndex, true);
+ setPropertyGroup(fakeIndex, headerGroupS);
+ }
+}
+
/*!
Returns the mapping of fake property names to real property names
*/
@@ -251,19 +204,17 @@ QHash<QString,QString> ItemViewPropertySheet::propertyNameMap() const
QVariant ItemViewPropertySheet::property(int index) const
{
- if (d->m_propertyIdMap.contains(index)) {
- Property realProperty = d->m_propertyIdMap.value(index);
- return realProperty.m_sheet->property(realProperty.m_id);
- } else {
- return QDesignerPropertySheet::property(index);
- }
+ const FakePropertyMap::const_iterator it = d->m_propertyIdMap.constFind(index);
+ if (it != d->m_propertyIdMap.constEnd())
+ return it.value().m_sheet->property(it.value().m_id);
+ return QDesignerPropertySheet::property(index);
}
void ItemViewPropertySheet::setProperty(int index, const QVariant &value)
{
- if (d->m_propertyIdMap.contains(index)) {
- Property realProperty = d->m_propertyIdMap.value(index);
- realProperty.m_sheet->setProperty(realProperty.m_id, value);
+ const FakePropertyMap::iterator it = d->m_propertyIdMap.find(index);
+ if (it != d->m_propertyIdMap.end()) {
+ it.value().m_sheet->setProperty(it.value().m_id, value);
} else {
QDesignerPropertySheet::setProperty(index, value);
}
@@ -271,18 +222,46 @@ void ItemViewPropertySheet::setProperty(int index, const QVariant &value)
void ItemViewPropertySheet::setChanged(int index, bool changed)
{
- if (d->m_propertyIdMap.contains(index)) {
- Property realProperty = d->m_propertyIdMap.value(index);
- realProperty.m_sheet->setChanged(realProperty.m_id, changed);
+ const FakePropertyMap::iterator it = d->m_propertyIdMap.find(index);
+ if (it != d->m_propertyIdMap.end()) {
+ it.value().m_sheet->setChanged(it.value().m_id, changed);
+ } else {
+ QDesignerPropertySheet::setChanged(index, changed);
}
- QDesignerPropertySheet::setChanged(index, changed);
+}
+
+bool ItemViewPropertySheet::isChanged(int index) const
+{
+ const FakePropertyMap::const_iterator it = d->m_propertyIdMap.constFind(index);
+ if (it != d->m_propertyIdMap.constEnd())
+ return it.value().m_sheet->isChanged(it.value().m_id);
+ return QDesignerPropertySheet::isChanged(index);
+}
+
+bool ItemViewPropertySheet::hasReset(int index) const
+{
+ const FakePropertyMap::const_iterator it = d->m_propertyIdMap.constFind(index);
+ if (it != d->m_propertyIdMap.constEnd())
+ return it.value().m_sheet->hasReset(it.value().m_id);
+ return QDesignerPropertySheet::hasReset(index);
}
bool ItemViewPropertySheet::reset(int index)
{
- if (d->m_propertyIdMap.contains(index)) {
- Property realProperty = d->m_propertyIdMap.value(index);
- return realProperty.m_sheet->reset(realProperty.m_id);
+ const FakePropertyMap::iterator it = d->m_propertyIdMap.find(index);
+ if (it != d->m_propertyIdMap.end()) {
+ QDesignerPropertySheetExtension *headerSheet = it.value().m_sheet;
+ const int headerIndex = it.value().m_id;
+ const bool resetRC = headerSheet->reset(headerIndex);
+ // Resetting for "visible" might fail and the stored default
+ // of the Widget database is "false" due to the widget not being
+ // visible at the time it was determined. Reset to "true" manually.
+ if (!resetRC && headerSheet->propertyName(headerIndex) == QLatin1String(visibleProperty)) {
+ headerSheet->setProperty(headerIndex, QVariant(true));
+ headerSheet->setChanged(headerIndex, false);
+ return true;
+ }
+ return resetRC;
} else {
return QDesignerPropertySheet::reset(index);
}
diff --git a/tools/designer/src/components/formeditor/itemview_propertysheet.h b/tools/designer/src/components/formeditor/itemview_propertysheet.h
index a926339..dbcd63d 100644
--- a/tools/designer/src/components/formeditor/itemview_propertysheet.h
+++ b/tools/designer/src/components/formeditor/itemview_propertysheet.h
@@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE
namespace qdesigner_internal {
-class ItemViewPropertySheetPrivate;
+struct ItemViewPropertySheetPrivate;
class ItemViewPropertySheet: public QDesignerPropertySheet
{
@@ -69,11 +69,15 @@ public:
QVariant property(int index) const;
void setProperty(int index, const QVariant &value);
- void setChanged(int index, bool changed);
+ virtual void setChanged(int index, bool changed);
+ virtual bool isChanged(int index) const;
- bool reset(int index);
+ virtual bool hasReset(int index) const;
+ virtual bool reset(int index);
private:
+ void initHeaderProperties(QHeaderView *hv, const QString &prefix);
+
ItemViewPropertySheetPrivate *d;
};
diff --git a/tools/designer/src/components/formeditor/widgetselection.cpp b/tools/designer/src/components/formeditor/widgetselection.cpp
index 484e3a9..35f1509 100644
--- a/tools/designer/src/components/formeditor/widgetselection.cpp
+++ b/tools/designer/src/components/formeditor/widgetselection.cpp
@@ -86,7 +86,7 @@ static inline Layout *managedLayoutOf(const QDesignerFormEditorInterface *core,
// ----------- WidgetHandle
WidgetHandle::WidgetHandle(FormWindow *parent, WidgetHandle::Type t, WidgetSelection *s) :
- InvisibleWidget(parent->mainContainer()),
+ InvisibleWidget(parent->formContainer()),
m_widget(0),
m_type(t),
m_formWindow( parent),
@@ -638,7 +638,7 @@ void WidgetSelection::updateGeometry()
return;
QPoint p = m_widget->parentWidget()->mapToGlobal(m_widget->pos());
- p = m_formWindow->mapFromGlobal(p);
+ p = m_formWindow->formContainer()->mapFromGlobal(p);
const QRect r(p, m_widget->size());
const int w = 6;
diff --git a/tools/designer/src/components/objectinspector/objectinspector.pri b/tools/designer/src/components/objectinspector/objectinspector.pri
index 280a1dc..733c4b3 100644
--- a/tools/designer/src/components/objectinspector/objectinspector.pri
+++ b/tools/designer/src/components/objectinspector/objectinspector.pri
@@ -1,4 +1,10 @@
-include($$QT_SOURCE_TREE/tools/shared/findwidget/findwidget.pri)
+# --- The Find widget is also linked into the designer_shared library.
+# Avoid conflict when linking statically
+contains(CONFIG, static) {
+ INCLUDEPATH *= $$QT_SOURCE_TREE/tools/shared/findwidget
+} else {
+ include($$QT_SOURCE_TREE/tools/shared/findwidget/findwidget.pri)
+}
INCLUDEPATH += $$PWD
diff --git a/tools/designer/src/components/propertyeditor/propertyeditor.pri b/tools/designer/src/components/propertyeditor/propertyeditor.pri
index d3e44a5..a8ed37e 100644
--- a/tools/designer/src/components/propertyeditor/propertyeditor.pri
+++ b/tools/designer/src/components/propertyeditor/propertyeditor.pri
@@ -4,8 +4,15 @@
INCLUDEPATH += $$PWD
-include($$QT_SOURCE_TREE/tools/shared/qtpropertybrowser/qtpropertybrowser.pri)
-include($$QT_SOURCE_TREE/tools/shared/qtgradienteditor/qtcolorbutton.pri)
+# --- Property browser is also linked into the designer_shared library.
+# Avoid conflict when linking statically
+contains(CONFIG, static) {
+ INCLUDEPATH *= $$QT_SOURCE_TREE/tools/shared/qtpropertybrowser
+ INCLUDEPATH *= $$QT_SOURCE_TREE/tools/shared/qtgradienteditor
+} else {
+ include($$QT_SOURCE_TREE/tools/shared/qtpropertybrowser/qtpropertybrowser.pri)
+ include($$QT_SOURCE_TREE/tools/shared/qtgradienteditor/qtcolorbutton.pri)
+}
FORMS += $$PWD/paletteeditor.ui \
$$PWD/stringlisteditor.ui \
diff --git a/tools/designer/src/lib/shared/actionrepository.cpp b/tools/designer/src/lib/shared/actionrepository.cpp
index 1655d07..83e64e6 100644
--- a/tools/designer/src/lib/shared/actionrepository.cpp
+++ b/tools/designer/src/lib/shared/actionrepository.cpp
@@ -226,7 +226,7 @@ void ActionModel::setItems(QDesignerFormEditorInterface *core, QAction *action,
item->setText(action->text());
item->setToolTip(action->text());
// shortcut
- const QString shortcut = actionShortCut(core, action).value().toString();
+ const QString shortcut = actionShortCut(core, action).value().toString(QKeySequence::NativeText);
item = sl[ShortCutColumn];
item->setText(shortcut);
item->setToolTip(shortcut);
diff --git a/tools/linguist/linguist/messageeditor.h b/tools/linguist/linguist/messageeditor.h
index b69af9c..d73c216 100644
--- a/tools/linguist/linguist/messageeditor.h
+++ b/tools/linguist/linguist/messageeditor.h
@@ -67,7 +67,7 @@ struct MessageEditorData {
QList<FormMultiWidget *> transTexts;
QString invariantForm;
QString firstForm;
- float fontSize;
+ qreal fontSize;
bool pluralEditMode;
};
diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp
index c45459a..2ab4a5e 100644
--- a/tools/linguist/lrelease/main.cpp
+++ b/tools/linguist/lrelease/main.cpp
@@ -55,6 +55,8 @@
#include <QtCore/QStringList>
#include <QtCore/QTextStream>
+QT_USE_NAMESPACE
+
#ifdef QT_BOOTSTRAPPED
static void initBinaryDir(
#ifndef Q_OS_WIN
@@ -109,6 +111,7 @@ static bool loadTsFile(Translator &tor, const QString &tsFileName, bool /* verbo
if (!cd.errors().isEmpty())
printOut(cd.error());
}
+ cd.clearErrors();
return ok;
}
@@ -139,11 +142,11 @@ static bool releaseTranslator(Translator &tor, const QString &qmFileName,
if (!ok) {
qWarning("lrelease error: cannot save '%s': %s\n",
qPrintable(qmFileName), qPrintable(cd.error()));
- return false;
} else if (!cd.errors().isEmpty()) {
printOut(cd.error());
}
- return true;
+ cd.clearErrors();
+ return ok;
}
static bool releaseTsFile(const QString& tsFileName,
diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp
index 41a2456..9ec7fdf 100644
--- a/tools/qdoc3/cppcodeparser.cpp
+++ b/tools/qdoc3/cppcodeparser.cpp
@@ -2318,9 +2318,9 @@ void CppCodeParser::createExampleFileNodes(FakeNode *fake)
exampleFile.mid(sizeOfBoringPartOfName),
Node::File);
foreach (const QString &imageFile, imageFiles) {
- FakeNode* newFake = new FakeNode(fake,
- imageFile.mid(sizeOfBoringPartOfName),
- Node::Image);
+ new FakeNode(fake,
+ imageFile.mid(sizeOfBoringPartOfName),
+ Node::Image);
}
}
diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp
index 9389268..56fca06 100644
--- a/tools/qdoc3/generator.cpp
+++ b/tools/qdoc3/generator.cpp
@@ -65,6 +65,8 @@ QMap<QString, QStringList> Generator::imgFileExts;
QSet<QString> Generator::outputFormats;
QStringList Generator::imageFiles;
QStringList Generator::imageDirs;
+QStringList Generator::exampleDirs;
+QStringList Generator::exampleImgExts;
QString Generator::outDir;
QString Generator::project;
@@ -120,12 +122,19 @@ void Generator::initialize(const Config &config)
if (!dirInfo.mkdir(outDir + "/images"))
config.lastLocation().fatal(tr("Cannot create output directory '%1'")
.arg(outDir + "/images"));
+ if (!dirInfo.mkdir(outDir + "/images/used-in-examples"))
+ config.lastLocation().fatal(tr("Cannot create output directory '%1'")
+ .arg(outDir + "/images/used-in-examples"));
}
imageFiles = config.getStringList(CONFIG_IMAGES);
imageDirs = config.getStringList(CONFIG_IMAGEDIRS);
+ exampleDirs = config.getStringList(CONFIG_EXAMPLEDIRS);
+ exampleImgExts = config.getStringList(CONFIG_EXAMPLES + Config::dot +
+ CONFIG_IMAGEEXTENSIONS);
- QString imagesDotFileExtensions = CONFIG_IMAGES + Config::dot + CONFIG_FILEEXTENSIONS;
+ QString imagesDotFileExtensions =
+ CONFIG_IMAGES + Config::dot + CONFIG_FILEEXTENSIONS;
QSet<QString> formats = config.subVars(imagesDotFileExtensions);
QSet<QString>::ConstIterator f = formats.begin();
while (f != formats.end()) {
@@ -323,7 +332,7 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
const FakeNode *fake = static_cast<const FakeNode *>(node);
if (fake->subType() == Node::Example)
generateExampleFiles(fake, marker);
- else if (fake->subType() == Node::File)
+ else if ((fake->subType() == Node::File) || (fake->subType() == Node::Image))
quiet = true;
}
@@ -530,6 +539,13 @@ void Generator::generateInheritedBy(const ClassNode *classe,
}
}
+/*!
+ This function is called when the documentation for an
+ example is being formatted. It outputs the list of source
+ files comprising the example, and the list of images used
+ by the example. The images are copied into a subtree of
+ \c{...doc/html/images/used-in-examples/...}
+ */
void Generator::generateFileList(const FakeNode* fake,
CodeMarker* marker,
Node::SubType subtype,
@@ -546,9 +562,30 @@ void Generator::generateFileList(const FakeNode* fake,
if (child->subType() == subtype) {
++count;
QString file = child->name();
+ if (subtype == Node::Image) {
+ if (!file.isEmpty()) {
+ QDir dirInfo;
+ QString userFriendlyFilePath;
+ QString srcPath = Config::findFile(fake->location(),
+ QStringList(),
+ exampleDirs,
+ file,
+ exampleImgExts,
+ userFriendlyFilePath);
+ userFriendlyFilePath.truncate(userFriendlyFilePath.lastIndexOf('/'));
+
+ QString imgOutDir = outDir + "/images/used-in-examples/" + userFriendlyFilePath;
+ if (!dirInfo.mkpath(imgOutDir))
+ fake->location().fatal(tr("Cannot create output directory '%1'")
+ .arg(imgOutDir));
+
+ QString imgOutName = Config::copyFile(fake->location(),
+ srcPath,
+ file,
+ imgOutDir);
+ }
- if (file == "network/qftp/images/dir.png")
- qDebug() << "FILE:" << file;
+ }
openedList.next();
text << Atom(Atom::ListItemNumber, openedList.numberString())
diff --git a/tools/qdoc3/generator.h b/tools/qdoc3/generator.h
index 7667789..cc1ea25 100644
--- a/tools/qdoc3/generator.h
+++ b/tools/qdoc3/generator.h
@@ -183,6 +183,8 @@ class Generator
static QSet<QString> outputFormats;
static QStringList imageFiles;
static QStringList imageDirs;
+ static QStringList exampleDirs;
+ static QStringList exampleImgExts;
static QString outDir;
static QString project;
};
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp
index 8711c6b..ae7bd81 100644
--- a/tools/qdoc3/htmlgenerator.cpp
+++ b/tools/qdoc3/htmlgenerator.cpp
@@ -3429,6 +3429,8 @@ QString HtmlGenerator::fileName(const Node *node)
if (node->type() == Node::Fake) {
if (static_cast<const FakeNode *>(node)->subType() == Node::ExternalPage)
return node->name();
+ if (static_cast<const FakeNode *>(node)->subType() == Node::Image)
+ return node->name();
}
return PageGenerator::fileName(node);
}
@@ -4000,6 +4002,8 @@ QString HtmlGenerator::getLink(const Atom *atom,
if (path.isEmpty()) {
link = linkForNode(*node, relative);
+ if (*node && (*node)->subType() == Node::Image)
+ link = "images/used-in-examples/" + link;
if (targetAtom)
link += "#" + refForAtom(targetAtom, *node);
}
diff --git a/tools/runonphone/main.cpp b/tools/runonphone/main.cpp
new file mode 100644
index 0000000..e2f6758
--- /dev/null
+++ b/tools/runonphone/main.cpp
@@ -0,0 +1,219 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications 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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QCoreApplication>
+#include <QTextStream>
+#include <QStringList>
+#include <QScopedPointer>
+#include <QTimer>
+#include "trkutils.h"
+#include "trkdevice.h"
+#include "launcher.h"
+
+#include "trksignalhandler.h"
+#include "serenum.h"
+
+void printUsage(QTextStream& outstream)
+{
+ outstream << "runtest [options] <program> [program arguments]" << endl
+ << "-s, --sis <file> specify sis file to install" << endl
+ << "-p, --portname <COMx> specify COM port to use by device name" << endl
+ << "-f, --portfriendlyname <substring> specify COM port to use by friendly name" << endl
+ << "-t, --timeout <milliseconds> terminate test if timeout occurs" << endl
+ << "-v, --verbose show debugging output" << endl
+ << "-q, --quiet hide progress messages" << endl
+ << endl
+ << "USB COM ports can usually be autodetected" << endl;
+}
+
+int main(int argc, char *argv[])
+{
+ QCoreApplication a(argc, argv);
+
+ QString serialPortName;
+ QString serialPortFriendlyName;
+ QString sisFile;
+ QString exeFile;
+ QString cmdLine;
+ QStringList args = QCoreApplication::arguments();
+ QTextStream outstream(stdout);
+ QTextStream errstream(stderr);
+ int loglevel=1;
+ int timeout=0;
+ for (int i=1;i<args.size();i++) {
+ QString arg = args.at(i);
+ if (arg.startsWith("-")) {
+ if (args.size() < i+2) {
+ errstream << "Command line missing argument parameters" << endl;
+ return 1;
+ }
+ QString param = args.at(i+1);
+ if(arg.compare("--portname", Qt::CaseSensitive) == 0
+ || arg.compare("-p", Qt::CaseSensitive) == 0) {
+ serialPortName = param;
+ i++;
+ }
+ else if(arg.compare("--portfriendlyname", Qt::CaseSensitive) == 0
+ || arg.compare("-f", Qt::CaseSensitive) == 0) {
+ serialPortFriendlyName = param;
+ i++;
+ }
+ else if(arg.compare("--sis", Qt::CaseSensitive) == 0
+ || arg.compare("-s", Qt::CaseSensitive) == 0) {
+ sisFile = param;
+ i++;
+ }
+ else if(arg.compare("--timeout", Qt::CaseSensitive) == 0
+ || arg.compare("-t", Qt::CaseSensitive) == 0) {
+ bool ok;
+ timeout = param.toInt(&ok);
+ if (!ok) {
+ errstream << "Timeout must be specified in milliseconds" << endl;
+ return 1;
+ }
+ i++;
+ }
+ else if(arg.compare("--verbose", Qt::CaseSensitive) == 0
+ || arg.compare("-v", Qt::CaseSensitive) == 0)
+ loglevel=2;
+ else if(arg.compare("--quiet", Qt::CaseSensitive) == 0
+ || arg.compare("-q", Qt::CaseSensitive) == 0)
+ loglevel=0;
+ else
+ errstream << "unknown command line option " << arg << endl;
+ } else {
+ exeFile = arg;
+ i++;
+ for(;i<args.size();i++) {
+ cmdLine.append(args.at(i));
+ if(i + 1 < args.size()) cmdLine.append(' ');
+ }
+ }
+ }
+
+ if(exeFile.isEmpty()) {
+ printUsage(outstream);
+ return 1;
+ }
+
+ if(serialPortName.isEmpty()) {
+ if(loglevel > 0)
+ outstream << "Detecting serial ports" << endl;
+ QList <SerialPortId> ports = enumerateSerialPorts();
+ foreach(SerialPortId id, ports) {
+ if(loglevel > 0)
+ outstream << "Port Name: " << id.portName << ", "
+ << "Friendly Name:" << id.friendlyName << endl;
+ if(serialPortName.isEmpty()) {
+ if(!id.friendlyName.isEmpty() &&
+ serialPortFriendlyName.isEmpty() &&
+ (id.friendlyName.contains("symbian", Qt::CaseInsensitive) ||
+ id.friendlyName.contains("s60", Qt::CaseInsensitive) ||
+ id.friendlyName.contains("nokia", Qt::CaseInsensitive)))
+ serialPortName = id.portName;
+ else if (!id.friendlyName.isEmpty() &&
+ !serialPortFriendlyName.isEmpty() &&
+ id.friendlyName.contains(serialPortFriendlyName))
+ serialPortName = id.portName;
+ }
+ }
+ }
+
+ QScopedPointer<trk::Launcher> launcher;
+
+ if(sisFile.isEmpty()) {
+ launcher.reset(new trk::Launcher(trk::Launcher::ActionCopyRun));
+ launcher->setCopyFileName(exeFile, QString("c:\\sys\\bin\\") + exeFile);
+ errstream << "System TRK required to copy EXE, use --sis if using Application TRK" << endl;
+ } else {
+ launcher.reset(new trk::Launcher(trk::Launcher::ActionCopyInstallRun));
+ launcher->addStartupActions(trk::Launcher::ActionInstall);
+ launcher->setCopyFileName(sisFile, "c:\\data\\testtemp.sis");
+ launcher->setInstallFileName("c:\\data\\testtemp.sis");
+ }
+ if(loglevel > 0)
+ outstream << "Connecting to target via " << serialPortName << endl;
+ launcher->setTrkServerName(QString("\\\\.\\") + serialPortName);
+
+ launcher->setFileName(QString("c:\\sys\\bin\\") + exeFile);
+ launcher->setCommandLineArgs(cmdLine);
+
+ if(loglevel > 1)
+ launcher->setVerbose(1);
+
+ TrkSignalHandler handler;
+ handler.setLogLevel(loglevel);
+
+ QObject::connect(launcher.data(), SIGNAL(copyingStarted()), &handler, SLOT(copyingStarted()));
+ QObject::connect(launcher.data(), SIGNAL(canNotConnect(const QString &)), &handler, SLOT(canNotConnect(const QString &)));
+ QObject::connect(launcher.data(), SIGNAL(canNotCreateFile(const QString &, const QString &)), &handler, SLOT(canNotCreateFile(const QString &, const QString &)));
+ QObject::connect(launcher.data(), SIGNAL(canNotWriteFile(const QString &, const QString &)), &handler, SLOT(canNotWriteFile(const QString &, const QString &)));
+ QObject::connect(launcher.data(), SIGNAL(canNotCloseFile(const QString &, const QString &)), &handler, SLOT(canNotCloseFile(const QString &, const QString &)));
+ QObject::connect(launcher.data(), SIGNAL(installingStarted()), &handler, SLOT(installingStarted()));
+ QObject::connect(launcher.data(), SIGNAL(canNotInstall(const QString &, const QString &)), &handler, SLOT(canNotInstall(const QString &, const QString &)));
+ QObject::connect(launcher.data(), SIGNAL(installingFinished()), &handler, SLOT(installingFinished()));
+ QObject::connect(launcher.data(), SIGNAL(startingApplication()), &handler, SLOT(startingApplication()));
+ QObject::connect(launcher.data(), SIGNAL(applicationRunning(uint)), &handler, SLOT(applicationRunning(uint)));
+ QObject::connect(launcher.data(), SIGNAL(canNotRun(const QString &)), &handler, SLOT(canNotRun(const QString &)));
+ QObject::connect(launcher.data(), SIGNAL(applicationOutputReceived(const QString &)), &handler, SLOT(applicationOutputReceived(const QString &)));
+ QObject::connect(launcher.data(), SIGNAL(copyProgress(int)), &handler, SLOT(copyProgress(int)));
+ QObject::connect(launcher.data(), SIGNAL(stateChanged(int)), &handler, SLOT(stateChanged(int)));
+ QObject::connect(launcher.data(), SIGNAL(stopped(uint,uint,uint,QString)), &handler, SLOT(stopped(uint,uint,uint,QString)));
+ QObject::connect(&handler, SIGNAL(resume(uint,uint)), launcher.data(), SLOT(resume(uint,uint)));
+ QObject::connect(&handler, SIGNAL(terminate()), launcher.data(), SLOT(terminate()));
+ QObject::connect(launcher.data(), SIGNAL(finished()), &handler, SLOT(finished()));
+
+ QTimer timer;
+ timer.setSingleShot(true);
+ QObject::connect(&timer, SIGNAL(timeout()), &handler, SLOT(timeout()));
+ if (timeout > 0) {
+ timer.start(timeout);
+ }
+
+ QString errorMessage;
+ if(!launcher->startServer(&errorMessage)) {
+ errstream << errorMessage << endl;
+ return 1;
+ }
+
+ return a.exec();
+}
+
diff --git a/tools/runonphone/runonphone.pro b/tools/runonphone/runonphone.pro
new file mode 100644
index 0000000..d243121
--- /dev/null
+++ b/tools/runonphone/runonphone.pro
@@ -0,0 +1,19 @@
+TEMPLATE = app
+
+QT -= gui
+CONFIG += console
+CONFIG -= app_bundle
+
+include(trk/trk.pri)
+
+SOURCES += main.cpp \
+ trksignalhandler.cpp
+
+HEADERS += trksignalhandler.h \
+ serenum.h
+
+windows {
+ SOURCES += serenum_win.cpp
+ LIBS += -lsetupapi \
+ -luuid
+}
diff --git a/tools/runonphone/serenum.h b/tools/runonphone/serenum.h
new file mode 100644
index 0000000..e7ab2d1
--- /dev/null
+++ b/tools/runonphone/serenum.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications 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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef WIN32SERENUM_H
+#define WIN32SERENUM_H
+
+#include <QString>
+#include <QList>
+
+struct SerialPortId
+{
+ QString portName;
+ QString friendlyName;
+};
+
+QList<SerialPortId> enumerateSerialPorts();
+
+#endif // WIN32SERENUM_H
diff --git a/tools/runonphone/serenum_win.cpp b/tools/runonphone/serenum_win.cpp
new file mode 100644
index 0000000..ec11c3c
--- /dev/null
+++ b/tools/runonphone/serenum_win.cpp
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications 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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "serenum.h"
+#include <QByteArray>
+#include <QString>
+#include <QDebug>
+#include <windows.h>
+#include <windef.h>
+#include <setupapi.h>
+#include <devguid.h>
+#include <winreg.h>
+#include <shlwapi.h>
+
+//{4d36e978-e325-11ce-bfc1-08002be10318}
+//DEFINE_GUID(GUID_DEVCLASS_PORTS, 0x4D36E978, 0xE325, 0x11CE, 0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18 );
+
+QList<SerialPortId> enumerateSerialPorts()
+{
+ DWORD index=0;
+ SP_DEVINFO_DATA info;
+ GUID guid = GUID_DEVCLASS_PORTS;
+ HDEVINFO infoset = SetupDiGetClassDevs(&guid, 0, 0, DIGCF_PRESENT);
+ QString valueName(16384, 0);
+ QList<SerialPortId> list;
+
+ for (index=0;;index++) {
+ ZeroMemory(&info, sizeof(SP_DEVINFO_DATA));
+ info.cbSize = sizeof(SP_DEVINFO_DATA);
+ if (!SetupDiEnumDeviceInfo(infoset, index, &info))
+ break;
+ QString friendlyName;
+ QString portName;
+ DWORD size=0;
+ SetupDiGetDeviceRegistryProperty(infoset, &info, SPDRP_FRIENDLYNAME, 0, 0, 0, &size);
+ QByteArray ba(size, 0);
+ if(SetupDiGetDeviceRegistryProperty(infoset, &info, SPDRP_FRIENDLYNAME, 0, (BYTE*)(ba.data()), size, 0)) {
+ friendlyName = QString((const QChar*)(ba.constData()), ba.size() / 2 - 1);
+ }
+ HKEY key = SetupDiOpenDevRegKey(infoset, &info, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_READ);
+ if(key != INVALID_HANDLE_VALUE) {
+#if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0600
+ //RegGetValue not supported on XP, SHRegGetValue not supported by mingw :(
+ for (DWORD dwi=0;;dwi++) {
+ DWORD vsize = valueName.size();
+ if (ERROR_SUCCESS == RegEnumValue(key, dwi, (WCHAR*)(valueName.data()), &vsize, 0, 0, 0, &size)) {
+ if (valueName.startsWith("PortName")) {
+ QByteArray ba(size, 0);
+ vsize = valueName.size();
+ if(ERROR_SUCCESS == RegEnumValue(key, dwi, (WCHAR*)(valueName.data()), &vsize, 0, 0, (BYTE*)(ba.data()), &size)) {
+ portName = QString((const QChar*)(ba.constData()), ba.size() / 2 - 1);
+ }
+ }
+ } else {
+ break;
+ }
+ }
+#else
+ if (ERROR_SUCCESS == SHRegGetValue(key, 0, "PortName", SRRF_RT_REG_SZ, 0, &size)) {
+ QByteArray ba(size, 0);
+ if (ERROR_SUCCESS == RegGetValue(key, 0, "PortName", SRRF_RT_REG_SZ, (BYTE*)(ba.data()), &size)) {
+ portName = QString((const QChar*)(ba.constData()), ba.size() / 2 - 1);
+ }
+ }
+#endif
+ RegCloseKey(key);
+ }
+ SerialPortId id;
+ id.portName = portName;
+ id.friendlyName = friendlyName;
+ list.append(id);
+ }
+ SetupDiDestroyDeviceInfoList(infoset);
+ return list;
+}
+
diff --git a/tools/runonphone/trk/bluetoothlistener.cpp b/tools/runonphone/trk/bluetoothlistener.cpp
new file mode 100644
index 0000000..73be9f4
--- /dev/null
+++ b/tools/runonphone/trk/bluetoothlistener.cpp
@@ -0,0 +1,224 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications 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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "bluetoothlistener.h"
+#include "trkdevice.h"
+
+#include <QtCore/QDebug>
+
+#ifdef Q_OS_UNIX
+# include <unistd.h>
+# include <signal.h>
+#else
+# include <windows.h>
+#endif
+
+// Process id helpers.
+#ifdef Q_OS_WIN
+inline DWORD processId(const QProcess &p)
+{
+ if (const Q_PID processInfoStruct = p.pid())
+ return processInfoStruct->dwProcessId;
+ return 0;
+}
+#else
+inline Q_PID processId(const QProcess &p)
+{
+ return p.pid();
+}
+#endif
+
+
+enum { debug = 0 };
+
+namespace trk {
+
+struct BluetoothListenerPrivate {
+ BluetoothListenerPrivate();
+ QString device;
+ QProcess process;
+#ifdef Q_OS_WIN
+ DWORD pid;
+#else
+ Q_PID pid;
+#endif
+ bool printConsoleMessages;
+ BluetoothListener::Mode mode;
+};
+
+BluetoothListenerPrivate::BluetoothListenerPrivate() :
+ pid(0),
+ printConsoleMessages(false),
+ mode(BluetoothListener::Listen)
+{
+}
+
+BluetoothListener::BluetoothListener(QObject *parent) :
+ QObject(parent),
+ d(new BluetoothListenerPrivate)
+{
+ d->process.setProcessChannelMode(QProcess::MergedChannels);
+
+ connect(&d->process, SIGNAL(readyReadStandardError()),
+ this, SLOT(slotStdError()));
+ connect(&d->process, SIGNAL(readyReadStandardOutput()),
+ this, SLOT(slotStdOutput()));
+ connect(&d->process, SIGNAL(finished(int, QProcess::ExitStatus)),
+ this, SLOT(slotProcessFinished(int,QProcess::ExitStatus)));
+ connect(&d->process, SIGNAL(error(QProcess::ProcessError)),
+ this, SLOT(slotProcessError(QProcess::ProcessError)));
+}
+
+BluetoothListener::~BluetoothListener()
+{
+ const int trc = terminateProcess();
+ if (debug)
+ qDebug() << "~BluetoothListener: terminated" << trc;
+ delete d;
+}
+
+BluetoothListener::Mode BluetoothListener::mode() const
+{
+ return d->mode;
+}
+
+void BluetoothListener::setMode(Mode m)
+{
+ d->mode = m;
+}
+
+bool BluetoothListener::printConsoleMessages() const
+{
+ return d->printConsoleMessages;
+}
+
+void BluetoothListener::setPrintConsoleMessages(bool p)
+{
+ d->printConsoleMessages = p;
+}
+
+int BluetoothListener::terminateProcess()
+{
+ enum { TimeOutMS = 200 };
+ if (debug)
+ qDebug() << "terminateProcess" << d->process.pid() << d->process.state();
+ if (d->process.state() == QProcess::NotRunning)
+ return -1;
+ emitMessage(tr("%1: Stopping listener %2...").arg(d->device).arg(processId(d->process)));
+ // When listening, the process should terminate by itself after closing the connection
+ if (mode() == Listen && d->process.waitForFinished(TimeOutMS))
+ return 0;
+#ifdef Q_OS_UNIX
+ kill(d->process.pid(), SIGHUP); // Listens for SIGHUP
+ if (d->process.waitForFinished(TimeOutMS))
+ return 1;
+#endif
+ d->process.terminate();
+ if (d->process.waitForFinished(TimeOutMS))
+ return 2;
+ d->process.kill();
+ return 3;
+}
+
+bool BluetoothListener::start(const QString &device, QString *errorMessage)
+{
+ if (d->process.state() != QProcess::NotRunning) {
+ *errorMessage = QLatin1String("Internal error: Still running.");
+ return false;
+ }
+ d->device = device;
+ const QString binary = QLatin1String("rfcomm");
+ QStringList arguments;
+ arguments << QLatin1String("-r")
+ << (d->mode == Listen ? QLatin1String("listen") : QLatin1String("watch"))
+ << device << QString(QLatin1Char('1'));
+ if (debug)
+ qDebug() << binary << arguments;
+ emitMessage(tr("%1: Starting Bluetooth listener %2...").arg(device, binary));
+ d->pid = 0;
+ d->process.start(binary, arguments);
+ if (!d->process.waitForStarted()) {
+ *errorMessage = tr("Unable to run '%1': %2").arg(binary, d->process.errorString());
+ return false;
+ }
+ d->pid = processId(d->process); // Forgets it after crash/termination
+ emitMessage(tr("%1: Bluetooth listener running (%2).").arg(device).arg(processId(d->process)));
+ return true;
+}
+
+void BluetoothListener::slotStdOutput()
+{
+ emitMessage(QString::fromLocal8Bit(d->process.readAllStandardOutput()));
+}
+
+void BluetoothListener::emitMessage(const QString &m)
+{
+ if (d->printConsoleMessages || debug)
+ qDebug("%s\n", qPrintable(m));
+ emit message(m);
+}
+
+void BluetoothListener::slotStdError()
+{
+ emitMessage(QString::fromLocal8Bit(d->process.readAllStandardError()));
+}
+
+void BluetoothListener::slotProcessFinished(int ex, QProcess::ExitStatus state)
+{
+ switch (state) {
+ case QProcess::NormalExit:
+ emitMessage(tr("%1: Process %2 terminated with exit code %3.")
+ .arg(d->device).arg(d->pid).arg(ex));
+ break;
+ case QProcess::CrashExit:
+ emitMessage(tr("%1: Process %2 crashed.").arg(d->device).arg(d->pid));
+ break;
+ }
+ emit terminated();
+}
+
+void BluetoothListener::slotProcessError(QProcess::ProcessError error)
+{
+ emitMessage(tr("%1: Process error %2: %3")
+ .arg(d->device).arg(error).arg(d->process.errorString()));
+}
+
+} // namespace trk
diff --git a/tools/runonphone/trk/bluetoothlistener.h b/tools/runonphone/trk/bluetoothlistener.h
new file mode 100644
index 0000000..0baec74
--- /dev/null
+++ b/tools/runonphone/trk/bluetoothlistener.h
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications 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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef BLUETOOTHLISTENER_H
+#define BLUETOOTHLISTENER_H
+
+#include <QtCore/QObject>
+#include <QtCore/QProcess>
+
+namespace trk {
+struct BluetoothListenerPrivate;
+
+/* BluetoothListener: Starts a helper process watching connections on a
+ * Bluetooth device, Linux only:
+ * The rfcomm command is used. It process can be started in the background
+ * while connection attempts (TrkDevice::open()) are made in the foreground. */
+
+class BluetoothListener : public QObject
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(BluetoothListener)
+public:
+ // The Mode property must be set before calling start().
+ enum Mode {
+ Listen, /* Terminate after client closed (read: Trk app
+ * on the phone terminated or disconnected).*/
+ Watch // Keep running, watch for next connection from client
+ };
+
+ explicit BluetoothListener(QObject *parent = 0);
+ virtual ~BluetoothListener();
+
+ Mode mode() const;
+ void setMode(Mode m);
+
+ bool start(const QString &device, QString *errorMessage);
+
+ // Print messages on the console.
+ bool printConsoleMessages() const;
+ void setPrintConsoleMessages(bool p);
+
+signals:
+ void terminated();
+ void message(const QString &);
+
+public slots:
+ void emitMessage(const QString &m); // accessed by starter
+
+private slots:
+ void slotStdOutput();
+ void slotStdError();
+ void slotProcessFinished(int, QProcess::ExitStatus);
+ void slotProcessError(QProcess::ProcessError error);
+
+private:
+ int terminateProcess();
+
+ BluetoothListenerPrivate *d;
+};
+
+} // namespace trk
+
+#endif // BLUETOOTHLISTENER_H
diff --git a/tools/runonphone/trk/bluetoothlistener_gui.cpp b/tools/runonphone/trk/bluetoothlistener_gui.cpp
new file mode 100644
index 0000000..d2fd72d
--- /dev/null
+++ b/tools/runonphone/trk/bluetoothlistener_gui.cpp
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications 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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "bluetoothlistener_gui.h"
+#include "bluetoothlistener.h"
+#include "communicationstarter.h"
+
+#include <QtGui/QMessageBox>
+#include <QtGui/QPushButton>
+#include <QtCore/QCoreApplication>
+#include <QtCore/QDebug>
+
+namespace trk {
+
+PromptStartCommunicationResult
+ promptStartCommunication(BaseCommunicationStarter &starter,
+ const QString &msgBoxTitle,
+ const QString &msgBoxText,
+ QWidget *msgBoxParent,
+ QString *errorMessage)
+{
+ errorMessage->clear();
+ // Initial connection attempt.
+ switch (starter.start()) {
+ case BaseCommunicationStarter::Started:
+ break;
+ case BaseCommunicationStarter::ConnectionSucceeded:
+ return PromptStartCommunicationConnected;
+ case BaseCommunicationStarter::StartError:
+ *errorMessage = starter.errorString();
+ return PromptStartCommunicationError;
+ }
+ // Run the starter with the event loop of a message box, have the box
+ // closed by the signals of the starter.
+ QMessageBox messageBox(QMessageBox::Information, msgBoxTitle, msgBoxText, QMessageBox::Cancel, msgBoxParent);
+ QObject::connect(&starter, SIGNAL(connected()), &messageBox, SLOT(close()));
+ QObject::connect(&starter, SIGNAL(timeout()), &messageBox, SLOT(close()));
+ messageBox.exec();
+ // Only starter.state() is reliable here to obtain the state.
+ switch (starter.state()) {
+ case AbstractBluetoothStarter::Running:
+ *errorMessage = QCoreApplication::translate("trk::promptStartCommunication", "Connection on %1 canceled.").arg(starter.device());
+ return PromptStartCommunicationCanceled;
+ case AbstractBluetoothStarter::TimedOut:
+ *errorMessage = starter.errorString();
+ return PromptStartCommunicationError;
+ case AbstractBluetoothStarter::Connected:
+ break;
+ }
+ return PromptStartCommunicationConnected;
+}
+
+PromptStartCommunicationResult
+ promptStartSerial(BaseCommunicationStarter &starter,
+ QWidget *msgBoxParent,
+ QString *errorMessage)
+{
+ const QString title = QCoreApplication::translate("trk::promptStartCommunication", "Waiting for App TRK");
+ const QString message = QCoreApplication::translate("trk::promptStartCommunication", "Waiting for App TRK to start on %1...").arg(starter.device());
+ return promptStartCommunication(starter, title, message, msgBoxParent, errorMessage);
+}
+
+PromptStartCommunicationResult
+ promptStartBluetooth(BaseCommunicationStarter &starter,
+ QWidget *msgBoxParent,
+ QString *errorMessage)
+{
+ const QString title = QCoreApplication::translate("trk::promptStartCommunication", "Waiting for Bluetooth Connection");
+ const QString message = QCoreApplication::translate("trk::promptStartCommunication", "Connecting to %1...").arg(starter.device());
+ return promptStartCommunication(starter, title, message, msgBoxParent, errorMessage);
+}
+
+} // namespace trk
diff --git a/tools/runonphone/trk/bluetoothlistener_gui.h b/tools/runonphone/trk/bluetoothlistener_gui.h
new file mode 100644
index 0000000..3b2ec17
--- /dev/null
+++ b/tools/runonphone/trk/bluetoothlistener_gui.h
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications 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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef BLUETOOTHLISTENER_GUI_H
+#define BLUETOOTHLISTENER_GUI_H
+
+#include <QtCore/QtGlobal>
+
+QT_BEGIN_NAMESPACE
+class QWidget;
+QT_END_NAMESPACE
+
+namespace trk {
+class BaseCommunicationStarter;
+
+/* promptStartCommunication(): Convenience functions that
+ * prompt the user to start a communication (launching or
+ * connecting TRK) using a modal message box in which they can cancel.
+ * Pass in the starter with device and parameters set up. */
+
+enum PromptStartCommunicationResult {
+ PromptStartCommunicationConnected,
+ PromptStartCommunicationCanceled,
+ PromptStartCommunicationError
+};
+
+PromptStartCommunicationResult
+ promptStartCommunication(BaseCommunicationStarter &starter,
+ const QString &msgBoxTitle,
+ const QString &msgBoxText,
+ QWidget *msgBoxParent,
+ QString *errorMessage);
+
+// Convenience to start a serial connection (messages prompting
+// to launch Trk).
+PromptStartCommunicationResult
+ promptStartSerial(BaseCommunicationStarter &starter,
+ QWidget *msgBoxParent,
+ QString *errorMessage);
+
+// Convenience to start blue tooth connection (messages
+// prompting to connect).
+PromptStartCommunicationResult
+ promptStartBluetooth(BaseCommunicationStarter &starter,
+ QWidget *msgBoxParent,
+ QString *errorMessage);
+} // namespace trk
+
+#endif // BLUETOOTHLISTENER_GUI_H
diff --git a/tools/runonphone/trk/callback.h b/tools/runonphone/trk/callback.h
new file mode 100644
index 0000000..4e12c5e
--- /dev/null
+++ b/tools/runonphone/trk/callback.h
@@ -0,0 +1,160 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications 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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DEBUGGER_CALLBACK_H
+#define DEBUGGER_CALLBACK_H
+
+#include <QtCore/QtGlobal>
+
+namespace trk {
+namespace Internal {
+
+/* Helper class for the 1-argument functor:
+ * Cloneable base class for the implementation which is
+ * invokeable with the argument. */
+template <class Argument>
+class CallbackImplBase
+{
+ Q_DISABLE_COPY(CallbackImplBase)
+public:
+ CallbackImplBase() {}
+ virtual CallbackImplBase *clone() const = 0;
+ virtual void invoke(Argument a) = 0;
+ virtual ~CallbackImplBase() {}
+};
+
+/* Helper class for the 1-argument functor: Implementation for
+ * a class instance with a member function pointer. */
+template <class Class, class Argument>
+class CallbackMemberPtrImpl : public CallbackImplBase<Argument>
+{
+public:
+ typedef void (Class::*MemberFuncPtr)(Argument);
+
+ CallbackMemberPtrImpl(Class *instance,
+ MemberFuncPtr memberFunc) :
+ m_instance(instance),
+ m_memberFunc(memberFunc) {}
+
+ virtual CallbackImplBase<Argument> *clone() const
+ {
+ return new CallbackMemberPtrImpl<Class, Argument>(m_instance, m_memberFunc);
+ }
+
+ virtual void invoke(Argument a)
+ { (m_instance->*m_memberFunc)(a); }
+private:
+ Class *m_instance;
+ MemberFuncPtr m_memberFunc;
+};
+
+} // namespace Internal
+
+/* Default-constructible, copyable 1-argument functor providing an
+ * operator()(Argument) that invokes a member function of a class:
+ * \code
+class Foo {
+public:
+ void print(const std::string &);
+};
+...
+Foo foo;
+Callback<const std::string &> f1(&foo, &Foo::print);
+f1("test");
+\endcode */
+
+template <class Argument>
+class Callback
+{
+public:
+ Callback() : m_impl(0) {}
+
+ template <class Class>
+ Callback(Class *instance, void (Class::*memberFunc)(Argument)) :
+ m_impl(new Internal::CallbackMemberPtrImpl<Class,Argument>(instance, memberFunc))
+ {}
+
+ ~Callback()
+ {
+ clean();
+ }
+
+ Callback(const Callback &rhs) :
+ m_impl(0)
+ {
+ if (rhs.m_impl)
+ m_impl = rhs.m_impl->clone();
+ }
+
+ Callback &operator=(const Callback &rhs)
+ {
+ if (this != &rhs) {
+ clean();
+ if (rhs.m_impl)
+ m_impl = rhs.m_impl->clone();
+ }
+ return *this;
+ }
+
+ bool isNull() const { return m_impl == 0; }
+ operator bool() const { return !isNull(); }
+
+ void operator()(Argument a)
+ {
+ if (m_impl)
+ m_impl->invoke(a);
+ }
+
+private:
+ void clean()
+ {
+ if (m_impl) {
+ delete m_impl;
+ m_impl = 0;
+ }
+ }
+
+ Internal::CallbackImplBase<Argument> *m_impl;
+};
+
+} // namespace trk
+
+#endif // DEBUGGER_CALLBACK_H
diff --git a/tools/runonphone/trk/communicationstarter.cpp b/tools/runonphone/trk/communicationstarter.cpp
new file mode 100644
index 0000000..0251976
--- /dev/null
+++ b/tools/runonphone/trk/communicationstarter.cpp
@@ -0,0 +1,260 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications 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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "communicationstarter.h"
+#include "bluetoothlistener.h"
+#include "trkdevice.h"
+
+#include <QtCore/QTimer>
+#include <QtCore/QEventLoop>
+
+namespace trk {
+
+// --------------- AbstractBluetoothStarter
+struct BaseCommunicationStarterPrivate {
+ explicit BaseCommunicationStarterPrivate(const BaseCommunicationStarter::TrkDevicePtr &d);
+
+ const BaseCommunicationStarter::TrkDevicePtr trkDevice;
+ BluetoothListener *listener;
+ QTimer *timer;
+ int intervalMS;
+ int attempts;
+ int n;
+ QString device;
+ QString errorString;
+ BaseCommunicationStarter::State state;
+};
+
+BaseCommunicationStarterPrivate::BaseCommunicationStarterPrivate(const BaseCommunicationStarter::TrkDevicePtr &d) :
+ trkDevice(d),
+ listener(0),
+ timer(0),
+ intervalMS(1000),
+ attempts(-1),
+ n(0),
+ device(QLatin1String("/dev/rfcomm0")),
+ state(BaseCommunicationStarter::TimedOut)
+{
+}
+
+BaseCommunicationStarter::BaseCommunicationStarter(const TrkDevicePtr &trkDevice, QObject *parent) :
+ QObject(parent),
+ d(new BaseCommunicationStarterPrivate(trkDevice))
+{
+}
+
+BaseCommunicationStarter::~BaseCommunicationStarter()
+{
+ stopTimer();
+ delete d;
+}
+
+void BaseCommunicationStarter::stopTimer()
+{
+ if (d->timer && d->timer->isActive())
+ d->timer->stop();
+}
+
+bool BaseCommunicationStarter::initializeStartupResources(QString *errorMessage)
+{
+ errorMessage->clear();
+ return true;
+}
+
+BaseCommunicationStarter::StartResult BaseCommunicationStarter::start()
+{
+ if (state() == Running) {
+ d->errorString = QLatin1String("Internal error, attempt to re-start BaseCommunicationStarter.\n");
+ return StartError;
+ }
+ // Before we instantiate timers, and such, try to open the device,
+ // which should succeed if another listener is already running in
+ // 'Watch' mode
+ if (d->trkDevice->open(d->device , &(d->errorString)))
+ return ConnectionSucceeded;
+ // Pull up resources for next attempt
+ d->n = 0;
+ if (!initializeStartupResources(&(d->errorString)))
+ return StartError;
+ // Start timer
+ if (!d->timer) {
+ d->timer = new QTimer;
+ connect(d->timer, SIGNAL(timeout()), this, SLOT(slotTimer()));
+ }
+ d->timer->setInterval(d->intervalMS);
+ d->timer->setSingleShot(false);
+ d->timer->start();
+ d->state = Running;
+ return Started;
+}
+
+BaseCommunicationStarter::State BaseCommunicationStarter::state() const
+{
+ return d->state;
+}
+
+int BaseCommunicationStarter::intervalMS() const
+{
+ return d->intervalMS;
+}
+
+void BaseCommunicationStarter::setIntervalMS(int i)
+{
+ d->intervalMS = i;
+ if (d->timer)
+ d->timer->setInterval(i);
+}
+
+int BaseCommunicationStarter::attempts() const
+{
+ return d->attempts;
+}
+
+void BaseCommunicationStarter::setAttempts(int a)
+{
+ d->attempts = a;
+}
+
+QString BaseCommunicationStarter::device() const
+{
+ return d->device;
+}
+
+void BaseCommunicationStarter::setDevice(const QString &dv)
+{
+ d->device = dv;
+}
+
+QString BaseCommunicationStarter::errorString() const
+{
+ return d->errorString;
+}
+
+void BaseCommunicationStarter::slotTimer()
+{
+ ++d->n;
+ // Check for timeout
+ if (d->attempts >= 0 && d->n >= d->attempts) {
+ stopTimer();
+ d->errorString = tr("%1: timed out after %n attempts using an interval of %2ms.", 0, d->n)
+ .arg(d->device).arg(d->intervalMS);
+ d->state = TimedOut;
+ emit timeout();
+ } else {
+ // Attempt n to connect?
+ if (d->trkDevice->open(d->device , &(d->errorString))) {
+ stopTimer();
+ const QString msg = tr("%1: Connection attempt %2 succeeded.").arg(d->device).arg(d->n);
+ emit message(msg);
+ d->state = Connected;
+ emit connected();
+ } else {
+ const QString msg = tr("%1: Connection attempt %2 failed: %3 (retrying)...")
+ .arg(d->device).arg(d->n).arg(d->errorString);
+ emit message(msg);
+ }
+ }
+}
+
+// --------------- AbstractBluetoothStarter
+
+AbstractBluetoothStarter::AbstractBluetoothStarter(const TrkDevicePtr &trkDevice, QObject *parent) :
+ BaseCommunicationStarter(trkDevice, parent)
+{
+}
+
+bool AbstractBluetoothStarter::initializeStartupResources(QString *errorMessage)
+{
+ // Create the listener and forward messages to it.
+ BluetoothListener *listener = createListener();
+ connect(this, SIGNAL(message(QString)), listener, SLOT(emitMessage(QString)));
+ return listener->start(device(), errorMessage);
+}
+
+// -------- ConsoleBluetoothStarter
+ConsoleBluetoothStarter::ConsoleBluetoothStarter(const TrkDevicePtr &trkDevice,
+ QObject *listenerParent,
+ QObject *parent) :
+AbstractBluetoothStarter(trkDevice, parent),
+m_listenerParent(listenerParent)
+{
+}
+
+BluetoothListener *ConsoleBluetoothStarter::createListener()
+{
+ BluetoothListener *rc = new BluetoothListener(m_listenerParent);
+ rc->setMode(BluetoothListener::Listen);
+ rc->setPrintConsoleMessages(true);
+ return rc;
+}
+
+bool ConsoleBluetoothStarter::startBluetooth(const TrkDevicePtr &trkDevice,
+ QObject *listenerParent,
+ const QString &device,
+ int attempts,
+ QString *errorMessage)
+{
+ // Set up a console starter to print to stdout.
+ ConsoleBluetoothStarter starter(trkDevice, listenerParent);
+ starter.setDevice(device);
+ starter.setAttempts(attempts);
+ switch (starter.start()) {
+ case Started:
+ break;
+ case ConnectionSucceeded:
+ return true;
+ case StartError:
+ *errorMessage = starter.errorString();
+ return false;
+ }
+ // Run the starter with an event loop. @ToDo: Implement
+ // some asynchronous keypress read to cancel.
+ QEventLoop eventLoop;
+ connect(&starter, SIGNAL(connected()), &eventLoop, SLOT(quit()));
+ connect(&starter, SIGNAL(timeout()), &eventLoop, SLOT(quit()));
+ eventLoop.exec(QEventLoop::ExcludeUserInputEvents);
+ if (starter.state() != AbstractBluetoothStarter::Connected) {
+ *errorMessage = starter.errorString();
+ return false;
+ }
+ return true;
+}
+} // namespace trk
diff --git a/tools/runonphone/trk/communicationstarter.h b/tools/runonphone/trk/communicationstarter.h
new file mode 100644
index 0000000..08defde
--- /dev/null
+++ b/tools/runonphone/trk/communicationstarter.h
@@ -0,0 +1,160 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications 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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef COMMUNICATIONSTARTER_H
+#define COMMUNICATIONSTARTER_H
+
+#include <QtCore/QSharedPointer>
+#include <QtCore/QObject>
+
+namespace trk {
+class TrkDevice;
+class BluetoothListener;
+struct BaseCommunicationStarterPrivate;
+
+/* BaseCommunicationStarter: A QObject that repeatedly tries to open a
+ * trk device until a connection succeeds or a timeout occurs (emitting
+ * signals), allowing to do something else in the foreground (local event loop
+ * [say QMessageBox] or some asynchronous operation). If the initial
+ * connection attempt in start() fails, the
+ * virtual initializeStartupResources() is called to initialize resources
+ * required to pull up the communication (namely Bluetooth listeners).
+ * The base class can be used as is to prompt the user to launch App TRK for a
+ * serial communication as this requires no further resource setup. */
+
+class BaseCommunicationStarter : public QObject {
+ Q_OBJECT
+ Q_DISABLE_COPY(BaseCommunicationStarter)
+public:
+ typedef QSharedPointer<TrkDevice> TrkDevicePtr;
+
+ enum State { Running, Connected, TimedOut };
+
+ explicit BaseCommunicationStarter(const TrkDevicePtr& trkDevice, QObject *parent = 0);
+ virtual ~BaseCommunicationStarter();
+
+ int intervalMS() const;
+ void setIntervalMS(int i);
+
+ int attempts() const;
+ void setAttempts(int a);
+
+ QString device() const;
+ void setDevice(const QString &);
+
+ State state() const;
+ QString errorString() const;
+
+ enum StartResult {
+ Started, // Starter is now running.
+ ConnectionSucceeded, /* Initial connection attempt succeeded,
+ * no need to keep running. */
+ StartError // Error occurred during start.
+ };
+
+ StartResult start();
+
+signals:
+ void connected();
+ void timeout();
+ void message(const QString &);
+
+private slots:
+ void slotTimer();
+
+protected:
+ virtual bool initializeStartupResources(QString *errorMessage);
+
+private:
+ inline void stopTimer();
+
+ BaseCommunicationStarterPrivate *d;
+};
+
+/* AbstractBluetoothStarter: Repeatedly tries to open a trk Bluetooth
+ * device. Note that in case a Listener is already running mode, the
+ * connection will succeed immediately.
+ * initializeStartupResources() is implemented to fire up the listener.
+ * Introduces a new virtual createListener() that derived classes must
+ * implement as a factory function that creates and sets up the
+ * listener (mode, message connection, etc). */
+
+class AbstractBluetoothStarter : public BaseCommunicationStarter {
+ Q_OBJECT
+ Q_DISABLE_COPY(AbstractBluetoothStarter)
+public:
+
+protected:
+ explicit AbstractBluetoothStarter(const TrkDevicePtr& trkDevice, QObject *parent = 0);
+
+ // Implemented to fire up the listener.
+ virtual bool initializeStartupResources(QString *errorMessage);
+ // New virtual: Overwrite to create and parametrize the listener.
+ virtual BluetoothListener *createListener() = 0;
+};
+
+/* ConsoleBluetoothStarter: Convenience class for console processes. Creates a
+ * listener in "Listen" mode with the messages redirected to standard output. */
+
+class ConsoleBluetoothStarter : public AbstractBluetoothStarter {
+ Q_OBJECT
+ Q_DISABLE_COPY(ConsoleBluetoothStarter)
+public:
+ static bool startBluetooth(const TrkDevicePtr& trkDevice,
+ QObject *listenerParent,
+ const QString &device,
+ int attempts,
+ QString *errorMessage);
+
+protected:
+ virtual BluetoothListener *createListener();
+
+private:
+ explicit ConsoleBluetoothStarter(const TrkDevicePtr& trkDevice,
+ QObject *listenerParent,
+ QObject *parent = 0);
+
+ QObject *m_listenerParent;
+};
+
+} // namespace trk
+
+#endif // COMMUNICATIONSTARTER_H
diff --git a/tools/runonphone/trk/launcher.cpp b/tools/runonphone/trk/launcher.cpp
new file mode 100644
index 0000000..a5d173a
--- /dev/null
+++ b/tools/runonphone/trk/launcher.cpp
@@ -0,0 +1,715 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications 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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "launcher.h"
+#include "trkutils.h"
+#include "trkdevice.h"
+#include "bluetoothlistener.h"
+
+#include <QtCore/QTimer>
+#include <QtCore/QDateTime>
+#include <QtCore/QVariant>
+#include <QtCore/QDebug>
+#include <QtCore/QQueue>
+#include <QtCore/QFile>
+#include <QtCore/QScopedPointer>
+
+namespace trk {
+
+struct LauncherPrivate {
+ struct CopyState {
+ QString sourceFileName;
+ QString destinationFileName;
+ uint copyFileHandle;
+ QScopedPointer<QByteArray> data;
+ int position;
+ };
+
+ explicit LauncherPrivate(const TrkDevicePtr &d);
+
+ TrkDevicePtr m_device;
+ QString m_trkServerName;
+ QByteArray m_trkReadBuffer;
+ Launcher::State m_state;
+
+ void logMessage(const QString &msg);
+ // Debuggee state
+ Session m_session; // global-ish data (process id, target information)
+
+ CopyState m_copyState;
+ QString m_fileName;
+ QString m_commandLineArgs;
+ QString m_installFileName;
+ int m_verbose;
+ Launcher::Actions m_startupActions;
+ bool m_closeDevice;
+};
+
+LauncherPrivate::LauncherPrivate(const TrkDevicePtr &d) :
+ m_device(d),
+ m_state(Launcher::Disconnected),
+ m_verbose(0),
+ m_closeDevice(true)
+{
+ if (m_device.isNull())
+ m_device = TrkDevicePtr(new TrkDevice);
+}
+
+Launcher::Launcher(Actions startupActions,
+ const TrkDevicePtr &dev,
+ QObject *parent) :
+ QObject(parent),
+ d(new LauncherPrivate(dev))
+{
+ d->m_startupActions = startupActions;
+ connect(d->m_device.data(), SIGNAL(messageReceived(trk::TrkResult)), this, SLOT(handleResult(trk::TrkResult)));
+ connect(this, SIGNAL(finished()), d->m_device.data(), SLOT(close()));
+}
+
+Launcher::~Launcher()
+{
+ logMessage("Shutting down.\n");
+ delete d;
+}
+
+Launcher::State Launcher::state() const
+{
+ return d->m_state;
+}
+
+void Launcher::setState(State s)
+{
+ if (s != d->m_state) {
+ d->m_state = s;
+ emit stateChanged(s);
+ }
+}
+
+void Launcher::addStartupActions(trk::Launcher::Actions startupActions)
+{
+ d->m_startupActions = Actions(d->m_startupActions | startupActions);
+}
+
+void Launcher::setTrkServerName(const QString &name)
+{
+ d->m_trkServerName = name;
+}
+
+QString Launcher::trkServerName() const
+{
+ return d->m_trkServerName;
+}
+
+TrkDevicePtr Launcher::trkDevice() const
+{
+ return d->m_device;
+}
+
+void Launcher::setFileName(const QString &name)
+{
+ d->m_fileName = name;
+}
+
+void Launcher::setCopyFileName(const QString &srcName, const QString &dstName)
+{
+ d->m_copyState.sourceFileName = srcName;
+ d->m_copyState.destinationFileName = dstName;
+}
+
+void Launcher::setInstallFileName(const QString &name)
+{
+ d->m_installFileName = name;
+}
+
+void Launcher::setCommandLineArgs(const QString &args)
+{
+ d->m_commandLineArgs = args;
+}
+
+void Launcher::setSerialFrame(bool b)
+{
+ d->m_device->setSerialFrame(b);
+}
+
+bool Launcher::serialFrame() const
+{
+ return d->m_device->serialFrame();
+}
+
+
+bool Launcher::closeDevice() const
+{
+ return d->m_closeDevice;
+}
+
+void Launcher::setCloseDevice(bool c)
+{
+ d->m_closeDevice = c;
+}
+
+bool Launcher::startServer(QString *errorMessage)
+{
+ errorMessage->clear();
+ if (d->m_verbose) {
+ const QString msg = QString::fromLatin1("Port=%1 Executable=%2 Package=%3 Remote Package=%4 Install file=%5")
+ .arg(d->m_trkServerName, d->m_fileName, d->m_copyState.sourceFileName, d->m_copyState.destinationFileName, d->m_installFileName);
+ logMessage(msg);
+ }
+ if (d->m_startupActions & ActionCopy) {
+ if (d->m_copyState.sourceFileName.isEmpty()) {
+ qWarning("No local filename given for copying package.");
+ return false;
+ } else if (d->m_copyState.destinationFileName.isEmpty()) {
+ qWarning("No remote filename given for copying package.");
+ return false;
+ }
+ }
+ if (d->m_startupActions & ActionInstall && d->m_installFileName.isEmpty()) {
+ qWarning("No package name given for installing.");
+ return false;
+ }
+ if (d->m_startupActions & ActionRun && d->m_fileName.isEmpty()) {
+ qWarning("No remote executable given for running.");
+ return false;
+ }
+ if (!d->m_device->isOpen() && !d->m_device->open(d->m_trkServerName, errorMessage))
+ return false;
+ if (d->m_closeDevice) {
+ connect(this, SIGNAL(finished()), d->m_device.data(), SLOT(close()));
+ } else {
+ disconnect(this, SIGNAL(finished()), d->m_device.data(), 0);
+ }
+ setState(Connecting);
+ // Set up the temporary 'waiting' state if we do not get immediate connection
+ QTimer::singleShot(1000, this, SLOT(slotWaitingForTrk()));
+ d->m_device->sendTrkInitialPing();
+ d->m_device->sendTrkMessage(TrkDisconnect); // Disconnect, as trk might be still connected
+ d->m_device->sendTrkMessage(TrkSupported, TrkCallback(this, &Launcher::handleSupportMask));
+ d->m_device->sendTrkMessage(TrkCpuType, TrkCallback(this, &Launcher::handleCpuType));
+ d->m_device->sendTrkMessage(TrkVersions, TrkCallback(this, &Launcher::handleTrkVersion));
+ if (d->m_startupActions != ActionPingOnly)
+ d->m_device->sendTrkMessage(TrkConnect, TrkCallback(this, &Launcher::handleConnect));
+ return true;
+}
+
+void Launcher::slotWaitingForTrk()
+{
+ // Set temporary state if we are still in connected state
+ if (state() == Connecting)
+ setState(WaitingForTrk);
+}
+
+void Launcher::handleConnect(const TrkResult &result)
+{
+ if (result.errorCode()) {
+ emit canNotConnect(result.errorString());
+ return;
+ }
+ setState(Connected);
+ if (d->m_startupActions & ActionCopy)
+ copyFileToRemote();
+ else if (d->m_startupActions & ActionInstall)
+ installRemotePackageSilently();
+ else if (d->m_startupActions & ActionRun)
+ startInferiorIfNeeded();
+}
+
+void Launcher::setVerbose(int v)
+{
+ d->m_verbose = v;
+ d->m_device->setVerbose(v);
+}
+
+void Launcher::logMessage(const QString &msg)
+{
+ if (d->m_verbose)
+ qDebug() << "LAUNCHER: " << qPrintable(msg);
+}
+
+void Launcher::terminate()
+{
+ switch (state()) {
+ case DeviceDescriptionReceived:
+ case Connected:
+ if (d->m_session.pid) {
+ QByteArray ba;
+ appendShort(&ba, 0x0000, TargetByteOrder);
+ appendInt(&ba, d->m_session.pid, TargetByteOrder);
+ d->m_device->sendTrkMessage(TrkDeleteItem, TrkCallback(this, &Launcher::handleRemoteProcessKilled), ba);
+ return;
+ }
+ if (d->m_copyState.copyFileHandle)
+ closeRemoteFile(true);
+ disconnectTrk();
+ break;
+ case Disconnected:
+ break;
+ case Connecting:
+ case WaitingForTrk:
+ setState(Disconnected);
+ emit finished();
+ break;
+ }
+}
+
+void Launcher::handleRemoteProcessKilled(const TrkResult &result)
+{
+ Q_UNUSED(result)
+ disconnectTrk();
+}
+
+void Launcher::handleResult(const TrkResult &result)
+{
+ QByteArray prefix = "READ BUF: ";
+ QByteArray str = result.toString().toUtf8();
+ if (result.isDebugOutput) { // handle application output
+ logMessage("APPLICATION OUTPUT: " + result.data);
+ emit applicationOutputReceived(result.data);
+ return;
+ }
+ switch (result.code) {
+ case TrkNotifyAck:
+ break;
+ case TrkNotifyNak: { // NAK
+ logMessage(prefix + "NAK: " + str);
+ //logMessage(prefix << "TOKEN: " << result.token);
+ logMessage(prefix + "ERROR: " + errorMessage(result.data.at(0)));
+ break;
+ }
+ case TrkNotifyStopped: { // Notified Stopped
+ logMessage(prefix + "NOTE: STOPPED " + str);
+ // 90 01 78 6a 40 40 00 00 07 23 00 00 07 24 00 00
+ QString reason;
+ if (result.data.size() >= 14) {
+ uint pc = extractInt(result.data.mid(0,4).constData());
+ uint pid = extractInt(result.data.mid(4,4).constData());
+ uint tid = extractInt(result.data.mid(8,4).constData());
+ ushort len = extractShort(result.data.mid(12,2).constData());
+ if(len > 0)
+ reason = result.data.mid(14, len);
+ emit(stopped(pc, pid, tid, reason));
+ } else {
+ emit(stopped(0, 0, 0, reason));
+ }
+ //const char *data = result.data.data();
+// uint addr = extractInt(data); //code address: 4 bytes; code base address for the library
+// uint pid = extractInt(data + 4); // ProcessID: 4 bytes;
+// uint tid = extractInt(data + 8); // ThreadID: 4 bytes
+ //logMessage(prefix << " ADDR: " << addr << " PID: " << pid << " TID: " << tid);
+ d->m_device->sendTrkAck(result.token);
+ break;
+ }
+ case TrkNotifyException: { // Notify Exception (obsolete)
+ logMessage(prefix + "NOTE: EXCEPTION " + str);
+ d->m_device->sendTrkAck(result.token);
+ break;
+ }
+ case TrkNotifyInternalError: { //
+ logMessage(prefix + "NOTE: INTERNAL ERROR: " + str);
+ d->m_device->sendTrkAck(result.token);
+ break;
+ }
+
+ // target->host OS notification
+ case TrkNotifyCreated: { // Notify Created
+ /*
+ const char *data = result.data.data();
+ byte error = result.data.at(0);
+ byte type = result.data.at(1); // type: 1 byte; for dll item, this value is 2.
+ uint pid = extractInt(data + 2); // ProcessID: 4 bytes;
+ uint tid = extractInt(data + 6); //threadID: 4 bytes
+ uint codeseg = extractInt(data + 10); //code address: 4 bytes; code base address for the library
+ uint dataseg = extractInt(data + 14); //data address: 4 bytes; data base address for the library
+ uint len = extractShort(data + 18); //length: 2 bytes; length of the library name string to follow
+ QByteArray name = result.data.mid(20, len); // name: library name
+
+ logMessage(prefix + "NOTE: LIBRARY LOAD: " + str);
+ logMessage(prefix + "TOKEN: " + result.token);
+ logMessage(prefix + "ERROR: " + int(error));
+ logMessage(prefix + "TYPE: " + int(type));
+ logMessage(prefix + "PID: " + pid);
+ logMessage(prefix + "TID: " + tid);
+ logMessage(prefix + "CODE: " + codeseg);
+ logMessage(prefix + "DATA: " + dataseg);
+ logMessage(prefix + "LEN: " + len);
+ logMessage(prefix + "NAME: " + name);
+ */
+
+ if (result.data.size() < 10)
+ break;
+ QByteArray ba;
+ ba.append(result.data.mid(2, 8));
+ d->m_device->sendTrkMessage(TrkContinue, TrkCallback(), ba, "CONTINUE");
+ //d->m_device->sendTrkAck(result.token)
+ break;
+ }
+ case TrkNotifyDeleted: { // NotifyDeleted
+ const ushort itemType = (unsigned char)result.data.at(1);
+ const ushort len = result.data.size() > 12 ? extractShort(result.data.data() + 10) : ushort(0);
+ const QString name = len ? QString::fromAscii(result.data.mid(12, len)) : QString();
+ logMessage(QString::fromLatin1("%1 %2 UNLOAD: %3").
+ arg(QString::fromAscii(prefix)).arg(itemType ? QLatin1String("LIB") : QLatin1String("PROCESS")).
+ arg(name));
+ d->m_device->sendTrkAck(result.token);
+ if (itemType == 0 // process
+ && result.data.size() >= 10
+ && d->m_session.pid == extractInt(result.data.data() + 6)) {
+ disconnectTrk();
+ }
+ break;
+ }
+ case TrkNotifyProcessorStarted: { // NotifyProcessorStarted
+ logMessage(prefix + "NOTE: PROCESSOR STARTED: " + str);
+ d->m_device->sendTrkAck(result.token);
+ break;
+ }
+ case TrkNotifyProcessorStandBy: { // NotifyProcessorStandby
+ logMessage(prefix + "NOTE: PROCESSOR STANDBY: " + str);
+ d->m_device->sendTrkAck(result.token);
+ break;
+ }
+ case TrkNotifyProcessorReset: { // NotifyProcessorReset
+ logMessage(prefix + "NOTE: PROCESSOR RESET: " + str);
+ d->m_device->sendTrkAck(result.token);
+ break;
+ }
+ default: {
+ logMessage(prefix + "INVALID: " + str);
+ break;
+ }
+ }
+}
+
+QString Launcher::deviceDescription(unsigned verbose) const
+{
+ return d->m_session.deviceDescription(verbose);
+}
+
+void Launcher::handleTrkVersion(const TrkResult &result)
+{
+ if (result.errorCode() || result.data.size() < 5) {
+ if (d->m_startupActions == ActionPingOnly) {
+ setState(Disconnected);
+ emit finished();
+ }
+ return;
+ }
+ d->m_session.trkAppVersion.trkMajor = result.data.at(1);
+ d->m_session.trkAppVersion.trkMinor = result.data.at(2);
+ d->m_session.trkAppVersion.protocolMajor = result.data.at(3);
+ d->m_session.trkAppVersion.protocolMinor = result.data.at(4);
+ setState(DeviceDescriptionReceived);
+ // Ping mode: Log & Terminate
+ if (d->m_startupActions == ActionPingOnly) {
+ qWarning("%s", qPrintable(deviceDescription()));
+ setState(Disconnected);
+ emit finished();
+ }
+}
+
+void Launcher::handleFileCreation(const TrkResult &result)
+{
+ if (result.errorCode() || result.data.size() < 6) {
+ emit canNotCreateFile(d->m_copyState.destinationFileName, result.errorString());
+ disconnectTrk();
+ return;
+ }
+ const char *data = result.data.data();
+ d->m_copyState.copyFileHandle = extractInt(data + 2);
+ QFile file(d->m_copyState.sourceFileName);
+ file.open(QIODevice::ReadOnly);
+ d->m_copyState.data.reset(new QByteArray(file.readAll()));
+ d->m_copyState.position = 0;
+ file.close();
+ continueCopying();
+}
+
+void Launcher::handleCopy(const TrkResult &result)
+{
+ if (result.errorCode() || result.data.size() < 4) {
+ closeRemoteFile(true);
+ emit canNotWriteFile(d->m_copyState.destinationFileName, result.errorString());
+ disconnectTrk();
+ } else {
+ continueCopying(extractShort(result.data.data() + 2));
+ }
+}
+
+void Launcher::continueCopying(uint lastCopiedBlockSize)
+{
+ int size = d->m_copyState.data->length();
+ d->m_copyState.position += lastCopiedBlockSize;
+ if (size == 0)
+ emit copyProgress(100);
+ else {
+ int percent = qMin((d->m_copyState.position*100)/size, 100);
+ emit copyProgress(percent);
+ }
+ if (d->m_copyState.position < size) {
+ QByteArray ba;
+ appendInt(&ba, d->m_copyState.copyFileHandle, TargetByteOrder);
+ appendString(&ba, d->m_copyState.data->mid(d->m_copyState.position, 2048), TargetByteOrder, false);
+ d->m_device->sendTrkMessage(TrkWriteFile, TrkCallback(this, &Launcher::handleCopy), ba);
+ } else {
+ closeRemoteFile();
+ }
+}
+
+void Launcher::closeRemoteFile(bool failed)
+{
+ QByteArray ba;
+ appendInt(&ba, d->m_copyState.copyFileHandle, TargetByteOrder);
+ appendDateTime(&ba, QDateTime::currentDateTime(), TargetByteOrder);
+ d->m_device->sendTrkMessage(TrkCloseFile,
+ failed ? TrkCallback() : TrkCallback(this, &Launcher::handleFileCopied),
+ ba);
+ d->m_copyState.data.reset();
+ d->m_copyState.copyFileHandle = 0;
+ d->m_copyState.position = 0;
+}
+
+void Launcher::handleFileCopied(const TrkResult &result)
+{
+ if (result.errorCode())
+ emit canNotCloseFile(d->m_copyState.destinationFileName, result.errorString());
+ if (d->m_startupActions & ActionInstall)
+ installRemotePackageSilently();
+ else if (d->m_startupActions & ActionRun)
+ startInferiorIfNeeded();
+ else
+ disconnectTrk();
+}
+
+void Launcher::handleCpuType(const TrkResult &result)
+{
+ logMessage("HANDLE CPU TYPE: " + result.toString());
+ if(result.errorCode() || result.data.size() < 7)
+ return;
+ //---TRK------------------------------------------------------
+ // Command: 0x80 Acknowledge
+ // Error: 0x00
+ // [80 03 00 04 00 00 04 00 00 00]
+ d->m_session.cpuMajor = result.data.at(1);
+ d->m_session.cpuMinor = result.data.at(2);
+ d->m_session.bigEndian = result.data.at(3);
+ d->m_session.defaultTypeSize = result.data.at(4);
+ d->m_session.fpTypeSize = result.data.at(5);
+ d->m_session.extended1TypeSize = result.data.at(6);
+ //d->m_session.extended2TypeSize = result.data[6];
+}
+
+void Launcher::handleCreateProcess(const TrkResult &result)
+{
+ if (result.errorCode()) {
+ emit canNotRun(result.errorString());
+ disconnectTrk();
+ return;
+ }
+ // 40 00 00]
+ //logMessage(" RESULT: " + result.toString());
+ // [80 08 00 00 00 01 B5 00 00 01 B6 78 67 40 00 00 40 00 00]
+ const char *data = result.data.data();
+ d->m_session.pid = extractInt(data + 1);
+ d->m_session.tid = extractInt(data + 5);
+ d->m_session.codeseg = extractInt(data + 9);
+ d->m_session.dataseg = extractInt(data + 13);
+ if (d->m_verbose) {
+ const QString msg = QString::fromLatin1("Process id: %1 Thread id: %2 code: 0x%3 data: 0x%4").
+ arg(d->m_session.pid).arg(d->m_session.tid).arg(d->m_session.codeseg, 0, 16).
+ arg(d->m_session.dataseg, 0 ,16);
+ logMessage(msg);
+ }
+ emit applicationRunning(d->m_session.pid);
+ QByteArray ba;
+ appendInt(&ba, d->m_session.pid);
+ appendInt(&ba, d->m_session.tid);
+ d->m_device->sendTrkMessage(TrkContinue, TrkCallback(), ba, "CONTINUE");
+}
+
+void Launcher::handleWaitForFinished(const TrkResult &result)
+{
+ logMessage(" FINISHED: " + stringFromArray(result.data));
+ setState(Disconnected);
+ emit finished();
+}
+
+void Launcher::handleSupportMask(const TrkResult &result)
+{
+ if (result.errorCode() || result.data.size() < 32)
+ return;
+ const char *data = result.data.data() + 1;
+
+ QByteArray str;
+ for (int i = 0; i < 32; ++i) {
+ //str.append(" [" + formatByte(data[i]) + "]: ");
+ for (int j = 0; j < 8; ++j)
+ if (data[i] & (1 << j))
+ str.append(QByteArray::number(i * 8 + j, 16) + " ");
+ }
+ logMessage("SUPPORTED: " + str);
+}
+
+
+void Launcher::cleanUp()
+{
+ //
+ //---IDE------------------------------------------------------
+ // Command: 0x41 Delete Item
+ // Sub Cmd: Delete Process
+ //ProcessID: 0x0000071F (1823)
+ // [41 24 00 00 00 00 07 1F]
+ QByteArray ba;
+ appendByte(&ba, 0x00);
+ appendByte(&ba, 0x00);
+ appendInt(&ba, d->m_session.pid);
+ d->m_device->sendTrkMessage(TrkDeleteItem, TrkCallback(), ba, "Delete process");
+
+ //---TRK------------------------------------------------------
+ // Command: 0x80 Acknowledge
+ // Error: 0x00
+ // [80 24 00]
+
+ //---IDE------------------------------------------------------
+ // Command: 0x1C Clear Break
+ // [1C 25 00 00 00 0A 78 6A 43 40]
+
+ //---TRK------------------------------------------------------
+ // Command: 0xA1 Notify Deleted
+ // [A1 09 00 00 00 00 00 00 00 00 07 1F]
+ //---IDE------------------------------------------------------
+ // Command: 0x80 Acknowledge
+ // Error: 0x00
+ // [80 09 00]
+
+ //---TRK------------------------------------------------------
+ // Command: 0x80 Acknowledge
+ // Error: 0x00
+ // [80 25 00]
+
+ //---IDE------------------------------------------------------
+ // Command: 0x1C Clear Break
+ // [1C 26 00 00 00 0B 78 6A 43 70]
+ //---TRK------------------------------------------------------
+ // Command: 0x80 Acknowledge
+ // Error: 0x00
+ // [80 26 00]
+
+
+ //---IDE------------------------------------------------------
+ // Command: 0x02 Disconnect
+ // [02 27]
+// sendTrkMessage(0x02, TrkCallback(this, &Launcher::handleDisconnect));
+ //---TRK------------------------------------------------------
+ // Command: 0x80 Acknowledge
+ // Error: 0x00
+}
+
+void Launcher::disconnectTrk()
+{
+ d->m_device->sendTrkMessage(TrkDisconnect, TrkCallback(this, &Launcher::handleWaitForFinished));
+}
+
+void Launcher::copyFileToRemote()
+{
+ emit copyingStarted();
+ QByteArray ba;
+ appendByte(&ba, 0x10);
+ appendString(&ba, d->m_copyState.destinationFileName.toLocal8Bit(), TargetByteOrder, false);
+ d->m_device->sendTrkMessage(TrkOpenFile, TrkCallback(this, &Launcher::handleFileCreation), ba);
+}
+
+void Launcher::installRemotePackageSilently()
+{
+ emit installingStarted();
+ QByteArray ba;
+ appendByte(&ba, 'C');
+ appendString(&ba, d->m_installFileName.toLocal8Bit(), TargetByteOrder, false);
+ d->m_device->sendTrkMessage(TrkInstallFile, TrkCallback(this, &Launcher::handleInstallPackageFinished), ba);
+}
+
+void Launcher::handleInstallPackageFinished(const TrkResult &result)
+{
+ if (result.errorCode()) {
+ emit canNotInstall(d->m_installFileName, result.errorString());
+ disconnectTrk();
+ return;
+ } else {
+ emit installingFinished();
+ }
+ if (d->m_startupActions & ActionRun) {
+ startInferiorIfNeeded();
+ } else {
+ disconnectTrk();
+ }
+}
+
+void Launcher::startInferiorIfNeeded()
+{
+ emit startingApplication();
+ if (d->m_session.pid != 0) {
+ logMessage("Process already 'started'");
+ return;
+ }
+ // It's not started yet
+ QByteArray ba;
+ appendShort(&ba, 0, TargetByteOrder); // create new process
+ appendByte(&ba, 0); // options - currently unused
+
+ if(d->m_commandLineArgs.isEmpty()) {
+ appendString(&ba, d->m_fileName.toLocal8Bit(), TargetByteOrder);
+ } else {
+ QByteArray ba2;
+ ba2.append(d->m_fileName.toLocal8Bit());
+ ba2.append('\0');
+ ba2.append(d->m_commandLineArgs.toLocal8Bit());
+ appendString(&ba, ba2, TargetByteOrder);
+ }
+ d->m_device->sendTrkMessage(TrkCreateItem, TrkCallback(this, &Launcher::handleCreateProcess), ba); // Create Item
+}
+
+void Launcher::resume(uint pid, uint tid)
+{
+ QByteArray ba;
+ appendInt(&ba, pid, BigEndian);
+ appendInt(&ba, tid, BigEndian);
+ d->m_device->sendTrkMessage(TrkContinue, TrkCallback(), ba, "CONTINUE");
+}
+} // namespace trk
diff --git a/tools/runonphone/trk/launcher.h b/tools/runonphone/trk/launcher.h
new file mode 100644
index 0000000..3a0c3ef
--- /dev/null
+++ b/tools/runonphone/trk/launcher.h
@@ -0,0 +1,170 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications 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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef LAUNCHER_H
+#define LAUNCHER_H
+
+#include "trkdevice.h"
+
+#include <QtCore/QObject>
+#include <QtCore/QVariant>
+#include <QtCore/QSharedPointer>
+
+namespace trk {
+
+struct TrkResult;
+struct TrkMessage;
+struct LauncherPrivate;
+
+typedef QSharedPointer<TrkDevice> TrkDevicePtr;
+
+class Launcher : public QObject
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(Launcher)
+public:
+ typedef void (Launcher::*TrkCallBack)(const TrkResult &);
+
+ enum Actions {
+ ActionPingOnly = 0x0,
+ ActionCopy = 0x1,
+ ActionInstall = 0x2,
+ ActionCopyInstall = ActionCopy | ActionInstall,
+ ActionRun = 0x4,
+ ActionCopyRun = ActionCopy | ActionRun,
+ ActionInstallRun = ActionInstall | ActionRun,
+ ActionCopyInstallRun = ActionCopy | ActionInstall | ActionRun
+ };
+
+ enum State { Disconnected, Connecting, Connected,
+ WaitingForTrk, // This occurs only if the initial ping times out after
+ // a reasonable timeout, indicating that Trk is not
+ // running. Note that this will never happen with
+ // Bluetooth as communication immediately starts
+ // after connecting.
+ DeviceDescriptionReceived };
+
+ explicit Launcher(trk::Launcher::Actions startupActions = trk::Launcher::ActionPingOnly,
+ const TrkDevicePtr &trkDevice = TrkDevicePtr(),
+ QObject *parent = 0);
+ ~Launcher();
+
+ State state() const;
+
+ void addStartupActions(trk::Launcher::Actions startupActions);
+ void setTrkServerName(const QString &name);
+ QString trkServerName() const;
+ void setFileName(const QString &name);
+ void setCopyFileName(const QString &srcName, const QString &dstName);
+ void setInstallFileName(const QString &name);
+ void setCommandLineArgs(const QString &args);
+ bool startServer(QString *errorMessage);
+ void setVerbose(int v);
+ void setSerialFrame(bool b);
+ bool serialFrame() const;
+ // Close device or leave it open
+ bool closeDevice() const;
+ void setCloseDevice(bool c);
+
+ TrkDevicePtr trkDevice() const;
+
+ // becomes valid after successful execution of ActionPingOnly
+ QString deviceDescription(unsigned verbose = 0u) const;
+
+signals:
+ void copyingStarted();
+ void canNotConnect(const QString &errorMessage);
+ void canNotCreateFile(const QString &filename, const QString &errorMessage);
+ void canNotWriteFile(const QString &filename, const QString &errorMessage);
+ void canNotCloseFile(const QString &filename, const QString &errorMessage);
+ void installingStarted();
+ void canNotInstall(const QString &packageFilename, const QString &errorMessage);
+ void installingFinished();
+ void startingApplication();
+ void applicationRunning(uint pid);
+ void canNotRun(const QString &errorMessage);
+ void finished();
+ void applicationOutputReceived(const QString &output);
+ void copyProgress(int percent);
+ void stateChanged(int);
+ void stopped(uint pc, uint pid, uint tid, const QString& reason);
+
+public slots:
+ void terminate();
+ void resume(uint pid, uint tid);
+
+private slots:
+ void handleResult(const trk::TrkResult &data);
+ void slotWaitingForTrk();
+
+private:
+ // kill process and breakpoints
+ void cleanUp();
+ void disconnectTrk();
+
+ void handleRemoteProcessKilled(const TrkResult &result);
+ void handleConnect(const TrkResult &result);
+ void handleFileCreation(const TrkResult &result);
+ void handleCopy(const TrkResult &result);
+ void continueCopying(uint lastCopiedBlockSize = 0);
+ void closeRemoteFile(bool failed = false);
+ void handleFileCopied(const TrkResult &result);
+ void handleInstallPackageFinished(const TrkResult &result);
+ void handleCpuType(const TrkResult &result);
+ void handleCreateProcess(const TrkResult &result);
+ void handleWaitForFinished(const TrkResult &result);
+ void handleStop(const TrkResult &result);
+ void handleSupportMask(const TrkResult &result);
+ void handleTrkVersion(const TrkResult &result);
+
+ void copyFileToRemote();
+ void installRemotePackageSilently();
+ void startInferiorIfNeeded();
+
+ void logMessage(const QString &msg);
+ void setState(State s);
+
+ LauncherPrivate *d;
+};
+
+} // namespace Trk
+
+#endif // LAUNCHER_H
diff --git a/tools/runonphone/trk/trk.pri b/tools/runonphone/trk/trk.pri
new file mode 100644
index 0000000..2ce17c0
--- /dev/null
+++ b/tools/runonphone/trk/trk.pri
@@ -0,0 +1,23 @@
+INCLUDEPATH *= $$PWD
+
+# Input
+HEADERS += $$PWD/callback.h \
+ $$PWD/trkutils.h \
+ $$PWD/trkdevice.h \
+ $$PWD/launcher.h \
+ $$PWD/bluetoothlistener.h \
+ $$PWD/communicationstarter.h
+
+SOURCES += $$PWD/trkutils.cpp \
+ $$PWD/trkdevice.cpp \
+ $$PWD/launcher.cpp \
+ $$PWD/bluetoothlistener.cpp \
+ $$PWD/communicationstarter.cpp
+
+# Tests/trklauncher is a console application
+contains(QT, gui) {
+ HEADERS += $$PWD/bluetoothlistener_gui.h
+ SOURCES += $$PWD/bluetoothlistener_gui.cpp
+} else {
+ message(Trk: Console ...)
+}
diff --git a/tools/runonphone/trk/trkdevice.cpp b/tools/runonphone/trk/trkdevice.cpp
new file mode 100644
index 0000000..d31fff1
--- /dev/null
+++ b/tools/runonphone/trk/trkdevice.cpp
@@ -0,0 +1,1073 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications 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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "trkdevice.h"
+#include "trkutils.h"
+
+#include <QtCore/QString>
+#include <QtCore/QDebug>
+#include <QtCore/QQueue>
+#include <QtCore/QHash>
+#include <QtCore/QMap>
+#include <QtCore/QThread>
+#include <QtCore/QMutex>
+#include <QtCore/QWaitCondition>
+#include <QtCore/QSharedPointer>
+#include <QtCore/QMetaType>
+
+#ifdef Q_OS_WIN
+# include <windows.h>
+#else
+# include <QtCore/QFile>
+
+# include <stdio.h>
+# include <sys/ioctl.h>
+# include <sys/types.h>
+# include <termios.h>
+# include <errno.h>
+# include <string.h>
+# include <unistd.h>
+/* Required headers for select() according to POSIX.1-2001 */
+# include <sys/select.h>
+/* Required headers for select() according to earlier standards:
+ #include <sys/time.h>
+ #include <sys/types.h>
+ #include <unistd.h>
+*/
+#endif
+
+#ifdef Q_OS_WIN
+
+// Format windows error from GetLastError() value:
+// TODO: Use the one provided by the utils lib.
+QString winErrorMessage(unsigned long error)
+{
+ QString rc = QString::fromLatin1("#%1: ").arg(error);
+ ushort *lpMsgBuf;
+
+ const int len = FormatMessage(
+ FORMAT_MESSAGE_ALLOCATE_BUFFER
+ | FORMAT_MESSAGE_FROM_SYSTEM
+ | FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL, error, 0, (LPTSTR)&lpMsgBuf, 0, NULL);
+ if (len) {
+ rc = QString::fromUtf16(lpMsgBuf, len);
+ LocalFree(lpMsgBuf);
+ } else {
+ rc += QString::fromLatin1("<unknown error>");
+ }
+ return rc;
+}
+
+#endif
+
+namespace trk {
+
+///////////////////////////////////////////////////////////////////////
+//
+// TrkMessage
+//
+///////////////////////////////////////////////////////////////////////
+
+/* A message to be send to TRK, triggering a callback on receipt
+ * of the answer. */
+struct TrkMessage
+{
+ explicit TrkMessage(byte code = 0u, byte token = 0u,
+ TrkCallback callback = TrkCallback());
+
+ byte code;
+ byte token;
+ QByteArray data;
+ QVariant cookie;
+ TrkCallback callback;
+};
+
+TrkMessage::TrkMessage(byte c, byte t, TrkCallback cb) :
+ code(c),
+ token(t),
+ callback(cb)
+{
+}
+
+} // namespace trk
+
+Q_DECLARE_METATYPE(trk::TrkMessage)
+Q_DECLARE_METATYPE(trk::TrkResult)
+
+namespace trk {
+
+///////////////////////////////////////////////////////////////////////
+//
+// TrkWriteQueue: Mixin class that manages a write queue of Trk messages.
+// pendingMessage()/notifyWriteResult() should be called from a worked/timer
+// that writes the messages. The class does not take precautions for multithreading.
+// A no-op message is simply taken off the queue. The calling class
+// can use the helper invokeNoopMessage() to trigger its callback.
+//
+///////////////////////////////////////////////////////////////////////
+
+class TrkWriteQueue
+{
+ Q_DISABLE_COPY(TrkWriteQueue)
+public:
+ explicit TrkWriteQueue();
+
+ // Enqueue messages.
+ void queueTrkMessage(byte code, TrkCallback callback,
+ const QByteArray &data, const QVariant &cookie);
+ void queueTrkInitialPing();
+
+ // Call this from the device read notification with the results.
+ void slotHandleResult(const TrkResult &result, QMutex *mutex = 0);
+
+ // pendingMessage() can be called periodically in a timer to retrieve
+ // the pending messages to be sent.
+ enum PendingMessageResult {
+ NoMessage, // No message in queue.
+ PendingMessage, /* There is a queued message. The calling class
+ * can write it out and use notifyWriteResult()
+ * to notify about the result. */
+ NoopMessageDequeued // A no-op message has been dequeued. see invokeNoopMessage().
+ };
+
+ PendingMessageResult pendingMessage(TrkMessage *message);
+ // Notify the queue about the success of the write operation
+ // after taking the pendingMessage off.
+ enum WriteResult {
+ WriteOk,
+ WriteFailedDiscard, // Discard failed message
+ WriteFailedKeep, // Keep failed message
+ };
+ void notifyWriteResult(WriteResult ok);
+
+ // Helper function that invokes the callback of a no-op message
+ static void invokeNoopMessage(trk::TrkMessage);
+
+private:
+ typedef QMap<byte, TrkMessage> TokenMessageMap;
+
+ byte nextTrkWriteToken();
+
+ byte m_trkWriteToken;
+ QQueue<TrkMessage> m_trkWriteQueue;
+ TokenMessageMap m_writtenTrkMessages;
+ bool m_trkWriteBusy;
+};
+
+TrkWriteQueue::TrkWriteQueue() :
+ m_trkWriteToken(0),
+ m_trkWriteBusy(false)
+{
+}
+
+byte TrkWriteQueue::nextTrkWriteToken()
+{
+ ++m_trkWriteToken;
+ if (m_trkWriteToken == 0)
+ ++m_trkWriteToken;
+ return m_trkWriteToken;
+}
+
+void TrkWriteQueue::queueTrkMessage(byte code, TrkCallback callback,
+ const QByteArray &data, const QVariant &cookie)
+{
+ const byte token = code == TRK_WRITE_QUEUE_NOOP_CODE ?
+ byte(0) : nextTrkWriteToken();
+ TrkMessage msg(code, token, callback);
+ msg.data = data;
+ msg.cookie = cookie;
+ m_trkWriteQueue.append(msg);
+}
+
+TrkWriteQueue::PendingMessageResult TrkWriteQueue::pendingMessage(TrkMessage *message)
+{
+ // Invoked from timer, try to flush out message queue
+ if (m_trkWriteBusy || m_trkWriteQueue.isEmpty())
+ return NoMessage;
+ // Handle the noop message, just invoke CB in slot (ower thread)
+ if (m_trkWriteQueue.front().code == TRK_WRITE_QUEUE_NOOP_CODE) {
+ *message = m_trkWriteQueue.dequeue();
+ return NoopMessageDequeued;
+ }
+ // Insert into map fir answers (as reading threads might get an
+ // answer before notifyWriteResult(true)) is called.
+ *message = m_trkWriteQueue.front();
+ m_writtenTrkMessages.insert(message->token, *message);
+ m_trkWriteBusy = true;
+ return PendingMessage;
+}
+
+void TrkWriteQueue::invokeNoopMessage(trk::TrkMessage noopMessage)
+{
+ TrkResult result;
+ result.code = noopMessage.code;
+ result.token = noopMessage.token;
+ result.data = noopMessage.data;
+ result.cookie = noopMessage.cookie;
+ noopMessage.callback(result);
+}
+
+void TrkWriteQueue::notifyWriteResult(WriteResult wr)
+{
+ // On success, dequeue message and await result
+ const byte token = m_trkWriteQueue.front().token;
+ switch (wr) {
+ case WriteOk:
+ m_trkWriteQueue.dequeue();
+ break;
+ case WriteFailedKeep:
+ case WriteFailedDiscard:
+ m_writtenTrkMessages.remove(token);
+ m_trkWriteBusy = false;
+ if (wr == WriteFailedDiscard)
+ m_trkWriteQueue.dequeue();
+ break;
+ }
+}
+
+void TrkWriteQueue::slotHandleResult(const TrkResult &result, QMutex *mutex)
+{
+ // Find which request the message belongs to and invoke callback
+ // if ACK or on NAK if desired.
+ if (mutex)
+ mutex->lock();
+ m_trkWriteBusy = false;
+ const TokenMessageMap::iterator it = m_writtenTrkMessages.find(result.token);
+ if (it == m_writtenTrkMessages.end()) {
+ if (mutex)
+ mutex->unlock();
+ return;
+ }
+ TrkCallback callback = it.value().callback;
+ const QVariant cookie = it.value().cookie;
+ m_writtenTrkMessages.erase(it);
+ if (mutex)
+ mutex->unlock();
+ // Invoke callback
+ if (callback) {
+ TrkResult result1 = result;
+ result1.cookie = cookie;
+ callback(result1);
+ }
+}
+
+void TrkWriteQueue::queueTrkInitialPing()
+{
+ // Ping, reset sequence count
+ m_trkWriteToken = 0;
+ m_trkWriteQueue.append(TrkMessage(TrkPing, 0));
+}
+
+///////////////////////////////////////////////////////////////////////
+//
+// DeviceContext to be shared between threads
+//
+///////////////////////////////////////////////////////////////////////
+
+struct DeviceContext {
+ DeviceContext();
+#ifdef Q_OS_WIN
+ HANDLE device;
+ OVERLAPPED readOverlapped;
+ OVERLAPPED writeOverlapped;
+#else
+ QFile file;
+#endif
+ bool serialFrame;
+ QMutex mutex;
+};
+
+DeviceContext::DeviceContext() :
+#ifdef Q_OS_WIN
+ device(INVALID_HANDLE_VALUE),
+#endif
+ serialFrame(true)
+{
+}
+
+///////////////////////////////////////////////////////////////////////
+//
+// TrkWriterThread: A thread operating a TrkWriteQueue.
+// with exception of the handling of the TRK_WRITE_QUEUE_NOOP_CODE
+// synchronization message. The invocation of the callback is then
+// done by the thread owning the TrkWriteQueue, while pendingMessage() is called
+// from another thread. This happens via a Qt::BlockingQueuedConnection.
+
+///////////////////////////////////////////////////////////////////////
+
+class WriterThread : public QThread {
+ Q_OBJECT
+ Q_DISABLE_COPY(WriterThread)
+public:
+ explicit WriterThread(const QSharedPointer<DeviceContext> &context);
+
+ // Enqueue messages.
+ void queueTrkMessage(byte code, TrkCallback callback,
+ const QByteArray &data, const QVariant &cookie);
+ void queueTrkInitialPing();
+
+ // Call this from the device read notification with the results.
+ void slotHandleResult(const TrkResult &result);
+
+ virtual void run();
+
+signals:
+ void error(const QString &);
+ void internalNoopMessageDequeued(const trk::TrkMessage&);
+
+public slots:
+ bool trkWriteRawMessage(const TrkMessage &msg);
+ void terminate();
+ void tryWrite();
+
+private slots:
+ void invokeNoopMessage(const trk::TrkMessage &);
+
+private:
+ bool write(const QByteArray &data, QString *errorMessage);
+ inline int writePendingMessage();
+
+ const QSharedPointer<DeviceContext> m_context;
+ QMutex m_dataMutex;
+ QMutex m_waitMutex;
+ QWaitCondition m_waitCondition;
+ TrkWriteQueue m_queue;
+ bool m_terminate;
+};
+
+WriterThread::WriterThread(const QSharedPointer<DeviceContext> &context) :
+ m_context(context),
+ m_terminate(false)
+{
+ static const int trkMessageMetaId = qRegisterMetaType<trk::TrkMessage>();
+ Q_UNUSED(trkMessageMetaId)
+ connect(this, SIGNAL(internalNoopMessageDequeued(trk::TrkMessage)),
+ this, SLOT(invokeNoopMessage(trk::TrkMessage)), Qt::BlockingQueuedConnection);
+}
+
+void WriterThread::run()
+{
+ while (writePendingMessage() == 0) ;
+}
+
+int WriterThread::writePendingMessage()
+{
+ enum { MaxAttempts = 100, RetryIntervalMS = 200 };
+
+ // Wait. Use a timeout in case something is already queued before we
+ // start up or some weird hanging exit condition
+ m_waitMutex.lock();
+ m_waitCondition.wait(&m_waitMutex, 100);
+ m_waitMutex.unlock();
+ if (m_terminate)
+ return 1;
+ // Send off message
+ m_dataMutex.lock();
+ TrkMessage message;
+ const TrkWriteQueue::PendingMessageResult pr = m_queue.pendingMessage(&message);
+ m_dataMutex.unlock();
+ switch (pr) {
+ case TrkWriteQueue::NoMessage:
+ break;
+ case TrkWriteQueue::PendingMessage: {
+ // Untested: try to re-send a few times
+ bool success = false;
+ for (int r = 0; !success && (r < MaxAttempts); r++) {
+ success = trkWriteRawMessage(message);
+ if (!success) {
+ emit error(QString::fromLatin1("Write failure, attempt %1 of %2.").arg(r).arg(int(MaxAttempts)));
+ if (m_terminate)
+ return 1;
+ QThread::msleep(RetryIntervalMS);
+ }
+ }
+ // Notify queue. If still failed, give up.
+ m_dataMutex.lock();
+ m_queue.notifyWriteResult(success ? TrkWriteQueue::WriteOk : TrkWriteQueue::WriteFailedDiscard);
+ m_dataMutex.unlock();
+ }
+ break;
+ case TrkWriteQueue::NoopMessageDequeued:
+ // Sync with thread that owns us via a blocking signal
+ emit internalNoopMessageDequeued(message);
+ break;
+ } // switch
+ return 0;
+}
+
+void WriterThread::invokeNoopMessage(const trk::TrkMessage &msg)
+{
+ TrkWriteQueue::invokeNoopMessage(msg);
+}
+
+void WriterThread::terminate()
+{
+ m_terminate = true;
+ m_waitCondition.wakeAll();
+ wait();
+ m_terminate = false;
+}
+
+#ifdef Q_OS_WIN
+
+static inline QString msgTerminated(int size)
+{
+ return QString::fromLatin1("Terminated with %1 bytes pending.").arg(size);
+}
+
+// Interruptible synchronous write function.
+static inline bool overlappedSyncWrite(HANDLE file,
+ const bool &terminateFlag,
+ const char *data,
+ DWORD size, DWORD *charsWritten,
+ OVERLAPPED *overlapped,
+ QString *errorMessage)
+{
+ if (WriteFile(file, data, size, charsWritten, overlapped))
+ return true;
+ const DWORD writeError = GetLastError();
+ if (writeError != ERROR_IO_PENDING) {
+ *errorMessage = QString::fromLatin1("WriteFile failed: %1").arg(winErrorMessage(writeError));
+ return false;
+ }
+ // Wait for written or thread terminated
+ const DWORD timeoutMS = 200;
+ const unsigned maxAttempts = 20;
+ DWORD wr = WaitForSingleObject(overlapped->hEvent, timeoutMS);
+ for (unsigned n = 0; wr == WAIT_TIMEOUT && n < maxAttempts && !terminateFlag;
+ wr = WaitForSingleObject(overlapped->hEvent, timeoutMS), n++);
+ if (terminateFlag) {
+ *errorMessage = msgTerminated(size);
+ return false;
+ }
+ switch (wr) {
+ case WAIT_OBJECT_0:
+ break;
+ case WAIT_TIMEOUT:
+ *errorMessage = QString::fromLatin1("Write timed out.");
+ return false;
+ default:
+ *errorMessage = QString::fromLatin1("Error while waiting for WriteFile results: %1").arg(winErrorMessage(GetLastError()));
+ return false;
+ }
+ if (!GetOverlappedResult(file, overlapped, charsWritten, TRUE)) {
+ *errorMessage = QString::fromLatin1("Error writing %1 bytes: %2").arg(size).arg(winErrorMessage(GetLastError()));
+ return false;
+ }
+ return true;
+}
+#endif
+
+bool WriterThread::write(const QByteArray &data, QString *errorMessage)
+{
+ QMutexLocker locker(&m_context->mutex);
+#ifdef Q_OS_WIN
+ DWORD charsWritten;
+ if (!overlappedSyncWrite(m_context->device, m_terminate, data.data(), data.size(), &charsWritten, &m_context->writeOverlapped, errorMessage)) {
+ return false;
+ }
+ FlushFileBuffers(m_context->device);
+ return true;
+#else
+ if (m_context->file.write(data) == -1 || !m_context->file.flush()) {
+ *errorMessage = QString::fromLatin1("Cannot write: %1").arg(m_context->file.errorString());
+ return false;
+ }
+ return true;
+#endif
+}
+
+bool WriterThread::trkWriteRawMessage(const TrkMessage &msg)
+{
+ const QByteArray ba = frameMessage(msg.code, msg.token, msg.data, m_context->serialFrame);
+ QString errorMessage;
+ const bool rc = write(ba, &errorMessage);
+ if (!rc) {
+ qWarning("%s\n", qPrintable(errorMessage));
+ emit error(errorMessage);
+ }
+ return rc;
+}
+
+void WriterThread::tryWrite()
+{
+ m_waitCondition.wakeAll();
+}
+
+void WriterThread::queueTrkMessage(byte code, TrkCallback callback,
+ const QByteArray &data, const QVariant &cookie)
+{
+ m_dataMutex.lock();
+ m_queue.queueTrkMessage(code, callback, data, cookie);
+ m_dataMutex.unlock();
+ tryWrite();
+}
+
+void WriterThread::queueTrkInitialPing()
+{
+ m_dataMutex.lock();
+ m_queue.queueTrkInitialPing();
+ m_dataMutex.unlock();
+ tryWrite();
+}
+
+// Call this from the device read notification with the results.
+void WriterThread::slotHandleResult(const TrkResult &result)
+{
+ m_queue.slotHandleResult(result, &m_dataMutex);
+ tryWrite(); // Have messages been enqueued in-between?
+}
+
+///////////////////////////////////////////////////////////////////////
+//
+// ReaderThreadBase: Base class for a thread that reads data from
+// the device, decodes the messages and emit signals for the messages.
+// A Qt::BlockingQueuedConnection should be used for the message signal
+// to ensure messages are processed in the correct sequence.
+//
+///////////////////////////////////////////////////////////////////////
+
+class ReaderThreadBase : public QThread {
+ Q_OBJECT
+ Q_DISABLE_COPY(ReaderThreadBase)
+public:
+
+signals:
+ void messageReceived(const trk::TrkResult &result, const QByteArray &rawData);
+
+protected:
+ explicit ReaderThreadBase(const QSharedPointer<DeviceContext> &context);
+ void processData(const QByteArray &a);
+ void processData(char c);
+
+ const QSharedPointer<DeviceContext> m_context;
+
+private:
+ void readMessages();
+
+ QByteArray m_trkReadBuffer;
+};
+
+ReaderThreadBase::ReaderThreadBase(const QSharedPointer<DeviceContext> &context) :
+ m_context(context)
+{
+ static const int trkResultMetaId = qRegisterMetaType<trk::TrkResult>();
+ Q_UNUSED(trkResultMetaId)
+}
+
+void ReaderThreadBase::processData(const QByteArray &a)
+{
+ m_trkReadBuffer += a;
+ readMessages();
+}
+
+void ReaderThreadBase::processData(char c)
+{
+ m_trkReadBuffer += c;
+ if (m_trkReadBuffer.size() > 1)
+ readMessages();
+}
+
+void ReaderThreadBase::readMessages()
+{
+ TrkResult r;
+ QByteArray rawData;
+ while (extractResult(&m_trkReadBuffer, m_context->serialFrame, &r, &rawData)) {
+ emit messageReceived(r, rawData);
+ }
+}
+
+#ifdef Q_OS_WIN
+///////////////////////////////////////////////////////////////////////
+//
+// WinReaderThread: A thread reading from the device using Windows API.
+// Waits on an overlapped I/O handle and an event that tells the thread to
+// terminate.
+//
+///////////////////////////////////////////////////////////////////////
+
+class WinReaderThread : public ReaderThreadBase {
+ Q_OBJECT
+ Q_DISABLE_COPY(WinReaderThread)
+public:
+ explicit WinReaderThread(const QSharedPointer<DeviceContext> &context);
+ ~WinReaderThread();
+
+ virtual void run();
+
+signals:
+ void error(const QString &);
+
+public slots:
+ void terminate();
+
+private:
+ enum Handles { FileHandle, TerminateEventHandle, HandleCount };
+
+ inline int tryRead();
+
+ HANDLE m_handles[HandleCount];
+};
+
+WinReaderThread::WinReaderThread(const QSharedPointer<DeviceContext> &context) :
+ ReaderThreadBase(context)
+{
+ m_handles[FileHandle] = NULL;
+ m_handles[TerminateEventHandle] = CreateEvent(NULL, FALSE, FALSE, NULL);
+}
+
+WinReaderThread::~WinReaderThread()
+{
+ CloseHandle(m_handles[TerminateEventHandle]);
+}
+
+// Return 0 to continue or error code
+int WinReaderThread::tryRead()
+{
+ enum { BufSize = 1024 };
+ char buffer[BufSize];
+ // Check if there are already bytes waiting. If not, wait for first byte
+ COMSTAT comStat;
+ if (!ClearCommError(m_context->device, NULL, &comStat)){
+ emit error(QString::fromLatin1("ClearCommError failed: %1").arg(winErrorMessage(GetLastError())));
+ return -7;
+ }
+ const DWORD bytesToRead = qMax(DWORD(1), qMin(comStat.cbInQue, DWORD(BufSize)));
+ // Trigger read
+ DWORD bytesRead = 0;
+ if (ReadFile(m_context->device, &buffer, bytesToRead, &bytesRead, &m_context->readOverlapped)) {
+ if (bytesRead == 1) {
+ processData(buffer[0]);
+ } else {
+ processData(QByteArray(buffer, bytesRead));
+ }
+ return 0;
+ }
+ const DWORD readError = GetLastError();
+ if (readError != ERROR_IO_PENDING) {
+ emit error(QString::fromLatin1("Read error: %1").arg(winErrorMessage(readError)));
+ return -1;
+ }
+ // Wait for either termination or data
+ const DWORD wr = WaitForMultipleObjects(HandleCount, m_handles, false, INFINITE);
+ if (wr == WAIT_FAILED) {
+ emit error(QString::fromLatin1("Wait failed: %1").arg(winErrorMessage(GetLastError())));
+ return -2;
+ }
+ if (wr - WAIT_OBJECT_0 == TerminateEventHandle) {
+ return 1; // Terminate
+ }
+ // Check data
+ if (!GetOverlappedResult(m_context->device, &m_context->readOverlapped, &bytesRead, true)) {
+ emit error(QString::fromLatin1("GetOverlappedResult failed: %1").arg(winErrorMessage(GetLastError())));
+ return -3;
+ }
+ if (bytesRead == 1) {
+ processData(buffer[0]);
+ } else {
+ processData(QByteArray(buffer, bytesRead));
+ }
+ return 0;
+}
+
+void WinReaderThread::run()
+{
+ m_handles[FileHandle] = m_context->readOverlapped.hEvent;
+ while ( tryRead() == 0) ;
+}
+
+void WinReaderThread::terminate()
+{
+ SetEvent(m_handles[TerminateEventHandle]);
+ wait();
+}
+
+typedef WinReaderThread ReaderThread;
+
+#else
+
+///////////////////////////////////////////////////////////////////////
+//
+// UnixReaderThread: A thread reading from the device.
+// Uses select() to wait and a special ioctl() to find out the number
+// of bytes queued. For clean termination, the self-pipe trick is used.
+// The class maintains a pipe, on whose read end the select waits besides
+// the device file handle. To terminate, a byte is written to the pipe.
+//
+///////////////////////////////////////////////////////////////////////
+
+static inline QString msgUnixCallFailedErrno(const char *func, int errorNumber)
+{
+ return QString::fromLatin1("Call to %1() failed: %2").arg(QLatin1String(func), QString::fromLocal8Bit(strerror(errorNumber)));
+}
+
+class UnixReaderThread : public ReaderThreadBase {
+ Q_OBJECT
+ Q_DISABLE_COPY(UnixReaderThread)
+public:
+ explicit UnixReaderThread(const QSharedPointer<DeviceContext> &context);
+ ~UnixReaderThread();
+
+ virtual void run();
+
+signals:
+ void error(const QString &);
+
+public slots:
+ void terminate();
+
+private:
+ inline int tryRead();
+
+ int m_terminatePipeFileDescriptors[2];
+};
+
+UnixReaderThread::UnixReaderThread(const QSharedPointer<DeviceContext> &context) :
+ ReaderThreadBase(context)
+{
+ m_terminatePipeFileDescriptors[0] = m_terminatePipeFileDescriptors[1] = -1;
+ // Set up pipes for termination. Should not fail
+ if (pipe(m_terminatePipeFileDescriptors) < 0)
+ qWarning("%s\n", qPrintable(msgUnixCallFailedErrno("pipe", errno)));
+}
+
+UnixReaderThread::~UnixReaderThread()
+{
+ close(m_terminatePipeFileDescriptors[0]);
+ close(m_terminatePipeFileDescriptors[1]);
+}
+
+int UnixReaderThread::tryRead()
+{
+ fd_set readSet, tempReadSet, tempExceptionSet;
+ struct timeval timeOut;
+ const int fileDescriptor = m_context->file.handle();
+ FD_ZERO(&readSet);
+ FD_SET(fileDescriptor, &readSet);
+ FD_SET(m_terminatePipeFileDescriptors[0], &readSet);
+ const int maxFileDescriptor = qMax(m_terminatePipeFileDescriptors[0], fileDescriptor);
+ int result = 0;
+ do {
+ memcpy(&tempReadSet, &readSet, sizeof(fd_set));
+ memcpy(&tempExceptionSet, &readSet, sizeof(fd_set));
+ timeOut.tv_sec = 1;
+ timeOut.tv_usec = 0;
+ result = select(maxFileDescriptor + 1, &tempReadSet, NULL, &tempExceptionSet, &timeOut);
+ } while ( result < 0 && errno == EINTR );
+ // Timeout?
+ if (result == 0)
+ return 0;
+ // Something wrong?
+ if (result < 0) {
+ emit error(msgUnixCallFailedErrno("select", errno));
+ return -1;
+ }
+ // Did the exception set trigger on the device?
+ if (FD_ISSET(fileDescriptor,&tempExceptionSet)) {
+ emit error(QLatin1String("An Exception occurred on the device."));
+ return -2;
+ }
+ // Check termination pipe.
+ if (FD_ISSET(m_terminatePipeFileDescriptors[0], &tempReadSet)
+ || FD_ISSET(m_terminatePipeFileDescriptors[0], &tempExceptionSet))
+ return 1;
+
+ // determine number of pending bytes and read
+ int numBytes;
+ if (ioctl(fileDescriptor, FIONREAD, &numBytes) < 0) {
+ emit error(msgUnixCallFailedErrno("ioctl", errno));
+ return -1;
+ }
+ m_context->mutex.lock();
+ const QByteArray data = m_context->file.read(numBytes);
+ m_context->mutex.unlock();
+ processData(data);
+ return 0;
+}
+
+void UnixReaderThread::run()
+{
+ // Read loop
+ while (tryRead() == 0)
+ ;
+}
+
+void UnixReaderThread::terminate()
+{
+ // Trigger select() by writing to the pipe
+ char c = 0;
+ write(m_terminatePipeFileDescriptors[1], &c, 1);
+ wait();
+}
+
+typedef UnixReaderThread ReaderThread;
+
+#endif
+
+///////////////////////////////////////////////////////////////////////
+//
+// TrkDevicePrivate
+//
+///////////////////////////////////////////////////////////////////////
+
+struct TrkDevicePrivate
+{
+ TrkDevicePrivate();
+
+ QSharedPointer<DeviceContext> deviceContext;
+ QSharedPointer<WriterThread> writerThread;
+ QSharedPointer<ReaderThread> readerThread;
+
+ QByteArray trkReadBuffer;
+ int verbose;
+ QString errorString;
+};
+
+///////////////////////////////////////////////////////////////////////
+//
+// TrkDevice
+//
+///////////////////////////////////////////////////////////////////////
+
+TrkDevicePrivate::TrkDevicePrivate() :
+ deviceContext(new DeviceContext),
+ verbose(0)
+{
+}
+
+///////////////////////////////////////////////////////////////////////
+//
+// TrkDevice
+//
+///////////////////////////////////////////////////////////////////////
+
+TrkDevice::TrkDevice(QObject *parent) :
+ QObject(parent),
+ d(new TrkDevicePrivate)
+{}
+
+TrkDevice::~TrkDevice()
+{
+ close();
+ delete d;
+}
+
+bool TrkDevice::open(const QString &port, QString *errorMessage)
+{
+ if (d->verbose)
+ qDebug() << "Opening" << port << "is open: " << isOpen() << " serialFrame=" << serialFrame();
+ close();
+#ifdef Q_OS_WIN
+ d->deviceContext->device = CreateFile(port.toStdWString().c_str(),
+ GENERIC_READ | GENERIC_WRITE,
+ 0,
+ NULL,
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL|FILE_FLAG_NO_BUFFERING|FILE_FLAG_OVERLAPPED,
+ NULL);
+
+ if (INVALID_HANDLE_VALUE == d->deviceContext->device) {
+ *errorMessage = QString::fromLatin1("Could not open device '%1': %2").arg(port, winErrorMessage(GetLastError()));
+ return false;
+ }
+ memset(&d->deviceContext->readOverlapped, 0, sizeof(OVERLAPPED));
+ d->deviceContext->readOverlapped.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ memset(&d->deviceContext->writeOverlapped, 0, sizeof(OVERLAPPED));
+ d->deviceContext->writeOverlapped.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ if (d->deviceContext->readOverlapped.hEvent == NULL || d->deviceContext->writeOverlapped.hEvent == NULL) {
+ *errorMessage = QString::fromLatin1("Failed to create events: %1").arg(winErrorMessage(GetLastError()));
+ return false;
+ }
+#else
+ d->deviceContext->file.setFileName(port);
+ if (!d->deviceContext->file.open(QIODevice::ReadWrite|QIODevice::Unbuffered)) {
+ *errorMessage = QString::fromLatin1("Cannot open %1: %2").arg(port, d->deviceContext->file.errorString());
+ return false;
+ }
+
+ struct termios termInfo;
+ if (tcgetattr(d->deviceContext->file.handle(), &termInfo) < 0) {
+ *errorMessage = QString::fromLatin1("Unable to retrieve terminal settings: %1 %2").arg(errno).arg(QString::fromAscii(strerror(errno)));
+ return false;
+ }
+ // Turn off terminal echo as not get messages back, among other things
+ termInfo.c_cflag |= CREAD|CLOCAL;
+ termInfo.c_lflag &= (~(ICANON|ECHO|ECHOE|ECHOK|ECHONL|ISIG));
+ termInfo.c_iflag &= (~(INPCK|IGNPAR|PARMRK|ISTRIP|ICRNL|IXANY));
+ termInfo.c_oflag &= (~OPOST);
+ termInfo.c_cc[VMIN] = 0;
+ termInfo.c_cc[VINTR] = _POSIX_VDISABLE;
+ termInfo.c_cc[VQUIT] = _POSIX_VDISABLE;
+ termInfo.c_cc[VSTART] = _POSIX_VDISABLE;
+ termInfo.c_cc[VSTOP] = _POSIX_VDISABLE;
+ termInfo.c_cc[VSUSP] = _POSIX_VDISABLE;
+ if (tcsetattr(d->deviceContext->file.handle(), TCSAFLUSH, &termInfo) < 0) {
+ *errorMessage = QString::fromLatin1("Unable to apply terminal settings: %1 %2").arg(errno).arg(QString::fromAscii(strerror(errno)));
+ return false;
+ }
+#endif
+ d->readerThread = QSharedPointer<ReaderThread>(new ReaderThread(d->deviceContext));
+ connect(d->readerThread.data(), SIGNAL(error(QString)), this, SLOT(emitError(QString)),
+ Qt::QueuedConnection);
+ connect(d->readerThread.data(), SIGNAL(messageReceived(trk::TrkResult,QByteArray)),
+ this, SLOT(slotMessageReceived(trk::TrkResult,QByteArray)),
+ Qt::QueuedConnection);
+ d->readerThread->start();
+
+ d->writerThread = QSharedPointer<WriterThread>(new WriterThread(d->deviceContext));
+ connect(d->writerThread.data(), SIGNAL(error(QString)), this, SLOT(emitError(QString)),
+ Qt::QueuedConnection);
+ d->writerThread->start();
+
+ if (d->verbose)
+ qDebug() << "Opened" << port;
+ return true;
+}
+
+void TrkDevice::close()
+{
+ if (!isOpen())
+ return;
+ if (d->readerThread)
+ d->readerThread->terminate();
+ if (d->writerThread)
+ d->writerThread->terminate();
+#ifdef Q_OS_WIN
+ CloseHandle(d->deviceContext->device);
+ d->deviceContext->device = INVALID_HANDLE_VALUE;
+ CloseHandle(d->deviceContext->readOverlapped.hEvent);
+ CloseHandle(d->deviceContext->writeOverlapped.hEvent);
+ d->deviceContext->readOverlapped.hEvent = d->deviceContext->writeOverlapped.hEvent = NULL;
+#else
+ d->deviceContext->file.close();
+#endif
+ if (d->verbose)
+ emitLogMessage("Close");
+}
+
+bool TrkDevice::isOpen() const
+{
+#ifdef Q_OS_WIN
+ return d->deviceContext->device != INVALID_HANDLE_VALUE;
+#else
+ return d->deviceContext->file.isOpen();
+#endif
+}
+
+QString TrkDevice::errorString() const
+{
+ return d->errorString;
+}
+
+bool TrkDevice::serialFrame() const
+{
+ return d->deviceContext->serialFrame;
+}
+
+void TrkDevice::setSerialFrame(bool f)
+{
+ d->deviceContext->serialFrame = f;
+}
+
+int TrkDevice::verbose() const
+{
+ return d->verbose;
+}
+
+void TrkDevice::setVerbose(int b)
+{
+ d->verbose = b;
+}
+
+void TrkDevice::slotMessageReceived(const trk::TrkResult &result, const QByteArray &rawData)
+{
+ d->writerThread->slotHandleResult(result);
+ emit messageReceived(result);
+ if (!rawData.isEmpty())
+ emit rawDataReceived(rawData);
+}
+
+void TrkDevice::emitError(const QString &s)
+{
+ d->errorString = s;
+ qWarning("%s\n", qPrintable(s));
+ emit error(s);
+}
+
+void TrkDevice::sendTrkMessage(byte code, TrkCallback callback,
+ const QByteArray &data, const QVariant &cookie)
+{
+ if (!d->writerThread.isNull()) {
+ if (d->verbose > 1)
+ qDebug() << "Sending " << code << data.toHex();
+ d->writerThread->queueTrkMessage(code, callback, data, cookie);
+ }
+}
+
+void TrkDevice::sendTrkInitialPing()
+{
+ if (!d->writerThread.isNull())
+ d->writerThread->queueTrkInitialPing();
+}
+
+bool TrkDevice::sendTrkAck(byte token)
+{
+ if (d->writerThread.isNull())
+ return false;
+ // The acknowledgement must not be queued!
+ TrkMessage msg(0x80, token);
+ msg.token = token;
+ msg.data.append('\0');
+ return d->writerThread->trkWriteRawMessage(msg);
+ // 01 90 00 07 7e 80 01 00 7d 5e 7e
+}
+
+void TrkDevice::emitLogMessage(const QString &msg)
+{
+ if (d->verbose)
+ qDebug("%s\n", qPrintable(msg));
+ emit logMessage(msg);
+}
+
+} // namespace trk
+
+#include "trkdevice.moc"
diff --git a/tools/runonphone/trk/trkdevice.h b/tools/runonphone/trk/trkdevice.h
new file mode 100644
index 0000000..41e7a6e
--- /dev/null
+++ b/tools/runonphone/trk/trkdevice.h
@@ -0,0 +1,133 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications 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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TRKDEVICE_H
+#define TRKDEVICE_H
+
+#include "callback.h"
+
+#include <QtCore/QObject>
+#include <QtCore/QVariant>
+#include <QtCore/QByteArray>
+#include <QtCore/QSharedPointer>
+
+QT_BEGIN_NAMESPACE
+class QIODevice;
+QT_END_NAMESPACE
+
+namespace trk {
+
+struct TrkResult;
+struct TrkMessage;
+struct TrkDevicePrivate;
+
+/* TrkDevice: Implements a Windows COM or Linux device for
+ * Trk communications. Provides synchronous write and asynchronous
+ * read operation.
+ * The serialFrames property specifies whether packets are encapsulated in
+ * "0x90 <length>" frames, which is currently the case for serial ports.
+ * Contains a write message queue allowing
+ * for queueing messages with a notification callback. If the message receives
+ * an ACK, the callback is invoked.
+ * The special message TRK_WRITE_QUEUE_NOOP_CODE code can be used for synchronisation.
+ * The respective message will not be sent, the callback is just invoked. */
+
+enum { TRK_WRITE_QUEUE_NOOP_CODE = 0x7f };
+
+typedef trk::Callback<const TrkResult &> TrkCallback;
+
+class TrkDevice : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(bool serialFrame READ serialFrame WRITE setSerialFrame)
+ Q_PROPERTY(bool verbose READ verbose WRITE setVerbose)
+public:
+ explicit TrkDevice(QObject *parent = 0);
+ virtual ~TrkDevice();
+
+ bool open(const QString &port, QString *errorMessage);
+ bool isOpen() const;
+
+ QString errorString() const;
+
+ bool serialFrame() const;
+ void setSerialFrame(bool f);
+
+ int verbose() const;
+ void setVerbose(int b);
+
+ // Enqueue a message with a notification callback.
+ void sendTrkMessage(unsigned char code,
+ TrkCallback callBack = TrkCallback(),
+ const QByteArray &data = QByteArray(),
+ const QVariant &cookie = QVariant());
+
+ // Enqeue an initial ping
+ void sendTrkInitialPing();
+
+ // Send an Ack synchronously, bypassing the queue
+ bool sendTrkAck(unsigned char token);
+
+signals:
+ void messageReceived(const trk::TrkResult &result);
+ // Emitted with the contents of messages enclosed in 07e, not for log output
+ void rawDataReceived(const QByteArray &data);
+ void error(const QString &msg);
+ void logMessage(const QString &msg);
+
+private slots:
+ void slotMessageReceived(const trk::TrkResult &result, const QByteArray &a);
+
+protected slots:
+ void emitError(const QString &msg);
+ void emitLogMessage(const QString &msg);
+
+public slots:
+ void close();
+
+private:
+ void readMessages();
+ TrkDevicePrivate *d;
+};
+
+} // namespace trk
+
+#endif // TRKDEVICE_H
diff --git a/tools/runonphone/trk/trkutils.cpp b/tools/runonphone/trk/trkutils.cpp
new file mode 100644
index 0000000..4fb4f1b
--- /dev/null
+++ b/tools/runonphone/trk/trkutils.cpp
@@ -0,0 +1,486 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications 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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "trkutils.h"
+#include <ctype.h>
+
+#include <QtCore/QCoreApplication>
+#include <QtCore/QDebug>
+#include <QtCore/QDate>
+#include <QtCore/QDateTime>
+#include <QtCore/QTime>
+
+#define logMessage(s) do { qDebug() << "TRKCLIENT: " << s; } while (0)
+
+namespace trk {
+
+TrkAppVersion::TrkAppVersion()
+{
+ reset();
+}
+
+void TrkAppVersion::reset()
+{
+ trkMajor = trkMinor= protocolMajor = protocolMinor = 0;
+}
+
+Session::Session()
+{
+ reset();
+}
+
+void Session::reset()
+{
+ cpuMajor = 0;
+ cpuMinor = 0;
+ bigEndian = 0;
+ defaultTypeSize = 0;
+ fpTypeSize = 0;
+ extended1TypeSize = 0;
+ extended2TypeSize = 0;
+ pid = 0;
+ tid = 0;
+ codeseg = 0;
+ dataseg = 0;
+
+ currentThread = 0;
+ libraries.clear();
+ trkAppVersion.reset();
+}
+
+QString formatCpu(int major, int minor)
+{
+ //: CPU description of an S60 device
+ //: %1 major verison, %2 minor version
+ //: %3 real name of major verison, %4 real name of minor version
+ const QString str = QCoreApplication::translate("trk::Session", "CPU: v%1.%2%3%4");
+ QString majorStr;
+ QString minorStr;
+ switch (major) {
+ case 0x04:
+ majorStr = " ARM";
+ break;
+ }
+ switch (minor) {
+ case 0x00:
+ minorStr = " 920T";
+ break;
+ }
+ return str.arg(major).arg(minor).arg(majorStr).arg(minorStr);
+ }
+
+QString formatTrkVersion(const TrkAppVersion &version)
+{
+ QString str = QCoreApplication::translate("trk::Session",
+ "App TRK: v%1.%2 TRK protocol: v%3.%4");
+ str = str.arg(version.trkMajor).arg(version.trkMinor);
+ return str.arg(version.protocolMajor).arg(version.protocolMinor);
+}
+
+QString Session::deviceDescription(unsigned verbose) const
+{
+ if (!cpuMajor)
+ return QString();
+
+ //: s60description
+ //: description of an S60 device
+ //: %1 CPU description, %2 endianness
+ //: %3 default type size (if any), %4 float size (if any)
+ //: %5 TRK version
+ QString msg = QCoreApplication::translate("trk::Session", "%1, %2%3%4, %5");
+ QString endianness = bigEndian
+ ? QCoreApplication::translate("trk::Session", "big endian")
+ : QCoreApplication::translate("trk::Session", "little endian");
+ msg = msg.arg(formatCpu(cpuMajor, cpuMinor)).arg(endianness);
+ //: The separator in a list of strings
+ QString defaultTypeSizeStr;
+ QString fpTypeSizeStr;
+ if (verbose && defaultTypeSize)
+ //: will be inserted into s60description
+ defaultTypeSizeStr = QCoreApplication::translate("trk::Session", ", type size: %1").arg(defaultTypeSize);
+ if (verbose && fpTypeSize)
+ //: will be inserted into s60description
+ fpTypeSizeStr = QCoreApplication::translate("trk::Session", ", float size: %1").arg(fpTypeSize);
+ msg = msg.arg(defaultTypeSizeStr).arg(fpTypeSizeStr);
+ return msg.arg(formatTrkVersion(trkAppVersion));
+}
+
+
+// FIXME: Use the QByteArray based version below?
+QString stringFromByte(byte c)
+{
+ return QString("%1 ").arg(c, 2, 16, QChar('0'));
+}
+
+QString stringFromArray(const QByteArray &ba, int maxLen)
+{
+ QString str;
+ QString ascii;
+ const int size = maxLen == -1 ? ba.size() : qMin(ba.size(), maxLen);
+ for (int i = 0; i < size; ++i) {
+ //if (i == 5 || i == ba.size() - 2)
+ // str += " ";
+ int c = byte(ba.at(i));
+ str += QString("%1 ").arg(c, 2, 16, QChar('0'));
+ if (i >= 8 && i < ba.size() - 2)
+ ascii += QChar(c).isPrint() ? QChar(c) : QChar('.');
+ }
+ if (size != ba.size()) {
+ str += "...";
+ ascii += "...";
+ }
+ return str + " " + ascii;
+}
+
+QByteArray hexNumber(uint n, int digits)
+{
+ QByteArray ba = QByteArray::number(n, 16);
+ if (digits == 0 || ba.size() == digits)
+ return ba;
+ return QByteArray(digits - ba.size(), '0') + ba;
+}
+
+QByteArray hexxNumber(uint n, int digits)
+{
+ return "0x" + hexNumber(n, digits);
+}
+
+TrkResult::TrkResult() :
+ code(0),
+ token(0),
+ isDebugOutput(false)
+{
+}
+
+void TrkResult::clear()
+{
+ code = token= 0;
+ isDebugOutput = false;
+ data.clear();
+ cookie = QVariant();
+}
+
+QString TrkResult::toString() const
+{
+ QString res = stringFromByte(code) + "[" + stringFromByte(token);
+ res.chop(1);
+ return res + "] " + stringFromArray(data);
+}
+
+QByteArray frameMessage(byte command, byte token, const QByteArray &data, bool serialFrame)
+{
+ byte s = command + token;
+ for (int i = 0; i != data.size(); ++i)
+ s += data.at(i);
+ byte checksum = 255 - (s & 0xff);
+ //int x = s + ~s;
+ //logMessage("check: " << s << checksum << x;
+
+ QByteArray response;
+ response.reserve(data.size() + 3);
+ response.append(char(command));
+ response.append(char(token));
+ response.append(data);
+ response.append(char(checksum));
+
+ QByteArray encodedData = encode7d(response);
+
+ QByteArray ba;
+ ba.reserve(encodedData.size() + 6);
+ if (serialFrame) {
+ ba.append(char(0x01));
+ ba.append(char(0x90));
+ const ushort encodedSize = encodedData.size() + 2; // 2 x 0x7e
+ appendShort(&ba, encodedSize, BigEndian);
+ }
+ ba.append(char(0x7e));
+ ba.append(encodedData);
+ ba.append(char(0x7e));
+
+ return ba;
+}
+
+/* returns 0 if array doesn't represent a result,
+otherwise returns the length of the result data */
+ushort isValidTrkResult(const QByteArray &buffer, bool serialFrame)
+{
+ if (serialFrame) {
+ // Serial protocol with length info
+ if (buffer.length() < 4)
+ return 0;
+ if (buffer.at(0) != 0x01 || byte(buffer.at(1)) != 0x90)
+ return 0;
+ const ushort len = extractShort(buffer.data() + 2);
+ return (buffer.size() >= len + 4) ? len : ushort(0);
+ }
+ // Frameless protocol without length info
+ const char delimiter = char(0x7e);
+ const int firstDelimiterPos = buffer.indexOf(delimiter);
+ // Regular message delimited by 0x7e..0x7e
+ if (firstDelimiterPos == 0) {
+ const int endPos = buffer.indexOf(delimiter, firstDelimiterPos + 1);
+ return endPos != -1 ? endPos + 1 - firstDelimiterPos : 0;
+ }
+ // Some ASCII log message up to first delimiter or all
+ return firstDelimiterPos != -1 ? firstDelimiterPos : buffer.size();
+}
+
+bool extractResult(QByteArray *buffer, bool serialFrame, TrkResult *result, QByteArray *rawData)
+{
+ result->clear();
+ if(rawData)
+ rawData->clear();
+ const ushort len = isValidTrkResult(*buffer, serialFrame);
+ if (!len)
+ return false;
+ // handle receiving application output, which is not a regular command
+ const int delimiterPos = serialFrame ? 4 : 0;
+ if (buffer->at(delimiterPos) != 0x7e) {
+ result->isDebugOutput = true;
+ result->data = buffer->mid(delimiterPos, len);
+ result->data.replace("\r\n", "\n");
+ *buffer->remove(0, delimiterPos + len);
+ return true;
+ }
+ // FIXME: what happens if the length contains 0xfe?
+ // Assume for now that it passes unencoded!
+ const QByteArray data = decode7d(buffer->mid(delimiterPos + 1, len - 2));
+ if(rawData)
+ *rawData = data;
+ *buffer->remove(0, delimiterPos + len);
+
+ byte sum = 0;
+ for (int i = 0; i < data.size(); ++i) // 3 = 2 * 0xfe + sum
+ sum += byte(data.at(i));
+ if (sum != 0xff)
+ logMessage("*** CHECKSUM ERROR: " << byte(sum));
+
+ result->code = data.at(0);
+ result->token = data.at(1);
+ result->data = data.mid(2, data.size() - 3);
+ //logMessage(" REST BUF: " << stringFromArray(*buffer));
+ //logMessage(" CURR DATA: " << stringFromArray(data));
+ //QByteArray prefix = "READ BUF: ";
+ //logMessage((prefix + "HEADER: " + stringFromArray(header).toLatin1()).data());
+ return true;
+}
+
+ushort extractShort(const char *data)
+{
+ return byte(data[0]) * 256 + byte(data[1]);
+}
+
+uint extractInt(const char *data)
+{
+ uint res = byte(data[0]);
+ res *= 256; res += byte(data[1]);
+ res *= 256; res += byte(data[2]);
+ res *= 256; res += byte(data[3]);
+ return res;
+}
+
+QString quoteUnprintableLatin1(const QByteArray &ba)
+{
+ QString res;
+ char buf[10];
+ for (int i = 0, n = ba.size(); i != n; ++i) {
+ const byte c = ba.at(i);
+ if (isprint(c)) {
+ res += c;
+ } else {
+ qsnprintf(buf, sizeof(buf) - 1, "\\%x", int(c));
+ res += buf;
+ }
+ }
+ return res;
+}
+
+QByteArray decode7d(const QByteArray &ba)
+{
+ QByteArray res;
+ res.reserve(ba.size());
+ for (int i = 0; i < ba.size(); ++i) {
+ byte c = byte(ba.at(i));
+ if (c == 0x7d) {
+ ++i;
+ c = 0x20 ^ byte(ba.at(i));
+ }
+ res.append(c);
+ }
+ //if (res != ba)
+ // logMessage("DECODED: " << stringFromArray(ba)
+ // << " -> " << stringFromArray(res));
+ return res;
+}
+
+QByteArray encode7d(const QByteArray &ba)
+{
+ QByteArray res;
+ res.reserve(ba.size() + 2);
+ for (int i = 0; i < ba.size(); ++i) {
+ byte c = byte(ba.at(i));
+ if (c == 0x7e || c == 0x7d) {
+ res.append(0x7d);
+ res.append(0x20 ^ c);
+ } else {
+ res.append(c);
+ }
+ }
+ //if (res != ba)
+ // logMessage("ENCODED: " << stringFromArray(ba)
+ // << " -> " << stringFromArray(res));
+ return res;
+}
+
+void appendByte(QByteArray *ba, byte b)
+{
+ ba->append(b);
+}
+
+void appendShort(QByteArray *ba, ushort s, Endianness endian)
+{
+ if (endian == BigEndian) {
+ ba->append(s / 256);
+ ba->append(s % 256);
+ } else {
+ ba->append(s % 256);
+ ba->append(s / 256);
+ }
+}
+
+void appendInt(QByteArray *ba, uint i, Endianness endian)
+{
+ const uchar b3 = i % 256; i /= 256;
+ const uchar b2 = i % 256; i /= 256;
+ const uchar b1 = i % 256; i /= 256;
+ const uchar b0 = i;
+ ba->reserve(ba->size() + 4);
+ if (endian == BigEndian) {
+ ba->append(b0);
+ ba->append(b1);
+ ba->append(b2);
+ ba->append(b3);
+ } else {
+ ba->append(b3);
+ ba->append(b2);
+ ba->append(b1);
+ ba->append(b0);
+ }
+}
+
+void appendString(QByteArray *ba, const QByteArray &str, Endianness endian, bool appendNullTerminator)
+{
+ const int fullSize = str.size() + (appendNullTerminator ? 1 : 0);
+ appendShort(ba, fullSize, endian); // count the terminating \0
+ ba->append(str);
+ if (appendNullTerminator)
+ ba->append('\0');
+}
+
+void appendDateTime(QByteArray *ba, QDateTime dateTime, Endianness endian)
+{
+ // convert the QDateTime to UTC and append its representation to QByteArray
+ // format is the same as in FAT file system
+ dateTime = dateTime.toUTC();
+ const QTime utcTime = dateTime.time();
+ const QDate utcDate = dateTime.date();
+ uint fatDateTime = (utcTime.hour() << 11 | utcTime.minute() << 5 | utcTime.second()/2) << 16;
+ fatDateTime |= (utcDate.year()-1980) << 9 | utcDate.month() << 5 | utcDate.day();
+ appendInt(ba, fatDateTime, endian);
+}
+
+QByteArray errorMessage(byte code)
+{
+ switch (code) {
+ case 0x00: return "No error";
+ case 0x01: return "Generic error in CWDS message";
+ case 0x02: return "Unexpected packet size in send msg";
+ case 0x03: return "Internal error occurred in CWDS";
+ case 0x04: return "Escape followed by frame flag";
+ case 0x05: return "Bad FCS in packet";
+ case 0x06: return "Packet too long";
+ case 0x07: return "Sequence ID not expected (gap in sequence)";
+
+ case 0x10: return "Command not supported";
+ case 0x11: return "Command param out of range";
+ case 0x12: return "An option was not supported";
+ case 0x13: return "Read/write to invalid memory";
+ case 0x14: return "Read/write invalid registers";
+ case 0x15: return "Exception occurred in CWDS";
+ case 0x16: return "Targeted system or thread is running";
+ case 0x17: return "Breakpoint resources (HW or SW) exhausted";
+ case 0x18: return "Requested breakpoint conflicts with existing one";
+
+ case 0x20: return "General OS-related error";
+ case 0x21: return "Request specified invalid process";
+ case 0x22: return "Request specified invalid thread";
+ }
+ return "Unknown error";
+}
+
+uint swapEndian(uint in)
+{
+ return (in>>24) | ((in<<8) & 0x00FF0000) | ((in>>8) & 0x0000FF00) | (in<<24);
+}
+
+int TrkResult::errorCode() const
+{
+ // NAK means always error, else data sized 1 with a non-null element
+ const bool isNAK = code == 0xff;
+ if (data.size() != 1 && !isNAK)
+ return 0;
+ if (const int errorCode = data.at(0))
+ return errorCode;
+ return isNAK ? 0xff : 0;
+}
+
+QString TrkResult::errorString() const
+{
+ // NAK means always error, else data sized 1 with a non-null element
+ if (code == 0xff)
+ return "NAK";
+ if (data.size() < 1)
+ return "Unknown error packet";
+ return errorMessage(data.at(0));
+}
+
+} // namespace trk
+
diff --git a/tools/runonphone/trk/trkutils.h b/tools/runonphone/trk/trkutils.h
new file mode 100644
index 0000000..632c0d89
--- /dev/null
+++ b/tools/runonphone/trk/trkutils.h
@@ -0,0 +1,189 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications 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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DEBUGGER_TRK_UTILS
+#define DEBUGGER_TRK_UTILS
+
+#include <QtCore/QByteArray>
+#include <QtCore/QHash>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+
+typedef unsigned char byte;
+
+QT_BEGIN_NAMESPACE
+class QDateTime;
+QT_END_NAMESPACE
+
+namespace trk {
+
+enum Command {
+ TrkPing = 0x00,
+ TrkConnect = 0x01,
+ TrkDisconnect = 0x02,
+ TrkVersions = 0x04,
+ TrkSupported = 0x05,
+ TrkCpuType = 0x06,
+ TrkHostVersions = 0x09,
+ TrkContinue = 0x18,
+ TrkCreateItem = 0x40,
+ TrkDeleteItem = 0x41,
+
+ TrkWriteFile = 0x48,
+ TrkOpenFile = 0x4a,
+ TrkCloseFile = 0x4b,
+ TrkInstallFile = 0x4d,
+ TrkInstallFile2 = 0x4e,
+
+ TrkNotifyAck = 0x80,
+ TrkNotifyNak = 0xff,
+ TrkNotifyStopped = 0x90,
+ TrkNotifyException = 0x91,
+ TrkNotifyInternalError = 0x92,
+ TrkNotifyCreated = 0xa0,
+ TrkNotifyDeleted = 0xa1,
+ TrkNotifyProcessorStarted = 0xa2,
+ TrkNotifyProcessorStandBy = 0xa6,
+ TrkNotifyProcessorReset = 0xa7
+};
+
+QByteArray decode7d(const QByteArray &ba);
+QByteArray encode7d(const QByteArray &ba);
+
+inline byte extractByte(const char *data) { return *data; }
+ushort extractShort(const char *data);
+uint extractInt(const char *data);
+
+QString quoteUnprintableLatin1(const QByteArray &ba);
+
+// produces "xx xx xx "
+QString stringFromArray(const QByteArray &ba, int maxLen = - 1);
+
+enum Endianness
+{
+ LittleEndian,
+ BigEndian,
+ TargetByteOrder = BigEndian,
+};
+
+void appendByte(QByteArray *ba, byte b);
+void appendShort(QByteArray *ba, ushort s, Endianness = TargetByteOrder);
+void appendInt(QByteArray *ba, uint i, Endianness = TargetByteOrder);
+void appendString(QByteArray *ba, const QByteArray &str, Endianness = TargetByteOrder, bool appendNullTerminator = true);
+void appendDateTime(QByteArray *ba, QDateTime dateTime, Endianness = TargetByteOrder);
+
+struct Library
+{
+ Library() {}
+
+ QByteArray name;
+ uint codeseg;
+ uint dataseg;
+};
+
+struct TrkAppVersion {
+ TrkAppVersion();
+ void reset();
+
+ int trkMajor;
+ int trkMinor;
+ int protocolMajor;
+ int protocolMinor;
+};
+
+struct Session
+{
+ Session();
+ void reset();
+ QString deviceDescription(unsigned verbose) const;
+
+ // Trk feedback
+ byte cpuMajor;
+ byte cpuMinor;
+ byte bigEndian;
+ byte defaultTypeSize;
+ byte fpTypeSize;
+ byte extended1TypeSize;
+ byte extended2TypeSize;
+ TrkAppVersion trkAppVersion;
+ uint pid;
+ uint tid;
+ uint codeseg;
+ uint dataseg;
+ QHash<uint, uint> addressToBP;
+
+ typedef QList<Library> Libraries;
+ Libraries libraries;
+
+ // Gdb request
+ uint currentThread;
+ QStringList modules;
+};
+
+struct TrkResult
+{
+ TrkResult();
+ void clear();
+ QString toString() const;
+ // 0 for no error.
+ int errorCode() const;
+ QString errorString() const;
+
+ byte code;
+ byte token;
+ QByteArray data;
+ QVariant cookie;
+ bool isDebugOutput;
+};
+
+// returns a QByteArray containing optionally
+// the serial frame [0x01 0x90 <len>] and 0x7e encoded7d(ba) 0x7e
+QByteArray frameMessage(byte command, byte token, const QByteArray &data, bool serialFrame);
+ushort isValidTrkResult(const QByteArray &buffer, bool serialFrame);
+bool extractResult(QByteArray *buffer, bool serialFrame, TrkResult *r, QByteArray *rawData = 0);
+QByteArray errorMessage(byte code);
+QByteArray hexNumber(uint n, int digits = 0);
+QByteArray hexxNumber(uint n, int digits = 0); // prepends '0x', too
+uint swapEndian(uint in);
+
+} // namespace trk
+
+#endif // DEBUGGER_TRK_UTILS
diff --git a/tools/runonphone/trksignalhandler.cpp b/tools/runonphone/trksignalhandler.cpp
new file mode 100644
index 0000000..099be7a
--- /dev/null
+++ b/tools/runonphone/trksignalhandler.cpp
@@ -0,0 +1,189 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications 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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QDebug>
+#include <QCoreApplication>
+#include <QObject>
+#include "trksignalhandler.h"
+
+class TrkSignalHandlerPrivate
+{
+ friend class TrkSignalHandler;
+public:
+ TrkSignalHandlerPrivate();
+ ~TrkSignalHandlerPrivate();
+private:
+ QTextStream out;
+ QTextStream err;
+ int loglevel;
+};
+
+void TrkSignalHandler::copyingStarted()
+{
+ if(d->loglevel > 0)
+ d->out << "Copying..." << endl;
+}
+
+void TrkSignalHandler::canNotConnect(const QString &errorMessage)
+{
+ d->err << "Cannot Connect - " << errorMessage << endl;
+}
+
+void TrkSignalHandler::canNotCreateFile(const QString &filename, const QString &errorMessage)
+{
+ d->err << "Cannot create file (" << filename << ") - " << errorMessage << endl;
+}
+
+void TrkSignalHandler::canNotWriteFile(const QString &filename, const QString &errorMessage)
+{
+ d->err << "Cannot write file (" << filename << ") - " << errorMessage << endl;
+}
+
+void TrkSignalHandler::canNotCloseFile(const QString &filename, const QString &errorMessage)
+{
+ d->err << "Cannot close file (" << filename << ") - " << errorMessage << endl;
+}
+
+void TrkSignalHandler::installingStarted()
+{
+ if(d->loglevel > 0)
+ d->out << "Installing..." << endl;
+}
+
+void TrkSignalHandler::canNotInstall(const QString &packageFilename, const QString &errorMessage)
+{
+ d->err << "Cannot install file (" << packageFilename << ") - " << errorMessage << endl;
+}
+
+void TrkSignalHandler::installingFinished()
+{
+ if(d->loglevel > 0)
+ d->out << "Installing finished" << endl;
+}
+
+void TrkSignalHandler::startingApplication()
+{
+ if(d->loglevel > 0)
+ d->out << "Starting app..." << endl;
+}
+
+void TrkSignalHandler::applicationRunning(uint pid)
+{
+ if(d->loglevel > 0)
+ d->out << "Running..." << endl;
+}
+
+void TrkSignalHandler::canNotRun(const QString &errorMessage)
+{
+ d->err << "Cannot run - " << errorMessage << endl;
+}
+
+void TrkSignalHandler::finished()
+{
+ if(d->loglevel > 0)
+ d->out << "Done." << endl;
+ QCoreApplication::quit();
+}
+
+void TrkSignalHandler::applicationOutputReceived(const QString &output)
+{
+ d->out << output;
+}
+
+void TrkSignalHandler::copyProgress(int percent)
+{
+ if(d->loglevel > 0) {
+ d->out << percent << "% ";
+ d->out.flush();
+ if(percent==100)
+ d->out << endl;
+ }
+}
+
+void TrkSignalHandler::stateChanged(int state)
+{
+ if(d->loglevel > 1)
+ d->out << "State" << state << endl;
+}
+
+void TrkSignalHandler::setLogLevel(int level)
+{
+ d->loglevel = level;
+}
+
+void TrkSignalHandler::stopped(uint pc, uint pid, uint tid, const QString& reason)
+{
+ d->err << "STOPPED: pc=" << hex << pc << " pid=" << pid
+ << " tid=" << tid << dec << " - " << reason << endl;
+ // if it was a breakpoint, then we could continue with "emit resume(pid, tid);"
+ // since we have set no breakpoints, it will be a just in time debug of a panic / exception
+ emit terminate();
+}
+
+void TrkSignalHandler::timeout()
+{
+ d->err << "FAILED: stopping test due to timeout" << endl;
+ emit terminate();
+}
+
+TrkSignalHandlerPrivate::TrkSignalHandlerPrivate() :
+ out(stdout),
+ err(stderr),
+ loglevel(0)
+{
+
+}
+
+TrkSignalHandlerPrivate::~TrkSignalHandlerPrivate()
+{
+ out.flush();
+ err.flush();
+}
+
+TrkSignalHandler::TrkSignalHandler()
+{
+ d = new TrkSignalHandlerPrivate();
+}
+
+TrkSignalHandler::~TrkSignalHandler()
+{
+ delete d;
+}
diff --git a/tools/runonphone/trksignalhandler.h b/tools/runonphone/trksignalhandler.h
new file mode 100644
index 0000000..818aa56
--- /dev/null
+++ b/tools/runonphone/trksignalhandler.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications 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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TRKSIGNALHANDLER_H
+#define TRKSIGNALHANDLER_H
+#include <QObject>
+#include <QString>
+
+class TrkSignalHandlerPrivate;
+class TrkSignalHandler : public QObject
+{
+ Q_OBJECT
+public slots:
+ void copyingStarted();
+ void canNotConnect(const QString &errorMessage);
+ void canNotCreateFile(const QString &filename, const QString &errorMessage);
+ void canNotWriteFile(const QString &filename, const QString &errorMessage);
+ void canNotCloseFile(const QString &filename, const QString &errorMessage);
+ void installingStarted();
+ void canNotInstall(const QString &packageFilename, const QString &errorMessage);
+ void installingFinished();
+ void startingApplication();
+ void applicationRunning(uint pid);
+ void canNotRun(const QString &errorMessage);
+ void finished();
+ void applicationOutputReceived(const QString &output);
+ void copyProgress(int percent);
+ void stateChanged(int);
+ void stopped(uint pc, uint pid, uint tid, const QString& reason);
+ void timeout();
+signals:
+ void resume(uint pid, uint tid);
+ void terminate();
+public:
+ TrkSignalHandler();
+ ~TrkSignalHandler();
+ void setLogLevel(int);
+private:
+ TrkSignalHandlerPrivate *d;
+};
+
+#endif // TRKSIGNALHANDLER_H
diff --git a/tools/shared/qtpropertybrowser/qteditorfactory.cpp b/tools/shared/qtpropertybrowser/qteditorfactory.cpp
index 17c5be8..ed74439 100644
--- a/tools/shared/qtpropertybrowser/qteditorfactory.cpp
+++ b/tools/shared/qtpropertybrowser/qteditorfactory.cpp
@@ -1158,6 +1158,7 @@ QWidget *QtDateEditFactory::createEditor(QtDatePropertyManager *manager, QtPrope
QWidget *parent)
{
QDateEdit *editor = d_ptr->createEditor(property, parent);
+ editor->setDisplayFormat(QtPropertyBrowserUtils::dateFormat());
editor->setCalendarPopup(true);
editor->setDateRange(manager->minimum(property), manager->maximum(property));
editor->setDate(manager->value(property));
@@ -1272,6 +1273,7 @@ QWidget *QtTimeEditFactory::createEditor(QtTimePropertyManager *manager, QtPrope
QWidget *parent)
{
QTimeEdit *editor = d_ptr->createEditor(property, parent);
+ editor->setDisplayFormat(QtPropertyBrowserUtils::timeFormat());
editor->setTime(manager->value(property));
connect(editor, SIGNAL(timeChanged(QTime)),
@@ -1385,6 +1387,7 @@ QWidget *QtDateTimeEditFactory::createEditor(QtDateTimePropertyManager *manager,
QtProperty *property, QWidget *parent)
{
QDateTimeEdit *editor = d_ptr->createEditor(property, parent);
+ editor->setDisplayFormat(QtPropertyBrowserUtils::dateTimeFormat());
editor->setDateTime(manager->value(property));
connect(editor, SIGNAL(dateTimeChanged(QDateTime)),
diff --git a/tools/shared/qtpropertybrowser/qtpropertybrowserutils.cpp b/tools/shared/qtpropertybrowser/qtpropertybrowserutils.cpp
index 9e0421f..63e4a63 100644
--- a/tools/shared/qtpropertybrowser/qtpropertybrowserutils.cpp
+++ b/tools/shared/qtpropertybrowser/qtpropertybrowserutils.cpp
@@ -47,6 +47,7 @@
#include <QtGui/QCheckBox>
#include <QtGui/QLineEdit>
#include <QtGui/QMenu>
+#include <QtCore/QLocale>
QT_BEGIN_NAMESPACE
@@ -208,6 +209,26 @@ QString QtPropertyBrowserUtils::fontValueText(const QFont &f)
.arg(f.pointSize());
}
+QString QtPropertyBrowserUtils::dateFormat()
+{
+ QLocale loc;
+ return loc.dateFormat(QLocale::ShortFormat);
+}
+
+QString QtPropertyBrowserUtils::timeFormat()
+{
+ QLocale loc;
+ // ShortFormat is missing seconds on UNIX.
+ return loc.timeFormat(QLocale::LongFormat);
+}
+
+QString QtPropertyBrowserUtils::dateTimeFormat()
+{
+ QString format = dateFormat();
+ format += QLatin1Char(' ');
+ format += timeFormat();
+ return format;
+}
QtBoolEdit::QtBoolEdit(QWidget *parent) :
QWidget(parent),
diff --git a/tools/shared/qtpropertybrowser/qtpropertybrowserutils_p.h b/tools/shared/qtpropertybrowser/qtpropertybrowserutils_p.h
index 09d29ae..358f9f4 100644
--- a/tools/shared/qtpropertybrowser/qtpropertybrowserutils_p.h
+++ b/tools/shared/qtpropertybrowser/qtpropertybrowserutils_p.h
@@ -94,6 +94,9 @@ public:
static QPixmap fontValuePixmap(const QFont &f);
static QIcon fontValueIcon(const QFont &f);
static QString fontValueText(const QFont &f);
+ static QString dateFormat();
+ static QString timeFormat();
+ static QString dateTimeFormat();
};
class QtBoolEdit : public QWidget {
diff --git a/tools/shared/qtpropertybrowser/qtpropertymanager.cpp b/tools/shared/qtpropertybrowser/qtpropertymanager.cpp
index a26dcda..fbad0ca 100644
--- a/tools/shared/qtpropertybrowser/qtpropertymanager.cpp
+++ b/tools/shared/qtpropertybrowser/qtpropertymanager.cpp
@@ -1553,6 +1553,7 @@ class QtDatePropertyManagerPrivate
QtDatePropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtDatePropertyManager)
public:
+ explicit QtDatePropertyManagerPrivate(QtDatePropertyManager *q);
struct Data
{
@@ -1573,6 +1574,12 @@ public:
QMap<const QtProperty *, Data> m_values;
};
+QtDatePropertyManagerPrivate::QtDatePropertyManagerPrivate(QtDatePropertyManager *q) :
+ q_ptr(q),
+ m_format(QtPropertyBrowserUtils::dateFormat())
+{
+}
+
/*!
\class QtDatePropertyManager
\internal
@@ -1622,12 +1629,8 @@ public:
Creates a manager with the given \a parent.
*/
QtDatePropertyManager::QtDatePropertyManager(QObject *parent)
- : QtAbstractPropertyManager(parent), d_ptr(new QtDatePropertyManagerPrivate)
+ : QtAbstractPropertyManager(parent), d_ptr(new QtDatePropertyManagerPrivate(this))
{
- d_ptr->q_ptr = this;
-
- QLocale loc;
- d_ptr->m_format = loc.dateFormat(QLocale::ShortFormat);
}
/*!
@@ -1786,13 +1789,20 @@ class QtTimePropertyManagerPrivate
QtTimePropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtTimePropertyManager)
public:
+ explicit QtTimePropertyManagerPrivate(QtTimePropertyManager *q);
- QString m_format;
+ const QString m_format;
typedef QMap<const QtProperty *, QTime> PropertyValueMap;
PropertyValueMap m_values;
};
+QtTimePropertyManagerPrivate::QtTimePropertyManagerPrivate(QtTimePropertyManager *q) :
+ q_ptr(q),
+ m_format(QtPropertyBrowserUtils::timeFormat())
+{
+}
+
/*!
\class QtTimePropertyManager
\internal
@@ -1825,12 +1835,8 @@ public:
Creates a manager with the given \a parent.
*/
QtTimePropertyManager::QtTimePropertyManager(QObject *parent)
- : QtAbstractPropertyManager(parent), d_ptr(new QtTimePropertyManagerPrivate)
+ : QtAbstractPropertyManager(parent), d_ptr(new QtTimePropertyManagerPrivate(this))
{
- d_ptr->q_ptr = this;
-
- QLocale loc;
- d_ptr->m_format = loc.timeFormat(QLocale::ShortFormat);
}
/*!
@@ -1903,13 +1909,20 @@ class QtDateTimePropertyManagerPrivate
QtDateTimePropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtDateTimePropertyManager)
public:
+ explicit QtDateTimePropertyManagerPrivate(QtDateTimePropertyManager *q);
- QString m_format;
+ const QString m_format;
typedef QMap<const QtProperty *, QDateTime> PropertyValueMap;
PropertyValueMap m_values;
};
+QtDateTimePropertyManagerPrivate::QtDateTimePropertyManagerPrivate(QtDateTimePropertyManager *q) :
+ q_ptr(q),
+ m_format(QtPropertyBrowserUtils::dateTimeFormat())
+{
+}
+
/*! \class QtDateTimePropertyManager
\internal
\inmodule QtDesigner
@@ -1938,14 +1951,8 @@ public:
Creates a manager with the given \a parent.
*/
QtDateTimePropertyManager::QtDateTimePropertyManager(QObject *parent)
- : QtAbstractPropertyManager(parent), d_ptr(new QtDateTimePropertyManagerPrivate)
+ : QtAbstractPropertyManager(parent), d_ptr(new QtDateTimePropertyManagerPrivate(this))
{
- d_ptr->q_ptr = this;
-
- QLocale loc;
- d_ptr->m_format = loc.dateFormat(QLocale::ShortFormat);
- d_ptr->m_format += QLatin1Char(' ');
- d_ptr->m_format += loc.timeFormat(QLocale::ShortFormat);
}
/*!
diff --git a/tools/xmlpatterns/main.cpp b/tools/xmlpatterns/main.cpp
index 604523b..76853b5 100644
--- a/tools/xmlpatterns/main.cpp
+++ b/tools/xmlpatterns/main.cpp
@@ -49,6 +49,7 @@
#include <QtCore/QUrl>
#include <QtCore/QVariant>
#include <QtCore/QVector>
+#include <QtCore/QCoreApplication>
#include <QtXmlPatterns/QXmlFormatter>
#include <QtXmlPatterns/QXmlItem>
@@ -58,7 +59,6 @@
#include "private/qautoptr_p.h"
#include "qapplicationargument_p.h"
#include "qapplicationargumentparser_p.h"
-#include "qcoloringmessagehandler_p.h"
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
/* Needed for opening stdout with _fdopen & friends. io.h seems to not be
diff --git a/tools/xmlpatterns/main.h b/tools/xmlpatterns/main.h
index cdef999..76b7097 100644
--- a/tools/xmlpatterns/main.h
+++ b/tools/xmlpatterns/main.h
@@ -54,21 +54,13 @@
#include <QCoreApplication>
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
class QXmlPatternistCLI
{
public:
- Q_DECLARE_TR_FUNCTIONS(QXmlPatternistCLI)
+ Q_DECLARE_TR_FUNCTIONS(QXmlPatternistCLI)
private:
inline QXmlPatternistCLI();
Q_DISABLE_COPY(QXmlPatternistCLI)
};
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
#endif
diff --git a/tools/xmlpatterns/xmlpatterns.pro b/tools/xmlpatterns/xmlpatterns.pro
index 47f5a48..8cd321c 100644
--- a/tools/xmlpatterns/xmlpatterns.pro
+++ b/tools/xmlpatterns/xmlpatterns.pro
@@ -17,16 +17,12 @@ CONFIG -= app_bundle
# in libQtXmlPatterns. See src/xmlpatterns/api/api.pri.
SOURCES = main.cpp \
qapplicationargument.cpp \
- qapplicationargumentparser.cpp \
- qcoloringmessagehandler.cpp \
- qcoloroutput.cpp
+ qapplicationargumentparser.cpp
HEADERS = main.h \
qapplicationargument.cpp \
- qapplicationargumentparser.cpp \
- qcoloringmessagehandler_p.h \
- qcoloroutput_p.h
+ qapplicationargumentparser.cpp
symbian: TARGET.UID3 = 0xA000D7C9
diff --git a/translations/assistant_pl.ts b/translations/assistant_pl.ts
index 069b5a0..0ef3251 100644
--- a/translations/assistant_pl.ts
+++ b/translations/assistant_pl.ts
@@ -78,7 +78,7 @@
<context>
<name>BookmarkManager</name>
<message>
- <location line="+434"/>
+ <location line="+435"/>
<source>Bookmarks</source>
<translation>Zakładki</translation>
</message>
@@ -102,7 +102,7 @@
<context>
<name>BookmarkWidget</name>
<message>
- <location line="-416"/>
+ <location line="-417"/>
<source>Filter:</source>
<translation>Filtr:</translation>
</message>
@@ -150,7 +150,7 @@
<context>
<name>CentralWidget</name>
<message>
- <location filename="../tools/assistant/tools/assistant/centralwidget.cpp" line="+238"/>
+ <location filename="../tools/assistant/tools/assistant/centralwidget.cpp" line="+239"/>
<source>Add new page</source>
<translation>Dodaj nową stronę</translation>
</message>
@@ -165,7 +165,7 @@
<translation>Wydrukuj dokument</translation>
</message>
<message>
- <location line="+148"/>
+ <location line="+130"/>
<location line="+2"/>
<source>unknown</source>
<translation>nieznany</translation>
@@ -191,7 +191,7 @@
<translation>Dodaj zakładkę dla tej strony...</translation>
</message>
<message>
- <location line="+255"/>
+ <location line="+235"/>
<source>Search</source>
<translation>Wyszukaj</translation>
</message>
@@ -225,7 +225,7 @@
<context>
<name>FindWidget</name>
<message>
- <location filename="../tools/assistant/tools/assistant/centralwidget.cpp" line="-955"/>
+ <location filename="../tools/assistant/tools/assistant/centralwidget.cpp" line="-918"/>
<source>Previous</source>
<translation>Poprzedni</translation>
</message>
@@ -281,7 +281,7 @@
<context>
<name>HelpViewer</name>
<message>
- <location filename="../tools/assistant/tools/assistant/helpviewer.cpp" line="+492"/>
+ <location filename="../tools/assistant/tools/assistant/helpviewer.cpp" line="+489"/>
<source>Help</source>
<translation>Pomoc</translation>
</message>
@@ -326,7 +326,7 @@
<translation>Wy&amp;szukaj:</translation>
</message>
<message>
- <location line="+68"/>
+ <location line="+72"/>
<source>Open Link</source>
<translation>Otwórz odsyłacz</translation>
</message>
@@ -440,19 +440,19 @@
<name>MainWindow</name>
<message>
<location filename="../tools/assistant/tools/assistant/mainwindow.cpp" line="+110"/>
- <location line="+391"/>
+ <location line="+383"/>
<source>Index</source>
<translation>Indeks</translation>
</message>
<message>
- <location line="-385"/>
- <location line="+383"/>
+ <location line="-377"/>
+ <location line="+375"/>
<source>Contents</source>
<translation>Spis treści</translation>
</message>
<message>
- <location line="-378"/>
- <location line="+382"/>
+ <location line="-370"/>
+ <location line="+374"/>
<source>Bookmarks</source>
<translation>Zakładki</translation>
</message>
@@ -462,14 +462,14 @@
<translation>Wyszukaj</translation>
</message>
<message>
- <location line="-372"/>
- <location line="+215"/>
- <location line="+512"/>
+ <location line="-364"/>
+ <location line="+207"/>
+ <location line="+514"/>
<source>Qt Assistant</source>
<translation>Qt Assistant</translation>
</message>
<message>
- <location line="-544"/>
+ <location line="-546"/>
<location line="+5"/>
<source>Unfiltered</source>
<translation>Nieprzefiltrowany</translation>
@@ -515,7 +515,12 @@
<translation>Znajdź w &amp;tekście...</translation>
</message>
<message>
- <location line="+6"/>
+ <location line="+2"/>
+ <source>&amp;Find</source>
+ <translation>&amp;Znajdź</translation>
+ </message>
+ <message>
+ <location line="+4"/>
<source>Find &amp;Next</source>
<translation>Znajdź &amp;następny</translation>
</message>
@@ -585,7 +590,12 @@
<translation>Znajdź bieżącą stronę w spisie treści</translation>
</message>
<message>
- <location line="+7"/>
+ <location line="+2"/>
+ <source>Sync</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+5"/>
<source>Next Page</source>
<translation>Następna strona</translation>
</message>
@@ -635,7 +645,7 @@
<translation>Przefiltrowane przez:</translation>
</message>
<message>
- <location line="+23"/>
+ <location line="+25"/>
<source>Address Toolbar</source>
<translation>Pasek adresu</translation>
</message>
@@ -660,7 +670,7 @@
<translation>Uaktualnianie indeksu wyszukiwawczego</translation>
</message>
<message>
- <location line="-638"/>
+ <location line="-640"/>
<source>Looking for Qt Documentation...</source>
<translation>Szukanie dokumentacji Qt...</translation>
</message>
@@ -962,7 +972,7 @@
<translation>Qt Assistant</translation>
</message>
<message>
- <location filename="../tools/assistant/tools/assistant/main.cpp" line="+217"/>
+ <location filename="../tools/assistant/tools/assistant/main.cpp" line="+228"/>
<source>Could not register documentation file
%1
@@ -1024,7 +1034,7 @@ Powód:
<context>
<name>SearchWidget</name>
<message>
- <location filename="../tools/assistant/tools/assistant/searchwidget.cpp" line="+195"/>
+ <location filename="../tools/assistant/tools/assistant/searchwidget.cpp" line="+196"/>
<source>&amp;Copy</source>
<translation>S&amp;kopiuj</translation>
</message>
diff --git a/translations/designer_pl.ts b/translations/designer_pl.ts
index f9c6dd0..acd1827 100644
--- a/translations/designer_pl.ts
+++ b/translations/designer_pl.ts
@@ -517,12 +517,12 @@
</message>
<message>
<location line="+89"/>
- <location filename="../tools/designer/src/lib/shared/qdesigner_menubar.cpp" line="+907"/>
+ <location filename="../tools/designer/src/lib/shared/qdesigner_menubar.cpp" line="+915"/>
<source>Move action</source>
<translation>Przenieś akcję</translation>
</message>
<message>
- <location filename="../tools/designer/src/lib/shared/qdesigner_menubar.cpp" line="-424"/>
+ <location filename="../tools/designer/src/lib/shared/qdesigner_menubar.cpp" line="-432"/>
<source>Change Title</source>
<translation>Zmień tytuł</translation>
</message>
@@ -703,7 +703,7 @@
<context>
<name>ConnectionDelegate</name>
<message>
- <location filename="../tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp" line="+643"/>
+ <location filename="../tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp" line="+644"/>
<source>&lt;object&gt;</source>
<translation>&lt;obiekt&gt;</translation>
</message>
@@ -1028,7 +1028,7 @@
<context>
<name>FormBuilder</name>
<message>
- <location filename="../tools/designer/src/lib/uilib/formbuilderextra.cpp" line="+359"/>
+ <location filename="../tools/designer/src/lib/uilib/formbuilderextra.cpp" line="+375"/>
<source>Invalid stretch value for &apos;%1&apos;: &apos;%2&apos;</source>
<extracomment>Parsing layout stretch values</extracomment>
<translation>Niepoprawna wartość rozciągniecia dla &apos;%1&apos;: &apos;%2&apos;</translation>
@@ -1050,7 +1050,7 @@
<message>
<location line="+4"/>
<source>Preview Zoom</source>
- <translation>Powiększenie podglądu</translation>
+ <translation>Powiększanie podglądu</translation>
</message>
<message>
<location line="+2"/>
@@ -1259,7 +1259,7 @@
<message>
<location line="-34"/>
<source>Show this Dialog on Startup</source>
- <translation>Pokaż to okno przy uruchamianiu</translation>
+ <translation>Pokazuj to okno przy uruchamianiu</translation>
</message>
<message>
<location line="+2"/>
@@ -1413,7 +1413,7 @@
<translation>Niepoprawny plik UI: brak głównego elementu &lt;ui&gt;.</translation>
</message>
<message>
- <location line="+119"/>
+ <location line="+104"/>
<source>The creation of a widget of the class &apos;%1&apos; failed.</source>
<translation>Utworzenie widżetu klasy &apos;%1&apos; nie powiodło się.</translation>
</message>
@@ -1594,7 +1594,7 @@ Skrypt: %3</translation>
<message>
<location line="-10"/>
<source>Edit Widgets</source>
- <translation>Edytuj widżety</translation>
+ <translation>Modyfikuj widżety</translation>
</message>
<message>
<location line="+195"/>
@@ -1803,7 +1803,7 @@ Czy chcesz zaktualizować położenie pliku lub wygenerować nowy formularz?</tr
<message>
<location line="+1"/>
<source>&amp;Print...</source>
- <translation>Wy&amp;drukuj...</translation>
+ <translation>&amp;Drukuj...</translation>
</message>
<message>
<location line="+3"/>
@@ -2277,7 +2277,7 @@ Strony pojemników powinny być dodawane jedynie poprzez wyspecyfikowanie ich w
<context>
<name>QFormBuilder</name>
<message>
- <location filename="../tools/designer/src/lib/uilib/formbuilder.cpp" line="+163"/>
+ <location filename="../tools/designer/src/lib/uilib/formbuilder.cpp" line="+168"/>
<source>An empty class name was passed on to %1 (object name: &apos;%2&apos;).</source>
<extracomment>Empty class name passed to widget factory method</extracomment>
<translation>Pusta nazwa klasy została przekazana do %1 (nazwa obiektu: &apos;%2&apos;).</translation>
@@ -2669,7 +2669,7 @@ Strony pojemników powinny być dodawane jedynie poprzez wyspecyfikowanie ich w
<message>
<location filename="../tools/shared/qtgradienteditor/qtgradientdialog.ui"/>
<source>Edit Gradient</source>
- <translation>Edytuj gradient</translation>
+ <translation>Modyfikuj gradient</translation>
</message>
</context>
<context>
@@ -3042,7 +3042,7 @@ Strony pojemników powinny być dodawane jedynie poprzez wyspecyfikowanie ich w
<location/>
<location filename="../tools/shared/qtgradienteditor/qtgradientview.cpp" line="+1"/>
<source>Edit...</source>
- <translation>Edytuj...</translation>
+ <translation>Modyfikuj...</translation>
</message>
<message>
<location/>
@@ -3499,7 +3499,7 @@ jako:
<message>
<location line="+20"/>
<source>Edit Resources...</source>
- <translation>Edytuj zasoby...</translation>
+ <translation>Modyfikuj zasoby...</translation>
</message>
<message>
<location line="+6"/>
@@ -3961,12 +3961,12 @@ Czy chcesz nadpisać szablon?</translation>
<message>
<location line="+98"/>
<source>Edit action</source>
- <translation>Edytuj akcję</translation>
+ <translation>Modyfikuj akcję</translation>
</message>
<message>
<location line="-417"/>
<source>Edit...</source>
- <translation>Edytuj...</translation>
+ <translation>Modyfikuj...</translation>
</message>
<message>
<location line="+1"/>
@@ -4126,7 +4126,7 @@ Czy chcesz nadpisać szablon?</translation>
<message>
<location filename="../tools/designer/src/components/buddyeditor/buddyeditor_plugin.cpp" line="+73"/>
<source>Edit Buddies</source>
- <translation>Edytuj skojarzone etykiety</translation>
+ <translation>Modyfikuj skojarzone etykiety</translation>
</message>
</context>
<context>
@@ -4134,7 +4134,7 @@ Czy chcesz nadpisać szablon?</translation>
<message>
<location filename="../tools/designer/src/components/buddyeditor/buddyeditor_tool.cpp" line="+56"/>
<source>Edit Buddies</source>
- <translation>Edytuj skojarzone etykiety</translation>
+ <translation>Modyfikuj skojarzone etykiety</translation>
</message>
</context>
<context>
@@ -4254,7 +4254,7 @@ Czy chcesz nadpisać szablon?</translation>
<message>
<location filename="../tools/designer/src/components/taskmenu/combobox_taskmenu.cpp" line="+68"/>
<source>Edit Items...</source>
- <translation>Edytuj elementy...</translation>
+ <translation>Modyfikuj elementy...</translation>
</message>
<message>
<location line="+38"/>
@@ -4653,7 +4653,7 @@ Czy chcesz nadpisać szablon?</translation>
<message>
<location line="+6"/>
<source>Edit the selected profile</source>
- <translation>Edytuj zaznaczony profil</translation>
+ <translation>Modyfikuj zaznaczony profil</translation>
</message>
<message>
<location line="+4"/>
@@ -4673,7 +4673,7 @@ Czy chcesz nadpisać szablon?</translation>
<message>
<location line="+35"/>
<source>Edit Profile</source>
- <translation>Edytuj profil</translation>
+ <translation>Modyfikuj profil</translation>
</message>
<message>
<location line="+26"/>
@@ -4709,7 +4709,7 @@ Czy chcesz nadpisać szablon?</translation>
<message>
<location line="+1"/>
<source>The file &quot;%1&quot; has changed outside Designer. Do you want to reload it?</source>
- <translation type="unfinished">Plik &quot;%1&quot; zmienił się na zewnątrz Designera. Czy chcesz go ponownie załadować?</translation>
+ <translation>Plik &quot;%1&quot; zmienił się na zewnątrz Designera. Czy chcesz go ponownie załadować?</translation>
</message>
</context>
<context>
@@ -4725,7 +4725,7 @@ Czy chcesz nadpisać szablon?</translation>
<message>
<location filename="../tools/designer/src/components/formeditor/formwindow.cpp" line="-1267"/>
<source>Edit contents</source>
- <translation>Edytuj zawartość</translation>
+ <translation>Modyfikuj zawartość</translation>
</message>
<message>
<location line="+1"/>
@@ -4834,7 +4834,7 @@ Czy chcesz nadpisać szablon?</translation>
<context>
<name>qdesigner_internal::FormWindowManager</name>
<message>
- <location filename="../tools/designer/src/components/formeditor/formwindowmanager.cpp" line="+364"/>
+ <location filename="../tools/designer/src/components/formeditor/formwindowmanager.cpp" line="+365"/>
<source>Cu&amp;t</source>
<translation>Wy&amp;tnij</translation>
</message>
@@ -5290,12 +5290,12 @@ Czy chcesz nadpisać szablon?</translation>
<message>
<location line="+32"/>
<source>Edit List Widget</source>
- <translation>Edytuj listę</translation>
+ <translation>Modyfikuj listę</translation>
</message>
<message>
<location line="+19"/>
<source>Edit Combobox</source>
- <translation>Edytuj combobox</translation>
+ <translation>Modyfikuj combobox</translation>
</message>
</context>
<context>
@@ -5303,7 +5303,7 @@ Czy chcesz nadpisać szablon?</translation>
<message>
<location filename="../tools/designer/src/components/taskmenu/listwidget_taskmenu.cpp" line="+67"/>
<source>Edit Items...</source>
- <translation>Edytuj elementy...</translation>
+ <translation>Modyfikuj elementy...</translation>
</message>
<message>
<location line="+38"/>
@@ -5560,18 +5560,15 @@ Wybierz inną nazwę.</translation>
<context>
<name>qdesigner_internal::ObjectInspector</name>
<message>
- <location filename="../tools/designer/src/components/objectinspector/objectinspector.cpp" line="+754"/>
- <source>&amp;Find in Text...</source>
- <translation>Z&amp;najdź w tekście...</translation>
- </message>
-</context>
-<context>
- <name>qdesigner_internal::ObjectInspector::ObjectInspectorPrivate</name>
- <message>
- <location line="-438"/>
+ <location filename="../tools/designer/src/components/objectinspector/objectinspector.cpp" line="+316"/>
<source>Change Current Page</source>
<translation>Zmień bieżącą stronę</translation>
</message>
+ <message>
+ <location line="+438"/>
+ <source>&amp;Find in Text...</source>
+ <translation>Z&amp;najdź w tekście...</translation>
+ </message>
</context>
<context>
<name>qdesigner_internal::OrderDialog</name>
@@ -5611,7 +5608,7 @@ Wybierz inną nazwę.</translation>
<message>
<location filename="../tools/designer/src/components/propertyeditor/paletteeditor.ui"/>
<source>Edit Palette</source>
- <translation>Edytuj paletę</translation>
+ <translation>Modyfikuj paletę</translation>
</message>
<message>
<location/>
@@ -5719,7 +5716,7 @@ Wybierz inną nazwę.</translation>
<message>
<location filename="../tools/designer/src/lib/shared/plaintexteditor.cpp" line="+65"/>
<source>Edit text</source>
- <translation>Edytuj tekst</translation>
+ <translation>Modyfikuj tekst</translation>
</message>
</context>
<context>
@@ -5785,9 +5782,6 @@ Wybierz inną nazwę.</translation>
<source>Browse...</source>
<translation>Przeglądaj...</translation>
</message>
-</context>
-<context>
- <name>qdesigner_internal::PreviewConfigurationWidget::PreviewConfigurationWidgetPrivate</name>
<message>
<location line="+118"/>
<source>Load Custom Device Skin</source>
@@ -6202,12 +6196,12 @@ Klasa: %2</translation>
<message>
<location line="+235"/>
<source>Edit ToolTip</source>
- <translation>Edytuj podpowiedź</translation>
+ <translation>Modyfikuj podpowiedź</translation>
</message>
<message>
<location line="+5"/>
<source>Edit WhatsThis</source>
- <translation>Edytuj &quot;Co to jest&quot;</translation>
+ <translation>Modyfikuj &quot;Co to jest&quot;</translation>
</message>
</context>
<context>
@@ -6332,7 +6326,7 @@ Klasa: %2</translation>
<message>
<location filename="../tools/designer/src/lib/shared/richtexteditor.cpp" line="+436"/>
<source>Edit text</source>
- <translation>Edytuj tekst</translation>
+ <translation>Modyfikuj tekst</translation>
</message>
<message>
<location line="+32"/>
@@ -6433,7 +6427,7 @@ Klasa: %2</translation>
<message>
<location filename="../tools/designer/src/lib/shared/scriptdialog.cpp" line="+66"/>
<source>Edit script</source>
- <translation>Edytuj skrypt</translation>
+ <translation>Modyfikuj skrypt</translation>
</message>
<message>
<location line="+56"/>
@@ -6483,7 +6477,7 @@ Klasa: %2</translation>
<message>
<location filename="../tools/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp" line="+72"/>
<source>Edit Signals/Slots</source>
- <translation>Edytuj sygnały/sloty</translation>
+ <translation>Modyfikuj sygnały/sloty</translation>
</message>
<message>
<location line="+2"/>
@@ -6496,7 +6490,7 @@ Klasa: %2</translation>
<message>
<location filename="../tools/designer/src/components/signalsloteditor/signalsloteditor_tool.cpp" line="+58"/>
<source>Edit Signals/Slots</source>
- <translation>Edytuj sygnały/sloty</translation>
+ <translation>Modyfikuj sygnały/sloty</translation>
</message>
</context>
<context>
@@ -6520,7 +6514,7 @@ Klasa: %2</translation>
<message>
<location filename="../tools/designer/src/lib/shared/stylesheeteditor.cpp" line="+97"/>
<source>Edit Style Sheet</source>
- <translation>Edytuj arkusz stylu</translation>
+ <translation>Modyfikuj arkusz stylu</translation>
</message>
<message>
<location line="-7"/>
@@ -6587,7 +6581,7 @@ Klasa: %2</translation>
<message>
<location filename="../tools/designer/src/components/tabordereditor/tabordereditor_plugin.cpp" line="+73"/>
<source>Edit Tab Order</source>
- <translation>Edytuj kolejność tabulacji</translation>
+ <translation>Modyfikuj kolejność tabulacji</translation>
</message>
</context>
<context>
@@ -6595,7 +6589,7 @@ Klasa: %2</translation>
<message>
<location filename="../tools/designer/src/components/tabordereditor/tabordereditor_tool.cpp" line="+57"/>
<source>Edit Tab Order</source>
- <translation>Edytuj kolejność tabulacji</translation>
+ <translation>Modyfikuj kolejność tabulacji</translation>
</message>
</context>
<context>
@@ -6603,7 +6597,7 @@ Klasa: %2</translation>
<message>
<location filename="../tools/designer/src/components/taskmenu/tablewidgeteditor.ui"/>
<source>Edit Table Widget</source>
- <translation>Edytuj tablę</translation>
+ <translation>Modyfikuj tablę</translation>
</message>
<message>
<location/>
@@ -6652,7 +6646,7 @@ Klasa: %2</translation>
<message>
<location filename="../tools/designer/src/components/taskmenu/tablewidget_taskmenu.cpp" line="+64"/>
<source>Edit Items...</source>
- <translation>Edytuj elementy...</translation>
+ <translation>Modyfikuj elementy...</translation>
</message>
</context>
<context>
@@ -6688,12 +6682,12 @@ Klasa: %2</translation>
<message>
<location line="-1"/>
<source>Edit HTML</source>
- <translation>Edytuj HTML</translation>
+ <translation>Modyfikuj HTML</translation>
</message>
<message>
<location line="+10"/>
<source>Edit Text</source>
- <translation>Edytuj tekst</translation>
+ <translation>Modyfikuj tekst</translation>
</message>
<message>
<location line="+1"/>
@@ -6757,7 +6751,7 @@ Klasa: %2</translation>
<message>
<location filename="../tools/designer/src/components/taskmenu/treewidgeteditor.ui"/>
<source>Edit Tree Widget</source>
- <translation>Edytuj drzewo</translation>
+ <translation>Modyfikuj drzewo</translation>
</message>
<message>
<location/>
@@ -6883,7 +6877,7 @@ Klasa: %2</translation>
<message>
<location filename="../tools/designer/src/components/taskmenu/treewidget_taskmenu.cpp" line="+63"/>
<source>Edit Items...</source>
- <translation>Edytuj elementy...</translation>
+ <translation>Modyfikujj elementy...</translation>
</message>
</context>
<context>
@@ -6934,7 +6928,7 @@ Klasa: %2</translation>
<message>
<location line="+2"/>
<source>Edit name</source>
- <translation>Edytuj nazwę</translation>
+ <translation>Modyfikuj nazwę</translation>
</message>
</context>
<context>
@@ -6950,7 +6944,7 @@ Klasa: %2</translation>
<message>
<location filename="../tools/designer/src/components/formeditor/tool_widgeteditor.cpp" line="+67"/>
<source>Edit Widgets</source>
- <translation>Edytuj widżety</translation>
+ <translation>Modyfikuj widżety</translation>
</message>
</context>
<context>
diff --git a/translations/linguist_pl.ts b/translations/linguist_pl.ts
index cdff54b..963c39b 100644
--- a/translations/linguist_pl.ts
+++ b/translations/linguist_pl.ts
@@ -4,7 +4,7 @@
<context>
<name>AboutDialog</name>
<message>
- <location filename="../tools/linguist/linguist/mainwindow.cpp" line="+1357"/>
+ <location filename="../tools/linguist/linguist/mainwindow.cpp" line="+1364"/>
<source>Qt Linguist</source>
<translation>Qt Linguist</translation>
</message>
@@ -110,11 +110,17 @@
</message>
<message>
<location line="+4"/>
+ <location line="+8"/>
<source>&lt;p&gt;[more duplicates omitted]</source>
<translation>&lt;p&gt;[pominięto resztę powtórzeń]</translation>
</message>
<message>
- <location line="+3"/>
+ <location line="-5"/>
+ <source>&lt;p&gt;* ID: %1</source>
+ <translation>&lt;p&gt;* identyfikator: %1</translation>
+ </message>
+ <message>
+ <location line="+8"/>
<source>&lt;p&gt;* Context: %1&lt;br&gt;* Source: %2</source>
<translation>&lt;p&gt;* Kontekst: %1&lt;br&gt;* Źródło: %2</translation>
</message>
@@ -124,7 +130,7 @@
<translation>&lt;br&gt;* Komentarz: %3</translation>
</message>
<message>
- <location line="+70"/>
+ <location line="+71"/>
<source>Linguist does not know the plural rules for &apos;%1&apos;.
Will assume a single universal form.</source>
<translation>Linguist nie zna reguł liczby mnogiej dla &quot;%1&quot;.
@@ -312,7 +318,7 @@ Przyjmie on uniwersalną formę liczby pojedynczej.</translation>
<context>
<name>LRelease</name>
<message numerus="yes">
- <location filename="../tools/linguist/shared/qm.cpp" line="+748"/>
+ <location filename="../tools/linguist/shared/qm.cpp" line="+763"/>
<source>Dropped %n message(s) which had no ID.</source>
<translation>
<numerusform>Opuszczono %n wyrażenie które nie miało identyfikatora.</numerusform>
@@ -714,7 +720,7 @@ Przyjmie on uniwersalną formę liczby pojedynczej.</translation>
<translation>Zamienia tłumaczenia we wszystkich pasujących do wzorca wpisach.</translation>
</message>
<message>
- <location filename="../tools/linguist/linguist/mainwindow.cpp" line="-2004"/>
+ <location filename="../tools/linguist/linguist/mainwindow.cpp" line="-2011"/>
<source></source>
<comment>This is the application&apos;s main window.</comment>
<translation></translation>
@@ -732,27 +738,27 @@ Przyjmie on uniwersalną formę liczby pojedynczej.</translation>
</message>
<message>
<location line="-2"/>
- <location line="+62"/>
+ <location line="+63"/>
<source>Context</source>
<translation>Kontekst</translation>
</message>
<message>
- <location line="-61"/>
+ <location line="-62"/>
<source>Items</source>
<translation>Elementy</translation>
</message>
<message>
- <location line="+78"/>
+ <location line="+79"/>
<source>This panel lists the source contexts.</source>
<translation>Ten panel pokazuje listę kontekstów.</translation>
</message>
<message>
- <location line="+15"/>
+ <location line="+13"/>
<source>Strings</source>
<translation>Tłumaczenia</translation>
</message>
<message>
- <location line="+39"/>
+ <location line="+37"/>
<source>Phrases and guesses</source>
<translation>Wyrażenia i podpowiedzi</translation>
</message>
@@ -773,7 +779,7 @@ Przyjmie on uniwersalną formę liczby pojedynczej.</translation>
<translation> MOD </translation>
</message>
<message>
- <location line="+130"/>
+ <location line="+139"/>
<source>Loading...</source>
<translation>Ładowanie...</translation>
</message>
@@ -811,7 +817,7 @@ Czy chcesz pominąć pierwszy plik?</translation>
</translation>
</message>
<message>
- <location line="+93"/>
+ <location line="+94"/>
<source>Related files (%1);;</source>
<translation>Związane pliki (%1);;</translation>
</message>
@@ -1176,7 +1182,7 @@ Wszystkie pliki (*)</translation>
<translation>Czy chcesz zachować książke wyrażeń &apos;%1&apos;?</translation>
</message>
<message>
- <location line="+323"/>
+ <location line="+334"/>
<source>All</source>
<translation>Wszystko</translation>
</message>
@@ -1242,7 +1248,7 @@ Wszystkie pliki (*)</translation>
</message>
<message>
<location/>
- <location filename="../tools/linguist/linguist/mainwindow.cpp" line="-470"/>
+ <location filename="../tools/linguist/linguist/mainwindow.cpp" line="-481"/>
<source>Translation</source>
<translation>Tłumaczenie</translation>
</message>
@@ -1579,7 +1585,7 @@ Wszystkie pliki (*)</translation>
<translation>Tutaj można wprowadzić komentarze na własny użytek. One nie mają wpływu na przetłumaczoną aplikację.</translation>
</message>
<message>
- <location line="+232"/>
+ <location line="+234"/>
<source>%1 translation (%2)</source>
<translation>Tłumaczenie na język %1 (%2)</translation>
</message>
@@ -1609,7 +1615,7 @@ Linia: %2</translation>
<context>
<name>MessageModel</name>
<message>
- <location filename="../tools/linguist/linguist/messagemodel.cpp" line="+832"/>
+ <location filename="../tools/linguist/linguist/messagemodel.cpp" line="+825"/>
<source>Completion status for %1</source>
<translation>Stan ukończenia dla %1</translation>
</message>
@@ -1632,7 +1638,7 @@ Linia: %2</translation>
<context>
<name>MsgEdit</name>
<message>
- <location filename="../tools/linguist/linguist/messageeditor.cpp" line="-612"/>
+ <location filename="../tools/linguist/linguist/messageeditor.cpp" line="-614"/>
<source></source>
<comment>This is the right panel of the main window.</comment>
<translation></translation>
@@ -1811,8 +1817,8 @@ Linia: %2</translation>
<translation>Wszystkie pliki (*)</translation>
</message>
<message>
- <location filename="../tools/linguist/linguist/messagemodel.cpp" line="-1118"/>
- <location line="+18"/>
+ <location filename="../tools/linguist/linguist/messagemodel.cpp" line="-1120"/>
+ <location line="+27"/>
<location line="+67"/>
<location line="+39"/>
<location line="+17"/>
@@ -1847,7 +1853,7 @@ Linia: %2</translation>
<translation>Pliki XLIFF</translation>
</message>
<message>
- <location filename="../tools/linguist/shared/qph.cpp" line="+183"/>
+ <location filename="../tools/linguist/shared/qph.cpp" line="+195"/>
<source>Qt Linguist &apos;Phrase Book&apos;</source>
<translation>Qt Linguist &quot;Książka wyrażeń&quot;</translation>
</message>
@@ -1998,12 +2004,12 @@ Linia: %2</translation>
<context>
<name>TranslationSettingsDialog</name>
<message>
- <location filename="../tools/linguist/linguist/translationsettingsdialog.cpp" line="+68"/>
+ <location filename="../tools/linguist/linguist/translationsettingsdialog.cpp" line="+93"/>
<source>Any Country</source>
<translation>Dowolny kraj</translation>
</message>
<message>
- <location line="+11"/>
+ <location line="-22"/>
<location line="+8"/>
<source>Settings for &apos;%1&apos; - Qt Linguist</source>
<translation>Ustawienia dla &apos;%1&apos; - Qt Linguist</translation>
diff --git a/translations/qt_help_pl.ts b/translations/qt_help_pl.ts
index 220f70c..f2eb6c9 100644
--- a/translations/qt_help_pl.ts
+++ b/translations/qt_help_pl.ts
@@ -32,13 +32,9 @@
<context>
<name>QHelpCollectionHandler</name>
<message>
- <source>The collection file is not set up yet!</source>
- <translation type="obsolete">Plik z kolekcją nie jest jeszcze ustawiony!</translation>
- </message>
- <message>
<location filename="../tools/assistant/lib/qhelpcollectionhandler.cpp" line="+79"/>
<source>The collection file &apos;%1&apos; is not set up yet!</source>
- <translation type="unfinished"></translation>
+ <translation>Plik z kolekcją &quot;%1&quot; nie jest jeszcze ustawiony!</translation>
</message>
<message>
<location line="+23"/>
@@ -59,31 +55,27 @@
<message>
<location line="+16"/>
<source>The collection file &apos;%1&apos; already exists!</source>
- <translation type="unfinished"></translation>
+ <translation>Plik z kolekcją &quot;%1&quot; już istnieje!</translation>
</message>
<message>
<location line="+148"/>
<source>Unknown filter &apos;%1&apos;!</source>
- <translation type="unfinished"></translation>
+ <translation>Nieznany filtr &quot;%1&quot;!</translation>
</message>
<message>
<location line="+105"/>
<source>Invalid documentation file &apos;%1&apos;!</source>
- <translation type="unfinished"></translation>
+ <translation>Niepoprawny plik z dokumentacją &quot;%1&quot;!</translation>
</message>
<message>
<location line="+167"/>
<source>Cannot register namespace &apos;%1&apos;!</source>
- <translation type="unfinished"></translation>
+ <translation>Nie można zarejestrować przestrzeni nazw &quot;%1&quot;!</translation>
</message>
<message>
<location line="+24"/>
<source>Cannot open database &apos;%1&apos; to optimize!</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>The specified collection file already exists!</source>
- <translation type="obsolete">Podany plik z kolekcją już istnieje!</translation>
+ <translation>Nie można otworzyć bazy danych &quot;%1&quot; do zoptymalizowania!</translation>
</message>
<message>
<location line="-438"/>
@@ -96,10 +88,6 @@
<translation>Nie można skopiować pliku z kolekcją: %1</translation>
</message>
<message>
- <source>Unknown filter!</source>
- <translation type="obsolete">Nieznany filtr!</translation>
- </message>
- <message>
<location line="+174"/>
<source>Cannot register filter %1!</source>
<translation>Nie można zarejestrować pliku %1!</translation>
@@ -110,10 +98,6 @@
<translation>Nie można otworzyć pliku z dokumentacją %1!</translation>
</message>
<message>
- <source>Invalid documentation file!</source>
- <translation type="obsolete">Niepoprawny plik z dokumentacją!</translation>
- </message>
- <message>
<location line="+40"/>
<source>The namespace %1 was not registered!</source>
<translation>Przestrzeń nazw %1 nie została zarejestrowana!</translation>
@@ -123,14 +107,6 @@
<source>Namespace %1 already exists!</source>
<translation>Przestrzeń nazw %1 już istnieje!</translation>
</message>
- <message>
- <source>Cannot register namespace!</source>
- <translation type="obsolete">Nie można zarejestrować przestrzeni nazw!</translation>
- </message>
- <message>
- <source>Cannot open database to optimize!</source>
- <translation type="obsolete">Nie można otworzyć bazy danych do zoptymalizowania!</translation>
- </message>
</context>
<context>
<name>QHelpDBReader</name>
@@ -144,7 +120,7 @@
<context>
<name>QHelpEngineCore</name>
<message>
- <location filename="../tools/assistant/lib/qhelpenginecore.cpp" line="+524"/>
+ <location filename="../tools/assistant/lib/qhelpenginecore.cpp" line="+525"/>
<source>The specified namespace does not exist!</source>
<translation>Podana przestrzeń nazw nie istnieje!</translation>
</message>
@@ -152,7 +128,7 @@
<context>
<name>QHelpEngineCorePrivate</name>
<message>
- <location line="-402"/>
+ <location line="-403"/>
<source>Cannot open documentation file %1: %2!</source>
<translation>Nie można otworzyć pliku z dokumentacją %1: %2!</translation>
</message>
@@ -342,11 +318,6 @@
<context>
<name>QObject</name>
<message>
- <location filename="../tools/assistant/lib/qhelp_global.h" line="+83"/>
- <source>Untitled</source>
- <translation>Nienazwany</translation>
- </message>
- <message>
<location filename="../tools/assistant/lib/qhelpprojectdata.cpp" line="+85"/>
<source>Unknown token.</source>
<translation>Nieznany znak.</translation>
diff --git a/translations/qt_pl.ts b/translations/qt_pl.ts
index f79ecb0..fabec70 100644
--- a/translations/qt_pl.ts
+++ b/translations/qt_pl.ts
@@ -4,7 +4,7 @@
<context>
<name>CloseButton</name>
<message>
- <location filename="../src/gui/widgets/qtabbar.cpp" line="+2245"/>
+ <location filename="../src/gui/widgets/qtabbar.cpp" line="+2264"/>
<source>Close Tab</source>
<translation>Zamknij kartę</translation>
</message>
@@ -12,7 +12,7 @@
<context>
<name>FakeReply</name>
<message>
- <location filename="../src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp" line="+2193"/>
+ <location filename="../src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp" line="+2199"/>
<source>Fake error !</source>
<translation type="unfinished"></translation>
</message>
@@ -58,7 +58,7 @@
<context>
<name>Phonon::AudioOutput</name>
<message>
- <location filename="../src/3rdparty/phonon/phonon/audiooutput.cpp" line="+377"/>
+ <location filename="../src/3rdparty/phonon/phonon/audiooutput.cpp" line="+385"/>
<source>&lt;html&gt;The audio playback device &lt;b&gt;%1&lt;/b&gt; does not work.&lt;br/&gt;Falling back to &lt;b&gt;%2&lt;/b&gt;.&lt;/html&gt;</source>
<translation>&lt;html&gt;Urządzenie dźwiękowe &lt;b&gt;%1&lt;/b&gt; nie działa.&lt;br/&gt;Przywracanie do &lt;b&gt;%2&lt;/b&gt;.&lt;/html&gt;</translation>
</message>
@@ -76,7 +76,7 @@
<context>
<name>Phonon::Gstreamer::Backend</name>
<message>
- <location filename="../src/3rdparty/phonon/gstreamer/backend.cpp" line="+171"/>
+ <location filename="../src/3rdparty/phonon/gstreamer/backend.cpp" line="+182"/>
<source>Warning: You do not seem to have the package gstreamer0.10-plugins-good installed.
Some video features have been disabled.</source>
<translation>Ostrzeżenie: Wygląda na to, że pakiet gstreamer0.10-plugins-good nie jest zainstalowany w tym systemie.
@@ -96,7 +96,7 @@ Obsługa dźwięku i wideo została wyłączona</translation>
<location filename="../src/3rdparty/phonon/gstreamer/mediaobject.cpp" line="+90"/>
<source>Cannot start playback.
-Check your Gstreamer installation and make sure you
+Check your GStreamer installation and make sure you
have libgstreamer-plugins-base installed.</source>
<translation>Nie można rozpocząć odtwarzania.
@@ -109,10 +109,10 @@ zainstalowałeś libgstreamer-plugins-base.</translation>
<translation>Brak wymaganego kodeka. Aby odtworzyć zawartość musisz zainstalować poniższy kodek: %0</translation>
</message>
<message>
- <location line="+681"/>
+ <location line="+702"/>
<location line="+8"/>
<location line="+15"/>
- <location line="+22"/>
+ <location line="+26"/>
<location line="+6"/>
<location line="+19"/>
<location line="+339"/>
@@ -121,12 +121,12 @@ zainstalowałeś libgstreamer-plugins-base.</translation>
<translation>Nie można otworzyć źródła mediów.</translation>
</message>
<message>
- <location line="-420"/>
+ <location line="-424"/>
<source>Invalid source type.</source>
<translation>Niepoprawny typ źródła.</translation>
</message>
<message>
- <location line="+394"/>
+ <location line="+398"/>
<source>Could not locate media source.</source>
<translation>Nie można znaleźć źródła mediów.</translation>
</message>
@@ -144,7 +144,7 @@ zainstalowałeś libgstreamer-plugins-base.</translation>
<context>
<name>Phonon::MMF</name>
<message>
- <location filename="../src/3rdparty/phonon/mmf/audiooutput.cpp" line="+108"/>
+ <location filename="../src/3rdparty/phonon/mmf/audiooutput.cpp" line="+98"/>
<source>Audio Output</source>
<translation>Wyjście dźwięku</translation>
</message>
@@ -166,12 +166,12 @@ zainstalowałeś libgstreamer-plugins-base.</translation>
<name>Phonon::MMF::EffectFactory</name>
<message>
<location filename="../src/3rdparty/phonon/mmf/effectfactory.cpp" line="+65"/>
- <source>audio equalizer</source>
+ <source>Audio Equalizer</source>
<translation>Korektor graficzny</translation>
</message>
<message>
<location line="+2"/>
- <source>Bass boost</source>
+ <source>Bass Boost</source>
<translation>Wzmocnienie basów</translation>
</message>
<message>
@@ -202,6 +202,14 @@ zainstalowałeś libgstreamer-plugins-base.</translation>
</message>
</context>
<context>
+ <name>Phonon::MMF::MediaObject</name>
+ <message>
+ <location filename="../src/3rdparty/phonon/mmf/mediaobject.cpp" line="+291"/>
+ <source>Media type could not be determined</source>
+ <translation>Nie można określić typu mediów</translation>
+ </message>
+</context>
+<context>
<name>Phonon::VolumeSlider</name>
<message>
<location filename="../src/3rdparty/phonon/phonon/volumeslider.cpp" line="+42"/>
@@ -268,7 +276,7 @@ zainstalowałeś libgstreamer-plugins-base.</translation>
<context>
<name>Q3FileDialog</name>
<message>
- <location filename="../src/qt3support/dialogs/q3filedialog.cpp" line="+4495"/>
+ <location filename="../src/qt3support/dialogs/q3filedialog.cpp" line="+4493"/>
<source>%1
File not found.
Check path and filename.</source>
@@ -285,7 +293,7 @@ Sprawdź ścieżkę i nazwę pliku.</translation>
<location line="-1924"/>
<location line="+49"/>
<location line="+2149"/>
- <location filename="../src/qt3support/dialogs/q3filedialog_mac.cpp" line="+112"/>
+ <location filename="../src/qt3support/dialogs/q3filedialog_mac.cpp" line="+133"/>
<source>All Files (*)</source>
<translation>Wszystkie pliki (*)</translation>
</message>
@@ -905,8 +913,8 @@ na
<context>
<name>QAbstractSocket</name>
<message>
- <location filename="../src/network/socket/qabstractsocket.cpp" line="+940"/>
- <location filename="../src/network/socket/qhttpsocketengine.cpp" line="+636"/>
+ <location filename="../src/network/socket/qabstractsocket.cpp" line="+949"/>
+ <location filename="../src/network/socket/qhttpsocketengine.cpp" line="+646"/>
<location filename="../src/network/socket/qsocks5socketengine.cpp" line="+691"/>
<source>Connection refused</source>
<translation>Połączenie odrzucone</translation>
@@ -925,8 +933,8 @@ na
<translation>Przekroczony czas połączenia</translation>
</message>
<message>
- <location line="-548"/>
- <location line="+789"/>
+ <location line="-555"/>
+ <location line="+805"/>
<location line="+208"/>
<source>Operation on socket is not supported</source>
<translation>Operacja na gnieździe nieobsługiwana</translation>
@@ -970,7 +978,7 @@ na
<message>
<location filename="../src/plugins/accessible/widgets/simplewidgets.cpp" line="+250"/>
<source>Press</source>
- <translation type="unfinished">Wciśnij</translation>
+ <translation>Wciśnij</translation>
</message>
</context>
<context>
@@ -996,7 +1004,7 @@ na
<translation>Niekompatybilność biblioteki Qt</translation>
</message>
<message>
- <location filename="../src/gui/kernel/qapplication.cpp" line="+2290"/>
+ <location filename="../src/gui/kernel/qapplication.cpp" line="+2280"/>
<source>QT_LAYOUT_DIRECTION</source>
<comment>Translate this string to the string &apos;LTR&apos; in left-to-right languages or to &apos;RTL&apos; in right-to-left languages (such as Hebrew and Arabic) to get proper widget layout.</comment>
<translation>LTR</translation>
@@ -1173,7 +1181,7 @@ na
<context>
<name>QDB2Driver</name>
<message>
- <location filename="../src/sql/drivers/db2/qsql_db2.cpp" line="+1254"/>
+ <location filename="../src/sql/drivers/db2/qsql_db2.cpp" line="+1253"/>
<source>Unable to connect</source>
<translation>Nie można nawiązać połączenia</translation>
</message>
@@ -1196,7 +1204,7 @@ na
<context>
<name>QDB2Result</name>
<message>
- <location line="-1031"/>
+ <location line="-1030"/>
<location line="+240"/>
<source>Unable to execute statement</source>
<translation>Nie można wykonać polecenia</translation>
@@ -1284,7 +1292,7 @@ na
<context>
<name>QDialogButtonBox</name>
<message>
- <location filename="../src/gui/widgets/qdialogbuttonbox.cpp" line="+653"/>
+ <location filename="../src/gui/widgets/qdialogbuttonbox.cpp" line="+669"/>
<source>Abort</source>
<translation>Przerwij</translation>
</message>
@@ -1511,7 +1519,7 @@ na
<message>
<location line="+23"/>
<source>Cannot remove source file</source>
- <translation>Nie można usunąć oryginalnego pilku</translation>
+ <translation>Nie można usunąć oryginalnego pliku</translation>
</message>
<message>
<location line="+130"/>
@@ -1575,7 +1583,7 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation>
<translation>Czy na pewno chcesz skasować &apos;%1&apos;?</translation>
</message>
<message>
- <location line="+425"/>
+ <location line="+419"/>
<source>Recent Places</source>
<translation>Ostatnie miejsca</translation>
</message>
@@ -1586,7 +1594,7 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation>
<translation>Powrót</translation>
</message>
<message>
- <location filename="../src/gui/dialogs/qfiledialog.cpp" line="-410"/>
+ <location filename="../src/gui/dialogs/qfiledialog.cpp" line="-404"/>
<source>Could not delete directory.</source>
<translation>Nie można skasować katalogu.</translation>
</message>
@@ -1803,9 +1811,8 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation>
</message>
<message>
<location line="+1"/>
- <location filename="../src/gui/itemviews/qdirmodel.cpp" line="+1"/>
<source>%1 bytes</source>
- <translation>%1 b</translation>
+ <translation>%1 bajtów</translation>
</message>
<message>
<location line="+77"/>
@@ -1854,62 +1861,67 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation>
<source>Computer</source>
<translation>Komputer</translation>
</message>
+ <message>
+ <location filename="../src/gui/itemviews/qdirmodel.cpp" line="+1"/>
+ <source>%1 byte(s)</source>
+ <translation>%1 bajt(ów)</translation>
+ </message>
</context>
<context>
<name>QFontDatabase</name>
<message>
<location filename="../src/gui/text/qfontdatabase.cpp" line="+102"/>
- <location line="+1335"/>
+ <location line="+1342"/>
<source>Normal</source>
<translation>Normalny</translation>
</message>
<message>
- <location line="-1332"/>
+ <location line="-1339"/>
<location line="+12"/>
- <location line="+1308"/>
+ <location line="+1315"/>
<source>Bold</source>
<translation>Pogrubiony</translation>
</message>
<message>
- <location line="-1317"/>
- <location line="+1319"/>
+ <location line="-1324"/>
+ <location line="+1326"/>
<source>Demi Bold</source>
<translation>Na wpół pogrubiony</translation>
</message>
<message>
- <location line="-1316"/>
+ <location line="-1323"/>
<location line="+18"/>
- <location line="+1294"/>
+ <location line="+1301"/>
<source>Black</source>
<translatorcomment>it&apos;s about font weight</translatorcomment>
<translation>Bardzo gruby</translation>
</message>
<message>
- <location line="-1304"/>
+ <location line="-1311"/>
<source>Demi</source>
<translation>Na wpół</translation>
</message>
<message>
<location line="+6"/>
- <location line="+1304"/>
+ <location line="+1311"/>
<source>Light</source>
<translatorcomment>it&apos;s about font weight</translatorcomment>
<translation>Cienki</translation>
</message>
<message>
- <location line="-1158"/>
- <location line="+1161"/>
+ <location line="-1165"/>
+ <location line="+1168"/>
<source>Italic</source>
<translation>Kursywa</translation>
</message>
<message>
- <location line="-1158"/>
- <location line="+1160"/>
+ <location line="-1165"/>
+ <location line="+1167"/>
<source>Oblique</source>
<translation>Pochyły</translation>
</message>
<message>
- <location line="+703"/>
+ <location line="+704"/>
<source>Any</source>
<translation>Każdy</translation>
</message>
@@ -2073,6 +2085,11 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation>
<source>Runic</source>
<translation>Runiczny</translation>
</message>
+ <message>
+ <location line="+3"/>
+ <source>N&apos;Ko</source>
+ <translation>N&apos;Ko</translation>
+ </message>
</context>
<context>
<name>QFontDialog</name>
@@ -2272,7 +2289,7 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation>
<context>
<name>QHostInfo</name>
<message>
- <location filename="../src/network/kernel/qhostinfo_p.h" line="+183"/>
+ <location filename="../src/network/kernel/qhostinfo_p.h" line="+185"/>
<source>Unknown error</source>
<translation>Nieznany błąd</translation>
</message>
@@ -2326,7 +2343,7 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation>
<translation>Podłączony do hosta %1</translation>
</message>
<message>
- <location filename="../src/network/access/qhttpnetworkconnection.cpp" line="+572"/>
+ <location filename="../src/network/access/qhttpnetworkconnection.cpp" line="+581"/>
<location filename="../src/qt3support/network/q3http.cpp" line="+17"/>
<source>Connection closed</source>
<translation>Połączenie zakończone</translation>
@@ -2633,7 +2650,7 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation>
<context>
<name>QIODevice</name>
<message>
- <location filename="../src/corelib/global/qglobal.cpp" line="+2067"/>
+ <location filename="../src/corelib/global/qglobal.cpp" line="+2081"/>
<source>No space left on device</source>
<translation>Brak wolnego miejsca na urządzeniu</translation>
</message>
@@ -2653,7 +2670,7 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation>
<translation>Zbyt wiele otwartych plików</translation>
</message>
<message>
- <location filename="../src/corelib/io/qiodevice.cpp" line="+1561"/>
+ <location filename="../src/corelib/io/qiodevice.cpp" line="+1556"/>
<source>Unknown error</source>
<translation>Nieznany błąd</translation>
</message>
@@ -2717,7 +2734,7 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation>
<translation>Błąd podczas weryfikacji danych we wtyczce &apos;%1&apos;</translation>
</message>
<message>
- <location line="+347"/>
+ <location line="+350"/>
<source>The plugin &apos;%1&apos; uses incompatible Qt library. (%2.%3.%4) [%5]</source>
<translation>Wtyczka &apos;%1&apos; używa niepoprawnej wersji biblioteki QT. (%2.%3.%4) [%5]</translation>
</message>
@@ -2769,37 +2786,37 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation>
<context>
<name>QLineEdit</name>
<message>
- <location filename="../src/gui/widgets/qlineedit.cpp" line="+1996"/>
+ <location filename="../src/gui/widgets/qlineedit.cpp" line="+2033"/>
<source>&amp;Copy</source>
<translation>S&amp;kopiuj</translation>
</message>
<message>
- <location line="-5"/>
+ <location line="-6"/>
<source>Cu&amp;t</source>
<translation>W&amp;ytnij</translation>
</message>
<message>
- <location line="+15"/>
+ <location line="+19"/>
<source>Delete</source>
<translation>Skasuj</translation>
</message>
<message>
- <location line="-5"/>
+ <location line="-7"/>
<source>&amp;Paste</source>
<translation>&amp;Wklej</translation>
</message>
<message>
- <location line="-17"/>
+ <location line="-21"/>
<source>&amp;Redo</source>
<translation>&amp;Przywróć</translation>
</message>
<message>
- <location line="+28"/>
+ <location line="+36"/>
<source>Select All</source>
<translation>Zaznacz wszystko</translation>
</message>
<message>
- <location line="-32"/>
+ <location line="-40"/>
<source>&amp;Undo</source>
<translation>&amp;Cofnij</translation>
</message>
@@ -2808,7 +2825,7 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation>
<name>QLocalServer</name>
<message>
<location filename="../src/network/socket/qlocalserver.cpp" line="+224"/>
- <location filename="../src/network/socket/qlocalserver_unix.cpp" line="+256"/>
+ <location filename="../src/network/socket/qlocalserver_unix.cpp" line="+246"/>
<source>%1: Name error</source>
<translation>%1: Błąd nazwy</translation>
</message>
@@ -2902,7 +2919,7 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation>
<context>
<name>QMYSQLDriver</name>
<message>
- <location filename="../src/sql/drivers/mysql/qsql_mysql.cpp" line="+1423"/>
+ <location filename="../src/sql/drivers/mysql/qsql_mysql.cpp" line="+1431"/>
<source>Unable to begin transaction</source>
<translation>Nie można rozpocząć transakcji</translation>
</message>
@@ -2912,7 +2929,7 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation>
<translation>Nie można potwierdzić transakcji</translation>
</message>
<message>
- <location line="-168"/>
+ <location line="-167"/>
<source>Unable to connect</source>
<translation>Nie można nawiązać połączenia</translation>
</message>
@@ -2922,7 +2939,7 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation>
<translation>Nie można otworzyć bazy danych &apos;</translation>
</message>
<message>
- <location line="+196"/>
+ <location line="+195"/>
<source>Unable to rollback transaction</source>
<translation>Nie można wycofać transakcji</translation>
</message>
@@ -2930,7 +2947,7 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation>
<context>
<name>QMYSQLResult</name>
<message>
- <location line="-433"/>
+ <location line="-432"/>
<location line="+21"/>
<source>Unable to bind outvalues</source>
<translation>Nie można powiązać wartości zewnętrznych</translation>
@@ -2951,12 +2968,13 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation>
<translation>Nie można wykonać polecenia</translation>
</message>
<message>
- <location line="-522"/>
+ <location line="-531"/>
+ <location line="+31"/>
<source>Unable to fetch data</source>
<translation>Nie można pobrać danych</translation>
</message>
<message>
- <location line="+380"/>
+ <location line="+358"/>
<location line="+8"/>
<source>Unable to prepare statement</source>
<translation>Nie można przygotować polecenia</translation>
@@ -3332,27 +3350,30 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation>
<context>
<name>QNetworkAccessFileBackend</name>
<message>
+ <location filename="../src/network/access/qfilenetworkreply.cpp" line="+83"/>
<location filename="../src/network/access/qnetworkaccessfilebackend.cpp" line="+100"/>
<source>Request for opening non-local file %1</source>
<translation>Żądanie otwarcia zdalnego pliku %1</translation>
</message>
<message>
- <location line="+45"/>
+ <location line="+31"/>
+ <location filename="../src/network/access/qnetworkaccessfilebackend.cpp" line="+45"/>
<source>Error opening %1: %2</source>
<translation>Błąd otwierania %1: %2</translation>
</message>
<message>
- <location line="+38"/>
+ <location filename="../src/network/access/qnetworkaccessfilebackend.cpp" line="+38"/>
<source>Write error writing to %1: %2</source>
<translation>Błąd w trakcie zapisywania do %1: %2</translation>
</message>
<message>
- <location line="+48"/>
+ <location filename="../src/network/access/qfilenetworkreply.cpp" line="-11"/>
+ <location filename="../src/network/access/qnetworkaccessfilebackend.cpp" line="+48"/>
<source>Cannot open %1: Path is a directory</source>
<translation>Nie można otworzyć %1: Ścieżka jest katalogiem</translation>
</message>
<message>
- <location line="+21"/>
+ <location filename="../src/network/access/qnetworkaccessfilebackend.cpp" line="+21"/>
<source>Read error reading from %1: %2</source>
<translation>Błąd w trakcie czytania z %1: %2</translation>
</message>
@@ -3418,7 +3439,7 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation>
<context>
<name>QOCIDriver</name>
<message>
- <location filename="../src/sql/drivers/oci/qsql_oci.cpp" line="+1932"/>
+ <location filename="../src/sql/drivers/oci/qsql_oci.cpp" line="+1939"/>
<source>Unable to initialize</source>
<comment>QOCIDriver</comment>
<translation>Nie można dokonać inicjalizacji</translation>
@@ -3447,8 +3468,8 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation>
<context>
<name>QOCIResult</name>
<message>
- <location line="-972"/>
- <location line="+161"/>
+ <location line="-979"/>
+ <location line="+168"/>
<location line="+15"/>
<source>Unable to bind column for batch execute</source>
<translation>Nie można powiązać kolumny dla wykonania zestawu poleceń</translation>
@@ -3552,7 +3573,7 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation>
<translation>Nie można przygotować polecenia</translation>
</message>
<message>
- <location filename="../src/sql/drivers/db2/qsql_db2.cpp" line="+190"/>
+ <location filename="../src/sql/drivers/db2/qsql_db2.cpp" line="+189"/>
<location filename="../src/sql/drivers/odbc/qsql_odbc.cpp" line="-199"/>
<location line="+576"/>
<source>Unable to fetch last</source>
@@ -3611,7 +3632,7 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation>
<context>
<name>QPPDOptionsModel</name>
<message>
- <location filename="../src/gui/dialogs/qprintdialog_unix.cpp" line="+1198"/>
+ <location filename="../src/gui/dialogs/qprintdialog_unix.cpp" line="+1197"/>
<source>Name</source>
<translation>Nazwa</translation>
</message>
@@ -3919,15 +3940,15 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation>
<message>
<location filename="../src/gui/dialogs/qprintdialog_qws.cpp" line="+24"/>
<source>Print all</source>
- <translation>Wydrukuj wszystko</translation>
+ <translation>Drukuj wszystko</translation>
</message>
<message>
<location line="+2"/>
<source>Print range</source>
- <translation>Wydrukuj zakres</translation>
+ <translation>Drukuj zakres</translation>
</message>
<message>
- <location filename="../src/gui/painting/qprinterinfo_unix.cpp" line="+471"/>
+ <location filename="../src/gui/painting/qprinterinfo_unix.cpp" line="+473"/>
<location line="+199"/>
<source>unknown</source>
<translation>nieznany</translation>
@@ -3972,15 +3993,15 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation>
<location line="+13"/>
<location filename="../src/gui/dialogs/qprintdialog_win.cpp" line="-2"/>
<source>Print</source>
- <translation>Wydrukuj</translation>
+ <translation>Drukowanie</translation>
</message>
<message>
- <location filename="../src/gui/dialogs/qprintdialog_unix.cpp" line="-357"/>
+ <location filename="../src/gui/dialogs/qprintdialog_unix.cpp" line="-359"/>
<source>Print To File ...</source>
- <translation>Wydrukuj do pliku ...</translation>
+ <translation>Drukuj do pliku ...</translation>
</message>
<message>
- <location line="+80"/>
+ <location line="+82"/>
<source>File %1 is not writable.
Please choose a different file name.</source>
<translation>Plik %1 jest plikiem tylko do odczytu.
@@ -4013,7 +4034,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="+227"/>
<source>Print selection</source>
- <translation>Wydrukuj zaznaczone</translation>
+ <translation>Drukuj zaznaczone</translation>
</message>
<message>
<location filename="../src/gui/dialogs/qpagesetupdialog_unix.cpp" line="-232"/>
@@ -4171,7 +4192,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<translation>Niestandardowy</translation>
</message>
<message>
- <location filename="../src/gui/dialogs/qprintdialog_unix.cpp" line="-524"/>
+ <location filename="../src/gui/dialogs/qprintdialog_unix.cpp" line="-523"/>
<location line="+68"/>
<source>&amp;Options &gt;&gt;</source>
<translation>&amp;Opcje &gt;&gt;</translation>
@@ -4179,7 +4200,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="-63"/>
<source>&amp;Print</source>
- <translation>&amp;Drukuj</translation>
+ <translation>Wy&amp;drukuj</translation>
</message>
<message>
<location line="+67"/>
@@ -4189,12 +4210,12 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="+253"/>
<source>Print to File (PDF)</source>
- <translation>Wydrukuj do pliku (PDF)</translation>
+ <translation>Drukuj do pliku (PDF)</translation>
</message>
<message>
<location line="+1"/>
<source>Print to File (Postscript)</source>
- <translation>Wydrukuj do pliku (Postscript)</translation>
+ <translation>Drukuj do pliku (Postscript)</translation>
</message>
<message>
<location line="+47"/>
@@ -4222,7 +4243,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="+68"/>
<source>Print Preview</source>
- <translation>Wydrukuj podgląd</translation>
+ <translation>Podgląd wydruku</translation>
</message>
<message>
<location line="+30"/>
@@ -4349,12 +4370,12 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location/>
<source>Print range</source>
- <translation>Wydrukuj zakres</translation>
+ <translation>Zakres wydruku</translation>
</message>
<message>
<location/>
<source>Print all</source>
- <translation>Wydrukuj wszystko</translation>
+ <translation>Drukuj wszystko</translation>
</message>
<message>
<location/>
@@ -4483,7 +4504,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<context>
<name>QProcess</name>
<message>
- <location filename="../src/corelib/io/qprocess_unix.cpp" line="+402"/>
+ <location filename="../src/corelib/io/qprocess_unix.cpp" line="+406"/>
<location filename="../src/corelib/io/qprocess_win.cpp" line="+137"/>
<source>Could not open input redirection for reading</source>
<translation>Nie można otworzyć wejściowego przekierowania do odczytu</translation>
@@ -4500,7 +4521,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<translation>Błąd zasobów (błąd forkowania): %1</translation>
</message>
<message>
- <location line="+252"/>
+ <location line="+258"/>
<location line="+52"/>
<location line="+74"/>
<location line="+66"/>
@@ -4664,7 +4685,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<context>
<name>QSQLiteDriver</name>
<message>
- <location filename="../src/sql/drivers/sqlite/qsql_sqlite.cpp" line="+555"/>
+ <location filename="../src/sql/drivers/sqlite/qsql_sqlite.cpp" line="+551"/>
<source>Error closing database</source>
<translation>Błąd zamykania bazy danych</translation>
</message>
@@ -4707,8 +4728,8 @@ Proszę wybrać inną nazwę pliku.</translation>
<translation>Nie można wykonać polecenia</translation>
</message>
<message>
- <location line="-133"/>
- <location line="+66"/>
+ <location line="-129"/>
+ <location line="+62"/>
<location line="+8"/>
<source>Unable to fetch row</source>
<translation>Nie można pobrać wiersza danych</translation>
@@ -4719,7 +4740,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<translation>Nie można skasować polecenia</translation>
</message>
<message>
- <location line="-152"/>
+ <location line="-148"/>
<source>No query</source>
<translation>Brak zapytania</translation>
</message>
@@ -4744,7 +4765,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="+2"/>
<source>Ignore-count</source>
- <translation type="unfinished"></translation>
+ <translation>Licznik pominięć</translation>
</message>
<message>
<location line="+2"/>
@@ -4754,7 +4775,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="+2"/>
<source>Hit-count</source>
- <translation>Ilość trafień</translation>
+ <translation>Licznik trafień</translation>
</message>
</context>
<context>
@@ -5031,7 +5052,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="+6"/>
<source>Debug Output</source>
- <translation>Wyjscie debuggera</translation>
+ <translation>Wyjście debuggera</translation>
</message>
<message>
<location line="+6"/>
@@ -5167,7 +5188,7 @@ Proszę wybrać inną nazwę pliku.</translation>
</message>
<message>
<location filename="../src/corelib/kernel/qsharedmemory_symbian.cpp" line="+83"/>
- <location filename="../src/corelib/kernel/qsharedmemory_unix.cpp" line="+80"/>
+ <location filename="../src/corelib/kernel/qsharedmemory_unix.cpp" line="+81"/>
<location filename="../src/corelib/kernel/qsharedmemory_win.cpp" line="+87"/>
<source>%1: permission denied</source>
<translation>%1: brak dostępu</translation>
@@ -5262,7 +5283,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<context>
<name>QShortcut</name>
<message>
- <location filename="../src/gui/kernel/qkeysequence.cpp" line="+1143"/>
+ <location filename="../src/gui/kernel/qkeysequence.cpp" line="+1249"/>
<source>+</source>
<translation>+</translation>
</message>
@@ -5273,12 +5294,12 @@ Proszę wybrać inną nazwę pliku.</translation>
<translation>Alt</translation>
</message>
<message>
- <location line="-767"/>
+ <location line="-871"/>
<source>Back</source>
<translation>Back</translation>
</message>
<message>
- <location line="-23"/>
+ <location line="-25"/>
<source>Backspace</source>
<translation>Backspace</translation>
</message>
@@ -5288,7 +5309,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<translation>Backtab</translation>
</message>
<message>
- <location line="+31"/>
+ <location line="+33"/>
<source>Bass Boost</source>
<translation>Wzmocnienie basów</translation>
</message>
@@ -5303,7 +5324,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<translation>Basy w górę</translation>
</message>
<message>
- <location line="+59"/>
+ <location line="+149"/>
<source>Call</source>
<translation>Wywołaj</translation>
</message>
@@ -5313,12 +5334,457 @@ Proszę wybrać inną nazwę pliku.</translation>
<translation>Caps Lock</translation>
</message>
<message>
- <location line="-53"/>
+ <location line="-145"/>
<source>CapsLock</source>
<translation>CapsLock</translation>
</message>
<message>
- <location line="+70"/>
+ <location line="+49"/>
+ <source>Monitor Brightness Up</source>
+ <translation>Zwiększ jasność monitora</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Monitor Brightness Down</source>
+ <translation>Zmniejsz jasność monitora</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Keyboard Light On/Off</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Keyboard Brightness Up</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Keyboard Brightness Down</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Power Off</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Wake Up</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Eject</source>
+ <translation>Wysuń</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Screensaver</source>
+ <translation>Wygaszacz ekranu</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>WWW</source>
+ <translation>WWW</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Sleep</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>LightBulb</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Shop</source>
+ <translation>Sklep</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>History</source>
+ <translation>Historia</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Add Favorite</source>
+ <translation>Dodaj do ulubionych</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Hot Links</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Adjust Brightness</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Finance</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Community</source>
+ <translation>Społeczność</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Audio Rewind</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Back Forward</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Application Left</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Application Right</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Book</source>
+ <translation>Książka</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>CD</source>
+ <translation>CD</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Calculator</source>
+ <translation>Kalkulator</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Clear</source>
+ <translation>Wyczyść</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Clear Grab</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Close</source>
+ <translation>Zamknij</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Copy</source>
+ <translation>Skopiuj</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Cut</source>
+ <translation>Wytnij</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Display</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>DOS</source>
+ <translation>DOS</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Documents</source>
+ <translation>Dokumenty</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Spreadsheet</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Browser</source>
+ <translation>Przeglądarka</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Game</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Go</source>
+ <translation>Przejdź</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>iTouch</source>
+ <translation>iTouch</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Logoff</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Market</source>
+ <translation>Rynek</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Meeting</source>
+ <translation>Spotkanie</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Keyboard Menu</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Menu PB</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>My Sites</source>
+ <translation>Moje strony</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>News</source>
+ <translation>Wiadomości</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Home Office</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Option</source>
+ <translation>Opcje</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Paste</source>
+ <translation>Wklej</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Phone</source>
+ <translation>Telefon</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Reply</source>
+ <translation>Odpowiedz</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Reload</source>
+ <translation>Przeładuj</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Rotate Windows</source>
+ <translation>Obróć okna</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Rotation PB</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Rotation KB</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Save</source>
+ <translation>Zachowaj</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Send</source>
+ <translation>Wyślij</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Spellchecker</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Split Screen</source>
+ <translation>Podziel ekran</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Support</source>
+ <translation>Pomoc techniczna</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Task Panel</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Terminal</source>
+ <translation>Terminal</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Tools</source>
+ <translation>Narzędzia</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Travel</source>
+ <translation>Podróże</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Video</source>
+ <translation>Wideo</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Word Processor</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>XFer</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Zoom In</source>
+ <translation>Powiększ</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Zoom Out</source>
+ <translation>Pomniejsz</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Away</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Messenger</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>WebCam</source>
+ <translation>WebCam</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Mail Forward</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Pictures</source>
+ <translation>Zdjęcia</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Music</source>
+ <translation>Muzyka</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Battery</source>
+ <translation>Bateria</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Bluetooth</source>
+ <translation>Bluetooth</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Wireless</source>
+ <translation>Bezprzewodowy</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Ultra Wide Band</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Audio Forward</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Audio Repeat</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Audio Random Play</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Subtitle</source>
+ <translation>Napisy</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Audio Cycle Track</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Time</source>
+ <translation>Czas</translation>
+ </message>
+ <message>
+ <location line="+2"/>
+ <source>View</source>
+ <translation>Widok</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Top Menu</source>
+ <translation>Menu główne</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Suspend</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Hibernate</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+24"/>
<source>Context1</source>
<translation>Kontekst1</translation>
</message>
@@ -5338,23 +5804,23 @@ Proszę wybrać inną nazwę pliku.</translation>
<translation>Kontekst4</translation>
</message>
<message>
- <location line="+564"/>
+ <location line="+578"/>
<location line="+135"/>
<source>Ctrl</source>
<translation>Ctrl</translation>
</message>
<message>
- <location line="-784"/>
+ <location line="-890"/>
<source>Del</source>
<translation>Del</translation>
</message>
<message>
- <location line="+70"/>
+ <location line="+162"/>
<source>Delete</source>
<translation>Delete</translation>
</message>
<message>
- <location line="-61"/>
+ <location line="-153"/>
<source>Down</source>
<translation>Dół</translation>
</message>
@@ -5374,37 +5840,37 @@ Proszę wybrać inną nazwę pliku.</translation>
<translation>Esc</translation>
</message>
<message>
- <location line="+78"/>
+ <location line="+170"/>
<source>Escape</source>
<translation>Escape</translation>
</message>
<message>
- <location line="+732"/>
+ <location line="+746"/>
<source>F%1</source>
<translation>F%1</translation>
</message>
<message>
- <location line="-766"/>
+ <location line="-870"/>
<source>Favorites</source>
<translation>Ulubione</translation>
</message>
<message>
- <location line="+51"/>
+ <location line="+141"/>
<source>Flip</source>
<translation>Odwróć</translation>
</message>
<message>
- <location line="-68"/>
+ <location line="-158"/>
<source>Forward</source>
<translation>Do przodu</translation>
</message>
<message>
- <location line="+67"/>
+ <location line="+157"/>
<source>Hangup</source>
<translation>Zawieś</translation>
</message>
<message>
- <location line="-71"/>
+ <location line="-163"/>
<source>Help</source>
<translation>Pomoc</translation>
</message>
@@ -5414,22 +5880,22 @@ Proszę wybrać inną nazwę pliku.</translation>
<translation>Home</translation>
</message>
<message>
- <location line="+32"/>
+ <location line="+34"/>
<source>Home Page</source>
<translation>Strona startowa</translation>
</message>
<message>
- <location line="-37"/>
+ <location line="-39"/>
<source>Ins</source>
<translation>Ins</translation>
</message>
<message>
- <location line="+70"/>
+ <location line="+162"/>
<source>Insert</source>
<translation>Insert</translation>
</message>
<message>
- <location line="-26"/>
+ <location line="-116"/>
<source>Launch (0)</source>
<translation>Uruchom (0)</translation>
</message>
@@ -5519,14 +5985,14 @@ Proszę wybrać inną nazwę pliku.</translation>
<translation>Uruchom przeglądarkę mediów</translation>
</message>
<message>
- <location line="-36"/>
+ <location line="-38"/>
<source>Left</source>
<translation>Lewo</translation>
</message>
<message>
- <location line="+28"/>
+ <location line="+30"/>
<source>Media Next</source>
- <translation>Następna ścieżka </translation>
+ <translation>Następna ścieżka</translation>
</message>
<message>
<location line="-3"/>
@@ -5549,18 +6015,18 @@ Proszę wybrać inną nazwę pliku.</translation>
<translation>Zatrzymaj</translation>
</message>
<message>
- <location line="-17"/>
+ <location line="-19"/>
<source>Menu</source>
<translation>Menu</translation>
</message>
<message>
- <location line="+637"/>
+ <location line="+743"/>
<location line="+130"/>
<source>Meta</source>
<translation>Meta</translation>
</message>
<message>
- <location line="-704"/>
+ <location line="-718"/>
<source>No</source>
<translation>Nie</translation>
</message>
@@ -5575,17 +6041,17 @@ Proszę wybrać inną nazwę pliku.</translation>
<translation>Number Lock</translation>
</message>
<message>
- <location line="-54"/>
+ <location line="-146"/>
<source>NumLock</source>
<translation>NumLock</translation>
</message>
<message>
- <location line="+27"/>
+ <location line="+29"/>
<source>Open URL</source>
<translation>Otwórz adres</translation>
</message>
<message>
- <location line="+24"/>
+ <location line="+114"/>
<source>Page Down</source>
<translation>Strona do góry</translation>
</message>
@@ -5595,7 +6061,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<translation>Strona w dół</translation>
</message>
<message>
- <location line="-62"/>
+ <location line="-154"/>
<source>Pause</source>
<translation>Pauza</translation>
</message>
@@ -5612,20 +6078,20 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="-8"/>
<source>Print</source>
- <translation>Print</translation>
+ <translation>Wydrukuj</translation>
</message>
<message>
- <location line="+60"/>
+ <location line="+152"/>
<source>Print Screen</source>
<translation>Wydrukuj zawartość ekranu</translation>
</message>
<message>
- <location line="-40"/>
+ <location line="-130"/>
<source>Refresh</source>
<translation>Odśwież</translation>
</message>
<message>
- <location line="-25"/>
+ <location line="-27"/>
<source>Return</source>
<translation>Powrót</translation>
</message>
@@ -5635,38 +6101,39 @@ Proszę wybrać inną nazwę pliku.</translation>
<translation>Prawo</translation>
</message>
<message>
- <location line="+60"/>
+ <location line="+152"/>
<source>Scroll Lock</source>
<translation>Scroll Lock</translation>
</message>
<message>
- <location line="-54"/>
+ <location line="-146"/>
<source>ScrollLock</source>
<translation>ScrollLock</translation>
</message>
<message>
- <location line="+24"/>
+ <location line="+26"/>
<source>Search</source>
<translation>Szukaj</translation>
</message>
<message>
- <location line="+38"/>
+ <location line="+106"/>
+ <location line="+22"/>
<source>Select</source>
<translation>Wybierz</translation>
</message>
<message>
- <location line="+574"/>
+ <location line="+588"/>
<location line="+138"/>
<source>Shift</source>
<translation>Shift</translation>
</message>
<message>
- <location line="-796"/>
+ <location line="-902"/>
<source>Space</source>
<translation>Spacja</translation>
</message>
<message>
- <location line="+47"/>
+ <location line="+49"/>
<source>Standby</source>
<translation>Tryb oczekiwania</translation>
</message>
@@ -5676,22 +6143,22 @@ Proszę wybrać inną nazwę pliku.</translation>
<translation>Zatrzymaj</translation>
</message>
<message>
- <location line="-18"/>
+ <location line="-20"/>
<source>SysReq</source>
<translation>SysReq</translation>
</message>
<message>
- <location line="+69"/>
+ <location line="+161"/>
<source>System Request</source>
<translation>Żądanie systemu</translation>
</message>
<message>
- <location line="-78"/>
+ <location line="-170"/>
<source>Tab</source>
<translation>Tabulator</translation>
</message>
<message>
- <location line="+36"/>
+ <location line="+38"/>
<source>Treble Down</source>
<translation>Soprany w dół</translation>
</message>
@@ -5701,12 +6168,12 @@ Proszę wybrać inną nazwę pliku.</translation>
<translation>Soprany w górę</translation>
</message>
<message>
- <location line="-22"/>
+ <location line="-24"/>
<source>Up</source>
<translation>Góra</translation>
</message>
<message>
- <location line="+16"/>
+ <location line="+18"/>
<source>Volume Down</source>
<translation>Przycisz</translation>
</message>
@@ -5721,7 +6188,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<translation>Zrób głośniej</translation>
</message>
<message>
- <location line="+52"/>
+ <location line="+142"/>
<source>Yes</source>
<translation>Tak</translation>
</message>
@@ -5822,7 +6289,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<translation>Nieznany kod błędu (0x%1) pośrednika SOCKS wersji 5</translation>
</message>
<message>
- <location line="+685"/>
+ <location line="+689"/>
<source>Network operation timed out</source>
<translation>Przekroczony czas operacji sieciowej</translation>
</message>
@@ -5830,7 +6297,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<context>
<name>QSoftKeyManager</name>
<message>
- <location filename="../src/gui/kernel/qsoftkeymanager.cpp" line="+78"/>
+ <location filename="../src/gui/kernel/qsoftkeymanager.cpp" line="+79"/>
<source>Ok</source>
<translation>OK</translation>
</message>
@@ -5855,7 +6322,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<translation>Anuluj</translation>
</message>
<message>
- <location line="+151"/>
+ <location line="+176"/>
<source>Exit</source>
<translation>Wyjście</translation>
</message>
@@ -5958,7 +6425,12 @@ Proszę wybrać inną nazwę pliku.</translation>
<translation>Niepoprawna lub pusta lista szyfrów (%1)</translation>
</message>
<message>
- <location line="+62"/>
+ <location line="+42"/>
+ <source>Private key does not certify public key, %1</source>
+ <translation>Prywatny klucz nie uwiarygodnia publicznego, %1</translation>
+ </message>
+ <message>
+ <location line="+20"/>
<source>Error creating SSL session, %1</source>
<translation>Błąd tworzenia sesji SSL, %1</translation>
</message>
@@ -5983,15 +6455,125 @@ Proszę wybrać inną nazwę pliku.</translation>
<translation>Błąd ładowania prywatnego klucza, %1</translation>
</message>
<message>
- <location line="+7"/>
- <source>Private key does not certificate public key, %1</source>
- <translation>Prywatny klucz nie uwiarygodnia publicznego, %1</translation>
+ <location filename="../src/network/ssl/qsslerror.cpp" line="+213"/>
+ <source>No error</source>
+ <translation>Brak błędu</translation>
+ </message>
+ <message>
+ <location line="+3"/>
+ <source>The issuer certificate could not be found</source>
+ <translation>Nie można odnaleźć wydawcy certyfikatu</translation>
+ </message>
+ <message>
+ <location line="+3"/>
+ <source>The certificate signature could not be decrypted</source>
+ <translation>Nie można odszyfrować podpisu certyfikatu</translation>
+ </message>
+ <message>
+ <location line="+3"/>
+ <source>The public key in the certificate could not be read</source>
+ <translation>Nie można odczytać publicznego klucza w certyfikacie</translation>
+ </message>
+ <message>
+ <location line="+3"/>
+ <source>The signature of the certificate is invalid</source>
+ <translation>Niepoprawny podpis certyfikatu</translation>
+ </message>
+ <message>
+ <location line="+3"/>
+ <source>The certificate is not yet valid</source>
+ <translation>Certyfikat nie jest jeszcze ważny</translation>
+ </message>
+ <message>
+ <location line="+3"/>
+ <source>The certificate has expired</source>
+ <translation>Certyfikat utracił ważność</translation>
+ </message>
+ <message>
+ <location line="+3"/>
+ <source>The certificate&apos;s notBefore field contains an invalid time</source>
+ <translation>Pole &quot;notBefore&quot; certyfikatu zawiera niepoprawną datę</translation>
+ </message>
+ <message>
+ <location line="+3"/>
+ <source>The certificate&apos;s notAfter field contains an invalid time</source>
+ <translation>Pole &quot;notAfter&quot; certyfikatu zawiera niepoprawną datę</translation>
+ </message>
+ <message>
+ <location line="+3"/>
+ <source>The certificate is self-signed, and untrusted</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+3"/>
+ <source>The root certificate of the certificate chain is self-signed, and untrusted</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+3"/>
+ <source>The issuer certificate of a locally looked up certificate could not be found</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+3"/>
+ <source>No certificates could be verified</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+3"/>
+ <source>One of the CA certificates is invalid</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+3"/>
+ <source>The basicConstraints path length parameter has been exceeded</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+3"/>
+ <source>The supplied certificate is unsuitable for this purpose</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+3"/>
+ <source>The root CA certificate is not trusted for this purpose</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+3"/>
+ <source>The root CA certificate is marked to reject the specified purpose</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+3"/>
+ <source>The current candidate issuer certificate was rejected because its subject name did not match the issuer name of the current certificate</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+4"/>
+ <source>The current candidate issuer certificate was rejected because its issuer name and serial number was present and did not match the authority key identifier of the current certificate</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+5"/>
+ <source>The peer did not present any certificate</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+3"/>
+ <source>The host name did not match any of the valid hosts for this certificate</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+6"/>
+ <source>Unknown error</source>
+ <translation>Nieznany błąd</translation>
</message>
</context>
<context>
<name>QStateMachine</name>
<message>
- <location filename="../src/corelib/statemachine/qstatemachine.cpp" line="+998"/>
+ <location filename="../src/corelib/statemachine/qstatemachine.cpp" line="+1028"/>
<source>Missing initial state in compound state &apos;%1&apos;</source>
<translation>Brak stanu początkowego w stanie złożonym &apos;%1&apos;</translation>
</message>
@@ -6045,7 +6627,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<context>
<name>QTDSDriver</name>
<message>
- <location filename="../src/sql/drivers/tds/qsql_tds.cpp" line="+584"/>
+ <location filename="../src/sql/drivers/tds/qsql_tds.cpp" line="+595"/>
<source>Unable to open connection</source>
<translation>Nie można otworzyć połączenia</translation>
</message>
@@ -6079,7 +6661,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<context>
<name>QTextControl</name>
<message>
- <location filename="../src/gui/text/qtextcontrol.cpp" line="+2018"/>
+ <location filename="../src/gui/text/qtextcontrol.cpp" line="+2034"/>
<source>&amp;Copy</source>
<translation>S&amp;kopiuj</translation>
</message>
@@ -6179,7 +6761,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<context>
<name>QUnicodeControlCharacterMenu</name>
<message>
- <location filename="../src/gui/text/qtextcontrol.cpp" line="+933"/>
+ <location filename="../src/gui/text/qtextcontrol.cpp" line="+948"/>
<source>Insert Unicode control character</source>
<translation>Wstaw znak kontroli Unicode</translation>
</message>
@@ -6237,7 +6819,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<context>
<name>QWebFrame</name>
<message>
- <location filename="../src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp" line="+711"/>
+ <location filename="../src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp" line="+712"/>
<source>Request cancelled</source>
<translation>Prośba anulowana</translation>
</message>
@@ -6657,13 +7239,13 @@ Proszę wybrać inną nazwę pliku.</translation>
<location line="+2"/>
<source>Movie time scrubber</source>
<comment>Media controller element</comment>
- <translation type="unfinished"></translation>
+ <translation>Suwak czasu</translation>
</message>
<message>
<location line="+2"/>
<source>Movie time scrubber thumb</source>
<comment>Media controller element</comment>
- <translation type="unfinished"></translation>
+ <translation>Uchwyt suwaka czasu</translation>
</message>
<message>
<location line="+2"/>
@@ -6779,7 +7361,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<translation>Wizytator sieciowy - %2</translation>
</message>
<message>
- <location filename="../src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp" line="+406"/>
+ <location filename="../src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp" line="+416"/>
<source>Bad HTTP request</source>
<translation>Niepoprawna komenda HTTP</translation>
</message>
@@ -6883,7 +7465,7 @@ Proszę wybrać inną nazwę pliku.</translation>
</translation>
</message>
<message>
- <location filename="../src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp" line="+1708"/>
+ <location filename="../src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp" line="+1827"/>
<source>JavaScript Alert - %1</source>
<translation>Ostrzeżenie JavaScript - %1</translation>
</message>
@@ -6908,9 +7490,9 @@ Proszę wybrać inną nazwę pliku.</translation>
<translation>Skrypt na tej stronie nie działa poprawnie. Czy chcesz przerwać ten skrypt?</translation>
</message>
<message>
- <location line="+383"/>
+ <location line="+381"/>
<source>Move the cursor to the next character</source>
- <translation>Przesuń kursor do nastepnego znaku</translation>
+ <translation>Przesuń kursor do następnego znaku</translation>
</message>
<message>
<location line="+3"/>
@@ -6920,7 +7502,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="+3"/>
<source>Move the cursor to the next word</source>
- <translation>Przesuń kursor do nastepnego słowa</translation>
+ <translation>Przesuń kursor do następnego słowa</translation>
</message>
<message>
<location line="+3"/>
@@ -6930,7 +7512,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="+3"/>
<source>Move the cursor to the next line</source>
- <translation>Przesuń kursor do nastepnej linii</translation>
+ <translation>Przesuń kursor do następnej linii</translation>
</message>
<message>
<location line="+3"/>
@@ -7080,7 +7662,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="+4"/>
<source>Insert Bulleted List</source>
- <translation>Wstaw listę wypunktową</translation>
+ <translation>Wstaw listę wypunktowaną</translation>
</message>
<message>
<location line="+4"/>
@@ -7129,7 +7711,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<context>
<name>QWidget</name>
<message>
- <location filename="../src/gui/kernel/qwidget.cpp" line="+5672"/>
+ <location filename="../src/gui/kernel/qwidget.cpp" line="+5723"/>
<source>*</source>
<translation>*</translation>
</message>
@@ -7557,7 +8139,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="+274"/>
<source>The standalone pseudo attribute must appear after the encoding.</source>
- <translation>Pseudo atrybut &quot;standalone&quot; musi pojawić sie po &quot;encoding&quot;.</translation>
+ <translation>Pseudo atrybut &quot;standalone&quot; musi pojawić się po &quot;encoding&quot;.</translation>
</message>
<message>
<location filename="../src/corelib/xml/qxmlstream_p.h" line="+562"/>
@@ -7752,17 +8334,22 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="+32"/>
<source>A positional predicate must evaluate to a single numeric value.</source>
- <translation>Wynikiem predykatu pozycyjnego musi być pojedyńcza wartość liczbowa.</translation>
+ <translation>Wynikiem predykatu pozycyjnego musi być pojedyncza wartość liczbowa.</translation>
</message>
<message>
- <location filename="../src/xmlpatterns/expr/qncnameconstructor_p.h" line="+137"/>
+ <location filename="../src/xmlpatterns/expr/qncnameconstructor_p.h" line="+113"/>
+ <source>The target name in a processing instruction cannot be %1 in any combination of upper and lower case. Therefore, %2 is invalid.</source>
+ <translation>Docelowa nazwa w instrukcji przetwarzania nie może być %1 w żadnej kombinacji wielkich i małych liter. Dlatego nazwa %2 jest niepoprawna.</translation>
+ </message>
+ <message>
+ <location line="+24"/>
<source>%1 is not a valid target name in a processing instruction. It must be a %2 value, e.g. %3.</source>
<translation>%1 nie jest poprawną nazwą docelową w instrukcji przetwarzania. Nazwa musi być wartością %2, np. %3.</translation>
</message>
<message>
<location filename="../src/xmlpatterns/expr/qpath.cpp" line="+109"/>
<source>The last step in a path must contain either nodes or atomic values. It cannot be a mixture between the two.</source>
- <translation>Ostatni krok w ścieżce musi zawierać albo wezły albo wartości atomowe. Nie może zawierać obu jednocześnie.</translation>
+ <translation>Ostatni krok w ścieżce musi zawierać albo węzły albo wartości atomowe. Nie może zawierać obu jednocześnie.</translation>
</message>
<message>
<location filename="../src/xmlpatterns/expr/qprocessinginstructionconstructor.cpp" line="+84"/>
@@ -7818,7 +8405,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location filename="../src/xmlpatterns/functions/qpatternmatchingfns.cpp" line="+94"/>
<source>%1 must be followed by %2 or %3, not at the end of the replacement string.</source>
- <translation>Po %1 musi następowac %2 lub %3, lecz nie na końcu zastępczego ciągu.</translation>
+ <translation>Po %1 musi następować %2 lub %3, lecz nie na końcu zastępczego ciągu.</translation>
</message>
<message>
<location line="+39"/>
@@ -7907,7 +8494,12 @@ Proszę wybrać inną nazwę pliku.</translation>
<translation>%1 jest nieznanym typem schematu.</translation>
</message>
<message>
- <location line="-7041"/>
+ <location line="-7254"/>
+ <source>A template with name %1 has already been declared.</source>
+ <translation>Szablon o nazwie %1 został już zadeklarowany.</translation>
+ </message>
+ <message>
+ <location line="+213"/>
<source>Only one %1 declaration can occur in the query prolog.</source>
<translation>Tylko jedna deklaracja %1 może się pojawić w prologu zapytania.</translation>
</message>
@@ -7962,12 +8554,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<translation>Cecha &quot;Import modułu&quot; nie jest obsługiwana</translation>
</message>
<message>
- <location line="+52"/>
- <source>No value is available for the external variable by name %1.</source>
- <translation>Brak wartości dla zewnętrznej zmiennej o nazwie %1.</translation>
- </message>
- <message>
- <location line="+114"/>
+ <location line="+166"/>
<source>The namespace %1 is reserved; therefore user defined functions may not use it. Try the predefined prefix %2, which exists for these cases.</source>
<translation>Przestrzeń nazw %1 jest zarezerwowana, dlatego funkcje zdefiniowane przez użytkownika nie mogą jej użyć. Spróbuj predefiniowany przedrostek %2, który istnieje w takich przypadkach.</translation>
</message>
@@ -7987,12 +8574,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<translation>Zewnętrzne funkcje nie są obsługiwane. Wszystkie obsługiwane funkcje mogą być używane bezpośrednio, bez ich uprzedniego deklarowania jako zewnętrzne</translation>
</message>
<message>
- <location line="+37"/>
- <source>An argument by name %1 has already been declared. Every argument name must be unique.</source>
- <translation>Argument o nazwie %1 został już zadeklarowany. Każda nazwa argumentu musi być unikatowa.</translation>
- </message>
- <message>
- <location line="+456"/>
+ <location line="+493"/>
<source>The name of a variable bound in a for-expression must be different from the positional variable. Hence, the two variables named %1 collide.</source>
<translation>Nazwa zmiennej powiązanej w wyrażeniu &quot;for&quot; musi być inna od zmiennej pozycjonującej. W związku z tym dwie zmienne o nazwie %1 kolidują ze sobą.</translation>
</message>
@@ -8019,12 +8601,12 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="-152"/>
<source>W3C XML Schema identity constraint selector</source>
- <translation>Selektor ograniczenia jednostki W3C XML Schema</translation>
+ <translation>Selektor narzucenia niepowtarzalności W3C XML Schema</translation>
</message>
<message>
<location line="+3"/>
<source>W3C XML Schema identity constraint field</source>
- <translation>Pole ograniczenia jednostki W3C XML Schema</translation>
+ <translation>Pole narzucenia niepowtarzalności W3C XML Schema</translation>
</message>
<message>
<location line="+4"/>
@@ -8032,37 +8614,37 @@ Proszę wybrać inną nazwę pliku.</translation>
<translation>Wystąpiła konstrukcja która jest niedozwolona w bieżącym języku (%1).</translation>
</message>
<message>
- <location line="+583"/>
- <source>No variable by name %1 exists</source>
- <translation>Zmienna o nazwie %1 nie istnieje</translation>
- </message>
- <message>
- <location line="-464"/>
- <source>A template by name %1 has already been declared.</source>
- <translation>Szablon o nazwie %1 został już zadeklarowany.</translation>
+ <location line="+3700"/>
+ <source>The keyword %1 cannot occur with any other mode name.</source>
+ <translation>Słowo kluczowe %1 nie może wystąpić z inną nazwą trybu.</translation>
</message>
<message>
- <location line="+3581"/>
- <source>The keyword %1 cannot occur with any other mode name.</source>
- <translation>Słowo kluczowe %1 nie może wystapić z inną nazwą trybu.</translation>
+ <location line="-3117"/>
+ <source>No variable with name %1 exists</source>
+ <translation>Zmienna o nazwie %1 nie istnieje</translation>
</message>
<message>
- <location line="+29"/>
- <source>The value of attribute %1 must of type %2, which %3 isn&apos;t.</source>
+ <location line="+3146"/>
+ <source>The value of attribute %1 must be of type %2, which %3 isn&apos;t.</source>
<translation>Wartość atrybutu %1 musi być typu %2, którym nie jest %3.</translation>
</message>
<message>
<location line="+75"/>
- <source>The prefix %1 can not be bound. By default, it is already bound to the namespace %2.</source>
+ <source>The prefix %1 cannot be bound. By default, it is already bound to the namespace %2.</source>
<translation>Przedrostek %1 nie może być powiązany. Jest on domyślnie powiązany z przestrzenią nazw %2.</translation>
</message>
<message>
<location line="+312"/>
- <source>A variable by name %1 has already been declared.</source>
+ <source>A variable with name %1 has already been declared.</source>
<translation>Zmienna o nazwie %1 została już zadeklarowana.</translation>
</message>
<message>
- <location line="+135"/>
+ <location line="+39"/>
+ <source>No value is available for the external variable with name %1.</source>
+ <translation>Brak wartości dla zewnętrznej zmiennej o nazwie %1.</translation>
+ </message>
+ <message>
+ <location line="+96"/>
<source>A stylesheet function must have a prefixed name.</source>
<translation>Funkcja arkusza stylu musi zawierać nazwę z przedrostkiem.</translation>
</message>
@@ -8072,7 +8654,12 @@ Proszę wybrać inną nazwę pliku.</translation>
<translation>Przestrzeń nazw dla funkcji zdefiniowanej przez użytkownika nie może być pusta (spróbuj predefiniowany przedrostek %1, który stworzono specjalnie do takich sytuacji)</translation>
</message>
<message>
- <location line="+294"/>
+ <location line="+115"/>
+ <source>An argument with name %1 has already been declared. Every argument name must be unique.</source>
+ <translation>Argument o nazwie %1 został już zadeklarowany. Każda nazwa argumentu musi być unikatowa.</translation>
+ </message>
+ <message>
+ <location line="+179"/>
<source>When function %1 is used for matching inside a pattern, the argument must be a variable reference or a string literal.</source>
<translation>Gdy funkcja %1 jest wykorzystana do dopasowania wewnątrz wzorca, jej argument musi być referencją do zmiennej lub napisem.</translation>
</message>
@@ -8113,11 +8700,16 @@ Proszę wybrać inną nazwę pliku.</translation>
</message>
<message>
<location line="+462"/>
- <source>No function by name %1 is available.</source>
+ <source>No function with name %1 is available.</source>
<translation>Żadna funkcja o nazwie %1 nie jest dostępna.</translation>
</message>
<message>
- <location line="+102"/>
+ <location line="+250"/>
+ <source>An attribute with name %1 has already appeared on this element.</source>
+ <translation>Atrybut o nazwie %1 już się pojawił w tym elemencie.</translation>
+ </message>
+ <message>
+ <location line="-148"/>
<source>The namespace URI cannot be the empty string when binding to a prefix, %1.</source>
<translation>Przestrzeń nazw URI nie może być pustym ciągiem w powiązaniu z przedrostkiem, %1.</translation>
</message>
@@ -8152,12 +8744,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<translation>Przestrzeń nazw URI nie może być stałą i nie może używać zawartych w niej wyrażeń.</translation>
</message>
<message>
- <location line="+16"/>
- <source>An attribute by name %1 has already appeared on this element.</source>
- <translation>Atrybut o nazwie %1 już się pojawił w tym elemencie.</translation>
- </message>
- <message>
- <location line="+61"/>
+ <location line="+77"/>
<source>A direct element constructor is not well-formed. %1 is ended with %2.</source>
<translation>Konstruktor elementu bezpośredniego nie jest dobrze sformatowany. %1 jest zakończony %2.</translation>
</message>
@@ -8262,11 +8849,6 @@ Proszę wybrać inną nazwę pliku.</translation>
<source>Modulus division (%1) by zero (%2) is undefined.</source>
<translation>Dzielenie modulo (%1) przez zero (%2) jest niezdefiniowane.</translation>
</message>
- <message>
- <location filename="../src/xmlpatterns/expr/qncnameconstructor_p.h" line="-24"/>
- <source>The target name in a processing instruction cannot be %1 in any combination of upper and lower case. Therefore, is %2 invalid.</source>
- <translation>Docelowa nazwa w instrukcji przetwarzania nie może być %1 w żadnej kombinacji wielkich i małych liter. Dlatego nazwa %2 jest niepoprawna.</translation>
- </message>
<message numerus="yes">
<location filename="../src/xmlpatterns/functions/qabstractfunctionfactory.cpp" line="+77"/>
<source>%1 takes at most %n argument(s). %2 is therefore invalid.</source>
@@ -8409,7 +8991,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="+166"/>
<source>In a simplified stylesheet module, attribute %1 must be present.</source>
- <translation>W uproszczonym module arkuszu stylu musi wystapić atrybut %1.</translation>
+ <translation>W uproszczonym module arkuszu stylu musi wystąpić atrybut %1.</translation>
</message>
<message>
<location line="+72"/>
@@ -8419,7 +9001,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="+9"/>
<source>Element %1 must have at least one of the attributes %2 or %3.</source>
- <translation>Element %1 musi posiadać przynajmiej jeden z atrybutów: %2 lub %3.</translation>
+ <translation>Element %1 musi posiadać przynajmniej jeden z atrybutów: %2 lub %3.</translation>
</message>
<message>
<location line="+28"/>
@@ -8531,12 +9113,12 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="+25"/>
<source>%1 is not allowed to derive from %2 by restriction as the latter defines it as final.</source>
- <translation>Nie można wywieść %1 z %2 ograniczając go ponieważ jest on zdefiniowany jako ostateczny.</translation>
+ <translation>Nie można wywieść %1 z %2 ograniczając go ponieważ jest on zdefiniowany jako końcowy.</translation>
</message>
<message>
<location line="+5"/>
<source>%1 is not allowed to derive from %2 by extension as the latter defines it as final.</source>
- <translation>Nie można wywieść %1 z %2 rozszerzając go ponieważ jest on zdefiniowany jako ostateczny.</translation>
+ <translation>Nie można wywieść %1 z %2 rozszerzając go ponieważ jest on zdefiniowany jako końcowy.</translation>
</message>
<message>
<location line="+31"/>
@@ -8562,13 +9144,13 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="+6"/>
<source>Simple type %1 cannot derive from %2 as the latter defines restriction as final.</source>
- <translation>Typ prosty %1 nie może wywodzić się z %2 ponieważ ten ostatni jest zdefiniowany jako ostateczny.</translation>
+ <translation>Typ prosty %1 nie może wywodzić się z %2 ponieważ ten ostatni jest zdefiniowany jako końcowy.</translation>
</message>
<message>
<location line="+13"/>
<location line="+484"/>
<source>Variety of item type of %1 must be either atomic or union.</source>
- <translation>Typem elementu %1 musi być albo typ atomowy albo unia.</translation>
+ <translation>Typem elementów listy %1 musi być albo typ atomowy albo unia.</translation>
</message>
<message>
<location line="-474"/>
@@ -8595,12 +9177,12 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="+6"/>
<source>Base type of simple type %1 has defined derivation by restriction as final.</source>
- <translation>Typ podstawowy dla typu prostego %1 ma zdefiniowane wywodzenie poprzez ograniczenie jako ostateczne.</translation>
+ <translation>Typ podstawowy dla typu prostego %1 ma zdefiniowane wywodzenie poprzez ograniczenie jako końcowe.</translation>
</message>
<message>
<location line="+6"/>
<source>Item type of base type does not match item type of %1.</source>
- <translation>Typ elementu w podstawowym typie nie pasuje do typu %1.</translation>
+ <translation>Typ elementów listy typu podstawowego nie pasuje do typu elementów listy %1.</translation>
</message>
<message>
<location line="+26"/>
@@ -8657,7 +9239,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="+37"/>
<source>Content model of complex type %1 is not a valid extension of content model of %2.</source>
- <translation>Model zawartości typu złożonego %1 nie jest poprawnym rozszerzenien modelu zawartości %2.</translation>
+ <translation>Model zawartości typu złożonego %1 nie jest poprawnym rozszerzeniem modelu zawartości %2.</translation>
</message>
<message>
<location line="+10"/>
@@ -8687,7 +9269,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="+35"/>
<source>Item type of simple type %1 cannot be a complex type.</source>
- <translation>Typ elementu w prostym typie %1 nie może być typem złożonym.</translation>
+ <translation>Typ elementów listy w prostym typie %1 nie może być typem złożonym.</translation>
</message>
<message>
<location line="+44"/>
@@ -8731,7 +9313,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="-389"/>
<source>%1 facet contains invalid regular expression</source>
- <translation>Aspekt %1 zawiera niepoprawe wyrażenie regularne</translation>
+ <translation>Aspekt %1 zawiera niepoprawne wyrażenie regularne</translation>
</message>
<message>
<location line="+15"/>
@@ -8902,7 +9484,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="+18"/>
<source>processContent of base wildcard must be weaker than derived wildcard.</source>
- <translation>&quot;processContent&quot; podstawowego znacznika musi być słabszy od wywiedzionego znacznika.</translation>
+ <translation>&quot;processContent&quot; podstawowego dżokera musi być słabszy od wywiedzionego dżokera.</translation>
</message>
<message>
<location line="+39"/>
@@ -8913,7 +9495,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="+28"/>
<source>Particle contains non-deterministic wildcards.</source>
- <translation>Element zawiera nieokreślone znaczniki.</translation>
+ <translation>Element zawiera nieokreślone dżokery.</translation>
</message>
<message>
<location filename="../src/xmlpatterns/schema/qxsdschemahelper.cpp" line="+691"/>
@@ -8933,13 +9515,13 @@ Proszę wybrać inną nazwę pliku.</translation>
</message>
<message>
<location line="+5"/>
- <source>Derived attribute %1 does not exists in the base definition.</source>
- <translation>Wywyiedziony atrybut %1 nie istnieje w podstawowej definicji.</translation>
+ <source>Derived attribute %1 does not exist in the base definition.</source>
+ <translation>Wywiedziony atrybut %1 nie istnieje w podstawowej definicji.</translation>
</message>
<message>
<location line="+11"/>
<source>Derived attribute %1 does not match the wildcard in the base definition.</source>
- <translation>Wywiedziony atrybut %1 nie pasuje do znacznika w podstawowej definicji.</translation>
+ <translation>Wywiedziony atrybut %1 nie pasuje do dżokera w podstawowej definicji.</translation>
</message>
<message>
<location line="+17"/>
@@ -8954,12 +9536,12 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="+5"/>
<source>Derived wildcard is not a subset of the base wildcard.</source>
- <translation>Wywiedziony znacznik nie jest podzbiorem podstawowego znacznika.</translation>
+ <translation>Wywiedziony dżoker nie jest podzbiorem podstawowego dżokera.</translation>
</message>
<message>
<location line="+5"/>
<source>%1 of derived wildcard is not a valid restriction of %2 of base wildcard</source>
- <translation>%1 wywiedzionego znacznika nie jest poprawnym ograniczeniem %2 podstawowego znacznika</translation>
+ <translation>%1 wywiedzionego dżokera nie jest poprawnym ograniczeniem %2 podstawowego dżokera</translation>
</message>
<message>
<location line="+23"/>
@@ -8984,12 +9566,12 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="+10"/>
<source>%1 references identity constraint %2 that is no %3 or %4 element.</source>
- <translation>%1 odwołuje się do ograniczenia jednostki %2 które nie jest elementem %3 ani %4.</translation>
+ <translation>%1 odwołuje się do narzucenia niepowtarzalności %2 które nie jest elementem %3 ani %4.</translation>
</message>
<message>
<location line="+10"/>
<source>%1 has a different number of fields from the identity constraint %2 that it references.</source>
- <translation>%1 posiada inna liczbę pól od ograniczenia jednostki %2 które się do niego odwołuje.</translation>
+ <translation>%1 posiada inna liczbę pól od narzucenia niepowtarzalności %2 które się do niego odwołuje.</translation>
</message>
<message>
<location line="+23"/>
@@ -8999,7 +9581,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="+84"/>
<source>Item type %1 of %2 element cannot be resolved.</source>
- <translation>Nie można rozwiązać typu elementu %1 w elemencie %2.</translation>
+ <translation>Nie można rozwiązać typu elementów listy %1 w elemencie %2.</translation>
</message>
<message>
<location line="+31"/>
@@ -9100,17 +9682,17 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="+52"/>
<source>Attribute wildcard of %1 is not a valid restriction of attribute wildcard of base type %2.</source>
- <translation>Znacznik atrybutu %1 nie jest poprawnym ograniczeniem znacznika atrybutu typu podstawowego %2.</translation>
+ <translation>Atrybut dżokera %1 nie jest poprawnym ograniczeniem atrybutu dżokera typu podstawowego %2.</translation>
</message>
<message>
<location line="+7"/>
<source>%1 has attribute wildcard but its base type %2 has not.</source>
- <translation>%1 posiada znacznik atrybutu lecz jego typ podstawowy %2 go nie posiada.</translation>
+ <translation>%1 posiada atrybut dżokera lecz jego typ podstawowy %2 go nie posiada.</translation>
</message>
<message>
<location line="+26"/>
<source>Union of attribute wildcard of type %1 and attribute wildcard of its base type %2 is not expressible.</source>
- <translation>Nie można wyrazić unii znacznika atrybutu typu %1 i znacznika atrybutu jego typu podstawowego %2.</translation>
+ <translation>Nie można wyrazić unii atrybutu dżokera typu %1 i atrybutu dżokera jego typu podstawowego %2.</translation>
</message>
<message>
<location line="+48"/>
@@ -9181,17 +9763,17 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="+18"/>
<source>Element %1 does not match namespace constraint of wildcard in base particle.</source>
- <translation>Element %1 nie pasuje do znacznika w ograniczeniu przestrzeni nazw w elemencie podstawowym.</translation>
+ <translation>Element %1 nie pasuje do ograniczenia przestrzeni nazw dżokera w elemencie podstawowym.</translation>
</message>
<message>
<location line="+11"/>
<source>Wildcard in derived particle is not a valid subset of wildcard in base particle.</source>
- <translation>Znacznik w wywiedzionym elemencie nie jest poprawnym podzbiorem znacznika w elemencie podstawowym.</translation>
+ <translation>Dżoker w wywiedzionym elemencie nie jest poprawnym podzbiorem dżokera w elemencie podstawowym.</translation>
</message>
<message>
<location line="+5"/>
<source>processContent of wildcard in derived particle is weaker than wildcard in base particle.</source>
- <translation>&quot;processContent&quot; znacznika w wywiedzionym elemencie jest słabszy od znacznika w podstawowym elemencie.</translation>
+ <translation>&quot;processContent&quot; dżokera w wywiedzionym elemencie jest słabszy od dżokera w podstawowym elemencie.</translation>
</message>
<message>
<location line="+240"/>
@@ -9385,7 +9967,7 @@ Proszę wybrać inną nazwę pliku.</translation>
</message>
<message>
<location line="+131"/>
- <source>Component with id %1 has been defined previously.</source>
+ <source>Component with ID %1 has been defined previously.</source>
<translation>Komponent o identyfikatorze %1 został uprzednio zdefiniowany.</translation>
</message>
<message>
@@ -9421,7 +10003,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="+11"/>
<source>Identity constraint %1 already defined.</source>
- <translation>Ograniczenie jednostki %1 jest już zdefiniowane.</translation>
+ <translation>Narzucenie niepowtarzalności %1 jest już zdefiniowane.</translation>
</message>
<message>
<location line="+11"/>
@@ -9800,11 +10382,16 @@ Proszę wybrać inną nazwę pliku.</translation>
</message>
<message>
<location line="+6"/>
- <source>Fixed value constrained not allowed if element is nillable.</source>
+ <source>Fixed value constraint not allowed if element is nillable.</source>
<translation>Ograniczenie stałej wartości jest niedozwolone gdy element jest zerowalny.</translation>
</message>
<message>
- <location line="+32"/>
+ <location line="+230"/>
+ <source>Element %1 cannot contain other elements, as it has a fixed content.</source>
+ <translation>Element %1 nie może zawierać innych elementów ponieważ posiada on stałą zawartość.</translation>
+ </message>
+ <message>
+ <location line="-198"/>
<source>Specified type %1 is not validly substitutable with element type %2.</source>
<translation>Podany typ %1 nie jest poprawnie zastępowalny typem elementu %2.</translation>
</message>
@@ -9848,19 +10435,14 @@ Proszę wybrać inną nazwę pliku.</translation>
<translation>Element %1 zawiera niedozwolony text.</translation>
</message>
<message>
- <location line="+18"/>
- <source>Element %1 can not contain other elements, as it has a fixed content.</source>
- <translation>Element %1 nie może zawierać innych elementów ponieważ posiada on stałą zawartość.</translation>
- </message>
- <message>
- <location line="+43"/>
+ <location line="+61"/>
<source>Element %1 is missing required attribute %2.</source>
<translation>Brak wymaganego atrybutu %2 w elemencie %1.</translation>
</message>
<message>
<location line="+29"/>
<source>Attribute %1 does not match the attribute wildcard.</source>
- <translation>Atrybut %1 nie pasuje do znacznika atrybutu.</translation>
+ <translation>Atrybut %1 nie pasuje do atrybutu dżokera.</translation>
</message>
<message>
<location line="+9"/>
@@ -9912,7 +10494,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="+40"/>
<source>No referenced value found for key reference %1.</source>
- <translation>Brak wartości do której odwołuje sie klucz %1.</translation>
+ <translation>Brak wartości do której odwołuje się klucz %1.</translation>
</message>
<message>
<location line="+64"/>
diff --git a/translations/qvfb_pl.ts b/translations/qvfb_pl.ts
index bc3313e..9b85ad9 100644
--- a/translations/qvfb_pl.ts
+++ b/translations/qvfb_pl.ts
@@ -4,7 +4,7 @@
<context>
<name>AnimationSaveWidget</name>
<message>
- <location filename="../tools/qvfb/qvfb.cpp" line="+865"/>
+ <location filename="../tools/qvfb/qvfb.cpp" line="+868"/>
<location line="+204"/>
<source>Record</source>
<translation>Nagraj</translation>
@@ -260,6 +260,11 @@
<source>BGR format</source>
<translation>format BGR</translation>
</message>
+ <message>
+ <location/>
+ <source>800x480</source>
+ <translation>800x480</translation>
+ </message>
</context>
<context>
<name>DeviceSkin</name>
@@ -322,12 +327,12 @@
<context>
<name>QVFb</name>
<message>
- <location filename="../tools/qvfb/qvfb.cpp" line="-501"/>
+ <location filename="../tools/qvfb/qvfb.cpp" line="-504"/>
<source>Browse...</source>
<translation>Przeglądaj...</translation>
</message>
<message>
- <location line="+140"/>
+ <location line="+143"/>
<source>Load Custom Skin...</source>
<translation>Załaduj skórki użytkownika...</translation>
</message>
diff --git a/util/s60pixelmetrics/pm_mapper.hrh b/util/s60pixelmetrics/pm_mapper.hrh
index 4822654..f46a963 100644
--- a/util/s60pixelmetrics/pm_mapper.hrh
+++ b/util/s60pixelmetrics/pm_mapper.hrh
@@ -55,16 +55,9 @@ enum
{
ECmdStartCalculations = 8500,
ECmdSwitchOrientation,
- ECmdSwitchMirroring,
ECmdStatus,
ECmdSwitchOutput,
- ECmdCreateHeaderFile,
- ECmdSetAutoMode
- };
-
-enum
- {
- EWaitNote = 9000
+ ECmdCreateHeaderFile
};
#endif // PMMAPPER_HRH
diff --git a/util/s60pixelmetrics/pm_mapper.rss b/util/s60pixelmetrics/pm_mapper.rss
index 22817ad..8071b44 100644
--- a/util/s60pixelmetrics/pm_mapper.rss
+++ b/util/s60pixelmetrics/pm_mapper.rss
@@ -150,11 +150,9 @@ RESOURCE MENU_PANE r_pmmapper_system_menu
{
MENU_ITEM { command = ECmdStartCalculations; txt = "Start calculations"; },
MENU_ITEM { command = ECmdSwitchOrientation; txt = "Switch orientation"; },
- MENU_ITEM { command = ECmdSwitchMirroring; txt = "Switch mirroring";},
MENU_ITEM { command = ECmdStatus; txt = "Status"; },
MENU_ITEM { command = ECmdSwitchOutput; txt = "Switch output (file/screen)"; },
- MENU_ITEM { command = ECmdCreateHeaderFile; txt = "Create header file"; },
- MENU_ITEM { command = ECmdSetAutoMode; txt = "Switch autoMode";}
+ MENU_ITEM { command = ECmdCreateHeaderFile; txt = "Create header file"; }
};
}
diff --git a/util/s60pixelmetrics/pm_mapperapp.cpp b/util/s60pixelmetrics/pm_mapperapp.cpp
index de6af0d..19d3b36 100644
--- a/util/s60pixelmetrics/pm_mapperapp.cpp
+++ b/util/s60pixelmetrics/pm_mapperapp.cpp
@@ -65,7 +65,6 @@
#include <aknglobalnote.h>
#include <CentralRepository.h>
-#include <AvkonInternalCRKeys.h> // KAknLayoutId
#include <Aknsutils.h>
#include <AknUtils.h>
@@ -89,7 +88,7 @@ _LIT(KEndBraceWithCommaAndCRLF, "},\n");
_LIT(KCRLF, "\n");
// Number of header lines in layout data.
-const TInt KHeaderValues = 5;
+const TInt KHeaderValues = 4;
// ============================ MEMBER FUNCTIONS ===============================
@@ -156,37 +155,27 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand )
Exit();
break;
case ECmdSwitchOutput:
+ {
+ HBufC* buffer = HBufC::NewLC( 100 );
+ TPtr bufferPtr = buffer->Des();
+ TBool last = ETrue;
+ bufferPtr.Append(_L("Output switched to "));
iFileOutputOn = !iFileOutputOn;
+ if (iFileOutputOn)
+ bufferPtr.Append(_L("file."));
+ else
+ bufferPtr.Append(_L("screen."));
+ ShowL( *buffer, last );
+ }
break;
case ECmdStatus:
{
ClearL();
// layout
- CRepository* repository = NULL;
- TInt value = KErrNotFound;
- TRAPD(ret, repository = CRepository::NewL(KCRUidAvkon));
- if (ret == KErrNone)
- {
- ret = repository->Get(KAknLayoutId, value);
- }
- delete repository;
- ret= 0;
HBufC* buffer = HBufC::NewLC( 100 );
TPtr bufferPtr = buffer->Des();
- bufferPtr.Append(_L("Layout: "));
- if (ret==KErrNone)
- {
- bufferPtr.AppendNum(value);
- }
- else
- {
- bufferPtr.Append(_L("(error) "));
- bufferPtr.AppendNum(ret);
- }
TBool last = ETrue;
- ShowL( *buffer, last );
- bufferPtr.Zero();
// Orientation
bufferPtr.Append(_L("Orientation: "));
@@ -201,12 +190,6 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand )
ShowL( *buffer, last );
bufferPtr.Zero();
- // Automode
- bufferPtr.Append(_L("AutoMode: "));
- bufferPtr.AppendNum((TInt)iAutoMode);
- ShowL( *buffer, last );
- bufferPtr.Zero();
-
CAknLayoutConfig::TScreenMode localAppScreenMode = CAknSgcClient::ScreenMode();
TInt hashValue = localAppScreenMode.ScreenStyleHash();
TPixelsTwipsAndRotation pixels = CAknSgcClient::PixelsAndRotation();
@@ -261,47 +244,24 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand )
CleanupStack::PopAndDestroy( buffer );
}
break;
- case ECmdSwitchMirroring:
- {
- // set the shared data value
- CRepository* repository = NULL;
- TRAPD(ret, repository = CRepository::NewL(KCRUidAvkon));
- if (ret == KErrNone)
- {
- TInt value = KErrNotFound;
- repository->Get(KAknLayoutId, value);
- if ( value == EAknLayoutIdELAF)
- {
- value = EAknLayoutIdABRW;
- }
- else if (value ==EAknLayoutIdABRW)
- {
- value = EAknLayoutIdELAF;
- }
- ret = repository->Set(KAknLayoutId, value);
- }
- delete repository;
- // now inform all open apps of the switch
- TWsEvent event;
- event.SetType(KEikDynamicLayoutVariantSwitch);
- iEikonEnv->WsSession().SendEventToAllWindowGroups(event);
- }
- break;
case ECmdSwitchOrientation:
{
ClearL();
+ HBufC* buffer = HBufC::NewLC( 100 );
+ TPtr bufferPtr = buffer->Des();
+ TBool last = ETrue;
+
#ifndef __SERIES60_31__
if (!iAvkonAppUi->OrientationCanBeChanged())
{
- HBufC* buffer = HBufC::NewLC( 100 );
- TPtr bufferPtr = buffer->Des();
bufferPtr.Append(_L("Orientation cannot be changed."));
- TBool last = EFalse;
ShowL( *buffer, last );
bufferPtr.Zero();
delete buffer;
+ break;
}
#endif //__SERIES60_31__
+
if ( iAvkonAppUi->Orientation() == CAknAppUiBase::EAppUiOrientationPortrait)
{
iAvkonAppUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationLandscape);
@@ -314,15 +274,11 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand )
{
// unspecified
iAvkonAppUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationLandscape);
- /*User::After(100000);
- HBufC* buffer = HBufC::NewLC( 100 );
- TPtr bufferPtr = buffer->Des();
- bufferPtr.Append(_L("Orientation unspecified."));
- TBool last = EFalse;
- ShowL( *buffer, last );
- bufferPtr.Zero();
- delete buffer;*/
}
+ bufferPtr.Append(_L("Orientation changed."));
+ ShowL( *buffer, last );
+ bufferPtr.Zero();
+ delete buffer;
break;
}
case ECmdStartCalculations:
@@ -362,12 +318,6 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand )
tgt.AppendNum(version.minorVersion, EDecimal); // put minor version into text file
ShowL( tgt, last );
tgt.Zero();
- // MIRRORED
- TBool mirrored = AknLayoutUtils::LayoutMirrored();
- tgt.Append(_L("mirrored: \t"));
- tgt.AppendNum(mirrored, EDecimal); // put mirrored state into text file
- ShowL( tgt, last );
- tgt.Zero();
}
TInt myValue = KErrNotFound;
@@ -385,33 +335,15 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand )
if (index==QStyle::PM_SubMenuOverlap) index = QStyle::PM_CustomBase;
index++;
}
- if (iAutoMode && !iMode)
- {
- HandleCommandL(ECmdSwitchMirroring);
- iMode = ETrue;
- }
}
break;
case ECmdCreateHeaderFile:
CreateHeaderFileL();
break;
- case ECmdSetAutoMode:
- iAutoMode = !iAutoMode;
default:
break;
}
}
-void CPixelMetricsMapperAppUi::DoAutoOperationL()
- {
- HandleCommandL(ECmdStartCalculations);
- iMode = EFalse;
- HandleCommandL(ECmdSwitchMirroring);
- }
-
-TBool CPixelMetricsMapperAppUi::ReadyForAutoOp() const
- {
- return (iAutoMode && iMode);
- }
// -----------------------------------------------------------------------------
//
@@ -834,21 +766,7 @@ void CPixelMetricsMapperAppUi::CreateHeaderFileL() const
User::LeaveIfError( lex.Val(nextValue) );
if ( loop <= KHeaderValues-1)
{
- if (loop == KHeaderValues -1 ) // true / false values
- {
- if (nextValue == 1)
- {
- bufferLayoutHdr.Append(_L("true"));
- }
- else
- {
- bufferLayoutHdr.Append(_L("false"));
- }
- }
- else
- {
- bufferLayoutHdr.AppendNum(nextValue);
- }
+ bufferLayoutHdr.AppendNum(nextValue);
}
else
{
@@ -882,13 +800,11 @@ TFileName CPixelMetricsMapperAppUi::CreateLayoutNameL(TFileText& aFileHandle) co
// Layout data is deployed like this:
// first line - height
// second line - width
- // fifth line mirror info
TFileName lines;
TFileName layoutName;
TInt height = -666;
TInt width = -666;
- TInt mirroring = -666;
// Collect name information.
for (TInt i=0; i<6; i++)
{
@@ -907,10 +823,6 @@ TFileName CPixelMetricsMapperAppUi::CreateLayoutNameL(TFileText& aFileHandle) co
{
error = myLexer.Val(width);
}
- if (i==4) //mirror info is fourth
- {
- error = myLexer.Val(mirroring);
- }
User::LeaveIfError(error);
}
@@ -966,10 +878,6 @@ TFileName CPixelMetricsMapperAppUi::CreateLayoutNameL(TFileText& aFileHandle) co
{
layoutName.Append(_L("Portrait"));
}
- if (mirroring)
- {
- layoutName.Append(_L(" Mirrored"));
- }
return layoutName;
}
diff --git a/util/s60pixelmetrics/pm_mapperapp.h b/util/s60pixelmetrics/pm_mapperapp.h
index cd119bc..aa6a63b 100644
--- a/util/s60pixelmetrics/pm_mapperapp.h
+++ b/util/s60pixelmetrics/pm_mapperapp.h
@@ -111,7 +111,7 @@ class CPixelMetricsMapperAppUi : public CAknViewAppUi
/**
* Constructor.
*/
- CPixelMetricsMapperAppUi();
+ CPixelMetricsMapperAppUi();
/**
* Symbian 2nd phase constructor.
@@ -123,12 +123,6 @@ class CPixelMetricsMapperAppUi : public CAknViewAppUi
*/
~CPixelMetricsMapperAppUi();
- public:
- void DoAutoOperationL();
-
- TBool ReadyForAutoOp() const;
-
-
private: // Functions from base classes
/**
@@ -158,18 +152,16 @@ class CPixelMetricsMapperAppUi : public CAknViewAppUi
private: // Data
// Test view.
- CPixelMetricsMapperView* iView;
+ CPixelMetricsMapperView* iView;
CEikDialog* iDialog;
TBool iFileOutputOn;
+ TBool iMode;
CFbsBitmap* icon;
CFbsBitmap* iconMask;
- TBool iAutoMode;
- TBool iMode;
-
};
diff --git a/util/s60pixelmetrics/pm_mapperview.cpp b/util/s60pixelmetrics/pm_mapperview.cpp
index 82b825d..04bc3e8 100644
--- a/util/s60pixelmetrics/pm_mapperview.cpp
+++ b/util/s60pixelmetrics/pm_mapperview.cpp
@@ -129,8 +129,6 @@ void CPixelMetricsMapperViewContainer::ShowL( const TDesC& aString, TBool& aLast
fileName.Append('_');
fileName.AppendNum(width);
- if (AknLayoutUtils::LayoutMirrored())
- fileName.Append(_L("_mirrored"));
fileName.Append(_L(".txt"));
TInt err=file.Open(fs,fileName,EFileStreamText|EFileWrite|EFileShareAny);
@@ -263,11 +261,9 @@ void CPixelMetricsMapperViewContainer::HandleResourceChange(TInt aType)
mainPaneRect );
SetRect( mainPaneRect );
- CPixelMetricsMapperAppUi* myApp = static_cast<CPixelMetricsMapperAppUi*> (ControlEnv()->AppUi());
- if (myApp->ReadyForAutoOp())
- myApp->DoAutoOperationL();
}
- if (iListbox) iListbox->HandleResourceChange(aType);
+ if (iListbox)
+ iListbox->HandleResourceChange(aType);
}
@@ -329,6 +325,7 @@ void CPixelMetricsMapperView::HandleCommandL( TInt aCommand )
AppUi()->HandleCommandL( aCommand );
}
+
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
@@ -342,6 +339,7 @@ void CPixelMetricsMapperView::HandleStatusPaneSizeChange()
}
}
+
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
@@ -358,6 +356,7 @@ void CPixelMetricsMapperView::DoActivateL(
AppUi()->AddToViewStackL( *this, iView );
}
+
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
@@ -372,4 +371,5 @@ void CPixelMetricsMapperView::DoDeactivate()
iView = NULL;
}
+
// End of File
diff --git a/util/s60pixelmetrics/pm_mapperview.h b/util/s60pixelmetrics/pm_mapperview.h
index be40a15..36376cd 100644
--- a/util/s60pixelmetrics/pm_mapperview.h
+++ b/util/s60pixelmetrics/pm_mapperview.h
@@ -219,7 +219,7 @@ class CPixelMetricsMapperView : public CAknView
private: // Data
// The view container.
- CPixelMetricsMapperViewContainer* iView;
+ CPixelMetricsMapperViewContainer* iView;
};