summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-x[-rw-r--r--]configure.exebin1180160 -> 1008128 bytes
-rw-r--r--examples/multimedia/audioinput/audioinput.cpp309
-rw-r--r--examples/multimedia/audioinput/audioinput.h60
-rw-r--r--examples/multimedia/audiooutput/audiooutput.cpp346
-rw-r--r--examples/multimedia/audiooutput/audiooutput.h68
-rw-r--r--examples/network/http/httpwindow.cpp129
-rw-r--r--examples/network/http/httpwindow.h23
-rw-r--r--examples/network/http/main.cpp1
-rw-r--r--examples/network/loopback/dialog.cpp10
-rw-r--r--header.BSD40
-rw-r--r--header.LGPL (renamed from qmake/generators/symbian/epocroot.h)12
-rw-r--r--header.LGPL-ONLY22
-rw-r--r--mkspecs/common/symbian/symbian.conf18
-rw-r--r--mkspecs/features/qttest_p4.prf24
-rw-r--r--mkspecs/features/symbian/stl.prf19
-rw-r--r--qmake/Makefile.unix14
-rw-r--r--qmake/Makefile.win3212
-rw-r--r--qmake/Makefile.win32-g++9
-rw-r--r--qmake/Makefile.win32-g++-sh9
-rw-r--r--qmake/generators/symbian/initprojectdeploy_symbian.cpp96
-rw-r--r--qmake/generators/symbian/initprojectdeploy_symbian.h2
-rw-r--r--qmake/generators/symbian/symmake.cpp40
-rw-r--r--qmake/generators/symbian/symmake.h2
-rw-r--r--qmake/generators/symbian/symmake_abld.cpp3
-rw-r--r--qmake/generators/symbian/symmake_sbsv2.cpp3
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp97
-rw-r--r--qmake/project.cpp5
-rw-r--r--qmake/qmake.pri9
-rw-r--r--qmake/qmake.pro4
-rw-r--r--src/corelib/arch/qatomic_s390.h16
-rw-r--r--src/corelib/arch/qatomic_symbian.h2
-rw-r--r--src/corelib/codecs/qtextcodec.h2
-rw-r--r--src/corelib/concurrent/qfuture.h2
-rw-r--r--src/corelib/io/qdatastream.cpp5
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp4
-rw-r--r--src/corelib/tools/qcontiguouscache.h2
-rw-r--r--src/corelib/tools/qhash.h6
-rw-r--r--src/corelib/tools/qlinkedlist.h6
-rw-r--r--src/corelib/tools/qlist.h6
-rw-r--r--src/corelib/tools/qmap.h6
-rw-r--r--src/corelib/tools/qset.h7
-rw-r--r--src/corelib/tools/qsharedpointer_impl.h4
-rw-r--r--src/corelib/tools/qvector.h6
-rw-r--r--src/corelib/xml/qxmlstream_p.h2
-rw-r--r--src/gui/dialogs/qcolordialog.cpp6
-rw-r--r--src/gui/dialogs/qfontdialog.cpp64
-rw-r--r--src/gui/dialogs/qfontdialog.h3
-rw-r--r--src/gui/dialogs/qfontdialog_mac.mm148
-rw-r--r--src/gui/dialogs/qfontdialog_p.h6
-rw-r--r--src/gui/effects/qgraphicseffect.cpp12
-rw-r--r--src/gui/egl/qegl.cpp23
-rw-r--r--src/gui/egl/qegl_symbian.cpp4
-rw-r--r--src/gui/graphicsview/qgraphicsview.cpp4
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_s60.cpp5
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp5
-rw-r--r--src/gui/itemviews/qtreeview.cpp9
-rw-r--r--src/gui/kernel/qapplication_win.cpp5
-rw-r--r--src/gui/kernel/qsoftkeymanager.cpp29
-rw-r--r--src/gui/kernel/qsoftkeymanager_p.h2
-rw-r--r--src/gui/painting/qdrawhelper_neon.cpp130
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp18
-rw-r--r--src/gui/styles/qs60style.cpp37
-rw-r--r--src/gui/styles/qs60style_p.h3
-rw-r--r--src/gui/styles/qstylesheetstyle.cpp7
-rw-r--r--src/gui/util/qdesktopservices_s60.cpp4
-rw-r--r--src/gui/widgets/qcombobox.cpp6
-rw-r--r--src/gui/widgets/qdockarealayout.cpp2
-rw-r--r--src/gui/widgets/qmainwindow.cpp5
-rw-r--r--src/gui/widgets/qmainwindowlayout.cpp1
-rw-r--r--src/gui/widgets/qmenu.cpp20
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp22
-rw-r--r--src/network/access/qhttpnetworkconnection_p.h5
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp77
-rw-r--r--src/network/access/qhttpnetworkreply.cpp13
-rw-r--r--src/network/access/qhttpnetworkreply_p.h2
-rw-r--r--src/network/access/qnetworkaccesshttpbackend.cpp2
-rw-r--r--src/network/access/qnetworkrequest.cpp2
-rw-r--r--src/network/socket/qabstractsocket.cpp10
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp4
-rw-r--r--src/openvg/qpaintengine_vg.cpp128
-rw-r--r--src/plugins/audio/audio.pro8
-rw-r--r--src/plugins/audio/symbian/main.cpp121
-rw-r--r--src/plugins/audio/symbian/symbian.pro31
-rw-r--r--src/plugins/audio/symbian/symbianaudio.h76
-rw-r--r--src/plugins/audio/symbian/symbianaudiodeviceinfo.cpp191
-rw-r--r--src/plugins/audio/symbian/symbianaudiodeviceinfo.h94
-rw-r--r--src/plugins/audio/symbian/symbianaudioinput.cpp595
-rw-r--r--src/plugins/audio/symbian/symbianaudioinput.h177
-rw-r--r--src/plugins/audio/symbian/symbianaudiooutput.cpp697
-rw-r--r--src/plugins/audio/symbian/symbianaudiooutput.h199
-rw-r--r--src/plugins/audio/symbian/symbianaudioutils.cpp395
-rw-r--r--src/plugins/audio/symbian/symbianaudioutils.h125
-rw-r--r--src/qbase.pri4
-rw-r--r--src/s60installs/qt.iby6
-rw-r--r--src/s60installs/s60installs.pro6
-rw-r--r--src/script/api/qscriptengine.cpp2
-rw-r--r--src/script/api/qscriptengine_p.h12
-rw-r--r--tests/auto/auto.pro16
-rw-r--r--tests/auto/compilerwarnings/compilerwarnings.qrc2
-rw-r--r--tests/auto/compilerwarnings/test_cpp.txt (renamed from tests/auto/compilerwarnings/test.cpp)0
-rw-r--r--tests/auto/compilerwarnings/tst_compilerwarnings.cpp4
-rw-r--r--tests/auto/maketestselftest/tst_maketestselftest.cpp4
-rw-r--r--tests/auto/modeltest/dynamictreemodel.h2
-rw-r--r--tests/auto/qhelpcontentmodel/qhelpcontentmodel.pro26
-rw-r--r--tests/auto/qhelpcontentmodel/tst_qhelpcontentmodel.pro22
-rw-r--r--tests/auto/qhelpenginecore/qhelpenginecore.pro27
-rw-r--r--tests/auto/qhelpenginecore/tst_qhelpenginecore.pro23
-rw-r--r--tests/auto/qhelpgenerator/qhelpgenerator.pro15
-rw-r--r--tests/auto/qhelpgenerator/tst_qhelpgenerator.pro9
-rw-r--r--tests/auto/qhelpindexmodel/qhelpindexmodel.pro15
-rw-r--r--tests/auto/qhelpindexmodel/tst_qhelpindexmodel.pro9
-rw-r--r--tests/auto/qhelpprojectdata/qhelpprojectdata.pro13
-rw-r--r--tests/auto/qhelpprojectdata/tst_qhelpprojectdata.pro9
-rw-r--r--tests/auto/qlibrary/lib2/lib2.pro9
-rw-r--r--tests/auto/qlocalsocket/lackey/main.cpp2
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp197
-rw-r--r--tests/auto/qpainter/tst_qpainter.cpp2
-rw-r--r--tests/auto/qpixmapcache/tst_qpixmapcache.cpp2
-rw-r--r--tests/auto/qpluginloader/theplugin/plugininterface.h3
-rw-r--r--tests/auto/qsharedmemory/qsharedmemory.pro4
-rw-r--r--tests/auto/qsystemsemaphore/files.qrc7
-rw-r--r--tests/auto/qsystemsemaphore/qsystemsemaphore.pro4
-rw-r--r--tests/auto/qtextstream/tst_qtextstream.cpp7
-rw-r--r--tests/auto/qtipc/lackey/lackey.pro (renamed from tests/auto/qsharedmemory/lackey/lackey.pro)2
-rw-r--r--tests/auto/qtipc/lackey/main.cpp (renamed from tests/auto/qsharedmemory/lackey/main.cpp)2
-rw-r--r--tests/auto/qtipc/lackey/scripts/consumer.js (renamed from tests/auto/qsharedmemory/lackey/scripts/consumer.js)0
-rw-r--r--tests/auto/qtipc/lackey/scripts/producer.js (renamed from tests/auto/qsharedmemory/lackey/scripts/producer.js)0
-rw-r--r--tests/auto/qtipc/lackey/scripts/readonly_segfault.js (renamed from tests/auto/qsharedmemory/lackey/scripts/readonly_segfault.js)0
-rw-r--r--tests/auto/qtipc/lackey/scripts/systemlock_read.js (renamed from tests/auto/qsharedmemory/lackey/scripts/systemlock_read.js)0
-rw-r--r--tests/auto/qtipc/lackey/scripts/systemlock_readwrite.js (renamed from tests/auto/qsharedmemory/lackey/scripts/systemlock_readwrite.js)0
-rw-r--r--tests/auto/qtipc/lackey/scripts/systemsemaphore_acquire.js (renamed from tests/auto/qsharedmemory/lackey/scripts/systemsemaphore_acquire.js)0
-rw-r--r--tests/auto/qtipc/lackey/scripts/systemsemaphore_acquirerelease.js (renamed from tests/auto/qsharedmemory/lackey/scripts/systemsemaphore_acquirerelease.js)0
-rw-r--r--tests/auto/qtipc/lackey/scripts/systemsemaphore_release.js (renamed from tests/auto/qsharedmemory/lackey/scripts/systemsemaphore_release.js)0
-rw-r--r--tests/auto/qtipc/qsharedmemory/.gitignore (renamed from tests/auto/qsharedmemory/.gitignore)0
-rw-r--r--tests/auto/qtipc/qsharedmemory/qsharedmemory.pro4
-rw-r--r--tests/auto/qtipc/qsharedmemory/qsystemlock/qsystemlock.pro (renamed from tests/auto/qsharedmemory/qsystemlock/qsystemlock.pro)0
-rw-r--r--tests/auto/qtipc/qsharedmemory/qsystemlock/tst_qsystemlock.cpp (renamed from tests/auto/qsharedmemory/qsystemlock/tst_qsystemlock.cpp)0
-rw-r--r--tests/auto/qtipc/qsharedmemory/src/qsystemlock.cpp (renamed from tests/auto/qsharedmemory/src/qsystemlock.cpp)0
-rw-r--r--tests/auto/qtipc/qsharedmemory/src/qsystemlock.h (renamed from tests/auto/qsharedmemory/src/qsystemlock.h)0
-rw-r--r--tests/auto/qtipc/qsharedmemory/src/qsystemlock_p.h (renamed from tests/auto/qsharedmemory/src/qsystemlock_p.h)0
-rw-r--r--tests/auto/qtipc/qsharedmemory/src/qsystemlock_unix.cpp (renamed from tests/auto/qsharedmemory/src/qsystemlock_unix.cpp)0
-rw-r--r--tests/auto/qtipc/qsharedmemory/src/qsystemlock_win.cpp (renamed from tests/auto/qsharedmemory/src/qsystemlock_win.cpp)0
-rw-r--r--tests/auto/qtipc/qsharedmemory/src/src.pri (renamed from tests/auto/qsharedmemory/src/src.pri)0
-rw-r--r--tests/auto/qtipc/qsharedmemory/test/test.pro (renamed from tests/auto/qsharedmemory/test/test.pro)4
-rw-r--r--tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp (renamed from tests/auto/qsharedmemory/tst_qsharedmemory.cpp)26
-rw-r--r--tests/auto/qtipc/qsystemsemaphore/.gitignore (renamed from tests/auto/qsystemsemaphore/.gitignore)0
-rw-r--r--tests/auto/qtipc/qsystemsemaphore/files.qrc7
-rw-r--r--tests/auto/qtipc/qsystemsemaphore/qsystemsemaphore.pro (renamed from tests/auto/qsystemsemaphore/test/test.pro)18
-rw-r--r--tests/auto/qtipc/qsystemsemaphore/tst_qsystemsemaphore.cpp (renamed from tests/auto/qsystemsemaphore/tst_qsystemsemaphore.cpp)2
-rw-r--r--tests/auto/qtipc/qtipc.pro6
-rw-r--r--tests/auto/qvariant/tst_qvariant.cpp5
-rw-r--r--tests/auto/symbols/tst_symbols.cpp12
-rw-r--r--tests/auto/xmlpatternsdiagnosticsts/test/test.pro32
-rw-r--r--tests/auto/xmlpatternsdiagnosticsts/tst_xmlpatternsdiagnosticsts.cpp (renamed from tests/auto/xmlpatternsdiagnosticsts/test/tst_xmlpatternsdiagnosticsts.cpp)0
-rw-r--r--tests/auto/xmlpatternsdiagnosticsts/xmlpatternsdiagnosticsts.pro30
-rw-r--r--tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro14
-rw-r--r--tests/auto/xmlpatternssdk/ASTItem.cpp (renamed from tests/auto/xmlpatternsxqts/lib/ASTItem.cpp)0
-rw-r--r--tests/auto/xmlpatternssdk/ASTItem.h (renamed from tests/auto/xmlpatternsxqts/lib/ASTItem.h)0
-rw-r--r--tests/auto/xmlpatternssdk/DebugExpressionFactory.cpp (renamed from tests/auto/xmlpatternsxqts/lib/DebugExpressionFactory.cpp)0
-rw-r--r--tests/auto/xmlpatternssdk/DebugExpressionFactory.h (renamed from tests/auto/xmlpatternsxqts/lib/DebugExpressionFactory.h)0
-rw-r--r--tests/auto/xmlpatternssdk/ErrorHandler.cpp (renamed from tests/auto/xmlpatternsxqts/lib/ErrorHandler.cpp)0
-rw-r--r--tests/auto/xmlpatternssdk/ErrorHandler.h (renamed from tests/auto/xmlpatternsxqts/lib/ErrorHandler.h)0
-rw-r--r--tests/auto/xmlpatternssdk/ErrorItem.cpp (renamed from tests/auto/xmlpatternsxqts/lib/ErrorItem.cpp)0
-rw-r--r--tests/auto/xmlpatternssdk/ErrorItem.h (renamed from tests/auto/xmlpatternsxqts/lib/ErrorItem.h)0
-rw-r--r--tests/auto/xmlpatternssdk/ExitCode.h (renamed from tests/auto/xmlpatternsxqts/lib/ExitCode.h)0
-rw-r--r--tests/auto/xmlpatternssdk/ExpressionInfo.cpp (renamed from tests/auto/xmlpatternsxqts/lib/ExpressionInfo.cpp)0
-rw-r--r--tests/auto/xmlpatternssdk/ExpressionInfo.h (renamed from tests/auto/xmlpatternsxqts/lib/ExpressionInfo.h)0
-rw-r--r--tests/auto/xmlpatternssdk/ExpressionNamer.cpp (renamed from tests/auto/xmlpatternsxqts/lib/ExpressionNamer.cpp)0
-rw-r--r--tests/auto/xmlpatternssdk/ExpressionNamer.h (renamed from tests/auto/xmlpatternsxqts/lib/ExpressionNamer.h)0
-rw-r--r--tests/auto/xmlpatternssdk/ExternalSourceLoader.cpp (renamed from tests/auto/xmlpatternsxqts/lib/ExternalSourceLoader.cpp)0
-rw-r--r--tests/auto/xmlpatternssdk/ExternalSourceLoader.h (renamed from tests/auto/xmlpatternsxqts/lib/ExternalSourceLoader.h)0
-rw-r--r--tests/auto/xmlpatternssdk/Global.cpp (renamed from tests/auto/xmlpatternsxqts/lib/Global.cpp)0
-rw-r--r--tests/auto/xmlpatternssdk/Global.h (renamed from tests/auto/xmlpatternsxqts/lib/Global.h)0
-rw-r--r--tests/auto/xmlpatternssdk/ResultThreader.cpp (renamed from tests/auto/xmlpatternsxqts/lib/ResultThreader.cpp)0
-rw-r--r--tests/auto/xmlpatternssdk/ResultThreader.h (renamed from tests/auto/xmlpatternsxqts/lib/ResultThreader.h)0
-rw-r--r--tests/auto/xmlpatternssdk/TestBaseLine.cpp (renamed from tests/auto/xmlpatternsxqts/lib/TestBaseLine.cpp)0
-rw-r--r--tests/auto/xmlpatternssdk/TestBaseLine.h (renamed from tests/auto/xmlpatternsxqts/lib/TestBaseLine.h)0
-rw-r--r--tests/auto/xmlpatternssdk/TestCase.cpp (renamed from tests/auto/xmlpatternsxqts/lib/TestCase.cpp)0
-rw-r--r--tests/auto/xmlpatternssdk/TestCase.h (renamed from tests/auto/xmlpatternsxqts/lib/TestCase.h)0
-rw-r--r--tests/auto/xmlpatternssdk/TestContainer.cpp (renamed from tests/auto/xmlpatternsxqts/lib/TestContainer.cpp)0
-rw-r--r--tests/auto/xmlpatternssdk/TestContainer.h (renamed from tests/auto/xmlpatternsxqts/lib/TestContainer.h)0
-rw-r--r--tests/auto/xmlpatternssdk/TestGroup.cpp (renamed from tests/auto/xmlpatternsxqts/lib/TestGroup.cpp)0
-rw-r--r--tests/auto/xmlpatternssdk/TestGroup.h (renamed from tests/auto/xmlpatternsxqts/lib/TestGroup.h)0
-rw-r--r--tests/auto/xmlpatternssdk/TestItem.h (renamed from tests/auto/xmlpatternsxqts/lib/TestItem.h)0
-rw-r--r--tests/auto/xmlpatternssdk/TestResult.cpp (renamed from tests/auto/xmlpatternsxqts/lib/TestResult.cpp)0
-rw-r--r--tests/auto/xmlpatternssdk/TestResult.h (renamed from tests/auto/xmlpatternsxqts/lib/TestResult.h)0
-rw-r--r--tests/auto/xmlpatternssdk/TestResultHandler.cpp (renamed from tests/auto/xmlpatternsxqts/lib/TestResultHandler.cpp)0
-rw-r--r--tests/auto/xmlpatternssdk/TestResultHandler.h (renamed from tests/auto/xmlpatternsxqts/lib/TestResultHandler.h)0
-rw-r--r--tests/auto/xmlpatternssdk/TestSuite.cpp (renamed from tests/auto/xmlpatternsxqts/lib/TestSuite.cpp)0
-rw-r--r--tests/auto/xmlpatternssdk/TestSuite.h (renamed from tests/auto/xmlpatternsxqts/lib/TestSuite.h)0
-rw-r--r--tests/auto/xmlpatternssdk/TestSuiteHandler.cpp (renamed from tests/auto/xmlpatternsxqts/lib/TestSuiteHandler.cpp)0
-rw-r--r--tests/auto/xmlpatternssdk/TestSuiteHandler.h (renamed from tests/auto/xmlpatternsxqts/lib/TestSuiteHandler.h)0
-rw-r--r--tests/auto/xmlpatternssdk/TestSuiteResult.cpp (renamed from tests/auto/xmlpatternsxqts/lib/TestSuiteResult.cpp)0
-rw-r--r--tests/auto/xmlpatternssdk/TestSuiteResult.h (renamed from tests/auto/xmlpatternsxqts/lib/TestSuiteResult.h)0
-rw-r--r--tests/auto/xmlpatternssdk/TreeItem.cpp (renamed from tests/auto/xmlpatternsxqts/lib/TreeItem.cpp)0
-rw-r--r--tests/auto/xmlpatternssdk/TreeItem.h (renamed from tests/auto/xmlpatternsxqts/lib/TreeItem.h)0
-rw-r--r--tests/auto/xmlpatternssdk/TreeModel.cpp (renamed from tests/auto/xmlpatternsxqts/lib/TreeModel.cpp)0
-rw-r--r--tests/auto/xmlpatternssdk/TreeModel.h (renamed from tests/auto/xmlpatternsxqts/lib/TreeModel.h)0
-rw-r--r--tests/auto/xmlpatternssdk/Worker.cpp (renamed from tests/auto/xmlpatternsxqts/lib/Worker.cpp)0
-rw-r--r--tests/auto/xmlpatternssdk/Worker.h (renamed from tests/auto/xmlpatternsxqts/lib/Worker.h)0
-rw-r--r--tests/auto/xmlpatternssdk/XMLWriter.cpp (renamed from tests/auto/xmlpatternsxqts/lib/XMLWriter.cpp)0
-rw-r--r--tests/auto/xmlpatternssdk/XMLWriter.h (renamed from tests/auto/xmlpatternsxqts/lib/XMLWriter.h)0
-rw-r--r--tests/auto/xmlpatternssdk/XQTSTestCase.cpp (renamed from tests/auto/xmlpatternsxqts/lib/XQTSTestCase.cpp)0
-rw-r--r--tests/auto/xmlpatternssdk/XQTSTestCase.h (renamed from tests/auto/xmlpatternsxqts/lib/XQTSTestCase.h)0
-rw-r--r--tests/auto/xmlpatternssdk/XSDTSTestCase.cpp (renamed from tests/auto/xmlpatternsxqts/lib/XSDTSTestCase.cpp)0
-rw-r--r--tests/auto/xmlpatternssdk/XSDTSTestCase.h (renamed from tests/auto/xmlpatternsxqts/lib/XSDTSTestCase.h)2
-rw-r--r--tests/auto/xmlpatternssdk/XSDTestSuiteHandler.cpp (renamed from tests/auto/xmlpatternsxqts/lib/XSDTestSuiteHandler.cpp)0
-rw-r--r--tests/auto/xmlpatternssdk/XSDTestSuiteHandler.h (renamed from tests/auto/xmlpatternsxqts/lib/XSDTestSuiteHandler.h)2
-rw-r--r--tests/auto/xmlpatternssdk/XSLTTestSuiteHandler.cpp (renamed from tests/auto/xmlpatternsxqts/lib/XSLTTestSuiteHandler.cpp)0
-rw-r--r--tests/auto/xmlpatternssdk/XSLTTestSuiteHandler.h (renamed from tests/auto/xmlpatternsxqts/lib/XSLTTestSuiteHandler.h)0
-rw-r--r--tests/auto/xmlpatternssdk/docs/XMLIndenterExample.cpp (renamed from tests/auto/xmlpatternsxqts/lib/docs/XMLIndenterExample.cpp)0
-rw-r--r--tests/auto/xmlpatternssdk/docs/XMLIndenterExampleResult.xml (renamed from tests/auto/xmlpatternsxqts/lib/docs/XMLIndenterExampleResult.xml)0
-rw-r--r--tests/auto/xmlpatternssdk/docs/XMLWriterExample.cpp (renamed from tests/auto/xmlpatternsxqts/lib/docs/XMLWriterExample.cpp)0
-rw-r--r--tests/auto/xmlpatternssdk/docs/XMLWriterExampleResult.xml (renamed from tests/auto/xmlpatternsxqts/lib/docs/XMLWriterExampleResult.xml)0
-rw-r--r--tests/auto/xmlpatternssdk/tests/XMLWriterTest.cpp (renamed from tests/auto/xmlpatternsxqts/lib/tests/XMLWriterTest.cpp)0
-rw-r--r--tests/auto/xmlpatternssdk/tests/XMLWriterTest.h (renamed from tests/auto/xmlpatternsxqts/lib/tests/XMLWriterTest.h)0
-rw-r--r--tests/auto/xmlpatternssdk/xmlpatternssdk.pro (renamed from tests/auto/xmlpatternsxqts/lib/lib.pro)2
-rw-r--r--tests/auto/xmlpatternsview/test/test.pro17
-rw-r--r--tests/auto/xmlpatternsview/tst_xmlpatternsview.cpp (renamed from tests/auto/xmlpatternsview/test/tst_xmlpatternsview.cpp)0
-rw-r--r--tests/auto/xmlpatternsview/xmlpatternsview.pro15
-rw-r--r--tests/auto/xmlpatternsxqts/test/test.pro26
-rw-r--r--tests/auto/xmlpatternsxqts/tst_suitetest.cpp (renamed from tests/auto/xmlpatternsxqts/test/tst_suitetest.cpp)0
-rw-r--r--tests/auto/xmlpatternsxqts/tst_suitetest.h (renamed from tests/auto/xmlpatternsxqts/test/tst_suitetest.h)2
-rw-r--r--tests/auto/xmlpatternsxqts/tst_xmlpatternsxqts.cpp (renamed from tests/auto/xmlpatternsxqts/test/tst_xmlpatternsxqts.cpp)0
-rw-r--r--tests/auto/xmlpatternsxqts/xmlpatternsxqts.pro26
-rw-r--r--tests/auto/xmlpatternsxslts/xmlpatternsxslts.pro14
-rw-r--r--tests/benchmarks/corelib/io/qdir/10000/10000.pro10
-rw-r--r--tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp (renamed from tests/benchmarks/corelib/io/qdir/tst_qdir.cpp)12
-rw-r--r--tests/benchmarks/corelib/io/qdir/qdir.pro10
-rw-r--r--tests/benchmarks/corelib/io/qfileinfo/qfileinfo.pro2
-rw-r--r--tests/benchmarks/gui/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp41
-rw-r--r--tests/benchmarks/gui/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp15
-rw-r--r--tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp7
-rw-r--r--tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/moveItems/main.cpp6
-rw-r--r--tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/scrolltest/main.cpp6
-rw-r--r--tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp300
-rw-r--r--tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp297
-rw-r--r--tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp9
-rw-r--r--tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro2
-rw-r--r--tools/assistant/lib/qhelpsearchengine.cpp6
-rw-r--r--tools/assistant/lib/qhelpsearchindexreader.cpp6
-rw-r--r--tools/assistant/lib/qhelpsearchindexreader_clucene.cpp10
-rw-r--r--tools/assistant/lib/qhelpsearchindexreader_clucene_p.h10
-rw-r--r--tools/assistant/lib/qhelpsearchindexreader_default.cpp10
-rw-r--r--tools/assistant/lib/qhelpsearchindexreader_default_p.h10
-rw-r--r--tools/assistant/lib/qhelpsearchindexreader_p.h6
-rw-r--r--tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp240
-rw-r--r--tools/assistant/lib/qhelpsearchindexwriter_clucene_p.h9
-rw-r--r--tools/assistant/lib/qhelpsearchindexwriter_default.cpp10
-rw-r--r--tools/assistant/lib/qhelpsearchindexwriter_default_p.h10
-rw-r--r--tools/assistant/tools/assistant/helpviewer.cpp5
-rw-r--r--tools/configure/configure.pro17
-rw-r--r--tools/configure/configureapp.cpp50
-rw-r--r--tools/configure/environment.cpp128
-rw-r--r--tools/configure/environment.h5
-rw-r--r--tools/configure/tools.cpp3
-rw-r--r--tools/qtestlib/wince/cetest/activesyncconnection.cpp139
-rw-r--r--tools/qtestlib/wince/cetest/activesyncconnection.h3
-rw-r--r--tools/qtestlib/wince/cetest/main.cpp48
-rw-r--r--tools/qtestlib/wince/remotelib/commands.cpp86
-rw-r--r--tools/qtestlib/wince/remotelib/commands.h3
-rw-r--r--tools/shared/symbian/epocroot.cpp230
-rw-r--r--tools/shared/symbian/epocroot.h67
-rw-r--r--tools/shared/windows/registry.cpp161
-rw-r--r--tools/shared/windows/registry.h64
265 files changed, 5811 insertions, 1969 deletions
diff --git a/configure.exe b/configure.exe
index 8913de1..9974236 100644..100755
--- a/configure.exe
+++ b/configure.exe
Binary files differ
diff --git a/examples/multimedia/audioinput/audioinput.cpp b/examples/multimedia/audioinput/audioinput.cpp
index fbf4dc4..b01a396 100644
--- a/examples/multimedia/audioinput/audioinput.cpp
+++ b/examples/multimedia/audioinput/audioinput.cpp
@@ -48,16 +48,47 @@
#include <QAudioDeviceInfo>
#include <QAudioInput>
+
+#include <QtCore/qendian.h>
+
#include "audioinput.h"
-#define BUFFER_SIZE 4096
+const QString InputTest::PushModeLabel(tr("Enable push mode"));
+const QString InputTest::PullModeLabel(tr("Enable pull mode"));
+const QString InputTest::SuspendLabel(tr("Suspend recording"));
+const QString InputTest::ResumeLabel(tr("Resume recording"));
-AudioInfo::AudioInfo(QObject *parent, QAudioInput *device)
- :QIODevice(parent)
-{
- input = device;
+const int BufferSize = 4096;
+
+AudioInfo::AudioInfo(const QAudioFormat &format, QObject *parent)
+ : QIODevice(parent)
+ , m_format(format)
+ , m_maxAmplitude(0)
+ , m_level(0.0)
- m_maxValue = 0;
+{
+ switch (m_format.sampleSize()) {
+ case 8:
+ switch (m_format.sampleType()) {
+ case QAudioFormat::UnSignedInt:
+ m_maxAmplitude = 255;
+ break;
+ case QAudioFormat::SignedInt:
+ m_maxAmplitude = 127;
+ break;
+ }
+ break;
+ case 16:
+ switch (m_format.sampleType()) {
+ case QAudioFormat::UnSignedInt:
+ m_maxAmplitude = 65535;
+ break;
+ case QAudioFormat::SignedInt:
+ m_maxAmplitude = 32767;
+ break;
+ }
+ break;
+ }
}
AudioInfo::~AudioInfo()
@@ -84,48 +115,56 @@ qint64 AudioInfo::readData(char *data, qint64 maxlen)
qint64 AudioInfo::writeData(const char *data, qint64 len)
{
- int samples = len/2; // 2 bytes per sample
- int maxAmp = 32768; // max for S16 samples
- bool clipping = false;
-
- m_maxValue = 0;
-
- qint16 *s = (qint16*)data;
-
- // sample format is S16LE, only!
-
- for (int i = 0; i < samples; ++i) {
- qint16 sample = *s;
- s++;
- if (abs(sample) > m_maxValue) m_maxValue = abs(sample);
+ if (m_maxAmplitude) {
+ Q_ASSERT(m_format.sampleSize() % 8 == 0);
+ const int channelBytes = m_format.sampleSize() / 8;
+ const int sampleBytes = m_format.channels() * channelBytes;
+ Q_ASSERT(len % sampleBytes == 0);
+ const int numSamples = len / sampleBytes;
+
+ quint16 maxValue = 0;
+ const unsigned char *ptr = reinterpret_cast<const unsigned char *>(data);
+
+ for (int i = 0; i < numSamples; ++i) {
+ for(int j = 0; j < m_format.channels(); ++j) {
+ quint16 value = 0;
+
+ if (m_format.sampleSize() == 8 && m_format.sampleType() == QAudioFormat::UnSignedInt) {
+ value = *reinterpret_cast<const quint8*>(ptr);
+ } else if (m_format.sampleSize() == 8 && m_format.sampleType() == QAudioFormat::SignedInt) {
+ value = qAbs(*reinterpret_cast<const qint8*>(ptr));
+ } else if (m_format.sampleSize() == 16 && m_format.sampleType() == QAudioFormat::UnSignedInt) {
+ if (m_format.byteOrder() == QAudioFormat::LittleEndian)
+ value = qFromLittleEndian<quint16>(ptr);
+ else
+ value = qFromBigEndian<quint16>(ptr);
+ } else if (m_format.sampleSize() == 16 && m_format.sampleType() == QAudioFormat::SignedInt) {
+ if (m_format.byteOrder() == QAudioFormat::LittleEndian)
+ value = qAbs(qFromLittleEndian<qint16>(ptr));
+ else
+ value = qAbs(qFromBigEndian<qint16>(ptr));
+ }
+
+ maxValue = qMax(value, maxValue);
+ ptr += channelBytes;
+ }
+ }
+
+ maxValue = qMin(maxValue, m_maxAmplitude);
+ m_level = qreal(maxValue) / m_maxAmplitude;
}
- // check for clipping
- if (m_maxValue >= (maxAmp - 1))
- clipping = true;
-
- float value = ((float)m_maxValue/(float)maxAmp);
- if (clipping)
- m_maxValue = 100;
- else
- m_maxValue = (int)(value*100);
emit update();
-
return len;
}
-int AudioInfo::LinearMax()
-{
- return m_maxValue;
-}
-
RenderArea::RenderArea(QWidget *parent)
: QWidget(parent)
{
setBackgroundRole(QPalette::Base);
setAutoFillBackground(true);
- level = 0;
+ m_level = 0;
setMinimumHeight(30);
setMinimumWidth(200);
}
@@ -139,12 +178,12 @@ void RenderArea::paintEvent(QPaintEvent * /* event */)
painter.viewport().top()+10,
painter.viewport().right()-20,
painter.viewport().bottom()-20));
- if (level == 0)
+ if (m_level == 0.0)
return;
painter.setPen(Qt::red);
- int pos = ((painter.viewport().right()-20)-(painter.viewport().left()+11))*level/100;
+ int pos = ((painter.viewport().right()-20)-(painter.viewport().left()+11))*m_level;
for (int i = 0; i < 10; ++i) {
int x1 = painter.viewport().left()+11;
int y1 = painter.viewport().top()+10+i;
@@ -157,156 +196,174 @@ void RenderArea::paintEvent(QPaintEvent * /* event */)
}
}
-void RenderArea::setLevel(int value)
+void RenderArea::setLevel(qreal value)
{
- level = value;
+ m_level = value;
repaint();
}
InputTest::InputTest()
+ : m_canvas(0)
+ , m_modeButton(0)
+ , m_suspendResumeButton(0)
+ , m_deviceBox(0)
+ , m_device(QAudioDeviceInfo::defaultInputDevice())
+ , m_audioInfo(0)
+ , m_audioInput(0)
+ , m_input(0)
+ , m_pullMode(false)
+ , m_buffer(BufferSize, 0)
{
- QWidget *window = new QWidget;
- QVBoxLayout* layout = new QVBoxLayout;
+ initializeWindow();
+ initializeAudio();
+}
+
+InputTest::~InputTest() {}
- canvas = new RenderArea;
- layout->addWidget(canvas);
+void InputTest::initializeWindow()
+{
+ QScopedPointer<QWidget> window(new QWidget);
+ QScopedPointer<QVBoxLayout> layout(new QVBoxLayout);
- deviceBox = new QComboBox(this);
+ m_canvas = new RenderArea(this);
+ layout->addWidget(m_canvas);
+
+ m_deviceBox = new QComboBox(this);
QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
for(int i = 0; i < devices.size(); ++i)
- deviceBox->addItem(devices.at(i).deviceName(), qVariantFromValue(devices.at(i)));
+ m_deviceBox->addItem(devices.at(i).deviceName(), qVariantFromValue(devices.at(i)));
- connect(deviceBox, SIGNAL(activated(int)), SLOT(deviceChanged(int)));
- layout->addWidget(deviceBox);
+ connect(m_deviceBox, SIGNAL(activated(int)), SLOT(deviceChanged(int)));
+ layout->addWidget(m_deviceBox);
- button = new QPushButton(this);
- button->setText(tr("Click for Push Mode"));
- connect(button, SIGNAL(clicked()), SLOT(toggleMode()));
- layout->addWidget(button);
+ m_modeButton = new QPushButton(this);
+ m_modeButton->setText(PushModeLabel);
+ connect(m_modeButton, SIGNAL(clicked()), SLOT(toggleMode()));
+ layout->addWidget(m_modeButton);
- button2 = new QPushButton(this);
- button2->setText(tr("Click To Suspend"));
- connect(button2, SIGNAL(clicked()), SLOT(toggleSuspend()));
- layout->addWidget(button2);
+ m_suspendResumeButton = new QPushButton(this);
+ m_suspendResumeButton->setText(SuspendLabel);
+ connect(m_suspendResumeButton, SIGNAL(clicked()), SLOT(toggleSuspend()));
+ layout->addWidget(m_suspendResumeButton);
- window->setLayout(layout);
- setCentralWidget(window);
- window->show();
+ window->setLayout(layout.data());
+ layout.take(); // ownership transferred
- buffer = new char[BUFFER_SIZE];
+ setCentralWidget(window.data());
+ QWidget *const windowPtr = window.take(); // ownership transferred
+ windowPtr->show();
+}
- pullMode = true;
+void InputTest::initializeAudio()
+{
+ m_pullMode = true;
- format.setFrequency(8000);
- format.setChannels(1);
- format.setSampleSize(16);
- format.setSampleType(QAudioFormat::SignedInt);
- format.setByteOrder(QAudioFormat::LittleEndian);
- format.setCodec("audio/pcm");
+ m_format.setFrequency(8000);
+ m_format.setChannels(1);
+ m_format.setSampleSize(16);
+ m_format.setSampleType(QAudioFormat::SignedInt);
+ m_format.setByteOrder(QAudioFormat::LittleEndian);
+ m_format.setCodec("audio/pcm");
QAudioDeviceInfo info(QAudioDeviceInfo::defaultInputDevice());
- if (!info.isFormatSupported(format)) {
- qWarning()<<"default format not supported try to use nearest";
- format = info.nearestFormat(format);
+ if (!info.isFormatSupported(m_format)) {
+ qWarning() << "Default format not supported - trying to use nearest";
+ m_format = info.nearestFormat(m_format);
}
- if(format.sampleSize() != 16) {
- qWarning()<<"audio device doesn't support 16 bit samples, example cannot run";
- audioInput = 0;
- button->setDisabled(true);
- button2->setDisabled(true);
- return;
- }
+ m_audioInfo = new AudioInfo(m_format, this);
+ connect(m_audioInfo, SIGNAL(update()), SLOT(refreshDisplay()));
- audioInput = new QAudioInput(format,this);
- connect(audioInput, SIGNAL(notify()), SLOT(status()));
- connect(audioInput, SIGNAL(stateChanged(QAudio::State)), SLOT(state(QAudio::State)));
- audioinfo = new AudioInfo(this,audioInput);
- connect(audioinfo, SIGNAL(update()), SLOT(refreshDisplay()));
- audioinfo->start();
- audioInput->start(audioinfo);
+ createAudioInput();
}
-InputTest::~InputTest() {}
+void InputTest::createAudioInput()
+{
+ m_audioInput = new QAudioInput(m_device, m_format, this);
+ connect(m_audioInput, SIGNAL(notify()), SLOT(notified()));
+ connect(m_audioInput, SIGNAL(stateChanged(QAudio::State)), SLOT(stateChanged(QAudio::State)));
+ m_audioInfo->start();
+ m_audioInput->start(m_audioInfo);
+}
-void InputTest::status()
+void InputTest::notified()
{
- qWarning()<<"bytesReady = "<<audioInput->bytesReady()<<" bytes, elapsedUSecs = "<<audioInput->elapsedUSecs()<<", processedUSecs = "<<audioInput->processedUSecs();
+ qWarning() << "bytesReady = " << m_audioInput->bytesReady()
+ << ", " << "elapsedUSecs = " <<m_audioInput->elapsedUSecs()
+ << ", " << "processedUSecs = "<<m_audioInput->processedUSecs();
}
void InputTest::readMore()
{
- if(!audioInput)
+ if(!m_audioInput)
return;
- qint64 len = audioInput->bytesReady();
+ qint64 len = m_audioInput->bytesReady();
if(len > 4096)
len = 4096;
- qint64 l = input->read(buffer,len);
+ qint64 l = m_input->read(m_buffer.data(), len);
if(l > 0) {
- audioinfo->write(buffer,l);
+ m_audioInfo->write(m_buffer.constData(), l);
}
}
void InputTest::toggleMode()
{
// Change bewteen pull and push modes
- audioInput->stop();
+ m_audioInput->stop();
- if (pullMode) {
- button->setText(tr("Click for Pull Mode"));
- input = audioInput->start();
- connect(input, SIGNAL(readyRead()), SLOT(readMore()));
- pullMode = false;
+ if (m_pullMode) {
+ m_modeButton->setText(PullModeLabel);
+ m_input = m_audioInput->start();
+ connect(m_input, SIGNAL(readyRead()), SLOT(readMore()));
+ m_pullMode = false;
} else {
- button->setText(tr("Click for Push Mode"));
- pullMode = true;
- audioInput->start(audioinfo);
+ m_modeButton->setText(PushModeLabel);
+ m_pullMode = true;
+ m_audioInput->start(m_audioInfo);
}
+
+ m_suspendResumeButton->setText(SuspendLabel);
}
void InputTest::toggleSuspend()
{
// toggle suspend/resume
- if(audioInput->state() == QAudio::SuspendedState) {
+ if(m_audioInput->state() == QAudio::SuspendedState) {
qWarning() << "status: Suspended, resume()";
- audioInput->resume();
- button2->setText("Click To Suspend");
- } else if (audioInput->state() == QAudio::ActiveState) {
+ m_audioInput->resume();
+ m_suspendResumeButton->setText(SuspendLabel);
+ } else if (m_audioInput->state() == QAudio::ActiveState) {
qWarning() << "status: Active, suspend()";
- audioInput->suspend();
- button2->setText("Click To Resume");
- } else if (audioInput->state() == QAudio::StoppedState) {
+ m_audioInput->suspend();
+ m_suspendResumeButton->setText(ResumeLabel);
+ } else if (m_audioInput->state() == QAudio::StoppedState) {
qWarning() << "status: Stopped, resume()";
- audioInput->resume();
- button2->setText("Click To Suspend");
- } else if (audioInput->state() == QAudio::IdleState) {
+ m_audioInput->resume();
+ m_suspendResumeButton->setText(SuspendLabel);
+ } else if (m_audioInput->state() == QAudio::IdleState) {
qWarning() << "status: IdleState";
}
}
-void InputTest::state(QAudio::State state)
+void InputTest::stateChanged(QAudio::State state)
{
- qWarning() << " state=" << state;
+ qWarning() << "state = " << state;
}
void InputTest::refreshDisplay()
{
- canvas->setLevel(audioinfo->LinearMax());
- canvas->repaint();
+ m_canvas->setLevel(m_audioInfo->level());
+ m_canvas->repaint();
}
-void InputTest::deviceChanged(int idx)
+void InputTest::deviceChanged(int index)
{
- audioinfo->stop();
- audioInput->stop();
- audioInput->disconnect(this);
- delete audioInput;
-
- device = deviceBox->itemData(idx).value<QAudioDeviceInfo>();
- audioInput = new QAudioInput(device, format, this);
- connect(audioInput, SIGNAL(notify()), SLOT(status()));
- connect(audioInput, SIGNAL(stateChanged(QAudio::State)), SLOT(state(QAudio::State)));
- audioinfo->start();
- audioInput->start(audioinfo);
+ m_audioInfo->stop();
+ m_audioInput->stop();
+ m_audioInput->disconnect(this);
+ delete m_audioInput;
+
+ m_device = m_deviceBox->itemData(index).value<QAudioDeviceInfo>();
+ createAudioInput();
}
diff --git a/examples/multimedia/audioinput/audioinput.h b/examples/multimedia/audioinput/audioinput.h
index abe2be1..f87c682 100644
--- a/examples/multimedia/audioinput/audioinput.h
+++ b/examples/multimedia/audioinput/audioinput.h
@@ -45,6 +45,7 @@
#include <QMainWindow>
#include <QPushButton>
#include <QComboBox>
+#include <QByteArray>
#include <qaudioinput.h>
@@ -52,21 +53,21 @@ class AudioInfo : public QIODevice
{
Q_OBJECT
public:
- AudioInfo(QObject *parent, QAudioInput *device);
+ AudioInfo(const QAudioFormat &format, QObject *parent);
~AudioInfo();
void start();
void stop();
- int LinearMax();
+ qreal level() const { return m_level; }
qint64 readData(char *data, qint64 maxlen);
qint64 writeData(const char *data, qint64 len);
- QAudioInput *input;
-
private:
- int m_maxValue;
+ const QAudioFormat m_format;
+ quint16 m_maxAmplitude;
+ qreal m_level; // 0.0 <= m_level <= 1.0
signals:
void update();
@@ -80,14 +81,14 @@ class RenderArea : public QWidget
public:
RenderArea(QWidget *parent = 0);
- void setLevel(int value);
+ void setLevel(qreal value);
protected:
void paintEvent(QPaintEvent *event);
private:
- int level;
- QPixmap pixmap;
+ qreal m_level;
+ QPixmap m_pixmap;
};
class InputTest : public QMainWindow
@@ -97,29 +98,38 @@ public:
InputTest();
~InputTest();
+private:
+ void initializeWindow();
+ void initializeAudio();
+ void createAudioInput();
+
private slots:
void refreshDisplay();
- void status();
+ void notified();
void readMore();
void toggleMode();
void toggleSuspend();
- void state(QAudio::State s);
- void deviceChanged(int idx);
+ void stateChanged(QAudio::State state);
+ void deviceChanged(int index);
private:
- AudioInfo *audioinfo;
- QAudioDeviceInfo device;
- QAudioFormat format;
- QAudioInput *audioInput;
- QIODevice *input;
- RenderArea *canvas;
-
- bool pullMode;
-
- QPushButton *button;
- QPushButton *button2;
- QComboBox *deviceBox;
-
- char *buffer;
+ // Owned by layout
+ RenderArea *m_canvas;
+ QPushButton *m_modeButton;
+ QPushButton *m_suspendResumeButton;
+ QComboBox *m_deviceBox;
+
+ AudioInfo *m_audioInfo;
+ QAudioDeviceInfo m_device;
+ QAudioFormat m_format;
+ QAudioInput *m_audioInput;
+ QIODevice *m_input;
+ bool m_pullMode;
+ QByteArray m_buffer;
+
+ static const QString PushModeLabel;
+ static const QString PullModeLabel;
+ static const QString SuspendLabel;
+ static const QString ResumeLabel;
};
diff --git a/examples/multimedia/audiooutput/audiooutput.cpp b/examples/multimedia/audiooutput/audiooutput.cpp
index b44accd..cbadf02 100644
--- a/examples/multimedia/audiooutput/audiooutput.cpp
+++ b/examples/multimedia/audiooutput/audiooutput.cpp
@@ -44,30 +44,34 @@
#include <QAudioOutput>
#include <QAudioDeviceInfo>
+#include <QtCore/qmath.h>
+#include <QtCore/qendian.h>
#include "audiooutput.h"
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
+const QString AudioTest::PushModeLabel(tr("Enable push mode"));
+const QString AudioTest::PullModeLabel(tr("Enable pull mode"));
+const QString AudioTest::SuspendLabel(tr("Suspend playback"));
+const QString AudioTest::ResumeLabel(tr("Resume playback"));
-#define SECONDS 1
-#define FREQ 600
-#define SYSTEM_FREQ 44100
+const int DurationSeconds = 1;
+const int ToneFrequencyHz = 600;
+const int DataFrequencyHz = 44100;
+const int BufferSize = 32768;
-Generator::Generator(QObject *parent)
- :QIODevice( parent )
+
+Generator::Generator(const QAudioFormat &format,
+ qint64 durationUs,
+ int frequency,
+ QObject *parent)
+ : QIODevice(parent)
+ , m_pos(0)
{
- finished = false;
- buffer = new char[SECONDS*SYSTEM_FREQ*4+1000];
- t=buffer;
- len=fillData(t,FREQ,SECONDS); /* mono FREQHz sine */
- pos = 0;
- total = len;
+ generateData(format, durationUs, frequency);
}
Generator::~Generator()
{
- delete [] buffer;
+
}
void Generator::start()
@@ -77,47 +81,65 @@ void Generator::start()
void Generator::stop()
{
+ m_pos = 0;
close();
}
-int Generator::putShort(char *t, unsigned int value)
+void Generator::generateData(const QAudioFormat &format, qint64 durationUs, int frequency)
{
- *(unsigned char *)(t++)=value&255;
- *(unsigned char *)(t)=(value/256)&255;
- return 2;
-}
-
-int Generator::fillData(char *start, int frequency, int seconds)
-{
- int i, len=0;
- int value;
- for(i=0; i<seconds*SYSTEM_FREQ; i++) {
- value=(int)(32767.0*sin(2.0*M_PI*((double)(i))*(double)(frequency)/SYSTEM_FREQ));
- putShort(start, value);
- start += 4;
- len+=2;
+ const int channelBytes = format.sampleSize() / 8;
+ const int sampleBytes = format.channels() * channelBytes;
+
+ qint64 length = (format.frequency() * format.channels() * (format.sampleSize() / 8))
+ * durationUs / 100000;
+
+ Q_ASSERT(length % sampleBytes == 0);
+ Q_UNUSED(sampleBytes) // suppress warning in release builds
+
+ m_buffer.resize(length);
+ unsigned char *ptr = reinterpret_cast<unsigned char *>(m_buffer.data());
+ int sampleIndex = 0;
+
+ while (length) {
+ const qreal x = qSin(2 * M_PI * frequency * qreal(sampleIndex % format.frequency()) / format.frequency());
+ for (int i=0; i<format.channels(); ++i) {
+ if (format.sampleSize() == 8 && format.sampleType() == QAudioFormat::UnSignedInt) {
+ const quint8 value = static_cast<quint8>((1.0 + x) / 2 * 255);
+ *reinterpret_cast<quint8*>(ptr) = value;
+ } else if (format.sampleSize() == 8 && format.sampleType() == QAudioFormat::SignedInt) {
+ const qint8 value = static_cast<qint8>(x * 127);
+ *reinterpret_cast<quint8*>(ptr) = value;
+ } else if (format.sampleSize() == 16 && format.sampleType() == QAudioFormat::UnSignedInt) {
+ quint16 value = static_cast<quint16>((1.0 + x) / 2 * 65535);
+ if (format.byteOrder() == QAudioFormat::LittleEndian)
+ qToLittleEndian<quint16>(value, ptr);
+ else
+ qToBigEndian<quint16>(value, ptr);
+ } else if (format.sampleSize() == 16 && format.sampleType() == QAudioFormat::SignedInt) {
+ qint16 value = static_cast<qint16>(x * 32767);
+ if (format.byteOrder() == QAudioFormat::LittleEndian)
+ qToLittleEndian<qint16>(value, ptr);
+ else
+ qToBigEndian<qint16>(value, ptr);
+ }
+
+ ptr += channelBytes;
+ length -= channelBytes;
+ }
+ ++sampleIndex;
}
- return len;
}
-qint64 Generator::readData(char *data, qint64 maxlen)
+qint64 Generator::readData(char *data, qint64 len)
{
- int len = maxlen;
- if (len > 16384)
- len = 16384;
-
- if (len < (SECONDS*SYSTEM_FREQ*2)-pos) {
- // Normal
- memcpy(data,t+pos,len);
- pos+=len;
- return len;
- } else {
- // Whats left and reset to start
- qint64 left = (SECONDS*SYSTEM_FREQ*2)-pos;
- memcpy(data,t+pos,left);
- pos=0;
- return left;
+ qint64 total = 0;
+ while (len - total) {
+ const qint64 chunk = qMin((m_buffer.size() - m_pos), len - total);
+ memcpy(data, m_buffer.constData() + m_pos, chunk);
+ m_pos = (m_pos + chunk) % m_buffer.size();
+ total += chunk;
}
+ return total;
}
qint64 Generator::writeData(const char *data, qint64 len)
@@ -128,158 +150,166 @@ qint64 Generator::writeData(const char *data, qint64 len)
return 0;
}
-AudioTest::AudioTest()
+qint64 Generator::bytesAvailable() const
{
- QWidget *window = new QWidget;
- QVBoxLayout* layout = new QVBoxLayout;
-
- deviceBox = new QComboBox(this);
- foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput))
- deviceBox->addItem(deviceInfo.deviceName(), qVariantFromValue(deviceInfo));
- connect(deviceBox,SIGNAL(activated(int)),SLOT(deviceChanged(int)));
- layout->addWidget(deviceBox);
-
- button = new QPushButton(this);
- button->setText(tr("Click for Push Mode"));
- connect(button,SIGNAL(clicked()),SLOT(toggle()));
- layout->addWidget(button);
-
- button2 = new QPushButton(this);
- button2->setText(tr("Click To Suspend"));
- connect(button2,SIGNAL(clicked()),SLOT(togglePlay()));
- layout->addWidget(button2);
-
- window->setLayout(layout);
- setCentralWidget(window);
- window->show();
+ return m_buffer.size() + QIODevice::bytesAvailable();
+}
- buffer = new char[BUFFER_SIZE];
+AudioTest::AudioTest()
+ : m_pullTimer(new QTimer(this))
+ , m_modeButton(0)
+ , m_suspendResumeButton(0)
+ , m_deviceBox(0)
+ , m_device(QAudioDeviceInfo::defaultOutputDevice())
+ , m_generator(0)
+ , m_audioOutput(0)
+ , m_output(0)
+ , m_buffer(BufferSize, 0)
+{
+ initializeWindow();
+ initializeAudio();
+}
- gen = new Generator(this);
+void AudioTest::initializeWindow()
+{
+ QScopedPointer<QWidget> window(new QWidget);
+ QScopedPointer<QVBoxLayout> layout(new QVBoxLayout);
- pullMode = true;
+ m_deviceBox = new QComboBox(this);
+ foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput))
+ m_deviceBox->addItem(deviceInfo.deviceName(), qVariantFromValue(deviceInfo));
+ connect(m_deviceBox,SIGNAL(activated(int)),SLOT(deviceChanged(int)));
+ layout->addWidget(m_deviceBox);
+
+ m_modeButton = new QPushButton(this);
+ m_modeButton->setText(PushModeLabel);
+ connect(m_modeButton, SIGNAL(clicked()), SLOT(toggleMode()));
+ layout->addWidget(m_modeButton);
+
+ m_suspendResumeButton = new QPushButton(this);
+ m_suspendResumeButton->setText(SuspendLabel);
+ connect(m_suspendResumeButton, SIGNAL(clicked()), SLOT(toggleSuspendResume()));
+ layout->addWidget(m_suspendResumeButton);
+
+ window->setLayout(layout.data());
+ layout.take(); // ownership transferred
+
+ setCentralWidget(window.data());
+ QWidget *const windowPtr = window.take(); // ownership transferred
+ windowPtr->show();
+}
- timer = new QTimer(this);
- connect(timer,SIGNAL(timeout()),SLOT(writeMore()));
+void AudioTest::initializeAudio()
+{
+ connect(m_pullTimer, SIGNAL(timeout()), SLOT(pullTimerExpired()));
- gen->start();
+ m_pullMode = true;
- settings.setFrequency(SYSTEM_FREQ);
- settings.setChannels(1);
- settings.setSampleSize(16);
- settings.setCodec("audio/pcm");
- settings.setByteOrder(QAudioFormat::LittleEndian);
- settings.setSampleType(QAudioFormat::SignedInt);
+ m_format.setFrequency(DataFrequencyHz);
+ m_format.setChannels(1);
+ m_format.setSampleSize(16);
+ m_format.setCodec("audio/pcm");
+ m_format.setByteOrder(QAudioFormat::LittleEndian);
+ m_format.setSampleType(QAudioFormat::SignedInt);
QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice());
- if (!info.isFormatSupported(settings)) {
- qWarning()<<"default format not supported try to use nearest";
- settings = info.nearestFormat(settings);
+ if (!info.isFormatSupported(m_format)) {
+ qWarning() << "Default format not supported - trying to use nearest";
+ m_format = info.nearestFormat(m_format);
}
- if(settings.sampleSize() != 16) {
- qWarning()<<"audio device doesn't support 16 bit samples, example cannot run";
- button->setDisabled(true);
- button2->setDisabled(true);
- audioOutput = 0;
- return;
- }
+ m_generator = new Generator(m_format, DurationSeconds*1000000, ToneFrequencyHz, this);
- audioOutput = new QAudioOutput(settings,this);
- connect(audioOutput,SIGNAL(notify()),SLOT(status()));
- connect(audioOutput,SIGNAL(stateChanged(QAudio::State)),SLOT(state(QAudio::State)));
+ createAudioOutput();
+}
- audioOutput->start(gen);
+void AudioTest::createAudioOutput()
+{
+ delete m_audioOutput;
+ m_audioOutput = 0;
+ m_audioOutput = new QAudioOutput(m_device, m_format, this);
+ connect(m_audioOutput, SIGNAL(notify()), SLOT(notified()));
+ connect(m_audioOutput, SIGNAL(stateChanged(QAudio::State)), SLOT(stateChanged(QAudio::State)));
+ m_generator->start();
+ m_audioOutput->start(m_generator);
}
AudioTest::~AudioTest()
{
- delete [] buffer;
+
}
-void AudioTest::deviceChanged(int idx)
+void AudioTest::deviceChanged(int index)
{
- timer->stop();
- gen->stop();
- audioOutput->stop();
- audioOutput->disconnect(this);
- delete audioOutput;
-
- device = deviceBox->itemData(idx).value<QAudioDeviceInfo>();
- audioOutput = new QAudioOutput(device,settings,this);
- connect(audioOutput,SIGNAL(notify()),SLOT(status()));
- connect(audioOutput,SIGNAL(stateChanged(QAudio::State)),SLOT(state(QAudio::State)));
- gen->start();
- audioOutput->start(gen);
+ m_pullTimer->stop();
+ m_generator->stop();
+ m_audioOutput->stop();
+ m_audioOutput->disconnect(this);
+ m_device = m_deviceBox->itemData(index).value<QAudioDeviceInfo>();
+ createAudioOutput();
}
-void AudioTest::status()
+void AudioTest::notified()
{
- qWarning() << "byteFree = " << audioOutput->bytesFree() << " bytes, elapsedUSecs = " << audioOutput->elapsedUSecs() << ", processedUSecs = " << audioOutput->processedUSecs();
+ qWarning() << "bytesFree = " << m_audioOutput->bytesFree()
+ << ", " << "elapsedUSecs = " << m_audioOutput->elapsedUSecs()
+ << ", " << "processedUSecs = " << m_audioOutput->processedUSecs();
}
-void AudioTest::writeMore()
+void AudioTest::pullTimerExpired()
{
- if (!audioOutput)
- return;
-
- if (audioOutput->state() == QAudio::StoppedState)
- return;
-
- int l;
- int out;
-
- int chunks = audioOutput->bytesFree()/audioOutput->periodSize();
- while(chunks) {
- l = gen->read(buffer,audioOutput->periodSize());
- if (l > 0)
- out = output->write(buffer,l);
- if (l != audioOutput->periodSize())
- break;
- chunks--;
+ if (m_audioOutput && m_audioOutput->state() != QAudio::StoppedState) {
+ int chunks = m_audioOutput->bytesFree()/m_audioOutput->periodSize();
+ while (chunks) {
+ const qint64 len = m_generator->read(m_buffer.data(), m_audioOutput->periodSize());
+ if (len)
+ m_output->write(m_buffer.data(), len);
+ if (len != m_audioOutput->periodSize())
+ break;
+ --chunks;
+ }
}
}
-void AudioTest::toggle()
+void AudioTest::toggleMode()
{
- // Change between pull and push modes
-
- timer->stop();
- audioOutput->stop();
-
- if (pullMode) {
- button->setText("Click for Pull Mode");
- output = audioOutput->start();
- pullMode = false;
- timer->start(20);
+ m_pullTimer->stop();
+ m_audioOutput->stop();
+
+ if (m_pullMode) {
+ m_modeButton->setText(PullModeLabel);
+ m_output = m_audioOutput->start();
+ m_pullMode = false;
+ m_pullTimer->start(20);
} else {
- button->setText("Click for Push Mode");
- pullMode = true;
- audioOutput->start(gen);
+ m_modeButton->setText(PushModeLabel);
+ m_pullMode = true;
+ m_audioOutput->start(m_generator);
}
+
+ m_suspendResumeButton->setText(SuspendLabel);
}
-void AudioTest::togglePlay()
+void AudioTest::toggleSuspendResume()
{
- // toggle suspend/resume
- if (audioOutput->state() == QAudio::SuspendedState) {
+ if (m_audioOutput->state() == QAudio::SuspendedState) {
qWarning() << "status: Suspended, resume()";
- audioOutput->resume();
- button2->setText("Click To Suspend");
- } else if (audioOutput->state() == QAudio::ActiveState) {
+ m_audioOutput->resume();
+ m_suspendResumeButton->setText(SuspendLabel);
+ } else if (m_audioOutput->state() == QAudio::ActiveState) {
qWarning() << "status: Active, suspend()";
- audioOutput->suspend();
- button2->setText("Click To Resume");
- } else if (audioOutput->state() == QAudio::StoppedState) {
+ m_audioOutput->suspend();
+ m_suspendResumeButton->setText(ResumeLabel);
+ } else if (m_audioOutput->state() == QAudio::StoppedState) {
qWarning() << "status: Stopped, resume()";
- audioOutput->resume();
- button2->setText("Click To Suspend");
- } else if (audioOutput->state() == QAudio::IdleState) {
+ m_audioOutput->resume();
+ m_suspendResumeButton->setText(SuspendLabel);
+ } else if (m_audioOutput->state() == QAudio::IdleState) {
qWarning() << "status: IdleState";
}
}
-void AudioTest::state(QAudio::State state)
+void AudioTest::stateChanged(QAudio::State state)
{
- qWarning() << " state=" << state;
+ qWarning() << "state = " << state;
}
diff --git a/examples/multimedia/audiooutput/audiooutput.h b/examples/multimedia/audiooutput/audiooutput.h
index 372cf78..889482b 100644
--- a/examples/multimedia/audiooutput/audiooutput.h
+++ b/examples/multimedia/audiooutput/audiooutput.h
@@ -41,14 +41,13 @@
#include <math.h>
-#define BUFFER_SIZE 32768
-
#include <QObject>
#include <QMainWindow>
#include <QIODevice>
#include <QTimer>
#include <QPushButton>
#include <QComboBox>
+#include <QByteArray>
#include <QAudioOutput>
@@ -56,26 +55,22 @@ class Generator : public QIODevice
{
Q_OBJECT
public:
- Generator(QObject *parent);
+ Generator(const QAudioFormat &format, qint64 durationUs, int frequency, QObject *parent);
~Generator();
void start();
void stop();
- char *t;
- int len;
- int pos;
- int total;
- char *buffer;
- bool finished;
- int chunk_size;
-
qint64 readData(char *data, qint64 maxlen);
qint64 writeData(const char *data, qint64 len);
+ qint64 bytesAvailable() const;
private:
- int putShort(char *t, unsigned int value);
- int fillData(char *start, int frequency, int seconds);
+ void generateData(const QAudioFormat &format, qint64 durationUs, int frequency);
+
+private:
+ qint64 m_pos;
+ QByteArray m_buffer;
};
class AudioTest : public QMainWindow
@@ -85,26 +80,39 @@ public:
AudioTest();
~AudioTest();
- QAudioDeviceInfo device;
- Generator* gen;
- QAudioOutput* audioOutput;
- QIODevice* output;
- QTimer* timer;
- QAudioFormat settings;
+private:
+ void initializeWindow();
+ void initializeAudio();
+ void createAudioOutput();
+
+private:
+ QTimer* m_pullTimer;
+
+ // Owned by layout
+ QPushButton* m_modeButton;
+ QPushButton* m_suspendResumeButton;
+ QComboBox* m_deviceBox;
+
+ QAudioDeviceInfo m_device;
+ Generator* m_generator;
+ QAudioOutput* m_audioOutput;
+ QIODevice* m_output; // not owned
+ QAudioFormat m_format;
- bool pullMode;
- char* buffer;
+ bool m_pullMode;
+ QByteArray m_buffer;
- QPushButton* button;
- QPushButton* button2;
- QComboBox* deviceBox;
+ static const QString PushModeLabel;
+ static const QString PullModeLabel;
+ static const QString SuspendLabel;
+ static const QString ResumeLabel;
private slots:
- void status();
- void writeMore();
- void toggle();
- void togglePlay();
- void state(QAudio::State s);
- void deviceChanged(int idx);
+ void notified();
+ void pullTimerExpired();
+ void toggleMode();
+ void toggleSuspendResume();
+ void stateChanged(QAudio::State state);
+ void deviceChanged(int index);
};
diff --git a/examples/network/http/httpwindow.cpp b/examples/network/http/httpwindow.cpp
index 95fc82f..ec7cd33 100644
--- a/examples/network/http/httpwindow.cpp
+++ b/examples/network/http/httpwindow.cpp
@@ -49,9 +49,9 @@ HttpWindow::HttpWindow(QWidget *parent)
: QDialog(parent)
{
#ifndef QT_NO_OPENSSL
- urlLineEdit = new QLineEdit("https://");
+ urlLineEdit = new QLineEdit("https://qt.nokia.com/");
#else
- urlLineEdit = new QLineEdit("http://");
+ urlLineEdit = new QLineEdit("http://qt.nokia.com/");
#endif
urlLabel = new QLabel(tr("&URL:"));
@@ -70,21 +70,14 @@ HttpWindow::HttpWindow(QWidget *parent)
progressDialog = new QProgressDialog(this);
- http = new QHttp(this);
-
connect(urlLineEdit, SIGNAL(textChanged(QString)),
this, SLOT(enableDownloadButton()));
- connect(http, SIGNAL(requestFinished(int,bool)),
- this, SLOT(httpRequestFinished(int,bool)));
- connect(http, SIGNAL(dataReadProgress(int,int)),
- this, SLOT(updateDataReadProgress(int,int)));
- connect(http, SIGNAL(responseHeaderReceived(QHttpResponseHeader)),
- this, SLOT(readResponseHeader(QHttpResponseHeader)));
- connect(http, SIGNAL(authenticationRequired(QString,quint16,QAuthenticator*)),
- this, SLOT(slotAuthenticationRequired(QString,quint16,QAuthenticator*)));
+
+ connect(&qnam, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)),
+ this, SLOT(slotAuthenticationRequired(QNetworkReply*,QAuthenticator*)));
#ifndef QT_NO_OPENSSL
- connect(http, SIGNAL(sslErrors(QList<QSslError>)),
- this, SLOT(sslErrors(QList<QSslError>)));
+ connect(&qnam, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)),
+ this, SLOT(sslErrors(QNetworkReply*,QList<QSslError>)));
#endif
connect(progressDialog, SIGNAL(canceled()), this, SLOT(cancelDownload()));
connect(downloadButton, SIGNAL(clicked()), this, SLOT(downloadFile()));
@@ -104,9 +97,21 @@ HttpWindow::HttpWindow(QWidget *parent)
urlLineEdit->setFocus();
}
+void HttpWindow::startRequest(QUrl url)
+{
+ reply = qnam.get(QNetworkRequest(url));
+ connect(reply, SIGNAL(finished()),
+ this, SLOT(httpFinished()));
+ connect(reply, SIGNAL(readyRead()),
+ this, SLOT(httpReadyRead()));
+ connect(reply, SIGNAL(downloadProgress(qint64,qint64)),
+ this, SLOT(updateDataReadProgress(qint64,qint64)));
+}
+
void HttpWindow::downloadFile()
{
- QUrl url(urlLineEdit->text());
+ url = urlLineEdit->text();
+
QFileInfo fileInfo(url.path());
QString fileName = fileInfo.fileName();
if (fileName.isEmpty())
@@ -132,35 +137,26 @@ void HttpWindow::downloadFile()
return;
}
- QHttp::ConnectionMode mode = url.scheme().toLower() == "https" ? QHttp::ConnectionModeHttps : QHttp::ConnectionModeHttp;
- http->setHost(url.host(), mode, url.port() == -1 ? 0 : url.port());
-
- if (!url.userName().isEmpty())
- http->setUser(url.userName(), url.password());
-
- httpRequestAborted = false;
- QByteArray path = QUrl::toPercentEncoding(url.path(), "!$&'()*+,;=:@/");
- if (path.isEmpty())
- path = "/";
- httpGetId = http->get(path, file);
progressDialog->setWindowTitle(tr("HTTP"));
progressDialog->setLabelText(tr("Downloading %1.").arg(fileName));
downloadButton->setEnabled(false);
+
+ // schedule the request
+ httpRequestAborted = false;
+ startRequest(url);
}
void HttpWindow::cancelDownload()
{
statusLabel->setText(tr("Download canceled."));
httpRequestAborted = true;
- http->abort();
+ reply->abort();
downloadButton->setEnabled(true);
}
-void HttpWindow::httpRequestFinished(int requestId, bool error)
+void HttpWindow::httpFinished()
{
- if (requestId != httpGetId)
- return;
if (httpRequestAborted) {
if (file) {
file->close();
@@ -168,54 +164,58 @@ void HttpWindow::httpRequestFinished(int requestId, bool error)
delete file;
file = 0;
}
-
+ reply->deleteLater();
progressDialog->hide();
return;
}
- if (requestId != httpGetId)
- return;
-
progressDialog->hide();
+ file->flush();
file->close();
- if (error) {
+
+ QVariant redirectionTarget = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
+ if (reply->error()) {
file->remove();
QMessageBox::information(this, tr("HTTP"),
tr("Download failed: %1.")
- .arg(http->errorString()));
+ .arg(reply->errorString()));
+ downloadButton->setEnabled(true);
+ } else if (!redirectionTarget.isNull()) {
+ QUrl newUrl = url.resolved(redirectionTarget.toUrl());
+ if (QMessageBox::question(this, tr("HTTP"),
+ tr("Redirect to %1 ?").arg(newUrl.toString()),
+ QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
+ url = newUrl;
+ reply->deleteLater();
+ file->open(QIODevice::WriteOnly);
+ file->resize(0);
+ startRequest(url);
+ return;
+ }
} else {
QString fileName = QFileInfo(QUrl(urlLineEdit->text()).path()).fileName();
statusLabel->setText(tr("Downloaded %1 to current directory.").arg(fileName));
+ downloadButton->setEnabled(true);
}
- downloadButton->setEnabled(true);
+ reply->deleteLater();
+ reply = 0;
delete file;
file = 0;
}
-void HttpWindow::readResponseHeader(const QHttpResponseHeader &responseHeader)
+void HttpWindow::httpReadyRead()
{
- switch (responseHeader.statusCode()) {
- case 200: // Ok
- case 301: // Moved Permanently
- case 302: // Found
- case 303: // See Other
- case 307: // Temporary Redirect
- // these are not error conditions
- break;
-
- default:
- QMessageBox::information(this, tr("HTTP"),
- tr("Download failed: %1.")
- .arg(responseHeader.reasonPhrase()));
- httpRequestAborted = true;
- progressDialog->hide();
- http->abort();
- }
+ // this slot gets called everytime the QNetworkReply has new data.
+ // We read all of its new data and write it into the file.
+ // That way we use less RAM than when reading it at the finished()
+ // signal of the QNetworkReply
+ if (file)
+ file->write(reply->readAll());
}
-void HttpWindow::updateDataReadProgress(int bytesRead, int totalBytes)
+void HttpWindow::updateDataReadProgress(qint64 bytesRead, qint64 totalBytes)
{
if (httpRequestAborted)
return;
@@ -229,14 +229,19 @@ void HttpWindow::enableDownloadButton()
downloadButton->setEnabled(!urlLineEdit->text().isEmpty());
}
-void HttpWindow::slotAuthenticationRequired(const QString &hostName, quint16, QAuthenticator *authenticator)
+void HttpWindow::slotAuthenticationRequired(QNetworkReply*,QAuthenticator *authenticator)
{
QDialog dlg;
Ui::Dialog ui;
ui.setupUi(&dlg);
dlg.adjustSize();
- ui.siteDescription->setText(tr("%1 at %2").arg(authenticator->realm()).arg(hostName));
-
+ ui.siteDescription->setText(tr("%1 at %2").arg(authenticator->realm()).arg(url.host()));
+
+ // Did the URL have information? Fill the UI
+ // This is only relevant if the URL-supplied credentials were wrong
+ ui.userEdit->setText(url.userName());
+ ui.passwordEdit->setText(url.password());
+
if (dlg.exec() == QDialog::Accepted) {
authenticator->setUser(ui.userEdit->text());
authenticator->setPassword(ui.passwordEdit->text());
@@ -244,7 +249,7 @@ void HttpWindow::slotAuthenticationRequired(const QString &hostName, quint16, QA
}
#ifndef QT_NO_OPENSSL
-void HttpWindow::sslErrors(const QList<QSslError> &errors)
+void HttpWindow::sslErrors(QNetworkReply*,const QList<QSslError> &errors)
{
QString errorString;
foreach (const QSslError &error, errors) {
@@ -253,10 +258,10 @@ void HttpWindow::sslErrors(const QList<QSslError> &errors)
errorString += error.errorString();
}
- if (QMessageBox::warning(this, tr("HTTP Example"),
+ if (QMessageBox::warning(this, tr("HTTP"),
tr("One or more SSL errors has occurred: %1").arg(errorString),
QMessageBox::Ignore | QMessageBox::Abort) == QMessageBox::Ignore) {
- http->ignoreSslErrors();
+ reply->ignoreSslErrors();
}
}
#endif
diff --git a/examples/network/http/httpwindow.h b/examples/network/http/httpwindow.h
index 9dca8a5..83898af 100644
--- a/examples/network/http/httpwindow.h
+++ b/examples/network/http/httpwindow.h
@@ -43,18 +43,21 @@
#define HTTPWINDOW_H
#include <QDialog>
+#include <QNetworkAccessManager>
+#include <QUrl>
QT_BEGIN_NAMESPACE
class QDialogButtonBox;
class QFile;
-class QHttp;
-class QHttpResponseHeader;
class QLabel;
class QLineEdit;
class QProgressDialog;
class QPushButton;
class QSslError;
class QAuthenticator;
+class QNetworkReply;
+
+
QT_END_NAMESPACE
class HttpWindow : public QDialog
@@ -64,16 +67,18 @@ class HttpWindow : public QDialog
public:
HttpWindow(QWidget *parent = 0);
+ void startRequest(QUrl url);
+
private slots:
void downloadFile();
void cancelDownload();
- void httpRequestFinished(int requestId, bool error);
- void readResponseHeader(const QHttpResponseHeader &responseHeader);
- void updateDataReadProgress(int bytesRead, int totalBytes);
+ void httpFinished();
+ void httpReadyRead();
+ void updateDataReadProgress(qint64 bytesRead, qint64 totalBytes);
void enableDownloadButton();
- void slotAuthenticationRequired(const QString &, quint16, QAuthenticator *);
+ void slotAuthenticationRequired(QNetworkReply*,QAuthenticator *);
#ifndef QT_NO_OPENSSL
- void sslErrors(const QList<QSslError> &errors);
+ void sslErrors(QNetworkReply*,const QList<QSslError> &errors);
#endif
private:
@@ -85,7 +90,9 @@ private:
QPushButton *quitButton;
QDialogButtonBox *buttonBox;
- QHttp *http;
+ QUrl url;
+ QNetworkAccessManager qnam;
+ QNetworkReply *reply;
QFile *file;
int httpGetId;
bool httpRequestAborted;
diff --git a/examples/network/http/main.cpp b/examples/network/http/main.cpp
index ecbe100..817b2be 100644
--- a/examples/network/http/main.cpp
+++ b/examples/network/http/main.cpp
@@ -46,7 +46,6 @@
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
- qWarning("The usage of QHttp is not recommended anymore, please use QNetworkAccessManager.");
HttpWindow httpWin;
httpWin.show();
return httpWin.exec();
diff --git a/examples/network/loopback/dialog.cpp b/examples/network/loopback/dialog.cpp
index 27cff31..b504e36 100644
--- a/examples/network/loopback/dialog.cpp
+++ b/examples/network/loopback/dialog.cpp
@@ -44,12 +44,12 @@
#include "dialog.h"
-#if !defined(Q_OS_WINCE)
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
static const int TotalBytes = 50 * 1024 * 1024;
#else
static const int TotalBytes = 5 * 1024 * 1024;
#endif
-static const int PayloadSize = 65536;
+static const int PayloadSize = 64 * 1024; // 64 KB
Dialog::Dialog(QWidget *parent)
: QDialog(parent)
@@ -130,6 +130,7 @@ void Dialog::acceptConnection()
void Dialog::startTransfer()
{
+ // called when the TCP client connected to the loopback server
bytesToWrite = TotalBytes - (int)tcpClient.write(QByteArray(PayloadSize, '@'));
clientStatusLabel->setText(tr("Connected"));
}
@@ -155,8 +156,11 @@ void Dialog::updateServerProgress()
void Dialog::updateClientProgress(qint64 numBytes)
{
+ // callen when the TCP client has written some bytes
bytesWritten += (int)numBytes;
- if (bytesToWrite > 0)
+
+ // only write more if not finished and when the Qt write buffer is below a certain size.
+ if (bytesToWrite > 0 && tcpClient.bytesToWrite() <= 4*PayloadSize)
bytesToWrite -= (int)tcpClient.write(QByteArray(qMin(bytesToWrite, PayloadSize), '@'));
clientProgressBar->setMaximum(TotalBytes);
diff --git a/header.BSD b/header.BSD
new file mode 100644
index 0000000..3c0d604
--- /dev/null
+++ b/header.BSD
@@ -0,0 +1,40 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the FOO module of the Qt Toolkit.
+**
+** $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/qmake/generators/symbian/epocroot.h b/header.LGPL
index be26438..4fbd874 100644
--- a/qmake/generators/symbian/epocroot.h
+++ b/header.LGPL
@@ -4,7 +4,7 @@
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the qmake application of the Qt Toolkit.
+** This file is part of the FOO module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
@@ -39,13 +39,3 @@
**
****************************************************************************/
-#ifndef EPOCROOT_H
-#define EPOCROOT_H
-
-#include <qstring.h>
-
-// Implementation of epocRoot method is in initprojectdeploy_symbian.cpp
-// Defined in separate header for inclusion clarity
-extern QString epocRoot();
-
-#endif // EPOCROOT_H
diff --git a/header.LGPL-ONLY b/header.LGPL-ONLY
new file mode 100644
index 0000000..59b4c04
--- /dev/null
+++ b/header.LGPL-ONLY
@@ -0,0 +1,22 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the FOO module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL-ONLY$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf
index 6113746..7b2ee91 100644
--- a/mkspecs/common/symbian/symbian.conf
+++ b/mkspecs/common/symbian/symbian.conf
@@ -75,15 +75,7 @@ QMAKE_LIBS_COMPAT =
QMAKE_LIBS_QT_ENTRY = -llibcrt0.lib
QMAKE_LIBS_S60 = -lavkon
-!isEmpty(QMAKE_SH) {
- QMAKE_COPY = cp
- QMAKE_COPY_DIR = cp -r
- QMAKE_MOVE = mv
- QMAKE_DEL_FILE = rm -f
- QMAKE_MKDIR = mkdir
- QMAKE_DEL_DIR = rmdir
- QMAKE_CHK_DIR_EXISTS = test -d
-} else {
+contains(QMAKE_HOST.os,Windows) {
QMAKE_COPY = copy /y
QMAKE_COPY_DIR = xcopy /s /q /y /i
QMAKE_MOVE = move
@@ -91,6 +83,14 @@ QMAKE_LIBS_S60 = -lavkon
QMAKE_MKDIR = mkdir
QMAKE_DEL_DIR = rmdir
QMAKE_CHK_DIR_EXISTS = if not exist
+} else {
+ QMAKE_COPY = cp
+ QMAKE_COPY_DIR = cp -r
+ QMAKE_MOVE = mv
+ QMAKE_DEL_FILE = rm -f
+ QMAKE_MKDIR = mkdir
+ QMAKE_DEL_DIR = rmdir
+ QMAKE_CHK_DIR_EXISTS = test -d
}
QMAKE_MOC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}moc.exe
diff --git a/mkspecs/features/qttest_p4.prf b/mkspecs/features/qttest_p4.prf
index e0b22f2..53c0d74 100644
--- a/mkspecs/features/qttest_p4.prf
+++ b/mkspecs/features/qttest_p4.prf
@@ -20,12 +20,32 @@ check.path = .
macx: check.commands += ./$(QMAKE_TARGET).app/Contents/MacOS/$(QMAKE_TARGET)
else:unix: check.commands += ./$(QMAKE_TARGET)
else:win32: {
- CONFIG(debug, debug|release):check.commands += debug\\$(QMAKE_TARGET)
- else:check.commands += release\\$(QMAKE_TARGET)
+ CONFIG(debug, debug|release):check.commands += $(DESTDIR_TARGET)
+ else:check.commands += $(DESTDIR_TARGET)
}
embedded: check.commands += -qws
QMAKE_EXTRA_TARGETS += check
+!debug_and_release|build_pass {
+ check.depends = $(DESTDIR_TARGET)
+} else {
+ check.CONFIG = recursive
+ # In debug and release mode, only run the test once.
+ # Run debug if available, release otherwise.
+ debug_and_release {
+ check.target = dummy_check
+ check.recurse_target = check
+ debug {
+ real_check.depends = debug-check
+ real_check.target = check
+ QMAKE_EXTRA_TARGETS += real_check
+ } else {
+ real_check.depends = release-check
+ real_check.target = check
+ QMAKE_EXTRA_TARGETS += real_check
+ }
+ }
+}
target.path += $$[QT_INSTALL_PREFIX]/tests/qt4
INSTALLS += target
diff --git a/mkspecs/features/symbian/stl.prf b/mkspecs/features/symbian/stl.prf
index e21ee5c..85c758a 100644
--- a/mkspecs/features/symbian/stl.prf
+++ b/mkspecs/features/symbian/stl.prf
@@ -15,11 +15,18 @@ INCLUDEPATH += $$OS_LAYER_STDCPP_SYSTEMINCLUDE
INCLUDEPATH -= $$[QT_INSTALL_PREFIX]/mkspecs/common/symbian/stl-off
# libstdcppv5 is preferred over libstdcpp as it has/uses the throwing version of operator new
-exists($${EPOCROOT}epoc32/release/armv5/urel/libstdcppv5.dll)|exists($${EPOCROOT}epoc32/release/winscw/udeb/libstdcppv5.dll) {
- LIBS *= -llibstdcppv5.dll
+STL_LIB = -llibstdcppv5.dll
- # STDCPP turns on standard C++ new behaviour (ie. throwing new)
- MMP_RULES += "STDCPP"
-} else {
- LIBS *= -llibstdcpp.dll
+# STDCPP turns on standard C++ new behaviour (ie. throwing new)
+STL_MMP_RULE = "STDCPP"
+
+# Fall back to old implementation if that is the only one that is found
+exists($${EPOCROOT}epoc32/release/armv5/urel/libstdcpp.dll)|exists($${EPOCROOT}epoc32/release/winscw/udeb/libstdcpp.dll) {
+ !exists($${EPOCROOT}epoc32/release/armv5/urel/libstdcppv5.dll):!exists($${EPOCROOT}epoc32/release/winscw/udeb/libstdcppv5.dll) {
+ STL_LIB = -llibstdcpp.dll
+ STL_MMP_RULE =
+ }
}
+
+LIBS *= $$STL_LIB
+MMP_RULES *= $$STL_MMP_RULE
diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix
index fcf43c8..d4f5849 100644
--- a/qmake/Makefile.unix
+++ b/qmake/Makefile.unix
@@ -10,7 +10,9 @@ OBJS=project.o property.o main.o makefile.o unixmake2.o unixmake.o \
mingw_make.o option.o winmakefile.o projectgenerator.o \
meta.o makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o \
borland_bmake.o msvc_dsp.o msvc_vcproj.o msvc_nmake.o msvc_objectmodel.o \
- symmake.o initprojectdeploy_symbian.o symmake_abld.o symmake_sbsv2.o
+ symmake.o initprojectdeploy_symbian.o symmake_abld.o symmake_sbsv2.o \
+ registry.o \
+ epocroot.o
#qt code
QOBJS=qtextcodec.o qutfcodec.o qstring.o qtextstream.o qiodevice.o qmalloc.o qglobal.o \
@@ -32,6 +34,8 @@ DEPEND_SRC=project.cpp property.cpp meta.cpp main.cpp generators/makefile.cpp ge
generators/makefiledeps.cpp option.cpp generators/win32/mingw_make.cpp generators/makefile.cpp \
generators/win32/msvc_objectmodel.cpp generators/win32/msvc_nmake.cpp generators/win32/borland_bmake.cpp \
generators/symbian/symmake.cpp generators/symbian/initprojectdeploy_symbian.cpp \
+ $(SOURCE_PATH)/tools/shared/windows/registry.cpp \
+ $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp \
generators/symbian/symmake_abld.cpp generators/symbian/symmake_sbsv2.cpp \
$(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp \
$(SOURCE_PATH)/src/corelib/tools/qstring.cpp $(SOURCE_PATH)/src/corelib/io/qfile.cpp \
@@ -62,6 +66,7 @@ DEPEND_SRC=project.cpp property.cpp meta.cpp main.cpp generators/makefile.cpp ge
CPPFLAGS = -I. -Igenerators -Igenerators/unix -Igenerators/win32 -Igenerators/mac -Igenerators/symbian \
-I$(BUILD_PATH)/include -I$(BUILD_PATH)/include/QtCore \
-I$(BUILD_PATH)/src/corelib/global -I$(BUILD_PATH)/src/corelib/xml \
+ -I$(SOURCE_PATH)/tools/shared \
-DQT_NO_PCRE \
-DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED \
-DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_STL \
@@ -281,6 +286,12 @@ symmake_sbsv2.o: generators/symbian/symmake_sbsv2.cpp
initprojectdeploy_symbian.o: generators/symbian/initprojectdeploy_symbian.cpp
$(CXX) -c -o $@ $(CXXFLAGS) generators/symbian/initprojectdeploy_symbian.cpp
+registry.o: $(SOURCE_PATH)/tools/shared/windows/registry.cpp
+ $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/tools/shared/windows/registry.cpp
+
+epocroot.o: $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp
+ $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp
+
projectgenerator.o: generators/projectgenerator.cpp
$(CXX) -c -o $@ $(CXXFLAGS) generators/projectgenerator.cpp
@@ -289,6 +300,7 @@ qxmlstream.o: $(SOURCE_PATH)/src/corelib/xml/qxmlstream.cpp
qxmlutils.o: $(SOURCE_PATH)/src/corelib/xml/qxmlutils.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/xml/qxmlutils.cpp
+
#default rules
.cpp.o:
$(CXX) -c -o $@ $(CXXFLAGS) $<
diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32
index e6bbcd5..48d84b7 100644
--- a/qmake/Makefile.win32
+++ b/qmake/Makefile.win32
@@ -34,6 +34,7 @@ CFLAGS = -c -Fo$@ \
-I$(BUILD_PATH)\src\corelib\global \
-I$(BUILD_PATH)\src\corelib\xml \
-I$(SOURCE_PATH)\mkspecs\$(QMAKESPEC) \
+ -I$(SOURCE_PATH)\tools\shared \
-DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NODLL -DQT_NO_STL \
-DQT_NO_COMPRESS -DUNICODE -DHAVE_QCONFIG_CPP -DQT_BUILD_QMAKE -DQT_NO_THREAD \
-DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM -DQT_NO_PCRE -DQT_BOOTSTRAPPED \
@@ -59,6 +60,7 @@ CFLAGS = -c -o$@ \
-I$(SOURCE_PATH)\include -I$(SOURCE_PATH)\include\QtCore \
-I$(BUILD_PATH)\src\corelib\global \
-I$(SOURCE_PATH)\mkspecs\$(QMAKESPEC) \
+ -I$(SOURCE_PATH)\tools\shared \
-DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NODLL -DQT_NO_STL \
-DQT_NO_COMPRESS -DUNICODE -DHAVE_QCONFIG_CPP -DQT_BUILD_QMAKE -DQT_NO_THREAD \
-DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT
@@ -75,6 +77,8 @@ OBJS = project.obj main.obj makefile.obj unixmake.obj unixmake2.obj mingw
makefiledeps.obj metamakefile.obj xmloutput.obj pbuilder_pbx.obj \
borland_bmake.obj msvc_nmake.obj msvc_dsp.obj msvc_vcproj.obj \
msvc_objectmodel.obj symmake.obj initprojectdeploy_symbian.obj \
+ registry.obj \
+ epocroot.obj \
symmake_abld.obj symmake_sbsv2.obj
!IFDEF QMAKE_OPENSOURCE_EDITION
@@ -198,6 +202,8 @@ clean::
-del symmake_abld.obj
-del symmake_sbsv2.obj
-del initprojectdeploy_symbian.obj
+ -del registry.obj
+ -del epocroot.obj
-del pbuilder_pbx.obj
-del qxmlstream.obj
-del qxmlutils.obj
@@ -397,6 +403,12 @@ symmake_sbsv2.obj: $(SOURCE_PATH)/qmake/generators/symbian/symmake_sbsv2.cpp
initprojectdeploy_symbian.obj: $(SOURCE_PATH)/qmake/generators/symbian/initprojectdeploy_symbian.cpp
$(CXX) $(CXXFLAGS) generators/symbian/initprojectdeploy_symbian.cpp
+registry.obj: $(SOURCE_PATH)/tools/shared/windows/registry.cpp
+ $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/tools/shared/windows/registry.cpp
+
+epocroot.obj: $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp
+ $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp
+
md5.obj: $(SOURCE_PATH)\src\3rdparty\md5\md5.cpp
$(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\3rdparty\md5\md5.cpp
diff --git a/qmake/Makefile.win32-g++ b/qmake/Makefile.win32-g++
index ade379b..169de3c 100644
--- a/qmake/Makefile.win32-g++
+++ b/qmake/Makefile.win32-g++
@@ -21,6 +21,7 @@ CFLAGS = -c -o$@ -O \
-I$(BUILD_PATH)/src/corelib/global \
-I$(BUILD_PATH)/src/corelib/xml \
-I$(SOURCE_PATH)/mkspecs/win32-g++ \
+ -I$(SOURCE_PATH)/tools/shared \
-DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NO_PCRE \
-DQT_NODLL -DQT_NO_STL -DQT_NO_COMPRESS -DUNICODE -DHAVE_QCONFIG_CPP \
-DQT_BUILD_QMAKE -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \
@@ -38,6 +39,8 @@ OBJS = project.o main.o makefile.o unixmake.o unixmake2.o mingw_make.o \
makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o \
borland_bmake.o msvc_nmake.o msvc_dsp.o msvc_vcproj.o \
msvc_objectmodel.o symmake.o initprojectdeploy_symbian.o \
+ registry.o \
+ epocroot.o \
symmake_abld.o symmake_sbsv2.o
ifdef QMAKE_OPENSOURCE_EDITION
@@ -278,6 +281,12 @@ symmake_sbsv2.o: $(SOURCE_PATH)/qmake/generators/symbian/symmake_sbsv2.cpp
initprojectdeploy_symbian.o: $(SOURCE_PATH)/qmake/generators/symbian/initprojectdeploy_symbian.cpp
$(CXX) $(CXXFLAGS) generators/symbian/initprojectdeploy_symbian.cpp
+registry.o: $(SOURCE_PATH)/tools/shared/windows/registry.cpp
+ $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/tools/shared/windows/registry.cpp
+
+epocroot.o: $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp
+ $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp
+
project.o: $(SOURCE_PATH)/qmake/project.cpp $(SOURCE_PATH)/qmake/project.h $(SOURCE_PATH)/qmake/option.h
$(CXX) $(CXXFLAGS) project.cpp
diff --git a/qmake/Makefile.win32-g++-sh b/qmake/Makefile.win32-g++-sh
index 8d2723c..98237e7 100644
--- a/qmake/Makefile.win32-g++-sh
+++ b/qmake/Makefile.win32-g++-sh
@@ -21,6 +21,7 @@ CFLAGS = -c -o$@ -O \
-I$(BUILD_PATH)/src/corelib/global \
-I$(BUILD_PATH)/src/corelib/xml \
-I$(SOURCE_PATH)/mkspecs/win32-g++ \
+ -I$(SOURCE_PATH)/tools/shared \
-DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NO_PCRE \
-DQT_NODLL -DQT_NO_STL -DQT_NO_COMPRESS -DUNICODE -DHAVE_QCONFIG_CPP \
-DQT_BUILD_QMAKE -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \
@@ -38,6 +39,8 @@ OBJS = project.o main.o makefile.o unixmake.o unixmake2.o mingw_make.o \
makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o \
borland_bmake.o msvc_nmake.o msvc_dsp.o msvc_vcproj.o \
msvc_objectmodel.o symmake.o initprojectdeploy_symbian.o \
+ registry.o \
+ epocroot.o \
symmake_abld.o symmake_sbsv2.o
ifdef QMAKE_OPENSOURCE_EDITION
@@ -277,6 +280,12 @@ symmake_sbsv2.o: $(SOURCE_PATH)/qmake/generators/symbian/symmake_sbsv2.cpp
initprojectdeploy_symbian.o: $(SOURCE_PATH)/qmake/generators/symbian/initprojectdeploy_symbian.cpp
$(CXX) $(CXXFLAGS) generators/symbian/initprojectdeploy_symbian.cpp
+registry.o: $(SOURCE_PATH)/tools/shared/windows/registry.cpp
+ $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/tools/shared/windows/registry.cpp
+
+epocroot.o: $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp
+ $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp
+
project.o: $(SOURCE_PATH)/qmake/project.cpp $(SOURCE_PATH)/qmake/project.h $(SOURCE_PATH)/qmake/option.h
$(CXX) $(CXXFLAGS) project.cpp
diff --git a/qmake/generators/symbian/initprojectdeploy_symbian.cpp b/qmake/generators/symbian/initprojectdeploy_symbian.cpp
index 5fbff58..2a22305 100644
--- a/qmake/generators/symbian/initprojectdeploy_symbian.cpp
+++ b/qmake/generators/symbian/initprojectdeploy_symbian.cpp
@@ -46,105 +46,15 @@
#include <qsettings.h>
#include <qdebug.h>
+// Included from tools/shared
+#include <symbian/epocroot.h>
+
#define SYSBIN_DIR "\\sys\\bin"
#define SUFFIX_DLL "dll"
#define SUFFIX_EXE "exe"
#define SUFFIX_QTPLUGIN "qtplugin"
-static void fixEpocRootStr(QString& path)
-{
- path.replace("\\", "/");
-
- if (path.size() > 1 && path[1] == QChar(':')) {
- path = path.mid(2);
- }
-
- if (!path.size() || path[path.size()-1] != QChar('/')) {
- path += QChar('/');
- }
-}
-
-#define SYMBIAN_SDKS_KEY "HKEY_LOCAL_MACHINE\\Software\\Symbian\\EPOC SDKs"
-
-static QString epocRootStr;
-
-QString epocRoot()
-{
- if (!epocRootStr.isEmpty()) {
- return epocRootStr;
- }
-
- // First, check the env variable
- epocRootStr = qgetenv("EPOCROOT");
-
- if (epocRootStr.isEmpty()) {
- // No EPOCROOT set, check the default device
- // First check EPOCDEVICE env variable
- QString defaultDevice = qgetenv("EPOCDEVICE");
-
- // Check the windows registry via QSettings for devices.xml path
- QSettings settings(SYMBIAN_SDKS_KEY, QSettings::NativeFormat);
- QString devicesXmlPath = settings.value("CommonPath").toString();
-
- if (!devicesXmlPath.isEmpty()) {
- // Parse xml for correct device
- devicesXmlPath += "/devices.xml";
- QFile devicesFile(devicesXmlPath);
- if (devicesFile.open(QIODevice::ReadOnly)) {
- QXmlStreamReader xml(&devicesFile);
- while (!xml.atEnd()) {
- xml.readNext();
- if (xml.isStartElement() && xml.name() == "devices") {
- if (xml.attributes().value("version") == "1.0") {
- // Look for correct device
- while (!(xml.isEndElement() && xml.name() == "devices") && !xml.atEnd()) {
- xml.readNext();
- if (xml.isStartElement() && xml.name() == "device") {
- if ((defaultDevice.isEmpty() && xml.attributes().value("default") == "yes") ||
- (!defaultDevice.isEmpty() && (xml.attributes().value("id").toString() + QString(":") + xml.attributes().value("name").toString()) == defaultDevice)) {
- // Found the correct device
- while (!(xml.isEndElement() && xml.name() == "device") && !xml.atEnd()) {
- xml.readNext();
- if (xml.isStartElement() && xml.name() == "epocroot") {
- epocRootStr = xml.readElementText();
- fixEpocRootStr(epocRootStr);
- return epocRootStr;
- }
- }
- xml.raiseError("No epocroot element found");
- }
- }
- }
- } else {
- xml.raiseError("Invalid 'devices' element version");
- }
- }
- }
- if (xml.hasError()) {
- fprintf(stderr, "ERROR: \"%s\" when parsing devices.xml\n", qPrintable(xml.errorString()));
- }
- } else {
- fprintf(stderr, "Could not open devices.xml (%s)\n", qPrintable(devicesXmlPath));
- }
- } else {
- fprintf(stderr, "Could not retrieve " SYMBIAN_SDKS_KEY " setting\n");
- }
-
- fprintf(stderr, "Failed to determine epoc root.\n");
- if (!defaultDevice.isEmpty())
- fprintf(stderr, "The device indicated by EPOCDEVICE environment variable (%s) could not be found.\n", qPrintable(defaultDevice));
- fprintf(stderr, "Either set EPOCROOT or EPOCDEVICE environment variable to a valid value, or provide a default Symbian device.\n");
-
- // No valid device found; set epocroot to "/"
- epocRootStr = QLatin1String("/");
- }
-
- fixEpocRootStr(epocRootStr);
- return epocRootStr;
-}
-
-
static bool isPlugin(const QFileInfo& info, const QString& devicePath)
{
// Libraries are plugins if deployment path is something else than
diff --git a/qmake/generators/symbian/initprojectdeploy_symbian.h b/qmake/generators/symbian/initprojectdeploy_symbian.h
index e23e6a9..b409225 100644
--- a/qmake/generators/symbian/initprojectdeploy_symbian.h
+++ b/qmake/generators/symbian/initprojectdeploy_symbian.h
@@ -50,8 +50,6 @@
#include <qfile.h>
#include <stdlib.h>
-#include "epocroot.h"
-
#define PLUGIN_STUB_DIR "qmakepluginstubs"
struct CopyItem
diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp
index 61988d3..217c1c3 100644
--- a/qmake/generators/symbian/symmake.cpp
+++ b/qmake/generators/symbian/symmake.cpp
@@ -49,6 +49,9 @@
#include <stdlib.h>
#include <qdebug.h>
+// Included from tools/shared
+#include <symbian/epocroot.h>
+
#define RESOURCE_DIRECTORY_MMP "/resource/apps"
#define RESOURCE_DIRECTORY_RESOURCE "\\\\resource\\\\apps\\\\"
#define REGISTRATION_RESOURCE_DIRECTORY_HW "/private/10003a3f/import/apps"
@@ -106,11 +109,13 @@ QString SymbianMakefileGenerator::fixPathForMmp(const QString& origPath, const Q
{
static QString epocRootStr;
if (epocRootStr.isEmpty()) {
- QFileInfo efi(epocRoot());
- epocRootStr = efi.canonicalFilePath();
- if (epocRootStr.isEmpty()) {
+ epocRootStr = epocRoot();
+ QFileInfo efi(epocRootStr);
+ if (!efi.exists() || epocRootStr.isEmpty()) {
fprintf(stderr, "Unable to resolve epocRoot '%s' to real dir on current drive, defaulting to '/' for mmp paths\n", qPrintable(epocRoot()));
epocRootStr = "/";
+ } else {
+ epocRootStr = efi.absoluteFilePath();
}
if (!epocRootStr.endsWith("/"))
epocRootStr += "/";
@@ -134,16 +139,8 @@ QString SymbianMakefileGenerator::fixPathForMmp(const QString& origPath, const Q
return resultPath;
}
-QString SymbianMakefileGenerator::canonizePath(const QString& origPath)
+QString SymbianMakefileGenerator::absolutizePath(const QString& origPath)
{
- // Since current path gets appended almost always anyway, use it as default
- // for nonexisting paths.
- static QString defaultPath;
- if (defaultPath.isEmpty()) {
- QFileInfo fi(".");
- defaultPath = fi.canonicalFilePath();
- }
-
// Prepend epocroot to any paths beginning with "/epoc32/"
QString resultPath = QDir::fromNativeSeparators(origPath);
if (resultPath.startsWith("/epoc32/", Qt::CaseInsensitive))
@@ -151,16 +148,13 @@ QString SymbianMakefileGenerator::canonizePath(const QString& origPath)
QFileInfo fi(fileInfo(resultPath));
if (fi.isDir()) {
- resultPath = fi.canonicalFilePath();
+ resultPath = fi.absoluteFilePath();
} else {
- resultPath = fi.canonicalPath();
+ resultPath = fi.absolutePath();
}
resultPath = QDir::cleanPath(resultPath);
- if (resultPath.isEmpty())
- resultPath = defaultPath;
-
return resultPath;
}
@@ -692,7 +686,7 @@ void SymbianMakefileGenerator::initMmpVariables()
srcpaths << project->values("UI_DIR");
QDir current = QDir::current();
- QString canonizedCurrent = canonizePath(".");
+ QString absolutizedCurrent = absolutizePath(".");
for (int j = 0; j < srcpaths.size(); ++j) {
QFileInfo fi(fileInfo(srcpaths.at(j)));
@@ -700,10 +694,10 @@ void SymbianMakefileGenerator::initMmpVariables()
if (fi.suffix().startsWith("c")) {
if (fi.filePath().length() > fi.fileName().length()) {
appendIfnotExist(srcincpaths, fi.path());
- sources[canonizePath(fi.path())] += fi.fileName();
+ sources[absolutizePath(fi.path())] += fi.fileName();
} else {
- sources[canonizedCurrent] += fi.fileName();
- appendIfnotExist(srcincpaths, canonizedCurrent);
+ sources[absolutizedCurrent] += fi.fileName();
+ appendIfnotExist(srcincpaths, absolutizedCurrent);
}
}
}
@@ -717,7 +711,7 @@ void SymbianMakefileGenerator::initMmpVariables()
incpaths << project->values("UI_DIR");
for (int j = 0; j < incpaths.size(); ++j) {
- QString includepath = canonizePath(incpaths.at(j));
+ QString includepath = absolutizePath(incpaths.at(j));
appendIfnotExist(sysincspaths, includepath);
appendAbldTempDirs(sysincspaths, includepath);
}
@@ -1348,7 +1342,7 @@ void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy
removeSpecialCharacters(bldinfDefine);
t << "#ifndef " << bldinfDefine << endl;
- t << "\t#include \"" << QDir::toNativeSeparators(bldinfFilename) << "\"" << endl;
+ t << "\t#include \"" << bldinfFilename << "\"" << endl;
t << "#endif // " << bldinfDefine << endl;
}
diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h
index 77d61da..542284c 100644
--- a/qmake/generators/symbian/symmake.h
+++ b/qmake/generators/symbian/symmake.h
@@ -84,7 +84,7 @@ protected:
void removeSpecialCharacters(QString& str);
QString fixPathForMmp(const QString& origPath, const QDir& parentDir);
- QString canonizePath(const QString& origPath);
+ QString absolutizePath(const QString& origPath);
virtual bool writeMakefile(QTextStream &t);
void generatePkgFile(const QString &iconFile, DeploymentList &depList);
diff --git a/qmake/generators/symbian/symmake_abld.cpp b/qmake/generators/symbian/symmake_abld.cpp
index 033bcbe..6c62412 100644
--- a/qmake/generators/symbian/symmake_abld.cpp
+++ b/qmake/generators/symbian/symmake_abld.cpp
@@ -48,6 +48,9 @@
#include <qdatetime.h>
#include <qdebug.h>
+// Included from tools/shared
+#include <symbian/epocroot.h>
+
#define DO_NOTHING_TARGET "do_nothing"
#define CREATE_TEMPS_TARGET "create_temps"
#define EXTENSION_CLEAN "extension_clean"
diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp
index e081b19..8accfce 100644
--- a/qmake/generators/symbian/symmake_sbsv2.cpp
+++ b/qmake/generators/symbian/symmake_sbsv2.cpp
@@ -48,6 +48,9 @@
#include <qdatetime.h>
#include <qdebug.h>
+// Included from tools/shared
+#include <symbian/epocroot.h>
+
SymbianSbsv2MakefileGenerator::SymbianSbsv2MakefileGenerator() : SymbianMakefileGenerator() { }
SymbianSbsv2MakefileGenerator::~SymbianSbsv2MakefileGenerator() { }
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index 47986f5..58f95e9 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -67,6 +67,7 @@ QT_END_NAMESPACE
#ifdef Q_OS_WIN32
#include <qt_windows.h>
+#include <windows/registry.h>
QT_BEGIN_NAMESPACE
@@ -93,102 +94,6 @@ struct {
{NETUnknown, "", ""},
};
-static QString keyPath(const QString &rKey)
-{
- int idx = rKey.lastIndexOf(QLatin1Char('\\'));
- if (idx == -1)
- return QString();
- return rKey.left(idx + 1);
-}
-
-static QString keyName(const QString &rKey)
-{
- int idx = rKey.lastIndexOf(QLatin1Char('\\'));
- if (idx == -1)
- return rKey;
-
- QString res(rKey.mid(idx + 1));
- if (res == "Default" || res == ".")
- res = "";
- return res;
-}
-
-static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey)
-{
-
- QString rSubkeyName = keyName(rSubkey);
- QString rSubkeyPath = keyPath(rSubkey);
-
- HKEY handle = 0;
- LONG res = RegOpenKeyEx(parentHandle, (wchar_t*)rSubkeyPath.utf16(), 0, KEY_READ, &handle);
-
- if (res != ERROR_SUCCESS)
- return QString();
-
- // get the size and type of the value
- DWORD dataType;
- DWORD dataSize;
- res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, &dataType, 0, &dataSize);
- if (res != ERROR_SUCCESS) {
- RegCloseKey(handle);
- return QString();
- }
-
- // get the value
- QByteArray data(dataSize, 0);
- res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, 0,
- reinterpret_cast<unsigned char*>(data.data()), &dataSize);
- if (res != ERROR_SUCCESS) {
- RegCloseKey(handle);
- return QString();
- }
-
- QString result;
- switch (dataType) {
- case REG_EXPAND_SZ:
- case REG_SZ: {
- result = QString::fromWCharArray(((const wchar_t *)data.constData()));
- break;
- }
-
- case REG_MULTI_SZ: {
- QStringList l;
- int i = 0;
- for (;;) {
- QString s = QString::fromWCharArray((const wchar_t *)data.constData() + i);
- i += s.length() + 1;
-
- if (s.isEmpty())
- break;
- l.append(s);
- }
- result = l.join(", ");
- break;
- }
-
- case REG_NONE:
- case REG_BINARY: {
- result = QString::fromWCharArray((const wchar_t *)data.constData(), data.size() / 2);
- break;
- }
-
- case REG_DWORD_BIG_ENDIAN:
- case REG_DWORD: {
- Q_ASSERT(data.size() == sizeof(int));
- int i;
- memcpy((char*)&i, data.constData(), sizeof(int));
- result = QString::number(i);
- break;
- }
-
- default:
- qWarning("QSettings: unknown data %d type in windows registry", dataType);
- break;
- }
-
- RegCloseKey(handle);
- return result;
-}
QT_END_NAMESPACE
#endif
diff --git a/qmake/project.cpp b/qmake/project.cpp
index 4ce8ba4..e4ef7dd 100644
--- a/qmake/project.cpp
+++ b/qmake/project.cpp
@@ -44,8 +44,6 @@
#include "option.h"
#include "cachekeys.h"
-#include "epocroot.h"
-
#include <qdatetime.h>
#include <qfile.h>
#include <qfileinfo.h>
@@ -64,6 +62,9 @@
#include <stdio.h>
#include <stdlib.h>
+// Included from tools/shared
+#include <symbian/epocroot.h>
+
#ifdef Q_OS_WIN32
#define QT_POPEN _popen
#define QT_PCLOSE _pclose
diff --git a/qmake/qmake.pri b/qmake/qmake.pri
index efe4f36..05debe6 100644
--- a/qmake/qmake.pri
+++ b/qmake/qmake.pri
@@ -17,7 +17,9 @@ SOURCES += project.cpp property.cpp main.cpp generators/makefile.cpp \
generators/symbian/symmake.cpp \
generators/symbian/symmake_abld.cpp \
generators/symbian/symmake_sbsv2.cpp \
- generators/symbian/initprojectdeploy_symbian.cpp
+ generators/symbian/initprojectdeploy_symbian.cpp \
+ windows/registry.cpp \
+ symbian/epocroot.cpp
HEADERS += project.h property.h generators/makefile.h \
generators/unix/unixmake.h meta.h option.h cachekeys.h \
@@ -29,8 +31,9 @@ HEADERS += project.h property.h generators/makefile.h \
generators/symbian/symmake.h \
generators/symbian/symmake_abld.h \
generators/symbian/symmake_sbsv2.h \
- generators/symbian/epocroot.h \
- generators/symbian/initprojectdeploy_symbian.h
+ generators/symbian/initprojectdeploy_symbian.h \
+ windows/registry.h \
+ symbian/epocroot.h
contains(QT_EDITION, OpenSource) {
DEFINES += QMAKE_OPENSOURCE_EDITION
diff --git a/qmake/qmake.pro b/qmake/qmake.pro
index 00dcbce..f3f9d53 100644
--- a/qmake/qmake.pro
+++ b/qmake/qmake.pro
@@ -27,5 +27,9 @@ INCPATH += generators \
$$QT_SOURCE_TREE/include \
$$QT_SOURCE_TREE/include/QtCore \
$$QT_SOURCE_TREE/qmake
+
+VPATH += $$QT_SOURCE_TREE/tools/shared
+INCPATH += $$QT_SOURCE_TREE/tools/shared
+
include(qmake.pri)
diff --git a/src/corelib/arch/qatomic_s390.h b/src/corelib/arch/qatomic_s390.h
index 21f5037..273c17b 100644
--- a/src/corelib/arch/qatomic_s390.h
+++ b/src/corelib/arch/qatomic_s390.h
@@ -366,11 +366,9 @@ template <typename T>
Q_INLINE_TEMPLATE T* QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue)
{
#ifndef __s390x__
- return (T*)__CS_OLD_LOOP(reinterpret_cast<volatile long*>(_q_value), (int)newValue, "lr",
- "", "bcr 15,0\n");
+ return (T*)__CS_OLD_LOOP(&_q_value, (int)newValue, "lr", "", "");
#else
- return (T*)__CSG_OLD_LOOP(reinterpret_cast<volatile long*>(_q_value), (long)newValue, "lgr",
- "", "bcr 15,0\n");
+ return (T*)__CSG_OLD_LOOP(&_q_value, (long)newValue, "lgr", "", "");
#endif
}
@@ -378,9 +376,9 @@ template <typename T>
Q_INLINE_TEMPLATE T* QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue)
{
#ifndef __s390x__
- return (T*)__CS_OLD_LOOP(reinterpret_cast<volatile long*>(_q_value), (int)newValue, "lr", "", "");
+ return (T*)__CS_OLD_LOOP(&_q_value, (int)newValue, "lr", "", "bcr 15,0 \n");
#else
- return (T*)__CSG_OLD_LOOP(reinterpret_cast<volatile long*>(_q_value), (long)newValue, "lgr", "", "");
+ return (T*)__CSG_OLD_LOOP(&_q_value, (long)newValue, "lgr", "", "bcr 15,0 \n");
#endif
}
@@ -388,11 +386,9 @@ template <typename T>
Q_INLINE_TEMPLATE T* QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue)
{
#ifndef __s390x__
- return (T*)__CS_OLD_LOOP(reinterpret_cast<volatile long*>(_q_value), (int)newValue, "lr",
- "bcr 15,0 \n", "");
+ return (T*)__CS_OLD_LOOP(&_q_value, (int)newValue, "lr", "bcr 15,0 \n", "");
#else
- return (T*)__CSG_OLD_LOOP(reinterpret_cast<volatile long*>(_q_value), (long)newValue, "lgr",
- "bcr 15,0\n", "");
+ return (T*)__CSG_OLD_LOOP(&_q_value, (long)newValue, "lgr", "bcr 15,0\n", "");
#endif
}
diff --git a/src/corelib/arch/qatomic_symbian.h b/src/corelib/arch/qatomic_symbian.h
index f1d332f..fa4e4a9 100644
--- a/src/corelib/arch/qatomic_symbian.h
+++ b/src/corelib/arch/qatomic_symbian.h
@@ -42,7 +42,7 @@
#ifndef QATOMIC_SYMBIAN_H
#define QATOMIC_SYMBIAN_H
-#include <qglobal.h>
+#include <QtCore/qglobal.h>
#include <e32std.h>
QT_BEGIN_HEADER
diff --git a/src/corelib/codecs/qtextcodec.h b/src/corelib/codecs/qtextcodec.h
index 23c91c7..169fe82 100644
--- a/src/corelib/codecs/qtextcodec.h
+++ b/src/corelib/codecs/qtextcodec.h
@@ -170,7 +170,7 @@ private:
friend class QXmlStreamWriter;
friend class QXmlStreamWriterPrivate;
-#if defined Q_XMLSTREAM_RENAME_SYMBOLS
+#if defined(Q_OS_MAC32) || defined(Q_OS_AIX)
friend class QCoreXmlStreamWriter;
friend class QCoreXmlStreamWriterPrivate;
#endif
diff --git a/src/corelib/concurrent/qfuture.h b/src/corelib/concurrent/qfuture.h
index e402335..02ae40a 100644
--- a/src/corelib/concurrent/qfuture.h
+++ b/src/corelib/concurrent/qfuture.h
@@ -111,7 +111,7 @@ public:
{
public:
typedef std::bidirectional_iterator_tag iterator_category;
- typedef ptrdiff_t difference_type;
+ typedef qptrdiff difference_type;
typedef T value_type;
typedef const T *pointer;
typedef const T &reference;
diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp
index f27ecc1..0b98e1e 100644
--- a/src/corelib/io/qdatastream.cpp
+++ b/src/corelib/io/qdatastream.cpp
@@ -158,10 +158,9 @@ QT_BEGIN_NAMESPACE
\section1 Reading and writing Qt collection classes
- The Qt collection classes can also be serialized to a QDataStream.
+ The Qt container classes can also be serialized to a QDataStream.
These include QList, QLinkedList, QVector, QSet, QHash, and QMap.
- These classes have have stream operators declared as non-member of
- the class.
+ The stream operators are declared as non-members of the classes.
\target Serializing Qt Classes
\section1 Reading and writing other Qt classes.
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp
index 93becc8..8010a76 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -510,8 +510,8 @@ LRESULT CALLBACK qt_GetMessageHook(int code, WPARAM wp, LPARAM lp)
MSG *msg = (MSG *) lp;
if (localSerialNumber != d->lastSerialNumber
// if this message IS the one that triggers sendPostedEvents(), no need to post it again
- && msg->hwnd != d->internalHwnd
- && msg->message != WM_QT_SENDPOSTEDEVENTS) {
+ && (msg->hwnd != d->internalHwnd
+ || msg->message != WM_QT_SENDPOSTEDEVENTS)) {
PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS, 0, 0);
}
}
diff --git a/src/corelib/tools/qcontiguouscache.h b/src/corelib/tools/qcontiguouscache.h
index aa5603d..f767962 100644
--- a/src/corelib/tools/qcontiguouscache.h
+++ b/src/corelib/tools/qcontiguouscache.h
@@ -97,7 +97,7 @@ public:
typedef const value_type* const_pointer;
typedef value_type& reference;
typedef const value_type& const_reference;
- typedef ptrdiff_t difference_type;
+ typedef qptrdiff difference_type;
typedef int size_type;
explicit QContiguousCache(int capacity = 0);
diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h
index 5e93523..05eae42 100644
--- a/src/corelib/tools/qhash.h
+++ b/src/corelib/tools/qhash.h
@@ -329,7 +329,7 @@ public:
public:
typedef std::bidirectional_iterator_tag iterator_category;
- typedef ptrdiff_t difference_type;
+ typedef qptrdiff difference_type;
typedef T value_type;
typedef T *pointer;
typedef T &reference;
@@ -394,7 +394,7 @@ public:
public:
typedef std::bidirectional_iterator_tag iterator_category;
- typedef ptrdiff_t difference_type;
+ typedef qptrdiff difference_type;
typedef T value_type;
typedef const T *pointer;
typedef const T &reference;
@@ -478,7 +478,7 @@ public:
// STL compatibility
typedef T mapped_type;
typedef Key key_type;
- typedef ptrdiff_t difference_type;
+ typedef qptrdiff difference_type;
typedef int size_type;
inline bool empty() const { return isEmpty(); }
diff --git a/src/corelib/tools/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h
index f6de966..bfcf24f 100644
--- a/src/corelib/tools/qlinkedlist.h
+++ b/src/corelib/tools/qlinkedlist.h
@@ -113,7 +113,7 @@ public:
{
public:
typedef std::bidirectional_iterator_tag iterator_category;
- typedef ptrdiff_t difference_type;
+ typedef qptrdiff difference_type;
typedef T value_type;
typedef T *pointer;
typedef T &reference;
@@ -146,7 +146,7 @@ public:
{
public:
typedef std::bidirectional_iterator_tag iterator_category;
- typedef ptrdiff_t difference_type;
+ typedef qptrdiff difference_type;
typedef T value_type;
typedef const T *pointer;
typedef const T &reference;
@@ -212,7 +212,7 @@ public:
typedef const value_type *const_pointer;
typedef value_type &reference;
typedef const value_type &const_reference;
- typedef ptrdiff_t difference_type;
+ typedef qptrdiff difference_type;
#ifndef QT_NO_STL
static inline QLinkedList<T> fromStdList(const std::list<T> &list)
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index 120442d..1ad7528 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -163,7 +163,7 @@ public:
public:
Node *i;
typedef std::random_access_iterator_tag iterator_category;
- typedef ptrdiff_t difference_type;
+ typedef qptrdiff difference_type;
typedef T value_type;
typedef T *pointer;
typedef T &reference;
@@ -210,7 +210,7 @@ public:
public:
Node *i;
typedef std::random_access_iterator_tag iterator_category;
- typedef ptrdiff_t difference_type;
+ typedef qptrdiff difference_type;
typedef T value_type;
typedef const T *pointer;
typedef const T &reference;
@@ -289,7 +289,7 @@ public:
typedef const value_type *const_pointer;
typedef value_type &reference;
typedef const value_type &const_reference;
- typedef ptrdiff_t difference_type;
+ typedef qptrdiff difference_type;
#ifdef QT3_SUPPORT
inline QT3_SUPPORT iterator remove(iterator pos) { return erase(pos); }
diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h
index e71064c..4679812 100644
--- a/src/corelib/tools/qmap.h
+++ b/src/corelib/tools/qmap.h
@@ -213,7 +213,7 @@ public:
public:
typedef std::bidirectional_iterator_tag iterator_category;
- typedef ptrdiff_t difference_type;
+ typedef qptrdiff difference_type;
typedef T value_type;
typedef T *pointer;
typedef T &reference;
@@ -281,7 +281,7 @@ public:
public:
typedef std::bidirectional_iterator_tag iterator_category;
- typedef ptrdiff_t difference_type;
+ typedef qptrdiff difference_type;
typedef T value_type;
typedef const T *pointer;
typedef const T &reference;
@@ -384,7 +384,7 @@ public:
// STL compatibility
typedef Key key_type;
typedef T mapped_type;
- typedef ptrdiff_t difference_type;
+ typedef qptrdiff difference_type;
typedef int size_type;
inline bool empty() const { return isEmpty(); }
diff --git a/src/corelib/tools/qset.h b/src/corelib/tools/qset.h
index 6525880..b266deb 100644
--- a/src/corelib/tools/qset.h
+++ b/src/corelib/tools/qset.h
@@ -97,7 +97,7 @@ public:
public:
typedef std::bidirectional_iterator_tag iterator_category;
- typedef ptrdiff_t difference_type;
+ typedef qptrdiff difference_type;
typedef T value_type;
typedef const T *pointer;
typedef const T &reference;
@@ -132,7 +132,7 @@ public:
public:
typedef std::bidirectional_iterator_tag iterator_category;
- typedef ptrdiff_t difference_type;
+ typedef qptrdiff difference_type;
typedef T value_type;
typedef const T *pointer;
typedef const T &reference;
@@ -188,11 +188,10 @@ public:
typedef const value_type *const_pointer;
typedef value_type &reference;
typedef const value_type &const_reference;
- typedef ptrdiff_t difference_type;
+ typedef qptrdiff difference_type;
typedef int size_type;
inline bool empty() const { return isEmpty(); }
-
// comfort
inline QSet<T> &operator<<(const T &value) { insert(value); return *this; }
inline QSet<T> &operator|=(const QSet<T> &other) { unite(other); return *this; }
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h
index 8fbfcda..964b279 100644
--- a/src/corelib/tools/qsharedpointer_impl.h
+++ b/src/corelib/tools/qsharedpointer_impl.h
@@ -132,7 +132,7 @@ namespace QtSharedPointer {
typedef const value_type *const_pointer;
typedef value_type &reference;
typedef const value_type &const_reference;
- typedef ptrdiff_t difference_type;
+ typedef qptrdiff difference_type;
inline T *data() const { return value; }
inline bool isNull() const { return !data(); }
@@ -541,7 +541,7 @@ public:
typedef const value_type *const_pointer;
typedef value_type &reference;
typedef const value_type &const_reference;
- typedef ptrdiff_t difference_type;
+ typedef qptrdiff difference_type;
inline bool isNull() const { return d == 0 || d->strongref == 0 || value == 0; }
#ifndef Q_CC_NOKIAX86
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index 90b7442..ac7c795 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -163,7 +163,7 @@ public:
public:
T *i;
typedef std::random_access_iterator_tag iterator_category;
- typedef ptrdiff_t difference_type;
+ typedef qptrdiff difference_type;
typedef T value_type;
typedef T *pointer;
typedef T &reference;
@@ -196,7 +196,7 @@ public:
public:
T *i;
typedef std::random_access_iterator_tag iterator_category;
- typedef ptrdiff_t difference_type;
+ typedef qptrdiff difference_type;
typedef T value_type;
typedef const T *pointer;
typedef const T &reference;
@@ -260,7 +260,7 @@ public:
typedef const value_type* const_pointer;
typedef value_type& reference;
typedef const value_type& const_reference;
- typedef ptrdiff_t difference_type;
+ typedef qptrdiff difference_type;
typedef iterator Iterator;
typedef const_iterator ConstIterator;
typedef int size_type;
diff --git a/src/corelib/xml/qxmlstream_p.h b/src/corelib/xml/qxmlstream_p.h
index 6b911d2..ac421cf 100644
--- a/src/corelib/xml/qxmlstream_p.h
+++ b/src/corelib/xml/qxmlstream_p.h
@@ -54,7 +54,7 @@
#ifndef QXMLSTREAM_P_H
#define QXMLSTREAM_P_H
-#if defined(Q_OS_VXWORKS) && defined(ERROR)
+#if defined(ERROR)
# undef ERROR
#endif
diff --git a/src/gui/dialogs/qcolordialog.cpp b/src/gui/dialogs/qcolordialog.cpp
index 83ecc30..e6abf7f 100644
--- a/src/gui/dialogs/qcolordialog.cpp
+++ b/src/gui/dialogs/qcolordialog.cpp
@@ -1078,8 +1078,7 @@ QColorShower::QColorShower(QColorDialog *parent)
#ifdef QT_SMALL_COLORDIALOG
# ifdef Q_WS_S60
- QS60Data s60Data = QS60Data();
- const bool nonTouchUI = !s60Data.hasTouchscreen;
+ const bool nonTouchUI = !S60->hasTouchscreen;
# elif defined Q_WS_MAEMO_5
const bool nonTouchUI = false;
# endif
@@ -1506,8 +1505,7 @@ void QColorDialogPrivate::init(const QColor &initial)
#if defined(QT_SMALL_COLORDIALOG)
# if defined(Q_WS_S60)
- QS60Data s60Data = QS60Data();
- const bool nonTouchUI = !s60Data.hasTouchscreen;
+ const bool nonTouchUI = !S60->hasTouchscreen;
# elif defined(Q_WS_MAEMO_5)
const bool nonTouchUI = false;
# endif
diff --git a/src/gui/dialogs/qfontdialog.cpp b/src/gui/dialogs/qfontdialog.cpp
index 56580a9..a4bf15d 100644
--- a/src/gui/dialogs/qfontdialog.cpp
+++ b/src/gui/dialogs/qfontdialog.cpp
@@ -989,34 +989,24 @@ void QFontDialog::open(QObject *receiver, const char *member)
void QFontDialog::setVisible(bool visible)
{
Q_D(QFontDialog);
- if (visible)
- d->selectedFont = QFont();
-
-#if defined(Q_WS_MAC)
- bool isCurrentlyVisible = (isVisible() || d->delegate);
-
- if (!visible == !isCurrentlyVisible)
- return;
-
if (visible) {
- if (!(d->opts & DontUseNativeDialog) && QFontDialogPrivate::sharedFontPanelAvailable) {
- d->delegate = QFontDialogPrivate::openCocoaFontPanel(
- currentFont(), parentWidget(), windowTitle(), options(), d);
- QFontDialogPrivate::sharedFontPanelAvailable = false;
- return;
- }
-
- setWindowFlags(windowModality() == Qt::WindowModal ? Qt::Sheet : DefaultWindowFlags);
- } else {
- if (d->delegate) {
- QFontDialogPrivate::closeCocoaFontPanel(d->delegate);
- d->delegate = 0;
- QFontDialogPrivate::sharedFontPanelAvailable = true;
+ if (testAttribute(Qt::WA_WState_ExplicitShowHide) && !testAttribute(Qt::WA_WState_Hidden))
return;
+ } else if (testAttribute(Qt::WA_WState_ExplicitShowHide) && testAttribute(Qt::WA_WState_Hidden))
+ return;
+#ifdef Q_WS_MAC
+ if (d->canBeNativeDialog()){
+ if (d->setVisible_sys(visible)){
+ d->nativeDialogInUse = true;
+ // Set WA_DontShowOnScreen so that QDialog::setVisible(visible) below
+ // updates the state correctly, but skips showing the non-native version:
+ setAttribute(Qt::WA_DontShowOnScreen, true);
+ } else {
+ d->nativeDialogInUse = false;
+ setAttribute(Qt::WA_DontShowOnScreen, false);
}
}
-#endif
-
+#endif // Q_WS_MAC
QDialog::setVisible(visible);
}
@@ -1032,11 +1022,14 @@ void QFontDialog::done(int result)
Q_D(QFontDialog);
QDialog::done(result);
if (result == Accepted) {
- d->selectedFont = currentFont();
+ // We check if this is the same font we had before, if so we emit currentFontChanged
+ QFont selectedFont = currentFont();
+ if(selectedFont != d->selectedFont)
+ emit(currentFontChanged(selectedFont));
+ d->selectedFont = selectedFont;
emit fontSelected(d->selectedFont);
- } else {
+ } else
d->selectedFont = QFont();
- }
if (d->receiverToDisconnectOnClose) {
disconnect(this, SIGNAL(fontSelected(QFont)),
d->receiverToDisconnectOnClose, d->memberToDisconnectOnClose);
@@ -1045,6 +1038,23 @@ void QFontDialog::done(int result)
d->memberToDisconnectOnClose.clear();
}
+#ifdef Q_WS_MAC
+bool QFontDialogPrivate::canBeNativeDialog()
+{
+ Q_Q(QFontDialog);
+ if (nativeDialogInUse)
+ return true;
+ if (q->testAttribute(Qt::WA_DontShowOnScreen))
+ return false;
+ if (opts & QFontDialog::DontUseNativeDialog)
+ return false;
+
+ QLatin1String staticName(QFontDialog::staticMetaObject.className());
+ QLatin1String dynamicName(q->metaObject()->className());
+ return (staticName == dynamicName);
+}
+#endif // Q_WS_MAC
+
/*!
\fn QFont QFontDialog::getFont(bool *ok, const QFont &initial, QWidget* parent, const char* name)
\since 4.5
diff --git a/src/gui/dialogs/qfontdialog.h b/src/gui/dialogs/qfontdialog.h
index e6f209e..6035a3a 100644
--- a/src/gui/dialogs/qfontdialog.h
+++ b/src/gui/dialogs/qfontdialog.h
@@ -131,6 +131,9 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_styleHighlighted(int))
Q_PRIVATE_SLOT(d_func(), void _q_sizeHighlighted(int))
Q_PRIVATE_SLOT(d_func(), void _q_updateSample())
+#if defined(Q_WS_MAC)
+ Q_PRIVATE_SLOT(d_func(), void _q_macRunNativeAppModalPanel())
+#endif
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QFontDialog::FontDialogOptions)
diff --git a/src/gui/dialogs/qfontdialog_mac.mm b/src/gui/dialogs/qfontdialog_mac.mm
index 68f5f00..67d32b8 100644
--- a/src/gui/dialogs/qfontdialog_mac.mm
+++ b/src/gui/dialogs/qfontdialog_mac.mm
@@ -49,6 +49,7 @@
#include <private/qfontengine_p.h>
#include <private/qt_cocoa_helpers_mac_p.h>
#include <private/qt_mac_p.h>
+#include <qabstracteventdispatcher.h>
#include <qdebug.h>
#import <AppKit/AppKit.h>
#import <Foundation/Foundation.h>
@@ -372,7 +373,12 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont)
[NSApp endModalSession:mModalSession];
mModalSession = 0;
}
-
+ // Hack alert!
+ // Since this code path was never intended to be followed when starting from exec
+ // we need to force the dialog to communicate the new font, otherwise the signal
+ // won't get emitted.
+ if(code == NSOKButton)
+ mPriv->sampleEdit->setFont([self qtFont]);
mPriv->done((code == NSOKButton) ? QDialog::Accepted : QDialog::Rejected);
} else {
[NSApp stopModalWithCode:code];
@@ -567,7 +573,6 @@ void *QFontDialogPrivate::openCocoaFontPanel(const QFont &initial,
[ourPanel makeKeyAndOrderFront:ourPanel];
}
}
-
return delegate;
}
@@ -640,6 +645,145 @@ void QFontDialogPrivate::setFont(void *delegate, const QFont &font)
[static_cast<QCocoaFontPanelDelegate *>(delegate) setQtFont:font];
}
+void *QFontDialogPrivate::_q_constructNativePanel()
+{
+ QMacCocoaAutoReleasePool pool;
+
+ bool sharedFontPanelExisted = [NSFontPanel sharedFontPanelExists];
+ NSFontPanel *sharedFontPanel = [NSFontPanel sharedFontPanel];
+ [sharedFontPanel setHidesOnDeactivate:false];
+
+ // hack to ensure that QCocoaApplication's validModesForFontPanel:
+ // implementation is honored
+ if (!sharedFontPanelExisted) {
+ [sharedFontPanel makeKeyAndOrderFront:sharedFontPanel];
+ [sharedFontPanel close];
+ }
+
+ NSPanel *ourPanel = 0;
+ NSView *stolenContentView = 0;
+ NSButton *okButton = 0;
+ NSButton *cancelButton = 0;
+
+ CGFloat dialogExtraWidth = 0.0;
+ CGFloat dialogExtraHeight = 0.0;
+
+ // compute dialogExtra{Width,Height}
+ dialogExtraWidth = 2.0 * DialogSideMargin;
+ dialogExtraHeight = DialogTopMargin + ButtonTopMargin + ButtonMinHeight
+ + ButtonBottomMargin;
+
+ // compute initial contents rectangle
+ NSRect contentRect = [sharedFontPanel contentRectForFrameRect:[sharedFontPanel frame]];
+ contentRect.size.width += dialogExtraWidth;
+ contentRect.size.height += dialogExtraHeight;
+
+ // create the new panel
+ ourPanel = [[NSPanel alloc] initWithContentRect:contentRect
+ styleMask:StyleMask
+ backing:NSBackingStoreBuffered
+ defer:YES];
+ [ourPanel setReleasedWhenClosed:YES];
+
+ stolenContentView = [sharedFontPanel contentView];
+
+ // steal the font panel's contents view
+ [stolenContentView retain];
+ [sharedFontPanel setContentView:0];
+
+ {
+ // create a new content view and add the stolen one as a subview
+ NSRect frameRect = { { 0.0, 0.0 }, { 0.0, 0.0 } };
+ NSView *ourContentView = [[NSView alloc] initWithFrame:frameRect];
+ [ourContentView addSubview:stolenContentView];
+
+ // create OK and Cancel buttons and add these as subviews
+ okButton = macCreateButton("&OK", ourContentView);
+ cancelButton = macCreateButton("Cancel", ourContentView);
+
+ [ourPanel setContentView:ourContentView];
+ [ourPanel setDefaultButtonCell:[okButton cell]];
+ }
+ // create a delegate and set it
+ QCocoaFontPanelDelegate *delegate =
+ [[QCocoaFontPanelDelegate alloc] initWithFontPanel:sharedFontPanel
+ stolenContentView:stolenContentView
+ okButton:okButton
+ cancelButton:cancelButton
+ priv:this
+ extraWidth:dialogExtraWidth
+ extraHeight:dialogExtraHeight];
+ [ourPanel setDelegate:delegate];
+ [[NSFontManager sharedFontManager] setDelegate:delegate];
+#ifdef QT_MAC_USE_COCOA
+ [[NSFontManager sharedFontManager] setTarget:delegate];
+#endif
+ setFont(delegate, QApplication::font());
+
+ {
+ // hack to get correct initial layout
+ NSRect frameRect = [ourPanel frame];
+ frameRect.size.width += 1.0;
+ [ourPanel setFrame:frameRect display:NO];
+ frameRect.size.width -= 1.0;
+ frameRect.size = [delegate windowWillResize:ourPanel toSize:frameRect.size];
+ [ourPanel setFrame:frameRect display:NO];
+ [ourPanel center];
+ }
+ NSString *title = @"Select font";
+ [ourPanel setTitle:title];
+
+ [delegate setModalSession:[NSApp beginModalSessionForWindow:ourPanel]];
+ return delegate;
+}
+
+void QFontDialogPrivate::mac_nativeDialogModalHelp()
+{
+ // Copied from QFileDialogPrivate
+ // Do a queued meta-call to open the native modal dialog so it opens after the new
+ // event loop has started to execute (in QDialog::exec). Using a timer rather than
+ // a queued meta call is intentional to ensure that the call is only delivered when
+ // [NSApp run] runs (timers are handeled special in cocoa). If NSApp is not
+ // running (which is the case if e.g a top-most QEventLoop has been
+ // interrupted, and the second-most event loop has not yet been reactivated (regardless
+ // if [NSApp run] is still on the stack)), showing a native modal dialog will fail.
+ if (nativeDialogInUse) {
+ Q_Q(QFontDialog);
+ QTimer::singleShot(1, q, SLOT(_q_macRunNativeAppModalPanel()));
+ }
+}
+
+// The problem with the native font dialog is that OS X does not
+// offer a proper dialog, but a panel (i.e. without Ok and Cancel buttons).
+// This means we need to "construct" a native dialog by taking the panel
+// and "adding" the buttons.
+void QFontDialogPrivate::_q_macRunNativeAppModalPanel()
+{
+ QBoolBlocker nativeDialogOnTop(QApplicationPrivate::native_modal_dialog_active);
+ Q_Q(QFontDialog);
+ QCocoaFontPanelDelegate *delegate = (QCocoaFontPanelDelegate *)_q_constructNativePanel();
+ NSWindow *ourPanel = [delegate actualPanel];
+ [ourPanel retain];
+ int rval = [NSApp runModalForWindow:ourPanel];
+ QAbstractEventDispatcher::instance()->interrupt();
+ [ourPanel release];
+ [delegate cleanUpAfterMyself];
+ [delegate release];
+ bool isOk = (rval == NSOKButton);
+ if(isOk)
+ rescode = QDialog::Accepted;
+ else
+ rescode = QDialog::Rejected;
+}
+
+bool QFontDialogPrivate::setVisible_sys(bool visible)
+{
+ Q_Q(QFontDialog);
+ if (!visible == q->isHidden())
+ return false;
+ return visible;
+}
+
QT_END_NAMESPACE
#endif
diff --git a/src/gui/dialogs/qfontdialog_p.h b/src/gui/dialogs/qfontdialog_p.h
index ca2b10b..7654a80 100644
--- a/src/gui/dialogs/qfontdialog_p.h
+++ b/src/gui/dialogs/qfontdialog_p.h
@@ -152,6 +152,12 @@ public:
inline QFontDialog *fontDialog() { return q_func(); }
void *delegate;
+ bool nativeDialogInUse;
+ bool canBeNativeDialog();
+ bool setVisible_sys(bool visible);
+ void *_q_constructNativePanel();
+ void _q_macRunNativeAppModalPanel();
+ void mac_nativeDialogModalHelp();
static bool sharedFontPanelAvailable;
#endif
diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp
index 7d1d03d..ce4ce6a 100644
--- a/src/gui/effects/qgraphicseffect.cpp
+++ b/src/gui/effects/qgraphicseffect.cpp
@@ -726,7 +726,8 @@ void QGraphicsColorizeEffect::draw(QPainter *painter)
elements. The level of detail can be modified using the setBlurRadius()
function. Use setBlurHints() to choose the blur hints.
- By default, the blur radius is 5 pixels.
+ By default, the blur radius is 5 pixels. The blur radius is specified in
+ device coordinates.
\img graphicseffect-blur.png
@@ -781,6 +782,9 @@ QGraphicsBlurEffect::~QGraphicsBlurEffect()
radius results in a more blurred appearance.
By default, the blur radius is 5 pixels.
+
+ The radius is given in device coordinates, meaning it is
+ unaffected by scale.
*/
qreal QGraphicsBlurEffect::blurRadius() const
{
@@ -884,7 +888,8 @@ void QGraphicsBlurEffect::draw(QPainter *painter)
By default, the drop shadow is a semi-transparent dark gray
(QColor(63, 63, 63, 180)) shadow, blurred with a radius of 1 at an offset
- of 8 pixels towards the lower right.
+ of 8 pixels towards the lower right. The drop shadow offset is specified
+ in device coordinates.
\img graphicseffect-drop-shadow.png
@@ -913,6 +918,9 @@ QGraphicsDropShadowEffect::~QGraphicsDropShadowEffect()
By default, the offset is 8 pixels towards the lower right.
+ The offset is given in device coordinates, which means it is
+ unaffected by scale.
+
\sa xOffset(), yOffset(), blurRadius(), color()
*/
QPointF QGraphicsDropShadowEffect::offset() const
diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp
index 4d447cb..0ed95ea 100644
--- a/src/gui/egl/qegl.cpp
+++ b/src/gui/egl/qegl.cpp
@@ -101,7 +101,7 @@ bool QEglContext::chooseConfig
// If we want the best pixel format, then return the first
// matching configuration.
if (match == QEgl::BestPixelFormat) {
- eglChooseConfig(dpy, props.properties(), &cfg, 1, &matching);
+ eglChooseConfig(display(), props.properties(), &cfg, 1, &matching);
if (matching < 1)
continue;
return true;
@@ -111,13 +111,13 @@ bool QEglContext::chooseConfig
// first that matches the pixel format we wanted.
EGLint size = matching;
EGLConfig *configs = new EGLConfig [size];
- eglChooseConfig(dpy, props.properties(), configs, size, &matching);
+ eglChooseConfig(display(), props.properties(), configs, size, &matching);
for (EGLint index = 0; index < size; ++index) {
EGLint red, green, blue, alpha;
- eglGetConfigAttrib(dpy, configs[index], EGL_RED_SIZE, &red);
- eglGetConfigAttrib(dpy, configs[index], EGL_GREEN_SIZE, &green);
- eglGetConfigAttrib(dpy, configs[index], EGL_BLUE_SIZE, &blue);
- eglGetConfigAttrib(dpy, configs[index], EGL_ALPHA_SIZE, &alpha);
+ eglGetConfigAttrib(display(), configs[index], EGL_RED_SIZE, &red);
+ eglGetConfigAttrib(display(), configs[index], EGL_GREEN_SIZE, &green);
+ eglGetConfigAttrib(display(), configs[index], EGL_BLUE_SIZE, &blue);
+ eglGetConfigAttrib(display(), configs[index], EGL_ALPHA_SIZE, &alpha);
if (red == props.value(EGL_RED_SIZE) &&
green == props.value(EGL_GREEN_SIZE) &&
blue == props.value(EGL_BLUE_SIZE) &&
@@ -181,7 +181,7 @@ bool QEglContext::createContext(QEglContext *shareContext, const QEglProperties
}
}
if (ctx == EGL_NO_CONTEXT) {
- ctx = eglCreateContext(dpy, cfg, 0, contextProps.properties());
+ ctx = eglCreateContext(display(), cfg, 0, contextProps.properties());
if (ctx == EGL_NO_CONTEXT) {
qWarning() << "QEglContext::createContext(): Unable to create EGL context:" << errorString(eglGetError());
return false;
@@ -197,7 +197,7 @@ void QEglContext::destroySurface(EGLSurface surface)
if (surface != EGL_NO_SURFACE) {
if (surface == currentSurface)
doneCurrent();
- eglDestroySurface(dpy, surface);
+ eglDestroySurface(display(), surface);
}
}
@@ -205,8 +205,7 @@ void QEglContext::destroySurface(EGLSurface surface)
void QEglContext::destroyContext()
{
if (ctx != EGL_NO_CONTEXT && ownsContext)
- eglDestroyContext(dpy, ctx);
- dpy = EGL_NO_DISPLAY;
+ eglDestroyContext(display(), ctx);
ctx = EGL_NO_CONTEXT;
cfg = 0;
}
@@ -343,7 +342,7 @@ QEglProperties QEglContext::configProperties(EGLConfig cfg) const
QEglProperties props;
for (int name = 0x3020; name <= 0x304F; ++name) {
EGLint value;
- if (name != EGL_NONE && eglGetConfigAttrib(dpy, cfg, name, &value))
+ if (name != EGL_NONE && eglGetConfigAttrib(display(), cfg, name, &value))
props.setValue(name, value);
}
eglGetError(); // Clear the error state.
@@ -417,7 +416,7 @@ void QEglContext::dumpAllConfigs()
if (!eglGetConfigs(display(), 0, 0, &count) || count < 1)
return;
EGLConfig *configs = new EGLConfig [count];
- eglGetConfigs(dpy, configs, count, &count);
+ eglGetConfigs(display(), configs, count, &count);
for (EGLint index = 0; index < count; ++index) {
props = configProperties(configs[index]);
qWarning() << props.toString();
diff --git a/src/gui/egl/qegl_symbian.cpp b/src/gui/egl/qegl_symbian.cpp
index b1c9408..5a010cd 100644
--- a/src/gui/egl/qegl_symbian.cpp
+++ b/src/gui/egl/qegl_symbian.cpp
@@ -78,9 +78,9 @@ EGLSurface QEglContext::createSurface(QPaintDevice *device, const QEglProperties
props = 0;
EGLSurface surf;
if (devType == QInternal::Widget)
- surf = eglCreateWindowSurface(dpy, cfg, windowDrawable, 0);
+ surf = eglCreateWindowSurface(dpy, cfg, windowDrawable, props);
else
- surf = eglCreatePixmapSurface(dpy, cfg, pixmapDrawable, 0);
+ surf = eglCreatePixmapSurface(dpy, cfg, pixmapDrawable, props);
if (surf == EGL_NO_SURFACE)
qWarning("QEglContext::createSurface(): Unable to create EGL surface, error = 0x%x", eglGetError());
return surf;
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp
index 96b9373..06b7438 100644
--- a/src/gui/graphicsview/qgraphicsview.cpp
+++ b/src/gui/graphicsview/qgraphicsview.cpp
@@ -3609,6 +3609,8 @@ void QGraphicsView::drawForeground(QPainter *painter, const QRectF &rect)
}
/*!
+ \obsolete
+
Draws the items \a items in the scene using \a painter, after the
background and before the foreground are drawn. \a numItems is the number
of items in \a items and options in \a options. \a options is a list of
@@ -3617,7 +3619,7 @@ 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
+ Since Qt 4.6, this function is not called anymore unless
the QGraphicsView::IndirectPainting flag is given as an Optimization
flag.
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
index 2b91711..1ac8ace 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
+++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
@@ -113,7 +113,7 @@ void QCoeFepInputContext::update()
updateHints(false);
// For pre-5.0 SDKs, we don't do text updates on S60 side.
- if (QSysInfo::s60Version() != QSysInfo::SV_S60_5_0) {
+ if (QSysInfo::s60Version() < QSysInfo::SV_S60_5_0) {
return;
}
@@ -740,6 +740,9 @@ void QCoeFepInputContext::GetScreenCoordinatesForFepL(TPoint& aLeftSideOfBaseLin
void QCoeFepInputContext::DoCommitFepInlineEditL()
{
commitCurrentString(false);
+ if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0)
+ ReportAknEdStateEvent(QT_EAknCursorPositionChanged);
+
}
void QCoeFepInputContext::commitCurrentString(bool cancelFepTransaction)
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index cbd9a8a..adf3ce3 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -1540,6 +1540,11 @@ bool QAbstractItemView::event(QEvent *event)
case QEvent::FontChange:
d->doDelayedItemsLayout(); // the size of the items will change
break;
+#ifdef QT_SOFTKEYS_ENABLED
+ case QEvent::LanguageChange:
+ d->doneSoftKey->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::DoneSoftKey));
+ break;
+#endif
default:
break;
}
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp
index d0fa22d..706d2a8 100644
--- a/src/gui/itemviews/qtreeview.cpp
+++ b/src/gui/itemviews/qtreeview.cpp
@@ -2474,10 +2474,11 @@ void QTreeView::rowsInserted(const QModelIndex &parent, int start, int end)
QVector<QTreeViewItem> insertedItems(delta);
for (int i = 0; i < delta; ++i) {
- insertedItems[i].index = d->model->index(i + start, 0, parent);
- insertedItems[i].level = childLevel;
- insertedItems[i].hasChildren = d->hasVisibleChildren(insertedItems[i].index);
- insertedItems[i].hasMoreSiblings = !((i == delta - 1) && (parentRowCount == end +1));
+ QTreeViewItem &item = insertedItems[i];
+ item.index = d->model->index(i + start, 0, parent);
+ item.level = childLevel;
+ item.hasChildren = d->hasVisibleChildren(item.index);
+ item.hasMoreSiblings = !((i == delta - 1) && (parentRowCount == end +1));
}
if (d->viewItems.isEmpty())
d->defaultItemHeight = indexRowSizeHint(insertedItems[0].index);
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index 0a4869b..aac834d 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -1905,8 +1905,13 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
break;
if (!msg.wParam) {
+#ifdef Q_WS_WINCE
+ // On Windows CE, lParam parameter is a constant, not a char pointer.
+ if (msg.lParam == INI_INTL) {
+#else
QString area = QString::fromWCharArray((wchar_t*)msg.lParam);
if (area == QLatin1String("intl")) {
+#endif
QLocalePrivate::updateSystemPrivate();
if (!widget->testAttribute(Qt::WA_SetLocale))
widget->dptr()->setLocale_helper(QLocale(), true);
diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp
index 6d108b0..c9a94ee 100644
--- a/src/gui/kernel/qsoftkeymanager.cpp
+++ b/src/gui/kernel/qsoftkeymanager.cpp
@@ -55,24 +55,24 @@ QT_BEGIN_NAMESPACE
QSoftKeyManager *QSoftKeyManagerPrivate::self = 0;
-const char *QSoftKeyManager::standardSoftKeyText(StandardSoftKey standardKey)
+QString QSoftKeyManager::standardSoftKeyText(StandardSoftKey standardKey)
{
- const char *softKeyText = 0;
+ QString softKeyText;
switch (standardKey) {
case OkSoftKey:
- softKeyText = QT_TRANSLATE_NOOP("QSoftKeyManager", "Ok");
+ softKeyText = QSoftKeyManager::tr("Ok");
break;
case SelectSoftKey:
- softKeyText = QT_TRANSLATE_NOOP("QSoftKeyManager", "Select");
+ softKeyText = QSoftKeyManager::tr("Select");
break;
case DoneSoftKey:
- softKeyText = QT_TRANSLATE_NOOP("QSoftKeyManager", "Done");
+ softKeyText = QSoftKeyManager::tr("Done");
break;
case MenuSoftKey:
- softKeyText = QT_TRANSLATE_NOOP("QSoftKeyManager", "Options");
+ softKeyText = QSoftKeyManager::tr("Options");
break;
case CancelSoftKey:
- softKeyText = QT_TRANSLATE_NOOP("QSoftKeyManager", "Cancel");
+ softKeyText = QSoftKeyManager::tr("Cancel");
break;
default:
break;
@@ -100,8 +100,7 @@ QSoftKeyManager::QSoftKeyManager() :
QAction *QSoftKeyManager::createAction(StandardSoftKey standardKey, QWidget *actionWidget)
{
- const char* text = standardSoftKeyText(standardKey);
- QAction *action = new QAction(QSoftKeyManager::tr(text), actionWidget);
+ QAction *action = new QAction(standardSoftKeyText(standardKey), actionWidget);
QAction::SoftKeyRole softKeyRole = QAction::NoSoftKey;
switch (standardKey) {
case MenuSoftKey: // FALL-THROUGH
@@ -211,13 +210,11 @@ bool QSoftKeyManager::handleUpdateSoftKeys()
d->requestedSoftKeyActions.clear();
bool recursiveMerging = false;
QWidget *source = softkeySource(NULL, recursiveMerging);
- do {
- if (source) {
- bool added = appendSoftkeys(*source, level);
- source = softkeySource(source, recursiveMerging);
- level = added ? ++level : level;
- }
- } while (source);
+ while (source) {
+ if (appendSoftkeys(*source, level))
+ ++level;
+ source = softkeySource(source, recursiveMerging);
+ }
d->updateSoftKeys_sys();
return true;
diff --git a/src/gui/kernel/qsoftkeymanager_p.h b/src/gui/kernel/qsoftkeymanager_p.h
index ce902fe..a6fe17e 100644
--- a/src/gui/kernel/qsoftkeymanager_p.h
+++ b/src/gui/kernel/qsoftkeymanager_p.h
@@ -87,6 +87,7 @@ public:
static QAction *createAction(StandardSoftKey standardKey, QWidget *actionWidget);
static QAction *createKeyedAction(StandardSoftKey standardKey, Qt::Key key, QWidget *actionWidget);
+ static QString standardSoftKeyText(StandardSoftKey standardKey);
protected:
bool event(QEvent *e);
@@ -94,7 +95,6 @@ protected:
private:
QSoftKeyManager();
static QSoftKeyManager *instance();
- static const char *standardSoftKeyText(StandardSoftKey standardKey);
bool appendSoftkeys(const QWidget &source, int level);
QWidget *softkeySource(QWidget *previousSource, bool& recursiveMerging);
bool handleUpdateSoftKeys();
diff --git a/src/gui/painting/qdrawhelper_neon.cpp b/src/gui/painting/qdrawhelper_neon.cpp
index 25860a0..77c5202 100644
--- a/src/gui/painting/qdrawhelper_neon.cpp
+++ b/src/gui/painting/qdrawhelper_neon.cpp
@@ -48,43 +48,43 @@
QT_BEGIN_NAMESPACE
-static inline int16x8_t qvdiv_255_s16(int16x8_t x, int16x8_t half)
+static inline uint16x8_t qvdiv_255_u16(uint16x8_t x, uint16x8_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);
+ const uint16x8_t temp = vshrq_n_u16(x, 8); // x >> 8
+ const uint16x8_t sum_part = vaddq_u16(x, half); // x + 0x80
+ const uint16x8_t sum = vaddq_u16(temp, sum_part);
- return vreinterpretq_s16_u16(vshrq_n_u16(vreinterpretq_u16_s16(sum), 8));
+ return vshrq_n_u16(sum, 8);
}
-static inline int16x8_t qvbyte_mul_s16(int16x8_t x, int16x8_t alpha, int16x8_t half)
+static inline uint16x8_t qvbyte_mul_u16(uint16x8_t x, uint16x8_t alpha, uint16x8_t half)
{
// t = qRound(x * alpha / 255.0)
- const int16x8_t t = vmulq_s16(x, alpha); // t
- return qvdiv_255_s16(t, half);
+ const uint16x8_t t = vmulq_u16(x, alpha); // t
+ return qvdiv_255_u16(t, half);
}
-static inline int16x8_t qvinterpolate_pixel_255(int16x8_t x, int16x8_t a, int16x8_t y, int16x8_t b, int16x8_t half)
+static inline uint16x8_t qvinterpolate_pixel_255(uint16x8_t x, uint16x8_t a, uint16x8_t y, uint16x8_t b, uint16x8_t half)
{
// t = x * a + y * b
- const int16x8_t ta = vmulq_s16(x, a);
- const int16x8_t tb = vmulq_s16(y, b);
+ const uint16x8_t ta = vmulq_u16(x, a);
+ const uint16x8_t tb = vmulq_u16(y, b);
- return qvdiv_255_s16(vaddq_s16(ta, tb), half);
+ return qvdiv_255_u16(vaddq_u16(ta, tb), half);
}
-static inline int16x8_t qvsource_over_s16(int16x8_t src16, int16x8_t dst16, int16x8_t half, int16x8_t full)
+static inline uint16x8_t qvsource_over_u16(uint16x8_t src16, uint16x8_t dst16, uint16x8_t half, uint16x8_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 uint16x4_t alpha16_high = vdup_lane_u16(vget_high_u16(src16), 3);
+ const uint16x4_t alpha16_low = vdup_lane_u16(vget_low_u16(src16), 3);
- const int16x8_t alpha16 = vsubq_s16(full, vcombine_s16(alpha16_low, alpha16_high));
+ const uint16x8_t alpha16 = vsubq_u16(full, vcombine_u16(alpha16_low, alpha16_high));
- return vaddq_s16(src16, qvbyte_mul_s16(dst16, alpha16, half));
+ return vaddq_u16(src16, qvbyte_mul_u16(dst16, alpha16, half));
}
void qt_blend_argb32_on_argb32_neon(uchar *destPixels, int dbpl,
@@ -94,21 +94,21 @@ void qt_blend_argb32_on_argb32_neon(uchar *destPixels, int dbpl,
{
const uint *src = (const uint *) srcPixels;
uint *dst = (uint *) destPixels;
- int16x8_t half = vdupq_n_s16(0x80);
- int16x8_t full = vdupq_n_s16(0xff);
+ uint16x8_t half = vdupq_n_u16(0x80);
+ uint16x8_t full = vdupq_n_u16(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]);
+ uint32x4_t src32 = vld1q_u32((uint32_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);
+ vst1q_u32((uint32_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]);
+ uint32x4_t dst32 = vld1q_u32((uint32_t *)&dst[x]);
- const uint8x16_t src8 = vreinterpretq_u8_s32(src32);
- const uint8x16_t dst8 = vreinterpretq_u8_s32(dst32);
+ const uint8x16_t src8 = vreinterpretq_u8_u32(src32);
+ const uint8x16_t dst8 = vreinterpretq_u8_u32(dst32);
const uint8x8_t src8_low = vget_low_u8(src8);
const uint8x8_t dst8_low = vget_low_u8(dst8);
@@ -116,19 +116,19 @@ void qt_blend_argb32_on_argb32_neon(uchar *destPixels, int dbpl,
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 uint16x8_t src16_low = vmovl_u8(src8_low);
+ const uint16x8_t dst16_low = 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 uint16x8_t src16_high = vmovl_u8(src8_high);
+ const uint16x8_t dst16_high = 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 uint16x8_t result16_low = qvsource_over_u16(src16_low, dst16_low, half, full);
+ const uint16x8_t result16_high = qvsource_over_u16(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));
+ const uint32x2_t result32_low = vreinterpret_u32_u8(vmovn_u16(result16_low));
+ const uint32x2_t result32_high = vreinterpret_u32_u8(vmovn_u16(result16_high));
- vst1q_s32((int32_t *)&dst[x], vcombine_s32(result32_low, result32_high));
+ vst1q_u32((uint32_t *)&dst[x], vcombine_u32(result32_low, result32_high));
}
}
for (; x<w; ++x) {
@@ -143,16 +143,16 @@ void qt_blend_argb32_on_argb32_neon(uchar *destPixels, int dbpl,
}
} else if (const_alpha != 0) {
const_alpha = (const_alpha * 255) >> 8;
- int16x8_t const_alpha16 = vdupq_n_s16(const_alpha);
+ uint16x8_t const_alpha16 = vdupq_n_u16(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]);
+ uint32x4_t src32 = vld1q_u32((uint32_t *)&src[x]);
+ uint32x4_t dst32 = vld1q_u32((uint32_t *)&dst[x]);
- const uint8x16_t src8 = vreinterpretq_u8_s32(src32);
- const uint8x16_t dst8 = vreinterpretq_u8_s32(dst32);
+ const uint8x16_t src8 = vreinterpretq_u8_u32(src32);
+ const uint8x16_t dst8 = vreinterpretq_u8_u32(dst32);
const uint8x8_t src8_low = vget_low_u8(src8);
const uint8x8_t dst8_low = vget_low_u8(dst8);
@@ -160,22 +160,22 @@ void qt_blend_argb32_on_argb32_neon(uchar *destPixels, int dbpl,
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 uint16x8_t src16_low = vmovl_u8(src8_low);
+ const uint16x8_t dst16_low = 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 uint16x8_t src16_high = vmovl_u8(src8_high);
+ const uint16x8_t dst16_high = 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 uint16x8_t srcalpha16_low = qvbyte_mul_u16(src16_low, const_alpha16, half);
+ const uint16x8_t srcalpha16_high = qvbyte_mul_u16(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 uint16x8_t result16_low = qvsource_over_u16(srcalpha16_low, dst16_low, half, full);
+ const uint16x8_t result16_high = qvsource_over_u16(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));
+ const uint32x2_t result32_low = vreinterpret_u32_u8(vmovn_u16(result16_low));
+ const uint32x2_t result32_high = vreinterpret_u32_u8(vmovn_u16(result16_high));
- vst1q_s32((int32_t *)&dst[x], vcombine_s32(result32_low, result32_high));
+ vst1q_u32((uint32_t *)&dst[x], vcombine_u32(result32_low, result32_high));
}
}
for (; x<w; ++x) {
@@ -206,19 +206,19 @@ void qt_blend_rgb32_on_rgb32_neon(uchar *destPixels, int dbpl,
if (const_alpha != 0) {
const uint *src = (const uint *) srcPixels;
uint *dst = (uint *) destPixels;
- int16x8_t half = vdupq_n_s16(0x80);
+ uint16x8_t half = vdupq_n_u16(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);
+ uint16x8_t const_alpha16 = vdupq_n_u16(const_alpha);
+ uint16x8_t one_minus_const_alpha16 = vdupq_n_u16(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]);
+ uint32x4_t src32 = vld1q_u32((uint32_t *)&src[x]);
+ uint32x4_t dst32 = vld1q_u32((uint32_t *)&dst[x]);
- const uint8x16_t src8 = vreinterpretq_u8_s32(src32);
- const uint8x16_t dst8 = vreinterpretq_u8_s32(dst32);
+ const uint8x16_t src8 = vreinterpretq_u8_u32(src32);
+ const uint8x16_t dst8 = vreinterpretq_u8_u32(dst32);
const uint8x8_t src8_low = vget_low_u8(src8);
const uint8x8_t dst8_low = vget_low_u8(dst8);
@@ -226,19 +226,19 @@ void qt_blend_rgb32_on_rgb32_neon(uchar *destPixels, int dbpl,
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 uint16x8_t src16_low = vmovl_u8(src8_low);
+ const uint16x8_t dst16_low = 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 uint16x8_t src16_high = vmovl_u8(src8_high);
+ const uint16x8_t dst16_high = 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 uint16x8_t result16_low = qvinterpolate_pixel_255(src16_low, const_alpha16, dst16_low, one_minus_const_alpha16, half);
+ const uint16x8_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));
+ const uint32x2_t result32_low = vreinterpret_u32_u8(vmovn_u16(result16_low));
+ const uint32x2_t result32_high = vreinterpret_u32_u8(vmovn_u16(result16_high));
- vst1q_s32((int32_t *)&dst[x], vcombine_s32(result32_low, result32_high));
+ vst1q_u32((uint32_t *)&dst[x], vcombine_u32(result32_low, result32_high));
}
for (; x<w; ++x) {
uint s = src[x];
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index bc56ed0..3c2cc8c 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -100,10 +100,6 @@
#endif
#include <limits.h>
-#if defined(QT_NO_FPU) || (_MSC_VER >= 1300 && _MSC_VER < 1400)
-# define FLOATING_POINT_BUGGY_OR_NO_FPU
-#endif
-
QT_BEGIN_NAMESPACE
extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp
@@ -3679,9 +3675,6 @@ void QRasterPaintEngine::drawEllipse(const QRectF &rect)
if (((qpen_style(s->lastPen) == Qt::SolidLine && s->flags.fast_pen)
|| (qpen_style(s->lastPen) == Qt::NoPen && !s->flags.antialiased))
&& qMax(rect.width(), rect.height()) < QT_RASTER_COORD_LIMIT
-#ifdef FLOATING_POINT_BUGGY_OR_NO_FPU
- && qMax(rect.width(), rect.height()) < 128 // integer math breakdown
-#endif
&& s->matrix.type() <= QTransform::TxScale) // no shear
{
ensureBrush();
@@ -6054,15 +6047,9 @@ static void drawEllipse_midpoint_i(const QRect &rect, const QRect &clip,
ProcessSpans pen_func, ProcessSpans brush_func,
QSpanData *pen_data, QSpanData *brush_data)
{
-#ifdef FLOATING_POINT_BUGGY_OR_NO_FPU // no fpu, so use fixed point
- const QFixed a = QFixed(rect.width()) >> 1;
- const QFixed b = QFixed(rect.height()) >> 1;
- QFixed d = b*b - (a*a*b) + ((a*a) >> 2);
-#else
const qreal a = qreal(rect.width()) / 2;
const qreal b = qreal(rect.height()) / 2;
qreal d = b*b - (a*a*b) + 0.25*a*a;
-#endif
int x = 0;
int y = (rect.height() + 1) / 2;
@@ -6085,12 +6072,7 @@ static void drawEllipse_midpoint_i(const QRect &rect, const QRect &clip,
pen_func, brush_func, pen_data, brush_data);
// region 2
-#ifdef FLOATING_POINT_BUGGY_OR_NO_FPU
- d = b*b*(x + (QFixed(1) >> 1))*(x + (QFixed(1) >> 1))
- + a*a*((y - 1)*(y - 1) - b*b);
-#else
d = b*b*(x + 0.5)*(x + 0.5) + a*a*((y - 1)*(y - 1) - b*b);
-#endif
const int miny = rect.height() & 0x1;
while (y > miny) {
if (d < 0) { // select SE
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index ea7399f..565cc2c 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -120,6 +120,8 @@ QPixmap *QS60StylePrivate::m_background = 0;
// theme palette
QPalette *QS60StylePrivate::m_themePalette = 0;
+qint64 QS60StylePrivate::m_webPaletteKey = 0;
+
const struct QS60StylePrivate::frameElementCenter QS60StylePrivate::m_frameElementsData[] = {
{SE_ButtonNormal, QS60StyleEnums::SP_QsnFrButtonTbCenter},
{SE_ButtonPressed, QS60StyleEnums::SP_QsnFrButtonTbCenterPressed},
@@ -807,8 +809,12 @@ void QS60StylePrivate::setThemePaletteHash(QPalette *palette) const
QPalette webPalette = *palette;
webPalette.setColor(QPalette::WindowText, Qt::black);
webPalette.setColor(QPalette::Text, Qt::black);
+ webPalette.setBrush(QPalette::Base, Qt::white);
+
QApplication::setPalette(webPalette, "QWebView");
QApplication::setPalette(webPalette, "QGraphicsWebView");
+
+ m_webPaletteKey = webPalette.cacheKey();
}
QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlags flags)
@@ -896,8 +902,11 @@ QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlag
return result;
}
-bool QS60StylePrivate::canDrawThemeBackground(const QBrush &backgroundBrush)
+bool QS60StylePrivate::canDrawThemeBackground(const QBrush &backgroundBrush, const QWidget *widget)
{
+ // Always return true for web pages.
+ if (widget && m_webPaletteKey == QApplication::palette(widget).cacheKey())
+ return true;
//If brush is not changed from style's default values, draw theme graphics.
return (backgroundBrush.color() == Qt::transparent ||
backgroundBrush.style() == Qt::NoBrush) ? true : false;
@@ -1901,7 +1910,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
case CE_ShapedFrame:
if (const QTextEdit *textEdit = qobject_cast<const QTextEdit *>(widget)) {
const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(option);
- if (QS60StylePrivate::canDrawThemeBackground(frame->palette.base()))
+ if (QS60StylePrivate::canDrawThemeBackground(frame->palette.base(), widget))
QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_Editor, painter, option->rect, flags);
else
QCommonStyle::drawControl(element, option, painter, widget);
@@ -2013,7 +2022,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
if (widget && qobject_cast<const QComboBox *>(widget->parentWidget()))
break;
#endif
- if (QS60StylePrivate::canDrawThemeBackground(option->palette.base()))
+ if (QS60StylePrivate::canDrawThemeBackground(option->palette.base(), widget))
QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_FrameLineEdit, painter, option->rect, flags);
else
commonStyleDraws = true;
@@ -2093,7 +2102,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
case PE_PanelButtonTool:
case PE_PanelButtonBevel:
case PE_FrameButtonBevel:
- if (QS60StylePrivate::canDrawThemeBackground(option->palette.base())) {
+ if (QS60StylePrivate::canDrawThemeBackground(option->palette.base(), widget)) {
const bool isPressed = option->state & State_Sunken;
const QS60StylePrivate::SkinElements skinElement =
isPressed ? QS60StylePrivate::SE_ButtonPressed : QS60StylePrivate::SE_ButtonNormal;
@@ -2125,7 +2134,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
case PE_IndicatorSpinDown:
case PE_IndicatorSpinUp:
if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
- if (QS60StylePrivate::canDrawThemeBackground(spinBox->palette.base())) {
+ if (QS60StylePrivate::canDrawThemeBackground(spinBox->palette.base(), widget)) {
QStyleOptionSpinBox optionSpinBox = *spinBox;
const QS60StyleEnums::SkinParts part = (element == PE_IndicatorSpinUp) ?
QS60StyleEnums::SP_QgnGrafScrollArrowUp :
@@ -2140,7 +2149,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
#endif //QT_NO_SPINBOX
#ifndef QT_NO_COMBOBOX
if (const QStyleOptionFrame *cmb = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
- if (QS60StylePrivate::canDrawThemeBackground( option->palette.base())) {
+ if (QS60StylePrivate::canDrawThemeBackground( option->palette.base(), widget)) {
// We want to draw down arrow here for comboboxes as well.
QStyleOptionFrame optionsComboBox = *cmb;
const QS60StyleEnums::SkinParts part = QS60StyleEnums::SP_QgnGrafScrollArrowDown;
@@ -2179,7 +2188,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
#endif //QT_NO_MENU
) {
//Need extra check since dialogs have their own theme background
- if (QS60StylePrivate::canDrawThemeBackground(option->palette.base()) &&
+ if (QS60StylePrivate::canDrawThemeBackground(option->palette.base(), widget) &&
option->palette.window().texture().cacheKey() ==
QS60StylePrivate::m_themePalette->window().texture().cacheKey())
QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_OptionsMenu, painter, option->rect, flags);
@@ -2387,10 +2396,20 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt,
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));
- if (const QAbstractButton *buttonWidget = (qobject_cast<const QAbstractButton *>(widget)))
+ if (const QAbstractButton *buttonWidget = (qobject_cast<const QAbstractButton *>(widget))) {
if (buttonWidget->isCheckable())
sz += QSize(pixelMetric(PM_IndicatorWidth) + pixelMetric(PM_CheckBoxLabelSpacing), 0);
+ const int iconHeight = (!buttonWidget->icon().isNull()) ? buttonWidget->iconSize().height() : 0;
+ const int textHeight = (buttonWidget->text().length() > 0) ?
+ buttonWidget->fontMetrics().size(Qt::TextSingleLine, buttonWidget->text()).height() : 0;
+ const int decoratorHeight = (buttonWidget->isCheckable()) ? pixelMetric(PM_IndicatorHeight) : 0;
+
+ const int contentHeight =
+ qMax(qMax(iconHeight, decoratorHeight) + pixelMetric(PM_ButtonMargin),
+ textHeight + 2*pixelMetric(PM_ButtonMargin));
+ sz.setHeight(contentHeight);
+ sz += QSize(2 * pixelMetric(PM_ButtonMargin), 0);
+ }
break;
case CT_LineEdit:
if (const QStyleOptionFrame *f = qstyleoption_cast<const QStyleOptionFrame *>(opt))
diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h
index ea30b81..16d82e7 100644
--- a/src/gui/styles/qs60style_p.h
+++ b/src/gui/styles/qs60style_p.h
@@ -542,7 +542,7 @@ public:
//Checks that the current brush is transparent or has BrushStyle NoBrush,
//so that theme graphic background can be drawn.
- static bool canDrawThemeBackground(const QBrush &backgroundBrush);
+ static bool canDrawThemeBackground(const QBrush &backgroundBrush, const QWidget *widget);
static int currentAnimationFrame(QS60StyleEnums::SkinParts part);
#ifdef Q_WS_S60
@@ -596,6 +596,7 @@ private:
QPalette m_originalPalette;
QPointer<QFocusFrame> m_focusFrame;
+ static qint64 m_webPaletteKey;
#ifdef Q_WS_S60
//list of progress bars having animation running
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp
index b36294a..c550938 100644
--- a/src/gui/styles/qstylesheetstyle.cpp
+++ b/src/gui/styles/qstylesheetstyle.cpp
@@ -5743,6 +5743,13 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c
return positionRect(w, subRule, subRule2, pe, opt->rect, opt->direction);
}
+#ifndef QT_NO_TOOLBAR
+ case SE_ToolBarHandle:
+ if (hasStyleRule(w, PseudoElement_ToolBarHandle))
+ return ParentStyle::subElementRect(se, opt, w);
+ break;
+#endif //QT_NO_TOOLBAR
+
default:
break;
}
diff --git a/src/gui/util/qdesktopservices_s60.cpp b/src/gui/util/qdesktopservices_s60.cpp
index 319c4b0..adc4fc1 100644
--- a/src/gui/util/qdesktopservices_s60.cpp
+++ b/src/gui/util/qdesktopservices_s60.cpp
@@ -48,7 +48,6 @@
#include <qurl.h>
#include <private/qcore_symbian_p.h>
-#include <miutset.h> // KUidMsgTypeSMTP
#include <txtrich.h> // CRichText
#include <f32file.h> // TDriveUnit etc
#include <eikenv.h> // CEikonEnv
@@ -57,6 +56,9 @@
#include <rsendas.h> // RSendAs
#include <rsendasmessage.h> // RSendAsMessage
+// copied from miutset.h, so we don't get a dependency into the app layer
+const TUid KUidMsgTypeSMTP = {0x10001028}; // 268439592
+
#ifdef Q_WS_S60
# include <pathinfo.h> // PathInfo
# ifdef USE_DOCUMENTHANDLER
diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp
index 72f32dc..585db70 100644
--- a/src/gui/widgets/qcombobox.cpp
+++ b/src/gui/widgets/qcombobox.cpp
@@ -607,7 +607,13 @@ void QComboBoxPrivateContainer::changeEvent(QEvent *e)
view->setMouseTracking(combo->style()->styleHint(QStyle::SH_ComboBox_ListMouseTracking, &opt, combo) ||
combo->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, combo));
setFrameStyle(combo->style()->styleHint(QStyle::SH_ComboBox_PopupFrameStyle, &opt, combo));
+#ifdef QT_SOFTKEYS_ENABLED
+ } else if (e->type() == QEvent::LanguageChange) {
+ selectAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::SelectSoftKey));
+ cancelAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::CancelSoftKey));
+#endif
}
+
QWidget::changeEvent(e);
}
diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp
index d754800..0c39f42 100644
--- a/src/gui/widgets/qdockarealayout.cpp
+++ b/src/gui/widgets/qdockarealayout.cpp
@@ -2635,7 +2635,7 @@ void QDockAreaLayout::getGrid(QVector<QLayoutStruct> *_ver_struct_list,
QSize bottom_max = docks[QInternal::BottomDock].maximumSize();
bottom_hint = bottom_hint.boundedTo(bottom_max).expandedTo(bottom_min);
- fallbackToSizeHints = !have_central;
+ fallbackToSizeHints = false;
if (_ver_struct_list != 0) {
QVector<QLayoutStruct> &ver_struct_list = *_ver_struct_list;
diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp
index 269cd12..e7c4f45 100644
--- a/src/gui/widgets/qmainwindow.cpp
+++ b/src/gui/widgets/qmainwindow.cpp
@@ -1426,6 +1426,11 @@ bool QMainWindow::event(QEvent *event)
}
break;
#endif
+#ifdef QT_SOFTKEYS_ENABLED
+ case QEvent::LanguageChange:
+ d->menuBarAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::MenuSoftKey));
+ break;
+#endif
default:
break;
}
diff --git a/src/gui/widgets/qmainwindowlayout.cpp b/src/gui/widgets/qmainwindowlayout.cpp
index fc75c92..593e391 100644
--- a/src/gui/widgets/qmainwindowlayout.cpp
+++ b/src/gui/widgets/qmainwindowlayout.cpp
@@ -1772,6 +1772,7 @@ void QMainWindowLayout::setCentralWidget(QWidget *widget)
if (savedState.isValid()) {
#ifndef QT_NO_DOCKWIDGET
savedState.dockAreaLayout.centralWidgetItem = layoutState.dockAreaLayout.centralWidgetItem;
+ savedState.dockAreaLayout.fallbackToSizeHints = true;
#else
savedState.centralWidgetItem = layoutState.centralWidgetItem;
#endif
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp
index 8ce7cc0..42b7406 100644
--- a/src/gui/widgets/qmenu.cpp
+++ b/src/gui/widgets/qmenu.cpp
@@ -117,7 +117,7 @@ public:
if (parentWidget->parentWidget())
parentWidget = parentWidget->parentWidget();
setParent(parentWidget, Qt::Window | Qt::Tool);
- setAttribute(Qt::WA_DeleteOnClose, true);
+ setAttribute(Qt::WA_DeleteOnClose, true);
setAttribute(Qt::WA_X11NetWmWindowTypeMenu, true);
setWindowTitle(p->windowTitle());
setEnabled(p->isEnabled());
@@ -1226,7 +1226,7 @@ void QMenu::initStyleOption(QStyleOptionMenuItem *option, const QAction *action)
else if (action->isSeparator())
option->menuItemType = QStyleOptionMenuItem::Separator;
else if (d->defaultAction == action)
- option->menuItemType = QStyleOptionMenuItem::DefaultItem;
+ option->menuItemType = QStyleOptionMenuItem::DefaultItem;
else
option->menuItemType = QStyleOptionMenuItem::Normal;
if (action->isIconVisibleInMenu())
@@ -1719,7 +1719,14 @@ bool QMenu::isEmpty() const
void QMenu::clear()
{
QList<QAction*> acts = actions();
+
for(int i = 0; i < acts.size(); i++) {
+#ifdef QT_SOFTKEYS_ENABLED
+ Q_D(QMenu);
+ // Lets not touch to our internal softkey actions
+ if(acts[i] == d->selectAction || acts[i] == d->cancelAction)
+ continue;
+#endif
removeAction(acts[i]);
if (acts[i]->parent() == this && acts[i]->d_func()->widgets.isEmpty())
delete acts[i];
@@ -2408,6 +2415,13 @@ QMenu::event(QEvent *e)
}
return true;
#endif
+#ifdef QT_SOFTKEYS_ENABLED
+ case QEvent::LanguageChange: {
+ d->selectAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::SelectSoftKey));
+ d->cancelAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::CancelSoftKey));
+ }
+ break;
+#endif
default:
break;
}
@@ -2919,7 +2933,7 @@ void QMenu::actionEvent(QActionEvent *e)
#endif
if (isVisible()) {
d->updateActionRects();
- resize(sizeHint());
+ resize(sizeHint());
update();
}
}
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index cc6a1c8..62aa2d7 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -404,6 +404,7 @@ QHttpNetworkReply* QHttpNetworkConnectionPrivate::queueRequest(const QHttpNetwor
QHttpNetworkReply *reply = new QHttpNetworkReply(request.url());
reply->setRequest(request);
reply->d_func()->connection = q;
+ reply->d_func()->connectionChannel = &channels[0]; // will have the correct one set later
HttpMessagePair pair = qMakePair(request, reply);
switch (request.priority()) {
@@ -688,14 +689,12 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest()
if (channels[i].resendCurrent) {
channels[i].resendCurrent = false;
channels[i].state = QHttpNetworkConnectionChannel::IdleState;
- if (channels[i].reply) {
- // if this is not possible, error will be emitted and connection terminated
- if (!channels[i].resetUploadData())
- continue;
+ // if this is not possible, error will be emitted and connection terminated
+ if (!channels[i].resetUploadData())
+ continue;
- channels[i].sendRequest();
- }
+ channels[i].sendRequest();
}
}
@@ -861,17 +860,6 @@ QNetworkProxy QHttpNetworkConnection::transparentProxy() const
// SSL support below
#ifndef QT_NO_OPENSSL
-QSslConfiguration QHttpNetworkConnectionPrivate::sslConfiguration(const QHttpNetworkReply &reply) const
-{
- if (!encrypt)
- return QSslConfiguration();
-
- for (int i = 0; i < channelCount; ++i)
- if (channels[i].reply == &reply)
- return static_cast<QSslSocket *>(channels[0].socket)->sslConfiguration();
- return QSslConfiguration(); // pending or done request
-}
-
void QHttpNetworkConnection::setSslConfiguration(const QSslConfiguration &config)
{
Q_D(QHttpNetworkConnection);
diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h
index 03cf09c..823774e 100644
--- a/src/network/access/qhttpnetworkconnection_p.h
+++ b/src/network/access/qhttpnetworkconnection_p.h
@@ -210,11 +210,6 @@ public:
void emitReplyError(QAbstractSocket *socket, QHttpNetworkReply *reply, QNetworkReply::NetworkError errorCode);
bool handleAuthenticateChallenge(QAbstractSocket *socket, QHttpNetworkReply *reply, bool isProxy, bool &resend);
-
-#ifndef QT_NO_OPENSSL
- QSslConfiguration sslConfiguration(const QHttpNetworkReply &reply) const;
-#endif
-
#ifndef QT_NO_NETWORKPROXY
QNetworkProxy networkProxy;
void emitProxyAuthenticationRequired(const QHttpNetworkConnectionChannel *chan, const QNetworkProxy &proxy, QAuthenticator* auth);
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 2a3036b..dbee72a 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -124,6 +124,13 @@ void QHttpNetworkConnectionChannel::close()
bool QHttpNetworkConnectionChannel::sendRequest()
{
+ if (!reply) {
+ // heh, how should that happen!
+ qWarning() << "QHttpNetworkConnectionChannel::sendRequest() called without QHttpNetworkReply";
+ state = QHttpNetworkConnectionChannel::IdleState;
+ return false;
+ }
+
switch (state) {
case QHttpNetworkConnectionChannel::IdleState: { // write the header
if (!ensureConnection()) {
@@ -134,13 +141,13 @@ bool QHttpNetworkConnectionChannel::sendRequest()
}
written = 0; // excluding the header
bytesTotal = 0;
- if (reply) {
- reply->d_func()->clear();
- reply->d_func()->connection = connection;
- reply->d_func()->autoDecompress = request.d->autoDecompress;
- reply->d_func()->pipeliningUsed = false;
- }
- state = QHttpNetworkConnectionChannel::WritingState;
+
+ reply->d_func()->clear();
+ reply->d_func()->connection = connection;
+ reply->d_func()->connectionChannel = this;
+ reply->d_func()->autoDecompress = request.d->autoDecompress;
+ reply->d_func()->pipeliningUsed = false;
+
pendingEncrypt = false;
// if the url contains authentication parameters, use the new ones
// both channels will use the new authentication parameters
@@ -174,13 +181,15 @@ bool QHttpNetworkConnectionChannel::sendRequest()
QObject::connect(uploadByteDevice, SIGNAL(readyRead()),this, SLOT(_q_uploadDataReadyRead()));
bytesTotal = request.contentLength();
+
+ state = QHttpNetworkConnectionChannel::WritingState; // start writing data
+ sendRequest(); //recurse
} else {
- state = QHttpNetworkConnectionChannel::WaitingState;
- sendRequest();
- break;
+ state = QHttpNetworkConnectionChannel::WaitingState; // now wait for response
+ sendRequest(); //recurse
}
- // write the initial chunk together with the headers
- // fall through
+
+ break;
}
case QHttpNetworkConnectionChannel::WritingState:
{
@@ -190,7 +199,7 @@ bool QHttpNetworkConnectionChannel::sendRequest()
if (uploadByteDevice)
emit reply->dataSendProgress(written, bytesTotal);
state = QHttpNetworkConnectionChannel::WaitingState; // now wait for response
- sendRequest();
+ sendRequest(); // recurse
break;
}
@@ -278,16 +287,25 @@ void QHttpNetworkConnectionChannel::_q_receiveReply()
{
Q_ASSERT(socket);
+ if (!reply) {
+ // heh, how should that happen!
+ qWarning() << "QHttpNetworkConnectionChannel::_q_receiveReply() called without QHttpNetworkReply,"
+ << socket->bytesAvailable() << "bytes on socket.";
+ close();
+ return;
+ }
+
qint64 bytes = 0;
QAbstractSocket::SocketState socketState = socket->state();
// connection might be closed to signal the end of data
if (socketState == QAbstractSocket::UnconnectedState) {
if (socket->bytesAvailable() <= 0) {
- if (reply && reply->d_func()->state == QHttpNetworkReplyPrivate::ReadingDataState) {
+ if (reply->d_func()->state == QHttpNetworkReplyPrivate::ReadingDataState) {
// finish this reply. this case happens when the server did not send a content length
reply->d_func()->state = QHttpNetworkReplyPrivate::AllDoneState;
allDone();
+ return;
} else {
handleUnexpectedEOF();
return;
@@ -299,12 +317,13 @@ void QHttpNetworkConnectionChannel::_q_receiveReply()
// read loop for the response
while (socket->bytesAvailable()) {
- QHttpNetworkReplyPrivate::ReplyState state = reply ? reply->d_func()->state : QHttpNetworkReplyPrivate::AllDoneState;
+ QHttpNetworkReplyPrivate::ReplyState state = reply->d_func()->state;
switch (state) {
case QHttpNetworkReplyPrivate::NothingDoneState: {
// only eat whitespace on the first call
eatWhitespace();
state = reply->d_func()->state = QHttpNetworkReplyPrivate::ReadingStatusState;
+ // fallthrough
}
case QHttpNetworkReplyPrivate::ReadingStatusState: {
qint64 statusBytes = reply->d_func()->readStatus(socket);
@@ -412,8 +431,10 @@ void QHttpNetworkConnectionChannel::_q_receiveReply()
#endif
}
}
+ // still in ReadingDataState? This function will be called again by the socket's readyRead
if (replyPrivate->state == QHttpNetworkReplyPrivate::ReadingDataState)
break;
+
// everything done, fall through
}
case QHttpNetworkReplyPrivate::AllDoneState:
@@ -568,7 +589,8 @@ void QHttpNetworkConnectionChannel::allDone()
handleStatus();
// ### at this point there should be no more data on the socket
// close if server requested
- if (reply->d_func()->isConnectionCloseEnabled())
+ bool connectionCloseEnabled = reply->d_func()->isConnectionCloseEnabled();
+ if (connectionCloseEnabled)
close();
// queue the finished signal, this is required since we might send new requests from
// slot connected to it. The socket will not fire readyRead signal, if we are already
@@ -579,14 +601,22 @@ void QHttpNetworkConnectionChannel::allDone()
// in case of failures, each channel will attempt two reconnects before emitting error.
reconnectAttempts = 2;
+ detectPipeliningSupport();
+
// now the channel can be seen as free/idle again, all signal emissions for the reply have been done
this->state = QHttpNetworkConnectionChannel::IdleState;
- detectPipeliningSupport();
+ // if it does not need to be sent again we can set it to 0
+ // the previous code did not do that and we had problems with accidental re-sending of a
+ // finished request.
+ // Note that this may trigger a segfault at some other point. But then we can fix the underlying
+ // problem.
+ if (!resendCurrent)
+ reply = 0;
// move next from pipeline to current request
if (!alreadyPipelinedRequests.isEmpty()) {
- if (resendCurrent || reply->d_func()->isConnectionCloseEnabled() || socket->state() != QAbstractSocket::ConnectedState) {
+ if (resendCurrent || connectionCloseEnabled || socket->state() != QAbstractSocket::ConnectedState) {
// move the pipelined ones back to the main queue
requeueCurrentlyPipelinedRequests();
close();
@@ -742,12 +772,11 @@ void QHttpNetworkConnectionChannel::pipelineInto(HttpMessagePair &pair)
QHttpNetworkRequest &request = pair.first;
QHttpNetworkReply *reply = pair.second;
- if (reply) {
- reply->d_func()->clear();
- reply->d_func()->connection = connection;
- reply->d_func()->autoDecompress = request.d->autoDecompress;
- reply->d_func()->pipeliningUsed = true;
- }
+ reply->d_func()->clear();
+ reply->d_func()->connection = connection;
+ reply->d_func()->connectionChannel = this;
+ reply->d_func()->autoDecompress = request.d->autoDecompress;
+ reply->d_func()->pipeliningUsed = true;
#ifndef QT_NO_NETWORKPROXY
QByteArray header = QHttpNetworkRequestPrivate::header(request,
diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp
index 512c045..984f557 100644
--- a/src/network/access/qhttpnetworkreply.cpp
+++ b/src/network/access/qhttpnetworkreply.cpp
@@ -230,6 +230,7 @@ void QHttpNetworkReplyPrivate::clear()
currentChunkRead = 0;
connectionCloseEnabled = true;
connection = 0;
+ connectionChannel = 0;
#ifndef QT_NO_COMPRESS
if (initInflate)
inflateEnd(&inflateStrm);
@@ -803,9 +804,15 @@ void QHttpNetworkReplyPrivate::eraseData()
QSslConfiguration QHttpNetworkReply::sslConfiguration() const
{
Q_D(const QHttpNetworkReply);
- if (d->connection)
- return d->connection->d_func()->sslConfiguration(*this);
- return QSslConfiguration();
+
+ if (!d->connectionChannel)
+ return QSslConfiguration();
+
+ QSslSocket *sslSocket = qobject_cast<QSslSocket*>(d->connectionChannel->socket);
+ if (!sslSocket)
+ return QSslConfiguration();
+
+ return sslSocket->sslConfiguration();
}
void QHttpNetworkReply::setSslConfiguration(const QSslConfiguration &config)
diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h
index af9266b..fa240ec 100644
--- a/src/network/access/qhttpnetworkreply_p.h
+++ b/src/network/access/qhttpnetworkreply_p.h
@@ -86,6 +86,7 @@ static const unsigned char gz_magic[2] = {0x1f, 0x8b}; // gzip magic header
QT_BEGIN_NAMESPACE
class QHttpNetworkConnection;
+class QHttpNetworkConnectionChannel;
class QHttpNetworkRequest;
class QHttpNetworkConnectionPrivate;
class QHttpNetworkReplyPrivate;
@@ -218,6 +219,7 @@ public:
qint64 currentChunkSize;
qint64 currentChunkRead;
QPointer<QHttpNetworkConnection> connection;
+ QPointer<QHttpNetworkConnectionChannel> connectionChannel;
bool initInflate;
bool streamEnd;
#ifndef QT_NO_COMPRESS
diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp
index 61a95fe..af971a7 100644
--- a/src/network/access/qnetworkaccesshttpbackend.cpp
+++ b/src/network/access/qnetworkaccesshttpbackend.cpp
@@ -976,7 +976,7 @@ QNetworkCacheMetaData QNetworkAccessHttpBackend::fetchCacheMetaData(const QNetwo
// of writes to disk when using a QNetworkDiskCache (i.e. don't
// write to disk when only the date changes).
// However, without the date we cannot calculate the age of the page
- // anymore. Consider a proper fix of that problem for 4.6.1.
+ // anymore.
//if (header == "date")
//continue;
diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp
index a2bef67..c4ff24d 100644
--- a/src/network/access/qnetworkrequest.cpp
+++ b/src/network/access/qnetworkrequest.cpp
@@ -138,6 +138,8 @@ QT_BEGIN_NAMESPACE
default follow redirections: it's up to the application to
determine if the requested redirection should be allowed,
according to its security policies.
+ The returned URL might be relative. Use QUrl::resolved()
+ to create an absolute URL out of it.
\value ConnectionEncryptedAttribute
Replies only, type: QVariant::Bool (default: false)
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp
index 829df89..275c436 100644
--- a/src/network/socket/qabstractsocket.cpp
+++ b/src/network/socket/qabstractsocket.cpp
@@ -155,6 +155,9 @@
See the \l network/fortuneclient and \l network/blockingfortuneclient
examples for an overview of both approaches.
+ \note We discourage the use of the blocking functions together
+ with signals. One of the two possibilities should be used.
+
QAbstractSocket can be used with QTextStream and QDataStream's
stream operators (operator<<() and operator>>()). There is one
issue to be aware of, though: You must make sure that enough data
@@ -1682,9 +1685,12 @@ static int qt_timeout_value(int msecs, int elapsed)
If msecs is -1, this function will not time out.
- Note: This function may wait slightly longer than \a msecs,
+ \note This function may wait slightly longer than \a msecs,
depending on the time it takes to complete the host lookup.
+ \note Multiple calls to this functions do not accumulate the time.
+ If the function times out, the connecting process will be aborted.
+
\sa connectToHost(), connected()
*/
bool QAbstractSocket::waitForConnected(int msecs)
@@ -1722,7 +1728,7 @@ bool QAbstractSocket::waitForConnected(int msecs)
d->_q_startConnecting(QHostInfo::fromName(d->hostName));
}
if (state() == UnconnectedState)
- return false;
+ return false; // connect not im progress anymore!
bool timedOut = true;
#if defined (QABSTRACTSOCKET_DEBUG)
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 8235a5c..c08d04a 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -89,6 +89,9 @@
QT_BEGIN_NAMESPACE
//#define QT_GL_NO_SCISSOR_TEST
+#if defined(Q_WS_WIN)
+extern Q_GUI_EXPORT bool qt_cleartype_enabled;
+#endif
extern QImage qt_imageForBrush(int brushStyle, bool invert);
@@ -1555,7 +1558,6 @@ 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;
diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp
index 6813d2f..4192dbb 100644
--- a/src/openvg/qpaintengine_vg.cpp
+++ b/src/openvg/qpaintengine_vg.cpp
@@ -131,8 +131,9 @@ public:
void draw(VGPath path, const QPen& pen, const QBrush& brush, VGint rule = VG_EVEN_ODD);
void stroke(VGPath path, const QPen& pen);
void fill(VGPath path, const QBrush& brush, VGint rule = VG_EVEN_ODD);
- VGPath vectorPathToVGPath(const QVectorPath& path);
- VGPath painterPathToVGPath(const QPainterPath& path);
+ inline void releasePath(VGPath path);
+ VGPath vectorPathToVGPath(const QVectorPath& path, bool forceNewPath = false);
+ VGPath painterPathToVGPath(const QPainterPath& path, bool forceNewPath = false);
VGPath roundedRectPath(const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode);
VGPaintType setBrush
(VGPaint paint, const QBrush& brush, VGMatrixMode mode,
@@ -178,6 +179,8 @@ public:
VGPath roundRectPath; // Cached path for quick drawing of rounded rects.
#endif
+ VGPath reusablePath; // Reusable path for vectorPathToVGPath(), etc.
+
QTransform transform; // Currently active transform.
bool simpleTransform; // True if the transform is simple (non-projective).
qreal penScale; // Pen scaling factor from "transform".
@@ -350,6 +353,8 @@ void QVGPaintEnginePrivate::init()
roundRectPath = 0;
#endif
+ reusablePath = 0;
+
simpleTransform = true;
pathTransformSet = false;
penScale = 1.0;
@@ -446,6 +451,15 @@ void QVGPaintEnginePrivate::initObjects()
VG_PATH_CAPABILITY_ALL);
vgAppendPathData(linePath, 2, segments, coords);
#endif
+
+ // This path can be reused over and over by calling vgClearPath().
+ reusablePath = vgCreatePath(VG_PATH_FORMAT_STANDARD,
+ VG_PATH_DATATYPE_F,
+ 1.0f, // scale
+ 0.0f, // bias
+ 32 + 1, // segmentCapacityHint
+ 32 * 2, // coordCapacityHint
+ VG_PATH_CAPABILITY_ALL);
}
void QVGPaintEnginePrivate::destroy()
@@ -465,6 +479,8 @@ void QVGPaintEnginePrivate::destroy()
if (roundRectPath)
vgDestroyPath(roundRectPath);
#endif
+ if (reusablePath)
+ vgDestroyPath(reusablePath);
#if !defined(QVG_NO_DRAW_GLYPHS)
QVGFontCache::Iterator it;
@@ -541,19 +557,32 @@ void QVGPaintEnginePrivate::updateTransform(QPaintDevice *pdev)
qt_scaleForTransform(transform, &penScale);
}
-VGPath QVGPaintEnginePrivate::vectorPathToVGPath(const QVectorPath& path)
+inline void QVGPaintEnginePrivate::releasePath(VGPath path)
+{
+ if (path == reusablePath)
+ vgClearPath(path, VG_PATH_CAPABILITY_ALL);
+ else
+ vgDestroyPath(path);
+}
+
+VGPath QVGPaintEnginePrivate::vectorPathToVGPath(const QVectorPath& path, bool forceNewPath)
{
int count = path.elementCount();
const qreal *points = path.points();
const QPainterPath::ElementType *elements = path.elements();
- VGPath vgpath = vgCreatePath(VG_PATH_FORMAT_STANDARD,
- VG_PATH_DATATYPE_F,
- 1.0f, // scale
- 0.0f, // bias
- count + 1, // segmentCapacityHint
- count * 2, // coordCapacityHint
- VG_PATH_CAPABILITY_ALL);
+ VGPath vgpath;
+ if (forceNewPath) {
+ vgpath = vgCreatePath(VG_PATH_FORMAT_STANDARD,
+ VG_PATH_DATATYPE_F,
+ 1.0f, // scale
+ 0.0f, // bias
+ count + 1, // segmentCapacityHint
+ count * 2, // coordCapacityHint
+ VG_PATH_CAPABILITY_ALL);
+ } else {
+ vgpath = reusablePath;
+ }
// Size is sufficient segments for drawRoundedRect() paths.
QVarLengthArray<VGubyte, 20> segments;
@@ -725,17 +754,22 @@ VGPath QVGPaintEnginePrivate::vectorPathToVGPath(const QVectorPath& path)
return vgpath;
}
-VGPath QVGPaintEnginePrivate::painterPathToVGPath(const QPainterPath& path)
+VGPath QVGPaintEnginePrivate::painterPathToVGPath(const QPainterPath& path, bool forceNewPath)
{
int count = path.elementCount();
- VGPath vgpath = vgCreatePath(VG_PATH_FORMAT_STANDARD,
- VG_PATH_DATATYPE_F,
- 1.0f, // scale
- 0.0f, // bias
- count + 1, // segmentCapacityHint
- count * 2, // coordCapacityHint
- VG_PATH_CAPABILITY_ALL);
+ VGPath vgpath;
+ if (forceNewPath) {
+ vgpath = vgCreatePath(VG_PATH_FORMAT_STANDARD,
+ VG_PATH_DATATYPE_F,
+ 1.0f, // scale
+ 0.0f, // bias
+ count + 1, // segmentCapacityHint
+ count * 2, // coordCapacityHint
+ VG_PATH_CAPABILITY_ALL);
+ } else {
+ vgpath = reusablePath;
+ }
if (count == 0)
return vgpath;
@@ -954,13 +988,7 @@ VGPath QVGPaintEnginePrivate::roundedRectPath(const QRectF &rect, qreal xRadius,
vgModifyPathCoords(vgpath, 0, 9, pts);
}
#else
- VGPath vgpath = vgCreatePath(VG_PATH_FORMAT_STANDARD,
- VG_PATH_DATATYPE_F,
- 1.0f, // scale
- 0.0f, // bias
- 10, // segmentCapacityHint
- 17 * 2, // coordCapacityHint
- VG_PATH_CAPABILITY_ALL);
+ VGPath vgpath = reusablePath;
vgAppendPathData(vgpath, 10, roundedrect_types, pts);
#endif
@@ -1516,7 +1544,7 @@ void QVGPaintEngine::draw(const QVectorPath &path)
d->draw(vgpath, s->pen, s->brush, VG_EVEN_ODD);
else
d->draw(vgpath, s->pen, s->brush, VG_NON_ZERO);
- vgDestroyPath(vgpath);
+ d->releasePath(vgpath);
}
void QVGPaintEngine::fill(const QVectorPath &path, const QBrush &brush)
@@ -1527,7 +1555,7 @@ void QVGPaintEngine::fill(const QVectorPath &path, const QBrush &brush)
d->fill(vgpath, brush, VG_EVEN_ODD);
else
d->fill(vgpath, brush, VG_NON_ZERO);
- vgDestroyPath(vgpath);
+ d->releasePath(vgpath);
}
void QVGPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
@@ -1535,7 +1563,7 @@ void QVGPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
Q_D(QVGPaintEngine);
VGPath vgpath = d->vectorPathToVGPath(path);
d->stroke(vgpath, pen);
- vgDestroyPath(vgpath);
+ d->releasePath(vgpath);
}
// Determine if a co-ordinate transform is simple enough to allow
@@ -1731,7 +1759,7 @@ void QVGPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op)
default: break;
}
- vgDestroyPath(vgpath);
+ d->releasePath(vgpath);
vgSeti(VG_MASKING, VG_TRUE);
d->maskValid = true;
@@ -2048,7 +2076,7 @@ void QVGPaintEngine::clip(const QPainterPath &path, Qt::ClipOperation op)
default: break;
}
- vgDestroyPath(vgpath);
+ d->releasePath(vgpath);
vgSeti(VG_MASKING, VG_TRUE);
d->maskValid = true;
@@ -2399,7 +2427,7 @@ void QVGPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
return;
// Check to see if we can use vgClear() for faster filling.
- if (brush.style() == Qt::SolidPattern &&
+ if (brush.style() == Qt::SolidPattern && brush.isOpaque() &&
clipTransformIsSimple(d->transform) && d->opacity == 1.0f &&
clearRect(rect, brush.color())) {
return;
@@ -2442,7 +2470,7 @@ void QVGPaintEngine::fillRect(const QRectF &rect, const QColor &color)
Q_D(QVGPaintEngine);
// Check to see if we can use vgClear() for faster filling.
- if (clipTransformIsSimple(d->transform) && d->opacity == 1.0f &&
+ if (clipTransformIsSimple(d->transform) && d->opacity == 1.0f && color.alpha() == 255 &&
clearRect(rect, color)) {
return;
}
@@ -2487,7 +2515,7 @@ void QVGPaintEngine::drawRoundedRect(const QRectF &rect, qreal xrad, qreal yrad,
VGPath vgpath = d->roundedRectPath(rect, xrad, yrad, mode);
d->draw(vgpath, s->pen, s->brush);
#if defined(QVG_NO_MODIFY_PATH)
- vgDestroyPath(vgpath);
+ d->releasePath(vgpath);
#endif
} else {
QPaintEngineEx::drawRoundedRect(rect, xrad, yrad, mode);
@@ -2636,13 +2664,7 @@ void QVGPaintEngine::drawEllipse(const QRectF &r)
Q_D(QVGPaintEngine);
if (d->simpleTransform) {
QVGPainterState *s = state();
- VGPath path = vgCreatePath(VG_PATH_FORMAT_STANDARD,
- VG_PATH_DATATYPE_F,
- 1.0f, // scale
- 0.0f, // bias
- 4, // segmentCapacityHint
- 12, // coordCapacityHint
- VG_PATH_CAPABILITY_ALL);
+ VGPath path = d->reusablePath;
static VGubyte segments[4] = {
VG_MOVE_TO_ABS,
VG_SCCWARC_TO_REL,
@@ -2666,7 +2688,7 @@ void QVGPaintEngine::drawEllipse(const QRectF &r)
coords[11] = 0.0f;
vgAppendPathData(path, 4, segments, coords);
d->draw(path, s->pen, s->brush);
- vgDestroyPath(path);
+ d->releasePath(path);
} else {
// The projective transform version of an ellipse is difficult.
// Generate a QVectorPath containing cubic curves and transform that.
@@ -2690,7 +2712,7 @@ void QVGPaintEngine::drawPath(const QPainterPath &path)
d->draw(vgpath, s->pen, s->brush, VG_EVEN_ODD);
else
d->draw(vgpath, s->pen, s->brush, VG_NON_ZERO);
- vgDestroyPath(vgpath);
+ d->releasePath(vgpath);
}
void QVGPaintEngine::drawPoints(const QPointF *points, int pointCount)
@@ -2765,13 +2787,7 @@ void QVGPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonD
{
Q_D(QVGPaintEngine);
QVGPainterState *s = state();
- VGPath path = vgCreatePath(VG_PATH_FORMAT_STANDARD,
- VG_PATH_DATATYPE_F,
- 1.0f, // scale
- 0.0f, // bias
- pointCount + 1, // segmentCapacityHint
- pointCount * 2, // coordCapacityHint
- VG_PATH_CAPABILITY_ALL);
+ VGPath path = d->reusablePath;
QVarLengthArray<VGfloat, 16> coords;
QVarLengthArray<VGubyte, 10> segments;
for (int i = 0; i < pointCount; ++i, ++points) {
@@ -2805,20 +2821,14 @@ void QVGPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonD
d->draw(path, s->pen, s->brush, VG_EVEN_ODD);
break;
}
- vgDestroyPath(path);
+ d->releasePath(path);
}
void QVGPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode)
{
Q_D(QVGPaintEngine);
QVGPainterState *s = state();
- VGPath path = vgCreatePath(VG_PATH_FORMAT_STANDARD,
- VG_PATH_DATATYPE_F,
- 1.0f, // scale
- 0.0f, // bias
- pointCount + 1, // segmentCapacityHint
- pointCount * 2, // coordCapacityHint
- VG_PATH_CAPABILITY_ALL);
+ VGPath path = d->reusablePath;
QVarLengthArray<VGfloat, 16> coords;
QVarLengthArray<VGubyte, 10> segments;
for (int i = 0; i < pointCount; ++i, ++points) {
@@ -2852,7 +2862,7 @@ void QVGPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDr
d->draw(path, s->pen, s->brush, VG_EVEN_ODD);
break;
}
- vgDestroyPath(path);
+ d->releasePath(path);
}
void QVGPaintEnginePrivate::setImageOptions()
@@ -3251,7 +3261,7 @@ void QVGFontGlyphCache::cacheGlyphs
ti.fontEngine->getUnscaledGlyph(glyph, &path, &metrics);
VGPath vgPath;
if (!path.isEmpty()) {
- vgPath = d->painterPathToVGPath(path);
+ vgPath = d->painterPathToVGPath(path, true);
} else {
// Probably a "space" character with no visible outline.
vgPath = VG_INVALID_HANDLE;
diff --git a/src/plugins/audio/audio.pro b/src/plugins/audio/audio.pro
index e93b369..5f75a8d 100644
--- a/src/plugins/audio/audio.pro
+++ b/src/plugins/audio/audio.pro
@@ -1,3 +1,9 @@
TEMPLATE = subdirs
+SUBDIRS =
+
+contains(QT_CONFIG, audio-backend) {
+ symbian {
+ SUBDIRS += symbian
+ }
+}
-#SUBDIRS += ossaudio
diff --git a/src/plugins/audio/symbian/main.cpp b/src/plugins/audio/symbian/main.cpp
new file mode 100644
index 0000000..536a8ec
--- /dev/null
+++ b/src/plugins/audio/symbian/main.cpp
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtMultimedia 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 <QtMultimedia/qaudioengineplugin.h>
+#include <QtMultimedia/qaudioengine.h>
+
+#include <qstringlist.h>
+#include <qiodevice.h>
+#include <qbytearray.h>
+#include <qdebug.h>
+
+#include "symbianaudiodeviceinfo.h"
+#include "symbianaudioinput.h"
+#include "symbianaudiooutput.h"
+
+QT_BEGIN_NAMESPACE
+
+class SymbianAudioPlugin : public QAudioEnginePlugin
+{
+public:
+ SymbianAudioPlugin(QObject *parent = 0);
+ ~SymbianAudioPlugin();
+
+ QStringList keys() const;
+
+ QList<QByteArray> availableDevices(QAudio::Mode) const;
+ QAbstractAudioInput* createInput(const QByteArray& device,
+ const QAudioFormat& format = QAudioFormat());
+ QAbstractAudioOutput* createOutput(const QByteArray& device,
+ const QAudioFormat& format = QAudioFormat());
+ QAbstractAudioDeviceInfo* createDeviceInfo(const QByteArray& device,
+ QAudio::Mode mode);
+};
+
+SymbianAudioPlugin::SymbianAudioPlugin(QObject *parent)
+ : QAudioEnginePlugin(parent)
+{
+
+}
+
+SymbianAudioPlugin::~SymbianAudioPlugin()
+{
+
+}
+
+QStringList SymbianAudioPlugin::keys() const
+{
+ QStringList keys(QLatin1String("default"));
+ keys << QLatin1String("default");
+ return keys;
+}
+
+QList<QByteArray> SymbianAudioPlugin::availableDevices(QAudio::Mode mode) const
+{
+ Q_UNUSED(mode)
+ QList<QByteArray> devices;
+ devices.append("default");
+ return devices;
+}
+
+QAbstractAudioInput* SymbianAudioPlugin::createInput(
+ const QByteArray &device, const QAudioFormat &format)
+{
+ return new SymbianAudioInput(device, format);
+}
+
+QAbstractAudioOutput* SymbianAudioPlugin::createOutput(
+ const QByteArray &device, const QAudioFormat &format)
+{
+ return new SymbianAudioOutput(device, format);
+}
+
+QAbstractAudioDeviceInfo* SymbianAudioPlugin::createDeviceInfo(
+ const QByteArray& device, QAudio::Mode mode)
+{
+ return new SymbianAudioDeviceInfo(device, mode);
+}
+
+Q_EXPORT_STATIC_PLUGIN(SymbianAudioPlugin)
+Q_EXPORT_PLUGIN2(qaudio, SymbianAudioPlugin)
+
+QT_END_NAMESPACE
+
diff --git a/src/plugins/audio/symbian/symbian.pro b/src/plugins/audio/symbian/symbian.pro
new file mode 100644
index 0000000..7355daa
--- /dev/null
+++ b/src/plugins/audio/symbian/symbian.pro
@@ -0,0 +1,31 @@
+QT += multimedia
+TARGET = qaudio
+
+# Paths to DevSound headers
+INCLUDEPATH += /epoc32/include/mmf/common
+INCLUDEPATH += /epoc32/include/mmf/server
+
+HEADERS += \
+ symbianaudio.h \
+ symbianaudiodeviceinfo.h \
+ symbianaudioinput.h \
+ symbianaudiooutput.h \
+ symbianaudioutils.h
+
+SOURCES += \
+ main.cpp \
+ symbianaudiodeviceinfo.cpp \
+ symbianaudioinput.cpp \
+ symbianaudiooutput.cpp \
+ symbianaudioutils.cpp
+
+LIBS += -lmmfdevsound
+
+QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/audio
+target.path = $$[QT_INSTALL_PLUGINS]/audio
+INSTALLS += target
+
+include(../../qpluginbase.pri)
+
+TARGET.UID3 = 0x2001E630
+
diff --git a/src/plugins/audio/symbian/symbianaudio.h b/src/plugins/audio/symbian/symbianaudio.h
new file mode 100644
index 0000000..3fc0419
--- /dev/null
+++ b/src/plugins/audio/symbian/symbianaudio.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtMultimedia 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 SYMBIANAUDIO_H
+#define SYMBIANAUDIO_H
+
+#include <QtCore/qnamespace.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace SymbianAudio {
+
+/**
+ * Default values used by audio input and output classes, when underlying
+ * DevSound instance has not yet been created.
+ */
+
+const int DefaultBufferSize = 4096; // bytes
+const int DefaultNotifyInterval = 1000; // ms
+
+/**
+ * Enumeration used to track state of internal DevSound instances.
+ * Values are translated to the corresponding QAudio::State values by
+ * SymbianAudio::Utils::stateNativeToQt.
+ */
+enum State {
+ ClosedState
+ , InitializingState
+ , ActiveState
+ , IdleState
+ , SuspendedState
+};
+
+} // namespace SymbianAudio
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/audio/symbian/symbianaudiodeviceinfo.cpp b/src/plugins/audio/symbian/symbianaudiodeviceinfo.cpp
new file mode 100644
index 0000000..9701dad
--- /dev/null
+++ b/src/plugins/audio/symbian/symbianaudiodeviceinfo.cpp
@@ -0,0 +1,191 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtMultimedia 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 "symbianaudiodeviceinfo.h"
+#include "symbianaudioutils.h"
+
+QT_BEGIN_NAMESPACE
+
+SymbianAudioDeviceInfo::SymbianAudioDeviceInfo(QByteArray device,
+ QAudio::Mode mode)
+ : m_deviceName(device)
+ , m_mode(mode)
+ , m_updated(false)
+{
+ QT_TRAP_THROWING(m_devsound.reset(CMMFDevSound::NewL()));
+}
+
+SymbianAudioDeviceInfo::~SymbianAudioDeviceInfo()
+{
+
+}
+
+QAudioFormat SymbianAudioDeviceInfo::preferredFormat() const
+{
+ QAudioFormat format;
+ switch (m_mode) {
+ case QAudio::AudioOutput:
+ format.setFrequency(44100);
+ format.setChannels(2);
+ format.setSampleSize(16);
+ format.setByteOrder(QAudioFormat::LittleEndian);
+ format.setSampleType(QAudioFormat::SignedInt);
+ format.setCodec(QLatin1String("audio/pcm"));
+ break;
+
+ case QAudio::AudioInput:
+ format.setFrequency(8000);
+ format.setChannels(1);
+ format.setSampleSize(16);
+ format.setByteOrder(QAudioFormat::LittleEndian);
+ format.setSampleType(QAudioFormat::SignedInt);
+ format.setCodec(QLatin1String("audio/pcm"));
+ break;
+
+ default:
+ Q_ASSERT_X(false, Q_FUNC_INFO, "Invalid mode");
+ }
+
+ if (!isFormatSupported(format)) {
+ if (m_frequencies.size())
+ format.setFrequency(m_frequencies[0]);
+ if (m_channels.size())
+ format.setChannels(m_channels[0]);
+ if (m_sampleSizes.size())
+ format.setSampleSize(m_sampleSizes[0]);
+ if (m_byteOrders.size())
+ format.setByteOrder(m_byteOrders[0]);
+ if (m_sampleTypes.size())
+ format.setSampleType(m_sampleTypes[0]);
+ }
+
+ return format;
+}
+
+bool SymbianAudioDeviceInfo::isFormatSupported(
+ const QAudioFormat &format) const
+{
+ getSupportedFormats();
+ const bool supported =
+ m_codecs.contains(format.codec())
+ && m_frequencies.contains(format.frequency())
+ && m_channels.contains(format.channels())
+ && m_sampleSizes.contains(format.sampleSize())
+ && m_byteOrders.contains(format.byteOrder())
+ && m_sampleTypes.contains(format.sampleType());
+
+ return supported;
+}
+
+QAudioFormat SymbianAudioDeviceInfo::nearestFormat(const QAudioFormat &format) const
+{
+ if (isFormatSupported(format))
+ return format;
+ else
+ return preferredFormat();
+}
+
+QString SymbianAudioDeviceInfo::deviceName() const
+{
+ return m_deviceName;
+}
+
+QStringList SymbianAudioDeviceInfo::codecList()
+{
+ getSupportedFormats();
+ return m_codecs;
+}
+
+QList<int> SymbianAudioDeviceInfo::frequencyList()
+{
+ getSupportedFormats();
+ return m_frequencies;
+}
+
+QList<int> SymbianAudioDeviceInfo::channelsList()
+{
+ getSupportedFormats();
+ return m_channels;
+}
+
+QList<int> SymbianAudioDeviceInfo::sampleSizeList()
+{
+ getSupportedFormats();
+ return m_sampleSizes;
+}
+
+QList<QAudioFormat::Endian> SymbianAudioDeviceInfo::byteOrderList()
+{
+ getSupportedFormats();
+ return m_byteOrders;
+}
+
+QList<QAudioFormat::SampleType> SymbianAudioDeviceInfo::sampleTypeList()
+{
+ getSupportedFormats();
+ return m_sampleTypes;
+}
+
+QList<QByteArray> SymbianAudioDeviceInfo::deviceList(QAudio::Mode mode)
+{
+ Q_UNUSED(mode)
+ QList<QByteArray> devices;
+ devices.append("default");
+ return devices;
+}
+
+void SymbianAudioDeviceInfo::getSupportedFormats() const
+{
+ if (!m_updated) {
+ QScopedPointer<SymbianAudio::DevSoundCapabilities> caps(
+ new SymbianAudio::DevSoundCapabilities(*m_devsound, m_mode));
+
+ SymbianAudio::Utils::capabilitiesNativeToQt(*caps,
+ m_frequencies, m_channels, m_sampleSizes,
+ m_byteOrders, m_sampleTypes);
+
+ m_codecs.append(QLatin1String("audio/pcm"));
+
+ m_updated = true;
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/audio/symbian/symbianaudiodeviceinfo.h b/src/plugins/audio/symbian/symbianaudiodeviceinfo.h
new file mode 100644
index 0000000..250804d
--- /dev/null
+++ b/src/plugins/audio/symbian/symbianaudiodeviceinfo.h
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtMultimedia 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 SYMBIANAUDIODEVICEINFO_H
+#define SYMBIANAUDIODEVICEINFO_H
+
+#include <QtMultimedia/qaudioengine.h>
+#include <sounddevice.h>
+
+QT_BEGIN_NAMESPACE
+
+class SymbianAudioDeviceInfo
+ : public QAbstractAudioDeviceInfo
+{
+ Q_OBJECT
+
+public:
+ SymbianAudioDeviceInfo(QByteArray device, QAudio::Mode mode);
+ ~SymbianAudioDeviceInfo();
+
+ // QAbstractAudioDeviceInfo
+ QAudioFormat preferredFormat() const;
+ bool isFormatSupported(const QAudioFormat &format) const;
+ QAudioFormat nearestFormat(const QAudioFormat &format) const;
+ QString deviceName() const;
+ QStringList codecList();
+ QList<int> frequencyList();
+ QList<int> channelsList();
+ QList<int> sampleSizeList();
+ QList<QAudioFormat::Endian> byteOrderList();
+ QList<QAudioFormat::SampleType> sampleTypeList();
+ QList<QByteArray> deviceList(QAudio::Mode);
+
+private:
+ void getSupportedFormats() const;
+
+private:
+ QScopedPointer<CMMFDevSound> m_devsound;
+
+ QString m_deviceName;
+ QAudio::Mode m_mode;
+
+ // Mutable to allow lazy initialization when called from const-qualified
+ // public functions (isFormatSupported, nearestFormat)
+ mutable bool m_updated;
+ mutable QStringList m_codecs;
+ mutable QList<int> m_frequencies;
+ mutable QList<int> m_channels;
+ mutable QList<int> m_sampleSizes;
+ mutable QList<QAudioFormat::Endian> m_byteOrders;
+ mutable QList<QAudioFormat::SampleType> m_sampleTypes;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/audio/symbian/symbianaudioinput.cpp b/src/plugins/audio/symbian/symbianaudioinput.cpp
new file mode 100644
index 0000000..8200925
--- /dev/null
+++ b/src/plugins/audio/symbian/symbianaudioinput.cpp
@@ -0,0 +1,595 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtMultimedia 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 "symbianaudioinput.h"
+#include "symbianaudioutils.h"
+
+QT_BEGIN_NAMESPACE
+
+//-----------------------------------------------------------------------------
+// Constants
+//-----------------------------------------------------------------------------
+
+const int PushInterval = 50; // ms
+
+
+//-----------------------------------------------------------------------------
+// Private class
+//-----------------------------------------------------------------------------
+
+SymbianAudioInputPrivate::SymbianAudioInputPrivate(
+ SymbianAudioInput *audioDevice)
+ : m_audioDevice(audioDevice)
+{
+
+}
+
+SymbianAudioInputPrivate::~SymbianAudioInputPrivate()
+{
+
+}
+
+qint64 SymbianAudioInputPrivate::readData(char *data, qint64 len)
+{
+ qint64 totalRead = 0;
+
+ if (m_audioDevice->state() == QAudio::ActiveState ||
+ m_audioDevice->state() == QAudio::IdleState) {
+
+ while (totalRead < len) {
+ const qint64 read = m_audioDevice->read(data + totalRead,
+ len - totalRead);
+ if (read > 0)
+ totalRead += read;
+ else
+ break;
+ }
+ }
+
+ return totalRead;
+}
+
+qint64 SymbianAudioInputPrivate::writeData(const char *data, qint64 len)
+{
+ Q_UNUSED(data)
+ Q_UNUSED(len)
+ return 0;
+}
+
+void SymbianAudioInputPrivate::dataReady()
+{
+ emit readyRead();
+}
+
+
+//-----------------------------------------------------------------------------
+// Public functions
+//-----------------------------------------------------------------------------
+
+SymbianAudioInput::SymbianAudioInput(const QByteArray &device,
+ const QAudioFormat &format)
+ : m_device(device)
+ , m_format(format)
+ , m_clientBufferSize(SymbianAudio::DefaultBufferSize)
+ , m_notifyInterval(SymbianAudio::DefaultNotifyInterval)
+ , m_notifyTimer(new QTimer(this))
+ , m_error(QAudio::NoError)
+ , m_internalState(SymbianAudio::ClosedState)
+ , m_externalState(QAudio::StoppedState)
+ , m_pullMode(false)
+ , m_sink(0)
+ , m_pullTimer(new QTimer(this))
+ , m_devSoundBuffer(0)
+ , m_devSoundBufferSize(0)
+ , m_totalBytesReady(0)
+ , m_devSoundBufferPos(0)
+ , m_totalSamplesRecorded(0)
+{
+ connect(m_notifyTimer.data(), SIGNAL(timeout()), this, SIGNAL(notify()));
+
+ SymbianAudio::Utils::formatQtToNative(m_format, m_nativeFourCC,
+ m_nativeFormat);
+
+ m_pullTimer->setInterval(PushInterval);
+ connect(m_pullTimer.data(), SIGNAL(timeout()), this, SLOT(pullData()));
+}
+
+SymbianAudioInput::~SymbianAudioInput()
+{
+ close();
+}
+
+QIODevice* SymbianAudioInput::start(QIODevice *device)
+{
+ stop();
+
+ open();
+ if (SymbianAudio::ClosedState != m_internalState) {
+ if (device) {
+ m_pullMode = true;
+ m_sink = device;
+ } else {
+ m_sink = new SymbianAudioInputPrivate(this);
+ m_sink->open(QIODevice::ReadOnly | QIODevice::Unbuffered);
+ }
+
+ m_elapsed.restart();
+ }
+
+ return m_sink;
+}
+
+void SymbianAudioInput::stop()
+{
+ close();
+}
+
+void SymbianAudioInput::reset()
+{
+ m_totalSamplesRecorded += getSamplesRecorded();
+ m_devSound->Stop();
+ startRecording();
+}
+
+void SymbianAudioInput::suspend()
+{
+ if (SymbianAudio::ActiveState == m_internalState
+ || SymbianAudio::IdleState == m_internalState) {
+ m_notifyTimer->stop();
+ m_pullTimer->stop();
+ m_devSound->Pause();
+ const qint64 samplesRecorded = getSamplesRecorded();
+ m_totalSamplesRecorded += samplesRecorded;
+
+ if (m_devSoundBuffer) {
+ m_devSoundBufferQ.append(m_devSoundBuffer);
+ m_devSoundBuffer = 0;
+ }
+
+ setState(SymbianAudio::SuspendedState);
+ }
+}
+
+void SymbianAudioInput::resume()
+{
+ if (SymbianAudio::SuspendedState == m_internalState)
+ startDataTransfer();
+}
+
+int SymbianAudioInput::bytesReady() const
+{
+ Q_ASSERT(m_devSoundBufferPos <= m_totalBytesReady);
+ return m_totalBytesReady - m_devSoundBufferPos;
+}
+
+int SymbianAudioInput::periodSize() const
+{
+ return bufferSize();
+}
+
+void SymbianAudioInput::setBufferSize(int value)
+{
+ // Note that DevSound does not allow its client to specify the buffer size.
+ // This functionality is available via custom interfaces, but since these
+ // cannot be guaranteed to work across all DevSound implementations, we
+ // do not use them here.
+ // In order to comply with the expected bevahiour of QAudioInput, we store
+ // the value and return it from bufferSize(), but the underlying DevSound
+ // buffer size remains unchanged.
+ if (value > 0)
+ m_clientBufferSize = value;
+}
+
+int SymbianAudioInput::bufferSize() const
+{
+ return m_devSoundBufferSize ? m_devSoundBufferSize : m_clientBufferSize;
+}
+
+void SymbianAudioInput::setNotifyInterval(int ms)
+{
+ if (ms > 0) {
+ const int oldNotifyInterval = m_notifyInterval;
+ m_notifyInterval = ms;
+ if (m_notifyTimer->isActive() && ms != oldNotifyInterval)
+ m_notifyTimer->start(m_notifyInterval);
+ }
+}
+
+int SymbianAudioInput::notifyInterval() const
+{
+ return m_notifyInterval;
+}
+
+qint64 SymbianAudioInput::processedUSecs() const
+{
+ int samplesPlayed = 0;
+ if (m_devSound && SymbianAudio::SuspendedState != m_internalState)
+ samplesPlayed = getSamplesRecorded();
+
+ // Protect against division by zero
+ Q_ASSERT_X(m_format.frequency() > 0, Q_FUNC_INFO, "Invalid frequency");
+
+ const qint64 result = qint64(1000000) *
+ (samplesPlayed + m_totalSamplesRecorded)
+ / m_format.frequency();
+
+ return result;
+}
+
+qint64 SymbianAudioInput::elapsedUSecs() const
+{
+ const qint64 result = (QAudio::StoppedState == state()) ?
+ 0 : m_elapsed.elapsed() * 1000;
+ return result;
+}
+
+QAudio::Error SymbianAudioInput::error() const
+{
+ return m_error;
+}
+
+QAudio::State SymbianAudioInput::state() const
+{
+ return m_externalState;
+}
+
+QAudioFormat SymbianAudioInput::format() const
+{
+ return m_format;
+}
+
+//-----------------------------------------------------------------------------
+// MDevSoundObserver implementation
+//-----------------------------------------------------------------------------
+
+void SymbianAudioInput::InitializeComplete(TInt aError)
+{
+ Q_ASSERT_X(SymbianAudio::InitializingState == m_internalState,
+ Q_FUNC_INFO, "Invalid state");
+
+ if (KErrNone == aError)
+ startRecording();
+}
+
+void SymbianAudioInput::ToneFinished(TInt aError)
+{
+ Q_UNUSED(aError)
+ // This class doesn't use DevSound's tone playback functions, so should
+ // never receive this callback.
+ Q_ASSERT_X(false, Q_FUNC_INFO, "Unexpected callback");
+}
+
+void SymbianAudioInput::BufferToBeFilled(CMMFBuffer *aBuffer)
+{
+ Q_UNUSED(aBuffer)
+ // This class doesn't use DevSound in play mode, so should never receive
+ // this callback.
+ Q_ASSERT_X(false, Q_FUNC_INFO, "Unexpected callback");
+}
+
+void SymbianAudioInput::PlayError(TInt aError)
+{
+ Q_UNUSED(aError)
+ // This class doesn't use DevSound in play mode, so should never receive
+ // this callback.
+ Q_ASSERT_X(false, Q_FUNC_INFO, "Unexpected callback");
+}
+
+void SymbianAudioInput::BufferToBeEmptied(CMMFBuffer *aBuffer)
+{
+ // Following receipt of this callback, DevSound should not provide another
+ // buffer until we have returned the current one.
+ Q_ASSERT_X(!m_devSoundBuffer, Q_FUNC_INFO, "Buffer already held");
+
+ CMMFDataBuffer *const buffer = static_cast<CMMFDataBuffer*>(aBuffer);
+
+ if (!m_devSoundBufferSize)
+ m_devSoundBufferSize = buffer->Data().MaxLength();
+
+ m_totalBytesReady += buffer->Data().Length();
+
+ if (SymbianAudio::SuspendedState == m_internalState) {
+ m_devSoundBufferQ.append(buffer);
+ } else {
+ // Will be returned to DevSound by bufferEmptied().
+ m_devSoundBuffer = buffer;
+ m_devSoundBufferPos = 0;
+
+ if (bytesReady() && !m_pullMode)
+ pushData();
+ }
+}
+
+void SymbianAudioInput::RecordError(TInt aError)
+{
+ Q_UNUSED(aError)
+ setError(QAudio::IOError);
+}
+
+void SymbianAudioInput::ConvertError(TInt aError)
+{
+ Q_UNUSED(aError)
+ // This class doesn't use DevSound's format conversion functions, so
+ // should never receive this callback.
+ Q_ASSERT_X(false, Q_FUNC_INFO, "Unexpected callback");
+}
+
+void SymbianAudioInput::DeviceMessage(TUid aMessageType, const TDesC8 &aMsg)
+{
+ Q_UNUSED(aMessageType)
+ Q_UNUSED(aMsg)
+ // Ignore this callback.
+}
+
+//-----------------------------------------------------------------------------
+// Private functions
+//-----------------------------------------------------------------------------
+
+void SymbianAudioInput::open()
+{
+ Q_ASSERT_X(SymbianAudio::ClosedState == m_internalState,
+ Q_FUNC_INFO, "DevSound already opened");
+
+ QT_TRAP_THROWING( m_devSound.reset(CMMFDevSound::NewL()) )
+
+ QScopedPointer<SymbianAudio::DevSoundCapabilities> caps(
+ new SymbianAudio::DevSoundCapabilities(*m_devSound, QAudio::AudioInput));
+
+ int err = SymbianAudio::Utils::isFormatSupported(m_format, *caps) ?
+ KErrNone : KErrNotSupported;
+
+ if (KErrNone == err) {
+ setState(SymbianAudio::InitializingState);
+ TRAP(err, m_devSound->InitializeL(*this, m_nativeFourCC,
+ EMMFStateRecording));
+ }
+
+ if (KErrNone != err) {
+ setError(QAudio::OpenError);
+ m_devSound.reset();
+ }
+}
+
+void SymbianAudioInput::startRecording()
+{
+ const int samplesRecorded = m_devSound->SamplesRecorded();
+ Q_ASSERT(samplesRecorded == 0);
+
+ TRAPD(err, startDevSoundL());
+ if (KErrNone == err) {
+ startDataTransfer();
+ } else {
+ setError(QAudio::OpenError);
+ close();
+ }
+}
+
+void SymbianAudioInput::startDevSoundL()
+{
+ TMMFCapabilities nativeFormat = m_devSound->Config();
+ m_nativeFormat.iBufferSize = nativeFormat.iBufferSize;
+ m_devSound->SetConfigL(m_nativeFormat);
+ m_devSound->RecordInitL();
+}
+
+void SymbianAudioInput::startDataTransfer()
+{
+ m_notifyTimer->start(m_notifyInterval);
+
+ if (m_pullMode)
+ m_pullTimer->start();
+
+ if (bytesReady()) {
+ setState(SymbianAudio::ActiveState);
+ if (!m_pullMode)
+ pushData();
+ } else {
+ if (SymbianAudio::SuspendedState == m_internalState)
+ setState(SymbianAudio::ActiveState);
+ else
+ setState(SymbianAudio::IdleState);
+ }
+}
+
+CMMFDataBuffer* SymbianAudioInput::currentBuffer() const
+{
+ CMMFDataBuffer *result = m_devSoundBuffer;
+ if (!result && !m_devSoundBufferQ.empty())
+ result = m_devSoundBufferQ.front();
+ return result;
+}
+
+void SymbianAudioInput::pushData()
+{
+ Q_ASSERT_X(bytesReady(), Q_FUNC_INFO, "No data available");
+ Q_ASSERT_X(!m_pullMode, Q_FUNC_INFO, "pushData called when in pull mode");
+ qobject_cast<SymbianAudioInputPrivate *>(m_sink)->dataReady();
+}
+
+qint64 SymbianAudioInput::read(char *data, qint64 len)
+{
+ // SymbianAudioInputPrivate is ready to read data
+
+ Q_ASSERT_X(!m_pullMode, Q_FUNC_INFO,
+ "read called when in pull mode");
+
+ qint64 bytesRead = 0;
+
+ CMMFDataBuffer *buffer = 0;
+ while ((buffer = currentBuffer()) && (bytesRead < len)) {
+ if (SymbianAudio::IdleState == m_internalState)
+ setState(SymbianAudio::ActiveState);
+
+ TDesC8 &inputBuffer = buffer->Data();
+
+ const qint64 inputBytes = bytesReady();
+ const qint64 outputBytes = len - bytesRead;
+ const qint64 copyBytes = outputBytes < inputBytes ?
+ outputBytes : inputBytes;
+
+ memcpy(data, inputBuffer.Ptr() + m_devSoundBufferPos, copyBytes);
+
+ m_devSoundBufferPos += copyBytes;
+ data += copyBytes;
+ bytesRead += copyBytes;
+
+ if (!bytesReady())
+ bufferEmptied();
+ }
+
+ return bytesRead;
+}
+
+void SymbianAudioInput::pullData()
+{
+ Q_ASSERT_X(m_pullMode, Q_FUNC_INFO,
+ "pullData called when in push mode");
+
+ CMMFDataBuffer *buffer = 0;
+ while (buffer = currentBuffer()) {
+ if (SymbianAudio::IdleState == m_internalState)
+ setState(SymbianAudio::ActiveState);
+
+ TDesC8 &inputBuffer = buffer->Data();
+
+ const qint64 inputBytes = bytesReady();
+ const qint64 bytesPushed = m_sink->write(
+ (char*)inputBuffer.Ptr() + m_devSoundBufferPos, inputBytes);
+
+ m_devSoundBufferPos += bytesPushed;
+
+ if (!bytesReady())
+ bufferEmptied();
+
+ if (!bytesPushed)
+ break;
+ }
+}
+
+void SymbianAudioInput::bufferEmptied()
+{
+ m_devSoundBufferPos = 0;
+
+ if (m_devSoundBuffer) {
+ m_totalBytesReady -= m_devSoundBuffer->Data().Length();
+ m_devSoundBuffer = 0;
+ m_devSound->RecordData();
+ } else {
+ Q_ASSERT(!m_devSoundBufferQ.empty());
+ m_totalBytesReady -= m_devSoundBufferQ.front()->Data().Length();
+ m_devSoundBufferQ.erase(m_devSoundBufferQ.begin());
+
+ // If the queue has been emptied, resume transfer from the hardware
+ if (m_devSoundBufferQ.empty())
+ m_devSound->RecordInitL();
+ }
+
+ Q_ASSERT(m_totalBytesReady >= 0);
+}
+
+void SymbianAudioInput::close()
+{
+ m_notifyTimer->stop();
+ m_pullTimer->stop();
+
+ m_error = QAudio::NoError;
+
+ if (m_devSound)
+ m_devSound->Stop();
+ m_devSound.reset();
+ m_devSoundBuffer = 0;
+ m_devSoundBufferSize = 0;
+ m_totalBytesReady = 0;
+
+ if (!m_pullMode) // m_sink is owned
+ delete m_sink;
+ m_pullMode = false;
+ m_sink = 0;
+
+ m_devSoundBufferQ.clear();
+ m_devSoundBufferPos = 0;
+ m_totalSamplesRecorded = 0;
+
+ setState(SymbianAudio::ClosedState);
+}
+
+qint64 SymbianAudioInput::getSamplesRecorded() const
+{
+ qint64 result = 0;
+ if (m_devSound)
+ result = qint64(m_devSound->SamplesRecorded());
+ return result;
+}
+
+void SymbianAudioInput::setError(QAudio::Error error)
+{
+ m_error = error;
+
+ // Although no state transition actually occurs here, a stateChanged event
+ // must be emitted to inform the client that the call to start() was
+ // unsuccessful.
+ if (QAudio::OpenError == error)
+ emit stateChanged(QAudio::StoppedState);
+
+ // Close the DevSound instance. This causes a transition to StoppedState.
+ // This must be done asynchronously in case the current function was called
+ // from a DevSound event handler, in which case deleting the DevSound
+ // instance may cause an exception.
+ QMetaObject::invokeMethod(this, "close", Qt::QueuedConnection);
+}
+
+void SymbianAudioInput::setState(SymbianAudio::State newInternalState)
+{
+ const QAudio::State oldExternalState = m_externalState;
+ m_internalState = newInternalState;
+ m_externalState = SymbianAudio::Utils::stateNativeToQt(
+ m_internalState, initializingState());
+
+ if (m_externalState != oldExternalState)
+ emit stateChanged(m_externalState);
+}
+
+QAudio::State SymbianAudioInput::initializingState() const
+{
+ return QAudio::IdleState;
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/audio/symbian/symbianaudioinput.h b/src/plugins/audio/symbian/symbianaudioinput.h
new file mode 100644
index 0000000..34b7d38
--- /dev/null
+++ b/src/plugins/audio/symbian/symbianaudioinput.h
@@ -0,0 +1,177 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtMultimedia 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 SYMBIANAUDIOINPUT_H
+#define SYMBIANAUDIOINPUT_H
+
+#include <QtMultimedia/qaudioengine.h>
+#include <QTime>
+#include <QTimer>
+#include <sounddevice.h>
+#include "symbianaudio.h"
+
+QT_BEGIN_NAMESPACE
+
+class SymbianAudioInput;
+
+class SymbianAudioInputPrivate : public QIODevice
+{
+ friend class SymbianAudioInput;
+ Q_OBJECT
+public:
+ SymbianAudioInputPrivate(SymbianAudioInput *audio);
+ ~SymbianAudioInputPrivate();
+
+ qint64 readData(char *data, qint64 len);
+ qint64 writeData(const char *data, qint64 len);
+
+ void dataReady();
+
+private:
+ SymbianAudioInput *const m_audioDevice;
+};
+
+class SymbianAudioInput
+ : public QAbstractAudioInput
+ , public MDevSoundObserver
+{
+ friend class SymbianAudioInputPrivate;
+ Q_OBJECT
+public:
+ SymbianAudioInput(const QByteArray &device,
+ const QAudioFormat &audioFormat);
+ ~SymbianAudioInput();
+
+ // QAbstractAudioInput
+ QIODevice* start(QIODevice *device = 0);
+ void stop();
+ void reset();
+ void suspend();
+ void resume();
+ int bytesReady() const;
+ int periodSize() const;
+ void setBufferSize(int value);
+ int bufferSize() const;
+ void setNotifyInterval(int milliSeconds);
+ int notifyInterval() const;
+ qint64 processedUSecs() const;
+ qint64 elapsedUSecs() const;
+ QAudio::Error error() const;
+ QAudio::State state() const;
+ QAudioFormat format() const;
+
+ // MDevSoundObserver
+ void InitializeComplete(TInt aError);
+ void ToneFinished(TInt aError);
+ void BufferToBeFilled(CMMFBuffer *aBuffer);
+ void PlayError(TInt aError);
+ void BufferToBeEmptied(CMMFBuffer *aBuffer);
+ void RecordError(TInt aError);
+ void ConvertError(TInt aError);
+ void DeviceMessage(TUid aMessageType, const TDesC8 &aMsg);
+
+private slots:
+ void pullData();
+
+private:
+ void open();
+ void startRecording();
+ void startDevSoundL();
+ void startDataTransfer();
+ CMMFDataBuffer* currentBuffer() const;
+ void pushData();
+ qint64 read(char *data, qint64 len);
+ void bufferEmptied();
+ Q_INVOKABLE void close();
+
+ qint64 getSamplesRecorded() const;
+
+ void setError(QAudio::Error error);
+ void setState(SymbianAudio::State state);
+
+ QAudio::State initializingState() const;
+
+private:
+ const QByteArray m_device;
+ const QAudioFormat m_format;
+
+ int m_clientBufferSize;
+ int m_notifyInterval;
+ QScopedPointer<QTimer> m_notifyTimer;
+ QTime m_elapsed;
+ QAudio::Error m_error;
+
+ SymbianAudio::State m_internalState;
+ QAudio::State m_externalState;
+
+ bool m_pullMode;
+ QIODevice *m_sink;
+
+ QScopedPointer<QTimer> m_pullTimer;
+
+ QScopedPointer<CMMFDevSound> m_devSound;
+ TUint32 m_nativeFourCC;
+ TMMFCapabilities m_nativeFormat;
+
+ // Latest buffer provided by DevSound, to be empied of data.
+ CMMFDataBuffer *m_devSoundBuffer;
+
+ int m_devSoundBufferSize;
+
+ // Total amount of data in buffers provided by DevSound
+ int m_totalBytesReady;
+
+ // Queue of buffers returned after call to CMMFDevSound::Pause().
+ QList<CMMFDataBuffer *> m_devSoundBufferQ;
+
+ // Current read position within m_devSoundBuffer
+ qint64 m_devSoundBufferPos;
+
+ // Samples recorded up to the last call to suspend(). It is necessary
+ // to cache this because suspend() is implemented using
+ // CMMFDevSound::Stop(), which resets DevSound's SamplesRecorded() counter.
+ quint32 m_totalSamplesRecorded;
+
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/audio/symbian/symbianaudiooutput.cpp b/src/plugins/audio/symbian/symbianaudiooutput.cpp
new file mode 100644
index 0000000..385e169
--- /dev/null
+++ b/src/plugins/audio/symbian/symbianaudiooutput.cpp
@@ -0,0 +1,697 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtMultimedia 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 "symbianaudiooutput.h"
+#include "symbianaudioutils.h"
+
+QT_BEGIN_NAMESPACE
+
+//-----------------------------------------------------------------------------
+// Constants
+//-----------------------------------------------------------------------------
+
+const int UnderflowTimerInterval = 50; // ms
+
+
+//-----------------------------------------------------------------------------
+// Private class
+//-----------------------------------------------------------------------------
+
+SymbianAudioOutputPrivate::SymbianAudioOutputPrivate(
+ SymbianAudioOutput *audioDevice)
+ : m_audioDevice(audioDevice)
+{
+
+}
+
+SymbianAudioOutputPrivate::~SymbianAudioOutputPrivate()
+{
+
+}
+
+qint64 SymbianAudioOutputPrivate::readData(char *data, qint64 len)
+{
+ Q_UNUSED(data)
+ Q_UNUSED(len)
+ return 0;
+}
+
+qint64 SymbianAudioOutputPrivate::writeData(const char *data, qint64 len)
+{
+ qint64 totalWritten = 0;
+
+ if (m_audioDevice->state() == QAudio::ActiveState ||
+ m_audioDevice->state() == QAudio::IdleState) {
+
+ while (totalWritten < len) {
+ const qint64 written = m_audioDevice->pushData(data + totalWritten,
+ len - totalWritten);
+ if (written > 0)
+ totalWritten += written;
+ else
+ break;
+ }
+ }
+
+ return totalWritten;
+}
+
+
+//-----------------------------------------------------------------------------
+// Public functions
+//-----------------------------------------------------------------------------
+
+SymbianAudioOutput::SymbianAudioOutput(const QByteArray &device,
+ const QAudioFormat &format)
+ : m_device(device)
+ , m_format(format)
+ , m_clientBufferSize(SymbianAudio::DefaultBufferSize)
+ , m_notifyInterval(SymbianAudio::DefaultNotifyInterval)
+ , m_notifyTimer(new QTimer(this))
+ , m_error(QAudio::NoError)
+ , m_internalState(SymbianAudio::ClosedState)
+ , m_externalState(QAudio::StoppedState)
+ , m_pullMode(false)
+ , m_source(0)
+ , m_devSoundBuffer(0)
+ , m_devSoundBufferSize(0)
+ , m_bytesWritten(0)
+ , m_pushDataReady(false)
+ , m_bytesPadding(0)
+ , m_underflow(false)
+ , m_lastBuffer(false)
+ , m_underflowTimer(new QTimer(this))
+ , m_samplesPlayed(0)
+ , m_totalSamplesPlayed(0)
+{
+ connect(m_notifyTimer.data(), SIGNAL(timeout()), this, SIGNAL(notify()));
+
+ SymbianAudio::Utils::formatQtToNative(m_format, m_nativeFourCC,
+ m_nativeFormat);
+
+ m_underflowTimer->setInterval(UnderflowTimerInterval);
+ connect(m_underflowTimer.data(), SIGNAL(timeout()), this,
+ SLOT(underflowTimerExpired()));
+}
+
+SymbianAudioOutput::~SymbianAudioOutput()
+{
+ close();
+}
+
+QIODevice* SymbianAudioOutput::start(QIODevice *device)
+{
+ stop();
+
+ // We have to set these before the call to open() because of the
+ // logic in initializingState()
+ if (device) {
+ m_pullMode = true;
+ m_source = device;
+ }
+
+ open();
+
+ if (SymbianAudio::ClosedState != m_internalState) {
+ if (device) {
+ connect(m_source, SIGNAL(readyRead()), this, SLOT(dataReady()));
+ } else {
+ m_source = new SymbianAudioOutputPrivate(this);
+ m_source->open(QIODevice::WriteOnly | QIODevice::Unbuffered);
+ }
+
+ m_elapsed.restart();
+ }
+
+ return m_source;
+}
+
+void SymbianAudioOutput::stop()
+{
+ close();
+}
+
+void SymbianAudioOutput::reset()
+{
+ m_totalSamplesPlayed += getSamplesPlayed();
+ m_devSound->Stop();
+ m_bytesPadding = 0;
+ startPlayback();
+}
+
+void SymbianAudioOutput::suspend()
+{
+ if (SymbianAudio::ActiveState == m_internalState
+ || SymbianAudio::IdleState == m_internalState) {
+ m_notifyTimer->stop();
+ m_underflowTimer->stop();
+
+ const qint64 samplesWritten = SymbianAudio::Utils::bytesToSamples(
+ m_format, m_bytesWritten);
+ m_bytesWritten = 0;
+
+ const qint64 samplesPlayed = getSamplesPlayed();
+
+ // CMMFDevSound::Pause() is not guaranteed to work correctly in all
+ // implementations, for play-mode DevSound sessions. We therefore
+ // have to implement suspend() by calling CMMFDevSound::Stop().
+ // Because this causes buffered data to be dropped, we replace the
+ // lost data with silence following a call to resume(), in order to
+ // ensure that processedUSecs() returns the correct value.
+ m_devSound->Stop();
+ m_totalSamplesPlayed += samplesPlayed;
+
+ // Calculate the amount of data dropped
+ const qint64 paddingSamples = samplesWritten - samplesPlayed;
+ m_bytesPadding = SymbianAudio::Utils::samplesToBytes(m_format,
+ paddingSamples);
+
+ setState(SymbianAudio::SuspendedState);
+ }
+}
+
+void SymbianAudioOutput::resume()
+{
+ if (SymbianAudio::SuspendedState == m_internalState)
+ startPlayback();
+}
+
+int SymbianAudioOutput::bytesFree() const
+{
+ int result = 0;
+ if (m_devSoundBuffer) {
+ const TDes8 &outputBuffer = m_devSoundBuffer->Data();
+ result = outputBuffer.MaxLength() - outputBuffer.Length();
+ }
+ return result;
+}
+
+int SymbianAudioOutput::periodSize() const
+{
+ return bufferSize();
+}
+
+void SymbianAudioOutput::setBufferSize(int value)
+{
+ // Note that DevSound does not allow its client to specify the buffer size.
+ // This functionality is available via custom interfaces, but since these
+ // cannot be guaranteed to work across all DevSound implementations, we
+ // do not use them here.
+ // In order to comply with the expected bevahiour of QAudioOutput, we store
+ // the value and return it from bufferSize(), but the underlying DevSound
+ // buffer size remains unchanged.
+ if (value > 0)
+ m_clientBufferSize = value;
+}
+
+int SymbianAudioOutput::bufferSize() const
+{
+ return m_devSoundBufferSize ? m_devSoundBufferSize : m_clientBufferSize;
+}
+
+void SymbianAudioOutput::setNotifyInterval(int ms)
+{
+ if (ms > 0) {
+ const int oldNotifyInterval = m_notifyInterval;
+ m_notifyInterval = ms;
+ if (m_notifyTimer->isActive() && ms != oldNotifyInterval)
+ m_notifyTimer->start(m_notifyInterval);
+ }
+}
+
+int SymbianAudioOutput::notifyInterval() const
+{
+ return m_notifyInterval;
+}
+
+qint64 SymbianAudioOutput::processedUSecs() const
+{
+ int samplesPlayed = 0;
+ if (m_devSound && SymbianAudio::SuspendedState != m_internalState)
+ samplesPlayed = getSamplesPlayed();
+
+ // Protect against division by zero
+ Q_ASSERT_X(m_format.frequency() > 0, Q_FUNC_INFO, "Invalid frequency");
+
+ const qint64 result = qint64(1000000) *
+ (samplesPlayed + m_totalSamplesPlayed)
+ / m_format.frequency();
+
+ return result;
+}
+
+qint64 SymbianAudioOutput::elapsedUSecs() const
+{
+ const qint64 result = (QAudio::StoppedState == state()) ?
+ 0 : m_elapsed.elapsed() * 1000;
+ return result;
+}
+
+QAudio::Error SymbianAudioOutput::error() const
+{
+ return m_error;
+}
+
+QAudio::State SymbianAudioOutput::state() const
+{
+ return m_externalState;
+}
+
+QAudioFormat SymbianAudioOutput::format() const
+{
+ return m_format;
+}
+
+//-----------------------------------------------------------------------------
+// MDevSoundObserver implementation
+//-----------------------------------------------------------------------------
+
+void SymbianAudioOutput::InitializeComplete(TInt aError)
+{
+ Q_ASSERT_X(SymbianAudio::InitializingState == m_internalState,
+ Q_FUNC_INFO, "Invalid state");
+
+ if (KErrNone == aError)
+ startPlayback();
+}
+
+void SymbianAudioOutput::ToneFinished(TInt aError)
+{
+ Q_UNUSED(aError)
+ // This class doesn't use DevSound's tone playback functions, so should
+ // never receive this callback.
+ Q_ASSERT_X(false, Q_FUNC_INFO, "Unexpected callback");
+}
+
+void SymbianAudioOutput::BufferToBeFilled(CMMFBuffer *aBuffer)
+{
+ // Following receipt of this callback, DevSound should not provide another
+ // buffer until we have returned the current one.
+ Q_ASSERT_X(!m_devSoundBuffer, Q_FUNC_INFO, "Buffer already held");
+
+ // Will be returned to DevSound by bufferFilled().
+ m_devSoundBuffer = static_cast<CMMFDataBuffer*>(aBuffer);
+
+ if (!m_devSoundBufferSize)
+ m_devSoundBufferSize = m_devSoundBuffer->Data().MaxLength();
+
+ writePaddingData();
+
+ if (m_pullMode && isDataReady() && !m_bytesPadding)
+ pullData();
+}
+
+void SymbianAudioOutput::PlayError(TInt aError)
+{
+ switch (aError) {
+ case KErrUnderflow:
+ m_underflow = true;
+ if (m_pullMode && !m_lastBuffer)
+ setError(QAudio::UnderrunError);
+ else
+ setState(SymbianAudio::IdleState);
+ break;
+ default:
+ setError(QAudio::IOError);
+ break;
+ }
+}
+
+void SymbianAudioOutput::BufferToBeEmptied(CMMFBuffer *aBuffer)
+{
+ Q_UNUSED(aBuffer)
+ // This class doesn't use DevSound in record mode, so should never receive
+ // this callback.
+ Q_ASSERT_X(false, Q_FUNC_INFO, "Unexpected callback");
+}
+
+void SymbianAudioOutput::RecordError(TInt aError)
+{
+ Q_UNUSED(aError)
+ // This class doesn't use DevSound in record mode, so should never receive
+ // this callback.
+ Q_ASSERT_X(false, Q_FUNC_INFO, "Unexpected callback");
+}
+
+void SymbianAudioOutput::ConvertError(TInt aError)
+{
+ Q_UNUSED(aError)
+ // This class doesn't use DevSound's format conversion functions, so
+ // should never receive this callback.
+ Q_ASSERT_X(false, Q_FUNC_INFO, "Unexpected callback");
+}
+
+void SymbianAudioOutput::DeviceMessage(TUid aMessageType, const TDesC8 &aMsg)
+{
+ Q_UNUSED(aMessageType)
+ Q_UNUSED(aMsg)
+ // Ignore this callback.
+}
+
+//-----------------------------------------------------------------------------
+// Private functions
+//-----------------------------------------------------------------------------
+
+void SymbianAudioOutput::dataReady()
+{
+ // Client-provided QIODevice has data ready to read.
+
+ Q_ASSERT_X(m_source->bytesAvailable(), Q_FUNC_INFO,
+ "readyRead signal received, but no data available");
+
+ if (!m_bytesPadding)
+ pullData();
+}
+
+void SymbianAudioOutput::underflowTimerExpired()
+{
+ const TInt samplesPlayed = getSamplesPlayed();
+ if (m_samplesPlayed && (samplesPlayed == m_samplesPlayed)) {
+ setError(QAudio::UnderrunError);
+ } else {
+ m_samplesPlayed = samplesPlayed;
+ m_underflowTimer->start();
+ }
+}
+
+void SymbianAudioOutput::open()
+{
+ Q_ASSERT_X(SymbianAudio::ClosedState == m_internalState,
+ Q_FUNC_INFO, "DevSound already opened");
+
+ QT_TRAP_THROWING( m_devSound.reset(CMMFDevSound::NewL()) )
+
+ QScopedPointer<SymbianAudio::DevSoundCapabilities> caps(
+ new SymbianAudio::DevSoundCapabilities(*m_devSound,
+ QAudio::AudioOutput));
+
+ int err = SymbianAudio::Utils::isFormatSupported(m_format, *caps) ?
+ KErrNone : KErrNotSupported;
+
+ if (KErrNone == err) {
+ setState(SymbianAudio::InitializingState);
+ TRAP(err, m_devSound->InitializeL(*this, m_nativeFourCC,
+ EMMFStatePlaying));
+ }
+
+ if (KErrNone != err) {
+ setError(QAudio::OpenError);
+ m_devSound.reset();
+ }
+}
+
+void SymbianAudioOutput::startPlayback()
+{
+ TRAPD(err, startDevSoundL());
+ if (KErrNone == err) {
+ if (isDataReady())
+ setState(SymbianAudio::ActiveState);
+ else
+ setState(SymbianAudio::IdleState);
+
+ m_notifyTimer->start(m_notifyInterval);
+ m_underflow = false;
+
+ Q_ASSERT(m_devSound->SamplesPlayed() == 0);
+
+ writePaddingData();
+
+ if (m_pullMode && m_source->bytesAvailable() && !m_bytesPadding)
+ dataReady();
+ } else {
+ setError(QAudio::OpenError);
+ close();
+ }
+}
+
+void SymbianAudioOutput::startDevSoundL()
+{
+ TMMFCapabilities nativeFormat = m_devSound->Config();
+ m_nativeFormat.iBufferSize = nativeFormat.iBufferSize;
+ m_devSound->SetConfigL(m_nativeFormat);
+ m_devSound->PlayInitL();
+}
+
+void SymbianAudioOutput::writePaddingData()
+{
+ // See comments in suspend()
+
+ while (m_devSoundBuffer && m_bytesPadding) {
+ if (SymbianAudio::IdleState == m_internalState)
+ setState(SymbianAudio::ActiveState);
+
+ TDes8 &outputBuffer = m_devSoundBuffer->Data();
+ const qint64 outputBytes = bytesFree();
+ const qint64 paddingBytes = outputBytes < m_bytesPadding ?
+ outputBytes : m_bytesPadding;
+ unsigned char *ptr = const_cast<unsigned char*>(outputBuffer.Ptr());
+ Mem::FillZ(ptr, paddingBytes);
+ outputBuffer.SetLength(outputBuffer.Length() + paddingBytes);
+ m_bytesPadding -= paddingBytes;
+
+ if (m_pullMode && m_source->atEnd())
+ lastBufferFilled();
+ if (paddingBytes == outputBytes)
+ bufferFilled();
+ }
+}
+
+qint64 SymbianAudioOutput::pushData(const char *data, qint64 len)
+{
+ // Data has been written to SymbianAudioOutputPrivate
+
+ Q_ASSERT_X(!m_pullMode, Q_FUNC_INFO,
+ "pushData called when in pull mode");
+
+ const unsigned char *const inputPtr =
+ reinterpret_cast<const unsigned char*>(data);
+ qint64 bytesWritten = 0;
+
+ if (SymbianAudio::IdleState == m_internalState)
+ setState(SymbianAudio::ActiveState);
+
+ while (m_devSoundBuffer && (bytesWritten < len)) {
+ // writePaddingData() is called from BufferToBeFilled(), so we should
+ // never have any padding data left at this point.
+ Q_ASSERT_X(0 == m_bytesPadding, Q_FUNC_INFO,
+ "Padding bytes remaining in pushData");
+
+ TDes8 &outputBuffer = m_devSoundBuffer->Data();
+
+ const qint64 outputBytes = bytesFree();
+ const qint64 inputBytes = len - bytesWritten;
+ const qint64 copyBytes = outputBytes < inputBytes ?
+ outputBytes : inputBytes;
+
+ outputBuffer.Append(inputPtr + bytesWritten, copyBytes);
+ bytesWritten += copyBytes;
+
+ bufferFilled();
+ }
+
+ m_pushDataReady = (bytesWritten < len);
+
+ // If DevSound is still initializing (m_internalState == InitializingState),
+ // we cannot transition m_internalState to ActiveState, but we must emit
+ // an (external) state change from IdleState to ActiveState. The following
+ // call triggers this signal.
+ setState(m_internalState);
+
+ return bytesWritten;
+}
+
+void SymbianAudioOutput::pullData()
+{
+ Q_ASSERT_X(m_pullMode, Q_FUNC_INFO,
+ "pullData called when in push mode");
+
+ if (m_bytesPadding)
+ m_bytesPadding = 1;
+
+ // writePaddingData() is called by BufferToBeFilled() before pullData(),
+ // so we should never have any padding data left at this point.
+ Q_ASSERT_X(0 == m_bytesPadding, Q_FUNC_INFO,
+ "Padding bytes remaining in pullData");
+
+ qint64 inputBytes = m_source->bytesAvailable();
+ while (m_devSoundBuffer && inputBytes) {
+ if (SymbianAudio::IdleState == m_internalState)
+ setState(SymbianAudio::ActiveState);
+
+ TDes8 &outputBuffer = m_devSoundBuffer->Data();
+
+ const qint64 outputBytes = bytesFree();
+ const qint64 copyBytes = outputBytes < inputBytes ?
+ outputBytes : inputBytes;
+
+ char *outputPtr = (char*)(outputBuffer.Ptr() + outputBuffer.Length());
+ const qint64 bytesCopied = m_source->read(outputPtr, copyBytes);
+ Q_ASSERT(bytesCopied == copyBytes);
+ outputBuffer.SetLength(outputBuffer.Length() + bytesCopied);
+ inputBytes -= bytesCopied;
+
+ if (m_source->atEnd())
+ lastBufferFilled();
+ else if (copyBytes == outputBytes)
+ bufferFilled();
+ }
+}
+
+void SymbianAudioOutput::bufferFilled()
+{
+ Q_ASSERT_X(m_devSoundBuffer, Q_FUNC_INFO, "No buffer to return");
+
+ const TDes8 &outputBuffer = m_devSoundBuffer->Data();
+ m_bytesWritten += outputBuffer.Length();
+
+ m_devSoundBuffer = 0;
+
+ m_samplesPlayed = getSamplesPlayed();
+ m_underflowTimer->start();
+
+ if (QAudio::UnderrunError == m_error)
+ m_error = QAudio::NoError;
+
+ m_devSound->PlayData();
+}
+
+void SymbianAudioOutput::lastBufferFilled()
+{
+ Q_ASSERT_X(m_devSoundBuffer, Q_FUNC_INFO, "No buffer to fill");
+ Q_ASSERT_X(!m_lastBuffer, Q_FUNC_INFO, "Last buffer already sent");
+ m_lastBuffer = true;
+ m_devSoundBuffer->SetLastBuffer(ETrue);
+ bufferFilled();
+}
+
+void SymbianAudioOutput::close()
+{
+ m_notifyTimer->stop();
+ m_underflowTimer->stop();
+
+ m_error = QAudio::NoError;
+
+ if (m_devSound)
+ m_devSound->Stop();
+ m_devSound.reset();
+ m_devSoundBuffer = 0;
+ m_devSoundBufferSize = 0;
+
+ if (!m_pullMode) // m_source is owned
+ delete m_source;
+ m_pullMode = false;
+ m_source = 0;
+
+ m_bytesWritten = 0;
+ m_pushDataReady = false;
+ m_bytesPadding = 0;
+ m_underflow = false;
+ m_lastBuffer = false;
+ m_samplesPlayed = 0;
+ m_totalSamplesPlayed = 0;
+
+ setState(SymbianAudio::ClosedState);
+}
+
+qint64 SymbianAudioOutput::getSamplesPlayed() const
+{
+ qint64 result = 0;
+ if (m_devSound) {
+ const qint64 samplesWritten = SymbianAudio::Utils::bytesToSamples(
+ m_format, m_bytesWritten);
+
+ if (m_underflow) {
+ result = samplesWritten;
+ } else {
+ // This is necessary because some DevSound implementations report
+ // that they have played more data than has actually been provided to them
+ // by the client.
+ const qint64 devSoundSamplesPlayed(m_devSound->SamplesPlayed());
+ result = qMin(devSoundSamplesPlayed, samplesWritten);
+ }
+ }
+ return result;
+}
+
+void SymbianAudioOutput::setError(QAudio::Error error)
+{
+ m_error = error;
+
+ // Although no state transition actually occurs here, a stateChanged event
+ // must be emitted to inform the client that the call to start() was
+ // unsuccessful.
+ if (QAudio::OpenError == error)
+ emit stateChanged(QAudio::StoppedState);
+
+ if (QAudio::UnderrunError == error)
+ setState(SymbianAudio::IdleState);
+ else
+ // Close the DevSound instance. This causes a transition to
+ // StoppedState. This must be done asynchronously in case the
+ // current function was called from a DevSound event handler, in which
+ // case deleting the DevSound instance may cause an exception.
+ QMetaObject::invokeMethod(this, "close", Qt::QueuedConnection);
+}
+
+void SymbianAudioOutput::setState(SymbianAudio::State newInternalState)
+{
+ const QAudio::State oldExternalState = m_externalState;
+ m_internalState = newInternalState;
+ m_externalState = SymbianAudio::Utils::stateNativeToQt(
+ m_internalState, initializingState());
+
+ if (m_externalState != oldExternalState)
+ emit stateChanged(m_externalState);
+}
+
+bool SymbianAudioOutput::isDataReady() const
+{
+ return (m_source && m_source->bytesAvailable())
+ || m_bytesPadding
+ || m_pushDataReady;
+}
+
+QAudio::State SymbianAudioOutput::initializingState() const
+{
+ return isDataReady() ? QAudio::ActiveState : QAudio::IdleState;
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/audio/symbian/symbianaudiooutput.h b/src/plugins/audio/symbian/symbianaudiooutput.h
new file mode 100644
index 0000000..8994e46
--- /dev/null
+++ b/src/plugins/audio/symbian/symbianaudiooutput.h
@@ -0,0 +1,199 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtMultimedia 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 SYMBIANAUDIOOUTPUT_H
+#define SYMBIANAUDIOOUTPUT_H
+
+#include <QtMultimedia/qaudioengine.h>
+#include <QTime>
+#include <QTimer>
+#include <sounddevice.h>
+#include "symbianaudio.h"
+
+QT_BEGIN_NAMESPACE
+
+class SymbianAudioOutput;
+
+class SymbianAudioOutputPrivate : public QIODevice
+{
+ friend class SymbianAudioOutput;
+ Q_OBJECT
+public:
+ SymbianAudioOutputPrivate(SymbianAudioOutput *audio);
+ ~SymbianAudioOutputPrivate();
+
+ qint64 readData(char *data, qint64 len);
+ qint64 writeData(const char *data, qint64 len);
+
+private:
+ SymbianAudioOutput *const m_audioDevice;
+};
+
+class SymbianAudioOutput
+ : public QAbstractAudioOutput
+ , public MDevSoundObserver
+{
+ friend class SymbianAudioOutputPrivate;
+ Q_OBJECT
+public:
+ SymbianAudioOutput(const QByteArray &device,
+ const QAudioFormat &audioFormat);
+ ~SymbianAudioOutput();
+
+ // QAbstractAudioOutput
+ QIODevice* start(QIODevice *device = 0);
+ void stop();
+ void reset();
+ void suspend();
+ void resume();
+ int bytesFree() const;
+ int periodSize() const;
+ void setBufferSize(int value);
+ int bufferSize() const;
+ void setNotifyInterval(int milliSeconds);
+ int notifyInterval() const;
+ qint64 processedUSecs() const;
+ qint64 elapsedUSecs() const;
+ QAudio::Error error() const;
+ QAudio::State state() const;
+ QAudioFormat format() const;
+
+ // MDevSoundObserver
+ void InitializeComplete(TInt aError);
+ void ToneFinished(TInt aError);
+ void BufferToBeFilled(CMMFBuffer *aBuffer);
+ void PlayError(TInt aError);
+ void BufferToBeEmptied(CMMFBuffer *aBuffer);
+ void RecordError(TInt aError);
+ void ConvertError(TInt aError);
+ void DeviceMessage(TUid aMessageType, const TDesC8 &aMsg);
+
+private slots:
+ void dataReady();
+ void underflowTimerExpired();
+
+private:
+ void open();
+ void startPlayback();
+ void startDevSoundL();
+ void writePaddingData();
+ qint64 pushData(const char *data, qint64 len);
+ void pullData();
+ void bufferFilled();
+ void lastBufferFilled();
+ Q_INVOKABLE void close();
+
+ qint64 getSamplesPlayed() const;
+
+ void setError(QAudio::Error error);
+ void setState(SymbianAudio::State state);
+
+ bool isDataReady() const;
+ QAudio::State initializingState() const;
+
+private:
+ const QByteArray m_device;
+ const QAudioFormat m_format;
+
+ int m_clientBufferSize;
+ int m_notifyInterval;
+ QScopedPointer<QTimer> m_notifyTimer;
+ QTime m_elapsed;
+ QAudio::Error m_error;
+
+ SymbianAudio::State m_internalState;
+ QAudio::State m_externalState;
+
+ bool m_pullMode;
+ QIODevice *m_source;
+
+ QScopedPointer<CMMFDevSound> m_devSound;
+ TUint32 m_nativeFourCC;
+ TMMFCapabilities m_nativeFormat;
+
+ // Buffer provided by DevSound, to be filled with data.
+ CMMFDataBuffer *m_devSoundBuffer;
+
+ int m_devSoundBufferSize;
+
+ // Number of bytes transferred from QIODevice to QAudioOutput. It is
+ // necessary to count this because data is dropped when suspend() is
+ // called. The difference between the position reported by DevSound and
+ // this value allows us to calculate m_bytesPadding;
+ quint32 m_bytesWritten;
+
+ // True if client has provided data while the audio subsystem was not
+ // ready to consume it.
+ bool m_pushDataReady;
+
+ // Number of zero bytes which will be written when client calls resume().
+ quint32 m_bytesPadding;
+
+ // True if PlayError(KErrUnderflow) has been called.
+ bool m_underflow;
+
+ // True if a buffer marked with the "last buffer" flag has been provided
+ // to DevSound.
+ bool m_lastBuffer;
+
+ // Some DevSound implementations ignore all underflow errors raised by the
+ // audio driver, unless the last buffer flag has been set by the client.
+ // In push-mode playback, this flag will never be set, so the underflow
+ // error will never be reported. In order to work around this, a timer
+ // is used, which gets reset every time the client provides more data. If
+ // the timer expires, an underflow error is raised by this object.
+ QScopedPointer<QTimer> m_underflowTimer;
+
+ // Result of previous call to CMMFDevSound::SamplesPlayed(). This value is
+ // used to determine whether, when m_underflowTimer expires, an
+ // underflow error has actually occurred.
+ quint32 m_samplesPlayed;
+
+ // Samples played up to the last call to suspend(). It is necessary
+ // to cache this because suspend() is implemented using
+ // CMMFDevSound::Stop(), which resets DevSound's SamplesPlayed() counter.
+ quint32 m_totalSamplesPlayed;
+
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/audio/symbian/symbianaudioutils.cpp b/src/plugins/audio/symbian/symbianaudioutils.cpp
new file mode 100644
index 0000000..f04c198
--- /dev/null
+++ b/src/plugins/audio/symbian/symbianaudioutils.cpp
@@ -0,0 +1,395 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtMultimedia 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 "symbianaudioutils.h"
+#include <mmffourcc.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace SymbianAudio {
+
+DevSoundCapabilities::DevSoundCapabilities(CMMFDevSound &devsound,
+ QAudio::Mode mode)
+{
+ QT_TRAP_THROWING(constructL(devsound, mode));
+}
+
+DevSoundCapabilities::~DevSoundCapabilities()
+{
+ m_fourCC.Close();
+}
+
+void DevSoundCapabilities::constructL(CMMFDevSound &devsound,
+ QAudio::Mode mode)
+{
+ m_caps = devsound.Capabilities();
+
+ TMMFPrioritySettings settings;
+
+ switch (mode) {
+ case QAudio::AudioOutput:
+ settings.iState = EMMFStatePlaying;
+ devsound.GetSupportedInputDataTypesL(m_fourCC, settings);
+ break;
+
+ case QAudio::AudioInput:
+ settings.iState = EMMFStateRecording;
+ devsound.GetSupportedInputDataTypesL(m_fourCC, settings);
+ break;
+
+ default:
+ Q_ASSERT_X(false, Q_FUNC_INFO, "Invalid mode");
+ }
+}
+
+namespace Utils {
+
+//-----------------------------------------------------------------------------
+// Static data
+//-----------------------------------------------------------------------------
+
+// Sample rate / frequency
+
+typedef TMMFSampleRate SampleRateNative;
+typedef int SampleRateQt;
+
+const int SampleRateCount = 12;
+
+const SampleRateNative SampleRateListNative[SampleRateCount] = {
+ EMMFSampleRate8000Hz
+ , EMMFSampleRate11025Hz
+ , EMMFSampleRate12000Hz
+ , EMMFSampleRate16000Hz
+ , EMMFSampleRate22050Hz
+ , EMMFSampleRate24000Hz
+ , EMMFSampleRate32000Hz
+ , EMMFSampleRate44100Hz
+ , EMMFSampleRate48000Hz
+ , EMMFSampleRate64000Hz
+ , EMMFSampleRate88200Hz
+ , EMMFSampleRate96000Hz
+};
+
+const SampleRateQt SampleRateListQt[SampleRateCount] = {
+ 8000
+ , 11025
+ , 12000
+ , 16000
+ , 22050
+ , 24000
+ , 32000
+ , 44100
+ , 48000
+ , 64000
+ , 88200
+ , 96000
+};
+
+// Channels
+
+typedef TMMFMonoStereo ChannelsNative;
+typedef int ChannelsQt;
+
+const int ChannelsCount = 2;
+
+const ChannelsNative ChannelsListNative[ChannelsCount] = {
+ EMMFMono
+ , EMMFStereo
+};
+
+const ChannelsQt ChannelsListQt[ChannelsCount] = {
+ 1
+ , 2
+};
+
+// Encoding
+
+const int EncodingCount = 6;
+
+const TUint32 EncodingFourCC[EncodingCount] = {
+ KMMFFourCCCodePCM8 // 0
+ , KMMFFourCCCodePCMU8 // 1
+ , KMMFFourCCCodePCM16 // 2
+ , KMMFFourCCCodePCMU16 // 3
+ , KMMFFourCCCodePCM16B // 4
+ , KMMFFourCCCodePCMU16B // 5
+};
+
+// The characterised DevSound API specification states that the iEncoding
+// field in TMMFCapabilities is ignored, and that the FourCC should be used
+// to specify the PCM encoding.
+// See "SGL.GT0287.102 Multimedia DevSound Baseline Compatibility.doc" in the
+// mm_info/mm_docs repository.
+const TMMFSoundEncoding EncodingNative[EncodingCount] = {
+ EMMFSoundEncoding16BitPCM // 0
+ , EMMFSoundEncoding16BitPCM // 1
+ , EMMFSoundEncoding16BitPCM // 2
+ , EMMFSoundEncoding16BitPCM // 3
+ , EMMFSoundEncoding16BitPCM // 4
+ , EMMFSoundEncoding16BitPCM // 5
+};
+
+
+const int EncodingSampleSize[EncodingCount] = {
+ 8 // 0
+ , 8 // 1
+ , 16 // 2
+ , 16 // 3
+ , 16 // 4
+ , 16 // 5
+};
+
+const QAudioFormat::Endian EncodingByteOrder[EncodingCount] = {
+ QAudioFormat::LittleEndian // 0
+ , QAudioFormat::LittleEndian // 1
+ , QAudioFormat::LittleEndian // 2
+ , QAudioFormat::LittleEndian // 3
+ , QAudioFormat::BigEndian // 4
+ , QAudioFormat::BigEndian // 5
+};
+
+const QAudioFormat::SampleType EncodingSampleType[EncodingCount] = {
+ QAudioFormat::SignedInt // 0
+ , QAudioFormat::UnSignedInt // 1
+ , QAudioFormat::SignedInt // 2
+ , QAudioFormat::UnSignedInt // 3
+ , QAudioFormat::SignedInt // 4
+ , QAudioFormat::UnSignedInt // 5
+};
+
+
+//-----------------------------------------------------------------------------
+// Private functions
+//-----------------------------------------------------------------------------
+
+// Helper functions for implementing parameter conversions
+
+template<typename Input>
+bool findValue(const Input *inputArray, int length, Input input, int &index) {
+ bool result = false;
+ for (int i=0; !result && i<length; ++i)
+ if (inputArray[i] == input) {
+ index = i;
+ result = true;
+ }
+ return result;
+}
+
+template<typename Input, typename Output>
+bool convertValue(const Input *inputArray, const Output *outputArray,
+ int length, Input input, Output &output) {
+ int index;
+ const bool result = findValue<Input>(inputArray, length, input, index);
+ if (result)
+ output = outputArray[index];
+ return result;
+}
+
+/**
+ * Macro which is used to generate the implementation of the conversion
+ * functions. The implementation is just a wrapper around the templated
+ * convertValue function, e.g.
+ *
+ * CONVERSION_FUNCTION_IMPL(SampleRate, Qt, Native)
+ *
+ * expands to
+ *
+ * bool SampleRateQtToNative(int input, TMMFSampleRate &output) {
+ * return convertValue<SampleRateQt, SampleRateNative>
+ * (SampleRateListQt, SampleRateListNative, SampleRateCount,
+ * input, output);
+ * }
+ */
+#define CONVERSION_FUNCTION_IMPL(FieldLc, Field, Input, Output) \
+bool FieldLc##Input##To##Output(Field##Input input, Field##Output &output) { \
+ return convertValue<Field##Input, Field##Output>(Field##List##Input, \
+ Field##List##Output, Field##Count, input, output); \
+}
+
+//-----------------------------------------------------------------------------
+// Local helper functions
+//-----------------------------------------------------------------------------
+
+CONVERSION_FUNCTION_IMPL(sampleRate, SampleRate, Qt, Native)
+CONVERSION_FUNCTION_IMPL(sampleRate, SampleRate, Native, Qt)
+CONVERSION_FUNCTION_IMPL(channels, Channels, Qt, Native)
+CONVERSION_FUNCTION_IMPL(channels, Channels, Native, Qt)
+
+bool sampleInfoQtToNative(int inputSampleSize,
+ QAudioFormat::Endian inputByteOrder,
+ QAudioFormat::SampleType inputSampleType,
+ TUint32 &outputFourCC,
+ TMMFSoundEncoding &outputEncoding) {
+
+ bool found = false;
+
+ for (int i=0; i<EncodingCount && !found; ++i) {
+ if ( EncodingSampleSize[i] == inputSampleSize
+ && EncodingByteOrder[i] == inputByteOrder
+ && EncodingSampleType[i] == inputSampleType) {
+ outputFourCC = EncodingFourCC[i];
+ outputEncoding = EncodingNative[i]; // EMMFSoundEncoding16BitPCM
+ found = true;
+ }
+ }
+
+ return found;
+}
+
+//-----------------------------------------------------------------------------
+// Public functions
+//-----------------------------------------------------------------------------
+
+void capabilitiesNativeToQt(const DevSoundCapabilities &caps,
+ QList<int> &frequencies,
+ QList<int> &channels,
+ QList<int> &sampleSizes,
+ QList<QAudioFormat::Endian> &byteOrders,
+ QList<QAudioFormat::SampleType> &sampleTypes) {
+
+ frequencies.clear();
+ sampleSizes.clear();
+ byteOrders.clear();
+ sampleTypes.clear();
+ channels.clear();
+
+ for (int i=0; i<SampleRateCount; ++i)
+ if (caps.caps().iRate & SampleRateListNative[i])
+ frequencies += SampleRateListQt[i];
+
+ for (int i=0; i<ChannelsCount; ++i)
+ if (caps.caps().iChannels & ChannelsListNative[i])
+ channels += ChannelsListQt[i];
+
+ for (int i=0; i<EncodingCount; ++i) {
+ if (caps.fourCC().Find(EncodingFourCC[i]) != KErrNotFound) {
+ sampleSizes += EncodingSampleSize[i];
+ byteOrders += EncodingByteOrder[i];
+ sampleTypes += EncodingSampleType[i];
+ }
+ }
+
+}
+
+bool isFormatSupported(const QAudioFormat &formatQt,
+ const DevSoundCapabilities &caps) {
+ TMMFCapabilities formatNative;
+ TUint32 fourCC;
+
+ bool result = false;
+ if (formatQt.codec() == "audio/pcm" &&
+ formatQtToNative(formatQt, fourCC, formatNative)) {
+ result =
+ (formatNative.iRate & caps.caps().iRate)
+ && (formatNative.iChannels & caps.caps().iChannels)
+ && (caps.fourCC().Find(fourCC) != KErrNotFound);
+ }
+ return result;
+}
+
+bool formatQtToNative(const QAudioFormat &inputFormat,
+ TUint32 &outputFourCC,
+ TMMFCapabilities &outputFormat) {
+
+ bool result = false;
+
+ // Need to use temporary variables because TMMFCapabilities fields are all
+ // TInt, rather than MMF enumerated types.
+ TMMFSampleRate outputSampleRate;
+ TMMFMonoStereo outputChannels;
+ TMMFSoundEncoding outputEncoding;
+
+ if (inputFormat.codec() == "audio/pcm") {
+ result =
+ sampleRateQtToNative(inputFormat.frequency(), outputSampleRate)
+ && channelsQtToNative(inputFormat.channels(), outputChannels)
+ && sampleInfoQtToNative(inputFormat.sampleSize(),
+ inputFormat.byteOrder(),
+ inputFormat.sampleType(),
+ outputFourCC,
+ outputEncoding);
+ }
+
+ if (result) {
+ outputFormat.iRate = outputSampleRate;
+ outputFormat.iChannels = outputChannels;
+ outputFormat.iEncoding = outputEncoding;
+ }
+
+ return result;
+}
+
+QAudio::State stateNativeToQt(State nativeState,
+ QAudio::State initializingState)
+{
+ switch (nativeState) {
+ case ClosedState:
+ return QAudio::StoppedState;
+ case InitializingState:
+ return initializingState;
+ case ActiveState:
+ return QAudio::ActiveState;
+ case IdleState:
+ return QAudio::IdleState;
+ case SuspendedState:
+ return QAudio::SuspendedState;
+ default:
+ Q_ASSERT_X(false, Q_FUNC_INFO, "Invalid state");
+ return QAudio::StoppedState; // suppress compiler warning
+ }
+}
+
+qint64 bytesToSamples(const QAudioFormat &format, qint64 length)
+{
+ return length / ((format.sampleSize() / 8) * format.channels());
+}
+
+qint64 samplesToBytes(const QAudioFormat &format, qint64 samples)
+{
+ return samples * (format.sampleSize() / 8) * format.channels();
+}
+
+} // namespace Utils
+} // namespace SymbianAudio
+
+QT_END_NAMESPACE
+
+
diff --git a/src/plugins/audio/symbian/symbianaudioutils.h b/src/plugins/audio/symbian/symbianaudioutils.h
new file mode 100644
index 0000000..53274e0
--- /dev/null
+++ b/src/plugins/audio/symbian/symbianaudioutils.h
@@ -0,0 +1,125 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtMultimedia 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 SYMBIANAUDIOUTILS_H
+#define SYMBIANAUDIOUTILS_H
+
+#include <QtCore/qnamespace.h>
+#include <QtMultimedia/qaudioformat.h>
+#include <QtMultimedia/qaudio.h>
+#include <sounddevice.h>
+#include "symbianaudio.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace SymbianAudio {
+
+/*
+ * Helper class for querying DevSound codec / format support
+ */
+class DevSoundCapabilities {
+public:
+ DevSoundCapabilities(CMMFDevSound &devsound, QAudio::Mode mode);
+ ~DevSoundCapabilities();
+
+ const RArray<TFourCC>& fourCC() const { return m_fourCC; }
+ const TMMFCapabilities& caps() const { return m_caps; }
+
+private:
+ void constructL(CMMFDevSound &devsound, QAudio::Mode mode);
+
+private:
+ RArray<TFourCC> m_fourCC;
+ TMMFCapabilities m_caps;
+};
+
+namespace Utils {
+
+/**
+ * Convert native audio capabilities to QAudio lists.
+ */
+void capabilitiesNativeToQt(const DevSoundCapabilities &caps,
+ QList<int> &frequencies,
+ QList<int> &channels,
+ QList<int> &sampleSizes,
+ QList<QAudioFormat::Endian> &byteOrders,
+ QList<QAudioFormat::SampleType> &sampleTypes);
+
+/**
+ * Check whether format is supported.
+ */
+bool isFormatSupported(const QAudioFormat &format,
+ const DevSoundCapabilities &caps);
+
+/**
+ * Convert QAudioFormat to native format types.
+ *
+ * Note that, despite the name, DevSound uses TMMFCapabilities to specify
+ * single formats as well as capabilities.
+ *
+ * Note that this function does not modify outputFormat.iBufferSize.
+ */
+bool formatQtToNative(const QAudioFormat &inputFormat,
+ TUint32 &outputFourCC,
+ TMMFCapabilities &outputFormat);
+
+/**
+ * Convert internal states to QAudio states.
+ */
+QAudio::State stateNativeToQt(State nativeState,
+ QAudio::State initializingState);
+
+/**
+ * Convert data length to number of samples.
+ */
+qint64 bytesToSamples(const QAudioFormat &format, qint64 length);
+
+/**
+ * Convert number of samples to data length.
+ */
+qint64 samplesToBytes(const QAudioFormat &format, qint64 samples);
+
+} // namespace Utils
+} // namespace SymbianAudio
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/qbase.pri b/src/qbase.pri
index db55365..6f2dfa4 100644
--- a/src/qbase.pri
+++ b/src/qbase.pri
@@ -108,6 +108,10 @@ symbian {
}
}
load(armcc_warnings)
+
+ # workaround for the fact that some of our required includes in Symbian^3
+ # now depend upon files in epoc32/include/platform
+ INCLUDEPATH += $$OS_LAYER_SYSTEMINCLUDE
}
win32-borland:INCLUDEPATH += kernel
diff --git a/src/s60installs/qt.iby b/src/s60installs/qt.iby
index a6a96ec..724451b 100644
--- a/src/s60installs/qt.iby
+++ b/src/s60installs/qt.iby
@@ -80,6 +80,9 @@ file=ABI_DIR\BUILD_DIR\qsvgicon.dll SHARED_LIB_DIR\qsvgicon.dll PAG
// Phonon MMF backend
file=ABI_DIR\BUILD_DIR\phonon_mmf.dll SHARED_LIB_DIR\phonon_mmf.dll PAGED
+// QtMultimedia audio backend
+file=ABI_DIR\BUILD_DIR\qaudio.dll SHARED_LIB_DIR\qaudio.dll PAGED
+
// graphicssystems
file=ABI_DIR\BUILD_DIR\qvggraphicssystem.dll SHARED_LIB_DIR\qvggraphicssystem.dll PAGED
@@ -109,6 +112,9 @@ data=\epoc32\data\z\resource\qt\plugins\iconengines\qsvgicon.qtplugin resou
// Phonon MMF backend
data=\epoc32\data\z\resource\qt\plugins\phonon_backend\phonon_mmf.qtplugin resource\qt\plugins\phonon_backend\phonon_mmf.qtplugin
+// QtMultimedia audio backend
+data=\epoc32\data\qt\qtlibspluginstubs\qaudio.qtplugin resource\qt\plugins\audio\qaudio.qtplugin
+
// graphicssystems
data=\epoc32\data\z\resource\qt\plugins\graphicssystems\qvggraphicssystem.qtplugin resource\qt\plugins\graphicssystems\qvggraphicssystem.qtplugin
diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro
index 5318693..1f3b4a6 100644
--- a/src/s60installs/s60installs.pro
+++ b/src/s60installs/s60installs.pro
@@ -78,6 +78,12 @@ symbian: {
DEPLOYMENT += phonon_backend_plugins
}
+ contains(QT_CONFIG, audio-backend) {
+ qaudio_backend_plugins.sources += qaudio.dll
+ qaudio_backend_plugins.path = c:$$QT_PLUGINS_BASE_DIR/audio
+ DEPLOYMENT += qaudio_backend_plugins
+ }
+
# Support backup & restore for Qt libraries
qtbackup.sources = backup_registration.xml
qtbackup.path = c:/private/10202D56/import/packages/$$replace(TARGET.UID3, 0x,)
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index 1bd7377..1199263 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -768,7 +768,7 @@ static QScriptValue __setupPackage__(QScriptContext *ctx, QScriptEngine *eng)
} // namespace QScript
QScriptEnginePrivate::QScriptEnginePrivate()
- : registeredScriptValues(0), freeScriptValues(0),
+ : registeredScriptValues(0), freeScriptValues(0), freeScriptValuesCount(0),
registeredScriptStrings(0), inEval(false)
{
qMetaTypeId<QScriptValue>();
diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h
index 6780b2c..401d6d2 100644
--- a/src/script/api/qscriptengine_p.h
+++ b/src/script/api/qscriptengine_p.h
@@ -255,6 +255,8 @@ public:
int agentLineNumber;
QScriptValuePrivate *registeredScriptValues;
QScriptValuePrivate *freeScriptValues;
+ static const int maxFreeScriptValues = 256;
+ int freeScriptValuesCount;
QScriptStringPrivate *registeredScriptStrings;
QHash<int, QScriptTypeInfo*> m_typeInfos;
int processEventsInterval;
@@ -377,6 +379,7 @@ inline QScriptValuePrivate *QScriptEnginePrivate::allocateScriptValuePrivate(siz
if (freeScriptValues) {
QScriptValuePrivate *p = freeScriptValues;
freeScriptValues = p->next;
+ --freeScriptValuesCount;
return p;
}
return reinterpret_cast<QScriptValuePrivate*>(qMalloc(size));
@@ -384,8 +387,13 @@ inline QScriptValuePrivate *QScriptEnginePrivate::allocateScriptValuePrivate(siz
inline void QScriptEnginePrivate::freeScriptValuePrivate(QScriptValuePrivate *p)
{
- p->next = freeScriptValues;
- freeScriptValues = p;
+ if (freeScriptValuesCount < maxFreeScriptValues) {
+ p->next = freeScriptValues;
+ freeScriptValues = p;
+ ++freeScriptValuesCount;
+ } else {
+ qFree(p);
+ }
}
inline void QScriptEnginePrivate::registerScriptValue(QScriptValuePrivate *value)
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 022b19a..3d25656 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -11,7 +11,6 @@ TEMPLATE = subdirs
maketestselftest \
moc \
uic \
- uic3 \
guiapplauncher \
#atwrapper \ # These tests need significant updating,
#uiloader \ # they have hardcoded machine names etc.
@@ -69,6 +68,9 @@ Q3SUBDIRS += \
q3uridrag \
q3widgetstack
+!cross_compile:Q3SUBDIRS += \
+ uic3
+
SUBDIRS += \
# exceptionsafety_objects \ shouldn't enable it
languagechange \
@@ -445,17 +447,16 @@ SUBDIRS += \
qplugin \
qpluginloader \
qscrollbar \
- qsharedmemory \
qsidebar \
qsizegrip \
qsqldriver \
- qsystemsemaphore \
qtconcurrentfilter \
qtconcurrentiteratekernel \
qtconcurrentmap \
qtconcurrentrun \
qtconcurrentthreadengine \
qthreadpool \
+ qtipc \
qtokenautomaton \
qtouchevent \
qwidget_window \
@@ -519,15 +520,16 @@ SUBDIRS += checkxmlfiles \
xmlpatternsdiagnosticsts \
xmlpatternsschema \
xmlpatternsschemats \
+ xmlpatternssdk \
xmlpatternsvalidator \
xmlpatternsview \
xmlpatternsxqts \
xmlpatternsxslts
-xmlpatternsdiagnosticsts.depends = xmlpatternsxqts
-xmlpatternsview.depends = xmlpatternsxqts
-xmlpatternsxslts.depends = xmlpatternsxqts
-xmlpatternsschemats.depends = xmlpatternsxqts
+xmlpatternsdiagnosticsts.depends = xmlpatternssdk
+xmlpatternsview.depends = xmlpatternssdk
+xmlpatternsxslts.depends = xmlpatternssdk
+xmlpatternsschemats.depends = xmlpatternssdk
}
unix:!embedded:contains(QT_CONFIG, dbus):SUBDIRS += \
diff --git a/tests/auto/compilerwarnings/compilerwarnings.qrc b/tests/auto/compilerwarnings/compilerwarnings.qrc
index 40fa8f1..3fa313c 100644
--- a/tests/auto/compilerwarnings/compilerwarnings.qrc
+++ b/tests/auto/compilerwarnings/compilerwarnings.qrc
@@ -1,5 +1,5 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
- <file>test.cpp</file>
+ <file>test_cpp.txt</file>
</qresource>
</RCC>
diff --git a/tests/auto/compilerwarnings/test.cpp b/tests/auto/compilerwarnings/test_cpp.txt
index 62b35eb..62b35eb 100644
--- a/tests/auto/compilerwarnings/test.cpp
+++ b/tests/auto/compilerwarnings/test_cpp.txt
diff --git a/tests/auto/compilerwarnings/tst_compilerwarnings.cpp b/tests/auto/compilerwarnings/tst_compilerwarnings.cpp
index 27624e9..f910a18 100644
--- a/tests/auto/compilerwarnings/tst_compilerwarnings.cpp
+++ b/tests/auto/compilerwarnings/tst_compilerwarnings.cpp
@@ -148,7 +148,7 @@ void tst_CompilerWarnings::warnings()
if (tmpSourceFile.isEmpty()) {
tmpQSourceFile.open(QIODevice::ReadWrite | QIODevice::Truncate);
tmpSourceFile = tmpQSourceFile.fileName();
- QFile cppSource(":/test.cpp");
+ QFile cppSource(":/test_cpp.txt");
bool openResult = cppSource.open(QIODevice::ReadOnly);
if (openResult)
{
@@ -158,7 +158,7 @@ void tst_CompilerWarnings::warnings()
}
}
tmpQSourceFile.close();
- QVERIFY2(openResult, "Need resource temporary \"test.cpp\"");
+ QVERIFY2(openResult, "Need resource temporary \"test_cpp.txt\"");
QStringList args;
QString compilerName;
diff --git a/tests/auto/maketestselftest/tst_maketestselftest.cpp b/tests/auto/maketestselftest/tst_maketestselftest.cpp
index ef92c56..1dde44b 100644
--- a/tests/auto/maketestselftest/tst_maketestselftest.cpp
+++ b/tests/auto/maketestselftest/tst_maketestselftest.cpp
@@ -92,7 +92,9 @@ void tst_MakeTestSelfTest::auto_dot_pro_data()
QStringList subdirs = dir.entryList(QDir::AllDirs|QDir::NoDotAndDotDot);
foreach (const QString& subdir, subdirs) {
- if (subdir == QString::fromLatin1("tmp")) {
+ if (subdir == QString::fromLatin1("tmp")
+ || subdir.startsWith("."))
+ {
continue;
}
QTest::newRow(qPrintable(subdir)) << subdir;
diff --git a/tests/auto/modeltest/dynamictreemodel.h b/tests/auto/modeltest/dynamictreemodel.h
index 3f0d90d..9633755 100644
--- a/tests/auto/modeltest/dynamictreemodel.h
+++ b/tests/auto/modeltest/dynamictreemodel.h
@@ -48,8 +48,6 @@
#include <QtCore/QList>
-template<typename T> class QList;
-
class DynamicTreeModel : public QAbstractItemModel
{
Q_OBJECT
diff --git a/tests/auto/qhelpcontentmodel/qhelpcontentmodel.pro b/tests/auto/qhelpcontentmodel/qhelpcontentmodel.pro
index 79bb44c..889aac9 100644
--- a/tests/auto/qhelpcontentmodel/qhelpcontentmodel.pro
+++ b/tests/auto/qhelpcontentmodel/qhelpcontentmodel.pro
@@ -1,10 +1,22 @@
-TEMPLATE = subdirs
-CONFIG += ordered
+load(qttest_p4)
+SOURCES += tst_qhelpcontentmodel.cpp
-contains(QT_BUILD_PARTS, tools): {
- SUBDIRS += ../../../tools/assistant/lib/fulltextsearch \
- ../../../tools/assistant/lib
-}
+CONFIG += help
-SUBDIRS += tst_qhelpcontentmodel.pro
+DEFINES += QT_USE_USING_NAMESPACE
+!contains(QT_BUILD_PARTS, tools): DEFINES += QT_NO_BUILD_TOOLS
+wince*: {
+ DEFINES += SRCDIR=\\\"./\\\"
+ QT += network
+ addFiles.sources = $$PWD/data/*.*
+ addFiles.path = data
+ clucene.sources = $$QT_BUILD_TREE/lib/QtCLucene*.dll
+
+ DEPLOYMENT += addFiles
+ DEPLOYMENT += clucene
+
+ DEPLOYMENT_PLUGIN += qsqlite
+} else {
+ DEFINES += SRCDIR=\\\"$$PWD\\\"
+} \ No newline at end of file
diff --git a/tests/auto/qhelpcontentmodel/tst_qhelpcontentmodel.pro b/tests/auto/qhelpcontentmodel/tst_qhelpcontentmodel.pro
deleted file mode 100644
index 889aac9..0000000
--- a/tests/auto/qhelpcontentmodel/tst_qhelpcontentmodel.pro
+++ /dev/null
@@ -1,22 +0,0 @@
-load(qttest_p4)
-SOURCES += tst_qhelpcontentmodel.cpp
-
-CONFIG += help
-
-DEFINES += QT_USE_USING_NAMESPACE
-!contains(QT_BUILD_PARTS, tools): DEFINES += QT_NO_BUILD_TOOLS
-
-wince*: {
- DEFINES += SRCDIR=\\\"./\\\"
- QT += network
- addFiles.sources = $$PWD/data/*.*
- addFiles.path = data
- clucene.sources = $$QT_BUILD_TREE/lib/QtCLucene*.dll
-
- DEPLOYMENT += addFiles
- DEPLOYMENT += clucene
-
- DEPLOYMENT_PLUGIN += qsqlite
-} else {
- DEFINES += SRCDIR=\\\"$$PWD\\\"
-} \ No newline at end of file
diff --git a/tests/auto/qhelpenginecore/qhelpenginecore.pro b/tests/auto/qhelpenginecore/qhelpenginecore.pro
index ee9b0c4..27ebd0f 100644
--- a/tests/auto/qhelpenginecore/qhelpenginecore.pro
+++ b/tests/auto/qhelpenginecore/qhelpenginecore.pro
@@ -1,10 +1,23 @@
-TEMPLATE = subdirs
-CONFIG += ordered
+load(qttest_p4)
+SOURCES += tst_qhelpenginecore.cpp
+CONFIG += help
+QT += sql
-contains(QT_BUILD_PARTS, tools): {
- SUBDIRS += ../../../tools/assistant/lib/fulltextsearch \
- ../../../tools/assistant/lib
-}
-SUBDIRS += tst_qhelpenginecore.pro
+DEFINES += QT_USE_USING_NAMESPACE
+!contains(QT_BUILD_PARTS, tools): DEFINES += QT_NO_BUILD_TOOLS
+
+wince*: {
+ DEFINES += SRCDIR=\\\"./\\\"
+ QT += network
+ addFiles.sources = $$PWD/data/*.*
+ addFiles.path = data
+ clucene.sources = $$QT_BUILD_TREE/lib/QtCLucene*.dll
+ DEPLOYMENT += addFiles
+ DEPLOYMENT += clucene
+
+ DEPLOYMENT_PLUGIN += qsqlite
+} else {
+ DEFINES += SRCDIR=\\\"$$PWD\\\"
+}
diff --git a/tests/auto/qhelpenginecore/tst_qhelpenginecore.pro b/tests/auto/qhelpenginecore/tst_qhelpenginecore.pro
deleted file mode 100644
index 27ebd0f..0000000
--- a/tests/auto/qhelpenginecore/tst_qhelpenginecore.pro
+++ /dev/null
@@ -1,23 +0,0 @@
-load(qttest_p4)
-SOURCES += tst_qhelpenginecore.cpp
-CONFIG += help
-QT += sql
-
-
-DEFINES += QT_USE_USING_NAMESPACE
-!contains(QT_BUILD_PARTS, tools): DEFINES += QT_NO_BUILD_TOOLS
-
-wince*: {
- DEFINES += SRCDIR=\\\"./\\\"
- QT += network
- addFiles.sources = $$PWD/data/*.*
- addFiles.path = data
- clucene.sources = $$QT_BUILD_TREE/lib/QtCLucene*.dll
-
- DEPLOYMENT += addFiles
- DEPLOYMENT += clucene
-
- DEPLOYMENT_PLUGIN += qsqlite
-} else {
- DEFINES += SRCDIR=\\\"$$PWD\\\"
-}
diff --git a/tests/auto/qhelpgenerator/qhelpgenerator.pro b/tests/auto/qhelpgenerator/qhelpgenerator.pro
index efa1ef5..b4b07dd 100644
--- a/tests/auto/qhelpgenerator/qhelpgenerator.pro
+++ b/tests/auto/qhelpgenerator/qhelpgenerator.pro
@@ -1,10 +1,9 @@
-TEMPLATE = subdirs
-CONFIG += ordered
+load(qttest_p4)
-contains(QT_BUILD_PARTS, tools): {
- SUBDIRS += ../../../tools/assistant/lib/fulltextsearch \
- ../../../tools/assistant/lib
-}
-
-SUBDIRS += tst_qhelpgenerator.pro
+SOURCES += tst_qhelpgenerator.cpp
+CONFIG += help
+QT += sql
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+DEFINES += QT_USE_USING_NAMESPACE
+!contains(QT_BUILD_PARTS, tools): DEFINES += QT_NO_BUILD_TOOLS
diff --git a/tests/auto/qhelpgenerator/tst_qhelpgenerator.pro b/tests/auto/qhelpgenerator/tst_qhelpgenerator.pro
deleted file mode 100644
index b4b07dd..0000000
--- a/tests/auto/qhelpgenerator/tst_qhelpgenerator.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-load(qttest_p4)
-
-SOURCES += tst_qhelpgenerator.cpp
-CONFIG += help
-QT += sql
-
-DEFINES += SRCDIR=\\\"$$PWD\\\"
-DEFINES += QT_USE_USING_NAMESPACE
-!contains(QT_BUILD_PARTS, tools): DEFINES += QT_NO_BUILD_TOOLS
diff --git a/tests/auto/qhelpindexmodel/qhelpindexmodel.pro b/tests/auto/qhelpindexmodel/qhelpindexmodel.pro
index 1325e09..927c2e1 100644
--- a/tests/auto/qhelpindexmodel/qhelpindexmodel.pro
+++ b/tests/auto/qhelpindexmodel/qhelpindexmodel.pro
@@ -1,10 +1,9 @@
-TEMPLATE = subdirs
-CONFIG += ordered
+load(qttest_p4)
-contains(QT_BUILD_PARTS, tools): {
- SUBDIRS += ../../../tools/assistant/lib/fulltextsearch \
- ../../../tools/assistant/lib
-}
-
-SUBDIRS += tst_qhelpindexmodel.pro
+SOURCES += tst_qhelpindexmodel.cpp
+CONFIG += help
+QT += sql
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+DEFINES += QT_USE_USING_NAMESPACE
+!contains(QT_BUILD_PARTS, tools): DEFINES += QT_NO_BUILD_TOOLS
diff --git a/tests/auto/qhelpindexmodel/tst_qhelpindexmodel.pro b/tests/auto/qhelpindexmodel/tst_qhelpindexmodel.pro
deleted file mode 100644
index 927c2e1..0000000
--- a/tests/auto/qhelpindexmodel/tst_qhelpindexmodel.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-load(qttest_p4)
-
-SOURCES += tst_qhelpindexmodel.cpp
-CONFIG += help
-QT += sql
-
-DEFINES += SRCDIR=\\\"$$PWD\\\"
-DEFINES += QT_USE_USING_NAMESPACE
-!contains(QT_BUILD_PARTS, tools): DEFINES += QT_NO_BUILD_TOOLS
diff --git a/tests/auto/qhelpprojectdata/qhelpprojectdata.pro b/tests/auto/qhelpprojectdata/qhelpprojectdata.pro
index 9617416..92dc620 100644
--- a/tests/auto/qhelpprojectdata/qhelpprojectdata.pro
+++ b/tests/auto/qhelpprojectdata/qhelpprojectdata.pro
@@ -1,10 +1,9 @@
-TEMPLATE = subdirs
-CONFIG += ordered
+load(qttest_p4)
-contains(QT_BUILD_PARTS, tools): {
- SUBDIRS += ../../../tools/assistant/lib/fulltextsearch \
- ../../../tools/assistant/lib
-}
+SOURCES += tst_qhelpprojectdata.cpp
+CONFIG += help
-SUBDIRS += tst_qhelpprojectdata.pro
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+DEFINES += QT_USE_USING_NAMESPACE
+!contains(QT_BUILD_PARTS, tools): DEFINES += QT_NO_BUILD_TOOLS
diff --git a/tests/auto/qhelpprojectdata/tst_qhelpprojectdata.pro b/tests/auto/qhelpprojectdata/tst_qhelpprojectdata.pro
deleted file mode 100644
index 92dc620..0000000
--- a/tests/auto/qhelpprojectdata/tst_qhelpprojectdata.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-load(qttest_p4)
-
-SOURCES += tst_qhelpprojectdata.cpp
-CONFIG += help
-
-DEFINES += SRCDIR=\\\"$$PWD\\\"
-DEFINES += QT_USE_USING_NAMESPACE
-!contains(QT_BUILD_PARTS, tools): DEFINES += QT_NO_BUILD_TOOLS
-
diff --git a/tests/auto/qlibrary/lib2/lib2.pro b/tests/auto/qlibrary/lib2/lib2.pro
index da30a2d..4654f4d 100644
--- a/tests/auto/qlibrary/lib2/lib2.pro
+++ b/tests/auto/qlibrary/lib2/lib2.pro
@@ -16,14 +16,19 @@ win32-borland: DEFINES += WIN32_BORLAND
!symbian {
win32 {
- src = $(DESTDIR_TARGET)
+ # vcproj and Makefile generators refer to target differently
+ contains(TEMPLATE,vc.*) {
+ src = $(TargetPath)
+ } else {
+ src = $(DESTDIR_TARGET)
+ }
files = mylib.dl2 system.trolltech.test.mylib.dll
} else {
src = $(DESTDIR)$(TARGET)
files = libmylib.so2 system.trolltech.test.mylib.so
}
for(file, files) {
- QMAKE_POST_LINK += $(COPY) $$src ..$$QMAKE_DIR_SEP$$file &&
+ QMAKE_POST_LINK += $$QMAKE_COPY $$src ..$$QMAKE_DIR_SEP$$file &&
CLEAN_FILES += ../$$file
}
QMAKE_POST_LINK = $$member(QMAKE_POST_LINK, 0, -2)
diff --git a/tests/auto/qlocalsocket/lackey/main.cpp b/tests/auto/qlocalsocket/lackey/main.cpp
index 0f1930c..1bba4f8 100644
--- a/tests/auto/qlocalsocket/lackey/main.cpp
+++ b/tests/auto/qlocalsocket/lackey/main.cpp
@@ -172,8 +172,10 @@ static int _q_ScriptRegisterQObjectMetaType(QScriptEngine *engine, const QScript
return qScriptRegisterMetaType<T*>(engine, _q_ScriptValueFromQObject<T>, _q_ScriptValueToQObject<T>, prototype);
}
+QT_BEGIN_NAMESPACE
Q_SCRIPT_DECLARE_QMETAOBJECT(QScriptLocalSocket, QObject*);
Q_SCRIPT_DECLARE_QMETAOBJECT(QScriptLocalServer, QObject*);
+QT_END_NAMESPACE
static void interactive(QScriptEngine &eng)
{
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index 5fecc86..78b4d98 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -257,6 +257,13 @@ private Q_SLOTS:
void httpConnectionCount();
+ void httpReUsingConnectionSequential_data();
+ void httpReUsingConnectionSequential();
+ void httpReUsingConnectionFromFinishedSlot_data();
+ void httpReUsingConnectionFromFinishedSlot();
+
+ void httpRecursiveCreation();
+
#ifndef QT_NO_OPENSSL
void ioPostToHttpsUploadProgress();
void ignoreSslErrorsList_data();
@@ -312,18 +319,20 @@ QT_END_NAMESPACE
QFAIL(qPrintable(errorMsg)); \
} while (0);
+
+// Does not work for POST/PUT!
class MiniHttpServer: public QTcpServer
{
Q_OBJECT
- QTcpSocket *client;
-
public:
+ QTcpSocket *client; // always the last one that was received
QByteArray dataToTransmit;
QByteArray receivedData;
bool doClose;
+ bool multiple;
int totalConnections;
- MiniHttpServer(const QByteArray &data) : client(0), dataToTransmit(data), doClose(true), totalConnections(0)
+ MiniHttpServer(const QByteArray &data) : client(0), dataToTransmit(data), doClose(true), multiple(false), totalConnections(0)
{
listen();
connect(this, SIGNAL(newConnection()), this, SLOT(doAccept()));
@@ -333,15 +342,21 @@ public slots:
void doAccept()
{
client = nextPendingConnection();
+ client->setParent(this);
++totalConnections;
- connect(client, SIGNAL(readyRead()), this, SLOT(sendData()));
+ connect(client, SIGNAL(readyRead()), this, SLOT(readyReadSlot()));
}
- void sendData()
+ void readyReadSlot()
{
receivedData += client->readAll();
- if (receivedData.contains("\r\n\r\n") ||
- receivedData.contains("\n\n")) {
+ int doubleEndlPos = receivedData.indexOf("\r\n\r\n");
+
+ if (doubleEndlPos != -1) {
+ // multiple requests incoming. remove the bytes of the current one
+ if (multiple)
+ receivedData.remove(0, doubleEndlPos+4);
+
client->write(dataToTransmit);
if (doClose) {
client->disconnectFromHost();
@@ -3788,6 +3803,174 @@ void tst_QNetworkReply::httpConnectionCount()
#endif
}
+void tst_QNetworkReply::httpReUsingConnectionSequential_data()
+{
+ QTest::addColumn<bool>("doDeleteLater");
+ QTest::newRow("deleteLater") << true;
+ QTest::newRow("noDeleteLater") << false;
+}
+
+void tst_QNetworkReply::httpReUsingConnectionSequential()
+{
+ QFETCH(bool, doDeleteLater);
+
+ QByteArray response("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n");
+ MiniHttpServer server(response);
+ server.multiple = true;
+ server.doClose = false;
+
+ QUrl url;
+ url.setScheme("http");
+ url.setPort(server.serverPort());
+ url.setHost("127.0.0.1");
+ // first request
+ QNetworkReply* reply1 = manager.get(QNetworkRequest(url));
+ connect(reply1, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+ QTestEventLoop::instance().enterLoop(2);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+ QVERIFY(!reply1->error());
+ int reply1port = server.client->peerPort();
+
+ if (doDeleteLater)
+ reply1->deleteLater();
+
+ // finished received, send the next one
+ QNetworkReply*reply2 = manager.get(QNetworkRequest(url));
+ connect(reply2, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+ QTestEventLoop::instance().enterLoop(2);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+ QVERIFY(!reply2->error());
+ int reply2port = server.client->peerPort(); // should still be the same object
+
+ QVERIFY(reply1port > 0);
+ QCOMPARE(server.totalConnections, 1);
+ QCOMPARE(reply2port, reply1port);
+
+ if (!doDeleteLater)
+ reply1->deleteLater(); // only do it if it was not done earlier
+ reply2->deleteLater();
+}
+
+class HttpReUsingConnectionFromFinishedSlot : public QObject {
+ Q_OBJECT;
+public:
+ QNetworkReply* reply1;
+ QNetworkReply* reply2;
+ QUrl url;
+ QNetworkAccessManager manager;
+public slots:
+ void finishedSlot() {
+ QVERIFY(!reply1->error());
+
+ QFETCH(bool, doDeleteLater);
+ if (doDeleteLater) {
+ reply1->deleteLater();
+ reply1 = 0;
+ }
+
+ // kick off 2nd request and exit the loop when it is done
+ reply2 = manager.get(QNetworkRequest(url));
+ reply2->setParent(this);
+ connect(reply2, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+ }
+};
+
+void tst_QNetworkReply::httpReUsingConnectionFromFinishedSlot_data()
+{
+ httpReUsingConnectionSequential_data();
+}
+
+void tst_QNetworkReply::httpReUsingConnectionFromFinishedSlot()
+{
+ QByteArray response("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n");
+ MiniHttpServer server(response);
+ server.multiple = true;
+ server.doClose = false;
+
+ HttpReUsingConnectionFromFinishedSlot helper;
+ helper.reply1 = 0;
+ helper.reply2 = 0;
+ helper.url.setScheme("http");
+ helper.url.setPort(server.serverPort());
+ helper.url.setHost("127.0.0.1");
+
+ // first request
+ helper.reply1 = helper.manager.get(QNetworkRequest(helper.url));
+ helper.reply1->setParent(&helper);
+ connect(helper.reply1, SIGNAL(finished()), &helper, SLOT(finishedSlot()));
+ QTestEventLoop::instance().enterLoop(4);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+
+ QVERIFY(helper.reply2);
+ QVERIFY(!helper.reply2->error());
+
+ QCOMPARE(server.totalConnections, 1);
+}
+
+class HttpRecursiveCreationHelper : public QObject {
+ Q_OBJECT
+public:
+
+ HttpRecursiveCreationHelper():
+ QObject(0),
+ requestsStartedCount_finished(0),
+ requestsStartedCount_readyRead(0),
+ requestsFinishedCount(0)
+ {
+ }
+ QNetworkAccessManager manager;
+ int requestsStartedCount_finished;
+ int requestsStartedCount_readyRead;
+ int requestsFinishedCount;
+public slots:
+ void finishedSlot() {
+ requestsFinishedCount++;
+
+ QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
+ QVERIFY(!reply->error());
+ QVERIFY(reply->bytesAvailable() == 27906);
+
+ if (requestsFinishedCount == 60) {
+ QTestEventLoop::instance().exitLoop();
+ return;
+ }
+
+ if (requestsStartedCount_finished < 30) {
+ startOne();
+ requestsStartedCount_finished++;
+ }
+
+ reply->deleteLater();
+ }
+ void readyReadSlot() {
+ QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
+ QVERIFY(!reply->error());
+
+ if (requestsStartedCount_readyRead < 30 && reply->bytesAvailable() > 27906/2) {
+ startOne();
+ requestsStartedCount_readyRead++;
+ }
+ }
+ void startOne() {
+ QUrl url = "http://" + QtNetworkSettings::serverName() + "/gif/fluke.gif";
+ QNetworkRequest request(url);
+ QNetworkReply *reply = manager.get(request);
+ reply->setParent(this);
+ connect(reply, SIGNAL(finished()), this, SLOT(finishedSlot()));
+ connect(reply, SIGNAL(readyRead()), this, SLOT(readyReadSlot()));
+ }
+};
+
+void tst_QNetworkReply::httpRecursiveCreation()
+{
+ // this test checks if creation of new requests to the same host properly works
+ // from readyRead() and finished() signals
+ HttpRecursiveCreationHelper helper;
+ helper.startOne();
+ QTestEventLoop::instance().enterLoop(30);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+}
+
#ifndef QT_NO_OPENSSL
void tst_QNetworkReply::ignoreSslErrorsList_data()
{
diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp
index 104728d..beb83a1 100644
--- a/tests/auto/qpainter/tst_qpainter.cpp
+++ b/tests/auto/qpainter/tst_qpainter.cpp
@@ -1580,10 +1580,8 @@ void tst_QPainter::drawClippedEllipse_data()
void tst_QPainter::drawClippedEllipse()
{
QFETCH(QRect, rect);
-#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
if (sizeof(qreal) != sizeof(double))
QSKIP("Test only works for qreal==double", SkipAll);
-#endif
QImage image(rect.width() + 1, rect.height() + 1,
QImage::Format_ARGB32_Premultiplied);
QRect expected = QRect(rect.x(), rect.y(), rect.width()+1, rect.height()+1)
diff --git a/tests/auto/qpixmapcache/tst_qpixmapcache.cpp b/tests/auto/qpixmapcache/tst_qpixmapcache.cpp
index a0f4339..f8951f5 100644
--- a/tests/auto/qpixmapcache/tst_qpixmapcache.cpp
+++ b/tests/auto/qpixmapcache/tst_qpixmapcache.cpp
@@ -483,7 +483,9 @@ void tst_QPixmapCache::pixmapKey()
QVERIFY(!getPrivate(key8));
}
+QT_BEGIN_NAMESPACE
extern int q_QPixmapCache_keyHashSize();
+QT_END_NAMESPACE
void tst_QPixmapCache::noLeak()
{
diff --git a/tests/auto/qpluginloader/theplugin/plugininterface.h b/tests/auto/qpluginloader/theplugin/plugininterface.h
index 0b093db..9b69429 100644
--- a/tests/auto/qpluginloader/theplugin/plugininterface.h
+++ b/tests/auto/qpluginloader/theplugin/plugininterface.h
@@ -45,7 +45,10 @@ struct PluginInterface {
virtual ~PluginInterface() {}
virtual QString pluginName() const = 0;
};
+
+QT_BEGIN_NAMESPACE
Q_DECLARE_INTERFACE(PluginInterface, "com.trolltect.autotests.plugininterface/1.0")
+QT_END_NAMESPACE
#endif // PLUGININTERFACE_H
diff --git a/tests/auto/qsharedmemory/qsharedmemory.pro b/tests/auto/qsharedmemory/qsharedmemory.pro
deleted file mode 100644
index 0aad554..0000000
--- a/tests/auto/qsharedmemory/qsharedmemory.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS = lackey test qsystemlock
-
-
diff --git a/tests/auto/qsystemsemaphore/files.qrc b/tests/auto/qsystemsemaphore/files.qrc
deleted file mode 100644
index 7b344ba..0000000
--- a/tests/auto/qsystemsemaphore/files.qrc
+++ /dev/null
@@ -1,7 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
- <file alias="systemsemaphore_acquire.js">../qsharedmemory/lackey/scripts/systemsemaphore_acquire.js</file>
- <file alias="systemsemaphore_release.js">../qsharedmemory/lackey/scripts/systemsemaphore_release.js</file>
- <file alias="systemsemaphore_acquirerelease.js">../qsharedmemory/lackey/scripts/systemsemaphore_acquirerelease.js</file>
-</qresource>
-</RCC>
diff --git a/tests/auto/qsystemsemaphore/qsystemsemaphore.pro b/tests/auto/qsystemsemaphore/qsystemsemaphore.pro
deleted file mode 100644
index a3f4a34..0000000
--- a/tests/auto/qsystemsemaphore/qsystemsemaphore.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS = ../qsharedmemory/lackey test
-
-
diff --git a/tests/auto/qtextstream/tst_qtextstream.cpp b/tests/auto/qtextstream/tst_qtextstream.cpp
index 8ff6bee..9146be2 100644
--- a/tests/auto/qtextstream/tst_qtextstream.cpp
+++ b/tests/auto/qtextstream/tst_qtextstream.cpp
@@ -4308,10 +4308,15 @@ void tst_QTextStream::int_write_with_locale()
// ------------------------------------------------------------------------------
// like QTEST_APPLESS_MAIN, but initialising the locale on Unix
+#if defined (Q_OS_UNIX) && !defined (Q_OS_SYMBIAN)
+QT_BEGIN_NAMESPACE
+extern bool qt_locale_initialized;
+QT_END_NAMESPACE
+#endif
+
int main(int argc, char *argv[])
{
#if defined (Q_OS_UNIX) && !defined (Q_OS_SYMBIAN)
- extern bool qt_locale_initialized;
::setlocale(LC_ALL, "");
qt_locale_initialized = true;
#endif
diff --git a/tests/auto/qsharedmemory/lackey/lackey.pro b/tests/auto/qtipc/lackey/lackey.pro
index d25a50a..3912312 100644
--- a/tests/auto/qsharedmemory/lackey/lackey.pro
+++ b/tests/auto/qtipc/lackey/lackey.pro
@@ -1,4 +1,4 @@
-include(../src/src.pri)
+include(../qsharedmemory/src/src.pri)
QT = core script
diff --git a/tests/auto/qsharedmemory/lackey/main.cpp b/tests/auto/qtipc/lackey/main.cpp
index 5a5bf5e..fef8d22 100644
--- a/tests/auto/qsharedmemory/lackey/main.cpp
+++ b/tests/auto/qtipc/lackey/main.cpp
@@ -242,9 +242,11 @@ private:
QSharedMemory sm;
};
+QT_BEGIN_NAMESPACE
Q_SCRIPT_DECLARE_QMETAOBJECT(ScriptSharedMemory, QObject*);
Q_SCRIPT_DECLARE_QMETAOBJECT(ScriptSystemLock, QObject*);
Q_SCRIPT_DECLARE_QMETAOBJECT(ScriptSystemSemaphore, QObject*);
+QT_END_NAMESPACE
static void interactive(QScriptEngine &eng)
{
diff --git a/tests/auto/qsharedmemory/lackey/scripts/consumer.js b/tests/auto/qtipc/lackey/scripts/consumer.js
index 4d12dca..4d12dca 100644
--- a/tests/auto/qsharedmemory/lackey/scripts/consumer.js
+++ b/tests/auto/qtipc/lackey/scripts/consumer.js
diff --git a/tests/auto/qsharedmemory/lackey/scripts/producer.js b/tests/auto/qtipc/lackey/scripts/producer.js
index e02cd8b..e02cd8b 100644
--- a/tests/auto/qsharedmemory/lackey/scripts/producer.js
+++ b/tests/auto/qtipc/lackey/scripts/producer.js
diff --git a/tests/auto/qsharedmemory/lackey/scripts/readonly_segfault.js b/tests/auto/qtipc/lackey/scripts/readonly_segfault.js
index 3eaf789..3eaf789 100644
--- a/tests/auto/qsharedmemory/lackey/scripts/readonly_segfault.js
+++ b/tests/auto/qtipc/lackey/scripts/readonly_segfault.js
diff --git a/tests/auto/qsharedmemory/lackey/scripts/systemlock_read.js b/tests/auto/qtipc/lackey/scripts/systemlock_read.js
index 1048bc7..1048bc7 100644
--- a/tests/auto/qsharedmemory/lackey/scripts/systemlock_read.js
+++ b/tests/auto/qtipc/lackey/scripts/systemlock_read.js
diff --git a/tests/auto/qsharedmemory/lackey/scripts/systemlock_readwrite.js b/tests/auto/qtipc/lackey/scripts/systemlock_readwrite.js
index fc6367f..fc6367f 100644
--- a/tests/auto/qsharedmemory/lackey/scripts/systemlock_readwrite.js
+++ b/tests/auto/qtipc/lackey/scripts/systemlock_readwrite.js
diff --git a/tests/auto/qsharedmemory/lackey/scripts/systemsemaphore_acquire.js b/tests/auto/qtipc/lackey/scripts/systemsemaphore_acquire.js
index 5cff429..5cff429 100644
--- a/tests/auto/qsharedmemory/lackey/scripts/systemsemaphore_acquire.js
+++ b/tests/auto/qtipc/lackey/scripts/systemsemaphore_acquire.js
diff --git a/tests/auto/qsharedmemory/lackey/scripts/systemsemaphore_acquirerelease.js b/tests/auto/qtipc/lackey/scripts/systemsemaphore_acquirerelease.js
index cedde3f..cedde3f 100644
--- a/tests/auto/qsharedmemory/lackey/scripts/systemsemaphore_acquirerelease.js
+++ b/tests/auto/qtipc/lackey/scripts/systemsemaphore_acquirerelease.js
diff --git a/tests/auto/qsharedmemory/lackey/scripts/systemsemaphore_release.js b/tests/auto/qtipc/lackey/scripts/systemsemaphore_release.js
index c805e0f..c805e0f 100644
--- a/tests/auto/qsharedmemory/lackey/scripts/systemsemaphore_release.js
+++ b/tests/auto/qtipc/lackey/scripts/systemsemaphore_release.js
diff --git a/tests/auto/qsharedmemory/.gitignore b/tests/auto/qtipc/qsharedmemory/.gitignore
index 03ddcf2..03ddcf2 100644
--- a/tests/auto/qsharedmemory/.gitignore
+++ b/tests/auto/qtipc/qsharedmemory/.gitignore
diff --git a/tests/auto/qtipc/qsharedmemory/qsharedmemory.pro b/tests/auto/qtipc/qsharedmemory/qsharedmemory.pro
new file mode 100644
index 0000000..9fef8e4
--- /dev/null
+++ b/tests/auto/qtipc/qsharedmemory/qsharedmemory.pro
@@ -0,0 +1,4 @@
+TEMPLATE = subdirs
+SUBDIRS = test qsystemlock
+
+
diff --git a/tests/auto/qsharedmemory/qsystemlock/qsystemlock.pro b/tests/auto/qtipc/qsharedmemory/qsystemlock/qsystemlock.pro
index e232443..e232443 100644
--- a/tests/auto/qsharedmemory/qsystemlock/qsystemlock.pro
+++ b/tests/auto/qtipc/qsharedmemory/qsystemlock/qsystemlock.pro
diff --git a/tests/auto/qsharedmemory/qsystemlock/tst_qsystemlock.cpp b/tests/auto/qtipc/qsharedmemory/qsystemlock/tst_qsystemlock.cpp
index ea906b7..ea906b7 100644
--- a/tests/auto/qsharedmemory/qsystemlock/tst_qsystemlock.cpp
+++ b/tests/auto/qtipc/qsharedmemory/qsystemlock/tst_qsystemlock.cpp
diff --git a/tests/auto/qsharedmemory/src/qsystemlock.cpp b/tests/auto/qtipc/qsharedmemory/src/qsystemlock.cpp
index 4ead748..4ead748 100644
--- a/tests/auto/qsharedmemory/src/qsystemlock.cpp
+++ b/tests/auto/qtipc/qsharedmemory/src/qsystemlock.cpp
diff --git a/tests/auto/qsharedmemory/src/qsystemlock.h b/tests/auto/qtipc/qsharedmemory/src/qsystemlock.h
index 7cd6b89..7cd6b89 100644
--- a/tests/auto/qsharedmemory/src/qsystemlock.h
+++ b/tests/auto/qtipc/qsharedmemory/src/qsystemlock.h
diff --git a/tests/auto/qsharedmemory/src/qsystemlock_p.h b/tests/auto/qtipc/qsharedmemory/src/qsystemlock_p.h
index 7995a91..7995a91 100644
--- a/tests/auto/qsharedmemory/src/qsystemlock_p.h
+++ b/tests/auto/qtipc/qsharedmemory/src/qsystemlock_p.h
diff --git a/tests/auto/qsharedmemory/src/qsystemlock_unix.cpp b/tests/auto/qtipc/qsharedmemory/src/qsystemlock_unix.cpp
index 525aa78..525aa78 100644
--- a/tests/auto/qsharedmemory/src/qsystemlock_unix.cpp
+++ b/tests/auto/qtipc/qsharedmemory/src/qsystemlock_unix.cpp
diff --git a/tests/auto/qsharedmemory/src/qsystemlock_win.cpp b/tests/auto/qtipc/qsharedmemory/src/qsystemlock_win.cpp
index ac97100..ac97100 100644
--- a/tests/auto/qsharedmemory/src/qsystemlock_win.cpp
+++ b/tests/auto/qtipc/qsharedmemory/src/qsystemlock_win.cpp
diff --git a/tests/auto/qsharedmemory/src/src.pri b/tests/auto/qtipc/qsharedmemory/src/src.pri
index 5bc9de6..5bc9de6 100644
--- a/tests/auto/qsharedmemory/src/src.pri
+++ b/tests/auto/qtipc/qsharedmemory/src/src.pri
diff --git a/tests/auto/qsharedmemory/test/test.pro b/tests/auto/qtipc/qsharedmemory/test/test.pro
index c9f4fec..40ba8b9 100644
--- a/tests/auto/qsharedmemory/test/test.pro
+++ b/tests/auto/qtipc/qsharedmemory/test/test.pro
@@ -20,14 +20,14 @@ TARGET = ../tst_qsharedmemory
wince*:{
requires(contains(QT_CONFIG,script))
QT += gui script
-addFiles.sources = ../lackey/lackey.exe ../lackey/scripts
+addFiles.sources = ../../lackey/lackey.exe ../../lackey/scripts
addFiles.path = lackey
DEPLOYMENT += addFiles
DEFINES += SRCDIR=\\\"\\\"
}else:symbian*{
requires(contains(QT_CONFIG,script))
QT += gui script
-addFiles.sources = ../lackey/scripts
+addFiles.sources = ../../lackey/scripts
addFiles.path = /data/qsharedmemorytemp/lackey
addBin.sources = lackey.exe
addBin.path = /sys/bin
diff --git a/tests/auto/qsharedmemory/tst_qsharedmemory.cpp b/tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp
index cea75bf..83f65b0 100644
--- a/tests/auto/qsharedmemory/tst_qsharedmemory.cpp
+++ b/tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp
@@ -51,7 +51,13 @@
#ifdef Q_OS_SYMBIAN
#define SRCDIR "c:/data/qsharedmemorytemp/"
+#define LACKEYDIR SRCDIR "lackey"
+#elif Q_OS_WINCE
+#define LACKEYDIR SRCDIR "lackey"
+#else
+#define LACKEYDIR SRCDIR "../lackey"
#endif
+
Q_DECLARE_METATYPE(QSharedMemory::SharedMemoryError)
Q_DECLARE_METATYPE(QSharedMemory::AccessMode)
@@ -411,10 +417,10 @@ void tst_QSharedMemory::readOnly()
#if defined (Q_OS_SYMBIAN)
QSKIP("Readonly shared memory is not supported in symbian", SkipAll);
#endif
- QString program = "./lackey/lackey";
+ QString program = LACKEYDIR "/lackey";
QStringList arguments;
rememberKey("readonly_segfault");
- arguments << SRCDIR "lackey/scripts/readonly_segfault.js";
+ arguments << LACKEYDIR "/scripts/readonly_segfault.js";
// ### on windows disable the popup somehow
QProcess p;
@@ -727,28 +733,20 @@ void tst_QSharedMemory::simpleProcessProducerConsumer()
rememberKey("market");
-#ifndef Q_OS_WINCE
- QStringList arguments = QStringList() << SRCDIR "lackey/scripts/producer.js";
-#else
- QStringList arguments = QStringList() << QFileInfo(SRCDIR "lackey/scripts/producer.js").absoluteFilePath();
-#endif
+ QStringList arguments = QStringList() << LACKEYDIR "/scripts/producer.js";
QProcess producer;
producer.setProcessChannelMode(QProcess::ForwardedChannels);
- producer.start( "./lackey/lackey", arguments);
+ producer.start( LACKEYDIR "/lackey", arguments);
producer.waitForStarted();
QVERIFY(producer.error() != QProcess::FailedToStart);
QList<QProcess*> consumers;
unsigned int failedProcesses = 0;
for (int i = 0; i < processes; ++i) {
-#ifndef Q_OS_WINCE
- QStringList arguments = QStringList() << SRCDIR "lackey/scripts/consumer.js";
-#else
- QStringList arguments = QStringList() << QFileInfo(SRCDIR "lackey/scripts/consumer.js").absoluteFilePath();
-#endif
+ QStringList arguments = QStringList() << LACKEYDIR "/scripts/consumer.js";
QProcess *p = new QProcess;
p->setProcessChannelMode(QProcess::ForwardedChannels);
- p->start("./lackey/lackey", arguments);
+ p->start(LACKEYDIR "/lackey", arguments);
if (p->waitForStarted(2000))
consumers.append(p);
diff --git a/tests/auto/qsystemsemaphore/.gitignore b/tests/auto/qtipc/qsystemsemaphore/.gitignore
index 2b60bfb..2b60bfb 100644
--- a/tests/auto/qsystemsemaphore/.gitignore
+++ b/tests/auto/qtipc/qsystemsemaphore/.gitignore
diff --git a/tests/auto/qtipc/qsystemsemaphore/files.qrc b/tests/auto/qtipc/qsystemsemaphore/files.qrc
new file mode 100644
index 0000000..6296690
--- /dev/null
+++ b/tests/auto/qtipc/qsystemsemaphore/files.qrc
@@ -0,0 +1,7 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file alias="systemsemaphore_acquire.js">../lackey/scripts/systemsemaphore_acquire.js</file>
+ <file alias="systemsemaphore_release.js">../lackey/scripts/systemsemaphore_release.js</file>
+ <file alias="systemsemaphore_acquirerelease.js">../lackey/scripts/systemsemaphore_acquirerelease.js</file>
+</qresource>
+</RCC>
diff --git a/tests/auto/qsystemsemaphore/test/test.pro b/tests/auto/qtipc/qsystemsemaphore/qsystemsemaphore.pro
index ed7898c..1f9205e 100644
--- a/tests/auto/qsystemsemaphore/test/test.pro
+++ b/tests/auto/qtipc/qsystemsemaphore/qsystemsemaphore.pro
@@ -1,29 +1,24 @@
CONFIG += qttest_p4
#QT = core
-include(../../qsharedmemory/src/src.pri)
+include(../qsharedmemory/src/src.pri)
win32: CONFIG += console
DEFINES += QSHAREDMEMORY_DEBUG
DEFINES += QSYSTEMSEMAPHORE_DEBUG
-SOURCES += ../tst_qsystemsemaphore.cpp
+SOURCES += tst_qsystemsemaphore.cpp
TARGET = tst_qsystemsemaphore
-DESTDIR = ../
-win32 {
- CONFIG(debug, debug|release): DESTDIR = ../debug
- else: DESTDIR = ../release
-}
-RESOURCES += ../files.qrc
+RESOURCES += files.qrc
wince*: {
requires(contains(QT_CONFIG,script))
# this test calls lackey, which then again depends on QtScript.
# let's add it here so that it gets deployed easily
QT += script
-lackey.sources = ../../qsharedmemory/lackey/lackey.exe
-lackey.path = ../qsharedmemory/lackey
+lackey.sources = ../lackey/lackey.exe
+lackey.path = ../lackey
DEPLOYMENT += lackey
}
@@ -34,7 +29,8 @@ requires(contains(QT_CONFIG,script))
# let's add it here so that it gets deployed easily
QT += script
-lackey.sources = ../../qsharedmemory/lackey/lackey.exe
+lackey.sources = ../lackey/lackey.exe
lackey.path = /sys/bin
DEPLOYMENT += lackey
}
+
diff --git a/tests/auto/qsystemsemaphore/tst_qsystemsemaphore.cpp b/tests/auto/qtipc/qsystemsemaphore/tst_qsystemsemaphore.cpp
index bf4efdc..eb82fd4 100644
--- a/tests/auto/qsystemsemaphore/tst_qsystemsemaphore.cpp
+++ b/tests/auto/qtipc/qsystemsemaphore/tst_qsystemsemaphore.cpp
@@ -46,7 +46,7 @@
//TESTED_FILES=
#define EXISTING_SHARE "existing"
-#define LACKYLOC "../qsharedmemory/lackey"
+#define LACKYLOC "../lackey"
#define LACKYWAITTIME 10000
class tst_QSystemSemaphore : public QObject
diff --git a/tests/auto/qtipc/qtipc.pro b/tests/auto/qtipc/qtipc.pro
new file mode 100644
index 0000000..60037d2
--- /dev/null
+++ b/tests/auto/qtipc/qtipc.pro
@@ -0,0 +1,6 @@
+TEMPLATE=subdirs
+SUBDIRS=\
+ lackey \
+ qsharedmemory \
+ qsystemsemaphore \
+
diff --git a/tests/auto/qvariant/tst_qvariant.cpp b/tests/auto/qvariant/tst_qvariant.cpp
index 21b2fe3..a316dda 100644
--- a/tests/auto/qvariant/tst_qvariant.cpp
+++ b/tests/auto/qvariant/tst_qvariant.cpp
@@ -3200,7 +3200,10 @@ struct MyPrimitive
return x == o.x && y == o.y;
}
};
+
+QT_BEGIN_NAMESPACE
Q_DECLARE_TYPEINFO(MyPrimitive, Q_PRIMITIVE_TYPE);
+QT_END_NAMESPACE
struct MyData
{
@@ -3239,7 +3242,9 @@ struct MyMovable
int MyMovable::count = 0;
+QT_BEGIN_NAMESPACE
Q_DECLARE_TYPEINFO(MyMovable, Q_MOVABLE_TYPE);
+QT_END_NAMESPACE
Q_DECLARE_METATYPE(QList<QSize>)
Q_DECLARE_METATYPE(MyPrimitive)
diff --git a/tests/auto/symbols/tst_symbols.cpp b/tests/auto/symbols/tst_symbols.cpp
index e30481a..d6fb65a 100644
--- a/tests/auto/symbols/tst_symbols.cpp
+++ b/tests/auto/symbols/tst_symbols.cpp
@@ -212,6 +212,10 @@ void tst_Symbols::prefix()
<< "winfnt_driver_class"
<< "pshinter_module_class"
<< "psnames_module_class"
+ // C symbols from Qt
+ << "qt_addObject"
+ << "qt_removeObject"
+ << "qt_startup_hook"
;
QHash<QString,QStringList> excusedPrefixes;
@@ -279,6 +283,10 @@ void tst_Symbols::prefix()
<< "cti" // ctiTrampoline and ctiVMThrowTrampoline from the JIT
#ifdef QT_NAMESPACE
<< "QWeb" // Webkit is only 'namespace aware'
+ << "qWeb"
+ << "qt"
+ << "QGraphicsWebView"
+ << "operator"
#endif
;
@@ -331,6 +339,8 @@ void tst_Symbols::prefix()
symbol = symbol.mid(symbol.indexOf(' ') + 1);
}
+ if (symbol.mid(symbol.indexOf(' ')+1).startsWith("std::"))
+ continue;
if (symbol.startsWith("_") || symbol.startsWith("std::"))
continue;
if (symbol.startsWith("vtable ") || symbol.startsWith("VTT for ") ||
@@ -342,6 +352,8 @@ void tst_Symbols::prefix()
continue;
if (symbol.startsWith(ns + "operator"))
continue;
+ if (symbol.startsWith("operator new") || symbol.startsWith("operator delete"))
+ continue;
if (symbol.startsWith("guard variable for "))
continue;
if (symbol.contains("(" + ns + "QTextStream"))
diff --git a/tests/auto/xmlpatternsdiagnosticsts/test/test.pro b/tests/auto/xmlpatternsdiagnosticsts/test/test.pro
deleted file mode 100644
index acd71e4..0000000
--- a/tests/auto/xmlpatternsdiagnosticsts/test/test.pro
+++ /dev/null
@@ -1,32 +0,0 @@
-load(qttest_p4)
-SOURCES += tst_xmlpatternsdiagnosticsts.cpp \
- ../../qxmlquery/TestFundament.cpp
-
-include (../../xmlpatterns.pri)
-
-TARGET = tst_xmlpatternsdiagnosticsts
-DESTDIR = ..
-win32 {
- CONFIG(debug, debug|release): DESTDIR = ../debug
- else: DESTDIR = ../release
-}
-
-contains(QT_CONFIG, xmlpatterns) {
-HEADERS += ../../xmlpatternsxqts/test/tst_suitetest.h
-SOURCES += ../../xmlpatternsxqts/test/tst_suitetest.cpp
-LIBS += -l$$XMLPATTERNS_SDK
-}
-
-QT += xml
-
-INCLUDEPATH += $$(QTSRCDIR)/tests/auto/xmlpatternsxqts/lib/ \
- $$(QTDIR)/include/QtXmlPatterns/private \
- $$(QTSRCDIR)/tests/auto/xmlpatternsxqts/test \
- ../../xmlpatternsxqts/test \
- ../../xmlpatternsxqts/lib
-
-wince*|symbian {
- catalog.sources = ../TestSuite ../Baseline.xml
- catalog.path = .
- DEPLOYMENT += catalog
-}
diff --git a/tests/auto/xmlpatternsdiagnosticsts/test/tst_xmlpatternsdiagnosticsts.cpp b/tests/auto/xmlpatternsdiagnosticsts/tst_xmlpatternsdiagnosticsts.cpp
index 4a11404..4a11404 100644
--- a/tests/auto/xmlpatternsdiagnosticsts/test/tst_xmlpatternsdiagnosticsts.cpp
+++ b/tests/auto/xmlpatternsdiagnosticsts/tst_xmlpatternsdiagnosticsts.cpp
diff --git a/tests/auto/xmlpatternsdiagnosticsts/xmlpatternsdiagnosticsts.pro b/tests/auto/xmlpatternsdiagnosticsts/xmlpatternsdiagnosticsts.pro
index 3d82eaf..981adab 100644
--- a/tests/auto/xmlpatternsdiagnosticsts/xmlpatternsdiagnosticsts.pro
+++ b/tests/auto/xmlpatternsdiagnosticsts/xmlpatternsdiagnosticsts.pro
@@ -1,5 +1,27 @@
-TEMPLATE = subdirs
-CONFIG += ordered
+load(qttest_p4)
+SOURCES += tst_xmlpatternsdiagnosticsts.cpp \
+ ../qxmlquery/TestFundament.cpp
-SUBDIRS = ../xmlpatternsxqts test
-requires(contains(QT_CONFIG,private_tests))
+include (../xmlpatterns.pri)
+
+TARGET = tst_xmlpatternsdiagnosticsts
+
+contains(QT_CONFIG, xmlpatterns) {
+HEADERS += ../xmlpatternsxqts/tst_suitetest.h
+SOURCES += ../xmlpatternsxqts/tst_suitetest.cpp
+LIBS += -l$$XMLPATTERNS_SDK
+}
+
+QT += xml
+
+INCLUDEPATH += $$(QTSRCDIR)/tests/auto/xmlpatternssdk \
+ $$(QTDIR)/include/QtXmlPatterns/private \
+ $$(QTSRCDIR)/tests/auto/xmlpatternsxqts \
+ ../xmlpatternsxqts \
+ ../xmlpatternssdk
+
+wince*|symbian {
+ catalog.sources = TestSuite Baseline.xml
+ catalog.path = .
+ DEPLOYMENT += catalog
+}
diff --git a/tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro b/tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro
index 0f55078..f36211e 100644
--- a/tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro
+++ b/tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro
@@ -5,8 +5,8 @@ SOURCES += tst_xmlpatternsschemats.cpp \
include (../xmlpatterns.pri)
contains(QT_CONFIG,xmlpatterns) {
-HEADERS += ../xmlpatternsxqts/test/tst_suitetest.h
-SOURCES += ../xmlpatternsxqts/test/tst_suitetest.cpp
+HEADERS += ../xmlpatternsxqts/tst_suitetest.h
+SOURCES += ../xmlpatternsxqts/tst_suitetest.cpp
}
PATTERNIST_SDK = QtXmlPatternsSDK
@@ -20,8 +20,8 @@ LIBS += -l$$PATTERNIST_SDK
QT += xml
-INCLUDEPATH += $$QT_SOURCE_TREE/tests/auto/xmlpatternsxqts/lib/ \
- $$QT_BUILD_TREE/include/QtXmlPatterns/private \
- $$QT_SOURCE_TREE/tests/auto/xmlpatternsxqts/test \
- ../xmlpatternsxqts/test \
- ../xmlpatternsxqts/lib
+INCLUDEPATH += $$QT_SOURCE_TREE/tests/auto/xmlpatternssdk/ \
+ $$QT_BUILD_TREE/include/QtXmlPatterns/private \
+ $$QT_SOURCE_TREE/tests/auto/xmlpatternsxqts \
+ ../xmlpatternsxqts \
+ ../xmlpatternssdk
diff --git a/tests/auto/xmlpatternsxqts/lib/ASTItem.cpp b/tests/auto/xmlpatternssdk/ASTItem.cpp
index 3b4fbdc..3b4fbdc 100644
--- a/tests/auto/xmlpatternsxqts/lib/ASTItem.cpp
+++ b/tests/auto/xmlpatternssdk/ASTItem.cpp
diff --git a/tests/auto/xmlpatternsxqts/lib/ASTItem.h b/tests/auto/xmlpatternssdk/ASTItem.h
index ca3ac8f..ca3ac8f 100644
--- a/tests/auto/xmlpatternsxqts/lib/ASTItem.h
+++ b/tests/auto/xmlpatternssdk/ASTItem.h
diff --git a/tests/auto/xmlpatternsxqts/lib/DebugExpressionFactory.cpp b/tests/auto/xmlpatternssdk/DebugExpressionFactory.cpp
index 1b5121e..1b5121e 100644
--- a/tests/auto/xmlpatternsxqts/lib/DebugExpressionFactory.cpp
+++ b/tests/auto/xmlpatternssdk/DebugExpressionFactory.cpp
diff --git a/tests/auto/xmlpatternsxqts/lib/DebugExpressionFactory.h b/tests/auto/xmlpatternssdk/DebugExpressionFactory.h
index d5e676d..d5e676d 100644
--- a/tests/auto/xmlpatternsxqts/lib/DebugExpressionFactory.h
+++ b/tests/auto/xmlpatternssdk/DebugExpressionFactory.h
diff --git a/tests/auto/xmlpatternsxqts/lib/ErrorHandler.cpp b/tests/auto/xmlpatternssdk/ErrorHandler.cpp
index 3f07737..3f07737 100644
--- a/tests/auto/xmlpatternsxqts/lib/ErrorHandler.cpp
+++ b/tests/auto/xmlpatternssdk/ErrorHandler.cpp
diff --git a/tests/auto/xmlpatternsxqts/lib/ErrorHandler.h b/tests/auto/xmlpatternssdk/ErrorHandler.h
index 25447a9..25447a9 100644
--- a/tests/auto/xmlpatternsxqts/lib/ErrorHandler.h
+++ b/tests/auto/xmlpatternssdk/ErrorHandler.h
diff --git a/tests/auto/xmlpatternsxqts/lib/ErrorItem.cpp b/tests/auto/xmlpatternssdk/ErrorItem.cpp
index 57edc1f..57edc1f 100644
--- a/tests/auto/xmlpatternsxqts/lib/ErrorItem.cpp
+++ b/tests/auto/xmlpatternssdk/ErrorItem.cpp
diff --git a/tests/auto/xmlpatternsxqts/lib/ErrorItem.h b/tests/auto/xmlpatternssdk/ErrorItem.h
index 1d05872..1d05872 100644
--- a/tests/auto/xmlpatternsxqts/lib/ErrorItem.h
+++ b/tests/auto/xmlpatternssdk/ErrorItem.h
diff --git a/tests/auto/xmlpatternsxqts/lib/ExitCode.h b/tests/auto/xmlpatternssdk/ExitCode.h
index e1810b1..e1810b1 100644
--- a/tests/auto/xmlpatternsxqts/lib/ExitCode.h
+++ b/tests/auto/xmlpatternssdk/ExitCode.h
diff --git a/tests/auto/xmlpatternsxqts/lib/ExpressionInfo.cpp b/tests/auto/xmlpatternssdk/ExpressionInfo.cpp
index abbc8b3..abbc8b3 100644
--- a/tests/auto/xmlpatternsxqts/lib/ExpressionInfo.cpp
+++ b/tests/auto/xmlpatternssdk/ExpressionInfo.cpp
diff --git a/tests/auto/xmlpatternsxqts/lib/ExpressionInfo.h b/tests/auto/xmlpatternssdk/ExpressionInfo.h
index 2d9d398..2d9d398 100644
--- a/tests/auto/xmlpatternsxqts/lib/ExpressionInfo.h
+++ b/tests/auto/xmlpatternssdk/ExpressionInfo.h
diff --git a/tests/auto/xmlpatternsxqts/lib/ExpressionNamer.cpp b/tests/auto/xmlpatternssdk/ExpressionNamer.cpp
index 605c754..605c754 100644
--- a/tests/auto/xmlpatternsxqts/lib/ExpressionNamer.cpp
+++ b/tests/auto/xmlpatternssdk/ExpressionNamer.cpp
diff --git a/tests/auto/xmlpatternsxqts/lib/ExpressionNamer.h b/tests/auto/xmlpatternssdk/ExpressionNamer.h
index 129d8d7..129d8d7 100644
--- a/tests/auto/xmlpatternsxqts/lib/ExpressionNamer.h
+++ b/tests/auto/xmlpatternssdk/ExpressionNamer.h
diff --git a/tests/auto/xmlpatternsxqts/lib/ExternalSourceLoader.cpp b/tests/auto/xmlpatternssdk/ExternalSourceLoader.cpp
index a83a100..a83a100 100644
--- a/tests/auto/xmlpatternsxqts/lib/ExternalSourceLoader.cpp
+++ b/tests/auto/xmlpatternssdk/ExternalSourceLoader.cpp
diff --git a/tests/auto/xmlpatternsxqts/lib/ExternalSourceLoader.h b/tests/auto/xmlpatternssdk/ExternalSourceLoader.h
index 2d88222..2d88222 100644
--- a/tests/auto/xmlpatternsxqts/lib/ExternalSourceLoader.h
+++ b/tests/auto/xmlpatternssdk/ExternalSourceLoader.h
diff --git a/tests/auto/xmlpatternsxqts/lib/Global.cpp b/tests/auto/xmlpatternssdk/Global.cpp
index f78e421..f78e421 100644
--- a/tests/auto/xmlpatternsxqts/lib/Global.cpp
+++ b/tests/auto/xmlpatternssdk/Global.cpp
diff --git a/tests/auto/xmlpatternsxqts/lib/Global.h b/tests/auto/xmlpatternssdk/Global.h
index 53c32cb..53c32cb 100644
--- a/tests/auto/xmlpatternsxqts/lib/Global.h
+++ b/tests/auto/xmlpatternssdk/Global.h
diff --git a/tests/auto/xmlpatternsxqts/lib/ResultThreader.cpp b/tests/auto/xmlpatternssdk/ResultThreader.cpp
index 3296854..3296854 100644
--- a/tests/auto/xmlpatternsxqts/lib/ResultThreader.cpp
+++ b/tests/auto/xmlpatternssdk/ResultThreader.cpp
diff --git a/tests/auto/xmlpatternsxqts/lib/ResultThreader.h b/tests/auto/xmlpatternssdk/ResultThreader.h
index 19749f0..19749f0 100644
--- a/tests/auto/xmlpatternsxqts/lib/ResultThreader.h
+++ b/tests/auto/xmlpatternssdk/ResultThreader.h
diff --git a/tests/auto/xmlpatternsxqts/lib/TestBaseLine.cpp b/tests/auto/xmlpatternssdk/TestBaseLine.cpp
index 6a46bcc..6a46bcc 100644
--- a/tests/auto/xmlpatternsxqts/lib/TestBaseLine.cpp
+++ b/tests/auto/xmlpatternssdk/TestBaseLine.cpp
diff --git a/tests/auto/xmlpatternsxqts/lib/TestBaseLine.h b/tests/auto/xmlpatternssdk/TestBaseLine.h
index e297128..e297128 100644
--- a/tests/auto/xmlpatternsxqts/lib/TestBaseLine.h
+++ b/tests/auto/xmlpatternssdk/TestBaseLine.h
diff --git a/tests/auto/xmlpatternsxqts/lib/TestCase.cpp b/tests/auto/xmlpatternssdk/TestCase.cpp
index 7b424d2..7b424d2 100644
--- a/tests/auto/xmlpatternsxqts/lib/TestCase.cpp
+++ b/tests/auto/xmlpatternssdk/TestCase.cpp
diff --git a/tests/auto/xmlpatternsxqts/lib/TestCase.h b/tests/auto/xmlpatternssdk/TestCase.h
index 28df5f1..28df5f1 100644
--- a/tests/auto/xmlpatternsxqts/lib/TestCase.h
+++ b/tests/auto/xmlpatternssdk/TestCase.h
diff --git a/tests/auto/xmlpatternsxqts/lib/TestContainer.cpp b/tests/auto/xmlpatternssdk/TestContainer.cpp
index ec6196c..ec6196c 100644
--- a/tests/auto/xmlpatternsxqts/lib/TestContainer.cpp
+++ b/tests/auto/xmlpatternssdk/TestContainer.cpp
diff --git a/tests/auto/xmlpatternsxqts/lib/TestContainer.h b/tests/auto/xmlpatternssdk/TestContainer.h
index 5b93491..5b93491 100644
--- a/tests/auto/xmlpatternsxqts/lib/TestContainer.h
+++ b/tests/auto/xmlpatternssdk/TestContainer.h
diff --git a/tests/auto/xmlpatternsxqts/lib/TestGroup.cpp b/tests/auto/xmlpatternssdk/TestGroup.cpp
index f2cd2bd..f2cd2bd 100644
--- a/tests/auto/xmlpatternsxqts/lib/TestGroup.cpp
+++ b/tests/auto/xmlpatternssdk/TestGroup.cpp
diff --git a/tests/auto/xmlpatternsxqts/lib/TestGroup.h b/tests/auto/xmlpatternssdk/TestGroup.h
index 5f4798f..5f4798f 100644
--- a/tests/auto/xmlpatternsxqts/lib/TestGroup.h
+++ b/tests/auto/xmlpatternssdk/TestGroup.h
diff --git a/tests/auto/xmlpatternsxqts/lib/TestItem.h b/tests/auto/xmlpatternssdk/TestItem.h
index 0b3c606..0b3c606 100644
--- a/tests/auto/xmlpatternsxqts/lib/TestItem.h
+++ b/tests/auto/xmlpatternssdk/TestItem.h
diff --git a/tests/auto/xmlpatternsxqts/lib/TestResult.cpp b/tests/auto/xmlpatternssdk/TestResult.cpp
index 2374bc0..2374bc0 100644
--- a/tests/auto/xmlpatternsxqts/lib/TestResult.cpp
+++ b/tests/auto/xmlpatternssdk/TestResult.cpp
diff --git a/tests/auto/xmlpatternsxqts/lib/TestResult.h b/tests/auto/xmlpatternssdk/TestResult.h
index 6951f90..6951f90 100644
--- a/tests/auto/xmlpatternsxqts/lib/TestResult.h
+++ b/tests/auto/xmlpatternssdk/TestResult.h
diff --git a/tests/auto/xmlpatternsxqts/lib/TestResultHandler.cpp b/tests/auto/xmlpatternssdk/TestResultHandler.cpp
index b87d481..b87d481 100644
--- a/tests/auto/xmlpatternsxqts/lib/TestResultHandler.cpp
+++ b/tests/auto/xmlpatternssdk/TestResultHandler.cpp
diff --git a/tests/auto/xmlpatternsxqts/lib/TestResultHandler.h b/tests/auto/xmlpatternssdk/TestResultHandler.h
index a786ac4..a786ac4 100644
--- a/tests/auto/xmlpatternsxqts/lib/TestResultHandler.h
+++ b/tests/auto/xmlpatternssdk/TestResultHandler.h
diff --git a/tests/auto/xmlpatternsxqts/lib/TestSuite.cpp b/tests/auto/xmlpatternssdk/TestSuite.cpp
index 2c3e49c..2c3e49c 100644
--- a/tests/auto/xmlpatternsxqts/lib/TestSuite.cpp
+++ b/tests/auto/xmlpatternssdk/TestSuite.cpp
diff --git a/tests/auto/xmlpatternsxqts/lib/TestSuite.h b/tests/auto/xmlpatternssdk/TestSuite.h
index d14dc62..d14dc62 100644
--- a/tests/auto/xmlpatternsxqts/lib/TestSuite.h
+++ b/tests/auto/xmlpatternssdk/TestSuite.h
diff --git a/tests/auto/xmlpatternsxqts/lib/TestSuiteHandler.cpp b/tests/auto/xmlpatternssdk/TestSuiteHandler.cpp
index 7c687f3..7c687f3 100644
--- a/tests/auto/xmlpatternsxqts/lib/TestSuiteHandler.cpp
+++ b/tests/auto/xmlpatternssdk/TestSuiteHandler.cpp
diff --git a/tests/auto/xmlpatternsxqts/lib/TestSuiteHandler.h b/tests/auto/xmlpatternssdk/TestSuiteHandler.h
index 76156c0..76156c0 100644
--- a/tests/auto/xmlpatternsxqts/lib/TestSuiteHandler.h
+++ b/tests/auto/xmlpatternssdk/TestSuiteHandler.h
diff --git a/tests/auto/xmlpatternsxqts/lib/TestSuiteResult.cpp b/tests/auto/xmlpatternssdk/TestSuiteResult.cpp
index 4e81859..4e81859 100644
--- a/tests/auto/xmlpatternsxqts/lib/TestSuiteResult.cpp
+++ b/tests/auto/xmlpatternssdk/TestSuiteResult.cpp
diff --git a/tests/auto/xmlpatternsxqts/lib/TestSuiteResult.h b/tests/auto/xmlpatternssdk/TestSuiteResult.h
index 491c2b2..491c2b2 100644
--- a/tests/auto/xmlpatternsxqts/lib/TestSuiteResult.h
+++ b/tests/auto/xmlpatternssdk/TestSuiteResult.h
diff --git a/tests/auto/xmlpatternsxqts/lib/TreeItem.cpp b/tests/auto/xmlpatternssdk/TreeItem.cpp
index b34262d..b34262d 100644
--- a/tests/auto/xmlpatternsxqts/lib/TreeItem.cpp
+++ b/tests/auto/xmlpatternssdk/TreeItem.cpp
diff --git a/tests/auto/xmlpatternsxqts/lib/TreeItem.h b/tests/auto/xmlpatternssdk/TreeItem.h
index f5e051f..f5e051f 100644
--- a/tests/auto/xmlpatternsxqts/lib/TreeItem.h
+++ b/tests/auto/xmlpatternssdk/TreeItem.h
diff --git a/tests/auto/xmlpatternsxqts/lib/TreeModel.cpp b/tests/auto/xmlpatternssdk/TreeModel.cpp
index e27f8e0..e27f8e0 100644
--- a/tests/auto/xmlpatternsxqts/lib/TreeModel.cpp
+++ b/tests/auto/xmlpatternssdk/TreeModel.cpp
diff --git a/tests/auto/xmlpatternsxqts/lib/TreeModel.h b/tests/auto/xmlpatternssdk/TreeModel.h
index 1d8ea72..1d8ea72 100644
--- a/tests/auto/xmlpatternsxqts/lib/TreeModel.h
+++ b/tests/auto/xmlpatternssdk/TreeModel.h
diff --git a/tests/auto/xmlpatternsxqts/lib/Worker.cpp b/tests/auto/xmlpatternssdk/Worker.cpp
index 0121099..0121099 100644
--- a/tests/auto/xmlpatternsxqts/lib/Worker.cpp
+++ b/tests/auto/xmlpatternssdk/Worker.cpp
diff --git a/tests/auto/xmlpatternsxqts/lib/Worker.h b/tests/auto/xmlpatternssdk/Worker.h
index b3d7ae2..b3d7ae2 100644
--- a/tests/auto/xmlpatternsxqts/lib/Worker.h
+++ b/tests/auto/xmlpatternssdk/Worker.h
diff --git a/tests/auto/xmlpatternsxqts/lib/XMLWriter.cpp b/tests/auto/xmlpatternssdk/XMLWriter.cpp
index 60a5344..60a5344 100644
--- a/tests/auto/xmlpatternsxqts/lib/XMLWriter.cpp
+++ b/tests/auto/xmlpatternssdk/XMLWriter.cpp
diff --git a/tests/auto/xmlpatternsxqts/lib/XMLWriter.h b/tests/auto/xmlpatternssdk/XMLWriter.h
index 2b629bb..2b629bb 100644
--- a/tests/auto/xmlpatternsxqts/lib/XMLWriter.h
+++ b/tests/auto/xmlpatternssdk/XMLWriter.h
diff --git a/tests/auto/xmlpatternsxqts/lib/XQTSTestCase.cpp b/tests/auto/xmlpatternssdk/XQTSTestCase.cpp
index 6a8645b..6a8645b 100644
--- a/tests/auto/xmlpatternsxqts/lib/XQTSTestCase.cpp
+++ b/tests/auto/xmlpatternssdk/XQTSTestCase.cpp
diff --git a/tests/auto/xmlpatternsxqts/lib/XQTSTestCase.h b/tests/auto/xmlpatternssdk/XQTSTestCase.h
index 8872b32..8872b32 100644
--- a/tests/auto/xmlpatternsxqts/lib/XQTSTestCase.h
+++ b/tests/auto/xmlpatternssdk/XQTSTestCase.h
diff --git a/tests/auto/xmlpatternsxqts/lib/XSDTSTestCase.cpp b/tests/auto/xmlpatternssdk/XSDTSTestCase.cpp
index 3cbb681..3cbb681 100644
--- a/tests/auto/xmlpatternsxqts/lib/XSDTSTestCase.cpp
+++ b/tests/auto/xmlpatternssdk/XSDTSTestCase.cpp
diff --git a/tests/auto/xmlpatternsxqts/lib/XSDTSTestCase.h b/tests/auto/xmlpatternssdk/XSDTSTestCase.h
index 8cfa143..947687a 100644
--- a/tests/auto/xmlpatternsxqts/lib/XSDTSTestCase.h
+++ b/tests/auto/xmlpatternssdk/XSDTSTestCase.h
@@ -50,6 +50,7 @@
#include "TestCase.h"
QT_BEGIN_HEADER
+QT_BEGIN_NAMESPACE
namespace QPatternistSDK
{
@@ -153,6 +154,7 @@ namespace QPatternistSDK
};
}
+QT_END_NAMESPACE
QT_END_HEADER
#endif
diff --git a/tests/auto/xmlpatternsxqts/lib/XSDTestSuiteHandler.cpp b/tests/auto/xmlpatternssdk/XSDTestSuiteHandler.cpp
index a868d19..a868d19 100644
--- a/tests/auto/xmlpatternsxqts/lib/XSDTestSuiteHandler.cpp
+++ b/tests/auto/xmlpatternssdk/XSDTestSuiteHandler.cpp
diff --git a/tests/auto/xmlpatternsxqts/lib/XSDTestSuiteHandler.h b/tests/auto/xmlpatternssdk/XSDTestSuiteHandler.h
index 9179a2d..5493c7d 100644
--- a/tests/auto/xmlpatternsxqts/lib/XSDTestSuiteHandler.h
+++ b/tests/auto/xmlpatternssdk/XSDTestSuiteHandler.h
@@ -50,6 +50,7 @@
#include "XQTSTestCase.h"
QT_BEGIN_HEADER
+QT_BEGIN_NAMESPACE
namespace QPatternistSDK
{
@@ -113,6 +114,7 @@ namespace QPatternistSDK
};
}
+QT_END_NAMESPACE
QT_END_HEADER
#endif
diff --git a/tests/auto/xmlpatternsxqts/lib/XSLTTestSuiteHandler.cpp b/tests/auto/xmlpatternssdk/XSLTTestSuiteHandler.cpp
index cfc3b2b..cfc3b2b 100644
--- a/tests/auto/xmlpatternsxqts/lib/XSLTTestSuiteHandler.cpp
+++ b/tests/auto/xmlpatternssdk/XSLTTestSuiteHandler.cpp
diff --git a/tests/auto/xmlpatternsxqts/lib/XSLTTestSuiteHandler.h b/tests/auto/xmlpatternssdk/XSLTTestSuiteHandler.h
index 8614789..8614789 100644
--- a/tests/auto/xmlpatternsxqts/lib/XSLTTestSuiteHandler.h
+++ b/tests/auto/xmlpatternssdk/XSLTTestSuiteHandler.h
diff --git a/tests/auto/xmlpatternsxqts/lib/docs/XMLIndenterExample.cpp b/tests/auto/xmlpatternssdk/docs/XMLIndenterExample.cpp
index 24ee158..24ee158 100644
--- a/tests/auto/xmlpatternsxqts/lib/docs/XMLIndenterExample.cpp
+++ b/tests/auto/xmlpatternssdk/docs/XMLIndenterExample.cpp
diff --git a/tests/auto/xmlpatternsxqts/lib/docs/XMLIndenterExampleResult.xml b/tests/auto/xmlpatternssdk/docs/XMLIndenterExampleResult.xml
index c5e7312..c5e7312 100644
--- a/tests/auto/xmlpatternsxqts/lib/docs/XMLIndenterExampleResult.xml
+++ b/tests/auto/xmlpatternssdk/docs/XMLIndenterExampleResult.xml
diff --git a/tests/auto/xmlpatternsxqts/lib/docs/XMLWriterExample.cpp b/tests/auto/xmlpatternssdk/docs/XMLWriterExample.cpp
index 24ee158..24ee158 100644
--- a/tests/auto/xmlpatternsxqts/lib/docs/XMLWriterExample.cpp
+++ b/tests/auto/xmlpatternssdk/docs/XMLWriterExample.cpp
diff --git a/tests/auto/xmlpatternsxqts/lib/docs/XMLWriterExampleResult.xml b/tests/auto/xmlpatternssdk/docs/XMLWriterExampleResult.xml
index c5e7312..c5e7312 100644
--- a/tests/auto/xmlpatternsxqts/lib/docs/XMLWriterExampleResult.xml
+++ b/tests/auto/xmlpatternssdk/docs/XMLWriterExampleResult.xml
diff --git a/tests/auto/xmlpatternsxqts/lib/tests/XMLWriterTest.cpp b/tests/auto/xmlpatternssdk/tests/XMLWriterTest.cpp
index a10c01a..a10c01a 100644
--- a/tests/auto/xmlpatternsxqts/lib/tests/XMLWriterTest.cpp
+++ b/tests/auto/xmlpatternssdk/tests/XMLWriterTest.cpp
diff --git a/tests/auto/xmlpatternsxqts/lib/tests/XMLWriterTest.h b/tests/auto/xmlpatternssdk/tests/XMLWriterTest.h
index f90aea2..f90aea2 100644
--- a/tests/auto/xmlpatternsxqts/lib/tests/XMLWriterTest.h
+++ b/tests/auto/xmlpatternssdk/tests/XMLWriterTest.h
diff --git a/tests/auto/xmlpatternsxqts/lib/lib.pro b/tests/auto/xmlpatternssdk/xmlpatternssdk.pro
index f5b0a06..6204f01 100644
--- a/tests/auto/xmlpatternsxqts/lib/lib.pro
+++ b/tests/auto/xmlpatternssdk/xmlpatternssdk.pro
@@ -1,4 +1,4 @@
-include (../../xmlpatterns.pri)
+include (../xmlpatterns.pri)
TARGET = $$XMLPATTERNS_SDK
TEMPLATE = lib
diff --git a/tests/auto/xmlpatternsview/test/test.pro b/tests/auto/xmlpatternsview/test/test.pro
deleted file mode 100644
index 6adff4d..0000000
--- a/tests/auto/xmlpatternsview/test/test.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-load(qttest_p4)
-SOURCES += tst_xmlpatternsview.cpp
-
-include (../../xmlpatterns.pri)
-
-DESTDIR = ..
-win32 {
- CONFIG(debug, debug|release): DESTDIR = ../debug
- else: DESTDIR = ../release
-}
-TARGET = tst_xmlpatternsview
-
-wince*: {
- viewexe.sources = $$QT_BUILD_TREE/xmlpatternsview.exe
- viewexe.path = .
- DEPLOYMENT += viewexe
-}
diff --git a/tests/auto/xmlpatternsview/test/tst_xmlpatternsview.cpp b/tests/auto/xmlpatternsview/tst_xmlpatternsview.cpp
index 91dee63..91dee63 100644
--- a/tests/auto/xmlpatternsview/test/tst_xmlpatternsview.cpp
+++ b/tests/auto/xmlpatternsview/tst_xmlpatternsview.cpp
diff --git a/tests/auto/xmlpatternsview/xmlpatternsview.pro b/tests/auto/xmlpatternsview/xmlpatternsview.pro
index 04ee4d0..d93cba3 100644
--- a/tests/auto/xmlpatternsview/xmlpatternsview.pro
+++ b/tests/auto/xmlpatternsview/xmlpatternsview.pro
@@ -1,9 +1,12 @@
-TEMPLATE = subdirs
-CONFIG += ordered
+load(qttest_p4)
+SOURCES += tst_xmlpatternsview.cpp
-SUBDIRS = ../xmlpatternsxqts test
+include (../xmlpatterns.pri)
-contains(QT_CONFIG,xmlpatterns) {
- SUBDIRS += view
+TARGET = tst_xmlpatternsview
+
+wince*: {
+ viewexe.sources = $$QT_BUILD_TREE/xmlpatternsview.exe
+ viewexe.path = .
+ DEPLOYMENT += viewexe
}
-requires(contains(QT_CONFIG,private_tests))
diff --git a/tests/auto/xmlpatternsxqts/test/test.pro b/tests/auto/xmlpatternsxqts/test/test.pro
deleted file mode 100644
index a69838a..0000000
--- a/tests/auto/xmlpatternsxqts/test/test.pro
+++ /dev/null
@@ -1,26 +0,0 @@
-load(qttest_p4)
-SOURCES += tst_xmlpatternsxqts.cpp ../../qxmlquery/TestFundament.cpp tst_suitetest.cpp
-
-include(../../xmlpatterns.pri)
-
-contains(QT_CONFIG,xmlpatterns) {
- HEADERS += tst_suitetest.h
- LIBS += -l$$XMLPATTERNS_SDK
-}
-
-# syncqt doesn't copy headers in tools/ so let's manually ensure
-# it works with shadow builds and source builds.
-INCLUDEPATH += $$(QTDIR)/include/QtXmlPatterns/private \
- $$(QTSRCDIR)/include/QtXmlPatterns/private \
- $$(QTSRCDIR)/tools/xmlpatterns \
- $$(QTDIR)/tools/xmlpatterns \
- ../lib/
-
-CONFIG += testlib
-QT += xml
-DESTDIR = ..
-win32 {
- CONFIG(debug, debug|release): DESTDIR = ../debug
- else: DESTDIR = ../release
-}
-TARGET = tst_xmlpatternsxqts
diff --git a/tests/auto/xmlpatternsxqts/test/tst_suitetest.cpp b/tests/auto/xmlpatternsxqts/tst_suitetest.cpp
index 64120c7..64120c7 100644
--- a/tests/auto/xmlpatternsxqts/test/tst_suitetest.cpp
+++ b/tests/auto/xmlpatternsxqts/tst_suitetest.cpp
diff --git a/tests/auto/xmlpatternsxqts/test/tst_suitetest.h b/tests/auto/xmlpatternsxqts/tst_suitetest.h
index 22e384a..70e56af 100644
--- a/tests/auto/xmlpatternsxqts/test/tst_suitetest.h
+++ b/tests/auto/xmlpatternsxqts/tst_suitetest.h
@@ -44,7 +44,7 @@
#define Q_tst_SuiteTest
#include <QtCore/QObject>
-#include "../../qxmlquery/TestFundament.h"
+#include "../qxmlquery/TestFundament.h"
/*!
\class tst_SuiteTest
diff --git a/tests/auto/xmlpatternsxqts/test/tst_xmlpatternsxqts.cpp b/tests/auto/xmlpatternsxqts/tst_xmlpatternsxqts.cpp
index 890234e..890234e 100644
--- a/tests/auto/xmlpatternsxqts/test/tst_xmlpatternsxqts.cpp
+++ b/tests/auto/xmlpatternsxqts/tst_xmlpatternsxqts.cpp
diff --git a/tests/auto/xmlpatternsxqts/xmlpatternsxqts.pro b/tests/auto/xmlpatternsxqts/xmlpatternsxqts.pro
index 3f49ccc..e81888a 100644
--- a/tests/auto/xmlpatternsxqts/xmlpatternsxqts.pro
+++ b/tests/auto/xmlpatternsxqts/xmlpatternsxqts.pro
@@ -1,13 +1,21 @@
-TEMPLATE = subdirs
+load(qttest_p4)
+SOURCES += tst_xmlpatternsxqts.cpp ../qxmlquery/TestFundament.cpp tst_suitetest.cpp
+
+include(../xmlpatterns.pri)
+
contains(QT_CONFIG,xmlpatterns) {
- SUBDIRS += lib
- test.depends = lib
+ HEADERS += tst_suitetest.h
+ LIBS += -l$$XMLPATTERNS_SDK
}
-SUBDIRS += test
-
-# Needed on the win32-g++ setup and on the test machine arsia.
-INCLUDEPATH += $$QT_BUILD_TREE/include/QtXmlPatterns/private \
- ../../../include/QtXmlPatterns/private
-requires(contains(QT_CONFIG,private_tests))
+# syncqt doesn't copy headers in tools/ so let's manually ensure
+# it works with shadow builds and source builds.
+INCLUDEPATH += $$(QTDIR)/include/QtXmlPatterns/private \
+ $$(QTSRCDIR)/include/QtXmlPatterns/private \
+ $$(QTSRCDIR)/tools/xmlpatterns \
+ $$(QTDIR)/tools/xmlpatterns \
+ ../xmlpatternssdk/
+CONFIG += testlib
+QT += xml
+TARGET = tst_xmlpatternsxqts
diff --git a/tests/auto/xmlpatternsxslts/xmlpatternsxslts.pro b/tests/auto/xmlpatternsxslts/xmlpatternsxslts.pro
index 9b63a52..940cc31 100644
--- a/tests/auto/xmlpatternsxslts/xmlpatternsxslts.pro
+++ b/tests/auto/xmlpatternsxslts/xmlpatternsxslts.pro
@@ -5,17 +5,17 @@ SOURCES += tst_xmlpatternsxslts.cpp \
include (../xmlpatterns.pri)
contains(QT_CONFIG,xmlpatterns) {
-HEADERS += ../xmlpatternsxqts/test/tst_suitetest.h
-SOURCES += ../xmlpatternsxqts/test/tst_suitetest.cpp
+HEADERS += ../xmlpatternsxqts/tst_suitetest.h
+SOURCES += ../xmlpatternsxqts/tst_suitetest.cpp
LIBS += -l$$XMLPATTERNS_SDK
}
QT += xml
-INCLUDEPATH += $$(QTSRCDIR)/tests/auto/xmlpatternsxqts/lib/ \
- $$(QTDIR)/include/QtXmlPatterns/private \
- $$(QTSRCDIR)/tests/auto/xmlpatternsxqts/test \
- ../xmlpatternsxqts/test \
- ../xmlpatternsxqts/lib
+INCLUDEPATH += $$(QTSRCDIR)/tests/auto/xmlpatternssdk \
+ $$(QTDIR)/include/QtXmlPatterns/private \
+ $$(QTSRCDIR)/tests/auto/xmlpatternsxqts \
+ ../xmlpatternsxqts \
+ ../xmlpatternssdk
wince*: {
testdata.sources = XSLTS Baseline.xml
diff --git a/tests/benchmarks/corelib/io/qdir/10000/10000.pro b/tests/benchmarks/corelib/io/qdir/10000/10000.pro
new file mode 100644
index 0000000..93b0992
--- /dev/null
+++ b/tests/benchmarks/corelib/io/qdir/10000/10000.pro
@@ -0,0 +1,10 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = bench_qdir_10000
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+SOURCES += bench_qdir_10000.cpp
+
+QT -= gui
diff --git a/tests/benchmarks/corelib/io/qdir/tst_qdir.cpp b/tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp
index aea9fd0..1238804 100644
--- a/tests/benchmarks/corelib/io/qdir/tst_qdir.cpp
+++ b/tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp
@@ -50,7 +50,7 @@
# include <unistd.h>
#endif
-class Test : public QObject{
+class bench_QDir_10000 : public QObject{
Q_OBJECT
public slots:
void initTestCase() {
@@ -95,9 +95,9 @@ private slots:
QBENCHMARK {
QDirIterator dit(testdir.path(), QDir::Files);
while (dit.hasNext()) {
+ dit.next();
dit.fileInfo().isDir();
dit.fileInfo().size();
- dit.next();
}
}
}
@@ -116,9 +116,9 @@ private slots:
QBENCHMARK {
QDirIterator dit(testdir.path());
while (dit.hasNext()) {
+ dit.next();
dit.fileInfo().isDir();
dit.fileInfo().size();
- dit.next();
}
}
}
@@ -156,6 +156,7 @@ private slots:
}
void sizeSpeedWithoutFilterLowLevel() {
+ QDir testdir(QDir::tempPath() + QLatin1String("/test_speed"));
#ifdef Q_OS_WIN
const wchar_t *dirpath = (wchar_t*)testdir.absolutePath().utf16();
wchar_t appendedPath[MAX_PATH];
@@ -173,7 +174,6 @@ private slots:
}
FindClose(hSearch);
#else
- QDir testdir(QDir::tempPath() + QLatin1String("/test_speed"));
DIR *dir = opendir(qPrintable(testdir.absolutePath()));
QVERIFY(dir);
@@ -194,5 +194,5 @@ private slots:
}
};
-QTEST_MAIN(Test)
-#include "tst_qdir.moc"
+QTEST_MAIN(bench_QDir_10000)
+#include "bench_qdir_10000.moc"
diff --git a/tests/benchmarks/corelib/io/qdir/qdir.pro b/tests/benchmarks/corelib/io/qdir/qdir.pro
index 2cdebfd..c572566 100644
--- a/tests/benchmarks/corelib/io/qdir/qdir.pro
+++ b/tests/benchmarks/corelib/io/qdir/qdir.pro
@@ -1,8 +1,2 @@
-load(qttest_p4)
-TEMPLATE = app
-TARGET = tst_qdir
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
-SOURCES += tst_qdir.cpp
+TEMPLATE = subdirs
+SUBDIRS = 10000
diff --git a/tests/benchmarks/corelib/io/qfileinfo/qfileinfo.pro b/tests/benchmarks/corelib/io/qfileinfo/qfileinfo.pro
index 295cb50..eca619f 100644
--- a/tests/benchmarks/corelib/io/qfileinfo/qfileinfo.pro
+++ b/tests/benchmarks/corelib/io/qfileinfo/qfileinfo.pro
@@ -1,6 +1,6 @@
load(qttest_p4)
TEMPLATE = app
-TARGET = qfileinfo
+TARGET = tst_qfileinfo
DEPENDPATH += .
INCLUDEPATH += .
diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index ac51072..e17cf1c 100644
--- a/tests/benchmarks/gui/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/benchmarks/gui/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -55,6 +55,7 @@ public:
virtual ~tst_QGraphicsItem();
public slots:
+ void initTestCase();
void init();
void cleanup();
@@ -71,7 +72,6 @@ private slots:
void scale();
void shear();
void translate();
- void setRotation();
};
tst_QGraphicsItem::tst_QGraphicsItem()
@@ -82,8 +82,23 @@ tst_QGraphicsItem::~tst_QGraphicsItem()
{
}
+static inline void processEvents()
+{
+ QApplication::flush();
+ QApplication::processEvents();
+ QApplication::processEvents();
+}
+
+void tst_QGraphicsItem::initTestCase()
+{
+ QApplication::flush();
+ QTest::qWait(1500);
+ processEvents();
+}
+
void tst_QGraphicsItem::init()
{
+ processEvents();
}
void tst_QGraphicsItem::cleanup()
@@ -152,10 +167,10 @@ void tst_QGraphicsItem::setPos()
QGraphicsScene scene;
QGraphicsRectItem *rect = scene.addRect(QRectF(0, 0, 100, 100));
+ processEvents();
QBENCHMARK {
rect->setPos(10, 10);
- rect->transform(); // prevent lazy optimizing
}
}
@@ -163,7 +178,6 @@ void tst_QGraphicsItem::setTransform_data()
{
QTest::addColumn<QTransform>("transform");
- QTest::newRow("id") << QTransform();
QTest::newRow("rotate 45z") << QTransform().rotate(45);
QTest::newRow("scale 2x2") << QTransform().scale(2, 2);
QTest::newRow("translate 100, 100") << QTransform().translate(100, 100);
@@ -177,10 +191,10 @@ void tst_QGraphicsItem::setTransform()
QGraphicsScene scene;
QGraphicsRectItem *item = scene.addRect(QRectF(0, 0, 100, 100));
+ processEvents();
QBENCHMARK {
item->setTransform(transform);
- item->transform(); // prevent lazy optimizing
}
}
@@ -188,10 +202,10 @@ void tst_QGraphicsItem::rotate()
{
QGraphicsScene scene;
QGraphicsItem *item = scene.addRect(QRectF(0, 0, 100, 100));
+ processEvents();
QBENCHMARK {
item->rotate(45);
- item->transform(); // prevent lazy optimizing
}
}
@@ -199,10 +213,10 @@ void tst_QGraphicsItem::scale()
{
QGraphicsScene scene;
QGraphicsItem *item = scene.addRect(QRectF(0, 0, 100, 100));
+ processEvents();
QBENCHMARK {
item->scale(2, 2);
- item->transform(); // prevent lazy optimizing
}
}
@@ -210,10 +224,10 @@ void tst_QGraphicsItem::shear()
{
QGraphicsScene scene;
QGraphicsItem *item = scene.addRect(QRectF(0, 0, 100, 100));
+ processEvents();
QBENCHMARK {
item->shear(1.5, 1.5);
- item->transform(); // prevent lazy optimizing
}
}
@@ -221,21 +235,10 @@ void tst_QGraphicsItem::translate()
{
QGraphicsScene scene;
QGraphicsItem *item = scene.addRect(QRectF(0, 0, 100, 100));
+ processEvents();
QBENCHMARK {
item->translate(100, 100);
- item->transform(); // prevent lazy optimizing
- }
-}
-
-void tst_QGraphicsItem::setRotation()
-{
- QGraphicsScene scene;
- QGraphicsItem *item = scene.addRect(QRectF(0, 0, 100, 100));
-
- QBENCHMARK {
- item->setRotation(45);
- item->transform(); // prevent lazy optimizing
}
}
diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
index 5bd07f9..10d73d5 100644
--- a/tests/benchmarks/gui/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/benchmarks/gui/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -75,8 +75,16 @@ tst_QGraphicsScene::~tst_QGraphicsScene()
{
}
+static inline void processEvents()
+{
+ QApplication::flush();
+ QApplication::processEvents();
+ QApplication::processEvents();
+}
+
void tst_QGraphicsScene::init()
{
+ processEvents();
}
void tst_QGraphicsScene::cleanup()
@@ -148,6 +156,8 @@ void tst_QGraphicsScene::addItem()
if (!sceneRect.isNull())
scene.setSceneRect(sceneRect);
+ processEvents();
+
QBENCHMARK {
QGraphicsItem *item = 0;
for (int y = 0; y < numItems_Y; ++y) {
@@ -209,7 +219,6 @@ void tst_QGraphicsScene::itemAt()
if (!sceneRect.isNull())
scene.setSceneRect(sceneRect);
- QGraphicsItem *item = 0;
for (int y = 0; y < numItems_Y; ++y) {
for (int x = 0; x < numItems_X; ++x) {
QGraphicsRectItem *item = new QGraphicsRectItem(itemRect);
@@ -219,9 +228,11 @@ void tst_QGraphicsScene::itemAt()
}
scene.itemAt(0, 0); // triggers indexing
+ processEvents();
+ QGraphicsItem *item = 0;
QBENCHMARK {
- scene.itemAt(0, 0);
+ item = scene.itemAt(0, 0);
}
//let QGraphicsScene::_q_polishItems be called so ~QGraphicsItem doesn't spend all his time cleaning the unpolished list
diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp
index 1028f42..6c4ca08 100644
--- a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp
+++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp
@@ -42,7 +42,14 @@
#include "view.h"
#include <QtGui>
+
+#ifdef Q_WS_WIN
+#define CALLGRIND_START_INSTRUMENTATION {}
+#define CALLGRIND_STOP_INSTRUMENTATION {}
+#else
#include "valgrind/callgrind.h"
+#endif
+
#ifndef QT_NO_OPENGL
#include <QtOpenGL>
#endif
diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/moveItems/main.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/moveItems/main.cpp
index 527713f..63b0da9 100644
--- a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/moveItems/main.cpp
+++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/moveItems/main.cpp
@@ -39,7 +39,13 @@
**
****************************************************************************/
#include <QtGui>
+
+#ifdef Q_WS_WIN
+#define CALLGRIND_START_INSTRUMENTATION {}
+#define CALLGRIND_STOP_INSTRUMENTATION {}
+#else
#include "valgrind/callgrind.h"
+#endif
#ifdef Q_WS_X11
extern void qt_x11_wait_for_window_manager(QWidget *);
diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/scrolltest/main.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/scrolltest/main.cpp
index 7419206..3f30393 100644
--- a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/scrolltest/main.cpp
+++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/scrolltest/main.cpp
@@ -39,7 +39,13 @@
**
****************************************************************************/
#include <QtGui>
+
+#ifdef Q_WS_WIN
+#define CALLGRIND_START_INSTRUMENTATION {}
+#define CALLGRIND_STOP_INSTRUMENTATION {}
+#else
#include "valgrind/callgrind.h"
+#endif
class ItemMover : public QObject
{
diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
index 10e00a6..3c0ae71 100644
--- a/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
@@ -45,11 +45,7 @@
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QImage>
-#ifdef Q_WS_X11
-QT_BEGIN_NAMESPACE
-extern void qt_x11_wait_for_window_manager(QWidget *);
-QT_END_NAMESPACE
-#endif
+
#include "chiptester/chiptester.h"
//#define CALLGRIND_DEBUG
#ifdef CALLGRIND_DEBUG
@@ -58,34 +54,65 @@ QT_END_NAMESPACE
//TESTED_FILES=
-class QEventWaiter : public QEventLoop
+static inline void processEvents()
+{
+ QPixmapCache::clear();
+ QApplication::flush();
+ QApplication::processEvents();
+ QApplication::processEvents();
+}
+
+class TestView : public QGraphicsView
{
+ Q_OBJECT
public:
- QEventWaiter(QObject *receiver, QEvent::Type type)
- : waiting(false), t(type)
- {
- receiver->installEventFilter(this);
- }
+ TestView() : QGraphicsView(), waiting(false), timerId(-1)
+ {}
- void wait()
+ void waitForPaintEvent(int timeout = 4000)
{
+ if (waiting)
+ return;
waiting = true;
- exec();
+ timerId = startTimer(timeout);
+ eventLoop.exec();
+ killTimer(timerId);
+ timerId = -1;
+ waiting = false;
}
- bool eventFilter(QObject *receiver, QEvent *event)
+ void tryResize(int width, int height)
{
- Q_UNUSED(receiver);
- if (waiting && event->type() == t) {
- waiting = false;
- exit();
+ QDesktopWidget *desktop = QApplication::desktop();
+ if (desktop->width() < width)
+ width = desktop->width();
+ if (desktop->height() < height)
+ height = desktop->height();
+ if (size() != QSize(width, height)) {
+ resize(width, height);
+ QTest::qWait(250);
+ processEvents();
}
- return false;
+ }
+
+protected:
+ void paintEvent(QPaintEvent *event)
+ {
+ QGraphicsView::paintEvent(event);
+ if (waiting)
+ eventLoop.exit();
+ }
+
+ void timerEvent(QTimerEvent *event)
+ {
+ if (event->timerId() == timerId)
+ eventLoop.exit();
}
private:
+ QEventLoop eventLoop;
bool waiting;
- QEvent::Type t;
+ int timerId;
};
class tst_QGraphicsView : public QObject
@@ -97,6 +124,7 @@ public:
virtual ~tst_QGraphicsView();
public slots:
+ void initTestCase();
void init();
void cleanup();
@@ -126,6 +154,9 @@ private slots:
void moveItemCache();
void paintItemCache_data();
void paintItemCache();
+
+private:
+ TestView mView;
};
tst_QGraphicsView::tst_QGraphicsView()
@@ -136,8 +167,25 @@ tst_QGraphicsView::~tst_QGraphicsView()
{
}
+void tst_QGraphicsView::initTestCase()
+{
+ mView.setFrameStyle(0);
+ mView.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ mView.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ mView.tryResize(100, 100);
+ mView.show();
+ QTest::qWaitForWindowShown(&mView);
+ QTest::qWait(300);
+ processEvents();
+}
+
void tst_QGraphicsView::init()
{
+ mView.setRenderHints(QPainter::RenderHints(0));
+ mView.viewport()->setMouseTracking(false);
+ mView.setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
+ for (int i = 0; i < 3; ++i)
+ processEvents();
}
void tst_QGraphicsView::cleanup()
@@ -156,25 +204,18 @@ void tst_QGraphicsView::paintSingleItem()
QGraphicsScene scene(0, 0, 100, 100);
scene.addRect(0, 0, 10, 10);
- QGraphicsView view(&scene);
- view.show();
- view.resize(100, 100);
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
+ mView.setScene(&scene);
+ mView.tryResize(100, 100);
+ processEvents();
QImage image(100, 100, QImage::Format_ARGB32_Premultiplied);
QPainter painter(&image);
QBENCHMARK {
- view.viewport()->render(&painter);
+ mView.viewport()->render(&painter);
}
}
-#ifdef Q_OS_SYMBIAN
-# define DEEP_STACKING_COUNT 85
-#else
-# define DEEP_STACKING_COUNT 1000
-#endif
+#define DEEP_STACKING_COUNT 85
void tst_QGraphicsView::paintDeepStackingItems()
{
@@ -188,17 +229,14 @@ void tst_QGraphicsView::paintDeepStackingItems()
lastRect = rect;
}
- QGraphicsView view(&scene);
- view.show();
- view.resize(100, 100);
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
+ mView.setScene(&scene);
+ mView.tryResize(100, 100);
+ processEvents();
QImage image(100, 100, QImage::Format_ARGB32_Premultiplied);
QPainter painter(&image);
QBENCHMARK {
- view.viewport()->render(&painter);
+ mView.viewport()->render(&painter);
}
}
@@ -215,17 +253,14 @@ void tst_QGraphicsView::paintDeepStackingItems_clipped()
lastRect = rect;
}
- QGraphicsView view(&scene);
- view.show();
- view.resize(100, 100);
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
+ mView.setScene(&scene);
+ mView.tryResize(100, 100);
+ processEvents();
QImage image(100, 100, QImage::Format_ARGB32_Premultiplied);
QPainter painter(&image);
QBENCHMARK {
- view.viewport()->render(&painter);
+ mView.viewport()->render(&painter);
}
}
@@ -234,18 +269,14 @@ void tst_QGraphicsView::moveSingleItem()
QGraphicsScene scene(0, 0, 100, 100);
QGraphicsRectItem *item = scene.addRect(0, 0, 10, 10);
- QGraphicsView view(&scene);
- view.show();
- view.resize(100, 100);
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
+ mView.setScene(&scene);
+ mView.tryResize(100, 100);
+ processEvents();
- QEventWaiter waiter(view.viewport(), QEvent::Paint);
int n = 1;
QBENCHMARK {
item->setPos(25 * n, 25 * n);
- waiter.wait();
+ mView.waitForPaintEvent();
n = n ? 0 : 1;
}
}
@@ -271,6 +302,8 @@ void tst_QGraphicsView::mapPointToScene()
QGraphicsView view;
view.setTransform(transform);
+ processEvents();
+
QBENCHMARK {
view.mapToScene(point);
}
@@ -297,6 +330,8 @@ void tst_QGraphicsView::mapPointFromScene()
QGraphicsView view;
view.setTransform(transform);
+ processEvents();
+
QBENCHMARK {
view.mapFromScene(point);
}
@@ -323,6 +358,8 @@ void tst_QGraphicsView::mapRectToScene()
QGraphicsView view;
view.setTransform(transform);
+ processEvents();
+
QBENCHMARK {
view.mapToScene(rect);
}
@@ -349,6 +386,8 @@ void tst_QGraphicsView::mapRectFromScene()
QGraphicsView view;
view.setTransform(transform);
+ processEvents();
+
QBENCHMARK {
view.mapFromScene(rect);
}
@@ -380,13 +419,14 @@ void tst_QGraphicsView::chipTester()
QFETCH(int, operation);
ChipTester tester;
- tester.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&tester);
-#endif
tester.setAntialias(antialias);
tester.setOpenGL(opengl);
tester.setOperation(ChipTester::Operation(operation));
+ tester.show();
+ QTest::qWaitForWindowShown(&tester);
+ QTest::qWait(250);
+ processEvents();
+
QBENCHMARK {
tester.runBenchmark();
}
@@ -436,20 +476,20 @@ void tst_QGraphicsView::deepNesting()
}
scene.setItemIndexMethod(bsp ? QGraphicsScene::BspTreeIndex : QGraphicsScene::NoIndex);
scene.setSortCacheEnabled(sortCache);
+ scene.setSceneRect(scene.sceneRect());
- QGraphicsView view(&scene);
- view.setRenderHint(QPainter::Antialiasing);
- view.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
- QTest::qWait(250);
+ mView.setRenderHint(QPainter::Antialiasing);
+ mView.setScene(&scene);
+ mView.tryResize(600, 600);
+ (void)scene.itemAt(0, 0);
+ processEvents();
QBENCHMARK {
#ifdef CALLGRIND_DEBUG
CALLGRIND_START_INSTRUMENTATION
#endif
- view.viewport()->repaint();
+ mView.viewport()->update();
+ mView.waitForPaintEvent();
#ifdef CALLGRIND_DEBUG
CALLGRIND_STOP_INSTRUMENTATION
#endif
@@ -503,23 +543,6 @@ private:
bool scale;
};
-class CountPaintEventView : public QGraphicsView
-{
-public:
- CountPaintEventView(QGraphicsScene *scene = 0)
- : QGraphicsView(scene), count(0)
- { }
-
- int count;
-
-protected:
- void paintEvent(QPaintEvent *event)
- {
- ++count;
- QGraphicsView::paintEvent(event);
- };
-};
-
void tst_QGraphicsView::imageRiver_data()
{
QTest::addColumn<int>("direction");
@@ -541,13 +564,6 @@ void tst_QGraphicsView::imageRiver()
QGraphicsScene scene(0, 0, 300, 300);
- CountPaintEventView view(&scene);
- view.resize(300, 300);
- view.setFrameStyle(0);
- view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- view.show();
-
QPixmap pix(":/images/designer.png");
QVERIFY(!pix.isNull());
@@ -555,37 +571,31 @@ void tst_QGraphicsView::imageRiver()
QFile file(":/random.data");
QVERIFY(file.open(QIODevice::ReadOnly));
QDataStream str(&file);
-#if defined(Q_OS_SYMBIAN)
for (int i = 0; i < 50; ++i) {
-#else
- for (int i = 0; i < 100; ++i) {
-#endif
- AnimatedPixmapItem *item;
+ AnimatedPixmapItem *item = 0;
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()));
+ item->setPos(-pix.width() + rnd1 % (300 + pix.width()),
+ -pix.height() + rnd2 % (300 + pix.height()));
scene.addItem(item);
}
+ scene.setSceneRect(0, 0, 300, 300);
- view.count = 0;
+ mView.setScene(&scene);
+ mView.tryResize(300, 300);
+ processEvents();
QBENCHMARK {
#ifdef CALLGRIND_DEBUG
CALLGRIND_START_INSTRUMENTATION
#endif
-#if defined(Q_OS_SYMBIAN)
for (int i = 0; i < 50; ++i) {
-#else
- for (int i = 0; i < 100; ++i) {
-#endif
scene.advance();
- while (view.count < (i+1))
- qApp->processEvents();
+ mView.waitForPaintEvent();
}
#ifdef CALLGRIND_DEBUG
CALLGRIND_STOP_INSTRUMENTATION
@@ -663,13 +673,6 @@ void tst_QGraphicsView::textRiver()
QGraphicsScene scene(0, 0, 300, 300);
- CountPaintEventView view(&scene);
- view.resize(300, 300);
- view.setFrameStyle(0);
- view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- view.show();
-
QPixmap pix(":/images/designer.png");
QVERIFY(!pix.isNull());
@@ -677,36 +680,32 @@ void tst_QGraphicsView::textRiver()
QFile file(":/random.data");
QVERIFY(file.open(QIODevice::ReadOnly));
QDataStream str(&file);
-#if defined(Q_OS_SYMBIAN)
for (int i = 0; i < 50; ++i) {
-#else
- for (int i = 0; i < 100; ++i) {
-#endif
- AnimatedTextItem *item;
+ AnimatedTextItem *item = 0;
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()));
+ item->setPos(-pix.width() + rnd1 % (300 + pix.width()),
+ -pix.height() + rnd2 % (300 + pix.height()));
+ item->setAcceptDrops(false);
+ item->setAcceptHoverEvents(false);
scene.addItem(item);
}
+ scene.setSceneRect(0, 0, 300, 300);
- view.count = 0;
+ mView.setScene(&scene);
+ mView.tryResize(300, 300);
+ processEvents();
QBENCHMARK {
#ifdef CALLGRIND_DEBUG
CALLGRIND_START_INSTRUMENTATION
#endif
-#if defined(Q_OS_SYMBIAN)
for (int i = 0; i < 50; ++i) {
-#else
- for (int i = 0; i < 100; ++i) {
-#endif
scene.advance();
- while (view.count < (i+1))
- qApp->processEvents();
+ mView.waitForPaintEvent();
}
#ifdef CALLGRIND_DEBUG
CALLGRIND_STOP_INSTRUMENTATION
@@ -773,13 +772,6 @@ void tst_QGraphicsView::moveItemCache()
QGraphicsScene scene(0, 0, 300, 300);
- CountPaintEventView view(&scene);
- view.resize(600, 600);
- view.setFrameStyle(0);
- view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- view.show();
-
QPixmap pix(":/images/wine.jpeg");
QVERIFY(!pix.isNull());
@@ -787,12 +779,8 @@ void tst_QGraphicsView::moveItemCache()
QFile file(":/random.data");
QVERIFY(file.open(QIODevice::ReadOnly));
QDataStream str(&file);
-#if defined(Q_OS_SYMBIAN)
for (int i = 0; i < 5; ++i) {
-#else
- for (int i = 0; i < 50; ++i) {
-#endif
- AnimatedPixmapCacheItem *item;
+ AnimatedPixmapCacheItem *item = 0;
if (direction == 0) item = new AnimatedPixmapCacheItem((i % 4) + 1, 0);
if (direction == 1) item = new AnimatedPixmapCacheItem(0, (i % 4) + 1);
if (direction == 2) item = new AnimatedPixmapCacheItem((i % 4) + 1, (i % 4) + 1);
@@ -802,25 +790,23 @@ void tst_QGraphicsView::moveItemCache()
item->setTransform(QTransform().rotate(45));
int rnd1, rnd2;
str >> rnd1 >> rnd2;
- item->setPos(-pix.width() + rnd1 % (view.width() + pix.width()),
- -pix.height() + rnd2 % (view.height() + pix.height()));
+ item->setPos(-pix.width() + rnd1 % (400 + pix.width()),
+ -pix.height() + rnd2 % (400 + pix.height()));
scene.addItem(item);
}
+ scene.setSceneRect(0, 0, 400, 400);
- view.count = 0;
+ mView.setScene(&scene);
+ mView.tryResize(400, 400);
+ processEvents();
QBENCHMARK {
#ifdef CALLGRIND_DEBUG
CALLGRIND_START_INSTRUMENTATION
#endif
-#if defined(Q_OS_SYMBIAN)
- for (int i = 0; i < 50; ++i) {
-#else
- for (int i = 0; i < 100; ++i) {
-#endif
+ for (int i = 0; i < 5; ++i) {
scene.advance();
- while (view.count < (i+1))
- qApp->processEvents();
+ mView.waitForPaintEvent();
}
#ifdef CALLGRIND_DEBUG
CALLGRIND_STOP_INSTRUMENTATION
@@ -843,6 +829,7 @@ public:
protected:
void advance(int i)
{
+ Q_UNUSED(i);
if (partial)
update(QRectF(boundingRect().center().x(), boundingRect().center().x(), 30, 30));
else
@@ -880,13 +867,6 @@ void tst_QGraphicsView::paintItemCache()
QGraphicsScene scene(0, 0, 300, 300);
- CountPaintEventView view(&scene);
- view.resize(600, 600);
- view.setFrameStyle(0);
- view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- view.show();
-
QPixmap pix(":/images/wine.jpeg");
QVERIFY(!pix.isNull());
@@ -910,21 +890,19 @@ void tst_QGraphicsView::paintItemCache()
item->setTransform(QTransform().rotate(45));
item->setPos(0, 0);
scene.addItem(item);
+ scene.setSceneRect(-100, -100, 600, 600);
- view.count = 0;
+ mView.tryResize(600, 600);
+ mView.setScene(&scene);
+ processEvents();
QBENCHMARK {
#ifdef CALLGRIND_DEBUG
CALLGRIND_START_INSTRUMENTATION
#endif
-#if defined(Q_OS_SYMBIAN)
for (int i = 0; i < 5; ++i) {
-#else
- for (int i = 0; i < 50; ++i) {
-#endif
scene.advance();
- while (view.count < (i+1))
- qApp->processEvents();
+ mView.waitForPaintEvent();
}
#ifdef CALLGRIND_DEBUG
CALLGRIND_STOP_INSTRUMENTATION
diff --git a/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp b/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp
index f21bd44..8c30be4 100644
--- a/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp
@@ -42,33 +42,35 @@
#include <qtest.h>
#include <QtGui>
-class tst_QWidget : public QObject
+static void processEvents()
{
- Q_OBJECT
-
-
-private slots:
- void update_data();
- void updateOpaque_data();
- void updateOpaque();
- void updateTransparent_data();
- void updateTransparent();
- void updatePartial_data();
- void updatePartial();
- void updateComplex_data();
- void updateComplex();
-
- void complexToplevelResize();
-};
+ QApplication::flush();
+ QApplication::processEvents();
+ QApplication::processEvents();
+}
class UpdateWidget : public QWidget
{
public:
- UpdateWidget(int rows, int columns) : QWidget(0)
+ UpdateWidget(int rows, int columns)
+ : QWidget(0), rowCount(0), columnCount(0), opaqueChildren(false)
{
+ fill(rows, columns);
+ }
+
+ UpdateWidget(QWidget *parent = 0)
+ : QWidget(parent), rowCount(0), columnCount(0), opaqueChildren(false) {}
+
+ void fill(int rows, int columns)
+ {
+ if (rows == rowCount && columns == columnCount)
+ return;
+ delete layout();
QGridLayout *layout = new QGridLayout;
- for (int row = 0; row < rows; ++row) {
- for (int column = 0; column < columns; ++column) {
+ rowCount = rows;
+ columnCount = columns;
+ for (int row = 0; row < rowCount; ++row) {
+ for (int column = 0; column < columnCount; ++column) {
UpdateWidget *widget = new UpdateWidget;
widget->setFixedSize(20, 20);
layout->addWidget(widget, row, column);
@@ -76,9 +78,20 @@ public:
}
}
setLayout(layout);
+ adjustSize();
+ QTest::qWait(250);
+ processEvents();
}
- UpdateWidget(QWidget *parent = 0) : QWidget(parent) {}
+ void setOpaqueChildren(bool enable)
+ {
+ if (opaqueChildren != enable) {
+ foreach (QWidget *w, children)
+ w->setAttribute(Qt::WA_OpaquePaintEvent, enable);
+ opaqueChildren = enable;
+ processEvents();
+ }
+ }
void paintEvent(QPaintEvent *)
{
@@ -93,75 +106,86 @@ public:
QRegion updateRegion;
QList<UpdateWidget*> children;
+ int rowCount;
+ int columnCount;
+ bool opaqueChildren;
};
-void tst_QWidget::update_data()
+class tst_QWidget : public QObject
{
- QTest::addColumn<int>("rows");
- QTest::addColumn<int>("columns");
- QTest::addColumn<int>("numUpdates");
-
- QTest::newRow("10x10x1") << 10 << 10 << 1;
- QTest::newRow("10x10x10") << 10 << 10 << 10;
- QTest::newRow("25x25x1") << 25 << 25 << 1;
- QTest::newRow("25x25x10") << 25 << 25 << 10;
- QTest::newRow("25x25x100") << 25 << 25 << 100;
-}
+ Q_OBJECT
-void tst_QWidget::updateOpaque_data()
-{
- update_data();
-}
+public slots:
+ void initTestCase();
+ void init();
-void tst_QWidget::updateOpaque()
-{
- QFETCH(int, rows);
- QFETCH(int, columns);
- QFETCH(int, numUpdates);
+private slots:
+ void update_data();
+ void update();
+ void updatePartial_data();
+ void updatePartial();
+ void updateComplex_data();
+ void updateComplex();
- UpdateWidget widget(rows, columns);
- foreach (QWidget *w, widget.children) {
- w->setAttribute(Qt::WA_OpaquePaintEvent);
- }
+private:
+ UpdateWidget widget;
+};
+void tst_QWidget::initTestCase()
+{
widget.show();
- QApplication::processEvents();
+ QTest::qWaitForWindowShown(&widget);
+ QTest::qWait(300);
+ processEvents();
+}
- int i = 0;
- const int n = widget.children.size();
- QBENCHMARK {
- for (int j = 0; j < numUpdates; ++j) {
- widget.children[i]->update();
- QApplication::processEvents();
- i = (i + 1) % n;
- }
- }
+void tst_QWidget::init()
+{
+ QVERIFY(widget.isVisible());
+ for (int i = 0; i < 3; ++i)
+ processEvents();
}
-void tst_QWidget::updateTransparent_data()
+void tst_QWidget::update_data()
{
- update_data();
+ QTest::addColumn<int>("rows");
+ QTest::addColumn<int>("columns");
+ QTest::addColumn<int>("numUpdates");
+ QTest::addColumn<bool>("opaque");
+
+ QTest::newRow("10x10x1 transparent") << 10 << 10 << 1 << false;
+ QTest::newRow("10x10x10 transparent") << 10 << 10 << 10 << false;
+ QTest::newRow("10x10x100 transparent") << 10 << 10 << 100 << false;
+ QTest::newRow("10x10x1 opaque") << 10 << 10 << 1 << true;
+ QTest::newRow("10x10x10 opaque") << 10 << 10 << 10 << true;
+ QTest::newRow("10x10x100 opaque") << 10 << 10 << 100 << true;
+ QTest::newRow("25x25x1 transparent ") << 25 << 25 << 1 << false;
+ QTest::newRow("25x25x10 transparent") << 25 << 25 << 10 << false;
+ QTest::newRow("25x25x100 transparent") << 25 << 25 << 100 << false;
+ QTest::newRow("25x25x1 opaque") << 25 << 25 << 1 << true;
+ QTest::newRow("25x25x10 opaque") << 25 << 25 << 10 << true;
+ QTest::newRow("25x25x100 opaque") << 25 << 25 << 100 << true;
}
-void tst_QWidget::updateTransparent()
+void tst_QWidget::update()
{
QFETCH(int, rows);
QFETCH(int, columns);
QFETCH(int, numUpdates);
+ QFETCH(bool, opaque);
- UpdateWidget widget(rows, columns);
- widget.show();
- QApplication::processEvents();
+ widget.fill(rows, columns);
+ widget.setOpaqueChildren(opaque);
- int i = 0;
- const int n = widget.children.size();
QBENCHMARK {
- for (int j = 0; j < numUpdates; ++j) {
- widget.children[i]->update();
+ for (int i = 0; i < widget.children.size(); ++i) {
+ for (int j = 0; j < numUpdates; ++j)
+ widget.children.at(i)->update();
QApplication::processEvents();
- i = (i + 1) % n;
}
}
+
+ QApplication::flush();
}
void tst_QWidget::updatePartial_data()
@@ -174,24 +198,23 @@ void tst_QWidget::updatePartial()
QFETCH(int, rows);
QFETCH(int, columns);
QFETCH(int, numUpdates);
+ QFETCH(bool, opaque);
- UpdateWidget widget(rows, columns);
- widget.show();
- QApplication::processEvents();
+ widget.fill(rows, columns);
+ widget.setOpaqueChildren(opaque);
- int i = 0;
- const int n = widget.children.size();
QBENCHMARK {
- for (int j = 0; j < numUpdates; ++j) {
+ for (int i = 0; i < widget.children.size(); ++i) {
QWidget *w = widget.children[i];
const int x = w->width() / 2;
const int y = w->height() / 2;
- w->update(0, 0, x, y);
- w->update(x, 0, x, y);
- w->update(0, y, x, y);
- w->update(x, y, x, y);
+ for (int j = 0; j < numUpdates; ++j) {
+ w->update(0, 0, x, y);
+ w->update(x, 0, x, y);
+ w->update(0, y, x, y);
+ w->update(x, y, x, y);
+ }
QApplication::processEvents();
- i = (i + 1) % n;
}
}
}
@@ -206,127 +229,27 @@ void tst_QWidget::updateComplex()
QFETCH(int, rows);
QFETCH(int, columns);
QFETCH(int, numUpdates);
+ QFETCH(bool, opaque);
- UpdateWidget widget(rows, columns);
- widget.show();
- QApplication::processEvents();
+ widget.fill(rows, columns);
+ widget.setOpaqueChildren(opaque);
- int i = 0;
- const int n = widget.children.size();
QBENCHMARK {
- for (int j = 0; j < numUpdates; ++j) {
+ for (int i = 0; i < widget.children.size(); ++i) {
QWidget *w = widget.children[i];
const int x = w->width() / 2;
const int y = w->height() / 2;
- w->update(QRegion(0, 0, x, y, QRegion::Ellipse));
- w->update(QRegion(x, y, x, y, QRegion::Ellipse));
+ QRegion r1(0, 0, x, y, QRegion::Ellipse);
+ QRegion r2(x, y, x, y, QRegion::Ellipse);
+ for (int j = 0; j < numUpdates; ++j) {
+ w->update(r1);
+ w->update(r2);
+ }
QApplication::processEvents();
- i = (i + 1) % n;
}
}
}
-class ResizeWidget : public QWidget
-{
-public:
- ResizeWidget();
-};
-
-ResizeWidget::ResizeWidget() : QWidget(0)
-{
- QBoxLayout *topLayout = new QVBoxLayout;
-
- QMenuBar *menubar = new QMenuBar;
- QMenu* popup = menubar->addMenu("&File");
- popup->addAction("&Quit", qApp, SLOT(quit()));
- topLayout->setMenuBar(menubar);
-
- QBoxLayout *buttons = new QHBoxLayout;
- buttons->setMargin(5);
- buttons->addStretch(10);
- for (int i = 1; i <= 4; i++ ) {
- QPushButton* button = new QPushButton;
- button->setText(QString("Button %1").arg(i));
- buttons->addWidget(button);
- }
- topLayout->addLayout(buttons);
-
- buttons = new QHBoxLayout;
- buttons->addStretch(10);
- for (int i = 11; i <= 16; i++) {
- QPushButton* button = new QPushButton;
- button->setText(QString("Button %1").arg(i));
- buttons->addWidget(button);
- }
- topLayout->addLayout(buttons);
-
- QBoxLayout *buttons2 = new QHBoxLayout;
- buttons2->addStretch(10);
- topLayout->addLayout(buttons2);
-
- QPushButton *button = new QPushButton;
- button->setText("Button five");
- buttons2->addWidget(button);
-
- button = new QPushButton;
- button->setText("Button 6");
- buttons2->addWidget(button);
-
- QTextEdit *bigWidget = new QTextEdit;
- bigWidget->setText("This widget will get all the remaining space");
- bigWidget->setFrameStyle(QFrame::Panel | QFrame::Plain);
- topLayout->addWidget(bigWidget);
-
- const int numRows = 6;
- const int labelCol = 0;
- const int linedCol = 1;
- const int multiCol = 2;
-
- QGridLayout *grid = new QGridLayout;
- for (int row = 0; row < numRows; row++) {
- QLineEdit *lineEdit = new QLineEdit;
- grid->addWidget(lineEdit, row, linedCol);
- QLabel *label = new QLabel(QString("Line &%1").arg(row + 1));
- grid->addWidget(label, row, labelCol);
- }
- topLayout->addLayout(grid);
-
- QTextEdit *multiLineEdit = new QTextEdit;
- grid->addWidget(multiLineEdit, 0, labelCol + 1, multiCol, multiCol);
-
- grid->setColumnStretch(linedCol, 10);
- grid->setColumnStretch(multiCol, 20);
-
- QLabel* statusBar = new QLabel;
- statusBar->setText("Let's pretend this is a status bar");
- statusBar->setFrameStyle(QFrame::Panel | QFrame::Sunken);
- statusBar->setFixedHeight(statusBar->sizeHint().height());
- statusBar->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
- topLayout->addWidget(statusBar);
-
- topLayout->activate();
- setLayout(topLayout);
-}
-
-void tst_QWidget::complexToplevelResize()
-{
- ResizeWidget w;
- w.show();
-
- QApplication::processEvents();
-
- const int minSize = 100;
- const int maxSize = 800;
- int size = minSize;
-
- QBENCHMARK {
- w.resize(size, size);
- size = qMax(minSize, (size + 10) % maxSize);
- QApplication::processEvents();
- QApplication::processEvents();
- }
-}
-
QTEST_MAIN(tst_QWidget)
#include "tst_qwidget.moc"
diff --git a/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp b/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp
index 226b661..d051b12 100644
--- a/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp
+++ b/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp
@@ -82,6 +82,7 @@ void tst_qstylesheetstyle::empty()
{
QWidget *w = buildSimpleWidgets();
w->setStyleSheet("/* */");
+ QApplication::processEvents();
int i = 0;
QBENCHMARK {
w->setStyleSheet("/*" + QString::number(i) + "*/");
@@ -94,6 +95,7 @@ void tst_qstylesheetstyle::empty_events()
{
QWidget *w = buildSimpleWidgets();
w->setStyleSheet("/* */");
+ QApplication::processEvents();
int i = 0;
QBENCHMARK {
w->setStyleSheet("/*" + QString::number(i) + "*/");
@@ -112,6 +114,7 @@ void tst_qstylesheetstyle::simple()
{
QWidget *w = buildSimpleWidgets();
w->setStyleSheet("/* */");
+ QApplication::processEvents();
int i = 0;
QBENCHMARK {
w->setStyleSheet(QString(simple_css) + "/*" + QString::number(i) + "*/");
@@ -124,6 +127,7 @@ void tst_qstylesheetstyle::simple_events()
{
QWidget *w = buildSimpleWidgets();
w->setStyleSheet("/* */");
+ QApplication::processEvents();
int i = 0;
QBENCHMARK {
w->setStyleSheet(QString(simple_css) + "/*" + QString::number(i) + "*/");
@@ -175,8 +179,13 @@ void tst_qstylesheetstyle::grid()
w->setStyleSheet("/* */");
if(show) {
w->show();
+ QTest::qWaitForWindowShown(w);
+ QApplication::flush();
+ QApplication::processEvents();
QTest::qWait(30);
+ QApplication::processEvents();
}
+ QApplication::processEvents();
int i = 0;
QBENCHMARK {
w->setStyleSheet(stylesheet + "/*" + QString::number(i) + "*/");
diff --git a/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro b/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro
index 99d1935..89f5d31 100644
--- a/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro
+++ b/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro
@@ -1,6 +1,6 @@
load(qttest_p4)
TEMPLATE = app
-TARGET = qfile_vs_qnetworkaccessmanager
+TARGET = tst_qfile_vs_qnetworkaccessmanager
DEPENDPATH += .
INCLUDEPATH += .
diff --git a/tools/assistant/lib/qhelpsearchengine.cpp b/tools/assistant/lib/qhelpsearchengine.cpp
index 7c2635d..9914efa 100644
--- a/tools/assistant/lib/qhelpsearchengine.cpp
+++ b/tools/assistant/lib/qhelpsearchengine.cpp
@@ -63,9 +63,9 @@
QT_BEGIN_NAMESPACE
#if defined(QT_CLUCENE_SUPPORT)
- using namespace qt::fulltextsearch::clucene;
+ using namespace fulltextsearch::clucene;
#else
- using namespace qt::fulltextsearch::std;
+ using namespace fulltextsearch::std;
#endif
class QHelpSearchEnginePrivate : public QObject
@@ -195,7 +195,7 @@ private:
QHelpSearchQueryWidget *queryWidget;
QHelpSearchResultWidget *resultWidget;
- qt::fulltextsearch::QHelpSearchIndexReader *indexReader;
+ fulltextsearch::QHelpSearchIndexReader *indexReader;
QHelpSearchIndexWriter *indexWriter;
QPointer<QHelpEngineCore> helpEngine;
diff --git a/tools/assistant/lib/qhelpsearchindexreader.cpp b/tools/assistant/lib/qhelpsearchindexreader.cpp
index 92d7658..e79fca6 100644
--- a/tools/assistant/lib/qhelpsearchindexreader.cpp
+++ b/tools/assistant/lib/qhelpsearchindexreader.cpp
@@ -43,8 +43,7 @@
QT_BEGIN_NAMESPACE
-namespace qt {
- namespace fulltextsearch {
+namespace fulltextsearch {
QHelpSearchIndexReader::QHelpSearchIndexReader()
: QThread()
@@ -100,7 +99,6 @@ QList<QHelpSearchEngine::SearchHit> QHelpSearchIndexReader::hits(int start,
}
- } // namespace fulltextsearch
-} // namespace qt
+} // namespace fulltextsearch
QT_END_NAMESPACE
diff --git a/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp b/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp
index b5bec44..b050361 100644
--- a/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp
+++ b/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp
@@ -55,9 +55,8 @@
QT_BEGIN_NAMESPACE
-namespace qt {
- namespace fulltextsearch {
- namespace clucene {
+namespace fulltextsearch {
+namespace clucene {
QHelpSearchIndexReaderClucene::QHelpSearchIndexReaderClucene()
: QHelpSearchIndexReader()
@@ -387,8 +386,7 @@ void QHelpSearchIndexReaderClucene::boostSearchHits(const QHelpEngineCore &engin
}
}
- } // namespace clucene
- } // namespace fulltextsearch
-} // namespace qt
+} // namespace clucene
+} // namespace fulltextsearch
QT_END_NAMESPACE
diff --git a/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h b/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h
index 3e3b9dd..8f51cb1 100644
--- a/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h
+++ b/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h
@@ -60,9 +60,8 @@
QT_BEGIN_NAMESPACE
-namespace qt {
- namespace fulltextsearch {
- namespace clucene {
+namespace fulltextsearch {
+namespace clucene {
class QHelpSearchIndexReaderClucene : public QHelpSearchIndexReader
{
@@ -84,9 +83,8 @@ private:
const QList<QHelpSearchQuery> &queryList);
};
- } // namespace clucene
- } // namespace fulltextsearch
-} // namespace qt
+} // namespace clucene
+} // namespace fulltextsearch
QT_END_NAMESPACE
diff --git a/tools/assistant/lib/qhelpsearchindexreader_default.cpp b/tools/assistant/lib/qhelpsearchindexreader_default.cpp
index d2241a5..11a50d9 100644
--- a/tools/assistant/lib/qhelpsearchindexreader_default.cpp
+++ b/tools/assistant/lib/qhelpsearchindexreader_default.cpp
@@ -52,9 +52,8 @@
QT_BEGIN_NAMESPACE
-namespace qt {
- namespace fulltextsearch {
- namespace std {
+namespace fulltextsearch {
+namespace std {
namespace {
QStringList split( const QString &str )
@@ -607,8 +606,7 @@ void QHelpSearchIndexReaderDefault::run()
emit searchingFinished(hitList.count());
}
- } // namespace std
- } // namespace fulltextsearch
-} // namespace qt
+} // namespace std
+} // namespace fulltextsearch
QT_END_NAMESPACE
diff --git a/tools/assistant/lib/qhelpsearchindexreader_default_p.h b/tools/assistant/lib/qhelpsearchindexreader_default_p.h
index 8c80608..b30fa4b 100644
--- a/tools/assistant/lib/qhelpsearchindexreader_default_p.h
+++ b/tools/assistant/lib/qhelpsearchindexreader_default_p.h
@@ -64,9 +64,8 @@ QT_BEGIN_NAMESPACE
struct Entry;
struct PosEntry;
-namespace qt {
- namespace fulltextsearch {
- namespace std {
+namespace fulltextsearch {
+namespace std {
class Reader
{
@@ -127,9 +126,8 @@ private:
Reader m_reader;
};
- } // namespace std
- } // namespace fulltextsearch
-} // namespace qt
+} // namespace std
+} // namespace fulltextsearch
QT_END_NAMESPACE
diff --git a/tools/assistant/lib/qhelpsearchindexreader_p.h b/tools/assistant/lib/qhelpsearchindexreader_p.h
index b309f46..4d27c0f 100644
--- a/tools/assistant/lib/qhelpsearchindexreader_p.h
+++ b/tools/assistant/lib/qhelpsearchindexreader_p.h
@@ -66,8 +66,7 @@ QT_BEGIN_NAMESPACE
class QHelpEngineCore;
-namespace qt {
- namespace fulltextsearch {
+namespace fulltextsearch {
class QHelpSearchIndexReader : public QThread
{
@@ -100,8 +99,7 @@ private:
virtual void run()=0;
};
- } // namespace fulltextsearch
-} // namespace qt
+} // namespace fulltextsearch
QT_END_NAMESPACE
diff --git a/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp b/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp
index e3cc2b0..59067cf 100644
--- a/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp
+++ b/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp
@@ -63,9 +63,8 @@
QT_BEGIN_NAMESPACE
-namespace qt {
- namespace fulltextsearch {
- namespace clucene {
+namespace fulltextsearch {
+namespace clucene {
// taken from qtexthtmlparser
static const struct QTextHtmlEntity
@@ -613,67 +612,69 @@ void QHelpSearchIndexWriter::optimizeIndex()
void QHelpSearchIndexWriter::run()
{
- QMutexLocker mutexLocker(&mutex);
+#if !defined(QT_NO_EXCEPTIONS)
+ try {
+#endif
+ QMutexLocker mutexLocker(&mutex);
- if (m_cancel)
- return;
+ if (m_cancel)
+ return;
- const bool reindex = this->m_reindex;
- const QString collectionFile(this->m_collectionFile);
+ const bool reindex = this->m_reindex;
+ const QString collectionFile(this->m_collectionFile);
- mutexLocker.unlock();
+ mutexLocker.unlock();
- QHelpEngineCore engine(collectionFile, 0);
- if (!engine.setupData())
- return;
+ QHelpEngineCore engine(collectionFile, 0);
+ if (!engine.setupData())
+ return;
- const QLatin1String key("CluceneIndexedNamespaces");
- if (reindex)
- engine.setCustomValue(key, QLatin1String(""));
-
- QMap<QString, QDateTime> indexMap;
- const QLatin1String oldKey("CluceneSearchNamespaces");
- if (!engine.customValue(oldKey, QString()).isNull()) {
- // old style qhc file < 4.4.2, need to convert...
- const QStringList indexedNamespaces = engine.customValue(oldKey).
- toString().split(QLatin1String("|"), QString::SkipEmptyParts);
- foreach (const QString &nameSpace, indexedNamespaces)
- indexMap.insert(nameSpace, QDateTime());
- engine.removeCustomValue(oldKey);
- } else {
- QDataStream dataStream(engine.customValue(key).toByteArray());
- dataStream >> indexMap;
- }
+ const QLatin1String key("CluceneIndexedNamespaces");
+ if (reindex)
+ engine.setCustomValue(key, QLatin1String(""));
+
+ QMap<QString, QDateTime> indexMap;
+ const QLatin1String oldKey("CluceneSearchNamespaces");
+ if (!engine.customValue(oldKey, QString()).isNull()) {
+ // old style qhc file < 4.4.2, need to convert...
+ const QStringList indexedNamespaces
+ = engine.customValue(oldKey).toString()
+ .split(QLatin1String("|"), QString::SkipEmptyParts);
+ foreach (const QString &nameSpace, indexedNamespaces)
+ indexMap.insert(nameSpace, QDateTime());
+ engine.removeCustomValue(oldKey);
+ } else {
+ QDataStream dataStream(engine.customValue(key).toByteArray());
+ dataStream >> indexMap;
+ }
- QString indexPath = m_indexFilesFolder;
+ QString indexPath = m_indexFilesFolder;
- QFileInfo fInfo(indexPath);
- if (fInfo.exists() && !fInfo.isWritable()) {
- qWarning("Full Text Search, could not create index (missing permissions for '%s').", qPrintable(indexPath));
- return;
- }
+ QFileInfo fInfo(indexPath);
+ if (fInfo.exists() && !fInfo.isWritable()) {
+ qWarning("Full Text Search, could not create index (missing permissions for '%s').",
+ qPrintable(indexPath));
+ return;
+ }
- emit indexingStarted();
+ emit indexingStarted();
- QCLuceneIndexWriter *writer = 0;
- QCLuceneStandardAnalyzer analyzer;
- const QStringList registeredDocs = engine.registeredDocumentations();
+ QCLuceneIndexWriter *writer = 0;
+ QCLuceneStandardAnalyzer analyzer;
+ const QStringList registeredDocs = engine.registeredDocumentations();
- QLocalSocket localSocket;
- localSocket.connectToServer(QString(QLatin1String("QtAssistant%1"))
- .arg(QLatin1String(QT_VERSION_STR)));
+ QLocalSocket localSocket;
+ localSocket.connectToServer(QString(QLatin1String("QtAssistant%1"))
+ .arg(QLatin1String(QT_VERSION_STR)));
- QLocalServer localServer;
- bool otherInstancesRunning = true;
- if (!localSocket.waitForConnected()) {
- otherInstancesRunning = false;
- localServer.listen(QString(QLatin1String("QtAssistant%1"))
- .arg(QLatin1String(QT_VERSION_STR)));
- }
+ QLocalServer localServer;
+ bool otherInstancesRunning = true;
+ if (!localSocket.waitForConnected()) {
+ otherInstancesRunning = false;
+ localServer.listen(QString(QLatin1String("QtAssistant%1"))
+ .arg(QLatin1String(QT_VERSION_STR)));
+ }
-#if !defined(QT_NO_EXCEPTIONS)
- try {
-#endif
// check if it's locked, and if the other instance is running
if (!otherInstancesRunning && QCLuceneIndexReader::isLocked(indexPath))
QCLuceneIndexReader::unlock(indexPath);
@@ -705,7 +706,8 @@ void QHelpSearchIndexWriter::run()
removeDocuments(indexPath, namespaceName);
} else {
QString path = engine.documentationFileName(namespaceName);
- if (indexMap.value(namespaceName) < QFileInfo(path).lastModified()) {
+ if (indexMap.value(namespaceName)
+ < QFileInfo(path).lastModified()) {
// make sure we remove some outdated indexed stuff
indexMap.remove(namespaceName);
removeDocuments(indexPath, namespaceName);
@@ -728,94 +730,85 @@ void QHelpSearchIndexWriter::run()
indexMap.clear();
writer = new QCLuceneIndexWriter(indexPath, analyzer, true);
}
-#if !defined(QT_NO_EXCEPTIONS)
- } catch (...) {
- qWarning("Full Text Search, could not create index writer in '%s'.",
- qPrintable(indexPath));
- return;
- }
-#endif
-#if !defined(QT_NO_EXCEPTIONS)
- try {
-#endif
writer->setMergeFactor(100);
writer->setMinMergeDocs(1000);
writer->setMaxFieldLength(QCLuceneIndexWriter::DEFAULT_MAX_FIELD_LENGTH);
-#if !defined(QT_NO_EXCEPTIONS)
- } catch (...) {
- qWarning("Full Text Search, could not set writer properties.");
- return;
- }
-#endif
- QStringList namespaces;
- foreach(const QString &namespaceName, registeredDocs) {
- mutexLocker.relock();
- if (m_cancel) {
- closeIndexWriter(writer);
- emit indexingFinished();
- return;
- }
- mutexLocker.unlock();
+ QStringList namespaces;
+ foreach(const QString &namespaceName, registeredDocs) {
+ mutexLocker.relock();
+ if (m_cancel) {
+ closeIndexWriter(writer);
+ emit indexingFinished();
+ return;
+ }
+ mutexLocker.unlock();
- namespaces.append(namespaceName);
- if (indexMap.contains(namespaceName))
- continue;
+ namespaces.append(namespaceName);
+ if (indexMap.contains(namespaceName))
+ continue;
- const QList<QStringList> attributeSets =
- engine.filterAttributeSets(namespaceName);
+ const QList<QStringList> attributeSets =
+ engine.filterAttributeSets(namespaceName);
- if (attributeSets.isEmpty()) {
- const QList<QUrl> docFiles = indexableFiles(&engine, namespaceName,
- QStringList());
- if (!addDocuments(docFiles, engine, QStringList(), namespaceName,
- writer, analyzer))
- break;
- } else {
- bool bail = false;
- foreach (const QStringList &attributes, attributeSets) {
- const QList<QUrl> docFiles = indexableFiles(&engine,
- namespaceName, attributes);
- if (!addDocuments(docFiles, engine, attributes, namespaceName,
- writer, analyzer)) {
- bail = true;
+ if (attributeSets.isEmpty()) {
+ const QList<QUrl> docFiles = indexableFiles(&engine, namespaceName,
+ QStringList());
+ if (!addDocuments(docFiles, engine, QStringList(), namespaceName,
+ writer, analyzer))
break;
+ } else {
+ bool bail = false;
+ foreach (const QStringList &attributes, attributeSets) {
+ const QList<QUrl> docFiles = indexableFiles(&engine,
+ namespaceName, attributes);
+ if (!addDocuments(docFiles, engine, attributes, namespaceName,
+ writer, analyzer)) {
+ bail = true;
+ break;
+ }
}
+ if (bail)
+ break;
}
- if (bail)
- break;
- }
- mutexLocker.relock();
- if (!m_cancel) {
- QString path(engine.documentationFileName(namespaceName));
- indexMap.insert(namespaceName, QFileInfo(path).lastModified());
- writeIndexMap(engine, indexMap);
+ mutexLocker.relock();
+ if (!m_cancel) {
+ QString path(engine.documentationFileName(namespaceName));
+ indexMap.insert(namespaceName, QFileInfo(path).lastModified());
+ writeIndexMap(engine, indexMap);
+ }
+ mutexLocker.unlock();
}
- mutexLocker.unlock();
- }
- closeIndexWriter(writer);
+ closeIndexWriter(writer);
- mutexLocker.relock();
- if (!m_cancel) {
- mutexLocker.unlock();
-
- QStringList indexedNamespaces = indexMap.keys();
- foreach(const QString &namespaceName, indexedNamespaces) {
- mutexLocker.relock();
- if (m_cancel)
- break;
+ mutexLocker.relock();
+ if (!m_cancel) {
mutexLocker.unlock();
- if (!namespaces.contains(namespaceName)) {
- indexMap.remove(namespaceName);
- writeIndexMap(engine, indexMap);
- removeDocuments(indexPath, namespaceName);
+ QStringList indexedNamespaces = indexMap.keys();
+ foreach(const QString &namespaceName, indexedNamespaces) {
+ mutexLocker.relock();
+ if (m_cancel)
+ break;
+ mutexLocker.unlock();
+
+ if (!namespaces.contains(namespaceName)) {
+ indexMap.remove(namespaceName);
+ writeIndexMap(engine, indexMap);
+ removeDocuments(indexPath, namespaceName);
+ }
}
}
+
+#if !defined(QT_NO_EXCEPTIONS)
+ } catch (...) {
+ qWarning("%s: Failed because of CLucene exception.", Q_FUNC_INFO);
}
+#endif
+
emit indexingFinished();
}
@@ -901,8 +894,7 @@ void QHelpSearchIndexWriter::closeIndexWriter(QCLuceneIndexWriter *writer)
#endif
}
- } // namespace clucene
- } // namespace fulltextsearch
-} // namespace qt
+} // namespace clucene
+} // namespace fulltextsearch
QT_END_NAMESPACE
diff --git a/tools/assistant/lib/qhelpsearchindexwriter_clucene_p.h b/tools/assistant/lib/qhelpsearchindexwriter_clucene_p.h
index 91b8abd..db1e533 100644
--- a/tools/assistant/lib/qhelpsearchindexwriter_clucene_p.h
+++ b/tools/assistant/lib/qhelpsearchindexwriter_clucene_p.h
@@ -69,9 +69,8 @@ QT_BEGIN_NAMESPACE
class QCLuceneIndexWriter;
-namespace qt {
- namespace fulltextsearch {
- namespace clucene {
+namespace fulltextsearch {
+namespace clucene {
class QHelpSearchIndexWriter : public QThread
{
@@ -116,9 +115,9 @@ private:
QString m_indexFilesFolder;
};
- } // namespace clucene
- } // namespace fulltextsearch
} // namespace clucene
+} // namespace fulltextsearch
+
QT_END_NAMESPACE
diff --git a/tools/assistant/lib/qhelpsearchindexwriter_default.cpp b/tools/assistant/lib/qhelpsearchindexwriter_default.cpp
index 6d09fb8..cb3e49c 100644
--- a/tools/assistant/lib/qhelpsearchindexwriter_default.cpp
+++ b/tools/assistant/lib/qhelpsearchindexwriter_default.cpp
@@ -55,9 +55,8 @@
QT_BEGIN_NAMESPACE
-namespace qt {
- namespace fulltextsearch {
- namespace std {
+namespace fulltextsearch {
+namespace std {
Writer::Writer(const QString &path)
: indexPath(path)
@@ -379,8 +378,7 @@ QString QHelpSearchIndexWriter::removeNamespace(const QString namespaces,
return value;
}
- } // namespace std
- } // namespace fulltextsearch
-} // namespace qt
+} // namespace std
+} // namespace fulltextsearch
QT_END_NAMESPACE
diff --git a/tools/assistant/lib/qhelpsearchindexwriter_default_p.h b/tools/assistant/lib/qhelpsearchindexwriter_default_p.h
index b222203..625cb84 100644
--- a/tools/assistant/lib/qhelpsearchindexwriter_default_p.h
+++ b/tools/assistant/lib/qhelpsearchindexwriter_default_p.h
@@ -65,9 +65,8 @@
QT_BEGIN_NAMESPACE
-namespace qt {
- namespace fulltextsearch {
- namespace std {
+namespace fulltextsearch {
+namespace std {
class Writer
{
@@ -123,9 +122,8 @@ private:
QString m_indexFilesFolder;
};
- } // namespace std
- } // namespace fulltextsearch
-} // namespace qt
+} // namespace std
+} // namespace fulltextsearch
QT_END_NAMESPACE
diff --git a/tools/assistant/tools/assistant/helpviewer.cpp b/tools/assistant/tools/assistant/helpviewer.cpp
index be6245a..f22ab8a 100644
--- a/tools/assistant/tools/assistant/helpviewer.cpp
+++ b/tools/assistant/tools/assistant/helpviewer.cpp
@@ -151,8 +151,9 @@ QNetworkReply *HelpNetworkAccessManager::createRequest(Operation /*op*/,
mimeType = QLatin1String("text/html");
}
- const QByteArray &ba = helpEngine->fileData(url);
- return new HelpNetworkReply(request, ba.isEmpty() ? " " : ba, mimeType);
+ const QByteArray &data = helpEngine->findFile(url).isValid()
+ ? helpEngine->fileData(url) : QByteArray("File not found!");
+ return new HelpNetworkReply(request, data, mimeType);
}
class HelpPage : public QWebPage
diff --git a/tools/configure/configure.pro b/tools/configure/configure.pro
index 243183c..91de7c2 100644
--- a/tools/configure/configure.pro
+++ b/tools/configure/configure.pro
@@ -3,8 +3,8 @@ DESTDIR = ../..
CONFIG += console flat
CONFIG -= moc qt
-DEFINES = UNICODE QT_NODLL QT_NO_CODECS QT_NO_TEXTCODEC QT_NO_UNICODETABLES QT_LITE_COMPONENT QT_NO_STL QT_NO_COMPRESS QT_BUILD_QMAKE QT_NO_THREAD QT_NO_QOBJECT _CRT_SECURE_NO_DEPRECATE
-
+DEFINES = UNICODE QT_NODLL QT_NO_CODECS QT_NO_TEXTCODEC QT_NO_UNICODETABLES QT_LITE_COMPONENT QT_NO_STL QT_NO_COMPRESS QT_NO_THREAD QT_NO_QOBJECT _CRT_SECURE_NO_DEPRECATE
+DEFINES += QT_BOOTSTRAPPED
win32 : LIBS += -lole32 -ladvapi32
win32-msvc.net | win32-msvc2* : QMAKE_CXXFLAGS += /EHsc
@@ -27,6 +27,7 @@ INCPATH += $$QT_SOURCE_TREE/src/corelib/arch/generic \
$$QT_SOURCE_TREE/src/corelib/global \
$$QT_BUILD_TREE/include \
$$QT_BUILD_TREE/include/QtCore \
+ $$QT_BUILD_TREE/tools/shared
HEADERS = configureapp.h environment.h tools.h\
$$QT_SOURCE_TREE/src/corelib/tools/qbytearray.h \
@@ -58,7 +59,11 @@ HEADERS = configureapp.h environment.h tools.h\
$$QT_SOURCE_TREE/src/corelib/tools/qstring.h \
$$QT_SOURCE_TREE/src/corelib/tools/qstringlist.h \
$$QT_SOURCE_TREE/src/corelib/tools/qstringmatcher.h \
- $$QT_SOURCE_TREE/src/corelib/tools/qunicodetables_p.h
+ $$QT_SOURCE_TREE/src/corelib/tools/qunicodetables_p.h \
+ $$QT_SOURCE_TREE/src/corelib/xml/qxmlstream.h \
+ $$QT_SOURCE_TREE/src/corelib/xml/qxmlutils_p.h \
+ $$QT_SOURCE_TREE/tools/shared/symbian/epocroot.h \
+ $$QT_SOURCE_TREE/tools/shared/windows/registry.h
SOURCES = main.cpp configureapp.cpp environment.cpp tools.cpp \
@@ -102,7 +107,11 @@ SOURCES = main.cpp configureapp.cpp environment.cpp tools.cpp \
$$QT_SOURCE_TREE/src/corelib/tools/qpoint.cpp \
$$QT_SOURCE_TREE/src/corelib/tools/qrect.cpp \
$$QT_SOURCE_TREE/src/corelib/kernel/qmetatype.cpp \
- $$QT_SOURCE_TREE/src/corelib/global/qmalloc.cpp
+ $$QT_SOURCE_TREE/src/corelib/global/qmalloc.cpp \
+ $$QT_SOURCE_TREE/src/corelib/xml/qxmlstream.cpp \
+ $$QT_SOURCE_TREE/src/corelib/xml/qxmlutils.cpp \
+ $$QT_SOURCE_TREE/tools/shared/symbian/epocroot.cpp \
+ $$QT_SOURCE_TREE/tools/shared/windows/registry.cpp
win32:SOURCES += $$QT_SOURCE_TREE/src/corelib/io/qfsfileengine_win.cpp
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index 9e0cb70..d521276 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -247,7 +247,7 @@ Configure::Configure( int& argc, char** argv )
dictionary[ "PHONON" ] = "auto";
dictionary[ "PHONON_BACKEND" ] = "yes";
dictionary[ "MULTIMEDIA" ] = "yes";
- dictionary[ "AUDIO_BACKEND" ] = "yes";
+ dictionary[ "AUDIO_BACKEND" ] = "auto";
dictionary[ "DIRECTSHOW" ] = "no";
dictionary[ "WEBKIT" ] = "auto";
dictionary[ "DECLARATIVE" ] = "auto";
@@ -2065,6 +2065,52 @@ bool Configure::checkAvailability(const QString &part)
available = (dictionary.value("QMAKESPEC") == "win32-msvc2005") || (dictionary.value("QMAKESPEC") == "win32-msvc2008") || (dictionary.value("QMAKESPEC") == "win32-g++");
} else if (part == "DECLARATIVE") {
available = QFile::exists(sourcePath + "/src/declarative/qml/qmlcomponent.h");
+ } else if (part == "AUDIO_BACKEND") {
+ available = true;
+ if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian")) {
+ QString epocRoot = Environment::symbianEpocRoot();
+ const QDir epocRootDir(epocRoot);
+ if (epocRootDir.exists()) {
+ QStringList paths;
+ paths << "epoc32/release/armv5/lib/mmfdevsound.dso"
+ << "epoc32/release/armv5/lib/mmfdevsound.lib"
+ << "epoc32/release/winscw/udeb/mmfdevsound.dll"
+ << "epoc32/release/winscw/udeb/mmfdevsound.lib"
+ << "epoc32/include/mmf/server/sounddevice.h";
+
+ QStringList::iterator i = paths.begin();
+ while (i != paths.end()) {
+ const QString &path = epocRoot + *i;
+ if (QFile::exists(path))
+ i = paths.erase(i);
+ else
+ ++i;
+ }
+
+ available = (paths.size() == 0);
+ if (!available) {
+ if (epocRoot.isNull() || epocRoot == "")
+ epocRoot = "<empty string>";
+ cout << endl
+ << "The QtMultimedia audio backend will not be built because required" << endl
+ << "support for CMMFDevSound was not found in the SDK." << endl
+ << "The SDK which was examined was located at the following path:" << endl
+ << " " << epocRoot << endl
+ << "The following required files were missing from the SDK:" << endl;
+ QString path;
+ foreach (path, paths)
+ cout << " " << path << endl;
+ cout << endl;
+ }
+ } else {
+ cout << endl
+ << "The SDK root was determined to be '" << epocRoot << "'." << endl
+ << "This directory was not found, so the SDK could not be checked for" << endl
+ << "CMMFDevSound support. The QtMultimedia audio backend will therefore" << endl
+ << "not be built." << endl << endl;
+ available = false;
+ }
+ }
}
return available;
@@ -2153,6 +2199,8 @@ void Configure::autoDetection()
dictionary["WEBKIT"] = checkAvailability("WEBKIT") ? "yes" : "no";
if (dictionary["DECLARATIVE"] == "auto")
dictionary["DECLARATIVE"] = checkAvailability("DECLARATIVE") ? "yes" : "no";
+ if (dictionary["AUDIO_BACKEND"] == "auto")
+ dictionary["AUDIO_BACKEND"] = checkAvailability("AUDIO_BACKEND") ? "yes" : "no";
// Qt/WinCE remote test application
if (dictionary["CETEST"] == "auto")
diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp
index af6f9e5..e93f9a0 100644
--- a/tools/configure/environment.cpp
+++ b/tools/configure/environment.cpp
@@ -60,6 +60,8 @@ using namespace std;
#include <qt_windows.h>
#endif
+#include <symbian/epocroot.h> // from tools/shared
+#include <windows/registry.h> // from tools/shared
QT_BEGIN_NAMESPACE
@@ -97,126 +99,6 @@ CompilerInfo *Environment::compilerInfo(Compiler compiler)
}
/*!
- Returns the path part of a registry key.
- Ei.
- For a key
- "Software\\Microsoft\\VisualStudio\\8.0\\Setup\\VC\\ProductDir"
- it returns
- "Software\\Microsoft\\VisualStudio\\8.0\\Setup\\VC\\"
-*/
-QString Environment::keyPath(const QString &rKey)
-{
- int idx = rKey.lastIndexOf(QLatin1Char('\\'));
- if (idx == -1)
- return QString();
- return rKey.left(idx + 1);
-}
-
-/*!
- Returns the name part of a registry key.
- Ei.
- For a key
- "Software\\Microsoft\\VisualStudio\\8.0\\Setup\\VC\\ProductDir"
- it returns
- "ProductDir"
-*/
-QString Environment::keyName(const QString &rKey)
-{
- int idx = rKey.lastIndexOf(QLatin1Char('\\'));
- if (idx == -1)
- return rKey;
-
- QString res(rKey.mid(idx + 1));
- if (res == "Default" || res == ".")
- res = "";
- return res;
-}
-
-/*!
- Returns a registry keys value in string form.
- If the registry key does not exist, or cannot be accessed, a
- QString() is returned.
-*/
-QString Environment::readRegistryKey(HKEY parentHandle, const QString &rSubkey)
-{
-#ifndef Q_OS_WIN32
- return QString();
-#else
- QString rSubkeyName = keyName(rSubkey);
- QString rSubkeyPath = keyPath(rSubkey);
-
- HKEY handle = 0;
- LONG res = RegOpenKeyEx(parentHandle, (wchar_t*)rSubkeyPath.utf16(), 0, KEY_READ, &handle);
- if (res != ERROR_SUCCESS)
- return QString();
-
- // get the size and type of the value
- DWORD dataType;
- DWORD dataSize;
- res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, &dataType, 0, &dataSize);
- if (res != ERROR_SUCCESS) {
- RegCloseKey(handle);
- return QString();
- }
-
- // get the value
- QByteArray data(dataSize, 0);
- res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, 0,
- reinterpret_cast<unsigned char*>(data.data()), &dataSize);
- if (res != ERROR_SUCCESS) {
- RegCloseKey(handle);
- return QString();
- }
-
- QString result;
- switch (dataType) {
- case REG_EXPAND_SZ:
- case REG_SZ: {
- result = QString::fromWCharArray(((const wchar_t *)data.constData()));
- break;
- }
-
- case REG_MULTI_SZ: {
- QStringList l;
- int i = 0;
- for (;;) {
- QString s = QString::fromWCharArray((const wchar_t *)data.constData() + i);
- i += s.length() + 1;
-
- if (s.isEmpty())
- break;
- l.append(s);
- }
- result = l.join(", ");
- break;
- }
-
- case REG_NONE:
- case REG_BINARY: {
- result = QString::fromWCharArray((const wchar_t *)data.constData(), data.size() / 2);
- break;
- }
-
- case REG_DWORD_BIG_ENDIAN:
- case REG_DWORD: {
- Q_ASSERT(data.size() == sizeof(int));
- int i;
- memcpy((char*)&i, data.constData(), sizeof(int));
- result = QString::number(i);
- break;
- }
-
- default:
- qWarning("QSettings: unknown data %d type in windows registry", dataType);
- break;
- }
-
- RegCloseKey(handle);
- return result;
-#endif
-}
-
-/*!
Returns the qmakespec for the compiler detected on the system.
*/
QString Environment::detectQMakeSpec()
@@ -579,4 +461,10 @@ bool Environment::rmdir(const QString &name)
return result;
}
+QString Environment::symbianEpocRoot()
+{
+ // Call function defined in tools/shared/symbian/epocroot.h
+ return ::epocRoot();
+}
+
QT_END_NAMESPACE
diff --git a/tools/configure/environment.h b/tools/configure/environment.h
index 2d0eafd..b1cbe3a 100644
--- a/tools/configure/environment.h
+++ b/tools/configure/environment.h
@@ -71,13 +71,12 @@ public:
static bool cpdir(const QString &srcDir, const QString &destDir);
static bool rmdir(const QString &name);
+ static QString symbianEpocRoot();
+
private:
static Compiler detectedCompiler;
static CompilerInfo *compilerInfo(Compiler compiler);
- static QString keyPath(const QString &rKey);
- static QString keyName(const QString &rKey);
- static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey);
};
diff --git a/tools/configure/tools.cpp b/tools/configure/tools.cpp
index aea2713..c4625af 100644
--- a/tools/configure/tools.cpp
+++ b/tools/configure/tools.cpp
@@ -146,6 +146,7 @@ void Tools::checkLicense(QMap<QString,QString> &dictionary, QMap<QString,QString
if (products == 'B') {
dictionary["EDITION"] = "Evaluation";
dictionary["QT_EDITION"] = "QT_EDITION_EVALUATION";
+ licenseType = "Evaluation";
}
}
@@ -212,7 +213,7 @@ void Tools::checkLicense(QMap<QString,QString> &dictionary, QMap<QString,QString
}
// Override for evaluation licenses
- if (dictionary["Edition"] == "Evaluation")
+ if (dictionary["EDITION"] == "Evaluation")
dictionary["LICENSE_EXTENSION"] = "-EVALUATION";
if (QFile::exists(dictionary["QT_SOURCE_TREE"] + "/.LICENSE")) {
diff --git a/tools/qtestlib/wince/cetest/activesyncconnection.cpp b/tools/qtestlib/wince/cetest/activesyncconnection.cpp
index 56fb173..98062ed 100644
--- a/tools/qtestlib/wince/cetest/activesyncconnection.cpp
+++ b/tools/qtestlib/wince/cetest/activesyncconnection.cpp
@@ -443,6 +443,145 @@ bool ActiveSyncConnection::execute(QString program, QString arguments, int timeo
return result;
}
+bool ActiveSyncConnection::setDeviceAwake(bool activate, int *returnValue)
+{
+ if (!isConnected()) {
+ qWarning("Cannot execute, connect to device first!");
+ return false;
+ }
+ bool result = false;
+
+ // If we want to wait, we have to use CeRapiInvoke, as CeCreateProcess has no way to wait
+ // until the process ends. The lib must have been build and also deployed already.
+ if (!isConnected() && !connect())
+ return false;
+
+ HRESULT res = S_OK;
+
+ //SYSTEM_POWER_STATUS_EX systemPowerState;
+
+ //res = CeGetSystemPowerStatusEx(&systemPowerState, true);
+
+ QString dllLocation = "\\Windows\\QtRemote.dll";
+ QString functionName = "qRemoteToggleUnattendedPowerMode";
+
+ DWORD outputSize;
+ BYTE* output;
+ IRAPIStream *stream;
+ int returned = 0;
+ int toggle = int(activate);
+
+ res = CeRapiInvoke(dllLocation.utf16(), functionName.utf16(), 0, 0, &outputSize, &output, &stream, 0);
+ if (S_OK != res) {
+ DWORD ce_error = CeGetLastError();
+ if (S_OK != ce_error) {
+ qWarning("Error invoking %s on %s: %s", qPrintable(functionName),
+ qPrintable(dllLocation), strwinerror(ce_error).constData());
+ } else {
+ qWarning("Error: %s on %s unexpectedly returned %d", qPrintable(functionName),
+ qPrintable(dllLocation), res);
+ }
+ } else {
+ DWORD written;
+
+ if (S_OK != stream->Write(&toggle, sizeof(toggle), &written)) {
+ qWarning(" Could not write toggle option to process");
+ return false;
+ }
+
+ if (S_OK != stream->Read(&returned, sizeof(returned), &written)) {
+ qWarning(" Could not access return value of process");
+ }
+ else
+ result = true;
+ }
+
+ if (returnValue)
+ *returnValue = returned;
+
+ return result;
+}
+
+bool ActiveSyncConnection::resetDevice()
+{
+ if (!isConnected()) {
+ qWarning("Cannot execute, connect to device first!");
+ return false;
+ }
+
+ bool result = false;
+ if (!isConnected() && !connect())
+ return false;
+
+ QString dllLocation = "\\Windows\\QtRemote.dll";
+ QString functionName = "qRemoteSoftReset";
+
+ DWORD outputSize;
+ BYTE* output;
+ IRAPIStream *stream;
+
+ int returned = 0;
+
+ HRESULT res = CeRapiInvoke(dllLocation.utf16(), functionName.utf16(), 0, 0, &outputSize, &output, &stream, 0);
+ if (S_OK != res) {
+ DWORD ce_error = CeGetLastError();
+ if (S_OK != ce_error) {
+ qWarning("Error invoking %s on %s: %s", qPrintable(functionName),
+ qPrintable(dllLocation), strwinerror(ce_error).constData());
+ } else {
+ qWarning("Error: %s on %s unexpectedly returned %d", qPrintable(functionName),
+ qPrintable(dllLocation), res);
+ }
+ } else {
+ result = true;
+ }
+ return result;
+}
+
+bool ActiveSyncConnection::toggleDevicePower(int *returnValue)
+{
+ if (!isConnected()) {
+ qWarning("Cannot execute, connect to device first!");
+ return false;
+ }
+
+ bool result = false;
+ if (!isConnected() && !connect())
+ return false;
+
+ QString dllLocation = "\\Windows\\QtRemote.dll";
+ QString functionName = "qRemotePowerButton";
+
+ DWORD outputSize;
+ BYTE* output;
+ IRAPIStream *stream;
+ int returned = 0;
+
+ HRESULT res = CeRapiInvoke(dllLocation.utf16(), functionName.utf16(), 0, 0, &outputSize, &output, &stream, 0);
+ if (S_OK != res) {
+ DWORD ce_error = CeGetLastError();
+ if (S_OK != ce_error) {
+ qWarning("Error invoking %s on %s: %s", qPrintable(functionName),
+ qPrintable(dllLocation), strwinerror(ce_error).constData());
+ } else {
+ qWarning("Error: %s on %s unexpectedly returned %d", qPrintable(functionName),
+ qPrintable(dllLocation), res);
+ }
+ } else {
+ DWORD written;
+ if (S_OK != stream->Read(&returned, sizeof(returned), &written)) {
+ qWarning(" Could not access return value of process");
+ }
+ else {
+ result = true;
+ }
+ }
+
+ if (returnValue)
+ *returnValue = returned;
+ return result;
+}
+
bool ActiveSyncConnection::createDirectory(const QString &path, bool deleteBefore)
{
if (deleteBefore)
diff --git a/tools/qtestlib/wince/cetest/activesyncconnection.h b/tools/qtestlib/wince/cetest/activesyncconnection.h
index 1891514..4502fc7 100644
--- a/tools/qtestlib/wince/cetest/activesyncconnection.h
+++ b/tools/qtestlib/wince/cetest/activesyncconnection.h
@@ -79,6 +79,9 @@ public:
bool createDirectory(const QString&, bool deleteBefore=false);
bool execute(QString program, QString arguments = QString(), int timeout = -1, int *returnValue = NULL);
+ bool resetDevice();
+ bool toggleDevicePower(int *returnValue = NULL);
+ bool setDeviceAwake(bool activate, int *returnValue = NULL);
private:
bool connected;
};
diff --git a/tools/qtestlib/wince/cetest/main.cpp b/tools/qtestlib/wince/cetest/main.cpp
index 146cc5a..9fe5f02 100644
--- a/tools/qtestlib/wince/cetest/main.cpp
+++ b/tools/qtestlib/wince/cetest/main.cpp
@@ -45,6 +45,9 @@
# include "activesyncconnection.h"
#endif
+const int SLEEP_AFTER_RESET = 60000; // sleep for 1 minute
+const int SLEEP_RECONNECT = 2000; // sleep for 2 seconds before trying another reconnect
+
#include "deployment.h"
#include <option.h>
#include <project.h>
@@ -123,6 +126,8 @@ void usage()
" -debug : Test debug version[default]\n"
" -release : Test release version\n"
" -libpath <path> : Remote path to deploy Qt libraries to\n"
+ " -reset : Reset device before starting a test\n"
+ " -awake : Device does not go sleep mode\n"
" -qt-delete : Delete the Qt libraries after execution\n"
" -project-delete : Delete the project file(s) after execution\n"
" -delete : Delete everything deployed after execution\n"
@@ -152,6 +157,8 @@ int main(int argc, char **argv)
int timeout = -1;
bool cleanupQt = false;
bool cleanupProject = false;
+ bool deviceReset = false;
+ bool keepAwake = false;
for (int i=1; i<arguments.size(); ++i) {
if (arguments.at(i).toLower() == QLatin1String("-help")
@@ -196,6 +203,10 @@ int main(int argc, char **argv)
} else if (arguments.at(i).toLower() == QLatin1String("-delete")) {
cleanupQt = true;
cleanupProject = true;
+ } else if (arguments.at(i).toLower() == QLatin1String("-reset")) {
+ deviceReset = true;
+ } else if (arguments.at(i).toLower() == QLatin1String("-awake")) {
+ keepAwake = true;
} else if (arguments.at(i).toLower() == QLatin1String("-conf")) {
if (++i == arguments.size()) {
cout << "Error: No qt.conf file specified!" << endl;
@@ -353,6 +364,43 @@ int main(int argc, char **argv)
cout << "Error: Could not copy file(s) to device" << endl;
return -1;
}
+ // device power mode
+ if (keepAwake)
+ {
+ int retVal = 0;
+ if (!connection.setDeviceAwake(true, &retVal)) {
+ cout << "Error: Could not set unattended mode on device" << endl;
+ return -1;
+ }
+ }
+
+ // reset device
+ if (deviceReset)
+ {
+ if (!connection.resetDevice()) {
+ //if (!connection.toggleDevicePower( &retVal)) {
+ cout << "Error: Could not reset the device" << endl;
+ return -1;
+ }
+ cout << " Entering sleep after reset for " << SLEEP_AFTER_RESET / 1000 << " seconds ... " << endl;
+ Sleep(SLEEP_AFTER_RESET);
+ cout << " ... woke up. " << endl;
+ connection.disconnect();
+ // reconnect after reset
+ int retryCount = 21;
+ while (--retryCount)
+ {
+ if (!connection.connect())
+ Sleep(SLEEP_RECONNECT);
+ else
+ break;
+ }
+ if (!connection.isConnected())
+ {
+ cout << "Error: Could not connect to device!" << endl;
+ return -1;
+ }
+ }
// launch
launchArguments.append("-o");
diff --git a/tools/qtestlib/wince/remotelib/commands.cpp b/tools/qtestlib/wince/remotelib/commands.cpp
index 4244424..88bf9e6 100644
--- a/tools/qtestlib/wince/remotelib/commands.cpp
+++ b/tools/qtestlib/wince/remotelib/commands.cpp
@@ -39,6 +39,9 @@
**
****************************************************************************/
#include "commands.h"
+#include <Pm.h>
+#include <Pmpolicy.h>
+
#define CLEAN_FAIL(a) {delete appName; \
delete arguments; \
@@ -124,3 +127,86 @@ bool qRemoteExecute(const wchar_t* program, const wchar_t* arguments, int *retur
}
return true;
}
+/**
+\brief Reset the device.
+*/
+int qRemoteSoftReset(DWORD, BYTE*, DWORD*, BYTE**, IRAPIStream* stream)
+{
+ //POWER_STATE_ON On state
+ //POWER_STATE_OFF Off state
+ //POWER_STATE_CRITICAL Critical state
+ //POWER_STATE_BOOT Boot state
+ //POWER_STATE_IDLE Idle state
+ //POWER_STATE_SUSPEND Suspend state
+ //POWER_STATE_RESET Reset state
+
+ DWORD returnValue = SetSystemPowerState(0, POWER_STATE_RESET, POWER_FORCE);
+ return returnValue;
+}
+
+/**
+\brief Toggle the unattended powermode of the device
+*/
+int qRemoteToggleUnattendedPowerMode(DWORD, BYTE*, DWORD*, BYTE**, IRAPIStream* stream)
+{
+ if (!stream)
+ return -1;
+
+ DWORD bytesRead;
+ int toggleVal = 0;
+ int returnValue = S_OK;
+
+ if (S_OK != stream->Read(&toggleVal, sizeof(toggleVal), &bytesRead))
+ return -2;
+
+ //PPN_REEVALUATESTATE 0x0001 Reserved. Set dwData to zero (0).
+ //PPN_POWERCHANGE 0x0002 Reserved. Set dwData to zero (0).
+ //PPN_UNATTENDEDMODE 0x0003 Set dwData to TRUE or FALSE.
+ //PPN_SUSPENDKEYPRESSED or
+ //PPN_POWERBUTTONPRESSED 0x0004 Reserved. Set dwData to zero (0).
+ //PPN_SUSPENDKEYRELEASED 0x0005 Reserved. Set dwData to zero (0).
+ //PPN_APPBUTTONPRESSED 0x0006 Reserved. Set dwData to zero (0).
+ //PPN_OEMBASE Greater than or equal to 0x10000
+ //You can define higher values, such as 0x10001, 0x10002, and so on.
+ // Reserved. Set dwData to zero (0).
+ returnValue = PowerPolicyNotify(PPN_UNATTENDEDMODE, toggleVal);
+
+ if (S_OK != stream->Write(&returnValue, sizeof(returnValue), &bytesRead))
+ return -3;
+ else
+ return S_OK;
+}
+
+/**
+\brief Virtually press the power button of the device
+*/
+int qRemotePowerButton(DWORD, BYTE*, DWORD*, BYTE**, IRAPIStream* stream)
+{
+ if (!stream)
+ return -1;
+
+ DWORD bytesRead;
+ int toggleVal = 0;
+ int returnValue = S_OK;
+
+ if (S_OK != stream->Read(&toggleVal, sizeof(toggleVal), &bytesRead))
+ return -2;
+
+ //PPN_REEVALUATESTATE 0x0001 Reserved. Set dwData to zero (0).
+ //PPN_POWERCHANGE 0x0002 Reserved. Set dwData to zero (0).
+ //PPN_UNATTENDEDMODE 0x0003 Set dwData to TRUE or FALSE.
+ //PPN_SUSPENDKEYPRESSED or
+ //PPN_POWERBUTTONPRESSED 0x0004 Reserved. Set dwData to zero (0).
+ //PPN_SUSPENDKEYRELEASED 0x0005 Reserved. Set dwData to zero (0).
+ //PPN_APPBUTTONPRESSED 0x0006 Reserved. Set dwData to zero (0).
+ //PPN_OEMBASE Greater than or equal to 0x10000
+ //You can define higher values, such as 0x10001, 0x10002, and so on.
+ // Reserved. Set dwData to zero (0).
+ returnValue = PowerPolicyNotify(PPN_POWERBUTTONPRESSED, 0);
+
+ if (S_OK != stream->Write(&returnValue, sizeof(returnValue), &bytesRead))
+ return -3;
+ else
+ return S_OK;
+}
+
diff --git a/tools/qtestlib/wince/remotelib/commands.h b/tools/qtestlib/wince/remotelib/commands.h
index c5cc926..8f202c8 100644
--- a/tools/qtestlib/wince/remotelib/commands.h
+++ b/tools/qtestlib/wince/remotelib/commands.h
@@ -45,6 +45,9 @@
extern "C" {
int __declspec(dllexport) qRemoteLaunch(DWORD, BYTE*, DWORD*, BYTE**, IRAPIStream*);
+ int __declspec(dllexport) qRemoteSoftReset(DWORD, BYTE*, DWORD*, BYTE**, IRAPIStream* stream);
+ int __declspec(dllexport) qRemoteToggleUnattendedPowerMode(DWORD, BYTE*, DWORD*, BYTE**, IRAPIStream* stream);
+ int __declspec(dllexport) qRemotePowerButton(DWORD, BYTE*, DWORD*, BYTE**, IRAPIStream* stream);
bool __declspec(dllexport) qRemoteExecute(const wchar_t* program, const wchar_t* arguments = NULL, int *returnValue = NULL , DWORD* error = NULL, int timeout = -1);
}
diff --git a/tools/shared/symbian/epocroot.cpp b/tools/shared/symbian/epocroot.cpp
new file mode 100644
index 0000000..071477d
--- /dev/null
+++ b/tools/shared/symbian/epocroot.cpp
@@ -0,0 +1,230 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the qmake application 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 <iostream>
+
+#include <QtCore/qdir.h>
+#include <QtCore/qxmlstream.h>
+
+#include "epocroot.h"
+#include "../windows/registry.h"
+
+// Registry key under which the location of the Symbian devices.xml file is
+// stored.
+// Note that, on 64-bit machines, this key is located under the 32-bit
+// compatibility key:
+// HKEY_LOCAL_MACHINE\Software\Wow6432Node
+#define SYMBIAN_SDKS_REG_SUBKEY "Software\\Symbian\\EPOC SDKs\\CommonPath"
+
+#ifdef Q_OS_WIN32
+# define SYMBIAN_SDKS_REG_HANDLE HKEY_LOCAL_MACHINE
+#else
+# define SYMBIAN_SDKS_REG_HANDLE 0
+#endif
+
+// Value which is populated and returned by the epocRoot() function.
+// Stored as a static value in order to avoid unnecessary re-evaluation.
+static QString epocRootValue;
+
+#ifdef QT_BUILD_QMAKE
+std::ostream &operator<<(std::ostream &s, const QString &val) {
+ s << val.toLocal8Bit().data();
+ return s;
+}
+#else
+// Operator implemented in configureapp.cpp
+std::ostream &operator<<(std::ostream &s, const QString &val);
+#endif
+
+QString getDevicesXmlPath()
+ {
+ // Note that the following call will return a null string on platforms other
+ // than Windows. If support is required on other platforms for devices.xml,
+ // an alternative mechanism for retrieving the location of this file will
+ // be required.
+ return readRegistryKey(SYMBIAN_SDKS_REG_HANDLE, SYMBIAN_SDKS_REG_SUBKEY);
+ }
+
+/**
+ * Checks whether epocRootValue points to an existent directory.
+ * If not, epocRootValue is set to an empty string and an error message is printed.
+ */
+void checkEpocRootExists(const QString &source)
+{
+ if (!epocRootValue.isEmpty()) {
+ QDir dir(epocRootValue);
+ if (!dir.exists()) {
+ std::cerr << "Warning: " << source << " is set to an invalid path: " << epocRootValue << std::endl;
+ epocRootValue = QString();
+ }
+ }
+}
+
+/**
+ * Translate path from Windows to Qt format.
+ */
+static void fixEpocRoot(QString &path)
+{
+ path.replace("\\", "/");
+
+ if (path.size() > 1 && path[1] == QChar(':')) {
+ path = path.mid(2);
+ }
+
+ if (!path.size() || path[path.size()-1] != QChar('/')) {
+ path += QChar('/');
+ }
+}
+
+/**
+ * Determine the epoc root for the currently active SDK.
+ */
+QString epocRoot()
+{
+ if (epocRootValue.isEmpty()) {
+ // 1. If environment variable EPOCROOT is set and points to an existent
+ // directory, this is returned.
+ epocRootValue = qgetenv("EPOCROOT");
+ checkEpocRootExists("EPOCROOT");
+
+ if (epocRootValue.isEmpty()) {
+ // 2. The location of devices.xml is specified by a registry key. If this
+ // file exists, it is parsed.
+ QString devicesXmlPath = getDevicesXmlPath();
+ if (devicesXmlPath.isEmpty()) {
+ std::cerr << "Error: Symbian SDK registry key not found" << std::endl;
+ } else {
+ devicesXmlPath += "/devices.xml";
+ QFile devicesFile(devicesXmlPath);
+ if (devicesFile.open(QIODevice::ReadOnly)) {
+
+ // 3. If the EPOCDEVICE environment variable is set and a corresponding
+ // entry is found in devices.xml, and its epocroot value points to an
+ // existent directory, it is returned.
+ // 4. If a device element marked as default is found in devices.xml and its
+ // epocroot value points to an existent directory, this is returned.
+
+ const QString epocDeviceValue = qgetenv("EPOCDEVICE");
+ bool epocDeviceFound = false;
+
+ QXmlStreamReader xml(&devicesFile);
+ while (!xml.atEnd()) {
+ xml.readNext();
+ if (xml.isStartElement() && xml.name() == "devices") {
+ if (xml.attributes().value("version") == "1.0") {
+ while (!(xml.isEndElement() && xml.name() == "devices") && !xml.atEnd()) {
+ xml.readNext();
+ if (xml.isStartElement() && xml.name() == "device") {
+ const bool isDefault = xml.attributes().value("default") == "yes";
+ const QString id = xml.attributes().value("id").toString();
+ const QString name = xml.attributes().value("name").toString();
+ const bool epocDeviceMatch = (id + ":" + name) == epocDeviceValue;
+ epocDeviceFound |= epocDeviceMatch;
+
+ if((epocDeviceValue.isEmpty() && isDefault) || epocDeviceMatch) {
+ // Found a matching device
+ while (!(xml.isEndElement() && xml.name() == "device") && !xml.atEnd()) {
+ xml.readNext();
+ if (xml.isStartElement() && xml.name() == "epocroot") {
+ epocRootValue = xml.readElementText();
+ const QString deviceSource = epocDeviceValue.isEmpty()
+ ? "default device"
+ : "EPOCDEVICE (" + epocDeviceValue + ")";
+ checkEpocRootExists(deviceSource);
+ }
+ }
+
+ if (epocRootValue.isEmpty())
+ xml.raiseError("No epocroot element found");
+ }
+ }
+ }
+ } else {
+ xml.raiseError("Invalid 'devices' element version");
+ }
+ }
+ }
+ if (xml.hasError()) {
+ std::cerr << "Error: \"" << xml.errorString() << "\" when parsing devices.xml" << std::endl;
+ } else {
+ if (epocRootValue.isEmpty()) {
+ if (!epocDeviceValue.isEmpty()) {
+ if (epocDeviceFound) {
+ std::cerr << "Error: missing or invalid epocroot attribute "
+ << "in device '" << epocDeviceValue << "'";
+ } else {
+ std::cerr << "Error: no device matching EPOCDEVICE ("
+ << epocDeviceValue << ")";
+ }
+ } else {
+ if (epocDeviceFound) {
+ std::cerr << "Error: missing or invalid epocroot attribute "
+ << "in default device";
+ } else {
+ std::cerr << "Error: no default device";
+ }
+ }
+ std::cerr << " found in devices.xml file." << std::endl;
+ }
+ }
+ } else {
+ std::cerr << "Error: could not open file " << devicesXmlPath << std::endl;
+ }
+ }
+ }
+
+ if (epocRootValue.isEmpty()) {
+ // 5. An empty string is returned.
+ std::cerr << "Error: failed to find epoc root" << std::endl
+ << "Either" << std::endl
+ << " 1. Set EPOCROOT environment variable to a valid value" << std::endl
+ << " or 2. Ensure that the HKEY_LOCAL_MACHINE\\" SYMBIAN_SDKS_REG_SUBKEY
+ " registry key is set, and then" << std::endl
+ << " a. Set EPOCDEVICE environment variable to a valid device" << std::endl
+ << " or b. Specify a default device in the devices.xml file." << std::endl;
+ } else {
+ fixEpocRoot(epocRootValue);
+ }
+ }
+
+ return epocRootValue;
+}
+
diff --git a/tools/shared/symbian/epocroot.h b/tools/shared/symbian/epocroot.h
new file mode 100644
index 0000000..9846485
--- /dev/null
+++ b/tools/shared/symbian/epocroot.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the qmake application 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 SYMBIAN_EPOCROOT_H
+#define SYMBIAN_EPOCROOT_H
+
+#include <QtCore/qstring.h>
+
+/**
+ * Determine the epoc root for the currently active SDK.
+ *
+ * The algorithm used is as follows:
+ * 1. If environment variable EPOCROOT is set and points to an existent
+ * directory, this is returned.
+ * 2. The location of devices.xml is specified by a registry key. If this
+ * file exists, it is parsed.
+ * 3. If the EPOCDEVICE environment variable is set and a corresponding
+ * entry is found in devices.xml, and its epocroot value points to an
+ * existent directory, it is returned.
+ * 4. If a device element marked as default is found in devices.xml and its
+ * epocroot value points to an existent directory, this is returned.
+ * 5. An empty string is returned.
+ *
+ * Any return value other than the empty string therefore is guaranteed to
+ * point to an existent directory.
+ */
+QString epocRoot();
+
+#endif // EPOCROOT_H
diff --git a/tools/shared/windows/registry.cpp b/tools/shared/windows/registry.cpp
new file mode 100644
index 0000000..d342d78
--- /dev/null
+++ b/tools/shared/windows/registry.cpp
@@ -0,0 +1,161 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the qmake application 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 <QtCore/qstringlist.h>
+#include "registry.h"
+
+/*!
+ Returns the path part of a registry key.
+ e.g.
+ For a key
+ "Software\\Microsoft\\VisualStudio\\8.0\\Setup\\VC\\ProductDir"
+ it returns
+ "Software\\Microsoft\\VisualStudio\\8.0\\Setup\\VC\\"
+*/
+static QString keyPath(const QString &rKey)
+{
+ int idx = rKey.lastIndexOf(QLatin1Char('\\'));
+ if (idx == -1)
+ return QString();
+ return rKey.left(idx + 1);
+}
+
+/*!
+ Returns the name part of a registry key.
+ e.g.
+ For a key
+ "Software\\Microsoft\\VisualStudio\\8.0\\Setup\\VC\\ProductDir"
+ it returns
+ "ProductDir"
+*/
+static QString keyName(const QString &rKey)
+{
+ int idx = rKey.lastIndexOf(QLatin1Char('\\'));
+ if (idx == -1)
+ return rKey;
+
+ QString res(rKey.mid(idx + 1));
+ if (res == "Default" || res == ".")
+ res = "";
+ return res;
+}
+
+QString readRegistryKey(HKEY parentHandle, const QString &rSubkey)
+{
+ QString result;
+
+#ifdef Q_OS_WIN32
+ QString rSubkeyName = keyName(rSubkey);
+ QString rSubkeyPath = keyPath(rSubkey);
+
+ HKEY handle = 0;
+ LONG res = RegOpenKeyEx(parentHandle, (wchar_t*)rSubkeyPath.utf16(), 0, KEY_READ, &handle);
+
+ if (res != ERROR_SUCCESS)
+ return QString();
+
+ // get the size and type of the value
+ DWORD dataType;
+ DWORD dataSize;
+ res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, &dataType, 0, &dataSize);
+ if (res != ERROR_SUCCESS) {
+ RegCloseKey(handle);
+ return QString();
+ }
+
+ // get the value
+ QByteArray data(dataSize, 0);
+ res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, 0,
+ reinterpret_cast<unsigned char*>(data.data()), &dataSize);
+ if (res != ERROR_SUCCESS) {
+ RegCloseKey(handle);
+ return QString();
+ }
+
+ switch (dataType) {
+ case REG_EXPAND_SZ:
+ case REG_SZ: {
+ result = QString::fromWCharArray(((const wchar_t *)data.constData()));
+ break;
+ }
+
+ case REG_MULTI_SZ: {
+ QStringList l;
+ int i = 0;
+ for (;;) {
+ QString s = QString::fromWCharArray((const wchar_t *)data.constData() + i);
+ i += s.length() + 1;
+
+ if (s.isEmpty())
+ break;
+ l.append(s);
+ }
+ result = l.join(", ");
+ break;
+ }
+
+ case REG_NONE:
+ case REG_BINARY: {
+ result = QString::fromWCharArray((const wchar_t *)data.constData(), data.size() / 2);
+ break;
+ }
+
+ case REG_DWORD_BIG_ENDIAN:
+ case REG_DWORD: {
+ Q_ASSERT(data.size() == sizeof(int));
+ int i;
+ memcpy((char*)&i, data.constData(), sizeof(int));
+ result = QString::number(i);
+ break;
+ }
+
+ default:
+ qWarning("QSettings: unknown data %d type in windows registry", dataType);
+ break;
+ }
+
+ RegCloseKey(handle);
+#endif
+
+ return result;
+}
+
+
diff --git a/tools/shared/windows/registry.h b/tools/shared/windows/registry.h
new file mode 100644
index 0000000..3896527
--- /dev/null
+++ b/tools/shared/windows/registry.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the qmake application 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 WINDOWS_REGISTRY_H
+#define WINDOWS_REGISTRY_H
+
+#include <QtCore/qglobal.h>
+
+#ifdef Q_OS_WIN32
+ #include <QtCore/qt_windows.h>
+#else
+ typedef void* HKEY;
+#endif
+
+#include <QtCore/qstring.h>
+
+/**
+ * Read a value from the Windows registry.
+ *
+ * If the key is not found, or the registry cannot be accessed (for example
+ * if this code is compiled for a platform other than Windows), a null
+ * string is returned.
+ */
+QString readRegistryKey(HKEY parentHandle, const QString &rSubkey);
+
+#endif // WINDOWS_REGISTRY_H