summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-08-11 08:45:54 +1000
committerWarwick Allison <warwick.allison@nokia.com>2009-08-11 08:45:54 +1000
commit6bb93ab2fd79ae0a04c826d9027503b644b6e374 (patch)
tree060d9765cf3f009c86fe6e421dac4ea8930d076e
parent40db84c97769141f3f2351de1b2d5c64904fe5c2 (diff)
parent6c3c9d812a730d5bc1bcd6261befe077a65be594 (diff)
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
-rwxr-xr-xbin/syncqt1
-rw-r--r--config.tests/unix/alsa/alsa.pro4
-rw-r--r--config.tests/unix/alsa/alsatest.cpp6
-rwxr-xr-xconfigure36
-rw-r--r--configure.exebin1896493 -> 1134080 bytes
-rw-r--r--demos/qtdemo/xml/examples.xml6
-rw-r--r--demos/textedit/textedit.cpp65
-rw-r--r--doc/src/containers.qdoc2
-rw-r--r--doc/src/examples-overview.qdoc11
-rw-r--r--doc/src/examples.qdoc9
-rw-r--r--doc/src/examples/audiodevices.qdoc54
-rw-r--r--doc/src/examples/audioinput.qdoc54
-rw-r--r--doc/src/examples/audiooutput.qdoc52
-rw-r--r--doc/src/examples/rogue.qdoc222
-rw-r--r--doc/src/images/rogue-example.pngbin0 -> 10364 bytes
-rw-r--r--doc/src/images/rogue-statechart.pngbin0 -> 2490 bytes
-rw-r--r--doc/src/qmake-manual.qdoc3
-rw-r--r--doc/src/qsqldatatype-table.qdoc2
-rw-r--r--doc/src/snippets/code/src_gui_image_qicon.cpp9
-rw-r--r--examples/examples.pro1
-rw-r--r--examples/gestures/imageviewer/imagewidget.cpp13
-rw-r--r--examples/gestures/imageviewer/tapandholdgesture.cpp33
-rw-r--r--examples/gestures/imageviewer/tapandholdgesture.h1
-rw-r--r--examples/itemviews/frozencolumn/freezetablewidget.h1
-rw-r--r--examples/itemviews/frozencolumn/main.cpp1
-rw-r--r--examples/multimedia/README34
-rw-r--r--examples/multimedia/audio/audio.pro10
-rw-r--r--examples/multimedia/audio/audiodevices/audiodevices.cpp272
-rw-r--r--examples/multimedia/audio/audiodevices/audiodevices.h79
-rw-r--r--examples/multimedia/audio/audiodevices/audiodevices.pro12
-rw-r--r--examples/multimedia/audio/audiodevices/audiodevicesbase.ui255
-rw-r--r--examples/multimedia/audio/audiodevices/main.cpp55
-rw-r--r--examples/multimedia/audio/audioinput/audioinput.cpp376
-rw-r--r--examples/multimedia/audio/audioinput/audioinput.h144
-rw-r--r--examples/multimedia/audio/audioinput/audioinput.pro12
-rw-r--r--examples/multimedia/audio/audioinput/main.cpp55
-rw-r--r--examples/multimedia/audio/audiooutput/audiooutput.cpp280
-rw-r--r--examples/multimedia/audio/audiooutput/audiooutput.h112
-rw-r--r--examples/multimedia/audio/audiooutput/audiooutput.pro11
-rw-r--r--examples/multimedia/audio/audiooutput/main.cpp56
-rw-r--r--examples/multimedia/multimedia.pro8
-rw-r--r--examples/script/calculator/calculator.js107
-rw-r--r--examples/script/customclass/bytearrayclass.cpp2
-rw-r--r--examples/statemachine/rogue/main.cpp55
-rw-r--r--examples/statemachine/rogue/movementtransition.h108
-rw-r--r--examples/statemachine/rogue/rogue.pro11
-rw-r--r--examples/statemachine/rogue/window.cpp201
-rw-r--r--examples/statemachine/rogue/window.h91
-rw-r--r--examples/statemachine/statemachine.pro1
-rw-r--r--examples/webkit/framecapture/framecapture.cpp121
-rw-r--r--examples/webkit/framecapture/framecapture.h70
-rw-r--r--examples/webkit/framecapture/framecapture.pro11
-rw-r--r--examples/webkit/framecapture/main.cpp76
-rw-r--r--mkspecs/common/mac.conf5
-rw-r--r--mkspecs/features/qt.prf3
-rw-r--r--mkspecs/features/qt_config.prf2
-rw-r--r--mkspecs/linux-g++-gles2-experimental/qmake.conf22
-rw-r--r--mkspecs/linux-g++-gles2-experimental/qplatformdefs.h164
-rw-r--r--mkspecs/wincewm65professional-msvc2005/default_post.prf1
-rw-r--r--mkspecs/wincewm65professional-msvc2005/qmake.conf5
-rw-r--r--mkspecs/wincewm65professional-msvc2005/qplatformdefs.h42
-rw-r--r--mkspecs/wincewm65professional-msvc2008/default_post.prf1
-rw-r--r--mkspecs/wincewm65professional-msvc2008/qmake.conf3
-rw-r--r--mkspecs/wincewm65professional-msvc2008/qplatformdefs.h43
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp8
-rw-r--r--qmake/option.cpp3
-rw-r--r--qmake/project.cpp13
-rw-r--r--qmake/qmake.pri2
-rw-r--r--src/3rdparty/phonon/ds9/mediaobject.cpp55
-rw-r--r--src/3rdparty/phonon/ds9/mediaobject.h1
-rw-r--r--src/3rdparty/phonon/phonon/mediasource.cpp8
-rw-r--r--src/3rdparty/webkit/WebCore/WebCore.pro2
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp2
-rw-r--r--src/corelib/arch/arch.pri2
-rw-r--r--src/corelib/global/qglobal.h14
-rw-r--r--src/corelib/io/qdir.cpp15
-rw-r--r--src/corelib/io/qprocess_unix.cpp12
-rw-r--r--src/corelib/io/qprocess_win.cpp46
-rw-r--r--src/corelib/kernel/qeventdispatcher_glib.cpp1
-rw-r--r--src/corelib/kernel/qeventdispatcher_unix.cpp2
-rw-r--r--src/corelib/kernel/qmetaobject.cpp2
-rw-r--r--src/corelib/kernel/qobject.cpp15
-rw-r--r--src/corelib/kernel/qobject_p.h2
-rw-r--r--src/corelib/kernel/qvariant.cpp16
-rw-r--r--src/corelib/kernel/qvariant.h1
-rw-r--r--src/corelib/statemachine/qhistorystate.cpp4
-rw-r--r--src/corelib/statemachine/qstate_p.h2
-rw-r--r--src/corelib/statemachine/qstatemachine.cpp1
-rw-r--r--src/corelib/tools/qsharedpointer.cpp64
-rw-r--r--src/corelib/tools/qsharedpointer.h1
-rw-r--r--src/corelib/tools/qsharedpointer_impl.h100
-rw-r--r--src/corelib/tools/qtimeline.cpp16
-rw-r--r--src/gui/dialogs/qcolordialog.cpp2
-rw-r--r--src/gui/dialogs/qfiledialog.cpp14
-rw-r--r--src/gui/dialogs/qfiledialog_win.cpp28
-rw-r--r--src/gui/egl/qegl.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp44
-rw-r--r--src/gui/graphicsview/qgraphicstransform.cpp40
-rw-r--r--src/gui/graphicsview/qgraphicstransform_p.h4
-rw-r--r--src/gui/graphicsview/qgraphicsview.cpp9
-rw-r--r--src/gui/gui.pro1
-rw-r--r--src/gui/image/image.pri3
-rw-r--r--src/gui/image/qicon.cpp226
-rw-r--r--src/gui/image/qicon.h10
-rw-r--r--src/gui/image/qicon_p.h138
-rw-r--r--src/gui/image/qiconloader.cpp599
-rw-r--r--src/gui/image/qiconloader_p.h185
-rw-r--r--src/gui/image/qimagepixmapcleanuphooks.cpp3
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp12
-rw-r--r--src/gui/itemviews/qitemdelegate.cpp8
-rw-r--r--src/gui/itemviews/qitemselectionmodel.cpp42
-rw-r--r--src/gui/itemviews/qlistwidget.cpp454
-rw-r--r--src/gui/itemviews/qstandarditemmodel.cpp18
-rw-r--r--src/gui/itemviews/qstyleditemdelegate.cpp7
-rw-r--r--src/gui/kernel/kernel.pri6
-rw-r--r--src/gui/kernel/qapplication.h4
-rw-r--r--src/gui/kernel/qapplication_p.h19
-rw-r--r--src/gui/kernel/qapplication_win.cpp108
-rw-r--r--src/gui/kernel/qapplication_x11.cpp238
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm54
-rw-r--r--src/gui/kernel/qdesktopwidget_x11.cpp26
-rw-r--r--src/gui/kernel/qevent_p.h13
-rw-r--r--src/gui/kernel/qgesture.cpp50
-rw-r--r--src/gui/kernel/qgesture.h5
-rw-r--r--src/gui/kernel/qkde.cpp159
-rw-r--r--src/gui/kernel/qkde_p.h76
-rw-r--r--src/gui/kernel/qstandardgestures.cpp280
-rw-r--r--src/gui/kernel/qstandardgestures.h43
-rw-r--r--src/gui/kernel/qstandardgestures_p.h25
-rw-r--r--src/gui/kernel/qt_x11_p.h3
-rw-r--r--src/gui/kernel/qwidget.cpp24
-rw-r--r--src/gui/kernel/qwidget_mac.mm6
-rw-r--r--src/gui/kernel/qwidget_p.h1
-rw-r--r--src/gui/kernel/qwidget_win.cpp70
-rw-r--r--src/gui/kernel/qwidget_x11.cpp7
-rw-r--r--src/gui/math3d/qquaternion.h29
-rw-r--r--src/gui/painting/qoutlinemapper.cpp2
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp3
-rw-r--r--src/gui/painting/qtransform.cpp1
-rw-r--r--src/gui/styles/gtksymbols.cpp33
-rw-r--r--src/gui/styles/gtksymbols_p.h1
-rw-r--r--src/gui/styles/qcleanlooksstyle.cpp563
-rw-r--r--src/gui/styles/qcleanlooksstyle_p.h2
-rw-r--r--src/gui/styles/qcommonstyle.cpp769
-rw-r--r--src/gui/styles/qcommonstyle_p.h13
-rw-r--r--src/gui/styles/qgtkstyle.cpp98
-rw-r--r--src/gui/styles/qgtkstyle.h4
-rw-r--r--src/gui/styles/qmacstyle_mac.mm12
-rw-r--r--src/gui/styles/qstylesheetstyle.cpp8
-rw-r--r--src/gui/styles/qwindowscestyle.cpp6
-rw-r--r--src/gui/styles/qwindowsmobilestyle.cpp4
-rw-r--r--src/gui/widgets/qabstractscrollarea.cpp58
-rw-r--r--src/gui/widgets/qabstractscrollarea.h2
-rw-r--r--src/gui/widgets/qabstractscrollarea_p.h5
-rw-r--r--src/gui/widgets/qdatetimeedit.cpp4
-rw-r--r--src/gui/widgets/qdockarealayout.cpp2
-rw-r--r--src/gui/widgets/qdockwidget.cpp2
-rw-r--r--src/gui/widgets/qlinecontrol.cpp11
-rw-r--r--src/gui/widgets/qlinecontrol_p.h5
-rw-r--r--src/gui/widgets/qlineedit.cpp5
-rw-r--r--src/gui/widgets/qlineedit.h3
-rw-r--r--src/gui/widgets/qlineedit_p.cpp15
-rw-r--r--src/gui/widgets/qlineedit_p.h3
-rw-r--r--src/gui/widgets/qmainwindowlayout.cpp3
-rw-r--r--src/gui/widgets/qmenu.cpp41
-rw-r--r--src/gui/widgets/qmenubar.cpp3
-rw-r--r--src/gui/widgets/qtextedit.cpp24
-rw-r--r--src/gui/widgets/qtextedit.h1
-rw-r--r--src/gui/widgets/qtextedit_p.h4
-rw-r--r--src/gui/widgets/qtoolbararealayout.cpp2
-rw-r--r--src/multimedia/audio/audio.pri56
-rw-r--r--src/multimedia/audio/qaudio.cpp102
-rw-r--r--src/multimedia/audio/qaudio.h71
-rw-r--r--src/multimedia/audio/qaudio_mac.cpp142
-rw-r--r--src/multimedia/audio/qaudio_mac_p.h144
-rw-r--r--src/multimedia/audio/qaudiodevicefactory.cpp250
-rw-r--r--src/multimedia/audio/qaudiodevicefactory_p.h100
-rw-r--r--src/multimedia/audio/qaudiodeviceid.cpp168
-rw-r--r--src/multimedia/audio/qaudiodeviceid.h94
-rw-r--r--src/multimedia/audio/qaudiodeviceid_p.h82
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo.cpp270
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo.h102
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp394
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo_alsa_p.h113
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp357
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo_mac_p.h97
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp378
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo_win32_p.h108
-rw-r--r--src/multimedia/audio/qaudioengine.cpp343
-rw-r--r--src/multimedia/audio/qaudioengine.h131
-rw-r--r--src/multimedia/audio/qaudioengineplugin.cpp54
-rw-r--r--src/multimedia/audio/qaudioengineplugin.h93
-rw-r--r--src/multimedia/audio/qaudioformat.cpp335
-rw-r--r--src/multimedia/audio/qaudioformat.h103
-rw-r--r--src/multimedia/audio/qaudioinput.cpp400
-rw-r--r--src/multimedia/audio/qaudioinput.h108
-rw-r--r--src/multimedia/audio/qaudioinput_alsa_p.cpp688
-rw-r--r--src/multimedia/audio/qaudioinput_alsa_p.h151
-rw-r--r--src/multimedia/audio/qaudioinput_mac_p.cpp930
-rw-r--r--src/multimedia/audio/qaudioinput_mac_p.h171
-rw-r--r--src/multimedia/audio/qaudioinput_win32_p.cpp541
-rw-r--r--src/multimedia/audio/qaudioinput_win32_p.h152
-rw-r--r--src/multimedia/audio/qaudiooutput.cpp403
-rw-r--r--src/multimedia/audio/qaudiooutput.h109
-rw-r--r--src/multimedia/audio/qaudiooutput_alsa_p.cpp706
-rw-r--r--src/multimedia/audio/qaudiooutput_alsa_p.h159
-rw-r--r--src/multimedia/audio/qaudiooutput_mac_p.cpp700
-rw-r--r--src/multimedia/audio/qaudiooutput_mac_p.h171
-rw-r--r--src/multimedia/audio/qaudiooutput_win32_p.cpp504
-rw-r--r--src/multimedia/audio/qaudiooutput_win32_p.h152
-rw-r--r--src/multimedia/multimedia.pro11
-rw-r--r--src/network/access/qhttp.cpp10
-rw-r--r--src/network/access/qhttpnetworkheader.cpp3
-rw-r--r--src/network/access/qhttpnetworkreply_p.h1
-rw-r--r--src/network/access/qhttpnetworkrequest.cpp4
-rw-r--r--src/network/access/qnetworkcookie.h6
-rw-r--r--src/openvg/qpixmapdata_vg.cpp25
-rw-r--r--src/plugins/audio/audio.pro3
-rw-r--r--src/plugins/plugins.pro1
-rw-r--r--src/qbase.pri2
-rw-r--r--src/qt3support/network/q3http.cpp2
-rw-r--r--src/qt3support/network/q3http.h5
-rw-r--r--src/qt3support/network/q3network.cpp2
-rw-r--r--src/script/qscriptable.cpp4
-rw-r--r--src/script/qscriptable_p.h4
-rw-r--r--src/script/qscriptclassdata.cpp2
-rw-r--r--src/sql/drivers/psql/qsql_psql.cpp12
-rw-r--r--src/src.pro4
-rw-r--r--src/testlib/qabstracttestlogger.cpp49
-rw-r--r--src/testlib/qabstracttestlogger_p.h52
-rw-r--r--src/testlib/qbenchmark.cpp21
-rw-r--r--src/testlib/qbenchmark.h10
-rw-r--r--src/testlib/qbenchmark_p.h1
-rw-r--r--src/testlib/qplaintestlogger.cpp22
-rw-r--r--src/testlib/qtest_global.h1
-rw-r--r--src/testlib/qtestbasicstreamer.cpp40
-rw-r--r--src/testlib/qtestbasicstreamer.h11
-rw-r--r--src/testlib/qtestcase.cpp57
-rw-r--r--src/testlib/qtestlightxmlstreamer.cpp70
-rw-r--r--src/testlib/qtestlightxmlstreamer.h6
-rw-r--r--src/testlib/qtestxmlstreamer.cpp61
-rw-r--r--src/testlib/qtestxmlstreamer.h6
-rw-r--r--src/testlib/qtestxunitstreamer.cpp43
-rw-r--r--src/testlib/qtestxunitstreamer.h8
-rw-r--r--src/testlib/qxmltestlogger.cpp75
-rw-r--r--src/testlib/qxmltestlogger_p.h8
-rw-r--r--src/tools/bootstrap/bootstrap.pro2
-rw-r--r--src/tools/uic/uic.cpp6
-rw-r--r--src/xmlpatterns/query.pri2
-rw-r--r--src/xmlpatterns/xmlpatterns.pro3
-rw-r--r--tests/arthur/lance/main.cpp2
-rw-r--r--tests/arthur/lance/widgets.h39
-rw-r--r--tests/auto/auto.pro48
-rw-r--r--tests/auto/linguist/lconvert/.gitignore2
-rw-r--r--tests/auto/linguist/lrelease/.gitignore2
-rw-r--r--tests/auto/linguist/lrelease/testdata/idbased.ts21
-rw-r--r--tests/auto/linguist/lupdate/.gitignore4
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result4
-rw-r--r--tests/auto/linguist/lupdate/tst_lupdate.cpp25
-rw-r--r--tests/auto/macgui/macgui.pro10
-rw-r--r--tests/auto/macgui/tst_macgui.cpp (renamed from tests/auto/macgui/tst_gui.cpp)19
-rw-r--r--tests/auto/networkselftest/networkselftest.pro (renamed from tests/auto/_networkselftest/_networkselftest.pro)0
-rw-r--r--tests/auto/networkselftest/tst_networkselftest.cpp (renamed from tests/auto/_networkselftest/tst_networkselftest.cpp)0
-rw-r--r--tests/auto/q3progressbar/tst_q3progressbar.cpp7
-rw-r--r--tests/auto/qaccessibility_mac/qaccessibility_mac.pro23
-rw-r--r--tests/auto/qaccessibility_mac/tst_qaccessibility_mac.cpp64
-rw-r--r--tests/auto/qaudiodeviceid/qaudiodeviceid.pro7
-rw-r--r--tests/auto/qaudiodeviceid/tst_qaudiodeviceid.cpp98
-rw-r--r--tests/auto/qaudiodeviceinfo/qaudiodeviceinfo.pro7
-rw-r--r--tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp159
-rw-r--r--tests/auto/qaudioformat/qaudioformat.pro7
-rw-r--r--tests/auto/qaudioformat/tst_qaudioformat.cpp180
-rw-r--r--tests/auto/qaudioinput/qaudioinput.pro7
-rw-r--r--tests/auto/qaudioinput/tst_qaudioinput.cpp120
-rw-r--r--tests/auto/qaudiooutput/4.wavbin0 -> 5538 bytes
-rw-r--r--tests/auto/qaudiooutput/qaudiooutput.pro12
-rw-r--r--tests/auto/qaudiooutput/tst_qaudiooutput.cpp156
-rw-r--r--tests/auto/qboxlayout/tst_qboxlayout.cpp3
-rw-r--r--tests/auto/qcombobox/tst_qcombobox.cpp40
-rw-r--r--tests/auto/qcompleter/tst_qcompleter.cpp12
-rw-r--r--tests/auto/qcopchannel/qcopchannel.pro1
-rw-r--r--tests/auto/qcopchannel/test/test.pro8
-rw-r--r--tests/auto/qcopchannel/testSend/testSend.pro1
-rw-r--r--tests/auto/qcssparser/qcssparser.pro2
-rw-r--r--tests/auto/qcssparser/tst_qcssparser.cpp (renamed from tests/auto/qcssparser/tst_cssparser.cpp)96
-rw-r--r--tests/auto/qdbuspendingcall/qdbuspendingcall.pro5
-rw-r--r--tests/auto/qdbuspendingreply/qdbuspendingreply.pro4
-rw-r--r--tests/auto/qdesktopwidget/tst_qdesktopwidget.cpp12
-rw-r--r--tests/auto/qdirectpainter/qdirectpainter.pro4
-rw-r--r--tests/auto/qdirectpainter/runDirectPainter/runDirectPainter.pro1
-rw-r--r--tests/auto/qdirectpainter/test/test.pro9
-rw-r--r--tests/auto/qdockwidget/tst_qdockwidget.cpp19
-rw-r--r--tests/auto/qfile/tst_qfile.cpp1
-rw-r--r--tests/auto/qfiledialog/tst_qfiledialog.cpp43
-rw-r--r--tests/auto/qfileinfo/tst_qfileinfo.cpp10
-rw-r--r--tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp22
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp16
-rw-r--r--tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp22
-rw-r--r--tests/auto/qhostinfo/tst_qhostinfo.cpp5
-rw-r--r--tests/auto/qicoimageformat/qicoimageformat.pro2
-rw-r--r--tests/auto/qicoimageformat/tst_qicoimageformat.cpp (renamed from tests/auto/qicoimageformat/tst_qticoimageformat.cpp)53
-rw-r--r--tests/auto/qicon/icons/testtheme/16x16/actions/appointment-new.pngbin0 -> 897 bytes
-rw-r--r--tests/auto/qicon/icons/testtheme/22x22/actions/appointment-new.pngbin0 -> 1411 bytes
-rw-r--r--tests/auto/qicon/icons/testtheme/32x32/actions/appointment-new.pngbin0 -> 2399 bytes
-rw-r--r--tests/auto/qicon/icons/testtheme/index.theme492
-rw-r--r--tests/auto/qicon/icons/testtheme/scalable/actions/svg-only.svg425
-rw-r--r--tests/auto/qicon/icons/themeparent/16x16/actions/address-book-new.pngbin0 -> 796 bytes
-rw-r--r--tests/auto/qicon/icons/themeparent/16x16/actions/appointment-new.pngbin0 -> 897 bytes
-rw-r--r--tests/auto/qicon/icons/themeparent/22x22/actions/address-book-new.pngbin0 -> 924 bytes
-rw-r--r--tests/auto/qicon/icons/themeparent/22x22/actions/appointment-new.pngbin0 -> 1411 bytes
-rw-r--r--tests/auto/qicon/icons/themeparent/32x32/actions/address-book-new.pngbin0 -> 1897 bytes
-rw-r--r--tests/auto/qicon/icons/themeparent/32x32/actions/appointment-new.pngbin0 -> 2399 bytes
-rw-r--r--tests/auto/qicon/icons/themeparent/index.theme492
-rw-r--r--tests/auto/qicon/icons/themeparent/scalable/actions/address-book-new.svg389
-rw-r--r--tests/auto/qicon/icons/themeparent/scalable/actions/appointment-new.svg425
-rw-r--r--tests/auto/qicon/tst_qicon.cpp67
-rw-r--r--tests/auto/qitemdelegate/tst_qitemdelegate.cpp2
-rw-r--r--tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp54
-rw-r--r--tests/auto/qitemview/tst_qitemview.cpp2
-rw-r--r--tests/auto/qlistwidget/tst_qlistwidget.cpp23
-rw-r--r--tests/auto/qlocalsocket/tst_qlocalsocket.cpp10
-rw-r--r--tests/auto/qmainwindow/tst_qmainwindow.cpp3
-rw-r--r--tests/auto/qmake/testdata/functions/functions.pro2
-rw-r--r--tests/auto/qmenu/tst_qmenu.cpp10
-rw-r--r--tests/auto/qmenubar/tst_qmenubar.cpp22
-rw-r--r--tests/auto/qmultiscreen/qmultiscreen.pro2
-rw-r--r--tests/auto/qplaintextedit/tst_qplaintextedit.cpp7
-rw-r--r--tests/auto/qpluginloader/tst/tst.pro2
-rw-r--r--tests/auto/qpluginloader/tst_qpluginloader.cpp1
-rw-r--r--tests/auto/qpolygon/.gitignore (renamed from tests/auto/qpointarray/.gitignore)0
-rw-r--r--tests/auto/qpolygon/qpolygon.pro (renamed from tests/auto/qpointarray/qpointarray.pro)2
-rw-r--r--tests/auto/qpolygon/tst_qpolygon.cpp (renamed from tests/auto/qpointarray/tst_qpointarray.cpp)2
-rw-r--r--tests/auto/qprocess/tst_qprocess.cpp2
-rw-r--r--tests/auto/qpushbutton/tst_qpushbutton.cpp1
-rw-r--r--tests/auto/qresourceengine/qresourceengine.pro2
-rw-r--r--tests/auto/qresourceengine/tst_qresourceengine.cpp (renamed from tests/auto/qresourceengine/tst_resourceengine.cpp)25
-rw-r--r--tests/auto/qscriptextqobject/.gitignore (renamed from tests/auto/qscriptqobject/.gitignore)0
-rw-r--r--tests/auto/qscriptextqobject/qscriptextqobject.pro (renamed from tests/auto/qscriptqobject/qscriptqobject.pro)2
-rw-r--r--tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp (renamed from tests/auto/qscriptqobject/tst_qscriptqobject.cpp)2
-rw-r--r--tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp9
-rw-r--r--tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp7
-rw-r--r--tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp36
-rw-r--r--tests/auto/qsharedpointer/tst_qsharedpointer.cpp147
-rw-r--r--tests/auto/qsharedpointer_and_qwidget/qsharedpointer_and_qwidget.pro3
-rw-r--r--tests/auto/qsharedpointer_and_qwidget/tst_qsharedpointer_and_qwidget.cpp150
-rw-r--r--tests/auto/qsqldatabase/tst_databases.h12
-rw-r--r--tests/auto/qsqldatabase/tst_qsqldatabase.cpp10
-rw-r--r--tests/auto/qstringbuilder/scenario1.pro1
-rw-r--r--tests/auto/qstringbuilder/scenario2.pro1
-rw-r--r--tests/auto/qstringbuilder/scenario3.pro1
-rw-r--r--tests/auto/qstringbuilder/scenario4.pro1
-rw-r--r--tests/auto/qstringbuilder/tst_qstringbuilder.cpp11
-rw-r--r--tests/auto/qstringbuilder/tst_qstringbuilder.h55
-rw-r--r--tests/auto/qstyle/tst_qstyle.cpp2
-rw-r--r--tests/auto/qtableview/tst_qtableview.cpp13
-rw-r--r--tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp36
-rw-r--r--tests/auto/qtimeline/tst_qtimeline.cpp41
-rw-r--r--tests/auto/qtreeview/tst_qtreeview.cpp3
-rw-r--r--tests/auto/qtreewidget/tst_qtreewidget.cpp13
-rw-r--r--tests/auto/qwidget_window/tst_qwidget_window.cpp24
-rw-r--r--tests/auto/qwindowsurface/tst_qwindowsurface.cpp6
-rw-r--r--tests/auto/qxmlquery/qxmlquery.pro6
-rw-r--r--tests/auto/qxmlquery/tst_qxmlquery.cpp30
-rwxr-xr-xtests/auto/runQtXmlPatternsTests.sh61
-rw-r--r--tests/auto/selftests/benchlibwalltime/tst_benchlibwalltime.cpp11
-rw-r--r--tests/auto/selftests/expected_benchlibwalltime.txt5
-rw-r--r--tests/auto/tests.xml8
-rw-r--r--tests/auto/uic/baseline/Dialog_with_Buttons_Bottom.ui.h4
-rw-r--r--tests/auto/uic/baseline/Dialog_with_Buttons_Right.ui.h4
-rw-r--r--tests/auto/uic/baseline/Dialog_without_Buttons.ui.h4
-rw-r--r--tests/auto/uic/baseline/Main_Window.ui.h4
-rw-r--r--tests/auto/uic/baseline/Widget.ui.h4
-rw-r--r--tests/auto/uic/baseline/addlinkdialog.ui.h4
-rw-r--r--tests/auto/uic/baseline/addtorrentform.ui.h4
-rw-r--r--tests/auto/uic/baseline/authenticationdialog.ui.h4
-rw-r--r--tests/auto/uic/baseline/backside.ui.h4
-rw-r--r--tests/auto/uic/baseline/batchtranslation.ui.h4
-rw-r--r--tests/auto/uic/baseline/bookmarkdialog.ui.h4
-rw-r--r--tests/auto/uic/baseline/bookwindow.ui.h4
-rw-r--r--tests/auto/uic/baseline/browserwidget.ui.h4
-rw-r--r--tests/auto/uic/baseline/calculator.ui.h4
-rw-r--r--tests/auto/uic/baseline/calculatorform.ui.h4
-rw-r--r--tests/auto/uic/baseline/certificateinfo.ui.h4
-rw-r--r--tests/auto/uic/baseline/chatdialog.ui.h4
-rw-r--r--tests/auto/uic/baseline/chatmainwindow.ui.h4
-rw-r--r--tests/auto/uic/baseline/chatsetnickname.ui.h4
-rw-r--r--tests/auto/uic/baseline/config.ui.h4
-rw-r--r--tests/auto/uic/baseline/connectdialog.ui.h4
-rw-r--r--tests/auto/uic/baseline/controller.ui.h4
-rw-r--r--tests/auto/uic/baseline/cookies.ui.h4
-rw-r--r--tests/auto/uic/baseline/cookiesexceptions.ui.h4
-rw-r--r--tests/auto/uic/baseline/default.ui.h4
-rw-r--r--tests/auto/uic/baseline/dialog.ui.h4
-rw-r--r--tests/auto/uic/baseline/downloaditem.ui.h4
-rw-r--r--tests/auto/uic/baseline/downloads.ui.h4
-rw-r--r--tests/auto/uic/baseline/embeddeddialog.ui.h4
-rw-r--r--tests/auto/uic/baseline/filespage.ui.h4
-rw-r--r--tests/auto/uic/baseline/filternamedialog.ui.h4
-rw-r--r--tests/auto/uic/baseline/filterpage.ui.h4
-rw-r--r--tests/auto/uic/baseline/finddialog.ui.h4
-rw-r--r--tests/auto/uic/baseline/form.ui.h4
-rw-r--r--tests/auto/uic/baseline/formwindowsettings.ui.h4
-rw-r--r--tests/auto/uic/baseline/generalpage.ui.h4
-rw-r--r--tests/auto/uic/baseline/gridpanel.ui.h4
-rw-r--r--tests/auto/uic/baseline/helpdialog.ui.h4
-rw-r--r--tests/auto/uic/baseline/history.ui.h4
-rw-r--r--tests/auto/uic/baseline/identifierpage.ui.h4
-rw-r--r--tests/auto/uic/baseline/imagedialog.ui.h4
-rw-r--r--tests/auto/uic/baseline/inputpage.ui.h4
-rw-r--r--tests/auto/uic/baseline/installdialog.ui.h4
-rw-r--r--tests/auto/uic/baseline/languagesdialog.ui.h4
-rw-r--r--tests/auto/uic/baseline/listwidgeteditor.ui.h4
-rw-r--r--tests/auto/uic/baseline/mainwindow.ui.h4
-rw-r--r--tests/auto/uic/baseline/mainwindowbase.ui.h4
-rw-r--r--tests/auto/uic/baseline/mydialog.ui.h4
-rw-r--r--tests/auto/uic/baseline/myform.ui.h4
-rw-r--r--tests/auto/uic/baseline/newactiondialog.ui.h4
-rw-r--r--tests/auto/uic/baseline/newdynamicpropertydialog.ui.h4
-rw-r--r--tests/auto/uic/baseline/newform.ui.h4
-rw-r--r--tests/auto/uic/baseline/orderdialog.ui.h4
-rw-r--r--tests/auto/uic/baseline/outputpage.ui.h4
-rw-r--r--tests/auto/uic/baseline/pagefold.ui.h4
-rw-r--r--tests/auto/uic/baseline/paletteeditor.ui.h4
-rw-r--r--tests/auto/uic/baseline/paletteeditoradvancedbase.ui.h4
-rw-r--r--tests/auto/uic/baseline/passworddialog.ui.h4
-rw-r--r--tests/auto/uic/baseline/pathpage.ui.h4
-rw-r--r--tests/auto/uic/baseline/phrasebookbox.ui.h4
-rw-r--r--tests/auto/uic/baseline/plugindialog.ui.h4
-rw-r--r--tests/auto/uic/baseline/preferencesdialog.ui.h4
-rw-r--r--tests/auto/uic/baseline/previewconfigurationwidget.ui.h4
-rw-r--r--tests/auto/uic/baseline/previewdialogbase.ui.h4
-rw-r--r--tests/auto/uic/baseline/previewwidget.ui.h4
-rw-r--r--tests/auto/uic/baseline/previewwidgetbase.ui.h4
-rw-r--r--tests/auto/uic/baseline/proxy.ui.h4
-rw-r--r--tests/auto/uic/baseline/qfiledialog.ui.h4
-rw-r--r--tests/auto/uic/baseline/qpagesetupwidget.ui.h4
-rw-r--r--tests/auto/uic/baseline/qprintpropertieswidget.ui.h4
-rw-r--r--tests/auto/uic/baseline/qprintsettingsoutput.ui.h4
-rw-r--r--tests/auto/uic/baseline/qprintwidget.ui.h4
-rw-r--r--tests/auto/uic/baseline/qsqlconnectiondialog.ui.h4
-rw-r--r--tests/auto/uic/baseline/qtgradientdialog.ui.h4
-rw-r--r--tests/auto/uic/baseline/qtgradienteditor.ui.h4
-rw-r--r--tests/auto/uic/baseline/qtgradientview.ui.h4
-rw-r--r--tests/auto/uic/baseline/qtgradientviewdialog.ui.h4
-rw-r--r--tests/auto/uic/baseline/qtresourceeditordialog.ui.h4
-rw-r--r--tests/auto/uic/baseline/qttoolbardialog.ui.h4
-rw-r--r--tests/auto/uic/baseline/querywidget.ui.h4
-rw-r--r--tests/auto/uic/baseline/remotecontrol.ui.h4
-rw-r--r--tests/auto/uic/baseline/saveformastemplate.ui.h4
-rw-r--r--tests/auto/uic/baseline/settings.ui.h4
-rw-r--r--tests/auto/uic/baseline/signalslotdialog.ui.h4
-rw-r--r--tests/auto/uic/baseline/sslclient.ui.h4
-rw-r--r--tests/auto/uic/baseline/sslerrors.ui.h4
-rw-r--r--tests/auto/uic/baseline/statistics.ui.h4
-rw-r--r--tests/auto/uic/baseline/stringlisteditor.ui.h4
-rw-r--r--tests/auto/uic/baseline/stylesheeteditor.ui.h4
-rw-r--r--tests/auto/uic/baseline/tabbedbrowser.ui.h4
-rw-r--r--tests/auto/uic/baseline/tablewidgeteditor.ui.h4
-rw-r--r--tests/auto/uic/baseline/tetrixwindow.ui.h4
-rw-r--r--tests/auto/uic/baseline/textfinder.ui.h4
-rw-r--r--tests/auto/uic/baseline/topicchooser.ui.h4
-rw-r--r--tests/auto/uic/baseline/translatedialog.ui.h4
-rw-r--r--tests/auto/uic/baseline/translationsettings.ui.h4
-rw-r--r--tests/auto/uic/baseline/treewidgeteditor.ui.h4
-rw-r--r--tests/auto/uic/baseline/trpreviewtool.ui.h4
-rw-r--r--tests/auto/uic/baseline/validators.ui.h4
-rw-r--r--tests/auto/uic/baseline/wateringconfigdialog.ui.h4
-rw-r--r--tests/auto/uiloader/baseline/css_task259226_spinboxes.ui83
-rw-r--r--tests/auto/windowsmobile/test/test.pro3
-rw-r--r--tests/auto/xmlpatterns/tst_xmlpatterns.cpp134
-rw-r--r--tests/auto/xmlpatterns/xmlpatterns.pro6
-rw-r--r--tests/benchmarks/qgraphicsitem/qgraphicsitem.pro1
-rw-r--r--tests/benchmarks/qgraphicsitem/tst_qgraphicsitem.cpp51
-rw-r--r--tests/manual/qdesktopwidget/main.cpp31
-rw-r--r--tests/manual/qtabletevent/main.cpp9
-rw-r--r--tests/manual/qtabletevent/qtabletevent.pro13
-rw-r--r--tests/manual/qtabletevent/tabletwidget.cpp150
-rw-r--r--tests/manual/qtabletevent/tabletwidget.h32
-rw-r--r--tools/assistant/compat/lib/lib.pro2
-rw-r--r--tools/assistant/compat/mainwindow.cpp10
-rw-r--r--tools/assistant/tools/assistant/installdialog.cpp2
-rw-r--r--tools/assistant/tools/assistant/installdialog.h4
-rw-r--r--tools/assistant/tools/assistant/mainwindow.cpp13
-rw-r--r--tools/checksdk/main.cpp4
-rw-r--r--tools/configure/configureapp.cpp15
-rw-r--r--tools/designer/src/components/buddyeditor/buddyeditor.cpp2
-rw-r--r--tools/designer/src/components/buddyeditor/buddyeditor_plugin.cpp5
-rw-r--r--tools/designer/src/components/formeditor/default_actionprovider.cpp15
-rw-r--r--tools/designer/src/components/formeditor/default_actionprovider.h4
-rw-r--r--tools/designer/src/components/formeditor/formwindowmanager.cpp22
-rw-r--r--tools/designer/src/components/lib/lib.pro2
-rw-r--r--tools/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp3
-rw-r--r--tools/designer/src/components/tabordereditor/tabordereditor_plugin.cpp4
-rw-r--r--tools/designer/src/designer/qdesigner_actions.cpp7
-rw-r--r--tools/designer/src/lib/lib.pro2
-rw-r--r--tools/designer/src/lib/shared/actioneditor.cpp18
-rw-r--r--tools/designer/src/lib/shared/actionprovider_p.h2
-rw-r--r--tools/designer/src/lib/shared/qdesigner_menu.cpp86
-rw-r--r--tools/designer/src/lib/shared/qdesigner_menu_p.h3
-rw-r--r--tools/designer/src/lib/shared/qdesigner_menubar.cpp58
-rw-r--r--tools/designer/src/lib/shared/qdesigner_menubar_p.h4
-rw-r--r--tools/designer/src/lib/shared/qdesigner_toolbar.cpp2
-rw-r--r--tools/designer/src/lib/shared/qtresourceview.cpp10
-rw-r--r--tools/designer/src/uitools/uitools.pro2
-rw-r--r--tools/linguist/linguist/mainwindow.cpp10
-rw-r--r--tools/linguist/linguist/mainwindow.ui6
-rw-r--r--tools/linguist/linguist/messageeditor.cpp2
-rw-r--r--tools/linguist/linguist/messageeditor.h2
-rw-r--r--tools/linguist/shared/profileevaluator.cpp2
-rw-r--r--tools/linguist/shared/profileevaluator.h15
-rw-r--r--tools/qdoc3/cppcodeparser.cpp3
-rw-r--r--tools/qdoc3/generator.cpp2
-rw-r--r--tools/qdoc3/htmlgenerator.cpp66
-rw-r--r--tools/qdoc3/node.h5
-rw-r--r--tools/qdoc3/tree.cpp5
-rw-r--r--tools/qtestlib/wince/cetcpsync/cetcpsync.pro22
-rw-r--r--tools/qtestlib/wince/cetcpsync/main.cpp191
-rw-r--r--tools/qtestlib/wince/cetcpsync/qtcesterconnection.cpp552
-rw-r--r--tools/qtestlib/wince/cetcpsync/qtcesterconnection.h86
-rw-r--r--tools/qtestlib/wince/cetcpsync/remoteconnection.cpp65
-rw-r--r--tools/qtestlib/wince/cetcpsync/remoteconnection.h81
-rw-r--r--tools/qtestlib/wince/cetcpsyncserver/cetcpsyncserver.pro17
-rw-r--r--tools/qtestlib/wince/cetcpsyncserver/commands.cpp686
-rw-r--r--tools/qtestlib/wince/cetcpsyncserver/commands.h292
-rw-r--r--tools/qtestlib/wince/cetcpsyncserver/connectionmanager.cpp138
-rw-r--r--tools/qtestlib/wince/cetcpsyncserver/connectionmanager.h83
-rw-r--r--tools/qtestlib/wince/cetcpsyncserver/main.cpp63
-rw-r--r--tools/qtestlib/wince/cetcpsyncserver/transfer_global.h159
-rw-r--r--tools/qtestlib/wince/cetest/cetcpsyncconnection.cpp200
-rw-r--r--tools/qtestlib/wince/cetest/cetcpsyncconnection.h82
-rw-r--r--tools/qtestlib/wince/cetest/cetest.pro19
-rw-r--r--tools/qtestlib/wince/cetest/deployment.cpp2
-rw-r--r--tools/qtestlib/wince/cetest/main.cpp11
-rw-r--r--translations/assistant_de.ts304
-rw-r--r--translations/linguist_de.ts1160
-rw-r--r--translations/qt_help_de.ts40
536 files changed, 25163 insertions, 4513 deletions
diff --git a/bin/syncqt b/bin/syncqt
index 6c4de6ad1..589659f46 100755
--- a/bin/syncqt
+++ b/bin/syncqt
@@ -43,6 +43,7 @@ my %modules = ( # path to module name map
"QtDBus" => "$basedir/src/dbus",
"QtWebKit" => "$basedir/src/3rdparty/webkit/WebCore",
"phonon" => "$basedir/src/phonon",
+ "QtMultimedia" => "$basedir/src/multimedia",
);
my %moduleheaders = ( # restrict the module headers to those found in relative path
"QtWebKit" => "../WebKit/qt/Api",
diff --git a/config.tests/unix/alsa/alsa.pro b/config.tests/unix/alsa/alsa.pro
new file mode 100644
index 000000000..4931d38ea
--- /dev/null
+++ b/config.tests/unix/alsa/alsa.pro
@@ -0,0 +1,4 @@
+SOURCES = alsatest.cpp
+LIBS+=-lasound
+CONFIG -= qt dylib
+mac:CONFIG -= app_bundle
diff --git a/config.tests/unix/alsa/alsatest.cpp b/config.tests/unix/alsa/alsatest.cpp
new file mode 100644
index 000000000..af2f5d91f
--- /dev/null
+++ b/config.tests/unix/alsa/alsatest.cpp
@@ -0,0 +1,6 @@
+#include <alsa/asoundlib.h>
+int main(int argc,char **argv)
+{
+ return 0;
+}
+
diff --git a/configure b/configure
index 095d04083..1d1f82694 100755
--- a/configure
+++ b/configure
@@ -609,6 +609,7 @@ CFG_NOBUILD_PARTS=""
CFG_RELEASE_QMAKE=no
CFG_PHONON=auto
CFG_PHONON_BACKEND=yes
+CFG_MULTIMEDIA=yes
CFG_SVG=yes
CFG_WEBKIT=auto # (yes|no|auto)
@@ -709,6 +710,7 @@ OPT_VERBOSE=no
OPT_HELP=
CFG_SILENT=no
CFG_GRAPHICS_SYSTEM=default
+CFG_ALSA=auto
# initalize variables used for installation
QT_INSTALL_PREFIX=
@@ -848,7 +850,7 @@ while [ "$#" -gt 0 ]; do
VAL=no
;;
#Qt style yes options
- -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xshape|-xinput|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-universal|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-svg|-webkit|-scripttools|-rpath|-force-pkg-config)
+ -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xshape|-xinput|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-universal|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-svg|-webkit|-scripttools|-rpath|-force-pkg-config)
VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
VAL=yes
;;
@@ -1976,6 +1978,13 @@ while [ "$#" -gt 0 ]; do
UNKNOWN_OPT=yes
fi
;;
+ multimedia)
+ if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
+ CFG_MULTIMEDIA="$VAL"
+ else
+ UNKNOWN_OPT=yes
+ fi
+ ;;
*)
UNKNOWN_OPT=yes
;;
@@ -3152,6 +3161,7 @@ Usage: $relconf [-h] [-prefix <dir>] [-prefix-install] [-bindir <dir>] [-libdir
[-no-optimized-qmake] [-optimized-qmake] [-no-xmlpatterns] [-xmlpatterns]
[-no-phonon] [-phonon] [-no-phonon-backend] [-phonon-backend]
[-no-openssl] [-openssl] [-openssl-linked]
+ [-no-multimedia] [-multimedia]
[-no-gtkstyle] [-gtkstyle] [-no-svg] [-svg] [-no-webkit] [-webkit]
[-no-scripttools] [-scripttools]
@@ -3292,6 +3302,9 @@ fi
-no-phonon-backend.. Do not build the platform phonon plugin.
+ -phonon-backend..... Build the platform phonon plugin.
+ -no-multimedia ..... Do not build the multimedia module.
+ * -multimedia ........ Build the multimedia module.
+
-no-svg ............ Do not build the SVG module.
+ -svg ............... Build the SVG module.
@@ -5664,6 +5677,14 @@ if [ "$CFG_PTMALLOC" != "no" ]; then
QMakeVar add QMAKE_LFLAGS "$outpath/lib/libptmalloc3.a"
fi
+if [ "$CFG_ALSA" = "auto" ]; then
+ if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/alsa "alsa" $L_FLAGS $I_FLAGS $l_FLAGS; then
+ CFG_ALSA=yes
+ else
+ CFG_ALSA=no
+ fi
+fi
+
#-------------------------------------------------------------------------------
# ask for all that hasn't been auto-detected or specified in the arguments
#-------------------------------------------------------------------------------
@@ -6104,6 +6125,10 @@ if [ "$CFG_EXCEPTIONS" != "no" ]; then
QTCONFIG_CONFIG="$QTCONFIG_CONFIG exceptions"
fi
+if [ "$CFG_ALSA" = "yes" ]; then
+ QT_CONFIG="$QT_CONFIG alsa"
+fi
+
#
# Some Qt modules are too advanced in C++ for some old compilers
# Detect here the platforms where they are known to work.
@@ -6275,6 +6300,12 @@ else
QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SCRIPTTOOLS"
fi
+if [ "$CFG_MULTIMEDIA" = "yes" ]; then
+ QT_CONFIG="$QT_CONFIG multimedia"
+else
+ QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MULTIMEDIA"
+fi
+
if [ "$CFG_EXCEPTIONS" = "no" ]; then
case "$COMPILER" in
g++*)
@@ -6776,6 +6807,7 @@ fi
[ "$CFG_XFIXES" = "runtime" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XFIXES"
[ "$CFG_XRANDR" = "runtime" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XRANDR"
[ "$CFG_XINPUT" = "runtime" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XINPUT"
+[ "$CFG_ALSA" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ALSA"
# sort QCONFIG_FLAGS for neatness if we can
[ '!' -z "$AWK" ] && QCONFIG_FLAGS=`echo $QCONFIG_FLAGS | $AWK '{ gsub(" ", "\n"); print }' | sort | uniq`
@@ -7135,6 +7167,7 @@ echo "QtConcurrent code.... $CFG_CONCURRENT"
echo "QtScriptTools module $CFG_SCRIPTTOOLS"
echo "QtXmlPatterns module $CFG_XMLPATTERNS"
echo "Phonon module ....... $CFG_PHONON"
+echo "Multimedia module ... $CFG_MULTIMEDIA"
echo "SVG module .......... $CFG_SVG"
echo "WebKit module ....... $CFG_WEBKIT"
echo "STL support ......... $CFG_STL"
@@ -7285,6 +7318,7 @@ if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_DEBUG"
echo "NOTE: Mac OS X frameworks implicitly build debug and release Qt libraries."
echo
fi
+echo "alsa support ........ $CFG_ALSA"
echo
sepath=`echo "$relpath" | sed -e 's/\\./\\\\./g'`
diff --git a/configure.exe b/configure.exe
index 322819ef2..cf5885a16 100644
--- a/configure.exe
+++ b/configure.exe
Binary files differ
diff --git a/demos/qtdemo/xml/examples.xml b/demos/qtdemo/xml/examples.xml
index 006bfd07e..6c8ddb05b 100644
--- a/demos/qtdemo/xml/examples.xml
+++ b/demos/qtdemo/xml/examples.xml
@@ -154,6 +154,11 @@
<category dirname="phonon" name="Phonon">
<example filename="musicplayer" name="Music Player" />
</category>
+ <category dirname="multimedia/audio" name="Multimedia">
+ <example filename="audiodevices" name="Audio Devices" />
+ <example filename="audiooutput" name="Audio Output" />
+ <example filename="audioinput" name="Audio Input" />
+ </category>
<category dirname="richtext" name="Rich Text">
<example filename="calendar" name="Calendar" />
<example filename="orderform" name="Order Form" />
@@ -178,6 +183,7 @@
</category>
<category dirname="statemachine" name="State Machine">
<example filename="eventtransitions" name="Event Transitions" />
+ <example filename="rogue" name="Rogue" />
<example filename="tankgame" name="Tank Game" />
<example filename="trafficlight" name="Traffic Light" />
<example filename="twowaybutton" name="Two-way Button" />
diff --git a/demos/textedit/textedit.cpp b/demos/textedit/textedit.cpp
index d1e12bbf5..31b419a72 100644
--- a/demos/textedit/textedit.cpp
+++ b/demos/textedit/textedit.cpp
@@ -158,14 +158,16 @@ void TextEdit::setupFileActions()
QAction *a;
- a = new QAction(QIcon(rsrcPath + "/filenew.png"), tr("&New"), this);
+ QIcon newIcon = QIcon::fromTheme("document-new", QIcon(rsrcPath + "/filenew.png"));
+ a = new QAction( newIcon, tr("&New"), this);
a->setPriority(QAction::LowPriority);
a->setShortcut(QKeySequence::New);
connect(a, SIGNAL(triggered()), this, SLOT(fileNew()));
tb->addAction(a);
menu->addAction(a);
- a = new QAction(QIcon(rsrcPath + "/fileopen.png"), tr("&Open..."), this);
+ a = new QAction(QIcon::fromTheme("document-open", QIcon(rsrcPath + "/fileopen.png")),
+ tr("&Open..."), this);
a->setShortcut(QKeySequence::Open);
connect(a, SIGNAL(triggered()), this, SLOT(fileOpen()));
tb->addAction(a);
@@ -173,7 +175,8 @@ void TextEdit::setupFileActions()
menu->addSeparator();
- actionSave = a = new QAction(QIcon(rsrcPath + "/filesave.png"), tr("&Save"), this);
+ actionSave = a = new QAction(QIcon::fromTheme("document-save", QIcon(rsrcPath + "/filesave.png")),
+ tr("&Save"), this);
a->setShortcut(QKeySequence::Save);
connect(a, SIGNAL(triggered()), this, SLOT(fileSave()));
a->setEnabled(false);
@@ -187,17 +190,21 @@ void TextEdit::setupFileActions()
menu->addSeparator();
#ifndef QT_NO_PRINTER
- a = new QAction(QIcon(rsrcPath + "/fileprint.png"), tr("&Print..."), this);
+ a = new QAction(QIcon::fromTheme("document-print", QIcon(rsrcPath + "/fileprint.png")),
+ tr("&Print..."), this);
+ a->setPriority(QAction::LowPriority);
a->setShortcut(QKeySequence::Print);
connect(a, SIGNAL(triggered()), this, SLOT(filePrint()));
tb->addAction(a);
menu->addAction(a);
- a = new QAction(QIcon(rsrcPath + "/fileprint.png"), tr("Print Preview..."), this);
+ a = new QAction(QIcon::fromTheme("fileprint", QIcon(rsrcPath + "/fileprint.png")),
+ tr("Print Preview..."), this);
connect(a, SIGNAL(triggered()), this, SLOT(filePrintPreview()));
menu->addAction(a);
- a = new QAction(QIcon(rsrcPath + "/exportpdf.png"), tr("&Export PDF..."), this);
+ a = new QAction(QIcon::fromTheme("exportpdf", QIcon(rsrcPath + "/exportpdf.png")),
+ tr("&Export PDF..."), this);
a->setPriority(QAction::LowPriority);
a->setShortcut(Qt::CTRL + Qt::Key_D);
connect(a, SIGNAL(triggered()), this, SLOT(filePrintPdf()));
@@ -218,32 +225,36 @@ void TextEdit::setupEditActions()
QToolBar *tb = new QToolBar(this);
tb->setWindowTitle(tr("Edit Actions"));
addToolBar(tb);
-
QMenu *menu = new QMenu(tr("&Edit"), this);
menuBar()->addMenu(menu);
QAction *a;
- a = actionUndo = new QAction(QIcon(rsrcPath + "/editundo.png"), tr("&Undo"), this);
+ a = actionUndo = new QAction(QIcon::fromTheme("edit-undo", QIcon(rsrcPath + "/editundo.png")),
+ tr("&Undo"), this);
a->setShortcut(QKeySequence::Undo);
tb->addAction(a);
menu->addAction(a);
- a = actionRedo = new QAction(QIcon(rsrcPath + "/editredo.png"), tr("&Redo"), this);
+ a = actionRedo = new QAction(QIcon::fromTheme("edit-redo", QIcon(rsrcPath + "/editredo.png")),
+ tr("&Redo"), this);
a->setPriority(QAction::LowPriority);
a->setShortcut(QKeySequence::Redo);
tb->addAction(a);
menu->addAction(a);
menu->addSeparator();
- a = actionCut = new QAction(QIcon(rsrcPath + "/editcut.png"), tr("Cu&t"), this);
+ a = actionCut = new QAction(QIcon::fromTheme("edit-cut", QIcon(rsrcPath + "/editcut.png")),
+ tr("Cu&t"), this);
a->setPriority(QAction::LowPriority);
a->setShortcut(QKeySequence::Cut);
tb->addAction(a);
menu->addAction(a);
- a = actionCopy = new QAction(QIcon(rsrcPath + "/editcopy.png"), tr("&Copy"), this);
+ a = actionCopy = new QAction(QIcon::fromTheme("edit-copy", QIcon(rsrcPath + "/editcopy.png")),
+ tr("&Copy"), this);
a->setPriority(QAction::LowPriority);
a->setShortcut(QKeySequence::Copy);
tb->addAction(a);
menu->addAction(a);
- a = actionPaste = new QAction(QIcon(rsrcPath + "/editpaste.png"), tr("&Paste"), this);
+ a = actionPaste = new QAction(QIcon::fromTheme("edit-paste", QIcon(rsrcPath + "/editpaste.png")),
+ tr("&Paste"), this);
a->setPriority(QAction::LowPriority);
a->setShortcut(QKeySequence::Paste);
tb->addAction(a);
@@ -260,10 +271,11 @@ void TextEdit::setupTextActions()
QMenu *menu = new QMenu(tr("F&ormat"), this);
menuBar()->addMenu(menu);
- actionTextBold = new QAction(QIcon(rsrcPath + "/textbold.png"), tr("&Bold"), this);
- actionTextBold->setPriority(QAction::LowPriority);
+ actionTextBold = new QAction(QIcon::fromTheme("format-text-bold", QIcon(rsrcPath + "/textbold.png")),
+ tr("&Bold"), this);
actionTextBold->setShortcut(Qt::CTRL + Qt::Key_B);
- QFont bold;
+ actionTextBold->setPriority(QAction::LowPriority);
+ QFont bold;
bold.setBold(true);
actionTextBold->setFont(bold);
connect(actionTextBold, SIGNAL(triggered()), this, SLOT(textBold()));
@@ -271,7 +283,8 @@ void TextEdit::setupTextActions()
menu->addAction(actionTextBold);
actionTextBold->setCheckable(true);
- actionTextItalic = new QAction(QIcon(rsrcPath + "/textitalic.png"), tr("&Italic"), this);
+ actionTextItalic = new QAction(QIcon::fromTheme("format-text-italic", QIcon(rsrcPath + "/textitalic.png")),
+ tr("&Italic"), this);
actionTextItalic->setPriority(QAction::LowPriority);
actionTextItalic->setShortcut(Qt::CTRL + Qt::Key_I);
QFont italic;
@@ -282,9 +295,10 @@ void TextEdit::setupTextActions()
menu->addAction(actionTextItalic);
actionTextItalic->setCheckable(true);
- actionTextUnderline = new QAction(QIcon(rsrcPath + "/textunder.png"), tr("&Underline"), this);
- actionTextUnderline->setPriority(QAction::LowPriority);
+ actionTextUnderline = new QAction(QIcon::fromTheme("format-text-underline", QIcon(rsrcPath + "/textunder.png")),
+ tr("&Underline"), this);
actionTextUnderline->setShortcut(Qt::CTRL + Qt::Key_U);
+ actionTextUnderline->setPriority(QAction::LowPriority);
QFont underline;
underline.setUnderline(true);
actionTextUnderline->setFont(underline);
@@ -300,15 +314,16 @@ void TextEdit::setupTextActions()
// Make sure the alignLeft is always left of the alignRight
if (QApplication::isLeftToRight()) {
- actionAlignLeft = new QAction(QIcon(rsrcPath + "/textleft.png"), tr("&Left"), grp);
- actionAlignCenter = new QAction(QIcon(rsrcPath + "/textcenter.png"), tr("C&enter"), grp);
- actionAlignRight = new QAction(QIcon(rsrcPath + "/textright.png"), tr("&Right"), grp);
+ actionAlignLeft = new QAction(QIcon::fromTheme("format-justify-left", QIcon(rsrcPath + "/textleft.png")),
+ tr("&Left"), grp);
+ actionAlignCenter = new QAction(QIcon::fromTheme("format-justify-center", QIcon(rsrcPath + "/textcenter.png")), tr("C&enter"), grp);
+ actionAlignRight = new QAction(QIcon::fromTheme("format-justify-right", QIcon(rsrcPath + "/textright.png")), tr("&Right"), grp);
} else {
- actionAlignRight = new QAction(QIcon(rsrcPath + "/textright.png"), tr("&Right"), grp);
- actionAlignCenter = new QAction(QIcon(rsrcPath + "/textcenter.png"), tr("C&enter"), grp);
- actionAlignLeft = new QAction(QIcon(rsrcPath + "/textleft.png"), tr("&Left"), grp);
+ actionAlignRight = new QAction(QIcon::fromTheme("format-justify-right", QIcon(rsrcPath + "/textright.png")), tr("&Right"), grp);
+ actionAlignCenter = new QAction(QIcon::fromTheme("format-justify-center", QIcon(rsrcPath + "/textcenter.png")), tr("C&enter"), grp);
+ actionAlignLeft = new QAction(QIcon::fromTheme("format-justify-left", QIcon(rsrcPath + "/textleft.png")), tr("&Left"), grp);
}
- actionAlignJustify = new QAction(QIcon(rsrcPath + "/textjustify.png"), tr("&Justify"), grp);
+ actionAlignJustify = new QAction(QIcon::fromTheme("format-justify-fill", QIcon(rsrcPath + "/textjustify.png")), tr("&Justify"), grp);
actionAlignLeft->setShortcut(Qt::CTRL + Qt::Key_L);
actionAlignLeft->setCheckable(true);
diff --git a/doc/src/containers.qdoc b/doc/src/containers.qdoc
index 11a4b0b54..2a3471649 100644
--- a/doc/src/containers.qdoc
+++ b/doc/src/containers.qdoc
@@ -682,7 +682,7 @@
\header \o{1,2} \o{2,1} Key lookup \o{2,1} Insertion
\header \o Average \o Worst case \o Average \o Worst case
\row \o QMap<Key, T> \o O(log \e n) \o O(log \e n) \o O(log \e n) \o O(log \e n)
- \row \o QMultiMap<Key, T> \o O((log \e n) \o O(log \e n) \o O(log \e n) \o O(log \e n)
+ \row \o QMultiMap<Key, T> \o O(log \e n) \o O(log \e n) \o O(log \e n) \o O(log \e n)
\row \o QHash<Key, T> \o Amort. O(1) \o O(\e n) \o Amort. O(1) \o O(\e n)
\row \o QSet<Key> \o Amort. O(1) \o O(\e n) \o Amort. O(1) \o O(\e n)
\endtable
diff --git a/doc/src/examples-overview.qdoc b/doc/src/examples-overview.qdoc
index 4313c436d..3db4a455d 100644
--- a/doc/src/examples-overview.qdoc
+++ b/doc/src/examples-overview.qdoc
@@ -238,6 +238,17 @@
These examples demonstrate the basic techniques used to take advantage of
OpenGL in Qt applications.
+ \section1 \l{Qt Examples#Multimedia}{Multimedia}
+
+ \l{Qt Examples#Multimedia}
+
+ Qt provides low-level audio support on linux,windows and mac platforms by default and
+ an audio plugin API to allow developers to implement there own audio support for
+ custom devices and platforms.
+
+ These examples demonstrate the basic techniques used to take advantage of
+ Audio API in Qt applications.
+
\section1 \l{Qt Examples#SQL}{SQL}
\l{Qt Examples#SQL}{\inlineimage sql-examples.png
diff --git a/doc/src/examples.qdoc b/doc/src/examples.qdoc
index e85acd134..7f9264b7a 100644
--- a/doc/src/examples.qdoc
+++ b/doc/src/examples.qdoc
@@ -255,6 +255,14 @@
\o \l{phonon/musicplayer}{Music Player}\raisedaster
\endlist
+ \section1 Multimedia
+
+ \list
+ \o \l{multimedia/audio/audiodevices}{Audio Devices}\raisedaster
+ \o \l{multimedia/audio/audiooutput}{Audio Output}\raisedaster
+ \o \l{multimedia/audio/audioinput}{Audio Input}\raisedaster
+ \endlist
+
\section1 Qt Designer
\list
@@ -322,6 +330,7 @@
\o \l{statemachine/eventtransitions}{Event Transitions}\raisedaster
\o \l{statemachine/factorial}{Factorial States}\raisedaster
\o \l{statemachine/pingpong}{Ping Pong States}\raisedaster
+ \o \l{statemachine/rogue}{Rogue}\raisedaster
\o \l{statemachine/trafficlight}{Traffic Light}\raisedaster
\o \l{statemachine/twowaybutton}{Two-way Button}\raisedaster
\endlist
diff --git a/doc/src/examples/audiodevices.qdoc b/doc/src/examples/audiodevices.qdoc
new file mode 100644
index 000000000..3b8cdd852
--- /dev/null
+++ b/doc/src/examples/audiodevices.qdoc
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example multimedia/audio/audiodevices
+ \title Audio Devices Example
+
+ The Audio Devices example demonstrates the basic use of QAudioDeviceInfo class
+ provided with Qt.
+
+ Qt provides the QAudioDeviceInfo class to enable audio querying within
+ a standard application user interface.
+
+ This example allows you to browse audio devices available and try out different
+ configurations to see if they are supported.
+*/
diff --git a/doc/src/examples/audioinput.qdoc b/doc/src/examples/audioinput.qdoc
new file mode 100644
index 000000000..5dfe76e07
--- /dev/null
+++ b/doc/src/examples/audioinput.qdoc
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example multimedia/audio/audioinput
+ \title AudioInput Example
+
+ The Audio Input example demonstrates the basic use of QAudioInput class
+ provided with Qt.
+
+ Qt provides the QAudioInput class to enable audio functionality within
+ a standard application user interface.
+
+ This example uses a fast-fourier transform on the input audio from the microphone
+ and displays the output.
+*/
diff --git a/doc/src/examples/audiooutput.qdoc b/doc/src/examples/audiooutput.qdoc
new file mode 100644
index 000000000..9c8a75f4b
--- /dev/null
+++ b/doc/src/examples/audiooutput.qdoc
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example multimedia/audio/audiooutput
+ \title Audio Output Example
+
+ The Audio Output example demonstrates the basic use of the QAudioOutput class
+ provided with Qt.
+
+ This example provides a tone generator to supply continuous audio playback.
+ The first button allows pause and resume of the playback.
+ The second button allows toggling between push and pull modes of operation.
+*/
diff --git a/doc/src/examples/rogue.qdoc b/doc/src/examples/rogue.qdoc
new file mode 100644
index 000000000..8fa2c6924
--- /dev/null
+++ b/doc/src/examples/rogue.qdoc
@@ -0,0 +1,222 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example statemachine/rogue
+ \title Rogue Example
+
+ The Rogue example shows how to use the Qt state machine for event
+ handling.
+
+ \image rogue-example.png
+
+ This example implements a simple text based game. Do you see the
+ \c{@} in the screenshot? That's you, the rogue. The \c{#}
+ characters are walls, and the dots represent floor. In a real
+ game, other ASCII characters would represent all kinds of objects
+ and creatures. For instance, ancient dragons (\c{D}'s) or food
+ rations (\c{%}'s). But let's not get carried away. In this game,
+ the rogue is simply running around in an empty room.
+
+ The rogue is moved with the keypad (2, 4, 8, 6). That aside, we
+ have implemented a \c quit command that triggers if the player
+ types \c {q}. The player is then asked if he/she really wants to
+ quit.
+
+ Most games have commands that need more than one key press and
+ that may require a different sequence of keys based on questions
+ asked the user. In this game, only the \c quit command falls under
+ this category, but for the sake of argument, let's imagine a
+ fully-fledged game with a rich set of commands. If we were to
+ implement these by catching key events in
+ \l{QWidget::}{keyPressEvent()}, we would have to keep a lot of
+ class member variables to track the sequence of keys already typed
+ (or find some other way of deducing the current state of a
+ command). This can easily lead to spaghetti, which is--as we all
+ well know, I'm sure--unpleasant. With a state machine, on the
+ other hand, separate states can wait for a single key press, and
+ that makes our lives a lot simpler.
+
+ The example consists of two classes:
+
+ \list
+ \o \c Window draws the text display of the game and sets
+ up the state machine. The window also has a status bar
+ above the area in which the rouge moves.
+ \o \c MovementTransition is a transition that carries out
+ a single move of the rogue.
+ \endlist
+
+ Before we embark on a code walkthrough, it is necessary to take a
+ closer look at the design of the machine. Here is a state chart
+ that shows what we want to achieve:
+
+ \image rogue-statechart.png
+
+ The input state waits for a key press to start a new command.
+ When receiving a key it recognizes, it transitions to one of the
+ two commands of the game; though, as we will see, movement is
+ handled by the transition itself. The quit state waits for the
+ player to answer yes or no (by typing \c y or \c n) when asked
+ whether he/she really wants to quit the game.
+
+ The chart demonstrates how we use one state to wait for a single
+ key press. The press received may trigger one of the transitions
+ connected to the state.
+
+ \section1 Window Class Definition
+
+ The \c Window class is a widget that draws the text display of the
+ game. It also sets up the state machine, i.e., creates and
+ connects the states in the machine. It is the key events from this
+ widget that are used by the machine.
+
+ \snippet examples/statemachine/rogue/window.h 0
+
+ \c Direction specifies the direction in which the rogue is to
+ move. We use this in \c movePlayer(), which moves the rogue and
+ repaints the window. The game has a status line above the area in
+ which the rogue moves. The \c status property contains the text of
+ this line. We use a property because the QState class allows
+ setting any Qt \l{Qt's Property System}{property} when entered.
+ More on this later.
+
+ \snippet examples/statemachine/rogue/window.h 1
+
+ The \c map is an array with the characters that are currently
+ displayed. We set up the array in \c setupMap(), and update it
+ when the rogue is moved. \c pX and \c pY is the current position
+ of the rogue. \c WIDTH and \c HEIGHT are macros specifying the
+ dimensions of the map.
+
+ The \c paintEvent() function is left out of this walkthrough. We
+ also do not discuss other code that does not concern the state
+ machine (the \c setupMap(), \c status(), \c setStatus(), \c
+ movePlayer(), and \c sizeHint() functions). If you wish to take a
+ look at the code, click on the link for the \c window.cpp file at
+ the top of this page.
+
+ \section1 Window Class Implementation
+
+ Here is the constructor of \c Window:
+
+ \snippet examples/statemachine/rogue/window.cpp 0
+ \dots
+ \snippet examples/statemachine/rogue/window.cpp 1
+
+ The player starts off at position (5, 5). We then set up the map
+ and statemachine. Let's proceed with the \c buildMachine()
+ function:
+
+ \snippet examples/statemachine/rogue/window.cpp 2
+
+ We enter \c inputState when the machine is started and from the \c
+ quitState if the user wants to continue playing. We then set the
+ status to a helpful reminder of how to play the game.
+
+ First, the \c Movement transition is added to the input state.
+ This will enable the rogue to be moved with the keypad. Notice
+ that we don't set a target state for the movement transition. This
+ will cause the transition to be triggered (and the
+ \l{QAbstractTransition::}{onTransition()} function to be invoked),
+ but the machine will not leave the \c inputState. If we had set \c
+ inputState as the target state, we would first have left and then
+ entered the \c inputState again.
+
+ \snippet examples/statemachine/rogue/window.cpp 3
+
+ When we enter \c quitState, we update the status bar of the
+ window.
+
+ \c QKeyEventTransition is a utility class that removes the hassle
+ of implementing transitions for \l{QKeyEvent}s. We simply need to
+ specify the key on which the transition should trigger and the
+ target state of the transition.
+
+ \snippet examples/statemachine/rogue/window.cpp 4
+
+ The transition from \c inputState allows triggering the quit state
+ when the player types \c {q}.
+
+ \snippet examples/statemachine/rogue/window.cpp 5
+
+ The machine is set up, so it's time to start it.
+
+ \section1 The MovementTransition Class
+
+ \c MovementTransition is triggered when the player request the
+ rogue to be moved (by typing 2, 4, 6, or 8) when the machine is in
+ the \c inputState.
+
+ \snippet examples/statemachine/rogue/movementtransition.h 0
+
+ In the constructor, we tell QEventTransition to only send
+ \l{QEvent::}{KeyPress} events to the
+ \l{QAbstractTransition::}{eventTest()} function:
+
+ \snippet examples/statemachine/rogue/movementtransition.h 1
+
+ The KeyPress events come wrapped in \l{QWrappedEvent}s. \c event
+ must be confirmed to be a wrapped event because Qt uses other
+ events internally. After that, it is simply a matter of checking
+ which key has been pressed.
+
+ Let's move on to the \c onTransition() function:
+
+ \snippet examples/statemachine/rogue/movementtransition.h 2
+
+ When \c onTransition() is invoked, we know that we have a
+ \l{QEvent::}{KeyPress} event with 2, 4, 6, or 8, i.e., the event
+ is already unwrapped.
+
+ \section1 The Roguelike Tradition
+
+ You might have been wondering why the game features a rogue. Well,
+ these kinds of text based dungeon exploration games date back to a
+ game called, yes, "Rogue". Although outflanked by the technology
+ of modern 3D computer games, roguelikes have a solid community of
+ hard-core, devoted followers.
+
+ Playing these games can be surprisingly addictive (despite the
+ lack of graphics). Angband, the perhaps most well-known rougelike,
+ is found here: \l{http://rephial.org/}.
+*/
+
diff --git a/doc/src/images/rogue-example.png b/doc/src/images/rogue-example.png
new file mode 100644
index 000000000..7aeb0e54f
--- /dev/null
+++ b/doc/src/images/rogue-example.png
Binary files differ
diff --git a/doc/src/images/rogue-statechart.png b/doc/src/images/rogue-statechart.png
new file mode 100644
index 000000000..c5f404892
--- /dev/null
+++ b/doc/src/images/rogue-statechart.png
Binary files differ
diff --git a/doc/src/qmake-manual.qdoc b/doc/src/qmake-manual.qdoc
index 0921ae77e..211d7e937 100644
--- a/doc/src/qmake-manual.qdoc
+++ b/doc/src/qmake-manual.qdoc
@@ -558,7 +558,8 @@
\o \c -makefile \BR
\c qmake output will be a Makefile.
\o \c -project \BR
- \c qmake output will be a project file.
+ \c qmake output will be a project file. \BR
+\bold{Note:} It is likely that the created file will need to be edited for example adding the \c QT variable to suit what modules are required for the project.
\endlist
The following \c options are used to specify both general and mode-specific
diff --git a/doc/src/qsqldatatype-table.qdoc b/doc/src/qsqldatatype-table.qdoc
index 2055e6aba..bc88c30a5 100644
--- a/doc/src/qsqldatatype-table.qdoc
+++ b/doc/src/qsqldatatype-table.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the documentation of the Qt Toolkit.
**
diff --git a/doc/src/snippets/code/src_gui_image_qicon.cpp b/doc/src/snippets/code/src_gui_image_qicon.cpp
index 2b7c89315..455fd843e 100644
--- a/doc/src/snippets/code/src_gui_image_qicon.cpp
+++ b/doc/src/snippets/code/src_gui_image_qicon.cpp
@@ -20,3 +20,12 @@ void MyWidget::drawIcon(QPainter *painter, QPoint pos)
painter->drawPixmap(pos, pixmap);
}
//! [2]
+
+//! [3]
+ QIcon undoicon = QIcon::fromTheme("edit-undo");
+//! [3]
+
+//! [4]
+ QIcon undoicon = QIcon::fromTheme("edit-undo", QIcon(":/undo.png"));
+//! [4]
+
diff --git a/examples/examples.pro b/examples/examples.pro
index 5855e4f38..e6cece9da 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -26,6 +26,7 @@ SUBDIRS = \
multitouch \
gestures
+contains(QT_CONFIG, multimedia):!static: SUBDIRS += multimedia
contains(QT_CONFIG, phonon):!static: SUBDIRS += phonon
contains(QT_CONFIG, webkit): SUBDIRS += webkit
embedded:SUBDIRS += qws
diff --git a/examples/gestures/imageviewer/imagewidget.cpp b/examples/gestures/imageviewer/imagewidget.cpp
index 99889ed4f..c0d1e2d2b 100644
--- a/examples/gestures/imageviewer/imagewidget.cpp
+++ b/examples/gestures/imageviewer/imagewidget.cpp
@@ -67,6 +67,7 @@ ImageWidget::ImageWidget(QWidget *parent)
tapAndHoldGesture = new TapAndHoldGesture(this);
connect(tapAndHoldGesture, SIGNAL(triggered()), this, SLOT(gestureTriggered()));
+ connect(tapAndHoldGesture, SIGNAL(finished()), this, SLOT(gestureTriggered()));
}
void ImageWidget::paintEvent(QPaintEvent*)
@@ -112,7 +113,7 @@ void ImageWidget::paintEvent(QPaintEvent*)
touchFeedback.position + QPoint(-10, 10),
touchFeedback.position + QPoint(-15, 0)
};
- for (int i = 0; i < (touchFeedback.tapAndHoldState-20)/10; ++i)
+ for (int i = 0; i < touchFeedback.tapAndHoldState/5; ++i)
p.drawEllipse(pts[i], 3, 3);
}
} else if (touchFeedback.sliding) {
@@ -156,10 +157,9 @@ void ImageWidget::mouseDoubleClickEvent(QMouseEvent *event)
void ImageWidget::gestureTriggered()
{
- touchFeedback.tapped = false;
- touchFeedback.doubleTapped = false;
-
if (sender() == panGesture) {
+ touchFeedback.tapped = false;
+ touchFeedback.doubleTapped = false;
QPanGesture *pg = qobject_cast<QPanGesture*>(sender());
if (zoomedIn) {
#ifndef QT_NO_CURSOR
@@ -174,7 +174,6 @@ void ImageWidget::gestureTriggered()
#endif
horizontalOffset += pg->lastOffset().width();
verticalOffset += pg->lastOffset().height();
- update();
} else {
// only slide gesture should be accepted
if (pg->state() == Qt::GestureFinished) {
@@ -187,6 +186,7 @@ void ImageWidget::gestureTriggered()
updateImage();
}
}
+ update();
feedbackFadeOutTimer.start(500, this);
} else if (sender() == tapAndHoldGesture) {
if (tapAndHoldGesture->state() == Qt::GestureFinished) {
@@ -199,6 +199,9 @@ void ImageWidget::gestureTriggered()
menu.addAction("Action 2");
menu.addAction("Action 3");
menu.exec(mapToGlobal(tapAndHoldGesture->pos()));
+ } else {
+ ++touchFeedback.tapAndHoldState;
+ update();
}
feedbackFadeOutTimer.start(500, this);
}
diff --git a/examples/gestures/imageviewer/tapandholdgesture.cpp b/examples/gestures/imageviewer/tapandholdgesture.cpp
index ff5284e45..5fe52ccbc 100644
--- a/examples/gestures/imageviewer/tapandholdgesture.cpp
+++ b/examples/gestures/imageviewer/tapandholdgesture.cpp
@@ -43,6 +43,8 @@
#include <QtGui/qevent.h>
+// #define TAPANDHOLD_USING_MOUSE
+
/*!
\class TapAndHoldGesture
\since 4.6
@@ -95,6 +97,26 @@ bool TapAndHoldGesture::filterEvent(QEvent *event)
case QEvent::TouchEnd:
reset();
break;
+#ifdef TAPANDHOLD_USING_MOUSE
+ case QEvent::MouseButtonPress: {
+ if (timer.isActive())
+ timer.stop();
+ timer.start(TapAndHoldGesture::iterationTimeout, this);
+ const QPoint p = static_cast<QMouseEvent*>(event)->pos();
+ position = startPosition = p;
+ break;
+ }
+ case QEvent::MouseMove: {
+ const QPoint startPos = startPosition;
+ const QPoint pos = static_cast<QMouseEvent*>(event)->pos();
+ if ((startPos - pos).manhattanLength() > 15)
+ reset();
+ break;
+ }
+ case QEvent::MouseButtonRelease:
+ reset();
+ break;
+#endif // TAPANDHOLD_USING_MOUSE
default:
break;
}
@@ -108,11 +130,9 @@ void TapAndHoldGesture::timerEvent(QTimerEvent *event)
return;
if (iteration == TapAndHoldGesture::iterationCount) {
timer.stop();
- setState(Qt::GestureFinished);
- emit triggered();
+ updateState(Qt::GestureFinished);
} else {
- setState(Qt::GestureStarted);
- emit triggered();
+ updateState(Qt::GestureUpdated);
}
++iteration;
}
@@ -120,11 +140,10 @@ void TapAndHoldGesture::timerEvent(QTimerEvent *event)
/*! \internal */
void TapAndHoldGesture::reset()
{
- if (state() != Qt::NoGesture)
- emit cancelled();
- setState(Qt::NoGesture);
timer.stop();
iteration = 0;
+ position = startPosition = QPoint();
+ updateState(Qt::NoGesture);
}
/*!
diff --git a/examples/gestures/imageviewer/tapandholdgesture.h b/examples/gestures/imageviewer/tapandholdgesture.h
index e0d50b560..61fabc229 100644
--- a/examples/gestures/imageviewer/tapandholdgesture.h
+++ b/examples/gestures/imageviewer/tapandholdgesture.h
@@ -66,6 +66,7 @@ private:
QBasicTimer timer;
int iteration;
QPoint position;
+ QPoint startPosition;
static const int iterationCount;
static const int iterationTimeout;
};
diff --git a/examples/itemviews/frozencolumn/freezetablewidget.h b/examples/itemviews/frozencolumn/freezetablewidget.h
index e22660ef8..f7b8e432e 100644
--- a/examples/itemviews/frozencolumn/freezetablewidget.h
+++ b/examples/itemviews/frozencolumn/freezetablewidget.h
@@ -39,7 +39,6 @@
**
****************************************************************************/
-
#ifndef FREEZETABLEWIDGET_H
#define FREEZETABLEWIDGET_H
diff --git a/examples/itemviews/frozencolumn/main.cpp b/examples/itemviews/frozencolumn/main.cpp
index 8ed9d3b32..9f6a63743 100644
--- a/examples/itemviews/frozencolumn/main.cpp
+++ b/examples/itemviews/frozencolumn/main.cpp
@@ -39,7 +39,6 @@
**
****************************************************************************/
-
#include <QApplication>
#include <QStandardItemModel>
#include <QFile>
diff --git a/examples/multimedia/README b/examples/multimedia/README
new file mode 100644
index 000000000..aa78e369f
--- /dev/null
+++ b/examples/multimedia/README
@@ -0,0 +1,34 @@
+
+The example launcher provided with Qt can be used to explore each of the
+examples in this directory.
+
+Documentation for these examples can be found via the Tutorial and Examples
+link in the main Qt documentation.
+
+
+Finding the Qt Examples and Demos launcher
+==========================================
+
+On Windows:
+
+The launcher can be accessed via the Windows Start menu. Select the menu
+entry entitled "Qt Examples and Demos" entry in the submenu containing
+the Qt tools.
+
+On Mac OS X:
+
+For the binary distribution, the qtdemo executable is installed in the
+/Developer/Applications/Qt directory. For the source distribution, it is
+installed alongside the other Qt tools on the path specified when Qt is
+configured.
+
+On Unix/Linux:
+
+The qtdemo executable is installed alongside the other Qt tools on the path
+specified when Qt is configured.
+
+On all platforms:
+
+The source code for the launcher can be found in the demos/qtdemo directory
+in the Qt package. This example is built at the same time as the Qt libraries,
+tools, examples, and demonstrations.
diff --git a/examples/multimedia/audio/audio.pro b/examples/multimedia/audio/audio.pro
new file mode 100644
index 000000000..c64bb34c6
--- /dev/null
+++ b/examples/multimedia/audio/audio.pro
@@ -0,0 +1,10 @@
+TEMPLATE = subdirs
+SUBDIRS = audioinput \
+ audiooutput \
+ audiodevices
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS audio.pro README
+sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio
+INSTALLS += target sources
diff --git a/examples/multimedia/audio/audiodevices/audiodevices.cpp b/examples/multimedia/audio/audiodevices/audiodevices.cpp
new file mode 100644
index 000000000..2a3af9877
--- /dev/null
+++ b/examples/multimedia/audio/audiodevices/audiodevices.cpp
@@ -0,0 +1,272 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QDebug>
+#include <QAudioDeviceInfo>
+
+#include "audiodevices.h"
+
+AudioDevicesBase::AudioDevicesBase( QMainWindow *parent, Qt::WFlags f )
+{
+ Q_UNUSED(parent)
+ Q_UNUSED(f)
+ setupUi( this );
+}
+
+AudioDevicesBase::~AudioDevicesBase() {}
+
+
+AudioTest::AudioTest( QMainWindow *parent, Qt::WFlags f )
+ : AudioDevicesBase( parent, f )
+{
+ mode = QAudio::AudioOutput;
+ modeBox->addItem("Input");
+ modeBox->addItem("Output");
+
+ connect(testButton,SIGNAL(clicked()),SLOT(test()));
+ connect(modeBox,SIGNAL(activated(int)),SLOT(modeChanged(int)));
+ connect(deviceBox,SIGNAL(activated(int)),SLOT(deviceChanged(int)));
+ connect(frequencyBox,SIGNAL(activated(int)),SLOT(freqChanged(int)));
+ connect(channelsBox,SIGNAL(activated(int)),SLOT(channelChanged(int)));
+ connect(codecsBox,SIGNAL(activated(int)),SLOT(codecChanged(int)));
+ connect(sampleSizesBox,SIGNAL(activated(int)),SLOT(sampleSizeChanged(int)));
+ connect(sampleTypesBox,SIGNAL(activated(int)),SLOT(sampleTypeChanged(int)));
+ connect(endianBox,SIGNAL(activated(int)),SLOT(endianChanged(int)));
+
+ device = 0;
+
+ modeBox->setCurrentIndex(0);
+ modeChanged(0);
+ deviceBox->setCurrentIndex(0);
+ deviceChanged(0);
+}
+
+AudioTest::~AudioTest()
+{
+}
+
+void AudioTest::test()
+{
+ // tries to set all the settings picked.
+
+ if(device) {
+ if(device->isFormatSupported(settings)) {
+ logOutput->append("Success");
+ nearestFreq->setText("");
+ nearestChannel->setText("");
+ nearestCodec->setText("");
+ nearestSampleSize->setText("");
+ nearestSampleType->setText("");
+ nearestEndian->setText("");
+ } else {
+ QAudioFormat nearest = device->nearestFormat(settings);
+ logOutput->append(tr("Failed"));
+ nearestFreq->setText(QString("%1").arg(nearest.frequency()));
+ nearestChannel->setText(QString("%1").arg(nearest.channels()));
+ nearestCodec->setText(nearest.codec());
+ nearestSampleSize->setText(QString("%1").arg(nearest.sampleSize()));
+
+ switch(nearest.sampleType()) {
+ case QAudioFormat::SignedInt:
+ nearestSampleType->setText("SignedInt");
+ break;
+ case QAudioFormat::UnSignedInt:
+ nearestSampleType->setText("UnSignedInt");
+ break;
+ case QAudioFormat::Float:
+ nearestSampleType->setText("Float");
+ break;
+ case QAudioFormat::Unknown:
+ nearestSampleType->setText("Unknown");
+ }
+ switch(nearest.byteOrder()) {
+ case QAudioFormat::LittleEndian:
+ nearestEndian->setText("LittleEndian");
+ break;
+ case QAudioFormat::BigEndian:
+ nearestEndian->setText("BigEndian");
+ }
+ }
+ }
+ else
+ logOutput->append("No Device");
+}
+
+void AudioTest::modeChanged(int idx)
+{
+ // mode has changed
+ if(idx == 0)
+ mode=QAudio::AudioInput;
+ else
+ mode=QAudio::AudioOutput;
+
+ deviceBox->clear();
+ QList<QAudioDeviceId> devices = QAudioDeviceInfo::deviceList(mode);
+ for(int i = 0; i < devices.size(); ++i) {
+ deviceBox->addItem(QAudioDeviceInfo(devices.at(i)).deviceName(), qVariantFromValue(devices.at(i)));
+ }
+}
+
+void AudioTest::deviceChanged(int idx)
+{
+ delete device;
+ device = 0;
+
+ if (deviceBox->count() == 0)
+ return;
+
+ // device has changed
+ deviceHandle = deviceBox->itemData(idx).value<QAudioDeviceId>();
+ device = new QAudioDeviceInfo(deviceHandle, this);
+
+ frequencyBox->clear();
+ QList<int> freqz = device->supportedFrequencies();
+ for(int i = 0; i < freqz.size(); ++i)
+ frequencyBox->addItem(QString("%1").arg(freqz.at(i)));
+ if(freqz.size())
+ settings.setFrequency(freqz.at(0));
+
+ channelsBox->clear();
+ QList<int> chz = device->supportedChannels();
+ for(int i = 0; i < chz.size(); ++i)
+ channelsBox->addItem(QString("%1").arg(chz.at(i)));
+ if(chz.size())
+ settings.setChannels(chz.at(0));
+
+ codecsBox->clear();
+ QStringList codecz = device->supportedCodecs();
+ for(int i = 0; i < codecz.size(); ++i)
+ codecsBox->addItem(QString("%1").arg(codecz.at(i)));
+ if(codecz.size())
+ settings.setCodec(codecz.at(0));
+ // Add false to create failed condition!
+ codecsBox->addItem("audio/mpeg");
+
+ sampleSizesBox->clear();
+ QList<int> sampleSizez = device->supportedSampleSizes();
+ for(int i = 0; i < sampleSizez.size(); ++i)
+ sampleSizesBox->addItem(QString("%1").arg(sampleSizez.at(i)));
+ if(sampleSizez.size())
+ settings.setSampleSize(sampleSizez.at(0));
+
+ sampleTypesBox->clear();
+ QList<QAudioFormat::SampleType> sampleTypez = device->supportedSampleTypes();
+ for(int i = 0; i < sampleTypez.size(); ++i) {
+ switch(sampleTypez.at(i)) {
+ case QAudioFormat::SignedInt:
+ sampleTypesBox->addItem("SignedInt");
+ break;
+ case QAudioFormat::UnSignedInt:
+ sampleTypesBox->addItem("UnSignedInt");
+ break;
+ case QAudioFormat::Float:
+ sampleTypesBox->addItem("Float");
+ break;
+ case QAudioFormat::Unknown:
+ sampleTypesBox->addItem("Unknown");
+ }
+ if(sampleTypez.size())
+ settings.setSampleType(sampleTypez.at(0));
+ }
+
+ endianBox->clear();
+ QList<QAudioFormat::Endian> endianz = device->supportedByteOrders();
+ for(int i = 0; i < endianz.size(); ++i) {
+ switch(endianz.at(i)) {
+ case QAudioFormat::LittleEndian:
+ endianBox->addItem("Little Endian");
+ break;
+ case QAudioFormat::BigEndian:
+ endianBox->addItem("Big Endian");
+ break;
+ }
+ }
+ if(endianz.size())
+ settings.setByteOrder(endianz.at(0));
+}
+
+void AudioTest::freqChanged(int idx)
+{
+ // freq has changed
+ settings.setFrequency(frequencyBox->itemText(idx).toInt());
+}
+
+void AudioTest::channelChanged(int idx)
+{
+ settings.setChannels(channelsBox->itemText(idx).toInt());
+}
+
+void AudioTest::codecChanged(int idx)
+{
+ settings.setCodec(codecsBox->itemText(idx));
+}
+
+void AudioTest::sampleSizeChanged(int idx)
+{
+ settings.setSampleSize(sampleSizesBox->itemText(idx).toInt());
+}
+
+void AudioTest::sampleTypeChanged(int idx)
+{
+ switch(sampleTypesBox->itemText(idx).toInt()) {
+ case QAudioFormat::SignedInt:
+ settings.setSampleType(QAudioFormat::SignedInt);
+ break;
+ case QAudioFormat::UnSignedInt:
+ settings.setSampleType(QAudioFormat::UnSignedInt);
+ break;
+ case QAudioFormat::Float:
+ settings.setSampleType(QAudioFormat::Float);
+ }
+}
+
+void AudioTest::endianChanged(int idx)
+{
+ switch(endianBox->itemText(idx).toInt()) {
+ case QAudioFormat::LittleEndian:
+ settings.setByteOrder(QAudioFormat::LittleEndian);
+ break;
+ case QAudioFormat::BigEndian:
+ settings.setByteOrder(QAudioFormat::BigEndian);
+ }
+}
+
diff --git a/examples/multimedia/audio/audiodevices/audiodevices.h b/examples/multimedia/audio/audiodevices/audiodevices.h
new file mode 100644
index 000000000..34a531b1f
--- /dev/null
+++ b/examples/multimedia/audio/audiodevices/audiodevices.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QObject>
+#include <QMainWindow>
+#include <QAudioDeviceInfo>
+
+#include "ui_audiodevicesbase.h"
+
+class AudioDevicesBase : public QMainWindow, public Ui::AudioDevicesBase
+{
+public:
+ AudioDevicesBase( QMainWindow *parent = 0, Qt::WFlags f = 0 );
+ virtual ~AudioDevicesBase();
+};
+
+class AudioTest : public AudioDevicesBase
+{
+ Q_OBJECT
+public:
+ AudioTest( QMainWindow *parent = 0, Qt::WFlags f = 0 );
+ virtual ~AudioTest();
+
+ QAudioDeviceId deviceHandle;
+ QAudioDeviceInfo* device;
+ QAudioFormat settings;
+ QAudio::Mode mode;
+
+private slots:
+ void modeChanged(int idx);
+ void deviceChanged(int idx);
+ void freqChanged(int idx);
+ void channelChanged(int idx);
+ void codecChanged(int idx);
+ void sampleSizeChanged(int idx);
+ void sampleTypeChanged(int idx);
+ void endianChanged(int idx);
+ void test();
+};
+
diff --git a/examples/multimedia/audio/audiodevices/audiodevices.pro b/examples/multimedia/audio/audiodevices/audiodevices.pro
new file mode 100644
index 000000000..adc489091
--- /dev/null
+++ b/examples/multimedia/audio/audiodevices/audiodevices.pro
@@ -0,0 +1,12 @@
+HEADERS = audiodevices.h
+SOURCES = audiodevices.cpp \
+ main.cpp
+FORMS += audiodevicesbase.ui
+
+QT += multimedia
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio/audiodevices
+sources.files = $$SOURCES *.h $$RESOURCES $$FORMS audiodevices.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio/audiodevices
+INSTALLS += target sources
diff --git a/examples/multimedia/audio/audiodevices/audiodevicesbase.ui b/examples/multimedia/audio/audiodevices/audiodevicesbase.ui
new file mode 100644
index 000000000..674f2014f
--- /dev/null
+++ b/examples/multimedia/audio/audiodevices/audiodevicesbase.ui
@@ -0,0 +1,255 @@
+<ui version="4.0" >
+ <class>AudioDevicesBase</class>
+ <widget class="QMainWindow" name="AudioDevicesBase" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>504</width>
+ <height>702</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>AudioDevicesBase</string>
+ </property>
+ <widget class="QWidget" name="centralwidget" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>28</y>
+ <width>504</width>
+ <height>653</height>
+ </rect>
+ </property>
+ <widget class="QWidget" name="layoutWidget" >
+ <property name="geometry" >
+ <rect>
+ <x>40</x>
+ <y>21</y>
+ <width>321</width>
+ <height>506</height>
+ </rect>
+ </property>
+ <layout class="QGridLayout" name="gridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="deviceLabel" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>Device</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" >
+ <widget class="QLabel" name="modeLabel" >
+ <property name="text" >
+ <string>Mode</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QComboBox" name="deviceBox" />
+ </item>
+ <item row="1" column="1" >
+ <widget class="QComboBox" name="modeBox" />
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="actualLabel" >
+ <property name="frameShape" >
+ <enum>QFrame::Panel</enum>
+ </property>
+ <property name="frameShadow" >
+ <enum>QFrame::Raised</enum>
+ </property>
+ <property name="text" >
+ <string>Actual Settings</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" >
+ <widget class="QLabel" name="nearestLabel" >
+ <property name="frameShape" >
+ <enum>QFrame::Panel</enum>
+ </property>
+ <property name="frameShadow" >
+ <enum>QFrame::Raised</enum>
+ </property>
+ <property name="text" >
+ <string>Nearest Settings</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <widget class="QLabel" name="actualFreqLabel" >
+ <property name="text" >
+ <string>Frequency</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1" >
+ <widget class="QLabel" name="nearestFreqLabel" >
+ <property name="text" >
+ <string>Frequency</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0" >
+ <widget class="QComboBox" name="frequencyBox" />
+ </item>
+ <item row="4" column="1" >
+ <widget class="QLineEdit" name="nearestFreq" />
+ </item>
+ <item row="5" column="0" >
+ <widget class="QLabel" name="actualChannelsLabel" >
+ <property name="text" >
+ <string>Channels</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1" >
+ <widget class="QLabel" name="nearestChannelLabel" >
+ <property name="text" >
+ <string>Channel</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="0" >
+ <widget class="QComboBox" name="channelsBox" />
+ </item>
+ <item row="6" column="1" >
+ <widget class="QLineEdit" name="nearestChannel" />
+ </item>
+ <item row="7" column="0" >
+ <widget class="QLabel" name="actualCodecLabel" >
+ <property name="text" >
+ <string>Codecs</string>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="1" >
+ <widget class="QLabel" name="nearestCodecLabel" >
+ <property name="text" >
+ <string>Codec</string>
+ </property>
+ </widget>
+ </item>
+ <item row="8" column="0" >
+ <widget class="QComboBox" name="codecsBox" />
+ </item>
+ <item row="8" column="1" >
+ <widget class="QLineEdit" name="nearestCodec" />
+ </item>
+ <item row="9" column="0" >
+ <widget class="QLabel" name="actualSampleSizeLabel" >
+ <property name="text" >
+ <string>SampleSize</string>
+ </property>
+ </widget>
+ </item>
+ <item row="9" column="1" >
+ <widget class="QLabel" name="nearestSampleSizeLabel" >
+ <property name="text" >
+ <string>SampleSize</string>
+ </property>
+ </widget>
+ </item>
+ <item row="10" column="0" >
+ <widget class="QComboBox" name="sampleSizesBox" />
+ </item>
+ <item row="10" column="1" >
+ <widget class="QLineEdit" name="nearestSampleSize" />
+ </item>
+ <item row="11" column="0" >
+ <widget class="QLabel" name="actualSampleTypeLabel" >
+ <property name="text" >
+ <string>SampleType</string>
+ </property>
+ </widget>
+ </item>
+ <item row="11" column="1" >
+ <widget class="QLabel" name="nearestSampleTypeLabel" >
+ <property name="text" >
+ <string>SampleType</string>
+ </property>
+ </widget>
+ </item>
+ <item row="12" column="0" >
+ <widget class="QComboBox" name="sampleTypesBox" />
+ </item>
+ <item row="12" column="1" >
+ <widget class="QLineEdit" name="nearestSampleType" />
+ </item>
+ <item row="13" column="0" >
+ <widget class="QLabel" name="actualEndianLabel" >
+ <property name="text" >
+ <string>Endianess</string>
+ </property>
+ </widget>
+ </item>
+ <item row="13" column="1" >
+ <widget class="QLabel" name="nearestEndianLabel" >
+ <property name="text" >
+ <string>Endianess</string>
+ </property>
+ </widget>
+ </item>
+ <item row="14" column="0" >
+ <widget class="QComboBox" name="endianBox" />
+ </item>
+ <item row="14" column="1" >
+ <widget class="QLineEdit" name="nearestEndian" />
+ </item>
+ <item row="15" column="0" colspan="2" >
+ <widget class="QTextEdit" name="logOutput" >
+ <property name="minimumSize" >
+ <size>
+ <width>0</width>
+ <height>40</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item row="16" column="0" colspan="2" >
+ <widget class="QPushButton" name="testButton" >
+ <property name="text" >
+ <string>Test</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ <widget class="QMenuBar" name="menubar" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>504</width>
+ <height>28</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QStatusBar" name="statusbar" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>681</y>
+ <width>504</width>
+ <height>21</height>
+ </rect>
+ </property>
+ </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/examples/multimedia/audio/audiodevices/main.cpp b/examples/multimedia/audio/audiodevices/main.cpp
new file mode 100644
index 000000000..12e413ea4
--- /dev/null
+++ b/examples/multimedia/audio/audiodevices/main.cpp
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "audiodevices.h"
+
+int main(int argv, char **args)
+{
+ QApplication app(argv, args);
+ app.setApplicationName("Audio Device Test");
+
+ AudioTest audio;
+ audio.show();
+
+ return app.exec();
+}
diff --git a/examples/multimedia/audio/audioinput/audioinput.cpp b/examples/multimedia/audio/audioinput/audioinput.cpp
new file mode 100644
index 000000000..ae7d84c2f
--- /dev/null
+++ b/examples/multimedia/audio/audioinput/audioinput.cpp
@@ -0,0 +1,376 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <stdlib.h>
+#include <math.h>
+
+#include <QDebug>
+#include <QPainter>
+#include <QVBoxLayout>
+
+#include <QAudioDeviceInfo>
+#include <QAudioInput>
+#include "audioinput.h"
+
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+
+Spectrum::Spectrum(QObject* parent, QAudioInput* device, float* out)
+ :QIODevice( parent )
+{
+ input = device;
+ output = out;
+
+ unsigned int i;
+
+ // Allocate sample buffer and initialize sin and cos lookup tables
+ fftState = (fft_state *) malloc (sizeof(fft_state));
+
+ for(i = 0; i < BUFFER_SIZE; i++) {
+ bitReverse[i] = reverseBits(i);
+ }
+ for(i = 0; i < BUFFER_SIZE / 2; i++) {
+ float j = 2 * M_PI * i / BUFFER_SIZE;
+ costable[i] = cos(j);
+ sintable[i] = sin(j);
+ }
+}
+
+Spectrum::~Spectrum()
+{
+}
+
+void Spectrum::start()
+{
+ open(QIODevice::WriteOnly);
+}
+
+void Spectrum::stop()
+{
+ close();
+}
+
+qint64 Spectrum::readData(char *data, qint64 maxlen)
+{
+ Q_UNUSED(data)
+ Q_UNUSED(maxlen)
+
+ return 0;
+}
+
+qint64 Spectrum::writeData(const char *data, qint64 len)
+{
+ performFFT((sound_sample*)data);
+ emit update();
+
+ return len;
+}
+
+int Spectrum::reverseBits(unsigned int initial) {
+ // BIT-REVERSE-COPY(a,A)
+
+ unsigned int reversed = 0, loop;
+ for(loop = 0; loop < BUFFER_SIZE_LOG; loop++) {
+ reversed <<= 1;
+ reversed += (initial & 1);
+ initial >>= 1;
+ }
+ return reversed;
+}
+
+void Spectrum::performFFT(const sound_sample *input) {
+ /* Convert to reverse bit order for FFT */
+ prepFFT(input, fftState->real, fftState->imag);
+
+ /* Calculate FFT */
+ calcFFT(fftState->real, fftState->imag);
+
+ /* Convert FFT to intensities */
+ outputFFT(fftState->real, fftState->imag);
+}
+
+void Spectrum::prepFFT(const sound_sample *input, float * re, float * im) {
+ unsigned int i;
+ float *realptr = re;
+ float *imagptr = im;
+
+ /* Get input, in reverse bit order */
+ for(i = 0; i < BUFFER_SIZE; i++) {
+ *realptr++ = input[bitReverse[i]];
+ *imagptr++ = 0;
+ }
+}
+
+void Spectrum::calcFFT(float * re, float * im) {
+ unsigned int i, j, k;
+ unsigned int exchanges;
+ float fact_real, fact_imag;
+ float tmp_real, tmp_imag;
+ unsigned int factfact;
+
+ /* Set up some variables to reduce calculation in the loops */
+ exchanges = 1;
+ factfact = BUFFER_SIZE / 2;
+
+ /* divide and conquer method */
+ for(i = BUFFER_SIZE_LOG; i != 0; i--) {
+ for(j = 0; j != exchanges; j++) {
+ fact_real = costable[j * factfact];
+ fact_imag = sintable[j * factfact];
+ for(k = j; k < BUFFER_SIZE; k += exchanges << 1) {
+ int k1 = k + exchanges;
+ tmp_real = fact_real * re[k1] - fact_imag * im[k1];
+ tmp_imag = fact_real * im[k1] + fact_imag * re[k1];
+ re[k1] = re[k] - tmp_real;
+ im[k1] = im[k] - tmp_imag;
+ re[k] += tmp_real;
+ im[k] += tmp_imag;
+ }
+ }
+ exchanges <<= 1;
+ factfact >>= 1;
+ }
+}
+
+void Spectrum::outputFFT(const float * re, const float * im) {
+ const float *realptr = re;
+ const float *imagptr = im;
+ float *outputptr = output;
+
+ float *endptr = output + BUFFER_SIZE / 2;
+
+ /* Convert FFT to intensities */
+
+ while(outputptr <= endptr) {
+ *outputptr = (*realptr * *realptr) + (*imagptr * *imagptr);
+ outputptr++; realptr++; imagptr++;
+ }
+ *output /= 4;
+ *endptr /= 4;
+}
+
+
+RenderArea::RenderArea(QWidget *parent)
+ : QWidget(parent)
+{
+ setBackgroundRole(QPalette::Base);
+ setAutoFillBackground(true);
+
+ samples = 0;
+ sampleSize = 0;
+ setMinimumHeight(30);
+ setMinimumWidth(200);
+}
+
+void RenderArea::paintEvent(QPaintEvent * /* event */)
+{
+ QPainter painter(this);
+
+ if(sampleSize == 0)
+ return;
+
+ painter.setPen(Qt::red);
+ int max = 0;
+ for(int i=0;i<sampleSize;i++) {
+ int m = (int)(sqrt(samples[i])/32768);
+ if(m > max)
+ max = m;
+ }
+ int x1,y1,x2,y2;
+
+ for(int i=0;i<10;i++) {
+ x1 = painter.viewport().left()+11;
+ y1 = painter.viewport().top()+10+i;
+ x2 = painter.viewport().right()-20-max;
+ y2 = painter.viewport().top()+10+i;
+ if(x2 < painter.viewport().left()+10)
+ x2 = painter.viewport().left()+10;
+
+ painter.drawLine(QPoint(x1,y1),QPoint(x2,y2));
+ }
+
+ painter.setPen(Qt::black);
+ painter.drawRect(QRect(painter.viewport().left()+10, painter.viewport().top()+10,
+ painter.viewport().right()-20, painter.viewport().bottom()-20));
+}
+
+void RenderArea::spectrum(float* output, int size)
+{
+ samples = output;
+ sampleSize = size;
+ repaint();
+}
+
+
+InputTest::InputTest()
+{
+ QWidget *window = new QWidget;
+ QVBoxLayout* layout = new QVBoxLayout;
+
+ canvas = new RenderArea;
+ layout->addWidget(canvas);
+
+ deviceBox = new QComboBox(this);
+ QList<QAudioDeviceId> devices = QAudioDeviceInfo::deviceList(QAudio::AudioInput);
+ for(int i = 0; i < devices.size(); ++i) {
+ deviceBox->addItem(QAudioDeviceInfo(devices.at(i)).deviceName(), qVariantFromValue(devices.at(i)));
+ }
+ 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(toggleMode()));
+ layout->addWidget(button);
+
+ button2 = new QPushButton(this);
+ button2->setText(tr("Click To Suspend"));
+ connect(button2,SIGNAL(clicked()),SLOT(toggleSuspend()));
+ layout->addWidget(button2);
+
+ window->setLayout(layout);
+ setCentralWidget(window);
+ window->show();
+
+ buffer = new char[BUFFER_SIZE*10];
+ output = new float[1024];
+
+ pullMode = true;
+
+ format.setFrequency(8000);
+ format.setChannels(1);
+ format.setSampleSize(8);
+ format.setSampleType(QAudioFormat::UnSignedInt);
+ format.setByteOrder(QAudioFormat::LittleEndian);
+ format.setCodec("audio/pcm");
+
+ audioInput = new QAudioInput(format,this);
+ connect(audioInput,SIGNAL(notify()),SLOT(status()));
+ connect(audioInput,SIGNAL(stateChanged(QAudio::State)),SLOT(state(QAudio::State)));
+ spec = new Spectrum(this,audioInput,output);
+ connect(spec,SIGNAL(update()),SLOT(refreshDisplay()));
+ spec->start();
+ audioInput->start(spec);
+}
+
+InputTest::~InputTest() {}
+
+void InputTest::status()
+{
+ qWarning()<<"bytesReady = "<<audioInput->bytesReady()<<" bytes, clock = "<<audioInput->clock()<<"ms, totalTime = "<<audioInput->totalTime()/1000<<"ms";
+}
+
+void InputTest::readMore()
+{
+ if(!audioInput)
+ return;
+ qint64 len = audioInput->bytesReady();
+ if(len > BUFFER_SIZE*10)
+ len = BUFFER_SIZE*10;
+ qint64 l = input->read(buffer,len);
+ if(l > 0) {
+ spec->write(buffer,l);
+ }
+}
+
+void InputTest::toggleMode()
+{
+ // Change bewteen pull and push modes
+ audioInput->stop();
+
+ if(pullMode) {
+ button->setText(tr("Click for Push Mode"));
+ input = audioInput->start(0);
+ connect(input,SIGNAL(readyRead()),SLOT(readMore()));
+ pullMode = false;
+ } else {
+ button->setText(tr("Click for Pull Mode"));
+ pullMode = true;
+ audioInput->start(spec);
+ }
+}
+
+void InputTest::toggleSuspend()
+{
+ // toggle suspend/resume
+ if(audioInput->state() == QAudio::SuspendState) {
+ qWarning()<<"status: Suspended, resume()";
+ audioInput->resume();
+ button2->setText("Click To Suspend");
+ } else if (audioInput->state() == QAudio::ActiveState) {
+ qWarning()<<"status: Active, suspend()";
+ audioInput->suspend();
+ button2->setText("Click To Resume");
+ } else if (audioInput->state() == QAudio::StopState) {
+ qWarning()<<"status: Stopped, resume()";
+ audioInput->resume();
+ button2->setText("Click To Suspend");
+ } else if (audioInput->state() == QAudio::IdleState) {
+ qWarning()<<"status: IdleState";
+ }
+}
+
+void InputTest::state(QAudio::State state)
+{
+ qWarning()<<" state="<<state;
+}
+
+void InputTest::refreshDisplay()
+{
+ canvas->spectrum(output,256);
+ canvas->repaint();
+}
+
+void InputTest::deviceChanged(int idx)
+{
+ spec->stop();
+ audioInput->stop();
+ audioInput->disconnect(this);
+ delete audioInput;
+
+ device = deviceBox->itemData(idx).value<QAudioDeviceId>();
+ audioInput = new QAudioInput(device, format, this);
+ connect(audioInput,SIGNAL(notify()),SLOT(status()));
+ connect(audioInput,SIGNAL(stateChanged(QAudio::State)),SLOT(state(QAudio::State)));
+ spec->start();
+ audioInput->start(spec);
+}
diff --git a/examples/multimedia/audio/audioinput/audioinput.h b/examples/multimedia/audio/audioinput/audioinput.h
new file mode 100644
index 000000000..3a6b3566c
--- /dev/null
+++ b/examples/multimedia/audio/audioinput/audioinput.h
@@ -0,0 +1,144 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QPixmap>
+#include <QWidget>
+#include <QObject>
+#include <QMainWindow>
+#include <QPushButton>
+#include <QComboBox>
+
+#include <qaudioinput.h>
+
+#define BUFFER_SIZE_LOG 9
+#define BUFFER_SIZE (1 << BUFFER_SIZE_LOG)
+
+struct _struct_fft_state {
+ float real[BUFFER_SIZE];
+ float imag[BUFFER_SIZE];
+};
+typedef _struct_fft_state fft_state;
+typedef short int sound_sample;
+
+class Spectrum : public QIODevice
+{
+ Q_OBJECT
+public:
+ Spectrum(QObject* parent, QAudioInput* device, float* out);
+ ~Spectrum();
+
+ void start();
+ void stop();
+
+ qint64 readData(char *data, qint64 maxlen);
+ qint64 writeData(const char *data, qint64 len);
+
+ QAudioInput* input;
+ float* output;
+ fft_state* fftState;
+
+ unsigned int bitReverse[BUFFER_SIZE];
+ float sintable[BUFFER_SIZE / 2];
+ float costable[BUFFER_SIZE / 2];
+
+ void prepFFT (const sound_sample *input, float *re, float *im);
+ void calcFFT (float *re, float *im);
+ void outputFFT (const float *re, const float *im);
+ int reverseBits (unsigned int initial);
+ void performFFT (const sound_sample *input);
+
+signals:
+ void update();
+};
+
+
+class RenderArea : public QWidget
+{
+ Q_OBJECT
+
+public:
+ RenderArea(QWidget *parent = 0);
+
+ void spectrum(float* output, int size);
+
+protected:
+ void paintEvent(QPaintEvent *event);
+
+private:
+ QPixmap pixmap;
+
+ float* samples;
+ int sampleSize;
+};
+
+class InputTest : public QMainWindow
+{
+ Q_OBJECT
+public:
+ InputTest();
+ ~InputTest();
+
+ QAudioDeviceId device;
+ QAudioFormat format;
+ QAudioInput* audioInput;
+ Spectrum* spec;
+ QIODevice* input;
+ RenderArea* canvas;
+
+ bool pullMode;
+
+ QPushButton* button;
+ QPushButton* button2;
+ QComboBox* deviceBox;
+
+ char* buffer;
+ float* output;
+
+private slots:
+ void refreshDisplay();
+ void status();
+ void readMore();
+ void toggleMode();
+ void toggleSuspend();
+ void state(QAudio::State s);
+ void deviceChanged(int idx);
+};
+
diff --git a/examples/multimedia/audio/audioinput/audioinput.pro b/examples/multimedia/audio/audioinput/audioinput.pro
new file mode 100644
index 000000000..d930750ec
--- /dev/null
+++ b/examples/multimedia/audio/audioinput/audioinput.pro
@@ -0,0 +1,12 @@
+HEADERS = audioinput.h
+SOURCES = audioinput.cpp \
+ main.cpp
+
+QT += multimedia
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio/audioinput
+sources.files = $$SOURCES *.h $$RESOURCES $$FORMS audioinput.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio/audioinput
+INSTALLS += target sources
+
diff --git a/examples/multimedia/audio/audioinput/main.cpp b/examples/multimedia/audio/audioinput/main.cpp
new file mode 100644
index 000000000..64a9b040f
--- /dev/null
+++ b/examples/multimedia/audio/audioinput/main.cpp
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "audioinput.h"
+
+int main(int argv, char **args)
+{
+ QApplication app(argv, args);
+ app.setApplicationName("Audio Input Test");
+
+ InputTest input;
+ input.show();
+
+ return app.exec();
+}
diff --git a/examples/multimedia/audio/audiooutput/audiooutput.cpp b/examples/multimedia/audio/audiooutput/audiooutput.cpp
new file mode 100644
index 000000000..be26f192c
--- /dev/null
+++ b/examples/multimedia/audio/audiooutput/audiooutput.cpp
@@ -0,0 +1,280 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QDebug>
+#include <QVBoxLayout>
+
+#include <QAudioOutput>
+#include <QAudioDeviceInfo>
+#include "audiooutput.h"
+
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+
+Generator::Generator(QObject *parent)
+ :QIODevice( parent )
+{
+ finished = false;
+ buffer = new char[SECONDS*44100*4+1000];
+ t=buffer;
+ len=fillData(t+4,450,SECONDS); /* left channel, 450Hz sine */
+ len+=fillData(t+6,452,SECONDS); /* right channel, 452Hz sine */
+ putLong(t,len);
+ putLong(buffer+4,len+8+16+8);
+ pos = 0;
+ total = len+8+16+8;
+}
+
+Generator::~Generator()
+{
+ delete [] buffer;
+}
+
+void Generator::start()
+{
+ open(QIODevice::ReadOnly);
+}
+
+void Generator::stop()
+{
+ close();
+}
+
+int Generator::putShort(char *t, unsigned int value)
+{
+ *(unsigned char *)(t++)=value&255;
+ *(unsigned char *)(t)=(value/256)&255;
+ return 2;
+}
+
+int Generator::putLong(char *t, unsigned int value)
+{
+ *(unsigned char *)(t++)=value&255;
+ *(unsigned char *)(t++)=(value/256)&255;
+ *(unsigned char *)(t++)=(value/(256*256))&255;
+ *(unsigned char *)(t)=(value/(256*256*256))&255;
+ return 4;
+}
+
+int Generator::fillData(char *start, int frequency, int seconds)
+{
+ int i, len=0;
+ int value;
+ for(i=0; i<seconds*44100; i++) {
+ value=(int)(32767.0*sin(2.0*M_PI*((double)(i))*(double)(frequency)/44100.0));
+ putShort(start, value);
+ start += 4;
+ len+=2;
+ }
+ return len;
+}
+
+qint64 Generator::readData(char *data, qint64 maxlen)
+{
+ int len = maxlen;
+ if(len > 16384)
+ len = 16384;
+
+ if(len < (SECONDS*44100*4+1000)-pos) {
+ // Normal
+ memcpy(data,t+pos,len);
+ pos+=len;
+ return len;
+ } else {
+ // Whats left and reset to start
+ qint64 left = (SECONDS*44100*4+1000)-pos;
+ memcpy(data,t+pos,left);
+ pos=0;
+ return left;
+ }
+}
+
+qint64 Generator::writeData(const char *data, qint64 len)
+{
+ Q_UNUSED(data);
+ Q_UNUSED(len);
+
+ return 0;
+}
+
+AudioTest::AudioTest()
+{
+ QWidget *window = new QWidget;
+ QVBoxLayout* layout = new QVBoxLayout;
+
+ deviceBox = new QComboBox(this);
+ QList<QAudioDeviceId> devices = QAudioDeviceInfo::deviceList(QAudio::AudioOutput);
+ for(int i = 0; i < devices.size(); ++i) {
+ deviceBox->addItem(QAudioDeviceInfo(devices.at(i)).deviceName(), qVariantFromValue(devices.at(i)));
+ }
+ 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();
+
+ buffer = new char[BUFFER_SIZE];
+
+ gen = new Generator(this);
+
+ pullMode = true;
+
+ timer = new QTimer(this);
+ connect(timer,SIGNAL(timeout()),SLOT(writeMore()));
+
+ gen->start();
+
+ settings.setFrequency(44100);
+ settings.setChannels(2);
+ settings.setSampleSize(16);
+ settings.setCodec("audio/pcm");
+ settings.setByteOrder(QAudioFormat::LittleEndian);
+ settings.setSampleType(QAudioFormat::SignedInt);
+ audioOutput = new QAudioOutput(settings,this);
+ connect(audioOutput,SIGNAL(notify()),SLOT(status()));
+ connect(audioOutput,SIGNAL(stateChanged(QAudio::State)),SLOT(state(QAudio::State)));
+
+ audioOutput->start(gen);
+}
+
+AudioTest::~AudioTest()
+{
+ delete [] buffer;
+}
+
+void AudioTest::deviceChanged(int idx)
+{
+ timer->stop();
+ gen->stop();
+ audioOutput->stop();
+ audioOutput->disconnect(this);
+ delete audioOutput;
+
+ device = deviceBox->itemData(idx).value<QAudioDeviceId>();
+ 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);
+}
+
+void AudioTest::status()
+{
+ qWarning()<<"byteFree = "<<audioOutput->bytesFree()<<" bytes, clock = "<<audioOutput->clock()<<"ms, totalTime = "<<audioOutput->totalTime()/1000<<"ms";
+}
+
+void AudioTest::writeMore()
+{
+ if(!audioOutput)
+ return;
+
+ if(audioOutput->state() == QAudio::StopState)
+ 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--;
+ }
+}
+
+void AudioTest::toggle()
+{
+ // Change between pull and push modes
+
+ timer->stop();
+ audioOutput->stop();
+
+ if (pullMode) {
+ button->setText("Click for Pull Mode");
+ output = audioOutput->start(0);
+ pullMode = false;
+ timer->start(20);
+ } else {
+ button->setText("Click for Push Mode");
+ pullMode = true;
+ audioOutput->start(gen);
+ }
+}
+
+void AudioTest::togglePlay()
+{
+ // toggle suspend/resume
+ if(audioOutput->state() == QAudio::SuspendState) {
+ qWarning()<<"status: Suspended, resume()";
+ audioOutput->resume();
+ button2->setText("Click To Suspend");
+ } else if (audioOutput->state() == QAudio::ActiveState) {
+ qWarning()<<"status: Active, suspend()";
+ audioOutput->suspend();
+ button2->setText("Click To Resume");
+ } else if (audioOutput->state() == QAudio::StopState) {
+ qWarning()<<"status: Stopped, resume()";
+ audioOutput->resume();
+ button2->setText("Click To Suspend");
+ } else if (audioOutput->state() == QAudio::IdleState) {
+ qWarning()<<"status: IdleState";
+ }
+}
+
+void AudioTest::state(QAudio::State state)
+{
+ qWarning()<<" state="<<state;
+}
diff --git a/examples/multimedia/audio/audiooutput/audiooutput.h b/examples/multimedia/audio/audiooutput/audiooutput.h
new file mode 100644
index 000000000..1e21b487c
--- /dev/null
+++ b/examples/multimedia/audio/audiooutput/audiooutput.h
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <math.h>
+
+#define BUFFER_SIZE 32768
+#define SECONDS 3
+
+#include <QObject>
+#include <QMainWindow>
+#include <QIODevice>
+#include <QTimer>
+#include <QPushButton>
+#include <QComboBox>
+
+#include <QAudioOutput>
+
+class Generator : public QIODevice
+{
+ Q_OBJECT
+public:
+ Generator(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);
+
+private:
+ int putShort(char *t, unsigned int value);
+ int putLong(char *t, unsigned int value);
+ int fillData(char *start, int frequency, int seconds);
+};
+
+class AudioTest : public QMainWindow
+{
+ Q_OBJECT
+public:
+ AudioTest();
+ ~AudioTest();
+
+ QAudioDeviceId device;
+ Generator* gen;
+ QAudioOutput* audioOutput;
+ QIODevice* output;
+ QTimer* timer;
+ QAudioFormat settings;
+
+ bool pullMode;
+ char* buffer;
+
+ QPushButton* button;
+ QPushButton* button2;
+ QComboBox* deviceBox;
+
+private slots:
+ void status();
+ void writeMore();
+ void toggle();
+ void togglePlay();
+ void state(QAudio::State s);
+ void deviceChanged(int idx);
+};
+
diff --git a/examples/multimedia/audio/audiooutput/audiooutput.pro b/examples/multimedia/audio/audiooutput/audiooutput.pro
new file mode 100644
index 000000000..08f43ce9e
--- /dev/null
+++ b/examples/multimedia/audio/audiooutput/audiooutput.pro
@@ -0,0 +1,11 @@
+HEADERS = audiooutput.h
+SOURCES = audiooutput.cpp \
+ main.cpp
+
+QT += multimedia
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio/audiooutput
+sources.files = $$SOURCES *.h $$RESOURCES $$FORMS audiooutput.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio/audiooutput
+INSTALLS += target sources
diff --git a/examples/multimedia/audio/audiooutput/main.cpp b/examples/multimedia/audio/audiooutput/main.cpp
new file mode 100644
index 000000000..fc319bd56
--- /dev/null
+++ b/examples/multimedia/audio/audiooutput/main.cpp
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtGui>
+
+#include "audiooutput.h"
+
+int main(int argv, char **args)
+{
+ QApplication app(argv, args);
+ app.setApplicationName("Audio Output Test");
+
+ AudioTest audio;
+ audio.show();
+
+ return app.exec();
+}
diff --git a/examples/multimedia/multimedia.pro b/examples/multimedia/multimedia.pro
new file mode 100644
index 000000000..ac78b15b4
--- /dev/null
+++ b/examples/multimedia/multimedia.pro
@@ -0,0 +1,8 @@
+TEMPLATE = subdirs
+SUBDIRS = audio
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/multimedia
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS multimedia.pro README
+sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia
+INSTALLS += target sources
diff --git a/examples/script/calculator/calculator.js b/examples/script/calculator/calculator.js
index 62c2cba07..ac3c1b69b 100644
--- a/examples/script/calculator/calculator.js
+++ b/examples/script/calculator/calculator.js
@@ -1,10 +1,19 @@
+Function.prototype.bind = function() {
+ var func = this;
+ var thisObject = arguments[0];
+ var args = Array.prototype.slice.call(arguments, 1);
+ return function() {
+ return func.apply(thisObject, args);
+ }
+}
+
//! [0]
function Calculator(ui)
{
this.ui = ui;
- this.pendingAdditiveOperator = "";
- this.pendingMultiplicativeOperator = "";
+ this.pendingAdditiveOperator = Calculator.NO_OPERATOR;
+ this.pendingMultiplicativeOperator = Calculator.NO_OPERATOR;
this.sumInMemory = 0;
this.sumSoFar = 0;
this.factorSoFar = 0;
@@ -13,16 +22,16 @@ function Calculator(ui)
with (ui) {
display.text = "0";
- zeroButton.clicked.connect(this, this.digitClicked);
- oneButton.clicked.connect(this, "digitClicked");
- twoButton.clicked.connect(this, "digitClicked");
- threeButton.clicked.connect(this, "digitClicked");
- fourButton.clicked.connect(this, "digitClicked");
- fiveButton.clicked.connect(this, "digitClicked");
- sixButton.clicked.connect(this, "digitClicked");
- sevenButton.clicked.connect(this, "digitClicked");
- eightButton.clicked.connect(this, "digitClicked");
- nineButton.clicked.connect(this, "digitClicked");
+ zeroButton.clicked.connect(this.digitClicked.bind(this, 0));
+ oneButton.clicked.connect(this.digitClicked.bind(this, 1));
+ twoButton.clicked.connect(this.digitClicked.bind(this, 2));
+ threeButton.clicked.connect(this.digitClicked.bind(this, 3));
+ fourButton.clicked.connect(this.digitClicked.bind(this, 4));
+ fiveButton.clicked.connect(this.digitClicked.bind(this, 5));
+ sixButton.clicked.connect(this.digitClicked.bind(this, 6));
+ sevenButton.clicked.connect(this.digitClicked.bind(this, 7));
+ eightButton.clicked.connect(this.digitClicked.bind(this, 8));
+ nineButton.clicked.connect(this.digitClicked.bind(this, 9));
pointButton.clicked.connect(this, "pointClicked");
changeSignButton.clicked.connect(this, "changeSignClicked");
@@ -36,19 +45,28 @@ function Calculator(ui)
setMemoryButton.clicked.connect(this, "setMemory");
addToMemoryButton.clicked.connect(this, "addToMemory");
- divisionButton.clicked.connect(this, "multiplicativeOperatorClicked");
- timesButton.clicked.connect(this, "multiplicativeOperatorClicked");
- minusButton.clicked.connect(this, "additiveOperatorClicked");
- plusButton.clicked.connect(this, "additiveOperatorClicked");
-
- squareRootButton.clicked.connect(this, "unaryOperatorClicked");
- powerButton.clicked.connect(this, "unaryOperatorClicked");
- reciprocalButton.clicked.connect(this, "unaryOperatorClicked");
+ divisionButton.clicked.connect(this.multiplicativeOperatorClicked.bind(this, Calculator.DIVISION_OPERATOR));
+ timesButton.clicked.connect(this.multiplicativeOperatorClicked.bind(this, Calculator.TIMES_OPERATOR));
+ minusButton.clicked.connect(this.additiveOperatorClicked.bind(this, Calculator.MINUS_OPERATOR));
+ plusButton.clicked.connect(this.additiveOperatorClicked.bind(this, Calculator.PLUS_OPERATOR));
+
+ squareRootButton.clicked.connect(this.unaryOperatorClicked.bind(this, Calculator.SQUARE_OPERATOR));
+ powerButton.clicked.connect(this.unaryOperatorClicked.bind(this, Calculator.POWER_OPERATOR));
+ reciprocalButton.clicked.connect(this.unaryOperatorClicked.bind(this, Calculator.RECIPROCAL_OPERATOR));
equalButton.clicked.connect(this, "equalClicked");
}
}
//! [0]
+Calculator.NO_OPERATOR = 0;
+Calculator.SQUARE_OPERATOR = 1;
+Calculator.POWER_OPERATOR = 2;
+Calculator.RECIPROCAL_OPERATOR = 3;
+Calculator.DIVISION_OPERATOR = 4;
+Calculator.TIMES_OPERATOR = 5;
+Calculator.MINUS_OPERATOR = 6;
+Calculator.PLUS_OPERATOR = 7;
+
Calculator.prototype.abortOperation = function()
{
this.clearAll();
@@ -57,24 +75,23 @@ Calculator.prototype.abortOperation = function()
Calculator.prototype.calculate = function(rightOperand, pendingOperator)
{
- if (pendingOperator == "+") {
+ if (pendingOperator == Calculator.PLUS_OPERATOR) {
this.sumSoFar += rightOperand;
- } else if (pendingOperator == "-") {
+ } else if (pendingOperator == Calculator.MINUS_OPERATOR) {
this.sumSoFar -= rightOperand;
- } else if (pendingOperator == "*") {
+ } else if (pendingOperator == Calculator.TIMES_OPERATOR) {
this.factorSoFar *= rightOperand;
- } else if (pendingOperator == "/") {
+ } else if (pendingOperator == Calculator.DIVISION_OPERATOR) {
if (rightOperand == 0)
- return false;
+ return false;
this.factorSoFar /= rightOperand;
}
return true;
}
//! [1]
-Calculator.prototype.digitClicked = function()
+Calculator.prototype.digitClicked = function(digitValue)
{
- var digitValue = __qt_sender__.text - 0;
if ((digitValue == 0) && (this.ui.display.text == "0"))
return;
if (this.waitingForOperand) {
@@ -85,19 +102,19 @@ Calculator.prototype.digitClicked = function()
}
//! [1]
-Calculator.prototype.unaryOperatorClicked = function()
+Calculator.prototype.unaryOperatorClicked = function(op)
{
var operand = this.ui.display.text - 0;
var result = 0;
- if (__qt_sender__.text == "Sqrt") {
+ if (op == Calculator.SQUARE_OPERATOR) {
if (operand < 0) {
this.abortOperation();
return;
}
result = Math.sqrt(operand);
- } else if (__qt_sender__.text == "x^2") {
+ } else if (op == Calculator.POWER_OPERATOR) {
result = Math.pow(operand, 2);
- } else if (__qt_sender__.text == "1/x") {
+ } else if (op == Calculator.RECIPROCAL_OPERATOR) {
if (operand == 0.0) {
this.abortOperation();
return;
@@ -108,11 +125,11 @@ Calculator.prototype.unaryOperatorClicked = function()
this.waitingForOperand = true;
}
-Calculator.prototype.additiveOperatorClicked = function()
+Calculator.prototype.additiveOperatorClicked = function(op)
{
var operand = this.ui.display.text - 0;
- if (this.pendingMultiplicativeOperator.length != 0) {
+ if (this.pendingMultiplicativeOperator != Calculator.NO_OPERATOR) {
if (!this.calculate(operand, this.pendingMultiplicativeOperator)) {
this.abortOperation();
return;
@@ -120,10 +137,10 @@ Calculator.prototype.additiveOperatorClicked = function()
this.ui.display.text = this.factorSoFar + "";
operand = this.factorSoFar;
this.factorSoFar = 0;
- this.pendingMultiplicativeOperator = "";
+ this.pendingMultiplicativeOperator = Calculator.NO_OPERATOR;
}
- if (this.pendingAdditiveOperator.length != 0) {
+ if (this.pendingAdditiveOperator != Calculator.NO_OPERATOR) {
if (!this.calculate(operand, this.pendingAdditiveOperator)) {
this.abortOperation();
return;
@@ -133,15 +150,15 @@ Calculator.prototype.additiveOperatorClicked = function()
this.sumSoFar = operand;
}
- this.pendingAdditiveOperator = __qt_sender__.text;
+ this.pendingAdditiveOperator = op;
this.waitingForOperand = true;
}
-Calculator.prototype.multiplicativeOperatorClicked = function()
+Calculator.prototype.multiplicativeOperatorClicked = function(op)
{
var operand = this.ui.display.text - 0;
- if (this.pendingMultiplicativeOperator.length != 0) {
+ if (this.pendingMultiplicativeOperator != Calculator.NO_OPERATOR) {
if (!this.calculate(operand, this.pendingMultiplicativeOperator)) {
this.abortOperation();
return;
@@ -151,7 +168,7 @@ Calculator.prototype.multiplicativeOperatorClicked = function()
this.factorSoFar = operand;
}
- this.pendingMultiplicativeOperator = __qt_sender__.text;
+ this.pendingMultiplicativeOperator = op;
this.waitingForOperand = true;
}
@@ -159,21 +176,21 @@ Calculator.prototype.equalClicked = function()
{
var operand = this.ui.display.text - 0;
- if (this.pendingMultiplicativeOperator.length != 0) {
+ if (this.pendingMultiplicativeOperator != Calculator.NO_OPERATOR) {
if (!this.calculate(operand, this.pendingMultiplicativeOperator)) {
this.abortOperation();
return;
}
operand = this.factorSoFar;
this.factorSoFar = 0.0;
- this.pendingMultiplicativeOperator = "";
+ this.pendingMultiplicativeOperator = Calculator.NO_OPERATOR;
}
- if (this.pendingAdditiveOperator.length != 0) {
+ if (this.pendingAdditiveOperator != Calculator.NO_OPERATOR) {
if (!this.calculate(operand, this.pendingAdditiveOperator)) {
this.abortOperation();
return;
}
- this.pendingAdditiveOperator = "";
+ this.pendingAdditiveOperator = Calculator.NO_OPERATOR;
} else {
this.sumSoFar = operand;
}
@@ -234,8 +251,8 @@ Calculator.prototype.clearAll = function()
{
this.sumSoFar = 0.0;
this.factorSoFar = 0.0;
- this.pendingAdditiveOperator = "";
- this.pendingMultiplicativeOperator = "";
+ this.pendingAdditiveOperator = Calculator.NO_OPERATOR;
+ this.pendingMultiplicativeOperator = Calculator.NO_OPERATOR;
this.ui.display.text = "0";
this.waitingForOperand = true;
}
diff --git a/examples/script/customclass/bytearrayclass.cpp b/examples/script/customclass/bytearrayclass.cpp
index 2044a168a..8fe1a960c 100644
--- a/examples/script/customclass/bytearrayclass.cpp
+++ b/examples/script/customclass/bytearrayclass.cpp
@@ -297,7 +297,7 @@ void ByteArrayClassPropertyIterator::toBack()
QScriptString ByteArrayClassPropertyIterator::name() const
{
- return QScriptString();
+ return object().engine()->toStringHandle(QString::number(m_last));
}
uint ByteArrayClassPropertyIterator::id() const
diff --git a/examples/statemachine/rogue/main.cpp b/examples/statemachine/rogue/main.cpp
new file mode 100644
index 000000000..0c2fb2d90
--- /dev/null
+++ b/examples/statemachine/rogue/main.cpp
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "window.h"
+
+int main(int argv, char **args)
+{
+ QApplication app(argv, args);
+
+ Window window;
+ window.show();
+
+ return app.exec();
+}
+
diff --git a/examples/statemachine/rogue/movementtransition.h b/examples/statemachine/rogue/movementtransition.h
new file mode 100644
index 000000000..929077dc6
--- /dev/null
+++ b/examples/statemachine/rogue/movementtransition.h
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MOVEMENTTRANSITION_H
+#define MOVEMENTTRANSITION_H
+
+#include <QtGui>
+
+#include "window.h"
+
+//![0]
+class MovementTransition : public QEventTransition
+{
+ Q_OBJECT
+
+public:
+ MovementTransition(Window *window) :
+ QEventTransition(window, QEvent::KeyPress) {
+ this->window = window;
+ }
+//![0]
+
+//![1]
+protected:
+ bool eventTest(QEvent *event) {
+ if (event->type() == QEvent::Wrapped &&
+ static_cast<QWrappedEvent *>(event)->event()->type() == QEvent::KeyPress) {
+ QEvent *wrappedEvent = static_cast<QWrappedEvent *>(event)->event();
+
+ QKeyEvent *keyEvent = static_cast<QKeyEvent *>(wrappedEvent);
+ int key = keyEvent->key();
+
+ return key == Qt::Key_2 || key == Qt::Key_8 || key == Qt::Key_6 ||
+ key == Qt::Key_4;
+ }
+ return false;
+ }
+//![1]
+
+//![2]
+ void onTransition(QEvent *event) {
+ QKeyEvent *keyEvent = static_cast<QKeyEvent *>(
+ static_cast<QWrappedEvent *>(event)->event());
+
+ int key = keyEvent->key();
+ switch (key) {
+ case Qt::Key_4:
+ window->movePlayer(Window::Left);
+ break;
+ case Qt::Key_8:
+ window->movePlayer(Window::Up);
+ break;
+ case Qt::Key_6:
+ window->movePlayer(Window::Right);
+ break;
+ case Qt::Key_2:
+ window->movePlayer(Window::Down);
+ break;
+ default:
+ ;
+ }
+ }
+//![2]
+
+private:
+ Window *window;
+};
+
+#endif
+
diff --git a/examples/statemachine/rogue/rogue.pro b/examples/statemachine/rogue/rogue.pro
new file mode 100644
index 000000000..15718540d
--- /dev/null
+++ b/examples/statemachine/rogue/rogue.pro
@@ -0,0 +1,11 @@
+HEADERS = window.h \
+ movementtransition.h
+SOURCES = main.cpp \
+ window.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/rogue
+sources.files = $$SOURCES $$HEADERS *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/statemachine/rogue
+INSTALLS += target sources
+
diff --git a/examples/statemachine/rogue/window.cpp b/examples/statemachine/rogue/window.cpp
new file mode 100644
index 000000000..39565a30f
--- /dev/null
+++ b/examples/statemachine/rogue/window.cpp
@@ -0,0 +1,201 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "window.h"
+#include "movementtransition.h"
+
+//![0]
+Window::Window()
+{
+ pX = 5;
+ pY = 5;
+//![0]
+
+ QFontDatabase database;
+ QFont font;
+ if (database.families().contains("Monospace"))
+ font = QFont("Monospace", 12);
+ else {
+ foreach (QString family, database.families()) {
+ if (database.isFixedPitch(family)) {
+ font = QFont(family, 12);
+ break;
+ }
+ }
+ }
+ setFont(font);
+
+//![1]
+ setupMap();
+ buildMachine();
+}
+//![1]
+
+void Window::setStatus(const QString &status)
+{
+ myStatus = status;
+ repaint();
+}
+
+QString Window::status() const
+{
+ return myStatus;
+}
+
+void Window::paintEvent(QPaintEvent * /* event */)
+{
+ QFontMetrics metrics(font());
+ QPainter painter(this);
+ int fontHeight = metrics.height();
+ int fontWidth = metrics.width('X');
+ int yPos = fontHeight;
+ int xPos;
+
+ painter.fillRect(rect(), Qt::black);
+ painter.setPen(Qt::white);
+
+ painter.drawText(QPoint(0, yPos), status());
+
+ for (int y = 0; y < HEIGHT; ++y) {
+ yPos += fontHeight;
+ xPos = 0;
+
+ for (int x = 0; x < WIDTH; ++x) {
+ if (y == pY && x == pX) {
+ xPos += fontWidth;
+ continue;
+ }
+
+ painter.drawText(QPoint(xPos, yPos), map[x][y]);
+ xPos += fontWidth;
+ }
+ }
+ painter.drawText(QPoint(pX * fontWidth, (pY + 2) * fontHeight), QChar('@'));
+}
+
+QSize Window::sizeHint() const
+{
+ QFontMetrics metrics(font());
+
+ return QSize(metrics.width('X') * WIDTH, metrics.height() * (HEIGHT + 1));
+}
+
+//![2]
+void Window::buildMachine()
+{
+ machine = new QStateMachine;
+
+ QState *inputState = new QState(machine);
+ inputState->assignProperty(this, "status", "Move the rogue with 2, 4, 6, and 8");
+
+ MovementTransition *transition = new MovementTransition(this);
+ inputState->addTransition(transition);
+//![2]
+
+//![3]
+ QState *quitState = new QState(machine);
+ quitState->assignProperty(this, "status", "Really quit(y/n)?");
+
+ QKeyEventTransition *yesTransition = new
+ QKeyEventTransition(this, QEvent::KeyPress, Qt::Key_Y);
+ yesTransition->setTargetState(new QFinalState(machine));
+ quitState->addTransition(yesTransition);
+
+ QKeyEventTransition *noTransition =
+ new QKeyEventTransition(this, QEvent::KeyPress, Qt::Key_N);
+ noTransition->setTargetState(inputState);
+ quitState->addTransition(noTransition);
+//![3]
+
+//![4]
+ QKeyEventTransition *quitTransition =
+ new QKeyEventTransition(this, QEvent::KeyPress, Qt::Key_Q);
+ quitTransition->setTargetState(quitState);
+ inputState->addTransition(quitTransition);
+//![4]
+
+//![5]
+ machine->setInitialState(inputState);
+
+ connect(machine, SIGNAL(finished()), qApp, SLOT(quit()));
+
+ machine->start();
+}
+//![5]
+
+void Window::movePlayer(Direction direction)
+{
+ switch (direction) {
+ case Left:
+ if (map[pX - 1][pY] != '#')
+ --pX;
+ break;
+ case Right:
+ if (map[pX + 1][pY] != '#')
+ ++pX;
+ break;
+ case Up:
+ if (map[pX][pY - 1] != '#')
+ --pY;
+ break;
+ case Down:
+ if (map[pX][pY + 1] != '#')
+ ++pY;
+ break;
+ }
+ repaint();
+}
+
+void Window::setupMap()
+{
+ qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
+
+ for (int x = 0; x < WIDTH; ++x)
+ for (int y = 0; y < HEIGHT; ++y) {
+ if (x == 0 || x == WIDTH - 1 || y == 0 || y == HEIGHT - 1 || qrand() % 40 == 0)
+ map[x][y] = '#';
+ else
+ map[x][y] = '.';
+ }
+}
+
diff --git a/examples/statemachine/rogue/window.h b/examples/statemachine/rogue/window.h
new file mode 100644
index 000000000..1df566d8d
--- /dev/null
+++ b/examples/statemachine/rogue/window.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef WINDOW_H
+#define WINDOW_H
+
+#include <QWidget>
+
+QT_BEGIN_NAMESPACE
+class QState;
+class QStateMachine;
+class QTransition;
+QT_END_NAMESPACE
+
+#define WIDTH 35
+#define HEIGHT 20
+
+//![0]
+class Window : public QWidget
+{
+ Q_OBJECT
+ Q_PROPERTY(QString status READ status WRITE setStatus)
+
+public:
+ enum Direction { Up, Down, Left, Right };
+
+ Window();
+
+ void movePlayer(Direction direction);
+ void setStatus(const QString &status);
+ QString status() const;
+
+ QSize sizeHint() const;
+
+protected:
+ void paintEvent(QPaintEvent *event);
+//![0]
+
+//![1]
+private:
+ void buildMachine();
+ void setupMap();
+
+ QChar map[WIDTH][HEIGHT];
+ int pX, pY;
+
+ QStateMachine *machine;
+ QString myStatus;
+};
+//![1]
+
+#endif
+
diff --git a/examples/statemachine/statemachine.pro b/examples/statemachine/statemachine.pro
index ea3e7a809..298c0ae33 100644
--- a/examples/statemachine/statemachine.pro
+++ b/examples/statemachine/statemachine.pro
@@ -3,6 +3,7 @@ SUBDIRS = \
eventtransitions \
factorial \
pingpong \
+ rogue \
trafficlight \
twowaybutton
diff --git a/examples/webkit/framecapture/framecapture.cpp b/examples/webkit/framecapture/framecapture.cpp
new file mode 100644
index 000000000..ef31f6d68
--- /dev/null
+++ b/examples/webkit/framecapture/framecapture.cpp
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "framecapture.h"
+
+#include <iostream>
+#include <QtWebKit>
+
+FrameCapture::FrameCapture(): QObject(), m_percent(0)
+{
+ connect(&m_page, SIGNAL(loadProgress(int)), this, SLOT(printProgress(int)));
+ connect(&m_page, SIGNAL(loadFinished(bool)), this, SLOT(saveResult(bool)));
+}
+
+void FrameCapture::load(const QUrl &url, const QString &outputFileName)
+{
+ std::cout << "Loading " << qPrintable(url.toString()) << std::endl;
+ m_percent = 0;
+ int index = outputFileName.lastIndexOf('.');
+ m_fileName = (index == -1) ? outputFileName + ".png" : outputFileName;
+ m_page.mainFrame()->load(url);
+ m_page.mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
+ m_page.mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
+}
+
+void FrameCapture::printProgress(int percent)
+{
+ if (m_percent >= percent)
+ return;
+
+ while (m_percent++ < percent)
+ std::cout << "#" << std::flush;
+}
+
+void FrameCapture::saveResult(bool ok)
+{
+ std::cout << std::endl;
+
+ // crude error-checking
+ if (!ok) {
+ std::cerr << "Failed loading " << qPrintable(m_page.mainFrame()->url().toString()) << std::endl;
+ emit finished();
+ return;
+ }
+
+ // save each internal frame in different image files
+ int frameCounter = 0;
+ foreach(QWebFrame *frame, m_page.mainFrame()->childFrames()) {
+ QString fileName(m_fileName);
+ int index = m_fileName.lastIndexOf('.');
+ fileName = fileName.insert(index, "_frame" + QString::number(++frameCounter));
+
+ frame->setClipRenderToViewport(false);
+
+ QImage image(frame->contentsSize(), QImage::Format_ARGB32_Premultiplied);
+ image.fill(Qt::transparent);
+
+ saveFrame(frame, image, fileName);
+ }
+
+ // save the main frame
+ m_page.setViewportSize(m_page.mainFrame()->contentsSize());
+ QImage image(m_page.mainFrame()->contentsSize(), QImage::Format_ARGB32_Premultiplied);
+ image.fill(Qt::transparent);
+ saveFrame(m_page.mainFrame(), image, m_fileName);
+
+ emit finished();
+}
+
+void FrameCapture::saveFrame(QWebFrame *frame, QImage image, QString fileName)
+{
+ QPainter painter(&image);
+ painter.setRenderHint(QPainter::Antialiasing, true);
+ painter.setRenderHint(QPainter::TextAntialiasing, true);
+ painter.setRenderHint(QPainter::SmoothPixmapTransform, true);
+
+ frame->render(&painter);
+
+ painter.end();
+
+ image.save(fileName);
+}
+
diff --git a/examples/webkit/framecapture/framecapture.h b/examples/webkit/framecapture/framecapture.h
new file mode 100644
index 000000000..ffc93acdd
--- /dev/null
+++ b/examples/webkit/framecapture/framecapture.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef FRAMECAPTURE_H
+#define FRAMECAPTURE_H
+
+#include <QtWebKit>
+
+class FrameCapture : public QObject
+{
+ Q_OBJECT
+
+public:
+ FrameCapture();
+ void load(const QUrl &url, const QString &outputFileName);
+
+signals:
+ void finished();
+
+private slots:
+ void printProgress(int percent);
+ void saveResult(bool ok);
+
+private:
+ QWebPage m_page;
+ QString m_fileName;
+ int m_percent;
+
+ void saveFrame(QWebFrame *frame, QImage image, QString fileName);
+};
+
+#endif
diff --git a/examples/webkit/framecapture/framecapture.pro b/examples/webkit/framecapture/framecapture.pro
new file mode 100644
index 000000000..6f2f0934a
--- /dev/null
+++ b/examples/webkit/framecapture/framecapture.pro
@@ -0,0 +1,11 @@
+QT += webkit
+
+HEADERS = framecapture.h
+SOURCES = main.cpp \
+ framecapture.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/webkit/framecapture
+sources.files = $$SOURCES $$HEADERS
+sources.path = $$[QT_INSTALL_EXAMPLES]/webkit/framecapture
+INSTALLS += target sources
diff --git a/examples/webkit/framecapture/main.cpp b/examples/webkit/framecapture/main.cpp
new file mode 100644
index 000000000..fcdb62a7a
--- /dev/null
+++ b/examples/webkit/framecapture/main.cpp
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "framecapture.h"
+
+#include <iostream>
+#include <QtGui>
+
+int main(int argc, char * argv[])
+{
+ if (argc != 3) {
+ std::cout << "Capture a web page and save its internal frames in different images" << std::endl << std::endl;
+ std::cout << " framecapture <url> <outputfile>" << std::endl;
+ std::cout << std::endl;
+ std::cout << "Notes:" << std::endl;
+ std::cout << " 'url' is the URL of the web page to be captured" << std::endl;
+ std::cout << " 'outputfile' is the prefix of the image files to be generated" << std::endl;
+ std::cout << std::endl;
+ std::cout << "Example: " << std::endl;
+ std::cout << " framecapture www.trolltech.com trolltech.png" << std::endl;
+ std::cout << std::endl;
+ std::cout << "Result:" << std::endl;
+ std::cout << " trolltech.png (full page)" << std::endl;
+ std::cout << " trolltech_frame1.png (...) trolltech_frameN.png ('N' number of internal frames)" << std::endl;
+ return 0;
+ }
+
+ QUrl url = QWebView::guessUrlFromString(QString::fromLatin1(argv[1]));
+ QString fileName = QString::fromLatin1(argv[2]);
+
+ QApplication a(argc, argv);
+ FrameCapture capture;
+ QObject::connect(&capture, SIGNAL(finished()), QApplication::instance(), SLOT(quit()));
+ capture.load(url, fileName);
+
+ return a.exec();
+}
+
diff --git a/mkspecs/common/mac.conf b/mkspecs/common/mac.conf
index 818b4504d..5d88ac4b6 100644
--- a/mkspecs/common/mac.conf
+++ b/mkspecs/common/mac.conf
@@ -38,8 +38,7 @@ QMAKE_DEL_FILE = rm -f
QMAKE_DEL_DIR = rmdir
QMAKE_CHK_DIR_EXISTS = test -d
QMAKE_MKDIR = mkdir -p
-# Need to enable the correct deployment target for Cocoa (should be 10.3 for Carbon).
-macx-icc: QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4
-else: QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.3
+QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4 # overridden to 10.5 for Cocoa on the compiler command line
+
include(unix.conf)
diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf
index 1bac953fa..a03a3139d 100644
--- a/mkspecs/features/qt.prf
+++ b/mkspecs/features/qt.prf
@@ -36,7 +36,7 @@ INCLUDEPATH = $$QMAKE_INCDIR_QT $$INCLUDEPATH #prepending prevents us from picki
win32:INCLUDEPATH += $$QMAKE_INCDIR_QT/ActiveQt
# As order does matter for static libs, we reorder the QT variable here
-TMPLIBS = webkit phonon dbus testlib script scripttools svg qt3support sql xmlpatterns xml egl opengl openvg gui network core
+TMPLIBS = multimedia webkit phonon dbus testlib script scripttools svg qt3support sql xmlpatterns xml egl opengl openvg gui network core
for(QTLIB, $$list($$TMPLIBS)) {
contains(QT, $$QTLIB): QT_ORDERED += $$QTLIB
}
@@ -152,6 +152,7 @@ for(QTLIB, $$list($$lower($$unique(QT)))) {
else:isEqual(QTLIB, dbus):qlib = QtDBus
else:isEqual(QTLIB, phonon):qlib = phonon
else:isEqual(QTLIB, webkit):qlib = QtWebKit
+ else:isEqual(QTLIB, multimedia):qlib = QtMultimedia
else:message("Unknown QT: $$QTLIB"):qlib =
!isEmpty(qlib) {
target_qt:isEqual(TARGET, qlib) {
diff --git a/mkspecs/features/qt_config.prf b/mkspecs/features/qt_config.prf
index 779c2e5ac..0a2d985de 100644
--- a/mkspecs/features/qt_config.prf
+++ b/mkspecs/features/qt_config.prf
@@ -4,7 +4,7 @@ isEmpty(QMAKE_QT_CONFIG)|!exists($$QMAKE_QT_CONFIG) {
else:exists($$_QMAKE_CACHE_):infile($$_QMAKE_CACHE_, QT_BUILD_TREE):QMAKE_QT_CONFIG = $$fromfile($$_QMAKE_CACHE_, QT_BUILD_TREE)/mkspecs/qconfig.pri
else:exists($$[QT_INSTALL_DATA]/mkspecs/qconfig.pri):QMAKE_QT_CONFIG = $$[QT_INSTALL_DATA]/mkspecs/qconfig.pri
}
-!exists($$QMAKE_QT_CONFIG)|!include($$QMAKE_QT_CONFIG) {
+!exists($$QMAKE_QT_CONFIG)|!include($$QMAKE_QT_CONFIG, "", true) {
debug(1, "Cannot load qconfig.pri!")
} else {
debug(1, "Loaded .qconfig.pri from ($$QMAKE_QT_CONFIG)")
diff --git a/mkspecs/linux-g++-gles2-experimental/qmake.conf b/mkspecs/linux-g++-gles2-experimental/qmake.conf
new file mode 100644
index 000000000..9c28d17fa
--- /dev/null
+++ b/mkspecs/linux-g++-gles2-experimental/qmake.conf
@@ -0,0 +1,22 @@
+#
+# Experimental qmake configuration for GLES2
+#
+
+MAKEFILE_GENERATOR = UNIX
+TEMPLATE = app
+CONFIG += qt warn_on release incremental link_prl
+QT += core gui
+QMAKE_INCREMENTAL_STYLE = sublib
+
+include(../common/g++.conf)
+
+QMAKE_LFLAGS += -Wl,-rpath-link=/usr/lib
+
+include(../common/linux.conf)
+
+QMAKE_LIBS_EGL = -lEGL
+QMAKE_LIBS_OPENGL = -lGLESv2
+QMAKE_LIBS_OPENGL_QT = -lGLESv2 -lEGL
+
+
+load(qt_config)
diff --git a/mkspecs/linux-g++-gles2-experimental/qplatformdefs.h b/mkspecs/linux-g++-gles2-experimental/qplatformdefs.h
new file mode 100644
index 000000000..b9a94e27b
--- /dev/null
+++ b/mkspecs/linux-g++-gles2-experimental/qplatformdefs.h
@@ -0,0 +1,164 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the qmake spec of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QPLATFORMDEFS_H
+#define QPLATFORMDEFS_H
+
+// Get Qt defines/settings
+
+#include "qglobal.h"
+
+// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs
+
+// 1) need to reset default environment if _BSD_SOURCE is defined
+// 2) need to specify POSIX thread interfaces explicitly in glibc 2.0
+// 3) it seems older glibc need this to include the X/Open stuff
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
+
+#include <unistd.h>
+
+
+// We are hot - unistd.h should have turned on the specific APIs we requested
+
+#include <features.h>
+#include <pthread.h>
+#include <dirent.h>
+#include <fcntl.h>
+#include <grp.h>
+#include <pwd.h>
+#include <signal.h>
+#include <dlfcn.h>
+
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/ipc.h>
+#include <sys/time.h>
+#include <sys/shm.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <netinet/in.h>
+#ifndef QT_NO_IPV6IFNAME
+#include <net/if.h>
+#endif
+
+#ifdef QT_LARGEFILE_SUPPORT
+#define QT_STATBUF struct stat64
+#define QT_STATBUF4TSTAT struct stat64
+#define QT_STAT ::stat64
+#define QT_FSTAT ::fstat64
+#define QT_LSTAT ::lstat64
+#define QT_OPEN ::open64
+#define QT_TRUNCATE ::truncate64
+#define QT_FTRUNCATE ::ftruncate64
+#define QT_LSEEK ::lseek64
+#else
+#define QT_STATBUF struct stat
+#define QT_STATBUF4TSTAT struct stat
+#define QT_STAT ::stat
+#define QT_FSTAT ::fstat
+#define QT_LSTAT ::lstat
+#define QT_OPEN ::open
+#define QT_TRUNCATE ::truncate
+#define QT_FTRUNCATE ::ftruncate
+#define QT_LSEEK ::lseek
+#endif
+
+#ifdef QT_LARGEFILE_SUPPORT
+#define QT_FOPEN ::fopen64
+#define QT_FSEEK ::fseeko64
+#define QT_FTELL ::ftello64
+#define QT_FGETPOS ::fgetpos64
+#define QT_FSETPOS ::fsetpos64
+#define QT_FPOS_T fpos64_t
+#define QT_OFF_T off64_t
+#else
+#define QT_FOPEN ::fopen
+#define QT_FSEEK ::fseek
+#define QT_FTELL ::ftell
+#define QT_FGETPOS ::fgetpos
+#define QT_FSETPOS ::fsetpos
+#define QT_FPOS_T fpos_t
+#define QT_OFF_T long
+#endif
+
+#define QT_STAT_REG S_IFREG
+#define QT_STAT_DIR S_IFDIR
+#define QT_STAT_MASK S_IFMT
+#define QT_STAT_LNK S_IFLNK
+#define QT_SOCKET_CONNECT ::connect
+#define QT_SOCKET_BIND ::bind
+#define QT_FILENO fileno
+#define QT_CLOSE ::close
+#define QT_READ ::read
+#define QT_WRITE ::write
+#define QT_ACCESS ::access
+#define QT_GETCWD ::getcwd
+#define QT_CHDIR ::chdir
+#define QT_MKDIR ::mkdir
+#define QT_RMDIR ::rmdir
+#define QT_OPEN_LARGEFILE O_LARGEFILE
+#define QT_OPEN_RDONLY O_RDONLY
+#define QT_OPEN_WRONLY O_WRONLY
+#define QT_OPEN_RDWR O_RDWR
+#define QT_OPEN_CREAT O_CREAT
+#define QT_OPEN_TRUNC O_TRUNC
+#define QT_OPEN_APPEND O_APPEND
+
+#define QT_SIGNAL_RETTYPE void
+#define QT_SIGNAL_ARGS int
+#define QT_SIGNAL_IGNORE SIG_IGN
+
+#if defined(__GLIBC__) && (__GLIBC__ >= 2)
+#define QT_SOCKLEN_T socklen_t
+#else
+#define QT_SOCKLEN_T int
+#endif
+
+#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500)
+#define QT_SNPRINTF ::snprintf
+#define QT_VSNPRINTF ::vsnprintf
+#endif
+
+
+#endif // QPLATFORMDEFS_H
diff --git a/mkspecs/wincewm65professional-msvc2005/default_post.prf b/mkspecs/wincewm65professional-msvc2005/default_post.prf
new file mode 100644
index 000000000..86bc964a5
--- /dev/null
+++ b/mkspecs/wincewm65professional-msvc2005/default_post.prf
@@ -0,0 +1 @@
+include(../wincewm60professional-msvc2005/default_post.prf)
diff --git a/mkspecs/wincewm65professional-msvc2005/qmake.conf b/mkspecs/wincewm65professional-msvc2005/qmake.conf
new file mode 100644
index 000000000..b4ae0966c
--- /dev/null
+++ b/mkspecs/wincewm65professional-msvc2005/qmake.conf
@@ -0,0 +1,5 @@
+include(../wincewm60professional-msvc2005/qmake.conf)
+
+DEFINES += QT_WINCE_GESTURES
+QMAKE_LIBS_GUI += TouchGestureCore.lib
+
diff --git a/mkspecs/wincewm65professional-msvc2005/qplatformdefs.h b/mkspecs/wincewm65professional-msvc2005/qplatformdefs.h
new file mode 100644
index 000000000..4317bc11e
--- /dev/null
+++ b/mkspecs/wincewm65professional-msvc2005/qplatformdefs.h
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the qmake spec of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "../wincewm60professional-msvc2005/qplatformdefs.h"
diff --git a/mkspecs/wincewm65professional-msvc2008/default_post.prf b/mkspecs/wincewm65professional-msvc2008/default_post.prf
new file mode 100644
index 000000000..c85456184
--- /dev/null
+++ b/mkspecs/wincewm65professional-msvc2008/default_post.prf
@@ -0,0 +1 @@
+include(../wincewm65professional-msvc2005/default_post.prf)
diff --git a/mkspecs/wincewm65professional-msvc2008/qmake.conf b/mkspecs/wincewm65professional-msvc2008/qmake.conf
new file mode 100644
index 000000000..552c7c8be
--- /dev/null
+++ b/mkspecs/wincewm65professional-msvc2008/qmake.conf
@@ -0,0 +1,3 @@
+include(../wincewm65professional-msvc2005/qmake.conf)
+QMAKE_COMPILER_DEFINES -= _MSC_VER=1400
+QMAKE_COMPILER_DEFINES += _MSC_VER=1500
diff --git a/mkspecs/wincewm65professional-msvc2008/qplatformdefs.h b/mkspecs/wincewm65professional-msvc2008/qplatformdefs.h
new file mode 100644
index 000000000..7f724f9b2
--- /dev/null
+++ b/mkspecs/wincewm65professional-msvc2008/qplatformdefs.h
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the qmake spec of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "../wincewm65professional-msvc2005/qplatformdefs.h"
+
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index 5f250bf34..9759e7d8b 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -1261,7 +1261,13 @@ void VcprojGenerator::initDeploymentTool()
searchPath = info.absoluteFilePath();
} else {
nameFilter = source.split('\\').last();
- searchPath = info.absolutePath();
+ if (source.contains('*')) {
+ source = source.split('*').first();
+ info = QFileInfo(source);
+ }
+ searchPath = info.absolutePath();
+ if (!info.exists())
+ fprintf(stderr, "Deployment file is missing %s\n", source.toLatin1().constData());
}
int pathSize = searchPath.size();
diff --git a/qmake/option.cpp b/qmake/option.cpp
index 230801736..5d7cb9b42 100644
--- a/qmake/option.cpp
+++ b/qmake/option.cpp
@@ -150,6 +150,9 @@ bool usage(const char *a0)
" In this mode qmake interprets files as files to\n"
" be built,\n"
" defaults to %s\n"
+ " Note: The created .pro file probably will \n"
+ " need to be edited. For example add the QT variable to \n"
+ " specify what modules are required.\n"
" -makefile Put qmake into makefile generation mode%s\n"
" In this mode qmake interprets files as project files to\n"
" be processed, if skipped qmake will try to find a project\n"
diff --git a/qmake/project.cpp b/qmake/project.cpp
index 4fefbabc7..6687e9a62 100644
--- a/qmake/project.cpp
+++ b/qmake/project.cpp
@@ -2693,10 +2693,15 @@ QMakeProject::doProjectTest(QString func, QList<QStringList> args_list, QMap<QSt
case T_LOAD: {
QString parseInto;
const bool include_statement = (func_t == T_INCLUDE);
- bool ignore_error = include_statement;
- if(args.count() == 2) {
+ bool ignore_error = false;
+ if(args.count() >= 2) {
if(func_t == T_INCLUDE) {
parseInto = args[1];
+ if (args.count() == 3){
+ QString sarg = args[2];
+ if (sarg.toLower() == "true" || sarg.toInt())
+ ignore_error = true;
+ }
} else {
QString sarg = args[1];
ignore_error = (sarg.toLower() == "true" || sarg.toInt());
@@ -2738,8 +2743,8 @@ QMakeProject::doProjectTest(QString func, QList<QStringList> args_list, QMap<QSt
if(stat == IncludeFeatureAlreadyLoaded) {
warn_msg(WarnParser, "%s:%d: Duplicate of loaded feature %s",
parser.file.toLatin1().constData(), parser.line_no, file.toLatin1().constData());
- } else if(stat == IncludeNoExist && include_statement) {
- warn_msg(WarnParser, "%s:%d: Unable to find file for inclusion %s",
+ } else if(stat == IncludeNoExist && !ignore_error) {
+ warn_msg(WarnAll, "%s:%d: Unable to find file for inclusion %s",
parser.file.toLatin1().constData(), parser.line_no, file.toLatin1().constData());
return false;
} else if(stat >= IncludeFailure) {
diff --git a/qmake/qmake.pri b/qmake/qmake.pri
index 9ba8506db..1f9243b5c 100644
--- a/qmake/qmake.pri
+++ b/qmake/qmake.pri
@@ -107,7 +107,7 @@ bootstrap { #Qt code
SOURCES += qfsfileengine_unix.cpp qfsfileengine_iterator_unix.cpp
mac {
SOURCES += qcore_mac.cpp qsettings_mac.cpp
- QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.3 #enables weak linking for 10.3 (exported)
+ QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4 #enables weak linking for 10.4 (exported)
LIBS += -framework ApplicationServices
}
} else:win32 {
diff --git a/src/3rdparty/phonon/ds9/mediaobject.cpp b/src/3rdparty/phonon/ds9/mediaobject.cpp
index 10782c251..b163ad4dd 100644
--- a/src/3rdparty/phonon/ds9/mediaobject.cpp
+++ b/src/3rdparty/phonon/ds9/mediaobject.cpp
@@ -57,24 +57,6 @@ namespace Phonon
{
}
- WorkerThread::Work WorkerThread::dequeueWork()
- {
- QMutexLocker locker(&m_mutex);
- if (m_finished) {
- return Work();
- }
- Work ret = m_queue.dequeue();
-
- //we ensure to have the wait condition in the right state
- if (m_queue.isEmpty()) {
- m_waitCondition.reset();
- } else {
- m_waitCondition.set();
- }
-
- return ret;
- }
-
void WorkerThread::run()
{
while (m_finished == false) {
@@ -88,11 +70,6 @@ namespace Phonon
}
DWORD result = ::WaitForMultipleObjects(count, handles, FALSE, INFINITE);
if (result == WAIT_OBJECT_0) {
- if (m_finished) {
- //that's the end of the thread execution
- return;
- }
-
handleTask();
} else {
//this is the event management
@@ -199,22 +176,25 @@ namespace Phonon
void WorkerThread::handleTask()
{
- const Work w = dequeueWork();
-
- if (m_finished) {
+ QMutexLocker locker(&m_mutex);
+ if (m_finished || m_queue.isEmpty()) {
return;
}
- HRESULT hr = S_OK;
+ const Work w = m_queue.dequeue();
- {
- QMutexLocker locker(&m_mutex);
- m_currentRender = w.graph;
- m_currentRenderId = w.id;
+ //we ensure to have the wait condition in the right state
+ if (m_queue.isEmpty()) {
+ m_waitCondition.reset();
+ } else {
+ m_waitCondition.set();
}
+ HRESULT hr = S_OK;
+
+ m_currentRender = w.graph;
+ m_currentRenderId = w.id;
if (w.task == ReplaceGraph) {
- QMutexLocker locker(&m_mutex);
int index = -1;
for(int i = 0; i < FILTER_COUNT; ++i) {
if (m_graphHandle[i].graph == w.oldGraph) {
@@ -237,6 +217,9 @@ namespace Phonon
m_graphHandle[index].handle = h;
}
} else if (w.task == Render) {
+ //we need to unlock here because the use might trigger a call to abort
+ //which uses the same mutex
+ locker.unlock();
if (w.filter) {
//let's render pins
w.graph->AddFilter(w.filter, 0);
@@ -255,6 +238,7 @@ namespace Phonon
if (hr != E_ABORT) {
emit asyncRenderFinished(w.id, hr, w.graph);
}
+ locker.relock();
} else if (w.task == Seek) {
//that's a seekrequest
ComPointer<IMediaSeeking> mediaSeeking(w.graph, IID_IMediaSeeking);
@@ -327,11 +311,8 @@ namespace Phonon
}
}
- {
- QMutexLocker locker(&m_mutex);
- m_currentRender = Graph();
- m_currentRenderId = 0;
- }
+ m_currentRender = Graph();
+ m_currentRenderId = 0;
}
void WorkerThread::abortCurrentRender(qint16 renderId)
diff --git a/src/3rdparty/phonon/ds9/mediaobject.h b/src/3rdparty/phonon/ds9/mediaobject.h
index 2c34ffc35..fe52604ae 100644
--- a/src/3rdparty/phonon/ds9/mediaobject.h
+++ b/src/3rdparty/phonon/ds9/mediaobject.h
@@ -135,7 +135,6 @@ namespace Phonon
};
QList<Filter> decoders; //for the state change requests
};
- Work dequeueWork();
void handleTask();
Graph m_currentRender;
diff --git a/src/3rdparty/phonon/phonon/mediasource.cpp b/src/3rdparty/phonon/phonon/mediasource.cpp
index 0a21c8766..c003af988 100644
--- a/src/3rdparty/phonon/phonon/mediasource.cpp
+++ b/src/3rdparty/phonon/phonon/mediasource.cpp
@@ -140,8 +140,12 @@ MediaSourcePrivate::~MediaSourcePrivate()
{
#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
if (autoDelete) {
- delete stream;
- delete ioDevice;
+ //here we use deleteLater because this object
+ //might be destroyed from another thread
+ if (stream)
+ stream->deleteLater();
+ if (ioDevice)
+ ioDevice->deleteLater();
}
#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM
}
diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro
index e49ab1344..2eb7c08f9 100644
--- a/src/3rdparty/webkit/WebCore/WebCore.pro
+++ b/src/3rdparty/webkit/WebCore/WebCore.pro
@@ -3159,7 +3159,7 @@ xpathbison.dependency_type = TYPE_C
xpathbison.variable_out = GENERATED_SOURCES
addExtraCompilerWithHeader(xpathbison)
-include($$PWD/../WebKit/qt/Api/headers.pri)
+include($$PWD/../WebKit/qt/Api/headers.pri, "", true)
HEADERS += $$WEBKIT_API_HEADERS
!CONFIG(QTDIR_build) {
target.path = $$[QT_INSTALL_LIBS]
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
index 1a45fe69c..613a72fd0 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
@@ -105,7 +105,7 @@ void QWEBKIT_EXPORT qt_drt_overwritePluginDirectories()
PluginDatabase* db = PluginDatabase::installedPlugins(/* populate */ false);
Vector<String> paths;
- String qtPath(getenv("QTWEBKIT_PLUGIN_PATH"));
+ String qtPath(qgetenv("QTWEBKIT_PLUGIN_PATH").data());
qtPath.split(UChar(':'), /* allowEmptyEntries */ false, paths);
db->setPluginDirectories(paths);
diff --git a/src/corelib/arch/arch.pri b/src/corelib/arch/arch.pri
index dd3141a3c..18f54ee5b 100644
--- a/src/corelib/arch/arch.pri
+++ b/src/corelib/arch/arch.pri
@@ -25,4 +25,4 @@ vxworks:HEADERS += arch/qatomic_vxworks.h
QT_ARCH_CPP = $$QT_SOURCE_TREE/src/corelib/arch/$$QT_ARCH
DEPENDPATH += $$QT_ARCH_CPP
-include($$QT_ARCH_CPP/arch.pri)
+include($$QT_ARCH_CPP/arch.pri, "", true)
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 18d5a9f80..1711f1671 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -1173,6 +1173,11 @@ class QDataStream;
# else
# define Q_OPENGL_EXPORT Q_DECL_IMPORT
# endif
+# if defined(QT_BUILD_MULTIMEDIA_LIB)
+# define Q_MULTIMEDIA_EXPORT Q_DECL_EXPORT
+# else
+# define Q_MULTIMEDIA_EXPORT Q_DECL_IMPORT
+# endif
# if defined(QT_BUILD_OPENVG_LIB)
# define Q_OPENVG_EXPORT Q_DECL_EXPORT
# else
@@ -1217,6 +1222,7 @@ class QDataStream;
# define Q_SVG_EXPORT Q_DECL_IMPORT
# define Q_CANVAS_EXPORT Q_DECL_IMPORT
# define Q_OPENGL_EXPORT Q_DECL_IMPORT
+# define Q_MULTIMEDIA_EXPORT Q_DECL_IMPORT
# define Q_OPENVG_EXPORT Q_DECL_IMPORT
# define Q_XML_EXPORT Q_DECL_IMPORT
# define Q_XMLPATTERNS_EXPORT Q_DECL_IMPORT
@@ -1243,6 +1249,7 @@ class QDataStream;
# define Q_NETWORK_EXPORT Q_DECL_EXPORT
# define Q_SVG_EXPORT Q_DECL_EXPORT
# define Q_OPENGL_EXPORT Q_DECL_EXPORT
+# define Q_MULTIMEDIA_EXPORT Q_DECL_EXPORT
# define Q_OPENVG_EXPORT Q_DECL_EXPORT
# define Q_XML_EXPORT Q_DECL_EXPORT
# define Q_XMLPATTERNS_EXPORT Q_DECL_EXPORT
@@ -1256,6 +1263,7 @@ class QDataStream;
# define Q_NETWORK_EXPORT
# define Q_SVG_EXPORT
# define Q_OPENGL_EXPORT
+# define Q_MULTIMEDIA_EXPORT
# define Q_XML_EXPORT
# define Q_XMLPATTERNS_EXPORT
# define Q_SCRIPT_EXPORT
@@ -2305,12 +2313,14 @@ QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathSysconf();
#define QT_MODULE_DBUS 0x08000
#define QT_MODULE_SCRIPTTOOLS 0x10000
#define QT_MODULE_OPENVG 0x20000
+#define QT_MODULE_MULTIMEDIA 0x40000
/* Qt editions */
#define QT_EDITION_CONSOLE (QT_MODULE_CORE \
| QT_MODULE_NETWORK \
| QT_MODULE_SQL \
| QT_MODULE_SCRIPT \
+ | QT_MODULE_MULTIMEDIA \
| QT_MODULE_XML \
| QT_MODULE_XMLPATTERNS \
| QT_MODULE_TEST \
@@ -2326,6 +2336,7 @@ QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathSysconf();
| QT_MODULE_OPENGL \
| QT_MODULE_OPENVG \
| QT_MODULE_SQL \
+ | QT_MODULE_MULTIMEDIA \
| QT_MODULE_XML \
| QT_MODULE_XMLPATTERNS \
| QT_MODULE_SCRIPT \
@@ -2374,6 +2385,9 @@ QT_LICENSED_MODULE(OpenVG)
#if (QT_EDITION & QT_MODULE_SQL)
QT_LICENSED_MODULE(Sql)
#endif
+#if (QT_EDITION & QT_MODULE_MULTIMEDIA)
+QT_LICENSED_MODULE(Multimedia)
+#endif
#if (QT_EDITION & QT_MODULE_XML)
QT_LICENSED_MODULE(Xml)
#endif
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index 072eb2736..cb0fdeb17 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -1541,9 +1541,11 @@ bool QDir::isReadable() const
/*!
\overload
- Returns true if the \e directory exists; otherwise returns false.
- (If a file with the same name is found this function will return
- false).
+ Returns true if the directory exists; otherwise returns false.
+ (If a file with the same name is found this function will return false).
+
+ The overload of this function that accepts an argument is used to test
+ for the presence of files and directories within a directory.
\sa QFileInfo::exists(), QFile::exists()
*/
@@ -1773,8 +1775,11 @@ bool QDir::rename(const QString &oldName, const QString &newName)
/*!
Returns true if the file called \a name exists; otherwise returns
- false. Unless \a name contains an absolute file path, the file
- name is assumed to be relative to the current directory.
+ false.
+
+ Unless \a name contains an absolute file path, the file name is assumed
+ to be relative to the directory itself, so this function is typically used
+ to check for the presence of files within a directory.
\sa QFileInfo::exists(), QFile::exists()
*/
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp
index 607b73450..168eac2e2 100644
--- a/src/corelib/io/qprocess_unix.cpp
+++ b/src/corelib/io/qprocess_unix.cpp
@@ -162,7 +162,17 @@ private:
QMap<int, QProcessInfo *> children;
};
-Q_GLOBAL_STATIC(QProcessManager, processManager)
+
+Q_GLOBAL_STATIC(QMutex, processManagerGlobalMutex)
+
+static QProcessManager *processManager() {
+ // The constructor of QProcessManager should be called only once
+ // so we cannot use Q_GLOBAL_STATIC directly for QProcessManager
+ QMutex *mutex = processManagerGlobalMutex();
+ QMutexLocker locker(mutex);
+ static QProcessManager processManager;
+ return &processManager;
+}
QProcessManager::QProcessManager()
{
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp
index eae17b4cf..d8da606c6 100644
--- a/src/corelib/io/qprocess_win.cpp
+++ b/src/corelib/io/qprocess_win.cpp
@@ -372,32 +372,30 @@ void QProcessPrivate::startProcess()
qDebug(" pass environment : %s", environment.isEmpty() ? "no" : "yes");
#endif
- DWORD dwCreationFlags = CREATE_NO_WINDOW;
-
#if defined(Q_OS_WINCE)
- QString fullPathProgram = program;
- if (!QDir::isAbsolutePath(fullPathProgram))
- fullPathProgram = QFileInfo(fullPathProgram).absoluteFilePath();
- fullPathProgram.replace(QLatin1Char('/'), QLatin1Char('\\'));
- success = CreateProcess((wchar_t*)fullPathProgram.utf16(),
- (wchar_t*)args.utf16(),
- 0, 0, false, 0, 0, 0, 0, pid);
+ QString fullPathProgram = program;
+ if (!QDir::isAbsolutePath(fullPathProgram))
+ fullPathProgram = QFileInfo(fullPathProgram).absoluteFilePath();
+ fullPathProgram.replace(QLatin1Char('/'), QLatin1Char('\\'));
+ success = CreateProcess((wchar_t*)fullPathProgram.utf16(),
+ (wchar_t*)args.utf16(),
+ 0, 0, false, 0, 0, 0, 0, pid);
#else
- dwCreationFlags |= CREATE_UNICODE_ENVIRONMENT;
- STARTUPINFOW startupInfo = { sizeof( STARTUPINFO ), 0, 0, 0,
- (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
- (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
- 0, 0, 0,
- STARTF_USESTDHANDLES,
- 0, 0, 0,
- stdinChannel.pipe[0], stdoutChannel.pipe[1], stderrChannel.pipe[1]
- };
- success = CreateProcess(0, (wchar_t*)args.utf16(),
- 0, 0, TRUE, dwCreationFlags,
- environment ? envlist.data() : 0,
- workingDirectory.isEmpty() ? 0
- : (wchar_t*)QDir::toNativeSeparators(workingDirectory).utf16(),
- &startupInfo, pid);
+ DWORD dwCreationFlags = CREATE_NO_WINDOW;
+ dwCreationFlags |= CREATE_UNICODE_ENVIRONMENT;
+ STARTUPINFOW startupInfo = { sizeof( STARTUPINFO ), 0, 0, 0,
+ (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
+ (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
+ 0, 0, 0,
+ STARTF_USESTDHANDLES,
+ 0, 0, 0,
+ stdinChannel.pipe[0], stdoutChannel.pipe[1], stderrChannel.pipe[1]
+ };
+ success = CreateProcess(0, (wchar_t*)args.utf16(),
+ 0, 0, TRUE, dwCreationFlags,
+ environment ? envlist.data() : 0,
+ workingDirectory.isEmpty() ? 0 : (wchar_t*)QDir::toNativeSeparators(workingDirectory).utf16(),
+ &startupInfo, pid);
if (stdinChannel.pipe[0] != INVALID_Q_PIPE) {
CloseHandle(stdinChannel.pipe[0]);
diff --git a/src/corelib/kernel/qeventdispatcher_glib.cpp b/src/corelib/kernel/qeventdispatcher_glib.cpp
index 7610631e1..2bbe560cb 100644
--- a/src/corelib/kernel/qeventdispatcher_glib.cpp
+++ b/src/corelib/kernel/qeventdispatcher_glib.cpp
@@ -263,6 +263,7 @@ QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(GMainContext *context)
(void) new (&timerSource->timerList) QTimerInfoList();
timerSource->processEventsFlags = QEventLoop::AllEvents;
g_source_set_can_recurse(&timerSource->source, true);
+ g_source_set_priority(&timerSource->source, G_PRIORITY_DEFAULT_IDLE);
g_source_attach(&timerSource->source, mainContext);
}
diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp
index 7982d4cb7..da151481b 100644
--- a/src/corelib/kernel/qeventdispatcher_unix.cpp
+++ b/src/corelib/kernel/qeventdispatcher_unix.cpp
@@ -627,7 +627,7 @@ QEventDispatcherUNIX::~QEventDispatcherUNIX()
int QEventDispatcherUNIX::select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
timeval *timeout)
{
- return ::qt_safe_select(nfds, readfds, writefds, exceptfds, timeout);
+ return qt_safe_select(nfds, readfds, writefds, exceptfds, timeout);
}
/*!
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index d43c5dd8d..f153c7ecc 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -2488,6 +2488,7 @@ bool QMetaProperty::isUser(const QObject *object) const
}
/*!
+ \since 4.6
Returns true if the property is constant; otherwise returns false.
A property is constant if the \c{Q_PROPERTY()}'s \c CONSTANT attribute
@@ -2502,6 +2503,7 @@ bool QMetaProperty::isConstant() const
}
/*!
+ \since 4.6
Returns true if the property is final; otherwise returns false.
A property is final if the \c{Q_PROPERTY()}'s \c FINAL attribute
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 7e7dcaf84..65201700e 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -56,6 +56,7 @@
#include <qvarlengtharray.h>
#include <qset.h>
#include <qsemaphore.h>
+#include <qsharedpointer.h>
#include <private/qorderedmutexlocker_p.h>
#include <private/qmutexpool_p.h>
@@ -768,6 +769,18 @@ QObject::~QObject()
QObjectPrivate::clearGuards(this);
}
+ if (d->sharedRefcount) {
+ if (d->sharedRefcount->strongref > 0) {
+ qWarning("QObject: shared QObject was deleted directly. The program is malformed and may crash.");
+ // but continue deleting, it's too late to stop anyway
+ }
+
+ // indicate to all QWeakPointers that this QObject has now been deleted
+ d->sharedRefcount->strongref = 0;
+ if (!d->sharedRefcount->weakref.deref())
+ delete d->sharedRefcount;
+ }
+
emit destroyed(this);
if (d->declarativeData)
d->declarativeData->destroyed(this);
@@ -830,9 +843,9 @@ QObject::~QObject()
if (senderLists)
senderLists->dirty = true;
+ node = node->next;
if (needToUnlock)
m->unlock();
- node = node->next;
}
}
diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h
index e58ee6cf8..5d17bfdbd 100644
--- a/src/corelib/kernel/qobject_p.h
+++ b/src/corelib/kernel/qobject_p.h
@@ -67,6 +67,7 @@ QT_BEGIN_NAMESPACE
class QVariant;
class QThreadData;
class QObjectConnectionListVector;
+namespace QtSharedPointer { struct ExternalRefCountData; }
/* mirrored in QtTestLib, DON'T CHANGE without prior warning */
struct QSignalSpyCallbackSet
@@ -187,6 +188,7 @@ public:
// plus QPointer, which keeps a separate list
QDeclarativeData *declarativeData;
QGuard<QObject> *objectGuards;
+ QAtomicPointer<QtSharedPointer::ExternalRefCountData> sharedRefcount;
int *deleteWatch;
};
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index 2b5ea0ae5..41669440f 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -161,6 +161,9 @@ static void construct(QVariant::Private *x, const void *copy)
case QMetaType::Float:
x->data.f = copy ? *static_cast<const float*>(copy) : 0.0f;
break;
+ case QMetaType::QObjectStar:
+ x->data.o = copy ? *static_cast<QObject *const*>(copy) : 0;
+ break;
case QVariant::LongLong:
x->data.ll = copy ? *static_cast<const qlonglong *>(copy) : Q_INT64_C(0);
break;
@@ -257,6 +260,7 @@ static void clear(QVariant::Private *d)
case QVariant::ULongLong:
case QVariant::Double:
case QMetaType::Float:
+ case QMetaType::QObjectStar:
break;
case QVariant::Invalid:
case QVariant::UserType:
@@ -326,6 +330,7 @@ static bool isNull(const QVariant::Private *d)
case QVariant::Bool:
case QVariant::Double:
case QMetaType::Float:
+ case QMetaType::QObjectStar:
break;
}
return d->is_null;
@@ -419,6 +424,8 @@ static bool compare(const QVariant::Private *a, const QVariant::Private *b)
return a->data.d == b->data.d;
case QMetaType::Float:
return a->data.f == b->data.f;
+ case QMetaType::QObjectStar:
+ return a->data.o == b->data.o;
case QVariant::Date:
return *v_cast<QDate>(a) == *v_cast<QDate>(b);
case QVariant::Time:
@@ -1048,6 +1055,9 @@ static void streamDebug(QDebug dbg, const QVariant &v)
case QMetaType::Float:
dbg.nospace() << qVariantValue<float>(v);
break;
+ case QMetaType::QObjectStar:
+ dbg.nospace() << qVariantValue<QObject *>(v);
+ break;
case QVariant::Double:
dbg.nospace() << v.toDouble();
break;
@@ -1361,7 +1371,7 @@ void QVariant::create(int type, const void *copy)
QVariant::~QVariant()
{
- if (d.type > Char && d.type != QMetaType::Float && (!d.is_shared || !d.data.shared->ref.deref()))
+ if (d.type > Char && d.type != QMetaType::Float && d.type != QMetaType::QObjectStar && (!d.is_shared || !d.data.shared->ref.deref()))
handler->clear(&d);
}
@@ -1377,7 +1387,7 @@ QVariant::QVariant(const QVariant &p)
{
if (d.is_shared) {
d.data.shared->ref.ref();
- } else if (p.d.type > Char && p.d.type != QMetaType::Float) {
+ } else if (p.d.type > Char && p.d.type != QMetaType::Float && p.d.type != QMetaType::QObjectStar) {
handler->construct(&d, p.constData());
d.is_null = p.d.is_null;
}
@@ -1733,7 +1743,7 @@ QVariant& QVariant::operator=(const QVariant &variant)
if (variant.d.is_shared) {
variant.d.data.shared->ref.ref();
d = variant.d;
- } else if (variant.d.type > Char && variant.d.type != QMetaType::Float) {
+ } else if (variant.d.type > Char && variant.d.type != QMetaType::Float && variant.d.type != QMetaType::QObjectStar) {
d.type = variant.d.type;
handler->construct(&d, variant.constData());
d.is_null = variant.d.is_null;
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index a68939d48..4489e9558 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -358,6 +358,7 @@ class Q_CORE_EXPORT QVariant
float f;
qlonglong ll;
qulonglong ull;
+ QObject *o;
void *ptr;
PrivateShared *shared;
} data;
diff --git a/src/corelib/statemachine/qhistorystate.cpp b/src/corelib/statemachine/qhistorystate.cpp
index e5ca83769..d21eee985 100644
--- a/src/corelib/statemachine/qhistorystate.cpp
+++ b/src/corelib/statemachine/qhistorystate.cpp
@@ -120,7 +120,7 @@ QT_BEGIN_NAMESPACE
*/
QHistoryStatePrivate::QHistoryStatePrivate()
- : defaultState(0)
+ : defaultState(0), historyType(QHistoryState::ShallowHistory)
{
}
@@ -135,8 +135,6 @@ QHistoryStatePrivate *QHistoryStatePrivate::get(QHistoryState *q)
QHistoryState::QHistoryState(QState *parent)
: QAbstractState(*new QHistoryStatePrivate, parent)
{
- Q_D(QHistoryState);
- d->historyType = ShallowHistory;
}
/*!
Constructs a new history state of the given \a type, with the given \a
diff --git a/src/corelib/statemachine/qstate_p.h b/src/corelib/statemachine/qstate_p.h
index 20eb5eadb..c43a26c95 100644
--- a/src/corelib/statemachine/qstate_p.h
+++ b/src/corelib/statemachine/qstate_p.h
@@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE
struct QPropertyAssignment
{
QPropertyAssignment()
- : object(0) {}
+ : object(0), explicitlySet(true) {}
QPropertyAssignment(QObject *o, const QByteArray &n,
const QVariant &v, bool es = true)
: object(o), propertyName(n), value(v), explicitlySet(es)
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp
index 9cb1d4dba..59261766d 100644
--- a/src/corelib/statemachine/qstatemachine.cpp
+++ b/src/corelib/statemachine/qstatemachine.cpp
@@ -209,6 +209,7 @@ QStateMachinePrivate::QStateMachinePrivate()
processing = false;
processingScheduled = false;
stop = false;
+ stopProcessingReason = EventQueueEmpty;
error = QStateMachine::NoError;
globalRestorePolicy = QStateMachine::DoNotRestoreProperties;
signalEventGenerator = 0;
diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp
index ef4dfacb4..cdb7d1d08 100644
--- a/src/corelib/tools/qsharedpointer.cpp
+++ b/src/corelib/tools/qsharedpointer.cpp
@@ -365,7 +365,7 @@
Returns a weak reference object that shares the pointer referenced
by this object.
- \sa QWeakPointer::QWeakPointer(const QSharedPointer<T> &)
+ \sa QWeakPointer::QWeakPointer()
*/
/*!
@@ -553,7 +553,7 @@
qDebug() << "The value has already been deleted";
\endcode
- \sa QSharedPointer::QSharedPointer(const QWeakPointer<T> &)
+ \sa QSharedPointer::QSharedPointer()
*/
/*!
@@ -864,6 +864,61 @@
#include <qset.h>
#include <qmutex.h>
+#if !defined(QT_NO_QOBJECT)
+#include "../kernel/qobject_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \internal
+ This function is called for a just-created QObject \a obj, to enable
+ the use of QSharedPointer and QWeakPointer.
+
+ When QSharedPointer is active in a QObject, the object must not be deleted
+ directly: the lifetime is managed by the QSharedPointer object. In that case,
+ the deleteLater() and parent-child relationship in QObject only decrease
+ the strong reference count, instead of deleting the object.
+*/
+void QtSharedPointer::ExternalRefCountData::setQObjectShared(const QObject *obj, bool)
+{
+ Q_ASSERT(obj);
+ QObjectPrivate *d = QObjectPrivate::get(const_cast<QObject *>(obj));
+
+ if (d->sharedRefcount)
+ qFatal("QSharedPointer: pointer %p already has reference counting", obj);
+ d->sharedRefcount = this;
+
+ // QObject decreases the refcount too, so increase it up
+ weakref.ref();
+}
+
+QtSharedPointer::ExternalRefCountData *QtSharedPointer::ExternalRefCountData::getAndRef(const QObject *obj)
+{
+ Q_ASSERT(obj);
+ QObjectPrivate *d = QObjectPrivate::get(const_cast<QObject *>(obj));
+ ExternalRefCountData *that = d->sharedRefcount;
+ if (that) {
+ that->weakref.ref();
+ return that;
+ }
+
+ // we can create the refcount data because it doesn't exist
+ ExternalRefCountData *x = new ExternalRefCountData(Qt::Uninitialized);
+ x->strongref = -1;
+ x->weakref = 2; // the QWeakPointer that called us plus the QObject itself
+ if (!d->sharedRefcount.testAndSetRelease(0, x)) {
+ delete x;
+ d->sharedRefcount->weakref.ref();
+ }
+ return d->sharedRefcount;
+}
+
+QT_END_NAMESPACE
+
+#endif
+
+
+
#if !defined(QT_NO_MEMBER_TEMPLATES)
//# define QT_SHARED_POINTER_BACKTRACE_SUPPORT
@@ -882,6 +937,8 @@
# include <unistd.h>
# include <sys/wait.h>
+QT_BEGIN_NAMESPACE
+
static inline QByteArray saveBacktrace() __attribute__((always_inline));
static inline QByteArray saveBacktrace()
{
@@ -942,6 +999,9 @@ static void printBacktrace(QByteArray stacktrace)
waitpid(child, 0, 0);
}
}
+
+QT_END_NAMESPACE
+
# endif // BACKTRACE_SUPPORTED
namespace {
diff --git a/src/corelib/tools/qsharedpointer.h b/src/corelib/tools/qsharedpointer.h
index abd83ad0c..2f86ce783 100644
--- a/src/corelib/tools/qsharedpointer.h
+++ b/src/corelib/tools/qsharedpointer.h
@@ -115,6 +115,7 @@ public:
QWeakPointer<T> operator=(const QWeakPointer<T> &other);
QWeakPointer<T> operator=(const QSharedPointer<T> &other);
+ T *data() const;
void clear();
QSharedPointer<T> toStrongRef() const;
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h
index e8e38126a..8a343620b 100644
--- a/src/corelib/tools/qsharedpointer_impl.h
+++ b/src/corelib/tools/qsharedpointer_impl.h
@@ -94,7 +94,6 @@ namespace QtSharedPointer {
template <class T> class InternalRefCount;
template <class T> class ExternalRefCount;
- template <class X, class T> QSharedPointer<X> strongRefFromWeakHelper(const QWeakPointer<T> &, X*);
template <class X, class Y> QSharedPointer<X> copyAndSetPointer(X * ptr, const QSharedPointer<Y> &src);
// used in debug mode to verify the reuse of pointers
@@ -131,21 +130,10 @@ namespace QtSharedPointer {
inline T *operator->() const { return data(); }
protected:
- inline Basic() : value(0) { }
+ inline Basic(T *ptr = 0) : value(ptr) { }
+ inline Basic(Qt::Initialization) { }
// ~Basic();
- inline void verifyReconstruction(const T *ptr)
- {
- Q_ASSERT_X(!ptr || value != ptr, "QSharedPointer",
- "QSharedPointer violation: you cannot create two QSharedPointer objects "
- "from the same pointer");
-
- // make use of the "ptr" variable in the no-op statement below
- // since this function is in a public header, we don't
- // want warnings on "unused variables" to show up everywhere
- ptr = 0;
- }
-
inline void internalConstruct(T *ptr)
{
value = ptr;
@@ -162,13 +150,24 @@ namespace QtSharedPointer {
struct ExternalRefCountData
{
- QAtomicInt weakref;
- QAtomicInt strongref;
+ QBasicAtomicInt weakref;
+ QBasicAtomicInt strongref;
- inline ExternalRefCountData() : weakref(1), strongref(1) { }
- virtual inline ~ExternalRefCountData() { Q_ASSERT(!weakref); Q_ASSERT(!strongref); }
+ inline ExternalRefCountData()
+ {
+ QBasicAtomicInt proto = Q_BASIC_ATOMIC_INITIALIZER(1);
+ weakref = strongref = proto;
+ }
+ inline ExternalRefCountData(Qt::Initialization) { }
+ virtual inline ~ExternalRefCountData() { Q_ASSERT(!weakref); Q_ASSERT(strongref <= 0); }
virtual inline bool destroy() { return false; }
+
+#ifndef QT_NO_QOBJECT
+ Q_CORE_EXPORT static ExternalRefCountData *getAndRef(const QObject *);
+ Q_CORE_EXPORT void setQObjectShared(const QObject *, bool enable);
+#endif
+ inline void setQObjectShared(...) { }
};
// sizeof(ExternalRefCount) = 12 (32-bit) / 16 (64-bit)
@@ -303,9 +302,10 @@ namespace QtSharedPointer {
#ifdef QT_SHAREDPOINTER_TRACK_POINTERS
internalConstruct<void (*)(T *)>(ptr, normalDeleter);
#else
- Q_ASSERT(!d);
if (ptr)
d = new Data;
+ else
+ d = 0;
internalFinishConstruction(ptr);
#endif
}
@@ -313,9 +313,10 @@ namespace QtSharedPointer {
template <typename Deleter>
inline void internalConstruct(T *ptr, Deleter deleter)
{
- Q_ASSERT(!d);
if (ptr)
d = ExternalRefCountWithCustomDeleter<T, Deleter>::create(ptr, deleter);
+ else
+ d = 0;
internalFinishConstruction(ptr);
}
@@ -329,15 +330,20 @@ namespace QtSharedPointer {
inline void internalFinishConstruction(T *ptr)
{
Basic<T>::internalConstruct(ptr);
+ if (ptr) d->setQObjectShared(ptr, true);
#ifdef QT_SHAREDPOINTER_TRACK_POINTERS
if (ptr) internalSafetyCheckAdd2(d, ptr);
#endif
}
inline ExternalRefCount() : d(0) { }
- inline ~ExternalRefCount() { if (d && !deref()) delete d; }
+ inline ExternalRefCount(Qt::Initialization i) : Basic<T>(i) { }
inline ExternalRefCount(const ExternalRefCount<T> &other) : Basic<T>(other), d(other.d)
{ if (d) ref(); }
+ template <class X>
+ inline ExternalRefCount(const ExternalRefCount<X> &other) : Basic<T>(other.value), d(other.d)
+ { if (d) ref(); }
+ inline ~ExternalRefCount() { if (d && !deref()) delete d; }
template <class X>
inline void internalCopy(const ExternalRefCount<X> &other)
@@ -351,23 +357,19 @@ namespace QtSharedPointer {
delete this->value;
}
- private:
#if defined(Q_NO_TEMPLATE_FRIENDS)
public:
#else
template <class X> friend class ExternalRefCount;
template <class X> friend class QWeakPointer;
template <class X, class Y> friend QSharedPointer<X> copyAndSetPointer(X * ptr, const QSharedPointer<Y> &src);
- template <class X, class Y> friend QSharedPointer<X> QtSharedPointer::strongRefFromWeakHelper(const QWeakPointer<Y> &src, X *);
#endif
inline void internalSet(Data *o, T *actual)
{
- if (d == o) return;
if (o) {
- verifyReconstruction(actual);
-
// increase the strongref, but never up from zero
+ // or less (-1 is used by QWeakPointer on untracked QObject)
register int tmp = o->strongref;
while (tmp > 0) {
// try to increment from "tmp" to "tmp + 1"
@@ -376,7 +378,7 @@ namespace QtSharedPointer {
tmp = o->strongref; // failed, try again
}
- if (tmp)
+ if (tmp > 0)
o->weakref.ref();
else
o = 0;
@@ -387,7 +389,6 @@ namespace QtSharedPointer {
this->value = d && d->strongref ? actual : 0;
}
- protected:
Data *d;
private:
@@ -403,7 +404,8 @@ public:
inline QSharedPointer() { }
// inline ~QSharedPointer() { }
- inline explicit QSharedPointer(T *ptr) { internalConstruct(ptr); }
+ inline explicit QSharedPointer(T *ptr) : BaseClass(Qt::Uninitialized)
+ { internalConstruct(ptr); }
template <typename Deleter>
inline QSharedPointer(T *ptr, Deleter d) { internalConstruct(ptr, d); }
@@ -415,13 +417,9 @@ public:
return *this;
}
- inline QSharedPointer(const QWeakPointer<T> &other)
- { *this = QtSharedPointer::strongRefFromWeakHelper(other, static_cast<T*>(0)); }
- inline QSharedPointer<T> &operator=(const QWeakPointer<T> &other)
- { *this = QtSharedPointer::strongRefFromWeakHelper(other, static_cast<T*>(0)); return *this; }
-
template <class X>
- inline QSharedPointer(const QSharedPointer<X> &other) { *this = other; }
+ inline QSharedPointer(const QSharedPointer<X> &other) : BaseClass(other)
+ { }
template <class X>
inline QSharedPointer<T> &operator=(const QSharedPointer<X> &other)
@@ -432,12 +430,12 @@ public:
}
template <class X>
- inline QSharedPointer(const QWeakPointer<X> &other)
- { *this = QtSharedPointer::strongRefFromWeakHelper(other, static_cast<T *>(0)); }
+ inline QSharedPointer(const QWeakPointer<X> &other) : BaseClass(Qt::Uninitialized)
+ { this->d = 0; *this = other; }
template <class X>
inline QSharedPointer<T> &operator=(const QWeakPointer<X> &other)
- { *this = strongRefFromWeakHelper(other, static_cast<T *>(0)); return *this; }
+ { internalSet(other.d, other.value); return *this; }
template <class X>
QSharedPointer<X> staticCast() const
@@ -469,10 +467,13 @@ public:
QWeakPointer<T> toWeakRef() const;
+protected:
+ inline QSharedPointer(Qt::Initialization i) : BaseClass(i) {}
+
public:
static inline QSharedPointer<T> create()
{
- QSharedPointer<T> result;
+ QSharedPointer<T> result(Qt::Uninitialized);
result.internalCreate();
// now initialize the data
@@ -496,6 +497,15 @@ public:
inline QWeakPointer() : d(0), value(0) { }
inline ~QWeakPointer() { if (d && !d->weakref.deref()) delete d; }
+
+ // special constructor that is enabled only if X derives from QObject
+ template <class X>
+ inline QWeakPointer(X *ptr) : d(ptr ? d->getAndRef(ptr) : 0), value(ptr)
+ { }
+ template <class X>
+ inline QWeakPointer &operator=(X *ptr)
+ { return *this = QWeakPointer(ptr); }
+
inline QWeakPointer(const QWeakPointer<T> &o) : d(o.d), value(o.value)
{ if (d) d->weakref.ref(); }
inline QWeakPointer<T> &operator=(const QWeakPointer<T> &o)
@@ -547,7 +557,7 @@ public:
template <class X>
inline bool operator==(const QSharedPointer<X> &o) const
- { return d == o.d && value == static_cast<const T *>(o.data()); }
+ { return d == o.d; }
template <class X>
inline bool operator!=(const QSharedPointer<X> &o) const
@@ -562,7 +572,7 @@ private:
#if defined(Q_NO_TEMPLATE_FRIENDS)
public:
#else
- template <class X, class Y> friend QSharedPointer<X> QtSharedPointer::strongRefFromWeakHelper(const QWeakPointer<Y> &src, X *);
+ template <class X> friend class QSharedPointer;
#endif
inline void internalSet(Data *o, T *actual)
@@ -639,14 +649,6 @@ namespace QtSharedPointer {
result.internalSet(src.d, ptr);
return result;
}
- template <class X, class T>
- Q_INLINE_TEMPLATE QSharedPointer<X> strongRefFromWeakHelper
- (const QT_PREPEND_NAMESPACE(QWeakPointer<T>) &src, X *)
- {
- QSharedPointer<X> result;
- result.internalSet(src.d, src.value);
- return result;
- }
}
// cast operators
diff --git a/src/corelib/tools/qtimeline.cpp b/src/corelib/tools/qtimeline.cpp
index e32fc0358..6dbad3424 100644
--- a/src/corelib/tools/qtimeline.cpp
+++ b/src/corelib/tools/qtimeline.cpp
@@ -69,7 +69,6 @@ public:
int currentLoopCount;
int currentTime;
- int elapsedTime;
int timerId;
QTime timer;
@@ -212,7 +211,7 @@ void QTimeLinePrivate::setCurrentTime(int msecs)
applies an interpolation algorithm to generate these value. You can choose
from a set of predefined timeline algorithms by calling
setCurveShape().
-
+
Note that by default, QTimeLine uses the EaseInOut curve shape,
which provides a value that grows slowly, then grows steadily, and
finally grows slowly. For a custom timeline, you can reimplement
@@ -549,7 +548,7 @@ void QTimeLine::setCurveShape(CurveShape shape)
case CosineCurve:
setEasingCurve(QEasingCurve(QEasingCurve::CosineCurve));
break;
- }
+ }
}
/*!
@@ -559,7 +558,7 @@ void QTimeLine::setCurveShape(CurveShape shape)
Specifies the easing curve that the timeline will use.
If both easing curve and curveShape are set, the last set property will
- override the previous one. (If valueForTime() is reimplemented it will
+ override the previous one. (If valueForTime() is reimplemented it will
override both)
*/
@@ -663,6 +662,7 @@ qreal QTimeLine::valueForTime(int msec) const
second). You can change the update interval by calling
setUpdateInterval().
+ The timeline will start from position 0, or the end if going backward.
If you want to resume a stopped timeline without restarting, you can call
resume() instead.
@@ -675,10 +675,8 @@ void QTimeLine::start()
qWarning("QTimeLine::start: already running");
return;
}
- int curTime = d->currentTime;
- if (curTime == d->duration && d->direction == Forward)
- curTime = 0;
- else if (curTime == 0 && d->direction == Backward)
+ int curTime = 0;
+ if (d->direction == Backward)
curTime = d->duration;
d->timerId = startTimer(d->updateInterval);
d->startTime = curTime;
@@ -694,7 +692,7 @@ void QTimeLine::start()
frame and value at regular intervals.
In contrast to start(), this function does not restart the timeline before
- is resumes.
+ it resumes.
\sa start(), updateInterval(), frameChanged(), valueChanged()
*/
diff --git a/src/gui/dialogs/qcolordialog.cpp b/src/gui/dialogs/qcolordialog.cpp
index aee592c21..0357a7a60 100644
--- a/src/gui/dialogs/qcolordialog.cpp
+++ b/src/gui/dialogs/qcolordialog.cpp
@@ -1836,8 +1836,8 @@ QRgb QColorDialog::getRgba(QRgb initial, bool *ok, QWidget *parent)
QColorDialog::~QColorDialog()
{
- Q_D(QColorDialog);
#if defined(Q_WS_MAC)
+ Q_D(QColorDialog);
if (d->delegate) {
d->releaseCocoaColorPanelDelegate();
QColorDialogPrivate::sharedColorPanelAvailable = true;
diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp
index 1ec94b644..f000033d9 100644
--- a/src/gui/dialogs/qfiledialog.cpp
+++ b/src/gui/dialogs/qfiledialog.cpp
@@ -394,6 +394,9 @@ QList<QUrl> QFileDialog::sidebarUrls() const
static const qint32 QFileDialogMagic = 0xbe;
+const char *qt_file_dialog_filter_reg_exp =
+"^(.*)\\(([a-zA-Z0-9_.*? +;#\\-\\[\\]@\\{\\}/!<>\\$%&=^~:\\|]*)\\)$";
+
/*!
\since 4.3
Saves the state of the dialog's layout, history and current directory.
@@ -984,8 +987,13 @@ void QFileDialog::setNameFilters(const QStringList &filters)
if (testOption(HideNameFilterDetails)) {
QStringList strippedFilters;
+ QRegExp r(QString::fromLatin1(qt_file_dialog_filter_reg_exp));
for (int i = 0; i < cleanedFilters.count(); ++i) {
- strippedFilters.append(cleanedFilters[i].mid(0, cleanedFilters[i].indexOf(QLatin1String(" ("))));
+ QString filterName;
+ int index = r.indexIn(cleanedFilters[i]);
+ if (index >= 0)
+ filterName = r.cap(1);
+ strippedFilters.append(filterName.simplified());
}
d->qFileDialogUi->fileTypeCombo->addItems(strippedFilters);
} else {
@@ -2837,10 +2845,6 @@ void QFileDialogPrivate::_q_goToDirectory(const QString &path)
}
}
-const char *qt_file_dialog_filter_reg_exp =
-"(\\W|[a-zA-Z0-9 -]*)\\(([a-zA-Z0-9_.*? +;#\\-\\[\\]@\\{\\}/!<>\\$%&=^~:\\|]*)\\)$";
-
-
// Makes a list of filters from a normal filter string "Image Files (*.png *.jpg)"
QStringList qt_clean_filter_list(const QString &filter)
{
diff --git a/src/gui/dialogs/qfiledialog_win.cpp b/src/gui/dialogs/qfiledialog_win.cpp
index 9bf82c334..114456d6b 100644
--- a/src/gui/dialogs/qfiledialog_win.cpp
+++ b/src/gui/dialogs/qfiledialog_win.cpp
@@ -59,7 +59,10 @@
#endif
#include <shlobj.h>
-
+//At some point we can hope that mingw will support that interface
+#if !defined(Q_WS_WINCE) && !defined(Q_CC_MINGW)
+#include <shobjidl.h>
+#endif
#include <objbase.h>
#if defined(__IFileDialog_INTERFACE_DEFINED__) \
@@ -173,15 +176,22 @@ static QStringList qt_win_make_filters_list(const QString &filter)
}
// Makes a NUL-oriented Windows filter from a Qt filter.
-static QString qt_win_filter(const QString &filter)
+static QString qt_win_filter(const QString &filter, bool hideFiltersDetails)
{
QStringList filterLst = qt_win_make_filters_list(filter);
QStringList::Iterator it = filterLst.begin();
QString winfilters;
+ QRegExp r(QString::fromLatin1(qt_file_dialog_filter_reg_exp));
for (; it != filterLst.end(); ++it) {
QString subfilter = *it;
if (!subfilter.isEmpty()) {
- winfilters += subfilter;
+ if (hideFiltersDetails) {
+ int index = r.indexIn(subfilter);
+ if (index >= 0)
+ winfilters += r.cap(1);
+ } else {
+ winfilters += subfilter;
+ }
winfilters += QChar();
winfilters += qt_win_extract_filter(subfilter);
winfilters += QChar();
@@ -295,9 +305,10 @@ QString qt_win_get_open_file_name(const QFileDialogArgs &args,
modal_widget.setParent(args.parent, Qt::Window);
QApplicationPrivate::enterModal(&modal_widget);
+ bool hideFiltersDetails = args.options & QFileDialog::HideNameFilterDetails;
OPENFILENAME* ofn = qt_win_make_OFN(args.parent, args.selection,
args.directory, args.caption,
- qt_win_filter(args.filter),
+ qt_win_filter(args.filter, hideFiltersDetails),
QFileDialog::ExistingFile,
args.options);
if (idx)
@@ -354,7 +365,7 @@ QString qt_win_get_save_file_name(const QFileDialogArgs &args,
modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true);
modal_widget.setParent(args.parent, Qt::Window);
QApplicationPrivate::enterModal(&modal_widget);
-
+ bool hideFiltersDetails = args.options & QFileDialog::HideNameFilterDetails;
// This block is used below for the lpstrDefExt member.
// Note that the current MSDN docs document this member wrong.
// It should rather be documented as "the default extension if no extension was given and if the
@@ -374,7 +385,7 @@ QString qt_win_get_save_file_name(const QFileDialogArgs &args,
OPENFILENAME *ofn = qt_win_make_OFN(args.parent, args.selection,
args.directory, args.caption,
- qt_win_filter(args.filter),
+ qt_win_filter(args.filter, hideFiltersDetails),
QFileDialog::AnyFile,
args.options);
@@ -441,6 +452,8 @@ static bool qt_win_set_IFileDialogOptions(IFileDialog *pfd,
QString subfilter = *it;
if (!subfilter.isEmpty()) {
offsets<<currentOffset;
+ //Here the COMMON_ITEM_DIALOG API always add the details for the filter (e.g. *.txt)
+ //so we don't need to handle the flag HideNameFilterDetails.
winfilters += subfilter; // The name of the filter.
winfilters += QChar();
currentOffset += subfilter.size()+1;
@@ -638,9 +651,10 @@ QStringList qt_win_get_open_file_names(const QFileDialogArgs &args,
modal_widget.setParent(args.parent, Qt::Window);
QApplicationPrivate::enterModal(&modal_widget);
+ bool hideFiltersDetails = args.options & QFileDialog::HideNameFilterDetails;
OPENFILENAME* ofn = qt_win_make_OFN(args.parent, args.selection,
args.directory, args.caption,
- qt_win_filter(args.filter),
+ qt_win_filter(args.filter, hideFiltersDetails),
QFileDialog::ExistingFiles,
args.options);
if (idx)
diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp
index ebdac9a60..1c45a58eb 100644
--- a/src/gui/egl/qegl.cpp
+++ b/src/gui/egl/qegl.cpp
@@ -95,7 +95,7 @@ bool QEglContext::chooseConfig
do {
// Get the number of matching configurations for this set of properties.
EGLint matching = 0;
- if (!eglChooseConfig(dpy, props.properties(), 0, 256, &matching) || !matching)
+ if (!eglChooseConfig(dpy, props.properties(), 0, 0, &matching) || !matching)
continue;
// If we want the best pixel format, then return the first
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 6a21e99d2..8d9a1f80a 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -675,19 +675,22 @@ void QGraphicsItemPrivate::updateAncestorFlag(QGraphicsItem::GraphicsItemFlag ch
return;
}
- // Inherit the enabled-state from our parents.
- if ((parent && ((parent->d_ptr->ancestorFlags & flag)
- || (int(parent->d_ptr->flags & childFlag) == childFlag)
+ if (parent) {
+ // Inherit the enabled-state from our parents.
+ if ((parent->d_ptr->ancestorFlags & flag)
+ || (int(parent->d_ptr->flags & childFlag) == childFlag)
|| (childFlag == -1 && parent->d_ptr->handlesChildEvents)
- || (childFlag == -2 && parent->d_ptr->filtersDescendantEvents)))) {
- enabled = true;
- ancestorFlags |= flag;
- }
-
- // Top-level root items don't have any ancestors, so there are no
- // ancestor flags either.
- if (!parent)
+ || (childFlag == -2 && parent->d_ptr->filtersDescendantEvents)) {
+ enabled = true;
+ ancestorFlags |= flag;
+ } else {
+ ancestorFlags &= ~flag;
+ }
+ } else {
+ // Top-level root items don't have any ancestors, so there are no
+ // ancestor flags either.
ancestorFlags = 0;
+ }
} else {
// Don't set or propagate the ancestor flag if it's already correct.
if (((ancestorFlags & flag) && enabled) || (!(ancestorFlags & flag) && !enabled))
@@ -9834,20 +9837,25 @@ void QGraphicsItemGroup::addToGroup(QGraphicsItem *item)
}
// COMBINE
- // ### Use itemTransform() instead.
- QTransform oldSceneMatrix = item->sceneTransform();
+ bool ok;
+ QTransform itemTransform = item->itemTransform(this, &ok);
+
+ if (!ok) {
+ qWarning("QGraphicsItemGroup::addToGroup: could not find a valid transformation from item to group coordinates");
+ return;
+ }
+
+ QTransform newItemTransform(itemTransform);
item->setPos(mapFromItem(item, 0, 0));
item->setParentItem(this);
- QTransform newItemTransform(oldSceneMatrix);
- newItemTransform *= sceneTransform().inverted();
+
+ // removing position from translation component of the new transform
if (!item->pos().isNull())
newItemTransform *= QTransform::fromTranslate(-item->x(), -item->y());
+
item->setTransform(newItemTransform);
item->d_func()->setIsMemberOfGroup(true);
prepareGeometryChange();
- QTransform itemTransform(item->transform());
- if (!item->pos().isNull())
- itemTransform *= QTransform::fromTranslate(item->x(), item->y());
d->itemsBoundingRect |= itemTransform.mapRect(item->boundingRect() | item->childrenBoundingRect());
update();
}
diff --git a/src/gui/graphicsview/qgraphicstransform.cpp b/src/gui/graphicsview/qgraphicstransform.cpp
index 778cd9451..775a0d581 100644
--- a/src/gui/graphicsview/qgraphicstransform.cpp
+++ b/src/gui/graphicsview/qgraphicstransform.cpp
@@ -80,11 +80,7 @@
#include "qgraphicsitem_p.h"
#include "qgraphicstransform_p.h"
#include <QDebug>
-
-#include <math.h>
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
+#include <QtCore/qmath.h>
QT_BEGIN_NAMESPACE
@@ -355,7 +351,6 @@ public:
QGraphicsRotationPrivate()
: angle(0) {}
QPointF origin;
- qreal originY;
qreal angle;
};
@@ -475,13 +470,18 @@ void QGraphicsRotation::applyTo(QTransform *t) const
By default the axis is (0, 0, 1), giving QGraphicsRotation3D the same
default behavior as QGraphicsRotation (i.e., rotation around the Z axis).
+ Note: the final rotation is the combined effect of a rotation in
+ 3D space followed by a projection back to 2D. If several rotations
+ are performed in succession, they will not behave as expected unless
+ they were all around the Z axis.
+
\sa QGraphicsTransform, QGraphicsItem::setRotation(), QTransform::rotate()
*/
class QGraphicsRotation3DPrivate : public QGraphicsRotationPrivate
{
public:
- QGraphicsRotation3DPrivate() {}
+ QGraphicsRotation3DPrivate() : axis(0, 0, 1) {}
QVector3D axis;
};
@@ -522,10 +522,14 @@ QVector3D QGraphicsRotation3D::axis()
void QGraphicsRotation3D::setAxis(const QVector3D &axis)
{
Q_D(QGraphicsRotation3D);
+ if (d->axis == axis)
+ return;
d->axis = axis;
update();
+ emit axisChanged();
}
+const qreal deg2rad = qreal(0.017453292519943295769); // pi/180
static const qreal inv_dist_to_plane = 1. / 1024.;
/*!
@@ -535,13 +539,27 @@ void QGraphicsRotation3D::applyTo(QTransform *t) const
{
Q_D(const QGraphicsRotation3D);
- if (d->angle == 0. ||
+ qreal a = d->angle;
+
+ if (a == 0. ||
(d->axis.z() == 0. && d->axis.y() == 0 && d->axis.x() == 0))
return;
- qreal rad = d->angle * 2. * M_PI / 360.;
- qreal c = ::cos(rad);
- qreal s = ::sin(rad);
+ qreal c, s;
+ if (a == 90. || a == -270.) {
+ s = 1.;
+ c = 0.;
+ } else if (a == 270. || a == -90.) {
+ s = -1.;
+ c = 0.;
+ } else if (a == 180.) {
+ s = 0.;
+ c = -1.;
+ } else {
+ qreal b = deg2rad*a;
+ s = qSin(b);
+ c = qCos(b);
+ }
qreal x = d->axis.x();
qreal y = d->axis.y();
diff --git a/src/gui/graphicsview/qgraphicstransform_p.h b/src/gui/graphicsview/qgraphicstransform_p.h
index 2d36edae2..467021fef 100644
--- a/src/gui/graphicsview/qgraphicstransform_p.h
+++ b/src/gui/graphicsview/qgraphicstransform_p.h
@@ -55,6 +55,8 @@
#include "private/qobject_p.h"
+QT_BEGIN_NAMESPACE
+
class QGraphicsItem;
class QGraphicsTransformPrivate : public QObjectPrivate {
@@ -70,4 +72,6 @@ public:
static void updateItem(QGraphicsItem *item);
};
+QT_END_NAMESPACE
+
#endif // QGRAPHICSTRANSFORM_P_H
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp
index ca55f2e96..92f8816a8 100644
--- a/src/gui/graphicsview/qgraphicsview.cpp
+++ b/src/gui/graphicsview/qgraphicsview.cpp
@@ -2209,8 +2209,7 @@ QPolygonF QGraphicsView::mapToScene(const QRect &rect) const
QPointF br = scrollOffset + r.bottomRight();
QPointF bl = scrollOffset + r.bottomLeft();
- QPolygonF poly;
- poly.resize(4);
+ QPolygonF poly(4);
if (!d->identityMatrix) {
QTransform x = d->matrix.inverted();
poly[0] = x.map(tl);
@@ -2313,8 +2312,7 @@ QPolygon QGraphicsView::mapFromScene(const QRectF &rect) const
br -= scrollOffset;
bl -= scrollOffset;
- QPolygon poly;
- poly.resize(4);
+ QPolygon poly(4);
poly[0] = tl.toPoint();
poly[1] = tr.toPoint();
poly[2] = br.toPoint();
@@ -3647,8 +3645,7 @@ QRectF QGraphicsViewPrivate::mapToScene(const QRectF &rect) const
QPointF br = scrollOffset + rect.bottomRight();
QPointF bl = scrollOffset + rect.bottomLeft();
- QPolygonF poly;
- poly.resize(4);
+ QPolygonF poly(4);
if (!identityMatrix) {
QTransform x = matrix.inverted();
poly[0] = x.map(tl);
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index b77bfdc31..a49d680e7 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -46,4 +46,3 @@ contains(DEFINES,QT_EVAL):include($$QT_SOURCE_TREE/src/corelib/eval.pri)
QMAKE_DYNAMIC_LIST_FILE = $$PWD/QtGui.dynlist
DEFINES += Q_INTERNAL_QAPP_SRC
-
diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri
index b9c36dc01..baf212522 100644
--- a/src/gui/image/image.pri
+++ b/src/gui/image/image.pri
@@ -6,6 +6,8 @@
HEADERS += \
image/qbitmap.h \
image/qicon.h \
+ image/qicon_p.h \
+ image/qiconloader_p.h \
image/qiconengine.h \
image/qiconengineplugin.h \
image/qimage.h \
@@ -32,6 +34,7 @@ HEADERS += \
SOURCES += \
image/qbitmap.cpp \
image/qicon.cpp \
+ image/qiconloader.cpp \
image/qimage.cpp \
image/qimageiohandler.cpp \
image/qimagereader.cpp \
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index fa407c78a..b7759e46d 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -40,9 +40,11 @@
****************************************************************************/
#include "qicon.h"
+#include "qicon_p.h"
#include "qiconengine.h"
#include "qiconengineplugin.h"
#include "private/qfactoryloader_p.h"
+#include "private/qiconloader_p.h"
#include "qapplication.h"
#include "qstyleoption.h"
#include "qpainter.h"
@@ -50,6 +52,7 @@
#include "qstyle.h"
#include "qpixmapcache.h"
#include "qvariant.h"
+#include "qcache.h"
#include "qdebug.h"
#ifdef Q_WS_MAC
@@ -57,6 +60,11 @@
#include <private/qt_cocoa_helpers_mac_p.h>
#endif
+#ifdef Q_WS_X11
+#include "private/qt_x11_p.h"
+#include "private/qkde_p.h"
+#endif
+
QT_BEGIN_NAMESPACE
/*!
@@ -94,73 +102,14 @@ QT_BEGIN_NAMESPACE
static QBasicAtomicInt serialNumCounter = Q_BASIC_ATOMIC_INITIALIZER(1);
-class QIconPrivate
-{
-public:
- QIconPrivate(): engine(0), ref(1), serialNum(serialNumCounter.fetchAndAddRelaxed(1)), detach_no(0), engine_version(2), v1RefCount(0) {}
-
- ~QIconPrivate() {
- if (engine_version == 1) {
- if (!v1RefCount->deref()) {
- delete engine;
- delete v1RefCount;
- }
- } else if (engine_version == 2) {
- delete engine;
- }
- }
-
- QIconEngine *engine;
-
- QAtomicInt ref;
- int serialNum;
- int detach_no;
- int engine_version;
-
- QAtomicInt *v1RefCount;
-};
-
-
-struct QPixmapIconEngineEntry
+QIconPrivate::QIconPrivate()
+ : engine(0), ref(1),
+ serialNum(serialNumCounter.fetchAndAddRelaxed(1)),
+ detach_no(0),
+ engine_version(2),
+ v1RefCount(0)
{
- QPixmapIconEngineEntry():mode(QIcon::Normal), state(QIcon::Off){}
- QPixmapIconEngineEntry(const QPixmap &pm, QIcon::Mode m = QIcon::Normal, QIcon::State s = QIcon::Off)
- :pixmap(pm), size(pm.size()), mode(m), state(s){}
- QPixmapIconEngineEntry(const QString &file, const QSize &sz = QSize(), QIcon::Mode m = QIcon::Normal, QIcon::State s = QIcon::Off)
- :fileName(file), size(sz), mode(m), state(s){}
- QPixmap pixmap;
- QString fileName;
- QSize size;
- QIcon::Mode mode;
- QIcon::State state;
- bool isNull() const {return (fileName.isEmpty() && pixmap.isNull()); }
-};
-
-class QPixmapIconEngine : public QIconEngineV2 {
-public:
- QPixmapIconEngine();
- QPixmapIconEngine(const QPixmapIconEngine &);
- ~QPixmapIconEngine();
- void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state);
- QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state);
- QPixmapIconEngineEntry *bestMatch(const QSize &size, QIcon::Mode mode, QIcon::State state, bool sizeOnly);
- QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state);
- void addPixmap(const QPixmap &pixmap, QIcon::Mode mode, QIcon::State state);
- void addFile(const QString &fileName, const QSize &size, QIcon::Mode mode, QIcon::State state);
-
- // v2 functions
- QString key() const;
- QIconEngineV2 *clone() const;
- bool read(QDataStream &in);
- bool write(QDataStream &out) const;
- void virtual_hook(int id, void *data);
-
-private:
- QPixmapIconEngineEntry *tryMatch(const QSize &size, QIcon::Mode mode, QIcon::State state);
- QVector<QPixmapIconEngineEntry> pixmaps;
-
- friend QDataStream &operator<<(QDataStream &s, const QIcon &icon);
-};
+}
QPixmapIconEngine::QPixmapIconEngine()
{
@@ -918,6 +867,146 @@ QList<QSize> QIcon::availableSizes(Mode mode, State state) const
return engine->availableSizes(mode, state);
}
+/*!
+ \since 4.6
+
+ Sets the search paths for icon themes to \a paths.
+ \sa themeSearchPaths(), fromTheme()
+*/
+void QIcon::setThemeSearchPaths(const QStringList &paths)
+{
+ QIconLoader::instance()->setThemeSearchPath(paths);
+}
+
+/*!
+ \since 4.6
+
+ Returns the search paths for icon themes.
+
+ The default value will depend on the platform:
+
+ On X11, the search path will use the XDG_DATA_DIRS environment
+ variable if available.
+
+ On Windows the search path defaults to [Application Directory]/icons
+
+ On Mac the default search path will search in the
+ [Contents/Resources/icons] part of the application bundle.
+
+ \sa setThemeSearchPaths(), fromTheme()
+*/
+QStringList QIcon::themeSearchPaths()
+{
+ return QIconLoader::instance()->themeSearchPaths();
+}
+
+/*!
+ \since 4.6
+
+ Sets the current icon theme.
+
+ The name should correspond to a directory name in the
+ current \ themeSearchPath() containing an index.theme
+ file describing it's contents..
+
+*/
+void QIcon::setThemeName(const QString &path)
+{
+ QIconLoader::instance()->setThemeName(path);
+}
+
+/*!
+ \since 4.6
+
+ Returns the name of the current icon theme.
+
+ On X11, the current icon theme depends on your desktop
+ settings. On other platforms it is not set by default.
+
+ \sa themeSearchPaths(), fromTheme(), hasThemeIcon()
+*/
+QString QIcon::themeName()
+{
+ return QIconLoader::instance()->themeName();
+}
+
+/*!
+ \since 4.6
+
+ Returns the QIcon corresponding to \a name in the current
+ icon theme. If no such icon is found in the current theme
+ \a fallback is return instead.
+
+ To use an icon theme on Windows or Mac, you will need to
+ bundle a compliant theme with your application and make sure
+ it is located in your themeSarchPaths.
+
+ The lastest version of the freedesktop icon specification and naming
+ spesification can be obtained here:
+ http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
+ http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
+
+ To fetch an icon from the current icon theme:
+
+ \snippet doc/src/snippets/code/src_gui_image_qicon.cpp 3
+
+ Or if you want to provide a guaranteed fallback for platforms that
+ do not support theme icons, you can use the second argument:
+
+ \snippet doc/src/snippets/code/src_gui_image_qicon.cpp 4
+
+ \note By default, only X11 will support themed icons. In order to
+ use themed icons on Mac and Windows, you will have to bundle a
+ compliant theme in one of your themeSearchPaths() and set the
+ appropriate themeName().
+
+ \sa themeName(), themeSearchPaths()
+*/
+QIcon QIcon::fromTheme(const QString &name, const QIcon &fallback)
+{
+
+ static QCache <QString, QIcon> iconCache;
+
+ QIcon icon;
+
+#ifdef Q_WS_X11
+ if (X11->desktopEnvironment == DE_KDE) {
+ icon = QKde::kdeIcon(name);
+ if (!icon.isNull())
+ return icon;
+ }
+#endif
+
+ if (iconCache.contains(name)) {
+ icon = *iconCache.object(name);
+ } else {
+ QIcon *cachedIcon = new QIcon(new QIconLoaderEngine(name));
+ iconCache.insert(name, cachedIcon);
+ icon = *cachedIcon;
+ }
+
+ if (icon.availableSizes().isEmpty())
+ return fallback;
+
+ return icon;
+}
+
+/*!
+ \since 4.6
+
+ Returns true if there is an icon available for a \a name in the current
+ icon theme, otherwise returns false.
+
+ \sa themeSearchPaths(), fromTheme()
+*/
+bool QIcon::hasThemeIcon(const QString &name)
+{
+ QIcon icon = fromTheme(name);
+
+ return !icon.isNull();
+}
+
+
/*****************************************************************************
QIcon stream functions
*****************************************************************************/
@@ -989,6 +1078,11 @@ QDataStream &operator>>(QDataStream &s, QIcon &icon)
QIconEngineV2 *engine = new QPixmapIconEngine;
icon.d->engine = engine;
engine->read(s);
+ } else if (key == QLatin1String("QIconLoaderEngine")) {
+ icon.d = new QIconPrivate;
+ QIconEngineV2 *engine = new QIconLoaderEngine();
+ icon.d->engine = engine;
+ engine->read(s);
#if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
} else if (QIconEngineFactoryInterfaceV2 *factory = qobject_cast<QIconEngineFactoryInterfaceV2*>(loaderV2()->instance(key))) {
if (QIconEngineV2 *engine= factory->create()) {
diff --git a/src/gui/image/qicon.h b/src/gui/image/qicon.h
index c318e14ff..2a717179b 100644
--- a/src/gui/image/qicon.h
+++ b/src/gui/image/qicon.h
@@ -97,6 +97,16 @@ public:
QList<QSize> availableSizes(Mode mode = Normal, State state = Off) const;
+ static QIcon fromTheme(const QString &name, const QIcon &fallback = QIcon());
+ static bool hasThemeIcon(const QString &name);
+
+ static QStringList themeSearchPaths();
+ static void setThemeSearchPaths(const QStringList &searchpath);
+
+ static QString themeName();
+ static void setThemeName(const QString &path);
+
+
#ifdef QT3_SUPPORT
enum Size { Small, Large, Automatic = Small };
static QT3_SUPPORT void setPixmapSize(Size which, const QSize &size);
diff --git a/src/gui/image/qicon_p.h b/src/gui/image/qicon_p.h
new file mode 100644
index 000000000..ccac4c30f
--- /dev/null
+++ b/src/gui/image/qicon_p.h
@@ -0,0 +1,138 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QICON_P_H
+#define QICON_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qglobal.h>
+#include <QtCore/qsize.h>
+#include <QtCore/qlist.h>
+#include <QtGui/qpixmap.h>
+#include <QtGui/qicon.h>
+#include <QtGui/qiconengine.h>
+
+QT_BEGIN_NAMESPACE
+
+class QIconPrivate
+{
+public:
+ QIconPrivate();
+
+ ~QIconPrivate() {
+ if (engine_version == 1) {
+ if (!v1RefCount->deref()) {
+ delete engine;
+ delete v1RefCount;
+ }
+ } else if (engine_version == 2) {
+ delete engine;
+ }
+ }
+
+ QIconEngine *engine;
+
+ QAtomicInt ref;
+ int serialNum;
+ int detach_no;
+ int engine_version;
+
+ QAtomicInt *v1RefCount;
+};
+
+
+struct QPixmapIconEngineEntry
+{
+ QPixmapIconEngineEntry():mode(QIcon::Normal), state(QIcon::Off){}
+ QPixmapIconEngineEntry(const QPixmap &pm, QIcon::Mode m = QIcon::Normal, QIcon::State s = QIcon::Off)
+ :pixmap(pm), size(pm.size()), mode(m), state(s){}
+ QPixmapIconEngineEntry(const QString &file, const QSize &sz = QSize(), QIcon::Mode m = QIcon::Normal, QIcon::State s = QIcon::Off)
+ :fileName(file), size(sz), mode(m), state(s){}
+ QPixmap pixmap;
+ QString fileName;
+ QSize size;
+ QIcon::Mode mode;
+ QIcon::State state;
+ bool isNull() const {return (fileName.isEmpty() && pixmap.isNull()); }
+};
+
+
+
+class QPixmapIconEngine : public QIconEngineV2 {
+public:
+ QPixmapIconEngine();
+ QPixmapIconEngine(const QPixmapIconEngine &);
+ ~QPixmapIconEngine();
+ void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state);
+ QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state);
+ QPixmapIconEngineEntry *bestMatch(const QSize &size, QIcon::Mode mode, QIcon::State state, bool sizeOnly);
+ QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state);
+ void addPixmap(const QPixmap &pixmap, QIcon::Mode mode, QIcon::State state);
+ void addFile(const QString &fileName, const QSize &size, QIcon::Mode mode, QIcon::State state);
+
+ // v2 functions
+ QString key() const;
+ QIconEngineV2 *clone() const;
+ bool read(QDataStream &in);
+ bool write(QDataStream &out) const;
+ void virtual_hook(int id, void *data);
+
+private:
+ QPixmapIconEngineEntry *tryMatch(const QSize &size, QIcon::Mode mode, QIcon::State state);
+ QVector<QPixmapIconEngineEntry> pixmaps;
+
+ friend QDataStream &operator<<(QDataStream &s, const QIcon &icon);
+ friend class QIconThemeEngine;
+};
+
+QT_END_NAMESPACE
+
+#endif // QICON_P_H
diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp
new file mode 100644
index 000000000..6bf8d3b35
--- /dev/null
+++ b/src/gui/image/qiconloader.cpp
@@ -0,0 +1,599 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <private/qiconloader_p.h>
+
+#include <private/qapplication_p.h>
+#include <private/qicon_p.h>
+#include <private/qkde_p.h>
+
+#include <QtGui/QIconEnginePlugin>
+#include <QtGui/QPixmapCache>
+#include <QtGui/QIconEngine>
+#include <QtGui/QStyleOption>
+#include <QtCore/QList>
+#include <QtCore/QHash>
+#include <QtCore/QDir>
+#include <QtCore/QSettings>
+
+#ifdef Q_WS_MAC
+#include <private/qt_cocoa_helpers_mac_p.h>
+#endif
+
+#ifdef Q_WS_X11
+#include <private/qt_x11_p.h>
+#include <private/gtksymbols_p.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+Q_GLOBAL_STATIC(QIconLoader, iconLoaderInstance)
+
+static QString systemThemeName()
+{
+ QString result;
+#ifdef Q_WS_X11
+ if (X11->desktopEnvironment == DE_GNOME) {
+ result = QGtk::getGConfString(QLatin1String("/desktop/gnome/interface/icon_theme"),
+ QLatin1String("gnome"));
+ } else if (X11->desktopEnvironment == DE_KDE) {
+ QString kdeDefault = X11->desktopVersion >= 4 ?
+ QString::fromLatin1("oxygen") :
+ QString::fromLatin1("crystalsvg");
+
+ QSettings settings(QKde::kdeHome() +
+ QLatin1String("/share/config/kdeglobals"),
+ QSettings::IniFormat);
+
+ settings.beginGroup(QLatin1String("Icons"));
+
+ result = settings.value(QLatin1String("Theme"), kdeDefault).toString();
+ }
+#endif
+ return result;
+}
+
+static QString fallbackTheme()
+{
+ QString defaultTheme = systemThemeName();
+ if (defaultTheme.isEmpty())
+ defaultTheme = QLatin1String("hicolor");
+ return defaultTheme;
+}
+
+QIconLoader::QIconLoader() :
+ m_themeKey(1), m_supportsSvg(false)
+{
+ m_systemTheme = systemThemeName();
+
+ QFactoryLoader iconFactoryLoader(QIconEngineFactoryInterfaceV2_iid,
+ QLatin1String("/iconengines"),
+ Qt::CaseInsensitive);
+ if (iconFactoryLoader.keys().contains(QLatin1String("svg")))
+ m_supportsSvg = true;
+}
+
+QIconLoader *QIconLoader::instance()
+{
+ return iconLoaderInstance();
+}
+
+// Queries the system theme and invalidates existing
+// icons if the theme has changed.
+void QIconLoader::updateSystemTheme()
+{
+ // Only change if this is not explicitly set by the user
+ if (m_userTheme.isEmpty()) {
+ QString theme = systemThemeName();
+ if (theme != m_systemTheme) {
+ m_systemTheme = theme;
+ invalidateKey();
+ }
+ }
+}
+
+void QIconLoader::setThemeName(const QString &themeName)
+{
+ m_userTheme = themeName;
+ invalidateKey();
+}
+
+void QIconLoader::setThemeSearchPath(const QStringList &searchPaths)
+{
+ m_iconDirs = searchPaths;
+ themeList.clear();
+ invalidateKey();
+}
+
+QStringList QIconLoader::themeSearchPaths() const
+{
+ if (m_iconDirs.isEmpty()) {
+
+#if defined(Q_WS_X11)
+
+ QString xdgDirString = QFile::decodeName(getenv("XDG_DATA_DIRS"));
+ if (xdgDirString.isEmpty())
+ xdgDirString = QLatin1String("/usr/local/share/:/usr/share/");
+
+ QStringList xdgDirs = xdgDirString.split(QLatin1Char(':'));
+
+ for (int i = 0 ; i < xdgDirs.size() ; ++i) {
+ QDir dir(xdgDirs[i]);
+ if (dir.exists())
+ m_iconDirs.append(dir.path() +
+ QLatin1String("/icons"));
+ }
+
+ if (X11->desktopEnvironment == DE_KDE) {
+
+ m_iconDirs << QLatin1Char(':') +
+ QKde::kdeHome() +
+ QLatin1String("/share/icons");
+ QStringList kdeDirs =
+ QFile::decodeName(getenv("KDEDIRS")).split(QLatin1Char(':'));
+
+ for (int i = 0 ; i< kdeDirs.count() ; ++i) {
+ QDir dir(QLatin1Char(':') + kdeDirs.at(i) +
+ QLatin1String("/share/icons"));
+ if (dir.exists())
+ m_iconDirs.append(dir.path());
+ }
+ }
+
+ // Add home directory first in search path
+ QDir homeDir(QDir::homePath() + QLatin1String("/.icons"));
+ if (homeDir.exists())
+ m_iconDirs.prepend(homeDir.path());
+
+#elif defined(Q_WS_WIN)
+ m_iconDirs.append(qApp->applicationDirPath() +
+ QLatin1String("/icons"));
+#elif defined(Q_WS_MAC)
+ m_iconDirs.append(qApp->applicationDirPath() +
+ QLatin1String("/../Resources/icons"));
+#endif
+ }
+ return m_iconDirs;
+}
+
+QIconTheme::QIconTheme(const QString &themeName)
+ : m_valid(false)
+{
+ QFile themeIndex;
+
+ QList <QIconDirInfo> keyList;
+ QStringList iconDirs = QIcon::themeSearchPaths();
+ for ( int i = 0 ; i < iconDirs.size() ; ++i) {
+ QDir iconDir(iconDirs[i]);
+ QString themeDir = iconDir.path() + QLatin1Char('/') + themeName;
+ themeIndex.setFileName(themeDir + QLatin1String("/index.theme"));
+ if (themeIndex.exists()) {
+ m_contentDir = themeDir;
+ m_valid = true;
+ break;
+ }
+ }
+
+ if (themeIndex.exists()) {
+ const QSettings indexReader(themeIndex.fileName(), QSettings::IniFormat);
+ QStringListIterator keyIterator(indexReader.allKeys());
+ while (keyIterator.hasNext()) {
+
+ const QString key = keyIterator.next();
+ if (key.endsWith(QLatin1String("/Size"))) {
+ // Note the QSettings ini-format does not accept
+ // slashes in key names, hence we have to cheat
+ if (int size = indexReader.value(key).toInt()) {
+ QString directoryKey = key.left(key.size() - 5);
+ QIconDirInfo dirInfo(directoryKey);
+ dirInfo.size = size;
+ QString type = indexReader.value(directoryKey +
+ QLatin1String("/Type")
+ ).toString();
+
+ if (type == QLatin1String("Fixed"))
+ dirInfo.type = QIconDirInfo::Fixed;
+ else if (type == QLatin1String("Scalable"))
+ dirInfo.type = QIconDirInfo::Scalable;
+ else
+ dirInfo.type = QIconDirInfo::Threshold;
+
+ dirInfo.threshold = indexReader.value(directoryKey +
+ QLatin1String("/Threshold"),
+ 2).toInt();
+
+ dirInfo.minSize = indexReader.value(directoryKey +
+ QLatin1String("/MinSize"),
+ size).toInt();
+
+ dirInfo.maxSize = indexReader.value(directoryKey +
+ QLatin1String("/MaxSize"),
+ size).toInt();
+ m_keyList.append(dirInfo);
+ }
+ }
+ }
+
+ // Parent themes provide fallbacks for missing icons
+ m_parents = indexReader.value(
+ QLatin1String("Icon Theme/Inherits")).toStringList();
+
+ // Ensure a default platform fallback for all themes
+ if (m_parents.isEmpty())
+ m_parents.append(fallbackTheme());
+
+ // Ensure that all themes fall back to hicolor
+ if (!m_parents.isEmpty())
+ m_parents.append(QLatin1String("hicolor"));
+ }
+}
+
+QThemeIconEntries QIconLoader::findIconHelper(const QString &themeName,
+ const QString &iconName,
+ QStringList &visited) const
+{
+ QThemeIconEntries entries;
+ Q_ASSERT(!themeName.isEmpty());
+
+ QPixmap pixmap;
+
+ // Used to protect against potential recursions
+ visited << themeName;
+
+ QIconTheme theme = themeList.value(themeName);
+ if (!theme.isValid()) {
+ theme = QIconTheme(themeName);
+ if (!theme.isValid())
+ theme = fallbackTheme();
+
+ themeList.insert(themeName, theme);
+ }
+
+ QString contentDir = theme.contentDir() + QLatin1Char('/');
+ QList<QIconDirInfo> subDirs = theme.keyList();
+
+ const QString svgext(QLatin1String(".svg"));
+ const QString pngext(QLatin1String(".png"));
+
+ // Add all relevant files
+ for (int i = 0; i < subDirs.size() ; ++i) {
+ const QIconDirInfo &dirInfo = subDirs.at(i);
+ QString subdir = dirInfo.path;
+ QDir currentDir(contentDir + subdir);
+
+ if (dirInfo.type == QIconDirInfo::Scalable && m_supportsSvg &&
+ currentDir.exists(iconName + svgext)) {
+ ScalableEntry *iconEntry = new ScalableEntry;
+ iconEntry->dir = dirInfo;
+ iconEntry->filename = currentDir.filePath(iconName + svgext);
+ entries.append(iconEntry);
+
+ } else if (currentDir.exists(iconName + pngext)) {
+ PixmapEntry *iconEntry = new PixmapEntry;
+ iconEntry->dir = dirInfo;
+ iconEntry->filename = currentDir.filePath(iconName + pngext);
+ // Notice we ensure that pixmap entries allways come before
+ // scalable to preserve search order afterwards
+ entries.prepend(iconEntry);
+ }
+ }
+
+ if (entries.isEmpty()) {
+ const QStringList parents = theme.parents();
+ // Search recursively through inherited themes
+ for (int i = 0 ; i < parents.size() ; ++i) {
+
+ const QString parentTheme = parents.at(i).trimmed();
+
+ if (!visited.contains(parentTheme)) // guard against recursion
+ entries = findIconHelper(parentTheme, iconName, visited);
+
+ if (!entries.isEmpty()) // success
+ break;
+ }
+ }
+ return entries;
+}
+
+QThemeIconEntries QIconLoader::loadIcon(const QString &name) const
+{
+ if (!themeName().isEmpty()) {
+ QStringList visited;
+ return findIconHelper(themeName(), name, visited);
+ }
+
+ return QThemeIconEntries();
+}
+
+
+// -------- Icon Loader Engine -------- //
+
+
+QIconLoaderEngine::QIconLoaderEngine(const QString& iconName)
+ : m_iconName(iconName), m_key(0)
+{
+}
+
+QIconLoaderEngine::~QIconLoaderEngine()
+{
+ while (!m_entries.isEmpty())
+ delete m_entries.takeLast();
+ Q_ASSERT(m_entries.size() == 0);
+}
+
+QIconLoaderEngine::QIconLoaderEngine(const QIconLoaderEngine &other)
+ : QIconEngineV2(other),
+ m_iconName(other.m_iconName),
+ m_key(0)
+{
+}
+
+QIconEngineV2 *QIconLoaderEngine::clone() const
+{
+ return new QIconLoaderEngine(*this);
+}
+
+bool QIconLoaderEngine::read(QDataStream &in) {
+ in >> m_iconName;
+ return true;
+}
+
+bool QIconLoaderEngine::write(QDataStream &out) const
+{
+ out << m_iconName;
+ return true;
+}
+
+bool QIconLoaderEngine::hasIcon() const
+{
+ return !(m_entries.isEmpty());
+}
+
+// Lazily load the icon
+void QIconLoaderEngine::ensureLoaded()
+{
+ if (!(iconLoaderInstance()->themeKey() == m_key)) {
+
+ while (!m_entries.isEmpty())
+ delete m_entries.takeLast();
+
+ Q_ASSERT(m_entries.size() == 0);
+ m_entries = iconLoaderInstance()->loadIcon(m_iconName);
+ m_key = iconLoaderInstance()->themeKey();
+ }
+}
+
+void QIconLoaderEngine::paint(QPainter *painter, const QRect &rect,
+ QIcon::Mode mode, QIcon::State state)
+{
+ QSize pixmapSize = rect.size();
+#if defined(Q_WS_MAC)
+ pixmapSize *= qt_mac_get_scalefactor();
+#endif
+ painter->drawPixmap(rect, pixmap(pixmapSize, mode, state));
+}
+
+/*
+ * This algorithm is defined by the freedesktop spec:
+ * http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
+ */
+static bool directoryMatchesSize(const QIconDirInfo &dir, int iconsize)
+{
+ if (dir.type == QIconDirInfo::Fixed) {
+ return dir.size == iconsize;
+
+ } else if (dir.type == QIconDirInfo::Scalable) {
+ return dir.size <= dir.maxSize &&
+ iconsize >= dir.minSize;
+
+ } else if (dir.type == QIconDirInfo::Threshold) {
+ return iconsize >= dir.size - dir.threshold &&
+ iconsize <= dir.size + dir.threshold;
+ }
+
+ Q_ASSERT(1); // Not a valid value
+ return false;
+}
+
+/*
+ * This algorithm is defined by the freedesktop spec:
+ * http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
+ */
+static int directorySizeDistance(const QIconDirInfo &dir, int iconsize)
+{
+ if (dir.type == QIconDirInfo::Fixed) {
+ return qAbs(dir.size - iconsize);
+
+ } else if (dir.type == QIconDirInfo::Scalable) {
+ if (iconsize < dir.minSize)
+ return dir.minSize - iconsize;
+ else if (iconsize > dir.maxSize)
+ return iconsize - dir.maxSize;
+ else
+ return 0;
+
+ } else if (dir.type == QIconDirInfo::Threshold) {
+ if (iconsize < dir.size - dir.threshold)
+ return dir.minSize - iconsize;
+ else if (iconsize > dir.size + dir.threshold)
+ return iconsize - dir.maxSize;
+ else return 0;
+ }
+
+ Q_ASSERT(1); // Not a valid value
+ return INT_MAX;
+}
+
+QIconLoaderEngineEntry *QIconLoaderEngine::entryForSize(const QSize &size)
+{
+ int iconsize = qMin(size.width(), size.height());
+
+ // Note that m_entries are sorted so that png-files
+ // come first
+
+ // Search for exact matches first
+ for (int i = 0; i < m_entries.count(); ++i) {
+ QIconLoaderEngineEntry *entry = m_entries.at(i);
+ if (directoryMatchesSize(entry->dir, iconsize)) {
+ return entry;
+ }
+ }
+
+ // Find the minimum distance icon
+ int minimalSize = INT_MAX;
+ QIconLoaderEngineEntry *closestMatch = 0;
+ for (int i = 0; i < m_entries.count(); ++i) {
+ QIconLoaderEngineEntry *entry = m_entries.at(i);
+ int distance = directorySizeDistance(entry->dir, iconsize);
+ if (distance < minimalSize) {
+ minimalSize = distance;
+ closestMatch = entry;
+ }
+ }
+ return closestMatch;
+}
+
+/*
+ * Returns the actual icon size. For scalable svg's this is equivalent
+ * to the requested size. Otherwise the closest match is returned.
+ *
+ * todo: the spec is a bit fuzzy in this area, but we should probably
+ * allow scaling down pixmap icons as well.
+ *
+ */
+QSize QIconLoaderEngine::actualSize(const QSize &size, QIcon::Mode mode,
+ QIcon::State state)
+{
+ ensureLoaded();
+
+ QIconLoaderEngineEntry *entry = entryForSize(size);
+ if (entry) {
+ const QIconDirInfo &dir = entry->dir;
+ if (dir.type == QIconDirInfo::Scalable)
+ return size;
+ else
+ return QSize(dir.size, dir.size);
+ }
+ return QIconEngineV2::actualSize(size, mode, state);
+}
+
+QPixmap PixmapEntry::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state)
+{
+ Q_UNUSED(state);
+
+ // Ensure that basePixmap is lazily initialized before generating the
+ // key, otherwise the cache key is not unique
+ if (basePixmap.isNull())
+ basePixmap.load(filename);
+
+ int actualSize = qMin(size.width(), size.height());
+ QString key = QLatin1String("$qt_theme_")
+ + QString::number(basePixmap.cacheKey(), 16)
+ + QLatin1Char('_')
+ + QString::number(mode)
+ + QLatin1Char('_')
+ + QString::number(qApp->palette().cacheKey(), 16)
+ + QLatin1Char('_')
+ + QString::number(actualSize);
+
+ QPixmap cachedPixmap;
+ if (QPixmapCache::find(key, &cachedPixmap)) {
+ return cachedPixmap;
+ } else {
+ QStyleOption opt(0);
+ opt.palette = qApp->palette();
+ cachedPixmap = qApp->style()->generatedIconPixmap(mode, basePixmap, &opt);
+ QPixmapCache::insert(key, cachedPixmap);
+ }
+ return cachedPixmap;
+}
+
+QPixmap ScalableEntry::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state)
+{
+ if (svgIcon.isNull())
+ svgIcon = QIcon(filename);
+
+ // Simply reuse svg icon engine
+ return svgIcon.pixmap(size, mode, state);
+}
+
+QPixmap QIconLoaderEngine::pixmap(const QSize &size, QIcon::Mode mode,
+ QIcon::State state)
+{
+ ensureLoaded();
+
+ QIconLoaderEngineEntry *entry = entryForSize(size);
+ if (entry)
+ return entry->pixmap(size, mode, state);
+
+ return QPixmap();
+}
+
+QString QIconLoaderEngine::key() const
+{
+ return QLatin1String("QIconLoaderEngine");
+}
+
+void QIconLoaderEngine::virtual_hook(int id, void *data)
+{
+ ensureLoaded();
+
+ switch (id) {
+ case QIconEngineV2::AvailableSizesHook:
+ {
+ QIconEngineV2::AvailableSizesArgument &arg
+ = *reinterpret_cast<QIconEngineV2::AvailableSizesArgument*>(data);
+ const QList<QIconDirInfo> directoryKey = iconLoaderInstance()->theme().keyList();
+ arg.sizes.clear();
+
+ // Gets all sizes from the DirectoryInfo entries
+ for (int i = 0 ; i < m_entries.size() ; ++i) {
+ int size = m_entries.at(i)->dir.size;
+ arg.sizes.append(QSize(size, size));
+ }
+ }
+ break;
+ default:
+ QIconEngineV2::virtual_hook(id, data);
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/image/qiconloader_p.h b/src/gui/image/qiconloader_p.h
new file mode 100644
index 000000000..707107c6f
--- /dev/null
+++ b/src/gui/image/qiconloader_p.h
@@ -0,0 +1,185 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QDESKTOPICON_P_H
+#define QDESKTOPICON_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/QIcon>
+#include <QtGui/QIconEngine>
+#include <QtGui/QPixmapCache>
+#include <private/qicon_p.h>
+#include <private/qfactoryloader_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QIconLoader;
+
+struct QIconDirInfo
+{
+ enum Type { Fixed, Scalable, Threshold };
+ QIconDirInfo(const QString &_path = QString()) :
+ path(_path),
+ size(0),
+ maxSize(0),
+ minSize(0),
+ threshold(0),
+ type(Threshold) {}
+ QString path;
+ short size;
+ short maxSize;
+ short minSize;
+ short threshold;
+ Type type : 4;
+};
+
+class QIconLoaderEngineEntry
+ {
+public:
+ virtual QPixmap pixmap(const QSize &size,
+ QIcon::Mode mode,
+ QIcon::State state) = 0;
+ QString filename;
+ QIconDirInfo dir;
+ static int count;
+};
+
+struct ScalableEntry : public QIconLoaderEngineEntry
+{
+ QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state);
+ QIcon svgIcon;
+};
+
+struct PixmapEntry : public QIconLoaderEngineEntry
+{
+ QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state);
+ QPixmap basePixmap;
+};
+
+typedef QList<QIconLoaderEngineEntry*> QThemeIconEntries;
+
+class QIconLoaderEngine : public QIconEngineV2
+{
+public:
+ QIconLoaderEngine(const QString& iconName = QString());
+ ~QIconLoaderEngine();
+
+ void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state);
+ QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state);
+ QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state);
+ QIconEngineV2 *clone() const;
+ bool read(QDataStream &in);
+ bool write(QDataStream &out) const;
+
+private:
+ QString key() const;
+ bool hasIcon() const;
+ void ensureLoaded();
+ void virtual_hook(int id, void *data);
+ QIconLoaderEngineEntry *entryForSize(const QSize &size);
+ QIconLoaderEngine(const QIconLoaderEngine &other);
+ QThemeIconEntries m_entries;
+ QString m_iconName;
+ uint m_key;
+
+ friend class QIconLoader;
+};
+
+class QIconTheme
+{
+public:
+ QIconTheme(const QString &name);
+ QIconTheme() : m_valid(false) {};
+ QStringList parents() { return m_parents; }
+ QList <QIconDirInfo> keyList() { return m_keyList; }
+ QString contentDir() { return m_contentDir; }
+ bool isValid() { return m_valid; }
+
+private:
+ QString m_contentDir;
+ QList <QIconDirInfo> m_keyList;
+ QStringList m_parents;
+ bool m_valid;
+};
+
+class QIconLoader : public QObject
+{
+public:
+ QIconLoader();
+ QThemeIconEntries loadIcon(const QString &iconName) const;
+ uint themeKey() const { return m_themeKey; }
+
+ QString themeName() const { return m_userTheme.isEmpty() ? m_systemTheme : m_userTheme; }
+ void setThemeName(const QString &themeName);
+ QIconTheme theme() { return themeList.value(themeName()); }
+ void setThemeSearchPath(const QStringList &searchPaths);
+ QStringList themeSearchPaths() const;
+ QIconDirInfo dirInfo(int dirindex);
+ static QIconLoader *instance();
+ void updateSystemTheme();
+ void invalidateKey() { m_themeKey++; }
+
+private:
+ QThemeIconEntries findIconHelper(const QString &themeName,
+ const QString &iconName,
+ QStringList &visited) const;
+ uint m_themeKey;
+ bool m_supportsSvg;
+
+ mutable QString m_userTheme;
+ mutable QString m_systemTheme;
+ mutable QStringList m_iconDirs;
+ mutable QHash <QString, QIconTheme> themeList;
+};
+
+QT_END_NAMESPACE
+
+#endif // QDESKTOPICON_P_H
diff --git a/src/gui/image/qimagepixmapcleanuphooks.cpp b/src/gui/image/qimagepixmapcleanuphooks.cpp
index 7d1c5fbe2..789700a0c 100644
--- a/src/gui/image/qimagepixmapcleanuphooks.cpp
+++ b/src/gui/image/qimagepixmapcleanuphooks.cpp
@@ -43,6 +43,8 @@
#include "qpixmapdata_p.h"
+QT_BEGIN_NAMESPACE
+
// Legacy, single instance hooks: ### Qt 5: remove
typedef void (*_qt_pixmap_cleanup_hook)(int);
typedef void (*_qt_pixmap_cleanup_hook_64)(qint64);
@@ -108,3 +110,4 @@ void QImagePixmapCleanupHooks::executeImageHooks(qint64 key)
qt_image_cleanup_hook_64(key);
}
+QT_END_NAMESPACE
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index 94569ec66..421d5115d 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -960,7 +960,8 @@ void QAbstractItemView::reset()
d->currentIndexSet = false;
setState(NoState);
setRootIndex(QModelIndex());
- d->selectionModel->reset();
+ if (d->selectionModel)
+ d->selectionModel->reset();
}
/*!
@@ -2649,7 +2650,7 @@ void QAbstractItemView::keyboardSearch(const QString &search)
if (search.isEmpty()
|| (d->keyboardInputTime.msecsTo(now) > QApplication::keyboardInputInterval())) {
d->keyboardInput = search;
- skipRow = true;
+ skipRow = currentIndex().isValid(); //if it is not valid we should really start at QModelIndex(0,0)
} else {
d->keyboardInput += search;
}
@@ -2676,6 +2677,7 @@ void QAbstractItemView::keyboardSearch(const QString &search)
QModelIndex current = start;
QModelIndexList match;
QModelIndex firstMatch;
+ QModelIndex startMatch;
QModelIndexList previous;
do {
match = d->model->match(current, Qt::DisplayRole, searchString);
@@ -2692,6 +2694,12 @@ void QAbstractItemView::keyboardSearch(const QString &search)
if (row >= d->model->rowCount(firstMatch.parent()))
row = 0;
current = firstMatch.sibling(row, firstMatch.column());
+
+ //avoid infinite loop if all the matching items are disabled.
+ if (!startMatch.isValid())
+ startMatch = firstMatch;
+ else if (startMatch == firstMatch)
+ break;
}
} while (current != start && firstMatch.isValid());
}
diff --git a/src/gui/itemviews/qitemdelegate.cpp b/src/gui/itemviews/qitemdelegate.cpp
index 962ce54f0..bd6dc62be 100644
--- a/src/gui/itemviews/qitemdelegate.cpp
+++ b/src/gui/itemviews/qitemdelegate.cpp
@@ -1296,8 +1296,14 @@ bool QItemDelegate::editorEvent(QEvent *event,
return false;
}
- Qt::CheckState state = (static_cast<Qt::CheckState>(value.toInt()) == Qt::Checked
+ Qt::CheckState state;
+ if ( flags & Qt::ItemIsTristate ) {
+ state = static_cast<Qt::CheckState>( (value.toInt() + 1) % 3 );
+ } else {
+ state = (static_cast<Qt::CheckState>(value.toInt()) == Qt::Checked
? Qt::Unchecked : Qt::Checked);
+ }
+
return model->setData(index, state, Qt::CheckStateRole);
}
diff --git a/src/gui/itemviews/qitemselectionmodel.cpp b/src/gui/itemviews/qitemselectionmodel.cpp
index 9dad95f86..06c345f0e 100644
--- a/src/gui/itemviews/qitemselectionmodel.cpp
+++ b/src/gui/itemviews/qitemselectionmodel.cpp
@@ -590,11 +590,43 @@ void QItemSelectionModelPrivate::_q_rowsAboutToBeRemoved(const QModelIndex &pare
emit q->currentColumnChanged(currentIndex, old);
}
- // update selectionsx
- QModelIndex tl = model->index(start, 0, parent);
- QModelIndex br = model->index(end, model->columnCount(parent) - 1, parent);
- q->select(QItemSelection(tl, br), QItemSelectionModel::Deselect);
- finalize();
+ QItemSelection deselected;
+ QItemSelection::iterator it = currentSelection.begin();
+ while (it != currentSelection.end()) {
+ if (it->topLeft().parent() != parent) { // Check parents until reaching root or contained in range
+ QModelIndex itParent = it->topLeft().parent();
+ while (itParent.isValid() && itParent.parent() != parent)
+ itParent = itParent.parent();
+
+ if (parent.isValid() && start <= itParent.row() && itParent.row() <= end) {
+ deselected.append(*it);
+ it = currentSelection.erase(it);
+ } else {
+ ++it;
+ }
+ } else if (start <= it->bottom() && it->bottom() <= end // Full inclusion
+ && start <= it->top() && it->top() <= end) {
+ deselected.append(*it);
+ it = currentSelection.erase(it);
+ } else if (start <= it->top() && it->top() <= end) { // Top intersection
+ deselected.append(QItemSelectionRange(it->topLeft(), model->index(end, it->left(), it->parent())));
+ it = currentSelection.insert(it, QItemSelectionRange(model->index(end + 1, it->left(), it->parent()),
+ it->bottomRight()));
+ it = currentSelection.erase(++it);
+ } else if (start <= it->bottom() && it->bottom() <= end) { // Bottom intersection
+ deselected.append(QItemSelectionRange(model->index(start, it->right(), it->parent()), it->bottomRight()));
+ it = currentSelection.insert(it, QItemSelectionRange(it->topLeft(),
+ model->index(start - 1, it->right(), it->parent())));
+ it = currentSelection.erase(++it);
+ } else {
+ if (it->top() < start && end < it->bottom()) // Middle intersection (do nothing)
+ deselected.append(QItemSelectionRange(model->index(start, it->right(), it->parent()),
+ model->index(end, it->left(), it->parent())));
+ ++it;
+ }
+ }
+
+ emit q->selectionChanged(QItemSelection(), deselected);
}
/*!
diff --git a/src/gui/itemviews/qlistwidget.cpp b/src/gui/itemviews/qlistwidget.cpp
index 25656571b..b518ff297 100644
--- a/src/gui/itemviews/qlistwidget.cpp
+++ b/src/gui/itemviews/qlistwidget.cpp
@@ -447,21 +447,20 @@ Qt::DropActions QListModel::supportedDropActions() const
\ingroup model-view
- QListWidgetItem is used to represent items in a list provided by the
- QListWidget class. Each item can hold several pieces of information,
- and will display these appropriately.
+ A QListWidgetItem represents a single item in a QListWidget. Each item can
+ hold several pieces of information, and will display them appropriately.
- The item view convenience classes use a classic item-based interface
- rather than a pure model/view approach. For a more flexible list view
- widget, consider using the QListView class with a standard model.
+ The item view convenience classes use a classic item-based interface rather
+ than a pure model/view approach. For a more flexible list view widget,
+ consider using the QListView class with a standard model.
- List items can be automatically inserted into a list when they are
- constructed by specifying the list widget:
+ List items can be inserted automatically into a list, when they are
+ constructed, by specifying the list widget:
\snippet doc/src/snippets/qlistwidget-using/mainwindow.cpp 2
- They can also be created without a parent widget, and later inserted into
- a list (see \l{QListWidget::insertItem()}).
+ Alternatively, list items can also be created without a parent widget, and
+ later inserted into a list using QListWidget::insertItem().
List items are typically used to display text() and an icon(). These are
set with the setText() and setIcon() functions. The appearance of the text
@@ -471,22 +470,24 @@ Qt::DropActions QListModel::supportedDropActions() const
with setToolTip(), setStatusTip(), and setWhatsThis().
By default, items are enabled, selectable, checkable, and can be the source
- of a drag and drop operation.
+ of drag and drop operations.
+
Each item's flags can be changed by calling setFlags() with the appropriate
- value (see \l{Qt::ItemFlags}). Checkable items can be checked, unchecked and
+ value (see Qt::ItemFlags). Checkable items can be checked, unchecked and
partially checked with the setCheckState() function. The corresponding
- checkState() function indicates what check state the item currently has.
+ checkState() function indicates the item's current check state.
+
+ The isHidden() function can be used to determine whether the item is
+ hidden. To hide an item, use setHidden().
- The isHidden() function can be used to determine whether the
- item is hidden. Items can be hidden with setHidden().
\section1 Subclassing
When subclassing QListWidgetItem to provide custom items, it is possible to
- define new types for them so that they can be distinguished from standard
- items. The constructors for subclasses that require this feature need to
- call the base class constructor with a new type value equal to or greater
- than \l UserType.
+ define new types for them enabling them to be distinguished from standard
+ items. For subclasses that require this feature, ensure that you call the
+ base class constructor with a new type value equal to or greater than
+ \l UserType, within \e your constructor.
\sa QListWidget, {Model/View Programming}, QTreeWidgetItem, QTableWidgetItem
*/
@@ -515,59 +516,58 @@ Qt::DropActions QListModel::supportedDropActions() const
/*!
\fn QListWidget *QListWidgetItem::listWidget() const
- Returns the list widget that contains the item.
+ Returns the list widget containing the item.
*/
/*!
- \fn void QListWidgetItem::setSelected(bool select)
- \since 4.2
+ \fn void QListWidgetItem::setSelected(bool select)
+ \since 4.2
- Sets the selected state of the item to \a select.
+ Sets the selected state of the item to \a select.
- \sa isSelected()
+ \sa isSelected()
*/
/*!
- \fn bool QListWidgetItem::isSelected() const
- \since 4.2
+ \fn bool QListWidgetItem::isSelected() const
+ \since 4.2
- Returns true if the item is selected, otherwise returns false.
+ Returns true if the item is selected; otherwise returns false.
- \sa setSelected()
+ \sa setSelected()
*/
/*!
- \fn void QListWidgetItem::setHidden(bool hide)
- \since 4.2
+ \fn void QListWidgetItem::setHidden(bool hide)
+ \since 4.2
- Hides the item if \a hide is true, otherwise shows the item.
+ Hides the item if \a hide is true; otherwise shows the item.
- \sa isHidden()
+ \sa isHidden()
*/
/*!
- \fn bool QListWidgetItem::isHidden() const
- \since 4.2
+ \fn bool QListWidgetItem::isHidden() const
+ \since 4.2
- Returns true if the item is hidden, otherwise returns false.
+ Returns true if the item is hidden; otherwise returns false.
- \sa setHidden()
+ \sa setHidden()
*/
/*!
\fn QListWidgetItem::QListWidgetItem(QListWidget *parent, int type)
Constructs an empty list widget item of the specified \a type with the
- given \a parent.
- If the parent is not specified, the item will need to be inserted into a
- list widget with QListWidget::insertItem().
-
- \note that this constructor inserts this same object into the model of
- the parent that is passed to the constructor. If the model is sorted then
- the behavior of the insert is undetermined since the model will call
- the '<' operator method on this object which has still not yet been
- constructed. In this case it would be better not to specify the parent
- and use the QListWidget::insertItem method to insert the item instead.
+ given \a parent. If \a parent is not specified, the item will need to be
+ inserted into a list widget with QListWidget::insertItem().
+
+ This constructor inserts the item into the model of the parent that is
+ passed to the constructor. If the model is sorted then the behavior of the
+ insert is undetermined since the model will call the \c '<' operator method
+ on the item which, at this point, is not yet constructed. To avoid the
+ undetermined behavior, we recommend not to specify the parent and use
+ QListWidget::insertItem() instead.
\sa type()
*/
@@ -586,16 +586,15 @@ QListWidgetItem::QListWidgetItem(QListWidget *view, int type)
\fn QListWidgetItem::QListWidgetItem(const QString &text, QListWidget *parent, int type)
Constructs an empty list widget item of the specified \a type with the
- given \a text and \a parent.
- If the parent is not specified, the item will need to be inserted into a
- list widget with QListWidget::insertItem().
-
- \note that this constructor inserts this same object into the model of
- the parent that is passed to the constructor. If the model is sorted then
- the behavior of the insert is undetermined since the model will call
- the '<' operator method on this object which has still not yet been
- constructed. In this case it would be better not to specify the parent
- and use the QListWidget::insertItem method to insert the item instead.
+ given \a text and \a parent. If the parent is not specified, the item will
+ need to be inserted into a list widget with QListWidget::insertItem().
+
+ This constructor inserts the item into the model of the parent that is
+ passed to the constructor. If the model is sorted then the behavior of the
+ insert is undetermined since the model will call the \c '<' operator method
+ on the item which, at this point, is not yet constructed. To avoid the
+ undetermined behavior, we recommend not to specify the parent and use
+ QListWidget::insertItem() instead.
\sa type()
*/
@@ -616,17 +615,17 @@ QListWidgetItem::QListWidgetItem(const QString &text, QListWidget *view, int typ
\fn QListWidgetItem::QListWidgetItem(const QIcon &icon, const QString &text, QListWidget *parent, int type)
Constructs an empty list widget item of the specified \a type with the
- given \a icon, \a text and \a parent.
- If the parent is not specified, the item will need to be inserted into a
- list widget with QListWidget::insertItem().
-
- \note that this constructor inserts this same object into the model of
- the parent that is passed to the constructor. If the model is sorted then
- the behavior of the insert is undetermined since the model will call
- the '<' operator method on this object which has still not yet been
- constructed. In this case it would be better not to specify the parent
- and use the QListWidget::insertItem method to insert the item instead.
-
+ given \a icon, \a text and \a parent. If the parent is not specified, the
+ item will need to be inserted into a list widget with
+ QListWidget::insertItem().
+
+ This constructor inserts the item into the model of the parent that is
+ passed to the constructor. If the model is sorted then the behavior of the
+ insert is undetermined since the model will call the \c '<' operator method
+ on the item which, at this point, is not yet constructed. To avoid the
+ undetermined behavior, we recommend not to specify the parent and use
+ QListWidget::insertItem() instead.
+
\sa type()
*/
QListWidgetItem::QListWidgetItem(const QIcon &icon,const QString &text,
@@ -645,7 +644,7 @@ QListWidgetItem::QListWidgetItem(const QIcon &icon,const QString &text,
}
/*!
- Destroys the list item.
+ Destroys the list item.
*/
QListWidgetItem::~QListWidgetItem()
{
@@ -655,7 +654,7 @@ QListWidgetItem::~QListWidgetItem()
}
/*!
- Creates an exact copy of the item.
+ Creates an exact copy of the item.
*/
QListWidgetItem *QListWidgetItem::clone() const
{
@@ -663,11 +662,10 @@ QListWidgetItem *QListWidgetItem::clone() const
}
/*!
- This function sets the data for a given \a role to the given \a value (see
- \l{Qt::ItemDataRole}). Reimplement this function if you need
- extra roles or special behavior for certain roles.
+ Sets the data for a given \a role to the given \a value. Reimplement this
+ function if you need extra roles or special behavior for certain roles.
- \sa Qt::ItemDataRole, data()
+ \sa Qt::ItemDataRole, data()
*/
void QListWidgetItem::setData(int role, const QVariant &value)
{
@@ -689,9 +687,10 @@ void QListWidgetItem::setData(int role, const QVariant &value)
}
/*!
- This function returns the item's data for a given \a role (see
- Qt::ItemDataRole). Reimplement this function if you need
- extra roles or special behavior for certain roles.
+ Returns the item's data for a given \a role. Reimplement this function if
+ you need extra roles or special behavior for certain roles.
+
+ \sa Qt::ItemDataRole, setData()
*/
QVariant QListWidgetItem::data(int role) const
{
@@ -703,8 +702,8 @@ QVariant QListWidgetItem::data(int role) const
}
/*!
- Returns true if this item's text is less then \a other item's text;
- otherwise returns false.
+ Returns true if this item's text is less then \a other item's text;
+ otherwise returns false.
*/
bool QListWidgetItem::operator<(const QListWidgetItem &other) const
{
@@ -740,8 +739,8 @@ void QListWidgetItem::write(QDataStream &out) const
/*!
\since 4.1
- Constructs a copy of \a other. Note that type() and listWidget()
- are not copied.
+ Constructs a copy of \a other. Note that type() and listWidget() are not
+ copied.
This function is useful when reimplementing clone().
@@ -756,8 +755,8 @@ QListWidgetItem::QListWidgetItem(const QListWidgetItem &other)
}
/*!
- Assigns \a other's data and flags to this item. Note that type()
- and listWidget() are not copied.
+ Assigns \a other's data and flags to this item. Note that type() and
+ listWidget() are not copied.
This function is useful when reimplementing clone().
@@ -805,9 +804,9 @@ QDataStream &operator>>(QDataStream &in, QListWidgetItem &item)
#endif // QT_NO_DATASTREAM
/*!
- \fn Qt::ItemFlags QListWidgetItem::flags() const
+ \fn Qt::ItemFlags QListWidgetItem::flags() const
- Returns the item flags for this item (see \l{Qt::ItemFlags}).
+ Returns the item flags for this item (see \l{Qt::ItemFlags}).
*/
/*!
@@ -851,15 +850,17 @@ QDataStream &operator>>(QDataStream &in, QListWidgetItem &item)
*/
/*!
- \fn QFont QListWidgetItem::font() const
+ \fn QFont QListWidgetItem::font() const
- Returns the font used to display this list item's text.
+ Returns the font used to display this list item's text.
*/
/*!
- \fn int QListWidgetItem::textAlignment() const
+ \fn int QListWidgetItem::textAlignment() const
- Returns the text alignment for the list item (see \l{Qt::AlignmentFlag}).
+ Returns the text alignment for the list item.
+
+ \sa Qt::AlignmentFlag
*/
/*!
@@ -905,26 +906,26 @@ QDataStream &operator>>(QDataStream &in, QListWidgetItem &item)
*/
/*!
- \fn QSize QListWidgetItem::sizeHint() const
- \since 4.1
+ \fn QSize QListWidgetItem::sizeHint() const
+ \since 4.1
- Returns the size hint set for the list item.
+ Returns the size hint set for the list item.
*/
/*!
- \fn void QListWidgetItem::setSizeHint(const QSize &size)
- \since 4.1
+ \fn void QListWidgetItem::setSizeHint(const QSize &size)
+ \since 4.1
- Sets the size hint for the list item to be \a size.
- If no size hint is set, the item delegate will compute the
- size hint based on the item data.
+ Sets the size hint for the list item to be \a size. If no size hint is set,
+ the item delegate will compute the size hint based on the item data.
*/
/*!
- \fn void QListWidgetItem::setFlags(Qt::ItemFlags flags)
+ \fn void QListWidgetItem::setFlags(Qt::ItemFlags flags)
- Sets the item flags for the list item to \a flags (see
- \l{Qt::ItemFlags}).
+ Sets the item flags for the list item to \a flags.
+
+ \sa Qt::ItemFlags
*/
void QListWidgetItem::setFlags(Qt::ItemFlags aflags) {
itemFlags = aflags;
@@ -953,10 +954,10 @@ void QListWidgetItem::setFlags(Qt::ItemFlags aflags) {
\fn void QListWidgetItem::setStatusTip(const QString &statusTip)
Sets the status tip for the list item to the text specified by
- \a statusTip. QListWidget mouse tracking needs to be enabled for this
+ \a statusTip. QListWidget mouseTracking needs to be enabled for this
feature to work.
- \sa statusTip() setToolTip() setWhatsThis()
+ \sa statusTip(), setToolTip(), setWhatsThis(), QWidget::setMouseTracking()
*/
/*!
@@ -964,29 +965,30 @@ void QListWidgetItem::setFlags(Qt::ItemFlags aflags) {
Sets the tooltip for the list item to the text specified by \a toolTip.
- \sa toolTip() setStatusTip() setWhatsThis()
+ \sa toolTip(), setStatusTip(), setWhatsThis()
*/
/*!
\fn void QListWidgetItem::setWhatsThis(const QString &whatsThis)
- Sets the "What's This?" help for the list item to the text specified
- by \a whatsThis.
+ Sets the "What's This?" help for the list item to the text specified by
+ \a whatsThis.
- \sa whatsThis() setStatusTip() setToolTip()
+ \sa whatsThis(), setStatusTip(), setToolTip()
*/
/*!
- \fn void QListWidgetItem::setFont(const QFont &font)
+ \fn void QListWidgetItem::setFont(const QFont &font)
- Sets the font used when painting the item to the given \a font.
+ Sets the font used when painting the item to the given \a font.
*/
/*!
- \fn void QListWidgetItem::setTextAlignment(int alignment)
+ \fn void QListWidgetItem::setTextAlignment(int alignment)
+
+ Sets the list item's text alignment to \a alignment.
- Sets the list item's text alignment to \a alignment (see
- \l{Qt::AlignmentFlag}).
+ \sa Qt::AlignmentFlag
*/
/*!
@@ -1127,10 +1129,10 @@ void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft,
\ingroup model-view
\mainclass
- QListWidget is a convenience class that provides a list view similar to
- the one supplied by QListView, but with a classic item-based interface
- for adding and removing items. QListWidget uses an internal model to
- manage each QListWidgetItem in the list.
+ QListWidget is a convenience class that provides a list view similar to the
+ one supplied by QListView, but with a classic item-based interface for
+ adding and removing items. QListWidget uses an internal model to manage
+ each QListWidgetItem in the list.
For a more flexible list view widget, use the QListView class with a
standard model.
@@ -1145,23 +1147,23 @@ void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft,
function.
There are two ways to add items to the list: they can be constructed with
- the list widget as their parent widget, or they can be constructed with
- no parent widget and added to the list later. If a list widget already
- exists when the items are constructed, the first method is easier to use:
+ the list widget as their parent widget, or they can be constructed with no
+ parent widget and added to the list later. If a list widget already exists
+ when the items are constructed, the first method is easier to use:
\snippet doc/src/snippets/qlistwidget-using/mainwindow.cpp 1
- If you need to insert a new item into the list at a particular position,
- it is more required to construct the item without a parent widget and
- use the insertItem() function to place it within the list. The list
- widget will take ownership of the item.
+ If you need to insert a new item into the list at a particular position, it
+ is more required to construct the item without a parent widget and use the
+ insertItem() function to place it within the list. The list widget will
+ take ownership of the item.
\snippet doc/src/snippets/qlistwidget-using/mainwindow.cpp 6
\snippet doc/src/snippets/qlistwidget-using/mainwindow.cpp 7
- For multiple items, insertItems() can be used instead. The number of
- items in the list is found with the count() function.
- To remove items from the list, use takeItem().
+ For multiple items, insertItems() can be used instead. The number of items
+ in the list is found with the count() function. To remove items from the
+ list, use takeItem().
The current item in the list can be found with currentItem(), and changed
with setCurrentItem(). The user can also change the current item by
@@ -1187,9 +1189,9 @@ void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft,
Inserts the \a item at the end of the list widget.
- \warning A QListWidgetItem can only be added to a
- QListWidget once. Adding the same QListWidgetItem multiple
- times to a QListWidget will result in undefined behavior.
+ \warning A QListWidgetItem can only be added to a QListWidget once. Adding
+ the same QListWidgetItem multiple times to a QListWidget will result in
+ undefined behavior.
\sa insertItem()
*/
@@ -1197,8 +1199,7 @@ void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft,
/*!
\fn void QListWidget::addItem(const QString &label)
- Inserts an item with the text \a label at the end of the list
- widget.
+ Inserts an item with the text \a label at the end of the list widget.
*/
/*!
@@ -1212,8 +1213,8 @@ void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft,
/*!
\fn void QListWidget::itemPressed(QListWidgetItem *item)
- This signal is emitted with the specified \a item when a mouse button is pressed
- on an item in the widget.
+ This signal is emitted with the specified \a item when a mouse button is
+ pressed on an item in the widget.
\sa itemClicked(), itemDoubleClicked()
*/
@@ -1221,8 +1222,8 @@ void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft,
/*!
\fn void QListWidget::itemClicked(QListWidgetItem *item)
- This signal is emitted with the specified \a item when a mouse button is clicked
- on an item in the widget.
+ This signal is emitted with the specified \a item when a mouse button is
+ clicked on an item in the widget.
\sa itemPressed(), itemDoubleClicked()
*/
@@ -1230,8 +1231,8 @@ void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft,
/*!
\fn void QListWidget::itemDoubleClicked(QListWidgetItem *item)
- This signal is emitted with the specified \a item when a mouse button is double
- clicked on an item in the widget.
+ This signal is emitted with the specified \a item when a mouse button is
+ double clicked on an item in the widget.
\sa itemClicked(), itemPressed()
*/
@@ -1239,20 +1240,21 @@ void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft,
/*!
\fn void QListWidget::itemActivated(QListWidgetItem *item)
- This signal is emitted when the \a item is activated. The \a item
- is activated when the user clicks or double clicks on it,
- depending on the system configuration. It is also activated when
- the user presses the activation key (on Windows and X11 this is
- the \gui Return key, on Mac OS X it is \key{Ctrl+0}).
+ This signal is emitted when the \a item is activated. The \a item is
+ activated when the user clicks or double clicks on it, depending on the
+ system configuration. It is also activated when the user presses the
+ activation key (on Windows and X11 this is the \gui Return key, on Mac OS
+ X it is \key{Ctrl+0}).
*/
/*!
\fn void QListWidget::itemEntered(QListWidgetItem *item)
- This signal is emitted when the mouse cursor enters an item. The
- \a item is the item entered. This signal is only emitted when
- mouseTracking is turned on, or when a mouse button is pressed
- while moving into an item.
+ This signal is emitted when the mouse cursor enters an item. The \a item is
+ the item entered. This signal is only emitted when mouseTracking is turned
+ on, or when a mouse button is pressed while moving into an item.
+
+ \sa QWidget::setMouseTracking()
*/
/*!
@@ -1264,24 +1266,28 @@ void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft,
/*!
\fn void QListWidget::currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous)
- This signal is emitted whenever the current item changes. The \a
- previous item is the item that previously had the focus, \a
- current is the new current item.
+ This signal is emitted whenever the current item changes.
+
+ \a previous is the item that previously had the focus; \a current is the
+ new current item.
*/
/*!
- \fn void QListWidget::currentTextChanged(const QString &currentText)
+ \fn void QListWidget::currentTextChanged(const QString &currentText)
- This signal is emitted whenever the current item changes. The \a currentText
- is the text data in the current item. If there is no current item, the \a currentText
- is invalid.
+ This signal is emitted whenever the current item changes.
+
+ \a currentText is the text data in the current item. If there is no current
+ item, the \a currentText is invalid.
*/
/*!
- \fn void QListWidget::currentRowChanged(int currentRow)
+ \fn void QListWidget::currentRowChanged(int currentRow)
+
+ This signal is emitted whenever the current item changes.
- This signal is emitted whenever the current item changes. The \a currentRow
- is the row of the current item. If there is no current item, the \a currentRow is -1.
+ \a currentRow is the row of the current item. If there is no current item,
+ the \a currentRow is -1.
*/
/*!
@@ -1289,15 +1295,15 @@ void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft,
This signal is emitted whenever the selection changes.
- \sa selectedItems() QListWidgetItem::isSelected() currentItemChanged()
+ \sa selectedItems(), QListWidgetItem::isSelected(), currentItemChanged()
*/
/*!
- \since 4.3
+ \since 4.3
- \fn void QListWidget::removeItemWidget(QListWidgetItem *item)
+ \fn void QListWidget::removeItemWidget(QListWidgetItem *item)
- Removes the widget set on the given \a item.
+ Removes the widget set on the given \a item.
*/
/*!
@@ -1361,8 +1367,8 @@ void QListWidget::insertItem(int row, QListWidgetItem *item)
}
/*!
- Inserts an item with the text \a label in the list widget at the
- position given by \a row.
+ Inserts an item with the text \a label in the list widget at the position
+ given by \a row.
\sa addItem()
*/
@@ -1387,11 +1393,11 @@ void QListWidget::insertItems(int row, const QStringList &labels)
}
/*!
- Removes and returns the item from the given \a row in the list widget; otherwise
- returns 0.
+ Removes and returns the item from the given \a row in the list widget;
+ otherwise returns 0.
- Items removed from a list widget will not be managed by Qt, and will need to be
- deleted manually.
+ Items removed from a list widget will not be managed by Qt, and will need
+ to be deleted manually.
\sa insertItem(), addItem()
*/
@@ -1405,8 +1411,8 @@ QListWidgetItem *QListWidget::takeItem(int row)
}
/*!
- \property QListWidget::count
- \brief the number of items in the list including any hidden items.
+ \property QListWidget::count
+ \brief the number of items in the list including any hidden items.
*/
int QListWidget::count() const
@@ -1416,7 +1422,7 @@ int QListWidget::count() const
}
/*!
- Returns the current item.
+ Returns the current item.
*/
QListWidgetItem *QListWidget::currentItem() const
{
@@ -1426,9 +1432,9 @@ QListWidgetItem *QListWidget::currentItem() const
/*!
- Sets the current item to \a item.
+ Sets the current item to \a item.
- Depending on the current selection mode, the item may also be selected.
+ Depending on the current selection mode, the item may also be selected.
*/
void QListWidget::setCurrentItem(QListWidgetItem *item)
{
@@ -1436,8 +1442,8 @@ void QListWidget::setCurrentItem(QListWidgetItem *item)
}
/*!
- \since 4.4
- Set the current item to \a item, using the given \a command.
+ \since 4.4
+ Set the current item to \a item, using the given \a command.
*/
void QListWidget::setCurrentItem(QListWidgetItem *item, QItemSelectionModel::SelectionFlags command)
{
@@ -1445,10 +1451,10 @@ void QListWidget::setCurrentItem(QListWidgetItem *item, QItemSelectionModel::Sel
}
/*!
- \property QListWidget::currentRow
- \brief the row of the current item.
+ \property QListWidget::currentRow
+ \brief the row of the current item.
- Depending on the current selection mode, the row may also be selected.
+ Depending on the current selection mode, the row may also be selected.
*/
int QListWidget::currentRow() const
@@ -1469,9 +1475,9 @@ void QListWidget::setCurrentRow(int row)
}
/*!
- \since 4.4
+ \since 4.4
- Sets the current row to be the given \a row, using the given \a command,
+ Sets the current row to be the given \a row, using the given \a command,
*/
void QListWidget::setCurrentRow(int row, QItemSelectionModel::SelectionFlags command)
{
@@ -1498,7 +1504,7 @@ QListWidgetItem *QListWidget::itemAt(const QPoint &p) const
/*!
- Returns the rectangle on the viewport occupied by the item at \a item.
+ Returns the rectangle on the viewport occupied by the item at \a item.
*/
QRect QListWidget::visualItemRect(const QListWidgetItem *item) const
{
@@ -1508,7 +1514,7 @@ QRect QListWidget::visualItemRect(const QListWidgetItem *item) const
}
/*!
- Sorts all the items in the list widget according to the specified \a order.
+ Sorts all the items in the list widget according to the specified \a order.
*/
void QListWidget::sortItems(Qt::SortOrder order)
{
@@ -1522,8 +1528,10 @@ void QListWidget::sortItems(Qt::SortOrder order)
\property QListWidget::sortingEnabled
\brief whether sorting is enabled
- If this property is true, sorting is enabled for the list; if the
- property is false, sorting is not enabled. The default value is false.
+ If this property is true, sorting is enabled for the list; if the property
+ is false, sorting is not enabled.
+
+ The default value is false.
*/
void QListWidget::setSortingEnabled(bool enable)
{
@@ -1538,7 +1546,7 @@ bool QListWidget::isSortingEnabled() const
}
/*!
- \internal
+ \internal
*/
Qt::SortOrder QListWidget::sortOrder() const
{
@@ -1547,7 +1555,7 @@ Qt::SortOrder QListWidget::sortOrder() const
}
/*!
- Starts editing the \a item if it is editable.
+ Starts editing the \a item if it is editable.
*/
void QListWidget::editItem(QListWidgetItem *item)
@@ -1557,9 +1565,10 @@ void QListWidget::editItem(QListWidgetItem *item)
}
/*!
- Opens an editor for the given \a item. The editor remains open after editing.
+ Opens an editor for the given \a item. The editor remains open after
+ editing.
- \sa closePersistentEditor()
+ \sa closePersistentEditor()
*/
void QListWidget::openPersistentEditor(QListWidgetItem *item)
{
@@ -1569,9 +1578,9 @@ void QListWidget::openPersistentEditor(QListWidgetItem *item)
}
/*!
- Closes the persistent editor for the given \a item.
+ Closes the persistent editor for the given \a item.
- \sa openPersistentEditor()
+ \sa openPersistentEditor()
*/
void QListWidget::closePersistentEditor(QListWidgetItem *item)
{
@@ -1597,9 +1606,10 @@ QWidget *QListWidget::itemWidget(QListWidgetItem *item) const
Sets the \a widget to be displayed in the give \a item.
- This function should only be used to display static content in the place of a list
- widget item. If you want to display custom dynamic content or implement a custom
- editor widget, use QListView and subclass QItemDelegate instead.
+ This function should only be used to display static content in the place of
+ a list widget item. If you want to display custom dynamic content or
+ implement a custom editor widget, use QListView and subclass QItemDelegate
+ instead.
\sa {Delegate Classes}
*/
@@ -1611,11 +1621,11 @@ void QListWidget::setItemWidget(QListWidgetItem *item, QWidget *widget)
}
/*!
- Returns true if \a item is selected; otherwise returns false.
+ Returns true if \a item is selected; otherwise returns false.
- \obsolete
+ \obsolete
- This function is deprecated. Use \l{QListWidgetItem::isSelected()} instead.
+ This function is deprecated. Use QListWidgetItem::isSelected() instead.
*/
bool QListWidget::isItemSelected(const QListWidgetItem *item) const
{
@@ -1625,12 +1635,12 @@ bool QListWidget::isItemSelected(const QListWidgetItem *item) const
}
/*!
- Selects or deselects the given \a item depending on whether \a select is
- true of false.
+ Selects or deselects the given \a item depending on whether \a select is
+ true of false.
- \obsolete
+ \obsolete
- This function is deprecated. Use \l{QListWidgetItem::setSelected()} instead.
+ This function is deprecated. Use QListWidgetItem::setSelected() instead.
*/
void QListWidget::setItemSelected(const QListWidgetItem *item, bool select)
{
@@ -1650,7 +1660,7 @@ void QListWidget::setItemSelected(const QListWidgetItem *item, bool select)
}
/*!
- Returns a list of all selected items in the list widget.
+ Returns a list of all selected items in the list widget.
*/
QList<QListWidgetItem*> QListWidget::selectedItems() const
@@ -1664,7 +1674,8 @@ QList<QListWidgetItem*> QListWidget::selectedItems() const
}
/*!
- Finds items with the text that matches the string \a text using the given \a flags.
+ Finds items with the text that matches the string \a text using the given
+ \a flags.
*/
QList<QListWidgetItem*> QListWidget::findItems(const QString &text, Qt::MatchFlags flags) const
@@ -1679,11 +1690,11 @@ QList<QListWidgetItem*> QListWidget::findItems(const QString &text, Qt::MatchFla
}
/*!
- Returns true if the \a item is explicitly hidden; otherwise returns false.
+ Returns true if the \a item is explicitly hidden; otherwise returns false.
- \obsolete
+ \obsolete
- This function is deprecated. Use \l{QListWidgetItem::isHidden()} instead.
+ This function is deprecated. Use QListWidgetItem::isHidden() instead.
*/
bool QListWidget::isItemHidden(const QListWidgetItem *item) const
{
@@ -1691,11 +1702,11 @@ bool QListWidget::isItemHidden(const QListWidgetItem *item) const
}
/*!
- If \a hide is true, the \a item will be hidden; otherwise it will be shown.
+ If \a hide is true, the \a item will be hidden; otherwise it will be shown.
- \obsolete
+ \obsolete
- This function is deprecated. Use \l{QListWidgetItem::setHidden()} instead.
+ This function is deprecated. Use QListWidgetItem::setHidden() instead.
*/
void QListWidget::setItemHidden(const QListWidgetItem *item, bool hide)
{
@@ -1703,9 +1714,9 @@ void QListWidget::setItemHidden(const QListWidgetItem *item, bool hide)
}
/*!
- Scrolls the view if necessary to ensure that the \a item is
- visible. The \a hint parameter specifies more precisely where the
- \a item should be located after the operation.
+ Scrolls the view if necessary to ensure that the \a item is visible.
+
+ \a hint specifies where the \a item should be located after the operation.
*/
void QListWidget::scrollToItem(const QListWidgetItem *item, QAbstractItemView::ScrollHint hint)
@@ -1718,7 +1729,7 @@ void QListWidget::scrollToItem(const QListWidgetItem *item, QAbstractItemView::S
/*!
Removes all items and selections in the view.
- \note All items will be permanently deleted.
+ \warning All items will be permanently deleted.
*/
void QListWidget::clear()
{
@@ -1743,8 +1754,8 @@ QStringList QListWidget::mimeTypes() const
\a items. The format used to describe the items is obtained from the
mimeTypes() function.
- If the list of items is empty, 0 is returned rather than a serialized
- empty list.
+ If the list of items is empty, 0 is returned instead of a serialized empty
+ list.
*/
QMimeData *QListWidget::mimeData(const QList<QListWidgetItem*>) const
{
@@ -1753,10 +1764,9 @@ QMimeData *QListWidget::mimeData(const QList<QListWidgetItem*>) const
#ifndef QT_NO_DRAGANDDROP
/*!
- Handles the \a data supplied by an external drag and drop operation
- that ended with the given \a action in the given \a index.
- Returns true if the data and action can be handled by the model;
- otherwise returns false.
+ Handles \a data supplied by an external drag and drop operation that ended
+ with the given \a action in the given \a index. Returns true if \a data and
+ \a action can be handled by the model; otherwise returns false.
\sa supportedDropActions()
*/
@@ -1823,9 +1833,9 @@ void QListWidget::dropEvent(QDropEvent *event) {
}
/*!
- Returns the drop actions supported by this view.
+ Returns the drop actions supported by this view.
- \sa Qt::DropActions
+ \sa Qt::DropActions
*/
Qt::DropActions QListWidget::supportedDropActions() const
{
@@ -1835,9 +1845,9 @@ Qt::DropActions QListWidget::supportedDropActions() const
#endif // QT_NO_DRAGANDDROP
/*!
- Returns a list of pointers to the items contained in the \a data object.
- If the object was not created by a QListWidget in the same process, the list
- is empty.
+ Returns a list of pointers to the items contained in the \a data object. If
+ the object was not created by a QListWidget in the same process, the list
+ is empty.
*/
QList<QListWidgetItem*> QListWidget::items(const QMimeData *data) const
{
@@ -1848,7 +1858,7 @@ QList<QListWidgetItem*> QListWidget::items(const QMimeData *data) const
}
/*!
- Returns the QModelIndex assocated with the given \a item.
+ Returns the QModelIndex assocated with the given \a item.
*/
QModelIndex QListWidget::indexFromItem(QListWidgetItem *item) const
@@ -1858,7 +1868,7 @@ QModelIndex QListWidget::indexFromItem(QListWidgetItem *item) const
}
/*!
- Returns a pointer to the QListWidgetItem assocated with the given \a index.
+ Returns a pointer to the QListWidgetItem assocated with the given \a index.
*/
QListWidgetItem *QListWidget::itemFromIndex(const QModelIndex &index) const
@@ -1870,7 +1880,7 @@ QListWidgetItem *QListWidget::itemFromIndex(const QModelIndex &index) const
}
/*!
- \internal
+ \internal
*/
void QListWidget::setModel(QAbstractItemModel * /*model*/)
{
diff --git a/src/gui/itemviews/qstandarditemmodel.cpp b/src/gui/itemviews/qstandarditemmodel.cpp
index e71d8f94a..6f99fb598 100644
--- a/src/gui/itemviews/qstandarditemmodel.cpp
+++ b/src/gui/itemviews/qstandarditemmodel.cpp
@@ -1745,15 +1745,17 @@ QList<QStandardItem*> QStandardItem::takeRow(int row)
if (d->model)
d->model->d_func()->rowsAboutToBeRemoved(this, row, row);
QList<QStandardItem*> items;
- int index = d->childIndex(row, 0);
- int col_count = d->columnCount();
- for (int column = 0; column < col_count; ++column) {
- QStandardItem *ch = d->children.at(index + column);
- if (ch)
- ch->d_func()->setParentAndModel(0, 0);
- items.append(ch);
+ int index = d->childIndex(row, 0); // Will return -1 if there are no columns
+ if (index != -1) {
+ int col_count = d->columnCount();
+ for (int column = 0; column < col_count; ++column) {
+ QStandardItem *ch = d->children.at(index + column);
+ if (ch)
+ ch->d_func()->setParentAndModel(0, 0);
+ items.append(ch);
+ }
+ d->children.remove(index, col_count);
}
- d->children.remove(index, col_count);
d->rows--;
if (d->model)
d->model->d_func()->rowsRemoved(this, row, 1);
diff --git a/src/gui/itemviews/qstyleditemdelegate.cpp b/src/gui/itemviews/qstyleditemdelegate.cpp
index 8faf0be42..34667ee6c 100644
--- a/src/gui/itemviews/qstyleditemdelegate.cpp
+++ b/src/gui/itemviews/qstyleditemdelegate.cpp
@@ -746,8 +746,13 @@ bool QStyledItemDelegate::editorEvent(QEvent *event,
return false;
}
- Qt::CheckState state = (static_cast<Qt::CheckState>(value.toInt()) == Qt::Checked
+ Qt::CheckState state;
+ if ( flags & Qt::ItemIsTristate ) {
+ state = static_cast<Qt::CheckState>( (value.toInt() + 1) % 3 );
+ } else {
+ state = (static_cast<Qt::CheckState>(value.toInt()) == Qt::Checked
? Qt::Unchecked : Qt::Checked);
+ }
return model->setData(index, state, Qt::CheckStateRole);
}
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri
index e6eff6ebc..d9deefe73 100644
--- a/src/gui/kernel/kernel.pri
+++ b/src/gui/kernel/kernel.pri
@@ -100,7 +100,8 @@ unix:x11 {
INCLUDEPATH += ../3rdparty/xorg
HEADERS += \
kernel/qx11embed_x11.h \
- kernel/qx11info_x11.h
+ kernel/qx11info_x11.h \
+ kernel/qkde_p.h
SOURCES += \
kernel/qapplication_x11.cpp \
@@ -114,7 +115,8 @@ unix:x11 {
kernel/qwidgetcreate_x11.cpp \
kernel/qx11embed_x11.cpp \
kernel/qx11info_x11.cpp \
- kernel/qkeymapper_x11.cpp
+ kernel/qkeymapper_x11.cpp \
+ kernel/qkde.cpp
contains(QT_CONFIG, glib) {
SOURCES += \
diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h
index 19ae085a0..58e0cc367 100644
--- a/src/gui/kernel/qapplication.h
+++ b/src/gui/kernel/qapplication.h
@@ -375,10 +375,6 @@ private:
friend class QDirectPainterPrivate;
#endif
-#if defined(Q_WS_WIN)
- friend QApplicationPrivate* getQApplicationPrivateInternal();
-#endif
-
#if defined(Q_WS_MAC) || defined(Q_WS_X11)
Q_PRIVATE_SLOT(d_func(), void _q_alertTimeOut())
#endif
diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h
index 595f22034..f8096729c 100644
--- a/src/gui/kernel/qapplication_p.h
+++ b/src/gui/kernel/qapplication_p.h
@@ -234,6 +234,9 @@ typedef struct tagGESTUREINFO
# define GC_PAN_WITH_SINGLE_FINGER_VERTICALLY 0x00000002
# define GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY 0x00000004
+# define GC_ZOOM 0x00000001
+# define GC_ROTATE 0x00000001
+
typedef struct tagGESTURECONFIG
{
DWORD dwID;
@@ -241,17 +244,20 @@ typedef struct tagGESTURECONFIG
DWORD dwBlock;
} GESTURECONFIG;
+# define GID_ROTATE_ANGLE_FROM_ARGUMENT(arg) ((((double)(arg) / 65535.0) * 4.0 * 3.14159265) - 2.0*3.14159265)
+
#endif // WM_GESTURE
#endif // Q_WS_WIN
class QPanGesture;
class QPinchGesture;
-struct StandardGestures
+struct QStandardGestures
{
QPanGesture *pan;
QPinchGesture *pinch;
- StandardGestures() : pan(0), pinch(0) { }
+
+ QStandardGestures() : pan(0), pinch(0) { }
};
@@ -281,7 +287,6 @@ public:
#if defined(Q_WS_X11)
#ifndef QT_NO_SETTINGS
- static QString kdeHome();
static QString x11_desktop_style();
static bool x11_apply_settings();
#endif
@@ -513,19 +518,17 @@ public:
QTouchEvent::DeviceType deviceType,
const QList<QTouchEvent::TouchPoint> &touchPoints);
+ typedef QMap<QWidget*, QStandardGestures> WidgetStandardGesturesMap;
+ WidgetStandardGesturesMap widgetGestures;
+
#if defined(Q_WS_WIN)
static PtrRegisterTouchWindow RegisterTouchWindow;
static PtrGetTouchInputInfo GetTouchInputInfo;
static PtrCloseTouchInputHandle CloseTouchInputHandle;
QHash<DWORD, int> touchInputIDToTouchPointID;
- QList<QTouchEvent::TouchPoint> appAllTouchPoints;
bool translateTouchEvent(const MSG &msg);
- typedef QMap<QWidget*, StandardGestures> WidgetStandardGesturesMap;
- WidgetStandardGesturesMap widgetGestures;
- ulong lastGestureId;
-
PtrGetGestureInfo GetGestureInfo;
PtrGetGestureExtraArgs GetGestureExtraArgs;
PtrCloseGestureInfoHandle CloseGestureInfoHandle;
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index 2bded5ce9..a0142e164 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -51,6 +51,9 @@ extern void qt_wince_hide_taskbar(HWND hwnd); //defined in qguifunctions_wince.c
#ifdef Q_WS_WINCE_WM
#include <windowsm.h>
#include <tpcshell.h>
+#ifdef QT_WINCE_GESTURES
+#include <gesture.h>
+#endif
#endif
#include "qapplication.h"
@@ -428,11 +431,6 @@ extern QCursor *qt_grab_cursor();
#define __export
#endif
-QApplicationPrivate* getQApplicationPrivateInternal()
-{
- return qApp->d_func();
-}
-
extern "C" LRESULT CALLBACK QtWndProc(HWND, UINT, WPARAM, LPARAM);
class QETWidget : public QWidget // event translator widget
@@ -815,32 +813,41 @@ void qt_init(QApplicationPrivate *priv, int)
ptrSetProcessDPIAware();
#endif
- priv->lastGestureId = 0;
+ priv->GetGestureInfo = 0;
+ priv->GetGestureExtraArgs = 0;
+#if defined(Q_WS_WINCE_WM) && defined(QT_WINCE_GESTURES)
+ priv->GetGestureInfo = (PtrGetGestureInfo) &TKGetGestureInfo;
+ priv->GetGestureExtraArgs = (PtrGetGestureExtraArgs) &TKGetGestureExtraArguments;
+ priv->CloseGestureInfoHandle = (PtrCloseGestureInfoHandle) 0;
+ priv->SetGestureConfig = (PtrSetGestureConfig) 0;
+ priv->GetGestureConfig = (PtrGetGestureConfig) 0;
+#elif !defined(Q_WS_WINCE)
priv->GetGestureInfo =
- (PtrGetGestureInfo)QLibrary::resolve(QLatin1String("user32"),
- "GetGestureInfo");
+ (PtrGetGestureInfo)QLibrary::resolve(QLatin1String("user32"),
+ "GetGestureInfo");
priv->GetGestureExtraArgs =
- (PtrGetGestureExtraArgs)QLibrary::resolve(QLatin1String("user32"),
- "GetGestureExtraArgs");
+ (PtrGetGestureExtraArgs)QLibrary::resolve(QLatin1String("user32"),
+ "GetGestureExtraArgs");
priv->CloseGestureInfoHandle =
- (PtrCloseGestureInfoHandle)QLibrary::resolve(QLatin1String("user32"),
- "CloseGestureInfoHandle");
+ (PtrCloseGestureInfoHandle)QLibrary::resolve(QLatin1String("user32"),
+ "CloseGestureInfoHandle");
priv->SetGestureConfig =
- (PtrSetGestureConfig)QLibrary::resolve(QLatin1String("user32"),
- "SetGestureConfig");
- priv->GetGestureConfig =
- (PtrGetGestureConfig)QLibrary::resolve(QLatin1String("user32"),
- "GetGestureConfig");
+ (PtrSetGestureConfig)QLibrary::resolve(QLatin1String("user32"),
+ "SetGestureConfig");
+ priv->SetGestureConfig =
+ (PtrGetGestureConfig)QLibrary::resolve(QLatin1String("user32"),
+ "GetGestureConfig");
priv->BeginPanningFeedback =
- (PtrBeginPanningFeedback)QLibrary::resolve(QLatin1String("uxtheme"),
- "BeginPanningFeedback");
+ (PtrBeginPanningFeedback)QLibrary::resolve(QLatin1String("uxtheme"),
+ "BeginPanningFeedback");
priv->UpdatePanningFeedback =
- (PtrUpdatePanningFeedback)QLibrary::resolve(QLatin1String("uxtheme"),
- "UpdatePanningFeedback");
+ (PtrUpdatePanningFeedback)QLibrary::resolve(QLatin1String("uxtheme"),
+ "UpdatePanningFeedback");
priv->EndPanningFeedback =
(PtrEndPanningFeedback)QLibrary::resolve(QLatin1String("uxtheme"),
"EndPanningFeedback");
+#endif
}
/*****************************************************************************
@@ -1245,7 +1252,10 @@ void QApplication::beep()
static void alert_widget(QWidget *widget, int duration)
{
-#ifndef Q_OS_WINCE
+#ifdef Q_OS_WINCE
+ Q_UNUSED(widget);
+ Q_UNUSED(duration);
+#else
bool stopFlash = duration < 0;
if (widget && (!widget->isActiveWindow() || stopFlash)) {
@@ -1463,7 +1473,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
// we receive the message for each toplevel window included internal hidden ones,
// but the aboutToQuit signal should be emitted only once.
- QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal();
+ QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
if (endsession && !qAppPriv->aboutToQuitEmitted) {
qAppPriv->aboutToQuitEmitted = true;
int index = QApplication::staticMetaObject.indexOfSignal("aboutToQuit()");
@@ -1650,7 +1660,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
} else {
switch (message) {
case WM_TOUCH:
- result = getQApplicationPrivateInternal()->translateTouchEvent(msg);
+ result = QApplicationPrivate::instance()->translateTouchEvent(msg);
break;
case WM_KEYDOWN: // keyboard event
case WM_SYSKEYDOWN:
@@ -3718,27 +3728,36 @@ bool QETWidget::translateCloseEvent(const MSG &)
bool QETWidget::translateGestureEvent(const MSG &msg)
{
GESTUREINFO gi;
+ memset(&gi, 0, sizeof(GESTUREINFO));
gi.cbSize = sizeof(GESTUREINFO);
- gi.dwFlags = 0;
- gi.ptsLocation.x = 0;
- gi.ptsLocation.y = 0;
- gi.dwID = 0;
- gi.dwInstanceID = 0;
- gi.dwSequenceID = 0;
-
- QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal();
- BOOL bResult = qAppPriv->GetGestureInfo((HANDLE)msg.lParam, &gi);
- const QPoint widgetPos = QPoint(gi.ptsLocation.x, gi.ptsLocation.y);
- QWidget *alienWidget = !internalWinId() ? this : childAt(widgetPos);
- if (alienWidget && alienWidget->internalWinId())
- alienWidget = 0;
- QWidget *widget = alienWidget ? alienWidget : this;
+ QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
+#if defined(Q_WS_WINCE_WM) && defined(QT_WINCE_GESTURES)
+#undef GID_ZOOM
+#define GID_ZOOM 0xf000
+#undef GID_ROTATE
+#define GID_ROTATE 0xf001
+#undef GID_TWOFINGERTAP
+#define GID_TWOFINGERTAP 0xf002
+#undef GID_ROLLOVER
+#define GID_ROLLOVER 0xf003
+#endif
+ BOOL bResult = false;
+ if (qAppPriv->GetGestureInfo)
+ bResult = qAppPriv->GetGestureInfo((HANDLE)msg.lParam, &gi);
- QNativeGestureEvent event;
- event.sequenceId = gi.dwSequenceID;
- event.position = QPoint(gi.ptsLocation.x, gi.ptsLocation.y);
if (bResult) {
+ const QPoint widgetPos = QPoint(gi.ptsLocation.x, gi.ptsLocation.y);
+ QWidget *alienWidget = !internalWinId() ? this : childAt(widgetPos);
+ if (alienWidget && alienWidget->internalWinId())
+ alienWidget = 0;
+ QWidget *widget = alienWidget ? alienWidget : this;
+
+ QNativeGestureEvent event;
+ event.sequenceId = gi.dwSequenceID;
+ event.position = QPoint(gi.ptsLocation.x, gi.ptsLocation.y);
+ event.argument = gi.ullArguments;
+
switch (gi.dwID) {
case GID_BEGIN:
event.gestureType = QNativeGestureEvent::GestureBegin;
@@ -3747,17 +3766,21 @@ bool QETWidget::translateGestureEvent(const MSG &msg)
event.gestureType = QNativeGestureEvent::GestureEnd;
break;
case GID_ZOOM:
- event.gestureType = QNativeGestureEvent::Pinch;
+ event.gestureType = QNativeGestureEvent::Zoom;
break;
case GID_PAN:
event.gestureType = QNativeGestureEvent::Pan;
break;
case GID_ROTATE:
+ event.gestureType = QNativeGestureEvent::Rotate;
+ break;
case GID_TWOFINGERTAP:
case GID_ROLLOVER:
default:
break;
}
+ if (qAppPriv->CloseGestureInfoHandle)
+ qAppPriv->CloseGestureInfoHandle((HANDLE)msg.lParam);
if (event.gestureType != QNativeGestureEvent::None)
qt_sendSpontaneousEvent(widget, &event);
} else {
@@ -3765,7 +3788,6 @@ bool QETWidget::translateGestureEvent(const MSG &msg)
if (dwErr > 0)
qWarning() << "translateGestureEvent: error = " << dwErr;
}
- qAppPriv->CloseGestureInfoHandle((HANDLE)msg.lParam);
return true;
}
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index 40165637f..470b43313 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -78,11 +78,13 @@
#include <private/qcrashhandler_p.h>
#include <private/qcolor_p.h>
#include <private/qcursor_p.h>
+#include <private/qiconloader_p.h>
#include "qstyle.h"
#include "qmetaobject.h"
#include "qtimer.h"
#include "qlibrary.h"
#include <private/qgraphicssystemfactory_p.h>
+#include "qkde_p.h"
#if !defined (QT_NO_TABLET)
extern "C" {
@@ -813,33 +815,6 @@ Q_GUI_EXPORT void qt_x11_apply_settings_in_all_apps()
PropModeReplace, (unsigned char *)stamp.data(), stamp.size());
}
-static int kdeSessionVersion()
-{
- static int kdeVersion = 0;
- if (!kdeVersion)
- kdeVersion = QString::fromLocal8Bit(qgetenv("KDE_SESSION_VERSION")).toInt();
- return kdeVersion;
-}
-
-/*! \internal
- Gets the current KDE 3 or 4 home path
-*/
-QString QApplicationPrivate::kdeHome()
-{
- static QString kdeHomePath;
- if (kdeHomePath.isEmpty()) {
- kdeHomePath = QString::fromLocal8Bit(qgetenv("KDEHOME"));
- if (kdeHomePath.isEmpty()) {
- QDir homeDir(QDir::homePath());
- QString kdeConfDir(QLatin1String("/.kde"));
- if (4 == kdeSessionVersion() && homeDir.exists(QLatin1String(".kde4")))
- kdeConfDir = QLatin1String("/.kde4");
- kdeHomePath = QDir::homePath() + kdeConfDir;
- }
- }
- return kdeHomePath;
-}
-
/*! \internal
apply the settings to the application
*/
@@ -896,28 +871,32 @@ bool QApplicationPrivate::x11_apply_settings()
}
// ### Fix properly for 4.6
- if (!(QApplicationPrivate::app_style && QApplicationPrivate::app_style->inherits("QGtkStyle"))) {
+ bool usingGtkSettings = QApplicationPrivate::app_style && QApplicationPrivate::app_style->inherits("QGtkStyle");
+ if (!usingGtkSettings) {
if (groupCount == QPalette::NColorGroups)
QApplicationPrivate::setSystemPalette(pal);
}
if (!appFont) {
- QFont font(QApplication::font());
- QString fontDescription;
- // Override Qt font if KDE4 settings can be used
- if (4 == kdeSessionVersion()) {
- QSettings kdeSettings(kdeHome() + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat);
- fontDescription = kdeSettings.value(QLatin1String("font")).toString();
- if (fontDescription.isEmpty()) {
- // KDE stores fonts without quotes
- fontDescription = kdeSettings.value(QLatin1String("font")).toStringList().join(QLatin1String(","));
+ // ### Fix properly for 4.6
+ if (!usingGtkSettings) {
+ QFont font(QApplication::font());
+ QString fontDescription;
+ // Override Qt font if KDE4 settings can be used
+ if (X11->desktopVersion == 4) {
+ QSettings kdeSettings(QKde::kdeHome() + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat);
+ fontDescription = kdeSettings.value(QLatin1String("font")).toString();
+ if (fontDescription.isEmpty()) {
+ // KDE stores fonts without quotes
+ fontDescription = kdeSettings.value(QLatin1String("font")).toStringList().join(QLatin1String(","));
+ }
+ }
+ if (fontDescription.isEmpty())
+ fontDescription = settings.value(QLatin1String("font")).toString();
+ if (!fontDescription .isEmpty()) {
+ font.fromString(fontDescription );
+ QApplicationPrivate::setSystemFont(font);
}
- }
- if (fontDescription.isEmpty())
- fontDescription = settings.value(QLatin1String("font")).toString();
- if (!fontDescription .isEmpty()) {
- font.fromString(fontDescription );
- QApplicationPrivate::setSystemFont(font);
}
}
@@ -936,7 +915,6 @@ bool QApplicationPrivate::x11_apply_settings()
// read new QStyle
QString stylename = settings.value(QLatin1String("style")).toString();
-
if (stylename.isEmpty() && QApplicationPrivate::styleOverride.isNull() && X11->use_xrender) {
stylename = x11_desktop_style();
}
@@ -1094,22 +1072,6 @@ static void qt_set_input_encoding()
XFree((char *)data);
}
-// Reads a KDE color setting
-static QColor kdeColor(const QString &key, const QSettings &kdeSettings)
-{
- QVariant variant = kdeSettings.value(key);
- if (variant.isValid()) {
- QStringList values = variant.toStringList();
- if (values.size() == 3) {
- int r = values[0].toInt();
- int g = values[1].toInt();
- int b = values[2].toInt();
- return QColor(r, g, b);
- }
- }
- return QColor();
-}
-
// set font, foreground and background from x11 resources. The
// arguments may override the resource settings.
static void qt_set_x11_resources(const char* font = 0, const char* fg = 0,
@@ -1130,7 +1092,6 @@ static void qt_set_x11_resources(const char* font = 0, const char* fg = 0,
if (QApplication::desktopSettingsAware()) {
// first, read from settings
QApplicationPrivate::x11_apply_settings();
-
// the call to QApplication::style() below creates the system
// palette, which breaks the logic after the RESOURCE_MANAGER
// loop... so I have to save this value to be able to use it later
@@ -1276,9 +1237,10 @@ static void qt_set_x11_resources(const char* font = 0, const char* fg = 0,
QApplicationPrivate::setSystemFont(fnt);
}
+ // QGtkStyle sets it's own system palette
+ bool gtkStyle = QApplicationPrivate::app_style && QApplicationPrivate::app_style->inherits("QGtkStyle");
bool kdeColors = (QApplication::desktopSettingsAware() && X11->desktopEnvironment == DE_KDE);
-
- if (kdeColors || (button || !resBG.isEmpty() || !resFG.isEmpty())) {// set app colors
+ if (!gtkStyle && (kdeColors || (button || !resBG.isEmpty() || !resFG.isEmpty()))) {// set app colors
bool allowX11ColorNames = QColor::allowX11ColorNames();
QColor::setAllowX11ColorNames(true);
@@ -1314,45 +1276,6 @@ static void qt_set_x11_resources(const char* font = 0, const char* fg = 0,
bright_mode = true;
}
- if (kdeColors) {
- const QSettings theKdeSettings(
- QApplicationPrivate::kdeHome()
- + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat);
-
- // Setup KDE palette
- QColor color;
- color = kdeColor(QLatin1String("buttonBackground"), theKdeSettings);
- if (!color.isValid())
- color = kdeColor(QLatin1String("Colors:Button/BackgroundNormal"), theKdeSettings);
- if (color.isValid())
- btn = color;
-
- color = kdeColor(QLatin1String("background"), theKdeSettings);
- if (!color.isValid())
- color = kdeColor(QLatin1String("Colors:Window/BackgroundNormal"), theKdeSettings);
- if (color.isValid())
- bg = color;
-
- color = kdeColor(QLatin1String("foreground"), theKdeSettings);
- if (!color.isValid())
- color = kdeColor(QLatin1String("Colors:View/ForegroundNormal"), theKdeSettings);
- if (color.isValid()) {
- fg = color;
- }
-
- color = kdeColor(QLatin1String("windowForeground"), theKdeSettings);
- if (!color.isValid())
- color = kdeColor(QLatin1String("Colors:Window/ForegroundNormal"), theKdeSettings);
- if (color.isValid())
- wfg = color;
-
- color = kdeColor(QLatin1String("windowBackground"), theKdeSettings);
- if (!color.isValid())
- color = kdeColor(QLatin1String("Colors:View/BackgroundNormal"), theKdeSettings);
- if (color.isValid())
- base = color;
- }
-
QPalette pal(fg, btn, btn.lighter(125), btn.darker(130), btn.darker(120), wfg.isValid() ? wfg : fg, Qt::white, base, bg);
QColor disabled((fg.red() + btn.red()) / 2,
(fg.green() + btn.green())/ 2,
@@ -1365,50 +1288,6 @@ static void qt_set_x11_resources(const char* font = 0, const char* fg = 0,
highlight = QColor(selectBackground);
highlightText = QColor(selectForeground);
}
- // Use KDE3 or KDE4 color settings if present
- if (kdeColors) {
- const QSettings theKdeSettings(
- QApplicationPrivate::kdeHome()
- + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat);
-
- QColor color = kdeColor(QLatin1String("selectBackground"), theKdeSettings);
- if (!color.isValid())
- color = kdeColor(QLatin1String("Colors:Selection/BackgroundNormal"), theKdeSettings);
- if (color.isValid())
- highlight = color;
-
- color = kdeColor(QLatin1String("selectForeground"), theKdeSettings);
- if (!color.isValid())
- color = kdeColor(QLatin1String("Colors:Selection/ForegroundNormal"), theKdeSettings);
- if (color.isValid())
- highlightText = color;
-
- color = kdeColor(QLatin1String("alternateBackground"), theKdeSettings);
- if (!color.isValid())
- color = kdeColor(QLatin1String("Colors:View/BackgroundAlternate"), theKdeSettings);
- if (color.isValid())
- pal.setColor(QPalette::AlternateBase, color);
- else
- pal.setBrush(QPalette::AlternateBase, pal.base().color().darker(110));
-
- color = kdeColor(QLatin1String("buttonForeground"), theKdeSettings);
- if (!color.isValid())
- color = kdeColor(QLatin1String("Colors:Button/ForegroundNormal"), theKdeSettings);
- if (color.isValid())
- pal.setColor(QPalette::ButtonText, color);
-
- color = kdeColor(QLatin1String("linkColor"), theKdeSettings);
- if (!color.isValid())
- color = kdeColor(QLatin1String("Colors:View/ForegroundLink"), theKdeSettings);
- if (color.isValid())
- pal.setColor(QPalette::Link, color);
-
- color = kdeColor(QLatin1String("visitedLinkColor"), theKdeSettings);
- if (!color.isValid())
- color = kdeColor(QLatin1String("Colors:View/ForegroundVisited"), theKdeSettings);
- if (color.isValid())
- pal.setColor(QPalette::LinkVisited, color);
- }
if (highlight.isValid() && highlightText.isValid()) {
pal.setColor(QPalette::Highlight, highlight);
@@ -1431,10 +1310,9 @@ static void qt_set_x11_resources(const char* font = 0, const char* fg = 0,
pal.setColor(QPalette::Disabled, QPalette::Highlight, Qt::darkBlue);
}
- // QGtkStyle sets it's own system palette
- if (!(QApplicationPrivate::app_style && QApplicationPrivate::app_style->inherits("QGtkStyle"))) {
- QApplicationPrivate::setSystemPalette(pal);
- }
+ if (kdeColors)
+ pal = QKde::kdePalette().resolve(pal);
+ QApplicationPrivate::setSystemPalette(pal);
QColor::setAllowX11ColorNames(allowX11ColorNames);
}
@@ -1454,6 +1332,8 @@ static void qt_set_x11_resources(const char* font = 0, const char* fg = 0,
QApplication::setEffectEnabled(Qt::UI_AnimateToolBox,
effects.contains(QLatin1String("animatetoolbox")));
}
+
+ QIconLoader::instance()->updateSystemTheme();
}
@@ -2315,6 +2195,7 @@ void qt_init(QApplicationPrivate *priv, int,
X11->compositingManagerRunning = XGetSelectionOwner(X11->display,
ATOM(_NET_WM_CM_S0));
X11->desktopEnvironment = DE_UNKNOWN;
+ X11->desktopVersion = 0;
// See if the current window manager is using the freedesktop.org spec to give its name
Window windowManagerWindow = XNone;
@@ -2390,6 +2271,9 @@ void qt_init(QApplicationPrivate *priv, int,
XFree((char *)data);
}
+ if (X11->desktopEnvironment == DE_KDE)
+ X11->desktopVersion = QString::fromLocal8Bit(qgetenv("KDE_SESSION_VERSION")).toInt();
+
qt_set_input_encoding();
qt_set_x11_resources(appFont, appFGCol, appBGCol, appBTNCol);
@@ -2657,44 +2541,30 @@ void qt_init(QApplicationPrivate *priv, int,
QString QApplicationPrivate::x11_desktop_style()
{
QString stylename;
- QStringList availableStyles = QStyleFactory::keys();
- // Override Qt style if KDE4 settings can be used
- if (4 == kdeSessionVersion()) {
- QSettings kdeSettings(kdeHome() + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat);
- QString kde4Style = kdeSettings.value(QLatin1String("widgetStyle"),
- QLatin1String("Oxygen")).toString();
- foreach (const QString &style, availableStyles) {
- if (style.toLower() == kde4Style.toLower())
- stylename = kde4Style;
- }
- // Set QGtkStyle for GNOME
- } else if (X11->desktopEnvironment == DE_GNOME) {
+ switch(X11->desktopEnvironment) {
+ case DE_KDE:
+ stylename = QKde::kdeStyle();
+ break;
+ case DE_GNOME: {
+ QStringList availableStyles = QStyleFactory::keys();
+ // Set QGtkStyle for GNOME if available
QString gtkStyleKey = QString::fromLatin1("GTK+");
- if (availableStyles.contains(gtkStyleKey))
+ if (availableStyles.contains(gtkStyleKey)) {
stylename = gtkStyleKey;
- }
-
- if (stylename.isEmpty()) {
- switch(X11->desktopEnvironment) {
- case DE_KDE:
- if (X11->use_xrender)
- stylename = QLatin1String("plastique");
- else
- stylename = QLatin1String("windows");
- break;
- case DE_GNOME:
- if (X11->use_xrender)
- stylename = QLatin1String("cleanlooks");
- else
- stylename = QLatin1String("windows");
- break;
- case DE_CDE:
- stylename = QLatin1String("cde");
- break;
- default:
- // Don't do anything
break;
}
+ if (X11->use_xrender)
+ stylename = QLatin1String("cleanlooks");
+ else
+ stylename = QLatin1String("windows");
+ break;
+ }
+ case DE_CDE:
+ stylename = QLatin1String("cde");
+ break;
+ default:
+ // Don't do anything
+ break;
}
return stylename;
}
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 1d352cb3a..8c6f39425 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -50,6 +50,7 @@
#include <private/qdnd_p.h>
#include <private/qmacinputcontext_p.h>
#include <private/qmultitouch_mac_p.h>
+#include <private/qevent_p.h>
#include <qscrollarea.h>
#include <qhash.h>
@@ -868,32 +869,65 @@ extern "C" {
- (void)magnifyWithEvent:(NSEvent *)event;
{
- Q_UNUSED(event);
-// qDebug() << "magnifyWithEvent";
+ if (!QApplicationPrivate::tryModalHelper(qwidget, 0))
+ return;
+
+ QNativeGestureEvent qNGEvent;
+ qNGEvent.gestureType = QNativeGestureEvent::Zoom;
+ NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
+ qNGEvent.position = flipPoint(p).toPoint();
+ qNGEvent.percentage = [event magnification];
+ qApp->sendEvent(qwidget, &qNGEvent);
}
- (void)rotateWithEvent:(NSEvent *)event;
{
- Q_UNUSED(event);
-// qDebug() << "rotateWithEvent";
+ if (!QApplicationPrivate::tryModalHelper(qwidget, 0))
+ return;
+
+ QNativeGestureEvent qNGEvent;
+ qNGEvent.gestureType = QNativeGestureEvent::Rotate;
+ NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
+ qNGEvent.position = flipPoint(p).toPoint();
+ qNGEvent.percentage = [event rotation];
+ qApp->sendEvent(qwidget, &qNGEvent);
}
- (void)swipeWithEvent:(NSEvent *)event;
{
- Q_UNUSED(event);
-// qDebug() << "swipeWithEvent";
+ if (!QApplicationPrivate::tryModalHelper(qwidget, 0))
+ return;
+
+ QNativeGestureEvent qNGEvent;
+ qNGEvent.gestureType = QNativeGestureEvent::Swipe;
+ NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
+ qNGEvent.position = flipPoint(p).toPoint();
+ qNGEvent.direction = QSize(-[event deltaX], -[event deltaY]);
+ qApp->sendEvent(qwidget, &qNGEvent);
}
- (void)beginGestureWithEvent:(NSEvent *)event;
{
- Q_UNUSED(event);
-// qDebug() << "beginGestureWithEvent";
+ if (!QApplicationPrivate::tryModalHelper(qwidget, 0))
+ return;
+
+ QNativeGestureEvent qNGEvent;
+ qNGEvent.gestureType = QNativeGestureEvent::GestureBegin;
+ NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
+ qNGEvent.position = flipPoint(p).toPoint();
+ qApp->sendEvent(qwidget, &qNGEvent);
}
- (void)endGestureWithEvent:(NSEvent *)event;
{
- Q_UNUSED(event);
-// qDebug() << "endGestureWithEvent";
+ if (!QApplicationPrivate::tryModalHelper(qwidget, 0))
+ return;
+
+ QNativeGestureEvent qNGEvent;
+ qNGEvent.gestureType = QNativeGestureEvent::GestureEnd;
+ NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
+ qNGEvent.position = flipPoint(p).toPoint();
+ qApp->sendEvent(qwidget, &qNGEvent);
}
#endif // MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
diff --git a/src/gui/kernel/qdesktopwidget_x11.cpp b/src/gui/kernel/qdesktopwidget_x11.cpp
index 1555fc034..8b0c215ce 100644
--- a/src/gui/kernel/qdesktopwidget_x11.cpp
+++ b/src/gui/kernel/qdesktopwidget_x11.cpp
@@ -285,26 +285,36 @@ const QRect QDesktopWidget::availableGeometry(int screen) const
if (d->workareas[screen].isValid())
return d->workareas[screen];
- if ((d->screenCount == 1 || !isVirtualDesktop())
- && X11->isSupportedByWM(ATOM(_NET_WORKAREA))) {
+ if (X11->isSupportedByWM(ATOM(_NET_WORKAREA))) {
+ int x11Screen = isVirtualDesktop() ? DefaultScreen(X11->display) : screen;
+
Atom ret;
int format, e;
unsigned char *data = 0;
unsigned long nitems, after;
e = XGetWindowProperty(X11->display,
- QX11Info::appRootWindow(screen),
- ATOM(_NET_WORKAREA), 0, 4, False, XA_CARDINAL,
- &ret, &format, &nitems, &after, &data);
+ QX11Info::appRootWindow(x11Screen),
+ ATOM(_NET_WORKAREA), 0, 4, False, XA_CARDINAL,
+ &ret, &format, &nitems, &after, &data);
+ QRect workArea;
if (e == Success && ret == XA_CARDINAL &&
format == 32 && nitems == 4) {
long *workarea = (long *) data;
- d->workareas[screen].setRect(workarea[0], workarea[1],
- workarea[2], workarea[3]);
+ workArea = QRect(workarea[0], workarea[1], workarea[2], workarea[3]);
} else {
- d->workareas[screen] = screenGeometry(screen);
+ workArea = screenGeometry(screen);
+ }
+
+ if (isVirtualDesktop()) {
+ // intersect the workarea (which spawns all Xinerama screens) with the rect for the
+ // requested screen
+ workArea &= screenGeometry(screen);
}
+
+ d->workareas[screen] = workArea;
+
if (data)
XFree(data);
} else {
diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h
index 92c4fc1c0..2ff672bb1 100644
--- a/src/gui/kernel/qevent_p.h
+++ b/src/gui/kernel/qevent_p.h
@@ -127,21 +127,26 @@ public:
GestureBegin,
GestureEnd,
Pan,
- Pinch
+ Zoom,
+ Rotate,
+ Swipe
};
QNativeGestureEvent()
- : QEvent(QEvent::NativeGesture), gestureType(None)
+ : QEvent(QEvent::NativeGesture), gestureType(None), percentage(0)
#ifdef Q_WS_WIN
- , sequenceId(0)
+ , sequenceId(0), argument(0)
#endif
{
}
Type gestureType;
-#ifdef Q_WS_WIN
+ float percentage;
QPoint position;
+ QSize direction;
+#ifdef Q_WS_WIN
ulong sequenceId;
+ quint64 argument;
#endif
};
diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp
index 32ac4f8ca..672fc1c99 100644
--- a/src/gui/kernel/qgesture.cpp
+++ b/src/gui/kernel/qgesture.cpp
@@ -97,7 +97,7 @@ private:
This is a base class, to create a custom gesture type, you should subclass
it and implement its pure virtual functions.
- \sa QPanGesture, QTapAndHoldGesture
+ \sa QPanGesture
*/
/*! \fn bool QGesture::filterEvent(QEvent *event)
@@ -197,11 +197,44 @@ Qt::GestureState QGesture::state() const
}
/*!
- Sets this gesture's recognition state to \a state.
+ Sets this gesture's recognition state to \a state and emits appropriate
+ signals.
+
+ This functions emits the signals according to the old state and the new
+ \a state, and it should be called after all the internal properties have been
+ initialized.
+
+ \sa started(), triggered(), finished(), cancelled()
*/
-void QGesture::setState(Qt::GestureState state)
+void QGesture::updateState(Qt::GestureState state)
{
- d_func()->state = state;
+ Q_D(QGesture);
+ if (d->state == state) {
+ if (state == Qt::GestureUpdated)
+ emit triggered();
+ return;
+ }
+ const Qt::GestureState oldState = d->state;
+ d->state = state;
+ if (state != Qt::NoGesture && oldState > state) {
+ // comparing the state as ints: state should only be changed from
+ // started to (optionally) updated and to finished.
+ qWarning("QGesture::updateState: incorrect new state");
+ return;
+ }
+ if (oldState == Qt::NoGesture)
+ emit started();
+ if (state == Qt::GestureUpdated)
+ emit triggered();
+ else if (state == Qt::GestureFinished)
+ emit finished();
+ else if (state == Qt::NoGesture)
+ emit cancelled();
+
+ if (state == Qt::GestureFinished) {
+ // gesture is finished, so we reset the internal state.
+ d->state = Qt::NoGesture;
+ }
}
/*!
@@ -238,14 +271,13 @@ QGraphicsItem* QGesture::graphicsItem() const
Resets the internal state of the gesture. This function might be called by
the filterEvent() implementation in a derived class, or by the user to
- cancel a gesture. The base class implementation emits the cancelled()
- signal if the state() of the gesture wasn't empty.
+ cancel a gesture. The base class implementation calls
+ updateState(Qt::NoGesture) which emits the cancelled()
+ signal if the state() of the gesture indicated it was active.
*/
void QGesture::reset()
{
- if (state() != Qt::NoGesture)
- emit cancelled();
- setState(Qt::NoGesture);
+ updateState(Qt::NoGesture);
}
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h
index 0735160c8..839fdcad1 100644
--- a/src/gui/kernel/qgesture.h
+++ b/src/gui/kernel/qgesture.h
@@ -73,15 +73,14 @@ public:
void setGraphicsItem(QGraphicsItem *);
QGraphicsItem *graphicsItem() const;
- virtual void reset();
-
Qt::GestureState state() const;
protected:
QGesture(QGesturePrivate &dd, QObject *parent);
bool eventFilter(QObject*, QEvent*);
- void setState(Qt::GestureState state);
+ virtual void reset();
+ void updateState(Qt::GestureState state);
Q_SIGNALS:
void started();
diff --git a/src/gui/kernel/qkde.cpp b/src/gui/kernel/qkde.cpp
new file mode 100644
index 000000000..96ff21e85
--- /dev/null
+++ b/src/gui/kernel/qkde.cpp
@@ -0,0 +1,159 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qkde_p.h"
+#include <QtCore/QLibrary>
+#include <QtCore/QDir>
+#include <QtCore/qdebug.h>
+#include <QtCore/QSettings>
+#include "QtGui/qstylefactory.h"
+#include "qt_x11_p.h"
+
+#if defined(Q_WS_X11)
+
+QT_BEGIN_NAMESPACE
+
+/*! \internal
+Gets the current KDE home path
+like "/home/troll/.kde"
+*/
+QString QKde::kdeHome()
+{
+ static QString kdeHomePath;
+ if (kdeHomePath.isEmpty()) {
+ kdeHomePath = QString::fromLocal8Bit(qgetenv("KDEHOME"));
+ if (kdeHomePath.isEmpty()) {
+ QDir homeDir(QDir::homePath());
+ QString kdeConfDir(QLatin1String("/.kde"));
+ if (4 == X11->desktopVersion && homeDir.exists(QLatin1String(".kde4")))
+ kdeConfDir = QLatin1String("/.kde4");
+ kdeHomePath = QDir::homePath() + kdeConfDir;
+ }
+ }
+ return kdeHomePath;
+}
+
+/*!\internal
+ Reads the color from the config, and store it in the palette with the given color role if found
+ */
+static bool kdeColor(QPalette *pal, QPalette::ColorRole role, const QSettings &kdeSettings, const QString &kde4Key, const QString &kde3Key = QString())
+{
+ QVariant variant = kdeSettings.value(kde4Key);
+ if (!variant.isValid())
+ QVariant variant = kdeSettings.value(kde3Key);
+ if (variant.isValid()) {
+ QStringList values = variant.toStringList();
+ if (values.size() == 3) {
+ int r = values[0].toInt();
+ int g = values[1].toInt();
+ int b = values[2].toInt();
+ pal->setBrush(role, QColor(r, g, b));
+ return true;
+ }
+ }
+ return false;
+}
+
+
+/*!\internal
+ Returns the KDE palette
+*/
+QPalette QKde::kdePalette()
+{
+ const QSettings theKdeSettings(QKde::kdeHome() +
+ QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat);
+ QPalette pal;
+
+ // Setup KDE palette
+ kdeColor(&pal, QPalette::Button, theKdeSettings, QLatin1String("Colors:Button/BackgroundNormal"), QLatin1String("buttonBackground"));
+ kdeColor(&pal, QPalette::Window, theKdeSettings, QLatin1String("Colors:Window/BackgroundNormal"), QLatin1String("background"));
+ kdeColor(&pal, QPalette::Text, theKdeSettings, QLatin1String("Colors:View/ForegroundNormal"), QLatin1String("foreground"));
+ kdeColor(&pal, QPalette::WindowText, theKdeSettings, QLatin1String("Colors:Window/ForegroundNormal"), QLatin1String("windowForeground"));
+ kdeColor(&pal, QPalette::Base, theKdeSettings, QLatin1String("Colors:View/BackgroundNormal"), QLatin1String("windowBackground"));
+ kdeColor(&pal, QPalette::Highlight, theKdeSettings, QLatin1String("Colors:Selection/BackgroundNormal"), QLatin1String("selectBackground"));
+ kdeColor(&pal, QPalette::HighlightedText, theKdeSettings, QLatin1String("Colors:Selection/ForegroundNormal"), QLatin1String("selectForeground"));
+ kdeColor(&pal, QPalette::AlternateBase, theKdeSettings, QLatin1String("Colors:View/BackgroundAlternate"), QLatin1String("alternateBackground"));
+ kdeColor(&pal, QPalette::ButtonText, theKdeSettings, QLatin1String("Colors:Button/ForegroundNormal"), QLatin1String("buttonForeground"));
+ kdeColor(&pal, QPalette::Link, theKdeSettings, QLatin1String("Colors:View/ForegroundLink"), QLatin1String("linkColor"));
+ kdeColor(&pal, QPalette::LinkVisited, theKdeSettings, QLatin1String("Colors:View/ForegroundVisited"), QLatin1String("visitedLinkColor"));
+ //## TODO tooltip color
+
+ return pal;
+}
+
+/*!\internal
+ Returns the name of the QStyle to use.
+ (read from the kde config if needed)
+*/
+QString QKde::kdeStyle()
+{
+ if (X11->desktopVersion >= 4) {
+ QSettings kdeSettings(QKde::kdeHome() + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat);
+ QString style = kdeSettings.value(QLatin1String("widgetStyle"), QLatin1String("Oxygen")).toString();
+
+ QStringList availableStyles = QStyleFactory::keys();
+ if(availableStyles.contains(style, Qt::CaseInsensitive))
+ return style;
+ }
+
+ if (X11->use_xrender)
+ return QLatin1String("plastique");
+ else
+ return QLatin1String("windows");
+
+ return QString();
+}
+
+/*!\internal
+ placeholder to load icon from kde.
+ to be implemented
+ */
+QIcon QKde::kdeIcon(const QString &name)
+{
+ //###todo
+ return QIcon();
+}
+
+QT_END_NAMESPACE
+
+#endif //Q_WS_X11
+
diff --git a/src/gui/kernel/qkde_p.h b/src/gui/kernel/qkde_p.h
new file mode 100644
index 000000000..ac760bd05
--- /dev/null
+++ b/src/gui/kernel/qkde_p.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QKDE_H
+#define QKDE_H
+
+#include <QtCore/qglobal.h>
+#include <QtGui/QPalette>
+#include <QtGui/QIcon>
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+#if defined(Q_WS_X11)
+
+
+QT_BEGIN_NAMESPACE
+
+// This namespace contains helper function to help KDE integration
+namespace QKde {
+ QString kdeHome();
+ QString kdeStyle();
+ QPalette kdePalette();
+ QIcon kdeIcon(const QString &name);
+}
+
+
+QT_END_NAMESPACE
+
+#endif // Q_WS_X11
+#endif // QKDE_H
diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp
index 475341627..b4c37876d 100644
--- a/src/gui/kernel/qstandardgestures.cpp
+++ b/src/gui/kernel/qstandardgestures.cpp
@@ -46,11 +46,12 @@
#include <qscrollbar.h>
#include <private/qapplication_p.h>
#include <private/qevent_p.h>
+#include <private/qwidget_p.h>
QT_BEGIN_NAMESPACE
#ifdef Q_WS_WIN
-QApplicationPrivate* getQApplicationPrivateInternal();
+QWidgetPrivate *qt_widget_private(QWidget *widget);
#endif
/*!
@@ -71,32 +72,38 @@ QApplicationPrivate* getQApplicationPrivateInternal();
QPanGesture::QPanGesture(QWidget *parent)
: QGesture(*new QPanGesturePrivate, parent)
{
-#ifdef Q_WS_WIN
if (parent) {
- QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal();
+ QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
qAppPriv->widgetGestures[parent].pan = this;
- }
+#ifdef Q_WS_WIN
+ qt_widget_private(parent)->winSetupGestures();
#endif
+ }
}
/*! \internal */
bool QPanGesture::event(QEvent *event)
{
-#ifdef Q_WS_WIN
- QApplicationPrivate* getQApplicationPrivateInternal();
switch (event->type()) {
case QEvent::ParentAboutToChange:
- if (QWidget *w = qobject_cast<QWidget*>(parent()))
- getQApplicationPrivateInternal()->widgetGestures[w].pan = 0;
+ if (QWidget *w = qobject_cast<QWidget*>(parent())) {
+ QApplicationPrivate::instance()->widgetGestures[w].pan = 0;
+#ifdef Q_WS_WIN
+ qt_widget_private(w)->winSetupGestures();
+#endif
+ }
break;
case QEvent::ParentChange:
- if (QWidget *w = qobject_cast<QWidget*>(parent()))
- getQApplicationPrivateInternal()->widgetGestures[w].pan = this;
+ if (QWidget *w = qobject_cast<QWidget*>(parent())) {
+ QApplicationPrivate::instance()->widgetGestures[w].pan = this;
+#ifdef Q_WS_WIN
+ qt_widget_private(w)->winSetupGestures();
+#endif
+ }
break;
default:
break;
}
-#endif
#if defined(Q_OS_MAC) && !defined(QT_MAC_USE_COCOA)
Q_D(QPanGesture);
@@ -106,9 +113,7 @@ bool QPanGesture::event(QEvent *event)
killTimer(d->panFinishedTimer);
d->panFinishedTimer = 0;
d->lastOffset = QSize(0, 0);
- setState(Qt::GestureFinished);
- emit triggered();
- setState(Qt::NoGesture);
+ updateState(Qt::GestureFinished);
}
}
#endif
@@ -119,38 +124,36 @@ bool QPanGesture::event(QEvent *event)
bool QPanGesture::eventFilter(QObject *receiver, QEvent *event)
{
#ifdef Q_WS_WIN
+ Q_D(QPanGesture);
if (receiver->isWidgetType() && event->type() == QEvent::NativeGesture) {
QNativeGestureEvent *ev = static_cast<QNativeGestureEvent*>(event);
- QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal();
+ QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
QApplicationPrivate::WidgetStandardGesturesMap::iterator it;
it = qAppPriv->widgetGestures.find(static_cast<QWidget*>(receiver));
if (it == qAppPriv->widgetGestures.end())
return false;
- QPanGesture *gesture = it.value().pan;
- if (!gesture)
+ if (this != it.value().pan)
return false;
- Qt::GestureState nextState = state();
+ Qt::GestureState nextState = Qt::NoGesture;
switch(ev->gestureType) {
case QNativeGestureEvent::GestureBegin:
// next we might receive the first gesture update event, so we
// prepare for it.
- setState(Qt::GestureStarted);
+ d->state = Qt::NoGesture;
return false;
case QNativeGestureEvent::Pan:
nextState = Qt::GestureUpdated;
+ event->accept();
break;
case QNativeGestureEvent::GestureEnd:
- if (state() != QNativeGestureEvent::Pan)
+ if (state() == Qt::NoGesture)
return false; // some other gesture has ended
- setState(Qt::GestureFinished);
nextState = Qt::GestureFinished;
break;
default:
return false;
}
- QPanGesturePrivate *d = gesture->d_func();
- if (state() == Qt::GestureStarted) {
- d->lastPosition = ev->position;
+ if (state() == Qt::NoGesture) {
d->lastOffset = d->totalOffset = QSize();
} else {
d->lastOffset = QSize(ev->position.x() - d->lastPosition.x(),
@@ -158,14 +161,7 @@ bool QPanGesture::eventFilter(QObject *receiver, QEvent *event)
d->totalOffset += d->lastOffset;
}
d->lastPosition = ev->position;
-
- if (state() == Qt::GestureStarted)
- emit gesture->started();
- emit gesture->triggered();
- if (state() == Qt::GestureFinished)
- emit gesture->finished();
- event->accept();
- gesture->setState(nextState);
+ updateState(nextState);
return true;
}
#endif
@@ -185,7 +181,6 @@ bool QPanGesture::filterEvent(QEvent *event)
d->lastOffset = d->totalOffset = QSize();
} else if (event->type() == QEvent::TouchEnd) {
if (state() != Qt::NoGesture) {
- setState(Qt::GestureFinished);
if (!ev->touchPoints().isEmpty()) {
QTouchEvent::TouchPoint p = ev->touchPoints().at(0);
const QPoint pos = p.pos().toPoint();
@@ -194,10 +189,8 @@ bool QPanGesture::filterEvent(QEvent *event)
d->lastOffset = QSize(pos.x() - lastPos.x(), pos.y() - lastPos.y());
d->totalOffset = QSize(pos.x() - startPos.x(), pos.y() - startPos.y());
}
- emit triggered();
- emit finished();
+ updateState(Qt::GestureFinished);
}
- setState(Qt::NoGesture);
reset();
} else if (event->type() == QEvent::TouchUpdate) {
QTouchEvent::TouchPoint p = ev->touchPoints().at(0);
@@ -208,11 +201,7 @@ bool QPanGesture::filterEvent(QEvent *event)
d->totalOffset = QSize(pos.x() - startPos.x(), pos.y() - startPos.y());
if (d->totalOffset.width() > 10 || d->totalOffset.height() > 10 ||
d->totalOffset.width() < -10 || d->totalOffset.height() < -10) {
- if (state() == Qt::NoGesture)
- setState(Qt::GestureStarted);
- else
- setState(Qt::GestureUpdated);
- emit triggered();
+ updateState(Qt::GestureUpdated);
}
}
#ifdef Q_OS_MAC
@@ -231,16 +220,14 @@ bool QPanGesture::filterEvent(QEvent *event)
d->lastOffset = wev->orientation() == Qt::Horizontal ? QSize(offset, 0) : QSize(0, offset);
if (state() == Qt::NoGesture) {
- setState(Qt::GestureStarted);
d->totalOffset = d->lastOffset;
} else {
- setState(Qt::GestureUpdated);
d->totalOffset += d->lastOffset;
}
killTimer(d->panFinishedTimer);
d->panFinishedTimer = startTimer(200);
- emit triggered();
+ updateState(Qt::GestureUpdated);
#endif
return true;
}
@@ -260,6 +247,7 @@ void QPanGesture::reset()
d->panFinishedTimer = 0;
}
#endif
+ QGesture::reset();
}
/*!
@@ -285,6 +273,210 @@ QSize QPanGesture::lastOffset() const
return d->lastOffset;
}
+
+/*!
+ \class QPinchGesture
+ \since 4.6
+
+ \brief The QPinchGesture class represents a Pinch gesture,
+ providing additional information related to zooming and/or rotation.
+*/
+
+/*!
+ Creates a new Pinch gesture handler object and marks it as a child of \a
+ parent.
+
+ On some platform like Windows it's necessary to provide a non-null widget
+ as \a parent to get native gesture support.
+*/
+QPinchGesture::QPinchGesture(QWidget *parent)
+ : QGesture(*new QPinchGesturePrivate, parent)
+{
+ if (parent) {
+ QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
+ qAppPriv->widgetGestures[parent].pinch = this;
+#ifdef Q_WS_WIN
+ qt_widget_private(parent)->winSetupGestures();
+#endif
+ }
+}
+
+/*! \internal */
+bool QPinchGesture::event(QEvent *event)
+{
+ switch (event->type()) {
+ case QEvent::ParentAboutToChange:
+ if (QWidget *w = qobject_cast<QWidget*>(parent())) {
+ QApplicationPrivate::instance()->widgetGestures[w].pinch = 0;
+#ifdef Q_WS_WIN
+ qt_widget_private(w)->winSetupGestures();
+#endif
+ }
+ break;
+ case QEvent::ParentChange:
+ if (QWidget *w = qobject_cast<QWidget*>(parent())) {
+ QApplicationPrivate::instance()->widgetGestures[w].pinch = this;
+#ifdef Q_WS_WIN
+ qt_widget_private(w)->winSetupGestures();
+#endif
+ }
+ break;
+ default:
+ break;
+ }
+ return QObject::event(event);
+}
+
+bool QPinchGesture::eventFilter(QObject *receiver, QEvent *event)
+{
+#ifdef Q_WS_WIN
+ Q_D(QPinchGesture);
+ if (receiver->isWidgetType() && event->type() == QEvent::NativeGesture) {
+ QNativeGestureEvent *ev = static_cast<QNativeGestureEvent*>(event);
+ QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
+ QApplicationPrivate::WidgetStandardGesturesMap::iterator it;
+ it = qAppPriv->widgetGestures.find(static_cast<QWidget*>(receiver));
+ if (it == qAppPriv->widgetGestures.end())
+ return false;
+ if (this != it.value().pinch)
+ return false;
+ Qt::GestureState nextState = Qt::NoGesture;
+ switch(ev->gestureType) {
+ case QNativeGestureEvent::GestureBegin:
+ // next we might receive the first gesture update event, so we
+ // prepare for it.
+ d->state = Qt::NoGesture;
+ d->scaleFactor = d->lastScaleFactor = 1;
+ d->rotationAngle = d->lastRotationAngle = 0;
+ d->startCenterPoint = d->centerPoint = d->lastCenterPoint = QPoint();
+ d->initialDistance = 0;
+ return false;
+ case QNativeGestureEvent::Rotate:
+ d->lastRotationAngle = d->rotationAngle;
+ d->rotationAngle = -1 * GID_ROTATE_ANGLE_FROM_ARGUMENT(ev->argument);
+ nextState = Qt::GestureUpdated;
+ event->accept();
+ break;
+ case QNativeGestureEvent::Zoom:
+ if (d->initialDistance != 0) {
+ d->lastScaleFactor = d->scaleFactor;
+ int distance = int(qint64(ev->argument));
+ d->scaleFactor = (qreal) distance / d->initialDistance;
+ } else {
+ d->initialDistance = int(qint64(ev->argument));
+ }
+ nextState = Qt::GestureUpdated;
+ event->accept();
+ break;
+ case QNativeGestureEvent::GestureEnd:
+ if (state() == Qt::NoGesture)
+ return false; // some other gesture has ended
+ nextState = Qt::GestureFinished;
+ break;
+ default:
+ return false;
+ }
+ if (d->startCenterPoint.isNull())
+ d->startCenterPoint = d->centerPoint;
+ d->lastCenterPoint = d->centerPoint;
+ d->centerPoint = static_cast<QWidget*>(receiver)->mapFromGlobal(ev->position);
+ updateState(nextState);
+ return true;
+ }
+#endif
+ return QGesture::eventFilter(receiver, event);
+}
+
+/*! \internal */
+bool QPinchGesture::filterEvent(QEvent *event)
+{
+ Q_UNUSED(event);
+ return false;
+}
+
+/*! \internal */
+void QPinchGesture::reset()
+{
+ Q_D(QPinchGesture);
+ d->scaleFactor = d->lastScaleFactor = 0;
+ d->rotationAngle = d->lastRotationAngle = 0;
+ d->startCenterPoint = d->centerPoint = d->lastCenterPoint = QPoint();
+ QGesture::reset();
+}
+
+/*!
+ \property QPinchGesture::scaleFactor
+
+ Specifies a scale factor of the pinch gesture.
+*/
+qreal QPinchGesture::scaleFactor() const
+{
+ return d_func()->scaleFactor;
+}
+
+/*!
+ \property QPinchGesture::lastScaleFactor
+
+ Specifies a previous scale factor of the pinch gesture.
+*/
+qreal QPinchGesture::lastScaleFactor() const
+{
+ return d_func()->lastScaleFactor;
+}
+
+/*!
+ \property QPinchGesture::rotationAngle
+
+ Specifies a rotation angle of the gesture.
+*/
+qreal QPinchGesture::rotationAngle() const
+{
+ return d_func()->rotationAngle;
+}
+
+/*!
+ \property QPinchGesture::lastRotationAngle
+
+ Specifies a previous rotation angle of the gesture.
+*/
+qreal QPinchGesture::lastRotationAngle() const
+{
+ return d_func()->lastRotationAngle;
+}
+
+/*!
+ \property QPinchGesture::centerPoint
+
+ Specifies a center point of the gesture. The point can be used as a center
+ point that the object is rotated around.
+*/
+QPoint QPinchGesture::centerPoint() const
+{
+ return d_func()->centerPoint;
+}
+
+/*!
+ \property QPinchGesture::lastCenterPoint
+
+ Specifies a previous center point of the gesture.
+*/
+QPoint QPinchGesture::lastCenterPoint() const
+{
+ return d_func()->lastCenterPoint;
+}
+
+/*!
+ \property QPinchGesture::startCenterPoint
+
+ Specifies an initial center point of the gesture. Difference between the
+ startCenterPoint and the centerPoint is the distance at which pinching
+ fingers has shifted.
+*/
+QPoint QPinchGesture::startCenterPoint() const
+{
+ return d_func()->startCenterPoint;
+}
+
QT_END_NAMESPACE
#include "moc_qstandardgestures.cpp"
diff --git a/src/gui/kernel/qstandardgestures.h b/src/gui/kernel/qstandardgestures.h
index c734fbafe..adee74074 100644
--- a/src/gui/kernel/qstandardgestures.h
+++ b/src/gui/kernel/qstandardgestures.h
@@ -66,11 +66,52 @@ public:
QPanGesture(QWidget *parent);
bool filterEvent(QEvent *event);
- void reset();
QSize totalOffset() const;
QSize lastOffset() const;
+protected:
+ void reset();
+
+private:
+ bool event(QEvent *event);
+ bool eventFilter(QObject *receiver, QEvent *event);
+
+ friend class QWidget;
+};
+
+class QPinchGesturePrivate;
+class Q_GUI_EXPORT QPinchGesture : public QGesture
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QPinchGesture)
+
+ Q_PROPERTY(qreal scaleFactor READ scaleFactor)
+ Q_PROPERTY(qreal lastScaleFactor READ lastScaleFactor)
+
+ Q_PROPERTY(qreal rotationAngle READ rotationAngle)
+ Q_PROPERTY(qreal lastRotationAngle READ lastRotationAngle)
+
+ Q_PROPERTY(QPoint startCenterPoint READ startCenterPoint)
+ Q_PROPERTY(QPoint lastCenterPoint READ lastCenterPoint)
+ Q_PROPERTY(QPoint centerPoint READ centerPoint)
+
+public:
+ QPinchGesture(QWidget *parent);
+
+ bool filterEvent(QEvent *event);
+ void reset();
+
+ QPoint startCenterPoint() const;
+ QPoint lastCenterPoint() const;
+ QPoint centerPoint() const;
+
+ qreal scaleFactor() const;
+ qreal lastScaleFactor() const;
+
+ qreal rotationAngle() const;
+ qreal lastRotationAngle() const;
+
private:
bool event(QEvent *event);
bool eventFilter(QObject *receiver, QEvent *event);
diff --git a/src/gui/kernel/qstandardgestures_p.h b/src/gui/kernel/qstandardgestures_p.h
index 0fe24ee89..43636d09c 100644
--- a/src/gui/kernel/qstandardgestures_p.h
+++ b/src/gui/kernel/qstandardgestures_p.h
@@ -85,6 +85,31 @@ public:
#endif
};
+class QPinchGesturePrivate : public QGesturePrivate
+{
+ Q_DECLARE_PUBLIC(QPinchGesture)
+
+public:
+ QPinchGesturePrivate()
+ : scaleFactor(0), lastScaleFactor(0),
+ rotationAngle(0), lastRotationAngle(0)
+#ifdef Q_WS_WIN
+ ,initialDistance(0)
+#endif
+ {
+ }
+ qreal scaleFactor;
+ qreal lastScaleFactor;
+ qreal rotationAngle;
+ qreal lastRotationAngle;
+ QPoint startCenterPoint;
+ QPoint lastCenterPoint;
+ QPoint centerPoint;
+#ifdef Q_WS_WIN
+ int initialDistance;
+#endif
+};
+
QT_END_NAMESPACE
#endif // QSTANDARDGESTURES_P_H
diff --git a/src/gui/kernel/qt_x11_p.h b/src/gui/kernel/qt_x11_p.h
index 1ac51e01d..44652d316 100644
--- a/src/gui/kernel/qt_x11_p.h
+++ b/src/gui/kernel/qt_x11_p.h
@@ -515,7 +515,8 @@ struct QX11Data
char *startupId;
- DesktopEnvironment desktopEnvironment;
+ DesktopEnvironment desktopEnvironment : 8;
+ uint desktopVersion : 8; /* Used only for KDE */
/* Warning: if you modify this list, modify the names of atoms in qapplication_x11.cpp as well! */
enum X11Atom {
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index a827967af..f7057616f 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -3480,27 +3480,27 @@ bool QWidgetPrivate::setMinimumSize_helper(int &minw, int &minh)
}
}
#endif
+ int mw = minw, mh = minh;
+ if (mw == QWIDGETSIZE_MAX)
+ mw = 0;
+ if (mh == QWIDGETSIZE_MAX)
+ mh = 0;
if (minw > QWIDGETSIZE_MAX || minh > QWIDGETSIZE_MAX) {
qWarning("QWidget::setMinimumSize: (%s/%s) "
"The largest allowed size is (%d,%d)",
q->objectName().toLocal8Bit().data(), q->metaObject()->className(), QWIDGETSIZE_MAX,
QWIDGETSIZE_MAX);
- minw = qMin<int>(minw, QWIDGETSIZE_MAX);
- minh = qMin<int>(minh, QWIDGETSIZE_MAX);
+ minw = mw = qMin<int>(minw, QWIDGETSIZE_MAX);
+ minh = mh = qMin<int>(minh, QWIDGETSIZE_MAX);
}
if (minw < 0 || minh < 0) {
qWarning("QWidget::setMinimumSize: (%s/%s) Negative sizes (%d,%d) "
"are not possible",
q->objectName().toLocal8Bit().data(), q->metaObject()->className(), minw, minh);
- minw = qMax(minw, 0);
- minh = qMax(minh, 0);
+ minw = mw = qMax(minw, 0);
+ minh = mh = qMax(minh, 0);
}
createExtra();
- int mw = minw, mh = minh;
- if (mw == QWIDGETSIZE_MAX)
- mw = 0;
- if (mh == QWIDGETSIZE_MAX)
- mh = 0;
if (extra->minw == mw && extra->minh == mh)
return false;
extra->minw = mw;
@@ -7990,10 +7990,12 @@ void QWidget::changeEvent(QEvent * event)
case QEvent::FontChange:
case QEvent::StyleChange: {
+ Q_D(QWidget);
update();
updateGeometry();
+ if (d->layout)
+ d->layout->invalidate();
#ifdef Q_WS_QWS
- Q_D(QWidget);
if (isWindow())
d->data.fstrut_dirty = true;
#endif
@@ -11114,8 +11116,6 @@ Q_GUI_EXPORT QWidgetPrivate *qt_widget_private(QWidget *widget)
}
-
-
#ifndef QT_NO_GRAPHICSVIEW
/*!
\since 4.5
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 78df09da0..6851e2504 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -3176,6 +3176,12 @@ void QWidgetPrivate::show_sys()
#ifndef QT_MAC_USE_COCOA
SizeWindow(window, q->width(), q->height(), true);
#endif
+
+#ifdef QT_MAC_USE_COCOA
+ // Make sure that we end up sending a repaint event to
+ // the widget if the window has been visible one before:
+ [qt_mac_get_contentview_for(window) setNeedsDisplay:YES];
+#endif
if(qt_mac_is_macsheet(q)) {
qt_event_request_showsheet(q);
} else if(qt_mac_is_macdrawer(q)) {
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index 998181e85..ac145b761 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -558,6 +558,7 @@ public:
#endif
void grabMouseWhileInWindow();
void registerTouchWindow();
+ void winSetupGestures();
#elif defined(Q_WS_MAC) // <--------------------------------------------------------- MAC
// This is new stuff
uint needWindowChange : 1;
diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp
index b11b661d8..510df7feb 100644
--- a/src/gui/kernel/qwidget_win.cpp
+++ b/src/gui/kernel/qwidget_win.cpp
@@ -56,6 +56,10 @@
#include "private/qbackingstore_p.h"
#include "private/qwindowsurface_raster_p.h"
+#include "qscrollbar.h"
+#include "qabstractscrollarea.h"
+#include <private/qabstractscrollarea_p.h>
+
#include <qdebug.h>
#include <private/qapplication_p.h>
@@ -1156,6 +1160,8 @@ void QWidgetPrivate::show_sys()
data.window_state |= Qt::WindowMaximized;
}
+ winSetupGestures();
+
invalidateBuffer(q->rect());
}
#endif //Q_WS_WINCE
@@ -2049,6 +2055,70 @@ void QWidgetPrivate::registerTouchWindow()
QApplicationPrivate::RegisterTouchWindow(q->effectiveWinId(), 0);
}
+void QWidgetPrivate::winSetupGestures()
+{
+ Q_Q(QWidget);
+ if (!q)
+ return;
+ q->setAttribute(Qt::WA_DontCreateNativeAncestors);
+ q->setAttribute(Qt::WA_NativeWindow);
+ if (!q->isVisible())
+ return;
+ QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
+ bool needh = false;
+ bool needv = false;
+ bool singleFingerPanEnabled = false;
+ QStandardGestures gestures = qAppPriv->widgetGestures[q];
+ WId winid = 0;
+
+ if (QAbstractScrollArea *asa = qobject_cast<QAbstractScrollArea*>(q)) {
+ winid = asa->viewport()->winId();
+ QScrollBar *hbar = asa->horizontalScrollBar();
+ QScrollBar *vbar = asa->verticalScrollBar();
+ Qt::ScrollBarPolicy hbarpolicy = asa->horizontalScrollBarPolicy();
+ Qt::ScrollBarPolicy vbarpolicy = asa->verticalScrollBarPolicy();
+ needh = (hbarpolicy == Qt::ScrollBarAlwaysOn ||
+ (hbarpolicy == Qt::ScrollBarAsNeeded && hbar->minimum() < hbar->maximum()));
+ needv = (vbarpolicy == Qt::ScrollBarAlwaysOn ||
+ (vbarpolicy == Qt::ScrollBarAsNeeded && vbar->minimum() < vbar->maximum()));
+ singleFingerPanEnabled = asa->d_func()->singleFingerPanEnabled;
+ } else {
+ winid = q->winId();
+ }
+ if (qAppPriv->SetGestureConfig) {
+ GESTURECONFIG gc[3];
+ memset(gc, 0, sizeof(gc));
+ gc[0].dwID = GID_PAN;
+ if (gestures.pan) {
+ gc[0].dwWant = GC_PAN;
+ if (needv && singleFingerPanEnabled)
+ gc[0].dwWant |= GC_PAN_WITH_SINGLE_FINGER_VERTICALLY;
+ else
+ gc[0].dwBlock |= GC_PAN_WITH_SINGLE_FINGER_VERTICALLY;
+ if (needh && singleFingerPanEnabled)
+ gc[0].dwWant |= GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY;
+ else
+ gc[0].dwBlock |= GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY;
+ } else {
+ gc[0].dwBlock = GC_PAN;
+ }
+
+ gc[1].dwID = GID_ZOOM;
+ if (gestures.pinch)
+ gc[1].dwWant = GC_ZOOM;
+ else
+ gc[1].dwBlock = GC_ZOOM;
+ gc[2].dwID = GID_ROTATE;
+ if (gestures.pinch)
+ gc[2].dwWant = GC_ROTATE;
+ else
+ gc[2].dwBlock = GC_ROTATE;
+
+ Q_ASSERT(winid);
+ qAppPriv->SetGestureConfig(winid, 0, sizeof(gc)/sizeof(gc[0]), gc, sizeof(gc[0]));
+ }
+}
+
QT_END_NAMESPACE
#ifdef Q_WS_WINCE
diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp
index 2a3d2f34e..cf65af3d4 100644
--- a/src/gui/kernel/qwidget_x11.cpp
+++ b/src/gui/kernel/qwidget_x11.cpp
@@ -512,6 +512,13 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
dialog = popup = false; // force these flags off
data.crect.setRect(0, 0, sw, sh);
} else if (topLevel && !q->testAttribute(Qt::WA_Resized)) {
+ QDesktopWidget *desktopWidget = qApp->desktop();
+ if (desktopWidget->isVirtualDesktop()) {
+ QRect r = desktopWidget->screenGeometry();
+ sw = r.width();
+ sh = r.height();
+ }
+
int width = sw / 2;
int height = 4 * sh / 10;
if (extra) {
diff --git a/src/gui/math3d/qquaternion.h b/src/gui/math3d/qquaternion.h
index 55c871d2b..9a1b59040 100644
--- a/src/gui/math3d/qquaternion.h
+++ b/src/gui/math3d/qquaternion.h
@@ -198,24 +198,17 @@ inline QQuaternion &QQuaternion::operator*=(qreal factor)
inline const QQuaternion operator*(const QQuaternion &q1, const QQuaternion& q2)
{
- // Algorithm from:
- // http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q53
- float x = q1.wp * q2.xp +
- q1.xp * q2.wp +
- q1.yp * q2.zp -
- q1.zp * q2.yp;
- float y = q1.wp * q2.yp +
- q1.yp * q2.wp +
- q1.zp * q2.xp -
- q1.xp * q2.zp;
- float z = q1.wp * q2.zp +
- q1.zp * q2.wp +
- q1.xp * q2.yp -
- q1.yp * q2.xp;
- float w = q1.wp * q2.wp -
- q1.xp * q2.xp -
- q1.yp * q2.yp -
- q1.zp * q2.zp;
+ float ww = (q1.zp + q1.xp) * (q2.xp + q2.yp);
+ float yy = (q1.wp - q1.yp) * (q2.wp + q2.zp);
+ float zz = (q1.wp + q1.yp) * (q2.wp - q2.zp);
+ float xx = ww + yy + zz;
+ float qq = 0.5 * (xx + (q1.zp - q1.xp) * (q2.xp - q2.yp));
+
+ float w = qq - ww + (q1.zp - q1.yp) * (q2.yp - q2.zp);
+ float x = qq - xx + (q1.xp + q1.wp) * (q2.xp + q2.wp);
+ float y = qq - yy + (q1.wp - q1.xp) * (q2.yp + q2.zp);
+ float z = qq - zz + (q1.zp + q1.yp) * (q2.wp - q2.xp);
+
return QQuaternion(w, x, y, z, 1);
}
diff --git a/src/gui/painting/qoutlinemapper.cpp b/src/gui/painting/qoutlinemapper.cpp
index 70125b9ea..1287672a2 100644
--- a/src/gui/painting/qoutlinemapper.cpp
+++ b/src/gui/painting/qoutlinemapper.cpp
@@ -201,6 +201,8 @@ void QOutlineMapper::endOutline()
const QVectorPath vp((qreal *)m_elements.data(), m_elements.size(), m_element_types.data());
QPainterPath path = vp.convertToPainterPath();
path = QTransform(m_m11, m_m12, m_m13, m_m21, m_m22, m_m23, m_dx, m_dy, m_m33).map(path);
+ if (!(m_outline.flags & QT_FT_OUTLINE_EVEN_ODD_FILL))
+ path.setFillRule(Qt::WindingFill);
uint old_txop = m_txop;
m_txop = QTransform::TxNone;
if (path.isEmpty())
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 74456dde4..b260f4129 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -2542,6 +2542,9 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
qDebug() << " - QRasterPaintEngine::drawImage(), r=" << r << " sr=" << sr << " image=" << img.size() << "depth=" << img.depth();
#endif
+ if (r.isEmpty())
+ return;
+
Q_D(QRasterPaintEngine);
QRasterPaintEngineState *s = state();
const bool aa = s->flags.antialiased || s->flags.bilinear;
diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp
index 0a64e4ede..a13b49404 100644
--- a/src/gui/painting/qtransform.cpp
+++ b/src/gui/painting/qtransform.cpp
@@ -1541,6 +1541,7 @@ static QPainterPath mapProjective(const QTransform &transform, const QPainterPat
if (path.elementCount() > 0 && lastMoveTo != last)
lineTo_clipped(result, transform, last, lastMoveTo, needsMoveTo, false);
+ result.setFillRule(path.fillRule());
return result;
}
diff --git a/src/gui/styles/gtksymbols.cpp b/src/gui/styles/gtksymbols.cpp
index c2c787612..2d8d6e282 100644
--- a/src/gui/styles/gtksymbols.cpp
+++ b/src/gui/styles/gtksymbols.cpp
@@ -60,6 +60,7 @@
#include <QtCore/QHash>
#include <private/qapplication_p.h>
+#include <private/qiconloader_p.h>
#include <QtGui/QMenu>
#include <QtGui/QStyle>
@@ -341,9 +342,9 @@ static bool resolveGConf()
typedef int (*x11ErrorHandler)(Display*, XErrorEvent*);
-static QString getGConfString(const QString &value)
+QString QGtk::getGConfString(const QString &value, const QString &fallback)
{
- QString retVal;
+ QString retVal = fallback;
if (resolveGConf()) {
g_type_init();
GConfClient* client = QGtk::gconf_client_get_default();
@@ -393,7 +394,7 @@ static QString getThemeName()
// Fall back to gconf
if (themeName.isEmpty() && resolveGConf())
- themeName = getGConfString(QLS("/desktop/gnome/interface/gtk_theme"));
+ themeName = QGtk::getGConfString(QLS("/desktop/gnome/interface/gtk_theme"));
return themeName;
}
@@ -546,9 +547,13 @@ void QGtkStyleUpdateScheduler::updateTheme()
{
static QString oldTheme(QLS("qt_not_set"));
QPixmapCache::clear();
+
+ QFont font = QGtk::getThemeFont();
+ if (QApplication::font() != font)
+ qApp->setFont(font);
+
if (oldTheme != getThemeName()) {
oldTheme = getThemeName();
- qApp->setFont(QGtk::getThemeFont());
QPalette newPalette = qApp->style()->standardPalette();
QApplicationPrivate::setSystemPalette(newPalette);
QApplication::setPalette(newPalette);
@@ -561,6 +566,7 @@ void QGtkStyleUpdateScheduler::updateTheme()
QApplication::sendEvent(widget, &e);
}
}
+ QIconLoader::instance()->updateSystemTheme();
}
static void add_widget(GtkWidget *widget)
@@ -752,7 +758,24 @@ static void setupGtkFileChooser(GtkWidget* gtkFileChooser, QWidget *parent,
QGtk::gtk_file_filter_set_name(gtkFilter, qPrintable(name.isEmpty() ? extensions.join(QLS(", ")) : name));
foreach (const QString &fileExtension, extensions) {
- QGtk::gtk_file_filter_add_pattern (gtkFilter, qPrintable(fileExtension));
+ // Note Gtk file dialogs are by default case sensitive
+ // and only supports basic glob syntax so we
+ // rewrite .xyz to .[xX][yY][zZ]
+ QString caseInsensitive;
+ for (int i = 0 ; i < fileExtension.length() ; ++i) {
+ QChar ch = fileExtension.at(i);
+ if (ch.isLetter()) {
+ caseInsensitive.append(
+ QLatin1Char('[') +
+ ch.toLower() +
+ ch.toUpper() +
+ QLatin1Char(']'));
+ } else {
+ caseInsensitive.append(ch);
+ }
+ }
+ QGtk::gtk_file_filter_add_pattern (gtkFilter, qPrintable(caseInsensitive));
+
}
if (filterMap)
filterMap->insert(gtkFilter, rawfilter);
diff --git a/src/gui/styles/gtksymbols_p.h b/src/gui/styles/gtksymbols_p.h
index 18c6dc55f..68e970a52 100644
--- a/src/gui/styles/gtksymbols_p.h
+++ b/src/gui/styles/gtksymbols_p.h
@@ -216,6 +216,7 @@ public:
static QString openDirectory(QWidget *parent, const QString &caption, const QString &dir, QFileDialog::Options options);
static QStringList openFilenames(QWidget *parent, const QString &caption, const QString &dir, const QString &filter,
QString *selectedFilter, QFileDialog::Options options);
+ static QString getGConfString(const QString &key, const QString &fallback = QString());
static Ptr_gtk_container_forall gtk_container_forall;
static Ptr_gtk_init gtk_init;
diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp
index 8f8878177..1782e3672 100644
--- a/src/gui/styles/qcleanlooksstyle.cpp
+++ b/src/gui/styles/qcleanlooksstyle.cpp
@@ -462,26 +462,6 @@ static const char * const qt_cleanlooks_checkbox_checked[] = {
" ",
" "};
-#ifdef Q_WS_X11
-extern "C" {
- struct GConfClient;
- struct GError;
- typedef void (*Ptr_g_type_init)();
- typedef GConfClient* (*Ptr_gconf_client_get_default)();
- typedef char* (*Ptr_gconf_client_get_string)(GConfClient*, const char*, GError **);
- typedef void (*Ptr_g_object_unref)(void *);
- typedef void (*Ptr_g_error_free)(GError *);
- typedef void (*Ptr_g_free)(void*);
-}
-
-static Ptr_g_type_init p_g_type_init = 0;
-static Ptr_gconf_client_get_default p_gconf_client_get_default = 0;
-static Ptr_gconf_client_get_string p_gconf_client_get_string = 0;
-static Ptr_g_object_unref p_g_object_unref = 0;
-static Ptr_g_error_free p_g_error_free = 0;
-static Ptr_g_free p_g_free = 0;
-#endif
-
static void qt_cleanlooks_draw_gradient(QPainter *painter, const QRect &rect, const QColor &gradientStart,
const QColor &gradientStop, Direction direction = TopDown, QBrush bgBrush = QBrush())
{
@@ -3848,17 +3828,6 @@ QSize QCleanlooksStyle::sizeFromContents(ContentsType type, const QStyleOption *
void QCleanlooksStyle::polish(QApplication *app)
{
QWindowsStyle::polish(app);
-#ifdef Q_WS_X11
- Q_D(QCleanlooksStyle);
-
- QString dataDirs = QLatin1String(getenv("XDG_DATA_DIRS"));
-
- if (dataDirs.isEmpty())
- dataDirs = QLatin1String("/usr/local/share/:/usr/share/");
-
- dataDirs.prepend(QDir::homePath() + QLatin1String("/:"));
- d->iconDirs = dataDirs.split(QLatin1Char(':'));
-#endif
}
/*!
@@ -4376,44 +4345,6 @@ QRect QCleanlooksStyle::subElementRect(SubElement sr, const QStyleOption *opt, c
return r;
}
-void QCleanlooksStylePrivate::lookupIconTheme() const
-{
-#ifdef Q_WS_X11
-
- if (themeName.isEmpty()) {
- //resolve glib and gconf functions
- p_g_type_init = (Ptr_g_type_init)QLibrary::resolve(QLatin1String("gobject-2.0"), 0, "g_type_init");
- p_gconf_client_get_default = (Ptr_gconf_client_get_default)QLibrary::resolve(QLatin1String("gconf-2"), 4, "gconf_client_get_default");
- p_gconf_client_get_string = (Ptr_gconf_client_get_string)QLibrary::resolve(QLatin1String("gconf-2"), 4, "gconf_client_get_string");
- p_g_object_unref = (Ptr_g_object_unref)QLibrary::resolve(QLatin1String("gobject-2.0"), 0, "g_object_unref");
- p_g_error_free = (Ptr_g_error_free)QLibrary::resolve(QLatin1String("glib-2.0"), 0, "g_error_free");
- p_g_free = (Ptr_g_free)QLibrary::resolve(QLatin1String("glib-2.0"), 0, "g_free");
-
- if (p_g_type_init &&
- p_gconf_client_get_default &&
- p_gconf_client_get_string &&
- p_g_object_unref &&
- p_g_error_free &&
- p_g_free) {
-
- p_g_type_init();
- GConfClient* client = p_gconf_client_get_default();
- GError *err = 0;
- char *str = p_gconf_client_get_string(client, "/desktop/gnome/interface/icon_theme", &err);
- if (!err) {
- themeName = QString::fromUtf8(str);
- p_g_free(str);
- }
- p_g_object_unref(client);
- if (err)
- p_g_error_free (err);
- }
- if (themeName.isEmpty())
- themeName = QLatin1String("gnome");
- }
-#endif
-}
-
/*!
\internal
*/
@@ -4421,165 +4352,6 @@ QIcon QCleanlooksStyle::standardIconImplementation(StandardPixmap standardIcon,
const QStyleOption *option,
const QWidget *widget) const
{
-#ifdef Q_WS_X11
- Q_D(const QCleanlooksStyle);
- if (!QApplication::desktopSettingsAware())
- return QWindowsStyle::standardIconImplementation(standardIcon, option, widget);
- QIcon icon;
- QPixmap pixmap;
- QPixmap link;
- d->lookupIconTheme();
- switch (standardIcon) {
- case SP_DirIcon: {
- icon = QIcon(proxy()->standardPixmap(standardIcon, option, widget));
- icon.addPixmap(proxy()->standardPixmap(SP_DirClosedIcon, option, widget),
- QIcon::Normal, QIcon::Off);
- pixmap = d->findIcon(16, QLatin1String("gnome-fs-directory.png"));
- if (!pixmap.isNull())
- icon.addPixmap(pixmap, QIcon::Normal, QIcon::Off);
- pixmap = d->findIcon(48, QLatin1String("gnome-fs-directory.png"));
- if (!pixmap.isNull())
- icon.addPixmap(pixmap, QIcon::Normal, QIcon::Off);
- pixmap = d->findIcon(16, QLatin1String("gnome-fs-directory-accept.png"));
- if (!pixmap.isNull())
- icon.addPixmap(pixmap, QIcon::Normal, QIcon::On);
- pixmap = d->findIcon(16, QLatin1String("gnome-fs-directory-accept.png"));
- if (!pixmap.isNull())
- icon.addPixmap(pixmap, QIcon::Normal, QIcon::On);
- }
- break;
- case SP_DirLinkIcon:
- {
- icon = QIcon(proxy()->standardPixmap(standardIcon, option, widget));
- QPixmap link = d->findIcon(12, QLatin1String("emblem-symbolic-link.png"));
- if (!link.isNull()) {
- icon.addPixmap(proxy()->standardPixmap(SP_DirLinkIcon, option, widget));
- pixmap = d->findIcon(16, QLatin1String("gnome-fs-directory.png"));
- if (!pixmap.isNull()) {
- QPainter painter(&pixmap);
- painter.drawPixmap(8, 8, 8, 8, link);
- painter.end();
- icon.addPixmap(pixmap);
- }
- }
- break;
- }
- case SP_FileIcon:
- {
- icon = d->createIcon(QLatin1String("unknown.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("gnome-fs-regular.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("stock_new.png"));
- break;
- }
- case SP_DialogCloseButton:
- {
- icon = d->createIcon(QLatin1String("gtk-close.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("stock-close.png"));
- break;
- }
- case SP_DirHomeIcon:
- {
- icon = d->createIcon(QLatin1String("folder_home.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("gnome_home.png"));
- break;
- }
- case SP_DriveFDIcon:
- {
- icon = d->createIcon(QLatin1String("gnome-dev-floppy.png"));
- break;
- }
- case SP_ComputerIcon:
- {
- icon = d->createIcon(QLatin1String("gnome-fs-client.png"));
- break;
- }
- case SP_DesktopIcon:
- {
- icon = d->createIcon(QLatin1String("gnome-fs-desktop.png"));
- break;
- }
- case SP_TrashIcon:
- {
- icon = d->createIcon(QLatin1String("gnome-fs-trash-empty.png"));
- break;
- }
- case SP_DriveCDIcon:
- case SP_DriveDVDIcon:
- {
- icon = d->createIcon(QLatin1String("gnome-dev-cdrom.png"));
- break;
- }
- case SP_DriveHDIcon:
- {
- icon = d->createIcon(QLatin1String("gnome-dev-harddisk.png"));
- break;
- }
- case SP_ArrowUp:
- {
- icon = d->createIcon(QLatin1String("stock_up.png"));
- break;
- }
- case SP_ArrowDown:
- {
- icon = d->createIcon(QLatin1String("stock_down.png"));
- break;
- }
- case SP_ArrowRight:
- {
- icon = d->createIcon(QLatin1String("stock_right.png"));
- break;
- }
- case SP_ArrowLeft:
- {
- icon = d->createIcon(QLatin1String("stock_left.png"));
- break;
- }
- case SP_BrowserReload:
- {
- icon = d->createIcon(QLatin1String("view-refresh.png"));
- break;
- }
- case SP_BrowserStop:
- {
- pixmap = d->findIcon(24, QLatin1String("stop.png"));
- break;
- }
- case SP_FileLinkIcon:
- {
- icon = QIcon(proxy()->standardPixmap(standardIcon, option, widget));
- QPixmap link = d->findIcon(12, QLatin1String("emblem-symbolic-link.png"));
- if (!link.isNull()) {
- icon.addPixmap(proxy()->standardPixmap(SP_FileLinkIcon,option, widget));
- pixmap = d->findIcon(16, QLatin1String("unknown.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(16, QLatin1String("stock_new.png"));
- if (!pixmap.isNull()) {
- QPainter painter(&pixmap);
- painter.drawPixmap(8, 8, 8, 8, link);
- painter.end();
- icon.addPixmap(pixmap);
- }
- }
- break;
- }
- case SP_ArrowForward:
- if (QApplication::layoutDirection() == Qt::RightToLeft)
- return standardIconImplementation(SP_ArrowLeft, option, widget);
- return standardIconImplementation(SP_ArrowRight, option, widget);
- case SP_ArrowBack:
- if (QApplication::layoutDirection() == Qt::RightToLeft)
- return standardIconImplementation(SP_ArrowRight, option, widget);
- return standardIconImplementation(SP_ArrowLeft, option, widget);
- default:
- icon = QIcon(proxy()->standardPixmap(standardIcon, option, widget));
- }
- if (!icon.isNull())
- return icon;
-#endif // Q_WS_X11
return QWindowsStyle::standardIconImplementation(standardIcon, option, widget);
}
@@ -4589,341 +4361,10 @@ QIcon QCleanlooksStyle::standardIconImplementation(StandardPixmap standardIcon,
QPixmap QCleanlooksStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt,
const QWidget *widget) const
{
-#ifdef Q_WS_X11
- Q_D(const QCleanlooksStyle);
QPixmap pixmap;
- if (!QApplication::desktopSettingsAware())
- return QWindowsStyle::standardPixmap(standardPixmap, opt, widget);
- d->lookupIconTheme();
+
#ifndef QT_NO_IMAGEFORMAT_XPM
switch (standardPixmap) {
- case SP_MessageBoxInformation:
- {
- pixmap = d->findIcon(48, QLatin1String("dialog-info.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(48, QLatin1String("stock_dialog-info.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_MessageBoxWarning:
- {
- pixmap = d->findIcon(48, QLatin1String("dialog-warning.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(48, QLatin1String("stock_dialog-warning.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_MessageBoxCritical:
- {
- pixmap = d->findIcon(48, QLatin1String("dialog-error.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(48, QLatin1String("stock_dialog-error.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_MessageBoxQuestion:
- {
- pixmap = d->findIcon(48, QLatin1String("dialog-question.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_DirHomeIcon:
- {
- pixmap = d->findIcon(16, QLatin1String("folder_home.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(16, QLatin1String("gnome_home.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_DialogOpenButton:
- case SP_DirOpenIcon:
- {
- pixmap = d->findIcon(24, QLatin1String("stock_open.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_FileIcon:
- {
- pixmap = d->findIcon(24, QLatin1String("unknown.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(24, QLatin1String("gnome-fs-regular.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(24, QLatin1String("stock_new.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_FileLinkIcon:
- {
- pixmap = d->findIcon(24, QLatin1String("emblem-symbolic-link.png"));
- if (!pixmap.isNull()) {
- QPixmap fileIcon = d->findIcon(24, QLatin1String("unknown.png"));
- if (fileIcon.isNull())
- fileIcon = d->findIcon(24, QLatin1String("stock_new.png"));
- if (!fileIcon.isNull()) {
- QPainter painter(&fileIcon);
- painter.setRenderHint(QPainter::SmoothPixmapTransform);
- painter.drawPixmap(12, 12, 12, 12, pixmap);
- return fileIcon;
- }
- }
- break;
- }
- case SP_DirClosedIcon:
- case SP_DirIcon:
- {
- pixmap = d->findIcon(24, QLatin1String("gnome-fs-directory.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_DirLinkIcon:
- {
- pixmap = d->findIcon(24, QLatin1String("emblem-symbolic-link.png"));
- if (!pixmap.isNull()) {
- QPixmap dirIcon = d->findIcon(24, QLatin1String("gnome-fs-directory.png"));
- if (!dirIcon.isNull()) {
- QPainter painter(&dirIcon);
- painter.setRenderHint(QPainter::SmoothPixmapTransform);
- painter.drawPixmap(12, 12, 12, 12, pixmap);
- return dirIcon;
- }
- }
- break;
- }
- case SP_DriveFDIcon:
- {
- pixmap = d->findIcon(24, QLatin1String("gnome-dev-floppy.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_ComputerIcon:
- {
- pixmap = d->findIcon(24, QLatin1String("gnome-fs-client.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_DesktopIcon:
- {
- pixmap = d->findIcon(24, QLatin1String("gnome-fs-desktop.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_TrashIcon:
- {
- pixmap = d->findIcon(24, QLatin1String("gnome-fs-trash-empty.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_DriveCDIcon:
- case SP_DriveDVDIcon:
- {
- pixmap = d->findIcon(24, QLatin1String("gnome-dev-cdrom.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_DriveHDIcon:
- {
- pixmap = d->findIcon(24, QLatin1String("gnome-dev-harddisk.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_FileDialogToParent:
- {
- pixmap = d->findIcon(16, QLatin1String("stock_up.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_FileDialogNewFolder:
- {
- pixmap = d->findIcon(16, QLatin1String("stock_new-dir.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_ArrowUp:
- {
- pixmap = d->findIcon(16, QLatin1String("stock_up.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_ArrowDown:
- {
- pixmap = d->findIcon(16, QLatin1String("stock_down.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_ArrowRight:
- {
- pixmap = d->findIcon(16, QLatin1String("stock_right.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_ArrowLeft:
- {
- pixmap = d->findIcon(16, QLatin1String("stock_left.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_DialogCloseButton:
- {
- pixmap = d->findIcon(24, QLatin1String("gtk-close.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(24, QLatin1String("stock-close.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_DialogApplyButton:
- {
- pixmap = d->findIcon(24, QLatin1String("dialog-apply.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(24, QLatin1String("stock-apply.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_DialogResetButton:
- {
- pixmap = d->findIcon(24, QLatin1String("gtk-clear.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_DialogHelpButton:
- {
- pixmap = d->findIcon(24, QLatin1String("gtk-help.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_DialogOkButton:
- {
- pixmap = d->findIcon(24, QLatin1String("dialog-ok.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(24, QLatin1String("stock-ok.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_DialogCancelButton:
- {
- pixmap = d->findIcon(24, QLatin1String("dialog-cancel.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(24, QLatin1String("stock-cancel.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(24, QLatin1String("process-stop.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_DialogSaveButton:
- {
- pixmap = d->findIcon(24, QLatin1String("stock_save.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_BrowserStop:
- {
- pixmap = d->findIcon(16, QLatin1String("process-stop.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_BrowserReload:
- {
- pixmap = d->findIcon(16, QLatin1String("view-refresh.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_MediaPlay:
- {
- pixmap = d->findIcon(24, QLatin1String("media-playback-start.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_MediaPause:
- {
- pixmap = d->findIcon(24, QLatin1String("media-playback-pause.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_MediaStop:
- {
- pixmap = d->findIcon(24, QLatin1String("media-playback-stop.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_MediaVolume:
- {
- pixmap = d->findIcon(16, QLatin1String("audio-volume-medium.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_MediaVolumeMuted:
- {
- pixmap = d->findIcon(16, QLatin1String("audio-volume-muted.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_MediaSeekForward:
- {
- pixmap = d->findIcon(24, QLatin1String("media-seek-forward.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_MediaSeekBackward:
- {
- pixmap = d->findIcon(24, QLatin1String("media-seek-backward.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_MediaSkipForward:
- {
- pixmap = d->findIcon(24, QLatin1String("media-skip-forward.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_MediaSkipBackward:
- {
- pixmap = d->findIcon(24, QLatin1String("media-skip-backward.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_TitleBarMenuButton:
- case SP_TitleBarShadeButton:
- case SP_TitleBarUnshadeButton:
- case SP_TitleBarMaxButton:
- case SP_TitleBarContextHelpButton:
- return QWindowsStyle::standardPixmap(standardPixmap, opt, widget);
case SP_TitleBarNormalButton:
return QPixmap((const char **)dock_widget_restore_xpm);
case SP_TitleBarMinButton:
@@ -4936,7 +4377,7 @@ QPixmap QCleanlooksStyle::standardPixmap(StandardPixmap standardPixmap, const QS
break;
}
#endif //QT_NO_IMAGEFORMAT_XPM
-#endif //Q_WS_X11
+
return QWindowsStyle::standardPixmap(standardPixmap, opt, widget);
}
diff --git a/src/gui/styles/qcleanlooksstyle_p.h b/src/gui/styles/qcleanlooksstyle_p.h
index a26d40db0..d325499df 100644
--- a/src/gui/styles/qcleanlooksstyle_p.h
+++ b/src/gui/styles/qcleanlooksstyle_p.h
@@ -71,8 +71,6 @@ public:
~QCleanlooksStylePrivate() {
}
-
- void lookupIconTheme() const;
};
QT_END_NAMESPACE
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp
index ba28e753d..387885600 100644
--- a/src/gui/styles/qcommonstyle.cpp
+++ b/src/gui/styles/qcommonstyle.cpp
@@ -63,7 +63,7 @@
#include <qtoolbar.h>
#include <qtoolbutton.h>
#include <qrubberband.h>
-#include <private/qapplication_p.h>
+#include <../kernel/qkde_p.h>
#include <private/qcommonstylepixmaps_p.h>
#include <private/qmath_p.h>
#include <private/qstylehelper_p.h>
@@ -840,169 +840,8 @@ static void drawArrow(const QStyle *style, const QStyleOptionToolButton *toolbut
#endif // QT_NO_TOOLBUTTON
-
#ifdef Q_WS_X11 // These functions are used to parse the X11 freedesktop icon spec
-static int kdeVersion()
-{
- static int kdeVersion = qgetenv("KDE_SESSION_VERSION").toInt();
- return kdeVersion;
-}
-
-void QCommonStylePrivate::lookupIconTheme() const
-{
- if (!themeName.isEmpty())
- return;
-
- QString dataDirs = QString::fromLocal8Bit(getenv("XDG_DATA_DIRS"));
- if (dataDirs.isEmpty())
- dataDirs = QLatin1String("/usr/local/share/:/usr/share/");
- dataDirs += QLatin1Char(':') + QApplicationPrivate::kdeHome() + QLatin1String("/share");
- dataDirs.prepend(QDir::homePath() + QLatin1String("/:"));
- QStringList kdeDirs = QString::fromLocal8Bit(getenv("KDEDIRS")).split(QLatin1Char(':'), QString::SkipEmptyParts);
- foreach (const QString &dirName, kdeDirs)
- dataDirs.append(QLatin1Char(':') + dirName + QLatin1String("/share"));
- iconDirs = dataDirs.split(QLatin1Char(':'));
-
- QFileInfo fileInfo(QLatin1String("/usr/share/icons/default.kde"));
- QDir dir(fileInfo.canonicalFilePath());
- QString kdeDefault = kdeVersion() >= 4 ? QString::fromLatin1("oxygen") : QString::fromLatin1("crystalsvg");
- QString defaultTheme = fileInfo.exists() ? dir.dirName() : kdeDefault;
- QSettings settings(QApplicationPrivate::kdeHome() +
- QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat);
- settings.beginGroup(QLatin1String("Icons"));
- themeName = settings.value(QLatin1String("Theme"), defaultTheme).toString();
-}
-
-QIconTheme QCommonStylePrivate::parseIndexFile(const QString &themeName) const
-{
- Q_Q(const QCommonStyle);
- QIconTheme theme;
- QFile themeIndex;
- QStringList parents;
- QHash <int, QString> dirList;
-
- for ( int i = 0 ; i < iconDirs.size() && !themeIndex.exists() ; ++i) {
- QString contentDir = QLatin1String(iconDirs[i].startsWith(QDir::homePath()) ?
- "/.icons/" : "/icons/");
- themeIndex.setFileName(iconDirs[i] + contentDir +
- themeName + QLatin1String("/index.theme"));
- }
-
- if (themeIndex.open(QIODevice::ReadOnly | QIODevice::Text)) {
-
- QTextStream in(&themeIndex);
-
- while (!in.atEnd()) {
-
- QString line = in.readLine();
-
- if (line.startsWith(QLatin1String("Inherits="))) {
- line = line.right(line.length() - 9);
- parents = line.split(QLatin1Char(','));
- }
-
- if (line.startsWith(QLatin1Char('['))) {
- line = line.trimmed();
- line.chop(1);
- QString dirName = line.right(line.length() - 1);
- if (!in.atEnd()) {
- line = in.readLine();
- int size;
- if (line.startsWith(QLatin1String("Size="))) {
- size = line.right(line.length() - 5).toInt();
- if (size)
- dirList.insertMulti(size, dirName);
- }
- }
- }
- }
- }
-
- if (q->inherits("QPlastiqueStyle")) {
- QFileInfo fileInfo(QLatin1String("/usr/share/icons/default.kde"));
- QDir dir(fileInfo.canonicalFilePath());
- QString defaultKDETheme = dir.exists() ? dir.dirName() : QString::fromLatin1("crystalsvg");
- if (!parents.contains(defaultKDETheme) && themeName != defaultKDETheme)
- parents.append(defaultKDETheme);
- } else if (parents.isEmpty() && themeName != QLatin1String("hicolor")) {
- parents.append(QLatin1String("hicolor"));
- }
- theme = QIconTheme(dirList, parents);
- return theme;
-}
-
-QPixmap QCommonStylePrivate::findIconHelper(int size,
- const QString &themeName,
- const QString &iconName,
- QStringList &visited) const
-{
- QPixmap pixmap;
-
- if (!themeName.isEmpty()) {
-
- visited << themeName;
- QIconTheme theme = themeList.value(themeName);
-
- if (!theme.isValid()) {
- theme = parseIndexFile(themeName);
- themeList.insert(themeName, theme);
- }
-
- if (!theme.isValid())
- return QPixmap();
-
- QList <QString> subDirs = theme.dirList().values(size);
- for ( int i = 0 ; i < iconDirs.size() ; ++i) {
- for ( int j = 0 ; j < subDirs.size() ; ++j) {
- QString contentDir = (iconDirs[i].startsWith(QDir::homePath())) ?
- QLatin1String("/.icons/") : QLatin1String("/icons/");
- QString fileName = iconDirs[i] + contentDir + themeName + QLatin1Char('/') + subDirs[j] + QLatin1Char('/') + iconName;
- QFile file(fileName);
- if (file.exists())
- pixmap.load(fileName);
- if (!pixmap.isNull())
- break;
- }
- }
-
- if (pixmap.isNull()) {
- QStringList parents = theme.parents();
- //search recursively through inherited themes
- for (int i = 0 ; pixmap.isNull() && i < parents.size() ; ++i) {
- QString parentTheme = parents[i].trimmed();
- if (!visited.contains(parentTheme)) //guard against endless recursion
- pixmap = findIconHelper(size, parentTheme, iconName, visited);
- }
- }
- }
- return pixmap;
-}
-
-QPixmap QCommonStylePrivate::findIcon(int size, const QString &name) const
-{
- QPixmap pixmap;
- QString pixmapName = QLatin1String("$qt") + name + QString::number(size);
-
- if (QPixmapCache::find(pixmapName, pixmap))
- return pixmap;
-
- if (!themeName.isEmpty()) {
- QStringList visited;
- pixmap = findIconHelper(size, themeName, name, visited);
- }
- QPixmapCache::insert(pixmapName, pixmap);
- return pixmap;
-}
-
-QIcon QCommonStylePrivate::createIcon(const QString &name) const
-{
- QIcon icon;
- icon.addPixmap(findIcon(16, name));
- icon.addPixmap(findIcon(24, name));
- icon.addPixmap(findIcon(32, name));
- return icon;
-}
/*!internal
Checks if you are running KDE and looks up the toolbar
@@ -1012,8 +851,8 @@ from the KDE configuration file
int QCommonStylePrivate::lookupToolButtonStyle() const
{
int result = Qt::ToolButtonIconOnly;
- if (kdeVersion() >= 4) {
- QSettings settings(QApplicationPrivate::kdeHome() +
+ if (X11->desktopEnvironment == DE_KDE && X11->desktopVersion >= 4) {
+ QSettings settings(QKde::kdeHome() +
QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat);
settings.beginGroup(QLatin1String("Toolbar style"));
QString toolbarStyle = settings.value(QLatin1String("ToolButtonStyle"), QLatin1String("TextBesideIcon")).toString();
@@ -4852,8 +4691,24 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
ret = int(QStyleHelper::dpiScaled(6.));
break;
- case PM_TabBarIconSize:
case PM_ToolBarIconSize:
+#ifdef Q_WS_X11
+ if (X11->desktopVersion >= 4) {
+ static int iconSize = 0;
+ if (!iconSize) {
+ QSettings settings(QKde::kdeHome() +
+ QLatin1String("/share/config/kdeglobals"),
+ QSettings::IniFormat);
+ settings.beginGroup(QLatin1String("ToolbarIcons"));
+ iconSize = settings.value(QLatin1String("Size"), QLatin1String("22")).toInt();
+ }
+ ret = iconSize;
+ } else
+#endif
+ ret = proxy()->pixelMetric(PM_SmallIconSize, opt, widget);
+ break;
+
+ case PM_TabBarIconSize:
case PM_ListViewIconSize:
ret = proxy()->pixelMetric(PM_SmallIconSize, opt, widget);
break;
@@ -5364,293 +5219,161 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti
Q_UNUSED(widget);
Q_UNUSED(sp);
#else
-#ifdef Q_WS_X11
- Q_D(const QCommonStyle);
QPixmap pixmap;
- if (QApplication::desktopSettingsAware()) {
- d->lookupIconTheme();
+
+ if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) {
switch (sp) {
case SP_DirHomeIcon:
- {
- pixmap = d->findIcon(16, QLatin1String("folder_home.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
+ pixmap = QIcon::fromTheme(QLatin1String("user-home")).pixmap(16);
+ break;
case SP_MessageBoxInformation:
- {
- pixmap = d->findIcon(32, QLatin1String("messagebox_info.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
+ pixmap = QIcon::fromTheme(QLatin1String("messagebox_info")).pixmap(16);
+ break;
case SP_MessageBoxWarning:
- {
- pixmap = d->findIcon(32, QLatin1String("messagebox_warning.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
+ pixmap = QIcon::fromTheme(QLatin1String("messagebox_warning")).pixmap(16);
+ break;
case SP_MessageBoxCritical:
- {
- pixmap = d->findIcon(32, QLatin1String("messagebox_critical.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
+ pixmap = QIcon::fromTheme(QLatin1String("messagebox_critical")).pixmap(16);
+ break;
case SP_MessageBoxQuestion:
- {
- pixmap = d->findIcon(32, QLatin1String("help.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
+ pixmap = QIcon::fromTheme(QLatin1String("help")).pixmap(16);
+ break;
case SP_DialogOpenButton:
case SP_DirOpenIcon:
- {
- pixmap = d->findIcon(16, QLatin1String("folder-open.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(16, QLatin1String("folder_open.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
+ pixmap = QIcon::fromTheme(QLatin1String("folder-open")).pixmap(16);
+ break;
case SP_FileIcon:
- {
- pixmap = d->findIcon(16, QLatin1String("text-x-generic.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(16, QLatin1String("empty.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_FileLinkIcon:
- {
- pixmap = d->findIcon(16, QLatin1String("link_overlay.png"));
- if (!pixmap.isNull()) {
- QPixmap fileIcon = d->findIcon(16, QLatin1String("text-x-generic.png"));
- if (fileIcon.isNull())
- fileIcon = d->findIcon(16, QLatin1String("empty.png"));
- if (!fileIcon.isNull()) {
- QPainter painter(&fileIcon);
- painter.drawPixmap(0, 0, 16, 16, pixmap);
- return fileIcon;
- }
- }
- break;
- }
+ pixmap = QIcon::fromTheme(QLatin1String("text-x-generic"),
+ QIcon::fromTheme(QLatin1String("empty"))).pixmap(16);
+ break;
case SP_DirClosedIcon:
case SP_DirIcon:
- {
- pixmap = d->findIcon(16, QLatin1String("folder.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("folder")).pixmap(16);
break;
- }
- case SP_DirLinkIcon:
- {
- pixmap = d->findIcon(16, QLatin1String("link_overlay.png"));
- if (!pixmap.isNull()) {
- QPixmap dirIcon = d->findIcon(16, QLatin1String("folder.png"));
- if (!dirIcon.isNull()) {
- QPainter painter(&dirIcon);
- painter.drawPixmap(0, 0, 16, 16, pixmap);
- return dirIcon;
- }
- }
- break;
- }
case SP_DriveFDIcon:
- {
- pixmap = d->findIcon(16, QLatin1String("media-floppy.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(16, QLatin1String("3floppy_unmount.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("media-floppy"),
+ QIcon::fromTheme(QLatin1String("3floppy_unmount"))).pixmap(16);
break;
- }
case SP_ComputerIcon:
- {
- pixmap = d->findIcon(16, QLatin1String("computer.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(16, QLatin1String("system.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("computer"),
+ QIcon::fromTheme(QLatin1String("system"))).pixmap(16);
break;
- }
case SP_DesktopIcon:
- {
- pixmap = d->findIcon(16, QLatin1String("user-desktop.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(16, QLatin1String("desktop.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("user-desktop"),
+ QIcon::fromTheme(QLatin1String("desktop"))).pixmap(16);
break;
- }
case SP_TrashIcon:
- {
- pixmap = d->findIcon(16, QLatin1String("user-trash.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(16, QLatin1String("trashcan_empty.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("user-trash"),
+ QIcon::fromTheme(QLatin1String("trashcan_empty"))).pixmap(16);
break;
- }
case SP_DriveCDIcon:
case SP_DriveDVDIcon:
- {
- pixmap = d->findIcon(16, QLatin1String("media-optical.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(16, QLatin1String("cdrom_unmount.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("media-optical"),
+ QIcon::fromTheme(QLatin1String("cdrom_unmount"))).pixmap(16);
break;
- }
case SP_DriveHDIcon:
- {
- pixmap = d->findIcon(16, QLatin1String("drive-harddisk.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(16, QLatin1String("hdd_unmount.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("drive-harddisk"),
+ QIcon::fromTheme(QLatin1String("hdd_unmount"))).pixmap(16);
break;
- }
case SP_FileDialogToParent:
- {
- pixmap = d->findIcon(32, QLatin1String("go-up.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(32, QLatin1String("up.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("go-up"),
+ QIcon::fromTheme(QLatin1String("up"))).pixmap(16);
break;
- }
case SP_FileDialogNewFolder:
- {
- pixmap = d->findIcon(16, QLatin1String("folder_new.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("folder_new")).pixmap(16);
break;
- }
case SP_ArrowUp:
- {
- pixmap = d->findIcon(32, QLatin1String("go-up.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(32, QLatin1String("up.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("go-up"),
+ QIcon::fromTheme(QLatin1String("up"))).pixmap(16);
break;
- }
case SP_ArrowDown:
- {
- pixmap = d->findIcon(32, QLatin1String("go-down.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(32, QLatin1String("down.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("go-down"),
+ QIcon::fromTheme(QLatin1String("down"))).pixmap(16);
break;
- }
case SP_ArrowRight:
- {
- pixmap = d->findIcon(32, QLatin1String("go-next.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(32, QLatin1String("forward.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("go-next"),
+ QIcon::fromTheme(QLatin1String("forward"))).pixmap(16);
break;
- }
case SP_ArrowLeft:
- {
- pixmap = d->findIcon(32, QLatin1String("go-previous.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(32, QLatin1String("back.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("go-previous"),
+ QIcon::fromTheme(QLatin1String("back"))).pixmap(16);
break;
- }
case SP_FileDialogDetailedView:
- {
- pixmap = d->findIcon(16, QLatin1String("view_detailed.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("view_detailed")).pixmap(16);
break;
- }
-
case SP_FileDialogListView:
- {
- pixmap = d->findIcon(16, QLatin1String("view_icon.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("view_icon")).pixmap(16);
break;
- }
case SP_BrowserReload:
- {
- pixmap = d->findIcon(32, QLatin1String("reload.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("reload")).pixmap(16);
break;
- }
case SP_BrowserStop:
- {
- pixmap = d->findIcon(32, QLatin1String("stop.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("process-stop")).pixmap(16);
break;
- }
case SP_MediaPlay:
- {
- pixmap = d->findIcon(16, QLatin1String("player_play.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("media-playback-start")).pixmap(16);
break;
- }
case SP_MediaPause:
- {
- pixmap = d->findIcon(16, QLatin1String("player_pause.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("media-playback-pause")).pixmap(16);
break;
- }
case SP_MediaStop:
- {
- pixmap = d->findIcon(16, QLatin1String("player_stop.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("media-playback-stop")).pixmap(16);
break;
- }
case SP_MediaSeekForward:
- {
- pixmap = d->findIcon(16, QLatin1String("player_fwd.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("media-seek-forward")).pixmap(16);
break;
- }
case SP_MediaSeekBackward:
- {
- pixmap = d->findIcon(16, QLatin1String("player_rew.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("media-seek-backward")).pixmap(16);
break;
- }
case SP_MediaSkipForward:
- {
- pixmap = d->findIcon(16, QLatin1String("player_end.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("media-skip-backward")).pixmap(16);
break;
- }
case SP_MediaSkipBackward:
- {
- pixmap = d->findIcon(16, QLatin1String("player_start.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("media-skip-backward")).pixmap(16);
+ break;
+ case SP_DialogResetButton:
+ pixmap = QIcon::fromTheme(QLatin1String("edit-clear")).pixmap(24);
break;
+ case SP_DialogHelpButton:
+ pixmap = QIcon::fromTheme(QLatin1String("help-contents")).pixmap(24);
+ break;
+ case SP_DialogCancelButton:
+ pixmap = QIcon::fromTheme(QLatin1String("process-stop")).pixmap(24);
+ break;
+ case SP_DialogSaveButton:
+ pixmap = QIcon::fromTheme(QLatin1String("document-save")).pixmap(24);
+ break;
+ case SP_FileLinkIcon:
+ pixmap = QIcon::fromTheme(QLatin1String("emblem-symbolic-link")).pixmap(16);
+ if (!pixmap.isNull()) {
+ QPixmap fileIcon = QIcon::fromTheme(QLatin1String("text-x-generic")).pixmap(16);
+ if (fileIcon.isNull())
+ fileIcon = QIcon::fromTheme(QLatin1String("empty")).pixmap(16);
+ if (!fileIcon.isNull()) {
+ QPainter painter(&fileIcon);
+ painter.drawPixmap(0, 0, 16, 16, pixmap);
+ return fileIcon;
+ }
}
-
+ break;
+ case SP_DirLinkIcon:
+ pixmap = QIcon::fromTheme(QLatin1String("emblem-symbolic-link")).pixmap(16);
+ if (!pixmap.isNull()) {
+ QPixmap dirIcon = QIcon::fromTheme(QLatin1String("folder")).pixmap(16);
+ if (!dirIcon.isNull()) {
+ QPainter painter(&dirIcon);
+ painter.drawPixmap(0, 0, 16, 16, pixmap);
+ return dirIcon;
+ }
+ }
+ break;
default:
break;
}
}
-#endif //Q_WS_X11
+
+ if (!pixmap.isNull())
+ return pixmap;
#endif //QT_NO_IMAGEFORMAT_PNG
switch (sp) {
#ifndef QT_NO_IMAGEFORMAT_XPM
@@ -5786,254 +5509,178 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons
const QWidget *widget) const
{
QIcon icon;
- if (QApplication::desktopSettingsAware()) {
-#ifdef Q_WS_X11
- Q_D(const QCommonStyle);
- d->lookupIconTheme();
- QPixmap pixmap;
+ if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) {
switch (standardIcon) {
case SP_DirHomeIcon:
- {
- icon = d->createIcon(QLatin1String("folder_home.png"));
+ icon = QIcon::fromTheme(QLatin1String("user-home"));
break;
- }
case SP_MessageBoxInformation:
- {
- icon = d->createIcon(QLatin1String("dialog-information.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("messagebox_info.png"));
+ icon = QIcon::fromTheme(QLatin1String("dialog-information"));
break;
- }
case SP_MessageBoxWarning:
- {
- icon = d->createIcon(QLatin1String("dialog-warning.png"));
- icon = d->createIcon(QLatin1String("dialog-warning.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("messagebox_warning.png"));
+ icon = QIcon::fromTheme(QLatin1String("dialog-warning"));
break;
- }
case SP_MessageBoxCritical:
- {
- icon = d->createIcon(QLatin1String("dialog-error.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("messagebox_critical.png"));
+ icon = QIcon::fromTheme(QLatin1String("dialog-error"));
break;
- }
case SP_MessageBoxQuestion:
- {
- icon = d->createIcon(QLatin1String("help.png"));
+ icon = QIcon::fromTheme(QLatin1String("dialog-question"));
break;
- }
case SP_DialogOpenButton:
case SP_DirOpenIcon:
- {
- icon = d->createIcon(QLatin1String("folder-open.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("folder_open.png"));
+ icon = QIcon::fromTheme(QLatin1String("folder-open"));
break;
- }
case SP_FileIcon:
- {
- icon = d->createIcon(QLatin1String("text-x-generic.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("empty.png"));
+ icon = QIcon::fromTheme(QLatin1String("text-x-generic"));
break;
- }
case SP_DirClosedIcon:
case SP_DirIcon:
- {
- icon = d->createIcon(QLatin1String("folder.png"));
+ icon = QIcon::fromTheme(QLatin1String("folder"));
break;
- }
case SP_DriveFDIcon:
- {
- icon = d->createIcon(QLatin1String("floppy_unmount.png"));
+ icon = QIcon::fromTheme(QLatin1String("floppy_unmount"));
break;
- }
case SP_ComputerIcon:
- {
- icon = d->createIcon(QLatin1String("computer.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("system.png"));
+ icon = QIcon::fromTheme(QLatin1String("computer"),
+ QIcon::fromTheme(QLatin1String("system")));
break;
- }
case SP_DesktopIcon:
- {
- icon = d->createIcon(QLatin1String("user-desktop.png"));
+ icon = QIcon::fromTheme(QLatin1String("user-desktop"));
break;
- }
case SP_TrashIcon:
- {
- icon = d->createIcon(QLatin1String("user-trash.png"));
+ icon = QIcon::fromTheme(QLatin1String("user-trash"));
break;
- }
case SP_DriveCDIcon:
case SP_DriveDVDIcon:
- {
- icon = d->createIcon(QLatin1String("media-optical.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("cdrom_unmount.png"));
+ icon = QIcon::fromTheme(QLatin1String("media-optical"));
break;
- }
case SP_DriveHDIcon:
- {
- icon = d->createIcon(QLatin1String("drive-harddisk.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("hdd_unmount.png"));
+ icon = QIcon::fromTheme(QLatin1String("drive-harddisk"));
break;
- }
case SP_FileDialogToParent:
- {
- icon = d->createIcon(QLatin1String("go-up.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("up.png"));
+ icon = QIcon::fromTheme(QLatin1String("go-up"));
break;
- }
case SP_FileDialogNewFolder:
- {
- icon = d->createIcon(QLatin1String("folder_new.png"));
+ icon = QIcon::fromTheme(QLatin1String("folder-new"));
break;
- }
case SP_ArrowUp:
- {
- icon = d->createIcon(QLatin1String("go-up.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("up.png"));
+ icon = QIcon::fromTheme(QLatin1String("go-up"));
break;
- }
case SP_ArrowDown:
- {
- icon = d->createIcon(QLatin1String("go-down.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("down.png"));
+ icon = QIcon::fromTheme(QLatin1String("go-down"));
break;
- }
case SP_ArrowRight:
- {
- icon = d->createIcon(QLatin1String("go-next.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("forward.png"));
+ icon = QIcon::fromTheme(QLatin1String("go-next"));
break;
- }
case SP_ArrowLeft:
- {
- icon = d->createIcon(QLatin1String("go-previous.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("back.png"));
+ icon = QIcon::fromTheme(QLatin1String("go-previous"));
+ break;
+ case SP_DialogHelpButton:
+ icon = QIcon::fromTheme(QLatin1String("help-contents"));
+ break;
+ case SP_DialogCancelButton:
+ icon = QIcon::fromTheme(QLatin1String("process-stop"));
+ break;
+ case SP_DialogCloseButton:
+ icon = QIcon::fromTheme(QLatin1String("window-close"));
+ break;
+ case SP_DialogApplyButton:
+ icon = QIcon::fromTheme(QLatin1String("dialog-ok-apply"));
+ break;
+ case SP_DialogOkButton:
+ icon = QIcon::fromTheme(QLatin1String("dialog-ok"));
break;
- }
case SP_FileDialogDetailedView:
- {
- icon = d->createIcon(QLatin1String("view-list-details.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("view_detailed.png"));
+ icon = QIcon::fromTheme(QLatin1String("view-list-details"));
break;
- }
case SP_FileDialogListView:
- {
- icon = d->createIcon(QLatin1String("view-list-icons.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("view_icon.png"));
+ icon = QIcon::fromTheme(QLatin1String("view-list-icons"));
break;
- }
case SP_BrowserReload:
- {
- icon = d->createIcon(QLatin1String("view-refresh.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("reload.png"));
+ icon = QIcon::fromTheme(QLatin1String("view-refresh"));
break;
- }
case SP_BrowserStop:
- {
- icon = d->createIcon(QLatin1String("process-stop.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("stop.png"));
+ icon = QIcon::fromTheme(QLatin1String("process-stop"));
break;
- }
case SP_MediaPlay:
- {
- icon = d->createIcon(QLatin1String("media-playback-start.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("player_play.png"));
+ icon = QIcon::fromTheme(QLatin1String("media-playback-start"));
break;
- }
case SP_MediaPause:
- {
- icon = d->createIcon(QLatin1String("media-playback-pause.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("player_pause.png"));
+ icon = QIcon::fromTheme(QLatin1String("media-playback-pause"));
break;
- }
case SP_MediaStop:
- {
- icon = d->createIcon(QLatin1String("media-playback-stop.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("player_stop.png"));
+ icon = QIcon::fromTheme(QLatin1String("media-playback-stop"));
break;
- }
case SP_MediaSeekForward:
- {
- icon = d->createIcon(QLatin1String("media-skip-forward.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("player_fwd.png"));
+ icon = QIcon::fromTheme(QLatin1String("media-seek-forward"));
break;
- }
case SP_MediaSeekBackward:
- {
- icon = d->createIcon(QLatin1String("media-skip-backward.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("player_rew.png"));
+ icon = QIcon::fromTheme(QLatin1String("media-seek-backward"));
break;
- }
case SP_MediaSkipForward:
- {
- icon = d->createIcon(QLatin1String("media-skip-forward.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("player_end.png"));
+ icon = QIcon::fromTheme(QLatin1String("media-skip-forward"));
break;
- }
case SP_MediaSkipBackward:
- {
- icon = d->createIcon(QLatin1String("media-skip-backward.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("player_start.png"));
+ icon = QIcon::fromTheme(QLatin1String("media-skip-backward"));
break;
- }
-
- case SP_FileLinkIcon: {
- icon = QIcon(proxy()->standardPixmap(standardIcon, option, widget));
- QPixmap pixmap = d->findIcon(32, QLatin1String("link_overlay.png"));
- if (!pixmap.isNull()) {
- QPixmap fileIcon = d->findIcon(32, QLatin1String("text-x-generic.png"));
- if (fileIcon.isNull())
- fileIcon = d->findIcon(32, QLatin1String("empty.png"));
- if (!fileIcon.isNull()) {
- QPainter painter(&fileIcon);
- painter.drawPixmap(0, 0, 32, 32, pixmap);
- icon.addPixmap(fileIcon);
+ case SP_MediaVolume:
+ icon = QIcon::fromTheme(QLatin1String("audio-volume-medium"));
+ break;
+ case SP_MediaVolumeMuted:
+ icon = QIcon::fromTheme(QLatin1String("audio-volume-muted"));
+ break;
+ case SP_DialogResetButton:
+ icon = QIcon::fromTheme(QLatin1String("edit-clear"));
+ break;
+ case SP_ArrowForward:
+ if (QApplication::layoutDirection() == Qt::RightToLeft)
+ return standardIconImplementation(SP_ArrowLeft, option, widget);
+ return standardIconImplementation(SP_ArrowRight, option, widget);
+ case SP_ArrowBack:
+ if (QApplication::layoutDirection() == Qt::RightToLeft)
+ return standardIconImplementation(SP_ArrowRight, option, widget);
+ return standardIconImplementation(SP_ArrowLeft, option, widget);
+ case SP_FileLinkIcon:
+ {
+ QIcon linkIcon = QIcon::fromTheme(QLatin1String("emblem-symbolic-link"));
+ if (!linkIcon.isNull()) {
+ QIcon baseIcon = standardIconImplementation(SP_FileIcon, option, widget);
+ const QList<QSize> sizes = baseIcon.availableSizes(QIcon::Normal, QIcon::Off);
+ for (int i = 0 ; i < sizes.size() ; ++i) {
+ int size = sizes[i].width();
+ QPixmap basePixmap = baseIcon.pixmap(size);
+ QPixmap linkPixmap = linkIcon.pixmap(size/2);
+ QPainter painter(&basePixmap);
+ painter.drawPixmap(size/2, size/2, linkPixmap);
+ icon.addPixmap(basePixmap);
+ }
}
}
- }
- break;
- case SP_DirLinkIcon: {
- icon = QIcon(proxy()->standardPixmap(standardIcon, option, widget));
- QPixmap pixmap = d->findIcon(32, QLatin1String("link_overlay.png"));
- if (!pixmap.isNull()) {
- QPixmap fileIcon = d->findIcon(32, QLatin1String("folder.png"));
- if (!fileIcon.isNull()) {
- QPainter painter(&fileIcon);
- painter.drawPixmap(0, 0, 32, 32, pixmap);
- icon.addPixmap(fileIcon);
+ break;
+ case SP_DirLinkIcon:
+ {
+ QIcon linkIcon = QIcon::fromTheme(QLatin1String("emblem-symbolic-link"));
+ if (!linkIcon.isNull()) {
+ QIcon baseIcon = standardIconImplementation(SP_DirIcon, option, widget);
+ const QList<QSize> sizes = baseIcon.availableSizes(QIcon::Normal, QIcon::Off);
+ for (int i = 0 ; i < sizes.size() ; ++i) {
+ int size = sizes[i].width();
+ QPixmap basePixmap = baseIcon.pixmap(size);
+ QPixmap linkPixmap = linkIcon.pixmap(size/2);
+ QPainter painter(&basePixmap);
+ painter.drawPixmap(size/2, size/2, linkPixmap);
+ icon.addPixmap(basePixmap);
+ }
}
- }
}
break;
default:
break;
}
+
if (!icon.isNull())
return icon;
-#elif defined(Q_WS_MAC)
+#if defined(Q_WS_MAC)
OSType iconType = 0;
switch (standardIcon) {
case QStyle::SP_MessageBoxQuestion:
@@ -6124,11 +5771,9 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons
ReleaseIconRef(overlayIcon);
return retIcon;
}
-
-#endif //Q_WS_X11 || Q_WS_MAC
+#endif // Q_WS_MAC
}
-
switch (standardIcon) {
#ifndef QT_NO_IMAGEFORMAT_PNG
case SP_FileDialogNewFolder:
diff --git a/src/gui/styles/qcommonstyle_p.h b/src/gui/styles/qcommonstyle_p.h
index f2af5b23b..cff46e69d 100644
--- a/src/gui/styles/qcommonstyle_p.h
+++ b/src/gui/styles/qcommonstyle_p.h
@@ -122,20 +122,7 @@ public:
}
#endif
mutable QIcon tabBarcloseButtonIcon;
-
-//icon detection on X11
-#ifdef Q_WS_X11
- void lookupIconTheme() const;
int lookupToolButtonStyle() const;
- QIcon createIcon(const QString &) const;
- QPixmap findIcon(int size, const QString &) const;
- QPixmap findIconHelper(int size, const QString &, const QString &, QStringList &visited) const;
- QIconTheme parseIndexFile(const QString &themeName) const;
- mutable QString themeName;
- mutable QStringList iconDirs;
- mutable QHash <QString, QIconTheme> themeList;
-#endif
-
};
QT_END_NAMESPACE
diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp
index 660b4c3de..5f562305f 100644
--- a/src/gui/styles/qgtkstyle.cpp
+++ b/src/gui/styles/qgtkstyle.cpp
@@ -1,4 +1,4 @@
-/******* *********************************************************************
+/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -3239,6 +3239,7 @@ QSize QGtkStyle::sizeFromContents(ContentsType type, const QStyleOption *option,
return newSize;
}
+
/*! \reimp */
QPixmap QGtkStyle::standardPixmap(StandardPixmap sp, const QStyleOption *option,
const QWidget *widget) const
@@ -3271,65 +3272,80 @@ QPixmap QGtkStyle::standardPixmap(StandardPixmap sp, const QStyleOption *option,
}
break;
- case SP_DialogDiscardButton: {
+ case SP_DialogDiscardButton:
return QGtkPainter::getIcon(GTK_STOCK_DELETE);
- }
-
- case SP_DialogOkButton: {
+ case SP_DialogOkButton:
return QGtkPainter::getIcon(GTK_STOCK_OK);
- }
-
- case SP_DialogCancelButton: {
+ case SP_DialogCancelButton:
return QGtkPainter::getIcon(GTK_STOCK_CANCEL);
- }
-
- case SP_DialogYesButton: {
+ case SP_DialogYesButton:
return QGtkPainter::getIcon(GTK_STOCK_YES);
- }
-
- case SP_DialogNoButton: {
+ case SP_DialogNoButton:
return QGtkPainter::getIcon(GTK_STOCK_NO);
- }
-
- case SP_DialogOpenButton: {
+ case SP_DialogOpenButton:
return QGtkPainter::getIcon(GTK_STOCK_OPEN);
- }
-
- case SP_DialogCloseButton: {
+ case SP_DialogCloseButton:
return QGtkPainter::getIcon(GTK_STOCK_CLOSE);
- }
-
- case SP_DialogApplyButton: {
+ case SP_DialogApplyButton:
return QGtkPainter::getIcon(GTK_STOCK_APPLY);
- }
-
- case SP_DialogSaveButton: {
+ case SP_DialogSaveButton:
return QGtkPainter::getIcon(GTK_STOCK_SAVE);
- }
-
- case SP_MessageBoxWarning: {
+ case SP_MessageBoxWarning:
return QGtkPainter::getIcon(GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG);
- }
-
- case SP_MessageBoxQuestion: {
+ case SP_MessageBoxQuestion:
return QGtkPainter::getIcon(GTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG);
- }
-
- case SP_MessageBoxInformation: {
+ case SP_MessageBoxInformation:
return QGtkPainter::getIcon(GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
- }
-
- case SP_MessageBoxCritical: {
+ case SP_MessageBoxCritical:
return QGtkPainter::getIcon(GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_DIALOG);
- }
-
default:
return QCleanlooksStyle::standardPixmap(sp, option, widget);
}
+ return pixmap;
+}
- return QPixmap();
+/*!
+ \internal
+*/
+QIcon QGtkStyle::standardIconImplementation(StandardPixmap standardIcon,
+ const QStyleOption *option,
+ const QWidget *widget) const
+{
+ if (!QGtk::isThemeAvailable())
+ return QCleanlooksStyle::standardIconImplementation(standardIcon, option, widget);
+ switch (standardIcon) {
+ case SP_DialogDiscardButton:
+ return QGtkPainter::getIcon(GTK_STOCK_DELETE);
+ case SP_DialogOkButton:
+ return QGtkPainter::getIcon(GTK_STOCK_OK);
+ case SP_DialogCancelButton:
+ return QGtkPainter::getIcon(GTK_STOCK_CANCEL);
+ case SP_DialogYesButton:
+ return QGtkPainter::getIcon(GTK_STOCK_YES);
+ case SP_DialogNoButton:
+ return QGtkPainter::getIcon(GTK_STOCK_NO);
+ case SP_DialogOpenButton:
+ return QGtkPainter::getIcon(GTK_STOCK_OPEN);
+ case SP_DialogCloseButton:
+ return QGtkPainter::getIcon(GTK_STOCK_CLOSE);
+ case SP_DialogApplyButton:
+ return QGtkPainter::getIcon(GTK_STOCK_APPLY);
+ case SP_DialogSaveButton:
+ return QGtkPainter::getIcon(GTK_STOCK_SAVE);
+ case SP_MessageBoxWarning:
+ return QGtkPainter::getIcon(GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG);
+ case SP_MessageBoxQuestion:
+ return QGtkPainter::getIcon(GTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG);
+ case SP_MessageBoxInformation:
+ return QGtkPainter::getIcon(GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
+ case SP_MessageBoxCritical:
+ return QGtkPainter::getIcon(GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_DIALOG);
+ default:
+ return QCleanlooksStyle::standardIconImplementation(standardIcon, option, widget);
+ }
}
+
/*! \reimp */
QRect QGtkStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const
{
diff --git a/src/gui/styles/qgtkstyle.h b/src/gui/styles/qgtkstyle.h
index e12f175f1..f12de521c 100644
--- a/src/gui/styles/qgtkstyle.h
+++ b/src/gui/styles/qgtkstyle.h
@@ -106,6 +106,10 @@ public:
void unpolish(QWidget *widget);
void unpolish(QApplication *app);
+
+protected Q_SLOTS:
+ QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option,
+ const QWidget *widget = 0) const;
};
diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm
index 2f930343f..235cba615 100644
--- a/src/gui/styles/qmacstyle_mac.mm
+++ b/src/gui/styles/qmacstyle_mac.mm
@@ -5510,9 +5510,15 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op
break;
}
case SC_SpinBoxEditField:
- ret.setRect(fw, fw,
- spin->rect.width() - spinner_w - fw * 2 - spinBoxSep,
- spin->rect.height() - fw * 2);
+ if (spin->buttonSymbols == QAbstractSpinBox::NoButtons) {
+ ret.setRect(fw, fw,
+ spin->rect.width() - fw * 2,
+ spin->rect.height() - fw * 2);
+ } else {
+ ret.setRect(fw, fw,
+ spin->rect.width() - fw * 2 - spinBoxSep - spinner_w,
+ spin->rect.height() - fw * 2);
+ }
ret = visualRect(spin->direction, spin->rect, ret);
break;
default:
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp
index 2efa4a779..5f6d4ab6c 100644
--- a/src/gui/styles/qstylesheetstyle.cpp
+++ b/src/gui/styles/qstylesheetstyle.cpp
@@ -2891,8 +2891,8 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
bool customUp = true, customDown = true;
QRenderRule upRule = renderRule(w, opt, PseudoElement_SpinBoxUpButton);
QRenderRule downRule = renderRule(w, opt, PseudoElement_SpinBoxDownButton);
- bool upRuleMatch = upRule.hasGeometry();
- bool downRuleMatch = downRule.hasGeometry();
+ bool upRuleMatch = upRule.hasGeometry() || upRule.hasPosition();
+ bool downRuleMatch = downRule.hasGeometry() || downRule.hasPosition();
if (rule.hasNativeBorder() && !upRuleMatch && !downRuleMatch) {
rule.drawBackgroundImage(p, spinOpt.rect);
customUp = (opt->subControls & QStyle::SC_SpinBoxUp)
@@ -5167,8 +5167,8 @@ QRect QStyleSheetStyle::subControlRect(ComplexControl cc, const QStyleOptionComp
QRenderRule upRule = renderRule(w, opt, PseudoElement_SpinBoxUpButton);
QRenderRule downRule = renderRule(w, opt, PseudoElement_SpinBoxDownButton);
bool ruleMatch = rule.hasBox() || !rule.hasNativeBorder();
- bool upRuleMatch = upRule.hasGeometry();
- bool downRuleMatch = downRule.hasGeometry();
+ bool upRuleMatch = upRule.hasGeometry() || upRule.hasPosition();
+ bool downRuleMatch = downRule.hasGeometry() || upRule.hasPosition();
if (ruleMatch || upRuleMatch || downRuleMatch) {
switch (sc) {
case SC_SpinBoxFrame:
diff --git a/src/gui/styles/qwindowscestyle.cpp b/src/gui/styles/qwindowscestyle.cpp
index 997fc722f..cd13dd8a7 100644
--- a/src/gui/styles/qwindowscestyle.cpp
+++ b/src/gui/styles/qwindowscestyle.cpp
@@ -1951,7 +1951,11 @@ QRect QWindowsCEStyle::subControlRect(ComplexControl control, const QStyleOption
rect = QRect(x, y , bs.width(), bs.height());
break;
case SC_SpinBoxEditField:
- rect = QRect(lx, fw, rx-2, spinbox->rect.height() - 2*fw);
+ if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) {
+ rect = QRect(lx, fw, spinbox->rect.width() - 2*fw - 2, spinbox->rect.height() - 2*fw);
+ } else {
+ rect = QRect(lx, fw, rx-2, spinbox->rect.height() - 2*fw);
+ }
break;
case SC_SpinBoxFrame:
rect = spinbox->rect;
diff --git a/src/gui/styles/qwindowsmobilestyle.cpp b/src/gui/styles/qwindowsmobilestyle.cpp
index c70b4c83f..e7080423e 100644
--- a/src/gui/styles/qwindowsmobilestyle.cpp
+++ b/src/gui/styles/qwindowsmobilestyle.cpp
@@ -2984,7 +2984,11 @@ QRect QWindowsMobileStyle::subControlRect(ComplexControl control, const QStyleOp
rect = QRect(x + bs.width(), 0, bs.width(), bs.height());
break;
case SC_SpinBoxEditField:
+ if (spinBox->buttonSymbols == QAbstractSpinBox::NoButtons) {
+ rect = QRect(lx, fw, spinBox->rect.width() - 2*fw - 2, spinBox->rect.height() - 2*fw);
+ } else {
rect = QRect(lx, fw, rx-2, spinBox->rect.height() - 2*fw);
+ }
break;
case SC_SpinBoxFrame:
rect = spinBox->rect;
diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp
index dd92e17eb..f6c1892ec 100644
--- a/src/gui/widgets/qabstractscrollarea.cpp
+++ b/src/gui/widgets/qabstractscrollarea.cpp
@@ -159,7 +159,7 @@ QT_BEGIN_NAMESPACE
QAbstractScrollAreaPrivate::QAbstractScrollAreaPrivate()
:hbar(0), vbar(0), vbarpolicy(Qt::ScrollBarAsNeeded), hbarpolicy(Qt::ScrollBarAsNeeded),
viewport(0), cornerWidget(0), left(0), top(0), right(0), bottom(0),
- xoffset(0), yoffset(0), viewportFilter(0)
+ xoffset(0), yoffset(0), viewportFilter(0), panGesture(0)
#ifdef Q_WS_WIN
, singleFingerPanEnabled(false)
#endif
@@ -294,33 +294,18 @@ void QAbstractScrollAreaPrivate::init()
q->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
q->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
layoutChildren();
+
+ panGesture = new QPanGesture(q);
+ QObject::connect(panGesture, SIGNAL(triggered()), q, SLOT(_q_gestureTriggered()));
}
-void QAbstractScrollAreaPrivate::setupGestures()
+#ifdef Q_WS_WIN
+void QAbstractScrollAreaPrivate::setSingleFingerPanEnabled(bool on)
{
-#ifdef Q_OS_WIN
- if (!viewport)
- return;
- QApplicationPrivate* getQApplicationPrivateInternal();
- QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal();
- bool needh = (hbarpolicy == Qt::ScrollBarAlwaysOn
- || (hbarpolicy == Qt::ScrollBarAsNeeded && hbar->minimum() < hbar->maximum()));
-
- bool needv = (vbarpolicy == Qt::ScrollBarAlwaysOn
- || (vbarpolicy == Qt::ScrollBarAsNeeded && vbar->minimum() < vbar->maximum()));
- if (qAppPriv->SetGestureConfig && (needh || needv)) {
- GESTURECONFIG gc[1];
- gc[0].dwID = GID_PAN;
- gc[0].dwWant = GC_PAN;
- gc[0].dwBlock = 0;
- if (needv && singleFingerPanEnabled)
- gc[0].dwWant |= GC_PAN_WITH_SINGLE_FINGER_VERTICALLY;
- if (needh && singleFingerPanEnabled)
- gc[0].dwWant |= GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY;
- qAppPriv->SetGestureConfig(viewport->winId(), 0, 1, gc, sizeof(gc));
- }
-#endif // Q_OS_WIN
+ singleFingerPanEnabled = on;
+ winSetupGestures();
}
+#endif // Q_WS_WIN
void QAbstractScrollAreaPrivate::layoutChildren()
{
@@ -1267,7 +1252,11 @@ void QAbstractScrollAreaPrivate::_q_vslide(int y)
void QAbstractScrollAreaPrivate::_q_showOrHideScrollBars()
{
layoutChildren();
- setupGestures();
+#ifdef Q_OS_WIN
+ // Need to re-subscribe to gestures as the content changes to make sure we
+ // enable/disable panning when needed.
+ winSetupGestures();
+#endif // Q_OS_WIN
}
QPoint QAbstractScrollAreaPrivate::contentsOffset() const
@@ -1332,6 +1321,25 @@ void QAbstractScrollArea::setupViewport(QWidget *viewport)
Q_UNUSED(viewport);
}
+void QAbstractScrollAreaPrivate::_q_gestureTriggered()
+{
+ Q_Q(QAbstractScrollArea);
+ QPanGesture *g = qobject_cast<QPanGesture*>(q->sender());
+ if (!g)
+ return;
+ QScrollBar *hBar = q->horizontalScrollBar();
+ QScrollBar *vBar = q->verticalScrollBar();
+ QSize delta = g->lastOffset();
+ if (!delta.isNull()) {
+ if (QApplication::isRightToLeft())
+ delta.rwidth() *= -1;
+ int newX = hBar->value() - delta.width();
+ int newY = vBar->value() - delta.height();
+ hbar->setValue(newX);
+ vbar->setValue(newY);
+ }
+}
+
QT_END_NAMESPACE
#include "moc_qabstractscrollarea.cpp"
diff --git a/src/gui/widgets/qabstractscrollarea.h b/src/gui/widgets/qabstractscrollarea.h
index 3ec41d1e3..9178629af 100644
--- a/src/gui/widgets/qabstractscrollarea.h
+++ b/src/gui/widgets/qabstractscrollarea.h
@@ -128,8 +128,10 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_hslide(int))
Q_PRIVATE_SLOT(d_func(), void _q_vslide(int))
Q_PRIVATE_SLOT(d_func(), void _q_showOrHideScrollBars())
+ Q_PRIVATE_SLOT(d_func(), void _q_gestureTriggered())
friend class QStyleSheetStyle;
+ friend class QWidgetPrivate;
};
#endif // QT_NO_SCROLLAREA
diff --git a/src/gui/widgets/qabstractscrollarea_p.h b/src/gui/widgets/qabstractscrollarea_p.h
index aef8ac5d4..8011ed5bb 100644
--- a/src/gui/widgets/qabstractscrollarea_p.h
+++ b/src/gui/widgets/qabstractscrollarea_p.h
@@ -60,6 +60,7 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_SCROLLAREA
+class QPanGesture;
class QScrollBar;
class QAbstractScrollAreaScrollBarContainer;
class Q_AUTOTEST_EXPORT QAbstractScrollAreaPrivate: public QFramePrivate
@@ -100,10 +101,12 @@ public:
{ return q_func()->viewportEvent(event); }
QObject *viewportFilter;
+ virtual void _q_gestureTriggered();
+ QPanGesture *panGesture;
#ifdef Q_WS_WIN
bool singleFingerPanEnabled;
+ void setSingleFingerPanEnabled(bool on = true);
#endif
- void setupGestures();
};
class QAbstractScrollAreaFilter : public QObject
diff --git a/src/gui/widgets/qdatetimeedit.cpp b/src/gui/widgets/qdatetimeedit.cpp
index 5ddf7f774..cb7687608 100644
--- a/src/gui/widgets/qdatetimeedit.cpp
+++ b/src/gui/widgets/qdatetimeedit.cpp
@@ -1086,10 +1086,6 @@ void QDateTimeEdit::keyPressEvent(QKeyEvent *event)
//hide cursor
d->edit->d_func()->setCursorVisible(false);
- if (d->edit->d_func()->cursorTimer > 0)
- killTimer(d->edit->d_func()->cursorTimer);
- d->edit->d_func()->cursorTimer = 0;
-
d->setSelected(0);
}
}
diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp
index ee29b55f4..cad69036a 100644
--- a/src/gui/widgets/qdockarealayout.cpp
+++ b/src/gui/widgets/qdockarealayout.cpp
@@ -1545,7 +1545,7 @@ void QDockAreaLayoutInfo::apply(bool animate)
QRect geo = w->geometry();
widgetAnimator.animate(w, r, animate);
- if (!w->isHidden()) {
+ if (!w->isHidden() && w->window()->isVisible()) {
QDockWidget *dw = qobject_cast<QDockWidget*>(w);
if (!r.isValid() && geo.right() >= 0 && geo.bottom() >= 0) {
dw->lower();
diff --git a/src/gui/widgets/qdockwidget.cpp b/src/gui/widgets/qdockwidget.cpp
index 5810c81c3..e60f099d9 100644
--- a/src/gui/widgets/qdockwidget.cpp
+++ b/src/gui/widgets/qdockwidget.cpp
@@ -1390,7 +1390,7 @@ bool QDockWidget::event(QEvent *event)
break;
case QEvent::Show:
d->toggleViewAction->setChecked(true);
- emit visibilityChanged(true);
+ emit visibilityChanged(geometry().right() >= 0 && geometry().bottom() >= 0);
break;
#endif
case QEvent::ApplicationLayoutDirectionChange:
diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp
index f68d2875f..f4a2348f3 100644
--- a/src/gui/widgets/qlinecontrol.cpp
+++ b/src/gui/widgets/qlinecontrol.cpp
@@ -257,6 +257,7 @@ void QLineControl::setSelection(int start, int length)
m_cursor = m_selstart;
}
emit selectionChanged();
+ emitCursorPositionChanged();
}
void QLineControl::_q_clipboardChanged()
@@ -1295,7 +1296,7 @@ bool QLineControl::processEvent(QEvent* ev)
}
if ((ev->type() == QEvent::KeyRelease)
&& !isReadOnly()
- && deleteAllTimer) {
+ && m_deleteAllTimer) {
killTimer(m_deleteAllTimer);
m_deleteAllTimer = 0;
backspace();
@@ -1701,12 +1702,12 @@ void QLineControl::processKeyEvent(QKeyEvent* event)
if (text().length() == 0) {
setText(m_cancelText);
- if (passwordEchoEditing)
+ if (passwordEchoEditing())
updatePasswordEchoEditing(false);
- setEditFocus(false);
- } else if (!deleteAllTimer) {
- deleteAllTimer = startTimer(750);
+ emit editFocusChange(false);
+ } else if (!m_deleteAllTimer) {
+ m_deleteAllTimer = startTimer(750);
}
} else {
unknown = true;
diff --git a/src/gui/widgets/qlinecontrol_p.h b/src/gui/widgets/qlinecontrol_p.h
index 9cad857c4..ad4e4e4df 100644
--- a/src/gui/widgets/qlinecontrol_p.h
+++ b/src/gui/widgets/qlinecontrol_p.h
@@ -343,6 +343,9 @@ Q_SIGNALS:
void editingFinished();
void updateNeeded(const QRect &);
+#ifdef QT_KEYPAD_NAVIGATION
+ void editFocusChange(bool);
+#endif
protected:
virtual void timerEvent(QTimerEvent *event);
@@ -638,7 +641,7 @@ inline void QLineControl::setCursorPosition(int pos)
{
if (pos < 0)
pos = 0;
- if (pos < m_text.length())
+ if (pos <= m_text.length())
moveCursor(pos);
}
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp
index e0f5bc965..9f315fd7a 100644
--- a/src/gui/widgets/qlineedit.cpp
+++ b/src/gui/widgets/qlineedit.cpp
@@ -1669,7 +1669,7 @@ void QLineEdit::focusInEvent(QFocusEvent *e)
selectAll();
}
#ifdef QT_KEYPAD_NAVIGATION
- if (!QApplication::keypadNavigationEnabled() || (hasEditFocus() && e->reason() == Qt::PopupFocusReason))
+ if (!QApplication::keypadNavigationEnabled() || (hasEditFocus() && e->reason() == Qt::PopupFocusReason)){
#endif
int cft = QApplication::cursorFlashTime();
d->control->setCursorBlinkPeriod(cft/2);
@@ -1683,7 +1683,8 @@ void QLineEdit::focusInEvent(QFocusEvent *e)
qt_mac_secure_keyboard(true);
#endif
#ifdef QT_KEYPAD_NAVIGATION
- d->control->setCancelText(d->text);
+ d->control->setCancelText(d->control->text());
+ }
#endif
#ifndef QT_NO_COMPLETER
if (d->control->completer()) {
diff --git a/src/gui/widgets/qlineedit.h b/src/gui/widgets/qlineedit.h
index daac6a753..32ef6a459 100644
--- a/src/gui/widgets/qlineedit.h
+++ b/src/gui/widgets/qlineedit.h
@@ -273,6 +273,9 @@ private:
#ifndef QT_NO_COMPLETER
Q_PRIVATE_SLOT(d_func(), void _q_completionHighlighted(QString))
#endif
+#ifdef QT_KEYPAD_NAVIGATION
+ Q_PRIVATE_SLOT(d_func(), void _q_editFocusChange(bool))
+#endif
};
#endif // QT_NO_LINEEDIT
diff --git a/src/gui/widgets/qlineedit_p.cpp b/src/gui/widgets/qlineedit_p.cpp
index f0ec8adee..d90723395 100644
--- a/src/gui/widgets/qlineedit_p.cpp
+++ b/src/gui/widgets/qlineedit_p.cpp
@@ -126,6 +126,14 @@ void QLineEditPrivate::_q_cursorPositionChanged(int from, int to)
emit q->cursorPositionChanged(from, to);
}
+#ifdef QT_KEYPAD_NAVIGATION
+void QLineEditPrivate::_q_editFocusChange(bool e)
+{
+ Q_Q(QLineEdit);
+ q->setEditFocus(e);
+}
+#endif
+
void QLineEditPrivate::init(const QString& txt)
{
Q_Q(QLineEdit);
@@ -142,6 +150,10 @@ void QLineEditPrivate::init(const QString& txt)
q, SIGNAL(returnPressed()));
QObject::connect(control, SIGNAL(editingFinished()),
q, SIGNAL(editingFinished()));
+#ifdef QT_KEYPAD_NAVIGATION
+ QObject::connect(control, SIGNAL(editFocusChange(bool)),
+ q, SLOT(_q_editFocusChange(bool)));
+#endif
// for now, going completely overboard with updates.
QObject::connect(control, SIGNAL(selectionChanged()),
@@ -149,6 +161,9 @@ void QLineEditPrivate::init(const QString& txt)
QObject::connect(control, SIGNAL(displayTextChanged(const QString &)),
q, SLOT(update()));
+
+ QObject::connect(control, SIGNAL(updateNeeded(const QRect &)),
+ q, SLOT(update()));
control->setPasswordCharacter(q->style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter));
#ifndef QT_NO_CURSOR
q->setCursor(Qt::IBeamCursor);
diff --git a/src/gui/widgets/qlineedit_p.h b/src/gui/widgets/qlineedit_p.h
index 230023de3..976e31fda 100644
--- a/src/gui/widgets/qlineedit_p.h
+++ b/src/gui/widgets/qlineedit_p.h
@@ -125,6 +125,9 @@ public:
void _q_deleteSelected();
void _q_textEdited(const QString &);
void _q_cursorPositionChanged(int, int);
+#ifdef QT_KEYPAD_NAVIGATION
+ void _q_editFocusChange(bool);
+#endif
#ifndef QT_NO_COMPLETER
void _q_completionHighlighted(QString);
diff --git a/src/gui/widgets/qmainwindowlayout.cpp b/src/gui/widgets/qmainwindowlayout.cpp
index 3936a6781..55afa7029 100644
--- a/src/gui/widgets/qmainwindowlayout.cpp
+++ b/src/gui/widgets/qmainwindowlayout.cpp
@@ -1988,6 +1988,9 @@ void QMainWindowLayout::timerEvent(QTimerEvent *e)
if (movingSeparatorOrigin == movingSeparatorPos)
return;
+ //when moving the separator, we need to update the previous position
+ parentWidget()->update(layoutState.dockAreaLayout.separatorRegion());
+
layoutState = savedState;
layoutState.dockAreaLayout.separatorMove(movingSeparator, movingSeparatorOrigin,
movingSeparatorPos);
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp
index 67bb10a9f..ccf81f8e5 100644
--- a/src/gui/widgets/qmenu.cpp
+++ b/src/gui/widgets/qmenu.cpp
@@ -204,6 +204,8 @@ void QMenuPrivate::updateActionRects() const
Q_Q(const QMenu);
if (!itemsDirty)
return;
+
+ q->ensurePolished();
//let's reinitialize the buffer
actionRects.resize(actions.count());
@@ -225,13 +227,17 @@ void QMenuPrivate::updateActionRects() const
dh = popupGeometry(QApplication::desktop()->screenNumber(q)).height(),
y = 0;
QStyle *style = q->style();
- const int hmargin = style->pixelMetric(QStyle::PM_MenuHMargin, 0, q),
- vmargin = style->pixelMetric(QStyle::PM_MenuVMargin, 0, q),
- icone = style->pixelMetric(QStyle::PM_SmallIconSize, 0, q);
- const int fw = style->pixelMetric(QStyle::PM_MenuPanelWidth, 0, q);
-
- const int sfcMargin = style->sizeFromContents(QStyle::CT_Menu, 0, QApplication::globalStrut(), q).width() - QApplication::globalStrut().width();
+ QStyleOption opt;
+ opt.init(q);
+ const int hmargin = style->pixelMetric(QStyle::PM_MenuHMargin, &opt, q),
+ vmargin = style->pixelMetric(QStyle::PM_MenuVMargin, &opt, q),
+ icone = style->pixelMetric(QStyle::PM_SmallIconSize, &opt, q);
+ const int fw = style->pixelMetric(QStyle::PM_MenuPanelWidth, &opt, q);
+ const int deskFw = style->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, &opt, q);
+
+ const int sfcMargin = style->sizeFromContents(QStyle::CT_Menu, &opt, QApplication::globalStrut(), q).width() - QApplication::globalStrut().width();
const int min_column_width = q->minimumWidth() - (sfcMargin + leftmargin + rightmargin + 2 * (fw + hmargin));
+ const int tearoffHeight = tearoff ? style->pixelMetric(QStyle::PM_MenuTearoffHeight, &opt, q) : 0;
//for compatability now - will have to refactor this away..
tabWidth = 0;
@@ -307,7 +313,7 @@ void QMenuPrivate::updateActionRects() const
max_column_width = qMax(min_column_width, qMax(max_column_width, sz.width()));
//wrapping
if (!scroll &&
- y+sz.height()+vmargin > dh - (style->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, 0, q) * 2)) {
+ y+sz.height()+vmargin > dh - (deskFw * 2)) {
ncols++;
y = vmargin;
}
@@ -322,7 +328,7 @@ void QMenuPrivate::updateActionRects() const
//calculate position
const int base_y = vmargin + fw + topmargin +
(scroll ? scroll->scrollOffset : 0) +
- (tearoff ? style->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, q) : 0);
+ tearoffHeight;
int x = hmargin + fw + leftmargin;
y = base_y;
@@ -331,7 +337,7 @@ void QMenuPrivate::updateActionRects() const
if (rect.isNull())
continue;
if (!scroll &&
- y+rect.height() > dh - (style->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, 0, q) * 2)) {
+ y+rect.height() > dh - deskFw * 2) {
x += max_column_width + hmargin;
y = base_y;
}
@@ -1701,12 +1707,9 @@ QRect QMenu::actionGeometry(QAction *act) const
QSize QMenu::sizeHint() const
{
Q_D(const QMenu);
- ensurePolished();
d->updateActionRects();
QSize s;
- QStyleOption opt(0);
- opt.init(this);
for (int i = 0; i < d->actionRects.count(); ++i) {
const QRect &rect = d->actionRects.at(i);
if (rect.isNull())
@@ -1719,15 +1722,11 @@ QSize QMenu::sizeHint() const
// Note that the action rects calculated above already include
// the top and left margins, so we only need to add margins for
// the bottom and right.
- if (const int fw = style()->pixelMetric(QStyle::PM_MenuPanelWidth, &opt, this)) {
- s.rwidth() += fw;
- s.rheight() += fw;
- }
-
- s.rwidth() += style()->pixelMetric(QStyle::PM_MenuHMargin, &opt, this);
- s.rheight() += style()->pixelMetric(QStyle::PM_MenuVMargin, &opt, this);
-
- s += QSize(d->rightmargin, d->bottommargin);
+ QStyleOption opt(0);
+ opt.init(this);
+ const int fw = style()->pixelMetric(QStyle::PM_MenuPanelWidth, &opt, this);
+ s.rwidth() += style()->pixelMetric(QStyle::PM_MenuHMargin, &opt, this) + fw + d->rightmargin;
+ s.rheight() += style()->pixelMetric(QStyle::PM_MenuVMargin, &opt, this) + fw + d->bottommargin;
return style()->sizeFromContents(QStyle::CT_Menu, &opt,
s.expandedTo(QApplication::globalStrut()), this);
diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp
index 4a900d6b4..389b65f9d 100644
--- a/src/gui/widgets/qmenubar.cpp
+++ b/src/gui/widgets/qmenubar.cpp
@@ -272,6 +272,9 @@ QRect QMenuBarPrivate::actionRect(QAction *act) const
//makes sure the geometries are up-to-date
const_cast<QMenuBarPrivate*>(this)->updateGeometries();
+ if (index >= actionRects.count())
+ return QRect(); // that can happen in case of native menubar
+
QRect ret = actionRects.at(index);
return QStyle::visualRect(q->layoutDirection(), q->rect(), ret);
}
diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp
index c095f5c33..0a41d74b6 100644
--- a/src/gui/widgets/qtextedit.cpp
+++ b/src/gui/widgets/qtextedit.cpp
@@ -114,7 +114,7 @@ QTextEditPrivate::QTextEditPrivate()
showCursorOnInitialShow = true;
inDrag = false;
#ifdef Q_WS_WIN
- singleFingerPanEnabled = true;
+ setSingleFingerPanEnabled(true);
#endif
}
@@ -183,8 +183,6 @@ void QTextEditPrivate::init(const QString &html)
#ifndef QT_NO_CURSOR
viewport->setCursor(Qt::IBeamCursor);
#endif
- panGesture = new QPanGesture(q);
- QObject::connect(panGesture, SIGNAL(triggered()), q, SLOT(_q_gestureTriggered()));
}
void QTextEditPrivate::_q_repaintContents(const QRectF &contentsRect)
@@ -2617,26 +2615,6 @@ void QTextEdit::ensureCursorVisible()
d->control->ensureCursorVisible();
}
-void QTextEditPrivate::_q_gestureTriggered()
-{
- Q_Q(QTextEdit);
- QPanGesture *g = qobject_cast<QPanGesture*>(q->sender());
- if (!g)
- return;
- QScrollBar *hBar = q->horizontalScrollBar();
- QScrollBar *vBar = q->verticalScrollBar();
- QSize delta = g->lastOffset();
- if (!delta.isNull()) {
- if (QApplication::isRightToLeft())
- delta.rwidth() *= -1;
- int newX = hBar->value() - delta.width();
- int newY = vBar->value() - delta.height();
- hbar->setValue(newX);
- vbar->setValue(newY);
- }
-}
-
-
/*!
\enum QTextEdit::KeyboardAction
diff --git a/src/gui/widgets/qtextedit.h b/src/gui/widgets/qtextedit.h
index 9e10e077c..617822a09 100644
--- a/src/gui/widgets/qtextedit.h
+++ b/src/gui/widgets/qtextedit.h
@@ -414,7 +414,6 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_currentCharFormatChanged(const QTextCharFormat &))
Q_PRIVATE_SLOT(d_func(), void _q_adjustScrollbars())
Q_PRIVATE_SLOT(d_func(), void _q_ensureVisible(const QRectF &))
- Q_PRIVATE_SLOT(d_func(), void _q_gestureTriggered())
friend class QTextEditControl;
friend class QTextDocument;
friend class QTextControl;
diff --git a/src/gui/widgets/qtextedit_p.h b/src/gui/widgets/qtextedit_p.h
index 249331e8a..3d14af623 100644
--- a/src/gui/widgets/qtextedit_p.h
+++ b/src/gui/widgets/qtextedit_p.h
@@ -70,7 +70,6 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_TEXTEDIT
class QMimeData;
-class QPanGesture;
class QTextEditPrivate : public QAbstractScrollAreaPrivate
{
Q_DECLARE_PUBLIC(QTextEdit)
@@ -129,9 +128,6 @@ public:
QString anchorToScrollToWhenVisible;
- void _q_gestureTriggered();
- QPanGesture *panGesture;
-
#ifdef QT_KEYPAD_NAVIGATION
QBasicTimer deleteAllTimer;
#endif
diff --git a/src/gui/widgets/qtoolbararealayout.cpp b/src/gui/widgets/qtoolbararealayout.cpp
index b4a0ef022..afd526af3 100644
--- a/src/gui/widgets/qtoolbararealayout.cpp
+++ b/src/gui/widgets/qtoolbararealayout.cpp
@@ -1156,8 +1156,8 @@ QLayoutItem *QToolBarAreaLayout::unplug(const QList<int> &path, QToolBarAreaLayo
if (!next.skip()) {
newExtraSpace = next.pos - previous.pos - pick(line.o, previous.sizeHint());
previous.resize(line.o, next.pos - previous.pos);
+ break;
}
- break;
}
break;
}
diff --git a/src/multimedia/audio/audio.pri b/src/multimedia/audio/audio.pri
new file mode 100644
index 000000000..3ddb23b80
--- /dev/null
+++ b/src/multimedia/audio/audio.pri
@@ -0,0 +1,56 @@
+HEADERS += $$PWD/qaudio.h \
+ $$PWD/qaudioformat.h \
+ $$PWD/qaudioinput.h \
+ $$PWD/qaudiooutput.h \
+ $$PWD/qaudiodeviceinfo.h \
+ $$PWD/qaudioengineplugin.h \
+ $$PWD/qaudioengine.h \
+ $$PWD/qaudiodevicefactory_p.h \
+ $$PWD/qaudiodeviceid.h \
+ $$PWD/qaudiodeviceid_p.h
+
+
+SOURCES += $$PWD/qaudio.cpp \
+ $$PWD/qaudioformat.cpp \
+ $$PWD/qaudiodeviceinfo.cpp \
+ $$PWD/qaudiooutput.cpp \
+ $$PWD/qaudioinput.cpp \
+ $$PWD/qaudioengineplugin.cpp \
+ $$PWD/qaudioengine.cpp \
+ $$PWD/qaudiodevicefactory.cpp \
+ $$PWD/qaudiodeviceid.cpp
+
+mac {
+ HEADERS += $$PWD/qaudioinput_mac_p.h \
+ $$PWD/qaudiooutput_mac_p.h \
+ $$PWD/qaudiodeviceinfo_mac_p.h \
+ $$PWD/qaudio_mac_p.h
+
+ SOURCES += $$PWD/qaudiodeviceinfo_mac_p.cpp \
+ $$PWD/qaudiooutput_mac_p.cpp \
+ $$PWD/qaudioinput_mac_p.cpp \
+ $$PWD/qaudio_mac.cpp
+
+ LIBS += -framework CoreAudio -framework AudioUnit -framework AudioToolbox
+
+} else:win32 {
+
+ HEADERS += $$PWD/qaudioinput_win32_p.h $$PWD/qaudiooutput_win32_p.h $$PWD/qaudiodeviceinfo_win32_p.h
+ SOURCES += $$PWD/qaudiodeviceinfo_win32_p.cpp \
+ $$PWD/qaudiooutput_win32_p.cpp \
+ $$PWD/qaudioinput_win32_p.cpp
+ !wince*:LIBS += -lwinmm
+ wince*:LIBS += -lcoredll
+
+} else:unix {
+ unix:contains(QT_CONFIG, alsa) {
+ linux-*|freebsd-*|openbsd-*:{
+ DEFINES += HAS_ALSA
+ HEADERS += $$PWD/qaudiooutput_alsa_p.h $$PWD/qaudioinput_alsa_p.h $$PWD/qaudiodeviceinfo_alsa_p.h
+ SOURCES += $$PWD/qaudiodeviceinfo_alsa_p.cpp \
+ $$PWD/qaudiooutput_alsa_p.cpp \
+ $$PWD/qaudioinput_alsa_p.cpp
+ LIBS += -lasound
+ }
+ }
+}
diff --git a/src/multimedia/audio/qaudio.cpp b/src/multimedia/audio/qaudio.cpp
new file mode 100644
index 000000000..5ba6493f0
--- /dev/null
+++ b/src/multimedia/audio/qaudio.cpp
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtMultimedia/qaudio.h>
+
+
+QT_BEGIN_NAMESPACE
+
+namespace QAudio
+{
+
+class RegisterMetaTypes
+{
+public:
+ RegisterMetaTypes()
+ {
+ qRegisterMetaType<QAudio::Error>();
+ qRegisterMetaType<QAudio::State>();
+ qRegisterMetaType<QAudio::Mode>();
+ }
+
+} _register;
+
+}
+
+/*!
+ \namespace QAudio
+ \brief The QAudio namespace contains enums used by the audio classes.
+ \since 4.6
+*/
+
+/*!
+ \enum QAudio::Error
+
+ \value NoError No errors have occurred
+ \value OpenError An error opening the audio device
+ \value IOError An error occurred during read/write of audio device
+ \value UnderrunError Audio data is not being fed to the audio device at a fast enough rate
+ \value FatalError A non-recoverable error has occurred, the audio device is not usable at this time.
+*/
+
+/*!
+ \enum QAudio::State
+
+ \value ActiveState Audio data is being processed, this state is set after start() is called
+ and while audio data is available to be processed.
+ \value SuspendState The audio device is in a suspended state, this state will only be entered
+ after suspend() is called.
+ \value StopState The audio device is closed, not processing any audio data
+ \value IdleState The QIODevice passed in has no data and audio system's buffer is empty, this state
+ is set after start() is called and while no audio data is available to be processed.
+*/
+
+/*!
+ \enum QAudio::Mode
+
+ \value AudioOutput audio output device
+ \value AudioInput audio input device
+*/
+
+
+QT_END_NAMESPACE
+
diff --git a/src/multimedia/audio/qaudio.h b/src/multimedia/audio/qaudio.h
new file mode 100644
index 000000000..b996cc6a0
--- /dev/null
+++ b/src/multimedia/audio/qaudio.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QAUDIO_H
+#define QAUDIO_H
+
+
+#include <QtCore/qglobal.h>
+#include <QtCore/qmetatype.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Multimedia)
+
+namespace QAudio
+{
+ enum Error { NoError, OpenError, IOError, UnderrunError, FatalError };
+ enum State { ActiveState, SuspendState, StopState, IdleState };
+ enum Mode { AudioInput, AudioOutput };
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+Q_DECLARE_METATYPE(QAudio::Error);
+Q_DECLARE_METATYPE(QAudio::State);
+Q_DECLARE_METATYPE(QAudio::Mode);
+
+#endif // QAUDIO_H
diff --git a/src/multimedia/audio/qaudio_mac.cpp b/src/multimedia/audio/qaudio_mac.cpp
new file mode 100644
index 000000000..cfa7ca313
--- /dev/null
+++ b/src/multimedia/audio/qaudio_mac.cpp
@@ -0,0 +1,142 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qaudio_mac_p.h"
+
+QT_BEGIN_NAMESPACE
+
+// Debugging
+QDebug operator<<(QDebug dbg, const QAudioFormat& audioFormat)
+{
+ dbg.nospace() << "QAudioFormat(" <<
+ audioFormat.frequency() << "," <<
+ audioFormat.channels() << "," <<
+ audioFormat.sampleSize()<< "," <<
+ audioFormat.codec() << "," <<
+ audioFormat.byteOrder() << "," <<
+ audioFormat.sampleType() << ")";
+
+ return dbg.space();
+}
+
+
+// Conversion
+QAudioFormat toQAudioFormat(AudioStreamBasicDescription const& sf)
+{
+ QAudioFormat audioFormat;
+
+ audioFormat.setFrequency(sf.mSampleRate);
+ audioFormat.setChannels(sf.mChannelsPerFrame);
+ audioFormat.setSampleSize(sf.mBitsPerChannel);
+ audioFormat.setCodec(QString::fromLatin1("audio/pcm"));
+ audioFormat.setByteOrder(sf.mFormatFlags & kLinearPCMFormatFlagIsBigEndian != 0 ? QAudioFormat::BigEndian : QAudioFormat::LittleEndian);
+ QAudioFormat::SampleType type = QAudioFormat::UnSignedInt;
+ if ((sf.mFormatFlags & kLinearPCMFormatFlagIsSignedInteger) != 0)
+ type = QAudioFormat::SignedInt;
+ else if ((sf.mFormatFlags & kLinearPCMFormatFlagIsFloat) != 0)
+ type = QAudioFormat::Float;
+ audioFormat.setSampleType(type);
+
+ return audioFormat;
+}
+
+AudioStreamBasicDescription toAudioStreamBasicDescription(QAudioFormat const& audioFormat)
+{
+ AudioStreamBasicDescription sf;
+
+ sf.mFormatFlags = kAudioFormatFlagIsPacked;
+ sf.mSampleRate = audioFormat.frequency();
+ sf.mFramesPerPacket = 1;
+ sf.mChannelsPerFrame = audioFormat.channels();
+ sf.mBitsPerChannel = audioFormat.sampleSize();
+ sf.mBytesPerFrame = sf.mChannelsPerFrame * (sf.mBitsPerChannel / 8);
+ sf.mBytesPerPacket = sf.mFramesPerPacket * sf.mBytesPerFrame;
+ sf.mFormatID = kAudioFormatLinearPCM;
+
+ switch (audioFormat.sampleType()) {
+ case QAudioFormat::SignedInt: sf.mFormatFlags |= kAudioFormatFlagIsSignedInteger; break;
+ case QAudioFormat::UnSignedInt: /* default */ break;
+ case QAudioFormat::Float: sf.mFormatFlags |= kAudioFormatFlagIsFloat; break;
+ case QAudioFormat::Unknown: default: break;
+ }
+
+ return sf;
+}
+
+// QAudioRingBuffer
+QAudioRingBuffer::QAudioRingBuffer(int bufferSize):
+ m_bufferSize(bufferSize)
+{
+ m_buffer = new char[m_bufferSize];
+ reset();
+}
+
+QAudioRingBuffer::~QAudioRingBuffer()
+{
+ delete m_buffer;
+}
+
+int QAudioRingBuffer::used() const
+{
+ return m_bufferUsed;
+}
+
+int QAudioRingBuffer::free() const
+{
+ return m_bufferSize - m_bufferUsed;
+}
+
+int QAudioRingBuffer::size() const
+{
+ return m_bufferSize;
+}
+
+void QAudioRingBuffer::reset()
+{
+ m_readPos = 0;
+ m_writePos = 0;
+ m_bufferUsed = 0;
+}
+
+QT_END_NAMESPACE
+
+
diff --git a/src/multimedia/audio/qaudio_mac_p.h b/src/multimedia/audio/qaudio_mac_p.h
new file mode 100644
index 000000000..8e2d522e5
--- /dev/null
+++ b/src/multimedia/audio/qaudio_mac_p.h
@@ -0,0 +1,144 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+
+#ifndef QAUDIO_MAC_P_H
+#define QAUDIO_MAC_P_H
+
+#include <CoreAudio/CoreAudio.h>
+
+#include <QtCore/qdebug.h>
+#include <QtCore/qatomic.h>
+
+#include <QtMultimedia/qaudioformat.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Multimedia)
+
+
+extern QDebug operator<<(QDebug dbg, const QAudioFormat& audioFormat);
+
+extern QAudioFormat toQAudioFormat(const AudioStreamBasicDescription& streamFormat);
+extern AudioStreamBasicDescription toAudioStreamBasicDescription(QAudioFormat const& audioFormat);
+
+class QAudioRingBuffer
+{
+public:
+ typedef QPair<char*, int> Region;
+
+ QAudioRingBuffer(int bufferSize);
+ ~QAudioRingBuffer();
+
+ Region acquireReadRegion(int size)
+ {
+ const int used = m_bufferUsed.fetchAndAddAcquire(0);
+
+ if (used > 0) {
+ const int readSize = qMin(size, qMin(m_bufferSize - m_readPos, used));
+
+ return readSize > 0 ? Region(m_buffer + m_readPos, readSize) : Region(0, 0);
+ }
+
+ return Region(0, 0);
+ }
+
+ void releaseReadRegion(Region const& region)
+ {
+ m_readPos = (m_readPos + region.second) % m_bufferSize;
+
+ m_bufferUsed.fetchAndAddRelease(-region.second);
+ }
+
+ Region acquireWriteRegion(int size)
+ {
+ const int free = m_bufferSize - m_bufferUsed.fetchAndAddAcquire(0);
+
+ if (free > 0) {
+ const int writeSize = qMin(size, qMin(m_bufferSize - m_writePos, free));
+
+ return writeSize > 0 ? Region(m_buffer + m_writePos, writeSize) : Region(0, 0);
+ }
+
+ return Region(0, 0);
+ }
+
+ void releaseWriteRegion(Region const& region)
+ {
+ m_writePos = (m_writePos + region.second) % m_bufferSize;
+
+ m_bufferUsed.fetchAndAddRelease(region.second);
+ }
+
+ int used() const;
+ int free() const;
+ int size() const;
+
+ void reset();
+
+private:
+ int m_bufferSize;
+ int m_readPos;
+ int m_writePos;
+ char* m_buffer;
+ QAtomicInt m_bufferUsed;
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QAUDIO_MAC_P_H
+
+
diff --git a/src/multimedia/audio/qaudiodevicefactory.cpp b/src/multimedia/audio/qaudiodevicefactory.cpp
new file mode 100644
index 000000000..35e9c9151
--- /dev/null
+++ b/src/multimedia/audio/qaudiodevicefactory.cpp
@@ -0,0 +1,250 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/qdebug.h>
+#include <QtMultimedia/qaudioengine.h>
+#include <QtMultimedia/qaudioengineplugin.h>
+#include <private/qfactoryloader_p.h>
+#include "qaudiodevicefactory_p.h"
+#include "qaudiodeviceid_p.h"
+
+#if defined(Q_OS_WIN)
+#include "qaudiodeviceinfo_win32_p.h"
+#include "qaudiooutput_win32_p.h"
+#include "qaudioinput_win32_p.h"
+#elif defined(Q_OS_MAC)
+#include "qaudiodeviceinfo_mac_p.h"
+#include "qaudiooutput_mac_p.h"
+#include "qaudioinput_mac_p.h"
+#elif defined(HAS_ALSA)
+#include "qaudiodeviceinfo_alsa_p.h"
+#include "qaudiooutput_alsa_p.h"
+#include "qaudioinput_alsa_p.h"
+#endif
+
+QT_BEGIN_NAMESPACE
+
+Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
+ (QAudioEngineFactoryInterface_iid, QLatin1String("/audio"), Qt::CaseInsensitive))
+
+
+class QNullDeviceInfo : public QAbstractAudioDeviceInfo
+{
+public:
+ QAudioFormat preferredFormat() const { qWarning()<<"using null deviceinfo, none available"; return QAudioFormat(); }
+ bool isFormatSupported(const QAudioFormat& ) const { return false; }
+ QAudioFormat nearestFormat(const QAudioFormat& ) const { return QAudioFormat(); }
+ QString deviceName() const { return QString(); }
+ QStringList codecList() { return QStringList(); }
+ QList<int> frequencyList() { return QList<int>(); }
+ QList<int> channelsList() { return QList<int>(); }
+ QList<int> sampleSizeList() { return QList<int>(); }
+ QList<QAudioFormat::Endian> byteOrderList() { return QList<QAudioFormat::Endian>(); }
+ QList<QAudioFormat::SampleType> sampleTypeList() { return QList<QAudioFormat::SampleType>(); }
+};
+
+class QNullInputDevice : public QAbstractAudioInput
+{
+public:
+ QIODevice* start(QIODevice* ) { qWarning()<<"using null input device, none available"; return 0; }
+ void stop() {}
+ void reset() {}
+ void suspend() {}
+ void resume() {}
+ int bytesReady() const { return 0; }
+ int periodSize() const { return 0; }
+ void setBufferSize(int ) {}
+ int bufferSize() const { return 0; }
+ void setNotifyInterval(int ) {}
+ int notifyInterval() const { return 0; }
+ qint64 totalTime() const { return 0; }
+ qint64 clock() const { return 0; }
+ QAudio::Error error() const { return QAudio::OpenError; }
+ QAudio::State state() const { return QAudio::StopState; }
+ QAudioFormat format() const { return QAudioFormat(); }
+};
+
+class QNullOutputDevice : public QAbstractAudioOutput
+{
+public:
+ QIODevice* start(QIODevice* ) { qWarning()<<"using null output device, none available"; return 0; }
+ void stop() {}
+ void reset() {}
+ void suspend() {}
+ void resume() {}
+ int bytesFree() const { return 0; }
+ int periodSize() const { return 0; }
+ void setBufferSize(int ) {}
+ int bufferSize() const { return 0; }
+ void setNotifyInterval(int ) {}
+ int notifyInterval() const { return 0; }
+ qint64 totalTime() const { return 0; }
+ qint64 clock() const { return 0; }
+ QAudio::Error error() const { return QAudio::OpenError; }
+ QAudio::State state() const { return QAudio::StopState; }
+ QAudioFormat format() const { return QAudioFormat(); }
+};
+
+QList<QAudioDeviceId> QAudioDeviceFactory::deviceList(QAudio::Mode mode)
+{
+ QList<QAudioDeviceId> devices;
+#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
+ foreach (const QByteArray &handle, QAudioDeviceInfoPrivate::deviceList(mode))
+ devices += createDeviceId(QLatin1String("builtin"), mode, handle);
+#endif
+ QFactoryLoader* l = loader();
+
+ foreach (QString const& key, l->keys()) {
+ QAudioEngineFactoryInterface* plugin = qobject_cast<QAudioEngineFactoryInterface*>(l->instance(key));
+ if (plugin) {
+ foreach (QByteArray const& handle, plugin->deviceList(mode))
+ devices += createDeviceId(key, mode, handle);
+ }
+
+ delete plugin;
+ }
+
+ return devices;
+}
+
+QAudioDeviceId QAudioDeviceFactory::defaultInputDevice()
+{
+ QAudioEngineFactoryInterface* plugin = qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(QLatin1String("default")));
+
+ if (plugin) {
+ QList<QByteArray> list = plugin->deviceList(QAudio::AudioInput);
+ if (list.size() > 0)
+ return createDeviceId(QLatin1String("default"), QAudio::AudioInput, list.at(0));
+ }
+#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
+ return createDeviceId(QLatin1String("builtin"), QAudio::AudioInput, QAudioDeviceInfoPrivate::defaultInputDevice());
+#endif
+ return QAudioDeviceId();
+}
+
+QAudioDeviceId QAudioDeviceFactory::defaultOutputDevice()
+{
+ QAudioEngineFactoryInterface* plugin = qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(QLatin1String("default")));
+
+ if (plugin) {
+ QList<QByteArray> list = plugin->deviceList(QAudio::AudioOutput);
+ if (list.size() > 0)
+ return createDeviceId(QLatin1String("default"), QAudio::AudioOutput, list.at(0));
+ }
+#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
+ return createDeviceId(QLatin1String("builtin"), QAudio::AudioOutput, QAudioDeviceInfoPrivate::defaultOutputDevice());
+#endif
+ return QAudioDeviceId();
+}
+
+QAbstractAudioDeviceInfo* QAudioDeviceFactory::audioDeviceInfo(QAudioDeviceId const& id)
+{
+ if (id.isNull())
+ return new QNullDeviceInfo();
+#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
+ if (id.d->key == QLatin1String("builtin"))
+ return new QAudioDeviceInfoPrivate(id.d->handle, QAudio::Mode(id.d->mode));
+#endif
+ QAudioEngineFactoryInterface* plugin = qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(id.d->key));
+
+ if (plugin)
+ return plugin->createDeviceInfo(id.d->handle, QAudio::Mode(id.d->mode));
+
+ return new QNullDeviceInfo();
+}
+
+QAbstractAudioInput* QAudioDeviceFactory::createDefaultInputDevice(QAudioFormat const &format)
+{
+ return createInputDevice(defaultInputDevice(), format);
+}
+
+QAbstractAudioOutput* QAudioDeviceFactory::createDefaultOutputDevice(QAudioFormat const &format)
+{
+ return createOutputDevice(defaultOutputDevice(), format);
+}
+
+QAbstractAudioInput* QAudioDeviceFactory::createInputDevice(QAudioDeviceId const& id, QAudioFormat const &format)
+{
+ if (id.isNull())
+ return new QNullInputDevice();
+#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
+ if (id.d->key == QLatin1String("builtin")) {
+ if(!defaultInputDevice().isNull())
+ return new QAudioInputPrivate(id.d->handle, format);
+ else
+ return new QNullInputDevice();
+ }
+#endif
+ QAudioEngineFactoryInterface* plugin = qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance((id.d->key)));
+
+ if (plugin)
+ return plugin->createInput(id.d->handle, format);
+
+ return new QNullInputDevice();
+}
+
+QAbstractAudioOutput* QAudioDeviceFactory::createOutputDevice(QAudioDeviceId const& id, QAudioFormat const &format)
+{
+ if (id.isNull())
+ return new QNullOutputDevice();
+#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
+ if (id.d->key == QLatin1String("builtin")) {
+ if(!defaultOutputDevice().isNull())
+ return new QAudioOutputPrivate(id.d->handle, format);
+ else
+ return new QNullOutputDevice();
+ }
+#endif
+ QAudioEngineFactoryInterface* plugin = qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(id.d->key));
+
+ if (plugin)
+ return plugin->createOutput(id.d->handle, format);
+
+ return new QNullOutputDevice();
+}
+
+QAudioDeviceId QAudioDeviceFactory::createDeviceId(QString const& key, int mode, QByteArray const& handle)
+{
+ return QAudioDeviceId(new QAudioDeviceIdPrivate(key, mode, handle));
+}
+
+QT_END_NAMESPACE
+
diff --git a/src/multimedia/audio/qaudiodevicefactory_p.h b/src/multimedia/audio/qaudiodevicefactory_p.h
new file mode 100644
index 000000000..a8e2b28ee
--- /dev/null
+++ b/src/multimedia/audio/qaudiodevicefactory_p.h
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#ifndef QAUDIODEVICEFACTORY_P_H
+#define QAUDIODEVICEFACTORY_P_H
+
+#include <QtCore/qglobal.h>
+#include <QtCore/qbytearray.h>
+#include <QtCore/qlist.h>
+
+#include <QtMultimedia/qaudiodeviceid.h>
+#include <QtMultimedia/qaudiodeviceinfo.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Multimedia)
+
+class QAbstractAudioInput;
+class QAbstractAudioOutput;
+
+
+class QAudioDeviceFactory
+{
+public:
+ static QList<QAudioDeviceId> deviceList(QAudio::Mode mode);
+
+ static QAudioDeviceId defaultInputDevice();
+ static QAudioDeviceId defaultOutputDevice();
+
+ static QAbstractAudioDeviceInfo* audioDeviceInfo(QAudioDeviceId const &device);
+
+ static QAbstractAudioInput* createDefaultInputDevice(QAudioFormat const &format);
+ static QAbstractAudioOutput* createDefaultOutputDevice(QAudioFormat const &format);
+
+ static QAbstractAudioInput* createInputDevice(QAudioDeviceId const &device, QAudioFormat const &format);
+ static QAbstractAudioOutput* createOutputDevice(QAudioDeviceId const &device, QAudioFormat const &format);
+
+ static QAbstractAudioInput* createNullInput();
+ static QAbstractAudioOutput* createNullOutput();
+
+ static QAudioDeviceId createDeviceId(QString const& key, int mode, QByteArray const& handle);
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QAUDIODEVICEFACTORY_P_H
+
diff --git a/src/multimedia/audio/qaudiodeviceid.cpp b/src/multimedia/audio/qaudiodeviceid.cpp
new file mode 100644
index 000000000..21a9cd81d
--- /dev/null
+++ b/src/multimedia/audio/qaudiodeviceid.cpp
@@ -0,0 +1,168 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/qstring.h>
+#include <QtCore/qbytearray.h>
+#include <QtCore/qdatastream.h>
+
+#include <QtMultimedia/qaudiodeviceid.h>
+#include "qaudiodeviceid_p.h"
+
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QAudioDeviceId
+ \brief The QAudioDeviceId class provides means for identifying a unique input or output device on a system.
+
+ \inmodule QtMultimedia
+ \ingroup multimedia
+ \since 4.6
+
+ \sa QAudioDeviceInfo, QAudioOutput, QAudioInput
+*/
+
+/*!
+ Construct a new null QAudioDeviceId.
+*/
+
+QAudioDeviceId::QAudioDeviceId()
+{
+}
+
+/*!
+ Copy the QAudDeviceId referenced by \a other.
+*/
+
+QAudioDeviceId::QAudioDeviceId(const QAudioDeviceId &other):
+ d(other.d)
+{
+}
+
+/*!
+ Destroy the QAudioDeviceId.
+*/
+
+QAudioDeviceId::~QAudioDeviceId()
+{
+}
+
+/*!
+ Make a copy of the \a other QAudioDeviceId.
+*/
+
+QAudioDeviceId& QAudioDeviceId::operator=(const QAudioDeviceId &other)
+{
+ d = other.d;
+ return *this;
+}
+
+/*!
+ Compare with the \a other QAudioDeviceId, return true if they are the same;
+ otherwise false.
+*/
+
+bool QAudioDeviceId::operator==(const QAudioDeviceId &other) const
+{
+ return (d.constData() == 0 && other.d.constData() == 0) ||
+ (d.constData() != 0 && other.d.constData() != 0 &&
+ d->key == other.d->key && d->mode == other.d->mode && d->handle == other.d->handle);
+}
+
+/*!
+ Compare with the \a other QAudioDeviceId, return false if they are the same;
+ otherwise true.
+*/
+
+bool QAudioDeviceId::operator!=(const QAudioDeviceId &other) const
+{
+ return !(*this == other);
+}
+
+/*!
+ Returns true if this is not a valid QAudioDeviceId; otherwise false.
+*/
+
+bool QAudioDeviceId::isNull() const
+{
+ return d.constData() == 0;
+}
+
+/*!
+ \internal
+*/
+
+QAudioDeviceId::QAudioDeviceId(QAudioDeviceIdPrivate* data):
+ d(data)
+{
+}
+
+/*!
+ \internal
+*/
+
+QAudioDeviceIdPrivate::QAudioDeviceIdPrivate(QString const& k, int m, QByteArray const& h):
+ key(k), mode(m), handle(h)
+{
+}
+
+#ifndef QT_NO_DATASTREAM
+Q_MULTIMEDIA_EXPORT QDataStream &operator<<(QDataStream &s, const QAudioDeviceId &id)
+{
+ s << id.d->key << id.d->mode << id.d->handle;
+ return s;
+}
+
+Q_MULTIMEDIA_EXPORT QDataStream &operator>>(QDataStream &s, QAudioDeviceId &id)
+{
+ QString key;
+ int mode;
+ QByteArray handle;
+
+ s >> key >> mode >> handle;
+ id = QAudioDeviceId(new QAudioDeviceIdPrivate(key, mode, handle));
+
+ return s;
+}
+#endif
+
+
+QT_END_NAMESPACE
diff --git a/src/multimedia/audio/qaudiodeviceid.h b/src/multimedia/audio/qaudiodeviceid.h
new file mode 100644
index 000000000..f9188d3ff
--- /dev/null
+++ b/src/multimedia/audio/qaudiodeviceid.h
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QAUDIODEVICEID_H
+#define QAUDIODEVICEID_H
+
+#include <QtCore/qshareddata.h>
+#include <QtCore/qmetatype.h>
+
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Multimedia)
+
+
+class QAudioDeviceFactory;
+class QAudioDeviceIdPrivate;
+
+class Q_MULTIMEDIA_EXPORT QAudioDeviceId
+{
+ friend class QAudioDeviceFactory;
+ friend Q_MULTIMEDIA_EXPORT QDataStream &operator<<(QDataStream&, const QAudioDeviceId&);
+ friend Q_MULTIMEDIA_EXPORT QDataStream &operator>>(QDataStream&, QAudioDeviceId&);
+
+public:
+ QAudioDeviceId();
+ QAudioDeviceId(const QAudioDeviceId &other);
+ ~QAudioDeviceId();
+
+ QAudioDeviceId& operator=(const QAudioDeviceId &other);
+ bool operator==(const QAudioDeviceId &id) const;
+ bool operator!=(const QAudioDeviceId &id) const;
+
+ bool isNull() const;
+
+private:
+ QAudioDeviceId(QAudioDeviceIdPrivate *data);
+
+ QSharedDataPointer<QAudioDeviceIdPrivate> d;
+};
+
+#ifndef QT_NO_DATASTREAM
+Q_MULTIMEDIA_EXPORT QDataStream &operator<<(QDataStream&, const QAudioDeviceId&);
+Q_MULTIMEDIA_EXPORT QDataStream &operator>>(QDataStream&, QAudioDeviceId&);
+#endif
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+Q_DECLARE_METATYPE(QAudioDeviceId);
+
+
+#endif // QAUDIODEVICEID_H
diff --git a/src/multimedia/audio/qaudiodeviceid_p.h b/src/multimedia/audio/qaudiodeviceid_p.h
new file mode 100644
index 000000000..303457476
--- /dev/null
+++ b/src/multimedia/audio/qaudiodeviceid_p.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#ifndef QAUDIODEVICEIDPRIVATE_H
+#define QAUDIODEVICEIDPRIVATE_H
+
+#include <QtCore/qstring.h>
+#include <QtCore/qbytearray.h>
+#include <QtCore/qshareddata.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Multimedia)
+
+
+class QAudioDeviceIdPrivate : public QSharedData
+{
+public:
+ QAudioDeviceIdPrivate(QString const& k, int m, QByteArray const& h);
+
+ QString key;
+ int mode;
+ QByteArray handle;
+};
+
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QAUDIODEVICEIDPRIVATE_H
diff --git a/src/multimedia/audio/qaudiodeviceinfo.cpp b/src/multimedia/audio/qaudiodeviceinfo.cpp
new file mode 100644
index 000000000..c1895d71d
--- /dev/null
+++ b/src/multimedia/audio/qaudiodeviceinfo.cpp
@@ -0,0 +1,270 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qaudiodevicefactory_p.h"
+#include <QtMultimedia/qaudioengine.h>
+#include <QtMultimedia/qaudiodeviceinfo.h>
+
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QAudioDeviceInfo
+ \brief The QAudioDeviceInfo class provides an interface to query audio devices and their functionality.
+
+ \inmodule QtMultimedia
+ \ingroup multimedia
+ \since 4.6
+
+ QAudioDeviceInfo lets you query for audio devices--such as sound
+ cards and USB headsets--that are currently available on the system.
+ The audio devices available are dependent on the platform or audio plugins installed.
+
+ You can also query each device for the formats it supports. A
+ format in this context is a set consisting of a specific byte
+ order, channel, codec, frequency, sample rate, and sample type. A
+ format is represented by the QAudioFormat class.
+
+ The values supported by the the device for each of these
+ parameters can be fetched with
+ supportedByteOrders(), supportedChannels(), supportedCodecs(),
+ supportedFrequencies(), supportedSampleSizes(), and
+ supportedSampleTypes(). The combinations supported are dependent on the platform,
+ audio plugins installed and the audio device capabilities. If you need a specific format, you can check if
+ the device supports it with isFormatSupported(), or fetch a
+ supported format that is as close as possible to the format with
+ nearestFormat().
+
+ A QAudioDeviceInfo is constructed with a QAudioDeviceId, which is
+ an identifier for a physical device. It is used by Qt to construct
+ classes that communicate with the device--such as
+ QAudioDeviceInfo, QAudioInput, and QAudioOutput. The static
+ functions defaultInputDevice(), defaultOutputDevice(), and
+ deviceList() let you get a hold of the ids for all available
+ devices. You fetch ids based on whether you will use the device
+ for input or output; this is specified by the QAudio::Mode enum.
+ The QAudioDeviceId returned are only valid for the QAudio::Mode.
+
+ For instance:
+
+ \code
+ foreach(QAudioDeviceId audioId, QAudioDeviceInfo::deviceList(QAudio::AudioOutput)) {
+ QAudioDeviceInfo info(audioId);
+ qDebug() << "Device name: " << info.deviceName();
+ }
+ \endcode
+
+ In this code sample, we loop through all devices that are able to output
+ sound, i.e., play an audio stream in a supported format. For each device we
+ find, we simply print the deviceName().
+
+ \sa QAudioOutput, QAudioInput, QAudioDeviceId
+*/
+
+/*!
+ Construct a new audio device info and attach it to \a parent.
+ Using the audio device with the specified \a id.
+*/
+
+QAudioDeviceInfo::QAudioDeviceInfo(const QAudioDeviceId &id, QObject *parent):
+ QObject(parent)
+{
+ d = QAudioDeviceFactory::audioDeviceInfo(id);
+}
+
+/*!
+ Destroy this audio device info.
+*/
+
+QAudioDeviceInfo::~QAudioDeviceInfo()
+{
+ delete d;
+}
+
+/*!
+ Returns human readable name of audio device.
+
+ Device names vary depending on platform/audio plugin being used.
+
+ They are a unique string identifiers for the audio device.
+
+ eg. default, Intel, U0x46d0x9a4
+*/
+
+QString QAudioDeviceInfo::deviceName() const
+{
+ return d->deviceName();
+}
+
+/*!
+ Returns true if \a settings are supported by the audio device of this QAudioDeviceInfo.
+*/
+
+bool QAudioDeviceInfo::isFormatSupported(const QAudioFormat &settings) const
+{
+ return d->isFormatSupported(settings);
+}
+
+/*!
+ Returns QAudioFormat of default settings.
+
+ These settings are provided by the platform/audio plugin being used.
+
+ They also are dependent on the QAudio::Mode being used.
+
+ A typical audio system would provide something like:
+ \list
+ \o Input settings: 8000Hz mono 8 bit.
+ \o Output settings: 44100Hz stereo 16 bit little endian.
+ \endlist
+*/
+
+QAudioFormat QAudioDeviceInfo::preferredFormat() const
+{
+ return d->preferredFormat();
+}
+
+/*!
+ Returns closest QAudioFormat to \a settings that system audio supports.
+
+ These settings are provided by the platform/audio plugin being used.
+
+ They also are dependent on the QAudio::Mode being used.
+*/
+
+QAudioFormat QAudioDeviceInfo::nearestFormat(const QAudioFormat &settings) const
+{
+ return d->nearestFormat(settings);
+}
+
+/*!
+ Returns a list of supported codecs.
+
+ All platform and plugin implementations should provide support for:
+
+ "audio/pcm" - Linear PCM
+
+ For writing plugins to support additional codecs refer to:
+
+ http://www.iana.org/assignments/media-types/audio/
+*/
+
+QStringList QAudioDeviceInfo::supportedCodecs() const
+{
+ return d->codecList();
+}
+
+/*!
+ Returns a list of supported frequencies.
+*/
+
+QList<int> QAudioDeviceInfo::supportedFrequencies() const
+{
+ return d->frequencyList();
+}
+
+/*!
+ Returns a list of supported channels.
+*/
+
+QList<int> QAudioDeviceInfo::supportedChannels() const
+{
+ return d->channelsList();
+}
+
+/*!
+ Returns a list of supported sample sizes.
+*/
+
+QList<int> QAudioDeviceInfo::supportedSampleSizes() const
+{
+ return d->sampleSizeList();
+}
+
+/*!
+ Returns a list of supported byte orders.
+*/
+
+QList<QAudioFormat::Endian> QAudioDeviceInfo::supportedByteOrders() const
+{
+ return d->byteOrderList();
+}
+
+/*!
+ Returns a list of supported sample types.
+*/
+
+QList<QAudioFormat::SampleType> QAudioDeviceInfo::supportedSampleTypes() const
+{
+ return d->sampleTypeList();
+}
+
+/*!
+ Returns the name of the default input audio device.
+ All platform and audio plugin implementations provide a default audio device to use.
+*/
+
+QAudioDeviceId QAudioDeviceInfo::defaultInputDevice()
+{
+ return QAudioDeviceFactory::defaultInputDevice();
+}
+
+/*!
+ Returns the name of the default output audio device.
+ All platform and audio plugin implementations provide a default audio device to use.
+*/
+
+QAudioDeviceId QAudioDeviceInfo::defaultOutputDevice()
+{
+ return QAudioDeviceFactory::defaultOutputDevice();
+}
+
+/*!
+ Returns a list of audio devices that support \a mode.
+*/
+
+QList<QAudioDeviceId> QAudioDeviceInfo::deviceList(QAudio::Mode mode)
+{
+ return QAudioDeviceFactory::deviceList(mode);
+}
+
+QT_END_NAMESPACE
+
diff --git a/src/multimedia/audio/qaudiodeviceinfo.h b/src/multimedia/audio/qaudiodeviceinfo.h
new file mode 100644
index 000000000..444a00a7e
--- /dev/null
+++ b/src/multimedia/audio/qaudiodeviceinfo.h
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QAUDIODEVICEINFO_H
+#define QAUDIODEVICEINFO_H
+
+#include <QtCore/qobject.h>
+#include <QtCore/qglobal.h>
+#include <QtCore/qbytearray.h>
+#include <QtCore/qstring.h>
+#include <QtCore/qstringlist.h>
+#include <QtCore/qlist.h>
+
+#include <QtMultimedia/qaudio.h>
+#include <QtMultimedia/qaudioformat.h>
+#include <QtMultimedia/qaudiodeviceid.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Multimedia)
+
+
+class QAbstractAudioDeviceInfo;
+
+class Q_MULTIMEDIA_EXPORT QAudioDeviceInfo : public QObject
+{
+ Q_OBJECT
+
+public:
+ explicit QAudioDeviceInfo(const QAudioDeviceId &id, QObject *parent = 0);
+ ~QAudioDeviceInfo();
+
+ QString deviceName() const;
+
+ bool isFormatSupported(const QAudioFormat &format) const;
+ QAudioFormat preferredFormat() const;
+ QAudioFormat nearestFormat(const QAudioFormat &format) const;
+
+ QStringList supportedCodecs() const;
+ QList<int> supportedFrequencies() const;
+ QList<int> supportedChannels() const;
+ QList<int> supportedSampleSizes() const;
+ QList<QAudioFormat::Endian> supportedByteOrders() const;
+ QList<QAudioFormat::SampleType> supportedSampleTypes() const;
+
+ static QAudioDeviceId defaultInputDevice();
+ static QAudioDeviceId defaultOutputDevice();
+
+ static QList<QAudioDeviceId> deviceList(QAudio::Mode mode);
+
+private:
+ Q_DISABLE_COPY(QAudioDeviceInfo)
+
+ QAbstractAudioDeviceInfo* d;
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QAUDIODEVICEINFO_H
diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp
new file mode 100644
index 000000000..fe45f829f
--- /dev/null
+++ b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp
@@ -0,0 +1,394 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qaudiodeviceinfo_alsa_p.h"
+
+QAudioDeviceInfoPrivate::QAudioDeviceInfoPrivate(QByteArray dev, QAudio::Mode mode)
+{
+ handle = 0;
+
+ device = QLatin1String(dev);
+ this->mode = mode;
+}
+
+QAudioDeviceInfoPrivate::~QAudioDeviceInfoPrivate()
+{
+ close();
+}
+
+bool QAudioDeviceInfoPrivate::isFormatSupported(const QAudioFormat& format) const
+{
+ return testSettings(format);
+}
+
+QAudioFormat QAudioDeviceInfoPrivate::preferredFormat() const
+{
+ QAudioFormat nearest;
+ if(mode == QAudio::AudioOutput) {
+ nearest.setFrequency(44100);
+ nearest.setChannels(2);
+ nearest.setByteOrder(QAudioFormat::LittleEndian);
+ nearest.setSampleType(QAudioFormat::SignedInt);
+ nearest.setSampleSize(16);
+ nearest.setCodec(tr("audio/pcm"));
+ } else {
+ nearest.setFrequency(8000);
+ nearest.setChannels(1);
+ nearest.setSampleType(QAudioFormat::SignedInt);
+ nearest.setSampleSize(8);
+ nearest.setCodec(tr("audio/pcm"));
+ }
+ return nearest;
+}
+
+QAudioFormat QAudioDeviceInfoPrivate::nearestFormat(const QAudioFormat& format) const
+{
+ if(testSettings(format))
+ return format;
+ else
+ return preferredFormat();
+}
+
+QString QAudioDeviceInfoPrivate::deviceName() const
+{
+ return device;
+}
+
+QStringList QAudioDeviceInfoPrivate::codecList()
+{
+ updateLists();
+ return codecz;
+}
+
+QList<int> QAudioDeviceInfoPrivate::frequencyList()
+{
+ updateLists();
+ return freqz;
+}
+
+QList<int> QAudioDeviceInfoPrivate::channelsList()
+{
+ updateLists();
+ return channelz;
+}
+
+QList<int> QAudioDeviceInfoPrivate::sampleSizeList()
+{
+ updateLists();
+ return sizez;
+}
+
+QList<QAudioFormat::Endian> QAudioDeviceInfoPrivate::byteOrderList()
+{
+ updateLists();
+ return byteOrderz;
+}
+
+QList<QAudioFormat::SampleType> QAudioDeviceInfoPrivate::sampleTypeList()
+{
+ updateLists();
+ return typez;
+}
+
+bool QAudioDeviceInfoPrivate::open()
+{
+ int err = 0;
+ QString dev = device;
+ if(!dev.contains(tr("default"))) {
+ int idx = snd_card_get_index(dev.toLocal8Bit().constData());
+ dev = QString(tr("hw:%1,0")).arg(idx);
+ }
+ if(mode == QAudio::AudioOutput) {
+ err=snd_pcm_open( &handle,dev.toLocal8Bit().constData(),SND_PCM_STREAM_PLAYBACK,0);
+ } else {
+ err=snd_pcm_open( &handle,dev.toLocal8Bit().constData(),SND_PCM_STREAM_CAPTURE,0);
+ }
+ if(err < 0) {
+ handle = 0;
+ return false;
+ }
+ return true;
+}
+
+void QAudioDeviceInfoPrivate::close()
+{
+ if(handle)
+ snd_pcm_close(handle);
+ handle = 0;
+}
+
+bool QAudioDeviceInfoPrivate::testSettings(const QAudioFormat& format) const
+{
+ // Set nearest to closest settings that do work.
+ // See if what is in settings will work (return value).
+
+ int err = 0;
+ snd_pcm_t* handle;
+ snd_pcm_hw_params_t *params;
+ QString dev = device;
+
+ // open()
+ if(!dev.contains(tr("default"))) {
+ int idx = snd_card_get_index(dev.toLocal8Bit().constData());
+ dev = QString(tr("hw:%1,0")).arg(idx);
+ }
+ if(mode == QAudio::AudioOutput) {
+ err=snd_pcm_open( &handle,dev.toLocal8Bit().constData(),SND_PCM_STREAM_PLAYBACK,0);
+ } else {
+ err=snd_pcm_open( &handle,dev.toLocal8Bit().constData(),SND_PCM_STREAM_CAPTURE,0);
+ }
+ if(err < 0) {
+ handle = 0;
+ return false;
+ }
+
+ bool testChannel = false;
+ bool testCodec = false;
+ bool testFreq = false;
+ bool testType = false;
+ bool testSize = false;
+
+ int dir = 0;
+
+ snd_pcm_nonblock( handle, 0 );
+ snd_pcm_hw_params_alloca( &params );
+ snd_pcm_hw_params_any( handle, params );
+
+ // For now, just accept only audio/pcm codec
+ if(!format.codec().startsWith(tr("audio/pcm"))) {
+ err=-1;
+ } else
+ testCodec = true;
+
+ if(err>=0 && format.channels() != -1) {
+ err = snd_pcm_hw_params_test_channels(handle,params,format.channels());
+ if(err>=0)
+ err = snd_pcm_hw_params_set_channels(handle,params,format.channels());
+ if(err>=0)
+ testChannel = true;
+ }
+
+ if(err>=0 && format.frequency() != -1) {
+ err = snd_pcm_hw_params_test_rate(handle,params,format.frequency(),0);
+ if(err>=0)
+ err = snd_pcm_hw_params_set_rate(handle,params,format.frequency(),dir);
+ if(err>=0)
+ testFreq = true;
+ }
+
+ if((err>=0 && format.sampleSize() != -1) &&
+ (format.sampleType() != QAudioFormat::Unknown)) {
+ switch(format.sampleSize()) {
+ case 8:
+ if(format.sampleType() == QAudioFormat::SignedInt)
+ err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S8);
+ else if(format.sampleType() == QAudioFormat::UnSignedInt)
+ err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U8);
+ break;
+ case 16:
+ if(format.sampleType() == QAudioFormat::SignedInt) {
+ if(format.byteOrder() == QAudioFormat::LittleEndian)
+ err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S16_LE);
+ else if(format.byteOrder() == QAudioFormat::BigEndian)
+ err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S16_BE);
+ } else if(format.sampleType() == QAudioFormat::UnSignedInt) {
+ if(format.byteOrder() == QAudioFormat::LittleEndian)
+ err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U16_LE);
+ else if(format.byteOrder() == QAudioFormat::BigEndian)
+ err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U16_BE);
+ }
+ break;
+ case 32:
+ if(format.sampleType() == QAudioFormat::SignedInt) {
+ if(format.byteOrder() == QAudioFormat::LittleEndian)
+ err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S32_LE);
+ else if(format.byteOrder() == QAudioFormat::BigEndian)
+ err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S32_BE);
+ } else if(format.sampleType() == QAudioFormat::UnSignedInt) {
+ if(format.byteOrder() == QAudioFormat::LittleEndian)
+ err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U32_LE);
+ else if(format.byteOrder() == QAudioFormat::BigEndian)
+ err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U32_BE);
+ }
+ }
+ if(err>=0) {
+ testSize = true;
+ testType = true;
+ }
+ }
+ if(err>=0)
+ err = snd_pcm_hw_params(handle, params);
+
+ if(err == 0) {
+ // settings work
+ // close()
+ if(handle)
+ snd_pcm_close(handle);
+ return true;
+ }
+ if(handle)
+ snd_pcm_close(handle);
+
+ return false;
+}
+
+void QAudioDeviceInfoPrivate::updateLists()
+{
+ // redo all lists based on current settings
+ freqz.clear();
+ channelz.clear();
+ sizez.clear();
+ byteOrderz.clear();
+ typez.clear();
+ codecz.clear();
+
+ if(!handle)
+ open();
+
+ if(!handle)
+ return;
+
+ for(int i=0; i<(int)MAX_SAMPLE_RATES; i++) {
+ //if(snd_pcm_hw_params_test_rate(handle, params, SAMPLE_RATES[i], dir) == 0)
+ freqz.append(SAMPLE_RATES[i]);
+ }
+ channelz.append(1);
+ channelz.append(2);
+ sizez.append(8);
+ sizez.append(16);
+ sizez.append(32);
+ byteOrderz.append(QAudioFormat::LittleEndian);
+ byteOrderz.append(QAudioFormat::BigEndian);
+ typez.append(QAudioFormat::SignedInt);
+ typez.append(QAudioFormat::UnSignedInt);
+ typez.append(QAudioFormat::Float);
+ codecz.append(tr("audio/pcm"));
+ close();
+}
+
+QList<QByteArray> QAudioDeviceInfoPrivate::deviceList(QAudio::Mode mode)
+{
+ QAudio::Mode _m;
+ QList<QByteArray> devices;
+ QByteArray filter;
+ QString dir;
+
+ // Create a list of all current audio devices that support mode
+ void **hints, **n;
+ char *name, *descr, *io;
+
+ if(snd_device_name_hint(-1, "pcm", &hints) < 0) {
+ qWarning()<<"no alsa devices available";
+ return devices;
+ }
+ n = hints;
+
+ while (*n != NULL) {
+ _m = QAudio::AudioOutput;
+ name = snd_device_name_get_hint(*n, "NAME");
+ descr = snd_device_name_get_hint(*n, "DESC");
+ io = snd_device_name_get_hint(*n, "IOID");
+ dir = QString::fromUtf8(io);
+ if((name != NULL) && (descr != NULL) && ((io == NULL) || (dir.length() ==filter.length()))) {
+ if(dir.length() == 5)
+ _m = QAudio::AudioInput;
+ if(io == NULL)
+ _m = mode;
+
+ QString str = tr(name);
+
+ if(str.contains(tr("default"))) {
+ int pos = str.indexOf(tr("="),0);
+ devices.append(str.mid(pos+1).toLocal8Bit().constData());
+ }
+ }
+ if(name != NULL)
+ free(name);
+ if(descr != NULL)
+ free(descr);
+ if(io != NULL)
+ free(io);
+ n++;
+ }
+ snd_device_name_free_hint(hints);
+
+ if(devices.size() > 0) {
+ devices.append("default");
+ if(mode == QAudio::AudioInput) {
+ filter.append("Input");
+ } else {
+ filter.append("Output");
+ }
+ }
+
+ return devices;
+}
+
+QByteArray QAudioDeviceInfoPrivate::defaultInputDevice()
+{
+ QList<QByteArray> devices = deviceList(QAudio::AudioInput);
+ if(devices.size() == 0)
+ return QByteArray();
+
+ return QByteArray("default");
+}
+
+QByteArray QAudioDeviceInfoPrivate::defaultOutputDevice()
+{
+ QList<QByteArray> devices = deviceList(QAudio::AudioOutput);
+ if(devices.size() == 0)
+ return QByteArray();
+
+ return QByteArray("default");
+}
+
+
diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h
new file mode 100644
index 000000000..3ac92390d
--- /dev/null
+++ b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+
+#ifndef QAUDIODEVICEINFOALSA_H
+#define QAUDIODEVICEINFOALSA_H
+
+#include <alsa/asoundlib.h>
+
+#include <QtCore/qbytearray.h>
+#include <QtCore/qstringlist.h>
+#include <QtCore/qlist.h>
+#include <QtCore/qdebug.h>
+
+#include <QtMultimedia/qaudio.h>
+#include <QtMultimedia/qaudiodeviceinfo.h>
+#include <QtMultimedia/qaudioengine.h>
+
+const unsigned int MAX_SAMPLE_RATES = 5;
+const unsigned int SAMPLE_RATES[] =
+ { 8000, 11025, 22050, 44100, 48000 };
+
+class QAudioDeviceInfoPrivate : public QAbstractAudioDeviceInfo
+{
+ Q_OBJECT
+public:
+ QAudioDeviceInfoPrivate(QByteArray dev,QAudio::Mode mode);
+ ~QAudioDeviceInfoPrivate();
+
+ bool testSettings(const QAudioFormat& format) const;
+ void updateLists();
+ 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();
+ static QByteArray defaultInputDevice();
+ static QByteArray defaultOutputDevice();
+ static QList<QByteArray> deviceList(QAudio::Mode);
+
+private:
+ bool open();
+ void close();
+
+ QString device;
+ QAudio::Mode mode;
+ QAudioFormat nearest;
+ QList<int> freqz;
+ QList<int> channelz;
+ QList<int> sizez;
+ QList<QAudioFormat::Endian> byteOrderz;
+ QStringList codecz;
+ QList<QAudioFormat::SampleType> typez;
+ snd_pcm_t* handle;
+ snd_pcm_hw_params_t *params;
+};
+
+#endif
+
diff --git a/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp
new file mode 100644
index 000000000..c94e0c47b
--- /dev/null
+++ b/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp
@@ -0,0 +1,357 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qstringlist.h>
+#include <QtCore/qlist.h>
+#include <QtCore/qbytearray.h>
+#include <QtCore/qdatastream.h>
+#include <QtCore/qdebug.h>
+#include <private/qcore_mac_p.h>
+
+#include <QtMultimedia/qaudiodeviceinfo.h>
+#include "qaudio_mac_p.h"
+#include "qaudiodeviceinfo_mac_p.h"
+
+
+
+QT_BEGIN_NAMESPACE
+
+
+QAudioDeviceInfoPrivate::QAudioDeviceInfoPrivate(QByteArray const& handle, QAudio::Mode)
+{
+ QDataStream ds(handle);
+ quint32 did, tm;
+
+ ds >> did >> tm >> name;
+ deviceId = AudioDeviceID(did);
+ mode = QAudio::Mode(tm);
+}
+
+bool QAudioDeviceInfoPrivate::isFormatSupported(const QAudioFormat& format) const
+{
+ return format.codec() == QString::fromLatin1("audio/pcm");
+}
+
+QAudioFormat QAudioDeviceInfoPrivate::preferredFormat() const
+{
+ QAudioFormat rc;
+
+ UInt32 propSize = 0;
+
+ if (AudioDeviceGetPropertyInfo(deviceId,
+ 0,
+ mode == QAudio::AudioInput,
+ kAudioDevicePropertyStreams,
+ &propSize,
+ 0) == noErr) {
+
+ const int sc = propSize / sizeof(AudioStreamID);
+
+ if (sc > 0) {
+ AudioStreamID* streams = new AudioStreamID[sc];
+
+ if (AudioDeviceGetProperty(deviceId,
+ 0,
+ mode == QAudio::AudioInput,
+ kAudioDevicePropertyStreams,
+ &propSize,
+ streams) == noErr) {
+
+ for (int i = 0; i < sc; ++i) {
+ if (AudioStreamGetPropertyInfo(streams[i],
+ 0,
+ kAudioStreamPropertyPhysicalFormat,
+ &propSize,
+ 0) == noErr) {
+
+ AudioStreamBasicDescription sf;
+
+ if (AudioStreamGetProperty(streams[i],
+ 0,
+ kAudioStreamPropertyPhysicalFormat,
+ &propSize,
+ &sf) == noErr) {
+ rc = toQAudioFormat(sf);
+ break;
+ }
+ }
+ }
+ }
+
+ delete streams;
+ }
+ }
+
+ return rc;
+}
+
+QAudioFormat QAudioDeviceInfoPrivate::nearestFormat(const QAudioFormat& format) const
+{
+ QAudioFormat rc(format);
+ QAudioFormat target = preferredFormat();
+
+ if (!format.codec().isEmpty() && format.codec() != QString::fromLatin1("audio/pcm"))
+ return QAudioFormat();
+
+ rc.setCodec(QString::fromLatin1("audio/pcm"));
+
+ if (rc.frequency() != target.frequency())
+ rc.setFrequency(target.frequency());
+ if (rc.channels() != target.channels())
+ rc.setChannels(target.channels());
+ if (rc.sampleSize() != target.sampleSize())
+ rc.setSampleSize(target.sampleSize());
+ if (rc.byteOrder() != target.byteOrder())
+ rc.setByteOrder(target.byteOrder());
+ if (rc.sampleType() != target.sampleType())
+ rc.setSampleType(target.sampleType());
+
+ return rc;
+}
+
+QString QAudioDeviceInfoPrivate::deviceName() const
+{
+ return name;
+}
+
+QStringList QAudioDeviceInfoPrivate::codecList()
+{
+ return QStringList() << QString::fromLatin1("audio/pcm");
+}
+
+QList<int> QAudioDeviceInfoPrivate::frequencyList()
+{
+ QSet<int> rc;
+
+ // Add some common frequencies
+ rc << 8000 << 11025 << 22050 << 44100;
+
+ //
+ UInt32 propSize = 0;
+
+ if (AudioDeviceGetPropertyInfo(deviceId,
+ 0,
+ mode == QAudio::AudioInput,
+ kAudioDevicePropertyAvailableNominalSampleRates,
+ &propSize,
+ 0) == noErr) {
+
+ const int pc = propSize / sizeof(AudioValueRange);
+
+ if (pc > 0) {
+ AudioValueRange* vr = new AudioValueRange[pc];
+
+ if (AudioDeviceGetProperty(deviceId,
+ 0,
+ mode == QAudio::AudioInput,
+ kAudioDevicePropertyAvailableNominalSampleRates,
+ &propSize,
+ vr) == noErr) {
+
+ for (int i = 0; i < pc; ++i)
+ rc << vr[i].mMaximum;
+ }
+
+ delete vr;
+ }
+ }
+
+ return rc.toList();
+}
+
+QList<int> QAudioDeviceInfoPrivate::channelsList()
+{
+ QList<int> rc;
+
+ // Can mix down to 1 channel
+ rc << 1;
+
+ UInt32 propSize = 0;
+ int channels = 0;
+
+ if (AudioDeviceGetPropertyInfo(deviceId,
+ 0,
+ mode == QAudio::AudioInput,
+ kAudioDevicePropertyStreamConfiguration,
+ &propSize,
+ 0) == noErr) {
+
+ AudioBufferList* audioBufferList = static_cast<AudioBufferList*>(qMalloc(propSize));
+
+ if (audioBufferList != 0) {
+ if (AudioDeviceGetProperty(deviceId,
+ 0,
+ mode == QAudio::AudioInput,
+ kAudioDevicePropertyStreamConfiguration,
+ &propSize,
+ audioBufferList) == noErr) {
+
+ for (int i = 0; i < int(audioBufferList->mNumberBuffers); ++i) {
+ channels += audioBufferList->mBuffers[i].mNumberChannels;
+ rc << channels;
+ }
+ }
+
+ qFree(audioBufferList);
+ }
+ }
+
+ return rc;
+}
+
+QList<int> QAudioDeviceInfoPrivate::sampleSizeList()
+{
+ return QList<int>() << 8 << 16 << 24 << 32 << 64;
+}
+
+QList<QAudioFormat::Endian> QAudioDeviceInfoPrivate::byteOrderList()
+{
+ return QList<QAudioFormat::Endian>() << QAudioFormat::LittleEndian << QAudioFormat::BigEndian;
+}
+
+QList<QAudioFormat::SampleType> QAudioDeviceInfoPrivate::sampleTypeList()
+{
+ return QList<QAudioFormat::SampleType>() << QAudioFormat::SignedInt << QAudioFormat::UnSignedInt << QAudioFormat::Float;
+}
+
+static QByteArray get_device_info(AudioDeviceID audioDevice, QAudio::Mode mode)
+{
+ UInt32 size;
+ QByteArray device;
+ QDataStream ds(&device, QIODevice::WriteOnly);
+ AudioStreamBasicDescription sf;
+ CFStringRef name;
+ Boolean isInput = mode == QAudio::AudioInput;
+
+ // Id
+ ds << quint32(audioDevice);
+
+ // Mode
+ size = sizeof(AudioStreamBasicDescription);
+ if (AudioDeviceGetProperty(audioDevice, 0, isInput, kAudioDevicePropertyStreamFormat,
+ &size, &sf) != noErr) {
+ return QByteArray();
+ }
+ ds << quint32(mode);
+
+ // Name
+ size = sizeof(CFStringRef);
+ if (AudioDeviceGetProperty(audioDevice, 0, isInput, kAudioObjectPropertyName,
+ &size, &name) != noErr) {
+ qWarning() << "QAudioDeviceInfo: Unable to find device name";
+ }
+ ds << QCFString::toQString(name);
+
+ CFRelease(name);
+
+ return device;
+}
+
+QByteArray QAudioDeviceInfoPrivate::defaultInputDevice()
+{
+ AudioDeviceID audioDevice;
+ UInt32 size = sizeof(audioDevice);
+
+ if (AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice, &size,
+ &audioDevice) != noErr) {
+ qWarning() << "QAudioDeviceInfo: Unable to find default input device";
+ return QByteArray();
+ }
+
+ return get_device_info(audioDevice, QAudio::AudioInput);
+}
+
+QByteArray QAudioDeviceInfoPrivate::defaultOutputDevice()
+{
+ AudioDeviceID audioDevice;
+ UInt32 size = sizeof(audioDevice);
+
+ if (AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, &size,
+ &audioDevice) != noErr) {
+ qWarning() << "QAudioDeviceInfo: Unable to find default output device";
+ return QByteArray();
+ }
+
+ return get_device_info(audioDevice, QAudio::AudioOutput);
+}
+
+QList<QByteArray> QAudioDeviceInfoPrivate::deviceList(QAudio::Mode mode)
+{
+ QList<QByteArray> devices;
+
+ UInt32 propSize = 0;
+
+ if (AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices, &propSize, 0) == noErr) {
+
+ const int dc = propSize / sizeof(AudioDeviceID);
+
+ if (dc > 0) {
+ AudioDeviceID* audioDevices = new AudioDeviceID[dc];
+
+ if (AudioHardwareGetProperty(kAudioHardwarePropertyDevices, &propSize, audioDevices) == noErr) {
+ for (int i = 0; i < dc; ++i) {
+ QByteArray info = get_device_info(audioDevices[i], mode);
+ if (!info.isNull())
+ devices << info;
+ }
+ }
+
+ delete audioDevices;
+ }
+ }
+
+ return devices;
+}
+
+
+QT_END_NAMESPACE
+
diff --git a/src/multimedia/audio/qaudiodeviceinfo_mac_p.h b/src/multimedia/audio/qaudiodeviceinfo_mac_p.h
new file mode 100644
index 000000000..ee593dee7
--- /dev/null
+++ b/src/multimedia/audio/qaudiodeviceinfo_mac_p.h
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+
+#ifndef QDEVICEINFO_MAC_P_H
+#define QDEVICEINFO_MAC_P_H
+
+#include <CoreAudio/CoreAudio.h>
+
+#include <QtMultimedia/qaudioengine.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+class QAudioDeviceInfoPrivate : public QAbstractAudioDeviceInfo
+{
+public:
+ AudioDeviceID deviceId;
+ QString name;
+ QAudio::Mode mode;
+
+ QAudioDeviceInfoPrivate(QByteArray const& handle, QAudio::Mode mode);
+
+ bool isFormatSupported(const QAudioFormat& format) const;
+ QAudioFormat preferredFormat() 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();
+
+ static QByteArray defaultInputDevice();
+ static QByteArray defaultOutputDevice();
+
+ static QList<QByteArray> deviceList(QAudio::Mode mode);
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QDEVICEINFO_MAC_P_H
diff --git a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp
new file mode 100644
index 000000000..1a1995aa7
--- /dev/null
+++ b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp
@@ -0,0 +1,378 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+
+#include <windows.h>
+#include <mmsystem.h>
+#include "qaudiodeviceinfo_win32_p.h"
+
+// For mingw toolchain mmsystem.h only defines half the defines, so add if needed.
+#ifndef WAVE_FORMAT_44M08
+#define WAVE_FORMAT_44M08 0x00000100
+#define WAVE_FORMAT_44S08 0x00000200
+#define WAVE_FORMAT_44M16 0x00000400
+#define WAVE_FORMAT_44S16 0x00000800
+#define WAVE_FORMAT_48M08 0x00001000
+#define WAVE_FORMAT_48S08 0x00002000
+#define WAVE_FORMAT_48M16 0x00004000
+#define WAVE_FORMAT_48S16 0x00008000
+#define WAVE_FORMAT_96M08 0x00010000
+#define WAVE_FORMAT_96S08 0x00020000
+#define WAVE_FORMAT_96M16 0x00040000
+#define WAVE_FORMAT_96S16 0x00080000
+#endif
+
+
+QAudioDeviceInfoPrivate::QAudioDeviceInfoPrivate(QByteArray dev, QAudio::Mode mode)
+{
+ device = QLatin1String(dev);
+ this->mode = mode;
+}
+
+QAudioDeviceInfoPrivate::~QAudioDeviceInfoPrivate()
+{
+ close();
+}
+
+bool QAudioDeviceInfoPrivate::isFormatSupported(const QAudioFormat& format) const
+{
+ return testSettings(format);
+}
+
+QAudioFormat QAudioDeviceInfoPrivate::preferredFormat() const
+{
+ QAudioFormat nearest;
+ if(mode == QAudio::AudioOutput) {
+ nearest.setFrequency(44100);
+ nearest.setChannels(2);
+ nearest.setByteOrder(QAudioFormat::LittleEndian);
+ nearest.setSampleType(QAudioFormat::SignedInt);
+ nearest.setSampleSize(16);
+ nearest.setCodec(tr("audio/pcm"));
+ } else {
+ nearest.setFrequency(11025);
+ nearest.setChannels(1);
+ nearest.setSampleType(QAudioFormat::SignedInt);
+ nearest.setSampleSize(8);
+ nearest.setCodec(tr("audio/pcm"));
+ }
+ return nearest;
+}
+
+QAudioFormat QAudioDeviceInfoPrivate::nearestFormat(const QAudioFormat& format) const
+{
+ if(testSettings(format))
+ return format;
+ else
+ return preferredFormat();
+}
+
+QString QAudioDeviceInfoPrivate::deviceName() const
+{
+ return device;
+}
+
+QStringList QAudioDeviceInfoPrivate::codecList()
+{
+ updateLists();
+ return codecz;
+}
+
+QList<int> QAudioDeviceInfoPrivate::frequencyList()
+{
+ updateLists();
+ return freqz;
+}
+
+QList<int> QAudioDeviceInfoPrivate::channelsList()
+{
+ updateLists();
+ return channelz;
+}
+
+QList<int> QAudioDeviceInfoPrivate::sampleSizeList()
+{
+ updateLists();
+ return sizez;
+}
+
+QList<QAudioFormat::Endian> QAudioDeviceInfoPrivate::byteOrderList()
+{
+ updateLists();
+ return byteOrderz;
+}
+
+QList<QAudioFormat::SampleType> QAudioDeviceInfoPrivate::sampleTypeList()
+{
+ updateLists();
+ return typez;
+}
+
+
+bool QAudioDeviceInfoPrivate::open()
+{
+ return true;
+}
+
+void QAudioDeviceInfoPrivate::close()
+{
+}
+
+bool QAudioDeviceInfoPrivate::testSettings(const QAudioFormat& format) const
+{
+ // Set nearest to closest settings that do work.
+ // See if what is in settings will work (return value).
+
+ bool testChannel = false;
+ bool testCodec = false;
+ bool testFreq = false;
+
+ int err = 0;
+
+ // For now, just accept only audio/pcm codec
+ if(!format.codec().startsWith(tr("audio/pcm"))) {
+ err=-1;
+ } else
+ testCodec = true;
+
+ if(err>=0 && format.channels() != -1) {
+ testChannel = true;
+ }
+
+ if(err>=0 && format.frequency() != -1) {
+ testFreq = true;
+ }
+
+ if(err == 0) {
+ // settings work
+ return true;
+ }
+ return false;
+}
+
+void QAudioDeviceInfoPrivate::updateLists()
+{
+ // redo all lists based on current settings
+ bool base = false;
+ bool match = false;
+ DWORD fmt = NULL;
+ QString tmp;
+
+ if(device.compare(tr("default")) == 0)
+ base = true;
+
+ if(mode == QAudio::AudioOutput) {
+ WAVEOUTCAPS woc;
+ unsigned long iNumDevs,i;
+ iNumDevs = waveOutGetNumDevs();
+ for(i=0;i<iNumDevs;i++) {
+ if(waveOutGetDevCaps(i, &woc, sizeof(WAVEOUTCAPS))
+ == MMSYSERR_NOERROR) {
+ tmp = QString::fromUtf16((const unsigned short*)woc.szPname);
+ if(tmp.compare(device) == 0) {
+ match = true;
+ fmt = woc.dwFormats;
+ break;
+ }
+ if(base) {
+ match = true;
+ fmt = woc.dwFormats;
+ break;
+ }
+ }
+ }
+ } else {
+ WAVEINCAPS woc;
+ unsigned long iNumDevs,i;
+ iNumDevs = waveInGetNumDevs();
+ for(i=0;i<iNumDevs;i++) {
+ if(waveInGetDevCaps(i, &woc, sizeof(WAVEINCAPS))
+ == MMSYSERR_NOERROR) {
+ tmp = QString::fromUtf16((const unsigned short*)woc.szPname);
+ if(tmp.compare(device) == 0) {
+ match = true;
+ fmt = woc.dwFormats;
+ break;
+ }
+ if(base) {
+ match = true;
+ fmt = woc.dwFormats;
+ break;
+ }
+ }
+ }
+ }
+ sizez.clear();
+ freqz.clear();
+ channelz.clear();
+ byteOrderz.clear();
+ typez.clear();
+ codecz.clear();
+
+ if(match) {
+ if((fmt && WAVE_FORMAT_1M08)
+ || (fmt && WAVE_FORMAT_1S08)
+ || (fmt && WAVE_FORMAT_2M08)
+ || (fmt && WAVE_FORMAT_2S08)
+ || (fmt && WAVE_FORMAT_4M08)
+ || (fmt && WAVE_FORMAT_4S08)
+#ifndef Q_OS_WINCE
+ || (fmt && WAVE_FORMAT_48M08)
+ || (fmt && WAVE_FORMAT_48S08)
+ || (fmt && WAVE_FORMAT_96M08)
+ || (fmt && WAVE_FORMAT_96S08)
+#endif
+ ) {
+ sizez.append(8);
+ }
+ if((fmt && WAVE_FORMAT_1M16)
+ || (fmt && WAVE_FORMAT_1S16)
+ || (fmt && WAVE_FORMAT_2M16)
+ || (fmt && WAVE_FORMAT_2S16)
+ || (fmt && WAVE_FORMAT_4M16)
+ || (fmt && WAVE_FORMAT_4S16)
+#ifndef Q_OS_WINCE
+ || (fmt && WAVE_FORMAT_48M16)
+ || (fmt && WAVE_FORMAT_48S16)
+ || (fmt && WAVE_FORMAT_96M16)
+ || (fmt && WAVE_FORMAT_96S16)
+#endif
+ ) {
+ sizez.append(16);
+ }
+ if((fmt && WAVE_FORMAT_1M08)
+ || (fmt && WAVE_FORMAT_1S08)
+ || (fmt && WAVE_FORMAT_1M16)
+ || (fmt && WAVE_FORMAT_1S16)) {
+ freqz.append(11025);
+ }
+ if((fmt && WAVE_FORMAT_2M08)
+ || (fmt && WAVE_FORMAT_2S08)
+ || (fmt && WAVE_FORMAT_2M16)
+ || (fmt && WAVE_FORMAT_2S16)) {
+ freqz.append(22050);
+ }
+ if((fmt && WAVE_FORMAT_4M08)
+ || (fmt && WAVE_FORMAT_4S08)
+ || (fmt && WAVE_FORMAT_4M16)
+ || (fmt && WAVE_FORMAT_4S16)) {
+ freqz.append(44100);
+ }
+#ifndef Q_OS_WINCE
+ if((fmt && WAVE_FORMAT_48M08)
+ || (fmt && WAVE_FORMAT_48S08)
+ || (fmt && WAVE_FORMAT_48M16)
+ || (fmt && WAVE_FORMAT_48S16)) {
+ freqz.append(48000);
+ }
+ if((fmt && WAVE_FORMAT_96M08)
+ || (fmt && WAVE_FORMAT_96S08)
+ || (fmt && WAVE_FORMAT_96M16)
+ || (fmt && WAVE_FORMAT_96S16)) {
+ freqz.append(96000);
+ }
+#endif
+ channelz.append(1);
+ channelz.append(2);
+
+ byteOrderz.append(QAudioFormat::LittleEndian);
+
+ typez.append(QAudioFormat::SignedInt);
+ typez.append(QAudioFormat::UnSignedInt);
+
+ codecz.append(tr("audio/pcm"));
+ }
+}
+
+QList<QByteArray> QAudioDeviceInfoPrivate::deviceList(QAudio::Mode mode)
+{
+ Q_UNUSED(mode)
+
+ QList<QByteArray> devices;
+
+ devices.append("default");
+
+ if(mode == QAudio::AudioOutput) {
+ WAVEOUTCAPS woc;
+ unsigned long iNumDevs,i;
+ iNumDevs = waveOutGetNumDevs();
+ for(i=0;i<iNumDevs;i++) {
+ if(waveOutGetDevCaps(i, &woc, sizeof(WAVEOUTCAPS))
+ == MMSYSERR_NOERROR) {
+ devices.append(QString::fromUtf16((const unsigned short*)woc.szPname).toLocal8Bit().constData());
+ }
+ }
+ } else {
+ WAVEINCAPS woc;
+ unsigned long iNumDevs,i;
+ iNumDevs = waveInGetNumDevs();
+ for(i=0;i<iNumDevs;i++) {
+ if(waveInGetDevCaps(i, &woc, sizeof(WAVEINCAPS))
+ == MMSYSERR_NOERROR) {
+ devices.append(QString::fromUtf16((const unsigned short*)woc.szPname).toLocal8Bit().constData());
+ }
+ }
+
+ }
+ return devices;
+}
+
+QByteArray QAudioDeviceInfoPrivate::defaultOutputDevice()
+{
+ return QByteArray("default");
+}
+
+QByteArray QAudioDeviceInfoPrivate::defaultInputDevice()
+{
+ return QByteArray("default");
+}
+
diff --git a/src/multimedia/audio/qaudiodeviceinfo_win32_p.h b/src/multimedia/audio/qaudiodeviceinfo_win32_p.h
new file mode 100644
index 000000000..140a7417d
--- /dev/null
+++ b/src/multimedia/audio/qaudiodeviceinfo_win32_p.h
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+
+#ifndef QAUDIODEVICEINFOWIN_H
+#define QAUDIODEVICEINFOWIN_H
+
+#include <QtCore/qbytearray.h>
+#include <QtCore/qstringlist.h>
+#include <QtCore/qlist.h>
+#include <QtCore/qdebug.h>
+
+#include <QtMultimedia/qaudiodeviceinfo.h>
+#include <QtMultimedia/qaudioengine.h>
+
+
+const unsigned int MAX_SAMPLE_RATES = 5;
+const unsigned int SAMPLE_RATES[] = { 8000, 11025, 22050, 44100, 48000 };
+
+class QAudioDeviceInfoPrivate : public QAbstractAudioDeviceInfo
+{
+ Q_OBJECT
+
+public:
+ QAudioDeviceInfoPrivate(QByteArray dev,QAudio::Mode mode);
+ ~QAudioDeviceInfoPrivate();
+
+ bool open();
+ void close();
+
+ bool testSettings(const QAudioFormat& format) const;
+ void updateLists();
+ 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();
+ static QByteArray defaultInputDevice();
+ static QByteArray defaultOutputDevice();
+ static QList<QByteArray> deviceList(QAudio::Mode);
+
+private:
+ QAudio::Mode mode;
+ QString device;
+ QAudioFormat nearest;
+ QList<int> freqz;
+ QList<int> channelz;
+ QList<int> sizez;
+ QList<QAudioFormat::Endian> byteOrderz;
+ QStringList codecz;
+ QList<QAudioFormat::SampleType> typez;
+};
+
+#endif
diff --git a/src/multimedia/audio/qaudioengine.cpp b/src/multimedia/audio/qaudioengine.cpp
new file mode 100644
index 000000000..930977e02
--- /dev/null
+++ b/src/multimedia/audio/qaudioengine.cpp
@@ -0,0 +1,343 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtMultimedia/qaudioengine.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QAbstractAudioDeviceInfo
+ \brief The QAbstractAudioDeviceInfo class provides access for QAudioDeviceInfo to access the audio
+ device provided by the plugin.
+ \internal
+
+ \ingroup multimedia
+
+ This class implements the audio functionality for
+ QAudioDeviceInfo, i.e., QAudioDeviceInfo keeps a
+ QAbstractAudioDeviceInfo and routes function calls to it. For a
+ description of the functionality that QAbstractAudioDeviceInfo
+ implements, you can read the class and functions documentation of
+ QAudioDeviceInfo.
+
+ \sa QAudioDeviceInfo
+*/
+
+/*!
+ \fn virtual QAudioFormat QAbstractAudioDeviceInfo::preferredFormat() const
+ Returns the nearest settings.
+*/
+
+/*!
+ \fn virtual bool QAbstractAudioDeviceInfo::isFormatSupported(const QAudioFormat& format) const
+ Returns true if \a format is available from audio device.
+*/
+
+/*!
+ \fn virtual QAudioFormat QAbstractAudioDeviceInfo::nearestFormat(const QAudioFormat& format) const
+ Returns the nearest settings \a format.
+*/
+
+/*!
+ \fn virtual QString QAbstractAudioDeviceInfo::deviceName() const
+ Returns the audio device name.
+*/
+
+/*!
+ \fn virtual QStringList QAbstractAudioDeviceInfo::codecList()
+ Returns the list of currently available codecs.
+*/
+
+/*!
+ \fn virtual QList<int> QAbstractAudioDeviceInfo::frequencyList()
+ Returns the list of currently available frequencies.
+*/
+
+/*!
+ \fn virtual QList<int> QAbstractAudioDeviceInfo::channelsList()
+ Returns the list of currently available channels.
+*/
+
+/*!
+ \fn virtual QList<int> QAbstractAudioDeviceInfo::sampleSizeList()
+ Returns the list of currently available sample sizes.
+*/
+
+/*!
+ \fn virtual QList<QAudioFormat::Endian> QAbstractAudioDeviceInfo::byteOrderList()
+ Returns the list of currently available byte orders.
+*/
+
+/*!
+ \fn virtual QList<QAudioFormat::SampleType> QAbstractAudioDeviceInfo::sampleTypeList()
+ Returns the list of currently available sample types.
+*/
+
+/*!
+ \class QAbstractAudioOutput
+ \brief The QAbstractAudioOutput class provides access for QAudioOutput to access the audio
+ device provided by the plugin.
+ \internal
+
+ \ingroup multimedia
+
+ QAbstractAudioOutput implements audio functionality for
+ QAudioOutput, i.e., QAudioOutput routes function calls to
+ QAbstractAudioOutput. For a description of the functionality that
+ is implemented, see the QAudioOutput class and function
+ descriptions.
+
+ \sa QAudioOutput
+*/
+
+/*!
+ \fn virtual QIODevice* QAbstractAudioOutput::start(QIODevice* device)
+ Uses the \a device as the QIODevice to transfer data. If \a device is null then the class
+ creates an internal QIODevice. Returns a pointer to the QIODevice being used to handle
+ the data transfer. This QIODevice can be used to write() audio data directly. Passing a
+ QIODevice allows the data to be transfered without any extra code.
+*/
+
+/*!
+ \fn virtual void QAbstractAudioOutput::stop()
+ Stops the audio output.
+*/
+
+/*!
+ \fn virtual void QAbstractAudioOutput::reset()
+ Drops all audio data in the buffers, resets buffers to zero.
+*/
+
+/*!
+ \fn virtual void QAbstractAudioOutput::suspend()
+ Stops processing audio data, preserving buffered audio data.
+*/
+
+/*!
+ \fn virtual void QAbstractAudioOutput::resume()
+ Resumes processing audio data after a suspend()
+*/
+
+/*!
+ \fn virtual int QAbstractAudioOutput::bytesFree() const
+ Returns the free space available in bytes in the audio buffer.
+*/
+
+/*!
+ \fn virtual int QAbstractAudioOutput::periodSize() const
+ Returns the period size in bytes.
+*/
+
+/*!
+ \fn virtual void QAbstractAudioOutput::setBufferSize(int value)
+ Sets the audio buffer size to \a value in bytes.
+*/
+
+/*!
+ \fn virtual int QAbstractAudioOutput::bufferSize() const
+ Returns the audio buffer size in bytes.
+*/
+
+/*!
+ \fn virtual void QAbstractAudioOutput::setNotifyInterval(int ms)
+ Sets the interval for notify() signal to be emitted. This is based on the \a ms
+ of audio data processed not on actual real-time. The resolution of the timer
+ is platform specific.
+*/
+
+/*!
+ \fn virtual int QAbstractAudioOutput::notifyInterval() const
+ Returns the notify interval in milliseconds.
+*/
+
+/*!
+ \fn virtual qint64 QAbstractAudioOutput::totalTime() const
+ Returns the amount of audio data processed since start() was called in milliseconds.
+*/
+
+/*!
+ \fn virtual qint64 QAbstractAudioOutput::clock() const
+ Returns the milliseconds since start() was called, including time in Idle and suspend states.
+*/
+
+/*!
+ \fn virtual QAudio::Error QAbstractAudioOutput::error() const
+ Returns the error state.
+*/
+
+/*!
+ \fn virtual QAudio::State QAbstractAudioOutput::state() const
+ Returns the state of audio processing.
+*/
+
+/*!
+ \fn virtual QAudioFormat QAbstractAudioOutput::format() const
+ Returns the QAudioFormat being used.
+*/
+
+/*!
+ \fn QAbstractAudioOutput::stateChanged(QAudio::State state)
+ This signal is emitted when the device \a state has changed.
+*/
+
+/*!
+ \fn QAbstractAudioOutput::notify()
+ This signal is emitted when x ms of audio data has been processed
+ the interval set by setNotifyInterval(x).
+*/
+
+
+/*!
+ \class QAbstractAudioInput
+ \brief The QAbstractAudioInput class provides access for QAudioInput to access the audio
+ device provided by the plugin.
+ \internal
+
+ \ingroup multimedia
+
+ QAudioDeviceInput keeps an instance of QAbstractAudioInput and
+ routes calls to functions of the same name to QAbstractAudioInput.
+ This means that it is QAbstractAudioInput that implements the
+ audio functionality. For a description of the functionality, see
+ the QAudioInput class description.
+
+ \sa QAudioInput
+*/
+
+/*!
+ \fn virtual QIODevice* QAbstractAudioInput::start(QIODevice* device)
+ Uses the \a device as the QIODevice to transfer data. If \a device is null
+ then the class creates an internal QIODevice. Returns a pointer to the
+ QIODevice being used to handle the data transfer. This QIODevice can be used to
+ read() audio data directly. Passing a QIODevice allows the data to be transfered
+ without any extra code.
+*/
+
+/*!
+ \fn virtual void QAbstractAudioInput::stop()
+ Stops the audio input.
+*/
+
+/*!
+ \fn virtual void QAbstractAudioInput::reset()
+ Drops all audio data in the buffers, resets buffers to zero.
+*/
+
+/*!
+ \fn virtual void QAbstractAudioInput::suspend()
+ Stops processing audio data, preserving buffered audio data.
+*/
+
+/*!
+ \fn virtual void QAbstractAudioInput::resume()
+ Resumes processing audio data after a suspend().
+*/
+
+/*!
+ \fn virtual int QAbstractAudioInput::bytesReady() const
+ Returns the amount of audio data available to read in bytes.
+*/
+
+/*!
+ \fn virtual int QAbstractAudioInput::periodSize() const
+ Returns the period size in bytes.
+*/
+
+/*!
+ \fn virtual void QAbstractAudioInput::setBufferSize(int value)
+ Sets the audio buffer size to \a value in milliseconds.
+*/
+
+/*!
+ \fn virtual int QAbstractAudioInput::bufferSize() const
+ Returns the audio buffer size in milliseconds.
+*/
+
+/*!
+ \fn virtual void QAbstractAudioInput::setNotifyInterval(int ms)
+ Sets the interval for notify() signal to be emitted. This is based
+ on the \a ms of audio data processed not on actual real-time.
+ The resolution of the timer is platform specific.
+*/
+
+/*!
+ \fn virtual int QAbstractAudioInput::notifyInterval() const
+ Returns the notify interval in milliseconds.
+*/
+
+/*!
+ \fn virtual qint64 QAbstractAudioInput::totalTime() const
+ Returns the amount of audio data processed since start() was called in milliseconds.
+*/
+
+/*!
+ \fn virtual qint64 QAbstractAudioInput::clock() const
+ Returns the milliseconds since start() was called, including time in Idle and suspend states.
+*/
+
+/*!
+ \fn virtual QAudio::Error QAbstractAudioInput::error() const
+ Returns the error state.
+*/
+
+/*!
+ \fn virtual QAudio::State QAbstractAudioInput::state() const
+ Returns the state of audio processing.
+*/
+
+/*!
+ \fn virtual QAudioFormat QAbstractAudioInput::format() const
+ Returns the QAudioFormat being used
+*/
+
+/*!
+ \fn QAbstractAudioInput::stateChanged(QAudio::State state)
+ This signal is emitted when the device \a state has changed.
+*/
+
+/*!
+ \fn QAbstractAudioInput::notify()
+ This signal is emitted when x ms of audio data has been processed
+ the interval set by setNotifyInterval(x).
+*/
+
+
+QT_END_NAMESPACE
diff --git a/src/multimedia/audio/qaudioengine.h b/src/multimedia/audio/qaudioengine.h
new file mode 100644
index 000000000..b0aa7628b
--- /dev/null
+++ b/src/multimedia/audio/qaudioengine.h
@@ -0,0 +1,131 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QAUDIOENGINE_H
+#define QAUDIOENGINE_H
+
+#include <QtCore/qglobal.h>
+#include <QtMultimedia/qaudio.h>
+#include <QtMultimedia/qaudioformat.h>
+#include <QtMultimedia/qaudiodeviceinfo.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Multimedia)
+
+class Q_MULTIMEDIA_EXPORT QAbstractAudioDeviceInfo : public QObject
+{
+ Q_OBJECT
+
+public:
+ virtual QAudioFormat preferredFormat() const = 0;
+ virtual bool isFormatSupported(const QAudioFormat &format) const = 0;
+ virtual QAudioFormat nearestFormat(const QAudioFormat &format) const = 0;
+ virtual QString deviceName() const = 0;
+ virtual QStringList codecList() = 0;
+ virtual QList<int> frequencyList() = 0;
+ virtual QList<int> channelsList() = 0;
+ virtual QList<int> sampleSizeList() = 0;
+ virtual QList<QAudioFormat::Endian> byteOrderList() = 0;
+ virtual QList<QAudioFormat::SampleType> sampleTypeList() = 0;
+};
+
+class Q_MULTIMEDIA_EXPORT QAbstractAudioOutput : public QObject
+{
+ Q_OBJECT
+
+public:
+ virtual QIODevice* start(QIODevice* device) = 0;
+ virtual void stop() = 0;
+ virtual void reset() = 0;
+ virtual void suspend() = 0;
+ virtual void resume() = 0;
+ virtual int bytesFree() const = 0;
+ virtual int periodSize() const = 0;
+ virtual void setBufferSize(int value) = 0;
+ virtual int bufferSize() const = 0;
+ virtual void setNotifyInterval(int milliSeconds) = 0;
+ virtual int notifyInterval() const = 0;
+ virtual qint64 totalTime() const = 0;
+ virtual qint64 clock() const = 0;
+ virtual QAudio::Error error() const = 0;
+ virtual QAudio::State state() const = 0;
+ virtual QAudioFormat format() const = 0;
+
+Q_SIGNALS:
+ void stateChanged(QAudio::State);
+ void notify();
+};
+
+class Q_MULTIMEDIA_EXPORT QAbstractAudioInput : public QObject
+{
+ Q_OBJECT
+
+public:
+ virtual QIODevice* start(QIODevice* device) = 0;
+ virtual void stop() = 0;
+ virtual void reset() = 0;
+ virtual void suspend() = 0;
+ virtual void resume() = 0;
+ virtual int bytesReady() const = 0;
+ virtual int periodSize() const = 0;
+ virtual void setBufferSize(int value) = 0;
+ virtual int bufferSize() const = 0;
+ virtual void setNotifyInterval(int milliSeconds) = 0;
+ virtual int notifyInterval() const = 0;
+ virtual qint64 totalTime() const = 0;
+ virtual qint64 clock() const = 0;
+ virtual QAudio::Error error() const = 0;
+ virtual QAudio::State state() const = 0;
+ virtual QAudioFormat format() const = 0;
+
+Q_SIGNALS:
+ void stateChanged(QAudio::State);
+ void notify();
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QAUDIOENGINE_H
diff --git a/src/multimedia/audio/qaudioengineplugin.cpp b/src/multimedia/audio/qaudioengineplugin.cpp
new file mode 100644
index 000000000..6e3900493
--- /dev/null
+++ b/src/multimedia/audio/qaudioengineplugin.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtMultimedia/qaudioengineplugin.h>
+
+QT_BEGIN_NAMESPACE
+
+QAudioEnginePlugin::QAudioEnginePlugin(QObject* parent) :
+ QObject(parent)
+{}
+
+QAudioEnginePlugin::~QAudioEnginePlugin()
+{}
+
+QT_END_NAMESPACE
diff --git a/src/multimedia/audio/qaudioengineplugin.h b/src/multimedia/audio/qaudioengineplugin.h
new file mode 100644
index 000000000..8eab2d710
--- /dev/null
+++ b/src/multimedia/audio/qaudioengineplugin.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QAUDIOENGINEPLUGIN_H
+#define QAUDIOENGINEPLUGIN_H
+
+#include <QtCore/qstring.h>
+#include <QtCore/qplugin.h>
+#include <QtCore/qfactoryinterface.h>
+
+#include <QtMultimedia/qaudioformat.h>
+#include <QtMultimedia/qaudiodeviceinfo.h>
+#include <QtMultimedia/qaudioengine.h>
+
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Multimedia)
+
+struct Q_MULTIMEDIA_EXPORT QAudioEngineFactoryInterface : public QFactoryInterface
+{
+ virtual QList<QByteArray> deviceList(QAudio::Mode) const = 0;
+ virtual QAbstractAudioInput* createInput(const QByteArray& device, const QAudioFormat& format = QAudioFormat()) = 0;
+ virtual QAbstractAudioOutput* createOutput(const QByteArray& device, const QAudioFormat& format = QAudioFormat()) = 0;
+ virtual QAbstractAudioDeviceInfo* createDeviceInfo(const QByteArray& device, QAudio::Mode mode) = 0;
+};
+
+#define QAudioEngineFactoryInterface_iid \
+ "com.nokia.qt.QAudioEngineFactoryInterface"
+Q_DECLARE_INTERFACE(QAudioEngineFactoryInterface, QAudioEngineFactoryInterface_iid)
+
+class Q_MULTIMEDIA_EXPORT QAudioEnginePlugin : public QObject, public QAudioEngineFactoryInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(QAudioEngineFactoryInterface:QFactoryInterface)
+
+public:
+ QAudioEnginePlugin(QObject *parent = 0);
+ ~QAudioEnginePlugin();
+
+ virtual QStringList keys() const = 0;
+ virtual QList<QByteArray> deviceList(QAudio::Mode) const = 0;
+ virtual QAbstractAudioInput* createInput(const QByteArray& device, const QAudioFormat& format = QAudioFormat()) = 0;
+ virtual QAbstractAudioOutput* createOutput(const QByteArray& device, const QAudioFormat& format = QAudioFormat()) = 0;
+ virtual QAbstractAudioDeviceInfo* createDeviceInfo(const QByteArray& device, QAudio::Mode mode) = 0;
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QAUDIOENGINEPLUGIN_H
diff --git a/src/multimedia/audio/qaudioformat.cpp b/src/multimedia/audio/qaudioformat.cpp
new file mode 100644
index 000000000..6632c63c3
--- /dev/null
+++ b/src/multimedia/audio/qaudioformat.cpp
@@ -0,0 +1,335 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtMultimedia/qaudioformat.h>
+
+
+QT_BEGIN_NAMESPACE
+
+
+class QAudioFormatPrivate : public QSharedData
+{
+public:
+ QAudioFormatPrivate()
+ {
+ frequency = -1;
+ channels = -1;
+ sampleSize = -1;
+ byteOrder = QAudioFormat::Endian(QSysInfo::ByteOrder);
+ sampleType = QAudioFormat::Unknown;
+ }
+
+ QString codec;
+ QAudioFormat::Endian byteOrder;
+ QAudioFormat::SampleType sampleType;
+
+ int frequency;
+ int channels;
+ int sampleSize;
+};
+
+/*!
+ \class QAudioFormat
+ \brief The QAudioFormat class stores audio parameter information.
+
+ \inmodule QtMultimedia
+ \ingroup multimedia
+ \since 4.6
+
+ An audio format specifies how data in an audio stream is arranged,
+ i.e, how the stream is to be interpreted. The encoding itself is
+ specified by the codec() used for the stream.
+
+ In addition to the encoding, QAudioFormat contains other
+ parameters that further specify how the audio data is arranged.
+ These are the frequency, the number of channels, the sample size,
+ the sample type, and the byte order. The following table describes
+ these in more detail.
+
+ \table
+ \header
+ \o Parameter
+ \o Description
+ \row
+ \o Frequency
+ \o Samples per second of audio data in Hertz.
+ \row
+ \o Number of channels
+ \o The number of audio channels (typically one for mono
+ or two for stereo)
+ \row
+ \o Sample size
+ \o How much data is stored in each sample (typically 8
+ or 16)
+ \row
+ \o Sample type
+ \o Numerical representation of sample (typically signed integer,
+ unsigned integer or float)
+ \row
+ \o Byte order
+ \o Byte ordering of sample (typically little endian, big endian)
+ \endtable
+
+ You can obtain audio formats compatible with the audio device used
+ through functions in QAudioDeviceInfo. This class also lets you
+ query available parameter values for a device, so that you can set
+ the parameters yourself. See the QAudioDeviceInfo class
+ description for details.
+*/
+
+/*!
+ Construct a new audio format.
+
+ Values are initialized as follows:
+ \list
+ \o frequency() = -1
+ \o channels() = -1
+ \o sampleSize() = -1
+ \o byteOrder() = QAudioFormat::Endian(QSysInfo::ByteOrder)
+ \o sampleType() = QAudioFormat::Unknown
+ \c codec() = ""
+ \endlist
+*/
+
+QAudioFormat::QAudioFormat():
+ d(new QAudioFormatPrivate)
+{
+}
+
+/*!
+ Construct a new audio format using \a other.
+*/
+
+QAudioFormat::QAudioFormat(const QAudioFormat &other):
+ d(other.d)
+{
+}
+
+/*!
+ Destroy this audio format.
+*/
+
+QAudioFormat::~QAudioFormat()
+{
+}
+
+/*!
+ Assigns \a other to this QAudioFormat implementation.
+*/
+
+QAudioFormat& QAudioFormat::operator=(const QAudioFormat &other)
+{
+ d = other.d;
+ return *this;
+}
+
+/*!
+ Returns true if this QAudioFormat is equal to the \a other
+ QAudioFormat; otherwise returns false.
+
+ All elements of QAudioFormat are used for the comparison.
+*/
+
+bool QAudioFormat::operator==(const QAudioFormat &other) const
+{
+ return d->frequency == other.d->frequency &&
+ d->channels == other.d->channels &&
+ d->sampleSize == other.d->sampleSize &&
+ d->byteOrder == other.d->byteOrder &&
+ d->codec == other.d->codec &&
+ d->sampleType == other.d->sampleType;
+}
+
+/*!
+ Returns true if this QAudioFormat is not equal to the \a other
+ QAudioFormat; otherwise returns false.
+
+ All elements of QAudioFormat are used for the comparison.
+*/
+
+bool QAudioFormat::operator!=(const QAudioFormat& other) const
+{
+ return !(*this == other);
+}
+
+/*!
+ Returns true if any of the parameters are invalid.
+*/
+
+bool QAudioFormat::isNull() const
+{
+ return d->frequency == -1 && d->channels == -1 &&
+ d->sampleSize == -1 &&
+ d->byteOrder == QAudioFormat::Endian(QSysInfo::ByteOrder) &&
+ d->sampleType == QAudioFormat::Unknown &&
+ d->codec.isNull();
+}
+
+/*!
+ Sets the frequency to \a frequency.
+*/
+
+void QAudioFormat::setFrequency(int frequency)
+{
+ d->frequency = frequency;
+}
+
+/*!
+ Returns the current frequency value.
+*/
+
+int QAudioFormat::frequency() const
+{
+ return d->frequency;
+}
+
+/*!
+ Sets the channels to \a channels.
+*/
+
+void QAudioFormat::setChannels(int channels)
+{
+ d->channels = channels;
+}
+
+/*!
+ Returns the current channel value.
+*/
+
+int QAudioFormat::channels() const
+{
+ return d->channels;
+}
+
+/*!
+ Sets the sampleSize to \a sampleSize.
+*/
+
+void QAudioFormat::setSampleSize(int sampleSize)
+{
+ d->sampleSize = sampleSize;
+}
+
+/*!
+ Returns the current sampleSize value.
+*/
+
+int QAudioFormat::sampleSize() const
+{
+ return d->sampleSize;
+}
+
+/*!
+ Sets the codec to \a codec.
+
+ \sa QAudioDeviceInfo::supportedCodecs()
+*/
+
+void QAudioFormat::setCodec(QString codec)
+{
+ d->codec = codec;
+}
+
+/*!
+ Returns the current codec value.
+
+ \sa QAudioDeviceInfo::supportedCodecs()
+*/
+
+QString QAudioFormat::codec() const
+{
+ return d->codec;
+}
+
+/*!
+ Sets the byteOrder to \a byteOrder.
+*/
+
+void QAudioFormat::setByteOrder(QAudioFormat::Endian byteOrder)
+{
+ d->byteOrder = byteOrder;
+}
+
+/*!
+ Returns the current byteOrder value.
+*/
+
+QAudioFormat::Endian QAudioFormat::byteOrder() const
+{
+ return d->byteOrder;
+}
+
+/*!
+ Sets the sampleType to \a sampleType.
+*/
+
+void QAudioFormat::setSampleType(QAudioFormat::SampleType sampleType)
+{
+ d->sampleType = sampleType;
+}
+
+/*!
+ Returns the current SampleType value.
+*/
+
+QAudioFormat::SampleType QAudioFormat::sampleType() const
+{
+ return d->sampleType;
+}
+
+/*!
+ \enum QAudioFormat::SampleType
+
+ \value Unknown Not Set
+ \value SignedInt samples are signed integers
+ \value UnSignedInt samples are unsigned intergers
+ \value Float samples are floats
+*/
+
+/*!
+ \enum QAudioFormat::Endian
+
+ \value BigEndian samples are big endian byte order
+ \value LittleEndian samples are little endian byte order
+*/
+
+QT_END_NAMESPACE
+
diff --git a/src/multimedia/audio/qaudioformat.h b/src/multimedia/audio/qaudioformat.h
new file mode 100644
index 000000000..c74096978
--- /dev/null
+++ b/src/multimedia/audio/qaudioformat.h
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QAUDIOFORMAT_H
+#define QAUDIOFORMAT_H
+
+#include <QtCore/qobject.h>
+#include <QtCore/qglobal.h>
+#include <QtCore/qshareddata.h>
+
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Multimedia)
+
+
+class QAudioFormatPrivate;
+
+class Q_MULTIMEDIA_EXPORT QAudioFormat
+{
+public:
+ enum SampleType { Unknown, SignedInt, UnSignedInt, Float };
+ enum Endian { BigEndian = QSysInfo::BigEndian, LittleEndian = QSysInfo::LittleEndian };
+
+ QAudioFormat();
+ QAudioFormat(const QAudioFormat &other);
+ ~QAudioFormat();
+
+ QAudioFormat& operator=(const QAudioFormat &other);
+ bool operator==(const QAudioFormat &other) const;
+ bool operator!=(const QAudioFormat &other) const;
+
+ bool isNull() const;
+
+ void setFrequency(int frequency);
+ int frequency() const;
+
+ void setChannels(int channels);
+ int channels() const;
+
+ void setSampleSize(int sampleSize);
+ int sampleSize() const;
+
+ void setCodec(QString codec);
+ QString codec() const;
+
+ void setByteOrder(QAudioFormat::Endian byteOrder);
+ QAudioFormat::Endian byteOrder() const;
+
+ void setSampleType(QAudioFormat::SampleType sampleType);
+ QAudioFormat::SampleType sampleType() const;
+
+private:
+ QSharedDataPointer<QAudioFormatPrivate> d;
+};
+
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QAUDIOFORMAT_H
diff --git a/src/multimedia/audio/qaudioinput.cpp b/src/multimedia/audio/qaudioinput.cpp
new file mode 100644
index 000000000..17cacc6df
--- /dev/null
+++ b/src/multimedia/audio/qaudioinput.cpp
@@ -0,0 +1,400 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtMultimedia/qaudio.h>
+#include <QtMultimedia/qaudiodeviceinfo.h>
+#include <QtMultimedia/qaudioengine.h>
+#include <QtMultimedia/qaudioinput.h>
+
+#include "qaudiodevicefactory_p.h"
+
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QAudioInput
+ \brief The QAudioInput class provides an interface for receiving audio data from an audio input device.
+
+ \inmodule QtMultimedia
+ \ingroup multimedia
+ \since 4.6
+
+ You can construct an audio input with the system's
+ \l{QAudioDeviceInfo::defaultInputDevice()}{default audio input
+ device}. It is also possible to create QAudioInput with a
+ specific QAudioDeviceId. When you create the audio input, you
+ should also send in the QAudioFormat to be used for the recording
+ (see the QAudioFormat class description for details).
+
+ To record to a file:
+
+ QAudioInput lets you record audio with an audio input device. The
+ default constructor of this class will use the systems default
+ audio device, but you can also specify a QAudioDeviceId for a
+ specific device. You also need to pass in the QAudioFormat in
+ which you wish to record.
+
+ Starting up the QAudioInput is simply a matter of calling start()
+ with a QIODevice opened for writing. For instance, to record to a
+ file, you can:
+
+ \code
+ {
+ QFile outputFile;
+ outputFile.setFileName("/tmp/test.raw");
+ outputFile.open( QIODevice::WriteOnly | QIODevice::Truncate );
+
+ QAudioFormat format;
+ // set up the format you want, eg.
+ format.setFrequency(8000);
+ format.setChannels(1);
+ format.setSampleSize(8);
+ format.setCodec("audio/pcm");
+ format.setByteOrder(QAudioFormat::LittleEndian);
+ format.setSampleType(QAudioFormat::UnSignedInt);
+
+ QAudioInput *audio = new QAudioInput(format, this);
+ QTimer::singleShot(3000, this, SLOT(stopRecording()));
+ audio->start(outputFile);
+ // Records audio for 3000ms
+ }
+ \endcode
+
+ This will start recording if the format specified is supported by
+ the input device (you can check this with
+ QAudioDeviceInfo::isFormatSupported(). In case there are any
+ snags, use the error() function to check what went wrong. We stop
+ recording in the \c stopRecording() slot.
+
+ \code
+ void stopRecording()
+ {
+ audio->stop();
+ outputFile->close();
+ }
+ \endcode
+
+ At any point in time, QAudioInput will be in one of four states:
+ active, suspended, stopped, or idle. These states are specified by
+ the QAudio::State enum. You can request a state change directly through
+ suspend(), resume(), stop(), reset(), and start(). The current
+ state is reported by state(). QAudioOutput will also signal you
+ when the state changes (stateChanged()).
+
+ QAudioInput provides several ways of measuring the time that has
+ passed since the start() of the recording. The \c totalTime()
+ function returns the length of the stream in microseconds written,
+ i.e., it leaves out the times the audio input was suspended or idle.
+ The clock() function returns the time elapsed since start() was called regardless of
+ which states the QAudioInput has been in.
+
+ If an error should occur, you can fetch its reason with error().
+ The possible error reasons are described by the QAudio::Error enum.
+
+ \sa QAudioOutput, QAudioDeviceInfo
+*/
+
+/*!
+ Construct a new audio input and attach it to \a parent.
+ The default audio input device is used with the output
+ \a format parameters.
+*/
+
+QAudioInput::QAudioInput(const QAudioFormat &format, QObject *parent):
+ QObject(parent)
+{
+ d = QAudioDeviceFactory::createDefaultInputDevice(format);
+ connect(d, SIGNAL(notify()), SIGNAL(notify()));
+ connect(d, SIGNAL(stateChanged(QAudio::State)), SIGNAL(stateChanged(QAudio::State)));
+}
+
+/*!
+ Construct a new audio input and attach it to \a parent.
+ The \a id of the audio input device is used with the input
+ \a format parameters.
+*/
+
+QAudioInput::QAudioInput(const QAudioDeviceId &id, const QAudioFormat &format, QObject *parent):
+ QObject(parent)
+{
+ d = QAudioDeviceFactory::createInputDevice(id, format);
+ connect(d, SIGNAL(notify()), SIGNAL(notify()));
+ connect(d, SIGNAL(stateChanged(QAudio::State)), SIGNAL(stateChanged(QAudio::State)));
+}
+
+/*!
+ Destroy this audio input.
+*/
+
+QAudioInput::~QAudioInput()
+{
+ delete d;
+}
+
+/*!
+ Uses the \a device as the QIODevice to transfer data.
+ If \a device is null then the class creates an internal QIODevice.
+ Returns a pointer to the QIODevice being used to handle the data
+ transfer. This QIODevice can be used to read() audio data
+ directly.
+ Passing a QIODevice allows the data to be transfered without any extra code.
+ All that is required is to open the QIODevice.
+
+ /sa QIODevice
+*/
+
+QIODevice* QAudioInput::start(QIODevice* device)
+{
+ /*
+ PULL MODE (valid QIODevice)
+ -If currently not StopState, stop
+ -If previous start was push mode, delete internal QIODevice.
+ -open audio input.
+ If ok, NoError and ActiveState, else OpenError and StopState.
+ -emit stateChanged()
+ -return device
+
+ PUSH MODE (device = 0)
+ -If currently not StopState, stop
+ -If no internal QIODevice, create one.
+ -open audio input.
+ -If ok, NoError and IdleState, else OpenError and StopState
+ -emit stateChanged()
+ -return internal QIODevice
+ */
+ return d->start(device);
+}
+
+/*!
+ Returns the QAudioFormat being used.
+*/
+
+QAudioFormat QAudioInput::format() const
+{
+ return d->format();
+}
+
+/*!
+ Stops the audio input.
+*/
+
+void QAudioInput::stop()
+{
+ /*
+ -If StopState, return
+ -set to StopState
+ -detach from audio device
+ -emit stateChanged()
+ */
+ d->stop();
+}
+
+/*!
+ Drops all audio data in the buffers, resets buffers to zero.
+*/
+
+void QAudioInput::reset()
+{
+ /*
+ -drop all buffered audio, set buffers to zero.
+ -call stop()
+ */
+ d->reset();
+}
+
+/*!
+ Stops processing audio data, preserving buffered audio data.
+*/
+
+void QAudioInput::suspend()
+{
+ /*
+ -If not ActiveState|IdleState, return
+ -stop processing audio, saving all buffered audio data
+ -set NoError and SuspendState
+ -emit stateChanged()
+ */
+ d->suspend();
+}
+
+/*!
+ Resumes processing audio data after a suspend().
+*/
+
+void QAudioInput::resume()
+{
+ /*
+ -If SuspendState, return
+ -resume audio
+ -(PULL MODE): set ActiveState, NoError
+ -(PUSH MODE): set IdleState, NoError
+ -kick start audio if needed
+ -emit stateChanged()
+ */
+ d->resume();
+}
+
+/*!
+ Sets the audio buffer size to \a value milliseconds.
+
+ Note: This function can be called anytime before start(), calls to this
+ are ignored after start(). It should not be assumed that the buffer size
+ set is the actual buffer size used, calling bufferSize() anytime after start()
+ will return the actual buffer size being used.
+
+*/
+
+void QAudioInput::setBufferSize(int value)
+{
+ d->setBufferSize(value);
+}
+
+/*!
+ Returns the audio buffer size in milliseconds.
+
+ If called before start(), returns platform default value.
+ If called before start() but setBufferSize() was called prior, returns value set by setBufferSize().
+ If called after start(), returns the actual buffer size being used. This may not be what was set previously
+ by setBufferSize().
+
+*/
+
+int QAudioInput::bufferSize() const
+{
+ return d->bufferSize();
+}
+
+/*!
+ Returns the amount of audio data available to read in bytes.
+*/
+
+int QAudioInput::bytesReady() const
+{
+ /*
+ -If not ActiveState|IdleState, return 0
+ -return amount of audio data available to read
+ */
+ return d->bytesReady();
+}
+
+/*!
+ Returns the period size in bytes.
+
+ Note: This is the recommended read size in bytes.
+*/
+
+int QAudioInput::periodSize() const
+{
+ return d->periodSize();
+}
+
+/*!
+ Sets the interval for notify() signal to be emitted.
+ This is based on the \a ms of audio data processed
+ not on actual real-time. The resolution of the timer is platform specific.
+*/
+
+void QAudioInput::setNotifyInterval(int ms)
+{
+ d->setNotifyInterval(ms);
+}
+
+/*!
+ Returns the notify interval in milliseconds.
+*/
+
+int QAudioInput::notifyInterval() const
+{
+ return d->notifyInterval();
+}
+
+/*!
+ Returns the amount of audio data processed since start()
+ was called in microseconds.
+*/
+
+qint64 QAudioInput::totalTime() const
+{
+ return d->totalTime();
+}
+
+/*!
+ Returns the microseconds since start() was called, including time in Idle and
+ Suspend states.
+*/
+
+qint64 QAudioInput::clock() const
+{
+ return d->clock();
+}
+
+/*!
+ Returns the error state.
+*/
+
+QAudio::Error QAudioInput::error() const
+{
+ return d->error();
+}
+
+/*!
+ Returns the state of audio processing.
+*/
+
+QAudio::State QAudioInput::state() const
+{
+ return d->state();
+}
+
+/*!
+ \fn QAudioInput::stateChanged(QAudio::State state)
+ This signal is emitted when the device \a state has changed.
+*/
+
+/*!
+ \fn QAudioInput::notify()
+ This signal is emitted when x ms of audio data has been processed
+ the interval set by setNotifyInterval(x).
+*/
+
+QT_END_NAMESPACE
+
diff --git a/src/multimedia/audio/qaudioinput.h b/src/multimedia/audio/qaudioinput.h
new file mode 100644
index 000000000..b0f1aed6e
--- /dev/null
+++ b/src/multimedia/audio/qaudioinput.h
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QAUDIOINPUT_H
+#define QAUDIOINPUT_H
+
+#include <QtCore/qiodevice.h>
+#include <QtCore/qglobal.h>
+
+#include <QtMultimedia/qaudio.h>
+#include <QtMultimedia/qaudioformat.h>
+#include <QtMultimedia/qaudiodeviceid.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Multimedia)
+
+
+class QAbstractAudioInput;
+
+class Q_MULTIMEDIA_EXPORT QAudioInput : public QObject
+{
+ Q_OBJECT
+
+public:
+ explicit QAudioInput(const QAudioFormat &format = QAudioFormat(), QObject *parent = 0);
+ explicit QAudioInput(const QAudioDeviceId &id, const QAudioFormat &format = QAudioFormat(), QObject *parent = 0);
+ ~QAudioInput();
+
+ QAudioFormat format() const;
+
+ QIODevice* start(QIODevice *device = 0);
+ void stop();
+ void reset();
+ void suspend();
+ void resume();
+
+ void setBufferSize(int bytes);
+ int bufferSize() const;
+
+ int bytesReady() const;
+ int periodSize() const;
+
+ void setNotifyInterval(int milliSeconds);
+ int notifyInterval() const;
+
+ qint64 totalTime() const;
+ qint64 clock() const;
+
+ QAudio::Error error() const;
+ QAudio::State state() const;
+
+Q_SIGNALS:
+ void stateChanged(QAudio::State);
+ void notify();
+
+private:
+ Q_DISABLE_COPY(QAudioInput);
+
+ QAbstractAudioInput* d;
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QAUDIOINPUT_H
diff --git a/src/multimedia/audio/qaudioinput_alsa_p.cpp b/src/multimedia/audio/qaudioinput_alsa_p.cpp
new file mode 100644
index 000000000..6f00469fc
--- /dev/null
+++ b/src/multimedia/audio/qaudioinput_alsa_p.cpp
@@ -0,0 +1,688 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qcoreapplication.h>
+#include "qaudioinput_alsa_p.h"
+
+//#define DEBUG_AUDIO 1
+
+QAudioInputPrivate::QAudioInputPrivate(const QByteArray &device, const QAudioFormat& audioFormat):
+ settings(audioFormat)
+{
+ bytesAvailable = 0;
+ handle = 0;
+ ahandler = 0;
+ access = SND_PCM_ACCESS_RW_INTERLEAVED;
+ pcmformat = SND_PCM_FORMAT_S16;
+ buffer_size = 0;
+ period_size = 0;
+ buffer_time = 100000;
+ period_time = 20000;
+ totalTimeValue = 0;
+ intervalTime = 1000;
+ audioBuffer = 0;
+ errorState = QAudio::NoError;
+ deviceState = QAudio::StopState;
+ audioSource = 0;
+ pullMode = true;
+ resuming = false;
+
+ QStringList list1 = QString(tr(device)).split(tr(":"));
+ m_device = QByteArray(list1.at(0).toLocal8Bit().constData());
+
+ timer = new QTimer(this);
+ connect(timer,SIGNAL(timeout()),SLOT(userFeed()));
+}
+
+QAudioInputPrivate::~QAudioInputPrivate()
+{
+ close();
+ disconnect(timer, SIGNAL(timeout()));
+ QCoreApplication::processEvents();
+ delete timer;
+}
+
+QAudio::Error QAudioInputPrivate::error() const
+{
+ return errorState;
+}
+
+QAudio::State QAudioInputPrivate::state() const
+{
+ return deviceState;
+}
+
+
+QAudioFormat QAudioInputPrivate::format() const
+{
+ return settings;
+}
+
+int QAudioInputPrivate::xrun_recovery(int err)
+{
+ int count = 0;
+ bool reset = false;
+
+ if(err == -EPIPE) {
+ errorState = QAudio::UnderrunError;
+ err = snd_pcm_prepare(handle);
+ if(err < 0)
+ reset = true;
+
+ } else if((err == -ESTRPIPE)||(err == -EIO)) {
+ errorState = QAudio::IOError;
+ while((err = snd_pcm_resume(handle)) == -EAGAIN){
+ usleep(100);
+ count++;
+ if(count > 5) {
+ reset = true;
+ break;
+ }
+ }
+ if(err < 0) {
+ err = snd_pcm_prepare(handle);
+ if(err < 0)
+ reset = true;
+ }
+ }
+ if(reset) {
+ close();
+ open();
+ snd_pcm_prepare(handle);
+ return 0;
+ }
+ return err;
+}
+
+int QAudioInputPrivate::setFormat()
+{
+ snd_pcm_format_t format = SND_PCM_FORMAT_S16;
+
+ if(settings.sampleSize() == 8) {
+ format = SND_PCM_FORMAT_U8;
+ } else if(settings.sampleSize() == 16) {
+ if(settings.sampleType() == QAudioFormat::SignedInt) {
+ if(settings.byteOrder() == QAudioFormat::LittleEndian)
+ format = SND_PCM_FORMAT_S16_LE;
+ else
+ format = SND_PCM_FORMAT_S16_BE;
+ } else if(settings.sampleType() == QAudioFormat::UnSignedInt) {
+ if(settings.byteOrder() == QAudioFormat::LittleEndian)
+ format = SND_PCM_FORMAT_U16_LE;
+ else
+ format = SND_PCM_FORMAT_U16_BE;
+ }
+ } else if(settings.sampleSize() == 24) {
+ if(settings.sampleType() == QAudioFormat::SignedInt) {
+ if(settings.byteOrder() == QAudioFormat::LittleEndian)
+ format = SND_PCM_FORMAT_S24_LE;
+ else
+ format = SND_PCM_FORMAT_S24_BE;
+ } else if(settings.sampleType() == QAudioFormat::UnSignedInt) {
+ if(settings.byteOrder() == QAudioFormat::LittleEndian)
+ format = SND_PCM_FORMAT_U24_LE;
+ else
+ format = SND_PCM_FORMAT_U24_BE;
+ }
+ } else if(settings.sampleSize() == 32) {
+ if(settings.sampleType() == QAudioFormat::SignedInt) {
+ if(settings.byteOrder() == QAudioFormat::LittleEndian)
+ format = SND_PCM_FORMAT_S32_LE;
+ else
+ format = SND_PCM_FORMAT_S32_BE;
+ } else if(settings.sampleType() == QAudioFormat::UnSignedInt) {
+ if(settings.byteOrder() == QAudioFormat::LittleEndian)
+ format = SND_PCM_FORMAT_U32_LE;
+ else
+ format = SND_PCM_FORMAT_U32_BE;
+ } else if(settings.sampleType() == QAudioFormat::Float) {
+ if(settings.byteOrder() == QAudioFormat::LittleEndian)
+ format = SND_PCM_FORMAT_FLOAT_LE;
+ else
+ format = SND_PCM_FORMAT_FLOAT_BE;
+ }
+ } else if(settings.sampleSize() == 64) {
+ if(settings.byteOrder() == QAudioFormat::LittleEndian)
+ format = SND_PCM_FORMAT_FLOAT64_LE;
+ else
+ format = SND_PCM_FORMAT_FLOAT64_BE;
+ }
+
+ return snd_pcm_hw_params_set_format( handle, hwparams, format);
+}
+
+QIODevice* QAudioInputPrivate::start(QIODevice* device)
+{
+ if(deviceState != QAudio::StopState)
+ close();
+
+ if(!pullMode && audioSource) {
+ delete audioSource;
+ }
+
+ if(device) {
+ //set to pull mode
+ pullMode = true;
+ audioSource = device;
+ } else {
+ //set to push mode
+ pullMode = false;
+ audioSource = new InputPrivate(this);
+ audioSource->open(QIODevice::ReadOnly | QIODevice::Unbuffered);
+ }
+
+ if( !open() )
+ return 0;
+
+ emit stateChanged(deviceState);
+
+ return audioSource;
+}
+
+void QAudioInputPrivate::stop()
+{
+ if(deviceState == QAudio::StopState)
+ return;
+
+ deviceState = QAudio::StopState;
+
+ close();
+ emit stateChanged(deviceState);
+}
+
+bool QAudioInputPrivate::open()
+{
+#ifdef DEBUG_AUDIO
+ QTime now(QTime::currentTime());
+ qDebug()<<now.second()<<"s "<<now.msec()<<"ms :open()";
+#endif
+ timeStamp.restart();
+
+ int dir;
+ int err=-1;
+ int count=0;
+ unsigned int freakuency=settings.frequency();
+
+ QString dev = QString(tr(m_device.constData()));
+ if(!dev.contains(tr("default"))) {
+ dev = QString(tr("default:CARD=%1")).arg(tr(m_device.constData()));
+ }
+
+ // Step 1: try and open the device
+ while((count < 5) && (err < 0)) {
+ err=snd_pcm_open(&handle,dev.toLocal8Bit().constData(),SND_PCM_STREAM_CAPTURE,0);
+ if(err < 0)
+ count++;
+ }
+ if (( err < 0)||(handle == 0)) {
+ errorState = QAudio::OpenError;
+ deviceState = QAudio::StopState;
+ emit stateChanged(deviceState);
+ return false;
+ }
+ snd_pcm_nonblock( handle, 0 );
+
+ // Step 2: Set the desired HW parameters.
+ snd_pcm_hw_params_alloca( &hwparams );
+
+ bool fatal = false;
+ QString errMessage;
+ unsigned int chunks = 8;
+
+ err = snd_pcm_hw_params_any( handle, hwparams );
+ if ( err < 0 ) {
+ fatal = true;
+ errMessage = QString(tr("QAudioInput: snd_pcm_hw_params_any: err = %1")).arg(err);
+ }
+ if ( !fatal ) {
+ err = snd_pcm_hw_params_set_rate_resample( handle, hwparams, 1 );
+ if ( err < 0 ) {
+ fatal = true;
+ errMessage = QString(tr("QAudioInput: snd_pcm_hw_params_set_rate_resample: err = %1")).arg(err);
+ }
+ }
+ if ( !fatal ) {
+ err = snd_pcm_hw_params_set_access( handle, hwparams, access );
+ if ( err < 0 ) {
+ fatal = true;
+ errMessage = QString(tr("QAudioInput: snd_pcm_hw_params_set_access: err = %1")).arg(err);
+ }
+ }
+ if ( !fatal ) {
+ err = setFormat();
+ if ( err < 0 ) {
+ fatal = true;
+ errMessage = QString(tr("QAudioInput: snd_pcm_hw_params_set_format: err = %1")).arg(err);
+ }
+ }
+ if ( !fatal ) {
+ err = snd_pcm_hw_params_set_channels( handle, hwparams, (unsigned int)settings.channels() );
+ if ( err < 0 ) {
+ fatal = true;
+ errMessage = QString(tr("QAudioInput: snd_pcm_hw_params_set_channels: err = %1")).arg(err);
+ }
+ }
+ if ( !fatal ) {
+ err = snd_pcm_hw_params_set_rate_near( handle, hwparams, &freakuency, 0 );
+ if ( err < 0 ) {
+ fatal = true;
+ errMessage = QString(tr("QAudioInput: snd_pcm_hw_params_set_rate_near: err = %1")).arg(err);
+ }
+ }
+ if ( !fatal ) {
+ err = snd_pcm_hw_params_set_buffer_time_near(handle, hwparams, &buffer_time, &dir);
+ if ( err < 0 ) {
+ fatal = true;
+ errMessage = QString(tr("QAudioInput: snd_pcm_hw_params_set_buffer_time_near: err = %1")).arg(err);
+ }
+ }
+ if ( !fatal ) {
+ err = snd_pcm_hw_params_set_period_time_near(handle, hwparams, &period_time, &dir);
+ if ( err < 0 ) {
+ fatal = true;
+ errMessage = QString(tr("QAudioInput: snd_pcm_hw_params_set_period_time_near: err = %1")).arg(err);
+ }
+ }
+ if ( !fatal ) {
+ err = snd_pcm_hw_params_set_periods_near(handle, hwparams, &chunks, &dir);
+ if ( err < 0 ) {
+ fatal = true;
+ errMessage = QString(tr("QAudioInput: snd_pcm_hw_params_set_periods_near: err = %1")).arg(err);
+ }
+ }
+ if ( !fatal ) {
+ err = snd_pcm_hw_params(handle, hwparams);
+ if ( err < 0 ) {
+ fatal = true;
+ errMessage = QString(tr("QAudioInput: snd_pcm_hw_params: err = %1")).arg(err);
+ }
+ }
+ if( err < 0) {
+ qWarning()<<errMessage;
+ errorState = QAudio::OpenError;
+ deviceState = QAudio::StopState;
+ emit stateChanged(deviceState);
+ return false;
+ }
+ snd_pcm_hw_params_get_buffer_size(hwparams,&buffer_frames);
+ buffer_size = snd_pcm_frames_to_bytes(handle,buffer_frames);
+ snd_pcm_hw_params_get_period_size(hwparams,&period_frames, &dir);
+ period_size = snd_pcm_frames_to_bytes(handle,period_frames);
+ snd_pcm_hw_params_get_buffer_time(hwparams,&buffer_time, &dir);
+ snd_pcm_hw_params_get_period_time(hwparams,&period_time, &dir);
+
+ // Step 3: Set the desired SW parameters.
+ snd_pcm_sw_params_t *swparams;
+ snd_pcm_sw_params_alloca(&swparams);
+ snd_pcm_sw_params_current(handle, swparams);
+ snd_pcm_sw_params_set_start_threshold(handle,swparams,period_frames);
+ snd_pcm_sw_params_set_stop_threshold(handle,swparams,buffer_frames);
+ snd_pcm_sw_params_set_avail_min(handle, swparams,period_frames);
+ snd_pcm_sw_params(handle, swparams);
+
+ // Step 4: Prepare audio
+ if(audioBuffer == 0)
+ audioBuffer = new char[buffer_size];
+ snd_pcm_prepare( handle );
+ snd_pcm_start(handle);
+
+ // Step 5: Setup timer
+ bytesAvailable = bytesReady();
+
+ if(pullMode)
+ connect(audioSource,SIGNAL(readyRead()),this,SLOT(userFeed()));
+
+ // Step 6: Start audio processing
+ chunks = buffer_size/period_size;
+ timer->start(period_time*chunks/2000);
+
+ errorState = QAudio::NoError;
+ deviceState = QAudio::ActiveState;
+
+ totalTimeValue = 0;
+
+ return true;
+}
+
+void QAudioInputPrivate::close()
+{
+ deviceState = QAudio::StopState;
+ timer->stop();
+
+ if ( handle ) {
+ snd_pcm_drop( handle );
+ snd_pcm_close( handle );
+ handle = 0;
+ delete [] audioBuffer;
+ audioBuffer=0;
+ }
+}
+
+int QAudioInputPrivate::bytesReady() const
+{
+ if(resuming)
+ return period_size;
+
+ if(deviceState != QAudio::ActiveState)
+ return 0;
+ int frames = snd_pcm_avail_update(handle);
+ if((int)frames > (int)buffer_frames)
+ frames = buffer_frames;
+
+ return snd_pcm_frames_to_bytes(handle, frames);
+}
+
+qint64 QAudioInputPrivate::read(char* data, qint64 len)
+{
+ Q_UNUSED(data)
+ Q_UNUSED(len)
+ // Read in some audio data and write it to QIODevice, pull mode
+ if ( !handle )
+ return 0;
+
+ bytesAvailable = bytesReady();
+
+ int count=0, err = 0;
+ while(count < 5) {
+ int chunks = bytesAvailable/period_size;
+ int frames = chunks*period_frames;
+ if(frames > (int)buffer_frames)
+ frames = buffer_frames;
+ int readFrames = snd_pcm_readi(handle, audioBuffer, frames);
+ if (readFrames >= 0) {
+ err = snd_pcm_frames_to_bytes(handle, readFrames);
+#ifdef DEBUG_AUDIO
+ qDebug()<<QString(tr("PULL: read in bytes = %1 (frames=%2)")).arg(err).arg(readFrames).toLatin1().constData();
+#endif
+ break;
+ } else if((readFrames == -EAGAIN) || (readFrames == -EINTR)) {
+ errorState = QAudio::IOError;
+ err = 0;
+ break;
+ } else {
+ if(readFrames == -EPIPE) {
+ errorState = QAudio::UnderrunError;
+ err = snd_pcm_prepare(handle);
+ } else if(readFrames == -ESTRPIPE) {
+ err = snd_pcm_prepare(handle);
+ }
+ if(err != 0) break;
+ }
+ count++;
+ }
+ if(err > 0) {
+ // got some send it onward
+#ifdef DEBUG_AUDIO
+ qDebug()<<"PULL: frames to write to QIODevice = "<<
+ snd_pcm_bytes_to_frames( handle, (int)err )<<" ("<<err<<") bytes";
+#endif
+ if(deviceState != QAudio::ActiveState)
+ return 0;
+
+ qint64 l = audioSource->write(audioBuffer,err);
+ if(l < 0) {
+ close();
+ errorState = QAudio::IOError;
+ deviceState = QAudio::StopState;
+ emit stateChanged(deviceState);
+ } else if(l == 0) {
+ errorState = QAudio::NoError;
+ deviceState = QAudio::IdleState;
+ } else {
+ totalTimeValue += snd_pcm_bytes_to_frames(handle, err)*1000000/settings.frequency();
+ resuming = false;
+ errorState = QAudio::NoError;
+ deviceState = QAudio::ActiveState;
+ }
+ return l;
+ }
+ return 0;
+}
+
+void QAudioInputPrivate::resume()
+{
+ if(deviceState == QAudio::SuspendState) {
+ int err = 0;
+
+ if(handle) {
+ err = snd_pcm_prepare( handle );
+ if(err < 0)
+ xrun_recovery(err);
+
+ err = snd_pcm_start(handle);
+ if(err < 0)
+ xrun_recovery(err);
+
+ bytesAvailable = buffer_size;
+ }
+ resuming = true;
+ deviceState = QAudio::ActiveState;
+ int chunks = buffer_size/period_size;
+ timer->start(buffer_time*chunks/2000);
+ emit stateChanged(deviceState);
+ }
+}
+
+void QAudioInputPrivate::setBufferSize(int value)
+{
+ buffer_size = value;
+}
+
+int QAudioInputPrivate::bufferSize() const
+{
+ return buffer_size;
+}
+
+int QAudioInputPrivate::periodSize() const
+{
+ return period_size;
+}
+
+void QAudioInputPrivate::setNotifyInterval(int ms)
+{
+ intervalTime = ms;
+}
+
+int QAudioInputPrivate::notifyInterval() const
+{
+ return intervalTime;
+}
+
+qint64 QAudioInputPrivate::totalTime() const
+{
+ return totalTimeValue;
+}
+
+void QAudioInputPrivate::suspend()
+{
+ if(deviceState == QAudio::ActiveState||resuming) {
+ timer->stop();
+ deviceState = QAudio::SuspendState;
+ emit stateChanged(deviceState);
+ }
+}
+
+void QAudioInputPrivate::userFeed()
+{
+ if(deviceState == QAudio::StopState || deviceState == QAudio::SuspendState)
+ return;
+#ifdef DEBUG_AUDIO
+ QTime now(QTime::currentTime());
+ qDebug()<<now.second()<<"s "<<now.msec()<<"ms :userFeed() IN";
+#endif
+ deviceReady();
+}
+
+bool QAudioInputPrivate::deviceReady()
+{
+ if(pullMode) {
+ // reads some audio data and writes it to QIODevice
+ read(0,0);
+ } else {
+ // emits readyRead() so user will call read() on QIODevice to get some audio data
+ InputPrivate* a = qobject_cast<InputPrivate*>(audioSource);
+ a->trigger();
+ }
+ bytesAvailable = bytesReady();
+
+ if(deviceState != QAudio::ActiveState)
+ return true;
+
+ if(timeStamp.elapsed() > intervalTime && intervalTime > 50) {
+ emit notify();
+ timeStamp.restart();
+ }
+ return true;
+}
+
+qint64 QAudioInputPrivate::clock() const
+{
+ if(!handle)
+ return 0;
+
+ if(deviceState != QAudio::ActiveState)
+ return 0;
+
+ snd_pcm_status_t* status;
+ snd_pcm_status_alloca(&status);
+
+ snd_timestamp_t t1,t2;
+ if( snd_pcm_status(handle, status) >= 0) {
+ snd_pcm_status_get_tstamp(status,&t1);
+ snd_pcm_status_get_trigger_tstamp(status,&t2);
+ t1.tv_sec-=t2.tv_sec;
+
+ signed long l = (signed long)t1.tv_usec - (signed long)t2.tv_usec;
+ if(l < 0) {
+ t1.tv_sec--;
+ l = -l;
+ l %= 1000000;
+ }
+ return ((t1.tv_sec * 1000)+l/1000);
+ } else
+ return 0;
+}
+
+void QAudioInputPrivate::reset()
+{
+ if(handle)
+ snd_pcm_reset(handle);
+}
+
+void QAudioInputPrivate::drain()
+{
+ if(handle)
+ snd_pcm_drain(handle);
+}
+
+InputPrivate::InputPrivate(QAudioInputPrivate* audio)
+{
+ audioDevice = qobject_cast<QAudioInputPrivate*>(audio);
+}
+
+InputPrivate::~InputPrivate()
+{
+}
+
+qint64 InputPrivate::readData( char* data, qint64 len)
+{
+ // push mode, user read() called
+ if((audioDevice->state() != QAudio::ActiveState) && !audioDevice->resuming)
+ return 0;
+
+ int readFrames;
+ int count=0, err = 0;
+
+ while(count < 5) {
+ int frames = snd_pcm_bytes_to_frames(audioDevice->handle, len);
+ readFrames = snd_pcm_readi(audioDevice->handle, data, frames);
+ if (readFrames >= 0) {
+ err = snd_pcm_frames_to_bytes(audioDevice->handle, readFrames);
+#ifdef DEBUG_AUDIO
+ qDebug()<<QString(tr("PUSH: read in bytes = %1 (frames=%2)")).arg(err).arg(readFrames).toLatin1().constData();
+#endif
+ break;
+ } else if((readFrames == -EAGAIN) || (readFrames == -EINTR)) {
+ audioDevice->errorState = QAudio::IOError;
+ err = 0;
+ break;
+ } else {
+ if(readFrames == -EPIPE) {
+ audioDevice->errorState = QAudio::UnderrunError;
+ err = snd_pcm_prepare(audioDevice->handle);
+ } else if(readFrames == -ESTRPIPE) {
+ err = snd_pcm_prepare(audioDevice->handle);
+ }
+ if(err != 0) break;
+ }
+ count++;
+ }
+ if(err > 0 && readFrames > 0) {
+ audioDevice->totalTimeValue += readFrames*1000/audioDevice->settings.frequency()*1000;
+ audioDevice->deviceState = QAudio::ActiveState;
+ return err;
+ }
+ return 0;
+}
+
+qint64 InputPrivate::writeData(const char* data, qint64 len)
+{
+ Q_UNUSED(data)
+ Q_UNUSED(len)
+ return 0;
+}
+
+void InputPrivate::trigger()
+{
+ emit readyRead();
+}
+
diff --git a/src/multimedia/audio/qaudioinput_alsa_p.h b/src/multimedia/audio/qaudioinput_alsa_p.h
new file mode 100644
index 000000000..21c8064b0
--- /dev/null
+++ b/src/multimedia/audio/qaudioinput_alsa_p.h
@@ -0,0 +1,151 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+
+#ifndef QAUDIOINPUTALSA_H
+#define QAUDIOINPUTALSA_H
+
+#include <alsa/asoundlib.h>
+
+#include <QtCore/qfile.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qtimer.h>
+#include <QtCore/qstring.h>
+#include <QtCore/qstringlist.h>
+#include <QtCore/qdatetime.h>
+
+#include <QtMultimedia/qaudio.h>
+#include <QtMultimedia/qaudiodeviceinfo.h>
+#include <QtMultimedia/qaudioengine.h>
+
+class InputPrivate;
+
+class QAudioInputPrivate : public QAbstractAudioInput
+{
+ Q_OBJECT
+public:
+ QAudioInputPrivate(const QByteArray &device, const QAudioFormat& audioFormat);
+ ~QAudioInputPrivate();
+
+ qint64 read(char* data, qint64 len);
+
+ 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 totalTime() const;
+ qint64 clock() const;
+ QAudio::Error error() const;
+ QAudio::State state() const;
+ QAudioFormat format() const;
+ bool resuming;
+ snd_pcm_t* handle;
+ qint64 totalTimeValue;
+ QIODevice* audioSource;
+ QAudioFormat settings;
+ QAudio::Error errorState;
+ QAudio::State deviceState;
+
+private slots:
+ void userFeed();
+ bool deviceReady();
+
+private:
+ int xrun_recovery(int err);
+ int setFormat();
+ bool open();
+ void close();
+ void drain();
+
+ QTimer* timer;
+ QTime timeStamp;
+ int intervalTime;
+ char* audioBuffer;
+ int bytesAvailable;
+ QByteArray m_device;
+ bool pullMode;
+ int buffer_size;
+ int period_size;
+ unsigned int buffer_time;
+ unsigned int period_time;
+ snd_pcm_uframes_t buffer_frames;
+ snd_pcm_uframes_t period_frames;
+ snd_async_handler_t* ahandler;
+ snd_pcm_access_t access;
+ snd_pcm_format_t pcmformat;
+ snd_timestamp_t* timestamp;
+ snd_pcm_hw_params_t *hwparams;
+};
+
+class InputPrivate : public QIODevice
+{
+ Q_OBJECT
+public:
+ InputPrivate(QAudioInputPrivate* audio);
+ ~InputPrivate();
+
+ qint64 readData( char* data, qint64 len);
+ qint64 writeData(const char* data, qint64 len);
+
+ void trigger();
+private:
+ QAudioInputPrivate *audioDevice;
+};
+
+#endif
diff --git a/src/multimedia/audio/qaudioinput_mac_p.cpp b/src/multimedia/audio/qaudioinput_mac_p.cpp
new file mode 100644
index 000000000..5400c850f
--- /dev/null
+++ b/src/multimedia/audio/qaudioinput_mac_p.cpp
@@ -0,0 +1,930 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qendian.h>
+#include <QtCore/qtimer.h>
+#include <QtCore/qdebug.h>
+
+#include <QtMultimedia/qaudiodeviceinfo.h>
+#include <QtMultimedia/qaudioinput.h>
+
+#include "qaudio_mac_p.h"
+#include "qaudioinput_mac_p.h"
+
+
+QT_BEGIN_NAMESPACE
+
+
+namespace
+{
+
+static const int default_buffer_size = 4 * 1024;
+
+class QAudioBufferList
+{
+public:
+ QAudioBufferList(AudioStreamBasicDescription const& streamFormat):
+ owner(false),
+ sf(streamFormat)
+ {
+ const bool isInterleaved = (sf.mFormatFlags & kAudioFormatFlagIsNonInterleaved) == 0;
+ const int numberOfBuffers = isInterleaved ? 1 : sf.mChannelsPerFrame;
+
+ dataSize = 0;
+
+ bfs = reinterpret_cast<AudioBufferList*>(qMalloc(sizeof(AudioBufferList) +
+ (sizeof(AudioBuffer) * numberOfBuffers)));
+
+ bfs->mNumberBuffers = numberOfBuffers;
+ for (int i = 0; i < numberOfBuffers; ++i) {
+ bfs->mBuffers[i].mNumberChannels = isInterleaved ? numberOfBuffers : 1;
+ bfs->mBuffers[i].mDataByteSize = 0;
+ bfs->mBuffers[i].mData = 0;
+ }
+ }
+
+ QAudioBufferList(AudioStreamBasicDescription const& streamFormat, char* buffer, int bufferSize):
+ owner(false),
+ sf(streamFormat),
+ bfs(0)
+ {
+ dataSize = bufferSize;
+
+ bfs = reinterpret_cast<AudioBufferList*>(qMalloc(sizeof(AudioBufferList) + sizeof(AudioBuffer)));
+
+ bfs->mNumberBuffers = 1;
+ bfs->mBuffers[0].mNumberChannels = 1;
+ bfs->mBuffers[0].mDataByteSize = dataSize;
+ bfs->mBuffers[0].mData = buffer;
+ }
+
+ QAudioBufferList(AudioStreamBasicDescription const& streamFormat, int framesToBuffer):
+ owner(true),
+ sf(streamFormat),
+ bfs(0)
+ {
+ const bool isInterleaved = (sf.mFormatFlags & kAudioFormatFlagIsNonInterleaved) == 0;
+ const int numberOfBuffers = isInterleaved ? 1 : sf.mChannelsPerFrame;
+
+ dataSize = framesToBuffer * sf.mBytesPerFrame;
+
+ bfs = reinterpret_cast<AudioBufferList*>(qMalloc(sizeof(AudioBufferList) +
+ (sizeof(AudioBuffer) * numberOfBuffers)));
+ bfs->mNumberBuffers = numberOfBuffers;
+ for (int i = 0; i < numberOfBuffers; ++i) {
+ bfs->mBuffers[i].mNumberChannels = isInterleaved ? numberOfBuffers : 1;
+ bfs->mBuffers[i].mDataByteSize = dataSize;
+ bfs->mBuffers[i].mData = qMalloc(dataSize);
+ }
+ }
+
+ ~QAudioBufferList()
+ {
+ if (owner) {
+ for (UInt32 i = 0; i < bfs->mNumberBuffers; ++i)
+ qFree(bfs->mBuffers[i].mData);
+ }
+
+ qFree(bfs);
+ }
+
+ AudioBufferList* audioBufferList() const
+ {
+ return bfs;
+ }
+
+ char* data(int buffer = 0) const
+ {
+ return static_cast<char*>(bfs->mBuffers[buffer].mData);
+ }
+
+ qint64 bufferSize(int buffer = 0) const
+ {
+ return bfs->mBuffers[buffer].mDataByteSize;
+ }
+
+ int frameCount(int buffer = 0) const
+ {
+ return bfs->mBuffers[buffer].mDataByteSize / sf.mBytesPerFrame;
+ }
+
+ int packetCount(int buffer = 0) const
+ {
+ return bfs->mBuffers[buffer].mDataByteSize / sf.mBytesPerPacket;
+ }
+
+ int packetSize() const
+ {
+ return sf.mBytesPerPacket;
+ }
+
+ void reset()
+ {
+ for (UInt32 i = 0; i < bfs->mNumberBuffers; ++i)
+ bfs->mBuffers[i].mDataByteSize = dataSize;
+ }
+
+private:
+ bool owner;
+ int dataSize;
+ AudioStreamBasicDescription sf;
+ AudioBufferList* bfs;
+};
+
+class QAudioPacketFeeder
+{
+public:
+ QAudioPacketFeeder(QAudioBufferList* abl):
+ audioBufferList(abl)
+ {
+ totalPackets = audioBufferList->packetCount();
+ position = 0;
+ }
+
+ bool feed(AudioBufferList& dst, UInt32& packetCount)
+ {
+ if (position == totalPackets) {
+ dst.mBuffers[0].mDataByteSize = 0;
+ packetCount = 0;
+ return false;
+ }
+
+ if (totalPackets - position < packetCount)
+ packetCount = totalPackets - position;
+
+ dst.mBuffers[0].mDataByteSize = packetCount * audioBufferList->packetSize();
+ dst.mBuffers[0].mData = audioBufferList->data() + (position * audioBufferList->packetSize());
+
+ position += packetCount;
+
+ return true;
+ }
+
+private:
+ UInt32 totalPackets;
+ UInt32 position;
+ QAudioBufferList* audioBufferList;
+};
+
+class QAudioInputBuffer : public QObject
+{
+ Q_OBJECT
+
+public:
+ QAudioInputBuffer(int bufferSize,
+ int maxPeriodSize,
+ AudioStreamBasicDescription const& inputFormat,
+ AudioStreamBasicDescription const& outputFormat,
+ QObject* parent):
+ QObject(parent),
+ m_deviceError(false),
+ m_inputFormat(inputFormat),
+ m_outputFormat(outputFormat)
+ {
+ m_maxPeriodSize = maxPeriodSize;
+ m_periodTime = m_maxPeriodSize / m_outputFormat.mBytesPerFrame * 1000 / m_outputFormat.mSampleRate;
+ m_buffer = new QAudioRingBuffer(bufferSize + (bufferSize % maxPeriodSize == 0 ? 0 : maxPeriodSize - (bufferSize % maxPeriodSize)));
+ m_inputBufferList = new QAudioBufferList(m_inputFormat);
+
+ m_flushTimer = new QTimer(this);
+ connect(m_flushTimer, SIGNAL(timeout()), SLOT(flushBuffer()));
+
+ if (inputFormat.mSampleRate != outputFormat.mSampleRate) {
+ if (AudioConverterNew(&m_inputFormat, &m_outputFormat, &m_audioConverter) != noErr) {
+ qWarning() << "QAudioInput: Unable to create an Audio Converter";
+ m_audioConverter = 0;
+ }
+ }
+ }
+
+ ~QAudioInputBuffer()
+ {
+ delete m_buffer;
+ }
+
+ qint64 renderFromDevice(AudioUnit audioUnit,
+ AudioUnitRenderActionFlags* ioActionFlags,
+ const AudioTimeStamp* inTimeStamp,
+ UInt32 inBusNumber,
+ UInt32 inNumberFrames)
+ {
+ const bool wasEmpty = m_buffer->used() == 0;
+
+ OSStatus err;
+ qint64 framesRendered = 0;
+
+ m_inputBufferList->reset();
+ err = AudioUnitRender(audioUnit,
+ ioActionFlags,
+ inTimeStamp,
+ inBusNumber,
+ inNumberFrames,
+ m_inputBufferList->audioBufferList());
+
+ if (m_audioConverter != 0) {
+ QAudioPacketFeeder feeder(m_inputBufferList);
+
+ bool wecan = true;
+ int copied = 0;
+
+ const int available = m_buffer->free();
+
+ while (err == noErr && wecan) {
+ QAudioRingBuffer::Region region = m_buffer->acquireWriteRegion(available);
+
+ if (region.second > 0) {
+ AudioBufferList output;
+ output.mNumberBuffers = 1;
+ output.mBuffers[0].mNumberChannels = 1;
+ output.mBuffers[0].mDataByteSize = region.second;
+ output.mBuffers[0].mData = region.first;
+
+ UInt32 packetSize = region.second / m_outputFormat.mBytesPerPacket;
+ err = AudioConverterFillComplexBuffer(m_audioConverter,
+ converterCallback,
+ &feeder,
+ &packetSize,
+ &output,
+ 0);
+
+ region.second = output.mBuffers[0].mDataByteSize;
+ copied += region.second;
+
+ m_buffer->releaseWriteRegion(region);
+ }
+ else
+ wecan = false;
+ }
+
+ framesRendered += copied / m_outputFormat.mBytesPerFrame;
+ }
+ else {
+ const int available = m_inputBufferList->bufferSize();
+ bool wecan = true;
+ int copied = 0;
+
+ while (wecan && copied < available) {
+ QAudioRingBuffer::Region region = m_buffer->acquireWriteRegion(available - copied);
+
+ if (region.second > 0) {
+ memcpy(region.first, m_inputBufferList->data() + copied, region.second);
+ copied += region.second;
+ }
+ else
+ wecan = false;
+
+ m_buffer->releaseWriteRegion(region);
+ }
+
+ framesRendered = copied / m_outputFormat.mBytesPerFrame;
+ }
+
+ if (wasEmpty && framesRendered > 0)
+ emit readyRead();
+
+ return framesRendered;
+ }
+
+ qint64 readBytes(char* data, qint64 len)
+ {
+ bool wecan = true;
+ qint64 bytesCopied = 0;
+
+ len -= len % m_maxPeriodSize;
+ while (wecan && bytesCopied < len) {
+ QAudioRingBuffer::Region region = m_buffer->acquireReadRegion(len - bytesCopied);
+
+ if (region.second > 0) {
+ memcpy(data + bytesCopied, region.first, region.second);
+ bytesCopied += region.second;
+ }
+ else
+ wecan = false;
+
+ m_buffer->releaseReadRegion(region);
+ }
+
+ return bytesCopied;
+ }
+
+ void setFlushDevice(QIODevice* device)
+ {
+ if (m_device != device)
+ m_device = device;
+ }
+
+ void startFlushTimer()
+ {
+ if (m_device != 0) {
+ m_flushTimer->start((m_buffer->size() - (m_maxPeriodSize * 2)) / m_maxPeriodSize * m_periodTime);
+ }
+ }
+
+ void stopFlushTimer()
+ {
+ m_flushTimer->stop();
+ }
+
+ void flush(bool all = false)
+ {
+ const int used = m_buffer->used();
+ const int readSize = all ? used : used - (used % m_maxPeriodSize);
+
+ if (readSize > 0) {
+ bool wecan = true;
+ int flushed = 0;
+
+ while (!m_deviceError && wecan && flushed < readSize) {
+ QAudioRingBuffer::Region region = m_buffer->acquireReadRegion(readSize - flushed);
+
+ if (region.second > 0) {
+ int bytesWritten = m_device->write(region.first, region.second);
+ if (bytesWritten < 0) {
+ stopFlushTimer();
+ m_deviceError = true;
+ }
+ else {
+ region.second = bytesWritten;
+ flushed += bytesWritten;
+ wecan = bytesWritten != 0;
+ }
+ }
+ else
+ wecan = false;
+
+ m_buffer->releaseReadRegion(region);
+ }
+ }
+ }
+
+ void reset()
+ {
+ m_buffer->reset();
+ m_deviceError = false;
+ }
+
+ int available() const
+ {
+ return m_buffer->free();
+ }
+
+ int used() const
+ {
+ return m_buffer->used();
+ }
+
+signals:
+ void readyRead();
+
+private slots:
+ void flushBuffer()
+ {
+ flush();
+ }
+
+private:
+ bool m_deviceError;
+ int m_maxPeriodSize;
+ int m_periodTime;
+ QIODevice* m_device;
+ QTimer* m_flushTimer;
+ QAudioRingBuffer* m_buffer;
+ QAudioBufferList* m_inputBufferList;
+ AudioConverterRef m_audioConverter;
+ AudioStreamBasicDescription m_inputFormat;
+ AudioStreamBasicDescription m_outputFormat;
+
+ const static OSStatus as_empty = 'qtem';
+
+ // Converter callback
+ static OSStatus converterCallback(AudioConverterRef inAudioConverter,
+ UInt32* ioNumberDataPackets,
+ AudioBufferList* ioData,
+ AudioStreamPacketDescription** outDataPacketDescription,
+ void* inUserData)
+ {
+ Q_UNUSED(inAudioConverter);
+ Q_UNUSED(outDataPacketDescription);
+
+ QAudioPacketFeeder* feeder = static_cast<QAudioPacketFeeder*>(inUserData);
+
+ if (!feeder->feed(*ioData, *ioNumberDataPackets))
+ return as_empty;
+
+ return noErr;
+ }
+};
+
+
+class MacInputDevice : public QIODevice
+{
+ Q_OBJECT
+
+public:
+ MacInputDevice(QAudioInputBuffer* audioBuffer, QObject* parent):
+ QIODevice(parent),
+ m_audioBuffer(audioBuffer)
+ {
+ open(QIODevice::ReadOnly | QIODevice::Unbuffered);
+ connect(m_audioBuffer, SIGNAL(readyRead()), SIGNAL(readyRead()));
+ }
+
+ qint64 readData(char* data, qint64 len)
+ {
+ return m_audioBuffer->readBytes(data, len);
+ }
+
+ qint64 writeData(const char* data, qint64 len)
+ {
+ Q_UNUSED(data);
+ Q_UNUSED(len);
+
+ return 0;
+ }
+
+ bool isSequential() const
+ {
+ return true;
+ }
+
+private:
+ QAudioInputBuffer* m_audioBuffer;
+};
+
+}
+
+
+QAudioInputPrivate::QAudioInputPrivate(const QByteArray& device, QAudioFormat const& format):
+ audioFormat(format)
+{
+ QDataStream ds(device);
+ quint32 did, mode;
+
+ ds >> did >> mode;
+
+ if (QAudio::Mode(mode) == QAudio::AudioOutput)
+ errorCode = QAudio::OpenError;
+ else {
+ isOpen = false;
+ audioDeviceId = AudioDeviceID(did);
+ audioUnit = 0;
+ startTime = 0;
+ totalFrames = 0;
+ audioBuffer = 0;
+ internalBufferSize = default_buffer_size;
+ clockFrequency = AudioGetHostClockFrequency() / 1000;
+ errorCode = QAudio::NoError;
+ stateCode = QAudio::StopState;
+
+ intervalTimer = new QTimer(this);
+ intervalTimer->setInterval(1000);
+ connect(intervalTimer, SIGNAL(timeout()), SIGNAL(notify()));
+ }
+}
+
+QAudioInputPrivate::~QAudioInputPrivate()
+{
+ close();
+}
+
+bool QAudioInputPrivate::open()
+{
+ UInt32 size = 0;
+
+ if (isOpen)
+ return true;
+
+ ComponentDescription cd;
+ cd.componentType = kAudioUnitType_Output;
+ cd.componentSubType = kAudioUnitSubType_HALOutput;
+ cd.componentManufacturer = kAudioUnitManufacturer_Apple;
+ cd.componentFlags = 0;
+ cd.componentFlagsMask = 0;
+
+ // Open
+ Component cp = FindNextComponent(NULL, &cd);
+ if (cp == 0) {
+ qWarning() << "QAudioInput: Failed to find HAL Output component";
+ return false;
+ }
+
+ if (OpenAComponent(cp, &audioUnit) != noErr) {
+ qWarning() << "QAudioInput: Unable to Open Output Component";
+ return false;
+ }
+
+ // Set mode
+ // switch to input mode
+ UInt32 enable = 1;
+ if (AudioUnitSetProperty(audioUnit,
+ kAudioOutputUnitProperty_EnableIO,
+ kAudioUnitScope_Input,
+ 1,
+ &enable,
+ sizeof(enable)) != noErr) {
+ qWarning() << "QAudioInput: Unabled to switch to input mode (Enable Input)";
+ return false;
+ }
+
+ enable = 0;
+ if (AudioUnitSetProperty(audioUnit,
+ kAudioOutputUnitProperty_EnableIO,
+ kAudioUnitScope_Output,
+ 0,
+ &enable,
+ sizeof(enable)) != noErr) {
+ qWarning() << "QAudioInput: Unabled to switch to input mode (Disable output)";
+ return false;
+ }
+
+ // register callback
+ AURenderCallbackStruct cb;
+ cb.inputProc = inputCallback;
+ cb.inputProcRefCon = this;
+
+ if (AudioUnitSetProperty(audioUnit,
+ kAudioOutputUnitProperty_SetInputCallback,
+ kAudioUnitScope_Global,
+ 0,
+ &cb,
+ sizeof(cb)) != noErr) {
+ qWarning() << "QAudioInput: Failed to set AudioUnit callback";
+ return false;
+ }
+
+ // Set Audio Device
+ if (AudioUnitSetProperty(audioUnit,
+ kAudioOutputUnitProperty_CurrentDevice,
+ kAudioUnitScope_Global,
+ 0,
+ &audioDeviceId,
+ sizeof(audioDeviceId)) != noErr) {
+ qWarning() << "QAudioInput: Unable to use configured device";
+ return false;
+ }
+
+ // Set format
+ streamFormat = toAudioStreamBasicDescription(audioFormat);
+
+ size = sizeof(deviceFormat);
+ if (AudioUnitGetProperty(audioUnit,
+ kAudioUnitProperty_StreamFormat,
+ kAudioUnitScope_Input,
+ 1,
+ &deviceFormat,
+ &size) != noErr) {
+ qWarning() << "QAudioInput: Unable to retrieve device format";
+ return false;
+ }
+
+ // If the device frequency is different to the requested use a converter
+ if (deviceFormat.mSampleRate != streamFormat.mSampleRate) {
+ AudioUnitSetProperty(audioUnit,
+ kAudioUnitProperty_StreamFormat,
+ kAudioUnitScope_Output,
+ 1,
+ &deviceFormat,
+ sizeof(streamFormat));
+ }
+ else {
+ AudioUnitSetProperty(audioUnit,
+ kAudioUnitProperty_StreamFormat,
+ kAudioUnitScope_Output,
+ 1,
+ &streamFormat,
+ sizeof(streamFormat));
+ }
+
+ // Setup buffers
+ UInt32 numberOfFrames;
+ size = sizeof(UInt32);
+ if (AudioUnitGetProperty(audioUnit,
+ kAudioDevicePropertyBufferFrameSize,
+ kAudioUnitScope_Global,
+ 0,
+ &numberOfFrames,
+ &size) != noErr) {
+ qWarning() << "QAudioInput: Failed to get audio period size";
+ return false;
+ }
+
+ // Allocate buffer
+ periodSizeBytes = (numberOfFrames * streamFormat.mSampleRate / deviceFormat.mSampleRate) *
+ streamFormat.mBytesPerFrame;
+ if (internalBufferSize < periodSizeBytes * 2)
+ internalBufferSize = periodSizeBytes * 2;
+ else
+ internalBufferSize -= internalBufferSize % streamFormat.mBytesPerFrame;
+
+ audioBuffer = new QAudioInputBuffer(internalBufferSize,
+ periodSizeBytes,
+ deviceFormat,
+ streamFormat,
+ this);
+
+ audioIO = new MacInputDevice(audioBuffer, this);
+
+ // Init
+ if (AudioUnitInitialize(audioUnit) != noErr) {
+ qWarning() << "QAudioInput: Failed to initialize AudioUnit";
+ return false;
+ }
+
+ isOpen = true;
+
+ return isOpen;
+}
+
+void QAudioInputPrivate::close()
+{
+ if (audioUnit != 0) {
+ AudioOutputUnitStop(audioUnit);
+ AudioUnitUninitialize(audioUnit);
+ CloseComponent(audioUnit);
+ }
+
+ delete audioBuffer;
+}
+
+QAudioFormat QAudioInputPrivate::format() const
+{
+ return audioFormat;
+}
+
+QIODevice* QAudioInputPrivate::start(QIODevice* device)
+{
+ QIODevice* op = device;
+
+ if (!open()) {
+ stateCode = QAudio::StopState;
+ errorCode = QAudio::OpenError;
+ return audioIO;
+ }
+
+ reset();
+ audioBuffer->reset();
+ audioBuffer->setFlushDevice(op);
+
+ if (op == 0)
+ op = audioIO;
+
+ // Start
+ startTime = AudioGetCurrentHostTime();
+ totalFrames = 0;
+
+ audioThreadStart();
+
+ return op;
+}
+
+void QAudioInputPrivate::stop()
+{
+ QMutexLocker lock(&mutex);
+ if (stateCode != QAudio::StopState) {
+ audioThreadStop();
+ audioBuffer->flush(true);
+
+ errorCode = QAudio::NoError;
+ stateCode = QAudio::StopState;
+ QMetaObject::invokeMethod(this, "stateChanged", Qt::QueuedConnection, Q_ARG(QAudio::State, stateCode));
+ }
+}
+
+void QAudioInputPrivate::reset()
+{
+ QMutexLocker lock(&mutex);
+ if (stateCode != QAudio::StopState) {
+ audioThreadStop();
+
+ errorCode = QAudio::NoError;
+ stateCode = QAudio::StopState;
+ QMetaObject::invokeMethod(this, "stateChanged", Qt::QueuedConnection, Q_ARG(QAudio::State, stateCode));
+ }
+}
+
+void QAudioInputPrivate::suspend()
+{
+ QMutexLocker lock(&mutex);
+ if (stateCode == QAudio::ActiveState || stateCode == QAudio::IdleState) {
+ audioThreadStop();
+
+ errorCode = QAudio::NoError;
+ stateCode = QAudio::SuspendState;
+ QMetaObject::invokeMethod(this, "stateChanged", Qt::QueuedConnection, Q_ARG(QAudio::State, stateCode));
+ }
+}
+
+void QAudioInputPrivate::resume()
+{
+ QMutexLocker lock(&mutex);
+ if (stateCode == QAudio::SuspendState) {
+ audioThreadStart();
+
+ errorCode = QAudio::NoError;
+ stateCode = QAudio::ActiveState;
+ QMetaObject::invokeMethod(this, "stateChanged", Qt::QueuedConnection, Q_ARG(QAudio::State, stateCode));
+ }
+}
+
+int QAudioInputPrivate::bytesReady() const
+{
+ return audioBuffer->used();
+}
+
+int QAudioInputPrivate::periodSize() const
+{
+ return periodSizeBytes;
+}
+
+void QAudioInputPrivate::setBufferSize(int bs)
+{
+ internalBufferSize = bs;
+}
+
+int QAudioInputPrivate::bufferSize() const
+{
+ return internalBufferSize;
+}
+
+void QAudioInputPrivate::setNotifyInterval(int milliSeconds)
+{
+ intervalTimer->setInterval(milliSeconds);
+}
+
+int QAudioInputPrivate::notifyInterval() const
+{
+ return intervalTimer->interval();
+}
+
+qint64 QAudioInputPrivate::totalTime() const
+{
+ return totalFrames * 1000000 / audioFormat.frequency();
+}
+
+qint64 QAudioInputPrivate::clock() const
+{
+ return (AudioGetCurrentHostTime() - startTime) / (clockFrequency / 1000);
+}
+
+QAudio::Error QAudioInputPrivate::error() const
+{
+ return errorCode;
+}
+
+QAudio::State QAudioInputPrivate::state() const
+{
+ return stateCode;
+}
+
+void QAudioInputPrivate::audioThreadStop()
+{
+ stopTimers();
+ if (audioThreadState.testAndSetAcquire(Running, Stopped))
+ threadFinished.wait(&mutex);
+}
+
+void QAudioInputPrivate::audioThreadStart()
+{
+ startTimers();
+ audioThreadState = Running;
+ AudioOutputUnitStart(audioUnit);
+}
+
+void QAudioInputPrivate::audioDeviceStop()
+{
+ AudioOutputUnitStop(audioUnit);
+ audioThreadState = Stopped;
+ threadFinished.wakeOne();
+}
+
+void QAudioInputPrivate::audioDeviceFull()
+{
+ QMutexLocker lock(&mutex);
+ if (stateCode == QAudio::ActiveState) {
+ audioDeviceStop();
+
+ errorCode = QAudio::UnderrunError;
+ stateCode = QAudio::IdleState;
+ QMetaObject::invokeMethod(this, "deviceStopped", Qt::QueuedConnection);
+ }
+}
+
+void QAudioInputPrivate::audioDeviceError()
+{
+ QMutexLocker lock(&mutex);
+ if (stateCode == QAudio::ActiveState) {
+ audioDeviceStop();
+
+ errorCode = QAudio::IOError;
+ stateCode = QAudio::StopState;
+ QMetaObject::invokeMethod(this, "deviceStopped", Qt::QueuedConnection);
+ }
+}
+
+void QAudioInputPrivate::startTimers()
+{
+ audioBuffer->startFlushTimer();
+ intervalTimer->start();
+}
+
+void QAudioInputPrivate::stopTimers()
+{
+ audioBuffer->stopFlushTimer();
+ intervalTimer->stop();
+}
+
+void QAudioInputPrivate::deviceStopped()
+{
+ stopTimers();
+ emit stateChanged(stateCode);
+}
+
+// Input callback
+OSStatus QAudioInputPrivate::inputCallback(void* inRefCon,
+ AudioUnitRenderActionFlags* ioActionFlags,
+ const AudioTimeStamp* inTimeStamp,
+ UInt32 inBusNumber,
+ UInt32 inNumberFrames,
+ AudioBufferList* ioData)
+{
+ Q_UNUSED(ioData);
+
+ QAudioInputPrivate* d = static_cast<QAudioInputPrivate*>(inRefCon);
+
+ const int threadState = d->audioThreadState.fetchAndAddAcquire(0);
+ if (threadState == Stopped)
+ d->audioDeviceStop();
+ else {
+ qint64 framesWritten;
+
+ framesWritten = d->audioBuffer->renderFromDevice(d->audioUnit,
+ ioActionFlags,
+ inTimeStamp,
+ inBusNumber,
+ inNumberFrames);
+
+ if (framesWritten > 0)
+ d->totalFrames += framesWritten;
+ else if (framesWritten == 0)
+ d->audioDeviceFull();
+ else if (framesWritten < 0)
+ d->audioDeviceError();
+ }
+
+ return noErr;
+}
+
+
+QT_END_NAMESPACE
+
+#include "qaudioinput_mac_p.moc"
+
diff --git a/src/multimedia/audio/qaudioinput_mac_p.h b/src/multimedia/audio/qaudioinput_mac_p.h
new file mode 100644
index 000000000..98ef9ce2f
--- /dev/null
+++ b/src/multimedia/audio/qaudioinput_mac_p.h
@@ -0,0 +1,171 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+
+#ifndef QAUDIOINPUT_MAC_P_H
+#define QAUDIOINPUT_MAC_P_H
+
+#include <CoreServices/CoreServices.h>
+#include <CoreAudio/CoreAudio.h>
+#include <AudioUnit/AudioUnit.h>
+#include <AudioToolbox/AudioToolbox.h>
+
+#include <QtCore/qobject.h>
+#include <QtCore/qmutex.h>
+#include <QtCore/qwaitcondition.h>
+#include <QtCore/qatomic.h>
+
+#include <QtMultimedia/qaudio.h>
+#include <QtMultimedia/qaudioformat.h>
+#include <QtMultimedia/qaudioengine.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+class QTimer;
+class QIODevice;
+
+namespace
+{
+class QAudioInputBuffer;
+}
+
+class QAudioInputPrivate : public QAbstractAudioInput
+{
+ Q_OBJECT
+
+public:
+ bool isOpen;
+ int periodSizeBytes;
+ int internalBufferSize;
+ qint64 totalFrames;
+ QAudioFormat audioFormat;
+ QIODevice* audioIO;
+ AudioUnit audioUnit;
+ AudioDeviceID audioDeviceId;
+ Float64 clockFrequency;
+ UInt64 startTime;
+ QAudio::Error errorCode;
+ QAudio::State stateCode;
+ QAudioInputBuffer* audioBuffer;
+ QMutex mutex;
+ QWaitCondition threadFinished;
+ QAtomicInt audioThreadState;
+ QTimer* intervalTimer;
+ AudioStreamBasicDescription streamFormat;
+ AudioStreamBasicDescription deviceFormat;
+
+ QAudioInputPrivate(const QByteArray& device, QAudioFormat const& format);
+ ~QAudioInputPrivate();
+
+ bool open();
+ void close();
+
+ QAudioFormat format() const;
+
+ QIODevice* start(QIODevice* device);
+ void stop();
+ void reset();
+ void suspend();
+ void resume();
+ void idle();
+
+ int bytesReady() const;
+ int periodSize() const;
+
+ void setBufferSize(int value);
+ int bufferSize() const;
+
+ void setNotifyInterval(int milliSeconds);
+ int notifyInterval() const;
+
+ qint64 totalTime() const;
+ qint64 clock() const;
+
+ QAudio::Error error() const;
+ QAudio::State state() const;
+
+ void audioThreadStart();
+ void audioThreadStop();
+
+ void audioDeviceStop();
+ void audioDeviceFull();
+ void audioDeviceError();
+
+ void startTimers();
+ void stopTimers();
+
+signals:
+ void stateChanged(QAudio::State);
+ void notify();
+
+private slots:
+ void deviceStopped();
+
+private:
+ enum { Running, Stopped };
+
+ // Input callback
+ static OSStatus inputCallback(void* inRefCon,
+ AudioUnitRenderActionFlags* ioActionFlags,
+ const AudioTimeStamp* inTimeStamp,
+ UInt32 inBusNumber,
+ UInt32 inNumberFrames,
+ AudioBufferList* ioData);
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QAUDIOINPUT_MAC_P_H
diff --git a/src/multimedia/audio/qaudioinput_win32_p.cpp b/src/multimedia/audio/qaudioinput_win32_p.cpp
new file mode 100644
index 000000000..3478e5104
--- /dev/null
+++ b/src/multimedia/audio/qaudioinput_win32_p.cpp
@@ -0,0 +1,541 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+
+#include "qaudioinput_win32_p.h"
+
+//#define DEBUG_AUDIO 1
+
+static CRITICAL_SECTION waveInCriticalSection;
+
+QAudioInputPrivate::QAudioInputPrivate(const QByteArray &device, const QAudioFormat& audioFormat):
+ settings(audioFormat)
+{
+ bytesAvailable = 0;
+ buffer_size = 0;
+ period_size = 0;
+ m_device = device;
+ totalTimeValue = 0;
+ intervalTime = 1000;
+ errorState = QAudio::NoError;
+ deviceState = QAudio::StopState;
+ audioSource = 0;
+ pullMode = true;
+ resuming = false;
+
+ connect(this,SIGNAL(processMore()),SLOT(deviceReady()));
+
+ InitializeCriticalSection(&waveInCriticalSection);
+}
+
+QAudioInputPrivate::~QAudioInputPrivate()
+{
+ close();
+ DeleteCriticalSection(&waveInCriticalSection);
+}
+
+void CALLBACK QAudioInputPrivate::waveInProc( HWAVEIN hWaveIn, UINT uMsg,
+ DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 )
+{
+ Q_UNUSED(dwParam1)
+ Q_UNUSED(dwParam2)
+ Q_UNUSED(hWaveIn)
+
+ QAudioInputPrivate* qAudio;
+ qAudio = (QAudioInputPrivate*)(dwInstance);
+ if(!qAudio)
+ return;
+
+ switch(uMsg) {
+ case WIM_OPEN:
+ break;
+ case WIM_DATA:
+ EnterCriticalSection(&waveInCriticalSection);
+ if(qAudio->waveFreeBlockCount > 0)
+ qAudio->waveFreeBlockCount--;
+ LeaveCriticalSection(&waveInCriticalSection);
+ qAudio->feedback();
+ break;
+ case WIM_CLOSE:
+ break;
+ default:
+ return;
+ }
+}
+
+WAVEHDR* QAudioInputPrivate::allocateBlocks(int size, int count)
+{
+ int i;
+ unsigned char* buffer;
+ WAVEHDR* blocks;
+ DWORD totalBufferSize = (size + sizeof(WAVEHDR))*count;
+
+ if((buffer=(unsigned char*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,
+ totalBufferSize)) == 0) {
+ qWarning("QAudioInput: Memory allocation error");
+ return 0;
+ }
+ blocks = (WAVEHDR*)buffer;
+ buffer += sizeof(WAVEHDR)*count;
+ for(i = 0; i < count; i++) {
+ blocks[i].dwBufferLength = size;
+ blocks[i].lpData = (LPSTR)buffer;
+ blocks[i].dwBytesRecorded=0;
+ blocks[i].dwUser = 0L;
+ blocks[i].dwFlags = 0L;
+ blocks[i].dwLoops = 0L;
+ result = waveInPrepareHeader(hWaveIn,&blocks[i], sizeof(WAVEHDR));
+ if(result != MMSYSERR_NOERROR) {
+ qWarning("QAudioInput: Can't prepare block %d",i);
+ return 0;
+ }
+ buffer += size;
+ }
+ return blocks;
+}
+
+void QAudioInputPrivate::freeBlocks(WAVEHDR* blockArray)
+{
+ HeapFree(GetProcessHeap(), 0, blockArray);
+}
+
+QAudio::Error QAudioInputPrivate::error() const
+{
+ return errorState;
+}
+
+QAudio::State QAudioInputPrivate::state() const
+{
+ return deviceState;
+}
+
+QAudioFormat QAudioInputPrivate::format() const
+{
+ return settings;
+}
+
+QIODevice* QAudioInputPrivate::start(QIODevice* device)
+{
+ if(deviceState != QAudio::StopState)
+ close();
+
+ if(!pullMode && audioSource) {
+ delete audioSource;
+ }
+
+ if(device) {
+ //set to pull mode
+ pullMode = true;
+ audioSource = device;
+ } else {
+ //set to push mode
+ pullMode = false;
+ audioSource = new InputPrivate(this);
+ audioSource->open(QIODevice::ReadOnly | QIODevice::Unbuffered);
+ }
+
+ if( !open() )
+ return 0;
+
+ emit stateChanged(deviceState);
+
+ return audioSource;
+}
+
+void QAudioInputPrivate::stop()
+{
+ if(deviceState == QAudio::StopState)
+ return;
+
+ deviceState = QAudio::StopState;
+
+ close();
+ emit stateChanged(deviceState);
+}
+
+bool QAudioInputPrivate::open()
+{
+#ifdef DEBUG_AUDIO
+ QTime now(QTime::currentTime());
+ qDebug()<<now.second()<<"s "<<now.msec()<<"ms :open()";
+#endif
+ header = 0;
+ if(buffer_size == 0) {
+ // Default buffer size, 100ms, default period size is 20ms
+ buffer_size = settings.frequency()*settings.channels()*(settings.sampleSize()/8)*0.1;
+ period_size = buffer_size/5;
+ } else {
+ period_size = buffer_size/5;
+ }
+ timeStamp.restart();
+ wfx.nSamplesPerSec = settings.frequency();
+ wfx.wBitsPerSample = settings.sampleSize();
+ wfx.nChannels = settings.channels();
+ wfx.cbSize = 0;
+
+ wfx.wFormatTag = WAVE_FORMAT_PCM;
+ wfx.nBlockAlign = (wfx.wBitsPerSample >> 3) * wfx.nChannels;
+ wfx.nAvgBytesPerSec = wfx.nBlockAlign * wfx.nSamplesPerSec;
+
+ UINT_PTR devId = WAVE_MAPPER;
+
+ WAVEINCAPS wic;
+ unsigned long iNumDevs,ii;
+ iNumDevs = waveInGetNumDevs();
+ for(ii=0;ii<iNumDevs;ii++) {
+ if(waveInGetDevCaps(ii, &wic, sizeof(WAVEINCAPS))
+ == MMSYSERR_NOERROR) {
+ QString tmp;
+ tmp = QString::fromUtf16((const unsigned short*)wic.szPname);
+ if(tmp.compare(tr(m_device)) == 0) {
+ devId = ii;
+ break;
+ }
+ }
+ }
+
+ if(waveInOpen(&hWaveIn, devId, &wfx,
+ (DWORD_PTR)&waveInProc,
+ (DWORD_PTR) this,
+ CALLBACK_FUNCTION) != MMSYSERR_NOERROR) {
+ errorState = QAudio::OpenError;
+ deviceState = QAudio::StopState;
+ emit stateChanged(deviceState);
+ qWarning("QAudioInput: failed to open audio device");
+ return false;
+ }
+ waveBlocks = allocateBlocks(period_size, buffer_size/period_size);
+ waveFreeBlockCount = buffer_size/period_size;
+ waveCurrentBlock = 0;
+
+ for(int i=0; i<buffer_size/period_size; i++) {
+ result = waveInAddBuffer(hWaveIn, &waveBlocks[i], sizeof(WAVEHDR));
+ if(result != MMSYSERR_NOERROR) {
+ qWarning("QAudioInput: failed to setup block %d,err=%d",i,result);
+ errorState = QAudio::OpenError;
+ deviceState = QAudio::StopState;
+ emit stateChanged(deviceState);
+ return false;
+ }
+ }
+ result = waveInStart(hWaveIn);
+ if(result) {
+ qWarning("QAudioInput: failed to start audio input");
+ errorState = QAudio::OpenError;
+ deviceState = QAudio::StopState;
+ emit stateChanged(deviceState);
+ return false;
+ }
+ timeStampOpened.restart();
+ totalTimeValue = 0;
+ errorState = QAudio::NoError;
+ deviceState = QAudio::ActiveState;
+ return true;
+}
+
+void QAudioInputPrivate::close()
+{
+ deviceState = QAudio::StopState;
+ int delay = (buffer_size-bytesReady())*1000/(settings.frequency()
+ *settings.channels()*(settings.sampleSize()/8));
+ waveInReset(hWaveIn);
+ Sleep(delay+10);
+
+ for(int i=0; i<waveFreeBlockCount; i++) {
+ if(waveBlocks[i].dwFlags & WHDR_PREPARED)
+ waveInUnprepareHeader(hWaveIn,&waveBlocks[i],sizeof(WAVEHDR));
+ }
+ freeBlocks(waveBlocks);
+ waveInClose(hWaveIn);
+}
+
+int QAudioInputPrivate::bytesReady() const
+{
+ int buf = ((buffer_size/period_size)-waveFreeBlockCount)*period_size;
+ if(buf < 0)
+ buf = 0;
+ return buf;
+}
+
+qint64 QAudioInputPrivate::read(char* data, qint64 len)
+{
+ bool done = false;
+
+ char* p = data;
+ qint64 l = 0;
+ qint64 written = 0;
+ while(!done) {
+ // Read in some audio data
+ if(waveBlocks[header].dwBytesRecorded > 0) {
+ if(pullMode) {
+ l = audioSource->write(waveBlocks[header].lpData,
+ waveBlocks[header].dwBytesRecorded);
+#ifdef DEBUG_AUDIO
+ qDebug()<<"IN: "<<waveBlocks[header].dwBytesRecorded<<", OUT: "<<l;
+#endif
+ if(l < 0) {
+ // error
+ qWarning("QAudioInput: IOError");
+ errorState = QAudio::IOError;
+
+ } else if(l == 0) {
+ // cant write to IODevice
+ qWarning("QAudioInput: IOError, can't write to QIODevice");
+ errorState = QAudio::IOError;
+
+ } else {
+ totalTimeValue += waveBlocks[header].dwBytesRecorded
+ /((settings.channels()*settings.sampleSize()/8))
+ *10000/settings.frequency()*100;
+ errorState = QAudio::NoError;
+ deviceState = QAudio::ActiveState;
+ resuming = false;
+ }
+ } else {
+ // push mode
+ memcpy(p,waveBlocks[header].lpData,waveBlocks[header].dwBytesRecorded);
+ l = waveBlocks[header].dwBytesRecorded;
+#ifdef DEBUG_AUDIO
+ qDebug()<<"IN: "<<waveBlocks[header].dwBytesRecorded<<", OUT: "<<l;
+#endif
+ totalTimeValue += waveBlocks[header].dwBytesRecorded
+ /((settings.channels()*settings.sampleSize()/8))
+ *10000/settings.frequency()*100;
+ errorState = QAudio::NoError;
+ deviceState = QAudio::ActiveState;
+ resuming = false;
+ }
+ } else {
+ //no data, not ready yet, next time
+ return 0;
+ }
+ EnterCriticalSection(&waveInCriticalSection);
+ waveFreeBlockCount++;
+ LeaveCriticalSection(&waveInCriticalSection);
+ waveBlocks[header].dwBytesRecorded=0;
+ waveBlocks[header].dwFlags = 0L;
+ result = waveInPrepareHeader(hWaveIn,&waveBlocks[header], sizeof(WAVEHDR));
+ if(result != MMSYSERR_NOERROR) {
+ qWarning("QAudioInput: failed to prepare block %d,err=%d",header,result);
+ errorState = QAudio::OpenError;
+ deviceState = QAudio::StopState;
+ emit stateChanged(deviceState);
+ }
+ result = waveInAddBuffer(hWaveIn, &waveBlocks[header], sizeof(WAVEHDR));
+ if(result != MMSYSERR_NOERROR) {
+ qWarning("QAudioInput: failed to setup block %d,err=%d",header,result);
+ errorState = QAudio::OpenError;
+ deviceState = QAudio::StopState;
+ emit stateChanged(deviceState);
+ }
+ header++;
+ if(header >= buffer_size/period_size)
+ header = 0;
+ p+=l;
+
+ if(!pullMode) {
+ if(l+period_size > len && waveFreeBlockCount == buffer_size/period_size)
+ done = true;
+ } else {
+ if(waveFreeBlockCount == buffer_size/period_size)
+ done = true;
+ }
+ written+=l;
+ }
+#ifdef DEBUG_AUDIO
+ qDebug()<<"read in len="<<written;
+#endif
+ return written;
+}
+
+void QAudioInputPrivate::resume()
+{
+ if(deviceState == QAudio::SuspendState) {
+ deviceState = QAudio::ActiveState;
+ for(int i=0; i<buffer_size/period_size; i++) {
+ result = waveInAddBuffer(hWaveIn, &waveBlocks[i], sizeof(WAVEHDR));
+ if(result != MMSYSERR_NOERROR) {
+ qWarning("QAudioInput: failed to setup block %d,err=%d",i,result);
+ errorState = QAudio::OpenError;
+ deviceState = QAudio::StopState;
+ emit stateChanged(deviceState);
+ return;
+ }
+ }
+ waveFreeBlockCount = buffer_size/period_size;
+ waveCurrentBlock = 0;
+ header = 0;
+ resuming = true;
+ waveInStart(hWaveIn);
+ QTimer::singleShot(20,this,SLOT(feedback()));
+ emit stateChanged(deviceState);
+ }
+}
+
+void QAudioInputPrivate::setBufferSize(int value)
+{
+ buffer_size = value;
+}
+
+int QAudioInputPrivate::bufferSize() const
+{
+ return buffer_size;
+}
+
+int QAudioInputPrivate::periodSize() const
+{
+ return period_size;
+}
+
+void QAudioInputPrivate::setNotifyInterval(int ms)
+{
+ intervalTime = ms;
+}
+
+int QAudioInputPrivate::notifyInterval() const
+{
+ return intervalTime;
+}
+
+qint64 QAudioInputPrivate::totalTime() const
+{
+ return totalTimeValue;
+}
+
+void QAudioInputPrivate::suspend()
+{
+ if(deviceState == QAudio::ActiveState) {
+ waveInReset(hWaveIn);
+ deviceState = QAudio::SuspendState;
+ emit stateChanged(deviceState);
+ }
+}
+
+void QAudioInputPrivate::feedback()
+{
+#ifdef DEBUG_AUDIO
+ QTime now(QTime::currentTime());
+ qDebug()<<now.second()<<"s "<<now.msec()<<"ms :feedback() INPUT";
+#endif
+ bytesAvailable = bytesReady();
+
+ if(!(deviceState==QAudio::StopState||deviceState==QAudio::SuspendState))
+ emit processMore();
+}
+
+bool QAudioInputPrivate::deviceReady()
+{
+#ifdef DEBUG_AUDIO
+ QTime now(QTime::currentTime());
+ qDebug()<<now.second()<<"s "<<now.msec()<<"ms :deviceReady() INPUT";
+#endif
+ if(pullMode) {
+ // reads some audio data and writes it to QIODevice
+ read(0,0);
+ } else {
+ // emits readyRead() so user will call read() on QIODevice to get some audio data
+ InputPrivate* a = qobject_cast<InputPrivate*>(audioSource);
+ a->trigger();
+ }
+ if(deviceState != QAudio::ActiveState)
+ return true;
+
+ if(timeStamp.elapsed() > intervalTime && intervalTime > 50) {
+ emit notify();
+ timeStamp.restart();
+ }
+ return true;
+}
+
+qint64 QAudioInputPrivate::clock() const
+{
+ if(deviceState != QAudio::ActiveState)
+ return 0;
+
+ return timeStampOpened.elapsed();
+}
+
+void QAudioInputPrivate::reset()
+{
+ close();
+}
+
+InputPrivate::InputPrivate(QAudioInputPrivate* audio)
+{
+ audioDevice = qobject_cast<QAudioInputPrivate*>(audio);
+}
+
+InputPrivate::~InputPrivate() {}
+
+qint64 InputPrivate::readData( char* data, qint64 len)
+{
+ // push mode, user read() called
+ if(audioDevice->deviceState != QAudio::ActiveState)
+ return 0;
+ // Read in some audio data
+ return audioDevice->read(data,len);
+}
+
+qint64 InputPrivate::writeData(const char* data, qint64 len)
+{
+ Q_UNUSED(data)
+ Q_UNUSED(len)
+
+ emit readyRead();
+ return 0;
+}
+
+void InputPrivate::trigger()
+{
+ emit readyRead();
+}
+
diff --git a/src/multimedia/audio/qaudioinput_win32_p.h b/src/multimedia/audio/qaudioinput_win32_p.h
new file mode 100644
index 000000000..aa0d0b39c
--- /dev/null
+++ b/src/multimedia/audio/qaudioinput_win32_p.h
@@ -0,0 +1,152 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#ifndef QAUDIOINPUTWIN_H
+#define QAUDIOINPUTWIN_H
+
+#include <windows.h>
+#include <mmsystem.h>
+
+#include <QtCore/qfile.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qtimer.h>
+#include <QtCore/qstring.h>
+#include <QtCore/qstringlist.h>
+#include <QtCore/qdatetime.h>
+
+#include <QtMultimedia/qaudio.h>
+#include <QtMultimedia/qaudiodeviceinfo.h>
+#include <QtMultimedia/qaudioengine.h>
+
+
+class QAudioInputPrivate : public QAbstractAudioInput
+{
+ Q_OBJECT
+public:
+ QAudioInputPrivate(const QByteArray &device, const QAudioFormat& audioFormat);
+ ~QAudioInputPrivate();
+
+ qint64 read(char* data, qint64 len);
+
+ QAudioFormat format() const;
+ 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 totalTime() const;
+ qint64 clock() const;
+ QAudio::Error error() const;
+ QAudio::State state() const;
+
+ QIODevice* audioSource;
+ QAudioFormat settings;
+ QAudio::Error errorState;
+ QAudio::State deviceState;
+
+private:
+ qint32 buffer_size;
+ qint32 period_size;
+ qint32 header;
+ QByteArray m_device;
+ int bytesAvailable;
+ int intervalTime;
+ QTime timeStamp;
+ QTime timeStampOpened;
+ qint64 totalTimeValue;
+ bool pullMode;
+ bool resuming;
+ WAVEFORMATEX wfx;
+ HWAVEIN hWaveIn;
+ MMRESULT result;
+ WAVEHDR* waveBlocks;
+ volatile int waveFreeBlockCount;
+ int waveCurrentBlock;
+
+ static void CALLBACK waveInProc( HWAVEIN hWaveIn, UINT uMsg,
+ DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 );
+
+ WAVEHDR* allocateBlocks(int size, int count);
+ void freeBlocks(WAVEHDR* blockArray);
+ bool open();
+ void close();
+
+private slots:
+ void feedback();
+ bool deviceReady();
+
+signals:
+ void processMore();
+};
+
+class InputPrivate : public QIODevice
+{
+ Q_OBJECT
+public:
+ InputPrivate(QAudioInputPrivate* audio);
+ ~InputPrivate();
+
+ qint64 readData( char* data, qint64 len);
+ qint64 writeData(const char* data, qint64 len);
+
+ void trigger();
+private:
+ QAudioInputPrivate *audioDevice;
+};
+
+#endif
diff --git a/src/multimedia/audio/qaudiooutput.cpp b/src/multimedia/audio/qaudiooutput.cpp
new file mode 100644
index 000000000..785da6121
--- /dev/null
+++ b/src/multimedia/audio/qaudiooutput.cpp
@@ -0,0 +1,403 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtMultimedia/qaudio.h>
+#include <QtMultimedia/qaudiodeviceinfo.h>
+#include <QtMultimedia/qaudioengine.h>
+#include <QtMultimedia/qaudiooutput.h>
+
+#include "qaudiodevicefactory_p.h"
+
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QAudioOutput
+ \brief The QAudioOutput class provides an interface for sending audio data to an audio output device.
+
+ \inmodule QtMultimedia
+ \ingroup multimedia
+ \since 4.6
+
+ You can construct an audio output with the system's
+ \l{QAudioDeviceInfo::defaultOutputDevice()}{default audio output
+ device}. It is also possible to create QAudioOutput with a
+ specific QAudioDeviceId. When you create the audio output, you
+ should also send in the QAudioFormat to be used for the playback
+ (see the QAudioFormat class description for details).
+
+ To play a file:
+
+ Starting to play an audio stream is simply a matter of calling
+ start() with a QIODevice. QAudioOutput will then fetch the data it
+ needs from the io device. So playing back an audio file is as
+ simple as:
+
+ \code
+ QFile inputFile;
+ inputFile.setFileName("/tmp/test.raw");
+ inputFile.open(QIODevice::ReadOnly);
+
+ QAudioFormat format;
+ // Set up the format, eg.
+ format.setFrequency(8000);
+ format.setChannels(1);
+ format.setSampleSize(8);
+ format.setCodec("audio/pcm");
+ format.setByteOrder(QAudioFormat::LittleEndian);
+ format.setSampleType(QAudioFormat::UnSignedInt);
+
+ QAudioOutput *audio = new QAudioOutput(format, this);
+ connect(audio,SIGNAL(stateChanged(QAudio::State)),SLOT(finishedPlaying(QAudio::State)));
+ audio->start(inputFile);
+
+ \endcode
+
+ The file will start playing assuming that the audio system and
+ output device support it. If you run out of luck, check what's
+ up with the error() function.
+
+ After the file has finished playing, we need to stop the device:
+
+ \code
+ void finishedPlaying(QAudio::State state)
+ {
+ if(state == QAudio::IdleState) {
+ audio->stop();
+ inputFile.close();
+ }
+ }
+ \endcode
+
+ At any given time, the QAudioOutput will be in one of four states:
+ active, suspended, stopped, or idle. These states are described
+ by the QAudio::State enum.
+ State changes are reported through the stateChanged() signal. You
+ can use this signal to, for instance, update the GUI of the
+ application; the mundane example here being changing the state of
+ a \c { play/pause } button. You request a state change directly
+ with suspend(), stop(), reset(), resume(), and start().
+
+ While the stream is playing, you can set a notify interval in
+ milliseconds with setNotifyInterval(). This interval specifies the
+ time between two emissions of the notify() signal. This is
+ relative to the position in the stream, i.e., if the QAudioOutput
+ is in the SuspendedState or the IdleState, the notify() signal is
+ not emitted. A typical use-case would be to update a
+ \l{QSlider}{slider} that allows seeking in the stream.
+ If you want the time since playback started regardless of which
+ states the audio output has been in, clock() is the function for you.
+
+ If an error occurs, you can fetch the \l{QAudio::Error}{error
+ type} with the error() function. Please see the QAudio::Error enum
+ for a description of the possible errors that are reported.
+
+ If an error is encountered state changes to QAudio::StopState.
+
+ \sa QAudioInput, QAudioDeviceInfo
+*/
+
+/*!
+ Construct a new audio output and attach it to \a parent.
+ The default audio output device is used with the output
+ \a format parameters.
+*/
+
+QAudioOutput::QAudioOutput(const QAudioFormat &format, QObject *parent):
+ QObject(parent)
+{
+ d = QAudioDeviceFactory::createDefaultOutputDevice(format);
+ connect(d, SIGNAL(notify()), SIGNAL(notify()));
+ connect(d, SIGNAL(stateChanged(QAudio::State)), SIGNAL(stateChanged(QAudio::State)));
+}
+
+/*!
+ Construct a new audio output and attach it to \a parent.
+ The \a id of the audio output device is used with the output
+ \a format parameters.
+*/
+
+QAudioOutput::QAudioOutput(const QAudioDeviceId &id, const QAudioFormat &format, QObject *parent):
+ QObject(parent)
+{
+ d = QAudioDeviceFactory::createOutputDevice(id, format);
+ connect(d, SIGNAL(notify()), SIGNAL(notify()));
+ connect(d, SIGNAL(stateChanged(QAudio::State)), SIGNAL(stateChanged(QAudio::State)));
+}
+
+/*!
+ Destroys this audio output.
+*/
+
+QAudioOutput::~QAudioOutput()
+{
+ delete d;
+}
+
+/*!
+ Returns the QAudioFormat being used.
+
+*/
+
+QAudioFormat QAudioOutput::format() const
+{
+ return d->format();
+}
+
+/*!
+ Uses the \a device as the QIODevice to transfer data.
+ If \a device is null then the class creates an internal QIODevice.
+ Returns a pointer to the QIODevice being used to handle the data
+ transfer. This QIODevice can be used to write() audio data
+ directly.
+ Passing a QIODevice allows the data to be transfered without any extra code.
+ All that is required is to open the QIODevice.
+
+ /sa QIODevice
+*/
+
+QIODevice* QAudioOutput::start(QIODevice* device)
+{
+ /*
+ PULL MODE (valid QIODevice)
+ -If currently not StopState, stop.
+ -If previous start was push mode, delete internal QIODevice.
+ -open audio output.
+ -If ok, NoError and ActiveState, else OpenError and StopState
+ -emit stateChanged()
+ -return device
+
+ PUSH MODE (device = 0)
+ -If currently not StopState, stop.
+ -If no internal QIODevice, create one.
+ -open audio output.
+ -If ok, NoError and IdleState, else OpenError and StopState
+ -emit stateChanged()
+ -return internal QIODevice
+ */
+ return d->start(device);
+}
+
+/*!
+ Stops the audio output.
+*/
+
+void QAudioOutput::stop()
+{
+ /*
+ -If StopState, return
+ -set to StopState
+ -detach from audio device
+ -emit stateChanged()
+ */
+ d->stop();
+}
+
+/*!
+ Drops all audio data in the buffers, resets buffers to zero.
+*/
+
+void QAudioOutput::reset()
+{
+ /*
+ -drop all buffered audio, set buffers to zero.
+ -call stop()
+ */
+ d->reset();
+}
+
+/*!
+ Stops processing audio data, preserving buffered audio data.
+*/
+
+void QAudioOutput::suspend()
+{
+ /*
+ -If not ActiveState|IdleState, return
+ -stop processing audio, saving all buffered audio data
+ -set NoError and SuspendState
+ -emit stateChanged()
+ */
+ d->suspend();
+}
+
+/*!
+ Resumes processing audio data after a suspend().
+*/
+
+void QAudioOutput::resume()
+{
+ /*
+ -If SuspendState, return
+ -resume audio
+ -(PULL MODE): set ActiveState, NoError
+ -(PUSH MODE): set IdleState, NoError
+ -kick start audio if needed
+ -emit stateChanged()
+ */
+ d->resume();
+}
+
+/*!
+ Returns the free space available in bytes in the audio buffer.
+*/
+
+int QAudioOutput::bytesFree() const
+{
+ /*
+ -If not ActiveState|IdleState, return 0
+ -return space available in audio buffer in bytes
+ */
+ return d->bytesFree();
+}
+
+/*!
+ Returns the period size in bytes.
+
+ Note: This is the recommended write size in bytes.
+*/
+
+int QAudioOutput::periodSize() const
+{
+ return d->periodSize();
+}
+
+/*!
+ Sets the audio buffer size to \a value in bytes.
+
+ Note: This function can be called anytime before start(), calls to this
+ are ignored after start(). It should not be assumed that the buffer size
+ set is the actual buffer size used, calling bufferSize() anytime after start()
+ will return the actual buffer size being used.
+*/
+
+void QAudioOutput::setBufferSize(int value)
+{
+ d->setBufferSize(value);
+}
+
+/*!
+ Returns the audio buffer size in bytes.
+
+ If called before start(), returns platform default value.
+ If called before start() but setBufferSize() was called prior, returns value set by setBufferSize().
+ If called after start(), returns the actual buffer size being used. This may not be what was set previously
+ by setBufferSize().
+
+*/
+
+int QAudioOutput::bufferSize() const
+{
+ return d->bufferSize();
+}
+
+/*!
+ Sets the interval for notify() signal to be emitted.
+ This is based on the \a ms of audio data processed
+ not on actual real-time. The resolution of the timer is platform specific.
+*/
+
+void QAudioOutput::setNotifyInterval(int ms)
+{
+ d->setNotifyInterval(ms);
+}
+
+/*!
+ Returns the notify interval in milliseconds.
+*/
+
+int QAudioOutput::notifyInterval() const
+{
+ return d->notifyInterval();
+}
+
+/*!
+ Returns the amount of audio data processed since start()
+ was called in microseconds.
+*/
+
+qint64 QAudioOutput::totalTime() const
+{
+ return d->totalTime();
+}
+
+/*!
+ Returns the microseconds since start() was called, including time in Idle and
+ Suspend states.
+*/
+
+qint64 QAudioOutput::clock() const
+{
+ return d->clock();
+}
+
+/*!
+ Returns the error state.
+*/
+
+QAudio::Error QAudioOutput::error() const
+{
+ return d->error();
+}
+
+/*!
+ Returns the state of audio processing.
+*/
+
+QAudio::State QAudioOutput::state() const
+{
+ return d->state();
+}
+
+/*!
+ \fn QAudioOutput::stateChanged(QAudio::State state)
+ This signal is emitted when the device \a state has changed.
+ This is the current state of the audio output.
+*/
+
+/*!
+ \fn QAudioOutput::notify()
+ This signal is emitted when x ms of audio data has been processed
+ the interval set by setNotifyInterval(x).
+*/
+
+QT_END_NAMESPACE
diff --git a/src/multimedia/audio/qaudiooutput.h b/src/multimedia/audio/qaudiooutput.h
new file mode 100644
index 000000000..95e28eada
--- /dev/null
+++ b/src/multimedia/audio/qaudiooutput.h
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QAUDIOOUTPUT_H
+#define QAUDIOOUTPUT_H
+
+#include <QtCore/qiodevice.h>
+#include <QtCore/qglobal.h>
+
+#include <QtMultimedia/qaudio.h>
+#include <QtMultimedia/qaudioformat.h>
+#include <QtMultimedia/qaudiodeviceid.h>
+
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Multimedia)
+
+
+class QAbstractAudioOutput;
+
+class Q_MULTIMEDIA_EXPORT QAudioOutput : public QObject
+{
+ Q_OBJECT
+
+public:
+ explicit QAudioOutput(const QAudioFormat &format = QAudioFormat(), QObject *parent = 0);
+ explicit QAudioOutput(const QAudioDeviceId &id, const QAudioFormat &format = QAudioFormat(), QObject *parent = 0);
+ ~QAudioOutput();
+
+ QAudioFormat format() const;
+
+ QIODevice* start(QIODevice *device = 0);
+ void stop();
+ void reset();
+ void suspend();
+ void resume();
+
+ void setBufferSize(int bytes);
+ int bufferSize() const;
+
+ int bytesFree() const;
+ int periodSize() const;
+
+ void setNotifyInterval(int milliSeconds);
+ int notifyInterval() const;
+
+ qint64 totalTime() const;
+ qint64 clock() const;
+
+ QAudio::Error error() const;
+ QAudio::State state() const;
+
+Q_SIGNALS:
+ void stateChanged(QAudio::State);
+ void notify();
+
+private:
+ Q_DISABLE_COPY(QAudioOutput)
+
+ QAbstractAudioOutput* d;
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QAUDIOOUTPUT_H
diff --git a/src/multimedia/audio/qaudiooutput_alsa_p.cpp b/src/multimedia/audio/qaudiooutput_alsa_p.cpp
new file mode 100644
index 000000000..d41c449cc
--- /dev/null
+++ b/src/multimedia/audio/qaudiooutput_alsa_p.cpp
@@ -0,0 +1,706 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qcoreapplication.h>
+#include "qaudiooutput_alsa_p.h"
+
+//#define DEBUG_AUDIO 1
+
+QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray &device, const QAudioFormat& audioFormat):
+ settings(audioFormat)
+{
+ bytesAvailable = 0;
+ handle = 0;
+ ahandler = 0;
+ access = SND_PCM_ACCESS_RW_INTERLEAVED;
+ pcmformat = SND_PCM_FORMAT_S16;
+ buffer_frames = 0;
+ period_frames = 0;
+ buffer_size = 0;
+ period_size = 0;
+ buffer_time = 100000;
+ period_time = 20000;
+ totalTimeValue = 0;
+ intervalTime = 1000;
+ audioBuffer = 0;
+ errorState = QAudio::NoError;
+ deviceState = QAudio::StopState;
+ audioSource = 0;
+ pullMode = true;
+ resuming = false;
+ opened = false;
+
+ QStringList list1 = QString(tr(device)).split(tr(":"));
+ m_device = QByteArray(list1.at(0).toLocal8Bit().constData());
+
+ timer = new QTimer(this);
+ connect(timer,SIGNAL(timeout()),SLOT(userFeed()));
+}
+
+QAudioOutputPrivate::~QAudioOutputPrivate()
+{
+ close();
+ disconnect(timer, SIGNAL(timeout()));
+ QCoreApplication::processEvents();
+ delete timer;
+}
+
+QAudio::Error QAudioOutputPrivate::error() const
+{
+ return errorState;
+}
+
+QAudio::State QAudioOutputPrivate::state() const
+{
+ return deviceState;
+}
+
+void QAudioOutputPrivate::async_callback(snd_async_handler_t *ahandler)
+{
+ QAudioOutputPrivate* audioOut;
+
+ audioOut = static_cast<QAudioOutputPrivate*>
+ (snd_async_handler_get_callback_private(ahandler));
+
+ if((audioOut->deviceState==QAudio::ActiveState)||(audioOut->resuming))
+ audioOut->feedback();
+}
+
+int QAudioOutputPrivate::xrun_recovery(int err)
+{
+ int count = 0;
+ bool reset = false;
+
+ if(err == -EPIPE) {
+ errorState = QAudio::UnderrunError;
+ err = snd_pcm_prepare(handle);
+ if(err < 0)
+ reset = true;
+
+ } else if((err == -ESTRPIPE)||(err == -EIO)) {
+ errorState = QAudio::IOError;
+ while((err = snd_pcm_resume(handle)) == -EAGAIN){
+ usleep(100);
+ count++;
+ if(count > 5) {
+ reset = true;
+ break;
+ }
+ }
+ if(err < 0) {
+ err = snd_pcm_prepare(handle);
+ if(err < 0)
+ reset = true;
+ }
+ }
+ if(reset) {
+ close();
+ open();
+ snd_pcm_prepare(handle);
+ return 0;
+ }
+ return err;
+}
+
+int QAudioOutputPrivate::setFormat()
+{
+ snd_pcm_format_t pcmformat = SND_PCM_FORMAT_S16;
+
+ if(settings.sampleSize() == 8) {
+ pcmformat = SND_PCM_FORMAT_U8;
+
+ } else if(settings.sampleSize() == 16) {
+ if(settings.sampleType() == QAudioFormat::SignedInt) {
+ if(settings.byteOrder() == QAudioFormat::LittleEndian)
+ pcmformat = SND_PCM_FORMAT_S16_LE;
+ else
+ pcmformat = SND_PCM_FORMAT_S16_BE;
+ } else if(settings.sampleType() == QAudioFormat::UnSignedInt) {
+ if(settings.byteOrder() == QAudioFormat::LittleEndian)
+ pcmformat = SND_PCM_FORMAT_U16_LE;
+ else
+ pcmformat = SND_PCM_FORMAT_U16_BE;
+ }
+ } else if(settings.sampleSize() == 24) {
+ if(settings.sampleType() == QAudioFormat::SignedInt) {
+ if(settings.byteOrder() == QAudioFormat::LittleEndian)
+ pcmformat = SND_PCM_FORMAT_S24_LE;
+ else
+ pcmformat = SND_PCM_FORMAT_S24_BE;
+ } else if(settings.sampleType() == QAudioFormat::UnSignedInt) {
+ if(settings.byteOrder() == QAudioFormat::LittleEndian)
+ pcmformat = SND_PCM_FORMAT_U24_LE;
+ else
+ pcmformat = SND_PCM_FORMAT_U24_BE;
+ }
+ } else if(settings.sampleSize() == 32) {
+ if(settings.sampleType() == QAudioFormat::SignedInt) {
+ if(settings.byteOrder() == QAudioFormat::LittleEndian)
+ pcmformat = SND_PCM_FORMAT_S32_LE;
+ else
+ pcmformat = SND_PCM_FORMAT_S32_BE;
+ } else if(settings.sampleType() == QAudioFormat::UnSignedInt) {
+ if(settings.byteOrder() == QAudioFormat::LittleEndian)
+ pcmformat = SND_PCM_FORMAT_U32_LE;
+ else
+ pcmformat = SND_PCM_FORMAT_U32_BE;
+ } else if(settings.sampleType() == QAudioFormat::Float) {
+ if(settings.byteOrder() == QAudioFormat::LittleEndian)
+ pcmformat = SND_PCM_FORMAT_FLOAT_LE;
+ else
+ pcmformat = SND_PCM_FORMAT_FLOAT_BE;
+ }
+ } else if(settings.sampleSize() == 64) {
+ if(settings.byteOrder() == QAudioFormat::LittleEndian)
+ pcmformat = SND_PCM_FORMAT_FLOAT64_LE;
+ else
+ pcmformat = SND_PCM_FORMAT_FLOAT64_BE;
+ }
+
+ return snd_pcm_hw_params_set_format( handle, hwparams, pcmformat);
+}
+
+QIODevice* QAudioOutputPrivate::start(QIODevice* device)
+{
+ if(deviceState != QAudio::StopState)
+ deviceState = QAudio::StopState;
+
+ errorState = QAudio::NoError;
+
+ // Handle change of mode
+ if(audioSource && pullMode && !device) {
+ // pull -> push
+ close();
+ audioSource = 0;
+ } else if(audioSource && !pullMode && device) {
+ // push -> pull
+ close();
+ delete audioSource;
+ audioSource = 0;
+ }
+
+ if(device) {
+ //set to pull mode
+ pullMode = true;
+ audioSource = device;
+ deviceState = QAudio::ActiveState;
+ } else {
+ //set to push mode
+ if(!audioSource) {
+ audioSource = new OutputPrivate(this);
+ audioSource->open(QIODevice::WriteOnly|QIODevice::Unbuffered);
+ }
+ pullMode = false;
+ deviceState = QAudio::IdleState;
+ }
+
+ open();
+
+ emit stateChanged(deviceState);
+
+ return audioSource;
+}
+
+void QAudioOutputPrivate::stop()
+{
+ if(deviceState == QAudio::StopState)
+ return;
+ deviceState = QAudio::StopState;
+ close();
+ emit stateChanged(deviceState);
+}
+
+bool QAudioOutputPrivate::open()
+{
+ if(opened)
+ return true;
+
+#ifdef DEBUG_AUDIO
+ QTime now(QTime::currentTime());
+ qDebug()<<now.second()<<"s "<<now.msec()<<"ms :open()";
+#endif
+ timeStamp.restart();
+
+ int dir;
+ int err=-1;
+ int count=0;
+ unsigned int freakuency=settings.frequency();
+
+ QString dev = tr(m_device.constData());
+ if(!dev.contains(tr("default"))) {
+ dev = QString(tr("default:CARD=%1")).arg(tr(m_device.constData()));
+ }
+ // Step 1: try and open the device
+ while((count < 5) && (err < 0)) {
+ err=snd_pcm_open(&handle,dev.toLocal8Bit().constData(),SND_PCM_STREAM_PLAYBACK,0);
+ if(err < 0)
+ count++;
+ }
+ if (( err < 0)||(handle == 0)) {
+ errorState = QAudio::OpenError;
+ deviceState = QAudio::StopState;
+ return false;
+ }
+ snd_pcm_nonblock( handle, 0 );
+
+ // Step 2: Set the desired HW parameters.
+ snd_pcm_hw_params_alloca( &hwparams );
+
+ bool fatal = false;
+ QString errMessage;
+ unsigned int chunks = 8;
+
+ err = snd_pcm_hw_params_any( handle, hwparams );
+ if ( err < 0 ) {
+ fatal = true;
+ errMessage = QString(tr("QAudioOutput: snd_pcm_hw_params_any: err = %1")).arg(err);
+ }
+ if ( !fatal ) {
+ err = snd_pcm_hw_params_set_rate_resample( handle, hwparams, 1 );
+ if ( err < 0 ) {
+ fatal = true;
+ errMessage = QString(tr("QAudioOutput: snd_pcm_hw_params_set_rate_resample: err = %1")).arg(err);
+ }
+ }
+ if ( !fatal ) {
+ err = snd_pcm_hw_params_set_access( handle, hwparams, access );
+ if ( err < 0 ) {
+ fatal = true;
+ errMessage = QString(tr("QAudioOutput: snd_pcm_hw_params_set_access: err = %1")).arg(err);
+ }
+ }
+ if ( !fatal ) {
+ err = setFormat();
+ if ( err < 0 ) {
+ fatal = true;
+ errMessage = QString(tr("QAudioOutput: snd_pcm_hw_params_set_format: err = %1")).arg(err);
+ }
+ }
+ if ( !fatal ) {
+ err = snd_pcm_hw_params_set_channels( handle, hwparams, (unsigned int)settings.channels() );
+ if ( err < 0 ) {
+ fatal = true;
+ errMessage = QString(tr("QAudioOutput: snd_pcm_hw_params_set_channels: err = %1")).arg(err);
+ }
+ }
+ if ( !fatal ) {
+ err = snd_pcm_hw_params_set_rate_near( handle, hwparams, &freakuency, 0 );
+ if ( err < 0 ) {
+ fatal = true;
+ errMessage = QString(tr("QAudioOutput: snd_pcm_hw_params_set_rate_near: err = %1")).arg(err);
+ }
+ }
+ if ( !fatal ) {
+ err = snd_pcm_hw_params_set_buffer_time_near(handle, hwparams, &buffer_time, &dir);
+ if ( err < 0 ) {
+ fatal = true;
+ errMessage = QString(tr("QAudioOutput: snd_pcm_hw_params_set_buffer_time_near: err = %1")).arg(err);
+ }
+ }
+ if ( !fatal ) {
+ err = snd_pcm_hw_params_set_period_time_near(handle, hwparams, &period_time, &dir);
+ if ( err < 0 ) {
+ fatal = true;
+ errMessage = QString(tr("QAudioOutput: snd_pcm_hw_params_set_period_time_near: err = %1")).arg(err);
+ }
+ }
+ if ( !fatal ) {
+ err = snd_pcm_hw_params_set_periods_near(handle, hwparams, &chunks, &dir);
+ if ( err < 0 ) {
+ fatal = true;
+ errMessage = QString(tr("QAudioOutput: snd_pcm_hw_params_set_periods_near: err = %1")).arg(err);
+ }
+ }
+ if ( !fatal ) {
+ err = snd_pcm_hw_params(handle, hwparams);
+ if ( err < 0 ) {
+ fatal = true;
+ errMessage = QString(tr("QAudioOutput: snd_pcm_hw_params: err = %1")).arg(err);
+ }
+ }
+ if( err < 0) {
+ qWarning()<<errMessage;
+ errorState = QAudio::OpenError;
+ deviceState = QAudio::StopState;
+ return false;
+ }
+ snd_pcm_hw_params_get_buffer_size(hwparams,&buffer_frames);
+ buffer_size = snd_pcm_frames_to_bytes(handle,buffer_frames);
+ snd_pcm_hw_params_get_period_size(hwparams,&period_frames, &dir);
+ period_size = snd_pcm_frames_to_bytes(handle,period_frames);
+ snd_pcm_hw_params_get_buffer_time(hwparams,&buffer_time, &dir);
+ snd_pcm_hw_params_get_period_time(hwparams,&period_time, &dir);
+
+ // Step 3: Set the desired SW parameters.
+ snd_pcm_sw_params_t *swparams;
+ snd_pcm_sw_params_alloca(&swparams);
+ snd_pcm_sw_params_current(handle, swparams);
+ snd_pcm_sw_params_set_start_threshold(handle,swparams,period_frames);
+ snd_pcm_sw_params_set_stop_threshold(handle,swparams,buffer_frames);
+ snd_pcm_sw_params_set_avail_min(handle, swparams,period_frames);
+ snd_pcm_sw_params(handle, swparams);
+
+ // Step 4: Prepare audio
+ if(audioBuffer == 0)
+ audioBuffer = new char[snd_pcm_frames_to_bytes(handle,buffer_frames)];
+ snd_pcm_prepare( handle );
+ snd_pcm_start(handle);
+
+ // Step 5: Setup callback and timer fallback
+ snd_async_add_pcm_handler(&ahandler, handle, async_callback, this);
+ bytesAvailable = bytesFree();
+
+ // Step 6: Start audio processing
+ timer->start(period_time/1000);
+
+ errorState = QAudio::NoError;
+ totalTimeValue = 0;
+ opened = true;
+
+ return true;
+}
+
+void QAudioOutputPrivate::close()
+{
+ deviceState = QAudio::StopState;
+ timer->stop();
+
+ if ( handle ) {
+ snd_pcm_drain( handle );
+ snd_pcm_close( handle );
+ handle = 0;
+ delete [] audioBuffer;
+ audioBuffer=0;
+ }
+ if(!pullMode && audioSource) {
+ delete audioSource;
+ audioSource = 0;
+ }
+ opened = false;
+}
+
+int QAudioOutputPrivate::bytesFree() const
+{
+ if(resuming)
+ return period_size;
+
+ if(deviceState != QAudio::ActiveState && deviceState != QAudio::IdleState)
+ return 0;
+ int frames = snd_pcm_avail_update(handle);
+ if((int)frames > (int)buffer_frames)
+ frames = buffer_frames;
+
+ return snd_pcm_frames_to_bytes(handle, frames);
+}
+
+qint64 QAudioOutputPrivate::write( const char *data, qint64 len )
+{
+ // Write out some audio data
+ if ( !handle )
+ return 0;
+#ifdef DEBUG_AUDIO
+ qDebug()<<"frames to write out = "<<
+ snd_pcm_bytes_to_frames( handle, (int)len )<<" ("<<len<<") bytes";
+#endif
+ int frames, err;
+ int space = bytesFree();
+ if(len < space) {
+ // Just write it
+ frames = snd_pcm_bytes_to_frames( handle, (int)len );
+ err = snd_pcm_writei( handle, data, frames );
+ } else {
+ // Only write space worth
+ frames = snd_pcm_bytes_to_frames( handle, (int)space );
+ err = snd_pcm_writei( handle, data, frames );
+ }
+ if(err > 0) {
+ totalTimeValue += err*1000000/settings.frequency();
+ resuming = false;
+ errorState = QAudio::NoError;
+ deviceState = QAudio::ActiveState;
+ return snd_pcm_frames_to_bytes( handle, err );
+ } else
+ err = xrun_recovery(err);
+
+ if(err < 0) {
+ close();
+ errorState = QAudio::FatalError;
+ deviceState = QAudio::StopState;
+ emit stateChanged(deviceState);
+ }
+ return 0;
+}
+
+int QAudioOutputPrivate::periodSize() const
+{
+ return period_size;
+}
+
+void QAudioOutputPrivate::setBufferSize(int value)
+{
+ if(deviceState == QAudio::StopState)
+ buffer_size = value;
+}
+
+int QAudioOutputPrivate::bufferSize() const
+{
+ return buffer_size;
+}
+
+void QAudioOutputPrivate::setNotifyInterval(int ms)
+{
+ intervalTime = ms;
+}
+
+int QAudioOutputPrivate::notifyInterval() const
+{
+ return intervalTime;
+}
+
+qint64 QAudioOutputPrivate::totalTime() const
+{
+ return totalTimeValue;
+}
+
+void QAudioOutputPrivate::resume()
+{
+ if(deviceState == QAudio::SuspendState) {
+ int err = 0;
+
+ if(handle) {
+ err = snd_pcm_prepare( handle );
+ if(err < 0)
+ xrun_recovery(err);
+
+ err = snd_pcm_start(handle);
+ if(err < 0)
+ xrun_recovery(err);
+
+ bytesAvailable = (int)snd_pcm_frames_to_bytes(handle, buffer_frames);
+ }
+ resuming = true;
+ if(pullMode)
+ deviceState = QAudio::ActiveState;
+ else
+ deviceState = QAudio::IdleState;
+
+ errorState = QAudio::NoError;
+ timer->start(period_time/1000);
+ emit stateChanged(deviceState);
+ }
+}
+
+QAudioFormat QAudioOutputPrivate::format() const
+{
+ return settings;
+}
+
+void QAudioOutputPrivate::suspend()
+{
+ if(deviceState == QAudio::ActiveState || deviceState == QAudio::IdleState || resuming) {
+ timer->stop();
+ deviceState = QAudio::SuspendState;
+ errorState = QAudio::NoError;
+ emit stateChanged(deviceState);
+ }
+}
+
+void QAudioOutputPrivate::userFeed()
+{
+ if(deviceState == QAudio::StopState || deviceState == QAudio::SuspendState)
+ return;
+#ifdef DEBUG_AUDIO
+ QTime now(QTime::currentTime());
+ qDebug()<<now.second()<<"s "<<now.msec()<<"ms :userFeed() OUT";
+#endif
+ if(deviceState == QAudio::IdleState)
+ bytesAvailable = bytesFree();
+
+ deviceReady();
+}
+
+void QAudioOutputPrivate::feedback()
+{
+ QMetaObject::invokeMethod(this, SLOT(updateAvailable()), Qt::QueuedConnection);
+}
+
+void QAudioOutputPrivate::updateAvailable()
+{
+#ifdef DEBUG_AUDIO
+ QTime now(QTime::currentTime());
+ qDebug()<<now.second()<<"s "<<now.msec()<<"ms :updateAvailable()";
+#endif
+ bytesAvailable = bytesFree();
+}
+
+bool QAudioOutputPrivate::deviceReady()
+{
+ if(pullMode) {
+ int l = 0;
+ int chunks = bytesAvailable/period_size;
+ if(chunks==0) {
+ bytesAvailable = bytesFree();
+ return false;
+ }
+#ifdef DEBUG_AUDIO
+ qDebug()<<"deviceReady() avail="<<bytesAvailable<<" bytes, period size="<<period_size<<" bytes";
+ qDebug()<<"deviceReady() no. of chunks that can fit ="<<chunks<<", chunks in bytes ="<<period_size*chunks;
+#endif
+ int input = period_frames*chunks;
+ if(input > (int)buffer_frames)
+ input = buffer_frames;
+ l = audioSource->read(audioBuffer,snd_pcm_frames_to_bytes(handle, input));
+ if(l > 0) {
+ // Got some data to output
+ if(deviceState != QAudio::ActiveState)
+ return true;
+ write(audioBuffer,l);
+ bytesAvailable = bytesFree();
+
+ } else if(l == 0) {
+ // Did not get any data to output
+ bytesAvailable = bytesFree();
+ if(bytesAvailable > snd_pcm_frames_to_bytes(handle, buffer_frames-period_frames)) {
+ // Underrun
+ errorState = QAudio::UnderrunError;
+ deviceState = QAudio::IdleState;
+ emit stateChanged(deviceState);
+ }
+
+ } else if(l < 0) {
+ close();
+ errorState = QAudio::IOError;
+ emit stateChanged(deviceState);
+ }
+ } else
+ bytesAvailable = bytesFree();
+
+ if(deviceState != QAudio::ActiveState)
+ return true;
+
+ if(timeStamp.elapsed() > intervalTime && intervalTime > 50) {
+ emit notify();
+ timeStamp.restart();
+ }
+ return true;
+}
+
+qint64 QAudioOutputPrivate::clock() const
+{
+ if(!handle)
+ return 0;
+
+ if(deviceState != QAudio::ActiveState)
+ return 0;
+
+ snd_pcm_status_t* status;
+ snd_pcm_status_alloca(&status);
+
+ snd_timestamp_t t1,t2;
+ if( snd_pcm_status(handle, status) >= 0) {
+ snd_pcm_status_get_tstamp(status,&t1);
+ snd_pcm_status_get_trigger_tstamp(status,&t2);
+ t1.tv_sec-=t2.tv_sec;
+
+ signed long l = (signed long)t1.tv_usec - (signed long)t2.tv_usec;
+ if(l < 0) {
+ t1.tv_sec--;
+ l = -l;
+ l %= 1000000;
+ }
+ return ((t1.tv_sec * 1000)+l/1000);
+ } else
+ return 0;
+ return 0;
+}
+
+void QAudioOutputPrivate::reset()
+{
+ if(handle)
+ snd_pcm_reset(handle);
+
+ stop();
+}
+
+OutputPrivate::OutputPrivate(QAudioOutputPrivate* audio)
+{
+ audioDevice = qobject_cast<QAudioOutputPrivate*>(audio);
+}
+
+OutputPrivate::~OutputPrivate() {}
+
+qint64 OutputPrivate::readData( char* data, qint64 len)
+{
+ Q_UNUSED(data)
+ Q_UNUSED(len)
+
+ return 0;
+}
+
+qint64 OutputPrivate::writeData(const char* data, qint64 len)
+{
+ int retry = 0;
+ qint64 written = 0;
+ if((audioDevice->deviceState == QAudio::ActiveState)
+ ||(audioDevice->deviceState == QAudio::IdleState)) {
+ while(written < len) {
+ int chunk = audioDevice->write(data+written,(len-written));
+ if(chunk <= 0)
+ retry++;
+ written+=chunk;
+ if(retry > 10)
+ return written;
+ }
+ }
+ return written;
+
+}
diff --git a/src/multimedia/audio/qaudiooutput_alsa_p.h b/src/multimedia/audio/qaudiooutput_alsa_p.h
new file mode 100644
index 000000000..f243bad16
--- /dev/null
+++ b/src/multimedia/audio/qaudiooutput_alsa_p.h
@@ -0,0 +1,159 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#ifndef QAUDIOOUTPUTALSA_H
+#define QAUDIOOUTPUTALSA_H
+
+#include <alsa/asoundlib.h>
+
+#include <QtCore/qfile.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qtimer.h>
+#include <QtCore/qstring.h>
+#include <QtCore/qstringlist.h>
+#include <QtCore/qdatetime.h>
+
+#include <QtMultimedia/qaudio.h>
+#include <QtMultimedia/qaudiodeviceinfo.h>
+#include <QtMultimedia/qaudioengine.h>
+
+class OutputPrivate;
+
+class QAudioOutputPrivate : public QAbstractAudioOutput
+{
+ friend class OutputPrivate;
+ Q_OBJECT
+public:
+ QAudioOutputPrivate(const QByteArray &device, const QAudioFormat& audioFormat);
+ ~QAudioOutputPrivate();
+
+ qint64 write( const char *data, qint64 len );
+
+ 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 totalTime() const;
+ qint64 clock() const;
+ QAudio::Error error() const;
+ QAudio::State state() const;
+ QAudioFormat format() const;
+
+ QIODevice* audioSource;
+ QAudioFormat settings;
+ QAudio::Error errorState;
+ QAudio::State deviceState;
+
+private slots:
+ void userFeed();
+ void feedback();
+ void updateAvailable();
+ bool deviceReady();
+
+signals:
+ void processMore();
+
+private:
+ bool opened;
+ bool pullMode;
+ bool resuming;
+ int buffer_size;
+ int period_size;
+ int intervalTime;
+ qint64 totalTimeValue;
+ unsigned int buffer_time;
+ unsigned int period_time;
+ snd_pcm_uframes_t buffer_frames;
+ snd_pcm_uframes_t period_frames;
+ static void async_callback(snd_async_handler_t *ahandler);
+ int xrun_recovery(int err);
+
+ int setFormat();
+ bool open();
+ void close();
+
+ QTimer* timer;
+ QByteArray m_device;
+ int bytesAvailable;
+ QTime timeStamp;
+ char* audioBuffer;
+ snd_pcm_t* handle;
+ snd_async_handler_t* ahandler;
+ snd_pcm_access_t access;
+ snd_pcm_format_t pcmformat;
+ snd_timestamp_t* timestamp;
+ snd_pcm_hw_params_t *hwparams;
+};
+
+class OutputPrivate : public QIODevice
+{
+ friend class QAudioOutputPrivate;
+ Q_OBJECT
+public:
+ OutputPrivate(QAudioOutputPrivate* audio);
+ ~OutputPrivate();
+
+ qint64 readData( char* data, qint64 len);
+ qint64 writeData(const char* data, qint64 len);
+
+private:
+ QAudioOutputPrivate *audioDevice;
+};
+
+#endif
diff --git a/src/multimedia/audio/qaudiooutput_mac_p.cpp b/src/multimedia/audio/qaudiooutput_mac_p.cpp
new file mode 100644
index 000000000..0d6e615ee
--- /dev/null
+++ b/src/multimedia/audio/qaudiooutput_mac_p.cpp
@@ -0,0 +1,700 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <CoreServices/CoreServices.h>
+#include <CoreAudio/CoreAudio.h>
+#include <AudioUnit/AudioUnit.h>
+#include <AudioToolbox/AudioToolbox.h>
+
+#include <QtCore/qendian.h>
+#include <QtCore/qbuffer.h>
+#include <QtCore/qtimer.h>
+#include <QtCore/qdebug.h>
+
+#include <QtMultimedia/qaudiodeviceinfo.h>
+#include <QtMultimedia/qaudiooutput.h>
+
+#include "qaudio_mac_p.h"
+#include "qaudiooutput_mac_p.h"
+
+
+QT_BEGIN_NAMESPACE
+
+
+namespace
+{
+
+static const int default_buffer_size = 8 * 1024;
+
+
+class QAudioOutputBuffer : public QObject
+{
+ Q_OBJECT
+
+public:
+ QAudioOutputBuffer(int bufferSize, int maxPeriodSize, QAudioFormat const& audioFormat):
+ m_deviceError(false),
+ m_maxPeriodSize(maxPeriodSize),
+ m_device(0)
+ {
+ m_buffer = new QAudioRingBuffer(bufferSize + (bufferSize % maxPeriodSize == 0 ? 0 : maxPeriodSize - (bufferSize % maxPeriodSize)));
+ m_bytesPerFrame = (audioFormat.sampleSize() / 8) * audioFormat.channels();
+ m_periodTime = m_maxPeriodSize / m_bytesPerFrame * 1000 / audioFormat.frequency();
+
+ m_fillTimer = new QTimer(this);
+ connect(m_fillTimer, SIGNAL(timeout()), SLOT(fillBuffer()));
+ }
+
+ ~QAudioOutputBuffer()
+ {
+ delete m_buffer;
+ }
+
+ qint64 readFrames(char* data, qint64 maxFrames)
+ {
+ bool wecan = true;
+ qint64 framesRead = 0;
+
+ while (wecan && framesRead < maxFrames) {
+ QAudioRingBuffer::Region region = m_buffer->acquireReadRegion((maxFrames - framesRead) * m_bytesPerFrame);
+
+ if (region.second > 0) {
+ region.second -= region.second % m_bytesPerFrame;
+ memcpy(data + (framesRead * m_bytesPerFrame), region.first, region.second);
+ framesRead += region.second / m_bytesPerFrame;
+ }
+ else
+ wecan = false;
+
+ m_buffer->releaseReadRegion(region);
+ }
+
+ if (framesRead == 0 && m_deviceError)
+ framesRead = -1;
+
+ return framesRead;
+ }
+
+ qint64 writeBytes(const char* data, qint64 maxSize)
+ {
+ bool wecan = true;
+ qint64 bytesWritten = 0;
+
+ maxSize -= maxSize % m_bytesPerFrame;
+ while (wecan && bytesWritten < maxSize) {
+ QAudioRingBuffer::Region region = m_buffer->acquireWriteRegion(maxSize - bytesWritten);
+
+ if (region.second > 0) {
+ memcpy(region.first, data + bytesWritten, region.second);
+ bytesWritten += region.second;
+ }
+ else
+ wecan = false;
+
+ m_buffer->releaseWriteRegion(region);
+ }
+
+ if (bytesWritten > 0)
+ emit readyRead();
+
+ return bytesWritten;
+ }
+
+ int available() const
+ {
+ return m_buffer->free();
+ }
+
+ void reset()
+ {
+ m_buffer->reset();
+ m_deviceError = false;
+ }
+
+ void setPrefetchDevice(QIODevice* device)
+ {
+ if (m_device != device) {
+ m_device = device;
+ if (m_device != 0)
+ fillBuffer();
+ }
+ }
+
+ void startFillTimer()
+ {
+ if (m_device != 0)
+ m_fillTimer->start(m_buffer->size() / 2 / m_maxPeriodSize * m_periodTime);
+ }
+
+ void stopFillTimer()
+ {
+ m_fillTimer->stop();
+ }
+
+signals:
+ void readyRead();
+
+private slots:
+ void fillBuffer()
+ {
+ const int free = m_buffer->free();
+ const int writeSize = free - (free % m_maxPeriodSize);
+
+ if (writeSize > 0) {
+ bool wecan = true;
+ int filled = 0;
+
+ while (!m_deviceError && wecan && filled < writeSize) {
+ QAudioRingBuffer::Region region = m_buffer->acquireWriteRegion(writeSize - filled);
+
+ if (region.second > 0) {
+ region.second = m_device->read(region.first, region.second);
+ if (region.second > 0)
+ filled += region.second;
+ else if (region.second == 0)
+ wecan = false;
+ else if (region.second < 0) {
+ m_fillTimer->stop();
+ region.second = 0;
+ m_deviceError = true;
+ }
+ }
+ else
+ wecan = false;
+
+ m_buffer->releaseWriteRegion(region);
+ }
+
+ if (filled > 0)
+ emit readyRead();
+ }
+ }
+
+private:
+ bool m_deviceError;
+ int m_maxPeriodSize;
+ int m_bytesPerFrame;
+ int m_periodTime;
+ QIODevice* m_device;
+ QTimer* m_fillTimer;
+ QAudioRingBuffer* m_buffer;
+};
+
+
+}
+
+class MacOutputDevice : public QIODevice
+{
+ Q_OBJECT
+
+public:
+ MacOutputDevice(QAudioOutputBuffer* audioBuffer, QObject* parent):
+ QIODevice(parent),
+ m_audioBuffer(audioBuffer)
+ {
+ open(QIODevice::WriteOnly | QIODevice::Unbuffered);
+ }
+
+ qint64 readData(char* data, qint64 len)
+ {
+ Q_UNUSED(data);
+ Q_UNUSED(len);
+
+ return 0;
+ }
+
+ qint64 writeData(const char* data, qint64 len)
+ {
+ return m_audioBuffer->writeBytes(data, len);
+ }
+
+ bool isSequential() const
+ {
+ return true;
+ }
+
+private:
+ QAudioOutputBuffer* m_audioBuffer;
+};
+
+
+QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray& device, const QAudioFormat& format):
+ audioFormat(format)
+{
+ QDataStream ds(device);
+ quint32 did, mode;
+
+ ds >> did >> mode;
+
+ if (QAudio::Mode(mode) == QAudio::AudioInput)
+ errorCode = QAudio::OpenError;
+ else {
+ isOpen = false;
+ audioDeviceId = AudioDeviceID(did);
+ audioUnit = 0;
+ audioIO = 0;
+ startTime = 0;
+ totalFrames = 0;
+ audioBuffer = 0;
+ internalBufferSize = default_buffer_size;
+ clockFrequency = AudioGetHostClockFrequency() / 1000;
+ errorCode = QAudio::NoError;
+ stateCode = QAudio::StopState;
+ audioThreadState = Stopped;
+
+ intervalTimer = new QTimer(this);
+ intervalTimer->setInterval(1000);
+ connect(intervalTimer, SIGNAL(timeout()), SIGNAL(notify()));
+ }
+}
+
+QAudioOutputPrivate::~QAudioOutputPrivate()
+{
+ close();
+}
+
+bool QAudioOutputPrivate::open()
+{
+ if (errorCode != QAudio::NoError)
+ return false;
+
+ if (isOpen)
+ return true;
+
+ ComponentDescription cd;
+ cd.componentType = kAudioUnitType_Output;
+ cd.componentSubType = kAudioUnitSubType_HALOutput;
+ cd.componentManufacturer = kAudioUnitManufacturer_Apple;
+ cd.componentFlags = 0;
+ cd.componentFlagsMask = 0;
+
+ // Open
+ Component cp = FindNextComponent(NULL, &cd);
+ if (cp == 0) {
+ qWarning() << "QAudioOutput: Failed to find HAL Output component";
+ return false;
+ }
+
+ if (OpenAComponent(cp, &audioUnit) != noErr) {
+ qWarning() << "QAudioOutput: Unable to Open Output Component";
+ return false;
+ }
+
+ // register callback
+ AURenderCallbackStruct cb;
+ cb.inputProc = renderCallback;
+ cb.inputProcRefCon = this;
+
+ if (AudioUnitSetProperty(audioUnit,
+ kAudioUnitProperty_SetRenderCallback,
+ kAudioUnitScope_Global,
+ 0,
+ &cb,
+ sizeof(cb)) != noErr) {
+ qWarning() << "QAudioOutput: Failed to set AudioUnit callback";
+ return false;
+ }
+
+ // Set Audio Device
+ if (AudioUnitSetProperty(audioUnit,
+ kAudioOutputUnitProperty_CurrentDevice,
+ kAudioUnitScope_Global,
+ 0,
+ &audioDeviceId,
+ sizeof(audioDeviceId)) != noErr) {
+ qWarning() << "QAudioOutput: Unable to use configured device";
+ return false;
+ }
+
+ // Set stream format
+ streamFormat = toAudioStreamBasicDescription(audioFormat);
+
+ UInt32 size = sizeof(deviceFormat);
+ if (AudioUnitGetProperty(audioUnit,
+ kAudioUnitProperty_StreamFormat,
+ kAudioUnitScope_Input,
+ 0,
+ &deviceFormat,
+ &size) != noErr) {
+ qWarning() << "QAudioOutput: Unable to retrieve device format";
+ return false;
+ }
+
+ if (AudioUnitSetProperty(audioUnit,
+ kAudioUnitProperty_StreamFormat,
+ kAudioUnitScope_Input,
+ 0,
+ &streamFormat,
+ sizeof(streamFormat)) != noErr) {
+ qWarning() << "QAudioOutput: Unable to Set Stream information";
+ return false;
+ }
+
+ // Allocate buffer
+ UInt32 numberOfFrames = 0;
+ size = sizeof(UInt32);
+ if (AudioUnitGetProperty(audioUnit,
+ kAudioDevicePropertyBufferFrameSize,
+ kAudioUnitScope_Global,
+ 0,
+ &numberOfFrames,
+ &size) != noErr) {
+ qWarning() << "QAudioInput: Failed to get audio period size";
+ return false;
+ }
+
+ periodSizeBytes = (numberOfFrames * streamFormat.mSampleRate / deviceFormat.mSampleRate) *
+ streamFormat.mBytesPerFrame;
+ if (internalBufferSize < periodSizeBytes * 2)
+ internalBufferSize = periodSizeBytes * 2;
+ else
+ internalBufferSize -= internalBufferSize % streamFormat.mBytesPerFrame;
+
+ audioBuffer = new QAudioOutputBuffer(internalBufferSize, periodSizeBytes, audioFormat);
+ connect(audioBuffer, SIGNAL(readyRead()), SLOT(inputReady())); // Pull
+
+ audioIO = new MacOutputDevice(audioBuffer, this);
+
+ // Init
+ if (AudioUnitInitialize(audioUnit)) {
+ qWarning() << "QAudioOutput: Failed to initialize AudioUnit";
+ return false;
+ }
+
+ isOpen = true;
+
+ return true;
+}
+
+void QAudioOutputPrivate::close()
+{
+ if (audioUnit != 0) {
+ AudioOutputUnitStop(audioUnit);
+ AudioUnitUninitialize(audioUnit);
+ CloseComponent(audioUnit);
+ }
+
+ delete audioBuffer;
+}
+
+QAudioFormat QAudioOutputPrivate::format() const
+{
+ return audioFormat;
+}
+
+QIODevice* QAudioOutputPrivate::start(QIODevice* device)
+{
+ QIODevice* op = device;
+
+ if (!open()) {
+ stateCode = QAudio::StopState;
+ errorCode = QAudio::OpenError;
+ return audioIO;
+ }
+
+ reset();
+ audioBuffer->reset();
+ audioBuffer->setPrefetchDevice(op);
+
+ if (op == 0) {
+ op = audioIO;
+ stateCode = QAudio::IdleState;
+ }
+ else
+ stateCode = QAudio::ActiveState;
+
+ // Start
+ errorCode = QAudio::NoError;
+ totalFrames = 0;
+ startTime = AudioGetCurrentHostTime();
+
+ if (stateCode == QAudio::ActiveState)
+ audioThreadStart();
+
+ return op;
+}
+
+void QAudioOutputPrivate::stop()
+{
+ QMutexLocker lock(&mutex);
+ if (stateCode != QAudio::StopState) {
+ audioThreadDrain();
+
+ stateCode = QAudio::StopState;
+ errorCode = QAudio::NoError;
+ QMetaObject::invokeMethod(this, "stateChanged", Qt::QueuedConnection, Q_ARG(QAudio::State, stateCode));
+ }
+}
+
+void QAudioOutputPrivate::reset()
+{
+ QMutexLocker lock(&mutex);
+ if (stateCode != QAudio::StopState) {
+ audioThreadStop();
+
+ stateCode = QAudio::StopState;
+ errorCode = QAudio::NoError;
+ QMetaObject::invokeMethod(this, "stateChanged", Qt::QueuedConnection, Q_ARG(QAudio::State, stateCode));
+ }
+}
+
+void QAudioOutputPrivate::suspend()
+{
+ QMutexLocker lock(&mutex);
+ if (stateCode == QAudio::ActiveState || stateCode == QAudio::IdleState) {
+ audioThreadStop();
+
+ stateCode = QAudio::SuspendState;
+ errorCode = QAudio::NoError;
+ QMetaObject::invokeMethod(this, "stateChanged", Qt::QueuedConnection, Q_ARG(QAudio::State, stateCode));
+ }
+}
+
+void QAudioOutputPrivate::resume()
+{
+ QMutexLocker lock(&mutex);
+ if (stateCode == QAudio::SuspendState) {
+ audioThreadStart();
+
+ stateCode = QAudio::ActiveState;
+ errorCode = QAudio::NoError;
+ QMetaObject::invokeMethod(this, "stateChanged", Qt::QueuedConnection, Q_ARG(QAudio::State, stateCode));
+ }
+}
+
+int QAudioOutputPrivate::bytesFree() const
+{
+ return audioBuffer->available();
+}
+
+int QAudioOutputPrivate::periodSize() const
+{
+ return periodSizeBytes;
+}
+
+void QAudioOutputPrivate::setBufferSize(int bs)
+{
+ if (stateCode == QAudio::StopState)
+ internalBufferSize = bs;
+}
+
+int QAudioOutputPrivate::bufferSize() const
+{
+ return internalBufferSize;
+}
+
+void QAudioOutputPrivate::setNotifyInterval(int milliSeconds)
+{
+ intervalTimer->setInterval(milliSeconds);
+}
+
+int QAudioOutputPrivate::notifyInterval() const
+{
+ return intervalTimer->interval();
+}
+
+qint64 QAudioOutputPrivate::totalTime() const
+{
+ return totalFrames * 1000000 / audioFormat.frequency();
+}
+
+qint64 QAudioOutputPrivate::clock() const
+{
+ return (AudioGetCurrentHostTime() - startTime) / (clockFrequency / 1000);
+}
+
+QAudio::Error QAudioOutputPrivate::error() const
+{
+ return errorCode;
+}
+
+QAudio::State QAudioOutputPrivate::state() const
+{
+ return stateCode;
+}
+
+void QAudioOutputPrivate::audioThreadStart()
+{
+ startTimers();
+ audioThreadState = Running;
+ AudioOutputUnitStart(audioUnit);
+}
+
+void QAudioOutputPrivate::audioThreadStop()
+{
+ stopTimers();
+ if (audioThreadState.testAndSetAcquire(Running, Stopped))
+ threadFinished.wait(&mutex);
+}
+
+void QAudioOutputPrivate::audioThreadDrain()
+{
+ stopTimers();
+ if (audioThreadState.testAndSetAcquire(Running, Draining))
+ threadFinished.wait(&mutex);
+}
+
+void QAudioOutputPrivate::audioDeviceStop()
+{
+ AudioOutputUnitStop(audioUnit);
+ audioThreadState = Stopped;
+ threadFinished.wakeOne();
+}
+
+void QAudioOutputPrivate::audioDeviceIdle()
+{
+ QMutexLocker lock(&mutex);
+ if (stateCode == QAudio::ActiveState) {
+ audioDeviceStop();
+
+ errorCode = QAudio::UnderrunError;
+ stateCode = QAudio::IdleState;
+ QMetaObject::invokeMethod(this, "deviceStopped", Qt::QueuedConnection);
+ }
+}
+
+void QAudioOutputPrivate::audioDeviceError()
+{
+ QMutexLocker lock(&mutex);
+ if (stateCode == QAudio::ActiveState) {
+ audioDeviceStop();
+
+ errorCode = QAudio::IOError;
+ stateCode = QAudio::StopState;
+ QMetaObject::invokeMethod(this, "deviceStopped", Qt::QueuedConnection);
+ }
+}
+
+void QAudioOutputPrivate::startTimers()
+{
+ audioBuffer->startFillTimer();
+ intervalTimer->start();
+}
+
+void QAudioOutputPrivate::stopTimers()
+{
+ audioBuffer->stopFillTimer();
+ intervalTimer->stop();
+}
+
+
+void QAudioOutputPrivate::deviceStopped()
+{
+ intervalTimer->stop();
+ emit stateChanged(stateCode);
+}
+
+void QAudioOutputPrivate::inputReady()
+{
+ QMutexLocker lock(&mutex);
+ if (stateCode == QAudio::IdleState) {
+ audioThreadStart();
+
+ stateCode = QAudio::ActiveState;
+ errorCode = QAudio::NoError;
+
+ QMetaObject::invokeMethod(this, "stateChanged", Qt::QueuedConnection, Q_ARG(QAudio::State, stateCode));
+ }
+}
+
+
+OSStatus QAudioOutputPrivate::renderCallback(void* inRefCon,
+ AudioUnitRenderActionFlags* ioActionFlags,
+ const AudioTimeStamp* inTimeStamp,
+ UInt32 inBusNumber,
+ UInt32 inNumberFrames,
+ AudioBufferList* ioData)
+{
+ Q_UNUSED(ioActionFlags)
+ Q_UNUSED(inTimeStamp)
+ Q_UNUSED(inBusNumber)
+ Q_UNUSED(inNumberFrames)
+
+ QAudioOutputPrivate* d = static_cast<QAudioOutputPrivate*>(inRefCon);
+
+ const int threadState = d->audioThreadState.fetchAndAddAcquire(0);
+ if (threadState == Stopped) {
+ ioData->mBuffers[0].mDataByteSize = 0;
+ d->audioDeviceStop();
+ }
+ else {
+ const UInt32 bytesPerFrame = d->streamFormat.mBytesPerFrame;
+ qint64 framesRead;
+
+ framesRead = d->audioBuffer->readFrames((char*)ioData->mBuffers[0].mData,
+ ioData->mBuffers[0].mDataByteSize / bytesPerFrame);
+
+ if (framesRead > 0) {
+ ioData->mBuffers[0].mDataByteSize = framesRead * bytesPerFrame;
+ d->totalFrames += framesRead;
+ }
+ else {
+ ioData->mBuffers[0].mDataByteSize = 0;
+ if (framesRead == 0) {
+ if (threadState == Draining)
+ d->audioDeviceStop();
+ else
+ d->audioDeviceIdle();
+ }
+ else
+ d->audioDeviceError();
+ }
+ }
+
+ return noErr;
+}
+
+
+QT_END_NAMESPACE
+
+#include "qaudiooutput_mac_p.moc"
+
diff --git a/src/multimedia/audio/qaudiooutput_mac_p.h b/src/multimedia/audio/qaudiooutput_mac_p.h
new file mode 100644
index 000000000..c85cab454
--- /dev/null
+++ b/src/multimedia/audio/qaudiooutput_mac_p.h
@@ -0,0 +1,171 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#ifndef QAUDIOOUTPUT_MAC_P_H
+#define QAUDIOOUTPUT_MAC_P_H
+
+#include <CoreServices/CoreServices.h>
+#include <CoreAudio/CoreAudio.h>
+#include <AudioUnit/AudioUnit.h>
+#include <AudioToolbox/AudioToolbox.h>
+
+#include <QtCore/qobject.h>
+#include <QtCore/qmutex.h>
+#include <QtCore/qwaitcondition.h>
+#include <QtCore/qtimer.h>
+#include <QtCore/qatomic.h>
+
+#include <QtMultimedia/qaudio.h>
+#include <QtMultimedia/qaudioformat.h>
+#include <QtMultimedia/qaudioengine.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+class QIODevice;
+
+namespace
+{
+class QAudioOutputBuffer;
+}
+
+class QAudioOutputPrivate : public QAbstractAudioOutput
+{
+ Q_OBJECT
+
+public:
+ bool isOpen;
+ int internalBufferSize;
+ int periodSizeBytes;
+ qint64 totalFrames;
+ QAudioFormat audioFormat;
+ QIODevice* audioIO;
+ AudioDeviceID audioDeviceId;
+ AudioUnit audioUnit;
+ Float64 clockFrequency;
+ UInt64 startTime;
+ AudioStreamBasicDescription deviceFormat;
+ AudioStreamBasicDescription streamFormat;
+ QAudioOutputBuffer* audioBuffer;
+ QAtomicInt audioThreadState;
+ QWaitCondition threadFinished;
+ QMutex mutex;
+ QTimer* intervalTimer;
+
+ QAudio::Error errorCode;
+ QAudio::State stateCode;
+
+ QAudioOutputPrivate(const QByteArray& device, const QAudioFormat& format);
+ ~QAudioOutputPrivate();
+
+ bool open();
+ void close();
+
+ QAudioFormat format() const;
+
+ QIODevice* start(QIODevice* device);
+ 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 totalTime() const;
+ qint64 clock() const;
+
+ QAudio::Error error() const;
+ QAudio::State state() const;
+
+ void audioThreadStart();
+ void audioThreadStop();
+ void audioThreadDrain();
+
+ void audioDeviceStop();
+ void audioDeviceIdle();
+ void audioDeviceError();
+
+ void startTimers();
+ void stopTimers();
+
+signals:
+ void stateChanged(QAudio::State);
+ void notify();
+
+private slots:
+ void deviceStopped();
+ void inputReady();
+
+private:
+ enum { Running, Draining, Stopped };
+
+ static OSStatus renderCallback(void* inRefCon,
+ AudioUnitRenderActionFlags* ioActionFlags,
+ const AudioTimeStamp* inTimeStamp,
+ UInt32 inBusNumber,
+ UInt32 inNumberFrames,
+ AudioBufferList* ioData);
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp
new file mode 100644
index 000000000..dbf0a66a8
--- /dev/null
+++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp
@@ -0,0 +1,504 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qaudiooutput_win32_p.h"
+
+//#define DEBUG_AUDIO 1
+
+static CRITICAL_SECTION waveOutCriticalSection;
+
+QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray &device, const QAudioFormat& audioFormat):
+ settings(audioFormat)
+{
+ bytesAvailable = 0;
+ buffer_size = 0;
+ period_size = 0;
+ m_device = device;
+ totalTimeValue = 0;
+ intervalTime = 1000;
+ audioBuffer = 0;
+ errorState = QAudio::NoError;
+ deviceState = QAudio::StopState;
+ audioSource = 0;
+ pullMode = true;
+ InitializeCriticalSection(&waveOutCriticalSection);
+}
+
+QAudioOutputPrivate::~QAudioOutputPrivate()
+{
+ close();
+ DeleteCriticalSection(&waveOutCriticalSection);
+}
+
+void CALLBACK QAudioOutputPrivate::waveOutProc( HWAVEOUT hWaveOut, UINT uMsg,
+ DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 )
+{
+ Q_UNUSED(dwParam1)
+ Q_UNUSED(dwParam2)
+ Q_UNUSED(hWaveOut)
+
+ QAudioOutputPrivate* qAudio;
+ qAudio = (QAudioOutputPrivate*)(dwInstance);
+ if(!qAudio)
+ return;
+
+ switch(uMsg) {
+ case WOM_OPEN:
+ qAudio->feedback();
+ break;
+ case WOM_CLOSE:
+ return;
+ case WOM_DONE:
+ EnterCriticalSection(&waveOutCriticalSection);
+ qAudio->waveFreeBlockCount++;
+ if(qAudio->waveFreeBlockCount >= qAudio->buffer_size/qAudio->period_size)
+ qAudio->waveFreeBlockCount = qAudio->buffer_size/qAudio->period_size;
+ LeaveCriticalSection(&waveOutCriticalSection);
+ qAudio->feedback();
+ break;
+ default:
+ return;
+ }
+}
+
+WAVEHDR* QAudioOutputPrivate::allocateBlocks(int size, int count)
+{
+ int i;
+ unsigned char* buffer;
+ WAVEHDR* blocks;
+ DWORD totalBufferSize = (size + sizeof(WAVEHDR))*count;
+
+ if((buffer=(unsigned char*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,
+ totalBufferSize)) == 0) {
+ qWarning("QAudioOutput: Memory allocation error");
+ return 0;
+ }
+ blocks = (WAVEHDR*)buffer;
+ buffer += sizeof(WAVEHDR)*count;
+ for(i = 0; i < count; i++) {
+ blocks[i].dwBufferLength = size;
+ blocks[i].lpData = (LPSTR)buffer;
+ buffer += size;
+ }
+ return blocks;
+}
+
+void QAudioOutputPrivate::freeBlocks(WAVEHDR* blockArray)
+{
+ HeapFree(GetProcessHeap(), 0, blockArray);
+}
+
+QAudioFormat QAudioOutputPrivate::format() const
+{
+ return settings;
+}
+
+QIODevice* QAudioOutputPrivate::start(QIODevice* device)
+{
+ if(deviceState != QAudio::StopState)
+ close();
+
+ if(!pullMode && audioSource) {
+ delete audioSource;
+ }
+
+ if(device) {
+ //set to pull mode
+ pullMode = true;
+ audioSource = device;
+ deviceState = QAudio::ActiveState;
+ } else {
+ //set to push mode
+ pullMode = false;
+ audioSource = new OutputPrivate(this);
+ audioSource->open(QIODevice::WriteOnly|QIODevice::Unbuffered);
+ deviceState = QAudio::IdleState;
+ }
+
+ if( !open() )
+ return 0;
+
+ emit stateChanged(deviceState);
+
+ return audioSource;
+}
+
+void QAudioOutputPrivate::stop()
+{
+ if(deviceState == QAudio::StopState)
+ return;
+ deviceState = QAudio::StopState;
+ close();
+ if(!pullMode && audioSource) {
+ delete audioSource;
+ audioSource = 0;
+ }
+ emit stateChanged(deviceState);
+}
+
+bool QAudioOutputPrivate::open()
+{
+#ifdef DEBUG_AUDIO
+ QTime now(QTime::currentTime());
+ qDebug()<<now.second()<<"s "<<now.msec()<<"ms :open()";
+#endif
+ if(buffer_size == 0) {
+ // Default buffer size, 200ms, default period size is 40ms
+ buffer_size = settings.frequency()*settings.channels()*(settings.sampleSize()/8)*0.2;
+ period_size = buffer_size/5;
+ } else {
+ period_size = buffer_size/5;
+ }
+ waveBlocks = allocateBlocks(period_size, buffer_size/period_size);
+ waveFreeBlockCount = buffer_size/period_size;
+ waveCurrentBlock = 0;
+
+ if(audioBuffer == 0)
+ audioBuffer = new char[buffer_size];
+
+ timeStamp.restart();
+
+ wfx.nSamplesPerSec = settings.frequency();
+ wfx.wBitsPerSample = settings.sampleSize();
+ wfx.nChannels = settings.channels();
+ wfx.cbSize = 0;
+
+ wfx.wFormatTag = WAVE_FORMAT_PCM;
+ wfx.nBlockAlign = (wfx.wBitsPerSample >> 3) * wfx.nChannels;
+ wfx.nAvgBytesPerSec = wfx.nBlockAlign * wfx.nSamplesPerSec;
+
+ UINT_PTR devId = WAVE_MAPPER;
+
+ WAVEOUTCAPS woc;
+ unsigned long iNumDevs,ii;
+ iNumDevs = waveOutGetNumDevs();
+ for(ii=0;ii<iNumDevs;ii++) {
+ if(waveOutGetDevCaps(ii, &woc, sizeof(WAVEOUTCAPS))
+ == MMSYSERR_NOERROR) {
+ QString tmp;
+ tmp = QString::fromUtf16((const unsigned short*)woc.szPname);
+ if(tmp.compare(tr(m_device)) == 0) {
+ devId = ii;
+ break;
+ }
+ }
+ }
+
+ if(waveOutOpen(&hWaveOut, devId, &wfx,
+ (DWORD_PTR)&waveOutProc,
+ (DWORD_PTR) this,
+ CALLBACK_FUNCTION) != MMSYSERR_NOERROR) {
+ errorState = QAudio::OpenError;
+ deviceState = QAudio::StopState;
+ emit stateChanged(deviceState);
+ qWarning("QAudioOutput: open error");
+ return false;
+ }
+
+ totalTimeValue = 0;
+ timeStampOpened.restart();
+
+ errorState = QAudio::NoError;
+ if(pullMode) {
+ deviceState = QAudio::ActiveState;
+ QTimer::singleShot(10, this, SLOT(feedback()));
+ } else
+ deviceState = QAudio::IdleState;
+
+ return true;
+}
+
+void QAudioOutputPrivate::close()
+{
+ if(deviceState == QAudio::StopState)
+ return;
+
+ deviceState = QAudio::StopState;
+ int delay = (buffer_size-bytesFree())*1000/(settings.frequency()
+ *settings.channels()*(settings.sampleSize()/8));
+ waveOutReset(hWaveOut);
+ Sleep(delay+10);
+
+ freeBlocks(waveBlocks);
+ waveOutClose(hWaveOut);
+ delete [] audioBuffer;
+ audioBuffer = 0;
+ buffer_size = 0;
+}
+
+int QAudioOutputPrivate::bytesFree() const
+{
+ int buf;
+ buf = waveFreeBlockCount*period_size;
+ return buf;
+}
+
+int QAudioOutputPrivate::periodSize() const
+{
+ return period_size;
+}
+
+void QAudioOutputPrivate::setBufferSize(int value)
+{
+ if(deviceState == QAudio::StopState)
+ buffer_size = value;
+}
+
+int QAudioOutputPrivate::bufferSize() const
+{
+ return buffer_size;
+}
+
+void QAudioOutputPrivate::setNotifyInterval(int ms)
+{
+ intervalTime = ms;
+}
+
+int QAudioOutputPrivate::notifyInterval() const
+{
+ return intervalTime;
+}
+
+qint64 QAudioOutputPrivate::totalTime() const
+{
+ return totalTimeValue;
+}
+
+qint64 QAudioOutputPrivate::write( const char *data, qint64 len )
+{
+ // Write out some audio data
+
+ char* p = (char*)data;
+ int l = (int)len;
+
+ WAVEHDR* current;
+ int remain;
+ current = &waveBlocks[waveCurrentBlock];
+ while(l > 0) {
+ if(waveFreeBlockCount==0)
+ break;
+
+ if(current->dwFlags & WHDR_PREPARED)
+ waveOutUnprepareHeader(hWaveOut, current, sizeof(WAVEHDR));
+
+ if(l < period_size)
+ remain = l;
+ else
+ remain = period_size;
+ memcpy(current->lpData, p, remain);
+
+ l -= remain;
+ p += remain;
+ current->dwBufferLength = remain;
+ waveOutPrepareHeader(hWaveOut, current, sizeof(WAVEHDR));
+ waveOutWrite(hWaveOut, current, sizeof(WAVEHDR));
+
+ EnterCriticalSection(&waveOutCriticalSection);
+ waveFreeBlockCount--;
+ LeaveCriticalSection(&waveOutCriticalSection);
+#ifdef DEBUG_AUDIO
+ qDebug("write out l=%d, waveFreeBlockCount=%d",
+ current->dwBufferLength,waveFreeBlockCount);
+#endif
+ totalTimeValue += current->dwBufferLength
+ /(settings.channels()*(settings.sampleSize()/8))
+ *1000000/settings.frequency();;
+ waveCurrentBlock++;
+ waveCurrentBlock %= buffer_size/period_size;
+ current = &waveBlocks[waveCurrentBlock];
+ current->dwUser = 0;
+ }
+ return (len-l);
+}
+
+void QAudioOutputPrivate::resume()
+{
+ if(deviceState == QAudio::SuspendState) {
+ deviceState = QAudio::ActiveState;
+ errorState = QAudio::NoError;
+ waveOutRestart(hWaveOut);
+ QTimer::singleShot(10, this, SLOT(feedback()));
+ emit stateChanged(deviceState);
+ }
+}
+
+void QAudioOutputPrivate::suspend()
+{
+ if(deviceState == QAudio::ActiveState) {
+ waveOutPause(hWaveOut);
+ deviceState = QAudio::SuspendState;
+ errorState = QAudio::NoError;
+ emit stateChanged(deviceState);
+ }
+}
+
+void QAudioOutputPrivate::feedback()
+{
+#ifdef DEBUG_AUDIO
+ QTime now(QTime::currentTime());
+ qDebug()<<now.second()<<"s "<<now.msec()<<"ms :feedback()";
+#endif
+ bytesAvailable = bytesFree();
+
+ if(!(deviceState==QAudio::StopState||deviceState==QAudio::SuspendState)) {
+ if(bytesAvailable >= period_size)
+ QMetaObject::invokeMethod(this, "deviceReady", Qt::QueuedConnection);
+ }
+}
+
+bool QAudioOutputPrivate::deviceReady()
+{
+ if(pullMode) {
+ int i = 0;
+ int chunks = bytesAvailable/period_size;
+#ifdef DEBUG_AUDIO
+ qDebug()<<"deviceReady() avail="<<bytesAvailable<<" bytes, period size="<<period_size<<" bytes";
+ qDebug()<<"deviceReady() no. of chunks that can fit ="<<chunks<<", chunks in bytes ="<<chunks*period_size;
+#endif
+ bool startup = false;
+ if(totalTimeValue == 0)
+ startup = true;
+
+ if(startup)
+ waveOutPause(hWaveOut);
+ int input = period_size*chunks;
+ int l = audioSource->read(audioBuffer,input);
+ if(l > 0) {
+ int out= write(audioBuffer,l);
+ if(out > 0)
+ deviceState = QAudio::ActiveState;
+ if(startup)
+ waveOutRestart(hWaveOut);
+ } else if(l == 0) {
+ bytesAvailable = bytesFree();
+ if(waveFreeBlockCount == buffer_size/period_size) {
+ errorState = QAudio::UnderrunError;
+ deviceState = QAudio::IdleState;
+ emit stateChanged(deviceState);
+ }
+
+ } else if(i < 0) {
+ bytesAvailable = bytesFree();
+ errorState = QAudio::IOError;
+ }
+ }
+ if(deviceState != QAudio::ActiveState)
+ return true;
+
+ if(timeStamp.elapsed() > intervalTime && intervalTime > 50) {
+ emit notify();
+ timeStamp.restart();
+ }
+
+ return true;
+}
+
+qint64 QAudioOutputPrivate::clock() const
+{
+ if(deviceState != QAudio::ActiveState)
+ return 0;
+
+ return timeStampOpened.elapsed();
+}
+
+QAudio::Error QAudioOutputPrivate::error() const
+{
+ return errorState;
+}
+
+QAudio::State QAudioOutputPrivate::state() const
+{
+ return deviceState;
+}
+
+void QAudioOutputPrivate::reset()
+{
+ close();
+}
+
+OutputPrivate::OutputPrivate(QAudioOutputPrivate* audio)
+{
+ audioDevice = qobject_cast<QAudioOutputPrivate*>(audio);
+}
+
+OutputPrivate::~OutputPrivate() {}
+
+qint64 OutputPrivate::readData( char* data, qint64 len)
+{
+ Q_UNUSED(data)
+ Q_UNUSED(len)
+
+ return 0;
+}
+
+qint64 OutputPrivate::writeData(const char* data, qint64 len)
+{
+ int retry = 0;
+ qint64 written = 0;
+
+ if((audioDevice->deviceState == QAudio::ActiveState)
+ ||(audioDevice->deviceState == QAudio::IdleState)) {
+ qint64 l = len;
+ while(written < l) {
+ int chunk = audioDevice->write(data+written,(l-written));
+ if(chunk <= 0)
+ retry++;
+ else
+ written+=chunk;
+
+ if(retry > 10)
+ return written;
+ }
+ audioDevice->deviceState = QAudio::ActiveState;
+ }
+ return written;
+}
diff --git a/src/multimedia/audio/qaudiooutput_win32_p.h b/src/multimedia/audio/qaudiooutput_win32_p.h
new file mode 100644
index 000000000..50a39924e
--- /dev/null
+++ b/src/multimedia/audio/qaudiooutput_win32_p.h
@@ -0,0 +1,152 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#ifndef QAUDIOOUTPUTWIN_H
+#define QAUDIOOUTPUTWIN_H
+
+#include <windows.h>
+#include <mmsystem.h>
+
+#include <QtCore/qdebug.h>
+#include <QtCore/qtimer.h>
+#include <QtCore/qstring.h>
+#include <QtCore/qstringlist.h>
+#include <QtCore/qdatetime.h>
+
+#include <QtMultimedia/qaudio.h>
+#include <QtMultimedia/qaudiodeviceinfo.h>
+#include <QtMultimedia/qaudioengine.h>
+
+
+class QAudioOutputPrivate : public QAbstractAudioOutput
+{
+ Q_OBJECT
+public:
+ QAudioOutputPrivate(const QByteArray &device, const QAudioFormat& audioFormat);
+ ~QAudioOutputPrivate();
+
+ qint64 write( const char *data, qint64 len );
+
+ QAudioFormat format() const;
+ 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 totalTime() const;
+ qint64 clock() const;
+ QAudio::Error error() const;
+ QAudio::State state() const;
+
+ QIODevice* audioSource;
+ QAudioFormat settings;
+ QAudio::Error errorState;
+ QAudio::State deviceState;
+
+private slots:
+ void feedback();
+ bool deviceReady();
+
+signals:
+ void stateChanged(QAudio::State);
+ void notify();
+
+private:
+ QByteArray m_device;
+ bool resuming;
+ int bytesAvailable;
+ QTime timeStamp;
+ QTime timeStampOpened;
+ qint32 buffer_size;
+ qint32 period_size;
+ qint64 totalTimeValue;
+ bool pullMode;
+ int intervalTime;
+ static void CALLBACK waveOutProc( HWAVEOUT hWaveOut, UINT uMsg,
+ DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 );
+
+ WAVEHDR* allocateBlocks(int size, int count);
+ void freeBlocks(WAVEHDR* blockArray);
+ bool open();
+ void close();
+
+ WAVEFORMATEX wfx;
+ HWAVEOUT hWaveOut;
+ MMRESULT result;
+ WAVEHDR header;
+ WAVEHDR* waveBlocks;
+ volatile int waveFreeBlockCount;
+ int waveCurrentBlock;
+ char* audioBuffer;
+};
+
+class OutputPrivate : public QIODevice
+{
+ Q_OBJECT
+public:
+ OutputPrivate(QAudioOutputPrivate* audio);
+ ~OutputPrivate();
+
+ qint64 readData( char* data, qint64 len);
+ qint64 writeData(const char* data, qint64 len);
+
+private:
+ QAudioOutputPrivate *audioDevice;
+};
+
+#endif
diff --git a/src/multimedia/multimedia.pro b/src/multimedia/multimedia.pro
new file mode 100644
index 000000000..7d38afa52
--- /dev/null
+++ b/src/multimedia/multimedia.pro
@@ -0,0 +1,11 @@
+TARGET = QtMultimedia
+QPRO_PWD = $$PWD
+QT = core
+DEFINES += QT_BUILD_MULTIMEDIA_LIB
+
+win32-msvc*:QMAKE_LIBS += $$QMAKE_LIBS_CORE
+
+unix:QMAKE_PKGCONFIG_REQUIRES = QtCore
+
+include(../qbase.pri)
+include(audio/audio.pri)
diff --git a/src/network/access/qhttp.cpp b/src/network/access/qhttp.cpp
index faa239870..4c0684818 100644
--- a/src/network/access/qhttp.cpp
+++ b/src/network/access/qhttp.cpp
@@ -1597,11 +1597,11 @@ QHttp::~QHttp()
This enum is used to specify the mode of connection to use:
- \value ConnectionModeHttp The connection is a regular Http connection to the server
- \value ConnectionModeHttps The Https protocol is used and the connection is encrypted using SSL.
+ \value ConnectionModeHttp The connection is a regular HTTP connection to the server
+ \value ConnectionModeHttps The HTTPS protocol is used and the connection is encrypted using SSL.
- When using the Https mode, care should be taken to connect to the sslErrors signal, and
- handle possible Ssl errors.
+ When using the HTTPS mode, care should be taken to connect to the sslErrors signal, and
+ handle possible SSL errors.
\sa QSslSocket
*/
@@ -2039,7 +2039,7 @@ int QHttp::setHost(const QString &hostName, quint16 port)
port \a port using the connection mode \a mode.
If port is 0, it will use the default port for the \a mode used
- (80 for Http and 443 fopr Https).
+ (80 for HTTP and 443 for HTTPS).
The function does not block; instead, it returns immediately. The request
is scheduled, and its execution is performed asynchronously. The
diff --git a/src/network/access/qhttpnetworkheader.cpp b/src/network/access/qhttpnetworkheader.cpp
index 5af9764e0..88cc48443 100644
--- a/src/network/access/qhttpnetworkheader.cpp
+++ b/src/network/access/qhttpnetworkheader.cpp
@@ -41,6 +41,7 @@
#include "qhttpnetworkheader_p.h"
+#ifndef QT_NO_HTTP
QT_BEGIN_NAMESPACE
@@ -121,3 +122,5 @@ bool QHttpNetworkHeaderPrivate::operator==(const QHttpNetworkHeaderPrivate &othe
QT_END_NAMESPACE
+
+#endif
diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h
index fe4979962..819aeb516 100644
--- a/src/network/access/qhttpnetworkreply_p.h
+++ b/src/network/access/qhttpnetworkreply_p.h
@@ -52,6 +52,7 @@
//
// We mean it.
//
+#include <qplatformdefs.h>
#ifndef QT_NO_HTTP
#ifndef QT_NO_COMPRESS
diff --git a/src/network/access/qhttpnetworkrequest.cpp b/src/network/access/qhttpnetworkrequest.cpp
index 0f330afdb..b1db0b782 100644
--- a/src/network/access/qhttpnetworkrequest.cpp
+++ b/src/network/access/qhttpnetworkrequest.cpp
@@ -42,6 +42,8 @@
#include "qhttpnetworkrequest_p.h"
#include "private/qnoncontiguousbytedevice_p.h"
+#ifndef QT_NO_HTTP
+
QT_BEGIN_NAMESPACE
QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(QHttpNetworkRequest::Operation op,
@@ -260,3 +262,5 @@ int QHttpNetworkRequest::minorVersion() const
QT_END_NAMESPACE
+#endif
+
diff --git a/src/network/access/qnetworkcookie.h b/src/network/access/qnetworkcookie.h
index ef309a8d6..4bc3f3fac 100644
--- a/src/network/access/qnetworkcookie.h
+++ b/src/network/access/qnetworkcookie.h
@@ -106,9 +106,6 @@ private:
};
Q_DECLARE_TYPEINFO(QNetworkCookie, Q_MOVABLE_TYPE);
-// ### Qt5 remove this include
-#include "qnetworkcookiejar.h"
-
#ifndef QT_NO_DEBUG_STREAM
class QDebug;
Q_NETWORK_EXPORT QDebug operator<<(QDebug, const QNetworkCookie &);
@@ -116,6 +113,9 @@ Q_NETWORK_EXPORT QDebug operator<<(QDebug, const QNetworkCookie &);
QT_END_NAMESPACE
+// ### Qt5 remove this include
+#include "qnetworkcookiejar.h"
+
Q_DECLARE_METATYPE(QNetworkCookie)
Q_DECLARE_METATYPE(QList<QNetworkCookie>)
diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp
index 90fd9a588..6f2024fa1 100644
--- a/src/openvg/qpixmapdata_vg.cpp
+++ b/src/openvg/qpixmapdata_vg.cpp
@@ -341,4 +341,29 @@ QImage::Format QVGPixmapData::sourceFormat() const
return QImage::Format_ARGB32_Premultiplied;
}
+/*
+ \internal
+
+ Returns the VGImage that is storing the contents of \a pixmap.
+ Returns VG_INVALID_HANDLE if \a pixmap is not owned by the OpenVG
+ graphics system or \a pixmap is invalid.
+
+ This function is typically used to access the backing store
+ for a pixmap when executing raw OpenVG calls. It must only
+ be used when a QPainter is active and the OpenVG paint engine
+ is in use by the QPainter.
+
+ \sa {QtOpenVG Module}
+*/
+Q_OPENVG_EXPORT VGImage qPixmapToVGImage(const QPixmap& pixmap)
+{
+ QPixmapData *pd = pixmap.pixmapData();
+ if (pd->classId() == QPixmapData::OpenVGClass) {
+ QVGPixmapData *vgpd = static_cast<QVGPixmapData *>(pd);
+ if (vgpd->isValid())
+ return vgpd->toVGImage();
+ }
+ return VG_INVALID_HANDLE;
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/audio/audio.pro b/src/plugins/audio/audio.pro
new file mode 100644
index 000000000..e93b36968
--- /dev/null
+++ b/src/plugins/audio/audio.pro
@@ -0,0 +1,3 @@
+TEMPLATE = subdirs
+
+#SUBDIRS += ossaudio
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
index cf4edf1b1..45669e41e 100644
--- a/src/plugins/plugins.pro
+++ b/src/plugins/plugins.pro
@@ -10,3 +10,4 @@ unix {
embedded:SUBDIRS *= gfxdrivers decorations mousedrivers kbddrivers
!win32:!embedded:!mac:SUBDIRS *= inputmethods
contains(QT_CONFIG, phonon): SUBDIRS *= phonon
+contains(QT_CONFIG, multimedia): SUBDIRS *= audio
diff --git a/src/qbase.pri b/src/qbase.pri
index 0ab04e61f..9e2d26ffa 100644
--- a/src/qbase.pri
+++ b/src/qbase.pri
@@ -13,7 +13,7 @@ mac:!contains(QMAKE_EXT_C, .mm):QMAKE_EXT_C += .mm
#load up the headers info
CONFIG += qt_install_headers
HEADERS_PRI = $$QT_BUILD_TREE/include/$$TARGET/headers.pri
-include($$HEADERS_PRI)|clear(HEADERS_PRI)
+include($$HEADERS_PRI, "", true)|clear(HEADERS_PRI)
#version overriding
win32 {
diff --git a/src/qt3support/network/q3http.cpp b/src/qt3support/network/q3http.cpp
index dba4e88ce..9b5c33f82 100644
--- a/src/qt3support/network/q3http.cpp
+++ b/src/qt3support/network/q3http.cpp
@@ -42,7 +42,7 @@
#include <qplatformdefs.h>
#include "q3http.h"
-#ifndef QT_NO_NETWORKPROTOCOL_HTTP
+#ifndef QT_NO_HTTP
#include "q3socket.h"
#include "qtextstream.h"
diff --git a/src/qt3support/network/q3http.h b/src/qt3support/network/q3http.h
index 93ab00e7f..5311764d7 100644
--- a/src/qt3support/network/q3http.h
+++ b/src/qt3support/network/q3http.h
@@ -52,8 +52,7 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Qt3Support)
-
-#ifndef QT_NO_NETWORKPROTOCOL_HTTP
+#ifndef QT_NO_HTTP
class Q3Socket;
class QTimerEvent;
@@ -269,7 +268,7 @@ private:
friend class Q3HttpPGHRequest;
};
-#endif // QT_NO_NETWORKPROTOCOL_HTTP
+#endif // QT_NO_HTTP
QT_END_NAMESPACE
diff --git a/src/qt3support/network/q3network.cpp b/src/qt3support/network/q3network.cpp
index 3a6a6f034..1f918d138 100644
--- a/src/qt3support/network/q3network.cpp
+++ b/src/qt3support/network/q3network.cpp
@@ -63,7 +63,7 @@ void q3InitNetworkProtocols()
#ifndef QT_NO_NETWORKPROTOCOL_FTP
Q3NetworkProtocol::registerNetworkProtocol( QLatin1String("ftp"), new Q3NetworkProtocolFactory< Q3Ftp > );
#endif
-#ifndef QT_NO_NETWORKPROTOCOL_HTTP
+#ifndef QT_NO_HTTP
Q3NetworkProtocol::registerNetworkProtocol( QLatin1String("http"), new Q3NetworkProtocolFactory< Q3Http > );
#endif
}
diff --git a/src/script/qscriptable.cpp b/src/script/qscriptable.cpp
index 5da9e9514..94468de2c 100644
--- a/src/script/qscriptable.cpp
+++ b/src/script/qscriptable.cpp
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QT_NO_QOBJECT
-
#include "qscriptable.h"
+#ifndef QT_NO_QOBJECT
+
#ifndef QT_NO_SCRIPT
#include "qscriptable_p.h"
diff --git a/src/script/qscriptable_p.h b/src/script/qscriptable_p.h
index 8ea65ed00..1d297d960 100644
--- a/src/script/qscriptable_p.h
+++ b/src/script/qscriptable_p.h
@@ -55,7 +55,7 @@
// We mean it.
//
-#if !defined(QT_NO_QOBJECT) && !defined(QT_NO_SCRIPT)
+#ifndef QT_NO_SCRIPT
QT_BEGIN_NAMESPACE
@@ -79,6 +79,6 @@ public:
QT_END_NAMESPACE
-#endif // QT_NO_QOBJECT && QT_NO_SCRIPT
+#endif // QT_NO_SCRIPT
#endif
diff --git a/src/script/qscriptclassdata.cpp b/src/script/qscriptclassdata.cpp
index 08e7220f7..576a51990 100644
--- a/src/script/qscriptclassdata.cpp
+++ b/src/script/qscriptclassdata.cpp
@@ -114,4 +114,4 @@ QScriptClassDataIterator::~QScriptClassDataIterator()
QT_END_NAMESPACE
-#endif
+#endif // QT_NO_SCRIPT
diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp
index c61c526d9..fccc62232 100644
--- a/src/sql/drivers/psql/qsql_psql.cpp
+++ b/src/sql/drivers/psql/qsql_psql.cpp
@@ -158,7 +158,7 @@ void QPSQLDriverPrivate::appendTables(QStringList &tl, QSqlQuery &t, QChar type)
class QPSQLResultPrivate
{
public:
- QPSQLResultPrivate(QPSQLResult *qq): q(qq), driver(0), result(0), currentSize(-1) {}
+ QPSQLResultPrivate(QPSQLResult *qq): q(qq), driver(0), result(0), currentSize(-1), preparedQueriesEnabled(false) {}
QPSQLResult *q;
const QPSQLDriverPrivate *driver;
@@ -940,7 +940,7 @@ QSqlIndex QPSQLDriver::primaryIndex(const QString& tablename) const
case QPSQLDriver::Version6:
stmt = QLatin1String("select pg_att1.attname, int(pg_att1.atttypid), pg_cl.relname "
"from pg_attribute pg_att1, pg_attribute pg_att2, pg_class pg_cl, pg_index pg_ind "
- "where lower(pg_cl.relname) = '%1_pkey' "
+ "where pg_cl.relname = '%1_pkey' "
"and pg_cl.oid = pg_ind.indexrelid "
"and pg_att2.attrelid = pg_ind.indexrelid "
"and pg_att1.attrelid = pg_ind.indrelid "
@@ -951,7 +951,7 @@ QSqlIndex QPSQLDriver::primaryIndex(const QString& tablename) const
case QPSQLDriver::Version71:
stmt = QLatin1String("select pg_att1.attname, pg_att1.atttypid::int, pg_cl.relname "
"from pg_attribute pg_att1, pg_attribute pg_att2, pg_class pg_cl, pg_index pg_ind "
- "where lower(pg_cl.relname) = '%1_pkey' "
+ "where pg_cl.relname = '%1_pkey' "
"and pg_cl.oid = pg_ind.indexrelid "
"and pg_att2.attrelid = pg_ind.indexrelid "
"and pg_att1.attrelid = pg_ind.indrelid "
@@ -1016,7 +1016,7 @@ QSqlRecord QPSQLDriver::record(const QString& tablename) const
"pg_attribute.attnotnull, pg_attribute.attlen, pg_attribute.atttypmod, "
"int(pg_attribute.attrelid), pg_attribute.attnum "
"from pg_class, pg_attribute "
- "where lower(pg_class.relname) = '%1' "
+ "where pg_class.relname = '%1' "
"and pg_attribute.attnum > 0 "
"and pg_attribute.attrelid = pg_class.oid ");
break;
@@ -1025,7 +1025,7 @@ QSqlRecord QPSQLDriver::record(const QString& tablename) const
"pg_attribute.attnotnull, pg_attribute.attlen, pg_attribute.atttypmod, "
"pg_attribute.attrelid::int, pg_attribute.attnum "
"from pg_class, pg_attribute "
- "where lower(pg_class.relname) = '%1' "
+ "where pg_class.relname = '%1' "
"and pg_attribute.attnum > 0 "
"and pg_attribute.attrelid = pg_class.oid ");
break;
@@ -1036,7 +1036,7 @@ QSqlRecord QPSQLDriver::record(const QString& tablename) const
"from pg_class, pg_attribute "
"left join pg_attrdef on (pg_attrdef.adrelid = "
"pg_attribute.attrelid and pg_attrdef.adnum = pg_attribute.attnum) "
- "where lower(pg_class.relname) = '%1' "
+ "where pg_class.relname = '%1' "
"and pg_attribute.attnum > 0 "
"and pg_attribute.attrelid = pg_class.oid "
"order by pg_attribute.attnum ");
diff --git a/src/src.pro b/src/src.pro
index 34db728c4..54ed6da98 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -22,6 +22,7 @@ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, o
contains(QT_CONFIG, openvg): SRC_SUBDIRS += src_openvg
contains(QT_CONFIG, xmlpatterns): SRC_SUBDIRS += src_xmlpatterns
contains(QT_CONFIG, phonon): SRC_SUBDIRS += src_phonon
+contains(QT_CONFIG, multimedia): SRC_SUBDIRS += src_multimedia
contains(QT_CONFIG, svg): SRC_SUBDIRS += src_svg
contains(QT_CONFIG, webkit) {
#exists($$QT_SOURCE_TREE/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro): SRC_SUBDIRS += src_javascriptcore
@@ -68,6 +69,8 @@ src_qt3support.subdir = $$QT_SOURCE_TREE/src/qt3support
src_qt3support.target = sub-qt3support
src_phonon.subdir = $$QT_SOURCE_TREE/src/phonon
src_phonon.target = sub-phonon
+src_multimedia.subdir = $$QT_SOURCE_TREE/src/multimedia
+src_multimedia.target = sub-multimedia
src_tools_uic3.subdir = $$QT_SOURCE_TREE/src/tools/uic3
src_tools_uic3.target = sub-uic3
src_activeqt.subdir = $$QT_SOURCE_TREE/src/activeqt
@@ -104,6 +107,7 @@ src_webkit.target = sub-webkit
src_testlib.depends = src_corelib
src_qt3support.depends = src_gui src_xml src_network src_sql
src_phonon.depends = src_gui
+ src_multimedia.depends = src_gui
src_tools_uic3.depends = src_qt3support src_xml
src_tools_idc.depends = src_corelib
src_tools_activeqt.depends = src_tools_idc src_gui
diff --git a/src/testlib/qabstracttestlogger.cpp b/src/testlib/qabstracttestlogger.cpp
index 6482ec9b8..6b4b375ec 100644
--- a/src/testlib/qabstracttestlogger.cpp
+++ b/src/testlib/qabstracttestlogger.cpp
@@ -43,8 +43,11 @@
#include "QtTest/private/qtestlog_p.h"
#include "QtTest/qtestassert.h"
+#include "QtCore/qbytearray.h"
+
#include <stdio.h>
#include <stdlib.h>
+#include <stdarg.h>
#ifndef Q_OS_WIN
#include <unistd.h>
@@ -106,4 +109,50 @@ void QAbstractTestLogger::stopLogging()
QTest::stream = 0;
}
+namespace QTest
+{
+
+extern void filter_unprintable(char *str);
+
+/*!
+ \fn int QTest::qt_asprintf(QTestCharBuffer *buf, const char *format, ...);
+ \internal
+ */
+int qt_asprintf(QTestCharBuffer *str, const char *format, ...)
+{
+ static const int MAXSIZE = 1024*1024*2;
+
+ Q_ASSERT(str);
+
+ int size = str->size();
+
+ va_list ap;
+ int res = 0;
+
+ for (;;) {
+ va_start(ap, format);
+ res = qvsnprintf(str->data(), size, format, ap);
+ va_end(ap);
+ str->data()[size - 1] = '\0';
+ if (res >= 0 && res < size) {
+ // We succeeded
+ break;
+ }
+ // buffer wasn't big enough, try again.
+ // Note, we're assuming that a result of -1 is always due to running out of space.
+ size *= 2;
+ if (size > MAXSIZE) {
+ break;
+ }
+ if (!str->reset(size))
+ break; // out of memory - take what we have
+ }
+
+ filter_unprintable(str->data());
+
+ return res;
+}
+
+}
+
QT_END_NAMESPACE
diff --git a/src/testlib/qabstracttestlogger_p.h b/src/testlib/qabstracttestlogger_p.h
index 588184e45..183408669 100644
--- a/src/testlib/qabstracttestlogger_p.h
+++ b/src/testlib/qabstracttestlogger_p.h
@@ -101,27 +101,26 @@ public:
struct QTestCharBuffer
{
- inline QTestCharBuffer()
- : buf(0)
- {}
+ enum { InitialSize = 512 };
- inline ~QTestCharBuffer()
+ inline QTestCharBuffer()
+ : _size(InitialSize), buf(staticBuf)
{
- delete[] buf;
- buf = 0;
+ staticBuf[0] = '\0';
}
- inline operator void*()
+ inline ~QTestCharBuffer()
{
- return buf;
+ if (buf != staticBuf)
+ qFree(buf);
}
- inline operator char*()
+ inline char *data()
{
return buf;
}
- inline operator char**()
+ inline char **buffer()
{
return &buf;
}
@@ -131,10 +130,43 @@ struct QTestCharBuffer
return buf;
}
+ inline int size() const
+ {
+ return _size;
+ }
+
+ inline bool reset(int newSize)
+ {
+ char *newBuf = 0;
+ if (buf == staticBuf) {
+ // if we point to our internal buffer, we need to malloc first
+ newBuf = reinterpret_cast<char *>(qMalloc(newSize));
+ } else {
+ // if we already malloc'ed, just realloc
+ newBuf = reinterpret_cast<char *>(qRealloc(buf, newSize));
+ }
+
+ // if the allocation went wrong (newBuf == 0), we leave the object as is
+ if (!newBuf)
+ return false;
+
+ _size = newSize;
+ buf = newBuf;
+ return true;
+ }
+
private:
+ int _size;
char* buf;
+ char staticBuf[InitialSize];
};
+namespace QTest
+{
+ int qt_asprintf(QTestCharBuffer *buf, const char *format, ...);
+}
+
+
QT_END_NAMESPACE
#endif
diff --git a/src/testlib/qbenchmark.cpp b/src/testlib/qbenchmark.cpp
index 9cdf23237..eaec02fda 100644
--- a/src/testlib/qbenchmark.cpp
+++ b/src/testlib/qbenchmark.cpp
@@ -116,7 +116,7 @@ int QBenchmarkGlobalData::adjustMedianIterationCount()
QBenchmarkTestMethodData *QBenchmarkTestMethodData::current;
QBenchmarkTestMethodData::QBenchmarkTestMethodData()
-:resultAccepted(false), iterationCount(-1)
+:resultAccepted(false), runOnce(false), iterationCount(-1)
{
}
@@ -157,6 +157,11 @@ void QBenchmarkTestMethodData::setResult(qint64 value)
if (QBenchmarkGlobalData::current->iterationCount != -1)
accepted = true;
+ if (QBenchmarkTestMethodData::current->runOnce) {
+ iterationCount = 1;
+ accepted = true;
+ }
+
// Test the result directly without calling the measurer if the minimum time
// has been specifed on the command line with -minimumvalue.
else if (QBenchmarkGlobalData::current->walltimeMinimum != -1)
@@ -174,15 +179,23 @@ void QBenchmarkTestMethodData::setResult(qint64 value)
QBenchmarkResult(QBenchmarkGlobalData::current->context, value, iterationCount);
}
-/*! \internal
+/*!
+ \class QTest::QBenchmarkIterationController
+ \internal
+
The QBenchmarkIterationController class is used by the QBENCHMARK macro to
drive the benchmarking loop. It is repsonsible for starting and stopping
the timing measurements as well as calling the result reporting functions.
*/
-QTest::QBenchmarkIterationController::QBenchmarkIterationController()
+
+/*! \internal
+*/
+QTest::QBenchmarkIterationController::QBenchmarkIterationController(RunMode runMode)
{
QTest::beginBenchmarkMeasurement();
i = 0;
+ if (runMode == RunOnce)
+ QBenchmarkTestMethodData::current->runOnce = true;
}
/*! \internal
*/
@@ -195,6 +208,8 @@ QTest::QBenchmarkIterationController::~QBenchmarkIterationController()
*/
bool QTest::QBenchmarkIterationController::isDone()
{
+ if (QBenchmarkTestMethodData::current->runOnce)
+ return i > 0;
return i >= QTest::iterationCount();
}
diff --git a/src/testlib/qbenchmark.h b/src/testlib/qbenchmark.h
index c06bfc082..87d34e7b6 100644
--- a/src/testlib/qbenchmark.h
+++ b/src/testlib/qbenchmark.h
@@ -64,7 +64,8 @@ namespace QTest
class Q_TESTLIB_EXPORT QBenchmarkIterationController
{
public:
- QBenchmarkIterationController();
+ enum RunMode { RepeatUntilValidMeasurement, RunOnce };
+ QBenchmarkIterationController(RunMode runMode);
~QBenchmarkIterationController();
bool isDone();
void next();
@@ -74,7 +75,12 @@ public:
}
#define QBENCHMARK \
- for (QTest::QBenchmarkIterationController __iteration_controller; __iteration_controller.isDone() == false; __iteration_controller.next())
+ for (QTest::QBenchmarkIterationController __iteration_controller(QTest::QBenchmarkIterationController::RepeatUntilValidMeasurement); \
+ __iteration_controller.isDone() == false; __iteration_controller.next())
+
+#define QBENCHMARK_ONCE \
+ for (QTest::QBenchmarkIterationController __iteration_controller(QTest::QBenchmarkIterationController::RunOnce); \
+ __iteration_controller.isDone() == false; __iteration_controller.next())
QT_END_NAMESPACE
diff --git a/src/testlib/qbenchmark_p.h b/src/testlib/qbenchmark_p.h
index 25f9cdc1e..185d65693 100644
--- a/src/testlib/qbenchmark_p.h
+++ b/src/testlib/qbenchmark_p.h
@@ -171,6 +171,7 @@ public:
QBenchmarkResult result;
bool resultAccepted;
+ bool runOnce;
int iterationCount;
};
diff --git a/src/testlib/qplaintestlogger.cpp b/src/testlib/qplaintestlogger.cpp
index 7bebaa13f..2515c51ed 100644
--- a/src/testlib/qplaintestlogger.cpp
+++ b/src/testlib/qplaintestlogger.cpp
@@ -148,11 +148,13 @@ namespace QTest {
static void outputMessage(const char *str)
{
#if defined(Q_OS_WINCE)
- int length = strlen(str);
- for (int pos = 0; pos < length; pos +=255) {
- QString uniText = QString::fromLatin1(str + pos, 255);
- OutputDebugString((wchar_t*)uniText.utf16());
- }
+ QString strUtf16 = QString::fromLatin1(str);
+ const int maxOutputLength = 255;
+ do {
+ QString tmp = strUtf16.left(maxOutputLength);
+ OutputDebugString((wchar_t*)tmp.utf16());
+ strUtf16.remove(0, maxOutputLength);
+ } while (!strUtf16.isEmpty());
if (QTestLog::outputFileName())
#elif defined(Q_OS_WIN)
EnterCriticalSection(&outputCriticalSection);
@@ -178,7 +180,7 @@ namespace QTest {
: "";
const char *filler = (tag[0] && gtag[0]) ? ":" : "";
if (file) {
- QTest::qt_asprintf(buf, "%s: %s::%s(%s%s%s)%s%s\n"
+ QTest::qt_asprintf(&buf, "%s: %s::%s(%s%s%s)%s%s\n"
#ifdef Q_OS_WIN
"%s(%d) : failure location\n"
#else
@@ -187,14 +189,14 @@ namespace QTest {
, type, QTestResult::currentTestObjectName(), fn, gtag, filler, tag,
msg[0] ? " " : "", msg, file, line);
} else {
- QTest::qt_asprintf(buf, "%s: %s::%s(%s%s%s)%s%s\n",
+ QTest::qt_asprintf(&buf, "%s: %s::%s(%s%s%s)%s%s\n",
type, QTestResult::currentTestObjectName(), fn, gtag, filler, tag,
msg[0] ? " " : "", msg);
}
// In colored mode, printf above stripped our nonprintable control characters.
// Put them back.
- memcpy(buf, type, strlen(type));
- outputMessage(buf);
+ memcpy(buf.data(), type, strlen(type));
+ outputMessage(buf.data());
}
template <typename T>
@@ -205,7 +207,7 @@ namespace QTest {
int digits = 0;
qreal divisor = 1;
-
+
while (num / divisor >= 1) {
divisor *= 10;
++digits;
diff --git a/src/testlib/qtest_global.h b/src/testlib/qtest_global.h
index c40f0adc3..b5b0fc054 100644
--- a/src/testlib/qtest_global.h
+++ b/src/testlib/qtest_global.h
@@ -82,7 +82,6 @@ namespace QTest
enum TestFailMode { Abort = 1, Continue = 2 };
int Q_TESTLIB_EXPORT qt_snprintf(char *str, int size, const char *format, ...);
- int qt_asprintf(char **str, const char *format, ...);
}
QT_END_NAMESPACE
diff --git a/src/testlib/qtestbasicstreamer.cpp b/src/testlib/qtestbasicstreamer.cpp
index aac57bad8..89de7d87b 100644
--- a/src/testlib/qtestbasicstreamer.cpp
+++ b/src/testlib/qtestbasicstreamer.cpp
@@ -68,39 +68,39 @@ QTestBasicStreamer::QTestBasicStreamer()
QTestBasicStreamer::~QTestBasicStreamer()
{}
-void QTestBasicStreamer::formatStart(const QTestElement *element, char **formatted) const
+void QTestBasicStreamer::formatStart(const QTestElement *element, QTestCharBuffer *formatted) const
{
if(!element || !formatted )
return;
- QTest::qt_asprintf(formatted, "");
+ formatted->data()[0] = '\0';
}
-void QTestBasicStreamer::formatEnd(const QTestElement *element, char **formatted) const
+void QTestBasicStreamer::formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const
{
if(!element || !formatted )
return;
- QTest::qt_asprintf(formatted, "");
+ formatted->data()[0] = '\0';
}
-void QTestBasicStreamer::formatBeforeAttributes(const QTestElement *element, char **formatted) const
+void QTestBasicStreamer::formatBeforeAttributes(const QTestElement *element, QTestCharBuffer *formatted) const
{
if(!element || !formatted )
return;
- QTest::qt_asprintf(formatted, "");
+ formatted->data()[0] = '\0';
}
-void QTestBasicStreamer::formatAfterAttributes(const QTestElement *element, char **formatted) const
+void QTestBasicStreamer::formatAfterAttributes(const QTestElement *element, QTestCharBuffer *formatted) const
{
if(!element || !formatted )
return;
- QTest::qt_asprintf(formatted, "");
+ formatted->data()[0] = '\0';
}
-void QTestBasicStreamer::formatAttributes(const QTestElement *, const QTestElementAttribute *attribute, char **formatted) const
+void QTestBasicStreamer::formatAttributes(const QTestElement *, const QTestElementAttribute *attribute, QTestCharBuffer *formatted) const
{
if(!attribute || !formatted )
return;
- QTest::qt_asprintf(formatted, "");
+ formatted->data()[0] = '\0';
}
void QTestBasicStreamer::output(QTestElement *element) const
@@ -125,22 +125,22 @@ void QTestBasicStreamer::outputElements(QTestElement *element, bool) const
while (element) {
hasChildren = element->childElements();
- formatStart(element, buf);
- outputString(buf);
+ formatStart(element, &buf);
+ outputString(buf.data());
- formatBeforeAttributes(element, buf);
- outputString(buf);
+ formatBeforeAttributes(element, &buf);
+ outputString(buf.data());
outputElementAttributes(element, element->attributes());
- formatAfterAttributes(element, buf);
- outputString(buf);
+ formatAfterAttributes(element, &buf);
+ outputString(buf.data());
if(hasChildren)
outputElements(element->childElements(), true);
- formatEnd(element, buf);
- outputString(buf);
+ formatEnd(element, &buf);
+ outputString(buf.data());
element = element->previousElement();
}
@@ -150,8 +150,8 @@ void QTestBasicStreamer::outputElementAttributes(const QTestElement* element, QT
{
QTestCharBuffer buf;
while(attribute){
- formatAttributes(element, attribute, buf);
- outputString(buf);
+ formatAttributes(element, attribute, &buf);
+ outputString(buf.data());
attribute = attribute->nextElement();
}
}
diff --git a/src/testlib/qtestbasicstreamer.h b/src/testlib/qtestbasicstreamer.h
index 432dd223a..932f5c3ec 100644
--- a/src/testlib/qtestbasicstreamer.h
+++ b/src/testlib/qtestbasicstreamer.h
@@ -53,6 +53,7 @@ QT_MODULE(Test)
class QTestElement;
class QTestElementAttribute;
class QTestLogger;
+struct QTestCharBuffer;
class QTestBasicStreamer
{
@@ -71,11 +72,11 @@ class QTestBasicStreamer
const QTestLogger *logger() const;
protected:
- virtual void formatStart(const QTestElement *element, char **formatted) const;
- virtual void formatEnd(const QTestElement *element, char **formatted) const;
- virtual void formatBeforeAttributes(const QTestElement *element, char **formatted) const;
- virtual void formatAfterAttributes(const QTestElement *element, char **formatted) const;
- virtual void formatAttributes(const QTestElement *element, const QTestElementAttribute *attribute, char **formatted) const;
+ virtual void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const;
+ virtual void formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const;
+ virtual void formatBeforeAttributes(const QTestElement *element, QTestCharBuffer *formatted) const;
+ virtual void formatAfterAttributes(const QTestElement *element, QTestCharBuffer *formatted) const;
+ virtual void formatAttributes(const QTestElement *element, const QTestElementAttribute *attribute, QTestCharBuffer *formatted) const;
virtual void outputElements(QTestElement *element, bool isChildElement = false) const;
virtual void outputElementAttributes(const QTestElement *element, QTestElementAttribute *attribute) const;
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index ac4ca830c..51e767c40 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -351,6 +351,26 @@ QT_BEGIN_NAMESPACE
{Chapter 5: Writing a Benchmark}{Writing a Benchmark}
*/
+/*!
+ \macro QBENCHMARK_ONCE
+ \since 4.6
+
+ \relates QTest
+
+ This macro is used to measure the performance of code within a test.
+ The code to be benchmarked is contained within a code block following
+ this macro.
+
+ Unlike QBENCHMARK, the contents of the contained code block is only run
+ once. The elapsed time will be reported as "0" if it's to short to
+ be measured by the selected backend. (Use)
+
+ \sa {QTestLib Manual#Creating a Benchmark}{Creating a Benchmark},
+ {Chapter 5: Writing a Benchmark}{Writing a Benchmark}
+*/
+
+
+
/*! \enum QTest::SkipMode
This enum describes the modes for skipping tests during execution
@@ -820,43 +840,6 @@ void filter_unprintable(char *str)
/*! \internal
*/
-int qt_asprintf(char **str, const char *format, ...)
-{
- static const int MAXSIZE = 1024*1024*2;
-
- int size = 32;
- delete[] *str;
- *str = new char[size];
-
- va_list ap;
- int res = 0;
-
- for (;;) {
- va_start(ap, format);
- res = qvsnprintf(*str, size, format, ap);
- va_end(ap);
- (*str)[size - 1] = '\0';
- if (res >= 0 && res < size) {
- // We succeeded
- break;
- }
- // buffer wasn't big enough, try again.
- // Note, we're assuming that a result of -1 is always due to running out of space.
- size *= 2;
- if (size > MAXSIZE) {
- break;
- }
- delete[] *str;
- *str = new char[size];
- }
-
- filter_unprintable(*str);
-
- return res;
-}
-
-/*! \internal
- */
int qt_snprintf(char *str, int size, const char *format, ...)
{
va_list ap;
diff --git a/src/testlib/qtestlightxmlstreamer.cpp b/src/testlib/qtestlightxmlstreamer.cpp
index e17620124..b84f531ad 100644
--- a/src/testlib/qtestlightxmlstreamer.cpp
+++ b/src/testlib/qtestlightxmlstreamer.cpp
@@ -59,7 +59,7 @@ QTestLightXmlStreamer::QTestLightXmlStreamer()
QTestLightXmlStreamer::~QTestLightXmlStreamer()
{}
-void QTestLightXmlStreamer::formatStart(const QTestElement *element, char **formatted) const
+void QTestLightXmlStreamer::formatStart(const QTestElement *element, QTestCharBuffer *formatted) const
{
if(!element || !formatted)
return;
@@ -67,14 +67,14 @@ void QTestLightXmlStreamer::formatStart(const QTestElement *element, char **form
switch(element->elementType()){
case QTest::LET_TestCase: {
QTestCharBuffer quotedTf;
- QXmlTestLogger::xmlQuote(quotedTf, element->attributeValue(QTest::AI_Name));
+ QXmlTestLogger::xmlQuote(&quotedTf, element->attributeValue(QTest::AI_Name));
QTest::qt_asprintf(formatted, "<TestFunction name=\"%s\">\n", quotedTf.constData());
break;
}
case QTest::LET_Failure: {
QTestCharBuffer cdataDesc;
- QXmlTestLogger::xmlCdata(cdataDesc, element->attributeValue(QTest::AI_Description));
+ QXmlTestLogger::xmlCdata(&cdataDesc, element->attributeValue(QTest::AI_Description));
QTest::qt_asprintf(formatted, " <Description><![CDATA[%s]]></Description>\n",
cdataDesc.constData());
@@ -84,8 +84,8 @@ void QTestLightXmlStreamer::formatStart(const QTestElement *element, char **form
// assuming type and attribute names don't need quoting
QTestCharBuffer quotedFile;
QTestCharBuffer cdataDesc;
- QXmlTestLogger::xmlQuote(quotedFile, element->attributeValue(QTest::AI_File));
- QXmlTestLogger::xmlCdata(cdataDesc, element->attributeValue(QTest::AI_Description));
+ QXmlTestLogger::xmlQuote(&quotedFile, element->attributeValue(QTest::AI_File));
+ QXmlTestLogger::xmlCdata(&cdataDesc, element->attributeValue(QTest::AI_Description));
QTest::qt_asprintf(formatted, "<Message type=\"%s\" %s=\"%s\" %s=\"%s\">\n <Description><![CDATA[%s]]></Description>\n</Message>\n",
element->attributeValue(QTest::AI_Type),
@@ -100,8 +100,8 @@ void QTestLightXmlStreamer::formatStart(const QTestElement *element, char **form
// assuming value and iterations don't need quoting
QTestCharBuffer quotedMetric;
QTestCharBuffer quotedTag;
- QXmlTestLogger::xmlQuote(quotedMetric, element->attributeValue(QTest::AI_Metric));
- QXmlTestLogger::xmlQuote(quotedTag, element->attributeValue(QTest::AI_Tag));
+ QXmlTestLogger::xmlQuote(&quotedMetric, element->attributeValue(QTest::AI_Metric));
+ QXmlTestLogger::xmlQuote(&quotedTag, element->attributeValue(QTest::AI_Tag));
QTest::qt_asprintf(formatted, "<BenchmarkResult %s=\"%s\" %s=\"%s\" %s=\"%s\" %s=\"%s\" />\n",
element->attributeName(QTest::AI_Metric),
@@ -115,11 +115,11 @@ void QTestLightXmlStreamer::formatStart(const QTestElement *element, char **form
break;
}
default:
- QTest::qt_asprintf(formatted, "");
+ formatted->data()[0] = '\0';
}
}
-void QTestLightXmlStreamer::formatEnd(const QTestElement *element, char **formatted) const
+void QTestLightXmlStreamer::formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const
{
if(!element || !formatted)
return;
@@ -129,47 +129,47 @@ void QTestLightXmlStreamer::formatEnd(const QTestElement *element, char **format
QTest::qt_asprintf(formatted, "</Incident>\n</TestFunction>\n");
else
QTest::qt_asprintf(formatted, "</TestFunction>\n");
+ } else {
+ formatted->data()[0] = '\0';
}
- else
- QTest::qt_asprintf(formatted, "");
}
-void QTestLightXmlStreamer::formatBeforeAttributes(const QTestElement *element, char **formatted) const
+void QTestLightXmlStreamer::formatBeforeAttributes(const QTestElement *element, QTestCharBuffer *formatted) const
{
if(!element || !formatted)
return;
- if (element->elementType() == QTest::LET_TestCase && element->attribute(QTest::AI_Result)){
- QTestCharBuffer buf;
- QTestCharBuffer quotedFile;
- QXmlTestLogger::xmlQuote(quotedFile, element->attributeValue(QTest::AI_File));
-
- QTest::qt_asprintf(buf, "%s=\"%s\" %s=\"%s\"",
- element->attributeName(QTest::AI_File),
- quotedFile.constData(),
- element->attributeName(QTest::AI_Line),
- element->attributeValue(QTest::AI_Line));
-
- if( !element->childElements() )
- QTest::qt_asprintf(formatted, "<Incident type=\"%s\" %s/>\n",
- element->attributeValue(QTest::AI_Result), buf.constData());
- else
- QTest::qt_asprintf(formatted, "<Incident type=\"%s\" %s>\n",
- element->attributeValue(QTest::AI_Result), buf.constData());
- }else{
- QTest::qt_asprintf(formatted, "");
+ if (element->elementType() == QTest::LET_TestCase && element->attribute(QTest::AI_Result)) {
+ QTestCharBuffer buf;
+ QTestCharBuffer quotedFile;
+ QXmlTestLogger::xmlQuote(&quotedFile, element->attributeValue(QTest::AI_File));
+
+ QTest::qt_asprintf(&buf, "%s=\"%s\" %s=\"%s\"",
+ element->attributeName(QTest::AI_File),
+ quotedFile.constData(),
+ element->attributeName(QTest::AI_Line),
+ element->attributeValue(QTest::AI_Line));
+
+ if( !element->childElements() )
+ QTest::qt_asprintf(formatted, "<Incident type=\"%s\" %s/>\n",
+ element->attributeValue(QTest::AI_Result), buf.constData());
+ else
+ QTest::qt_asprintf(formatted, "<Incident type=\"%s\" %s>\n",
+ element->attributeValue(QTest::AI_Result), buf.constData());
+ } else {
+ formatted->data()[0] = '\0';
}
}
void QTestLightXmlStreamer::output(QTestElement *element) const
{
QTestCharBuffer buf;
- QTest::qt_asprintf(buf, "<Environment>\n <QtVersion>%s</QtVersion>\n <QTestVersion>%s</QTestVersion>\n",
+ QTest::qt_asprintf(&buf, "<Environment>\n <QtVersion>%s</QtVersion>\n <QTestVersion>%s</QTestVersion>\n",
qVersion(), QTEST_VERSION_STR );
- outputString(buf);
+ outputString(buf.constData());
- QTest::qt_asprintf(buf, "</Environment>\n");
- outputString(buf);
+ QTest::qt_asprintf(&buf, "</Environment>\n");
+ outputString(buf.constData());
QTestBasicStreamer::output(element);
}
diff --git a/src/testlib/qtestlightxmlstreamer.h b/src/testlib/qtestlightxmlstreamer.h
index 6dafdcc0f..e147e5cc0 100644
--- a/src/testlib/qtestlightxmlstreamer.h
+++ b/src/testlib/qtestlightxmlstreamer.h
@@ -59,9 +59,9 @@ class QTestLightXmlStreamer: public QTestBasicStreamer
QTestLightXmlStreamer();
~QTestLightXmlStreamer();
- void formatStart(const QTestElement *element, char **formatted) const;
- void formatEnd(const QTestElement *element, char **formatted) const;
- void formatBeforeAttributes(const QTestElement *element, char **formatted) const;
+ void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const;
+ void formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const;
+ void formatBeforeAttributes(const QTestElement *element, QTestCharBuffer *formatted) const;
void output(QTestElement *element) const;
};
diff --git a/src/testlib/qtestxmlstreamer.cpp b/src/testlib/qtestxmlstreamer.cpp
index 1b6e674e8..c72d6480f 100644
--- a/src/testlib/qtestxmlstreamer.cpp
+++ b/src/testlib/qtestxmlstreamer.cpp
@@ -60,7 +60,7 @@ QTestXmlStreamer::QTestXmlStreamer()
QTestXmlStreamer::~QTestXmlStreamer()
{}
-void QTestXmlStreamer::formatStart(const QTestElement *element, char **formatted) const
+void QTestXmlStreamer::formatStart(const QTestElement *element, QTestCharBuffer *formatted) const
{
if(!element || !formatted)
return;
@@ -68,20 +68,20 @@ void QTestXmlStreamer::formatStart(const QTestElement *element, char **formatted
switch(element->elementType()){
case QTest::LET_TestCase: {
QTestCharBuffer quotedTf;
- QXmlTestLogger::xmlQuote(quotedTf, element->attributeValue(QTest::AI_Name));
+ QXmlTestLogger::xmlQuote(&quotedTf, element->attributeValue(QTest::AI_Name));
QTest::qt_asprintf(formatted, "<TestFunction name=\"%s\">\n", quotedTf.constData());
break;
}
case QTest::LET_Failure: {
QTestCharBuffer cdataDesc;
- QXmlTestLogger::xmlCdata(cdataDesc, element->attributeValue(QTest::AI_Description));
+ QXmlTestLogger::xmlCdata(&cdataDesc, element->attributeValue(QTest::AI_Description));
QTestCharBuffer location;
QTestCharBuffer quotedFile;
- QXmlTestLogger::xmlQuote(quotedFile, element->attributeValue(QTest::AI_File));
+ QXmlTestLogger::xmlQuote(&quotedFile, element->attributeValue(QTest::AI_File));
- QTest::qt_asprintf(location, "%s=\"%s\" %s=\"%s\"",
+ QTest::qt_asprintf(&location, "%s=\"%s\" %s=\"%s\"",
element->attributeName(QTest::AI_File),
quotedFile.constData(),
element->attributeName(QTest::AI_Line),
@@ -89,7 +89,7 @@ void QTestXmlStreamer::formatStart(const QTestElement *element, char **formatted
if (element->attribute(QTest::AI_Tag)) {
QTestCharBuffer cdataTag;
- QXmlTestLogger::xmlCdata(cdataTag, element->attributeValue(QTest::AI_Tag));
+ QXmlTestLogger::xmlCdata(&cdataTag, element->attributeValue(QTest::AI_Tag));
QTest::qt_asprintf(formatted, "<Incident type=\"%s\" %s>\n"
" <DataTag><![CDATA[%s]]></DataTag>\n"
" <Description><![CDATA[%s]]></Description>\n"
@@ -108,8 +108,8 @@ void QTestXmlStreamer::formatStart(const QTestElement *element, char **formatted
// assuming type and attribute names don't need quoting
QTestCharBuffer quotedFile;
QTestCharBuffer cdataDesc;
- QXmlTestLogger::xmlQuote(quotedFile, element->attributeValue(QTest::AI_File));
- QXmlTestLogger::xmlCdata(cdataDesc, element->attributeValue(QTest::AI_Description));
+ QXmlTestLogger::xmlQuote(&quotedFile, element->attributeValue(QTest::AI_File));
+ QXmlTestLogger::xmlCdata(&cdataDesc, element->attributeValue(QTest::AI_Description));
QTest::qt_asprintf(formatted, "<Message type=\"%s\" %s=\"%s\" %s=\"%s\">\n <Description><![CDATA[%s]]></Description>\n</Message>\n",
element->attributeValue(QTest::AI_Type),
@@ -124,8 +124,8 @@ void QTestXmlStreamer::formatStart(const QTestElement *element, char **formatted
// assuming value and iterations don't need quoting
QTestCharBuffer quotedMetric;
QTestCharBuffer quotedTag;
- QXmlTestLogger::xmlQuote(quotedMetric, element->attributeValue(QTest::AI_Metric));
- QXmlTestLogger::xmlQuote(quotedTag, element->attributeValue(QTest::AI_Tag));
+ QXmlTestLogger::xmlQuote(&quotedMetric, element->attributeValue(QTest::AI_Metric));
+ QXmlTestLogger::xmlQuote(&quotedTag, element->attributeValue(QTest::AI_Tag));
QTest::qt_asprintf(formatted, "<BenchmarkResult %s=\"%s\" %s=\"%s\" %s=\"%s\" %s=\"%s\" />\n",
element->attributeName(QTest::AI_Metric),
@@ -139,23 +139,23 @@ void QTestXmlStreamer::formatStart(const QTestElement *element, char **formatted
break;
}
default:
- QTest::qt_asprintf(formatted, "");
+ formatted->data()[0] = '\0';
}
}
-void QTestXmlStreamer::formatEnd(const QTestElement *element, char **formatted) const
+void QTestXmlStreamer::formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const
{
if(!element || !formatted)
return;
if (element->elementType() == QTest::LET_TestCase) {
QTest::qt_asprintf(formatted, "</TestFunction>\n");
+ } else {
+ formatted->data()[0] = '\0';
}
- else
- QTest::qt_asprintf(formatted, "");
}
-void QTestXmlStreamer::formatBeforeAttributes(const QTestElement *element, char **formatted) const
+void QTestXmlStreamer::formatBeforeAttributes(const QTestElement *element, QTestCharBuffer *formatted) const
{
if(!element || !formatted)
return;
@@ -163,9 +163,9 @@ void QTestXmlStreamer::formatBeforeAttributes(const QTestElement *element, char
if (element->elementType() == QTest::LET_TestCase && element->attribute(QTest::AI_Result)){
QTestCharBuffer buf;
QTestCharBuffer quotedFile;
- QXmlTestLogger::xmlQuote(quotedFile, element->attributeValue(QTest::AI_File));
+ QXmlTestLogger::xmlQuote(&quotedFile, element->attributeValue(QTest::AI_File));
- QTest::qt_asprintf(buf, "%s=\"%s\" %s=\"%s\"",
+ QTest::qt_asprintf(&buf, "%s=\"%s\" %s=\"%s\"",
element->attributeName(QTest::AI_File),
quotedFile.constData(),
element->attributeName(QTest::AI_Line),
@@ -174,12 +174,11 @@ void QTestXmlStreamer::formatBeforeAttributes(const QTestElement *element, char
if( !element->childElements() ) {
QTest::qt_asprintf(formatted, "<Incident type=\"%s\" %s/>\n",
element->attributeValue(QTest::AI_Result), buf.constData());
+ } else {
+ formatted->data()[0] = '\0';
}
- else {
- QTest::qt_asprintf(formatted, "");
- }
- }else{
- QTest::qt_asprintf(formatted, "");
+ } else {
+ formatted->data()[0] = '\0';
}
}
@@ -187,23 +186,23 @@ void QTestXmlStreamer::output(QTestElement *element) const
{
QTestCharBuffer buf;
QTestCharBuffer quotedTc;
- QXmlTestLogger::xmlQuote(quotedTc, QTestResult::currentTestObjectName());
+ QXmlTestLogger::xmlQuote(&quotedTc, QTestResult::currentTestObjectName());
- QTest::qt_asprintf(buf, "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<TestCase name=\"%s\">\n",
+ QTest::qt_asprintf(&buf, "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<TestCase name=\"%s\">\n",
quotedTc.constData());
- outputString(buf);
+ outputString(buf.constData());
- QTest::qt_asprintf(buf, "<Environment>\n <QtVersion>%s</QtVersion>\n <QTestVersion>%s</QTestVersion>\n",
+ QTest::qt_asprintf(&buf, "<Environment>\n <QtVersion>%s</QtVersion>\n <QTestVersion>%s</QTestVersion>\n",
qVersion(), QTEST_VERSION_STR );
- outputString(buf);
+ outputString(buf.constData());
- QTest::qt_asprintf(buf, "</Environment>\n");
- outputString(buf);
+ QTest::qt_asprintf(&buf, "</Environment>\n");
+ outputString(buf.constData());
QTestBasicStreamer::output(element);
- QTest::qt_asprintf(buf, "</TestCase>\n");
- outputString(buf);
+ QTest::qt_asprintf(&buf, "</TestCase>\n");
+ outputString(buf.constData());
}
QT_END_NAMESPACE
diff --git a/src/testlib/qtestxmlstreamer.h b/src/testlib/qtestxmlstreamer.h
index a601f6034..6e1ae84cb 100644
--- a/src/testlib/qtestxmlstreamer.h
+++ b/src/testlib/qtestxmlstreamer.h
@@ -59,9 +59,9 @@ class QTestXmlStreamer: public QTestBasicStreamer
QTestXmlStreamer();
~QTestXmlStreamer();
- void formatStart(const QTestElement *element, char **formatted) const;
- void formatEnd(const QTestElement *element, char **formatted) const;
- void formatBeforeAttributes(const QTestElement *element, char **formatted) const;
+ void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const;
+ void formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const;
+ void formatBeforeAttributes(const QTestElement *element, QTestCharBuffer *formatted) const;
void output(QTestElement *element) const;
};
diff --git a/src/testlib/qtestxunitstreamer.cpp b/src/testlib/qtestxunitstreamer.cpp
index d5d2631bf..932b70b13 100644
--- a/src/testlib/qtestxunitstreamer.cpp
+++ b/src/testlib/qtestxunitstreamer.cpp
@@ -73,7 +73,7 @@ void QTestXunitStreamer::indentForElement(const QTestElement* element, char* buf
}
}
-void QTestXunitStreamer::formatStart(const QTestElement *element, char **formatted) const
+void QTestXunitStreamer::formatStart(const QTestElement *element, QTestCharBuffer *formatted) const
{
if(!element || !formatted )
return;
@@ -85,8 +85,7 @@ void QTestXunitStreamer::formatStart(const QTestElement *element, char **formatt
if (element->elementType() == QTest::LET_Error) {
if (element->parentElement()->elementType() == QTest::LET_SystemError) {
QTest::qt_asprintf(formatted, "<![CDATA[");
- }
- else {
+ } else {
QTest::qt_asprintf(formatted, "%s<!--", indent);
}
return;
@@ -95,13 +94,13 @@ void QTestXunitStreamer::formatStart(const QTestElement *element, char **formatt
QTest::qt_asprintf(formatted, "%s<%s", indent, element->elementName());
}
-void QTestXunitStreamer::formatEnd(const QTestElement *element, char **formatted) const
+void QTestXunitStreamer::formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const
{
- if(!element || !formatted )
+ if (!element || !formatted )
return;
- if(!element->childElements()){
- QTest::qt_asprintf(formatted, "");
+ if (!element->childElements()){
+ formatted->data()[0] = '\0';
return;
}
@@ -111,7 +110,7 @@ void QTestXunitStreamer::formatEnd(const QTestElement *element, char **formatted
QTest::qt_asprintf(formatted, "%s</%s>\n", indent, element->elementName());
}
-void QTestXunitStreamer::formatAttributes(const QTestElement* element, const QTestElementAttribute *attribute, char **formatted) const
+void QTestXunitStreamer::formatAttributes(const QTestElement* element, const QTestElementAttribute *attribute, QTestCharBuffer *formatted) const
{
if(!attribute || !formatted )
return;
@@ -136,15 +135,14 @@ void QTestXunitStreamer::formatAttributes(const QTestElement* element, const QTe
if (key) {
QTestCharBuffer quotedValue;
- QXmlTestLogger::xmlQuote(quotedValue, attribute->value());
+ QXmlTestLogger::xmlQuote(&quotedValue, attribute->value());
QTest::qt_asprintf(formatted, " %s=\"%s\"", key, quotedValue.constData());
- }
- else {
- QTest::qt_asprintf(formatted, "");
+ } else {
+ formatted->data()[0] = '\0';
}
}
-void QTestXunitStreamer::formatAfterAttributes(const QTestElement *element, char **formatted) const
+void QTestXunitStreamer::formatAfterAttributes(const QTestElement *element, QTestCharBuffer *formatted) const
{
if(!element || !formatted )
return;
@@ -153,8 +151,7 @@ void QTestXunitStreamer::formatAfterAttributes(const QTestElement *element, char
if (element->elementType() == QTest::LET_Error) {
if (element->parentElement()->elementType() == QTest::LET_SystemError) {
QTest::qt_asprintf(formatted, "]]>\n");
- }
- else {
+ } else {
QTest::qt_asprintf(formatted, " -->\n");
}
return;
@@ -187,22 +184,22 @@ void QTestXunitStreamer::outputElements(QTestElement *element, bool) const
hasChildren = element->childElements();
if(element->elementType() != QTest::LET_Benchmark){
- formatStart(element, buf);
- outputString(buf);
+ formatStart(element, &buf);
+ outputString(buf.data());
- formatBeforeAttributes(element, buf);
- outputString(buf);
+ formatBeforeAttributes(element, &buf);
+ outputString(buf.data());
outputElementAttributes(element, element->attributes());
- formatAfterAttributes(element, buf);
- outputString(buf);
+ formatAfterAttributes(element, &buf);
+ outputString(buf.data());
if(hasChildren)
outputElements(element->childElements(), true);
- formatEnd(element, buf);
- outputString(buf);
+ formatEnd(element, &buf);
+ outputString(buf.data());
}
element = element->previousElement();
}
diff --git a/src/testlib/qtestxunitstreamer.h b/src/testlib/qtestxunitstreamer.h
index 044307f9e..43ff03d81 100644
--- a/src/testlib/qtestxunitstreamer.h
+++ b/src/testlib/qtestxunitstreamer.h
@@ -58,10 +58,10 @@ class QTestXunitStreamer: public QTestBasicStreamer
QTestXunitStreamer();
~QTestXunitStreamer();
- void formatStart(const QTestElement *element, char **formatted) const;
- void formatEnd(const QTestElement *element, char **formatted) const;
- void formatAfterAttributes(const QTestElement *element, char **formatted) const;
- void formatAttributes(const QTestElement *element, const QTestElementAttribute *attribute, char **formatted) const;
+ void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const;
+ void formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const;
+ void formatAfterAttributes(const QTestElement *element, QTestCharBuffer *formatted) const;
+ void formatAttributes(const QTestElement *element, const QTestElementAttribute *attribute, QTestCharBuffer *formatted) const;
void output(QTestElement *element) const;
void outputElements(QTestElement *element, bool isChildElement = false) const;
diff --git a/src/testlib/qxmltestlogger.cpp b/src/testlib/qxmltestlogger.cpp
index fca7bfc1e..494acb46f 100644
--- a/src/testlib/qxmltestlogger.cpp
+++ b/src/testlib/qxmltestlogger.cpp
@@ -108,19 +108,19 @@ void QXmlTestLogger::startLogging()
if (xmlmode == QXmlTestLogger::Complete) {
QTestCharBuffer quotedTc;
- xmlQuote(quotedTc, QTestResult::currentTestObjectName());
- QTest::qt_asprintf(buf,
+ xmlQuote(&quotedTc, QTestResult::currentTestObjectName());
+ QTest::qt_asprintf(&buf,
"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
"<TestCase name=\"%s\">\n", quotedTc.constData());
- outputString(buf);
+ outputString(buf.constData());
}
- QTest::qt_asprintf(buf,
+ QTest::qt_asprintf(&buf,
"<Environment>\n"
" <QtVersion>%s</QtVersion>\n"
" <QTestVersion>"QTEST_VERSION_STR"</QTestVersion>\n"
"</Environment>\n", qVersion());
- outputString(buf);
+ outputString(buf.constData());
}
void QXmlTestLogger::stopLogging()
@@ -136,9 +136,9 @@ void QXmlTestLogger::enterTestFunction(const char *function)
{
QTestCharBuffer buf;
QTestCharBuffer quotedFunction;
- xmlQuote(quotedFunction, function);
- QTest::qt_asprintf(buf, "<TestFunction name=\"%s\">\n", quotedFunction.constData());
- outputString(buf);
+ xmlQuote(&quotedFunction, function);
+ QTest::qt_asprintf(&buf, "<TestFunction name=\"%s\">\n", quotedFunction.constData());
+ outputString(buf.constData());
}
void QXmlTestLogger::leaveTestFunction()
@@ -219,12 +219,12 @@ void QXmlTestLogger::addIncident(IncidentTypes type, const char *description,
QTestCharBuffer cdataTag;
QTestCharBuffer cdataDescription;
- xmlQuote(quotedFile, file);
- xmlCdata(cdataGtag, gtag);
- xmlCdata(cdataTag, tag);
- xmlCdata(cdataDescription, description);
+ xmlQuote(&quotedFile, file);
+ xmlCdata(&cdataGtag, gtag);
+ xmlCdata(&cdataTag, tag);
+ xmlCdata(&cdataDescription, description);
- QTest::qt_asprintf(buf,
+ QTest::qt_asprintf(&buf,
QTest::incidentFormatString(QTest::isEmpty(description), notag),
QTest::xmlIncidentType2String(type),
quotedFile.constData(), line,
@@ -233,7 +233,7 @@ void QXmlTestLogger::addIncident(IncidentTypes type, const char *description,
cdataTag.constData(),
cdataDescription.constData());
- outputString(buf);
+ outputString(buf.constData());
}
void QXmlTestLogger::addBenchmarkResult(const QBenchmarkResult &result)
@@ -242,18 +242,18 @@ void QXmlTestLogger::addBenchmarkResult(const QBenchmarkResult &result)
QTestCharBuffer quotedMetric;
QTestCharBuffer quotedTag;
- xmlQuote(quotedMetric,
+ xmlQuote(&quotedMetric,
QBenchmarkGlobalData::current->measurer->metricText().toAscii().constData());
- xmlQuote(quotedTag, result.context.tag.toAscii().constData());
+ xmlQuote(&quotedTag, result.context.tag.toAscii().constData());
QTest::qt_asprintf(
- buf,
+ &buf,
QTest::benchmarkResultFormatString(),
quotedMetric.constData(),
quotedTag.constData(),
QByteArray::number(result.value).constData(), //no 64-bit qt_snprintf support
result.iterations);
- outputString(buf);
+ outputString(buf.constData());
}
void QXmlTestLogger::addMessage(MessageTypes type, const char *message,
@@ -270,12 +270,12 @@ void QXmlTestLogger::addMessage(MessageTypes type, const char *message,
QTestCharBuffer cdataTag;
QTestCharBuffer cdataDescription;
- xmlQuote(quotedFile, file);
- xmlCdata(cdataGtag, gtag);
- xmlCdata(cdataTag, tag);
- xmlCdata(cdataDescription, message);
+ xmlQuote(&quotedFile, file);
+ xmlCdata(&cdataGtag, gtag);
+ xmlCdata(&cdataTag, tag);
+ xmlCdata(&cdataDescription, message);
- QTest::qt_asprintf(buf,
+ QTest::qt_asprintf(&buf,
QTest::messageFormatString(QTest::isEmpty(message), notag),
QTest::xmlMessageType2String(type),
quotedFile.constData(), line,
@@ -284,7 +284,7 @@ void QXmlTestLogger::addMessage(MessageTypes type, const char *message,
cdataTag.constData(),
cdataDescription.constData());
- outputString(buf);
+ outputString(buf.constData());
}
/*
@@ -292,10 +292,11 @@ void QXmlTestLogger::addMessage(MessageTypes type, const char *message,
XML characters as necessary so that dest is suitable for use in an XML
quoted attribute string.
*/
-int QXmlTestLogger::xmlQuote(char* dest, char const* src, size_t n)
+int QXmlTestLogger::xmlQuote(QTestCharBuffer* destBuf, char const* src, size_t n)
{
if (n == 0) return 0;
+ char *dest = destBuf->data();
*dest = 0;
if (!src) return 0;
@@ -351,10 +352,12 @@ int QXmlTestLogger::xmlQuote(char* dest, char const* src, size_t n)
Copy up to n characters from the src string into dest, escaping any
special strings such that dest is suitable for use in an XML CDATA section.
*/
-int QXmlTestLogger::xmlCdata(char* dest, char const* src, size_t n)
+int QXmlTestLogger::xmlCdata(QTestCharBuffer *destBuf, char const* src, size_t n)
{
if (!n) return 0;
+ char *dest = destBuf->data();
+
if (!src || n == 1) {
*dest = 0;
return 0;
@@ -394,25 +397,23 @@ int QXmlTestLogger::xmlCdata(char* dest, char const* src, size_t n)
return (dest-begin);
}
-typedef int (*StringFormatFunction)(char*,char const*,size_t);
+typedef int (*StringFormatFunction)(QTestCharBuffer*,char const*,size_t);
/*
A wrapper for string functions written to work with a fixed size buffer so they can be called
with a dynamically allocated buffer.
*/
-int allocateStringFn(char** str, char const* src, StringFormatFunction func)
+int allocateStringFn(QTestCharBuffer* str, char const* src, StringFormatFunction func)
{
static const int MAXSIZE = 1024*1024*2;
- int size = 32;
- delete[] *str;
- *str = new char[size];
+ int size = str->size();
int res = 0;
for (;;) {
- res = func(*str, src, size);
- (*str)[size - 1] = '\0';
+ res = func(str, src, size);
+ str->data()[size - 1] = '\0';
if (res < size) {
// We succeeded or fatally failed
break;
@@ -422,19 +423,19 @@ int allocateStringFn(char** str, char const* src, StringFormatFunction func)
if (size > MAXSIZE) {
break;
}
- delete[] *str;
- *str = new char[size];
+ if (!str->reset(size))
+ break; // ran out of memory - bye
}
return res;
}
-int QXmlTestLogger::xmlQuote(char** str, char const* src)
+int QXmlTestLogger::xmlQuote(QTestCharBuffer* str, char const* src)
{
return allocateStringFn(str, src, QXmlTestLogger::xmlQuote);
}
-int QXmlTestLogger::xmlCdata(char** str, char const* src)
+int QXmlTestLogger::xmlCdata(QTestCharBuffer* str, char const* src)
{
return allocateStringFn(str, src, QXmlTestLogger::xmlCdata);
}
diff --git a/src/testlib/qxmltestlogger_p.h b/src/testlib/qxmltestlogger_p.h
index a7cc00a34..e14504ce4 100644
--- a/src/testlib/qxmltestlogger_p.h
+++ b/src/testlib/qxmltestlogger_p.h
@@ -79,10 +79,10 @@ public:
void addMessage(MessageTypes type, const char *message,
const char *file = 0, int line = 0);
- static int xmlCdata(char** dest, char const* src);
- static int xmlQuote(char** dest, char const* src);
- static int xmlCdata(char* dest, char const* src, size_t n);
- static int xmlQuote(char* dest, char const* src, size_t n);
+ static int xmlCdata(QTestCharBuffer *dest, char const* src);
+ static int xmlQuote(QTestCharBuffer *dest, char const* src);
+ static int xmlCdata(QTestCharBuffer *dest, char const* src, size_t n);
+ static int xmlQuote(QTestCharBuffer *dest, char const* src, size_t n);
private:
XmlMode xmlmode;
diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro
index d8a1f9659..396e9ae83 100644
--- a/src/tools/bootstrap/bootstrap.pro
+++ b/src/tools/bootstrap/bootstrap.pro
@@ -89,7 +89,7 @@ win32:SOURCES += ../../corelib/io/qfsfileengine_win.cpp \
../../corelib/io/qfsfileengine_iterator_win.cpp
macx: {
- QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.3 #enables weak linking for 10.3 (exported)
+ QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4 #enables weak linking for 10.4 (exported)
SOURCES += ../../corelib/kernel/qcore_mac.cpp
LIBS += -framework CoreServices
}
diff --git a/src/tools/uic/uic.cpp b/src/tools/uic/uic.cpp
index bbb3af713..14576e285 100644
--- a/src/tools/uic/uic.cpp
+++ b/src/tools/uic/uic.cpp
@@ -184,9 +184,9 @@ DomUI *Uic::parseUiFile(QXmlStreamReader &reader)
if (reader.hasError()) {
delete ui;
ui = 0;
- fprintf(stderr, "uic: Error in line %llu, column %llu : %s\n",
- reader.lineNumber(), reader.columnNumber(),
- reader.errorString().toAscii().constData());
+ fprintf(stderr, "%s\n", qPrintable(QString::fromLatin1("uic: Error in line %1, column %2 : %3")
+ .arg(reader.lineNumber()).arg(reader.columnNumber())
+ .arg(reader.errorString())));
}
return ui;
diff --git a/src/xmlpatterns/query.pri b/src/xmlpatterns/query.pri
index e09a61854..fab194031 100644
--- a/src/xmlpatterns/query.pri
+++ b/src/xmlpatterns/query.pri
@@ -11,4 +11,4 @@ include($$PWD/parser/parser.pri)
include($$PWD/projection/projection.pri)
include($$PWD/type/type.pri)
include($$PWD/utils/utils.pri)
-include($$PWD/qobjectmodel/qobjectmodel.pri)
+include($$PWD/qobjectmodel/qobjectmodel.pri, "", true)
diff --git a/src/xmlpatterns/xmlpatterns.pro b/src/xmlpatterns/xmlpatterns.pro
index fb6aa1af5..bb8e45215 100644
--- a/src/xmlpatterns/xmlpatterns.pro
+++ b/src/xmlpatterns/xmlpatterns.pro
@@ -22,10 +22,9 @@ include($$PWD/janitors/janitors.pri)
include($$PWD/parser/parser.pri)
include($$PWD/projection/projection.pri)
include($$PWD/schema/schema.pri)
-include($$PWD/schematron/schematron.pri)
include($$PWD/type/type.pri)
include($$PWD/utils/utils.pri)
-include($$PWD/qobjectmodel/qobjectmodel.pri)
+include($$PWD/qobjectmodel/qobjectmodel.pri, "", true)
wince*: {
# The Microsoft MIPS compiler crashes if /Og is specified
diff --git a/tests/arthur/lance/main.cpp b/tests/arthur/lance/main.cpp
index f95b42623..0c9f3d854 100644
--- a/tests/arthur/lance/main.cpp
+++ b/tests/arthur/lance/main.cpp
@@ -271,7 +271,7 @@ int main(int argc, char **argv)
QString format = QString(argv[++i]).toLower();
imageFormat = QImage::Format_Invalid;
- static const unsigned int formatCount =
+ static const int formatCount =
sizeof(imageFormats) / sizeof(imageFormats[0]);
for (int ff = 0; ff < formatCount; ++ff) {
if (QLatin1String(imageFormats[ff].name) == format) {
diff --git a/tests/arthur/lance/widgets.h b/tests/arthur/lance/widgets.h
index 72476084f..61691dc11 100644
--- a/tests/arthur/lance/widgets.h
+++ b/tests/arthur/lance/widgets.h
@@ -56,6 +56,9 @@
#include <QFileDialog>
#include <QTextStream>
#include <QPaintEngine>
+#include <QSignalMapper>
+#include <QAction>
+
#include <private/qwindowsurface_p.h>
@@ -96,8 +99,8 @@ public:
OnScreenWidget(const QString &file, QWidget *parent = 0)
: T(parent),
- m_view_mode(RenderView),
- m_filename(file)
+ m_filename(file),
+ m_view_mode(RenderView)
{
QSettings settings("Trolltech", "lance");
for (int i=0; i<10; ++i) {
@@ -117,36 +120,36 @@ public:
}
if (m_baseline.isNull()) {
- setWindowTitle("Rendering: '" + file + "'. No baseline available");
+ T::setWindowTitle("Rendering: '" + file + "'. No baseline available");
} else {
- setWindowTitle("Rendering: '" + file + "'. Shortcuts: 1=render, 2=baseline, 3=difference");
+ T::setWindowTitle("Rendering: '" + file + "'. Shortcuts: 1=render, 2=baseline, 3=difference");
StupidWorkaround *workaround = new StupidWorkaround(this, &m_view_mode);
QSignalMapper *mapper = new QSignalMapper(this);
- connect(mapper, SIGNAL(mapped(int)), workaround, SLOT(setViewMode(int)));
- connect(mapper, SIGNAL(mapped(QString)), this, SLOT(setWindowTitle(QString)));
+ T::connect(mapper, SIGNAL(mapped(int)), workaround, SLOT(setViewMode(int)));
+ T::connect(mapper, SIGNAL(mapped(QString)), this, SLOT(setWindowTitle(QString)));
QAction *renderViewAction = new QAction("Render View", this);
renderViewAction->setShortcut(Qt::Key_1);
- connect(renderViewAction, SIGNAL(triggered()), mapper, SLOT(map()));
+ T::connect(renderViewAction, SIGNAL(triggered()), mapper, SLOT(map()));
mapper->setMapping(renderViewAction, RenderView);
mapper->setMapping(renderViewAction, "Render View: " + file);
- addAction(renderViewAction);
+ T::addAction(renderViewAction);
QAction *baselineAction = new QAction("Baseline", this);
baselineAction->setShortcut(Qt::Key_2);
- connect(baselineAction, SIGNAL(triggered()), mapper, SLOT(map()));
+ T::connect(baselineAction, SIGNAL(triggered()), mapper, SLOT(map()));
mapper->setMapping(baselineAction, BaselineView);
mapper->setMapping(baselineAction, "Baseline View: " + file);
- addAction(baselineAction);
+ T::addAction(baselineAction);
QAction *differenceAction = new QAction("Differenfe View", this);
differenceAction->setShortcut(Qt::Key_3);
- connect(differenceAction, SIGNAL(triggered()), mapper, SLOT(map()));
+ T::connect(differenceAction, SIGNAL(triggered()), mapper, SLOT(map()));
mapper->setMapping(differenceAction, DifferenceView);
mapper->setMapping(differenceAction, "Difference View" + file);
- addAction(differenceAction);
+ T::addAction(differenceAction);
}
@@ -178,7 +181,7 @@ public:
}
}
- void OnScreenWidget<T>::paintRenderView()
+ void paintRenderView()
{
QPainter pt;
QPaintDevice *dev = this;
@@ -233,7 +236,7 @@ public:
}
if (m_render_view.isNull()) {
- m_render_view = window()->windowSurface()->grabWidget(this);
+ m_render_view = T::window()->windowSurface()->grabWidget(this);
m_render_view.save("renderView.png");
}
}
@@ -242,7 +245,7 @@ public:
QPainter p(this);
if (m_baseline.isNull()) {
- p.drawText(rect(), Qt::AlignCenter,
+ p.drawText(T::rect(), Qt::AlignCenter,
"No baseline found\n"
"file '" + m_baseline_name + "' does not exist...");
return;
@@ -258,7 +261,7 @@ public:
QPixmap generateDifference()
{
- QImage img(size(), QImage::Format_RGB32);
+ QImage img(T::size(), QImage::Format_RGB32);
img.fill(0);
QPainter p(&img);
@@ -275,13 +278,13 @@ public:
void paintDifferenceView() {
QPainter p(this);
if (m_baseline.isNull()) {
- p.drawText(rect(), Qt::AlignCenter,
+ p.drawText(T::rect(), Qt::AlignCenter,
"No baseline found\n"
"file '" + m_baseline_name + "' does not exist...");
return;
}
- p.fillRect(rect(), Qt::black);
+ p.fillRect(T::rect(), Qt::black);
p.drawPixmap(0, 0, generateDifference());
}
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index b4a660003..d7f27bd1b 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -4,7 +4,7 @@ TEMPLATE = subdirs
!wince*:SUBDIRS += \
headers
-SUBDIRS += _networkselftest \
+SUBDIRS += \
bic \
collections \
compile \
@@ -13,10 +13,11 @@ SUBDIRS += _networkselftest \
linguist \
macgui \
macplist \
- mediaobject \
-# mediaobject_wince_ds9 \ This is Windows CE only (we test the second phonon backend ds9 here)
+ mediaobject \
+# mediaobject_wince_ds9 \ This is Windows CE only (we test the second phonon backend ds9 here)
moc \
modeltest \
+ networkselftest \
q3accel \
q3action \
q3actiongroup \
@@ -105,8 +106,6 @@ SUBDIRS += _networkselftest \
qdate \
qdatetime \
qdatetimeedit \
- qdbuspendingcall \
- qdbuspendingreply \
qdebug \
qdesktopservices \
qdesktopwidget \
@@ -140,6 +139,7 @@ SUBDIRS += _networkselftest \
qgetputenv \
qgl \
qglobal \
+ qgraphicsgridlayout \
qgraphicsitem \
qgraphicsitemanimation \
qgraphicslayout \
@@ -147,13 +147,14 @@ SUBDIRS += _networkselftest \
qgraphicslinearlayout \
qgraphicsobject \
qgraphicspixmapitem \
- qgraphicspolygonitem \
- qgraphicsproxywidget \
+ qgraphicspolygonitem \
+ qgraphicsproxywidget \
qgraphicsscene \
qgraphicssceneindex \
+ qgraphicstransform \
qgraphicsview \
qgraphicswidget \
- qgridlayout \
+ qgridlayout \
qgroupbox \
qguivariant \
qhash \
@@ -166,8 +167,8 @@ SUBDIRS += _networkselftest \
qhostaddress \
qhostinfo \
qhttp \
- qhttpnetworkreply \
- qhttpnetworkconnection \
+ qhttpnetworkreply \
+ qhttpnetworkconnection \
qicon \
qicoimageformat \
qimage \
@@ -190,7 +191,7 @@ SUBDIRS += _networkselftest \
qlibrary \
qline \
qlineedit \
- qlist \
+ qlist \
q3listbox \
qlistview \
qlistwidget \
@@ -212,12 +213,12 @@ SUBDIRS += _networkselftest \
qmutex \
qmutexlocker \
qnativesocketengine \
- qnetworkcookie \
- qnetworkcookiejar \
+ qnetworkcookie \
+ qnetworkcookiejar \
qnetworkinterface \
qnetworkproxy \
- qnetworkrequest \
- qnetworkreply \
+ qnetworkrequest \
+ qnetworkreply \
qnetworkaccessmanager_and_qprogressdialog \
qnumeric \
qobject \
@@ -236,8 +237,8 @@ SUBDIRS += _networkselftest \
qpixmapfilter \
qplaintextedit \
qpoint \
- qpointarray \
qpointer \
+ qpolygon \
qprinter \
qprinterinfo \
qprocess \
@@ -261,16 +262,17 @@ SUBDIRS += _networkselftest \
qscriptcontextinfo \
qscriptengine \
qscriptengineagent \
+ qscriptextqobject \
qscriptjstestsuite \
qscriptv8testsuite \
- qscriptqobject \
qscriptstring \
qscriptvalue \
qscriptvalueiterator \
qscriptenginedebugger \
qscrollarea \
qsemaphore \
- qsharedpointer \
+ qsharedpointer \
+ qsharedpointer_and_qwidget \
qsequentialanimationgroup \
qset \
qsettings \
@@ -284,6 +286,10 @@ SUBDIRS += _networkselftest \
qsocks5socketengine \
qsortfilterproxymodel \
qsound \
+ qaudiodeviceid \
+ qaudioformat \
+ qaudiooutput \
+ qaudioinput \
qspinbox \
qsplitter \
qsql \
@@ -347,7 +353,7 @@ SUBDIRS += _networkselftest \
qtextstream \
qtexttable \
qthread \
- qthreadonce \
+ qthreadonce \
qthreadstorage \
qtime \
qtimeline \
@@ -449,7 +455,9 @@ unix:!embedded:contains(QT_CONFIG, dbus):SUBDIRS += \
qdbusmarshall \
qdbusmetaobject \
qdbusmetatype \
- qdbusperformance \
+ qdbuspendingcall \
+ qdbuspendingreply \
+ qdbusperformance \
qdbusreply \
qdbusthreading \
qdbusxmlparser
diff --git a/tests/auto/linguist/lconvert/.gitignore b/tests/auto/linguist/lconvert/.gitignore
new file mode 100644
index 000000000..042d7ac30
--- /dev/null
+++ b/tests/auto/linguist/lconvert/.gitignore
@@ -0,0 +1,2 @@
+tst_lconvert
+data/plural-?.po
diff --git a/tests/auto/linguist/lrelease/.gitignore b/tests/auto/linguist/lrelease/.gitignore
new file mode 100644
index 000000000..cf7059c4b
--- /dev/null
+++ b/tests/auto/linguist/lrelease/.gitignore
@@ -0,0 +1,2 @@
+tst_lrelease
+testdata/*.qm
diff --git a/tests/auto/linguist/lrelease/testdata/idbased.ts b/tests/auto/linguist/lrelease/testdata/idbased.ts
new file mode 100644
index 000000000..61497deec
--- /dev/null
+++ b/tests/auto/linguist/lrelease/testdata/idbased.ts
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0">
+<context>
+ <name></name>
+ <message id="test_id">
+ <source>Completely irrelevant source text</source>
+ <translation>This is a test string.</translation>
+ </message>
+ <message id="untranslated_id">
+ <source>This has no translation.</source>
+ </message>
+ <message id="this_another_id">
+ <source>Foo bar.</source>
+ <comment>Warn me!</comment>
+ </message>
+ <message>
+ <source>Drop me!</source>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/linguist/lupdate/.gitignore b/tests/auto/linguist/lupdate/.gitignore
new file mode 100644
index 000000000..4ba5b79ec
--- /dev/null
+++ b/tests/auto/linguist/lupdate/.gitignore
@@ -0,0 +1,4 @@
+tst_lupdate
+testdata/good/*/project.ts
+testdata/output_ts/toplevel/library/tools/translations/project.ts
+testdata/recursivescan/*.ts
diff --git a/tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result
index 151a18ed5..f2d109b57 100644
--- a/tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result
+++ b/tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
-<TS version="1.1">
+<TS version="2.0">
<context>
<name>QApplication</name>
<message>
- <location filename="../src/main.cpp" line="13"/>
+ <location filename="../src/main.cpp" line="10"/>
<source>QT_LAYOUT_DIRECTION</source>
<comment>Translate this string to the string &apos;LTR&apos; in left-to-right languages or to &apos;RTL&apos; in right-to-left languages (such as Hebrew and Arabic) to get proper widget layout.</comment>
<translation type="unfinished"></translation>
diff --git a/tests/auto/linguist/lupdate/tst_lupdate.cpp b/tests/auto/linguist/lupdate/tst_lupdate.cpp
index fcf85825b..97400d934 100644
--- a/tests/auto/linguist/lupdate/tst_lupdate.cpp
+++ b/tests/auto/linguist/lupdate/tst_lupdate.cpp
@@ -93,13 +93,24 @@ void tst_lupdate::doCompare(const QStringList &actual, const QString &expectedFn
} else if (i == ei) {
ei = 0;
break;
- } else if (err ? !QRegExp(expected.at(i)).exactMatch(actual.at(i)) :
- (actual.at(i) != expected.at(i))) {
- while ((ei - 1) >= i && (gi - 1) >= i &&
- (err ? QRegExp(expected.at(ei - 1)).exactMatch(actual.at(gi - 1)) :
- (actual.at(gi - 1) == expected.at(ei - 1))))
- ei--, gi--;
- break;
+ } else {
+ QString act = actual.at(i);
+ act.remove('\r');
+ if (err ? !QRegExp(expected.at(i)).exactMatch(act) :
+ (act != expected.at(i))) {
+ bool cond = true;
+ while (cond) {
+ act = actual.at(gi - 1);
+ act.remove('\r');
+ cond = (ei - 1) >= i && (gi - 1) >= i &&
+ (err ? QRegExp(expected.at(ei - 1)).exactMatch(act) :
+ (act == expected.at(ei - 1)));
+ if (cond) {
+ ei--, gi--;
+ }
+ }
+ break;
+ }
}
}
QByteArray diff;
diff --git a/tests/auto/macgui/macgui.pro b/tests/auto/macgui/macgui.pro
index dc646278a..0ed2350a4 100644
--- a/tests/auto/macgui/macgui.pro
+++ b/tests/auto/macgui/macgui.pro
@@ -4,12 +4,8 @@ DEPENDPATH += .
INCLUDEPATH += .
# Input
-SOURCES += tst_gui.cpp
-
-mac {
- SOURCES += guitest.cpp
- HEADERS += guitest.h
-}
-
+SOURCES += tst_macgui.cpp guitest.cpp
+HEADERS += guitest.h
+requires(mac)
diff --git a/tests/auto/macgui/tst_gui.cpp b/tests/auto/macgui/tst_macgui.cpp
index 635023a3b..627dc82d5 100644
--- a/tests/auto/macgui/tst_gui.cpp
+++ b/tests/auto/macgui/tst_macgui.cpp
@@ -52,7 +52,7 @@
#ifdef Q_OS_MAC
-class tst_gui : public GuiTester
+class tst_MacGui : public GuiTester
{
Q_OBJECT
private slots:
@@ -76,7 +76,7 @@ QPixmap grabWindowContents(QWidget * widget)
Test that vertical and horizontal mac-style scrollbars paint their
entire area.
*/
-void tst_gui::scrollbarPainting()
+void tst_MacGui::scrollbarPainting()
{
ColorWidget colorWidget;
colorWidget.resize(400, 400);
@@ -108,7 +108,7 @@ void tst_gui::scrollbarPainting()
// When running the auto-tests on scruffy, the first enter-the-event-loop-and-wait-for-a-click
// test that runs always times out, so we have this dummy test.
-void tst_gui::dummy()
+void tst_MacGui::dummy()
{
QPixmap pix(100, 100);
QSplashScreen splash(pix);
@@ -133,7 +133,7 @@ void tst_gui::dummy()
/*
Test that a message box pops up in front of a QSplashScreen.
*/
-void tst_gui::splashScreenModality()
+void tst_MacGui::splashScreenModality()
{
QPixmap pix(300, 300);
QSplashScreen splash(pix);
@@ -162,7 +162,7 @@ void tst_gui::splashScreenModality()
Test that a non-modal dialog created as a child of a modal dialog is
shown in front.
*/
-void tst_gui::dialogModality()
+void tst_MacGui::dialogModality()
{
QDialog d;
d.setModal(true);
@@ -222,7 +222,7 @@ void PrimaryWindowDialog::test()
of the dialog even if the dialog becomes modal after the child window
is created.
*/
-void tst_gui::nonModalOrder()
+void tst_MacGui::nonModalOrder()
{
clearSequence();
PrimaryWindowDialog primary;
@@ -235,7 +235,7 @@ void tst_gui::nonModalOrder()
/*
Test that the QSpinBox buttons are correctly positioned with the Mac style.
*/
-void tst_gui::spinBoxArrowButtons()
+void tst_MacGui::spinBoxArrowButtons()
{
ColorWidget colorWidget;
colorWidget.resize(200, 200);
@@ -266,7 +266,7 @@ void tst_gui::spinBoxArrowButtons()
QVERIFY(noFocus.copy(compareRect) == focus.copy(compareRect));
}
-QTEST_MAIN(tst_gui)
+QTEST_MAIN(tst_MacGui)
#else
@@ -274,4 +274,5 @@ QTEST_NOOP_MAIN
#endif
-#include "tst_gui.moc"
+#include "tst_macgui.moc"
+
diff --git a/tests/auto/_networkselftest/_networkselftest.pro b/tests/auto/networkselftest/networkselftest.pro
index 9e2ad0e91..9e2ad0e91 100644
--- a/tests/auto/_networkselftest/_networkselftest.pro
+++ b/tests/auto/networkselftest/networkselftest.pro
diff --git a/tests/auto/_networkselftest/tst_networkselftest.cpp b/tests/auto/networkselftest/tst_networkselftest.cpp
index cb8273321..cb8273321 100644
--- a/tests/auto/_networkselftest/tst_networkselftest.cpp
+++ b/tests/auto/networkselftest/tst_networkselftest.cpp
diff --git a/tests/auto/q3progressbar/tst_q3progressbar.cpp b/tests/auto/q3progressbar/tst_q3progressbar.cpp
index 0378d1536..549c8a40e 100644
--- a/tests/auto/q3progressbar/tst_q3progressbar.cpp
+++ b/tests/auto/q3progressbar/tst_q3progressbar.cpp
@@ -102,7 +102,7 @@ void tst_Q3ProgressBar::setProgress()
{
MyCustomProgressBar * m_progressBar = new MyCustomProgressBar();
m_progressBar->show();
- QTest::qWait(500);
+ QApplication::processEvents();
//case with total steps = 0
m_progressBar->setTotalSteps(0);
@@ -110,15 +110,16 @@ void tst_Q3ProgressBar::setProgress()
m_progressBar->paintNumber = 0;
m_progressBar->setProgress(m_progressBar->progress() + 1);
QCOMPARE(oldValue + 1,m_progressBar->progress());
- QCOMPARE(m_progressBar->paintNumber,1);
+ QApplication::processEvents();
+ QVERIFY(m_progressBar->paintNumber >= 1); //it might be more than 1 because it is animated
//standard case
m_progressBar->setTotalSteps(3);
m_progressBar->setProgress(0);
m_progressBar->paintNumber = 0;
m_progressBar->setProgress(m_progressBar->progress() + 1);
+ QApplication::processEvents();
QCOMPARE(m_progressBar->paintNumber,1);
-
}
QTEST_MAIN(tst_Q3ProgressBar)
diff --git a/tests/auto/qaccessibility_mac/qaccessibility_mac.pro b/tests/auto/qaccessibility_mac/qaccessibility_mac.pro
index b6829dc2f..47f72d1cd 100644
--- a/tests/auto/qaccessibility_mac/qaccessibility_mac.pro
+++ b/tests/auto/qaccessibility_mac/qaccessibility_mac.pro
@@ -4,21 +4,20 @@ TARGET = tst_qaccessibility_mac
RESOURCES = qaccessibility_mac.qrc
-mac {
+requires(mac)
+
# this setup should support both building as an autotest
# (where uilib isn't built by default), and when running shadow
# builds (where QTDIR points to the build directory).
# autotest + shadow build is not supported :)
- exists($$(QTDIR)/tools/designer/src/lib/uilib/uilib.pri) {
- include($$(QTDIR)/tools/designer/src/lib/uilib/uilib.pri)
- INCLUDEPATH += $$(QTDIR)/tools/designer/src/uitools
- SOURCES += $$(QTDIR)/tools/designer/src/uitools/quiloader.cpp
- HEADERS += $$(QTDIR)/tools/designer/src/uitools/quiloader.h
- } else {
- CONFIG += uitools
- }
- QT += xml
- LIBS += -framework ApplicationServices -framework Carbon
+exists($$(QTDIR)/tools/designer/src/lib/uilib/uilib.pri) {
+ include($$(QTDIR)/tools/designer/src/lib/uilib/uilib.pri, "", true)
+ INCLUDEPATH += $$(QTDIR)/tools/designer/src/uitools
+ SOURCES += $$(QTDIR)/tools/designer/src/uitools/quiloader.cpp
+ HEADERS += $$(QTDIR)/tools/designer/src/uitools/quiloader.h
+} else {
+ CONFIG += uitools
}
-
+QT += xml
+LIBS += -framework ApplicationServices -framework Carbon
diff --git a/tests/auto/qaccessibility_mac/tst_qaccessibility_mac.cpp b/tests/auto/qaccessibility_mac/tst_qaccessibility_mac.cpp
index deb6c8dea..b32aa0e00 100644
--- a/tests/auto/qaccessibility_mac/tst_qaccessibility_mac.cpp
+++ b/tests/auto/qaccessibility_mac/tst_qaccessibility_mac.cpp
@@ -73,7 +73,7 @@ Q_DECLARE_METATYPE(AXUIElementRef);
typedef QCFType<CFArrayRef> QCFArrayRef;
-class tst_accessibility_mac : public QObject
+class tst_qaccessibility_mac : public QObject
{
Q_OBJECT
public slots:
@@ -665,7 +665,7 @@ void testAppAndForm(AXUIElementRef application)
VERIFY_ELEMENT(form, application, "AXWindow");
}
-void tst_accessibility_mac::printInfo()
+void tst_qaccessibility_mac::printInfo()
{
AXUIElementRef currentApplication = AXUIElementCreateApplication(getpid());
printElementInfo(currentApplication);
@@ -674,7 +674,7 @@ void tst_accessibility_mac::printInfo()
/*
Tests for form.ui
*/
-void tst_accessibility_mac::testForm()
+void tst_qaccessibility_mac::testForm()
{
// Get reference to the current application.
AXUIElementRef currentApplication = AXUIElementCreateApplication(getpid());
@@ -685,7 +685,7 @@ void tst_accessibility_mac::testForm()
/*
Tests for buttons.ui
*/
-void tst_accessibility_mac::testButtons()
+void tst_qaccessibility_mac::testButtons()
{
// Get reference to the current application.
AXUIElementRef currentApplication = AXUIElementCreateApplication(getpid());
@@ -714,7 +714,7 @@ void tst_accessibility_mac::testButtons()
VERIFY_ROLE_DESCRIPTION(brain, "button");
}
-void tst_accessibility_mac::testLabel()
+void tst_qaccessibility_mac::testLabel()
{
// Get reference to the current application.
AXUIElementRef currentApplication = AXUIElementCreateApplication(getpid());
@@ -731,7 +731,7 @@ void tst_accessibility_mac::testLabel()
/*
Tests for lineedit.ui
*/
-void tst_accessibility_mac::testLineEdit()
+void tst_qaccessibility_mac::testLineEdit()
{
// Get reference to the current application.
AXUIElementRef currentApplication = AXUIElementCreateApplication(getpid());
@@ -746,7 +746,7 @@ void tst_accessibility_mac::testLineEdit()
/*
Tests for groups.ui
*/
-void tst_accessibility_mac::testGroups()
+void tst_qaccessibility_mac::testGroups()
{
// Get reference to the current application.
AXUIElementRef currentApplication = AXUIElementCreateApplication(getpid());
@@ -769,7 +769,7 @@ void tst_accessibility_mac::testGroups()
/*
Tests for tabs.ui
*/
-void tst_accessibility_mac::testTabWidget()
+void tst_qaccessibility_mac::testTabWidget()
{
{ // Test that the QTabWidget hierarchy is what we expect it to be.
QTabWidget tabWidget;
@@ -878,7 +878,7 @@ void tst_accessibility_mac::testTabWidget()
}
}
-void tst_accessibility_mac::testTabBar()
+void tst_qaccessibility_mac::testTabBar()
{
QTabBar tabBar;
tabBar.addTab("Tab A");
@@ -929,7 +929,7 @@ void tst_accessibility_mac::testTabBar()
}
}
-void tst_accessibility_mac::testComboBox()
+void tst_qaccessibility_mac::testComboBox()
{
// Get reference to the current application.
AXUIElementRef currentApplication = AXUIElementCreateApplication(getpid());
@@ -945,7 +945,7 @@ void tst_accessibility_mac::testComboBox()
QVERIFY(performAction(comboBox, "AXPress"));
}
-void tst_accessibility_mac::testDeleteWidget()
+void tst_qaccessibility_mac::testDeleteWidget()
{
const QString buttonTitle = "Hi there";
QWidget *form = new QWidget(0, Qt::Window);
@@ -969,7 +969,7 @@ void tst_accessibility_mac::testDeleteWidget()
delete form;
}
-void tst_accessibility_mac::testDeleteWidgets()
+void tst_qaccessibility_mac::testDeleteWidgets()
{
const QString buttonTitle = "Hi there";
const int repeats = 10;
@@ -1052,7 +1052,7 @@ void tst_accessibility_mac::testDeleteWidgets()
}
-void tst_accessibility_mac::testMultipleWindows()
+void tst_qaccessibility_mac::testMultipleWindows()
{
const QString formATitle("FormA");
const QString formBTitle("FormB");
@@ -1082,7 +1082,7 @@ void tst_accessibility_mac::testMultipleWindows()
delete formA;
}
-void tst_accessibility_mac::testHiddenWidgets()
+void tst_qaccessibility_mac::testHiddenWidgets()
{
const QString windowTitle ="a widget";
QWidget * const window = new QWidget(0);
@@ -1113,7 +1113,7 @@ void tst_accessibility_mac::testHiddenWidgets()
delete window;
};
-void tst_accessibility_mac::testActions()
+void tst_qaccessibility_mac::testActions()
{
// create a window with a push button
const QString windowTitle ="a widget";
@@ -1150,7 +1150,7 @@ void tst_accessibility_mac::testActions()
delete window;
};
-void tst_accessibility_mac::testChangeState()
+void tst_qaccessibility_mac::testChangeState()
{
const QString windowTitle ="a widget";
QWidget * const window = new QWidget();
@@ -1220,7 +1220,7 @@ void tst_accessibility_mac::testChangeState()
delete window;
}
-void tst_accessibility_mac::testSlider()
+void tst_qaccessibility_mac::testSlider()
{
const QString windowTitle = "a widget";
QWidget * const window = new QWidget();
@@ -1246,7 +1246,7 @@ void tst_accessibility_mac::testSlider()
delete slider;
}
-void tst_accessibility_mac::testScrollArea()
+void tst_qaccessibility_mac::testScrollArea()
{
QWidget window;
const QString windowTitle = "window";
@@ -1373,7 +1373,7 @@ void tst_accessibility_mac::testScrollArea()
}
}
-void tst_accessibility_mac::testListView()
+void tst_qaccessibility_mac::testListView()
{
QWidget window;
const QString windowTitle("window");
@@ -1457,7 +1457,7 @@ void tst_accessibility_mac::testListView()
QVERIFY(contains(listElement, C));
}
-void tst_accessibility_mac::testTableView()
+void tst_qaccessibility_mac::testTableView()
{
QWidget window;
const QString windowTitle("window");
@@ -1653,7 +1653,7 @@ void tst_accessibility_mac::testTableView()
// QTest::qWait(1000000);
}
-void tst_accessibility_mac::testScrollBar()
+void tst_qaccessibility_mac::testScrollBar()
{
{
QScrollBar scrollBar;
@@ -1699,7 +1699,7 @@ void tst_accessibility_mac::testScrollBar()
}
}
-void tst_accessibility_mac::testSplitter()
+void tst_qaccessibility_mac::testSplitter()
{
const AXUIElementRef currentApplication = AXUIElementCreateApplication(getpid());
testAppAndForm(currentApplication);
@@ -1736,7 +1736,7 @@ void tst_accessibility_mac::testSplitter()
}
}
-void tst_accessibility_mac::testTextEdit()
+void tst_qaccessibility_mac::testTextEdit()
{
QWidget window;
const QString windowTitle("window");
@@ -1802,13 +1802,13 @@ void testModelLessItemView(QAbstractItemView *itemView, const QByteArray &role)
delete itemView;
}
-void tst_accessibility_mac::testItemViewsWithoutModel()
+void tst_qaccessibility_mac::testItemViewsWithoutModel()
{
testModelLessItemView(new QListView(), "AXList");
testModelLessItemView(new QTableView(), "AXTable");
}
-void tst_accessibility_mac::testQAElement()
+void tst_qaccessibility_mac::testQAElement()
{
{
QAElement element;
@@ -1831,7 +1831,7 @@ void tst_accessibility_mac::testQAElement()
}
-void tst_accessibility_mac::testQAInterface()
+void tst_qaccessibility_mac::testQAInterface()
{
{
QAInterface interface;
@@ -1861,7 +1861,7 @@ void tst_accessibility_mac::testQAInterface()
}
}
-void tst_accessibility_mac::uitests_data()
+void tst_qaccessibility_mac::uitests_data()
{
QTest::addColumn<QString>("uiFilename");
QTest::addColumn<QString>("testSlot");
@@ -1877,7 +1877,7 @@ void tst_accessibility_mac::uitests_data()
QTest::newRow("splitters") << "splitters.ui" << SLOT(testSplitter());
}
-void tst_accessibility_mac::uitests()
+void tst_qaccessibility_mac::uitests()
{
QFETCH(QString, uiFilename);
QFETCH(QString, testSlot);
@@ -1907,7 +1907,7 @@ void tst_accessibility_mac::uitests()
delete window;
}
-void tst_accessibility_mac::tests_data()
+void tst_qaccessibility_mac::tests_data()
{
QTest::addColumn<QString>("testSlot");
QTest::newRow("deleteWidget") << SLOT(testDeleteWidget());
@@ -1925,7 +1925,7 @@ void tst_accessibility_mac::tests_data()
QTest::newRow("tabbar") << SLOT(testTabBar());
}
-void tst_accessibility_mac::tests()
+void tst_qaccessibility_mac::tests()
{
QFETCH(QString, testSlot);
runTest(testSlot);
@@ -1936,7 +1936,7 @@ void tst_accessibility_mac::tests()
kAXErrorAPIDisabled error, indicating that the accessible API is disabled, which it isn't.)
To work around this, we run the tests in a callback slot called from the main event loop.
*/
-void tst_accessibility_mac::runTest(const QString &testSlot)
+void tst_qaccessibility_mac::runTest(const QString &testSlot)
{
// The Accessibility interface must be enabled to run this test.
if (!AXAPIEnabled())
@@ -1953,7 +1953,7 @@ void tst_accessibility_mac::runTest(const QString &testSlot)
}
-QTEST_APPLESS_MAIN(tst_accessibility_mac)
+QTEST_APPLESS_MAIN(tst_qaccessibility_mac)
#else // defined(Q_WS_MAC) && !defined (QT_MAC_USE_COCOA)
diff --git a/tests/auto/qaudiodeviceid/qaudiodeviceid.pro b/tests/auto/qaudiodeviceid/qaudiodeviceid.pro
new file mode 100644
index 000000000..e0c7d4df8
--- /dev/null
+++ b/tests/auto/qaudiodeviceid/qaudiodeviceid.pro
@@ -0,0 +1,7 @@
+load(qttest_p4)
+
+DEFINES += SRCDIR=\\\"$$PWD/\\\"
+
+SOURCES += tst_qaudiodeviceid.cpp
+
+QT = core multimedia
diff --git a/tests/auto/qaudiodeviceid/tst_qaudiodeviceid.cpp b/tests/auto/qaudiodeviceid/tst_qaudiodeviceid.cpp
new file mode 100644
index 000000000..d40118b24
--- /dev/null
+++ b/tests/auto/qaudiodeviceid/tst_qaudiodeviceid.cpp
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QtCore/qlocale.h>
+#include <qaudiodeviceid.h>
+#include <qaudiodeviceinfo.h>
+
+#include <QStringList>
+#include <QList>
+
+
+class tst_QAudioDeviceId : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QAudioDeviceId(QObject* parent=0) : QObject(parent) {}
+
+private slots:
+ void checkNull();
+ void checkEquality();
+};
+
+void tst_QAudioDeviceId::checkNull()
+{
+ // Default constructed is null.
+ QAudioDeviceId deviceId0;
+ QVERIFY(deviceId0.isNull());
+
+ // Null is transferred
+ QAudioDeviceId deviceId1(deviceId0);
+ QVERIFY(deviceId1.isNull());
+}
+
+void tst_QAudioDeviceId::checkEquality()
+{
+ QAudioDeviceId deviceId0;
+ QAudioDeviceId deviceId1;
+
+ // Null ids are equivalent
+ QVERIFY(deviceId0 == deviceId1);
+ QVERIFY(!(deviceId0 != deviceId1));
+
+ deviceId1 = QAudioDeviceInfo::defaultOutputDevice();
+
+ // Different
+ QVERIFY(deviceId0 != deviceId1);
+ QVERIFY(!(deviceId0 == deviceId1));
+
+ // Same
+ deviceId0 = deviceId1;
+
+ QVERIFY(deviceId0 == deviceId1);
+ QVERIFY(!(deviceId0 != deviceId1));
+}
+
+QTEST_MAIN(tst_QAudioDeviceId)
+
+#include "tst_qaudiodeviceid.moc"
diff --git a/tests/auto/qaudiodeviceinfo/qaudiodeviceinfo.pro b/tests/auto/qaudiodeviceinfo/qaudiodeviceinfo.pro
new file mode 100644
index 000000000..695987c9e
--- /dev/null
+++ b/tests/auto/qaudiodeviceinfo/qaudiodeviceinfo.pro
@@ -0,0 +1,7 @@
+load(qttest_p4)
+
+DEFINES += SRCDIR=\\\"$$PWD/\\\"
+
+SOURCES += tst_qaudiodeviceinfo.cpp
+
+QT = core multimedia
diff --git a/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp b/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp
new file mode 100644
index 000000000..c2cd97e34
--- /dev/null
+++ b/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp
@@ -0,0 +1,159 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtTest/QtTest>
+#include <QtCore/qlocale.h>
+#include <qaudiodeviceinfo.h>
+
+#include <QStringList>
+#include <QList>
+
+
+class tst_QAudioDeviceInfo : public QObject
+{
+ Q_OBJECT
+public:
+ tst_QAudioDeviceInfo(QObject* parent=0) : QObject(parent) {}
+
+private slots:
+ void checkAvailableDefaultInput();
+ void checkAvailableDefaultOutput();
+ void outputList();
+ void codecs();
+ void channels();
+ void sampleSizes();
+ void byteOrders();
+ void sampleTypes();
+ void frequencies();
+ void isformat();
+ void preferred();
+ void nearest();
+
+private:
+ QAudioDeviceInfo* device;
+};
+
+void tst_QAudioDeviceInfo::checkAvailableDefaultInput()
+{
+ QVERIFY(!QAudioDeviceInfo::defaultInputDevice().isNull());
+}
+
+void tst_QAudioDeviceInfo::checkAvailableDefaultOutput()
+{
+ QVERIFY(!QAudioDeviceInfo::defaultOutputDevice().isNull());
+}
+
+void tst_QAudioDeviceInfo::outputList()
+{
+ QList<QAudioDeviceId> devices = QAudioDeviceInfo::deviceList(QAudio::AudioOutput);
+ QVERIFY(devices.size() > 0);
+ device = new QAudioDeviceInfo(devices.at(0), this);
+}
+
+void tst_QAudioDeviceInfo::codecs()
+{
+ QStringList avail = device->supportedCodecs();
+ QVERIFY(avail.size() > 0);
+}
+
+void tst_QAudioDeviceInfo::channels()
+{
+ QList<int> avail = device->supportedChannels();
+ QVERIFY(avail.size() > 0);
+}
+
+void tst_QAudioDeviceInfo::sampleSizes()
+{
+ QList<int> avail = device->supportedSampleSizes();
+ QVERIFY(avail.size() > 0);
+}
+
+void tst_QAudioDeviceInfo::byteOrders()
+{
+ QList<QAudioFormat::Endian> avail = device->supportedByteOrders();
+ QVERIFY(avail.size() > 0);
+}
+
+void tst_QAudioDeviceInfo::sampleTypes()
+{
+ QList<QAudioFormat::SampleType> avail = device->supportedSampleTypes();
+ QVERIFY(avail.size() > 0);
+}
+
+void tst_QAudioDeviceInfo::frequencies()
+{
+ QList<int> avail = device->supportedFrequencies();
+ QVERIFY(avail.size() > 0);
+}
+
+void tst_QAudioDeviceInfo::isformat()
+{
+ QAudioFormat format;
+ format.setFrequency(44100);
+ format.setChannels(2);
+ format.setSampleType(QAudioFormat::SignedInt);
+ format.setByteOrder(QAudioFormat::LittleEndian);
+ format.setSampleSize(16);
+ format.setCodec("audio/pcm");
+
+ // Should always be true for these format
+ QVERIFY(device->isFormatSupported(format));
+}
+
+void tst_QAudioDeviceInfo::preferred()
+{
+ QAudioFormat format = device->preferredFormat();
+ QVERIFY(format.frequency() == 44100);
+ QVERIFY(format.channels() == 2);
+}
+
+void tst_QAudioDeviceInfo::nearest()
+{
+ QAudioFormat format1, format2;
+ format1.setFrequency(8000);
+ format2 = device->nearestFormat(format1);
+ QVERIFY(format2.frequency() == 44100);
+}
+
+QTEST_MAIN(tst_QAudioDeviceInfo)
+
+#include "tst_qaudiodeviceinfo.moc"
diff --git a/tests/auto/qaudioformat/qaudioformat.pro b/tests/auto/qaudioformat/qaudioformat.pro
new file mode 100644
index 000000000..78962d706
--- /dev/null
+++ b/tests/auto/qaudioformat/qaudioformat.pro
@@ -0,0 +1,7 @@
+load(qttest_p4)
+
+DEFINES += SRCDIR=\\\"$$PWD/\\\"
+
+SOURCES += tst_qaudioformat.cpp
+
+QT = core multimedia
diff --git a/tests/auto/qaudioformat/tst_qaudioformat.cpp b/tests/auto/qaudioformat/tst_qaudioformat.cpp
new file mode 100644
index 000000000..bcfc78f38
--- /dev/null
+++ b/tests/auto/qaudioformat/tst_qaudioformat.cpp
@@ -0,0 +1,180 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtTest/QtTest>
+#include <QtCore/qlocale.h>
+#include <qaudioformat.h>
+
+#include <QStringList>
+#include <QList>
+
+
+class tst_QAudioFormat : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QAudioFormat(QObject* parent=0) : QObject(parent) {}
+
+private slots:
+ void checkNull();
+ void checkFrequency();
+ void checkChannels();
+ void checkSampleSize();
+ void checkCodec();
+ void checkByteOrder();
+ void checkSampleType();
+ void checkEquality();
+ void checkAssignment();
+};
+
+void tst_QAudioFormat::checkNull()
+{
+ // Default constructed QAudioFormat is null.
+ QAudioFormat audioFormat0;
+ QVERIFY(audioFormat0.isNull());
+
+ // Null is transferred
+ QAudioFormat audioFormat1(audioFormat0);
+ QVERIFY(audioFormat1.isNull());
+
+ // Null is voided on activity
+ audioFormat0.setFrequency(44100);
+ QVERIFY(!audioFormat0.isNull());
+}
+
+void tst_QAudioFormat::checkFrequency()
+{
+ QAudioFormat audioFormat;
+ audioFormat.setFrequency(44100);
+ QVERIFY(audioFormat.frequency() == 44100);
+}
+
+void tst_QAudioFormat::checkChannels()
+{
+ QAudioFormat audioFormat;
+ audioFormat.setChannels(2);
+ QVERIFY(audioFormat.channels() == 2);
+}
+
+void tst_QAudioFormat::checkSampleSize()
+{
+ QAudioFormat audioFormat;
+ audioFormat.setSampleSize(16);
+ QVERIFY(audioFormat.sampleSize() == 16);
+}
+
+void tst_QAudioFormat::checkCodec()
+{
+ QAudioFormat audioFormat;
+ audioFormat.setCodec(QString::fromLatin1("audio/pcm"));
+ QVERIFY(audioFormat.codec() == QString::fromLatin1("audio/pcm"));
+}
+
+void tst_QAudioFormat::checkByteOrder()
+{
+ QAudioFormat audioFormat;
+ audioFormat.setByteOrder(QAudioFormat::LittleEndian);
+ QVERIFY(audioFormat.byteOrder() == QAudioFormat::LittleEndian);
+}
+
+void tst_QAudioFormat::checkSampleType()
+{
+ QAudioFormat audioFormat;
+ audioFormat.setSampleType(QAudioFormat::SignedInt);
+ QVERIFY(audioFormat.sampleType() == QAudioFormat::SignedInt);
+}
+
+void tst_QAudioFormat::checkEquality()
+{
+ QAudioFormat audioFormat0;
+ QAudioFormat audioFormat1;
+
+ // Null formats are equivalent
+ QVERIFY(audioFormat0 == audioFormat1);
+ QVERIFY(!(audioFormat0 != audioFormat1));
+
+ // on filled formats
+ audioFormat0.setFrequency(8000);
+ audioFormat0.setChannels(1);
+ audioFormat0.setSampleSize(8);
+ audioFormat0.setCodec("audio/pcm");
+ audioFormat0.setByteOrder(QAudioFormat::LittleEndian);
+ audioFormat0.setSampleType(QAudioFormat::UnSignedInt);
+
+ audioFormat1.setFrequency(8000);
+ audioFormat1.setChannels(1);
+ audioFormat1.setSampleSize(8);
+ audioFormat1.setCodec("audio/pcm");
+ audioFormat1.setByteOrder(QAudioFormat::LittleEndian);
+ audioFormat1.setSampleType(QAudioFormat::UnSignedInt);
+
+ QVERIFY(audioFormat0 == audioFormat1);
+ QVERIFY(!(audioFormat0 != audioFormat1));
+
+ audioFormat0.setFrequency(44100);
+ QVERIFY(audioFormat0 != audioFormat1);
+ QVERIFY(!(audioFormat0 == audioFormat1));
+}
+
+void tst_QAudioFormat::checkAssignment()
+{
+ QAudioFormat audioFormat0;
+ QAudioFormat audioFormat1;
+
+ audioFormat0.setFrequency(8000);
+ audioFormat0.setChannels(1);
+ audioFormat0.setSampleSize(8);
+ audioFormat0.setCodec("audio/pcm");
+ audioFormat0.setByteOrder(QAudioFormat::LittleEndian);
+ audioFormat0.setSampleType(QAudioFormat::UnSignedInt);
+
+ audioFormat1 = audioFormat0;
+ QVERIFY(audioFormat1 == audioFormat0);
+
+ QAudioFormat audioFormat2(audioFormat0);
+ QVERIFY(audioFormat2 == audioFormat0);
+}
+
+QTEST_MAIN(tst_QAudioFormat)
+
+#include "tst_qaudioformat.moc"
diff --git a/tests/auto/qaudioinput/qaudioinput.pro b/tests/auto/qaudioinput/qaudioinput.pro
new file mode 100644
index 000000000..8a0374988
--- /dev/null
+++ b/tests/auto/qaudioinput/qaudioinput.pro
@@ -0,0 +1,7 @@
+load(qttest_p4)
+
+DEFINES += SRCDIR=\\\"$$PWD/\\\"
+
+SOURCES += tst_qaudioinput.cpp
+
+QT = core multimedia
diff --git a/tests/auto/qaudioinput/tst_qaudioinput.cpp b/tests/auto/qaudioinput/tst_qaudioinput.cpp
new file mode 100644
index 000000000..6e16320d0
--- /dev/null
+++ b/tests/auto/qaudioinput/tst_qaudioinput.cpp
@@ -0,0 +1,120 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QtCore/qlocale.h>
+#include <qaudioinput.h>
+#include <qaudiodeviceinfo.h>
+#include <qaudio.h>
+#include <qaudioformat.h>
+
+
+class tst_QAudioInput : public QObject
+{
+ Q_OBJECT
+public:
+ tst_QAudioInput(QObject* parent=0) : QObject(parent) {}
+
+private slots:
+ void initTestCase();
+ void settings();
+ void notifyInterval();
+ void pullFile();
+
+private:
+ QAudioFormat format;
+ QAudioInput* audio;
+};
+
+void tst_QAudioInput::initTestCase()
+{
+ format.setFrequency(8000);
+ format.setChannels(1);
+ format.setSampleSize(8);
+ format.setCodec("audio/pcm");
+ format.setByteOrder(QAudioFormat::LittleEndian);
+ format.setSampleType(QAudioFormat::UnSignedInt);
+
+ audio = new QAudioInput(format, this);
+}
+
+void tst_QAudioInput::settings()
+{
+ QAudioFormat f = audio->format();
+
+ QVERIFY(format.channels() == f.channels());
+ QVERIFY(format.frequency() == f.frequency());
+ QVERIFY(format.sampleSize() == f.sampleSize());
+ QVERIFY(format.codec() == f.codec());
+ QVERIFY(format.byteOrder() == f.byteOrder());
+ QVERIFY(format.sampleType() == f.sampleType());
+}
+
+void tst_QAudioInput::notifyInterval()
+{
+ QVERIFY(audio->notifyInterval() == 1000); // Default
+
+ audio->setNotifyInterval(500);
+ QVERIFY(audio->notifyInterval() == 500); // Custom
+
+ audio->setNotifyInterval(1000); // reset
+}
+
+void tst_QAudioInput::pullFile()
+{
+ QFile filename(SRCDIR "test.raw");
+ filename.open( QIODevice::WriteOnly | QIODevice::Truncate );
+
+ QSignalSpy readSignal(audio, SIGNAL(notify()));
+ audio->start(&filename);
+
+ QTest::qWait(5000);
+
+ QVERIFY(readSignal.count() > 0);
+ QVERIFY(audio->totalTime() > 0);
+
+ audio->stop();
+ filename.close();
+}
+
+QTEST_MAIN(tst_QAudioInput)
+
+#include "tst_qaudioinput.moc"
diff --git a/tests/auto/qaudiooutput/4.wav b/tests/auto/qaudiooutput/4.wav
new file mode 100644
index 000000000..e31b06090
--- /dev/null
+++ b/tests/auto/qaudiooutput/4.wav
Binary files differ
diff --git a/tests/auto/qaudiooutput/qaudiooutput.pro b/tests/auto/qaudiooutput/qaudiooutput.pro
new file mode 100644
index 000000000..6c07c645e
--- /dev/null
+++ b/tests/auto/qaudiooutput/qaudiooutput.pro
@@ -0,0 +1,12 @@
+load(qttest_p4)
+
+DEFINES += SRCDIR=\\\"$$PWD/\\\"
+
+SOURCES += tst_qaudiooutput.cpp
+
+QT = core multimedia
+
+wince*: {
+ deploy.sources += 4.wav
+ DEPLOYMENT = deploy
+}
diff --git a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp
new file mode 100644
index 000000000..0f94faaf8
--- /dev/null
+++ b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp
@@ -0,0 +1,156 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+
+#include <QtTest/QtTest>
+#include <QtCore/qlocale.h>
+#include <qaudiooutput.h>
+#include <qaudiodeviceinfo.h>
+#include <qaudio.h>
+#include <qaudioformat.h>
+
+
+class tst_QAudioOutput : public QObject
+{
+ Q_OBJECT
+public:
+ tst_QAudioOutput(QObject* parent=0) : QObject(parent) {}
+
+private slots:
+ void initTestCase();
+ void settings();
+ void notifyInterval();
+ void pullFile();
+ void pushFile();
+
+private:
+ QAudioFormat format;
+ QAudioOutput* audio;
+};
+
+void tst_QAudioOutput::initTestCase()
+{
+ format.setFrequency(8000);
+ format.setChannels(1);
+ format.setSampleSize(8);
+ format.setCodec("audio/pcm");
+ format.setByteOrder(QAudioFormat::LittleEndian);
+ format.setSampleType(QAudioFormat::UnSignedInt);
+
+ audio = new QAudioOutput(format, this);
+}
+
+void tst_QAudioOutput::settings()
+{
+ QAudioFormat f = audio->format();
+
+ QVERIFY(format.channels() == f.channels());
+ QVERIFY(format.frequency() == f.frequency());
+ QVERIFY(format.sampleSize() == f.sampleSize());
+ QVERIFY(format.codec() == f.codec());
+ QVERIFY(format.byteOrder() == f.byteOrder());
+ QVERIFY(format.sampleType() == f.sampleType());
+}
+
+void tst_QAudioOutput::notifyInterval()
+{
+ QVERIFY(audio->notifyInterval() == 1000); // Default
+
+ audio->setNotifyInterval(500);
+ QVERIFY(audio->notifyInterval() == 500); // Custom
+
+ audio->setNotifyInterval(1000); // reset
+}
+
+void tst_QAudioOutput::pullFile()
+{
+ QFile filename(SRCDIR "4.wav");
+ QVERIFY(filename.exists());
+ filename.open(QIODevice::ReadOnly);
+
+ QSignalSpy readSignal(audio, SIGNAL(notify()));
+ audio->setNotifyInterval(100);
+ audio->start(&filename);
+
+ QTestEventLoop::instance().enterLoop(1);
+ // 4.wav is a little less than 700ms, so notify should fire 6 times!
+ QVERIFY(readSignal.count() >= 6);
+ QVERIFY(audio->totalTime() == 692250);
+
+ audio->stop();
+ filename.close();
+}
+
+void tst_QAudioOutput::pushFile()
+{
+ QFile filename(SRCDIR "4.wav");
+ QVERIFY(filename.exists());
+ filename.open(QIODevice::ReadOnly);
+
+ const qint64 fileSize = filename.size();
+
+ QIODevice* feed = audio->start(0);
+
+ char* buffer = new char[fileSize];
+ filename.read(buffer, fileSize);
+
+ qint64 counter=0;
+ qint64 written=0;
+ while(written < fileSize) {
+ written+=feed->write(buffer+written,fileSize-written);
+ QTest::qWait(20);
+ counter++;
+ }
+ QTestEventLoop::instance().enterLoop(1);
+
+ QVERIFY(written == fileSize);
+ QVERIFY(audio->totalTime() == 692250);
+
+ audio->stop();
+ filename.close();
+ delete [] buffer;
+ delete audio;
+}
+
+QTEST_MAIN(tst_QAudioOutput)
+
+#include "tst_qaudiooutput.moc"
diff --git a/tests/auto/qboxlayout/tst_qboxlayout.cpp b/tests/auto/qboxlayout/tst_qboxlayout.cpp
index be6f3dd54..5803985cb 100644
--- a/tests/auto/qboxlayout/tst_qboxlayout.cpp
+++ b/tests/auto/qboxlayout/tst_qboxlayout.cpp
@@ -222,6 +222,8 @@ void tst_QBoxLayout::setStyleShouldChangeSpacing()
QHBoxLayout *hbox = new QHBoxLayout(window);
QPushButton *pb1 = new QPushButton(tr("The spacing between this"));
QPushButton *pb2 = new QPushButton(tr("and this button should depend on the style of the parent widget"));;
+ pb1->setAttribute(Qt::WA_LayoutUsesWidgetRect);
+ pb2->setAttribute(Qt::WA_LayoutUsesWidgetRect);
hbox->addWidget(pb1);
hbox->addWidget(pb2);
CustomLayoutStyle *style1 = new CustomLayoutStyle;
@@ -238,7 +240,6 @@ void tst_QBoxLayout::setStyleShouldChangeSpacing()
window->setStyle(style2);
QTest::qWait(100);
spacing = pb2->geometry().left() - pb1->geometry().right() - 1;
- QEXPECT_FAIL("", "Fix for next minor release", Continue);
QCOMPARE(spacing, 10);
delete window;
diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp
index 67c9ac9e1..479769853 100644
--- a/tests/auto/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/qcombobox/tst_qcombobox.cpp
@@ -139,6 +139,7 @@ private slots:
void task190205_setModelAdjustToContents();
void task248169_popupWithMinimalSize();
void task247863_keyBoardSelection();
+ void task220195_keyBoardSelection2();
void setModelColumn();
void noScrollbar_data();
void noScrollbar();
@@ -2092,7 +2093,7 @@ void tst_QComboBox::task190205_setModelAdjustToContents()
#endif
// box should be resized to the same size as correctBox
- QCOMPARE(box.size(), correctBox.size());
+ QTRY_COMPARE(box.size(), correctBox.size());
}
void tst_QComboBox::task248169_popupWithMinimalSize()
@@ -2138,6 +2139,40 @@ void tst_QComboBox::task247863_keyBoardSelection()
QCOMPARE(spy.count(), 1);
}
+void tst_QComboBox::task220195_keyBoardSelection2()
+{
+ QComboBox combo;
+ combo.setEditable(false);
+ combo.addItem( QLatin1String("foo1"));
+ combo.addItem( QLatin1String("foo2"));
+ combo.addItem( QLatin1String("foo3"));
+ combo.show();
+ QApplication::setActiveWindow(&combo);
+ QTest::qWait(100);
+
+ combo.setCurrentIndex(-1);
+ QVERIFY(combo.currentText().isNull());
+
+ QTest::keyClick(&combo, 'f');
+ QCOMPARE(combo.currentText(), QLatin1String("foo1"));
+ QTest::qWait(QApplication::keyboardInputInterval() + 30);
+ QTest::keyClick(&combo, 'f');
+ QCOMPARE(combo.currentText(), QLatin1String("foo2"));
+ QTest::qWait(QApplication::keyboardInputInterval() + 30);
+ QTest::keyClick(&combo, 'f');
+ QCOMPARE(combo.currentText(), QLatin1String("foo3"));
+ QTest::qWait(QApplication::keyboardInputInterval() + 30);
+ QTest::keyClick(&combo, 'f');
+ QCOMPARE(combo.currentText(), QLatin1String("foo1"));
+ QTest::qWait(QApplication::keyboardInputInterval() + 30);
+
+ combo.setCurrentIndex(1);
+ QCOMPARE(combo.currentText(), QLatin1String("foo2"));
+ QTest::keyClick(&combo, 'f');
+ QCOMPARE(combo.currentText(), QLatin1String("foo3"));
+}
+
+
void tst_QComboBox::setModelColumn()
{
QStandardItemModel model(5,3);
@@ -2199,7 +2234,7 @@ void tst_QComboBox::noScrollbar()
QVERIFY(!comboBox.view()->horizontalScrollBar()->isVisible());
QVERIFY(!comboBox.view()->verticalScrollBar()->isVisible());
}
-
+
{
QTableWidget *table = new QTableWidget(2,2);
QComboBox comboBox;
@@ -2238,5 +2273,6 @@ void tst_QComboBox::task253944_itemDelegateIsReset()
QCOMPARE(comboBox.itemDelegate(), itemDelegate);
}
+
QTEST_MAIN(tst_QComboBox)
#include "tst_qcombobox.moc"
diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp
index a65490d45..9c436fa43 100644
--- a/tests/auto/qcompleter/tst_qcompleter.cpp
+++ b/tests/auto/qcompleter/tst_qcompleter.cpp
@@ -1316,14 +1316,20 @@ void tst_QCompleter::task253125_lineEditCompletion()
edit.show();
edit.setFocus();
- QTest::qWait(100);
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&edit);
+#endif
+ QTest::qWait(100);
QTest::keyClick(&edit, 'i');
QCOMPARE(edit.completer()->currentCompletion(), QString("iota"));
QTest::keyClick(edit.completer()->popup(), Qt::Key_Down);
QTest::keyClick(edit.completer()->popup(), Qt::Key_Enter);
QCOMPARE(edit.text(), QString("iota"));
+
+ delete completer;
+ delete model;
}
void tst_QCompleter::task247560_keyboardNavigation()
@@ -1345,6 +1351,10 @@ void tst_QCompleter::task247560_keyboardNavigation()
edit.show();
edit.setFocus();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&edit);
+#endif
+
QTest::qWait(100);
QTest::keyClick(&edit, 'r');
diff --git a/tests/auto/qcopchannel/qcopchannel.pro b/tests/auto/qcopchannel/qcopchannel.pro
index 29f78349a..427430f62 100644
--- a/tests/auto/qcopchannel/qcopchannel.pro
+++ b/tests/auto/qcopchannel/qcopchannel.pro
@@ -3,4 +3,5 @@ SUBDIRS = testSend
SUBDIRS += test
+requires(embedded)
diff --git a/tests/auto/qcopchannel/test/test.pro b/tests/auto/qcopchannel/test/test.pro
index 48a218ee0..8c7cc5baa 100644
--- a/tests/auto/qcopchannel/test/test.pro
+++ b/tests/auto/qcopchannel/test/test.pro
@@ -3,12 +3,4 @@ load(qttest_p4)
SOURCES += ../tst_qcopchannel.cpp
TARGET = ../tst_qcopchannel
-win32 {
- CONFIG(debug, debug|release) {
- TARGET = ../../debug/tst_qcopchannel
-} else {
- TARGET = ../../release/tst_qcopchannel
- }
-}
-
diff --git a/tests/auto/qcopchannel/testSend/testSend.pro b/tests/auto/qcopchannel/testSend/testSend.pro
index f78341c52..ebce3ddb4 100644
--- a/tests/auto/qcopchannel/testSend/testSend.pro
+++ b/tests/auto/qcopchannel/testSend/testSend.pro
@@ -2,4 +2,5 @@ load(qttest_p4)
SOURCES = main.cpp
TARGET = testSend
+requires(embedded)
diff --git a/tests/auto/qcssparser/qcssparser.pro b/tests/auto/qcssparser/qcssparser.pro
index 723e4d3a1..fb1f17e40 100644
--- a/tests/auto/qcssparser/qcssparser.pro
+++ b/tests/auto/qcssparser/qcssparser.pro
@@ -1,5 +1,5 @@
load(qttest_p4)
-SOURCES += tst_cssparser.cpp
+SOURCES += tst_qcssparser.cpp
DEFINES += SRCDIR=\\\"$$PWD\\\"
QT += xml
diff --git a/tests/auto/qcssparser/tst_cssparser.cpp b/tests/auto/qcssparser/tst_qcssparser.cpp
index cd2c0f490..be1a2121d 100644
--- a/tests/auto/qcssparser/tst_cssparser.cpp
+++ b/tests/auto/qcssparser/tst_qcssparser.cpp
@@ -46,7 +46,7 @@
#include "private/qcssparser_p.h"
-class tst_CssParser : public QObject
+class tst_QCssParser : public QObject
{
Q_OBJECT
private slots:
@@ -93,7 +93,7 @@ private slots:
void quotedAndUnquotedIdentifiers();
};
-void tst_CssParser::scanner_data()
+void tst_QCssParser::scanner_data()
{
QTest::addColumn<QString>("input");
QTest::addColumn<QString>("output");
@@ -166,7 +166,7 @@ static void debug(const QVector<QCss::Symbol> &symbols, int index = -1)
//static void debug(const QCss::Parser &p) { debug(p.symbols); }
-void tst_CssParser::scanner()
+void tst_QCssParser::scanner()
{
QFETCH(QString, input);
QFETCH(QString, output);
@@ -215,7 +215,7 @@ void tst_CssParser::scanner()
Q_DECLARE_METATYPE(QCss::Value)
-void tst_CssParser::term_data()
+void tst_QCssParser::term_data()
{
QTest::addColumn<bool>("parseSuccess");
QTest::addColumn<QString>("css");
@@ -330,7 +330,7 @@ void tst_CssParser::term_data()
QTest::newRow("ItaLIc") << true << "ItaLIc" << val;
}
-void tst_CssParser::term()
+void tst_QCssParser::term()
{
QFETCH(bool, parseSuccess);
QFETCH(QString, css);
@@ -351,7 +351,7 @@ void tst_CssParser::term()
Q_DECLARE_METATYPE(QVector<QCss::Value>)
-void tst_CssParser::expr_data()
+void tst_QCssParser::expr_data()
{
QTest::addColumn<bool>("parseSuccess");
QTest::addColumn<QString>("css");
@@ -376,7 +376,7 @@ void tst_CssParser::expr_data()
values.clear();
}
-void tst_CssParser::expr()
+void tst_QCssParser::expr()
{
QFETCH(bool, parseSuccess);
QFETCH(QString, css);
@@ -396,7 +396,7 @@ void tst_CssParser::expr()
}
}
-void tst_CssParser::import()
+void tst_QCssParser::import()
{
QCss::Parser parser("@import \"plainstring\";");
QVERIFY(parser.testImport());
@@ -413,7 +413,7 @@ void tst_CssParser::import()
QCOMPARE(rule.media.at(1), QString("screen"));
}
-void tst_CssParser::media()
+void tst_QCssParser::media()
{
QCss::Parser parser("@media print/*comment*/,screen /*comment to ignore*/{ }");
QVERIFY(parser.testMedia());
@@ -425,7 +425,7 @@ void tst_CssParser::media()
QVERIFY(rule.styleRules.isEmpty());
}
-void tst_CssParser::page()
+void tst_QCssParser::page()
{
QCss::Parser parser("@page :first/*comment to ignore*/{ }");
QVERIFY(parser.testPage());
@@ -435,7 +435,7 @@ void tst_CssParser::page()
QVERIFY(rule.declarations.isEmpty());
}
-void tst_CssParser::ruleset()
+void tst_QCssParser::ruleset()
{
{
QCss::Parser parser("p/*foo*/{ }");
@@ -483,7 +483,7 @@ void tst_CssParser::ruleset()
Q_DECLARE_METATYPE(QCss::Selector)
-void tst_CssParser::selector_data()
+void tst_QCssParser::selector_data()
{
QTest::addColumn<QString>("css");
QTest::addColumn<QCss::Selector>("expectedSelector");
@@ -685,7 +685,7 @@ void tst_CssParser::selector_data()
}
}
-void tst_CssParser::selector()
+void tst_QCssParser::selector()
{
QFETCH(QString, css);
QFETCH(QCss::Selector, expectedSelector);
@@ -717,7 +717,7 @@ void tst_CssParser::selector()
}
}
-void tst_CssParser::prio()
+void tst_QCssParser::prio()
{
{
QCss::Parser parser("!important");
@@ -739,14 +739,14 @@ void tst_CssParser::prio()
}
}
-void tst_CssParser::escapes()
+void tst_QCssParser::escapes()
{
QCss::Parser parser("\\hello");
parser.test(QCss::IDENT);
QCOMPARE(parser.lexem(), QString("hello"));
}
-void tst_CssParser::malformedDeclarations_data()
+void tst_QCssParser::malformedDeclarations_data()
{
QTest::addColumn<QString>("css");
@@ -759,7 +759,7 @@ void tst_CssParser::malformedDeclarations_data()
QTest::newRow("7") << QString("p { color:red; color{;color:maroon}; color:green } /* same with recovery */");
}
-void tst_CssParser::malformedDeclarations()
+void tst_QCssParser::malformedDeclarations()
{
QFETCH(QString, css);
QCss::Parser parser(css);
@@ -778,7 +778,7 @@ void tst_CssParser::malformedDeclarations()
QCOMPARE(rule.declarations.last().d->values.at(0).variant.toString(), QString("green"));
}
-void tst_CssParser::invalidAtKeywords()
+void tst_QCssParser::invalidAtKeywords()
{
QCss::Parser parser(""
"@three-dee {"
@@ -810,7 +810,7 @@ void tst_CssParser::invalidAtKeywords()
Q_DECLARE_METATYPE(QColor)
-void tst_CssParser::colorValue_data()
+void tst_QCssParser::colorValue_data()
{
QTest::addColumn<QString>("css");
QTest::addColumn<QColor>("expectedColor");
@@ -831,7 +831,7 @@ void tst_CssParser::colorValue_data()
QTest::newRow("transparent") << "color: transparent" << QColor(Qt::transparent);
}
-void tst_CssParser::colorValue()
+void tst_QCssParser::colorValue()
{
QFETCH(QString, css);
QFETCH(QColor, expectedColor);
@@ -886,7 +886,7 @@ private:
Q_DECLARE_METATYPE(QDomDocument);
-void tst_CssParser::marginValue_data()
+void tst_QCssParser::marginValue_data()
{
QTest::addColumn<QString>("css");
QTest::addColumn<QString>("expectedMargin");
@@ -914,7 +914,7 @@ void tst_CssParser::marginValue_data()
QTest::newRow("crap") << "margin: crap" << "0 0 0 0";
}
-void tst_CssParser::marginValue()
+void tst_QCssParser::marginValue()
{
QFETCH(QString, css);
QFETCH(QString, expectedMargin);
@@ -947,7 +947,7 @@ void tst_CssParser::marginValue()
}
}
-void tst_CssParser::styleSelector_data()
+void tst_QCssParser::styleSelector_data()
{
QTest::addColumn<bool>("match");
QTest::addColumn<QString>("selector");
@@ -1062,7 +1062,7 @@ void tst_CssParser::styleSelector_data()
QTest::newRow("unknown-pseudo") << false << QString("p:enabled:foobar") << QString("<p/>") << QString();
}
-void tst_CssParser::styleSelector()
+void tst_QCssParser::styleSelector()
{
QFETCH(bool, match);
QFETCH(QString, selector);
@@ -1106,7 +1106,7 @@ void tst_CssParser::styleSelector()
}
}
-void tst_CssParser::specificity_data()
+void tst_QCssParser::specificity_data()
{
QTest::addColumn<QString>("selector");
QTest::addColumn<int>("specificity");
@@ -1129,7 +1129,7 @@ void tst_CssParser::specificity_data()
QTest::newRow("id") << QString("#x34y") << 1 * 0x100;
}
-void tst_CssParser::specificity()
+void tst_QCssParser::specificity()
{
QFETCH(QString, selector);
@@ -1139,14 +1139,14 @@ void tst_CssParser::specificity()
QVERIFY(parser.parse(&sheet));
QCOMPARE(sheet.styleRules.count() + sheet.nameIndex.count() + sheet.idIndex.count() , 1);
- QCss::StyleRule rule = (!sheet.styleRules.isEmpty()) ? sheet.styleRules.at(0)
- : (!sheet.nameIndex.isEmpty()) ? *sheet.nameIndex.begin()
+ QCss::StyleRule rule = (!sheet.styleRules.isEmpty()) ? sheet.styleRules.at(0)
+ : (!sheet.nameIndex.isEmpty()) ? *sheet.nameIndex.begin()
: *sheet.idIndex.begin();
QCOMPARE(rule.selectors.count(), 1);
QTEST(rule.selectors.at(0).specificity(), "specificity");
}
-void tst_CssParser::specificitySort_data()
+void tst_QCssParser::specificitySort_data()
{
QTest::addColumn<QString>("firstSelector");
QTest::addColumn<QString>("secondSelector");
@@ -1159,7 +1159,7 @@ void tst_CssParser::specificitySort_data()
QTest::newRow("class") << QString("p") << QString(".hey") << QString("<p class=\"hey\" />");
}
-void tst_CssParser::specificitySort()
+void tst_QCssParser::specificitySort()
{
QFETCH(QString, firstSelector);
QFETCH(QString, secondSelector);
@@ -1205,7 +1205,7 @@ void tst_CssParser::specificitySort()
}
}
-void tst_CssParser::rulesForNode_data()
+void tst_QCssParser::rulesForNode_data()
{
QTest::addColumn<QString>("xml");
QTest::addColumn<QString>("css");
@@ -1249,7 +1249,7 @@ void tst_CssParser::rulesForNode_data()
<< quint64(QCss::PseudoClass_Pressed) << 1 << "blue" << "";
}
-void tst_CssParser::rulesForNode()
+void tst_QCssParser::rulesForNode()
{
QFETCH(QString, xml);
QFETCH(QString, css);
@@ -1291,7 +1291,7 @@ void tst_CssParser::rulesForNode()
QCOMPARE(decls.at(1).d->values.at(0).variant.toString(), value1);
}
-void tst_CssParser::shorthandBackgroundProperty_data()
+void tst_QCssParser::shorthandBackgroundProperty_data()
{
QTest::addColumn<QString>("css");
QTest::addColumn<QBrush>("expectedBrush");
@@ -1311,7 +1311,7 @@ void tst_CssParser::shorthandBackgroundProperty_data()
QTest::newRow("multi3") << "background: url(blah.png) top right" << QBrush() << QString("blah.png") << int(QCss::Repeat_XY) << int(Qt::AlignTop | Qt::AlignRight);
}
-void tst_CssParser::shorthandBackgroundProperty()
+void tst_QCssParser::shorthandBackgroundProperty()
{
QFETCH(QString, css);
@@ -1350,7 +1350,7 @@ void tst_CssParser::shorthandBackgroundProperty()
QTEST(int(alignment), "expectedAlignment");
}
-void tst_CssParser::pseudoElement_data()
+void tst_QCssParser::pseudoElement_data()
{
QTest::addColumn<QString>("css");
QTest::addColumn<QString>("pseudoElement");
@@ -1384,7 +1384,7 @@ void tst_CssParser::pseudoElement_data()
<< "pe2" << 1;
}
-void tst_CssParser::pseudoElement()
+void tst_QCssParser::pseudoElement()
{
QFETCH(QString, css);
QFETCH(QString, pseudoElement);
@@ -1413,7 +1413,7 @@ void tst_CssParser::pseudoElement()
QVERIFY(decls.count() == declCount);
}
-void tst_CssParser::gradient_data()
+void tst_QCssParser::gradient_data()
{
QTest::addColumn<QString>("css");
QTest::addColumn<QString>("type");
@@ -1458,7 +1458,7 @@ void tst_CssParser::gradient_data()
*/
}
-void tst_CssParser::gradient()
+void tst_QCssParser::gradient()
{
QFETCH(QString, css);
QFETCH(QString, type);
@@ -1506,8 +1506,11 @@ void tst_CssParser::gradient()
QVERIFY(g->stops().at(1).second == color1);
}
-void tst_CssParser::extractFontFamily_data()
+void tst_QCssParser::extractFontFamily_data()
{
+ if (QFontInfo(QFont("Times New Roman")).family() != "Times New Roman")
+ QSKIP("'Times New Roman' font not found ", SkipAll);
+
QTest::addColumn<QString>("css");
QTest::addColumn<QString>("expectedFamily");
@@ -1522,7 +1525,7 @@ void tst_CssParser::extractFontFamily_data()
QTest::newRow("shorthand multiple") << "font: 12pt invalid, Times New Roman " << QString("Times New Roman");
}
-void tst_CssParser::extractFontFamily()
+void tst_QCssParser::extractFontFamily()
{
QFETCH(QString, css);
css.prepend("dummy {");
@@ -1547,7 +1550,7 @@ void tst_CssParser::extractFontFamily()
QTEST(info.family(), "expectedFamily");
}
-void tst_CssParser::extractBorder_data()
+void tst_QCssParser::extractBorder_data()
{
QTest::addColumn<QString>("css");
QTest::addColumn<int>("expectedTopWidth");
@@ -1575,7 +1578,7 @@ void tst_CssParser::extractBorder_data()
QTest::newRow("top-width+color") << "border-top: 3px green" << 3 << (int)QCss::BorderStyle_None << QColor("green");
}
-void tst_CssParser::extractBorder()
+void tst_QCssParser::extractBorder()
{
QFETCH(QString, css);
QFETCH(int, expectedTopWidth);
@@ -1607,7 +1610,7 @@ void tst_CssParser::extractBorder()
QVERIFY(colors[QCss::TopEdge] == expectedTopColor);
}
-void tst_CssParser::noTextDecoration()
+void tst_QCssParser::noTextDecoration()
{
QCss::Parser parser("dummy { text-decoration: none; }");
QCss::StyleSheet sheet;
@@ -1632,7 +1635,7 @@ void tst_CssParser::noTextDecoration()
QVERIFY(!f.strikeOut());
}
-void tst_CssParser::quotedAndUnquotedIdentifiers()
+void tst_QCssParser::quotedAndUnquotedIdentifiers()
{
QCss::Parser parser("foo { font-style: \"italic\"; font-weight: bold }");
QCss::StyleSheet sheet;
@@ -1653,5 +1656,6 @@ void tst_CssParser::quotedAndUnquotedIdentifiers()
QCOMPARE(decls.at(1).d->values.first().toString(), QLatin1String("bold"));
}
-QTEST_MAIN(tst_CssParser)
-#include "tst_cssparser.moc"
+QTEST_MAIN(tst_QCssParser)
+#include "tst_qcssparser.moc"
+
diff --git a/tests/auto/qdbuspendingcall/qdbuspendingcall.pro b/tests/auto/qdbuspendingcall/qdbuspendingcall.pro
index 65e8f139d..dd8f14198 100644
--- a/tests/auto/qdbuspendingcall/qdbuspendingcall.pro
+++ b/tests/auto/qdbuspendingcall/qdbuspendingcall.pro
@@ -1,4 +1,5 @@
load(qttest_p4)
-QT = core
-contains(QT_CONFIG, dbus):QT += dbus
+requires(contains(QT_CONFIG, dbus))
+QT = core dbus
SOURCES += tst_qdbuspendingcall.cpp
+
diff --git a/tests/auto/qdbuspendingreply/qdbuspendingreply.pro b/tests/auto/qdbuspendingreply/qdbuspendingreply.pro
index 94e7acfc6..c649e4aaf 100644
--- a/tests/auto/qdbuspendingreply/qdbuspendingreply.pro
+++ b/tests/auto/qdbuspendingreply/qdbuspendingreply.pro
@@ -1,4 +1,4 @@
load(qttest_p4)
-QT = core
-contains(QT_CONFIG, dbus):QT += dbus
+requires(contains(QT_CONFIG, dbus))
+QT = core dbus
SOURCES += tst_qdbuspendingreply.cpp
diff --git a/tests/auto/qdesktopwidget/tst_qdesktopwidget.cpp b/tests/auto/qdesktopwidget/tst_qdesktopwidget.cpp
index c6fac8d46..d2b0d8a47 100644
--- a/tests/auto/qdesktopwidget/tst_qdesktopwidget.cpp
+++ b/tests/auto/qdesktopwidget/tst_qdesktopwidget.cpp
@@ -99,9 +99,17 @@ void tst_QDesktopWidget::availableGeometry()
{
QDesktopWidget desktop;
- QRect total = desktop.screenGeometry();
- QRect available = desktop.availableGeometry();
+ QRect total;
+ QRect available;
+ for (int i = 0; i < desktop.screenCount(); ++i) {
+ total = desktop.screenGeometry(i);
+ available = desktop.availableGeometry(i);
+ QVERIFY(total.contains(available));
+ }
+
+ total = desktop.screenGeometry();
+ available = desktop.availableGeometry();
QVERIFY(total.contains(available));
QCOMPARE(desktop.availableGeometry(desktop.primaryScreen()), available);
QCOMPARE(desktop.screenGeometry(desktop.primaryScreen()), total);
diff --git a/tests/auto/qdirectpainter/qdirectpainter.pro b/tests/auto/qdirectpainter/qdirectpainter.pro
index 89671942c..e86b3427e 100644
--- a/tests/auto/qdirectpainter/qdirectpainter.pro
+++ b/tests/auto/qdirectpainter/qdirectpainter.pro
@@ -1,7 +1,5 @@
-load(qttest_p4)
-SOURCES += tst_qdirectpainter.cpp
-
TEMPLATE = subdirs
SUBDIRS = test runDirectPainter
+requires(embedded)
diff --git a/tests/auto/qdirectpainter/runDirectPainter/runDirectPainter.pro b/tests/auto/qdirectpainter/runDirectPainter/runDirectPainter.pro
index 9e5131c20..09524e90c 100644
--- a/tests/auto/qdirectpainter/runDirectPainter/runDirectPainter.pro
+++ b/tests/auto/qdirectpainter/runDirectPainter/runDirectPainter.pro
@@ -2,4 +2,5 @@ load(qttest_p4)
SOURCES = main.cpp
TARGET = runDirectPainter
+requires(embedded)
diff --git a/tests/auto/qdirectpainter/test/test.pro b/tests/auto/qdirectpainter/test/test.pro
index 98c74e415..6d820b158 100644
--- a/tests/auto/qdirectpainter/test/test.pro
+++ b/tests/auto/qdirectpainter/test/test.pro
@@ -3,12 +3,5 @@ load(qttest_p4)
SOURCES += ../tst_qdirectpainter.cpp
TARGET = ../tst_qdirectpainter
-win32 {
- CONFIG(debug, debug|release) {
- TARGET = ../../debug/tst_qdirectpainter
-} else {
- TARGET = ../../release/tst_qdirectpainter
- }
-}
-
+requires(embedded)
diff --git a/tests/auto/qdockwidget/tst_qdockwidget.cpp b/tests/auto/qdockwidget/tst_qdockwidget.cpp
index 9b0e7060d..16bb12d18 100644
--- a/tests/auto/qdockwidget/tst_qdockwidget.cpp
+++ b/tests/auto/qdockwidget/tst_qdockwidget.cpp
@@ -91,6 +91,7 @@ private slots:
void task169808_setFloating();
void task237438_setFloatingCrash();
void task248604_infiniteResize();
+ void task258459_visibilityChanged();
};
// Testing get/set functions
@@ -730,7 +731,7 @@ void tst_QDockWidget::task169808_setFloating()
return QSize(20,20);
}
- void paintEvent(QPaintEvent *e)
+ void paintEvent(QPaintEvent *)
{
QPainter p(this);
p.fillRect(rect(), Qt::red);
@@ -798,5 +799,21 @@ void tst_QDockWidget::task248604_infiniteResize()
}
+void tst_QDockWidget::task258459_visibilityChanged()
+{
+ QMainWindow win;
+ QDockWidget dock1, dock2;
+ win.addDockWidget(Qt::RightDockWidgetArea, &dock1);
+ win.tabifyDockWidget(&dock1, &dock2);
+ QSignalSpy spy1(&dock1, SIGNAL(visibilityChanged(bool)));
+ QSignalSpy spy2(&dock2, SIGNAL(visibilityChanged(bool)));
+ win.show();
+ QTest::qWait(200);
+ QCOMPARE(spy1.count(), 1);
+ QCOMPARE(spy1.first().first().toBool(), false); //dock1 is invisible
+ QCOMPARE(spy2.count(), 1);
+ QCOMPARE(spy2.first().first().toBool(), true); //dock1 is visible
+}
+
QTEST_MAIN(tst_QDockWidget)
#include "tst_qdockwidget.moc"
diff --git a/tests/auto/qfile/tst_qfile.cpp b/tests/auto/qfile/tst_qfile.cpp
index 66f29dd54..249b70249 100644
--- a/tests/auto/qfile/tst_qfile.cpp
+++ b/tests/auto/qfile/tst_qfile.cpp
@@ -915,6 +915,7 @@ void tst_QFile::copyAfterFail()
QVERIFY(file1.open(QIODevice::ReadWrite) && "(test-precondition)");
QVERIFY(file2.open(QIODevice::ReadWrite) && "(test-precondition)");
+ file2.close();
QVERIFY(!QFile::exists("copied-file-1.txt") && "(test-precondition)");
QVERIFY(!QFile::exists("copied-file-2.txt") && "(test-precondition)");
diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp
index c31ecf240..0f307dce4 100644
--- a/tests/auto/qfiledialog/tst_qfiledialog.cpp
+++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp
@@ -161,6 +161,7 @@ private slots:
void task251341_sideBarRemoveEntries();
void task254490_selectFileMultipleTimes();
void task257579_sideBarWithNonCleanUrls();
+ void task259105_filtersCornerCases();
private:
QByteArray userSettings;
@@ -2057,6 +2058,48 @@ void tst_QFiledialog::task257579_sideBarWithNonCleanUrls()
#endif
}
+void tst_QFiledialog::task259105_filtersCornerCases()
+{
+ QNonNativeFileDialog fd(0, "TestFileDialog");
+ fd.setNameFilter(QLatin1String("All Files! (*);;Text Files (*.txt)"));
+ fd.setOption(QFileDialog::HideNameFilterDetails, true);
+ fd.show();
+ QTest::qWait(250);
+
+ //Extensions are hidden
+ QComboBox *filters = qFindChild<QComboBox*>(&fd, "fileTypeCombo");
+ QVERIFY(filters);
+ QCOMPARE(filters->currentText(), QLatin1String("All Files!"));
+ filters->setCurrentIndex(1);
+ QCOMPARE(filters->currentText(), QLatin1String("Text Files"));
+
+ //We should have the full names
+ fd.setOption(QFileDialog::HideNameFilterDetails, false);
+ QTest::qWait(250);
+ filters->setCurrentIndex(0);
+ QCOMPARE(filters->currentText(), QLatin1String("All Files! (*)"));
+ filters->setCurrentIndex(1);
+ QCOMPARE(filters->currentText(), QLatin1String("Text Files (*.txt)"));
+
+ //Corner case undocumented of the task
+ fd.setNameFilter(QLatin1String("\352 (I like cheese) All Files! (*);;Text Files (*.txt)"));
+ QCOMPARE(filters->currentText(), QLatin1String("\352 (I like cheese) All Files! (*)"));
+ filters->setCurrentIndex(1);
+ QCOMPARE(filters->currentText(), QLatin1String("Text Files (*.txt)"));
+
+ fd.setOption(QFileDialog::HideNameFilterDetails, true);
+ filters->setCurrentIndex(0);
+ QTest::qWait(500);
+ QCOMPARE(filters->currentText(), QLatin1String("\352 (I like cheese) All Files!"));
+ filters->setCurrentIndex(1);
+ QCOMPARE(filters->currentText(), QLatin1String("Text Files"));
+ fd.setOption(QFileDialog::HideNameFilterDetails, true);
+ filters->setCurrentIndex(0);
+ QTest::qWait(500);
+ QCOMPARE(filters->currentText(), QLatin1String("\352 (I like cheese) All Files!"));
+ filters->setCurrentIndex(1);
+ QCOMPARE(filters->currentText(), QLatin1String("Text Files"));
+}
QTEST_MAIN(tst_QFiledialog)
#include "tst_qfiledialog.moc"
diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp
index 512f2b640..a87e3060d 100644
--- a/tests/auto/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp
@@ -749,7 +749,7 @@ void tst_QFileInfo::size()
void tst_QFileInfo::systemFiles()
{
-#ifndef Q_OS_WIN
+#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE)
QSKIP("This is a Windows only test", SkipAll);
#endif
QFileInfo fi("c:\\pagefile.sys");
@@ -1077,7 +1077,13 @@ void tst_QFileInfo::isWritable()
{
QVERIFY(QFileInfo("tst_qfileinfo.cpp").isWritable());
#ifdef Q_OS_WIN
- QVERIFY(!QFileInfo("c:\\pagefile.sys").isWritable());
+#ifdef Q_OS_WINCE
+ QFileInfo fi("\\Windows\\wince.nls");
+#else
+ QFileInfo fi("c:\\pagefile.sys");
+#endif
+ QVERIFY(fi.exists());
+ QVERIFY(!fi.isWritable());
#endif
#ifdef Q_OS_UNIX
if (::getuid() == 0)
diff --git a/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
index c883c6331..b89890ee2 100644
--- a/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
+++ b/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
@@ -399,6 +399,15 @@ void tst_QFileSystemWatcher::removePaths()
watcher.removePaths(paths);
}
+#if 0
+class SignalTest : public QObject {
+ Q_OBJECT;
+ public slots:
+ void fileSlot(const QString &file) { qDebug() << "file " << file;}
+ void dirSlot(const QString &dir) { qDebug() << "dir" << dir;}
+};
+#endif
+
void tst_QFileSystemWatcher::watchFileAndItsDirectory()
{
QFETCH(QString, backend);
@@ -423,6 +432,12 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory()
watcher.addPath(testDir.dirName());
watcher.addPath(testFileName);
+ /*
+ SignalTest signalTest;
+ QObject::connect(&watcher, SIGNAL(fileChanged(const QString &)), &signalTest, SLOT(fileSlot(const QString &)));
+ QObject::connect(&watcher, SIGNAL(directoryChanged(const QString &)), &signalTest, SLOT(dirSlot(const QString &)));
+ */
+
QSignalSpy fileChangedSpy(&watcher, SIGNAL(fileChanged(const QString &)));
QSignalSpy dirChangedSpy(&watcher, SIGNAL(directoryChanged(const QString &)));
QEventLoop eventLoop;
@@ -440,9 +455,12 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory()
timer.start(3000);
eventLoop.exec();
- QCOMPARE(fileChangedSpy.count(), 1);
+ QVERIFY(fileChangedSpy.count() > 0);
QCOMPARE(dirChangedSpy.count(), 0);
+ if (backend == "dnotify")
+ QSKIP("dnotify is broken, skipping the rest of the test.", SkipSingle);
+
fileChangedSpy.clear();
QFile secondFile(secondFileName);
secondFile.open(QIODevice::WriteOnly | QIODevice::Truncate);
@@ -460,7 +478,7 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory()
timer.start(3000);
eventLoop.exec();
- QCOMPARE(fileChangedSpy.count(), 1);
+ QVERIFY(fileChangedSpy.count() > 0);
QCOMPARE(dirChangedSpy.count(), 1);
fileChangedSpy.clear();
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index ef3f0f8ff..789bb2771 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -761,6 +761,22 @@ void tst_QGraphicsItem::flags()
QApplication::sendEvent(&scene, &event5);
QCOMPARE(item->pos(), QPointF(10, 10));
}
+ {
+ QGraphicsItem* clippingParent = new QGraphicsRectItem;
+ clippingParent->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true);
+
+ QGraphicsItem* nonClippingParent = new QGraphicsRectItem;
+ nonClippingParent->setFlag(QGraphicsItem::ItemClipsChildrenToShape, false);
+
+ QGraphicsItem* child = new QGraphicsRectItem(nonClippingParent);
+ QVERIFY(!child->isClipped());
+
+ child->setParentItem(clippingParent);
+ QVERIFY(child->isClipped());
+
+ child->setParentItem(nonClippingParent);
+ QVERIFY(!child->isClipped());
+ }
}
class ImhTester : public QGraphicsItem
diff --git a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp
index 672b1f15a..c9481da3b 100644
--- a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp
+++ b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp
@@ -137,7 +137,10 @@ void tst_QGraphicsTransform::rotation()
void tst_QGraphicsTransform::rotation3d()
{
QGraphicsRotation3D rotation;
- rotation.setOrigin(QPointF(10, 10));
+ QCOMPARE(rotation.axis().x(), (qreal)0);
+ QCOMPARE(rotation.axis().y(), (qreal)0);
+ QCOMPARE(rotation.axis().z(), (qreal)1);
+ QCOMPARE(rotation.angle(), (qreal)0);
QTransform t;
rotation.applyTo(&t);
@@ -147,6 +150,23 @@ void tst_QGraphicsTransform::rotation3d()
rotation.setAngle(180);
+ QTransform t180;
+ t180.rotate(180.0f);
+
+ QCOMPARE(t, QTransform());
+ QVERIFY(qFuzzyCompare(rotation.transform(), t180));
+
+ rotation.setAxis(QVector3D(0, 0, 0));
+ rotation.setOrigin(QPointF(10, 10));
+
+ t = QTransform();
+ rotation.applyTo(&t);
+
+ QCOMPARE(t, QTransform());
+ QCOMPARE(rotation.transform(), QTransform());
+
+ rotation.setAngle(180);
+
QCOMPARE(t, QTransform());
QCOMPARE(rotation.transform(), QTransform());
diff --git a/tests/auto/qhostinfo/tst_qhostinfo.cpp b/tests/auto/qhostinfo/tst_qhostinfo.cpp
index c3d7c2d35..86b70e152 100644
--- a/tests/auto/qhostinfo/tst_qhostinfo.cpp
+++ b/tests/auto/qhostinfo/tst_qhostinfo.cpp
@@ -214,10 +214,7 @@ void tst_QHostInfo::lookupIPv4_data()
QTest::newRow("empty") << "" << "" << int(QHostInfo::HostNotFound);
- QTest::newRow("lupinella_00") << "l" << lupinellaIp << int(QHostInfo::NoError);
- QTest::newRow("lupinella_01") << "lupinella" << lupinellaIp << int(QHostInfo::NoError);
- QTest::newRow("lupinella_02") << "lupinella.troll.no" << lupinellaIp << int(QHostInfo::NoError);
- QTest::newRow("lupinella_03") << "lupinella.trolltech.com" << lupinellaIp << int(QHostInfo::NoError);
+ QTest::newRow("single_ip4") << "lupinella.troll.no" << lupinellaIp << int(QHostInfo::NoError);
QTest::newRow("multiple_ip4") << "multi.dev.troll.no" << "1.2.3.4 1.2.3.5 10.3.3.31" << int(QHostInfo::NoError);
QTest::newRow("literal_ip4") << lupinellaIp << lupinellaIp << int(QHostInfo::NoError);
QTest::newRow("notfound") << "this-name-does-not-exist-hopefully." << "" << int(QHostInfo::HostNotFound);
diff --git a/tests/auto/qicoimageformat/qicoimageformat.pro b/tests/auto/qicoimageformat/qicoimageformat.pro
index 19c13b70c..9a347d78b 100644
--- a/tests/auto/qicoimageformat/qicoimageformat.pro
+++ b/tests/auto/qicoimageformat/qicoimageformat.pro
@@ -1,5 +1,5 @@
load(qttest_p4)
-SOURCES+= tst_qticoimageformat.cpp
+SOURCES+= tst_qicoimageformat.cpp
wince*: {
DEFINES += SRCDIR=\\\".\\\"
diff --git a/tests/auto/qicoimageformat/tst_qticoimageformat.cpp b/tests/auto/qicoimageformat/tst_qicoimageformat.cpp
index fbd382137..95d2a6d4b 100644
--- a/tests/auto/qicoimageformat/tst_qticoimageformat.cpp
+++ b/tests/auto/qicoimageformat/tst_qicoimageformat.cpp
@@ -42,13 +42,13 @@
#include <QtGui>
#include <QtCore>
-class tst_QtIcoImageFormat : public QObject
+class tst_QIcoImageFormat : public QObject
{
Q_OBJECT
public:
- tst_QtIcoImageFormat();
- virtual ~tst_QtIcoImageFormat();
+ tst_QIcoImageFormat();
+ virtual ~tst_QIcoImageFormat();
public slots:
@@ -78,45 +78,45 @@ private:
};
-tst_QtIcoImageFormat::tst_QtIcoImageFormat()
+tst_QIcoImageFormat::tst_QIcoImageFormat()
{
m_IconPath = QLatin1String(SRCDIR) + "/icons";
qDebug() << m_IconPath;
}
-tst_QtIcoImageFormat::~tst_QtIcoImageFormat()
+tst_QIcoImageFormat::~tst_QIcoImageFormat()
{
}
-void tst_QtIcoImageFormat::init()
+void tst_QIcoImageFormat::init()
{
}
-void tst_QtIcoImageFormat::cleanup()
+void tst_QIcoImageFormat::cleanup()
{
}
-void tst_QtIcoImageFormat::initTestCase()
+void tst_QIcoImageFormat::initTestCase()
{
}
-void tst_QtIcoImageFormat::cleanupTestCase()
+void tst_QIcoImageFormat::cleanupTestCase()
{
}
-void tst_QtIcoImageFormat::format()
+void tst_QIcoImageFormat::format()
{
QImageReader reader(m_IconPath + "/valid/35FLOPPY.ICO", "ico");
QByteArray fmt = reader.format();
QCOMPARE(const_cast<const char*>(fmt.data()), "ico" );
}
-void tst_QtIcoImageFormat::canRead_data()
+void tst_QIcoImageFormat::canRead_data()
{
QTest::addColumn<QString>("fileName");
QTest::addColumn<int>("isValid");
@@ -135,7 +135,7 @@ void tst_QtIcoImageFormat::canRead_data()
QTest::newRow("PNG compression") << "valid/Qt.ico" << 1;
}
-void tst_QtIcoImageFormat::canRead()
+void tst_QIcoImageFormat::canRead()
{
QFETCH(QString, fileName);
QFETCH(int, isValid);
@@ -157,7 +157,7 @@ public:
};
-void tst_QtIcoImageFormat::SequentialFile_data()
+void tst_QIcoImageFormat::SequentialFile_data()
{
QTest::addColumn<QString>("fileName");
QTest::addColumn<int>("isValid");
@@ -169,7 +169,7 @@ void tst_QtIcoImageFormat::SequentialFile_data()
}
-void tst_QtIcoImageFormat::SequentialFile()
+void tst_QIcoImageFormat::SequentialFile()
{
QFETCH(QString, fileName);
QFETCH(int, isValid);
@@ -187,7 +187,7 @@ void tst_QtIcoImageFormat::SequentialFile()
}
-void tst_QtIcoImageFormat::imageCount_data()
+void tst_QIcoImageFormat::imageCount_data()
{
QTest::addColumn<QString>("fileName");
QTest::addColumn<int>("count");
@@ -206,7 +206,7 @@ void tst_QtIcoImageFormat::imageCount_data()
}
-void tst_QtIcoImageFormat::imageCount()
+void tst_QIcoImageFormat::imageCount()
{
QFETCH(QString, fileName);
QFETCH(int, count);
@@ -216,7 +216,7 @@ void tst_QtIcoImageFormat::imageCount()
}
-void tst_QtIcoImageFormat::jumpToNextImage_data()
+void tst_QIcoImageFormat::jumpToNextImage_data()
{
QTest::addColumn<QString>("fileName");
QTest::addColumn<int>("count");
@@ -233,7 +233,7 @@ void tst_QtIcoImageFormat::jumpToNextImage_data()
QTest::newRow("PNG compression") << "valid/Qt.ico" << 4;
}
-void tst_QtIcoImageFormat::jumpToNextImage()
+void tst_QIcoImageFormat::jumpToNextImage()
{
QFETCH(QString, fileName);
QFETCH(int, count);
@@ -247,7 +247,7 @@ void tst_QtIcoImageFormat::jumpToNextImage()
QCOMPARE(count, 0);
}
-void tst_QtIcoImageFormat::loopCount_data()
+void tst_QIcoImageFormat::loopCount_data()
{
QTest::addColumn<QString>("fileName");
QTest::addColumn<int>("count");
@@ -256,7 +256,7 @@ void tst_QtIcoImageFormat::loopCount_data()
QTest::newRow("invalid floppy (first 8 bytes = 0xff)") << "invalid/35floppy.ico" << 0;
}
-void tst_QtIcoImageFormat::loopCount()
+void tst_QIcoImageFormat::loopCount()
{
QFETCH(QString, fileName);
QFETCH(int, count);
@@ -265,7 +265,7 @@ void tst_QtIcoImageFormat::loopCount()
QCOMPARE(reader.loopCount(), count);
}
-void tst_QtIcoImageFormat::nextImageDelay_data()
+void tst_QIcoImageFormat::nextImageDelay_data()
{
QTest::addColumn<QString>("fileName");
QTest::addColumn<int>("count");
@@ -283,7 +283,7 @@ void tst_QtIcoImageFormat::nextImageDelay_data()
QTest::newRow("PNG compression") << "valid/Qt.ico" << 4;
}
-void tst_QtIcoImageFormat::nextImageDelay()
+void tst_QIcoImageFormat::nextImageDelay()
{
QFETCH(QString, fileName);
QFETCH(int, count);
@@ -300,7 +300,7 @@ void tst_QtIcoImageFormat::nextImageDelay()
}
}
-void tst_QtIcoImageFormat::pngCompression_data()
+void tst_QIcoImageFormat::pngCompression_data()
{
QTest::addColumn<QString>("fileName");
QTest::addColumn<int>("index");
@@ -310,7 +310,7 @@ void tst_QtIcoImageFormat::pngCompression_data()
QTest::newRow("PNG compression") << "valid/Qt.ico" << 4 << 256 << 256;
}
-void tst_QtIcoImageFormat::pngCompression()
+void tst_QIcoImageFormat::pngCompression()
{
QFETCH(QString, fileName);
QFETCH(int, index);
@@ -327,5 +327,6 @@ void tst_QtIcoImageFormat::pngCompression()
QCOMPARE(image.height(), height);
}
-QTEST_MAIN(tst_QtIcoImageFormat)
-#include "tst_qticoimageformat.moc"
+QTEST_MAIN(tst_QIcoImageFormat)
+#include "tst_qicoimageformat.moc"
+
diff --git a/tests/auto/qicon/icons/testtheme/16x16/actions/appointment-new.png b/tests/auto/qicon/icons/testtheme/16x16/actions/appointment-new.png
new file mode 100644
index 000000000..18b7c6781
--- /dev/null
+++ b/tests/auto/qicon/icons/testtheme/16x16/actions/appointment-new.png
Binary files differ
diff --git a/tests/auto/qicon/icons/testtheme/22x22/actions/appointment-new.png b/tests/auto/qicon/icons/testtheme/22x22/actions/appointment-new.png
new file mode 100644
index 000000000..d676ffd46
--- /dev/null
+++ b/tests/auto/qicon/icons/testtheme/22x22/actions/appointment-new.png
Binary files differ
diff --git a/tests/auto/qicon/icons/testtheme/32x32/actions/appointment-new.png b/tests/auto/qicon/icons/testtheme/32x32/actions/appointment-new.png
new file mode 100644
index 000000000..85daef3b0
--- /dev/null
+++ b/tests/auto/qicon/icons/testtheme/32x32/actions/appointment-new.png
Binary files differ
diff --git a/tests/auto/qicon/icons/testtheme/index.theme b/tests/auto/qicon/icons/testtheme/index.theme
new file mode 100644
index 000000000..e18736ab4
--- /dev/null
+++ b/tests/auto/qicon/icons/testtheme/index.theme
@@ -0,0 +1,492 @@
+[Icon Theme]
+_Name=Test
+_Comment=Test Theme
+Inherits=crystalsvg, themeparent
+Example=x-directory-normal
+
+# KDE Specific Stuff
+DisplayDepth=32
+LinkOverlay=link_overlay
+LockOverlay=lock_overlay
+ZipOverlay=zip_overlay
+DesktopDefault=48
+DesktopSizes=16,22,32,48,64,72,96,128
+ToolbarDefault=22
+ToolbarSizes=16,22,32,48
+MainToolbarDefault=22
+MainToolbarSizes=16,22,32,48
+SmallDefault=16
+SmallSizes=16
+PanelDefault=32
+PanelSizes=16,22,32,48,64,72,96,128
+
+# Directory list
+Directories=16x16/actions,16x16/apps,16x16/categories,16x16/devices,16x16/emblems,16x16/emotes,16x16/mimetypes,16x16/places,16x16/status,22x22/actions,22x22/apps,22x22/categories,22x22/devices,22x22/emblems,22x22/emotes,22x22/mimetypes,22x22/places,22x22/status,24x24/actions,24x24/apps,24x24/categories,24x24/devices,24x24/emblems,24x24/emotes,24x24/mimetypes,24x24/places,24x24/status,32x32/actions,32x32/apps,32x32/categories,32x32/devices,32x32/emblems,32x32/emotes,32x32/mimetypes,32x32/places,32x32/status,48x48/actions,48x48/apps,48x48/categories,48x48/devices,48x48/emblems,48x48/emotes,48x48/mimetypes,48x48/places,48x48/status,64x64/actions,64x64/apps,64x64/categories,64x64/devices,64x64/emblems,64x64/emotes,64x64/mimetypes,64x64/places,64x64/status,72x72/actions,72x72/apps,72x72/categories,72x72/devices,72x72/emblems,72x72/emotes,72x72/mimetypes,72x72/places,72x72/status,96x96/actions,96x96/apps,96x96/categories,96x96/devices,96x96/emblems,96x96/emotes,96x96/mimetypes,96x96/places,96x96/status,128x128/actions,128x128/apps,128x128/categories,128x128/devices,128x128/emblems,128x128/emotes,128x128/mimetypes,128x128/places,128x128/status,scalable/actions,scalable/apps,scalable/categories,scalable/devices,scalable/emblems,scalable/emotes,scalable/mimetypes,scalable/places,scalable/status
+
+[16x16/actions]
+Size=16
+Context=Actions
+Type=Fixed
+
+[16x16/apps]
+Size=16
+Context=Applications
+Type=Fixed
+
+[16x16/categories]
+Size=16
+Context=Categories
+Type=Fixed
+
+[16x16/devices]
+Size=16
+Context=Devices
+Type=Fixed
+
+[16x16/emblems]
+Size=16
+Context=Emblems
+Type=Fixed
+
+[16x16/emotes]
+Size=16
+Context=Emotes
+Type=Fixed
+
+[16x16/mimetypes]
+Size=16
+Context=MimeTypes
+Type=Fixed
+
+[16x16/places]
+Size=16
+Context=Places
+Type=Fixed
+
+[16x16/status]
+Size=16
+Context=Status
+Type=Fixed
+
+[22x22/actions]
+Size=22
+Context=Actions
+Type=Fixed
+
+[22x22/apps]
+Size=22
+Context=Applications
+Type=Fixed
+
+[22x22/categories]
+Size=22
+Context=Categories
+Type=Fixed
+
+[22x22/devices]
+Size=22
+Context=Devices
+Type=Fixed
+
+[22x22/emblems]
+Size=22
+Context=Emblems
+Type=Fixed
+
+[22x22/emotes]
+Size=22
+Context=Emotes
+Type=Fixed
+
+[22x22/mimetypes]
+Size=22
+Context=MimeTypes
+Type=Fixed
+
+[22x22/places]
+Size=22
+Context=Places
+Type=Fixed
+
+[22x22/status]
+Size=22
+Context=Status
+Type=Fixed
+
+[24x24/actions]
+Size=24
+Context=Actions
+Type=Fixed
+
+[24x24/apps]
+Size=24
+Context=Applications
+Type=Fixed
+
+[24x24/categories]
+Size=24
+Context=Categories
+Type=Fixed
+
+[24x24/devices]
+Size=24
+Context=Devices
+Type=Fixed
+
+[24x24/emblems]
+Size=24
+Context=Emblems
+Type=Fixed
+
+[24x24/emotes]
+Size=24
+Context=Emotes
+Type=Fixed
+
+[24x24/mimetypes]
+Size=24
+Context=MimeTypes
+Type=Fixed
+
+[24x24/places]
+Size=24
+Context=Places
+Type=Fixed
+
+[24x24/status]
+Size=24
+Context=Status
+Type=Fixed
+
+[32x32/actions]
+Size=32
+Context=Actions
+Type=Fixed
+
+[32x32/apps]
+Size=32
+Context=Applications
+Type=Fixed
+
+[32x32/categories]
+Size=32
+Context=Categories
+Type=Fixed
+
+[32x32/devices]
+Size=32
+Context=Devices
+Type=Fixed
+
+[32x32/emblems]
+Size=32
+Context=Emblems
+Type=Fixed
+
+[32x32/emotes]
+Size=32
+Context=Emotes
+Type=Fixed
+
+[32x32/mimetypes]
+Size=32
+Context=MimeTypes
+Type=Fixed
+
+[32x32/places]
+Size=32
+Context=Places
+Type=Fixed
+
+[32x32/status]
+Size=32
+Context=Status
+Type=Fixed
+
+[48x48/actions]
+Size=48
+Context=Actions
+Type=Fixed
+
+[48x48/apps]
+Size=48
+Context=Applications
+Type=Fixed
+
+[48x48/categories]
+Size=48
+Context=Categories
+Type=Fixed
+
+[48x48/devices]
+Size=48
+Context=Devices
+Type=Fixed
+
+[48x48/emblems]
+Size=48
+Context=Emblems
+Type=Fixed
+
+[48x48/emotes]
+Size=48
+Context=Emotes
+Type=Fixed
+
+[48x48/mimetypes]
+Size=48
+Context=MimeTypes
+Type=Fixed
+
+[48x48/places]
+Size=48
+Context=Places
+Type=Fixed
+
+[48x48/status]
+Size=48
+Context=Status
+Type=Fixed
+
+[64x64/actions]
+Size=64
+Context=Actions
+Type=Fixed
+
+[64x64/apps]
+Size=64
+Context=Applications
+Type=Fixed
+
+[64x64/categories]
+Size=64
+Context=Categories
+Type=Fixed
+
+[64x64/devices]
+Size=64
+Context=Devices
+Type=Fixed
+
+[64x64/emblems]
+Size=64
+Context=Emblems
+Type=Fixed
+
+[64x64/emotes]
+Size=64
+Context=Emotes
+Type=Fixed
+
+[64x64/mimetypes]
+Size=64
+Context=MimeTypes
+Type=Fixed
+
+[64x64/places]
+Size=64
+Context=Places
+Type=Fixed
+
+[64x64/status]
+Size=64
+Context=Status
+Type=Fixed
+
+[72x72/actions]
+Size=72
+Context=Actions
+Type=Fixed
+
+[72x72/apps]
+Size=72
+Context=Applications
+Type=Fixed
+
+[72x72/categories]
+Size=72
+Context=Categories
+Type=Fixed
+
+[72x72/devices]
+Size=72
+Context=Devices
+Type=Fixed
+
+[72x72/emblems]
+Size=72
+Context=Emblems
+Type=Fixed
+
+[72x72/emotes]
+Size=72
+Context=Emotes
+Type=Fixed
+
+[72x72/mimetypes]
+Size=72
+Context=MimeTypes
+Type=Fixed
+
+[72x72/places]
+Size=72
+Context=Places
+Type=Fixed
+
+[72x72/status]
+Size=72
+Context=Status
+Type=Fixed
+
+[96x96/actions]
+Size=96
+Context=Actions
+Type=Fixed
+
+[96x96/apps]
+Size=96
+Context=Applications
+Type=Fixed
+
+[96x96/categories]
+Size=96
+Context=Categories
+Type=Fixed
+
+[96x96/devices]
+Size=96
+Context=Devices
+Type=Fixed
+
+[96x96/emblems]
+Size=96
+Context=Emblems
+Type=Fixed
+
+[96x96/emotes]
+Size=96
+Context=Emotes
+Type=Fixed
+
+[96x96/mimetypes]
+Size=96
+Context=MimeTypes
+Type=Fixed
+
+[96x96/places]
+Size=96
+Context=Places
+Type=Fixed
+
+[96x96/status]
+Size=96
+Context=Status
+Type=Fixed
+
+[128x128/actions]
+Size=128
+Context=Actions
+Type=Fixed
+
+[128x128/apps]
+Size=128
+Context=Applications
+Type=Fixed
+
+[128x128/categories]
+Size=128
+Context=Categories
+Type=Fixed
+
+[128x128/devices]
+Size=128
+Context=Devices
+Type=Fixed
+
+[128x128/emblems]
+Size=128
+Context=Emblems
+Type=Fixed
+
+[128x128/emotes]
+Size=128
+Context=Emotes
+Type=Fixed
+
+[128x128/mimetypes]
+Size=128
+Context=MimeTypes
+Type=Fixed
+
+[128x128/places]
+Size=128
+Context=Places
+Type=Fixed
+
+[128x128/status]
+Size=128
+Context=Status
+Type=Fixed
+
+[scalable/actions]
+Size=48
+Context=Actions
+Type=Scalable
+MinSize=32
+MaxSize=256
+
+[scalable/apps]
+Size=48
+Context=Applications
+Type=Scalable
+MinSize=32
+MaxSize=256
+
+[scalable/categories]
+Size=48
+Context=Categories
+Type=Scalable
+MinSize=32
+MaxSize=256
+
+[scalable/devices]
+Size=48
+Context=Devices
+Type=Scalable
+MinSize=32
+MaxSize=256
+
+[scalable/emblems]
+Size=48
+Context=Emblems
+Type=Scalable
+MinSize=32
+MaxSize=256
+
+[scalable/emotes]
+Size=48
+Context=Emotes
+Type=Scalable
+Minsize=32
+MaxSize=256
+
+[scalable/mimetypes]
+Size=48
+Context=MimeTypes
+Type=Scalable
+MinSize=32
+MaxSize=256
+
+[scalable/places]
+Size=48
+Context=Places
+Type=Scalable
+MinSize=32
+MaxSize=256
+
+[scalable/status]
+Size=48
+Context=Status
+Type=Scalable
+MinSize=32
+MaxSize=256
diff --git a/tests/auto/qicon/icons/testtheme/scalable/actions/svg-only.svg b/tests/auto/qicon/icons/testtheme/scalable/actions/svg-only.svg
new file mode 100644
index 000000000..4cb14f82f
--- /dev/null
+++ b/tests/auto/qicon/icons/testtheme/scalable/actions/svg-only.svg
@@ -0,0 +1,425 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ inkscape:export-ydpi="90.000000"
+ inkscape:export-xdpi="90.000000"
+ inkscape:export-filename="/home/jimmac/Desktop/wi-fi.png"
+ width="48px"
+ height="48px"
+ id="svg11300"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ sodipodi:docbase="/home/tigert/cvs/freedesktop.org/tango-icon-theme/scalable/actions"
+ sodipodi:docname="appointment-new.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs3">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 24 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="48 : 24 : 1"
+ inkscape:persp3d-origin="24 : 16 : 1"
+ id="perspective59" />
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient5204">
+ <stop
+ style="stop-color:#c4a000;stop-opacity:1;"
+ offset="0"
+ id="stop5206" />
+ <stop
+ style="stop-color:#c4a000;stop-opacity:0;"
+ offset="1"
+ id="stop5208" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient5196">
+ <stop
+ style="stop-color:#c4a000;stop-opacity:1;"
+ offset="0"
+ id="stop5198" />
+ <stop
+ style="stop-color:#c4a000;stop-opacity:0;"
+ offset="1"
+ id="stop5200" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient12512">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1.0000000;"
+ offset="0.0000000"
+ id="stop12513" />
+ <stop
+ style="stop-color:#fff520;stop-opacity:0.89108908;"
+ offset="0.50000000"
+ id="stop12517" />
+ <stop
+ style="stop-color:#fff300;stop-opacity:0.0000000;"
+ offset="1.0000000"
+ id="stop12514" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient12512"
+ id="radialGradient278"
+ gradientUnits="userSpaceOnUse"
+ cx="55.000000"
+ cy="125.00000"
+ fx="55.000000"
+ fy="125.00000"
+ r="14.375000" />
+ <linearGradient
+ id="linearGradient10653">
+ <stop
+ style="stop-color:#f3f4ff;stop-opacity:1.0000000;"
+ offset="0.0000000"
+ id="stop10655" />
+ <stop
+ style="stop-color:#9193af;stop-opacity:1.0000000;"
+ offset="1.0000000"
+ id="stop10657" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient42174">
+ <stop
+ style="stop-color:#a0a0a0;stop-opacity:1.0000000;"
+ offset="0.0000000"
+ id="stop42176" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1.0000000;"
+ offset="1.0000000"
+ id="stop42178" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2145">
+ <stop
+ style="stop-color:#fffffd;stop-opacity:1.0000000;"
+ offset="0.0000000"
+ id="stop2147" />
+ <stop
+ style="stop-color:#cbcbc9;stop-opacity:1.0000000;"
+ offset="1.0000000"
+ id="stop2149" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient37935">
+ <stop
+ id="stop37937"
+ offset="0.0000000"
+ style="stop-color:#9497b3;stop-opacity:1.0000000;" />
+ <stop
+ id="stop37939"
+ offset="1.0000000"
+ style="stop-color:#4c4059;stop-opacity:1.0000000;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2152">
+ <stop
+ id="stop2154"
+ offset="0.0000000"
+ style="stop-color:#9aa29a;stop-opacity:1.0000000;" />
+ <stop
+ id="stop2156"
+ offset="1.0000000"
+ style="stop-color:#b5beb5;stop-opacity:1.0000000;" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient3816">
+ <stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="0"
+ id="stop3818" />
+ <stop
+ style="stop-color:#000000;stop-opacity:0;"
+ offset="1"
+ id="stop3820" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3816"
+ id="radialGradient3822"
+ cx="31.112698"
+ cy="19.008621"
+ fx="31.112698"
+ fy="19.008621"
+ r="8.6620579"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2152"
+ id="linearGradient4307"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(3.123841,0.000000,0.000000,0.969691,-31.88758,-19.59492)"
+ x1="8.9156475"
+ y1="37.197018"
+ x2="9.8855033"
+ y2="52.090678" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient10653"
+ id="radialGradient4309"
+ gradientUnits="userSpaceOnUse"
+ cx="11.329200"
+ cy="10.583970"
+ fx="11.329200"
+ fy="10.583970"
+ r="15.532059" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2145"
+ id="radialGradient4311"
+ gradientUnits="userSpaceOnUse"
+ cx="11.901996"
+ cy="10.045444"
+ fx="11.901996"
+ fy="10.045444"
+ r="29.292715" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient42174"
+ id="linearGradient4313"
+ gradientUnits="userSpaceOnUse"
+ x1="6.3422160"
+ y1="7.7893324"
+ x2="22.218424"
+ y2="25.884274" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5196"
+ id="radialGradient5202"
+ cx="23.375"
+ cy="10.972863"
+ fx="23.375"
+ fy="10.972863"
+ r="3.3478092"
+ gradientTransform="matrix(3.630420,1.654030e-15,-1.608743e-15,3.742066,-61.48607,-29.18618)"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5204"
+ id="linearGradient5210"
+ x1="19.667364"
+ y1="4.2570662"
+ x2="20.329933"
+ y2="5.2845874"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient37935"
+ id="radialGradient5212"
+ gradientUnits="userSpaceOnUse"
+ cx="8.7468252"
+ cy="6.8283234"
+ fx="8.7468252"
+ fy="6.8283234"
+ r="29.889715" />
+ </defs>
+ <sodipodi:namedview
+ stroke="#c4a000"
+ fill="#babdb6"
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="0.25490196"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="11.313708"
+ inkscape:cx="13.2248"
+ inkscape:cy="25.106052"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:grid-bbox="true"
+ inkscape:document-units="px"
+ inkscape:showpageshadow="false"
+ inkscape:window-width="833"
+ inkscape:window-height="772"
+ inkscape:window-x="305"
+ inkscape:window-y="76" />
+ <metadata
+ id="metadata4">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Jakub Steiner</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <dc:source>http://jimmac.musichall.cz</dc:source>
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/publicdomain/" />
+ <dc:title>New Appointment</dc:title>
+ <dc:subject>
+ <rdf:Bag>
+ <rdf:li>appointment</rdf:li>
+ <rdf:li>new</rdf:li>
+ <rdf:li>meeting</rdf:li>
+ <rdf:li>rvsp</rdf:li>
+ </rdf:Bag>
+ </dc:subject>
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/publicdomain/">
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#Reproduction" />
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#Distribution" />
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <path
+ d="M 39.774755 19.008621 A 8.6620579 8.6620579 0 1 1 22.45064,19.008621 A 8.6620579 8.6620579 0 1 1 39.774755 19.008621 z"
+ sodipodi:ry="8.6620579"
+ sodipodi:rx="8.6620579"
+ sodipodi:cy="19.008621"
+ sodipodi:cx="31.112698"
+ id="path4318"
+ style="opacity:1;color:#000000;fill:url(#radialGradient3822);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ sodipodi:type="arc"
+ transform="matrix(2.563158,0.000000,0.000000,1.219602,-55.98414,14.04144)" />
+ <path
+ sodipodi:nodetypes="cccc"
+ id="path14341"
+ d="M 18.587591,1.403729 L 4.226755,18.096665 L 5.4854717,19.339844 L 18.587591,1.403729 z "
+ style="color:#000000;fill:url(#linearGradient4307);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ sodipodi:nodetypes="cccc"
+ id="path18921"
+ d="M 18.467176,1.3138035 L 5.6605716,19.072612 L 7.4900985,20.687913 L 18.467176,1.3138035 z "
+ style="fill:#fefefe;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1" />
+ <path
+ transform="matrix(1.431529,0.000000,0.000000,1.431529,0.569459,-1.654618)"
+ d="M 31.160714 16.910715 A 14.910714 14.910714 0 1 1 1.3392859,16.910715 A 14.910714 14.910714 0 1 1 31.160714 16.910715 z"
+ sodipodi:ry="14.910714"
+ sodipodi:rx="14.910714"
+ sodipodi:cy="16.910715"
+ sodipodi:cx="16.25"
+ id="path27786"
+ style="fill:url(#radialGradient5212);fill-opacity:1;fill-rule:evenodd;stroke:#605773;stroke-width:0.69855404;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1"
+ sodipodi:type="arc" />
+ <path
+ transform="matrix(1.163838,0.000000,0.000000,1.163838,4.824801,2.777556)"
+ d="M 31.160714 16.910715 A 14.910714 14.910714 0 1 1 1.3392859,16.910715 A 14.910714 14.910714 0 1 1 31.160714 16.910715 z"
+ sodipodi:ry="14.910714"
+ sodipodi:rx="14.910714"
+ sodipodi:cy="16.910715"
+ sodipodi:cx="16.25"
+ id="path35549"
+ style="fill:url(#radialGradient4311);fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient4313);stroke-width:0.71139598;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1"
+ sodipodi:type="arc" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;color:#000000;fill:url(#radialGradient5202);fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient5210);stroke-width:0.56498736;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="path4120"
+ sodipodi:cx="23.375"
+ sodipodi:cy="11.875"
+ sodipodi:rx="8.5"
+ sodipodi:ry="8.5"
+ d="M 16.679382,6.6387137 A 8.5,8.5 0 0 1 23.332691,3.3751053 L 23.375,11.875 z"
+ transform="matrix(1.769951,0.000000,0.000000,1.769951,-17.02424,1.610741)"
+ sodipodi:start="3.8052902"
+ sodipodi:end="4.7074114" />
+ <path
+ transform="matrix(2.073295,0.000000,0.000000,2.073295,-7.310224,-13.13682)"
+ d="M 16.40625 17.28125 A 1.21875 1.21875 0 1 1 13.96875,17.28125 A 1.21875 1.21875 0 1 1 16.40625 17.28125 z"
+ sodipodi:ry="1.21875"
+ sodipodi:rx="1.21875"
+ sodipodi:cy="17.28125"
+ sodipodi:cx="15.1875"
+ id="path34778"
+ style="fill:#f3f3f3;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.48232403;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;stroke-dasharray:none"
+ sodipodi:type="arc" />
+ <path
+ id="path35559"
+ d="M 22.176614,20.718014 L 13.155702,13.140282"
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ id="path35561"
+ d="M 19.408614,29.776506 L 22.368655,25.283228"
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ sodipodi:nodetypes="cc" />
+ <path
+ transform="matrix(2.749493,0.000000,0.000000,2.749493,-22.30073,-12.40939)"
+ d="M 17.324117 7.6932044 A 0.61871845 0.61871845 0 1 1 16.08668,7.6932044 A 0.61871845 0.61871845 0 1 1 17.324117 7.6932044 z"
+ sodipodi:ry="0.61871845"
+ sodipodi:rx="0.61871845"
+ sodipodi:cy="7.6932044"
+ sodipodi:cx="16.705399"
+ id="path35563"
+ style="fill:#b6b9b1;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.36871839;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;opacity:1"
+ sodipodi:type="arc" />
+ <path
+ transform="matrix(2.749493,0.000000,0.000000,2.749493,-22.30073,14.80922)"
+ d="M 17.324117 7.6932044 A 0.61871845 0.61871845 0 1 1 16.08668,7.6932044 A 0.61871845 0.61871845 0 1 1 17.324117 7.6932044 z"
+ sodipodi:ry="0.61871845"
+ sodipodi:rx="0.61871845"
+ sodipodi:cy="7.6932044"
+ sodipodi:cx="16.705399"
+ id="path35565"
+ style="fill:#b6b9b1;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.36871839;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;opacity:1"
+ sodipodi:type="arc" />
+ <path
+ transform="matrix(2.749493,0.000000,0.000000,2.749493,-35.91004,1.199890)"
+ d="M 17.324117 7.6932044 A 0.61871845 0.61871845 0 1 1 16.08668,7.6932044 A 0.61871845 0.61871845 0 1 1 17.324117 7.6932044 z"
+ sodipodi:ry="0.61871845"
+ sodipodi:rx="0.61871845"
+ sodipodi:cy="7.6932044"
+ sodipodi:cx="16.705399"
+ id="path35567"
+ style="fill:#b6b9b1;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.36871839;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;opacity:1"
+ sodipodi:type="arc" />
+ <path
+ transform="matrix(2.749493,0.000000,0.000000,2.749493,-8.691448,1.199890)"
+ d="M 17.324117 7.6932044 A 0.61871845 0.61871845 0 1 1 16.08668,7.6932044 A 0.61871845 0.61871845 0 1 1 17.324117 7.6932044 z"
+ sodipodi:ry="0.61871845"
+ sodipodi:rx="0.61871845"
+ sodipodi:cy="7.6932044"
+ sodipodi:cx="16.705399"
+ id="path35569"
+ style="fill:#b6b9b1;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.36871839;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;opacity:1"
+ sodipodi:type="arc" />
+ <path
+ sodipodi:type="arc"
+ style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#radialGradient4309);stroke-width:0.73656511;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1"
+ id="path10651"
+ sodipodi:cx="16.25"
+ sodipodi:cy="16.910715"
+ sodipodi:rx="14.910714"
+ sodipodi:ry="14.910714"
+ d="M 31.160714 16.910715 A 14.910714 14.910714 0 1 1 1.3392859,16.910715 A 14.910714 14.910714 0 1 1 31.160714 16.910715 z"
+ transform="matrix(1.357654,0.000000,0.000000,1.357654,1.769896,-0.493735)" />
+ <path
+ sodipodi:type="arc"
+ style="color:#000000;fill:url(#radialGradient278);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.25000024;stroke-linecap:butt;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:block"
+ id="path12511"
+ sodipodi:cx="55"
+ sodipodi:cy="125"
+ sodipodi:rx="14.375"
+ sodipodi:ry="14.375"
+ d="M 69.375 125 A 14.375 14.375 0 1 1 40.625,125 A 14.375 14.375 0 1 1 69.375 125 z"
+ transform="matrix(0.611127,0.000000,0.000000,0.611127,5.544052,-66.92818)"
+ inkscape:export-filename="/home/jimmac/ximian_art/icons/nautilus/suse93/stock_new-16.png"
+ inkscape:export-xdpi="33.852203"
+ inkscape:export-ydpi="33.852203" />
+ </g>
+</svg>
diff --git a/tests/auto/qicon/icons/themeparent/16x16/actions/address-book-new.png b/tests/auto/qicon/icons/themeparent/16x16/actions/address-book-new.png
new file mode 100644
index 000000000..2098cfdf3
--- /dev/null
+++ b/tests/auto/qicon/icons/themeparent/16x16/actions/address-book-new.png
Binary files differ
diff --git a/tests/auto/qicon/icons/themeparent/16x16/actions/appointment-new.png b/tests/auto/qicon/icons/themeparent/16x16/actions/appointment-new.png
new file mode 100644
index 000000000..18b7c6781
--- /dev/null
+++ b/tests/auto/qicon/icons/themeparent/16x16/actions/appointment-new.png
Binary files differ
diff --git a/tests/auto/qicon/icons/themeparent/22x22/actions/address-book-new.png b/tests/auto/qicon/icons/themeparent/22x22/actions/address-book-new.png
new file mode 100644
index 000000000..fad446cd9
--- /dev/null
+++ b/tests/auto/qicon/icons/themeparent/22x22/actions/address-book-new.png
Binary files differ
diff --git a/tests/auto/qicon/icons/themeparent/22x22/actions/appointment-new.png b/tests/auto/qicon/icons/themeparent/22x22/actions/appointment-new.png
new file mode 100644
index 000000000..d676ffd46
--- /dev/null
+++ b/tests/auto/qicon/icons/themeparent/22x22/actions/appointment-new.png
Binary files differ
diff --git a/tests/auto/qicon/icons/themeparent/32x32/actions/address-book-new.png b/tests/auto/qicon/icons/themeparent/32x32/actions/address-book-new.png
new file mode 100644
index 000000000..420139d30
--- /dev/null
+++ b/tests/auto/qicon/icons/themeparent/32x32/actions/address-book-new.png
Binary files differ
diff --git a/tests/auto/qicon/icons/themeparent/32x32/actions/appointment-new.png b/tests/auto/qicon/icons/themeparent/32x32/actions/appointment-new.png
new file mode 100644
index 000000000..85daef3b0
--- /dev/null
+++ b/tests/auto/qicon/icons/themeparent/32x32/actions/appointment-new.png
Binary files differ
diff --git a/tests/auto/qicon/icons/themeparent/index.theme b/tests/auto/qicon/icons/themeparent/index.theme
new file mode 100644
index 000000000..e536a0bf2
--- /dev/null
+++ b/tests/auto/qicon/icons/themeparent/index.theme
@@ -0,0 +1,492 @@
+[Icon Theme]
+_Name=Test
+_Comment=Test Theme
+Inherits=gnome,crystalsvg
+Example=x-directory-normal
+
+# KDE Specific Stuff
+DisplayDepth=32
+LinkOverlay=link_overlay
+LockOverlay=lock_overlay
+ZipOverlay=zip_overlay
+DesktopDefault=48
+DesktopSizes=16,22,32,48,64,72,96,128
+ToolbarDefault=22
+ToolbarSizes=16,22,32,48
+MainToolbarDefault=22
+MainToolbarSizes=16,22,32,48
+SmallDefault=16
+SmallSizes=16
+PanelDefault=32
+PanelSizes=16,22,32,48,64,72,96,128
+
+# Directory list
+Directories=16x16/actions,16x16/apps,16x16/categories,16x16/devices,16x16/emblems,16x16/emotes,16x16/mimetypes,16x16/places,16x16/status,22x22/actions,22x22/apps,22x22/categories,22x22/devices,22x22/emblems,22x22/emotes,22x22/mimetypes,22x22/places,22x22/status,24x24/actions,24x24/apps,24x24/categories,24x24/devices,24x24/emblems,24x24/emotes,24x24/mimetypes,24x24/places,24x24/status,32x32/actions,32x32/apps,32x32/categories,32x32/devices,32x32/emblems,32x32/emotes,32x32/mimetypes,32x32/places,32x32/status,48x48/actions,48x48/apps,48x48/categories,48x48/devices,48x48/emblems,48x48/emotes,48x48/mimetypes,48x48/places,48x48/status,64x64/actions,64x64/apps,64x64/categories,64x64/devices,64x64/emblems,64x64/emotes,64x64/mimetypes,64x64/places,64x64/status,72x72/actions,72x72/apps,72x72/categories,72x72/devices,72x72/emblems,72x72/emotes,72x72/mimetypes,72x72/places,72x72/status,96x96/actions,96x96/apps,96x96/categories,96x96/devices,96x96/emblems,96x96/emotes,96x96/mimetypes,96x96/places,96x96/status,128x128/actions,128x128/apps,128x128/categories,128x128/devices,128x128/emblems,128x128/emotes,128x128/mimetypes,128x128/places,128x128/status,scalable/actions,scalable/apps,scalable/categories,scalable/devices,scalable/emblems,scalable/emotes,scalable/mimetypes,scalable/places,scalable/status
+
+[16x16/actions]
+Size=16
+Context=Actions
+Type=Fixed
+
+[16x16/apps]
+Size=16
+Context=Applications
+Type=Fixed
+
+[16x16/categories]
+Size=16
+Context=Categories
+Type=Fixed
+
+[16x16/devices]
+Size=16
+Context=Devices
+Type=Fixed
+
+[16x16/emblems]
+Size=16
+Context=Emblems
+Type=Fixed
+
+[16x16/emotes]
+Size=16
+Context=Emotes
+Type=Fixed
+
+[16x16/mimetypes]
+Size=16
+Context=MimeTypes
+Type=Fixed
+
+[16x16/places]
+Size=16
+Context=Places
+Type=Fixed
+
+[16x16/status]
+Size=16
+Context=Status
+Type=Fixed
+
+[22x22/actions]
+Size=22
+Context=Actions
+Type=Fixed
+
+[22x22/apps]
+Size=22
+Context=Applications
+Type=Fixed
+
+[22x22/categories]
+Size=22
+Context=Categories
+Type=Fixed
+
+[22x22/devices]
+Size=22
+Context=Devices
+Type=Fixed
+
+[22x22/emblems]
+Size=22
+Context=Emblems
+Type=Fixed
+
+[22x22/emotes]
+Size=22
+Context=Emotes
+Type=Fixed
+
+[22x22/mimetypes]
+Size=22
+Context=MimeTypes
+Type=Fixed
+
+[22x22/places]
+Size=22
+Context=Places
+Type=Fixed
+
+[22x22/status]
+Size=22
+Context=Status
+Type=Fixed
+
+[24x24/actions]
+Size=24
+Context=Actions
+Type=Fixed
+
+[24x24/apps]
+Size=24
+Context=Applications
+Type=Fixed
+
+[24x24/categories]
+Size=24
+Context=Categories
+Type=Fixed
+
+[24x24/devices]
+Size=24
+Context=Devices
+Type=Fixed
+
+[24x24/emblems]
+Size=24
+Context=Emblems
+Type=Fixed
+
+[24x24/emotes]
+Size=24
+Context=Emotes
+Type=Fixed
+
+[24x24/mimetypes]
+Size=24
+Context=MimeTypes
+Type=Fixed
+
+[24x24/places]
+Size=24
+Context=Places
+Type=Fixed
+
+[24x24/status]
+Size=24
+Context=Status
+Type=Fixed
+
+[32x32/actions]
+Size=32
+Context=Actions
+Type=Fixed
+
+[32x32/apps]
+Size=32
+Context=Applications
+Type=Fixed
+
+[32x32/categories]
+Size=32
+Context=Categories
+Type=Fixed
+
+[32x32/devices]
+Size=32
+Context=Devices
+Type=Fixed
+
+[32x32/emblems]
+Size=32
+Context=Emblems
+Type=Fixed
+
+[32x32/emotes]
+Size=32
+Context=Emotes
+Type=Fixed
+
+[32x32/mimetypes]
+Size=32
+Context=MimeTypes
+Type=Fixed
+
+[32x32/places]
+Size=32
+Context=Places
+Type=Fixed
+
+[32x32/status]
+Size=32
+Context=Status
+Type=Fixed
+
+[48x48/actions]
+Size=48
+Context=Actions
+Type=Fixed
+
+[48x48/apps]
+Size=48
+Context=Applications
+Type=Fixed
+
+[48x48/categories]
+Size=48
+Context=Categories
+Type=Fixed
+
+[48x48/devices]
+Size=48
+Context=Devices
+Type=Fixed
+
+[48x48/emblems]
+Size=48
+Context=Emblems
+Type=Fixed
+
+[48x48/emotes]
+Size=48
+Context=Emotes
+Type=Fixed
+
+[48x48/mimetypes]
+Size=48
+Context=MimeTypes
+Type=Fixed
+
+[48x48/places]
+Size=48
+Context=Places
+Type=Fixed
+
+[48x48/status]
+Size=48
+Context=Status
+Type=Fixed
+
+[64x64/actions]
+Size=64
+Context=Actions
+Type=Fixed
+
+[64x64/apps]
+Size=64
+Context=Applications
+Type=Fixed
+
+[64x64/categories]
+Size=64
+Context=Categories
+Type=Fixed
+
+[64x64/devices]
+Size=64
+Context=Devices
+Type=Fixed
+
+[64x64/emblems]
+Size=64
+Context=Emblems
+Type=Fixed
+
+[64x64/emotes]
+Size=64
+Context=Emotes
+Type=Fixed
+
+[64x64/mimetypes]
+Size=64
+Context=MimeTypes
+Type=Fixed
+
+[64x64/places]
+Size=64
+Context=Places
+Type=Fixed
+
+[64x64/status]
+Size=64
+Context=Status
+Type=Fixed
+
+[72x72/actions]
+Size=72
+Context=Actions
+Type=Fixed
+
+[72x72/apps]
+Size=72
+Context=Applications
+Type=Fixed
+
+[72x72/categories]
+Size=72
+Context=Categories
+Type=Fixed
+
+[72x72/devices]
+Size=72
+Context=Devices
+Type=Fixed
+
+[72x72/emblems]
+Size=72
+Context=Emblems
+Type=Fixed
+
+[72x72/emotes]
+Size=72
+Context=Emotes
+Type=Fixed
+
+[72x72/mimetypes]
+Size=72
+Context=MimeTypes
+Type=Fixed
+
+[72x72/places]
+Size=72
+Context=Places
+Type=Fixed
+
+[72x72/status]
+Size=72
+Context=Status
+Type=Fixed
+
+[96x96/actions]
+Size=96
+Context=Actions
+Type=Fixed
+
+[96x96/apps]
+Size=96
+Context=Applications
+Type=Fixed
+
+[96x96/categories]
+Size=96
+Context=Categories
+Type=Fixed
+
+[96x96/devices]
+Size=96
+Context=Devices
+Type=Fixed
+
+[96x96/emblems]
+Size=96
+Context=Emblems
+Type=Fixed
+
+[96x96/emotes]
+Size=96
+Context=Emotes
+Type=Fixed
+
+[96x96/mimetypes]
+Size=96
+Context=MimeTypes
+Type=Fixed
+
+[96x96/places]
+Size=96
+Context=Places
+Type=Fixed
+
+[96x96/status]
+Size=96
+Context=Status
+Type=Fixed
+
+[128x128/actions]
+Size=128
+Context=Actions
+Type=Fixed
+
+[128x128/apps]
+Size=128
+Context=Applications
+Type=Fixed
+
+[128x128/categories]
+Size=128
+Context=Categories
+Type=Fixed
+
+[128x128/devices]
+Size=128
+Context=Devices
+Type=Fixed
+
+[128x128/emblems]
+Size=128
+Context=Emblems
+Type=Fixed
+
+[128x128/emotes]
+Size=128
+Context=Emotes
+Type=Fixed
+
+[128x128/mimetypes]
+Size=128
+Context=MimeTypes
+Type=Fixed
+
+[128x128/places]
+Size=128
+Context=Places
+Type=Fixed
+
+[128x128/status]
+Size=128
+Context=Status
+Type=Fixed
+
+[scalable/actions]
+Size=48
+Context=Actions
+Type=Scalable
+MinSize=32
+MaxSize=256
+
+[scalable/apps]
+Size=48
+Context=Applications
+Type=Scalable
+MinSize=32
+MaxSize=256
+
+[scalable/categories]
+Size=48
+Context=Categories
+Type=Scalable
+MinSize=32
+MaxSize=256
+
+[scalable/devices]
+Size=48
+Context=Devices
+Type=Scalable
+MinSize=32
+MaxSize=256
+
+[scalable/emblems]
+Size=48
+Context=Emblems
+Type=Scalable
+MinSize=32
+MaxSize=256
+
+[scalable/emotes]
+Size=48
+Context=Emotes
+Type=Scalable
+Minsize=32
+MaxSize=256
+
+[scalable/mimetypes]
+Size=48
+Context=MimeTypes
+Type=Scalable
+MinSize=32
+MaxSize=256
+
+[scalable/places]
+Size=48
+Context=Places
+Type=Scalable
+MinSize=32
+MaxSize=256
+
+[scalable/status]
+Size=48
+Context=Status
+Type=Scalable
+MinSize=32
+MaxSize=256
diff --git a/tests/auto/qicon/icons/themeparent/scalable/actions/address-book-new.svg b/tests/auto/qicon/icons/themeparent/scalable/actions/address-book-new.svg
new file mode 100644
index 000000000..600a82c1b
--- /dev/null
+++ b/tests/auto/qicon/icons/themeparent/scalable/actions/address-book-new.svg
@@ -0,0 +1,389 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="48px"
+ height="48px"
+ id="svg1256"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ sodipodi:docbase="/home/jimmac/src/cvs/tango-icon-theme/scalable/actions"
+ sodipodi:docname="address-book-new.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs3">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 24 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="48 : 24 : 1"
+ inkscape:persp3d-origin="24 : 16 : 1"
+ id="perspective58" />
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient5060">
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0"
+ id="stop5062" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop5064" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient5048">
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="0"
+ id="stop5050" />
+ <stop
+ id="stop5056"
+ offset="0.5"
+ style="stop-color:black;stop-opacity:1;" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop5052" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient12512">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1.0000000;"
+ offset="0.0000000"
+ id="stop12513" />
+ <stop
+ style="stop-color:#fff520;stop-opacity:0.89108908;"
+ offset="0.50000000"
+ id="stop12517" />
+ <stop
+ style="stop-color:#fff300;stop-opacity:0.0000000;"
+ offset="1.0000000"
+ id="stop12514" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient12512"
+ id="radialGradient278"
+ gradientUnits="userSpaceOnUse"
+ cx="55.000000"
+ cy="125.00000"
+ fx="55.000000"
+ fy="125.00000"
+ r="14.375000" />
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient2116">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop2118" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0;"
+ offset="1"
+ id="stop2120" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2094">
+ <stop
+ style="stop-color:#d6e3f0;stop-opacity:1.0000000;"
+ offset="0.0000000"
+ id="stop2096" />
+ <stop
+ style="stop-color:#95b1cf;stop-opacity:1.0000000;"
+ offset="1.0000000"
+ id="stop2098" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2803">
+ <stop
+ id="stop2805"
+ offset="0"
+ style="stop-color:#ffffff;stop-opacity:1;" />
+ <stop
+ id="stop2807"
+ offset="1.0000000"
+ style="stop-color:#cbcbcb;stop-opacity:1.0000000;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2795">
+ <stop
+ id="stop2797"
+ offset="0.0000000"
+ style="stop-color:#000000;stop-opacity:0.068627454;" />
+ <stop
+ id="stop2799"
+ offset="1.0000000"
+ style="stop-color:#ffffff;stop-opacity:1.0000000;" />
+ </linearGradient>
+ <linearGradient
+ gradientUnits="userSpaceOnUse"
+ y2="4.9530048"
+ x2="41.219128"
+ y1="4.9530050"
+ x1="35.433035"
+ gradientTransform="matrix(0.254000,0.000000,1.822151e-16,3.759813,0.788629,0.148567)"
+ id="linearGradient2801"
+ xlink:href="#linearGradient2795"
+ inkscape:collect="always" />
+ <linearGradient
+ gradientUnits="userSpaceOnUse"
+ y2="84.287079"
+ x2="10.219901"
+ y1="93.338043"
+ x1="10.496115"
+ gradientTransform="matrix(2.262742,0.000000,0.000000,0.441942,1.000000,-0.875000)"
+ id="linearGradient2813"
+ xlink:href="#linearGradient2803"
+ inkscape:collect="always" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2094"
+ id="linearGradient2100"
+ gradientTransform="matrix(0.957750,0.000000,0.000000,1.027989,1.000000,-0.571911)"
+ x1="6.5871811"
+ y1="22.132999"
+ x2="14.511404"
+ y2="22.132999"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2116"
+ id="linearGradient2112"
+ gradientTransform="matrix(1.025428,0.000000,0.000000,0.957303,0.000000,-0.806758)"
+ x1="73.361984"
+ y1="26.652197"
+ x2="-2.7582901"
+ y2="21.270376"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5060"
+ id="radialGradient5013"
+ gradientUnits="userSpaceOnUse"
+ cx="605.71429"
+ cy="486.64789"
+ fx="605.71429"
+ fy="486.64789"
+ r="117.14286"
+ gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5048"
+ id="linearGradient5016"
+ gradientUnits="userSpaceOnUse"
+ x1="302.85715"
+ y1="366.64789"
+ x2="302.85715"
+ y2="609.50507"
+ gradientTransform="matrix(2.774389,0,0,1.969706,-1892.179,-872.8854)" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5060"
+ id="radialGradient5020"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)"
+ cx="605.71429"
+ cy="486.64789"
+ fx="605.71429"
+ fy="486.64789"
+ r="117.14286" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5048"
+ id="linearGradient5027"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.774389,0,0,1.969706,-1892.179,-872.8854)"
+ x1="302.85715"
+ y1="366.64789"
+ x2="302.85715"
+ y2="609.50507" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5060"
+ id="radialGradient5029"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)"
+ cx="605.71429"
+ cy="486.64789"
+ fx="605.71429"
+ fy="486.64789"
+ r="117.14286" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5060"
+ id="radialGradient5031"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)"
+ cx="605.71429"
+ cy="486.64789"
+ fx="605.71429"
+ fy="486.64789"
+ r="117.14286" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="0.27843137"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1"
+ inkscape:cx="-111.52422"
+ inkscape:cy="10.167608"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:grid-bbox="true"
+ inkscape:document-units="px"
+ inkscape:window-width="872"
+ inkscape:window-height="688"
+ inkscape:window-x="562"
+ inkscape:window-y="160"
+ fill="#ef2929"
+ stroke="#cc0000"
+ inkscape:showpageshadow="false" />
+ <metadata
+ id="metadata4">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title>Addess Book - New</dc:title>
+ <dc:date />
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Jakub Steiner</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <dc:source>http://jimmac.musichall.cz</dc:source>
+ <dc:subject>
+ <rdf:Bag>
+ <rdf:li>address</rdf:li>
+ <rdf:li>contact</rdf:li>
+ <rdf:li>book</rdf:li>
+ </rdf:Bag>
+ </dc:subject>
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/publicdomain/" />
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/publicdomain/">
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#Reproduction" />
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#Distribution" />
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <path
+ style="opacity:1;color:#000000;fill:#edd400;fill-opacity:1;fill-rule:evenodd;stroke:#c4a000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 33.096456,4.6520202 L 40.521077,4.6520202 C 41.228184,4.6520202 41.758513,4.8287969 41.93529,5.71268 L 42.819174,12.606972 C 42.907562,13.667632 42.443523,14.021185 41.493349,14.021185 L 32.919679,14.021185 L 33.096456,4.6520202 z "
+ id="path21630"
+ sodipodi:nodetypes="ccccccc" />
+ <path
+ sodipodi:nodetypes="ccccccc"
+ id="path21632"
+ d="M 34.10295,5.638875 L 40.463507,5.638875 C 40.771656,5.638875 40.940266,5.669037 40.986054,5.960473 L 41.777489,12.344449 C 41.847258,12.775421 41.959897,13.019804 41.637211,13.034341 L 33.963412,13.034341 L 34.10295,5.638875 z "
+ style="opacity:0.48538011;color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.0000006;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ sodipodi:nodetypes="ccccccc"
+ id="path21634"
+ d="M 35.596456,12.40202 L 43.021077,12.40202 C 43.728184,12.40202 44.258513,12.578797 44.43529,13.46268 L 45.319174,20.356972 C 45.407562,21.417632 44.943523,21.771185 43.993349,21.771185 L 35.419679,21.771185 L 35.596456,12.40202 z "
+ style="opacity:1;color:#000000;fill:#9db029;fill-opacity:1;fill-rule:evenodd;stroke:#727e0a;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ style="opacity:0.48538011;color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.0000006;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 36.60295,13.388875 L 42.963507,13.388875 C 43.271656,13.388875 43.440266,13.419037 43.486054,13.710473 L 44.277489,20.094449 C 44.347258,20.525421 44.459897,20.769804 44.137211,20.784341 L 36.463412,20.784341 L 36.60295,13.388875 z "
+ id="path21636"
+ sodipodi:nodetypes="ccccccc" />
+ <path
+ style="opacity:1;color:#000000;fill:#ef2929;fill-opacity:1;fill-rule:evenodd;stroke:#cc0000;stroke-width:0.99999988;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 36.06451,20.776498 L 44.50992,20.776498 C 45.314245,20.776498 45.917487,20.995896 46.118569,22.092882 L 47.123975,30.649381 C 47.224515,31.965765 46.696677,32.40456 45.615866,32.40456 L 35.863428,32.40456 L 36.06451,20.776498 z "
+ id="path21638"
+ sodipodi:nodetypes="ccccccc" />
+ <path
+ sodipodi:nodetypes="ccccccc"
+ id="path21640"
+ d="M 37.209384,21.763574 L 44.444435,21.763574 C 44.79495,21.763574 44.986742,21.801928 45.038825,22.172513 L 45.939072,30.290267 C 46.018433,30.838284 46.146559,31.149038 45.779508,31.167522 L 37.050661,31.167522 L 37.209384,21.763574 z "
+ style="opacity:0.48538011;color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.00000072;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <g
+ id="g5022"
+ transform="matrix(2.165152e-2,0,0,4.307902e-2,43.08625,34.04509)">
+ <rect
+ y="-150.69685"
+ x="-1559.2523"
+ height="478.35718"
+ width="1339.6335"
+ id="rect4173"
+ style="opacity:0.40206185;color:black;fill:url(#linearGradient5027);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ sodipodi:nodetypes="cccc"
+ id="path5058"
+ d="M -219.61876,-150.68038 C -219.61876,-150.68038 -219.61876,327.65041 -219.61876,327.65041 C -76.744594,328.55086 125.78146,220.48075 125.78138,88.454235 C 125.78138,-43.572302 -33.655436,-150.68036 -219.61876,-150.68038 z "
+ style="opacity:0.40206185;color:black;fill:url(#radialGradient5029);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ style="opacity:0.40206185;color:black;fill:url(#radialGradient5031);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M -1559.2523,-150.68038 C -1559.2523,-150.68038 -1559.2523,327.65041 -1559.2523,327.65041 C -1702.1265,328.55086 -1904.6525,220.48075 -1904.6525,88.454235 C -1904.6525,-43.572302 -1745.2157,-150.68036 -1559.2523,-150.68038 z "
+ id="path5018"
+ sodipodi:nodetypes="cccc" />
+ </g>
+ <path
+ style="color:#000000;fill:#5b6b94;fill-opacity:1;fill-rule:nonzero;stroke:#364878;stroke-width:1.00000012;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 6.3643222,5.5185897 C 6.4551049,3.6036003 7.3719758,2.5542814 9.0788784,2.549044 L 38.405776,2.4590577 C 38.652361,2.4583011 38.974317,2.6592071 38.999012,2.9089888 L 42.257491,35.867228 L 40.942189,35.923862 L 41.571429,42.369516 C 41.632441,42.994499 41.390059,43.52882 40.5,43.533035 L 9.7893046,43.678474 C 7.25676,43.690468 4.6538454,41.59976 4.7759337,39.024403 L 6.3643222,5.5185897 z "
+ id="rect1408"
+ sodipodi:nodetypes="csssccsssss" />
+ <path
+ id="path2489"
+ d="M 40.125,34.875 L 10.9375,35 C 9.3809819,35.177868 8.125,36.39612 8.125,38 C 8.125,39.60388 9.3809819,40.822132 10.9375,41 L 40.125,41.125 L 40.125,41.0625 C 38.469378,40.984348 37.125,39.674851 37.125,38 C 37.125,36.325149 38.469378,35.015652 40.125,34.9375 L 40.125,34.875 z "
+ style="color:#000000;fill:url(#linearGradient2813);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ sodipodi:nodetypes="ccccccssc"
+ id="path2784"
+ d="M 9.6875,2.8125 C 7.9805897,2.8125 7.050103,3.8215062 6.96875,5.6738658 L 5.3125,37.825772 C 5.22054,40.904199 7.1393732,42.654485 9.125,43.15625 C 4.875,41.525579 5.4375,34.164455 10.75,34.195222 L 41.648286,34.195222 L 38.335786,3.2432432 C 38.310025,3.0025304 37.987878,2.8125 37.742036,2.8125 L 9.6875,2.8125 z "
+ style="color:#000000;fill:url(#linearGradient2100);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ y="3.968539"
+ x="9.7886267"
+ height="29.604792"
+ width="2"
+ id="rect2793"
+ style="opacity:0.48044691;color:#000000;fill:url(#linearGradient2801);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:0.60818715;visibility:visible;display:inline;overflow:visible"
+ transform="matrix(1.000000,0.000000,-3.582731e-2,0.999358,0.000000,0.000000)" />
+ <path
+ style="color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient2112);stroke-width:1.00000012;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:20;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 9.8751008,3.3336831 C 8.1912014,3.3336831 7.5384236,4.0658459 7.4581673,5.887831 L 6.1592633,35.777198 C 7.0925916,34.170451 8.5988591,33.594437 11.011665,33.594437 L 40.963081,33.594437 L 38.137179,3.7573631 C 38.114727,3.5203092 37.793961,3.3336831 37.551434,3.3336831 L 9.8751008,3.3336831 z "
+ id="path2104"
+ sodipodi:nodetypes="cccscssc" />
+ <path
+ style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:120.00000477%;writing-mode:lr-tb;text-anchor:start;fill:#ad7fa8;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ d="M 21.12553,18.381288 C 21.050283,19.50227 21.269376,20.384155 21.782812,21.026947 C 22.296751,21.661909 23.039741,21.979388 24.011788,21.979387 C 24.97597,21.979388 25.754005,21.65799 26.345892,21.01519 C 26.945589,20.372398 27.282799,19.49443 27.357529,18.381288 C 27.431173,17.283839 27.207372,16.413709 26.686123,15.770905 C 26.165371,15.120279 25.426826,14.794959 24.470482,14.79495 C 23.521952,14.794959 22.743917,15.11636 22.136378,15.759145 C 21.536656,16.401952 21.199707,17.275998 21.12553,18.381288 M 27.29793,21.897075 C 26.787062,22.500679 26.216183,22.947501 25.58529,23.237544 C 24.962734,23.519747 24.247754,23.66085 23.44035,23.660849 C 22.092032,23.66085 21.027197,23.174832 20.245835,22.202797 C 19.472826,21.222925 19.138938,19.949092 19.244172,18.381288 C 19.349395,16.813498 19.858197,15.539665 20.770584,14.559781 C 21.682954,13.579917 22.809375,13.089981 24.149854,13.089969 C 24.957257,13.089981 25.656689,13.238924 26.24815,13.536791 C 26.840107,13.826846 27.347352,14.269749 27.76988,14.865501 L 27.873267,13.325141 L 29.554732,13.325141 L 28.973868,21.979387 C 30.129917,21.806931 31.058551,21.285637 31.759769,20.415508 C 32.469312,19.537544 32.870659,18.404812 32.963808,17.017304 C 33.020082,16.178542 32.947536,15.390722 32.746168,14.653848 C 32.552597,13.916994 32.226018,13.235002 31.766435,12.607873 C 31.020085,11.580979 30.077151,10.79708 28.937625,10.256176 C 27.806428,9.707462 26.551007,9.433097 25.171361,9.433081 C 24.207151,9.433097 23.27347,9.56244 22.370314,9.821111 C 21.467662,10.071974 20.623234,10.448244 19.837027,10.949925 C 18.552629,11.749517 17.517932,12.79994 16.732929,14.101199 C 15.956279,15.394643 15.517185,16.797819 15.415642,18.310738 C 15.331983,19.557142 15.476998,20.725151 15.85069,21.814765 C 16.232213,22.904387 16.822316,23.864664 17.621,24.695594 C 18.389368,25.51085 19.300238,26.130129 20.353615,26.553435 C 21.406448,26.984578 22.54823,27.20015 23.778962,27.200153 C 24.790178,27.20015 25.793384,27.027692 26.788584,26.682781 C 27.791068,26.345701 28.72125,25.859684 29.579139,25.224728 L 30.549801,26.529919 C 29.518874,27.2903 28.409917,27.870384 27.222932,28.270174 C 26.043227,28.677799 24.857618,28.881612 23.666104,28.881616 C 22.215881,28.881612 20.865341,28.622926 19.614483,28.105557 C 18.36308,27.596019 17.268571,26.851316 16.330955,25.871444 C 15.393328,24.89157 14.705054,23.758838 14.266133,22.47324 C 13.827731,21.179813 13.658252,19.792311 13.757696,18.310738 C 13.853452,16.88405 14.211263,15.523986 14.831129,14.230542 C 15.450993,12.937121 16.287663,11.800469 17.34115,10.820582 C 18.419191,9.825045 19.638236,9.0646655 20.998287,8.5394366 C 22.358842,8.0064001 23.779908,7.7398759 25.261489,7.7398585 C 26.923341,7.7398759 28.440813,8.080872 29.813913,8.7628469 C 31.194815,9.444854 32.325282,10.41297 33.205316,11.667193 C 33.741656,12.435425 34.132443,13.270279 34.377679,14.171752 C 34.630708,15.073243 34.724877,16.006082 34.660187,16.970271 C 34.521787,19.031929 33.789414,20.658519 32.463064,21.850041 C 31.136671,23.04157 29.374449,23.66085 27.17639,23.707883 L 27.29793,21.897075"
+ id="text21625" />
+ <path
+ sodipodi:type="arc"
+ style="color:#000000;fill:url(#radialGradient278);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.25000024;stroke-linecap:butt;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:block"
+ id="path12511"
+ sodipodi:cx="55"
+ sodipodi:cy="125"
+ sodipodi:rx="14.375"
+ sodipodi:ry="14.375"
+ d="M 69.375 125 A 14.375 14.375 0 1 1 40.625,125 A 14.375 14.375 0 1 1 69.375 125 z"
+ transform="matrix(0.611127,0.000000,0.000000,0.611127,-24.94992,-67.63529)"
+ inkscape:export-filename="/home/jimmac/ximian_art/icons/nautilus/suse93/stock_new-16.png"
+ inkscape:export-xdpi="33.852203"
+ inkscape:export-ydpi="33.852203" />
+ </g>
+</svg>
diff --git a/tests/auto/qicon/icons/themeparent/scalable/actions/appointment-new.svg b/tests/auto/qicon/icons/themeparent/scalable/actions/appointment-new.svg
new file mode 100644
index 000000000..4cb14f82f
--- /dev/null
+++ b/tests/auto/qicon/icons/themeparent/scalable/actions/appointment-new.svg
@@ -0,0 +1,425 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ inkscape:export-ydpi="90.000000"
+ inkscape:export-xdpi="90.000000"
+ inkscape:export-filename="/home/jimmac/Desktop/wi-fi.png"
+ width="48px"
+ height="48px"
+ id="svg11300"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ sodipodi:docbase="/home/tigert/cvs/freedesktop.org/tango-icon-theme/scalable/actions"
+ sodipodi:docname="appointment-new.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs3">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 24 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="48 : 24 : 1"
+ inkscape:persp3d-origin="24 : 16 : 1"
+ id="perspective59" />
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient5204">
+ <stop
+ style="stop-color:#c4a000;stop-opacity:1;"
+ offset="0"
+ id="stop5206" />
+ <stop
+ style="stop-color:#c4a000;stop-opacity:0;"
+ offset="1"
+ id="stop5208" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient5196">
+ <stop
+ style="stop-color:#c4a000;stop-opacity:1;"
+ offset="0"
+ id="stop5198" />
+ <stop
+ style="stop-color:#c4a000;stop-opacity:0;"
+ offset="1"
+ id="stop5200" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient12512">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1.0000000;"
+ offset="0.0000000"
+ id="stop12513" />
+ <stop
+ style="stop-color:#fff520;stop-opacity:0.89108908;"
+ offset="0.50000000"
+ id="stop12517" />
+ <stop
+ style="stop-color:#fff300;stop-opacity:0.0000000;"
+ offset="1.0000000"
+ id="stop12514" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient12512"
+ id="radialGradient278"
+ gradientUnits="userSpaceOnUse"
+ cx="55.000000"
+ cy="125.00000"
+ fx="55.000000"
+ fy="125.00000"
+ r="14.375000" />
+ <linearGradient
+ id="linearGradient10653">
+ <stop
+ style="stop-color:#f3f4ff;stop-opacity:1.0000000;"
+ offset="0.0000000"
+ id="stop10655" />
+ <stop
+ style="stop-color:#9193af;stop-opacity:1.0000000;"
+ offset="1.0000000"
+ id="stop10657" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient42174">
+ <stop
+ style="stop-color:#a0a0a0;stop-opacity:1.0000000;"
+ offset="0.0000000"
+ id="stop42176" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1.0000000;"
+ offset="1.0000000"
+ id="stop42178" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2145">
+ <stop
+ style="stop-color:#fffffd;stop-opacity:1.0000000;"
+ offset="0.0000000"
+ id="stop2147" />
+ <stop
+ style="stop-color:#cbcbc9;stop-opacity:1.0000000;"
+ offset="1.0000000"
+ id="stop2149" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient37935">
+ <stop
+ id="stop37937"
+ offset="0.0000000"
+ style="stop-color:#9497b3;stop-opacity:1.0000000;" />
+ <stop
+ id="stop37939"
+ offset="1.0000000"
+ style="stop-color:#4c4059;stop-opacity:1.0000000;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2152">
+ <stop
+ id="stop2154"
+ offset="0.0000000"
+ style="stop-color:#9aa29a;stop-opacity:1.0000000;" />
+ <stop
+ id="stop2156"
+ offset="1.0000000"
+ style="stop-color:#b5beb5;stop-opacity:1.0000000;" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient3816">
+ <stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="0"
+ id="stop3818" />
+ <stop
+ style="stop-color:#000000;stop-opacity:0;"
+ offset="1"
+ id="stop3820" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3816"
+ id="radialGradient3822"
+ cx="31.112698"
+ cy="19.008621"
+ fx="31.112698"
+ fy="19.008621"
+ r="8.6620579"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2152"
+ id="linearGradient4307"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(3.123841,0.000000,0.000000,0.969691,-31.88758,-19.59492)"
+ x1="8.9156475"
+ y1="37.197018"
+ x2="9.8855033"
+ y2="52.090678" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient10653"
+ id="radialGradient4309"
+ gradientUnits="userSpaceOnUse"
+ cx="11.329200"
+ cy="10.583970"
+ fx="11.329200"
+ fy="10.583970"
+ r="15.532059" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2145"
+ id="radialGradient4311"
+ gradientUnits="userSpaceOnUse"
+ cx="11.901996"
+ cy="10.045444"
+ fx="11.901996"
+ fy="10.045444"
+ r="29.292715" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient42174"
+ id="linearGradient4313"
+ gradientUnits="userSpaceOnUse"
+ x1="6.3422160"
+ y1="7.7893324"
+ x2="22.218424"
+ y2="25.884274" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5196"
+ id="radialGradient5202"
+ cx="23.375"
+ cy="10.972863"
+ fx="23.375"
+ fy="10.972863"
+ r="3.3478092"
+ gradientTransform="matrix(3.630420,1.654030e-15,-1.608743e-15,3.742066,-61.48607,-29.18618)"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5204"
+ id="linearGradient5210"
+ x1="19.667364"
+ y1="4.2570662"
+ x2="20.329933"
+ y2="5.2845874"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient37935"
+ id="radialGradient5212"
+ gradientUnits="userSpaceOnUse"
+ cx="8.7468252"
+ cy="6.8283234"
+ fx="8.7468252"
+ fy="6.8283234"
+ r="29.889715" />
+ </defs>
+ <sodipodi:namedview
+ stroke="#c4a000"
+ fill="#babdb6"
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="0.25490196"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="11.313708"
+ inkscape:cx="13.2248"
+ inkscape:cy="25.106052"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:grid-bbox="true"
+ inkscape:document-units="px"
+ inkscape:showpageshadow="false"
+ inkscape:window-width="833"
+ inkscape:window-height="772"
+ inkscape:window-x="305"
+ inkscape:window-y="76" />
+ <metadata
+ id="metadata4">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Jakub Steiner</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <dc:source>http://jimmac.musichall.cz</dc:source>
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/publicdomain/" />
+ <dc:title>New Appointment</dc:title>
+ <dc:subject>
+ <rdf:Bag>
+ <rdf:li>appointment</rdf:li>
+ <rdf:li>new</rdf:li>
+ <rdf:li>meeting</rdf:li>
+ <rdf:li>rvsp</rdf:li>
+ </rdf:Bag>
+ </dc:subject>
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/publicdomain/">
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#Reproduction" />
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#Distribution" />
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <path
+ d="M 39.774755 19.008621 A 8.6620579 8.6620579 0 1 1 22.45064,19.008621 A 8.6620579 8.6620579 0 1 1 39.774755 19.008621 z"
+ sodipodi:ry="8.6620579"
+ sodipodi:rx="8.6620579"
+ sodipodi:cy="19.008621"
+ sodipodi:cx="31.112698"
+ id="path4318"
+ style="opacity:1;color:#000000;fill:url(#radialGradient3822);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ sodipodi:type="arc"
+ transform="matrix(2.563158,0.000000,0.000000,1.219602,-55.98414,14.04144)" />
+ <path
+ sodipodi:nodetypes="cccc"
+ id="path14341"
+ d="M 18.587591,1.403729 L 4.226755,18.096665 L 5.4854717,19.339844 L 18.587591,1.403729 z "
+ style="color:#000000;fill:url(#linearGradient4307);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ sodipodi:nodetypes="cccc"
+ id="path18921"
+ d="M 18.467176,1.3138035 L 5.6605716,19.072612 L 7.4900985,20.687913 L 18.467176,1.3138035 z "
+ style="fill:#fefefe;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1" />
+ <path
+ transform="matrix(1.431529,0.000000,0.000000,1.431529,0.569459,-1.654618)"
+ d="M 31.160714 16.910715 A 14.910714 14.910714 0 1 1 1.3392859,16.910715 A 14.910714 14.910714 0 1 1 31.160714 16.910715 z"
+ sodipodi:ry="14.910714"
+ sodipodi:rx="14.910714"
+ sodipodi:cy="16.910715"
+ sodipodi:cx="16.25"
+ id="path27786"
+ style="fill:url(#radialGradient5212);fill-opacity:1;fill-rule:evenodd;stroke:#605773;stroke-width:0.69855404;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1"
+ sodipodi:type="arc" />
+ <path
+ transform="matrix(1.163838,0.000000,0.000000,1.163838,4.824801,2.777556)"
+ d="M 31.160714 16.910715 A 14.910714 14.910714 0 1 1 1.3392859,16.910715 A 14.910714 14.910714 0 1 1 31.160714 16.910715 z"
+ sodipodi:ry="14.910714"
+ sodipodi:rx="14.910714"
+ sodipodi:cy="16.910715"
+ sodipodi:cx="16.25"
+ id="path35549"
+ style="fill:url(#radialGradient4311);fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient4313);stroke-width:0.71139598;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1"
+ sodipodi:type="arc" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;color:#000000;fill:url(#radialGradient5202);fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient5210);stroke-width:0.56498736;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="path4120"
+ sodipodi:cx="23.375"
+ sodipodi:cy="11.875"
+ sodipodi:rx="8.5"
+ sodipodi:ry="8.5"
+ d="M 16.679382,6.6387137 A 8.5,8.5 0 0 1 23.332691,3.3751053 L 23.375,11.875 z"
+ transform="matrix(1.769951,0.000000,0.000000,1.769951,-17.02424,1.610741)"
+ sodipodi:start="3.8052902"
+ sodipodi:end="4.7074114" />
+ <path
+ transform="matrix(2.073295,0.000000,0.000000,2.073295,-7.310224,-13.13682)"
+ d="M 16.40625 17.28125 A 1.21875 1.21875 0 1 1 13.96875,17.28125 A 1.21875 1.21875 0 1 1 16.40625 17.28125 z"
+ sodipodi:ry="1.21875"
+ sodipodi:rx="1.21875"
+ sodipodi:cy="17.28125"
+ sodipodi:cx="15.1875"
+ id="path34778"
+ style="fill:#f3f3f3;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.48232403;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;stroke-dasharray:none"
+ sodipodi:type="arc" />
+ <path
+ id="path35559"
+ d="M 22.176614,20.718014 L 13.155702,13.140282"
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ id="path35561"
+ d="M 19.408614,29.776506 L 22.368655,25.283228"
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ sodipodi:nodetypes="cc" />
+ <path
+ transform="matrix(2.749493,0.000000,0.000000,2.749493,-22.30073,-12.40939)"
+ d="M 17.324117 7.6932044 A 0.61871845 0.61871845 0 1 1 16.08668,7.6932044 A 0.61871845 0.61871845 0 1 1 17.324117 7.6932044 z"
+ sodipodi:ry="0.61871845"
+ sodipodi:rx="0.61871845"
+ sodipodi:cy="7.6932044"
+ sodipodi:cx="16.705399"
+ id="path35563"
+ style="fill:#b6b9b1;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.36871839;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;opacity:1"
+ sodipodi:type="arc" />
+ <path
+ transform="matrix(2.749493,0.000000,0.000000,2.749493,-22.30073,14.80922)"
+ d="M 17.324117 7.6932044 A 0.61871845 0.61871845 0 1 1 16.08668,7.6932044 A 0.61871845 0.61871845 0 1 1 17.324117 7.6932044 z"
+ sodipodi:ry="0.61871845"
+ sodipodi:rx="0.61871845"
+ sodipodi:cy="7.6932044"
+ sodipodi:cx="16.705399"
+ id="path35565"
+ style="fill:#b6b9b1;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.36871839;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;opacity:1"
+ sodipodi:type="arc" />
+ <path
+ transform="matrix(2.749493,0.000000,0.000000,2.749493,-35.91004,1.199890)"
+ d="M 17.324117 7.6932044 A 0.61871845 0.61871845 0 1 1 16.08668,7.6932044 A 0.61871845 0.61871845 0 1 1 17.324117 7.6932044 z"
+ sodipodi:ry="0.61871845"
+ sodipodi:rx="0.61871845"
+ sodipodi:cy="7.6932044"
+ sodipodi:cx="16.705399"
+ id="path35567"
+ style="fill:#b6b9b1;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.36871839;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;opacity:1"
+ sodipodi:type="arc" />
+ <path
+ transform="matrix(2.749493,0.000000,0.000000,2.749493,-8.691448,1.199890)"
+ d="M 17.324117 7.6932044 A 0.61871845 0.61871845 0 1 1 16.08668,7.6932044 A 0.61871845 0.61871845 0 1 1 17.324117 7.6932044 z"
+ sodipodi:ry="0.61871845"
+ sodipodi:rx="0.61871845"
+ sodipodi:cy="7.6932044"
+ sodipodi:cx="16.705399"
+ id="path35569"
+ style="fill:#b6b9b1;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.36871839;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;opacity:1"
+ sodipodi:type="arc" />
+ <path
+ sodipodi:type="arc"
+ style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#radialGradient4309);stroke-width:0.73656511;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1"
+ id="path10651"
+ sodipodi:cx="16.25"
+ sodipodi:cy="16.910715"
+ sodipodi:rx="14.910714"
+ sodipodi:ry="14.910714"
+ d="M 31.160714 16.910715 A 14.910714 14.910714 0 1 1 1.3392859,16.910715 A 14.910714 14.910714 0 1 1 31.160714 16.910715 z"
+ transform="matrix(1.357654,0.000000,0.000000,1.357654,1.769896,-0.493735)" />
+ <path
+ sodipodi:type="arc"
+ style="color:#000000;fill:url(#radialGradient278);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.25000024;stroke-linecap:butt;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:block"
+ id="path12511"
+ sodipodi:cx="55"
+ sodipodi:cy="125"
+ sodipodi:rx="14.375"
+ sodipodi:ry="14.375"
+ d="M 69.375 125 A 14.375 14.375 0 1 1 40.625,125 A 14.375 14.375 0 1 1 69.375 125 z"
+ transform="matrix(0.611127,0.000000,0.000000,0.611127,5.544052,-66.92818)"
+ inkscape:export-filename="/home/jimmac/ximian_art/icons/nautilus/suse93/stock_new-16.png"
+ inkscape:export-xdpi="33.852203"
+ inkscape:export-ydpi="33.852203" />
+ </g>
+</svg>
diff --git a/tests/auto/qicon/tst_qicon.cpp b/tests/auto/qicon/tst_qicon.cpp
index a266c1646..545ca0986 100644
--- a/tests/auto/qicon/tst_qicon.cpp
+++ b/tests/auto/qicon/tst_qicon.cpp
@@ -74,6 +74,7 @@ private slots:
void availableSizes();
void streamAvailableSizes_data();
void streamAvailableSizes();
+ void fromTheme();
void task184901_badCache();
void task223279_inconsistentAddFile();
@@ -605,6 +606,72 @@ void tst_QIcon::task184901_badCache()
QVERIFY( icon.pixmap(32, QIcon::Normal).toImage() == icon.pixmap(32, QIcon::Disabled).toImage() );
}
+void tst_QIcon::fromTheme()
+{
+ const QString prefix = QLatin1String(SRCDIR) + QLatin1String("/");
+ QString searchPath = prefix + QLatin1String("/icons");
+ QIcon::setThemeSearchPaths(QStringList() << searchPath);
+ QVERIFY(QIcon::themeSearchPaths().size() == 1);
+ QCOMPARE(searchPath, QIcon::themeSearchPaths()[0]);
+
+ QString themeName("testtheme");
+ QIcon::setThemeName(themeName);
+ QCOMPARE(QIcon::themeName(), themeName);
+
+ // Test normal icon
+ QIcon appointmentIcon = QIcon::fromTheme("appointment-new");
+ QVERIFY(!appointmentIcon.isNull());
+ QVERIFY(!appointmentIcon.availableSizes(QIcon::Normal, QIcon::Off).isEmpty());
+ QVERIFY(appointmentIcon.availableSizes().contains(QSize(16, 16)));
+ QVERIFY(appointmentIcon.availableSizes().contains(QSize(32, 32)));
+ QVERIFY(appointmentIcon.availableSizes().contains(QSize(22, 22)));
+
+ // Test icon from parent theme
+ QIcon abIcon = QIcon::fromTheme("address-book-new");
+ QVERIFY(!abIcon.isNull());
+ QVERIFY(QIcon::hasThemeIcon("address-book-new"));
+ QVERIFY(!abIcon.availableSizes().isEmpty());
+
+ // Test non existing icon
+ QIcon noIcon = QIcon::fromTheme("broken-icon");
+ QVERIFY(noIcon.isNull());
+ QVERIFY(!QIcon::hasThemeIcon("broken-icon"));
+
+ // Test non existing icon with fallback
+ noIcon = QIcon::fromTheme("broken-icon", abIcon);
+ QVERIFY(noIcon.cacheKey() == abIcon.cacheKey());
+
+ // Test svg-only icon
+ noIcon = QIcon::fromTheme("svg-icon", abIcon);
+ QVERIFY(!noIcon.availableSizes().isEmpty());
+
+ QByteArray ba;
+ // write to QByteArray
+ {
+ QBuffer buffer(&ba);
+ buffer.open(QIODevice::WriteOnly);
+ QDataStream stream(&buffer);
+ stream << abIcon;
+ }
+
+ // read from QByteArray
+ {
+ QBuffer buffer(&ba);
+ buffer.open(QIODevice::ReadOnly);
+ QDataStream stream(&buffer);
+ QIcon i;
+ stream >> i;
+ QCOMPARE(i.isNull(), abIcon.isNull());
+ QCOMPARE(i.availableSizes(), abIcon.availableSizes());
+ }
+
+ // Make sure setting the theme name clears the state
+ QIcon::setThemeName("");
+ abIcon = QIcon::fromTheme("address-book-new");
+ QVERIFY(abIcon.isNull());
+}
+
+
void tst_QIcon::task223279_inconsistentAddFile()
{
QIcon icon1;
diff --git a/tests/auto/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/qitemdelegate/tst_qitemdelegate.cpp
index 6714de3ac..06018b980 100644
--- a/tests/auto/qitemdelegate/tst_qitemdelegate.cpp
+++ b/tests/auto/qitemdelegate/tst_qitemdelegate.cpp
@@ -1153,7 +1153,7 @@ void tst_QItemDelegate::task257859_finalizeEdit()
QTimer::singleShot(100, &dialog, SLOT(close()));
dialog.exec();
- QTest::qWait(10);
+ QTest::qWait(100);
QVERIFY(!editor);
}
diff --git a/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp b/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp
index 0541b461f..ec21f79eb 100644
--- a/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp
+++ b/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp
@@ -90,6 +90,7 @@ private slots:
void merge();
void task119433_isRowSelected();
void task252069_rowIntersectsSelection();
+ void task232634_childrenDeselectionSignal();
private:
QAbstractItemModel *model;
@@ -2187,5 +2188,58 @@ void tst_QItemSelectionModel::task252069_rowIntersectsSelection()
QVERIFY(!selected.columnIntersectsSelection(5, QModelIndex()));
}
+void tst_QItemSelectionModel::task232634_childrenDeselectionSignal()
+{
+ QStandardItemModel model;
+
+ QStandardItem *parentItem = model.invisibleRootItem();
+ for (int i = 0; i < 4; ++i) {
+ QStandardItem *item = new QStandardItem(QString("item %0").arg(i));
+ parentItem->appendRow(item);
+ parentItem = item;
+ }
+
+ QModelIndex root = model.index(0,0);
+ QModelIndex par = root.child(0,0);
+ QModelIndex sel = par.child(0,0);
+
+ QItemSelectionModel selectionModel(&model);
+ selectionModel.select(sel, QItemSelectionModel::SelectCurrent);
+
+ QSignalSpy deselectSpy(&selectionModel, SIGNAL(selectionChanged(const QItemSelection& , const QItemSelection&)));
+ model.removeRows(0, 1, root);
+ QVERIFY(deselectSpy.count() == 1);
+
+ // More testing stress for the patch.
+ model.clear();
+ selectionModel.clear();
+
+ parentItem = model.invisibleRootItem();
+ for (int i = 0; i < 2; ++i) {
+ QStandardItem *item = new QStandardItem(QString("item %0").arg(i));
+ parentItem->appendRow(item);
+ }
+ for (int i = 0; i < 2; ++i) {
+ parentItem = model.invisibleRootItem()->child(i, 0);
+ for (int j = 0; j < 2; ++j) {
+ QStandardItem *item = new QStandardItem(QString("item %0.%1").arg(i).arg(j));
+ parentItem->appendRow(item);
+ }
+ }
+
+ sel = model.index(0, 0).child(0, 0);
+ selectionModel.select(sel, QItemSelectionModel::Select);
+ QModelIndex sel2 = model.index(1, 0).child(0, 0);
+ selectionModel.select(sel2, QItemSelectionModel::Select);
+
+ QVERIFY(selectionModel.selection().contains(sel));
+ QVERIFY(selectionModel.selection().contains(sel2));
+ deselectSpy.clear();
+ model.removeRow(0, model.index(0, 0));
+ QVERIFY(deselectSpy.count() == 1);
+ QVERIFY(!selectionModel.selection().contains(sel));
+ QVERIFY(selectionModel.selection().contains(sel2));
+}
+
QTEST_MAIN(tst_QItemSelectionModel)
#include "tst_qitemselectionmodel.moc"
diff --git a/tests/auto/qitemview/tst_qitemview.cpp b/tests/auto/qitemview/tst_qitemview.cpp
index 73c08d1b6..2f9ac9646 100644
--- a/tests/auto/qitemview/tst_qitemview.cpp
+++ b/tests/auto/qitemview/tst_qitemview.cpp
@@ -173,8 +173,6 @@ public:
}
QModelIndex index( int row, int column, const QModelIndex & parent = QModelIndex() ) const {
- Q_ASSERT(row >= 0 && row <= rowCount(parent));
- Q_ASSERT(column >= 0 && column <= columnCount(parent));
return QStandardItemModel::index(row, column, parent);
};
diff --git a/tests/auto/qlistwidget/tst_qlistwidget.cpp b/tests/auto/qlistwidget/tst_qlistwidget.cpp
index e581bd3ac..422c7d5e9 100644
--- a/tests/auto/qlistwidget/tst_qlistwidget.cpp
+++ b/tests/auto/qlistwidget/tst_qlistwidget.cpp
@@ -128,6 +128,8 @@ private slots:
void setSortingEnabled();
void task199503_crashWhenCleared();
void task217070_scrollbarsAdjusted();
+ void task258949_keypressHangup();
+
protected slots:
void rowsAboutToBeInserted(const QModelIndex &parent, int first, int last)
@@ -1009,7 +1011,7 @@ void tst_QListWidget::sortHiddenItems()
for (int k = 0; k < tw->count(); ++k)
QCOMPARE(persistent.at(k).row(), expectedRows.at(k));
-
+
delete tw;
}
@@ -1513,5 +1515,24 @@ void tst_QListWidget::task217070_scrollbarsAdjusted()
}
}
+void tst_QListWidget::task258949_keypressHangup()
+{
+ QListWidget lw;
+ for (int y = 0; y < 5; y++) {
+ QListWidgetItem *lwi = new QListWidgetItem(&lw);
+ lwi->setText(y ? "1" : "0");
+ if (y)
+ lwi->setFlags(Qt::ItemIsSelectable);
+ }
+
+ lw.show();
+ lw.setCurrentIndex(lw.model()->index(0,0));
+ QCOMPARE(lw.currentIndex(), lw.model()->index(0,0));
+ QTest::qWait(30);
+ QTest::keyPress(&lw, '1'); //this used to freeze
+ QTest::qWait(30);
+ QCOMPARE(lw.currentIndex(), lw.model()->index(0,0));
+}
+
QTEST_MAIN(tst_QListWidget)
#include "tst_qlistwidget.moc"
diff --git a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
index a41eecdd7..177648d97 100644
--- a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
+++ b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
@@ -555,14 +555,17 @@ void tst_QLocalSocket::readBufferOverflow()
QVERIFY(server.hasPendingConnections());
QLocalSocket* serverSocket = server.nextPendingConnection();
- char* buffer = (char*)qMalloc(dataBufferSize);
+ char buffer[dataBufferSize];
memset(buffer, 0, dataBufferSize);
serverSocket->write(buffer, dataBufferSize);
serverSocket->flush();
- qFree(buffer);
QVERIFY(client.waitForReadyRead());
- QCOMPARE(client.readAll().size(), dataBufferSize);
+ QCOMPARE(client.read(buffer, readBufferSize), qint64(readBufferSize));
+#ifdef QT_LOCALSOCKET_TCP
+ QTest::qWait(250);
+#endif
+ QCOMPARE(client.read(buffer, readBufferSize), qint64(readBufferSize));
}
// QLocalSocket/Server can take a name or path, check that it works as expected
@@ -918,6 +921,7 @@ void tst_QLocalSocket::writeOnlySocket()
QVERIFY(server.waitForNewConnection());
QLocalSocket* serverSocket = server.nextPendingConnection();
+ QVERIFY(serverSocket);
QCOMPARE(client.bytesAvailable(), qint64(0));
QCOMPARE(client.state(), QLocalSocket::ConnectedState);
diff --git a/tests/auto/qmainwindow/tst_qmainwindow.cpp b/tests/auto/qmainwindow/tst_qmainwindow.cpp
index 6ae7a3e99..f81dd82c8 100644
--- a/tests/auto/qmainwindow/tst_qmainwindow.cpp
+++ b/tests/auto/qmainwindow/tst_qmainwindow.cpp
@@ -550,6 +550,9 @@ void tst_QMainWindow::menuBar()
mw.setMenuBar(mb1);
QVERIFY(mw.menuBar() != 0);
QCOMPARE(mw.menuBar(), (QMenuBar *)mb1);
+#ifdef Q_WS_WINCE_WM
+ QSKIP("With native menubar integration the menubar is not a child", SkipSingle);
+#endif
QCOMPARE(mb1->parentWidget(), (QWidget *)&mw);
mw.setMenuBar(0);
diff --git a/tests/auto/qmake/testdata/functions/functions.pro b/tests/auto/qmake/testdata/functions/functions.pro
index 9ed92f960..5e089e403 100644
--- a/tests/auto/qmake/testdata/functions/functions.pro
+++ b/tests/auto/qmake/testdata/functions/functions.pro
@@ -46,7 +46,7 @@ isEmpty( CONFIG ) {
}
#include
-include( infiletest.pro )
+include( infiletest.pro, "", true )
!contains( DEFINES, QT_DLL ) {
message( "FAILED: include function: $$DEFINES" )
}
diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp
index 6ba646666..23bb0c2bc 100644
--- a/tests/auto/qmenu/tst_qmenu.cpp
+++ b/tests/auto/qmenu/tst_qmenu.cpp
@@ -50,6 +50,7 @@
#include <QStatusBar>
#include <QListWidget>
#include <QWidgetAction>
+#include <QDesktopWidget>
#include <qmenu.h>
#include <qstyle.h>
@@ -692,6 +693,12 @@ void tst_QMenu::task250673_activeMultiColumnSubMenuPosition()
};
QMenu sub;
+
+ if (sub.style()->styleHint(QStyle::SH_Menu_Scrollable, 0, &sub)) {
+ //the style prevents the menus from getting columns
+ QSKIP("the style doesn't support multiple columns, it makes the menu scrollable", SkipSingle);
+ }
+
sub.addAction("Sub-Item1");
QAction *subAction = sub.addAction("Sub-Item2");
@@ -703,6 +710,7 @@ void tst_QMenu::task250673_activeMultiColumnSubMenuPosition()
uint i = 2;
while (main.columnCount() < 2) {
main.addAction(QString("Item %1").arg(i));
+ qDebug() << "adding action" << i;
++i;
Q_ASSERT(i<1000);
}
@@ -784,7 +792,7 @@ void tst_QMenu::task258920_mouseBorder()
Menu258920 menu;
QAction *action = menu.addAction("test");
- menu.popup(QPoint());
+ menu.popup(QApplication::desktop()->availableGeometry().center());
QTest::qWait(100);
QRect actionRect = menu.actionGeometry(action);
QTest::mouseMove(&menu, actionRect.center());
diff --git a/tests/auto/qmenubar/tst_qmenubar.cpp b/tests/auto/qmenubar/tst_qmenubar.cpp
index 1245de194..3ccd0c8ab 100644
--- a/tests/auto/qmenubar/tst_qmenubar.cpp
+++ b/tests/auto/qmenubar/tst_qmenubar.cpp
@@ -59,6 +59,8 @@
#include <qobject.h>
+#include "../../shared/util.h"
+
QT_FORWARD_DECLARE_CLASS(QMainWindow)
#include <qmenubar.h>
@@ -1527,6 +1529,7 @@ void tst_QMenuBar::task223138_triggered()
void tst_QMenuBar::task256322_highlight()
{
QMainWindow win;
+ win.menuBar()->setNativeMenuBar(false); //we can't check the geometry of native menubars
QMenu menu;
QAction *file = win.menuBar()->addMenu(&menu);
file->setText("file");
@@ -1536,27 +1539,24 @@ void tst_QMenuBar::task256322_highlight()
QAction *nothing = win.menuBar()->addAction("nothing");
win.show();
+ QTest::qWait(200);
+ QTest::mouseMove(win.menuBar(), win.menuBar()->actionGeometry(file).center());
QTest::mouseClick(win.menuBar(), Qt::LeftButton, 0, win.menuBar()->actionGeometry(file).center());
- QVERIFY(menu.isVisible());
+ QTRY_VERIFY(menu.isVisible());
QVERIFY(!menu2.isVisible());
QCOMPARE(win.menuBar()->activeAction(), file);
QTest::mouseMove(win.menuBar(), win.menuBar()->actionGeometry(file2).center());
- QVERIFY(!menu.isVisible());
+ QTRY_VERIFY(!menu.isVisible());
QVERIFY(menu2.isVisible());
QCOMPARE(win.menuBar()->activeAction(), file2);
- QTest::mouseMove(win.menuBar(), win.menuBar()->actionGeometry(nothing).center());
+ QPoint nothingCenter = win.menuBar()->actionGeometry(nothing).center();
+ QTest::mouseMove(win.menuBar(), nothingCenter);
+ QTRY_VERIFY(!menu2.isVisible());
QVERIFY(!menu.isVisible());
- QVERIFY(!menu2.isVisible());
QCOMPARE(win.menuBar()->activeAction(), nothing);
-
- QTest::mouseMove(&win, win.menuBar()->geometry().bottomLeft() + QPoint(1,1));
-
- QVERIFY(!menu.isVisible());
- QVERIFY(!menu2.isVisible());
- QVERIFY(!win.menuBar()->activeAction());
}
void tst_QMenuBar::menubarSizeHint()
@@ -1583,6 +1583,8 @@ void tst_QMenuBar::menubarSizeHint()
} style;
QMenuBar mb;
+ mb.setNativeMenuBar(false); //we can't check the geometry of native menubars
+
mb.setStyle(&style);
//this is a list of arbitrary strings so that we check the geometry
QStringList list = QStringList() << "trer" << "ezrfgtgvqd" << "sdgzgzerzerzer" << "eerzertz" << "er";
diff --git a/tests/auto/qmultiscreen/qmultiscreen.pro b/tests/auto/qmultiscreen/qmultiscreen.pro
index 810c05f7f..30666d72d 100644
--- a/tests/auto/qmultiscreen/qmultiscreen.pro
+++ b/tests/auto/qmultiscreen/qmultiscreen.pro
@@ -1,5 +1,5 @@
load(qttest_p4)
SOURCES += tst_qmultiscreen.cpp
-
+requires(embedded)
diff --git a/tests/auto/qplaintextedit/tst_qplaintextedit.cpp b/tests/auto/qplaintextedit/tst_qplaintextedit.cpp
index 40ad539ee..e8350e39b 100644
--- a/tests/auto/qplaintextedit/tst_qplaintextedit.cpp
+++ b/tests/auto/qplaintextedit/tst_qplaintextedit.cpp
@@ -856,7 +856,12 @@ void tst_QPlainTextEdit::lineWrapModes()
ed->setLineWrapMode(QPlainTextEdit::NoWrap);
QCOMPARE(lineCount(), 1);
ed->setLineWrapMode(QPlainTextEdit::WidgetWidth);
- ed->resize(1, 1000);
+
+ // QPlainTextEdit does lazy line layout on resize, only for the visible blocks.
+ // We thus need to make it wide enough to show something visible.
+ int minimumWidth = 2 * ed->document()->documentMargin();
+ minimumWidth += ed->fontMetrics().width(QLatin1Char('a'));
+ ed->resize(minimumWidth, 1000);
QCOMPARE(lineCount(), 26);
ed->setParent(0);
delete window;
diff --git a/tests/auto/qpluginloader/tst/tst.pro b/tests/auto/qpluginloader/tst/tst.pro
index 5331f09d0..28f74d4d4 100644
--- a/tests/auto/qpluginloader/tst/tst.pro
+++ b/tests/auto/qpluginloader/tst/tst.pro
@@ -13,7 +13,7 @@ win32 {
wince*: {
- addFiles.sources = ../bin/*.dll
+ addFiles.sources = $$OUT_PWD/../bin/*.dll
addFiles.path = bin
DEPLOYMENT += addFiles
}
diff --git a/tests/auto/qpluginloader/tst_qpluginloader.cpp b/tests/auto/qpluginloader/tst_qpluginloader.cpp
index 822132588..0b8ae4591 100644
--- a/tests/auto/qpluginloader/tst_qpluginloader.cpp
+++ b/tests/auto/qpluginloader/tst_qpluginloader.cpp
@@ -264,6 +264,7 @@ void tst_QPluginLoader::deleteinstanceOnUnload()
if (pass == 0)
loader1.load(); // not recommended, instance() should do the job.
PluginInterface *instance1 = qobject_cast<PluginInterface*>(loader1.instance());
+ QVERIFY(instance1);
QCOMPARE(instance1->pluginName(), QLatin1String("Plugin ok"));
QPluginLoader loader2;
diff --git a/tests/auto/qpointarray/.gitignore b/tests/auto/qpolygon/.gitignore
index 7c9d48c84..7c9d48c84 100644
--- a/tests/auto/qpointarray/.gitignore
+++ b/tests/auto/qpolygon/.gitignore
diff --git a/tests/auto/qpointarray/qpointarray.pro b/tests/auto/qpolygon/qpolygon.pro
index d86433754..311958de6 100644
--- a/tests/auto/qpointarray/qpointarray.pro
+++ b/tests/auto/qpolygon/qpolygon.pro
@@ -1,5 +1,5 @@
load(qttest_p4)
-SOURCES += tst_qpointarray.cpp
+SOURCES += tst_qpolygon.cpp
unix:!mac:LIBS+=-lm
diff --git a/tests/auto/qpointarray/tst_qpointarray.cpp b/tests/auto/qpolygon/tst_qpolygon.cpp
index f46c96d44..6b20dae65 100644
--- a/tests/auto/qpointarray/tst_qpointarray.cpp
+++ b/tests/auto/qpolygon/tst_qpolygon.cpp
@@ -92,4 +92,4 @@ void tst_QPolygon::makeEllipse()
}
QTEST_APPLESS_MAIN(tst_QPolygon)
-#include "tst_qpointarray.moc"
+#include "tst_qpolygon.moc"
diff --git a/tests/auto/qprocess/tst_qprocess.cpp b/tests/auto/qprocess/tst_qprocess.cpp
index d235dff95..1ffa36063 100644
--- a/tests/auto/qprocess/tst_qprocess.cpp
+++ b/tests/auto/qprocess/tst_qprocess.cpp
@@ -1224,7 +1224,7 @@ private:
//-----------------------------------------------------------------------------
void tst_QProcess::processInAThread()
{
- for (int i = 0; i < 3; ++i) {
+ for (int i = 0; i < 10; ++i) {
TestThread thread;
thread.start();
QVERIFY(thread.wait(10000));
diff --git a/tests/auto/qpushbutton/tst_qpushbutton.cpp b/tests/auto/qpushbutton/tst_qpushbutton.cpp
index 7a81dbf14..528f3bb4a 100644
--- a/tests/auto/qpushbutton/tst_qpushbutton.cpp
+++ b/tests/auto/qpushbutton/tst_qpushbutton.cpp
@@ -661,6 +661,7 @@ void tst_QPushButton::sizeHint()
tabWidget->setCurrentWidget(tab2);
tabWidget->setCurrentWidget(tab1);
QTest::qWait(100);
+ QApplication::processEvents();
QCOMPARE(button1_2->size(), button2_2->size());
}
diff --git a/tests/auto/qresourceengine/qresourceengine.pro b/tests/auto/qresourceengine/qresourceengine.pro
index 8f3ca5ce3..1d53e194d 100644
--- a/tests/auto/qresourceengine/qresourceengine.pro
+++ b/tests/auto/qresourceengine/qresourceengine.pro
@@ -6,7 +6,7 @@ load(qttest_p4)
load(resources)
# Input
-SOURCES += tst_resourceengine.cpp
+SOURCES += tst_qresourceengine.cpp
RESOURCES += testqrc/test.qrc
runtime_resource.target = runtime_resource.rcc
diff --git a/tests/auto/qresourceengine/tst_resourceengine.cpp b/tests/auto/qresourceengine/tst_qresourceengine.cpp
index e133a72e6..8857dd833 100644
--- a/tests/auto/qresourceengine/tst_resourceengine.cpp
+++ b/tests/auto/qresourceengine/tst_qresourceengine.cpp
@@ -43,7 +43,7 @@
#include <QtTest/QtTest>
#include <QtCore>
-class tst_ResourceEngine: public QObject
+class tst_QResourceEngine: public QObject
{
Q_OBJECT
@@ -66,7 +66,7 @@ private:
Q_DECLARE_METATYPE(QLocale)
Q_DECLARE_METATYPE(qlonglong)
-void tst_ResourceEngine::initTestCase()
+void tst_QResourceEngine::initTestCase()
{
QVERIFY(QResource::registerResource("runtime_resource.rcc"));
QVERIFY(QResource::registerResource("runtime_resource.rcc", "/secondary_root/"));
@@ -79,7 +79,7 @@ void tst_ResourceEngine::initTestCase()
}
}
-void tst_ResourceEngine::cleanupTestCase()
+void tst_QResourceEngine::cleanupTestCase()
{
if (!builddir.isEmpty()) {
QDir::setCurrent(builddir);
@@ -90,7 +90,7 @@ void tst_ResourceEngine::cleanupTestCase()
QVERIFY(QResource::unregisterResource("runtime_resource.rcc", "/secondary_root/"));
}
-void tst_ResourceEngine::checkStructure_data()
+void tst_QResourceEngine::checkStructure_data()
{
QTest::addColumn<QString>("pathName");
QTest::addColumn<QString>("contents");
@@ -306,7 +306,7 @@ void tst_ResourceEngine::checkStructure_data()
}
}
-void tst_ResourceEngine::checkStructure()
+void tst_QResourceEngine::checkStructure()
{
QFETCH(QString, pathName);
QFETCH(QString, contents);
@@ -376,7 +376,7 @@ void tst_ResourceEngine::checkStructure()
QLocale::setDefault(QLocale::system());
}
-void tst_ResourceEngine::searchPath_data()
+void tst_QResourceEngine::searchPath_data()
{
QTest::addColumn<QString>("searchPath");
QTest::addColumn<QString>("file");
@@ -396,7 +396,7 @@ void tst_ResourceEngine::searchPath_data()
<< QByteArray("path2\n");
}
-void tst_ResourceEngine::searchPath()
+void tst_QResourceEngine::searchPath()
{
QFETCH(QString, searchPath);
QFETCH(QString, file);
@@ -414,7 +414,7 @@ void tst_ResourceEngine::searchPath()
qf.close();
}
-void tst_ResourceEngine::checkUnregisterResource_data()
+void tst_QResourceEngine::checkUnregisterResource_data()
{
QTest::addColumn<QString>("rcc_file");
QTest::addColumn<QString>("root");
@@ -426,7 +426,7 @@ void tst_ResourceEngine::checkUnregisterResource_data()
<< (int)QFileInfo("testqrc/currentdir.txt").size();
}
-void tst_ResourceEngine::checkUnregisterResource()
+void tst_QResourceEngine::checkUnregisterResource()
{
QFETCH(QString, rcc_file);
QFETCH(QString, root);
@@ -450,12 +450,13 @@ void tst_ResourceEngine::checkUnregisterResource()
QCOMPARE((int)fileInfo.size(), size);
}
-void tst_ResourceEngine::doubleSlashInRoot()
+void tst_QResourceEngine::doubleSlashInRoot()
{
QVERIFY(QFile::exists(":/secondary_root/runtime_resource/search_file.txt"));
QVERIFY(QFile::exists("://secondary_root/runtime_resource/search_file.txt"));
}
-QTEST_MAIN(tst_ResourceEngine)
+QTEST_MAIN(tst_QResourceEngine)
+
+#include "tst_qresourceengine.moc"
-#include "tst_resourceengine.moc"
diff --git a/tests/auto/qscriptqobject/.gitignore b/tests/auto/qscriptextqobject/.gitignore
index bff799fd3..bff799fd3 100644
--- a/tests/auto/qscriptqobject/.gitignore
+++ b/tests/auto/qscriptextqobject/.gitignore
diff --git a/tests/auto/qscriptqobject/qscriptqobject.pro b/tests/auto/qscriptextqobject/qscriptextqobject.pro
index be3a98042..87ab1b74b 100644
--- a/tests/auto/qscriptqobject/qscriptqobject.pro
+++ b/tests/auto/qscriptextqobject/qscriptextqobject.pro
@@ -1,5 +1,5 @@
load(qttest_p4)
QT = core gui script
-SOURCES += tst_qscriptqobject.cpp
+SOURCES += tst_qscriptextqobject.cpp
diff --git a/tests/auto/qscriptqobject/tst_qscriptqobject.cpp b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp
index ee914abdc..85693dc86 100644
--- a/tests/auto/qscriptqobject/tst_qscriptqobject.cpp
+++ b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp
@@ -2880,4 +2880,4 @@ void tst_QScriptExtQObject::connectToDestroyedSignal()
}
QTEST_MAIN(tst_QScriptExtQObject)
-#include "tst_qscriptqobject.moc"
+#include "tst_qscriptextqobject.moc"
diff --git a/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp b/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp
index 019473067..92068dc55 100644
--- a/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp
+++ b/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp
@@ -785,6 +785,8 @@ tst_Suite::tst_Suite()
addFileExclusion("regress-322135-04.js", "takes forever");
addFileExclusion("ecma_3/RegExp/regress-375715-04.js", "bug");
+ static const char klass[] = "tst_QScriptJsTestSuite";
+
QVector<uint> *data = qt_meta_data_tst_Suite();
// content:
*data << 1 // revision
@@ -796,7 +798,7 @@ tst_Suite::tst_Suite()
;
QVector<char> *stringdata = qt_meta_stringdata_tst_Suite();
- appendCString(stringdata, "tst_Suite");
+ appendCString(stringdata, klass);
appendCString(stringdata, "");
// don't execute any tests on slow machines
@@ -814,11 +816,12 @@ tst_Suite::tst_Suite()
// slot: signature, parameters, type, tag, flags
QString data_slot = QString::fromLatin1("%0/%1_data()")
.arg(testSuiteDir.dirName()).arg(ssdi.fileName());
- *data << stringdata->size() << 10 << 10 << 10 << 0x08;
+ static const int nullbyte = sizeof(klass);
+ *data << stringdata->size() << nullbyte << nullbyte << nullbyte << 0x08;
appendCString(stringdata, data_slot.toLatin1());
QString slot = QString::fromLatin1("%0/%1()")
.arg(testSuiteDir.dirName()).arg(ssdi.fileName());
- *data << stringdata->size() << 10 << 10 << 10 << 0x08;
+ *data << stringdata->size() << nullbyte << nullbyte << nullbyte << 0x08;
appendCString(stringdata, slot.toLatin1());
}
}
diff --git a/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp b/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp
index 50eb19f23..e022ccde8 100644
--- a/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp
+++ b/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp
@@ -254,6 +254,8 @@ tst_Suite::tst_Suite()
addTestExclusion("mul-exhaustive", "Demands too much memory on WinCE");
#endif
+ static const char klass[] = "tst_QScriptV8TestSuite";
+
QVector<uint> *data = qt_meta_data_tst_Suite();
// content:
*data << 1 // revision
@@ -265,7 +267,7 @@ tst_Suite::tst_Suite()
;
QVector<char> *stringdata = qt_meta_stringdata_tst_Suite();
- appendCString(stringdata, "tst_Suite");
+ appendCString(stringdata, klass);
appendCString(stringdata, "");
QFileInfoList testFileInfos;
@@ -275,7 +277,8 @@ tst_Suite::tst_Suite()
QString name = tfi.baseName();
// slot: signature, parameters, type, tag, flags
QString slot = QString::fromLatin1("%0()").arg(name);
- *data << stringdata->size() << 10 << 10 << 10 << 0x08;
+ static const int nullbyte = sizeof(klass);
+ *data << stringdata->size() << nullbyte << nullbyte << nullbyte << 0x08;
appendCString(stringdata, slot.toLatin1());
testNames.append(name);
}
diff --git a/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp b/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp
index 97ff04b2a..744ba5264 100644
--- a/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp
+++ b/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp
@@ -88,6 +88,7 @@ private slots:
void currentAnimationWithZeroDuration();
void insertAnimation();
void clearAnimations();
+ void pauseResume();
};
tst_QSequentialAnimationGroup::tst_QSequentialAnimationGroup()
@@ -1644,5 +1645,40 @@ void tst_QSequentialAnimationGroup::clearAnimations()
QCOMPARE(group.state(), QAbstractAnimation::Running);
}
+void tst_QSequentialAnimationGroup::pauseResume()
+{
+ QObject dummy;
+ dummy.setProperty("foo", 0);
+ QParallelAnimationGroup group;
+ QPropertyAnimation *anim = new QPropertyAnimation(&dummy, "foo", &group);
+ anim->setDuration(250);
+ anim->setEndValue(250);
+ QSignalSpy spy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
+ QCOMPARE(group.duration(), 250);
+ group.start();
+ QTest::qWait(100);
+ QCOMPARE(group.state(), QAnimationGroup::Running);
+ QCOMPARE(anim->state(), QAnimationGroup::Running);
+ QCOMPARE(spy.count(), 1);
+ spy.clear();
+ const int currentTime = group.currentTime();
+ QCOMPARE(anim->currentTime(), currentTime);
+
+ group.pause();
+ QCOMPARE(group.state(), QAnimationGroup::Paused);
+ QCOMPARE(group.currentTime(), currentTime);
+ QCOMPARE(anim->state(), QAnimationGroup::Paused);
+ QCOMPARE(anim->currentTime(), currentTime);
+ QCOMPARE(spy.count(), 1);
+ spy.clear();
+
+ group.resume();
+ QCOMPARE(group.state(), QAnimationGroup::Running);
+ QCOMPARE(group.currentTime(), currentTime);
+ QCOMPARE(anim->state(), QAnimationGroup::Running);
+ QCOMPARE(anim->currentTime(), currentTime);
+ QCOMPARE(spy.count(), 1);
+}
+
QTEST_MAIN(tst_QSequentialAnimationGroup)
#include "tst_qsequentialanimationgroup.moc"
diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
index 210f3fae1..516729cb8 100644
--- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
@@ -67,6 +67,9 @@ private slots:
void memoryManagement();
void downCast();
void upCast();
+ void qobjectWeakManagement();
+ void noSharedPointerFromWeakQObject();
+ void weakQObjectFromSharedPointer();
void objectCast();
void differentPointers();
void virtualBaseDifferentPointers();
@@ -79,6 +82,7 @@ private slots:
void constCorrectness();
void customDeleter();
void creating();
+ void creatingQObject();
void mixTrackingPointerCode();
void threadStressTest_data();
void threadStressTest();
@@ -503,6 +507,122 @@ class OtherObject: public QObject
Q_OBJECT
};
+void tst_QSharedPointer::qobjectWeakManagement()
+{
+ {
+ QObject *obj = new QObject;
+ QWeakPointer<QObject> weak(obj);
+ QVERIFY(!weak.isNull());
+ QVERIFY(weak.data() == obj);
+
+ // now delete
+ delete obj;
+ QVERIFY(weak.isNull());
+ }
+ check();
+
+ {
+ // same, bit with operator=
+ QObject *obj = new QObject;
+ QWeakPointer<QObject> weak;
+ weak = obj;
+ QVERIFY(!weak.isNull());
+ QVERIFY(weak.data() == obj);
+
+ // now delete
+ delete obj;
+ QVERIFY(weak.isNull());
+ }
+ check();
+
+ {
+ // delete triggered by parent
+ QObject *obj, *parent;
+ parent = new QObject;
+ obj = new QObject(parent);
+ QWeakPointer<QObject> weak(obj);
+
+ // now delete the parent
+ delete parent;
+ QVERIFY(weak.isNull());
+ }
+ check();
+
+ {
+ // same as above, but set the parent after QWeakPointer is created
+ QObject *obj, *parent;
+ obj = new QObject;
+ QWeakPointer<QObject> weak(obj);
+
+ parent = new QObject;
+ obj->setParent(parent);
+
+ // now delete the parent
+ delete parent;
+ QVERIFY(weak.isNull());
+ }
+ check();
+
+ {
+ // with two QWeakPointers
+ QObject *obj = new QObject;
+ QWeakPointer<QObject> weak(obj);
+
+ {
+ QWeakPointer<QObject> weak2(obj);
+ QVERIFY(!weak2.isNull());
+ QVERIFY(weak == weak2);
+ }
+ QVERIFY(!weak.isNull());
+
+ delete obj;
+ QVERIFY(weak.isNull());
+ }
+ check();
+
+ {
+ // same, but delete the pointer while two QWeakPointers exist
+ QObject *obj = new QObject;
+ QWeakPointer<QObject> weak(obj);
+
+ {
+ QWeakPointer<QObject> weak2(obj);
+ QVERIFY(!weak2.isNull());
+
+ delete obj;
+ QVERIFY(weak.isNull());
+ QVERIFY(weak2.isNull());
+ }
+ QVERIFY(weak.isNull());
+ }
+ check();
+}
+
+void tst_QSharedPointer::noSharedPointerFromWeakQObject()
+{
+ // you're not allowed to create a QSharedPointer from an unmanaged QObject
+ QObject obj;
+ QWeakPointer<QObject> weak(&obj);
+
+ QSharedPointer<QObject> strong = weak.toStrongRef();
+ QVERIFY(strong.isNull());
+
+ // is something went wrong, we'll probably crash here
+}
+
+void tst_QSharedPointer::weakQObjectFromSharedPointer()
+{
+ // this is the inverse of the above: you're allowed to create a QWeakPointer
+ // from a managed QObject
+ QSharedPointer<QObject> shared(new QObject);
+ QWeakPointer<QObject> weak = shared.data();
+ QVERIFY(!weak.isNull());
+
+ // delete:
+ shared.clear();
+ QVERIFY(weak.isNull());
+}
+
void tst_QSharedPointer::objectCast()
{
{
@@ -1081,6 +1201,13 @@ void tst_QSharedPointer::customDeleter()
QCOMPARE(dataDeleter.callCount, 0);
QCOMPARE(derivedDataDeleter.callCount, 1);
QCOMPARE(refcount, 2);
+ check();
+}
+
+void customQObjectDeleterFn(QObject *obj)
+{
+ ++customDeleterFnCallCount;
+ delete obj;
}
void tst_QSharedPointer::creating()
@@ -1147,7 +1274,10 @@ void tst_QSharedPointer::creating()
QCOMPARE(baseptr->classLevel(), 4);
}
check();
+}
+void tst_QSharedPointer::creatingQObject()
+{
{
QSharedPointer<QObject> ptr = QSharedPointer<QObject>::create();
QCOMPARE(ptr->metaObject(), &QObject::staticMetaObject);
@@ -1243,7 +1373,9 @@ void tst_QSharedPointer::threadStressTest_data()
QTest::newRow("5+10") << 5 << 10;
QTest::newRow("5+30") << 5 << 30;
+#ifndef Q_OS_WINCE
QTest::newRow("100+100") << 100 << 100;
+#endif
}
void tst_QSharedPointer::threadStressTest()
@@ -1277,7 +1409,11 @@ void tst_QSharedPointer::threadStressTest()
base.clear();
+#ifdef Q_OS_WINCE
+ srand(QDateTime::currentDateTime().toTime_t());
+#else
srand(time(NULL));
+#endif
// start threads
for (int i = 0; i < allThreads.count(); ++i)
if (allThreads[i]) allThreads[i]->start();
@@ -1446,6 +1582,17 @@ void tst_QSharedPointer::invalidConstructs_data()
<< &QTest::QExternalTest::tryCompileFail
<< "QSharedPointer<Data> ptr1;\n"
"QSharedPointer<int> ptr2 = qSharedPointerObjectCast<int>(ptr1);";
+
+ QTest::newRow("weak-pointer-from-regular-pointer")
+ << &QTest::QExternalTest::tryCompileFail
+ << "Data *ptr = 0;\n"
+ "QWeakPointer<Data> weakptr(ptr);\n";
+
+ QTest::newRow("shared-pointer-from-unmanaged-qobject")
+ << &QTest::QExternalTest::tryRunFail
+ << "QObject *ptr = new QObject;\n"
+ "QWeakPointer<QObject> weak = ptr;\n" // this makes the object unmanaged
+ "QSharedPointer<QObject> shared(ptr);\n";
}
void tst_QSharedPointer::invalidConstructs()
diff --git a/tests/auto/qsharedpointer_and_qwidget/qsharedpointer_and_qwidget.pro b/tests/auto/qsharedpointer_and_qwidget/qsharedpointer_and_qwidget.pro
new file mode 100644
index 000000000..db647a55c
--- /dev/null
+++ b/tests/auto/qsharedpointer_and_qwidget/qsharedpointer_and_qwidget.pro
@@ -0,0 +1,3 @@
+load(qttest_p4)
+SOURCES += tst_qsharedpointer_and_qwidget.cpp
+DEFINES += SRCDIR=\\\"$$PWD/\\\"
diff --git a/tests/auto/qsharedpointer_and_qwidget/tst_qsharedpointer_and_qwidget.cpp b/tests/auto/qsharedpointer_and_qwidget/tst_qsharedpointer_and_qwidget.cpp
new file mode 100644
index 000000000..66727c2fc
--- /dev/null
+++ b/tests/auto/qsharedpointer_and_qwidget/tst_qsharedpointer_and_qwidget.cpp
@@ -0,0 +1,150 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui/QWidget>
+#include <QtGui/QPushButton>
+#include <QtTest/QtTest>
+
+namespace QtSharedPointer {
+ Q_CORE_EXPORT void internalSafetyCheckCleanCheck();
+}
+
+class tst_QSharedPointer_and_QWidget: public QObject
+{
+ Q_OBJECT
+private slots:
+ void weak_externalDelete();
+ void weak_parentDelete();
+ void weak_parentDelete_setParent();
+
+ void strong_weak();
+
+ void strong_sharedptrDelete();
+
+public slots:
+ void cleanup() { check(); }
+
+public:
+ inline void check()
+ {
+#ifdef QT_BUILD_INTERNAL
+ QtSharedPointer::internalSafetyCheckCleanCheck();
+#endif
+ }
+};
+
+void tst_QSharedPointer_and_QWidget::weak_externalDelete()
+{
+ QWidget *w = new QWidget;
+ QWeakPointer<QWidget> ptr = w;
+
+ QVERIFY(!ptr.isNull());
+
+ delete w;
+ QVERIFY(ptr.isNull());
+}
+
+void tst_QSharedPointer_and_QWidget::weak_parentDelete()
+{
+ QWidget *parent = new QWidget;
+ QWidget *w = new QWidget(parent);
+ QWeakPointer<QWidget> ptr = w;
+
+ QVERIFY(!ptr.isNull());
+
+ delete parent;
+ QVERIFY(ptr.isNull());
+}
+
+void tst_QSharedPointer_and_QWidget::weak_parentDelete_setParent()
+{
+ QWidget *parent = new QWidget;
+ QWidget *w = new QWidget;
+ QWeakPointer<QWidget> ptr = w;
+ w->setParent(parent);
+
+ QVERIFY(!ptr.isNull());
+
+ delete parent;
+ QVERIFY(ptr.isNull());
+}
+
+// -- mixed --
+
+void tst_QSharedPointer_and_QWidget::strong_weak()
+{
+ QSharedPointer<QWidget> ptr(new QWidget);
+ QWeakPointer<QWidget> weak = ptr.data();
+ QWeakPointer<QWidget> weak2 = ptr;
+
+ QVERIFY(!weak.isNull());
+ QVERIFY(!weak2.isNull());
+
+ ptr.clear(); // deletes
+
+ QVERIFY(weak.isNull());
+ QVERIFY(weak2.isNull());
+}
+
+
+// ---- strong management ----
+
+void tst_QSharedPointer_and_QWidget::strong_sharedptrDelete()
+{
+ QWidget *parent = new QWidget;
+ QSharedPointer<QWidget> ptr(new QWidget(parent));
+ QWeakPointer<QWidget> weak = ptr;
+ QPointer<QWidget> check = ptr.data();
+
+ QVERIFY(!check.isNull());
+ QVERIFY(!weak.isNull());
+
+ ptr.clear(); // deletes
+
+ QVERIFY(check.isNull());
+ QVERIFY(weak.isNull());
+
+ delete parent; // mustn't crash
+}
+
+QTEST_MAIN(tst_QSharedPointer_and_QWidget)
+
+#include "tst_qsharedpointer_and_qwidget.moc"
diff --git a/tests/auto/qsqldatabase/tst_databases.h b/tests/auto/qsqldatabase/tst_databases.h
index 8253541fd..f1e9d28e0 100644
--- a/tests/auto/qsqldatabase/tst_databases.h
+++ b/tests/auto/qsqldatabase/tst_databases.h
@@ -219,7 +219,7 @@ public:
// addDb( "QMYSQL3", "testdb", "troll", "trond", "horsehead.nokia.troll.no", 3307 );
// addDb( "QMYSQL3", "testdb", "troll", "trond", "horsehead.nokia.troll.no", 3308, "CLIENT_COMPRESS=1;CLIENT_SSL=1" ); // MySQL 4.1.1
// addDb( "QMYSQL3", "testdb", "troll", "trond", "horsehead.nokia.troll.no", 3309, "CLIENT_COMPRESS=1;CLIENT_SSL=1" ); // MySQL 5.0.18 Linux
-// addDb( "QMYSQL3", "testdb", "troll", "trond", "iceblink.nokia.troll.no" ); // MySQL 5.0.13 Windows
+// addDb( "QMYSQL3", "testdb", "troll", "trond", "silence.nokia.troll.no" ); // MySQL 5.1.36 Windows
// addDb( "QMYSQL3", "testdb", "testuser", "Ee4Gabf6_", "mysql4-nokia.trolltech.com.au" ); // MySQL 4.1.22-2.el4 linux
// addDb( "QMYSQL3", "testdb", "testuser", "Ee4Gabf6_", "mysql5-nokia.trolltech.com.au" ); // MySQL 5.0.45-7.el5 linux
@@ -518,6 +518,16 @@ public:
return QString();
}
+ static QString getPSQLVersion( const QSqlDatabase &db )
+ {
+ QSqlQuery q(db);
+ q.exec( "select version()" );
+ if(q.next())
+ return q.value( 0 ).toString();
+ else
+ return QString();
+ }
+
QStringList dbNames;
int counter;
};
diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
index 4cf8d562a..fe4c86e1a 100644
--- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
+++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
@@ -1054,6 +1054,7 @@ void tst_QSqlDatabase::recordMySQL()
int major = tst_Databases::getMySqlVersion( db ).section( QChar('.'), 0, 0 ).toInt();
int minor = tst_Databases::getMySqlVersion( db ).section( QChar('.'), 1, 1 ).toInt();
int revision = tst_Databases::getMySqlVersion( db ).section( QChar('.'), 2, 2 ).toInt();
+ int vernum = (major << 16) + (minor << 8) + revision;
#ifdef QT3_SUPPORT
/* The below is broken in mysql below 5.0.15
@@ -1061,7 +1062,7 @@ void tst_QSqlDatabase::recordMySQL()
specifically: Before MySQL 5.0.15, the pad value is space. Values are right-padded
with space on insert, and trailing spaces are removed on select.
*/
- if ( major >5 || ( major == 5 && minor > 0) || ( major == 5 && minor == 0 && revision >= 15) ) {
+ if( vernum >= ((5 << 16) + 15) ) {
bin10 = FieldDef("binary(10)", QVariant::ByteArray, QByteArray(Q3CString("123abc ")));
varbin10 = FieldDef("varbinary(10)", QVariant::ByteArray, QByteArray(Q3CString("123abcv ")));
}
@@ -1591,6 +1592,11 @@ void tst_QSqlDatabase::bug_249059()
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
+ QString version=tst_Databases::getPSQLVersion( db );
+ double ver=version.section(QChar::fromLatin1('.'),0,1).toDouble();
+ if (ver < 7.3)
+ QSKIP("Test requires PostgreSQL >= 7.3", SkipSingle);
+
QSqlQuery q(db);
QString tableName = qTableName("bug_249059");
QVERIFY_SQL(q, exec(QString("CREATE TABLE %1 (dt timestamp, t time)").arg(tableName)));
@@ -2025,8 +2031,6 @@ void tst_QSqlDatabase::mysql_multiselect()
CHECK_DATABASE(db);
QSqlQuery q(db);
- QVERIFY_SQL(q, exec("select version()"));
- QVERIFY_SQL(q, next());
QString version=tst_Databases::getMySqlVersion( db );
double ver=version.section(QChar::fromLatin1('.'),0,1).toDouble();
if (ver < 4.1)
diff --git a/tests/auto/qstringbuilder/scenario1.pro b/tests/auto/qstringbuilder/scenario1.pro
index 4ce715610..d72451c2e 100644
--- a/tests/auto/qstringbuilder/scenario1.pro
+++ b/tests/auto/qstringbuilder/scenario1.pro
@@ -3,6 +3,7 @@ load(qttest_p4)
QT = core
SOURCES += scenario1.cpp
+HEADERS += tst_qstringbuilder.h
DEFINES += SCENARIO=1
diff --git a/tests/auto/qstringbuilder/scenario2.pro b/tests/auto/qstringbuilder/scenario2.pro
index 64c46e2a5..78e0c68de 100644
--- a/tests/auto/qstringbuilder/scenario2.pro
+++ b/tests/auto/qstringbuilder/scenario2.pro
@@ -3,5 +3,6 @@ load(qttest_p4)
QT = core
SOURCES += scenario2.cpp
+HEADERS += tst_qstringbuilder.h
DEFINES += SCENARIO=2
diff --git a/tests/auto/qstringbuilder/scenario3.pro b/tests/auto/qstringbuilder/scenario3.pro
index beedffd87..7b9e5af18 100644
--- a/tests/auto/qstringbuilder/scenario3.pro
+++ b/tests/auto/qstringbuilder/scenario3.pro
@@ -3,5 +3,6 @@ load(qttest_p4)
QT = core
SOURCES += scenario3.cpp
+HEADERS += tst_qstringbuilder.h
DEFINES += SCENARIO=3
diff --git a/tests/auto/qstringbuilder/scenario4.pro b/tests/auto/qstringbuilder/scenario4.pro
index 1c45a7034..1b62b25e3 100644
--- a/tests/auto/qstringbuilder/scenario4.pro
+++ b/tests/auto/qstringbuilder/scenario4.pro
@@ -3,5 +3,6 @@ load(qttest_p4)
QT = core
SOURCES += scenario4.cpp
+HEADERS += tst_qstringbuilder.h
DEFINES += SCENARIO=4
diff --git a/tests/auto/qstringbuilder/tst_qstringbuilder.cpp b/tests/auto/qstringbuilder/tst_qstringbuilder.cpp
index 72889bc13..86f6ada42 100644
--- a/tests/auto/qstringbuilder/tst_qstringbuilder.cpp
+++ b/tests/auto/qstringbuilder/tst_qstringbuilder.cpp
@@ -86,20 +86,13 @@
#endif
#include <QtTest/QtTest>
+#include "tst_qstringbuilder.h"
//TESTED_CLASS=QStringBuilder
//TESTED_FILES=qstringbuilder.cpp
#define LITERAL "some literal"
-class tst_QStringBuilder : public QObject
-{
- Q_OBJECT
-
-private slots:
- void scenario();
-};
-
void tst_QStringBuilder::scenario()
{
QLatin1Literal l1literal(LITERAL);
@@ -138,5 +131,3 @@ void tst_QStringBuilder::scenario()
}
QTEST_APPLESS_MAIN(tst_QStringBuilder)
-
-#include "tst_qstringbuilder.moc"
diff --git a/tests/auto/qstringbuilder/tst_qstringbuilder.h b/tests/auto/qstringbuilder/tst_qstringbuilder.h
new file mode 100644
index 000000000..92c66d8c3
--- /dev/null
+++ b/tests/auto/qstringbuilder/tst_qstringbuilder.h
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TST_QSTRINGBUILDER_H
+#define TST_QSTRINGBUILDER_H
+
+#include <qobject.h>
+
+class tst_QStringBuilder : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void scenario();
+};
+
+#endif
diff --git a/tests/auto/qstyle/tst_qstyle.cpp b/tests/auto/qstyle/tst_qstyle.cpp
index 2cb508080..3c63a50aa 100644
--- a/tests/auto/qstyle/tst_qstyle.cpp
+++ b/tests/auto/qstyle/tst_qstyle.cpp
@@ -351,7 +351,7 @@ void tst_QStyle::testAllFunctions(QStyle *style)
testScrollBarSubControls(style);
}
-void tst_QStyle::testScrollBarSubControls(QStyle *)
+void tst_QStyle::testScrollBarSubControls(QStyle* style)
{
#ifdef Q_OS_WINCE_WM
if (qobject_cast<QWindowsMobileStyle*>(style) && qt_wince_is_smartphone())
diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp
index 6fa57f0a7..eb39dd73e 100644
--- a/tests/auto/qtableview/tst_qtableview.cpp
+++ b/tests/auto/qtableview/tst_qtableview.cpp
@@ -2542,7 +2542,7 @@ void tst_QTableView::span_data()
<< 2 << 1
<< false;
- /* This makes no sens.
+ /* This makes no sens.
QTest::newRow("top left 2x0")
<< 10 << 10
<< -1 << -1
@@ -2631,7 +2631,7 @@ void tst_QTableView::span()
view.hideRow(hiddenRow);
view.hideColumn(hiddenColumn);
view.show();
-
+
QCOMPARE(view.rowSpan(row, column), expectedRowSpan);
QCOMPARE(view.columnSpan(row, column), expectedColumnSpan);
@@ -3110,14 +3110,14 @@ void tst_QTableView::task227953_setRootIndex()
}
tableView.setModel(&model);
-
+
//show the first 10 rows of the first table
QModelIndex root = model.indexFromItem(&item1);
tableView.setRootIndex(root);
for (int i = 10; i != 40; ++i) {
tableView.setRowHidden(i, true);
}
-
+
QCOMPARE(tableView.verticalHeader()->count(), 40);
QCOMPARE(tableView.verticalHeader()->hiddenSectionCount(), 30);
@@ -3139,16 +3139,13 @@ void tst_QTableView::task240266_veryBigColumn()
table.setColumnWidth(1, 100); //normal column
table.setColumnWidth(2, 9000); //very big column
table.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
QTest::qWait(100);
QScrollBar *scroll = table.horizontalScrollBar();
QCOMPARE(scroll->minimum(), 0);
QCOMPARE(scroll->maximum(), model.columnCount() - 1);
QCOMPARE(scroll->singleStep(), 1);
-
+
//1 is not always a very correct value for pageStep. Ideally this should be dynamic.
//Maybe something for Qt 5 ;-)
QCOMPARE(scroll->pageStep(), 1);
diff --git a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp
index 30f97ba74..13d0f34f2 100644
--- a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp
+++ b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp
@@ -76,13 +76,13 @@
// This test depends on the fonts in the following package being installed:
// http://people.freedesktop.org/~hausmann/harfbuzz-test-fonts-0.1.tar.bz2
-class tst_QScriptEngine : public QObject
+class tst_QTextScriptEngine : public QObject
{
Q_OBJECT
public:
- tst_QScriptEngine();
- virtual ~tst_QScriptEngine();
+ tst_QTextScriptEngine();
+ virtual ~tst_QTextScriptEngine();
public slots:
@@ -104,19 +104,19 @@ private slots:
void linearB();
};
-tst_QScriptEngine::tst_QScriptEngine()
+tst_QTextScriptEngine::tst_QTextScriptEngine()
{
}
-tst_QScriptEngine::~tst_QScriptEngine()
+tst_QTextScriptEngine::~tst_QTextScriptEngine()
{
}
-void tst_QScriptEngine::init()
+void tst_QTextScriptEngine::init()
{
}
-void tst_QScriptEngine::cleanup()
+void tst_QTextScriptEngine::cleanup()
{
}
@@ -172,7 +172,7 @@ static bool shaping( const QFont &f, const ShapeTable *s)
}
#endif
-void tst_QScriptEngine::devanagari()
+void tst_QTextScriptEngine::devanagari()
{
#if defined(Q_WS_X11)
{
@@ -284,7 +284,7 @@ void tst_QScriptEngine::devanagari()
#endif
}
-void tst_QScriptEngine::bengali()
+void tst_QTextScriptEngine::bengali()
{
#if defined(Q_WS_X11)
{
@@ -531,7 +531,7 @@ void tst_QScriptEngine::bengali()
#endif
}
-void tst_QScriptEngine::gurmukhi()
+void tst_QTextScriptEngine::gurmukhi()
{
#if defined(Q_WS_X11)
{
@@ -556,7 +556,7 @@ void tst_QScriptEngine::gurmukhi()
#endif
}
-void tst_QScriptEngine::oriya()
+void tst_QTextScriptEngine::oriya()
{
#if defined(Q_WS_X11)
{
@@ -596,7 +596,7 @@ void tst_QScriptEngine::oriya()
}
-void tst_QScriptEngine::tamil()
+void tst_QTextScriptEngine::tamil()
{
#if defined(Q_WS_X11)
{
@@ -667,7 +667,7 @@ void tst_QScriptEngine::tamil()
}
-void tst_QScriptEngine::telugu()
+void tst_QTextScriptEngine::telugu()
{
#if defined(Q_WS_X11)
{
@@ -713,7 +713,7 @@ void tst_QScriptEngine::telugu()
}
-void tst_QScriptEngine::kannada()
+void tst_QTextScriptEngine::kannada()
{
#if defined(Q_WS_X11)
{
@@ -783,7 +783,7 @@ void tst_QScriptEngine::kannada()
-void tst_QScriptEngine::malayalam()
+void tst_QTextScriptEngine::malayalam()
{
#if defined(Q_WS_X11)
{
@@ -838,7 +838,7 @@ void tst_QScriptEngine::malayalam()
-void tst_QScriptEngine::khmer()
+void tst_QTextScriptEngine::khmer()
{
#if defined(Q_WS_X11)
{
@@ -881,7 +881,7 @@ void tst_QScriptEngine::khmer()
#endif
}
-void tst_QScriptEngine::linearB()
+void tst_QTextScriptEngine::linearB()
{
#if defined(Q_WS_X11)
{
@@ -909,5 +909,5 @@ void tst_QScriptEngine::linearB()
}
-QTEST_MAIN(tst_QScriptEngine)
+QTEST_MAIN(tst_QTextScriptEngine)
#include "tst_qtextscriptengine.moc"
diff --git a/tests/auto/qtimeline/tst_qtimeline.cpp b/tests/auto/qtimeline/tst_qtimeline.cpp
index e6e75ff01..4ce1f4b81 100644
--- a/tests/auto/qtimeline/tst_qtimeline.cpp
+++ b/tests/auto/qtimeline/tst_qtimeline.cpp
@@ -81,6 +81,7 @@ private slots:
void outOfRange();
void stateInFinishedSignal();
void resume();
+ void restart();
protected slots:
void finishedSlot();
@@ -177,7 +178,7 @@ void tst_QTimeLine::currentTime()
QCOMPARE(spy.count(), 1);
spy.clear();
QCOMPARE(timeLine.currentTime(), timeLine.duration()/2);
- timeLine.start();
+ timeLine.resume();
// Let it update on its own
QTest::qWait(timeLine.duration()/4);
QCOMPARE(timeLine.state(), QTimeLine::Running);
@@ -699,5 +700,43 @@ void tst_QTimeLine::resume()
}
}
+void tst_QTimeLine::restart()
+{
+ QTimeLine timeLine(100);
+ timeLine.setFrameRange(0,9);
+
+ timeLine.start();
+ QTest::qWait(timeLine.duration()*2);
+ QCOMPARE(timeLine.currentFrame(), timeLine.endFrame());
+ QCOMPARE(timeLine.state(), QTimeLine::NotRunning);
+
+ // A restart with the same duration
+ timeLine.start();
+ QCOMPARE(timeLine.state(), QTimeLine::Running);
+ QCOMPARE(timeLine.currentFrame(), timeLine.startFrame());
+ QCOMPARE(timeLine.currentTime(), 0);
+ QTest::qWait(250);
+ QCOMPARE(timeLine.currentFrame(), timeLine.endFrame());
+ QCOMPARE(timeLine.state(), QTimeLine::NotRunning);
+
+ // Set a smaller duration and restart
+ timeLine.setDuration(50);
+ timeLine.start();
+ QCOMPARE(timeLine.state(), QTimeLine::Running);
+ QCOMPARE(timeLine.currentFrame(), timeLine.startFrame());
+ QCOMPARE(timeLine.currentTime(), 0);
+ QTest::qWait(250);
+ QCOMPARE(timeLine.currentFrame(), timeLine.endFrame());
+ QCOMPARE(timeLine.state(), QTimeLine::NotRunning);
+
+ // Set a longer duration and restart
+ timeLine.setDuration(150);
+ timeLine.start();
+ QCOMPARE(timeLine.state(), QTimeLine::Running);
+ QCOMPARE(timeLine.currentFrame(), timeLine.startFrame());
+ QCOMPARE(timeLine.currentTime(), 0);
+}
+
QTEST_MAIN(tst_QTimeLine)
+
#include "tst_qtimeline.moc"
diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp
index b21a97355..6b4282122 100644
--- a/tests/auto/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/qtreeview/tst_qtreeview.cpp
@@ -2917,8 +2917,7 @@ void tst_QTreeView::styleOptionViewItem()
delegate.count = 0;
view.showMaximized();
- QTest::qWait(30);
- QVERIFY(delegate.count >= 13);
+ QTRY_VERIFY(delegate.count >= 13);
}
class task174627_TreeView : public QTreeView
diff --git a/tests/auto/qtreewidget/tst_qtreewidget.cpp b/tests/auto/qtreewidget/tst_qtreewidget.cpp
index 7d79d5639..fd0fdb112 100644
--- a/tests/auto/qtreewidget/tst_qtreewidget.cpp
+++ b/tests/auto/qtreewidget/tst_qtreewidget.cpp
@@ -238,6 +238,9 @@ void tst_QTreeWidget::initTestCase()
testWidget = new CustomTreeWidget();
testWidget->show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(testWidget);
+#endif
}
void tst_QTreeWidget::cleanupTestCase()
@@ -2017,7 +2020,7 @@ void tst_QTreeWidget::setHeaderItem()
headerItem->setText(0, "0");
headerItem->setText(1, "1");
testWidget->setHeaderItem(headerItem);
- qApp->processEvents();
+ QTest::qWait(100);
QCOMPARE(testWidget->headerItem(), headerItem);
QCOMPARE(headerItem->treeWidget(), static_cast<QTreeWidget *>(testWidget));
@@ -2762,16 +2765,18 @@ void tst_QTreeWidget::defaultRowSizes()
for (int j=0; j<tw->columnCount() - 1; ++j) {
it->setText(j, "This is a test");
}
+ QPixmap icon = tw->style()->standardPixmap((QStyle::StandardPixmap)(i + QStyle::SP_TitleBarMenuButton));
+ if (icon.isNull())
+ QSKIP("No pixmap found on current style, skipping this test.", SkipSingle);
it->setIcon(tw->columnCount() - 1,
- tw->style()->standardPixmap((QStyle::StandardPixmap)(i + QStyle::SP_TitleBarMenuButton)).
- scaled(tw->iconSize()));
+ icon.scaled(tw->iconSize()));
}
tw->resize(100,100);
tw->show();
QApplication::processEvents();
QRect visualRect = tw->visualItemRect(tw->topLevelItem(0));
- QVERIFY(visualRect.height() >=50);
+ QVERIFY(visualRect.height() >= 50);
}
void tst_QTreeWidget::task191552_rtl()
diff --git a/tests/auto/qwidget_window/tst_qwidget_window.cpp b/tests/auto/qwidget_window/tst_qwidget_window.cpp
index f059abe50..6dddfe8b7 100644
--- a/tests/auto/qwidget_window/tst_qwidget_window.cpp
+++ b/tests/auto/qwidget_window/tst_qwidget_window.cpp
@@ -78,6 +78,7 @@ private slots:
void tst_windowFilePath();
void tst_showWithoutActivating();
+ void tst_paintEventOnSecondShow();
};
void tst_QWidget_window::initTestCase()
@@ -150,7 +151,9 @@ class TestWidget : public QWidget
{
public:
int m_first, m_next;
- void reset(){ m_first = m_next = 0; }
+ bool paintEventReceived;
+
+ void reset(){ m_first = m_next = 0; paintEventReceived = false; }
bool event(QEvent *event)
{
switch (event->type()) {
@@ -162,6 +165,10 @@ public:
m_next = event->type();
else
m_first = event->type();
+ break;
+ case QEvent::Paint:
+ paintEventReceived = true;
+ break;
default:
break;
}
@@ -300,5 +307,20 @@ void tst_QWidget_window::tst_showWithoutActivating()
#endif // Q_WS_X11
}
+void tst_QWidget_window::tst_paintEventOnSecondShow()
+{
+ TestWidget w;
+ w.show();
+ w.hide();
+
+ w.reset();
+ w.show();
+#ifdef Q_WS_X11
+ QTest::qWait(500);
+#endif
+ QApplication::processEvents();
+ QVERIFY(w.paintEventReceived);
+}
+
QTEST_MAIN(tst_QWidget_window)
#include "tst_qwidget_window.moc"
diff --git a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp
index ddd193008..b03cd05a1 100644
--- a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp
+++ b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp
@@ -48,6 +48,7 @@
#include <private/qwindowsurface_p.h>
#include <QDesktopWidget>
+#include <QX11Info>
class tst_QWindowSurface : public QObject
{
@@ -138,6 +139,11 @@ void tst_QWindowSurface::getSetWindowSurface()
void tst_QWindowSurface::flushOutsidePaintEvent()
{
+#ifdef Q_WS_X11
+ if (QX11Info::isCompositingManagerRunning())
+ QSKIP("Test is unreliable with composition manager", SkipAll);
+#endif
+
#ifdef Q_WS_WIN
if (QSysInfo::WindowsVersion & QSysInfo::WV_VISTA) {
QTest::qWait(1000);
diff --git a/tests/auto/qxmlquery/qxmlquery.pro b/tests/auto/qxmlquery/qxmlquery.pro
index e8ab641ab..3db3734fa 100644
--- a/tests/auto/qxmlquery/qxmlquery.pro
+++ b/tests/auto/qxmlquery/qxmlquery.pro
@@ -10,6 +10,12 @@ RESOURCES = input.qrc
QT += network
+!wince* {
+DEFINES += SRCDIR=\\\"$$PWD/\\\"
+} else {
+DEFINES += SRCDIR=\\\"./\\\"
+}
+
include (../xmlpatterns.pri)
wince*: {
diff --git a/tests/auto/qxmlquery/tst_qxmlquery.cpp b/tests/auto/qxmlquery/tst_qxmlquery.cpp
index 5c1432935..65632406e 100644
--- a/tests/auto/qxmlquery/tst_qxmlquery.cpp
+++ b/tests/auto/qxmlquery/tst_qxmlquery.cpp
@@ -259,7 +259,7 @@ void tst_QXmlQuery::checkBaseURI(const QUrl &baseURI, const QString &candidate)
QVERIFY(QDir(baseURI.toLocalFile()).relativeFilePath(QFileInfo(candidate).canonicalFilePath()).startsWith("../"));
}
-const char *const tst_QXmlQuery::queriesDirectory = "../xmlpatterns/queries/";
+const char *const tst_QXmlQuery::queriesDirectory = SRCDIR "../xmlpatterns/queries/";
QStringList tst_QXmlQuery::queries()
{
@@ -738,7 +738,7 @@ void tst_QXmlQuery::bindVariableQStringQIODeviceWithString() const
void tst_QXmlQuery::bindVariableQStringQIODeviceWithQFile() const
{
QXmlQuery query;
- QFile inDevice(QLatin1String("input.xml"));
+ QFile inDevice(QLatin1String(SRCDIR "input.xml"));
QVERIFY(inDevice.open(QIODevice::ReadOnly));
@@ -852,7 +852,7 @@ void tst_QXmlQuery::bindVariableXSLTSuccess() const
stylesheet.bindVariable(QLatin1String("paramSelectWithTypeIntBoundWithBindVariableRequired"),
QVariant(QLatin1String("param5")));
- stylesheet.setQuery(QUrl(inputFile(QLatin1String("../xmlpatterns/stylesheets/parameters.xsl"))));
+ stylesheet.setQuery(QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/parameters.xsl"))));
QVERIFY(stylesheet.isValid());
@@ -960,7 +960,7 @@ void tst_QXmlQuery::evaluateToReceiver()
PushBaseliner push(stream, query.namePool());
query.evaluateTo(&push);
- const QString baselineName(inputFile(QLatin1String("pushBaselines/") + inputQuery.left(inputQuery.length() - 2) + QString::fromLatin1("ref")));
+ const QString baselineName(inputFile(QLatin1String(SRCDIR "pushBaselines/") + inputQuery.left(inputQuery.length() - 2) + QString::fromLatin1("ref")));
QFile baseline(baselineName);
if(baseline.exists())
@@ -1300,7 +1300,7 @@ void tst_QXmlQuery::basicQtToXQueryTypeCheck() const
// TODO Do with different QDateTime time specs
query.bindVariable(QLatin1String("fromQDateTime"), QXmlItem(QDateTime(QDate(2001, 9, 10), QTime(1, 2, 3))));
query.bindVariable(QLatin1String("fromDouble"), QXmlItem(double(3)));
- query.bindVariable(QLatin1String("fromFloat"), QXmlItem(float(4)));
+// query.bindVariable(QLatin1String("fromFloat"), QXmlItem(float(4)));
query.bindVariable(QLatin1String("integer"), QXmlItem(5));
query.bindVariable(QLatin1String("fromQString"), QXmlItem(QString::fromLatin1("A QString")));
query.bindVariable(QLatin1String("fromQChar"), QXmlItem(QChar::fromLatin1('C')));
@@ -1793,11 +1793,11 @@ void tst_QXmlQuery::setFocusQUrl() const
{
QXmlQuery query(QXmlQuery::XSLT20);
- const TestURIResolver resolver(QUrl(inputFile(QLatin1String("../xmlpatterns/stylesheets/documentElement.xml"))));
+ const TestURIResolver resolver(QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/documentElement.xml"))));
query.setUriResolver(&resolver);
QVERIFY(query.setFocus(QUrl(QLatin1String("arbitraryURI"))));
- query.setQuery(QUrl(inputFile(QLatin1String("../xmlpatterns/stylesheets/copyWholeDocument.xsl"))));
+ query.setQuery(QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/copyWholeDocument.xsl"))));
QVERIFY(query.isValid());
QBuffer result;
@@ -2011,7 +2011,7 @@ void tst_QXmlQuery::fnDocNetworkAccessSuccess_data() const
QTest::addColumn<QByteArray>("expectedOutput");
QTest::newRow("file scheme")
- << inputFileAsURI(QLatin1String("input.xml"))
+ << inputFileAsURI(QLatin1String(SRCDIR "input.xml"))
<< QByteArray("<!-- This is just a file for testing. --><input/>");
QTest::newRow("data scheme with ASCII")
@@ -2992,7 +2992,7 @@ void tst_QXmlQuery::setInitialTemplateNameQXmlName() const
QCOMPARE(query.initialTemplateName(), name);
- query.setQuery(QUrl(inputFile(QLatin1String("../xmlpatterns/stylesheets/namedTemplate.xsl"))));
+ query.setQuery(QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/namedTemplate.xsl"))));
QVERIFY(query.isValid());
QBuffer result;
@@ -3054,7 +3054,7 @@ void tst_QXmlQuery::setNetworkAccessManager() const
/* Ensure fn:doc() picks up the right QNetworkAccessManager. */
{
NetworkOverrider networkOverrider(QUrl(QLatin1String("tag:example.com:DOESNOTEXIST")),
- QUrl(inputFile(QLatin1String("../xmlpatterns/queries/simpleDocument.xml"))));
+ QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/queries/simpleDocument.xml"))));
QXmlQuery query;
query.setNetworkAccessManager(&networkOverrider);
@@ -3070,7 +3070,7 @@ void tst_QXmlQuery::setNetworkAccessManager() const
/* Ensure setQuery() is using the right network manager. */
{
NetworkOverrider networkOverrider(QUrl(QLatin1String("tag:example.com:DOESNOTEXIST")),
- QUrl(inputFile(QLatin1String("../xmlpatterns/queries/concat.xq"))));
+ QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/queries/concat.xq"))));
QXmlQuery query;
query.setNetworkAccessManager(&networkOverrider);
@@ -3128,9 +3128,9 @@ void tst_QXmlQuery::multipleDocsAndFocus() const
/* We use string concatenation, since variable bindings might disturb what
* we're testing. */
query.setQuery(QLatin1String("string(doc('") +
- inputFile(QLatin1String("../xmlpatterns/queries/simpleDocument.xml")) +
+ inputFile(QLatin1String(SRCDIR "../xmlpatterns/queries/simpleDocument.xml")) +
QLatin1String("'))"));
- query.setFocus(QUrl(inputFile(QLatin1String("../xmlpatterns/stylesheets/documentElement.xml"))));
+ query.setFocus(QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/documentElement.xml"))));
query.setQuery(QLatin1String("string(.)"));
QStringList result;
@@ -3154,11 +3154,11 @@ void tst_QXmlQuery::multipleEvaluationsWithDifferentFocus() const
QXmlQuery query;
QStringList result;
- query.setFocus(QUrl(inputFile(QLatin1String("../xmlpatterns/stylesheets/documentElement.xml"))));
+ query.setFocus(QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/documentElement.xml"))));
query.setQuery(QLatin1String("string(.)"));
QVERIFY(query.evaluateTo(&result));
- query.setFocus(QUrl(inputFile(QLatin1String("../xmlpatterns/stylesheets/documentElement.xml"))));
+ query.setFocus(QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/documentElement.xml"))));
QVERIFY(query.evaluateTo(&result));
}
diff --git a/tests/auto/runQtXmlPatternsTests.sh b/tests/auto/runQtXmlPatternsTests.sh
deleted file mode 100755
index 41d6c83ef..000000000
--- a/tests/auto/runQtXmlPatternsTests.sh
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/bin/sh
-# Runs all the tests specific to QtXmlPatterns in one go.
-
-# If you add a test, remember to update ./auto.pro too.
-# checkxmlfiles is not part of Patternist, but since it shares test code
-# and use Patternist, we include it as well.
-#
-# Sorted alphabetically, with the difference that xmlpatternsxqts appears
-# before xmlpattersview, xmlpatternsdiagnosticsts, and xmlpatternsxslts, since
-# they have the former as dependency.
-tests=" \
-checkxmlfiles \
-patternistexamplefiletree \
-patternistexamples \
-patternistheaders \
-qabstractmessagehandler \
-qabstracturiresolver \
-qabstractxmlforwarditerator \
-qabstractxmlnodemodel \
-qabstractxmlreceiver \
-qapplicationargumentparser \
-qautoptr \
-qsimplexmlnodemodel \
-qsourcelocation \
-qtokenautomaton \
-qxmlformatter \
-qxmlitem \
-qxmlname \
-qxmlnamepool \
-qxmlnodemodelindex \
-qxmlquery \
-qxmlresultitems \
-qxmlserializer \
-xmlpatterns \
-xmlpatternsxqts \
-xmlpatternsdiagnosticsts \
-xmlpatternsschema \
-xmlpatternsschemats \
-xmlpatternsview \
-xmlpatternsxslts"
-
-os=`uname`
-
-for test in $tests; do
- cd $test
- make distclean
- qmake
- make
-
- if [ $os = "Darwin" ]; then
- ./tst_"$test".app/Contents/MacOS/tst_"$test"
- else
- ./tst_$test
- fi
-
- if [ $? -ne 0 ]; then
- exit $?
- else
- cd ..
- fi
-done
diff --git a/tests/auto/selftests/benchlibwalltime/tst_benchlibwalltime.cpp b/tests/auto/selftests/benchlibwalltime/tst_benchlibwalltime.cpp
index de655995e..8474144f3 100644
--- a/tests/auto/selftests/benchlibwalltime/tst_benchlibwalltime.cpp
+++ b/tests/auto/selftests/benchlibwalltime/tst_benchlibwalltime.cpp
@@ -50,6 +50,7 @@ class tst_BenchlibWalltime: public QObject
private slots:
void waitForOneThousand();
void waitForFourThousand();
+ void qbenchmark_once();
};
void tst_BenchlibWalltime::waitForOneThousand()
@@ -66,6 +67,16 @@ void tst_BenchlibWalltime::waitForFourThousand()
}
}
+void tst_BenchlibWalltime::qbenchmark_once()
+{
+ int iterations = 0;
+ QBENCHMARK_ONCE {
+ ++iterations;
+ }
+ QCOMPARE(iterations, 1);
+}
+
+
QTEST_MAIN(tst_BenchlibWalltime)
#include "tst_benchlibwalltime.moc"
diff --git a/tests/auto/selftests/expected_benchlibwalltime.txt b/tests/auto/selftests/expected_benchlibwalltime.txt
index 03f246512..ec2d02040 100644
--- a/tests/auto/selftests/expected_benchlibwalltime.txt
+++ b/tests/auto/selftests/expected_benchlibwalltime.txt
@@ -7,6 +7,9 @@ PASS : tst_BenchlibWalltime::waitForOneThousand()
RESULT : tst_BenchlibWalltime::waitForFourThousand():
4,000 msec per iteration (total: 4000, iterations: 1)
PASS : tst_BenchlibWalltime::waitForFourThousand()
+RESULT : tst_BenchlibWalltime::qbenchmark_once():
+ 0 msec per iteration (total: 0, iterations: 1)
+PASS : tst_BenchlibWalltime::qbenchmark_once()
PASS : tst_BenchlibWalltime::cleanupTestCase()
-Totals: 4 passed, 0 failed, 0 skipped
+Totals: 5 passed, 0 failed, 0 skipped
********* Finished testing of tst_BenchlibWalltime *********
diff --git a/tests/auto/tests.xml b/tests/auto/tests.xml
index a5386b25a..ccfc3807f 100644
--- a/tests/auto/tests.xml
+++ b/tests/auto/tests.xml
@@ -271,6 +271,10 @@
<Test name="qsocks5socketengine" location="tests/auto/qsocks5socketengine/tst_qsocks5socketengine" />
<Test name="qsortfilterproxymodel" location="tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel" />
<Test name="qsound" location="tests/auto/qsound/tst_qsound" />
+ <Test name="qaudiodeviceid" location="tests/auto/qaudiodeviceid/tst_qaudiodeviceid" />
+ <Test name="qaudioformat" location="tests/auto/qaudioformat/tst_qaudioformat" />
+ <Test name="qaudiooutput" location="tests/auto/qaudiooutput/tst_qaudiooutput" />
+ <Test name="qaudioinput" location="tests/auto/qaudioinput/tst_qaudioinput" />
<Test name="qsourcelocation" location="tests/auto/qsourcelocation/tst_qsourcelocation" />
<Test name="qspinbox" location="tests/auto/qspinbox/tst_qspinbox" />
<Test name="qsplitter" location="tests/auto/qsplitter/tst_qsplitter" />
@@ -676,6 +680,10 @@
<Test id="qsocks5socketengine" />
<Test id="qsortfilterproxymodel" />
<Test id="qsound" />
+ <Test id="qaudiodeviceid" />
+ <Test id="qaudioformat" />
+ <Test id="qaudiooutput" />
+ <Test id="qaudioinput" />
<Test id="qsourcelocation" />
<Test id="qspinbox" />
<Test id="qsplitter" />
diff --git a/tests/auto/uic/baseline/Dialog_with_Buttons_Bottom.ui.h b/tests/auto/uic/baseline/Dialog_with_Buttons_Bottom.ui.h
index 6ce357905..166dc608f 100644
--- a/tests/auto/uic/baseline/Dialog_with_Buttons_Bottom.ui.h
+++ b/tests/auto/uic/baseline/Dialog_with_Buttons_Bottom.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'Dialog_with_Buttons_Bottom.ui'
+** Form generated from reading UI file 'Dialog_with_Buttons_Bottom.ui'
**
** Created: Thu Jul 10 09:47:34 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef DIALOG_WITH_BUTTONS_BOTTOM_H
diff --git a/tests/auto/uic/baseline/Dialog_with_Buttons_Right.ui.h b/tests/auto/uic/baseline/Dialog_with_Buttons_Right.ui.h
index a2a9078e4..cbb3cc48f 100644
--- a/tests/auto/uic/baseline/Dialog_with_Buttons_Right.ui.h
+++ b/tests/auto/uic/baseline/Dialog_with_Buttons_Right.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'Dialog_with_Buttons_Right.ui'
+** Form generated from reading UI file 'Dialog_with_Buttons_Right.ui'
**
** Created: Thu Jul 10 09:47:34 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef DIALOG_WITH_BUTTONS_RIGHT_H
diff --git a/tests/auto/uic/baseline/Dialog_without_Buttons.ui.h b/tests/auto/uic/baseline/Dialog_without_Buttons.ui.h
index d89bbef02..bb06a544f 100644
--- a/tests/auto/uic/baseline/Dialog_without_Buttons.ui.h
+++ b/tests/auto/uic/baseline/Dialog_without_Buttons.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'Dialog_without_Buttons.ui'
+** Form generated from reading UI file 'Dialog_without_Buttons.ui'
**
** Created: Thu Jul 10 09:47:34 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef DIALOG_WITHOUT_BUTTONS_H
diff --git a/tests/auto/uic/baseline/Main_Window.ui.h b/tests/auto/uic/baseline/Main_Window.ui.h
index 7404ecad4..07a8389c4 100644
--- a/tests/auto/uic/baseline/Main_Window.ui.h
+++ b/tests/auto/uic/baseline/Main_Window.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'Main_Window.ui'
+** Form generated from reading UI file 'Main_Window.ui'
**
** Created: Thu Jul 10 09:47:34 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef MAIN_WINDOW_H
diff --git a/tests/auto/uic/baseline/Widget.ui.h b/tests/auto/uic/baseline/Widget.ui.h
index a7a31989a..bba9fd9a3 100644
--- a/tests/auto/uic/baseline/Widget.ui.h
+++ b/tests/auto/uic/baseline/Widget.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'Widget.ui'
+** Form generated from reading UI file 'Widget.ui'
**
** Created: Thu Jul 10 09:47:35 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef WIDGET_H
diff --git a/tests/auto/uic/baseline/addlinkdialog.ui.h b/tests/auto/uic/baseline/addlinkdialog.ui.h
index 34caca979..920a8f7a1 100644
--- a/tests/auto/uic/baseline/addlinkdialog.ui.h
+++ b/tests/auto/uic/baseline/addlinkdialog.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'addlinkdialog.ui'
+** Form generated from reading UI file 'addlinkdialog.ui'
**
** Created: Thu Jul 10 09:47:34 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef ADDLINKDIALOG_H
diff --git a/tests/auto/uic/baseline/addtorrentform.ui.h b/tests/auto/uic/baseline/addtorrentform.ui.h
index fafcb1673..185ce2e44 100644
--- a/tests/auto/uic/baseline/addtorrentform.ui.h
+++ b/tests/auto/uic/baseline/addtorrentform.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'addtorrentform.ui'
+** Form generated from reading UI file 'addtorrentform.ui'
**
** Created: Thu Jul 10 09:47:34 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef ADDTORRENTFORM_H
diff --git a/tests/auto/uic/baseline/authenticationdialog.ui.h b/tests/auto/uic/baseline/authenticationdialog.ui.h
index 33acd9188..b46c05df5 100644
--- a/tests/auto/uic/baseline/authenticationdialog.ui.h
+++ b/tests/auto/uic/baseline/authenticationdialog.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'authenticationdialog.ui'
+** Form generated from reading UI file 'authenticationdialog.ui'
**
** Created: Thu Jul 10 09:47:34 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef AUTHENTICATIONDIALOG_H
diff --git a/tests/auto/uic/baseline/backside.ui.h b/tests/auto/uic/baseline/backside.ui.h
index 7cc5ee99c..6fdab4b79 100644
--- a/tests/auto/uic/baseline/backside.ui.h
+++ b/tests/auto/uic/baseline/backside.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'backside.ui'
+** Form generated from reading UI file 'backside.ui'
**
** Created: Tue Jun 17 09:18:47 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef BACKSIDE_H
diff --git a/tests/auto/uic/baseline/batchtranslation.ui.h b/tests/auto/uic/baseline/batchtranslation.ui.h
index 4cdad442a..2567fd9e5 100644
--- a/tests/auto/uic/baseline/batchtranslation.ui.h
+++ b/tests/auto/uic/baseline/batchtranslation.ui.h
@@ -41,12 +41,12 @@
*/
/********************************************************************************
-** Form generated from reading ui file 'batchtranslation.ui'
+** Form generated from reading UI file 'batchtranslation.ui'
**
** Created: Thu Jul 10 09:47:34 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef BATCHTRANSLATION_H
diff --git a/tests/auto/uic/baseline/bookmarkdialog.ui.h b/tests/auto/uic/baseline/bookmarkdialog.ui.h
index b5af0cfda..1db7dca19 100644
--- a/tests/auto/uic/baseline/bookmarkdialog.ui.h
+++ b/tests/auto/uic/baseline/bookmarkdialog.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'bookmarkdialog.ui'
+** Form generated from reading UI file 'bookmarkdialog.ui'
**
** Created: Mon Jun 16 18:01:55 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef BOOKMARKDIALOG_H
diff --git a/tests/auto/uic/baseline/bookwindow.ui.h b/tests/auto/uic/baseline/bookwindow.ui.h
index eae06d91e..776f9e978 100644
--- a/tests/auto/uic/baseline/bookwindow.ui.h
+++ b/tests/auto/uic/baseline/bookwindow.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'bookwindow.ui'
+** Form generated from reading UI file 'bookwindow.ui'
**
** Created: Thu Jul 10 09:47:34 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef BOOKWINDOW_H
diff --git a/tests/auto/uic/baseline/browserwidget.ui.h b/tests/auto/uic/baseline/browserwidget.ui.h
index 67f637fae..c1ca60fbe 100644
--- a/tests/auto/uic/baseline/browserwidget.ui.h
+++ b/tests/auto/uic/baseline/browserwidget.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'browserwidget.ui'
+** Form generated from reading UI file 'browserwidget.ui'
**
** Created: Mon Jun 16 18:01:09 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef BROWSERWIDGET_H
diff --git a/tests/auto/uic/baseline/calculator.ui.h b/tests/auto/uic/baseline/calculator.ui.h
index aa70aff9a..f476d9b64 100644
--- a/tests/auto/uic/baseline/calculator.ui.h
+++ b/tests/auto/uic/baseline/calculator.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'calculator.ui'
+** Form generated from reading UI file 'calculator.ui'
**
** Created: Thu Jul 10 09:47:34 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef CALCULATOR_H
diff --git a/tests/auto/uic/baseline/calculatorform.ui.h b/tests/auto/uic/baseline/calculatorform.ui.h
index 8e9e62055..1c575e88a 100644
--- a/tests/auto/uic/baseline/calculatorform.ui.h
+++ b/tests/auto/uic/baseline/calculatorform.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'calculatorform.ui'
+** Form generated from reading UI file 'calculatorform.ui'
**
** Created: Thu Jul 10 09:47:34 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef CALCULATORFORM_H
diff --git a/tests/auto/uic/baseline/certificateinfo.ui.h b/tests/auto/uic/baseline/certificateinfo.ui.h
index bbb5d5f25..548bec589 100644
--- a/tests/auto/uic/baseline/certificateinfo.ui.h
+++ b/tests/auto/uic/baseline/certificateinfo.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'certificateinfo.ui'
+** Form generated from reading UI file 'certificateinfo.ui'
**
** Created: Thu Jul 10 09:47:34 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef CERTIFICATEINFO_H
diff --git a/tests/auto/uic/baseline/chatdialog.ui.h b/tests/auto/uic/baseline/chatdialog.ui.h
index 7d1937652..c9f269356 100644
--- a/tests/auto/uic/baseline/chatdialog.ui.h
+++ b/tests/auto/uic/baseline/chatdialog.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'chatdialog.ui'
+** Form generated from reading UI file 'chatdialog.ui'
**
** Created: Thu Jul 10 09:47:34 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef CHATDIALOG_H
diff --git a/tests/auto/uic/baseline/chatmainwindow.ui.h b/tests/auto/uic/baseline/chatmainwindow.ui.h
index 93ce435bb..87ac882cd 100644
--- a/tests/auto/uic/baseline/chatmainwindow.ui.h
+++ b/tests/auto/uic/baseline/chatmainwindow.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'chatmainwindow.ui'
+** Form generated from reading UI file 'chatmainwindow.ui'
**
** Created: Mon Sep 1 09:31:02 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef CHATMAINWINDOW_H
diff --git a/tests/auto/uic/baseline/chatsetnickname.ui.h b/tests/auto/uic/baseline/chatsetnickname.ui.h
index c1fd62ba7..54f48e7de 100644
--- a/tests/auto/uic/baseline/chatsetnickname.ui.h
+++ b/tests/auto/uic/baseline/chatsetnickname.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'chatsetnickname.ui'
+** Form generated from reading UI file 'chatsetnickname.ui'
**
** Created: Thu Jul 10 09:47:34 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef CHATSETNICKNAME_H
diff --git a/tests/auto/uic/baseline/config.ui.h b/tests/auto/uic/baseline/config.ui.h
index 20de66f5f..793317899 100644
--- a/tests/auto/uic/baseline/config.ui.h
+++ b/tests/auto/uic/baseline/config.ui.h
@@ -41,12 +41,12 @@
*/
/********************************************************************************
-** Form generated from reading ui file 'config.ui'
+** Form generated from reading UI file 'config.ui'
**
** Created: Thu Jul 10 09:47:34 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef CONFIG_H
diff --git a/tests/auto/uic/baseline/connectdialog.ui.h b/tests/auto/uic/baseline/connectdialog.ui.h
index b90de5611..d7e0eaf8a 100644
--- a/tests/auto/uic/baseline/connectdialog.ui.h
+++ b/tests/auto/uic/baseline/connectdialog.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'connectdialog.ui'
+** Form generated from reading UI file 'connectdialog.ui'
**
** Created: Thu Jul 10 09:47:34 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef CONNECTDIALOG_H
diff --git a/tests/auto/uic/baseline/controller.ui.h b/tests/auto/uic/baseline/controller.ui.h
index 29985c16c..c5cd1fe5c 100644
--- a/tests/auto/uic/baseline/controller.ui.h
+++ b/tests/auto/uic/baseline/controller.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'controller.ui'
+** Form generated from reading UI file 'controller.ui'
**
** Created: Thu Jul 10 09:47:34 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef CONTROLLER_H
diff --git a/tests/auto/uic/baseline/cookies.ui.h b/tests/auto/uic/baseline/cookies.ui.h
index e4c70ec68..0b4d88a72 100644
--- a/tests/auto/uic/baseline/cookies.ui.h
+++ b/tests/auto/uic/baseline/cookies.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'cookies.ui'
+** Form generated from reading UI file 'cookies.ui'
**
** Created: Thu Jul 10 09:47:34 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef COOKIES_H
diff --git a/tests/auto/uic/baseline/cookiesexceptions.ui.h b/tests/auto/uic/baseline/cookiesexceptions.ui.h
index 5a436ebdc..12e80d889 100644
--- a/tests/auto/uic/baseline/cookiesexceptions.ui.h
+++ b/tests/auto/uic/baseline/cookiesexceptions.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'cookiesexceptions.ui'
+** Form generated from reading UI file 'cookiesexceptions.ui'
**
** Created: Thu Jul 10 09:47:34 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef COOKIESEXCEPTIONS_H
diff --git a/tests/auto/uic/baseline/default.ui.h b/tests/auto/uic/baseline/default.ui.h
index 771769484..f68a93e82 100644
--- a/tests/auto/uic/baseline/default.ui.h
+++ b/tests/auto/uic/baseline/default.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'default.ui'
+** Form generated from reading UI file 'default.ui'
**
** Created: Mon Sep 1 09:31:03 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef DEFAULT_H
diff --git a/tests/auto/uic/baseline/dialog.ui.h b/tests/auto/uic/baseline/dialog.ui.h
index 307f2fc6c..d65c10a6f 100644
--- a/tests/auto/uic/baseline/dialog.ui.h
+++ b/tests/auto/uic/baseline/dialog.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'dialog.ui'
+** Form generated from reading UI file 'dialog.ui'
**
** Created: Thu Jul 10 09:47:34 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef DIALOG_H
diff --git a/tests/auto/uic/baseline/downloaditem.ui.h b/tests/auto/uic/baseline/downloaditem.ui.h
index 7df99df81..341fdd26b 100644
--- a/tests/auto/uic/baseline/downloaditem.ui.h
+++ b/tests/auto/uic/baseline/downloaditem.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'downloaditem.ui'
+** Form generated from reading UI file 'downloaditem.ui'
**
** Created: Thu Jul 10 09:47:34 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef DOWNLOADITEM_H
diff --git a/tests/auto/uic/baseline/downloads.ui.h b/tests/auto/uic/baseline/downloads.ui.h
index b4739f6a5..70a038adc 100644
--- a/tests/auto/uic/baseline/downloads.ui.h
+++ b/tests/auto/uic/baseline/downloads.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'downloads.ui'
+** Form generated from reading UI file 'downloads.ui'
**
** Created: Thu Jul 10 09:47:34 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef DOWNLOADS_H
diff --git a/tests/auto/uic/baseline/embeddeddialog.ui.h b/tests/auto/uic/baseline/embeddeddialog.ui.h
index 7df8ab83c..3dd36a6ad 100644
--- a/tests/auto/uic/baseline/embeddeddialog.ui.h
+++ b/tests/auto/uic/baseline/embeddeddialog.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'embeddeddialog.ui'
+** Form generated from reading UI file 'embeddeddialog.ui'
**
** Created: Mon Sep 1 09:31:03 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef EMBEDDEDDIALOG_H
diff --git a/tests/auto/uic/baseline/filespage.ui.h b/tests/auto/uic/baseline/filespage.ui.h
index f94600286..15a0f5b75 100644
--- a/tests/auto/uic/baseline/filespage.ui.h
+++ b/tests/auto/uic/baseline/filespage.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'filespage.ui'
+** Form generated from reading UI file 'filespage.ui'
**
** Created: Thu Jul 10 09:47:34 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef FILESPAGE_H
diff --git a/tests/auto/uic/baseline/filternamedialog.ui.h b/tests/auto/uic/baseline/filternamedialog.ui.h
index f4306ea18..ad435c17a 100644
--- a/tests/auto/uic/baseline/filternamedialog.ui.h
+++ b/tests/auto/uic/baseline/filternamedialog.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'filternamedialog.ui'
+** Form generated from reading UI file 'filternamedialog.ui'
**
** Created: Thu Jul 10 09:47:34 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef FILTERNAMEDIALOG_H
diff --git a/tests/auto/uic/baseline/filterpage.ui.h b/tests/auto/uic/baseline/filterpage.ui.h
index ebac37596..e7fb7fbcb 100644
--- a/tests/auto/uic/baseline/filterpage.ui.h
+++ b/tests/auto/uic/baseline/filterpage.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'filterpage.ui'
+** Form generated from reading UI file 'filterpage.ui'
**
** Created: Mon Jun 16 17:58:59 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef FILTERPAGE_H
diff --git a/tests/auto/uic/baseline/finddialog.ui.h b/tests/auto/uic/baseline/finddialog.ui.h
index 091c54acc..7a3620ad6 100644
--- a/tests/auto/uic/baseline/finddialog.ui.h
+++ b/tests/auto/uic/baseline/finddialog.ui.h
@@ -41,12 +41,12 @@
*/
/********************************************************************************
-** Form generated from reading ui file 'finddialog.ui'
+** Form generated from reading UI file 'finddialog.ui'
**
** Created: Mon Sep 1 09:31:03 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef FINDDIALOG_H
diff --git a/tests/auto/uic/baseline/form.ui.h b/tests/auto/uic/baseline/form.ui.h
index 3f85b035c..60f5a144a 100644
--- a/tests/auto/uic/baseline/form.ui.h
+++ b/tests/auto/uic/baseline/form.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'form.ui'
+** Form generated from reading UI file 'form.ui'
**
** Created: Thu Jul 10 09:47:34 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef FORM_H
diff --git a/tests/auto/uic/baseline/formwindowsettings.ui.h b/tests/auto/uic/baseline/formwindowsettings.ui.h
index 9e97b48cc..2e292901d 100644
--- a/tests/auto/uic/baseline/formwindowsettings.ui.h
+++ b/tests/auto/uic/baseline/formwindowsettings.ui.h
@@ -41,12 +41,12 @@
*/
/********************************************************************************
-** Form generated from reading ui file 'formwindowsettings.ui'
+** Form generated from reading UI file 'formwindowsettings.ui'
**
** Created: Mon Sep 1 09:31:03 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef FORMWINDOWSETTINGS_H
diff --git a/tests/auto/uic/baseline/generalpage.ui.h b/tests/auto/uic/baseline/generalpage.ui.h
index 0289f5037..0dcc6ec63 100644
--- a/tests/auto/uic/baseline/generalpage.ui.h
+++ b/tests/auto/uic/baseline/generalpage.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'generalpage.ui'
+** Form generated from reading UI file 'generalpage.ui'
**
** Created: Thu Jul 10 09:47:34 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef GENERALPAGE_H
diff --git a/tests/auto/uic/baseline/gridpanel.ui.h b/tests/auto/uic/baseline/gridpanel.ui.h
index f79ffa932..1bc2f04cf 100644
--- a/tests/auto/uic/baseline/gridpanel.ui.h
+++ b/tests/auto/uic/baseline/gridpanel.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'gridpanel.ui'
+** Form generated from reading UI file 'gridpanel.ui'
**
** Created: Mon Sep 1 09:31:03 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef GRIDPANEL_H
diff --git a/tests/auto/uic/baseline/helpdialog.ui.h b/tests/auto/uic/baseline/helpdialog.ui.h
index 608dba3a9..b003e7d48 100644
--- a/tests/auto/uic/baseline/helpdialog.ui.h
+++ b/tests/auto/uic/baseline/helpdialog.ui.h
@@ -41,12 +41,12 @@
*/
/********************************************************************************
-** Form generated from reading ui file 'helpdialog.ui'
+** Form generated from reading UI file 'helpdialog.ui'
**
** Created: Mon Sep 1 09:31:03 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef HELPDIALOG_H
diff --git a/tests/auto/uic/baseline/history.ui.h b/tests/auto/uic/baseline/history.ui.h
index 4b84e6841..16553df2c 100644
--- a/tests/auto/uic/baseline/history.ui.h
+++ b/tests/auto/uic/baseline/history.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'history.ui'
+** Form generated from reading UI file 'history.ui'
**
** Created: Thu Jul 10 09:47:34 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef HISTORY_H
diff --git a/tests/auto/uic/baseline/identifierpage.ui.h b/tests/auto/uic/baseline/identifierpage.ui.h
index 78396003e..24aecf8f5 100644
--- a/tests/auto/uic/baseline/identifierpage.ui.h
+++ b/tests/auto/uic/baseline/identifierpage.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'identifierpage.ui'
+** Form generated from reading UI file 'identifierpage.ui'
**
** Created: Thu Jul 10 09:47:34 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef IDENTIFIERPAGE_H
diff --git a/tests/auto/uic/baseline/imagedialog.ui.h b/tests/auto/uic/baseline/imagedialog.ui.h
index 001532e96..2f51b659a 100644
--- a/tests/auto/uic/baseline/imagedialog.ui.h
+++ b/tests/auto/uic/baseline/imagedialog.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'imagedialog.ui'
+** Form generated from reading UI file 'imagedialog.ui'
**
** Created: Thu Jul 10 09:47:34 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef IMAGEDIALOG_H
diff --git a/tests/auto/uic/baseline/inputpage.ui.h b/tests/auto/uic/baseline/inputpage.ui.h
index 917f91b55..23f2a0ba7 100644
--- a/tests/auto/uic/baseline/inputpage.ui.h
+++ b/tests/auto/uic/baseline/inputpage.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'inputpage.ui'
+** Form generated from reading UI file 'inputpage.ui'
**
** Created: Thu Jul 10 09:47:34 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef INPUTPAGE_H
diff --git a/tests/auto/uic/baseline/installdialog.ui.h b/tests/auto/uic/baseline/installdialog.ui.h
index d61377d26..e6180f7e3 100644
--- a/tests/auto/uic/baseline/installdialog.ui.h
+++ b/tests/auto/uic/baseline/installdialog.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'installdialog.ui'
+** Form generated from reading UI file 'installdialog.ui'
**
** Created: Thu Jul 10 09:47:34 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef INSTALLDIALOG_H
diff --git a/tests/auto/uic/baseline/languagesdialog.ui.h b/tests/auto/uic/baseline/languagesdialog.ui.h
index fbe57ca0f..ff837c1e7 100644
--- a/tests/auto/uic/baseline/languagesdialog.ui.h
+++ b/tests/auto/uic/baseline/languagesdialog.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'languagesdialog.ui'
+** Form generated from reading UI file 'languagesdialog.ui'
**
** Created: Fri May 15 16:58:03 2009
** by: Qt User Interface Compiler version 4.5.2
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef LANGUAGESDIALOG_H
diff --git a/tests/auto/uic/baseline/listwidgeteditor.ui.h b/tests/auto/uic/baseline/listwidgeteditor.ui.h
index 127228cb9..50adea047 100644
--- a/tests/auto/uic/baseline/listwidgeteditor.ui.h
+++ b/tests/auto/uic/baseline/listwidgeteditor.ui.h
@@ -41,12 +41,12 @@
*/
/********************************************************************************
-** Form generated from reading ui file 'listwidgeteditor.ui'
+** Form generated from reading UI file 'listwidgeteditor.ui'
**
** Created: Mon Jun 16 17:54:30 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef LISTWIDGETEDITOR_H
diff --git a/tests/auto/uic/baseline/mainwindow.ui.h b/tests/auto/uic/baseline/mainwindow.ui.h
index 73a9de20b..11b019641 100644
--- a/tests/auto/uic/baseline/mainwindow.ui.h
+++ b/tests/auto/uic/baseline/mainwindow.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'mainwindow.ui'
+** Form generated from reading UI file 'mainwindow.ui'
**
** Created: Thu Jul 10 09:47:35 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef MAINWINDOW_H
diff --git a/tests/auto/uic/baseline/mainwindowbase.ui.h b/tests/auto/uic/baseline/mainwindowbase.ui.h
index 4a49f9545..aef2f3a16 100644
--- a/tests/auto/uic/baseline/mainwindowbase.ui.h
+++ b/tests/auto/uic/baseline/mainwindowbase.ui.h
@@ -41,12 +41,12 @@
*/
/********************************************************************************
-** Form generated from reading ui file 'mainwindowbase.ui'
+** Form generated from reading UI file 'mainwindowbase.ui'
**
** Created: Mon Sep 1 09:31:03 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef MAINWINDOWBASE_H
diff --git a/tests/auto/uic/baseline/mydialog.ui.h b/tests/auto/uic/baseline/mydialog.ui.h
index 17cf6c561..ac7b45873 100644
--- a/tests/auto/uic/baseline/mydialog.ui.h
+++ b/tests/auto/uic/baseline/mydialog.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'mydialog.ui'
+** Form generated from reading UI file 'mydialog.ui'
**
** Created: Thu Jul 10 09:47:35 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef MYDIALOG_H
diff --git a/tests/auto/uic/baseline/myform.ui.h b/tests/auto/uic/baseline/myform.ui.h
index 07e16635a..74c83f5af 100644
--- a/tests/auto/uic/baseline/myform.ui.h
+++ b/tests/auto/uic/baseline/myform.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'myform.ui'
+** Form generated from reading UI file 'myform.ui'
**
** Created: Thu Jul 10 09:47:35 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef MYFORM_H
diff --git a/tests/auto/uic/baseline/newactiondialog.ui.h b/tests/auto/uic/baseline/newactiondialog.ui.h
index 69f13fd4e..9c78f7b1b 100644
--- a/tests/auto/uic/baseline/newactiondialog.ui.h
+++ b/tests/auto/uic/baseline/newactiondialog.ui.h
@@ -41,12 +41,12 @@
*/
/********************************************************************************
-** Form generated from reading ui file 'newactiondialog.ui'
+** Form generated from reading UI file 'newactiondialog.ui'
**
** Created: Mon Sep 1 09:31:03 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef NEWACTIONDIALOG_H
diff --git a/tests/auto/uic/baseline/newdynamicpropertydialog.ui.h b/tests/auto/uic/baseline/newdynamicpropertydialog.ui.h
index 69f1ed565..f8e5b5196 100644
--- a/tests/auto/uic/baseline/newdynamicpropertydialog.ui.h
+++ b/tests/auto/uic/baseline/newdynamicpropertydialog.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'newdynamicpropertydialog.ui'
+** Form generated from reading UI file 'newdynamicpropertydialog.ui'
**
** Created: Thu Jul 10 09:47:35 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef NEWDYNAMICPROPERTYDIALOG_H
diff --git a/tests/auto/uic/baseline/newform.ui.h b/tests/auto/uic/baseline/newform.ui.h
index 37eb709f6..a011e9bf2 100644
--- a/tests/auto/uic/baseline/newform.ui.h
+++ b/tests/auto/uic/baseline/newform.ui.h
@@ -41,12 +41,12 @@
*/
/********************************************************************************
-** Form generated from reading ui file 'newform.ui'
+** Form generated from reading UI file 'newform.ui'
**
** Created: Mon Jun 16 17:56:52 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef NEWFORM_H
diff --git a/tests/auto/uic/baseline/orderdialog.ui.h b/tests/auto/uic/baseline/orderdialog.ui.h
index 74604750c..304a3df5f 100644
--- a/tests/auto/uic/baseline/orderdialog.ui.h
+++ b/tests/auto/uic/baseline/orderdialog.ui.h
@@ -41,12 +41,12 @@
*/
/********************************************************************************
-** Form generated from reading ui file 'orderdialog.ui'
+** Form generated from reading UI file 'orderdialog.ui'
**
** Created: Mon Jun 16 17:55:54 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef ORDERDIALOG_H
diff --git a/tests/auto/uic/baseline/outputpage.ui.h b/tests/auto/uic/baseline/outputpage.ui.h
index 8199c5778..0b68cb96f 100644
--- a/tests/auto/uic/baseline/outputpage.ui.h
+++ b/tests/auto/uic/baseline/outputpage.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'outputpage.ui'
+** Form generated from reading UI file 'outputpage.ui'
**
** Created: Thu Jul 10 09:47:35 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef OUTPUTPAGE_H
diff --git a/tests/auto/uic/baseline/pagefold.ui.h b/tests/auto/uic/baseline/pagefold.ui.h
index 9c2a4531e..5cc583603 100644
--- a/tests/auto/uic/baseline/pagefold.ui.h
+++ b/tests/auto/uic/baseline/pagefold.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'pagefold.ui'
+** Form generated from reading UI file 'pagefold.ui'
**
** Created: Mon Sep 1 09:31:03 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef PAGEFOLD_H
diff --git a/tests/auto/uic/baseline/paletteeditor.ui.h b/tests/auto/uic/baseline/paletteeditor.ui.h
index 0dcefb35e..9ef392077 100644
--- a/tests/auto/uic/baseline/paletteeditor.ui.h
+++ b/tests/auto/uic/baseline/paletteeditor.ui.h
@@ -41,12 +41,12 @@
*/
/********************************************************************************
-** Form generated from reading ui file 'paletteeditor.ui'
+** Form generated from reading UI file 'paletteeditor.ui'
**
** Created: Thu Jul 10 09:47:35 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef PALETTEEDITOR_H
diff --git a/tests/auto/uic/baseline/paletteeditoradvancedbase.ui.h b/tests/auto/uic/baseline/paletteeditoradvancedbase.ui.h
index bb2a9595f..419bc0f31 100644
--- a/tests/auto/uic/baseline/paletteeditoradvancedbase.ui.h
+++ b/tests/auto/uic/baseline/paletteeditoradvancedbase.ui.h
@@ -41,12 +41,12 @@
*/
/********************************************************************************
-** Form generated from reading ui file 'paletteeditoradvancedbase.ui'
+** Form generated from reading UI file 'paletteeditoradvancedbase.ui'
**
** Created: Mon Sep 1 09:31:03 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef PALETTEEDITORADVANCEDBASE_H
diff --git a/tests/auto/uic/baseline/passworddialog.ui.h b/tests/auto/uic/baseline/passworddialog.ui.h
index 267b5f2b9..be8029883 100644
--- a/tests/auto/uic/baseline/passworddialog.ui.h
+++ b/tests/auto/uic/baseline/passworddialog.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'passworddialog.ui'
+** Form generated from reading UI file 'passworddialog.ui'
**
** Created: Thu Jul 10 09:47:35 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef PASSWORDDIALOG_H
diff --git a/tests/auto/uic/baseline/pathpage.ui.h b/tests/auto/uic/baseline/pathpage.ui.h
index 528fed8c3..257c19111 100644
--- a/tests/auto/uic/baseline/pathpage.ui.h
+++ b/tests/auto/uic/baseline/pathpage.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'pathpage.ui'
+** Form generated from reading UI file 'pathpage.ui'
**
** Created: Thu Jul 10 09:47:35 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef PATHPAGE_H
diff --git a/tests/auto/uic/baseline/phrasebookbox.ui.h b/tests/auto/uic/baseline/phrasebookbox.ui.h
index f4abb1bab..8c5346322 100644
--- a/tests/auto/uic/baseline/phrasebookbox.ui.h
+++ b/tests/auto/uic/baseline/phrasebookbox.ui.h
@@ -41,12 +41,12 @@
*/
/********************************************************************************
-** Form generated from reading ui file 'phrasebookbox.ui'
+** Form generated from reading UI file 'phrasebookbox.ui'
**
** Created: Mon Sep 1 09:31:03 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef PHRASEBOOKBOX_H
diff --git a/tests/auto/uic/baseline/plugindialog.ui.h b/tests/auto/uic/baseline/plugindialog.ui.h
index bb51f4a75..961155b61 100644
--- a/tests/auto/uic/baseline/plugindialog.ui.h
+++ b/tests/auto/uic/baseline/plugindialog.ui.h
@@ -41,12 +41,12 @@
*/
/********************************************************************************
-** Form generated from reading ui file 'plugindialog.ui'
+** Form generated from reading UI file 'plugindialog.ui'
**
** Created: Mon Jun 16 17:52:32 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef PLUGINDIALOG_H
diff --git a/tests/auto/uic/baseline/preferencesdialog.ui.h b/tests/auto/uic/baseline/preferencesdialog.ui.h
index 5412fe115..a1f5ac2be 100644
--- a/tests/auto/uic/baseline/preferencesdialog.ui.h
+++ b/tests/auto/uic/baseline/preferencesdialog.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'preferencesdialog.ui'
+** Form generated from reading UI file 'preferencesdialog.ui'
**
** Created: Thu Jul 10 09:47:35 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef PREFERENCESDIALOG_H
diff --git a/tests/auto/uic/baseline/previewconfigurationwidget.ui.h b/tests/auto/uic/baseline/previewconfigurationwidget.ui.h
index 6d5247d42..4a7b69461 100644
--- a/tests/auto/uic/baseline/previewconfigurationwidget.ui.h
+++ b/tests/auto/uic/baseline/previewconfigurationwidget.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'previewconfigurationwidget.ui'
+** Form generated from reading UI file 'previewconfigurationwidget.ui'
**
** Created: Thu Jul 10 09:47:35 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef PREVIEWCONFIGURATIONWIDGET_H
diff --git a/tests/auto/uic/baseline/previewdialogbase.ui.h b/tests/auto/uic/baseline/previewdialogbase.ui.h
index 93bfb69dc..822990cd6 100644
--- a/tests/auto/uic/baseline/previewdialogbase.ui.h
+++ b/tests/auto/uic/baseline/previewdialogbase.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'previewdialogbase.ui'
+** Form generated from reading UI file 'previewdialogbase.ui'
**
** Created: Mon Sep 1 09:31:03 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef PREVIEWDIALOGBASE_H
diff --git a/tests/auto/uic/baseline/previewwidget.ui.h b/tests/auto/uic/baseline/previewwidget.ui.h
index b76aa5642..d8a596e94 100644
--- a/tests/auto/uic/baseline/previewwidget.ui.h
+++ b/tests/auto/uic/baseline/previewwidget.ui.h
@@ -41,12 +41,12 @@
*/
/********************************************************************************
-** Form generated from reading ui file 'previewwidget.ui'
+** Form generated from reading UI file 'previewwidget.ui'
**
** Created: Thu Jul 10 09:47:35 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef PREVIEWWIDGET_H
diff --git a/tests/auto/uic/baseline/previewwidgetbase.ui.h b/tests/auto/uic/baseline/previewwidgetbase.ui.h
index 82899b709..e131cd53a 100644
--- a/tests/auto/uic/baseline/previewwidgetbase.ui.h
+++ b/tests/auto/uic/baseline/previewwidgetbase.ui.h
@@ -41,12 +41,12 @@
*/
/********************************************************************************
-** Form generated from reading ui file 'previewwidgetbase.ui'
+** Form generated from reading UI file 'previewwidgetbase.ui'
**
** Created: Thu Jul 10 09:47:35 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef PREVIEWWIDGETBASE_H
diff --git a/tests/auto/uic/baseline/proxy.ui.h b/tests/auto/uic/baseline/proxy.ui.h
index 2ec63fa5d..d22edefef 100644
--- a/tests/auto/uic/baseline/proxy.ui.h
+++ b/tests/auto/uic/baseline/proxy.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'proxy.ui'
+** Form generated from reading UI file 'proxy.ui'
**
** Created: Thu Jul 10 09:47:35 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef PROXY_H
diff --git a/tests/auto/uic/baseline/qfiledialog.ui.h b/tests/auto/uic/baseline/qfiledialog.ui.h
index 3b3a62628..ea5814f29 100644
--- a/tests/auto/uic/baseline/qfiledialog.ui.h
+++ b/tests/auto/uic/baseline/qfiledialog.ui.h
@@ -41,12 +41,12 @@
*/
/********************************************************************************
-** Form generated from reading ui file 'qfiledialog.ui'
+** Form generated from reading UI file 'qfiledialog.ui'
**
** Created: Mon Jun 16 17:51:48 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef QFILEDIALOG_H
diff --git a/tests/auto/uic/baseline/qpagesetupwidget.ui.h b/tests/auto/uic/baseline/qpagesetupwidget.ui.h
index f2a68bd13..4694409ab 100644
--- a/tests/auto/uic/baseline/qpagesetupwidget.ui.h
+++ b/tests/auto/uic/baseline/qpagesetupwidget.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'qpagesetupwidget.ui'
+** Form generated from reading UI file 'qpagesetupwidget.ui'
**
** Created: Mon Sep 1 09:31:03 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef QPAGESETUPWIDGET_H
diff --git a/tests/auto/uic/baseline/qprintpropertieswidget.ui.h b/tests/auto/uic/baseline/qprintpropertieswidget.ui.h
index 16148ef79..626fee7b7 100644
--- a/tests/auto/uic/baseline/qprintpropertieswidget.ui.h
+++ b/tests/auto/uic/baseline/qprintpropertieswidget.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'qprintpropertieswidget.ui'
+** Form generated from reading UI file 'qprintpropertieswidget.ui'
**
** Created: Thu Jul 10 09:47:35 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef QPRINTPROPERTIESWIDGET_H
diff --git a/tests/auto/uic/baseline/qprintsettingsoutput.ui.h b/tests/auto/uic/baseline/qprintsettingsoutput.ui.h
index 307582a7b..a6360eefe 100644
--- a/tests/auto/uic/baseline/qprintsettingsoutput.ui.h
+++ b/tests/auto/uic/baseline/qprintsettingsoutput.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'qprintsettingsoutput.ui'
+** Form generated from reading UI file 'qprintsettingsoutput.ui'
**
** Created: Mon Sep 1 09:31:03 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef QPRINTSETTINGSOUTPUT_H
diff --git a/tests/auto/uic/baseline/qprintwidget.ui.h b/tests/auto/uic/baseline/qprintwidget.ui.h
index 7fa0b4f1a..99d6486e7 100644
--- a/tests/auto/uic/baseline/qprintwidget.ui.h
+++ b/tests/auto/uic/baseline/qprintwidget.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'qprintwidget.ui'
+** Form generated from reading UI file 'qprintwidget.ui'
**
** Created: Mon Sep 1 09:31:03 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef QPRINTWIDGET_H
diff --git a/tests/auto/uic/baseline/qsqlconnectiondialog.ui.h b/tests/auto/uic/baseline/qsqlconnectiondialog.ui.h
index 846f34dff..165c7d717 100644
--- a/tests/auto/uic/baseline/qsqlconnectiondialog.ui.h
+++ b/tests/auto/uic/baseline/qsqlconnectiondialog.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'qsqlconnectiondialog.ui'
+** Form generated from reading UI file 'qsqlconnectiondialog.ui'
**
** Created: Mon Sep 1 09:31:03 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef QSQLCONNECTIONDIALOG_H
diff --git a/tests/auto/uic/baseline/qtgradientdialog.ui.h b/tests/auto/uic/baseline/qtgradientdialog.ui.h
index 8a5d18c0d..0f2f58150 100644
--- a/tests/auto/uic/baseline/qtgradientdialog.ui.h
+++ b/tests/auto/uic/baseline/qtgradientdialog.ui.h
@@ -41,12 +41,12 @@
*/
/********************************************************************************
-** Form generated from reading ui file 'qtgradientdialog.ui'
+** Form generated from reading UI file 'qtgradientdialog.ui'
**
** Created: Thu Jul 10 09:47:35 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef QTGRADIENTDIALOG_H
diff --git a/tests/auto/uic/baseline/qtgradienteditor.ui.h b/tests/auto/uic/baseline/qtgradienteditor.ui.h
index 5eab3a892..446855233 100644
--- a/tests/auto/uic/baseline/qtgradienteditor.ui.h
+++ b/tests/auto/uic/baseline/qtgradienteditor.ui.h
@@ -41,12 +41,12 @@
*/
/********************************************************************************
-** Form generated from reading ui file 'qtgradienteditor.ui'
+** Form generated from reading UI file 'qtgradienteditor.ui'
**
** Created: Mon Jun 16 17:50:21 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef QTGRADIENTEDITOR_H
diff --git a/tests/auto/uic/baseline/qtgradientview.ui.h b/tests/auto/uic/baseline/qtgradientview.ui.h
index 6be5ed5e2..809cf5bdf 100644
--- a/tests/auto/uic/baseline/qtgradientview.ui.h
+++ b/tests/auto/uic/baseline/qtgradientview.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'qtgradientview.ui'
+** Form generated from reading UI file 'qtgradientview.ui'
**
** Created: Thu Jul 10 09:47:35 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef QTGRADIENTVIEW_H
diff --git a/tests/auto/uic/baseline/qtgradientviewdialog.ui.h b/tests/auto/uic/baseline/qtgradientviewdialog.ui.h
index 883630142..fd57bc673 100644
--- a/tests/auto/uic/baseline/qtgradientviewdialog.ui.h
+++ b/tests/auto/uic/baseline/qtgradientviewdialog.ui.h
@@ -41,12 +41,12 @@
*/
/********************************************************************************
-** Form generated from reading ui file 'qtgradientviewdialog.ui'
+** Form generated from reading UI file 'qtgradientviewdialog.ui'
**
** Created: Thu Jul 10 09:47:35 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef QTGRADIENTVIEWDIALOG_H
diff --git a/tests/auto/uic/baseline/qtresourceeditordialog.ui.h b/tests/auto/uic/baseline/qtresourceeditordialog.ui.h
index 03e7362db..a08a16ce0 100644
--- a/tests/auto/uic/baseline/qtresourceeditordialog.ui.h
+++ b/tests/auto/uic/baseline/qtresourceeditordialog.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'qtresourceeditordialog.ui'
+** Form generated from reading UI file 'qtresourceeditordialog.ui'
**
** Created: Mon Jun 16 17:45:38 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef QTRESOURCEEDITORDIALOG_H
diff --git a/tests/auto/uic/baseline/qttoolbardialog.ui.h b/tests/auto/uic/baseline/qttoolbardialog.ui.h
index 7225edaee..9099553a1 100644
--- a/tests/auto/uic/baseline/qttoolbardialog.ui.h
+++ b/tests/auto/uic/baseline/qttoolbardialog.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'qttoolbardialog.ui'
+** Form generated from reading UI file 'qttoolbardialog.ui'
**
** Created: Mon Jun 16 17:42:37 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef QTTOOLBARDIALOG_H
diff --git a/tests/auto/uic/baseline/querywidget.ui.h b/tests/auto/uic/baseline/querywidget.ui.h
index 769732838..8afcf5411 100644
--- a/tests/auto/uic/baseline/querywidget.ui.h
+++ b/tests/auto/uic/baseline/querywidget.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'querywidget.ui'
+** Form generated from reading UI file 'querywidget.ui'
**
** Created: Thu Jul 10 09:47:35 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef QUERYWIDGET_H
diff --git a/tests/auto/uic/baseline/remotecontrol.ui.h b/tests/auto/uic/baseline/remotecontrol.ui.h
index 854a9941d..3d183f731 100644
--- a/tests/auto/uic/baseline/remotecontrol.ui.h
+++ b/tests/auto/uic/baseline/remotecontrol.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'remotecontrol.ui'
+** Form generated from reading UI file 'remotecontrol.ui'
**
** Created: Thu Jul 10 09:47:35 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef REMOTECONTROL_H
diff --git a/tests/auto/uic/baseline/saveformastemplate.ui.h b/tests/auto/uic/baseline/saveformastemplate.ui.h
index 1bad01e6c..483239ddd 100644
--- a/tests/auto/uic/baseline/saveformastemplate.ui.h
+++ b/tests/auto/uic/baseline/saveformastemplate.ui.h
@@ -41,12 +41,12 @@
*/
/********************************************************************************
-** Form generated from reading ui file 'saveformastemplate.ui'
+** Form generated from reading UI file 'saveformastemplate.ui'
**
** Created: Mon Sep 1 09:31:03 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef SAVEFORMASTEMPLATE_H
diff --git a/tests/auto/uic/baseline/settings.ui.h b/tests/auto/uic/baseline/settings.ui.h
index 8fb0ef267..98cb6eeaf 100644
--- a/tests/auto/uic/baseline/settings.ui.h
+++ b/tests/auto/uic/baseline/settings.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'settings.ui'
+** Form generated from reading UI file 'settings.ui'
**
** Created: Thu Jul 10 09:47:35 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef SETTINGS_H
diff --git a/tests/auto/uic/baseline/signalslotdialog.ui.h b/tests/auto/uic/baseline/signalslotdialog.ui.h
index 6adcf21e5..f3ce8bc49 100644
--- a/tests/auto/uic/baseline/signalslotdialog.ui.h
+++ b/tests/auto/uic/baseline/signalslotdialog.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'signalslotdialog.ui'
+** Form generated from reading UI file 'signalslotdialog.ui'
**
** Created: Mon Jun 16 16:18:52 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef SIGNALSLOTDIALOG_H
diff --git a/tests/auto/uic/baseline/sslclient.ui.h b/tests/auto/uic/baseline/sslclient.ui.h
index 1ca1c3f9d..aee02241d 100644
--- a/tests/auto/uic/baseline/sslclient.ui.h
+++ b/tests/auto/uic/baseline/sslclient.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'sslclient.ui'
+** Form generated from reading UI file 'sslclient.ui'
**
** Created: Thu Jul 10 09:47:35 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef SSLCLIENT_H
diff --git a/tests/auto/uic/baseline/sslerrors.ui.h b/tests/auto/uic/baseline/sslerrors.ui.h
index a1a46a192..f999be05b 100644
--- a/tests/auto/uic/baseline/sslerrors.ui.h
+++ b/tests/auto/uic/baseline/sslerrors.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'sslerrors.ui'
+** Form generated from reading UI file 'sslerrors.ui'
**
** Created: Thu Jul 10 09:47:35 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef SSLERRORS_H
diff --git a/tests/auto/uic/baseline/statistics.ui.h b/tests/auto/uic/baseline/statistics.ui.h
index b8257c476..713c1c27c 100644
--- a/tests/auto/uic/baseline/statistics.ui.h
+++ b/tests/auto/uic/baseline/statistics.ui.h
@@ -41,12 +41,12 @@
*/
/********************************************************************************
-** Form generated from reading ui file 'statistics.ui'
+** Form generated from reading UI file 'statistics.ui'
**
** Created: Thu Jul 10 09:47:35 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef STATISTICS_H
diff --git a/tests/auto/uic/baseline/stringlisteditor.ui.h b/tests/auto/uic/baseline/stringlisteditor.ui.h
index e6daa520c..23655d923 100644
--- a/tests/auto/uic/baseline/stringlisteditor.ui.h
+++ b/tests/auto/uic/baseline/stringlisteditor.ui.h
@@ -41,12 +41,12 @@
*/
/********************************************************************************
-** Form generated from reading ui file 'stringlisteditor.ui'
+** Form generated from reading UI file 'stringlisteditor.ui'
**
** Created: Mon Sep 1 09:31:03 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef STRINGLISTEDITOR_H
diff --git a/tests/auto/uic/baseline/stylesheeteditor.ui.h b/tests/auto/uic/baseline/stylesheeteditor.ui.h
index 7633d5b51..a99f2744b 100644
--- a/tests/auto/uic/baseline/stylesheeteditor.ui.h
+++ b/tests/auto/uic/baseline/stylesheeteditor.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'stylesheeteditor.ui'
+** Form generated from reading UI file 'stylesheeteditor.ui'
**
** Created: Thu Jul 10 09:47:35 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef STYLESHEETEDITOR_H
diff --git a/tests/auto/uic/baseline/tabbedbrowser.ui.h b/tests/auto/uic/baseline/tabbedbrowser.ui.h
index 1106f13d7..c234f645a 100644
--- a/tests/auto/uic/baseline/tabbedbrowser.ui.h
+++ b/tests/auto/uic/baseline/tabbedbrowser.ui.h
@@ -41,12 +41,12 @@
*/
/********************************************************************************
-** Form generated from reading ui file 'tabbedbrowser.ui'
+** Form generated from reading UI file 'tabbedbrowser.ui'
**
** Created: Thu Jul 10 09:47:35 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef TABBEDBROWSER_H
diff --git a/tests/auto/uic/baseline/tablewidgeteditor.ui.h b/tests/auto/uic/baseline/tablewidgeteditor.ui.h
index 4769c423b..38fb8322f 100644
--- a/tests/auto/uic/baseline/tablewidgeteditor.ui.h
+++ b/tests/auto/uic/baseline/tablewidgeteditor.ui.h
@@ -41,12 +41,12 @@
*/
/********************************************************************************
-** Form generated from reading ui file 'tablewidgeteditor.ui'
+** Form generated from reading UI file 'tablewidgeteditor.ui'
**
** Created: Mon Jun 16 17:48:45 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef TABLEWIDGETEDITOR_H
diff --git a/tests/auto/uic/baseline/tetrixwindow.ui.h b/tests/auto/uic/baseline/tetrixwindow.ui.h
index a84854518..50ed416e0 100644
--- a/tests/auto/uic/baseline/tetrixwindow.ui.h
+++ b/tests/auto/uic/baseline/tetrixwindow.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'tetrixwindow.ui'
+** Form generated from reading UI file 'tetrixwindow.ui'
**
** Created: Thu Jul 10 09:47:35 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef TETRIXWINDOW_H
diff --git a/tests/auto/uic/baseline/textfinder.ui.h b/tests/auto/uic/baseline/textfinder.ui.h
index f1d51f990..546ff1784 100644
--- a/tests/auto/uic/baseline/textfinder.ui.h
+++ b/tests/auto/uic/baseline/textfinder.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'textfinder.ui'
+** Form generated from reading UI file 'textfinder.ui'
**
** Created: Mon Sep 1 09:31:03 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef TEXTFINDER_H
diff --git a/tests/auto/uic/baseline/topicchooser.ui.h b/tests/auto/uic/baseline/topicchooser.ui.h
index 8404d0ccb..65cf2051a 100644
--- a/tests/auto/uic/baseline/topicchooser.ui.h
+++ b/tests/auto/uic/baseline/topicchooser.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'topicchooser.ui'
+** Form generated from reading UI file 'topicchooser.ui'
**
** Created: Mon Sep 1 09:31:03 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef TOPICCHOOSER_H
diff --git a/tests/auto/uic/baseline/translatedialog.ui.h b/tests/auto/uic/baseline/translatedialog.ui.h
index b0df4b5f4..a85f5ed33 100644
--- a/tests/auto/uic/baseline/translatedialog.ui.h
+++ b/tests/auto/uic/baseline/translatedialog.ui.h
@@ -41,12 +41,12 @@
*/
/********************************************************************************
-** Form generated from reading ui file 'translatedialog.ui'
+** Form generated from reading UI file 'translatedialog.ui'
**
** Created: Mon Sep 1 09:31:03 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef TRANSLATEDIALOG_H
diff --git a/tests/auto/uic/baseline/translationsettings.ui.h b/tests/auto/uic/baseline/translationsettings.ui.h
index 7ce0485b5..e36545e1a 100644
--- a/tests/auto/uic/baseline/translationsettings.ui.h
+++ b/tests/auto/uic/baseline/translationsettings.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'translationsettings.ui'
+** Form generated from reading UI file 'translationsettings.ui'
**
** Created: Mon Sep 1 09:31:03 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef TRANSLATIONSETTINGS_H
diff --git a/tests/auto/uic/baseline/treewidgeteditor.ui.h b/tests/auto/uic/baseline/treewidgeteditor.ui.h
index eb4875d77..2fe6344f5 100644
--- a/tests/auto/uic/baseline/treewidgeteditor.ui.h
+++ b/tests/auto/uic/baseline/treewidgeteditor.ui.h
@@ -41,12 +41,12 @@
*/
/********************************************************************************
-** Form generated from reading ui file 'treewidgeteditor.ui'
+** Form generated from reading UI file 'treewidgeteditor.ui'
**
** Created: Mon Jun 16 17:47:26 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef TREEWIDGETEDITOR_H
diff --git a/tests/auto/uic/baseline/trpreviewtool.ui.h b/tests/auto/uic/baseline/trpreviewtool.ui.h
index 2575cda43..5f925832d 100644
--- a/tests/auto/uic/baseline/trpreviewtool.ui.h
+++ b/tests/auto/uic/baseline/trpreviewtool.ui.h
@@ -41,12 +41,12 @@
*/
/********************************************************************************
-** Form generated from reading ui file 'trpreviewtool.ui'
+** Form generated from reading UI file 'trpreviewtool.ui'
**
** Created: Thu Jul 10 09:47:35 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef TRPREVIEWTOOL_H
diff --git a/tests/auto/uic/baseline/validators.ui.h b/tests/auto/uic/baseline/validators.ui.h
index 03bc89837..07e114a41 100644
--- a/tests/auto/uic/baseline/validators.ui.h
+++ b/tests/auto/uic/baseline/validators.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'validators.ui'
+** Form generated from reading UI file 'validators.ui'
**
** Created: Thu Jul 10 09:47:35 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef VALIDATORS_H
diff --git a/tests/auto/uic/baseline/wateringconfigdialog.ui.h b/tests/auto/uic/baseline/wateringconfigdialog.ui.h
index 02de59ba5..43120a57b 100644
--- a/tests/auto/uic/baseline/wateringconfigdialog.ui.h
+++ b/tests/auto/uic/baseline/wateringconfigdialog.ui.h
@@ -1,10 +1,10 @@
/********************************************************************************
-** Form generated from reading ui file 'wateringconfigdialog.ui'
+** Form generated from reading UI file 'wateringconfigdialog.ui'
**
** Created: Thu Jul 10 09:47:35 2008
** by: Qt User Interface Compiler version 4.5.0
**
-** WARNING! All changes made in this file will be lost when recompiling ui file!
+** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef WATERINGCONFIGDIALOG_H
diff --git a/tests/auto/uiloader/baseline/css_task259226_spinboxes.ui b/tests/auto/uiloader/baseline/css_task259226_spinboxes.ui
new file mode 100644
index 000000000..eb9ade316
--- /dev/null
+++ b/tests/auto/uiloader/baseline/css_task259226_spinboxes.ui
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Form</class>
+ <widget class="QWidget" name="Form">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>320</width>
+ <height>116</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">#spinbox1::up-button{
+ subcontrol-origin: border;
+ subcontrol-position: top left;
+ }
+#spinbox1::down-button {
+ subcontrol-origin: border;
+ subcontrol-position: bottom left;
+ }
+
+
+#spinbox2::up-button{
+ subcontrol-origin: border;
+ subcontrol-position: center left;
+ left: 0px;
+ height: 100%;
+ top: 0px;
+ }
+#spinbox2::down-button {
+ subcontrol-origin: border;
+ subcontrol-position: center right;
+ right: 0px;
+ height: 100%;
+ top: 0px;
+ }
+
+
+
+#spinbox3::up-button{
+ subcontrol-origin: border;
+ subcontrol-position: top left;
+ }
+
+
+#spinbox4 { padding: 20px 1px; }
+#spinbox4::up-button{
+ subcontrol-origin: border;
+ subcontrol-position: top center;
+ width:100%;
+ height: 20px;
+ }
+#spinbox4::down-button {
+ subcontrol-origin: border;
+ subcontrol-position: bottom center;
+ width:100%;
+ height: 20px;
+ }
+
+</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QSpinBox" name="spinbox1"/>
+ </item>
+ <item row="0" column="1">
+ <widget class="QSpinBox" name="spinbox2"/>
+ </item>
+ <item row="1" column="0">
+ <widget class="QSpinBox" name="spinbox3"/>
+ </item>
+ <item row="1" column="1">
+ <widget class="QSpinBox" name="spinbox4"/>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/tests/auto/windowsmobile/test/test.pro b/tests/auto/windowsmobile/test/test.pro
index 2420bf173..b7f65a98e 100644
--- a/tests/auto/windowsmobile/test/test.pro
+++ b/tests/auto/windowsmobile/test/test.pro
@@ -8,8 +8,7 @@ RESOURCES += windowsmobile.qrc
TARGET = tst_windowsmobile
wincewm*: {
- addFiles.sources = \
- ../testQMenuBar/*.exe
+ addFiles.sources = $$OUT_PWD/../testQMenuBar/*.exe
addFiles.path = "\Program Files\tst_windowsmobile"
diff --git a/tests/auto/xmlpatterns/tst_xmlpatterns.cpp b/tests/auto/xmlpatterns/tst_xmlpatterns.cpp
index 2069d031f..26dc280d6 100644
--- a/tests/auto/xmlpatterns/tst_xmlpatterns.cpp
+++ b/tests/auto/xmlpatterns/tst_xmlpatterns.cpp
@@ -154,7 +154,7 @@ void tst_XmlPatterns::xquerySupport()
const QByteArray rawProducedStderr((process.readAllStandardError()));
const QString fixedStderr(QString::fromLocal8Bit(rawProducedStderr).remove(m_filenameInStderr));
- const QString errorFileName(inputFile(QLatin1String("stderrBaselines/") +
+ const QString errorFileName(inputFile(QLatin1String(SRCDIR "stderrBaselines/") +
QString::fromUtf8(QTest::currentDataTag()).remove(m_normalizeTestName) +
QLatin1String(".txt")));
@@ -221,7 +221,7 @@ void tst_XmlPatterns::xquerySupport_data() const
#endif
/* Check one file for existence, to avoid possible false positives. */
- QVERIFY(QFile::exists(inputFile(QLatin1String("queries/onePlusOne.xq"))));
+ QVERIFY(QFile::exists(inputFile(QLatin1String(SRCDIR "queries/onePlusOne.xq"))));
QTest::addColumn<int>("expectedExitCode");
QTest::addColumn<QByteArray>("expectedQueryOutput");
@@ -232,21 +232,21 @@ void tst_XmlPatterns::xquerySupport_data() const
QTest::newRow("A simple math query")
<< 0
<< QByteArray("2\n")
- << QStringList((QLatin1String("queries/onePlusOne.xq")))
+ << QStringList((QLatin1String(SRCDIR "queries/onePlusOne.xq")))
<< QString()
<< QString();
QTest::newRow("An unbound external variable")
<< 2
<< QByteArray()
- << QStringList(QLatin1String("queries/externalVariable.xq"))
+ << QStringList(QLatin1String(SRCDIR "queries/externalVariable.xq"))
<< QString()
<< QString();
QTest::newRow("Bind an external variable")
<< 0
<< QByteArray("1 4<e>1</e>true\n")
- << (QStringList() << QLatin1String("queries/externalVariable.xq")
+ << (QStringList() << QLatin1String(SRCDIR "queries/externalVariable.xq")
<< QLatin1String("-param")
<< QLatin1String("externalVariable=1"))
<< QString()
@@ -257,21 +257,21 @@ void tst_XmlPatterns::xquerySupport_data() const
<< QByteArray("1 4<e>1</e>true\n")
<< (QStringList() << QLatin1String("-param")
<< QLatin1String("externalVariable=1")
- << QLatin1String("queries/externalVariable.xq"))
+ << QLatin1String(SRCDIR "queries/externalVariable.xq"))
<< QString()
<< QString();
QTest::newRow("Use fn:doc")
<< 0
<< QByteArray("<e xmlns=\"http://example.com\" xmlns:p=\"http://example.com/P\" attr=\"1\" p:attr=\"\">\n <?target data?>\n <!-- a comment -->\n <e/>text <f/>text node</e>\n")
- << QStringList(QLatin1String("queries/openDocument.xq"))
+ << QStringList(QLatin1String(SRCDIR "queries/openDocument.xq"))
<< QString()
<< QString();
QTest::newRow("Use fn:doc, together with -no-format, last")
<< 0
<< QByteArray("<e xmlns=\"http://example.com\" xmlns:p=\"http://example.com/P\" attr=\"1\" p:attr=\"\"><?target data?><!-- a comment --><e/>text <f/>text node</e>")
- << (QStringList() << QLatin1String("queries/openDocument.xq")
+ << (QStringList() << QLatin1String(SRCDIR "queries/openDocument.xq")
<< QLatin1String("-no-format"))
<< QString()
<< QString();
@@ -280,7 +280,7 @@ void tst_XmlPatterns::xquerySupport_data() const
<< 0
<< QByteArray("<e xmlns=\"http://example.com\" xmlns:p=\"http://example.com/P\" attr=\"1\" p:attr=\"\"><?target data?><!-- a comment --><e/>text <f/>text node</e>")
<< (QStringList() << QLatin1String("-no-format")
- << QLatin1String("queries/openDocument.xq"))
+ << QLatin1String(SRCDIR "queries/openDocument.xq"))
<< QString()
<< QString();
@@ -288,28 +288,28 @@ void tst_XmlPatterns::xquerySupport_data() const
QTest::newRow("Make sure query paths are resolved against CWD, not the location of the executable.")
<< 0
<< QByteArray("2\n")
- << QStringList(QLatin1String("onePlusOne.xq"))
+ << QStringList(QLatin1String(SRCDIR "queries/onePlusOne.xq"))
<< QString::fromLatin1("queries")
<< QString();
QTest::newRow("Call fn:error()")
<< 2
<< QByteArray()
- << QStringList(QLatin1String("queries/errorFunction.xq"))
+ << QStringList(QLatin1String(SRCDIR "queries/errorFunction.xq"))
<< QString()
<< QString();
QTest::newRow("Evaluate a library module")
<< 2
<< QByteArray()
- << QStringList(QLatin1String("queries/simpleLibraryModule.xq"))
+ << QStringList(QLatin1String(SRCDIR "queries/simpleLibraryModule.xq"))
<< QString()
<< QString();
QTest::newRow("Trigger a static error.")
<< 2
<< QByteArray()
- << QStringList(QLatin1String("queries/staticError.xq"))
+ << QStringList(QLatin1String(SRCDIR "queries/staticError.xq"))
<< QString()
<< QString();
@@ -323,7 +323,7 @@ void tst_XmlPatterns::xquerySupport_data() const
QTest::newRow("Open an nonexistent file")
<< 2
<< QByteArray()
- << QStringList(QLatin1String("queries/ThisFileDoesNotExist.xq"))
+ << QStringList(QLatin1String(SRCDIR "queries/ThisFileDoesNotExist.xq"))
<< QString()
<< QString();
@@ -332,63 +332,63 @@ void tst_XmlPatterns::xquerySupport_data() const
QTest::newRow("XQuery-function message markups")
<< 2
<< QByteArray()
- << QStringList(QLatin1String("queries/wrongArity.xq"))
+ << QStringList(QLatin1String(SRCDIR "queries/wrongArity.xq"))
<< QString()
<< QString();
QTest::newRow("XQuery-type message markups")
<< 2
<< QByteArray()
- << QStringList(QLatin1String("queries/typeError.xq"))
+ << QStringList(QLatin1String(SRCDIR "queries/typeError.xq"))
<< QString()
<< QString();
QTest::newRow("XQuery-data & XQuery-keyword message markups")
<< 2
<< QByteArray()
- << QStringList(QLatin1String("queries/zeroDivision.xq"))
+ << QStringList(QLatin1String(SRCDIR "queries/zeroDivision.xq"))
<< QString()
<< QString();
QTest::newRow("XQuery-uri message markups")
<< 2
<< QByteArray()
- << QStringList(QLatin1String("queries/unsupportedCollation.xq"))
+ << QStringList(QLatin1String(SRCDIR "queries/unsupportedCollation.xq"))
<< QString()
<< QString();
QTest::newRow("XQuery-expression message markups")
<< 2
<< QByteArray()
- << QStringList(QLatin1String("queries/invalidRegexp.xq"))
+ << QStringList(QLatin1String(SRCDIR "queries/invalidRegexp.xq"))
<< QString()
<< QString();
QTest::newRow("Print a list of available regexp flags(The available flags are formatted in a complex way.)")
<< 2
<< QByteArray()
- << QStringList(QLatin1String("queries/invalidRegexpFlag.xq"))
+ << QStringList(QLatin1String(SRCDIR "queries/invalidRegexpFlag.xq"))
<< QString()
<< QString();
QTest::newRow("Trigger an assert in QPatternist::ColorOutput. The query naturally contains an error; XPTY0004.")
<< 2
<< QByteArray()
- << QStringList(QLatin1String("queries/flwor.xq"))
+ << QStringList(QLatin1String(SRCDIR "queries/flwor.xq"))
<< QString()
<< QString();
QTest::newRow("Trigger a second assert in QPatternist::ColorOutput. The query naturally contains XPST0003.")
<< 2
<< QByteArray()
- << QStringList(QLatin1String("queries/syntaxError.xq"))
+ << QStringList(QLatin1String(SRCDIR "queries/syntaxError.xq"))
<< QString()
<< QString();
QTest::newRow("-param is missing so multiple queries appear")
<< 2
<< QByteArray()
- << (QStringList() << QLatin1String("queries/reportGlobals.xq")
+ << (QStringList() << QLatin1String(SRCDIR "queries/reportGlobals.xq")
<< QLatin1String("fileToOpen=globals.gccxml"))
<< QString()
<< QString();
@@ -403,7 +403,7 @@ void tst_XmlPatterns::xquerySupport_data() const
QTest::newRow("Basic use of -output, query first")
<< 0
<< QByteArray("2\n")
- << (QStringList() << QLatin1String("queries/onePlusOne.xq")
+ << (QStringList() << QLatin1String(SRCDIR "queries/onePlusOne.xq")
<< QLatin1String("-output")
<< QLatin1String("basicOutput.out"))
<< QString()
@@ -414,22 +414,22 @@ void tst_XmlPatterns::xquerySupport_data() const
<< QByteArray("<e/>\n")
<< (QStringList() << QLatin1String("-output")
<< QLatin1String("basicOutput2.out")
- << QLatin1String("queries/oneElement.xq"))
+ << QLatin1String(SRCDIR "queries/oneElement.xq"))
<< QString()
<< QString::fromLatin1("basicOutput2.out");
QTest::newRow("A single query, that does not exist")
<< 2
<< QByteArray()
- << (QStringList() << QLatin1String("doesNotExist.xq"))
+ << (QStringList() << QLatin1String(SRCDIR "doesNotExist.xq"))
<< QString()
<< QString();
QTest::newRow("Specify two identical query names")
<< 2
<< QByteArray()
- << (QStringList() << QLatin1String("query.xq")
- << QLatin1String("query.xq"))
+ << (QStringList() << QLatin1String(SRCDIR "query.xq")
+ << QLatin1String(SRCDIR "query.xq"))
<< QString()
<< QString();
@@ -459,7 +459,7 @@ void tst_XmlPatterns::xquerySupport_data() const
<< QByteArray()
<< (QStringList() << QLatin1String("-output")
<< filename
- << QLatin1String("queries/onePlusOne.xq"))
+ << QLatin1String(SRCDIR "queries/onePlusOne.xq"))
<< QString()
<< filename;
}
@@ -476,7 +476,7 @@ void tst_XmlPatterns::xquerySupport_data() const
<< QByteArray("2\n")
<< (QStringList() << QLatin1String("-output")
<< outName
- << QLatin1String("queries/onePlusOne.xq"))
+ << QLatin1String(SRCDIR "queries/onePlusOne.xq"))
<< QString()
<< outName;
}
@@ -484,7 +484,7 @@ void tst_XmlPatterns::xquerySupport_data() const
QTest::newRow("one query, and a terminating dash at the end")
<< 0
<< QByteArray("2\n")
- << (QStringList() << QLatin1String("queries/onePlusOne.xq")
+ << (QStringList() << QLatin1String(SRCDIR "queries/onePlusOne.xq")
<< QLatin1String("-"))
<< QString()
<< QString();
@@ -493,7 +493,7 @@ void tst_XmlPatterns::xquerySupport_data() const
<< 0
<< QByteArray("2\n")
<< (QStringList() << QLatin1String("-")
- << QLatin1String("queries/onePlusOne.xq"))
+ << QLatin1String(SRCDIR "queries/onePlusOne.xq"))
<< QString()
<< QString();
@@ -580,21 +580,21 @@ void tst_XmlPatterns::xquerySupport_data() const
QTest::newRow("Run a query which evaluates to the empty sequence.")
<< 0
<< QByteArray("\n")
- << (QStringList() << QLatin1String("queries/emptySequence.xq"))
+ << (QStringList() << QLatin1String(SRCDIR "queries/emptySequence.xq"))
<< QString()
<< QString();
QTest::newRow("Run a query which evaluates to a single document node with no children.")
<< 0
<< QByteArray("\n")
- << (QStringList() << QLatin1String("queries/onlyDocumentNode.xq"))
+ << (QStringList() << QLatin1String(SRCDIR "queries/onlyDocumentNode.xq"))
<< QString()
<< QString();
QTest::newRow("Invoke with invalid -param value.")
<< 1
<< QByteArray()
- << (QStringList() << QLatin1String("queries/externalVariable.xq")
+ << (QStringList() << QLatin1String(SRCDIR "queries/externalVariable.xq")
<< QLatin1String("-param")
<< QLatin1String("EqualSignIsMissing"))
<< QString()
@@ -603,7 +603,7 @@ void tst_XmlPatterns::xquerySupport_data() const
QTest::newRow("Invoke with colon in variable name.")
<< 1
<< QByteArray()
- << (QStringList() << QLatin1String("queries/externalVariable.xq")
+ << (QStringList() << QLatin1String(SRCDIR "queries/externalVariable.xq")
<< QLatin1String("-param")
<< QLatin1String("xs:name=value"))
<< QString()
@@ -612,7 +612,7 @@ void tst_XmlPatterns::xquerySupport_data() const
QTest::newRow("Invoke with missing name in -param arg.")
<< 1
<< QByteArray()
- << (QStringList() << QLatin1String("queries/externalVariable.xq")
+ << (QStringList() << QLatin1String(SRCDIR "queries/externalVariable.xq")
<< QLatin1String("-param")
<< QLatin1String("=value"))
<< QString()
@@ -621,7 +621,7 @@ void tst_XmlPatterns::xquerySupport_data() const
QTest::newRow("Invoke with -param that has two adjacent equal signs.")
<< 0
<< QByteArray("START =text END\n")
- << (QStringList() << QLatin1String("queries/externalStringVariable.xq")
+ << (QStringList() << QLatin1String(SRCDIR "queries/externalStringVariable.xq")
<< QLatin1String("-param")
<< QLatin1String("externalString==text"))
<< QString()
@@ -630,7 +630,7 @@ void tst_XmlPatterns::xquerySupport_data() const
QTest::newRow("Pass in an external variable, but the query doesn't use it.")
<< 0
<< QByteArray("2\n")
- << (QStringList() << QLatin1String("queries/onePlusOne.xq")
+ << (QStringList() << QLatin1String(SRCDIR "queries/onePlusOne.xq")
<< QLatin1String("-param")
<< QLatin1String("externalString==text"))
<< QString()
@@ -640,7 +640,7 @@ void tst_XmlPatterns::xquerySupport_data() const
QTest::newRow("Invoke with -param that has no value.")
<< 0
<< QByteArray("START END\n")
- << (QStringList() << QLatin1String("queries/externalStringVariable.xq")
+ << (QStringList() << QLatin1String(SRCDIR "queries/externalStringVariable.xq")
<< QLatin1String("-param")
<< QLatin1String("externalString="))
<< QString()
@@ -656,7 +656,7 @@ void tst_XmlPatterns::xquerySupport_data() const
QTest::newRow("Use a native path")
<< 0
<< QByteArray("2\n")
- << (QStringList() << QDir::toNativeSeparators(QLatin1String("queries/onePlusOne.xq")))
+ << (QStringList() << QDir::toNativeSeparators(QLatin1String(SRCDIR "queries/onePlusOne.xq")))
<< QString()
<< QString();
@@ -671,8 +671,8 @@ void tst_XmlPatterns::xquerySupport_data() const
QTest::newRow("A valid, existing query, followed by a bogus one")
<< 1
<< QByteArray()
- << (QStringList() << QLatin1String("queries/onePlusOne.xq")
- << QLatin1String("doesNotExist.xq"))
+ << (QStringList() << QLatin1String(SRCDIR "queries/onePlusOne.xq")
+ << QLatin1String(SRCDIR "doesNotExist.xq"))
<< QString()
<< QString();
*/
@@ -681,8 +681,8 @@ void tst_XmlPatterns::xquerySupport_data() const
QTest::newRow("Specify two different query names")
<< 1
<< QByteArray()
- << (QStringList() << QLatin1String("query1.xq")
- << QLatin1String("query2.xq"))
+ << (QStringList() << QLatin1String(SRCDIR "query1.xq")
+ << QLatin1String(SRCDIR "query2.xq"))
<< QString()
<< QString();
*/
@@ -696,7 +696,7 @@ void tst_XmlPatterns::xquerySupport_data() const
QTest::newRow("Use -param twice")
<< 0
<< QByteArray("param1 param2\n")
- << (QStringList() << QLatin1String("queries/twoVariables.xq")
+ << (QStringList() << QLatin1String(SRCDIR "queries/twoVariables.xq")
<< QLatin1String("-param")
<< QLatin1String("var1=param1")
<< QLatin1String("-param")
@@ -707,7 +707,7 @@ void tst_XmlPatterns::xquerySupport_data() const
QTest::newRow("Use -param thrice")
<< 0
<< QByteArray("param1 param2 third\n")
- << (QStringList() << QLatin1String("queries/threeVariables.xq")
+ << (QStringList() << QLatin1String(SRCDIR "queries/threeVariables.xq")
<< QLatin1String("-param")
<< QLatin1String("var1=param1")
<< QLatin1String("-param")
@@ -720,7 +720,7 @@ void tst_XmlPatterns::xquerySupport_data() const
QTest::newRow("Specify the same parameter twice, different values")
<< 1
<< QByteArray()
- << (QStringList() << QLatin1String("queries/onePlusOne.xq")
+ << (QStringList() << QLatin1String(SRCDIR "queries/onePlusOne.xq")
<< QLatin1String("-param")
<< QLatin1String("duplicated=param1")
<< QLatin1String("-param")
@@ -731,7 +731,7 @@ void tst_XmlPatterns::xquerySupport_data() const
QTest::newRow("Specify the same parameter twice, same values")
<< 1
<< QByteArray()
- << (QStringList() << QLatin1String("queries/onePlusOne.xq")
+ << (QStringList() << QLatin1String(SRCDIR "queries/onePlusOne.xq")
<< QLatin1String("-param")
<< QLatin1String("duplicated=param1")
<< QLatin1String("-param")
@@ -742,7 +742,7 @@ void tst_XmlPatterns::xquerySupport_data() const
QTest::newRow("Open a non-existing collection.")
<< 2
<< QByteArray()
- << (QStringList() << QLatin1String("queries/nonexistingCollection.xq"))
+ << (QStringList() << QLatin1String(SRCDIR "queries/nonexistingCollection.xq"))
<< QString()
<< QString();
@@ -804,7 +804,7 @@ void tst_XmlPatterns::stdoutFailure() const
//process.setStandardOutputFile(outName);
process.setWorkingDirectory(QDir::current().absoluteFilePath(QString()));
- process.start(m_command, QStringList("queries/onePlusOne.xq"));
+ process.start(m_command, QStringList(SRCDIR "queries/onePlusOne.xq"));
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
QVERIFY(process.waitForFinished());
@@ -865,8 +865,8 @@ void tst_XmlPatterns::xsltSupport_data() const
QTest::newRow("Pass in a stylesheet file which contains an XQuery query")
<< 2
<< QByteArray()
- << (QStringList() << QLatin1String("stylesheets/queryAsStylesheet.xsl")
- << QLatin1String("queries/simpleDocument.xml"))
+ << (QStringList() << QLatin1String(SRCDIR "stylesheets/queryAsStylesheet.xsl")
+ << QLatin1String(SRCDIR "queries/simpleDocument.xml"))
<< QString()
<< QString();
@@ -883,7 +883,7 @@ void tst_XmlPatterns::xsltSupport_data() const
<< QByteArray()
<< (QStringList() << QLatin1String("-initial-template")
<< QLatin1String("name")
- << QLatin1String("queries/onePlusOne.xq"))
+ << QLatin1String(SRCDIR "queries/onePlusOne.xq"))
<< QString()
<< QString();
@@ -918,8 +918,8 @@ void tst_XmlPatterns::xsltSupport_data() const
<< (QStringList() << QLatin1String("-no-format")
<< QLatin1String("-initial-template")
<< QLatin1String("main")
- << QLatin1String("stylesheets/namedAndRootTemplate.xsl")
- << QLatin1String("stylesheets/documentElement.xml"))
+ << QLatin1String(SRCDIR "stylesheets/namedAndRootTemplate.xsl")
+ << QLatin1String(SRCDIR "stylesheets/documentElement.xml"))
<< QString()
<< QString();
@@ -929,8 +929,8 @@ void tst_XmlPatterns::xsltSupport_data() const
<< (QStringList() << QLatin1String("-no-format")
<< QLatin1String("-initial-template")
<< QLatin1String("no-template-by-this-name")
- << QLatin1String("stylesheets/namedAndRootTemplate.xsl")
- << QLatin1String("stylesheets/documentElement.xml"))
+ << QLatin1String(SRCDIR "stylesheets/namedAndRootTemplate.xsl")
+ << QLatin1String(SRCDIR "stylesheets/documentElement.xml"))
<< QString()
<< QString();
@@ -940,7 +940,7 @@ void tst_XmlPatterns::xsltSupport_data() const
<< (QStringList() << QLatin1String("-no-format")
<< QLatin1String("-initial-template")
<< QLatin1String("main")
- << QLatin1String("stylesheets/namedAndRootTemplate.xsl"))
+ << QLatin1String(SRCDIR "stylesheets/namedAndRootTemplate.xsl"))
<< QString()
<< QString();
@@ -950,7 +950,7 @@ void tst_XmlPatterns::xsltSupport_data() const
<< (QStringList() << QLatin1String("-no-format")
<< QLatin1String("-initial-template")
<< QLatin1String("{http://example.com/NS}main")
- << QLatin1String("stylesheets/namedAndRootTemplate.xsl"))
+ << QLatin1String(SRCDIR "stylesheets/namedAndRootTemplate.xsl"))
<< QString()
<< QString();
@@ -959,7 +959,7 @@ void tst_XmlPatterns::xsltSupport_data() const
<< QByteArray("defParam overridedDefaultedParam implicitlyRequiredValue\n")
<< (QStringList() << QLatin1String("-initial-template")
<< QLatin1String("main")
- << QLatin1String("stylesheets/useParameters.xsl")
+ << QLatin1String(SRCDIR "stylesheets/useParameters.xsl")
<< QLatin1String("-param")
<< QLatin1String("overridedDefaultedParam=overridedDefaultedParam")
<< QLatin1String("-param")
@@ -970,24 +970,24 @@ void tst_XmlPatterns::xsltSupport_data() const
QTest::newRow("Use a simplified stylesheet module")
<< 0
<< QByteArray("<output>some text</output>\n")
- << (QStringList() << QLatin1String("stylesheets/simplifiedStylesheetModule.xsl")
- << QLatin1String("stylesheets/simplifiedStylesheetModule.xml"))
+ << (QStringList() << QLatin1String(SRCDIR "stylesheets/simplifiedStylesheetModule.xsl")
+ << QLatin1String(SRCDIR "stylesheets/simplifiedStylesheetModule.xml"))
<< QString()
<< QString();
QTest::newRow("Not well-formed stylesheet, causes crash in coloring code.")
<< 2
<< QByteArray()
- << (QStringList() << QLatin1String("stylesheets/notWellformed.xsl")
- << QLatin1String("queries/simpleDocument.xml"))
+ << (QStringList() << QLatin1String(SRCDIR "stylesheets/notWellformed.xsl")
+ << QLatin1String(SRCDIR "queries/simpleDocument.xml"))
<< QString()
<< QString();
QTest::newRow("Not well-formed instance document, causes crash in coloring code.")
<< 2
<< QByteArray()
- << (QStringList() << QLatin1String("stylesheets/bool070.xsl")
- << QLatin1String("stylesheets/bool070.xml"))
+ << (QStringList() << QLatin1String(SRCDIR "stylesheets/bool070.xsl")
+ << QLatin1String(SRCDIR "stylesheets/bool070.xml"))
<< QString()
<< QString();
diff --git a/tests/auto/xmlpatterns/xmlpatterns.pro b/tests/auto/xmlpatterns/xmlpatterns.pro
index 569e23f47..01e3b2bd1 100644
--- a/tests/auto/xmlpatterns/xmlpatterns.pro
+++ b/tests/auto/xmlpatterns/xmlpatterns.pro
@@ -2,4 +2,10 @@ load(qttest_p4)
SOURCES += tst_xmlpatterns.cpp \
../qxmlquery/TestFundament.cpp
+!wince* {
+DEFINES += SRCDIR=\\\"$$PWD/\\\"
+} else {
+DEFINES += SRCDIR=\\\"./\\\"
+}
+
include (../xmlpatterns.pri)
diff --git a/tests/benchmarks/qgraphicsitem/qgraphicsitem.pro b/tests/benchmarks/qgraphicsitem/qgraphicsitem.pro
index c8fc07bf1..726bb9613 100644
--- a/tests/benchmarks/qgraphicsitem/qgraphicsitem.pro
+++ b/tests/benchmarks/qgraphicsitem/qgraphicsitem.pro
@@ -3,4 +3,3 @@ TEMPLATE = app
TARGET = tst_qgraphicsitem
SOURCES += tst_qgraphicsitem.cpp
-
diff --git a/tests/benchmarks/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/benchmarks/qgraphicsitem/tst_qgraphicsitem.cpp
index d072d080d..ee27ebe0e 100644
--- a/tests/benchmarks/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/benchmarks/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -25,6 +25,9 @@ public slots:
void cleanup();
private slots:
+ void setParentItem();
+ void setParentItem_deep();
+ void deleteItemWithManyChildren();
void setPos_data();
void setPos();
void setTransform_data();
@@ -34,7 +37,6 @@ private slots:
void shear();
void translate();
void setRotation();
- void setRotationXYZ();
};
tst_QGraphicsItem::tst_QGraphicsItem()
@@ -53,6 +55,40 @@ void tst_QGraphicsItem::cleanup()
{
}
+void tst_QGraphicsItem::setParentItem()
+{
+ QBENCHMARK {
+ QGraphicsRectItem rect;
+ QGraphicsRectItem *childRect = new QGraphicsRectItem;
+ childRect->setParentItem(&rect);
+ }
+}
+
+void tst_QGraphicsItem::setParentItem_deep()
+{
+ QBENCHMARK {
+ QGraphicsRectItem rect;
+ QGraphicsRectItem *lastRect = &rect;
+ for (int i = 0; i < 10; ++i) {
+ QGraphicsRectItem *childRect = new QGraphicsRectItem;
+ childRect->setParentItem(lastRect);
+ lastRect = childRect;
+ }
+ QGraphicsItem *first = rect.children().first();
+ first->setParentItem(0);
+ }
+}
+
+void tst_QGraphicsItem::deleteItemWithManyChildren()
+{
+ QBENCHMARK {
+ QGraphicsRectItem *rect = new QGraphicsRectItem;
+ for (int i = 0; i < 1000; ++i)
+ new QGraphicsRectItem(rect);
+ delete rect;
+ }
+}
+
void tst_QGraphicsItem::setPos_data()
{
QTest::addColumn<QPointF>("pos");
@@ -150,18 +186,7 @@ void tst_QGraphicsItem::setRotation()
QGraphicsItem *item = scene.addRect(QRectF(0, 0, 100, 100));
QBENCHMARK {
- item->setXRotation(45);
- item->transform(); // prevent lazy optimizing
- }
-}
-
-void tst_QGraphicsItem::setRotationXYZ()
-{
- QGraphicsScene scene;
- QGraphicsItem *item = scene.addRect(QRectF(0, 0, 100, 100));
-
- QBENCHMARK {
- item->setRotation(45, 45, 45);
+ item->setRotation(45);
item->transform(); // prevent lazy optimizing
}
}
diff --git a/tests/manual/qdesktopwidget/main.cpp b/tests/manual/qdesktopwidget/main.cpp
index 2cbdfb9dd..653a5fc44 100644
--- a/tests/manual/qdesktopwidget/main.cpp
+++ b/tests/manual/qdesktopwidget/main.cpp
@@ -53,8 +53,11 @@ public:
QDesktopWidget *desktop = QApplication::desktop();
connect(desktop, SIGNAL(resized(int)), this, SLOT(updateScene()));
+ connect(desktop, SIGNAL(resized(int)), this, SLOT(desktopResized(int)));
connect(desktop, SIGNAL(workAreaResized(int)), this, SLOT(updateScene()));
+ connect(desktop, SIGNAL(workAreaResized(int)), this, SLOT(desktopWorkAreaResized(int)));
connect(desktop, SIGNAL(screenCountChanged(int)), this, SLOT(updateScene()));
+ connect(desktop, SIGNAL(screenCountChanged(int)), this, SLOT(desktopScreenCountChanged(int)));
updateScene();
@@ -63,6 +66,7 @@ public:
setTransform(transform);
setBackgroundBrush(Qt::darkGray);
+ desktopScreenCountChanged(-1);
}
protected:
@@ -169,6 +173,33 @@ private slots:
return rect;
}
+ void desktopResized(int screen)
+ {
+ qDebug() << "Screen was resized: " << screen
+ << ", new size =" << QApplication::desktop()->screenGeometry(screen);
+ }
+ void desktopWorkAreaResized(int screen)
+ {
+ qDebug() << "Screen workarea was resized: " << screen
+ << ", new size =" << QApplication::desktop()->availableGeometry(screen);
+ }
+ void desktopScreenCountChanged(int screenCount)
+ {
+ QDesktopWidget *desktop = QApplication::desktop();
+ qDebug() << "";
+ if (screenCount != -1) {
+ qDebug() << "Screen count was changed to " << screenCount;
+ } else {
+ screenCount = desktop->screenCount();
+ qDebug() << "Screen count: " << screenCount;
+ }
+ for (int i = 0; i < screenCount; ++i) {
+ qDebug() << " #" << i << ": geometry =" << desktop->screenGeometry(i)
+ << "; available geometry =" << desktop->availableGeometry(i);
+ }
+ qDebug() << "";
+ }
+
private:
QGraphicsScene *scene;
QGraphicsRectItem *that;
diff --git a/tests/manual/qtabletevent/main.cpp b/tests/manual/qtabletevent/main.cpp
new file mode 100644
index 000000000..4014d580c
--- /dev/null
+++ b/tests/manual/qtabletevent/main.cpp
@@ -0,0 +1,9 @@
+#include <QtGui>
+#include "tabletwidget.h"
+
+int main(int argc, char **argv) {
+ QApplication app(argc, argv);
+ TabletWidget tabletWidget;
+ tabletWidget.showMaximized();
+ return app.exec();
+}
diff --git a/tests/manual/qtabletevent/qtabletevent.pro b/tests/manual/qtabletevent/qtabletevent.pro
new file mode 100644
index 000000000..e0ed54900
--- /dev/null
+++ b/tests/manual/qtabletevent/qtabletevent.pro
@@ -0,0 +1,13 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Mon Aug 10 17:02:09 2009
+######################################################################
+
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+SOURCES += main.cpp\
+ tabletwidget.cpp
+HEADERS += tabletwidget.h
diff --git a/tests/manual/qtabletevent/tabletwidget.cpp b/tests/manual/qtabletevent/tabletwidget.cpp
new file mode 100644
index 000000000..4d6a36524
--- /dev/null
+++ b/tests/manual/qtabletevent/tabletwidget.cpp
@@ -0,0 +1,150 @@
+#include "tabletwidget.h"
+#include <QPainter>
+#include <QApplication>
+
+TabletWidget::TabletWidget()
+{
+ QPalette newPalette = palette();
+ newPalette.setColor(QPalette::Window, Qt::white);
+ setPalette(newPalette);
+ qApp->installEventFilter(this);
+ resetAttributes();
+}
+
+bool TabletWidget::eventFilter(QObject *, QEvent *ev)
+{
+ switch (ev->type()) {
+ case QEvent::TabletEnterProximity:
+ case QEvent::TabletLeaveProximity:
+ case QEvent::TabletMove:
+ case QEvent::TabletPress:
+ case QEvent::TabletRelease:
+ {
+ QTabletEvent *event = static_cast<QTabletEvent*>(ev);
+ mType = event->type();
+ mPos = event->pos();
+ mGPos = event->globalPos();
+ mHiResGlobalPos = event->hiResGlobalPos();
+ mDev = event->device();
+ mPointerType = event->pointerType();
+ mUnique = event->uniqueId();
+ mXT = event->xTilt();
+ mYT = event->yTilt();
+ mZ = event->z();
+ mPress = event->pressure();
+ mTangential = event->tangentialPressure();
+ mRot = event->rotation();
+ if (isVisible())
+ update();
+ break;
+ }
+ case QEvent::MouseMove:
+ {
+ resetAttributes();
+ QMouseEvent *event = static_cast<QMouseEvent*>(ev);
+ mType = event->type();
+ mPos = event->pos();
+ mGPos = event->globalPos();
+ }
+ default:
+ break;
+ }
+ return false;
+}
+
+void TabletWidget::paintEvent(QPaintEvent *event)
+{
+ QPainter painter(this);
+
+ QStringList eventInfo;
+
+ QString typeString("Event type: ");
+ switch (mType) {
+ case QEvent::TabletEnterProximity:
+ typeString += "QEvent::TabletEnterProximity";
+ break;
+ case QEvent::TabletLeaveProximity:
+ typeString += "QEvent::TabletLeaveProximity";
+ break;
+ case QEvent::TabletMove:
+ typeString += "QEvent::TabletMove";
+ break;
+ case QEvent::TabletPress:
+ typeString += "QEvent::TabletPress";
+ break;
+ case QEvent::TabletRelease:
+ typeString += "QEvent::TabletRelease";
+ break;
+ case QEvent::MouseMove:
+ typeString += "QEvent::MouseMove";
+ break;
+ }
+ eventInfo << typeString;
+
+ eventInfo << QString("Global position: %1 %2").arg(QString::number(mGPos.x()), QString::number(mGPos.y()));
+ eventInfo << QString("Local position: %1 %2").arg(QString::number(mPos.x()), QString::number(mPos.y()));
+ if (mType == QEvent::TabletEnterProximity || mType == QEvent::TabletLeaveProximity
+ || mType == QEvent::TabletMove || mType == QEvent::TabletPress
+ || mType == QEvent::TabletRelease) {
+
+ eventInfo << QString("Hight res global position: %1 %2").arg(QString::number(mHiResGlobalPos.x()), QString::number(mHiResGlobalPos.y()));
+
+ QString pointerType("Pointer type: ");
+ switch (mPointerType) {
+ case QTabletEvent::UnknownPointer:
+ pointerType += "QTabletEvent::UnknownPointer";
+ break;
+ case QTabletEvent::Pen:
+ pointerType += "QTabletEvent::Pen";
+ break;
+ case QTabletEvent::Cursor:
+ pointerType += "QTabletEvent::Cursor";
+ break;
+ case QTabletEvent::Eraser:
+ pointerType += "QTabletEvent::Eraser";
+ break;
+ }
+ eventInfo << pointerType;
+
+
+ QString deviceString = "Device type: ";
+ switch (mDev) {
+ case QTabletEvent::NoDevice:
+ deviceString += "QTabletEvent::NoDevice";
+ break;
+ case QTabletEvent::Puck:
+ deviceString += "QTabletEvent::Puck";
+ break;
+ case QTabletEvent::Stylus:
+ deviceString += "QTabletEvent::Stylus";
+ break;
+ case QTabletEvent::Airbrush:
+ deviceString += "QTabletEvent::Airbrush";
+ break;
+ case QTabletEvent::FourDMouse:
+ deviceString += "QTabletEvent::FourDMouse";
+ break;
+ case QTabletEvent::RotationStylus:
+ deviceString += "QTabletEvent::RotationStylus";
+ break;
+ }
+ eventInfo << deviceString;
+
+ eventInfo << QString("Pressure: %1").arg(QString::number(mPress));
+ eventInfo << QString("Tangential pressure: %1").arg(QString::number(mTangential));
+ eventInfo << QString("Rotation: %1").arg(QString::number(mRot));
+ eventInfo << QString("xTilt: %1").arg(QString::number(mXT));
+ eventInfo << QString("yTilt: %1").arg(QString::number(mYT));
+ eventInfo << QString("z: %1").arg(QString::number(mZ));
+
+ eventInfo << QString("Unique Id: %1").arg(QString::number(mUnique));
+ }
+
+ painter.drawText(rect(), eventInfo.join("\n"));
+}
+
+void TabletWidget::tabletEvent(QTabletEvent *event)
+{
+ event->accept();
+}
+
diff --git a/tests/manual/qtabletevent/tabletwidget.h b/tests/manual/qtabletevent/tabletwidget.h
new file mode 100644
index 000000000..b0efef218
--- /dev/null
+++ b/tests/manual/qtabletevent/tabletwidget.h
@@ -0,0 +1,32 @@
+#ifndef TABLETWIDGET_H
+#define TABLETWIDGET_H
+
+#include <QWidget>
+#include <QTabletEvent>
+
+// a widget showing the information of the last tablet event
+class TabletWidget : public QWidget
+{
+public:
+ TabletWidget();
+protected:
+ bool eventFilter(QObject *obj, QEvent *ev);
+ void tabletEvent(QTabletEvent *event);
+ void paintEvent(QPaintEvent *event);
+private:
+ void resetAttributes() {
+ mType = mDev = mPointerType = mXT = mYT = mZ = 0;
+ mPress = mTangential = mRot = 0.0;
+ mPos = mGPos = QPoint();
+ mHiResGlobalPos = QPointF();
+ mUnique = 0;
+ }
+ int mType;
+ QPoint mPos, mGPos;
+ QPointF mHiResGlobalPos;
+ int mDev, mPointerType, mXT, mYT, mZ;
+ qreal mPress, mTangential, mRot;
+ qint64 mUnique;
+};
+
+#endif // TABLETWIDGET_H
diff --git a/tools/assistant/compat/lib/lib.pro b/tools/assistant/compat/lib/lib.pro
index d4b5a47b2..e50d4702c 100644
--- a/tools/assistant/compat/lib/lib.pro
+++ b/tools/assistant/compat/lib/lib.pro
@@ -32,7 +32,7 @@ contains(CONFIG, static) {
#load up the headers info
CONFIG += qt_install_headers
HEADERS_PRI = $$QT_BUILD_TREE/include/QtAssistant/headers.pri
-include($$HEADERS_PRI)|clear(HEADERS_PRI)
+include($$HEADERS_PRI, "", true)|clear(HEADERS_PRI)
#mac frameworks
mac:!static:contains(QT_CONFIG, qt_framework) {
diff --git a/tools/assistant/compat/mainwindow.cpp b/tools/assistant/compat/mainwindow.cpp
index 670b1440b..9d308dfa0 100644
--- a/tools/assistant/compat/mainwindow.cpp
+++ b/tools/assistant/compat/mainwindow.cpp
@@ -140,6 +140,16 @@ MainWindow::MainWindow()
ui.actionZoomIn->setIcon(QIcon(MacIconPath + QLatin1String("/zoomin.png")));
ui.actionSyncToc->setIcon(QIcon(MacIconPath + QLatin1String("/synctoc.png")));
ui.actionHelpWhatsThis->setIcon(QIcon(MacIconPath + QLatin1String("/whatsthis.png")));
+#elif defined(Q_WS_X11)
+ ui.actionGoNext->setIcon(QIcon::fromTheme("go-next" , ui.actionGoNext->icon()));
+ ui.actionGoPrevious->setIcon(QIcon::fromTheme("go-previous" , ui.actionGoPrevious->icon()));
+ ui.actionGoHome->setIcon(QIcon::fromTheme("user-home" , ui.actionGoHome->icon()));
+ ui.actionEditCopy->setIcon(QIcon::fromTheme("edit-copy" , ui.actionEditCopy->icon()));
+ ui.actionEditFind->setIcon(QIcon::fromTheme("edit-find" , ui.actionEditFind->icon()));
+ ui.actionFilePrint->setIcon(QIcon::fromTheme("document-print" , ui.actionFilePrint->icon()));
+ ui.actionZoomOut->setIcon(QIcon::fromTheme("zoom-out" , ui.actionZoomOut->icon()));
+ ui.actionZoomIn->setIcon(QIcon::fromTheme("zoom-in" , ui.actionZoomIn->icon()));
+ ui.actionSyncToc->setIcon(QIcon::fromTheme("view-refresh" , ui.actionSyncToc->icon()));
#endif
}
diff --git a/tools/assistant/tools/assistant/installdialog.cpp b/tools/assistant/tools/assistant/installdialog.cpp
index 5a8dfeaf8..2574f1f8b 100644
--- a/tools/assistant/tools/assistant/installdialog.cpp
+++ b/tools/assistant/tools/assistant/installdialog.cpp
@@ -56,6 +56,7 @@
#include <QtNetwork/QHttp>
QT_BEGIN_NAMESPACE
+#ifndef QT_NO_HTTP
#define QCH_FILENAME 92943
#define QCH_NAMESPACE 92944
@@ -335,4 +336,5 @@ void InstallDialog::browseDirectories()
m_ui.pathLineEdit->setText(dir);
}
+#endif
QT_END_NAMESPACE
diff --git a/tools/assistant/tools/assistant/installdialog.h b/tools/assistant/tools/assistant/installdialog.h
index 62759ecd7..9e18a22b9 100644
--- a/tools/assistant/tools/assistant/installdialog.h
+++ b/tools/assistant/tools/assistant/installdialog.h
@@ -47,6 +47,8 @@
#include <QtNetwork/QHttpResponseHeader>
#include "ui_installdialog.h"
+#ifndef QT_NO_HTTP
+
QT_BEGIN_NAMESPACE
class QHttp;
@@ -98,4 +100,6 @@ private:
QT_END_NAMESPACE
+#endif
+
#endif // INSTALLDIALOG_H
diff --git a/tools/assistant/tools/assistant/mainwindow.cpp b/tools/assistant/tools/assistant/mainwindow.cpp
index bc73b80d6..a0d4fbfcc 100644
--- a/tools/assistant/tools/assistant/mainwindow.cpp
+++ b/tools/assistant/tools/assistant/mainwindow.cpp
@@ -545,6 +545,19 @@ void MainWindow::setupActions()
m_aboutAction = menu->addAction(tr("About..."), this, SLOT(showAboutDialog()));
m_aboutAction->setMenuRole(QAction::AboutRole);
+#ifdef Q_WS_X11
+ m_backAction->setIcon(QIcon::fromTheme("go-previous" , m_backAction->icon()));
+ m_nextAction->setIcon(QIcon::fromTheme("go-next" , m_nextAction->icon()));
+ m_zoomInAction->setIcon(QIcon::fromTheme("zoom-in" , m_zoomInAction->icon()));
+ m_zoomOutAction->setIcon(QIcon::fromTheme("zoom-out" , m_zoomOutAction->icon()));
+ m_resetZoomAction->setIcon(QIcon::fromTheme("zoom-original" , m_resetZoomAction->icon()));
+ m_syncAction->setIcon(QIcon::fromTheme("view-refresh" , m_syncAction->icon()));
+ m_copyAction->setIcon(QIcon::fromTheme("edit-copy" , m_copyAction->icon()));
+ m_findAction->setIcon(QIcon::fromTheme("edit-find" , m_findAction->icon()));
+ m_homeAction->setIcon(QIcon::fromTheme("go-home" , m_homeAction->icon()));
+ m_printAction->setIcon(QIcon::fromTheme("document-print" , m_printAction->icon()));
+#endif
+
QToolBar *navigationBar = addToolBar(tr("Navigation Toolbar"));
navigationBar->setObjectName(QLatin1String("NavigationToolBar"));
navigationBar->addAction(m_backAction);
diff --git a/tools/checksdk/main.cpp b/tools/checksdk/main.cpp
index 6322eb7bf..b36aa3286 100644
--- a/tools/checksdk/main.cpp
+++ b/tools/checksdk/main.cpp
@@ -161,5 +161,5 @@ int main(int argc, char **argv)
}
}
qWarning("Could not find specified SDK: %s" , qPrintable(sdkName));
- return 0;
-} \ No newline at end of file
+ return -1;
+}
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index c93891928..f32e7dc09 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -245,6 +245,7 @@ Configure::Configure( int& argc, char** argv )
dictionary[ "XMLPATTERNS" ] = "auto";
dictionary[ "PHONON" ] = "auto";
dictionary[ "PHONON_BACKEND" ] = "yes";
+ dictionary[ "MULTIMEDIA" ] = "yes";
dictionary[ "DIRECTSHOW" ] = "no";
dictionary[ "WEBKIT" ] = "auto";
dictionary[ "PLUGIN_MANIFESTS" ] = "yes";
@@ -843,6 +844,10 @@ void Configure::parseCmdLine()
dictionary[ "XMLPATTERNS" ] = "no";
} else if( configCmdLine.at(i) == "-xmlpatterns" ) {
dictionary[ "XMLPATTERNS" ] = "yes";
+ } else if( configCmdLine.at(i) == "-no-multimedia" ) {
+ dictionary[ "MULTIMEDIA" ] = "no";
+ } else if( configCmdLine.at(i) == "-multimedia" ) {
+ dictionary[ "MULTIMEDIA" ] = "yes";
} else if( configCmdLine.at(i) == "-no-phonon" ) {
dictionary[ "PHONON" ] = "no";
} else if( configCmdLine.at(i) == "-phonon" ) {
@@ -1425,6 +1430,7 @@ bool Configure::displayHelp()
"[-no-openssl] [-no-dbus] [-dbus] [-dbus-linked] [-platform <spec>]\n"
"[-qtnamespace <namespace>] [-qtlibinfix <infix>] [-no-phonon]\n"
"[-phonon] [-no-phonon-backend] [-phonon-backend]\n"
+ "[-no-multimedia] [-multimedia]\n"
"[-no-webkit] [-webkit]\n"
"[-no-scripttools] [-scripttools]\n"
"[-graphicssystem raster|opengl]\n\n", 0, 7);
@@ -1599,6 +1605,8 @@ bool Configure::displayHelp()
desc("PHONON", "yes", "-phonon", "Compile the Phonon module (Phonon is built if a decent C++ compiler is used.)");
desc("PHONON_BACKEND","no", "-no-phonon-backend","Do not compile the platform-specific Phonon backend-plugin");
desc("PHONON_BACKEND","yes","-phonon-backend", "Compile in the platform-specific Phonon backend-plugin");
+ desc("MULTIMEDIA", "no", "-no-multimedia", "Do not compile the multimedia module");
+ desc("MULTIMEDIA", "yes","-multimedia", "Compile in multimedia module");
desc("WEBKIT", "no", "-no-webkit", "Do not compile in the WebKit module");
desc("WEBKIT", "yes", "-webkit", "Compile in the WebKit module (WebKit is built if a decent C++ compiler is used.)");
desc("SCRIPTTOOLS", "no", "-no-scripttools", "Do not build the QtScriptTools module.");
@@ -1867,6 +1875,8 @@ bool Configure::checkAvailability(const QString &part)
if (!findFile("msdmo.lib")) cout << "msdmo.lib not found" << endl;
if (!findFile("d3d9.h")) cout << "d3d9.h not found" << endl;
}
+ } else if (part == "MULTIMEDIA") {
+ available = true;
} else if (part == "WEBKIT") {
available = (dictionary.value("QMAKESPEC") == "win32-msvc2005") || (dictionary.value("QMAKESPEC") == "win32-msvc2008") || (dictionary.value("QMAKESPEC") == "win32-g++");
} else if (part == "SCRIPTTOOLS") {
@@ -2302,6 +2312,9 @@ void Configure::generateOutputVars()
qtConfig += "phonon-backend";
}
+ if (dictionary["MULTIMEDIA"] == "yes")
+ qtConfig += "multimedia";
+
if (dictionary["WEBKIT"] == "yes")
qtConfig += "webkit";
@@ -2662,6 +2675,7 @@ void Configure::generateConfigfiles()
if(dictionary["IPV6"] == "no") qconfigList += "QT_NO_IPV6";
if(dictionary["WEBKIT"] == "no") qconfigList += "QT_NO_WEBKIT";
if(dictionary["PHONON"] == "no") qconfigList += "QT_NO_PHONON";
+ if(dictionary["MULTIMEDIA"] == "no") qconfigList += "QT_NO_MULTIMEDIA";
if(dictionary["XMLPATTERNS"] == "no") qconfigList += "QT_NO_XMLPATTERNS";
if(dictionary["SCRIPTTOOLS"] == "no") qconfigList += "QT_NO_SCRIPTTOOLS";
@@ -2920,6 +2934,7 @@ void Configure::displayConfig()
cout << "QtDBus support.............." << dictionary[ "DBUS" ] << endl;
cout << "QtXmlPatterns support......." << dictionary[ "XMLPATTERNS" ] << endl;
cout << "Phonon support.............." << dictionary[ "PHONON" ] << endl;
+ cout << "Multimedia support.........." << dictionary[ "MULTIMEDIA" ] << endl;
cout << "WebKit support.............." << dictionary[ "WEBKIT" ] << endl;
cout << "QtScriptTools support......." << dictionary[ "SCRIPTTOOLS" ] << endl;
cout << "Graphics System............." << dictionary[ "GRAPHICS_SYSTEM" ] << endl;
diff --git a/tools/designer/src/components/buddyeditor/buddyeditor.cpp b/tools/designer/src/components/buddyeditor/buddyeditor.cpp
index 9984b0d86..d5c86700c 100644
--- a/tools/designer/src/components/buddyeditor/buddyeditor.cpp
+++ b/tools/designer/src/components/buddyeditor/buddyeditor.cpp
@@ -404,7 +404,7 @@ QWidget *BuddyEditor::findBuddy(QLabel *l, const QWidgetList &existingBuddies) c
const QRect geom = l->geometry();
const int y = geom.center().y();
QWidget *neighbour = 0;
- switch (QApplication::layoutDirection()) {
+ switch (l->layoutDirection()) {
case Qt::LeftToRight: { // Walk right to find next managed neighbour
const int xEnd = parent->size().width();
for (int x = geom.right() + 1; x < xEnd; x += DeltaX)
diff --git a/tools/designer/src/components/buddyeditor/buddyeditor_plugin.cpp b/tools/designer/src/components/buddyeditor/buddyeditor_plugin.cpp
index ff0c3c688..cf838a248 100644
--- a/tools/designer/src/components/buddyeditor/buddyeditor_plugin.cpp
+++ b/tools/designer/src/components/buddyeditor/buddyeditor_plugin.cpp
@@ -72,8 +72,9 @@ void BuddyEditorPlugin::initialize(QDesignerFormEditorInterface *core)
m_action = new QAction(tr("Edit Buddies"), this);
m_action->setObjectName(QLatin1String("__qt_edit_buddies_action"));
- m_action->setIcon(QIcon(core->resourceLocation() + QLatin1String("/buddytool.png")));
- m_action->setIcon(QIcon(core->resourceLocation() + QLatin1String("/buddytool.png")));
+ QIcon buddyIcon = QIcon::fromTheme("designer-edit-buddy",
+ QIcon(core->resourceLocation() + QLatin1String("/buddytool.png")));
+ m_action->setIcon(buddyIcon);
m_action->setEnabled(false);
setParent(core);
diff --git a/tools/designer/src/components/formeditor/default_actionprovider.cpp b/tools/designer/src/components/formeditor/default_actionprovider.cpp
index 42d1f81cd..41333f8e8 100644
--- a/tools/designer/src/components/formeditor/default_actionprovider.cpp
+++ b/tools/designer/src/components/formeditor/default_actionprovider.cpp
@@ -73,9 +73,8 @@ enum { indicatorSize = 2 };
// Position an indicator horizontally over the rectangle, indicating
// 'Insert before' (left or right according to layout direction)
-static inline QRect horizontalIndicatorRect(const QRect &rect)
+static inline QRect horizontalIndicatorRect(const QRect &rect, Qt::LayoutDirection layoutDirection)
{
- const Qt::LayoutDirection layoutDirection = QApplication::layoutDirection();
// Position right?
QRect rc = QRect(rect.x(), 0, indicatorSize, rect.height() - 1);
if (layoutDirection == Qt::RightToLeft)
@@ -91,13 +90,13 @@ static inline QRect verticalIndicatorRect(const QRect &rect)
// Determine the geometry of the indicator by retrieving
// the action under mouse and positioning the bar within its geometry.
-QRect ActionProviderBase::indicatorGeometry(const QPoint &pos) const
+QRect ActionProviderBase::indicatorGeometry(const QPoint &pos, Qt::LayoutDirection layoutDirection) const
{
QAction *action = actionAt(pos);
if (!action)
return QRect();
QRect rc = actionGeometry(action);
- return orientation() == Qt::Horizontal ? horizontalIndicatorRect(rc) : verticalIndicatorRect(rc);
+ return orientation() == Qt::Horizontal ? horizontalIndicatorRect(rc, layoutDirection) : verticalIndicatorRect(rc);
}
// Adjust the indicator while dragging. (-1,1) is called to finish a DND operation
@@ -107,7 +106,7 @@ void ActionProviderBase::adjustIndicator(const QPoint &pos)
m_indicator->hide();
return;
}
- const QRect ig = indicatorGeometry(pos);
+ const QRect ig = indicatorGeometry(pos, m_indicator->layoutDirection());
if (ig.isValid()) {
m_indicator->setGeometry(ig);
QPalette p = m_indicator->palette();
@@ -145,9 +144,9 @@ Qt::Orientation QToolBarActionProvider::orientation() const
return m_widget->orientation();
}
-QRect QToolBarActionProvider::indicatorGeometry(const QPoint &pos) const
+QRect QToolBarActionProvider::indicatorGeometry(const QPoint &pos, Qt::LayoutDirection layoutDirection) const
{
- const QRect actionRect = ActionProviderBase::indicatorGeometry(pos);
+ const QRect actionRect = ActionProviderBase::indicatorGeometry(pos, layoutDirection);
if (actionRect.isValid())
return actionRect;
// Toolbar differs in that is has no dummy placeholder to 'insert before'
@@ -155,7 +154,7 @@ QRect QToolBarActionProvider::indicatorGeometry(const QPoint &pos) const
const QRect freeArea = ToolBarEventFilter::freeArea(m_widget);
if (!freeArea.contains(pos))
return QRect();
- return orientation() == Qt::Horizontal ? horizontalIndicatorRect(freeArea) : verticalIndicatorRect(freeArea);
+ return orientation() == Qt::Horizontal ? horizontalIndicatorRect(freeArea, layoutDirection) : verticalIndicatorRect(freeArea);
}
// ------------- QMenuBarActionProvider
diff --git a/tools/designer/src/components/formeditor/default_actionprovider.h b/tools/designer/src/components/formeditor/default_actionprovider.h
index 3660f1107..270ea3601 100644
--- a/tools/designer/src/components/formeditor/default_actionprovider.h
+++ b/tools/designer/src/components/formeditor/default_actionprovider.h
@@ -66,7 +66,7 @@ public:
virtual Qt::Orientation orientation() const = 0;
protected:
- virtual QRect indicatorGeometry(const QPoint &pos) const;
+ virtual QRect indicatorGeometry(const QPoint &pos, Qt::LayoutDirection layoutDirection) const;
private:
QWidget *m_indicator;
@@ -84,7 +84,7 @@ public:
Qt::Orientation orientation() const;
protected:
- virtual QRect indicatorGeometry(const QPoint &pos) const;
+ virtual QRect indicatorGeometry(const QPoint &pos, Qt::LayoutDirection layoutDirection) const;
private:
QToolBar *m_widget;
diff --git a/tools/designer/src/components/formeditor/formwindowmanager.cpp b/tools/designer/src/components/formeditor/formwindowmanager.cpp
index 993bae905..a2a0a4053 100644
--- a/tools/designer/src/components/formeditor/formwindowmanager.cpp
+++ b/tools/designer/src/components/formeditor/formwindowmanager.cpp
@@ -443,7 +443,8 @@ void FormWindowManager::setupActions()
m_actionVerticalLayout->setEnabled(false);
connect(m_actionVerticalLayout, SIGNAL(triggered()), this, SLOT(createLayout()));
- QAction *actionFormLayout = new QAction(createIconSet(QLatin1String("editform.png")), tr("Lay Out in a &Form Layout"), this);
+ QIcon formIcon = QIcon::fromTheme("designer-form-layout", createIconSet(QLatin1String("editform.png")));
+ QAction *actionFormLayout = new QAction(formIcon, tr("Lay Out in a &Form Layout"), this);
actionFormLayout->setObjectName(QLatin1String("__qt_form_layout_action"));
actionFormLayout->setShortcut(Qt::CTRL + Qt::Key_6);
actionFormLayout->setStatusTip(tr("Lays out the selected widgets in a form layout"));
@@ -510,15 +511,30 @@ void FormWindowManager::setupActions()
m_actionUndo = m_undoGroup->createUndoAction(this);
m_actionUndo->setEnabled(false);
- m_actionUndo->setIcon(createIconSet(QLatin1String("undo.png")));
+
+ m_actionUndo->setIcon(QIcon::fromTheme("edit-undo", createIconSet(QLatin1String("undo.png"))));
m_actionRedo = m_undoGroup->createRedoAction(this);
m_actionRedo->setEnabled(false);
- m_actionRedo->setIcon(createIconSet(QLatin1String("redo.png")));
+ m_actionRedo->setIcon(QIcon::fromTheme("edit-redo", createIconSet(QLatin1String("redo.png"))));
m_actionShowFormWindowSettingsDialog = new QAction(tr("Form &Settings..."), this);
m_actionShowFormWindowSettingsDialog->setObjectName(QLatin1String("__qt_form_settings_action"));
connect(m_actionShowFormWindowSettingsDialog, SIGNAL(triggered()), this, SLOT(slotActionShowFormWindowSettingsDialog()));
m_actionShowFormWindowSettingsDialog->setEnabled(false);
+
+
+ m_actionCopy->setIcon(QIcon::fromTheme("edit-copy", m_actionCopy->icon()));
+ m_actionCut->setIcon(QIcon::fromTheme("edit-cut", m_actionCut->icon()));
+ m_actionPaste->setIcon(QIcon::fromTheme("edit-paste", m_actionPaste->icon()));
+
+ // These do not currently exist, but will allow theme authors to fill in the gaps
+ m_actionBreakLayout->setIcon(QIcon::fromTheme("designer-break-layout", m_actionBreakLayout->icon()));
+ m_actionGridLayout->setIcon(QIcon::fromTheme("designer-grid-layout", m_actionGridLayout->icon()));
+ m_actionHorizontalLayout->setIcon(QIcon::fromTheme("designer-horizontal-layout", m_actionHorizontalLayout->icon()));
+ m_actionVerticalLayout->setIcon(QIcon::fromTheme("designer-vertical-layout", m_actionVerticalLayout->icon()));
+ m_actionSplitHorizontal->setIcon(QIcon::fromTheme("designer-split-horizontal", m_actionSplitHorizontal->icon()));
+ m_actionSplitVertical->setIcon(QIcon::fromTheme("designer-split-vertical", m_actionSplitVertical->icon()));
+ m_actionAdjustSize->setIcon(QIcon::fromTheme("designer-adjust-size", m_actionAdjustSize->icon()));
}
void FormWindowManager::slotActionCutActivated()
diff --git a/tools/designer/src/components/lib/lib.pro b/tools/designer/src/components/lib/lib.pro
index 4515b6635..92cf387cf 100644
--- a/tools/designer/src/components/lib/lib.pro
+++ b/tools/designer/src/components/lib/lib.pro
@@ -24,7 +24,7 @@ QMAKE_TARGET_DESCRIPTION = Graphical user interface designer.
#load up the headers info
CONFIG += qt_install_headers
HEADERS_PRI = $$QT_BUILD_TREE/include/QtDesigner/headers.pri
-include($$HEADERS_PRI)|clear(HEADERS_PRI)
+include($$HEADERS_PRI, "", true)|clear(HEADERS_PRI)
#mac frameworks
mac:!static:contains(QT_CONFIG, qt_framework) {
diff --git a/tools/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp b/tools/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp
index e664ae7cf..a1130410f 100644
--- a/tools/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp
+++ b/tools/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp
@@ -72,7 +72,8 @@ void SignalSlotEditorPlugin::initialize(QDesignerFormEditorInterface *core)
m_action = new QAction(tr("Edit Signals/Slots"), this);
m_action->setObjectName(QLatin1String("__qt_edit_signals_slots_action"));
m_action->setShortcut(tr("F4"));
- QIcon icon(QIcon(core->resourceLocation() + QLatin1String("/signalslottool.png")));
+ QIcon icon = QIcon::fromTheme("designer-edit-signals",
+ QIcon(core->resourceLocation() + QLatin1String("/signalslottool.png")));
m_action->setIcon(icon);
m_action->setEnabled(false);
diff --git a/tools/designer/src/components/tabordereditor/tabordereditor_plugin.cpp b/tools/designer/src/components/tabordereditor/tabordereditor_plugin.cpp
index 9b051c9b9..ddddd083f 100644
--- a/tools/designer/src/components/tabordereditor/tabordereditor_plugin.cpp
+++ b/tools/designer/src/components/tabordereditor/tabordereditor_plugin.cpp
@@ -72,7 +72,9 @@ void TabOrderEditorPlugin::initialize(QDesignerFormEditorInterface *core)
m_action = new QAction(tr("Edit Tab Order"), this);
m_action->setObjectName(QLatin1String("_qt_edit_tab_order_action"));
- m_action->setIcon(QIcon(core->resourceLocation() + QLatin1String("/tabordertool.png")));
+ QIcon icon = QIcon::fromTheme("designer-edit-tabs",
+ QIcon(core->resourceLocation() + QLatin1String("/tabordertool.png")));
+ m_action->setIcon(icon);
m_action->setEnabled(false);
setParent(core);
diff --git a/tools/designer/src/designer/qdesigner_actions.cpp b/tools/designer/src/designer/qdesigner_actions.cpp
index c671386f8..567a13ea9 100644
--- a/tools/designer/src/designer/qdesigner_actions.cpp
+++ b/tools/designer/src/designer/qdesigner_actions.cpp
@@ -200,6 +200,10 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench)
#endif
m_previewManager(0)
{
+ m_newFormAction->setIcon(QIcon::fromTheme("document-new", m_newFormAction->icon()));
+ m_openFormAction->setIcon(QIcon::fromTheme("document-open", m_openFormAction->icon()));
+ m_saveFormAction->setIcon(QIcon::fromTheme("document-save", m_saveFormAction->icon()));
+
Q_ASSERT(m_core != 0);
qdesigner_internal::QDesignerFormWindowManager *ifwm = qobject_cast<qdesigner_internal::QDesignerFormWindowManager *>(m_core->formWindowManager());
Q_ASSERT(ifwm);
@@ -323,7 +327,8 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench)
shortcuts.append(QKeySequence(Qt::Key_Escape));
#endif
m_editWidgetsAction->setShortcuts(shortcuts);
- m_editWidgetsAction->setIcon(QIcon(m_core->resourceLocation() + QLatin1String("/widgettool.png")));
+ QIcon fallback(m_core->resourceLocation() + QLatin1String("/widgettool.png"));
+ m_editWidgetsAction->setIcon(QIcon::fromTheme("designer-edit-widget", fallback));
connect(m_editWidgetsAction, SIGNAL(triggered()), this, SLOT(editWidgetsSlot()));
m_editWidgetsAction->setChecked(true);
m_editWidgetsAction->setEnabled(false);
diff --git a/tools/designer/src/lib/lib.pro b/tools/designer/src/lib/lib.pro
index e0f2f2357..495976d21 100644
--- a/tools/designer/src/lib/lib.pro
+++ b/tools/designer/src/lib/lib.pro
@@ -34,7 +34,7 @@ QMAKE_TARGET_DESCRIPTION = Graphical user interface designer.
#load up the headers info
CONFIG += qt_install_headers
HEADERS_PRI = $$QT_BUILD_TREE/include/QtDesigner/headers.pri
-include($$HEADERS_PRI)|clear(HEADERS_PRI)
+include($$HEADERS_PRI, "", true)|clear(HEADERS_PRI)
#mac frameworks
mac:CONFIG += explicitlib
diff --git a/tools/designer/src/lib/shared/actioneditor.cpp b/tools/designer/src/lib/shared/actioneditor.cpp
index 1a236d6bd..a931b8aaf 100644
--- a/tools/designer/src/lib/shared/actioneditor.cpp
+++ b/tools/designer/src/lib/shared/actioneditor.cpp
@@ -147,7 +147,8 @@ ActionEditor::ActionEditor(QDesignerFormEditorInterface *core, QWidget *parent,
toolbar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
l->addWidget(toolbar);
// edit actions
- m_actionNew->setIcon(createIconSet(QLatin1String("filenew.png")));
+ QIcon documentNewIcon = QIcon::fromTheme("document-new", createIconSet(QLatin1String("filenew.png")));
+ m_actionNew->setIcon(documentNewIcon);
m_actionNew->setEnabled(false);
connect(m_actionNew, SIGNAL(triggered()), this, SLOT(slotNewAction()));
toolbar->addAction(m_actionNew);
@@ -156,15 +157,18 @@ ActionEditor::ActionEditor(QDesignerFormEditorInterface *core, QWidget *parent,
m_actionCut->setEnabled(false);
connect(m_actionCut, SIGNAL(triggered()), this, SLOT(slotCut()));
- m_actionCut->setIcon(createIconSet(QLatin1String("editcut.png")));
+ QIcon editCutIcon = QIcon::fromTheme("edit-cut", createIconSet(QLatin1String("editcut.png")));
+ m_actionCut->setIcon(editCutIcon);
m_actionCopy->setEnabled(false);
connect(m_actionCopy, SIGNAL(triggered()), this, SLOT(slotCopy()));
- m_actionCopy->setIcon(createIconSet(QLatin1String("editcopy.png")));
+ QIcon editCopyIcon = QIcon::fromTheme("edit-copy", createIconSet(QLatin1String("editcopy.png")));
+ m_actionCopy->setIcon(editCopyIcon);
toolbar->addAction(m_actionCopy);
connect(m_actionPaste, SIGNAL(triggered()), this, SLOT(slotPaste()));
- m_actionPaste->setIcon(createIconSet(QLatin1String("editpaste.png")));
+ QIcon editPasteIcon = QIcon::fromTheme("edit-paste", createIconSet(QLatin1String("editpaste.png")));
+ m_actionPaste->setIcon(editPasteIcon);
toolbar->addAction(m_actionPaste);
m_actionEdit->setEnabled(false);
@@ -172,7 +176,8 @@ ActionEditor::ActionEditor(QDesignerFormEditorInterface *core, QWidget *parent,
connect(m_actionNavigateToSlot, SIGNAL(triggered()), this, SLOT(navigateToSlotCurrentAction()));
- m_actionDelete->setIcon(createIconSet(QLatin1String("editdelete.png")));
+ QIcon editDeleteIcon = QIcon::fromTheme("edit-delete", createIconSet(QLatin1String("editdelete.png")));
+ m_actionDelete->setIcon(editDeleteIcon);
m_actionDelete->setEnabled(false);
connect(m_actionDelete, SIGNAL(triggered()), this, SLOT(slotDelete()));
toolbar->addAction(m_actionDelete);
@@ -243,7 +248,8 @@ QToolButton *ActionEditor::createConfigureMenuButton(const QString &t, QMenu **p
{
QToolButton *configureButton = new QToolButton;
QAction *configureAction = new QAction(t, configureButton);
- configureAction->setIcon(createIconSet(QLatin1String("configure.png")));
+ QIcon configureIcon = QIcon::fromTheme("document-properties", createIconSet(QLatin1String("configure.png")));
+ configureAction->setIcon(configureIcon);
QMenu *configureMenu = new QMenu;
configureAction->setMenu(configureMenu);
configureButton->setDefaultAction(configureAction);
diff --git a/tools/designer/src/lib/shared/actionprovider_p.h b/tools/designer/src/lib/shared/actionprovider_p.h
index b43dee993..5f9b7a011 100644
--- a/tools/designer/src/lib/shared/actionprovider_p.h
+++ b/tools/designer/src/lib/shared/actionprovider_p.h
@@ -86,7 +86,7 @@ template <class Widget>
// actionGeometry() can be wrong sometimes; it returns a geometry that
// stretches to the end of the toolbar/menu bar. So, check from the beginning
// in the case of a horizontal right-to-left orientation.
- const bool checkTopRight = orientation == Qt::Horizontal && QApplication::layoutDirection() == Qt::RightToLeft;
+ const bool checkTopRight = orientation == Qt::Horizontal && w->layoutDirection() == Qt::RightToLeft;
const QPoint topRight = QPoint(w->rect().width(), 0);
for (int index = 0; index < actionCount; ++index) {
QRect g = w->actionGeometry(actions.at(index));
diff --git a/tools/designer/src/lib/shared/qdesigner_menu.cpp b/tools/designer/src/lib/shared/qdesigner_menu.cpp
index c727d8e07..6aba65b98 100644
--- a/tools/designer/src/lib/shared/qdesigner_menu.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_menu.cpp
@@ -73,6 +73,19 @@ QT_BEGIN_NAMESPACE
using namespace qdesigner_internal;
+// give the user a little more space to click on the sub menu rectangle
+static inline void extendClickableArea(QRect *subMenuRect, Qt::LayoutDirection dir)
+{
+ switch (dir) {
+ case Qt::LeftToRight:
+ subMenuRect->setLeft(subMenuRect->left() - 20);
+ break;
+ case Qt::RightToLeft:
+ subMenuRect->setRight(subMenuRect->right() + 20);
+ break;
+ }
+}
+
QDesignerMenu::QDesignerMenu(QWidget *parent) :
QMenu(parent),
m_currentIndex(0),
@@ -325,8 +338,7 @@ bool QDesignerMenu::handleMouseDoubleClickEvent(QWidget *, QMouseEvent *event)
QRect pm_rect;
if (action->menu() || hasSubMenuPixmap(action)) {
pm_rect = subMenuPixmapRect(action);
- pm_rect.setLeft(pm_rect.left() - 20); // give the user a little more
- // space to click
+ extendClickableArea(&pm_rect, layoutDirection());
}
if (!pm_rect.contains(event->pos()) && m_currentIndex != -1)
@@ -381,7 +393,7 @@ bool QDesignerMenu::handleMousePressEvent(QWidget * /*widget*/, QMouseEvent *eve
QAction *action = safeActionAt(index);
QRect pm_rect = subMenuPixmapRect(action);
- pm_rect.setLeft(pm_rect.left() - 20); // give the user a little more space to click
+ extendClickableArea(&pm_rect, layoutDirection());
const int old_index = m_currentIndex;
m_currentIndex = index;
@@ -540,7 +552,7 @@ QRect QDesignerMenu::subMenuPixmapRect(QAction *action) const
{
static const QPixmap pm(QLatin1String(":/trolltech/formeditor/images/submenu.png"));
const QRect g = actionGeometry(action);
- const int x = g.right() - pm.width() - 2;
+ const int x = layoutDirection() == Qt::LeftToRight ? (g.right() - pm.width() - 2) : 2;
const int y = g.top() + (g.height() - pm.height())/2 + 1;
return QRect(x, y, pm.width(), pm.height());
}
@@ -863,38 +875,52 @@ void QDesignerMenu::closeMenuChain()
m_lastSubMenuIndex = -1;
}
-void QDesignerMenu::moveLeft()
+// Close submenu using the left/right keys according to layoutDirection().
+// Return false to indicate the event must be propagated to the menu bar.
+bool QDesignerMenu::hideSubMenuOnCursorKey()
{
if (parentMenu()) {
hide();
- } else {
- closeMenuChain();
- if (QDesignerMenuBar *mb = parentMenuBar()) {
- if (QApplication::layoutDirection() == Qt::LeftToRight)
- mb->moveLeft();
- else
- mb->moveRight();
- }
+ return true;
}
+ closeMenuChain();
update();
+ if (parentMenuBar())
+ return false;
+ return true;
}
-void QDesignerMenu::moveRight()
+// Open a submenu using the left/right keys according to layoutDirection().
+// Return false to indicate the event must be propagated to the menu bar.
+bool QDesignerMenu::showSubMenuOnCursorKey()
{
- QAction *action = currentAction();
+ const QAction *action = currentAction();
- if (qobject_cast<SpecialMenuAction*>(action) || action->isSeparator()) {
+ if (qobject_cast<const SpecialMenuAction*>(action) || action->isSeparator()) {
closeMenuChain();
- if (QDesignerMenuBar *mb = parentMenuBar()) {
- if (QApplication::layoutDirection() == Qt::LeftToRight)
- mb->moveRight();
- else
- mb->moveLeft();
- }
- } else {
- m_lastSubMenuIndex = -1; // force a refresh
- slotShowSubMenuNow();
+ if (parentMenuBar())
+ return false;
+ return true;
}
+ m_lastSubMenuIndex = -1; // force a refresh
+ slotShowSubMenuNow();
+ return true;
+}
+
+void QDesignerMenu::moveLeft()
+{
+ const bool handled = layoutDirection() == Qt::LeftToRight ?
+ hideSubMenuOnCursorKey() : showSubMenuOnCursorKey();
+ if (!handled)
+ parentMenuBar()->moveLeft();
+}
+
+void QDesignerMenu::moveRight()
+{
+ const bool handled = layoutDirection() == Qt::LeftToRight ?
+ showSubMenuOnCursorKey() : hideSubMenuOnCursorKey();
+ if (!handled)
+ parentMenuBar()->moveRight();
}
void QDesignerMenu::moveUp(bool ctrl)
@@ -1053,7 +1079,15 @@ void QDesignerMenu::slotShowSubMenuNow()
if ((menu->windowFlags() & Qt::Popup) != Qt::Popup)
menu->setWindowFlags(Qt::Popup);
const QRect g = actionGeometry(action);
- menu->move(mapToGlobal(g.topRight()));
+ if (layoutDirection() == Qt::LeftToRight) {
+ menu->move(mapToGlobal(g.topRight()));
+ } else {
+ // The position is not initially correct due to the unknown width,
+ // causing it to overlap a bit the first time it is invoked.
+ const QSize menuSize = menu->size();
+ QPoint point = g.topLeft() - QPoint(menu->width() + 10, 0);
+ menu->move(mapToGlobal(point));
+ }
menu->show();
menu->setFocus();
} else {
diff --git a/tools/designer/src/lib/shared/qdesigner_menu_p.h b/tools/designer/src/lib/shared/qdesigner_menu_p.h
index 55d8bcd58..93735e608 100644
--- a/tools/designer/src/lib/shared/qdesigner_menu_p.h
+++ b/tools/designer/src/lib/shared/qdesigner_menu_p.h
@@ -181,6 +181,9 @@ protected:
void selectCurrentAction();
private:
+ bool hideSubMenuOnCursorKey();
+ bool showSubMenuOnCursorKey();
+
QPoint m_startPosition;
int m_currentIndex;
QAction *m_addItem;
diff --git a/tools/designer/src/lib/shared/qdesigner_menubar.cpp b/tools/designer/src/lib/shared/qdesigner_menubar.cpp
index b53bb8d0b..2b19142e5 100644
--- a/tools/designer/src/lib/shared/qdesigner_menubar.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_menubar.cpp
@@ -219,18 +219,12 @@ bool QDesignerMenuBar::handleKeyPressEvent(QWidget *, QKeyEvent *e)
case Qt::Key_Left:
e->accept();
- if (QApplication::layoutDirection() == Qt::LeftToRight)
- moveLeft(e->modifiers() & Qt::ControlModifier);
- else
- moveRight(e->modifiers() & Qt::ControlModifier);
+ moveLeft(e->modifiers() & Qt::ControlModifier);
return true;
case Qt::Key_Right:
e->accept();
- if (QApplication::layoutDirection() == Qt::LeftToRight)
- moveRight(e->modifiers() & Qt::ControlModifier);
- else
- moveLeft(e->modifiers() & Qt::ControlModifier);
+ moveRight(e->modifiers() & Qt::ControlModifier);
return true; // no update
case Qt::Key_Up:
@@ -741,28 +735,48 @@ int QDesignerMenuBar::realActionCount() const
return actions().count() - 1; // 1 fake actions
}
-void QDesignerMenuBar::moveLeft(bool ctrl)
+bool QDesignerMenuBar::dragging() const
{
- if (ctrl)
- (void) swap(m_currentIndex, m_currentIndex - 1);
-
- m_currentIndex = qMax(0, --m_currentIndex);
- // Always re-select, swapping destroys order
- updateCurrentAction(true);
+ return m_dragging;
}
-bool QDesignerMenuBar::dragging() const
+void QDesignerMenuBar::moveLeft(bool ctrl)
{
- return m_dragging;
+ if (layoutDirection() == Qt::LeftToRight) {
+ movePrevious(ctrl);
+ } else {
+ moveNext(ctrl);
+ }
}
void QDesignerMenuBar::moveRight(bool ctrl)
{
- if (ctrl)
- (void) swap(m_currentIndex + 1, m_currentIndex);
+ if (layoutDirection() == Qt::LeftToRight) {
+ moveNext(ctrl);
+ } else {
+ movePrevious(ctrl);
+ }
+}
+
+void QDesignerMenuBar::movePrevious(bool ctrl)
+{
+ const bool swapped = ctrl && swapActions(m_currentIndex, m_currentIndex - 1);
+ const int newIndex = qMax(0, m_currentIndex - 1);
+ // Always re-select, swapping destroys order
+ if (swapped || newIndex != m_currentIndex) {
+ m_currentIndex = newIndex;
+ updateCurrentAction(true);
+ }
+}
- m_currentIndex = qMin(actions().count() - 1, ++m_currentIndex);
- updateCurrentAction(!ctrl);
+void QDesignerMenuBar::moveNext(bool ctrl)
+{
+ const bool swapped = ctrl && swapActions(m_currentIndex + 1, m_currentIndex);
+ const int newIndex = qMin(actions().count() - 1, m_currentIndex + 1);
+ if (swapped || newIndex != m_currentIndex) {
+ m_currentIndex = newIndex;
+ updateCurrentAction(!ctrl);
+ }
}
void QDesignerMenuBar::moveUp()
@@ -869,7 +883,7 @@ QAction *QDesignerMenuBar::safeActionAt(int index) const
return actions().at(index);
}
-bool QDesignerMenuBar::swap(int a, int b)
+bool QDesignerMenuBar::swapActions(int a, int b)
{
const int left = qMin(a, b);
int right = qMax(a, b);
diff --git a/tools/designer/src/lib/shared/qdesigner_menubar_p.h b/tools/designer/src/lib/shared/qdesigner_menubar_p.h
index 97a655b8f..fb820e1c3 100644
--- a/tools/designer/src/lib/shared/qdesigner_menubar_p.h
+++ b/tools/designer/src/lib/shared/qdesigner_menubar_p.h
@@ -155,10 +155,12 @@ protected:
QAction *safeActionAt(int index) const;
- bool swap(int a, int b);
+ bool swapActions(int a, int b);
private:
void updateCurrentAction(bool selectAction);
+ void movePrevious(bool ctrl);
+ void moveNext(bool ctrl);
QAction *m_addMenu;
QPointer<QMenu> m_activeMenu;
diff --git a/tools/designer/src/lib/shared/qdesigner_toolbar.cpp b/tools/designer/src/lib/shared/qdesigner_toolbar.cpp
index 269345241..8c0c61d02 100644
--- a/tools/designer/src/lib/shared/qdesigner_toolbar.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_toolbar.cpp
@@ -466,7 +466,7 @@ QRect ToolBarEventFilter::freeArea(const QToolBar *tb)
QRect exclusionRectangle = actionList.empty() ? handleArea(tb) : tb->actionGeometry(actionList.back());
switch (tb->orientation()) {
case Qt::Horizontal:
- switch (QApplication::layoutDirection()) {
+ switch (tb->layoutDirection()) {
case Qt::LeftToRight:
rc.setX(exclusionRectangle.right() + 1);
break;
diff --git a/tools/designer/src/lib/shared/qtresourceview.cpp b/tools/designer/src/lib/shared/qtresourceview.cpp
index 40be3e60e..f55f7ae7b 100644
--- a/tools/designer/src/lib/shared/qtresourceview.cpp
+++ b/tools/designer/src/lib/shared/qtresourceview.cpp
@@ -582,17 +582,21 @@ QtResourceView::QtResourceView(QDesignerFormEditorInterface *core, QWidget *pare
{
d_ptr->q_ptr = this;
- d_ptr->m_editResourcesAction = new QAction(qdesigner_internal::createIconSet(QLatin1String("edit.png")), tr("Edit Resources..."), this);
+ QIcon editIcon = QIcon::fromTheme("document-properties", qdesigner_internal::createIconSet(QLatin1String("edit.png")));
+ d_ptr->m_editResourcesAction = new QAction(editIcon, tr("Edit Resources..."), this);
d_ptr->m_toolBar->addAction(d_ptr->m_editResourcesAction);
connect(d_ptr->m_editResourcesAction, SIGNAL(triggered()), this, SLOT(slotEditResources()));
d_ptr->m_editResourcesAction->setEnabled(false);
- d_ptr->m_reloadResourcesAction = new QAction(qdesigner_internal::createIconSet(QLatin1String("reload.png")), tr("Reload"), this);
+ QIcon refreshIcon = QIcon::fromTheme("view-refresh", qdesigner_internal::createIconSet(QLatin1String("reload.png")));
+ d_ptr->m_reloadResourcesAction = new QAction(refreshIcon, tr("Reload"), this);
+
d_ptr->m_toolBar->addAction(d_ptr->m_reloadResourcesAction);
connect(d_ptr->m_reloadResourcesAction, SIGNAL(triggered()), this, SLOT(slotReloadResources()));
d_ptr->m_reloadResourcesAction->setEnabled(false);
- d_ptr->m_copyResourcePathAction = new QAction(qdesigner_internal::createIconSet(QLatin1String("editcopy.png")), tr("Copy Path"), this);
+ QIcon copyIcon = QIcon::fromTheme("edit-copy", qdesigner_internal::createIconSet(QLatin1String("editcopy.png")));
+ d_ptr->m_copyResourcePathAction = new QAction(copyIcon, tr("Copy Path"), this);
connect(d_ptr->m_copyResourcePathAction, SIGNAL(triggered()), this, SLOT(slotCopyResourcePath()));
d_ptr->m_copyResourcePathAction->setEnabled(false);
diff --git a/tools/designer/src/uitools/uitools.pro b/tools/designer/src/uitools/uitools.pro
index a20abf0b2..34e487758 100644
--- a/tools/designer/src/uitools/uitools.pro
+++ b/tools/designer/src/uitools/uitools.pro
@@ -22,7 +22,7 @@ include(../lib/uilib/uilib.pri)
HEADERS += quiloader.h
SOURCES += quiloader.cpp
-include($$QT_BUILD_TREE/include/QtUiTools/headers.pri)
+include($$QT_BUILD_TREE/include/QtUiTools/headers.pri, "", true)
quitools_headers.files = $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES
quitools_headers.path = $$[QT_INSTALL_HEADERS]/QtUiTools
INSTALLS += quitools_headers
diff --git a/tools/linguist/linguist/mainwindow.cpp b/tools/linguist/linguist/mainwindow.cpp
index bb79b1916..22ff46a6e 100644
--- a/tools/linguist/linguist/mainwindow.cpp
+++ b/tools/linguist/linguist/mainwindow.cpp
@@ -482,9 +482,9 @@ MainWindow::MainWindow()
readConfig();
m_statistics = 0;
- connect(m_ui.actionLenghtVariants, SIGNAL(toggled(bool)),
- m_messageEditor, SLOT(setLenghtVariants(bool)));
- m_messageEditor->setLenghtVariants(m_ui.actionLenghtVariants->isChecked());
+ connect(m_ui.actionLengthVariants, SIGNAL(toggled(bool)),
+ m_messageEditor, SLOT(setLengthVariants(bool)));
+ m_messageEditor->setLengthVariants(m_ui.actionLengthVariants->isChecked());
m_focusWatcher = new FocusWatcher(m_messageEditor, this);
m_contextView->installEventFilter(m_focusWatcher);
@@ -2521,7 +2521,7 @@ void MainWindow::readConfig()
config.value(settingPath("Validators/PhraseMatch"), true).toBool());
m_ui.actionPlaceMarkerMatches->setChecked(
config.value(settingPath("Validators/PlaceMarkers"), true).toBool());
- m_ui.actionLenghtVariants->setChecked(
+ m_ui.actionLengthVariants->setChecked(
config.value(settingPath("Options/LengthVariants"), false).toBool());
recentFiles().readConfig();
@@ -2548,7 +2548,7 @@ void MainWindow::writeConfig()
config.setValue(settingPath("Validators/PlaceMarkers"),
m_ui.actionPlaceMarkerMatches->isChecked());
config.setValue(settingPath("Options/LengthVariants"),
- m_ui.actionLenghtVariants->isChecked());
+ m_ui.actionLengthVariants->isChecked());
config.setValue(settingPath("MainWindowState"),
saveState());
recentFiles().writeConfig();
diff --git a/tools/linguist/linguist/mainwindow.ui b/tools/linguist/linguist/mainwindow.ui
index 613241bb0..9dfb1fff1 100644
--- a/tools/linguist/linguist/mainwindow.ui
+++ b/tools/linguist/linguist/mainwindow.ui
@@ -116,7 +116,7 @@
<addaction name="actionResetSorting"/>
<addaction name="actionDisplayGuesses"/>
<addaction name="actionStatistics"/>
- <addaction name="actionLenghtVariants"/>
+ <addaction name="actionLengthVariants"/>
<addaction name="separator"/>
<addaction name="menuToolbars"/>
<addaction name="menuViewViews"/>
@@ -878,12 +878,12 @@
<string>Ctrl+W</string>
</property>
</action>
- <action name="actionLenghtVariants">
+ <action name="actionLengthVariants">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
- <string>Lenght Variants</string>
+ <string>Length Variants</string>
</property>
</action>
</widget>
diff --git a/tools/linguist/linguist/messageeditor.cpp b/tools/linguist/linguist/messageeditor.cpp
index 9e598a804..e9113897e 100644
--- a/tools/linguist/linguist/messageeditor.cpp
+++ b/tools/linguist/linguist/messageeditor.cpp
@@ -710,7 +710,7 @@ void MessageEditor::setEditingEnabled(int model, bool enabled)
updateCanPaste();
}
-void MessageEditor::setLenghtVariants(bool on)
+void MessageEditor::setLengthVariants(bool on)
{
m_lengthVariants = on;
foreach (const MessageEditorData &ed, m_editors)
diff --git a/tools/linguist/linguist/messageeditor.h b/tools/linguist/linguist/messageeditor.h
index 410603694..b195a04db 100644
--- a/tools/linguist/linguist/messageeditor.h
+++ b/tools/linguist/linguist/messageeditor.h
@@ -110,7 +110,7 @@ public slots:
void beginFromSource();
void setEditorFocus();
void setTranslation(int latestModel, const QString &translation);
- void setLenghtVariants(bool on);
+ void setLengthVariants(bool on);
private slots:
void editorCreated(QTextEdit *);
diff --git a/tools/linguist/shared/profileevaluator.cpp b/tools/linguist/shared/profileevaluator.cpp
index 5a9095a04..fe2206789 100644
--- a/tools/linguist/shared/profileevaluator.cpp
+++ b/tools/linguist/shared/profileevaluator.cpp
@@ -256,10 +256,8 @@ public:
ProFile *m_prevProFile; // See m_prevLineNo
};
-#if (!defined(__GNUC__) || __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3)) && !defined(__SUNPRO_CC)
Q_DECLARE_TYPEINFO(ProFileEvaluator::Private::State, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(ProFileEvaluator::Private::ProLoop, Q_MOVABLE_TYPE);
-#endif
ProFileEvaluator::Private::Private(ProFileEvaluator *q_)
: q(q_)
diff --git a/tools/linguist/shared/profileevaluator.h b/tools/linguist/shared/profileevaluator.h
index f3498c1c5..ba525b2e8 100644
--- a/tools/linguist/shared/profileevaluator.h
+++ b/tools/linguist/shared/profileevaluator.h
@@ -50,10 +50,21 @@
#include <QtCore/QStringList>
#include <QtCore/QStack>
+#if (!defined(__GNUC__) || __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3)) && !defined(__SUNPRO_CC)
+# define HAVE_TEMPLATE_CLASS_FRIENDS
+#endif
+
QT_BEGIN_NAMESPACE
class ProFileEvaluator
{
+#ifdef HAVE_TEMPLATE_CLASS_FRIENDS
+private:
+#else
+public:
+#endif
+ class Private;
+
public:
enum TemplateType {
TT_Unknown = 0,
@@ -93,11 +104,11 @@ public:
virtual void fileMessage(const QString &msg); // error() and message() from .pro file
private:
- class Private;
Private *d;
- // This doesn't help gcc 3.3 and sunpro ...
+#ifdef HAVE_TEMPLATE_CLASS_FRIENDS
template<typename T> friend class QTypeInfo;
+#endif
};
QT_END_NAMESPACE
diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp
index 562684b4d..12ec7f3a9 100644
--- a/tools/qdoc3/cppcodeparser.cpp
+++ b/tools/qdoc3/cppcodeparser.cpp
@@ -1737,6 +1737,9 @@ bool CppCodeParser::matchProperty(InnerNode *parent)
property->setDesignable(value.toLower() == "true");
else if (key == "RESET")
tre->addPropertyFunction(property, value, PropertyNode::Resetter);
+ else if (key == "NOTIFY") {
+ tre->addPropertyFunction(property, value, PropertyNode::Notifier);
+ }
}
match(Tok_RightParen);
return true;
diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp
index e92f53b45..9538dfe75 100644
--- a/tools/qdoc3/generator.cpp
+++ b/tools/qdoc3/generator.cpp
@@ -283,7 +283,7 @@ bool Generator::generateText(const Text& text,
bool Generator::generateQmlText(const Text& text,
const Node *relative,
CodeMarker *marker,
- const QString& qmlName)
+ const QString& /* qmlName */ )
{
const Atom* atom = text.firstAtom();
if (atom == 0)
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp
index 425c50b12..c203c6258 100644
--- a/tools/qdoc3/htmlgenerator.cpp
+++ b/tools/qdoc3/htmlgenerator.cpp
@@ -539,16 +539,14 @@ int HtmlGenerator::generateAtom(const Atom *atom,
break;
case Atom::AnnotatedList:
{
- const FakeNode *fake = static_cast<const FakeNode *>(relative);
- if (fake && !fake->groupMembers().isEmpty()) {
- QList<Node*> values = tre->groups().values(atom->string());
- QMap<QString, const Node*> nodeMap;
- for (int i = 0; i < values.size(); ++i) {
- const Node* n = values.at(i);
+ QList<Node*> values = tre->groups().values(atom->string());
+ QMap<QString, const Node*> nodeMap;
+ for (int i = 0; i < values.size(); ++i) {
+ const Node* n = values.at(i);
+ if ((n->status() != Node::Internal) && (n->access() != Node::Private))
nodeMap.insert(n->name(),n);
- }
- generateAnnotatedList(fake, marker, nodeMap);
}
+ generateAnnotatedList(relative, marker, nodeMap);
}
break;
case Atom::GeneratedList:
@@ -2021,8 +2019,8 @@ void HtmlGenerator::generateCompactList(const Node *relative,
assume that NumParagraphs is 37. Each paragraph is a
QMap<QString, const Node *>.
*/
- QMap<QString, const Node *> paragraph[NumParagraphs];
- QString paragraphName[NumParagraphs];
+ QMap<QString, const Node *> paragraph[NumParagraphs+1];
+ QString paragraphName[NumParagraphs+1];
QMap<QString, const Node *>::ConstIterator c = classMap.begin();
while (c != classMap.end()) {
@@ -2055,22 +2053,22 @@ void HtmlGenerator::generateCompactList(const Node *relative,
We now want to compute the paragraph offset. Paragraphs 0 to 6
start at offsets 0, 3, 4, 8, 9, 14, 23.
*/
- int paragraphOffset[NumParagraphs + 1];
+ int paragraphOffset[NumParagraphs + 1]; // 37 + 1
int i, j, k;
paragraphOffset[0] = 0;
- for (j = 0; j < NumParagraphs; j++)
+ for (j = 0; j < NumParagraphs; j++) // j = 0..36
paragraphOffset[j + 1] = paragraphOffset[j] + paragraph[j].count();
- int firstOffset[NumColumns + 1];
- int currentOffset[NumColumns];
- int currentParagraphNo[NumColumns];
- int currentOffsetInParagraph[NumColumns];
+ int firstOffset[NumColumns + 1]; // 4 + 1
+ int currentOffset[NumColumns]; // 4
+ int currentParagraphNo[NumColumns]; // 4
+ int currentOffsetInParagraph[NumColumns]; // 4
int numRows = (classMap.count() + NumColumns - 1) / NumColumns;
int curParagNo = 0;
- for (i = 0; i < NumColumns; i++) {
+ for (i = 0; i < NumColumns; i++) { // i = 0..3
firstOffset[i] = qMin(i * numRows, classMap.size());
currentOffset[i] = firstOffset[i];
@@ -2095,11 +2093,18 @@ void HtmlGenerator::generateCompactList(const Node *relative,
out() << "<td>\n</td>\n";
}
else {
- while (currentOffsetInParagraph[i] == paragraph[currentParagraphNo[i]].count()) {
+ while ((currentParagraphNo[i] < NumParagraphs) &&
+ (currentOffsetInParagraph[i] == paragraph[currentParagraphNo[i]].count())) {
++currentParagraphNo[i];
currentOffsetInParagraph[i] = 0;
}
-
+#if 0
+ if (currentParagraphNo[i] >= NumParagraphs) {
+ qDebug() << "### Internal error ###" << __FILE__ << __LINE__
+ << currentParagraphNo[i] << NumParagraphs;
+ currentParagraphNo[i] = NumParagraphs - 1;
+ }
+#endif
out() << "<td align=\"right\">";
if (currentOffsetInParagraph[i] == 0) {
// start a new paragraph
@@ -2109,7 +2114,8 @@ void HtmlGenerator::generateCompactList(const Node *relative,
}
out() << "</td>\n";
- if (!paragraphName[currentParagraphNo[i]].isEmpty()) {
+ if ((currentParagraphNo[i] < NumParagraphs) &&
+ !paragraphName[currentParagraphNo[i]].isEmpty()) {
QMap<QString, const Node *>::Iterator it;
it = paragraph[currentParagraphNo[i]].begin();
for (j = 0; j < currentOffsetInParagraph[i]; j++)
@@ -3414,6 +3420,14 @@ void HtmlGenerator::generateDetailedMember(const Node *node,
out() << "<p><b>Access functions:</b></p>\n";
generateSectionList(section, node, marker, CodeMarker::Accessors);
}
+
+ Section notifiers;
+ notifiers.members += property->notifiers();
+
+ if (!notifiers.members.isEmpty()) {
+ out() << "<p><b>Notifier signal:</b></p>\n";
+ generateSectionList(notifiers, node, marker, CodeMarker::Accessors);
+ }
}
else if (node->type() == Node::Enum) {
const EnumNode *enume = static_cast<const EnumNode *>(node);
@@ -3708,12 +3722,6 @@ QString HtmlGenerator::getLink(const Atom *atom,
}
inObsoleteLink = true;
}
-#if 0
- qDebug() << "Link to Obsolete entity"
- << (*node)->name();
- qDebug() << " relative entity"
- << relative->name();
-#endif
}
}
}
@@ -3729,8 +3737,6 @@ QString HtmlGenerator::getLink(const Atom *atom,
else if ((*node)->status() == Node::Internal) {
qDebug() << "Link to Internal entity";
}
- //else
- //qDebug() << "Node Status:" << (*node)->status();
#endif
}
@@ -4014,10 +4020,6 @@ void HtmlGenerator::generateQmlInherits(const QmlClassNode* cn,
generateText(text, cn, marker);
out() << "</p>";
}
-// else
-// qDebug() << "generateQmlInherits(): "
-// << "Inherited element not documented -->"
-// << linkPair.first;
}
}
}
diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h
index 17ec4479c..61f2a76d8 100644
--- a/tools/qdoc3/node.h
+++ b/tools/qdoc3/node.h
@@ -590,8 +590,8 @@ class FunctionNode : public LeafNode
class PropertyNode : public LeafNode
{
public:
- enum FunctionRole { Getter, Setter, Resetter };
- enum { NumFunctionRoles = Resetter + 1 };
+ enum FunctionRole { Getter, Setter, Resetter, Notifier };
+ enum { NumFunctionRoles = Notifier + 1 };
PropertyNode(InnerNode *parent, const QString& name);
virtual ~PropertyNode() { }
@@ -609,6 +609,7 @@ class PropertyNode : public LeafNode
NodeList getters() const { return functions(Getter); }
NodeList setters() const { return functions(Setter); }
NodeList resetters() const { return functions(Resetter); }
+ NodeList notifiers() const { return functions(Notifier); }
bool isStored() const { return fromTrool(sto, storedDefault()); }
bool isDesignable() const { return fromTrool(des, designableDefault()); }
const PropertyNode *overriddenFrom() const { return overrides; }
diff --git a/tools/qdoc3/tree.cpp b/tools/qdoc3/tree.cpp
index d75af70ee..a5e22f1c0 100644
--- a/tools/qdoc3/tree.cpp
+++ b/tools/qdoc3/tree.cpp
@@ -485,6 +485,7 @@ void Tree::resolveProperties()
QString getterName = (*propEntry)[PropertyNode::Getter];
QString setterName = (*propEntry)[PropertyNode::Setter];
QString resetterName = (*propEntry)[PropertyNode::Resetter];
+ QString notifierName = (*propEntry)[PropertyNode::Notifier];
NodeList::ConstIterator c = parent->childNodes().begin();
while (c != parent->childNodes().end()) {
@@ -499,6 +500,8 @@ void Tree::resolveProperties()
property->addFunction(function, PropertyNode::Setter);
} else if (function->name() == resetterName) {
property->addFunction(function, PropertyNode::Resetter);
+ } else if (function->name() == notifierName) {
+ property->addFunction(function, PropertyNode::Notifier);
}
}
}
@@ -575,10 +578,12 @@ void Tree::resolveGroups()
if (fake && fake->subType() == Node::Group) {
fake->addGroupMember(i.value());
}
+#if 0
else {
if (prevGroup != i.key())
i.value()->doc().location().warning(tr("No such group '%1'").arg(i.key()));
}
+#endif
prevGroup = i.key();
}
diff --git a/tools/qtestlib/wince/cetcpsync/cetcpsync.pro b/tools/qtestlib/wince/cetcpsync/cetcpsync.pro
new file mode 100644
index 000000000..d1d7c999a
--- /dev/null
+++ b/tools/qtestlib/wince/cetcpsync/cetcpsync.pro
@@ -0,0 +1,22 @@
+TARGET = cetcpsync
+DESTDIR = ../../../../bin
+CONFIG += console
+CONFIG -= app_bundle
+QT += network
+QT -= gui
+TEMPLATE = app
+
+build_all:!build_pass {
+ CONFIG -= build_all
+ CONFIG += release
+}
+
+INCLUDEPATH += ../cetcpsyncserver
+
+SOURCES += main.cpp \
+ remoteconnection.cpp \
+ qtcesterconnection.cpp
+
+HEADERS += \
+ remoteconnection.h \
+ qtcesterconnection.h
diff --git a/tools/qtestlib/wince/cetcpsync/main.cpp b/tools/qtestlib/wince/cetcpsync/main.cpp
new file mode 100644
index 000000000..73c7350de
--- /dev/null
+++ b/tools/qtestlib/wince/cetcpsync/main.cpp
@@ -0,0 +1,191 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <iostream>
+#include "qtcesterconnection.h"
+
+using namespace std;
+
+static void showUsage()
+{
+ cout << "cetcpsync is meant to be used by cetest internally." << endl
+ << "For usage instructions remoteconnection.h could be useful." << endl;
+}
+
+const int debugLevel = 0;
+void debugOutput(const QString& text, int level)
+{
+ if (level <= debugLevel)
+ cout << qPrintable(text) << endl;
+}
+
+class Exception
+{
+public:
+ Exception(const QString& msg = QString())
+ : m_message(msg)
+ {}
+
+ QString message() { return m_message; }
+
+protected:
+ QString m_message;
+};
+
+class TooFewParametersException : public Exception
+{
+public:
+ TooFewParametersException(const QLatin1String& cmd, int expectedParameterCount)
+ {
+ m_message = QLatin1String("Command ") + cmd + QLatin1String(" needs at least ");
+ m_message.append(QString::number(expectedParameterCount));
+ m_message.append(QLatin1String(" parameters."));
+ }
+};
+
+static void fileTimeFromString(FILETIME& ft, const QString& str)
+{
+ int idx = str.indexOf("*");
+ if (idx <= 0)
+ return;
+ ft.dwLowDateTime = str.left(idx).toULong();
+ ft.dwHighDateTime = str.mid(idx+1).toULong();
+}
+
+static QString fileTimeToString(FILETIME& ft)
+{
+ return QString::number(ft.dwLowDateTime) + "*" + QString::number(ft.dwHighDateTime);
+}
+
+static int execCommand(const QLatin1String& cmd, int argc, char* argv[])
+{
+ int retval = 0;
+ bool success = true;
+ QtCesterConnection connection;
+ if (cmd == "copyFileToDevice") {
+ if (argc < 3)
+ throw TooFewParametersException(cmd, 3);
+ success = connection.copyFileToDevice(argv[0], argv[1], argv[2] == "true");
+ } else if (cmd == "copyDirectoryToDevice") {
+ if (argc < 3)
+ throw TooFewParametersException(cmd, 3);
+ success = connection.copyDirectoryToDevice(argv[0], argv[1], argv[2] == "true");
+ } else if (cmd == "copyFileFromDevice") {
+ if (argc < 3)
+ throw TooFewParametersException(cmd, 3);
+ success = connection.copyFileFromDevice(argv[0], argv[1], argv[2] == "true");
+ } else if (cmd == "copyDirectoryFromDevice") {
+ if (argc < 3)
+ throw TooFewParametersException(cmd, 3);
+ success = connection.copyDirectoryFromDevice(argv[0], argv[1], argv[2] == "true");
+ } else if (cmd == "timeStampForLocalFileTime") {
+ if (argc < 1)
+ throw TooFewParametersException(cmd, 1);
+ FILETIME ft;
+ fileTimeFromString(ft, argv[0]);
+ success = connection.timeStampForLocalFileTime(&ft);
+ if (success)
+ cout << qPrintable(fileTimeToString(ft));
+ } else if (cmd == "fileCreationTime") {
+ if (argc < 1)
+ throw TooFewParametersException(cmd, 1);
+ FILETIME ft;
+ success = connection.fileCreationTime(argv[0], &ft);
+ if (success)
+ cout << qPrintable(fileTimeToString(ft));
+ } else if (cmd == "copyFile") {
+ if (argc < 3)
+ throw TooFewParametersException(cmd, 3);
+ success = connection.copyFile(argv[0], argv[1], argv[2] == "true");
+ } else if (cmd == "copyDirectory") {
+ if (argc < 3)
+ throw TooFewParametersException(cmd, 3);
+ success = connection.copyDirectory(argv[0], argv[1], argv[2] == "true");
+ } else if (cmd == "deleteFile") {
+ if (argc < 1)
+ throw TooFewParametersException(cmd, 1);
+ success = connection.deleteFile(argv[0]);
+ } else if (cmd == "deleteDirectory") {
+ if (argc < 3)
+ throw TooFewParametersException(cmd, 3);
+ success = connection.deleteDirectory(argv[0], argv[1] == "true", argv[2] == "true");
+ } else if (cmd == "moveFile") {
+ if (argc < 3)
+ throw TooFewParametersException(cmd, 3);
+ success = connection.moveFile(argv[0], argv[1], argv[2] == "true");
+ } else if (cmd == "moveDirectory") {
+ if (argc < 3)
+ throw TooFewParametersException(cmd, 3);
+ success = connection.moveDirectory(argv[0], argv[1], argv[2] == "true");
+ } else if (cmd == "createDirectory") {
+ if (argc < 2)
+ throw TooFewParametersException(cmd, 2);
+ success = connection.createDirectory(argv[0], argv[1] == "true");
+ } else if (cmd == "execute") {
+ if (argc < 3)
+ throw TooFewParametersException(cmd, 3);
+ int timeout = QString(argv[2]).toInt();
+ success = connection.execute(argv[0], argv[1], timeout, &retval);
+ } else if (cmd == "noop") {
+ // do nothing :)
+ success = true;
+ } else {
+ throw Exception("unknown command");
+ }
+
+ return success ? retval : 1;
+}
+
+int main(int argc, char *argv[])
+{
+ if (argc <= 1) {
+ showUsage();
+ return 0;
+ }
+
+ QLatin1String param(argv[1]);
+ int result = 1;
+ try {
+ result = execCommand(param, argc - 2, argv + 2);
+ } catch (Exception e) {
+ cerr << "Error: " << qPrintable(e.message());
+ }
+ return result;
+}
diff --git a/tools/qtestlib/wince/cetcpsync/qtcesterconnection.cpp b/tools/qtestlib/wince/cetcpsync/qtcesterconnection.cpp
new file mode 100644
index 000000000..76d3b4bbd
--- /dev/null
+++ b/tools/qtestlib/wince/cetcpsync/qtcesterconnection.cpp
@@ -0,0 +1,552 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "qtcesterconnection.h"
+#include <transfer_global.h>
+#include <QtCore/QDir>
+#include <QtCore/QFile>
+#include <QtCore/QFileInfo>
+#include <QtNetwork/QTcpSocket>
+#include <QtNetwork/QHostAddress>
+
+extern void debugOutput(const QString& text, int level);
+
+#pragma warning(disable:4996)
+
+#define END_ERROR(s, a) \
+ if(a) qDebug() << a; \
+ _freeSocket(s); \
+ return false;
+
+QtCesterConnection::QtCesterConnection()
+ : AbstractRemoteConnection()
+{
+}
+
+QtCesterConnection::~QtCesterConnection()
+{
+}
+
+bool QtCesterConnection::connect(QVariantList&)
+{
+ // We connect with each command, so this is always true
+ // The command itself will fail then
+ connected = true;
+ return true;
+}
+
+void QtCesterConnection::disconnect()
+{
+ connected = false;
+}
+
+bool QtCesterConnection::isConnected() const
+{
+ return connected;
+}
+
+bool QtCesterConnection::copyFileToDevice(const QString &localSource, const QString &deviceDest, bool failIfExists)
+{
+ debugOutput( qPrintable(QString::fromLatin1("Copy File: %1 -> %2").arg(localSource).arg(deviceDest)),0);
+ QFile localFile(localSource);
+ QFileInfo info(localSource);
+ if (!localFile.exists() || !localFile.open(QIODevice::ReadOnly)) {
+ qDebug() << "Could not open File!";
+ return false;
+ }
+
+ QTcpSocket* socket = 0;
+ if (!_initCommand(socket, COMMAND_CREATE_FILE)) {
+ END_ERROR(socket, "Could not initialized command");
+ }
+
+ CreateFileOptions option;
+ strcpy(option.fileName, qPrintable(deviceDest));
+#ifdef Q_OS_WIN
+ // Copy FileTime for update verification
+ FILETIME creationTime, accessTime, writeTime;
+ HANDLE localHandle = CreateFile(localSource.utf16(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
+ if (localHandle != INVALID_HANDLE_VALUE) {
+ if (GetFileTime(localHandle, &creationTime, &accessTime, &writeTime)) {
+ LocalFileTimeToFileTime(&writeTime, &writeTime);
+ option.fileTime = writeTime;
+ }
+ CloseHandle(localHandle);
+ }
+ DWORD attributes = GetFileAttributes(localSource.utf16());
+ if (attributes != -1 )
+ option.fileAttributes = attributes;
+#endif
+ option.fileSize = info.size();
+ option.overwriteExisting = !failIfExists;
+
+ if (!_sendData(socket, (char*) &option, sizeof(option))) {
+ END_ERROR(socket, "Could not send options...");
+ }
+
+ if (!_checkResult(socket)) {
+ END_ERROR(socket, "Server did not accept configuration");
+ }
+
+ int bytesWritten = 0;
+ const int bufferSize = 1024;
+ QByteArray data;
+ while (bytesWritten < option.fileSize) {
+ data = localFile.read(bufferSize);
+ bytesWritten += data.size();
+#ifdef Q_OS_WIN
+ wprintf( L"%s -> %s (%d / %d) %d %%\r", localSource.utf16() , deviceDest.utf16(),
+ bytesWritten , option.fileSize, (100*bytesWritten)/option.fileSize );
+#endif
+ if (!_sendData(socket, data.constData(), data.size())) {
+ END_ERROR(socket, "Error during file transfer");
+ }
+ if (!_checkResult(socket)) {
+ END_ERROR(socket, "Got some strange result");
+ }
+ }
+#ifdef Q_OS_WIN
+ wprintf( L"\n"); // We should jump to next line...
+#endif
+ if (bytesWritten != option.fileSize) {
+ END_ERROR(socket, "Did not send sufficient data");
+ }
+ _freeSocket(socket);
+ return true;
+}
+
+bool QtCesterConnection::copyDirectoryToDevice(const QString &localSource, const QString &deviceDest, bool recursive)
+{
+ QTcpSocket* socket = NULL;
+ QFileInfo info(localSource);
+ if (!info.exists() || !info.isDir()) {
+ END_ERROR(socket, "Input directory invalid");
+ }
+
+ createDirectory(deviceDest, true);
+ QDir dir(localSource);
+ QFileInfoList list = dir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
+ foreach(QFileInfo item, list) {
+ QString targetName = deviceDest + QLatin1String("\\") + item.fileName();
+ if (item.isDir()) {
+ if (recursive) {
+ if (!copyDirectoryToDevice(item.absoluteFilePath() , targetName, recursive))
+ return false;
+ }
+ } else {
+ if (!copyFileToDevice(item.absoluteFilePath(), targetName))
+ return false;
+ }
+ }
+ return true;
+}
+
+bool QtCesterConnection::copyFileFromDevice(const QString &deviceSource, const QString &localDest, bool failIfExists)
+{
+ QFile targetFile(localDest);
+ QTcpSocket* socket = 0;
+ if (targetFile.exists() && failIfExists) {
+ END_ERROR(socket, "Local file not supposed to be overwritten");
+ }
+
+ if (!targetFile.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
+ END_ERROR(socket, "Could not open local file for writing");
+ }
+
+ if (!_initCommand(socket, COMMAND_READ_FILE)) {
+ END_ERROR(socket, "Could not establish connection");
+ }
+
+ ReadFileOptions option;
+ strcpy(option.fileName, qPrintable(deviceSource));
+ if (!_sendData(socket, (char*) &option, sizeof(option))) {
+ END_ERROR(socket, "Could not send options");
+ }
+
+ QByteArray data;
+ if (!_receiveData(socket, data)) {
+ END_ERROR(socket, "Did not receive any data");
+ }
+
+ ReadFileReply* reply = (ReadFileReply*) data.data();
+ if (!reply->fileValid) {
+ END_ERROR(socket, "Requested file invalid");
+ }
+
+ int fileSize = reply->fileSize;
+ int currentSize = 0;
+ // ### TODO: make a little bit more error-prone
+ do {
+ _sendData(socket, COMMAND_SUCCESS, strlen(COMMAND_SUCCESS));
+ _receiveData(socket, data);
+ currentSize += data.size();
+ targetFile.write(data);
+ } while(currentSize < fileSize);
+
+ _freeSocket(socket);
+ targetFile.close();
+ return true;
+}
+
+bool QtCesterConnection::copyDirectoryFromDevice(const QString& /*deviceSource*/
+ , const QString& /*localDest*/
+ , bool /*recursive*/)
+{
+ qDebug() << "To be implemented!! Should not be needed for autotest system";
+ exit(-1);
+ return false;
+}
+
+bool QtCesterConnection::copyFile(const QString &srcFile, const QString &destFile, bool failIfExists)
+{
+ QTcpSocket* socket = 0;
+ if (!_initCommand(socket, COMMAND_COPY_FILE)) {
+ END_ERROR(socket, "Could not establish connection for copy");
+ }
+
+ CopyFileOptions option;
+ strcpy(option.from, qPrintable(srcFile));
+ strcpy(option.to, qPrintable(destFile));
+ option.overwriteExisting = !failIfExists;
+ if (!_sendData(socket, (char*) &option, sizeof(option))) {
+ END_ERROR(socket, "Could not send copy options");
+ }
+
+ if (!_checkResult(socket)) {
+ END_ERROR(socket, "Copy failed");
+ }
+
+ _freeSocket(socket);
+ return true;
+}
+
+bool QtCesterConnection::copyDirectory(const QString &srcDirectory, const QString &destDirectory,
+ bool recursive)
+{
+ QTcpSocket* socket = 0;
+ if (!_initCommand(socket, COMMAND_COPY_DIRECTORY)) {
+ END_ERROR(socket, "Could not establish connection for dir copy");
+ }
+
+ CopyDirectoryOptions option;
+ strcpy(option.from, qPrintable(srcDirectory));
+ strcpy(option.to, qPrintable(destDirectory));
+ option.recursive = recursive;
+ if (!_sendData(socket, (char*) &option, sizeof(option))) {
+ END_ERROR(socket, "Could not send dir copy options");
+ }
+
+ if (!_checkResult(socket)) {
+ END_ERROR(socket, "Dir Copy failed");
+ }
+
+ _freeSocket(socket);
+ return true;
+}
+
+bool QtCesterConnection::deleteFile(const QString &fileName)
+{
+ QTcpSocket* socket = 0;
+ if (!_initCommand(socket, COMMAND_DELETE_FILE)) {
+ END_ERROR(socket, "Could not establish connection for file deletion");
+ }
+
+ DeleteFileOptions option;
+ strcpy(option.fileName, qPrintable(fileName));
+ if (!_sendData(socket, (char*) &option, sizeof(option))) {
+ END_ERROR(socket, "Could not send file options");
+ }
+
+ if (!_checkResult(socket)) {
+ //END_ERROR(socket, "File Deletion failed");
+ // This is actually not an error so ignore it.
+ }
+
+ _freeSocket(socket);
+ return true;
+}
+
+bool QtCesterConnection::deleteDirectory(const QString &directory, bool recursive, bool failIfContentExists)
+{
+ QTcpSocket* socket = 0;
+ if (!_initCommand(socket, COMMAND_DELETE_DIRECTORY)) {
+ END_ERROR(socket, "Could not establish connection for dir deletion");
+ }
+
+ DeleteDirectoryOptions option;
+ strcpy(option.dirName, qPrintable(directory));
+ option.recursive = recursive;
+ option.failIfContentExists = failIfContentExists;
+ if (!_sendData(socket, (char*) &option, sizeof(option))) {
+ END_ERROR(socket, "Could not send dir options");
+ }
+
+ if (!_checkResult(socket)) {
+ // we do not write an error as this will fail a lot on recursive.
+ END_ERROR(socket, 0);
+ }
+
+ _freeSocket(socket);
+ return true;
+}
+
+bool QtCesterConnection::execute(QString program,
+ QString arguments,
+ int timeout,
+ int *returnValue)
+{
+ QTcpSocket* socket = 0;
+ if (!_initCommand(socket, COMMAND_EXECUTE)) {
+ END_ERROR(socket, "Could not establish connection for dir deletion");
+ }
+
+ ExecuteOptions options;
+ strcpy(options.appName, qPrintable(program));
+ QStringList argList = arguments.split(QLatin1Char(' '));
+ options.argumentsCount = qMin(argList.size(), MAX_ARGUMENTS);
+ options.waitForFinished = true;
+ options.timeout = timeout;
+ if (!_sendData(socket, (char*) &options, sizeof(options))) {
+ END_ERROR(socket, "Could not send dir options");
+ }
+ if (!_checkResult(socket)) {
+ END_ERROR(socket, "Did not receive an answer");
+ }
+
+ for (int i=0; i < options.argumentsCount; ++i) {
+ char someData[MAX_NAME_LENGTH];
+ strcpy(someData, qPrintable(argList[i]));
+ if (!_sendData(socket, someData, MAX_NAME_LENGTH)) {
+ END_ERROR(socket, "Could not send argument");
+ }
+ if (!_checkResult(socket)) {
+ END_ERROR(socket, "Failure in argument send");
+ }
+ }
+
+ // trigger the startup
+ if (!_sendData(socket, COMMAND_SUCCESS, strlen(COMMAND_SUCCESS))) {
+ END_ERROR(socket, "Could not trigger startup");
+ }
+
+ const int waitTime = 60 * 60 * 1000;
+ if (!socket->waitForReadyRead(waitTime)) {
+ END_ERROR(socket, "Process timed out");
+ }
+
+ QByteArray result = socket->readAll();
+ if (result != COMMAND_SUCCESS) {
+ if (returnValue)
+ *returnValue = -1; // just some at least
+ END_ERROR(socket, "Application did not start or returned error");
+ }
+
+ if (returnValue)
+ *returnValue = 0;
+ _freeSocket(socket);
+ return true;
+}
+
+bool QtCesterConnection::createDirectory(const QString &path, bool deleteBefore)
+{
+ if (deleteBefore)
+ deleteDirectory(path, true, true);
+
+ QTcpSocket* socket = 0;
+ if (!_initCommand(socket, COMMAND_CREATE_DIRECTORY)) {
+ END_ERROR(socket, "Could not establish connection for dir creation");
+ }
+
+ CreateDirectoryOptions option;
+ strcpy(option.dirName, qPrintable(path));
+ option.recursively = true;
+ if (!_sendData(socket, (char*) &option, sizeof(option))) {
+ END_ERROR(socket, "Could not send dir options");
+ }
+
+ if (!_checkResult(socket)) {
+ END_ERROR(socket, "Dir creation failed");
+ }
+
+ _freeSocket(socket);
+ return true;
+}
+
+bool QtCesterConnection::timeStampForLocalFileTime(FILETIME* fTime) const
+{
+ if (!fTime)
+ return false;
+
+ FILETIME copyTime = *fTime;
+ LocalFileTimeToFileTime(&copyTime, &copyTime);
+
+ QTcpSocket* socket = 0;
+ if (!_initCommand(socket, COMMAND_TIME_STAMP)) {
+ END_ERROR(socket, "Could not establish time stamp connection");
+ }
+
+ if (!_sendData(socket, (char*) &copyTime, sizeof(copyTime))) {
+ END_ERROR(socket, "Could not send stamp time");
+ }
+
+ QByteArray data;
+ if (!_receiveData(socket, data)) {
+ END_ERROR(socket, "Did not receive time stamp or connection interrupted");
+ }
+
+ copyTime = *((FILETIME*)data.data());
+ if (copyTime.dwLowDateTime == -1 && copyTime.dwHighDateTime == -1) {
+ END_ERROR(socket, "remote Time stamp failed!");
+ }
+
+ *fTime = copyTime;
+ _freeSocket(socket);
+ return true;
+}
+
+bool QtCesterConnection::fileCreationTime(const QString &fileName, FILETIME* deviceCreationTime) const
+{
+ if (!deviceCreationTime)
+ return false;
+
+ QTcpSocket* socket = 0;
+ if (!_initCommand(socket, COMMAND_FILE_TIME)) {
+ END_ERROR(socket, "Could not establish connection for file time access");
+ }
+
+ FileTimeOptions option;
+ strcpy(option.fileName, qPrintable(fileName));
+ if (!_sendData(socket, (char*) &option, sizeof(option))) {
+ END_ERROR(socket, "Could not send file time name");
+ }
+
+ QByteArray data;
+ if (!_receiveData(socket, data)) {
+ END_ERROR(socket, "File Time request failed");
+ }
+
+ FILETIME* resultTime = (FILETIME*) data.data();
+ if (resultTime->dwLowDateTime == -1 && resultTime->dwHighDateTime == -1) {
+ END_ERROR(socket, 0);
+ debugOutput("Could not access file time", 0);
+ }
+
+ *deviceCreationTime = *resultTime;
+ _freeSocket(socket);
+ return true;
+}
+
+bool QtCesterConnection::_createSocket(QTcpSocket*& result) const
+{
+ QTcpSocket* sock = new QTcpSocket();
+ QByteArray ipAddress = qgetenv("DEVICE_IP");
+ if (ipAddress.isEmpty()) {
+ qWarning("Error: You need to have DEVICE_IP set");
+ exit(0);
+ }
+ sock->connectToHost(QHostAddress(QString(ipAddress)), 12145);
+
+ if (!sock->waitForConnected()) {
+ qDebug() << "connection timeout...";
+ result = NULL;
+ return false;
+ }
+ result = sock;
+ return true;
+}
+
+void QtCesterConnection::_freeSocket(QTcpSocket*& sock) const
+{
+ if (!sock)
+ return;
+ if (sock->state() == QAbstractSocket::ConnectedState) {
+ sock->disconnectFromHost();
+ // seems like no need to wait
+ //sock->waitForDisconnected();
+ }
+ delete sock;
+ sock = NULL;
+#ifdef Q_OS_WIN
+ Sleep(100);
+#endif
+}
+
+bool QtCesterConnection::_initCommand(QTcpSocket*& sock, const char* command) const
+{
+ QTcpSocket* socket = NULL;
+ if (!_createSocket(socket)) {
+ END_ERROR(socket, "Could not connect to server");
+ }
+
+ if (!_sendData(socket, command, strlen(command)) ||
+ !_checkResult(socket)) {
+ END_ERROR(socket, "Cound not send command");
+ }
+ sock = socket;
+ return true;
+}
+
+bool QtCesterConnection::_sendData(QTcpSocket*& sock, const char* data, int dataSize) const
+{
+ int amount = sock->write(data, dataSize);
+ if (amount != dataSize) {
+ fprintf(stderr, "*******COULD NOT SEND ENOUGH DATA*************\n");
+ }
+ return sock->waitForBytesWritten();
+}
+
+bool QtCesterConnection::_receiveData(QTcpSocket*& sock, QByteArray& data) const
+{
+ if (!sock->waitForReadyRead()) {
+ qDebug() << "did not receive any data";
+ return false;
+ }
+ data = sock->readAll();
+ return true;
+}
+
+bool QtCesterConnection::_checkResult(QTcpSocket*& sock) const
+{
+ QByteArray response;
+ if (!_receiveData(sock, response) || response != COMMAND_SUCCESS)
+ return false;
+ return true;
+}
+
diff --git a/tools/qtestlib/wince/cetcpsync/qtcesterconnection.h b/tools/qtestlib/wince/cetcpsync/qtcesterconnection.h
new file mode 100644
index 000000000..d7b8393eb
--- /dev/null
+++ b/tools/qtestlib/wince/cetcpsync/qtcesterconnection.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef ACTIVESYNC_REMOTECONNECTION_H
+#define ACTIVESYNC_REMOTECONNECTION_H
+
+#include "remoteconnection.h"
+
+class QTcpSocket;
+
+class QtCesterConnection : public AbstractRemoteConnection
+{
+public:
+ QtCesterConnection();
+ virtual ~QtCesterConnection();
+
+ bool connect(QVariantList &list = QVariantList());
+ void disconnect();
+ bool isConnected() const;
+
+ // These functions are designed for transfer between desktop and device
+ // Caution: deviceDest path has to be device specific (eg. no drive letters for CE)
+ bool copyFileToDevice(const QString &localSource, const QString &deviceDest, bool failIfExists = false);
+ bool copyDirectoryToDevice(const QString &localSource, const QString &deviceDest, bool recursive = true);
+ bool copyFileFromDevice(const QString &deviceSource, const QString &localDest, bool failIfExists = false);
+ bool copyDirectoryFromDevice(const QString &deviceSource, const QString &localDest, bool recursive = true);
+
+ bool timeStampForLocalFileTime(FILETIME*) const;
+ bool fileCreationTime(const QString &fileName, FILETIME*) const;
+
+ // These functions only work on files existing on the device
+ bool copyFile(const QString&, const QString&, bool failIfExists = false);
+ bool copyDirectory(const QString&, const QString&, bool recursive = true);
+ bool deleteFile(const QString&);
+ bool deleteDirectory(const QString&, bool recursive = true, bool failIfContentExists = false);
+ bool createDirectory(const QString&, bool deleteBefore=false);
+
+ bool execute(QString program, QString arguments = QString(), int timeout = -1, int *returnValue = NULL);
+private:
+ bool _createSocket(QTcpSocket*&) const;
+ void _freeSocket(QTcpSocket*&) const;
+ bool _initCommand(QTcpSocket*&, const char*) const;
+ bool _sendData(QTcpSocket*&, const char* data, int dataSize) const;
+ bool _receiveData(QTcpSocket*&, QByteArray&) const;
+ bool _checkResult(QTcpSocket*&) const;
+ bool connected;
+};
+
+#endif
diff --git a/tools/qtestlib/wince/cetcpsync/remoteconnection.cpp b/tools/qtestlib/wince/cetcpsync/remoteconnection.cpp
new file mode 100644
index 000000000..b197c5c66
--- /dev/null
+++ b/tools/qtestlib/wince/cetcpsync/remoteconnection.cpp
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "remoteconnection.h"
+
+AbstractRemoteConnection::AbstractRemoteConnection()
+{
+}
+
+AbstractRemoteConnection::~AbstractRemoteConnection()
+{
+}
+
+// Slow but should be ok...
+bool AbstractRemoteConnection::moveFile(const QString &src, const QString &dest, bool FailIfExists)
+{
+ bool result = copyFile(src, dest, FailIfExists);
+ deleteFile(src);
+ return result;
+}
+
+// Slow but should be ok...
+bool AbstractRemoteConnection::moveDirectory(const QString &src, const QString &dest, bool recursive)
+{
+ bool result = copyDirectory(src, dest, true);
+ deleteDirectory(src, recursive);
+ return result;
+}
diff --git a/tools/qtestlib/wince/cetcpsync/remoteconnection.h b/tools/qtestlib/wince/cetcpsync/remoteconnection.h
new file mode 100644
index 000000000..fae6f7f75
--- /dev/null
+++ b/tools/qtestlib/wince/cetcpsync/remoteconnection.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef REMOTECONNECTION_H
+#define REMOTECONNECTION_H
+
+#include <QtCore/QString>
+#include <QtCore/QVariant>
+#include <windows.h>
+class AbstractRemoteConnection
+{
+public:
+ AbstractRemoteConnection();
+ virtual ~AbstractRemoteConnection();
+
+ virtual bool connect(QVariantList&) = 0;
+ virtual void disconnect() = 0;
+ virtual bool isConnected() const = 0;
+
+ // These functions are designed for transfer between desktop and device
+ // Caution: deviceDest path has to be device specific (eg. no drive letters for CE)
+ virtual bool copyFileToDevice(const QString &localSource, const QString &deviceDest, bool failIfExists = false) = 0;
+ virtual bool copyDirectoryToDevice(const QString &localSource, const QString &deviceDest, bool recursive = true) = 0;
+ virtual bool copyFileFromDevice(const QString &deviceSource, const QString &localDest, bool failIfExists = false) = 0;
+ virtual bool copyDirectoryFromDevice(const QString &deviceSource, const QString &localDest, bool recursive = true) = 0;
+
+ // For "intelligent deployment" we need to investigate on filetimes on the device
+ virtual bool timeStampForLocalFileTime(FILETIME*) const = 0;
+ virtual bool fileCreationTime(const QString &fileName, FILETIME*) const = 0;
+
+ // These functions only work on files existing on the device
+ virtual bool copyFile(const QString&, const QString&, bool failIfExists = false) = 0;
+ virtual bool copyDirectory(const QString&, const QString&, bool recursive = true) = 0;
+ virtual bool deleteFile(const QString&) = 0;
+ virtual bool deleteDirectory(const QString&, bool recursive = true, bool failIfContentExists = false) = 0;
+ bool moveFile(const QString&, const QString&, bool FailIfExists = false);
+ bool moveDirectory(const QString&, const QString&, bool recursive = true);
+
+ virtual bool createDirectory(const QString&, bool deleteBefore=false) = 0;
+
+ virtual bool execute(QString program, QString arguments = QString(), int timeout = -1, int *returnValue = NULL) = 0;
+};
+
+#endif
diff --git a/tools/qtestlib/wince/cetcpsyncserver/cetcpsyncserver.pro b/tools/qtestlib/wince/cetcpsyncserver/cetcpsyncserver.pro
new file mode 100644
index 000000000..bd01d2dab
--- /dev/null
+++ b/tools/qtestlib/wince/cetcpsyncserver/cetcpsyncserver.pro
@@ -0,0 +1,17 @@
+TEMPLATE = app
+TARGET = cetcpsyncsvr
+DEPENDPATH += .
+QT -= gui
+QT += network
+
+CONFIG += console
+
+HEADERS += \
+ connectionmanager.h \
+ commands.h \
+ transfer_global.h
+
+SOURCES += \
+ connectionmanager.cpp \
+ commands.cpp \
+ main.cpp
diff --git a/tools/qtestlib/wince/cetcpsyncserver/commands.cpp b/tools/qtestlib/wince/cetcpsyncserver/commands.cpp
new file mode 100644
index 000000000..0c4d3bc03
--- /dev/null
+++ b/tools/qtestlib/wince/cetcpsyncserver/commands.cpp
@@ -0,0 +1,686 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "commands.h"
+#include <QtCore/QDebug>
+#include <QtCore/QFileInfo>
+#include <QtCore/QDir>
+#include <QtCore/QProcess>
+
+#ifdef Q_OS_WINCE
+#include <windows.h>
+#endif
+
+/////////////////////////////////////////////////////
+// Abstract Command Implementation //
+/////////////////////////////////////////////////////
+AbstractCommand::AbstractCommand()
+: m_socket(0)
+{
+}
+
+AbstractCommand::~AbstractCommand()
+{
+}
+
+void AbstractCommand::reportSuccess()
+{
+ m_socket->write(COMMAND_SUCCESS, strlen(COMMAND_SUCCESS));
+ m_socket->waitForBytesWritten();
+}
+
+void AbstractCommand::reportError()
+{
+ m_socket->write(COMMAND_ERROR, strlen(COMMAND_ERROR));
+ m_socket->waitForBytesWritten();
+}
+
+void AbstractCommand::dataReceived(QByteArray&)
+{
+ debugOutput(1, "AbstractCommand::dataReceived NOT SUPPOSED TO BE HERE");
+}
+
+void AbstractCommand::commandFinished()
+{
+ debugOutput(1, "AbstractCommand::commandFinished()NOT SUPPOSED TO BE HERE");
+}
+
+void AbstractCommand::setSocket(QTcpSocket* socket)
+{
+ debugOutput(0, "AbstractCommand::setSocket()");
+ Q_ASSERT(socket);
+ m_socket = socket;
+ connect(m_socket, SIGNAL(readyRead()), this, SLOT(_readData()));
+ reportSuccess();
+}
+
+QTcpSocket* AbstractCommand::socket()
+{
+ return m_socket;
+}
+
+void AbstractCommand::_readData()
+{
+ QByteArray arr = m_socket->readAll();
+ dataReceived(arr);
+}
+
+void AbstractCommand::_disconnect()
+{
+}
+
+/////////////////////////////////////////////////////
+// Create File Command Implementation //
+/////////////////////////////////////////////////////
+CreateFileCommand::CreateFileCommand()
+: m_dataCount(0)
+{
+ debugOutput(0, "CreateFileCommand::CreateFileCommand");
+ m_options.fileSize= -1;
+}
+
+CreateFileCommand::~CreateFileCommand()
+{
+ debugOutput(0, "CreateFileCommand::~CreateFileCommand");
+ if (m_file.isOpen()) {
+ fprintf(stderr, "****************FILE IS STILL OPENED AND HAVENT FINISHED WRITING**********************\n");
+ fprintf(stderr, "Current: %d Expected: %d\n", m_dataCount , m_options.fileSize);
+ m_file.close();
+ }
+}
+
+void CreateFileCommand::dataReceived(QByteArray &data)
+{
+ bool successful = true;
+ // If we haven't received the options yet
+ if (m_options.fileSize == -1) {
+ CreateFileOptions* opt = (CreateFileOptions*) data.data();
+ memcpy(&m_options , opt , sizeof(CreateFileOptions));
+
+ if (QFileInfo(QString::fromLatin1(m_options.fileName)).exists()) {
+ if (m_options.overwriteExisting) {
+#ifdef Q_OS_WINCE
+ SetFileAttributes(QFileInfo(m_options.fileName).absoluteFilePath().utf16(), FILE_ATTRIBUTE_NORMAL);
+#endif
+ QFile::remove(m_options.fileName);
+ } else
+ successful = false;
+ }
+ m_file.setFileName(QString::fromLatin1(m_options.fileName));
+ if (!m_file.open(QIODevice::WriteOnly))
+ successful = false;
+ else
+ debugOutput(3, QString::fromLatin1("Creating file: %1").arg(m_options.fileName));
+ } else { // write buffer on disc
+ if (!m_file.isOpen())
+ return;
+ m_file.write(data);
+ m_dataCount += data.size();
+ if (m_dataCount >= m_options.fileSize) {
+ // We do not care about more data than announced
+ m_file.close();
+ }
+ }
+
+ if (successful)
+ reportSuccess();
+ else
+ reportError();
+}
+
+void CreateFileCommand::commandFinished()
+{
+ debugOutput(0, "CreateFileCommand::commandFinished");
+#ifdef Q_OS_WIN
+ // We need to set the file attributes for intelligent time comparisons
+ QString tmpFile = QString::fromLatin1(m_options.fileName);
+ HANDLE handle = CreateFile(tmpFile.utf16(), GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
+ if (handle != INVALID_HANDLE_VALUE) {
+ SetFileTime(handle, &(m_options.fileTime), NULL, NULL);
+ CloseHandle(handle);
+ }
+ SetFileAttributes(tmpFile.utf16(), m_options.fileAttributes);
+#endif
+}
+
+/////////////////////////////////////////////////////
+// Create Directory Command Implementation //
+/////////////////////////////////////////////////////
+CreateDirectoryCommand::CreateDirectoryCommand()
+ : AbstractCommand()
+{
+ debugOutput(0, "CreateDirectoryCommand::CreateDirectoryCommand");
+}
+
+CreateDirectoryCommand::~CreateDirectoryCommand()
+{
+ debugOutput(0, "CreateDirectoryCommand::~CreateDirectoryCommand()");
+}
+
+void CreateDirectoryCommand::dataReceived(QByteArray &data)
+{
+ debugOutput(0, "CreateDirectoryCommand::dataReceived()");
+ CreateDirectoryOptions* options = (CreateDirectoryOptions*) data.data();
+ debugOutput(3, QString::fromLatin1("Creating directory: %1").arg(options->dirName));
+ bool success = true;
+ QDir dir;
+ if (options->recursively)
+ success = dir.mkpath(options->dirName);
+ else
+ success = dir.mkdir(options->dirName);
+
+ if (success)
+ reportSuccess();
+ else
+ reportError();
+}
+
+void CreateDirectoryCommand::commandFinished()
+{
+ debugOutput(0, "CreateDirectoryCommand::commandFinished()");
+}
+
+/////////////////////////////////////////////////////
+// Copy File Command Implementation //
+/////////////////////////////////////////////////////
+CopyFileCommand::CopyFileCommand()
+ : AbstractCommand()
+{
+ debugOutput(0, "CopyFileCommand::CopyFileCommand()");
+}
+
+CopyFileCommand::~CopyFileCommand()
+{
+ debugOutput(0, "CopyFileCommand::~CopyFileCommand()");
+}
+
+void CopyFileCommand::dataReceived(QByteArray &data)
+{
+ debugOutput(0, "CopyFileCommand::dataReceived()");
+ CopyFileOptions* options = (CopyFileOptions*) data.data();
+ debugOutput(3, QString::fromLatin1("Copy File: %1 -> %2").arg(options->from).arg(options->to));
+ bool success = true;
+ if (QFileInfo(options->to).exists()) {
+ if (options->overwriteExisting)
+ QFile::remove(options->to);
+ else
+ success = false;
+ }
+ if (success)
+ if (!QFile::copy(options->from , options->to))
+ success = false;
+
+ if (success)
+ reportSuccess();
+ else
+ reportError();
+}
+
+void CopyFileCommand::commandFinished()
+{
+ debugOutput(0, "CopyFileCommand::commandFinished()");
+}
+
+/////////////////////////////////////////////////////
+// Copy Directory Command Implementation //
+/////////////////////////////////////////////////////
+CopyDirectoryCommand::CopyDirectoryCommand()
+ : AbstractCommand()
+{
+ debugOutput(0, "CopyDirectoryCommand::CopyDirectoryCommand()");
+}
+
+CopyDirectoryCommand::~CopyDirectoryCommand()
+{
+ debugOutput(0, "CopyDirectoryCommand::~CopyDirectoryCommand()");
+}
+
+void CopyDirectoryCommand::dataReceived(QByteArray &data)
+{
+ debugOutput(0, "CopyDirectoryCommand::dataReceived()");
+ CopyDirectoryOptions* options = (CopyDirectoryOptions*) data.data();
+ debugOutput(3, QString::fromLatin1("Copy Directory: %1 %2").arg(options->from).arg(options->to));
+ if (copyDir(QLatin1String(options->from) , QLatin1String(options->to) , options->recursive))
+ reportSuccess();
+ else
+ reportError();
+}
+
+void CopyDirectoryCommand::commandFinished()
+{
+ debugOutput(0, "CopyDirectoryCommand::commandFinished()");
+}
+
+bool CopyDirectoryCommand::copyDir(const QString &from, const QString &to, bool recursive)
+{
+ QDir().mkpath(to);
+ QDir sourceDir(from);
+ QDir destDir(to);
+ QStringList entries = sourceDir.entryList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
+ foreach (QString item , entries) {
+ QString itemFrom = sourceDir.absoluteFilePath(item);
+ QString itemTo = destDir.absoluteFilePath(item);
+ if (QFileInfo(item).isDir()) {
+ if (recursive && !copyDir(itemFrom, itemTo, recursive))
+ return false;
+ } else {
+ if (!QFile::copy(itemFrom, itemTo))
+ return false;
+ }
+ }
+ return true;
+}
+
+/////////////////////////////////////////////////////
+// Delete File Command Implementation //
+/////////////////////////////////////////////////////
+DeleteFileCommand::DeleteFileCommand()
+ : AbstractCommand()
+{
+ debugOutput(0, "DeleteFileCommand::DeleteFileCommand()");
+}
+
+DeleteFileCommand::~DeleteFileCommand()
+{
+ debugOutput(0, "DeleteFileCommand::~DeleteFileCommand()");
+}
+
+void DeleteFileCommand::dataReceived(QByteArray &data)
+{
+ debugOutput(0, "DeleteFileCommand::dataReceived()");
+ DeleteFileOptions* options = (DeleteFileOptions*) data.data();
+ debugOutput(3, QString::fromLatin1("Delete File: %1").arg(options->fileName));
+ bool success = true;
+ QFile file(options->fileName);
+ if (file.exists()) {
+#ifdef Q_OS_WINCE
+ SetFileAttributes(QFileInfo(options->fileName).absoluteFilePath().utf16(), FILE_ATTRIBUTE_NORMAL);
+#endif
+ success = file.remove();
+ } else
+ success = false;
+
+ if (success)
+ reportSuccess();
+ else
+ reportError();
+}
+
+void DeleteFileCommand::commandFinished()
+{
+ debugOutput(0, "DeleteFileCommand::commandFinished()");
+}
+
+/////////////////////////////////////////////////////
+// Delete Directory Command Implementation //
+/////////////////////////////////////////////////////
+DeleteDirectoryCommand::DeleteDirectoryCommand()
+ : AbstractCommand()
+{
+ debugOutput(0, "DeleteDirectoryCommand::DeleteDirectoryCommand()");
+}
+
+DeleteDirectoryCommand::~DeleteDirectoryCommand()
+{
+ debugOutput(0, "DeleteDirectoryCommand::~DeleteDirectoryCommand()");
+}
+
+void DeleteDirectoryCommand::dataReceived(QByteArray &data)
+{
+ debugOutput(0, "DeleteDirectoryCommand::dataReceived()");
+ DeleteDirectoryOptions* options = (DeleteDirectoryOptions*) data.data();
+ debugOutput(3, QString::fromLatin1("Delete directory: %1").arg(options->dirName));
+ if (deleteDirectory(QLatin1String(options->dirName), options->recursive, options->failIfContentExists))
+ reportSuccess();
+ else
+ reportError();
+}
+
+void DeleteDirectoryCommand::commandFinished()
+{
+ debugOutput(0, "DeleteDirectoryCommand::commandFinished()");
+}
+
+bool DeleteDirectoryCommand::deleteDirectory(const QString &dirName, bool recursive, bool failIfContentExists)
+{
+ QDir dir(dirName);
+ if (!dir.exists())
+ return false;
+
+ QStringList itemList = dir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
+ if (itemList.size() > 0 && failIfContentExists)
+ return false;
+
+ foreach (QString item, itemList) {
+ QString itemName = dir.absoluteFilePath(item);
+ if (QFileInfo(itemName).isDir()) {
+ if (recursive && !deleteDirectory(itemName, recursive, failIfContentExists))
+ return false;
+ } else {
+ if (!dir.remove(item))
+ return false;
+ }
+ }
+ QString lastName = dir.dirName();
+ dir.cdUp();
+ dir.rmpath(lastName);
+ return true;
+}
+
+/////////////////////////////////////////////////////
+// Execute Command Implementation //
+/////////////////////////////////////////////////////
+ExecuteCommand::ExecuteCommand()
+ : AbstractCommand()
+ , m_argumentCount(0)
+ , m_timeout(-1)
+{
+ debugOutput(0, "ExecuteCommand::ExecuteCommand()");
+}
+
+ExecuteCommand::~ExecuteCommand()
+{
+ debugOutput(0, "ExecuteCommand::~ExecuteCommand()");
+}
+
+void ExecuteCommand::dataReceived(QByteArray &data)
+{
+ debugOutput(0, "ExecuteCommand::dataReceived()");
+
+ if (m_argumentCount == 0) {
+ ExecuteOptions* options = (ExecuteOptions*) data.data();
+ if (!QFileInfo(options->appName).exists()) {
+ debugOutput(1, "Error execute: application does not exist");
+ reportError();
+ return;
+ }
+
+ m_program = QLatin1String(options->appName);
+ m_argumentCount = options->argumentsCount;
+ m_waitFinished = options->waitForFinished;
+ m_timeout = options->timeout;
+ if (m_argumentCount == 0)
+ m_argumentCount = -1; // to trigger startup on next receive
+ reportSuccess();
+ } else if (m_arguments.size() < m_argumentCount) {
+ m_arguments += data;
+ reportSuccess();
+ } else { // do the execution
+ if (data == COMMAND_SUCCESS)
+ _doExecute();
+ }
+}
+
+void ExecuteCommand::_doExecute()
+{
+ debugOutput(0, "ExecuteCommand::_doExecute()");
+ debugOutput(3, QString::fromLatin1("Execute: %1 %2").arg(m_program).arg(m_arguments.join(" ")));
+ if (m_waitFinished) {
+ QProcess process;
+ process.start(m_program, m_arguments);
+ if (process.waitForFinished(m_timeout) == false || process.exitCode() < 0)
+ reportError();
+ else
+ reportSuccess();
+ } else {
+ if (QProcess::startDetached(m_program, m_arguments))
+ reportSuccess();
+ else
+ reportError();
+ }
+}
+void ExecuteCommand::commandFinished()
+{
+ debugOutput(0,"ExecuteCommand::commandFinished()");
+}
+
+/////////////////////////////////////////////////////
+// Read File Implementation //
+/////////////////////////////////////////////////////
+ReadFileCommand::ReadFileCommand()
+ : AbstractCommand()
+ , m_currentPos(0)
+{
+ debugOutput(0, "ReadFileCommand::ReadFileCommand()");
+ m_fileName.clear();
+}
+
+ReadFileCommand::~ReadFileCommand()
+{
+ debugOutput(0, "ReadFileCommand::~ReadFileCommand()");
+ if (m_file.isOpen())
+ m_file.close();
+}
+
+void ReadFileCommand::dataReceived(QByteArray &data)
+{
+ debugOutput(0, "ReadFileCommand::dataReceived()");
+ if (m_fileName.isEmpty()) {
+ ReadFileOptions* option = (ReadFileOptions*) data.data();
+ m_fileName = QLatin1String(option->fileName);
+ QFileInfo info(m_fileName);
+ m_file.setFileName(m_fileName);
+ ReadFileReply reply;
+ if (!info.exists() || !info.isFile() || !m_file.open(QIODevice::ReadOnly))
+ reply.fileValid = false;
+ else
+ reply.fileValid = true;
+ reply.fileSize = info.size();
+ m_fileSize = reply.fileSize;
+ socket()->write((char*) &reply, sizeof(reply));
+ debugOutput(3, QString::fromLatin1("Reading file: %1").arg(m_fileName));
+ } else {
+ QTcpSocket* sock = socket(); // design failure???
+ if (data != COMMAND_SUCCESS || m_currentPos >= m_fileSize) {
+ sock->disconnectFromHost();
+ return;
+ }
+ const int bufferSize = 1024;
+ QByteArray buffer = m_file.read(bufferSize);
+ m_currentPos += buffer.size();
+ sock->write(buffer);
+ sock->waitForBytesWritten();
+ }
+}
+
+void ReadFileCommand::commandFinished()
+{
+ debugOutput(0, "ReadFileCommand::commandFinished()");
+}
+
+/////////////////////////////////////////////////////
+// Read Directory Implementation //
+/////////////////////////////////////////////////////
+ReadDirectoryCommand::ReadDirectoryCommand()
+ : AbstractCommand()
+ , m_iterator(0)
+{
+ debugOutput(0, "ReadDirectoryCommand::ReadDirectoryCommand");
+ m_dirName.clear();
+}
+
+ReadDirectoryCommand::~ReadDirectoryCommand()
+{
+ debugOutput(0, "ReadDirectoryCommand::~ReadDirectoryCommand()");
+ delete m_iterator;
+}
+
+void ReadDirectoryCommand::dataReceived(QByteArray &data)
+{
+ debugOutput(0, "ReadDirectoryCommand::dataReceived()");
+ QTcpSocket* sock = socket();
+ if (m_dirName.isEmpty()) {
+ ReadDirectoryOptions* option = (ReadDirectoryOptions*) data.data();
+ QFileInfo info(QLatin1String(option->dirName));
+ debugOutput(3, QString::fromLatin1("Reading Directory entries: %1").arg(option->dirName));
+ ReadDirectoryReply reply;
+ if (!info.exists() || !info.isDir()) {
+ reply.itemCount = -1;
+ reply.entryValid = false;
+ } else {
+ m_dirName = QLatin1String(option->dirName);
+ m_dir.setPath(m_dirName);
+ m_iterator = new QDirIterator(m_dir);
+ reply.itemCount = m_dir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot).size();
+ reply.entryValid = true;
+ }
+ sock->write((char*) &reply, sizeof(reply));
+ sock->waitForBytesWritten();
+ } else {
+ if (data != COMMAND_SUCCESS) {
+ qDebug() << "Something went wrong in the meantime";
+ return;
+ }
+ ReadDirectoryItem reply;
+ if (m_iterator->hasNext()) {
+ m_iterator->next();
+ QFileInfo info = m_iterator->fileInfo();
+ strcpy(reply.name, qPrintable(info.absoluteFilePath()));
+ reply.isDirectory = info.isDir();
+ if (!reply.isDirectory)
+ reply.size = info.size();
+ }
+ reply.hasMore = m_iterator->hasNext();
+ sock->write((char*) &reply, sizeof(reply));
+ sock->waitForBytesWritten();
+ }
+}
+
+void ReadDirectoryCommand::commandFinished()
+{
+ debugOutput(0, "ReadDirectoryCommand::commandFinished()");
+}
+
+/////////////////////////////////////////////////////
+// File Time Implementation //
+/////////////////////////////////////////////////////
+FileTimeCommand::FileTimeCommand()
+ : AbstractCommand()
+{
+ debugOutput(0, "FileTimeCommand::FileTimeCommand()");
+}
+
+FileTimeCommand::~FileTimeCommand()
+{
+ debugOutput(0, "FileTimeCommand::~FileTimeCommand()");
+}
+
+void FileTimeCommand::dataReceived(QByteArray &data)
+{
+ debugOutput(0, "FileTimeCommand::dataReceived()");
+ FileTimeOptions* option = (FileTimeOptions*) data.data();
+
+ FILETIME resultTime;
+ resultTime.dwLowDateTime = -1;
+ resultTime.dwHighDateTime = -1;
+
+#ifdef Q_OS_WIN
+ QString fileName = QLatin1String(option->fileName);
+ HANDLE deviceHandle = CreateFile(fileName.utf16(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
+ debugOutput(3, QString::fromLatin1("Asking FileTime: %1").arg(fileName));
+ if (deviceHandle != INVALID_HANDLE_VALUE) {
+ FILETIME deviceCreationTime;
+ if (GetFileTime(deviceHandle, &deviceCreationTime, NULL, NULL)) {
+ resultTime = deviceCreationTime;
+ }
+ CloseHandle(deviceHandle);
+ }
+#endif
+ QTcpSocket* sock = socket();
+ sock->write((char*) &resultTime, sizeof(resultTime));
+ sock->waitForBytesWritten();
+}
+
+void FileTimeCommand::commandFinished()
+{
+ debugOutput(0, "FileTimeCommand::commandFinished()");
+}
+
+/////////////////////////////////////////////////////
+// Time Stamp Implementation //
+/////////////////////////////////////////////////////
+TimeStampCommand::TimeStampCommand()
+ : AbstractCommand()
+{
+ debugOutput(0, "TimeStampCommand::TimeStampCommand()");
+}
+
+TimeStampCommand::~TimeStampCommand()
+{
+ debugOutput(0, "TimeStampCommand::~TimeStampCommand()");
+}
+
+void TimeStampCommand::dataReceived(QByteArray &data)
+{
+ debugOutput(0, "TimeStampCommand::dataReceived()");
+ FILETIME resultTime;
+ resultTime.dwLowDateTime = -1;
+ resultTime.dwHighDateTime = -1;
+
+#ifdef Q_OS_WIN
+ FILETIME stampTime = *((FILETIME*)data.data());
+
+ QString tmpFile = QString::fromLatin1("\\qt_tmp_ftime_convert");
+ HANDLE remoteHandle = CreateFile(tmpFile.utf16(), GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
+ if (remoteHandle != INVALID_HANDLE_VALUE) {
+ if (!SetFileTime(remoteHandle, &stampTime, NULL, NULL)) {
+ CloseHandle(remoteHandle);
+ } else {
+ CloseHandle(remoteHandle);
+ remoteHandle = CreateFile(tmpFile.utf16(), GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
+ if (remoteHandle != INVALID_HANDLE_VALUE) {
+ if (GetFileTime(remoteHandle, &stampTime, NULL, NULL))
+ resultTime = stampTime;
+ CloseHandle(remoteHandle);
+ DeleteFile(tmpFile.utf16());
+ }
+ }
+ }
+ debugOutput(3, QString::fromLatin1("Asking TimeStamp"));
+#endif
+ QTcpSocket* sock = socket();
+ sock->write((char*) &resultTime, sizeof(resultTime));
+ sock->waitForBytesWritten();
+}
+
+void TimeStampCommand::commandFinished()
+{
+ debugOutput(0, "TimeStampCommand::commandFinished()");
+}
diff --git a/tools/qtestlib/wince/cetcpsyncserver/commands.h b/tools/qtestlib/wince/cetcpsyncserver/commands.h
new file mode 100644
index 000000000..356c1aa36
--- /dev/null
+++ b/tools/qtestlib/wince/cetcpsyncserver/commands.h
@@ -0,0 +1,292 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef COMMANDS_INCL
+#define COMMANDS_INCL
+
+#include "transfer_global.h"
+
+#include <QtNetwork/QTcpSocket>
+#include <QtCore/QString>
+#include <QtCore/QFile>
+#include <QtCore/QDir>
+#include <QtCore/QDirIterator>
+#include <windows.h>
+
+// debug output
+#define DEBUG_LEVEL 2
+inline void debugOutput(int level, const char* text)
+{
+ if (level >= DEBUG_LEVEL)
+ qDebug() << text;
+}
+
+inline void debugOutput(int level, const QString &text)
+{
+ if (level >= DEBUG_LEVEL)
+ qDebug() << text;
+}
+// Basic abtract command class
+class AbstractCommand : public QObject
+{
+ Q_OBJECT
+public:
+ AbstractCommand();
+ virtual ~AbstractCommand();
+
+ void setSocket(QTcpSocket*);
+ QTcpSocket* socket();
+
+ void reportSuccess();
+ void reportError();
+
+public slots:
+ virtual void dataReceived(QByteArray&);
+ virtual void commandFinished();
+
+private slots:
+ void _readData();
+ void _disconnect();
+
+private:
+ QTcpSocket* m_socket;
+};
+
+// File Creation class
+class CreateFileCommand : public AbstractCommand
+{
+ Q_OBJECT
+public:
+ CreateFileCommand();
+ ~CreateFileCommand();
+
+public slots:
+ void dataReceived(QByteArray&);
+ void commandFinished();
+
+private:
+ CreateFileOptions m_options;
+ QFile m_file;
+ int m_dataCount;
+};
+
+inline AbstractCommand* instCreateFile() { return new CreateFileCommand(); }
+
+// Directory Creation class
+class CreateDirectoryCommand : public AbstractCommand
+{
+ Q_OBJECT
+public:
+ CreateDirectoryCommand();
+ ~CreateDirectoryCommand();
+
+public slots:
+ void dataReceived(QByteArray&);
+ void commandFinished();
+};
+inline AbstractCommand* instCreateDirectory() { return new CreateDirectoryCommand(); }
+
+// File copy class
+class CopyFileCommand : public AbstractCommand
+{
+ Q_OBJECT
+public:
+ CopyFileCommand();
+ ~CopyFileCommand();
+
+public slots:
+ void dataReceived(QByteArray&);
+ void commandFinished();
+};
+inline AbstractCommand* instCopyFile() { return new CopyFileCommand(); }
+
+// Copy directory class
+class CopyDirectoryCommand : public AbstractCommand
+{
+ Q_OBJECT
+public:
+ CopyDirectoryCommand();
+ ~CopyDirectoryCommand();
+
+public slots:
+ void dataReceived(QByteArray&);
+ void commandFinished();
+private:
+ bool copyDir(const QString &from, const QString &to, bool recursive);
+};
+inline AbstractCommand* instCopyDirectory() { return new CopyDirectoryCommand(); }
+
+// Delete File class
+class DeleteFileCommand : public AbstractCommand
+{
+ Q_OBJECT
+public:
+ DeleteFileCommand();
+ ~DeleteFileCommand();
+public slots:
+ void dataReceived(QByteArray&);
+ void commandFinished();
+};
+inline AbstractCommand* instDeleteFile() { return new DeleteFileCommand(); }
+
+// Delete Directory class
+class DeleteDirectoryCommand : public AbstractCommand
+{
+ Q_OBJECT
+public:
+ DeleteDirectoryCommand();
+ ~DeleteDirectoryCommand();
+public slots:
+ void dataReceived(QByteArray&);
+ void commandFinished();
+private:
+ bool deleteDirectory(const QString &dirName, bool recursive, bool failIfContentExists);
+};
+inline AbstractCommand* instDeleteDirectory() { return new DeleteDirectoryCommand(); }
+
+// Execute application class
+class ExecuteCommand : public AbstractCommand
+{
+ Q_OBJECT
+public:
+ ExecuteCommand();
+ ~ExecuteCommand();
+public slots:
+ void dataReceived(QByteArray&);
+ void commandFinished();
+private:
+ void _doExecute();
+ QString m_program;
+ QStringList m_arguments;
+ int m_argumentCount;
+ bool m_waitFinished;
+ int m_timeout;
+};
+inline AbstractCommand* instExecution() { return new ExecuteCommand(); }
+
+// Read File class
+class ReadFileCommand : public AbstractCommand
+{
+ Q_OBJECT
+public:
+ ReadFileCommand();
+ ~ReadFileCommand();
+public slots:
+ void dataReceived(QByteArray&);
+ void commandFinished();
+private:
+ QString m_fileName;
+ QFile m_file;
+ qint64 m_currentPos;
+ qint64 m_fileSize;
+};
+inline AbstractCommand* instReadFile() { return new ReadFileCommand(); }
+
+// Read Directory class
+class ReadDirectoryCommand : public AbstractCommand
+{
+ Q_OBJECT
+public:
+ ReadDirectoryCommand();
+ ~ReadDirectoryCommand();
+public slots:
+ void dataReceived(QByteArray&);
+ void commandFinished();
+private:
+ QString m_dirName;
+ QDir m_dir;
+ QDirIterator* m_iterator;
+};
+inline AbstractCommand* instReadDirectory() { return new ReadDirectoryCommand(); }
+
+// Read File Time class
+class FileTimeCommand : public AbstractCommand
+{
+ Q_OBJECT
+public:
+ FileTimeCommand();
+ ~FileTimeCommand();
+public slots:
+ void dataReceived(QByteArray&);
+ void commandFinished();
+};
+inline AbstractCommand* instFileTime() { return new FileTimeCommand(); }
+
+// Time stamp class
+class TimeStampCommand : public AbstractCommand
+{
+ Q_OBJECT
+public:
+ TimeStampCommand();
+ ~TimeStampCommand();
+public slots:
+ void dataReceived(QByteArray&);
+ void commandFinished();
+};
+inline AbstractCommand* instTimeStamp() { return new TimeStampCommand(); }
+
+// Access part
+typedef AbstractCommand* (*instantiator)();
+
+struct CommandInfo
+{
+ CommandInfo(const QString &name, instantiator func) : commandName(name) , commandFunc(func) { }
+ QString commandName;
+ instantiator commandFunc;
+};
+
+inline QList<CommandInfo> availableCommands()
+{
+ QList<CommandInfo> list;
+ list.append(CommandInfo(QLatin1String(COMMAND_CREATE_FILE), instCreateFile));
+ list.append(CommandInfo(QLatin1String(COMMAND_CREATE_DIRECTORY), instCreateDirectory));
+ list.append(CommandInfo(QLatin1String(COMMAND_COPY_FILE), instCopyFile));
+ list.append(CommandInfo(QLatin1String(COMMAND_COPY_DIRECTORY), instCopyDirectory));
+ list.append(CommandInfo(QLatin1String(COMMAND_DELETE_FILE), instDeleteFile));
+ list.append(CommandInfo(QLatin1String(COMMAND_DELETE_DIRECTORY), instDeleteDirectory));
+ list.append(CommandInfo(QLatin1String(COMMAND_EXECUTE), instExecution));
+ list.append(CommandInfo(QLatin1String(COMMAND_READ_FILE), instReadFile));
+ list.append(CommandInfo(QLatin1String(COMMAND_READ_DIRECTORY), instReadDirectory));
+ list.append(CommandInfo(QLatin1String(COMMAND_FILE_TIME), instFileTime));
+ list.append(CommandInfo(QLatin1String(COMMAND_TIME_STAMP), instTimeStamp));
+ return list;
+}
+
+#endif
diff --git a/tools/qtestlib/wince/cetcpsyncserver/connectionmanager.cpp b/tools/qtestlib/wince/cetcpsyncserver/connectionmanager.cpp
new file mode 100644
index 000000000..901cd1240
--- /dev/null
+++ b/tools/qtestlib/wince/cetcpsyncserver/connectionmanager.cpp
@@ -0,0 +1,138 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "connectionmanager.h"
+#include "commands.h"
+#include <QtCore/QDebug>
+
+ConnectionManager::ConnectionManager()
+ : QObject()
+ , m_server(0)
+{
+ debugOutput(0, "ConnectionManager::ConnectionManager()");
+}
+
+ConnectionManager::~ConnectionManager()
+{
+ debugOutput(0, "ConnectionManager::~ConnectionManager()");
+ cleanUp();
+}
+
+bool ConnectionManager::init()
+{
+ debugOutput(0, "ConnectionManager::init()");
+ debugOutput(3, "Initializing server...");
+ cleanUp();
+ m_server = new QTcpServer(this);
+ connect(m_server, SIGNAL(newConnection()), this, SLOT(newConnection()));
+ bool result = m_server->listen(QHostAddress::Any, SERVER_PORT);
+ if (!result)
+ debugOutput(3, QString::fromLatin1(" Error: Server start failed:") + m_server->errorString());
+ debugOutput(3, " Waiting for action");
+ return result;
+}
+
+void ConnectionManager::cleanUp()
+{
+ debugOutput(0, "ConnectionManager::cleanUp()");
+
+ if (m_server) {
+ debugOutput(1, "Removing server instance...");
+ disconnect(m_server, SIGNAL(newConnection()), this, SLOT(newConnection()));
+ delete m_server;
+ m_server = 0;
+ }
+}
+
+void ConnectionManager::newConnection()
+{
+ debugOutput(0, "ConnectionManager::newConnection()");
+
+ QTcpSocket* connection = m_server->nextPendingConnection();
+ if (!connection) {
+ debugOutput(3, "Received connection has empty socket");
+ return;
+ }
+ debugOutput(0, QString::fromLatin1(" received a connection: %1").arg((int) connection));
+ new Connection(connection);
+}
+
+Connection::Connection(QTcpSocket *socket)
+ : QObject()
+ , m_connection(socket)
+ , m_command(0)
+{
+ connect(m_connection, SIGNAL(readyRead()), this, SLOT(receiveCommand()));
+ connect(m_connection, SIGNAL(disconnected()), this, SLOT(closedConnection()));
+}
+
+Connection::~Connection()
+{
+ if (m_command) {
+ m_command->commandFinished();
+ delete m_command;
+ m_command = 0;
+ }
+ delete m_connection;
+}
+
+void Connection::receiveCommand()
+{
+ QByteArray arr = m_connection->readAll();
+ debugOutput(1, QString::fromLatin1("Command received: ") + (arr));
+ QList<CommandInfo> commands = availableCommands();
+ for(QList<CommandInfo>::iterator it = commands.begin(); it != commands.end(); ++it) {
+ if (it->commandName == QString::fromLatin1(arr)) {
+ debugOutput(1, "Found command in list");
+ disconnect(m_connection, SIGNAL(readyRead()), this, SLOT(receiveCommand()));
+ AbstractCommand* command = (*it).commandFunc();
+ command->setSocket(m_connection);
+ m_command = command;
+ return;
+ }
+ }
+ debugOutput(2, QString::fromLatin1("Unknown command received: ") + (arr));
+}
+
+void Connection::closedConnection()
+{
+ debugOutput(0, "connection being closed...");
+ this->deleteLater();
+}
diff --git a/tools/qtestlib/wince/cetcpsyncserver/connectionmanager.h b/tools/qtestlib/wince/cetcpsyncserver/connectionmanager.h
new file mode 100644
index 000000000..21183ac71
--- /dev/null
+++ b/tools/qtestlib/wince/cetcpsyncserver/connectionmanager.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef CONNECTION_MANAGER_INCL
+#define CONNECTION_MANAGER_INCL
+
+#include "transfer_global.h"
+#include "commands.h"
+
+#include <QtNetwork/QTcpServer>
+#include <QtNetwork/QTcpSocket>
+
+class Connection : public QObject
+{
+ Q_OBJECT
+public:
+ Connection(QTcpSocket* socket);
+ ~Connection();
+
+public slots:
+ void receiveCommand();
+ void closedConnection();
+
+private:
+ QTcpSocket* m_connection;
+ AbstractCommand* m_command;
+};
+
+class ConnectionManager : public QObject
+{
+ Q_OBJECT
+public:
+ ConnectionManager();
+ ~ConnectionManager();
+
+ bool init();
+
+public slots:
+ void cleanUp();
+ void newConnection();
+
+private:
+ QTcpServer* m_server;
+};
+
+#endif
diff --git a/tools/qtestlib/wince/cetcpsyncserver/main.cpp b/tools/qtestlib/wince/cetcpsyncserver/main.cpp
new file mode 100644
index 000000000..19d38ea80
--- /dev/null
+++ b/tools/qtestlib/wince/cetcpsyncserver/main.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "connectionmanager.h"
+
+#include <QtCore>
+#include <QtNetwork>
+
+void messageOutput(QtMsgType type, const char *msg)
+{
+ switch(type) {
+ case QtDebugMsg: fprintf(stderr, "Debug: %s\n", msg); break;
+ case QtWarningMsg: fprintf(stderr, "Warning: %s\n", msg); break;
+ default: fprintf(stderr, "Some Msg: %s\n", msg); break;
+ }
+}
+
+int main(int argc, char **argv)
+{
+ qInstallMsgHandler(messageOutput);
+
+ QCoreApplication app(argc, argv);
+ ConnectionManager manager;
+ manager.init();
+ return app.exec();
+}
diff --git a/tools/qtestlib/wince/cetcpsyncserver/transfer_global.h b/tools/qtestlib/wince/cetcpsyncserver/transfer_global.h
new file mode 100644
index 000000000..5b6ff23d3
--- /dev/null
+++ b/tools/qtestlib/wince/cetcpsyncserver/transfer_global.h
@@ -0,0 +1,159 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef TRANSFER_GLOBAL_H
+#define TRANSFER_GLOBAL_H
+
+#include <QtCore/qglobal.h>
+#ifdef Q_OS_WIN
+#include <windows.h>
+#endif
+
+#define SERVER_PORT 12145
+
+#define MAX_NAME_LENGTH 512
+#define MAX_ARGUMENTS 10
+
+// Defines for commands sent/received
+#define COMMAND_CREATE_FILE "CREATEFILE"
+#define COMMAND_CREATE_DIRECTORY "CREATEDIR"
+#define COMMAND_COPY_FILE "COPYFILE"
+#define COMMAND_COPY_DIRECTORY "COPYDIR"
+#define COMMAND_DELETE_FILE "DELETEFILE"
+#define COMMAND_DELETE_DIRECTORY "DELETEDIR"
+#define COMMAND_EXECUTE "EXECUTE"
+#define COMMAND_QUIT_SERVER "QUIT"
+#define COMMAND_FILE_TIME "FILETIME"
+#define COMMAND_TIME_STAMP "TIMESTAMP"
+
+// Report back commands
+#define COMMAND_SUCCESS "SUCCESS"
+#define COMMAND_ERROR "ERROR"
+
+// Defines for commands that send data back to requester
+#define COMMAND_READ_FILE "READFILE"
+#define COMMAND_READ_DIRECTORY "READDIR"
+
+#include <QtCore/qglobal.h>
+// Option-Structures for commands
+
+struct CreateFileOptions
+{
+ char fileName[MAX_NAME_LENGTH];
+#ifdef Q_OS_WIN
+ FILETIME fileTime;
+ DWORD fileAttributes;
+#endif
+ int fileSize;
+ bool overwriteExisting;
+};
+
+struct CreateDirectoryOptions
+{
+ char dirName[MAX_NAME_LENGTH];
+ bool recursively; // in case of \foo\bar create \foo if it does not exist
+};
+
+struct CopyFileOptions
+{
+ char from[MAX_NAME_LENGTH];
+ char to[MAX_NAME_LENGTH];
+ bool overwriteExisting;
+};
+
+struct CopyDirectoryOptions
+{
+ char from[MAX_NAME_LENGTH];
+ char to[MAX_NAME_LENGTH];
+ bool recursive;
+};
+
+struct DeleteFileOptions
+{
+ char fileName[MAX_NAME_LENGTH];
+};
+
+struct DeleteDirectoryOptions
+{
+ char dirName[MAX_NAME_LENGTH];
+ bool recursive;
+ bool failIfContentExists;
+};
+
+struct ExecuteOptions
+{
+ char appName[MAX_NAME_LENGTH];
+ int argumentsCount;
+ bool waitForFinished;
+ int timeout;
+};
+
+struct ReadFileOptions
+{
+ char fileName[MAX_NAME_LENGTH];
+};
+
+struct ReadFileReply
+{
+ qint64 fileSize;
+ bool fileValid;
+};
+
+struct ReadDirectoryOptions
+{
+ char dirName[MAX_NAME_LENGTH];
+};
+
+struct ReadDirectoryItem
+{
+ char name[MAX_NAME_LENGTH];
+ qint64 size;
+ bool isDirectory;
+ bool hasMore;
+};
+
+#define FileTimeOptions ReadFileOptions
+
+struct ReadDirectoryReply
+{
+ bool entryValid;
+ int itemCount; // might change during iteration
+};
+#endif
diff --git a/tools/qtestlib/wince/cetest/cetcpsyncconnection.cpp b/tools/qtestlib/wince/cetest/cetcpsyncconnection.cpp
new file mode 100644
index 000000000..621a6acd5
--- /dev/null
+++ b/tools/qtestlib/wince/cetest/cetcpsyncconnection.cpp
@@ -0,0 +1,200 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "CeTcpSyncConnection.h"
+#include <qdir.h>
+#include <qfile.h>
+#include <qfileinfo>
+
+static const QString ceTcpSyncProgram = "cetcpsync";
+extern void debugOutput(const QString& text, int level);
+
+CeTcpSyncConnection::CeTcpSyncConnection()
+ : AbstractRemoteConnection()
+ , connected(false)
+{
+}
+
+CeTcpSyncConnection::~CeTcpSyncConnection()
+{
+ if (isConnected())
+ disconnect();
+}
+
+bool CeTcpSyncConnection::connect(QVariantList&)
+{
+ // We connect with each command, so this is always true
+ // The command itself will fail then
+ const QString cmd = ceTcpSyncProgram + " noop";
+ if (system(qPrintable(cmd)) != 0)
+ return false;
+ connected = true;
+ return true;
+}
+
+void CeTcpSyncConnection::disconnect()
+{
+ connected = false;
+}
+
+bool CeTcpSyncConnection::isConnected() const
+{
+ return connected;
+}
+
+inline QString boolToString(bool b)
+{
+ return b ? "true" : "false";
+}
+
+static bool fileTimeFromString(FILETIME& ft, const QString& str)
+{
+ int idx = str.indexOf("*");
+ if (idx <= 0)
+ return false;
+ bool ok;
+ ft.dwLowDateTime = str.left(idx).toULong(&ok);
+ if (!ok)
+ return false;
+ ft.dwHighDateTime = str.mid(idx+1).toULong(&ok);
+ return ok;
+}
+
+static QString fileTimeToString(FILETIME& ft)
+{
+ return QString::number(ft.dwLowDateTime) + "*" + QString::number(ft.dwHighDateTime);
+}
+
+bool CeTcpSyncConnection::copyFileToDevice(const QString &localSource, const QString &deviceDest, bool failIfExists)
+{
+ QString cmd = ceTcpSyncProgram + " copyFileToDevice \"" + localSource + "\" \"" + deviceDest + "\" " + boolToString(failIfExists);
+ return system(qPrintable(cmd)) == 0;
+}
+
+bool CeTcpSyncConnection::copyDirectoryToDevice(const QString &localSource, const QString &deviceDest, bool recursive)
+{
+ QString cmd = ceTcpSyncProgram + " copyDirectoryToDevice \"" + localSource + "\" \"" + deviceDest + "\" " + boolToString(recursive);
+ return system(qPrintable(cmd)) == 0;
+}
+
+bool CeTcpSyncConnection::copyFileFromDevice(const QString &deviceSource, const QString &localDest, bool failIfExists)
+{
+ QString cmd = ceTcpSyncProgram + " copyFileFromDevice \"" + deviceSource + "\" \"" + localDest + "\" " + boolToString(failIfExists);
+ return system(qPrintable(cmd)) == 0;
+}
+
+bool CeTcpSyncConnection::copyDirectoryFromDevice(const QString &deviceSource, const QString &localDest, bool recursive)
+{
+ QString cmd = ceTcpSyncProgram + " copyDirectoryFromDevice \"" + deviceSource + "\" \"" + localDest + "\" " + boolToString(recursive);
+ return system(qPrintable(cmd)) == 0;
+}
+
+bool CeTcpSyncConnection::copyFile(const QString &srcFile, const QString &destFile, bool failIfExists)
+{
+ QString cmd = ceTcpSyncProgram + " copyFile \"" + srcFile + "\" \"" + destFile + "\" " + boolToString(failIfExists);
+ return system(qPrintable(cmd)) == 0;
+}
+
+bool CeTcpSyncConnection::copyDirectory(const QString &srcDirectory, const QString &destDirectory,
+ bool recursive)
+{
+ QString cmd = ceTcpSyncProgram + " copyDirectory \"" + srcDirectory + "\" \"" + destDirectory + "\" " + boolToString(recursive);
+ return system(qPrintable(cmd)) == 0;
+}
+
+bool CeTcpSyncConnection::deleteFile(const QString &fileName)
+{
+ QString cmd = ceTcpSyncProgram + " deleteFile \"" + fileName + "\"";
+ return system(qPrintable(cmd)) == 0;
+}
+
+bool CeTcpSyncConnection::deleteDirectory(const QString &directory, bool recursive, bool failIfContentExists)
+{
+ QString cmd = ceTcpSyncProgram + " deleteDirectory \"" + directory + "\" " + boolToString(recursive) + " " + boolToString(failIfContentExists);
+ return system(qPrintable(cmd)) == 0;
+}
+
+bool CeTcpSyncConnection::execute(QString program, QString arguments, int timeout, int *returnValue)
+{
+ QString cmd = ceTcpSyncProgram + " execute \"" + program + "\" \"" + arguments + "\" " + QString::number(timeout);
+ int exitCode = system(qPrintable(cmd));
+ if (returnValue)
+ *returnValue = exitCode;
+ return true;
+}
+
+bool CeTcpSyncConnection::createDirectory(const QString &path, bool deleteBefore)
+{
+ QString cmd = ceTcpSyncProgram + " createDirectory \"" + path + "\" " + boolToString(deleteBefore);
+ return system(qPrintable(cmd)) == 0;
+}
+
+bool CeTcpSyncConnection::timeStampForLocalFileTime(FILETIME* fTime) const
+{
+ QString cmd = ceTcpSyncProgram + " timeStampForLocalFileTime " + fileTimeToString(*fTime) + " >qt_cetcpsyncdata.txt";
+ if (system(qPrintable(cmd)) != 0)
+ return false;
+
+ QFile file("qt_cetcpsyncdata.txt");
+ if (!file.open(QIODevice::ReadOnly))
+ return false;
+
+ bool result = fileTimeFromString(*fTime, file.readLine());
+ file.close();
+ file.remove();
+ return result;
+}
+
+bool CeTcpSyncConnection::fileCreationTime(const QString &fileName, FILETIME* deviceCreationTime) const
+{
+ QString cmd = ceTcpSyncProgram + " fileCreationTime \"" + fileName + "\" >qt_cetcpsyncdata.txt";
+ if (system(qPrintable(cmd)) != 0)
+ return false;
+
+ QFile file("qt_cetcpsyncdata.txt");
+ if (!file.open(QIODevice::ReadOnly))
+ return false;
+
+ bool result = fileTimeFromString(*deviceCreationTime, file.readLine());
+ file.close();
+ file.remove();
+ return result;
+}
diff --git a/tools/qtestlib/wince/cetest/cetcpsyncconnection.h b/tools/qtestlib/wince/cetest/cetcpsyncconnection.h
new file mode 100644
index 000000000..1ef8423cf
--- /dev/null
+++ b/tools/qtestlib/wince/cetest/cetcpsyncconnection.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CETCPSYNC_REMOTECONNECTION_H
+#define CETCPSYNC_REMOTECONNECTION_H
+
+#include "remoteconnection.h"
+
+class CeTcpSyncConnection : public AbstractRemoteConnection
+{
+public:
+ CeTcpSyncConnection();
+ virtual ~CeTcpSyncConnection();
+
+ bool connect(QVariantList &list = QVariantList());
+ void disconnect();
+ bool isConnected() const;
+
+ // These functions are designed for transfer between desktop and device
+ // Caution: deviceDest path has to be device specific (eg. no drive letters for CE)
+ bool copyFileToDevice(const QString &localSource, const QString &deviceDest, bool failIfExists = false);
+ bool copyDirectoryToDevice(const QString &localSource, const QString &deviceDest, bool recursive = true);
+ bool copyFileFromDevice(const QString &deviceSource, const QString &localDest, bool failIfExists = false);
+ bool copyDirectoryFromDevice(const QString &deviceSource, const QString &localDest, bool recursive = true);
+
+ bool timeStampForLocalFileTime(FILETIME*) const;
+ bool fileCreationTime(const QString &fileName, FILETIME*) const;
+
+ // These functions only work on files existing on the device
+ bool copyFile(const QString&, const QString&, bool failIfExists = false);
+ bool copyDirectory(const QString&, const QString&, bool recursive = true);
+ bool deleteFile(const QString&);
+ bool deleteDirectory(const QString&, bool recursive = true, bool failIfContentExists = false);
+ bool moveFile(const QString&, const QString&, bool FailIfExists = false);
+ bool moveDirectory(const QString&, const QString&, bool recursive = true);
+
+ bool createDirectory(const QString&, bool deleteBefore=false);
+
+ bool execute(QString program, QString arguments = QString(), int timeout = -1, int *returnValue = NULL);
+private:
+ bool connected;
+};
+
+#endif
diff --git a/tools/qtestlib/wince/cetest/cetest.pro b/tools/qtestlib/wince/cetest/cetest.pro
index d66fa3318..a6b79dafd 100644
--- a/tools/qtestlib/wince/cetest/cetest.pro
+++ b/tools/qtestlib/wince/cetest/cetest.pro
@@ -28,20 +28,27 @@ DEPENDPATH += $$QT_BUILD_TREE/src/corelib/tools $$QT_BUILD_TREE/src/corelib/io
# Input
HEADERS += \
remoteconnection.h \
- activesyncconnection.h \
deployment.h
SOURCES += \
remoteconnection.cpp \
- activesyncconnection.cpp \
deployment.cpp \
main.cpp
-win32-msvc*:LIBS += ole32.lib advapi32.lib rapi.lib
+LIBS += ole32.lib advapi32.lib
+
+isEmpty(QT_CE_RAPI_INC) {
+ DEFINES += QT_CETEST_NO_ACTIVESYNC
+ HEADERS += cetcpsyncconnection.h
+ SOURCES += cetcpsyncconnection.cpp
+} else {
+ HEADERS += activesyncconnection.h
+ SOURCES += activesyncconnection.cpp
+ LIBS += rapi.lib
+ INCLUDEPATH += $$QT_CE_RAPI_INC
+ LIBS += -L$$QT_CE_RAPI_LIB
+}
include(qmake_include.pri)
include(bootstrapped.pri)
include($$QT_SOURCE_TREE/src/script/script.pri)
-
-INCLUDEPATH += $$QT_CE_RAPI_INC
-LIBS += -L$$QT_CE_RAPI_LIB
diff --git a/tools/qtestlib/wince/cetest/deployment.cpp b/tools/qtestlib/wince/cetest/deployment.cpp
index 68f0197f0..c64ae261e 100644
--- a/tools/qtestlib/wince/cetest/deployment.cpp
+++ b/tools/qtestlib/wince/cetest/deployment.cpp
@@ -168,6 +168,7 @@ void DeploymentHandler::initQtDeploy(QMakeProject *project, DeploymentList &depl
}
}
+#ifndef QT_CETEST_NO_ACTIVESYNC
// QtRemote deployment. We always deploy to \Windows
if (!project->values("QMAKE_LIBDIR").isEmpty()) {
QString remoteLibName = QLatin1String("QtRemote.dll");
@@ -177,6 +178,7 @@ void DeploymentHandler::initQtDeploy(QMakeProject *project, DeploymentList &depl
else
debugOutput(QString::fromLatin1("Could not find QtRemote. Might not be able to launch target executable"),0);
}
+#endif
// C-runtime deployment
QString runtime = project->values("QT_CE_C_RUNTIME").join(QLatin1String(" "));
diff --git a/tools/qtestlib/wince/cetest/main.cpp b/tools/qtestlib/wince/cetest/main.cpp
index 782f6d953..e0e475ccc 100644
--- a/tools/qtestlib/wince/cetest/main.cpp
+++ b/tools/qtestlib/wince/cetest/main.cpp
@@ -39,7 +39,12 @@
**
****************************************************************************/
-#include "activesyncconnection.h"
+#ifdef QT_CETEST_NO_ACTIVESYNC
+# include "cetcpsyncconnection.h"
+#else
+# include "activesyncconnection.h"
+#endif
+
#include "deployment.h"
#include <option.h>
#include <project.h>
@@ -290,7 +295,11 @@ int main(int argc, char **argv)
projectDeploymentList.append(CopyItem(TestConfiguration::localExecutable , TestConfiguration::remoteExecutable));
// deploy
+#ifdef QT_CETEST_NO_ACTIVESYNC
+ CeTcpSyncConnection connection;
+#else
ActiveSyncConnection connection;
+#endif
if (!connection.connect()) {
cout << "Error: Could not connect to device!" << endl;
return -1;
diff --git a/translations/assistant_de.ts b/translations/assistant_de.ts
index f7024654f..ce3206243 100644
--- a/translations/assistant_de.ts
+++ b/translations/assistant_de.ts
@@ -52,11 +52,11 @@
<translation>Neuer Ordner</translation>
</message>
<message>
- <location filename="../tools/assistant/tools/assistant/bookmarkmanager.cpp" line="+185"/>
+ <location filename="../tools/assistant/tools/assistant/bookmarkmanager.cpp" line="+184"/>
<location line="+18"/>
- <location line="+36"/>
- <location line="+24"/>
- <location line="+32"/>
+ <location line="+39"/>
+ <location line="+18"/>
+ <location line="+30"/>
<source>Bookmarks</source>
<translation>Lesezeichen</translation>
</message>
@@ -66,7 +66,7 @@
<translation>+</translation>
</message>
<message>
- <location filename="../tools/assistant/tools/assistant/bookmarkmanager.cpp" line="-69"/>
+ <location filename="../tools/assistant/tools/assistant/bookmarkmanager.cpp" line="-61"/>
<source>Delete Folder</source>
<translation>Ordner löschen</translation>
</message>
@@ -79,12 +79,12 @@
<context>
<name>BookmarkManager</name>
<message>
- <location line="+450"/>
+ <location line="+434"/>
<source>Bookmarks</source>
<translation>Lesezeichen</translation>
</message>
<message>
- <location line="+36"/>
+ <location line="+37"/>
<source>Remove</source>
<translation>Entfernen</translation>
</message>
@@ -94,7 +94,7 @@
<translation>Wenn Sie diesen Ordner löschen, wird auch&lt;br&gt;dessen kompletter Inhalt gelöscht. Möchten Sie wirklich fortfahren?</translation>
</message>
<message>
- <location line="+109"/>
+ <location line="+143"/>
<location line="+9"/>
<source>New Folder</source>
<translation>Neuer Ordner</translation>
@@ -103,25 +103,17 @@
<context>
<name>BookmarkWidget</name>
<message>
- <location line="-391"/>
+ <location line="-416"/>
<source>Filter:</source>
<translation>Filter:</translation>
</message>
<message>
- <source>Bookmarks</source>
- <translation type="obsolete">Lesezeichen</translation>
- </message>
- <message>
- <location line="+32"/>
+ <location line="+33"/>
<source>Remove</source>
<translation>Entfernen</translation>
</message>
<message>
- <source>You are going to delete a Folder, this will also&lt;br&gt;remove it&apos;s content. Are you sure to continue?</source>
- <translation type="obsolete">Wenn Sie dieses Verzeichnis löschen, wird auch&lt;br&gt;dessen kompletter Inhalt gelöscht! Fortfahren?</translation>
- </message>
- <message>
- <location line="-78"/>
+ <location line="-79"/>
<source>Delete Folder</source>
<translation>Ordner löschen</translation>
</message>
@@ -151,11 +143,7 @@
<translation>Lesezeichen umbenennen</translation>
</message>
<message>
- <source>Search for:</source>
- <translation type="obsolete">Suchen:</translation>
- </message>
- <message>
- <location line="+61"/>
+ <location line="+62"/>
<source>Add</source>
<translation>Hinzufügen</translation>
</message>
@@ -163,7 +151,7 @@
<context>
<name>CentralWidget</name>
<message>
- <location filename="../tools/assistant/tools/assistant/centralwidget.cpp" line="+208"/>
+ <location filename="../tools/assistant/tools/assistant/centralwidget.cpp" line="+238"/>
<source>Add new page</source>
<translation>Neue Seite hinzufügen</translation>
</message>
@@ -173,7 +161,7 @@
<translation>Aktuelle Seite schließen</translation>
</message>
<message>
- <location line="+282"/>
+ <location line="+312"/>
<source>Print Document</source>
<translation>Drucken</translation>
</message>
@@ -184,7 +172,7 @@
<translation>unbekannt</translation>
</message>
<message>
- <location line="+91"/>
+ <location line="+93"/>
<source>Add New Page</source>
<translation>Neue Seite hinzufügen</translation>
</message>
@@ -204,7 +192,7 @@
<translation>Lesezeichen für diese Seite hinzufügen ...</translation>
</message>
<message>
- <location line="+259"/>
+ <location line="+255"/>
<source>Search</source>
<translation>Suchen</translation>
</message>
@@ -212,7 +200,7 @@
<context>
<name>ContentWindow</name>
<message>
- <location filename="../tools/assistant/tools/assistant/contentwindow.cpp" line="+155"/>
+ <location filename="../tools/assistant/tools/assistant/contentwindow.cpp" line="+158"/>
<source>Open Link</source>
<translation>Link öffnen</translation>
</message>
@@ -225,10 +213,6 @@
<context>
<name>FilterNameDialogClass</name>
<message>
- <source>FilterNameDialog</source>
- <translation type="obsolete">FilterNameDialog</translation>
- </message>
- <message>
<location filename="../tools/assistant/tools/assistant/filternamedialog.ui"/>
<source>Add Filter Name</source>
<translation>Filternamen hinzufügen</translation>
@@ -242,7 +226,7 @@
<context>
<name>FindWidget</name>
<message>
- <location filename="../tools/assistant/tools/assistant/centralwidget.cpp" line="-899"/>
+ <location filename="../tools/assistant/tools/assistant/centralwidget.cpp" line="-955"/>
<source>Previous</source>
<translation>Zurück</translation>
</message>
@@ -303,12 +287,6 @@
<translation>Hilfe</translation>
</message>
<message>
- <source>Unable to launch web browser.
-</source>
- <translation type="obsolete">Der Webbrowser konnte nicht gestarted werden.
-</translation>
- </message>
- <message>
<location line="+1"/>
<source>OK</source>
<translation>OK</translation>
@@ -362,13 +340,13 @@
<context>
<name>InstallDialog</name>
<message>
- <location filename="../tools/assistant/tools/assistant/installdialog.cpp" line="+75"/>
<location filename="../tools/assistant/tools/assistant/installdialog.ui"/>
+ <location filename="../tools/assistant/tools/assistant/installdialog.cpp" line="+76"/>
<source>Install Documentation</source>
<translation>Dokumentation installieren</translation>
</message>
<message>
- <location line="+30"/>
+ <location filename="../tools/assistant/tools/assistant/installdialog.cpp" line="+30"/>
<source>Downloading documentation info...</source>
<translation>Dokumentationsinformation herunterladen ...</translation>
</message>
@@ -462,20 +440,20 @@
<context>
<name>MainWindow</name>
<message>
- <location filename="../tools/assistant/tools/assistant/mainwindow.cpp" line="+108"/>
- <location line="+354"/>
+ <location filename="../tools/assistant/tools/assistant/mainwindow.cpp" line="+110"/>
+ <location line="+391"/>
<source>Index</source>
<translation>Index</translation>
</message>
<message>
- <location line="-348"/>
- <location line="+346"/>
+ <location line="-385"/>
+ <location line="+383"/>
<source>Contents</source>
<translation>Inhalt</translation>
</message>
<message>
- <location line="-341"/>
- <location line="+345"/>
+ <location line="-378"/>
+ <location line="+382"/>
<source>Bookmarks</source>
<translation>Lesezeichen</translation>
</message>
@@ -485,24 +463,20 @@
<translation>Suchen</translation>
</message>
<message>
- <location line="-335"/>
- <location line="+208"/>
- <location line="+476"/>
+ <location line="-372"/>
+ <location line="+215"/>
+ <location line="+502"/>
<source>Qt Assistant</source>
<translation>Qt Assistant</translation>
</message>
<message>
- <location line="-508"/>
+ <location line="-534"/>
<location line="+5"/>
<source>Unfiltered</source>
<translation>Ohne Filter</translation>
</message>
<message>
- <source>File</source>
- <translation type="obsolete">Datei</translation>
- </message>
- <message>
- <location line="+84"/>
+ <location line="+107"/>
<source>Page Set&amp;up...</source>
<translation>S&amp;eite einrichten ...</translation>
</message>
@@ -517,111 +491,62 @@
<translation>&amp;Drucken ...</translation>
</message>
<message>
- <source>CTRL+P</source>
- <translation type="obsolete">CTRL+P</translation>
- </message>
- <message>
- <location line="+6"/>
+ <location line="+7"/>
<source>New &amp;Tab</source>
<translation>Neuer &amp;Tab</translation>
</message>
<message>
- <source>CTRL+T</source>
- <translation type="obsolete">CTRL+T</translation>
- </message>
- <message>
<location line="+3"/>
<source>&amp;Close Tab</source>
<translation>Tab &amp;schließen</translation>
</message>
<message>
- <source>CTRL+W</source>
- <translation type="obsolete">CTRL+W</translation>
- </message>
- <message>
<location line="+4"/>
<source>&amp;Quit</source>
<translation>&amp;Beenden</translation>
</message>
<message>
- <location line="+1"/>
- <source>CTRL+Q</source>
- <translation>CTRL+Q</translation>
- </message>
- <message>
- <source>Edit</source>
- <translation type="obsolete">Bearbeiten</translation>
- </message>
- <message>
- <location line="+4"/>
+ <location line="+5"/>
<source>&amp;Copy selected Text</source>
<translation>Ausgewählten Text &amp;kopieren</translation>
</message>
<message>
- <source>Ctrl+C</source>
- <translation type="obsolete">Ctrl+C</translation>
- </message>
- <message>
- <location line="+6"/>
+ <location line="+8"/>
<source>&amp;Find in Text...</source>
<translation>&amp;Textsuche ...</translation>
</message>
<message>
- <source>Ctrl+F</source>
- <translation type="obsolete">Ctrl+F</translation>
- </message>
- <message>
- <location line="+5"/>
+ <location line="+6"/>
<source>Find &amp;Next</source>
<translation>&amp;Weitersuchen</translation>
</message>
<message>
- <source>F3</source>
- <translation type="obsolete">F3</translation>
- </message>
- <message>
<location line="+4"/>
<source>Find &amp;Previous</source>
<translation>&amp;Vorheriges suchen</translation>
</message>
<message>
- <source>Shift+F3</source>
- <translation type="obsolete">Shift+F3</translation>
- </message>
- <message>
<location line="+5"/>
<source>Preferences...</source>
<translation>Einstellungen ...</translation>
</message>
<message>
- <source>View</source>
- <translation type="obsolete">Ansicht</translation>
- </message>
- <message>
<location line="+4"/>
<source>Zoom &amp;in</source>
<translation>&amp;Vergrößern</translation>
</message>
<message>
- <source>Ctrl++</source>
- <translation type="obsolete">Ctrl++</translation>
- </message>
- <message>
- <location line="+5"/>
+ <location line="+6"/>
<source>Zoom &amp;out</source>
<translation>Ver&amp;kleinern</translation>
</message>
<message>
- <source>Ctrl+-</source>
- <translation type="obsolete">Ctrl+-</translation>
- </message>
- <message>
- <location line="+5"/>
+ <location line="+6"/>
<source>Normal &amp;Size</source>
<translation>Standard&amp;größe</translation>
</message>
<message>
- <location line="+3"/>
+ <location line="+4"/>
<source>Ctrl+0</source>
<translation>Ctrl+0</translation>
</message>
@@ -636,30 +561,17 @@
<translation>ALT+I</translation>
</message>
<message>
- <source>ALT+B</source>
- <translation type="obsolete">ALT+B</translation>
- </message>
- <message>
<location line="+4"/>
<source>ALT+S</source>
<translation>ALT+S</translation>
</message>
<message>
- <source>Go</source>
- <translation type="obsolete">Gehe</translation>
- </message>
- <message>
<location line="+3"/>
<source>&amp;Home</source>
<translation>&amp;Startseite</translation>
</message>
<message>
- <location line="+1"/>
- <source>Ctrl+Home</source>
- <translation>Ctrl+Home</translation>
- </message>
- <message>
- <location line="+3"/>
+ <location line="+4"/>
<source>&amp;Back</source>
<translation>&amp;Rückwärts</translation>
</message>
@@ -669,12 +581,12 @@
<translation>&amp;Vorwärts</translation>
</message>
<message>
- <location line="+5"/>
+ <location line="+6"/>
<source>Sync with Table of Contents</source>
<translation>Seite mit Inhalt-Tab abgleichen</translation>
</message>
<message>
- <location line="+6"/>
+ <location line="+7"/>
<source>Next Page</source>
<translation>Nächste Seite</translation>
</message>
@@ -699,15 +611,7 @@
<translation>Lesezeichen hinzufügen ...</translation>
</message>
<message>
- <source>CTRL+B</source>
- <translation type="obsolete">CTRL+B</translation>
- </message>
- <message>
- <source>Help</source>
- <translation type="obsolete">Hilfe</translation>
- </message>
- <message>
- <location line="+4"/>
+ <location line="+5"/>
<source>About...</source>
<translation>Über ...</translation>
</message>
@@ -747,38 +651,22 @@
<translation>Der zugehörige Inhaltseintrag konnte nicht gefunden werden.</translation>
</message>
<message>
- <source>Open Source Edition</source>
- <translation type="obsolete">Open Source Edition</translation>
- </message>
- <message>
- <source>This version of Qt Assistant is part of the Qt Open Source Edition, for use in the development of Open Source applications. Qt is a comprehensive C++ framework for cross-platform application development.</source>
- <translation type="obsolete">This version of Qt Assistant is part of the Qt Open Source Edition, for use in the development of Open Source applications. Qt is a comprehensive C++ framework for cross-platform application development.</translation>
- </message>
- <message>
- <source>You need a commercial Qt license for development of proprietary (closed source) applications. Please see &lt;a href=&quot;http://qtsoftware.com/company/model.html&quot;&gt;qtsoftware.com/company/model.html&lt;/a&gt; for an overview of Qt licensing.</source>
- <translation type="obsolete">You need a commercial Qt license for development of proprietary (closed source) applications. Please see &lt;a href=&quot;http://qtsoftware.com/company/model.html&quot;&gt;qtsoftware.com/company/model.html&lt;/a&gt; for an overview of Qt licensing.</translation>
- </message>
- <message>
- <source>This program is licensed to you under the terms of the Qt Commercial License Agreement. For details, see the file LICENSE that came with this software distribution.</source>
- <translation type="obsolete">This program is licensed to you under the terms of the Qt Commercial License Agreement. For details, see the file LICENSE that came with this software distribution.</translation>
- </message>
- <message>
- <location line="+81"/>
+ <location line="+74"/>
<source>About %1</source>
<translation>Über %1</translation>
</message>
<message>
- <location line="+113"/>
+ <location line="+114"/>
<source>Updating search index</source>
<translation>Suchindex wird aufgebaut</translation>
</message>
<message>
- <location line="-601"/>
+ <location line="-628"/>
<source>Looking for Qt Documentation...</source>
<translation>Suche nach Qt-Dokumentation ...</translation>
</message>
<message>
- <location line="+195"/>
+ <location line="+228"/>
<source>&amp;Window</source>
<translation>&amp;Fenster</translation>
</message>
@@ -798,54 +686,47 @@
<translation>Zoom</translation>
</message>
<message>
- <source>Add</source>
- <translation type="obsolete">Hinzufügen</translation>
- </message>
- <message>
- <source>Remove</source>
- <translation type="obsolete">Entfernen</translation>
- </message>
- <message>
- <location line="-136"/>
+ <location line="-146"/>
<source>&amp;File</source>
<translation>&amp;Datei</translation>
</message>
<message>
- <location line="+24"/>
+ <location line="+25"/>
<source>&amp;Edit</source>
<translation>&amp;Bearbeiten</translation>
</message>
<message>
- <location line="+24"/>
+ <location line="+27"/>
<source>&amp;View</source>
<translation>&amp;Ansicht</translation>
</message>
<message>
- <location line="+27"/>
+ <location line="+30"/>
<source>&amp;Go</source>
<translation>&amp;Gehe zu</translation>
</message>
<message>
+ <location line="+2"/>
+ <source>ALT+Home</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
<location line="+29"/>
<source>&amp;Bookmarks</source>
<translation>&amp;Lesezeichen</translation>
</message>
<message>
- <location line="+4"/>
+ <location line="+5"/>
<source>&amp;Help</source>
<translation>&amp;Hilfe</translation>
</message>
<message>
- <source>You need a commercial Qt license for development of proprietary (closed source) applications. Please see &lt;a href=&quot;http://qtsoftware.com/company/about/businessmodel&quot;&gt;http://qtsoftware.com/company/about/businessmodel&lt;/a&gt; for an overview of Qt licensing.</source>
- <translation type="obsolete">Sie benötigen eine kommerzielle Qt Lizenz für die Entwicklung von proprietären (geschlossenen) Anwendungen. Besuchen Sie &lt;a href=&quot;http://qtsoftware.com/company/about/businessmodel&quot;&gt;http://qtsoftware.com/company/about/businessmodel&lt;/a&gt; um sich einen Überblick über die Qt Lizenzvergabe zu verschaffen.</translation>
- </message>
- <message>
- <location line="-37"/>
+ <location line="-40"/>
<source>ALT+O</source>
<translation>ALT+O</translation>
</message>
<message>
- <location line="+35"/>
+ <location line="+38"/>
<source>CTRL+D</source>
<translation>CTRL+D</translation>
</message>
@@ -853,15 +734,7 @@
<context>
<name>PreferencesDialog</name>
<message>
- <source>From Local File System...</source>
- <translation type="obsolete">Von Dateisystem...</translation>
- </message>
- <message>
- <source>Download from Help Server...</source>
- <translation type="obsolete">Von Hilfe-Server herunterladen...</translation>
- </message>
- <message>
- <location filename="../tools/assistant/tools/assistant/preferencesdialog.cpp" line="+256"/>
+ <location filename="../tools/assistant/tools/assistant/preferencesdialog.cpp" line="+259"/>
<location line="+43"/>
<source>Add Documentation</source>
<translation>Dokumentation hinzufügen</translation>
@@ -902,7 +775,7 @@
<translation>OK</translation>
</message>
<message>
- <location line="+86"/>
+ <location line="+88"/>
<source>Use custom settings</source>
<translation>Benutzerdefinierte Einstellungen verwenden</translation>
</message>
@@ -980,22 +853,6 @@
<translation>Hinzufügen ...</translation>
</message>
<message>
- <source>Network</source>
- <translation type="obsolete">Netzwerk</translation>
- </message>
- <message>
- <source>Use Http Proxy</source>
- <translation type="obsolete">Http Proxy</translation>
- </message>
- <message>
- <source>Http Proxy:</source>
- <translation type="obsolete">Http Proxy:</translation>
- </message>
- <message>
- <source>Port:</source>
- <translation type="obsolete">Port:</translation>
- </message>
- <message>
<location/>
<source>Options</source>
<translation>Einstellungen</translation>
@@ -1015,14 +872,35 @@
<source>Homepage</source>
<translation>Startseite</translation>
</message>
+ <message>
+ <location/>
+ <source>On help start:</source>
+ <translation>Zu Beginn:</translation>
+ </message>
+ <message>
+ <location/>
+ <source>Show my home page</source>
+ <translation>Startseite zeigen</translation>
+ </message>
+ <message>
+ <location/>
+ <source>Show a blank page</source>
+ <translation>Leere Seite zeigen</translation>
+ </message>
+ <message>
+ <location/>
+ <source>Show my tabs from last session</source>
+ <translation>Reiter aus letzter Sitzung zeigen</translation>
+ </message>
+ <message>
+ <location/>
+ <source>Blank Page</source>
+ <translation>Leere Seite</translation>
+ </message>
</context>
<context>
<name>QObject</name>
<message>
- <source>New Folder</source>
- <translation type="obsolete">Neuer Ordner</translation>
- </message>
- <message>
<location filename="../tools/assistant/tools/assistant/cmdlineparser.cpp" line="+112"/>
<source>The specified collection file does not exist!</source>
<translation>Die angegebene Katalogdatei (collection file) kann nicht gefunden werden.</translation>
@@ -1085,7 +963,7 @@
<translation>Qt Assistant</translation>
</message>
<message>
- <location filename="../tools/assistant/tools/assistant/main.cpp" line="+203"/>
+ <location filename="../tools/assistant/tools/assistant/main.cpp" line="+217"/>
<source>Could not register documentation file
%1
@@ -1128,12 +1006,6 @@ Grund:
<source>The specified collection file could not be read!</source>
<translation>Die angegebene Katalogdatei (collection file) kann nicht gelesen werden.</translation>
</message>
- <message>
- <location filename="../tools/assistant/tools/assistant/bookmarkmanager.cpp" line="+167"/>
- <location line="+1"/>
- <source>Bookmark</source>
- <translation>Lesezeichen</translation>
- </message>
</context>
<context>
<name>RemoteControl</name>
@@ -1170,10 +1042,6 @@ Grund:
<source>Select All</source>
<translation>Alles markieren</translation>
</message>
- <message>
- <source>Open Link</source>
- <translation type="obsolete">Link öffnen</translation>
- </message>
</context>
<context>
<name>TopicChooser</name>
diff --git a/translations/linguist_de.ts b/translations/linguist_de.ts
index 48f1f2e4d..8924b6e3b 100644
--- a/translations/linguist_de.ts
+++ b/translations/linguist_de.ts
@@ -2,24 +2,9 @@
<!DOCTYPE TS>
<TS version="2.0" language="de">
<context>
- <name></name>
- <message>
- <location filename="../tools/linguist/linguist/phrasebookbox.cpp" line="+59"/>
- <source>(New Entry)</source>
- <translation>(Neuer Eintrag)</translation>
- </message>
-</context>
-<context>
- <name>@default</name>
- <message>
- <source>(New Phrase)</source>
- <translation type="obsolete">(Neue Phrase)</translation>
- </message>
-</context>
-<context>
<name>AboutDialog</name>
<message>
- <location filename="../tools/linguist/linguist/mainwindow.cpp" line="+1357"/>
+ <location filename="../tools/linguist/linguist/mainwindow.cpp" line="+1359"/>
<source>Qt Linguist</source>
<translation>Qt Linguist</translation>
</message>
@@ -76,11 +61,6 @@
</message>
<message>
<location/>
- <source>Note that the modified entries will be reset to unfinished if &apos;Set translated entries to finished&apos; above is unchecked.</source>
- <translation>Beachten Sie, dass die geänderten Einträge in den Status &apos;unerledigt&apos; zurückgesetzt werden, wenn &apos;Übersetzung als erledigt markieren&apos; deaktiviert ist.</translation>
- </message>
- <message>
- <location/>
<source>Translate also finished entries</source>
<translation>Erledigte Einträge übersetzen</translation>
</message>
@@ -101,11 +81,6 @@
</message>
<message>
<location/>
- <source>The batch translator will search through the selected phrase books in the order given above.</source>
- <translation>Der automatische Übersetzer wird in der angegebenen Reihenfolge durch die ausgewählten Wörterbücher gehen.</translation>
- </message>
- <message>
- <location/>
<source>&amp;Run</source>
<translation>&amp;Ausführen</translation>
</message>
@@ -114,6 +89,16 @@
<source>Cancel</source>
<translation>Abbrechen</translation>
</message>
+ <message>
+ <location/>
+ <source>Note that the modified entries will be reset to unfinished if &apos;Set translated entries to finished&apos; above is unchecked</source>
+ <translation>Geänderte Einträge werden als unerledigt gekennzeichnet, wenn die obige Einstellung &apos;Übersetzung als erledigt markieren&apos; nicht aktiviert ist</translation>
+ </message>
+ <message>
+ <location/>
+ <source>The batch translator will search through the selected phrase books in the order given above</source>
+ <translation>Der automatische Übersetzer wird in der angegebenen Reihenfolge durch die ausgewählten Wörterbücher gehen</translation>
+ </message>
</context>
<context>
<name>DataModel</name>
@@ -156,61 +141,6 @@ Es wird mit einer einfachen Universalform gearbeitet.</translation>
</message>
</context>
<context>
- <name>EditorPage</name>
- <message>
- <source>Source text</source>
- <translation type="obsolete">Ursprungstext</translation>
- </message>
- <message>
- <source>This area shows the source text.</source>
- <translation type="obsolete">Dieser Bereich zeigt den Ursprungstext.</translation>
- </message>
- <message>
- <source>This area shows a comment that may guide you, and the context in which the text occurs.</source>
- <translation type="obsolete">Dieser Bereich zeigt eventuelle Kommentare und den Kontext, in dem der Text auftritt.</translation>
- </message>
- <message>
- <source>Existing %1 translation</source>
- <translation type="obsolete">Existierende Übersetzung %1</translation>
- </message>
- <message>
- <source>Translation</source>
- <translation type="obsolete">Übersetzung</translation>
- </message>
- <message>
- <source>%1 translation</source>
- <translation type="obsolete">Übersetzung %1</translation>
- </message>
- <message>
- <source>%1 translation (%2)</source>
- <translation type="obsolete">Übersetzung %1 (%2)</translation>
- </message>
- <message>
- <source>This is where you can enter or modify the translation of some source text.</source>
- <translation type="obsolete">Hier können Sie die Übersetzung des Ursprungstextes eingeben bzw. ändern.</translation>
- </message>
- <message>
- <source>German</source>
- <translation type="obsolete">Deutsch</translation>
- </message>
- <message>
- <source>Japanese</source>
- <translation type="obsolete">Japanisch</translation>
- </message>
- <message>
- <source>French</source>
- <translation type="obsolete">Französisch</translation>
- </message>
- <message>
- <source>Polish</source>
- <translation type="obsolete">Polnisch</translation>
- </message>
- <message>
- <source>Chinese</source>
- <translation type="obsolete">Chinesisch</translation>
- </message>
-</context>
-<context>
<name>ErrorsView</name>
<message>
<location filename="../tools/linguist/linguist/errorsview.cpp" line="+76"/>
@@ -251,19 +181,11 @@ Es wird mit einer einfachen Universalform gearbeitet.</translation>
<context>
<name>FindDialog</name>
<message>
- <source>Qt Linguist</source>
- <translation type="obsolete">Qt Linguist</translation>
- </message>
- <message>
<location filename="../tools/linguist/linguist/finddialog.ui"/>
<source>This window allows you to search for some text in the translation source file.</source>
<translation>Dieses Fenster erlaubt die Suche in der Übersetzungsdatei.</translation>
</message>
<message>
- <source>Find what:</source>
- <translation type="obsolete">Suchen nach:</translation>
- </message>
- <message>
<location/>
<source>Type in the text to search for.</source>
<translation>Geben Sie den Text ein, nach dem gesucht werden soll.</translation>
@@ -279,37 +201,21 @@ Es wird mit einer einfachen Universalform gearbeitet.</translation>
<translation>Wenn aktiviert, wird in den Ursprungstexten gesucht.</translation>
</message>
<message>
- <source>Source texts</source>
- <translation type="obsolete">Ursprungsstexte</translation>
- </message>
- <message>
<location/>
<source>Translations are searched when checked.</source>
<translation>Wenn ausgewählt, wird in den Übersetzungen gesucht.</translation>
</message>
<message>
- <source>Translations</source>
- <translation type="obsolete">Übersetzungen</translation>
- </message>
- <message>
<location/>
<source>Texts such as &apos;TeX&apos; and &apos;tex&apos; are considered as different when checked.</source>
<translation>Wenn aktiviert, werden Texte wie &apos;TeX&apos; und &apos;tex&apos; als unterschiedlich betrachtet.</translation>
</message>
<message>
- <source>Match case</source>
- <translation type="obsolete">Groß-/Kleinschreibung beachten</translation>
- </message>
- <message>
<location/>
<source>Comments and contexts are searched when checked.</source>
<translation>Wenn ausgewählt, werden Kommentare und Kontextnamen durchsucht.</translation>
</message>
<message>
- <source>Comments</source>
- <translation type="obsolete">Kommentare</translation>
- </message>
- <message>
<location/>
<source>Find</source>
<translation>Suchen</translation>
@@ -365,10 +271,6 @@ Es wird mit einer einfachen Universalform gearbeitet.</translation>
<translation>Abbrechen</translation>
</message>
<message>
- <source>Ignore accelerators</source>
- <translation type="obsolete">Kurztasten ignorieren</translation>
- </message>
- <message>
<location filename="../tools/linguist/linguist/finddialog.cpp" line="+12"/>
<source></source>
<comment>Choose Edit|Find from the menu bar or press Ctrl+F to pop up the Find dialog</comment>
@@ -376,16 +278,56 @@ Es wird mit einer einfachen Universalform gearbeitet.</translation>
</message>
</context>
<context>
- <name>FormHolder</name>
+ <name>FormMultiWidget</name>
+ <message>
+ <location filename="../tools/linguist/linguist/messageeditorwidgets.cpp" line="+296"/>
+ <source>Alt+Delete</source>
+ <extracomment>translate, but don&apos;t change</extracomment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Shift+Alt+Insert</source>
+ <extracomment>translate, but don&apos;t change</extracomment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Alt+Insert</source>
+ <extracomment>translate, but don&apos;t change</extracomment>
+ <translation type="unfinished"></translation>
+ </message>
<message>
- <source>Preview Form</source>
- <translation type="obsolete">Vorschau</translation>
+ <location line="+131"/>
+ <source>Confirmation - Qt Linguist</source>
+ <translation>Bestätigung - Qt Linguist</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Delete non-empty length variant?</source>
+ <translation>Soll die ausgefüllte Längenvariante gelöscht werden?</translation>
</message>
</context>
<context>
<name>LRelease</name>
<message numerus="yes">
- <location filename="../tools/linguist/shared/qm.cpp" line="+715"/>
+ <location filename="../tools/linguist/shared/qm.cpp" line="+747"/>
+ <source>Dropped %n message(s) which had no ID.</source>
+ <translation>
+ <numerusform>Es wurde ein Eintrag ohne Bezeichner gelöscht.</numerusform>
+ <numerusform>Es wurde %n Einträge ohne Bezeichner gelöscht.</numerusform>
+ </translation>
+ </message>
+ <message numerus="yes">
+ <location line="+4"/>
+ <source>Excess context/disambiguation dropped from %n message(s).</source>
+ <translation>
+ <numerusform>Es wurde überflüssiger Kontext beziehungsweise überflüssige Infomation zur Unterscheidung bei einem Eintrag entfernt.</numerusform>
+ <numerusform>Es wurde überflüssiger Kontext beziehungsweise überflüssige Infomation zur Unterscheidung bei %n Einträgen entfernt.</numerusform>
+ </translation>
+ </message>
+ <message numerus="yes">
+ <location line="+8"/>
<source> Generated %n translation(s) (%1 finished and %2 unfinished)
</source>
<translation>
@@ -408,89 +350,6 @@ Es wird mit einer einfachen Universalform gearbeitet.</translation>
</message>
</context>
<context>
- <name>LanguagesDialog</name>
- <message>
- <source>Open Translation File</source>
- <translation type="obsolete">Öffne Übersetzungsdatei</translation>
- </message>
- <message>
- <source>Qt translation sources (%1);;Qt translation sources (*.ts);;XLIFF localization files (*.xlf);;All files (*)</source>
- <translation type="obsolete">Qt Übersetzungsdateien (%1);;Qt Übersetzungsdateien (*.ts);;XLIFF Lokalisierungsdateien (*.xlf);;Alle Dateien (*)</translation>
- </message>
- <message>
- <source>Auxiliary Languages</source>
- <translation type="obsolete">Unterstützende Sprachen</translation>
- </message>
- <message>
- <source>Locale</source>
- <translation type="obsolete">Regionalschema</translation>
- </message>
- <message>
- <source>File</source>
- <translation type="obsolete">Datei</translation>
- </message>
- <message>
- <source>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
-p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;MS Shell Dlg 2&apos;; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Move selected language up&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
- <translation type="obsolete">&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
-p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;MS Shell Dlg 2&apos;; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Bewege ausgewählte Sprache herauf&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
- </message>
- <message>
- <source>up</source>
- <translation type="obsolete">Hoch</translation>
- </message>
- <message>
- <source>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
-p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;MS Shell Dlg 2&apos;; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;Move selected language down&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
- <translation type="obsolete">&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
-p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;MS Shell Dlg 2&apos;; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;Bewege ausgewählte Sprache herunter&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
- </message>
- <message>
- <source>down</source>
- <translation type="obsolete">Herunter</translation>
- </message>
- <message>
- <source>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
-p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;MS Shell Dlg 2&apos;; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Remove selected language&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
- <translation type="obsolete">&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
-p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;MS Shell Dlg 2&apos;; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Entferne ausgewählte Sprache&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
- </message>
- <message>
- <source>remove</source>
- <translation type="obsolete">Entfernen</translation>
- </message>
- <message>
- <source>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
-p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;MS Shell Dlg 2&apos;; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Open auxiliary language files&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
- <translation type="obsolete">&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
-p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;MS Shell Dlg 2&apos;; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Öffne unterstützende Sprachen&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
- </message>
- <message>
- <source>...</source>
- <translation type="obsolete">...</translation>
- </message>
- <message>
- <source>OK</source>
- <translation type="obsolete">OK</translation>
- </message>
-</context>
-<context>
<name>MainWindow</name>
<message>
<location filename="../tools/linguist/linguist/mainwindow.ui"/>
@@ -538,10 +397,6 @@ p, li { white-space: pre-wrap; }
<translation>&amp;Werkzeugleisten</translation>
</message>
<message>
- <source>Too&amp;ls</source>
- <translation type="obsolete">&amp;Werkzeuge</translation>
- </message>
- <message>
<location/>
<source>&amp;Help</source>
<translation>&amp;Hilfe</translation>
@@ -557,19 +412,11 @@ p, li { white-space: pre-wrap; }
<translation>&amp;Datei</translation>
</message>
<message>
- <source>Re&amp;cently Opened Files</source>
- <translation type="obsolete">&amp;Zuletzt geöffnete Dateien</translation>
- </message>
- <message>
<location/>
<source>&amp;Edit</source>
<translation>&amp;Bearbeiten</translation>
</message>
<message>
- <source>&amp;New</source>
- <translation type="obsolete">&amp;Neu</translation>
- </message>
- <message>
<location/>
<source>&amp;Open...</source>
<translation>Ö&amp;ffnen ...</translation>
@@ -612,51 +459,26 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<location/>
- <source>Previous unfinished item.</source>
- <translation>Vorheriger unerledigter Eintrag.</translation>
- </message>
- <message>
- <location/>
<source>Move to the previous unfinished item.</source>
<translation>Zum vorherigen unerledigten Eintrag gehen.</translation>
</message>
<message>
<location/>
- <source>Next unfinished item.</source>
- <translation>Nächster unerledigter Eintrag.</translation>
- </message>
- <message>
- <location/>
<source>Move to the next unfinished item.</source>
<translation>Zum nächsten unerledigten Eintrag gehen.</translation>
</message>
<message>
<location/>
- <source>Move to previous item.</source>
- <translation>Zum vorigen Eintrag gehen.</translation>
- </message>
- <message>
- <location/>
<source>Move to the previous item.</source>
<translation>Zum vorigen Eintrag gehen.</translation>
</message>
<message>
<location/>
- <source>Next item.</source>
- <translation>Nächster Eintrag.</translation>
- </message>
- <message>
- <location/>
<source>Move to the next item.</source>
<translation>Zum nächsten Eintrag gehen.</translation>
</message>
<message>
<location/>
- <source>Mark item as done and move to the next unfinished item.</source>
- <translation>Eintrag als erledigt markieren und zum nächsten unerledigten Eintrag gehen.</translation>
- </message>
- <message>
- <location/>
<source>Mark this item as done and move to the next unfinished item.</source>
<translation>Diesen Eintrag als erledigt markieren und zum nächsten unerledigten Eintrag gehen.</translation>
</message>
@@ -667,21 +489,11 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<location/>
- <source>Toggle the validity check of accelerators.</source>
- <translation>Prüfung der Tastenkürzel ein- bzw. ausschalten.</translation>
- </message>
- <message>
- <location/>
<source>Toggle the validity check of accelerators, i.e. whether the number of ampersands in the source and translation text is the same. If the check fails, a message is shown in the warnings window.</source>
<translation>Die Prüfung der Tastenkürzel, das heißt, die Übereinstimmung der kaufmännischen Und-Zeichen in Quelle und Übersetzung ein- bzw. ausschalten. Bei Fehlschlag wird eine Warnung im Hinweis-Fenster angezeigt.</translation>
</message>
<message>
<location/>
- <source>Toggle the validity check of ending punctuation.</source>
- <translation>Prüfung der Satzendezeichen am Ende des Textes ein- bzw. ausschalten.</translation>
- </message>
- <message>
- <location/>
<source>Toggle the validity check of ending punctuation. If the check fails, a message is shown in the warnings window.</source>
<translation>Die Prüfung der Satzendezeichen am Ende des Textes ein- bzw. ausschalten. Bei Fehlschlag wird eine Warnung im Hinweis-Fenster angezeigt.</translation>
</message>
@@ -692,11 +504,6 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<location/>
- <source>Toggle the validity check of place markers.</source>
- <translation>Prüfung der Platzhalter ein- bzw. ausschalten.</translation>
- </message>
- <message>
- <location/>
<source>Toggle the validity check of place markers, i.e. whether %1, %2, ... are used consistently in the source text and translation text. If the check fails, a message is shown in the warnings window.</source>
<translation>Die Prüfung der Platzhalter, das heißt, ob %1, %2 usw. in Ursprungstext und Übersetzung übereinstimmend verwendet werden, ein- bzw. ausschalten. Bei Fehlschlag wird eine Warnung im Hinweis-Fenster angezeigt.</translation>
</message>
@@ -716,14 +523,14 @@ p, li { white-space: pre-wrap; }
<translation>Ctrl+S</translation>
</message>
<message>
+ <location/>
<location filename="../tools/linguist/linguist/mainwindow.cpp" line="-14"/>
<location line="+11"/>
- <location filename="../tools/linguist/linguist/mainwindow.ui"/>
<source>Save &amp;As...</source>
<translation>Speichern &amp;unter...</translation>
</message>
<message>
- <location filename="../tools/linguist/linguist/mainwindow.ui"/>
+ <location/>
<source>Save As...</source>
<translation>Speichern unter ...</translation>
</message>
@@ -748,10 +555,6 @@ p, li { white-space: pre-wrap; }
<translation>&amp;Drucken ...</translation>
</message>
<message>
- <source>Print a list of all the phrases in the current Qt translation source file.</source>
- <translation type="obsolete">Drucke die Liste aller Übersetzungen in der aktuellen Qt Übersetzungsdatei.</translation>
- </message>
- <message>
<location/>
<source>Ctrl+P</source>
<translation>Ctrl+P</translation>
@@ -762,10 +565,6 @@ p, li { white-space: pre-wrap; }
<translation>&amp;Rückgängig</translation>
</message>
<message>
- <source>Undo the last editing operation performed on the translation.</source>
- <translation type="obsolete">Mache die letzte Änderung an der Übersetzung rückgängig.</translation>
- </message>
- <message>
<location/>
<source>Recently Opened &amp;Files</source>
<translation>Zu&amp;letzt bearbeitete Dateien</translation>
@@ -916,10 +715,6 @@ p, li { white-space: pre-wrap; }
<translation>Ctrl+W</translation>
</message>
<message>
- <source>Moves to the previous unfinished item.</source>
- <translation type="obsolete">Gehe zum letzten unerledigten Eintrag.</translation>
- </message>
- <message>
<location/>
<source>Ctrl+K</source>
<translation>Ctrl+K</translation>
@@ -930,23 +725,11 @@ p, li { white-space: pre-wrap; }
<translation>&amp;Nächster Unerledigter</translation>
</message>
<message>
- <source>Moves to the next unfinished item.</source>
- <translation type="obsolete">Gehe zum nächsten unerledigten Eintrag.</translation>
- </message>
- <message>
- <source>Ctrl+L</source>
- <translation type="obsolete">Ctrl+L</translation>
- </message>
- <message>
<location/>
<source>P&amp;rev</source>
<translation>V&amp;orheriger</translation>
</message>
<message>
- <source>Moves to the previous item.</source>
- <translation type="obsolete">Gehe zum letzten Eintrag.</translation>
- </message>
- <message>
<location/>
<source>Ctrl+Shift+K</source>
<translation>Ctrl+Shift+K</translation>
@@ -957,27 +740,11 @@ p, li { white-space: pre-wrap; }
<translation>Nä&amp;chster</translation>
</message>
<message>
- <source>Moves to the next item.</source>
- <translation type="obsolete">Gehe zum nächsten Eintrag.</translation>
- </message>
- <message>
- <source>Ctrl+Shift+L</source>
- <translation type="obsolete">Ctrl+Shift+L</translation>
- </message>
- <message>
<location/>
<source>&amp;Done and Next</source>
<translation>&amp;Fertig und Nächster</translation>
</message>
<message>
- <source>Marks this item as done and moves to the next unfinished item.</source>
- <translation type="obsolete">Markiere diesen Eintrag als erledigt und gehe zum nächsten unerledigten Eintrg.</translation>
- </message>
- <message>
- <source>&amp;Begin from source</source>
- <translation type="obsolete">Übernehme &amp;Ursprungstext</translation>
- </message>
- <message>
<location/>
<source>Copies the source text into the translation field.</source>
<translation>Kopiert den Ursprungstext in das Übersetzungsfeld.</translation>
@@ -993,38 +760,21 @@ p, li { white-space: pre-wrap; }
<translation>&amp;Kurzbefehle</translation>
</message>
<message>
- <source>Toggle validity checks of accelerators.</source>
- <translation type="obsolete">Aktiviere/Deaktiviere Validitätsprüfung für Kurztasten.</translation>
- </message>
- <message>
<location/>
<source>&amp;Ending Punctuation</source>
<translation>&amp;Punktierung am Ende</translation>
</message>
<message>
- <source>Toggle validity checks of ending punctuation.</source>
- <translation type="obsolete">Aktiviere/Deaktiviere Validitätsprüfung für Punktierung am Ende des Textes.</translation>
- </message>
- <message>
<location/>
<source>&amp;Phrase matches</source>
<translation>&amp;Wörterbuch</translation>
</message>
<message>
<location/>
- <source>Toggle checking that phrase suggestions are used.</source>
- <translation>Überprüfung, ob Wörterbucheinträge benutzt werden, aktivieren/deaktivieren.</translation>
- </message>
- <message>
- <location/>
<source>Place &amp;Marker Matches</source>
<translation>Platz&amp;halter</translation>
</message>
<message>
- <source>Toggle validity checks of place markers.</source>
- <translation type="obsolete">Aktiviere/Deaktiviere Validitätsprüfung für Platzhalter .</translation>
- </message>
- <message>
<location/>
<source>&amp;New Phrase Book...</source>
<translation>&amp;Neues Wörterbuch ...</translation>
@@ -1140,36 +890,31 @@ p, li { white-space: pre-wrap; }
<translation>Die Übersetzung aller Einträge ersetzen, die dem Suchtext entsprechen.</translation>
</message>
<message>
+ <location/>
<location filename="../tools/linguist/linguist/mainwindow.cpp" line="+21"/>
- <location filename="../tools/linguist/linguist/mainwindow.ui"/>
<source>&amp;Batch Translation...</source>
<translation>&amp;Automatische Übersetzung ...</translation>
</message>
<message>
- <location filename="../tools/linguist/linguist/mainwindow.ui"/>
+ <location/>
<source>Batch translate all entries using the information in the phrase books.</source>
<translation>Alle Einträge automatisch mit Hilfe des Wörterbuchs übersetzen.</translation>
</message>
<message>
+ <location/>
<location filename="../tools/linguist/linguist/mainwindow.cpp" line="-34"/>
<location line="+10"/>
- <location filename="../tools/linguist/linguist/mainwindow.ui"/>
<source>Release As...</source>
<translation>Freigeben unter ...</translation>
</message>
<message>
- <location filename="../tools/linguist/linguist/mainwindow.ui"/>
- <source>Create a Qt message file suitable for released applications from the current message file. The filename will automatically be determined from the name of the .ts file.</source>
- <translation>Eine Qt-Nachrichtendatei aus der aktuellen Übersetzungsdatei erzeugen. Der Dateiname wird automatisch aus dem Namen der TS-Datei abgeleitet.</translation>
- </message>
- <message>
- <location filename="../tools/linguist/linguist/mainwindow.cpp" line="-2004"/>
+ <location filename="../tools/linguist/linguist/mainwindow.cpp" line="-2006"/>
<source></source>
<comment>This is the application&apos;s main window.</comment>
<translation></translation>
</message>
<message>
- <location line="+195"/>
+ <location line="+188"/>
<source>Source text</source>
<translation>Ursprungstext</translation>
</message>
@@ -1181,17 +926,17 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<location line="-2"/>
- <location line="+61"/>
+ <location line="+62"/>
<source>Context</source>
<translation>Kontext</translation>
</message>
<message>
- <location line="-60"/>
+ <location line="-61"/>
<source>Items</source>
<translation>Einträge</translation>
</message>
<message>
- <location line="+77"/>
+ <location line="+78"/>
<source>This panel lists the source contexts.</source>
<translation>Dieser Bereich zeigt die Kontexte an.</translation>
</message>
@@ -1219,10 +964,10 @@ p, li { white-space: pre-wrap; }
<location line="+59"/>
<source> MOD </source>
<comment>status bar: file(s) modified</comment>
- <translation type="unfinished"></translation>
+ <translation>Geändert</translation>
</message>
<message>
- <location line="+125"/>
+ <location line="+130"/>
<source>Loading...</source>
<translation>Lade ...</translation>
</message>
@@ -1275,14 +1020,19 @@ Soll die erstgenannte Datei übersprungen werden?</translation>
<translation>Datei gespeichert.</translation>
</message>
<message>
- <location line="+15"/>
- <location line="+1164"/>
+ <location line="+526"/>
+ <source>&lt;center&gt;&lt;img src=&quot;:/images/splash.png&quot;/&gt;&lt;/img&gt;&lt;p&gt;%1&lt;/p&gt;&lt;/center&gt;&lt;p&gt;Qt Linguist is a tool for adding translations to Qt applications.&lt;/p&gt;&lt;p&gt;Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).&lt;/p&gt;&lt;p&gt;The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.&lt;/p&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
<location filename="../tools/linguist/linguist/mainwindow.ui"/>
+ <location filename="../tools/linguist/linguist/mainwindow.cpp" line="-511"/>
+ <location line="+1167"/>
<source>Release</source>
<translation>Freigeben</translation>
</message>
<message>
- <location line="-1163"/>
+ <location filename="../tools/linguist/linguist/mainwindow.cpp" line="-1166"/>
<source>Qt message files for released applications (*.qm)
All files (*)</source>
<translation>Qt-Nachrichtendateien (*.qm)
@@ -1295,7 +1045,7 @@ Alle Dateien (*)</translation>
<translation>Datei erzeugt.</translation>
</message>
<message>
- <location line="+27"/>
+ <location line="+34"/>
<location line="+355"/>
<source>Printing...</source>
<translation>Drucke ...</translation>
@@ -1346,7 +1096,7 @@ Alle Dateien (*)</translation>
<message>
<location line="+17"/>
<location line="+278"/>
- <location line="+40"/>
+ <location line="+36"/>
<location line="+24"/>
<location line="+22"/>
<location line="+516"/>
@@ -1358,18 +1108,11 @@ Alle Dateien (*)</translation>
<translation>Qt Linguist</translation>
</message>
<message>
- <location line="-1204"/>
+ <location line="-1200"/>
<location line="+102"/>
<source>Cannot find the string &apos;%1&apos;.</source>
<translation>Kann Zeichenkette &apos;%1&apos; nicht finden.</translation>
</message>
- <message numerus="yes">
- <source>Translated %n entries to &apos;%1&apos;</source>
- <translation type="obsolete">
- <numerusform>Ein Eintrag wurde mit &apos;%1&apos; übersetzt</numerusform>
- <numerusform>%n Einträge wurden mit &apos;%1&apos; übersetzt</numerusform>
- </translation>
- </message>
<message>
<location line="-82"/>
<source>Search And Translate in &apos;%1&apos; - Qt Linguist</source>
@@ -1463,16 +1206,7 @@ Alle Dateien (*)</translation>
<translation>Version %1</translation>
</message>
<message>
- <source> Open Source Edition</source>
- <translation type="obsolete">Open Source Edition</translation>
- </message>
- <message>
- <location line="+6"/>
- <source>&lt;center&gt;&lt;img src=&quot;:/images/splash.png&quot;/&gt;&lt;/img&gt;&lt;p&gt;%1&lt;/p&gt;&lt;/center&gt;&lt;p&gt;Qt Linguist is a tool for adding translations to Qt applications.&lt;/p&gt;&lt;p&gt;%2&lt;/p&gt;&lt;p&gt;Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).&lt;/p&gt;&lt;p&gt;The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.&lt;/p&gt;</source>
- <translation>&lt;center&gt;&lt;img src=&quot;:/images/splash.png&quot;/&gt;&lt;/img&gt;&lt;p&gt;%1&lt;/p&gt;&lt;/center&gt;&lt;p&gt;Qt Linguist ist ein Werkzeug zum Übersetzen von Qt-Anwendungen.&lt;/p&gt;&lt;p&gt;%2&lt;/p&gt;&lt;p&gt;Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).&lt;/p&gt;&lt;p&gt;The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.&lt;/p&gt;</translation>
- </message>
- <message>
- <location line="+41"/>
+ <location line="+43"/>
<source>Do you want to save the modified files?</source>
<translation>Möchten Sie die geänderten Dateien speichern?</translation>
</message>
@@ -1559,13 +1293,13 @@ Alle Dateien (*)</translation>
<translation>Alles speichern</translation>
</message>
<message>
- <location line="+1"/>
<location filename="../tools/linguist/linguist/mainwindow.ui"/>
+ <location filename="../tools/linguist/linguist/mainwindow.cpp" line="+1"/>
<source>&amp;Release All</source>
<translation>Alles f&amp;reigeben</translation>
</message>
<message>
- <location line="+1"/>
+ <location filename="../tools/linguist/linguist/mainwindow.cpp" line="+1"/>
<source>Close All</source>
<translation>Alle schließen</translation>
</message>
@@ -1590,37 +1324,37 @@ Alle Dateien (*)</translation>
<translation>Suchen und &amp;übersetzen ...</translation>
</message>
<message>
- <location line="+51"/>
<location filename="../tools/linguist/linguist/mainwindow.ui"/>
+ <location filename="../tools/linguist/linguist/mainwindow.cpp" line="+51"/>
<source>File</source>
<translation>Datei</translation>
</message>
<message>
- <location line="+7"/>
- <location filename="../tools/linguist/linguist/mainwindow.ui"/>
+ <location/>
+ <location filename="../tools/linguist/linguist/mainwindow.cpp" line="+7"/>
<source>Edit</source>
<translation>Bearbeiten</translation>
</message>
<message>
- <location line="+6"/>
- <location filename="../tools/linguist/linguist/mainwindow.ui"/>
+ <location/>
+ <location filename="../tools/linguist/linguist/mainwindow.cpp" line="+6"/>
<source>Translation</source>
<translation>Übersetzung</translation>
</message>
<message>
- <location line="+6"/>
- <location filename="../tools/linguist/linguist/mainwindow.ui"/>
+ <location/>
+ <location filename="../tools/linguist/linguist/mainwindow.cpp" line="+6"/>
<source>Validation</source>
<translation>Validierung</translation>
</message>
<message>
- <location line="+7"/>
- <location filename="../tools/linguist/linguist/mainwindow.ui"/>
+ <location/>
+ <location filename="../tools/linguist/linguist/mainwindow.cpp" line="+7"/>
<source>Help</source>
<translation>Hilfe</translation>
</message>
<message>
- <location line="+84"/>
+ <location filename="../tools/linguist/linguist/mainwindow.cpp" line="+84"/>
<source>Cannot read from phrase book &apos;%1&apos;.</source>
<translation>Wörterbuch &apos;%1&apos; kann nicht gelesen werden.</translation>
</message>
@@ -1650,7 +1384,7 @@ Alle Dateien (*)</translation>
<translation>Möchten Sie das Wörterbuch &apos;%1&apos; speichern?</translation>
</message>
<message>
- <location line="+314"/>
+ <location line="+323"/>
<source>All</source>
<translation>Alle</translation>
</message>
@@ -1670,21 +1404,13 @@ Alle Dateien (*)</translation>
<translation>F5</translation>
</message>
<message>
- <location filename="../tools/linguist/linguist/mainwindow.cpp" line="-527"/>
- <location filename="../tools/linguist/linguist/mainwindow.ui"/>
+ <location/>
+ <location filename="../tools/linguist/linguist/mainwindow.cpp" line="-536"/>
<source>Translation File &amp;Settings...</source>
<translation>E&amp;instellungen ...</translation>
</message>
<message>
- <source>Other &amp;Languages...</source>
- <translation type="obsolete">A&amp;ndere Sprachen...</translation>
- </message>
- <message>
- <source>Edit which other languages to show.</source>
- <translation type="obsolete">Welche anderen Sprachen sollen dargestellt werden.</translation>
- </message>
- <message>
- <location filename="../tools/linguist/linguist/mainwindow.ui"/>
+ <location/>
<source>&amp;Add to Phrase Book</source>
<translation>Zum Wörterbuch &amp;hinzufügen</translation>
</message>
@@ -1703,11 +1429,82 @@ Alle Dateien (*)</translation>
<source>Ctrl+Shift+J</source>
<translation>Ctrl+Shift+J</translation>
</message>
+ <message>
+ <location/>
+ <source>Previous unfinished item</source>
+ <translation>Vorheriger unerledigter Eintrag</translation>
+ </message>
+ <message>
+ <location/>
+ <source>Next unfinished item</source>
+ <translation>Nächster unerledigter Eintrag</translation>
+ </message>
+ <message>
+ <location/>
+ <source>Move to previous item</source>
+ <translation>Zum vorigen Eintrag gehen</translation>
+ </message>
+ <message>
+ <location/>
+ <source>Next item</source>
+ <translation>Nächster Eintrag</translation>
+ </message>
+ <message>
+ <location/>
+ <source>Mark item as done and move to the next unfinished item</source>
+ <translation>Eintrag als erledigt markieren und zum nächsten unerledigten Eintrag gehen</translation>
+ </message>
+ <message>
+ <location/>
+ <source>Copies the source text into the translation field</source>
+ <translation>Kopiert den Ursprungstext in das Übersetzungsfeld</translation>
+ </message>
+ <message>
+ <location/>
+ <source>Toggle the validity check of accelerators</source>
+ <translation>Prüfung der Tastenkürzel ein- bzw. ausschalten</translation>
+ </message>
+ <message>
+ <location/>
+ <source>Toggle the validity check of ending punctuation</source>
+ <translation>Prüfung der Satzendezeichen am Ende des Textes ein- bzw. ausschalten</translation>
+ </message>
+ <message>
+ <location/>
+ <source>Toggle checking that phrase suggestions are used</source>
+ <translation>Überprüfung, ob Wörterbucheinträge benutzt werden, aktivieren/deaktivieren</translation>
+ </message>
+ <message>
+ <location/>
+ <source>Toggle the validity check of place markers</source>
+ <translation>Prüfung der Platzhalter ein- bzw. ausschalten&apos;</translation>
+ </message>
+ <message>
+ <location/>
+ <source>Create a Qt message file suitable for released applications from the current message file. The filename will automatically be determined from the name of the TS file.</source>
+ <translation>Eine Qt-Nachrichtendatei aus der aktuellen Übersetzungsdatei erzeugen. Der Dateiname wird automatisch aus dem Namen der TS-Datei abgeleitet.</translation>
+ </message>
+ <message>
+ <location/>
+ <source>Length Variants</source>
+ <translation>Längenvarianten</translation>
+ </message>
</context>
<context>
<name>MessageEditor</name>
<message>
- <location filename="../tools/linguist/linguist/messageeditor.cpp" line="+72"/>
+ <location filename="../tools/linguist/linguist/messageeditor.cpp" line="+42"/>
+ <source></source>
+ <comment>This is the right panel of the main window.</comment>
+ <translation></translation>
+ </message>
+ <message>
+ <location line="+30"/>
+ <source>Russian</source>
+ <translation>Russisch</translation>
+ </message>
+ <message>
+ <location line="+1"/>
<source>German</source>
<translation>Deutsch</translation>
</message>
@@ -1732,7 +1529,7 @@ Alle Dateien (*)</translation>
<translation>Chinesisch</translation>
</message>
<message>
- <location line="+50"/>
+ <location line="+53"/>
<source>This whole panel allows you to view and edit the translation of some source text.</source>
<translation>Dieser Bereich erlaubt die Darstellung und Änderung der Übersetzung eines Textes.</translation>
</message>
@@ -1747,7 +1544,7 @@ Alle Dateien (*)</translation>
<translation>Dieser Bereich zeigt den Ursprungstext.</translation>
</message>
<message>
- <location line="+3"/>
+ <location line="+4"/>
<source>Source text (Plural)</source>
<translation>Ursprungstext (Plural)</translation>
</message>
@@ -1757,7 +1554,7 @@ Alle Dateien (*)</translation>
<translation>Dieser Bereich zeigt die Pluralform des Ursprungstexts.</translation>
</message>
<message>
- <location line="+3"/>
+ <location line="+4"/>
<source>Developer comments</source>
<translation>Hinweise des Entwicklers</translation>
</message>
@@ -1772,12 +1569,12 @@ Alle Dateien (*)</translation>
<translation>Hier können Sie Hinweise für den eigenen Gebrauch eintragen. Diese haben keinen Einflusse auf die Übersetzung.</translation>
</message>
<message>
- <location line="+205"/>
+ <location line="+232"/>
<source>%1 translation (%2)</source>
<translation>Übersetzung %1 (%2)</translation>
</message>
<message>
- <location line="+19"/>
+ <location line="+9"/>
<source>This is where you can enter or modify the translation of the above source text.</source>
<translation>Hier können Sie die Übersetzung des Ursprungstextes eingeben bzw. ändern.</translation>
</message>
@@ -1792,56 +1589,16 @@ Alle Dateien (*)</translation>
<translation>%1 Hinweise des Übersetzers</translation>
</message>
<message>
- <location line="+138"/>
+ <location line="+157"/>
<source>&apos;%1&apos;
Line: %2</source>
<translation>&apos;%1&apos;
Zeile: %2</translation>
</message>
- <message>
- <source>%1 Translation (%2)</source>
- <translation type="obsolete">Übersetzung %1 (%2)</translation>
- </message>
- <message>
- <source>bell</source>
- <translation type="obsolete">bell</translation>
- </message>
- <message>
- <source>backspace</source>
- <translation type="obsolete">Rücktaste</translation>
- </message>
- <message>
- <source>new page</source>
- <translation type="obsolete">Neue Seite</translation>
- </message>
- <message>
- <source>new line</source>
- <translation type="obsolete">Neue Zeile</translation>
- </message>
- <message>
- <source>carriage return</source>
- <translation type="obsolete">Carriage Return</translation>
- </message>
- <message>
- <source>tab</source>
- <translation type="obsolete">Tab</translation>
- </message>
</context>
<context>
<name>MessageModel</name>
<message>
- <source>Context</source>
- <translation type="obsolete">Kontext</translation>
- </message>
- <message>
- <source>Items</source>
- <translation type="obsolete">Einträge</translation>
- </message>
- <message>
- <source>Index</source>
- <translation type="obsolete">Index</translation>
- </message>
- <message>
<location filename="../tools/linguist/linguist/messagemodel.cpp" line="+832"/>
<source>Completion status for %1</source>
<translation>Bearbeitungsstand von %1</translation>
@@ -1863,16 +1620,9 @@ Zeile: %2</translation>
</message>
</context>
<context>
- <name>MessagesTreeView</name>
- <message>
- <source>Done</source>
- <translation type="obsolete">Done</translation>
- </message>
-</context>
-<context>
<name>MsgEdit</name>
<message>
- <location filename="../tools/linguist/linguist/messageeditor.cpp" line="-572"/>
+ <location filename="../tools/linguist/linguist/messageeditor.cpp" line="-614"/>
<source></source>
<comment>This is the right panel of the main window.</comment>
<translation></translation>
@@ -1881,17 +1631,18 @@ Zeile: %2</translation>
<context>
<name>PhraseBookBox</name>
<message>
- <source>%1 - %2[*]</source>
- <translation type="obsolete">%1 - %2[*]</translation>
- </message>
- <message>
- <location filename="../tools/linguist/linguist/phrasebookbox.cpp" line="-47"/>
+ <location filename="../tools/linguist/linguist/phrasebookbox.cpp" line="+12"/>
<source></source>
<comment>Go to Phrase &gt; Edit Phrase Book... The dialog that pops up is a PhraseBookBox.</comment>
<translation></translation>
</message>
<message>
- <location line="+55"/>
+ <location line="+54"/>
+ <source>(New Entry)</source>
+ <translation>(Neuer Eintrag)</translation>
+ </message>
+ <message>
+ <location line="+3"/>
<source>%1[*] - Qt Linguist</source>
<translation>%1[*] - Qt Linguist</translation>
</message>
@@ -1911,10 +1662,6 @@ Zeile: %2</translation>
<translation>Wörterbuch bearbeiten</translation>
</message>
<message>
- <source>This window allows you to add, modify, or delete phrases in a phrase book.</source>
- <translation type="obsolete">Dieses Fenster erlaubt das Hinzufügen, Ändern und Entfernen von Einträgen aus dem Wörterbuch.</translation>
- </message>
- <message>
<location/>
<source>This window allows you to add, modify, or delete entries in a phrase book.</source>
<translation>Dieses Fenster erlaubt das Hinzufügen, Ändern und Entfernen von Wörterbuch-Einträgen.</translation>
@@ -1975,18 +1722,6 @@ Zeile: %2</translation>
<translation>&amp;Einstellungen ...</translation>
</message>
<message>
- <source>&amp;New Phrase</source>
- <translation type="obsolete">&amp;Neuer Eintrag</translation>
- </message>
- <message>
- <source>Click here to remove the phrase from the phrase book.</source>
- <translation type="obsolete">Entferne den Eintrag aus dem Wörterbuch.</translation>
- </message>
- <message>
- <source>&amp;Remove Phrase</source>
- <translation type="obsolete">&amp;Entferne Eintrag</translation>
- </message>
- <message>
<location/>
<source>Click here to save the changes made.</source>
<translation>Änderungen speichern.</translation>
@@ -2028,7 +1763,7 @@ Zeile: %2</translation>
<context>
<name>PhraseView</name>
<message>
- <location filename="../tools/linguist/linguist/phraseview.cpp" line="+121"/>
+ <location filename="../tools/linguist/linguist/phraseview.cpp" line="+122"/>
<source>Insert</source>
<translation>Einfügen</translation>
</message>
@@ -2056,7 +1791,7 @@ Zeile: %2</translation>
<translation>Kompilierte Qt-Übersetzungen</translation>
</message>
<message>
- <location filename="../tools/linguist/linguist/mainwindow.cpp" line="-1279"/>
+ <location filename="../tools/linguist/linguist/mainwindow.cpp" line="-1282"/>
<source>Translation files (%1);;</source>
<translation>Übersetzungsdateien (%1);;</translation>
</message>
@@ -2077,26 +1812,11 @@ Zeile: %2</translation>
<translation>Qt Linguist</translation>
</message>
<message>
- <location filename="../tools/linguist/shared/cpp.cpp" line="+1072"/>
- <source>C++ source files</source>
- <translation>C++-Quelltextdateien</translation>
- </message>
- <message>
- <location filename="../tools/linguist/shared/java.cpp" line="+646"/>
- <source>Java source files</source>
- <translation>Java-Quelltextdateien</translation>
- </message>
- <message>
- <location filename="../tools/linguist/shared/po.cpp" line="+651"/>
+ <location filename="../tools/linguist/shared/po.cpp" line="+658"/>
<source>GNU Gettext localization files</source>
<translation>GNU-Gettext-Übersetzungsdateien</translation>
</message>
<message>
- <location filename="../tools/linguist/shared/qscript.cpp" line="+2399"/>
- <source>Qt Script source files</source>
- <translation>Qt-Skript-Quelltextdateien</translation>
- </message>
- <message>
<location filename="../tools/linguist/shared/ts.cpp" line="+752"/>
<source>Qt translation sources (format 1.1)</source>
<translation>Qt-Übersetzungsdateien (Formatversion 1.1)</translation>
@@ -2112,61 +1832,17 @@ Zeile: %2</translation>
<translation>Qt-Übersetzungsdateien (aktuelles Format)</translation>
</message>
<message>
- <location filename="../tools/linguist/shared/ui.cpp" line="+213"/>
- <source>Qt Designer form files</source>
- <translation>Formulardateien für Qt Designer</translation>
- </message>
- <message>
- <location line="+9"/>
- <source>Qt Jambi form files</source>
- <translation>Formulardateien für Qt Jambi</translation>
- </message>
- <message>
- <location filename="../tools/linguist/shared/xliff.cpp" line="+817"/>
+ <location filename="../tools/linguist/shared/xliff.cpp" line="+820"/>
<source>XLIFF localization files</source>
<translation>XLIFF-Übersetzungsdateien</translation>
</message>
<message>
- <location filename="../tools/linguist/shared/qph.cpp" line="+192"/>
+ <location filename="../tools/linguist/shared/qph.cpp" line="+183"/>
<source>Qt Linguist &apos;Phrase Book&apos;</source>
<translation>Qt-Linguist-Wörterbuch</translation>
</message>
</context>
<context>
- <name>QtWindowListMenu</name>
- <message>
- <source>Tile</source>
- <translation type="obsolete">Teilen</translation>
- </message>
- <message>
- <source>Cascade</source>
- <translation type="obsolete">Kaskadieren</translation>
- </message>
- <message>
- <source>Close</source>
- <translation type="obsolete">Schließen</translation>
- </message>
- <message>
- <source>Close All</source>
- <translation type="obsolete">Alle schließen</translation>
- </message>
-</context>
-<context>
- <name>SortedMessagesModel</name>
- <message>
- <source>Source text</source>
- <translation type="obsolete">Ursprungstext</translation>
- </message>
- <message>
- <source>Translation</source>
- <translation type="obsolete">Übersetzung</translation>
- </message>
- <message>
- <source>Index</source>
- <translation type="obsolete">Index</translation>
- </message>
-</context>
-<context>
<name>SourceCodeView</name>
<message>
<location filename="../tools/linguist/linguist/sourcecodeview.cpp" line="+70"/>
@@ -2192,10 +1868,6 @@ Zeile: %2</translation>
<translation>Statistiken</translation>
</message>
<message>
- <source>&amp;Close</source>
- <translation type="obsolete">&amp;Schließen</translation>
- </message>
- <message>
<location/>
<source>Translation</source>
<translation>Übersetzung</translation>
@@ -2232,406 +1904,8 @@ Zeile: %2</translation>
</message>
</context>
<context>
- <name>TrPreviewTool</name>
- <message>
- <source>&lt;No Translation&gt;</source>
- <translation type="obsolete">&lt;Keine Übersetzung&gt;</translation>
- </message>
- <message>
- <source>Open Forms</source>
- <translation type="obsolete">Öffne Maske</translation>
- </message>
- <message>
- <source>User interface form files (*.ui);;All files (*.*)</source>
- <translation type="obsolete">User Interface Masken Dateien (*.ui);;Alle Dateien (*.*)</translation>
- </message>
- <message>
- <source>Could not load form file(s):
-</source>
- <translation type="obsolete">Könnte Quelldateien nicht laden:
-</translation>
- </message>
- <message>
- <source>Load Translation</source>
- <translation type="obsolete">Lade Übersetzung</translation>
- </message>
- <message>
- <source>Translation files (*.qm);;All files (*.*)</source>
- <translation type="obsolete">Übersetzungsdateien (*.qm);;Alle Dateien (*.*)</translation>
- </message>
- <message>
- <source>Could not load translation file:
-</source>
- <translation type="obsolete">Konnte Übersetzungsdatei nicht laden:
-</translation>
- </message>
- <message>
- <source>Could not reload translation file(s):
-</source>
- <translation type="obsolete">Konnte Übersetzungsdateien nicht erneut laden:
-</translation>
- </message>
- <message>
- <source>Qt Translation Preview Tool: Warning</source>
- <translation type="obsolete">Qt Vorschau: Warnung</translation>
- </message>
- <message>
- <source>About </source>
- <translation type="obsolete">Info</translation>
- </message>
- <message>
- <source>Could not load form file:
-%1.</source>
- <translation type="obsolete">Konnte Maskendatei nicht laden.
-%1.</translation>
- </message>
-</context>
-<context>
- <name>TrPreviewToolClass</name>
- <message>
- <source>Qt Translation Preview Tool</source>
- <translation type="obsolete">Qt Vorschau Tool</translation>
- </message>
- <message>
- <source>&amp;View</source>
- <translation type="obsolete">&amp;Ansicht</translation>
- </message>
- <message>
- <source>&amp;Views</source>
- <translation type="obsolete">&amp;Ansichten</translation>
- </message>
- <message>
- <source>&amp;Help</source>
- <translation type="obsolete">&amp;Hilfe</translation>
- </message>
- <message>
- <source>&amp;File</source>
- <translation type="obsolete">&amp;Datei</translation>
- </message>
- <message>
- <source>Forms</source>
- <translation type="obsolete">Masken</translation>
- </message>
- <message>
- <source>&amp;Open Form...</source>
- <translation type="obsolete">&amp;Öffne Maske...</translation>
- </message>
- <message>
- <source>&amp;Load Translation...</source>
- <translation type="obsolete">&amp;Lade Übersetzung...</translation>
- </message>
- <message>
- <source>&amp;Reload Translations</source>
- <translation type="obsolete">Lade Übersetzungen &amp;neu</translation>
- </message>
- <message>
- <source>F5</source>
- <translation type="obsolete">F5</translation>
- </message>
- <message>
- <source>&amp;Close</source>
- <translation type="obsolete">&amp;Schließen</translation>
- </message>
- <message>
- <source>About</source>
- <translation type="obsolete">Info</translation>
- </message>
- <message>
- <source>About Qt</source>
- <translation type="obsolete">Über Qt</translation>
- </message>
-</context>
-<context>
- <name>TrWindow</name>
- <message>
- <source>Context</source>
- <translation type="obsolete">Kontext</translation>
- </message>
- <message>
- <source>This panel lists the source contexts.</source>
- <translation type="obsolete">Dieser Bereich zeigt die Kontexte an.</translation>
- </message>
- <message>
- <source>Strings</source>
- <translation type="obsolete">Zeichenketten</translation>
- </message>
- <message>
- <source>Phrases and guesses</source>
- <translation type="obsolete">Wörterbuch und Vorschläge</translation>
- </message>
- <message>
- <source>Source code</source>
- <translation type="obsolete">Quelltext</translation>
- </message>
- <message>
- <source>Warnings</source>
- <translation type="obsolete">Warnungen</translation>
- </message>
- <message>
- <source>MOD</source>
- <translation type="obsolete">MOD</translation>
- </message>
- <message>
- <source>Loading...</source>
- <translation type="obsolete">Lade...</translation>
- </message>
- <message>
- <source>Qt Linguist</source>
- <translation type="obsolete">Qt Linguist</translation>
- </message>
- <message>
- <source>Cannot open &apos;%1&apos;.</source>
- <translation type="obsolete">Kann &apos;%1&apos; nicht öffnen.</translation>
- </message>
- <message numerus="yes">
- <source>%n source phrase(s) loaded.</source>
- <translation type="obsolete">
- <numerusform>Einen Ursprungstext geladen.</numerusform>
- <numerusform>%n Ursprungstexte geladen.</numerusform>
- </translation>
- </message>
- <message>
- <source>Open Translation File</source>
- <translation type="obsolete">Öffne Übersetzungsdatei</translation>
- </message>
- <message>
- <source>Qt translation sources (*.ts);;XLIFF localization files (*.xlf);;All files (*)</source>
- <translation type="obsolete">Qt Übersetzungsdateien (*.ts);;Qt Übersetzungsdateien (*.ts);;Alle Dateien (*)</translation>
- </message>
- <message>
- <source>File saved.</source>
- <translation type="obsolete">Datei gespeichert.</translation>
- </message>
- <message>
- <source>Cannot save &apos;%1&apos;.</source>
- <translation type="obsolete">Kann &apos;%1&apos; nicht speichern.</translation>
- </message>
- <message>
- <source>Qt translation source (*.ts)
-XLIFF localization file (*.xlf)
-All files (*)</source>
- <translation type="obsolete">Qt Übersetzungsdateien (*.ts)
-Qt Übersetzungsdateien (*.ts)
-Alle Dateien (*)</translation>
- </message>
- <message>
- <source>Release</source>
- <translation type="obsolete">Freigeben</translation>
- </message>
- <message>
- <source>Qt message files for released applications (*.qm)
-All files (*)</source>
- <translation type="obsolete">Qt Nachrichtendateien (*.qm)
-Alle Dateien (*)</translation>
- </message>
- <message>
- <source>File created.</source>
- <translation type="obsolete">Datei erzeugt.</translation>
- </message>
- <message>
- <source>Printing...</source>
- <translation type="obsolete">Drucke...</translation>
- </message>
- <message>
- <source>Context: %1</source>
- <translation type="obsolete">Kontext: %1</translation>
- </message>
- <message>
- <source>finished</source>
- <translation type="obsolete">erledigt</translation>
- </message>
- <message>
- <source>unresolved</source>
- <translation type="obsolete">ungelöst</translation>
- </message>
- <message>
- <source>obsolete</source>
- <translation type="obsolete">veraltet</translation>
- </message>
- <message>
- <source>Printing... (page %1)</source>
- <translation type="obsolete">Drucke... (Seite %1)</translation>
- </message>
- <message>
- <source>Printing completed</source>
- <translation type="obsolete">Drucken beendet</translation>
- </message>
- <message>
- <source>Printing aborted</source>
- <translation type="obsolete">Drucken abgebrochen</translation>
- </message>
- <message>
- <source>Search wrapped.</source>
- <translation type="obsolete">Suche beginnt von oben.</translation>
- </message>
- <message>
- <source>Cannot find the string &apos;%1&apos;.</source>
- <translation type="obsolete">Kann Zeichenkette &apos;%1&apos; nicht finden.</translation>
- </message>
- <message>
- <source>Translate</source>
- <translation type="obsolete">Übersetzungen</translation>
- </message>
- <message numerus="yes">
- <source>Translated %n entries to &apos;%1&apos;</source>
- <translation type="obsolete">
- <numerusform>Ein Eintrag wurde mit &apos;%1&apos; übersetzt</numerusform>
- <numerusform>%n Einträge wurden mit &apos;%1&apos; übersetzt</numerusform>
- </translation>
- </message>
- <message>
- <source>Create New Phrase Book</source>
- <translation type="obsolete">Erzeugen eines neuen Wörterbuchs</translation>
- </message>
- <message>
- <source>Qt phrase books (*.qph)
-All files (*)</source>
- <translation type="obsolete">Qt Wörterbücher (*.qph)
-Alle Dateien (*)</translation>
- </message>
- <message>
- <source>A file called &apos;%1&apos; already exists. Please choose another name.</source>
- <translation type="obsolete">Die Datei &apos;%1&apos; existiert schon. Bitte wählen Sie einen anderen Namen.</translation>
- </message>
- <message>
- <source>Phrase book created.</source>
- <translation type="obsolete">Wörterbuch erzeugt.</translation>
- </message>
- <message>
- <source>Open Phrase Book</source>
- <translation type="obsolete">Öffne Wörterbuch</translation>
- </message>
- <message>
- <source>Qt phrase books (*.qph);;All files (*)</source>
- <translation type="obsolete">Qt Wörterbücher (*.qph);;Alle Dateien (*)</translation>
- </message>
- <message numerus="yes">
- <source>%n phrase(s) loaded.</source>
- <translation type="obsolete">
- <numerusform>Ein Wörterbucheintrag geladen.</numerusform>
- <numerusform>%n Wörterbucheinträge geladen.</numerusform>
- </translation>
- </message>
- <message>
- <source>Add to phrase book</source>
- <translation type="obsolete">Hinzufügen zum Wörterbuch</translation>
- </message>
- <message>
- <source>Adding phrase to phrasebook %1</source>
- <translation type="obsolete">Eintrag zu Wörterbuch %1 hinzufügen</translation>
- </message>
- <message>
- <source>Select phrase book to add to</source>
- <translation type="obsolete">Zu welchem Wörterbuch soll der Eintrag hinzugefügt werden?</translation>
- </message>
- <message>
- <source>Unable to launch Qt Assistant (%1)</source>
- <translation type="obsolete">Kann Qt Assistant nicht starten (%1)</translation>
- </message>
- <message>
- <source>Version %1</source>
- <translation type="obsolete">Version %1</translation>
- </message>
- <message>
- <source> Open Source Edition</source>
- <translation type="obsolete">Open Source Edition</translation>
- </message>
- <message>
- <source>&lt;center&gt;&lt;img src=&quot;:/images/splash.png&quot;/&gt;&lt;/img&gt;&lt;p&gt;%1&lt;/p&gt;&lt;/center&gt;&lt;p&gt;Qt Linguist is a tool for adding translations to Qt applications.&lt;/p&gt;&lt;p&gt;%2&lt;/p&gt;&lt;p&gt;Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).&lt;/p&gt;&lt;p&gt;The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.&lt;/p&gt;</source>
- <translation type="obsolete">&lt;center&gt;&lt;img src=&quot;:/images/splash.png&quot;/&gt;&lt;/img&gt;&lt;p&gt;%1&lt;/p&gt;&lt;/center&gt;&lt;p&gt;Qt Linguist ist ein Werkzeug zum Übersetzen von Qt Anwendungen.&lt;/p&gt;&lt;p&gt;%2&lt;/p&gt;&lt;p&gt;Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).&lt;/p&gt;&lt;p&gt;The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.&lt;/p&gt;</translation>
- </message>
- <message>
- <source>Do you want to save &apos;%1&apos;?</source>
- <translation type="obsolete">Wollen Sie &apos;%1&apos; speichern?</translation>
- </message>
- <message>
- <source>Qt Linguist by Trolltech[*]</source>
- <translation type="obsolete">Qt Linguist von Trolltech[*]</translation>
- </message>
- <message>
- <source>%1 - %2[*]</source>
- <translation type="obsolete">%1 - %2[*]</translation>
- </message>
- <message>
- <source>Qt Linguist by Trolltech</source>
- <translation type="obsolete">Qt Linguist von Trolltech</translation>
- </message>
- <message>
- <source>No untranslated phrases left.</source>
- <translation type="obsolete">Alle Einträge sind übersetzt.</translation>
- </message>
- <message>
- <source>&amp;Window</source>
- <translation type="obsolete">&amp;Fenster</translation>
- </message>
- <message>
- <source>Minimize</source>
- <translation type="obsolete">Minimieren</translation>
- </message>
- <message>
- <source>Ctrl+M</source>
- <translation type="obsolete">Ctrl+M</translation>
- </message>
- <message>
- <source>Display the manual for %1.</source>
- <translation type="obsolete">Zeige Handbuch für %1 an.</translation>
- </message>
- <message>
- <source>Display information about %1.</source>
- <translation type="obsolete">Zeige Informationen über %1 an.</translation>
- </message>
- <message>
- <source>File</source>
- <translation type="obsolete">Datei</translation>
- </message>
- <message>
- <source>Edit</source>
- <translation type="obsolete">Bearbeiten</translation>
- </message>
- <message>
- <source>Translation</source>
- <translation type="obsolete">Übersetzung</translation>
- </message>
- <message>
- <source>Validation</source>
- <translation type="obsolete">Validierung</translation>
- </message>
- <message>
- <source>Help</source>
- <translation type="obsolete">Hilfe</translation>
- </message>
- <message>
- <source>Cannot read from phrase book &apos;%1&apos;.</source>
- <translation type="obsolete">Kann Wörterbuch &apos;%1&apos; nicht lesen.</translation>
- </message>
- <message>
- <source>Close this phrase book.</source>
- <translation type="obsolete">Schließe dieses Wörterbuch.</translation>
- </message>
- <message>
- <source>Allow you to add, modify, or delete phrases of this phrase book.</source>
- <translation type="obsolete">Erlaubt das Hinzufügen, Ändern und Entfernen von Einträgen aus dem Wörterbuch.</translation>
- </message>
- <message>
- <source>Print the entries of the phrase book.</source>
- <translation type="obsolete">Drucke die Einträge des Wörterbuchs.</translation>
- </message>
- <message>
- <source>Cannot create phrase book &apos;%1&apos;.</source>
- <translation type="obsolete">Kann Wörterbuch &apos;%1&apos; nicht erzeugen.</translation>
- </message>
- <message>
- <source>Do you want to save phrasebook &apos;%1&apos;?</source>
- <translation type="obsolete">Wollen Sie das Wörterbuch &apos;%1&apos; speichern?</translation>
- </message>
-</context>
-<context>
<name>TranslateDialog</name>
<message>
- <source>Qt Linguist</source>
- <translation type="obsolete">Qt Linguist</translation>
- </message>
- <message>
<location filename="../tools/linguist/linguist/translatedialog.ui"/>
<source>This window allows you to search for some text in the translation source file.</source>
<translation>Dieses Fenster erlaubt die Suche in der Übersetzungsdatei.</translation>
@@ -2703,25 +1977,6 @@ Alle Dateien (*)</translation>
</message>
</context>
<context>
- <name>TranslationSettings</name>
- <message>
- <source>Qt Linguist - Translation file settings</source>
- <translation type="obsolete">Qt Linguist - Einstellungen der Übersetzungsdatei</translation>
- </message>
- <message>
- <source>Target language</source>
- <translation type="obsolete">Zielsprache</translation>
- </message>
- <message>
- <source>Language</source>
- <translation type="obsolete">Sprache</translation>
- </message>
- <message>
- <source>Country/Region</source>
- <translation type="obsolete">Land/Region</translation>
- </message>
-</context>
-<context>
<name>TranslationSettingsDialog</name>
<message>
<location filename="../tools/linguist/linguist/translationsettingsdialog.cpp" line="+68"/>
@@ -2755,47 +2010,4 @@ Alle Dateien (*)</translation>
<translation>Zielsprache</translation>
</message>
</context>
-<context>
- <name>databaseTranslationDialog</name>
- <message>
- <source>Qt Linguist - Batch Translation</source>
- <translation type="obsolete">Qt Linguist - Automatische Übersetzung</translation>
- </message>
- <message>
- <source>Options</source>
- <translation type="obsolete">Optionen</translation>
- </message>
- <message>
- <source>Only translate entries with no translation</source>
- <translation type="obsolete">Übersetze nur Einträge ohne bisherige Übersetzung</translation>
- </message>
- <message>
- <source>Set translated entries to finished</source>
- <translation type="obsolete">Markiere Übersetzung als erledigt</translation>
- </message>
- <message>
- <source>Phrase book preference</source>
- <translation type="obsolete">Wörterbücher</translation>
- </message>
- <message>
- <source>Move up</source>
- <translation type="obsolete">Nach oben</translation>
- </message>
- <message>
- <source>Move down</source>
- <translation type="obsolete">Nach unten</translation>
- </message>
- <message>
- <source>The batch translator will search through the selected phrasebooks in the order given above.</source>
- <translation type="obsolete">Der automatische Übersetzer wird in der angegebenen Reihenfolge durch die ausgewählten Wörterbücher gehen.</translation>
- </message>
- <message>
- <source>&amp;Run</source>
- <translation type="obsolete">&amp;Ausführen</translation>
- </message>
- <message>
- <source>&amp;Cancel</source>
- <translation type="obsolete">&amp;Abbrechen</translation>
- </message>
-</context>
</TS>
diff --git a/translations/qt_help_de.ts b/translations/qt_help_de.ts
index 9d48661f1..8e6cb8562 100644
--- a/translations/qt_help_de.ts
+++ b/translations/qt_help_de.ts
@@ -111,8 +111,9 @@
<context>
<name>QHelpDBReader</name>
<message>
- <location filename="../tools/assistant/lib/qhelpdbreader.cpp" line="+95"/>
+ <location filename="../tools/assistant/lib/qhelpdbreader.cpp" line="+98"/>
<source>Cannot open database &apos;%1&apos; &apos;%2&apos;: %3</source>
+ <extracomment>The placeholders are: %1 - The name of the database which cannot be opened %2 - The unique id for the connection %3 - The actual error string</extracomment>
<translation>Kann Datenbank nicht öffnen: &apos;%1&apos; &apos;%2&apos;: %3</translation>
</message>
</context>
@@ -200,17 +201,22 @@
<translation>Dateien einfügen...</translation>
</message>
<message>
- <location line="+41"/>
+ <location line="+42"/>
+ <source>The referenced file %1 must be inside or within a subdirectory of (%2). Skipping it.</source>
+ <translation>Die referenzierte Datei %1 muss sich im Verzeichnis %2 oder in einem Unterverzeichnis davon befinden. Sie wird übersprungen.</translation>
+ </message>
+ <message>
+ <location line="+7"/>
<source>The file %1 does not exist! Skipping it.</source>
<translation>Die Datei %1 existiert nicht. Wird übersprungen.</translation>
</message>
<message>
- <location line="+7"/>
+ <location line="+6"/>
<source>Cannot open file %1! Skipping it.</source>
<translation>Die Datei %1 kann nicht geöffnet werden. Wird übersprungen.</translation>
</message>
<message>
- <location line="+134"/>
+ <location line="+131"/>
<source>The filter %1 is already registered!</source>
<translation>Der Filter %1 ist bereits registriert.</translation>
</message>
@@ -243,17 +249,27 @@
<context>
<name>QHelpSearchQueryWidget</name>
<message>
- <location filename="../tools/assistant/lib/qhelpsearchquerywidget.cpp" line="+200"/>
+ <location filename="../tools/assistant/lib/qhelpsearchquerywidget.cpp" line="+411"/>
<source>Search for:</source>
<translation>Suche nach:</translation>
</message>
<message>
+ <location line="+5"/>
+ <source>Previous search</source>
+ <translation>Vorige Suche</translation>
+ </message>
+ <message>
+ <location line="+4"/>
+ <source>Next search</source>
+ <translation>Nächste Suche</translation>
+ </message>
+ <message>
<location line="+2"/>
<source>Search</source>
<translation>Suche</translation>
</message>
<message>
- <location line="+16"/>
+ <location line="+20"/>
<source>Advanced search</source>
<translation>Erweiterte Suche</translation>
</message>
@@ -263,22 +279,22 @@
<translation>Worte &lt;B&gt;ähnlich&lt;/B&gt; zu:</translation>
</message>
<message>
- <location line="+5"/>
+ <location line="+6"/>
<source>&lt;B&gt;without&lt;/B&gt; the words:</source>
<translation>&lt;B&gt;ohne&lt;/B&gt; die Wörter:</translation>
</message>
<message>
- <location line="+5"/>
+ <location line="+6"/>
<source>with &lt;B&gt;exact phrase&lt;/B&gt;:</source>
<translation>mit der &lt;B&gt;genauen Wortgruppe&lt;/B&gt;:</translation>
</message>
<message>
- <location line="+5"/>
+ <location line="+6"/>
<source>with &lt;B&gt;all&lt;/B&gt; of the words:</source>
<translation>mit &lt;B&gt;allen&lt;/B&gt; Wörtern:</translation>
</message>
<message>
- <location line="+5"/>
+ <location line="+6"/>
<source>with &lt;B&gt;at least one&lt;/B&gt; of the words:</source>
<translation>mit &lt;B&gt;irgendeinem&lt;/B&gt; der Wörter:</translation>
</message>
@@ -307,7 +323,7 @@
<translation>Ohne Titel</translation>
</message>
<message>
- <location filename="../tools/assistant/lib/qhelpprojectdata.cpp" line="+80"/>
+ <location filename="../tools/assistant/lib/qhelpprojectdata.cpp" line="+85"/>
<source>Unknown token.</source>
<translation>Unbekanntes Token.</translation>
</message>
@@ -347,7 +363,7 @@
<translation>Fehlendes Attribut in Schlagwort in Zeile %1.</translation>
</message>
<message>
- <location line="+83"/>
+ <location line="+123"/>
<source>The input file %1 could not be opened!</source>
<translation>Die Eingabe-Datei %1 kann nicht geöffnet werden.</translation>
</message>